1var T="u">typeof window?window:void 0,vt="u">typeof globalThis?globalThis:T,Je=vt?.navigator,F=vt?.document,Ne=vt?.location,yr=vt?.fetch,Cu=vt?.XMLHttpRequest&&"withCredentials"in new vt.XMLHttpRequest?vt.XMLHttpRequest:void 0,qd=vt?.AbortController,Q0=vt?.CompressionStream,pt=Je?.userAgent;function kg(){return!(!T||T.navigator.onLine===!1)}var kn=typeof globalThis<"u"?globalThis:T;kn&&typeof self>"u"&&(kn.self=kn),kn&&typeof File>"u"&&(kn.File=function(){});var R=T??{},K0="$people_distinct_id",jt="distinct_id",Eu="$device_id",tl="$device_model",Qo="__alias",J0="__cmpns",Hd="$fbc",zs="$fbc_persistence",Ud="$fbp",Qn="$fbp_persistence",cc="__timers",Cg="$autocapture_disabled_server_side",uc="$heatmaps_enabled_server_side",dc="$exception_capture_enabled_server_side",Eg="$error_tracking_suppression_rules",hc="$error_tracking_capture_extension_exceptions",pc="$web_vitals_enabled_server_side",xu="$dead_clicks_enabled_server_side",Tu="$product_tours_enabled_server_side",xg="$logs_capture_enabled_server_side",Tg="$web_vitals_allowed_metrics",js="$session_recording_remote_config",Y0="$session_recording_enabled_server_side",Ig="$replay_sample_rate",_c="$replay_override_sampling",gc="$replay_override_linked_flag",fc="$replay_override_url_trigger",vc="$replay_override_event_trigger",Os="$sesid",br="$session_is_sampled",Mg="$session_past_minimum_duration",Iu="$session_recording_url_trigger_activated_session",Mu="$session_recording_event_trigger_activated_session",Pu="$posthog_sr_group_event_trigger_",Ru="$posthog_sr_group_url_trigger_",Pg="$posthog_sr_group_sampling_",Z0="$debug_first_full_snapshot_timestamp",mc="$sess_rec_flush_size",Gt="$enabled_feature_flags",gi="$active_feature_flags",yc="$early_access_features",ns="$feature_flag_details",Fi="$feature_flag_payloads",rs="$feature_flag_request_id",Kn="$minimal_flag_called_events",Xt="$override_feature_flags",Yi="$override_feature_flag_payloads",Qt="$stored_person_properties",Ai="$stored_group_properties",Rg="$groups",ss="$surveys",Ko="$surveys_loaded_at",Fg="$surveys_activated",Ag="$surveys_activated_session",Lg="$surveys_activated_timestamps",bc="ph_product_tours",X0="$product_tours_activated",ey="$product_tours_activated_session",ty="$conversations_widget_session_id",iy="$conversations_ticket_id",sy="$conversations_widget_state",ny="$conversations_user_traits",Li="$flag_call_reported",Bn="$flag_call_reported_session_id",Sr="$feature_flag_errors",Di="$feature_flag_evaluated_at",St="$user_state",Sc="$client_session_props",ry="$capture_rate_limit",Og="$initial_campaign_params",$g="$initial_referrer_info",$s="$initial_person_info",Fu="$epp",il="$posthog_cookieless",Dg="$cookieless_mode",Ng="$sdk_debug_extensions_init_method",Bg="$sdk_debug_extensions_init_time_ms",Au="$sdk_debug_recording_script_not_loaded",Lu="$sdk_debug_replay_stale_config",Ou="$sdk_debug_replay_event_trigger_status",$u="$sdk_debug_replay_linked_flag_trigger_status",Du="$sdk_debug_replay_matched_recording_trigger_groups",Jn="$sdk_debug_replay_pen
1ding_trigger_conditions",Oa="$sdk_debug_replay_remote_trigger_matching_config",Nu="$sdk_debug_replay_trigger_groups_count",Bu="$sdk_debug_replay_url_trigger_status",oy="$sdk_debug_rrweb_attached",ay="$sdk_debug_rrweb_start_attempted",qg="$session_recording_start_reason",qu="PostHog loadExternalDependency extension not found.",fi="anonymous",Mo="identified",Hg="identified_only",wr="visibilitychange",Jo="beforeunload",Hu="$pageview",Wd="$pageleave",Ug="$identify",zd="$groupidentify";function jd(e,t,i,s,n,r,o){try{var a=e[r](o),l=a.value}catch(c){return void i(c)}a.done?t(l):Promise.resolve(l).then(s,n)}function Ce(e){return function(){var t=this,i=arguments;return new Promise(function(s,n){var r=e.apply(t,i);function o(l){jd(r,s,n,o,a,"next",l)}function a(l){jd(r,s,n,o,a,"throw",l)}o(void 0)})}}function Yn(e){return Yn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Yn(e)}function ly(e,t,i){return(t=(function(s){var n=(function(r){if(Yn(r)!="object"||!r)return r;var o=r[Symbol.toPrimitive];if(o!==void 0){var a=o.call(r,"string");if(Yn(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)})(s);return Yn(n)=="symbol"?n:n+""})(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Vd(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),i.push.apply(i,s)}return i}function b(e){for(var t=1;arguments.length>t;t++){var i=arguments[t]!=null?arguments[t]:{};t%2?Vd(Object(i),!0).forEach(function(s){ly(e,s,i[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):Vd(Object(i)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(i,s))})}return e}var ei=(function(e){return e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.EnablePersonProcessing="enable_person_processing",e.PersonMode="person_mode",e.FeatureFlagDetails="feature_flag_details",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",e.BootstrapFeatureFlags="bootstrap_feature_flags",e.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.AiQueue="ai_queue",e.AiCaptureQueue="ai_capture_queue",e.LogsQueue="logs_queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionStartTimestamp="session_start_timestamp",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay",e.PushRegistered="push_registered",e.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",e.SurveyLastSeenDate="survey_last_seen_date",e.SurveysInProgress="surveys_in_progress",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config",e.FlagsEndpointWasHit="flags_endpoint_was_hit",e.DeviceId="device_id",e})({}),wc=(function(e){return e.GZipJS="gzip-js",e.Base64="base64",e})({}),Gd="min_length",Qd="max_length",cy=["$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"],uy=["token"];function ie(e,t){return e.indexOf(t)!==-1}var $a=function(e){return e.trim()},kc=function(e){return e.replace(/^\$/,"")};function Wg(e){var t;let i=[];return(t=JSON.stringify(e,function(s,n){if(typeof n=="bigint")return n.toString();if(typeof n!="function"&&typeof n!="symbol"){if(n instanceof Error)return{name:n.name,message:n.message,stack:n.stack};if(n&&typeof n=="object"){for(;i.length>0&&i[i.length-1]!==this;)i.pop();if(i.includes(n))return"[Circular]";i.push(n)}return n}}))!==null&&t!==void 0?t:"null"}var zg=Object.prototype,Lr=zg.hasOwnProperty,Da=zg.toString,W=Array.isArray||function(e){return Da.call(e)==="[object Array]"},_e=e=>typeof e=="function",ee=e=>e===Object(e)&&!W(e),Ct=e=>{if(ee(e)){for(let t in e)if(Lr.call(e,t))return!1;return!0}return!1},M=e=>e===void 0,oe=e=>Da.call(e)=="[object String]",Zn=e=>oe(e)&&e.trim().length===0,ue=e=>e===null,Y=e=>M(e)||ue(e),ne=e=>Da.call(e)=="[object Number]"&&e==e,hi=e=>ne(e)&&e>0,Ae=e=>Da.call(e)==="[object Boolean]",jg=e=>e instanceof FormData,dy=e=>ie(cy,e),hy=e=>ie(uy,e);function Vg(e){return e===null||typeof e!="object"}function Yo(e,t){return{}.toString.call(e)===`[object ${t}]`}function hn(e){switch({}
1.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return Gg(e,Error)}}function Uu(e){return"u">typeof Event&&Gg(e,Event)}function Gg(e,t){try{return e instanceof t}catch{return!1}}var py=[!0,"true",1,"1","yes"],sl=e=>ie(py,e),_y=[!1,"false",0,"0","no"],gy=["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"],Kd=function(e,t=[]){if(!e)return!1;let i=e.toLowerCase();return gy.concat(t).some(s=>{let n=s.toLowerCase();return i.indexOf(n)!==-1})};function Tt(e,t,i,s,n){return t>i&&(s.warn("min cannot be greater than max."),t=i),ne(e)?e>i?(s.warn(" cannot be greater than max: "+i+". Using max value instead."),i):t>e?(s.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(s.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+n),Tt(n??i,t,i,s))}var Qg=class{constructor(e){this._buckets={},this._onBucketRateLimited=e._onBucketRateLimited,this._bucketSize=Tt(e.bucketSize,0,100,e._logger),this._refillRate=Tt(e.refillRate,0,this._bucketSize,e._logger),this._refillInterval=Tt(e.refillInterval,0,864e5,e._logger)}_applyRefill(e,t){let i=Math.floor((t-e.lastAccess)/this._refillInterval);i>0&&(e.tokens=Math.min(e.tokens+i*this._refillRate,this._bucketSize),e.lastAccess=e.lastAccess+i*this._refillInterval)}consumeRateLimit(e){var t;let i=Date.now(),s=String(e),n=this._buckets[s];return n?this._applyRefill(n,i):(n={tokens:this._bucketSize,lastAccess:i},this._buckets[s]=n),n.tokens===0||(n.tokens--,n.tokens===0&&((t=this._onBucketRateLimited)===null||t===void 0||t.call(this,e)),n.tokens===0)}stop(){this._buckets={}}},Zs="Mobile",kr="Android",Zo="Tablet",Kg="Android Tablet",Jg="iPad",Yg="Apple Watch",Po="Safari",Na="BlackBerry",Zg="Samsung Internet",Ro="Chrome",Xg="Chrome iOS",ef="Internet Explorer",tf="Internet Explorer Mobile",sf="Opera",nf="Microsoft Edge",Fo="Firefox",rf="Firefox iOS",Xo="Nintendo",ea="PlayStation",Ba="Xbox",of="Android Mobile",af="Mobile Safari",nl="Windows",lf="Windows Phone",Jd="Nokia",Cc="Ouya",fy="Generic "+Zs.toLowerCase(),cf="Generic "+Zo.toLowerCase(),Ec="Konqueror",uf="Oculus Browser",df="Vivaldi",hf="Yandex",pf="Whale",_f="DuckDuckGo",gf="Pale Moon",ff="Waterfox",xc="Brave",vf="Claude",mf="Codex",yf="ChatGPT",bf="Google Search App",rl=new RegExp("Version/(\\d+(\\.\\d+)?)"),ol=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),vy=new RegExp(Ba,"i"),my=new RegExp("PlayStation \\w+","i"),yy=new RegExp("Nintendo \\w+","i"),Wu=new RegExp("BlackBerry|PlayBook|BB10","i"),by={"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"},Sf=function(e,t,i,s){return t=t||"",(function(r){return r?.brave?xc:null})(i)||(s?.detectGoogleSearchApp&&ie(e,"GSA/")?bf:ie(e," OPR/")&&ie(e,"Mini")?"Opera Mini":ie(e," OPR/")?sf:Wu.test(e)?Na:ie(e,"IEMobile")||ie(e,"WPDesktop")?tf:ie(e,"OculusBrowser")?uf:ie(e,"SamsungBrowser")?Zg:ie(e,"Edge")||ie(e,"Edg/")?nf:ie(e,"Vivaldi/")?df:ie(e,"YaBrowser/")?hf:ie(e,"Whale/")?pf:ie(e,"DuckDuckGo/")||ie(e,"Ddg/")?_f:ie(e,"Claude/")?vf:ie(e,"Codex/")?mf:ie(e,"ChatGPT/")?yf:ie(e,"FBIOS")?"Facebook Mobile":ie(e,"UCWEB")||ie(e,"UCBrowser")?"UC Browser":ie(e,"CriOS")?Xg:ie(e,"CrMo")||ie(e,Ro)?Ro:ie(e,kr)&&ie(e,Po)?of:ie(e,"FxiOS")?rf:ie(e.toLowerCase(),Ec.toLowerCase())?Ec:ie(e,"Brave/")?xc:((r,o)=>o&&ie(o,"Apple")||(function(a){return ie(a,Po)&&!ie(a,Ro)&&!ie(a,kr)})(r))(e,t)?ie(e,Zs)?af:Po:ie(e,"PaleMoon/")?gf:ie(e,"Waterfox/")?ff:ie(e,Fo)?Fo:ie(e,"MSIE")||ie(e,"Trident/")?ef:ie(e,"Gecko")?Fo:"")},Sy={[tf]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[nf]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[Ro]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[Xg]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[Po]:[rl],[af]:[rl],[sf]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[Fo]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[rf]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[Ec]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[Na]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),rl],[of]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[Zg]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[uf]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[df]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[hf]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[pf]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[xc]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[vf]:[ol],[mf]:[ol],[yf]:[ol],[_f]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[gf]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[ff]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[bf]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[ef]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},wy=function(e,t,i,s){let n=Sf(e,t,i,s),r=Sy[n];if(M(r))return null;for(let o=0;r.length>
1o;o++){let a=e.match(r[o]);if(a)return parseFloat(a[a.length-2])}return null},Yd=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),e=>[Ba,e&&e[1]||""]],[new RegExp(Xo,"i"),[Xo,""]],[new RegExp(ea,"i"),[ea,""]],[Wu,[Na,""]],[new RegExp(nl,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[lf,""];if(new RegExp(Zs).test(t)&&!/IEMobile\b/.test(t))return["Windows Mobile",""];let i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){let s=by[i[1]]||"";return/arm/i.test(t)&&(s="RT"),[nl,s]}return[nl,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?["iOS",[e[3],e[4],e[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{let t="";return e&&e.length>=3&&(t=M(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),e=>e&&e[2]?[kr,[e[2],e[3],e[4]||"0"].join(".")]:[kr,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{let t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],wf=function(e){for(let t=0;Yd.length>t;t++){let[i,s]=Yd[t],n=i.exec(e),r=n&&(_e(s)?s(n,e):s);if(r)return r}return["",""]},kf=function(e){return yy.test(e)?Xo:my.test(e)?ea:vy.test(e)?Ba:new RegExp(Cc,"i").test(e)?Cc:new RegExp("(Windows Phone|WPDesktop)","i").test(e)?lf:/iPad/.test(e)?Jg:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?Yg:Wu.test(e)?Na:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Jd,"i").test(e)?Jd:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(Zs).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?kr:Kg:new RegExp("(pda|Mobile)","i").test(e)?fy:new RegExp(Zo,"i").test(e)&&!new RegExp("Tablet pc","i").test(e)?cf:""},Cf=function(e,t){var i;let s=kf(e);return s===Jg||s===Kg||s==="Kobo"||s==="Kindle Fire"||s===cf?Zo:s===Xo||s===Ba||s===ea||s===Cc?"Console":s===Yg?"Wearable":s?Zs:t?.userAgentDataPlatform==="Android"&&((i=t?.maxTouchPoints)!==null&&i!==void 0?i:0)>0?600>Math.min((n=t?.screenWidth)!==null&&n!==void 0?n:0,(r=t?.screenHeight)!==null&&r!==void 0?r:0)/((o=t?.devicePixelRatio)!==null&&o!==void 0?o:1)?Zs:Zo:"Desktop";var n,r,o},al=/\bFBAV\/(\d+(?:\.\d+)*)/i,Zd=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",al],[/\bFBAN\/EMA\b/i,"Facebook Lite",al],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",al],[/\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"]],Tc="[Truncated]",Or="[Unserializable]";function Vs(e){let t="";for(let i=0;e.length>i;i++){let s=e.charCodeAt(i);if(55296>s||s>56319)t+=56320>s||s>57343?e[i]:"\uFFFD";else{let n=e.charCodeAt(i+1);56320>n||n>57343?t+="\uFFFD":(t+=e[i]+e[i+1],i++)}}return t}function Ef(e,t){if(!t)return e;let i=[];try{i=Object.keys(t)}catch{i=[]}for(let s of i){let n;try{n=t[s]}catch{n=Or}Object.defineProperty(e,s,{value:n,enumerable:!0,writable:!0,configurable:!0})}return e}var Ao=3e5,xf=class{record(e){if(e.kind==="too-large")return;if(e.kind!=="retry-later")return void this.reset();if(!e.retryAfterMs)return;let t=this.isOpen(),i=Date.now(),s=Math.min(e.retryAfterMs,Ao);if(!t)return this._installedAt=i,void(this._until=i+s);this._until=Math.max(this._until,Math.min(i+s,this._installedAt+Ao))}remainingMs(){let e=Date.now();if(this._installedAt-5e3>e)return this.reset(),0;let t=Math.min(Ao,Math.max(0,this._until-e));return t===0&&this.reset(),t}isOpen(){return this.remainingMs()>0}reset(){this._until=0,this._installedAt=0}constructor(){this._until=0,this._installedAt=0}},ky=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Xd(e,t){return typeof(i=e)=="string"&&ky.test(i)?e:t();var i}function Tf(e,t){let i=new Error(t);try{Object.defineProperty(i,"name",{value:e,writable:!0,enumerable:!0,configurable:!0})}catch{}return i}function ni(e){return e&&e.split("#")[0]}function ta(e){try{return e()}catch{return}}function If(e,t){let i=setTimeout(e,t);return i!=null&&i.unref&&i?.unref(),i}function eh(e,t,i){return Mf.apply(this,arguments)}function Mf(){return(Mf=Ce(function*(e,t,i){let s;try{return yield Promise.race([e,new Promise((n,r)=>{s=If(()=>{try{i?.(),n()}catch(o){r(o)}},t)})])}finally{clearTimeout(s)}})).apply(this,arguments)}var Gr,th,ll;function Cy(e){let t=globalThis._posthogChunkIds;if(!t)return;let i=Object.keys(t);return ll&&i.length===th||(th=i.length,ll=i.reduce((s,n)=>{Gr||(Gr={});let r=Gr[n];if(r)s[r[0]]=r[1];else{let o=e(n);for(let a=o.length-1;a>=0;a--){let l=o[a],c=l?.filename,d=t[n];if(c&&d){s[c]=d,Gr[n]=[c,d];break}}}return s},{})),ll}var Ey=class{constructor(e,t,i=[]){this.coercers=e,this.stackParser=t,this.modifiers=i}buildFromUnknown(e,t={}){let i=t&&t.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(i,t,0).apply(e),n=this.buildParsingContext(t),r=this.parseStacktrace(s,n);return{$exception_list:this.convertToExceptionList(r,i),$exception_level:"error"}}modifyFrames(e){var t=this;return Ce(function*(){for(let i of e)i.stacktrace&&i.stacktrace.frames&&W(i.stacktrace.frames)&&(i.stacktrace.frames=yield t.applyModifiers(i.stacktrace.frames));return e})()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:(t=e.syntheticException)===null||t===void 0?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var i;let s,n;if(e.cause!=null&&(s=this.parseStacktrace(e.cause,t)),e.stack!=""&&e.stack!=null)try{n=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.ski
1pFirstLines:0),t.chunkIdMap)}catch{}return b(b({},e),{},{cause:s,stack:n,errors:(i=e.errors)===null||i===void 0?void 0:i.map(r=>this.parseStacktrace(r,t))})}applyChunkIds(e,t){return e.map(i=>(i.filename&&t&&(i.chunk_id=t[i.filename]),i))}applyCoercers(e,t){for(let i of this.coercers)if(i.match(e))return i.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return Ce(function*(){let i=e;for(let s of t.modifiers)i=yield s(i);return i})()}convertToExceptionList(e,t){let i=[],s=(n,r,o)=>{var a;let l=i.length,c=r===void 0?b(b({type:typeof t.type=="string"&&t.type.length>0?t.type:"generic"},typeof t.handled=="boolean"?{handled:t.handled}:t.handled===void 0?{handled:!0}:{}),{},{synthetic:typeof t.synthetic=="boolean"?t.synthetic:n.synthetic,exception_id:l}):{type:"chained",source:o,synthetic:n.synthetic,exception_id:l,parent_id:r},d={type:n.type,value:n.value,mechanism:c};n.stack&&(d.stacktrace={type:"raw",frames:n.stack}),i.push(d),n.cause&&s(n.cause,l,"cause");for(let h of(a=n.errors)!==null&&a!==void 0?a:[])s(h,l,"member")};return s(e),i}buildParsingContext(e){var t;return{chunkIdMap:Cy(this.stackParser),skipFirstLines:(t=e.skipFirstLines)!==null&&t!==void 0?t:1}}getAggregateErrors(e){try{if(hn(e)){let i=Object.getPrototypeOf(e);for(let s=0;i&&100>s;s++){var t;let n=(t=Object.getOwnPropertyDescriptor(i,"constructor"))===null||t===void 0?void 0:t.value;if(typeof n=="function"&&n.name==="AggregateError"){let r=e.errors;return W(r)?r:void 0}i=Object.getPrototypeOf(i)}}}catch{}}buildCoercingContext(e,t,i=0){let s=0,n=0,r=!1,o=new Set,a=[],l={},c=(u,p,_=0)=>{let g=d(p,_),v=g.apply;if(g.apply=x=>{a.push(u);try{return v(x)}finally{a.pop()}},_>4||_>0&&a.indexOf(u)!==-1)return this.coerceFallback(g);let f=typeof u=="object"&&u!==null||typeof u=="function";if(_===0&&s>=50||f&&o.has(u))return;f&&o.add(u),_===0&&s++;let m=this.getAggregateErrors(u),y,w;r||(r=!!m);try{if(y=this.applyCoercers(u,g),!y)throw l}catch(x){if(x===l)return void(_===0&&s--);if(!r)throw x;y=this.coerceFallback(g)}if(!m||s>=50)return y;try{w=m.length}catch{return y}if(!Number.isInteger(w)||0>w||w>4294967295)return y;let S=[];for(let x=0;50>s&&1e3>n&&w>x;x++){let k;n++;try{k=g.next(m[x])}catch{s++,k=this.coerceFallback(d(p+1))}k&&S.push(k)}return b(b({},y),{},{errors:S})},d=(u,p=0)=>b(b({},t),{},{syntheticException:u==0?t.syntheticException:void 0,mechanism:u==0?e:{},apply(_){let g=c(_,u,p+1);if(!g)throw l;return g},next:_=>c(_,u+1)}),h=d(i);return b(b({},h),{},{apply:u=>{var p;return(p=c(u,i))!==null&&p!==void 0?p:this.coerceFallback(h)}})}},xy=/^([a-z][a-z0-9.+-]+):/i,Ty=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function Iy(e){if(!e||e==="<anonymous>")return!1;let t=xy.exec(e);return!t||Ty.includes(t[1].toLowerCase())}function Ic(e,t,i,s,n){let r={platform:e,filename:t,function:i==="<anonymous>"?"?":i,in_app:Iy(t)};return M(s)||(r.lineno=s),M(n)||(r.colno=n),r}var Pf=(e,t)=>{let i=e.indexOf("safari-extension")!==-1,s=e.indexOf("safari-web-extension")!==-1;return i||s?[e.indexOf("@")!==-1?e.split("@")[0]:"?",i?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},My=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Py=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Ry=/\((\S*)(?::(\d+))(?::(\d+))\)/,Fy=(e,t)=>{let i=My.exec(e);if(i){let[,n,r,o]=i;return Ic(t,n,"?",+r,+o)}let s=Py.exec(e);if(s){if(s[2]&&s[2].indexOf("eval")===0){let o=Ry.exec(s[2]);o&&(s[2]=o[1],s[3]=o[2],s[4]=o[3])}let[n,r]=Pf(s[1]||"?",s[2]);return Ic(t,r,n,s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}},Ay=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Ly=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Oy=(e,t)=>{let i=Ay.exec(e);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){let r=Ly.exec(i[3]);r&&(i[1]=i[1]||"eval",i[3]=r[1],i[4]=r[2],i[5]="")}let s=i[3],n=i[1]||"?";return[n,s]=Pf(n,s),Ic(t,s,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},ih=/\(error: (.*)\)/;function zu(e,t){return e.filename===t.filename&&e.function===t.function&&e.module===t.module&&e.lineno===t.lineno&&e.colno===t.colno}function $y(e){for(let t=1;10>=t;t++){let i=e.length-2*t;if(0>i)break;let s=!0;for(let n=0;t>n;n++)if(!zu(e[i+n],e[i+t+n])){s=!1;break}if(s){for(let n=0;t>n;n++)e[i+n]=e[i+t+n];return e.length=i+t,{start:i,length:t}}}}function Dy(e,t){let i=t.start+t.length,s=Ff(e,t);
1s&&e.splice(i+s===e.length?i:t.start,s)}function Rf(e,t){let i=t.start;for(;i>0&&zu(e[i-1],e[i-1+t.length]);)i--;return t.start-i}function Ff(e,t){let i=t.start+t.length,s=i;for(;e.length>s&&zu(e[s],e[s-t.length]);)s++;return s-i}function Ny(e,t){let i=t[0],s=e.length-(i?Rf(e,i):0);for(let n of t)s-=Ff(e,n);return s}function By(e,t,i){for(let s=0;e.length>s;s++){let n=e[(t+s)%e.length],r=e[(i+s)%e.length];if(n!==r)return r>n}return!1}var qy=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){let i=oe(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:i?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){let t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?`${t}: ${e.message}`:t}isDOMException(e){return Yo(e,"DOMException")}isDOMError(e){return Yo(e,"DOMError")}},Hy=class{match(e){return hn(e)}coerce(e,t){var i;let s=this.getStack(e),n=s===void 0?(i=t.syntheticException)===null||i===void 0?void 0:i.stack:void 0,r=!!n;return{type:this.getType(e),value:this.getMessage(e,t),stack:s??n,cause:e.cause?t.next(e.cause):void 0,synthetic:r}}getType(e){return e.name||e.constructor.name}getMessage(e,t){let i=e.message;return String(i.error&&typeof i.error.message=="string"?i.error.message:i)}getStack(e){try{let t=e.stacktrace;if(typeof t=="string"&&t.length>0)return t;let i=e.stack;return typeof i=="string"&&i.length>0?i:void 0}catch{return}}},Uy=class{match(e){return!!Yo(e,"ErrorEvent")&&(e.error!=null||this._hasUsableMessage(e))}coerce(e,t){var i;if(e.error!=null)return t.apply(e.error);let s=t.apply(e.message);return b(b({},s),{},{stack:(i=this._buildLocationStack(e))!==null&&i!==void 0?i:s.stack,synthetic:!0})}_hasUsableMessage(e){return oe(e.message)&&e.message.length>0}_buildLocationStack(e){var t,i;let s=e,n=(t=s.lineno)!==null&&t!==void 0?t:0,r=(i=s.colno)!==null&&i!==void 0?i:0;if(oe(s.filename)&&s.filename.length!==0&&n!==0)return`Error 2 at ${s.filename}:${n}:${r}`}},Wy=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,zy=class{match(e){return typeof e=="string"}coerce(e,t){var i;let[s,n]=this.getInfos(e);return{type:s??"Error",value:n??e,stack:(i=t.syntheticException)===null||i===void 0?void 0:i.stack,synthetic:!0}}getInfos(e){let t="Error",i=e,s=e.match(Wy);return s&&(t=s[1],i=s[2]),[t,i]}},jy=["fatal","error","warning","log","info","debug"];function Af(e,t=40){let i=Object.keys(e);if(i.sort(),!i.length)return"[object has no keys]";for(let s=i.length;s>0;s--){let n=i.slice(0,s).join(", ");if(t>=n.length)return s===i.length?n:n.length>t?`${n.slice(0,t)}...`:n}return""}var Vy=class{match(e){return typeof e=="object"&&e!==null}coerce(e,t){var i,s;let n=this.getErrorPropertyFromObject(e);return n?t.apply(n):{type:this.getType(e),value:this.getValue(e),stack:(i=this.getStack(e))!==null&&i!==void 0?i:(s=t.syntheticException)===null||s===void 0?void 0:s.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){if(Uu(e))return e.constructor.name;let t="name"in e?e.name:void 0;return oe(t)&&!Zn(t)?t:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){let i=`'${e.name}' captured as exception`;return"message"in e&&typeof e.message=="string"&&(i+=` with message: '${e.message}'`),i}if("message"in e&&typeof e.message=="string")return e.message;let t=this.getObjectClassName(e);return`${t&&t!=="Object"?`'${t}'`:"Object"} captured as exception with keys: ${Af(e)}`}isSeverityLevel(e){return oe(e)&&!Zn(e)&&jy.indexOf(e)>=0}getStack(e){try{return oe(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:oe(e.stack)&&e.stack.length>0?e.stack:void 0}catch{return}}getErrorPropertyFromObject(e){for(let t in e)if({}.hasOwnProperty.call(e,t)){let i=e[t];if(hn(i))return i}}getObjectClassName(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},Gy=class{match(e){return Uu(e)}coerce(e,t){var i;let s=e.constructor.name;return{type:s,value:`${s} captured as exception with keys: ${Af(e)}`,stack:(i=t.syntheticException)===null||i===void 0?void 0:i.stack,synthetic:!0}}},Qy=class{match(e){return Vg(e)}coerce(e,t){var i;return{type:"Error",value:`Primitive value captured as exception: ${String(e)}`,stack:(i=t.syntheticException)===null||i===void 0?void 0:i.stack,synthetic:!0}}},Ky=class{match(e){return Yo(e,"PromiseRejectionEvent")||this.isCu
2stomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!Uu(e))return!1;try{let t=e.detail;return t!=null&&typeof t=="object"&&"reason"in t}catch{return!1}}coerce(e,t){var i;let s=this.getUnhandledRejectionReason(e);return Vg(s)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(s)}`,stack:(i=t.syntheticException)===null||i===void 0?void 0:i.stack,synthetic:!0}:t.apply(s)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&e.detail!=null&&typeof e.detail=="object"&&"reason"in e.detail)return e.detail.reason}catch{}return e}},ia="$message",sa="$timestamp",Jy=new Set([ia,sa]),cl={enabled:!0,max_bytes:32768};function na(e){var t;return e?{enabled:(t=e.enabled)!==null&&t!==void 0?t:cl.enabled,max_bytes:Zy(e.max_bytes,cl.max_bytes)}:b({},cl)}var Yy=class{constructor(e){this._entries=[],this._totalBytes=0,this._config=na(e)}setConfig(e){this._config=na(e),this._trimToMaxBytes()}add(e){let t=(function(s){let n;try{n=Wg(s)}catch{return}try{let r=JSON.parse(n);if(!ee(r))return;let o=r,a=o[ia],l=o[sa];return!oe(a)||a.trim().length===0||!oe(l)&&!ne(l)?void 0:{step:o,json:n}}catch{return}})(e);if(!t)return;let i=(function(s){if("u">typeof TextEncoder)return new TextEncoder().encode(s).length;let n=encodeURIComponent(s),r=0;for(let o=0;n.length>o;o++)n[o]==="%"?(r+=1,o+=2):r+=1;return r})(t.json);i>this._config.max_bytes||(this._entries.push({step:t.step,bytes:i}),this._totalBytes+=i,this._trimToMaxBytes())}getAttachable(){return this._entries.map(e=>e.step)}clear(){this._entries=[],this._totalBytes=0}size(){return this._entries.length}_trimToMaxBytes(){for(;this._totalBytes>this._config.max_bytes&&this._entries.length>0;){let e=this._entries.shift();e&&(this._totalBytes-=e.bytes)}}};function Zy(e,t){if(!ne(e)||e===1/0||e===-1/0)return t;let i=Math.floor(e);return 0>i?t:i}var sh=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}};function nh(e){return typeof e=="string"||e}function rh(e){return typeof e=="string"?e:void 0}var Xy=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","oppref","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],Lf="NativeGzipValidationError",Mc=e=>e.length>=2&&e[0]===31&&e[1]===139,oh=(e,t)=>e===wc.GZipJS||t===wc.GZipJS||t==="gzip",Of=e=>!(!e||typeof e!="object")&&("name"in e?String(e.name):"")==="NotReadableError",$f=e=>{if(!e||typeof e!="object")return!1;let t="name"in e?String(e.name):"";return Of(e)||t===Lf},Cn,Qr=e=>{throw Tf(Lf,`Native gzip produced invalid output: ${e}`)},eb=(ah=Ce(function*(e,t){18>e.size&&Qr("too-short");let i=new Uint8Array(yield e.slice(0,10).arrayBuffer());Mc(i)&&i[2]===8||Qr("invalid-header");let s=new DataView(yield e.slice(e.size-8).arrayBuffer());s.getUint32(0,!0)!==(r=>{let o=(()=>{if(Cn)return Cn;Cn=[];for(let l=0;256>l;l++){let c=l;for(let d=0;8>d;d++)c=1&c?3988292384^c>>>1:c>>>1;Cn[l]=c>>>0}return Cn})(),a=4294967295;for(let l=0;r.length>l;l++)a=o[255&(a^r[l])]^a>>>8;return(4294967295^a)>>>0})(t)&&Qr("invalid-crc");let n=t.length>>>0;s.getUint32(4,!0)!==n&&Qr("invalid-size")}),function(e,t){return ah.apply(this,arguments)}),ah;function Df(e){return Pc.apply(this,arguments)}function Pc(){return Pc=Ce(function*(e,t=!0,i){try{let n=new TextEncoder().encode(e),r=new globalThis.CompressionStream("gzip"),o=r.writable.getWriter(),a=o.write(n).then(()=>o.close()).catch((s=Ce(function*(d){try{yield o.abort(d)}catch{}throw d}),function(d){return s.apply(this,arguments)})),l=new Response(r.readable).blob(),[c]=yield Promise.all([l,a]);return yield eb(c,n),c}catch(n){if(i?.rethrow)throw n;return t&&console.error("Failed to gzip compress data",n),null}var s}),Pc.apply(this,arguments)}function ju(e,t){if(e==null)return{};var i,s,n=(function(o,a){if(o==null)return{};var l={};for(var c in o)if({}.hasOwnProperty.call(o,c)){if(a.includes(c))continue;l[c]=o[c]}return l})(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(s=0;r.length>s;s++)t.includes(i=r[s])||{}.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}var tb={}.propertyIsEnumerable;function ra(e,t){try{return Nf(e,t,{ancestors:new WeakSet,remainingNodes:1e4}
2,0)}catch{return[]}}function Vu(e,t,i,s){if(0>=i.remainingNodes)return{stringValue:Tc};if(i.remainingNodes--,Ae(e))return{boolValue:e};if(typeof e=="bigint")return(function(n,r){let o=n.toString(),a=BigInt("9223372036854775808");return n>=a||-a>n?(r?.debug(`Attribute ${o} is outside the int64 range; encoding it as a string`),{stringValue:o}):{intValue:o}})(e,t);if(typeof e=="number"){if(!Number.isFinite(e))return{stringValue:String(e)};if(Number.isInteger(e)){if(Number.isSafeInteger(e))return{intValue:String(e)};if(typeof BigInt>"u")return{stringValue:String(e)};let n=BigInt(e).toString();return e>=9223372036854776e3||-9223372036854776e3>e?(t?.debug(`Attribute ${n} is outside the int64 range; encoding it as a string`),{stringValue:n}):{intValue:n}}return{doubleValue:e}}if(typeof e=="string")return{stringValue:Vs(e)};if(typeof e=="function")return{stringValue:"[Function]"};if(typeof e=="symbol")return{stringValue:String(e)};if(typeof e=="object"&&e!==null){if(i.ancestors.has(e))return{stringValue:"[Circular]"};if(s>=20)return{stringValue:Tc};if(e instanceof Date){let n=e.getTime(),r=Number.isFinite(n)?e.toISOString():String(e);return{stringValue:typeof r=="string"?Vs(r):String(r)}}i.ancestors.add(e);try{try{let n=e.toJSON;if(typeof n=="function")return Vu(n.call(e),t,i,s+1)}catch{}return W(e)?{arrayValue:{values:ib(e,t,i,s+1)}}:{kvlistValue:{values:Nf(e,t,i,s+1)}}}finally{i.ancestors.delete(e)}}return{stringValue:Vs(String(e))}}function ib(e,t,i,s){let n=[],r=Math.min(e.length,1e3),o=0;for(;r>o&&i.remainingNodes>0;o++)try{let a=o in e?e[o]:void 0;if(Y(a))continue;n.push(Vu(a,t,i,s))}catch{n.push({stringValue:Or})}return e.length>o&&n.push({stringValue:Tc}),n}function Nf(e,t,i,s){let n=[];for(let r in e)if(tb.call(e,r)){if(!r){t?.debug("Dropping an attribute with an empty key");continue}if(n.length>=1e3||0>=i.remainingNodes){t?.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{let o=e[r];if(ue(o)||M(o))continue;n.push({key:Vs(r),value:Vu(o,t,i,s)})}catch{n.push({key:Vs(r),value:{stringValue:Or}})}}return n}function Bf(e,t,i){return b(b(b(b({},Ef({},e.resourceAttributes)),{},{"service.name":e.serviceName||"unknown_service"},e.environment&&{"deployment.environment":e.environment}),e.serviceVersion&&{"service.version":e.serviceVersion}),{},{"telemetry.sdk.name":t,"telemetry.sdk.version":i})}var sb=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function qf(e,t){let i=Ef({},e),s={};for(let n of sb)({}).hasOwnProperty.call(i,n)&&(s[n]=i[n],delete i[n]);return[...ra(i,t),...ra(s,t)]}var lh={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"},Hf={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}},nb=Hf.info;function rb(e){try{return Vs(String(e))}catch{return Or}}function ob(e,t,i,s){let n=e.level||"info",{text:r,number:o}=Hf[n]||nb,a=(function(u=Date.now()){return String(u)+"000000"})(ne(s)?s:void 0),l={};t.distinctId&&(l.posthogDistinctId=t.distinctId),t.sessionId&&(l.sessionId=t.sessionId),t.windowId&&(l["window.id"]=t.windowId),Y(t.sessionStartTimestamp)||(l.sessionStartTimestamp=String(t.sessionStartTimestamp)),Y(t.lastActivityTimestamp)||(l.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(l["url.full"]=t.currentUrl),t.screenName&&(l["screen.name"]=t.screenName),t.appState&&(l["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(l.feature_flags=t.activeFeatureFlags);let c=b({},l),d=e.attributes;if(d){let u=[];try{u=Object.keys(d)}catch{u=[]}for(let p of u){let _;try{_=d[p]}catch{_=Or}Object.defineProperty(c,p,{value:_,enumerable:!0,writable:!0,configurable:!0})}}let h={timeUnixNano:a,observedTimeUnixNano:a,severityNumber:o,severityText:r,body:{stringValue:rb(e.body)},attributes:ra(c,i)};return e.trace_id&&(h.traceId=e.trace_id),e.span_id&&(h.spanId=e.span_id),M(e.trace_flags)||(h.flags=e.trace_flags),h}function Uf(e,t,i){return Bf(e,t,i)}function Wf(e,t,i,s){return{resourceLogs:[{resource:{attributes:qf(t)},scopeLogs:[{scope:{name:i,version:s},logRecords:e}]}]}}var zf=class{constructor(e){this._onFire=e,this._firesAt=0}get pending(){return!!this._timer}arm(e){this.clear(),this._firesAt=Date.now()+e,this._timer=If(()=>{this._timer=void 0,this._onFire()},e)}armNoEarlierThan(e){this._timer&&Date.now()+e<=this._firesAt||this.arm(e)}clear(){this._timer&&(clearTimeout(this._timer),this._timer=void 0)}};function jf(){return .75+.5*Math.random()}function Vf(e,t,i,s){let n=Math.min(Math.max(0,t-1),6),r=e*Math.pow(2,n);return Math.round((s===void 0?r:Math.min(r,Math.max(s,e)))*i)}var ab=class{constructor(e,t,i,s,n,r=()=>Promise.resolve(),o){var a;this._instance=e,this._config=t,this._logger=i,this._getContext=s,this._onReady=n,this._waitForStoragePersist=r,this._scopeName=o,this._flushTimer=new zf(()=>
2this._flushInBackground()),this._flushPromise=null,this._evictedSinceAdvance=0,this._queueGeneration=0,this._retryAfter=new xf,this._consecutiveFlushFailures=0,this._flushJitter=1,this._intervalWindowStart=0,this._intervalLogCount=0,this._droppedWarned=!1,this._maxBufferSize=t.maxBufferSize,this._maxQueueSize=Math.max((a=t.maxQueueSize)!==null&&a!==void 0?a:t.maxBufferSize,t.maxBufferSize),this._flushIntervalMs=t.flushIntervalMs,this._maxBatchRecordsPerPost=t.maxBatchRecordsPerPost,this._rateCapWindowMs=t.rateCapWindowMs,this._maxLogsPerInterval=t.maxLogsPerInterval}clearQueue(){this._queueGeneration++,this._instance.setPersistedProperty(ei.LogsQueue,[])}reset(){this._flushTimer.clear(),this._intervalWindowStart=0,this._intervalLogCount=0,this._droppedWarned=!1,this._consecutiveFlushFailures=0,this._flushJitter=1,this._retryAfter.reset(),this._maxBatchRecordsPerPost=this._config.maxBatchRecordsPerPost}onReconnect(){this._consecutiveFlushFailures=0,this._flushJitter=1,this._retryAfter.isOpen()?this._hasQueuedRecords()&&this._armFlushTimer():this._flushInBackground()}captureLog(e,t){var i;if(this._instance.isDisabled||this._instance.optedOut||!e?.body)return;let s=this._runBeforeSend(e);if(s===null)return;if(!s.body)return void this._logger.info("Log was rejected in beforeSend function");if(!this._checkRateLimit())return;let n={record:ob(s,(i=t?.context)!==null&&i!==void 0?i:this._getContext(),this._logger,t?.occurredAtMs)};this._onReady(()=>this._enqueue(n))}_runBeforeSend(e){let t=this._config.beforeSend;if(!t)return e;let i=W(t)?t:[t],s=e;for(let n of i)try{let r=n(s);if(!r)return this._logger.info("Log was rejected in beforeSend function"),null;s=r}catch(r){return this._logger.error("Error in beforeSend function for log:",r),null}return s}_checkRateLimit(){if(this._maxLogsPerInterval===void 0)return!0;let e=Date.now(),t=e-this._intervalWindowStart;return this._rateCapWindowMs>t&&t>=0||(this._intervalWindowStart=e,this._intervalLogCount=0,this._droppedWarned=!1),this._maxLogsPerInterval>this._intervalLogCount?(this._intervalLogCount++,!0):(this._droppedWarned||(this._logger.warn(`captureLog dropping logs: exceeded ${this._maxLogsPerInterval} logs per ${this._rateCapWindowMs}ms`),this._droppedWarned=!0),!1)}flush(){var e=this;return Ce(function*(){if(!e._instance.isDisabled)return e._flushPromise||(e._flushPromise=e._flushInner().finally(()=>{e._flushPromise=null})),e._flushPromise})()}_flushInner(){var e=this;return Ce(function*(){var t;e._flushTimer.clear();let i=(t=e._instance.getPersistedProperty(ei.LogsQueue))!==null&&t!==void 0?t:[];if(i.length===0)return;let s=i.length,n=0;for(;i.length>0&&s>n;){var r,o;let a=e._queueGeneration;e._evictedSinceAdvance=0;let l=Math.min(i.length,e._maxBatchRecordsPerPost),c=i.slice(0,l),d=Wf(c.map(u=>u.record),e._buildResourceAttributes(),(r=e._scopeName)!==null&&r!==void 0?r:e._instance.getLibraryId(),e._instance.getLibraryVersion()),h=yield e._instance._sendLogsBatch(d);if(e._queueGeneration!==a)return;if(h.kind==="too-large"&&c.length>1)e._maxBatchRecordsPerPost=Math.max(1,Math.floor(c.length/2)),e._logger.warn(`Logs batch of size ${c.length} was too large for the ingestion endpoint, reducing batch size to ${e._maxBatchRecordsPerPost}`);else if(e._retryAfter.record(h),e._flushTimer.pending&&e._flushTimer.arm(Math.max(e._flushIntervalMs,e._retryAfter.remainingMs())),h.kind==="retry-later"||(h.kind==="too-large"?e._logger.warn("Dropping a single log record with batch size 1 \u2014 the record is larger than the server cap and cannot be split further."):h.kind==="ok"&&e._config.maxBatchRecordsPerPost>e._maxBatchRecordsPerPost&&(e._maxBatchRecordsPerPost=Math.min(e._config.maxBatchRecordsPerPost,e._maxBatchRecordsPerPost+1)),yield e._persistQueueAdvance(c.length),i=(o=e._instance.getPersistedProperty(ei.LogsQueue))!==null&&o!==void 0?o:[],n+=c.length,h.kind==="fatal"))throw h.error}})()}_persistQueueAdvance(e){var t=this;return Ce(function*(){var i;let s=Math.max(0,e-t._evictedSinceAdvance),n=(i=t._instance.getPersistedProperty(ei.LogsQueue))!==null&&i!==void 0?i:[];t._instance.setPersistedProperty(ei.LogsQueue,n.slice(s)),yield t._waitForStoragePersist()})()}
2_buildResourceAttributes(){return Uf(this._config,this._instance.getLibraryId(),this._instance.getLibraryVersion())}_enqueue(e){var t;if(this._instance.optedOut)return;let i=(t=this._instance.getPersistedProperty(ei.LogsQueue))!==null&&t!==void 0?t:[];this._maxQueueSize>i.length||(i.shift(),this._evictedSinceAdvance++,this._logger.info("Logs queue is full, dropping oldest record.")),i.push(e),this._instance.setPersistedProperty(ei.LogsQueue,i),this._maxBufferSize>i.length||this._retryAfter.isOpen()?this._armFlushTimer():this._flushInBackground()}_armFlushTimer(){this._flushTimer.pending||this._flushTimer.arm(Math.max(this._flushIntervalMs,this._retryAfter.remainingMs()))}_nextFlushDelay(){return Math.max(Vf(this._flushIntervalMs,this._consecutiveFlushFailures,this._flushJitter,3e4),this._retryAfter.remainingMs())}_hasQueuedRecords(){let e=this._instance.getPersistedProperty(ei.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return Ce(function*(){t._flushTimer.clear();let i=t.flush().catch(()=>{});e!==void 0?yield eh(i,e):yield i})()}flushWithTimeout(e){var t=this;return Ce(function*(){let i=t.flush();yield eh(i,e,()=>{i.catch(()=>{})})})()}_flushInBackground(){this.flush().then(()=>{this._consecutiveFlushFailures=0,this._flushJitter=1},e=>{this._consecutiveFlushFailures++,this._flushJitter=jf(),this._logger.error("PostHog logs flush failed:",e)}).finally(()=>{!this._instance.isDisabled&&this._hasQueuedRecords()&&this._flushTimer.armNoEarlierThan(this._nextFlushDelay())})}},ul=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function ch(e){return String(e)+"000000"}function uh(e,t,i,s){let n="";return s&&(n=Object.keys(s).sort().map(r=>`${JSON.stringify(r)}:${JSON.stringify(s[r])}`).join(",")),`${e}\0${t}\0${i??""}\0${n}`}var lb=class{constructor(e,t,i){this._instance=e,this._config=t,this._logger=i,this._series=new Map,this._flushTimer=new zf(()=>this.flush().catch(s=>{this._logger.error("Metrics flush failed:",s)})),this._flushPromise=null,this._seriesCapWarned=!1,this._typeByName=new Map,this._typeCollisionWarned=new Set,this._retryAfter=new xf,this._consecutiveFlushFailures=0,this._flushJitter=1,this._generation=0}count(e,t=1,i){this._capture({name:e,type:"count",value:t,unit:i?.unit,attributes:i?.attributes})}gauge(e,t,i){this._capture({name:e,type:"gauge",value:t,unit:i?.unit,attributes:i?.attributes})}histogram(e,t,i){this._capture({name:e,type:"histogram",value:t,unit:i?.unit,attributes:i?.attributes})}flush(){var e=this;let t=this._flushPromise,i=(function(){var s=Ce(function*(){t&&(yield t.catch(()=>{})),yield e._doFlush()});return function(){return s.apply(this,arguments)}})()().finally(()=>{this._flushPromise===i&&(this._flushPromise=null)});return this._flushPromise=i,i}drainWindow(){if(this._series.size===0)return null;let e=this._series;return this._series=new Map,this._seriesCapWarned=!1,this._typeByName=new Map,this._typeCollisionWarned=new Set,this._buildPayload(e)}reset(){this._generation++,this._retryAfter.reset(),this._consecutiveFlushFailures=0,this._flushJitter=1,this._flushTimer.clear(),this._series=new Map,this._flushPromise=null,this._seriesCapWarned=!1,this._typeByName=new Map,this._typeCollisionWarned=new Set}_capture(e){if(this._instance.isDisabled||this._instance.optedOut)return;let t=this._runBeforeSend(e);if(t===null)return;if(!t.name||typeof t.name!="string")return void this._logger.warn("Dropping metric with empty name");if(typeof t.value!="number"||!Number.isFinite(t.value))return void this._logger.warn(`Dropping metric '${t.name}': value must be a finite number`);if(t.type==="count"&&0>t.value)return void this._logger.warn(`Dropping count '${t.name}': counters are monotonic, value must be >= 0`);let i,s;try{i=t.attributes?b({},t.attributes):void 0,s=uh(t.type,t.name,t.unit,i)}catch(o){return void this._logger.warn(`Dropping metric '${t.name}': attributes could not be serialized`,o)}let n=this._series.get(s);if(!n){if(!this._admitNewSeries())return;n={name:t.name,type:t.type,unit:t.unit,attributes:i,windowStartMs:Date.now()},this._series.set(s,n)}let r=this._typeByName.get(t.name);r===void 0?this._typeByName.set(t.name,t.type):r===t.type||this._typeCollisionWarned.has(t.name)||(this._typeCollisionWarned.add(t.name),this._logger.warn(`Metric name '${t.name}' is already used as a ${r}; recording it as a ${t.type} too will blend both series in charts. Use a distinct name.`)),this._fold(n,t.value),this._armFlushTimer()}_admitNewSeries(){return this._config.maxSeriesPerFlush>this._series.size||(this._seriesCapWarned||(this._seriesCapWarned=!0,this._logger.warn(`Metric series cap reached (${this._config.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}_fold(e,t){switch(e.type){case"count":var i;e.total=((i=e.total)!==null&&i!==void 0?i:0)+t;break;case"gauge":e.last=t;break;case"histogram":{e.hist||(e.hist={count:0,sum:0,min:t,max:t,bucketCounts:new Array(ul.length+1).fill(0)});let s=e.hist;s.count+=1,s.sum+=t,s.min=Math.min(s.min,t),s.max=Math.max(s.max,t),s.bucketCounts[(function(n,r){for(let o=0;r.length>
2o;o++)if(r[o]>=n)return o;return r.length})(t,ul)]+=1;break}}}_runBeforeSend(e){let t=this._config.beforeSend;if(!t)return e;let i=W(t)?t:[t],s=e;for(let n of i)try{let r=n(s);if(!r)return this._logger.info("Metric was rejected in beforeSend function"),null;s=r}catch(r){return this._logger.error("Error in beforeSend function for metric:",r),null}return s}_armFlushTimer(){this._flushTimer.pending||this._flushTimer.arm(this._nextFlushDelay())}_nextFlushDelay(){return Math.max(Vf(this._config.flushIntervalMs,this._consecutiveFlushFailures,this._flushJitter,3e4),this._retryAfter.remainingMs())}_doFlush(){var e=this;return Ce(function*(){if(e._flushTimer.clear(),e._series.size===0)return;let t=e._series;e._series=new Map,e._seriesCapWarned=!1,e._typeByName=new Map,e._typeCollisionWarned=new Set;let i=e._generation,s=yield e._instance._sendMetricsBatch(e._buildPayload(t));if(i===e._generation)switch(e._retryAfter.record(s),s.kind==="retry-later"?(e._consecutiveFlushFailures++,e._flushJitter=jf()):(e._consecutiveFlushFailures=0,e._flushJitter=1),e._flushTimer.pending&&e._flushTimer.arm(e._nextFlushDelay()),s.kind){case"ok":return;case"retry-later":return e._mergeWindowBack(t),void e._flushTimer.armNoEarlierThan(e._nextFlushDelay());case"too-large":return void e._logger.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e._logger.error("Failed to send metrics batch:",s.error)}})()}_buildPayload(e){return t=this._buildMetrics(e),i=(function(r,o,a){return Bf(r,o,a)})(this._config,this._instance.getLibraryId(),this._instance.getLibraryVersion()),s=this._instance.getLibraryId(),n=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:qf(i)},scopeMetrics:[{scope:{name:s,version:n},metrics:t}]}]};var t,i,s,n}_buildMetrics(e){let t=ch(Date.now()),i=new Map;for(let o of e.values()){var s;let a=uh(o.type,o.name,o.unit,void 0),l=i.get(a);l||(l=b({name:o.name},o.unit&&{unit:o.unit}),o.type==="count"?l.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:o.type==="gauge"?l.gauge={dataPoints:[]}:l.histogram={aggregationTemporality:1,dataPoints:[]},i.set(a,l));let c=ra((s=o.attributes)!==null&&s!==void 0?s:{},this._logger),d=ch(o.windowStartMs);if(o.type==="count"){var n;let h={attributes:c,startTimeUnixNano:d,timeUnixNano:t,asDouble:(n=o.total)!==null&&n!==void 0?n:0};l.sum.dataPoints.push(h)}else if(o.type==="gauge"){var r;let h={attributes:c,timeUnixNano:t,asDouble:(r=o.last)!==null&&r!==void 0?r:0};l.gauge.dataPoints.push(h)}else o.hist&&l.histogram.dataPoints.push({attributes:c,startTimeUnixNano:d,timeUnixNano:t,count:o.hist.count,sum:o.hist.sum,min:o.hist.min,max:o.hist.max,bucketCounts:o.hist.bucketCounts,explicitBounds:ul})}return Array.from(i.values())}_mergeWindowBack(e){for(let[s,n]of e){let r=this._series.get(s);if(r)switch(r.windowStartMs=Math.min(r.windowStartMs,n.windowStartMs),r.type){case"count":var t,i;r.total=((t=r.total)!==null&&t!==void 0?t:0)+((i=n.total)!==null&&i!==void 0?i:0);break;case"gauge":break;case"histogram":if(n.hist)if(r.hist){r.hist.count+=n.hist.count,r.hist.sum+=n.hist.sum,r.hist.min=Math.min(r.hist.min,n.hist.min),r.hist.max=Math.max(r.hist.max,n.hist.max);for(let o=0;r.hist.bucketCounts.length>o;o++)r.hist.bucketCounts[o]+=n.hist.bucketCounts[o]}else r.hist=n.hist}else this._admitNewSeries()&&this._series.set(s,n)}}};function dh(e,t){if(!e)return;let i=e.find(s=>s.type===t);return i?.value}var hh="0.9.1",mi={DEBUG:!1,LIB_VERSION:hh,LIB_NAME:"browser-common",JS_SDK_VERSION:hh},Gf=(e,{debugEnabled:t}={})=>{let i={_log(s,...n){T&&(mi.DEBUG||T.POSTHOG_DEBUG||t)&&!M(T.console)&&T.console&&("__rrweb_original__"in T.console[s]?T.console[s].__rrweb_original__:T.console[s])(e,...n)},debug(...s){i._log("debug",...s)},info(...s){i._log("log",...s)},warn(...s){i._log("warn",...s)},error(...s){i._log("error",...s)},critical(...s){console.error(e,...s)},uninitializedWarning(s){i.error(`You must initialize PostHog before calling ${s}`)},createLogger:(s,n)=>Gf(`${e} ${s}`,n)};return i},D=Gf("[PostHog.js]"),Ie=D.createLogger;function Ds(e,t){W(e)&&e.forEach(t)}function xe(e,t){if(!Y(e))if(W(e))e.forEach(t);else if(jg(e))e.forEach((i,s)=>t(i,s));else for(let i in e)Lr.call(e,i)&&t(e[i],i)}var Oe=function(e,...t){for(let i of t)for(let s in i)i[s]!==void 0&&(e[s]=i[s]);return e};function Lo(e){let t=Object.keys(e),i=t.length,s=new Array(i);for(;i--;)s[i]=[t[i],e[t[i]]];return s}var cb=function(e){return function(...t){try{return e.apply(this,t)}catch(i){D.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),D.critical(i)}}},Gu=function(e){let t={};return xe(e,function(i,s){(oe(i)&&i.length>0||ne(i))&&(t[s]=i)}),t};function Qf(e){let t=b({},e);for(let i of["name","message","stack","cause","errors"])try{i in e&&(t[i]=e[i])}catch{}return t}var ub=["herokuapp.com","vercel.app","netlify.app"];function db(e){let t=e?.hostname;if(!oe(t))return!1;let i=t.split(".").slice(-2).join(".");for(let s of ub)if(i===s)return!1;return!0}function Z(e,t,i,s){let{capture:n=!1,passive:r=!0}=s??{};e?.addEventListener(t,i,{capture:n,passive:r})}
2function Rc(e){return e.name==="ph_toolbar_internal"}var hb=["localhost","127.0.0.1"],Ns=(e,t)=>{try{let i;return JSON.stringify(e,(s,n)=>{var r;return hn(n)?((r=i)!==null&&r!==void 0||(i=new WeakMap),i.has(n)||i.set(n,Qf(n)),i.get(n)):typeof n=="bigint"?n.toString():n},t)}catch{return Wg(e)}},Jt=e=>{let t=F?.createElement("a");return M(t)?null:(t.href=e,t)},Kf=function(e,t="&"){let i,s,n=[];return xe(e,function(r,o){M(r)||M(o)||o==="undefined"||(i=encodeURIComponent((a=>a instanceof File)(r)?r.name:r.toString()),s=encodeURIComponent(o),n[n.length]=s+"="+i)}),n.join(t)},Xs=function(e,t){let i=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s;for(let n=0;i.length>n;n++){let r=i[n].split("=");if(r[0]===t){s=r;break}}if(!W(s)||2>s.length)return"";{let n=s[1];try{n=decodeURIComponent(n)}catch{D.error("Skipping decoding for malformed query param: "+n)}return n.replace(/\+/g," ")}},en=function(e,t,i){if(!e||!t||!t.length)return e;let s=e.split("#"),n=s[1],r=(s[0]||"").split("?"),o=r[1],a=r[0],l=(o||"").split("&"),c=[];for(let h=0;l.length>h;h++){let u=l[h].split("=");W(u)&&(t.includes(u[0])?c.push(u[0]+"="+i):c.push(l[h]))}let d=a;return o!=null&&(d+="?"+c.join("&")),n!=null&&(d+="#"+n),d},oa=function(e,t){let i=e.match(new RegExp(t+"=([^&]*)"));return i?i[1]:null},Jf=(e,t)=>e>=t&&kg(),Yf=(e,t,i,s)=>{if(e===0){if(kg()){let n=t+1;return n===i&&s(),n}return t}return 0};function Zf(e,t){var i;let s=e==null||(i=e.config)===null||i===void 0?void 0:i.get_current_url;if(!_e(s))return t;try{let n=s(t);return oe(n)&&n?n:t}catch(n){return D.error("Error in get_current_url, falling back to window.location.href",n),t}}function Xn(e){var t;let i=T==null||(t=T.location)===null||t===void 0?void 0:t.href;return M(i)?void 0:Zf(e,i)}function Fc(e){var t;return e instanceof Element&&(e.id==="__POSTHOG_TOOLBAR__"||!!(!((t=e.closest)===null||t===void 0)&&t.call(e,".toolbar-global-fade-container")))}function _t(e){return!!e&&e.nodeType===1}function ot(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function Xf(e){return!!e&&e.nodeType===3}function Qu(e){return!!e&&e.nodeType===11&&_t(e.host)}function Ku(e){return e?$a(e).split(/\s+/):[]}function ph(e,t){let i=Xn(t);return!!(i&&e&&e.some(s=>i.match(s)))}function tn(e){let t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return Ku(t)}function ev(e){return Y(e)?null:$a(e).split(/(\s+)/).filter(t=>Qs(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Cr(e){let t="";return Gs(e)&&!xr(e)&&e.childNodes&&e.childNodes.length&&xe(e.childNodes,function(i){var s;Xf(i)&&i.textContent&&(t+=(s=ev(i.textContent))!==null&&s!==void 0?s:"")}),$a(t)}function Ni(e){var t;return M(e.target)?e.srcElement||null:!((t=e.target)===null||t===void 0)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}var Ju=["a","button","form","input","select","textarea","label"];function Ac(e,t){let i=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;try{return!!i&&i.call(e,t)}catch{return!1}}function aa(e,t){if(M(t))return!0;for(let i of e)if(t.some(s=>Ac(i,s)))return!0;return!1}function tv(e){let t=e.parentNode;return!(!t||!_t(t))&&t}var dl=[".ph-no-autocapture","[data-ph-no-autocapture]"],iv=["next","previous","prev",">","<"],pb=[...iv,"+","-","\u2212","\u2013"],_h=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,gh=[".ph-no-deadclick",".ph-no-capture"],fh=[".ph-no-rageclick",".ph-no-capture"],_b=["","text","search","email","password","url","tel","number"];function Ps(e){return!(!e||!_t(e))&&(!!ot(e,"textarea")||(ot(e,"input")?ie(_b,(e.getAttribute("type")||"").toLowerCase()):(function(t){var i;if(t.isContentEditable)return!0;let s=(i=t.getAttribute)===null||i===void 0?void 0:i.call(t,"contenteditable");return s==="true"||s===""})(e)))}function sv(e,t){if(!T||Er(e))return!1;let i,s,n;var r,o;if(Ae(t)?(i=!!t&&fh,s=void 0,n=!1):(i=(r=t?.css_selector_ignorelist)!==null&&r!==void 0?r:fh,s=t?.content_ignorelist,n=(o=t?.ignore_text_selection)!==null&&o!==void 0&&o),i===!1||n&&Ps(e))return!1;let{targetElementList:a}=la(e,!1);
2return!(function(l,c){if(l===!1||M(l))return!1;let d;if(l===!0)d=iv;else{if(!W(l))return!1;if(l.length>10)return D.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;d=l.map(h=>h.toLowerCase())}return c.some(({safeText:h,ariaLabel:u})=>d.some(p=>_h(h,p)||_h(u,p)))})(s,a.map(l=>{var c;return{safeText:Cr(l).toLowerCase(),ariaLabel:((c=l.getAttribute("aria-label"))===null||c===void 0?void 0:c.toLowerCase().trim())||""}}))&&!aa(a,i)}var Er=e=>!e||ot(e,"html")||!_t(e),la=(e,t)=>{if(!T||Er(e))return{parentIsUsefulElement:!1,targetElementList:[]};let i=!1,s=[e],n=e;for(;n.parentNode&&!ot(n,"body");){if(Qu(n.parentNode)){s.push(n.parentNode.host),n=n.parentNode.host;continue}let r=tv(n);if(!r)break;if(t||Ju.indexOf(r.tagName.toLowerCase())>-1)i=!0;else try{let o=T.getComputedStyle(r);o&&o.getPropertyValue("cursor")==="pointer"&&(i=!0)}catch{}s.push(r),n=r}return{parentIsUsefulElement:i,targetElementList:s}};function Gs(e){let t=new Set,i=0;for(let r=e;r.parentNode&&!ot(r,"body");r=r.parentNode){if(i++>=1e3||t.has(r))return!1;t.add(r);let o=tn(r);if(ie(o,"ph-sensitive")||ie(o,"ph-no-capture"))return!1}if(ie(tn(e),"ph-include"))return!0;let s=e.type||"";if(oe(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}let n=e.name||e.id||"";return!oe(n)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(n.replace(/[^a-zA-Z0-9]/g,""))}function xr(e){return!!(ot(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||ot(e,"select")||ot(e,"textarea")||e.getAttribute("contenteditable")==="true")}var vh=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}))$"),mh=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,gb
2=[16,15,14,13],fb=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),yh=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),bh=/[0-9A-Za-z_]/;function vb(e){let t=0,i=!1;for(let s=e.length-1;s>=0;s--){let n=e.charCodeAt(s)-48;i&&(n*=2,n>9&&(n-=9)),t+=n,i=!i}return t%10==0}function Qs(e,t=!0){return!(Y(e)||oe(e)&&(e=$a(e),(t?vh.test((e||"").replace(/[- ]/g,"")):(function(i){let s;for(mh.lastIndex=0;s=mh.exec(i);){let n=s[2];if(!n)continue;let r=n.replace(/[- ]/g,"");for(let o=0;r.length>o;o++)for(let a of gb){let l=o+a;if(r.length>=l){let c=r.slice(o,l);if(vh.test(c)&&vb(c))return!0}}}return!1})(e))||(t?fb.test(e):(function(i){let s;for(yh.lastIndex=0;s=yh.exec(i);){let n=s[1],r=s[3];if(!(n&&r&&bh.test(n)&&bh.test(r)))return!0}return!1})(e))))}function Sh(e){let t=Cr(e);return t=`${t} ${nv(e)}`.trim(),Qs(t)?t:""}function nv(e){let t="";return e&&e.childNodes&&e.childNodes.length&&xe(e.childNodes,function(i){var s;if(i&&((s=i.tagName)===null||s===void 0?void 0:s.toLowerCase())==="span")try{let n=Cr(i);t=`${t} ${n}`.trim(),i.childNodes&&i.childNodes.length&&(t=`${t} ${nv(i)}`.trim())}catch(n){D.error("[AutoCapture]",n)}}),t}function wh(e){return e.replace(/"|\\"/g,'\\"')}function mb(e){let t=e.attr__class;if(t)return W(t)?t:Ku(t)}var Lc=1e6;function rv(e){var t;return Math.min(Lc,(t=e.payloadSizeLimitBytes)!==null&&t!==void 0?t:Lc)}var Bs={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:e=>e,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:Lc,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},yb=["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"],bb=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],Sb=["auth","token","secret","session","api-key","apikey","api_key","credential","password","passwd","cookie","csrf","xsrf"],kh=e=>{Y(e)||xe(Object.keys(e),t=>{(i=>{let s=i.toLowerCase();return yb.includes(s)||Sb.some(n=>s.includes(n))})(t)&&(e[t]="redacted")})},wb=["/s/","/e/","/i/"];function Ch(e,t,i,s){if(Y(e))return e;let n=t?.["content-length"]||(function(r){return new Blob([r]).size})(e);return oe(n)&&(n=parseInt(n)),n>i?`[SessionRecording] ${s} body too large to record (${n} bytes)`:e}function Eh(e,t){if(Y(e))return e;let i=e;return Qs(i,!1)||(i="[SessionRecording] "+t+" body redacted"),xe(bb,s=>{i?.length&&i?.indexOf(s)!==-1&&(i="[SessionRecording] "+t+" body redacted as might contain: "+s)}),i}var ov=new WeakSet,Kt="disabled",Yu="sampled",Oc="active",sn="buffering",Zu="paused",xh="lazy_loading",Xu="rrweb_error",pn="trigger_activated",us="trigger_pending",nn="trigger_disabled";function av(e,t,i,s,n,r){return t===0?nn:e?.get_property(i?s+i:n)===r?pn:us}function Kr(e,t,i){return t.some(s=>{var n;return s.matching==="regex"&&((n=i?.get(s.url))!==null&&n!==void 0?n:new RegExp(s.url)).test(e)})}function Th(e){return e.includes("trigger_activated")?pn:e.includes("trigger_pending")?us:nn}function Ih(e){let t=new Set(e);switch(t.delete(nn),t.size){case 0:return nn;case 1:return Array.from(t)[0];default:return us}}var ed=class{constructor(e){this._matchers=e}triggerStatus(e){return Th(this._matchers.map(t=>t.triggerStatus(e)))}triggerStatusNoSideEffects(e){return Th(this._matchers.map(t=>t.triggerStatusNoSideEffects(e)))}stop(){this._matchers.forEach(e=>e.stop())}},td=class{constructor(e){this._matchers=e}triggerStatus(e){return Ih(this._matchers.map(t=>t.triggerStatus(e)))}triggerStatusNoSideEffects(e){return Ih(this._matchers.map(t=>t.triggerStatusNoSideEffects(e)))}
2stop(){this._matchers.forEach(e=>e.stop())}},kb=class{triggerStatus(){return this.triggerStatusNoSideEffects()}triggerStatusNoSideEffects(){return pn}stop(){}},ca=e=>"sessionRecording"in e,lv=class{constructor(e,t){this._instance=e,this._urlTriggers=[],this._urlBlocklist=[],this._compiledTriggerRegexes=new Map,this._compiledBlocklistRegexes=new Map,this._lastCheckedUrl="",this.urlBlocked=!1,this._groupId=t}onConfig(e){var t,i;this._urlTriggers=(ca(e)?ee(e.sessionRecording)?(t=e.sessionRecording)===null||t===void 0?void 0:t.urlTriggers:[]:e?.urlTriggers)||[],this._urlBlocklist=(ca(e)?ee(e.sessionRecording)?(i=e.sessionRecording)===null||i===void 0?void 0:i.urlBlocklist:[]:e?.urlBlocklist)||[],this._compileRegexCache()}_compileRegexCache(){this._compiledTriggerRegexes.clear(),this._compiledBlocklistRegexes.clear();for(let e of this._urlTriggers)if(e.matching==="regex"&&!this._compiledTriggerRegexes.has(e.url))try{this._compiledTriggerRegexes.set(e.url,new RegExp(e.url))}catch(t){D.error("Invalid URL trigger regex pattern:",e.url,t)}for(let e of this._urlBlocklist)if(e.matching==="regex"&&!this._compiledBlocklistRegexes.has(e.url))try{this._compiledBlocklistRegexes.set(e.url,new RegExp(e.url))}catch(t){D.error("Invalid URL blocklist regex pattern:",e.url,t)}}onRemoteConfig(e){this.onConfig(e)}_urlTriggerStatus(e){return av(this._instance,this._urlTriggers.length,this._groupId,Ru,Iu,e)}triggerStatus(e){let t=this.triggerStatusNoSideEffects(e);return this._instance.register_for_session({[Bu]:t}),t}triggerStatusNoSideEffects(e){return this._urlTriggerStatus(e)}isCurrentUrlBlocked(){let e=Xn(this._instance);if(!e)return!1;try{return Kr(e,this._urlBlocklist,this._compiledBlocklistRegexes)}catch{return!0}}checkUrlBlocklist(e,t){let i=Xn(this._instance);if(!i||i===this._lastCheckedUrl)return;this._lastCheckedUrl=i;let s=this.urlBlocked,n=Kr(i,this._urlBlocklist,this._compiledBlocklistRegexes);s&&n||(n&&!s?e():!n&&s&&t())}checkUrlTriggerConditions(e,t,i,s){let n=Xn(this._instance);if(!n||n===this._lastCheckedUrl)return;this._lastCheckedUrl=n;let r=this.urlBlocked,o=Kr(n,this._urlBlocklist,this._compiledBlocklistRegexes);o&&!r?e():!o&&r&&t();let a=this._urlTriggerStatus(s)===pn,l=Kr(n,this._urlTriggers,this._compiledTriggerRegexes);!a&&l&&i("url",n)}stop(){this._lastCheckedUrl=""}},cv=class{constructor(e){this._instance=e,this.linkedFlag=null,this.linkedFlagSeen=!1,this._flagListenerCleanup=()=>{}}triggerStatus(){let e=this.triggerStatusNoSideEffects();return this._instance.register_for_session({[$u]:e}),e}triggerStatusNoSideEffects(){let e=us;return Y(this.linkedFlag)&&(e=nn),this.linkedFlagSeen&&(e=pn),e}onConfig(e,t){var i;if(this.linkedFlag=(ca(e)?ee(e.sessionRecording)?(i=e.sessionRecording)===null||i===void 0?void 0:i.linkedFlag:null:e?.linkedFlag)||null,!Y(this.linkedFlag)&&!this.linkedFlagSeen){let s=oe(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,n=oe(this.linkedFlag)?null:this.linkedFlag.variant;this._flagListenerCleanup=this._instance.onFeatureFlags((r,o)=>{let a=!1;if(ee(o)&&s in o){let c=o[s];a=Ae(c)?c===!0:n?c===n:!!c}let l=a&&!this.linkedFlagSeen;this.linkedFlagSeen=a,l&&t(s,n)})}}onRemoteConfig(e,t){this.onConfig(e,t)}stop(){this._flagListenerCleanup()}},uv=class{constructor(e,t){this._instance=e,this._eventTriggers=[],this._groupId=t}onConfig(e){var t;this._eventTriggers=(ca(e)?ee(e.sessionRecording)?(t=e.sessionRecording)===null||t===void 0?void 0:t.eventTriggers:[]:e?.eventTriggers)||[]}onRemoteConfig(e){this.onConfig(e)}_eventTriggerStatus(e){return av(this._instance,this._eventTriggers.length,this._groupId,Pu,Mu,e)}triggerStatus(e){let t=this.triggerStatusNoSideEffects(e);return this._instance.register_for_session({[Ou]:t}),t}triggerStatusNoSideEffects(e){return this._eventTriggerStatus(e)}checkEventTriggerConditions(e,t,i){if(this._eventTriggers.length===0)return;let s=this._eventTriggerStatus(i)===pn,n=this._eventTriggers.includes(e);!s&&n&&t("event",e)}stop(){}},Cb=class{constructor(e,t,i){if(this._instance=e,this.group=t,this._urlTriggerMatching=new lv(e,t.id),this._eventTriggerMatching=new uv(e,t.id),this._linkedFlagMatching=new cv(e),t.conditions.events&&t.conditions.events.length>0||t.conditions.urls&&t.conditions.urls.length>0||t.conditions.flag){let s=(t.conditions.events||[]).map(o=>o.name),n={urlTriggers:t.conditions.urls||[],eventTriggers:s,linkedFlag:t.conditions.flag||null,urlBlocklist:[]};this._urlTriggerMatching.onConfig(n),this._eventTriggerMatching.onConfig(n),this._linkedFlagMatching.onConfig(n,i);let r=[this._eventTriggerMatching,this._urlTriggerMatching,this._linkedFlagMatching];this._combinedMatching=t.conditions.matchType==="any"?new ed(r):new td(r)}else this._combinedMatching=new kb}triggerStatus(e){return this._combinedMatching.triggerStatus(e)}triggerStatusNoSideEffects(e){return this._combinedMatching.triggerStatusNoSideEffects(e)}getPendingTriggerConditions(e){return this.triggerStatusNoSideEffects(e)!=="trigger_pending"?[]:[{label:"URL condition not matched",status:this._urlTriggerMatching.triggerStatusNoSideEffects(e)},{label:"event condition not matched",status:this._eventTriggerMatching.triggerStatusNoSideEffects(e)},{label:"linked flag condition not matched",status:this._linkedFlagMatching.triggerStatusNoSideEffects()}].filter(({status:t})=>t===us).map(({label:t})=>t)}checkEventTriggerConditions(e,t,i){this._eventTriggerMatching.checkEventTriggerConditions(e,t,i)}checkUrlTriggerConditions(e,t,i,s){this._urlTriggerMatching.checkUrlTriggerConditions(e,t,i,s)}activateTrigger(e,t){var i;let s=e==="url"?Ru+this.group.id:Pu+this.group.id;(i=this._instance.persistence)===null||i===void 0||i.register({[s]:t})}stop(){this._urlTriggerMatching.stop(),this._eventTriggerMatching.stop(),this._linkedFlagMatching.stop()}};function Eb(e){if(e.rrwebError)return Xu;if(!e.receivedFlags)return sn;if(!e.isRecordingEnabled)return Kt;if(e.urlTriggerMatching.urlBlocked)return Zu;let t=e.isSampled===!0,i=new ed([e.eventTriggerMatching,e.urlTriggerMatching,e.linkedFlagMatching]).triggerStatus(e.sessionId);return t?Yu:i==="trigger_activated"?Oc:i==="trigger_pending"?sn:e.isSampled===!1?Kt:Oc}function Mh(e){if(e.rrwebError)return Xu;if(!e.receivedFlags)return sn;if(!e.isRecordingEnabled)return Kt;if(e.urlTriggerMatching.urlBlocked)return Zu;let t=new td([e.eventTriggerMatching,e.urlTriggerMatching,e.linkedFlagMatching]).triggerStatus(e.sessionId),i=t!==nn,s=Ae(e.isSampled);return i&&t==="trigger_pending"?sn:i&&t==="trigger_disabled"||s&&!e.isSampled?Kt:e.isSampled===!0?Yu:Oc}function dv(){let e=[];return function(t,i){if(ee(i)||W(i)){for(;e.length>0&&e[e.length-1]!==this;)e.pop();return e.includes(i)?"[Circular]":(e.push(i),i)}return i}}
vendor: 5,871 bytes, line 2
2function qs(e){try{let t=JSON.stringify(e,dv());return t?new Blob([t]).size:0}catch{return-1}}function ua(e){if(ue(e))return 4;if(M(e))return 0;switch(typeof e){case"string":return e.length+2;case"number":return String(e).length;case"boolean":return e?4:5;case"object":{if(W(e)){let n=2;for(let r=0;e.length>r;r++){r>0&&(n+=1);let o=e[r];n+=M(o)||ue(o)?4:ua(o)}return n}let t=e,i=2,s=!0;for(let n in t){if(!{}.hasOwnProperty.call(t,n))continue;let r=t[n];M(r)||(s||(i+=1),s=!1,i+=n.length+3+ua(r))}return i}default:return 0}}function $c(e,t=66060288e-1){if(e.size>=t&&e.data.length>1){let i=Math.floor(e.data.length/2),s=e.sizes.slice(0,i),n=e.sizes.slice(i);return[$c({size:s.reduce((r,o)=>r+o,0),data:e.data.slice(0,i),sizes:s,sessionId:e.sessionId,windowId:e.windowId}),$c({size:n.reduce((r,o)=>r+o,0),data:e.data.slice(i),sizes:n,sessionId:e.sessionId,windowId:e.windowId})].flatMap(r=>r)}return[e]}var Lt=Uint8Array,kt=Uint16Array,rn=Uint32Array,id=new Lt([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]),sd=new Lt([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]),Ph=new Lt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),hv=function(e,t){for(var i=new kt(31),s=0;31>s;++s)i[s]=t+=1<<e[s-1];var n=new rn(i[30]);for(s=1;30>s;++s)for(var r=i[s];i[s+1]>r;++r)n[r]=r-i[s]<<5|s;return[i,n]},pv=hv(id,2),Dc=pv[1];pv[0][28]=258,Dc[258]=28;for(Nc=hv(sd,0)[1],da=new kt(32768),Be=0;32768>Be;++Be)ji=(43690&Be)>>>1|(21845&Be)<<1,da[Be]=((65280&(ji=(61680&(ji=(52428&ji)>>>2|(13107&ji)<<2))>>>4|(3855&ji)<<4))>>>8|(255&ji)<<8)>>>1;var ji,Nc,da,Be,er=function(e,t,i){for(var s=e.length,n=0,r=new kt(t);s>n;++n)++r[e[n]-1];var o,a=new kt(t);for(n=0;t>n;++n)a[n]=a[n-1]+r[n-1]<<1;if(i){o=new kt(1<<t);var l=15-t;for(n=0;s>n;++n)if(e[n])for(var c=n<<4|e[n],d=t-e[n],h=a[e[n]-1]++<<d,u=h|(1<<d)-1;u>=h;++h)o[da[h]>>>l]=c}else for(o=new kt(s),n=0;s>n;++n)o[n]=da[a[e[n]-1]++]>>>15-e[n];return o},ds=new Lt(288);for(Be=0;144>Be;++Be)ds[Be]=8;for(Be=144;256>Be;++Be)ds[Be]=9;for(Be=256;280>Be;++Be)ds[Be]=7;for(Be=280;288>Be;++Be)ds[Be]=8;var ha=new Lt(32);for(Be=0;32>Be;++Be)ha[Be]=5;var xb=er(ds,9,0),Tb=er(ha,5,0),_v=function(e){return(e/8|0)+(7&e&&1)},gv=function(e,t,i){(t==null||0>t)&&(t=0),(i==null||i>e.length)&&(i=e.length);var s=new(e instanceof kt?kt:e instanceof rn?rn:Lt)(i-t);return s.set(e.subarray(t,i)),s},ui=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8},En=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8,e[s+2]|=i>>>16},hl=function(e,t){for(var i=[],s=0;e.length>s;++s)e[s]&&i.push({s,f:e[s]});var n=i.length,r=i.slice();if(!n)return[new Lt(0),0];if(n==1){var o=new Lt(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort(function(S,x){return S.f-x.f}),i.push({s:-1,f:25001});var a=i[0],l=i[1],c=0,d=1,h=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};d!=n-1;)a=i[i[h].f>i[c].f?c++:h++],l=i[c!=d&&i[h].f>i[c].f?c++:h++],i[d++]={s:-1,f:a.f+l.f,l:a,r:l};var u=r[0].s;for(s=1;n>s;++s)r[s].s>u&&(u=r[s].s);var p=new kt(u+1),_=Bc(i[d-1],p,0);if(_>t){s=0;var g=0,v=_-t,f=1<<v;for(r.sort(function(S,x){return p[x.s]-p[S.s]||S.f-x.f});n>s;++s){var m=r[s].s;if(t>=p[m])break;g+=f-(1<<_-p[m]),p[m]=t}for(g>>>=v;g>0;){var y=r[s].s;t>p[y]?g-=1<<t-p[y]++-1:++s}for(;s>=0&&g;--s){var w=r[s].s;p[w]==t&&(--p[w],++g)}_=t}return[new Lt(p),_]},Bc=function(e,t,i){return e.s==-1?Math.max(Bc(e.l,t,i+1),Bc(e.r,t,i+1)):t[e.s]=i},Rh=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new kt(++t),s=0,n=e[0],r=1,o=function(l){i[s++]=l},a=1;t>=a;++a)if(e[a]==n&&a!=t)++r;else{if(!n&&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(n),--r;r>6;r-=6)o(8304);r>2&&(o(r-3<<5|8208),r=0)}for(;r--;)o(n);r=1,n=e[a]}return[i.subarray(0,s),t]},xn=function(e,t){for(var i=0,s=0;t.length>s;++s)i+=e[s]*t[s];return i},Oo=function(e,t,i){var s=i.length,n=_v(t+2);e[n]=255&s,e[n+1]=s>>>8,e[n+2]=255^e[n],e[n+3]=255^e[n+1];for(var r=0;s>r;++r)e[n+r+4]=i[r];return 8*(n+4+s)},Fh=function(e,t,i,s,n,r,o,a,l,c,d){ui(t,d++,i),++n[256];for(var h=hl(n,15),u=h[0],p=h[1],_=hl(r,15),g=_[0],v=_[1],f=Rh(u),m=f[0],y=f[1],w=Rh(g),S=w[0],x=w[1],k=new kt(19),C=0;m.length>C;++C)k[31&m[C]]++;for(C=0;S.length>C;++C)k[31&S[C]]++;for(var E=hl(k,7),I=E[0],P=E[1],O=19;O>4&&!I[Ph[O-1]];--O);var L,A,B,q,K=c+5<<3,U=xn(n,ds)+xn(r,ha)+o,ce=xn(n,u)+xn(r,g)+o+14+3*O+xn(k,I)+(2*k[16]+3*k[17]+7*k[18]);if(U>=K&&ce>=K)return Oo(t,d,e.subarray(l,l+c));if(ui(t,d,1+(U>ce)),d+=2,U>ce){L=er(u,p,0),A=u,B=er(g,v,0),q=g;var j=er(I,P,0);for(ui(t,d,y-257),ui(t,d+5,x-1),ui(t,d+10,O-4),d+=14,C=0;O>C;++C)ui(t,d+3*C,I[Ph[C]]);d+=3*O;for(var N=[m,S],V=0;2>V;++V){var Q=N[V];for(C=0;Q.length>C;++C)ui(t,d,j[z=31&Q[C]]),d+=I[z],z>15&&(ui(t,d,Q[C]>>>5&127),d+=Q[C]>>>12)}}else L=xb,A=ds,B=Tb,q=ha;for(C=0;a>C;++C)if(s[C]>255){var z;En(t,d,L[257+(z=s[C]>>>18&31)]),d+=A[z+257],z>7&&(ui(t,d,s[C]>>>23&31),d+=id[z]);var ae=31&s[C];En(t,d,B[ae]),d+=q[ae],ae>3&&(En(t,d,s[C]>>>5&8191),d+=sd[ae])}else En(t,d,L[s[C]]),d+=A[s[C]];return En(t,d,L[256]),d+A[256]},Ib=new rn([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Mb=new Lt(0),Pb=(function(){for(var e=new rn(256),t=0;256>t;++t){for(var i=t,s=9;--s;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e})(),pl=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};function fv(e,t){t===void 0&&(t={});var i=(function(){var h=4294967295;return{p(u){for(var p=h,_=0;u.length>_;++_)p=Pb[255&p^u[_]]^p>>>8;h=p},d(){return 4294967295^h}}})(),s=e.length;i.p(e);var n,r,o,a,l,c=(n=e,r=t,o=(function(h){return 10+(h.filename&&h.filename.length+1||0)})(t),a=8,(function(h,u,p,_,g,v){var f=h.length,m=new Lt(_+f+5*(1+Math.floor(f/7e3))+g),y=m.subarray(_,m.length-g),w=0;if(!u||8>f)for(var S=0;f>=S;S+=65535){var x=S+65535;f>x?w=Oo(y,w,h.subarray(S,x)):(y[S]=v,w=Oo(y,w,h.subarray(S,f)))}else{for(var k=Ib[u-1],C=k>>>13,E=8191&k,I=(1<<p)-1,P=new kt(32768),O=new kt(I+1),L=Math.ceil(p/3),A=2*L,B=function(Fe){return(
2h[Fe]^h[Fe+1]<<L^h[Fe+2]<<A)&I},q=new rn(25e3),K=new kt(288),U=new kt(32),ce=0,j=0,N=(S=0,0),V=0,Q=0;f>S;++S){var z=B(S),ae=32767&S,be=O[z];if(P[ae]=be,O[z]=ae,S>=V){var Ee=f-S;if((ce>7e3||N>24576)&&Ee>423){w=Fh(h,y,0,q,K,U,j,N,Q,S-Q,w),N=ce=j=0,Q=S;for(var pe=0;286>pe;++pe)K[pe]=0;for(pe=0;30>pe;++pe)U[pe]=0}var ve=2,dt=0,st=E,Le=ae-be&32767;if(Ee>2&&z==B(S-Le))for(var ze=Math.min(C,Ee)-1,It=Math.min(32767,S),Ci=Math.min(258,Ee);It>=Le&&--st&&ae!=be;){if(h[S+ve]==h[S+ve-Le]){for(var nt=0;Ci>nt&&h[S+nt]==h[S+nt-Le];++nt);if(nt>ve){if(ve=nt,dt=Le,nt>ze)break;var Bt=Math.min(Le,nt-2),Yt=0;for(pe=0;Bt>pe;++pe){var qe=S-Le+pe+32768&32767,Pe=qe-P[qe]+32768&32767;Pe>Yt&&(Yt=Pe,be=qe)}}}Le+=(ae=be)-(be=P[ae])+32768&32767}if(dt){q[N++]=268435456|Dc[ve]<<18|Nc[dt];var X=31&Dc[ve],at=31&Nc[dt];j+=id[X]+sd[at],++K[257+X],++U[at],V=S+ve,++ce}else q[N++]=h[S],++K[h[S]]}}w=Fh(h,y,v,q,K,U,j,N,Q,S-Q,w),v||(w=Oo(y,w,Mb))}return gv(m,0,_+_v(w)+g)})(n,r.level==null?6:r.level,r.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+r.mem,o,a,!l)),d=c.length;return(function(h,u){var p=u.filename;if(h[0]=31,h[1]=139,h[2]=8,h[8]=2>u.level?4:u.level==9?2:0,h[9]=3,u.mtime!=0&&pl(h,4,Math.floor(new Date(u.mtime||Date.now())/1e3)),p){h[3]=8;for(var _=0;p.length>=_;++_)h[_+10]=p.charCodeAt(_)}})(c,t),pl(c,d-8,i.d()),pl(c,d-4,s),c}function vv(e,t){var i=e.length;if(!t&&typeof TextEncoder<"u")return new TextEncoder().encode(e);for(var s=new Lt(e.length+(e.length>>>1)),n=0,r=function(c){s[n++]=c},o=0;i>o;++o){if(n+5>s.length){var a=new Lt(n+8+(i-o<<1));a.set(s),s=a}var l=e.charCodeAt(o);128>l||t?r(l):2048>l?(r(192|l>>>6),r(128|63&l)):l>55295&&57344>l?(r(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++o))>>>18),r(128|l>>>12&63),r(128|l>>>6&63),r(128|63&l)):(r(224|l>>>12),r(128|l>>>6&63),r(128|63&l))}return gv(s,0,n)}function mv(e,t){var i="";if(!t&&typeof TextDecoder<"u")return new TextDecoder().decode(e);for(var s=0;e.length>s;){var n=e[s++];128>n||t?i+=String.fromCharCode(n):224>n?i+=String.fromCharCode((31&n)<<6|63&e[s++]):240>n?i+=String.fromCharCode((15&n)<<12|(63&e[s++])<<6|63&e[s++]):(n=((15&n)<<18|(63&e[s++])<<12|(63&e[s++])<<6|63&e[s++])-65536,i+=String.fromCharCode(55296|n>>10,56320|1023&n))}return i}var Rb=class{constructor(e,t={}){var i,s,n,r;this._rrweb=e,this._options=t,this._loggedTracker={},this._lastByteRefill=Date.now(),this._lastResyncAt=-1/0,this._refillByteBudget=()=>{let a=Date.now(),l=a-this._lastByteRefill;l>0?(this._byteTokens=Math.min(this._bytesBucketSize,this._byteTokens+l/1e3*this._bytesRefillRate),this._lastByteRefill=a):this._lastByteRefill=a},this._onNodeRateLimited=a=>{if(!this._loggedTracker[a]){var l,c;this._loggedTracker[a]=!0;let d=this._getNode(a);(l=(c=this._options).onBlockedNode)===null||l===void 0||l.call(c,a,d)}},this._getNodeOrRelevantParent=a=>{let l=this._getNode(a);if(l?.nodeName!=="svg"&&l instanceof Element){let c=l.closest("svg");if(c)return[this._rrweb.mirror.getId(c),c]}return[a,l]},this._getNode=a=>this._rrweb.mirror.getNode(a),this._numberOfChanges=a=>{var l,c,d,h,u,p,_,g;return((l=(c=a.removes)===null||c===void 0?void 0:c.length)!==null&&l!==void 0?l:0)+((d=(h=a.attributes)===null||h===void 0?void 0:h.length)!==null&&d!==void 0?d:0)+((u=(p=a.texts)===null||p===void 0?void 0:p.length)!==null&&u!==void 0?u:0)+((_=(g=a.adds)===null||g===void 0?void 0:g.length)!==null&&_!==void 0?_:0)},this.throttleMutations=a=>{if(a.type!==3||a.data.source!==0)return a;let l=a.data,c=this._numberOfChanges(l);if(l.attributes){let v=l.attributes.length;l.attributes=l.attributes.filter(m=>{let[y]=this._getNodeOrRelevantParent(m.id);return!this._rateLimiter.consumeRateLimit(y)&&m});let f=v-l.attributes.length;var d,h;f>0&&((d=(h=this._options).onDroppedAttributeMutations)===null||d===void 0||d.call(h,f))}let u=this._numberOfChanges(l);if(u===0&&c!==u)return;if(this._byteBudgetDisabled)return a;this._refillByteBudget();let p=ua(a);var _,g;return p>this._byteTokens?((_=(g=this._options).onDroppedOversizedMutation)===null||_===void 0||_.call(g,p),void this._scheduleResync()):(this._byteTokens-=p,a)},this._scheduleResync=()=>
2{if(this._resyncTimer)return;let a=Math.max(0,this._resyncIntervalMs-(Date.now()-this._lastResyncAt));this._resyncTimer=setTimeout(()=>{var l,c;this._resyncTimer=void 0,this._lastResyncAt=Date.now(),(l=(c=this._options).requestFullSnapshot)===null||l===void 0||l.call(c)},a)},this._rateLimiter=new Qg({bucketSize:(i=this._options.bucketSize)!==null&&i!==void 0?i:100,refillRate:(s=this._options.refillRate)!==null&&s!==void 0?s:10,refillInterval:1e3,_onBucketRateLimited:this._onNodeRateLimited,_logger:D}),this._bytesBucketSize=(n=this._options.bytesBucketSize)!==null&&n!==void 0?n:0,this._bytesRefillRate=(r=this._options.bytesRefillRate)!==null&&r!==void 0?r:25600,this._byteBudgetDisabled=!Number.isFinite(this._bytesBucketSize)||0>=this._bytesBucketSize,this._byteTokens=this._bytesBucketSize;let o=this._options.resyncIntervalMs;this._resyncIntervalMs=ne(o)&&Number.isFinite(o)&&o>0?o:3e5}reset(){this._loggedTracker={},this._resyncTimer&&(clearTimeout(this._resyncTimer),this._resyncTimer=void 0),this._lastResyncAt=Date.now()}stop(){this._rateLimiter.stop(),this.reset(),this._byteTokens=this._bytesBucketSize,this._lastByteRefill=Date.now(),this._lastResyncAt=-1/0}},tr=e=>{if(F){try{let t=e+"=",i=F.cookie.split(";").filter(s=>s.length);for(let s=0;i.length>s;s++){let n=i[s];for(;n.charAt(0)==" ";)n=n.substring(1,n.length);if(n.indexOf(t)===0)return decodeURIComponent(n.substring(t.length,n.length))}}catch{}return null}};Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return ne(e)&&isFinite(e)&&Math.floor(e)===e});var Fb=class qc{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,i,s,n){if(!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||!Number.isInteger(n)||0>t||0>i||0>s||0>n||t>0xffffffffffff||i>4095||s>1073741823||n>4294967295)throw new RangeError("invalid field value");let r=new Uint8Array(16);return r[0]=t/Math.pow(2,40),r[1]=t/Math.pow(2,32),r[2]=t/Math.pow(2,24),r[3]=t/Math.pow(2,16),r[4]=t/256,r[5]=t,r[6]=112|i>>>8,r[7]=i,r[8]=128|s>>>24,r[9]=s>>>16,r[10]=s>>>8,r[11]=s,r[12]=n>>>24,r[13]=n>>>16,r[14]=n>>>8,r[15]=n,new qc(r)}toString(){let t="";for(let i=0;this.bytes.length>i;i++)t=t+(this.bytes[i]>>>4).toString(16)+(15&this.bytes[i]).toString(16),i!==3&&i!==5&&i!==7&&i!==9||(t+="-");if(t.length!==36)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new qc(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(let i=0;16>i;i++){let s=this.bytes[i]-t.bytes[i];if(s!==0)return Math.sign(s)}return 0}},Ab=class{generate(){let e=this.generateOrAbort();if(!M(e))return e;{this._timestamp=0;let t=this.generateOrAbort();if(M(t))throw new Error("Could not generate UUID after timestamp reset");return t}}generateOrAbort(){let e=(()=>{let t=Date.now();return ne(t)&&isFinite(t)?Math.min(Math.max(Math.floor(t),0),0xffffffffffff):0})();if(e>this._timestamp)this._timestamp=e,this._resetCounter();else{if(this._timestamp>=e+1e4)return;this._counter++,this._counter>4398046511103&&(this._timestamp++,this._resetCounter())}return Fb.fromFieldsV7(this._timestamp,Math.trunc(this._counter/Math.pow(2,30)),this._counter&Math.pow(2,30)-1,this._random.nextUint32())}_resetCounter(){this._counter=1024*this._random.nextUint32()+(1023&this._random.nextUint32())}constructor(){this._timestamp=0,this._counter=0,this._random=new Lb}},yv=e=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(let t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};T&&!M(T.crypto)&&crypto.getRandomValues&&(yv=e=>crypto.getRandomValues(e));var Lb=class{nextUint32(){return this._buffer.length>this._cursor||(yv(this._buffer),this._cursor=0),this._buffer[this._cursor++]}constructor(){this._buffer=new Uint32Array(8),this._cursor=1/0}},Ah,Rt=()=>Ob().toString(),Ob=()=>(Ah||(Ah=new Ab)).generate(),Tn="",$b=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,vs=null,Ue={_is_supported(){if(!ue(vs))return vs;if(vs=!1,F)try{let e=`__ph_cookie_support_${Rt()}`;Ue._set(e,"xyz"),vs=tr(e)==='"xyz"',Ue._remove(e)}catch{vs=!1}return vs},_error(e){D.error("cookieStore error: "+e)},_get:tr,_parse(e){let t;try{t=JSON.parse(Ue._get(e))||{}}catch{}return t},_set(e,t,i,s,n){if(!F)return!1;try{let r="",o="",a=(function(c,d){if(d){let h=(function(u,p=F){if(Tn)return Tn;if(!p||["localhost","127.0.0.1"].includes(u))return"";let _=u.split("."),g=Math.min(_.length,8),v="dmn_chk_"+Rt();for(;!Tn&&g--;){let f=_.slice(g).join("."),m=v+"=1;domain=."+f+";path=/";p.cookie=m+";max-age=3",p.cookie.includes(v)&&(p.cookie=m+";max-age=0",Tn=f)}return Tn})(c);if(!h){let u=(p=>{let _=p.match($b);return _?_[0]:""})(c);u!==h&&D.info("Warning: cookie subdomain discovery mismatch",u,h),h=u}return h?"; domain=."+h:""}return""})(F.location.hostname,s);if(i){let c=new Date;c.setTime(c.getTime()+864e5*i),r="; expires="+c.toUTCString()}n&&(o="; secure");let l=e+"="+encodeURIComponent(JSON.stringify(t))+r+"; SameSite=Lax; path=/"+a+o;return l.length>3686.4&&D.warn("cookieStore warning: large cookie, len="+l.length),F.cookie=l,!0}catch{return!1}}
2,_remove(e,t){if(F?.cookie&&(!t||!ue(tr(e))))try{Ue._set(e,"",-1,t)}catch{return}}},_l=null,ye={_is_supported(){if(!ue(_l))return _l;let e=!0;if(M(T))e=!1;else try{let t="__mplssupport__";ye._set(t,"xyz"),ye._get(t)!=='"xyz"'&&(e=!1),ye._remove(t)}catch{e=!1}return e||D.error("localStorage unsupported; falling back to cookie store"),_l=e,e},_error(e){D.error("localStorage error: "+e)},_get(e){try{return T?.localStorage.getItem(e)}catch(t){ye._error(t)}return null},_parse(e){try{return JSON.parse(ye._get(e))||{}}catch{}return null},_set(e,t){try{return T?.localStorage.setItem(e,JSON.stringify(t)),!0}catch(i){ye._error(i)}return!1},_remove(e){try{T?.localStorage.removeItem(e)}catch(t){ye._error(t)}}},gl=[Qt,gi,Gt,ns,Fi,rs,Di,Sr,Li],Zi=[Eu,jt,Os,br,Fu,$s,zs,St],pa=e=>e+"_cpm",Db=["__proto__","constructor","prototype"],fl=e=>{if(!ee(e))return{};let t={};return Object.keys(e).forEach(i=>{Db.indexOf(i)===-1&&(t[i]=e[i])}),t},vl=(e,t=[])=>{let i={};return[...Zi,...t].forEach(s=>{let n=e[s];M(n)||ue(n)||n===""||(i[s]=n)}),i},bv=e=>{let t=5381,i=2166136261;for(let s=0;e.length>s;s++){let n=e.charCodeAt(s);t=33*t^n,i=Math.imul(i^n,16777619)}return e.length.toString(36)+"."+(t>>>0).toString(36)+"."+(i>>>0).toString(36)},Lh=(e,t)=>({p:t,f:bv(JSON.stringify(e))}),Oh=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{let i=Ue._parse(pa(e)),s=i?.f===bv(t)&&W(i.p);return{properties:s?i.p:[],isValid:s}}catch{return{properties:[],isValid:!1}}},ml=(e,t)=>
2t+"|"+(Ue._get(pa(e))||""),ms={},Hc={_is_supported:()=>!0,_error(e){D.error("memoryStorage error: "+e)},_get:e=>e in ms?ms[e]:null,_parse:e=>e in ms?ms[e]:null,_set:(e,t)=>(ms[e]=t,!0),_remove(e){delete ms[e]}},Vi=null,Te={_is_supported(){if(!ue(Vi))return Vi;if(Vi=!0,M(T))Vi=!1;else try{let e="__support__";Te._set(e,"xyz"),Te._get(e)!=='"xyz"'&&(Vi=!1),Te._remove(e)}catch{Vi=!1}return Vi},_error(e){D.error("sessionStorage error: ",e)},_get(e){try{return T?.sessionStorage.getItem(e)}catch(t){Te._error(t)}return null},_parse(e){try{return JSON.parse(Te._get(e))||null}catch{}return null},_set(e,t){try{return T?.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(i){Te._error(i)}return!1},_remove(e){try{T?.sessionStorage.removeItem(e)}catch(t){Te._error(t)}}};mi.DEBUG=!1,mi.LIB_VERSION="1.435.8",mi.LIB_NAME="web";var Qe=mi,Nb=class{constructor(e){if(!e.persistence)throw new Error("it is not valid to not have persistence and be this far into setting up the application");this._getProperty=e.get_property.bind(e),this._setProperty=e.persistence.set_property.bind(e.persistence)}trackSize(e,t){this._setProperty(mc,{sessionId:e,size:this.currentTrackedSize(e)+t})}currentTrackedSize(e){let t=this._getProperty(mc);return ee(i=t)&&oe(i.sessionId)&&ne(i.size)&&t.sessionId===e?t.size:0;var i}};function Sv(e,t){return(function(i){let s=0;for(let n=0;i.length>n;n++)s=(s<<5)-s+i.charCodeAt(n),s|=0;return Math.abs(s)})(e)%100<Tt(100*t,0,100,D)}function os(e){return`$survey_response_${e}`}function $h(e,t){if(!t)return null;let i=e[os(t)];return W(i)?[...i]:i}function wv({event:e,survey:t,responses:i={},submissionId:s,completed:n,surveyLanguage:r,questionSnapshots:o}){return b(b(b(b({},!M(s)&&{$survey_submission_id:s}),e==="sent"?!M(n)&&{$survey_completed:n}:{$survey_partially_completed:Bb(i)}),r&&{$survey_language:r}),(function(a={},l,c){let d={};return l.questions.forEach(h=>{if(M(h.originalQuestionIndex))return;let u=(p=h.originalQuestionIndex)===0?"$survey_response":`$survey_response_${p}`;var p;let _=$h(a,h.id);M(_)||(d[u]=_)}),b(b({$survey_questions:l.questions.map(h=>{var u,p;return{id:h.id,question:(u=c?.[(p=h.id)!==null&&p!==void 0?p:""])!==null&&u!==void 0?u:h.question,response:$h(a,h.id)}})},a),d)})(i,t,o))}function Bb(e={}){return Object.values(e).some(t=>!Y(t))}function nd(e,t){let i=`$survey_${t}/${e.id}`;return e.current_iteration&&e.current_iteration>0&&(i=`$survey_${t}/${e.id}/${e.current_iteration}`),i}function yl(e){return typeof e=="string"&&e.trim()?e.trim():null}function bl(e){return e.toLowerCase()}function Dh(e,t,i){if(!e||!t)return null;let s=bl(t),n=Object.keys(e).find(r=>bl(r)===s);if(n)return i?.debug(`Found exact translation match: ${n}`),n;if(s.includes("-")){let r=s.split("-")[0],o=Object.keys(e).find(a=>bl(a)===r);if(o)return i?.debug(`Found base language translation match: ${o} (from ${t})`),o}return null}var Nh=["thankYouMessageHeader","thankYouMessageDescription","thankYouMessageCloseButtonText","introScreenHeader","introScreenDescription","introScreenButtonText","submitButtonText","backButtonText"];function qb(e,t,i){var s;let n=Dh(e.translations,t,i),r=b({},e),o=!1;if(n){var a;let u=(a=e.translations)===null||a===void 0?void 0:a[n];if(u)if(i?.info(`Applying survey-level translation for language: ${n}`),M(u.name)||(r.name=u.name,o=!0),r.appearance){let p=b({},r.appearance);for(let _ of Nh){let g=u[_];M(g)||(p[_]=g,o=!0)}r.appearance=p}else(function(p){return Nh.some(_=>!M(p[_]))})(u)&&(o=!0)}let l=e.questions.map(u=>(function(p,_,g){var v;let f=Dh(p.translations,_,g);if(!f)return{question:p,matchedKey:null,hasChanges:!1};let m=(v=p.translations)===null||v===void 0?void 0:v[f];if(!m)return{question:p,matchedKey:null,hasChanges:!1};let y=b({},p),w=!1;return M(m.question)||(y.question=m.question,w=!0),M(m.description)||(y.description=m.description,w=!0),M(m.buttonText)||(y.buttonText=m.buttonText,w=!0),"link"in y&&!M(m.link)&&(y.link=m.link,w=!0),"lowerBoundLabel"in y&&!M(m.lowerBoundLabel)&&(y.lowerBoundLabel=m.lowerBoundLabel,w=!0),"upperBoundLabel"in y&&!M(m.upperBoundLabel)&&(y.upperBoundLabel=m.upperBoundLabel,w=!0),"choices"in y&&(function(S){return W(S.choices)}
2)(m)&&(y.choices=m.choices,w=!0),{question:w?y:p,matchedKey:w?f:null,hasChanges:w}})(u,t,i)),c=l.map(u=>u.question),d=l.some(u=>u.hasChanges),h=null;return n||(h=((s=l.find(u=>u.matchedKey))===null||s===void 0?void 0:s.matchedKey)||null),d&&(r.questions=c,o=!0,i?.info(`Applied question-level translations for language: ${t}`)),{survey:r,matchedKey:o?n||h:null}}function rd(e){var t;return!!(!((t=e.conditions)===null||t===void 0||(t=t.events)===null||t===void 0||(t=t.values)===null||t===void 0)&&t.length)}function kv(e){var t;return rd(e)&&!!(!((t=e.conditions)===null||t===void 0||(t=t.events)===null||t===void 0)&&t.repeatedActivation)||e.schedule==="always"}var _a=(e,t)=>{if(!(i=>{try{new RegExp(i)}catch{return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}},Jr=e=>e.toLowerCase(),$r={exact:(e,t)=>t.some(i=>e.some(s=>i===s)),is_not:(e,t)=>t.every(i=>e.every(s=>i!==s)),regex:(e,t)=>t.some(i=>e.some(s=>_a(i,s))),not_regex:(e,t)=>t.every(i=>e.every(s=>!_a(i,s))),icontains:(e,t)=>t.map(Jr).some(i=>e.map(Jr).some(s=>i.includes(s))),not_icontains:(e,t)=>t.map(Jr).every(i=>e.map(Jr).every(s=>!i.includes(s))),gt:(e,t)=>t.some(i=>{let s=parseFloat(i);return!isNaN(s)&&e.some(n=>s>parseFloat(n))}),lt:(e,t)=>t.some(i=>{let s=parseFloat(i);return!isNaN(s)&&e.some(n=>s<parseFloat(n))})};function Cv(e,t){return!e||Object.entries(e).every(([i,s])=>{let n=t?.[i];if(n==null)return!1;let r=$r[s.operator];return!!r&&r(s.values.map(String),[String(n)])})}var Ev=e=>{let t=[...e];for(let i=t.length-1;i>0;i--){let s=Math.floor(Math.random()*(i+1));[t[i],t[s]]=[t[s],t[i]]}return t};function Sl(e,t,i){return Ns({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}var Hb=new Set(["is_not","not_icontains","not_regex"]);function Bh(e,t,i){return!e||e.length===0||e.every(s=>{let n=s.type==="person"?i:t,r=n?.[s.key],o=s.operator||"exact";if(M(r)||ue(r))return Hb.has(o);let a=$r[o];return!!a&&!M(s.value)&&!ue(s.value)&&a(W(s.value)?s.value.map(String):[String(s.value)],W(r)?r.map(String):[String(r)])})}var ir=Ie("[SessionRecording]");function Ub(e,t){return t?e:"!"+e}function Uc(e,t){return e===t||e!=="!"+t&&null}var Wb=class{constructor(e,t,i,s,n,r,o){this._instance=e,this._urlTriggerMatching=t,this._eventTriggerMatching=i,this._linkedFlagMatching=s,this._reportStarted=n,this._tryTakeFullSnapshot=r,this._onTriggerActivated=o,this._sampleRate=null,this._recordingStatusFunction=Mh}onRemoteConfig(e){this._sampleRate=ne(e.sampleRate)?e.sampleRate:null,e.triggerMatchType==="any"?(this._triggerStatusMatcher=new ed([this._eventTriggerMatching,this._urlTriggerMatching]),this._recordingStatusFunction=Eb):(this._triggerStatusMatcher=new td([this._eventTriggerMatching,this._urlTriggerMatching]),this._recordingStatusFunction=Mh),this._instance.register_for_session({[Oa]:e.triggerMatchType}),this._urlTriggerMatching.onConfig(e),this._eventTriggerMatching.onConfig(e),this._linkedFlagMatching.onConfig(e,(t,i)=>{this._reportStarted("linked_flag_matched",{flag:t,variant:i}),this._onTriggerActivated()})}getStatus(e){return this._recordingStatusFunction({receivedFlags:!0,isRecordingEnabled:!0,isSampled:e.isSampled,rrwebError:e.rrwebError,urlTriggerMatching:e.urlTriggerMatching,eventTriggerMatching:e.eventTriggerMatching,linkedFlagMatching:e.linkedFlagMatching,sessionId:e.sessionId})}getMinimumDuration(e){let t=this._instance.get_property("$session_recording_remote_config"),i=t?.minimumDurationMilliseconds;return ne(i)?i:null}checkUrlTriggers(e,t,i,s){this._urlTriggerMatching.checkUrlTriggerConditions(t,i,s,e)}setupEventTriggerListeners(e,t,i){if(this._eventTriggerMatching._eventTriggers.length!==0&&Y(this._removeEventTriggerCaptureHook))return this._removeEventTriggerCaptureHook=e(s=>{try{this._eventTriggerMatching.checkEventTriggerConditions(s.event,i,t)}catch(n){ir.error("Could not activate event trigger",n)}}),this._removeEventTriggerCaptureHook}makeSamplingDecisions(e){var t;let i=this._sampleRate;var s,n;if(!ne(i))return(s=this._instance.persistence)===null||s===void 0||s.unregister("$session_is_sampled"),void((n=this._instance.persistence)===null||n===void 0||n.unregister("$replay_sample_rate"));let r=this._instance.get_property(br),o=this._instance.get_property(Ig),a=Uc(r,e),l=ne(o)&&o!==i,c=M(o)&&r===e,d=l||c||!Ae(a),h=d?Sv(e,i):a;d&&(h?this._reportStarted("sampled"):ir.warn(`Sample rate (${i}) has determined that this sessionId (${e}) will not be sent to the server.`)),(t=this._instance.persistence)===null||t===void 0||t.register({$session_is_sampled:Ub(e,h),$replay_sample_rate:ue(o)&&r===e?null:i})}ensureSamplingDecision(e){if(!ne(this._sampleRate))return;let t=this._instance.get_property(br);Ae(Uc(t,e))||this.makeSamplingDecisions(e)}onFlushComplete(){}clearConditionalRecordingPersistence(){var e,t,i,s,n;(e=this._instance.persistence)===null||e===void 0||e.unregister("$session_recording_event_trigger_activated_session"),(t=this._instance.persistence)===null||t===void 0||t.unregister("$session_recording_url_trigger_activated_session"),(i=this._instance.persistence)===null||i===void 0||i.unregister("$session_is_sampled"),(s=this._instance.persistence)===null||s===void 0||s.unregister("$replay_sample_rate"),(n=this._instance.persistence)===null||n===void 0||n.unregister("$session_past_minimum_duration")}updateActiveTriggers(e){}hasPendingTriggers(e){var t;return((t=this._triggerStatusMatcher)===null||t===void 0?void 0:t.triggerStatus(e))===us}getPendingTriggerConditions(e){return[{label:"URL condition not matched",status:this._urlTriggerMatching.triggerStatusNoSideEffects(e)},{label:"event condition not matched",status:this._eventTriggerMatching.triggerStatusNoSideEffects(e)},{label:"linked flag condition not matched",status:this._linkedFlagMatching.triggerStatusNoSideEffects()}].filter(({status:t})=>t===us).map(({label:t})=>t)}stop(){var e;(e=this._removeEventTriggerCaptureHook)===null||e===void 0||e.call(this),this._removeEventTriggerCaptureHook=void 0,this._eventTriggerMatching.stop(),this._urlTriggerMatching.stop(),this._linkedFlagMatching.stop()}},zb=class{constructor(e,t,i,s,n){this._instance=e,this._urlTriggerMatching=t,this._reportStarted=i,this._tryAddCustomEvent=s,this._onTriggerActivated=n,this._triggerGroupMatchers=[],this._triggerGroupSamplingResults=new Map,this._hasCompletedInitialFlush=!1}onRemoteConfig(e){e.triggerGroups&&e.triggerGroups.length!==0?(this._setupTriggerGroups(e.triggerGroups),this._instance.register_for_session({[Oa]:"v2_trigger_groups",[Nu]:e.triggerGroups.length}),this._urlTriggerMatching.onConfig(e)):ir.warn("[V2Strategy] No trigger groups configured")}getStatus(e){return(function(t){if(t.rrwebError)return Xu;if(!t.receivedFlags)return sn;if(!t.isRecordingEnabled)return Kt;if(t.urlTriggerMatching.urlBlocked)return Zu;let i=t.triggerGroupMatchers,s=t.triggerGroupSamplingResults;if(i.length===0)return Kt;let n=!1,r=!1;for(let o of i){let a=o.triggerStatus(t.sessionId);if(a==="trigger_activated"){let l=o.group.id,c=s.get(l);M(c)?D.warn("[V2 Triggers] Group activated but no sampling decision found",{groupId:l}):c===!0&&(r=!0)}else a==="trigger_pending"&&(n=!0)}return r?Yu:n?sn:Kt})({receivedFlags:!0,isRecordingEnabled:!0,isSampled:e.isSampled,rrwebError:e.rrwebError,urlTriggerMatching:e.urlTriggerMatching,eventTriggerMatching:e.eventTriggerMatching,linkedFlagMatching:e.linkedFlagMatching,sessionId:e.sessionId,triggerGroupMatchers:this._triggerGroupMatchers,triggerGroupSamplingResults:this._triggerGroupSamplingResults,minimumDuration:this.getMinimumDuration(e.sessionId)})}getMinimumDuration(e){let t=null;for(let i of this._triggerGroupMatchers)if(i.triggerStatus(e)==="trigger_activated"){let s=i.group.minDurationMs;ne(s)&&(ue(t)||t>s)&&(t=s)}return t}checkUrlTriggers(e,t,i,s){this._urlTriggerMatching.checkUrlBlocklist(t,i);for(let n of this._triggerGroupMatchers)n.checkUrlTriggerConditions(t,i,r=>{this._checkGroupLevelProperties(n,void 0)&&(n.activateTrigger(r,e),this.updateActiveTriggers(e),this._onTriggerActivated(r))},e)}setupEventTriggerListeners(e,t,i){return this._removeEventTriggerCaptureHook=e(s=>{var n;if(this._hasCompletedInitialFlush)return ir.info("[SessionRecorder] Stopping trigger checks - initial buffer flushed"),(n=this._removeEventTriggerCaptureHook)===null||n===void 0||n.call(this),void(this._removeEventTriggerCaptureHook=void 0);try{for(let r of this._triggerGroupMatchers)r.checkEventTriggerConditions(s.event,o=>{if(!this._checkGroupLevelProperties(r,s.properties))return;let a=(r.group.conditions.events||[]).filter(c=>c.name===s.event),l=this._instance.get_property(Qt);a.some(c=>!c.properties||c.properties.length===0||Bh(c.properties,s.properties,l))&&(r.activateTrigger(o,t),this.updateActiveTriggers(t),this._onTriggerActivated(o))},t)}catch(r){ir.error("Could not activate event trigger for trigger groups",r)}}),this._removeEventTriggerCaptureHook}makeSamplingDecisions(e){for(let i of this._triggerGroupMatchers){var t;let s=i.group,n=s.id,r=s.sampleRate,o=Pg+n,a=this._instance.get_property(o),l=null,c=!1,d=!1,h=!1;if(ee(a)){let _=a.sessionId,g=a.sampleRate,v=a.sampled;c=typeof _=="string"&&_!==e,d=ne(g)&&g!==r,l=_===e&&ne(g)&&g===r&&Ae(v)?v:null}
2else l=a===e||null,c=typeof a=="string"&&a!==e,h=a===e;let u=c||d||h||!Ae(l),p=u?Sv(e+n,r):l;u&&this._tryAddCustomEvent("triggerGroupSamplingDecisionMade",{group_id:n,group_name:s.name,sampleRate:r,isSampled:p}),this._triggerGroupSamplingResults.set(n,p),(t=this._instance.persistence)===null||t===void 0||t.register({[o]:{sessionId:e,sampleRate:r,sampled:p}})}this.updateActiveTriggers(e)}ensureSamplingDecision(e){}onFlushComplete(){this._hasCompletedInitialFlush=!0}clearConditionalRecordingPersistence(){var e,t,i;(e=this._instance.persistence)===null||e===void 0||e.unregister("$session_is_sampled"),(t=this._instance.persistence)===null||t===void 0||t.unregister("$replay_sample_rate"),(i=this._instance.persistence)===null||i===void 0||i.unregister("$session_past_minimum_duration");for(let o of this._triggerGroupMatchers){var s,n,r;let a=o.group.id;(s=this._instance.persistence)===null||s===void 0||s.unregister("$posthog_sr_group_event_trigger_"+a),(n=this._instance.persistence)===null||n===void 0||n.unregister("$posthog_sr_group_url_trigger_"+a),(r=this._instance.persistence)===null||r===void 0||r.unregister("$posthog_sr_group_sampling_"+a)}}updateActiveTriggers(e){let t=[];for(let i of this._triggerGroupMatchers){let s=i.group,n=s.id,r=i.triggerStatus(e)==="trigger_activated",o=this._triggerGroupSamplingResults.get(n)===!0;r&&t.push({id:n,name:s.name,matched:!0,sampled:o})}this._instance.register_for_session({[Du]:t})}hasPendingTriggers(e){for(let t of this._triggerGroupMatchers)if(t.triggerStatus(e)==="trigger_pending")return!0;return!1}getPendingTriggerConditions(e){return this._triggerGroupMatchers.flatMap(t=>t.triggerStatusNoSideEffects(e)!=="trigger_pending"?[]:t.getPendingTriggerConditions(e).map(i=>`trigger group "${t.group.name}": ${i}`))}stop(){var e;(e=this._removeEventTriggerCaptureHook)===null||e===void 0||e.call(this),this._removeEventTriggerCaptureHook=void 0,this._triggerGroupMatchers.forEach(t=>t.stop()),this._triggerGroupMatchers=[],this._triggerGroupSamplingResults.clear(),this._urlTriggerMatching.stop()}_checkGroupLevelProperties(e,t){let i=e.group.conditions.properties;return!i||i.length===0||Bh(i,t,this._instance.get_property(Qt))}_setupTriggerGroups(e){this._triggerGroupMatchers.forEach(t=>t.stop()),this._triggerGroupMatchers=[],this._triggerGroupSamplingResults.clear();for(let t of e){let i=new Cb(this._instance,t,(s,n)=>{this._reportStarted("linked_flag_matched",{flag:s,variant:n,group_id:t.id,group_name:t.name}),this._onTriggerActivated()});this._triggerGroupMatchers.push(i)}}},hs=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","oppref","irclid","_kx"],jb=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...hs],on="<masked>",Vb=["li_fat_id"];function xv(e,t,i){if(!F)return{};let s=t?[...hs,...i||[]]:[],n=Tv(en(F.URL,s,on),e),r=(function(){let o={};return xe(Vb,function(a){let l=tr(a);o[a]=l||null}),o})();return Oe(r,n)}function Tv(e,t){let i=jb.concat(t||[]),s={};return xe(i,function(n){let r=Xs(e,n);s[n]=r||null}),s}function Iv(e){let t=(function(n){return n?n.search("https?://(.*)google.([^/?]*)")===0?"google":n.search("https?://(.*)bing.com")===0?"bing":n.search("https?://(.*)yahoo.com")===0?"yahoo":n.search("https?://(.*)duckduckgo.com")===0?"duckduckgo":null:null})(e),i=t!="yahoo"?"q":"p",s={};if(!ue(t)){s.$search_engine=t;let n=F?Xs(F.referrer,i):"";n.length&&(s.ph_keyword=n)}return s}function od(){return navigator.language||navigator.userLanguage}function Gb(){let e=od();return typeof e=="string"?e.split("-")[0]:void 0}var ga="$direct";function Mv(){return F?.referrer||ga}function Pv(e,t,i=!1){let s=e?[...hs,...t||[]]:[],n=i?ni(Ne?.href):Ne?.href,r=n?.substring(0,1e3);return{r:Mv().substring(0,1e3),u:r?en(r,s,on):void 0}}function Rv(e,t=!1){var i;let{r:s,u:n}=e,r=t?ni(n):n,o={$referrer:s,$referring_domain:s==null?void 0:s==ga?ga:(i=Jt(s))===null||i===void 0?void 0:i.host};
2if(r){o.$current_url=r;let a=Jt(r);o.$host=a?.host,o.$pathname=a?.pathname;let l=Tv(r);Oe(o,l)}if(s){let a=Iv(s);Oe(o,a)}return o}function Fv(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function Qb(){try{return new Date().getTimezoneOffset()}catch{return}}var qh=1e5,Kb=/^[A-Za-z0-9]*[A-Za-z][A-Za-z0-9]*$/,Hh=[],Uh=()=>!1,Jb="@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(" "),Yb="Action BorrowAction ReadAction SearchAction SeekToAction SolveMathAction WatchAction".split(" "),qn="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(" "),Av="Accommodation AdministrativeArea Country Place State".split(" "),Xi={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:Yb,publisher:qn},Event:{startDate:!0,endDate:!0,previousStartDate:!0,aggregateRating:["AggregateRating"],offers:["AggregateOffer","Offer"]},ItemList:{itemListElement:["ListItem"]},ListItem:{item:Hh},Offer:{seller:qn},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:qn,offers:["Offer","AggregateOffer"],aggregateRating:["AggregateRating"]},Service:{name:!0,serviceType:!0,category:!0,provider:qn,areaServed:Av,offers:["AggregateOffer","Offer"],aggregateRating:["AggregateRating"]},OfferCatalog:{name:!0,itemListElement:Hh}},Zb=[["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(" "),Xi.CreativeWork],["BroadcastEvent BusinessEvent EducationEvent Festival MusicEvent SportsEvent TheaterEvent".split(" "),Xi.Event],[qn,Xi.Organization],[Av,Xi.Place],["Car IndividualProduct ProductGroup ProductModel".split(" "),Xi.Product]];function Rs(e,t){return Lr.call(e,t)?e[t]:void 0}function Wh(e){let t=typeof e;return ue(e)||t==="string"||t==="number"||t==="boolean"}function zh(e,t){return t&&(function(i){return oe(i)&&/^(https?:\/\/|\/|\.\.?\/)/i.test(i.trim())})(e)?t(e.trim())||void 0:e}function jh(e,t){return W(e)&&e.every(Wh)?e.map(i=>zh(i,t)).filter(i=>!M(i)):Wh(e)?zh(e,t):void 0}function Xb(e,t){if(typeof e!="string")return;let i=e.trim(),s=i.indexOf("#"),n=0>s?i:i.slice(s+1);if(!(!n||0>s&&(/^[a-z][a-z\d+.-]*:/i.test(i)||i.includes("/")||i.includes("?"))))try{return t(n)?n:void 0}catch{return}}function Vh(e){if(Lr.call(Xi,e))return Xi[e];for(let[t,i]of Zb)if(t.includes(e))return i}function Yr(e,t,i){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:i,writable:!0})}function Wc(e,t,i,s){if(W(e)){let n=e.map(r=>Wc(r,t,i,s)).filter(r=>!M(r));return n.length?n:void 0}return Lv(e,t,i,s)||void 0}function Lv(e,t,i,s){if(!ee(e)||!(function(c){return c.remainingNodes?(c.remainingNodes--,!0):(c.exceeded=!0,!1)})(i))return null;let n=Rs(e,"@type"),r=(function(c){let d=new Set,h=typeof c=="string"?[c]:W(c)?c:[],u=[];
2for(let p of h){if(typeof p!="string")continue;let _=p.replace(/^https?:\/\/schema\.org\//,"");if(100>=_.length&&Kb.test(_)&&!d.has(_)&&(d.add(_),u.push(_),u.length===20))break}return u})(n),o=r.filter(c=>!!Vh(c)&&(!s||!s.length||s.includes(c))),a={};for(let c of Jb){let d=c==="@type"?r.length?typeof n=="string"?r[0]:r:void 0:c==="@id"?Xb(Rs(e,c),t):jh(Rs(e,c),i.maskUrl);M(d)||Yr(a,c,d)}for(let c of o){let d=Vh(c);for(let h of Object.keys(d)){let u=Rs(e,h),p=d[h];if(p===!0){let _=jh(u,i.maskUrl);M(_)||Yr(a,h,_)}else{let _=Wc(u,t,i,p);M(_)||Yr(a,h,_)}}}let l=Wc(Rs(e,"@graph"),t,i);return M(l)||Yr(a,"@graph",l),Object.keys(a).length?a:null}function Gh(e,t,i){if(!ee(e))return null;let s=Rs(e,"@context");if(typeof s!="string"||!/^https?:\/\/schema\.org\/?$/.test(s))return null;let n=Lv(e,t,i);return n?b({"@context":"https://schema.org"},n):null}function sr(e){var t;return e.nodeName==="SCRIPT"&&((t=e.getAttribute("type"))===null||t===void 0?void 0:t.trim().toLowerCase())==="application/ld+json"}function eS(e,t,i){if(typeof t=="string"?e.classList.contains(t):t&&Array.from(e.classList).some(s=>(t.lastIndex=0,t.test(s))))return!0;try{return!!i&&e.matches(i)}catch{return!1}}function wl(e,t,i){for(let s=e;s;){if(eS(s,t,i))return!0;let n=s.parentNode;s=s.parentElement||(n&&n.nodeType===n.DOCUMENT_FRAGMENT_NODE?n.host:null)}return!1}function Qh(e){return sr(e)?[e]:e.nodeType!==e.ELEMENT_NODE?[]:Array.from(e.querySelectorAll("script")).filter(sr)}function Kh(e){return ee(e)?e.network_timing:e}var we=Ie("[SessionRecording]"),tS=[1,2,3,4,5,6,7,12],Jh=e=>({rrwebMethod:e,enqueuedAt:Date.now(),attempt:1});function $o(){var e;return R==null||(e=R.__PosthogExtensions__)===null||e===void 0?void 0:e.rrweb}function In(){var e;return(e=$o())===null||e===void 0?void 0:e.record}function Ov(e){try{return JSON.stringify(e)}catch(t){if(t instanceof RangeError)throw t;return JSON.stringify(e,dv())}}function nr(e){return mv(fv(vv(Ov(e))),!0)}function rr(e){return $v.apply(this,arguments)}function $v(){return($v=Ce(function*(e){let t=yield Df(Ov(e),Qe.DEBUG,{rethrow:!0});return mv(new Uint8Array(yield t.arrayBuffer()),!0)})).apply(this,arguments)}var Ks,Zr,iS=typeof globalThis<"u"&&"CompressionStream"in globalThis&&"TextEncoder"in globalThis&&"Response"in globalThis&&typeof Response.prototype.blob=="function",Dv=!1;function Xr(e){var t;return W(e)&&e.length===0?(Ks=(t=Ks)!==null&&t!==void 0?t:nr([]),Ks):nr(e)}function eo(e){return Nv.apply(this,arguments)}function Nv(){return(Nv=Ce(function*(e){var t;return W(e)&&e.length===0?Ks||(Zr=(t=Zr)!==null&&t!==void 0?t:rr([]).then(i=>(Ks=i,i)).catch(i=>{throw Ks=void 0,Zr=void 0,i}),Zr):rr(e)})).apply(this,arguments)}function Yh(e){return iS&&!Dv&&(function(t){return t.type===2||t.type===3&&(t.data.source===0||t.data.source===8)})(e)}function Js(e){return{event:e,size:ua(e)}}function Bv(e,t){return b(b({},e),{},{data:t,cv:"2024-10"})}function fa(e,t){return b(b({},e),{},{cv:"2024-10",data:b(b({},e.data),t)})}function Do(e){try{if(e.type===2)return Js(Bv(e,nr(e.data)));if(e.type===3&&e.data.source===0)return Js(fa(e,{texts:Xr(e.data.texts),attributes:Xr(e.data.attributes),removes:Xr(e.data.removes),adds:Xr(e.data.adds)}));if(e.type===3&&e.data.source===8)return Js(fa(e,{adds:e.data.adds?nr(e.data.adds):void 0,removes:e.data.removes?nr(e.data.removes):void 0}))}catch(t){we.warn("could not compress event - will use uncompressed event",t)}return{event:e,size:qs(e)}}function zc(){return zc=Ce(function*(e){try{if(e.type===2)return Js(Bv(e,yield rr(e.data)));if(e.type===3&&e.data.source===0){let[t,i,s,n]=yield Promise.all([eo(e.data.texts),eo(e.data.attributes),eo(e.data.removes),eo(e.data.adds)]);return Js(fa(e,{texts:t,attributes:i,removes:s,adds:n}))}if(e.type===3&&e.data.source===8){let[t,i]=yield Promise.all([e.data.adds?rr(e.data.adds):void 0,e.data.removes?rr(e.data.removes):void 0]);return Js(fa(e,{adds:t,removes:i}))}}catch(t){return $f(t)&&(Dv=!0),we.warn("could not compress event asynchronously - trying synchronous compression",t),Do(e)}return{event:e,size:qs(e)}}),zc.apply(this,arguments)}function ad(e,t){return e.type===5&&e.data.tag===t}function Zh(e){return ad(e,"sessionIdle")}function kl(e){return ad(e,"$session_ending")}function Cl(e){return ad(e,"$session_starting")}var sS=class{get sessionId(){return this._sessionId}get _sessionManager(){if(!this._instance.sessionManager)throw new Error("[SessionRecording] must be started with a valid sessionManager.");return this._instance.sessionManager}get _sessionIdleThresholdMilliseconds(){return this._instance.config.session_recording.session_idle_threshold_ms||3e5}get _isSampled(){return Uc(this._instance.get_property(br),this.sessionId)}get _sampleRate(){var e;let t=(e=this._remoteConfig)===null||e===void 0?void 0:e.sampleRate;return ne(t)?t:null}get _minimumDuration(){var e,t;return(e=(t=this._strategy)===null||t===void 0?void 0:t.getMinimumDuration(this.sessionId))!==null&&e!==void 0?e:null}constructor(e,t){this._instance=e,this._endpoint="/s/",this._forceAllowLocalhostNetworkCapture=!1,this._stopRrweb=void 0,this._jsonLdCaptureReady=!1,this._lastActivityTimestamp=Date.now(),this._isActivatingTrigger=!1,this._queuedRRWebEvents=[],this._isIdle="unknown",this._eventsDroppedWhileIdle=0,this._throttledMutationsDropped=0,this._oversizedMutationsDropped=0,this._oversizedMutationBytesDropped=0,this._unstringifiableEventsDropped=0,this._holdFlushUntilInteraction=!1,this._heldEpochShipsOnUnload=!1,this._heldBufferOverflowed=!1,this._suppressNextFreshStartHold=!1,this._rrwebError=!1,this._rrwebStartAttempted=!1,this._snapshotCostErrorLogged=!1,this._hasWarnedClientMaskingOverride=!1,this._hasWarnedExclusiveAttributeMasking=!1,this._maskRegionsFnFailed=!1,this._hasLoggedRecorderCallbackError=!1,this._lastFullSnapshotSessionId=void 0,this._fullSnapshotHealAttemptedFor=void 0,this._pendingBufferRestored=!1,this._pendingCompressionEvents=[],this._queuedCompressionEvents=0,this._compressionQueueGeneration=0,this._isStoppingAfterCompression=!1,this._removePageViewCaptureHook=void 0,this._removeEventTriggerCaptureHook=void 0,this._onSessionIdListener=void 0,this._onSessionIdleResetForcedListener=void 0,this._forceIdleSessionIdListener=void 0,this._onSessionIdCallback=(r,o,a)=>{var l,c,d,h;if(!a||r===this._sessionId&&o===this._windowId)return;let u=!a.noSessionId&&(a.activityTimeout||a.sessionPastMaximumLength),p=this._sessionId,_=this._windowId;var g;if(u&&this._tryAddCustomEvent("$session_ending",{currentSessionId:p,currentWindowId:_,nextSessionId:r,nextWindowId:o,changeReason:a,lastActivityTimestamp:this._lastActivityTimestamp,flushed_size:(g=this._flushedSizeTracker)===null||g===void 0?void 0:g.currentTrackedSize(p)}),(l=this._instance.persistence)===null||l===void 0||l.unregister("$debug_first_full_snapshot_timestamp"),(c=$o())===null||c===void 0||(d=c.resetMaxDepthState)===null||d===void 0||d.call(c),this._tryAddCustomEvent("$session_id_change",{sessionId:r,windowId:o,changeReason:a}),this._clearConditionalRecordingPersistence(),!(this._isIdle===!1&&this.isStarted||this._sessionId===r&&this._windowId===o)){let v=this._sessionId!==r&&this._isIdle!==!1;this._isIdle="unknown",this._restartForSessionIdChange(v)}u&&this._tryAddCustomEvent("$session_starting",{previousSessionId:p,previousWindowId:_,nextSessionId:r,nextWindowId:o,changeReason:a,lastActivityTimestamp:this._lastActivityTimestamp}),(h=this._strategy)===null||h===void 0||h.makeSamplingDecisions(r)},this._isRestartingForSessionIdChange=!1,this._hasPassedMinimumDuration=()=>{var r;return((r=this._instance.persistence)===null||r===void 0?void 0:r.props[Mg])===this._sessionId},this._getBufferDuration=()=>{var r,o;
2if(this._buffer.data.length===0)return null;let a=(r=this._buffer.data[0])===null||r===void 0?void 0:r.timestamp,l=(o=this._buffer.data[this._buffer.data.length-1])===null||o===void 0?void 0:o.timestamp;return ne(a)&&ne(l)?l-a:null},this._isBelowMinimumDuration=()=>{var r,o;let a=this._minimumDuration;if(!ne(a))return!1;if((r=(o=this._instance.config.session_recording)===null||o===void 0?void 0:o.strictMinimumDuration)===null||r===void 0||!r){let d=this._sessionDuration;return ne(d)&&d>=0&&a>d}if(this._hasPassedMinimumDuration())return!1;let l=this._getBufferDuration();return!!ue(l)||a>l||((c=this._instance.persistence)===null||c===void 0||c.register({$session_past_minimum_duration:this._sessionId}),!1);var c},this._onBeforeUnload=()=>{this.status!=="buffering"?(this._holdFlushUntilInteraction&&this._heldEpochShipsOnUnload&&this._documentWasEverVisible&&(this._setFlushHold(void 0),this._heldBufferOverflowed&&(this._heldBufferOverflowed=!1,this._tryTakeFullSnapshot())),this._drainCompressionQueueSync(),this._flushBuffer(!0)):this._clearBuffer()},this._onPageHide=()=>{this._onBeforeUnload()},this._onOffline=()=>{this._tryAddCustomEvent("browser offline",{})},this._onOnline=()=>{this._tryAddCustomEvent("browser online",{})},this._onVisibilityChange=()=>{F?.visibilityState&&(F.visibilityState==="visible"&&(this._documentWasEverVisible=!0),this._tryAddCustomEvent("window "+F.visibilityState,{}))},this._documentWasEverVisible=t==null||t;let{sessionId:i,windowId:s,sessionStartTimestamp:n}=this._sessionManager.checkAndGetSessionAndWindowId();this._sessionId=i,this._windowId=s,this._sessionStartTimestamp=n,this._linkedFlagMatching=new cv(this._instance),this._urlTriggerMatching=new lv(this._instance),this._eventTriggerMatching=new uv(this._instance),this._buffer=this._clearBuffer(),this._pendingBufferStorageKey="ph_replay_pending_buffer_"+JSON.stringify([this._instance.config.persistence_name||this._instance.config.token,this._instance.config.token]),this._sessionManager.sessionTimeoutMs>this._sessionIdleThresholdMilliseconds||we.warn(`session_idle_threshold_ms (${this._sessionIdleThresholdMilliseconds}) is greater than the session timeout (${this._sessionManager.sessionTimeoutMs}). Session will never be detected as idle`),this._flushedSizeTracker=new Nb(this._instance)}setDocumentWasEverVisible(e){e&&(this._documentWasEverVisible=!0)}get _masking(){var e,t,i,s,n,r,o,a,l;let c=(e=this._remoteConfig)===null||e===void 0?void 0:e.masking,d={maskAllInputs:(t=this._instance.config.session_recording)===null||t===void 0?void 0:t.maskAllInputs,maskTextSelector:(i=this._instance.config.session_recording)===null||i===void 0?void 0:i.maskTextSelector,blockSelector:(s=this._instance.config.session_recording)===null||s===void 0?void 0:s.blockSelector,maskAllElementAttributes:(n=this._instance.config.session_recording)===null||n===void 0?void 0:n.maskAllElementAttributes},h=(r=d?.maskAllInputs)!==null&&r!==void 0?r:c?.maskAllInputs,u=(o=d?.maskTextSelector)!==null&&o!==void 0?o:c?.maskTextSelector,p=(a=d?.blockSelector)!==null&&a!==void 0?a:c?.blockSelector,_=(l=d?.maskAllElementAttributes)!==null&&l!==void 0?l:c?.maskAllElementAttributes;return M(h)&&M(u)&&M(p)&&M(_)?void 0:{maskAllInputs:h==null||h,maskTextSelector:u,blockSelector:p,maskAllElementAttributes:_}}_warnIfClientMaskingShadowsServer(){var e;if(this._hasWarnedClientMaskingOverride)return;let t=(e=this._remoteConfig)===null||e===void 0?void 0:e.masking;if(Y(t))return;let i=this._instance.config.session_recording,s=["maskAllInputs","maskTextSelector","blockSelector","maskAllElementAttributes"].filter(n=>{let r=i?.[n],o=t[n];return!M(r)&&r!==o});s.length!==0&&(this._hasWarnedClientMaskingOverride=!0,we.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: '+s.join(", ")+". Remove these masking options from `posthog.init` to use the project setting instead. See https://posthog.com/docs/session-replay/privacy",{client:{maskAllInputs:i?.maskAllInputs,maskTextSelector:i?.maskTextSelector,blockSelector:i?.blockSelector,maskAllElementAttributes:i?.maskAllElementAttributes},project:t}))}get _canvasResolutionScale(){var e;return Tt((e=this._instance.config.session_recording.canvasCapture)===null||e===void 0?void 0:e.resolutionScale,.1,1,Ie("canvas recording resolution scale"),1)}get _canvasRecording(){var e,t,i,s,n,r,o;let a=this._instance.config.session_recording.captureCanvas,l=(e=this._remoteConfig)===null||e===void 0?void 0:e.canvasRecording,c=(t=(i=a?.recordCanvas)!==null&&i!==void 0?i:l?.enabled)!==null&&t!==void 0&&t,d=(s=(n=a?.canvasFps)!==null&&n!==void 0?n:l?.fps)!==null&&s!==void 0?s:4,h=(r=(o=a?.canvasQuality)!==null&&o!==void 0?o:l?.quality)!==null&&r!==void 0?r:.4;if(typeof h=="string"){let u=parseFloat(h);h=isNaN(u)?.4:u}return{enabled:c,fps:Tt(d,0,12,Ie("canvas recording fps"),4),quality:Tt(h,0,1,Ie("canvas recording quality"),.4)}}get _isConsoleLogCaptureEnabled(){var e;let t=!!(!((e=this._remoteConfig)===null||e===void 0)&&e.consoleLogRecordingEnabled),i=this._instance.config.enable_recording_console_log;return i??t}get _networkPayloadCapture(){var e,t,i;let s=(e=this._remoteConfig)===null||e===void 0?void 0:e.networkPayloadCapture,n={recordHeaders:(t=this._instance.config.session_recording)===null||t===void 0?void 0:t.recordHeaders,recordBody:(i=this._instance.config.session_recording)===null||i===void 0?void 0:i.recordBody},r=n?.recordHeaders||s?.recordHeaders,o=n?.recordBody||s?.recordBody,a=Kh(this._instance.config.capture_performance),l=Kh(s?.capturePerformance),c=!!(Ae(a)?a:l);return r||o||c?{recordHeaders:r,recordBody:o,recordPerformance:c}:void 0}_gatherRRWebPlugins(){var e,t;let i=[],s=(e=R.__PosthogExtensions__)===null||e===void 0||(e=e.rrwebPlugins)===null||e===void 0?void 0:e.getRecordConsolePlugin;s&&this._isConsoleLogCaptureEnabled&&i.push(s());let n=(t=R.__PosthogExtensions__)===null||t===void 0||(t=t.rrwebPlugins)===null||t===void 0?void 0:t.getRecordNetworkPlugin;if(this._networkPayloadCapture&&_e(n))if(!hb.includes(Ne.hostname)||this._forceAllowLocalhostNetworkCapture){let r=_e(this._instance.requestRouter.isIngestionEndpoint)?this._instance.requestRouter.isIngestionEndpoint.bind(this._instance.requestRouter):void 0;i.push(n(((o,a,l)=>{let c={payloadSizeLimitBytes:Bs.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...Bs.performanceEntryTypeToObserve],payloadHostDenyList:[...a.payloadHostDenyList||[],...Bs.payloadHostDenyList]},d=o.session_recording.recordHeaders!==!1&&a.recordHeaders,h=o.session_recording.recordBody!==!1&&a.recordBody,u=o.capture_performance!==!1&&a.recordPerformance,p=(v=>{let f=rv(v);return m=>(m?.requestBody&&(m.requestBody=Ch(m.requestBody,m.requestHeaders,f,"Request")),m?.responseBody&&(m.responseBody=Ch(m.responseBody,m.responseHeaders,f,"Response")),m)})(c),_=v=>{return p(((m,y,w)=>{var S;if(w?.(m.name))return;let x=Jt(m.name),k=y.indexOf("http")===0?(S=Jt(y))===null||S===void 0?void 0:S.pathname:y;k==="/"&&(k="");let C=x?.pathname.replace(k||"","");return x&&C&&wb.some(E=>C.indexOf(E)===0)?void 0:m})((kh((f=v).requestHeaders),kh(f.responseHeaders),f),o.api_host,l));var f}
2,g=_e(o.session_recording.maskNetworkRequestFn);return g&&_e(o.session_recording.maskCapturedNetworkRequestFn)?D.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."):g&&(o.session_recording.maskCapturedNetworkRequestFn=v=>{let f=o.session_recording.maskNetworkRequestFn({url:v.name});return!f&&v.isInitial?f:b(b({},v),{},{name:f?.url})}),c.maskRequestFn=_e(o.session_recording.maskCapturedNetworkRequestFn)?v=>{var f,m;let y=_(v);if(!y)return;let w=y.isInitial?{name:"",entryType:y.entryType,startTime:y.startTime,duration:y.duration,endTime:y.endTime,timeOrigin:y.timeOrigin,timestamp:y.timestamp,isInitial:!0}:void 0,S=(f=(m=o.session_recording).maskCapturedNetworkRequestFn)===null||f===void 0?void 0:f.call(m,y);return Y(S)&&w?(ov.add(w),w):S??void 0}:v=>(function(f){if(!M(f))return f.requestBody=Eh(f.requestBody,"Request"),f.responseBody=Eh(f.responseBody,"Response"),f})(_(v)),b(b(b({},Bs),c),{},{recordHeaders:d,recordBody:h,recordPerformance:u,recordInitialRequests:u,streamNetworkBody:o.session_recording.streamNetworkBody===!0})})(this._instance.config,this._networkPayloadCapture,r)))}else we.info("NetworkCapture not started because we are on localhost.");return i}_stripUrlHash(e){return this._instance.config.disable_capture_url_hashes?ni(e):e}_maskReplayUrl(e,t=!1){let i=t?ni(e):this._stripUrlHash(e),s=this._instance.config.mask_personal_data_properties?[...hs,...this._instance.config.custom_personal_data_properties||[]]:[];return this._maskUrl(en(i,s,on))}_maskUrl(e){let t=this._instance.config.session_recording;if(t.maskCapturedNetworkRequestFn){var i;let s=t.maskCapturedNetworkRequestFn({name:e});return(i=s?.name)!==null&&i!==void 0?i:s?.url}if(t.maskNetworkRequestFn){let s=t.maskNetworkRequestFn({url:e});return s?.url}return e}_tryRRWebMethod(e){try{return e.rrwebMethod(),!0}catch(t){return 10>this._queuedRRWebEvents.length?this._queuedRRWebEvents.push({enqueuedAt:e.enqueuedAt||Date.now(),attempt:e.attempt+1,rrwebMethod:e.rrwebMethod}):we.warn("could not emit queued rrweb event.",t,e),!1}}_tryAddCustomEvent(e,t){return this._tryRRWebMethod(Jh(()=>In().addCustomEvent(e,t)))}_canCaptureJsonLd(){var e;return this._jsonLdCaptureReady&&((e=this._instance.config.session_recording)===null||e===void 0?void 0:e.captureJsonLd)===!0&&!this._urlTriggerMatching.urlBlocked&&this._isIdle!==!0}_tryAddJsonLdEvent(e){if(!this._canCaptureJsonLd())return!1;try{let t=In();return!!t&&(t.addCustomEvent("$json_ld",e),this._canCaptureJsonLd())}catch{return!1}}_scheduleJsonLdScan(e=!1){Promise.resolve().then(()=>{var t;return(t=this._jsonLdCapture)===null||t===void 0?void 0:t.scan(e)})}_pageViewFallBack(){try{if(this._instance.config.capture_pageview||!T)return;let e=new URL(T.location.href),t=this._maskReplayUrl(e.origin+e.pathname+e.search);this._lastHref!==t&&(this._lastHref=t,this._tryAddCustomEvent("$url_changed",{href:t}))}catch{}}_processQueuedEvents(){if(this._queuedRRWebEvents.length){let e=[...this._queuedRRWebEvents];this._queuedRRWebEvents=[],e.forEach(t=>{Date.now()-t.enqueuedAt>2e3||this._tryRRWebMethod(t)})}}_tryTakeFullSnapshot(){return this._tryRRWebMethod(Jh(()=>In().takeFullSnapshot()))}get _fullSnapshotIntervalMillis(){var e,t,i;if(!((e=this._strategy)===null||e===void 0)&&e.hasPendingTriggers(this.sessionId)&&!["sampled","active"].includes(this.status)){var s;let n=(s=this._instance.config.session_recording)===null||s===void 0?void 0:s.trigger_pending_buffer_interval_millis;return ne(n)&&Number.isFinite(n)&&n>=1e3&&36e5>=n?n:6e4}return(t=(i=this._instance.config.session_recording)===null||i===void 0?void 0:i.full_snapshot_interval_millis)!==null&&t!==void 0?t:3e5}_scheduleFullSnapshot(){if(this._fullSnapshotTimer&&clearInterval(this._fullSnapshotTimer),this._isIdle===!0)return;let e=this._fullSnapshotIntervalMillis;e&&(this._fullSnapshotTimer=setInterval(()=>{this._tryTakeFullSnapshot()},e))}_onTriggerActivated(e){e==="event"&&this._releaseHoldAndFlush(),!this._urlTriggerMatching.urlBlocked&&["sampled","active"].includes(this.status)&&this._scheduleFullSnapshot()}_pauseRecording(){var e;this._urlTriggerMatching.urlBlocked||(this._urlTriggerMatching.urlBlocked=!0,(e=this._jsonLdCapture)===null||e===void 0||e.scan(),clearInterval(this._fullSnapshotTimer),we.info("recording paused due to URL blocker"),this._tryAddCustomEvent("recording paused",{reason:"url blocker"}))}_resumeRecording(){var e;this._urlTriggerMatching.urlBlocked&&((e=this._jsonLdCapture)===null||e===void 0||e.scan(),this._urlTriggerMatching.urlBlocked=!1,this._tryTakeFullSnapshot(),this._scheduleJsonLdScan(),this._scheduleFullSnapshot(),this._tryAddCustomEvent("recording resumed",{reason:"left blocked url"}),we.info("recording resumed"))}_activateTrigger(e,t){var i;if(e==="event"&&this._releaseHoldAndFlush(),!this._isActivatingTrigger&&((i=this._strategy)===null||i===void 0?void 0:i.hasPendingTriggers(this.sessionId))){this._isActivatingTrigger=!0;try{var s,n;let r=e==="url"?Iu:Mu;(s=this._instance.persistence)===null||s===void 0||s.register({[r]:this.sessionId}),(n=this._strategy)===null||n===void 0||n.updateActiveTriggers(this.sessionId),this._onTriggerActivated(),this._flushBuffer(),this._reportStarted(e+"_trigger_matched",{[e==="url"?"matchedUrl":"matchedEvent"]:t})}finally{this._isActivatingTrigger=!1}}}get isStarted(){return!!this._stopRrweb}get _remoteConfig(){let e=this._instance.get_property(js);if(!e)return;let t;try{t=ee(e)?e:JSON.parse(e)}catch(s){return void we.warn("persisted remote config for session recording is invali
2d and will be ignored",s)}if(!this.isStarted&&!this._isRestartingForSessionIdChange){var i;let s=(i=t.cache_timestamp)!==null&&i!==void 0?i:Date.now();if(Date.now()-s>36e5)return void we.info("persisted remote config for session recording is stale and will be ignored",{cacheTimestamp:s,persistedConfig:e})}return t}_checkOverride(e,t,i){this._instance.get_property(e)&&(t(),i())}start(e){var t,i;let s=this._remoteConfig;if(!s)return void we.info("remote config must be stored in persistence before recording can start");if(!this.isStarted){let a=this._isIdle!==!1&&!this._suppressNextFreshStartHold;this._setFlushHold(a?"no_interaction_since_recording_started":void 0),this._suppressNextFreshStartHold=!1,this._heldEpochShipsOnUnload=a,this._heldBufferOverflowed=!1}this._isStoppingAfterCompression&&(this._invalidateCompressionQueue(),this._clearBuffer());let{sessionId:n,windowId:r,sessionStartTimestamp:o}=this._sessionManager.checkAndGetSessionAndWindowId();this._sessionId=n,this._windowId=r,this._sessionStartTimestamp=o,this._restorePendingBuffer(),(t=this._instance.persistence)===null||t===void 0||t.unregister("$debug_first_full_snapshot_timestamp"),s?.endpoint&&(this._endpoint=s?.endpoint),this._strategy=s?.version===2&&s?.triggerGroups&&s.triggerGroups.length>0?new zb(this._instance,this._urlTriggerMatching,this._reportStarted.bind(this),this._tryAddCustomEvent.bind(this),this._onTriggerActivated.bind(this)):new Wb(this._instance,this._urlTriggerMatching,this._eventTriggerMatching,this._linkedFlagMatching,this._reportStarted.bind(this),this._tryTakeFullSnapshot.bind(this),this._onTriggerActivated.bind(this)),this._strategy.onRemoteConfig(s),(i=this._removeEventTriggerCaptureHook)===null||i===void 0||i.call(this),this._removeEventTriggerCaptureHook=this._strategy.setupEventTriggerListeners(this._instance.on.bind(this._instance,"eventCaptured"),this.sessionId,(a,l)=>this._activateTrigger(a,l)),this._checkOverride(_c,()=>{this.overrideSampling()},()=>{var a;return(a=this._instance.persistence)===null||a===void 0?void 0:a.unregister(_c)}),this._checkOverride(gc,()=>{this.overrideLinkedFlag()},()=>{var a;return(a=this._instance.persistence)===null||a===void 0?void 0:a.unregister(gc)}),this._checkOverride(vc,()=>{this.overrideTrigger("event")},()=>{var a;return(a=this._instance.persistence)===null||a===void 0?void 0:a.unregister(vc)}),this._checkOverride(fc,()=>{this.overrideTrigger("url")},()=>{var a;return(a=this._instance.persistence)===null||a===void 0?void 0:a.unregister(fc)}),this._strategy.makeSamplingDecisions(this.sessionId),this._startRecorder(),this._rrwebError||(Z(T,"beforeunload",this._onBeforeUnload),Z(T,"pagehide",this._onPageHide),Z(T,"offline",this._onOffline),Z(T,"online",this._onOnline),Z(F,"visibilitychange",this._onVisibilityChange),!this._onSessionIdListener&&_e(this._sessionManager.onSessionId)&&(this._onSessionIdListener=this._sessionManager.onSessionId(this._onSessionIdCallback)),!this._onSessionIdleResetForcedListener&&_e(this._sessionManager.on)?this._onSessionIdleResetForcedListener=this._sessionManager.on("forcedIdleReset",()=>{this._clearConditionalRecordingPersistence(),this._isIdle="unknown",this.stop(),this._forceIdleSessionIdListener=this._sessionManager.onSessionId((a,l,c)=>{var d;(d=this._forceIdleSessionIdListener)===null||d===void 0||d.call(this),this._forceIdleSessionIdListener=void 0,this._onSessionIdCallback(a,l,c)})}):_e(this._sessionManager.on)||we.warn("bundled core has no SessionIdManager.on (requires posthog-js >= 1.268.6); recording will start but skip forced-idle-reset handling"),Y(this._removePageViewCaptureHook)&&(this._removePageViewCaptureHook=this._instance.on("eventCaptured",a=>{try{if(a.event==="$pageview"){let l=a?.properties.$current_url?this._maskReplayUrl(a.properties.$current_url):"";if(!l)return;this._tryAddCustomEvent("$pageview",{href:l})}}catch(l){we.error("Could not add $pageview to rrweb session",l)}})),this.status==="active"&&this._reportStarted(e||"recording_initialized"))}_teardown(){var e,t,i,s,n,r;T?.removeEventListener("beforeunload",this._onBeforeUnload),T?.removeEventListener("pagehide",this._onPageHide),T?.removeEventListener("offline",this._onOffline),T?.removeEventListener("online",this._onOnline),F?.removeEventListener("visibilitychange",this._onVisibilityChange),clearInterval(this._fullSnapshotTimer),this._clearFlushBufferTimer(),(e=this._removePageViewCaptureHook)===null||e===void 0||e.call(this),this._removePageViewCaptureHook=void 0,(t=this._removeEventTriggerCaptureHook)===null||t===void 0||t.call(this),this._removeEventTriggerCaptureHook=void 0,(i=this._onSessionIdListener)===null||i===void 0||i.call(this),this._onSessionIdListener=void 0,(s=this._onSessionIdleResetForcedListener)===null||s===void 0||s.call(this),this._onSessionIdleResetForcedListener=void 0,(n=this._forceIdleSessionIdListener)===null||n===void 0||n.call(this),this._forceIdleSessionIdListener=void 0,(r=this._strategy)===null||r===void 0||r.stop(),this._stopRecordingProducers(),this._invalidateCompressionQueue()}_invalidateCompressionQueue(){this._compressionQueueGeneration+=1,this._pendingCompressionEvents=[],this._queuedCompressionEvents=0,this._compressionQueue=void 0,this._isStoppingAfterCompression=!1}_stopRecordingProducers(){var e,t;(e=this._mutationThrottler)===null||e===void 0||e.stop(),this._queuedRRWebEvents=[],(t=this._jsonLdCapture)===null||t===void 0||t.stop(),this._jsonLdCapture=void 0,this._jsonLdCaptureReady=!1;try{var i;(i=this._stopRrweb)===null||i===void 0||i.call(this)}catch(s){we.warn("could not stop rrweb",s)}this._stopRrweb=void 0}_stopAfterCompressionQueueDrains(){if(!this._compressionQueue||this._queuedCompressionEvents===0)return!1;if(this._isStoppingAfterCompression)return!0;this._isStoppingAfterCompression=!0,this._flushHoldReason=void 0;let e=this._compressionQueueGeneration;return this._clearFlushBufferTimer(),this._stopRecordingProducers(),this._compressionQueue.catch(()=>{}).then(()=>{e===this._compressionQueueGeneration&&(this._isStoppingAfterCompression=!1,this._flushBuffer(),this._clearBuffer(),this._releaseHoldAfterStop(),this._teardown(),we.info("stopped"))}).catch(()=>{this._isStoppingAfterCompression=!1,this._releaseHoldAfterStop(),this._teardown(),we.info("stopped")}),!0}stop(){if(this._stopRecordingProducers(),this._isRestartingForSessionIdChange)this._drainCompressionQueueSync();else if(this._stopAfterCompressionQueueDrains())return;this._flushBuffer(),this._clearBuffer(),this._releaseHoldAfterStop(),this._teardown(),we.info("stopped")}_releaseHoldAfterStop(){this._setFlushHold(void 0,{preserveLogDedup:this._isRestartingForSessionIdChange}),this._heldEpochShipsOnUnload=!1}flushBeforeIdentityReset(){(this.isStarted||this._isStoppingAfterCompression)&&(this._drainCompressionQueueSync(),this._flushBuffer())}_restartForSessionIdChange(e){this._isRestartingForSessionIdChange=!0,this._lastActivityTimestamp=Date.now();try{var t,i;this.stop(),this._lastSeenSnapshotCost=void 0,this._unstringifiableEventsDropped=0,this._throttledMutationsDropped=0,this._oversizedMutationsDropped=0,this._oversizedMutationBytesDropped=0,(t=$o())===null||t===void 0||(i=t.resetSnapshotCostState)===null||i===void 0||i.call(t),this.start("session_id_changed")}finally{this._isRestartingForSessionIdChange=!1}this._setFlushHold(e?"no_interaction_since_session_rotated":void 0),this._heldEpochShipsOnUnload=!1}_setFlushHold(e,{preserveLogDedup:t=!1}={}){if(this._holdFlushUntilInteraction=!M(e),this._flushHoldReason=e,M(e))return void(t||(this._lastLoggedFlushHold=void 0));if(this._isRestartingForSessionIdChange)return;let i=`${this.sessionId}:${e}`;i!==this._lastLoggedFlushHold&&(this._lastLoggedFlushHold=i,we.info(`holding buffer: ${e}. nothing is uploaded until the user interacts with the page`))}_releaseHoldAndFlush(){this.isStarted||(this._suppressNextFreshStartHold=!0),this._holdFlushUntilInteraction&&(this._setFlushHold(void 0),this._heldEpochShipsOnUnload=!1,this._heldBufferOverflowed&&(this._heldBufferOverflowed=!1,this._tryTakeFullSnapshot()),this._scheduleFlush
2Buffer())}discard({discardProducerEvents:e=!1}={}){this._holdFlushUntilInteraction=!0,e&&(this._clearBuffer(),this._stopRecordingProducers()),this._clearBuffer(),this._teardown(),this._clearBuffer(),this._releaseHoldAfterStop(),we.info("discarded")}_captureProcessedEvent(e,t,i,s,n){if(i===-1)return this._unstringifiableEventsDropped+=1,void we.warn("could not stringify event - dropping it to keep the rest of the recording");let r={$snapshot_bytes:i,$snapshot_data:t,$session_id:s,$window_id:n};this.status!=="disabled"?(this._ensureFullSnapshotForSession(e,s),this._captureSnapshotBuffered(r)):this._clearBuffer()}_safeTrackFullSnapshotCost(){try{this._trackFullSnapshotCost()}catch(e){this._snapshotCostErrorLogged||(this._snapshotCostErrorLogged=!0,we.error("could not track full snapshot cost",e))}}_trackFullSnapshotCost(){var e,t;let i=(e=$o())===null||e===void 0||(t=e.getLastSnapshotCost)===null||t===void 0?void 0:t.call(e);i&&i!==this._lastSeenSnapshotCost&&(this._lastSeenSnapshotCost=i,500>i.durationMs||we.warn("full snapshot was slow, the page may have been unresponsive while it ran",{durationMs:Math.round(i.durationMs),stylesheetMs:Math.round(i.stylesheetMs),nodeCount:i.nodeCount,cssRuleCount:i.cssRuleCount,nonDeferrableCssRuleCount:i.nonDeferrableCssRuleCount,deferredStylesheetCount:i.deferredStylesheetCount}))}_ensureFullSnapshotForSession(e,t){e.type!==2?e.type===3&&(M(this._lastFullSnapshotSessionId)||this._lastFullSnapshotSessionId===t||this._fullSnapshotHealAttemptedFor===t||(this._fullSnapshotHealAttemptedFor=t,we.info("incremental snapshot for a session with no full snapshot - requesting one",{sessionId:t}),this._tryTakeFullSnapshot())):this._lastFullSnapshotSessionId=t}_finishQueuedCompressionEvent(e){e.counted&&e.generation===this._compressionQueueGeneration&&(this._queuedCompressionEvents=Math.max(0,this._queuedCompressionEvents-1)),e.counted=!1,this._pendingCompressionEvents=this._pendingCompressionEvents.filter(t=>t!==e)}_captureQueuedCompressionEvent(e,t,i){e.processed||e.generation!==this._compressionQueueGeneration||(e.processed=!0,this._captureProcessedEvent(e.event,t,i,e.targetSessionId,e.targetWindowId))}_processQueuedCompressionEventSync(e){try{let t,i=e.event;if(e.compressionEnabled)try{({event:i,size:t}=Do(e.event))}catch(s){we.warn("could not process queued compression event - will use uncompressed event",s)}M(t)&&(t=qs(e.event));try{this._captureQueuedCompressionEvent(e,i,t)}catch(s){we.warn("could not capture queued compression event",s)}}finally{this._finishQueuedCompressionEvent(e)}}_drainCompressionQueueSync(){[...this._pendingCompressionEvents].forEac
2h(e=>{try{this._processQueuedCompressionEventSync(e)}catch(t){we.warn("could not drain queued compression event",t)}})}_enqueueCompression(e,t,i,s){var n=this;let r={event:e,compressionEnabled:t,targetSessionId:i,targetWindowId:s,generation:this._compressionQueueGeneration,processed:!1,counted:!0};this._pendingCompressionEvents.push(r),this._queuedCompressionEvents+=1;let o=(a=Ce(function*(){try{if(r.processed)return;let l,c;try{let d=t?Yh(e)?yield(function(h){return zc.apply(this,arguments)})(e):Do(e):{event:e,size:qs(e)};l=d.event,c=d.size}catch(d){we.warn("could not process queued compression event - will use uncompressed event",d),l=e,c=qs(e)}n._captureQueuedCompressionEvent(r,l,c)}finally{n._finishQueuedCompressionEvent(r)}}),function(){return a.apply(this,arguments)});var a;this._compressionQueue=this._compressionQueue?this._compressionQueue.catch(()=>{}).then(o):o()}onRRwebEmit(e){var t,i,s,n,r,o,a,l,c,d,h;if(!this._instance.sessionManager||(this._processQueuedEvents(),!e||!ee(e)))return;if(e.type===4){let C=this._maskReplayUrl(e.data.href);if(this._lastHref=C,!C)return;e.data.href=C}else this._pageViewFallBack();if((t=this._strategy)===null||t===void 0||t.checkUrlTriggers(this.sessionId,()=>this._pauseRecording(),()=>this._resumeRecording(),(C,E)=>this._activateTrigger(C,E)),this._urlTriggerMatching.urlBlocked&&!(function(C){return C.type===5&&C.data.tag==="recording paused"})(e))return;e.type===2&&(this._safeTrackFullSnapshotCost(),Promise.resolve().then(()=>this._safeTrackFullSnapshotCost()),this._scheduleFullSnapshot(),(d=this._mutationThrottler)===null||d===void 0||d.reset(),(h=this._instance.persistence)===null||h===void 0||h.register_once({$debug_first_full_snapshot_timestamp:e.timestamp},void 0));let u=e.type===2&&((i=this._strategy)===null||i===void 0?void 0:i.hasPendingTriggers(this.sessionId));u&&this._clearBufferBeforeMostRecentMeta();let p=this._mutationThrottler?this._mutationThrottler.throttleMutations(e):e;if(!p)return void(this._isIdle===!0&&this._eventsDroppedWhileIdle++);let _=(function(C){let E=C;if(E&&ee(E)&&E.type===6&&ee(E.data)&&E.data.plugin==="rrweb/console@1"){E.data.payload.payload.length>10&&(E.data.payload.payload=E.data.payload.payload.slice(0,10),E.data.payload.payload.push("...[truncated]"));let I=[];for(let P=0;E.data.payload.payload.length>P;P++)I.push(E.data.payload.payload[P]&&E.data.payload.payload[P].length>2e3?E.data.payload.payload[P].slice(0,2e3)+"...[truncated]":E.data.payload.payload[P]);return E.data.payload.payload=I,C}return C})(p),g=(function(C){return kl(C)?C.data.payload:null})(_),v=(function(C){return Cl(C)?C.data.payload:null})(_),f=(function(C){return Zh(C)?C.data.payload:null})(_);g||v?g?.lastActivityTimestamp&&(_.timestamp=g.lastActivityTimestamp):f?.sessionId||this._updateWindowAndSessionIds(_);let m=(s=(n=(r=g?.currentSessionId)!==null&&r!==void 0?r:v?.nextSessionId)!==null&&n!==void 0?n:f?.sessionId)!==null&&s!==void 0?s:this._sessionId,y=(o=(a=(l=g?.currentWindowId)!==null&&l!==void 0?l:v?.nextWindowId)!==null&&a!==void 0?a:f?.windowId)!==null&&o!==void 0?o:this._windowId;if(this._isIdle===!0&&!(function(C){return Zh(C)||kl(C)||Cl(C)})(_))return void((function(C){return C.type===2||C.type===4||C.type===3&&C.data.source!==9})(_)&&this._eventsDroppedWhileIdle++);_.type===2&&(this._eventsDroppedWhileIdle=0),f&&(_.timestamp=f.lastActivityTimestamp+f.threshold);let w=this._jsonLdCaptureReady;this._jsonLdCaptureReady=!0,u?this._scheduleJsonLdScan(!0):w||this._scheduleJsonLdScan();let S=(c=this._instance.config.session_recording.compress_events)===null||c===void 0||c;if(_.type===5&&_.data.tag==="$json_ld"){let C;try{C=T?this._maskReplayUrl(T.location.href):void 0}catch{}_.data.href=C}if(this._queuedCompressionEvents>0||S&&Yh(_))return void this._enqueueCompression(_,S,m,y);let{event:x,size:k}=S?Do(_):{event:_,size:qs(_)};this._captureProcessedEvent(_,x,k,m,y)}get status(){return this._strategy?this._strategy.getStatus({instance:this._instance,sessionId:this.sessionId,isSampled:this._isSampled,rrwebError:this._rrwebError,urlTriggerMatching:this._urlTriggerMatching,eventTriggerMatching:this._eventTriggerMatching,linkedFlagMatching:this._linkedFlagMatching,remoteConfig:this._remoteConfig}):Kt}log(e,t="log"){var i;(i=this._instance.sessionRecording)===null||i===void 0||i.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:t,trace:[],payload:[JSON.stringify(e)]}},timestamp:Date.now()})}overrideLinkedFlag(){this._linkedFlagMatching.linkedFlagSeen=!0,this._tryTakeFullSnapshot(),this._releaseHoldAndFlush(),this._reportStarted("linked_flag_overridden")}overrideSampling(){var e;(e=this._instance.persistence)===null||e===void 0||e.register({$session_is_sampled:this.sessionId,$replay_sample_rate:null}),this._tryTakeFullSnapshot(),this._releaseHoldAndFlush(),this._reportStarted("sampling_overridden")}overrideTrigger(e){this._activateTrigger(e),this._releaseHoldAndFlush()}_currentMaskedHostname(){try{var e;let t=T==null||(e=T.location)===null||e===void 0?void 0:e.href;if(!t)return;let i=this._maskReplayUrl(t);return i&&new URL(i).hostname||void 0}catch{return}}_clearFlushBufferTimer(){this._flushBufferTimer&&(clearTimeout(this._flushBufferTimer),this._flushBufferTimer=void 0)}
2_scheduleFlushBuffer(){this._flushBufferTimer||(this._flushBufferTimer=setTimeout(()=>{this._flushBuffer()},2e3))}_wouldOpenRecordingWithMarkersOnly(){return this._lastFullSnapshotSessionId!==this._buffer.sessionId&&this._buffer.data.length!==0&&this._buffer.data.every(e=>e?.type===5&&!kl(e)&&!Cl(e))}_describePendingTriggerConditions(){var e,t;return(e=(t=this._strategy)===null||t===void 0?void 0:t.getPendingTriggerConditions(this.sessionId))!==null&&e!==void 0?e:[]}_maybeLogBufferingReason(e){if(e!=="buffering")return M(this._lastLoggedBufferingReason)||this._instance.register_for_session({[Jn]:[]}),void(this._lastLoggedBufferingReason=void 0);let t=this._describePendingTriggerConditions();if(t.length===0)return M(this._lastLoggedBufferingReason)||this._instance.register_for_session({[Jn]:[]}),void(this._lastLoggedBufferingReason=void 0);let i=t.join(", "),s=`${this.sessionId}:${i}`;s!==this._lastLoggedBufferingReason&&(this._lastLoggedBufferingReason=s,this._instance.register_for_session({[Jn]:t}),we.info(`buffering: ${i}`))}_canParkPendingBuffer(){var e;return this._instance.config.persistence!=="memory"&&((e=this._instance.persistence)===null||e===void 0?void 0:e._disabled)!==!0&&Te._is_supported()}_parkBufferForNextPage(){this._buffer.data.length!==0&&this._buffer.size!==this._lastParkedBufferSize&&943718.4>=this._buffer.size&&this._canParkPendingBuffer()&&(this._lastParkedBufferSize=this._buffer.size,Te._set(this._pe
2ndingBufferStorageKey,this._buffer))}_restorePendingBuffer(){if(this._pendingBufferRestored||!this._canParkPendingBuffer())return;this._pendingBufferRestored=!0;let e=Te._parse(this._pendingBufferStorageKey);Te._remove(this._pendingBufferStorageKey),ee(e)&&W(e.data)&&e.data.length!==0&&W(e.sizes)&&e.sizes.length===e.data.length&&ne(e.size)&&e.sessionId===this._sessionId&&e.windowId===this._windowId&&(this._buffer.data.length>0||(this._buffer=e))}_flushBuffer(e=!1){var t;if(this._clearFlushBufferTimer(),this._holdFlushUntilInteraction)return this._buffer;if(this._wouldOpenRecordingWithMarkersOnly())return this._buffer.size>943718.4?this._clearBuffer():(e&&this._parkBufferForNextPage(),this._buffer);let i=this._buffer;(t=this._strategy)===null||t===void 0||t.ensureSamplingDecision(this.sessionId);let s=this._isBelowMinimumDuration(),n=this.status;if(this._maybeLogBufferingReason(n),n==="buffering"||n==="paused"||n==="disabled"||s)return!e||n!=="active"&&n!=="sampled"||this._parkBufferForNextPage(),this._scheduleFlushBuffer(),this._buffer;if(this._buffer!==i)return this._buffer;if(i.data.length>0){var r;let o=this._currentMaskedHostname();$c(i).forEach(a=>{try{var l;(l=this._flushedSizeTracker)===null||l===void 0||l.trackSize(a.sessionId,a.size),this._captureSnapshot(b(b(b(b({$snapshot_bytes:a.size,$snapshot_data:a.data,$session_id:a.sessionId,$window_id:a.windowId,$lib:Qe.LIB_NAME,$lib_version:Qe.LIB_VERSION,$snapshot_host:o},this._throttledMutationsDropped>0?{$sdk_debug_replay_throttled_mutations_dropped:this._throttledMutationsDropped}:{}),this._oversizedMutationsDropped>0?{$sdk_debug_replay_oversized_mutations_dropped:this._oversizedMutationsDropped}:{}),this._oversizedMutationBytesDropped>0?{$sdk_debug_replay_oversized_mutation_bytes_dropped:this._oversizedMutationBytesDropped}:{}),this._unstringifiableEventsDropped>0?{$sdk_debug_replay_unstringifiable_events_dropped:this._unstringifiableEventsDropped}:{}))}catch(c){we.warn("could not capture snapshot chunk - skipping it",c)}}),M(this._lastParkedBufferSize)||(Te._remove(this._pendingBufferStorageKey),this._lastParkedBufferSize=void 0),(r=this._strategy)===null||r===void 0||r.onFlushComplete()}return this._clearBuffer()}_captureSnapshotBuffered(e){var t;let i=2+(((t=this._buffer)===null||t===void 0?void 0:t.data.length)||0),s=e.$session_id,n=this._buffer.sessionId!==s;if(n||this._isIdle!==!0&&!this._holdFlushUntilInteraction&&this._buffer.size+e.$snapshot_bytes+i>943718.4){let r=this._sessionId;if(this._buffer=this._flushBuffer(),this._sessionId!==r)return;n&&this._buffer.data.length>0&&(this._buffer=this._clearBuffer()),this._buffer.sessionId=s,this._buffer.windowId=e.$window_id}this._holdFlushUntilInteraction&&(this._heldBufferOverflowed||this._buffer.size+e.$snapshot_bytes+i>943718.4)?this._heldBufferOverflowed=!0:(this._buffer.size+=e.$snapshot_bytes,this._buffer.data.push(e.$snapshot_data),this._buffer.sizes.push(e.$snapshot_bytes),this._isIdle===!0||this._holdFlushUntilInteraction||this._scheduleFlushBuffer())}_captureSnapshot(e){this._instance.capture("$snapshot",e,{_url:this._instance.requestRouter.endpointFor("api",this._endpoint),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}get _sessionDuration(){var e,t;let i=(e=this._buffer)===null||e===void 0?void 0:e.data[((t=this._buffer)===null||t===void 0?void 0:t.data.length)-1];return i?i.timestamp-this._sessionStartTimestamp:null}_clearBufferBeforeMostRecentMeta(){if(!this._buffer||this._buffer.data.length===0)return this._clearBuffer();let e=-1;for(let t=this._buffer.data.length-1;t>=0;t--)if(this._buffer.data[t].type===4){e=t;break}return 0>e?this._clearBuffer():(this._buffer.data=this._buffer.data.slice(e),this._buffer.sizes=this._buffer.sizes.slice(e),this._buffer.size=this._buffer.sizes.reduce((t,i)=>t+i,0),this._buffer)}_clearBuffer(){return this._buffer={size:0,data:[],sizes:[],sessionId:this._sessionId,windowId:this._windowId},this._buffer}_reportStarted(e,t){this._instance.register_for_session({[qg]:e}),we.info(e.replace("_"," "),t),e!=="session_id_changed"&&this._tryAddCustomEvent("$recording_started",b({reason:e},t))}_isInteractiveEvent(e){var t;return e.type===3&&tS.indexOf((t=e.data)===null||t===void 0?void 0:t.source)!==-1}_updateWindowAndSessionIds(e){let t=this._isInteractiveEvent(e);t||this._isIdle===!0||e.timestamp-this._lastActivityTimestamp>this._sessionIdleThresholdMilliseconds&&(this._isIdle=!0,clearInterval(this._fullSnapshotTimer),this._tryAddCustomEvent("sessionIdle",{eventTimestamp:e.timestamp,lastActivityTimestamp:this._lastActivityTimestamp,threshold:this._sessionIdleThresholdMilliseconds,bufferLength:this._buffer.data.length,bufferSize:this._buffer.size,sessionId:this._sessionId,windowId:this._windowId}),this._flushBuffer());let{windowId:i,sessionId:s}=this._sessionManager.checkAndGetSessionAndWindowId(!t,e.timestamp),n=!1;if(t&&(this._lastActivityTimestamp=e.timestamp,this._isIdle)){let l=this._isIdle==="unknown";this._isIdle=!1,l||(this._tryAddCustomEvent("sessionNoLongerIdle",{reason:"user activity",type:e.type}),n=!0)}let r=this._sessionId!==s,o=this._windowId!==i;if(this._windowId=i,this._sessionId=s,r||o){let l=r&&this._isIdle!==!1;l&&(this._isIdle="unknown"),this._restartForSessionIdChange(l)}else if(t&&this._releaseHoldAndFlush(),n){var a;let l=["sampled","active"].includes(this.status)||((a=this._strategy)===null||a===void 0?void 0:a.hasPendingTriggers(this.sessionId));this._eventsDroppedWhileIdle>0&&l&&this._tryTakeFullSnapshot(),this._scheduleJsonLdScan(),this._scheduleFullSnapshot()}}_clearConditionalRecordingPersistence(){var e;(e=this._strategy)===null||e===void 0||e.clearConditionalRecordingPersistence()}get sdkDebugProperties(){var e;return{$recording_status:this.status,$sdk_debug_replay_flush_hold_reason:this._flushHoldReason,$sdk_debug_replay_internal_buffer_length:this._buffer.data.length,$sdk_debug_replay_internal_buffer_size:this._buffer.size,$sdk_debug_session_start:this._sessionStartTimestamp,$sdk_debug_replay_flushed_size:(e=this._flushedSizeTracker)===null||e===void 0?void 0:e.currentTrackedSize(this.sessionId),$sdk_debug_replay_rrweb_error:this._rrwebError,[oy]:this._rrwebAttached,[ay]:this._rrwebStartAttempted}}get _rrwebAttached(){var e,t,i;return!!this._stopRrweb&&((e=(t=In())===null||t===void 0||(i=t.isRecording)===null||i===void 0?void 0:i.call(t))===null||e===void 0||e)}_startRecorder(){var e;if(this._stopRrweb)return;this._rrwebStartAttempted=!0;let t={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:{}
2,collectFonts:!1,inlineStylesheet:!0,inlineStylesheetBudgetRules:1e4,recordCrossOriginIframes:!1,sampling:void 0,attributeFilter:void 0},i=this._instance.config.session_recording;for(let[c,d]of Object.entries(i||{}))if(c in t)if(c==="maskInputOptions")t.maskInputOptions=b({password:!0},d);else if(c==="sampling"){let h=d??{},u={};M(h.mousemove)||(u.mousemove=h.mousemove),M(h.mouseInteraction)||(u.mouseInteraction=h.mouseInteraction),t.sampling=u}else t[c]=d;var s,n,r,o;i?.captureJsonLd===!0&&t.slimDOMOptions!==!0&&t.slimDOMOptions!=="all"&&(t.slimDOMOptions=b(b({},t.slimDOMOptions),{},{script:!0})),this._canvasRecording&&this._canvasRecording.enabled&&(t.recordCanvas=!0,t.sampling=b(b({},t.sampling),{},{canvas:this._canvasRecording.fps}),t.dataURLOptions={type:"image/webp",quality:this._canvasRecording.quality},t.canvasResolutionScale=this._canvasResolutionScale,t.canvasMasking={configured:()=>{var c;return _e((c=this._instance.config.session_recording)===null||c===void 0||(c=c.canvasCapture)===null||c===void 0?void 0:c.maskRegionsFn)},regionsFn:c=>{var d;let h=(d=this._instance.config.session_recording)===null||d===void 0||(d=d.canvasCapture)===null||d===void 0?void 0:d.maskRegionsFn;if(_e(h))try{var u;return(u=h(c))!==null&&u!==void 0?u:null}catch(p){return this._maskRegionsFnFailed||(this._maskRegionsFnFailed=!0,we.warn("canvasCapture.maskRegionsFn threw, canvas frames will be skipped",p)),null}}}),this._masking&&(t.maskAllInputs=(s=this._masking.maskAllInputs)===null||s===void 0||s,t.maskTextSelector=(n=this._masking.maskTextSelector)!==null&&n!==void 0?n:void 0,t.blockSelector=(r=this._masking.blockSelector)!==null&&r!==void 0?r:void 0,t.maskAllElementAttributes=(o=this._masking.maskAllElementAttributes)!==null&&o!==void 0&&o),t.maskAllElementAttributes&&t.maskAttributeFn&&(t.maskAttributeFn=void 0,this._hasWarnedExclusiveAttributeMasking||(this._hasWarnedExclusiveAttributeMasking=!0,we.warn('`maskAllElementAttributes` and `maskAttributeFn` are mutually exclusive, and `maskAttributeFn` is being ignored. Remove one of the two. Note that `maskAllElementAttributes` can also come from your project\'s "Privacy and masking" settings. See https://posthog.com/docs/session-replay/privacy'))),this._warnIfClientMaskingShadowsServer();let a=In();if(!a)return void we.error("_startRecorder was called but rrwebRecord is not available. This indicates something has gone wrong.");this._mutationThrottler=(e=this._mutationThrottler)!==null&&e!==void 0?e:new Rb(a,{refillRate:this._instance.config.session_recording.__mutationThrottlerRefillRate,bucketSize:this._instance.config.session_recording.__mutationThrottlerBucketSize,onBlockedNode:(c,d)=>{let h=`Too many mutations on node '${c}'. Rate limiting. This could be due to SVG animations or something similar`;we.info(h,{node:d}),this.log("[SessionRecording] "+h,"warn")},onDroppedAttributeMutations:c=>this._throttledMutationsDropped+=c,bytesRefillRate:this._instance.config.session_recording.__mutationBytesRefillRate,bytesBucketSize:this._instance.config.session_recording.__mutationBytesBucketSize,resyncIntervalMs:this._fullSnapshotIntervalMillis,onDroppedOversizedMutation:c=>{this._oversizedMutationsDropped===0&&this.log("[SessionRecording] Dropped an oversized DOM mutation to keep the recording playable. The recording will resync with a full snapshot.","warn"),this._oversizedMutationsDropped+=1,this._oversizedMutationBytesDropped+=c},requestFullSnapshot:()=>this._tryTakeFullSnapshot()});let l=this._gatherRRWebPlugins();if(this._stopRrweb=a(b(b({emit:c=>{this.onRRwebEmit(c)},plugins:l,errorHandler:(c,d)=>d==="rrweb"&&(this._hasLoggedRecorderCallbackError||(this._hasLoggedRecorderCallbackError=!0,we.error("rrweb internal error - recording will continue but may be incomplete",c)),!0)},t),{},{recordAfter:"DOMContentLoaded"})),!this._stopRrweb)return this._rrwebError=!0,void we.error("rrweb failed to start - Loss of recording data is possible. Check the browser console for rrweb errors.");this._rrwebError=!1,i?.captureJsonLd===!0&&F&&T?.MutationObserver&&!this._jsonLdCapture&&(this._jsonLdCapture=(function(c,d,h){let u=new WeakMap,p=h.getCaptureState||(()=>!0),_=qh,g=(function(f,m){let y=m.attributeFilter;return m.maskAllElementAttributes||m.maskAttributeFn||y?.length&&!y.includes("id")?Uh:w=>{let S=f.getElementById(w);return!!S&&S.nodeName!=="SCRIPT"&&(!m.isRecordedElement||m.isRecordedElement(S))&&!wl(S,m.blockClass,m.blockSelector)}})(c,h),v=f=>{try{let m=p();if(!_||m===!1||!f.isConnected||f.ownerDocument!==c||(function(x,k){return wl(x,k.blockClass,k.blockSelector)||wl(x,k.maskTextClass,k.maskTextSelector)})(f,h))return;let y=(function(x,k=Uh,C){if(!x||x.length>qh)return null;try{let E=JSON.parse(x),I={maskUrl:C,remainingNodes:2048,exceeded:!1},P=W(E)?E.map(L=>Gh(L,k,I)):Gh(E,k,I);if(I.exceeded||ue(P)||W(P)&&(!P.length||P.some(ue)))return null;let O=JSON.stringify(P);return O.length>2e4?null:[P,O]}catch{return null}})(f.text,g,h.maskUrl);if(!y)return void u.delete(f);let[w,S]=y;if(ue(m))return void u.set(f,S);if(u.get(f)!==S){if(S.length>_)return void(_=0);h.emit(w)&&(u.set(f,S),_-=S.length)}}catch{return}};try{let f=new d(m=>{try{if(!_||p()===!1)return;let y=w=>{for(let S of Qh(w))v(S)};for(let w of m)if(w.type==="childList")sr(w.target)&&v(w.target),w.addedNodes.forEac
2h(y);else if(w.type==="characterData"){let S=w.target.parentNode;S&&sr(S)&&v(S)}else w.type==="attributes"&&sr(w.target)&&v(w.target)}catch{return}});return f.observe(c,{attributes:!0,attributeFilter:["type"],characterData:!0,childList:!0,subtree:!0}),{scan(m=!1){_&&p()!==!1&&Qh(c.documentElement).forEach(y=>{m&&u.delete(y),v(y)})},stop(){return f.disconnect()}}}catch{return{scan(){},stop(){}}}})(F,T.MutationObserver,{maskUrl:c=>this._maskReplayUrl(c),attributeFilter:t.attributeFilter,blockClass:t.blockClass,blockSelector:t.blockSelector,isRecordedElement:c=>a.mirror.getId(c)>0,maskAllElementAttributes:t.maskAllElementAttributes,maskAttributeFn:t.maskAttributeFn,maskTextClass:t.maskTextClass,maskTextSelector:t.maskTextSelector,getCaptureState:()=>{var c;return((c=this._instance.config.session_recording)===null||c===void 0?void 0:c.captureJsonLd)!==!0||this._urlTriggerMatching.urlBlocked||this._urlTriggerMatching.isCurrentUrlBlocked()?null:this._canCaptureJsonLd()},emit:c=>this._tryAddJsonLdEvent(c)}),this._urlTriggerMatching.isCurrentUrlBlocked()&&this._jsonLdCapture.scan()),this._lastActivityTimestamp=Date.now(),this._isIdle=Ae(this._isIdle)?this._isIdle:"unknown",this.tryAddCustomEvent("$remote_config_received",this._remoteConfig),this._tryAddCustomEvent("$session_options",{sessionRecordingOptions:t,activePlugins:l.map(c=>c?.name)}),this._tryAddCustomEvent("$posthog_config",{config:this._instance.config})}tryAddCustomEvent(e,t){return this._tryAddCustomEvent(e,t)}},nS=["type"],Me=(function(e){return e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e})({}),me=(function(e){return e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e})({}),Mt=(function(e){return e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e})({}),Gi=(function(e){return e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e})({}),Mn=(function(e){return e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e})({}),Pn=(function(e){return e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e})({}),lt=(function(e){return e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e})({});function Xh(e,t){return e.indexOf(t)!==-1}"Mobile".toLowerCase(),"Tablet".toLowerCase(),new RegExp("Xbox","i"),new RegExp("Nintendo","i"),new RegExp("PlayStation","i"),new RegExp("Windows","i"),"0".repeat(32),"0".repeat(16);var ep={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot"],MutationObserver:[]},tp={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:["querySelector","querySelectorAll"],MutationObserver:["constructor"]},to={};function qa(e){if(to[e])return to[e];let t=(function(c){var d,h;let u=(d=globalThis)===null||d===void 0||(d=d.Zone)===null||d===void 0||(h=d.__symbol__)===null||h===void 0?void 0:h.call(d,c);return u&&globalThis[u]?globalThis[u]:void 0})(e)||globalThis[e],i=t.prototype,s=e in ep?ep[e]:void 0,n=!!(s&&s.every(c=>{var d;return!!(!((d=Object.getOwnPropertyDescriptor(i,c))===null||d===void 0||(d=d.get)===null||d===void 0)&&d.toString().includes("[native code]"))})),r=e in tp?tp[e]:void 0,o=!!(r&&r.every(c=>{var d;return typeof i[c]=="function"&&((d=i[c])===null||d===void 0?void 0:d.toString().includes("[native code]"))}));if(n&&o)return to[e]=t.prototype,t.prototype;let a=document.createElement("iframe");a.style.display="none";let l=!1;try{document.body.appendChild(a);let c=a.contentWindow;if(!c)return t.prototype;let d=c[e].prototype;return d?((function(h){return Xh(h,"AppleWebKit")&&!Xh(h,"Chrome")})(navigator.userAgent)&&(a.classList.add("rr-block","ph-no-capture"),a.setAttribute("__rrwebUntaintedPrototype",e),l=!0),to[e]=d):i}catch{return i}finally{!l&&a.parentNode&&document.body.removeChild(a)}}var Hn=Object.create(null);function ys(e,t,i){var s;let n=Hn[e],r=n[i];if(r)return r.call(t);let o=qa(e),a=(s=Object.getOwnPropertyDescriptor(o,i))===null||s===void 0?void 0:s.get;return a?(n[i]=a,a.call(t)):t[i]}Hn.Node=Object.create(null),Hn.ShadowRoot=Object.create(null),Hn.MutationObserver=Object.create(null),Hn.Element=Object.create(null);var io,El={};function so(e,t,i){let s=`${e}.${String(i)}`;if(El[s])return El[s].bind(t);let n=qa(e)[i];return typeof n!="function"?t[i]:(El[s]=n,n.bind(t))}function qv(){return qa("MutationObserver").constructor}function qi(e,t,i){try{if(!(t in e))return()=>{};let s=e[t],n={next:s},r=i(function(...o){return n.next.apply(this,o)});return typeof r=="function"&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__rrweb_original__:{enumerable:!1,value:s},__rrweb_layer__:{enumerable:!1,value:n}})),e[t]=r,()=>{if(e[t]===r)return void(e[t]=n.next);let o=c=>{var d;return typeof c=="function"?(d=c.__rrweb_layer__)!==null&&d!==void 0?d:c.__posthog_layer__:void 0},a=e[t],l=o(a);for(;l;){if(l.next===r)return void(l.next=n.next);a=l.next,l=o(a)}}}catch{return()=>{}}}var se={childNodes:e=>ys("Node",e,"childNodes"),parentNode:e=>ys("Node",e,"parentNode"),parentElement:e=>ys("Node",e,"parentElement"),textContent:e=>ys("Node",e,"textContent"),isConnected(e){if(io===void 0){var t;let i=(t=Object.getOwnPropertyDescriptor(qa("Node"),"isConnected"))===null||t===void 0?void 0:t.get;io=i?.toString().includes("[native code]")?i:null}return io?.call(e)},contains:(e,t)=>so("Node",e,"contains")(t),getRootNode:e=>so("Node",e,"getRootNode")(),host:e=>e&&"host"in e?ys("ShadowRoot",e,"host"):null,styleSheets:e=>e.styleSheets,shadowRoot:e=>e&&"shadowRoot"in e?ys("Element",e,"shadowRoot"):null,querySelector:(e,t)=>
2so("Element",e,"querySelector")(t),querySelectorAll:(e,t)=>so("Element",e,"querySelectorAll")(t),mutationObserver:qv,patch:qi};function Dt(){try{if(typeof performance<"u"&&performance.now)return performance.now()}catch{}return Date.now()}var _s=0;function rS(){_s+=1}function Hv(){return _s}function ld(e,t){return(t!==_s||e>6e4)&&!0}var ri=0,cd=0,ud=0,Et={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},va=null,Ys=null,Tr=[],Ir=0,ma=0,ya={slowestBatchMs:0},as={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0};function ip(e){(ri+=1)>1||(Et={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},Tr=[],Ir=0,Ys=(t=>t&&t>0?t:null)(e),cd=Dt(),ud=_s)}function sp(){return ri===0?va||{durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0}:(ri-=1)>0?Et:(Et.durationMs=Dt()-cd,Et.deferredStylesheetCount=Ir,as.deferredCount+=Ir,Ys=null,ld(Et.durationMs,ud)?Et:va=Et)}function ba(e,t,i){let s=e.length;if(i>=32)return s;for(let n=0;e.length>n;n++){let r=e[n];try{let o=r.cssRules;if(o&&o.length)s+=ba(o,t,i+1);else if(t&&r.styleSheet){let a=r.styleSheet;if(!t.has(a)){t.add(a);let l=a.rules||a.cssRules;l&&(s+=ba(l,t,i+1))}}}catch{}}return s}function Sa(e){if(ri===0)return;let t=ba(e,null,0);Et.cssRuleCount+=t,ma>0&&(Et.nonDeferrableCssRuleCount+=t)}function Uv(e){ma+=1;try{return e()}finally{ma-=1}}function dd(e){ri>0&&(Et.stylesheetMs+=e)}function np(e){if(ri===0||Ys===null)return!1;let t=Et.cssRuleCount-Et.nonDeferrableCssRuleCount;return t>=Ys||t+(function(i){try{let s=i&&(i.rules||i.cssRules);if(!s)return 0;let n=new WeakSet;return n.add(i),ba(s,n,0)}catch{return 0}})(e)>Ys}function oS(){let e=Tr;return Tr=[],e}function no(){as.failedCount+=1}function rp(e){e>0&&(as.abandonedCount+=e)}function or(e){return or=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},or(e)}function $(e,t,i){return(t=(function(s){var n=(function(r){if(or(r)!="object"||!r)return r;var o=r[Symbol.toPrimitive];if(o!==void 0){var a=o.call(r,"string");if(or(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)})(s);return or(n)=="symbol"?n:n+""})(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function hd(e){return e.nodeType===e.ELEMENT_NODE}function ar(e){let t=e&&"host"in e&&"mode"in e&&se.host(e)||null;return!!(t&&"shadowRoot"in t&&se.shadowRoot(t)===e)}function lr(e){return{}.toString.call(e)==="[object ShadowRoot]"}function Wv(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),e}function zv(e){let{cssText:t}=e;if(3>t.split('"').length)return t;let i=["@import",`url(${JSON.stringify(e.href)})`];return e.layerName===""?i.push("layer"):e.layerName&&i.push(`layer(${e.layerName})`),e.supportsText&&i.push(`supports(${e.supportsText})`),e.media.length&&i.push(e.media.mediaText),i.join(" ")+";"}var xl=0;function cr(e){let t=xl===0,i=t?Dt():0;xl+=1;try{let s=e.rules||e.cssRules;if(!s)return null;Sa(s);let n=e.href;return!n&&e.ownerNode&&(n=e.ownerNode.baseURI),Wv(Array.from(s,r=>jv(r,n)).join(""))}catch{return null}finally{xl-=1,t&&dd(Dt()-i)}}function jv(e,t){if(Vc(e)){let s;try{s=cr(e.styleSheet)||zv(e)}catch{s=e.cssText}try{var i;if(s&&(!((i=e.styleSheet)===null||i===void 0)&&i.href))return ls(s,e.styleSheet.href)}catch{}return s}{let s=e.cssText;return No(e)&&e.selectorText.includes(":")&&(s=jc(s)),t?ls(s,t):s}}function jc(e){return e.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")}function Vc(e){return"styleSheet"in e}function No(e){return"selectorText"in e}var op=/^-?[A-Za-z_][\w-]*$/,aS=/^-?[A-Za-z_][\w-]*(\.-?[A-Za-z_][\w-]*)*$/;function lS(e){let t=[],i=!1,s=null,n=new Map;function r(l){let c=t.pop();if(c.kind==="group"){if(l===null){for(;t.length>0&&t[t.length-1].kind==="group";)t.pop();return void r(null)}let d=t[t.length-1];return d.parts.push(l),void(d.index+=1)}if(!c.importRule)return i=!0,void(s=l);o(t[t.length-1],c.importRule,l)}function o(l,c,d){try{let u;
2try{u=d||zv(c)}catch{u=c.cssText}try{var h;u&&(!((h=c.styleSheet)===null||h===void 0)&&h.href)&&(u=ls(u,c.styleSheet.href))}catch{}u&&l.parts.push(u),l.index+=1}catch{r(null)}}function a(l){let c=l.rules[l.index];if(l.kind==="sheet"&&Vc(c)){let h=n.get(c);return h===null?(l.parts.push(c.cssText),void(l.index+=1)):h?void t.push({kind:"sheet",sheet:h.sheet,rules:h.rules,sheetHref:h.sheetHref,index:0,parts:[],importRule:c}):void o(l,c,null)}if((function(h,u){try{let p=(function(g){let v=g;if(!v.cssRules||v.cssRules.length===0)return null;if(v.media&&typeof v.media.mediaText=="string")return`@media ${v.media.mediaText} {`;if(No(g)){if(typeof v.type=="number"&&v.type!==1)return null;let m=v.style?v.style.cssText:"";return`${g.selectorText} {${m?" "+m:""}`}if("containerName"in v)return typeof v.containerQuery!="string"||v.containerName&&!op.test(v.containerName)?null:`@container ${v.containerName?`${v.containerName} `:""}${v.containerQuery} {`;if(typeof v.conditionText=="string"){let m="";try{var f;m=((f=g.constructor)===null||f===void 0?void 0:f.name)||""}catch{return null}return m===""||m==="Object"||m==="CSSSupportsRule"?`@supports ${v.conditionText} {`:null}return typeof v.name=="string"?"keyText"in v.cssRules[0]?op.test(v.name)?`@keyframes ${v.name} {`:null:v.name===""?"@layer {":aS.test(v.name)?`@layer ${v.name} {`:null:null})(h);if(p===null)return!1;let _=u.sheetHref;return t.push({kind:"group",rules:Array.from(h.cssRules),sheetHref:_,index:0,parts:[],prelude:_?ls(p,_):p,fixColons:u.kind==="sheet"&&No(h)&&h.selectorText.includes(":")}),!0}catch{return!1}})(c,l))return;let d=c.cssText;l.kind==="sheet"&&No(c)&&c.selectorText.includes(":")&&(d=jc(d)),l.parts.push(l.sheetHref?ls(d,l.sheetHref):d),l.index+=1}return(function(l){try{let c=l.rules||l.cssRules;if(!c)return!1;Sa(c);let d=l.href;!d&&l.ownerNode&&(d=l.ownerNode.baseURI);let h=Array.from(c);return t.push({kind:"sheet",sheet:l,rules:h,sheetHref:d,index:0,parts:[],importRule:null}),(function(u,p){let _=[{sheet:p,rules:u,index:0}];for(;_.length>0;){let g=_[_.length-1];if(g.index>=g.rules.length){_.pop();continue}let v=g.rules[g.index];if(g.index+=1,!Vc(v)||n.has(v))continue;let f=null;try{f=v.styleSheet}catch{n.set(v,null);continue}if(f&&!_.some(m=>m.sheet===f))try{let m=f.rules||f.cssRules;if(!m)continue;Sa(m);let y=f.href;!y&&f.ownerNode&&(y=f.ownerNode.baseURI);let w=Array.from(m);n.set(v,{sheet:f,rules:w,sheetHref:y}),_.push({sheet:f,rules:w,index:0})}catch{}}})(h,l),!0}catch{return!1}})(e)||(i=!0),{advance(l){if(i)return!0;let c=Dt(),d=l>0?l:1;try{for(;!i&&d>0;){let h=t[t.length-1];if(h.index>=h.rules.length){let u=null;try{if(h.kind==="group"){let p=h.prelude+h.parts.join("")+"}";u=h.fixColons?jc(p):p}else u=Wv(h.parts.join(""))}catch{}r(u);continue}d-=1;try{a(h)}catch{r(null)}}}catch{i=!0,s=null}finally{dd(Dt()-c)}return i},text:()=>i?s:null,remainingRules(){if(i)return 0;let l=0;for(let c of t)l+=c.rules.length-c.index;return l}}}var Vv=class{constructor(){$(this,"idNodeMap",new Map),$(this,"nodeMetaMap",new WeakMap)}getId(e){var t,i;return e&&(t=(i=this.getMeta(e))===null||i===void 0?void 0:i.id)!==null&&t!==void 0?t:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){let t=this.getId(e);if(this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach(i=>this.removeNodeFromMap(i)),hd(e)){let i=se.shadowRoot(e);i&&this.removeNodeFromMap(i),e.nodeName==="IFRAME"&&e.contentDocument&&this.removeNodeFromMap(e.contentDocument)}}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){this.idNodeMap.set(t.id,e),this.nodeMetaMap.set(e,t)}replace(e,t){let i=this.getNode(e);if(i){let s=this.nodeMetaMap.get(i);s&&this.nodeMetaMap.set(t,s)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function wa({element:e,maskInputOptions:t,tagName:i,type:s,value:n,maskInputFn:r}){let o=n||"",a=s&&oi(s);return(t[i.toLowerCase()]||a&&t[a])&&(o=r?r(o,e):"*".repeat(o.length)),o}function oi(e){return e.toLowerCase()}var cS=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 ka({element:e,name:t,value:i,maskAllElementAttributes:s,maskAttributeFn:n,isGenerated:r=!1}){return i&&(s?r&&cS.has(oi(t))?i:"*".repeat(i.length):n?n(t,i,e):i)}var ap="__rrweb_original__";function Ca(e){try{let t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?oi(t):null}catch{return null}}var uS=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,dS=/^(?:[a-z+]+:)?\/\//i,hS=/^www\..*/i,pS=/^(data:)([^,]*),(.*)/i;function ls(e,t){return(e||"").replace(uS,(i,s,n,r,o,a)=>{let l=n||o||a,c=s||r||"";if(!l)return i;if(dS.test(l)||hS.test(l))return`url(${c}${l}${c})`;if(pS.test(l))return`url(${c}${l}${c})`;if(l[0]==="/")return`url(${c}${(function(u){let p="";return p=u.indexOf("//")>-1?u.split("/").slice(0,3).join("/"):u.split("/")[0],p=p.split("?")[0],p})(t)+l}${c})`;let d=t.split("/"),h=l.split("/");d.pop();for(let u of h)u!=="."&&(u===".."?d.pop():d.push(u));return`url(${c}${d.join("/")}${c})`})}var bs,lp,Rn=new Map,_S=1,gS=new RegExp("[^a-z0-9-_:]");function Gv(){return _S++}var cp=!1,fS=/^[^ \t\n\r\u000c]+/,vS=/^[, \t\n\r\u000c]+/,up=new WeakMap;function Ss(e,t){return t&&t.trim()!==""?pd(e,t):t}function pd(e,t){let i=up.get(e);if(i||(i=e.createElement("a"),up.set(e,i)),t){if(t.startsWith("blob:")||t.startsWith("data:"))return t}else t="";return i.setAttribute("href",t),i.href}function Tl(e,t){return t?.maxBase64ImageLength?(function(i,s){return s&&i.length>s?"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxkZWZzPgogICAgPHBhdHRlcm4gaWQ9InN0cmlwZXMiIHBhdHRlcm5Vbml0cz0idXNlclNwYWNlT25Vc2UiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+CiAgICAgIDxyZWN0IHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0iYmxhY2siLz4KICAgICAgPHBhdGggZD0iTTggMEgxNkwwIDE2VjhMOCAwWiIgZmlsbD0iIzJEMkQyRCIvPgogICAgICA8cGF0aCBkPSJNMTYgOFYxNkg4TDE2IDhaIiBmaWxsPSIjMkQyRDJEIi8+CiAgICA8L3BhdHRlcm4+CiAgPC9kZWZzPgogIDxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjc3RyaXBlcykiLz4KPC9zdmc+Cg==":i})(e,t.maxBase64ImageLength):e}function Qv(e,t,i,s,n,r){if(!s)return s;if(i==="src"||i==="href"&&(t!=="use"||s[0]!=="#")){if(t==="link"&&n){var o;let l=(o=n.sheet)===null||o===void 0?void 0:o.href;if(l)return l}let a=Ss(e,s);if(a.startsWith("data:")){if(t==="img"&&n){let l=a;return(r?.type||r?.quality!==void 0)&&(l=(function(c,d,h,u){if(1e5>
2d.length||!c.complete||c.naturalWidth===0||c.naturalWidth>4096||c.naturalHeight>4096)return d;let p=Rn.get(d);if(p&&p.type===h&&p.quality===u)return p.result;try{let _=document.createElement("canvas");_.width=c.naturalWidth,_.height=c.naturalHeight;let g=_.getContext("2d");if(!g)return d;g.drawImage(c,0,0);let v=_.toDataURL(h||"image/webp",u??.4),f=d.length>v.length?v:d;if(Rn.size>=10){let m=Rn.keys().next().value;m!==void 0&&Rn.delete(m)}return Rn.set(d,{type:h,quality:u,result:f}),f}catch{return d}})(n,a,r.type,r.quality)),Tl(l,r)}if(t==="image")return Tl(a,r)}return a}if(i==="xlink:href"&&s[0]!=="#"){let a=Ss(e,s);return t==="image"&&a.startsWith("data:")?Tl(a,r):a}return i!=="background"||t!=="table"&&t!=="td"&&t!=="th"?i==="srcset"?(function(a,l){if(l.trim()==="")return l;let c=0;function d(u){let p,_=u.exec(l.substring(c));return _?(p=_[0],c+=p.length,p):""}let h=[];for(;d(vS),l.length>c;){let u=d(fS);if(u.slice(-1)===",")u=Ss(a,u.substring(0,u.length-1)),h.push(u);else{let p="";u=Ss(a,u);let _=!1;for(;;){let g=l.charAt(c);if(g===""){h.push((u+p).trim());break}if(_)g===")"&&(_=!1);else{if(g===","){c+=1,h.push((u+p).trim());break}g==="("&&(_=!0)}p+=g,c+=1}}}return h.join(", ")})(e,s):i==="style"?ls(s,pd(e)):t==="object"&&i==="data"?Ss(e,s):s:Ss(e,s)}function Kv(e,t,i){return(e==="video"||e==="audio")&&oi(t)==="autoplay"}function dp(e){return typeof e=="string"&&oi(e).split(/\s+/).includes("stylesheet")}function Ea(e,t,i){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!i&&Ea(se.parentNode(e),t,i);for(let s=e.classList.length;s--;)if(t.test(e.classList[s]))return!0;return!!i&&Ea(se.parentNode(e),t,i)}function Jv(e,t,i,s){let n;if(hd(e)){if(n=e,!se.childNodes(n).length)return!1}else{if(se.parentElement(e)===null)return!1;n=se.parentElement(e)}try{if(typeof t=="string"){if(s){if(n.closest(`.${t}`))return!0}else if(n.classList.contains(t))return!0}else if(Ea(n,t,s))return!0;if(i){if(s){if(n.closest(i))return!0}else if(n.matches(i))return!0}}catch{}return!1}function ws(e,t,i){let s=e.removeEventListener;typeof s=="function"&&s.call(e,t,i)}var ur=new Map;function hp(e,t){return Array.from(e.styleSheets).find(i=>i.href===t)}function Ot(e){return e==null?"":e.toLowerCase()}var Gc=!1,Qc=!1;function Hs(e,t){let{doc:i,mirror:s,blockClass:n,blockSelector:r,maskTextClass:o,maskTextSelector:a,skipChild:l=!1,inlineStylesheet:c=!0,maskInputOptions:d={},maskTextFn:h,maskInputFn:u,maskAllElementAttributes:p=!1,maskAttributeFn:_,slimDOMOptions:g,dataURLOptions:v={},inlineImages:f=!1,recordCanvas:m=!1,canvasMaskingConfigured:y,onSerialize:w,onIframeLoad:S,iframeLoadTimeout:x=5e3,onIframeListenerRegistered:k,onStylesheetLoad:C,stylesheetLoadTimeout:E=5e3,keepIframeSrcFn:I=()=>!1,newlyAddedElement:P=!1,depth:O=0,maxDepth:L=50}=t,{needsMask:A}=t,{preserveWhiteSpace:B=!0}=t;if(O>=L)return Qc=!0,Gc||(Gc=!0,console.warn(`[rrweb-snapshot] DOM tree depth exceeded max depth of ${L}. Children beyond this depth will not be recorded. This may indicate deeply nested DOM structures.`)),null;A||(A=Jv(e,o,a,A===void 0)),ri>0&&(Et.nodeCount+=1);let q=(function(N,V){let{doc:Q,mirror:z,blockClass:ae,blockSelector:be,needsMask:Ee,inlineStylesheet:pe,maskInputOptions:ve={},maskTextFn:dt,maskInputFn:st,maskAllElementAttributes:Le=!1,maskAttributeFn:ze,dataURLOptions:It={},inlineImages:Ci,recordCanvas:nt,canvasMaskingConfigured:Bt,keepIframeSrcFn:Yt,newlyAddedElement:qe=!1}=V,Pe=(function(X,at){if(!at.hasNode(X))return;let Fe=at.getId(X);return Fe===1?void 0:Fe})(Q,z);switch(N.nodeType){case N.DOCUMENT_NODE:return N.compatMode!=="CSS1Compat"?{type:lt.Document,childNodes:[],compatMode:N.compatMode}:{type:lt.Document,childNodes:[]};case N.DOCUMENT_TYPE_NODE:return{type:lt.DocumentType,name:N.name,publicId:N.publicId,systemId:N.systemId,rootId:Pe};case N.ELEMENT_NODE:return(function(X,at){let{doc:Fe,blockClass:te,blockSelector:je,inlineStylesheet:Ve,maskInputOptions:le={},maskInputFn:ge,maskAllElementAttributes:mt=!1,maskAttributeFn:fe,dataURLOptions:he={},inlineImages:re,recordCanvas:He,canvasMaskingConfigured:Re,keepIframeSrcFn:qt,newlyAddedElement:Ht=!1,rootId:fs}=at,li=(function(G,Se,rt){try{if(typeof Se=="string"){if(G.classList.contains(Se))return!0}else for(let ht=G.classList.length;ht--;)if(Se.test(G.classList[ht]))return!0;
2if(rt)return G.matches(rt)}catch{}return!1})(X,te,je),Ye=(function(G){if(G instanceof HTMLFormElement)return"form";let Se=oi(G.tagName);return gS.test(Se)?"div":Se})(X),De=new Set,de={},Ut=X.attributes.length;for(let G=0;Ut>G;G++){let Se=X.attributes[G];Kv(Ye,Se.name)||(de[Se.name]=Qv(Fe,Ye,oi(Se.name),Se.value,X,he))}if(Ye==="link"&&Ve&&!li&&dp(de.rel)){let G=X.sheet;if(!G){let rt=(function(ht){return ht.href})(X);rt&&(G=hp(Fe,rt),!G&&rt.includes(".css"))&&(G=hp(Fe,window.location.origin+"/"+rt.replace(window.location.href,"")))}let Se=null;G&&(np(G)?ri>0&&(Tr.push(X),Ir+=1):Se=cr(G)),Se&&(delete de.rel,delete de.href,de._cssText=Se)}var Wt;if(Ye==="style"&&X.sheet&&!(X.innerText||se.textContent(X)||"").trim().length){let G=Uv(()=>cr(X.sheet));G&&(de._cssText=G)}if(Ye==="input"||Ye==="textarea"||Ye==="select"){let G=X.value,Se=X.checked;de.type!=="radio"&&de.type!=="checkbox"&&de.type!=="submit"&&de.type!=="button"&&G?de.value=wa({element:X,type:Ca(X),tagName:Ye,value:G,maskInputOptions:le,maskInputFn:ge}):Se&&(de.checked=Se)}if(Ye==="option"&&(X.selected&&!le.select?de.selected=!0:delete de.selected),Ye==="dialog"&&X.open){try{de.rr_open_mode=X.matches("dialog:modal")?"modal":"non-modal"}catch{de.rr_open_mode="modal",de.ph_rr_could_not_detect_modal=!0}De.add("rr_open_mode")}if(Ye==="canvas"&&He&&!Re?.())try{if(X.__context==="2d")(function(G){let Se=G.getContext("2d");if(!Se)return!0;for(let rt=0;G.width>rt;rt+=50)for(let ht=0;G.height>ht;ht+=50){let Xe=Se.getImageData,ci=ap in Xe?Xe[ap]:Xe,zi;try{zi=ci.call(Se,rt,ht,Math.min(50,G.width-rt),Math.min(50,G.height-ht))}catch{return!1}if(new Uint32Array(zi.data.buffer).some(Bd=>Bd!==0))return!1}return!0})(X)||(de.rr_dataURL=X.toDataURL(he.type,he.quality));else if(!("__context"in X)){let G=X.toDataURL(he.type,he.quality),Se=Fe.createElement("canvas");Se.width=X.width,Se.height=X.height,G!==Se.toDataURL(he.type,he.quality)&&(de.rr_dataURL=G)}}catch(G){((Wt=G)==null?void 0:Wt.name)==="SecurityError"?cp||(cp=!0,console.warn("Cannot read canvas pixels, so this canvas is left out of the recording. A cross-origin image or video drawn into it taints it.",Wt)):console.warn("Cannot read canvas pixels, so this canvas is left out of the recording.",Wt)}let jr,Vr=!1;if(Ye==="img"&&re){bs||(bs=Fe.createElement("canvas"),lp=bs.getContext("2d"));let G=X,Se=G.currentSrc||G.getAttribute("src")||"<unknown-src>",rt=G.crossOrigin,ht=(ci,zi)=>Vr?ka({element:X,name:ci,value:zi,maskAllElementAttributes:mt,maskAttributeFn:fe}):zi,Xe=()=>{ws(G,"load",Xe);try{bs.width=G.naturalWidth,bs.height=G.naturalHeight,lp.drawImage(G,0,0);let ci=bs.toDataURL(he.type,he.quality);de.rr_dataURL=ht("rr_dataURL",ci)}catch(ci){if(G.crossOrigin!=="anonymous")return G.crossOrigin="anonymous",void(G.complete&&G.naturalWidth!==0?Xe():G.addEventListener("load",Xe));console.warn(`Cannot inline img src=${Se}! Error: ${ci}`)}G.crossOrigin==="anonymous"&&(rt?de.crossOrigin=ht("crossOrigin",rt):G.removeAttribute("crossorigin"))};G.complete&&G.naturalWidth!==0?Xe():G.addEventListener("load",Xe)}if(Ye==="audio"||Ye==="video"){let G=de;G.rr_mediaState=X.paused?"paused":"played",De.add("rr_mediaState"),G.rr_mediaCurrentTime=X.currentTime,G.rr_mediaPlaybackRate=X.playbackRate,G.rr_mediaMuted=X.muted,G.rr_mediaLoop=X.loop,G.rr_mediaVolume=X.volume}if(Ht||(X.scrollLeft&&(de.rr_scrollLeft=X.scrollLeft),X.scrollTop&&(de.rr_scrollTop=X.scrollTop)),li){var yn,bn,Sn;let{width:G,height:Se,left:rt,top:ht}=X.getBoundingClientRect(),Xe=(yn=Fe.defaultView)===null||yn===void 0?void 0:yn.getComputedStyle(X);de={class:de.class,rr_width:`${G}px`,rr_height:`${Se}px`,rr_left:`${Math.floor(rt+(((bn=Fe.defaultView)===null||bn===void 0?void 0:bn.scrollX)||0))}px`,rr_top:`${Math.floor(ht+(((Sn=Fe.defaultView)===null||Sn===void 0?void 0:Sn.scrollY)||0))}px`},De.add("rr_width"),De.add("rr_height"),De.add("rr_left"),De.add("rr_top"),Xe&&(de.rr_position=Xe.position||"static",De.add("rr_position"),Xe.transform&&Xe.transform!=="none"&&(de.rr_transform=Xe.transform,De.add("rr_transform")),Xe.display&&Xe.display.startsWith("inline")&&(de.rr_display=Xe.display,De.add("rr_display")))}if(Ye!=="iframe"||qt(de.src)||(X.contentDocument||(de.rr_src=de.src),delete de.src),mt||fe)for(let[G,Se]of Object.entries(de))typeof Se!="string"&&Se!==null||(de[G]=ka({element:X,name:G,value:Se,maskAllElementAttributes:mt,maskAttributeFn:fe,isGenerated:De.has(G)}));Vr=!0;try{customElements.get(Ye)&&(jr=!0)}catch{}return{type:lt.Element,tagName:Ye,attributes:de,childNodes:[],isSVG:(wn=X,!!(wn.tagName==="svg"||wn.ownerSVGElement)||void 0),needBlock:li,rootId:fs,isCustom:jr};var wn})(N,{doc:Q,blockClass:ae,blockSelector:be,inlineStylesheet:pe,maskInputOptions:ve,maskInputFn:st,maskAllElementAttributes:Le,maskAttributeFn:ze,dataURLOptions:It,inlineImages:Ci,recordCanvas:nt,canvasMaskingConfigured:Bt,keepIframeSrcFn:Yt,newlyAddedElement:qe,rootId:Pe});case N.TEXT_NODE:return(function(X,at){let{needsMask:Fe,maskTextFn:te,rootId:je}=at,Ve=se.parentNode(X),le=Ve&&Ve.tagName,ge=se.textContent(X),mt=le==="STYLE"||void 0,fe=le==="SCRIPT"||void 0;if(mt&&ge){try{var he;if(!(X.nextSibling||X.previousSibling)){if(!np(Ve.sheet)){if(!((he=Ve.sheet)===null||he===void 0)&&he.cssRules){let re=cr(Ve.sheet);re&&!/(?:^|[\s;{}
2])-?[a-zA-Z][\w-]*\s*:\s*;/.test(re)&&(ge=re)}}}}catch(re){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${re}`,X)}ge=ls(ge,pd(at.doc))}return fe&&(ge="SCRIPT_PLACEHOLDER"),!mt&&!fe&&ge&&Fe&&(ge=te?te(ge,se.parentElement(X)):ge.replace(/[\S]/g,"*")),{type:lt.Text,textContent:ge||"",isStyle:mt,rootId:je}})(N,{doc:Q,needsMask:Ee,maskTextFn:dt,rootId:Pe});case N.CDATA_SECTION_NODE:return{type:lt.CDATA,textContent:"",rootId:Pe};case N.COMMENT_NODE:return{type:lt.Comment,textContent:se.textContent(N)||"",rootId:Pe};default:return!1}})(e,{doc:i,mirror:s,blockClass:n,blockSelector:r,needsMask:A,inlineStylesheet:c,maskInputOptions:d,maskTextFn:h,maskInputFn:u,maskAllElementAttributes:p,maskAttributeFn:_,dataURLOptions:v,inlineImages:f,recordCanvas:m,canvasMaskingConfigured:y,keepIframeSrcFn:I,newlyAddedElement:P});if(!q)return console.warn(e,"not serialized"),null;let K;K=s.hasNode(e)?s.getId(e):(function(N,V){return!!(V.comment&&N.type===lt.Comment||N.type===lt.Element&&(V.script&&(N.tagName==="script"||N.tagName==="link"&&(N.attributes.rel==="preload"&&N.attributes.as==="script"||N.attributes.rel==="modulepreload")||N.tagName==="link"&&N.attributes.rel==="prefetch"&&typeof N.attributes.href=="string"&&(function(Q){var z;let ae;try{ae=new URL(Q,window.location.href)}catch{return null}let be=ae.pathname.match(/\.([0-9a-z]+)(?:$)/i);return(z=be?.[1])!==null&&z!==void 0?z:null})(N.attributes.href)==="js")||V.headFavicon&&(N.tagName==="link"&&N.attributes.rel==="shortcut icon"||N.tagName==="meta"&&(Ot(N.attributes.name).match(/^msapplication-tile(image|color)$/)||Ot(N.attributes.name)==="application-name"||["icon","apple-touch-icon","shortcut icon"].includes(Ot(N.attributes.rel))))||N.tagName==="meta"&&(V.headMetaDescKeywords&&Ot(N.attributes.name).match(/^description|keywords$/)||V.headMetaSocial&&(Ot(N.attributes.property).match(/^(og|twitter|fb):/)||Ot(N.attributes.name).match(/^(og|twitter):/)||Ot(N.attributes.name)==="pinterest")||V.headMetaRobots&&["robots","googlebot","bingbot"].includes(Ot(N.attributes.name))||V.headMetaHttpEquiv&&N.attributes["http-equiv"]!==void 0||V.headMetaAuthorship&&(["author","generator","framework","publisher","progid"].includes(Ot(N.attributes.name))||Ot(N.attributes.property).match(/^article:/)||Ot(N.attributes.property).match(/^product:/))||V.headMetaVerification&&["google-site-verification","yandex-verification","csrf-token","p:domain_verify","verify-v1","verification","shopify-checkout-api-token"].includes(Ot(N.attributes.name)))))})(q,g)||!B&&q.type===lt.Text&&!q.isStyle&&!q.textContent.replace(/^\s+|\s+$/gm,"").length?-2:Gv();let U=Object.assign(q,{id:K});if(s.add(e,U),K===-2)return null;w&&w(e);let ce=!l;if(U.type===lt.Element){ce=ce&&!U.needBlock,delete U.needBlock;let N=se.shadowRoot(e);N&&lr(N)&&(U.isShadowHost=!0)}if((U.type===lt.Document||U.type===lt.Element)&&ce){g.headWhitespace&&U.type===lt.Element&&U.tagName==="head"&&(B=!1);let N={doc:i,mirror:s,blockClass:n,blockSelector:r,needsMask:A,maskTextClass:o,maskTextSelector:a,skipChild:l,inlineStylesheet:c,maskInputOptions:d,maskTextFn:h,maskInputFn:u,maskAllElementAttributes:p,maskAttributeFn:_,slimDOMOptions:g,dataURLOptions:v,inlineImages:f,recordCanvas:m,canvasMaskingConfigured:y,preserveWhiteSpace:B,onSerialize:w,onIframeLoad:S,iframeLoadTimeout:x,onIframeListenerRegistered:k,onStylesheetLoad:C,stylesheetLoadTimeout:E,keepIframeSrcFn:I,depth:O+1,maxDepth:L};if(!(U.type===lt.Element&&U.tagName==="textarea"&&U.attributes.value!==void 0))for(let Q of Array.from(se.childNodes(e))){let z=Hs(Q,N);z&&U.childNodes.push(z)}let V=null;if(hd(e)&&(V=se.shadowRoot(e)))for(let Q of Array.from(se.childNodes(V))){let z=Hs(Q,N);z&&(lr(V)&&(z.isShadow=!0),U.childNodes.push(z))}}let j=se.parentNode(e);if(j&&ar(j)&&lr(j)&&(U.isShadow=!0),U.type===lt.Element&&U.tagName==="iframe"){let N=(function(V,Q,z){let ae=()=>{},be=V.contentWindow;if(!be)return ae;let Ee;try{Ee=be.document.readyState}catch{return ae}let pe=()=>Q();if(Ee!=="complete"){let st=!1,Le=null,ze=()=>{st||(st=!0,Le!==null&&(clearTimeout(Le),Le=null),ws(V,"load",It),V.addEventListener("load",pe),Q())},It=()=>ze();return Le=setTimeout(ze,z),V.addEventListener("load",It),()=>{Le!==null&&(clearTimeout(Le),Le=null),st?ws(V,"load",pe):(st=!0,ws(V,"load",It))}}let ve="about:blank",dt;try{dt=be.location.href}catch{return ae}if(dt!==ve||V.src===ve||V.src===""){let st=setTimeout(Q,0);return V.addEventListener("load",pe),()=>{clearTimeout(st),ws(V,"load",pe)}}return V.addEventListener("load",pe),()=>{ws(V,"load",pe)}})(e,()=>{let V=e.contentDocument;if(V&&S){let Q=Hs(V,{doc:V,mirror:s,blockClass:n,blockSelector:r,needsMask:A,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:d,maskTextFn:
2h,maskInputFn:u,maskAllElementAttributes:p,maskAttributeFn:_,slimDOMOptions:g,dataURLOptions:v,inlineImages:f,recordCanvas:m,canvasMaskingConfigured:y,preserveWhiteSpace:B,onSerialize:w,onIframeLoad:S,iframeLoadTimeout:x,onIframeListenerRegistered:k,onStylesheetLoad:C,stylesheetLoadTimeout:E,keepIframeSrcFn:I,depth:O+1,maxDepth:L});Q&&S(e,Q)}},x);k?.(e,N)}return U.type===lt.Element&&U.tagName==="link"&&dp(U.attributes.rel)&&(function(N,V,Q){if(ur.has(N))return;let z;try{z=N.sheet}catch{return}if(z)return;let ae=new AbortController,be=!1,Ee=()=>{if(!be){be=!0;try{(()=>{if(C){let ve=Hs(e,{doc:i,mirror:s,blockClass:n,blockSelector:r,needsMask:A,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:d,maskTextFn:h,maskInputFn:u,maskAllElementAttributes:p,maskAttributeFn:_,slimDOMOptions:g,dataURLOptions:v,inlineImages:f,recordCanvas:m,canvasMaskingConfigured:y,preserveWhiteSpace:B,onSerialize:w,onIframeLoad:S,iframeLoadTimeout:x,onStylesheetLoad:C,stylesheetLoadTimeout:E,keepIframeSrcFn:I,depth:O,maxDepth:L});ve&&C(e,ve)}})()}finally{ur.delete(N),ae.abort()}}},pe=setTimeout(Ee,Q);ae.signal.addEventListener("abort",()=>clearTimeout(pe),{once:!0}),N.addEventListener("load",Ee,{signal:ae.signal,once:!0}),ur.set(N,ae)})(e,0,E),U}function pp(e){return e===!0||e==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:e==="all",headMetaDescKeywords:e==="all",headTitleMutations:e==="all"}:e===!1?{}:e}var mS=class Yv{constructor(...t){$(this,"parentElement",null),$(this,"parentNode",null),$(this,"ownerDocument",void 0),$(this,"firstChild",null),$(this,"lastChild",null),$(this,"previousSibling",null),$(this,"nextSibling",null),$(this,"ELEMENT_NODE",1),$(this,"TEXT_NODE",3),$(this,"nodeType",void 0),$(this,"nodeName",void 0),$(this,"RRNodeType",void 0)}get childNodes(){let t=[],i=this.firstChild;for(;i;)t.push(i),i=i.nextSibling;return t}contains(t){if(!(t instanceof Yv)||t.ownerDocument!==this.ownerDocument)return!1;if(t===this)return!0;for(;t.parentNode;){if(t.parentNode===this)return!0;t=t.parentNode}return!1}appendChild(t){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(t,i){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 Ze(e,t,i=document){let s={capture:!0,passive:!0};return i.addEventListener(e,t,s),()=>Fs(i,e,t,s)}function Fs(e,t,i,s){vi(()=>{let n=e.removeEventListener;typeof n=="function"&&(s!==void 0?n.call(e,t,i,s):n.call(e,t,i))})}function vi(e){try{e()}catch(t){if(!(t instanceof DOMException&&t.name==="SecurityError"))throw t}}function xa(e){e.forEach(t=>{if(typeof t=="function")try{t()}catch{}})}var As=`Please stop import mirror directly. Instead of that,\r 3now you can use replayer.getMirror() to access the mirror instance of a replayer,\r 4or you can use record.mirror to access the mirror instance during recording.`,_p={map:{},getId(){return console.warn(As),-1},getNode(){return console.warn(As),null},removeNodeFromMap(){console.warn(As)},has(){return console.warn(As),!1},reset(){console.warn(As)}};function Un(e,t,i={}){let s=null,n=0;return function(...r){let o=Date.now();n||i.leading!==!1||(n=o);let a=t-(o-n),l=this;0>=a||a>t?(s&&(clearTimeout(s),s=null),n=o,e.apply(l,r)):s||i.trailing===!1||(s=setTimeout(()=>{n=i.leading===!1?0:Date.now(),s=null,e.apply(l,r)},a))}}function Ha(e,t,i,s,n=window){let r=n.Object.getOwnPropertyDescriptor(e,t),o=()=>Ha(e,t,r||{},!0);if(s)return n.Object.defineProperty(e,t,i),o;let a=(function(l){let c=typeof l.setTimeout=="function"?l.setTimeout:void 0;try{var d,h;let p=(d=l.Zone)===null||d===void 0||(h=d.__symbol__)===null||h===void 0?void 0:h.call(d,"setTimeout"),_=p?l[p]:void 0;typeof _=="function"&&(c=_)}catch{}if(!c)return()=>{};let u=c;return p=>{try{u.call(l,p,0)}catch{}}})(n);return n.Object.defineProperty(e,t,{set(l){if(a(()=>{try{i.set.call(this,l)}catch{}}),r&&r.set){if(r.get)try{r.get.call(this)}catch{return}r.set.call(this,l)}}}),o}typeof window<"u"&&window.Proxy&&window.Reflect&&(_p=new Proxy(_p,{get(e,t,i){return t==="map"&&c
4onsole.warn(As),Reflect.get(e,t,i)}}));var Ta=Date.now;function Zv(e){var t,i,s,n;let r=e.document;return{left:r.scrollingElement?r.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:r.documentElement.scrollLeft||r?.body&&((t=se.parentElement(r.body))===null||t===void 0?void 0:t.scrollLeft)||(r==null||(i=r.body)===null||i===void 0?void 0:i.scrollLeft)||0,top:r.scrollingElement?r.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:r?.documentElement.scrollTop||r?.body&&((s=se.parentElement(r.body))===null||s===void 0?void 0:s.scrollTop)||(r==null||(n=r.body)===null||n===void 0?void 0:n.scrollTop)||0}}function Xv(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function em(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function tm(e){return e?e.nodeType===e.ELEMENT_NODE?e:se.parentElement(e):null}function it(e,t,i,s){if(!e)return!1;let n=tm(e);if(!n)return!1;try{if(typeof t=="string"){if(n.classList.contains(t)||s&&n.closest("."+t)!==null)return!0}else if(Ea(n,t,s))return!0}catch{}return!!(i&&(n.matches(i)||s&&n.closest(i)!==null))}function Il(e,t,i){return!(e.tagName!=="TITLE"||!i.headTitleMutations)||t.getId(e)===-2}function im(e,t){if(ar(e))return!1;let i=t.getId(e);if(!t.has(i))return!0;let s=se.parentNode(e);return(!s||s.nodeType!==e.DOCUMENT_NODE)&&(!s||im(s,t))}function Ml(e){return!!e.changedTouches}function sm(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}function nm(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function Kc(e){return!!e&&(e instanceof mS&&"shadowRoot"in e?!!e.shadowRoot:!!se.shadowRoot(e))}/[1-9][0-9]{12}/.test(Date.now().toString())||(Ta=()=>new Date().getTime());var yS=class{constructor(){$(this,"id",1),$(this,"styleIDMap",new WeakMap),$(this,"idStyleMap",new Map)}getId(e){var t;return(t=this.styleIDMap.get(e))!==null&&t!==void 0?t:-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let i;return i=t===void 0?this.id++:t,this.styleIDMap.set(e,i),this.idStyleMap.set(i,e),i}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function rm(e){var t;let i=null;return"getRootNode"in e&&((t=se.getRootNode(e))===null||t===void 0?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&se.host(se.getRootNode(e))&&(i=se.host(se.getRootNode(e))),i}function om(e){let t=e.ownerDocument;if(!t)return!1;if(se.contains(t,e))return!0;let i=se.isConnected(e);return typeof i=="boolean"?i:(function(s){let n=s.ownerDocument;if(!n)return!1;let r=(function(o){let a,l=o;for(;a=rm(l);)l=a;return l})(s);return se.contains(n,r)})(e)}function gp(e){return"__ln"in e}var dr,bS=class{constructor(){$(this,"length",0),$(this,"head",null),$(this,"tail",null)}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let i=0;e>i;i++)t=t?.next||null;return t}addNode(e){let t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&gp(e.previousSibling)){let i=e.previousSibling.__ln.next;t.next=i,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,i&&(i.previous=t)}else if(e.nextSibling&&gp(e.nextSibling)&&e.nextSibling.__ln.previous){let i=e.nextSibling.__ln.previous;t.previous=i,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,i&&(i.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;t.next===null&&(this.tail=t),this.length++}removeNode(e){let t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}},fp=(e,t)=>`${e}@${t}`,SS=class{constructor(){$(this,"frozen",!1),$(this,"locked",!1),$(this,"texts",[]),$(this,"attributes",[]),$(this,"attributeMap",new WeakMap),$(this,"generatedAttributes",new WeakMap),$(this,"removes",[]),$(this,"mapRemoves",new Set),$(this,"movedMap",{}),$(this,"addedSet",new Set),$(this,"movedSet",new Set),$(this,"droppedSet",new Set),$(this,"removesSubTreeCache",new Set),$(this,"mutationCb",void 0),$(this,"blockClass",void 0),$(this,"blockSelector",void 0),$(this,"maskTextClass",void 0),$(this,"maskTextSelector",void 0),$(this,"inlineStylesheet",void 0),$(this,"maskInputOptions",void 0),$(this,"maskTextFn",void 0),$(this,"maskInputFn",void 0),$(this,"maskAllElementAttributes",void 0),$(this,"maskAttributeFn",void 0),$(this,"keepIframeSrcFn",void 0),$(this,"recordCanvas",void 0),$(this,"canvasMaskingConfigured",void 0),$(this,"inlineImages",void 0),$(this,"slimDOMOptions",void 0),$(this,"dataURLOptions",void 0),$(this,"doc",void 0),$(this,"mirror",void 0),$(this,"iframeManager",void 0),$(this,"stylesheetManager",void 0),$(this,"shadowDomManager",void 0),$(this,"canvasManager",void 0),$(this,"processedNodeManager",void 0),$(this,"unattachedDoc",void 0),$(this,"canvasManagerReleased",!1),$(this,"processMutations",e=>
4{e.forEach(this.processMutation),this.emit()}),$(this,"emit",()=>{if(this.frozen||this.locked)return;let e=Dt(),t=Hv();try{this.processBufferedMutations()}finally{i=Dt()-e,s=t,ri>0||ld(i,s??_s)||i>ya.slowestBatchMs&&(ya.slowestBatchMs=i)}var i,s}),$(this,"processBufferedMutations",()=>{let e=[],t=new Set,i=new bS,s=l=>{let c=l,d=-2;for(;d===-2;)c=c&&c.nextSibling,d=c&&this.mirror.getId(c);return d},n,r=l=>{var c;let d=se.parentNode(l);if(!d||!om(l)||d.tagName==="TEXTAREA"||this.isBlockedAtEmission(d))return;let h=ar(d)?this.mirror.getId(rm(l)):this.mirror.getId(d),u=s(l);if(h===-1||u===-1)return i.addNode(l);(c=n)!==null&&c!==void 0||(n={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:_=>{sm(_,this.mirror)&&this.iframeManager.addIframe(_),nm(_,this.mirror)&&this.stylesheetManager.trackLinkElement(_),Kc(_)&&!it(_,this.blockClass,this.blockSelector,!0)&&this.shadowDomManager.addShadowRoot(se.shadowRoot(_),this.doc)},onIframeLoad:(_,g)=>{this.iframeManager.attachIframe(_,g),this.shadowDomManager.observeAttachShadow(_)},onIframeListenerRegistered:(_,g)=>{this.iframeManager.registerLoadListenerDisposer(_,g)},onStylesheetLoad:(_,g)=>{this.stylesheetManager.attachLinkElement(_,g)}});let p=Hs(l,n);p&&(e.push({parentId:h,nextId:u,node:p}),t.add(p.id))};for(let l of this.mapRemoves)this.mapRemoves.delete(l),this.mirror.removeNodeFromMap(l);for(let l of this.movedSet)mp(this.removesSubTreeCache,l)&&!this.movedSet.has(se.parentNode(l))||r(l);for(let l of this.addedSet)yp(this.droppedSet,l)||mp(this.removesSubTreeCache,l)?yp(this.movedSet,l)?r(l):this.droppedSet.add(l):r(l);let o=null;for(;i.length;){let l=null;if(o){let c=this.mirror.getId(se.parentNode(o.value)),d=s(o.value);c!==-1&&d!==-1&&(l=o)}if(!l){let c=i.tail;for(;c;){let d=c;if(c=c.previous,d){let h=this.mirror.getId(se.parentNode(d.value));if(s(d.value)===-1)continue;if(h!==-1){l=d;break}{let u=se.parentNode(d.value);if(u&&u.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let p=se.host(u);if(this.mirror.getId(p)!==-1){l=d;break}}}}}}if(!l){for(;i.head;)i.removeNode(i.head.value);break}o=l.previous,i.removeNode(l.value),r(l.value)}let a={texts:this.texts.filter(l=>!this.isBlockedAtEmission(l.node)).map(l=>{let c=l.node,d=se.parentNode(c);return d&&d.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(d),{id:this.mirror.getId(c),value:l.value}}).filter(l=>!t.has(l.id)).filter(l=>this.mirror.has(l.id)),attributes:this.attributes.filter(l=>!this.isBlockedAtEmission(l.node)).map(l=>{let{attributes:c}=l;if(!this.maskAllElementAttributes&&!this.maskAttributeFn&&typeof c.style=="string"){let h=JSON.stringify(l.styleDiff),u=JSON.stringify(l._unchangedStyles);c.style.length>h.length&&(h+u).split("var(").length===c.style.split("var(").length&&(c.style=l.styleDiff)}if(this.maskAllElementAttributes||this.maskAttributeFn){for(let[h,u]of Object.entries(c))if(typeof u=="string"||u===null){var d;c[h]=ka({element:l.node,name:h,value:u,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn,isGenerated:(d=this.generatedAttributes.get(l.node))===null||d===void 0?void 0:d.has(h)})}}return{id:this.mirror.getId(l.node),attributes:c}}).filter(l=>!t.has(l.id)).filter(l=>this.mirror.has(l.id)),removes:this.removes,adds:e};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={},(a.texts.length||a.attributes.length||a.removes.length||a.adds.length)&&this.mutationCb(a)}),$(this,"bufferBelongsToIframe",e=>this.doc===e.contentDocument),$(this,"genTextAreaValueMutation",e=>{let t=this.attributeMap.get(e);t||(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(t),this.attributeMap.set(e,t));let i=Array.from(se.childNodes(e),s=>se.textContent(s)||"").join("");t.attributes.value=wa({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:Ca(e),value:i,maskInputFn:this.maskInputFn})}),$(this,"processMutation",e=>{if(!Il(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":{let s=se.textContent(e.target);it(e.target,this.blockClass,this.blockSelector,!1)||s===e.oldValue||this.texts.push({value:Jv(e.target,this.maskTextClass,this.maskTextSelector,!0)&&s?this.maskTextFn?this.maskTextFn(s,tm(e.target)):s.replace(/[\S]/g,"*"):s,node:e.target});break}case"attributes":{var t;let s=e.target,n=oi(s.tagName),r=e.attributeName,o=(t=e.attributeNamespace)!==null&&t!==void 0?t:null,a=(function(h,u,p){if(!p)return u;let _=h.getAttributeNodeNS(p,u);if(_)return _.name;if(p==="http://www.w3.org/1999/xlink")return`xlink:${u}`;if(p==="http://www.w3.org/XML/1998/namespace")return`xml:${u}`;if(p==="http://www.w3.org/2000/xmlns/")return u==="xmlns"?u:`xmlns:${u}`;let g=h.lookupPrefix(p);return g?`${g}:${u}`:u})(s,r,o),l=o?s.getAttributeNS(o,r):e.target.getAttribute(r);if(a==="value"){let h=s,u=Ca(h);l=wa({element:h,maskInputOptions:this.maskInputOptions,tagName:s.tagName,type:u,value:l,maskInputFn:this.maskInputFn})}if(it(e.target,this.blockClass,this.blockSelector,!1)||l===e.oldValue)return;let c=this.attributeMap.get(e.target),d=n==="iframe"&&a==="src";if(d&&!this.keepIframeSrcFn(l)&&s.contentDocument)return;if(a==="type"&&n==="input"&&(e.oldValue||"").toLowerCase()==="password"&&s.setAttribute("data-rr-is-password","true"),!Kv(n,a)){var i;c||(c={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(c),this.attributeMap.set(e.target,c));let h=Qv(this.doc,n,oi(a),l,s,this.dataURLOptions);if(d&&!this.keepIframeSrcFn(l)&&(a="rr_src"),c.attributes[a]=h,(i=this.generatedAttributes.get(e.target))===null||i===void 0||i.delete(a),a==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}let u=this.unattachedDoc.createElement("span"),p=s.style;e.oldValue&&(u.style.cssText=e.oldValue);for(let _ of Array.from(p)){let g=p.getPropertyValue(_),v=p.getPropertyPriority(_);g!==u.style.getPropertyValue(_)||v!==u.style.getPropertyPriority(_)?c.styleDiff[_]=v===""?g:[g,v]:c._unchangedStyles[_]=[g,v]}for(let _ of Array.from(u.style))p.getPropertyValue(_)===""&&(c.styleDiff[_]=!1)}else if(a==="open"&&n==="dialog"){c.attributes.rr_open_mode=s.matches("dialog:modal")?"modal":"non-modal";let u=this.generatedAttributes.get(e.target);u||(u=new Set,this.generatedAttributes.set(e.target,u)),u.add("rr_open_mode")}}break}case"childList":if(it(e.target,this.blockClass,this.blockSelector,!0))return;if(e.target.tagName==="TEXTAREA")return void this.genTextAreaValueMutation(e.target);
4e.addedNodes.forEach(s=>this.genAdds(s,e.target)),e.removedNodes.forEach(s=>{let n=this.mirror.getId(s),r=ar(e.target)?this.mirror.getId(se.host(e.target)):this.mirror.getId(e.target);it(e.target,this.blockClass,this.blockSelector,!1)||Il(s,this.mirror,this.slimDOMOptions)||!(function(o,a){return a.getId(o)!==-1})(s,this.mirror)||(this.addedSet.has(s)?(vp(this.addedSet,s),this.droppedSet.add(s)):this.addedSet.has(e.target)&&n===-1||im(e.target,this.mirror)||(this.movedSet.has(s)&&this.movedMap[fp(n,r)]?vp(this.movedSet,s):(this.removes.push({parentId:r,id:n,isShadow:!(!ar(e.target)||!lr(e.target))||void 0}),(function(o,a){let l=[o];for(;l.length;){let c=l.pop();a.has(c)||(a.add(c),se.childNodes(c).forEach(d=>l.push(d)))}})(s,this.removesSubTreeCache))),this.mapRemoves.add(s))})}}),$(this,"genAdds",(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)){if(this.addedSet.has(e))return this.addedSet.delete(e),void this.addedSet.add(e);if(!this.movedSet.has(e)){if(this.mirror.hasNode(e)){if(Il(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);let i=null;t&&this.mirror.hasNode(t)&&(i=this.mirror.getId(t)),i&&i!==-1&&(this.movedMap[fp(this.mirror.getId(e),i)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);if(!it(e,this.blockClass,this.blockSelector,!1)){if(e.nodeType===e.TEXT_NODE)return;let i=se.childNodes(e);for(let s=0,n=i.length;n>s;s++){let r=i[s];r&&this.genAdds(r)}if(Kc(e)){let s=se.childNodes(se.shadowRoot(e));for(let n=0,r=s.length;r>n;n++){let o=s[n];o&&(this.processedNodeManager.add(o,this),this.genAdds(o,e))}}}}}})}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","maskAllElementAttributes","maskAttributeFn","keepIframeSrcFn","recordCanvas","canvasMaskingConfigured","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(t=>{this[t]=e[t]}),this.canvasManager.acquire()}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.releaseCanvasManager()}releaseCanvasManager(){this.canvasManagerReleased||(this.canvasManagerReleased=!0,this.canvasManager.reset())}bufferDoc(){return this.doc}destroy(){for(let e of this.mapRemoves)this.mapRemoves.delete(e),this.mirror.removeNodeFromMap(e)}isBlockedAtEmission(e){let t=this.blockClass,i=t&&typeof t!="string"&&(t.global||t.sticky)?new RegExp(t):null;for(;e;){if(i&&(i.lastIndex=0),it(e,i||t,this.blockSelector,!0))return!0;let s="getRootNode"in e?se.getRootNode(e):null;e=s?.nodeType===Node.DOCUMENT_FRAGMENT_NODE?se.host(s):null}return!1}};function vp(e,t){let i=[t];for(;i.length;){let s=i.pop();if(e.delete(s),s.nodeType===s.TEXT_NODE)continue;let n=se.childNodes(s);for(let r=0,o=n.length;o>r;r++){let a=n[r];a&&i.push(a)}}}function mp(e,t,i){return e.size!==0&&(function(s,n){let r=se.parentNode(n);return!!r&&s.has(r)})(e,t)}function yp(e,t){if(e.size===0)return!1;let i=se.parentNode(t);for(;i;){if(e.has(i))return!0;i=se.parentNode(i)}return!1}function wS(e){dr=e}function kS(){dr=void 0}var ke=(e,t="rrweb")=>dr?(...i)=>{try{return e(...i)}catch(s){if(dr&&dr(s,t)===!0)return;throw s}}:e,At=[];function Wn(e){try{if("composedPath"in e){let t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch{}return e&&e.target}function am(e,t){let i=new SS,s;i.init(e);try{s=new(qv())(ke(i.processMutations.bind(i)));let n={attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0};return e.attributeFilter&&e.attributeFilter.length>0&&(n.attributeFilter=e.attributeFilter),s.observe(t,n),At.push(i),{observer:s,buffer:i}}catch(n){try{s?.disconnect(),i.destroy(),i.reset()}catch{}throw n}}function lm({scrollCb:e,doc:t,mirror:i,blockClass:s,blockSelector:n,sampling:r}){let o=new Map,a=c=>{let d=Wn(c);if(!d||it(d,s,n,!0))return;let h=i.getId(d),u,p;if(d===t&&t.defaultView){let g=Zv(t.defaultView);u=g.left,p=g.top}else u=d.scrollLeft,p=d.scrollTop;let _=`${u},${p}`;o.get(h)!==_&&(o.set(h,_),e({id:h,x:u,y:p}))},l=[Ze("scroll",ke(Un(ke(c=>a(c)),r.scroll||100)),t)];return"onscrollend"in t&&l.push(Ze("scrollend",ke(a),t)),()=>l.forEach(c=>c())}function cm(e,t){for(let i=At.length-1;i>=0;i--){let s=At[i];if(!s)continue;let n=s.bufferBelongsToIframe(e);!n&&t&&t.has(s.bufferDoc())&&(n=!0),n&&(s.reset(),At.splice(i,1))}}var CS=["INPUT","TEXTAREA","SELECT"],bp=new WeakMap;
4function ro(e){return(function t(i,s){if(oo("CSSGroupingRule")&&i.parentRule instanceof CSSGroupingRule||oo("CSSMediaRule")&&i.parentRule instanceof CSSMediaRule||oo("CSSSupportsRule")&&i.parentRule instanceof CSSSupportsRule||oo("CSSConditionRule")&&i.parentRule instanceof CSSConditionRule){let n=Array.from(i.parentRule.cssRules).indexOf(i);return s.unshift(n),t(i.parentRule,s)}if(i.parentStyleSheet){let n=Array.from(i.parentStyleSheet.cssRules).indexOf(i);s.unshift(n)}return s})(e,[])}function Ei(e,t,i){let s,n;return e?(e.ownerNode?s=t.getId(e.ownerNode):n=i.getId(e),{styleId:n,id:s}):{}}function um({mirror:e,stylesheetManager:t},i){var s,n;let r=null;r=e.getId(i.nodeName==="#document"?i:se.host(i));let o=i.nodeName==="#document"?(s=i.defaultView)===null||s===void 0?void 0:s.Document:(n=i.ownerDocument)===null||n===void 0||(n=n.defaultView)===null||n===void 0?void 0:n.ShadowRoot,a=o?.prototype?Object.getOwnPropertyDescriptor(o?.prototype,"adoptedStyleSheets"):void 0;return r!==null&&r!==-1&&o&&a?(Object.defineProperty(i,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get(){var l;return(l=a.get)===null||l===void 0?void 0:l.call(this)},set(l){let c;try{var d;c=(d=a.set)===null||d===void 0?void 0:d.call(this,l)}catch(h){if(h&&typeof h=="object"&&h.name==="NotAllowedError")return;throw h}if(r!==null&&r!==-1)try{t.adoptStyleSheets(l,r)}catch{}return c}}),ke(()=>{Object.defineProperty(i,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set})})):()=>{}}var Jc=new Set;function ES(e,t={}){let i=e.doc.defaultView;if(!i)return()=>{};let s,n;(function(l,c){let{mutationCb:d,mousemoveCb:h,mouseInteractionCb:u,scrollCb:p,viewportResizeCb:_,inputCb:g,mediaInteractionCb:v,styleSheetRuleCb:f,styleDeclarationCb:m,canvasMutationCb:y,fontCb:w,selectionCb:S,customElementCb:x}=l;l.mutationCb=(...k)=>{c.mutation&&c.mutation(...k),d(...k)},l.mousemoveCb=(...k)=>{c.mousemove&&c.mousemove(...k),h(...k)},l.mouseInteractionCb=(...k)=>{c.mouseInteraction&&c.mouseInteraction(...k),u(...k)},l.scrollCb=(...k)=>{c.scroll&&c.scroll(...k),p(...k)},l.viewportResizeCb=(...k)=>{c.viewportResize&&c.viewportResize(...k),_(...k)},l.inputCb=(...k)=>{c.input&&c.input(...k),g(...k)},l.mediaInteractionCb=(...k)=>{c.mediaInteaction&&c.mediaInteaction(...k),v(...k)},l.styleSheetRuleCb=(...k)=>{c.styleSheetRule&&c.styleSheetRule(...k),f(...k)},l.styleDeclarationCb=(...k)=>{c.styleDeclaration&&c.styleDeclaration(...k),m(...k)},l.canvasMutationCb=(...k)=>{c.canvasMutation&&c.canvasMutation(...k),y(...k)},l.fontCb=(...k)=>{c.font&&c.font(...k),w(...k)},l.selectionCb=(...k)=>{c.selection&&c.selection(...k),S(...k)},l.customElementCb=(...k)=>{c.customElement&&c.customElement(...k),x(...k)}})(e,t);let r=[],o=ke(()=>{try{if(n)try{n.destroy(),n.reset()}finally{let l=At.indexOf(n);l!==-1&&At.splice(l,1)}e.shadowDomManager.resetForDoc(e.doc),s?.disconnect()}finally{xa(r)}}),a=(l,c)=>{let d=ke(()=>{try{return c()}catch(h){throw Jc.add(l),h}})();typeof d=="function"&&r.push(d)};try{if(e.recordDOM&&a("mutation",()=>{let l=am(e,e.doc);s=l.observer,n=l.buffer}),a("move",()=>(function({mousemoveCb:l,sampling:c,doc:d,mirror:h}){if(c.mousemove===!1)return()=>{};let u=typeof c.mousemove=="number"?c.mousemove:50,p=typeof c.mousemoveCallback=="number"?c.mousemoveCallback:500,_,g=[],v=Un(ke(y=>{let w=Date.now()-_;l(g.map(S=>(S.timeOffset-=w,S)),y),g=[],_=null}),p),f=ke(Un(ke(y=>{let w=Wn(y),{clientX:S,clientY:x}=Ml(y)?y.changedTouches[0]:y;
4_||(_=Ta()),g.push({x:S,y:x,id:h.getId(w),timeOffset:Ta()-_}),v(typeof DragEvent<"u"&&y instanceof DragEvent?me.Drag:y instanceof MouseEvent?me.MouseMove:me.TouchMove)}),u,{trailing:!1})),m=[Ze("mousemove",f,d),Ze("touchmove",f,d),Ze("drag",f,d)];return ke(()=>{m.forEach(y=>y())})})(e)),a("mouseInteraction",()=>(function({mouseInteractionCb:l,doc:c,mirror:d,blockClass:h,blockSelector:u,sampling:p}){if(p.mouseInteraction===!1)return()=>{};let _=p.mouseInteraction===!0||p.mouseInteraction===void 0?{}:p.mouseInteraction,g=[],v=null;return Object.keys(Mt).filter(f=>Number.isNaN(Number(f))&&!f.endsWith("_Departed")&&_[f]!==!1).forEach(f=>{let m=oi(f),y=(w=>S=>{let x=Wn(S);if(it(x,h,u,!0))return;let k=null,C=w;if("pointerType"in S){switch(S.pointerType){case"mouse":k=Gi.Mouse;break;case"touch":k=Gi.Touch;break;case"pen":k=Gi.Pen}k===Gi.Touch&&(Mt[w]===Mt.MouseDown?C="TouchStart":Mt[w]===Mt.MouseUp&&(C="TouchEnd"))}else Ml(S)&&(k=Gi.Touch);k!==null?(v=k,(C.startsWith("Touch")&&k===Gi.Touch||C.startsWith("Mouse")&&k===Gi.Mouse)&&(k=null)):Mt[w]===Mt.Click&&(k=v,v=null);let E=Ml(S)?S.changedTouches[0]:S;if(!E)return;let I=d.getId(x),{clientX:P,clientY:O}=E;ke(l)(b({type:Mt[C],id:I,x:P,y:O},k!==null&&{pointerType:k}))})(f);if(window.PointerEvent)switch(Mt[f]){case Mt.MouseDown:case Mt.MouseUp:m=m.replace("mouse","pointer");break;case Mt.TouchStart:case Mt.TouchEnd:return}g.push(Ze(m,y,c))}),ke(()=>{g.forEach(f=>f())})})(e)),a("scroll",()=>lm(e)),a("viewportResize",()=>(function({viewportResizeCb:l},{win:c}){let d=-1,h=-1;return Ze("resize",ke(Un(ke(()=>{let u=Xv(),p=em();d===u&&h===p||(l({width:Number(p),height:Number(u)}),d=u,h=p)}),200)),c)})(e,{win:i})),a("input",()=>(function({inputCb:l,doc:c,mirror:d,blockClass:h,blockSelector:u,ignoreClass:p,ignoreSelector:_,maskInputOptions:g,maskInputFn:v,sampling:f,userTriggeredOnInput:m}){function y(C){let E=Wn(C),I=C.isTrusted,P=c.defaultView;if(E&&P&&!(E instanceof P.HTMLElement))return;let O=E&&E.tagName;if(E&&O==="OPTION"&&(E=se.parentElement(E)),!E||!O||0>CS.indexOf(O)||it(E,h,u,!0)||E.classList.contains(p)||_&&E.matches(_))return;let L=E.value,A=!1,B=Ca(E)||"";B==="radio"||B==="checkbox"?A=E.checked:(g[O.toLowerCase()]||g[B])&&(L=wa({element:E,maskInputOptions:g,tagName:O,type:B,value:L,maskInputFn:v})),w(E,m?{text:L,isChecked:A,userTriggered:I}:{text:L,isChecked:A});let q=E.name;B==="radio"&&q&&A&&c.querySelectorAll(`input[type="radio"][name="${q}"]`).forEach(K=>{if(K!==E){let U=K.value;w(K,m?{text:U,isChecked:!A,userTriggered:!1}:{text:U,isChecked:!A})}})}function w(C,E){let I=bp.get(C);if(!I||I.text!==E.text||I.isChecked!==E.isChecked){bp.set(C,E);let P=d.getId(C);ke(l)(b(b({},E),{},{id:P}))}}let S=(f.input==="last"?["change"]:["input","change"]).map(C=>Ze(C,ke(y),c)),x=c.defaultView;if(!x)return()=>{S.forEach(C=>C())};let k=x.Object.getOwnPropertyDescriptor(x.HTMLInputElement.prototype,"value");return k&&k.set&&S.push(...[[x.HTMLInputElement.prototype,"value"],[x.HTMLInputElement.prototype,"checked"],[x.HTMLSelectElement.prototype,"value"],[x.HTMLTextAreaElement.prototype,"value"],[x.HTMLSelectElement.prototype,"selectedIndex"],[x.HTMLOptionElement.prototype,"selected"]].map(C=>Ha(C[0],C[1],{set(){ke(y)({target:this,isTrusted:!1})}},!1,x))),ke(()=>{xa(S)})})(e)),a("mediaInteraction",()=>(function({mediaInteractionCb:l,blockClass:c,blockSelector:d,mirror:h,sampling:u,doc:p}){let _=ke(v=>Un(ke(f=>{let m=Wn(f);if(!m||it(m,c,d,!0))return;let{currentTime:y,volume:w,muted:S,playbackRate:x,loop:k}=m;l({type:v,id:h.getId(m),currentTime:y,volume:w,muted:S,playbackRate:x,loop:k})}),u.media||500)),g=[Ze("play",_(Pn.Play),p),Ze("pause",_(Pn.Pause),p),Ze("seeked",_(Pn.Seeked),p),Ze("volumechange",_(Pn.VolumeChange),p),Ze("ratechange",_(Pn.RateChange),p)];return ke(()=>{g.forEach(v=>v())})})(e)),e.recordDOM){let l=(function(c){let d=new Map,h=new Set,u=!0,p=g=>{if(u)try{g()}catch{}},_=g=>{var v;let f=d.get(g);if(f){for(;!((v=f[0])===null||v===void 0)&&v.ready;){let m=f.shift();m?.emit&&p(m.emit)}f.length===0&&d.delete(g)}};return{queueMutation(g,v){if(!g)return void p(v);let f=d.get(g);f?(f.push({emit:v,ready:!0}),_(g)):p(v)},queuePendingMutation(g,v,f){if(!u)return()=>{};let m=d.get(g);m||(m=[],d.set(g,m));let y={emit:v,ready:!1};m.push(y);let w,S=!1,x=!1,k=()=>{S||x||(S=!0,w!==void 0&&h.delete(w),y.ready=!0,y.emit=void 0,_(g))};try{w=c.setTimeout(k,5e3),S||x?c.clearTimeout(w):h.add(w)}catch{k()}return C=>{!x&&u&&(x=!0,w!==void 0&&(c.clearTimeout(w),h.delete(w)),S?C&&p(f):(y.ready=!0,C||(y.emit=void 0),_(g)))}},reset(){u=!1,h.forEach(g=>c.clearTimeout(g)),h.clear(),d.clear()}}})(i);r.push(l.reset),a("styleSheet",()=>(function({styleSheetRuleCb:c,mirror:d,stylesheetManager:h}
4,{win:u,mutationQueue:p}){if(!u.CSSStyleSheet||!u.CSSStyleSheet.prototype)return()=>{};let _=u.CSSStyleSheet.prototype.insertRule;u.CSSStyleSheet.prototype.insertRule=new Proxy(_,{apply:ke((w,S,x)=>{let[k]=x,C=w.apply(S,x);h.onCssomSheetMutation(S);let{id:E,styleId:I}=Ei(S,d,h.styleMirror);return(E&&E!==-1||I&&I!==-1)&&p.queueMutation(S,()=>c({id:E,styleId:I,adds:[{rule:k,index:C}]})),C},"host")}),u.CSSStyleSheet.prototype.addRule=function(w,S,x=this.cssRules.length){return u.CSSStyleSheet.prototype.insertRule.apply(this,[`${w} { ${S} }`,x])};let g=u.CSSStyleSheet.prototype.deleteRule,v,f;u.CSSStyleSheet.prototype.deleteRule=new Proxy(g,{apply:ke((w,S,x)=>{let[k]=x,C=w.apply(S,x);h.onCssomSheetMutation(S);let{id:E,styleId:I}=Ei(S,d,h.styleMirror);return(E&&E!==-1||I&&I!==-1)&&p.queueMutation(S,()=>c({id:E,styleId:I,removes:[{index:k}]})),C},"host")}),u.CSSStyleSheet.prototype.removeRule=function(w){return u.CSSStyleSheet.prototype.deleteRule.apply(this,[w])},u.CSSStyleSheet.prototype.replace&&(v=u.CSSStyleSheet.prototype.replace,u.CSSStyleSheet.prototype.replace=new Proxy(v,{apply:ke((w,S,x)=>{let[k]=x,C=w.apply(S,x);try{let E=C?.then;if(S.ownerNode||!C||typeof E!="function")return C;h.onCssomSheetMutation(S);let{id:I,styleId:P}=Ei(S,d,h.styleMirror);if(!(I&&I!==-1||P&&P!==-1))return C;let O=p.queuePendingMutation(S,()=>c({id:I,styleId:P,replace:k}),()=>{let L=cr(S);L!==null&&c({id:I,styleId:P,replace:L})});try{E.call(C,()=>O(!0),()=>O(!1))}catch{O(!1)}}catch{}return C},"host")})),u.CSSStyleSheet.prototype.replaceSync&&(f=u.CSSStyleSheet.prototype.replaceSync,u.CSSStyleSheet.prototype.replaceSync=new Proxy(f,{apply:ke((w,S,x)=>{let[k]=x,C=w.apply(S,x);h.onCssomSheetMutation(S);let{id:E,styleId:I}=Ei(S,d,h.styleMirror);return(E&&E!==-1||I&&I!==-1)&&p.queueMutation(S,()=>c({id:E,styleId:I,replaceSync:k}
4)),C},"host")}));let m={};ao("CSSGroupingRule")?m.CSSGroupingRule=u.CSSGroupingRule:(ao("CSSMediaRule")&&(m.CSSMediaRule=u.CSSMediaRule),ao("CSSConditionRule")&&(m.CSSConditionRule=u.CSSConditionRule),ao("CSSSupportsRule")&&(m.CSSSupportsRule=u.CSSSupportsRule));let y={};return Object.entries(m).forEach(([w,S])=>{y[w]={insertRule:S.prototype.insertRule,deleteRule:S.prototype.deleteRule},S.prototype.insertRule=new Proxy(y[w].insertRule,{apply:ke((x,k,C)=>{let[E]=C,I=x.apply(k,C);h.onCssomSheetMutation(k.parentStyleSheet);let{id:P,styleId:O}=Ei(k.parentStyleSheet,d,h.styleMirror);if(k.parentStyleSheet&&(P&&P!==-1||O&&O!==-1)){let L=[...ro(k),I];p.queueMutation(k.parentStyleSheet,()=>c({id:P,styleId:O,adds:[{rule:E,index:L}]}))}return I},"host")}),S.prototype.deleteRule=new Proxy(y[w].deleteRule,{apply:ke((x,k,C)=>{let[E]=C,I=x.apply(k,C);h.onCssomSheetMutation(k.parentStyleSheet);let{id:P,styleId:O}=Ei(k.parentStyleSheet,d,h.styleMirror);if(k.parentStyleSheet&&(P&&P!==-1||O&&O!==-1)){let L=[...ro(k),E];p.queueMutation(k.parentStyleSheet,()=>c({id:P,styleId:O,removes:[{index:L}]}))}return I},"host")})}),ke(()=>{u.CSSStyleSheet.prototype.insertRule=_,u.CSSStyleSheet.prototype.deleteRule=g,v&&(u.CSSStyleSheet.prototype.replace=v),f&&(u.CSSStyleSheet.prototype.replaceSync=f),Object.entries(m).forEach(([w,S])=>{S.prototype.insertRule=y[w].insertRule,S.prototype.deleteRule=y[w].deleteRule})})})(e,{win:i,mutationQueue:l})),a("adoptedStyleSheet",()=>um(e,e.doc)),a("styleDeclaration",()=>(function({styleDeclarationCb:c,mirror:d,ignoreCSSAttributes:h,stylesheetManager:u},{win:p,mutationQueue:_}){let g=p.CSSStyleDeclaration.prototype.setProperty;p.CSSStyleDeclaration.prototype.setProperty=new Proxy(g,{apply:ke((f,m,y)=>{var w;let[S,x,k]=y,C=f.apply(m,y);if(h.has(S))return C;let E=(w=m.parentRule)===null||w===void 0?void 0:w.parentStyleSheet;u.onCssomSheetMutation(E);let{id:I,styleId:P}=Ei(E,d,u.styleMirror);if(I&&I!==-1||P&&P!==-1){let O=ro(m.parentRule);_.queueMutation(E,()=>c({id:I,styleId:P,set:{property:S,value:x,priority:k},index:O}))}return C},"host")});let v=p.CSSStyleDeclaration.prototype.removeProperty;return p.CSSStyleDeclaration.prototype.removeProperty=new Proxy(v,{apply:ke((f,m,y)=>{var w;let[S]=y,x=f.apply(m,y);if(h.has(S))return x;let k=(w=m.parentRule)===null||w===void 0?void 0:w.parentStyleSheet;u.onCssomSheetMutation(k);let{id:C,styleId:E}=Ei(k,d,u.styleMirror);if(C&&C!==-1||E&&E!==-1){let I=ro(m.parentRule);_.queueMutation(k,()=>c({id:C,styleId:E,remove:{property:S},index:I}))}return x},"host")}),ke(()=>{p.CSSStyleDeclaration.prototype.setProperty=g,p.CSSStyleDeclaration.prototype.removeProperty=v})})(e,{win:i,mutationQueue:l})),e.collectFonts&&a("font",()=>(function({fontCb:c,doc:d}){let h=d.defaultView;if(!h)return()=>{};let u=[],p=new WeakMap,_=h.FontFace;h.FontFace=function(v,f,m){let y=new _(v,f,m);return p.set(y,{family:v,buffer:typeof f!="string",descriptors:m,fontSource:typeof f=="string"?f:JSON.stringify(Array.from(new Uint8Array(f)))}),y};let g=qi(d.fonts,"add",function(v){return function(f){return setTimeout(ke(()=>{let m=p.get(f);m&&(c(m),p.delete(f))}),0),v.apply(this,[f])}});return u.push(()=>{h.FontFace=_}),u.push(g),ke(()=>{u.forEach(v=>v())})})(e))}a("selection",()=>(function(l){let{doc:c,mirror:d,blockClass:h,blockSelector:u,selectionCb:p}=l,_=!0,g=ke(()=>{let v=c.getSelection();if(!v||_&&v?.isCollapsed)return;_=v.isCollapsed||!1;let f=[],m=v.rangeCount||0;for(let y=0;m>y;y++){let{startContainer:w,startOffset:S,endContainer:x,endOffset:k}=v.getRangeAt(y);it(w,h,u,!0)||it(x,h,u,!0)||f.push({start:d.getId(w),startOffset:S,end:d.getId(x),endOffset:k})}p({ranges:f})});return g(),Ze("selectionchange",g)})(e)),a("customElement",()=>(function({doc:l,customElementCb:c}){let d=l.defaultView;return d&&d.customElements?qi(d.customElements,"define",function(h){return function(u,p,_){try{c({define:{name:u}})}catch{console.warn(`Custom element callback failed for ${u}`)}return h.apply(this,[u,p,_])}}):()=>{}})(e));for(let l of e.plugins)a(`plugin:${l.name}`,()=>l.observer(l.callback,i,l.options))}catch(l){try{o()}catch{}throw l}return o}function oo(e){return window[e]!==void 0}function ao(e){return!!(window[e]!==void 0&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}var Sp=class{constructor(e){$(this,"generateIdFn",void 0),$(this,"iframeRemoteIdToLocalIdMap",new WeakMap),$(this,"iframeLocalIdToRemoteIdMap",new WeakMap),this.generateIdFn=e}getId(e,t,i,s){if(0>t)return t;let n=i||this.getRemoteIdToLocalIdMap(e),r=s||this.getLocalIdToRemoteIdMap(e),o=n.get(t);return o===void 0&&(o=this.generateIdFn(),n.set(t,o),r.set(o,t)),o}getIds(e,t){let i=this.getRemoteIdToLocalIdMap(e),s=this.getLocalIdToRemoteIdMap(e);return t.map(n=>this.getId(e,n,i,s))}getRemoteId(e,t,i){var s;return typeof t!="number"||0>t?t:(s=(i||this.getLocalIdToRemoteIdMap(e)).get(t))!==null&&s!==void 0?s:-1}getRemoteIds(e,t){let i=this.getLocalIdToRemoteIdMap(e);return t.map(s=>this.getRemoteId(e,s,i))}reset(e){if(!e)return this.iframeRemoteIdToLocalIdMap=new WeakMap,void(this.iframeLocalIdToRemoteIdMap=new WeakMap);this.iframeRemoteIdToLocalIdMap.delete(e),this.iframeLocalIdToRemoteIdMap.delete(e)}getRemoteIdToLocalIdMap(e){let t=this.iframeRemoteIdToLocalIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToLocalIdMap.set(e,t)),t}getLocalIdToRemoteIdMap(e){let t=this.iframeLocalIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeLocalIdToRemoteIdMap.set(e,t)),t}},xS=class{constructor(e){$(this,"iframes",new WeakMap),$(this,"crossOriginIframeMap",new WeakMap),$(this,"crossOriginIframeMirror",new Sp(Gv)),$(this,"crossOriginIframeStyleMirror",void 0),$(this,"crossOriginIframeRootIdMap",new WeakMap),$(this,"mirror",void 0),$(this,"mutationCb",void 0),$(this,"wrappedEmit",void 0),$(this,"loadListener",void 0),$(this,"pageHideListener",void 0),$(this,"stylesheetManager",void 0),$(this,"recordCrossOriginIframes",void 0),$(this,"messageHandler",void 0),$(this,"nestedIframeListeners",new Map),$(this,"attachedWindows",new WeakMap),$(this,"attachedDocuments",new WeakMap),$(this,"attachedIframes",new Map),$(this,"loadListenerDisposers",new WeakMap),$(this,"iframeElementsById",new Map),$(this,"pageHideHandlers",new WeakMap),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=ne
4w Sp(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.messageHandler=this.handleMessage.bind(this),this.recordCrossOriginIframes&&window.addEventListener("message",this.messageHandler)}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}registerLoadListenerDisposer(e,t){let i=this.loadListenerDisposers.get(e);i||(i=new Set,this.loadListenerDisposers.set(e,i)),i.add(t);let s=this.mirror.getId(e);s!==-1&&this.iframeElementsById.set(s,e)}getIframeElementById(e){var t,i,s;return(t=(i=(s=this.attachedIframes.get(e))===null||s===void 0?void 0:s.element)!==null&&i!==void 0?i:this.iframeElementsById.get(e))!==null&&t!==void 0?t:null}forgetIframeId(e){this.attachedIframes.delete(e),this.iframeElementsById.delete(e)}disposeLoadListeners(e){let t=this.loadListenerDisposers.get(e);t&&(t.forEach(i=>vi(i)),this.loadListenerDisposers.delete(e))}removePageHideListener(e){let t=this.pageHideHandlers.get(e);t&&(t.forEach(({win:i,handler:s})=>{Fs(i,"pagehide",s)}),this.pageHideHandlers.delete(e))}addLoadListener(e){this.loadListener=e}addPageHideListener(e){this.pageHideListener=e}removeLoadListener(){this.loadListener=void 0}trackIframeContent(e,t){let i=this.mirror.getId(e);return this.attachedIframes.set(i,{element:e,content:t}),i}attachIframe(e,t){var i;let s=this.trackIframeContent(e,t);if(e.contentDocument){let r=this.attachedDocuments.get(e);r||(r=new Set,this.attachedDocuments.set(e,r)),r.add(e.contentDocument)}this.mutationCb({adds:[{parentId:s,nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0});let n=e.contentWindow;if(this.recordCrossOriginIframes&&n&&!this.nestedIframeListeners.has(n)){let r=this.handleMessage.bind(this);vi(()=>{n.addEventListener("message",r),this.nestedIframeListeners.set(n,r);let o=this.attachedWindows.get(e);o||(o=new Set,this.attachedWindows.set(e,o)),o.add(n)})}vi(()=>{let r=e.contentWindow;if(!r)return;let o=this.pageHideHandlers.get(e);if(o){for(let l of o)if(l.win===r)return}let a=()=>{var l;(l=this.pageHideListener)===null||l===void 0||l.call(this,e),e.contentDocument&&this.mirror.removeNodeFromMap(e.contentDocument)};r.addEventListener("pagehide",a),o||(o=new Set,this.pageHideHandlers.set(e,o)),o.add({win:r,handler:a})}),(i=this.loadListener)===null||i===void 0||i.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){let t=e;if(t.data.type!=="rrweb"||t.origin!==t.data.origin||!e.source)return;let i=this.crossOriginIframeMap.get(e.source);if(!i)return;let s=this.transformCrossOriginEvent(i,t.data.event);s&&this.wrappedEmit(s,t.data.isCheckout)}transformCrossOriginEvent(e,t){switch(t.type){case Me.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);let s=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,s),this.patchRootIdOnNode(t.data.node,s),this.trackIframeContent(e,t.data.node),{timestamp:t.timestamp,type:Me.IncrementalSnapshot,data:{source:me.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case Me.Meta:case Me.Load:case Me.DomContentLoaded:return!1;case Me.Plugin:return t;case Me.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case Me.IncrementalSnapshot:switch(t.data.source){case me.Mutation:return t.data.adds.forEach(s=>{this.replaceIds(s,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(s.node,e);let n=this.crossOriginIframeRootIdMap.get(e);n&&this.patchRootIdOnNode(s.node,n)}),t.data.removes.forEach(s=>{this.replaceIds(s,e,["parentId","id"])}),t.data.attributes.forEach(s=>{this.replaceIds(s,e,["id"])}),t.data.texts.forEach(s=>{this.replaceIds(s,e,["id"])}),t;case me.Drag:case me.TouchMove:case me.MouseMove:return t.data.positions.forEach(s=>{this.replaceIds(s,e,["id"])}),t;case me.ViewportResize:return!1;case me.MediaInteraction:case me.MouseInteraction:case me.Scroll:case me.CanvasMutation:case me.Input:return this.replaceIds(t.data,e,["id"]),t;case me.StyleSheetRule:case me.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case me.Font:return t;
vendor: 4,507 bytes, line 4
4case me.Selection:return t.data.ranges.forEach(s=>{this.replaceIds(s,e,["start","end"])}),t;case me.AdoptedStyleSheet:var i;return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),(i=t.data.styles)===null||i===void 0||i.forEach(s=>{this.replaceStyleIds(s,e,["styleId"])}),t}}return!1}replace(e,t,i,s){for(let n of s)(Array.isArray(t[n])||typeof t[n]=="number")&&(t[n]=Array.isArray(t[n])?e.getIds(i,t[n]):e.getId(i,t[n]));return t}replaceIds(e,t,i){return this.replace(this.crossOriginIframeMirror,e,t,i)}replaceStyleIds(e,t,i){return this.replace(this.crossOriginIframeStyleMirror,e,t,i)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(i=>{this.replaceIdOnNode(i,t)})}patchRootIdOnNode(e,t){e.type===lt.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(i=>{this.patchRootIdOnNode(i,t)})}removeIframeById(e){let t=this.attachedIframes.get(e),i=t?.element||this.iframeElementsById.get(e)||this.mirror.getNode(e);if(this.iframeElementsById.delete(e),i){let s=i.contentWindow,n=this.attachedWindows.get(i);n&&(n.forEach(o=>{let a=this.nestedIframeListeners.get(o);a&&(Fs(o,"message",a),this.nestedIframeListeners.delete(o)),this.crossOriginIframeMap.delete(o)}),this.attachedWindows.delete(i)),s&&this.nestedIframeListeners.has(s)&&(Fs(s,"message",this.nestedIframeListeners.get(s)),this.nestedIframeListeners.delete(s)),s&&this.crossOriginIframeMap.delete(s),this.iframes.delete(i),this.disposeLoadListeners(i),this.removePageHideListener(i);let r=this.attachedDocuments.get(i);r&&(r.forEach(o=>{vi(()=>this.mirror.removeNodeFromMap(o))}),vi(()=>cm(i,r)),this.attachedDocuments.delete(i))}t&&this.attachedIframes.delete(e)}cleanupDetachedIframes(){if(this.attachedIframes.size===0)return;let e=[];this.attachedIframes.forEach((t,i)=>{this.mirror.has(i)||e.push(i)}),e.forEach(t=>this.removeIframeById(t))}reattachIframes(){this.attachedIframes.forEach(({content:e},t)=>{this.mirror.has(t)?this.mutationCb({adds:[{parentId:t,nextId:null,node:e}],removes:[],texts:[],attributes:[],isAttachIframe:!0}):this.attachedIframes.delete(t)})}destroy(){this.recordCrossOriginIframes&&Fs(window,"message",this.messageHandler),this.nestedIframeListeners.forEach((t,i)=>{Fs(i,"message",t)}),this.nestedIframeListeners.clear();let e=new Set;this.iframeElementsById.forEach(t=>e.add(t)),this.attachedIframes.forEach(({element:t})=>e.add(t)),e.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}},TS=class{constructor(e){$(this,"shadowDoms",new WeakSet),$(this,"mutationCb",void 0),$(this,"scrollCb",void 0),$(this,"bypassOptions",void 0),$(this,"mirror",void 0),$(this,"restoreHandlers",[]),this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){var i,s;if(!lr(e)||this.shadowDoms.has(e))return;this.shadowDoms.add(e);let n=(i=(s=se.host(e))===null||s===void 0?void 0:s.ownerDocument)!==null&&i!==void 0?i:t,{observer:r,buffer:o}=am(b(b({},this.bypassOptions),{},{doc:n,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e);this.restoreHandlers.push({doc:n,handler(){r.disconnect(),o.destroy(),o.releaseCanvasManager();let a=At.indexOf(o);a!==-1&&At.splice(a,1)}}),this.restoreHandlers.push({doc:n,handler:lm(b(b({},this.bypassOptions),{},{scrollCb:this.scrollCb,doc:e,mirror:this.mirror}))}),setTimeout(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(se.host(e))),this.restoreHandlers.push({doc:n,handler:um({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e)})},0)}observeAttachShadow(e){e.contentWindow&&e.contentDocument&&this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,t){let i=this;this.restoreHandlers.push({doc:t,handler:qi(e.prototype,"attachShadow",function(s){return function(n){let r=s.call(this,n),o=se.shadowRoot(this);return o&&om(this)&&i.addShadowRoot(o,t),r}})})}
4reset(){this.restoreHandlers.forEach(({handler:e})=>{try{e()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}resetForDoc(e){let t=[];for(let i of this.restoreHandlers)if(i.doc===e)try{i.handler()}catch{}else t.push(i);this.restoreHandlers=t}},wp="skip-frame";function IS(e){if(typeof e!="object"||e===null)return!1;let{x:t,y:i,width:s,height:n}=e;return Number.isFinite(t)&&Number.isFinite(i)&&Number.isFinite(s)&&Number.isFinite(n)&&s>=0&&n>=0}for(Us="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",kp=typeof Uint8Array>"u"?[]:new Uint8Array(256),Fn=0;64>Fn;Fn++)kp[Us.charCodeAt(Fn)]=Fn;var Us,kp,Fn,MS=function(e){var t,i=new Uint8Array(e),s=i.length,n="";for(t=0;s>t;t+=3)n+=Us[i[t]>>2],n+=Us[(3&i[t])<<4|i[t+1]>>4],n+=Us[(15&i[t+1])<<2|i[t+2]>>6],n+=Us[63&i[t+2]];return s%3==2?n=n.substring(0,n.length-1)+"=":s%3==1&&(n=n.substring(0,n.length-2)+"=="),n},Cp=!1,Ep=new Map,dm=(e,t,i)=>{if(!e||!pm(e,t)&&typeof e!="object")return;let s=(function(r,o){let a=Ep.get(r);return a||(a=new Map,Ep.set(r,a)),a.has(o)||a.set(o,[]),a.get(o)})(i,e.constructor.name),n=s.indexOf(e);return n===-1&&(n=s.length,s.push(e)),n};function Bo(e,t,i,s){if(e instanceof Array)return e.map(n=>Bo(n,t,i,s));if(e===null)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer)return{rr_type:e.constructor.name,base64:MS(e)};if(e instanceof DataView)return{rr_type:e.constructor.name,args:[Bo(e.buffer,t,i,s),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){let n=e.constructor.name,{src:r}=e;return{rr_type:n,src:r}}if(e instanceof HTMLCanvasElement){let n="HTMLImageElement",r;try{r=e.toDataURL(s.type,s.quality)}catch(o){throw(function(a){a?.name==="SecurityError"?Cp||(Cp=!0,console.warn("[replay] canvas capture: skipping a canvas draw because its pixels cannot be read. A cross-origin image or video drawn into it taints it.",a)):console.warn("[replay] canvas capture: skipping a canvas draw because its pixels cannot be read.",a)})(o),o}return{rr_type:n,src:r}}return e instanceof ImageData?{rr_type:e.constructor.name,args:[Bo(e.data,t,i,s),e.width,e.height]}:pm(e,t)||typeof e=="object"?{rr_type:e.constructor.name,index:dm(e,t,i)}:e}var hm=(e,t,i,s)=>e.map(n=>Bo(n,t,i,s)),pm=(e,t)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(s=>typeof t[s]=="function").find(s=>e instanceof t[s]),PS=["webgl","webgl2"];function xp(e){return"nodeType"in e}function Tp(e,t,i,s){let n=[];try{if(s){let o=(function(a,l,c){let d=a.GPUCanvasContext;if(d?.prototype&&typeof d.prototype.configure=="function")return qi(d.prototype,"configure",function(h){return function(u){let p=(function(g){let{canvas:v}=g;return v&&typeof v=="object"?v:null})(this);if(!p||xp(p)&&it(p,l,c,!0))return h.call(this,u);xp(p)&&!("__context"in p)&&(p.__context="webgpu");let _=(function(g){let v=g.GPUTextureUsage;return v?v.COPY_SRC|v.RENDER_ATTACHMENT:null})(a);return h.call(this,_!==null&&u?b(b({},u),{},{usage:typeof u.usage=="number"?u.usage|_:_}):u)}})})(e,t,i);o&&n.push(o)}let r=qi(e.HTMLCanvasElement.prototype,"getContext",function(o){return function(a,...l){let c=(function(d){return d==="experimental-webgl"?"webgl":d})(a);if(!it(this,t,i,!0)&&("__context"in this||(this.__context=c),s&&PS.includes(c)))if(l[0]&&typeof l[0]=="object"){let d=l[0];d.preserveDrawingBuffer||(d.preserveDrawingBuffer=!0)}else l.splice(0,1,{preserveDrawingBuffer:!0});return o.apply(this,[a,...l])}});n.push(r)}catch{console.warn("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{n.forEach(r=>r())}}function Ip(e,t,i,s,n,r,o){let a=[],l=Object.getOwnPropertyNames(e);for(let c of l)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(c))try{if
4(typeof e[c]!="function")continue;let d=qi(e,c,function(h){return function(...u){let p=h.apply(this,u);if(dm(p,r,this),this.canvas&&"tagName"in this.canvas&&!it(this.canvas,s,n,!0)){let _;try{_=hm(u,r,this,o)}catch{}_&&i(this.canvas,{type:t,property:c,args:_})}return p}});a.push(d)}catch{let h=Ha(e,c,{set(u){this.canvas&&"tagName"in this.canvas&&!it(this.canvas,s,n,!0)&&i(this.canvas,{type:t,property:c,args:[u],setter:!0})}});a.push(h)}return a}var _m=`(function() { 5 //#region ../../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/base64-arraybuffer/1.0.2/f63fa6b5c318cf1c9f6bdd1d4292ad2f15f76f2ec78475025a2d44070e896fe9/node_modules/base64-arraybuffer/dist/base64-arraybuffer.es5.js 6 var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; 7 var lookup = typeof Uint8Array === "undefined" ? [] : /* @__PURE__ */ new Uint8Array(256); 8 for (var i = 0; i < chars.length; i++) lookup[chars.charCodeAt(i)] = i; 9 var encode = function(arraybuffer) { 10 var bytes = new Uint8Array(arraybuffer), i, len = bytes.length, base64 = ""; 11 for (i = 0; i < len; i += 3) { 12 base64 += chars[bytes[i] >> 2]; 13 base64 += chars[(bytes[i] & 3) << 4 | bytes[i + 1] >> 4]; 14 base64 += chars[(bytes[i + 1] & 15) << 2 | bytes[i + 2] >> 6]; 15 base64 += chars[bytes[i + 2] & 63]; 16 } 17 if (len % 3 === 2) base64 = base64.substring(0, base64.length - 1) + "="; 18 else if (len % 3 === 1) base64 = base64.substring(0, base64.length - 2) + "=="; 19 return base64; 20 }; 21 //#endregion 22 //#region ../rrweb/src/record/workers/image-bitmap-data-url-worker.ts 23 const lastFingerprintMap = /* @__PURE__ */ new Map(); 24 const transparentFingerprintMap = /* @__PURE__ */ new Map(); 25 const lastSentAtMap = /* @__PURE__ */ new Map(); 26 const PROVIDER_KEYFRAME_INTERVAL_MS = 3e4; 27 function hashPixels(data) { 28 const view = new Uint32Array(data.buffer, data.byteOffset, data.byteLength >>> 2); 29 let primaryHash = 2166136261; 30 let secondaryHash = 2654435769; 31 for (let i = 0; i < view.length; i++) { 32 primaryHash ^= view[i]; 33 primaryHash = Math.imul(primaryHash, 16777619); 34 secondaryHash ^= view[i]; 35 secondaryHash = Math.imul(secondaryHash, 2246822507); 36 } 37 return \`\${(primaryHash >>> 0).toString(16)}:\${(secondaryHash >>> 0).toString(16)}\`; 38 } 39 function frameFingerprint(width, height, data) { 40 return \`\${width}x\${height}:\${hashPixels(data)}\`; 41 } 42 function transparentFingerprint(width, height) { 43 const pixelCount = width * height; 44 let hash = transparentFingerprintMap.get(pixelCount); 45 if (hash === void 0) { 46 hash = hashPixels(new Uint8ClampedArray(pixelCount * 4)); 47 transparentFingerprintMap.set(pixelCount, hash); 48 } 49 return \`\${width}x\${height}:\${hash}\`; 50 } 51 const worker = self; 52 let reusableCanvas = null; 53 let reusableCtx = null; 54 worker.onmessage = async function(e) { 55 if ("resetFrameDedup" in e.data) { 56 lastFingerprintMap.clear(); 57 return; 58 } 59 if ("OffscreenCanvas" in globalThis) { 60 const { id, bitmap, width, height, displayWidth, displayHeight, dataURLOptions, maskRegions } = e.data; 61 try { 62 if (!reusableCanvas || reusableCanvas.width !== width || reusableCanvas.height !== height) { 63 reusableCanvas = new OffscreenCanvas(width, height); 64 reusableCtx = reusableCanvas.getContext("2d", { willReadFrequently: true }); 65 } 66 const ctx = reusableCtx; 67 ctx.clearRect(0, 0, width, height); 68 ctx.drawImage(bitmap, 0, 0); 69 bitmap.close(); 70 if (maskRegions) { 71 ctx.fillStyle = "black"; 72 for (const region of maskRegions) ctx.fillRect(region.x, region.y, region.width, region.height); 73 } 74 const fingerprint = frameFingerprint(width, height, ctx.getImageData(0, 0, width, height).data); 75 if (fingerprint === (lastFingerprintMap.get(id) ?? transparentFingerprint(width, height))) { 76 const lastSentAt = lastSentAtMap.get(id); 77 if (!(maskRegions !== void 0 && lastSentAt !== void 0 && Date.now() - lastSentAt >= PROVIDER_KEYFRAME_INTERVAL_MS)) return worker.postMessage({ id }); 78 } 79 const blob = await reusableCanvas.convertToBlob(dataURLOptions); 80 const arrayBuffer = await blob.arrayBuffer(); 81 worker.postMessage({ 82 id, 83 type: blob.type, 84 base64: encode(arrayBuffer), 85 displayWidth, 86 displayHeight 87 }); 88 lastFingerprintMap.set(id, fingerprint); 89 lastSentAtMap.set(id, Date.now()); 90 } catch { 91 worker.postMessage({ id }); 92 } 93 } else { 94 e.data.bitmap.close(); 95 return worker.postMessage({ id: e.data.id }); 96 } 97 }; 98 //#endregion 99})(); 100`,Mp=typeof self<"u"&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",_m],{type:"text/javascript;charset=utf-8"});function RS(e){let t;try{if(t=Mp&&(self.URL||self.webkitURL).createObjectURL(Mp),!t)throw"";let i=new Worker(t,{name:e?.name});return i.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),i}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(_m),{name:e?.name})}}var Pp="A page CSP that omits blob: from worker-src or script-src blocks it";function An(e,...t){console.warn(`[replay] canvas capture: ${e}`,...t)}var Ge,qo,lo,FS=class{onFullSnapshot(){var e;(e=this.resetFrameDedup)===null||e===void 0||e.call(this)}acquire(){this.refCount+=1}reset(){this.refCount>0&&(this.refCount-=1),this.refCount>0||this.teardown()}teardown(){this.torndown||(this.torndown=!0,this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers(),this.rafIdTimestamp!==null&&(cancelAnimationFrame(this.rafIdTimestamp),this.rafIdTimestamp=null),this.rafIdFlush!==null&&(cancelAnimationFrame(this.rafIdFlush),this.rafIdFlush=null))}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}constructor(e){$(this,"pendingCanvasMutations",new Map),$(this,"rafStamps",{latestId:0,invokeId:null}),$(this,"mirror",void 0),$(this,"mutationCb",void 0),$(this,"resetObservers",void 0),$(this,"frozen",!1),$(this,"locked",!1),$(this,"rafIdTimestamp",null),$(this,"rafIdFlush",null),$(this,"refCount",0),$(this,"torndown",!1),$(this,"resetFrameDedup",null),$(this,"processMutation",(c,d)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(c)||this.pendingCanvasMutations.set(c,[]),this.pendingCanvasMutations.get(c).push(d)});let{sampling:t="all",win:i,blockClass:s,blockSelector:n,recordCanvas:r,dataURLOptions:o,resolutionScale:a,canvasMasking:l}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,r&&t==="all"&&this.initCanvasMutationObserver(i,s,n,o),r&&typeof t=="number"&&this.initCanvasFPSObserver(t,i,s,n,{dataURLOptions:o,resolutionScale:a,canvasMasking:l})}initCanvasFPSObserver(e,t,i,s,n){var r=this;if(!("OffscreenCanvas"in t))return void An("disabled because this browser does not support OffscreenCanvas");let o=typeof n.resolutionScale=="number"&&Number.isFinite(n.resolutionScale)?Math.min(1,Math.max(.1,n.resolutionScale)):1,a=Tp(t,i,s,!0),l=new Map,c;try{c=new RS}catch(f){return An(`disabled because the encode worker did not start. ${Pp}`,f),void a()}let d=!1;c.onerror=f=>{var m;d=!0,An(`stopped because the encode worker failed. ${Pp}`,f),cancelAnimationFrame(_),(m=c.terminate)===null||m===void 0||m.call(c),this.resetFrameDedup=null},this.resetFrameDedup=()=>{c.postMessage({resetFrameDedup:!0})},c.onmessage=f=>{let{id:m}=f.data;if(l.set(m,!1),!("base64"in f.data))return;let{base64:y,type:w,displayWidth:S,displayHeight:x}=f.data;this.mutationCb({id:m,type:Mn["2D"],commands:[{property:"clearRect",args:[0,0,S,x]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:y}],type:w}]},0,0,S,x]}],displayWidth:S,displayHeight:x})};let h=!1,u=!1,p=1e3/e,_,g=0,v=f=>{var m;d||(g&&p>f-g||(g=f,(()=>{let y=[],w=S=>{try{S.querySelectorAll("canvas").forEach(x=>{it(x,i,s,!0)||y.push(x)}),S.querySelectorAll("*").forEach(x=>{x.shadowRoot&&w(x.shadowRoot)})}catch{}};return w(t.document),y}
100)().forEach((m=Ce(function*(y){let w=r.mirror.getId(y);if(w!==-1&&!l.get(w)&&y.width!==0&&y.height!==0){l.set(w,!0);try{if(["webgl","webgl2"].includes(y.__context)){var S,x;let L=y.getContext(y.__context);if(!(L==null||(S=L.isContextLost)===null||S===void 0)&&S.call(L))return void l.set(w,!1);(L==null||(x=L.getContextAttributes())===null||x===void 0?void 0:x.preserveDrawingBuffer)===!1&&L.clear(L.COLOR_BUFFER_BIT)}let k=y.clientWidth||y.width,C=y.clientHeight||y.height,E=Math.max(1,Math.round(k*o)),I=Math.max(1,Math.round(C*o)),P=(function(L,A,B,q,K,U){if(!L||typeof L.regionsFn!="function")return;let ce;try{ce=L.regionsFn(A)}catch{return wp}if(ce===void 0)return;if(!Array.isArray(ce)||!ce.every(IS))return wp;let j=B/K,N=q/U;return ce.filter(V=>V.width>0&&V.height>0).map(V=>{let Q=Math.floor(V.x*j),z=Math.floor(V.y*N);return{x:Q,y:z,width:Math.ceil((V.x+V.width)*j)-Q,height:Math.ceil((V.y+V.height)*N)-z}})})(n.canvasMasking,y,E,I,k,C);if(P==="skip-frame")return h||(h=!0,An("dropped a frame because the mask provider did not return valid regions. A provider that always fail
100s records no canvas frames at all")),void l.set(w,!1);let O=yield createImageBitmap(y,1>o?{resizeWidth:E,resizeHeight:I,resizeQuality:"medium"}:{resizeWidth:E,resizeHeight:I});c.postMessage({id:w,bitmap:O,width:E,height:I,displayWidth:k,displayHeight:C,dataURLOptions:n.dataURLOptions,maskRegions:P},[O])}catch(k){u||(u=!0,An("dropped a frame because the snapshot failed. A canvas that fails every frame records no canvas frames at all",k)),l.set(w,!1)}}}),function(y){return m.apply(this,arguments)}))),_=requestAnimationFrame(v))};_=requestAnimationFrame(v),this.resetObservers=()=>{var f;a(),cancelAnimationFrame(_),(f=c.terminate)===null||f===void 0||f.call(c),this.resetFrameDedup=null}}initCanvasMutationObserver(e,t,i,s){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let n=Tp(e,t,i,!1),r=(function(a,l,c,d,h){let u=[],p=Object.getOwnPropertyNames(l.CanvasRenderingContext2D.prototype);for(let _ of p)try{if(typeof l.CanvasRenderingContext2D.prototype[_]!="function")continue;let g=qi(l.CanvasRenderingContext2D.prototype,_,function(v){return function(...f){return it(this.canvas,c,d,!0)||setTimeout(()=>{let m;try{m=hm(f,l,this,h)}catch{return}a(this.canvas,{type:Mn["2D"],property:_,args:m})},0),v.apply(this,f)}});u.push(g)}catch{let v=Ha(l.CanvasRenderingContext2D.prototype,_,{set(f){it(this.canvas,c,d,!0)||a(this.canvas,{type:Mn["2D"],property:_,args:[f],setter:!0})}});u.push(v)}return()=>{u.forEach(_=>_())}})(this.processMutation.bind(this),e,t,i,s),o=(function(a,l,c,d,h){let u=[];return l.WebGLRenderingContext!==void 0&&u.push(...Ip(l.WebGLRenderingContext.prototype,Mn.WebGL,a,c,d,l,h)),l.WebGL2RenderingContext!==void 0&&u.push(...Ip(l.WebGL2RenderingContext.prototype,Mn.WebGL2,a,c,d,l,h)),()=>{u.forEach(p=>p())}})(this.processMutation.bind(this),e,t,i,s);this.resetObservers=()=>{n(),r(),o()}}startPendingCanvasMutationFlusher(){this.rafIdFlush=requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){let e=t=>{this.rafStamps.latestId=t,this.rafIdTimestamp=requestAnimationFrame(e)};this.rafIdTimestamp=requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,t)=>{let i=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,i)}),this.rafIdFlush=requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;let i=this.pendingCanvasMutations.get(e);if(!i||t===-1)return;let s=i.map(r=>ju(r,nS)),{type:n}=i[0];this.mutationCb({id:t,type:n,commands:s}),this.pendingCanvasMutations.delete(e)}},AS=class{constructor(e){var t;$(this,"trackedLinkElements",new WeakSet),$(this,"pendingDeferredSheets",new Set),$(this,"mutationCb",void 0),$(this,"adoptedStyleSheetCb",void 0),$(this,"maskAllElementAttributes",void 0),$(this,"maskAttributeFn",void 0),$(this,"styleMirror",new yS),this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb,this.maskAllElementAttributes=(t=e.maskAllElementAttributes)!==null&&t!==void 0&&t,this.maskAttributeFn=e.maskAttributeFn}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}beginDeferredLinkInlining(e,t){if(t===-1||!e.isConnected)return null;let i=null,s=null;try{s=e.sheet,s&&(i=lS(s))}catch{}if(!i||!s)return no(),null;let n=i,r=!1,o={sheet:s,invalidate(){r=!0}};this.pendingDeferredSheets.add(o);let a=!1;return{advance:l=>{if(a)return!0;let c=Dt(),d=Hv(),h=!0;try{if(r)return a=!0,no(),!0;if(!n.advance(l))return h=!1,!1;a=!0;let _=n.text();if(!e.isConnected)return!0;let g=null;try{g=e.sheet}catch{}return g!==s?(no(),!0):_?(this.emitCssTextMutation(e,t,_),!0):(no(),!0)}finally{h&&this.pendingDeferredSheets.delete(o),ld(u=Dt()-c,(p=d)!=null?p:_s)||(as.totalMs+=u,u>as.slowestSliceMs&&(as.slowestSliceMs=u))}var u,p},remainingRules:()=>n.remainingRules(),discard:()=>{this.pendingDeferredSheets.delete(o)}}}onCssomSheetMutation(e){if(e&&this.pendingDeferredSheets.size!==0)for(let t of this.pendingDeferredSheets)t.sheet===e&&(this.pendingDeferredSheets.delete(t),t.invalidate())}inlineDeferredLinkElement(e,t){var i;(i=this.beginDeferredLinkInlining(e,t))===null||i===void 0||i.advance(1/0)}emitCssTextMutation(e,t,i){this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t,attributes:{_cssText:ka({element:e,name:"_cssText",value:i,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn})}}]})}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(e.length===0)return;let i={id:t,styleIds:[]},s=[];for(let n of e){let r;if(this.styleMirror.has(n))r=this.styleMirror.getId(n);else{let o=this.styleMirror.add(n);r=o;let a=Dt();try{Uv(()=>{try{let l=n.rules||n.cssRules;l&&Sa(l)}catch{}s.push({styleId:o,rules:Array.from(n.rules||CSSRule,(l,c)=>({rule:jv(l,n.href),index:c}))})})}finally{dd(Dt()-a)}}i.styleIds.push(r)}s.length>0&&(i.styles=s),this.adoptedStyleSheetCb(i)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet,this.pendingDeferredSheets.clear(),ur.forEach(e
100=>e.abort()),ur.clear()}trackStylesheetInLinkElement(e){}},LS=class{constructor(){$(this,"nodeMap",new WeakMap),$(this,"active",!1)}inOtherBuffer(e,t){let i=this.nodeMap.get(e);return i&&Array.from(i).some(s=>s!==t)}add(e,t){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}destroy(){}},hr=!1;try{if(Array.from([1],e=>2*e)[0]!==2){let e=document.createElement("iframe");document.body.appendChild(e),Array.from=((co=e.contentWindow)===null||co===void 0?void 0:co.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}var co,ct=new Vv,OS=new Set([me.Mutation,me.MediaInteraction,me.StyleSheetRule,me.CanvasMutation,me.Font,me.Log,me.StyleDeclaration,me.AdoptedStyleSheet]);function Rp(e){let t=window;if(typeof t.requestIdleCallback=="function"){let s=t.requestIdleCallback(e,{timeout:2e3});return{cancel(){var n;return(n=t.cancelIdleCallback)===null||n===void 0?void 0:n.call(t,s)}}}let i=setTimeout(e,250);return{cancel:()=>clearTimeout(i)}}function es(e={}){let t,i=!1,s=!1,{emit:n,checkoutEveryNms:r,checkoutEveryNth:o,blockClass:a="rr-block",blockSelector:l=null,ignoreClass:c="rr-ignore",ignoreSelector:d=null,maskTextClass:h="rr-mask",maskTextSelector:u=null,inlineStylesheet:p=!0,inlineStylesheetBudgetRules:_,maskAllInputs:g,maskInputOptions:v,slimDOMOptions:f,maskInputFn:m,maskTextFn:y,maskAllElementAttributes:w=!1,maskAttributeFn:S,hooks:x,packFn:k,sampling:C={},dataURLOptions:E={},canvasResolutionScale:I,canvasMasking:P,mousemoveWait:O,recordDOM:L=!0,recordCanvas:A=!1,recordCrossOriginIframes:B=!1,recordAfter:q=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:K=!1,collectFonts:U=!1,inlineImages:ce=!1,plugins:j,keepIframeSrcFn:N=()=>!1,ignoreCSSAttributes:V=new Set([]),attributeFilter:Q,errorHandler:z}=e;wS(z);let ae=b({type:"image/webp",quality:.4,maxBase64ImageLength:1048576},E),be=!B||window.parent===window,Ee=!1;if(!be)try{window.parent.document&&(Ee=!1)}catch{Ee=!0}if(be&&!n)throw new Error("emit function is required");if(!be&&!Ee)return()=>{};O!==void 0&&C.mousemove===void 0&&(C.mousemove=O),ct.reset();let pe=g===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:v!==void 0?v:{password:!0},ve=pp(f!==void 0&&f),dt;(function(te=window){"NodeList"in te&&!te.NodeList.prototype.forEach&&(te.NodeList.prototype.forEach=[].forEach),"DOMTokenList"in te&&!te.DOMTokenList.prototype.forEach&&(te.DOMTokenList.prototype.forEach=[].forEach)})();let st=0,Le=new Map,ze,It,Ci=te=>{for(let je of j||[])je.eventProcessor&&(te=je.eventProcessor(te));return k&&!Ee&&(te=k(te)),te};Ge=(te,je)=>{var Ve;let le=te;if(le.timestamp=Ta(),!(!((Ve=At[0])===null||Ve===void 0)&&Ve.isFrozen())||le.type===Me.FullSnapshot||le.type===Me.IncrementalSnapshot&&OS.has(le.data.source)||At.forEach(ge=>ge.unfreeze()),be)n?.(Ci(le),je);else if(Ee){let ge={type:"rrweb",event:Ci(le),origin:window.location.origin,isCheckout:je};window.parent.postMessage(ge,"*")}if(le.type===Me.FullSnapshot)dt=le,st=0;else if(le.type===Me.IncrementalSnapshot){if(le.data.source===me.Mutation&&le.data.isAttachIframe)return;st++,(o&&st>=o||r&&le.timestamp-dt.timestamp>r)&&qo(!0)}};let nt=te=>{if(te.removes&&te.removes.length>0){let je=te.adds.length>0?new Set(te.adds.map(le=>le.node.id)):null,Ve=new Set;if(te.adds.length>0)for(let le of te.adds){let ge=ct.getNode(le.node.id);ge&&ge.nodeName==="IFRAME"&&Ve.add(ge)}te.removes.forEach(({id:le})=>{if(je&&je.has(le))return;let ge=Pe.getIframeElementById(le);ge&&Ve.has(ge)?Pe.forgetIframeId(le):(ze?.(le),Pe.removeIframeById(le))}),It?.(),Pe.cleanupDetachedIframes()}Ge({type:Me.IncrementalSnapshot,data:b({source:me.Mutation},te)})},Bt=te=>Ge({type:Me.IncrementalSnapshot,data:b({source:me.Scroll},te)}),Yt=te=>Ge({type:Me.IncrementalSnapshot,data:b({source:me.CanvasMutation},te)}),qe=new AS({mutationCb:nt,adoptedStyleSheetCb:te=>Ge({type:Me.IncrementalSnapshot,data:b({source:me.AdoptedStyleSheet},te)}),maskAllElementAttributes:w,maskAttributeFn:S}),Pe=new xS({mirror:ct,mutationCb:nt,stylesheetManager:qe,recordCrossOriginIframes:B,wrappedEmit:Ge});for(let te of j||[])te.getMirror&&te.getMirror({nodeMirror:ct,crossOriginIframeMirror:Pe.crossOriginIframeMirror,crossOriginIframeStyleMirror:Pe.crossOriginIframeStyleMirror});let X=new LS,at=P?.configured;lo=new FS({recordCanvas:A,mutationCb:Yt,win:window,blockClass:a,blockSelector:l,mirror:ct,sampling:C.canvas,dataURLOptions:ae,resolutionScale:I,canvasMasking:P});let Fe=new TS({mutationCb:nt,scrollCb:Bt,bypassOptions:{blockClass:a,blockSelector:l,maskTextClass:h,maskTextSelector:u,inlineStylesheet:p,maskInputOptions:pe,dataURLOptions:ae,maskTextFn:y,maskInputFn:m,maskAllElementAttributes:w,maskAttributeFn:S,recordCanvas:A,canvasMaskingConfigured:at,inlineImages:ce,sampling:C,slimDOMOptions:ve,iframeManager:Pe,stylesheetManager:qe,canvasManager:lo,keepIframeSrcFn:N,processedNodeManager:X,attributeFilter:Q},mirror:ct});qo=(te=!1)=>
100{if(L){ip(_);try{if(Ge({type:Me.Meta,data:{href:window.location.href,width:em(),height:Xv()}},te),i)return;t?.cancel(),t=void 0,qe.reset(),Fe.init(),At.forEach(le=>le.lock());let je=null,Ve=[];try{je=(function(le,ge){let{mirror:mt=new Vv,blockClass:fe="rr-block",blockSelector:he=null,maskTextClass:re="rr-mask",maskTextSelector:He=null,inlineStylesheet:Re=!0,inlineImages:qt=!1,recordCanvas:Ht=!1,canvasMaskingConfigured:fs,maskAllInputs:li=!1,maskTextFn:Ye,maskInputFn:De,maskAllElementAttributes:de=!1,maskAttributeFn:Ut,slimDOM:Wt=!1,dataURLOptions:jr,preserveWhiteSpace:Vr,onSerialize:yn,onIframeLoad:bn,iframeLoadTimeout:Sn,onIframeListenerRegistered:wn,onStylesheetLoad:G,stylesheetLoadTimeout:Se,keepIframeSrcFn:rt=()=>!1,maxDepth:ht,inlineStylesheetBudgetRules:Xe}=ge||{},ci=li===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:li===!1?{password:!0}:li,zi=pp(Wt);ip(Xe);try{return Hs(le,{doc:le,mirror:mt,blockClass:fe,blockSelector:he,maskTextClass:re,maskTextSelector:He,skipChild:!1,inlineStylesheet:Re,maskInputOptions:ci,maskTextFn:Ye,maskInputFn:De,maskAllElementAttributes:de,maskAttributeFn:Ut,slimDOMOptions:zi,dataURLOptions:jr,inlineImages:qt,recordCanvas:Ht,canvasMaskingConfigured:fs,preserveWhiteSpace:Vr,onSerialize:yn,onIframeLoad:bn,iframeLoadTimeout:Sn,onIframeListenerRegistered:wn,onStylesheetLoad:G,stylesheetLoadTimeout:Se,keepIframeSrcFn:rt,newlyAddedElement:!1,maxDepth:ht})}finally{sp()}})(document,{mirror:ct,blockClass:a,blockSelector:l,maskTextClass:h,maskTextSelector:u,inlineStylesheet:p,maskAllInputs:pe,inlineStylesheetBudgetRules:_,maskTextFn:y,maskInputFn:m,maskAllElementAttributes:w,maskAttributeFn:S,slimDOM:ve,dataURLOptions:ae,recordCanvas:A,canvasMaskingConfigured:at,inlineImages:ce,onSerialize(le){sm(le,ct)&&Pe.addIframe(le),nm(le,ct)&&qe.trackLinkElement(le),Kc(le)&&Fe.addShadowRoot(se.shadowRoot(le),document)},onIframeLoad(le,ge){Pe.attachIframe(le,ge),Fe.observeAttachShadow(le)},onIframeListenerRegistered(le,ge){Pe.registerLoadListenerDisposer(le,ge)},onStylesheetLoad(le,ge){qe.attachLinkElement(le,ge)},keepIframeSrcFn:N})}finally{Ve=oS()}if(i)return;if(!je)return console.warn("Failed to snapshot the document");if(Ge({type:Me.FullSnapshot,data:{node:je,initialOffset:Zv(window)}},te),i)return;if(At.forEach(le=>le.unlock()),lo.onFullSnapshot(),Ve.length){let le=(function(ge,mt,fe){let he=!1,re=null,He=0,Re=null,qt=()=>Re!==null||ge.length>He,Ht=()=>{let De=ge[He];ge[He]=null,He+=1,De&&vi(()=>{Re=mt.beginDeferredLinkInlining(De,ct.getId(De))})},fs=()=>{if(!Re)return;let De=Re,de=!0;vi(()=>
100{de=De.advance(200)}),de&&(Re=null)},li=()=>{Re||Ht(),fs()},Ye=De=>{if(re=null,he)return;let de=0;do{try{li()}catch{Re?.discard(),Re=null,rp(1)}de+=1}while(!he&&qt()&&(De?!De.didTimeout&&De.timeRemaining()>5:10>de));he||(qt()?re=Rp(Ye):fe())};return re=Rp(Ye),{cancel(){he=!0,Re?.discard(),Re=null,re?.cancel(),re=null},flush(){if(he)return;he=!0,re?.cancel(),re=null;let De=0,de=0;for(;qt()&&50>De;){Re||Ht();let Ut=Re;if(Ut)if(Math.floor(Ut.remainingRules()/200)+1>50-De)Ut.discard(),Re=null,de+=1;else{try{fs()}catch{Re?.discard(),Re=null,de+=1}De+=1}}if(qt()||de>0){let Ut=de+(Re!==null?1:0);for(let Wt=He;ge.length>Wt;Wt++)ge[Wt]!==null&&(Ut+=1);rp(Ut),Re?.discard(),Re=null}fe()}}})(Ve,qe,()=>{t===le&&(t=void 0)});t=le}B&&Pe.reattachIframes(),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&qe.adoptStyleSheets(document.adoptedStyleSheets,ct.getId(document))}finally{sp()}}};try{let te=[];te.push(Ze("pagehide",()=>{try{t?.flush()}catch{}t=void 0},window));for(let fe of["visibilitychange","freeze","resume"])te.push(Ze(fe,rS,document));ze=fe=>{let he=Le.get(fe);he&&(he.forEach(re=>{vi(re);let He=te.indexOf(re);He!==-1&&te.splice(He,1)}),Le.delete(fe))},It=()=>{for(let[fe]of Le){let he=ct.getNode(fe);if(he)try{he.contentDocument&&he.contentDocument.defaultView||ze==null||ze(fe)}catch{ze?.(fe)}else ze?.(fe)}};let je=fe=>{var he;return ke(ES)({mutationCb:nt,mousemoveCb:(re,He)=>Ge({type:Me.IncrementalSnapshot,data:{source:He,positions:re}}),mouseInteractionCb:re=>Ge({type:Me.IncrementalSnapshot,data:b({source:me.MouseInteraction},re)}),scrollCb:Bt,viewportResizeCb:re=>Ge({type:Me.IncrementalSnapshot,data:b({source:me.ViewportResize},re)}),inputCb:re=>Ge({type:Me.IncrementalSnapshot,data:b({source:me.Input},re)}),mediaInteractionCb:re=>Ge({type:Me.IncrementalSnapshot,data:b({source:me.MediaInteraction},re)}),styleSheetRuleCb:re=>Ge({type:Me.IncrementalSnapshot,data:b({source:me.StyleSheetRule},re)}),styleDeclarationCb:re=>Ge({type:Me.IncrementalSnapshot,data:b({source:me.StyleDeclaration},re)}),canvasMutationCb:Yt,fontCb:re=>Ge({type:Me.IncrementalSnapshot,data:b({source:me.Font},re)}),selectionCb(re){Ge({type:Me.IncrementalSnapshot,data:b({source:me.Selection},re)})},customElementCb(re){Ge({type:Me.IncrementalSnapshot,data:b({source:me.CustomElement},re)})},blockClass:a,ignoreClass:c,ignoreSelector:d,maskTextClass:h,maskTextSelector:u,maskInputOptions:pe,inlineStylesheet:p,sampling:C,recordDOM:L,recordCanvas:A,canvasMaskingConfigured:at,inlineImages:ce,userTriggeredOnInput:K,collectFonts:U,doc:fe,maskInputFn:m,maskTextFn:y,maskAllElementAttributes:w,maskAttributeFn:S,keepIframeSrcFn:N,blockSelector:l,slimDOMOptions:ve,dataURLOptions:ae,mirror:ct,iframeManager:Pe,stylesheetManager:qe,shadowDomManager:Fe,processedNodeManager:X,canvasManager:lo,ignoreCSSAttributes:V,attributeFilter:Q,plugins:(j==null||(he=j.filter(re=>re.observer))===null||he===void 0?void 0:he.map(re=>({name:re.name,observer:re.observer,options:re.options,callback:He=>Ge({type:Me.Plugin,data:{plugin:re.name,payload:He}})})))||[]},x)};Pe.addLoadListener(fe=>{try{let he=ct.getId(fe),re=je(fe.contentDocument);if(typeof re=="function"&&(te.push(re),he!==-1)){let He=Le.get(he);He||(He=new Set,Le.set(he,He)),He.add(re)}}catch(he){console.warn(he)}}),Pe.addPageHideListener(fe=>{let he=ct.getId(fe);ze?.(he),cm(fe)});let Ve=-1,le=fe=>Ge({type:Me.Custom,data:{tag:"rrweb/fullscreen",payload:fe}}),ge=()=>{var fe,he,re,He;let Re=document,qt=(fe=(he=(re=(He=Re.fullscreenElement)!==null&&He!==void 0?He:Re.webkitFullscreenElement)!==null&&re!==void 0?re:Re.mozFullScreenElement)!==null&&he!==void 0?he:Re.msFullscreenElement)!==null&&fe!==void 0?fe:null,Ht=qt?ct.getId(qt):-1;Ht!==Ve&&(Ve!==-1&&le({id:Ve,enter:!1}),Ve=Ht,Ht!==-1&&le({id:Ht,enter:!0}))},mt=()=>{if(i||s||(s=!0,qo(),i))return;let fe=je(document);i?typeof fe=="function"&&xa([fe]):(typeof fe=="function"&&te.push(fe),te.push(Ze("fullscreenchange",ge)),te.push(Ze("webkitfullscreenchange",ge)),te.push(Ze("mozfullscreenchange",ge)),te.push(Ze("MSFullscreenChange",ge)),hr=!0)};return["interactive","complete"].includes(document.readyState)?mt():(te.push(Ze("DOMContentLoaded",()=>{Ge({type:Me.DomContentLoaded,data:{}}),q==="DOMContentLoaded"&&setTimeout(mt,0)})),te.push(Ze("load",()=>{Ge({type:Me.Load,data:{}}),q==="load"&&mt()}
100,window))),()=>{i=!0;try{t?.flush()}catch{}t=void 0,xa(te),X.destroy(),Pe.removeLoadListener(),Pe.destroy(),Le.clear(),Fe.reset(),ct.reset(),hr=!1,kS()}}catch(te){console.warn(te)}}es.addCustomEvent=(e,t)=>{if(!hr)throw new Error("please add custom event after start recording");Ge({type:Me.Custom,data:{tag:e,payload:t}})},es.freezePage=()=>{At.forEach(e=>e.freeze())},es.takeFullSnapshot=e=>{if(!hr)throw new Error("please take full snapshot after start recording");qo(e)},es.isRecording=()=>hr,es.mirror=ct,"Mobile".toLowerCase(),"Tablet".toLowerCase(),new RegExp("Xbox","i"),new RegExp("Nintendo","i"),new RegExp("PlayStation","i"),new RegExp("Windows","i"),"0".repeat(32),"0".repeat(16);var uo=Object.create(null);function pr(e){return pr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pr(e)}function ho(e,t,i){return(t=(function(s){var n=(function(r){if(pr(r)!="object"||!r)return r;var o=r[Symbol.toPrimitive];if(o!==void 0){var a=o.call(r,"string");if(pr(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)})(s);return pr(n)=="symbol"?n:n+""})(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}uo.Node=Object.create(null),uo.ShadowRoot=Object.create(null),uo.MutationObserver=Object.create(null),uo.Element=Object.create(null);var ks=class{constructor(e){ho(this,"fileName",void 0),ho(this,"functionName",void 0),ho(this,"lineNumber",void 0),ho(this,"columnNumber",void 0),this.fileName=e.fileName||"",this.functionName=e.functionName||"",this.lineNumber=e.lineNumber,this.columnNumber=e.columnNumber}toString(){let e=this.lineNumber||"",t=this.columnNumber||"";return this.functionName?`${this.functionName} (${this.fileName}:${e}:${t})`:`${this.fileName}:${e}:${t}`}},$S=/(^|@)\S+:\d+/,Fp=/^\s*at .*(\S+:\d+|\(native\))/m,DS=/^(eval@)?(\[native code])?$/,Pl={parse(e){return e?e.stacktrace!==void 0||e["opera#sourceloc"]!==void 0?this.parseOpera(e):e.stack&&e.stack.match(Fp)?this.parseV8OrIE(e):e.stack?this.parseFFOrSafari(e):[]:[]},extractLocation(e){if(e.indexOf(":")===-1)return[e];let t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));if(!t)throw new Error(`Cannot parse given url: ${e}`);return[t[1],t[2]||void 0,t[3]||void 0]},parseV8OrIE(e){return e.stack.split(` 101`).filter(function(t){return!!t.match(Fp)},this).map(function(t){t.indexOf("(eval ")>-1&&(t=t.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));let i=t.replace(/^\s+/,"").replace(/\(eval code/g,"("),s=i.match(/ (\((.+):(\d+):(\d+)\)$)/);i=s?i.replace(s[0],""):i;let n=i.split(/\s+/).slice(1),r=this.extractLocation(s?s[1]:n.pop());return new ks({functionName:n.join(" ")||void 0,fileName:["eval","<anonymous>"].indexOf(r[0])>-1?void 0:r[0],lineNumber:r[1],columnNumber:r[2]})},this)},parseFFOrSafari(e){return e.stack.split(` 102`).filter(function(t){return!t.match(DS)},this).map(function(t){if(t.indexOf(" > eval")>-1&&(t=t.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),t.indexOf("@")===-1&&t.indexOf(":")===-1)return new ks({functionName:t});{let i=/((.*".+"[^@]*)?[^@]*)(?:@)/,s=t.match(i),n=s&&s[1]?s[1]:void 0,r=this.extractLocation(t.replace(i,""));return new ks({functionName:n,fileName:r[0],lineNumber:r[1],columnNumber:r[2]})}},this)},parseOpera(e){return!e.stacktrace||e.message.indexOf(` 103`)>-1&&e.message.split(` 104`).length>e.stacktrace.split(` 105`).length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9(e){let t=/Line (\d+).*script (?:in )?(\S+)/i,i=e.message.split(` 106`),s=[];for(let n=2,r=i.length;r>n;n+=2){let o=t.exec(i[n]);o&&s.push(new ks({fileName:o[2],lineNumber:parseFloat(o[1])}))}return s},parseOpera10(e){let t=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,i=e.stacktrace.split(` 107`),s=[];for(let n=0,r=i.length;r>n;n+=2){let o=t.exec(i[n]);o&&s.push(new ks({functionName:o[3]||void 0,fileName:o[2],lineNumber:parseFloat(o[1])}))}return s},parseOpera11(e){return e.stack.split(` 108`).filter(function(t){return!!t.match($S)&&!t.match(/^Error created at/)},this).map(function(t){let i=t.split("@"),s=this.extractLocation(i.pop());return new ks({functionName:(i.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0,fileName:s[0],lineNumber:s[1],columnNumber:s[2]})},this)}};function NS(e){if(!e||!e.outerHTML)return"";let t="";for(;e.parentElement;){let i=e.localName;if(!i)break;i=i.toLowerCase();let s=e.parentElement,n=[];if(s.children&&s.children.length>0)for(let r=0;
108s.children.length>r;r++){let o=s.children[r];o.localName&&o.localName.toLowerCase&&o.localName.toLowerCase()===i&&n.push(o)}n.length>1&&(i+=`:eq(${n.indexOf(e)})`),t=i+(t?">"+t:""),e=s}return t}function gm(e){return Array.isArray(e)}function Yc(e){return typeof e=="object"&&e!==null&&!gm(e)}function fm(e,t){if(t===0)return!0;let i=Object.keys(e);for(let s of i)if(Yc(e[s])&&fm(e[s],t-1))return!0;return!1}function Cs(e,t){let i={numOfKeysLimit:50,depthOfLimit:4};Object.assign(i,t);let s=[],n=[];return JSON.stringify(e,function(r,o){if(s.length>0){let l=s.indexOf(this);~l?s.splice(l+1):s.push(this),~l?n.splice(l,1/0,r):n.push(r),~s.indexOf(o)&&(o=s[0]===o?"[Circular ~]":"[Circular ~."+n.slice(0,s.indexOf(o)).join(".")+"]")}else s.push(o);if(o===null)return o;if(o===void 0)return"undefined";if(Yc(a=o)&&Object.keys(a).length>i.numOfKeysLimit||typeof a=="function"||Yc(a)&&fm(a,i.depthOfLimit))return(function(l){let c=l.toString();return i.stringLengthLimit&&c.length>i.stringLengthLimit&&(c=`${c.slice(0,i.stringLengthLimit)}...`),c})(o);var a;if(typeof o=="bigint")return o.toString()+"n";if(o instanceof Event){let l={};for(let c in o){let d=o[c];l[c]=gm(d)?NS(d.length?d[0]:null):d}return l}return o instanceof Node?o instanceof HTMLElement?o?o.outerHTML:"":o.nodeName:o instanceof Error?o.stack?o.stack+` 109End of stack for Error object`:o.name+": "+o.message:o})}var Ap={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 BS(e,t,i){let s=i?Object.assign({},Ap,i):Ap,n=s.logger;if(!n)return()=>{};let r;r=typeof n=="string"?t[n]:n;let o=0,a=!1,l=!0,c=[];if(s.level.includes("error")){let h=p=>{let _=p.message;e({level:"error",trace:Pl.parse(p.error).map(g=>g.toString()),payload:[Cs(_,s.stringifyOptions)]})};t.addEventListener("error",h),c.push(()=>{t.removeEventListener("error",h)});let u=p=>{let _,g;p.reason instanceof Error?(_=p.reason,g=[Cs(`Uncaught (in promise) ${_.name}: ${_.message}`,s.stringifyOptions)]):(_=new Error,g=[Cs("Uncaught (in promise)",s.stringifyOptions),Cs(p.reason,s.stringifyOptions)]),e({level:"error",trace:Pl.parse(_).map(v=>v.toString()),payload:g})};t.addEventListener("unhandledrejection",u),c.push(()=>{t.removeEventListener("unhandledrejection",u)})}for(let h of s.level)c.push(d(r,h));return()=>{l=!1,c.forEach(h=>h())};function d(h,u){return h[u]?(function(p,_){try{if(!(_ in p))return()=>{};let g=p[_],v={next:g},f=(m=>(...y)=>{if(m.apply(h,y),l&&!(u==="assert"&&y[0]||a)){a=!0;try{let w=Pl.parse(new Error).map(x=>x.toString()).splice(1),S=(u==="assert"?y.slice(1):y).map(x=>Cs(x,s.stringifyOptions));o++,s.lengthThreshold>o?e({level:u,trace:w,payload:S}):o===s.lengthThreshold&&e({level:"warn",trace:[],payload:[Cs("The number of log records reached the threshold.")]})}catch(w){m.apply(h,["rrweb logger error:",w,...y])}finally{a=!1}
109}})(function(...m){return v.next.apply(this,m)});return typeof f=="function"&&(f.prototype=f.prototype||{},Object.defineProperties(f,{__rrweb_original__:{enumerable:!1,value:g},__rrweb_layer__:{enumerable:!1,value:v}})),p[_]=f,()=>{if(p[_]===f)return void(p[_]=v.next);let m=S=>{var x;return typeof S=="function"?(x=S.__rrweb_layer__)!==null&&x!==void 0?x:S.__posthog_layer__:void 0},y=p[_],w=m(y);for(;w;){if(w.next===f)return void(w.next=v.next);y=w.next,w=m(y)}}}catch{return()=>{}}})(h,u):()=>{}}}var Lp=e=>({name:"rrweb/console@1",observer:BS,options:e}),Op=()=>{},$p=e=>{var t;if(_e(e))return(t=e.__posthog_layer__)!==null&&t!==void 0?t:e.__rrweb_layer__};function ai(e,t,i){try{if(!(t in e))return Op;let s={next:e[t]},n=i(function(...r){return s.next.apply(this,r)});return _e(n)&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:s}})),e[t]=n,()=>{if(e[t]===n)return void(e[t]=s.next);let r=e[t],o=$p(r);for(;o;){if(o.next===n)return void(o.next=s.next);r=o.next,o=$p(r)}}}catch{return Op}}function _d(e,t){var i;let s=(function(r){try{return typeof r=="string"?new URL(r).hostname:"url"in r?new URL(r.url).hostname:r.hostname}catch{return null}})(e),n={hostname:s,isHostDenied:!1};if(!(!((i=t.payloadHostDenyList)===null||i===void 0)&&i.length)||!s?.trim().length)return n;for(let r of t.payloadHostDenyList)if(s.endsWith(r))return{hostname:s,isHostDenied:!0};return n}var Mi=Ie("[Recorder]"),vm=e=>e.entryType==="navigation",gd=e=>e.entryType==="resource",qS=()=>{};function Dp(e,t){var i;return vm(t)&&((i=e.document)===null||i===void 0?void 0:i.readyState)==="complete"&&t.loadEventEnd>0}function HS(e,t){return t.recordInitialRequests?e.performance.getEntries().filter(i=>Dp(e,i)||gd(i)&&t.initiatorTypes.includes(i.initiatorType)):t.performanceEntryTypeToObserve.includes("navigation")?(function(i){var s;return((s=i.document)===null||s===void 0?void 0:s.readyState)!=="complete"?[]:i.performance.getEntriesByType("navigation").filter(n=>Dp(i,n))})(e):[]}function po(e,t){return!!t&&(Ae(t)||t[e])}function mm(e){if(typeof Request>"u")return!1;if(e instanceof Request)return!0;try{return{}.toString.call(e)==="[object Request]"}catch{return!1}}var US=["image/","video/","audio/","font/","application/octet-stream","application/pdf","application/zip","application/wasm"];function _o({type:e,recordBody:t,headers:i,url:s}){function n(o){let a=Object.keys(i).find(c=>c.toLowerCase()==="content-type"),l=a&&i[a];return o.some(c=>l?.toLowerCase().includes(c))}if(!t||(function o(a){try{return typeof a=="string"?a.startsWith("blob:"):a instanceof URL?a.protocol==="blob:":!!mm(a)&&o(a.url)}catch{return!1}})(s)||n(US))return!1;if(Ae(t))return!0;if(W(t))return n(t);let r=t[e];return Ae(r)?r:n(r)}function Zc(e,t,i,s,n){return Xc.apply(this,arguments)}function Xc(){return Xc=Ce(function*(e,t,i,s,n,r=0){return r>10?(Mi.warn("Failed to get performance entry for request",{url:i,initiatorType:t}),null):(function(a,l){for(let c=a.length-1;c>=0;c-=1)if(l(a[c]))return a[c]})(e.performance.getEntriesByName(i),a=>gd(a)&&a.initiatorType===t&&(M(s)||a.startTime>=s)&&(M(n)||n>=a.startTime))||(yield new Promise(a=>setTimeout(a,50*r)),Zc(e,t,i,s,n,r+1))}),Xc.apply(this,arguments)}function Np({body:e,options:t,url:i}){if(Y(e))return null;let{hostname:s,isHostDenied:n}=_d(i,t);if(n)return s+" is in deny list";if(oe(e))return e;if((r=>"u">typeof Document&&r instanceof Document)(e))return e.textContent;if(jg(e))return Kf(e);if(ee(e))try{return JSON.stringify(e)}catch{return"[SessionReplay] Failed to stringify response object"}return"[SessionReplay] Cannot read body of type "+toString.call(e)}var WS=e=>!ue(e)&&(e.entryType==="navigation"||e.entryType==="resource");function go(e,{entry:t,method:i,status:s,networkRequest:n,isInitial:r,start:o,end:a,url:l,initiatorType:c}){o=t?t.startTime:o,a=t?t.responseEnd:a;let d=Math.floor(Date.now()-e.performance.now()),h=Math.floor(d+(o||0)),u=[b(b({},t?JSON.parse(JSON.stringify(t.toJSON())):{name:l}),{},{startTime:M(o)?void 0:Math.round(o),endTime:M(a)?void 0:Math.round(a),timeOrigin:d,timestamp:h,method:i,initiatorType:c||(t?t.initiatorType:void 0),status:s,requestHeaders:n.requestHeaders,requestBody:n.requestBody,responseHeaders:n.responseHeaders,responseBody:n.responseBody,isInitial:r})];if(WS(t))for(let p of t.serverTiming||[])u.push({timeOrigin:d,timestamp:h,startTime:Math.round(t.startTime),name:p.name,duration:p.duration,entryType:"serverTiming"});return u}var zS=["video/","audio/"];function ym(e){return ee(e)&&_e(e.getReader)&&_e(e.tee)}
109var Bp="[SessionReplay] Timeout while trying to read body",zn="[SessionReplay] Failed to read body";function Rl(e){return`${zn}: ${e}`}function qp(e){return`[SessionReplay] Body too large to record (> ${e} bytes)`}function bm(e,t){if(!t.streamNetworkBody)return(function(s){return new Promise(n=>{let r=setTimeout(()=>n(Bp),500);try{s.clone().text().then(o=>n(o),o=>n(Rl(o))).finally(()=>clearTimeout(r))}catch{clearTimeout(r),n(zn)}})})(e);let i=rv(t);return(function(s,n){try{var r,o;let a=(r=s.headers)===null||r===void 0||(o=r.get)===null||o===void 0?void 0:o.call(r,"content-length");if(!a)return!1;let l=parseInt(a,10);return Number.isFinite(l)&&l>n}catch{return!1}})(e,i)?Promise.resolve(qp(i)):(function(s,n){return new Promise(r=>{let o,a=!1;function l(){try{o?.cancel().catch(()=>{})}catch{}}function c(g){a||(a=!0,clearTimeout(d),l(),r(g))}let d=setTimeout(()=>c(Bp),500),h;try{h=s.clone()}catch{return void c(zn)}let u=h.body;if(!ym(u)||typeof TextDecoder>"u"){try{h.text().then(g=>c(g),g=>c(Rl(g)))}catch{c(zn)}return}try{o=u.getReader()}catch{return void c(zn)}let p=[],_=0;(function g(){o.read().then(({done:v,value:f})=>{if(a)l();else if(v)c(new TextDecoder().decode((function(m,y){let w=new Uint8Array(y),S=0;for(let x of m)w.set(x,S),S+=x.byteLength;return w})(p,_)));else{if(f){if(_+f.byteLength>n)return void c(qp(n));_+=f.byteLength,p.push(f)}g()}},v=>c(Rl(v)))})()})})(e,i)}function eu(){return eu=Ce(function*({r:e,options:t,url:i}){let{hostname:s,isHostDenied:n}=_d(i,t);return n?Promise.resolve(s+" is in deny list"):bm(e,t)}),eu.apply(this,arguments)}function tu(){return tu=Ce(function*({r:e,options:t,url:i}){let s=(function({r:n,options:r,url:o}){var a;if(n.headers.get("Transfer-Encoding")==="chunked")return"Chunked Transfer-Encoding is not supported";let l=(a=n.headers.get("Content-Type"))===null||a===void 0?void 0:a.toLowerCase(),c=zS.some(u=>l?.startsWith(u));if(l&&c)return`Content-Type ${l} is not supported`;
109let{hostname:d,isHostDenied:h}=_d(o,r);return h?d+" is in deny list":null})({r:e,options:t,url:i});return ue(s)?bm(e,t):Promise.resolve(s)}),tu.apply(this,arguments)}var fo=null;function jS(e,t,i){if(!("performance"in t))return()=>{};if(fo)return Mi.warn("Network observer already initialised, doing nothing"),()=>{};let s=i?Object.assign({},Bs,i):Bs,n=!0,r=!1,o=h=>{if(!n)return;let u=[],p=!1;h.requests.forEach(_=>{let g=_.entryType==="serverTiming";if(g&&p)return;let v;try{v=s.maskRequestFn(_)}catch{return r||(r=!0,Mi.warn("Network capture masking callback failed; dropping the record. Further masking failures will not be logged for this observer.")),void(g||(p=!0))}g||(p=!v||(f=>!!f&&ov.has(f))(v)),v&&u.push(v)}),u.length>0&&e(b(b({},h),{},{requests:u}))},a=(function(h,u,p){try{h({requests:HS(u,p).flatMap(m=>go(u,{entry:m,method:void 0,status:void 0,networkRequest:{},isInitial:!0})),isInitial:!0})}catch(m){Mi.error("Failed to capture initial performance entries for network capture",m)}let _=u.PerformanceObserver,g=_?.supportedEntryTypes;if(!_||!W(g))return;let v=g.filter(m=>p.performanceEntryTypeToObserve.includes(m));if(!v.length)return;let f=new _(m=>{h({requests:m.getEntries().filter(y=>vm(y)||gd(y)&&p.initiatorTypes.includes(y.initiatorType)&&(w=>!p.recordBody&&!p.recordHeaders||w.initiatorType!=="xmlhttprequest"&&w.initiatorType!=="fetch")(y)).flatMap(y=>go(u,{entry:y,method:void 0,status:void 0,networkRequest:{}}))})});return f.observe({entryTypes:v}),()=>{f.disconnect()}})(o,t,s),l=s.recordHeaders||s.recordBody;if(!a&&!l)return n=!1,qS;let c=()=>{},d=()=>{};return l&&(c=(function(h,u,p){if(!p.initiatorTypes.includes("xmlhttprequest"))return()=>{};let _=po("request",p.recordHeaders),g=po("response",p.recordHeaders),v=ai(u.XMLHttpRequest.prototype,"open",f=>function(m,y,w=!0,S,x){let k=this;try{let C=new Request(y),E={},I,P,O={},L=k.setRequestHeader.bind(k);k.setRequestHeader=(K,U)=>(O[K]=U,L(K,U)),_&&(E.requestHeaders=O);let A=k.send.bind(k);k.send=K=>(_o({type:"request",headers:O,url:y,recordBody:p.recordBody})&&(E.requestBody=Np({body:K,options:p,url:y})),I=u.performance.now(),A(K));let B=()=>{k.removeEventListener("readystatechange",q),k.removeEventListener("error",B),k.removeEventListener("abort",B),k.removeEventListener("timeout",B)},q=()=>{if(k.readyState!==k.DONE)return;B(),P=u.performance.now();let K={};k.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(U=>{let ce=U.split(": "),j=ce.shift(),N=ce.join(": ");j&&(K[j]=N)}),g&&(E.responseHeaders=K),_o({type:"response",headers:K,url:y,recordBody:p.recordBody})&&(E.responseBody=Np({body:k.response,options:p,url:y})),Zc(u,"xmlhttprequest",C.url,I,P).then(U=>{h({requests:go(u,{entry:U,method:m,status:k?.status,networkRequest:E,start:I,end:P,url:y.toString(),initiatorType:"xmlhttprequest"})})}).catch(()=>{})};k.addEventListener("readystatechange",q),k.addEventListener("error",B),k.addEventListener("abort",B),k.addEventListener("timeout",B)}catch(C){Mi.error("Failed to instrument XHR for network capture",C)}f.call(k,m,y.toString(),w,S,x)});return()=>{v()}})(o,t,s),d=(function(h,u,p){if(!p.initiatorTypes.includes("fetch"))return()=>{};let _=po("request",p.recordHeaders),g=po("response",p.recordHeaders),v=ai(u,"fetch",f=>(function(){var m=Ce(function*(y,w){let S,x;try{S=new Request(y,w)}catch(I){return Mi.error("Failed to instrument fetch for network capture",I),f(y,w)}let k={},C,E;try{try{let I={};S.headers.forEach((P,O)=>{I[O]=P}),_&&(k.requestHeaders=I),!ym(w?.body)&&_o({type:"request",headers:I,url:y,recordBody:p.recordBody})&&(k.requestBody=yield(function(P){return eu.apply(this,arguments)})({r:S,options:p,url:y}))}catch(I){Mi.error("Failed to record fetch request for network capture",I)}C=u.performance.now(),x=mm(y)?yield f(S):yield f(y,w),E=u.performance.now();try{let I={};x.headers.forEach((P,O)=>{I[O]=P}),g&&(k.responseHeaders=I),_o({type:"response",headers:I,url:y,recordBody:p.recordBody})&&(k.responseBody=yield(function(P){return tu.apply(this,arguments)})({r:x,options:p,url:y}))}catch(I){Mi.error("Failed to record fetch response for network capture",I)}return x}finally{Zc(u,"fetch",S.url,C,E).then(I=>{h({requests:go(u,{entry:I,method:S.method,status:x?.status,networkRequest:k,start:C,end:E,url:S.url,initiatorType:"fetch"})})}).catch(()=>{})}});return function(y,w){return m.apply(this,arguments)}})());return()=>
vendor: 5,992 bytes, line 109
109{v()}})(o,t,s)),fo=()=>{n=!1,a?.(),c(),d(),fo=null},fo}var Hp=e=>({name:"rrweb/network@1",observer:jS,options:e}),Dr,$e,Sm,Ri,Up,wm,km,Fl,Ho,_r,Cm,fd,iu,su,Em;R.__PosthogExtensions__=R.__PosthogExtensions__||{},R.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:Lp,getRecordNetworkPlugin:Hp},R.__PosthogExtensions__.rrweb={record:es,version:"v2",wasMaxDepthReached:()=>Qc,resetMaxDepthState(){Qc=!1,Gc=!1},getLastSnapshotCost:()=>va,getMutationCost:()=>b({},ya),getObserverInitFailures:()=>Jc.size?Array.from(Jc):void 0,resetSnapshotCostState(){ri=0,cd=0,ud=0,_s=0,Et={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},va=null,Ys=null,Tr=[],Ir=0,ma=0,ya={slowestBatchMs:0},as={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0}}},R.rrweb={record:es,version:"v2"},R.rrwebConsoleRecord={getRecordConsolePlugin:Lp},R.getRecordNetworkPlugin=Hp,R.__PosthogExtensions__=R.__PosthogExtensions__||{},R.__PosthogExtensions__.initSessionRecording=(e,t)=>new sS(e,t);var an,Ke,Al,Wp,Ia={},Ma=[],VS=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Pa=Array.isArray;function ti(e,t){for(var i in t)e[i]=t[i];return e}function nu(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Oi(e,t,i){var s,n,r,o={};for(r in t)r=="key"?s=t[r]:r=="ref"?n=t[r]:o[r]=t[r];if(arguments.length>2&&(o.children=arguments.length>3?Dr.call(arguments,2):i),typeof e=="function"&&e.defaultProps!=null)for(r in e.defaultProps)o[r]===void 0&&(o[r]=e.defaultProps[r]);return gr(e,o,s,n,null)}function gr(e,t,i,s,n){var r={type:e,props:t,key:i,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:n??++Sm,__i:-1,__u:0};return n==null&&$e.vnode!=null&&$e.vnode(r),r}function ki(e){return e.children}function Uo(e,t){this.props=e,this.context=t}function ln(e,t){if(t==null)return e.__?ln(e.__,e.__i+1):null;for(var i;e.__k.length>t;t++)if((i=e.__k[t])!=null&&i.__e!=null)return i.__e;return typeof e.type=="function"?ln(e):null}function GS(e){if(e.__P&&e.__d){var t=e.__v,i=t.__e,s=[],n=[],r=ti({},t);r.__v=t.__v+1,$e.vnode&&$e.vnode(r),vd(e.__P,r,t,e.__n,e.__P.namespaceURI,32&t.__u?[i]:null,s,i??ln(t),!!(32&t.__u),n),r.__v=t.__v,r.__.__k[r.__i]=r,Im(s,r,n),t.__e=t.__=null,r.__e!=i&&xm(r)}}function xm(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),xm(e)}function ru(e){(!e.__d&&(e.__d=!0)&&Ri.push(e)&&!Ra.__r++||Up!=$e.debounceRendering)&&((Up=$e.debounceRendering)||wm)(Ra)}function Ra(){try{for(var e,t=1;Ri.length;)Ri.length>t&&Ri.sort(km),e=Ri.shift(),t=Ri.length,GS(e)}finally{Ri.length=Ra.__r=0}}function zp(e,t,i,s,n,r,o,a,l,c,d){var h,u,p,_,g,v,f,m=s&&s.__k||Ma,y=t.length;for(l=(function(w,S,x,k,C){var E,I,P,O,L,A=x.length,B=A,q=0;for(w.__k=new Array(C),E=0;C>E;E++)(I=S[E])!=null&&typeof I!="boolean"&&typeof I!="function"?(typeof I=="string"||typeof I=="number"||typeof I=="bigint"||I.constructor==String?I=w.__k[E]=gr(null,I,null,null,null):Pa(I)?I=w.__k[E]=gr(ki,{children:I},null,null,null):I.constructor===void 0&&I.__b>0?I=w.__k[E]=gr(I.type,I.props,I.key,I.ref?I.ref:null,I.__v):w.__k[E]=I,O=E+q,I.__=w,I.__b=w.__b+1,P=null,(L=I.__i=QS(I,x,O,B))!=-1&&(B--,(P=x[L])&&(P.__u|=2)),P==null||P.__v==null?(L==-1&&(C>A?q--:A>C&&q++),typeof I.type!="function"&&(I.__u|=4)):L!=O&&(L==O-1?q--:L==O+1?q++:(L>O?q--:q++,I.__u|=4))):w.__k[E]=null;if(B)for(E=0;A>E;E++)(P=x[E])!=null&&!(2&P.__u)&&(P.__e==k&&(k=ln(P)),Pm(P,P));return k})(i,t,m,l,y),h=0;y>h;h++)(p=i.__k[h])!=null&&(u=p.__i!=-1&&m[p.__i]||Ia,p.__i=h,v=vd(e,p,u,n,r,o,a,l,c,d),_=p.__e,p.ref&&u.ref!=p.ref&&(u.ref&&md(u.ref,null,p),d.push(p.ref,p.__c||_,p)),g==null&&_!=null&&(g=_),(f=!!(4&p.__u))||u.__k===p.__k?(l=Tm(p,l,e,f),f&&u.__e&&(u.__e=null)):typeof p.type=="function"&&v!==void 0?l=v:_&&(l=_.nextSibling),p.__u&=-7);return i.__e=g,l}function Tm(e,t,i,s){var n,r;if(typeof e.type=="function"){for(n=e.__k,r=0;n&&n.length>r;r++)n[r]&&(n[r].__=e,t=Tm(n[r],t,i,s));return t}e.__e!=t&&(s&&(t&&e.type&&!t.parentNode&&(t=ln(e)),i.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function QS(e,t,i,s){var n,r,o,a=e.key,l=e.type,c=t[i],d=c!=null&&!(2&c.__u);if(c===null&&a==null||d&&a==c.key&&l==c.type)return i;if(s>(d?1:0)){for(n=i-1,r=i+1;n>=0||t.length>r;)if((c=t[o=0>n?r++:n--])!=null&&!(2&c.__u)&&a==c.key&&l==c.type)return o}return-1}function jp(e,t,i){t[0]=="-"?e.setProperty(t,i??""):e[t]=i==null?"":typeof i!="number"||VS.test(t)?i:i+"px"}function vo(e,t,i,s,n){var r,o;e:if(t=="style")if(typeof i=="string")e.style.cssText=i;else{if(typeof s=="string"&&(e.style.cssText=s=""),s)for(t in s)i&&t in i||jp(e.style,t,"");if(i)for(t in i)s&&i[t]==s[t]||jp(e.style,t,i[t])}else if(t[0]=="o"&&t[1]=="n")r=t!=(t=t.replace(Cm,"$1")),o=t.toLowerCase(),t=o in e||t=="onFocusOut"||t=="onFocusIn"?o.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+r]=i,i?s?i[_r]=s[_r]:(i[_r]=fd,e.addEventListener(t,r?su:iu,r)):e.removeEventListener(t,r?su:iu,r);else{if(n=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=i??"";break e}catch{}typeof i=="function"||(i==null||i===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&i==1?"":i))}}function Vp(e){return function(t){if(this.l){var i=this.l[t.type+e];if(t[Ho]==null)t[Ho]=fd++;else if(i[_r]>t[Ho])return;return i($e.event?$e.event(t):t)}}}function vd(e,t,i,s,n,r,o,a,l,c){var d,h,u,p,_,g,v,f,m,y,w,S,x,k,C,E,I=t.type;if(t.constructor!==void 0)return null;128&i.__u&&(l=!!(32&i.__u),r=[a=t.__e=i.__e]),(d=$e.__b)&&d(t);e:if(typeof I=="function"){h=o.length;try{if(m=t.props,y=I.prototype&&I.prototype.render,w=(d=I.contextType)&&s[d.__c],S=d?w?w.props.value:d.__:s,i.__c?f=(u=t.__c=i.__c).__=u.__E:(y?t.__c=u=new I(m,S):(t.__c=u=new
vendor: 5,476 bytes, line 109
109Uo(m,S),u.constructor=I,u.render=KS),w&&w.sub(u),u.state||(u.state={}),u.__n=s,p=u.__d=!0,u.__h=[],u._sb=[]),y&&u.__s==null&&(u.__s=u.state),y&&I.getDerivedStateFromProps!=null&&(u.__s==u.state&&(u.__s=ti({},u.__s)),ti(u.__s,I.getDerivedStateFromProps(m,u.__s))),_=u.props,g=u.state,u.__v=t,p)y&&I.getDerivedStateFromProps==null&&u.componentWillMount!=null&&u.componentWillMount(),y&&u.componentDidMount!=null&&u.__h.push(u.componentDidMount);else{if(y&&I.getDerivedStateFromProps==null&&m!==_&&u.componentWillReceiveProps!=null&&u.componentWillReceiveProps(m,S),t.__v==i.__v||!u.__e&&u.shouldComponentUpdate!=null&&u.shouldComponentUpdate(m,u.__s,S)===!1){t.__v!=i.__v&&(u.props=m,u.state=u.__s,u.__d=!1),t.__e=i.__e,t.__k=i.__k,t.__k.some(function(P){P&&(P.__=t)}),Ma.push.apply(u.__h,u._sb),u._sb=[],u.__h.length&&o.push(u);break e}u.componentWillUpdate!=null&&u.componentWillUpdate(m,u.__s,S),y&&u.componentDidUpdate!=null&&u.__h.push(function(){u.componentDidUpdate(_,g,v)})}if(u.context=S,u.props=m,u.__P=e,u.__e=!1,x=$e.__r,k=0,y)u.state=u.__s,u.__d=!1,x&&x(t),d=u.render(u.props,u.state,u.context),Ma.push.apply(u.__h,u._sb),u._sb=[];else do u.__d=!1,x&&x(t),d=u.render(u.props,u.state,u.context),u.state=u.__s;while(u.__d&&25>++k);u.state=u.__s,u.getChildContext!=null&&(s=ti(ti({},s),u.getChildContext())),y&&!p&&u.getSnapshotBeforeUpdate!=null&&(v=u.getSnapshotBeforeUpdate(_,g)),C=d!=null&&d.type===ki&&d.key==null?Mm(d.props.children):d,a=zp(e,Pa(C)?C:[C],t,i,s,n,r,o,a,l,c),u.base=t.__e,t.__u&=-161,u.__h.length&&o.push(u),f&&(u.__E=u.__=null)}catch(P){if(o.length=h,t.__v=null,l||r!=null)if(P.then){for(t.__u|=l?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;r!=null&&(r[r.indexOf(a)]=null),t.__e=a}else{if(r!=null)for(E=r.length;E--;)nu(r[E]);ou(t)}else t.__e=i.__e,!t.__k&&i.__k&&(t.__k=i.__k),P.then||ou(t);$e.__e(P,t,i)}}else r==null&&t.__v==i.__v?(t.__k=i.__k,t.__e=i.__e):a=t.__e=(function(P,O,L,A,B,q,K,U,ce){var j,N,V,Q,z,ae,be,Ee=L.props||Ia,pe=O.props,ve=O.type;if(ve=="svg"?B="http://www.w3.org/2000/svg":ve=="math"?B="http://www.w3.org/1998/Math/MathML":B||(B="http://www.w3.org/1999/xhtml"),q!=null){for(j=0;q.length>j;j++)if((z=q[j])&&"setAttribute"in z==!!ve&&(ve?z.localName==ve:z.nodeType==3)){P=z,q[j]=null;break}}if(P==null){if(ve==null)return document.createTextNode(pe);P=document.createElementNS(B,ve,pe.is&&pe),U&&($e.__m&&$e.__m(O,q),U=!1),q=null}if(ve==null)Ee===pe||U&&P.data==pe||(P.data=pe);else{if(q=ve=="textarea"&&pe.defaultValue!=null?null:q&&Dr.call(P.childNodes),!U&&q!=null)for(Ee={},j=0;P.attributes.length>j;j++)Ee[(z=P.attributes[j]).name]=z.value;for(j in Ee)z=Ee[j],j=="dangerouslySetInnerHTML"?V=z:j=="children"||j in pe||j=="value"&&"defaultValue"in pe||j=="checked"&&"defaultChecked"in pe||vo(P,j,null,z,B);for(j in pe)z=pe[j],j=="children"?Q=z:j=="dangerouslySetInnerHTML"?N=z:j=="value"?ae=z:j=="checked"?be=z:U&&typeof z!="function"||Ee[j]===z||vo(P,j,z,Ee[j],B);if(N)U||V&&(N.__html==V.__html||N.__html==P.innerHTML)||(P.innerHTML=N.__html),O.__k=[];else if(V&&(P.innerHTML=""),zp(O.type=="template"?P.content:P,Pa(Q)?Q:[Q],O,L,A,ve=="foreignObject"?"http://www.w3.org/1999/xhtml":B,q,K,q?q[0]:L.__k&&ln(L,0),U,ce),q!=null)for(j=q.length;j--;)nu(q[j]);U&&ve!="textarea"||(j="value",ve=="progress"&&ae==null?P.removeAttribute("value"):ae!=null&&(ae!==P[j]||ve=="progress"&&!ae||ve=="option"&&ae!=Ee[j])&&vo(P,j,ae,Ee[j],B),j="checked",be!=null&&be!=P[j]&&vo(P,j,be,Ee[j],B))}return P})(i.__e,t,i,s,n,r,o,l,c);return(d=$e.diffed)&&d(t),128&t.__u?void 0:a}function ou(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(ou))}function Im(e,t,i){for(var s=0;i.length>s;s++)md(i[s],i[++s],i[++s]);$e.__c&&$e.__c(t,e),e.some(function(n){try{e=n.__h,n.__h=[],e.some(function(r){r.call(n)})}catch(r){$e.__e(r,n.__v)}})}function Mm(e){return typeof e!="object"||e==null||e.__b>0?e:Pa(e)?e.map(Mm):e.constructor!==void 0?null:ti({},e)}function md(e,t,i){try{if(typeof e=="function"){var s=typeof e.__u=="function";s&&e.__u(),s&&t==null||(e.__u=e(t))}else e.current=t}catch(n){$e.__e(n,i)}}function Pm(e,t,i){var s,n;if($e.unmount&&$e.unmount(e),(s=e.ref)&&(s.current&&s.current!=e.__e||md(s,null,t)),(s=e.__c)!=null){if(s.componentWillUnmount)try{s.componentWillUnmount()}catch(r){$e.__e(r,t)}s.base=s.__P=s.__n=null}if(s=e.__k)for(n=0;s.length>n;n++)s[n]&&Pm(s[n],t,i||typeof e.type!="function");i||nu(e.__e),e.__c=e.__=e.__e=void 0}function KS(e,t,i){return this.constructor(e,i)}function xi(e,t,i){var s,n,r,o;t==document&&(t=document.documentElement),$e.__&&$e.__(e,t),n=(s=typeof i=="function")?null:i&&i.__k||t.__k,r=[],o=[],vd(t,e=(!s&&i||t).__k=Oi(ki,null,[e]),n||Ia,Ia,t.namespaceURI,!s&&i?[i]:n?null:t.firstChild?Dr.call(t.childNodes):null,r,!s&&i?i:n?n.__e:t.firstChild,s,o),Im(r,e,o),e.props.children=null}Dr=Ma.slice,$e={__e(e,t,i,s){for(var n,r,o;t=t.__;)if((n=t.__c)&&!n.__)try{if((r=n.constructor)&&r.getDerivedStateFromError!=null&&(n.setState(r.getDerivedStateFromError(e)),o=n.__d),n.componentDidCatch!=null&&(n.componentDidCatch(e,s||{}),o=n.__d),o)return n.__E=n}catch(a){e=a}throw e}},Sm=0,Uo.prototype.setState=function(e,t){var i=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=ti({},this.state);typeof e=="function"&&(e=e(ti({},i),this.props)),e&&ti(i,e),e!=null&&this.__v&&(t&&this._sb.push(t),ru(this))},Uo.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),ru(this))},Uo.prototype.render=ki,Ri=[],wm=typeof Promise=="function"?Promise.prototype.then.bind(Prom
vendor: 4,596 bytes, line 109
109ise.resolve()):setTimeout,km=function(e,t){return e.__v.__b-t.__v.__b},Ra.__r=0,Fl=Math.random().toString(8),Ho="__d"+Fl,_r="__a"+Fl,Cm=/(PointerCapture)$|Capture$/i,fd=0,iu=Vp(!1),su=Vp(!0),Em=0;var Fa=0,Rm=[],tt=$e,Gp=tt.__b,Qp=tt.__r,Kp=tt.diffed,Jp=tt.__c,Yp=tt.unmount,Zp=tt.__;function Ua(e,t){tt.__h&&tt.__h(Ke,e,Fa||t),Fa=0;var i=Ke.__H||(Ke.__H={__:[],__h:[]});return e>=i.__.length&&i.__.push({}),i.__[e]}function wt(e){return Fa=1,(function(t,i){var s=Ua(an++,2);if(s.t=t,!s.__c&&(s.__=[t_(void 0,i),function(a){var l=s.__N?s.__N[0]:s.__[0],c=s.t(l,a);l!==c&&(s.__N=[c,s.__[1]],s.__c.setState({}))}],s.__c=Ke,!Ke.__f)){var n=function(a,l,c){if(!s.__c.__H)return!0;var d=!1,h=s.__c.props!==a;if(s.__c.__H.__.some(function(p){if(p.__N){d=!0;var _=p.__[0];p.__=p.__N,p.__N=void 0,_!==p.__[0]&&(h=!0)}}),r){var u=r.call(this,a,l,c);return d?u||h:u}return!d||h};Ke.__f=!0;var r=Ke.shouldComponentUpdate,o=Ke.componentWillUpdate;Ke.componentWillUpdate=function(a,l,c){if(this.__e){var d=r;r=void 0,n(a,l,c),r=d}o&&o.call(this,a,l,c)},Ke.shouldComponentUpdate=n}return s.__N||s.__})(t_,e)}function _n(e,t){var i=Ua(an++,3);!tt.__s&&Am(i.__H,t)&&(i.__=e,i.u=t,Ke.__H.__h.push(i))}function Mr(e){return Fa=5,yi(function(){return{current:e}},[])}function yi(e,t){var i=Ua(an++,7);return Am(i.__H,t)&&(i.__=e(),i.__H=t,i.__h=e),i.__}function gn(e){var t=Ke.context[e.__c],i=Ua(an++,9);return i.c=e,t?(i.__==null&&(i.__=!0,t.sub(Ke)),t.props.value):e.__}function Xp(){for(var e;e=Rm.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(au),t.__h.some(Fm),t.__h=[]}catch(i){t.__h=[],tt.__e(i,e.__v)}}}tt.__b=function(e){Ke=null,Gp&&Gp(e)},tt.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Zp&&Zp(e,t)},tt.__r=function(e){Qp&&Qp(e),an=0;var t=(Ke=e.__c).__H;t&&(Al===Ke?(t.__h=[],Ke.__h=[],t.__.some(function(i){i.__N&&(i.__=i.__N),i.u=i.__N=void 0})):(t.__h.length&&Xp(),an=0)),Al=Ke},tt.diffed=function(e){Kp&&Kp(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Rm.push(t)!==1&&Wp===tt.requestAnimationFrame||((Wp=tt.requestAnimationFrame)||JS)(Xp)),t.__H.__.some(function(i){i.u&&(i.__H=i.u,i.u=void 0)})),Al=Ke=null},tt.__c=function(e,t){t.some(function(i){try{i.__h.some(au),i.__h=i.__h.filter(function(s){return!s.__||Fm(s)})}catch(s){t.some(function(n){n.__h&&(n.__h=[])}),t=[],tt.__e(s,i.__v)}}),Jp&&Jp(e,t)},tt.unmount=function(e){Yp&&Yp(e);var t,i=e.__c;i&&i.__H&&(i.__H.__.some(function(s){try{au(s)}catch(n){t=n}}),i.__H=void 0,t&&tt.__e(t,i.__v))};var e_=typeof requestAnimationFrame=="function";function JS(e){var t,i=function(){clearTimeout(s),e_&&cancelAnimationFrame(t),setTimeout(e)},s=setTimeout(i,35);e_&&(t=requestAnimationFrame(i))}function au(e){var t=Ke,i=e.__c;typeof i=="function"&&(e.__c=void 0,i()),Ke=t}function Fm(e){var t=Ke;e.__c=e.__(),Ke=t}function Am(e,t){return!e||e.length!==t.length||t.some(function(i,s){return i!==e[s]})}function t_(e,t){return typeof t=="function"?t(e):t}var Ft={GZipJS:"gzip-js",Base64:"base64"},Ln={Activation:"events",Cancellation:"cancelEvents"},cs={Button:"button",Tab:"tab",Selector:"selector"},bt={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"},jn={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},Nt={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},xt={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},Vt={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},lu={Once:"once",Recurring:"recurring",Always:"always"},gt={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},ft={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"},cu={Popover:"popover",Inline:"inline"};function mo(e){let t=!0;return{dispose(){if(t){t=!1;let i=e();i&&_e(i.then)&&i.then(void 0,()=>{})}}}}var J=Ie("[Surveys]"),Lm="PostHog is not capturing, so a survey response cannot be recorded";function _i(e){return _e(e.is_capturing)?e.is_capturing():!e.has_opted_out_capturing()}
109function Om(e){return!(!e.start_date||e.end_date)}function $m(e){var t;return!!(!((t=e.conditions)===null||t===void 0||(t=t.actions)===null||t===void 0||(t=t.values)===null||t===void 0)&&t.length)}var yd=(e,t)=>`${e}${(function(i){return i.current_iteration&&i.current_iteration>0?`${i.id}_${i.current_iteration}`:i.id})(t)}`,Dm=e=>yd("seenSurvey_",e),Wa=e=>{try{let t=Dm(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(t){J.error("Failed to persist survey seen state",t)}},Nm=[Nt.Popover,Nt.Widget,Nt.API],YS={ignoreConditions:!1,ignoreDelay:!1,displayType:cu.Popover},Bm="logs",ZS=Ie("[Stylesheet Loader]"),qm=T,Ws=F,Wo="#020617",Hi={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:bt.Right,widgetType:cs.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:Wo,scrollbarThumbColor:"var(--ph-survey-border-color)",scrollbarTrackColor:"var(--ph-survey-background-color)"},XS=[bt.Center,bt.Left,bt.Right];function i_(e){if(e.startsWith("#")){let t=e.replace(/^#/,"");return/^[0-9A-Fa-f]{3}$/.test(t)&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),/^[0-9A-Fa-f]{6}$/.test(t)?`rgb(${parseInt(t.slice(0,2),16)},${parseInt(t.slice(2,4),16)},${parseInt(t.slice(4,6),16)})`:"rgb(255, 255, 255)"}return"rgb(255, 255, 255)"}function On(e=Hi.backgroundColor){let t;e[0]==="#"&&(t=i_(e)),e.startsWith("rgb")&&(t=e);let 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",s
109almon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"}[e.toLowerCase()];if(i&&(t=i_(i)),!t)return Wo;let s=t.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/);if(s){let n=parseInt(s[1]),r=parseInt(s[2]),o=parseInt(s[3]);return Math.sqrt(n*n*.299+r*r*.587+o*o*.114)>127.5?Wo:"white"}return Wo}var yo=(e,t,i)=>{let s=du(e),n=Ws.querySelector(`.${s}`);if(n&&n.shadowRoot)return{shadow:n.shadowRoot,isNewlyCreated:!1};let r=Ws.createElement("div");((l,c,d)=>{let h=b(b({},Hi),d),u=l.style,p=!XS.includes(h.position)||c===Nt.Widget&&d?.widgetType===cs.Tab;u.setProperty("--ph-survey-font-family",(function(f){if(f==="inherit")return"inherit";let m='BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"';return f?`${f}, ${m}`:`-apple-system, ${m}`})(h.fontFamily)),u.setProperty("--ph-survey-box-padding",h.boxPadding),u.setProperty("--ph-survey-max-width",h.maxWidth),u.setProperty("--ph-survey-z-index",h.zIndex),u.setProperty("--ph-survey-border-color",h.borderColor),p?(u.setProperty("--ph-survey-border-radius",h.borderRadius),u.setProperty("--ph-survey-border-bottom","1.5px solid var(--ph-survey-border-color)")):(u.setProperty("--ph-survey-border-bottom","none"),u.setProperty("--ph-survey-border-radius",`${h.borderRadius} ${h.borderRadius} 0 0`)),u.setProperty("--ph-survey-background-color",h.backgroundColor),u.setProperty("--ph-survey-box-shadow",h.boxShadow),u.setProperty("--ph-survey-disabled-button-opacity",h.disabledButtonOpacity),u.setProperty("--ph-survey-submit-button-color",h.submitButtonColor),u.setProperty("--ph-survey-submit-button-text-color",d?.submitButtonTextColor||On(h.submitButtonColor)),u.setProperty("--ph-survey-rating-bg-color",h.ratingButtonColor),u.setProperty("--ph-survey-rating-active-bg-color",h.ratingButtonActiveColor),u.setProperty("--ph-survey-rating-active-text-color",On(h.ratingButtonActiveColor)),u.setProperty("--ph-survey-text-primary-color",d?.textColor||On(h.backgroundColor)),u.setProperty("--ph-survey-text-subtle-color",h.textSubtleColor),u.setProperty("--ph-widget-color",h.widgetColor),u.setProperty("--ph-widget-text-color",On(h.widgetColor)),u.setProperty("--ph-widget-z-index",h.zIndex);let _=d?.inputBackground||d?.inputBackgroundColor,g=_||h.inputBackground;_||h.backgroundColor!=="white"||(g="#f8f8f8"),u.setProperty("--ph-survey-input-background",g);let v=d?.inputTextColor||On(g);u.setProperty("--ph-survey-input-text-color",v),u.setProperty("--ph-survey-rating-text-color",v),u.setProperty("--ph-survey-scrollbar-thumb-color",h.scrollbarThumbColor),u.setProperty("--ph-survey-scrollbar-track-color",h.scrollbarTrackColor),u.setProperty("--ph-survey-outline-color",h.outlineColor)})(r,e.type,e.appearance),r.className=s;let o=r.attachShadow({mode:"open"}),a=(function(l){let c=((d,h,u)=>{let p=d.createElement("style");p.innerText=h;let _=(g=>{var v;return _e(g)?g:g==null||(v=g.config)===null||v===void 0?void 0:v.prepare_external_dependency_stylesheet})(u);return _&&(p=_(p)),p||(ZS.error("prepare_external_dependency_stylesheet returned null"),null)})(Ws
vendor: 13,370 bytes, line 109
109,':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)}}',
109l);return c?.setAttribute("data-ph-survey-style","true"),c})(t);if(a){let l=o.querySelector("style");l&&o.removeChild(l),o.appendChild(a)}return(i||Ws.body).appendChild(r),{shadow:o,isNewlyCreated:!0}},Hm=({responses:e,survey:t,surveySubmissionId:i,posthog:s,isSurveyCompleted:n,properties:r,surveyLanguage:o,questionSnapshots:a})=>{var l;s?_i(s)&&(Wa(t),n&&Cd(t),s.capture(gt.SENT,b(b(b({[ft.SURVEY_NAME]:t.name,[ft.SURVEY_ID]:t.id,[ft.SURVEY_ITERATION]:t.current_iteration,[ft.SURVEY_ITERATION_START_DATE]:t.current_iteration_start_date,sessionRecordingUrl:(l=s.get_session_replay_url)===null||l===void 0?void 0:l.call(s)},wv({event:"sent",survey:t,responses:e,submissionId:i,completed:n,surveyLanguage:o,questionSnapshots:a})),r),{},{$set:{[nd(t,"responded")]:!0}})),n&&(qm.dispatchEvent(new CustomEvent("PHSurveySent",{detail:{surveyId:t.id}})),s.reloadFeatureFlags())):J.error("[survey sent] event not captured, PostHog instance not found.")},Um=(e,t,i,s)=>{var n;return b({[ft.SURVEY_NAME]:t.name,[ft.SURVEY_ID]:t.id,[ft.SURVEY_ITERATION]:t.current_iteration,[ft.SURVEY_ITERATION_START_DATE]:t.current_iteration_start_date,sessionRecordingUrl:(n=s.get_session_replay_url)===null||n===void 0?void 0:n.call(s)},wv({event:e,survey:t,responses:i?.responses,submissionId:i?.surveySubmissionId,surveyLanguage:i?.surveyLanguage,questionSnapshots:i?.questionSnapshots}))},s_=(e,t,i,s)=>{if(!t)return void J.error("[survey dismissed] event not captured, PostHog instance not found.");if(i)return;let n=ps(e),r=n?n.surveyLanguage:s,o=b(b(b({},Um("dismissed",e,n,t)),r&&{[ft.SURVEY_LANGUAGE]:r}),{},{$set:{[nd(e,"dismissed")]:!0}});Cd(e),Wa(e),t.capture(gt.DISMISSED,o),qm.dispatchEvent(new CustomEvent("PHSurveyClosed",{detail:{surveyId:e.id}}))},ew=(e,t)=>{if(!t)return void J.error("[survey abandoned] event not captured, PostHog instance not found.");let i=(n=>yd("abandonedSurvey_",n))(e);try{if(localStorage.getItem(i)==="true")return}catch{return}let s=ps(e);if(s){try{localStorage.setItem(i,"true")}catch{}t.capture(gt.ABANDONED,Um("abandoned",e,s,t),{transport:"sendBeacon"})}},zo=e=>{let t=e.map(i=>i.id);return t.every(i=>!!i)?t:void 0},n_=(e,t)=>{return(r=>r.questions.some(o=>{var a;return!!(!((a=o.branching)===null||a===void 0)&&a.type)}))(e)?e.questions:t?(i=((r,o)=>{if(!o||o.length!==r.questions.length)return null;let a=new Map(r.questions.map(c=>[c.id,c])),l=[];for(let c of o){let d=a.get(c);if(!d)return null;l.push(d)}return l})(e,t.questionOrder))!==null&&i!==void 0?i:e.questions:e.appearance&&e.appearance.shuffleQuestions&&!e.enable_partial_responses?(s=e.questions,n=Ev(e.questions),s.length===n.length&&s.every((r,o)=>r===n[o])?n.reverse():n):e.questions;var i,s,n},r_=e=>kv(e)||jo(e),gs=(function(e){function t(i){var s,n;return this.getChildContext||(s=new Set,(n={})[t.__c]=this,this.getChildContext=function(){return n},this.componentWillUnmount=function(){s=null},this.shouldComponentUpdate=function(r){this.props.value!=r.value&&s.forEach(function(o){o.__e=!0,ru(o)})},this.sub=function(r){s.add(r);var o=r.componentWillUnmount;r.componentWillUnmount=function(){s&&s.delete(r),o&&o.call(r)}}),i.children}return t.__c="__cC"+Em++,t.__=e,t.Provider=t.__l=(t.Consumer=function(i,s){return i.children(s)}).contextType=t,t})({isPreviewMode:!1,previewPageIndex:0,onPopupSurveyDismissed(){},isPopup:!0,onPreviewSubmit(){},onPreviewBack(){},surveySubmissionId:"",properties:void 0,surveyLanguage:null}),bd=()=>gn(gs),Sd=({component:e,children:t,renderAsHtml:i,style:s})=>(function(n,r,o){var a,l,c,d,h=ti({},n.props);for(c in n.type&&n.type.defaultProps&&(d=n.type.defaultProps),r)c=="key"?a=r[c]:c=="ref"?l=r[c]:h[c]=r[c]===void 0&&d!=null?d[c]:r[c];return arguments.length>2&&(h.children=arguments.length>3?Dr.call(arguments,2):o),gr(n.type,h,a||n.key,l||n.ref,null)})(e,i?{dangerouslySetInnerHTML:{__html:t},style:s}:{children:t,style:s});function wd(e,t){var i,s;if(!(!((i=e.conditions)===null||i===void 0)&&i.url))return!0;let n=Xn(t);if(!n)return!1;let r=[e.conditions.url],o=(function(a){return a??"icontains"})((s=e.conditions)===null||s===void 0?void 0:s.urlMatchType);return $r[o](r,[n])}var kd=e=>yd("inProgressSurvey_",e),cn={},uu=(e,t)=>
109{let i=kd(e);try{localStorage.setItem(i,JSON.stringify(t)),delete cn[i]}catch(s){J.error("Error setting in-progress survey state in localStorage",s),cn[i]=t}},ps=e=>{let t=kd(e),i=cn[t];if(i)return i;try{let s=localStorage.getItem(t);if(s)return JSON.parse(s)}catch(s){J.error("Error getting in-progress survey state from localStorage",s)}return null},jo=e=>{let t=ps(e);return!Y(t?.surveySubmissionId)},Cd=e=>{let t=kd(e);delete cn[t];try{localStorage.removeItem(t)}catch(i){J.error("Error clearing in-progress survey state from localStorage",i
109)}};function du(e,t=!1){let i=`PostHogSurvey-${e.id}`;return t?`.${i}`:i}function tw(e,t=bt.Right,i){if(e===Nt.ExternalSurvey)return{};switch(t){case bt.TopLeft:return{top:"0",left:"0",transform:"translate(30px, 30px)"};case bt.TopRight:return{top:"0",right:"0",transform:"translate(-30px, 30px)"};case bt.TopCenter:return{top:"0",left:"50%",transform:"translate(-50%, 30px)"};case bt.MiddleLeft:return{top:"50%",left:"0",transform:"translate(30px, -50%)"};case bt.MiddleRight:return{top:"50%",right:"0",transform:"translate(-30px, -50%)"};case bt.MiddleCenter:return{top:"50%",left:"50%",transform:"translate(-50%, -50%)"};case bt.Left:return{left:"30px"};case bt.Center:return{left:"50%",transform:"translateX(-50%)"};default:return{right:e===Nt.Widget&&i===cs.Tab?"60px":"30px"}}}var iw=0;function H(e,t,i,s,n,r){t||(t={});var o,a,l=t;if("ref"in l)for(a in l={},t)a=="ref"?o=t[a]:l[a]=t[a];var c={type:e,props:l,key:i,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--iw,__i:-1,__u:0,__source:n,__self:r};if(typeof e=="function"&&(o=e.defaultProps))for(a in o)l[a]===void 0&&(l[a]=o[a]);return $e.vnode&&$e.vnode(c),c}var o_=H("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:H("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"})}),a_=H("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:H("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"})}),l_=H("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:H("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"})}),sw=H("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:H("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
109-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"})}),nw=H("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:H("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"})}),rw=H("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:H("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"})}),ow=H("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:H("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"})}),aw=({fill:e="currentColor"}={})=>H("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:e,xmlns:"http://www.w3.org/2000/svg","aria-labelledby":"close-survey-title-adam",children:[H("title",{id:"close-survey-title",className:"adam-testing",children:"Close survey"}),H("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M0.164752 0.164752C0.384422 -0.0549175 0.740578 -0.0549175 0.960248 0.164752L6 5.20451L11.0398 0.164752C11.2594 -0.0549175 11.6156 -0.0549175 11.8352 0.164752C12.0549 0.384422 12.0549 0.740578 11.8352 0.960248L6.79549 6L11.8352 11.0398C12.0549 11.2594 12.0549 11.6156 11.8352 11.8352C11.6156 12.0549 11.2594 12.0549 11.0398 11.8352L6 6.79549L0.960248 11.8352C0.740578 12.0549 0.384422 12.0549 0.164752 11.8352C-0.0549175 11.6156 -0.0549175 11.2594 0.164752 11.0398L5.20451 6L0.164752 0.960248C-0.0549175 0.740578 -0.0549175 0.384422 0.164752 0.164752Z",fill:e})]}),lw=H("svg",{width:"80",height:"14",viewBox:"0 0 160 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[H("g",{"clip-path":"url(#ph-survey-logo-clip)",children:[H("path",{fill:"currentColor",d:"m50 23.34-.35-.05A4.5 4.5 0 0 1 47 21.97L35.56 10.1c-.3-.33-.86-.1-.86.35V27.5c0 .27.22.5.5.5h13.78c1.48 0 2.67-1.2 2.67-2.67v-.1a1.9 1.9 0 0 0-1.67-1.89zm-10.81.2a1.8 1.8 0 1 1 0-3.58 1.8 1.8 0 0 1 0 3.58"}),H("path",{fill:"#0054ff",d:"M.87 19.13a.5.5 0 0 0-.87.34v5.94a2.6 2.6 0 0 0 2.59 2.58H7.8a.5.5 0 0 0 .37-.84zM.86 8.4c-.3-.32-.86-.1-.86.36v6.73q0 .2.13.34l8.81 9.68 1.8 2.06v-8.82zM4.59.82A2.67 2.67 0 0 0 0 2.68v1.93q0 .4.27.69l10.47 10.95v-9.1z"}),H("path",{fill:"#ff5506",d:"M11.36 28h7.08a.5.5 0 0 0 .36-.85l-8.05-8.4v8.8l.23.28q.16.17.38.17m-.61-11.76 8.84 9.25 2.1 2.33q.1.11.27.14V18.7L10.75 7.15zm0-13.7v1.41a2 2 0 0 0 .55 1.28L21.96 16.2V7.65L15.32.8a2.67 2.67 0 0 0-4.57 1.71z"}),H("path",{fill:"#ffb70f",d:"M22.06 28h7.76a.5.5 0 0 0 .36-.86l-8.22-8.45v9.27l.09.02zM31 25.49l1.13 1.14c.32.31.85.09.85-.35v-7.3l-.49-.51L21.96 7.64v8.55zM22.52 5.73l9.62 9.89c.3.32.86.1.86-.35V7.46L26.56.82a2.67 2.67 0 0 0-4.59 1.84v1.7c0 .51.2 1 .57 1.37z"})]}),H("path",{fill:"currentColor",d:"M64.9 22.88c-.67 0-1.23-.56-1.23-1.24V5.24c0-.69.56-1.24 1.24-1.24h6.55c3.89 0 6.39 2.32 6.39 5.9 0 3.6-2.5 5.91-6.4 5.91h-3.53v5.83c0 .68-.56 1.24-1.24 1.24zm3.02-11.94c0 .68.55 1.23 1.23 1.23h1.88c1.6 0 2.58-.86 2.58-2.26s-.97-2.27-2.58-2.27h-1.88c-.68 0-1.23.55-1.23 1.23zM84.71 23.1c-4.18 0-7.14-2.97-7.14-7.02s2.96-7.01 7.14-7.01c4.14 0 7.14 2.97 7.14 7.01 0 4.05-3 7.01-7.14 7.01m-3.22-7.02c0 2.16 1.3 3.64 3.22 3.64 1.9 0 3.2-1.48 3.2-3.64s-1.3-3.64-3.2-3.64c-1.93 0-3.22 1.48-3.22 3.64m16.34 7.03a6.2 6.2 0 0 1-5.54-3.01c-.34-.57-.01-1.26.6-1.5l.77-.3c.7-.27 1.45.15 1.92.73a2.8 2.8 0 0 0 2.25 1.08c1.05 0 1.75-.51 1.75-1.27 0-2.13-7.17-.7-7.17-5.85 0-2.13 1.85-3.91 4.83-3.91 2.27 0 4.2.9 5.17 2.31.36.53.05 1.2-.54 1.44l-.85.35c-.68.29-1.45-.14-2-.63a2.5 2.5 0 0 0-1.64-.64c-.89 0-1.5.38-1.5.97 0 2.16 7.27.38 7.27 5.88 0 2.35-2.15 4.34-5.32 4.34m14.64-1.31c.04.57-.3 1.1-.86 1.2q-.6.1-1.27.11c-2.92 0-5.15-1.56-5.15-4.85v-5.66h-.91c-.69 0-1.24-.56-1.24-1.24v-.82c0-.68.55-1.23 1.24-1.23h.91v-2.7c0-.69.55-1.24 1.23-1.24h1.48c.68 0 1.24.55 1.24
1091.23v2.7h2.04c.68 0 1.23.56 1.23 1.24v.82c0 .68-.55 1.24-1.23 1.24h-2.04v5.15c0 1.2.64 1.91 1.6 1.91.75 0 1.6.5 1.66 1.25zM125.5 5.23c0-.68.55-1.23 1.23-1.23h1.8c.68 0 1.23.55 1.23 1.23v16.41c0 .68-.55 1.24-1.23 1.24h-1.8c-.68 0-1.23-.56-1.23-1.24v-5.43c0-.68-.56-1.23-1.24-1.23h-5c-.67 0-1.23.55-1.23 1.23v5.43c0 .68-.55 1.24-1.23 1.24h-1.77c-.69 0-1.24-.56-1.24-1.24V5.24c0-.69.55-1.24 1.24-1.24h1.77c.68 0 1.23.55 1.23 1.23v4.87c0 .68.56 1.23 1.24 1.23h5c.67 0 1.23-.55 1.23-1.23zm12.87 17.87c-4.19 0-7.14-2.97-7.14-7.02s2.95-7.01 7.14-7.01c4.13 0 7.14 2.97 7.14 7.01 0 4.05-3 7.01-7.14 7.01m-3.22-7.02c0 2.16 1.29 3.64 3.22 3.64 1.9 0 3.2-1.48 3.2-3.64s-1.3-3.64-3.2-3.64c-1.93 0-3.22 1.48-3.22 3.64m17.17 6.37c-3.84 0-6.2-2.58-6.2-6.68s2.36-6.69 6.12-6.69c1.58 0 2.82.54 3.54 1.37 0-.64.52-1.15 1.16-1.15h1.5c.68 0 1.24.55 1.24 1.23V21.9c0 3.64-2.77 6.09-6.93 6.09-2.64 0-4.9-1.2-5.85-3.09-.31-.62.16-1.29.85-1.4l1.14-.17c.67-.11 1.29.4 1.78.85.5.46 1.26.7 2.08.7 1.85 0 3.06-1.04 3.06-2.55v-1.3c-.7.9-2.01 1.4-3.49 1.4m-2.36-6.68c0 2.02 1.18 3.31 3 3.31 1.86 0 3.04-1.29 3.04-3.31s-1.18-3.32-3.03-3.32c-1.83 0-3.01 1.3-3.01 3.32"}),H("defs",{children:H("clipPath",{id:"ph-survey-logo-clip",children:H("path",{fill:"#fff",d:"M0 0h51.67v28H0z"})})})]});function cw({urlParams:e}){let t=e?Object.entries(e).map(([i,s])=>`${encodeURIComponent(i)}=${encodeURIComponent(s)}`).join("&"):"";return H("a",{href:"https://posthog.com/surveys"+(t?`?${t}`:""),target:"_blank",rel:"noopener",className:"footer-branding",children:["Survey by ",lw]})}function fn({text:e,submitDisabled:t,appearance:i,onSubmit:s,link:n,onPreviewSubmit:r,skipSubmitButton:o,canGoBack:a,onBack:l}){let{isPreviewMode:c}=gn(gs),d=!!a&&!!l,h=!o&&H("button",{className:"form-submit",disabled:t,"aria-label":"Submit survey",type:"button",onClick(){n&&T?.open(n),c?r?.():s()},children:e});return H("div",{className:"bottom-section",children:[d?H("div",{className:"form-buttons form-buttons-with-back",children:[H("button",{className:"form-back",type:"button","aria-label":"Go to previous question",onClick:l,children:i.backButtonText||"Back"}),h]}
109):h,!i.whiteLabel&&H(cw,{urlParams:{utm_source:"survey-footer"}})]})}function za({question:e,forceDisableHtml:t,htmlFor:i}){return H("div",{class:e.question||e.description?"question-header":"question-header question-header--empty",children:[H(e.type===xt.Open?"label":"h3",{className:"survey-question",htmlFor:i,children:e.question}),e.description&&Sd({component:Oi("p",{className:"survey-question-description"}),children:e.description,renderAsHtml:!t&&e.descriptionContentType!=="text"})]})}function Ed({onClick:e}){let{isPreviewMode:t}=gn(gs);return H("button",{className:"form-cancel",onClick:e,disabled:t,"aria-label":"Close survey",type:"button",children:aw({fill:"black"})})}var c_=T;function uw({header:e,description:t,contentType:i,forceDisableHtml:s,appearance:n,onClose:r}){let{isPopup:o}=gn(gs);return _n(()=>{let a=l=>{l.key!=="Enter"&&l.key!=="Escape"||(l.preventDefault(),r())};return Z(c_,"keydown",a),()=>{c_.removeEventListener("keydown",a)}},[r]),H("div",{className:"thank-you-message",role:"status",tabIndex:0,"aria-atomic":"true",children:[o&&n.hideCancelButton!==!0&&H(Ed,{onClick:()=>r()}),H("h3",{className:"thank-you-message-header",children:e}),t&&Sd({component:Oi("p",{className:"thank-you-message-body"}),children:t,renderAsHtml:!s&&i!=="text"}),o&&H(fn,{text:n.thankYouMessageCloseButtonText||"Close",submitDisabled:!1,appearance:n,onSubmit:()=>r()})]})}function dw({header:e,description:t,contentType:i,forceDisableHtml:s,appearance:n,onStart:r}){let{isPopup:o,onPreviewSubmit:a,onPopupSurveyDismissed:l}=gn(gs);return H("div",{className:"intro-screen",role:"status",tabIndex:0,"aria-atomic":"true",children:[o&&n.hideCancelButton!==!0&&H(Ed,{onClick:()=>l()}),e&&H("h3",{className:"intro-screen-header",children:e}),t&&Sd({component:Oi("p",{className:"intro-screen-body"}),children:t,renderAsHtml:!s&&i!=="text"}),H(fn,{text:n.introScreenButtonText||"Get started",submitDisabled:!1,appearance:n,onSubmit:r,onPreviewSubmit:()=>a(null)})]})}var u_=e=>W(e)&&e.every(t=>oe(t));function hw({question:e,forceDisableHtml:t,appearance:i,onSubmit:s,onPreviewSubmit:n,displayQuestionIndex:r,initialValue:o,canGoBack:a,onBack:l}){let{isPreviewMode:c}=bd(),d=Mr(null),[h,u]=wt(()=>oe(o)?o:""),p=i?.disableAutofocus;_n(()=>{p||setTimeout(()=>{var S;c||(S=d.current)===null||S===void 0||S.focus()},100)},[c,p]);let _=`surveyQuestion${r}`,g=yi(()=>(function(S,x,k){let C=S.trim();if(!k&&C==="")return"This field is required";if(C==="")return!1;if(x&&x.length>0)for(let P of x)switch(P.type){case Gd:var E;if(P.value!==void 0&&P.value>C.length)return(E=P.errorMessage)!==null&&E!==void 0?E:`Please enter at least ${P.value} characters`;break;case Qd:var I;if(P.value!==void 0&&C.length>P.value)return(I=P.errorMessage)!==null&&I!==void 0?I:`Please enter no more than ${P.value} characters`}return!1})(h,e.validation,e.optional),[h,e.validation,e.optional]),v=dh(e.validation,Gd),f=dh(e.validation,Qd),m=yi(()=>(function(S,x){let k=S===1?void 0:S;return k&&x?`Enter ${k}-${x} characters`:k?`Enter at least ${k} ${k===1?"character":"characters"}`:x?`Maximum ${x} ${x===1?"character":"characters"}`:void 0})(v,f),[v,f]),y=()=>{g||s(h.trim())},w=()=>{g||n(h.trim())};return H(ki,{children:[H("div",{className:"question-container",children:[H(za,{question:e,forceDisableHtml:t,htmlFor:_}),H("textarea",{ref:d,id:_,rows:4,placeholder:i?.placeholder,minLength:v,maxLength:f,onInput(S){u(S.currentTarget.value),S.stopPropagation()},onKeyDown(S){S.stopPropagation(),S.key!=="Enter"||!S.metaKey&&!S.ctrlKey||g||(S.preventDefault(),c?w():y())},value:h}),m&&H("div",{className:"validation-hint",children:m})]}),H(fn,{text:e.buttonText||"Submit",submitDisabled:!!g,appearance:i,onSubmit:y,onPreviewSubmit:w,canGoBack:a,onBack:l})]})}function pw({question:e,forceDisableHtml:t,appearance:i,onSubmit:s,onPreviewSubmit:n,canGoBack:r,onBack:o}){return H(ki,{children:[H("div",{className:"question-container",children:H(za,{question:e,forceDisableHtml:t})}),H(fn,{text:e.buttonText||"Submit",submitDisabled:!1,link:e.link,appearance:i,onSubmit:()=>s("link clicked"),onPreviewSubmit:()=>n("link clicked"),canGoBack:r,onBack:o})]})}function _w({question:e,forceDisableHtml:t,displayQuestionIndex:i,appearance:s,onSubmit:n,onPreviewSubmit:r,initialValue:o,canGoBack:a,onBack:l}){var c;let d=e.scale,h=e.scale===10?0:1,[u,p]=wt(()=>ne(o)?o:W(o)&&o.length>0&&ne(parseInt(o[0]))?parseInt(o[0]):oe(o)&&ne(parseInt(o))?parseInt(o):null),_=e.display==="emoji"&&e.scale===2,{isPreviewMode:g}=bd(),v=f=>g?r(f):n(f);return H(ki,{children:[H("div",{className:"question-container",children:[H(za,{question:e,forceDisableHtml:t}),H("div",{className:"rating-section",children:[H("div",{className:"rating-options",children:[e.display==="emoji"&&H("div",{className:"rating-options-emoji"+(_?" rating-options-emoji-2":""),children:(c=bw[e.scale])===null||c===void 0?void 0:c.map((f,m)=>H("button",{"aria-label":`Rate ${m+1}`,className:`ratings-emoji question-${i}-rating-${m} ${m+1===u?"rating-active":""}`,value:m+1,type:"button",onClick(){let y=m+1;p(y),e.skipSubmitButton&&v(y)},children:f},m))}),e.display==="number"&&H("div",{className:"rating-options-number",style:{gridTemplateColumns:`repeat(${d-h+1}, minmax(0, 1fr))`},children:Sw(e.scale).map((f,m)=>H(gw,{displayQuestionIndex:i,active:u===f,appearance:s,num:f,setActiveNumber(y){p(y),e.skipSubmitButton&&v(y)}},m))})]}),!_&&H("div",{className:"rating-text",children:[H("div",{children:e.lowerBoundLabel}),H("div",{children:e.upperBoundLabel})]})]})]}),H(fn,{text:e.buttonText||s?.submitButtonText||"Submit",submitDisabled:ue(u)&&!e.optional,appearance:s,onSubmit:()=>n(u),onPreviewSubmit:()=>r(u),skipSubmitButton:e.skipSubmitButton,canGoBack:a,onBack:l})]})}function gw({num:e,active:t,displayQuestionIndex:i,setActiveNumber:s}){return H("button",{"aria-label":`Rate ${e}`,className:`ratings-number question-${i}-rating-${e} ${t?"rating-active":""}`,type:"button",onClick(){s(e)},children:e})}function fw({question:e,forceDisableHtml:t,displayQuestionIndex:i,appearance:s,onSubmit:n,onPreviewSubmit:r,initialValue:o,canGoBack:a,onBack:l}){let c=Mr(null),d=yi(()=>(C=>{var E;if(!C.shuffleOptions)return C.choices;let I=[...C.choices],P=C.hasOpenChoice&&(E=I.pop())!==null&&E!==void 0?E:null,O=(L=I,(A=Ev(I)).length>1&&L.every((B,q)=>B===A[q])?A.reverse():A);var L,A;return ue(P)||O.push(P),O})(e),[e]),[h,u]=wt(()=>((C,E)=>oe(C)||u_(C)?C:E===xt.SingleChoice?null:[])(o,e.type)),[p,_]=wt(()=>((C,E)=>{if(oe(C)&&!E.includes(C))return{isSelected:!0,inputValue:C};if(u_(C)){let I=C.find(P=>!E.includes(P));
109if(I)return{isSelected:!0,inputValue:I}}return{isSelected:!1,inputValue:""}})(o,d)),{isPreviewMode:g}=bd(),v=e.type===xt.SingleChoice,f=e.type===xt.MultipleChoice,m=e.skipSubmitButton&&v&&!e.hasOpenChoice,y=(C,E)=>{if(E){let I=!p.isSelected;return _(P=>b(b({},P),{},{isSelected:I,inputValue:I?P.inputValue:""})),v&&u(""),void(I&&setTimeout(()=>{var P;return(P=c.current)===null||P===void 0?void 0:P.focus()},75))}if(v)return u(C),_(I=>b(b({},I),{},{isSelected:!1,inputValue:""})),void(m&&(n(C),g&&r(C)));f&&W(h)&&(h.includes(C)?u(h.filter(I=>I!==C)):u([...h,C]))},w=C=>{C.stopPropagation();let E=C.currentTarget.value;_(I=>b(b({},I),{},{inputValue:E})),v&&u(E)},S=C=>{C.stopPropagation(),C.key!=="Enter"||x()||(C.preventDefault(),k()),C.key==="Escape"&&(C.preventDefault(),_(E=>b(b({},E),{},{isSelected:!1,inputValue:""})),v&&u(null))},x=()=>!(e.optional||!ue(h)&&(!W(h)||p.isSelected||h.length!==0)&&(!p.isSelected||p.inputValue.trim()!=="")),k=()=>{p.isSelected&&f?W(h)&&(g?r([...h,p.inputValue]):n([...h,p.inputValue])):g?r(h):n(h)};return H(ki,{children:[H("div",{className:"question-container",children:[H(za,{question:e,forceDisableHtml:t}),H("fieldset",{className:"multiple-choice-options limit-height",children:[H("legend",{className:"sr-only",children:f?" Select all that apply":" Select one"}),d.map((C,E)=>{let I=!!e.hasOpenChoice&&E===e.choices.length-1,P=`surveyQuestion${i}Choice${E}`,O=`${P}Open`,L=I?p.isSelected:v?h===C:W(h)&&h.includes(C);return H("label",{className:I?"choice-option-open":"",children:[H("div",{className:"response-choice",children:[H("input",{type:v?"radio":"checkbox",name:P,checked:L,onChange:()=>y(C,I),id:P,"aria-controls":O}),H("span",{children:I?`${C}:`:C})]}),I&&H("input",{type:"text",ref:c,id:O,name:`question${i}Open`,value:p.inputValue,onKeyDown:S,onInput:w,onClick(A){p.isSelected||y(C,!0),A.stopPropagation()},"aria-label":`${C} - please specify`})]},E)})]})]}),H(fn,{text:e.buttonText||"Submit",submitDisabled:x(),appearance:s,onSubmit:k,onPreviewSubmit:k,skipSubmitButton:m,canGoBack:a,onBack:l})]})}var vw=[1,2,3,4,5],mw=[1,2,3,4,5,6,7],yw=[0,1,2,3,4,5,6,7,8,9,10],bw={2:[rw,ow],3:[l_,a_,o_],5:[sw,l_,a_,o_,nw]};function Sw(e){switch(e){case 5:default:return vw;case 7:return mw;case 10:return yw}}var ww=Ie("[Surveys]");function Wm(e,t,i){var s;let n=e.questions[t],r=t+1;if(!(!((s=n.branching)===null||s===void 0)&&s.type))return t===e.questions.length-1?Vt.End:r;if(n.branching.type===Vt.End)return Vt.End;if(n.branching.type===Vt.SpecificQuestion){if(Number.isInteger(n.branching.index))return n.branching.index}else if(n.branching.type===Vt.ResponseBased){if(n.type===xt.SingleChoice){var o;let l=n.choices.indexOf(`${i}`);if(l===-1&&n.hasOpenChoice&&(l=n.choices.length-1),(o=n.branching)===null||o===void 0||(o=o.responseValues)===null||o===void 0?void 0:o.hasOwnProperty(l)){let c=n.branching.responseValues[l];return Number.isInteger(c)?c:c===Vt.End?Vt.End:r}}else if(n.type===xt.Rating){var a;if(typeof i!="number"||!Number.isInteger(i))throw new Error("The response type must be an integer");let l=(function(c,d){if(d===2){if(1>c||c>2)throw new Error("The response must be in range 1-2");return c===1?"positive":"negative"}if(d===3){if(1>c||c>3)throw new Error("The response must be in range 1-3");return c===1?"negative":c===2?"neutral":"positive"}if(d===5){if(1>c||c>5)throw new Error("The response must be in range 1-5");return c>2?c===3?"neutral":"positive":"negative"}if(d===7){if(1>c||c>7)throw new Error("The response must be in range 1-7");return c>3?c===4?"neutral":"positive":"negative"}if(d===10){if(0>c||c>10)throw new Error("The response must be in range 0-10");return c>6?c>8?"promoters":"passives":"detractors"}throw new Error("The scale must be one of: 2, 3, 5, 7, 10")})(i,n.scale);if(!((a=n.branching)===null||a===void 0||(a=a.responseValues)===null||a===void 0)&&a.hasOwnProperty(l)){let c=n.branching.responseValues[l];return Number.isInteger(c)?c:c===Vt.End?Vt.End:r}}return r}return ww.warn("Falling back to next question index due to unexpected branching type"),r}var Ll=Ie("[SurveyTranslations]");function kw(e,t){let i=(function(n){return(function({overrideLanguage:r,storedPersonProperties:o,locale:a},l){let c=yl(r);if(c)return l?.info(`Using override display language: ${c}`),c;let d=(function(u){return u&&typeof u=="object"&&"language"in u?yl(u.language):null})(o);if(d)return l?.info(`Using person property language: ${d}`),d;let h=yl(a);return h?(l?.info(`Using detected locale: ${h}`),h):(l?.info("No user language detected"),null)})({overrideLanguage:n.config.override_display_language,storedPersonProperties:_e(n.get_property)?n.get_property(Qt):void 0,locale:od()},Ll)})(t);if(!i)return Ll.info("No user language detected"),{survey:e,language:null};let s=qb(e,i,Ll);return{survey:s.survey,language:s.matchedKey}}var We=T,$i=F,hu="ph:show_survey_widget",Ol="PHWidgetSurveyClickListener";function d_(e,t){try{let i=e.getBoundingClientRect(),s=We.innerHe
109ight,n=We.innerWidth,r=i.left+i.width/2-t/2;r+t>n-20&&(r=n-t-20),20>r&&(r=20);let o=s-i.bottom,a=250>o&&i.top>o;return{position:"fixed",top:a?"auto":`${i.bottom+12}px`,left:`${r}px`,right:"auto",bottom:a?s-i.top+12+"px":"auto",zIndex:Hi.zIndex}}catch(i){return J.warn("Failed to calculate trigger position:",i),null}}var Cw=class{constructor(e){this._surveyTimeouts=new Map,this._widgetSelectorListeners=new Map,this._renderedTabWidgets=new Map,this._renderedTargets=new Map,this._prefillHandledSurveys=new Set,this._currentLanguage=null,this._surveyIsRendered=!1,this._languageChangeListener=null,this._unsubscribeFeatureFlags=null,this._surveyPopupProps=null,this._loggedFeatureFlagsDisabledWarning=!1,this.handlePageUnload=()=>{let t=this._posthog.get_property(ss);if(t)for(let i of t)jo(i)&&ew(i,this._posthog)},this.handlePopoverSurvey=(t,i,{resumeDelayFromActivation:s=!1}={})=>{var n,r,o,a,l,c;if(!_i(this._posthog))return;let{survey:d,language:h}=this._translateSurveyForRendering(t);this._currentLanguage=h,this._surveyPopupProps=null,this._displayOptions=i;let u=this._applyDisplayOverrides(d,i);this._clearSurveyTimeout(u.id);let{properties:p,initialResponses:_}=i??{},g=!(!_||0>=Object.keys(_).length)&&this._handleInitialResponses(u,_,p,h);if(g&&!(!((n=u.appearance)===null||n===void 0)&&n.displayThankYouMessage))return;this._addSurveyToFocus(u);let v={};if(((r=u.appearance)===null||r===void 0?void 0:r.position)===bt.NextToTrigger&&(!((o=u.appearance)===null||o===void 0)&&o.widgetSelector)){let P=$i.querySelector(u.appearance.widgetSelector);var f;P&&(v=d_(P,parseInt(((f=u.appearance)===null||f===void 0?void 0:f.maxWidth)||Hi.maxWidth))||{})}let m=((a=u.appearance)===null||a===void 0?void 0:a.surveyPopupDelaySeconds)||0,{shadow:y}=yo(u,this._posthog);this._renderedTargets.set(y,y.host);let w={posthog:this._posthog,survey:u,removeSurveyFromFocus:this._removeSurveyFromFocus,properties:p,style:v,isSurveyCompleted:g,skipShownEvent:i?.skipShownEvent,surveyLanguage:h};if(this._surveyPopupProps=w,0>=m)return this._surveyIsRendered=!0,xi(H(Ls,b({},w)),y);let S=()=>{this._surveyIsRendered=!0;let{survey:P,language:O}=this._translateSurveyForRendering(t);this._currentLanguage=O;let L=this._applyDisplayOverrides(P,i),A=b(b({},w),{},{survey:L,surveyLanguage:O});this._surveyPopupProps=A,xi(H(Ls,b(b({},A),{},{survey:b(b({},L),{},{appearance:b(b({},L.appearance),{},{surveyPopupDelaySeconds:0})})})),y)},x=()=>{if(!_i(this._posthog)||!this._shouldDisplaySurvey(u))return J.info(`Survey ${u.id} no longer eligible when its display delay elapsed; not displaying`),this._removeSurveyFromFocus(u);S()},k=s?(l=this._posthog.surveys)===null||l===void 0||(l=l._surveyEventReceiver)===null||l===void 0||(c=l.getActivationTimestamp)===null||c===void 0?void 0:c.call(l,u.id):void 0,C=ne(k)?Math.max(0,Date.now()-k):0,E=Math.max(0,1e3*m-C);if(0>=E)return x();let I=We.setTimeout(()=>{this._surveyTimeouts.delete(u.id),x()},E);this._surveyTimeouts.set(u.id,I)},this._handleWidget=t=>{var i;let{survey:s,language:n}=this._translateSurveyForRendering(t),{shadow:r,isNewlyCreated:o}=yo(s,this._posthog);this._renderedTargets.set(r,r.host),((i=t.appearance)===null||i===void 0?void 0:i.widgetType)===cs.Tab&&this._renderedTabWidgets.set(t.id,t),o&&xi(H(Iw,{posthog:this._posthog,survey:s,surveyLanguage:n},t.id),r)},this._detachWidgetSelectorListener=t=>{let i=this._widgetSelectorListeners.get(t);i&&(i.element.removeEventListener("click",i.listener),i.element.removeAttribute(Ol),this._widgetSelectorListeners.delete(t),J.info(`Removed click listener for survey ${t}`))},this._removeWidgetSelectorListener=t=>{this._isWidgetSurveyOpen(t)||(this._removeSurveyFromDom(t),this._detachWidgetSelectorListener(t.id))},this._removeTabWidget=t=>{this._isWidgetSurveyOpen(t)||(this._removeSurveyFromDom(t),this._renderedTabWidgets.delete(t.id))},this._isWidgetSurveyOpen=t=>{try{var i;let s=$i.querySelector(du(t,!0));return!!(!(s==null||(i=s.shadowRoot)===null||i===void 0)&&i.querySelector(".ph-survey"))}catch{return!1}},this._manageWidgetSelectorListener=(t,i)=>{let s=$i.querySelector(i),n=this._widgetSelectorListeners.get(t.id);
109if(s){if(this._handleWidget(t),n){if(s===n.element)return;J.info(`Selector element changed for survey ${t.id}. Re-attaching listener.`),this._detachWidgetSelectorListener(t.id)}if(!s.hasAttribute(Ol)){let r=o=>{var a,l;o.stopPropagation();let c=((a=t.appearance)===null||a===void 0?void 0:a.position)===bt.NextToTrigger?d_(o.currentTarget,parseInt(((l=t.appearance)===null||l===void 0?void 0:l.maxWidth)||Hi.maxWidth)):{};We.dispatchEvent(new CustomEvent(hu,{detail:{surveyId:t.id,position:c}}))};Z(s,"click",r),s.setAttribute(Ol,"true"),this._widgetSelectorListeners.set(t.id,{element:s,listener:r,survey:t}),J.info(`Attached click listener for feedback button survey ${t.id}`)}}else n&&this._removeWidgetSelectorListener(t)},this.renderPopover=t=>{if(!_i(this._posthog))return;let{survey:i,language:s}=this._translateSurveyForRendering(t),{shadow:n}=yo(i,this._posthog);this._renderedTargets.set(n,n.host),xi(H(Ls,{posthog:this._posthog,survey:i,removeSurveyFromFocus:this._removeSurveyFromFocus,surveyLanguage:s}),n)},this.renderSurvey=(t,i,s)=>{var n;if(!_i(this._posthog))return;let{survey:r,language:o}=this._translateSurveyForRendering(t),a=!1;!((n=this._posthog.config)===null||n===void 0||(n=n.surveys)===null||n===void 0)&&n.prefillFromUrl&&(a=this._handleUrlPrefill(r,o,s)),xi(H(Ls,{posthog:this._posthog,survey:r,removeSurveyFromFocus:this._removeSurveyFromFocus,isPopup:!1,properties:s,isSurveyCompleted:a,surveyLanguage:o}),i)},this.getActiveMatchingSurveys=(t,i=!1)=>{var s;(s=this._posthog)===null||s===void 0||(s=s.surveys)===null||s===void 0||s.getSurveys(n=>{t(n.filter(r=>this._shouldDisplaySurvey(r)))},i)},this.callSurveysAndEvaluateDisplayLogic=(t=!1)=>{this.getActiveMatchingSurveys(i=>{let s=_i(this._posthog),n=i.filter(c=>s&&(c.type===Nt.Popover||c.type===Nt.Widget)),r=new Set(n.map(c=>c.id));for(let c of Array.from(this._surveyTimeouts.keys()))r.has(c)||this.cancelSurvey(c);let o=this._sortSurveysByAppearanceDelay(n),a=new Set,l=new Set;o.forEach(c=>{if(c.type===Nt.Widget){var d,h,u,p;if(((d=c.appearance)===null||d===void 0?void 0:d.widgetType)===cs.Tab)return l.add(c.id),void this._handleWidget(c);((h=c.appearance)===null||h===void 0?void 0:h.widgetType)===cs.Selector&&(!((u=c.appearance)===null||u===void 0)&&u.widgetSelector)&&(a.add(c.id),this._manageWidgetSelectorListener(c,(p=c.appearance)===null||p===void 0?void 0:p.widgetSelector))}ue(this._surveyInFocus)&&c.type===Nt.Popover&&this.handlePopoverSurvey(c,void 0,{resumeDelayFromActivation:!0})}),this._widgetSelectorListeners.forEach(({survey:c})=>{a.has(c.id)||this._removeWidgetSelectorListener(c)}),this._renderedTabWidgets.forEach((c,d)=>{l.has(d)||this._removeTabWidget(c)})},t)},this._addSurveyToFocus=t=>{ue(this._surveyInFocus)||J.error(`Survey ${this._surveyInFocus} already in focus. Cannot add survey ${t.id}.`),this._surveyInFocus=t.id},this._removeSurveyFromFocus=t=>{this._surveyInFocus!==t.id&&J.error(`Survey ${t.id} is not in focus. Cannot remove survey ${t.id}.`),this._clearSurveyTimeout(t.id),this._surveyInFocus=null,this._currentLanguage=null,this._surveyIsRendered=!1,this._surveyPopupProps=null,this._displayOptions=void 0,this._removeSurveyFromDom(t)},this._posthog=e,this._surveyInFocus=null,this._languageChangeListener=()=>this._onLanguageChange(),Z(We,"languagechange",this._languageChangeListener),this._unsubscribeFeatureFlags=e.onFeatureFlags(()=>this._onLanguageChange())}_onLanguageChange(){if(ue(this._surveyInFocus))return;let e=this._posthog.get_property(ss),t=e?.find(o=>o.id===this._surveyInFocus);if(!t)return;let{survey:i,language:s}=this._translateSurveyForRendering(t);if(s===this._currentLanguage||(this._currentLanguage=s,!this._surveyIsRendered))return;let n=this._applyDisplayOverrides(i,this._displayOptions),{shadow:r}=yo(n,this._posthog);xi(H(Ls,b(b({},this._surveyPopupProps),{},{posthog:this._posthog,survey:n,removeSurveyFromFocus:this._removeSurveyFromFocus,surveyLanguage:s})),r)}get _featureFlags(){var e,t,i;return(e=(t=(i=this._posthog).getExtension)===null||t===void 0?void 0:t.call(i,"featureFlags"))!==null&&e!==void 0?e:this._posthog.featureFlags}_applyDisplayOverrides(e,t){return t?.position||t?.selector?b(b({},e),{},{appearance:b(b(b({},e.appearance),t.position&&{position:t.position}),t.selector&&{widgetSelector:t.selector})}):e}_clearSurveyTimeout(e){let t=this._surveyTimeouts.get(e);t&&(clearTimeout(t),this._surveyTimeouts.delete(e))}cancelSurvey(e){this._surveyTimeouts.has(e)&&(J.info(`Cancelled pending survey ${e}`),this._clearSurveyTimeout(e),this._surveyInFocus===e&&(this._surveyInFocus=null,this._currentLanguage=null,this._surveyIsRendered=!1,this._surveyPopupProps=null,this._displayOptions=void 0))}clearInMemoryInProgressSurveyState(){(()=>{for(let e of Object.keys(cn))delete cn[e]})()}setAutomaticDisplayDispose(e){this._automaticDisplayDispose=e}dispose(){var e;(e=this._automaticDisplayDispose)===null||e===void 0||e.call(this),this._automaticDisplayDispose=void 0,this._languageChangeListener&&(We.removeEventListener("languagechange",this._languageChangeListener),this._languageChangeListener=null),this._unsubscribeFeatureFlags&&(this._unsubscribeFeatureFlags(),this._unsubscribeFeatureFlags=null),this._surveyTimeouts.forEac
109h((t,i)=>this._clearSurveyTimeout(i)),this._widgetSelectorListeners.forEach((t,i)=>this._detachWidgetSelectorListener(i)),this._renderedTargets.forEach((t,i)=>{xi(null,i),t?.remove()}),this._renderedTargets.clear(),this._renderedTabWidgets.clear(),this._surveyInFocus=null}_sortSurveysByAppearanceDelay(e){return e.sort((t,i)=>{var s,n;let r=jo(t),o=jo(i);if(r&&!o)return-1;if(!r&&o)return 1;let a=t.schedule===lu.Always,l=i.schedule===lu.Always;return a&&!l?1:!a&&l?-1:(((s=t.appearance)===null||s===void 0?void 0:s.surveyPopupDelaySeconds)||0)-(((n=i.appearance)===null||n===void 0?void 0:n.surveyPopupDelaySeconds)||0)})}_translateSurveyForRendering(e){return kw(e,this._posthog)}_handleUrlPrefill(e,t,i){if(this._prefillHandledSurveys.has(e.id))return!1;let{params:s}=(function(){let r={},o=!1,a=We.location.search.replace(/^\?/,"");if(!a)return{params:r,autoSubmit:o};let l=a.split("&");for(let c of l){let d=c.indexOf("=");if(0>=d)continue;let h,u;try{h=decodeURIComponent(c.slice(0,d)),u=decodeURIComponent(c.slice(d+1))}catch{continue}if(h==="auto_submit"&&u==="true"){o=!0;continue}let p=h.match(/^q(\d+)$/);if(p){let _=parseInt(p[1],10);r[_]||(r[_]=[]),r[_].push(u)}}return{params:r,autoSubmit:o}})();if(Object.keys(s).length===0)return!1;J.info("[Survey Prefill] Detected URL prefill parameters");let n=this._processPrefillData(e,s,t);return!!n&&(this._autoSubmitPrefilledResponses(e,n,i,t),this._prefillHandledSurveys.add(e.id),n.isSurveyCompleted)}_autoSubmitPrefilledResponses(e,t,i,s){let{responses:n,submissionId:r,isSurveyCompleted:o,skippedResponses:a}=t;(Object.keys(a).length>0&&e.enable_partial_responses||o)&&Hm({responses:o?n:a,survey:e,surveySubmissionId:r,posthog:this._posthog,isSurveyCompleted:o,properties:i,surveyLanguage:s})}_handleInitialResponses(e,t,i,s){let n={};for(let[o,a]of Object.entries(t))n[parseInt(o)]=W(a)?a.map(String):[String(a)];J.info("[Survey] Processing initial responses");let r=this._processPrefillData(e,n,s);return!!r&&(this._autoSubmitPrefilledResponses(e,r,i,s),r.isSurveyCompleted)}_processPrefillData(e,t,i){try{let s=(function(c,d){let h={};return c.questions.forEach((u,p)=>{if(!d[p]||!u.id)return;let _=d[p],g=os(u.id);try{switch(u.type){case xt.SingleChoice:{if(!u.choices||u.choices.length===0)return void D.warn(`[Survey Prefill] Question ${p} has no choices`);let v=parseInt(_[0],10);if(isNaN(v)||0>v||v>=u.choices.length)return void D.warn(`[Survey Prefill] Invalid choice index for q${p}: ${_[0]}`);h[g]=u.choices[v];break}case xt.MultipleChoice:{if(!u.choices||u.choices.length===0)return void D.warn(`[Survey Prefill] Question ${p} has no choices`);let v=_.map(m=>parseInt(m,10)).filter(m=>!isNaN(m)&&m>=0&&u.choices.length>m);if(v.length===0)return void D.warn(`[Survey Prefill] No valid choices for q${p}`);let f=[...new Set(v.map(m=>u.choices[m]))];v.length>f.length&&D.warn(`[Survey Prefill] Removed duplicate choices for q${p}`),h[g]=f;break}case xt.Rating:{let v=parseInt(_[0],10),f=u.scale||10;if(isNaN(v)||0>v||v>f)return void D.warn(`[Survey Prefill] Invalid rating for q${p}: ${_[0]} (scale: 0-${f})`);h[g]=v;break}default:D.info(`[Survey Prefill] Question type ${u.type} does not support prefill`)}}catch(v){D.error(`[Survey Prefill] Error converting q${p}:`,v)}}),h})(e,t);if(Object.keys(s).length===0)return J.warn("[Survey Prefill] No valid responses after conversion"),null;let n=Rt(),{startQuestionIndex:r,skippedResponses:o,skippedIndices:a}=(function(c,d,h){let u=0,p={},_=[],g=c.questions.length+1,v=0;for(;c.questions.length>u&&g>v&&(v++,d.includes(u));){let f=c.questions[u];if(!f||!("skipSubmitButton"in f)||!f.skipSubmitButton)break;if(f.id){let y=os(f.id);M(h[y])||(p[y]=h[y])}_.push(u);let m=Wm(c,u,f.id?h[os(f.id)]:null);if(m===Vt.End)return{startQuestionIndex:c.questions.length,skippedResponses:p,skippedIndices:_};u=m}return{startQuestionIndex:u,skippedResponses:p,skippedIndices:_}})(e,Object.keys(t).map(c=>parseInt(c,10)),s),l=r>=e.questions.length;return uu(e,{surveySubmissionId:n,responses:s,lastQuestionIndex:r,questionOrder:zo(e.questions),visitedIndices:a,surveyLanguage:i}),J.info("[Survey Prefill] Stored prefilled responses in localStorage"),{responses:s,submissionId:n,startQuestionIndex:r,isSurveyCompleted:l,skippedResponses:o}}catch(s){return J.error("[Survey Prefill] Error handling prefill:",s),null}}_isSurveyFeatureFlagEnabled(e,t=void 0){if(!e)return!0;let i=this._featureFlags,s=!!i?.isFeatureEnabled(e,{send_event:!e.startsWith("survey-targeting-")}),n=!0;t&&(n=i?.getFeatureFlag(e,{send_event:!1})===t||t==="any");let r=s&&n;return r||this._warnIfFeatureFlagsDisabled(e),r}_warnIfFeatureFlagsDisabled(e){var t;!this._loggedFeatureFlagsDisabledWarning&&(!((t=this._posthog.config)===null||t===void 0)&&t.advanced_disable_feature_flags)&&(this._loggedFeatureFlagsDisabledWarning=!0,J.warn(`Survey feature flag "${e}
109" evaluated to false because advanced_disable_feature_flags is set. PostHog creates an internal targeting flag for almost every survey, so no survey can display while flags are disabled. To keep surveys working, replace advanced_disable_feature_flags with advanced_only_evaluate_survey_feature_flags, which evaluates survey flags only.`))}_isSurveyConditionMatched(e){return!e.conditions||wd(e,this._posthog)&&(function(t){var i,s;return(function(n,r){var o,a,l;if(!n||n.length===0)return!0;if(!pt)return!1;let c=Cf(pt,{userAgentDataPlatform:Je==null||(o=Je.userAgentData)===null||o===void 0?void 0:o.platform,maxTouchPoints:Je?.maxTouchPoints,screenWidth:T==null||(a=T.screen)===null||a===void 0?void 0:a.width,screenHeight:T==null||(l=T.screen)===null||l===void 0?void 0:l.height,devicePixelRatio:T?.devicePixelRatio});return $r[r??"icontains"](n,[c])})((i=t.conditions)===null||i===void 0?void 0:i.deviceTypes,(s=t.conditions)===null||s===void 0?void 0:s.deviceTypesMatchType)})(e)&&(function(t){var i;return!(!((i=t.conditions)===null||i===void 0)&&i.selector)||!!Ws?.querySelector(t.conditions.selector)})(e)}_internalFlagCheckSatisfied(e){var t;return r_(e)?{satisfied:!0}:e.internal_targeting_flag_key&&(function(i){var s;return i.schedule==="recurring"||((s=i.current_iteration)!==null&&s!==void 0?s:0)>0})(e)&&!(!((t=this._featureFlags)===null||t===void 0)&&t.hasLoadedFlags)?(this._warnIfFeatureFlagsDisabled(e.internal_targeting_flag_key),{satisfied:!1,reason:"Feature flags have not loaded yet; deferring internal targeting flag check"}):{satisfied:this._isSurveyFeatureFlagEnabled(e.internal_targeting_flag_key)}}checkSurveyEligibility(e){var t,i;let s={eligible:!0,reason:void 0};if(!Om(e))return s.eligible=!1,s.reason=`Survey is not running. It was completed on ${e.end_date}`,s;if(!Nm.includes(e.type))return s.eligible=!1,s.reason=`Surveys of type ${e.type} are never eligible to be shown in the app`,s;let n=(t=e.conditions)===null||t===void 0?void 0:t.linkedFlagVariant;if(!this._isSurveyFeatureFlagEnabled(e.linked_flag_key,n))return s.eligible=!1,s.reason=n?`Survey linked feature flag is not enabled for variant ${n}`:"Survey linked feature flag is not enabled",s;if(!this._isSurveyFeatureFlagEnabled(e.targeting_flag_key))return s.eligible=!1,s.reason="Survey targeting feature flag is not enabled",s;let r=this._internalFlagCheckSatisfied(e);var o;
109return r.satisfied?(function(a,l){if(!a||!l)return!0;let c=typeof l=="string"?new Date(l):l,d=Math.abs(new Date().getTime()-c.getTime());return Math.ceil(d/864e5)>a})((i=e.conditions)===null||i===void 0?void 0:i.seenSurveyWaitPeriodInDays,ye._get("lastSeenSurveyDate"))?((a=>!!ye._get(Dm(a))&&!r_(a))(e)&&(s.eligible=!1,s.reason="Survey has already been seen and it can't be activated again"),s):(s.eligible=!1,s.reason="Survey wait period has not passed",s):(s.eligible=!1,s.reason=(o=r.reason)!==null&&o!==void 0?o:"Survey internal targeting flag is not enabled and survey cannot activate repeatedly and survey is not in progress",s)}checkSurveyCaptureEligibility(){return _i(this._posthog)?{eligible:!0}:{eligible:!1,reason:Lm}}checkSurveyDisplayEligibility(e){let t=this.checkSurveyCaptureEligibility();return t.eligible?this.checkSurveyEligibility(e):t}checkSurveyRenderability(e){let t=this.checkSurveyDisplayEligibility(e);return t.eligible&&!this._hasActionOrEventTriggeredSurvey(e)?{eligible:!1,reason:"Survey event/action trigger has not been fired yet"}:t}_hasActionOrEventTriggeredSurvey(e){var t;if(!rd(e)&&!$m(e))return!0;let i=(t=this._posthog.surveys)===null||t===void 0||(t=t._surveyEventReceiver)===null||t===void 0?void 0:t.getSurveys();return!!i?.includes(e.id)}_checkFlags(e){var t;return!(!((t=e.feature_flag_keys)===null||t===void 0)&&t.length)||e.feature_flag_keys.every(({key:i,value:s})=>!i||!s||this._isSurveyFeatureFlagEnabled(s))}_shouldDisplaySurvey(e){return this.checkSurveyEligibility(e).eligible&&this._isSurveyConditionMatched(e)&&this._hasActionOrEventTriggeredSurvey(e)&&this._checkFlags(e)}_removeSurveyFromDom(e){try{let t=$i.querySelector(du(e,!0));t?.shadowRoot&&(xi(null,t.shadowRoot),this._renderedTargets.delete(t.shadowRoot)),t?.remove()}catch(t){J.warn(`Failed to remove survey ${e.id} from DOM:`,t)}}getTestAPI(){return{addSurveyToFocus:this._addSurveyToFocus,removeSurveyFromFocus:this._removeSurveyFromFocus,surveyInFocus:this._surveyInFocus,surveyTimeouts:this._surveyTimeouts,handleWidget:this._handleWidget,handlePopoverSurvey:this.handlePopoverSurvey,manageWidgetSelectorListener:this._manageWidgetSelectorListener,sortSurveysByAppearanceDelay:this._sortSurveysByAppearanceDelay,checkFlags:this._checkFlags.bind(this),isSurveyFeatureFlagEnabled:this._isSurveyFeatureFlagEnabled.bind(this),onLanguageChange:this._onLanguageChange.bind(this),currentLanguage:this._currentLanguage,surveyIsRendered:this._surveyIsRendered}}};function h_(e,t){if(!$i||!We)return;let i=new Cw(e);if(e.config.disable_surveys_automatic_display)return J.info("Surveys automatic display is disabled. Skipping call surveys and evaluate display logic."),i;if(t===!1)return J.info("There are no surveys to load or Surveys is disabled in the project settings."),i;let s;i.callSurveysAndEvaluateDisplayLogic(!0);let n=()=>{M(s)&&(s=setInterval(()=>{i.callSurveysAndEvaluateDisplayLogic(!1)},1e3))},r=()=>{M(s)||(clearInterval(s),s=void 0)};n();let o=()=>{$i.hidden?r():(i.callSurveysAndEvaluateDisplayLogic(!1),n())};return Z($i,"visibilitychange",o),i.setAutomaticDisplayDispose(()=>{r(),$i.removeEventListener("visibilitychange",o)}),i}function zm({survey:e,removeSurveyFromFocus:t=()=>{},setSurveyVisible:i,isPreviewMode:s=!1,posthog:n}){_n(()=>{var r;if(s||!(!((r=e.conditions)===null||r===void 0)&&r.url))return;let o=()=>{var c;let d=e.type===Nt.Widget,h=wd(e,n),u=((c=e.appearance)===null||c===void 0?void 0:c.widgetType)===cs.Tab&&d;if(!h)return J.info(`Hiding survey ${e.id} because URL does not match`),i(!1),t(e);u&&(J.info(`Showing survey ${e.id} because it is a feedback button tab and URL matches`),i(!0))};Z(We,"popstate",o),Z(We,"hashchange",o);let a=We.history.pushState,l=We.history.replaceState;return We.history.pushState=function(...c){a.apply(this,c),o()},We.history.replaceState=function(...c){l.apply(this,c),o()},()=>{We.removeEventListener("popstate",o),We.removeEventListener("hashchange",o),We.history.pushState=a,We.history.replaceState=l}},[s,e,t,i,n])}var Ew=200;function xw(e=jn.Right){switch(e){case jn.Top:return{top:"0",left:"50%",transform:"translateX(-50%)"};case jn.Left:return{top:"50%",left:"0",transform:"rotate(90deg) translateY(-100%)",transformOrigin:"left top"};case jn.Bottom:return{bottom:"0",left:"50%",transform:"translateX(-50%)"};default:return{top:"50%",right:"0",transform:"rotate(-90deg) translateY(-100%)",transformOrigin:"right top"}}}function Ls({survey:e,forceDisableHtml:t,posthog:i,style:s={},previewPageIndex:n,removeSurveyFromFocus:r=()=>{},isPopup:o=!0,onPreviewSubmit:a=()=>{},onPreviewBack:l=()=>{},onPopupSurveyDismissed:c=()=>{},onCloseConfirmationMessage:d=()=>{},properties:h,isSurveyCompleted:u,skipShownEvent:p,surveyLanguage:_}){var g,v,f,m,y,w,S,x,k,C,E,I;let P=Mr(null),O=Number.isInteger(n),{isPopupVisible:L,isSurveySent:A,hidePopupWithAnimation:B}
109=(function(Q,z,ae,be,Ee,pe,ve,dt,st){let[Le,ze]=wt(be||ae===0||Q.type===Nt.ExternalSurvey),[It,Ci]=wt(!1),nt=Mr(!1),Bt=()=>{let qe=()=>{pe&&Ee(Q),ze(!1)};if(nt.current)return;let Pe=ve?.current;Pe?(nt.current=!0,Pe.style.transition=`opacity ${Ew}ms ease-out`,Pe.style.opacity="0",setTimeout(()=>{nt.current=!1,qe()},250)):qe()},Yt=qe=>{qe.detail.surveyId===Q.id&&Bt()};return _n(()=>{if(!z)return void J.error("usePopupVisibility hook called without a PostHog instance.");if(be)return;let qe,Pe=Fe=>{var te,je;if(Fe.detail.surveyId===Q.id){if(!(!((te=Q.appearance)===null||te===void 0)&&te.displayThankYouMessage))return Bt();Ci(!0),!((je=Q.appearance)===null||je===void 0)&&je.autoDisappear&&(qe&&clearTimeout(qe),qe=setTimeout(Bt,5e3))}},X=()=>{if(wd(Q,z)){ze(!0);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}var Fe;We.dispatchEvent(new Event("PHSurveyShown")),dt||z.capture(gt.SHOWN,b(b({[ft.SURVEY_NAME]:Q.name,[ft.SURVEY_ID]:Q.id,[ft.SURVEY_ITERATION]:Q.current_iteration,[ft.SURVEY_ITERATION_START_DATE]:Q.current_iteration_start_date},st&&{[ft.SURVEY_LANGUAGE]:st}),{},{sessionRecordingUrl:(Fe=z.get_session_replay_url)===null||Fe===void 0?void 0:Fe.call(z)}))}};Z(We,"PHSurveyClosed",Yt),Z(We,"PHSurveySent",Pe);let at=ae>0?setTimeout(X,ae):void 0;return M(at)&&X(),()=>{M(at)||clearTimeout(at),M(qe)||clearTimeout(qe),We.removeEventListener("PHSurveyClosed",Yt),We.removeEventListener("PHSurveySent",Pe)}},[]),zm({survey:Q,removeSurveyFromFocus:Ee,setSurveyVisible:ze,isPreviewMode:be,posthog:z}),{isPopupVisible:Le,isSurveySent:It,setIsPopupVisible:ze,hidePopupWithAnimation:Bt}})(e,i,!((g=e.appearance)===null||g===void 0)&&g.surveyPopupDelaySeconds?1e3*e.appearance.surveyPopupDelaySeconds:0,O,r,o,P,p,_),q=A||n===e.questions.length||u===!0,[K,U]=wt(!1),ce=yi(()=>!!ps(e),[e]),j=!(!(!((v=e.appearance)===null||v===void 0)&&v.introScreenHeader)&&!(!((f=e.appearance)===null||f===void 0)&&f.introScreenDescription)),N=O?n===-1:!!(!((m=e.appearance)===null||m===void 0)&&m.displayIntroScreen)&&j&&!K&&!ce,V=yi(()=>{let Q=ps(e),z=Q?.surveySubmissionId||Rt();return{isPreviewMode:O,previewPageIndex:n,onPopupSurveyDismissed(){_?s_(e,i,O,_):s_(e,i,O),c()},isPopup:o||!1,surveySubmissionId:z,onPreviewSubmit:a,onPreviewBack:l,posthog:i,properties:h,surveyLanguage:_}},[O,n,o,i,e,c,a,l,h,_]);return L?H(gs.Provider,{value:V,children:H("div",{className:"ph-survey",style:b(b
109({},tw(e.type,(y=e.appearance)===null||y===void 0?void 0:y.position,(w=e.appearance)===null||w===void 0?void 0:w.widgetType)),s),ref:P,children:q?H(uw,{header:((S=e.appearance)===null||S===void 0?void 0:S.thankYouMessageHeader)||"Thank you!",description:((x=e.appearance)===null||x===void 0?void 0:x.thankYouMessageDescription)||"",forceDisableHtml:!!t,contentType:(k=e.appearance)===null||k===void 0?void 0:k.thankYouMessageDescriptionContentType,appearance:e.appearance||Hi,onClose(){B(),d()}}):N?H(dw,{header:((C=e.appearance)===null||C===void 0?void 0:C.introScreenHeader)||"",description:((E=e.appearance)===null||E===void 0?void 0:E.introScreenDescription)||"",forceDisableHtml:!!t,contentType:(I=e.appearance)===null||I===void 0?void 0:I.introScreenDescriptionContentType,appearance:e.appearance||Hi,onStart:()=>U(!0)}):H(Tw,{survey:e,forceDisableHtml:!!t,posthog:i})})}):null}function Tw({survey:e,forceDisableHtml:t,posthog:i}){var s,n;let r=yi(()=>{let L=ps(e);if(!L)return null;let A=ne(L.lastQuestionIndex);return!A||A&&L.lastQuestionIndex>=0&&e.questions.length>L.lastQuestionIndex?L:(Cd(e),null)},[e]),[o,a]=wt(()=>(r?.responses&&J.info("Survey is already in progress, filling in initial responses"),r?.responses||{})),[l,c]=wt(!1),{previewPageIndex:d,onPopupSurveyDismissed:h,isPopup:u,onPreviewSubmit:p,onPreviewBack:_,surveySubmissionId:g,isPreviewMode:v,properties:f,surveyLanguage:m}=gn(gs),[y,w]=wt(()=>{let L=r?.lastQuestionIndex,A=ne(L)&&L>=0&&e.questions.length>L?L:0;return ne(d)&&d>=0?d:A}),[S,x]=wt(()=>{var L;return((L=r?.visitedIndices)!==null&&L!==void 0?L:[]).filter(A=>A>=0&&e.questions.length>A)}),[k,C]=wt(()=>{var L;let A=ps(e);return(L=A?.questionSnapshots)!==null&&L!==void 0?L:{}}),E=yi(()=>zo(n_(e,r)),[e.id,r]),I=yi(()=>
109{if(!E||new Set(E).size!==E.length)return n_(e,r);let L=new Map(e.questions.map(B=>[B.id,B])),A=E.map(B=>L.get(B)).filter(B=>!!B);return A.length===E.length?A:e.questions},[E,e.questions,e,r]);_n(()=>{!v||M(d)||0>d||w(d)},[d,v]);let P=!!(!((s=e.appearance)===null||s===void 0)&&s.allowGoBack)&&(v?(d??0)>0:S.length>0),O=I.at(y);return O?H("form",{className:"survey-form",name:"surveyForm",children:[u&&((n=e.appearance)===null||n===void 0?void 0:n.hideCancelButton)!==!0&&H(Ed,{onClick(){h()}}),H("div",{className:"survey-box","data-question-index":y,children:[l&&H("p",{role:"alert",children:"Your response could not be sent. Please try again later."}),Mw({question:O,forceDisableHtml:t,displayQuestionIndex:y,appearance:e.appearance||Hi,onSubmit:L=>(({res:A,displayQuestionIndex:B,questionId:q})=>{if(!i)return void J.error("onNextButtonClick called without a PostHog instance.");if(!_i(i))return void c(!0);if(c(!1),!q)return void J.error("onNextButtonClick called without a questionId.");let{responses:K,questionSnapshots:U}=(function({responses:V,questionSnapshots:Q={}},z,ae,be){return{responses:b(b({},V),{},{[os(z)]:ae}),questionSnapshots:be?.id?b(b({},Q),{},{[be.id]:be.question}):Q}})({responses:o,questionSnapshots:k},q,A,I[B]);a(K),C(U);let ce=Wm(e,B,A),j=ce===Vt.End,N=[...S,B];if(j||(x(N),w(ce),uu(e,{surveySubmissionId:g,responses:K,lastQuestionIndex:ce,questionOrder:zo(I),visitedIndices:N,surveyLanguage:m,questionSnapshots:U})),e.enable_partial_responses||j){let V=new Set(N.map(z=>{var ae;return(ae=I[z])===null||ae===void 0?void 0:ae.id}).filter(z=>!!z).map(z=>os(z))),Q=Object.fromEntries(Object.entries(K).filter(([z])=>V.has(z)));Hm({responses:Q,survey:e,surveySubmissionId:g,isSurveyCompleted:j,posthog:i,properties:f,surveyLanguage:m,questionSnapshots:U})}})({res:L,displayQuestionIndex:y,questionId:O.id}),onPreviewSubmit:p,initialValue:O.id?o[os(O.id)]:void 0,canGoBack:P,onBack(){if(v)return void _();if(S.length===0)return;let L=S[S.length-1],A=S.slice(0,-1);x(A),w(L),uu(e,{surveySubmissionId:g,responses:o,lastQuestionIndex:L,questionOrder:zo(I),visitedIndices:A,surveyLanguage:m,questionSnapshots:k})}})]})]}):null}function Iw({survey:e,forceDisableHtml:t,posthog:i,readOnly:s,surveyLanguage:n}){var r,o,a,l,c,d,h;let[u,p]=wt(!0),[_,g]=wt(!1),[v,f]=wt({}),m=Mr(void 0),y=()=>{(_||!i||s||_i(i))&&g(!_)};if(_n(()=>{var S;if(!i)return void J.error("FeedbackWidget called without a PostHog instance.");if(s)return;((S=e.appearance)===null||S===void 0?void 0:S.widgetType)==="tab"&&f({to
109p:"50%",bottom:"auto"});let x=k=>{var C;let E=k;((C=E.detail)===null||C===void 0?void 0:C.surveyId)===e.id&&(J.info(`Received show event for feedback button survey ${e.id}`),f(E.detail.position||{}),y())};return Z(We,hu,x),()=>{M(m.current)||(clearTimeout(m.current),m.current=void 0),We.removeEventListener(hu,x)}},[i,s,e.id,(r=e.appearance)===null||r===void 0?void 0:r.widgetType,(o=e.appearance)===null||o===void 0?void 0:o.widgetSelector,(a=e.appearance)===null||a===void 0?void 0:a.borderColor]),zm({survey:e,setSurveyVisible:p,posthog:i}),!u)return null;let w=()=>{e.schedule!==lu.Always&&p(!1),M(m.current)||clearTimeout(m.current),m.current=setTimeout(()=>{m.current=void 0,g(!1)},200)};return H(ki,{children:[((l=e.appearance)===null||l===void 0?void 0:l.widgetType)==="tab"&&H("button",{className:"ph-survey-widget-tab "+(((c=e.appearance)===null||c===void 0?void 0:c.tabPosition)===jn.Top?"widget-tab-top":""),onClick:y,disabled:s,style:xw((d=e.appearance)===null||d===void 0?void 0:d.tabPosition),children:((h=e.appearance)===null||h===void 0?void 0:h.widgetLabel)||""}),_&&H(Ls,{posthog:i,survey:e,forceDisableHtml:t,style:v,onPopupSurveyDismissed:w,onCloseConfirmationMessage:w,surveyLanguage:n})]})}var Mw=({question:e,forceDisableHtml:t,displayQuestionIndex:i,appearance:s,onSubmit:n,onPreviewSubmit:r,initialValue:o,canGoBack:a,onBack:l})=>{let c={forceDisableHtml:t,appearance:s,onPreviewSubmit(d){r(d)},onSubmit(d){n(d)},initialValue:o,displayQuestionIndex:i,canGoBack:a,onBack:l};switch(e.type){case xt.Open:return Oi(hw,b(b({},c),{},{question:e,key:e.id}));case xt.Link:return Oi(pw,b(b({},c),{},{question:e,key:e.id}));case xt.Rating:return Oi(_w,b(b({},c),{},{question:e,key:e.id}));case xt.SingleChoice:case xt.MultipleChoice:return Oi(fw,b(b({},c),{},{question:e,key:e.id}));default:return J.error(`Unsupported question type: ${e.type}`),null}};R.__PosthogExtensions__=R.__PosthogExtensions__||{},R.__PosthogExtensions__.generateSurveys=h_,R.extendPostHogWithSurveys=h_;var jm=e=>{for(;e?.__rrweb_original__;)e=e.__rrweb_original__;return e},pu=1e4,Pt=(e,t,i)=>i.remaining>0?t.length>i.remaining?(e.push(t.slice(0,i.remaining)),i.remaining=0,i.truncated=!0,!1):(e.push(t),i.remaining-=t.length,!0):(i.truncated=!0,!1),$l=(e,t,i)=>{let s=JSON.stringify(e);if(i.remaining>=s.length)return Pt(t,s,i);if(i.truncated=!0,2>i.remaining)return!1;let n=0,r=Math.min(e.length,i.remaining-2);for(;r>n;){let o=Math.ceil((n+r)/2);JSON.stringify(e.slice(0,o)).length>i.remaining?r=o-1:n=o}return Pt(t,JSON.stringify(e.slice(0,n)),i)},p_=e=>e!==void 0&&typeof e!="function"&&typeof e!="symbol"&&typeof e!="bigint",__=(e,t,i)=>{if(!i.truncated){if(i.keysRemaining-=1,i.sizeRemaining-=String(t).length+e.length,0>=i.keysRemaining||0>=i.sizeRemaining)return i.truncated=!0,void(i.result.attributes_truncated=!0);i.result[e]=t}},Vm=(e,t,i)=>{if(!i.truncated)if(ee(e)){if(i.seen.has(e))return void __(t||"circular","[Circular]",i);i.seen.add(e);try{for(let s in e)try{if(!{}.hasOwnProperty.call(e,s))continue;if(Vm(e[s],t?`${t}.${s}`:s,i),i.truncated)return}catch{continue}}catch{}}else __(t,e,i)},Vn=(e,t,i,s,n=!1,r)=>{if(!p_(e))return!n||Pt(t,"null",i);if(ue(e)||(a=>{try{return ne(a)||Ae(a)}catch{return!1}})(e))return Pt(t,JSON.stringify(e),i);if(typeof e=="string")return $l(e,t,i);if(!ee(e)&&!W(e))return Pt(t,JSON.stringify(e),i);if(s.has(e))return $l("[Circular]",t,i);s.add(e);try{let a=e.toJSON;if(_e(a))return Vn(a.call(e),t,i,s,n)}catch{}try{let a={}.toString.call(e);if(a==="[object String]")return $l(String(e.valueOf()),t,i);if(a==="[object Number]"||a==="[object Boolean]")return Pt(t,JSON.stringify(e.valueOf()),i)}catch{}if(e instanceof Error){let a={};try{for(let l in e)({}).hasOwnProperty.call(e,l)&&(a[l]=e[l])}catch{}try{a.name=e.name}catch{}try{a.message=e.message}catch{}try{a.stack=e.stack}catch{}return Vn(a,t,i,s,n,r)}if(W(e)){if(!Pt(t,"[",i))return!1;for(let a=0;e.length>a;a++){if(a>0&&!Pt(t,",",i))return!1;let l;try{l=e[a]}catch{l=void 0}if(!Vn(l,t,i,s,!0))return!1}return Pt(t,"]",i)}if(!Pt(t,"{",i))return!1;let o=!0;try{for(let a in e){if(!{}.hasOwnProperty.call(e,a))continue;if(0>=i.remaining)return i.truncated=!0,!1;let l;try{l=e[a]}catch{continue}if(r)try{Vm(l,a,r)}catch{}if(!p_(l))continue;let c=`${o?"":","}${JSON.stringify(a)}:`;if(c.length>=i.remaining)return i.truncated=!0,!1;let d=t.length,h=i.remaining,u=i.truncated;if(!Pt(t,c,i))return!1;let p=t.length,_=Vn(l,t,i,s,!1),g=i.truncated;if(t.length!==p){if(o=!1,!_)return!1}else if(t.length=d,i.remaining=h,i.truncated=_?u:g,!_)return!1}}catch{}return Pt(t,"}",i)},g_=(e,t)=>
109{let i=[],s={remaining:t,truncated:!1},n=ee(e[0])?{result:{},keysRemaining:50,sizeRemaining:pu,truncated:!1,seen:new WeakSet([e[0]])}:void 0;for(let r=0;e.length>r&&(0>=r||Pt(i," ",s))&&Vn(e[r],i,s,new WeakSet,!1,r===0?n:void 0);r++);return{body:i.join("")+(s.truncated?"...":""),truncated:s.truncated,attributes:n?.result||{}}},Dl={debug:"debug",log:"info",warn:"warn",error:"error",info:"info"},Gm=e=>"canCapture"in e,f_=e=>Gm(e)?e.canCapture?e.getExtension(Bm):void 0:e.is_capturing()?e.logs:void 0,Pw=(e,t,i)=>{if(Gm(e))return void t.captureConsoleLog(i);let s=(r=>{let o=/^1\.(\d+)\.(\d+)$/.exec(r);if(!o)return;let a=Number(o[1]),l=Number(o[2]);return 392>a||a>419?void 0:a===410?l>4?l>10?void 0:"de":"le":a===418?l>3?l>10?l>14?l>17?void 0:"vi":"ci":"ui":"he":a===419?l>2?void 0:"vi":410>a?"le":"he"})(e.version),n=s?t[s]:void 0;_e(n)&&n.call(t,i)};R.__PosthogExtensions__=R.__PosthogExtensions__||{},R.__PosthogExtensions__.logs={initializeLogs(e){let t=e,i=[],s={host:R.location.host},n=!1;for(let r of Object.keys(Dl)){let o=l=>(...c)=>{let d=!1;try{let h=t;if(c.length>0&&!n&&h){let u=f_(h);if(u){n=!0,d=!0;let{body:p,truncated:_,attributes:g}=g_(c,pu),v=b(b({},s),_?{body_truncated:"true"}:{}),f={level:Dl[r],body:p,attributes:b(b({"log.source":`console.${r}`},v),g)};Pw(h,u,f)}}}catch{}finally{d&&(n=!1),l.apply(R.console,c)}},a=R.console[r];i.push(ai(R.console,r,l=>{let c=o(l);return c.__rrweb_original__=jm(a),c}))}return()=>{t=void 0,i.forEach(r=>r())}},replayConsoleBuffer(e,t){let i=f_(e);if(i)for(let n of t)try{var s;let{body:r,truncated:o,attributes:a}=g_(n.args,pu);(s=i.captureBufferedConsoleLog)===null||s===void 0||s.call(i,{level:Dl[n.level],body:r,attributes:b(b({"log.source":`console.${n.level}`,host:R.location.host},o?{body_truncated:"true"}:{}),a)},n.context,n.occurredAtMs)}catch{}}};var v_=e=>hn(e)&&(e.name==="RangeError"&&e.message.indexOf("Maximum call stack size exceeded")===0||e.name==="InternalError"&&e.message==="too much recursion"),zt=Ie("[Error tracking]"),_u="webkit-masked-url:",Rw=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],Fw=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",_u],Aw=["__firefox__","__gCrWeb"];function Qm(){return new Ey([new qy,new Ky,new Uy,new Hy,new Gy,new Vy,new zy,new Qy],(function(e,...t){return(i,s=0)=>{let n=[],r=i.split(` 110`),o=Math.min(r.length,s+1e3),a=[];for(let d=s;o>d;d++){let h=r[d];if(h.length>1024)continue;let u=ih.test(h)?h.replace(ih,"$1"):h;if(!u.match(/\S*Error: /)){for(let p of t){let _=p(u,e);if(_){n.push(_);let g=$y(n);if(g){for(let v=a.length-1;v>=0;v--){let f=a[v];if(g.start>=f.start+f.length)break;a.pop()}a.push(g)}break}}if(Ny(n,a)>=50)break}}let l=[...a].sort((d,h)=>h.start-d.start),c=l[l.length-1];if(c){let d=Rf(n,c);n.splice(c.start-d,d);for(let h of l)h.start-=d}for(let d of l)Dy(n,d);return a.some(d=>d.start===0&&n.length===d.length)&&(function(d){let h=d.map(p=>`${p.function}|${p.filename}|${p.lineno}|${p.colno}|${p.module}`),u=0;for(let p=1;h.length>p;p++)By(h,p,u)&&(u=p);d.push(...d.splice(0,u))})(n),(function(d){if(!d.length)return[];let h=Array.from(d);return h.reverse(),h.slice(0,50).map(u=>{return b(b({},u),{},{filename:u.filename||(p=h,p[p.length-1]||{}).filename,function:u.function||"?"});var p})})(n)}})("web:javascript",Fy,Oy))}var Pr=Ie("[ExceptionAutocapture]"),xd=Qm(),wi=(e,t)=>{try{return e()}catch{return t}},Td=(e,t)=>wi(()=>e(t()),void 0),Id=e=>wi(()=>_e(e)&&_e(e.call),!1),Md=(e,t)=>wi(()=>{e[t].__POSTHOG_INSTRUMENTED__=!0},void 0),Pd=(e,t,i)=>{wi(()=>{var s;(s=e[t])===null||s===void 0||delete s.__POSTHOG_INSTRUMENTED__},void 0),wi(()=>{e[t]=i},void 0)},Km=e=>{let t=T;t||Pr.info("window not available, cannot wrap onerror");let i=wi(()=>t.onerror,void 0);return t.onerror=function(...s){var n;return Td(e,()=>xd.buildFromUnknown((([r,o,a,l,c])=>{if(c!=null)return c;if(oe(r)&&oe(o)&&o.length>0&&typeof ErrorEvent<"u")try{return new ErrorEvent("error",{message:r,filename:o,lineno:a,colno:l})}catch{return r}return r})(s),{mechanism:{handled:!1}})),!!Id(i)&&(n=i(...s))!==null&&n!==void 0&&n},Md(t,"onerror"),()=>Pd(t,"onerror",i)},Jm=(e,t=!1)=>{let i=T;i||Pr.info("window not available, cannot wrap onUnhandledRejection");let s=wi(()=>i.onunhandledrejection,void 0);return i.onunhandledrejection=function(n){var r;return Td(e,()=>xd.buildFromUnknown(n,{mechanism:{handled:!1}})),Id(s)?(r=s(n))!==null&&r!==void 0&&r:t},Md(i,"onunhandledrejection"),()=>Pd(i,"onunhandledrejection",s)}
110,m_={wrapOnError:Km,wrapUnhandledRejection:Jm,wrapConsoleError(e){let t=console;t||Pr.info("console not available, cannot wrap console.error");let i=wi(()=>t.error,void 0);return t.error=function(...s){wi(()=>s.length>1&&oe(s[0])&&(/^\[PostHog\.js\](?: |$)/.test(s[0])||s[0]==="rrweb logger error:"),!1)||Td(e,()=>{let n;n=s.length==1?s[0]:s.join(" ");let r=s.find(o=>o instanceof Error);return xd.buildFromUnknown(r||n,{mechanism:{handled:!0,type:"onconsole"},syntheticException:new Error("PostHog syntheticException"),skipFirstLines:2})}),Id(i)&&i(...s)},Md(t,"error"),()=>Pd(t,"error",i)}};R.__PosthogExtensions__=R.__PosthogExtensions__||{},R.__PosthogExtensions__.errorWrappingFunctions=m_,R.posthogErrorWrappingFunctions=m_;var y_=(e,t)=>{if(!_e(e?.capture))return;let i=t?.autocaptureExceptions,s=!ue(i)&&typeof i=="object"&&W(i.errors_to_ignore)?i.errors_to_ignore.reduce((r,o)=>{try{r.push(new RegExp(o))}catch(a){Pr.error("Ignoring invalid legacy exception exclusion rule",o,a)}return r},[]):[],n=r=>{try{var o;(o=e.capture)===null||o===void 0||o.call(e,"$exception",r,{_noTruncate:!0,_batchKey:"exceptionEvent",_noHeatmaps:!0})}catch(a){Pr.error("Failed to capture exception for a legacy client",a)}};Km(r=>{s.some(o=>r.$exception_list.some(a=>o.test(a.value||"")))||n(r)}),Jm(n,!0)};R.extendPostHogWithExceptionAutoCapture=y_,R.extendPostHogWithExceptionAutocapture=y_;var Ym="X-POSTHOG-SESSION-ID",Zm="X-POSTHOG-WINDOW-ID",Xm="X-POSTHOG-DISTINCT-ID",Lw=[Ym,Zm,Xm],b_=["attributionReporting","body","browsingTopics","cache","credentials","dispatcher","duplex","integrity","keepalive","method","mode","priority","redirect","referrer","referrerPolicy","signal","window"],S_=(e,t)=>({}).hasOwnProperty.call(e,t),w_=e=>typeof e=="object"&&!ue(e)||_e(e),e0=e=>typeof Request<"u"&&(e instanceof Request||{}.toString.call(e)==="[object Request]"),k_=e=>{try{var t;return e0(e)?e.url:new URL(e instanceof URL?e.toString():String(e),T==null||(t=T.location)===null||t===void 0?void 0:t.href).toString()}catch{return}},Nl=(e,t,i,s,n)=>{let r;try{r=new URL(s).hostname}catch{return!1}if(!e||W(e)&&!e.includes(r))return!1;let o=!1;if(i){let{sessionId:l,windowId:c}=i.checkAndGetSessionAndWindowId(!0);n.set(Ym,l),n.set(Zm,c),o=!0}let a=(l=>_e(l)?l():l)(t);return a&&a!=="$posthog_cookieless"&&(n.set(Xm,a),o=!0),o};R.__PosthogExtensions__=R.__PosthogExtensions__||{};var C_={_patchFetch:(e,t,i)=>ai(T,"fetch",s=>function(n,r){let o=arguments.length>1?[n,r]:[n],a=o;try{let l=k_(n);if(l)if(e0(n)){let c=new Request(n,r);Nl(e,t,i,c.url,c.headers),a=[c]}else{let c=new Headers(w_(r)?r.headers:void 0);if(Nl(e,t,i,l,c)){let d=((h,u)=>{if(M(h)||ue(h))return{headers:u};if(!w_(h))return;let p=h;if(typeof Proxy>"u"||typeof Reflect>"u"){let _=Object.create(p);return Object.defineProperty(_,"headers",{configurable:!0,enumerable:!0,value:u,writable:!0}),_}return new Proxy({headers:u},{get:(_,g)=>S_(_,g)?Reflect.get(_,g):Reflect.get(p,g,p),has:(_,g)=>S_(_,g)||g in p,ownKeys(_){let g=new Set(Reflect.ownKeys(_));return Reflect.ownKeys(p).forEach(v=>g.add(v)),b_.forEach(v=>{v in p&&g.add(v)}),Array.from(g)},getOwnPropertyDescriptor(_,g){let v=Reflect.getOwnPropertyDescriptor(_,g);if(v)return v;if(typeof g=="string"&&b_.includes(g)&&g in p)return{configurable:!0,enumerable:!0,get(){return Reflect.get(p,g,p)}};let f=Reflect.getOwnPropertyDescriptor(p,g);return f?b(b({},f),{},{configurable:!0}):void 0},getPrototypeOf:()=>Object.getPrototypeOf(p)})})(r,c);d&&(a=[n,d])}}}catch{a=o}return s.apply(this,a)}),_patchXHR:(e,t,i)=>ai(T.XMLHttpRequest.prototype,"open",s=>function(n,r,o=!0,a,l){let c=this,d=new Headers,h=k_(r);h&&Nl(e,t,i,h,d);let u=s.call(c,n,r,o,a,l);return Lw.forEach(p=>{let _=d.get(p);if(_)try{c.setRequestHeader(p,_)}catch{}}),u})};R.__PosthogExtensions__.tracingHeadersPatchFns=C_,R.postHogTracingHeadersPatchFns=C_,typeof[].at!="function"&&Object.defineProperty(Array.prototype,"at",{value(e){let t=this.length,i=Math.trunc(e)||0;return 0>i&&(i+=t),0>i||i>=t?void 0:this[i]},writable:!0,enumerable:!1,configurable:!0}),typeof[].findLast!="function"&&Object.defineProperty(Array.prototype,"findLast",{value(e,t){for(let i=this.length-1;i>=0;i--){let s=this[i];if(e.call(t,s,i,this))return s}}
110,writable:!0,enumerable:!1,configurable:!0});var E_=class{constructor(){this.t=void 0,this.o=0,this.i=[]}l(e){var t;if(e.hadRecentInput)return;let i=this.i[0],s=this.i.at(-1);this.o&&i&&s&&1e3>e.startTime-s.startTime&&5e3>e.startTime-i.startTime?(this.o+=e.value,this.i.push(e)):(this.o=e.value,this.i=[e]),(t=this.t)===null||t===void 0||t.call(this,e)}},Nr=()=>{let e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},Rr=e=>{if(document.readyState==="loading")return"loading";let t=Nr();if(t){if(t.domInteractive>e)return"loading";if(t.domContentLoadedEventStart===0||t.domContentLoadedEventStart>e)return"dom-interactive";if(t.domComplete===0||t.domComplete>e)return"dom-content-loaded"}return"complete"},Ow=e=>{let t=e.nodeName;return e.nodeType===1?t.toLowerCase():t.toUpperCase().replace(/^#/,"")},Rd=e=>{let t="";try{for(;e?.nodeType!==9;){var i;let s=e,n=s.id?"#"+s.id:[Ow(s),...Array.from((i=s.classList)!==null&&i!==void 0?i:[]).sort()].join(".");if(t.length+n.length>99)return t||n;if(t=t?n+">"+t:n,s.id)break;e=s.parentNode}}catch{}return t},x_=new WeakMap;function Ui(e,t){let i=x_.get(t);return i||(i=new WeakMap,x_.set(t,i)),i.get(e)||i.set(e,new t),i.get(e)}var t0=-1,vn=()=>t0,Br=e=>{addEventListener("pageshow",t=>{t.persisted&&(t0=t.timeStamp,e(t))},!0)},ii=(e,t,i,s)=>{let n,r;return o=>{var a;t.value>=0&&(o||s)&&(r=t.value-((a=n)!==null&&a!==void 0?a:0),(r||n===void 0)&&(n=t.value,t.delta=r,t.rating=((l,c)=>l>c[1]?"poor":l>c[0]?"needs-improvement":"good")(t.value,i),e(t)))}},Fd=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},ja=()=>{var e,t;return(e=(t=Nr())===null||t===void 0?void 0:t.activationStart)!==null&&e!==void 0?e:0},ts=-1,i0=new Set,T_=()=>document.visibilityState!=="hidden"||document.prerendering?1/0:0,gu=e=>{if(document.visibilityState==="hidden"){if(e.type==="visibilitychange")for(let t of i0)t();isFinite(ts)||(ts=e.type==="visibilitychange"?e.timeStamp:0,removeEventListener("prerenderingchange",gu,!0))}},Fr=(e=!1)=>{if(e&&(ts=1/0),0>ts){var t;let i=ja(),s=document.prerendering||(t=globalThis.performance.getEntriesByType("visibility-state").find(n=>n.name==="hidden"&&n.startTime>=i))===null||t===void 0?void 0:t.startTime;ts=s??T_(),addEventListener("visibilitychange",gu,!0),addEventListener("prerenderingchange",gu,!0),Br(()=>{setTimeout(()=>{ts=T_()})})}return{get firstHiddenTime(){return ts},onHidden(i){i0.add(i)}}},bi=(e,t=-1,i,s=0,n,r,o)=>{let a=Nr(),l=a?.navigationId||0,c="navigate";return i?c=i:0>vn()?a&&(document.prerendering||ja()>0?c="prerender":document.wasDiscarded?c="restore":a.type&&(c=a.type.replace(/_/g,"-"))):c="back-forward-cache",{name:e,value:t,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:c,navigationId:s||l,navigationInteractionId:n,navigationURL:r||a?.name,navigationStartTime:o||0}},Bi=(e,t,i={})=>{try{let s=e.filter(n=>PerformanceObserver.supportedEntryTypes.includes(n));if(s.length>0){let n=new PerformanceObserver(r=>{queueMicrotask(()=>{let o=r.getEntries();s.length>1&&o.sort((a,l)=>a.startTime+a.duration-(l.startTime+l.duration)),t(o)})});for(let r of s)n.observe(b({type:r,buffered:!0},i));return n}}catch{}},un=e=>{var t,i;return((t=globalThis.PerformanceObserver)===null||t===void 0||(t=t.supportedEntryTypes)===null||t===void 0?void 0:t.includes("soft-navigation"))&&typeof((i=globalThis.PerformanceSoftNavigation)===null||i===void 0||(i=i.prototype)===null||i===void 0?void 0:i.getLargestInteractionContentfulPaint)=="function"&&e&&e.reportSoftNavs},s0=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){let i=e.keys().next().value;i!==void 0&&e.delete(i)}},n0=e=>{let t=!1;return()=>{t||(e(),t=!0)}},r0=class{constructor(){this.u=void 0}},Ad=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},Bl=[1800,3e3],o0=(e,t={})=>{let i=un(t);Ad(()=>{let s=Ui(t,r0),n=Fr(),r,o=bi("FCP"),a=Bi(["paint"],l=>{for(let c of l)c.name==="first-contentful-paint"&&(a.disconnect(),n.firstHiddenTime>c.startTime&&(o.value=Math.max(c.startTime-ja(),0),o.entries.push(c),o.navigationId=c.navigationId||o.navigationId,r(!0)))});a&&(r=ii(e,o,Bl,t.reportAllChanges),Br(l=>{o=bi("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,vn()),r=ii(e,o,Bl,t.reportAllChanges),Fd(()=>{o.value=performance.now()-l.timeStamp,r(!0)})}
vendor: 4,258 bytes, line 110
110)),i&&Bi(["soft-navigation"],l=>{l.forEach(c=>{s.u&&c.navigationId&&s0(s.u,c);let d=Math.max((c.presentationTime||c.paintTime||0)-c.startTime,0);o=bi("FCP",d,"soft-navigation",c.navigationId,c.interactionId,c.name,c.startTime),r=ii(e,o,Bl,t.reportAllChanges),r(!0)})},t)})},I_=[.1,.25],M_=e=>e.find(t=>{var i;return((i=t.node)===null||i===void 0?void 0:i.nodeType)===1})||e[0],a0=(e,t={})=>{let i=Ui(t=Object.assign({},t),E_),s=new WeakMap;i.t=n=>{var r;if(!(n==null||(r=n.sources)===null||r===void 0)&&r.length){let l=M_(n.sources),c=l?.node;if(c){var o,a;let d=(o=(a=t.generateTarget)===null||a===void 0?void 0:a.call(t,c))!==null&&o!==void 0?o:Rd(c);s.set(l,d)}}},((n,r={})=>{let o=Fr();o0(n0(()=>{let a,l=bi("CLS",0),c=Ui(r,E_),d=(v,f,m,y,w)=>{l=bi("CLS",0,v,f,m,y,w),c.o=0,a=ii(n,l,I_,r.reportAllChanges)},h=(v=!1)=>{c.o>l.value&&(l.value=c.o,l.entries=c.i),a(v)},u=v=>{h(!0),d("soft-navigation",v.navigationId,v.interactionId,v.name,v.startTime)},p=v=>{for(let f of v)f.entryType!=="soft-navigation"?c.l(f):u(f);h()},_=["layout-shift"];un(r)&&_.push("soft-navigation");let g=Bi(_,p);g&&(a=ii(n,l,I_,r.reportAllChanges),o.onHidden(()=>{p(g.takeRecords()),a(!0)}),Br(()=>{d("back-forward-cache",l.navigationId,l.navigationInteractionId,l.navigationURL,vn()),Fd(a)}),setTimeout(a))}))})(n=>{e((r=>{let o={};if(r.entries.length){var a;let l=r.entries.reduce((c,d)=>c.value>d.value?c:d);if(!(l==null||(a=l.sources)===null||a===void 0)&&a.length){let c=M_(l.sources);c&&(o={largestShiftTarget:s.get(c),largestShiftTime:l.startTime,largestShiftValue:l.value,largestShiftSource:c,largestShiftEntry:l,loadState:Rr(l.startTime)})}}return Object.assign(r,{attribution:o})})(n))},t)},l0=(e,t={})=>{let i=Ui(t=Object.assign({},t),r0);un(t)&&(i.u=new Map),o0(s=>{e((n=>{let r={timeToFirstByte:0,firstByteToFCP:n.value,loadState:Rr(vn())};if(n.navigationType!=="soft-navigation"){if(n.entries.length){let a=Nr(),l=n.entries.at(-1);if(a){let c=Math.max(0,a.responseStart-(a.activationStart||0));r={timeToFirstByte:c,firstByteToFCP:n.value-c,loadState:Rr(n.entries[0].startTime),navigationEntry:a,fcpEntry:l}}}}else{var o;let a=(o=i.u)===null||o===void 0?void 0:o.get(n.navigationId);a&&(r={timeToFirstByte:0,firstByteToFCP:n.value,loadState:"complete",navigationEntry:a})}return Object.assign(n,{attribution:r})})(s))},t)},c0=0,ql=1/0,bo=0,$w=e=>{for(let t of e)t.interactionId&&(ql=Math.min(ql,t.interactionId),bo=Math.max(bo,t.interactionId),c0=bo?(bo-ql)/7+1:0)},fu,P_=()=>{var e;return fu?c0:(e=performance.interactionCount)!==null&&e!==void 0?e:0},R_=class{constructor(){this.h=0,this.v=[],this.p=new Map,this.m=void 0,this.M=void 0}T(){return P_()-this.h}D(){this.h=P_(),this.v.length=0,this.p.clear()}S(e){let t=this.T(),i=Math.min(this.v.length-1,Math.floor(t/50));return!t||i!==-1||e!=="soft-navigation"&&e!=="back-forward-cache"?this.v[i]:{k:8,id:-1,entries:[]}}l(e){var t;if((t=this.m)===null||t===void 0||t.call(this,e),!e.interactionId)return;let i=this.v.at(-1),s=this.p.get(e.interactionId);if(s||10>this.v.length||e.duration>i.k){var n;if(s?e.duration>s.k?(s.entries=[e],s.k=e.duration):e.duration===s.k&&e.startTime===s.entries[0].startTime&&s.entries.push(e):(s={id:e.interactionId,entries:[e],k:e.duration},this.p.set(s.id,s),this.v.push(s)),this.v.sort((r,o)=>o.k-r.k),this.v.length>10){let r=this.v.splice(10);for(let o of r)this.p.delete(o.id)}(n=this.M)===null||n===void 0||n.call(this,s)}}},vu=e=>{let t="requestIdleCallback"in globalThis?1e3:0,i=globalThis.requestIdleCallback||setTimeout,s=globalThis.cancelIdleCallback||clearTimeout;if(document.visibilityState==="hidden")e();else{let n=n0(e),r=-1,o=()=>{s(r),n()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),r=i(()=>{removeEventListener("visibilitychange",o,{capture:!0}),n()},{timeout:t})}},F_=[200,500],u0=(e,t={})=>{let i=Ui(t=Object.assign({},t),R_),s=[],n=[],r=0,o=new WeakMap,a=new WeakMap,l=!1,c=()=>{l||(vu(d),l=!0)},d=()=>{let u=new Set(i.v.map(g=>o.get(g.entries[0]))),p=n.length-10;n=n.filter((g,v)=>v>=p||u.has(g));let _=new Set;for(let g of n){let v=h(g.startTime,g.processingEnd);for(let f of v)_.add(f)}s=s.filter(g=>g.startTime>r||_.has(g)),l=!1};i.m=u=>{let p=u.startTime+u.duration,_;r=Math.max(r,u.processingEnd);for(let g=n.length-1;g>=0;g--){let v=n[g];
110if(8>=Math.abs(p-v.renderTime)){_=v,_.startTime=Math.min(u.startTime,_.startTime),_.processingStart=Math.min(u.processingStart,_.processingStart),_.processingEnd=Math.max(u.processingEnd,_.processingEnd),t.includeProcessedEventEntries&&_.entries.push(u);break}}_||(_={startTime:u.startTime,processingStart:u.processingStart,processingEnd:u.processingEnd,renderTime:p,entries:t.includeProcessedEventEntries?[u]:[]},n.push(_)),u.interactionId&&o.set(u,_),c()},i.M=u=>{if(!a.get(u)){var p;let f=(p=u.entries.find(m=>m.target))===null||p===void 0?void 0:p.target;if(f){var _,g;let m=(_=(g=t.generateTarget)===null||g===void 0?void 0:g.call(t,f))!==null&&_!==void 0?_:Rd(f);a.set(u,m)}else{var v;let m=(v=u.entries.find(y=>y.targetSelector))===null||v===void 0?void 0:v.targetSelector;m&&a.set(u,m)}}};let h=(u,p)=>{let _=[];for(let g of s)if(g.startTime+g.duration>=u){if(g.startTime>p)break;_.push(g)}return _};Bi(["long-animation-frame"],u=>{s=s.concat(u),c()},t),((u,p={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;let _=Fr();Ad(()=>{var g;"interactionCount"in performance||fu||(fu=Bi(["event"],$w,{durationThreshold:0}));let v,f=bi("INP"),m=Ui(p,R_),y=(E,I,P,O,L)=>{m.D(),f=bi("INP",-1,E,I,P,O,L),v=ii(u,f,F_,p.reportAllChanges)},w=()=>{let E=m.S(f.navigationType);E&&E.k!==f.value&&(f.value=E.k,f.entries=E.entries,v())},S=E=>{w(),v(!0),y("soft-navigation",E.navigationId,E.interactionId,E.name,E.startTime)},x=(E,I=!1)=>{vu(()=>{for(let P of E)P.entryType!=="soft-navigation"?m.l(P):S(P);w(),I&&v(!0)})},k=["event","first-input"];un(p)&&k.push("soft-navigation");let C=Bi(k,x,b(b({},p),{},{durationThreshold:(g=p.durationThreshold)!==null&&g!==void 0?g:40}));v=ii(u,f,F_,p.reportAllChanges),C&&(_.onHidden(()=>{x(C.takeRecords(),!0)}),Br(()=>{y("back-forward-cache",f.navigationId,f.navigationInteractionId,f.navigationURL,vn())}))})})(u=>{e((p=>{if(p.entries.length===0){let k={processedEventEntries:[],longAnimationFrameEntries:[],inputDelay:0,processingDuration:0,presentationDelay:p.value,loadState:Rr(p.navigationStartTime||0)};return Object.assign(p,{attribution:k})}let _=p.entries[0],g=o.get(_),v=Math.max(g.processingStart,_.startTime),f=Math.max(_.startTime+_.duration,v),m=Math.min(g.processingEnd,f),y=g.entries.sort((k,C)=>k.processingStart-C.processingStart),w=h(_.startTime,m),S=i.p.get(_.interactionId),x={interactionTarget:a.get(S),interactionType:_.name.startsWith("key")?"keyboard":"pointer",interactionTime:_.startTime,nextPaintTime:f,processedEventEntries:y,longAnimationFrameEntries:w,inputDelay:v-_.startTime,processingDuration:m-v,presentationDelay:f-m,loadState:Rr(_.startTime),longestScript:void 0,totalScriptDuration:void 0,totalStyleAndLayoutDuration:void 0,totalPaintDuration:void 0,totalUnattributedDuration:void 0};return(k=>{var C;let E=k.interactionTime,I=k.nextPaintTime;if(!(!((C=k.longAnimationFrameEntries)===null||C===void 0)&&C.length)||!E||!I)return;let P=k.inputDelay,O=k.processingDuration,L,A,B=0,q=0,K=0,U=0;for(let N of k.longAnimationFrameEntries){q=q+N.startTime+N.duration-N.styleAndLayoutStart;for(let V of N.scripts){let Q=V.startTime+V.duration;if(E>Q)continue;let z=Q-Math.max(E,V.startTime),ae=V.duration?z/V.duration*V.forcedStyleAndLayoutDuration:0;B+=z-ae,q+=ae,z>U&&(A=E+P>V.startTime?"input-delay":E+P+O>V.startTime?"processing-duration":"presentation-delay",L=V,U=z)}}let ce=k.longAnimationFrameEntries.at(-1),j=ce?ce.startTime+ce.duration:0;j>=E+P+O&&(K=I-j),L&&A&&(k.longestScript={entry:L,subpart:A,intersectingDuration:U}),k.totalScriptDuration=B,k.totalStyleAndLayoutDuration=q,k.totalPaintDuration=K,k.totalUnattributedDuration=I-E-B-q-K})(x),Object.assign(p,{attribution:x})})(u))},t)},A_=class{constructor(){this.m=void 0,this.u=void 0}l(e){var t;(t=this.m)===null||t===void 0||t.call(this,e)}},Hl=[2500,4e3],d0=50,Vo=[];Bi(["resource"],e=>{for(let t of e)Vo.push(t),Vo.length>d0&&Vo.shift()});var h0=(e,t={})=>{(t=Object.assign({},t)).resourceBufferSize!=null&&(d0=t.resourceBufferSize);let i=Ui(t,A_),s=new WeakMap;un(t)&&(i.u=new Map),i.m=n=>{let r=n.element;if(r){var o,a;let l=(o=(a=t.generateTarget)===null||a===void 0?void 0:a.call(t,r))!==null&&o!==void 0?o:Rd(r);s.set(n,l)}else n.id&&s.set(n,`#${n.id}`)},((n,r={})=>{let o=!1,a=un(r);Ad(()=>{let l,c=Fr(),d=bi("LCP"),h=Ui(r,A_),u=(f,m,y,w,S)=>{d=bi("LCP",-1,f,m,y,w,S),l=ii(n,d,Hl,r.reportAllChanges),o=!1,f==="soft-navigation"&&(c=Fr(!0))},p=f=>{var m;h.u&&f.navigationId&&s0(h.u,f),o||l(!0),u("soft-navigation",f.navigationId,f.interactionId,f.n
110ame,f.startTime);let y=(m=f.getLargestInteractionContentfulPaint)===null||m===void 0?void 0:m.call(f);y&&_([y])},_=f=>{r.reportAllChanges||a||(f=f.slice(-1));for(let y of f){if(!y)continue;if(y.entryType==="soft-navigation"){p(y);continue}let w=0,S=[],x=y.startTime;if(y.entryType==="largest-contentful-paint")w=Math.max(y.startTime-ja(),0),h.l(y),S=[y];else if(y.entryType==="interaction-contentful-paint"){var m;let k=y;if(!d.navigationId||"interactionId"in k&&k.interactionId!=d.navigationInteractionId)continue;x=((m=k.largestContentfulPaint)===null||m===void 0?void 0:m.renderTime)||0,w=Math.max(x-y.startTime,0),k.largestContentfulPaint&&(h.l(k.largestContentfulPaint),S=[k.largestContentfulPaint])}c.firstHiddenTime>x&&(d.value=w,d.entries=S,l())}},g=["largest-contentful-paint"];a&&g.push("interaction-contentful-paint","soft-navigation");let v=Bi(g,_);if(v){l=ii(n,d,Hl,r.reportAllChanges);let f=["keydown","click","visibilitychange"],m=y=>{if(y.isTrusted&&!o){let w=d.id;vu(()=>{if(!o){if(!a){v.disconnect();for(let S of f)removeEventListener(S,m,{capture:!0})}w===d.id&&(o=!0,l(!0))}})}};for(let y of f)addEventListener(y,m,{capture:!0});Br(y=>{u("back-forward-cache",d.navigationId,d.navigationInteractionId,d.navigationURL,vn()),l=ii(n,d,Hl,r.reportAllChanges),Fd(()=>{d.value=performance.now()-y.timeStamp,o=!0,l(!0)})})}})})(n=>{e((r=>{let o={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:r.value};if(r.entries.length){var a,l,c;let d=r.entries.at(-1),h=d.url&&(Vo.findLast(g=>g.name===d.url)||performance.getEntriesByType("resource").findLast(g=>g.name===d.url)),u;o.target=s.get(d),o.lcpEntry=d,d.url&&(o.url=d.url),h&&(o.lcpResourceEntry=h);let p=0,_=0;if(r.navigationType!=="soft-navigation"?(u=Nr(),p=(a=u?.activationStart)!==null&&a!==void 0?a:0,_=(l=u?.responseStart)!==null&&l!==void 0?l:0):(p=r.navigationStartTime||0,u=(c=i.u)===null||c===void 0?void 0:c.get(r.navigationId)),u){let g=Math.max(0,_-p),v=Math.max(g,h?(h.requestStart||h.startTime)-p:0),f=Math.min(r.value,Math.max(v,h?h.responseEnd-p:0));o=b(b({},o),{},{timeToFirstByte:g,resourceLoadDelay:v-g,resourceLoadDuration:f-v,elementRenderDelay:r.value-f,navigationEntry:u})}}return Object.assign(r,{attribution:o})})(n))},t)},p0=-1,qr=()=>p0,Hr=e=>{addEventListener("pageshow",t=>{t.persisted&&(p0=t.timeStamp,e(t))},!0)},si=(e,t,i,s)=>{let n,r;return o=>{var a;t.value>=0&&(o||s)&&(r=t.value-((a=n)!==null&&a!==void 0?a:0),(r||n===void 0)&&(n=t.value,t.delta=r,t.rating=((l,c)=>l>c[1]?"poor":l>c[0]?"needs-improvement":"good")(t.value,i),e(t)))}},Ld=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},_0=()=>{let e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},Va=()=>{var e,t;return(e=(t=_0())===null||t===void 0?void 0:t.activationStart)!==null&&e!==void 0?e:0},is=-1,g0=new Set,L_=()=>document.visibilityState!=="hidden"||document.prerendering?1/0:0,mu=e=>{if(document.visibilityState==="hidden"){if(e.type==="visibilitychange")for(let t of g0)t();isFinite(is)||(is=e.type==="visibilitychange"?e.timeStamp:0,removeEventListener("prerenderingchange",mu,!0))}},Ar=(e=!1)=>{if(e&&(is=1/0),0>is){var t;let i=Va(),s=document.prerendering||(t=globalThis.performance.getEntriesByType("visibility-state").find(n=>n.name==="hidden"&&n.startTime>=i))===null||t===void 0?void 0:t.startTime;is=s??L_(),addEventListener("visibilitychange",mu,!0),addEventListener("prerenderingchange",mu,!0),Hr(()=>{setTimeout(()=>{is=L_()})})}return{get firstHiddenTime(){return is},onHidden(i){g0.add(i)}}},Si=(e,t=-1,i,s=0,n,r,o)=>{let a=_0(),l=a?.navigationId||0,c="navigate";return i?c=i:0>qr()?a&&(document.prerendering||Va()>0?c="prerender":document.wasDiscarded?c="restore":a.type&&(c=a.type.replace(/_/g,"-"))):c="back-forward-cache",{name:e,value:t,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:c,navigationId:s||l,navigationInteractionId:n,navigationURL:r||a?.name,navigationStartTime:o||0}},O_=new WeakMap;function Ga(e,t){let i=O_.get(t);
vendor: 4,263 bytes, line 110
110return i||(i=new WeakMap,O_.set(t,i)),i.get(e)||i.set(e,new t),i.get(e)}var Dw=class{constructor(){this.t=void 0,this.i=0,this.o=[]}h(e){var t;if(e.hadRecentInput)return;let i=this.o[0],s=this.o.at(-1);this.i&&i&&s&&1e3>e.startTime-s.startTime&&5e3>e.startTime-i.startTime?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),(t=this.t)===null||t===void 0||t.call(this,e)}},dn=(e,t,i={})=>{try{let s=e.filter(n=>PerformanceObserver.supportedEntryTypes.includes(n));if(s.length>0){let n=new PerformanceObserver(r=>{queueMicrotask(()=>{let o=r.getEntries();s.length>1&&o.sort((a,l)=>a.startTime+a.duration-(l.startTime+l.duration)),t(o)})});for(let r of s)n.observe(b({type:r,buffered:!0},i));return n}}catch{}},Qa=e=>{var t,i;return((t=globalThis.PerformanceObserver)===null||t===void 0||(t=t.supportedEntryTypes)===null||t===void 0?void 0:t.includes("soft-navigation"))&&typeof((i=globalThis.PerformanceSoftNavigation)===null||i===void 0||(i=i.prototype)===null||i===void 0?void 0:i.getLargestInteractionContentfulPaint)=="function"&&e&&e.reportSoftNavs},f0=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){let i=e.keys().next().value;i!==void 0&&e.delete(i)}},v0=e=>{let t=!1;return()=>{t||(e(),t=!0)}},Nw=class{constructor(){this.l=void 0}},Od=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},Ul=[1800,3e3],Ur=(e,t={})=>{let i=Qa(t);Od(()=>{let s=Ga(t,Nw),n=Ar(),r,o=Si("FCP"),a=dn(["paint"],l=>{for(let c of l)c.name==="first-contentful-paint"&&(a.disconnect(),n.firstHiddenTime>c.startTime&&(o.value=Math.max(c.startTime-Va(),0),o.entries.push(c),o.navigationId=c.navigationId||o.navigationId,r(!0)))});a&&(r=si(e,o,Ul,t.reportAllChanges),Hr(l=>{o=Si("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,qr()),r=si(e,o,Ul,t.reportAllChanges),Ld(()=>{o.value=performance.now()-l.timeStamp,r(!0)})})),i&&dn(["soft-navigation"],l=>{l.forEach(c=>{s.l&&c.navigationId&&f0(s.l,c);let d=Math.max((c.presentationTime||c.paintTime||0)-c.startTime,0);o=Si("FCP",d,"soft-navigation",c.navigationId,c.interactionId,c.name,c.startTime),r=si(e,o,Ul,t.reportAllChanges),r(!0)})},t)})},$_=[.1,.25],Ka=(e,t={})=>{let i=Ar();Ur(v0(()=>{let s,n=Si("CLS",0),r=Ga(t,Dw),o=(u,p,_,g,v)=>{n=Si("CLS",0,u,p,_,g,v),r.i=0,s=si(e,n,$_,t.reportAllChanges)},a=(u=!1)=>{r.i>n.value&&(n.value=r.i,n.entries=r.o),s(u)},l=u=>{a(!0),o("soft-navigation",u.navigationId,u.interactionId,u.name,u.startTime)},c=u=>{for(let p of u)p.entryType!=="soft-navigation"?r.h(p):l(p);a()},d=["layout-shift"];Qa(t)&&d.push("soft-navigation");let h=dn(d,c);h&&(s=si(e,n,$_,t.reportAllChanges),i.onHidden(()=>{c(h.takeRecords()),s(!0)}),Hr(()=>{o("back-forward-cache",n.navigationId,n.navigationInteractionId,n.navigationURL,qr()),Ld(s)}),setTimeout(s))}))},m0=0,Wl=1/0,So=0,Bw=e=>{for(let t of e)t.interactionId&&(Wl=Math.min(Wl,t.interactionId),So=Math.max(So,t.interactionId),m0=So?(So-Wl)/7+1:0)},yu,D_=()=>{var e;return yu?m0:(e=performance.interactionCount)!==null&&e!==void 0?e:0},qw=class{constructor(){this.u=0,this.v=[],this.m=new Map,this.p=void 0,this.T=void 0}_(){return D_()-this.u}M(){this.u=D_(),this.v.length=0,this.m.clear()}L(e){let t=this._(),i=Math.min(this.v.length-1,Math.floor(t/50));return!t||i!==-1||e!=="soft-navigation"&&e!=="back-forward-cache"?this.v[i]:{P:8,id:-1,entries:[]}}h(e){var t;if((t=this.p)===null||t===void 0||t.call(this,e),!e.interactionId)return;let i=this.v.at(-1),s=this.m.get(e.interactionId);if(s||10>this.v.length||e.duration>i.P){var n;if(s?e.duration>s.P?(s.entries=[e],s.P=e.duration):e.duration===s.P&&e.startTime===s.entries[0].startTime&&s.entries.push(e):(s={id:e.interactionId,entries:[e],P:e.duration},this.m.set(s.id,s),this.v.push(s)),this.v.sort((r,o)=>o.P-r.P),this.v.length>10){let r=this.v.splice(10);for(let o of r)this.m.delete(o.id)}(n=this.T)===null||n===void 0||n.call(this,s)}}},y0=e=>{let t="requestIdleCallback"in globalThis?1e3:0,i=globalThis.requestIdleCallback||setTimeout,s=globalThis.cancelIdleCallback||clearTimeout;if(document.visibilityState==="hidden")e();else{let n=v0(e),r=-1,o=()=>{s(r),n()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),r=i(()=>{removeEventListener("visibilitychange",o,{capture:!0}),n()},{timeout:t})}},N_=[200,500],Ja=(e,t={})=>
110{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;let i=Ar();Od(()=>{var s;"interactionCount"in performance||yu||(yu=dn(["event"],Bw,{durationThreshold:0}));let n,r=Si("INP"),o=Ga(t,qw),a=(p,_,g,v,f)=>{o.M(),r=Si("INP",-1,p,_,g,v,f),n=si(e,r,N_,t.reportAllChanges)},l=()=>{let p=o.L(r.navigationType);p&&p.P!==r.value&&(r.value=p.P,r.entries=p.entries,n())},c=p=>{l(),n(!0),a("soft-navigation",p.navigationId,p.interactionId,p.name,p.startTime)},d=(p,_=!1)=>{y0(()=>{for(let g of p)g.entryType!=="soft-navigation"?o.h(g):c(g);l(),_&&n(!0)})},h=["event","first-input"];Qa(t)&&h.push("soft-navigation");let u=dn(h,d,b(b({},t),{},{durationThreshold:(s=t.durationThreshold)!==null&&s!==void 0?s:40}));n=si(e,r,N_,t.reportAllChanges),u&&(i.onHidden(()=>{d(u.takeRecords(),!0)}),Hr(()=>{a("back-forward-cache",r.navigationId,r.navigationInteractionId,r.navigationURL,qr())}))})},Hw=class{constructor(){this.p=void 0,this.l=void 0}h(e){var t;(t=this.p)===null||t===void 0||t.call(this,e)}},zl=[2500,4e3],Ya=(e,t={})=>{let i=!1,s=Qa(t);Od(()=>{let n,r=Ar(),o=Si("LCP"),a=Ga(t,Hw),l=(p,_,g,v,f)=>{o=Si("LCP",-1,p,_,g,v,f),n=si(e,o,zl,t.reportAllChanges),i=!1,p==="soft-navigation"&&(r=Ar(!0))},c=p=>{var _;a.l&&p.navigationId&&f0(a.l,p),i||n(!0),l("soft-navigation",p.navigationId,p.interactionId,p.name,p.startTime);let g=(_=p.getLargestInteractionContentfulPaint)===null||_===void 0?void 0:_.call(p);g&&d([g])},d=p=>{t.reportAllChanges||s||(p=p.slice(-1));for(let g of p){if(!g)continue;if(g.entryType==="soft-navigation"){c(g);continue}let v=0,f=[],m=g.startTime;if(g.entryType==="largest-contentful-paint")v=Math.max(g.startTime-Va(),0),a.h(g),f=[g];else if(g.entryType==="interaction-contentful-paint"){var _;let y=g;if(!o.navigationId||"interactionId"in y&&y.interactionId!=o.navigationInteractionId)continue;m=((_=y.largestContentfulPaint)===null||_===void 0?void 0:_.renderTime)||0,v=Math.max(m-g.startTime,0),y.largestContentfulPaint&&(a.h(y.largestContentfulPaint),f=[y.largestContentfulPaint])}r.firstHiddenTime>m&&(o.value=v,o.entries=f,n())}},h=["largest-contentful-paint"];s&&h.push("interaction-contentful-paint","soft-navigation");let u=dn(h,d);if(u){n=si(e,o,zl,t.reportAllChanges);let p=["keydown","click","visibilitychange"],_=g=>{if(g.isTrusted&&!i){let v=o.id;y0(()=>{if(!i){if(!s){u.disconnect();for(let f of p)removeEventListener(f,_,{capture:!0})}v===o.id&&(i=!0,n(!0))}})}};for(let g of p)addEventListener(g,_,{capture:!0});Hr(g=>{l("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,qr()),n=si(e,o,zl,t.reportAllChanges),Ld(()=>{o.value=performance.now()-g.timeStamp,i=!0,n(!0)})})}})},jl={onLCP:h0,onCLS:a0,onFCP:l0,onINP:u0,withoutAttribution:{onLCP:Ya,onCLS:Ka,onFCP:Ur,onINP:Ja}};R.__PosthogExtensions__=R.__PosthogExtensions__||{},R.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=R.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},R.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution-soft-navs"]=jl,R.__PosthogExtensions__.postHogWebVitalsCallbacks=jl,R.postHogWebVitalsCallbacks=jl;var wo={onLCP:Ya,onCLS:Ka,onFCP:Ur,onINP:Ja};R.__PosthogExtensions__=R.__PosthogExtensions__||{},R.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=R.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},R.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-soft-navs"]=wo,R.__PosthogExtensions__.postHogWebVitalsCallbacks=wo,R.postHogWebVitalsCallbacks=wo,R.__PosthogExtensions__.loadWebVitalsCallbacks=()=>wo;var Vl={onLCP:h0,onCLS:a0,onFCP:l0,onINP:u0,withoutAttribution:{onLCP:Ya,onCLS:Ka,onFCP:Ur,onINP:Ja}};R.__PosthogExtensions__=R.__PosthogExtensions__||{},R.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=R.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},R.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution"]=Vl,R.__PosthogExtensions__.postHogWebVitalsCallbacks=Vl,R.postHogWebVitalsCallbacks=Vl;var ko={onLCP:Ya,onCLS:Ka,onFCP:Ur,onINP:Ja};R.__PosthogExtensions__=R.__PosthogExtensions__||{},R.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=R.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},R.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals"]=ko,R.__PosthogExtensions__.postHogWebVitalsCallbacks=ko,R.postHogWebVitalsCallbacks=ko,R.__PosthogExtensions__.loadWebVitalsCallbacks=()=>ko;var b0=class{constructor(e){this.disabled=e===!1;let t=ee(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,i){if(this.disabled)return!1;let s=this.clicks[this.clicks.length-1];if(s&&Math.abs(e-s.x)+Math.abs(t-s.y)<this.thresholdPx&&this.timeoutMs>i-s.timestamp){if(this.clicks.push({x:e,y:t,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:i}];return!1}},Gl="$copy_autocapture",Ql=Ie("[AutoCapture]");function Kl(e,t){return t.length>e?t.slice(0,e)+"...":t}function Uw(e){if(e.previousElementSibling)return e.previousElementSibling;let t=e;do t=t.previousSibling;while(t&&!_t(t));return t}function S0(e,{e:t,maskAllElementAttributes:i,maskAllText:s,elementAttributeIgnoreList:n,elementsC
110hainAsString:r,disableCaptureUrlHashes:o}){var a,l;if(!_t(e))return{props:{}};let c=[e],d=new Set([e]),h=e;for(;h.parentNode&&!ot(h,"body")&&1e3>c.length;){if(Qu(h.parentNode)){let x=h.parentNode.host;if(d.has(x))break;d.add(x),c.push(x),h=x;continue}if(!_t(h.parentNode)||d.has(h.parentNode))break;d.add(h.parentNode),c.push(h.parentNode),h=h.parentNode}let u=t.type==="click"&&e.namespaceURI==="http://www.w3.org/2000/svg"?c.findIndex(x=>ot(x,"button")||ot(x,"a")):-1;u>0&&(s=s||c.slice(0,u+1).some(x=>!Gs(x)||xr(x)));let p=[],_={},g,v=!1,f=!1;if(xe(c,x=>{let k=Gs(x);if(ot(x,"a")&&!i&&!n?.includes("href")){let C=x.getAttribute("href");v=!!(k&&C&&Qs(C))&&(o?ni(C):C)}ie(tn(x),"ph-no-capture")&&(f=!0),p.push((function(C,E,I,P,O=!1){let L=C.tagName.toLowerCase(),A={tag_name:L};Ju.indexOf(L)>-1&&!I&&(A.$el_text=L.toLowerCase()==="a"||L.toLowerCase()==="button"?Kl(1024,Sh(C)):Kl(1024,Cr(C)));let B=tn(C);E||P?.includes("class")||0>=B.length||(A.classes=B.filter(function(ce){return ce!==""})),xe(C.attributes,function(ce){var j;if((!xr(C)||["name","id","class","aria-label"].indexOf(ce.name)!==-1)&&!P?.includes(ce.name)&&!E&&Qs(ce.value)&&(!oe(j=ce.name)||j.substring(0,10)!=="_ngcontent"&&j.substring(0,7)!=="_nghost")){let N=ce.value;ce.name==="class"&&(N=Ku(N).join(" ")),A["attr__"+ce.name]=Kl(1024,ce.name==="href"&&O?ni(N):N)}});let q=1,K=1,U=C;for(;U=Uw(U);)q++,U.tagName===C.tagName&&K++;return A.nth_child=q,A.nth_of_type=K,A})(x,i,s,n,o)),xe((function(C){if(!Gs(C))return{};let E={};return xe(C.attributes,function(I){if(I.name&&I.name.indexOf("data-ph-capture-attribute")===0){let P=I.name.replace("data-ph-capture-attribute-",""),O=I.value;P&&O&&Qs(O)&&(E[P]=O)}}),E})(x),(C,E)=>{({}).hasOwnProperty.call(_,E)||(_[E]=C)})}),f)return{props:{},explicitNoCapture:f};if(u>0&&(e=c[u],p.splice(0,u)),s||(p[0].$el_text=ot(e,"a")||ot(e,"button")?Sh(e):Cr(e)),v){var m,y;p[0].attr__href=v;let x=(m=Jt(v))===null||m===void 0?void 0:m.host,k=T==null||(y=T.location)===null||y===void 0?void 0:y.host;x&&k&&x!==k&&(g=v)}return{props:Oe((S=t.type,{$event_type:S,$ce_version:1}),r?{}:{$elements:p},{$elements_chain:(w=p,W(w)?(function(x){return x.map(k=>{var C,E;let I="";if(k.tag_name&&(I+=k.tag_name),k.attr_class){k.attr_class.sort();for(let L of k.attr_class)I+=`.${L.replace(/"/g,"")}`}let P=b(b(b(b({},k.text?{text:k.text}:{}),{},{"nth-child":(C=k.nth_child)!==null&&C!==void 0?C:0,"nth-of-type":(E=k.nth_of_type)!==null&&E!==void 0?E:0},k.href?{href:k.href}:{}),k.attr_id?{attr_id:k.attr_id}:{}),k.attributes),O={};return Lo(P).sort(([L],[A])=>(function(B,q){return q>B?-1:B>q?1:0})(L,A)).forEach(([L,A])=>O[wh(L.toString())]=wh(A.toString())),I+=":",I+=Lo(O).map(([L,A])=>`${L}="${A}"`).join(""),I}).join(";")})((function(x){return x.map(k=>{var C,E;let I={text:(C=k.$el_text)===null||C===void 0?void 0:C.slice(0,400),tag_name:k.tag_name,href:(E=k.attr__href)===null||E===void 0?void 0:E.slice(0,2048),attr_class:mb(k),attr_id:k.attr__id,nth_child:k.nth_child,nth_of_type:k.nth_of_type,attributes:{}};return Lo(k).filter(([P])=>P.indexOf("attr__")===0).forEach(([P,O])=>I.attributes[P]=O),I})})(w)):"")},!((a=p[0])===null||a===void 0)&&a.$el_text?{$el_text:(l=p[0])===null||l===void 0?void 0:l.$el_text}:{},g&&t.type==="click"?{$external_click_url:g}:{},_),target:e};var w,S}var Ww=class{_clearPointer(){this._pointerDown=void 0,clearTimeout(this._pointerExpiry),this._pointerExpiry=void 0}_isExcludedPointerTarget(e){var t;if(!Gs(e))return!0;let i=(t=this._refreshConfig().css_selector_ignorelist)!==null&&t!==void 0?t:dl,s=new Set,n=e;for(;n;){if(s.size>=1e3||s.has(n))return!0;s.add(n);let r=n,o=tn(r);if(ie(o,"ph-no-capture")||ie(o,"ph-sensitive")||xr(r)||i.some(l=>Ac(r,l)))return!0;let a=n.parentNode;n=Qu(a)?a.host:a&&_t(a)?a:null}return!1}_trackPointer(e){if(!this.isEnabled||e.type==="pointercancel")return void this._clearPointer();if(e.type==="pointerdown"){this._clearPointer();let s=Ni(e);var t;return void(e.isPrimary&&e.button===0&&!e.ctrlKey&&s&&_t(s)&&(this._pointerDown={target:s,excluded:this._isExcludedPointerTarget(s),id:e.pointerId,x:e.clientX,y:e.clientY,released:!1,distinctId:(t=this._client)===null||t===void 0?void 0:t.distinctId}))}let i=this._pointerDown;
110i&&(e.pointerId!==i.id||Math.abs(e.clientX-i.x)>5||Math.abs(e.clientY-i.y)>5?this._clearPointer():e.type==="pointerup"&&(i.released=!0,this._pointerExpiry=setTimeout(()=>this._clearPointer(),0)))}_recoverClickTarget(e){var t;let i=this._pointerDown;this._clearPointer();let s=Ni(e);if(i?.released&&i.target.isConnected&&i.distinctId===((t=this._client)===null||t===void 0?void 0:t.distinctId)&&e.pointerId===i.id&&(e.detail>0||e.pointerType==="touch"||e.pointerType==="pen")&&e.button===0&&5>=Math.abs(e.clientX-i.x)&&5>=Math.abs(e.clientY-i.y)&&s&&(ot(s,"html")||ot(s,"body"))){var n;if(i.excluded)return null;let r=(n=this._refreshConfig().css_selector_ignorelist)!==null&&n!==void 0?n:dl;return[s,F?.documentElement,F?.body].some(o=>{if(!o)return!1;let a=tn(o);return ie(a,"ph-no-capture")||ie(a,"ph-sensitive")||!Gs(o)||xr(o)||r.some(l=>Ac(o,l))})?null:i.target}}constructor(e){this._configSource=e,this.name="autocapture",this._initialized=!1,this._isDisabledServerSide=null,this._hasReceivedConfigResponse=!1,this._elementSelectorsByOwner=new Map,this._elementsC
110hainAsString=!1,this._config={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this._disposed=!1,this._configSource.refresh(this._config),this.rageclicks=new b0(this._config.rageclick),this._elementSelectors=null}setup(e){this._compileUrlPatterns(),this._client=e;let t=e.onRemoteConfig(this.onRemoteConfig.bind(this));this._disposed?t.dispose():(this._remoteConfigSubscription=t,this.startIfEnabled())}dispose(){var e;this._disposed||(this._disposed=!0,this._client=void 0,(e=this._remoteConfigSubscription)===null||e===void 0||e.dispose(),this._remoteConfigSubscription=void 0,this._elementSelectorsByOwner.clear(),this._elementSelectors=null,this._removeDomEventHandlers())}_refreshConfig(){return this._configSource.refresh(this._config),this._config}_compileUrlPatterns(){var e,t;return this._refreshConfig(),this._config.url_allowlist=(e=this._config.url_allowlist)===null||e===void 0?void 0:e.map(i=>new RegExp(i)),this._config.url_ignorelist=(t=this._config.url_ignorelist)===null||t===void 0?void 0:t.map(i=>new RegExp(i)),this._config}_addDomEventHandlers(){if(!this.isBrowserSupported())return void Ql.info("Disabling Automatic Event Collection because this browser is not supported");if(!T||!F)return;let e=this._domEventHandler=t=>{t=t||T?.event;try{if(t.type==="blur")return void this._clearPointer();if(t.type.indexOf("pointer")===0)return void this._trackPointer(t);let i=t.type==="click"?this._recoverClickTarget(t):void 0;if(ue(i))return;this._captureEvent(t,"$autocapture",i)}catch(i){Ql.error("Failed to capture event",i)}};if(Z(T,"blur",e),Z(F,"submit",e,{capture:!0}),Z(F,"change",e,{capture:!0}),Z(F,"click",e,{capture:!0}),xe(["pointerdown","pointermove","pointerup","pointercancel"],t=>{Z(F,t,e,{capture:!0})}),this._refreshConfig().capture_copied_text){let t=this._copiedTextHandler=i=>{i=i||T?.event;try{this._captureEvent(i,Gl)}catch(s){Ql.error("Failed to capture clipboard event",s)}};Z(F,"copy",t,{capture:!0}),Z(F,"cut",t,{capture:!0}),Z(F,"paste",t,{capture:!0})}}_removeDomEventHandlers(){this._clearPointer(),this._domEventHandler&&(T?.removeEventListener("blur",this._domEventHandler),xe(["pointerdown","pointermove","pointerup","pointercancel"],e=>{F?.removeEventListener(e,this._domEventHandler,!0)}),F?.removeEventListener("submit",this._domEventHandler,!0),F?.removeEventListener("change",this._domEventHandler,!0),F?.removeEventListener("click",this._domEventHandler,!0),this._domEventHandler=void 0),this._copiedTextHandler&&(F?.removeEventListener("copy",this._copiedTextHandler,!0),F?.removeEventListener("cut",this._copiedTextHandler,!0),F?.removeEventListener("paste",this._copiedTextHandler,!0),this._copiedTextHandler=void 0),this._initialized=!1}startIfEnabled(){this.isEnabled||this._clearPointer(),!this._disposed&&this._client&&this.isEnabled&&!this._initialized&&(this._addDomEventHandlers(),this._initialized=!0)}onRemoteConfig(e){if(this._disposed)return;if(this._hasReceivedConfigResponse=!0,!e.ok)return void this.startIfEnabled();let t=e.config;
110t.elementsChainAsString&&(this._elementsChainAsString=t.elementsChainAsString);let i=t.autocapture_opt_out;var s;Ae(i)&&((s=this._client)===null||s===void 0||s.kv.set("$autocapture_disabled_server_side",i),this._isDisabledServerSide=i),this.startIfEnabled()}setElementSelectors(e,t=this){if(this._disposed)return;e.size?this._elementSelectorsByOwner.set(t,new Set(e)):this._elementSelectorsByOwner.delete(t);let i=new Set;this._elementSelectorsByOwner.forEach(s=>{s.forEach(n=>i.add(n))}),this._elementSelectors=i}getElementSelectors(e,t){var i;let s=[];return(i=this._elementSelectors)===null||i===void 0||i.forEach(n=>{let r=F?.querySelectorAll(n);r?.forEach(o=>{e!==o&&t!==o||ie(s,n)||s.push(n)})}),s}get isEnabled(){var e,t;if(this._disposed)return!1;let i=(e=this._client)===null||e===void 0?void 0:e.kv.get(Cg),s=this._isDisabledServerSide,n=this._refreshConfig();if(!n.remoteRequestsDisabled&&!this._hasReceivedConfigResponse)return!1;let r=n.remoteRequestsDisabled&&!this._hasReceivedConfigResponse;if(ue(s)&&!Ae(i)&&!r)return!1;let o=(t=this._isDisabledServerSide)!==null&&t!==void 0?t:!!i;return!!n.enabled&&!o}_captureEvent(e,t="$autocapture",i){if(!this.isEnabled)return void this._clearPointer();let s=i||Ni(e);Xf(s)&&(s=s.parentNode||null);let n=this._compileUrlPatterns();var r;t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&n.rageclick&&(!((r=this.rageclicks)===null||r===void 0)&&r.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime()))&&sv(s,n.rageclick)&&this._captureEvent(e,"$rageclick",i);let o=t===Gl,a=o?b(b({},n),{},{dom_event_allowlist:void 0}):n;if(s&&(function(h,u,p,_,g,v){var f;if(!T||Er(h)||p?.url_allowlist&&!ph(p.url_allowlist,v)||p?.url_ignorelist&&ph(p.url_ignorelist,v))return!1;if(p?.dom_event_allowlist){let S=p.dom_event_allowlist;if(S&&!S.some(x=>u.type===x))return!1}let{parentIsUsefulElement:m,targetElementList:y}=la(h,_);if(!(function(S,x){let k=x?.element_allowlist;if(M(k))return!0;for(let C of S)if(k.some(E=>C.tagName.toLowerCase()===E))return!0;return!1})(y,p)||!aa(y,p?.css_selector_allowlist)||aa(y,(f=p?.css_selector_ignorelist)!==null&&f!==void 0?f:dl))return!1;try{let S=T.getComputedStyle(h);if(S&&S.getPropertyValue("cursor")==="pointer"&&u.type==="click")return!0}catch{}let w=h.tagName.toLowerCase();switch(w){case"html":return!1;case"form":return(g||["submit"]).indexOf(u.type)>=0;case"input":case"select":case"textarea":return(g||["change","click"]).indexOf(u.type)>=0;default:return m?(g||["click"]).indexOf(u.type)>=0:(g||["click"]).indexOf(u.type)>=0&&(Ju.indexOf(w)>-1||h.getAttribute("contenteditable")==="true")}})(s,e,a,o,o?["copy","cut","paste"]:void 0,{config:{get_current_url:n.getCurrentUrl}})){var l;let{props:h,explicitNoCapture:u,target:p}=S0(s,{e,maskAllElementAttributes:n.maskAllElementAttributes,maskAllText:n.maskAllText,elementAttributeIgnoreList:n.element_attribute_ignorelist,elementsChainAsString:this._elementsC
110hainAsString,disableCaptureUrlHashes:n.disableCaptureUrlHashes});if(u)return!1;let _=this.getElementSelectors(s,p);if(_&&_.length>0&&(h.$element_selectors=_),t===Gl){let g=e.type||"clipboard";if(g!=="paste"){var c,d;let v=T==null||(c=T.getSelection())===null||c===void 0?void 0:c.toString(),f=ev(v);if(!f)return!1;h.$selected_content=f,h.$clipboard_text_length=(d=v?.length)!==null&&d!==void 0?d:0}h.$copy_type=g}return(l=this._client)===null||l===void 0||l.capture(t,h),!0}}isBrowserSupported(){return _e(F?.querySelectorAll)}},Jl={};function B_(e,t){let i=Ni(e);return i?b({node:i,originalEvent:e,timestamp:Date.now()},t):null}function Yl(e){return!!ta(()=>_t(e))}function zw(e,t){return Math.abs(e)<Math.abs(t)?0>t?"up":"down":0>e?"left":"right"}function q_(e){return e.type==="swipe"?"$dead_swipe":"$dead_click"}var H_="canvas,video,audio,embed,object";function Co(e,t){return ne(e)&&e>=t}function w0(e,t=1e3){return e>=0&&t>e?e:void 0}function Zl(e,t,i=1e3){return ne(t)?w0(e-t,i):void 0}var jw=class{_asRequiredConfig(e){var t,i,s,n,r,o,a,l;let c=this._defaultConfig(e?.__onCapture||this._captureDeadClick.bind(this));return{element_attribute_ignorelist:(t=e?.element_attribute_ignorelist)!==null&&t!==void 0?t:c.element_attribute_ignorelist,scroll_threshold_ms:(i=e?.scroll_threshold_ms)!==null&&i!==void 0?i:c.scroll_threshold_ms,selection_change_threshold_ms:(s=e?.selection_change_threshold_ms)!==null&&s!==void 0?s:c.selection_change_threshold_ms,mutation_threshold_ms:(n=e?.mutation_threshold_ms)!==null&&n!==void 0?n:c.mutation_threshold_ms,capture_clicks_with_modifier_keys:(r=e?.capture_clicks_with_modifier_keys)!==null&&r!==void 0?r:c.capture_clicks_with_modifier_keys,capture_dead_swipes:(o=e?.capture_dead_swipes)!==null&&o!==void 0?o:c.capture_dead_swipes,swipe_threshold_px:(a=e?.swipe_threshold_px)!==null&&a!==void 0?a:c.swipe_threshold_px,max_dead_swipes_per_page_load:(l=e?.max_dead_swipes_per_page_load)!==null&&l!==void 0?l:c.max_dead_swipes_per_page_load,css_selector_ignorelist:e?.css_selector_ignorelist,__onCapture:c.__onCapture}}constructor(e,t){this.instance=e,this._observedRoots=new WeakSet,this._hadSelection=!1,this._clicks=[],this._deadSwipesCaptured=0,this._defaultConfig=i=>({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:i}),this._clearMouseSelection=()=>{clearTimeout(this._mouseSelectionTimer),this._mouseSelectionTimer=void 0,this._mouseSelection=void 0},this._onMouseDown=i=>{if(this._observeGesturePath(i),this._clearMouseSelection(),i.button===0){let s={path:i.composedPath(),trusted:i.isTrusted,selectionChanged:!1,selectionInitiallyRelated:!1},n=F?.getSelection();s.selectionInitiallyRelated=n?.type==="Range"&&this._selectionTouchesGesture(n,s),this._mouseSelection=s}},this._onMouseOut=i=>{ue(i.relatedTarget)&&this._clearMouseSelection()},this._onMouseUp=i=>{let s=this._mouseSelection,n=i;if(!s||n.button!==0||i.isTrusted!==s.trusted)return;let r=i.composedPath();for(let o of s.path)if(Yl(o)&&r.indexOf(o)!==-1){s.clickTarget=o;break}s.clickDetail=n.detail,this._mouseSelectionTimer=R.setTimeout(this._clearMouseSelection,0)},this._onClick=i=>{this._observeGesturePath(i);let s=i,n=B_(s,{type:"click"}),r=this._mouseSelection;n&&r&&s.button===0&&s.detail>0&&s.detail===r.clickDetail&&i.isTrusted===r.trusted&&n.node===r.clickTarget&&(n.selectionChangedDuringGesture=r.selectionChanged&&this._config.selection_change_threshold_ms>0,this._clearMouseSelection()),ue(n)||this._ignore(n)||this._queueCandidate(n),this._scheduleCheck()},this._onScroll=()=>{let i=Date.now();this._lastScroll=i,i%50==0&&this._clicks.forEach(s=>{M(s.scrollDelayMs)&&(s.scrollDelayMs=i-s.timestamp)})},this._onSelectionChange=i=>{var s,n;let r=F?.getSelection(),o=this._hadSelection;this._hadSelection=r?.type==="Range";let a=r?.focusNode,l=a&&(_t(a)?a:a.parentElement),c=F?.activeElement,d=c;for(;!(d==null||(s=d.shadowRoot)===null||s===void 0)&&s.activeElement;)d=d.shadowRoot.activeElement;let h=Ps(Ni(i))||Ps(l??null)||Ps((n=d)!==null&&n!==void 0?n:null),u=r?.type==="Caret"&&d&&!d.shadowRoot&&a&&a!==c&&a.contains(c??null);if(!(o||this._hadSelection||h||u))return;let p=Date.now();this._lastSelectionChanged=p;let _=this._mouseSelection;if(_&&(o||this._hadSelection||h)){let v=Ni(i),f;if(Ps(v))f=v;else if(r?.type==="Caret"){var g;Ps((g=d)!==null&&g!==void 0?g:null)||u?f=d:h&&(f=l)}let m=f?this._selectionIsInGesture(f,_):r&&(a||r.anchorNode)?this._selectionTouchesGesture(r,_):o&&!this._hadSelection&&_.selectionInitiallyRelated;_.selectionChanged=_.selectionChanged||m}this._clicks.forEach(v=>{let f=p-v.timestamp;0>f||!M(v.selectionChangedDelayMs)&&f>=v.selectionChangedDelayMs||(v.selectionChangedDelayMs=f)})},this._onVisibilityChange=()=>{F?.visibilityState==="hidden"&&this._clearMouseSelection();let i=Date.now();this._lastVisibilityChange=i,this._recordLivenessSignal("visibilityChangedDelayMs",i)},this._onFocusChange=()=>{let i=Date.now();this._lastFocusChange=i,this._recordLivenessSignal("focusChangedDelayMs",i)},this._onTouchStart=i=>{this._observeGesturePath(i);let s=i.touches,n=s?.length===1?s[0]:void 0;this._touchStart=n?{x:n.clientX,y:n.clientY,timestamp:Date.now()}:void 0},this._onTouchCancel=()=>{this._touchStart=void 0},this._onTouchEnd=i=>{var s;let n=this._touchStart;if(this._touchStart=void 0,M(n)||this._deadSwipesCaptured>
110=this._config.max_dead_swipes_per_page_load)return;let r=i,o=(s=r.changedTouches)===null||s===void 0?void 0:s[0];if(!o)return;let a=o.clientX-n.x,l=o.clientY-n.y,c=a*a+l*l,d=this._config.swipe_threshold_px;if(d*d>c||[this._lastScroll,this._lastMutation,this._lastSelectionChanged].some(_=>ne(_)&&_>=n.timestamp))return;var h,u;if(this._pageHasUnobservableSurfaces()&&((h=F==null||(u=F.elementsFromPoint)===null||u===void 0?void 0:u.call(F,n.x,n.y))!==null&&h!==void 0?h:[]).some(_=>{var g;return(g=_.matches)===null||g===void 0?void 0:g.call(_,H_)}))return;let p=B_(r,{type:"swipe",swipeDirection:zw(a,l),swipeDistancePx:Math.round(Math.sqrt(c))});ue(p)||this._ignore(p)||this._queueCandidate(p),this._scheduleCheck()},this._config=this._asRequiredConfig(t),this._onCapture=this._config.__onCapture}start(e){this._startClickObserver(),this._startScrollObserver(),this._startSelectionChangedObserver(),this._startVisibilityChangeObserver(),this._startFocusChangeObserver(),this._startMutationObserver(e),this._config.capture_dead_swipes&&this._startSwipeObserver()}_startMutationObserver(e){if(!this._mutationObserver){let t=(function(i){return(function(s,n){let r=Jl[s];if(r)return r;let o=n[s];if((d=>_e(d)&&d.toString().indexOf("[native code]")!==-1)(o)&&!T?.Zone)return Jl[s]=o.bind(n);let a=n.document;if(a&&_e(a.createElement)){let d,h=!1;try{d=a.createElement("iframe"),d.hidden=!0,a.head.appendChild(d);let u=d.contentWindow;var l,c;u&&u[s]&&(o=u[s],s==="MutationObserver"&&(function(p){return ie(p,"AppleWebKit")&&!ie(p,"Chrome")})((l=(c=n.navigator)===null||c===void 0?void 0:c.userAgent)!==null&&l!==void 0?l:"")&&(d.classList.add("rr-block","ph-no-capture"),h=!0))}catch(u){D.warn(`Could not create sandbox iframe for ${s} check, bailing to assignableWindow.${s}: `,u)}finally{!h&&d?.parentNode&&d.parentNode.removeChild(d)}}return o&&_e(o)?Jl[s]=o.bind(n):o})("MutationObserver",i)})(R);this._mutationObserver=new t(i=>{this._onMutation(i)}),this._observeRoot(e)}}_observeRoot(e){e&&this._mutationObserver&&(this._observedRoots.has(e)||(this._mutationObserver.observe(e,{attributes:!0,characterData:!0,childList:!0,subtree:!0}),this._observedRoots.add(e),this._observeShadowRoots(e)))}_observeShadowRoots(e,t){var i,s;_t(e)&&e.shadowRoot&&this._observeRoot(e.shadowRoot);let n=(i=(s=e.querySelectorAll)===null||s===void 0?void 0:s.call(e,"*"))!==null&&i!==void 0?i:[];for(let r=0;n.length>r;r++)t?.add(n[r]),this._observeRoot(n[r].shadowRoot)}_observeGesturePath(e){var t,i;let s=(t=(i=e.composedPath)===null||i===void 0?void 0:i.call(e))!==null&&t!==void 0?t:[];for(let n=0;s.length>n;n++){let r=s[n];Yl(r)&&this._observeRoot(r.shadowRoot)}}stop(){var e;(e=this._mutationObserver)===null||e===void 0||e.disconnect(),this._mutationObserver=void 0,this._observedRoots=new WeakSet,R.removeEventListener("click",this._onClick,{capture:!0}),R.removeEventListener("mousedown",this._onMouseDown,{capture:!0}),R.removeEventListener("mouseup",this._onMouseUp,{capture:!0}),R.removeEventListener("mouseout",this._onMouseOut,{capture:!0}),R.removeEventListener("dragstart",this._clearMouseSelection,{capture:!0}),R.removeEventListener("pointercancel",this._clearMouseSelection,{capture:!0}),R.removeEventListener("blur",this._clearMouseSelection),this._clearMouseSelection(),R.removeEventListener("scroll",this._onScroll,{capture:!0}),F?.removeEventListener("selectionchange",this._onSelectionChange),R.removeEventListener("touchstart",this._onTouchStart,{capture:!0}),R.removeEventListener("touchend",this._onTouchEnd,{capture:!0}),R.removeEventListener("touchcancel",this._onTouchCancel,{capture:!0}),F?.removeEventListener("visibilitychange",this._onVisibilityChange),R.removeEventListener("blur",this._onFocusChange),R.removeEventListener("focus",this._onFocusChange),this._touchStart=void 0}_onMutation(e){let t=new Set;for(let s of e)try{var i;if(((i=s.target)===null||i===void 0?void 0:i.isConnected)===!1)continue;this._lastMutation=Date.now();let n=s.addedNodes;for(let r=0;n.length>r;r++){let o=n[r];Yl(o)&&!t.has(o)&&this._observeShadowRoots(o,t)}}catch{}}_startClickObserver(){Z(R,"click",this._onClick,{capture:!0}),Z(R,"mousedown",this._onMouseDown,{capture:!0}),Z(R,"mouseup",this._onMouseUp,{capture:!0}),Z(R,"mouseout",this._onMouseOut,{capture:!0}),Z(R,"dragstart",this._clearMouseSelection,{capture:!0}),Z(R,"pointercancel",this._clearMouseSelection,{capture:!0}),Z(R,"blur",this._clearMouseSelection)}_queueCandidate(e){e.selectionChangedDelayMs=Zl(e.timestamp,this._lastSelectionChanged,this._config.selection_change_threshold_ms),e.visibilityChangedDelayMs=Zl(e.timestamp,this._lastVisibilityChange),e.focusChangedDelayMs=Zl(e.timestamp,this._lastFocusChange),this._clicks.push(e)}_scheduleCheck(){this._clicks.length&&M(this._checkClickTimer)&&(this._checkClickTimer=R.setTimeout(()=>{this._checkClicks()},1e3))}_startScrollObserver(){Z(R,"scroll",this._onScroll,{capture:!0})}_startSelectionChangedObserver(){var e;this._hadSelection=(F==null||(e=F.getSelection())===null||e===void 0?void 0:e.type)==="Range",Z(F,"selectionchange",this._onSelectionChange)}_selectionIsInGesture(e,t){let i=t.path[0];try{for(;e;){if(t.path.indexOf(e)!==-1||_t(i)&&i.contains(e))return!0;e=e.getRootNode().host}}catch{}return!1}_selectionTouchesGesture(e,t){let i=t.path[0],s=e.rangeCount>0?e.getRangeAt(0):void 0,n=!!s&&ta(()=>s.startContainer.getRootNode()===i.getRootNode());if(s&&n&&_t(i)){var r;if(!s.collapsed)return s.intersectsNode(i);let o=_t(s.startContainer)&&(r=s.startContainer.childNodes[s.startOffset])!==null&&r!==void 0?r:s.startContainer;return this._selectionIsInGesture(o,t)}return this._selectionIsInGesture(e.focusNode,t)||this._selectionIsInGesture(e.anchorNode,t)}_startVisibilityChangeObserver(){Z(F,"visibilitychange",this._onVisibilityChange)}_startFocusChangeObserver(){Z(R,"blur",this._onFocusChange),Z(R,"focus",this._onFocusChange)}_recordLivenessSignal(e,t){this._clicks.forEach(i=>
110{let s=w0(t-i.timestamp);ne(s)&&(M(i[e])||i[e]>s)&&(i[e]=s)})}_startSwipeObserver(){Z(R,"touchstart",this._onTouchStart,{capture:!0,passive:!0}),Z(R,"touchend",this._onTouchEnd,{capture:!0,passive:!0}),Z(R,"touchcancel",this._onTouchCancel,{capture:!0,passive:!0})}_pageHasUnobservableSurfaces(){let e=M(this._surfacesCheckedAt)||ne(this._lastMutation)&&this._lastMutation>this._surfacesCheckedAt;return(M(this._hasUnobservableSurfaces)||e)&&(this._surfacesCheckedAt=Date.now(),this._hasUnobservableSurfaces=!!F?.querySelector(H_)),!!this._hasUnobservableSurfaces}_ignore(e){return!e||(e.type==="swipe"?this._ignoreCommon(e):this._ignoreClick(e))}_ignoreCommon(e){return!(!Fc(e.node)&&!this._clicks.some(t=>t.type===e.type&&t.node===e.node&&1e3>Math.abs(t.timestamp-e.timestamp))&&!ot(e.node,"html")&&_t(e.node)&&(function(t,i){var s;if(!T||Er(t))return!1;let n=Ae(i)?gh:(s=i?.css_selector_ignorelist)!==null&&s!==void 0?s:gh,{targetElementList:r}=la(t,!1);return!aa(r,n)})(e.node,{css_selector_ignorelist:this._config.css_selector_ignorelist}))}_ignoreClick(e){return!(this._config.capture_clicks_with_modifier_keys||(t=e.originalEvent,!(t.ctrlKey||t.metaKey||t.altKey||t.shiftKey)))||!!this._ignoreCommon(e)||(function(i){if(!T||Er(i))return!1;let{targetElementList:s}=la(i,!1);return s.some(n=>ot(n,"a"))})(e.node);var t}_checkClicks(){if(!this._clicks.length)return;clearTimeout(this._checkClickTimer),this._checkClickTimer=void 0;let e=this._clicks;this._clicks=[];for(let i of e){var t;i.mutationDelayMs=(t=i.mutationDelayMs)!==null&&t!==void 0?t:this._lastMutation&&this._lastMutation>=i.timestamp?this._lastMutation-i.timestamp:void 0,i.absoluteDelayMs=Date.now()-i.timestamp;let s=Co(i.scrollDelayMs,this._config.scroll_threshold_ms),n=Co(i.selectionChangedDelayMs,this._config.selection_change_threshold_ms),r=Co(i.mutationDelayMs,this._config.mutation_threshold_ms),o=Co(i.absoluteDelayMs,1.1*this._config.mutation_threshold_ms),a=ne(i.scrollDelayMs)&&this._config.scroll_threshold_ms>i.scrollDelayMs,l=ne(i.mutationDelayMs)&&this._config.mutation_threshold_ms>i.mutationDelayMs,c=i.selectionChangedDuringGesture||ne(i.selectionChangedDelayMs)&&this._config.selection_change_threshold_ms>i.selectionChangedDelayMs,d=ne(i.visibilityChangedDelayMs),h=ne(i.focusChangedDelayMs);if(!(a||l||c||d||h))if(s||r||o||n){let u=q_(i);if(u==="$dead_swipe"){if(this._deadSwipesCaptured>=this._config.max_dead_swipes_per_page_load)continue;this._deadSwipesCaptured++}this._onCapture(i,{[`${u}_last_mutation_timestamp`]:this._lastMutation,[`${u}_event_timestamp`]:i.timestamp,[`${u}_scroll_timeout`]:s,[`${u}_mutation_timeout`]:r,[`${u}_absolute_timeout`]:o,[`${u}_selection_changed_timeout`]:n,[`${u}_visibility_changed_timeout`]:!1})}else this._config.mutation_threshold_ms>i.absoluteDelayMs&&this._clicks.push(i)}this._scheduleCheck()}_captureDeadClick(e,t){let i=q_(e);this.instance.capture(i,b(b(b({},t),S0(e.node,{e:e.originalEvent,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this._config.element_attribute_ignorelist,elementsChainAsString:!1,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes}).props),{},{[`${i}_scroll_delay_ms`]:e.scrollDelayMs,[`${i}_mutation_delay_ms`]:e.mutationDelayMs,[`${i}_absolute_delay_ms`]:e.absoluteDelayMs,[`${i}_selection_changed_delay_ms`]:e.selectionChangedDelayMs,[`${i}_visibility_changed_delay_ms`]:e.visibilityChangedDelayMs,[`${i}_focus_changed_delay_ms`]:e.focusChangedDelayMs,$dead_swipe_direction:e.swipeDirection,$dead_swipe_distance_px:e.swipeDistancePx}),{timestamp:new Date(e.timestamp)})}};R.__PosthogExtensions__=R.__PosthogExtensions__||{},R.__PosthogExtensions__.initDeadClicksAutocapture=(e,t)=>new jw(e,t);var Vw=class{constructor(e){this._instance=e}get _config(){return this._instance.config}get consent(){return this._getDnt()?0:this._storedConsent}isOptedOut(){return this._config.cookieless_mode==="always"||this.isRejected()||this.consent===-1&&this._config.cookieless_mode==="on_reject"}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this._config.opt_out_capturing_by_default}optInOut(e){this._storage._set(this._storageKey,e?1:0,this._config.cookie_expiration,this._config.cross_subdomain_cookie,this._config.secure_cookie)}reset(){this._storage._remove(this._storageKey,this._config.cross_subdomain_cookie)}get _storageKey(){let{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:i}=this._instance.config;
110return i||(t?t+e:"__ph_opt_in_out_"+e)}get _storedConsent(){let e=this._storage._get(this._storageKey);return sl(e)?1:ie(_y,e)?0:-1}get _storage(){let e=this._config.opt_out_capturing_persistence_type,t=e==="localStorage"?ye:Ue,i=t._is_supported()?t:Hc;if(!this._persistentStore||this._persistentStore!==i){this._persistentStore=i;let s=e==="localStorage"?Ue:ye;s._get(this._storageKey)&&(this._persistentStore._get(this._storageKey)||this.optInOut(sl(s._get(this._storageKey))),s._remove(this._storageKey,this._config.cross_subdomain_cookie))}return this._persistentStore}_getDnt(){return!!this._config.respect_dnt&&[Je?.doNotTrack,Je?.msDoNotTrack,R.doNotTrack,Je?.globalPrivacyControl].some(e=>sl(e))}},Eo=Ie("[Dead Clicks]"),Gw=()=>!0,Qw=e=>{var t;let i=!!(!((t=e.instance.persistence)===null||t===void 0)&&t.get_property(xu)),s=e.instance.config.capture_dead_clicks;return Ae(s)?s:!!ee(s)||i},U_=class{get lazyLoadedDeadClicksAutocapture(){return this._lazyLoadedDeadClicksAutocapture}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(e){if(!e.ok)return;let t=e.config;"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[xu]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this._loadScript(()=>{this._start()}):this.stop()}_loadScript(e){var t,i,s;!((t=R.__PosthogExtensions__)===null||t===void 0)&&t.initDeadClicksAutocapture?e():(i=R.__PosthogExtensions__)===null||i===void 0||(s=i.loadExternalDependency)===null||s===void 0||s.call(i,this.instance,"dead-clicks-autocapture",n=>{n?Eo.error("failed to load script",n):e()})}_start(){var e;if(F){if(!this._lazyLoadedDeadClicksAutocapture&&(!((e=R.__PosthogExtensions__)===null||e===void 0)&&e.initDeadClicksAutocapture)){let t=ee(this.instance.config.capture_dead_clicks)?b({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this._lazyLoadedDeadClicksAutocapture=R.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this._lazyLoadedDeadClicksAutocapture.start(F),Eo.info("starting...")}}else Eo.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,Eo.info("stopping..."))}},$n=Ie("[SegmentIntegration]");function W_(e,t,i=!0){let s=e.config.segment;if(!s)return t();let{analytics:n,filterProperties:r}=(a=>_e(a.register))(o=s)?{analytics:o}:o;var o;(function(a,l,c,d){let h=p=>{let _=()=>p.anonymousId()||Rt();a.config.get_device_id=_,d&&p.id()&&(a.register({distinct_id:p.id(),$device_id:_()}),a.persistence.set_property(St,Mo)),c(d?void 0:p.anonymousId()||void 0)},u=l.user();"then"in u&&_e(u.then)?u.then(h):h(u)})(e,n,a=>{n.register(((l,c,{filterProperties:d}={})=>{typeof Promise<"u"&&Promise.resolve||$n.warn("This browser does not have Promise support, and can not use the segment integration");let h=(u,p)=>{if(!p)return u;let _=!!c&&u.event.anonymousId===c&&!u.event.userId;_||u.event.userId||u.event.anonymousId===l.get_distinct_id()||($n.info("No userId set, resetting PostHog"),l.reset()),_||(c=void 0),u.event.userId&&u.event.userId!==l.get_distinct_id()&&($n.info("UserId set, identifying with PostHog"),l.identify(u.event.userId));let g=l.calculateEventProperties(p,u.event.properties);if(!Y(d)){let v=u.event.properties||{},f={};for(let y of Object.keys(g))Lr.call(v,y)||(f[y]=g[y]);let m=((y,w)=>{let S=W(y)?y:[y],x=b({},w);for(let k of S)try{if(x=k(x),Y(x))return null}catch(C){return $n.error("Error in Segment filterProperties:",C),null}return x})(d,f);if(Y(m))return u;g=m}return u.event.properties=Object.assign({},g,u.event.properties),u};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(u){return h(u,u.event.event)},page(u){return h(u,Hu)},identify(u){return h(u,Ug)},screen(u){return h(u,"$screen")}}})(e,a,{filterProperties:r})).then(()=>{t()},l=>{$n.error("Failed to register the Segment integration",l),t()})},i)}var k0="posthog-js";function C0(e,{organization:t,projectId:i,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:r=!0}={}){return o=>{var a,l,c,d,h;if(n!=="*"&&!n.includes(o.level)||!e.__loaded)return o;o.tags||(o.tags={});let u=e.requestRouter.endpointFor("ui",`/project/${e.config.token}/person/${e.get_distinct_id()}`);o.tags["PostHog Person URL"]=u,e.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));let p=((a=o.exception)===null||a===void 0?void 0:a.values)||[],_=p.map(f=>b(b({},f),{},{stacktrace:f.stacktrace?b(b({},f.stacktrace),{},{type:"raw",frames:(f.stacktrace.frames||[]).map(m=>b(b({},m),{},{platform:"web:javascript"}))}):void 0})),g={$exception_message:((l=p[0])===null||l===void 0?void 0:l.value)||o.message,$exception_type:(c=p[0])===null||c===void 0?void 0:c.type,$exception_level:o.level,$exception_list:_,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:((d=p[0])===null||d===void 0?void 0:d.value)||o.message,$sentry_exception_type:(h=p[0])===null||h===void 0?void 0:h.type,$sentry_tags:o.tags};var v;return t&&i&&(g.$sentry_url=(s||"https://sentry.io/organizations/")+t+"/issues/?project="+i+"&query="+o.event_id),r&&((v=e.exceptions)===null||v===void 0||v.sendExceptionEvent(g)),o}}var Kw=class{constructor(e,t,i,s,n,r){this.name=k0,this.setupOnce=function(o){o(C0(e,{organization:t,projectId:i,prefix:s,severityAllowList:n,sendExceptionsToPostHog:r==null||r}))}}},z_=class{constructor(e){this._onSessionIdChange=(t,i,s)=>{s&&(s.noSessionId||s.activityTimeout||s.sessionPastMaximumLength||s.crossTabAdoption)&&(D.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:s}),this._currentPageview=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this._setupSessionRotationHandler()}_setupSessionRotationHandler(){var e;this._unsubscribeSessionId=(e=this._instance.sessionManager)===null||e===void 0?void 0:e.onSessionId(this._onSessionIdChange)}destroy(){var e;(e=this._unsubscribeSessionId)===null||e===void 0||e.call(this),this._unsubscribeSessionId=void 0}doPageView(e,t){var i;let s=this._previousPageViewProperties(e,t);return this._currentPageview={pathname:(i=T?.location.pathname)!==null&&i!==void 0?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var t;return this._previousPageViewProperties(e,(t=this._currentPageview)===null||t===void 0?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this._currentPageview)===null||e===void 0?void 0:e.pageViewId}}_previousPageViewProperties(e,t){let i=this._currentPageview;if(!i)return{$pageview_id:t};let s={$pageview_id:t,$prev_pageview_id:i.pageViewId},n=this._instance.scrollManager.getContext();if(n&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:r,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:c,maxContentY:d}=n;
110if(!(M(r)||M(o)||M(a)||M(l)||M(c)||M(d))){r=Math.ceil(r),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),c=Math.ceil(c),d=Math.ceil(d);let h=r>1?Tt(o/r,0,1,D):1,u=r>1?Tt(a/r,0,1,D):1,p=l>1?Tt(c/l,0,1,D):1,_=l>1?Tt(d/l,0,1,D):1;s=Oe(s,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:h,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:u,$prev_pageview_last_content:c,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:d,$prev_pageview_max_content_percentage:_})}}return i.pathname&&(s.$prev_pageview_pathname=i.pathname),i.timestamp&&(s.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),s}},Dn=["flags","surveys"],Jw={[K0]:{exposure:"hidden"},[Qo]:{exposure:"hidden"},[J0]:{exposure:"hidden"},[cc]:{exposure:"hidden"},[zs]:{exposure:"hidden"},[Qn]:{exposure:"hidden"},[Cg]:{exposure:"event"},[uc]:{exposure:"hidden"},[xg]:{exposure:"hidden"},[dc]:{exposure:"event"},[Eg]:{exposure:"hidden"},[hc]:{exposure:"event"},[pc]:{exposure:"event"},[xu]:{exposure:"event"},[Tu]:{exposure:"hidden"},[Tg]:{exposure:"event"},[js]:{exposure:"hidden"},[Y0]:{exposure:"hidden"},[Os]:{exposure:"hidden"},[br]:{exposure:"event"},[Ig]:{exposure:"event",shouldSkipFromEventProperties:e=>ue(e)},[Mg]:{exposure:"event"},[Iu]:{exposure:"event"},[Mu]:{exposure:"event"},[Z0]:{exposure:"event"},[mc]:{exposure:"hidden"},[Gt]:{exposure:"hidden",storageGroup:"flags"},[gi]:{exposure:"hidden",storageGroup:"flags"},[yc]:{exposure:"hidden"},[ns]:{exposure:"hidden",storageGroup:"flags"},[Fi]:{exposure:"hidden",storageGroup:"flags"},[rs]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Kn]:{exposure:"hidden",storageGroup:"flags"},[Xt]:{exposure:"hidden"},[Yi]:{exposure:"hidden"},[Qt]:{exposure:"hidden"},[Ai]:{exposure:"hidden"},[ss]:{exposure:"hidden",storageGroup:"surveys"},[Ko]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[Fg]:{exposure:"event"},[Ag]:{exposure:"hidden"},[Lg]:{exposure:"hidden"},[bc]:{exposure:"hidden"},[X0]:{exposure:"hidden"},[ey]:{exposure:"hidden"},[ty]:{exposure:"event"},[iy]:{exposure:"event"},[sy]:{exposure:"event"},[ny]:{exposure:"event"},[Li]:{exposure:"hidden"},[Bn]:{exposure:"hidden"},[Rg]:{exposure:"event"},[Sr]:{exposure:"hidden"},[Di]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[St]:{exposure:"hidden"},[Sc]:{exposure:"hidden"},[ry]:{exposure:"hidden"},[Og]:{exposure:"hidden"},[$g]:{exposure:"hidden"},[$s]:{exposure:"hidden"},[Fu]:{exposure:"hidden"},[_c]:{exposure:"event"},[gc]:{exposure:"event"},[fc]:{exposure:"event"},[vc]:{exposure:"event"},[Ng]:{exposure:"event"},[Bg]:{exposure:"event"},[Au]:{exposure:"hidden"},[Lu]:{exposure:"hidden"},[Ou]:{exposure:"hidden"},[$u]:{exposure:"hidden"},[Du]:{exposure:"hidden"},[Jn]:{exposure:"hidden"},[Oa]:{exposure:"hidden"},[Nu]:{exposure:"hidden"},[Bu]:{exposure:"hidden"},[qg]:{exposure:"event"}},Yw=[[Pu,{exposure:"hidden"}],[Ru,{exposure:"hidden"}],[Pg,{exposure:"hidden"}]],ut=e=>{let t=Jw[e];if(t)return t;for(let[i,s]of Yw)if(e.indexOf(i)===0)return s},Zw={flags:Di,surveys:Ko},Xw=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],xo=e=>`${e}_cookie_identity_change_pending`,To=e=>{let t="",i=0;for(let s of e){let n=encodeURIComponent(JSON.stringify(s).slice(1,-1)).length;if(i+n>1e3)break;t+=s,i+=n}return t},et="main",pi=[Gt,gi,ns,Fi,rs,Di,Kn,Qt],Xl=e=>pi.indexOf(e)!==-1,E0=[zs,Qn],j_=e=>E0.indexOf(e)!==-1,Ti=(e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch{return e===t}},Es=e=>{if(!e)return{};let t=JSON.parse(e);return ee(t)?t:{}},V_=(e,t)=>{xe(e,(i,s)=>{let n=ut(s);n&&n.exposure!=="event"||{}.hasOwnProperty.call(t,s)||delete e[s]})},ec=class{constructor(e,t,i=!0,s=!e.cookieless_mode){if(this._slotState={},this._splitStorageEligible=!1,this._storesIdentityInCookie=!1,this._splitStorage=!1,this._cookieIdentityChangePending=!1,this._cookieSyncSuppressed=!1,this._pendingCrossTabFeatureFlagChanges=new Map,this._storageMigrationInProgress=!1,this._localIdentityChangePending=!1,this._crossTabFeatureFlagIdentityMismatch=!1,this._metaIdentifierChangePending=new Set,this._crossTabFeatureFlagHandlers=new Set,this._config=e,this._ownsSplitStorage=i,this.props={},this._campaign_params_url=void 0,this._name=(n=>{let r="";return n.token&&(r=n.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),n.persistence_name?"ph_"+n.persistence_name:"ph_"+r+"_posthog"})(e),this._disabled=e.disable_persistence||!!t,this._storage=this._buildStorage(e),this._splitStorage=this._resolveSplitStorage(e),this.load(s),this._markLoadedCrossTabFeatureFlagChangesPending(),e.debug&&D.info("Persistence loaded",e.persistence,b({},this.props)),this.update_config(e,e,t),this.save(),T){let n=()=>this.flush();Z(T,"beforeunload",n,{capture:!1}),Z(T,"pagehide",n,{capture:!1}),this._onStorage=r=>{if(this._splitStorageEligible&&(!r.storageArea||r.storageArea===T?.localStorage)&&r.key)if(r.key!==this._name){if(this._splitStorage){let o=Dn.find(a=>r.key===this._groupEntryName(a));o&&this._syncCrossTabFeatureFlagProperties(r.key,o)}}else this._syncCrossTabFeatureFlagProperties(r.key,et)},Z(T,"storage",this._onStorage)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(([t,i])=>
110{let s=this._pendingCrossTabFeatureFlagChanges.get(t);if(!Xl(t)||s===!0)return;if(i===!0)return void this._setCrossTabFeatureFlagChangesPending(t,!0);let n=new Set(s||[]);i.forEach(r=>n.add(r)),n.size&&this._setCrossTabFeatureFlagChangesPending(t,n)})}onCrossTabFeatureFlagChange(e){return this._crossTabFeatureFlagHandlers.add(e),()=>this._crossTabFeatureFlagHandlers.delete(e)}destroy(){this._onStorage&&T&&(T.removeEventListener("storage",this._onStorage),this._onStorage=void 0),this._crossTabFeatureFlagHandlers.clear()}_syncCrossTabFeatureFlagProperties(e,t,i=!0){if(this._disabled)return!1;let s,n;try{if(n=ye._get(e),ue(n)){let a=this._slotWriteState(t);return a.storageValue=null,t!==et&&(a.persisted=!1),!1}s=Es(n)}catch{return!1}let r=t===et?s:ye._parse(this._name);if(r&&this._hasCrossTabFeatureFlagIdentityMismatch(r))return!1;let o=this._mergeCrossTabFeatureFlagProperties(s,t,i);return t===et&&this._splitStorage&&!Ti(this._partitionProps().main,s)||this._rememberCrossTabStorageFingerprint(s,t,!0,n),o}_hasCrossTabFeatureFlagIdentityMismatch(e){let t=this.props[jt],i=e[jt];return!M(t)&&!M(i)&&t!==i}_rememberCrossTabStorageFingerprint(e,t,i,s){let n=this._slotWriteState(t);n.storageValue=s,t!==et&&(n.persisted=i);try{n.fingerprint=this._entryFingerprint(e,t)}catch{n.fingerprint=void 0}}_mergeCrossTabFeatureFlagProperties(e,t,i){let s=!1;return pi.forEach(n=>{var r;let o=(r=ut(n))===null||r===void 0?void 0:r.storageGroup;if(t===et&&this._splitStorage&&o||t!==et&&o!==t)return;let a=n in e,l=this._mergePendingCrossTabFeatureFlagChanges(n,a?e[n]:void 0),c=this._pendingCrossTabFeatureFlagChanges.has(n)?n in this.props:a;c===n in this.props&&Ti(l,this.props[n])||(c?this._setProp(n,l,!1):this._deleteProp(n,!1),s=!0)}),s&&i&&this._crossTabFeatureFlagHandlers.forEach(n=>n()),s}_reconcileCrossTabFeatureFlagPropertiesBeforeWrite(){if(!this._splitStorageEligible)return!1;try{this._crossTabFeatureFlagIdentityMismatch=!1;let e=ye._get(this._name),t=this._slotWriteState(et),i,s=!1,n=!1;if(e!==t.storageValue)if(ue(e))t.storageValue=null;else{if(i=Es(e),this._crossTabFeatureFlagIdentityMismatch=!this._localIdentityChangePending&&this._hasCrossTabFeatureFlagIdentityMismatch(i),this._crossTabFeatureFlagIdentityMismatch)return!1;n=this._mergeCrossTabFeatureFlagProperties(i,et,!1),!this._splitStorage||Ti(this._partitionProps().main,i)?this._rememberCrossTabStorageFingerprint(i,et,!0,e):t.storageValue=e,s=!0}return this._splitStorage&&Dn.forEach(r=>{let o=ye._get(this._groupEntryName(r)),a=this._slotWriteState(r),l=i||{},c=s&&pi.some(h=>{var u;return((u=ut(h))===null||u===void 0?void 0:u.storageGroup)===r&&h in l});if(o===a.storageValue&&!c)return;if(ue(o))return a.storageValue=null,a.persisted=!1,void(c&&(n=this._mergeCrossTabFeatureFlagProperties(l,r,!1)||n));let d=Es(o);n=this._mergeCrossTabFeatureFlagProperties(d,r,!1)||n,this._rememberCrossTabStorageFingerprint(d,r,!0,o)}),n}catch{return!1}}_setCrossTabFeatureFlagChangesPending(e,t){this._pendingCrossTabFeatureFlagChanges.set(e,t);let i=ut(e);i?.volatile||(this._slotWriteState((this._splitStorage?i?.storageGroup:void 0)||et).fingerprint=void 0,this._markGroupDirty(e))}_markAllCrossTabFeatureFlagChangesPending(){pi.forEach(e=>this._pendingCrossTabFeatureFlagChanges.set(e,!0))}_markLoadedCrossTabFeatureFlagChangesPending(){if(this._splitStorageEligible)try{let e=ye._get(this._name),t=Es(e);this._slotWriteState(et).storageValue=e,pi.forEach(i=>{var s;let n=this._splitStorage?(s=ut(i))===null||s===void 0?void 0:s.storageGroup:void 0,r=n?ye._get(this._groupEntryName(n)):null;if(n){let a=this._slotWriteState(n);a.storageValue=r,a.persisted=!ue(r)}let o=n&&!ue(r)?Es(r):t;i in this.props?this._markPendingCrossTabFeatureFlagChanges(i,o[i],this.props[i]):i in o&&this._setCrossTabFeatureFlagChangesPending(i,!0)})}catch{}}_mergePendingCrossTabFeatureFlagChanges(e,t){let i=this._pendingCrossTabFeatureFlagChanges.get(e);if(!i)return t;if(i===!0)return this.props[e];if(e==="$active_feature_flags"){let r=new Set(W(t)?t:[]),o=new Set(W(this.props[e])?this.props[e]:[]);return i.forEach(a=>o.has(a)?r.add(a):r.delete(a)),Array.from(r)}let s=ee(t)?b({},t):{},n=ee(this.props[e])?this.props[e]:{};
110return i.forEach(r=>{r in n?s[r]=n[r]:delete s[r]}),s}_markPendingCrossTabFeatureFlagChanges(e,t,i){if(!Xl(e))return;let s=this._pendingCrossTabFeatureFlagChanges.get(e);if(s===!0)return;let n=t;if(this._splitStorageEligible)try{var r;let a=this._splitStorage?(r=ut(e))===null||r===void 0?void 0:r.storageGroup:void 0,l=a?this._groupEntryName(a):this._name;n=Es(ye._get(l))[e]}catch{}let o=new Set(s||[]);if(e==="$active_feature_flags"){if(!M(t)&&!W(t)||!M(n)&&!W(n)||!W(i))return void this._setCrossTabFeatureFlagChangesPending(e,!0);let a=new Set(t||[]),l=new Set(n||[]),c=new Set(i);new Set([...a,...c]).forEach(d=>{a.has(d)!==c.has(d)&&o.add(d)}),o.forEach(d=>{l.has(d)===c.has(d)&&o.delete(d)})}else{if(!ee(i))return void(Ti(n,i)?this._pendingCrossTabFeatureFlagChanges.delete(e):this._setCrossTabFeatureFlagChangesPending(e,!0));{if(!M(t)&&!ee(t)||M(t)&&Ct(i)&&M(n))return void this._setCrossTabFeatureFlagChangesPending(e,!0);let a=ee(t)?t:{},l=ee(n)?n:{};new Set([...Object.keys(a),...Object.keys(i)]).forEach(c=>{c in a==c in i&&Ti(a[c],i[c])||o.add(c)}),o.forEach(c=>{c in l==c in i&&Ti(l[c],i[c])&&o.delete(c)})}}o.size?this._setCrossTabFeatureFlagChangesPending(e,o):this._pendingCrossTabFeatureFlagChanges.delete(e)}_saveDebounceMs(){var e;let t=(e=this._config)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return ne(t)&&t>0?t:0}_rememberCurrentCookieProperties(e){if(this._config.cookieWinsOnConflict&&this._config.persistence.toLowerCase()==="localstorage+cookie")if(e)try{let t=vl(e,this._config.cookie_persisted_properties||[]),i=Lh(t,this._config.cookie_persisted_properties||[]),s=JSON.stringify(t)+"|"+JSON.stringify(i),n=Ue._get(this._name)||void 0;n&&ml(this._name,n)===s&&(this._lastSeenCookiePropertiesFingerprint=s,this._lastSeenMainCookieValue=n)}catch{}else try{let t=Ue._get(this._name)||void 0;this._lastSeenCookiePropertiesFingerprint=t?ml(this._name,t):void 0,this._lastSeenMainCookieValue=t}catch{}}syncCookieProperties(){return this._syncCookieProperties(this._config)}_syncCookieProperties(e,t=!1){if(this._disabled&&!t||this._cookieSyncSuppressed||!e.cookieWinsOnConflict||e.persistence.toLowerCase()!=="localstorage+cookie")return!1;let i;try{i=Ue._get(this._name)||void 0}catch{}if(!i||i===this._lastSeenMainCookieValue)return!1;let s=ml(this._name,i),n;try{n=fl(JSON.parse(i))}catch{return!1}if((Ue._get(this._name)||void 0)!==i)return!1;this._lastSeenCookiePropertiesFingerprint=s,this._lastSeenMainCookieValue=i;let r=Oh(this._name,i),o=[...Zi,...r.properties],a={};if(Object.keys(n).forEach(g=>{let v=n[g];(M(v)||ue(v)||v===""||g==="$user_state"&&v!=="anonymous"&&v!=="identified")&&(a[g]=!0,delete n[g])}),Ct(n))return!1;let l="distinct_id"in n||n.$user_state==="anonymous"||n.$user_state==="identified",c=this.props,d=c[jt],h=c[St],u=Oe({},c);[...Zi,...e.cookie_persisted_properties||[]].forEach(g=>{if(o.indexOf(g)!==-1&&!(g in n)&&!a[g]&&(l||g!=="distinct_id"&&g!=="$user_state")){let v=u[g];(r.isValid||Zi.indexOf(g)===-1||v!==!1&&v!==0)&&delete u[g]}}),this.props=Oe(u,n),pi.forEach(g=>{let v=g in this.props;g in c===v&&Ti(c[g],this.props[g])||(v?this._markPendingCrossTabFeatureFlagChanges(g,c[g],this.props[g]):this._setCrossTabFeatureFlagChangesPending(g,!0))}),!l||"$user_state"in n||"$user_state"in this.props||this._setProp(St,fi);let p=this.props[jt],_=this.props[St];return!l||p===d&&_===h||(this._localIdentityChangePending=!0,this._cookieIdentityChangePending=!0,Te._set(xo(this._name),!0),this._deleteProp(Qt),this._deleteProp(gi),this._deleteProp(Gt),this._deleteProp(ns),this._deleteProp(Fi),this._deleteProp(rs),this._deleteProp(Di),this._deleteProp(Sr),this._deleteProp(Li),_!=="anonymous"||h!=="identified"&&n.$user_state!=="anonymous"&&(M(d)||p===d)||(V_(this.props,n),this._deleteProp(Ai)),_==="identified"?this.props.$user_id=p:delete this.props.$user_id,this._deleteProp(Qo)),!0}
110consumeCookieIdentityChange(){let e=xo(this._name),t=this._cookieIdentityChangePending||!!Te._get(e);return this._cookieIdentityChangePending=!1,t&&Te._remove(e),t}_beginCookieSyncSuppression(e=!1){return!(this._cookieSyncSuppressed||this._disabled&&!e||!this._config.cookieWinsOnConflict||this._config.persistence.toLowerCase()!=="localstorage+cookie"||(this._cookieSyncSuppressed=!0,0))}_publishSuppressedCookieSnapshot(){this._cookieSyncSuppressed&&(M(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0),delete this._slotState[et],this._writeNow(!0))}_endCookieSyncSuppression(e=!0){if(this._cookieSyncSuppressed)try{e?this._publishSuppressedCookieSnapshot():M(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0)}finally{this._cookieSyncSuppressed=!1}}isDisabled(){return!!this._disabled}_buildStorage(e){Xw.indexOf(e.persistence.toLowerCase())===-1&&(D.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");let t=((o=[],a=!1,l=()=>!1)=>{let c=[...Zi,...o];return b(b({},ye),{},{_parse(d){try{let u,p={};try{u=Ue._get(d)||void 0,p=u?fl(JSON.parse(u)):{}}catch{}let _=JSON.parse(ye._get(d)||"{}"),g;if(a){let v=Oh(d,u),f=[...Zi,...v.properties],m={};Object.keys(p).forEach(w=>{let S=p[w];ue(S)||S===""||w==="$user_state"&&S!=="anonymous"&&S!=="identified"||(m[w]=S)});let y="distinct_id"in m||m.$user_state==="anonymous"||m.$user_state==="identified";if(Object.keys(m).length>0){var h;let w=_[jt],S=(h=_.$user_state)!==null&&h!==void 0?h:fi;c.forEach(x=>{if(f.indexOf(x)!==-1&&!(x in p)&&(y||x!=="distinct_id"&&x!=="$user_state")){let k=_[x];(v.isValid||Zi.indexOf(x)===-1||k!==!1&&k!==0)&&delete _[x]}}),!y||"$user_state"in p||"$user_state"in _||(_[St]=fi),!y||("distinct_id"in m?m[jt]:_[jt])===w&&("$user_state"in m?m[St]:_[St])===S||(gl.forEach(x=>delete _[x]),m.$user_state==="identified"&&"distinct_id"in m?_.$user_id=m[jt]:delete _.$user_id,m.$user_state!=="identified"&&(delete _[Rg],delete _[Ai]),delete _.__alias)}g=Oe(_,m)}else g=Oe(p,_);return l()||ye._set(d,g),g}catch{}return null},_set(d,h,u,p,_,g){let v=ye._set(d,h,void 0,void 0,g);try{let f=vl(h,o);if(Object.keys(f).length){if(a){let m=pa(d),y=Lh(f,o);if(Ue._set(m,y,u,p,_,g),Ue._get(m)!==JSON.stringify(y)){Ue._remove(m,p);let w=vl(h);return Ue._set(d,w,u,p,_,g),v}}Ue._set(d,f,u,p,_,g)}}catch(f){ye._error(f)}return v},_remove(d,h){try{T?.localStorage.removeItem(d),Ue._remove(d,h),Ue._remove(pa(d),h)}catch(u){ye._error(u)}}})})(e.cookie_persisted_properties||[],e.cookieWinsOnConflict,()=>!!this._disabled),i,s=!1,n=!1,r=e.persistence.toLowerCase();return r==="localstorage"&&ye._is_supported()?(i=ye,n=!0):r==="localstorage+cookie"&&t._is_supported()?(i=t,n=!0,s=!0):r==="sessionstorage"&&Te._is_supported()?i=Te:r==="memory"?i=Hc:r==="cookie"&&Ue._is_supported()?(i=Ue,s=!0):t._is_supported()?(i=t,n=!0,s=!0):Ue._is_supported()?(i=Ue,s=!0):i=Hc,this._splitStorageEligible=n,this._storesIdentityInCookie=s,i}_groupEntryName(e){return`${this._name}__${e}`}_resolveSplitStorage(e){return this._splitStorageEligible&&!!e.split_storage}properties(){let e={};return xe(this.props,(t,i)=>{let s=ut(i);if(!s||s.exposure==="event"){var n;if(!(s==null||(n=s.shouldSkipFromEventProperties)===null||n===void 0)&&n.call(s,t))return;e[i]=t}}),e}load(e=!1){if(this._disabled&&!e)return;let t=this._config.cookieWinsOnConflict&&this._config.persistence.toLowerCase()==="localstorage+cookie",i=t?ye._parse(this._name):null,s={};if(t)try{s=fl(Ue._parse(this._name)),xe(s,(a,l)=>{(M(a)||ue(a)||a==="")&&delete s[l]})}catch{}let n=this._storage._parse(this._name);if(n&&(this.props=Oe({},n)),this._splitStorage&&this._loadGroupEntries(),t&&n){var r,o;let a=i?.[jt],l=(r=i?.$user_state)!==null&&r!==void 0?r:fi,c=n[jt],d=(o=n.$user_state)!==null&&o!==void 0?o:fi;if(c!==a||d!==l){this._cookieIdentityChangePending=!0,this._disabled||Te._set(xo(this._name),!0);let h=Oe({},this.props);gl.forEach(p=>delete h[p]),d!=="anonymous"||l!=="identified"&&s.$user_state!=="anonymous"&&(M(a)||c===a)||(V_(h,s),delete h[Ai]),this.props=h;let u=new Set;gl.forEach(p=>{var _;let g=(_=ut(p))===null||_===void 0?void 0:_.storageGroup;g&&u.add(g)}),u.forEach(p=>{if(this._disabled)return;let _={};xe(this.props,(g,v)=>{var f;((f=ut(v))===null||f===void 0?void 0:f.storageGroup)===p&&(_[v]=g)}),Ct(_)?(ye._remove(this._groupEntryName(p)),this._slotState[p]={}):ye._set(this._groupEntryName(p),_)&&(this._slotState[p]={persisted:!0,fingerprint:this._entryFingerprint(_,p)})})}}Te._get(xo(this._name))&&(this._cookieIdentityChangePending=!0)}_loadGroupEntries(){for(let e of Dn){let t=ye._parse(this._groupEntryName(e));if(t&&!Ct(t)){let i=this._slotWriteState(e);i.persisted=!0,this._mainCarriesGroupKey(e)||(i.fingerprint=this._entryFingerprint(t,e)),this._groupEntryIsStale(e,t)||Oe(this.props,t)}}}_mainCarriesGroupKey(e){return Object.keys(this.props).some(t=>{var i;return((i=ut(t))===null||i===void 0?void 0:i.storageGroup)===e})}_groupEntryIsStale(e,t){let i=Zw[e];if(!i)return!1;let s=t[i],n=this.props[i];return ne(s)&&ne(n)&&n>s}refreshKey(e){var t;if(this._disabled||this._metaIdentifierChangePending.has(e))return;let i=this._splitStorage?(t=ut(e))===null||t===void 0?void 0:t.storageGroup:void 0,s=i?ye._parse(this._groupEntryName(i)):this._storage._parse(this._name);if(s&&e in s)this._setProp(e,s[e],!1);else{if(i){let n=this._storage._parse(this._name);if(n&&e in n)return void this._setProp(e,n[e],!1)}this._deleteProp(e,!1)}}save(){if(this._disabled)return;let e=this._saveDebounceMs();e>
1100?M(this._pendingSaveTimer)&&(this._pendingSaveTimer=setTimeout(()=>{this._pendingSaveTimer=void 0,this._writeNow()},e)):this._writeNow()}flush(){M(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0,this._writeNow())}_writeNow(e=!1){if(this._disabled||this._cookieSyncSuppressed&&!e)return;e||(this.syncCookieProperties(),this._config.cookieWinsOnConflict&&this._config.persistence.toLowerCase()==="localstorage+cookie"||E0.forEach(n=>this.refreshKey(n)));let t=!e&&!this._storageMigrationInProgress;t||(this._crossTabFeatureFlagIdentityMismatch=!1);let i=!!t&&this._reconcileCrossTabFeatureFlagPropertiesBeforeWrite();if(this._crossTabFeatureFlagIdentityMismatch)return void(this._config.debug&&D.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this._splitStorage)return this._writeNowSplit(),void(i&&this._crossTabFeatureFlagHandlers.forEach(n=>n()));let s=this._writeEntry(this._storage,this._name,this.props,et);s==="written"&&this._rememberCurrentCookieProperties(this.props),s!=="failed"&&(this._pendingCrossTabFeatureFlagChanges.clear(),this._localIdentityChangePending=!1,this._metaIdentifierChangePending.clear()),i&&this._crossTabFeatureFlagHandlers.forEach(n=>n())}_writeNowSplit(){let{main:e,groups:t}=this._partitionProps(),i=this._writeEntry(this._storage,this._name,e,et);i==="written"&&this._rememberCurrentCookieProperties(e),i!=="failed"&&(this._localIdentityChangePending=!1,this._metaIdentifierChangePending.clear(),pi.forEach(n=>{var r;!((r=ut(n))===null||r===void 0)&&r.storageGroup||this._pendingCrossTabFeatureFlagChanges.delete(n)}));for(let n of Dn){var s;let r=t[n];if(Ct(r)&&!(!((s=this._slotState[n])===null||s===void 0)&&s.persisted)){pi.forEach(a=>{var l;((l=ut(a))===null||l===void 0?void 0:l.storageGroup)===n&&this._pendingCrossTabFeatureFlagChanges.delete(a)});continue}let o=this._writeEntry(ye,this._groupEntryName(n),r,n);o!=="failed"&&pi.forEach(a=>{let l=ut(a);l?.storageGroup!==n||o!=="written"&&l.volatile||this._pendingCrossTabFeatureFlagChanges.delete(a)})}}_partitionProps(){let e={},t={flags:{},surveys:{}};return xe(this.props,(i,s)=>{var n;let r=(n=ut(s))===null||n===void 0?void 0:n.storageGroup;r?t[r][s]=i:e[s]=i}),{main:e,groups:t}}_entryFingerprint(e,t){if(t===et)return JSON.stringify(e)+"|"+this._expire_days+"|"+this._cross_subdomain+"|"+this._secure;let i={};return xe(e,(s,n)=>{var r;i[n]=!((r=ut(n))===null||r===void 0)&&r.volatile?"__volatile__":s}),JSON.stringify(i)}_writeEntry(e,t,i,s){let n=this._slotWriteState(s);if(s!==et&&!n.dirty&&!M(n.fingerprint))return"skipped";let r;try{if(r=this._entryFingerprint(i,s),r===n.fingerprint)return n.dirty=!1,"skipped"}catch{r=void 0}return e._set(t,i,this._expire_days,this._cross_subdomain,this._secure,this._config.debug)?(n.dirty=!1,s!==et&&(n.persisted=!0),M(r)||(n.fingerprint=r),this._splitStorageEligible&&(n.storageValue=ye._get(t)),"written"):(this._config.debug&&D.warn(`failed to persist storage entry "${t}"; will retry on next save`),"failed")}remove({keepGroupEntries:e=!1}={}){if(this._markAllCrossTabFeatureFlagChangesPending(),M(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0),this._storage._remove(this._name,!1),this._storage._remove(this._name,!0),!e&&this._ownsSplitStorage)for(let t of Dn)ye._remove(this._groupEntryName(t));e?delete this._slotState[et]:this._slotState={},this._lastSeenCookiePropertiesFingerprint=void 0,this._lastSeenMainCookieValue=void 0}clear(){this.remove(),this.props={}}register_once(e,t,i){if(ee(e)){this.syncCookieProperties(),M(t)&&(t="None"),this._expire_days=M(i)?this._default_expiry:i;let s=!1;if(xe(e,(n,r)=>{this.props.hasOwnProperty(r)&&this.props[r]!==t||(this._setProp(r,n),s=!0)}),s)return this.save(),!0}return!1}register(e,t){if(ee(e)){this.syncCookieProperties(),this._expire_days=M(t)?this._default_expiry:t;let i=!1;if(xe(e,(s,n)=>{e.hasOwnProperty(n)&&(this.props[n]!==s||ee(s)||W(s))&&(this._setProp(n,s),i=!0)}),i)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();let t=typeof e=="string"?[e]:e,i=!1;for(let s of t)s in this.props&&(this._deleteProp(s),i=!0);i&&this.save()}update_campaign_params(){let e=F?.URL;if(e===this._campaign_params_url)return;let t=xv(this._config.custom_campaign_params,this._config.mask_personal_data_properties,this._config.custom_personal_data_properties),i=!Ct(Gu(t));return i&&this.register(t),this._campaign_params_url=e,i?t:void 0}update_search_keyword(){this.register((function(){let e=F?.referrer;return e?Iv(e):{}})())}update_referrer_info(){var e;this.register_once({$referrer:Mv(),$referring_domain:F?.referrer&&((e=Jt(F.referrer))===null||e===void 0?void 0:e.host)||ga},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;let e=Pv(this._config.mask_personal_data_properties,this._config.custom_personal_data_properties,this._config.disable_capture_url_hashes
110);this.register_once({[$s]:this._storesIdentityInCookie?{r:To(e.r),u:e.u?To(e.u):void 0}:e},void 0)}get_initial_props(){let e={};xe([$g,Og],i=>{let s=this.props[i];s&&xe(s,function(n,r){e["$initial_"+kc(r)]=n})});let t=this.props[$s];if(t){let i=(function(s,n=!1){let r=Rv(s,n),o={};return xe(r,function(a,l){o[`$initial_${kc(l)}`]=a}),o})(t,this._config.disable_capture_url_hashes);Oe(e,i)}return e}safe_merge(e){return xe(this.props,function(t,i){i in e||(e[i]=t)}),e}update_config(e,t,i){let s=e.persistence!==t.persistence,n=!((p,_)=>{if(p.length!==_.length)return!1;let g=[...p].sort(),v=[..._].sort();return g.every((f,m)=>f===v[m])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),r=s||n,o=e.cookieWinsOnConflict!==t.cookieWinsOnConflict,a=e.disable_persistence||!!i,l=!!this._disabled&&!a;a||this._syncCookieProperties(t,l),this._config=e,!a&&(s||n||o)&&(this._lastSeenCookiePropertiesFingerprint=void 0,this._lastSeenMainCookieValue=void 0,this._syncCookieProperties(b(b({},e),{},{cookie_persisted_properties:t.cookie_persisted_properties}),l));let c=r||o?this._buildStorage(e):this._storage;this._truncateExistingPersonInfoForCookie();let d=this._resolveSplitStorage(e),h=r||d!==this._splitStorage,u=!a&&(h||e.cross_subdomain_cookie!==this._cross_subdomain||e.secure_cookie!==this._secure)&&this._beginCookieSyncSuppression(l);this._storageMigrationInProgress=h;try{if(this._default_expiry=this._expire_days=e.cookie_expiration,this.set_disabled(a),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),h){let p=this.props;this.clear(),this._storage=c,this._splitStorage=d,this.props=p,this.save()}else o&&(this._storage=c,a||(delete this._slotState[et],this._writeNow()))}finally{this._storageMigrationInProgress=!1,u&&this._endCookieSyncSuppression()}}_truncateExistingPersonInfoForCookie(){let e=this.props[$s];if(!this._storesIdentityInCookie||!ee(e)||typeof e.r!="string")return;let t=To(e.r),i=typeof e.u=="string"?To(e.u):e.u;t===e.r&&i===e.u||this._setProp($s,b(b({},e),{},{r:t,u:i}))}set_disabled(e){this._disabled=e,this._disabled?this.remove():this.save()}set_cross_subdomain(e){e!==this._cross_subdomain&&(this._cross_subdomain=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this._secure&&(this._secure=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){let i=this.props.__timers||{};i[e]=t,this._setProp(cc,i),this.save()}remove_event_timer(e){let t=this.props.__timers||{},i=t[e];return M(i)||(delete t[e],this._setProp(cc,t),this.save()),i}get_property(e){return this.props[e]}set_property(e,t){this._setProp(e,t),this.save()}_setProp(e,t,i=!0){var s;let n=this.props[e];this.props[e]=t,i&&(e!=="distinct_id"&&e!=="$user_state"||n===t||(this._localIdentityChangePending=!0),j_(e)&&!Ti(n,t)&&this._metaIdentifierChangePending.add(e),this._markPendingCrossTabFeatureFlagChanges(e,n,t),!((s=ut(e))===null||s===void 0)&&s.volatile||this._markGroupDirty(e))}_deleteProp(e,t=!0){delete this.props[e],t&&(Xl(e)&&this._setCrossTabFeatureFlagChangesPending(e,!0),j_(e)&&this._metaIdentifierChangePending.add(e),this._markGroupDirty(e))}_markGroupDirty(e){var t;let i=(t=ut(e))===null||t===void 0?void 0:t.storageGroup;i&&(this._slotWriteState(i).dirty=!0)}_slotWriteState(e){return this._slotState[e]||(this._slotState[e]={})}};var ek={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"},G_={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"},Q_=Ie("[RateLimiter]"),tk=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{let i=t.text;
110if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach(s=>{Q_.info(`${s||"events"} is quota limited.`),this.serverLimits[s]=new Date().getTime()+6e4})}catch(s){return void Q_.warn(`could not rate limit - continuing. Error: "${s?.message}"`,{text:i})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)===null||e===void 0?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)===null||e===void 0?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e=!1){var t,i,s;let{captureEventsBurstLimit:n,captureEventsPerSecond:r}=this,o=new Date().getTime(),a=(t=(i=this.instance.persistence)===null||i===void 0?void 0:i.get_property("$capture_rate_limit"))!==null&&t!==void 0?t:{tokens:n,last:o};a.tokens+=(o-a.last)/1e3*r,a.last=o,a.tokens>n&&(a.tokens=n);let l=1>a.tokens;if(l||e||(a.tokens=Math.max(0,a.tokens-1)),l&&!e){let c=(ne(a.dropped)?a.dropped:0)+1;a.dropped=c,!this.lastEventRateLimited&&this._captureWarning(c)&&(a.dropped=0)}return this.lastEventRateLimited=l,(s=this.instance.persistence)===null||s===void 0||s.set_property("$capture_rate_limit",a),{isRateLimited:l,remainingTokens:a.tokens}}_isPropertyAllowed(e){let t=this.instance.config.property_denylist;return!W(t)||!t.includes(e)}_triggeringPage(){var e;if(this._isPropertyAllowed("$current_url")&&this._isPropertyAllowed("$pathname")&&Ne?.pathname)return`${(e=Ne.origin)!==null&&e!==void 0?e:""}${Ne.pathname}`}_captureWarning(e){var t,i;let{captureEventsBurstLimit:s,captureEventsPerSecond:n}=this,r=this._triggeringPage(),o=this._isPropertyAllowed("$session_id")?(t=(i=this.instance).get_session_id)===null||t===void 0?void 0:t.call(i):void 0,a=[`${e} event(s) dropped since the last warning`,r?`triggered on ${r}`:void 0,o?`session ${o}`:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:`posthog-js client rate limited: ${a}. Config is set to ${n} events per second and ${s} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(e){let t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}},Ii=Ie("[RemoteConfig]"),x0=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=R._POSTHOG_REMOTE_CONFIG)===null||e===void 0||(e=e[this._instance.config.token])===null||e===void 0?void 0:e.config}_loadRemoteConfigJs(e){var t,i,s;!((t=R.__PosthogExtensions__)===null||t===void 0)&&t.loadExternalDependency?(i=R.__PosthogExtensions__)===null||i===void 0||(s=i.loadExternalDependency)===null||s===void 0||s.call(i,this._instance,"remote-config",()=>e(this.remoteConfig)):e()}_loadRemoteConfigJSON(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets",`/array/${this._instance.config.token}/config`),callback:e})}load(){try{if(this.remoteConfig)return Ii.info("Using preloaded remote config",this.remoteConfig),void this._onRemoteConfig(this.remoteConfig);if(this._instance._shouldDisableFlags())return void Ii.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs(e=>{if(!e)return Ii.info("No config found after loading remote JS config. Falling back to JSON."),void this._loadRemoteConfigJSON(t=>{this._onRemoteConfig(t.json,t)});this._onRemoteConfig(e)})}catch(e){Ii.error("Error loading remote config",e),this._onRemoteConfig()}}_onRemoteConfig(e,t){!e&&t&&(t.statusCode===0?t.error||Ii.warn("Failed to fetch remote config from PostHog."):Ii.error("Failed to fetch remote config from PostHog."));try{this._instance._onRemoteConfig(e?{ok:!0,config:e}:{ok:!1})}catch(s){Ii.error("Error applying remote config",s)}if(e?.hasFeatureFlags!==!1&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var i;(i=this._instance.featureFlags)===null||i===void 0||i.ensureFlagsLoaded()}catch(s){Ii.error("Error loading feature flags",s)}}};var ik=!!Cu||!!yr,T0=new WeakMap,I0="text/plain",tc=0,Go=!1,M0=(e,t)=>{let[i,s]=e.split("#"),[n,r]=i.split("?");if(!r)return e;let o=r.split("&").filter(a=>a.split("=")[0]!==t).join("&");return`${n}${o?`?${o}`:""}${s?`#${s}`:""}`},Wr=(e,t,i=!0)=>{var s;let[n,r]=e.split("?"),o=b({},t),a=(s=r?.split("&").map(c=>{var d;let[h,u]=c.split("="),p=i&&(d=o[h])!==null&&d!==void 0?d:u;return delete o[h],`${h}=${p}`}))!==null&&s!==void 0?s:[],l=Kf(o);return l&&a.push(l),a.length>0?`${n}?${a.join("&")}`:n},ic=e=>{if(e._encodedBody)return e._encodedBody;let{data:t,compression:i}=e;if(!t)return;if(i===Ft.GZipJS){let n=fv(vv(Ns(t)),{mtime:0});return{contentType:I0,body:n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength),estimatedSize:n.byteLength}}if(i===Ft.Base64){let n=(function(o){return o&&btoa(encodeURIComponent(o).replace(/%([0-9A-F]{2})/g,(a,l)=>String.fromCharCode(parseInt(l,16))))})(Ns(t)),r=(o=>
110"data="+encodeURIComponent(typeof o=="string"?o:Ns(o)))(n);return{contentType:"application/x-www-form-urlencoded",body:r,estimatedSize:new Blob([r]).size}}let s=Ns(t);return{contentType:"application/json",body:s,estimatedSize:new Blob([s]).size}},P0=e=>{let t=()=>e.transport==="sendBeacon"?{url:Wr(e.url,{compression:Ft.Base64}),encodedBody:ic(b(b({},e),{},{compression:Ft.Base64,_encodedBody:void 0}))}:{url:M0(e.url,"compression"),encodedBody:ic(b(b({},e),{},{compression:void 0,_encodedBody:void 0}))},i;try{i=ic(e)}catch(n){if(oh(e.compression,Xs(e.url,"compression")))return D.error("Failed to gzip request body, sending uncompressed payload",n),t();throw n}return i&&oh(e.compression,Xs(e.url,"compression"))&&!((s=i.body)instanceof ArrayBuffer?Mc(new Uint8Array(s)):ArrayBuffer.isView(s)&&Mc(new Uint8Array(s.buffer,s.byteOffset,s.byteLength)))?(Go=!0,t()):{url:e.url,encodedBody:i};var s},R0=e=>{try{return P0(e)}catch(i){var t;return D.error(i),void((t=e.callback)===null||t===void 0||t.call(e,{statusCode:0,error:i}))}},sk=(function(){var e=Ce(function*(t){let i=yield Df(Ns(t.data),Qe.DEBUG,{rethrow:!0});if(!i)return t;let s=yield i.arrayBuffer();return b(b({},t),{},{_encodedBody:{contentType:I0,body:s,estimatedSize:s.byteLength}})});return function(t){return e.apply(this,arguments)}})(),nk=/Failed to fetch|NetworkError|Load failed/i,F0=e=>e?.name==="TypeError"&&nk.test(e?.message||""),A0=e=>{try{let t=(function(i,s=Date.now()){if(typeof i!="string"||!i)return;let n=i.trim(),r=/^\d+\s*,/.test(n)?n.slice(0,n.indexOf(",")).trim():n;if(/^\d+$/.test(r)){let l=1e3*Math.min(Number(r),300);return l>0?l:void 0}if(!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(r))return;let o=/^\w{3} \w{3} /.test(r)?r+" GMT":r,a=Date.parse(o)-s;return Number.isFinite(a)&&a>0?Math.min(a,Ao):void 0})(e());return M(t)?void 0:Math.min(t,3e4)}catch{return}},L0=e=>{let t=R0(e);if(!t)return;let i=new Cu;T0.set(i,!0);let{url:s,encodedBody:n}=t;i.open(e.method||"GET",s,!0);let{contentType:r,body:o}=n??{};xe(e.headers,function(a,l){i.setRequestHeader(l,a)}),r&&i.setRequestHeader("Content-Type",r),e.timeout&&(i.timeout=e.timeout),i.onreadystatechange=()=>{if(i.readyState===4){var a;let l={statusCode:i.status,text:i.responseText};if(i.status===200)try{l.json=JSON.parse(i.responseText)}catch{}(a=e.callback)===null||a===void 0||a.call(e,l,A0(()=>i.getResponseHeader("Retry-After")))}},i.send(o)},O0=e=>{let t=R0(e);if(!t)return;let{url:i,encodedBody:s}=t,{contentType:n,body:r,estimatedSize:o}=s??{},a=new Headers;xe(e.headers,function(_,g){a.append(g,_)}),n&&a.append("Content-Type",n);let l=null,c=!1;if(qd){let _=new qd;l={signal:_.signal,timeout:setTimeout(()=>{c=!0;try{_.abort(Tf("AbortError","PostHog request timed out"+((g=e.timeout)?` after ${g}ms`:"")))}catch(v){h(v)}var g},e.timeout)}}let d=!1,h=_=>{var g;d||(d=!0,c&&_?.name==="AbortError"||F0(_)?D.warn(_):D.error(_),(g=e.callback)===null||g===void 0||g.call(e,{statusCode:0,error:_}))},u=0,p=()=>{tc-=u,u=0,l&&clearTimeout(l.timeout)};try{let _=b({method:e?.method||"GET",headers:a,referrerPolicy:"strict-origin",body:r,signal:l?.signal},e.fetchOptions),g=o??(M(r)?0:void 0);_.keepalive=_.method==="POST"&&!e._keepaliveDisabled&&_.keepalive!==!1&&_.body===r&&!M(g)&&g>=0&&52428.8>tc+g,_.keepalive&&(u=g,tc+=u),yr(i,_).then(v=>v.text().then(f=>{var m;if(d)return;let y={statusCode:v.status,text:f};if(v.status===200)try{y.json=JSON.parse(f)}catch(w){D.error(w)}d=!0,p(),(m=e.callback)===null||m===void 0||m.call(e,y,A0(()=>v.headers.get("Retry-After")))})).catch(v=>{p(),h(v)}).finally(p)}catch(_){p(),h(_)}},bu=e=>{try{var t;let{url:i,encodedBody:s}=P0(e),{contentType:n,body:r,estimatedSize:o}=s??{};if(!r)return;let a=r instanceof Blob?r:new Blob([r],{type:n});if(Je.sendBeacon(i,a))return;let l=W(e.data)?e.data:(t=e.data)===null||t===void 0?void 0:t.batch;if(W(l)&&l.length>1&&(o??0)>16384){let c=Math.ceil(l.length/2),d=h=>W(e.data)?h:b(b({},e.data),{},{batch:h});return bu(b(b({},e),{},{data:d(l.slice(0,c))})),void bu(b(b({},e),{},{data:d(l.slice(c))}))}D.warn(`Beacon of ~${o??0} bytes was rejected by the browser, falling back to ${yr?"fetch":"XHR"}`),yr?O0(b(b({},e),{},{_keepaliveDisabled:!0})):L0(e)}catch(i){D.warn("Beacon send failed",i)}},K_=(e,t,i,s)=>{let n=s==="query"?t==="POST"?"sent_at":"_":void 0;return Wr(i===Ft.GZipJS?M0(e,"compression"):e,b(b({},n?{[n]:Date.now().toString()}:{}),i===Ft.GZipJS?{}:{compression:i}))},rk=(()=>{let e=[];return yr&&e.push({transport:"fetch",method:O0}),Cu&&e.push({transport:"XHR",method:L0}),Je?.sendBeacon&&e.push({transport:"sendBeacon",method:bu}),e})(),$0=!ik&&pt?.indexOf("MSIE")===-1&&pt?.indexOf("Mozilla")===-1;function D0(e,t,i){var s,n,r;i&&(t=b(b({},t),{},{callback:o=>i(o)})),e.__loaded?$0?e.__request_queue.push(t):e.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&((n=t.callback)===null||n===void 0||n.call(t,{statusCode:429})):(t.transport=t.transport||e.config.api_transport,t.headers=b(b({},e.config.request_headers),t.headers),t.compression=t.compression==="best-available"?(s=e.compression)!==null&&s!==void 0?s:t.compressionFallback:t.compression,(M(e.config.disable_beacon)?e.config.__preview_disable_beacon:e.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||e.config.fetch_options,
110((o,a)=>{var l,c,d;let h=b(b({},o),{},{callback:a??(v=>{var f;return(f=o.callback)===null||f===void 0?void 0:f.call(o,v)})});h.timeout=h.timeout||6e4;let u=(l=h.transport)!==null&&l!==void 0?l:"fetch";u==="sendBeacon"&&M(h.compression)&&h.data&&(h.compression=Ft.Base64),h.method==="POST"&&h.data&&(h.timestampMode==="capture-body"?h.data=(v=>{var f,m;let y=(W(v)?v:[v]).map(S=>b(b({},S),S.timestamp instanceof Date&&!isNaN(S.timestamp.getTime())?{timestamp:S.timestamp.toISOString()}:{})),w=y[0];return{api_key:(f=w==null||(m=w.properties)===null||m===void 0?void 0:m.token)!==null&&f!==void 0?f:w?.token,batch:y,sent_at:new Date().toISOString()}})(h.data):h.timestampMode==="body"&&(h.data=((v,f=new Date().toISOString())=>W(v)?v.map(m=>b(b({},m),{},{sent_at:f})):b(b({},v),{},{sent_at:f}))(h.data))),h.url=K_(h.url,h.method,h.compression,h.timestampMode);let p=rk.filter(v=>!h.disableTransport||!v.transport||!h.disableTransport.includes(v.transport)),_=(c=(d=(function(v,f){for(let m=0;v.length>m;m++)if(f(v[m]))return v[m]})(p,v=>v.transport===u))===null||d===void 0?void 0:d.method)!==null&&c!==void 0?c:p[0].method;if(!_)throw new Error("No available transport method");let g=v=>{try{_(v)}catch(m){var f;F0(m)?D.warn(m):D.error(m),(f=h.callback)===null||f===void 0||f.call(h,{statusCode:0,error:m})}};u!=="sendBeacon"&&!h.preferSyncCompression&&h.data&&h.compression===Ft.GZipJS&&Q0&&typeof Promise<"u"&&!Go?sk(h).then(v=>{g(v)}).catch(v=>{if(Of(v))return Go=!0,void g(b(b({},h),{},{compression:void 0,url:K_(o.url,o.method,void 0,o.timestampMode)}));$f(v)&&(Go=!0),g(h)}):g(h)})(t,(o,a)=>{var l,c,d;e.rateLimiter.checkForLimiting(o),400>o.statusCode||(l=(c=e.config).on_request_error)===null||l===void 0||l.call(c,o),i?i(o,a):(d=t.callback)===null||d===void 0||d.call(t,o)})):t.fireCallbackOnDrop&&((r=t.callback)===null||r===void 0||r.call(t,{statusCode:0}))}var ok=class{constructor(e,t){this._isPaused=!0,this._queue=[],this._flushTimeoutMs=Tt(t?.flush_interval_ms||3e3,250,5e3,D.createLogger("flush interval"),3e3),this._sendRequest=e}enqueue(e){this._queue.push(e),this._flushTimeout||this._setFlushTimeout()}unload(){this._clearFlushTimeout();let e=this._queue.length>0?this._formatQueue():{},t=Object.values(e);[...t.filter(i=>i.url.indexOf("/e")===0),...t.filter(i=>i.url.indexOf("/e")!==0)].map(i=>{this._sendRequestSafely(i,"sendBeacon")})}enable(){this._isPaused=!1,this._setFlushTimeout()}_setFlushTimeout(){this._isPaused||(this._flushTimeout=setTimeout(()=>{if(this._clearFlushTimeout(),this._queue.length>0){let e=this._formatQueue();for(let t in e)this._sendRequestSafely(e[t])}},this._flushTimeoutMs))}_sendRequestSafely(e,t){try{this._sendRequest(e,t)}catch(i){D.error(i)}}_clearFlushTimeout(){clearTimeout(this._flushTimeout),this._flushTimeout=void 0}_formatQueue(){let e={};return xe(this._queue,t=>{var i;let s=t,n=((s?s.batchKey:null)||s.url)+(s.batchGroup?`:${s.batchGroup}`:"");M(e[n])&&(e[n]=b(b({},s),{},{data:[]})),(i=e[n].data)===null||i===void 0||i.push(s.data)}),this._queue=[],e}},ak=["retriesPerformedSoFar"],lk=class{constructor(e){this._instance=e,this._isPolling=!1,this._pollIntervalMs=3e3,this._queue=[],this._queue=[],this._areWeOnline=!0,this.resume()}resume(){if(!M(T)&&"onLine"in T.navigator){if(this._areWeOnline=T.navigator.onLine,this._onlineListener)return;this._onlineListener=()=>{this._areWeOnline=!0,this._flush()},this._offlineListener=()=>{this._areWeOnline=!1},Z(T,"online",this._onlineListener),Z(T,"offline",this._offlineListener)}}get length(){return this._queue.length}retriableRequest(e,t){let{retriesPerformedSoFar:i}=e,s=ju(e,ak);hi(i)&&(s.url=Wr(s.url,{retry_count:i})),D0(this._instance,t?b(b({},s),{},{transport:t}):s,(n,r)=>{var o;if(n.statusCode!==200&&(400>n.statusCode||n.statusCode>=500)){if((n.statusCode===0?3:10)>(i??0))return void this._enqueue(b({retriesPerformedSoFar:i},s),r);n.statusCode===0&&D.warn(`Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after ${i??0} retries.`)}(o=s.callback)===null||o===void 0||o.call(s,n)})}_enqueue(e,t){let i=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=i+1;let s=Math.max((function(o){let a=3e3*Math.pow(2,o),l=a/2,c=Math.min(18e5,a),d=(Math.random()-.5)*(c-l);return Math.ceil(c+d)})(i),t??0),n=Date.now()+s;this._queue.push({retryAt:n,requestOptions:e});let r=`Enqueued failed request for retry in ${s}`;navigator.onLine||(r+=" (Browser is offline)"),D.warn(r),this._isPolling||(this._isPolling=!0,this._poll())}_poll(){if(this._poller&&clearTimeout(this._poller),this._queue.length===0)return this._isPolling=!1,void(this._poller=void 0);this._poller=setTimeout(()=>{this._areWeOnline&&this._queue.length>0&&this._flush(),this._poll()},this._pollIntervalMs)}_flush(){let e=Date.now(),t=[],i=this._queue.filter(s=>e>s.retryAt||(t.push(s),!1));if(this._queue=t,i.length>0)for(let{requestOptions:s}of i)this.retriableRequest(s)}unload(){this._poller&&(clearTimeout(this._poller),this._poller=void 0),this._isPolling=!1,M(T)||(this._onlineListener&&(T.removeEventListener("online",this._onlineListener),this._onlineListener=void 0),this._offlineListener&&(T.removeEventListener("offline",this._offlineListener),this._offlineListener=void 0));for(let{requestOptions:e}of this._queue)try{this._instance._send_request(b(b({},e),{},{transport:"sendBeacon"}))}catch(t){D.error(t)}this._queue=[]}},ck=class{constructor(e){this._instance=e,this._updateScrollData=()=>{var t,i,s,n;this._context||(this._context={});let r=this.scrollElement(),o=this.scrollY(),a=r?Math.max(0,r.scrollHeight-r.clientHeight):0,l=o+(r?.clientHeight||0),c=r?.scrollHeight||0;this._context.lastScrollY=Math.ceil(o),this._context.maxScrollY=Math.max(o,(t=this._context.maxScrollY)!==null&&t!==void 0?t:0),this._context.maxScrollHeight=Math.max(a,(i=this._context.maxScrollHeight)!==null&&i!==void 0?i:0),this._context.lastContentY=l,this._context.maxContentY=Math.max(l,(s=this._context.maxContentY)!==null&&s!==void 0?s:0),this._context.maxContentHeight=Math.max(c,(n=this._context.maxContentHeight)!==null&&n!==void 0?n:0)}}get _scrollRoot(){return this._instance.config.scroll_root_selector}getContext(){return this._context}resetContext(){let e=this._context;return this._context=void 0,setTimeout(this._updateScrollData,0),e}startMeasuringScrollPosition(){Z(T,"scroll",this._updateScrollData,{capture:!0}),Z(T,"scrollend",this._updateScrollData,{capture:!0}),Z(T,"resize",this._updateScrollData)}scrollElement(){if(this._scrollRoot){let i=W(this._scrollRoot)?this._scrollRoot:[this._scrollRoot];for(let s of i){var e;let n=T==null||(e=T.document)===null||e===void 0?void 0:e.querySelector(s);if(n)return n}return}var t;return T==null||(t=T.document)===null||t===void 0?void 0:t.documentElement}_scrollPosition(e){var t,i;let s=e==="y"?"scrollTop":"scrollLeft";if(this._scrollRoot){let n=this.scrollElement();return n&&n[s]||0}return T?e==="y"?T.scrollY||T.pageYOffset||((t=T.document)===null||t===void 0||(t=t.documentElement)===null||t===void 0?void 0:t.scrollTop)||0:T.scrollX||T.pageXOffset||((i=T.document)===null||i===void 0||(i=i.documentElement)===null||i===void 0?void 0:i.scrollLeft)||0:0}scrollY(){return this._scrollPosition("y")}scrollX(){return this._scrollPosition("x")}},uk=e=>Pv(e?.config.mask_personal_data_properties,e?.config.custom_personal_data_properties,e?.config.disable_capture_url_hashes
110),J_=class{constructor(e,t,i,s){this._onSessionIdCallback=n=>{let r=this._getStored();if(r&&r.sessionId===n)return;let o={sessionId:n,props:this._sessionSourceParamGenerator(this._instance)};this._persistence.register({[Sc]:o})},this._instance=e,this._sessionIdManager=t,this._persistence=i,this._sessionSourceParamGenerator=s||uk,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStored(){return this._persistence.props[Sc]}getSetOnceProps(){var e;let t=(e=this._getStored())===null||e===void 0?void 0:e.props;return t?"r"in t?Rv(t,this._instance.config.disable_capture_url_hashes):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){let e={};return xe(Gu(this.getSetOnceProps()),(t,i)=>{i==="$current_url"&&(i="url"),e[`$session_entry_${kc(i)}`]=t}),e}},Aa=class{on(e,t){return this._events[e]||(this._events[e]=[]),this._events[e].push(t),()=>{this._events[e]=this._events[e].filter(i=>i!==t)}}emit(e,t){for(let i of this._events[e]||[])i(t);for(let i of this._events["*"]||[])i(e,t)}constructor(){this._events={}}},xs=Ie("[SessionId]"),Y_=864e5,Z_=class{on(e,t){return this._eventEmitter.on(e,t)}constructor(e,t,i){var s;if(this._lastPersistedActivityTimestamp=null,this._lastCookieSyncTimestamp=null,this._sessionIdChangedHandlers=[],this._beforeUnloadListener=void 0,this._destroyed=!1,this._eventEmitter=new Aa,this._sessionHasBeenIdleTooLong=(r,o)=>!(!hi(r)||!hi(o))&&Math.abs(r-o)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this._config=e.config,this._persistence=e.persistence,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._pendingBootstrapSession=void 0,this._sessionActivityTimestamp=null,this._sessionIdGenerator=t||Rt,this._windowIdGenerator=i||Rt;let n=this._config.persistence_name||this._config.token;if(this._sessionTimeoutMs=1e3*Tt(this._config.session_idle_timeout_seconds||1800,60,36e3,xs.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this._resetIdleTimer(),this._window_id_storage_key="ph_"+n+"_window_id",this._primary_window_exists_storage_key="ph_"+n+"_primary_window_exists",this._canUseSessionStorage()){let r=Te._parse(this._window_id_storage_key),o=Te._parse(this._primary_window_exists_storage_key);r&&!o?this._windowId=r:Te._remove(this._window_id_storage_key),Te._set(this._primary_window_exists_storage_key,!0)}!((s=this._config.bootstrap)===null||s===void 0)&&s.sessionID&&this.setBootstrapSessionId(this._config.bootstrap.sessionID),this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return M(this._sessionIdChangedHandlers)&&(this._sessionIdChangedHandlers=[]),this._sessionIdChangedHandlers.push(e),this._sessionId&&e(this._sessionId,this._windowId),()=>{this._sessionIdChangedHandlers=this._sessionIdChangedHandlers.filter(t=>t!==e)}}_canUseSessionStorage(){return this._config.persistence!=="memory"&&!this._persistence._disabled&&Te._is_supported()}_setWindowId(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&Te._set(this._window_id_storage_key,e))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?Te._parse(this._window_id_storage_key):null}_isActivityChangeBelowGranularity(e){let t=this._lastPersistedActivityTimestamp;return!ue(t)&&!ue(e)&&5e3>Math.abs(e-t)}_setSessionId(e,t,i){let s=t!==this._sessionActivityTimestamp,n=!(e!==this._sessionId||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this._sessionId=e,n&&!s||n&&this._isActivityChangeBelowGranularity(t)||(this._lastPersistedActivityTimestamp=t,this._persistence.register({[Os]:[t,e,i]}))}_useCrossTabRefreshHardening(){var e;let t=(e=this._config)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return hi(t)&&t>0}_refreshSessionIdFromStorage(){this._useCrossTabRefreshHardening()?this._persistence.refreshKey(Os):(this._persistence.flush(),this._persistence.load())}_flushPendingActivityTimestamp(){var e;if(ue(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this._lastPersistedActivityTimestamp)return;this._refreshSessionIdFromStorage();let[,t,i]=this._getSessionId();t===this._sessionId&&i===this._sessionStartTimestamp&&(this._lastPersistedActivityTimestamp=this._sessionActivityTimestamp,this._persistence.register({[Os]:[this._sessionActivityTimestamp,(e=this._sessionId)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this._persistence.flush())}_freshestActivityTimestamp(){let[e]=this._getSessionId(),t=hi(e)?e:0,i=hi(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,i)}_isSessionIdleAfterCrossTabRefresh(e){return this._refreshSessionIdFromStorage(),this._sessionHasBeenIdleTooLong(e,this._freshestActivityTimestamp())}_getSessionId(){let e=this._persistence.props[Os];return W(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this._lastPersistedActivityTimestamp=null,this._pendingBootstrapSession=void 0,clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._setSessionId(null,null,null)}setBootstrapSessionId(e,t=!1){let i=((s,n=new Date().getTime())=>{try{let r=(o=>{let a=o.replace(/-/g,"");if(a.length!==32)throw new Error("Not a valid UUID");if(a[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(a.substring(0,12),16)})(s);return r>n+6e4?void xs.error("Bootstrap sessionID cannot be in the future"):r}catch(r){return void xs.error("Invalid sessionID in bootstrap",r)}})(e);return!M(i)&&(t?this._pendingBootstrapSession={sessionId:e,sessionStartTimestamp:i}:this._setSessionId(e,new Date().getTime(),i),!0)}destroy(){this._destroyed=!0,this._flushPendingActivityTimestamp(),clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._beforeUnloadListener&&T&&(T.removeEventListener(Jo,this._beforeUnloadListener,{capture:!1}
110),this._beforeUnloadListener=void 0),this._sessionIdChangedHandlers=[]}_listenToReloadWindow(){this._beforeUnloadListener=()=>{this._flushPendingActivityTimestamp(),this._canUseSessionStorage()&&Te._remove(this._primary_window_exists_storage_key)},Z(T,Jo,this._beforeUnloadListener,{capture:!1})}checkAndGetSessionAndWindowId(e=!1,t=null,i=!1){if(this._config.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');let s=t||new Date().getTime(),n=this._sessionId;if(i)this._lastCookieSyncTimestamp=s;else if(ue(this._lastCookieSyncTimestamp)||this._lastCookieSyncTimestamp>s||s-this._lastCookieSyncTimestamp>=1e3){var r,o;(r=(o=this._persistence).syncCookieProperties)===null||r===void 0||r.call(o),this._lastCookieSyncTimestamp=s}let[,a,l]=this._getSessionId(),c=!M(n)&&a!==n,d=this._freshestActivityTimestamp(),h=this._getWindowId(),u=this._pendingBootstrapSession,p=!!u&&(u.sessionStartTimestamp>s+6e4||s-u.sessionStartTimestamp>Y_),_=u?p:hi(l)&&Math.abs(s-l)>Y_,g=!1,v=c,f=!a||!!u,m=a,y=!f&&!e&&this._sessionHasBeenIdleTooLong(s,d);if(y&&(y=this._isSessionIdleAfterCrossTabRefresh(s),y||xs.info("cross-tab refresh kept the session alive",{sessionId:a}),[,a,l]=this._getSessionId(),y||(f=!a||!!u)),f||y||_){v=!1;let k=u&&!p;a=k?u.sessionId:this._sessionIdGenerator(),h=this._windowIdGenerator(),xs.info("new session ID assigned",{sessionId:a,windowId:h,bootstrapped:!!k,changeReason:{noSessionId:f,activityTimeout:y,sessionPastMaximumLength:_}}),l=k?u.sessionStartTimestamp:s,this._pendingBootstrapSession=void 0,g=!0}else h||(h=this._windowIdGenerator(),g=!0),v=v||a!==m,v&&(xs.info("adopted cross-tab session id",{sessionId:a,windowId:h}),g=!0);let w=hi(d)&&e&&!_?d:s,S=hi(l)?l:new Date().getTime();this._setWindowId(h),this._setSessionId(a,w,S),e||this._resetIdleTimer();let x={noSessionId:f,activityTimeout:y,sessionPastMaximumLength:_,crossTabAdoption:v};return g&&this._sessionIdChangedHandlers.forEach(k=>k(a,h,x)),{sessionId:a,windowId:h,sessionStartTimestamp:S,changeReason:g?x:void 0,lastActivityTimestamp:d}}_resetIdleTimer(){this._destroyed||(clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=setTimeout(()=>{if(!this._destroyed)if(this._isSessionIdleAfterCrossTabRefresh(new Date().getTime())){let e=this._sessionId;this.resetSessionId(),this._eventEmitter.emit("forcedIdleReset",{idleSessionId:e})}else this._resetIdleTimer()},1.1*this.sessionTimeoutMs))}},N0=function(e,t){if(!e)return!1;let i=e.userAgent;if(i&&Kd(i,t))return!0;try{let s=e?.userAgentData;if(s?.brands&&s.brands.some(n=>Kd(n?.brand,t)))return!0}catch{}return!!e.webdriver};function Su(){return Su=Ce(function*(){let e=Je?.userAgentData;if(e?.getHighEntropyValues)try{let t=yield e.getHighEntropyValues(["model"]),i=t?.model;return oe(i)&&i.length>0?i:void 0}catch(t){return void D.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}}),Su.apply(this,arguments)}var wu="custom",X_="i.posthog.com",dk=/^\/static\//,hk=["/s/","/e/","/i/"],pk=class{constructor(e){this._regionCache={},this.instance=e}get apiHost(){let e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){let e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e;let t=(e=this.instance.config.ui_host)===null||e===void 0?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace(`.${X_}`,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this._regionCache[this.apiHost]||(this._regionCache[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":wu),this._regionCache[this.apiHost]}_staticAssetHostOverride(e){if(!dk.test(e))return;let t=this.instance.config.asset_host;return typeof t=="string"&&t.trim().replace(/\/$/,"")||void 0}_urlKey(e){let t=Jt(e);return t?t.protocol+"//"+t.host+t.pathname:void 0}_prepareEndpoint(e,t,i){if(e==="ui")return i;let s=i,n=this.instance.config.rewriteRequestPath;if(n){var r;let o=((r=Jt(i))===null||r===void 0?void 0:r.href)||i;s=n(new URL(o)).toString()}if(n&&e==="api"&&hk.some(o=>t.indexOf(o)===0)){let o=this._urlKey(s);if(o){let a=this.apiHost,l=this._ingestionEndpoints;
110l?.apiHost===a&&l.rewriteRequestPath===n||(l={apiHost:a,rewriteRequestPath:n,urls:new Set},this._ingestionEndpoints=l),l.urls.add(o)}}return s}isIngestionEndpoint(e){let t=this._ingestionEndpoints,i=this._urlKey(e);return t?.apiHost===this.apiHost&&t.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!i&&t.urls.has(i)}endpointFor(e,t=""){if(t&&(t=t[0]==="/"?t:`/${t}`),e==="ui")return this._prepareEndpoint(e,t,this.uiHost+t);if(e==="flags")return this._prepareEndpoint(e,t,this.flagsApiHost+t);if(e==="assets"){let s=this._staticAssetHostOverride(t);if(s)return this._prepareEndpoint(e,t,`${s}${t}`)}if(this.region===wu)return this._prepareEndpoint(e,t,this.apiHost+t);let i=X_+t;switch(e){case"assets":return this._prepareEndpoint(e,t,`https://${this.region}-assets.${i}`);case"api":return this._prepareEndpoint(e,t,`https://${this.region}.${i}`)}}},_k=Ie("[PostHog ExternalIntegrations]"),gk={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},fk=class{constructor(e){this._instance=e}_loadScript(e,t){var i,s;(i=R.__PosthogExtensions__)===null||i===void 0||(s=i.loadExternalDependency)===null||s===void 0||s.call(i,this._instance,e,n=>{if(n)return _k.error("failed to load script",n);t()})}startIfEnabledOrStop(){var e;for(let[n,r]of Object.entries((e=this._instance.config.integrations)!==null&&e!==void 0?e:{})){var t,i,s;r&&!(!((t=R.__PosthogExtensions__)===null||t===void 0||(t=t.integrations)===null||t===void 0)&&t[n])&&this._loadScript(gk[n],()=>{var o;(o=R.__PosthogExtensions__)===null||o===void 0||(o=o.integrations)===null||o===void 0||(o=o[n])===null||o===void 0||o.start(this._instance)}),!r&&(!((i=R.__PosthogExtensions__)===null||i===void 0||(i=i.integrations)===null||i===void 0)&&i[n])&&((s=R.__PosthogExtensions__)===null||s===void 0||(s=s.integrations)===null||s===void 0||(s=s[n])===null||s===void 0||s.stop())}}},vk=class{constructor(e,t){this._logger=e,this._client=t,this._extensions=new Map,this._disposed=!1}add(e){var t=this;return Ce(function*(){if(t._disposed)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(t._extensions.has(e.name))throw new Error(`Browser extension "${e.name}" is already registered`);t._extensions.set(e.name,e);try{let i=e.setup(t._client);i&&(yield i)}catch(i){let s=t._extensions.get(e.name)===e;s&&t._extensions.delete(e.name),t._logger.error(`Failed to set up browser extension "${e.name}"`,i),s&&t._disposeExtension(e)}})()}getExtension(e){return this._extensions.get(e)}dispose(){if(this._disposed)return;this._disposed=!0;let e=Array.from(this._extensions.values()).reverse();this._extensions.clear();for(let t of e)this._disposeExtension(t)}_disposeExtension(e){try{var t;let i=(t=e.dispose)===null||t===void 0?void 0:t.call(e);i&&_e(i.then)&&i.then(void 0,s=>{this._logger.error(`Failed to dispose browser extension "${e.name}"`,s)})}catch(i){this._logger.error(`Failed to dispose browser extension "${e.name}"`,i)}}},mk=class{constructor(e){this._instance=e}initialize(){}get(e){let t=this._instance.persistence;if(typeof e=="string")return t?.get_property(e);let i={};for(let s of e){let n=t?.get_property(s);M(n)||(i[s]=n)}return i}set(e,t){var i;(i=this._instance.persistence)===null||i===void 0||i.register(typeof e=="string"?{[e]:t}:e)}remove(e){var t;(t=this._instance.persistence)===null||t===void 0||t.unregister(e)}},eg="extensionsRemoteConfig",yk=class{constructor(e){this.instance=e,this._disposed=!1,this._logger=D,this._latestRemoteConfigResult=e._lastRemoteConfig,this.kv=new mk(e),this.onEvent=t=>mo(this.instance.on("eventCaptured",i=>{try{t({event:i.event,properties:i.properties})}catch(s){this._logger.error("Browser extension event listener failed",s)}})),this.onRemoteConfig=t=>{if(this._disposed)return mo(()=>{});let i=n=>{try{t(n)}catch(r){this._logger.error("Browser extension remote config listener failed",r)}},s=this.instance._internalEventEmitter.on(eg,i);return this._latestRemoteConfigResult&&i(this._latestRemoteConfigResult),mo(s)},this._runtime=new vk(D.createLogger("[BrowserExtensions]"),this)}get logger(){return this._logger}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return(e=this.instance.get_property("$device_id"))!==null&&e!==void 0?e:this.distinctId}get deviceId(){let e=this.instance.get_property(Eu);return typeof e=="string"?e:void 0}get library(){return{name:Qe.LIB_NAME,version:Qe.LIB_VERSION}}get initialPersonProperties(){var e,t;return(e=(t=this.instance.persistence)===null||t===void 0?void 0:t.get_initial_props())!==null&&e!==void 0?e:{}}get groups(){return this.instance.getGroups()}get session(){try{var e,t,i,s;let n=(e=this.instance.sessionManager)===null||e===void 0?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:(t=n?.sessionId)!==null&&t!==void 0?t:"",windowId:(i=n?.windowId)!==null&&i!==void 0?i:"",sessionStartTimestamp:(s=n?.sessionStartTimestamp)!==null&&s!==void 0?s:0}}catch{return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(e){return this._runtime.add(e)}getExtension(e){return this._runtime.getExtension(e)}capture(e,t,i){i?this.instance.capture(e,t,{timestamp:i.timestamp,uuid:i.uuid,$set:i.set,$set_once:i.setOnce}):this.instance.capture(e,t)}registerDynamicEventProperties(e){return mo(this.instance._registerExtensionEventProperties(e))}handleRemoteConfig(e){this._disposed||(this._latestRemoteConfigResult=e,this.instance._internalEventEmitter.emit(eg,e))}sendRequest(e){var t=this;return Ce(function*(i,s={}){var n;let r=t.instance.requestRouter.endpointFor((n=s.target)!==null&&n!==void 0?n:"api",i),o={method:s.method,url:s.query?Wr(r,s.query
110):r,data:s.body,headers:s.headers,timeout:s.timeoutMs,fireCallbackOnDrop:!0,transport:s.transport,compression:s.compression,compressionFallback:s.target==="flags"&&s.compression==="best-available"?wc.Base64:void 0,timestampMode:s.sentAt};return s.transport==="sendBeacon"?(t.instance._send_request(o),{statusCode:202}):new Promise(a=>{o.callback=a,t.instance._send_request(o)})}).apply(this,arguments)}dispose(){this._disposed||(this._disposed=!0,this._runtime.dispose())}},fr={},sc=0,vr=()=>{},tg='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Ts="Surveys module not available",ig="sanitize_properties is deprecated. Use before_send instead",B0="Invalid value for property_denylist config: ",bk=["$recording_status","$sdk_debug_recording_script_not_loaded","$sdk_debug_replay_url_trigger_status","$sdk_debug_replay_event_trigger_status","$sdk_debug_replay_linked_flag_trigger_status","$sdk_debug_replay_rrweb_error","$sdk_debug_replay_internal_buffer_length","$sdk_debug_replay_flushed_size"],Sk=["$feature_flag_called","$$heatmap","$snapshot"],sg=e=>e.charAt(0)==="$"&&!ie(Sk,e),wk=/^[A-Za-z0-9_-]{1,400}$/,ng=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,rg=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,kk=["token","distinct_id",Dg],Gn="posthog",Ck=e=>{let t={};return e&&e!=="unset"&&("2025-11-30">e||(t.strictMinimumDuration=!0),"2026-05-30">e||(t.canvasCapture={resolutionScale:.6}),"2026-06-25">e||(t.streamNetworkBody=!0),"2026-08-30">e||(t.captureJsonLd=!0)),t},nc=e=>{var t;return b({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:db(F?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:vr,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:e??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:Ne&&oe(Ne?.search)&&Ne.search.indexOf("__posthog_debug=true")!==-1||!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:(T==null||(t=T.location)===null||t===void 0?void 0:t.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,feature_flag_request_max_retries:1,surveys_request_timeout_ms:1e4,on_request_error(i){D.error("Bad HTTP status: "+i.statusCode+" "+i.text)},get_device_id:i=>i,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:Hg,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:vr},(i=>({rageclick:i&&i>="2026-05-30"?{content_ignorelist:pb,ignore_text_selection:!0}
110:!i||"2025-11-30">i||{content_ignorelist:!0},capture_pageview:!i||"2025-05-24">i||"history_change",session_recording:Ck(i),external_scripts_inject_target:i&&i>="2026-01-30"?"head":"body",internal_or_test_user_hostname:i&&i>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:i&&i>="2026-05-30"?250:0,split_storage:!(!i||"2026-05-30">i),detect_google_search_app:!(!i||"2026-05-30">i),disable_capture_url_hashes:!(!i||"2026-06-25">i),cookieWinsOnConflict:!(!i||i==="unset"||"2026-08-29">i)}))(e))},Ek=[["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"]],og=e=>{let t={};for(let[n,r]of Ek)M(e[n])||(t[r]=e[n]);let i=Oe({},t,e),s=e.__preview_external_dependency_versioned_paths;return M(s)||(M(e.strict_script_versioning)&&(i.strict_script_versioning=!!s),oe(s)&&M(e.asset_host)&&(i.asset_host=s)),W(e.property_blacklist)&&(M(e.property_denylist)?i.property_denylist=e.property_blacklist:W(e.property_denylist)?i.property_denylist=[...e.property_blacklist,...e.property_denylist]:D.error(B0+e.property_denylist)),i},xk=class{constructor(){this.__forceAllowLocalhost=!1}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){D.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},mr=class Pi{_removeExtension(t){if(!t)return;let i=this._extensions.indexOf(t);i!==-1&&this._extensions.splice(i,1)}_replaceExtension(t,i){var s;return this._removeExtension(t),this._extensions.push(i),(s=i.initialize)===null||s===void 0||s.call(i),i}_inCookielessMode(){return this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isRejected()}_warnIfVolatileIdentityWithoutStableId(){if(this._hasWarnedAboutVolatileIdentity||this.config.reuseAnonymousId||this.config.segment||this._inCookielessMode())return;let t=this.config.persistence==="memory"||this.config.persistence==="sessionStorage";if(!t&&!this.config.disable_persistence||this._hasStableInitialDistinctId)return;let i,s,n;t?(i=`persistence is set to '${this.config.persistence}'`,s=this.config.persistence==="memory"?"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."):(i="persistence is disabled (disable_persistence is true)",s="on every page load",n="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this._hasWarnedAboutVolatileIdentity=!0,console.warn("[PostHog.js]",`${i} but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ${s}, so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. ${n}`)}_syncCookielessIdentity(){let t=this.persistence;if(!t||this._isConsentTransition)return;if(this._inCookielessMode())return void(this.config.cookieless_mode==="on_reject"&&this.get_distinct_id()!=="$posthog_cookieless"&&(this._sync_opt_out_with_persistence(),this._enterCookielessMode()));if(this.get_distinct_id()!=="$posthog_cookieless")return;this._is_persistence_disabled()||t.load(!0);let i=this.get_distinct_id();if(!i||i==="$posthog_cookieless"){let s=this.config.get_device_id(Rt());this.register({distinct_id:s,$device_id:s}),t.set_property(St,fi)}this._sync_opt_out_with_persistence()}get decideEndpointWasHit(){var t,i;return(t=(i=this.featureFlags)===null||i===void 0?void 0:i.hasLoadedFlags)!==null&&t!==void 0&&t}get flagsEndpointWasHit(){var t,i;return(t=(i=this.featureFlags)===null||i===void 0?void 0:i.hasLoadedFlags)!==null&&t!==void 0&&t}constructor(){var t;this._isPageUnloading=!1,this._isShutdown=!1,this.webPerformance=new xk,this._personProcessingSetOncePropertiesSent=!1,this.version=Qe.LIB_VERSION,this._sessionRegisteredPropKeys=new Set,this._sessionRegisteredPropertiesStorageKey="",this._internalEventEmitter=new Aa,this._extensions=[],this._extensionEventPropertyProducers=[],this._replayDebugPropertiesPaused=!1,this._hasStableInitialDistinctId=!1,this._hasWarnedAboutVolatileIdentity=!1,this._isConsentTransition=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=nc(),this.SentryIntegration=Kw,this.sentryIntegration=s=>(function(n,r){let o=C0(n,r);return{name:k0,processEvent:a=>o(a)}})(this,s),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this._visibilityStateListener=null,this._initialPersonProfilesConfig=null,this._cachedPersonProperties=null,this.scrollManager=new ck(this),this.pageViewM
110anager=new z_(this),this.rateLimiter=new tk(this),this.requestRouter=new pk(this),this.consent=new Vw(this),this.externalIntegrations=new fk(this);let i=(t=Pi.__defaultExtensionClasses)!==null&&t!==void 0?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:(s,n,r)=>{let o=oe(s)?{[s]:n}:s;this.setPersonProperties(o),r?.({})},set_once:(s,n,r)=>{let o=oe(s)?{[s]:n}:s;this.setPersonProperties(void 0,o),r?.({})}},this.on("eventCaptured",s=>D.info(`send "${s?.event}"`,s))}init(t,i,s){if(s&&s!==Gn){var n;let r=(n=fr[s])!==null&&n!==void 0?n:new Pi;return r._init(t,i,s),fr[s]=r,fr[Gn][s]=r,r}return this._init(t,i,s)}_init(t,i={},s){var n,r,o;let a=oe(t)?t.trim():"";if(!a)return D.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;var l;if(this.__loaded)return a!==((l=this.config)===null||l===void 0?void 0:l.token)?console.warn("[PostHog.js]",`You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('${a}', { ... }, 'project2')`):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=nc(i.defaults),i.debug=this._checkLocalStorageForDebug(i.debug),this._originalUserConfig=i,this._triggered_notifs=[],i.person_profiles?this._initialPersonProfilesConfig=i.person_profiles:i.process_person&&(this._initialPersonProfilesConfig=i.process_person);let c=nc(i.defaults),d=og(i),h=Oe({},c,d,{name:s,token:a});ee(c.rageclick)&&ee(d.rageclick)&&(h.rageclick=Oe({},c.rageclick,d.rageclick)),ee(c.session_recording)&&ee(d.session_recording)&&(h.session_recording=Oe({},c.session_recording,d.session_recording)),this.set_config(h),this.config.on_xhr_error&&D.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:Ft.GZipJS;let u=this._is_persistence_disabled(),p=!this._inCookielessMode();if(this.persistence=new ec(this.config,u,!0,p),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new ec(b(b({},this.config),{},{persistence:"sessionStorage"}),u,!1,p),this._sessionRegisteredPropertiesStorageKey="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties",this.config.persistence!=="memory"&&!u&&Te._is_supported()){let m=Te._parse(this._sessionRegisteredPropertiesStorageKey);W(m)&&m.forEach(y=>{oe(y)&&this._sessionRegisteredPropKeys.add(y)})}else Te._remove(this._sessionRegisteredPropertiesStorageKey);let _=b({},this.persistence.props),g=b({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this._requestQueue=new ok((m,y)=>this._send_retriable_request(m,y),this.config.request_queue_config),this._retryQueue=new lk(this),this.__request_queue=[];let v=this._inCookielessMode();v||(this.sessionManager=new Z_(this),this.sessionPropsManager=new J_(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((m,y,w)=>{(w?.activityTimeout||w?.sessionPastMaximumLength||w?.crossTabAdoption)&&this._clearSessionRegisteredProps()})),this._enrollFeatureFlags(),this.config.__preview_deferred_init_extensions?(D.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this._initExtensions(v)},0)):(D.info("Initializing extensions synchronously"),this._initExtensions(v)),Qe.DEBUG=Qe.DEBUG||this.config.debug,Qe.DEBUG&&D.info("Starting in debug mode",{this:this,config:i,thisC:b({},this.config),p:_,s:g}),this.config.identity_distinct_id&&!(!((n=i.bootstrap)===null||n===void 0)&&n.distinctID)&&(i.bootstrap=b(b({},i.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));let f=(r=i.bootstrap)===null||r===void 0?void 0:r.distinctID;if(this._hasStableInitialDistinctId=!!f&&!Zn(f),(o=i.bootstrap)===null||o===void 0?void 0:o.distinctID){let m=i.bootstrap.distinctID,y=this.get_distinct_id(),w=this.persistence.get_property(St);if(i.bootstrap.isIdentifiedID&&y!=null&&y!==m&&w==="anonymous")this.identify(m);else if(i.bootstrap.isIdentifiedID&&y!=null&&y!==m&&w==="identified")D.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{let S=this.config.get_device_id(Rt()),x=i.bootstrap.isIdentifiedID?S:m;this.persistence.set_property(St,i.bootstrap.isIdentifiedID?Mo:fi),this.register({distinct_id:m,$device_id:x})}}if(v)this.register_once({distinct_id:il,$device_id:null},"");else if(!this.get_distinct_id()){let m=this.config.get_device_id(Rt());this.register_once({distinct_id:m,$device_id:m},""),this.persistence.set_property(St,fi)}return Z(T,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),Z(T,"pageshow",()=>{var m;this._isPageUnloading=!1,this._isShutdown||(m=this._retryQueue)===null||m===void 0||m.resume()}),i.segment?W_(this,()=>this._loaded()):this._loaded(),_e(this.config._onCapture)&&this.config._onCapture!==vr&&(D.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",m=>this.config._onCapture(m.event,m))),this.config.ip&&D.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 Su.apply(this,arguments)})().then(m=>{m&&this.register({[tl]:m})}).catch(vr),this}_isSharedExtension(t){let i=t;return oe(i.name)&&_e(i.setup)}_enrollExtension(t,i){this._isSharedExtension(t)?i.push(()=>
110{this._getBrowserClientAdapter().add(t).catch(()=>{var s;return(s=t.dispose)===null||s===void 0?void 0:s.call(t)}).catch(s=>{D.error(`Failed to dispose browser extension "${t.name}"`,s)})}):this._extensions.push(t)}_enrollFeatureFlags(){var t,i,s;let n=(t=(i=this.config.__extensionClasses)===null||i===void 0?void 0:i.featureFlags)!==null&&t!==void 0?t:(s=Pi.__defaultExtensionClasses)===null||s===void 0?void 0:s.featureFlags;var r,o,a;n&&(this.featureFlags&&this.featureFlags instanceof n||((r=this._featureFlagsReloadingUnsubscribe)===null||r===void 0||r.call(this),this._featureFlagsReloadingUnsubscribe=void 0,this.featureFlags=new n(this)),_e(this.featureFlags.onReloading)&&_e(this.featureFlags.setup)?this._featureFlagsReloadingUnsubscribe||(this._featureFlagsReloadingUnsubscribe=this.featureFlags.onReloading(()=>{this._internalEventEmitter.emit("featureFlagsReloading",!0)}),this._getBrowserClientAdapter().add(this.featureFlags)):(o=(a=this.featureFlags).initialize)===null||o===void 0||o.call(a))}_initExtensions(t){let i=performance.now(),s=b(b({},Pi.__defaultExtensionClasses),this.config.__extensionClasses),n=[];var r,o,a,l,c,d,h;s.exceptions&&this._extensions.push(this.exceptions=(r=this.exceptions)!==null&&r!==void 0?r:new s.exceptions(this)),s.historyAutocapture&&this._extensions.push(this.historyAutocapture=new s.historyAutocapture(this)),s.tracingHeaders&&this._extensions.push(this.tracingHeaders=new s.tracingHeaders(this)),s.siteApps&&this._extensions.push(this.siteApps=new s.siteApps(this)),s.sessionRecording&&!t&&this._extensions.push(this.sessionRecording=new s.sessionRecording(this)),this.config.disable_scroll_properties||n.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),s.autocapture&&this._enrollExtension(this.autocapture=new s.autocapture(this),n),s.surveys&&this._enrollExtension(this.surveys=(o=this.surveys)!==null&&o!==void 0?o:new s.surveys(this),n),s.logs&&this._enrollExtension(this.logs=(a=this.logs)!==null&&a!==void 0?a:new s.logs(this),n),s.metrics&&this._extensions.push(this.metrics=(l=this.metrics)!==null&&l!==void 0?l:new s.metrics(this)),s.conversations&&this._extensions.push(this.conversations=(c=this.conversations)!==null&&c!==void 0?c:new s.conversations(this)),s.productTours&&this._extensions.push(this.productTours=new s.productTours(this)),s.heatmaps&&this._extensions.push(this.heatmaps=new s.heatmaps(this)),s.webVitalsAutocapture&&this._extensions.push(this.webVitalsAutocapture=new s.webVitalsAutocapture(this)),s.exceptionObserver&&this._extensions.push(this.exceptionObserver=new s.exceptionObserver(this)),s.deadClicksAutocapture&&this._extensions.push(this.deadClicksAutocapture=new s.deadClicksAutocapture(this,Qw)),s.toolbar&&this._extensions.push(this.toolbar=(d=this.toolbar)!==null&&d!==void 0?d:new s.toolbar(this)),s.experiments&&this._extensions.push(this.experiments=(h=this.experiments)!==null&&h!==void 0?h:new s.experiments(this)),this._extensions.forEach(u=>{u.initialize&&n.push(()=>{var p;(p=u.initialize)===null||p===void 0||p.call(u)})}),n.push(()=>
110{if(this._pendingRemoteConfig){let u=this._pendingRemoteConfig;this._pendingRemoteConfig=void 0,this._extensions.forEach(p=>{var _;return(_=p.onRemoteConfig)===null||_===void 0?void 0:_.call(p,u)})}}),this._processInitTaskQueue(n,i)}_processInitTaskQueue(t,i){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-i>=30&&t.length>0)return void setTimeout(()=>{this._processInitTaskQueue(t,i)},0);let n=t.shift();if(n)try{n()}catch(r){D.error("Error initializing extension:",r)}}let s=Math.round(performance.now()-i);this.register_for_session({[Ng]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Bg]:s}),this.config.__preview_deferred_init_extensions&&D.info(`PostHog extensions initialized (${s}ms)`)}_onRemoteConfig(t){var i;if(!F||!F.body)return D.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this._onRemoteConfig(t)},500);if(this.config.__preview_deferred_init_extensions&&(this._pendingRemoteConfig=t),this._lastRemoteConfig=t,this.compression=void 0,t.ok){var s;let n=t.config;n.supportedCompression&&!this.config.disable_compression&&(this.compression=ie(n.supportedCompression,Ft.GZipJS)?Ft.GZipJS:ie(n.supportedCompression,Ft.Base64)?Ft.Base64:void 0),!((s=n.analytics)===null||s===void 0)&&s.endpoint&&(this.analyticsDefaultEndpoint=n.analytics.endpoint)}this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:Hg}),(i=this._browserClientAdapter)===null||i===void 0||i.handleRemoteConfig(t),this._extensions.forEach(n=>{var r;return(r=n.onRemoteConfig)===null||r===void 0?void 0:r.call(n,t)})}_loaded(){try{this.config.loaded(this)}catch(t){D.critical("`loaded` function failed",t)}if(this._start_queue_if_opted_in(),this.config.internal_or_test_user_hostname&&Ne?.hostname){let t=Ne.hostname,i=this.config.internal_or_test_user_hostname;(typeof i=="string"?t===i:i.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this._inCookielessMode())&&this._captureInitialPageview()},1),this._remoteConfigLoader=new x0(this),this._remoteConfigLoader.load()}_start_queue_if_opted_in(){var t;this.is_capturing()&&this.config.request_batching&&((t=this._requestQueue)===null||t===void 0||t.enable())}_dom_loaded(){this.is_capturing()&&Ds(this.__request_queue,t=>this._send_retriable_request(t)),this.__request_queue=[],this._start_queue_if_opted_in()}_handle_unload(){var t,i,s,n,r,o;this._isPageUnloading=!0,(t=this.surveys)===null||t===void 0||(i=t.handlePageUnload)===null||i===void 0||i.call(t),(s=this.metrics)===null||s===void 0||s.flush("sendBeacon"),this.config.request_batching?(this._shouldCapturePageleave()&&this.capture(Wd),(n=this.logs)===null||n===void 0||n.flushLogs("sendBeacon"),(r=this._requestQueue)===null||r===void 0||r.unload(),(o=this._retryQueue)===null||o===void 0||o.unload()):this._shouldCapturePageleave()&&this.capture(Wd,null,{transport:"sendBeacon"})}_send_request(t){D0(this,t)}_send_retriable_request(t,i){this._retryQueue?this._retryQueue.retriableRequest(t,i):this._send_request(i?b(b({},t),{},{transport:i}):t)}_execute_array(t){sc++;try{let i,s=[],n=[],r=[];Ds(t,a=>{if(a)if(i=a[0],W(i))r.push(a);else if(_e(a))try{a.call(this)}catch(l){D.error("Error executing queued PostHog call",a,l)}else W(a)&&i==="alias"?s.push(a):W(a)&&i.indexOf("capture")!==-1&&_e(this[i])?r.push(a):n.push(a)});let o=function(a,l){Ds(a,function(c){try{if(W(c[0])){let d=l;xe(c,function(h){d=d[h[0]].apply(d,h.slice(1))})}else l[c[0]].apply(l,c.slice(1))}catch(d){D.error("Error executing queued PostHog call",c,d)}})};o(s,this),o(n,this),o(r,this)}finally{sc--}}push(t){if(sc>0&&W(t)&&oe(t[0])){let i=Pi.prototype[t[0]];return void(_e(i)&&i.apply(this,t.slice(1)))}this._execute_array([t])}get _facebookClickIdChannel(){return{property:Hd,persistenceKey:zs,cookieName:"_fbc",pattern:ng,register:(t,i)=>{var s;return(s=this.persistence)===null||s===void 0?void 0:s.register({[zs]:{value:t,delivered:i}})},unregister:()=>{var t;return(t=this.persistence)===null||t===void 0?void 0:t.unregister(zs)}}}get _facebookBrowserIdChannel(){return{property:Ud,persistenceKey:Qn,cookieName:"_fbp",pattern:rg,register:(t,i)=>{var s;return(s=this.persistence)===null||s===void 0?void 0:s.register({[Qn]:{value:t,delivered:i}})},unregister:()=>{var t;return(t=this.persistence)===null||t===void 0?void 0:t.unregister(Qn)}}}_getPersistedMetaIdentifier(t){var i;let s=(i=this.persistence)===null||i===void 0?void 0:i.get_property(t.persistenceKey);return oe(s)&&t.pattern.test(s)?{value:s,delivered:!1}:ee(s)&&oe(s.value)&&t.pattern.test(s.value)?{value:s.value,delivered:s.delivered===!0}:void 0}_storeMetaIdentifier(t,i,s){return i===s?.value?{value:i,pending:!s.delivered}:(t.register(i,!1),{value:i,pending:!0})}_readMetaCookie(t){if(!this.config.save_campaign_params||this._inCookielessMode())return;let i=tr(t.cookieName);return oe(i)&&t.pattern.test(i)?i:void 0}_updateFacebookClickId(t,i,s,n){if(!this.persistence)return;let r=this._facebookClickIdChannel;this.persistence.refreshKey(r.persistenceKey);let o=this._getPersistedMetaIdentifier(r);if(n)return void r.unregister();if(s)return oe(i)&&ng.test(i)?this._storeMetaIdentifier(r,i,o):void r.unregister();let a=oe(t)&&wk.test(t)?t:void 0,l=this._readMetaCookie(r);return l&&((c,d,h)=>{let u=c.split(".");if(d)return u[3]===d;if(!h)return!0;let p=h.value.split(".");return u[3]===p[3]||Number(u[2])>Number(p[2])})(l,a,o)?this._storeMetaIdentifier(r,l,o):a?o?.value.split(".")[3]===a?{value:o.value,pending:!o.delivered}:this._storeMetaIdentifier(r,`fb.1.${Date.now()}.${a}`,o):o?{value:o.value,pending:!o.delivered}:void 0}_updateFacebookBrowserId(t,i,s){if(!this.persistence)return;let n=this._facebookBrowserIdChannel;this.persistence.refreshKey(n.persistenceKey);let r=this._getPersistedMetaIdentifier(n);if(s)return void n.unregister();if(i)return oe(t)&&rg.test(t)?this._storeMetaIdentifier(n,t,r):void n.unregister();let o=this._readMetaCookie(n);return o?this._storeMetaIdentifier(n,o,r):r?{value:r.value,pending:!r.delivered}:void 0}_markMetaIdentifierDelivered(t,i){if(!this.persistence)return;this.persistence.refreshKey(t.persistenceKey);let s=this._getPersistedMetaIdentifier(t);s?.value!==i||s.delivered||t.register(i,!0)}capture(t,i,s){var n,r;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue))return void D.uninitializedWarning("posthog.capture");
110if(!this.is_capturing())return;if(M(t)||!oe(t))return void D.error("No event name provided to posthog.capture");if(this._syncCookielessIdentity(),t==="$snapshot"&&this._inCookielessMode())return;let o=!this.config.opt_out_useragent_filter&&this._is_bot();if(o&&!this.config.__preview_capture_bot_pageviews)return;let a=s?.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(a?.isRateLimited)return void D.critical("This capture call is ignored due to client rate limiting.");let l;i?.$current_url&&!oe(i?.$current_url)&&(D.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),i==null||delete i.$current_url),t!=="$exception"||s?._originatedFromCaptureException||D.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&(l=this.sessionPersistence.update_campaign_params()),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();let c=new Date,d=s?.timestamp||c,h=Xd(s?.uuid,Rt),u={uuid:h,event:t,properties:this.calculateEventProperties(t,i||{},d,h)};t==="$pageview"&&this.config.__preview_capture_bot_pageviews&&o&&(u.event="$bot_pageview",u.properties.$browser_type="bot"),a&&(u.properties.$lib_rate_limit_remaining_tokens=a.remainingTokens);let p=t==="$feature_flag_called"&&u.properties.$feature_flag_has_experiment===!1&&this.get_property("$minimal_flag_called_events")===!0;s?.$set&&!p&&(u.$set=s?.$set);let _=ee(i?.$set)?i.$set:void 0,g=W(i?.$unset)?i.$unset:[],v=s?.$unset||[],f=A=>{var B;let q=!!s?.$set&&A in s.$set;return{hasProvided:q||!!_&&A in _,provided:q?s==null||(B=s.$set)===null||B===void 0?void 0:B[A]:_?.[A],unset:g.indexOf(A)!==-1||v.indexOf(A)!==-1}},m=f(Hd),y=f(Ud),w=[{channel:this._facebookClickIdChannel,hasProvided:m.hasProvided,update:this._updateFacebookClickId(l?.fbclid,m.provided,m.hasProvided,m.unset)},{channel:this._facebookBrowserIdChannel,hasProvided:y.hasProvided,update:this._updateFacebookBrowserId(y.provided,y.hasProvided,y.unset)}];for(let{channel:A,hasProvided:B,update:q}of w)q&&u.properties.$process_person_profile===!0&&q.pending&&!B&&!p&&(u.$set=b({[A.property]:q.value},u.$set));let S=s?.$unset;S&&(u.$unset=S);let x=p?void 0:this._calculate_set_once_properties(s?.$set_once,t!==zd,t===Ug);if(x&&(u.$set_once=x),s?._noTruncate||(k=this.config.properties_string_max_length,u=(function(A,B){let q=new Set;return(function K(U,ce){if(U!==Object(U))return B?B(U):U;if(q.has(U))return;let j;if(q.add(U),W(U))j=[],Ds(U,N=>{j.push(K(N))});else{let N={};xe(hn(U)?Qf(U):U,(V,Q)=>{q.has(V)||(N[Q]=K(V,Q))}),j=N}return j})(A)})(u,A=>oe(A)?A.slice(0,k):A)),u.timestamp=d,M(s?.timestamp)||(u.properties.$event_time_override_provided=!0,u.properties.$event_time_override_system_time=c),p&&(u.properties=((A,B=[])=>{let q={},K=U=>{A[U]!==void 0&&(q[U]=A[U])};return Xy.forEach(K),B.forEach(K),q})(u.properties,kk)),t===gt.DISMISSED||t===gt.SENT){let A=i?.[ft.SURVEY_ID],B=i?.[ft.SURVEY_ITERATION];Wa({id:A,current_iteration:B}),u.$set=b(b({},u.$set),{},{[nd({id:A,current_iteration:B},t===gt.SENT?"responded":"dismissed")]:!0})}else t===gt.SHOWN&&(u.$set=b(b({},u.$set),{},{[ft.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var k;if(t===ek.SHOWN){let A=i?.[G_.TOUR_TYPE];A&&(u.$set=b(b({},u.$set),{},{[`${G_.TOUR_LAST_SEEN_DATE}/${A}`]:new Date().toISOString()}))}let C=b(b({},u.properties.$set),u.$set);if(Ct(C)||this.setPersonPropertiesForFlags(C),!Y(this.config.before_send)){let A=this._runBeforeSend(u);if(!A)return;u=A,u.uuid=Xd(u.uuid,Rt)}this.sessionRecording&&!this._replayDebugPropertiesPaused&&sg(t)&&(this._replayDebugPropertiesPaused=!0,setTimeout(()=>this._replayDebugPropertiesPaused=!1,3e4));let E=w.filter(({channel:A,update:B})=>{var q,K,U;let ce=(q=(K=u.$set)===null||K===void 0?void 0:K[A.property])!==null&&q!==void 0?q:ee((U=u.properties)===null||U===void 0?void 0:U.$set)?u.properties.$set[A.property]:void 0;return B?.pending&&ce===B.value});this._internalEventEmitter.emit("eventCaptured",u);let I=(n=s?._url)!==null&&n!==void 0?n:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),P=s?._batchKey==="recordings"||/\/s\/(?:\?|$)/.test(I
110),O=b(b(b({method:"POST",url:I,data:u,compression:"best-available",preferSyncCompression:s?.send_instantly,timestampMode:P?"body":"capture-body",batchKey:s?._batchKey},P&&(!((r=u.properties)===null||r===void 0)&&r.$session_id)?{batchGroup:u.properties.$session_id+(u.properties.$window_id?`-${u.properties.$window_id}`:"")}:{}),s?.transport?{transport:s.transport}:{}),E.length?{fireCallbackOnDrop:!0,callback:A=>{if(A.statusCode>=200&&300>A.statusCode)for(let{channel:B,update:q}of E)this._markMetaIdentifierDelivered(B,q.value)}}:{});if(!this.config.request_batching||s&&!s?._batchKey||s?.send_instantly||E.length){var L;let A;!O.transport&&!O.callback&&Ct((L=this.config.request_headers)!==null&&L!==void 0?L:{})&&this._isPageUnloading&&(A="sendBeacon"),this._send_retriable_request(O,A)}else this._requestQueue.enqueue(O);return u}_addCaptureHook(t){return this.on("eventCaptured",i=>t(i.event,i))}getExtension(t){var i;return(i=this._browserClientAdapter)===null||i===void 0?void 0:i.getExtension(t)}_getBrowserClientAdapter(){var t;return(t=this._browserClientAdapter)!==null&&t!==void 0?t:this._browserClientAdapter=new yk(this)}_registerExtensionEventProperties(t){this._extensionEventPropertyProducers.push(t);let i=!0;return()=>{if(!i)return;i=!1;let s=this._extensionEventPropertyProducers.indexOf(t);s!==-1&&this._extensionEventPropertyProducers.splice(s,1)}}_processCookieIdentityChange(t=!0){var i,s,n;
110return!!(!((i=this.persistence)===null||i===void 0)&&i.consumeCookieIdentityChange())&&(this._cachedPersonProperties=null,this.persistence.get_property("$user_state")==="anonymous"&&((n=this.sessionPersistence)===null||n===void 0||n.clear(),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys()),(s=this.featureFlags)===null||s===void 0||s.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,i,s,n,r){if(s=s||new Date,!this.persistence||!this.sessionPersistence)return i;this._syncCookielessIdentity(),this.persistence.syncCookieProperties(),this._processCookieIdentityChange();let o=r?void 0:this.persistence.remove_event_timer(t),a=b({},i);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,this._inCookielessMode()&&(a[Dg]=!0),t==="$snapshot"){let m=b(b({},this.persistence.properties()),this.sessionPersistence.properties());return a.distinct_id=m.distinct_id,(!oe(a.distinct_id)&&!ne(a.distinct_id)||Zn(a.distinct_id))&&D.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}let l=(function(m,y,w,S=!1){var x,k,C,E;if(!pt)return{};let I=m?[...hs,...y||[]]:[],[P,O]=wf(pt),[L,A]=(function(z){for(let ae=0;Zd.length>ae;ae++){let[be,Ee,pe]=Zd[ae],ve=z.match(be);if(ve){let dt=pe&&z.match(pe)||ve;return[Ee,dt?.[1]||""]}}return["",""]})(pt),B=(function(){let z="u">typeof navigator?navigator:void 0;return z?.brave?{brave:!0}:{}})(),q={};M(w)||(q.detectGoogleSearchApp=w);let K={},U=(x=navigator)===null||x===void 0||(x=x.userAgentData)===null||x===void 0?void 0:x.platform,ce=(k=navigator)===null||k===void 0?void 0:k.maxTouchPoints,j=T==null||(C=T.screen)===null||C===void 0?void 0:C.width,N=T==null||(E=T.screen)===null||E===void 0?void 0:E.height,V=T?.devicePixelRatio;M(U)||(K.userAgentDataPlatform=U),M(ce)||(K.maxTouchPoints=ce),M(j)||(K.screenWidth=j),M(N)||(K.screenHeight=N),M(V)||(K.devicePixelRatio=V);let Q=Oe(Gu({$os:P,$os_version:O,$browser:Sf(pt,navigator.vendor,B,q),$webview_app:L,$webview_app_version:A,$device:kf(pt),$device_type:Cf(pt,K),$timezone:Fv(),$timezone_offset:Qb()}),{$current_url:en(S?ni(Ne?.href):Ne?.href,I,on),$host:Ne?.host,$pathname:Ne?.pathname,$raw_user_agent:pt.length>1e3?pt.substring(0,997)+"...":pt,$browser_version:wy(pt,navigator.vendor,B,q),$browser_language:od(),$browser_language_prefix:Gb(),$screen_height:T?.screen.height,$screen_width:T?.screen.width,$viewport_height:T?.innerHeight,$viewport_width:T?.innerWidth,$lib:mi.LIB_NAME,$lib_version:mi.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return mi.SDK_DIST_CHANNEL&&(Q.$sdk_dist_channel=mi.SDK_DIST_CHANNEL),Q})(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){let{sessionId:m,windowId:y}=this.sessionManager.checkAndGetSessionAndWindowId(r,s.getTime(),!0);a.$session_id=m,a.$window_id=y}this.sessionPropsManager&&Oe(a,this.sessionPropsManager.getSessionProps());try{var c;if(this.sessionRecording){let m=this.sessionRecording.sdkDebugProperties,y=!this._replayDebugPropertiesPaused&&sg(t);for(let w in m)(y||ie(bk,w))&&(a[w]=m[w])}a.$sdk_debug_retry_queue_size=(c=this._retryQueue)===null||c===void 0?void 0:c.length}catch(m){a.$sdk_debug_error_capturing_properties=String(m)}let d;if(this.requestRouter.region===wu&&(a.$lib_custom_api_host=this.config.api_host),d=t!=="$pageview"||r?t!=="$pageleave"||r?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(s):this.pageViewManager.doPageView(s,n),a=Oe(a,d),t==="$pageview"&&F&&(a.title=F.title),!M(o)){let m=s.getTime()-o;a.$duration=parseFloat((m/1e3).toFixed(3))}pt&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser");let h=this.persistence.properties(),u=this.sessionPersistence.properties(),p=a.$groups,_=h.$groups;ee(p)&&!Ct(p)&&(a.$groups=b(b({},ee(_)?_:{}),p)),xe(["$referrer","$referring_domain"],m=>{m in h&&delete u[m]});let g={};if(this._extensionEventPropertyProducers.length>0)for(let m of this._extensionEventPropertyProducers.slice())try{Oe(g,m())}catch(y){D.error("Failed to produce browser extension event properties",y)}a=Oe({},l,h,u,b(b({},g),a)),a.$is_identified=this._isIdentified(),W(this.config.property_denylist)?xe(this.config.property_denylist,function(m){delete a[m]}):D.error(B0+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);let v=this.config.sanitize_properties;v&&(D.error(ig),a=v(a,t));let f=this._hasPersonProcessing();return a.$process_person_profile=f,f&&!r&&this._requirePersonProcessing("_calculate_event_properties"),a}_calculate_set_once_properties(t,i=!0,s=!1){var n;if(!this.persistence||!this._hasPersonProcessing()||this._personProcessingSetOncePropertiesSent&&!s)return t;let r=this.persistence.get_initial_props(),o=(n=this.sessionPropsManager)===null||n===void 0?void 0:n.getSetOnceProps(),a=Oe({},r,o||{},t||{}),l=this.config.sanitize_properties;return l&&(D.error(ig),a=l(a,"$set_once")),i&&(this._personProcessingSetOncePropertiesSent=!0),Ct(a)?void 0:a}register(t,i){var s;(s=this.persistence)===null||s===void 0||s.register(t,i)}register_once(t,i,s){var n;(n=this.persistence)===null||n===void 0||n.register_once(t,i,s)}register_for_session(t){var i,s;(i=this.persistence)===null||i===void 0||i.syncCookieProperties(),this._processCookieIdentityChange(),(s=this.sessionPersistence)===null||s===void 0||s.register(t),Object.keys(t).forEach(n=>this._sessionRegisteredPropKeys.add(n)),this._persistSessionRegisteredPropKeys()}unregister(t){var i;(i=this.persistence)===null||i===void 0||i.unregister(t)}unregister_for_session(t){var i;(i=this.sessionPersistence)===null||i===void 0||i.unregister(t),this._sessionRegisteredPropKeys.delete(t),this._persistSessionRegisteredPropKeys()}_register_single(t,i){this.register({[t]:i})}_clearSessionRegisteredProps(){this._sessionRegisteredPropKeys.forEach(t=>{var i;(i=this.sessionPersistence)===null||i===void 0||i.unregister(t)}),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys()}_persistSessionRegisteredPropKeys(){var t;if(!this._sessionRegisteredPropertiesStorageKey)return;if(this.config.persistence==="memory"||!((t=this.sessionPersistence)===null||t===void 0)&&t._disabled||!Te._is_supported())return void Te._remove(this._sessionRegisteredPropertiesStorageKey);let i=[];this._sessionRegisteredPropKeys.forEach(s=>i.push(s)),i.length>0?Te._set(this._sessionRegisteredPropertiesStorageKey,i):Te._remove(this._sessionRegisteredPropertiesStorageKey)}getFeatureFlag(t,i){var s;return(s=this.featureFlags)===null||s===void 0?void 0:s.getFeatureFlag(t,i)}getFeatureFlagPayload(t){var i;return(i=this.featureFlags)===null||i===void 0?void 0:i.getFeatureFlagPayload(t)}getFeatureFlagResult(t,i){var s;return(s=this.featureFlags)===null||s===void 0?void 0:s.getFeatureFlagResult(t,i)}getAllFeatureFlags(){var t,i;return(t=(i=this.featureFlags)===null||i===void 0?void 0:i.getAllFeatureFlags())!==null&&t!==void 0?t:[]}isFeatureEnabled(t,i){var s,n;return(s=(n=this.featureFlags)===null||n===void 0?void 0:n.isFeatureEnabled(t,i))!==null&&s!==void 0?s:i?.defaultValue}reloadFeatureFlags(){var t;(t=this.featureFlags)===null||t===void 0||t.reloadFeatureFlags()}updateFlags(t,i,s){var n;(n=this.featureFlags)===null||n===void 0||n.updateFlags(t,i,s)}updateEarlyAccessFeatureEnrollment(t,i,s){var n;(n=this.featureFlags)===null||n===void 0||n.updateEarlyAccessFeatureEnrollment(t,i,s)}getEarlyAccessFeatures(t,i=!1,s){var n;return(n=this.featureFlags)===null||n===void 0?void 0:n.getEarlyAccessFeatures(t,i,s)}on(t,i){return this._internalEventEmitter.on(t,i)}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:Ts}),()=>{})}onSessionId(t){var i,s;return(i=(s=this.sessionManager)===null||s===void 0?void 0:s.onSessionId(t))!==null&&i!==void 0?i:()=>{}}getSurveys(t,i=!1){this.surveys?this.surveys.getSurveys(t,i):t([],{isLoaded:!1,error:Ts})}getActiveMatchingSurveys(t,i=!1){this.surveys?this.surveys.getActiveMatchingSurveys(t,i):t([],{isLoaded:!1,error:Ts})}onActiveMatchingSurveysChanged(t){return this.surveys?this.surveys.onActiveMatchingSurveysChanged(t):(t([],{isLoaded:!1,error:Ts}),()=>{})}renderSurvey(t,i){var s;(s=this.surveys)===null||s===void 0||s.renderSurvey(t,i)}displaySurvey(t,i=YS){var s;(s=this.surveys)===null||s===void 0||s.displaySurvey(t,i)}cancelPendingSurvey(t){var i;(i=this.surveys)===null||i===void 0||i.cancelPendingSurvey(t)}canRenderSurvey(t){var i,s;return(i=(s=this.surveys)===null||s===void 0?void 0:s.canRenderSurvey(t))!==null&&i!==void 0?i:{visible:!1,disabledReason:Ts}}canRenderSurveyAsync(t,i=!1){var s,n;return(s=(n=this.surveys)===null||n===void 0?void 0:n.canRenderSurveyAsync(t,i))!==null&&s!==void 0?s:Promise.resolve({visible:!1,disabledReason:Ts})}_validateIdentifyId(t){return!t||Zn(t)?(D.critical("Unique user id has not been set in posthog.identify"),!1):t==="$posthog_cookieless"?(D.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())||(D.critical(`The string "${t}" was set in posthog.identify which indicates an error. This ID should be unique to the user and n
110ot a hardcoded string.`),!1)}identify(t,i,s){if(!this.__loaded||!this.persistence)return D.uninitializedWarning("posthog.identify");if(ne(t)&&(t=t.toString(),D.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this._validateIdentifyId(t)||!this._requirePersonProcessing("posthog.identify"))return;this._syncCookielessIdentity();let n=this.get_distinct_id(),r=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==n,o=this._processCookieIdentityChange(!1),a=this.persistence._beginCookieSyncSuppression(),l=!1;try{let d=this.get_distinct_id();this.register({$user_id:t}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:d},""),t!==d&&t!==this.get_property("__alias")&&(this.unregister(Qo),this.register({distinct_id:t}));let h=(this.persistence.get_property("$user_state")||"anonymous")===fi,u=t!==d,p=!u&&h;if(u&&h){var c;let _=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:d};this.persistence.set_property(St,Mo),this.setPersonPropertiesForFlags({$set:i||{},$set_once:s||{}},!1),this.config.cookieWinsOnConflict&&this.persistence._publishSuppressedCookieSnapshot(),this.capture("$identify",_,{$set:i||{},$set_once:s||{}})&&(this._cachedPersonProperties=Sl(t,i,s)),(c=this.featureFlags)===null||c===void 0||c.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:d)}else if(p){this.persistence.set_property(St,Mo);let _=i||{},g=s||{};this.setPersonPropertiesForFlags({$set:_,$set_once:g},!1),this.config.cookieWinsOnConflict&&this.persistence._publishSuppressedCookieSnapshot(),this.capture("$set",{$set:_,$set_once:g})&&(this._cachedPersonProperties=Sl(t,i,s))}else(i||s)&&this.setPersonProperties(i,s);u||r||o?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(Li)):p&&(i||s)&&this.reloadFeatureFlags(),l=!0}finally{a&&this.persistence._endCookieSyncSuppression(l)}}setPersonProperties(t,i){if(!t&&!i||!this._requirePersonProcessing("posthog.setPersonProperties"))return;let s=Sl(this.get_distinct_id(),t,i);this._cachedPersonProperties!==s?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!0),this.capture("$set",{$set:t||{},$set_once:i||{}})&&(this._cachedPersonProperties=s)):D.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(t){var i;let s=(W(t)?t:[t]).filter(n=>oe(n)&&n.length>0);s.length!==0&&this._requirePersonProcessing("posthog.unsetPersonProperties")&&((i=this.featureFlags)===null||i===void 0||i.unsetPersonPropertiesForFlags(s,!0),this.capture("$set",{$unset:s}),this._cachedPersonProperties=null)}group(t,i,s){var n;if(!t||!i)return void D.error("posthog.group requires a group type and group key");(n=this.persistence)===null||n===void 0||n.syncCookieProperties(),this._processCookieIdentityChange();let r=this.getGroups(),o=r[t]!==i;if(o&&this.resetGroupPropertiesForFlags(t),this.register({$groups:b(b({},r),{},{[t]:i})}),(o||s)&&this._hasPersonProcessing()){let a={$group_type:t,$group_key:i};s&&(a.$group_set=s),this.capture(zd,a)}s&&this.setGroupPropertiesForFlags({[t]:s}),o&&!s&&this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,i=!0){var s;(s=this.featureFlags)===null||s===void 0||s.setPersonPropertiesForFlags(t,i)}resetPersonPropertiesForFlags(t=!0){var i;(i=this.featureFlags)===null||i===void 0||i.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,i=!0){var s;this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&((s=this.featureFlags)===null||s===void 0||s.setGroupPropertiesForFlags(t,i))}resetGroupPropertiesForFlags(t){var i;(i=this.featureFlags)===null||i===void 0||i.resetGroupPropertiesForFlags(t)}
110reset(t){let i=Ae(t)?t:t?.resetDeviceID,s=Ae(t)||t==null?void 0:t.bootstrap;this._reset(i,!1,s)}_reset(t,i=!1,s){var n,r,o,a,l,c;if(D.info("reset"),!this.__loaded)return D.uninitializedWarning("posthog.reset");let d=s?.sessionID;this.config.bootstrap=s||((n=this._originalUserConfig)===null||n===void 0?void 0:n.bootstrap)||{},(r=this.featureFlags)===null||r===void 0||(o=r.updateConfig)===null||o===void 0||o.call(r,this.config,this._shouldDisableFlags());let h=this.get_property(Eu),u=this.get_property(tl),p=this.get_property(js);(a=this.sessionRecording)===null||a===void 0||a.flushBeforeIdentityReset();let _=this.is_capturing();i||this.consent.reset(),i||!_||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.");let g=(l=this.persistence)===null||l===void 0||(c=l._beginCookieSyncSuppression)===null||c===void 0?void 0:c.call(l),v=this._isConsentTransition;this._isConsentTransition=v||i;let f=!1;try{var m,y,w,S,x,k,C,E,I,P,O,L,A;if((m=this.persistence)===null||m===void 0||m.clear(),(y=this.sessionPersistence)===null||y===void 0||y.clear(),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys(),M(p)||(P=this.persistence)===null||P===void 0||P.register({$session_recording_remote_config:p}),(w=this.surveys)===null||w===void 0||w.reset(),(S=this.featureFlags)===null||S===void 0||S.reset(),(x=this.conversations)===null||x===void 0||x.reset(),(k=this.logs)===null||k===void 0||k.reset(),(C=this.metrics)===null||C===void 0||C.reset(),(E=this.persistence)===null||E===void 0||E.set_property("$user_state","anonymous"),(I=this.sessionManager)===null||I===void 0||I.resetSessionId(),this._cachedPersonProperties=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:il,$device_id:null},"");else{let K=this.config.get_device_id(Rt());this.register_once({distinct_id:K,$device_id:t?K:h},""),t||M(u)||this.register({[tl]:u})}if(this.register({$last_posthog_reset:new Date().toISOString()},1),s&&(s.distinctID&&!this._inCookielessMode()&&((A=this.persistence)===null||A===void 0||A.set_property("$user_state",s.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:s.distinctID})),(O=this.featureFlags)===null||O===void 0||O.initialize(),!Y(d)&&!(!((L=this.sessionManager)===null||L===void 0)&&L.setBootstrapSessionId(d,!0)))){let K=b({},s);delete K.sessionID,this.config.bootstrap=K}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,f=!0}finally{var B,q;this._isConsentTransition=v,g&&((B=this.persistence)===null||B===void 0||(q=B._endCookieSyncSuppression)===null||q===void 0||q.call(B,f))}this.reloadFeatureFlags()}shutdown(t){var i=this;return Ce(function*(){var s,n,r,o,a,l,c,d;if(i.__loaded){i._isShutdown=!0,i._getBrowserClientAdapter().dispose(),(s=i.sessionRecording)===null||s===void 0||s.dispose(),(n=i.logs)===null||n===void 0||n.flushLogs("sendBeacon"),(r=i.metrics)===null||r===void 0||r.flush("sendBeacon"),(o=i.metrics)===null||o===void 0||o.dispose(),(a=i._requestQueue)===null||a===void 0||a.unload(),(l=i._retryQueue)===null||l===void 0||l.unload();try{var h;(h=i.featureFlags)===null||h===void 0||h.destroy()}catch(u){D.error("Error while destroying feature flags",u)}(c=i.persistence)===null||c===void 0||c.destroy(),(d=i.sessionPersistence)===null||d===void 0||d.destroy()}else D.uninitializedWarning("posthog.shutdown")})()}setIdentity(t,i){var s;delete this.config.identity_claims,this.config.identity_distinct_id=t,this.config.identity_hash=i,this.alias(t),(s=this.conversations)===null||s===void 0||s._onIdentityChanged()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,(t=this.conversations)===null||t===void 0||t._onIdentityCleared()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,i;return(t=(i=this.sessionManager)===null||i===void 0?void 0:i.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&t!==void 0?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";let{sessionId:i,sessionStartTimestamp:s}=this.sessionManager.checkAndGetSessionAndWindowId(!0),n=this.requestRouter.endpointFor("ui",`/project/${this.config.token}/replay/${i}`);if(t?.withTimestamp&&s){var r;let o=(r=t.timestampLookBack)!==null&&r!==void 0?r:10;if(!s)return n;n+=`?t=${Math.max(Math.floor((new Date().getTime()-s)/1e3)-o,0)}`}return n}alias(t,i){return t===this.get_property("$people_distinct_id")?(D.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(M(i)&&(i=this.get_distinct_id()),t!==i?(this._register_single(Qo,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(D.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){let i=b({},this.config);if(ee(t)){var s,n,r,o,a,l,c,d,h,u,p,_,g;Oe(this.config,og(t));let w=this._is_persistence_disabled();if(this.persistence){let x=this.config.persistence==="sessionStorage"||this.config.persistence==="memory";var v,f;if(x&&this.sessionPersistence!==this.persistence&&((v=this.sessionPersistence)===null||v===void 0||v.remove(),(f=this.sessionPersistence)===null||f===void 0||f.destroy()),this.persistence.update_config(this.config,i,w),x)this.sessionPersistence=this.persistence;else if(this.sessionPersistence===this.persistence)this.sessionPersistence=new ec(b(b({},this.config),{},{persistence:"sessionStorage"}),w,!1);else{var m;(m=this.sessionPersistence)===null||m===void 0||m.update_config(b(b({},this.config),{},{persistence:"sessionStorage"}),b(b({},i),{},{persistence:"sessionStorage"}),w)}}let S=this._checkLocalStorageForDebug(this.config.debug);var y;Ae(S)&&(this.config.debug=S),Ae(this.config.debug)&&(this.config.debug?(Qe.DEBUG=!0,ye._is_supported()&&ye._set("ph_debug",!0),D.info("set_config",{config:t,oldConfig:i,newConfig:b({},this.config)})):(Qe.DEBUG=!1,ye._is_supported()&&ye._remove("ph_debug"))),(s=this.featureFlags)===null||s===void 0||(n=s.updateConfig)===null||n===void 0||n.call(s,this.config,this._shouldDisableFlags()),(r=this.exceptionObserver)===null||r===void 0||r.onConfigChange(),(o=this.exceptions)===null||o===void 0||o.onConfigChange(),(a=this.metrics)===null||a===void 0||a.onConfigChange(),(l=this.sessionRecording)===null||l===void 0||l.startIfEnabledOrStop(),(c=this.tracingHeaders)===null||c===void 0||c.startIfEnabledOrStop(),(d=this.autocapture)===null||d===void 0||d.startIfEnabled(),(h=this.heatmaps)===null||h===void 0||h.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&((y=this.historyAutocapture)===null||y===void 0||y.startIfEnabledOrStop()),(u=this.exceptionObserver)===null||u===void 0||u.startIfEnabledOrStop(),(p=this.deadClicksAutocapture)===null||p===void 0||p.startIfEnabledOrStop(),(_=this.surveys)===null||_===void 0||_.loadIfEnabled(),this._sync_opt_out_with_persistence(),(g=this.externalIntegrations)===null||g===void 0||g.startIfEnabledOrStop(),!i.segment&&this.config.segment&&this.persistence&&W_(this,vr,!1)}}_overrideSDKInfo(t,i){Qe.LIB_NAME=t,Qe.LIB_VERSION=i}startSessionRecording(t){let i=t===!0,s={sampling:i||!!t?.sampling,linked_flag:i||!!t?.linked_flag,url_trigger:i||!!t?.url_trigger,event_trigger:i||!!t?.event_trigger};var n,r,o,a,l;
110Object.values(s).some(Boolean)&&((n=this.sessionManager)===null||n===void 0||n.checkAndGetSessionAndWindowId(),s.sampling&&((r=this.sessionRecording)===null||r===void 0||r.overrideSampling()),s.linked_flag&&((o=this.sessionRecording)===null||o===void 0||o.overrideLinkedFlag()),s.url_trigger&&((a=this.sessionRecording)===null||a===void 0||a.overrideTrigger("url")),s.event_trigger&&((l=this.sessionRecording)===null||l===void 0||l.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!!(!((t=this.sessionRecording)===null||t===void 0)&&t.started)}captureException(t,i){try{if(!this.exceptions)return;let s=this.exceptions.buildProperties(t,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(b(b({},s),i))}catch{return}}addExceptionStep(t,i){var s;(s=this.exceptions)===null||s===void 0||s.addExceptionStep(t,i)}captureLog(t){var i;(i=this.logs)===null||i===void 0||i.captureLog(t)}get logger(){var t,i;return(t=(i=this.logs)===null||i===void 0?void 0:i.logger)!==null&&t!==void 0?t:Pi._noopLogger}startExceptionAutocapture(t){this.set_config({capture_exceptions:t==null||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var i,s;return(i=(s=this.toolbar)===null||s===void 0?void 0:s.loadToolbar(t))!==null&&i!==void 0&&i}get_property(t){var i;return(i=this.persistence)===null||i===void 0?void 0:i.props[t]}getSessionProperty(t){var i;return(i=this.sessionPersistence)===null||i===void 0?void 0:i.props[t]}toString(){var t;let i=(t=this.config.name)!==null&&t!==void 0?t:Gn;return i!==Gn&&(i="posthog."+i),i}_isIdentified(){var t,i;return((t=this.persistence)===null||t===void 0?void 0:t.get_property("$user_state"))==="identified"||((i=this.sessionPersistence)===null||i===void 0?void 0:i.get_property("$user_state"))==="identified"}_hasPersonProcessing(){var t,i;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&Ct(this.getGroups())&&!(!((t=this.persistence)===null||t===void 0||(t=t.props)===null||t===void 0)&&t.__alias)&&!(!((i=this.persistence)===null||i===void 0||(i=i.props)===null||i===void 0)&&i.$epp))}_shouldCapturePageleave(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&!!this.config.capture_pageview}createPersonProfile(){this._hasPersonProcessing()||this._requirePersonProcessing("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this._requirePersonProcessing("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}_requirePersonProcessing(t){return this.config.person_profiles==="never"?(D.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._warnIfVolatileIdentityWithoutStableId(),this._register_single(Fu,!0),!0)}_is_persistence_disabled(){if(this.config.cookieless_mode==="always")return!0;let t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!=="on_reject")}_sync_opt_out_with_persistence(){var t,i;let s=this._is_persistence_disabled();var n,r,o;return this.is_capturing()||(n=this.logs)===null||n===void 0||n._onOptOut(),((t=this.persistence)===null||t===void 0?void 0:t._disabled)!==s&&((r=this.persistence)===null||r===void 0||r.set_disabled(s)),((i=this.sessionPersistence)===null||i===void 0?void 0:i._disabled)!==s&&((o=this.sessionPersistence)===null||o===void 0||o.set_disabled(s)),this._persistSessionRegisteredPropKeys(),s}opt_in_capturing(t){var i;if(this.config.cookieless_mode!=="always"){if(this._inCookielessMode()){var s,n,r,o,a,l;(s=this.sessionRecording)===null||s===void 0||s.dispose({discardBufferedEvents:!0}),this._reset(!0,!0),(n=this.sessionManager)===null||n===void 0||n.destroy(),(r=this.pageViewManager)===null||r===void 0||r.destroy(),this.sessionManager=new Z_(this),this.pageViewM
110anager=new z_(this),this.persistence&&(this.sessionPropsManager=new J_(this,this.sessionManager,this.persistence));let p=(o=(a=this.config.__extensionClasses)===null||a===void 0?void 0:a.sessionRecording)!==null&&o!==void 0?o:(l=Pi.__defaultExtensionClasses)===null||l===void 0?void 0:l.sessionRecording;var c,d;p&&(this.sessionRecording=this._replaceExtension(this.sessionRecording,new p(this)),this._lastRemoteConfig&&((c=this.sessionRecording)===null||c===void 0||(d=c.onRemoteConfig)===null||d===void 0||d.call(c,this._lastRemoteConfig)))}var h,u;this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),this._start_queue_if_opted_in(),(i=this.sessionRecording)===null||i===void 0||i.startIfEnabledOrStop(),this.config.cookieless_mode=="on_reject"&&((h=this.surveys)===null||h===void 0||h.loadIfEnabled()),(M(t?.captureEventName)||t?.captureEventName)&&this.capture((u=t?.captureEventName)!==null&&u!==void 0?u:"$opt_in",t?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._captureInitialPageview()}else D.warn(tg)}opt_out_capturing(){this.config.cookieless_mode!=="always"?(this.consent.optInOut(!1),this._sync_opt_out_with_persistence(),this.config.cookieless_mode==="on_reject"&&this._enterCookielessMode()):D.warn(tg)}_enterCookielessMode(){var t,i;let s=this.sessionRecording;s?.dispose({discardBufferedEvents:!0}),this.get_distinct_id()!=="$posthog_cookieless"&&this._reset(!0,!0),this.register({distinct_id:il,$device_id:null}),this._removeExtension(s),this.sessionRecording=void 0,(t=this.sessionManager)===null||t===void 0||t.destroy(),(i=this.pageViewManager)===null||i===void 0||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this._captureInitialPageview(),this._start_queue_if_opted_in()}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){let t=this.consent.consent;return t===1?"granted":t===0?"denied":"pending"}is_capturing(){return!this._isConsentTransition&&(this.config.cookieless_mode==="always"||(this.config.cookieless_mode==="on_reject"?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing()))}clear_opt_in_out_capturing(){this.consent.reset(),this._sync_opt_out_with_persistence()}_is_bot(){return Je?N0(Je,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){F&&(F.visibilityState==="visible"?this._initialPageviewCaptured||(this._initialPageviewCaptured=!0,this.capture(Hu,{title:F.title},{send_instantly:!0}),this._visibilityStateListener&&(F.removeEventListener(wr,this._visibilityStateListener),this._visibilityStateListener=null)):this._visibilityStateListener||(this._visibilityStateListener=this._captureInitialPageview.bind(this),Z(F,wr,this._visibilityStateListener)))}debug(t){t===!1?(T?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(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}))}_shouldDisableFlags(){let t=this._originalUserConfig||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(D.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(i,s,n,r,o){let a=s in i&&!Y(i[s]),l=n in i&&!Y(i[n]);return a?i[s]:!!l&&(o&&o.warn(`Config field '${n}' is deprecated. Please use '${s}' instead. The old field will be removed in a future major version.`),i[n])})(t,"advanced_disable_flags","advanced_disable_decide",0,D)}_runBeforeSend(t){var i;if(Y(this.config.before_send))return t;let s=Object.keys((i=t.properties)!==null&&i!==void 0?i:{}).filter(hy),n=W(this.config.before_send)?this.config.before_send:[this.config.before_send],r=t;for(let o of n)try{if(r=o(r),Y(r)){let a=`Event '${t.event}' was rejected in beforeSend function`;return dy(t.event)?D.warn(`${a}. This can cause unexpected behavior.`):D.info(a),null}r.properties&&!Ct(r.properties)||D.warn(`Event '${t.event}' has no properties after beforeSend function, this is likely an error.`)}catch(a){return D.error(`Error in beforeSend function for event '${t.event}':`,a),null}for(let o of s)if(r.properties&&Y(r.properties[o]))return D.warn(`Event '${t.event}' had its '${o}' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return r}getPageViewId(){var t;
110return(t=this.pageViewManager._currentPageview)===null||t===void 0?void 0:t.pageViewId}captureTraceFeedback(t,i){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:i})}captureTraceMetric(t,i,s){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:i,$ai_metric_value:String(s)})}_checkLocalStorageForDebug(t){let i=Ae(t)&&!t,s=ye._is_supported()&&ye._get("ph_debug")==="true";return!i&&(!!s||t)}};mr.__defaultExtensionClasses={},mr._noopLogger=(()=>{let e=()=>{};return{trace:e,debug:e,info:e,warn:e,error:e,fatal:e}})(),(function(e,t){for(let i=0;t.length>i;i++)e.prototype[t[i]]=cb(e.prototype[t[i]])})(mr,["identify"]);var Tk=class{constructor(e){this._instance=e}refresh(e){let t=this._instance.config,i=ee(t.autocapture)?t.autocapture:void 0;e.enabled=!!t.autocapture,e.rageclick=t.rageclick,e.maskAllElementAttributes=t.mask_all_element_attributes,e.maskAllText=t.mask_all_text,e.disableCaptureUrlHashes=t.disable_capture_url_hashes,e.getCurrentUrl=t.get_current_url,e.remoteRequestsDisabled=this._instance._shouldDisableFlags(),e.url_allowlist=i?.url_allowlist,e.url_ignorelist=i?.url_ignorelist,e.dom_event_allowlist=i?.dom_event_allowlist,e.element_allowlist=i?.element_allowlist,e.css_selector_allowlist=i?.css_selector_allowlist,e.css_selector_ignorelist=i?.css_selector_ignorelist,e.element_attribute_ignorelist=i?.element_attribute_ignorelist,e.capture_copied_text=i?.capture_copied_text}},Nn=Ie("[ExceptionAutocapture]"),Ik=Ie("[TracingHeaders]"),Qi=Ie("[Web Vitals]"),ag=9e5,lg=["CLS","FCP","INP","LCP"],Mk=["INP","LCP"],Pk=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],di=Ie("[SessionRecording]"),Rk=[Au,Lu,Ou,$u,Du,Jn,Oa,Nu,Bu],Fk=Ie("[Heatmaps]");function rc(e){return ee(e)&&"clientX"in e&&"clientY"in e&&ne(e.clientX)&&ne(e.clientY)}var Io=Ie("[Product Tours]"),oc=e=>{var t;return!e.config.disable_product_tours&&!!(!((t=e.persistence)===null||t===void 0)&&t.get_property(Tu))},Ak=["$set_once","$set"],Zt=Ie("[SiteApps]"),cg="Error while initializing PostHog app with config id ",q0=(e,t)=>e?.then?e.then(t):t(e),Is="SDK is not enabled or survey functionality is not yet loaded",ug="Disabled. Not loading surveys.",Lk=class{constructor(e,t){this._configSource=e,this._initialClientState=t,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this._isInitializingSurveys=!1,this._surveyInitializationFailed=!1,this._surveyCallbacks=[],this._activeMatchingSurveyCallbacks=[],this._getSurveysInFlightPromise=null,this._lastSurveyRefreshFailedAt=null,this._disposed=!1,this._renderTimeouts=new Set,this.onRemoteConfig=i=>{if(this._disposed||this._config.disableSurveys)return;if(!i.ok)return this._surveyInitializationFailed=!0,this._notifyActiveMatchingSurveyCallbacks({isLoaded:!1,error:"Remote config unavailable. Not loading surveys."}),J.warn("Remote config unavailable. Not loading surveys.");let s=i.config.surveys;if(Y(s))return J.warn("Flags not loaded yet. Not loading surveys.");this._isSurveysEnabled=Ae(s)?s:s.length>0,J.info(`flags response received, isSurveysEnabled: ${this._isSurveysEnabled}`),this.loadIfEnabled()},this._notifyActiveMatchingSurveyCallbacks=i=>{this._activeMatchingSurveyCallbacks.slice().forEach(s=>this._notifyActiveMatchingSurveyCallback(s,i))}}setup(e){if(!this._disposed)return this._initializingClient=e,q0(e.kv.initialize(),()=>{if(this._initializingClient!==e||this._disposed)return;this._initializingClient=void 0,this._client=e;let t=e.onRemoteConfig(this.onRemoteConfig);this._disposed?t.dispose():(this._remoteConfigSubscription=t,this.loadIfEnabled())})}dispose(){var e,t,i,s,n;this._disposed||(this._disposed=!0,this._initializingClient=void 0,this._client=void 0,(e=this._remoteConfigSubscription)===null||e===void 0||e.dispose(),this._remoteConfigSubscription=void 0,(t=this._surveyEventReceiver)===null||t===void 0||t.dispose(),this._surveyEventReceiver=null,(i=this._surveyManager)===null||i===void 0||(s=i.dispose)===null||s===void 0||s.call(i),this._surveyManager=null,this._surveyCallbacks=[],this._activeMatchingSurveyCallbacks.forEach(r=>{r.active=!1}),this._activeMatchingSurveyCallbacks=[],(n=this._activeMatchingSurveyConditionsUnsubscribe)===null||n===void 0||n.call(this),this._activeMatchingSurveyConditionsUnsubscribe=void 0,this._getSurveysInFlightPromise=null,this._renderTimeouts.forEac
110h(r=>clearTimeout(r)),this._renderTimeouts.clear())}get _config(){return this._configSource.get()}initialize(){this.loadIfEnabled()}reset(){var e,t;(e=this._surveyManager)===null||e===void 0||(t=e.clearInMemoryInProgressSurveyState)===null||t===void 0||t.call(e);try{var i;(i=this._surveyEventReceiver)===null||i===void 0||i.reset(),localStorage.removeItem("lastSeenSurveyDate");let s=[];for(let n=0;n<localStorage.length;n++){let r=localStorage.key(n);(r?.startsWith("seenSurvey_")||r?.startsWith("inProgressSurvey_"))&&s.push(r)}s.forEach(n=>localStorage.removeItem(n))}catch{}this._notifyActiveMatchingSurveyCallbacks()}loadIfEnabled(){if(this._disposed||!this._client)return;let e=this._config;if(this._surveyManager)return;if(this._isInitializingSurveys)return void J.info("Already initializing surveys, skipping...");if(e.disableSurveys)return void J.info(ug);if(e.cookielessMode&&this._configSource.isOptedOut())return void J.info("Not loading surveys in cookieless mode without consent.");let t=this._configSource.getExtensions();if(!t)return void this._handleSurveyLoadError("PostHog Extensions not found.");if(M(this._isSurveysEnabled)&&!e.advancedEnableSurveys)return;let i=this._isSurveysEnabled||e.advancedEnableSurveys;this._isInitializingSurveys=!0,this._surveyInitializationFailed=!1;try{let s=t.generateSurveys;if(s)return this._completeSurveyInitialization(s,i),void(this._isInitializingSurveys=!1);let n=t.loadExternalDependency;if(!n)return this._handleSurveyLoadError(qu),void(this._isInitializingSurveys=!1);n(r=>{try{if(this._disposed)return;let o=this._configSource.getExtensions();r||!o?.generateSurveys?this._handleSurveyLoadError("Could not load surveys script",r):this._completeSurveyInitialization(o.generateSurveys,i)}finally{this._isInitializingSurveys=!1}})}catch(s){throw this._isInitializingSurveys=!1,this._handleSurveyLoadError("Error initializing surveys",s),s}}_completeSurveyInitialization(e,t){var i,s;if(this._disposed)return;this._surveyManager=e(t),this._surveyEventReceiver=this._configSource.createEventReceiver(this._notifyActiveMatchingSurveyCallbacks);let n=(i=(s=this._client)!==null&&s!==void 0?s:this._initialClientState)===null||i===void 0?void 0:i.kv.get(ss);n&&this._registerEventOrActionBasedSurveys(n),J.info("Surveys loaded successfully"),this._startActiveMatchingSurveyConditions(),this._notifyActiveMatchingSurveyCallbacks(),this._notifySurveyCallbacks({isLoaded:!0})}_handleSurveyLoadError(e,t){this._surveyInitializationFailed=!0,J.error(e,t),this._notifyActiveMatchingSurveyCallbacks({isLoaded:!1,error:e}),this._notifySurveyCallbacks({isLoaded:!1,error:e})}onSurveysLoaded(e){return this._surveyCallbacks.push(e),this._surveyManager&&this._notifySurveyCallbacks({isLoaded:!0}),()=>{this._surveyCallbacks=this._surveyCallbacks.filter(t=>t!==e)}}getSurveys(e,t=!1){var i;let s=(i=this._client)!==null&&i!==void 0?i:this._initialClientState;if(!s||this._disposed)return;if(this._config.disableSurveys)return J.info(ug),e([]);let n=s.kv.get(ss);if(n&&!t)return e(n,{isLoaded:!0}),void(this._shouldBackgroundRefreshSurveys()&&this.getSurveys(()=>{},!0));if(this._getSurveysInFlightPromise)return void this._getSurveysInFlightPromise.then(({surveys:a,context:l})=>{this._disposed||e(a,l)}).catch(a=>J.error("Error in survey callback",a));let r=this._sendSurveysRequest("/api/surveys/",{method:"GET",query:{token:s.projectToken},sentAt:"query",timeoutMs:this._config.requestTimeoutMs}).then(a=>{try{return this._handleSurveyResponse(s,a)}catch(l){return J.error("Error processing surveys response",l),this._handleSurveyResponse(s,{statusCode:0,error:l})}},a=>this._handleSurveyResponse(s,{statusCode:0,error:a}));this._getSurveysInFlightPromise=r;let o=()=>{this._getSurveysInFlightPromise===r&&(this._getSurveysInFlightPromise=null)};r.then(a=>{o(),this._disposed||(this._notifyActiveMatchingSurveyCallbacks(a.context),e(a.surveys,a.context))},o).catch(a=>J.error("Error in survey callback",a))}_sendSurveysRequest(e,t){let i=this._client;return i?i.sendRequest(e,t):new Promise(s=>s({statusCode:0,error:new Error(Is)}))}_handleSurveyResponse(e,t){if(this._disposed)return{surveys:[],context:{isLoaded:!1,error:Is}};let i=t.statusCode;if(i!==200||!t.json){let n=`Surveys API could not be loaded, status: ${i}`;return i!==0?J.error(n):t.error||J.warn(n),this._lastSurveyRefreshFailedAt=Date.now(),{surveys:[],context:{isLoaded:!1,error:n}}}this._lastSurveyRefreshFailedAt=null;let s=t.json.surveys||[];return e.kv.set({[ss]:s,[Ko]:Date.now()}),this._registerEventOrActionBasedSurveys(s),{surveys:s,context:{isLoaded:!0}}}_registerEventOrActionBasedSurveys(e){var t;let i=e.filter(s=>Om(s)&&(rd(s)||$m(s)));(t=this._surveyEventReceiver)===null||t===void 0||t.replace(i)}
110_shouldBackgroundRefreshSurveys(){return this._isSurveyCacheStale()&&!this._getSurveysInFlightPromise&&!this._isSurveyRefreshBackingOff()}_isSurveyCacheStale(){var e,t;let i=(e=(t=this._client)!==null&&t!==void 0?t:this._initialClientState)===null||e===void 0?void 0:e.kv.get(Ko);return ne(i)&&Date.now()-i>3e5}_isSurveyRefreshBackingOff(){return ne(this._lastSurveyRefreshFailedAt)&&3e5>Date.now()-this._lastSurveyRefreshFailedAt}markSurveyAsSeen(e,t){var i;let s={id:e,current_iteration:(i=t?.iteration)!==null&&i!==void 0?i:null};Wa(s);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}this._notifyActiveMatchingSurveyCallbacks()}_notifySurveyCallbacks(e){for(let t of this._surveyCallbacks)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(i){J.error("Error in survey callback",i)}}getActiveMatchingSurveys(e,t=!1){if(!Y(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);J.warn("init was not called")}onActiveMatchingSurveysChanged(e){var t,i;if(this._disposed)return()=>{};let s={callback:e,active:!0,revision:0};this._activeMatchingSurveyCallbacks.push(s),this._startActiveMatchingSurveyConditions();let n=(t=(i=this._client)!==null&&i!==void 0?i:this._initialClientState)===null||t===void 0?void 0:t.kv.get(ss);return this._config.disableSurveys||!this._surveyManager&&this._surveyInitializationFailed&&!this._isInitializingSurveys||!n&&!Y(this._lastSurveyRefreshFailedAt)&&!this._getSurveysInFlightPromise?this._notifyActiveMatchingSurveyCallback(s,{isLoaded:!1}):this._surveyManager&&this._notifyActiveMatchingSurveyCallback(s),()=>{var r;s.active=!1,this._activeMatchingSurveyCallbacks=this._activeMatchingSurveyCallbacks.filter(o=>o!==s),this._activeMatchingSurveyCallbacks.length===0&&((r=this._activeMatchingSurveyConditionsUnsubscribe)===null||r===void 0||r.call(this),this._activeMatchingSurveyConditionsUnsubscribe=void 0)}}_startActiveMatchingSurveyConditions(){var e,t,i;this._surveyManager&&this._activeMatchingSurveyCallbacks.length>0&&((e=this._activeMatchingSurveyConditionsUnsubscribe)!==null&&e!==void 0||(this._activeMatchingSurveyConditionsUnsubscribe=(t=(i=this._configSource).onMatchingConditionsChanged)===null||t===void 0?void 0:t.call(i,this._notifyActiveMatchingSurveyCallbacks)))}_notifyActiveMatchingSurveyCallback(e,t){if(this._disposed||!e.active)return;let i=++e.revision,s=n=>{if(!this._disposed&&e.active&&i===e.revision)try{let r=t??{isLoaded:!0},o=JSON.stringify([n,r]);if(o===e.lastResult)return;e.lastResult=o,e.callback(n,r)}catch(r){J.error("Error in active matching surveys callback",r)}};try{t&&!t.isLoaded?s([]):this.getActiveMatchingSurveys(s)}catch(n){J.error("Error in active matching surveys callback",n)}}_getSurveyById(e){let t=null;return this.getSurveys(i=>{var s;t=(s=i.find(n=>n.id===e))!==null&&s!==void 0?s:null}),t}_checkSurveyEligibility(e){if(Y(this._surveyManager))return{eligible:!1,reason:Is};let t=typeof e=="string"?this._getSurveyById(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}_checkSurveyRenderability(e){if(!this._configSource.isCapturing())return{eligible:!1,reason:Lm};if(Y(this._surveyManager))return{eligible:!1,reason:Is};let t=typeof e=="string"?this._getSurveyById(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(Y(this._surveyManager))return J.warn("init was not called"),{visible:!1,disabledReason:Is};let t=this._checkSurveyRenderability(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return Y(this._surveyManager)?(J.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Is})):new Promise(i=>{this.getSurveys(s=>{var n;let r=(n=s.find(o=>o.id===e))!==null&&n!==void 0?n:null;if(r){let o=this._checkSurveyRenderability(r);i({visible:o.eligible,disabledReason:o.reason})}else i({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t,i){var s;if(!this._configSource.isCapturing())return;if(Y(this._surveyManager))return void J.warn("init was not called");let n=typeof e=="string"?this._getSurveyById(e):e;if(!n?.id)return void J.warn("Survey not found");
110if(!Nm.includes(n.type))return void J.warn(`Surveys of type ${n.type} cannot be rendered in the app`);let r=F?.querySelector(t);if(r){if(!((s=n.appearance)===null||s===void 0)&&s.surveyPopupDelaySeconds){J.info(`Rendering survey ${n.id} with delay of ${n.appearance.surveyPopupDelaySeconds} seconds`);let o=setTimeout(()=>{var a,l;this._renderTimeouts.delete(o),!this._disposed&&this._configSource.isCapturing()&&(J.info(`Rendering survey ${n.id} with delay of ${(a=n.appearance)===null||a===void 0?void 0:a.surveyPopupDelaySeconds} seconds`),(l=this._surveyManager)===null||l===void 0||l.renderSurvey(n,r,i),J.info(`Survey ${n.id} rendered`))},1e3*n.appearance.surveyPopupDelaySeconds);return void this._renderTimeouts.add(o)}this._surveyManager.renderSurvey(n,r,i)}else J.warn("Survey element not found")}displaySurvey(e,t){var i;if(!this._configSource.isCapturing())return;if(Y(this._surveyManager))return void J.warn("init was not called");let s=this._getSurveyById(e);if(!s)return void J.warn("Survey not found");let n=s;if(!((i=s.appearance)===null||i===void 0)&&i.surveyPopupDelaySeconds&&t.ignoreDelay&&(n=b(b({},s),{},{appearance:b(b({},s.appearance),{},{surveyPopupDelaySeconds:0})})),t.displayType!==cu.Popover&&t.initialResponses&&J.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){let r=this._checkSurveyEligibility(s);if(!r.eligible)return void J.warn("Survey is not eligible to be displayed: ",r.reason)}t.displayType!==cu.Inline?this._surveyManager.handlePopoverSurvey(n,t):this.renderSurvey(n,t.selector,t.properties)}cancelPendingSurvey(e){Y(this._surveyManager)?J.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e,t;(e=this._surveyManager)===null||e===void 0||(t=e.handlePageUnload)===null||t===void 0||t.call(e)}};function Ms(e,t,i){if(Y(e))return!1;switch(i){case"exact":return e===t;case"contains":{let s=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(s,"i").test(e)}case"regex":try{return new RegExp(t).test(e)}catch{return!1}default:return!1}}var Ok=class{constructor(e){this._instance=e,this._actionRegistry=new Set,this._actionEvents=new Set,this._debugEventEmitter=new Aa,this._checkStep=(t,i)=>this._checkStepEvent(t,i)&&this._checkStepUrl(t,i)&&this._checkStepElement(t,i)&&this._checkStepProperties(t,i),this._checkStepEvent=(t,i)=>!i?.event||t?.event===i?.event}init(){var e,t;M((e=this._instance)===null||e===void 0?void 0:e._addCaptureHook)||(this._captureHookUnsubscribe=(t=this._instance)===null||t===void 0?void 0:t._addCaptureHook((i,s)=>{this.on(i,s)}))}dispose(){var e,t;(e=this._captureHookUnsubscribe)===null||e===void 0||e.call(this),this._captureHookUnsubscribe=void 0,(t=this._instance)===null||t===void 0||(t=t.autocapture)===null||t===void 0||t.setElementSelectors(new Set,this),this._debugEventEmitter=new Aa}register(e){var t,i;if(!M((t=this._instance)===null||t===void 0?void 0:t._addCaptureHook)&&(e.forEach(s=>{var n;this._actionRegistry.add(s),(n=s.steps)===null||n===void 0||n.forEach(r=>{this._actionEvents.add(r?.event||"")})}),(i=this._instance)===null||i===void 0?void 0:i.autocapture)){let s=new Set;this._actionRegistry.forEach(n=>{var r;(r=n.steps)===null||r===void 0||r.forEach(o=>{o?.selector&&s.add(o.selector)})}),this._instance.autocapture.setElementSelectors(s,this)}}replace(e){this._actionRegistry.clear(),this._actionEvents.clear(),this.register(e)}on(e,t){t!=null&&e.length!=0&&(this._actionEvents.has(e)||this._actionEvents.has(t.event))&&this._actionRegistry.forEach(i=>{this._checkAction(t,i)&&this._debugEventEmitter.emit("actionCaptured",i.name)})}_addActionHook(e){this.onAction("actionCaptured",t=>e(t))}_checkAction(e,t){if(t?.steps==null)return!1;for(let i of t.steps)if(this._checkStep(e,i))return!0;return!1}onAction(e,t){return this._debugEventEmitter.on(e,t)}_checkStepUrl(e,t){if(t?.url){var i;let s=e==null||(i=e.properties)===null||i===void 0?void 0:i.$current_url;if(!s||typeof s!="string"||!Ms(s,t.url,t.url_matching||"contains"))return!1}return!0}_checkStepElement(e,t){return!!this._checkStepHref(e,t)&&!!this._checkStepText(e,t)&&!!this._checkStepSelector(e,t)}_checkStepHref(e,t){var i;if(!t?.href)return!0;let s=this._getElementsList(e);if(s.length>0)return s.some(r=>Ms(r.href,t.href,t.href_matching||"exact"));let n=(e==null||(i=e.properties)===null||i===void 0?void 0:i.$elements_chain)||"";return!!n&&Ms((function(r){let o=r.match(/(?::|")href="(.*?)"/);return o?o[1]:""})(n),t.href,t.href_matching||"exact")}_checkStepText(e,t){var i;if(!t?.text)return!0;let s=this._getElementsList(e);if(s.length>0)return s.some(l=>Ms(l.text,t.text,t.text_matching||"exact")||Ms(l.$el_text,t.text,t.text_matching||"exact"));let n=(e==null||(i=e.properties)===null||i===void 0?void 0:i.$elements_chain)||"";return!!n&&(r=(function(l){let c=[],d=/(?::|")text="(.*?)"/g,h;for(;!Y(h=d.exec(l));)c.includes(h[1])||c.push(h[1]);return c})(n),o=t.text,a=t.text_matching||"exact",r.some(l=>Ms(l,o,a)));var r,o,a}_checkStepSelector(e,t){var i,s;if(!t?.selector)return!0;let n=e==null||(i=e.properties)===null||i===void 0?void 0:i.$element_selectors;if(n?.includes(t.selector))return!0;let r=(e==null||(s=e.properties)===null||s===void 0?void 0:s.$elements_chain)||"";if(t.selector_regex&&r)try{return new RegExp(t.selector_regex).test(r)}catch{return!1}return!1}_getElementsList(e){var t;return(e==null||(t=e.properties)===null||t===void 0?void 0:t.$elements)==null?[]:e?.properties.$elements}_checkStepProperties(e,t){return!t?.properties||t.properties.length===0||Cv(t.properties.reduce((i,s)=>{let n=W(s.value)?s.value.map(String):s.value!=null?[String(s.value)]:[];return i[s.key]={values:n,operator:s.operator||"exact"},i},{}),e?.properties)}},$k=class{constructor(e,t){var i,s;this._pendingActivatedItems=[],this._instance=e,this._onActivationChanged=t,this._eventToItems=new Map,this._cancelEventToItems=new Map,this._actionToItems=new Map,this._sessionIdUnsubscribe=(i=this._instance)===null||i===void 0||(s=i.onSessionId)===null||s===void 0?void 0:s.call(i,n=>this._onSessionIdChanged(n))}_shouldPersistArmedActivation(e){return!1}_getActivationTimestampsKey(){return null}_writeActivationTimestamps(e){}_clearActivationTimestampsStore(){}_doesEventMatchFilter(e,t){return!!e&&Cv(e.propertyFilters,t?.properties)}_buildEventToItemMap(e,t){let i=new Map;return e.forEach(s=>{var n;(n=s.conditions)===null||n===void 0||(n=n[t])===null||n===void 0||(n=n.values)===null||n===void 0||n.forEac
110h(r=>{if(r?.name){let o=i.get(r.name)||[];o.push(s.id),i.set(r.name,o)}})}),i}_getMatchingItems(e,t,i){let s=(i===Ln.Activation?this._eventToItems:this._cancelEventToItems).get(e),n=[];return this._getItems(r=>{n=r.filter(o=>s?.includes(o.id))}),n.filter(r=>{var o;let a=(o=r.conditions)===null||o===void 0||(o=o[i])===null||o===void 0||(o=o.values)===null||o===void 0?void 0:o.find(l=>l.name===e);return this._doesEventMatchFilter(a,t)})}register(e){this._register(e,!1)}replace(e){this._register(e,!0)}_register(e,t){var i;M((i=this._instance)===null||i===void 0?void 0:i._addCaptureHook)||(this._setupEventBasedItems(e,t),this._setupActionBasedItems(e,t))}_setupActionBasedItems(e,t){let i=e.filter(r=>{var o;return(o=r.conditions)===null||o===void 0||(o=o.actions)===null||o===void 0||(o=o.values)===null||o===void 0?void 0:o.length});var s;if(t&&this._actionToItems.clear(),i.length===0)return void(t&&((s=this._actionMatcher)===null||s===void 0||s.replace([])));this._actionMatcher||(this._actionMatcher=new Ok(this._instance),this._actionMatcher.init(),this._actionMatcher._addActionHook(r=>this.onAction(r)));let n=[];i.forEach(r=>{var o;(o=r.conditions)===null||o===void 0||(o=o.actions)===null||o===void 0||o.values.forEach(a=>{if(n.push(a),a.name){var l;let c=(l=this._actionToItems.get(a.name))!==null&&l!==void 0?l:[];c.includes(r.id)||c.push(r.id),this._actionToItems.set(a.name,c)}})}),t?this._actionMatcher.replace(n):this._actionMatcher.register(n)}_mergeItemMaps(e,t){t.forEach((i,s)=>{var n;let r=(n=e.get(s))!==null&&n!==void 0?n:[];i.forEach(o=>{r.includes(o)||r.push(o)}),e.set(s,r)})}_setupEventBasedItems(e,t){var i,s;let n=e.filter(l=>{var c,d;return((c=l.conditions)===null||c===void 0?void 0:c.events)&&((d=l.conditions)===null||d===void 0||(d=d.events)===null||d===void 0||(d=d.values)===null||d===void 0?void 0:d.length)>0}),r=e.filter(l=>{var c,d;return((c=l.conditions)===null||c===void 0?void 0:c.cancelEvents)&&((d=l.conditions)===null||d===void 0||(d=d.cancelEvents)===null||d===void 0||(d=d.values)===null||d===void 0?void 0:d.length)>0}),o=this._buildEventToItemMap(e,Ln.Activation),a=this._buildEventToItemMap(e,Ln.Cancellation);t?(this._eventToItems=o,this._cancelEventToItems=a):(this._mergeItemMaps(this._eventToItems,o),this._mergeItemMaps(this._cancelEventToItems,a)),(n.length!==0||r.length!==0||e.some(l=>{var c;return(c=l.conditions)===null||c===void 0||(c=c.actions)===null||c===void 0||(c=c.values)===null||c===void 0?void 0:c.length}))&&((i=this._captureHookUnsubscribe)!==null&&i!==void 0||(this._captureHookUnsubscribe=(s=this._instance)===null||s===void 0?void 0:s._addCaptureHook((l,c)=>{this.onEvent(l,c)})))}onEvent(e,t){var i,s;let n=this._getLogger(),r=(t==null||(i=t.properties)===null||i===void 0?void 0:i.$survey_id)||(t==null||(s=t.properties)===null||s===void 0?void 0:s.$product_tour_id);if(r&&this.getActivatedIds().includes(r)){let a=this._activationOutcome(e,r,t);if(a==="consume")return n.info("event consumed activated item, removing it",{event:e,itemId:r}),void this._deactivateItems([r]);if(a==="persist")return n.info("shown item promoted to persisted activation",{event:e,itemId:r}),this._persistActivation(r),void this._clearActivationTimestamps([r])}if(this._cancelEventToItems.has(e)){let a=this._getMatchingItems(e,t,Ln.Cancellation);a.length>0&&(n.info("cancel event matched, cancelling items",{event:e,itemsToCancel:a.map(l=>l.id)}),this._deactivateItems(a.map(l=>l.id)),a.forEach(l=>this._cancelPendingItem(l.id)))}if(!this._eventToItems.has(e))return;n.info("event name matched",{event:e,eventPayload:t,items:this._eventToItems.get(e)});let o=this._getMatchingItems(e,t,Ln.Activation);this._activateItems(o.map(a=>a.id))}onAction(e){this._actionToItems.has(e)&&this._activateItems(this._actionToItems.get(e)||[])}_activateItems(e){var t,i;if(e.length===0)return;let s=!!(!((t=this._instance)===null||t===void 0||(i=t.get_session_id)===null||i===void 0)&&i.call(t)),n=[];for(let r of e)s&&this._shouldPersistArmedActivation(r)?this._persistActivation(r)&&this._recordActivationTimestamp(r):n.push(r);n.length>
1100&&(this._pendingActivatedItems=[...new Set([...this._pendingActivatedItems,...n])]),this._getLogger().info("updating activated items",{activatedItems:this.getActivatedIds()}),this._notifyActivationChanged()}_persistActivation(e){this._pendingActivatedItems=this._pendingActivatedItems.filter(i=>i!==e);let t=this._getPersistedActivatedIds();return!t.includes(e)&&(this._setActivatedItems([...t,e]),this._stampActivationSession(),!0)}_deactivateItems(e){let t=new Set(e);this._pendingActivatedItems=this._pendingActivatedItems.filter(n=>!t.has(n));let i=this._getRawPersistedActivatedIds(),s=i.filter(n=>!t.has(n));s.length!==i.length&&(this._setActivatedItems(s),s.length===0&&this._clearActivationSession()),this._clearActivationTimestamps(e),this._notifyActivationChanged()}_notifyActivationChanged(){try{var e;(e=this._onActivationChanged)===null||e===void 0||e.call(this)}catch(t){this._getLogger().error("Error while handling activated items change",t)}}_getRawActivationTimestamps(){var e;let t=this._getActivationTimestampsKey();if(!t)return{};let i=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[t];return i&&typeof i=="object"?i:{}}_recordActivationTimestamp(e){if(!this._getActivationTimestampsKey())return;let t=this._getRawActivationTimestamps();this._writeActivationTimestamps(b(b({},t),{},{[e]:Date.now()}))}_clearActivationTimestamps(e){if(!this._getActivationTimestampsKey())return;let t=this._getRawActivationTimestamps(),i={},s=!1;for(let[n,r]of Object.entries(t))e.includes(n)?s=!0:i[n]=r;s&&(Ct(i)?this._clearActivationTimestampsStore():this._writeActivationTimestamps(i))}_clearAllActivationTimestamps(){this._getActivationTimestampsKey()&&this._clearActivationTimestampsStore()}getActivationTimestamp(e){if(!this._getPersistedActivatedIds().includes(e))return;let t=this._getRawActivationTimestamps()[e];return ne(t)?t:void 0}_getRawPersistedActivatedIds(){var e;let t=this._getActivatedKey();return((e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[t])||[]}_getPersistedActivatedIds(){var e,t,i;let s=this._getRawPersistedActivatedIds();if(s.length===0)return[];let n=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[this._getActivatedSessionKey()],r=(t=this._instance)===null||t===void 0||(i=t.get_session_id)===null||i===void 0?void 0:i.call(t);return r&&n===r?s:[]}_stampActivationSession(){var e,t;let i=(e=this._instance)===null||e===void 0||(t=e.get_session_id)===null||t===void 0?void 0:t.call(e);i&&this._setActivatedSession(i)}_clearActivationSession(){this._clearActivatedSession()}_onSessionIdChanged(e){var t;let i=(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0?void 0:t.props[this._getActivatedSessionKey()];if(i&&i!==e){let s=this._getRawPersistedActivatedIds(),n=this._getRawActivationTimestamps();s.length>0&&(this._setActivatedItems([]),s.filter(r=>ne(n[r])).forEach(r=>this._cancelPendingItem(r))),this._clearActivationSession(),this._clearAllActivationTimestamps(),s.length>0&&this._notifyActivationChanged()}}getActivatedIds(){return[...new Set([...this._getPersistedActivatedIds(),...this._pendingActivatedItems])].filter(e=>!this._isItemPermanentlyIneligible(e))}dispose(){var e,t,i;(e=this._sessionIdUnsubscribe)===null||e===void 0||e.call(this),this._sessionIdUnsubscribe=void 0,(t=this._captureHookUnsubscribe)===null||t===void 0||t.call(this),this._captureHookUnsubscribe=void 0,(i=this._actionMatcher)===null||i===void 0||i.dispose(),this._actionMatcher=void 0}reset(){this._pendingActivatedItems=[],this._getRawPersistedActivatedIds().length>0&&this._setActivatedItems([]),this._clearActivationSession(),this._clearAllActivationTimestamps(),this._notifyActivationChanged()}getEventToItemsMap(){return this._eventToItems}_getActionMatcher(){return this._actionMatcher}},Dk=class extends $k{constructor(e,t){super(e,t)}_getActivatedKey(){return Fg}_getActivatedSessionKey(){return Ag}_getActivationTimestampsKey(){return Lg}_writeActivationTimestamps(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated_timestamps:e})}_clearActivationTimestampsStore(){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.unregister("$surveys_activated_timestamps")}_shouldPersistArmedActivation(e){var t;let i;this._getItems(n=>{i=n.find(r=>r.id===e)});let s=i==null||(t=i.appearance)===null||t===void 0?void 0:t.surveyPopupDelaySeconds;return ne(s)&&s>0}_getShownEventName(){return gt.SHOWN}_getItems(e){var t;(t=this._instance)===null||t===void 0||t.getSurveys(e)}_cancelPendingItem(e){var t;(t=this._instance)===null||t===void 0||t.cancelPendingSurvey(e)}_getLogger(){return J}_setActivatedItems(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated:e})}_setActivatedSession(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated_session:e})}_clearActivatedSession(){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.unregister("$surveys_activated_session")}_isItemPermanentlyIneligible(){return!1}_activationOutcome(e,t,i){var s;if(e===gt.SENT&&(i==null||(s=i.properties)===null||s===void 0?void 0:s.$survey_completed)===!1)return"ignore";let n;return this._getItems(r=>{n=r.find(o=>o.id===t)}),!n||kv(n)?e===gt.SHOWN?"consume":"ignore":e===gt.SHOWN?"persist":e===gt.DISMISSED||e===gt.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}
110getEventToSurveys(){return this.getEventToItemsMap()}},Nk=class{constructor(e){this._instance=e}initialize(){}get(e){if(typeof e=="string")return this._instance.get_property(e);let t={};for(let i of e){let s=this._instance.get_property(i);M(s)||(t[i]=s)}return t}set(e,t){this._instance.register(typeof e=="string"?{[e]:t}:e)}remove(e){typeof e!="string"?e.forEach(t=>this._instance.unregister(t)):this._instance.unregister(e)}},Bk=class{constructor(e){this._instance=e}get(){let e=this._instance.config;return{disableSurveys:e.disable_surveys,cookielessMode:!!e.cookieless_mode,advancedEnableSurveys:e.advanced_enable_surveys,requestTimeoutMs:e.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}isCapturing(){return this._instance.is_capturing()}getExtensions(){let e=R?.__PosthogExtensions__;if(!e)return;let{generateSurveys:t,loadExternalDependency:i}=e;return{generateSurveys:t?s=>t(this._instance,s):void 0,loadExternalDependency:i?s=>i(this._instance,"surveys",s):void 0}}createEventReceiver(e){return new Dk(this._instance,e)}onMatchingConditionsChanged(e){let t=this._instance._addCaptureHook(r=>{r!=="$pageview"&&r!==gt.SHOWN&&r!==gt.DISMISSED&&r!==gt.SENT||e()}),i=()=>e();Z(T,"PHSurveyShown",i);let s=!1,n=this._instance.onFeatureFlags(()=>{s&&e()});return s=!0,()=>{s=!1,t(),n(),T?.removeEventListener("PHSurveyShown",i)}}},qk=T?.location?oa(T.location.hash,"__posthog")||oa(location.hash,"state"):null,dg="_postHogToolbarParams",hg=Ie("[Toolbar]"),pg=Ie("[FeatureFlags]"),Hk=class{constructor(e,t=!1){this._loggedEvaluationEnvironmentsDeprecation=!1,this.update(e,t)}update(e,t){this._snapshot=((i,s)=>{var n,r,o,a,l,c,d,h;return{bootstrap:{featureFlags:(n=(r=i.bootstrap)===null||r===void 0?void 0:r.featureFlags)!==null&&n!==void 0?n:void 0,featureFlagPayloads:(o=(a=i.bootstrap)===null||a===void 0?void 0:a.featureFlagPayloads)!==null&&o!==void 0?o:void 0},remoteRequestsDisabled:s,featureFlagsDisabled:!!i.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!i.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!i.advanced_feature_flags_dedup_per_session,cacheTtlMs:i.feature_flag_cache_ttl_ms,refreshIntervalMs:(l=i.remote_config_refresh_interval_ms)!==null&&l!==void 0?l:3e5,idleRefreshBackoff:M(i.remote_config_refresh_interval_ms),requestTimeoutMs:i.feature_flag_request_timeout_ms,requestMaxRetries:Math.max(0,(c=i.feature_flag_request_max_retries)!==null&&c!==void 0?c:1),compression:i.disable_compression?void 0:"best-available",evaluationContexts:(d=(h=i.evaluation_contexts)!==null&&h!==void 0?h:i.evaluation_environments)!==null&&d!==void 0?d:[],flagKeys:W(i.flag_keys)?i.flag_keys:void 0}})(e,t),!e.evaluation_environments||e.evaluation_contexts||this._loggedEvaluationEnvironmentsDeprecation||(pg.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this._loggedEvaluationEnvironmentsDeprecation=!0),M(e.flag_keys)||W(e.flag_keys)||pg.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this._snapshot}},_g=Ie("[FeatureFlags]"),Ki=Ie("[FeatureFlags]",{debugEnabled:!0}),ac=`" failed. Feature flags didn't load in time.`,Uk=[502,504],gg=["click","keydown","wheel","touchstart","pointerdown"],fg="connection_error",vg=e=>{let t={};for(let i=0;e.length>i;i++)t[e[i]]=!0;return t},mg=e=>{let t={};for(let[i,s]of Lo(e||{}))s&&(t[i]=s);return t},yg="Refusing to render web experiment since the viewer is a likely bot",Wk={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>_a(t,e),not_regex:(e,t)=>!_a(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e},$t=Ie("[Conversations]"),Ji="Conversations not available yet.";function bg(e,t){var i,s,n,r,o,a,l;let c=(i=e?.flushIntervalMs)!==null&&i!==void 0?i:3e3,d=(s=e?.maxBufferSize)!==null&&s!==void 0?s:100,h=t?.consoleCapture?void 0:(n=e?.maxLogsPerInterval)!==null&&n!==void 0?n:1e3,u=M(h)?Math.max(d,2048):Math.max(d,h),p=b(b({},(function(){let _="",g="";try{let v=Je?.userAgent;v&&([_,g]=wf(v))}catch{}return(function(v,f){let m=(function(y){if(y)return{}.hasOwnProperty.call(lh,y)?lh[y]:y})(v);return b(b({},m?{"os.name":m}:{}),f?{"os.version":f}:{})})(_,g)})()),e?.resourceAttributes);return{serviceName:(r=(o=p?.["service.name"])!==null&&o!==void 0?o:e?.serviceName)!==null&&r!==void 0?r:t?.serviceNameDefault,serviceVersion:(a=p?.["service.version"])!==null&&a!==void 0?a:e?.serviceVersion,environment:(l=p?.["deployment.environment"])!==null&&l!==void 0?l:e?.environment,resourceAttributes:p,beforeSend:e?.beforeSend,flushIntervalMs:c,maxBufferSize:d,maxQueueSize:u,maxBatchRecordsPerPost:100,rateCapWindowMs:c,maxLogsPerInterval:h,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}
110var zk=["debug","log","warn","error","info"],Sg="console",H0="__posthogHandledLogsRequestError",lc=(e,t)=>{let i=e instanceof Error?e:new Error(t);return i[H0]=!0,i},wg=e=>!!e&&typeof e=="object"&&e[H0]===!0,La=Ie("[NetworkMetrics]"),$d=()=>{var e;return!(T==null||(e=T.performance)===null||e===void 0)&&e.now?T.performance.now():Date.now()},jk={"http:":80,"https:":443},Vk=new Set(["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"]),U0=(e,t)=>{var i;let s=String(t);return{method:String(e).toUpperCase(),url:((i=Jt(s))===null||i===void 0?void 0:i.href)||s}},ku=(e,t,i,s,n,r,o=!1)=>{try{var a,l;let c=n();if(!c)return;let d=i||void 0,h=$d()-s,u=Jt(t.url);if(u&&u.protocol!=="http:"&&u.protocol!=="https:")return;let p={url:u?.href||t.url,method:t.method},_=_e(c.name)?c.name(p):oe(c.name)?c.name:"http.client.request.duration";if(!_)return;let g=o&&!d?void 0:((f,m)=>f?400>f?void 0:String(f):m?.name||"_OTHER")(d,r),v=b(b(b(b(b({},(f=>{let m=Vk.has(f)?f:"_OTHER";return b({"http.request.method":m},m==="_OTHER"&&f!==m?{"http.request.method_original":f}:{})})(p.method)),u?(f=>{return{"server.address":f.hostname.startsWith("[")&&f.hostname.endsWith("]")?f.hostname.slice(1,-1):f.hostname,"server.port":Number(f.port)||jk[f.protocol],"url.scheme":f.protocol.slice(0,-1),"url.template":(m=f.pathname,m.split("/").map(y=>(w=>/^\d+$/.test(w)||w.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(w))(y)?":id":y).join("/"))};var m})(u):{}),d?{"http.response.status_code":d}:{}),g?{"error.type":g}:{}),(a=c.attributes)===null||a===void 0?void 0:a.call(c,p,{status:d,durationMs:h}));(l=e.metrics)===null||l===void 0||l.histogram(_,h,{unit:"ms",attributes:v})}catch(c){La.error("Failed to record network metric",c)}},W0=()=>{},Gk=(e,t)=>_e(T?.fetch)?ai(T,"fetch",i=>function(...s){let n=$d(),r=i.apply(this,s);if(!t())return r;try{var o,a,l;let[c,d]=s,h=U0((o=(a=d?.method)!==null&&a!==void 0?a:c?.method)!==null&&o!==void 0?o:"GET",(l=c?.url)!==null&&l!==void 0?l:c);return r.then(u=>(ku(e,h,u?.status,n,t,void 0,!0),u),u=>{throw ku(e,h,void 0,n,t,u),u})}catch(c){return La.error("Failed to observe fetch",c),r}}):W0,Qk=(e,t)=>{var i;let s=T==null||(i=T.XMLHttpRequest)===null||i===void 0?void 0:i.prototype;if(!s)return W0;let n=new WeakMap,r=ai(s,"open",a=>function(...l){try{T0.has(this)||n.set(this,U0(l[0],l[1]))}catch(c){La.error("Failed to observe XHR open",c)}return a.apply(this,l)}),o=ai(s,"send",a=>function(...l){let c;try{let d=n.get(this);if(d&&t()){let h=$d();c=()=>{this.removeEventListener("loadend",c),ku(e,d,this.status,h,t)},Z(this,"loadend",c)}}catch(d){La.error("Failed to observe XHR send",d)}try{return a.apply(this,l)}catch(d){throw c&&this.removeEventListener("loadend",c),d}});return()=>{r(),o()}},Za={featureFlags:class{constructor(e){this.name="featureFlags",this._override_warning=!1,this.featureFlagEventHandlers=[],this._logger=_g,this._baseEventProperties={},this._eventPropertiesWithFlagValues={},this._reloadingHandlers=[],this._hasLoadedFlags=!1,this._requestInFlight=!1,this._requestGeneration=0,this._reloadingDisabled=!1,this._additionalReloadRequested=!1,this._flagsLoadedFromRemote=!1,this._staleCacheRefreshTriggered=!1,this._consecutiveStatusZeroFailures=0,this._hadUserInteraction=!1,this._onOnline=()=>{let t=this._hasStatusZeroCircuitBreakerTripped();this._consecutiveStatusZeroFailures=0,t&&this.reloadFeatureFlags()},this._refreshIfDue=()=>{var t,i;let s=this._refreshIntervalMs,n=(t=this._dueRefreshIntervalMs)!==null&&t!==void 0?t:s;M(s)||M(n)||this._config.remoteRequestsDisabled||!F||F.visibilityState==="hidden"||Date.now()-((i=this._lastRefreshAt)!==null&&i!==void 0?i:0)<n||(this._dueRefreshIntervalMs=this._hadUserInteraction||!this._config.idleRefreshBackoff?s:Math.min(2*n,36e5),this._hadUserInteraction=!1,this.reloadFeatureFlags(),this._scheduleNextRefresh())},this._onUserInteraction=()=>{this._hadUserInteraction&&this._dueRefreshIntervalMs===this._refreshIntervalMs||this._resumeConfiguredInterval()},this._onVisibilityChange=()=>{F?.visibilityState==="visible"&&this._resumeConfiguredInterval()},"get"in e?this._configSource=e:(this._instance=e,this._mutableConfigSource=new Hk(e.config,e._shouldDisableFlags()),this._configSource=this._mutableConfigSource)}updateConfig(e,t){var i;(i=this._mutableConfigSource)===null||i===void 0||i.update(e,t),this._client&&this._syncAutomaticRefresh()}setup(e){return this._initializingClient=e,this._logger=e.logger.createLogger("[FeatureFlags]"),q0(e.kv.initialize(),()=>{this._initializingClient===e&&(this._initializingClient=void 0,this._client=e,this._finishSetup(e))})}_finishSetup(e){var t;if(this._client===e)return T&&Z(T,"online",this._onOnline),this._syncAutomaticRefresh(),this._dynamicProperties=e.registerDynamicEventProperties(()=>this._isCacheStale()?this._baseEventProperties:this._eventPropertiesWithFlagValues),this._crossTabPersistenceUnsubscribe=(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0?void 0:t.onCrossTabFeatureFlagChange(()=>{this._clearBootstrapState(),this._rebuildEventProperties(),this._fireFeatureFlagsCallbacks()}),this._rebuildEventProperties(),this.initialize()}_resumeConfiguredInterval(){this._hadUserInteraction=!0,this._dueRefresh
110IntervalMs=this._refreshIntervalMs,this._refreshIfDue()}_syncAutomaticRefresh(){let e=this._config.refreshIntervalMs,t=!this._config.remoteRequestsDisabled&&F&&!M(e)&&e>0?e:void 0;this._config.idleRefreshBackoff||(this._dueRefreshIntervalMs=t),t!==this._refreshIntervalMs&&(this._stopAutomaticRefresh(),M(t)||(this._refreshIntervalMs=t,this._dueRefreshIntervalMs=t,this._scheduleNextRefresh(),F?.addEventListener&&(Z(F,wr,this._onVisibilityChange),Ds(gg,i=>{Z(F,i,this._onUserInteraction,{capture:!0})}))))}_scheduleNextRefresh(){M(this._refreshIntervalMs)||(M(this._refreshInterval)||clearInterval(this._refreshInterval),this._lastRefreshAt=Date.now(),this._refreshInterval=setInterval(this._refreshIfDue,this._refreshIntervalMs))}_stopAutomaticRefresh(){var e;M(this._refreshInterval)||(clearInterval(this._refreshInterval),this._refreshInterval=void 0,F==null||(e=F.removeEventListener)===null||e===void 0||e.call(F,"visibilitychange",this._onVisibilityChange),Ds(gg,t=>{var i;F==null||(i=F.removeEventListener)===null||i===void 0||i.call(F,t,this._onUserInteraction,{capture:!0})})),this._refreshIntervalMs=void 0,this._dueRefreshIntervalMs=void 0,this._hadUserInteraction=!1,this._lastRefreshAt=void 0}destroy(){this._dispose()}dispose(){this._dispose()}_dispose(){var e,t;this._stopAutomaticRefresh(),this._requestGeneration++,this._additionalReloadRequested=!1,this._initializingClient=void 0,this._client&&(this._clearDebouncer(),(e=this._dynamicProperties)===null||e===void 0||e.dispose(),this._dynamicProperties=void 0,(t=this._crossTabPersistenceUnsubscribe)===null||t===void 0||t.call(this),this._crossTabPersistenceUnsubscribe=void 0,this._reloadingHandlers=[],T?.removeEventListener("online",this._onOnline),this._client=void 0)}get _config(){return this._configSource.get()}_prop(e){var t;return this._bootstrapState&&e in this._bootstrapState?this._bootstrapState[e]:(t=this._client)===null||t===void 0?void 0:t.kv.get(e)}_clearBootstrapState(){return!!this._bootstrapState&&(this._bootstrapState=void 0,!0)}_fallBackToPersistedFlags(){var e;return!M((e=this._client)===null||e===void 0?void 0:e.kv.get("$enabled_feature_flags"))&&this._clearBootstrapState()}_set(e){this._persist(()=>{var t;return(t=this._client)===null||t===void 0?void 0:t.kv.set(e)})}_markCrossTabFeatureFlagSnapshot(e,t,i){var s;if(!(!((s=this._instance)===null||s===void 0)&&s.persistence)||!e.$enabled_feature_flags)return;let n=this._prop("$enabled_feature_flags")||{},r=e.$enabled_feature_flags||{},o=t.flags||t.featureFlags,a=t.flags?Object.entries(t.flags).filter(([,f])=>!f?.failed).map(([f])=>f):[],l=!!t.errorsWhileComputingFlags&&!!t.flags,c=l?a:i&&!W(o)?Object.keys(o||{}):Array.from(new Set([...Object.keys(n),...Object.keys(r)])),d=this._prop("$feature_flag_payloads")||{},h=e.$feature_flag_payloads||{},u=l||i?c:Array.from(new Set([...Object.keys(d),...Object.keys(h)])),p=!l&&!i,_=!!p||c,g=!!p||u,v={[gi]:_,[Gt]:_,[Fi]:g};e.$feature_flag_details&&(v[ns]=_);for(let f of[rs,Di,Kn])M(e[f])||(v[f]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(v)}_remove(e){this._persist(()=>{var t;return(t=this._client)===null||t===void 0?void 0:t.kv.remove(e)})}_persist(e){try{e()}catch(t){this._logger.error("Failed to update feature flag persistence",t)}}_rebuildEventProperties(){let e={};for(let s of[gi,Fi,rs,Xt]){let n=this._prop(s);M(n)||(e[s]=n)}this._baseEventProperties=e;let t=b({},e),i=this._prop(Gt);if(i)for(let[s,n]of Object.entries(i))t[`$feature/${s}`]=n;this._eventPropertiesWithFlagValues=t}_isCacheStale(){let e=this._config.cacheTtlMs;if(!e||0>=e)return!1;let t=this._prop(Di);return typeof t!="number"||Date.now()-t>e}_checkAndTriggerStaleRefresh(){return!!this._isCacheStale()&&(this._staleCacheRefreshTriggered||this._requestInFlight||(this._staleCacheRefreshTriggered=!0,this._logger.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}_getValidEvaluationEnvironments(){let e=this._config.evaluationContexts;return e?.length?e.filter(t=>{let i=t&&typeof t=="string"&&t.trim().length>0;return i||this._logger.error("Invalid evaluation context found:",t,"Expected non-empty string"),i}):[]}_getValidFlagKeys(){let e=this._config.flagKeys;if(!M(e))return e.filter(t=>{let i=t&&typeof t=="string"&&t.trim().length>0;return i||this._logger.error("Invalid flag key found:",t,"Expected non-empty string"),i})}initialize(){var e,t;let i=this._config,s=(e=(t=i.bootstrap)===null||t===void 0?void 0:t.featureFlags)!==null&&e!==void 0?e:{};if(Object.keys(s).length){var n,r;let o=(n=(r=i.bootstrap)===null||r===void 0?void 0:r.featureFlagPayloads)!==null&&n!==void 0?n:{},a=Object.keys(s).filter(c=>!M(s[c])).reduce((c,d)=>(c[d]=s[d],c),{}),l=Object.keys(o).filter(c=>a[c]).reduce((c,d)=>(c[d]=o[d],c),{});return this._receivedFeatureFlags({featureFlags:a,featureFlagPayloads:l},void 0,{persist:!1})}}updateFlags(e,t,i){var s,n;let r=i?.merge&&(s=this._prop("$enabled_feature_flags"))!==null&&s!==void 0?s:{},o=i?.merge&&(n=this._prop("$feature_flag_payloads"))!==null&&n!==void 0?n:{},a=b(b({},r),e),l=b(b({},o),t),c={};for(let[d,h]of Object.entries(a))c[d]={key:d,enabled:nh(h),variant:rh(h),reason:void 0,metadata:M(l?.[d])?void 0:{id:0,version:void 0,description:void 0,payload:l[d]}};this._receivedFeatureFlags({flags:c})}get hasLoadedFlags(){return this._hasLoadedFlags}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){let e=this._prop(ns),t=this._prop(Xt),i=this._prop(Yi);if(!i&&!t)return e||{};let s=Oe({},e||{}),n=[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])];for(let a of n){var r;let l=s[a],c=t?.[a],d=M(c)?(r=l?.enabled)!==null&&r!==void 0&&r:!!c,h=M(c)?l?.variant:typeof c=="string"?c:void 0,u=i?.[a],p=b(b({},l),{},{enabled:d,variant:d?h??l?.variant:void 0});var o;d!==l?.enabled&&(p.original_enabled=l?.enabled),h!==l?.variant&&(p.original_variant=l?.variant),u&&(p.metadata=b(b({},l?.metadata),{},{payload:u,original_payload:l==null||(o=l.metadata)===null||o===void 0?void 0:o.payload})),s[a]=p}return this._override_warning||(this._logger.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:s}),this._override_warning=!0),s}getAllFeatureFlags(){let e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map(i=>{let s=e[i];return{key:i,enabled:nh(s),variant:rh(s),payload:sh(t[i])}})}getFlagVariants(){let e=this._prop(Gt),t=this._prop(Xt);if(!t)return e||{};let i=Oe({},e||{}),s=Object.keys(t);for(let n=0;s.length>n;n++)i[s[n]]=t[s[n]];return this._override_warning||(this._logger.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this._override_warning=!0),i}getFlagPayloads(){let e=this._prop(Fi),t=this._prop(Yi);if(!t)return e||{};let i=Oe({},e||{}),s=Object.keys(t);for(let n=0;s.length>n;n++)i[s[n]]=t[s[n]];return this._override_warning||(this._logger.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this._override_warning=!0),i}reloadFeatureFlags(){this._reloadingDisabled||this._config.featureFlagsDisabled||this._hasStatusZeroCircuitBreakerTripped()||(this._requestInFlight&&(this._additionalReloadRequested=!0),this._reloadDebouncer||(this._reloadingHandlers.slice().forEac
110h(e=>{try{e()}catch(t){this._logger.error("Error while running feature flags reloading callback",t)}}),this._reloadDebouncer=setTimeout(()=>{this._callFlagsEndpoint()},5)))}_clearDebouncer(){clearTimeout(this._reloadDebouncer),this._reloadDebouncer=void 0}onReloading(e){return this._reloadingHandlers.push(e),()=>{this._reloadingHandlers=this._reloadingHandlers.filter(t=>t!==e)}}ensureFlagsLoaded(){this._hasLoadedFlags||this._requestInFlight||this._reloadDebouncer||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this._reloadingDisabled=e}resetFlagCallReported(){this._remove(Li)}_callFlagsEndpoint(e){this._clearDebouncer();let t=this._client;if(!t||this._config.remoteRequestsDisabled||this._hasStatusZeroCircuitBreakerTripped())return;if(this._requestInFlight)return void(this._additionalReloadRequested=!0);let i={token:t.projectToken,distinct_id:t.distinctId,groups:t.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:b(b(b({},t.initialPersonProperties),this._prop("$stored_person_properties")||{}),{},{$lib:t.library.name,$lib_version:t.library.version}),group_properties:this._prop(Ai),timezone:Fv()};M(t.deviceId)||(i.$device_id=t.deviceId),(e?.disableFlags||this._config.featureFlagsDisabled)&&(i.disable_flags=!0);let s=this._getValidEvaluationEnvironments();s.length&&(i.evaluation_contexts=s);let n=this._getValidFlagKeys();M(n)||(i.flag_keys=n);let r=this._config.onlyEvaluateSurveyFeatureFlags,o="/flags/?v=2"+(r?"&only_evaluate_survey_feature_flags=true":""),a=this._requestGeneration;this._requestInFlight=!0;let l=()=>{this._additionalReloadRequested&&(this._additionalReloadRequested=!1,this._callFlagsEndpoint())},c=_=>{var g,v;let f=(g=_.json)!==null&&g!==void 0?g:{},m=_.statusCode!==200;if(this._requestInFlight=!1,a!==this._requestGeneration)return void l();if(this._trackStatusZeroReachability(_.statusCode),m||this._additionalReloadRequested||(this.$anon_distinct_id=void 0),i.disable_flags&&!this._additionalReloadRequested)return;this._flagsLoadedFromRemote=!m;let y=[];_.error?y.push(_.error instanceof Error&&_.error.name==="AbortError"?"timeout":_.error instanceof Error?fg:"unknown_error"):_.statusCode!==200&&y.push(`api_error_${_.statusCode}`),f.errorsWhileComputingFlags&&y.push("errors_while_computing_flags");let w=!!(!((v=f.quotaLimited)===null||v===void 0)&&v.includes("feature_flags"));w&&y.push("quota_limited"),this._set({[Sr]:y}),w?this._logger.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):i.disable_flags||this._receivedFeatureFlags(f,m,{partialResponse:r}),l()},d=_=>{this._requestInFlight=!1,a===this._requestGeneration&&(this._set({[Sr]:[fg]}),this._logger.error("Feature flag request failed",_),this._fallBackToPersistedFlags()&&this._fireFeatureFlagsCallbacks(!0)),l()},h=this._config.requestMaxRetries,u=()=>h>0&&a===this._requestGeneration,p=()=>{if(a!==this._requestGeneration||!this._client||this._config.remoteRequestsDisabled)return this._requestInFlight=!1,void l();try{t.sendRequest(o,{target:"flags",method:"POST",body:i,compression:this._config.compression,sentAt:"body",timeoutMs:this._config.requestTimeoutMs}).then(_=>{if((g=>Uk.includes(g.statusCode)||(v=>v.statusCode===0&&v.error instanceof Error&&v.error.name==="AbortError")(g))(_)&&u())return h--,void setTimeout(p,500);c(_)}).catch(d)}catch(_){d(_)}};p()}_hasStatusZeroCircuitBreakerTripped(){return Jf(this._consecutiveStatusZeroFailures,3)}_trackStatusZeroReachability(e){this._consecutiveStatusZeroFailures=Yf(e,this._consecutiveStatusZeroFailures,3,()=>this._logger.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes."))}getFeatureFlag(e,t={}){var i;if(t.fresh&&!this._flagsLoadedFromRemote)return;if(!(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0))return void this._logger.warn('getFeatureFlag for key "'+e+ac);if(this._checkAndTriggerStaleRefresh())return;let s=this.getFeatureFlagResult(e,t);return(i=s?.variant)!==null&&i!==void 0?i:s?.enabled}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){let t=this.getFeatureFlagResult(e,{send_event:!1});return t?.payload}getFeatureFlagResult(e,t={}){if(t.fresh&&!this._flagsLoadedFromRemote)return;if(!(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0))return void this._logger.warn('getFeatureFlagResult for key "'+e+ac);if(this._checkAndTriggerStaleRefresh())return;let i=this.getFlagVariants(),s=e in i,n=i[e],r=this.getFlagPayloads()[e],o=String(n),a=this._prop("$feature_flag_request_id")||void 0,l=this._prop("$feature_flag_evaluated_at")||void 0,c,d=this._prop("$flag_call_reported")||{};if(this._config.deduplicateCallsPerSession){var h;let E=(h=this._client)===null||h===void 0?void 0:h.session.sessionId,I=this._prop(Bn);E&&E!==I&&(d={},c=E)}if(t.send_event||!("send_event"in t))if(e in d&&d[e].includes(o))c&&this._set({[Li]:d,[Bn]:c});else{var u,p,_,g,v,f,m,y,w,S,x,k;W(d[e])?d[e].push(o):d[e]=[o],this._set(b({[Li]:d},c?{[Bn]:c}:{}));let E=this.getFeatureFlagDetails(e),I=[...(u=this._prop("$feature_flag_errors"))!==null&&u!==void 0?u:[]];M(n)&&I.push("flag_missing");let P={$feature_flag:e,$feature_flag_response:n,$feature_flag_payload:r??null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:(p=(_=this._config.bootstrap)===null||_===void 0||(_=_.featureFlags)===null||_===void 0?void 0:_[e])!==null&&p!==void 0?p:null,$feature_flag_bootstrapped_payload:(g=(v=this._config.bootstrap)===null||v===void 0||(v=v.featureFlagPayloads)===null||v===void 0?void 0:v[e])!==null&&g!==void 0?g:null,$used_bootstrap_value:!this._flagsLoadedFromRemote};M(E==null||(f=E.metadata)===null||f===void 0?void 0:f.has_experiment)||(P.$feature_flag_has_experiment=E.metadata.has_experiment),M(E==null||(m=E.metadata)===null||m===void 0?void 0:m.version)||(P.$feature_flag_version=E.metadata.version);let O=(y=E==null||(w=E.reason)===null||w===void 0?void 0:w.description)!==null&&y!==void 0?y:E==null||(S=E.reason)===null||S===void 0?void 0:S.code;var C;O&&(P.$feature_flag_reason=O),!(E==null||(x=E.metadata)===null||x===void 0)&&x.id&&(P.$feature_flag_id=E.metadata.id),M(E?.original_variant)&&M(E?.original_enabled)||(P.$feature_flag_original_response=M(E.original_variant)?E.original_enabled:E.original_variant),!(E==null||(k=E.metadata)===null||k===void 0)&&k.original_payload&&(P.$feature_flag_original_payload=E==null||(C=E.metadata)===null||C===void 0?void 0:C.original_payload),I.length&&(P.$feature_flag_error=I.join(",")),this._captureFeatureFlagCalled(P)}else c&&this._set({[Li]:d,[Bn]:c});return s?{key:e,enabled:!!n,variant:typeof n=="string"?n:void 0,payload:sh(r)}:void 0}_captureFeatureFlagCalled(e){try{var t;(t=this._client)===null||t===void 0||t.capture("$feature_flag_called",e)}catch(i){this._logger.error("Failed to capture feature flag call",i)}}getRemoteConfigPayload(e,t){this._getRemoteConfigPayload(e,t)}_getRemoteConfigPayload(e,t){var i=this;return Ce(function*(){let s=i._client;if(!s)return;let n={distinct_id:s.distinctId,token:s.projectToken,person_properties:{$lib:s.library.name,$lib_version:s.library.version}},r=i._getValidEvaluationEnvironments();r.length&&(n.evaluation_contexts=r);let o=i._getValidFlagKeys(),a;M(o)||(n.flag_keys=o);try{var l;let c=(l=(yield s.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:n,compression:i._config.compression,sentAt:"body",timeoutMs:i._config.requestTimeoutMs})).json)===null||l===void 0?void 0:l.featureFlagPayloads;a=c?.[e]||void 0}catch(c){return void i._logger.error("Remote config feature flag request failed",c)}try{t(a)}catch(c){i._logger.error("Remote config feature flag callback failed",c)}})()}isFeatureEnabled(e,t={}){if(t.fresh&&!this._flagsLoadedFromRemote)return t.defaultValue;if(!(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0))return this._logger.warn('isFeatureEnabled for key "'+e+ac),t.defaultValue;let i=this.getFeatureFlag(e,t);return M(i)?t.defaultValue:!!i}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t,i){this._receivedFeatureFlags(e,t,i)}_receivedFeatureFlags(e,t,i){if(!this._client)return;this._hasLoadedFlags=!0;let s=((n,r={},o={},a={},l,c=_g)=>
110{let d=((y,w)=>{let S=y.flags;if(S){let x=Object.fromEntries(Object.keys(S).map(C=>{var E;return[C,(E=S[C].variant)!==null&&E!==void 0?E:S[C].enabled]})),k=Object.fromEntries(Object.keys(S).filter(C=>S[C].enabled).filter(C=>{var E;return!M((E=S[C].metadata)===null||E===void 0?void 0:E.payload)}).map(C=>{var E;return[C,(E=S[C].metadata)===null||E===void 0?void 0:E.payload]}));return b(b({},y),{},{featureFlags:x,featureFlagPayloads:k})}return y.featureFlags&&w.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),y})(n,c),h=d.flags,u=d.featureFlags,p=d.featureFlagPayloads;if(!u)return;let _=n.requestId,g=n.evaluatedAt;if(W(u)){c.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");let y={};if(u)for(let w=0;u.length>w;w++)y[u[w]]=!0;return{[gi]:u,[Gt]:y,[Kn]:!1}}let v=u,f=p,m=h;if(l?.partialResponse){let y=Object.keys(v),w=f||{};v=b(b({},r),v),f=b(b({},o),w),y.forEach(S=>{S in w||f==null||delete f[S]}),m=b(b({},a),m)}else if(n.errorsWhileComputingFlags)if(h){let y=new Set(Object.keys(h).filter(S=>{var x;return!(!((x=h[S])===null||x===void 0)&&x.failed)}));v=b(b({},r),Object.fromEntries(Object.entries(v).filter(([S])=>y.has(S))));let w=Object.fromEntries(Object.entries(f||{}).filter(([S])=>y.has(S)));f=b(b({},o),w),y.forEach(S=>{S in w||f==null||delete f[S]}),m=b(b({},a),Object.fromEntries(Object.entries(m||{}).filter(([S])=>y.has(S))))}else v=b(b({},r),v),f=b(b({},o),f),m=b(b({},a),m);return b(b({[gi]:Object.keys(mg(v)),[Gt]:v||{},[Fi]:f||{},[ns]:m||{},[Kn]:n.minimalFlagCalledEvents===!0},_?{[rs]:_}:{}),g?{[Di]:g}:{})})(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),i,this._logger);if(s)if(i?.persist===!1){let n=!M(this._client.kv.get(Gt));this._bootstrapState=s,n||this._set(s)}else this._clearBootstrapState(),this._markCrossTabFeatureFlagSnapshot(s,e,!!i?.partialResponse),this._set(s);else t&&this._fallBackToPersistedFlags();t||(this._staleCacheRefreshTriggered=!1),this._fireFeatureFlagsCallbacks(t)}override(e,t=!1){this._logger.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){this._overrideFeatureFlags(e)}_overrideFeatureFlags(e){if(this._client){if(e===!1)return this._remove([Xt,Yi]),this._fireFeatureFlagsCallbacks(),void Ki.info("All overrides cleared");if(W(e))return this._set({[Xt]:vg(e)}),this._fireFeatureFlagsCallbacks(),void Ki.info("Flag overrides set",{flags:e});if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var t;let i=e;this._override_warning=!!((t=i.suppressWarning)!==null&&t!==void 0&&t);let s={},n=i.flags,r=i.payloads;return n&&(s[Xt]=W(n)?vg(n):n),r&&(s[Yi]=r),Object.keys(s).length&&this._set(s),n===!1&&r===!1?this._remove([Xt,Yi]):n===!1?this._remove(Xt):r===!1&&this._remove(Yi),this._fireFeatureFlagsCallbacks(),n===!1?Ki.info("Flag overrides cleared"):n&&Ki.info("Flag overrides set",{flags:n}),void(r===!1?Ki.info("Payload overrides cleared"):r&&Ki.info("Payload overrides set",{payloads:r}))}if(e&&typeof e=="object")return this._set({[Xt]:e}),this._fireFeatureFlagsCallbacks(),void Ki.info("Flag overrides set",{flags:e});this._logger.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}else this._logger.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this._hasLoadedFlags){let{flags:t,flagVariants:i}=this._prepareFeatureFlagsForCallbacks();try{e(t,i)}catch(s){this._logger.error("Error while running feature flags callback",s)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var s;let n=(this._prop("$early_access_features")||[]).find(c=>c.flagKey===e),r={[`$feature_enrollment/${e}`]:t},o={$feature_flag:e,$feature_enrollment:t,$set:r};n&&(o.$early_access_feature_name=n.name),i&&(o.$feature_enrollment_stage=i);let a=b(b({},this.getFlagVariants()),{},{[e]:t});(s=this._instance)===null||s===void 0||(s=s.persistence)===null||s===void 0||s.markCrossTabFeatureFlagChanges({$active_feature_flags:[e],$enabled_feature_flags:[e],$stored_person_properties:Object.keys(r)}),this._set({[gi]:Object.keys(mg(a)),[Gt]:a,[Qt]:b(b({},this._prop("$stored_person_properties")||{}),r)}),this._fireFeatureFlagsCallbacks();try{var l;(l=this._client)===null||l===void 0||l.capture("$feature_enrollment_update",o)}catch(c){this._logger.error("Failed to capture early access feature enrollment",c)}}getEarlyAccessFeatures(e,t=!1,i){let s=this._prop(yc);!s||t?this._getEarlyAccessFeatures(e,i):e(s)}_getEarlyAccessFeatures(e,t){var i=this;return Ce(function*(){let s=i._client;if(!s)return;let n=t?`&${t.map(o=>`stage=${o}`).join("&")}`:"",r;try{let o=yield s.sendRequest(`/api/early_access_features/?token=${s.projectToken}${n}`,{target:"api",method:"GET",sentAt:"query"});if(!o.json)return;r=o.json.earlyAccessFeatures,i._set({[yc]:r})}catch(o){return void i._logger.error("Early access feature request failed",o)}try{e(r)}catch(o){i._logger.error("Early access feature callback failed",o)}})()}_prepareFeatureFlagsForCallbacks(){let e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(i=>t[i]),flagVariants:Object.keys(t).filter(i=>t[i]).reduce((i,s)=>(i[s]=t[s],i),{})}}_fireFeatureFlagsCallbacks(e){this._rebuildEventProperties();let{flags:t,flagVariants:i}=this._prepareFeatureFlagsForCallbacks();
110this.featureFlagEventHandlers.forEach(s=>{try{s(t,i,{errorsLoading:e})}catch(n){this._logger.error("Error while running feature flags callback",n)}})}setPersonPropertiesForFlags(e,t=!0){this._setPersonPropertiesForFlags(e,t)}_setPersonPropertiesForFlags(e,t=!0){let i=this._prop("$stored_person_properties")||{},s=e?.$set||(e?.$set_once?{}:e),n=e?.$set_once,r={};if(n)for(let o in n)({}).hasOwnProperty.call(n,o)&&(o in i||(r[o]=n[o]));this._set({[Qt]:b(b(b({},i),r),s)}),t&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t=!0){let i=b({},this._prop("$stored_person_properties")||{});e.forEach(s=>{delete i[s]}),this._set({[Qt]:i}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e=!0){this._remove(Qt),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t=!0){let i=this._prop("$stored_group_properties")||{},s=b({},i);for(let n of Object.keys(e))s[n]=b(b({},i[n]),e[n]);this._set({[Ai]:s}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){let t=this._prop("$stored_group_properties")||{};this._set({[Ai]:b(b({},t),{},{[e]:{}})})}else this._remove(Ai)}reset(){this._requestGeneration++,this._additionalReloadRequested=!1,this._baseEventProperties={},this._eventPropertiesWithFlagValues={},this._bootstrapState=void 0,this._hasLoadedFlags=!1,this._reloadingDisabled=!1,this._flagsLoadedFromRemote=!1,this.$anon_distinct_id=void 0,this._clearDebouncer(),this._override_warning=!1,this._consecutiveStatusZeroFailures=0}}},Kk={sessionRecording:class{get _config(){return this._instance.config}get _persistence(){return this._instance.persistence}get started(){var e;return!!(!((e=this._lazyLoadedSessionRecording)===null||e===void 0)&&e.isStarted)}get status(){var e,t;return this._recordingStatus==="awaiting_config"||this._recordingStatus==="missing_config"?this._recordingStatus:(e=(t=this._lazyLoadedSessionRecording)===null||t===void 0?void 0:t.status)!==null&&e!==void 0?e:this._recordingStatus}constructor(e){if(this._instance=e,this._forceAllowLocalhostNetworkCapture=!1,this._recordingStatus=Kt,this._persistFlagsOnSessionListener=void 0,this._sessionRecordingDisposed=!1,this._documentWasEverVisible=(()=>{var t,i;if(!F?.visibilityState||F.visibilityState==="visible")return!0;let s=T==null||(t=T.performance)===null||t===void 0||(i=t.getEntriesByType)===null||i===void 0?void 0:i.call(t,"visibility-state");return!s?.length||s.some(n=>n.name==="visible")})(),this._onVisibilityChange=()=>{var t,i;F?.visibilityState==="visible"&&(this._documentWasEverVisible=!0,(t=this._lazyLoadedSessionRecording)===null||t===void 0||(i=t.setDocumentWasEverVisible)===null||i===void 0||i.call(t,!0))},!this._instance.sessionManager)throw di.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if(this._config.cookieless_mode==="always")throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');F?.addEventListener&&Z(F,"visibilitychange",this._onVisibilityChange)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:e=!1}={}){var t;this._sessionRecordingDisposed=!0,F==null||(t=F.removeEventListener)===null||t===void 0||t.call(F,"visibilitychange",this._onVisibilityChange),e?this._discardRecording(!0):this.stopRecording()}get _isRecordingEnabled(){var e;let t=!!(!((e=this._instance.get_property("$session_recording_remote_config"))===null||e===void 0)&&e.enabled),i=!this._config.disable_session_recording,s=this._config.disable_session_recording||this._instance.consent.isOptedOut();return T&&t&&i&&!s}startIfEnabledOrStop(e){var t;if(this._sessionRecordingDisposed||this._isRecordingEnabled&&(!((t=this._lazyLoadedSessionRecording)===null||t===void 0)&&t.isStarted))return;let i=!M(Object.assign)&&!M(Array.from);this._isRecordingEnabled&&i?(this._lazyLoadAndStart(e),di.info("starting")):(this._recordingStatus=Kt,this.stopRecording())}_lazyLoadAndStart(e){var t,i;if(this._isRecordingEnabled)if(this._recordingStatus!=="awaiting_config"&&this._recordingStatus!=="missing_config"&&(this._recordingStatus=xh),(R==null||(t=R.__PosthogExtensions__)===null||t===void 0||(t=t.rrweb)===null||t===void 0?void 0:t.record)&&((i=R.__PosthogExtensions__)===null||i===void 0?void 0:i.initSessionRecording))this._onScriptLoaded(e);else{var s,n;let r=this._instance.sessionManager;(s=R.__PosthogExtensions__)===null||s===void 0||(n=s.loadExternalDependency)===null||n===void 0||n.call(s,this._instance,this._scriptName,o=>{if(!this._sessionRecordingDisposed&&this._isRecordingEnabled&&this._instance.sessionManager===r)return o?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),di.error("could not load recorder",o)):void this._onScriptLoaded(e);this._recordingStatus="disabled"})}}stopRecording(){var e,t;(e=this._persistFlagsOnSessionListener)===null||e===void 0||e.call(this),this._persistFlagsOnSessionListener=void 0,(t=this._lazyLoadedSessionRecording)===null||t===void 0||t.stop()}_discardRecording(e=!1){var t,i;(t=this._persistFlagsOnSessionListener)===null||t===void 0||t.call(this),this._persistFlagsOnSessionListener=void 0,(i=this._lazyLoadedSessionRecording)===null||i===void 0||i.discard({discardProducerEvents:e})}_resetSampling(){var e,t;(e=this._persistence)===null||e===void 0||e.unregister("$session_is_sampled"),(t=this._persistence)===null||t===void 0||t.unregister("$replay_sample_rate")}_validateSampleRate(e,t){if(Y(e))return null;let i=ne(e)?e:parseFloat(e);return typeof(s=i)!="number"||!Number.isFinite(s)||0>s||s>1?(di.warn(`${t} must be between 0 and 1. Ignoring invalid value:`,e),null):i;var s}_persistRemoteConfig(e){if(this._persistence){var t,i;let s=this._persistence,n=()=>{var r;let o=e.sessionRecording===!1?void 0:e.sessionRecording,a=this._val
110idateSampleRate((r=this._config.session_recording)===null||r===void 0?void 0:r.sampleRate,"session_recording.sampleRate"),l=this._validateSampleRate(o?.sampleRate,"remote config sampleRate"),c=a??l;Y(c)&&this._resetSampling();let d=o?.minimumDurationMilliseconds;s.register({[js]:b(b({cache_timestamp:Date.now(),enabled:!!o},o),{},{networkPayloadCapture:b({capturePerformance:e.capturePerformance},o?.networkPayloadCapture),canvasRecording:{enabled:o?.recordCanvas,fps:o?.canvasFps,quality:o?.canvasQuality},sampleRate:c,minimumDurationMilliseconds:M(d)?null:d,endpoint:o?.endpoint,triggerMatchType:o?.triggerMatchType,masking:o?.masking,urlTriggers:o?.urlTriggers,version:o?.version,triggerGroups:o?.triggerGroups})})};n(),(t=this._persistFlagsOnSessionListener)===null||t===void 0||t.call(this),this._persistFlagsOnSessionListener=(i=this._instance.sessionManager)===null||i===void 0?void 0:i.onSessionId(n)}}onRemoteConfig(e){let t=e.ok?e.config:void 0;return t&&"sessionRecording"in t?t.sessionRecording===!1?(this._persistRemoteConfig(t),void this._discardRecording()):(this._persistRemoteConfig(t),void this.startIfEnabledOrStop()):(this._recordingStatus==="awaiting_config"&&(this._recordingStatus="missing_config",this._instance.register_for_session({[Lu]:!0}),di.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t="log"){var i;!((i=this._lazyLoadedSessionRecording)===null||i===void 0)&&i.log?this._lazyLoadedSessionRecording.log(e,t):di.warn("log called before recorder was ready")}get _scriptName(){var e,t;let i=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.get_property(js);return(i==null||(t=i.scriptConfig)===null||t===void 0?void 0:t.script)||"lazy-recorder"}_isRemoteConfigFresh(){let e=this._instance.get_property(js);if(!e)return!1;let t;try{t=typeof e=="object"?e:JSON.parse(e)}catch(i){return di.warn("persisted remote config for session recording is invalid and will be ignored",i),!1}return!Y(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}_onScriptLoaded(e){var t,i,s;if(!this._sessionRecordingDisposed&&this._isRecordingEnabled&&this._instance.sessionManager){if(!(!((t=R.__PosthogExtensions__)===null||t===void 0)&&t.initSessionRecording))return di.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Au]:!0});var n;if(this._lazyLoadedSessionRecording||(this._lazyLoadedSessionRecording=(n=R.__PosthogExtensions__)===null||n===void 0?void 0:n.initSessionRecording(this._instance,this._documentWasEverVisible),this._lazyLoadedSessionRecording._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this._isRemoteConfigFresh())return this._recordingStatus==="missing_config"||this._recordingStatus==="awaiting_config"?void 0:(this._recordingStatus="awaiting_config",di.info("persisted remote config is stale, requesting fresh config before starting"),void new x0(this._instance).load());this._recordingStatus=xh,(i=(s=this._lazyLoadedSessionRecording).setDocumentWasEverVisible)===null||i===void 0||i.call(s,this._documentWasEverVisible),this._lazyLoadedSessionRecording.start(e)}else this._recordingStatus=Kt}onRRwebEmit(e){var t,i;(t=this._lazyLoadedSessionRecording)===null||t===void 0||(i=t.onRRwebEmit)===null||i===void 0||i.call(t,e)}overrideLinkedFlag(){var e,t;this._lazyLoadedSessionRecording||(t=this._persistence)===null||t===void 0||t.register({$replay_override_linked_flag:!0}),(e=this._lazyLoadedSessionRecording)===null||e===void 0||e.overrideLinkedFlag()}overrideSampling(){var e,t;this._lazyLoadedSessionRecording||(t=this._persistence)===null||t===void 0||t.register({$replay_override_sampling:!0}),(e=this._lazyLoadedSessionRecording)===null||e===void 0||e.overrideSampling()}overrideTrigger(e){var t,i;this._lazyLoadedSessionRecording||(i=this._persistence)===null||i===void 0||i.register({[e==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(t=this._lazyLoadedSessionRecording)===null||t===void 0||t.overrideTrigger(e)}get sdkDebugProperties(){var e;let t={};for(let s of Rk){var i;let n=(i=this._instance.sessionPersistence)===null||i===void 0?void 0:i.get_property(s);M(n)||(t[s]=n)}return b(b({}
110,t),((e=this._lazyLoadedSessionRecording)===null||e===void 0?void 0:e.sdkDebugProperties)||{$recording_status:this.status})}tryAddCustomEvent(e,t){var i;return!!(!((i=this._lazyLoadedSessionRecording)===null||i===void 0)&&i.tryAddCustomEvent(e,t))}flushBeforeIdentityReset(){var e,t;(e=this._lazyLoadedSessionRecording)===null||e===void 0||(t=e.flushBeforeIdentityReset)===null||t===void 0||t.call(e)}}},Jk={autocapture:class extends Ww{constructor(e){super(new Tk(e)),this.instance=e}},historyAutocapture:class{constructor(e){this._isFlushingPageview=!1,this._instance=e,this._lastLocation=this._getCurrentLocation()}initialize(){this.startIfEnabled()}get isEnabled(){let e=this._getCaptureOptions();return!!(e.path||e.search||this._shouldCaptureHashChanges(e))}startIfEnabled(){this.isEnabled&&(D.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this._lastLocation=this._getCurrentLocation(),this.startIfEnabled()}stop(){this._popstateListener&&this._popstateListener(),this._popstateListener=void 0,this._hashchangeListener&&this._hashchangeListener(),this._hashchangeListener=void 0,D.info("History API monitoring stopped")}monitorHistoryChanges(){T&&T.history&&(this._patchHistoryMethod("pushState"),this._patchHistoryMethod("replaceState"),this._setupPopstateListener(),this._shouldCaptureHashChanges()&&this._setupHashchangeListener())}_patchHistoryMethod(e){var t;if(!T||!((t=T.history[e])===null||t===void 0)&&t.__posthog_wrapped__)return;let i=this;ai(T.history,e,s=>function(n,r,o){var a;i._isUrlChanging(o)&&i._flushPendingPageview(),s.call(this,n,r,o),i._capturePageview(e,!i._isFlushingPageview&&(T==null||(a=T.event)===null||a===void 0?void 0:a.type)!=="popstate")})}_getCurrentLocation(){let e=T?.location;if(e?.pathname)return{pathname:e.pathname,search:e.search,hash:e.hash}}_getCaptureOptions(){let e=this._instance.config.capture_pageview;return e==="history_change"?{path:!0}:ee(e)?e:{}}_shouldCaptureHashChanges(e=this._getCaptureOptions()){return!!e.hash&&!this._instance.config.disable_capture_url_hashes}_hasLocationChanged(e){let t=this._getCaptureOptions(),i=this._lastLocation;return!(!i||!(t.path&&e.pathname!==i.pathname||t.search&&e.search!==i.search||this._shouldCaptureHashChanges(t)&&e.hash!==i.hash))}_capturePageview(e,t=!1){try{t||this._flushPendingPageview();let i=this._getCurrentLocation();if(!i)return;if(this._hasLocationChanged(i)){let s=()=>this._instance.capture(Hu,{navigation_type:e});t?(this._pendingPageview=s,Promise.resolve().then(()=>this._flushPendingPageview())):s()}this._lastLocation=i}catch(i){D.error(`Error capturing ${e} pageview`,i)}}_isUrlChanging(e){var t,i;return!(Y(e)||!T)&&((t=Jt(String(e)))===null||t===void 0?void 0:t.href)!==((i=T.location)===null||i===void 0?void 0:i.href)}_flushPendingPageview(){let e=this._pendingPageview;if(e){this._pendingPageview=void 0,this._isFlushingPageview=!0;try{e()}catch(t){D.error("Error capturing deferred pageview",t)}finally{this._isFlushingPageview=!1}this._lastLocation=this._getCurrentLocation()}}_setupPopstateListener(){if(this._popstateListener)return;let e=()=>{this._capturePageview("popstate")};Z(T,"popstate",e),this._popstateListener=()=>{T&&T.removeEventListener("popstate",e)}}_setupHashchangeListener(){if(this._hashchangeListener)return;let e=()=>{this._capturePageview("hashchange")};Z(T,"hashchange",e),this._hashchangeListener=()=>{T&&T.removeEventListener("hashchange",e)}}},heatmaps:class{get _config(){return this.instance.config}constructor(e){var t;this._enabledServerSide=!1,this._initialized=!1,this._flushInterval=null,this.instance=e,this._enabledServerSide=!!(!((t=this.instance.persistence)===null||t===void 0)&&t.props[uc]),this.rageclicks=new b0(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let e=5e3;return ee(this._config.capture_heatmaps)&&this._config.capture_heatmaps.flush_interval_milliseconds&&(e=this._config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return Y(this._config.capture_heatmaps)?Y(this._config.enable_heatmaps)?this._enabledServerSide:this._config.enable_heatmaps:this._config.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this._initialized)return;Fk.info("starting..."),this._setupListeners(),this._onVisibilityChange()}else{var e;clearInterval((e=this._flushInterval)!==null&&e!==void 0?e:void 0),this._removeListeners(),this.getAndClearBuffer()}}onRemoteConfig(e){if(!e.ok)return;let t=e.config;if(!("heatmaps"in t))return;let i=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[uc]:i}),this._enabledServerSide=i,this.startIfEnabled()}getAndClearBuffer(){let e=this._buffer;return this._buffer=void 0,e}_onDeadClick(e){rc(e.originalEvent)&&this._onClick(e.originalEvent,"deadclick")}_onVisibilityChange(){this._flushInterval&&clearInterval(this._flushInterval),this._flushInterval=F?.visibilityState==="visible"?setInterval(this._flush.bind(this),this.flushIntervalMilliseconds):null}_setupListeners(){T&&F&&(this._flushHandler=this._flush.bind(this),Z(T,Jo,this._flushHandler),this._onClickHandler=e=>this._onClick(e||T?.event),Z(F,"click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler=e=>this._onMouseMove(e||T?.event),Z(F,"mousemove",this._onMouseMoveHandler,{capture:!0}),this._deadClicksCapture=new U_(this.instance,Gw,this._onDeadClick.bind(this)),this._deadClicksCapture.startIfEnabledOrStop(),this._onVisibilityChange_handler=this._onVisibilityChange.bind(this),Z(F,wr,this._onVisibilityChange_handler),this._initialized=!0)}_removeListeners(){var e;T&&F&&(this._flushHandler&&T.removeEventListener(Jo,this._flushHandler),this._onClickHandler&&F.removeEventListener("click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler&&F.removeEventListener("mousemove",this._onMouseMoveHandler,{capture:!0}),this._onVisibilityChange_handler&&F.removeEventListener(wr,this._onVisibilityChange_handler),clearTimeout(this._mouseMoveTimeout),(e=this._deadClicksCapture)===null||e===void 0||e.stop(),this._initialized=!1)}_getProperties(e,t){let i=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),r=(function(o,a,l){let c=o;for(;c&&_t(c)&&!ot(c,"body");){if(c===l)return!1;let p;try{var d,h,u;p=(d=(h=(u=c.ownerDocument)===null||u===void 0?void 0:u.defaultView)!==null&&h!==void 0?h:T)===null||d===void 0?void 0:d.getComputedStyle(c).position}catch{return!1}if(ie(a,p))return!0;c=tv(c)}return!1})(Ni(e),["fixed","sticky"],n);return{x:e.clientX+(r?0:s),y:e.clientY+(r?0:i),target_fixed:r,type:t}}_onClick(e,t="click"){var i;if(Fc(e.target)||!rc(e))return;let s=this._getProperties(e,t);!((i=this.rageclicks)===null||i===void 0)&&i.isRageClick(e.clientX,e.clientY,new Date().getTime())&&sv(Ni(e),this.instance.config.rageclick)&&this._capture(b(b({},s),{},{type:"rageclick"})),this._capture(s)}_onMouseMove(e){!Fc(e.target)&&rc(e)&&(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout(()=>{this._capture(this._getProperties(e,"mousemove"))},500))}_capture(e){if(!T)return;let t=this._config.disable_capture_url_hashes?ni(T.location.href):T.location.href,i=this._config.custom_personal_data_properties,s=this._config.mask_personal_data_properties?[...hs,...i||[]]:[],n=en(t,s,on);this._buffer=this._buffer||{},this._buffer[n]||(this._buffer[n]=[]),this._buffer[n].push(e)}_flush(){this._buffer&&!Ct(this._buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:U_,webVitalsAutocapture:class{constructor(e){var t;this._instance=e,this._enabledServerSide=!1,this._initialized=!1,this._buffer={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this._flushToCapture=()=>{clearTimeout(this._delayedFlushTimer),this._delayedFlushTimer=void 0,this._buffer.metrics.length!==0&&(this._instance.capture("$web_vitals",b({$current_url:this._buffer.url},this._buffer.metrics.reduce((i,s)=>b(b({},i),{},{[`$web_vitals_${s.name}_event`]:b({},s),[`$web_vitals_${s.name}_value`]:s.value}),{}))),this._buffer={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this._addToBuffer=i=>{var s;if(this._buffer=this._buffer||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},Y(i?.name)||Y(i?.value))return void Qi.error("Invalid metric received",i);
110let n=typeof i.navigationURL=="string"?i.navigationURL:void 0,r=this._maskedURL(n);if(M(r))return;let o=ne(i.navigationId)||typeof i.navigationId=="string"?`navigation:${i.navigationId}`:`url:${r}`;if(this._maxAllowedValue&&i.value>=this._maxAllowedValue)return void Qi.error("Ignoring metric with value >= "+this._maxAllowedValue,i);this._buffer.navigationKey!==o&&(this._flushToCapture(),this._delayedFlushTimer=setTimeout(this._flushToCapture,this.flushToCaptureTimeoutMs)),M(this._buffer.navigationKey)&&(this._buffer.navigationKey=o,this._buffer.url=r),this._buffer.firstMetricTimestamp=M(this._buffer.firstMetricTimestamp)?Date.now():this._buffer.firstMetricTimestamp;let a=(s=this._instance.sessionManager)===null||s===void 0?void 0:s.checkAndGetSessionAndWindowId(!0),l=b(b(b({},i),n?{navigationURL:r}:{}),{},{$current_url:r,timestamp:Date.now()});if(delete l.entries,ee(i.attribution)&&this.attributionMetrics.indexOf(i.name)>-1){let c={};for(let d of Pk){let h=d==="url"&&typeof i.attribution[d]=="string"?this._maskedURL(i.attribution[d]):i.attribution[d];M(h)||(c[d]=h)}l.attribution=c}else delete l.attribution;M(a)||(l.$session_id=a.sessionId,l.$window_id=a.windowId),this._buffer.metrics.push(l),this._buffer.metrics.length===this.allowedMetrics.length&&this._flushToCapture()},this._startCapturing=()=>{if(this._initialized)return;let i,s,n,r,o=!1,a=R.__PosthogExtensions__,l=a?.postHogWebVitalsCallbacksByFlavor,c=l?.[this._callbackFlavor]||(this._callbackFlavor==="web-vitals"&&M(l)?a?.postHogWebVitalsCallbacks:void 0);if(!M(c)){let u=c.withoutAttribution,p=this.attributionMetrics;o=!M(u),i=p.indexOf("LCP")>-1?c.onLCP:u?.onLCP||c.onLCP,s=p.indexOf("CLS")>-1?c.onCLS:u?.onCLS||c.onCLS,n=p.indexOf("FCP")>-1?c.onFCP:u?.onFCP||c.onFCP,r=p.indexOf("INP")>-1?c.onINP:u?.onINP||c.onINP}if(!(i&&s&&n&&r))return void Qi.error("web vitals callbacks not loaded - not starting");let d={reportSoftNavs:this.useSoftNavs},h=o&&this.attributionMetrics.indexOf("INP")>-1?b(b({},d),{},{includeProcessedEventEntries:!1}):d;this.allowedMetrics.indexOf("LCP")>-1&&i(this._addToBuffer.bind(this),d),this.allowedMetrics.indexOf("CLS")>-1&&s(this._addToBuffer.bind(this),d),this.allowedMetrics.indexOf("FCP")>-1&&n(this._addToBuffer.bind(this),d),this.allowedMetrics.indexOf("INP")>-1&&r(this._addToBuffer.bind(this),h),this._initialized=!0},this._enabledServerSide=!!(!((t=this._instance.persistence)===null||t===void 0)&&t.props[pc]),this.startIfEnabled()}get _perfConfig(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t;let i=ee(this._perfConfig)?(e=this._perfConfig)===null||e===void 0?void 0:e.web_vitals_allowed_metrics:void 0;return Y(i)?((t=this._instance.persistence)===null||t===void 0?void 0:t.props.$web_vitals_allowed_metrics)||lg:i}get flushToCaptureTimeoutMs(){return(ee(this._perfConfig)?this._perfConfig.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){let e=ee(this._perfConfig)?this._perfConfig.web_vitals_attribution:void 0;return Ae(e)?e?lg:[]:W(e)?e:Mk}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){let e=ee(this._perfConfig)?this._perfConfig.__preview_web_vitals_soft_navs:void 0;return e!=null&&e}get _maxAllowedValue(){let e=ee(this._perfConfig)&&ne(this._perfConfig.__web_vitals_max_value)?this._perfConfig.__web_vitals_max_value:ag;return e>0&&6e4>=e?ag:e}get isEnabled(){let e=Ne?.protocol;if(e!=="http:"&&e!=="https:")return Qi.info("Web Vitals are disabled on non-http/https protocols"),!1;let t=ee(this._perfConfig)?this._perfConfig.web_vitals:Ae(this._perfConfig)?this._perfConfig:void 0;return Ae(t)?t:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(Qi.info("enabled, starting..."),this._loadScript(this._startCapturing))}onRemoteConfig(e){if(!e.ok)return;let t=e.config;if(!("capturePerformance"in t))return;let i=ee(t.capturePerformance)&&!!t.capturePerformance.web_vitals,s=ee(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[pc]:i}),this._instance.persistence.register({[Tg]:s})),this._enabledServerSide=i,this.startIfEnabled()}get _callbackFlavor(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}_loadScript(e){var t;let i=R.__PosthogExtensions__,s=this._callbackFlavor,n=i?.postHogWebVitalsCallbacksByFlavor;n?.[s]||s==="web-vitals"&&M(n)&&i?.postHogWebVitalsCallbacks?e():i==null||(t=i.loadExternalDependency)===null||t===void 0||t.call(i,this._instance,s,r=>{r?Qi.error("failed to load script",r):e()})}_maskedURL(e){let t=e||T?.location.href;if(!t)return void Qi.error("Could not determine current URL");let i=this._instance.config.disable_capture_url_hashes?ni(t):t,s=this._instance.config.custom_personal_data_properties,n=this._instance.config.mask_personal_data_properties?[...hs,...s||[]]:[];return en(i,n,on)}}},Yk={exceptionObserver:class{constructor(e){var t;this._startCapturing=()=>{var i;if(!T||!this.isEnabled||!(!((i=R.__PosthogExtensions__)===null||i===void 0)&&i.errorWrappingFunctions))return;let s=R.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,n=R.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=R.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this._unwrapOnError&&this._config.capture_unhandled_errors&&(this._unwrapOnError=s(this.captureException.bind(this))),!this._unwrapUnhandledRejection&&this._config.capture_unhandled_rejections&&(this._unwrapUnhandledRejection=n(this.captureException.bind(this))),!this._unwrapConsoleError&&this._config.capture_console_errors&&(this._unwrapConsoleError=r(this.captureException.bind(this)))}catch(o){Nn.error("failed to start",o),this._stopCapturing()}},this._instance=e,this._remoteEnabled=!!(!((t=this._instance.persistence)===null||t===void 0)&&t.props[dc]),this._rateLimiter=new Qg(b(b({},(function(i={}){var s,n,r,o;return{refillRate:(s=(n=i.exceptionRateLimiterRefillRate)!==null&&n!==void 0?n:i.__exceptionRateLimiterRefillRate)!==null&&s!==void 0?s:1,bucketSize:(r=(o=i.exceptionRateLimiterBucketSize)!==null&&o!==void 0?o:i.__exceptionRateLimiterBucketSize)!==null&&r!==void 0?r:10}})(this._instance.config.error_tracking)),{},{refillInterval:1e4,_logger:Nn})),this._config=this._requiredConfig(),this.startIfEnabledOrStop()}_requiredConfig(){let e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return ee(e)?t=b(b({},t),e):(M(e)?this._remoteEnabled:e)&&(t=b(b({},t),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this._config.capture_console_errors||this._config.capture_unhandled_errors||this._config.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Nn.info("enabled"),this._stopCapturing(),this._loadScript(this._startCapturing)):this._stopCapturing()}_loadScript(e){var t,i,s;!((t=R.__PosthogExtensions__)===null||t===void 0)&&t.errorWrappingFunctions?e():(i=R.__PosthogExtensions__)===null||i===void 0||(s=i.loadExternalDependency)===null||s===void 0||s.call(i,this._instance,"exception-autocapture",n=>{if(n)return Nn.error("failed to load script",n);e()})}_stopCapturing(){var e,t,i;(e=this._unwrapOnError)===null||e===void 0||e.call(this),this._unwrapOnError=void 0,(t=this._unwrapUnhandledRejection)===null||t===void 0||t.call(this),this._unwrapUnhandledRejection=void 0,(i=this._unwrapConsoleError)===null||i===void 0||i.call(this),this._unwrapConsoleError=void 0}onRemoteConfig(e){if(!e.ok)return;let t=e.config;"autocaptureExceptions"in t&&(this._remoteEnabled=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[dc]:this._remoteEnabled}),this._config=this._requiredConfig(),this.startIfEnabledOrStop())}onConfigChange(){this._config=this._requiredConfig()}captureException(e){try{var t,i,s;let n=(t=e==null||(i=e.$exception_list)===null||i===void 0||(i=i[0])===null||i===void 0?void 0:i.type)!==null&&t!==void 0?t:"Exception";if(this._rateLimiter.consumeRateLimit(n))return void Nn.info("Skipping exception capture because of client rate limiting.",{exception:n});(s=this._instance.exceptions)===null||s===void 0||s.sendExceptionEvent(e)}catch{}}},exceptions:class{constructor(e){var t,i;this._suppressionRules=[],this._errorPropertiesBuilder=Qm(),this._instance=e,this._suppressionRules=(t=(i=this._instance.persistence)===null||i===void 0?void 0:i.get_property("$error_tracking_suppression_rules"))!==null&&t!==void 0?t:[],this._exceptionStepsConfig=na(this._getExceptionStepsConfig()),this._exceptionStepsBuffer=new Yy(this._exceptionStepsConfig)}onConfigChange(){this._exceptionStepsConfig=na(this._getExceptionStepsConfig()),this._exceptionStepsBuffer.setConfig(this._exceptionStepsConfig)}onRemoteConfig(e){var t,i,s;if(!e.ok)return;let n=e.config;if(!("errorTracking"in n))return;let r=(t=(i=n.errorTracking)===null||i===void 0?void 0:i.suppressionRules)!==null&&t!==void 0?t:[],o=(s=n.errorTracking)===null||s===void 0?void 0:s.captureExtensionExceptions;this._suppressionRules=r,this._instance.persistence&&this._instance.persistence.register({[Eg]:this._suppressionRules,[hc]:o})}get _captureExtensionExceptions(){var e;let t=!!this._instance.get_property(hc),i=this._instance.config.error_tracking.captureExtensionExceptions;return(e=i??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this._errorPropertiesBuilder.buildFromUnknown(e,{syntheticException:t?.syntheticException,mechanism:{handled:t?.handled}})}addExceptionStep(e,t){if(this._exceptionStepsConfig.enabled)try{if(!oe(e)||e.trim().length===0)return void zt.warn("Ignoring exception step because message must be a non-empty string");let{sanitizedProperties:i,droppedKeys:s}=(function(n){if(!n)return{sanitizedProperties:{},droppedKeys:[]};let r=[];return{sanitizedProperties:Object.keys(n).reduce((o,a)=>Jy.has(a)?(r.push(a),o):(o[a]=n[a],o),{}),droppedKeys:r}})(this._coerceExceptionStepProperties(t));s.length>0&&zt.warn("Ignoring reserved exception step fields",{droppedKeys:s}
110),this._exceptionStepsBuffer.add(b({[ia]:e,[sa]:new Date().toISOString()},i))}catch(i){zt.error("Failed to add exception step. Ignoring breadcrumb.",i)}}sendExceptionEvent(e){try{let t=e.$exception_list;if(this._isExceptionList(t)){if(this._matchesSuppressionRule(t))return this._addDroppedExceptionStep("Exception dropped: matched a suppression rule"),void zt.info("Skipping exception capture because a suppression rule matched");if(!this._captureExtensionExceptions&&this._isExtensionException(t))return this._addDroppedExceptionStep("Exception dropped: thrown by a browser extension"),void zt.info("Skipping exception capture because it was thrown by an extension");if(!this._captureExtensionExceptions&&this._isInjectedBrowserScriptException(t))return this._addDroppedExceptionStep("Exception dropped: thrown by an injected browser script"),void zt.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this._isPostHogException(t))return this._addDroppedExceptionStep("Exception dropped: thrown by the PostHog SDK"),void zt.info("Skipping exception capture because it was thrown by the PostHog SDK")}let i=this._exceptionStepsConfig.enabled&&Y(e.$exception_steps)?this._addBufferedExceptionSteps(e):e,s=(function(){let n=globalThis._posthogReleaseId;return typeof n=="string"&&n.length>0?n:void 0})();s&&(i.$release_id=s);try{let n=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",_originatedFromCaptureException:!0});return n&&this._exceptionStepsBuffer.clear(),n}catch(n){return v_(n)||zt.error("Failed to capture exception event. Dropping this exception.",n),void this._exceptionStepsBuffer.clear()}}catch(t){return void(v_(t)||zt.error("Failed to process exception event. Ignoring this exception.",t))}}_addBufferedExceptionSteps(e){try{let t=this._exceptionStepsBuffer.getAttachable();return t.length===0?e:b(b({},e),{},{$exception_steps:t})}catch(t){return zt.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}_addDroppedExceptionStep(e){this._exceptionStepsConfig.enabled&&this._exceptionStepsBuffer.add({[ia]:e,[sa]:new Date().toISOString()})}_coerceExceptionStepProperties(e){return ee(e)?b({},e):{}}_getExceptionStepsConfig(){var e,t;return(e=(t=this._instance.config.error_tracking)===null||t===void 0?void 0:t.exception_steps)!==null&&e!==void 0?e:{}}_matchesSuppressionRule(e){if(e.length===0)return!1;try{let t=e.reduce((i,{type:s,value:n})=>(oe(s)&&s.length>0&&i.$exception_types.push(s),oe(n)&&n.length>0&&i.$exception_values.push(n),i),{$exception_types:[],$exception_values:[]});return this._suppressionRules.some(i=>{let s=i.values.map(n=>{let r=$r[n.operator],o=t[n.key];if(!r||!o)return!1;let a=W(n.value)?n.value:[n.value];return a.length>0&&r(a,o)});return i.type==="OR"?s.some(Boolean):s.every(Boolean)})}catch(t){return zt.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}_isExtensionException(e){let t=e.flatMap(s=>{var n,r;return(n=(r=s.stacktrace)===null||r===void 0?void 0:r.frames)!==null&&n!==void 0?n:[]}),i=t.filter(({filename:s})=>!!s&&Fw.some(n=>s.startsWith(n)));return i.length!==0&&(!i.every(({filename:s})=>!!s&&s.startsWith(_u))||e.some(({type:s,value:n})=>s==="NoResponse"||oe(n)&&Rw.some(({value:r,exact:o})=>o?n===r:n.includes(r)))&&!t.some(({in_app:s,filename:n})=>s&&!n?.startsWith(_u)))}_isInjectedBrowserScriptException(e){return e.some(({value:t})=>oe(t)&&Aw.some(i=>t.includes(i)))}_isPostHogException(e){if(e.length>0){var t,i,s,n;let r=(t=(i=e[0].stacktrace)===null||i===void 0?void 0:i.frames)!==null&&t!==void 0?t:[],o=r[r.length-1];return(s=o==null||(n=o.filename)===null||n===void 0?void 0:n.includes("posthog.com/static"))!==null&&s!==void 0&&s}return!1}_isExceptionList(e){return!Y(e)&&W(e)}}},Zk=b({productTours:class{get _persistence(){return this._instance.persistence}constructor(e){this._productTourManager=null,this._cachedTours=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!e.ok)return;let t=e.config;if("productTours"in t){var i,s;if(this._persistence&&this._persistence.register({[Tu]:!!t.productTours}),!oc(this._instance))return!this._productTourManager&&Y((i=this._persistence)===null||i===void 0?void 0:i.props.ph_product_tours)||Io.info("product tours disabled; stopping and clearing cached tours"),(s=this._productTourManager)===null||s===void 0||s.stop(),this._productTourManager=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this._productTourManager&&oc(this._instance)&&this._loadScript(()=>this._startProductTours())}_loadScript(e){var t,i,s;!((t=R.__PosthogExtensions__)===null||t===void 0)&&t.generateProductTours?e():(i=R.__PosthogExtensions__)===null||i===void 0||(s=i.loadExternalDependency)===null||s===void 0||s.call(i,this._instance,"product-tours",n=>{n?Io.error("Could not load product tours script",n):e()})}_startProductTours(){var e;!this._productTourManager&&(!((e=R.__PosthogExtensions__)===null||e===void 0)&&e.generateProductTours)&&(this._productTourManager=R.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t=!1){if(W(this._cachedTours)&&!t)return void e(this._cachedTours,{isLoaded:!0});let i=this._persistence;if(i){let s=i.props[bc];if(W(s)&&!t)return this._cachedTours=s,void e(s,{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:s=>{if(!oc(this._instance))return void e([],{isLoaded:!0});let n=s.statusCode;if(n!==200||!s.json){let o=`Product Tours API could not be loaded, status: ${n}`;return n===0?s.error||Io.warn(o):Io.error(o),void e([],{isLoaded:!1,error:o})}let r=W(s.json.product_tours)?s.json.product_tours:[];this._cachedTours=r,i&&i.register({[bc]:r}),e(r,{isLoaded:!0})}})}getActiveProductTours(e){Y(this._productTourManager)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this._productTourManager.getActiveProductTours(e)}showProductTour(e){var t;(t=this._productTourManager)===null||t===void 0||t.showTourById(e)}previewTour(e){this._productTourManager?this._productTourManager.previewTour(e):this._loadScript(()=>{var t;this._startProductTours(),(t=this._productTourManager)===null||t===void 0||t.previewTour(e)})}dismissProductTour(){var e;(e=this._productTourManager)===null||e===void 0||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this._productTourManager)===null||e===void 0||e.nextStep()}previousStep(){var e;(e=this._productTourManager)===null||e===void 0||e.previousStep()}clearCache(){var e;this._cachedTours=null,(e=this._persistence)===null||e===void 0||e.unregister("ph_product_tours")}resetTour(e){var t;(t=this._productTourManager)===null||t===void 0||t.resetTour(e)}resetAllTours(){var e;(e=this._productTourManager)===null||e===void 0||e.resetAllTours()}cancelPendingTour(e){var t;(t=this._productTourManager)===null||t===void 0||t.cancelPendingTour(e)}}},Za),Xk={siteApps:class{constructor(e){this._instance=e,this._siteAppElementPatchCount=0,this._bufferedInvocations=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}_eventCollector(e,t){if(!t)return;let i=this.globalsForEvent(t);this._bufferedInvocations.push(i),this._bufferedInvocations.length>1e3&&(this._bufferedInvocations=this._bufferedInvocations.slice(10))}get siteAppLoaders(){var e;return(e=R._POSTHOG_REMOTE_CONFIG)===null||e===void 0||(e=e[this._instance.config.token])===null||e===void 0?void 0:e.siteApps}initialize(){if(this.isEnabled){let e=this._instance._addCaptureHook(this._eventCollector.bind(this));this._stopBuffering=()=>{e(),this._bufferedInvocations=[],this._stopBuffering=void 0}}}globalsForEvent(e){var t,i,s,n,r,o,a;if(!e)throw new Error("Event payload is required");let l={},c=this._instance.get_property("$groups")||[],d=this._instance.get_property("$stored_group_properties")||{};for(let[p,_]of Object.entries(d))l[p]={id:c[p],type:p,properties:_};let{$set_once:h,$set:u}=e;return{event:b(b({}
110,ju(e,Ak)),{},{properties:b(b(b({},e.properties),u?{$set:b(b({},(t=(i=e.properties)===null||i===void 0?void 0:i.$set)!==null&&t!==void 0?t:{}),u)}:{}),h?{$set_once:b(b({},(s=(n=e.properties)===null||n===void 0?void 0:n.$set_once)!==null&&s!==void 0?s:{}),h)}:{}),elements_chain:(r=(o=e.properties)===null||o===void 0?void 0:o.$elements_chain)!==null&&r!==void 0?r:"",distinct_id:(a=e.properties)===null||a===void 0?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}_prepareElementForSiteApp(e){var t;let i=(t=e.tagName)===null||t===void 0?void 0:t.toLowerCase();return i==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||(Zt.error("prepare_external_dependency_stylesheet returned null"),null):i==="script"&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(e)||(Zt.error("prepare_external_dependency_script returned null"),null):e}_patchSiteAppElementInsertionMethods(){var e,t,i,s,n,r,o,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};let l=F?.defaultView,c=l==null||(e=l.Node)===null||e===void 0?void 0:e.prototype;if(!l||!c)return()=>{};if(this._siteAppElementPatchCount++,this._restoreSiteAppElementPatches)return this._releaseSiteAppElementPatches();let d=[],h=this,u=new WeakSet,p=(v,f,m)=>{if(!v?.[f])return;let y=v[f];v[f]=m(y),d.push(()=>{v[f]=y})},_=v=>{if(u.has(v))return v;let f=h._prepareElementForSiteApp(v);return f&&u.add(f),f},g=v=>v.map(f=>typeof f=="string"?f:_(f)).filter(f=>!ue(f));return p(c,"appendChild",v=>function(f){let m=_(f);return m?v.call(this,m):f}),p(c,"insertBefore",v=>function(f,m){let y=_(f);return y?v.call(this,y,m):f}),p(c,"replaceChild",v=>function(f,m){let y=_(f);return y?v.call(this,y,m):m}),[(t=l.Element)===null||t===void 0?void 0:t.prototype,(i=l.Document)===null||i===void 0?void 0:i.prototype,(s=l.DocumentFragment)===null||s===void 0?void 0:s.prototype].forEach(v=>{p(v,"append",f=>function(...m){return f.apply(this,g(m))}),p(v,"prepend",f=>function(...m){return f.apply(this,g(m))})}),[(n=l.Element)===null||n===void 0?void 0:n.prototype,(r=l.CharacterData)===null||r===void 0?void 0:r.prototype,(o=l.DocumentType)===null||o===void 0?void 0:o.prototype].forEach(v=>{p(v,"before",f=>function(...m){return f.apply(this,g(m))}),p(v,"after",f=>function(...m){return f.apply(this,g(m))}),p(v,"replaceWith",f=>function(...m){let y=g(m);return m.length&&!y.length?void 0:f.apply(this,y)})}),p((a=l.Element)===null||a===void 0?void 0:a.prototype,"insertAdjacentElement",v=>function(f,m){let y=_(m);return y?v.call(this,f,y):null}),this._restoreSiteAppElementPatches=()=>{d.forEach(v=>v()),this._restoreSiteAppElementPatches=void 0},this._releaseSiteAppElementPatches()}_releaseSiteAppElementPatches(){let e=!1;return()=>{var t;e||(e=!0,this._siteAppElementPatchCount--,this._siteAppElementPatchCount===0&&((t=this._restoreSiteAppElementPatches)===null||t===void 0||t.call(this)))}}_runWithPreparedSiteAppElements(e,t=!0){let i=this._patchSiteAppElementInsertionMethods();try{let s=e(i);return t&&i(),s}catch(s){throw i(),s}}setupSiteApp(e){let t=this.apps[e.id],i=()=>{var r;!t.errored&&this._bufferedInvocations.length&&(Zt.info(`Processing ${this._bufferedInvocations.length} events for site app with id ${e.id}`),this._bufferedInvocations.forEach(o=>this._runWithPreparedSiteAppElements(()=>{var a;return(a=t.processEvent)===null||a===void 0?void 0:a.call(t,o)})),t.processedBuffer=!0),Object.values(this.apps).every(o=>o.processedBuffer||o.errored)&&((r=this._stopBuffering)===null||r===void 0||r.call(this))},s=!1,n=r=>{t.errored=!r,t.loaded=!0,Zt.info(`Site app with id ${e.id} ${r?"loaded":"errored"}`),s&&i()};try{let{processEvent:r}=this._runWithPreparedSiteAppElements(o=>e.init({posthog:this._instance,callback(a){o(),n(a)}}),!1);r&&(t.processEvent=r),s=!0}catch(r){Zt.error(cg+e.id,r),n(!1)}if(s&&t.loaded)try{i()}catch(r){Zt.error(`Error while processing buffered events PostHog app with config id ${e.id}`,r),t.errored=!0}}_setupSiteApps(){let e=this.siteAppLoaders||[];for(let t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(let t of e)this.setupSiteApp(t)}_onCapturedEvent(e){if(Object.keys(this.apps).length===0)return;let t=this.globalsForEvent(e);for(let i of Object.values(this.apps))try{this._runWithPreparedSiteAppElements(()=>{var s;return(s=i.processEvent)===null||s===void 0?void 0:s.call(i,t)})}catch(s){Zt.error(`Error while processing event ${e.event} for site app ${i.id}`,s)}}onRemoteConfig(e){var t,i,s;if(!((t=this.siteAppLoaders)===null||t===void 0)&&t.length)return this.isEnabled?(this._setupSiteApps(),void this._instance.on("eventCaptured",a=>this._onCapturedEvent(a))):void Zt.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((i=this._stopBuffering)===null||i===void 0||i.call(this),!e.ok)return;let n=e.config;if(!((s=n.siteApps)===null||s===void 0)&&s.length)if(this.isEnabled)for(let{id:a,url:l}of n.siteApps){var r,o;R[`__$$ph_site_app_${a}`]=this._instance,(r=R.__PosthogExtensions__)===null||r===void 0||(o=r.loadSiteApp)===null||o===void 0||o.call(r,this._instance,l,c=>{if(c)return Zt.error(cg+a,c)})}else Zt.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},e1={tracingHeaders:class{constructor(e){this._instance=e,this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0,this._hostnamesForPatch=void 0,this._startCapturing=()=>{let t=this._syncHostnamesForPatch();var i,s;t?(M(this._restoreXHRPatch)&&(this._restoreXHRPatch=(i=R.__PosthogExtensions__)===null||i===void 0||(i=i.tracingHeadersPatchFns)===null||i===void 0?void 0:i._patchXHR(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),M(this._restoreFetchPatch)&&(this._restoreFetchPatch=(s=R.__PosthogExtensions__)===null||s===void 0||(s=s.tracingHeadersPatchFns)===null||s===void 0?void 0:s._patchFetch(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this._stopCapturing()}}initialize(){this.startIfEnabledOrStop()}_loadScript(e){var t,i,s;!((t=R.__PosthogExtensions__)===null||t===void 0)&&t.tracingHeadersPatchFns?e():(i=R.__PosthogExtensions__)===null||i===void 0||(s=i.loadExternalDependency)===null||s===void 0||s.call(i,this._instance,"tracing-headers",n=>{if(n)return Ik.error("failed to load script",n);e()})}_getConfiguredHostnames(){var e,t;return(e=(t=this._instance.config.tracing_headers)!==null&&t!==void 0?t:this._instance.config.addTracingHeaders)!==null&&e!==void 0?e:this._instance.config.__add_tracing_headers}_syncHostnamesForPatch(){let e=this._getConfiguredHostnames();return W(e)?(W(this._hostnamesForPatch)?this._hostnamesForPatch.splice(0,this._hostnamesForPatch.length,...e):this._hostnamesForPatch=[...e],e.length>0?this._hostnamesForPatch:void 0):(W(this._hostnamesForPatch)&&this._hostnamesForPatch.splice(0),this._hostnamesForPatch=e||void 0,this._hostnamesForPatch)}_stopCapturing(){var e,t;(e=this._restoreXHRPatch)===null||e===void 0||e.call(this),(t=this._restoreFetchPatch)===null||t===void 0||t.call(this),this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0}startIfEnabledOrStop(){this._syncHostnamesForPatch()?this._loadScript(this._startCapturing):this._stopCapturing()}}},t1=b({surveys:class extends Lk{constructor(e){var t;super(new Bk(e),(t=e,{get projectToken(){return t.config.token},kv:new Nk(t)})),this._instance=e}_sendSurveysRequest(e,t){let i=t.query?Wr(e,t.query):e;return new Promise(s=>{var n;this._instance._send_request({method:t.method,url:this._instance.requestRouter.endpointFor((n=t.target)!==null&&n!==void 0?n:"api",i),data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,timestampMode:t.sentAt,callback:s})})}}},Za),i1={toolbar:class{constructor(e){this.instance=e}_setToolbarState(e){R.ph_toolbar_state=e}_getToolbarState(){var e;return(e=R.ph_toolbar_state)!==null&&e!==void 0?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e=void 0,t=void 0,i=void 0){var s,n;if(Rc(this.instance.config)||!T||!F)return!1;e=(s=e)!==null&&s!==void 0?s:T.location,i=(n=i)!==null&&n!==void 0?n:T.history;try{if(!t){try{T.localStorage.setItem("test","test"),T.localStorage.removeItem("test")}catch{return!1}t=T?.localStorage}let r=qk||oa(e.hash,"__posthog")||oa(e.hash,"state"),o,a=r?ta(()=>JSON.parse(atob(decodeURIComponent(r))))||ta(()=>JSON.parse(decodeURIComponent(r))):null;return a&&a.action==="ph_authorize"?(o=a,o.source="url",o&&Object.keys(o).length>0&&(a.desiredHash?e.hash=a.desiredHash:i?i.replaceState(i.state,"",e.pathname+e.search):e.hash="")):(o=JSON.parse(t.getItem(dg)||"{}"),o.source="localstorage",delete o.userIntent),!(!o.token||this.instance.config.token!==o.token||(this.loadToolbar(o),0))}catch{return!1}}_callLoadToolbar(e){let t=R.ph_load_toolbar||R.ph_load_editor;!Y(t)&&_e(t)?t(e,this.instance):hg.warn("No toolbar load function found")}loadToolbar(e){let t=!!F?.getElementById("__POSTHOG_TOOLBAR__");
110if(!T||t)return!1;let i=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,s=b(b({token:this.instance.config.token},e),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},i?{instrument:!1}:{});if(T.localStorage.setItem(dg,JSON.stringify(b(b({},s),{},{source:void 0}))),this._getToolbarState()===2)this._callLoadToolbar(s);else if(this._getToolbarState()===0){var n,r;this._setToolbarState(1),(n=R.__PosthogExtensions__)===null||n===void 0||(r=n.loadExternalDependency)===null||r===void 0||r.call(n,this.instance,"toolbar",o=>{if(o)return hg.error("[Toolbar] Failed to load",o),void this._setToolbarState(0);this._setToolbarState(2),this._callLoadToolbar(s)}),Z(T,"turbolinks:load",()=>{this._setToolbarState(0),this.loadToolbar(s)})}return!0}_loadEditor(e){return this.loadToolbar(e)}maybeLoadEditor(e=void 0,t=void 0,i=void 0){return this.maybeLoadToolbar(e,t,i)}}},s1=b({experiments:class yt{get _config(){return this._instance.config}constructor(t){this._instance=t,this.getWebExperimentsAndEvaluateDisplayLogic=(i=!1)=>{this.getWebExperiments(s=>{yt._logInfo("retrieved web experiments from the server"),this._flagToExperiments=new Map,s.forEac
110h(n=>{if(n.feature_flag_key){var r;this._flagToExperiments&&(yt._logInfo("setting flag key ",n.feature_flag_key," to web experiment ",n),(r=this._flagToExperiments)===null||r===void 0||r.set(n.feature_flag_key,n));let o=this._instance.getFeatureFlag(n.feature_flag_key);oe(o)&&n.variants[o]&&this._applyTransforms(n.name,o,n.variants[o].transforms)}else if(n.variants)for(let o in n.variants){let a=n.variants[o];yt._matchesTestVariant(a,this._instance)&&this._applyTransforms(n.name,o,a.transforms)}})},i)},this._instance.onFeatureFlags(i=>{this.onFeatureFlags(i)})}initialize(){}onFeatureFlags(t){if(this._is_bot())yt._logInfo(yg);else if(!this._config.disable_web_experiments){if(Y(this._flagToExperiments))return this._flagToExperiments=new Map,this.loadIfEnabled(),void this.previewWebExperiment();yt._logInfo("applying feature flags",t),t.forEach(i=>{var s;if(this._flagToExperiments&&(!((s=this._flagToExperiments)===null||s===void 0)&&s.has(i))){var n;let r=this._instance.getFeatureFlag(i),o=(n=this._flagToExperiments)===null||n===void 0?void 0:n.get(i);r&&o?.variants[r]&&this._applyTransforms(o.name,r,o.variants[r].transforms)}})}}previewWebExperiment(){let t=yt.getWindowLocation();if(t?.search){let i=Xs(t?.search,"__experiment_id"),s=Xs(t?.search,"__experiment_variant");i&&s&&(yt._logInfo(`previewing web experiments ${i} && ${s}`),this.getWebExperiments(n=>{this._showPreviewWebExperiment(parseInt(i),s,n)},!1,!0))}}loadIfEnabled(){this._config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,i,s){if(this._config.disable_web_experiments&&!s)return t([]);let n=this._instance.get_property("$web_experiments");if(n&&!i)return t(n);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/web_experiments/?token=${this._config.token}`),method:"GET",timestampMode:"query",callback:r=>t(r.statusCode===200&&r.json&&r.json.experiments||[])})}_showPreviewWebExperiment(t,i,s){let n=s.filter(r=>r.id===t);n&&n.length>0&&(yt._logInfo(`Previewing web experiment [${n[0].name}] with variant [${i}]`),this._applyTransforms(n[0].name,i,n[0].variants[i].transforms))}static _matchesTestVariant(t,i){return!Y(t.conditions)&&yt._matchUrlConditions(t,i)&&yt._matchUTMConditions(t)}static _matchUrlConditions(t,i){var s;if(Y(t.conditions)||Y((s=t.conditions)===null||s===void 0?void 0:s.url))return!0;let n=yt.getWindowLocation();if(n){var r,o,a;let l=Zf(i,n.href);return!(!((r=t.conditions)===null||r===void 0)&&r.url)||Wk[(o=(a=t.conditions)===null||a===void 0?void 0:a.urlMatchType)!==null&&o!==void 0?o:"icontains"](t.conditions.url,l)}return!1}
110static getWindowLocation(){return T?.location}static _matchUTMConditions(t){var i;if(Y(t.conditions)||Y((i=t.conditions)===null||i===void 0?void 0:i.utm))return!0;let s=xv();if(s.utm_source){var n,r,o,a,l,c,d,h;let u=!(!((n=t.conditions)===null||n===void 0||(n=n.utm)===null||n===void 0)&&n.utm_campaign)||((r=t.conditions)===null||r===void 0||(r=r.utm)===null||r===void 0?void 0:r.utm_campaign)==s.utm_campaign,p=!(!((o=t.conditions)===null||o===void 0||(o=o.utm)===null||o===void 0)&&o.utm_source)||((a=t.conditions)===null||a===void 0||(a=a.utm)===null||a===void 0?void 0:a.utm_source)==s.utm_source,_=!(!((l=t.conditions)===null||l===void 0||(l=l.utm)===null||l===void 0)&&l.utm_medium)||((c=t.conditions)===null||c===void 0||(c=c.utm)===null||c===void 0?void 0:c.utm_medium)==s.utm_medium,g=!(!((d=t.conditions)===null||d===void 0||(d=d.utm)===null||d===void 0)&&d.utm_term)||((h=t.conditions)===null||h===void 0||(h=h.utm)===null||h===void 0?void 0:h.utm_term)==s.utm_term;return u&&_&&g&&p}return!1}static _logInfo(t,...i){D.info(`[WebExperiments] ${t}`,i)}_applyTransforms(t,i,s){this._is_bot()?yt._logInfo(yg):i!=="control"?s.forEach(n=>{if(n.selector){var r;yt._logInfo(`applying transform of variant ${i} for experiment ${t} `,n);let o=(r=document)===null||r===void 0?void 0:r.querySelectorAll(n.selector);o?.forEach(a=>{let l=a;n.html&&(l.innerHTML=n.html),n.css&&l.setAttribute("style",n.css)})}}):yt._logInfo("Control variants leave the page unmodified.")}_is_bot(){return Je&&this._instance?N0(Je,this._config.custom_blocked_useragents):void 0}}},Za),n1={conversations:class{constructor(e){this._instance=e,this._isConversationsEnabled=void 0,this._conversationsManager=null,this._isInitializing=!1,this._remoteConfig=null,this._loadFailed=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(this._instance.config.disable_conversations||(this._remoteConfigSuccessful=e.ok,!e.ok))return;let t=e.config.conversations;Y(t)||(Ae(t)?this._isConversationsEnabled=t:(this._isConversationsEnabled=t.enabled,this._remoteConfig=t),this.loadIfEnabled())}reset(){var e;(e=this._conversationsManager)===null||e===void 0||e.reset(),this._conversationsManager=null,this._isConversationsEnabled=void 0,this._remoteConfig=null,this._remoteConfigSuccessful=void 0,this._loadFailed=!1}loadIfEnabled(){if(this._conversationsManager||this._isInitializing||this._instance.config.disable_conversations||Rc(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;let e=R?.__PosthogExtensions__;if(e&&!M(this._isConversationsEnabled)&&this._isConversationsEnabled)if(this._remoteConfig&&this._remoteConfig.token){this._isInitializing=!0;try{let t=e.initConversations;if(t)return this._completeInitialization(t),void(this._isInitializing=!1);let i=e.loadExternalDependency;if(!i)return void this._handleLoadError(qu);i(this._instance,"conversations",s=>{s||!e.initConversations?this._handleLoadError("Could not load conversations script",s):this._completeInitialization(e.initConversations),this._isInitializing=!1})}catch(t){this._handleLoadError("Error initializing conversations",t),this._isInitializing=!1}}else $t.error("Conversations enabled but missing token in remote config.")}_completeInitialization(e){if(this._remoteConfig)try{this._conversationsManager=e(this._remoteConfig,this._instance),this._loadFailed=!1,$t.info("Conversations loaded successfully")}catch(t){this._handleLoadError("Error completing conversations initialization",t)}else $t.error("Cannot complete initialization: remote config is null")}_handleLoadError(e,t){$t.error(e,t),this._conversationsManager=null,this._isInitializing=!1,this._loadFailed=!0}show(){this._conversationsManager?this._conversationsManager.show():$t.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this._isConversationsEnabled===!0&&!ue(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":Rc(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":this._remoteConfigSuccessful===!1?"remote_config_failed":M(this._isConversationsEnabled)?this._remoteConfigSuccessful?"disabled_in_project":"remote_config_pending":this._isConversationsEnabled?Y(this._remoteConfig)||!this._remoteConfig.token?"missing_token":R?.__PosthogExtensions__?this._isInitializing?"initializing":this._loadFailed?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var e,t;return(e=(t=this._conversationsManager)===null||t===void 0?void 0:t.isVisible())!==null&&e!==void 0&&e}sendMessage(e,t,i){var s=this;return Ce(function*(){return s._conversationsManager?s._conversationsManager.sendMessage(e,t,i):($t.warn(Ji),null)})()}getMessages(e,t){var i=this;return Ce(function*(){return i._conversationsManager?i._conversationsManager.getMessages(e,t):($t.warn(Ji),null)})()}markAsRead(e){var t=this;return Ce(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):($t.warn(Ji),null)})()}getTickets(e){var t=this;return Ce(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):($t.warn(Ji),null)})()}requestRestoreLink(e){var t=this;return Ce(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):($t.warn(Ji),null)})()}restoreFromToken(e){var t=this;return Ce(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):($t.warn(Ji),null)})()}restoreFromUrlToken(){var e=this;return Ce(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():($t.warn(Ji),null)})()}getCurrentTicketId(){var e,t;return(e=(t=this._conversationsManager)===null||t===void 0?void 0:t.getCurrentTicketId())!==null&&e!==void 0?e:null}getWidgetSessionId(){var e,t;return(e=(t=this._conversationsManager)===null||t===void 0?void 0:t.getWidgetSessionId())!==null&&e!==void 0?e:null}_onIdentityChanged(){var e;(e=this._conversationsManager)===null||e===void 0||e.setIdentity()}_onIdentityCleared(){var e;(e=this._conversationsManager)===null||e===void 0||e.clearIdentity()}}},r1={logs:class{constructor(e){var t;this._instance=e,this.name=Bm,this._isLogsEnabled=!1,this._isLoaded=!1,this._isLoading=!1,this._logger=Ie("[logs]"),this._coreLogger=b
110(b({},this._logger),{},{error:(...i)=>{i.some(wg)||this._logger.error(...i)}}),this._queue=[],this._consoleQueue=[],this._consecutiveStatusZeroFailures=0,this._disposed=!1,this._consoleBuffer=[],this._consoleRecorderUnpatchers=[],this._isRecordingConsole=!1,this._isRecordingConsoleEntry=!1,this._onReconnect=()=>{var i,s;this._disposed||(this._consecutiveStatusZeroFailures=0,(i=this._core)===null||i===void 0||i.onReconnect(),(s=this._consoleCore)===null||s===void 0||s.onReconnect())},this._instance&&(!((t=this._instance.config.logs)===null||t===void 0)&&t.captureConsoleLogs)&&(this._isLogsEnabled=!0),T&&Z(T,"online",this._onReconnect)}_buildCore(e,t,i,s){var n;let r=bg((n=this._instance)===null||n===void 0||(n=n.config)===null||n===void 0?void 0:n.logs,i);return[new ab(this._createHost(e,t),r,this._coreLogger,()=>this._getSdkContext(),o=>o(),void 0,s),r]}_getCore(){var e;let t=(e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.logs;var i;return this._core&&this._resolvedFrom===t||((i=this._core)===null||i===void 0||i.reset(),this._resolvedFrom=t,[this._core,this._resolvedConfig]=this._buildCore(()=>this._queue,s=>{this._queue=s})),this._core}_getConsoleCore(){var e;let t=(e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.logs;var i;return this._consoleCore&&this._consoleResolvedFrom===t||((i=this._consoleCore)===null||i===void 0||i.reset(),this._consoleResolvedFrom=t,[this._consoleCore,this._consoleResolvedConfig]=this._buildCore(()=>this._consoleQueue,s=>{this._consoleQueue=s},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Sg)),this._consoleCore}setup(e){var t;if(this._disposed)return;this._client=e,!((t=this._instance)===null||t===void 0||(t=t.config)===null||t===void 0||(t=t.logs)===null||t===void 0)&&t.captureConsoleLogs&&(this._isLogsEnabled=!0),(this._isLogsEnabled||this._remoteConfigWillArrive()&&this._persistedCaptureHint())&&this._startConsoleRecorder();let i=!1,s=e.onRemoteConfig(n=>{var r;i=n.ok&&((r=n.config.logs)===null||r===void 0?void 0:r.captureConsoleLogs)===!0,this.onRemoteConfig(n)});this._disposed?s.dispose():(this._remoteConfigSubscription=s,i||this.loadIfEnabled())}dispose(){var e,t,i,s;this._disposed||(this._disposed=!0,this._stopConsoleRecorder(),(e=this._remoteConfigSubscription)===null||e===void 0||e.dispose(),this._remoteConfigSubscription=void 0,this._client=void 0,this._isLoading=!1,T?.removeEventListener("online",this._onReconnect),(t=this._consoleLogsDispose)===null||t===void 0||t.call(this),this._consoleLogsDispose=void 0,(i=this._core)===null||i===void 0||i.reset(),(s=this._consoleCore)===null||s===void 0||s.reset())}onRemoteConfig(e){var t,i;if(this._disposed)return;let s=e.ok?(t=e.config.logs)===null||t===void 0?void 0:t.captureConsoleLogs:void 0;Y(s)?this._stopRecorderStartedByPersistedHint():((i=this._instance)===null||i===void 0||(i=i.persistence)===null||i===void 0||i.register({$logs_capture_enabled_server_side:!!s}),s?(this._isLogsEnabled=!0,this._isLoaded||this._startConsoleRecorder(),this.loadIfEnabled()):this._stopRecorderStartedByPersistedHint())}reset(){var e,t,i,s;this._stopConsoleRecorder(),(e=this._core)===null||e===void 0||e.clearQueue(),this._queue=[],(t=this._core)===null||t===void 0||t.reset(),(i=this._consoleCore)===null||i===void 0||i.clearQueue(),this._consoleQueue=[],(s=this._consoleCore)===null||s===void 0||s.reset(),this._consecutiveStatusZeroFailures=0}captureLog(e){this._disposed||this._getCore().captureLog(e)}captureConsoleLog(e){this._disposed||this._getConsoleCore().captureLog(e)}captureBufferedConsoleLog(e,t,i){this._disposed||this._getConsoleCore().captureLog(e,{context:t,occurredAtMs:i})}_persistedCaptureHint(){var e;return!!(!((e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||(e=e.props)===null||e===void 0)&&e[xg])}_remoteConfigWillArrive(){var e,t,i;return!(!((e=this._instance)===null||e===void 0||(t=e._shouldDisableFlags)===null||t===void 0)&&t.call(e))||!!(!((i=R._POSTHOG_REMOTE_CONFIG)===null||i===void 0||(i=i[this._instance.config.token])===null||i===void 0)&&i.c
110onfig)}_onOptOut(){var e;this._stopConsoleRecorder(),(e=this._consoleCore)===null||e===void 0||e.clearQueue(),this._consoleQueue=[]}_stopRecorderStartedByPersistedHint(){this._isLogsEnabled||this._stopConsoleRecorder()}_startConsoleRecorder(){var e;if(this._isRecordingConsole||!R?.console)return;let t=bg((e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.logs).maxBufferSize,i=!0;this._consoleRecorderUnpatchers.push(()=>{i=!1});for(let s of zk){let n;try{n=jm(R.console[s])}catch{continue}n&&this._consoleRecorderUnpatchers.push(ai(R.console,s,r=>{let o=(...a)=>{try{i&&this._recordConsoleEntry(s,a,t)}catch{}return r.apply(R.console,a)};return o.__rrweb_original__=n,o}))}this._isRecordingConsole=!0,this._consoleRecorderTimeout=setTimeout(()=>{this._stopConsoleRecorder()},3e4)}_recordConsoleEntry(e,t,i){var s;if(this._isRecordingConsole&&!this._isRecordingConsoleEntry&&t.length!==0)if(!((s=this._instance)===null||s===void 0)&&s.is_capturing()){if(i>this._consoleBuffer.length){this._isRecordingConsoleEntry=!0;try{this._consoleBuffer.push({level:e,args:t,occurredAtMs:Date.now(),context:this._getSdkContext()})}finally{this._isRecordingConsoleEntry=!1}}}else this._stopConsoleRecorder()}_stopConsoleRecorder(){if(this._consoleBuffer=[],this._isRecordingConsole){this._isRecordingConsole=!1,this._consoleRecorderTimeout&&(clearTimeout(this._consoleRecorderTimeout),this._consoleRecorderTimeout=void 0);for(let e of this._consoleRecorderUnpatchers)e();this._consoleRecorderUnpatchers=[]}}_takeConsoleBuffer(){let e=this._consoleBuffer;return this._stopConsoleRecorder(),e}get logger(){return this._capture_logger||(this._capture_logger={trace:(e,t)=>this.captureLog({body:e,level:"trace",attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:"debug",attributes:t}),info:(e,t)=>this.captureLog({body:e,level:"info",attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:"warn",attributes:t}),error:(e,t)=>this.captureLog({body:e,level:"error",attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:"fatal",attributes:t})}),this._capture_logger}flushLogs(e){e?this._flushViaTransport(e):(this._core&&this._core.flush().catch(t=>this._logFlushError(t)),this._consoleCore&&this._consoleCore.flush().catch(t=>this._logFlushError(t)))}_logFlushError(e){wg(e)||this._logger.error("PostHog logs flush failed:",e)}loadIfEnabled(){if(this._disposed||!this._isLogsEnabled||this._isLoaded||this._isLoading)return;let e=R?.__PosthogExtensions__;if(!e)return this._logger.error("PostHog Extensions not found."),void this._stopConsoleRecorder();let t=e.loadExternalDependency;if(!t)return this._logger.error(qu),void this._stopConsoleRecorder();this._isLoading=!0;try{t(this._instance,"logs",i=>{if(this._isLoading=!1,this._disposed||!this._isLogsEnabled)return;let s=e.logs;if(i||!s?.initializeLogs)this._logger.error("Could not load logs script",i),this._stopConsoleRecorder();else{var n;let a=this._takeConsoleBuffer();var r,o;this._consoleLogsDispose=s.initializeLogs((n=this._client)!==null&&n!==void 0?n:this._instance),this._isLoaded=!0,a.length>0&&((r=s.replayConsoleBuffer)===null||r===void 0||r.call(s,(o=this._client)!==null&&o!==void 0?o:this._instance,a))}})}catch(i){throw this._isLoading=!1,i}}_createHost(e,t){let i=this._instance;return{get isDisabled(){return!1},get optedOut(){return!i.is_capturing()},getPersistedProperty:s=>s===ei.LogsQueue?e():void 0,setPersistedProperty(s,n){var r;s===ei.LogsQueue&&t((r=n)!==null&&r!==void 0?r:[])},_sendLogsBatch:s=>this._sendLogsBatch(s),getLibraryId:()=>Qe.LIB_NAME,getLibraryVersion:()=>Qe.LIB_VERSION}}_sendLogsBatch(e){return new Promise(t=>{if(Jf(this._consecutiveStatusZeroFailures,3))return void t({kind:"fatal",error:lc(void 0,"logs endpoint is unreachable, dropping batch")});let i=!1,s=r=>{i||(i=!0,clearTimeout(n),t(r))},n=setTimeout(()=>{this._logger.warn("Logs request timed out before receiving a response"),s({kind:"retry-later",error:lc(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this._logsUrl(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:r=>{let o=r.statusCode;if(this._trackEndpointReachability(o),o>=200&&300>o)s({kind:"ok"});else if(o===413)s({kind:"too-large"});else if(o!==0&&o!==408&&o!==429&&500>o)s({kind:"fatal",error:new Error(`logs request failed with status ${o}`)});else{var a;o===0?(r.error||this._logger.warn("Logs request failed before receiving an HTTP response"),s({kind:"retry-later",error:lc(r.error,"logs request failed before receiving an HTTP response")})):s({kind:"retry-later",error:(a=r.error)!==null&&a!==void 0?a:new Error(`logs request failed with status ${o}`)})}}})})}_trackEndpointReachability(e){(e!==0||this._instance.__loaded)&&(this._consecutiveStatusZeroFailures=Yf(e,this._consecutiveStatusZeroFailures,3,()=>this._logger.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes.")))}_flushViaTransport(e){this._queue.length>0&&this._drainQueueViaTransport(e,this._queue,this._resolvedConfig,Qe.LIB_NAME,t=>{this._queue=t}),this._consoleQueue.length>0&&this._drainQueueViaTransport(e,this._consoleQueue,this._consoleResolvedConfig,Sg,t=>{this._consoleQueue=t})}_drainQueueViaTransport(e,t,i,s,n){if(t.length===0)return;let r=t.map(a=>a.record);n([]);let o=Wf(r,Uf(i,Qe.LIB_NAME,Qe.LIB_VERSION),s,Qe.LIB_VERSION);this._instance._send_request({method:"POST",url:this._logsUrl(),data:o,compression:"best-available",batchKey:"logs",transport:e})}_logsUrl(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}_getSdkContext(){var e;let t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){let{sessionId:i,windowId:s,sessionStartTimestamp:n,lastActivityTimestamp:r}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);t.sessionId=i,t.windowId=s,Y(n)||(t.sessionStartTimestamp=n),Y(r)||(t.lastActivityTimestamp=r)}if(!(R==null||(e=R.location)===null||e===void 0)&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?ni(R.location.href):R.location.href),this._instance.featureFlags){let i=this._instance.featureFlags.getFlags();i&&i.length>0&&(t.activeFeatureFlags=i)}return t}}},o1={metrics:class{constructor(e){this._instance=e,this._logger=Ie("[metrics]"),this._disposed=!1}initialize(){this.onConfigChange()}onConfigChange(){var e;if(this._disposed)return;let t=!!(!((e=this._instance.config.metrics)===null||e===void 0)&&e.network);t&&!this._stopNetworkMetrics?this._stopNetworkMetrics=(i=>{let s=!0,n=()=>s?(a=>{var l;let c=(l=a.config.metrics)===null||l===void 0?void 0:l.network;return c===!0?{}:c||void 0})(i):void 0,r=Gk(i,n),o=Qk(i,n);return()=>{s=!1,r(),o()}})(this._instance):!t&&this._stopNetworkMetrics&&(this._stopNetworkMetrics(),this._stopNetworkMetrics=void 0)}_getCore(){var e;let t=(e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.metrics;var i;return this._core&&this._resolvedFrom===t||((i=this._core)===null||i===void 0||i.reset(),this._resolvedFrom=t,this._core=new lb(this._createHost(),(function(s){var n,r,o,a,l;
110let c=s?.resourceAttributes;return{serviceName:(n=c?.["service.name"])!==null&&n!==void 0?n:s?.serviceName,serviceVersion:(r=c?.["service.version"])!==null&&r!==void 0?r:s?.serviceVersion,environment:(o=c?.["deployment.environment"])!==null&&o!==void 0?o:s?.environment,resourceAttributes:c,beforeSend:s?.beforeSend,flushIntervalMs:(a=s?.flushIntervalMs)!==null&&a!==void 0?a:1e4,maxSeriesPerFlush:(l=s?.maxSeriesPerFlush)!==null&&l!==void 0?l:1e3}})(t),this._logger)),this._core}count(e,t=1,i){this._getCore().count(e,t,i)}gauge(e,t,i){this._getCore().gauge(e,t,i)}histogram(e,t,i){this._getCore().histogram(e,t,i)}flush(e){if(!this._core)return Promise.resolve();if(e){let t=this._core.drainWindow();return t&&this._sendMetricsBatch(t,e),Promise.resolve()}return this._core.flush().catch(t=>this._logger.error("PostHog metrics flush failed:",t))}reset(){var e;(e=this._core)===null||e===void 0||e.reset()}dispose(){var e,t;this._disposed=!0,(e=this._stopNetworkMetrics)===null||e===void 0||e.call(this),this._stopNetworkMetrics=void 0,(t=this._core)===null||t===void 0||t.reset()}_createHost(){let e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},_sendMetricsBatch:i=>t._sendMetricsBatch(i),getLibraryId:()=>Qe.LIB_NAME,getLibraryVersion:()=>Qe.LIB_VERSION}}_sendMetricsBatch(e,t){return new Promise(i=>{let s=!1,n=o=>{s||(s=!0,clearTimeout(r),i(o))},r=setTimeout(()=>n({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(b(b({method:"POST",url:this._metricsUrl(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t}),{},{fireCallbackOnDrop:!0,callback(o){let a=o.statusCode;if(a>=200&&300>a)n({kind:"ok"});else if(a===413)n({kind:"too-large"});else if(a!==0&&a!==408&&a!==429&&500>a)n({kind:"fatal",error:new Error(`metrics request failed with status ${a}`)});else{var l;n({kind:"retry-later",error:(l=o.error)!==null&&l!==void 0?l:new Error(`metrics request failed with status ${a}`)})}}}))})}_metricsUrl(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}};mr.__defaultExtensionClasses=b({},b(b(b(b(b(b(b(b(b(b(b(b(b({},Za),Kk),Jk),Yk),Zk),Xk),t1),e1),i1),s1),n1),r1),o1));var a1=(function(){Qe.SDK_DIST_CHANNEL="npm";let e=fr[Gn]=new mr;return(function(){function t(){t.done||(t.done=!0,$0=!1,xe(fr,function(i){i._dom_loaded()}))}F?.addEventListener?F.readyState==="complete"?t():Z(F,"DOMContentLoaded",t,{capture:!1}):T&&D.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),e})(),z0=a1;import{analyticsAllowed as zr,configureAnalytics as Dd,allowedEvent as l1,pagePath as mn,pageCategory as c1,analyticsTestMode as j0,safePublicClick as u1}from "./analytics.js?v=d640bc98c68e";var Xa,Wi="marionettejs.com";function d1(e,t){if(!e||!l1(e.event)||!zr()||!el(e.properties?.distinct_id))return null;let i=e.event==="$pageview"||e.event==="$pageleave",s=mn(i?e.properties?.$pathname??globalThis.location?.pathname:e.properties?.path);if(i&&!s)return null;let n=e.event==="site_click"?u1({...e.properties,targetPath:e.properties?.target_path}):null;if(e.event==="site_click"&&!n)return null;let r={};if(i){for(let l of["$pageview_id","$prev_pageview_id"]){let c=e.properties?.[l];el(c)&&(r[l]=c)}let o=mn(e.properties?.$prev_pageview_pathname);o&&(r.$prev_pageview_pathname=o);let a=e.properties?.$prev_pageview_duration;typeof a=="number"&&Number.isFinite(a)&&a>=0&&a<=86400&&(r.$prev_pageview_duration=Math.round(a*10)/10)}return{api_key:t,distinct_id:e.properties?.distinct_id,event:e.event,uuid:e.uuid,timestamp:e.timestamp,properties:{token:t,distinct_id:e.properties?.distinct_id,$process_person_profile:!1,$geoip_disable:!0,analytics_test:j0(),...r,...n||{},$host:Wi,...V0(e.properties),...s?{$current_url:`https://${Wi}${s}`,$pathname:s}:{},path:s,page:s?c1(s):"other"}}}function h1(e,t,i=!1){return{api_host:"https://e.marionettejs.com",ui_host:"https://eu.posthog.com",person_profiles:"never",persistence:"cookie",cookie_expiration:1,cross_subdomain_cookie:!1,secure_cookie:!0,autocapture:!1,capture_pageview:"history_change",capture_pageleave:!0,
110capture_performance:!1,capture_exceptions:!1,capture_heatmaps:!1,capture_dead_clicks:!1,capture_dead_swipes:!1,rageclick:!1,disable_session_recording:!i,disable_capture_url_hashes:!0,enable_recording_console_log:!1,get_current_url:()=>{let s=mn(globalThis.location?.pathname);return s?`https://${Wi}${s}`:`https://${Wi}/`},session_recording:{maskAllInputs:!1,maskInputFn:(s,n)=>n?.matches?.('.pagefind-ui__search-input, input[type="password"], input[type="search"]')?"*".repeat(s.length):s,maskInputOptions:{password:!0,search:!0,text:!0},blockSelector:"iframe, #workshop-notes, body > :not(header):not(main):not(footer):not(#playground)",recordCrossOriginIframes:!1,recordHeaders:!1,recordBody:!1,captureCanvas:{enabled:!1},compress_events:!1,maskCapturedNetworkRequestFn:s=>{if(Object.keys(s).length!==1||typeof s.name!="string")return null;let n=G0(s.name);return n?{name:n}:null}},disable_surveys:!0,disable_product_tours:!0,disable_conversations:!0,disable_web_experiments:!0,save_campaign_params:!1,debug:!1,disable_external_dependency_loading:!0,advanced_disable_flags:!i,advanced_disable_feature_flags:!0,remote_config_refresh_interval_ms:0,disable_scroll_properties:!0,save_referrer:!1,store_google:!1,ip:!1,request_batching:!1,disable_compression:!0,before_send:s=>{let n=s?.event==="$snapshot"&&i?p1(s,e):d1(s,e);return n&&t&&t(n),null}}}function nE(e,t=z0){if(!/^phc_[A-Za-z0-9]+$/.test(e?.projectKey||"")||!zr()||!mn(globalThis.location?.pathname)||!["marionettejs.com","www.marionettejs.com","v5.marionettejs.com"].includes(globalThis.location?.hostname))return!1;if(Xa)return Xa.projectKey!==e.projectKey||Xa.sdk!==t?!1:(Dd((n,r)=>t.capture(n,r)),!0);let i=new Set,s=()=>{if(!zr()){for(let n of i)n.abort();i.clear(),Dd(),t.stopSessionRecording?.()}};return globalThis.addEventListener?.("marionette-analytics-opt-out",s),globalThis.addEventListener?.("storage",n=>{n.key==="marionette-analytics-opt-out"&&s()}),t.init(e.projectKey,h1(e.projectKey,n=>{if(!zr())return;let r=new AbortController;i.add(r);let o=JSON.stringify(n);fetch(n.event==="$snapshot"?"https://e.marionettejs.com/s/":"https://e.marionettejs.com/i/v0/e/",{method:"POST",body:o,headers:{"Content-Type":"text/plain"},credentials:"omit",referrerPolicy:"no-referrer",keepalive:new TextEncoder().encode(o).byteLength<6e4,signal:r.signal}).catch(()=>{}).finally(()=>i.delete(r))},!!e.replayFreeCapConfirmed)),Xa={projectKey:e.projectKey,sdk:t},Dd((n,r)=>t.capture(n,r)),!0}var el=e=>typeof e=="string"&&/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i.test(e);function V0(e){return Object.fromEntries(["$session_id","$window_id"].filter(t=>el(e?.[t])).map(t=>[t,e[t]]))}function G0(e){try{let t=new URL(e,`https://${Wi}`);if(!["http:","https:"].includes(t.protocol)||!["marionettejs.com","www.marionettejs.com","v5.marionettejs.com"].includes(t.hostname))return"";let i=mn(t.pathname);return i?`https://${Wi}${i}`:/^\/(?:assets|vendor|pagefind)\/[A-Za-z0-9_./-]+$/.test(t.pathname)?`https://${Wi}${t.pathname}`:""}catch{return""}}function Nd(e){if(Array.isArray(e))return e.map(Nd);if(!e||typeof e!="object")return e;let t={};for(let[i,s]of Object.entries(e))["srcdoc","action","formaction","data","integrity","srcset","style","_cssText"].includes(i)&&typeof s=="string"||(["href","src","url"].includes(i)&&typeof s=="string"?t[i]=G0(s):t[i]=Nd(s));return t}function p1(e,t){return!zr()||!mn(globalThis.location?.pathname)||!el(e?.properties?.distinct_id)||!Array.isArray(e.properties.$snapshot_data)?null:{api_key:t,event:"$snapshot",uuid:e.uuid,timestamp:e.timestamp,distinct_id:e.properties.distinct_id,properties:{token:t,distinct_id:e.properties.distinct_id,...V0(e.properties),$snapshot_data:Nd(e.properties.$snapshot_data),$snapshot_bytes:e.properties.$snapshot_bytes,$lib:"web",$lib_version:"1.435.8",$snapshot_host:Wi,$process_person_profile:!1,$geoip_disable:!0,analytics_test:j0()}}}export{nE as initializePostHog,h1 as postHogOptions,d1 as sanitizePostHogEvent,p1 as sanitizeReplayEvent};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.