UNPKG

posthog-js

Version:

Posthog-js allows you to automatically capture usage and send events to PostHog.

2 lines • 154 kB
var t,e=["retriesPerformedSoFar"];function i(){return i=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var i=arguments[e];for(var r in i)({}).hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t},i.apply(null,arguments)}function r(t,e,i,r,s,n,o){try{var a=t[n](o),l=a.value}catch(t){return void i(t)}a.done?e(l):Promise.resolve(l).then(r,s)}function s(t){return function(){var e=this,i=arguments;return new Promise(function(s,n){var o=t.apply(e,i);function a(t){r(o,s,n,a,l,"next",t)}function l(t){r(o,s,n,a,l,"throw",t)}a(void 0)})}}var n="u">typeof window?window:void 0,o="u">typeof globalThis?globalThis:n,a=null==o?void 0:o.navigator,l=null==o?void 0:o.document,h=null==o?void 0:o.location,u=null==o?void 0:o.fetch,d=null!=o&&o.XMLHttpRequest&&"withCredentials"in new o.XMLHttpRequest?o.XMLHttpRequest:void 0,v=null==o?void 0:o.AbortController,c=null==o?void 0:o.CompressionStream,_=null==a?void 0:a.userAgent,p="undefined"!=typeof globalThis?globalThis:n;p&&"undefined"==typeof self&&(p.self=p),p&&"undefined"==typeof File&&(p.File=function(){});var f=null!=n?n:{},g="0.9.11",m={DEBUG:!1,LIB_VERSION:g,LIB_NAME:"browser-common",JS_SDK_VERSION:g},b=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),y=["$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"],w=["token"];function S(t,e){return-1!==t.indexOf(e)}var x=function(t){return t.replace(/^\$/,"")},E=Object.prototype,T=E.hasOwnProperty,k=E.toString,P=Array.isArray||function(t){return"[object Array]"===k.call(t)},R=t=>"function"==typeof t,I=t=>t===Object(t)&&!P(t),O=t=>{if(I(t)){for(var e in t)if(T.call(t,e))return!1;return!0}return!1},C=t=>void 0===t,A=t=>"[object String]"==k.call(t),M=t=>A(t)&&0===t.trim().length,D=t=>null===t,N=t=>C(t)||D(t),F=t=>"[object Number]"==k.call(t)&&t==t,U=t=>F(t)&&t>0,B=t=>"[object Boolean]"===k.call(t),L=t=>S(y,t),j=t=>S(w,t);function z(t){switch({}.toString.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return function(t,e){try{return t instanceof e}catch(t){return!1}}(t,Error)}}var W=[!0,"true",1,"1","yes"],q=t=>S(W,t),G=[!1,"false",0,"0","no"],H=["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"],V=new Map,J=function(t,e){if(void 0===e&&(e=[]),!t)return!1;var i=function(t,e){for(var i="",r=0;e.length>r;r++){var s=e[r];i+=s.length+":"+s}return t.length+":"+t+"|"+e.length+":"+i}(t,e),r=V.get(i);if(void 0!==r)return r;var s=t.toLowerCase(),n=H.concat(e).some(t=>-1!==s.indexOf(t.toLowerCase()));return 256>V.size||V.clear(),V.set(i,n),n};function K(t,e,i,r,s){return e>i&&(r.warn("min cannot be greater than max."),e=i),F(t)?t>i?(r.warn(" cannot be  greater than max: "+i+". Using max value instead."),i):e>t?(r.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(r.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+s),K(null!=s?s:i,e,i,r))}var Y="Mobile",X="Android",Q="Tablet",Z="Android Tablet",tt="iPad",et="Apple Watch",it="Safari",rt="BlackBerry",st="Samsung Internet",nt="Chrome",ot="Chrome iOS",at="Internet Explorer",lt="Internet Explorer Mobile",ht="Opera",ut="Microsoft Edge",dt="Firefox",vt="Firefox iOS",ct="Nintendo",_t="PlayStation",pt="Xbox",ft="Android Mobile",gt="Mobile Safari",mt="Windows",bt="Windows Phone",yt="Nokia",wt="Ouya",$t="Generic "+Y.toLowerCase(),St="Generic "+Q.toLowerCase(),xt="Konqueror",Et="Oculus Browser",Tt="Vivaldi",kt="Yandex",Pt="Whale",Rt="DuckDuckGo",It="Pale Moon",Ot="Waterfox",Ct="Brave",At="Claude",Mt="Codex",Dt="ChatGPT",Nt="Google Search App",Ft=new RegExp("Version/(\\d+(\\.\\d+)?)"),Ut=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),Bt=new RegExp(pt,"i"),Lt=new RegExp("PlayStation \\w+","i"),jt=new RegExp("Nintendo \\w+","i"),zt=new RegExp("BlackBerry|PlayBook|BB10","i"),Wt={"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"},qt=function(t,e,i,r){e=e||"";var s=function(t){return null!=t&&t.brave?Ct:null}(i);return s||(null!=r&&r.detectGoogleSearchApp&&S(t,"GSA/")?Nt:S(t," OPR/")&&S(t,"Mini")?"Opera Mini":S(t," OPR/")?ht:zt.test(t)?rt:S(t,"IEMobile")||S(t,"WPDesktop")?lt:S(t,"OculusBrowser")?Et:S(t,"SamsungBrowser")?st:S(t,"Edge")||S(t,"Edg/")?ut:S(t,"Vivaldi/")?Tt:S(t,"YaBrowser/")?kt:S(t,"Whale/")?Pt:S(t,"DuckDuckGo/")||S(t,"Ddg/")?Rt:S(t,"Claude/")?At:S(t,"Codex/")?Mt:S(t,"ChatGPT/")?Dt:S(t,"FBIOS")?"Facebook Mobile":S(t,"UCWEB")||S(t,"UCBrowser")?"UC Browser":S(t,"CriOS")?ot:S(t,"CrMo")||S(t,nt)?nt:S(t,X)&&S(t,it)?ft:S(t,"FxiOS")?vt:S(t.toLowerCase(),xt.toLowerCase())?xt:S(t,"Brave/")?Ct:((t,e)=>e&&S(e,"Apple")||function(t){return S(t,it)&&!S(t,nt)&&!S(t,X)}(t))(t,e)?S(t,Y)?gt:it:S(t,"PaleMoon/")?It:S(t,"Waterfox/")?Ot:S(t,dt)?dt:S(t,"MSIE")||S(t,"Trident/")?at:S(t,"Gecko")?dt:"")},Gt={[lt]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[ut]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[nt]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[ot]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[it]:[Ft],[gt]:[Ft],[ht]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[dt]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[vt]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[xt]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[rt]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),Ft],[ft]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[st]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[Et]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[Tt]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[kt]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[Pt]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[Ct]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[At]:[Ut],[Mt]:[Ut],[Dt]:[Ut],[Rt]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[It]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[Ot]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[Nt]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[at]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},Ht=function(t,e,i,r){var s=Gt[qt(t,e,i,r)];if(C(s))return null;for(var n=0;s.length>n;n++){var o=t.match(s[n]);if(o)return parseFloat(o[o.length-2])}return null},Vt=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),t=>[pt,t&&t[1]||""]],[new RegExp(ct,"i"),[ct,""]],[new RegExp(_t,"i"),[_t,""]],[zt,[rt,""]],[new RegExp(mt,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[bt,""];if(new RegExp(Y).test(e)&&!/IEMobile\b/.test(e))return["Windows Mobile",""];var i=/Windows NT ([0-9.]+)/i.exec(e);if(i&&i[1]){var r=Wt[i[1]]||"";return/arm/i.test(e)&&(r="RT"),[mt,r]}return[mt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?["iOS",[t[3],t[4],t[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=C(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),t=>t&&t[2]?[X,[t[2],t[3],t[4]||"0"].join(".")]:[X,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var e=["Mac OS X",""];return t&&t[1]&&(e[1]=[t[1],t[2],t[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],Jt=function(t){return jt.test(t)?ct:Lt.test(t)?_t:Bt.test(t)?pt:new RegExp(wt,"i").test(t)?wt:new RegExp("(Windows Phone|WPDesktop)","i").test(t)?bt:/iPad/.test(t)?tt:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?et:zt.test(t)?rt:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(yt,"i").test(t)?yt:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(Y).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?X:Z:new RegExp("(pda|Mobile)","i").test(t)?$t:new RegExp(Q,"i").test(t)&&!new RegExp("Tablet pc","i").test(t)?St:""},Kt=/\bFBAV\/(\d+(?:\.\d+)*)/i,Yt=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",Kt],[/\bFBAN\/EMA\b/i,"Facebook Lite",Kt],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",Kt],[/\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"]],Xt=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Qt(t,e){return"string"==typeof(i=t)&&Xt.test(i)?t:e();var i}function Zt(t,e){var i=new Error(e);try{Object.defineProperty(i,"name",{value:t,writable:!0,enumerable:!0,configurable:!0})}catch(t){}return i}function te(t){return t?t.split("#")[0]:t}var ee,ie=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","oppref","bfcid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],re="NativeGzipValidationError",se=t=>t.length>=2&&31===t[0]&&139===t[1],ne=(t,e)=>t===b.GZipJS||e===b.GZipJS||"gzip"===e,oe=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),ae=t=>{throw Zt(re,"Native gzip produced invalid output: "+t)},le=function(){var t=s(function*(t,e){18>t.size&&ae("too-short");var i=new Uint8Array(yield t.slice(0,10).arrayBuffer());se(i)&&8===i[2]||ae("invalid-header");var r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{for(var e=(()=>{if(ee)return ee;ee=[];for(var t=0;256>t;t++){for(var e=t,i=0;8>i;i++)e=1&e?3988292384^e>>>1:e>>>1;ee[t]=e>>>0}return ee})(),i=4294967295,r=0;t.length>r;r++)i=e[255&(i^t[r])]^i>>>8;return(4294967295^i)>>>0})(e)&&ae("invalid-crc");var s=e.length>>>0;r.getUint32(4,!0)!==s&&ae("invalid-size")});return function(e,i){return t.apply(this,arguments)}}();function he(){return he=s(function*(t,e,i){void 0===e&&(e=!0);try{var r=(new TextEncoder).encode(t),n=new globalThis.CompressionStream("gzip"),o=n.writable.getWriter(),a=o.write(r).then(()=>o.close()).catch(function(){var t=s(function*(t){try{yield o.abort(t)}catch(t){}throw t});return function(e){return t.apply(this,arguments)}}()),l=new Response(n.readable).blob(),h=(yield Promise.all([l,a]))[0];return yield le(h,r),h}catch(t){if(null!=i&&i.rethrow)throw t;return e&&console.error("Failed to gzip compress data",t),null}}),he.apply(this,arguments)}var ue=function(t,e){var i=(void 0===e?{}:e).debugEnabled,r={N(e){var r;try{r=typeof window>"u"?void 0:window}catch(t){return}for(var s=arguments.length,n=new Array(s>1?s-1:0),o=1;s>o;o++)n[o-1]=arguments[o];r&&(m.DEBUG||r.POSTHOG_DEBUG||i)&&!C(r.console)&&r.console&&("__rrweb_original__"in r.console[e]?r.console[e].__rrweb_original__:r.console[e])(t,...n)},debug(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.N("debug",...e)},info(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.N("log",...e)},warn(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.N("warn",...e)},error(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.N("error",...e)},critical(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];console.error(t,...i)},uninitializedWarning(t){r.error("You must initialize PostHog before calling "+t)},createLogger:(e,i)=>ue(t+" "+e,i)};return r},de=ue("[PostHog.js]"),ve=de.createLogger,ce=ve("[ExternalScriptsLoader]"),_e=t=>{var e=null==l?void 0:l.querySelectorAll("script");if(e)for(var i=0;e.length>i;i++)if(e[i].src===t||e[i].getAttribute("src")===t)return e[i]},pe=(t,e,i)=>{if(t.config.disable_external_dependency_loading)return ce.warn(e+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var r=_e(e);if(r){if(r.__posthog_loading_callback_fired)return i();var s=r.__posthog_loading_error;return s?i(s):(r.addEventListener("load",t=>{r.__posthog_loading_callback_fired=!0,i(void 0,t)}),void r.addEventListener("error",t=>{r.__posthog_loading_error=t,i(t)}))}var n=()=>{if(!l)return i("document not found");if(_e(e))return pe(t,e,i);var r=l.createElement("script");if(r.type="text/javascript",r.crossOrigin="anonymous",r.src=e,r.onload=t=>{r.__posthog_loading_callback_fired=!0,i(void 0,t)},r.onerror=t=>{r.__posthog_loading_error=t,i(t)},t.config.prepare_external_dependency_script&&(r=t.config.prepare_external_dependency_script(r)),!r)return i("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)l.head.appendChild(r);else{var s,n=l.querySelectorAll("body > script");n.length>0?null==(s=n[0].parentNode)||s.insertBefore(r,n[0]):l.body.appendChild(r)}};null!=l&&l.body?n():null==l||l.addEventListener("DOMContentLoaded",n)},fe={},ge=(t,e)=>{var i="/static/"+e+".js?v="+t.version;if("toolbar"===e){var r=3e5;i=i+"&t="+Math.floor(Date.now()/r)*r}return t.requestRouter.endpointFor("assets",i)};f.__PosthogExtensions__=f.__PosthogExtensions__||{},f.__PosthogExtensions__.loadExternalDependency=(t,e,i)=>{if("remote-config"!==e){var r=t.config.strict_script_versioning;if(r){var s=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+e+".js"),n=fe[s];if("fallback"===r&&n){if(_e(n))return void pe(t,n,i);delete fe[s]}pe(t,s,"fallback"===r?(r,n)=>{if(r)if("string"==typeof r)i(r);else{var o,a=ge(t,e);fe[s]=a;var l=_e(s);null==l||null==(o=l.parentNode)||o.removeChild(l),pe(t,a,i)}else i(void 0,n)}:i)}else pe(t,ge(t,e),i)}else pe(t,t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js"),i)},f.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{pe(t,t.requestRouter.endpointFor("api",e),i)},m.DEBUG=!1,m.LIB_VERSION="1.438.23",m.LIB_NAME="web";var me=m,be="$early_access_features",ye="$active_feature_flags",we="$feature_flag_details",$e="$feature_flag_errors",Se="$feature_flag_evaluated_at",xe="$feature_flag_request_id",Ee="$minimal_flag_called_events",Te="$enabled_feature_flags",ke="$stored_group_properties",Pe="$stored_person_properties",Re="$flag_call_reported",Ie="$flag_call_reported_session_id",Oe="$feature_flag_payloads",Ce="$override_feature_flags",Ae="$override_feature_flag_payloads",Me="visibilitychange",De="$autocapture_disabled_server_side",Ne="$surveys",Fe="$surveys_loaded_at",Ue="$surveys_activated",Be="$surveys_activated_session",Le="$surveys_activated_timestamps",je="$people_distinct_id",ze="distinct_id",We="$device_id",qe="$device_model",Ge="__alias",He="__cmpns",Ve="$fbc",Je="$fbc_persistence",Ke="$fbp",Ye="$fbp_persistence",Xe="__timers",Qe="$heatmaps_enabled_server_side",Ze="$exception_capture_enabled_server_side",ti="$error_tracking_suppression_rules",ei="$error_tracking_capture_extension_exceptions",ii="$web_vitals_enabled_server_side",ri="$dead_clicks_enabled_server_side",si="$product_tours_enabled_server_side",ni="$logs_capture_enabled_server_side",oi="$web_vitals_allowed_metrics",ai="$session_recording_remote_config",li="$session_recording_enabled_server_side",hi="$replay_sample_rate",ui="$replay_override_sampling",di="$replay_override_linked_flag",vi="$replay_override_url_trigger",ci="$replay_override_event_trigger",_i="$sesid",pi="$session_is_sampled",fi="$session_past_minimum_duration",gi="$session_recording_url_trigger_activated_session",mi="$session_recording_event_trigger_activated_session",bi="$debug_first_full_snapshot_timestamp",yi="$sess_rec_flush_size",wi="$groups",$i="ph_product_tours",Si="$product_tours_activated",xi="$product_tours_activated_session",Ei="$conversations_widget_session_id",Ti="$conversations_ticket_id",ki="$conversations_widget_state",Pi="$conversations_user_traits",Ri="$user_state",Ii="$client_session_props",Oi="$capture_rate_limit",Ci="$initial_campaign_params",Ai="$initial_referrer_info",Mi="$initial_person_info",Di="$epp",Ni="$posthog_cookieless",Fi="$cookieless_mode",Ui="$sdk_debug_extensions_init_method",Bi="$sdk_debug_extensions_init_time_ms",Li="$sdk_debug_recording_script_not_loaded",ji="$sdk_debug_replay_stale_config",zi="$sdk_debug_replay_event_trigger_status",Wi="$sdk_debug_replay_linked_flag_trigger_status",qi="$sdk_debug_replay_matched_recording_trigger_groups",Gi="$sdk_debug_replay_pending_trigger_conditions",Hi="$sdk_debug_replay_remote_trigger_matching_config",Vi="$sdk_debug_replay_trigger_groups_count",Ji="$sdk_debug_replay_url_trigger_status",Ki="$session_recording_start_reason",Yi="anonymous",Xi="identified",Qi="identified_only",Zi="beforeunload",tr="$pageview",er="$pageleave",ir="$identify",rr="$groupidentify";function sr(t,e){P(t)&&t.forEach(e)}function nr(t,e){if(!N(t))if(P(t))t.forEach(e);else if((t=>t instanceof FormData)(t))t.forEach((t,i)=>e(t,i));else for(var i in t)T.call(t,i)&&e(t[i],i)}var or=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];for(var s of i)for(var n in s)void 0!==s[n]&&(t[n]=s[n]);return t},ar=function(t){return function(){try{for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,i)}catch(t){de.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),de.critical(t)}}},lr=function(t){var e={};return nr(t,function(t,i){(A(t)&&t.length>0||F(t))&&(e[i]=t)}),e};function hr(t){var e=i({},t);for(var r of["name","message","stack","cause","errors"])try{r in t&&(e[r]=t[r])}catch(t){}return e}var ur=["herokuapp.com","vercel.app","netlify.app"];function dr(t){var e=null==t?void 0:t.hostname;if(!A(e))return!1;var i=e.split(".").slice(-2).join(".");for(var r of ur)if(i===r)return!1;return!0}function vr(t,e,i,r){var s=null!=r?r:{},n=s.capture,o=s.passive;null==t||t.addEventListener(e,i,{capture:void 0!==n&&n,passive:void 0===o||o})}var cr,_r,pr=t=>{if(l){try{for(var e=t+"=",i=l.cookie.split(";").filter(t=>t.length),r=0;i.length>r;r++){for(var s=i[r];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(e))return decodeURIComponent(s.substring(e.length,s.length))}}catch(t){}return null}},fr=class t{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,i,r,s){if(!Number.isInteger(e)||!Number.isInteger(i)||!Number.isInteger(r)||!Number.isInteger(s)||0>e||0>i||0>r||0>s||e>0xffffffffffff||i>4095||r>1073741823||s>4294967295)throw new RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=e/Math.pow(2,40),n[1]=e/Math.pow(2,32),n[2]=e/Math.pow(2,24),n[3]=e/Math.pow(2,16),n[4]=e/256,n[5]=e,n[6]=112|i>>>8,n[7]=i,n[8]=128|r>>>24,n[9]=r>>>16,n[10]=r>>>8,n[11]=r,n[12]=s>>>24,n[13]=s>>>16,n[14]=s>>>8,n[15]=s,new t(n)}toString(){for(var t="",e=0;this.bytes.length>e;e++)t=t+(this.bytes[e]>>>4).toString(16)+(15&this.bytes[e]).toString(16),3!==e&&5!==e&&7!==e&&9!==e||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new t(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(var e=0;16>e;e++){var i=this.bytes[e]-t.bytes[e];if(0!==i)return Math.sign(i)}return 0}},gr=class{generate(){var t=this.generateOrAbort();if(!C(t))return t;this.Ct=0;var e=this.generateOrAbort();if(C(e))throw new Error("Could not generate UUID after timestamp reset");return e}generateOrAbort(){var t,e=(t=Date.now(),F(t)&&isFinite(t)?Math.min(Math.max(Math.floor(t),0),0xffffffffffff):0);if(e>this.Ct)this.Ct=e,this.It();else{if(this.Ct>=e+1e4)return;this.Mt++,this.Mt>4398046511103&&(this.Ct++,this.It())}return fr.fromFieldsV7(this.Ct,Math.trunc(this.Mt/Math.pow(2,30)),this.Mt&Math.pow(2,30)-1,this.Tt.nextUint32())}It(){this.Mt=1024*this.Tt.nextUint32()+(1023&this.Tt.nextUint32())}constructor(){this.Ct=0,this.Mt=0,this.Tt=new br}},mr=t=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t},br=class{nextUint32(){return this.Rt.length>this.Et||((null!=cr?cr:cr="u">typeof window&&!C(window.crypto)&&crypto.getRandomValues?t=>crypto.getRandomValues(t):mr)(this.Rt),this.Et=0),this.Rt[this.Et++]}constructor(){this.Rt=new Uint32Array(8),this.Et=1/0}},yr=()=>wr().toString(),wr=()=>(_r||(_r=new gr)).generate(),$r="",Sr=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var xr=null,Er={$t(){if(!D(xr))return xr;if(xr=!1,l)try{var t="__ph_cookie_support_"+yr();Er.At(t,"xyz"),xr='"xyz"'===pr(t),Er.Pt(t)}catch(t){xr=!1}return xr},Ft(t){de.error("cookieStore error: "+t)},Ot:pr,Lt(t){var e;try{e=JSON.parse(Er.Ot(t))||{}}catch(t){}return e},At(t,e,i,r,s){if(!l)return!1;try{var n="",o="",a=function(t,e){if(e){var i=function(t,e){if(void 0===e&&(e=l),$r)return $r;if(!e)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var i=t.split("."),r=Math.min(i.length,8),s="dmn_chk_"+yr();!$r&&r--;){var n=i.slice(r).join("."),o=s+"=1;domain=."+n+";path=/";e.cookie=o+";max-age=3",e.cookie.includes(s)&&(e.cookie=o+";max-age=0",$r=n)}return $r}(t);if(!i){var r=(t=>{var e=t.match(Sr);return e?e[0]:""})(t);r!==i&&de.info("Warning: cookie subdomain discovery mismatch",r,i),i=r}return i?"; domain=."+i:""}return""}(l.location.hostname,r);if(i){var h=new Date;h.setTime(h.getTime()+864e5*i),n="; expires="+h.toUTCString()}s&&(o="; secure");var u=t+"="+encodeURIComponent(JSON.stringify(e))+n+"; SameSite=Lax; path=/"+a+o;return u.length>3686.4&&de.warn("cookieStore warning: large cookie, len="+u.length),l.cookie=u,!0}catch(t){return!1}},Pt(t,e){if(null!=l&&l.cookie&&(!e||!D(pr(t))))try{Er.At(t,"",-1,e)}catch(t){return}}},Tr=null,kr={$t(){if(!D(Tr))return Tr;var t=!0;if(C(n))t=!1;else try{var e="__mplssupport__";kr.At(e,"xyz"),'"xyz"'!==kr.Ot(e)&&(t=!1),kr.Pt(e)}catch(e){t=!1}return t||de.error("localStorage unsupported; falling back to cookie store"),Tr=t,t},Ft(t){de.error("localStorage error: "+t)},Ot(t){try{return null==n?void 0:n.localStorage.getItem(t)}catch(t){kr.Ft(t)}return null},Lt(t){try{return JSON.parse(kr.Ot(t))||{}}catch(t){}return null},At(t,e){try{return null==n||n.localStorage.setItem(t,JSON.stringify(e)),!0}catch(t){kr.Ft(t)}return!1},Pt(t){try{null==n||n.localStorage.removeItem(t)}catch(t){kr.Ft(t)}}},Pr=[Pe,ye,Te,we,Oe,xe,Se,$e,Re],Rr=[We,ze,_i,pi,Di,Mi,Je,Ri],Ir=t=>t+"_cpm",Or=["__proto__","constructor","prototype"],Cr=t=>{if(!I(t))return{};var e={};return Object.keys(t).forEach(i=>{-1===Or.indexOf(i)&&(e[i]=t[i])}),e},Ar=function(t,e){void 0===e&&(e=[]);var i={};return[...Rr,...e].forEach(e=>{var r=t[e];C(r)||D(r)||""===r||(i[e]=r)}),i},Mr=t=>{for(var e=5381,i=2166136261,r=0;t.length>r;r++){var s=t.charCodeAt(r);e=33*e^s,i=Math.imul(i^s,16777619)}return t.length.toString(36)+"."+(e>>>0).toString(36)+"."+(i>>>0).toString(36)},Dr=(t,e)=>({p:e,f:Mr(JSON.stringify(t))}),Nr=(t,e)=>{if(!e)return{properties:[],isValid:!1};try{var i=Er.Lt(Ir(t)),r=(null==i?void 0:i.f)===Mr(e)&&P(i.p);return{properties:r?i.p:[],isValid:r}}catch(t){return{properties:[],isValid:!1}}},Fr=(t,e)=>e+"|"+(Er.Ot(Ir(t))||""),Ur={},Br={$t:()=>!0,Ft(t){de.error("memoryStorage error: "+t)},Ot:t=>t in Ur?Ur[t]:null,Lt:t=>t in Ur?Ur[t]:null,At:(t,e)=>(Ur[t]=e,!0),Pt(t){delete Ur[t]}},Lr=null,jr={$t(){if(!D(Lr))return Lr;if(Lr=!0,C(n))Lr=!1;else try{var t="__support__";jr.At(t,"xyz"),'"xyz"'!==jr.Ot(t)&&(Lr=!1),jr.Pt(t)}catch(t){Lr=!1}return Lr},Ft(t){de.error("sessionStorage error: ",t)},Ot(t){try{return null==n?void 0:n.sessionStorage.getItem(t)}catch(t){jr.Ft(t)}return null},Lt(t){try{return JSON.parse(jr.Ot(t))||null}catch(t){}return null},At(t,e){try{return null==n||n.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch(t){jr.Ft(t)}return!1},Pt(t){try{null==n||n.sessionStorage.removeItem(t)}catch(t){jr.Ft(t)}}},zr=class{constructor(t){this._instance=t}get Ar(){return this._instance.config}get consent(){return this.Sl()?0:this.xl}isOptedOut(){return"always"===this.Ar.cookieless_mode||this.isRejected()||-1===this.consent&&"on_reject"===this.Ar.cookieless_mode}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Ar.opt_out_capturing_by_default}optInOut(t){this.$l.At(this.Cl,t?1:0,this.Ar.cookie_expiration,this.Ar.cross_subdomain_cookie,this.Ar.secure_cookie)}reset(){this.$l.Pt(this.Cl,this.Ar.cross_subdomain_cookie)}get Cl(){var t=this._instance.config,e=t.token,i=t.opt_out_capturing_cookie_prefix;return t.consent_persistence_name||(i?i+e:"__ph_opt_in_out_"+e)}get xl(){var t=this.$l.Ot(this.Cl);return q(t)?1:S(G,t)?0:-1}get $l(){var t=this.Ar.opt_out_capturing_persistence_type,e="localStorage"===t?kr:Er,i=e.$t()?e:Br;if(!this.Tl||this.Tl!==i){this.Tl=i;var r="localStorage"===t?Er:kr;r.Ot(this.Cl)&&(this.Tl.Ot(this.Cl)||this.optInOut(q(r.Ot(this.Cl))),r.Pt(this.Cl,this.Ar.cross_subdomain_cookie))}return this.Tl}Sl(){return!!this.Ar.respect_dnt&&[null==a?void 0:a.doNotTrack,null==a?void 0:a.msDoNotTrack,f.doNotTrack,null==a?void 0:a.globalPrivacyControl].some(t=>q(t))}},Wr=["next","previous","prev",">","<","→","←","›","‹","»","«","▶","◀","❯","❮","+","-","−","–"];ve("[Dead Clicks]");var qr=t=>{var e,i=!(null==(e=t.instance.persistence)||!e.get_property(ri)),r=t.instance.config.capture_dead_clicks;return B(r)?r:!!I(r)||i},Gr=ve("[SegmentIntegration]");function Hr(t,e,r){void 0===r&&(r=!0);var s=t.config.segment;if(!s)return e();var n,o=(t=>R(t.register))(n=s)?{analytics:n}:n,a=o.analytics,l=o.filterProperties;!function(t,e,i,r){var s=e=>{var s=()=>e.anonymousId()||yr();t.config.get_device_id=s,r&&e.id()&&(t.register({distinct_id:e.id(),$device_id:s()}),t.persistence.set_property(Ri,Xi)),i(r?void 0:e.anonymousId()||void 0)},n=e.user();"then"in n&&R(n.then)?n.then(s):s(n)}(t,a,r=>{a.register(function(t,e,r){var s=(void 0===r?{}:r).filterProperties;"undefined"!=typeof Promise&&Promise.resolve||Gr.warn("This browser does not have Promise support, and can not use the segment integration");var n=(r,n)=>{if(!n)return r;var o=!!e&&r.event.anonymousId===e&&!r.event.userId;o||r.event.userId||r.event.anonymousId===t.get_distinct_id()||(Gr.info("No userId set, resetting PostHog"),t.reset()),o||(e=void 0),r.event.userId&&r.event.userId!==t.get_distinct_id()&&(Gr.info("UserId set, identifying with PostHog"),t.identify(r.event.userId));var a=t.calculateEventProperties(n,r.event.properties);if(!N(s)){var l=r.event.properties||{},h={};for(var u of Object.keys(a))T.call(l,u)||(h[u]=a[u]);var d=((t,e)=>{var r=P(t)?t:[t],s=i({},e);for(var n of r)try{if(s=n(s),N(s))return null}catch(t){return Gr.error("Error in Segment filterProperties:",t),null}return s})(s,h);if(N(d))return r;a=d}return r.event.properties=Object.assign({},a,r.event.properties),r};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(t){return n(t,t.event.event)},page(t){return n(t,tr)},identify(t){return n(t,ir)},screen(t){return n(t,"$screen")}}}(t,r,{filterProperties:l})).then(()=>{e()},t=>{Gr.error("Failed to register the Segment integration",t),e()})},r)}var Vr="posthog-js";function Jr(t,e){var r=void 0===e?{}:e,s=r.organization,n=r.projectId,o=r.prefix,a=r.severityAllowList,l=void 0===a?["error"]:a,h=r.sendExceptionsToPostHog,u=void 0===h||h;return e=>{var r,a,h,d,v,c;if("*"!==l&&!l.includes(e.level)||!t.__loaded)return e;e.tags||(e.tags={});var _=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());e.tags["PostHog Person URL"]=_,t.sessionRecordingStarted()&&(e.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var p=(null==(r=e.exception)?void 0:r.values)||[],f=p.map(t=>i({},t,{stacktrace:t.stacktrace?i({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map(t=>i({},t,{platform:"web:javascript"}))}):void 0})),g={$exception_message:(null==(a=p[0])?void 0:a.value)||e.message,$exception_type:null==(h=p[0])?void 0:h.type,$exception_level:e.level,$exception_list:f,$sentry_event_id:e.event_id,$sentry_exception:e.exception,$sentry_exception_message:(null==(d=p[0])?void 0:d.value)||e.message,$sentry_exception_type:null==(v=p[0])?void 0:v.type,$sentry_tags:e.tags};return s&&n&&(g.$sentry_url=(o||"https://sentry.io/organizations/")+s+"/issues/?project="+n+"&query="+e.event_id),u&&(null==(c=t.exceptions)||c.sendExceptionEvent(g)),e}}var Kr=class{constructor(t,e,i,r,s,n){this.name=Vr,this.setupOnce=function(o){o(Jr(t,{organization:e,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}},Yr=class{constructor(t){this.Pl=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(de.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.Rl=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.Al()}Al(){var t;this.Fl=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.Pl)}destroy(){var t;null==(t=this.Fl)||t.call(this),this.Fl=void 0}doPageView(t,e){var i,r=this.Ol(t,e);return this.Rl={pathname:null!==(i=null==n?void 0:n.location.pathname)&&void 0!==i?i:"",pageViewId:e,timestamp:t},this._instance.scrollManager.resetContext(),r}doPageLeave(t){var e;return this.Ol(t,null==(e=this.Rl)?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.Rl)?void 0:t.pageViewId}}Ol(t,e){var i=this.Rl;if(!i)return{$pageview_id:e};var r={$pageview_id:e,$prev_pageview_id:i.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var n=s.maxScrollHeight,o=s.lastScrollY,a=s.maxScrollY,l=s.maxContentHeight,h=s.lastContentY,u=s.maxContentY;if(!(C(n)||C(o)||C(a)||C(l)||C(h)||C(u))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),h=Math.ceil(h),u=Math.ceil(u);var d=n>1?K(o/n,0,1,de):1,v=n>1?K(a/n,0,1,de):1,c=l>1?K(h/l,0,1,de):1,_=l>1?K(u/l,0,1,de):1;r=or(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:v,$prev_pageview_last_content:h,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:_})}}return i.pathname&&(r.$prev_pageview_pathname=i.pathname),i.timestamp&&(r.$prev_pageview_duration=(t.getTime()-i.timestamp.getTime())/1e3),r}},Xr=["flags","surveys"],Qr={[je]:{exposure:"hidden"},[Ge]:{exposure:"hidden"},[He]:{exposure:"hidden"},[Xe]:{exposure:"hidden"},[Je]:{exposure:"hidden"},[Ye]:{exposure:"hidden"},[De]:{exposure:"event"},[Qe]:{exposure:"hidden"},[ni]:{exposure:"hidden"},[Ze]:{exposure:"event"},[ti]:{exposure:"hidden"},[ei]:{exposure:"event"},[ii]:{exposure:"event"},[ri]:{exposure:"event"},[si]:{exposure:"hidden"},[oi]:{exposure:"event"},[ai]:{exposure:"hidden"},[li]:{exposure:"hidden"},[_i]:{exposure:"hidden"},[pi]:{exposure:"event"},[hi]:{exposure:"event",shouldSkipFromEventProperties:t=>D(t)},[fi]:{exposure:"event"},[gi]:{exposure:"event"},[mi]:{exposure:"event"},[bi]:{exposure:"event"},[yi]:{exposure:"hidden"},[Te]:{exposure:"hidden",storageGroup:"flags"},[ye]:{exposure:"hidden",storageGroup:"flags"},[be]:{exposure:"hidden"},[we]:{exposure:"hidden",storageGroup:"flags"},[Oe]:{exposure:"hidden",storageGroup:"flags"},[xe]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Ee]:{exposure:"hidden",storageGroup:"flags"},[Ce]:{exposure:"hidden"},[Ae]:{exposure:"hidden"},[Pe]:{exposure:"hidden"},[ke]:{exposure:"hidden"},[Ne]:{exposure:"hidden",storageGroup:"surveys"},[Fe]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[Ue]:{exposure:"event"},[Be]:{exposure:"hidden"},[Le]:{exposure:"hidden"},[$i]:{exposure:"hidden"},[Si]:{exposure:"hidden"},[xi]:{exposure:"hidden"},[Ei]:{exposure:"event"},[Ti]:{exposure:"event"},[ki]:{exposure:"event"},[Pi]:{exposure:"event"},[Re]:{exposure:"hidden"},[Ie]:{exposure:"hidden"},[wi]:{exposure:"event"},[$e]:{exposure:"hidden"},[Se]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Ri]:{exposure:"hidden"},[Ii]:{exposure:"hidden"},[Oi]:{exposure:"hidden"},[Ci]:{exposure:"hidden"},[Ai]:{exposure:"hidden"},[Mi]:{exposure:"hidden"},[Di]:{exposure:"hidden"},[ui]:{exposure:"event"},[di]:{exposure:"event"},[vi]:{exposure:"event"},[ci]:{exposure:"event"},[Ui]:{exposure:"event"},[Bi]:{exposure:"event"},[Li]:{exposure:"hidden"},[ji]:{exposure:"hidden"},[zi]:{exposure:"hidden"},[Wi]:{exposure:"hidden"},[qi]:{exposure:"hidden"},[Gi]:{exposure:"hidden"},[Hi]:{exposure:"hidden"},[Vi]:{exposure:"hidden"},[Ji]:{exposure:"hidden"},[Ki]:{exposure:"event"}},Zr=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],ts=t=>{var e=Qr[t];if(e)return e;for(var i of Zr){var r=i[1];if(0===t.indexOf(i[0]))return r}};function es(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}var is=t=>{var e,i=null==(e=typeof document>"u"?void 0:document)?void 0:e.createElement("a");return C(i)?null:(i.href=t,i)},rs=(t,e)=>{try{var i;return JSON.stringify(t,(t,e)=>z(e)?(null!=i||(i=new WeakMap),i.has(e)||i.set(e,hr(e)),i.get(e)):"bigint"==typeof e?e.toString():e,e)}catch(e){return s=[],null!==(r=JSON.stringify(t,function(t,e){if("bigint"==typeof e)return e.toString();if("function"!=typeof e&&"symbol"!=typeof e){if(e instanceof Error)return{name:e.name,message:e.message,stack:e.stack};if(e&&"object"==typeof e){for(;s.length>0&&s[s.length-1]!==this;)s.pop();if(s.includes(e))return"[Circular]";s.push(e)}return e}}))&&void 0!==r?r:"null"}var r,s},ss=function(t,e){for(var i,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split(/=(.*)/);if(n[0]===e){i=n;break}}if(!P(i)||2>i.length)return"";var o=i[1].replace(/\+/g," ");try{o=decodeURIComponent(o)}catch(t){de.error("Skipping decoding for malformed query param: "+o)}return o},ns=function(t,e,i){if(!t||!e||!e.length)return t;for(var r=t.split("#"),s=r[1],n=(r[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),h=[],u=0;l.length>u;u++){var d=l[u].split("=");P(d)&&(e.includes(d[0])?h.push(d[0]+"="+i):h.push(l[u]))}var v=a;return null!=o&&(v+="?"+h.join("&")),null!=s&&(v+="#"+s),v},os=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","oppref","bfcid","irclid","_kx"],as=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...os],ls="<masked>",hs=["li_fat_id"];function us(t,e){var i=as.concat(e||[]),r={};return nr(i,function(e){var i=ss(t,e);r[e]=i||null}),r}function ds(t){var e=function(t){return t?0===t.search("https?://(.*)google.([^/?]*)")?"google":0===t.search("https?://(.*)bing.com")?"bing":0===t.search("https?://(.*)yahoo.com")?"yahoo":0===t.search("https?://(.*)duckduckgo.com")?"duckduckgo":null:null}(t),i="yahoo"!=e?"q":"p",r={};if(!D(e)){r.$search_engine=e;var s=l?ss(l.referrer,i):"";s.length&&(r.ph_keyword=s)}return r}function vs(){return navigator.language||navigator.userLanguage}var cs="$direct";function _s(){return(null==l?void 0:l.referrer)||cs}function ps(t,e,i){var r;void 0===i&&(i=!1);var s=t?[...os,...e||[]]:[],n=null==(r=i?te(null==h?void 0:h.href):null==h?void 0:h.href)?void 0:r.substring(0,1e3);return{r:_s().substring(0,1e3),u:n?ns(n,s,ls):void 0}}function fs(t,e){var i;void 0===e&&(e=!1);var r=t.r,s=t.u,n=e?te(s):s,o={$referrer:r,$referring_domain:null==r?void 0:r==cs?cs:null==(i=is(r))?void 0:i.host};if(n){o.$current_url=n;var a=is(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname,or(o,us(n))}return r&&or(o,ds(r)),o}function gs(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var ms={flags:Se,surveys:Fe},bs=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],ys=t=>t+"_cookie_identity_change_pending",ws=t=>{var e="",i=0;for(var r of t){var s=encodeURIComponent(JSON.stringify(r).slice(1,-1)).length;if(i+s>1e3)break;e+=r,i+=s}return e},$s="main",Ss=[Te,ye,we,Oe,xe,Se,Ee,Pe],xs=t=>-1!==Ss.indexOf(t),Es=[Je,Ye],Ts=t=>-1!==Es.indexOf(t),ks=(t,e)=>{try{return JSON.stringify(t)===JSON.stringify(e)}catch(i){return t===e}},Ps=t=>{if(!t)return{};var e=JSON.parse(t);return I(e)?e:{}},Rs=(t,e)=>{nr(t,(i,r)=>{var s=ts(r);s&&"event"!==s.exposure||{}.hasOwnProperty.call(e,r)||delete t[r]})},Is=class{constructor(t,e,r,s){if(void 0===r&&(r=!0),void 0===s&&(s=!t.cookieless_mode),this.Dl={},this.Ll=!1,this.Nl=!1,this.ql=!1,this.jl=!1,this.Bl=!1,this.zl=new Map,this.Hl=!1,this.Ul=!1,this.Wl=!1,this.Vl=new Set,this.Gl=new Set,this.Ar=t,this.Ql=r,this.props={},this.Zl=void 0,this.Jl=(t=>{var e="";return t.token&&(e=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+e+"_posthog"})(t),this.hi=t.disable_persistence||!!e,this.$l=this.Kl(t),this.ql=this.Xl(t),this.load(s),this.Yl(),t.debug&&de.info("Persistence loaded",t.persistence,i({},this.props)),this.update_config(t,t,e),this.save(),n){var o=()=>this.flush();vr(n,"beforeunload",o,{capture:!1}),vr(n,"pagehide",o,{capture:!1}),this.tu=t=>{if(this.Ll&&(!t.storageArea||t.storageArea===(null==n?void 0:n.localStorage))&&t.key)if(t.key!==this.Jl){if(this.ql){var e=Xr.find(e=>t.key===this.eu(e));e&&this.iu(t.key,e)}}else this.iu(t.key,$s)},vr(n,"storage",this.tu)}}markCrossTabFeatureFlagChanges(t){Object.entries(t).forEach(t=>{var e=t[0],i=t[1],r=this.zl.get(e);if(xs(e)&&!0!==r)if(!0!==i){var s=new Set(r||[]);i.forEach(t=>s.add(t)),s.size&&this.nu(e,s)}else this.nu(e,!0)})}onCrossTabFeatureFlagChange(t){return this.Gl.add(t),()=>this.Gl.delete(t)}destroy(){this.tu&&n&&(n.removeEventListener("storage",this.tu),this.tu=void 0),this.Gl.clear()}iu(t,e,i){if(void 0===i&&(i=!0),this.hi)return!1;var r,s;try{if(s=kr.Ot(t),D(s)){var n=this.su(e);return n.storageValue=null,e!==$s&&(n.persisted=!1),!1}r=Ps(s)}catch(t){return!1}var o=e===$s?r:kr.Lt(this.Jl);if(o&&this.ru(o))return!1;var a=this.ou(r,e,i);return e===$s&&this.ql&&!ks(this.au().main,r)||this.lu(r,e,!0,s),a}ru(t){var e=this.props[ze],i=t[ze];return!C(e)&&!C(i)&&e!==i}lu(t,e,i,r){var s=this.su(e);s.storageValue=r,e!==$s&&(s.persisted=i);try{s.fingerprint=this.uu(t,e)}catch(t){s.fingerprint=void 0}}ou(t,e,i){var r=!1;return Ss.forEach(i=>{var s,n=null==(s=ts(i))?void 0:s.storageGroup;if(!(e===$s&&this.ql&&n||e!==$s&&n!==e)){var o=i in t,a=this.cu(i,o?t[i]:void 0),l=this.zl.has(i)?i in this.props:o;l===i in this.props&&ks(a,this.props[i])||(l?this.hu(i,a,!1):this.du(i,!1),r=!0)}}),r&&i&&this.Gl.forEach(t=>t()),r}vu(){if(!this.Ll)return!1;try{this.Wl=!1;var t,e=kr.Ot(this.Jl),i=this.su($s),r=!1,s=!1;if(e!==i.storageValue)if(D(e))i.storageValue=null;else{if(t=Ps(e),this.Wl=!this.Ul&&this.ru(t),this.Wl)return!1;s=this.ou(t,$s,!1),!this.ql||ks(this.au().main,t)?this.lu(t,$s,!0,e):i.storageValue=e,r=!0}return this.ql&&Xr.forEach(e=>{var i=kr.Ot(this.eu(e)),n=this.su(e),o=t||{},a=r&&Ss.some(t=>{var i;return(null==(i=ts(t))?void 0:i.storageGroup)===e&&t in o});if(i!==n.storageValue||a){if(D(i))return n.storageValue=null,n.persisted=!1,void(a&&(s=this.ou(o,e,!1)||s));var l=Ps(i);s=this.ou(l,e,!1)||s,this.lu(l,e,!0,i)}}),s}catch(t){return!1}}nu(t,e){this.zl.set(t,e);var i=ts(t);null!=i&&i.volatile||(this.su((this.ql?null==i?void 0:i.storageGroup:void 0)||$s).fingerprint=void 0,this.fu(t))}pu(){Ss.forEach(t=>this.zl.set(t,!0))}Yl(){if(this.Ll)try{var t=kr.Ot(this.Jl),e=Ps(t);this.su($s).storageValue=t,Ss.forEach(t=>{var i,r=this.ql?null==(i=ts(t))?void 0:i.storageGroup:void 0,s=r?kr.Ot(this.eu(r)):null;if(r){var n=this.su(r);n.storageValue=s,n.persisted=!D(s)}var o=r&&!D(s)?Ps(s):e;t in this.props?this.gu(t,o[t],this.props[t]):t in o&&this.nu(t,!0)})}catch(t){}}cu(t,e){var r=this.zl.get(t);if(!r)return e;if(!0===r)return this.props[t];if("$active_feature_flags"===t){var s=new Set(P(e)?e:[]),n=new Set(P(this.props[t])?this.props[t]:[]);return r.forEach(t=>n.has(t)?s.add(t):s.delete(t)),Array.from(s)}var o=I(e)?i({},e):{},a=I(this.props[t])?this.props[t]:{};return r.forEach(t=>{t in a?o[t]=a[t]:delete o[t]}),o}gu(t,e,i){if(xs(t)){var r=this.zl.get(t);if(!0!==r){var s=e;if(this.Ll)try{var n,o=this.ql?null==(n=ts(t))?void 0:n.storageGroup:void 0,a=o?this.eu(o):this.Jl;s=Ps(kr.Ot(a))[t]}catch(t){}var l=new Set(r||[]);if("$active_feature_flags"===t){if(!C(e)&&!P(e)||!C(s)&&!P(s)||!P(i))return void this.nu(t,!0);var h=new Set(e||[]),u=new Set(s||[]),d=new Set(i);new Set([...h,...d]).forEach(t=>{h.has(t)!==d.has(t)&&l.add(t)}),l.forEach(t=>{u.has(t)===d.has(t)&&l.delete(t)})}else{if(!I(i))return void(ks(s,i)?this.zl.delete(t):this.nu(t,!0));if(!C(e)&&!I(e)||C(e)&&O(i)&&C(s))return void this.nu(t,!0);var v=I(e)?e:{},c=I(s)?s:{};new Set([...Object.keys(v),...Object.keys(i)]).forEach(t=>{t in v==t in i&&ks(v[t],i[t])||l.add(t)}),l.forEach(t=>{t in c==t in i&&ks(c[t],i[t])&&l.delete(t)})}l.size?this.nu(t,l):this.zl.delete(t)}}}mu(){var t,e=null==(t=this.Ar)?void 0:t.persistence_save_debounce_ms;return F(e)&&e>0?e:0}yu(t){if(this.Ar.cookieWinsOnConflict&&"localstorage+cookie"===this.Ar.persistence.toLowerCase())if(t)try{var e=Ar(t,this.Ar.cookie_persisted_properties||[]),i=Dr(e,this.Ar.cookie_persisted_properties||[]),r=JSON.stringify(e)+"|"+JSON.stringify(i),s=Er.Ot(this.Jl)||void 0;s&&Fr(this.Jl,s)===r&&(this.bu=r,this._u=s)}catch(t){}else try{var n=Er.Ot(this.Jl)||void 0;this.bu=n?Fr(this.Jl,n):void 0,this._u=n}catch(t){}}syncCookieProperties(){return this.wu(this.Ar)}wu(t,e){if(void 0===e&&(e=!1),this.hi&&!e||this.Bl||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;var i;try{i=Er.Ot(this.Jl)||void 0}catch(t){}if(!i||i===this._u)return!1;var r,s=Fr(this.Jl,i);try{r=Cr(JSON.parse(i))}catch(t){return!1}if((Er.Ot(this.Jl)||void 0)!==i)return!1;this.bu=s,this._u=i;var n=Nr(this.Jl,i),o=[...Rr,...n.properties],a={};if(Object.keys(r).forEach(t=>{var e=r[t];(C(e)||D(e)||""===e||"$user_state"===t&&"anonymous"!==e&&"identified"!==e)&&(a[t]=!0,delete r[t])}),O(r))return!1;var l="distinct_id"in r||"anonymous"===r.$user_state||"identified"===r.$user_state,h=this.props,u=h[ze],d=h[Ri],v=or({},h);[...Rr,...t.cookie_persisted_properties||[]].forEach(t=>{if(-1!==o.indexOf(t)&&!(t in r)&&!a[t]&&(l||"distinct_id"!==t&&"$user_state"!==t)){var e=v[t];(n.isValid||-1===Rr.indexOf(t)||!1!==e&&0!==e)&&delete v[t]}}),this.props=or(v,r),Ss.forEach(t=>{var e=t in this.props;t in h===e&&ks(h[t],this.props[t])||(e?this.gu(t,h[t],this.props[t]):this.nu(t,!0))}),!l||"$user_state"in r||"$user_state"in this.props||this.hu(Ri,Yi);var c=this.props[ze],_=this.props[Ri];return!l||c===u&&_===d||(this.Ul=!0,this.jl=!0,jr.At(ys(this.Jl),!0),this.du(Pe),this.du(ye),this.du(Te),this.du(we),this.du(Oe),this.du(xe),this.du(Se),this.du($e),this.du(Re),"anonymous"!==_||"identified"!==d&&"anonymous"!==r.$user_state&&(C(u)||c===u)||(Rs(this.props,r),this.du(ke)),"identified"===_?this.props.$user_id=c:delete this.props.$user_id,this.du(Ge)),!0}consumeCookieIdentityChange(){var t=ys(this.Jl),e=this.jl||!!jr.Ot(t);return this.jl=!1,e&&jr.Pt(t),e}ku(t){return void 0===t&&(t=!1),!(this.Bl||this.hi&&!t||!this.Ar.cookieWinsOnConflict||"localstorage+cookie"!==this.Ar.persistence.toLowerCase()||(this.Bl=!0,0))}Su(){this.Bl&&(C(this.xu)||(clearTimeout(this.xu),this.xu=void 0),delete this.Dl[$s],this.$u(!0))}Cu(t){if(void 0===t&&(t=!0),this.Bl)try{t?this.Su():C(this.xu)||(clearTimeout(this.xu),this.xu=void 0)}finally{this.Bl=!1}}isDisabled(){return!!this.hi}Kl(t){-1===bs.indexOf(t.persistence.toLowerCase())&&(de.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var e,r=function(t,e,r){void 0===t&&(t=[]),void 0===e&&(e=!1),void 0===r&&(r=()=>!1);var s=[...Rr,...t];return i({},kr,{Tu(t){return[Er.Ot(t),Er.Ot(Ir(t)),kr.Ot(t)].join("\0")},Lt(t){try{var i,n={};try{i=Er.Ot(t)||void 0,n=i?Cr(JSON.parse(i)):{}}catch(t){}var o,a=JSON.parse(kr.Ot(t)||"{}");if(e){var l=Nr(t,i),h=[...Rr,...l.properties],u={};Object.keys(n).forEach(t=>{var e=n[t];D(e)||""===e||"$user_state"===t&&"anonymous"!==e&&"identified"!==e||(u[t]=e)});var d="distinct_id"in u||"anonymous"===u.$user_state||"identified"===u.$user_state;if(Object.keys(u).length>0){var v,c=a[ze],_=null!==(v=a.$user_state)&&void 0!==v?v:"anonymous";s.forEach(t=>{if(-1!==h.indexOf(t)&&!(t in n)&&(d||"distinct_id"!==t&&"$user_state"!==t)){var e=a[t];(l.isValid||-1===Rr.indexOf(t)||!1!==e&&0!==e)&&delete a[t]}}),!d||"$user_state"in n||"$user_state"in a||(a[Ri]=Yi),!d||("distinct_id"in u?u[ze]:a[ze])===c&&("$user_state"in u?u[Ri]:a[Ri])===_||(Pr.forEach(t=>delete a[t]),"identified"===u.$user_state&&"distinct_id"in u?a.$user_id=u[ze]:delete a.$user_id,"identified"!==u.$user_state&&(delete a[wi],delete a[ke]),delete a.__alias)}o=or(a,u)}else o=or(n,a);return r()||kr.At(t,o),o}catch(t){}return null},At(i,r,s,n,o,a){var l=kr.At(i,r,void 0,void 0,a);try{var h=Ar(r,t);if(Object.keys(h).length){if(e){var u=Ir(i),d=Dr(h,t);if(Er.At(u,d,s,n,o,a),Er.Ot(u)!==JSON.stringify(d)){Er.Pt(u,n);var v=Ar(r);return Er.At(i,v,s,n,o,a),l}}Er.At(i,h,s,n,o,a)}}catch(t){kr.Ft(t)}return l},Pt(t,e){try{null==n||n.localStorage.removeItem(t),Er.Pt(t,e),Er.Pt(Ir(t),e)}catch(t){kr.Ft(t)}}})}(t.cookie_persisted_properties||[],t.cookieWinsOnConflict,()=>!!this.hi),s=!1,o=!1,a=t.persistence.toLowerCase();return"localstorage"===a&&kr.$t()?(e=kr,o=!0):"localstorage+cookie"===a&&r.$t()?(e=r,o=!0,s=!0):"sessionstorage"===a&&jr.$t()?e=jr:"memory"===a?e=Br:"cookie"===a&&Er.$t()?(e=Er,s=!0):r.$t()?(e=r,o=!0,s=!0):Er.$t()?(e=Er,s=!0):e=Br,this.Ll=o,this.Nl=s,e}eu(t){return this.Jl+"__"+t}Xl(t){return this.Ll&&!!t.split_storage}properties(){var t={};return nr(this.props,(e,i)=>{var r=ts(i);if(!r||"event"===r.exposure){if(null!=r&&null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(e))return;t[i]=e}}),t}load(t){if(void 0===t&&(t=!1),!this.hi||t){var e=this.Ar.cookieWinsOnConflict&&"localstorage+cookie"===this.Ar.persistence.toLowerCase(),i=e?kr.Lt(this.Jl):null,r={};if(e)try{nr(r=Cr(Er.Lt(this.Jl)),(t,e)=>{(C(t)||D(t)||""===t)&&delete r[e]})}catch(t){}var s=this.$l.Lt(this.Jl);if(s&&(this.props=or({},s)),this.ql&&this.Iu(),e&&s){var n,o,a=null==i?void 0:i[ze],l=null!==(n=null==i?void 0:i.$user_state)&&void 0!==n?n:"anonymous",h=s[ze],u=null!==(o=s.$user_state)&&void 0!==o?o:"anonymous";if(h!==a||u!==l){this.jl=!0,this.hi||jr.At(ys(this.Jl),!0);var d=or({},this.props);Pr.forEach(t=>delete d[t]),"anonymous"!==u||"identified"!==l&&"anonymous"!==r.$user_state&&(C(a)||h===a)||(Rs(d,r),delete d[ke]),this.props=d;var v=new Set;Pr.forEach(t=>{var e,i=null==(e=ts(t))?void 0:e.storageGroup;i&&v.add(i)}),v.forEach(t=>{if(!this.hi){var e={};nr(this.props,(i,r)=>{var s;(null==(s=ts(r))?void 0:s.storageGroup)===t&&(e[r]=i)}),O(e)?(kr.Pt(this.eu(t)),this.Dl[t]={}):kr.At(this.eu(t),e)&&(this.Dl[t]={persisted:!0,fingerprint:this.uu(e,t)})}})}}jr.Ot(ys(this.Jl))&&(this.jl=!0)}}Iu(){for(var t of Xr){var e=kr.Lt(this.eu(t));if(e&&!O(e)){var i=this.su(t);i.persisted=!0,this.Mu(t)||(i.fingerprint=this.uu(e,t)),this.Eu(t,e)||or(this.props,e)}}}Mu(t){return Object.keys(this.props).some(e=>{var i;return(null==(i=ts(e))?void 0:i.storageGroup)===t})}Eu(t,e){var i=ms[t];if(!i)return!1;var r=e[i],s=this.props[i];return F(r)&&F(s)&&s>r}refreshKey(t){this.Pu([t])}Pu(t){if(!this.hi){var e,i=!1,r=()=>(i||(e=this.$l.Lt(this.Jl),i=!0),e);t.forEach(t=>{var e;if(!this.Vl.has(t)){var i=this.ql?null==(e=ts(t))?void 0:e.storageGroup:void 0,s=i?kr.Lt(this.eu(i)):r();if(s&&t in s)this.hu(t,s[t],!1);else{if(i){var n=r();if(n&&t in n)return void this.hu(t,n[t],!1)}this.du(t,!1)}}})}}refreshMetaIdentifiers(){if(!this.hi){var t=this.Ru();(C(t)||t!==this.Au)&&(this.Pu(Es),this.Fu(t))}}Fu(t){void 0===t&&(t=this.Ru()),this.Au=0===this.Vl.size?t:void 0}Ru(){var t=this.$l.Tu?this.$l.Tu(this.Jl):this.$l.Ot(this.Jl);return A(t)?t:void 0}save(){if(!this.hi){var t=this.mu();t>0?C(this.xu)&&(this.xu=setTimeout(()=>{this.xu=void 0,this.$u()},t)):this.$u()}}flush(){C(this.xu)||(clearTimeout(this.xu),this.xu=void 0,this.$u())}$u(t){if(void 0===t&&(t=!1),!(this.hi||this.Bl&&!t)){t||(this.syncCookieProperties(),this.Ar.cookieWinsOnConflict&&"localstorage+cookie"===this.Ar.persistence.toLowerCase()||this.refreshMetaIdentifiers());var e=!t&&!this.Hl;e||(this.Wl=!1);var i=!!e&&this.vu();if(this.Wl)this.Ar.debug&&de.warn("skipping persistence write because storage belongs to a different distinct ID");else{if(this.ql)return this.Ou(),void(i&&this.Gl.forEach(t=>t()));var r=this.Du(this.$l,this.Jl,this.props,$s);"written"===r&&this.yu(this.props),"failed"!==r&&(this.zl.clear(),this.Ul=!1,this.Vl.clear()),"written"===r&&this.Fu(),i&&this.Gl.forEach(t=>t())}}}Ou(){var t=this,e=this.au(),i=e.main,r=e.groups,s=this.Du(this.$l,this.Jl,i,$s);"written"===s&&this.yu(i),"failed"!==s&&(this.Ul=!1,this.Vl.clear(),Ss.forEach(t=>{var e;null!=(e=ts(t))&&e.storageGroup||this.zl.delete(t)})),"written"===s&&this.Fu();var n=function(e){var i,s=r[e];if(O(s)&&(null==(i=t.Dl[e])||!i.persisted))return Ss.forEach(i=>{var r;(null==(r=ts(i))?void 0:r.storageGroup)===e&&t.zl.delete(i)}),1;var n=t.Du(kr,t.eu(e),s,e);"failed"!==n&&Ss.forEach(i=>{var r=ts(i);(null==r?void 0:r.storageGroup)!==e||"written"!==n&&r.volatile||t.zl.delete(i)})};for(var o of Xr)if(n(o))continue}au(){var t={},e={flags:{},surveys:{}};return nr(this.props,(i,r)=>{var s,n=null==(s=ts(r))?void 0:s.storageGroup;n?e[n][r]=i:t[r]=i}),{main:t,groups:e}}uu(t,e){if(e===$s)return JSON.stringify(t)+"|"+this.Lu+"|"+this.Nu+"|"+this.qu;var i={};return nr(t,(t,e)=>{var r;i[e]=null!=(r=ts(e))&&r.volatile?"__volatile__":t}),JSON.stringify(i)}Du(t,e,i,r){var s,n=this.su(r);if(r!==$s&&!n.dirty&&!C(n.fingerprint))return"skipped";try{if((s=this.uu(i,r))===n.fingerprint)return n.dirty=!1,"skipped"}catch(t){s=void 0}return t.At(e,i,this.Lu,this.Nu,this.qu,this.Ar.debug)?(n.dirty=!1,r!==$s&&(n.persisted=!0),C(s)||(n.fingerprint=s),this.Ll&&(n.storageValue=kr.Ot(e)),"written"):(this.Ar.debug&&de.warn('failed to persist storage entry "'+e+'"; will retry on next save'),"failed")}remove(t){var e=(void 0===t?{}:t).keepGroupEntries,i=void 0!==e&&e;if(this.pu(),C(this.xu)||(clearTimeout(this.xu),this.xu=void 0),this.$l.Pt(this.Jl,!1),this.$l.Pt(this.Jl,!0),!i&&this.Ql)for(var r of Xr)kr.Pt(this.eu(r));i?delete this.Dl[$s]:this.Dl={},this.bu=void 0,this._u=void 0}clear(){this.remove(),this.props={}}register_once(t,e,i){if(I(t)){this.syncCookieProperties(),C(e)&&(e="None"),this.Lu=C(i)?this.ju:i;var r=!1;if(nr(t,(t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this.hu(i,t),r=!0)}),r)return this.save(),!0}return!1}register(t,e){if(I(t)){this.syncCookieProperties(),this.Lu=C(e)?this.ju:e;var i=!1;if(nr(t,(e,r)=>{t.hasOwnProperty(r)&&(this.props[r]!==e||I(e)||P(e))&&(this.hu(r,e),i=!0)}),i)return this.save(),!0}return!1}unregister(t){this.syncCookieProperties();var e="string"==typeof t?[t]:t,i=!1;for(var r of e)r in this.props&&(this.du(r),i=!0);i&&this.save()}update_campaign_params(){var t=null==l?void 0:l.URL;if(t!==this.Zl){var e=function(t,e,i){if(!l)return{};var r,s=e?[...os,...i||[]]:[],n=us(ns(l.URL,s,ls),t);return or((r={},nr(hs,function(t){var e=pr(t);r[t]=e||null}),r),n)}(this.Ar.custom_campaign_params,this.Ar.mask_personal_data_properties,this.Ar.custom_personal_data_properties),i=!O(lr(e));return i&&this.register(e),this.Zl=t,i?e:void 0}}update_search_keyword(){var t;this.register((t=null==l?void 0:l.referrer)?ds(t):{})}update_referrer_info(){var t;this.register_once({$referrer:_s(),$referring_domain:null!=l&&l.referrer&&(null==(t=is(l.referrer))?void 0:t.host)||cs},void 0)}set_initial_person_info(){if(!this.props.$initial_campaign_params&&!this.props.$initial_referrer_info){var t=ps(this.Ar.mask_personal_data_properties,this.Ar.custom_personal_data_properties,this.Ar.disable_capture_url_hashes);this.register_once({[Mi]:this.Nl?{r:ws(t.r),u:t.u?ws(t.u):void 0}:t},void 0)}}get_initial_props(){var t={};nr([Ai,Ci],e=>{var i=this.props[e];i&&nr(i,function(e,i){t["$initial_"+x(i)]=e})});var e=this.props[Mi];return e&&or(t,function(t,e){void 0===e&&(e=!1);var i=fs(t,e),r={};return nr(i,function(t,e){r["$initial_"+x(e)]=t}),r}(e,this.Ar.disable_capture_url_hashes)),t}safe_merge(t){return nr(this.props,function(e,i){i in t||(t[i]=e)}),t}update_config(t,e,r){var s=t.persistence!==e.persistence,n=!((t,e)=>{if(t.length!==e.length)return!1;var i=[...t].sort(),r=[...e].sort();return i.every((t,e)=>t===r[e])})(t.cookie_persisted_properties||[],e.cookie_persisted_properties||[]),o=s||n,a=t.cookieWinsOnConflict!==e.cookieWinsOnConflict,l=t.disable_persistence||!!r,h=!!this.hi&&!l;l||this.wu(e,h),this.Ar=t,!l&&(s||n||a)&&(this.bu=void 0,this._u=void 0,this.wu(i({},t,{cookie_persisted_properties:e.cookie_persisted_properties}),h));var u=o||a?this.Kl(t):this.$l;this.Bu();var d=this.Xl(t),v=o||d!==this.ql,c=!l&&(v||t.cross_subdomain_cookie!==this.Nu||t.secure_cookie!==this.qu)&&this.ku(h);this.Hl=v;try{if(this.ju=this.Lu=t.cookie_expiration,this.set_disabled(l),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),v){var _=this.props;this.clear(),this.$l=u,this.ql=d,this.props=_,this.save()}else a&&(this.$l=u,l||(delete this.Dl[$s],this.$u()))}finally{this.Hl=!1,c&&this.Cu()}}Bu(){var t=this.props[Mi];if(this.Nl&&I(t)&&"string"==typeof t.r){var e=ws(t.r),r="string"==typeof t.u?ws(t.u):t.u;e===t.r&&r===t.u||this.hu(Mi,i({},t,{r:e,u:r}))}}set_disabled(t){this.hi=t,this.hi?this.remove():this.save()}set_cross_subdomain(t){t!==this.Nu&&(this.Nu=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.qu&&(this.qu=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,e){var i=this.props.__timers||{};i[t]=e,this.hu(Xe,i),this.save()}remove_event_timer(t){var e=this.props.__timers||{},i=e[t];return C(i)||(delete e[t],this.hu(Xe,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this.hu(t,e),this.save()}hu(t,e,i){var r;void 0===i&&(i=!0);var s=this.props[t];this.props[t]=e,i&&("distinct_id"!==t&&"$user_state"!==t||s===e||(this.Ul=!0),Ts(t)&&!ks(s,e)&&this.Vl.add(t),this.gu(t,s,e),null!=(r=ts(t))&&r.volatile||this.fu(t))}du(t,e){void 0===e&&(e=!0),delete this.props[t],e&&(xs(t)&&this.nu(t,!0),Ts(t)&&this.Vl.add(t),this.fu(t))}fu(t){var e,i=null==(e=ts(t))?void 0:e.storageGroup;i&&(this.su(i).dirty=!0)}su(t){return this.Dl[t]||(this.Dl[t]={})}},Os={GZipJS:"gzip-js",Base64:"base64"},Cs={Activation:"events",Cancellation:"cancelEvents"},As={Button:"button",Tab:"tab",Selector:"selector"},Ms={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"},Ds={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},Ns={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},Fs={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},Us={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},Bs={Once:"once",Recurring:"recurring",Always:"always"},Ls={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},js={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"},zs={Popover:"popover",Inline:"inline"};function Ws(t){var e=!0;return{dispose(){if(e){e=!1;var i=t();i&&R(i.then)&&i.then(void 0,()=>{})}}}}var qs={backgroundColor:"#ffffff",textColor:"#1d1f27",buttonColor:"#1d1f27",borderRadius:8,buttonBorderRadius:6,borderColor:"#e5e7eb",fontFamily:"system-ui",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",showOverlay:!0,whiteLabel:!1,dismissOnClickOutside:!0,zIndex:2147483646},Gs={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"},Hs={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"},Vs=ve("[RateLimiter]"),Js=class{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var e=t.text;if(e&&e.length)try{(JSON.parse(e).quota_limited||[]).forEach(t=>{Vs.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4})}catch(t){return void Vs.warn('could not rate limit - continuing. Error: "'+(null==t?void 0:t.message)+'"',{text:e})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return(null==(t=this.instance.config.rate_limiting)?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null==(t=this.instance.config.rate_limiting)?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var e,i,r;void 0===t&&(t=!1);var s=this.captureEventsBurstLimit,n=this.captureEventsPerSecond,o=(new Date).getTime(),a=null!==(e=null==(i=this.instance.persistence)?void 0:i.get_property("$capture_rate_limit"))&&void 0!==e?e:{tokens:s,last:o};a.tokens+=Math.max(0,o-a.last)/1e3*n,a.last=Math.max(a.last,o),a.tokens>s&&(a.tokens=s);var l=1>a.tokens;if(l||t||(a.tokens=Math.max(0,a.tokens-1)),l&&!t){var h=(F(a.dropped)?a.dropped:0)+1;a.dropped=h,!this.lastEventRateLimited&&this.zu(h)&&(a.dropped=0)}return this.lastEventRateLimited=l,null==(r=this.instance.persistence)||r.set_property(Oi,a),{isRateLimited:l,remainingTokens:a.tokens}}Hu(t){var e=this.instance.config.property_denylist;return!P(e)||!e.includes(t)}Uu(){var t;if(this.Hu("$current_url")&&this.Hu("$pathname")&&null!=h&&h.pathname)return""+(null!==(t=h.origin)&&void 0!==t?t:"")+h.pathname}zu(t){var e,i,r=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,n=this.Uu(),o=this.Hu("$session_id")?null==(e=(i=this.instance).get_session_id)?void 0:e.call(i):void 0,a=[t+" event(s) dropped since the last warning",n?"triggered on "+n: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 "+s+" events per second and "+r+" events burst limit."},{skip_client_rate_limiting:!0})}isServerRateLimited(t){var e=this.serverLimits[t||"events"]||!1;return!1!==e&&(new Date).getTime()<e}},Ks=ve("[RemoteConfig]"),Ys=class{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=f._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}Wu(t){var e,i;null!=(e=f.__PosthogExtensions__)&&e.loadExternalDependency?null==(i=f.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",()=>t(this.remoteConfig)):t()}Vu(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t})}load(){try{if(this.remoteConfig)return Ks.info("Using preloaded remote config",this.remoteConfig),void this.Gu(this.remoteConfig);if(this._instance._shouldDisableFlags())return void Ks.warn("Remote config is disabled. Falling back to local config.");this.Wu(t=>{if(!t)return Ks.info("No config found after loading remote JS config. Falling back to JSON."),void this.Vu(t=>{this.Gu(t.json,t)});this.Gu(t)})}catch(t){Ks.error("Error loading remote config",t),this.Gu()}}Gu(t,e){!t&&e&&(0===e.statusCode?e.error||Ks.warn("Failed to fetch remote config from PostHog."):Ks.error("Failed to fetch remote config from PostHog."));try{this._instance.Gu(t?{ok:!0,config:t}:{ok:!1})}catch(t){Ks.error("Error applying remote config",t)}if(!1!==(null==t?void 0:t.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var i;null==(i=this._instance.featureFlags)||i.ensureFlagsLoaded()}catch(t){Ks.error("Error loading feature flags",t)}}},Xs=["fatal","error","warning","log","info","debug"],Qs=Uint8Array,Zs=Uint16Array,tn=Uint32Array,en=new Qs([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]),rn=new Qs([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]),sn=new Qs([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),nn=function(t,e){for(var i=new Zs(31),r=0;31>r;++r)i[r]=e+=1<<t[r-1];var s=new tn(i[30]);for(r=1;30>r;++r)for(var n=i[r];i[r+1]>n;++n)s[n]=n-i[r]<<5|r;return[i,s]},on=nn(en,2),an=on[1];on[0][28]=258,an[258]=28;for(var ln=nn(rn,0)[1],hn=new Zs(32768),un=0;32768>un;++un){var dn=(43690&un)>>>1|(21845&un)<<1;hn[un]=((65280&(dn=(61680&(dn=(52428&dn)>>>2|(13107&dn)<<2))>>>4|(3855&dn)<<4))>>>8|(255&dn)<<8)>>>1}var vn=function(t,e,i){for(var r=t.length,s=0,n=new Zs(e);r>s;++s)++n[t[s]-1];var o,a=new Zs(e);for(s=0;e>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new Zs(1<<e);var l=15-e;for(s=0;r>s;++s)if(t[s])for(var h=s<<4|t[s],u=e-t[s],d=a[t[s]-1]++<<u,v=d|(1<<u)-1;v>=d;++d)o[hn[d]>>>l]=h}else for(o=new Zs(r),s=0;r>s;++s)o[s]=hn[a[t[s]-1]++]>>>15-t[s];return o},cn=new Qs(288);for(un=0;144>un;++un)cn[un]=8;for(un=144;256>un;++un)cn[un]=9;for(un=256;280>un;++un)cn[un]=7;for(un=280;288>un;++un)cn[un]=8;var _n=new Qs(32);for(un=0;32>un;++un)_n[un]=5;var pn=vn(cn,9,0),fn=vn(_n,5,0),gn=function(t){return(t/8|0)+(7&t&&1)},mn=function(t,e,i){(null==e||0>e)&&(e=0),(null==i||i>t.length)&&(i=t.length);var r=new(t instanceof Zs?Zs:t instanceof tn?tn:Qs)(i-e);return r.set(t.subarray(e,i)),r},bn=function(t,e,i){var r=e/8|0;t[r]|=i<<=7&e,t[r+1]|=i>>>8},yn=function(t,e,i){var r=e/8|0;t[r]|=i<<=7&e,t[r+1]|=i>>>8,t[r+2]|=i>>>16},wn=function(t,e){for(var i=[],r=0;t.length>r;++r)t[r]&&i.push({s:r,f:t[r]});var s=i.length,n=i.slice();if(!s)return[new Qs(0),0];if(1==s){var o=new Qs(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort(function(t,e){return t.f-e.f}),i.push({s:-1,f:25001});var a=i[0],l=i[1],h=0,u=1,d=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=s-1;)a=i[i[d].f>i[h].f?h++:d++],l=i[h!=u&&i[d].f>i[h].f?h++:d++],i[u++]={s:-1,f:a.f+l.f,l:a,r:l};var v=n[0].s;for(r=1;s>r;++r)n[r].s>v&&(v=n[r].s);var c=new Zs(v+1),_=$n(i[u-1],c,0);if(_>e){r=0;var p=0,f=_-e,g=1<<f;for(n.sort(function(t,e){return c[e.s]-c[t.s]||t.f-e.f});s>r;++r){var m=n[r].s;if(e>=c[m])break;p+=g-(1<<_-c[m]),c[m]=e}for(p>>>=f;p>0;){var b=n[r].s;e>c[b]?p-=1<<e-c[b]++-1:++r}for(;r>=0&&p;--r){var y=n[r].s;c[y]==e&&(--c[y],++p)}_=e}return[new Qs(c),_]},$n=function(t,e,i){return-1==t.s?Math.max($n(t.l,e,i+1),$n(t.r,e,i+1)):e[t.s]=i},Sn=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new Zs(++e),r=0,s=t[0],n=1,o=function(t){i[r++]=t},a=1;e>=a;++a)if(t[a]==s&&a!=e)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=t[a]}return[i.subarray(0,r),e]},xn=function(t,e){for(var i=0,r=0;e.length>r;++r)i+=t[r]*e[r];return i},En=function(t,e,i){var r=i.length,s=gn(e+2);t[s]=255&r,t[s+1]=r>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var n=0;r>n;++n)t[s+n+4]=i[n];return 8*(s+4+r)},Tn=function(t,e,i,r,s,n,o,a,l,h,u){bn(e,u++,i),++s[256];for(var d=wn(s,15),v=d[0],c=d[1],_=wn(n,15),p=_[0],f=_[1],g=Sn(v),m=g[0],b=g[1],y=Sn(p),w=y[0],S=y[1],x=new Zs(19),E=0;m.length>E;++E)x[31&m[E]]++;for(E=0;w.length>E;++E)x[31&w[E]]++;for(var T=wn(x,7),k=T[0],P=T[1],R=19;R>4&&!k[sn[R-1]];--R);var I,O,C,A,M=h+5<<3,D=xn(s,cn)+xn(n,_n)+o,N=xn(s,v)+xn(n,p)+o+14+3*R+xn(x,k)+(2*x[16]+3*x[17]+7*x[18]);if(D>=M&&N>=M)return En(e,u,t.subarray(l,l+h));if(bn(e,u,1+(D>N)),u+=2,D>N){I=vn(v,c,0),O=v,C=vn(p,f,0),A=p;var F=vn(k,P,0);for(bn(e,u,b-257),bn(e,u+5,S-1),bn(e,u+10,R-4),u+=14,E=0;R>E;++E)bn(e,u+3*E,k[sn[E]]);u+=3*R;for(var U=[m,w],B=0;2>B;++B){var L=U[B];for(E=0;L.length>E;++E)bn(e,u,F[j=31&L[E]]),u+=k[j],j>15&&(bn(e,u,L[E]>>>5&127),u+=L[E]>>>12)}}else I=pn,O=cn,C=fn,A=_n;for(E=0;a>E;++E)if(r[E]>255){var j;yn(e,u,I[257+(j=r[E]>>>18&31)]),u+=O[j+257],j>7&&(bn(e,u,r[E]>>>23&31),u+=en[j]);var z=31&r[E];yn(e,u,C[z]),u+=A[z],z>3&&(yn(e,u,r[E]>>>5&8191),u+=rn[z])}else yn(e,u,I[r[E]]),u+=O[r[E]];return yn(e,u,I[256]),u+O[256]},kn=new tn([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Pn=new Qs(0),Rn=function(){for(var t=new tn(256),e=0;256>e;++e){for(var i=e,r=9;--r;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),In=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function On(t,e){void 0===e&&(e={});var i=function(){var t=4294967295;return{p(e){for(var i=t,r=0;e.length>r;++r)i=Rn[255&i^e[r]]^i>>>8;t=i},d(){return 4294967295^t}}}(),r=t.length;i.p(t);var s,n,o,a,l,h,u=(a=10+((s=e).filename&&s.filename.length+1||0),l=8,function(t,e,i,r,s,n){var o=t.length,a=new Qs(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),h=0;if(!e||8>o)for(var u=0;o>=u;u+=65535){var d=u+65535;o>d?h=En(l,h,t.subarray(u,d)):(l[u]=n,h=En(l,h,t.subarray(u,o)))}else{for(var v=kn[e-1],c=v>>>13,_=8191&v,p=(1<<i)-1,f=new Zs(32768),g=new Zs(p+1),m=Math.ceil(i/3),b=2*m,y=function(e){return(t[e]^t[e+1]<<m^t[e+2]<<b)&p},w=new tn(25e3),S=new Zs(288),x=new Zs(32),E=0,T=0,k=(u=0,0),P=0,R=0;o>u;++u){var I=y(u),O=32767&u,C=g[I];if(f[O]=C,g[I]=O,u>=P){var A=o-u;if((E>7e3||k>24576)&&A>423){h=Tn(t,l,0,w,S,x,T,k,R,u-R,h),k=E=T=0,R=u;for(var M=0;286>M;++M)S[M]=0;for(M=0;30>M;++M)x[M]=0}var D=2,N=0,F=_,U=O-C&32767;if(A>2&&I==y(u-U))for(var B=Math.min(c,A)-1,L=Math.min(32767,u),j=Math.min(258,A);L>=U&&--F&&O!=C;){if(t[u+D]==t[u+D-U]){for(var z=0;j>z&&t[u+z]==t[u+z-U];++z);if(z>D){if(D=z,N=U,z>B)break;var W=Math.min(U,z-2),q=0;for(M=0;W>M;++M){var G=u-U+M+32768&32767,H=G-f[G]+32768&32767;H>q&&(q=H,C=G)}}}U+=(O=C)-(C=f[O])+32768&32767}if(N){w[k++]=268435456|an[D]<<18|ln[N];var V=31&an[D],J=31&ln[N];T+=en[V]+rn[J],++S[257+V],++x[J],P=u+D,++E}else w[k++]=t[u],++S[t[u]]}}h=Tn(t,l,n,w,S,x,T,k,R,u-R,h),n||(h=En(l,h,Pn))}return mn(a,0,r+gn(h)+s)}(n=t,null==(o=e).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+o.mem,a,l,!h)),d=u.length;return function(t,e){var i=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>e.level?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&In(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),i){t[3]=8;for(var r=0;i.length>=r;++r)t[r+10]=i.charCodeAt(r)}}(u,e),In(u,d-8,i.d()),In(u,d-4,r),u}var Cn=!!d||!!u,An=new WeakMap,Mn="text/plain",Dn=0,Nn=!1,Fn=(t,e)=>{var i=t.split("#"),r=i[1],s=i[0].split("?"),n=s[0],o=s[1];if(!o)return t;var a=o.split("&").filter(t=>t.split("=")[0]!==e).join("&");return n+(a?"?"+a:"")+(r?"#"+r:"")},Un=function(t,e,r){var s;void 0===r&&(r=!0);var n=t.split("?"),o=n[0],a=n[1],l=i({},e),h=null!==(s=null==a?void 0:a.split("&").map(t=>{var e,i=t.split("="),s=i[0],n=r&&null!==(e=l[s])&&void 0!==e?e:i[1];return delete l[s],s+"="+n}))&&void 0!==s?s:[],u=function(t,e){var i,r;void 0===e&&(e="&");var s=[];return nr(t,function(t,e){C(t)||C(e)||"undefined"===e||(i=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),r=encodeURIComponent(e),s[s.length]=r+"="+i)}),s.join(e)}(l);return u&&h.push(u),h.length>0?o+"?"+h.join("&"):o},Bn=t=>{if(t.lr)return t.lr;var e=t.data,i=t.compression;if(e){if(i===Os.GZipJS){var r=On(function(t){var e=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var i=new Qs(t.length+(t.length>>>1)),r=0,s=function(t){i[r++]=t},n=0;e>n;++n){if(r+5>i.length){var o=new Qs(r+8+(e-n<<1));o.set(i),i=o}var a=t.charCodeAt(n);128>a?s(a):2048>a?(s(192|a>>>6),s(128|63&a)):a>55295&&57344>a?(s(240|(a=65536+(1047552&a)|1023&t.charCodeAt(++n))>>>18),s(128|a>>>12&63),s(128|a>>>6&63),s(128|63&a)):(s(224|a>>>12),s(128|a>>>6&63),s(128|63&a))}return mn(i,0,r)}(rs(e)),{mtime:0});return{contentType:Mn,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===Os.Base64){var s=(t=>"data="+encodeURIComponent("string"==typeof t?t:rs(t)))(function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(t,e)=>String.fromCharCode(parseInt(e,16)))):t}(rs(e)));return{contentType:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}var n=rs(e);return{contentType:"application/json",body:n,estimatedSize:new Blob([n]).size}}},Ln=t=>{var e,r,s=()=>"sendBeacon"===t.transport?{url:Un(t.url,{compression:Os.Base64}),encodedBody:Bn(i({},t,{compression:Os.Base64,lr:void 0}))}:{url:Fn(t.url,"compression"),encodedBody:Bn(i({},t,{compression:void 0,lr:void 0}))};try{e=Bn(t)}catch(e){if(ne(t.compression,ss(t.url,"compression")))return de.error("Failed to gzip request body, sending uncompressed payload",e),s();throw e}return e&&ne(t.compression,ss(t.url,"compression"))&&!((r=e.body)instanceof ArrayBuffer?se(new Uint8Array(r)):ArrayBuffer.isView(r)&&se(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)))?(Nn=!0,s()):{url:t.url,encodedBody:e}},jn=t=>{try{return Ln(t)}catch(e){return de.error(e),void(null==t.callback||t.callback({statusCode:0,error:e}))}},zn=function(){var t=s(function*(t){var e=yield function(t,e,i){return he.apply(this,arguments)}(rs(t.data),me.DEBUG,{rethrow:!0});if(!e)return t;var r=yield e.arrayBuffer();return i({},t,{lr:{contentType:Mn,body:r,estimatedSize:r.byteLength}})});return function(e){return t.apply(this,arguments)}}(),Wn=/Failed to fetch|NetworkError|Load failed/i,qn=t=>"TypeError"===(null==t?void 0:t.name)&&Wn.test((null==t?void 0:t.message)||""),Gn=t=>{try{var e=function(t,e){if(void 0===e&&(e=Date.now()),"string"==typeof t&&t){var i=t.trim(),r=/^\d+\s*,/.test(i)?i.slice(0,i.indexOf(",")).trim():i;if(/^\d+$/.test(r)){var s=1e3*Math.min(Number(r),300);return s>0?s:void 0}if(/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(r)){var n=/^\w{3} \w{3} /.test(r)?r+" GMT":r,o=Date.parse(n)-e;if(Number.isFinite(o)&&o>0)return Math.min(o,3e5)}}}(t());return C(e)?void 0:Math.min(e,3e4)}catch(t){return}},Hn=t=>{var e=jn(t);if(e){var i=new d;An.set(i,!0);var r=e.encodedBody;i.open(t.method||"GET",e.url,!0);var s=null!=r?r:{},n=s.contentType,o=s.body;nr(t.headers,function(t,e){i.setRequestHeader(e,t)}),n&&i.setRequestHeader("Content-Type",n),t.timeout&&(i.timeout=t.timeout),i.onreadystatechange=()=>{if(4===i.readyState){var e={statusCode:i.status,text:i.responseText};if(200===i.status)try{e.json=JSON.parse(i.responseText)}catch(t){}null==t.callback||t.callback(e,Gn(()=>i.getResponseHeader("Retry-After")))}},i.send(o)}},Vn=t=>{var e=jn(t);if(e){var r=e.url,s=e.encodedBody,n=null!=s?s:{},o=n.contentType,a=n.body,l=n.estimatedSize,h=new Headers;nr(t.headers,function(t,e){h.append(e,t)}),o&&h.append("Content-Type",o);var d=null,c=!1;if(v){var _=new v;d={signal:_.signal,timeout:setTimeout(()=>{c=!0;try{_.abort(Zt("AbortError","PostHog request timed out"+((e=t.timeout)?" after "+e+"ms":"")))}catch(t){f(t)}var e},t.timeout)}}var p=!1,f=e=>{p||(p=!0,c&&"AbortError"===(null==e?void 0:e.name)||qn(e)?de.warn(e):de.error(e),null==t.callback||t.callback({statusCode:0,error:e}))},g=0,m=()=>{Dn-=g,g=0,d&&clearTimeout(d.timeout)};try{var b,y=i({method:(null==t?void 0:t.method)||"GET",headers:h,referrerPolicy:"strict-origin",body:a,signal:null==(b=d)?void 0:b.signal},t.fetchOptions),w=null!=l?l:C(a)?0:void 0;y.keepalive="POST"===y.method&&!t.kl&&!1!==y.keepalive&&y.body===a&&!C(w)&&w>=0&&52428.8>Dn+w,y.keepalive&&(Dn+=g=w),u(r,y).then(e=>e.text().then(i=>{if(!p){var r={statusCode:e.status,text:i};if(200===e.status)try{r.json=JSON.parse(i)}catch(t){de.error(t)}p=!0,m(),null==t.callback||t.callback(r,Gn(()=>e.headers.get("Retry-After")))}})).catch(t=>{m(),f(t)}).finally(m)}catch(t){m(),f(t)}}},Jn=t=>{try{var e,r=Ln(t),s=r.url,n=r.encodedBody,o=null!=n?n:{},l=o.body,h=o.estimatedSize;if(!l)return;var d=l instanceof Blob?l:new Blob([l],{type:o.contentType});if(a.sendBeacon(s,d))return;var v=P(t.data)?t.data:null==(e=t.data)?void 0:e.batch;if(P(v)&&v.length>1&&(null!=h?h:0)>16384){var c=Math.ceil(v.length/2),_=e=>P(t.data)?e:i({},t.data,{batch:e});return Jn(i({},t,{data:_(v.slice(0,c))})),void Jn(i({},t,{data:_(v.slice(c))}))}de.warn("Beacon of ~"+(null!=h?h:0)+" bytes was rejected by the browser, falling back to "+(u?"fetch":"XHR")),u?Vn(i({},t,{kl:!0})):Hn(t)}catch(t){de.warn("Beacon send failed",t)}},Kn=(t,e,r,s)=>{var n="query"===s?"POST"===e?"sent_at":"_":void 0;return Un(r===Os.GZipJS?Fn(t,"compression"):t,i({},n?{[n]:Date.now().toString()}:{},r===Os.GZipJS?{}:{compression:r}))},Yn=(()=>{var t=[];return u&&t.push({transport:"fetch",method:Vn}),d&&t.push({transport:"XHR",method:Hn}),null!=a&&a.sendBeacon&&t.push({transport:"sendBeacon",method:Jn}),t})(),Xn=!Cn&&-1===(null==_?void 0:_.indexOf("MSIE"))&&-1===(null==_?void 0:_.indexOf("Mozilla"));function Qn(t,e,r){var s;r&&(e=i({},e,{callback:t=>r(t)})),t.__loaded?Xn?t.__request_queue.push(e):t.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(null==e.callback||e.callback({statusCode:429})):(e.transport=e.transport||t.config.api_transport,e.headers=i({},t.config.request_headers,e.headers),e.compression="best-available"===e.compression?null!==(s=t.compression)&&void 0!==s?s:e.compressionFallback:e.compression,(C(t.config.disable_beacon)?t.config.__preview_disable_beacon:t.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||t.config.fetch_options,((t,e)=>{var r,s,n,o=i({},t,{callback:null!=e?e:e=>null==t.callback?void 0:t.callback(e)});o.timeout=o.timeout||6e4;var a,l,h,u,d,v=null!==(r=o.transport)&&void 0!==r?r:"fetch";"sendBeacon"===v&&C(o.compression)&&o.data&&(o.compression=Os.Base64),"POST"===o.method&&o.data&&("capture-body"===o.timestampMode?o.data={api_key:null!==(l=null==(d=(u=(P(a=o.data)?a:[a]).map(t=>i({},t,t.timestamp instanceof Date&&!isNaN(t.timestamp.getTime())?{timestamp:t.timestamp.toISOString()}:{})))[0])||null==(h=d.properties)?void 0:h.token)&&void 0!==l?l:null==d?void 0:d.token,batch:u,sent_at:(new Date).toISOString()}:"body"===o.timestampMode&&(o.data=function(t,e){return void 0===e&&(e=(new Date).toISOString()),P(t)?t.map(t=>i({},t,{sent_at:e})):i({},t,{sent_at:e})}(o.data))),o.url=Kn(o.url,o.method,o.compression,o.timestampMode);var _=Yn.filter(t=>!o.disableTransport||!t.transport||!o.disableTransport.includes(t.transport)),p=null!==(s=null==(n=function(t,e){for(var i=0;t.length>i;i++)if(e(t[i]))return t[i]}(_,t=>t.transport===v))?void 0:n.method)&&void 0!==s?s:_[0].method;if(!p)throw new Error("No available transport method");var f=t=>{try{p(t)}catch(t){qn(t)?de.warn(t):de.error(t),null==o.callback||o.callback({statusCode:0,error:t})}};"sendBeacon"!==v&&!o.preferSyncCompression&&o.data&&o.compression===Os.GZipJS&&c&&"undefined"!=typeof Promise&&!Nn?zn(o).then(t=>{f(t)}).catch(e=>{if(oe(e))return Nn=!0,void f(i({},o,{compression:void 0,url:Kn(t.url,t.method,void 0,t.timestampMode)}));(t=>{if(!t||"object"!=typeof t)return!1;var e="name"in t?String(t.name):"";return oe(t)||e===re})(e)&&(Nn=!0),f(o)}):f(o)})(e,(i,s)=>{t.rateLimiter.checkForLimiting(i),400>i.statusCode||null==t.config.on_request_error||t.config.on_request_error(i),r?r(i,s):null==e.callback||e.callback(i)})):e.fireCallbackOnDrop&&(null==e.callback||e.callback({statusCode:0}))}var Zn=class{constructor(t,e){this.Zu=!0,this.Ju=[],this.Ku=K((null==e?void 0:e.flush_interval_ms)||3e3,250,5e3,de.createLogger("flush interval"),3e3),this.Xu=t}enqueue(t){this.Ju.push(t),this.Yu||this.tc()}unload(){this.ec();var t=this.Ju.length>0?this.nc():{},e=Object.values(t);[...e.filter(t=>0===t.url.indexOf("/e")),...e.filter(t=>0!==t.url.indexOf("/e"))].map(t=>{this.sc(i({},t,{callback:void 0}),"sendBeacon")})}enable(){this.Zu=!1,this.tc()}tc(){this.Zu||(this.Yu=setTimeout(()=>{this.ec(),this.rc()},this.Ku))}rc(){if(this.Ju.length>0){var t=this.nc();for(var e in t)this.sc(t[e])}}sc(t,e){try{this.Xu(t,e)}catch(t){de.error(t)}}ec(){clearTimeout(this.Yu),this.Yu=void 0}nc(){var t={},e={};nr(this.Ju,r=>{var s,n=r,o=((n?n.batchKey:null)||n.url)+(n.batchGroup?":"+n.batchGroup:"");C(t[o])&&(t[o]=i({},n,{data:[],callback:void 0,fireCallbackOnDrop:void 0}),e[o]=[]),null==(s=t[o].data)||s.push(n.data),n.callback&&e[o].push(n.callback)});var r=function(){var i=e[s];i.length&&(t[s].callback=t=>{for(var e of i)e(t)})};for(var s in e)r();return this.Ju=[],t}},to=class{constructor(t){this._instance=t,this.oc=!1,this.ac=3e3,this.Ju=[],this.Ju=[],this.lc=!0,this.resume()}resume(){if(!C(n)&&"onLine"in n.navigator){if(this.lc=n.navigator.onLine,this.uc)return;this.uc=()=>{this.lc=!0,this.rc()},this.cc=()=>{this.lc=!1},vr(n,"online",this.uc),vr(n,"offline",this.cc)}}get length(){return this.Ju.length}retriableRequest(t,r){var s=t.retriesPerformedSoFar,n=function(t,e){if(null==t)return{};var i={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==e.indexOf(r))continue;i[r]=t[r]}return i}(t,e);U(s)&&(n.url=Un(n.url,{retry_count:s})),Qn(this._instance,r?i({},n,{transport:r}):n,(t,e)=>{if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=s?s:0))return void this.Ls(i({retriesPerformedSoFar:s},n),e);0===t.statusCode&&de.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(null!=s?s:0)+" retries.")}null==n.callback||n.callback(t)})}Ls(t,e){var i=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=i+1;var r=Math.max(function(t){var e=3e3*Math.pow(2,t),i=e/2,r=Math.min(18e5,e),s=(Math.random()-.5)*(r-i);return Math.ceil(r+s)}(i),null!=e?e:0),s=Date.now()+r;this.Ju.push({retryAt:s,requestOptions:t});var n="Enqueued failed request for retry in "+r;navigator.onLine||(n+=" (Browser is offline)"),de.warn(n),this.oc||(this.oc=!0,this.hc())}hc(){if(this.dc&&clearTimeout(this.dc),0===this.Ju.length)return this.oc=!1,void(this.dc=void 0);this.dc=setTimeout(()=>{this.lc&&this.Ju.length>0&&this.rc(),this.hc()},this.ac)}rc(){var t=Date.now(),e=[],i=this.Ju.filter(i=>t>i.retryAt||(e.push(i),!1));if(this.Ju=e,i.length>0)for(var r of i)this.retriableRequest(r.requestOptions)}unload(){for(var t of(this.dc&&(clearTimeout(this.dc),this.dc=void 0),this.oc=!1,C(n)||(this.uc&&(n.removeEventListener("online",this.uc),this.uc=void 0),this.cc&&(n.removeEventListener("offline",this.cc),this.cc=void 0)),this.Ju)){var e=t.requestOptions;try{this._instance._send_request(i({},e,{callback:P(e.data)?void 0:e.callback,transport:"sendBeacon"}))}catch(t){de.error(t)}}this.Ju=[]}},eo=class{constructor(t){this._instance=t,this.vc=()=>{var t,e,i,r;this.fc||(this.fc={});var s=this.scrollElement(),n=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=n+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;this.fc.lastScrollY=Math.ceil(n),this.fc.maxScrollY=Math.max(n,null!==(t=this.fc.maxScrollY)&&void 0!==t?t:0),this.fc.maxScrollHeight=Math.max(o,null!==(e=this.fc.maxScrollHeight)&&void 0!==e?e:0),this.fc.lastContentY=a,this.fc.maxContentY=Math.max(a,null!==(i=this.fc.maxContentY)&&void 0!==i?i:0),this.fc.maxContentHeight=Math.max(l,null!==(r=this.fc.maxContentHeight)&&void 0!==r?r:0)}}get gc(){return this._instance.config.scroll_root_selector}getContext(){return this.fc}resetContext(){var t=this.fc;return this.fc=void 0,setTimeout(this.vc,0),t}startMeasuringScrollPosition(){vr(n,"scroll",this.vc,{capture:!0}),vr(n,"scrollend",this.vc,{capture:!0}),vr(n,"resize",this.vc)}scrollElement(){var t;if(!this.gc)return null==n||null==(t=n.document)?void 0:t.documentElement;for(var e of P(this.gc)?this.gc:[this.gc]){var i,r=null==n||null==(i=n.document)?void 0:i.querySelector(e);if(r)return r}}mc(t){var e,i,r="y"===t?"scrollTop":"scrollLeft";if(this.gc){var s=this.scrollElement();return s&&s[r]||0}return n?"y"===t?n.scrollY||n.pageYOffset||(null==(e=n.document)||null==(e=e.documentElement)?void 0:e.scrollTop)||0:n.scrollX||n.pageXOffset||(null==(i=n.document)||null==(i=i.documentElement)?void 0:i.scrollLeft)||0:0}scrollY(){return this.mc("y")}scrollX(){return this.mc("x")}},io=t=>ps(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties,null==t?void 0:t.config.disable_capture_url_hashes),ro=class{constructor(t,e,i,r){this.qe=t=>{var e=this.yc();if(!e||e.sessionId!==t){var i={sessionId:t,props:this.bc(this._instance)};this._c.register({[Ii]:i})}},this._instance=t,this.wc=e,this._c=i,this.bc=r||io,this.wc.onSessionId(this.qe)}yc(){return this._c.props[Ii]}getSetOnceProps(){var t,e=null==(t=this.yc())?void 0:t.props;return e?"r"in e?fs(e,this._instance.config.disable_capture_url_hashes):{$referring_domain:e.referringDomain,$pathname:e.initialPathName,utm_source:e.utm_source,utm_campaign:e.utm_campaign,utm_medium:e.utm_medium,utm_content:e.utm_content,utm_term:e.utm_term}:{}}getSessionProps(){var t={};return nr(lr(this.getSetOnceProps()),(e,i)=>{"$current_url"===i&&(i="url"),t["$session_entry_"+x(i)]=e}),t}},so=class{on(t,e){return this.bo[t]||(this.bo[t]=[]),this.bo[t].push(e),()=>{this.bo[t]=this.bo[t].filter(t=>t!==e)}}emit(t,e){for(var i of this.bo[t]||[])i(e);for(var r of this.bo["*"]||[])r(t,e)}constructor(){this.bo={}}},no=ve("[SessionId]"),oo=864e5,ao=class{on(t,e){return this.kc.on(t,e)}constructor(t,e,i){var r;if(this.Sc=null,this.xc=null,this.$c=[],this.Cc=void 0,this.Tc=!1,this.kc=new so,this.Ic=(t,e)=>!(!U(t)||!U(e))&&Math.abs(t-e)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if("always"===t.config.cookieless_mode)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Ar=t.config,this._c=t.persistence,this.je=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.Mc=void 0,this._sessionActivityTimestamp=null,this.Ec=e||yr,this.Pc=i||yr;var s=this.Ar.persistence_name||this.Ar.token;if(this._sessionTimeoutMs=1e3*K(this.Ar.session_idle_timeout_seconds||1800,60,36e3,no.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Rc(),this.Ac="ph_"+s+"_window_id",this.Fc="ph_"+s+"_primary_window_exists",this.Oc()){var n=jr.Lt(this.Ac),o=jr.Lt(this.Fc);n&&!o?this.je=n:jr.Pt(this.Ac),jr.At(this.Fc,!0)}null!=(r=this.Ar.bootstrap)&&r.sessionID&&this.setBootstrapSessionId(this.Ar.bootstrap.sessionID),this.Dc()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return C(this.$c)&&(this.$c=[]),this.$c.push(t),this.Xt&&t(this.Xt,this.je),()=>{this.$c=this.$c.filter(e=>e!==t)}}Oc(){return"memory"!==this.Ar.persistence&&!this._c.hi&&jr.$t()}Lc(t){t!==this.je&&(this.je=t,this.Oc()&&jr.At(this.Ac,t))}Nc(){return this.je?this.je:this.Oc()?jr.Lt(this.Ac):null}qc(t){var e=this.Sc;return!D(e)&&!D(t)&&5e3>Math.abs(t-e)}jc(t,e,i){var r=e!==this._sessionActivityTimestamp,s=!(t!==this.Xt||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=e,this.Xt=t,s&&!r||s&&this.qc(e)||(this.Sc=e,this._c.register({[_i]:[e,t,i]}))}Bc(){var t,e=null==(t=this.Ar)?void 0:t.persistence_save_debounce_ms;return U(e)&&e>0}zc(){this.Bc()?this._c.refreshKey(_i):(this._c.flush(),this._c.load())}Hc(){var t;if(!D(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Sc){this.zc();var e=this.Uc();e[1]===this.Xt&&e[2]===this._sessionStartTimestamp&&(this.Sc=this._sessionActivityTimestamp,this._c.register({[_i]:[this._sessionActivityTimestamp,null!==(t=this.Xt)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this._c.flush())}}Wc(){var t=this.Uc()[0],e=U(t)?t:0,i=U(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(e,i)}Vc(t){return this.zc(),this.Ic(t,this.Wc())}Uc(){var t=this._c.props[_i];return P(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Sc=null,this.Mc=void 0,clearTimeout(this.Gc),this.Gc=void 0,this.jc(null,null,null)}setBootstrapSessionId(t,e){void 0===e&&(e=!1);var i=function(t,e){void 0===e&&(e=(new Date).getTime());try{var i=(t=>{var e=t.replace(/-/g,"");if(32!==e.length)throw new Error("Not a valid UUID");if("7"!==e[12])throw new Error("Not a UUIDv7");return parseInt(e.substring(0,12),16)})(t);return i>e+6e4?void no.error("Bootstrap sessionID cannot be in the future"):i}catch(t){return void no.error("Invalid sessionID in bootstrap",t)}}(t);return!C(i)&&(e?this.Mc={sessionId:t,sessionStartTimestamp:i}:this.jc(t,(new Date).getTime(),i),!0)}destroy(){this.Tc=!0,this.Hc(),clearTimeout(this.Gc),this.Gc=void 0,this.Cc&&n&&(n.removeEventListener(Zi,this.Cc,{capture:!1}),this.Cc=void 0),this.$c=[]}Dc(){this.Cc=()=>{this.Hc(),this.Oc()&&jr.Pt(this.Fc)},vr(n,Zi,this.Cc,{capture:!1})}checkAndGetSessionAndWindowId(t,e,i){if(void 0===t&&(t=!1),void 0===e&&(e=null),void 0===i&&(i=!1),"always"===this.Ar.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=e||(new Date).getTime(),s=this.Xt;if(i)this.xc=r;else if(D(this.xc)||this.xc>r||r-this.xc>=1e3){var n,o;null==(n=(o=this._c).syncCookieProperties)||n.call(o),this.xc=r}var a=this.Uc(),l=a[1],h=a[2],u=!C(s)&&l!==s,d=this.Wc(),v=this.Nc(),c=this.Mc,_=!!c&&(c.sessionStartTimestamp>r+6e4||r-c.sessionStartTimestamp>oo),p=c?_:U(h)&&Math.abs(r-h)>oo,f=!1,g=u,m=!l||!!c,b=l,y=!m&&!t&&this.Ic(r,d);if(y){(y=this.Vc(r))||no.info("cross-tab refresh kept the session alive",{sessionId:l});var w=this.Uc();l=w[1],h=w[2],y||(m=!l||!!c)}if(m||y||p){g=!1;var S=c&&!_;l=S?c.sessionId:this.Ec(),v=this.Pc(),no.info("new session ID assigned",{sessionId:l,windowId:v,bootstrapped:!!S,changeReason:{noSessionId:m,activityTimeout:y,sessionPastMaximumLength:p}}),h=S?c.sessionStartTimestamp:r,this.Mc=void 0,f=!0}else v||(v=this.Pc(),f=!0),(g=g||l!==b)&&(no.info("adopted cross-tab session id",{sessionId:l,windowId:v}),f=!0);var x=U(d)&&t&&!p?d:r,E=U(h)?h:(new Date).getTime();this.Lc(v),this.jc(l,x,E),t||this.Rc();var T={noSessionId:m,activityTimeout:y,sessionPastMaximumLength:p,crossTabAdoption:g};return f&&this.$c.forEach(t=>t(l,v,T)),{sessionId:l,windowId:v,sessionStartTimestamp:E,changeReason:f?T:void 0,lastActivityTimestamp:d}}Rc(){this.Tc||(clearTimeout(this.Gc),this.Gc=setTimeout(()=>{if(!this.Tc)if(this.Vc((new Date).getTime())){var t=this.Xt;this.resetSessionId(),this.kc.emit("forcedIdleReset",{idleSessionId:t})}else this.Rc()},1.1*this.sessionTimeoutMs))}};function lo(){return(lo=s(function*(){var t=null==a?void 0:a.userAgentData;if(null!=t&&t.getHighEntropyValues)try{var e,i=null==(e=yield t.getHighEntropyValues(["model"]))?void 0:e.model;return A(i)&&i.length>0?i:void 0}catch(t){return void de.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}})).apply(this,arguments)}function ho(t,e){var i="$survey_"+e+"/"+t.id;return t.current_iteration&&t.current_iteration>0&&(i="$survey_"+e+"/"+t.id+"/"+t.current_iteration),i}function uo(t,e,i){return rs({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}var vo="custom",co="i.posthog.com",_o=/^\/static\//,po=["/s/","/e/","/i/"],fo=class{constructor(t){this.Qc={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,e=null==(t=this.instance.config.ui_host)?void 0:t.replace(/\/$/,"");return e||(e=this.apiHost.replace("."+co,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}get region(){return this.Qc[this.apiHost]||(this.Qc[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":vo),this.Qc[this.apiHost]}Zc(t){if(_o.test(t)){var e=this.instance.config.asset_host;if("string"==typeof e)return e.trim().replace(/\/$/,"")||void 0}}Jc(t){var e=is(t);return e?e.protocol+"//"+e.host+e.pathname:void 0}Kc(t,e,i){if("ui"===t)return i;var r=i,s=this.instance.config.rewriteRequestPath;if(s){var n,o=(null==(n=is(i))?void 0:n.href)||i;r=s(new URL(o)).toString()}if(s&&"api"===t&&po.some(t=>0===e.indexOf(t))){var a=this.Jc(r);if(a){var l,h=this.apiHost,u=this.Xc;(null==(l=u)?void 0:l.apiHost)===h&&u.rewriteRequestPath===s||(this.Xc=u={apiHost:h,rewriteRequestPath:s,urls:new Set}),u.urls.add(a)}}return r}isIngestionEndpoint(t){var e=this.Xc,i=this.Jc(t);return(null==e?void 0:e.apiHost)===this.apiHost&&e.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!i&&e.urls.has(i)}endpointFor(t,e){if(void 0===e&&(e=""),e&&(e="/"===e[0]?e:"/"+e),"ui"===t)return this.Kc(t,e,this.uiHost+e);if("flags"===t)return this.Kc(t,e,this.flagsApiHost+e);if("assets"===t){var i=this.Zc(e);if(i)return this.Kc(t,e,""+i+e)}if(this.region===vo)return this.Kc(t,e,this.apiHost+e);var r=co+e;switch(t){case"assets":return this.Kc(t,e,"https://"+this.region+"-assets."+r);case"api":return this.Kc(t,e,"https://"+this.region+"."+r)}}},go=ve("[Surveys]"),mo={ignoreConditions:!1,ignoreDelay:!1,displayType:zs.Popover},bo=ve("[PostHog ExternalIntegrations]"),yo={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},wo=class{constructor(t){this._instance=t}Ml(t,e){var i;null==(i=f.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,t,t=>{if(t)return bo.error("failed to load script",t);e()})}startIfEnabledOrStop(){var t=this,e=function(){var e,r,s,n=i[0],o=i[1];!o||null!=(e=f.__PosthogExtensions__)&&null!=(e=e.integrations)&&e[n]||t.Ml(yo[n],()=>{var e;null==(e=f.__PosthogExtensions__)||null==(e=e.integrations)||null==(e=e[n])||e.start(t._instance)}),!o&&null!=(r=f.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[n]&&(null==(s=f.__PosthogExtensions__)||null==(s=s.integrations)||null==(s=s[n])||s.stop())};for(var i of Object.entries(null!==(r=this._instance.config.integrations)&&void 0!==r?r:{})){var r;e()}}};ve("[AutoCapture]");var $o,So=class{constructor(t){this._instance=t}initialize(){}get(t){var e=this._instance.persistence;if("string"==typeof t)return null==e?void 0:e.get_property(t);var i={};for(var r of t){var s=null==e?void 0:e.get_property(r);C(s)||(i[r]=s)}return i}set(t,e){var i;null==(i=this._instance.persistence)||i.register("string"==typeof t?{[t]:e}:t)}remove(t){var e;null==(e=this._instance.persistence)||e.unregister(t)}},xo=class{constructor(t){this.instance=t,this.$=de,this.kv=new So(t),this.onSession=t=>Ws(this.instance.onSessionId(e=>{try{t(e)}catch(t){this.$.error("Browser extension session listener failed",t)}})),this.onEvent=t=>Ws(this.instance._addCaptureHook((e,i)=>{if(i)try{t({event:e,properties:i.properties})}catch(t){this.$.error("Browser extension event listener failed",t)}})),this.onRemoteConfig=t=>{var e=e=>{try{t(e)}catch(t){this.$.error("Browser extension remote config listener failed",t)}},i=this.instance.ur.on("extensionsRemoteConfig",e);return this.instance.cr&&e(this.instance.cr),Ws(i)}}get logger(){return this.$}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return null!==(t=this.instance.get_property("$device_id"))&&void 0!==t?t:this.distinctId}get deviceId(){var t=this.instance.get_property(We);return"string"==typeof t?t:void 0}get library(){return{name:me.LIB_NAME,version:me.LIB_VERSION}}get initialPersonProperties(){var t,e;return null!==(t=null==(e=this.instance.persistence)?void 0:e.get_initial_props())&&void 0!==t?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,e,i,r,s,n=null==(t=this.instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(e=null==n?void 0:n.sessionId)&&void 0!==e?e:"",windowId:null!==(i=null==n?void 0:n.windowId)&&void 0!==i?i:"",sessionStartTimestamp:null!==(r=null==n?void 0:n.sessionStartTimestamp)&&void 0!==r?r:0,lastActivityTimestamp:null!==(s=null==n?void 0:n.lastActivityTimestamp)&&void 0!==s?s:0}}catch(t){return{sessionId:"",windowId:"",sessionStartTimestamp:0,lastActivityTimestamp:0}}}get isOptedOut(){return this.instance.has_opted_out_capturing()}get canCapture(){return R(this.instance.is_capturing)?this.instance.is_capturing():!this.isOptedOut}get projectToken(){return this.instance.config.token}getExtension(t){var e;switch(t){case"featureFlags":case"featureFlagsCommon":e=this.instance.featureFlags;break;case"logs":e=this.instance.logs;break;case"surveys":e=this.instance.surveys;break;case"autocapture":e=this.instance.autocapture}return e}capture(t,e,r){if(r){var s=i({timestamp:r.timestamp,uuid:r.uuid,$set:r.set,$set_once:r.setOnce},"unload"===r.delivery?{transport:"sendBeacon",send_instantly:!0}:{});this.instance.capture(t,e,s)}else this.instance.capture(t,e)}registerDynamicEventProperties(t){return Ws(this.instance.dr(t))}sendRequest(t,e){var i=this;return s(function*(){var r;void 0===e&&(e={});var s=null!==(r=e.target)&&void 0!==r?r:"api",n=e.query?Un(t,e.query):t,o=i.instance.requestRouter.endpointFor(s,n),a={method:e.method,url:o,data:e.body,headers:e.headers,timeout:e.timeoutMs,fireCallbackOnDrop:!0,transport:e.transport,compression:e.compression,compressionFallback:"flags"===e.target&&"best-available"===e.compression?b.Base64:void 0,timestampMode:e.sentAt};return"api"===s&&"/i/v1/logs"===t&&(a.batchKey="logs"),"sendBeacon"===e.transport?(i.instance._send_request(a),{statusCode:202}):new Promise(t=>{a.callback=t,i.instance._send_request(a)})})()}},Eo={},To=0,ko=()=>{},Po='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Ro="Surveys module not available",Io="sanitize_properties is deprecated. Use before_send instead",Oo="Invalid value for property_denylist config: ",Co=["$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"],Ao=["$feature_flag_called","$$heatmap","$snapshot"],Mo=t=>"$"===t.charAt(0)&&!S(Ao,t),Do=/^[A-Za-z0-9_-]{1,400}$/,No=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,Fo=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,Uo=["token","distinct_id",Fi],Bo="posthog",Lo=t=>{var e={};return t&&"unset"!==t?("2025-11-30">t||(e.strictMinimumDuration=!0),"2026-05-30">t||(e.canvasCapture={resolutionScale:.6}),"2026-06-25">t||(e.streamNetworkBody=!0),"2026-08-30">t||(e.captureJsonLd=!0),e):e},jo=t=>{var e;return i({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:dr(null==l?void 0:l.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:ko,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=t?t:"unset",__preview_deferred_init_extensions:!1,__preview_replay_sync_fetch:!0,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:h&&A(null==h?void 0:h.search)&&-1!==h.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,reuseAnonymousId:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:"https:"===(null==n||null==(e=n.location)?void 0:e.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,feature_flag_request_max_retries:1,surveys_request_timeout_ms:1e4,on_request_error(t){de.error("Bad HTTP status: "+t.statusCode+" "+t.text)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:Qi,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:ko},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:Wr,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:Lo(t),external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body",internal_or_test_user_hostname:t&&t>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:t&&t>="2026-05-30"?250:0,split_storage:!(!t||"2026-05-30">t),detect_google_search_app:!(!t||"2026-05-30">t),disable_capture_url_hashes:!(!t||"2026-06-25">t),cookieWinsOnConflict:!(!t||"unset"===t||"2026-08-29">t)}))(t))},zo=[["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"]],Wo=t=>{var e={};for(var i of zo){var r=i[0],s=i[1];C(t[r])||(e[s]=t[r])}var n=or({},e,t),o=t.__preview_external_dependency_versioned_paths;return C(o)||(C(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),A(o)&&C(t.asset_host)&&(n.asset_host=o)),P(t.property_blacklist)&&(C(t.property_denylist)?n.property_denylist=t.property_blacklist:P(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:de.error(Oo+t.property_denylist)),n},qo=class{constructor(){this.__forceAllowLocalhost=!1}get Yc(){return this.__forceAllowLocalhost}set Yc(t){de.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}},Go=(t=class t{th(t){if(t){var e=this.eh.indexOf(t);-1!==e&&this.eh.splice(e,1)}}ih(t,e){return this.th(t),this.eh.push(e),null==e.initialize||e.initialize(),e}nh(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}sh(){if(!(this.rh||this.config.reuseAnonymousId||this.config.segment||this.nh())){var t,e,i,r="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;(r||this.config.disable_persistence)&&(this.oh||(r?(t="persistence is set to '"+this.config.persistence+"'",e="memory"===this.config.persistence?"on every page load":"for every new browser tab or window",i="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(t="persistence is disabled (disable_persistence is true)",e="on every page load",i="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this.rh=!0,console.warn("[PostHog.js]",t+" but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID "+e+", 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. "+i)))}}ah(){var t=this.persistence;if(t&&!this.uh)if(this.nh())"on_reject"===this.config.cookieless_mode&&"$posthog_cookieless"!==this.get_distinct_id()&&(this.hh(),this.dh());else if("$posthog_cookieless"===this.get_distinct_id()){this.fh()||t.load(!0);var e=this.get_distinct_id();if(!e||"$posthog_cookieless"===e){var i=this.config.get_device_id(yr());this.register({distinct_id:i,$device_id:i}),t.set_property(Ri,Yi)}this.hh()}}get decideEndpointWasHit(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.hasLoadedFlags)&&void 0!==t&&t}constructor(){var e;this.ph=!1,this.gh=!1,this.webPerformance=new qo,this.mh=!1,this.version=me.LIB_VERSION,this.yh=new Set,this.bh="",this.ur=new so,this.eh=[],this._h=[],this.wh=!1,this.oh=!1,this.rh=!1,this.uh=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=jo(),this.SentryIntegration=Kr,this.sentryIntegration=t=>function(t,e){var i=Jr(t,e);return{name:Vr,processEvent:t=>i(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.kh=!1,this.Sh=null,this.xh=null,this.$h=null,this.scrollManager=new eo(this),this.pageViewManager=new Yr(this),this.rateLimiter=new Js(this),this.requestRouter=new fo(this),this.consent=new zr(this),this.externalIntegrations=new wo(this);var i=null!==(e=t.__defaultExtensionClasses)&&void 0!==e?e:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.metrics=i.metrics&&new i.metrics(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(t,e,i)=>{var r=A(t)?{[t]:e}:t;this.setPersonProperties(r),null==i||i({})},set_once:(t,e,i)=>{var r=A(t)?{[t]:e}:t;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",t=>de.info('send "'+(null==t?void 0:t.event)+'"',t))}init(e,i,r){if(r&&r!==Bo){var s,n=null!==(s=Eo[r])&&void 0!==s?s:new t;return n._init(e,i,r),Eo[r]=n,Eo[Bo][r]=n,n}return this._init(e,i,r)}_init(t,e,r){var s,o,a;void 0===e&&(e={});var l,h=A(t)?t.trim():"";if(!h)return de.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return h!==(null==(l=this.config)?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('"+h+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=jo(e.defaults),e.debug=this.Ch(e.debug),this.Th=e,this.Ih=[],e.person_profiles?this.xh=e.person_profiles:e.process_person&&(this.xh=e.process_person);var u=jo(e.defaults),d=Wo(e),v=or({},u,d,{name:r,token:h});I(u.rageclick)&&I(d.rageclick)&&(v.rageclick=or({},u.rageclick,d.rageclick)),I(u.session_recording)&&I(d.session_recording)&&(v.session_recording=or({},u.session_recording,d.session_recording)),this.set_config(v),this.config.on_xhr_error&&de.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=e.disable_compression?void 0:Os.GZipJS;var c=this.fh(),_=!this.nh();if(this.persistence=new Is(this.config,c,!0,_),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Is(i({},this.config,{persistence:"sessionStorage"}),c,!1,_),this.bh="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!c&&jr.$t()){var p=jr.Lt(this.bh);P(p)&&p.forEach(t=>{A(t)&&this.yh.add(t)})}else jr.Pt(this.bh);var f=i({},this.persistence.props),g=i({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Mh=new Zn((t,e)=>this.Eh(t,e),this.config.request_queue_config),this.Ph=new to(this),this.__request_queue=[];var m=this.nh();m||(this.sessionManager=new ao(this),this.sessionPropsManager=new ro(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((t,e,i)=>{(null!=i&&i.activityTimeout||null!=i&&i.sessionPastMaximumLength||null!=i&&i.crossTabAdoption)&&this.Rh()})),this.Ah(),this.config.__preview_deferred_init_extensions?(de.info("Deferring extension initialization to improve startup performance"),this.Fh=setTimeout(()=>{this.Fh=void 0,this.Oh(m)},0)):(de.info("Initializing extensions synchronously"),this.Oh(m)),me.DEBUG=me.DEBUG||this.config.debug,me.DEBUG&&de.info("Starting in debug mode",{this:this,config:e,thisC:i({},this.config),p:f,s:g}),!this.config.identity_distinct_id||null!=(s=e.bootstrap)&&s.distinctID||(e.bootstrap=i({},e.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));var b=null==(o=e.bootstrap)?void 0:o.distinctID;if(this.oh=!!b&&!M(b),null!=(a=e.bootstrap)&&a.distinctID){var y=e.bootstrap.distinctID,w=this.get_distinct_id(),S=this.persistence.get_property(Ri);if(e.bootstrap.isIdentifiedID&&null!=w&&w!==y&&"anonymous"===S)this.identify(y);else if(e.bootstrap.isIdentifiedID&&null!=w&&w!==y&&"identified"===S)de.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{var x=this.config.get_device_id(yr()),E=e.bootstrap.isIdentifiedID?x:y;this.persistence.set_property(Ri,e.bootstrap.isIdentifiedID?Xi:Yi),this.register({distinct_id:y,$device_id:E})}}if(m)this.register_once({distinct_id:Ni,$device_id:null},"");else if(!this.get_distinct_id()){var T=this.config.get_device_id(yr());this.register_once({distinct_id:T,$device_id:T},""),this.persistence.set_property(Ri,Yi)}return vr(n,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),vr(n,"pageshow",()=>{var t;this.ph=!1,this.gh||null==(t=this.Ph)||t.resume()}),e.segment?Hr(this,()=>this.Dh()):this.Dh(),R(this.config._onCapture)&&this.config._onCapture!==ko&&(de.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",t=>this.config._onCapture(t.event,t))),this.config.ip&&de.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 lo.apply(this,arguments)}().then(t=>{t&&this.register({[qe]:t})}).catch(ko),this}Lh(t){var e=t;return A(e.name)&&R(e.setup)}Nh(t,e){var i=this;this.Lh(t)?e.push(s(function*(){try{yield t.setup(i.qh())}catch(e){de.error('Failed to set up extension "'+t.name+'"',e);try{yield null==t.dispose?void 0:t.dispose()}catch(e){de.error('Failed to dispose extension "'+t.name+'"',e)}}})):this.eh.push(t)}Ah(){var e,i,r,n,o,a,l=this,h=null!==(e=null==(i=this.config.__extensionClasses)?void 0:i.featureFlags)&&void 0!==e?e:null==(r=t.__defaultExtensionClasses)?void 0:r.featureFlags;if(h)if(this.featureFlags&&this.featureFlags instanceof h||(null==(a=this.jh)||a.call(this),this.jh=void 0,this.featureFlags=new h(this)),R(this.featureFlags.onReloading)&&R(this.featureFlags.setup)){if(!this.jh){this.jh=this.featureFlags.onReloading(()=>{this.ur.emit("featureFlagsReloading",!0)});var u=this.featureFlags;s(function*(){try{yield u.setup(l.qh())}catch(e){de.error("Failed to set up feature flags",e);var t=l.jh;l.jh=void 0;try{null==t||t()}catch(t){de.error("Failed to unsubscribe feature flag reloading",t)}try{yield u.dispose()}catch(t){de.error("Failed to dispose feature flags",t)}}})()}}else null==(n=(o=this.featureFlags).initialize)||n.call(o)}Oh(e){var r,s,n,o,a,l,h,u,d=performance.now(),v=i({},t.__defaultExtensionClasses,this.config.__extensionClasses),c=[];v.exceptions&&this.eh.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new v.exceptions(this)),v.historyAutocapture&&this.eh.push(this.historyAutocapture=new v.historyAutocapture(this)),v.tracingHeaders&&this.eh.push(this.tracingHeaders=new v.tracingHeaders(this)),v.siteApps&&this.eh.push(this.siteApps=new v.siteApps(this)),v.sessionRecording&&!e&&this.eh.push(this.sessionRecording=new v.sessionRecording(this)),this.config.disable_scroll_properties||c.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),v.autocapture&&this.Nh(this.autocapture=new v.autocapture(this),c),v.surveys&&this.Nh(this.surveys=null!==(s=this.surveys)&&void 0!==s?s:new v.surveys(this),c),v.logs&&this.Nh(this.logs=null!==(n=this.logs)&&void 0!==n?n:new v.logs(this),c),v.metrics&&this.eh.push(this.metrics=null!==(o=this.metrics)&&void 0!==o?o:new v.metrics(this)),v.conversations&&this.eh.push(this.conversations=null!==(a=this.conversations)&&void 0!==a?a:new v.conversations(this)),v.productTours&&this.eh.push(this.productTours=new v.productTours(this)),v.heatmaps&&this.eh.push(this.heatmaps=new v.heatmaps(this)),v.webVitalsAutocapture&&this.eh.push(this.webVitalsAutocapture=new v.webVitalsAutocapture(this)),v.exceptionObserver&&this.eh.push(this.exceptionObserver=new v.exceptionObserver(this)),v.deadClicksAutocapture&&this.eh.push(this.deadClicksAutocapture=new v.deadClicksAutocapture(this,qr)),v.toolbar&&this.eh.push(this.toolbar=null!==(l=this.toolbar)&&void 0!==l?l:new v.toolbar(this)),v.experiments&&this.eh.push(this.experiments=null!==(h=this.experiments)&&void 0!==h?h:new v.experiments(this)),v.webMCP&&this.eh.push(this.webMCP=null!==(u=this.webMCP)&&void 0!==u?u:new v.webMCP(this)),this.eh.forEach(t=>{t.initialize&&c.push(()=>{null==t.initialize||t.initialize()})}),c.push(()=>{if(this.Bh){var t=this.Bh;this.Bh=void 0,this.eh.forEach(e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t))}}),this.zh(c,d)}zh(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void(this.Fh=setTimeout(()=>{this.Fh=void 0,this.zh(t,e)},0));var i=t.shift();if(i)try{i()}catch(t){de.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-e);this.register_for_session({[Ui]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Bi]:r}),this.config.__preview_deferred_init_extensions&&de.info("PostHog extensions initialized ("+r+"ms)")}Gu(t){if(!l||!l.body)return de.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Gu(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.Bh=t),this.cr=t,this.compression=void 0,t.ok){var e,i=t.config;i.supportedCompression&&!this.config.disable_compression&&(this.compression=S(i.supportedCompression,Os.GZipJS)?Os.GZipJS:S(i.supportedCompression,Os.Base64)?Os.Base64:void 0),null!=(e=i.analytics)&&e.endpoint&&(this.analyticsDefaultEndpoint=i.analytics.endpoint)}this.set_config({person_profiles:this.xh?this.xh:Qi}),this.ur.emit("extensionsRemoteConfig",t),this.eh.forEach(e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t))}Dh(){try{this.config.loaded(this)}catch(t){de.critical("`loaded` function failed",t)}if(this.Hh(),this.config.internal_or_test_user_hostname&&null!=h&&h.hostname){var t=h.hostname,e=this.config.internal_or_test_user_hostname;("string"==typeof e?t===e:e.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.nh())&&this.Uh()},1),this.Wh=new Ys(this),this.Wh.load()}Hh(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.Mh)||t.enable())}_dom_loaded(){this.is_capturing()&&sr(this.__request_queue,t=>this.Eh(t)),this.__request_queue=[],this.Hh()}_handle_unload(){var t,e,i,r,s;this.ph=!0,null==(t=this.surveys)||null==t.handlePageUnload||t.handlePageUnload(),null==(e=this.metrics)||e.flush("sendBeacon"),this.config.request_batching?(this.Vh()&&this.capture(er),null==(i=this.logs)||i.flushLogs("sendBeacon"),null==(r=this.Mh)||r.unload(),null==(s=this.Ph)||s.unload()):this.Vh()&&this.capture(er,null,{transport:"sendBeacon"})}_send_request(t){Qn(this,t)}Eh(t,e){this.Ph?this.Ph.retriableRequest(t,e):this._send_request(e?i({},t,{transport:e}):t)}_execute_array(t){To++;try{var e,i=[],r=[],s=[];sr(t,t=>{if(t)if(P(e=t[0]))s.push(t);else if(R(t))try{t.call(this)}catch(e){de.error("Error executing queued PostHog call",t,e)}else P(t)&&"alias"===e?i.push(t):P(t)&&-1!==e.indexOf("capture")&&R(this[e])?s.push(t):r.push(t)});var n=function(t,e){sr(t,function(t){try{if(P(t[0])){var i=e;nr(t,function(t){i=i[t[0]].apply(i,t.slice(1))})}else e[t[0]].apply(e,t.slice(1))}catch(e){de.error("Error executing queued PostHog call",t,e)}})};n(i,this),n(r,this),n(s,this)}finally{To--}}push(e){if(To>0&&P(e)&&A(e[0])){var i=t.prototype[e[0]];R(i)&&i.apply(this,e.slice(1))}else this._execute_array([e])}get Gh(){return{property:Ve,persistenceKey:Je,cookieName:"_fbc",pattern:No,register:(t,e)=>{var i;return null==(i=this.persistence)?void 0:i.register({[Je]:{value:t,delivered:e}})},unregister:()=>{var t;return null==(t=this.persistence)?void 0:t.unregister(Je)}}}get Qh(){return{property:Ke,persistenceKey:Ye,cookieName:"_fbp",pattern:Fo,register:(t,e)=>{var i;return null==(i=this.persistence)?void 0:i.register({[Ye]:{value:t,delivered:e}})},unregister:()=>{var t;return null==(t=this.persistence)?void 0:t.unregister(Ye)}}}Zh(t){var e,i=null==(e=this.persistence)?void 0:e.get_property(t.persistenceKey);return A(i)&&t.pattern.test(i)?{value:i,delivered:!1}:I(i)&&A(i.value)&&t.pattern.test(i.value)?{value:i.value,delivered:!0===i.delivered}:void 0}Jh(t,e,i){return e===(null==i?void 0:i.value)?{value:e,pending:!i.delivered}:(t.register(e,!1),{value:e,pending:!0})}Kh(t){if(this.config.save_campaign_params&&!this.nh()){var e=pr(t.cookieName);return A(e)&&t.pattern.test(e)?e:void 0}}Xh(t,e,i,r){if(this.persistence){var s=this.Gh;this.persistence.refreshMetaIdentifiers();var n=this.Zh(s);if(!r){if(i)return A(e)&&No.test(e)?this.Jh(s,e,n):void s.unregister();var o=A(t)&&Do.test(t)?t:void 0,a=this.Kh(s);return a&&((t,e,i)=>{var r=t.split(".");if(e)return r[3]===e;if(!i)return!0;var s=i.value.split(".");return r[3]===s[3]||Number(r[2])>Number(s[2])})(a,o,n)?this.Jh(s,a,n):o?(null==n?void 0:n.value.split(".")[3])===o?{value:n.value,pending:!n.delivered}:this.Jh(s,"fb.1."+Date.now()+"."+o,n):n?{value:n.value,pending:!n.delivered}:void 0}s.unregister()}}Yh(t,e,i){if(this.persistence){var r=this.Qh;this.persistence.refreshMetaIdentifiers();var s=this.Zh(r);if(!i){if(e)return A(t)&&Fo.test(t)?this.Jh(r,t,s):void r.unregister();var n=this.Kh(r);return n?this.Jh(r,n,s):s?{value:s.value,pending:!s.delivered}:void 0}r.unregister()}}td(t,e){if(this.persistence){this.persistence.refreshMetaIdentifiers();var i=this.Zh(t);(null==i?void 0:i.value)!==e||i.delivered||t.register(e,!0)}}capture(t,e,r){var s,n,o,a,l,h,u;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Mh)if(this.is_capturing())if(!C(t)&&A(t)){if(this.ah(),"$snapshot"!==t||!this.nh()){var d=!this.config.opt_out_useragent_filter&&this._is_bot();if(!d||this.config.__preview_capture_bot_pageviews){var v=null!=r&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==v||!v.isRateLimited){var c;null!=e&&e.$current_url&&!A(null==e?void 0:e.$current_url)&&(de.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==e||delete e.$current_url),"$exception"!==t||null!=r&&r._originatedFromCaptureException||de.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&(c=this.sessionPersistence.update_campaign_params()),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var _=new Date,p=(null==r?void 0:r.timestamp)||_,f=Qt(null==r?void 0:r.uuid,yr),g={uuid:f,event:t,properties:this.calculateEventProperties(t,e||{},p,f)};"$pageview"===t&&this.config.__preview_capture_bot_pageviews&&d&&(g.event="$bot_pageview",g.properties.$browser_type="bot"),v&&(g.properties.$lib_rate_limit_remaining_tokens=v.remainingTokens);var m="$feature_flag_called"===t&&!1===g.properties.$feature_flag_has_experiment&&!0===this.get_property("$minimal_flag_called_events");null!=r&&r.$set&&!m&&(g.$set=null==r?void 0:r.$set);var b=I(null==e?void 0:e.$set)?e.$set:void 0,y=P(null==e?void 0:e.$unset)?e.$unset:[],w=(null==r?void 0:r.$unset)||[],S=t=>{var e,i=!(null==r||!r.$set)&&t in r.$set;return{hasProvided:i||!!b&&t in b,provided:i?null==r||null==(e=r.$set)?void 0:e[t]:null==b?void 0:b[t],unset:-1!==y.indexOf(t)||-1!==w.indexOf(t)}},x=S(Ve),E=S(Ke),T=[{channel:this.Gh,hasProvided:x.hasProvided,update:this.Xh(null==(s=c)?void 0:s.fbclid,x.provided,x.hasProvided,x.unset)},{channel:this.Qh,hasProvided:E.hasProvided,update:this.Yh(E.provided,E.hasProvided,E.unset)}];for(var k of T){var R=k.channel,M=k.update;M&&!0===g.properties.$process_person_profile&&M.pending&&!k.hasProvided&&!m&&(g.$set=i({[R.property]:M.value},g.$set))}var D=null==r?void 0:r.$unset;D&&(g.$unset=D);var F=m?void 0:this.nd(null==r?void 0:r.$set_once,t!==rr,t===ir);if(F&&(g.$set_once=F),null!=r&&r._noTruncate||(a=this.config.properties_string_max_length,l=g,h=t=>A(t)?t.slice(0,a):t,u=new Set,g=function t(e,i){if(e!==Object(e))return h?h(e):e;if(!u.has(e)){var r;if(u.add(e),P(e))r=[],sr(e,e=>{r.push(t(e))});else{var s={};nr(z(e)?hr(e):e,(e,i)=>{u.has(e)||(s[i]=t(e,i))}),r=s}return r}}(l)),g.timestamp=p,C(null==r?void 0:r.timestamp)||(g.properties.$event_time_override_provided=!0,g.properties.$event_time_override_system_time=_),m&&(g.properties=function(t,e){void 0===e&&(e=[]);var i={},r=e=>{void 0!==t[e]&&(i[e]=t[e])};return ie.forEach(r),e.forEach(r),i}(g.properties,Uo)),t===Ls.DISMISSED||t===Ls.SENT){var U=null==e?void 0:e[js.SURVEY_ID],B=null==e?void 0:e[js.SURVEY_ITERATION];(t=>{try{var e=(t=>((t,e)=>"seenSurvey_"+function(t){return t.current_iteration&&t.current_iteration>0?t.id+"_"+t.current_iteration:t.id}(e))(0,t))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(t){go.error("Failed to persist survey seen state",t)}})({id:U,current_iteration:B}),g.$set=i({},g.$set,{[ho({id:U,current_iteration:B},t===Ls.SENT?"responded":"dismissed")]:!0})}else t===Ls.SHOWN&&(g.$set=i({},g.$set,{[js.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(t===Gs.SHOWN){var L=null==e?void 0:e[Hs.TOUR_TYPE];L&&(g.$set=i({},g.$set,{[Hs.TOUR_LAST_SEEN_DATE+"/"+L]:(new Date).toISOString()}))}var j=i({},g.properties.$set,g.$set);if(O(j)||this.setPersonPropertiesForFlags(j),!N(this.config.before_send)){var W=this.Os(g);if(!W)return;(g=W).uuid=Qt(g.uuid,yr)}this.sessionRecording&&!this.wh&&Mo(t)&&(this.wh=!0,setTimeout(()=>this.wh=!1,3e4));var q=T.filter(t=>{var e,i,r,s=t.channel,n=t.update,o=null!==(e=null==(i=g.$set)?void 0:i[s.property])&&void 0!==e?e:I(null==(r=g.properties)?void 0:r.$set)?g.properties.$set[s.property]:void 0;return(null==n?void 0:n.pending)&&o===n.value});this.ur.emit("eventCaptured",g);var G,H,V=null!==(n=null==r?void 0:r._url)&&void 0!==n?n:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),J="recordings"===(null==r?void 0:r._batchKey)||/\/s\/(?:\?|$)/.test(V),K=i({method:"POST",url:V,data:g,compression:"best-available",preferSyncCompression:null==r?void 0:r.send_instantly,timestampMode:J?"body":"capture-body",batchKey:null==r?void 0:r._batchKey},J&&null!=(o=g.properties)&&o.$session_id?{batchGroup:g.properties.$session_id+(g.properties.$window_id?"-"+g.properties.$window_id:"")}:{},null!=r&&r.transport?{transport:r.transport}:{},q.length?{fireCallbackOnDrop:!0,callback:t=>{if(t.statusCode>=200&&300>t.statusCode)for(var e of q)this.td(e.channel,e.update.value)}}:{});return!this.config.request_batching||r&&(null==r||!r._batchKey)||null!=r&&r.send_instantly?(!K.transport&&!K.callback&&O(null!==(G=this.config.request_headers)&&void 0!==G?G:{})&&this.ph&&(H="sendBeacon"),this.Eh(K,H)):this.Mh.enqueue(K),g}de.critical("This capture call is ignored due to client rate limiting.")}else de.info('Event "'+t+'" was not captured because the user agent looks like a bot. Set `opt_out_useragent_filter: true` to capture it.')}}else de.error("No event name provided to posthog.capture");else de.info('Event "'+t+'" was not captured because capturing is disabled (opted out or consent pending).');else de.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",e=>t(e.event,e))}getExtension(t){var e;return null==(e=this.sd)?void 0:e.getExtension(t)}qh(){var t;return null!==(t=this.sd)&&void 0!==t?t:this.sd=new xo(this)}dr(t){this._h.push(t);var e=!0;return()=>{if(e){e=!1;var i=this._h.indexOf(t);-1!==i&&this._h.splice(i,1)}}}rd(t){var e,i,r;return void 0===t&&(t=!0),!(null==(e=this.persistence)||!e.consumeCookieIdentityChange())&&(this.$h=null,"anonymous"===this.persistence.get_property("$user_state")&&(null==(r=this.sessionPersistence)||r.clear(),this.yh.clear(),this.od()),null==(i=this.featureFlags)||i.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,e,r,s,o){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return e;this.ah(),this.persistence.syncCookieProperties(),this.rd();var a=o?void 0:this.persistence.remove_event_timer(t),u=i({},e);if(u.token=this.config.token,u.$config_defaults=this.config.defaults,this.nh()&&(u[Fi]=!0),"$snapshot"===t){var d=i({},this.persistence.properties(),this.sessionPersistence.properties());return u.distinct_id=d.distinct_id,(!A(u.distinct_id)&&!F(u.distinct_id)||M(u.distinct_id))&&de.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),u}var v,c=function(t,e,i,r){var s,o,a,l;if(void 0===r&&(r=!1),!_)return{};var u,d=t?[...os,...e||[]]:[],v=function(t){for(var e=0;Vt.length>e;e++){var i=Vt[e],r=i[1],s=i[0].exec(t),n=s&&(R(r)?r(s,t):r);if(n)return n}return["",""]}(_),c=v[0],p=v[1],f=function(t){for(var e=0;Yt.length>e;e++){var i,r=Yt[e],s=r[1],n=r[2],o=t.match(r[0]);if(o)return[s,(null==(i=n&&t.match(n)||o)?void 0:i[1])||""]}return["",""]}(_),g=f[0],b=f[1],y=null!=(u="u">typeof navigator?navigator:void 0)&&u.brave?{brave:!0}:{},w={};C(i)||(w.detectGoogleSearchApp=i);var S={},x=null==(s=navigator)||null==(s=s.userAgentData)?void 0:s.platform,E=null==(o=navigator)?void 0:o.maxTouchPoints,T=null==n||null==(a=n.screen)?void 0:a.width,k=null==n||null==(l=n.screen)?void 0:l.height,P=null==n?void 0:n.devicePixelRatio;C(x)||(S.userAgentDataPlatform=x),C(E)||(S.maxTouchPoints=E),C(T)||(S.screenWidth=T),C(k)||(S.screenHeight=k),C(P)||(S.devicePixelRatio=P);var I,O,A,M,D,N,F,U,B=or(lr({$os:c,$os_version:p,$browser:qt(_,navigator.vendor,y,w),$webview_app:g,$webview_app_version:b,$device:Jt(_),$device_type:(O=_,A=S,U=Jt(O),U===tt||U===Z||"Kobo"===U||"Kindle Fire"===U||U===St?Q:U===ct||U===pt||U===_t||U===wt?"Console":U===et?"Wearable":U?Y:"Android"===(null==A?void 0:A.userAgentDataPlatform)&&(null!==(M=null==A?void 0:A.maxTouchPoints)&&void 0!==M?M:0)>0?600>Math.min(null!==(D=null==A?void 0:A.screenWidth)&&void 0!==D?D:0,null!==(N=null==A?void 0:A.screenHeight)&&void 0!==N?N:0)/(null!==(F=null==A?void 0:A.devicePixelRatio)&&void 0!==F?F:1)?Y:Q:"Desktop"),$timezone:es(),$timezone_offset:gs()}),{$current_url:ns(r?te(null==h?void 0:h.href):null==h?void 0:h.href,d,ls),$host:null==h?void 0:h.host,$pathname:null==h?void 0:h.pathname,$raw_user_agent:_.length>1e3?_.substring(0,997)+"...":_,$browser_version:Ht(_,navigator.vendor,y,w),$browser_language:vs(),$browser_language_prefix:(I=vs(),"string"==typeof I?I.split("-")[0]:void 0),$screen_height:null==n?void 0:n.screen.height,$screen_width:null==n?void 0:n.screen.width,$viewport_height:null==n?void 0:n.innerHeight,$viewport_width:null==n?void 0:n.innerWidth,$lib:m.LIB_NAME,$lib_version:m.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return m.SDK_DIST_CHANNEL&&(B.$sdk_dist_channel=m.SDK_DIST_CHANNEL),B}(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){var p=this.sessionManager.checkAndGetSessionAndWindowId(o,r.getTime(),!0),f=p.windowId;u.$session_id=p.sessionId,u.$window_id=f}this.sessionPropsManager&&or(u,this.sessionPropsManager.getSessionProps());try{var g;if(this.sessionRecording){var b=this.sessionRecording.sdkDebugProperties,y=!this.wh&&Mo(t);for(var w in b)(y||S(Co,w))&&(u[w]=b[w])}u.$sdk_debug_retry_queue_size=null==(g=this.Ph)?void 0:g.length}catch(t){u.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===vo&&(u.$lib_custom_api_host=this.config.api_host),v="$pageview"!==t||o?"$pageleave"!==t||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,s),u=or(u,v),"$pageview"===t&&l&&(u.title=l.title),!C(a)){var x=r.getTime()-a;u.$duration=parseFloat((x/1e3).toFixed(3))}_&&this.config.opt_out_useragent_filter&&(u.$browser_type=this._is_bot()?"bot":"browser");var E=this.persistence.properties(),T=this.sessionPersistence.properties(),k=u.$groups,D=E.$groups;I(k)&&!O(k)&&(u.$groups=i({},I(D)?D:{},k)),nr(["$referrer","$referring_domain"],t=>{t in E&&delete T[t]});var N={};if(this._h.length>0)for(var U of this._h.slice())try{or(N,U())}catch(t){de.error("Failed to produce browser extension event properties",t)}(u=or({},c,E,T,i({},N,u))).$is_identified=this._isIdentified(),P(this.config.property_denylist)?nr(this.config.property_denylist,function(t){delete u[t]}):de.error(Oo+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var B=this.config.sanitize_properties;B&&(de.error(Io),u=B(u,t));var L=this.ad();return u.$process_person_profile=L,L&&!o&&this.ld("_calculate_event_properties"),u}nd(t,e,i){var r;if(void 0===e&&(e=!0),void 0===i&&(i=!1),!this.persistence||!this.ad())return t;if(this.mh&&!i)return t;var s=or({},this.persistence.get_initial_props(),(null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps())||{},t||{}),n=this.config.sanitize_properties;return n&&(de.error(Io),s=n(s,"$set_once")),e&&(this.mh=!0),O(s)?void 0:s}register(t,e){var i;null==(i=this.persistence)||i.register(t,e)}register_once(t,e,i){var r;null==(r=this.persistence)||r.register_once(t,e,i)}register_for_session(t){var e,i;null==(e=this.persistence)||e.syncCookieProperties(),this.rd(),null==(i=this.sessionPersistence)||i.register(t),Object.keys(t).forEach(t=>this.yh.add(t)),this.od()}unregister(t){var e;null==(e=this.persistence)||e.unregister(t)}unregister_for_session(t){var e;null==(e=this.sessionPersistence)||e.unregister(t),this.yh.delete(t),this.od()}ud(t,e){this.register({[t]:e})}Rh(){this.yh.forEach(t=>{var e;null==(e=this.sessionPersistence)||e.unregister(t)}),this.yh.clear(),this.od()}od(){var t;if(this.bh)if("memory"===this.config.persistence||null!=(t=this.sessionPersistence)&&t.hi||!jr.$t())jr.Pt(this.bh);else{var e=[];this.yh.forEach(t=>e.push(t)),e.length>0?jr.At(this.bh,e):jr.Pt(this.bh)}}getFeatureFlag(t,e){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlag(t,e)}getFeatureFlagPayload(t){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlagPayload(t)}getFeatureFlagResult(t,e){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagResult(t,e)}getAllFeatureFlags(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.getAllFeatureFlags())&&void 0!==t?t:[]}isFeatureEnabled(t,e){var i,r;return null!==(i=null==(r=this.featureFlags)?void 0:r.isFeatureEnabled(t,e))&&void 0!==i?i:null==e?void 0:e.defaultValue}reloadFeatureFlags(){var t;null==(t=this.featureFlags)||t.reloadFeatureFlags()}updateFlags(t,e,i){var r;null==(r=this.featureFlags)||r.updateFlags(t,e,i)}updateEarlyAccessFeatureEnrollment(t,e,i){var r;null==(r=this.featureFlags)||r.updateEarlyAccessFeatureEnrollment(t,e,i)}getEarlyAccessFeatures(t,e,i){var r;return void 0===e&&(e=!1),null==(r=this.featureFlags)?void 0:r.getEarlyAccessFeatures(t,e,i)}on(t,e){return this.ur.on(t,e)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:Ro}),()=>{})}onSessionId(t){var e,i;return null!==(e=null==(i=this.sessionManager)?void 0:i.onSessionId(t))&&void 0!==e?e:()=>{}}getSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getSurveys(t,e):t([],{isLoaded:!1,error:Ro})}getActiveMatchingSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:Ro})}onActiveMatchingSurveysChanged(t){return this.surveys?this.surveys.onActiveMatchingSurveysChanged(t):(t([],{isLoaded:!1,error:Ro}),()=>{})}renderSurvey(t,e){var i;null==(i=this.surveys)||i.renderSurvey(t,e)}displaySurvey(t,e){var i;void 0===e&&(e=mo),null==(i=this.surveys)||i.displaySurvey(t,e)}cancelPendingSurvey(t){var e;null==(e=this.surveys)||e.cancelPendingSurvey(t)}canRenderSurvey(t){var e,i;return null!==(e=null==(i=this.surveys)?void 0:i.canRenderSurvey(t))&&void 0!==e?e:{visible:!1,disabledReason:Ro}}canRenderSurveyAsync(t,e){var i,r;return void 0===e&&(e=!1),null!==(i=null==(r=this.surveys)?void 0:r.canRenderSurveyAsync(t,e))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:Ro})}hd(t){return!t||M(t)?(de.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===t?(de.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())||(de.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(t,e,i){if(!this.__loaded||!this.persistence)return de.uninitializedWarning("posthog.identify");if(F(t)&&(t=t.toString(),de.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.hd(t)&&this.ld("posthog.identify")){this.ah();var r=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==r,n=this.rd(!1),o=this.persistence.ku(),a=!1;try{var l=this.get_distinct_id();this.register({$user_id:t}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:l},""),t!==l&&t!==this.get_property("__alias")&&(this.unregister(Ge),this.register({distinct_id:t}));var h=(this.persistence.get_property("$user_state")||"anonymous")===Yi,u=t!==l,d=!u&&h;if(u&&h){var v,c=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:l};this.persistence.set_property(Ri,Xi),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Su(),this.capture("$identify",c,{$set:e||{},$set_once:i||{}})&&(this.$h=uo(t,e,i)),null==(v=this.featureFlags)||v.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:l)}else if(d){this.persistence.set_property(Ri,Xi);var _=e||{},p=i||{};this.setPersonPropertiesForFlags({$set:_,$set_once:p},!1),this.config.cookieWinsOnConflict&&this.persistence.Su(),this.capture("$set",{$set:_,$set_once:p})&&(this.$h=uo(t,e,i))}else(e||i)&&this.setPersonProperties(e,i);u||s||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(Re)):d&&(e||i)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence.Cu(a)}}}setPersonProperties(t,e){if((t||e)&&this.ld("posthog.setPersonProperties")){var i=uo(this.get_distinct_id(),t,e);this.$h!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}})&&(this.$h=i)):de.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var e,i=(P(t)?t:[t]).filter(t=>A(t)&&t.length>0);0!==i.length&&this.ld("posthog.unsetPersonProperties")&&(null==(e=this.featureFlags)||e.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.$h=null)}group(t,e,r){var s;if(t&&e){null==(s=this.persistence)||s.syncCookieProperties(),this.rd();var n=this.getGroups(),o=n[t]!==e;if(o&&this.resetGroupPropertiesForFlags(t),this.register({$groups:i({},n,{[t]:e})}),(o||r)&&this.ad()){var a={$group_type:t,$group_key:e};r&&(a.$group_set=r),this.capture(rr,a)}r&&this.setGroupPropertiesForFlags({[t]:r}),o&&!r&&this.reloadFeatureFlags()}else de.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,e){var i;void 0===e&&(e=!0),null==(i=this.featureFlags)||i.setPersonPropertiesForFlags(t,e)}resetPersonPropertiesForFlags(t){var e;void 0===t&&(t=!0),null==(e=this.featureFlags)||e.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,e){var i;void 0===e&&(e=!0),this.ld("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(t,e))}resetGroupPropertiesForFlags(t){var e;null==(e=this.featureFlags)||e.resetGroupPropertiesForFlags(t)}reset(t){var e=B(t)?t:null==t?void 0:t.resetDeviceID,i=B(t)||null==t?void 0:t.bootstrap;this.dd(e,!1,i)}dd(t,e,r){var s,n,o,a,l;if(void 0===e&&(e=!1),de.info("reset"),!this.__loaded)return de.uninitializedWarning("posthog.reset");var h=null==r?void 0:r.sessionID;this.config.bootstrap=r||(null==(s=this.Th)?void 0:s.bootstrap)||{},null==(n=this.featureFlags)||null==n.updateConfig||n.updateConfig(this.config,this._shouldDisableFlags());var u=this.get_property(We),d=this.get_property(qe),v=this.get_property(ai);null==(o=this.sessionRecording)||o.flushBeforeIdentityReset();var c=this.is_capturing();e||this.consent.reset(),e||!c||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.");var _=null==(a=this.persistence)||null==a.ku?void 0:a.ku(),p=this.uh;this.uh=p||e;var f=!1;try{var g,m,b,y,w,S,x,E,T,k,P,R,I;if(null==(g=this.persistence)||g.clear(),null==(m=this.sessionPersistence)||m.clear(),this.yh.clear(),this.od(),C(v)||null==(b=this.persistence)||b.register({[ai]:v}),null==(y=this.surveys)||y.reset(),null==(w=this.featureFlags)||w.reset(),null==(S=this.conversations)||S.reset(),null==(x=this.logs)||x.reset(),null==(E=this.metrics)||E.reset(),null==(T=this.persistence)||T.set_property(Ri,Yi),null==(k=this.sessionManager)||k.resetSessionId(),this.$h=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:Ni,$device_id:null},"");else{var O=this.config.get_device_id(yr());this.register_once({distinct_id:O,$device_id:t?O:u},""),t||C(d)||this.register({[qe]:d})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),r)if(r.distinctID&&!this.nh()&&(null==(I=this.persistence)||I.set_property(Ri,r.isIdentifiedID?Xi:Yi),this.register({distinct_id:r.distinctID})),null==(P=this.featureFlags)||P.initialize(),!(N(h)||null!=(R=this.sessionManager)&&R.setBootstrapSessionId(h,!0))){var A=i({},r);delete A.sessionID,this.config.bootstrap=A}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,f=!0}finally{var M;this.uh=p,_&&(null==(M=this.persistence)||null==M.Cu||M.Cu(f))}this.cr&&(null==(l=this.conversations)||l.onRemoteConfig(this.cr)),this.reloadFeatureFlags()}shutdown(t){var e=this;return s(function*(){if(e.__loaded){e.gh=!0,clearTimeout(e.Fh),e.Fh=void 0;var t=e.jh;for(var i of(e.jh=void 0,[()=>{var t;return null==(t=e.sessionRecording)?void 0:t.dispose()},()=>{var t;return null==(t=e.logs)?void 0:t.flushLogs("sendBeacon")},()=>{var t;return null==(t=e.metrics)?void 0:t.flush("sendBeacon")},()=>{var t;return null==(t=e.metrics)?void 0:t.dispose()},()=>{var t;return null==(t=e.logs)?void 0:t.dispose()},()=>{var t;return null==(t=e.surveys)?void 0:t.dispose()},()=>{var t;return null==(t=e.autocapture)?void 0:t.dispose()},()=>null==t?void 0:t(),()=>{var t;return null==(t=e.Mh)?void 0:t.unload()},()=>{var t;return null==(t=e.Ph)?void 0:t.unload()},()=>{var t;return null==(t=e.featureFlags)?void 0:t.destroy()},()=>{var t;return null==(t=e.persistence)?void 0:t.destroy()},()=>{var t;return null==(t=e.sessionPersistence)?void 0:t.destroy()}]))try{var r=i();r&&R(r.then)&&r.then(void 0,t=>{de.error("Error during shutdown",t)})}catch(t){de.error("Error during shutdown",t)}}else de.uninitializedWarning("posthog.shutdown")})()}setIdentity(t,e){var i;delete this.config.identity_claims,this.config.identity_distinct_id=t,this.config.identity_hash=e,this.alias(t),null==(i=this.conversations)||i._onIdentityChanged()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,null==(t=this.conversations)||t._onIdentityCleared()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,e;return null!==(t=null==(e=this.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var e=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=e.sessionStartTimestamp,r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+e.sessionId);if(null!=t&&t.withTimestamp&&i){var s,n=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!i)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return r}alias(t,e){return t===this.get_property("$people_distinct_id")?(de.critical("Attempting to create alias for existing People user - aborting."),-2):this.ld("posthog.alias")?(C(e)&&(e=this.get_distinct_id()),t!==e?(this.ud(Ge,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(de.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var e=i({},this.config);if(I(t)){var r,s,n,o,a,l,h,u,d,v,c,_,p,f;or(this.config,Wo(t));var g=this.fh();if(this.persistence){var m,b,y,w="sessionStorage"===this.config.persistence||"memory"===this.config.persistence;w&&this.sessionPersistence!==this.persistence&&(null==(b=this.sessionPersistence)||b.remove(),null==(y=this.sessionPersistence)||y.destroy()),this.persistence.update_config(this.config,e,g),w?this.sessionPersistence=this.persistence:this.sessionPersistence===this.persistence?this.sessionPersistence=new Is(i({},this.config,{persistence:"sessionStorage"}),g,!1):null==(m=this.sessionPersistence)||m.update_config(i({},this.config,{persistence:"sessionStorage"}),i({},e,{persistence:"sessionStorage"}),g)}var S=this.Ch(this.config.debug);B(S)&&(this.config.debug=S),B(this.config.debug)&&(this.config.debug?(me.DEBUG=!0,kr.$t()&&kr.At("ph_debug",!0),de.info("set_config",{config:t,oldConfig:e,newConfig:i({},this.config)})):(me.DEBUG=!1,kr.$t()&&kr.Pt("ph_debug"))),null==(r=this.featureFlags)||null==r.updateConfig||r.updateConfig(this.config,this._shouldDisableFlags()),null==(s=this.exceptionObserver)||s.onConfigChange(),null==(n=this.exceptions)||n.onConfigChange(),null==(o=this.metrics)||o.onConfigChange(),null==(a=this.webMCP)||a.startIfEnabled(),null==(l=this.sessionRecording)||l.startIfEnabledOrStop(),null==(h=this.tracingHeaders)||h.startIfEnabledOrStop(),null==(u=this.autocapture)||u.startIfEnabled(),null==(d=this.heatmaps)||d.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null==(v=this.historyAutocapture)||v.startIfEnabledOrStop()),null==(c=this.exceptionObserver)||c.startIfEnabledOrStop(),null==(_=this.deadClicksAutocapture)||_.startIfEnabledOrStop(),null==(p=this.surveys)||p.loadIfEnabled(),this.hh(),null==(f=this.externalIntegrations)||f.startIfEnabledOrStop(),!e.segment&&this.config.segment&&this.persistence&&Hr(this,ko,!1)}}_overrideSDKInfo(t,e){me.LIB_NAME=t,me.LIB_VERSION=e}startSessionRecording(t){var e,i,r,s,n,o=!0===t,a={sampling:o||!(null==t||!t.sampling),linked_flag:o||!(null==t||!t.linked_flag),url_trigger:o||!(null==t||!t.url_trigger),event_trigger:o||!(null==t||!t.event_trigger)};Object.values(a).some(Boolean)&&(null==(e=this.sessionManager)||e.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(r=this.sessionRecording)||r.overrideLinkedFlag()),a.url_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!(null==(t=this.sessionRecording)||!t.started)}captureException(t,e){try{if(!this.exceptions)return;var r=this.exceptions.buildProperties(t,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(i({},r,e))}catch(t){return}}addExceptionStep(t,e){var i;null==(i=this.exceptions)||i.addExceptionStep(t,e)}captureLog(t){var e;null==(e=this.logs)||e.captureLog(t)}get logger(){var e,i;return null!==(e=null==(i=this.logs)?void 0:i.logger)&&void 0!==e?e:t.pd}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var e,i;return null!==(e=null==(i=this.toolbar)?void 0:i.loadToolbar(t))&&void 0!==e&&e}get_property(t){var e;return null==(e=this.persistence)?void 0:e.props[t]}getSessionProperty(t){var e;return null==(e=this.sessionPersistence)?void 0:e.props[t]}toString(){var t,e=null!==(t=this.config.name)&&void 0!==t?t:Bo;return e!==Bo&&(e="posthog."+e),e}_isIdentified(){var t,e;return"identified"===(null==(t=this.persistence)?void 0:t.get_property("$user_state"))||"identified"===(null==(e=this.sessionPersistence)?void 0:e.get_property("$user_state"))}ad(){var t,e;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&O(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t.__alias)&&(null==(e=this.persistence)||null==(e=e.props)||!e.$epp))}Vh(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.ad()||this.ld("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.ld("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}ld(t){return"never"===this.config.person_profiles?(de.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.sh(),this.ud(Di,!0),!0)}fh(){if("always"===this.config.cookieless_mode)return!0;var t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&"on_reject"!==this.config.cookieless_mode)}hh(){var t,e,i,r,s,n=this.fh();return this.is_capturing()||null==(t=this.logs)||t._onOptOut(),(null==(e=this.persistence)?void 0:e.hi)!==n&&(null==(i=this.persistence)||i.set_disabled(n)),(null==(r=this.sessionPersistence)?void 0:r.hi)!==n&&(null==(s=this.sessionPersistence)||s.set_disabled(n)),this.od(),n}opt_in_capturing(e){var i,r;if("always"!==this.config.cookieless_mode){if(this.nh()){var s,n,o,a,l,h;null==(s=this.sessionRecording)||s.dispose({discardBufferedEvents:!0}),this.dd(!0,!0),null==(n=this.sessionManager)||n.destroy(),null==(o=this.pageViewManager)||o.destroy(),this.sessionManager=new ao(this),this.pageViewManager=new Yr(this),this.persistence&&(this.sessionPropsManager=new ro(this,this.sessionManager,this.persistence));var u,d=null!==(a=null==(l=this.config.__extensionClasses)?void 0:l.sessionRecording)&&void 0!==a?a:null==(h=t.__defaultExtensionClasses)?void 0:h.sessionRecording;d&&(this.sessionRecording=this.ih(this.sessionRecording,new d(this)),this.cr&&(null==(u=this.sessionRecording)||null==u.onRemoteConfig||u.onRemoteConfig(this.cr)))}var v,c;this.consent.optInOut(!0),this.hh(),this.Hh(),null==(i=this.sessionRecording)||i.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null==(v=this.surveys)||v.loadIfEnabled(),null==(c=this.conversations)||c.loadIfEnabled()),(C(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!==(r=null==e?void 0:e.captureEventName)&&void 0!==r?r:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Uh()}else de.warn(Po)}opt_out_capturing(){"always"!==this.config.cookieless_mode?(this.consent.optInOut(!1),this.hh(),"on_reject"===this.config.cookieless_mode&&this.dh()):de.warn(Po)}dh(){var t,e,i=this.sessionRecording;null==i||i.dispose({discardBufferedEvents:!0}),"$posthog_cookieless"!==this.get_distinct_id()&&this.dd(!0,!0),this.register({distinct_id:Ni,$device_id:null}),this.th(i),this.sessionRecording=void 0,null==(t=this.sessionManager)||t.destroy(),null==(e=this.pageViewManager)||e.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.Uh(),this.Hh()}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return 1===t?"granted":0===t?"denied":"pending"}is_capturing(){return!this.uh&&("always"===this.config.cookieless_mode||("on_reject"===this.config.cookieless_mode?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing()))}clear_opt_in_out_capturing(){this.consent.reset(),this.hh()}_is_bot(){return a?function(t,e){if(!t)return!1;var i=t.userAgent;if(i&&J(i,e))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some(t=>J(null==t?void 0:t.brand,e)))return!0}catch(t){}return!!t.webdriver}(a,this.config.custom_blocked_useragents):void 0}Uh(){l&&("visible"===l.visibilityState?this.kh||(this.kh=!0,this.capture(tr,{title:l.title},{send_instantly:!0}),this.Sh&&(l.removeEventListener(Me,this.Sh),this.Sh=null)):this.Sh||(this.Sh=this.Uh.bind(this),vr(l,Me,this.Sh)))}debug(t){!1===t?(null==n||n.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==n||n.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(){var t=this.Th||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(de.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):function(t,e,i,r,s){var n=e in t&&!N(t[e]),o=i in t&&!N(t[i]);return n?t[e]:!!o&&(s&&s.warn("Config field '"+i+"' is deprecated. Please use '"+e+"' instead. The old field will be removed in a future major version."),t[i])}(t,"advanced_disable_flags","advanced_disable_decide",0,de)}Os(t){var e;if(N(this.config.before_send))return t;var i=Object.keys(null!==(e=t.properties)&&void 0!==e?e:{}).filter(j),r=P(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var n of r)try{if(s=n(s),N(s)){var o="Event '"+t.event+"' was rejected in beforeSend function";return L(t.event)?de.warn(o+". This can cause unexpected behavior."):de.info(o),null}s.properties&&!O(s.properties)||de.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}catch(e){return de.error("Error in beforeSend function for event '"+t.event+"':",e),null}for(var a of i)if(s.properties&&N(s.properties[a]))return de.warn("Event '"+t.event+"' had its '"+a+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return s}getPageViewId(){var t;return null==(t=this.pageViewManager.Rl)?void 0:t.pageViewId}captureTraceFeedback(t,e){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:e})}captureTraceMetric(t,e,i){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:e,$ai_metric_value:String(i)})}Ch(t){var e=B(t)&&!t,i=kr.$t()&&"true"===kr.Ot("ph_debug");return!e&&(!!i||t)}},t.__defaultExtensionClasses={},t.pd={trace:$o=()=>{},debug:$o,info:$o,warn:$o,error:$o,fatal:$o},t);!function(t,e){for(var i=0;e.length>i;i++)t.prototype[e[i]]=ar(t.prototype[e[i]])}(Go,["identify"]);var Ho=function(){me.SDK_DIST_CHANNEL="npm";var t=Eo[Bo]=new Go;return function(){function t(){t.done||(t.done=!0,Xn=!1,nr(Eo,function(t){t._dom_loaded()}))}null!=l&&l.addEventListener?"complete"===l.readyState?t():vr(l,"DOMContentLoaded",t,{capture:!1}):n&&de.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),t}();export{Os as Compression,qs as DEFAULT_PRODUCT_TOUR_APPEARANCE,zs as DisplaySurveyType,Go as PostHog,Gs as ProductTourEventName,Hs as ProductTourEventProperties,Ls as SurveyEventName,js as SurveyEventProperties,Cs as SurveyEventType,Ms as SurveyPosition,Us as SurveyQuestionBranchingType,Fs as SurveyQuestionType,Bs as SurveySchedule,Ds as SurveyTabPosition,Ns as SurveyType,As as SurveyWidgetType,Ho as default,Ho as posthog,Xs as severityLevels};
//# sourceMappingURL=module.slim.js.map