posthog-js 1.453.1 → 1.453.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/all-external-dependencies.js +1 -1
- package/dist/all-external-dependencies.js.map +1 -1
- package/dist/array.full.es5.js +1 -1
- package/dist/array.full.es5.js.map +1 -1
- package/dist/array.full.js +1 -1
- package/dist/array.full.js.map +1 -1
- package/dist/array.full.no-external.js +1 -1
- package/dist/array.full.no-external.js.map +1 -1
- package/dist/array.js +1 -1
- package/dist/array.no-external.js +1 -1
- package/dist/customizations.full.js +1 -1
- package/dist/customizations.js +1 -1
- package/dist/default-extensions.js +1 -1
- package/dist/extension-bundles.js +1 -1
- package/dist/external-scripts-loader.js +1 -1
- package/dist/integrity.json +27 -27
- package/dist/lazy-recorder.js +1 -1
- package/dist/main.js +1 -1
- package/dist/module.full.cjs +1 -1
- package/dist/module.full.js +1 -1
- package/dist/module.full.js.map +1 -1
- package/dist/module.full.no-external.cjs +1 -1
- package/dist/module.full.no-external.js +1 -1
- package/dist/module.full.no-external.js.map +1 -1
- package/dist/module.js +1 -1
- package/dist/module.mjs +1 -1
- package/dist/module.no-external.cjs +1 -1
- package/dist/module.no-external.js +1 -1
- package/dist/module.slim.js +1 -1
- package/dist/module.slim.no-external.js +1 -1
- package/dist/posthog-recorder.js +1 -1
- package/dist/surveys-preview.js +1 -1
- package/dist/surveys-preview.js.map +1 -1
- package/dist/surveys.js +1 -1
- package/dist/surveys.js.map +1 -1
- package/lib/package.json +1 -1
- package/package.json +4 -4
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e,t=["retriesPerformedSoFar"];function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var i=arguments[t];for(var s in i)({}).hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e},i.apply(null,arguments)}function s(e,t,i,s,r,n,o){try{var a=e[n](o),l=a.value}catch(e){return void i(e)}a.done?t(l):Promise.resolve(l).then(s,r)}function r(e){return function(){var t=this,i=arguments;return new Promise(function(r,n){var o=e.apply(t,i);function a(e){s(o,r,n,a,l,"next",e)}function l(e){s(o,r,n,a,l,"throw",e)}a(void 0)})}}var n="0.12.1",o={DEBUG:(!1,!1),LIB_VERSION:(n,"1.453.1"),LIB_NAME:("browser-common","web"),JS_SDK_VERSION:n},a=o,l="u">typeof window?window:void 0,d="u">typeof globalThis?globalThis:l,u=null==d?void 0:d.navigator,_=null==d?void 0:d.document,c=null==d?void 0:d.location,h=null==d?void 0:d.fetch,p=null!=d&&d.XMLHttpRequest&&"withCredentials"in new d.XMLHttpRequest?d.XMLHttpRequest:void 0,g=null==d?void 0:d.AbortController,v=null==d?void 0:d.CompressionStream,f=null==u?void 0:u.userAgent,m="undefined"!=typeof globalThis?globalThis:l;m&&"undefined"==typeof self&&(m.self=m),m&&"undefined"==typeof File&&(m.File=function(){});var y=null!=l?l:{},b=e=>{var t;return null!=e&&e.config.require_subresource_integrity?e.__loadExternalDependency:null==(t=y.__PosthogExtensions__)?void 0:t.loadExternalDependency},w="$early_access_features",S="$active_feature_flags",P="$feature_flag_details",k="$feature_flag_errors",C="$feature_flag_evaluated_at",I="$feature_flag_request_id",E="$minimal_flag_called_events",x="$enabled_feature_flags",T="$stored_group_properties",F="$stored_person_properties",R="$flag_call_reported",O="$flag_call_reported_session_id",M="$feature_flag_payloads",A="$override_feature_flags",D="$override_feature_flag_payloads",L="visibilitychange",N="$autocapture_disabled_server_side",B="$surveys",U="$surveys_loaded_at",q="$surveys_activated",H="$surveys_activated_session",G="$surveys_activated_timestamps",W="$people_distinct_id",V="distinct_id",j="$device_id",z="$device_model",K="__alias",J="__cmpns",Y="$fbc",Q="$fbc_persistence",X="$fbp",Z="$fbp_persistence",ee="__timers",te="$heatmaps_enabled_server_side",ie="$exception_capture_enabled_server_side",se="$error_tracking_suppression_rules",re="$error_tracking_capture_extension_exceptions",ne="$web_vitals_enabled_server_side",oe="$dead_clicks_enabled_server_side",ae="$product_tours_enabled_server_side",le="$logs_capture_enabled_server_side",de="$web_vitals_allowed_metrics",ue="$session_recording_remote_config",_e="$session_recording_enabled_server_side",ce="$replay_sample_rate",he="$replay_override_sampling",pe="$replay_override_linked_flag",ge="$replay_override_url_trigger",ve="$replay_override_event_trigger",fe="$sesid",me="$session_is_sampled",ye="$session_past_minimum_duration",be="$session_recording_url_trigger_activated_session",we="$session_recording_event_trigger_activated_session",Se="$debug_first_full_snapshot_timestamp",Pe="$sess_rec_flush_size",ke="$groups",Ce="ph_product_tours",Ie="$product_tours_activated",Ee="$product_tours_activated_session",xe="$conversations_widget_session_id",Te="$conversations_ticket_id",$e="$conversations_widget_state",Fe="$conversations_user_traits",Re="$user_state",Oe="$client_session_props",Me="$capture_rate_limit",Ae="$initial_campaign_params",De="$initial_referrer_info",Le="$initial_person_info",Ne="$epp",Be="$posthog_cookieless",Ue="$cookieless_mode",qe="$sdk_debug_extensions_init_method",He="$sdk_debug_extensions_init_time_ms",Ge="$sdk_debug_recording_script_not_loaded",We="$sdk_debug_replay_stale_config",Ve="$sdk_debug_replay_event_trigger_status",je="$sdk_debug_replay_linked_flag_trigger_status",ze="$sdk_debug_replay_matched_recording_trigger_groups",Ke="$sdk_debug_replay_pending_trigger_conditions",Je="$sdk_debug_replay_remote_trigger_matching_config",Ye="$sdk_debug_replay_trigger_groups_count",Qe="$sdk_debug_replay_url_trigger_status",Xe="$session_recording_start_reason",Ze="anonymous",et="identified",tt="identified_only",it="beforeunload",st="$pageview",rt="$pageleave",nt="$identify",ot="$groupidentify",at=function(e){return e.GZipJS="gzip-js",e.Base64="base64",e}({}),lt=["$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"],dt=["token"];function ut(e,t){return-1!==e.indexOf(t)}var _t=function(e){return e.replace(/^\$/,"")},ct=Object.prototype,ht=ct.hasOwnProperty,pt=ct.toString,gt=Array.isArray||function(e){return"[object Array]"===pt.call(e)},vt=e=>"function"==typeof e,ft=e=>e===Object(e)&&!gt(e),mt=e=>{if(ft(e)){for(var t in e)if(ht.call(e,t))return!1;return!0}return!1},yt=e=>void 0===e,bt=e=>"[object String]"==pt.call(e),wt=e=>bt(e)&&0===e.trim().length,St=e=>null===e,Pt=e=>yt(e)||St(e),kt=e=>"[object Number]"==pt.call(e)&&e==e,Ct=e=>kt(e)&&e>0,It=e=>"[object Boolean]"===pt.call(e),Et=e=>ut(lt,e),xt=e=>ut(dt,e);function Tt(e){switch({}.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return function(e,t){try{return e instanceof t}catch(e){return!1}}(e,Error)}}var $t=[!0,"true",1,"1","yes"],Ft=e=>ut($t,e),Rt=[!1,"false",0,"0","no"],Ot=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterestbot","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","lightpanda","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],Mt=new Map,At=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var i=function(e,t){for(var i="",s=0;t.length>s;s++){var r=t[s];i+=r.length+":"+r}return e.length+":"+e+"|"+t.length+":"+i}(e,t),s=Mt.get(i);if(void 0!==s)return s;var r=e.toLowerCase(),n=Ot.concat(t).some(e=>-1!==r.indexOf(e.toLowerCase()));return 256>Mt.size||Mt.clear(),Mt.set(i,n),n};function Dt(e,t,i,s,r){return t>i&&(s.warn("min cannot be greater than max."),t=i),kt(e)?e>i?(s.warn(" cannot be greater than max: "+i+". Using max value instead."),i):t>e?(s.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(s.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+r),Dt(null!=r?r:i,t,i,s))}var Lt="Mobile",Nt="Android",Bt="Tablet",Ut="Android Tablet",qt="iPad",Ht="Apple Watch",Gt="Safari",Wt="BlackBerry",Vt="Samsung Internet",jt="Chrome",zt="Chrome iOS",Kt="Internet Explorer",Jt="Internet Explorer Mobile",Yt="Opera",Qt="Microsoft Edge",Xt="Firefox",Zt="Firefox iOS",ei="Nintendo",ti="PlayStation",ii="Xbox",si="Android Mobile",ri="Mobile Safari",ni="Windows",oi="Windows Phone",ai="Nokia",li="Ouya",di="Generic tablet",ui="Konqueror",_i="Oculus Browser",ci="Vivaldi",hi="Yandex",pi="Whale",gi="DuckDuckGo",vi="Pale Moon",fi="Waterfox",mi="Brave",yi="Claude",bi="Codex",wi="ChatGPT",Si="Google Search App",Pi=new RegExp("Version/(\\d+(\\.\\d+)?)"),ki=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),Ci=new RegExp(ii,"i"),Ii=new RegExp("PlayStation \\w+","i"),Ei=new RegExp("Nintendo \\w+","i"),xi=new RegExp("BlackBerry|PlayBook|BB10","i"),Ti={"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"},$i=function(e,t,i,s){t=t||"";var r=function(e){return null!=e&&e.brave?mi:null}(i);return r||(null!=s&&s.detectGoogleSearchApp&&ut(e,"GSA/")?Si:ut(e," OPR/")&&ut(e,"Mini")?"Opera Mini":ut(e," OPR/")?Yt:xi.test(e)?Wt:ut(e,"IEMobile")||ut(e,"WPDesktop")?Jt:ut(e,"OculusBrowser")?_i:ut(e,"SamsungBrowser")?Vt:ut(e,"Edge")||ut(e,"Edg/")?Qt:ut(e,"Vivaldi/")?ci:ut(e,"YaBrowser/")?hi:ut(e,"Whale/")?pi:ut(e,"DuckDuckGo/")||ut(e,"Ddg/")?gi:ut(e,"Claude/")?yi:ut(e,"Codex/")?bi:ut(e,"ChatGPT/")?wi:ut(e,"FBIOS")?"Facebook Mobile":ut(e,"UCWEB")||ut(e,"UCBrowser")?"UC Browser":ut(e,"CriOS")?zt:ut(e,"CrMo")||ut(e,jt)?jt:ut(e,Nt)&&ut(e,Gt)?si:ut(e,"FxiOS")?Zt:ut(e.toLowerCase(),ui.toLowerCase())?ui:ut(e,"Brave/")?mi:((e,t)=>t&&ut(t,"Apple")||function(e){return ut(e,Gt)&&!ut(e,jt)&&!ut(e,Nt)}(e))(e,t)?ut(e,Lt)?ri:Gt:ut(e,"PaleMoon/")?vi:ut(e,"Waterfox/")?fi:ut(e,Xt)?Xt:ut(e,"MSIE")||ut(e,"Trident/")?Kt:ut(e,"Gecko")?Xt:"")},Fi={[Jt]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[Qt]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[jt]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[zt]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[Gt]:[Pi],[ri]:[Pi],[Yt]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[Xt]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[Zt]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[ui]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[Wt]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),Pi],[si]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[Vt]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[_i]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[ci]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[hi]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[pi]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[mi]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[yi]:[ki],[bi]:[ki],[wi]:[ki],[gi]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[vi]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[fi]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[Si]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[Kt]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},Ri=function(e,t,i,s){var r=Fi[$i(e,t,i,s)];if(yt(r))return null;for(var n=0;r.length>n;n++){var o=e.match(r[n]);if(o)return parseFloat(o[o.length-2])}return null},Oi=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),e=>[ii,e&&e[1]||""]],[new RegExp(ei,"i"),[ei,""]],[new RegExp(ti,"i"),[ti,""]],[xi,[Wt,""]],[new RegExp(ni,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[oi,""];if(new RegExp(Lt).test(t)&&!/IEMobile\b/.test(t))return["Windows Mobile",""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var s=Ti[i[1]]||"";return/arm/i.test(t)&&(s="RT"),[ni,s]}return[ni,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?["iOS",[e[3],e[4],e[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=yt(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),e=>e&&e[2]?[Nt,[e[2],e[3],e[4]||"0"].join(".")]:[Nt,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],Mi=function(e){return Ei.test(e)?ei:Ii.test(e)?ti:Ci.test(e)?ii:new RegExp(li,"i").test(e)?li:new RegExp("(Windows Phone|WPDesktop)","i").test(e)?oi:/iPad/.test(e)?qt:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?Ht:xi.test(e)?Wt:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(ai,"i").test(e)?ai:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(Lt).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?Nt:Ut:new RegExp("(pda|Mobile)","i").test(e)?"Generic mobile":new RegExp(Bt,"i").test(e)&&!new RegExp("Tablet pc","i").test(e)?di:""},Ai=/\bFBAV\/(\d+(?:\.\d+)*)/i,Di=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",Ai],[/\bFBAN\/EMA\b/i,"Facebook Lite",Ai],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",Ai],[/\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"]],Li=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Ni(e,t){return"string"==typeof(i=e)&&Li.test(i)?e:t();var i}function Bi(e,t){var i=new Error(t);try{Object.defineProperty(i,"name",{value:e,writable:!0,enumerable:!0,configurable:!0})}catch(e){}return i}function Ui(e){return e?e.split("#")[0]:e}var qi,Hi=["$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"],Gi="NativeGzipValidationError",Wi=e=>e.length>=2&&31===e[0]&&139===e[1],Vi=(e,t)=>e===at.GZipJS||t===at.GZipJS||"gzip"===t,ji=e=>!(!e||"object"!=typeof e)&&"NotReadableError"===("name"in e?String(e.name):""),zi=e=>{throw Bi(Gi,"Native gzip produced invalid output: "+e)},Ki=0,Ji=!1,Yi=function(){var e=r(function*(e,t){18>e.size&&zi("too-short");var i=new Uint8Array(yield e.slice(0,10).arrayBuffer());Wi(i)&&8===i[2]||zi("invalid-header");var s=new DataView(yield e.slice(e.size-8).arrayBuffer()),r=t.length>>>0;s.getUint32(4,!0)!==r&&zi("invalid-size"),(Ji||3>Ki)&&(s.getUint32(0,!0)!==(e=>{for(var t=(()=>{if(qi)return qi;qi=[];for(var e=0;256>e;e++){for(var t=e,i=0;8>i;i++)t=1&t?3988292384^t>>>1:t>>>1;qi[e]=t>>>0}return qi})(),i=4294967295,s=0;e.length>s;s++)i=t[255&(i^e[s])]^i>>>8;return(4294967295^i)>>>0})(t)&&(Ji=!0,zi("invalid-crc")),Ki++)});return function(t,i){return e.apply(this,arguments)}}();function Qi(){return Qi=r(function*(e,t,i){void 0===t&&(t=!0);try{var s=(new TextEncoder).encode(e),n=new globalThis.CompressionStream("gzip"),o=n.writable.getWriter(),a=o.write(s).then(()=>o.close()).catch(function(){var e=r(function*(e){try{yield o.abort(e)}catch(e){}throw e});return function(t){return e.apply(this,arguments)}}()),l=new Response(n.readable).blob(),d=(yield Promise.all([l,a]))[0];return yield Yi(d,s),d}catch(e){if(null!=i&&i.rethrow)throw e;return t&&console.error("Failed to gzip compress data",e),null}}),Qi.apply(this,arguments)}var Xi=function(e,t){var i=(void 0===t?{}:t).debugEnabled,s={_log(t){var s;try{s=typeof window>"u"?void 0:window}catch(e){return}for(var r=arguments.length,n=new Array(r>1?r-1:0),a=1;r>a;a++)n[a-1]=arguments[a];s&&(o.DEBUG||s.POSTHOG_DEBUG||i)&&!yt(s.console)&&s.console&&("__rrweb_original__"in s.console[t]?s.console[t].__rrweb_original__:s.console[t])(e,...n)},debug(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s._log("debug",...t)},info(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s._log("log",...t)},warn(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s._log("warn",...t)},error(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s._log("error",...t)},critical(){for(var t=arguments.length,i=new Array(t),s=0;t>s;s++)i[s]=arguments[s];console.error(e,...i)},uninitializedWarning(e){s.error("You must initialize PostHog before calling "+e)},createLogger:(t,i)=>Xi(e+" "+t,i)};return s},Zi=Xi("[PostHog.js]"),es=(e,t)=>Zi.createLogger(e,t);function ts(e,t){gt(e)&&e.forEach(t)}function is(e,t){if(!Pt(e))if(gt(e))e.forEach(t);else if((e=>e instanceof FormData)(e))e.forEach((e,i)=>t(e,i));else for(var i in e)ht.call(e,i)&&t(e[i],i)}var ss=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;t>s;s++)i[s-1]=arguments[s];for(var r of i)for(var n in r)void 0!==r[n]&&(e[n]=r[n]);return e},rs=function(e){return function(){try{for(var t=arguments.length,i=new Array(t),s=0;t>s;s++)i[s]=arguments[s];return e.apply(this,i)}catch(e){Zi.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Zi.critical(e)}}},ns=function(e){var t={};return is(e,function(e,i){(bt(e)&&e.length>0||kt(e))&&(t[i]=e)}),t};function os(e){var t=i({},e);for(var s of["name","message","stack","cause","errors"])try{s in e&&(t[s]=e[s])}catch(e){}return t}var as=["herokuapp.com","vercel.app","netlify.app"];function ls(e){var t=null==e?void 0:e.hostname;if(!bt(t))return!1;var i=t.split(".").slice(-2).join(".");for(var s of as)if(i===s)return!1;return!0}function ds(e,t,i,s){var r=null!=s?s:{},n=r.capture,o=r.passive;null==e||e.addEventListener(t,i,{capture:void 0!==n&&n,passive:void 0===o||o})}var us,_s,cs=e=>{if(_){try{for(var t=e+"=",i=_.cookie.split(";").filter(e=>e.length),s=0;i.length>s;s++){for(var r=i[s];" "==r.charAt(0);)r=r.substring(1,r.length);if(0===r.indexOf(t))return decodeURIComponent(r.substring(t.length,r.length))}}catch(e){}return null}},hs=class e{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,i,s,r){if(!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||!Number.isInteger(r)||0>t||0>i||0>s||0>r||t>0xffffffffffff||i>4095||s>1073741823||r>4294967295)throw new RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=t/Math.pow(2,40),n[1]=t/Math.pow(2,32),n[2]=t/Math.pow(2,24),n[3]=t/Math.pow(2,16),n[4]=t/256,n[5]=t,n[6]=112|i>>>8,n[7]=i,n[8]=128|s>>>24,n[9]=s>>>16,n[10]=s>>>8,n[11]=s,n[12]=r>>>24,n[13]=r>>>16,n[14]=r>>>8,n[15]=r,new e(n)}toString(){for(var e="",t=0;this.bytes.length>t;t++)e=e+(this.bytes[t]>>>4).toString(16)+(15&this.bytes[t]).toString(16),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new e(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(var t=0;16>t;t++){var i=this.bytes[t]-e.bytes[t];if(0!==i)return Math.sign(i)}return 0}},ps=class{generate(){var e=this.generateOrAbort();if(!yt(e))return e;this._timestamp=0;var t=this.generateOrAbort();if(yt(t))throw new Error("Could not generate UUID after timestamp reset");return t}generateOrAbort(){var e=(()=>{var e=Date.now();return kt(e)&&isFinite(e)?Math.min(Math.max(Math.floor(e),0),0xffffffffffff):0})();if(e>this._timestamp)this._timestamp=e,this._resetCounter();else{if(this._timestamp>=e+1e4)return;this._counter++,this._counter>4398046511103&&(this._timestamp++,this._resetCounter())}return hs.fromFieldsV7(this._timestamp,Math.trunc(this._counter/Math.pow(2,30)),this._counter&Math.pow(2,30)-1,this._random.nextUint32())}_resetCounter(){this._counter=1024*this._random.nextUint32()+(1023&this._random.nextUint32())}constructor(){this._timestamp=0,this._counter=0,this._random=new vs}},gs=e=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e},vs=class{nextUint32(){return this._buffer.length>this._cursor||((null!=us?us:us="u">typeof window&&!yt(window.crypto)&&crypto.getRandomValues?e=>{try{return crypto.getRandomValues(e)}catch(t){return gs(e)}}:gs)(this._buffer),this._cursor=0),this._buffer[this._cursor++]}constructor(){this._buffer=new Uint32Array(8),this._cursor=1/0}},fs=()=>ms().toString(),ms=()=>(_s||(_s=new ps)).generate(),ys="",bs=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var ws=null,Ss={_is_supported(){if(!St(ws))return ws;if(ws=!1,_)try{var e="__ph_cookie_support_"+fs();Ss._set(e,"xyz"),ws='"xyz"'===cs(e),Ss._remove(e)}catch(e){ws=!1}return ws},_error(e){Zi.error("cookieStore error: "+e)},_get:cs,_parse(e){var t;try{t=JSON.parse(Ss._get(e))||{}}catch(e){}return t},_set(e,t,i,s,r){if(!_)return!1;try{var n="",o="",a=function(e,t){if(t){var i=function(e,t){if(void 0===t&&(t=_),ys)return ys;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var i=e.split("."),s=Math.min(i.length,8),r="dmn_chk_"+fs();!ys&&s--;){var n=i.slice(s).join("."),o=r+"=1;domain=."+n+";path=/";t.cookie=o+";max-age=3",t.cookie.includes(r)&&(t.cookie=o+";max-age=0",ys=n)}return ys}(e);if(!i){var s=(e=>{var t=e.match(bs);return t?t[0]:""})(e);s!==i&&Zi.info("Warning: cookie subdomain discovery mismatch",s,i),i=s}return i?"; domain=."+i:""}return""}(_.location.hostname,s);if(i){var l=new Date;l.setTime(l.getTime()+864e5*i),n="; expires="+l.toUTCString()}r&&(o="; secure");var d=e+"="+encodeURIComponent(JSON.stringify(t))+n+"; SameSite=Lax; path=/"+a+o;return d.length>3686.4&&Zi.warn("cookieStore warning: large cookie, len="+d.length),_.cookie=d,!0}catch(e){return!1}},_remove(e,t){if(null!=_&&_.cookie&&(!t||!St(cs(e))))try{Ss._set(e,"",-1,t)}catch(e){return}}},Ps=null,ks={_is_supported(){if(!St(Ps))return Ps;var e=!0;if(yt(l))e=!1;else try{var t="__mplssupport__";ks._set(t,"xyz"),'"xyz"'!==ks._get(t)&&(e=!1),ks._remove(t)}catch(t){e=!1}return e||Zi.error("localStorage unsupported; falling back to cookie store"),Ps=e,e},_error(e){Zi.error("localStorage error: "+e)},_get(e){try{return null==l?void 0:l.localStorage.getItem(e)}catch(e){ks._error(e)}return null},_parse(e){try{return JSON.parse(ks._get(e))||{}}catch(e){}return null},_set(e,t){try{return null==l||l.localStorage.setItem(e,JSON.stringify(t)),!0}catch(e){ks._error(e)}return!1},_remove(e){try{null==l||l.localStorage.removeItem(e)}catch(e){ks._error(e)}}},Cs=[F,S,x,P,M,I,C,k,R],Is=[j,V,fe,me,Ne,Le,Q,Re],Es=e=>e+"_cpm",xs=["__proto__","constructor","prototype"],Ts=e=>{if(!ft(e))return{};var t={};return Object.keys(e).forEach(i=>{-1===xs.indexOf(i)&&(t[i]=e[i])}),t},$s=function(e,t){void 0===t&&(t=[]);var i={};return[...Is,...t].forEach(t=>{var s=e[t];yt(s)||St(s)||""===s||(i[t]=s)}),i},Fs=e=>{for(var t=5381,i=2166136261,s=0;e.length>s;s++){var r=e.charCodeAt(s);t=33*t^r,i=Math.imul(i^r,16777619)}return e.length.toString(36)+"."+(t>>>0).toString(36)+"."+(i>>>0).toString(36)},Rs=(e,t)=>({p:t,f:Fs(JSON.stringify(e))}),Os=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{var i=Ss._parse(Es(e)),s=(null==i?void 0:i.f)===Fs(t)&>(i.p);return{properties:s?i.p:[],isValid:s}}catch(e){return{properties:[],isValid:!1}}},Ms=(e,t)=>t+"|"+(Ss._get(Es(e))||""),As={},Ds={_is_supported:()=>!0,_error(e){Zi.error("memoryStorage error: "+e)},_get:e=>e in As?As[e]:null,_parse:e=>e in As?As[e]:null,_set:(e,t)=>(As[e]=t,!0),_remove(e){delete As[e]}},Ls=null,Ns={_is_supported(){if(!St(Ls))return Ls;if(Ls=!0,yt(l))Ls=!1;else try{var e="__support__";Ns._set(e,"xyz"),'"xyz"'!==Ns._get(e)&&(Ls=!1),Ns._remove(e)}catch(e){Ls=!1}return Ls},_error(e){Zi.error("sessionStorage error: ",e)},_get(e){try{return null==l?void 0:l.sessionStorage.getItem(e)}catch(e){Ns._error(e)}return null},_parse(e){try{return JSON.parse(Ns._get(e))||null}catch(e){}return null},_set(e,t){try{return null==l||l.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(e){Ns._error(e)}return!1},_remove(e){try{null==l||l.sessionStorage.removeItem(e)}catch(e){Ns._error(e)}}},Bs=class{constructor(e){this._instance=e}get _config(){return this._instance.config}get consent(){return this._getDnt()?0:this._storedConsent}isOptedOut(){return"always"===this._config.cookieless_mode||this.isRejected()||-1===this.consent&&"on_reject"===this._config.cookieless_mode}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this._config.opt_out_capturing_by_default}optInOut(e){this._storage._set(this._storageKey,e?1:0,this._config.cookie_expiration,this._config.cross_subdomain_cookie,this._config.secure_cookie)}reset(){this._storage._remove(this._storageKey,this._config.cross_subdomain_cookie)}get _storageKey(){var e=this._instance.config,t=e.token,i=e.opt_out_capturing_cookie_prefix;return e.consent_persistence_name||(i?i+t:"__ph_opt_in_out_"+t)}get _storedConsent(){var e=this._storage._get(this._storageKey);return Ft(e)?1:ut(Rt,e)?0:-1}get _storage(){var e=this._config.opt_out_capturing_persistence_type,t="localStorage"===e?ks:Ss,i=t._is_supported()?t:Ds;if(!this._persistentStore||this._persistentStore!==i){this._persistentStore=i;var s="localStorage"===e?Ss:ks;s._get(this._storageKey)&&(this._persistentStore._get(this._storageKey)||this.optInOut(Ft(s._get(this._storageKey))),s._remove(this._storageKey,this._config.cross_subdomain_cookie))}return this._persistentStore}_getDnt(){return!!this._config.respect_dnt&&[null==u?void 0:u.doNotTrack,null==u?void 0:u.msDoNotTrack,y.doNotTrack,null==u?void 0:u.globalPrivacyControl].some(e=>Ft(e))}},Us=["next","previous","prev",">","<","→","←","›","‹","»","«","▶","◀","❯","❮"],qs=(()=>[...Us,"+","-","−","–"])(),Hs=e=>{var t,i=!(null==(t=e.instance.persistence)||!t.get_property(oe)),s=e.instance.config.capture_dead_clicks;return It(s)?s:!!ft(s)||i},Gs=es("[SegmentIntegration]");function Ws(e,t,s){void 0===s&&(s=!0);var r=e.config.segment;if(!r)return t();var n,o=(e=>vt(e.register))(n=r)?{analytics:n}:n,a=o.analytics,l=o.filterProperties;!function(e,t,i,s){var r=t=>{var r=()=>t.anonymousId()||fs();e.config.get_device_id=r,s&&t.id()&&(e.register({distinct_id:t.id(),$device_id:r()}),e.persistence.set_property(Re,et)),i(s?void 0:t.anonymousId()||void 0)},n=t.user();"then"in n&&vt(n.then)?n.then(r):r(n)}(e,a,s=>{a.register(function(e,t,s){var r=(void 0===s?{}:s).filterProperties;"undefined"!=typeof Promise&&Promise.resolve||Gs.warn("This browser does not have Promise support, and can not use the segment integration");var n=(s,n)=>{if(!n)return s;var o=!!t&&s.event.anonymousId===t&&!s.event.userId;o||s.event.userId||s.event.anonymousId===e.get_distinct_id()||(Gs.info("No userId set, resetting PostHog"),e.reset()),o||(t=void 0),s.event.userId&&s.event.userId!==e.get_distinct_id()&&(Gs.info("UserId set, identifying with PostHog"),e.identify(s.event.userId));var a=e.calculateEventProperties(n,s.event.properties);if(!Pt(r)){var l=s.event.properties||{},d={};for(var u of Object.keys(a))ht.call(l,u)||(d[u]=a[u]);var _=((e,t)=>{var s=gt(e)?e:[e],r=i({},t);for(var n of s)try{if(r=n(r),Pt(r))return null}catch(e){return Gs.error("Error in Segment filterProperties:",e),null}return r})(r,d);if(Pt(_))return s;a=_}return s.event.properties=Object.assign({},a,s.event.properties),s};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(e){return n(e,e.event.event)},page(e){return n(e,st)},identify(e){return n(e,nt)},screen(e){return n(e,"$screen")}}}(e,s,{filterProperties:l})).then(()=>{t()},e=>{Gs.error("Failed to register the Segment integration",e),t()})},s)}var Vs="posthog-js";function js(e,t){var s=void 0===t?{}:t,r=s.organization,n=s.projectId,o=s.prefix,a=s.severityAllowList,l=void 0===a?["error"]:a,d=s.sendExceptionsToPostHog,u=void 0===d||d;return t=>{var s,a,d,_,c,h;if("*"!==l&&!l.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var p=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());t.tags["PostHog Person URL"]=p,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var g=(null==(s=t.exception)?void 0:s.values)||[],v=g.map(e=>i({},e,{stacktrace:e.stacktrace?i({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map(e=>i({},e,{platform:"web:javascript"}))}):void 0})),f={$exception_message:(null==(a=g[0])?void 0:a.value)||t.message,$exception_type:null==(d=g[0])?void 0:d.type,$exception_level:t.level,$exception_list:v,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(_=g[0])?void 0:_.value)||t.message,$sentry_exception_type:null==(c=g[0])?void 0:c.type,$sentry_tags:t.tags};return r&&n&&(f.$sentry_url=(o||"https://sentry.io/organizations/")+r+"/issues/?project="+n+"&query="+t.event_id),u&&(null==(h=e.exceptions)||h.sendExceptionEvent(f)),t}}var zs=class{constructor(e,t,i,s,r,n){this.name=Vs,this.setupOnce=function(o){o(js(e,{organization:t,projectId:i,prefix:s,severityAllowList:r,sendExceptionsToPostHog:null==n||n}))}}},Ks=class{constructor(e){this._onSessionIdChange=(e,t,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(Zi.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:i}),this._currentPageview=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this._setupSessionRotationHandler()}_setupSessionRotationHandler(){var e;this._unsubscribeSessionId=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(this._onSessionIdChange)}destroy(){var e;null==(e=this._unsubscribeSessionId)||e.call(this),this._unsubscribeSessionId=void 0}doPageView(e,t){var i,s=this._previousPageViewProperties(e,t);return this._currentPageview={pathname:null!==(i=null==l?void 0:l.location.pathname)&&void 0!==i?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var t;return this._previousPageViewProperties(e,null==(t=this._currentPageview)?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null==(e=this._currentPageview)?void 0:e.pageViewId}}_previousPageViewProperties(e,t){var i=this._currentPageview;if(!i)return{$pageview_id:t};var s={$pageview_id:t,$prev_pageview_id:i.pageViewId},r=this._instance.scrollManager.getContext();if(r&&!this._instance.config.disable_scroll_properties){var n=r.maxScrollHeight,o=r.lastScrollY,a=r.maxScrollY,l=r.maxContentHeight,d=r.lastContentY,u=r.maxContentY;if(!(yt(n)||yt(o)||yt(a)||yt(l)||yt(d)||yt(u))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),d=Math.ceil(d),u=Math.ceil(u);var _=n>1?Dt(o/n,0,1,Zi):1,c=n>1?Dt(a/n,0,1,Zi):1,h=l>1?Dt(d/l,0,1,Zi):1,p=l>1?Dt(u/l,0,1,Zi):1;s=ss(s,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:_,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:c,$prev_pageview_last_content:d,$prev_pageview_last_content_percentage:h,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:p})}}return i.pathname&&(s.$prev_pageview_pathname=i.pathname),i.timestamp&&(s.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),s}},Js=["flags","surveys"],Ys={[W]:{exposure:"hidden"},[K]:{exposure:"hidden"},[J]:{exposure:"hidden"},[ee]:{exposure:"hidden"},[Q]:{exposure:"hidden"},[Z]:{exposure:"hidden"},[N]:{exposure:"event"},[te]:{exposure:"hidden"},[le]:{exposure:"hidden"},[ie]:{exposure:"event"},[se]:{exposure:"hidden"},[re]:{exposure:"event"},[ne]:{exposure:"event"},[oe]:{exposure:"event"},[ae]:{exposure:"hidden"},[de]:{exposure:"event"},[ue]:{exposure:"hidden"},[_e]:{exposure:"hidden"},[fe]:{exposure:"hidden"},[me]:{exposure:"event"},[ce]:{exposure:"event",shouldSkipFromEventProperties:e=>St(e)},[ye]:{exposure:"event"},[be]:{exposure:"event"},[we]:{exposure:"event"},[Se]:{exposure:"event"},[Pe]:{exposure:"hidden"},[x]:{exposure:"hidden",storageGroup:"flags"},[S]:{exposure:"hidden",storageGroup:"flags"},[w]:{exposure:"hidden"},[P]:{exposure:"hidden",storageGroup:"flags"},[M]:{exposure:"hidden",storageGroup:"flags"},[I]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[E]:{exposure:"hidden",storageGroup:"flags"},[A]:{exposure:"hidden"},[D]:{exposure:"hidden"},[F]:{exposure:"hidden"},[T]:{exposure:"hidden"},[B]:{exposure:"hidden",storageGroup:"surveys"},[U]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[q]:{exposure:"event"},[H]:{exposure:"hidden"},[G]:{exposure:"hidden"},[Ce]:{exposure:"hidden"},[Ie]:{exposure:"hidden"},[Ee]:{exposure:"hidden"},[xe]:{exposure:"event"},[Te]:{exposure:"event"},[$e]:{exposure:"event"},[Fe]:{exposure:"event"},[R]:{exposure:"hidden"},[O]:{exposure:"hidden"},[ke]:{exposure:"event"},[k]:{exposure:"hidden"},[C]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Re]:{exposure:"hidden"},[Oe]:{exposure:"hidden"},[Me]:{exposure:"hidden"},[Ae]:{exposure:"hidden"},[De]:{exposure:"hidden"},[Le]:{exposure:"hidden"},[Ne]:{exposure:"hidden"},[he]:{exposure:"event"},[pe]:{exposure:"event"},[ge]:{exposure:"event"},[ve]:{exposure:"event"},[qe]:{exposure:"event"},[He]:{exposure:"event"},[Ge]:{exposure:"hidden"},[We]:{exposure:"hidden"},[Ve]:{exposure:"hidden"},[je]:{exposure:"hidden"},[ze]:{exposure:"hidden"},[Ke]:{exposure:"hidden"},[Je]:{exposure:"hidden"},[Ye]:{exposure:"hidden"},[Qe]:{exposure:"hidden"},[Xe]:{exposure:"event"}},Qs=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Xs=e=>{var t=Ys[e];if(t)return t;for(var i of Qs){var s=i[1];if(0===e.indexOf(i[0]))return s}};function Zs(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}var er=e=>{var t,i=null==(t=typeof document>"u"?void 0:document)?void 0:t.createElement("a");return yt(i)?null:(i.href=e,i)},tr=(e,t)=>{try{var i;return JSON.stringify(e,(e,t)=>Tt(t)?(null!=i||(i=new WeakMap),i.has(t)||i.set(t,os(t)),i.get(t)):"bigint"==typeof t?t.toString():t,t)}catch(t){return r=[],null!==(s=JSON.stringify(e,function(e,t){if("bigint"==typeof t)return t.toString();if("function"!=typeof t&&"symbol"!=typeof t){if(t instanceof Error)return{name:t.name,message:t.message,stack:t.stack};if(t&&"object"==typeof t){for(;r.length>0&&r[r.length-1]!==this;)r.pop();if(r.includes(t))return"[Circular]";r.push(t)}return t}}))&&void 0!==s?s:"null"}var s,r},ir=function(e,t){for(var i,s=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;s.length>r;r++){var n=s[r].split(/=(.*)/);if(n[0]===t){i=n;break}}if(!gt(i)||2>i.length)return"";var o=i[1].replace(/\+/g," ");try{o=decodeURIComponent(o)}catch(e){Zi.error("Skipping decoding for malformed query param: "+o)}return o},sr=function(e,t,i){if(!e||!t||!t.length)return e;for(var s=e.split(/#(.*)/),r=s[1],n=(s[0]||"").split(/\?(.*)/),o=n[1],a=n[0],l=(o||"").split("&"),d=[],u=0;l.length>u;u++){for(var _=l[u].split("?"),c=0;_.length>c&&!t.includes(_[c].split("=")[0]);)c++;d.push(_.length>c?_.slice(0,c).concat(_[c].split("=")[0]+"="+i).join("?"):l[u])}var h=a;return null!=o&&(h+="?"+d.join("&")),null!=r&&(h+="#"+r),h},rr=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","oppref","bfcid","irclid","_kx"],nr=(()=>["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...rr])(),or="<masked>",ar=["li_fat_id"];function lr(e,t){var i=nr.concat(t||[]),s={};return is(i,function(t){var i=ir(e,t);s[t]=i||null}),s}function dr(e){var t=function(e){return e?0===e.search("https?://(.*)google.([^/?]*)")?"google":0===e.search("https?://(.*)bing.com")?"bing":0===e.search("https?://(.*)yahoo.com")?"yahoo":0===e.search("https?://(.*)duckduckgo.com")?"duckduckgo":null:null}(e),i="yahoo"!=t?"q":"p",s={};if(!St(t)){s.$search_engine=t;var r=_?ir(_.referrer,i):"";r.length&&(s.ph_keyword=r)}return s}function ur(){return navigator.language||navigator.userLanguage}var _r="$direct";function cr(){return(null==_?void 0:_.referrer)||_r}function hr(e,t,i){var s;void 0===i&&(i=!1);var r=e?[...rr,...t||[]]:[],n=null==(s=i?Ui(null==c?void 0:c.href):null==c?void 0:c.href)?void 0:s.substring(0,1e3);return{r:cr().substring(0,1e3),u:n?sr(n,r,or):void 0}}function pr(e,t){var i;void 0===t&&(t=!1);var s=e.r,r=e.u,n=t?Ui(r):r,o={$referrer:s,$referring_domain:null==s?void 0:s==_r?_r:null==(i=er(s))?void 0:i.host};if(n){o.$current_url=n;var a=er(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname,ss(o,lr(n))}return s&&ss(o,dr(s)),o}function gr(){try{return(new Date).getTimezoneOffset()}catch(e){return}}var vr={flags:C,surveys:U},fr=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],mr=e=>e+"_cookie_identity_change_pending",yr=e=>{var t="",i=0;for(var s of e){var r=encodeURIComponent(JSON.stringify(s).slice(1,-1)).length;if(i+r>1e3)break;t+=s,i+=r}return t},br="main",wr=[x,S,P,M,I,C,E,F],Sr=e=>-1!==wr.indexOf(e),Pr=[Q,Z],kr=e=>-1!==Pr.indexOf(e),Cr=(e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch(i){return e===t}},Ir=e=>{if(!e)return{};var t=JSON.parse(e);return ft(t)?t:{}},Er=(e,t)=>{is(e,(i,s)=>{var r=Xs(s);r&&"event"!==r.exposure||{}.hasOwnProperty.call(t,s)||delete e[s]})},xr=class{constructor(e,t,s,r){if(void 0===s&&(s=!0),void 0===r&&(r=!e.cookieless_mode),this._slotState={},this._splitStorageEligible=!1,this._storesIdentityInCookie=!1,this._splitStorage=!1,this._cookieIdentityChangePending=!1,this._cookieSyncSuppressed=!1,this._pendingCrossTabFeatureFlagChanges=new Map,this._storageMigrationInProgress=!1,this._localIdentityChangePending=!1,this._crossTabFeatureFlagIdentityMismatch=!1,this._metaIdentifierChangePending=new Set,this._crossTabFeatureFlagHandlers=new Set,this._config=e,this._ownsSplitStorage=s,this.props={},this._campaign_params_url=void 0,this._name=(e=>{var t="";return e.token&&(t=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),e.persistence_name?"ph_"+e.persistence_name:"ph_"+t+"_posthog"})(e),this._disabled=e.disable_persistence||!!t,this._storage=this._buildStorage(e),this._splitStorage=this._resolveSplitStorage(e),this.load(r),this._markLoadedCrossTabFeatureFlagChangesPending(),e.debug&&Zi.info("Persistence loaded",e.persistence,i({},this.props)),this.update_config(e,e,t),this.save(),l){var n=()=>this.flush();ds(l,"beforeunload",n,{capture:!1}),ds(l,"pagehide",n,{capture:!1}),this._onStorage=e=>{if(this._splitStorageEligible&&(!e.storageArea||e.storageArea===(null==l?void 0:l.localStorage))&&e.key)if(e.key!==this._name){if(this._splitStorage){var t=Js.find(t=>e.key===this._groupEntryName(t));t&&this._syncCrossTabFeatureFlagProperties(e.key,t)}}else this._syncCrossTabFeatureFlagProperties(e.key,br)},ds(l,"storage",this._onStorage)}}reconcileFeatureFlagsBeforeMerge(){return!(this._disabled||this._cookieSyncSuppressed||this._storageMigrationInProgress)&&this._reconcileCrossTabFeatureFlagPropertiesBeforeWrite()}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(e=>{var t=e[0],i=e[1],s=this._pendingCrossTabFeatureFlagChanges.get(t);if(Sr(t)&&!0!==s)if(!0!==i){var r=new Set(s||[]);i.forEach(e=>r.add(e)),r.size&&this._setCrossTabFeatureFlagChangesPending(t,r)}else this._setCrossTabFeatureFlagChangesPending(t,!0)})}onCrossTabFeatureFlagChange(e){return this._crossTabFeatureFlagHandlers.add(e),()=>this._crossTabFeatureFlagHandlers.delete(e)}destroy(){this._onStorage&&l&&(l.removeEventListener("storage",this._onStorage),this._onStorage=void 0),this._crossTabFeatureFlagHandlers.clear()}_syncCrossTabFeatureFlagProperties(e,t,i){if(void 0===i&&(i=!0),this._disabled)return!1;var s,r;try{if(r=ks._get(e),St(r)){var n=this._slotWriteState(t);return n.storageValue=null,t!==br?n.persisted=!1:this._mergeMetaIdentifierProperties({}),!1}s=Ir(r)}catch(e){return!1}t===br&&this._mergeMetaIdentifierProperties(s);var o=t===br?s:ks._parse(this._name);if(o&&this._hasCrossTabFeatureFlagIdentityMismatch(o))return!1;var a=this._mergeCrossTabFeatureFlagProperties(s,t,i);return t===br&&this._splitStorage&&!Cr(this._partitionProps().main,s)||this._rememberCrossTabStorageFingerprint(s,t,!0,r),a}_hasCrossTabFeatureFlagIdentityMismatch(e){var t=this.props[V],i=e[V];return!yt(t)&&!yt(i)&&t!==i}_rememberCrossTabStorageFingerprint(e,t,i,s){var r=this._slotWriteState(t);r.storageValue=s,t!==br&&(r.persisted=i);try{r.fingerprint=this._entryFingerprint(e,t)}catch(e){r.fingerprint=void 0}}_mergeCrossTabFeatureFlagProperties(e,t,i){var s=!1;return wr.forEach(i=>{var r,n=null==(r=Xs(i))?void 0:r.storageGroup;if(!(t===br&&this._splitStorage&&n||t!==br&&n!==t)){var o=i in e,a=this._mergePendingCrossTabFeatureFlagChanges(i,o?e[i]:void 0),l=this._pendingCrossTabFeatureFlagChanges.has(i)?i in this.props:o;l===i in this.props&&Cr(a,this.props[i])||(l?this._setProp(i,a,!1):this._deleteProp(i,!1),s=!0)}}),s&&i&&this._crossTabFeatureFlagHandlers.forEach(e=>e()),s}_mergeMetaIdentifierProperties(e){var t=this._storesIdentityInCookie&&this._config.cookieWinsOnConflict?[...Is,...this._config.cookie_persisted_properties||[]]:[];Pr.forEach(i=>{this._metaIdentifierChangePending.has(i)||-1!==t.indexOf(i)||(i in e?Cr(e[i],this.props[i])||this._setProp(i,e[i],!1):i in this.props&&this._deleteProp(i,!1))})}_metaIdentifierCookieSyncEnabled(){return this._storesIdentityInCookie&&this._splitStorageEligible&&!this._config.cookieWinsOnConflict}_adoptMetaIdentifiersFromCookie(){if(this._metaIdentifierCookieSyncEnabled()){var e;try{e=Ss._get(this._name)||void 0}catch(e){return}if(e&&e!==this._lastSeenMetaIdentifierCookieValue){var t;this._lastSeenMetaIdentifierCookieValue=e;try{t=Ts(JSON.parse(e))}catch(e){return}Pr.forEach(e=>{!(e in t)||e in this.props||this._metaIdentifierChangePending.has(e)||this._setProp(e,t[e],!1)})}}}_rememberMetaIdentifierCookieValue(e){if(this._metaIdentifierCookieSyncEnabled())try{var t=JSON.stringify($s(e,this._config.cookie_persisted_properties||[])),i=Ss._get(this._name)||void 0;i===t&&(this._lastSeenMetaIdentifierCookieValue=i)}catch(e){}}_reconcileCrossTabFeatureFlagPropertiesBeforeWrite(){if(!this._splitStorageEligible)return!1;try{this._crossTabFeatureFlagIdentityMismatch=!1;var e,t=ks._get(this._name),i=this._slotWriteState(br),s=!1,r=!1;if(t!==i.storageValue)if(St(t))bt(i.storageValue)&&this._mergeMetaIdentifierProperties({}),i.storageValue=null;else{if(e=Ir(t),this._mergeMetaIdentifierProperties(e),this._crossTabFeatureFlagIdentityMismatch=!this._localIdentityChangePending&&this._hasCrossTabFeatureFlagIdentityMismatch(e),this._crossTabFeatureFlagIdentityMismatch)return!1;r=this._mergeCrossTabFeatureFlagProperties(e,br,!1),!this._splitStorage||Cr(this._partitionProps().main,e)?this._rememberCrossTabStorageFingerprint(e,br,!0,t):i.storageValue=t,s=!0}return this._splitStorage&&Js.forEach(t=>{var i=ks._get(this._groupEntryName(t)),n=this._slotWriteState(t),o=e||{},a=s&&wr.some(e=>{var i;return(null==(i=Xs(e))?void 0:i.storageGroup)===t&&e in o});if(i!==n.storageValue||a){if(St(i))return n.storageValue=null,n.persisted=!1,void(a&&(r=this._mergeCrossTabFeatureFlagProperties(o,t,!1)||r));var l=Ir(i);r=this._mergeCrossTabFeatureFlagProperties(l,t,!1)||r,this._rememberCrossTabStorageFingerprint(l,t,!0,i)}}),r}catch(e){return!1}}_setCrossTabFeatureFlagChangesPending(e,t){this._pendingCrossTabFeatureFlagChanges.set(e,t);var i=Xs(e);null!=i&&i.volatile||(this._slotWriteState((this._splitStorage?null==i?void 0:i.storageGroup:void 0)||br).fingerprint=void 0,this._markGroupDirty(e))}_markAllCrossTabFeatureFlagChangesPending(){wr.forEach(e=>this._pendingCrossTabFeatureFlagChanges.set(e,!0))}_markLoadedCrossTabFeatureFlagChangesPending(){if(this._splitStorageEligible)try{var e=ks._get(this._name),t=Ir(e);this._slotWriteState(br).storageValue=e,wr.forEach(e=>{var i,s=this._splitStorage?null==(i=Xs(e))?void 0:i.storageGroup:void 0,r=s?ks._get(this._groupEntryName(s)):null;if(s){var n=this._slotWriteState(s);n.storageValue=r,n.persisted=!St(r)}var o=s&&!St(r)?Ir(r):t;e in this.props?this._markPendingCrossTabFeatureFlagChanges(e,o[e],this.props[e]):e in o&&this._setCrossTabFeatureFlagChangesPending(e,!0)})}catch(e){}}_mergePendingCrossTabFeatureFlagChanges(e,t){var s=this._pendingCrossTabFeatureFlagChanges.get(e);if(!s)return t;if(!0===s)return this.props[e];if("$active_feature_flags"===e){var r=new Set(gt(t)?t:[]),n=new Set(gt(this.props[e])?this.props[e]:[]);return s.forEach(e=>n.has(e)?r.add(e):r.delete(e)),Array.from(r)}var o=ft(t)?i({},t):{},a=ft(this.props[e])?this.props[e]:{};return s.forEach(e=>{e in a?o[e]=a[e]:delete o[e]}),o}_markPendingCrossTabFeatureFlagChanges(e,t,i){if(Sr(e)){var s=this._pendingCrossTabFeatureFlagChanges.get(e);if(!0!==s){var r=t;if(this._splitStorageEligible)try{var n,o=this._splitStorage?null==(n=Xs(e))?void 0:n.storageGroup:void 0,a=o?this._groupEntryName(o):this._name;r=Ir(ks._get(a))[e]}catch(e){}var l=new Set(s||[]);if("$active_feature_flags"===e){if(!yt(t)&&!gt(t)||!yt(r)&&!gt(r)||!gt(i))return void this._setCrossTabFeatureFlagChangesPending(e,!0);var d=new Set(t||[]),u=new Set(r||[]),_=new Set(i);new Set([...d,..._]).forEach(e=>{d.has(e)!==_.has(e)&&l.add(e)}),l.forEach(e=>{u.has(e)===_.has(e)&&l.delete(e)})}else{if(!ft(i))return void(Cr(r,i)?this._pendingCrossTabFeatureFlagChanges.delete(e):this._setCrossTabFeatureFlagChangesPending(e,!0));if(!yt(t)&&!ft(t)||yt(t)&&mt(i)&&yt(r))return void this._setCrossTabFeatureFlagChangesPending(e,!0);var c=ft(t)?t:{},h=ft(r)?r:{};new Set([...Object.keys(c),...Object.keys(i)]).forEach(e=>{e in c==e in i&&Cr(c[e],i[e])||l.add(e)}),l.forEach(e=>{e in h==e in i&&Cr(h[e],i[e])&&l.delete(e)})}l.size?this._setCrossTabFeatureFlagChangesPending(e,l):this._pendingCrossTabFeatureFlagChanges.delete(e)}}}_saveDebounceMs(){var e,t=null==(e=this._config)?void 0:e.persistence_save_debounce_ms;return kt(t)&&t>0?t:0}_rememberCurrentCookieProperties(e){if(this._config.cookieWinsOnConflict&&"localstorage+cookie"===this._config.persistence.toLowerCase())if(e)try{var t=$s(e,this._config.cookie_persisted_properties||[]),i=Rs(t,this._config.cookie_persisted_properties||[]),s=JSON.stringify(t)+"|"+JSON.stringify(i),r=Ss._get(this._name)||void 0;r&&Ms(this._name,r)===s&&(this._lastSeenCookiePropertiesFingerprint=s,this._lastSeenMainCookieValue=r)}catch(e){}else try{var n=Ss._get(this._name)||void 0;this._lastSeenCookiePropertiesFingerprint=n?Ms(this._name,n):void 0,this._lastSeenMainCookieValue=n}catch(e){}}syncCookieProperties(){return this._syncCookieProperties(this._config)}_syncCookieProperties(e,t){if(void 0===t&&(t=!1),this._disabled&&!t||this._cookieSyncSuppressed||!e.cookieWinsOnConflict||"localstorage+cookie"!==e.persistence.toLowerCase())return!1;var i;try{i=Ss._get(this._name)||void 0}catch(e){}if(!i||i===this._lastSeenMainCookieValue)return!1;var s,r=Ms(this._name,i);try{s=Ts(JSON.parse(i))}catch(e){return!1}if((Ss._get(this._name)||void 0)!==i)return!1;this._lastSeenCookiePropertiesFingerprint=r,this._lastSeenMainCookieValue=i;var n=Os(this._name,i),o=[...Is,...n.properties],a={};if(Object.keys(s).forEach(e=>{var t=s[e];(yt(t)||St(t)||""===t||"$user_state"===e&&"anonymous"!==t&&"identified"!==t)&&(a[e]=!0,delete s[e])}),mt(s))return!1;var l="distinct_id"in s||"anonymous"===s.$user_state||"identified"===s.$user_state,d=this.props,u=d[V],_=d[Re],c=ss({},d);[...Is,...e.cookie_persisted_properties||[]].forEach(e=>{if(-1!==o.indexOf(e)&&!(e in s)&&!a[e]&&(l||"distinct_id"!==e&&"$user_state"!==e)){var t=c[e];(n.isValid||-1===Is.indexOf(e)||!1!==t&&0!==t)&&delete c[e]}}),this.props=ss(c,s),wr.forEach(e=>{var t=e in this.props;e in d===t&&Cr(d[e],this.props[e])||(t?this._markPendingCrossTabFeatureFlagChanges(e,d[e],this.props[e]):this._setCrossTabFeatureFlagChangesPending(e,!0))}),!l||"$user_state"in s||"$user_state"in this.props||this._setProp(Re,Ze);var h=this.props[V],p=this.props[Re];return!l||h===u&&p===_||(this._localIdentityChangePending=!0,this._cookieIdentityChangePending=!0,Ns._set(mr(this._name),!0),this._deleteProp(F),this._deleteProp(S),this._deleteProp(x),this._deleteProp(P),this._deleteProp(M),this._deleteProp(I),this._deleteProp(C),this._deleteProp(k),this._deleteProp(R),"anonymous"!==p||"identified"!==_&&"anonymous"!==s.$user_state&&(yt(u)||h===u)||(Er(this.props,s),this._deleteProp(T)),"identified"===p?this.props.$user_id=h:delete this.props.$user_id,this._deleteProp(K)),!0}consumeCookieIdentityChange(){var e=mr(this._name),t=this._cookieIdentityChangePending||!!Ns._get(e);return this._cookieIdentityChangePending=!1,t&&Ns._remove(e),t}_beginCookieSyncSuppression(e){return void 0===e&&(e=!1),!(this._cookieSyncSuppressed||this._disabled&&!e||!this._config.cookieWinsOnConflict||"localstorage+cookie"!==this._config.persistence.toLowerCase()||(this._cookieSyncSuppressed=!0,0))}_publishSuppressedCookieSnapshot(){this._cookieSyncSuppressed&&(yt(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0),delete this._slotState[br],this._writeNow(!0))}_endCookieSyncSuppression(e){if(void 0===e&&(e=!0),this._cookieSyncSuppressed)try{e?this._publishSuppressedCookieSnapshot():yt(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0)}finally{this._cookieSyncSuppressed=!1}}isDisabled(){return!!this._disabled}_buildStorage(e){-1===fr.indexOf(e.persistence.toLowerCase())&&(Zi.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t,s=function(e,t,s){void 0===e&&(e=[]),void 0===t&&(t=!1),void 0===s&&(s=()=>!1);var r=[...Is,...e];return i({},ks,{_parse(e){try{var i,n={};try{i=Ss._get(e)||void 0,n=i?Ts(JSON.parse(i)):{}}catch(e){}var o,a=JSON.parse(ks._get(e)||"{}");if(t){var l=Os(e,i),d=[...Is,...l.properties],u={};Object.keys(n).forEach(e=>{var t=n[e];St(t)||""===t||"$user_state"===e&&"anonymous"!==t&&"identified"!==t||(u[e]=t)});var _="distinct_id"in u||"anonymous"===u.$user_state||"identified"===u.$user_state;if(Object.keys(u).length>0){var c,h=a[V],p=null!==(c=a.$user_state)&&void 0!==c?c:"anonymous";r.forEach(e=>{if(-1!==d.indexOf(e)&&!(e in n)&&(_||"distinct_id"!==e&&"$user_state"!==e)){var t=a[e];(l.isValid||-1===Is.indexOf(e)||!1!==t&&0!==t)&&delete a[e]}}),!_||"$user_state"in n||"$user_state"in a||(a[Re]=Ze),!_||("distinct_id"in u?u[V]:a[V])===h&&("$user_state"in u?u[Re]:a[Re])===p||(Cs.forEach(e=>delete a[e]),"identified"===u.$user_state&&"distinct_id"in u?a.$user_id=u[V]:delete a.$user_id,"identified"!==u.$user_state&&(delete a[ke],delete a[T]),delete a.__alias)}o=ss(a,u)}else o=ss(n,a);return s()||ks._set(e,o),o}catch(e){}return null},_set(i,s,r,n,o,a){var l=ks._set(i,s,void 0,void 0,a);try{var d=$s(s,e);if(Object.keys(d).length){if(t){var u=Es(i),_=Rs(d,e);if(Ss._set(u,_,r,n,o,a),Ss._get(u)!==JSON.stringify(_)){Ss._remove(u,n);var c=$s(s);return Ss._set(i,c,r,n,o,a),l}}Ss._set(i,d,r,n,o,a)}}catch(e){ks._error(e)}return l},_remove(e,t){try{null==l||l.localStorage.removeItem(e),Ss._remove(e,t),Ss._remove(Es(e),t)}catch(e){ks._error(e)}}})}(e.cookie_persisted_properties||[],e.cookieWinsOnConflict,()=>!!this._disabled),r=!1,n=!1,o=e.persistence.toLowerCase();return"localstorage"===o&&ks._is_supported()?(t=ks,n=!0):"localstorage+cookie"===o&&s._is_supported()?(t=s,n=!0,r=!0):"sessionstorage"===o&&Ns._is_supported()?t=Ns:"memory"===o?t=Ds:"cookie"===o&&Ss._is_supported()?(t=Ss,r=!0):s._is_supported()?(t=s,n=!0,r=!0):Ss._is_supported()?(t=Ss,r=!0):t=Ds,this._splitStorageEligible=n,this._storesIdentityInCookie=r,t}_groupEntryName(e){return this._name+"__"+e}_resolveSplitStorage(e){return this._splitStorageEligible&&!!e.split_storage}properties(){var e={};return is(this.props,(t,i)=>{var s=Xs(i);if(!s||"event"===s.exposure){if(null!=s&&null!=s.shouldSkipFromEventProperties&&s.shouldSkipFromEventProperties(t))return;e[i]=t}}),e}load(e){if(void 0===e&&(e=!1),!this._disabled||e){var t=this._config.cookieWinsOnConflict&&"localstorage+cookie"===this._config.persistence.toLowerCase(),i=t?ks._parse(this._name):null,s={};if(t)try{is(s=Ts(Ss._parse(this._name)),(e,t)=>{(yt(e)||St(e)||""===e)&&delete s[t]})}catch(e){}var r=this._storage._parse(this._name);if(r&&(this.props=ss({},r)),this._splitStorage&&this._loadGroupEntries(),t&&r){var n,o,a=null==i?void 0:i[V],l=null!==(n=null==i?void 0:i.$user_state)&&void 0!==n?n:"anonymous",d=r[V],u=null!==(o=r.$user_state)&&void 0!==o?o:"anonymous";if(d!==a||u!==l){this._cookieIdentityChangePending=!0,this._disabled||Ns._set(mr(this._name),!0);var _=ss({},this.props);Cs.forEach(e=>delete _[e]),"anonymous"!==u||"identified"!==l&&"anonymous"!==s.$user_state&&(yt(a)||d===a)||(Er(_,s),delete _[T]),this.props=_;var c=new Set;Cs.forEach(e=>{var t,i=null==(t=Xs(e))?void 0:t.storageGroup;i&&c.add(i)}),c.forEach(e=>{if(!this._disabled){var t={};is(this.props,(i,s)=>{var r;(null==(r=Xs(s))?void 0:r.storageGroup)===e&&(t[s]=i)}),mt(t)?(ks._remove(this._groupEntryName(e)),this._slotState[e]={}):ks._set(this._groupEntryName(e),t)&&(this._slotState[e]={persisted:!0,fingerprint:this._entryFingerprint(t,e)})}})}}Ns._get(mr(this._name))&&(this._cookieIdentityChangePending=!0)}}_loadGroupEntries(){for(var e of Js){var t=ks._parse(this._groupEntryName(e));if(t&&!mt(t)){var i=this._slotWriteState(e);i.persisted=!0,this._mainCarriesGroupKey(e)||(i.fingerprint=this._entryFingerprint(t,e)),this._groupEntryIsStale(e,t)||ss(this.props,t)}}}_mainCarriesGroupKey(e){return Object.keys(this.props).some(t=>{var i;return(null==(i=Xs(t))?void 0:i.storageGroup)===e})}_groupEntryIsStale(e,t){var i=vr[e];if(!i)return!1;var s=t[i],r=this.props[i];return kt(s)&&kt(r)&&r>s}refreshKey(e){this._refreshKeys([e])}_refreshKeys(e){if(!this._disabled){var t,i=!1,s=()=>(i||(t=this._storage._parse(this._name),i=!0),t);e.forEach(e=>{var t;if(!this._metaIdentifierChangePending.has(e)){var i=this._splitStorage?null==(t=Xs(e))?void 0:t.storageGroup:void 0,r=i?ks._parse(this._groupEntryName(i)):s();if(r&&e in r)this._setProp(e,r[e],!1);else{if(i){var n=s();if(n&&e in n)return void this._setProp(e,n[e],!1)}this._deleteProp(e,!1)}}})}}refreshMetaIdentifiers(){this._disabled||(this._usesMetaIdentifierSnapshotRefresh()?this._refreshMetaIdentifiersIfStorageChanged():this._refreshKeys(Pr))}_refreshMetaIdentifiersIfStorageChanged(){var e=this._storageSnapshot();(yt(e)||e!==this._metaIdentifierStorageSnapshot)&&(this._refreshKeys(Pr),this._rememberMetaIdentifierStorageSnapshot(e))}_rememberMetaIdentifierStorageSnapshot(e){void 0===e&&(e=this._storageSnapshot()),this._metaIdentifierStorageSnapshot=0===this._metaIdentifierChangePending.size?e:void 0}refreshMetaIdentifiersBeforeCapture(){this._disabled||this._cookieSyncSuppressed||(this._usesMetaIdentifierSnapshotRefresh()||this._adoptMetaIdentifiersFromCookie(),this._refreshMetaIdentifiersIfStorageChanged())}_usesMetaIdentifierSnapshotRefresh(){return this._storage===Ss||this._storage===Ns||this._storage===Ds}_storageSnapshot(){var e=this._storage._get(this._name);return bt(e)?e:void 0}save(){if(!this._disabled){var e=this._saveDebounceMs();e>0?yt(this._pendingSaveTimer)&&(this._pendingSaveTimer=setTimeout(()=>{this._pendingSaveTimer=void 0,this._writeNow()},e)):this._writeNow()}}flush(){yt(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0,this._writeNow())}_writeNow(e){if(void 0===e&&(e=!1),!(this._disabled||this._cookieSyncSuppressed&&!e)){e||(this.syncCookieProperties(),this._usesMetaIdentifierSnapshotRefresh()&&this.refreshMetaIdentifiers());var t=!e&&!this._storageMigrationInProgress;t||(this._crossTabFeatureFlagIdentityMismatch=!1);var i=!!t&&this._reconcileCrossTabFeatureFlagPropertiesBeforeWrite();if(this._crossTabFeatureFlagIdentityMismatch)this._config.debug&&Zi.warn("skipping persistence write because storage belongs to a different distinct ID");else{if(e||this._adoptMetaIdentifiersFromCookie(),this._splitStorage)return this._writeNowSplit(),void(i&&this._crossTabFeatureFlagHandlers.forEach(e=>e()));var s=this._writeEntry(this._storage,this._name,this.props,br);"written"===s&&(this._rememberCurrentCookieProperties(this.props),this._rememberMetaIdentifierCookieValue(this.props)),"failed"!==s&&(this._pendingCrossTabFeatureFlagChanges.clear(),this._localIdentityChangePending=!1,this._metaIdentifierChangePending.clear()),"written"===s&&this._rememberMetaIdentifierStorageSnapshot(),i&&this._crossTabFeatureFlagHandlers.forEach(e=>e())}}}_writeNowSplit(){var e=this,t=this._partitionProps(),i=t.main,s=t.groups,r=this._writeEntry(this._storage,this._name,i,br);"written"===r&&(this._rememberCurrentCookieProperties(i),this._rememberMetaIdentifierCookieValue(i)),"failed"!==r&&(this._localIdentityChangePending=!1,this._metaIdentifierChangePending.clear(),wr.forEach(e=>{var t;null!=(t=Xs(e))&&t.storageGroup||this._pendingCrossTabFeatureFlagChanges.delete(e)})),"written"===r&&this._rememberMetaIdentifierStorageSnapshot();var n=function(t){var i,r=s[t];if(mt(r)&&(null==(i=e._slotState[t])||!i.persisted))return wr.forEach(i=>{var s;(null==(s=Xs(i))?void 0:s.storageGroup)===t&&e._pendingCrossTabFeatureFlagChanges.delete(i)}),1;var n=e._writeEntry(ks,e._groupEntryName(t),r,t);"failed"!==n&&wr.forEach(i=>{var s=Xs(i);(null==s?void 0:s.storageGroup)!==t||"written"!==n&&s.volatile||e._pendingCrossTabFeatureFlagChanges.delete(i)})};for(var o of Js)if(n(o))continue}_partitionProps(){var e={},t={flags:{},surveys:{}};return is(this.props,(i,s)=>{var r,n=null==(r=Xs(s))?void 0:r.storageGroup;n?t[n][s]=i:e[s]=i}),{main:e,groups:t}}_entryFingerprint(e,t){if(t===br)return JSON.stringify(e)+"|"+this._expire_days+"|"+this._cross_subdomain+"|"+this._secure;var i={};return is(e,(e,t)=>{var s;i[t]=null!=(s=Xs(t))&&s.volatile?"__volatile__":e}),JSON.stringify(i)}_writeEntry(e,t,i,s){var r,n=this._slotWriteState(s);if(s!==br&&!n.dirty&&!yt(n.fingerprint))return"skipped";try{if((r=this._entryFingerprint(i,s))===n.fingerprint)return n.dirty=!1,"skipped"}catch(e){r=void 0}return e._set(t,i,this._expire_days,this._cross_subdomain,this._secure,this._config.debug)?(n.dirty=!1,s!==br&&(n.persisted=!0),yt(r)||(n.fingerprint=r),this._splitStorageEligible&&(n.storageValue=ks._get(t)),"written"):(this._config.debug&&Zi.warn('failed to persist storage entry "'+t+'"; will retry on next save'),"failed")}remove(e){var t=(void 0===e?{}:e).keepGroupEntries,i=void 0!==t&&t;if(this._markAllCrossTabFeatureFlagChangesPending(),yt(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0),this._storage._remove(this._name,!1),this._storage._remove(this._name,!0),!i&&this._ownsSplitStorage)for(var s of Js)ks._remove(this._groupEntryName(s));i?delete this._slotState[br]:this._slotState={},this._lastSeenCookiePropertiesFingerprint=void 0,this._lastSeenMainCookieValue=void 0,this._lastSeenMetaIdentifierCookieValue=void 0}clear(){this.remove(),this.props={}}register_once(e,t,i){if(ft(e)){this.syncCookieProperties(),yt(t)&&(t="None"),this._expire_days=yt(i)?this._default_expiry:i;var s=!1;if(is(e,(e,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==t||(this._setProp(i,e),s=!0)}),s)return this.save(),!0}return!1}register(e,t){if(ft(e)){this.syncCookieProperties(),this._expire_days=yt(t)?this._default_expiry:t;var i=!1;if(is(e,(t,s)=>{e.hasOwnProperty(s)&&(this.props[s]!==t||ft(t)||gt(t))&&(this._setProp(s,t),i=!0)}),i)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();var t="string"==typeof e?[e]:e,i=!1;for(var s of t)s in this.props&&(this._deleteProp(s),i=!0);i&&this.save()}update_campaign_params(){var e=null==_?void 0:_.URL;if(e!==this._campaign_params_url){var t=function(e,t,i){if(!_)return{};var s,r=t?[...rr,...i||[]]:[],n=lr(sr(_.URL,r,or),e);return ss((s={},is(ar,function(e){var t=cs(e);s[e]=t||null}),s),n)}(this._config.custom_campaign_params,this._config.mask_personal_data_properties,this._config.custom_personal_data_properties),i=!mt(ns(t));return i&&this.register(t),this._campaign_params_url=e,i?t:void 0}}update_search_keyword(){var e;this.register((e=null==_?void 0:_.referrer)?dr(e):{})}update_referrer_info(){var e;this.register_once({$referrer:cr(),$referring_domain:null!=_&&_.referrer&&(null==(e=er(_.referrer))?void 0:e.host)||_r},void 0)}set_initial_person_info(){if(!this.props.$initial_campaign_params&&!this.props.$initial_referrer_info){var e=hr(this._config.mask_personal_data_properties,this._config.custom_personal_data_properties,this._config.disable_capture_url_hashes);this.register_once({[Le]:this._storesIdentityInCookie?{r:yr(e.r),u:e.u?yr(e.u):void 0}:e},void 0)}}get_initial_props(){var e={};is([De,Ae],t=>{var i=this.props[t];i&&is(i,function(t,i){e["$initial_"+_t(i)]=t})});var t=this.props[Le];return t&&ss(e,function(e,t){void 0===t&&(t=!1);var i=pr(e,t),s={};return is(i,function(e,t){s["$initial_"+_t(t)]=e}),s}(t,this._config.disable_capture_url_hashes)),e}safe_merge(e){return is(this.props,function(t,i){i in e||(e[i]=t)}),e}update_config(e,t,s){var r=e.persistence!==t.persistence,n=!((e,t)=>{if(e.length!==t.length)return!1;var i=[...e].sort(),s=[...t].sort();return i.every((e,t)=>e===s[t])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),o=r||n,a=e.cookieWinsOnConflict!==t.cookieWinsOnConflict,l=e.disable_persistence||!!s,d=!!this._disabled&&!l;l||this._syncCookieProperties(t,d),this._config=e,!l&&(r||n||a)&&(this._lastSeenCookiePropertiesFingerprint=void 0,this._lastSeenMainCookieValue=void 0,this._lastSeenMetaIdentifierCookieValue=void 0,this._syncCookieProperties(i({},e,{cookie_persisted_properties:t.cookie_persisted_properties}),d));var u=o||a?this._buildStorage(e):this._storage;this._truncateExistingPersonInfoForCookie();var _=this._resolveSplitStorage(e),c=o||_!==this._splitStorage,h=!l&&(c||e.cross_subdomain_cookie!==this._cross_subdomain||e.secure_cookie!==this._secure)&&this._beginCookieSyncSuppression(d);this._storageMigrationInProgress=c;try{if(this._default_expiry=this._expire_days=e.cookie_expiration,this.set_disabled(l),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),c){var p=this.props;this.clear(),this._storage=u,this._splitStorage=_,this.props=p,this.save()}else a&&(this._storage=u,l||(delete this._slotState[br],this._writeNow()))}finally{this._storageMigrationInProgress=!1,h&&this._endCookieSyncSuppression()}}_truncateExistingPersonInfoForCookie(){var e=this.props[Le];if(this._storesIdentityInCookie&&ft(e)&&"string"==typeof e.r){var t=yr(e.r),s="string"==typeof e.u?yr(e.u):e.u;t===e.r&&s===e.u||this._setProp(Le,i({},e,{r:t,u:s}))}}set_disabled(e){this._disabled=e,this._disabled?this.remove():this.save()}set_cross_subdomain(e){e!==this._cross_subdomain&&(this._cross_subdomain=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this._secure&&(this._secure=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){var i=this.props.__timers||{};i[e]=t,this._setProp(ee,i),this.save()}remove_event_timer(e){var t=this.props.__timers||{},i=t[e];return yt(i)||(delete t[e],this._setProp(ee,t),this.save()),i}get_property(e){return this.props[e]}set_property(e,t){this._setProp(e,t),this.save()}_setProp(e,t,i){var s;void 0===i&&(i=!0);var r=this.props[e];this.props[e]=t,i&&("distinct_id"!==e&&"$user_state"!==e||r===t||(this._localIdentityChangePending=!0),kr(e)&&!Cr(r,t)&&this._metaIdentifierChangePending.add(e),this._markPendingCrossTabFeatureFlagChanges(e,r,t),null!=(s=Xs(e))&&s.volatile||this._markGroupDirty(e))}_deleteProp(e,t){void 0===t&&(t=!0),delete this.props[e],t&&(Sr(e)&&this._setCrossTabFeatureFlagChangesPending(e,!0),kr(e)&&this._metaIdentifierChangePending.add(e),this._markGroupDirty(e))}_markGroupDirty(e){var t,i=null==(t=Xs(e))?void 0:t.storageGroup;i&&(this._slotWriteState(i).dirty=!0)}_slotWriteState(e){return this._slotState[e]||(this._slotState[e]={})}},Tr={GZipJS:"gzip-js",Base64:"base64"},$r={Activation:"events",Cancellation:"cancelEvents"},Fr={Button:"button",Tab:"tab",Selector:"selector"},Rr={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"},Or={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},Mr={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},Ar={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},Dr={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},Lr={Once:"once",Recurring:"recurring",Always:"always"},Nr={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Br={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"},Ur={Popover:"popover",Inline:"inline"};function qr(e){var t=!0;return{dispose(){if(t){t=!1;var i=e();i&&vt(i.then)&&i.then(void 0,()=>{})}}}}var Hr={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},Gr={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"},Wr={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"},Vr=es("[RateLimiter]"),jr=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach(e=>{Vr.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4})}catch(e){return void Vr.warn('could not rate limit - continuing. Error: "'+(null==e?void 0:e.message)+'"',{text:t})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return(null==(e=this.instance.config.rate_limiting)?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max((null==(e=this.instance.config.rate_limiting)?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}get isClientRateLimited(){return 1>this._refilledBucket().tokens}clientRateLimitContext(e){var t;void 0===e&&(e=!1);var i=this._refilledBucket(),s=1>i.tokens;if(s||e||(i.tokens=Math.max(0,i.tokens-1)),s&&!e){var r=(kt(i.dropped)?i.dropped:0)+1;i.dropped=r,!this.lastEventRateLimited&&this._captureWarning(r)&&(i.dropped=0)}return this.lastEventRateLimited=s,null==(t=this.instance.persistence)||t.set_property(Me,i),{isRateLimited:s,remainingTokens:i.tokens}}_refilledBucket(){var e,t=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,r=(new Date).getTime(),n=null==(e=this.instance.persistence)?void 0:e.get_property(Me),o=n?i({},n):{tokens:t,last:r};return o.tokens+=Math.max(0,r-o.last)/1e3*s,o.last=Math.max(o.last,r),o.tokens>t&&(o.tokens=t),o}_isPropertyAllowed(e){var t=this.instance.config.property_denylist;return!gt(t)||!t.includes(e)}_triggeringPage(){var e;if(this._isPropertyAllowed("$current_url")&&this._isPropertyAllowed("$pathname")&&null!=c&&c.pathname)return""+(null!==(e=c.origin)&&void 0!==e?e:"")+c.pathname}_captureWarning(e){var t,i,s=this.captureEventsBurstLimit,r=this.captureEventsPerSecond,n=this._triggeringPage(),o=this._isPropertyAllowed("$session_id")?null==(t=(i=this.instance).get_session_id)?void 0:t.call(i):void 0,a=[e+" 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 "+r+" events per second and "+s+" events burst limit."},{skip_client_rate_limiting:!0})}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}},zr=es("[RemoteConfig]"),Kr=class{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=y._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}_loadRemoteConfigJs(e){var t=b(this._instance);t?t(this._instance,"remote-config",()=>e(this.remoteConfig)):e()}_loadRemoteConfigJSON(e){var t=this._instance.__pending_remote_config_callbacks;if(t)t.push(e);else{var i=[e];this._instance.__pending_remote_config_callbacks=i;try{this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),batchKey:"remote_config",fireCallbackOnDrop:!0,callback:e=>{this._instance.__pending_remote_config_callbacks=void 0,i.forEach(t=>t(e))}})}catch(e){throw this._instance.__pending_remote_config_callbacks=void 0,e}}}load(){try{if(this.remoteConfig)return zr.info("Using preloaded remote config",this.remoteConfig),void this._onRemoteConfig(this.remoteConfig);if(this._instance._shouldDisableFlags())return void zr.warn("Remote config is disabled. Falling back to local config.");if(!this._instance.config.opt_in_site_apps)return void this._loadRemoteConfigJSON(e=>{this._onRemoteConfig(e.json,e)});this._loadRemoteConfigJs(e=>{if(!e)return zr.info("No config found after loading remote JS config. Falling back to JSON."),void this._loadRemoteConfigJSON(e=>{this._onRemoteConfig(e.json,e)});this._onRemoteConfig(e)})}catch(e){zr.error("Error loading remote config",e),this._onRemoteConfig()}}_onRemoteConfig(e,t){!e&&t&&(0===t.statusCode?t.error||zr.warn("Failed to fetch remote config from PostHog."):zr.error("Failed to fetch remote config from PostHog."));try{this._instance._onRemoteConfig(e?{ok:!0,config:e}:{ok:!1})}catch(e){zr.error("Error applying remote config",e)}if(!1!==(null==e?void 0:e.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var i;null==(i=this._instance.featureFlags)||i.ensureFlagsLoaded()}catch(e){zr.error("Error loading feature flags",e)}}},Jr=["fatal","error","warning","log","info","debug"],Yr=Uint8Array,Qr=Uint16Array,Xr=Uint32Array,Zr=new Yr([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]),en=new Yr([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]),tn=new Yr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),sn=function(e,t){for(var i=new Qr(31),s=0;31>s;++s)i[s]=t+=1<<e[s-1];var r=new Xr(i[30]);for(s=1;30>s;++s)for(var n=i[s];i[s+1]>n;++n)r[n]=n-i[s]<<5|s;return[i,r]},rn=sn(Zr,2),nn=rn[1];rn[0][28]=258,nn[258]=28;for(var on=sn(en,0)[1],an=new Qr(32768),ln=0;32768>ln;++ln){var dn=(43690&ln)>>>1|(21845&ln)<<1;an[ln]=((65280&(dn=(61680&(dn=(52428&dn)>>>2|(13107&dn)<<2))>>>4|(3855&dn)<<4))>>>8|(255&dn)<<8)>>>1}var un=function(e,t,i){for(var s=e.length,r=0,n=new Qr(t);s>r;++r)++n[e[r]-1];var o,a=new Qr(t);for(r=0;t>r;++r)a[r]=a[r-1]+n[r-1]<<1;if(i){o=new Qr(1<<t);var l=15-t;for(r=0;s>r;++r)if(e[r])for(var d=r<<4|e[r],u=t-e[r],_=a[e[r]-1]++<<u,c=_|(1<<u)-1;c>=_;++_)o[an[_]>>>l]=d}else for(o=new Qr(s),r=0;s>r;++r)o[r]=an[a[e[r]-1]++]>>>15-e[r];return o},_n=new Yr(288);for(ln=0;144>ln;++ln)_n[ln]=8;for(ln=144;256>ln;++ln)_n[ln]=9;for(ln=256;280>ln;++ln)_n[ln]=7;for(ln=280;288>ln;++ln)_n[ln]=8;var cn=new Yr(32);for(ln=0;32>ln;++ln)cn[ln]=5;var hn=un(_n,9,0),pn=un(cn,5,0),gn=function(e){return(e/8|0)+(7&e&&1)},vn=function(e,t,i){(null==t||0>t)&&(t=0),(null==i||i>e.length)&&(i=e.length);var s=new(e instanceof Qr?Qr:e instanceof Xr?Xr:Yr)(i-t);return s.set(e.subarray(t,i)),s},fn=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8},mn=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8,e[s+2]|=i>>>16},yn=function(e,t){for(var i=[],s=0;e.length>s;++s)e[s]&&i.push({s:s,f:e[s]});var r=i.length,n=i.slice();if(!r)return[new Yr(0),0];if(1==r){var o=new Yr(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort(function(e,t){return e.f-t.f}),i.push({s:-1,f:25001});var a=i[0],l=i[1],d=0,u=1,_=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=r-1;)a=i[i[_].f>i[d].f?d++:_++],l=i[d!=u&&i[_].f>i[d].f?d++:_++],i[u++]={s:-1,f:a.f+l.f,l:a,r:l};var c=n[0].s;for(s=1;r>s;++s)n[s].s>c&&(c=n[s].s);var h=new Qr(c+1),p=bn(i[u-1],h,0);if(p>t){s=0;var g=0,v=p-t,f=1<<v;for(n.sort(function(e,t){return h[t.s]-h[e.s]||e.f-t.f});r>s;++s){var m=n[s].s;if(t>=h[m])break;g+=f-(1<<p-h[m]),h[m]=t}for(g>>>=v;g>0;){var y=n[s].s;t>h[y]?g-=1<<t-h[y]++-1:++s}for(;s>=0&&g;--s){var b=n[s].s;h[b]==t&&(--h[b],++g)}p=t}return[new Yr(h),p]},bn=function(e,t,i){return-1==e.s?Math.max(bn(e.l,t,i+1),bn(e.r,t,i+1)):t[e.s]=i},wn=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new Qr(++t),s=0,r=e[0],n=1,o=function(e){i[s++]=e},a=1;t>=a;++a)if(e[a]==r&&a!=t)++n;else{if(!r&&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(r),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(r);n=1,r=e[a]}return[i.subarray(0,s),t]},Sn=function(e,t){for(var i=0,s=0;t.length>s;++s)i+=e[s]*t[s];return i},Pn=function(e,t,i){var s=i.length,r=gn(t+2);e[r]=255&s,e[r+1]=s>>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var n=0;s>n;++n)e[r+n+4]=i[n];return 8*(r+4+s)},kn=function(e,t,i,s,r,n,o,a,l,d,u){fn(t,u++,i),++r[256];for(var _=yn(r,15),c=_[0],h=_[1],p=yn(n,15),g=p[0],v=p[1],f=wn(c),m=f[0],y=f[1],b=wn(g),w=b[0],S=b[1],P=new Qr(19),k=0;m.length>k;++k)P[31&m[k]]++;for(k=0;w.length>k;++k)P[31&w[k]]++;for(var C=yn(P,7),I=C[0],E=C[1],x=19;x>4&&!I[tn[x-1]];--x);var T,F,R,O,M=d+5<<3,A=Sn(r,_n)+Sn(n,cn)+o,D=Sn(r,c)+Sn(n,g)+o+14+3*x+Sn(P,I)+(2*P[16]+3*P[17]+7*P[18]);if(A>=M&&D>=M)return Pn(t,u,e.subarray(l,l+d));if(fn(t,u,1+(A>D)),u+=2,A>D){T=un(c,h,0),F=c,R=un(g,v,0),O=g;var L=un(I,E,0);for(fn(t,u,y-257),fn(t,u+5,S-1),fn(t,u+10,x-4),u+=14,k=0;x>k;++k)fn(t,u+3*k,I[tn[k]]);u+=3*x;for(var N=[m,w],B=0;2>B;++B){var U=N[B];for(k=0;U.length>k;++k)fn(t,u,L[q=31&U[k]]),u+=I[q],q>15&&(fn(t,u,U[k]>>>5&127),u+=U[k]>>>12)}}else T=hn,F=_n,R=pn,O=cn;for(k=0;a>k;++k)if(s[k]>255){var q;mn(t,u,T[257+(q=s[k]>>>18&31)]),u+=F[q+257],q>7&&(fn(t,u,s[k]>>>23&31),u+=Zr[q]);var H=31&s[k];mn(t,u,R[H]),u+=O[H],H>3&&(mn(t,u,s[k]>>>5&8191),u+=en[H])}else mn(t,u,T[s[k]]),u+=F[s[k]];return mn(t,u,T[256]),u+F[256]},Cn=new Xr([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),In=new Yr(0),En=function(){for(var e=new Xr(256),t=0;256>t;++t){for(var i=t,s=9;--s;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e}(),xn=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};function Tn(e,t){void 0===t&&(t={});var i=function(){var e=4294967295;return{p(t){for(var i=e,s=0;t.length>s;++s)i=En[255&i^t[s]]^i>>>8;e=i},d(){return 4294967295^e}}}(),s=e.length;i.p(e);var r,n,o,a,l,d,u=(a=10+((r=t).filename&&r.filename.length+1||0),l=8,function(e,t,i,s,r,n){var o=e.length,a=new Yr(s+o+5*(1+Math.floor(o/7e3))+r),l=a.subarray(s,a.length-r),d=0;if(!t||8>o)for(var u=0;o>=u;u+=65535){var _=u+65535;o>_?d=Pn(l,d,e.subarray(u,_)):(l[u]=n,d=Pn(l,d,e.subarray(u,o)))}else{for(var c=Cn[t-1],h=c>>>13,p=8191&c,g=(1<<i)-1,v=new Qr(32768),f=new Qr(g+1),m=Math.ceil(i/3),y=2*m,b=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<y)&g},w=new Xr(25e3),S=new Qr(288),P=new Qr(32),k=0,C=0,I=(u=0,0),E=0,x=0;o>u;++u){var T=b(u),F=32767&u,R=f[T];if(v[F]=R,f[T]=F,u>=E){var O=o-u;if((k>7e3||I>24576)&&O>423){d=kn(e,l,0,w,S,P,C,I,x,u-x,d),I=k=C=0,x=u;for(var M=0;286>M;++M)S[M]=0;for(M=0;30>M;++M)P[M]=0}var A=2,D=0,L=p,N=F-R&32767;if(O>2&&T==b(u-N))for(var B=Math.min(h,O)-1,U=Math.min(32767,u),q=Math.min(258,O);U>=N&&--L&&F!=R;){if(e[u+A]==e[u+A-N]){for(var H=0;q>H&&e[u+H]==e[u+H-N];++H);if(H>A){if(A=H,D=N,H>B)break;var G=Math.min(N,H-2),W=0;for(M=0;G>M;++M){var V=u-N+M+32768&32767,j=V-v[V]+32768&32767;j>W&&(W=j,R=V)}}}N+=(F=R)-(R=v[F])+32768&32767}if(D){w[I++]=268435456|nn[A]<<18|on[D];var z=31&nn[A],K=31&on[D];C+=Zr[z]+en[K],++S[257+z],++P[K],E=u+A,++k}else w[I++]=e[u],++S[e[u]]}}d=kn(e,l,n,w,S,P,C,I,x,u-x,d),n||(d=Pn(l,d,In))}return vn(a,0,s+gn(d)+r)}(n=e,null==(o=t).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,!d)),_=u.length;return function(e,t){var i=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=2>t.level?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&xn(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var s=0;i.length>=s;++s)e[s+10]=i.charCodeAt(s)}}(u,t),xn(u,_-8,i.d()),xn(u,_-4,s),u}var $n=!!p||!!h,Fn=new WeakMap,Rn="text/plain",On=0,Mn=!1,An=(e,t)=>{var i=e.split("#"),s=i[1],r=i[0].split("?"),n=r[0],o=r[1];if(!o)return e;var a=o.split("&").filter(e=>e.split("=")[0]!==t).join("&");return n+(a?"?"+a:"")+(s?"#"+s:"")},Dn=function(e,t,s){var r;void 0===s&&(s=!0);var n=e.split("?"),o=n[0],a=n[1],l=i({},t),d=null!==(r=null==a?void 0:a.split("&").map(e=>{var t,i=e.split("="),r=i[0],n=s&&null!==(t=l[r])&&void 0!==t?t:i[1];return delete l[r],r+"="+n}))&&void 0!==r?r:[],u=function(e,t){var i,s;void 0===t&&(t="&");var r=[];return is(e,function(e,t){yt(e)||yt(t)||"undefined"===t||(i=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),s=encodeURIComponent(t),r[r.length]=s+"="+i)}),r.join(t)}(l);return u&&d.push(u),d.length>0?o+"?"+d.join("&"):o},Ln=e=>{if(e._encodedBody)return e._encodedBody;var t=e.data,i=e.compression;if(t){if(i===Tr.GZipJS){var s=Tn(function(e){var t=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var i=new Yr(e.length+(e.length>>>1)),s=0,r=function(e){i[s++]=e},n=0;t>n;++n){if(s+5>i.length){var o=new Yr(s+8+(t-n<<1));o.set(i),i=o}var a=e.charCodeAt(n);128>a?r(a):2048>a?(r(192|a>>>6),r(128|63&a)):a>55295&&57344>a?(r(240|(a=65536+(1047552&a)|1023&e.charCodeAt(++n))>>>18),r(128|a>>>12&63),r(128|a>>>6&63),r(128|63&a)):(r(224|a>>>12),r(128|a>>>6&63),r(128|63&a))}return vn(i,0,s)}(tr(t)),{mtime:0});return{contentType:Rn,body:s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength),estimatedSize:s.byteLength}}if(i===Tr.Base64){var r=function(e){return e?btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16)))):e}(tr(t)),n="sendBeacon"===e.transport,o=n?r:(e=>"data="+encodeURIComponent("string"==typeof e?e:tr(e)))(r);return{contentType:n?Rn:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var a=tr(t);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},Nn=e=>{var t,s,r=()=>"sendBeacon"===e.transport?{url:Dn(e.url,{compression:Tr.Base64}),encodedBody:Ln(i({},e,{compression:Tr.Base64,_encodedBody:void 0}))}:{url:An(e.url,"compression"),encodedBody:Ln(i({},e,{compression:void 0,_encodedBody:void 0}))};try{t=Ln(e)}catch(t){if(Vi(e.compression,ir(e.url,"compression")))return Zi.error("Failed to gzip request body, sending uncompressed payload",t),r();throw t}return t&&Vi(e.compression,ir(e.url,"compression"))&&!((s=t.body)instanceof ArrayBuffer?Wi(new Uint8Array(s)):ArrayBuffer.isView(s)&&Wi(new Uint8Array(s.buffer,s.byteOffset,s.byteLength)))?(Mn=!0,r()):{url:e.url,encodedBody:t}},Bn=e=>{try{return Nn(e)}catch(t){return Zi.error(t),void(null==e.callback||e.callback({statusCode:0,error:t}))}},Un=function(){var e=r(function*(e){var t=yield function(e,t,i){return Qi.apply(this,arguments)}(tr(e.data),a.DEBUG,{rethrow:!0});if(!t)return e;var s=yield t.arrayBuffer();return i({},e,{_encodedBody:{contentType:Rn,body:s,estimatedSize:s.byteLength}})});return function(t){return e.apply(this,arguments)}}(),qn=e=>Bi("AbortError","PostHog request timed out"+(e?" after "+e+"ms":"")),Hn=/Failed to fetch|NetworkError|Load failed/i,Gn=e=>"TypeError"===(null==e?void 0:e.name)&&Hn.test((null==e?void 0:e.message)||""),Wn=e=>{try{var t=function(e,t,i){if(void 0===t&&(t=Date.now()),void 0===i&&(i=3e5),"string"==typeof e&&e){var s=e.trim(),r=/^\d+\s*,/.test(s)?s.slice(0,s.indexOf(",")).trim():s;if(/^\d+$/.test(r)){var n=1e3*Math.min(Number(r),i/1e3);return n>0?n:void 0}if(/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(r)){var o=/^\w{3} \w{3} /.test(r)?r+" GMT":r,a=Date.parse(o)-t;if(Number.isFinite(a)&&a>0)return Math.min(a,i)}}}(e());return yt(t)?void 0:Math.min(t,3e4)}catch(e){return}},Vn=e=>{var t=Bn(e);if(t){var i=new p;Fn.set(i,!0);var s=t.url,r=t.encodedBody;i.open(e.method||"GET",s,!0);var n=null!=r?r:{},o=n.contentType,a=n.body;is(e.headers,function(e,t){i.setRequestHeader(t,e)}),o&&i.setRequestHeader("Content-Type",o),e.timeout&&(i.timeout=e.timeout);var l=!1;i.ontimeout=()=>{l=!0},i.onloadend=()=>{if(l){var t=qn(e.timeout);return Zi.warn(t),void(null==e.callback||e.callback({statusCode:0,error:t}))}var s={statusCode:i.status,text:i.responseText};if(200===i.status)try{s.json=JSON.parse(i.responseText)}catch(e){}null==e.callback||e.callback(s,Wn(()=>i.getResponseHeader("Retry-After")))},null==e.onSend||e.onSend(s),i.send(a)}},jn=e=>{var t=Bn(e);if(t){var s=t.url,r=t.encodedBody,n=null!=r?r:{},o=n.contentType,a=n.body,l=n.estimatedSize,d=new Headers;is(e.headers,function(e,t){d.append(t,e)}),o&&d.append("Content-Type",o);var u=null,_=!1;if(g){var c=new g;u={signal:c.signal,timeout:setTimeout(()=>{_=!0;try{c.abort(qn(e.timeout))}catch(e){v(e)}},e.timeout)}}var p=!1,v=t=>{p||(p=!0,_&&"AbortError"===(null==t?void 0:t.name)||Gn(t)?Zi.warn(t):Zi.error(t),null==e.callback||e.callback({statusCode:0,error:t}))},f=0,m=()=>{On-=f,f=0,u&&clearTimeout(u.timeout)};try{var y,b=i({method:(null==e?void 0:e.method)||"GET",headers:d,referrerPolicy:"strict-origin",body:a,signal:null==(y=u)?void 0:y.signal},e.fetchOptions);null==e.onSend||e.onSend(s);var w=null!=l?l:yt(a)?0:void 0;b.keepalive="POST"===b.method&&!e._keepaliveDisabled&&!1!==b.keepalive&&b.body===a&&!yt(w)&&w>=0&&52428.8>On+w,b.keepalive&&(On+=f=w),h(s,b).then(t=>t.text().then(i=>{if(!p){var s={statusCode:t.status,text:i};if(200===t.status)try{s.json=JSON.parse(i)}catch(e){Zi.error(e)}p=!0,m(),null==e.callback||e.callback(s,Wn(()=>t.headers.get("Retry-After")))}})).catch(e=>{m(),v(e)}).finally(m)}catch(e){m(),v(e)}}},zn=e=>{try{var t,s=Nn(e),r=s.url,n=s.encodedBody,o=null!=n?n:{},a=o.body,l=o.estimatedSize;if(!a)return;var d=a instanceof Blob?a:new Blob([a],{type:o.contentType});if(u.sendBeacon(r,d))return;var _=gt(e.data)?e.data:null==(t=e.data)?void 0:t.batch;if(gt(_)&&_.length>1&&(null!=l?l:0)>16384){var c=Math.ceil(_.length/2),p=t=>gt(e.data)?t:i({},e.data,{batch:t});return zn(i({},e,{data:p(_.slice(0,c))})),void zn(i({},e,{data:p(_.slice(c))}))}Zi.warn("Beacon of ~"+(null!=l?l:0)+" bytes was rejected by the browser, falling back to "+(h?"fetch":"XHR")),h?jn(i({},e,{_keepaliveDisabled:!0})):Vn(e)}catch(e){Zi.warn("Beacon send failed",e)}},Kn=(e,t,s,r)=>{var n="query"===r?"POST"===t?"sent_at":"_":void 0;return Dn(s===Tr.GZipJS?An(e,"compression"):e,i({},n?{[n]:Date.now().toString()}:{},s===Tr.GZipJS?{}:{compression:s}))},Jn=(()=>{var e=[];return h&&e.push({transport:"fetch",method:jn}),p&&e.push({transport:"XHR",method:Vn}),null!=u&&u.sendBeacon&&e.push({transport:"sendBeacon",method:zn}),e})(),Yn=!$n&&-1===(null==f?void 0:f.indexOf("MSIE"))&&-1===(null==f?void 0:f.indexOf("Mozilla"));function Qn(e,t,s){var r;s&&(t=i({},t,{callback:e=>s(e)})),e.__loaded?Yn?e.__request_queue.push(t):e.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:429})):(t.transport=t.transport||e.config.api_transport,t.headers=i({},e.config.request_headers,t.headers),t.compression="best-available"===t.compression?null!==(r=e.compression)&&void 0!==r?r:t.compressionFallback:t.compression,(yt(e.config.disable_beacon)?e.config.__preview_disable_beacon:e.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||e.config.fetch_options,null==t.onDispatch||t.onDispatch(),((e,t)=>{var s,r,n,o=i({},e,{callback:null!=t?t:t=>null==e.callback?void 0:e.callback(t)});o.timeout=o.timeout||6e4;var a,l,d,u,_,c=null!==(s=o.transport)&&void 0!==s?s:"fetch";"sendBeacon"===c&&yt(o.compression)&&o.data&&(o.compression=Tr.Base64),"POST"===o.method&&o.data&&("capture-body"===o.timestampMode?o.data={api_key:null!==(l=null==(_=(u=(gt(a=o.data)?a:[a]).map(e=>i({},e,e.timestamp instanceof Date&&!isNaN(e.timestamp.getTime())?{timestamp:e.timestamp.toISOString()}:{})))[0])||null==(d=_.properties)?void 0:d.token)&&void 0!==l?l:null==_?void 0:_.token,batch:u,sent_at:(new Date).toISOString()}:"body"===o.timestampMode&&(o.data=function(e,t){return void 0===t&&(t=(new Date).toISOString()),gt(e)?e.map(e=>i({},e,{sent_at:t})):i({},e,{sent_at:t})}(o.data))),o.url=Kn(o.url,o.method,o.compression,o.timestampMode);var h=Jn.filter(e=>!o.disableTransport||!e.transport||!o.disableTransport.includes(e.transport)),p=null!==(r=null==(n=function(e,t){for(var i=0;e.length>i;i++)if(t(e[i]))return e[i]}(h,e=>e.transport===c))?void 0:n.method)&&void 0!==r?r:h[0].method;if(!p)throw new Error("No available transport method");var g=e=>{try{p(e)}catch(e){Gn(e)?Zi.warn(e):Zi.error(e),null==o.callback||o.callback({statusCode:0,error:e})}};"sendBeacon"!==c&&!o.preferSyncCompression&&o.data&&o.compression===Tr.GZipJS&&v&&"undefined"!=typeof Promise&&!Mn?Un(o).then(e=>{g(e)}).catch(t=>{if(ji(t))return Mn=!0,void g(i({},o,{compression:void 0,url:Kn(e.url,e.method,void 0,e.timestampMode)}));(e=>{if(!e||"object"!=typeof e)return!1;var t="name"in e?String(e.name):"";return ji(e)||t===Gi})(t)&&(Mn=!0),g(o)}):g(o)})(t,(i,r)=>{e.rateLimiter.checkForLimiting(i),400>i.statusCode||null==e.config.on_request_error||e.config.on_request_error(i),s?s(i,r):null==t.callback||t.callback(i)})):t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:0}))}var Xn=class{constructor(e,t){this._isPaused=!0,this._queue=[],this._flushTimeoutMs=Dt((null==t?void 0:t.flush_interval_ms)||3e3,250,5e3,Zi.createLogger("flush interval"),3e3),this._sendRequest=e}enqueue(e){this._queue.push(e),this._flushTimeout||this._setFlushTimeout()}unload(){this._clearFlushTimeout();var e=this._queue.length>0?this._formatQueue():{},t=Object.values(e);[...t.filter(e=>0===e.url.indexOf("/e")),...t.filter(e=>0!==e.url.indexOf("/e"))].map(e=>{this._sendRequestSafely(i({},e,{callback:void 0}),"sendBeacon")})}enable(){this._isPaused=!1,this._setFlushTimeout()}_setFlushTimeout(){this._isPaused||(this._flushTimeout=setTimeout(()=>{this._clearFlushTimeout(),this._flush()},this._flushTimeoutMs))}_flush(){if(this._queue.length>0){var e=this._formatQueue();for(var t in e)this._sendRequestSafely(e[t])}}_sendRequestSafely(e,t){try{this._sendRequest(e,t)}catch(e){Zi.error(e)}}_clearFlushTimeout(){clearTimeout(this._flushTimeout),this._flushTimeout=void 0}_formatQueue(){var e={},t={};is(this._queue,s=>{var r,n=s,o=((n?n.batchKey:null)||n.url)+(n.batchGroup?":"+n.batchGroup:"");yt(e[o])&&(e[o]=i({},n,{data:[],callback:void 0,fireCallbackOnDrop:void 0}),t[o]=[]),null==(r=e[o].data)||r.push(n.data),n.callback&&t[o].push(n.callback)});var s=function(){var i=t[r];i.length&&(e[r].callback=e=>{for(var t of i)t(e)})};for(var r in t)s();return this._queue=[],e}},Zn=class{constructor(e){this._instance=e,this._isPolling=!1,this._pollIntervalMs=3e3,this._queue=[],this._queue=[],this._areWeOnline=!0,this.resume()}resume(){if(!yt(l)&&"onLine"in l.navigator){if(this._areWeOnline=l.navigator.onLine,this._onlineListener)return;this._onlineListener=()=>{this._areWeOnline=!0,this._flush()},this._offlineListener=()=>{this._areWeOnline=!1},ds(l,"online",this._onlineListener),ds(l,"offline",this._offlineListener)}}get length(){return this._queue.length}retriableRequest(e,s){var r=e.retriesPerformedSoFar,n=function(e,t){if(null==e)return{};var i={};for(var s in e)if({}.hasOwnProperty.call(e,s)){if(-1!==t.indexOf(s))continue;i[s]=e[s]}return i}(e,t);Ct(r)&&(n.url=Dn(n.url,{retry_count:r})),Qn(this._instance,s?i({},n,{transport:s}):n,(e,t)=>{if(200!==e.statusCode&&(400>e.statusCode||e.statusCode>=500)){if((0===e.statusCode?3:10)>(null!=r?r:0))return void this._enqueue(i({retriesPerformedSoFar:r},n),t);0===e.statusCode&&Zi.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!=r?r:0)+" retries.")}null==n.callback||n.callback(e)})}_enqueue(e,t){var i=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=i+1;var s=Math.max(function(e){var t=3e3*Math.pow(2,e),i=t/2,s=Math.min(18e5,t),r=(Math.random()-.5)*(s-i);return Math.ceil(s+r)}(i),null!=t?t:0),r=Date.now()+s;this._queue.push({retryAt:r,requestOptions:e});var n="Enqueued failed request for retry in "+s;navigator.onLine||(n+=" (Browser is offline)"),Zi.warn(n),this._isPolling||(this._isPolling=!0,this._poll())}_poll(){if(this._poller&&clearTimeout(this._poller),0===this._queue.length)return this._isPolling=!1,void(this._poller=void 0);this._poller=setTimeout(()=>{this._areWeOnline&&this._queue.length>0&&this._flush(),this._poll()},this._pollIntervalMs)}_flush(){var e=Date.now(),t=[],i=this._queue.filter(i=>e>i.retryAt||(t.push(i),!1));if(this._queue=t,i.length>0)for(var s of i)this.retriableRequest(s.requestOptions)}unload(){for(var e of(this._poller&&(clearTimeout(this._poller),this._poller=void 0),this._isPolling=!1,yt(l)||(this._onlineListener&&(l.removeEventListener("online",this._onlineListener),this._onlineListener=void 0),this._offlineListener&&(l.removeEventListener("offline",this._offlineListener),this._offlineListener=void 0)),this._queue)){var t=e.requestOptions;try{this._instance._send_request(i({},t,{callback:gt(t.data)?void 0:t.callback,transport:"sendBeacon"}))}catch(e){Zi.error(e)}}this._queue=[]}},eo=class{constructor(e){this._instance=e,this._updateScrollData=()=>{var e,t,i,s;this._context||(this._context={});var r=this.scrollElement(),n=this.scrollY(),o=r?Math.max(0,r.scrollHeight-r.clientHeight):0,a=n+((null==r?void 0:r.clientHeight)||0),l=(null==r?void 0:r.scrollHeight)||0;this._context.lastScrollY=Math.ceil(n),this._context.maxScrollY=Math.max(n,null!==(e=this._context.maxScrollY)&&void 0!==e?e:0),this._context.maxScrollHeight=Math.max(o,null!==(t=this._context.maxScrollHeight)&&void 0!==t?t:0),this._context.lastContentY=a,this._context.maxContentY=Math.max(a,null!==(i=this._context.maxContentY)&&void 0!==i?i:0),this._context.maxContentHeight=Math.max(l,null!==(s=this._context.maxContentHeight)&&void 0!==s?s:0)}}get _scrollRoot(){return this._instance.config.scroll_root_selector}getContext(){return this._context}resetContext(){var e=this._context;return this._context=void 0,setTimeout(this._updateScrollData,0),e}startMeasuringScrollPosition(){ds(l,"scroll",this._updateScrollData,{capture:!0}),ds(l,"scrollend",this._updateScrollData,{capture:!0}),ds(l,"resize",this._updateScrollData)}scrollElement(){var e;if(!this._scrollRoot)return null==l||null==(e=l.document)?void 0:e.documentElement;for(var t of gt(this._scrollRoot)?this._scrollRoot:[this._scrollRoot]){var i,s=null==l||null==(i=l.document)?void 0:i.querySelector(t);if(s)return s}}_scrollPosition(e){var t,i,s="y"===e?"scrollTop":"scrollLeft";if(this._scrollRoot){var r=this.scrollElement();return r&&r[s]||0}return l?"y"===e?l.scrollY||l.pageYOffset||(null==(t=l.document)||null==(t=t.documentElement)?void 0:t.scrollTop)||0:l.scrollX||l.pageXOffset||(null==(i=l.document)||null==(i=i.documentElement)?void 0:i.scrollLeft)||0:0}scrollY(){return this._scrollPosition("y")}scrollX(){return this._scrollPosition("x")}},to=e=>hr(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties,null==e?void 0:e.config.disable_capture_url_hashes),io=class{constructor(e,t,i,s){this._onSessionIdCallback=e=>{var t=this._getStored();if(!t||t.sessionId!==e){var i={sessionId:e,props:this._sessionSourceParamGenerator(this._instance)};this._persistence.register({[Oe]:i})}},this._instance=e,this._sessionIdManager=t,this._persistence=i,this._sessionSourceParamGenerator=s||to,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStored(){return this._persistence.props[Oe]}getSetOnceProps(){var e,t=null==(e=this._getStored())?void 0:e.props;return t?"r"in t?pr(t,this._instance.config.disable_capture_url_hashes):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return is(ns(this.getSetOnceProps()),(t,i)=>{"$current_url"===i&&(i="url"),e["$session_entry_"+_t(i)]=t}),e}},so=class{on(e,t){return this._events[e]||(this._events[e]=[]),this._events[e].push(t),()=>{this._events[e]=this._events[e].filter(e=>e!==t)}}emit(e,t){for(var i of this._events[e]||[])i(t);for(var s of this._events["*"]||[])s(e,t)}constructor(){this._events={}}},ro=es("[SessionId]"),no=864e5,oo=class{on(e,t){return this._eventEmitter.on(e,t)}constructor(e,t,i){var s;if(this._lastPersistedActivityTimestamp=null,this._lastCookieSyncTimestamp=null,this._sessionIdChangedHandlers=[],this._beforeUnloadListener=void 0,this._destroyed=!1,this._eventEmitter=new so,this._sessionHasBeenIdleTooLong=(e,t)=>!(!Ct(e)||!Ct(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if("always"===e.config.cookieless_mode)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this._config=e.config,this._persistence=e.persistence,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._pendingBootstrapSession=void 0,this._sessionActivityTimestamp=null,this._sessionIdGenerator=t||fs,this._windowIdGenerator=i||fs;var r=this._config.persistence_name||this._config.token;if(this._sessionTimeoutMs=1e3*Dt(this._config.session_idle_timeout_seconds||1800,60,36e3,ro.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this._resetIdleTimer(),this._window_id_storage_key="ph_"+r+"_window_id",this._primary_window_exists_storage_key="ph_"+r+"_primary_window_exists",this._canUseSessionStorage()){var n=Ns._parse(this._window_id_storage_key),o=Ns._parse(this._primary_window_exists_storage_key);n&&!o?this._windowId=n:Ns._remove(this._window_id_storage_key),Ns._set(this._primary_window_exists_storage_key,!0)}null!=(s=this._config.bootstrap)&&s.sessionID&&this.setBootstrapSessionId(this._config.bootstrap.sessionID),this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return yt(this._sessionIdChangedHandlers)&&(this._sessionIdChangedHandlers=[]),this._sessionIdChangedHandlers.push(e),this._sessionId&&e(this._sessionId,this._windowId),()=>{this._sessionIdChangedHandlers=this._sessionIdChangedHandlers.filter(t=>t!==e)}}_canUseSessionStorage(){return"memory"!==this._config.persistence&&!this._persistence._disabled&&Ns._is_supported()}_setWindowId(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&Ns._set(this._window_id_storage_key,e))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?Ns._parse(this._window_id_storage_key):null}_isActivityChangeBelowGranularity(e){var t=this._lastPersistedActivityTimestamp;return!St(t)&&!St(e)&&5e3>Math.abs(e-t)}_setSessionId(e,t,i){var s=t!==this._sessionActivityTimestamp,r=!(e!==this._sessionId||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this._sessionId=e,r&&!s||r&&this._isActivityChangeBelowGranularity(t)||(this._lastPersistedActivityTimestamp=t,this._persistence.register({[fe]:[t,e,i]}))}_useCrossTabRefreshHardening(){var e,t=null==(e=this._config)?void 0:e.persistence_save_debounce_ms;return Ct(t)&&t>0}_refreshSessionIdFromStorage(){this._useCrossTabRefreshHardening()?this._persistence.refreshKey(fe):(this._persistence.flush(),this._persistence.load())}_flushPendingActivityTimestamp(){var e;if(!St(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this._lastPersistedActivityTimestamp){this._refreshSessionIdFromStorage();var t=this._getSessionId();t[1]===this._sessionId&&t[2]===this._sessionStartTimestamp&&(this._lastPersistedActivityTimestamp=this._sessionActivityTimestamp,this._persistence.register({[fe]:[this._sessionActivityTimestamp,null!==(e=this._sessionId)&&void 0!==e?e:null,this._sessionStartTimestamp]}),this._persistence.flush())}}_freshestActivityTimestamp(){var e=this._getSessionId()[0],t=Ct(e)?e:0,i=Ct(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,i)}_isSessionIdleAfterCrossTabRefresh(e){return this._refreshSessionIdFromStorage(),this._sessionHasBeenIdleTooLong(e,this._freshestActivityTimestamp())}_getSessionId(){var e=this._persistence.props[fe];return gt(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this._lastPersistedActivityTimestamp=null,this._pendingBootstrapSession=void 0,clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._setSessionId(null,null,null)}setBootstrapSessionId(e,t){void 0===t&&(t=!1);var i=function(e,t){void 0===t&&(t=(new Date).getTime());try{var i=(e=>{var t=e.replace(/-/g,"");if(32!==t.length)throw new Error("Not a valid UUID");if("7"!==t[12])throw new Error("Not a UUIDv7");return parseInt(t.substring(0,12),16)})(e);return i>t+6e4?void ro.error("Bootstrap sessionID cannot be in the future"):i}catch(e){return void ro.error("Invalid sessionID in bootstrap",e)}}(e);return!yt(i)&&(t?this._pendingBootstrapSession={sessionId:e,sessionStartTimestamp:i}:this._setSessionId(e,(new Date).getTime(),i),!0)}destroy(){this._destroyed=!0,this._flushPendingActivityTimestamp(),clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._beforeUnloadListener&&l&&(l.removeEventListener(it,this._beforeUnloadListener,{capture:!1}),this._beforeUnloadListener=void 0),this._sessionIdChangedHandlers=[]}_listenToReloadWindow(){this._beforeUnloadListener=()=>{this._flushPendingActivityTimestamp(),this._canUseSessionStorage()&&Ns._remove(this._primary_window_exists_storage_key)},ds(l,it,this._beforeUnloadListener,{capture:!1})}checkAndGetSessionAndWindowId(e,t,i){if(void 0===e&&(e=!1),void 0===t&&(t=null),void 0===i&&(i=!1),"always"===this._config.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var s=t||(new Date).getTime(),r=this._sessionId;if(i)this._lastCookieSyncTimestamp=s;else if(St(this._lastCookieSyncTimestamp)||this._lastCookieSyncTimestamp>s||s-this._lastCookieSyncTimestamp>=1e3){var n,o;null==(n=(o=this._persistence).syncCookieProperties)||n.call(o),this._lastCookieSyncTimestamp=s}var a=this._getSessionId(),l=a[1],d=a[2],u=!yt(r)&&l!==r,_=this._freshestActivityTimestamp(),c=this._getWindowId(),h=this._pendingBootstrapSession,p=!!h&&(h.sessionStartTimestamp>s+6e4||s-h.sessionStartTimestamp>no),g=h?p:Ct(d)&&Math.abs(s-d)>no,v=!1,f=u,m=!l||!!h,y=l,b=!m&&!e&&this._sessionHasBeenIdleTooLong(s,_);if(b){(b=this._isSessionIdleAfterCrossTabRefresh(s))||ro.info("cross-tab refresh kept the session alive",{sessionId:l});var w=this._getSessionId();l=w[1],d=w[2],b||(m=!l||!!h)}if(m||b||g){f=!1;var S=h&&!p;l=S?h.sessionId:this._sessionIdGenerator(),c=this._windowIdGenerator(),ro.info("new session ID assigned",{sessionId:l,windowId:c,bootstrapped:!!S,changeReason:{noSessionId:m,activityTimeout:b,sessionPastMaximumLength:g}}),d=S?h.sessionStartTimestamp:s,this._pendingBootstrapSession=void 0,v=!0}else c||(c=this._windowIdGenerator(),v=!0),(f=f||l!==y)&&(ro.info("adopted cross-tab session id",{sessionId:l,windowId:c}),v=!0);var P=Ct(_)&&e&&!g?_:s,k=Ct(d)?d:(new Date).getTime();this._setWindowId(c),this._setSessionId(l,P,k),e||this._resetIdleTimer();var C={noSessionId:m,activityTimeout:b,sessionPastMaximumLength:g,crossTabAdoption:f};return v&&this._sessionIdChangedHandlers.forEach(e=>e(l,c,C)),{sessionId:l,windowId:c,sessionStartTimestamp:k,changeReason:v?C:void 0,lastActivityTimestamp:_}}_resetIdleTimer(){this._destroyed||(clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=setTimeout(()=>{if(!this._destroyed)if(this._isSessionIdleAfterCrossTabRefresh((new Date).getTime())){var e=this._sessionId;this.resetSessionId(),this._eventEmitter.emit("forcedIdleReset",{idleSessionId:e})}else this._resetIdleTimer()},1.1*this.sessionTimeoutMs))}},ao=Object.freeze(["2026-08-30","2026-08-29","2026-06-25","2026-05-30","2026-01-30","2025-11-30","2025-05-24"]);function lo(){return(lo=r(function*(){var e=null==u?void 0:u.userAgentData;if(null!=e&&e.getHighEntropyValues)try{var t,i=null==(t=yield e.getHighEntropyValues(["model"]))?void 0:t.model;return bt(i)&&i.length>0?i:void 0}catch(e){return void Zi.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",e)}})).apply(this,arguments)}function uo(e,t){var i="$survey_"+t+"/"+e.id;return e.current_iteration&&e.current_iteration>0&&(i="$survey_"+t+"/"+e.id+"/"+e.current_iteration),i}function _o(e,t,i){return tr({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}var co,ho="custom",po="i.posthog.com",go=/^\/static\//,vo=["/s/","/e/","/i/"],fo=class{constructor(e){this._regionCache={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,t=null==(e=this.instance.config.ui_host)?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+po,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this._regionCache[this.apiHost]||(this._regionCache[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":ho),this._regionCache[this.apiHost]}_staticAssetHostOverride(e){if(go.test(e)){var t=this.instance.config.asset_host;if("string"==typeof t)return t.trim().replace(/\/$/,"")||void 0}}_urlKey(e){var t=er(e);return t?t.protocol+"//"+t.host+t.pathname:void 0}_prepareEndpoint(e,t,i){if("ui"===e)return i;var s=i,r=this.instance.config.rewriteRequestPath;if(r){var n,o=(null==(n=er(i))?void 0:n.href)||i;s=r(new URL(o)).toString()}if(r&&"api"===e&&vo.some(e=>0===t.indexOf(e))){var a=this._urlKey(s);if(a){var l,d=this.apiHost,u=this._ingestionEndpoints;(null==(l=u)?void 0:l.apiHost)===d&&u.rewriteRequestPath===r||(this._ingestionEndpoints=u={apiHost:d,rewriteRequestPath:r,urls:new Set}),u.urls.add(a)}}return s}isIngestionEndpoint(e){var t=this._ingestionEndpoints,i=this._urlKey(e);return(null==t?void 0:t.apiHost)===this.apiHost&&t.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!i&&t.urls.has(i)}endpointFor(e,t){if(void 0===t&&(t=""),t&&(t="/"===t[0]?t:"/"+t),"ui"===e)return this._prepareEndpoint(e,t,this.uiHost+t);if("flags"===e)return this._prepareEndpoint(e,t,this.flagsApiHost+t);if("assets"===e){var i=this._staticAssetHostOverride(t);if(i)return this._prepareEndpoint(e,t,""+i+t)}if(this.region===ho)return this._prepareEndpoint(e,t,this.apiHost+t);var s=po+t;switch(e){case"assets":return this._prepareEndpoint(e,t,"https://"+this.region+"-assets."+s);case"api":return this._prepareEndpoint(e,t,"https://"+this.region+"."+s)}}},mo=es("[Surveys]"),yo={ignoreConditions:!1,ignoreDelay:!1,displayType:Ur.Popover},bo=es("[PostHog ExternalIntegrations]"),wo={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},So=class{constructor(e){this._instance=e}_loadScript(e,t){var i;null==(i=b(this._instance))||i(this._instance,e,e=>{if(e)return bo.error("failed to load script",e);t()})}startIfEnabledOrStop(){var e=this,t=function(){var t,s,r,n=i[0],o=i[1];!o||null!=(t=y.__PosthogExtensions__)&&null!=(t=t.integrations)&&t[n]||e._loadScript(wo[n],()=>{var t;null==(t=y.__PosthogExtensions__)||null==(t=t.integrations)||null==(t=t[n])||t.start(e._instance)}),!o&&null!=(s=y.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[n]&&(null==(r=y.__PosthogExtensions__)||null==(r=r.integrations)||null==(r=r[n])||r.stop())};for(var i of Object.entries(null!==(s=this._instance.config.integrations)&&void 0!==s?s:{})){var s;t()}}},Po=()=>{var e;return null!=l&&null!=(e=l.performance)&&e.now?l.performance.now():Date.now()},ko=[],Co=[50,75,100,150,200,300,400,500,750,1e3,1500,2e3,3e3,5e3,1e4],Io=[5,10,25,...Co],Eo=class{constructor(e){this._instance=e}initialize(){}get(e){var t=this._instance.persistence;if("string"==typeof e)return null==t?void 0:t.get_property(e);var i={};for(var s of e){var r=null==t?void 0:t.get_property(s);yt(r)||(i[s]=r)}return i}set(e,t){var i;null==(i=this._instance.persistence)||i.register("string"==typeof e?{[e]:t}:e)}remove(e){var t;null==(t=this._instance.persistence)||t.unregister(e)}},xo=class{constructor(e){this.instance=e,this._logger=Zi,this.kv=new Eo(e),this.onSession=e=>qr(this.instance.onSessionId(t=>{try{e(t)}catch(e){this._logger.error("Browser extension session listener failed",e)}})),this.onEvent=e=>qr(this.instance._addCaptureHook((t,i)=>{if(i)try{e({event:t,properties:i.properties})}catch(e){this._logger.error("Browser extension event listener failed",e)}})),this.onRemoteConfig=e=>{var t=t=>{try{e(t)}catch(e){this._logger.error("Browser extension remote config listener failed",e)}},i=this.instance._internalEventEmitter.on("extensionsRemoteConfig",t);return this.instance._lastRemoteConfig&&t(this.instance._lastRemoteConfig),qr(i)}}get logger(){return this._logger}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return null!==(e=this.instance.get_property("$device_id"))&&void 0!==e?e:this.distinctId}get deviceId(){var e=this.instance.get_property(j);return"string"==typeof e?e:void 0}get library(){return{name:a.LIB_NAME,version:a.LIB_VERSION}}get initialPersonProperties(){var e,t;return null!==(e=null==(t=this.instance.persistence)?void 0:t.get_initial_props())&&void 0!==e?e:{}}get groups(){return this.instance.getGroups()}get session(){try{var e,t,i,s,r,n=null==(e=this.instance.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(t=null==n?void 0:n.sessionId)&&void 0!==t?t:"",windowId:null!==(i=null==n?void 0:n.windowId)&&void 0!==i?i:"",sessionStartTimestamp:null!==(s=null==n?void 0:n.sessionStartTimestamp)&&void 0!==s?s:0,lastActivityTimestamp:null!==(r=null==n?void 0:n.lastActivityTimestamp)&&void 0!==r?r:0}}catch(e){return{sessionId:"",windowId:"",sessionStartTimestamp:0,lastActivityTimestamp:0}}}get isOptedOut(){return this.instance.has_opted_out_capturing()}get canCapture(){return vt(this.instance.is_capturing)?this.instance.is_capturing():!this.isOptedOut}get isRateLimited(){var e;return!(null==(e=this.instance.rateLimiter)||!e.isClientRateLimited)}get projectToken(){return this.instance.config.token}getExtension(e){var t;switch(e){case"featureFlags":case"featureFlagsCommon":t=this.instance.featureFlags;break;case"logs":t=this.instance.logs;break;case"surveys":t=this.instance.surveys;break;case"autocapture":t=this.instance.autocapture}return t}capture(e,t,s){if(!s)return this._notRateLimited(this.instance.capture(e,t));var r=i({timestamp:s.timestamp,uuid:s.uuid,$set:s.set,$set_once:s.setOnce},"unload"===s.delivery?{transport:"sendBeacon",send_instantly:!0}:{});return this._notRateLimited(this.instance.capture(e,t,r))}_notRateLimited(e){var t;return!yt(e)||!(null!=(t=this.instance.rateLimiter)&&t.lastEventRateLimited)}registerDynamicEventProperties(e){return qr(this.instance._registerExtensionEventProperties(e))}sendRequest(e,t){var i=this;return r(function*(){var s;void 0===t&&(t={});var r=null!==(s=t.target)&&void 0!==s?s:"api",n=t.query?Dn(e,t.query):e,o=i.instance.requestRouter.endpointFor(r,n),a={method:t.method,url:o,data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,compressionFallback:"flags"===t.target&&"best-available"===t.compression?at.Base64:void 0,timestampMode:t.sentAt};return"api"===r&&"/i/v1/logs"===e&&(a.batchKey="logs"),"sendBeacon"===t.transport?(i.instance._send_request(a),{statusCode:202}):new Promise(e=>{var t,s,n;a.callback=e,"flags"===r&&null!=(t=i.instance.config.metrics)&&t.flags&&(a.onDispatch=()=>{s=Po()},a.onSend=e=>{n=(e=>{try{return(e=>{var t,i=null==l?void 0:l.PerformanceObserver,s=null==(t=er(e))?void 0:t.href;if(i&&s){var r,n,o,a=Po(),d={name:s,before:1/0,inFlight:!0},u=1/0,_=!1,c=()=>{_||(_=!0,clearTimeout(o),g.disconnect(),ko.splice(ko.indexOf(d),1))},h=!1,p=e=>{for(var t of e){var i=t.startTime;t.name!==s||(h?a>=i:a>i)||i>=d.before||r&&i>=r.startTime||(r=t)}if(r&&n&&u>=r.startTime){var o=n;c(),o(r)}},g=new i(e=>p(e.getEntriesByName(s,"resource")));for(var v of(g.observe({entryTypes:["resource"]}),ko))v.name===s&&(v.before=Math.min(v.before,a),h=h||v.inFlight);return ko.push(d),{take(e,t){_||(u=e,d.inFlight=!1,n=t,o=setTimeout(c,5e3),vt(g.takeRecords)&&p(g.takeRecords()))},stop:c}}})(e)}catch(e){return}})(e)},a.callback=t=>{var r;if(e(t),!yt(s)){var a=s,l=Po();try{var d=((e,t)=>{var i,s,r=t.statusCode||void 0,n={"server.address":(null!==(i=null==(s=er(e))?void 0:s.hostname)&&void 0!==i?i:e).replace(/^\[(.*)\]$/,"$1")};r&&(n["http.response.status_code"]=r);var o=((e,t)=>e?400>e?void 0:String(e):"AbortError"===(null==t?void 0:t.name)?"timeout":"_OTHER")(r,t.error);o&&(n["error.type"]=o);var a=Zs();return a&&(n["client.timezone"]=a),n})(o,t);if(i._recordFlagsHistogram("posthog.flags.request.duration",l-a,Co,d),t.statusCode&&n)return void n.take(l,e=>i._recordFlagsSplit(e,a,l,d))}catch(e){Zi.error("Failed to record the /flags request timing",e)}null==(r=n)||r.stop()}}),i.instance._send_request(a)})})()}_recordFlagsSplit(e,t,i,s){if(e.responseEnd>=e.startTime)try{var r=Math.min(e.responseEnd,i);this._recordFlagsHistogram("posthog.flags.request.pre_send_duration",e.startTime-t,Io,s),this._recordFlagsHistogram("posthog.flags.request.network_duration",r-e.startTime,Co,s),this._recordFlagsHistogram("posthog.flags.request.main_thread_duration",i-r,Io,s)}catch(e){Zi.error("Failed to record the /flags request timing split",e)}}_recordFlagsHistogram(e,t,s,r){var n;null==(n=this.instance.metrics)||n.histogram(e,t,{unit:"ms",attributes:i({},r),bounds:s})}},To={},$o=0,Fo=()=>{},Ro='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Oo="Surveys module not available",Mo="sanitize_properties is deprecated. Use before_send instead",Ao="Invalid value for property_denylist config: ",Do=["$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"],Lo=["$feature_flag_called","$$heatmap","$snapshot"],No=e=>"$"===e.charAt(0)&&!ut(Lo,e),Bo=/^[A-Za-z0-9_-]{1,400}$/,Uo=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,qo=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,Ho=["token","distinct_id",Ue],Go="posthog",Wo=[...ao].sort()[ao.length-1],Vo=e=>{var t={};return e&&"unset"!==e?("2025-11-30">e||(t.strictMinimumDuration=!0),"2026-05-30">e||(t.canvasCapture={resolutionScale:.6}),"2026-06-25">e||(t.streamNetworkBody=!0),"2026-08-30">e||(t.captureJsonLd=!0),t):t},jo=e=>{var t;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:ls(null==_?void 0:_.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Fo,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,__preview_replay_sync_fetch:!0,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:c&&bt(null==c?void 0:c.search)&&-1!==c.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==l||null==(t=l.location)?void 0:t.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(e){Zi.error("Bad HTTP status: "+e.statusCode+" "+e.text)},get_device_id:e=>e,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:tt,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:Fo},(e=>({rageclick:e&&e>="2026-05-30"?{content_ignorelist:qs,ignore_text_selection:!0}:!e||"2025-11-30">e||{content_ignorelist:!0},capture_pageview:!e||"2025-05-24">e||"history_change",session_recording:Vo(e),external_scripts_inject_target:e&&e>="2026-01-30"?"head":"body",internal_or_test_user_hostname:e&&e>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:e&&e>="2026-05-30"?250:0,split_storage:!(!e||"2026-05-30">e),detect_google_search_app:!(!e||"2026-05-30">e),disable_capture_url_hashes:!(!e||"2026-06-25">e),cookieWinsOnConflict:!(!e||"unset"===e||"2026-08-29">e)}))(e))},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"]],Ko=e=>{var t={};for(var i of zo){var s=i[0],r=i[1];yt(e[s])||(t[r]=e[s])}var n=ss({},t,e),o=e.__preview_external_dependency_versioned_paths;return yt(o)||(yt(e.strict_script_versioning)&&(n.strict_script_versioning=!!o),bt(o)&&yt(e.asset_host)&&(n.asset_host=o)),gt(e.property_blacklist)&&(yt(e.property_denylist)?n.property_denylist=e.property_blacklist:gt(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:Zi.error(Ao+e.property_denylist)),n},Jo=class{constructor(){this.__forceAllowLocalhost=!1}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){Zi.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},Yo=(e=class e{_removeExtension(e){if(e){var t=this._extensions.indexOf(e);-1!==t&&this._extensions.splice(t,1)}}_replaceExtension(e,t){return this._removeExtension(e),this._extensions.push(t),null==t.initialize||t.initialize(),t}_inCookielessMode(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}_warnIfHistoryAutocaptureMissing(){if(!this._hasWarnedAboutMissingHistoryAutocapture&&this._originalUserConfig&&"capture_pageview"in this._originalUserConfig&&!i({},e.__defaultExtensionClasses,this.config.__extensionClasses).historyAutocapture){var t=this.config.capture_pageview;("history_change"===t||ft(t)&&(t.path||t.search||t.hash&&!this.config.disable_capture_url_hashes))&&(this._hasWarnedAboutMissingHistoryAutocapture=!0,Zi.warn("capture_pageview is set to capture history changes, but the history autocapture extension is not loaded, so only the first pageview of each page load is captured. With the slim bundle, pass __extensionClasses: { historyAutocapture: AnalyticsExtensions.historyAutocapture } from 'posthog-js/dist/extension-bundles', or set capture_pageview: true to capture page loads only."))}}_warnIfVolatileIdentityWithoutStableId(){if(!(this._hasWarnedAboutVolatileIdentity||this.config.reuseAnonymousId||this.config.segment||this._inCookielessMode())){var e,t,i,s="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;(s||this.config.disable_persistence)&&(this._hasStableInitialDistinctId||(s?(e="persistence is set to '"+this.config.persistence+"'",t="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."):(e="persistence is disabled (disable_persistence is true)",t="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._hasWarnedAboutVolatileIdentity=!0,console.warn("[PostHog.js]",e+" but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID "+t+", 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)))}}_syncCookielessIdentity(){var e=this.persistence;if(e&&!this._isConsentTransition)if(this._inCookielessMode())"on_reject"===this.config.cookieless_mode&&"$posthog_cookieless"!==this.get_distinct_id()&&(this._sync_opt_out_with_persistence(),this._enterCookielessMode());else if("$posthog_cookieless"===this.get_distinct_id()){this._is_persistence_disabled()||e.load(!0);var t=this.get_distinct_id();if(!t||"$posthog_cookieless"===t){var i=this.config.get_device_id(fs());this.register({distinct_id:i,$device_id:i}),e.set_property(Re,Ze)}this._sync_opt_out_with_persistence()}}get decideEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}get flagsEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}constructor(){var t;this._botFilterWarned=!1,this._isPageUnloading=!1,this._isShutdown=!1,this.webPerformance=new Jo,this._personProcessingSetOncePropertiesSent=!1,this.version=a.LIB_VERSION,this.__loadExternalDependency=void 0,this._sessionRegisteredPropKeys=new Set,this._sessionRegisteredPropertiesStorageKey="",this._internalEventEmitter=new so,this._extensions=[],this._extensionEventPropertyProducers=[],this._replayDebugPropertiesPaused=!1,this._hasStableInitialDistinctId=!1,this._hasWarnedAboutVolatileIdentity=!1,this._hasWarnedAboutMissingHistoryAutocapture=!1,this._isConsentTransition=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=jo(),this.SentryIntegration=zs,this.sentryIntegration=e=>function(e,t){var i=js(e,t);return{name:Vs,processEvent:e=>i(e)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this._visibilityStateListener=null,this._initialPersonProfilesConfig=null,this._cachedPersonProperties=null,this.scrollManager=new eo(this),this.pageViewManager=new Ks(this),this.rateLimiter=new jr(this),this.requestRouter=new fo(this),this.consent=new Bs(this),this.externalIntegrations=new So(this);var i=null!==(t=e.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.metrics=i.metrics&&new i.metrics(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(e,t,i)=>{var s=bt(e)?{[e]:t}:e;this.setPersonProperties(s),null==i||i({})},set_once:(e,t,i)=>{var s=bt(e)?{[e]:t}:e;this.setPersonProperties(void 0,s),null==i||i({})}},this.on("eventCaptured",e=>Zi.info('send "'+(null==e?void 0:e.event)+'"',e))}init(t,i,s){if(s&&s!==Go){var r,n=null!==(r=To[s])&&void 0!==r?r:new e;return n._init(t,i,s),To[s]=n,To[Go][s]=n,n}return this._init(t,i,s)}_init(e,t,s){var r,n,o;void 0===t&&(t={});var d,u=bt(e)?e.trim():"";if(!u)return Zi.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 u!==(null==(d=this.config)?void 0:d.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('"+u+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=jo(t.defaults),t.debug=this._checkLocalStorageForDebug(t.debug),this._originalUserConfig=t,this._triggered_notifs=[],t.person_profiles?this._initialPersonProfilesConfig=t.person_profiles:t.process_person&&(this._initialPersonProfilesConfig=t.process_person);var _=jo(t.defaults),c=Ko(t),h=ss({},_,c,{name:s,token:u});ft(_.rageclick)&&ft(c.rageclick)&&(h.rageclick=ss({},_.rageclick,c.rageclick)),ft(_.session_recording)&&ft(c.session_recording)&&(h.session_recording=ss({},_.session_recording,c.session_recording)),this.set_config(h),this.config.on_xhr_error&&Zi.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:Tr.GZipJS;var p=this._is_persistence_disabled(),g=!this._inCookielessMode();if(this.persistence=new xr(this.config,p,!0,g),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new xr(i({},this.config,{persistence:"sessionStorage"}),p,!1,g),this._sessionRegisteredPropertiesStorageKey="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!p&&Ns._is_supported()){var v=Ns._parse(this._sessionRegisteredPropertiesStorageKey);gt(v)&&v.forEach(e=>{bt(e)&&this._sessionRegisteredPropKeys.add(e)})}else Ns._remove(this._sessionRegisteredPropertiesStorageKey);var f=i({},this.persistence.props),m=i({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this._requestQueue=new Xn((e,t)=>this._send_retriable_request(e,t),this.config.request_queue_config),this._retryQueue=new Zn(this),this.__request_queue=[];var y=this._inCookielessMode();y||(this.sessionManager=new oo(this),this.sessionPropsManager=new io(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((e,t,i)=>{(null!=i&&i.activityTimeout||null!=i&&i.sessionPastMaximumLength||null!=i&&i.crossTabAdoption)&&this._clearSessionRegisteredProps()})),this._enrollFeatureFlags(),this.config.__preview_deferred_init_extensions?(Zi.info("Deferring extension initialization to improve startup performance"),this._extensionInitTimeout=setTimeout(()=>{this._extensionInitTimeout=void 0,this._initExtensions(y)},0)):(Zi.info("Initializing extensions synchronously"),this._initExtensions(y)),a.DEBUG=a.DEBUG||this.config.debug,a.DEBUG&&Zi.info("Starting in debug mode",{this:this,config:t,thisC:i({},this.config),p:f,s:m}),!this.config.identity_distinct_id||null!=(r=t.bootstrap)&&r.distinctID||(t.bootstrap=i({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));var b=null==(n=t.bootstrap)?void 0:n.distinctID;if(this._hasStableInitialDistinctId=!!b&&!wt(b),null!=(o=t.bootstrap)&&o.distinctID){var w=t.bootstrap.distinctID,S=this.get_distinct_id(),P=this.persistence.get_property(Re);if(t.bootstrap.isIdentifiedID&&null!=S&&S!==w&&"anonymous"===P)this.identify(w);else if(t.bootstrap.isIdentifiedID&&null!=S&&S!==w&&"identified"===P)Zi.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 k=this.config.get_device_id(fs()),C=t.bootstrap.isIdentifiedID?k:w;this.persistence.set_property(Re,t.bootstrap.isIdentifiedID?et:Ze),this.register({distinct_id:w,$device_id:C})}}if(y)this.register_once({distinct_id:Be,$device_id:null},"");else if(!this.get_distinct_id()){var I=this.config.get_device_id(fs());this.register_once({distinct_id:I,$device_id:I},""),this.persistence.set_property(Re,Ze)}return ds(l,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),ds(l,"pageshow",e=>{if(this._isPageUnloading=!1,!this._isShutdown){var t;if(e.persisted&&this.persistence){var i=this.persistence.get_property(V),s=this.persistence.get_property(Re);this.persistence.load(),this._processCookieIdentityChange()||i===this.persistence.get_property("distinct_id")&&s===this.persistence.get_property("$user_state")||this._processIdentityChange()}null==(t=this._retryQueue)||t.resume()}}),t.segment?Ws(this,()=>this._loaded()):this._loaded(),vt(this.config._onCapture)&&this.config._onCapture!==Fo&&(Zi.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",e=>this.config._onCapture(e.event,e))),this.config.ip&&Zi.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(e=>{e&&this.register({[z]:e})}).catch(Fo),this}_isSharedExtension(e){var t=e;return bt(t.name)&&vt(t.setup)}_enrollExtension(e,t){var i=this;this._isSharedExtension(e)?t.push(r(function*(){try{yield e.setup(i._getBrowserClientAdapter())}catch(t){Zi.error('Failed to set up extension "'+e.name+'"',t);try{yield null==e.dispose?void 0:e.dispose()}catch(t){Zi.error('Failed to dispose extension "'+e.name+'"',t)}}})):this._extensions.push(e)}_enrollFeatureFlags(){var t,i,s,n,o,a,l=this,d=null!==(t=null==(i=this.config.__extensionClasses)?void 0:i.featureFlags)&&void 0!==t?t:null==(s=e.__defaultExtensionClasses)?void 0:s.featureFlags;if(d)if(this.featureFlags&&this.featureFlags instanceof d||(null==(a=this._featureFlagsReloadingUnsubscribe)||a.call(this),this._featureFlagsReloadingUnsubscribe=void 0,this.featureFlags=new d(this)),vt(this.featureFlags.onReloading)&&vt(this.featureFlags.setup)){if(!this._featureFlagsReloadingUnsubscribe){this._featureFlagsReloadingUnsubscribe=this.featureFlags.onReloading(()=>{this._internalEventEmitter.emit("featureFlagsReloading",!0)});var u=this.featureFlags;r(function*(){try{yield u.setup(l._getBrowserClientAdapter())}catch(t){Zi.error("Failed to set up feature flags",t);var e=l._featureFlagsReloadingUnsubscribe;l._featureFlagsReloadingUnsubscribe=void 0;try{null==e||e()}catch(e){Zi.error("Failed to unsubscribe feature flag reloading",e)}try{yield u.dispose()}catch(e){Zi.error("Failed to dispose feature flags",e)}}})()}}else null==(n=(o=this.featureFlags).initialize)||n.call(o)}_initExtensions(t){var s,r,n,o,a,l,d,u,_=performance.now(),c=i({},e.__defaultExtensionClasses,this.config.__extensionClasses),h=[];c.exceptions&&this._extensions.push(this.exceptions=null!==(s=this.exceptions)&&void 0!==s?s:new c.exceptions(this)),c.historyAutocapture&&this._extensions.push(this.historyAutocapture=new c.historyAutocapture(this)),this._warnIfHistoryAutocaptureMissing(),c.tracingHeaders&&this._extensions.push(this.tracingHeaders=new c.tracingHeaders(this)),c.siteApps&&this._extensions.push(this.siteApps=new c.siteApps(this)),c.sessionRecording&&!t&&this._extensions.push(this.sessionRecording=new c.sessionRecording(this)),c.autocapture&&this._enrollExtension(this.autocapture=new c.autocapture(this),h),c.surveys&&this._enrollExtension(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new c.surveys(this),h),c.logs&&this._enrollExtension(this.logs=null!==(n=this.logs)&&void 0!==n?n:new c.logs(this),h),c.metrics&&this._extensions.push(this.metrics=null!==(o=this.metrics)&&void 0!==o?o:new c.metrics(this)),c.conversations&&this._extensions.push(this.conversations=null!==(a=this.conversations)&&void 0!==a?a:new c.conversations(this)),c.productTours&&this._extensions.push(this.productTours=new c.productTours(this)),c.heatmaps&&this._extensions.push(this.heatmaps=new c.heatmaps(this)),c.webVitalsAutocapture&&this._extensions.push(this.webVitalsAutocapture=new c.webVitalsAutocapture(this)),c.exceptionObserver&&this._extensions.push(this.exceptionObserver=new c.exceptionObserver(this)),c.deadClicksAutocapture&&this._extensions.push(this.deadClicksAutocapture=new c.deadClicksAutocapture(this,Hs)),c.toolbar&&this._extensions.push(this.toolbar=null!==(l=this.toolbar)&&void 0!==l?l:new c.toolbar(this)),c.experiments&&this._extensions.push(this.experiments=null!==(d=this.experiments)&&void 0!==d?d:new c.experiments(this)),c.webMCP&&this._extensions.push(this.webMCP=null!==(u=this.webMCP)&&void 0!==u?u:new c.webMCP(this));var p=this._extensions.length>0||h.length>0;this.config.disable_scroll_properties||h.unshift(()=>{this.scrollManager.startMeasuringScrollPosition()}),this._extensions.forEach(e=>{e.initialize&&h.push(()=>{null==e.initialize||e.initialize()})}),h.push(()=>{if(this._pendingRemoteConfig){var e=this._pendingRemoteConfig;this._pendingRemoteConfig=void 0,this._extensions.forEach(t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e))}}),this._processInitTaskQueue(h,_,p)}_processInitTaskQueue(e,t,i){for(var s,r;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void(this._extensionInitTimeout=setTimeout(()=>{this._extensionInitTimeout=void 0,this._processInitTaskQueue(e,t,i)},0));var n=e.shift();if(n)try{n()}catch(e){Zi.error("Error initializing extension:",e)}}var o=Math.round(performance.now()-t);i&&o>0?this.register_for_session({[qe]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[He]:o}):yt(null==(s=this.sessionPersistence)?void 0:s.props.$sdk_debug_extensions_init_method)&&yt(null==(r=this.sessionPersistence)?void 0:r.props.$sdk_debug_extensions_init_time_ms)||(this.unregister_for_session(qe),this.unregister_for_session(He)),this.config.__preview_deferred_init_extensions&&Zi.info("PostHog extensions initialized ("+o+"ms)")}_onRemoteConfig(e){if(!_||!_.body)return Zi.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this._onRemoteConfig(e)},500);if(this.config.__preview_deferred_init_extensions&&(this._pendingRemoteConfig=e),this._lastRemoteConfig=e,this.compression=void 0,e.ok){var t,i=e.config;i.supportedCompression&&!this.config.disable_compression&&(this.compression=ut(i.supportedCompression,Tr.GZipJS)?Tr.GZipJS:ut(i.supportedCompression,Tr.Base64)?Tr.Base64:void 0),null!=(t=i.analytics)&&t.endpoint&&(this.analyticsDefaultEndpoint=i.analytics.endpoint)}this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:tt}),this._internalEventEmitter.emit("extensionsRemoteConfig",e),this._extensions.forEach(t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e))}_loaded(){try{this.config.loaded(this)}catch(e){Zi.critical("`loaded` function failed",e)}if(this._start_queue_if_opted_in(),this.config.internal_or_test_user_hostname&&null!=c&&c.hostname){var e=c.hostname,t=this.config.internal_or_test_user_hostname;("string"==typeof t?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this._inCookielessMode())&&this._captureInitialPageview()},1),this._remoteConfigLoader=new Kr(this),this._remoteConfigLoader.load()}_start_queue_if_opted_in(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this._requestQueue)||e.enable())}_dom_loaded(){this.is_capturing()&&ts(this.__request_queue,e=>this._send_retriable_request(e)),this.__request_queue=[],this._start_queue_if_opted_in()}_handle_unload(){var e,t,i,s,r;this._isPageUnloading=!0,null==(e=this.surveys)||null==e.handlePageUnload||e.handlePageUnload(),null==(t=this.metrics)||t.flush("sendBeacon"),this.config.request_batching?(this._shouldCapturePageleave()&&this.capture(rt),null==(i=this.logs)||i.flushLogs("sendBeacon"),null==(s=this._requestQueue)||s.unload(),null==(r=this._retryQueue)||r.unload()):this._shouldCapturePageleave()&&this.capture(rt,null,{transport:"sendBeacon"})}_send_request(e){Qn(this,e)}_send_retriable_request(e,t){this._retryQueue?this._retryQueue.retriableRequest(e,t):this._send_request(t?i({},e,{transport:t}):e)}_execute_array(e){$o++;try{var t,i=[],s=[],r=[];ts(e,e=>{if(e)if(gt(t=e[0]))r.push(e);else if(vt(e))try{e.call(this)}catch(t){Zi.error("Error executing queued PostHog call",e,t)}else gt(e)&&"alias"===t?i.push(e):gt(e)&&-1!==t.indexOf("capture")&&vt(this[t])?r.push(e):s.push(e)});var n=function(e,t){ts(e,function(e){try{if(gt(e[0])){var i=t;is(e,function(e){i=i[e[0]].apply(i,e.slice(1))})}else t[e[0]].apply(t,e.slice(1))}catch(t){Zi.error("Error executing queued PostHog call",e,t)}})};n(i,this),n(s,this),n(r,this)}finally{$o--}}push(t){if($o>0&>(t)&&bt(t[0])){var i=e.prototype[t[0]];vt(i)&&i.apply(this,t.slice(1))}else this._execute_array([t])}get _facebookClickIdChannel(){return{property:Y,persistenceKey:Q,cookieName:"_fbc",pattern:Uo,register:(e,t)=>{var i;return null==(i=this.persistence)?void 0:i.register({[Q]:{value:e,delivered:t}})},unregister:()=>{var e;return null==(e=this.persistence)?void 0:e.unregister(Q)}}}get _facebookBrowserIdChannel(){return{property:X,persistenceKey:Z,cookieName:"_fbp",pattern:qo,register:(e,t)=>{var i;return null==(i=this.persistence)?void 0:i.register({[Z]:{value:e,delivered:t}})},unregister:()=>{var e;return null==(e=this.persistence)?void 0:e.unregister(Z)}}}_getPersistedMetaIdentifier(e){var t,i=null==(t=this.persistence)?void 0:t.get_property(e.persistenceKey);return bt(i)&&e.pattern.test(i)?{value:i,delivered:!1}:ft(i)&&bt(i.value)&&e.pattern.test(i.value)?{value:i.value,delivered:!0===i.delivered}:void 0}_storeMetaIdentifier(e,t,i){return t===(null==i?void 0:i.value)?{value:t,pending:!i.delivered}:(e.register(t,!1),{value:t,pending:!0})}_readMetaCookie(e){if(this.config.save_campaign_params&&!this._inCookielessMode()){var t=cs(e.cookieName);return bt(t)&&e.pattern.test(t)?t:void 0}}_updateFacebookClickId(e,t,i,s){if(this.persistence){var r=this._facebookClickIdChannel,n=this._getPersistedMetaIdentifier(r);if(!s){if(i)return bt(t)&&Uo.test(t)?this._storeMetaIdentifier(r,t,n):void r.unregister();var o=bt(e)&&Bo.test(e)?e:void 0,a=this._readMetaCookie(r);return a&&((e,t,i)=>{var s=e.split(".");if(t)return s[3]===t;if(!i)return!0;var r=i.value.split(".");return s[3]===r[3]||Number(s[2])>Number(r[2])})(a,o,n)?this._storeMetaIdentifier(r,a,n):o?(null==n?void 0:n.value.split(".")[3])===o?{value:n.value,pending:!n.delivered}:this._storeMetaIdentifier(r,"fb.1."+Date.now()+"."+o,n):n?{value:n.value,pending:!n.delivered}:void 0}r.unregister()}}_updateFacebookBrowserId(e,t,i){if(this.persistence){var s=this._facebookBrowserIdChannel,r=this._getPersistedMetaIdentifier(s);if(!i){if(t)return bt(e)&&qo.test(e)?this._storeMetaIdentifier(s,e,r):void s.unregister();var n=this._readMetaCookie(s);return n?this._storeMetaIdentifier(s,n,r):r?{value:r.value,pending:!r.delivered}:void 0}s.unregister()}}_markMetaIdentifiersDelivered(e){if(this.persistence){var t=e=>{var t=e.value,i=this._getPersistedMetaIdentifier(e.channel);return(null==i?void 0:i.value)===t&&!i.delivered},i=e.filter(t);i.length&&(this.persistence.refreshMetaIdentifiers(),i.filter(t).forEach(e=>e.channel.register(e.value,!0)))}}capture(e,t,s){var r,n,o,a,l,d,u,_;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue)if(this.is_capturing())if(!yt(e)&&bt(e)){if(this._syncCookielessIdentity(),"$snapshot"!==e||!this._inCookielessMode()){var c=!this.config.opt_out_useragent_filter&&this._is_bot();if(c&&!this.config.__preview_capture_bot_pageviews)return this._botFilterWarned||(this._botFilterWarned=!0,console.warn("[PostHog.js] Events are being dropped because the user agent looks like a bot. Set `opt_out_useragent_filter: true` to capture them, e.g. in end-to-end tests. Note that logs from `captureLog` are not subject to this filter.")),void Zi.info('Event "'+e+'" was not captured because the user agent looks like a bot. Set `opt_out_useragent_filter: true` to capture it.');var h=null!=s&&s.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==h||!h.isRateLimited){var p;null!=t&&t.$current_url&&!bt(null==t?void 0:t.$current_url)&&(Zi.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==t||delete t.$current_url),"$exception"!==e||null!=s&&s._originatedFromCaptureException||Zi.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&&(p=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 g=new Date,v=(null==s?void 0:s.timestamp)||g,f=Ni(null==s?void 0:s.uuid,fs),m={uuid:f,event:e,properties:this.calculateEventProperties(e,t||{},v,f)};"$pageview"===e&&this.config.__preview_capture_bot_pageviews&&c&&(m.event="$bot_pageview",m.properties.$browser_type="bot"),h&&(m.properties.$lib_rate_limit_remaining_tokens=h.remainingTokens);var y="$feature_flag_called"===e&&!1===m.properties.$feature_flag_has_experiment&&!0===this.get_property("$minimal_flag_called_events");null!=s&&s.$set&&!y&&(m.$set=null==s?void 0:s.$set);var b=ft(null==t?void 0:t.$set)?t.$set:void 0,w=gt(null==t?void 0:t.$unset)?t.$unset:[],S=(null==s?void 0:s.$unset)||[],P=e=>{var t,i=!(null==s||!s.$set)&&e in s.$set;return{hasProvided:i||!!b&&e in b,provided:i?null==s||null==(t=s.$set)?void 0:t[e]:null==b?void 0:b[e],unset:-1!==w.indexOf(e)||-1!==S.indexOf(e)}};this.persistence.refreshMetaIdentifiersBeforeCapture();var k=P(Y),C=P(X),I=[{channel:this._facebookClickIdChannel,hasProvided:k.hasProvided,update:this._updateFacebookClickId(null==(r=p)?void 0:r.fbclid,k.provided,k.hasProvided,k.unset)},{channel:this._facebookBrowserIdChannel,hasProvided:C.hasProvided,update:this._updateFacebookBrowserId(C.provided,C.hasProvided,C.unset)}];for(var E of I){var x=E.channel,T=E.update;T&&!0===m.properties.$process_person_profile&&T.pending&&!E.hasProvided&&!y&&(m.$set=i({[x.property]:T.value},m.$set))}var F=null==s?void 0:s.$unset;F&&(m.$unset=F);var R=y?void 0:this._calculate_set_once_properties(null==s?void 0:s.$set_once,e!==ot,e===nt);if(R&&(m.$set_once=R),null!=s&&s._noTruncate||(l=this.config.properties_string_max_length,d=m,u=e=>bt(e)?e.slice(0,l):e,_=new Set,m=function e(t,i){if(t!==Object(t))return u?u(t):t;if(!_.has(t)){var s;if(_.add(t),gt(t))s=[],ts(t,t=>{s.push(e(t))});else{var r={};is(Tt(t)?os(t):t,(t,i)=>{_.has(t)||(r[i]=e(t,i))}),s=r}return s}}(d)),m.timestamp=v,yt(null==s?void 0:s.timestamp)||(m.properties.$event_time_override_provided=!0,m.properties.$event_time_override_system_time=g),y&&(m.properties=function(e,t){void 0===t&&(t=[]);var i={},s=t=>{void 0!==e[t]&&(i[t]=e[t])};return Hi.forEach(s),t.forEach(s),i}(m.properties,Ho)),e===Nr.DISMISSED||e===Nr.SENT){var O=null==t?void 0:t[Br.SURVEY_ID],M=null==t?void 0:t[Br.SURVEY_ITERATION];(e=>{try{var t=(e=>((e,t)=>"seenSurvey_"+function(e){return e.current_iteration&&e.current_iteration>0?e.id+"_"+e.current_iteration:e.id}(t))(0,e))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(e){mo.error("Failed to persist survey seen state",e)}})({id:O,current_iteration:M}),m.$set=i({},m.$set,{[uo({id:O,current_iteration:M},e===Nr.SENT?"responded":"dismissed")]:!0})}else e===Nr.SHOWN&&(m.$set=i({},m.$set,{[Br.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(e===Gr.SHOWN){var A=null==t?void 0:t[Wr.TOUR_TYPE];A&&(m.$set=i({},m.$set,{[Wr.TOUR_LAST_SEEN_DATE+"/"+A]:(new Date).toISOString()}))}var D=i({},m.properties.$set,m.$set);if(mt(D)||this.setPersonPropertiesForFlags(D),!Pt(this.config.before_send)){var L=this._runBeforeSend(m);if(!L)return;(m=L).uuid=Ni(m.uuid,fs)}this.sessionRecording&&!this._replayDebugPropertiesPaused&&No(e)&&(this._replayDebugPropertiesPaused=!0,setTimeout(()=>this._replayDebugPropertiesPaused=!1,3e4));var N=[];I.forEach(e=>{var t,i,s,r=e.channel,n=e.update,o=null!==(t=null==(i=m.$set)?void 0:i[r.property])&&void 0!==t?t:ft(null==(s=m.properties)?void 0:s.$set)?m.properties.$set[r.property]:void 0;null!=n&&n.pending&&o===n.value&&N.push({channel:r,value:n.value})}),this._internalEventEmitter.emit("eventCaptured",m);var B,U,q=null!==(n=null==s?void 0:s._url)&&void 0!==n?n:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),H="recordings"===(null==s?void 0:s._batchKey)||/\/s\/(?:\?|$)/.test(q),G=i({method:"POST",url:q,data:m,compression:"best-available",preferSyncCompression:null==s?void 0:s.send_instantly,timestampMode:H?"body":"capture-body",batchKey:null==s?void 0:s._batchKey},H&&null!=(o=m.properties)&&o.$session_id?{batchGroup:m.properties.$session_id+(m.properties.$window_id?"-"+m.properties.$window_id:"")}:{},null!=s&&s.transport?{transport:s.transport}:{},N.length?{fireCallbackOnDrop:!0,callback:e=>{e.statusCode>=200&&300>e.statusCode&&this._markMetaIdentifiersDelivered(N)}}:{});return!this.config.request_batching||s&&(null==s||!s._batchKey)||null!=s&&s.send_instantly?(!G.transport&&!G.callback&&mt(null!==(B=this.config.request_headers)&&void 0!==B?B:{})&&this._isPageUnloading&&(U="sendBeacon"),this._send_retriable_request(G,U)):this._requestQueue.enqueue(G),null==(a=this.featureFlags)||a.sendFlagCallsPendingCapture(),m}Zi.critical("This capture call is ignored due to client rate limiting.")}}else Zi.error("No event name provided to posthog.capture");else Zi.info('Event "'+e+'" was not captured because capturing is disabled (opted out or consent pending).');else Zi.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",t=>e(t.event,t))}getExtension(e){var t;return null==(t=this._browserClientAdapter)?void 0:t.getExtension(e)}_getBrowserClientAdapter(){var e;return null!==(e=this._browserClientAdapter)&&void 0!==e?e:this._browserClientAdapter=new xo(this)}_registerExtensionEventProperties(e){this._extensionEventPropertyProducers.push(e);var t=!0;return()=>{if(t){t=!1;var i=this._extensionEventPropertyProducers.indexOf(e);-1!==i&&this._extensionEventPropertyProducers.splice(i,1)}}}_processCookieIdentityChange(e){var t;return void 0===e&&(e=!0),!(null==(t=this.persistence)||!t.consumeCookieIdentityChange()||(this._processIdentityChange(e),0))}_processIdentityChange(e){var t,i,s;void 0===e&&(e=!0),this._cachedPersonProperties=null,"anonymous"===(null==(t=this.persistence)?void 0:t.get_property("$user_state"))&&(null==(s=this.sessionPersistence)||s.clear(),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys()),null==(i=this.featureFlags)||i.reset(),e&&this.reloadFeatureFlags()}calculateEventProperties(e,t,s,r,n){if(s=s||new Date,!this.persistence||!this.sessionPersistence)return t;this._syncCookielessIdentity(),this.persistence.syncCookieProperties(),this._processCookieIdentityChange();var a=n?void 0:this.persistence.remove_event_timer(e),d=i({},t);if(d.token=this.config.token,d.$config_defaults="latest"===this.config.defaults?Wo:this.config.defaults,this._inCookielessMode()&&(d[Ue]=!0),"$snapshot"===e){var u=i({},this.persistence.properties(),this.sessionPersistence.properties());return d.distinct_id=u.distinct_id,(!bt(d.distinct_id)&&!kt(d.distinct_id)||wt(d.distinct_id))&&Zi.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),d}var h,p,g=function(e,t,i,s){var r,n,a,d;if(void 0===s&&(s=!1),!f)return{};var u,_=e?[...rr,...t||[]]:[],h=function(e){for(var t=0;Oi.length>t;t++){var i=Oi[t],s=i[1],r=i[0].exec(e),n=r&&(vt(s)?s(r,e):s);if(n)return n}return["",""]}(f),p=h[0],g=h[1],v=function(e){for(var t=0;Di.length>t;t++){var i,s=Di[t],r=s[1],n=s[2],o=e.match(s[0]);if(o)return[r,(null==(i=n&&e.match(n)||o)?void 0:i[1])||""]}return["",""]}(f),m=v[0],y=v[1],b=null!=(u="u">typeof navigator?navigator:void 0)&&u.brave?{brave:!0}:{},w={};yt(i)||(w.detectGoogleSearchApp=i);var S={},P=null==(r=navigator)||null==(r=r.userAgentData)?void 0:r.platform,k=null==(n=navigator)?void 0:n.maxTouchPoints,C=null==l||null==(a=l.screen)?void 0:a.width,I=null==l||null==(d=l.screen)?void 0:d.height,E=null==l?void 0:l.devicePixelRatio;yt(P)||(S.userAgentDataPlatform=P),yt(k)||(S.maxTouchPoints=k),yt(C)||(S.screenWidth=C),yt(I)||(S.screenHeight=I),yt(E)||(S.devicePixelRatio=E);var x,T,F,R,O,M,A,D,L=ss(ns({$os:p,$os_version:g,$browser:$i(f,navigator.vendor,b,w),$webview_app:m,$webview_app_version:y,$device:Mi(f),$device_type:(T=f,F=S,D=Mi(T),D===qt||D===Ut||"Kobo"===D||"Kindle Fire"===D||D===di?Bt:D===ei||D===ii||D===ti||D===li?"Console":D===Ht?"Wearable":D?Lt:"Android"===(null==F?void 0:F.userAgentDataPlatform)&&(null!==(R=null==F?void 0:F.maxTouchPoints)&&void 0!==R?R:0)>0?600>Math.min(null!==(O=null==F?void 0:F.screenWidth)&&void 0!==O?O:0,null!==(M=null==F?void 0:F.screenHeight)&&void 0!==M?M:0)/(null!==(A=null==F?void 0:F.devicePixelRatio)&&void 0!==A?A:1)?Lt:Bt:"Desktop"),$timezone:Zs(),$timezone_offset:gr()}),{$current_url:sr(s?Ui(null==c?void 0:c.href):null==c?void 0:c.href,_,or),$host:null==c?void 0:c.host,$pathname:null==c?void 0:c.pathname,$raw_user_agent:f.length>1e3?f.substring(0,997)+"...":f,$browser_version:Ri(f,navigator.vendor,b,w),$browser_language:ur(),$browser_language_prefix:(x=ur(),"string"==typeof x?x.split("-")[0]:void 0),$screen_height:null==l?void 0:l.screen.height,$screen_width:null==l?void 0:l.screen.width,$viewport_height:null==l?void 0:l.innerHeight,$viewport_width:null==l?void 0:l.innerWidth,$lib:o.LIB_NAME,$lib_version:o.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return o.SDK_DIST_CHANNEL&&(L.$sdk_dist_channel=o.SDK_DIST_CHANNEL),L}(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 v=this.sessionManager.checkAndGetSessionAndWindowId(n,s.getTime(),!0),m=v.windowId;d.$session_id=v.sessionId,d.$window_id=m}this.sessionPropsManager&&ss(d,this.sessionPropsManager.getSessionProps());try{var y;if(this.sessionRecording){var b=this.sessionRecording.sdkDebugProperties,w=!this._replayDebugPropertiesPaused&&No(e);for(var S in b)(w||ut(Do,S))&&(d[S]=b[S])}h=null==(y=this._retryQueue)?void 0:y.length}catch(e){d.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===ho&&(d.$lib_custom_api_host=this.config.api_host),p="$pageview"!==e||n?"$pageleave"!==e||n?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(s):this.pageViewManager.doPageView(s,r),d=ss(d,p),"$pageview"===e&&_&&(d.title=_.title),!yt(a)){var P=s.getTime()-a;d.$duration=parseFloat((P/1e3).toFixed(3))}f&&this.config.opt_out_useragent_filter&&(d.$browser_type=this._is_bot()?"bot":"browser");var k=this.persistence.properties(),C=this.sessionPersistence.properties(),I=d.$groups,E=k.$groups;ft(I)&&!mt(I)&&(d.$groups=i({},ft(E)?E:{},I)),is(["$referrer","$referring_domain"],e=>{e in k&&delete C[e]});var x={};if(this._extensionEventPropertyProducers.length>0)for(var T of this._extensionEventPropertyProducers.slice())try{ss(x,T())}catch(e){Zi.error("Failed to produce browser extension event properties",e)}d=ss({},g,k,C,i({},x,d)),h?d.$sdk_debug_retry_queue_size=h:delete d.$sdk_debug_retry_queue_size,d.$is_identified=this._isIdentified(),gt(this.config.property_denylist)?is(this.config.property_denylist,function(e){delete d[e]}):Zi.error(Ao+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var F=this.config.sanitize_properties;F&&(Zi.error(Mo),d=F(d,e));var R=this._hasPersonProcessing();return d.$process_person_profile=R,R&&!n&&this._requirePersonProcessing("_calculate_event_properties"),d}_calculate_set_once_properties(e,t,i){var s;if(void 0===t&&(t=!0),void 0===i&&(i=!1),!this.persistence||!this._hasPersonProcessing())return e;if(this._personProcessingSetOncePropertiesSent&&!i)return e;var r=ss({},this.persistence.get_initial_props(),(null==(s=this.sessionPropsManager)?void 0:s.getSetOnceProps())||{},e||{}),n=this.config.sanitize_properties;return n&&(Zi.error(Mo),r=n(r,"$set_once")),t&&(this._personProcessingSetOncePropertiesSent=!0),mt(r)?void 0:r}register(e,t){var i;null==(i=this.persistence)||i.register(e,t)}register_once(e,t,i){var s;null==(s=this.persistence)||s.register_once(e,t,i)}register_for_session(e){var t,i;null==(t=this.persistence)||t.syncCookieProperties(),this._processCookieIdentityChange(),null==(i=this.sessionPersistence)||i.register(e),Object.keys(e).forEach(e=>this._sessionRegisteredPropKeys.add(e)),this._persistSessionRegisteredPropKeys()}unregister(e){var t;null==(t=this.persistence)||t.unregister(e)}unregister_for_session(e){var t;null==(t=this.sessionPersistence)||t.unregister(e),this._sessionRegisteredPropKeys.delete(e),this._persistSessionRegisteredPropKeys()}_register_single(e,t){this.register({[e]:t})}_clearSessionRegisteredProps(){this._sessionRegisteredPropKeys.forEach(e=>{var t;null==(t=this.sessionPersistence)||t.unregister(e)}),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys()}_persistSessionRegisteredPropKeys(){var e;if(this._sessionRegisteredPropertiesStorageKey)if("memory"===this.config.persistence||null!=(e=this.sessionPersistence)&&e._disabled||!Ns._is_supported())Ns._remove(this._sessionRegisteredPropertiesStorageKey);else{var t=[];this._sessionRegisteredPropKeys.forEach(e=>t.push(e)),t.length>0?Ns._set(this._sessionRegisteredPropertiesStorageKey,t):Ns._remove(this._sessionRegisteredPropertiesStorageKey)}}getFeatureFlag(e,t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return null==(t=this.featureFlags)?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagResult(e,t)}getAllFeatureFlags(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.getAllFeatureFlags())&&void 0!==e?e:[]}isFeatureEnabled(e,t){var i,s;return null!==(i=null==(s=this.featureFlags)?void 0:s.isFeatureEnabled(e,t))&&void 0!==i?i:null==t?void 0:t.defaultValue}reloadFeatureFlags(){var e;null==(e=this.featureFlags)||e.reloadFeatureFlags()}updateFlags(e,t,i){var s;null==(s=this.featureFlags)||s.updateFlags(e,t,i)}updateEarlyAccessFeatureEnrollment(e,t,i){var s;null==(s=this.featureFlags)||s.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t,i){var s;return void 0===t&&(t=!1),null==(s=this.featureFlags)?void 0:s.getEarlyAccessFeatures(e,t,i)}on(e,t){return this._internalEventEmitter.on(e,t)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:Oo}),()=>{})}onSessionId(e){var t,i;return null!==(t=null==(i=this.sessionManager)?void 0:i.onSessionId(e))&&void 0!==t?t:()=>{}}getSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:Oo})}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:Oo})}onActiveMatchingSurveysChanged(e){return this.surveys?this.surveys.onActiveMatchingSurveysChanged(e):(e([],{isLoaded:!1,error:Oo}),()=>{})}renderSurvey(e,t){var i;null==(i=this.surveys)||i.renderSurvey(e,t)}displaySurvey(e,t){var i;void 0===t&&(t=yo),null==(i=this.surveys)||i.displaySurvey(e,t)}cancelPendingSurvey(e){var t;null==(t=this.surveys)||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,i;return null!==(t=null==(i=this.surveys)?void 0:i.canRenderSurvey(e))&&void 0!==t?t:{visible:!1,disabledReason:Oo}}canRenderSurveyAsync(e,t){var i,s;return void 0===t&&(t=!1),null!==(i=null==(s=this.surveys)?void 0:s.canRenderSurveyAsync(e,t))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:Oo})}_validateIdentifyId(e){return!e||wt(e)?(Zi.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===e?(Zi.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(Zi.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(e,t,i){if(!this.__loaded||!this.persistence)return Zi.uninitializedWarning("posthog.identify");if(kt(e)&&(e=e.toString(),Zi.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this._validateIdentifyId(e)&&this._requirePersonProcessing("posthog.identify")){this._syncCookielessIdentity();var s=this.get_distinct_id(),r=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==s,n=this._processCookieIdentityChange(!1),o=this.persistence._beginCookieSyncSuppression(),a=!1;try{var l=this.get_distinct_id();this.register({$user_id:e}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:l},""),e!==l&&e!==this.get_property("__alias")&&(this.unregister(K),this.register({distinct_id:e}));var d=(this.persistence.get_property("$user_state")||"anonymous")===Ze,u=e!==l,_=!u&&d;if(u&&d){var c,h=this.config.reuseAnonymousId?{distinct_id:e}:{distinct_id:e,$anon_distinct_id:l};this.persistence.set_property(Re,et),this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence._publishSuppressedCookieSnapshot(),this.capture("$identify",h,{$set:t||{},$set_once:i||{}})&&(this._cachedPersonProperties=_o(e,t,i)),null==(c=this.featureFlags)||c.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:l)}else if(_){this.persistence.set_property(Re,et);var p=t||{},g=i||{};this.setPersonPropertiesForFlags({$set:p,$set_once:g},!1),this.config.cookieWinsOnConflict&&this.persistence._publishSuppressedCookieSnapshot(),this.capture("$set",{$set:p,$set_once:g})&&(this._cachedPersonProperties=_o(e,t,i))}else(t||i)&&this.setPersonProperties(t,i);u||r||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(R)):_&&(t||i)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence._endCookieSyncSuppression(a)}}}setPersonProperties(e,t){if((e||t)&&this._requirePersonProcessing("posthog.setPersonProperties")){var i=_o(this.get_distinct_id(),e,t);this._cachedPersonProperties!==i?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}})&&(this._cachedPersonProperties=i)):Zi.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(e){var t,i=(gt(e)?e:[e]).filter(e=>bt(e)&&e.length>0);0!==i.length&&this._requirePersonProcessing("posthog.unsetPersonProperties")&&(null==(t=this.featureFlags)||t.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this._cachedPersonProperties=null)}group(e,t,s){var r;if(e&&t){null==(r=this.persistence)||r.syncCookieProperties(),this._processCookieIdentityChange();var n=this.getGroups(),o=n[e]!==t;if(o&&this.resetGroupPropertiesForFlags(e),this.register({$groups:i({},n,{[e]:t})}),(o||s)&&this._hasPersonProcessing()){var a={$group_type:e,$group_key:t};s&&(a.$group_set=s),this.capture(ot,a)}s&&this.setGroupPropertiesForFlags({[e]:s}),o&&!s&&this.reloadFeatureFlags()}else Zi.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){var i;void 0===t&&(t=!0),null==(i=this.featureFlags)||i.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(e){var t;void 0===e&&(e=!0),null==(t=this.featureFlags)||t.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,t){var i;void 0===t&&(t=!0),this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;null==(t=this.featureFlags)||t.resetGroupPropertiesForFlags(e)}reset(e){var t=It(e)?e:null==e?void 0:e.resetDeviceID,i=It(e)||null==e?void 0:e.bootstrap;this._reset(t,!1,i)}_reset(e,t,s){var r,n,o,a,l;if(void 0===t&&(t=!1),Zi.info("reset"),!this.__loaded)return Zi.uninitializedWarning("posthog.reset");var d=null==s?void 0:s.sessionID;this.config.bootstrap=s||(null==(r=this._originalUserConfig)?void 0:r.bootstrap)||{},null==(n=this.featureFlags)||null==n.updateConfig||n.updateConfig(this.config,this._shouldDisableFlags());var u=this.get_property(j),_=this.get_property(z),c=this.get_property(ue);null==(o=this.sessionRecording)||o.flushBeforeIdentityReset();var h=this.is_capturing();t||this.consent.reset(),t||!h||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 p=null==(a=this.persistence)||null==a._beginCookieSyncSuppression?void 0:a._beginCookieSyncSuppression(),g=this._isConsentTransition;this._isConsentTransition=g||t;var v=!1;try{var f,m,y,b,w,S,P,k,C,I,E,x,T;if(null==(f=this.persistence)||f.clear(),null==(m=this.sessionPersistence)||m.clear(),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys(),yt(c)||null==(y=this.persistence)||y.register({[ue]:c}),null==(b=this.surveys)||b.reset(),null==(w=this.featureFlags)||w.reset(),null==(S=this.conversations)||S.reset(),null==(P=this.logs)||P.reset(),null==(k=this.metrics)||k.reset(),null==(C=this.persistence)||C.set_property(Re,Ze),null==(I=this.sessionManager)||I.resetSessionId(),this._cachedPersonProperties=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:Be,$device_id:null},"");else{var F=this.config.get_device_id(fs());this.register_once({distinct_id:F,$device_id:e?F:u},""),e||yt(_)||this.register({[z]:_})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),s)if(s.distinctID&&!this._inCookielessMode()&&(null==(T=this.persistence)||T.set_property(Re,s.isIdentifiedID?et:Ze),this.register({distinct_id:s.distinctID})),null==(E=this.featureFlags)||E.initialize(),!(Pt(d)||null!=(x=this.sessionManager)&&x.setBootstrapSessionId(d,!0))){var R=i({},s);delete R.sessionID,this.config.bootstrap=R}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,v=!0}finally{var O;this._isConsentTransition=g,p&&(null==(O=this.persistence)||null==O._endCookieSyncSuppression||O._endCookieSyncSuppression(v))}this._lastRemoteConfig&&(null==(l=this.conversations)||l.onRemoteConfig(this._lastRemoteConfig)),this.reloadFeatureFlags()}shutdown(e){var t=this;return r(function*(){if(t.__loaded){t._isShutdown=!0,clearTimeout(t._extensionInitTimeout),t._extensionInitTimeout=void 0;var e=t._featureFlagsReloadingUnsubscribe;for(var i of(t._featureFlagsReloadingUnsubscribe=void 0,[()=>{var e;return null==(e=t.sessionRecording)?void 0:e.dispose()},()=>{var e;return null==(e=t.logs)?void 0:e.flushLogs("sendBeacon")},()=>{var e;return null==(e=t.metrics)?void 0:e.flush("sendBeacon")},()=>{var e;return null==(e=t.metrics)?void 0:e.dispose()},()=>{var e;return null==(e=t.logs)?void 0:e.dispose()},()=>{var e;return null==(e=t.surveys)?void 0:e.dispose()},()=>{var e;return null==(e=t.autocapture)?void 0:e.dispose()},()=>null==e?void 0:e(),()=>{var e;return null==(e=t._requestQueue)?void 0:e.unload()},()=>{var e;return null==(e=t._retryQueue)?void 0:e.unload()},()=>{var e;return null==(e=t.featureFlags)?void 0:e.destroy()},()=>{var e;return null==(e=t.persistence)?void 0:e.destroy()},()=>{var e;return null==(e=t.sessionPersistence)?void 0:e.destroy()}]))try{var s=i();s&&vt(s.then)&&s.then(void 0,e=>{Zi.error("Error during shutdown",e)})}catch(e){Zi.error("Error during shutdown",e)}}else Zi.uninitializedWarning("posthog.shutdown")})()}setIdentity(e,t){var i;delete this.config.identity_claims,this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),null==(i=this.conversations)||i._onIdentityChanged()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,null==(e=this.conversations)||e._onIdentityCleared()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return null!==(e=null==(t=this.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==e?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var t=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=t.sessionStartTimestamp,s=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t.sessionId);if(null!=e&&e.withTimestamp&&i){var r,n=null!==(r=e.timestampLookBack)&&void 0!==r?r:10;if(!i)return s;s+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return s}alias(e,t){return e===this.get_property("$people_distinct_id")?(Zi.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(yt(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(K,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(Zi.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=i({},this.config);if(ft(e)){var s,r,n,o,l,d,u,_,c,h,p,g,v,f;ss(this.config,Ko(e));var m=this._is_persistence_disabled();if(this.persistence){var y,b,w,S="sessionStorage"===this.config.persistence||"memory"===this.config.persistence;S&&this.sessionPersistence!==this.persistence&&(null==(b=this.sessionPersistence)||b.remove(),null==(w=this.sessionPersistence)||w.destroy()),this.persistence.update_config(this.config,t,m),S?this.sessionPersistence=this.persistence:this.sessionPersistence===this.persistence?this.sessionPersistence=new xr(i({},this.config,{persistence:"sessionStorage"}),m,!1):null==(y=this.sessionPersistence)||y.update_config(i({},this.config,{persistence:"sessionStorage"}),i({},t,{persistence:"sessionStorage"}),m)}var P=this._checkLocalStorageForDebug(this.config.debug);It(P)&&(this.config.debug=P),It(this.config.debug)&&(this.config.debug?(a.DEBUG=!0,ks._is_supported()&&ks._set("ph_debug",!0),Zi.info("set_config",{config:e,oldConfig:t,newConfig:i({},this.config)})):(a.DEBUG=!1,ks._is_supported()&&ks._remove("ph_debug"))),null==(s=this.featureFlags)||null==s.updateConfig||s.updateConfig(this.config,this._shouldDisableFlags()),null==(r=this.exceptionObserver)||r.onConfigChange(),null==(n=this.exceptions)||n.onConfigChange(),null==(o=this.metrics)||o.onConfigChange(),null==(l=this.webMCP)||l.startIfEnabled(),null==(d=this.sessionRecording)||d.startIfEnabledOrStop(),null==(u=this.tracingHeaders)||u.startIfEnabledOrStop(),null==(_=this.autocapture)||_.startIfEnabled(),null==(c=this.heatmaps)||c.startIfEnabled(),("capture_pageview"in e||"disable_capture_url_hashes"in e)&&(null==(h=this.historyAutocapture)||h.startIfEnabledOrStop()),null==(p=this.exceptionObserver)||p.startIfEnabledOrStop(),null==(g=this.deadClicksAutocapture)||g.startIfEnabledOrStop(),null==(v=this.surveys)||v.loadIfEnabled(),this._sync_opt_out_with_persistence(),null==(f=this.externalIntegrations)||f.startIfEnabledOrStop(),!t.segment&&this.config.segment&&this.persistence&&Ws(this,Fo,!1)}}_overrideSDKInfo(e,t){a.LIB_NAME=e,a.LIB_VERSION=t}startSessionRecording(e){var t,i,s,r,n,o=!0===e,a={sampling:o||!(null==e||!e.sampling),linked_flag:o||!(null==e||!e.linked_flag),url_trigger:o||!(null==e||!e.url_trigger),event_trigger:o||!(null==e||!e.event_trigger)};Object.values(a).some(Boolean)&&(null==(t=this.sessionManager)||t.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(s=this.sessionRecording)||s.overrideLinkedFlag()),a.url_trigger&&(null==(r=this.sessionRecording)||r.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 e;return!(null==(e=this.sessionRecording)||!e.started)}captureException(e,t){try{if(!this.exceptions)return;var s=this.exceptions.buildProperties(e,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(i({},s,t))}catch(e){return}}addExceptionStep(e,t){var i;null==(i=this.exceptions)||i.addExceptionStep(e,t)}captureLog(e){var t;null==(t=this.logs)||t.captureLog(e)}get logger(){var t,i;return null!==(t=null==(i=this.logs)?void 0:i.logger)&&void 0!==t?t:e._noopLogger}startExceptionAutocapture(e){this.set_config({capture_exceptions:null==e||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,i;return null!==(t=null==(i=this.toolbar)?void 0:i.loadToolbar(e))&&void 0!==t&&t}get_property(e){var t;return null==(t=this.persistence)?void 0:t.props[e]}getSessionProperty(e){var t;return null==(t=this.sessionPersistence)?void 0:t.props[e]}toString(){var e,t=null!==(e=this.config.name)&&void 0!==e?e:Go;return t!==Go&&(t="posthog."+t),t}_isIdentified(){var e,t;return"identified"===(null==(e=this.persistence)?void 0:e.get_property("$user_state"))||"identified"===(null==(t=this.sessionPersistence)?void 0:t.get_property("$user_state"))}_hasPersonProcessing(){var e,t;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&mt(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e.__alias)&&(null==(t=this.persistence)||null==(t=t.props)||!t.$epp))}_shouldCapturePageleave(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this._hasPersonProcessing()||this._requirePersonProcessing("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this._requirePersonProcessing("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}_requirePersonProcessing(e){return"never"===this.config.person_profiles?(Zi.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._warnIfVolatileIdentityWithoutStableId(),this._register_single(Ne,!0),!0)}_is_persistence_disabled(){if("always"===this.config.cookieless_mode)return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&"on_reject"!==this.config.cookieless_mode)}_sync_opt_out_with_persistence(){var e,t,i,s,r,n=this._is_persistence_disabled();return this.is_capturing()||null==(e=this.logs)||e._onOptOut(),(null==(t=this.persistence)?void 0:t._disabled)!==n&&(null==(i=this.persistence)||i.set_disabled(n)),(null==(s=this.sessionPersistence)?void 0:s._disabled)!==n&&(null==(r=this.sessionPersistence)||r.set_disabled(n)),this._persistSessionRegisteredPropKeys(),n}opt_in_capturing(t){var i,s,r,n;if("always"!==this.config.cookieless_mode){if(this._inCookielessMode()){var o,a,l,d,u,_;null==(o=this.sessionRecording)||o.dispose({discardBufferedEvents:!0}),this._reset(!0,!0),null==(a=this.sessionManager)||a.destroy(),null==(l=this.pageViewManager)||l.destroy(),this.sessionManager=new oo(this),this.pageViewManager=new Ks(this),this.persistence&&(this.sessionPropsManager=new io(this,this.sessionManager,this.persistence));var c,h=null!==(d=null==(u=this.config.__extensionClasses)?void 0:u.sessionRecording)&&void 0!==d?d:null==(_=e.__defaultExtensionClasses)?void 0:_.sessionRecording;h&&(this.sessionRecording=this._replaceExtension(this.sessionRecording,new h(this)),this._lastRemoteConfig&&(null==(c=this.sessionRecording)||null==c.onRemoteConfig||c.onRemoteConfig(this._lastRemoteConfig)))}var p,g,v=1===this.consent.consent;v&&this._syncCookielessIdentity(),this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),this._start_queue_if_opted_in(),null==(i=this.sessionRecording)||i.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null==(p=this.surveys)||p.loadIfEnabled(),null==(g=this.conversations)||g.loadIfEnabled()),!v&&(yt(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)&&this.capture(null!==(s=null==t?void 0:t.captureEventName)&&void 0!==s?s:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),null==(r=this.persistence)||r.syncCookieProperties(),this._processCookieIdentityChange(),null==(n=this.featureFlags)||n.sendFlagCallsPendingCapture(),this.config.capture_pageview&&this._captureInitialPageview()}else Zi.warn(Ro)}opt_out_capturing(){"always"!==this.config.cookieless_mode?(this.consent.optInOut(!1),this._sync_opt_out_with_persistence(),"on_reject"===this.config.cookieless_mode&&this._enterCookielessMode()):Zi.warn(Ro)}_enterCookielessMode(){var e,t,i=this.sessionRecording;null==i||i.dispose({discardBufferedEvents:!0}),"$posthog_cookieless"!==this.get_distinct_id()&&this._reset(!0,!0),this.register({distinct_id:Be,$device_id:null}),this._removeExtension(i),this.sessionRecording=void 0,null==(e=this.sessionManager)||e.destroy(),null==(t=this.pageViewManager)||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this._captureInitialPageview(),this._start_queue_if_opted_in()}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return 1===e?"granted":0===e?"denied":"pending"}is_capturing(){return!this._isConsentTransition&&("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._sync_opt_out_with_persistence()}_is_bot(){return u?function(e,t){if(!e)return!1;var i=e.userAgent;if(i&&At(i,t))return!0;try{var s=null==e?void 0:e.userAgentData;if(null!=s&&s.brands&&s.brands.some(e=>At(null==e?void 0:e.brand,t)))return!0}catch(e){}return!!e.webdriver}(u,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){_&&("visible"===_.visibilityState?this._initialPageviewCaptured||(this._initialPageviewCaptured=!0,this.capture(st,{title:_.title},{send_instantly:!0}),this._visibilityStateListener&&(_.removeEventListener(L,this._visibilityStateListener),this._visibilityStateListener=null)):this._visibilityStateListener||(this._visibilityStateListener=this._captureInitialPageview.bind(this),ds(_,L,this._visibilityStateListener)))}debug(e){!1===e?(null==l||l.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==l||l.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 e=this._originalUserConfig||{};return"advanced_disable_flags"in e?!!e.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(Zi.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(e,t,i,s,r){var n=t in e&&!Pt(e[t]),o=i in e&&!Pt(e[i]);return n?e[t]:!!o&&(r&&r.warn("Config field '"+i+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[i])}(e,"advanced_disable_flags","advanced_disable_decide",0,Zi)}_runBeforeSend(e){var t;if(Pt(this.config.before_send))return e;var i=Object.keys(null!==(t=e.properties)&&void 0!==t?t:{}).filter(xt),s=gt(this.config.before_send)?this.config.before_send:[this.config.before_send],r=e;for(var n of s)try{if(r=n(r),Pt(r)){var o="Event '"+e.event+"' was rejected in beforeSend function";return Et(e.event)?Zi.warn(o+". This can cause unexpected behavior."):Zi.info(o),null}r.properties&&!mt(r.properties)||Zi.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}catch(t){return Zi.error("Error in beforeSend function for event '"+e.event+"':",t),null}for(var a of i)if(r.properties&&Pt(r.properties[a]))return Zi.warn("Event '"+e.event+"' had its '"+a+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return r}getPageViewId(){var e;return null==(e=this.pageViewManager._currentPageview)?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}_checkLocalStorageForDebug(e){var t=It(e)&&!e,i=ks._is_supported()&&"true"===ks._get("ph_debug");return!t&&(!!i||e)}},e.__defaultExtensionClasses={},e._noopLogger={trace:co=()=>{},debug:co,info:co,warn:co,error:co,fatal:co},e);!function(e,t){for(var i=0;t.length>i;i++)e.prototype[t[i]]=rs(e.prototype[t[i]])}(Yo,["identify"]);var Qo=function(){a.SDK_DIST_CHANNEL="npm";var e=To[Go]=new Yo;return function(){function e(){e.done||(e.done=!0,Yn=!1,is(To,function(e){e._dom_loaded()}))}null!=_&&_.addEventListener?"complete"===_.readyState?e():ds(_,"DOMContentLoaded",e,{capture:!1}):l&&Zi.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),e}();export{Tr as Compression,Hr as DEFAULT_PRODUCT_TOUR_APPEARANCE,Ur as DisplaySurveyType,Yo as PostHog,Gr as ProductTourEventName,Wr as ProductTourEventProperties,Nr as SurveyEventName,Br as SurveyEventProperties,$r as SurveyEventType,Rr as SurveyPosition,Dr as SurveyQuestionBranchingType,Ar as SurveyQuestionType,Lr as SurveySchedule,Or as SurveyTabPosition,Mr as SurveyType,Fr as SurveyWidgetType,Qo as default,Qo as posthog,Jr as severityLevels};
|
|
1
|
+
var e,t=["retriesPerformedSoFar"];function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var i=arguments[t];for(var s in i)({}).hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e},i.apply(null,arguments)}function s(e,t,i,s,r,n,o){try{var a=e[n](o),l=a.value}catch(e){return void i(e)}a.done?t(l):Promise.resolve(l).then(s,r)}function r(e){return function(){var t=this,i=arguments;return new Promise(function(r,n){var o=e.apply(t,i);function a(e){s(o,r,n,a,l,"next",e)}function l(e){s(o,r,n,a,l,"throw",e)}a(void 0)})}}var n="0.12.2",o={DEBUG:(!1,!1),LIB_VERSION:(n,"1.453.2"),LIB_NAME:("browser-common","web"),JS_SDK_VERSION:n},a=o,l="u">typeof window?window:void 0,d="u">typeof globalThis?globalThis:l,u=null==d?void 0:d.navigator,_=null==d?void 0:d.document,c=null==d?void 0:d.location,h=null==d?void 0:d.fetch,p=null!=d&&d.XMLHttpRequest&&"withCredentials"in new d.XMLHttpRequest?d.XMLHttpRequest:void 0,g=null==d?void 0:d.AbortController,v=null==d?void 0:d.CompressionStream,f=null==u?void 0:u.userAgent,m="undefined"!=typeof globalThis?globalThis:l;m&&"undefined"==typeof self&&(m.self=m),m&&"undefined"==typeof File&&(m.File=function(){});var y=null!=l?l:{},b=e=>{var t;return null!=e&&e.config.require_subresource_integrity?e.__loadExternalDependency:null==(t=y.__PosthogExtensions__)?void 0:t.loadExternalDependency},w="$early_access_features",S="$active_feature_flags",P="$feature_flag_details",k="$feature_flag_errors",C="$feature_flag_evaluated_at",I="$feature_flag_request_id",E="$minimal_flag_called_events",x="$enabled_feature_flags",T="$stored_group_properties",F="$stored_person_properties",R="$flag_call_reported",O="$flag_call_reported_session_id",M="$feature_flag_payloads",A="$override_feature_flags",D="$override_feature_flag_payloads",L="visibilitychange",N="$autocapture_disabled_server_side",B="$surveys",U="$surveys_loaded_at",q="$surveys_activated",H="$surveys_activated_session",G="$surveys_activated_timestamps",W="$people_distinct_id",V="distinct_id",j="$device_id",z="$device_model",K="__alias",J="__cmpns",Y="$fbc",Q="$fbc_persistence",X="$fbp",Z="$fbp_persistence",ee="__timers",te="$heatmaps_enabled_server_side",ie="$exception_capture_enabled_server_side",se="$error_tracking_suppression_rules",re="$error_tracking_capture_extension_exceptions",ne="$web_vitals_enabled_server_side",oe="$dead_clicks_enabled_server_side",ae="$product_tours_enabled_server_side",le="$logs_capture_enabled_server_side",de="$web_vitals_allowed_metrics",ue="$session_recording_remote_config",_e="$session_recording_enabled_server_side",ce="$replay_sample_rate",he="$replay_override_sampling",pe="$replay_override_linked_flag",ge="$replay_override_url_trigger",ve="$replay_override_event_trigger",fe="$sesid",me="$session_is_sampled",ye="$session_past_minimum_duration",be="$session_recording_url_trigger_activated_session",we="$session_recording_event_trigger_activated_session",Se="$debug_first_full_snapshot_timestamp",Pe="$sess_rec_flush_size",ke="$groups",Ce="ph_product_tours",Ie="$product_tours_activated",Ee="$product_tours_activated_session",xe="$conversations_widget_session_id",Te="$conversations_ticket_id",$e="$conversations_widget_state",Fe="$conversations_user_traits",Re="$user_state",Oe="$client_session_props",Me="$capture_rate_limit",Ae="$initial_campaign_params",De="$initial_referrer_info",Le="$initial_person_info",Ne="$epp",Be="$posthog_cookieless",Ue="$cookieless_mode",qe="$sdk_debug_extensions_init_method",He="$sdk_debug_extensions_init_time_ms",Ge="$sdk_debug_recording_script_not_loaded",We="$sdk_debug_replay_stale_config",Ve="$sdk_debug_replay_event_trigger_status",je="$sdk_debug_replay_linked_flag_trigger_status",ze="$sdk_debug_replay_matched_recording_trigger_groups",Ke="$sdk_debug_replay_pending_trigger_conditions",Je="$sdk_debug_replay_remote_trigger_matching_config",Ye="$sdk_debug_replay_trigger_groups_count",Qe="$sdk_debug_replay_url_trigger_status",Xe="$session_recording_start_reason",Ze="anonymous",et="identified",tt="identified_only",it="beforeunload",st="$pageview",rt="$pageleave",nt="$identify",ot="$groupidentify",at=function(e){return e.GZipJS="gzip-js",e.Base64="base64",e}({}),lt=["$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"],dt=["token"];function ut(e,t){return-1!==e.indexOf(t)}var _t=function(e){return e.replace(/^\$/,"")},ct=Object.prototype,ht=ct.hasOwnProperty,pt=ct.toString,gt=Array.isArray||function(e){return"[object Array]"===pt.call(e)},vt=e=>"function"==typeof e,ft=e=>e===Object(e)&&!gt(e),mt=e=>{if(ft(e)){for(var t in e)if(ht.call(e,t))return!1;return!0}return!1},yt=e=>void 0===e,bt=e=>"[object String]"==pt.call(e),wt=e=>bt(e)&&0===e.trim().length,St=e=>null===e,Pt=e=>yt(e)||St(e),kt=e=>"[object Number]"==pt.call(e)&&e==e,Ct=e=>kt(e)&&e>0,It=e=>"[object Boolean]"===pt.call(e),Et=e=>ut(lt,e),xt=e=>ut(dt,e);function Tt(e){switch({}.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return function(e,t){try{return e instanceof t}catch(e){return!1}}(e,Error)}}var $t=[!0,"true",1,"1","yes"],Ft=e=>ut($t,e),Rt=[!1,"false",0,"0","no"],Ot=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterestbot","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","lightpanda","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],Mt=new Map,At=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var i=function(e,t){for(var i="",s=0;t.length>s;s++){var r=t[s];i+=r.length+":"+r}return e.length+":"+e+"|"+t.length+":"+i}(e,t),s=Mt.get(i);if(void 0!==s)return s;var r=e.toLowerCase(),n=Ot.concat(t).some(e=>-1!==r.indexOf(e.toLowerCase()));return 256>Mt.size||Mt.clear(),Mt.set(i,n),n};function Dt(e,t,i,s,r){return t>i&&(s.warn("min cannot be greater than max."),t=i),kt(e)?e>i?(s.warn(" cannot be greater than max: "+i+". Using max value instead."),i):t>e?(s.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(s.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+r),Dt(null!=r?r:i,t,i,s))}var Lt="Mobile",Nt="Android",Bt="Tablet",Ut="Android Tablet",qt="iPad",Ht="Apple Watch",Gt="Safari",Wt="BlackBerry",Vt="Samsung Internet",jt="Chrome",zt="Chrome iOS",Kt="Internet Explorer",Jt="Internet Explorer Mobile",Yt="Opera",Qt="Microsoft Edge",Xt="Firefox",Zt="Firefox iOS",ei="Nintendo",ti="PlayStation",ii="Xbox",si="Android Mobile",ri="Mobile Safari",ni="Windows",oi="Windows Phone",ai="Nokia",li="Ouya",di="Generic tablet",ui="Konqueror",_i="Oculus Browser",ci="Vivaldi",hi="Yandex",pi="Whale",gi="DuckDuckGo",vi="Pale Moon",fi="Waterfox",mi="Brave",yi="Claude",bi="Codex",wi="ChatGPT",Si="Google Search App",Pi=new RegExp("Version/(\\d+(\\.\\d+)?)"),ki=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),Ci=new RegExp(ii,"i"),Ii=new RegExp("PlayStation \\w+","i"),Ei=new RegExp("Nintendo \\w+","i"),xi=new RegExp("BlackBerry|PlayBook|BB10","i"),Ti={"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"},$i=function(e,t,i,s){t=t||"";var r=function(e){return null!=e&&e.brave?mi:null}(i);return r||(null!=s&&s.detectGoogleSearchApp&&ut(e,"GSA/")?Si:ut(e," OPR/")&&ut(e,"Mini")?"Opera Mini":ut(e," OPR/")?Yt:xi.test(e)?Wt:ut(e,"IEMobile")||ut(e,"WPDesktop")?Jt:ut(e,"OculusBrowser")?_i:ut(e,"SamsungBrowser")?Vt:ut(e,"Edge")||ut(e,"Edg/")?Qt:ut(e,"Vivaldi/")?ci:ut(e,"YaBrowser/")?hi:ut(e,"Whale/")?pi:ut(e,"DuckDuckGo/")||ut(e,"Ddg/")?gi:ut(e,"Claude/")?yi:ut(e,"Codex/")?bi:ut(e,"ChatGPT/")?wi:ut(e,"FBIOS")?"Facebook Mobile":ut(e,"UCWEB")||ut(e,"UCBrowser")?"UC Browser":ut(e,"CriOS")?zt:ut(e,"CrMo")||ut(e,jt)?jt:ut(e,Nt)&&ut(e,Gt)?si:ut(e,"FxiOS")?Zt:ut(e.toLowerCase(),ui.toLowerCase())?ui:ut(e,"Brave/")?mi:((e,t)=>t&&ut(t,"Apple")||function(e){return ut(e,Gt)&&!ut(e,jt)&&!ut(e,Nt)}(e))(e,t)?ut(e,Lt)?ri:Gt:ut(e,"PaleMoon/")?vi:ut(e,"Waterfox/")?fi:ut(e,Xt)?Xt:ut(e,"MSIE")||ut(e,"Trident/")?Kt:ut(e,"Gecko")?Xt:"")},Fi={[Jt]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[Qt]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[jt]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[zt]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[Gt]:[Pi],[ri]:[Pi],[Yt]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[Xt]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[Zt]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[ui]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[Wt]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),Pi],[si]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[Vt]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[_i]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[ci]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[hi]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[pi]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[mi]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[yi]:[ki],[bi]:[ki],[wi]:[ki],[gi]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[vi]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[fi]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[Si]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[Kt]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},Ri=function(e,t,i,s){var r=Fi[$i(e,t,i,s)];if(yt(r))return null;for(var n=0;r.length>n;n++){var o=e.match(r[n]);if(o)return parseFloat(o[o.length-2])}return null},Oi=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),e=>[ii,e&&e[1]||""]],[new RegExp(ei,"i"),[ei,""]],[new RegExp(ti,"i"),[ti,""]],[xi,[Wt,""]],[new RegExp(ni,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[oi,""];if(new RegExp(Lt).test(t)&&!/IEMobile\b/.test(t))return["Windows Mobile",""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var s=Ti[i[1]]||"";return/arm/i.test(t)&&(s="RT"),[ni,s]}return[ni,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?["iOS",[e[3],e[4],e[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=yt(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),e=>e&&e[2]?[Nt,[e[2],e[3],e[4]||"0"].join(".")]:[Nt,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],Mi=function(e){return Ei.test(e)?ei:Ii.test(e)?ti:Ci.test(e)?ii:new RegExp(li,"i").test(e)?li:new RegExp("(Windows Phone|WPDesktop)","i").test(e)?oi:/iPad/.test(e)?qt:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?Ht:xi.test(e)?Wt:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(ai,"i").test(e)?ai:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(Lt).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?Nt:Ut:new RegExp("(pda|Mobile)","i").test(e)?"Generic mobile":new RegExp(Bt,"i").test(e)&&!new RegExp("Tablet pc","i").test(e)?di:""},Ai=/\bFBAV\/(\d+(?:\.\d+)*)/i,Di=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",Ai],[/\bFBAN\/EMA\b/i,"Facebook Lite",Ai],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",Ai],[/\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"]],Li=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Ni(e,t){return"string"==typeof(i=e)&&Li.test(i)?e:t();var i}function Bi(e,t){var i=new Error(t);try{Object.defineProperty(i,"name",{value:e,writable:!0,enumerable:!0,configurable:!0})}catch(e){}return i}function Ui(e){return e?e.split("#")[0]:e}var qi,Hi=["$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"],Gi="NativeGzipValidationError",Wi=e=>e.length>=2&&31===e[0]&&139===e[1],Vi=(e,t)=>e===at.GZipJS||t===at.GZipJS||"gzip"===t,ji=e=>!(!e||"object"!=typeof e)&&"NotReadableError"===("name"in e?String(e.name):""),zi=e=>{throw Bi(Gi,"Native gzip produced invalid output: "+e)},Ki=0,Ji=!1,Yi=function(){var e=r(function*(e,t){18>e.size&&zi("too-short");var i=new Uint8Array(yield e.slice(0,10).arrayBuffer());Wi(i)&&8===i[2]||zi("invalid-header");var s=new DataView(yield e.slice(e.size-8).arrayBuffer()),r=t.length>>>0;s.getUint32(4,!0)!==r&&zi("invalid-size"),(Ji||3>Ki)&&(s.getUint32(0,!0)!==(e=>{for(var t=(()=>{if(qi)return qi;qi=[];for(var e=0;256>e;e++){for(var t=e,i=0;8>i;i++)t=1&t?3988292384^t>>>1:t>>>1;qi[e]=t>>>0}return qi})(),i=4294967295,s=0;e.length>s;s++)i=t[255&(i^e[s])]^i>>>8;return(4294967295^i)>>>0})(t)&&(Ji=!0,zi("invalid-crc")),Ki++)});return function(t,i){return e.apply(this,arguments)}}();function Qi(){return Qi=r(function*(e,t,i){void 0===t&&(t=!0);try{var s=(new TextEncoder).encode(e),n=new globalThis.CompressionStream("gzip"),o=n.writable.getWriter(),a=o.write(s).then(()=>o.close()).catch(function(){var e=r(function*(e){try{yield o.abort(e)}catch(e){}throw e});return function(t){return e.apply(this,arguments)}}()),l=new Response(n.readable).blob(),d=(yield Promise.all([l,a]))[0];return yield Yi(d,s),d}catch(e){if(null!=i&&i.rethrow)throw e;return t&&console.error("Failed to gzip compress data",e),null}}),Qi.apply(this,arguments)}var Xi=function(e,t){var i=(void 0===t?{}:t).debugEnabled,s={_log(t){var s;try{s=typeof window>"u"?void 0:window}catch(e){return}for(var r=arguments.length,n=new Array(r>1?r-1:0),a=1;r>a;a++)n[a-1]=arguments[a];s&&(o.DEBUG||s.POSTHOG_DEBUG||i)&&!yt(s.console)&&s.console&&("__rrweb_original__"in s.console[t]?s.console[t].__rrweb_original__:s.console[t])(e,...n)},debug(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s._log("debug",...t)},info(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s._log("log",...t)},warn(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s._log("warn",...t)},error(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s._log("error",...t)},critical(){for(var t=arguments.length,i=new Array(t),s=0;t>s;s++)i[s]=arguments[s];console.error(e,...i)},uninitializedWarning(e){s.error("You must initialize PostHog before calling "+e)},createLogger:(t,i)=>Xi(e+" "+t,i)};return s},Zi=Xi("[PostHog.js]"),es=(e,t)=>Zi.createLogger(e,t);function ts(e,t){gt(e)&&e.forEach(t)}function is(e,t){if(!Pt(e))if(gt(e))e.forEach(t);else if((e=>e instanceof FormData)(e))e.forEach((e,i)=>t(e,i));else for(var i in e)ht.call(e,i)&&t(e[i],i)}var ss=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;t>s;s++)i[s-1]=arguments[s];for(var r of i)for(var n in r)void 0!==r[n]&&(e[n]=r[n]);return e},rs=function(e){return function(){try{for(var t=arguments.length,i=new Array(t),s=0;t>s;s++)i[s]=arguments[s];return e.apply(this,i)}catch(e){Zi.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Zi.critical(e)}}},ns=function(e){var t={};return is(e,function(e,i){(bt(e)&&e.length>0||kt(e))&&(t[i]=e)}),t};function os(e){var t=i({},e);for(var s of["name","message","stack","cause","errors"])try{s in e&&(t[s]=e[s])}catch(e){}return t}var as=["herokuapp.com","vercel.app","netlify.app"];function ls(e){var t=null==e?void 0:e.hostname;if(!bt(t))return!1;var i=t.split(".").slice(-2).join(".");for(var s of as)if(i===s)return!1;return!0}function ds(e,t,i,s){var r=null!=s?s:{},n=r.capture,o=r.passive;null==e||e.addEventListener(t,i,{capture:void 0!==n&&n,passive:void 0===o||o})}var us,_s,cs=e=>{if(_){try{for(var t=e+"=",i=_.cookie.split(";").filter(e=>e.length),s=0;i.length>s;s++){for(var r=i[s];" "==r.charAt(0);)r=r.substring(1,r.length);if(0===r.indexOf(t))return decodeURIComponent(r.substring(t.length,r.length))}}catch(e){}return null}},hs=class e{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,i,s,r){if(!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||!Number.isInteger(r)||0>t||0>i||0>s||0>r||t>0xffffffffffff||i>4095||s>1073741823||r>4294967295)throw new RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=t/Math.pow(2,40),n[1]=t/Math.pow(2,32),n[2]=t/Math.pow(2,24),n[3]=t/Math.pow(2,16),n[4]=t/256,n[5]=t,n[6]=112|i>>>8,n[7]=i,n[8]=128|s>>>24,n[9]=s>>>16,n[10]=s>>>8,n[11]=s,n[12]=r>>>24,n[13]=r>>>16,n[14]=r>>>8,n[15]=r,new e(n)}toString(){for(var e="",t=0;this.bytes.length>t;t++)e=e+(this.bytes[t]>>>4).toString(16)+(15&this.bytes[t]).toString(16),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new e(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(var t=0;16>t;t++){var i=this.bytes[t]-e.bytes[t];if(0!==i)return Math.sign(i)}return 0}},ps=class{generate(){var e=this.generateOrAbort();if(!yt(e))return e;this._timestamp=0;var t=this.generateOrAbort();if(yt(t))throw new Error("Could not generate UUID after timestamp reset");return t}generateOrAbort(){var e=(()=>{var e=Date.now();return kt(e)&&isFinite(e)?Math.min(Math.max(Math.floor(e),0),0xffffffffffff):0})();if(e>this._timestamp)this._timestamp=e,this._resetCounter();else{if(this._timestamp>=e+1e4)return;this._counter++,this._counter>4398046511103&&(this._timestamp++,this._resetCounter())}return hs.fromFieldsV7(this._timestamp,Math.trunc(this._counter/Math.pow(2,30)),this._counter&Math.pow(2,30)-1,this._random.nextUint32())}_resetCounter(){this._counter=1024*this._random.nextUint32()+(1023&this._random.nextUint32())}constructor(){this._timestamp=0,this._counter=0,this._random=new vs}},gs=e=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e},vs=class{nextUint32(){return this._buffer.length>this._cursor||((null!=us?us:us="u">typeof window&&!yt(window.crypto)&&crypto.getRandomValues?e=>{try{return crypto.getRandomValues(e)}catch(t){return gs(e)}}:gs)(this._buffer),this._cursor=0),this._buffer[this._cursor++]}constructor(){this._buffer=new Uint32Array(8),this._cursor=1/0}},fs=()=>ms().toString(),ms=()=>(_s||(_s=new ps)).generate(),ys="",bs=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var ws=null,Ss={_is_supported(){if(!St(ws))return ws;if(ws=!1,_)try{var e="__ph_cookie_support_"+fs();Ss._set(e,"xyz"),ws='"xyz"'===cs(e),Ss._remove(e)}catch(e){ws=!1}return ws},_error(e){Zi.error("cookieStore error: "+e)},_get:cs,_parse(e){var t;try{t=JSON.parse(Ss._get(e))||{}}catch(e){}return t},_set(e,t,i,s,r){if(!_)return!1;try{var n="",o="",a=function(e,t){if(t){var i=function(e,t){if(void 0===t&&(t=_),ys)return ys;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var i=e.split("."),s=Math.min(i.length,8),r="dmn_chk_"+fs();!ys&&s--;){var n=i.slice(s).join("."),o=r+"=1;domain=."+n+";path=/";t.cookie=o+";max-age=3",t.cookie.includes(r)&&(t.cookie=o+";max-age=0",ys=n)}return ys}(e);if(!i){var s=(e=>{var t=e.match(bs);return t?t[0]:""})(e);s!==i&&Zi.info("Warning: cookie subdomain discovery mismatch",s,i),i=s}return i?"; domain=."+i:""}return""}(_.location.hostname,s);if(i){var l=new Date;l.setTime(l.getTime()+864e5*i),n="; expires="+l.toUTCString()}r&&(o="; secure");var d=e+"="+encodeURIComponent(JSON.stringify(t))+n+"; SameSite=Lax; path=/"+a+o;return d.length>3686.4&&Zi.warn("cookieStore warning: large cookie, len="+d.length),_.cookie=d,!0}catch(e){return!1}},_remove(e,t){if(null!=_&&_.cookie&&(!t||!St(cs(e))))try{Ss._set(e,"",-1,t)}catch(e){return}}},Ps=null,ks={_is_supported(){if(!St(Ps))return Ps;var e=!0;if(yt(l))e=!1;else try{var t="__mplssupport__";ks._set(t,"xyz"),'"xyz"'!==ks._get(t)&&(e=!1),ks._remove(t)}catch(t){e=!1}return e||Zi.error("localStorage unsupported; falling back to cookie store"),Ps=e,e},_error(e){Zi.error("localStorage error: "+e)},_get(e){try{return null==l?void 0:l.localStorage.getItem(e)}catch(e){ks._error(e)}return null},_parse(e){try{return JSON.parse(ks._get(e))||{}}catch(e){}return null},_set(e,t){try{return null==l||l.localStorage.setItem(e,JSON.stringify(t)),!0}catch(e){ks._error(e)}return!1},_remove(e){try{null==l||l.localStorage.removeItem(e)}catch(e){ks._error(e)}}},Cs=[F,S,x,P,M,I,C,k,R],Is=[j,V,fe,me,Ne,Le,Q,Re],Es=e=>e+"_cpm",xs=["__proto__","constructor","prototype"],Ts=e=>{if(!ft(e))return{};var t={};return Object.keys(e).forEach(i=>{-1===xs.indexOf(i)&&(t[i]=e[i])}),t},$s=function(e,t){void 0===t&&(t=[]);var i={};return[...Is,...t].forEach(t=>{var s=e[t];yt(s)||St(s)||""===s||(i[t]=s)}),i},Fs=e=>{for(var t=5381,i=2166136261,s=0;e.length>s;s++){var r=e.charCodeAt(s);t=33*t^r,i=Math.imul(i^r,16777619)}return e.length.toString(36)+"."+(t>>>0).toString(36)+"."+(i>>>0).toString(36)},Rs=(e,t)=>({p:t,f:Fs(JSON.stringify(e))}),Os=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{var i=Ss._parse(Es(e)),s=(null==i?void 0:i.f)===Fs(t)&>(i.p);return{properties:s?i.p:[],isValid:s}}catch(e){return{properties:[],isValid:!1}}},Ms=(e,t)=>t+"|"+(Ss._get(Es(e))||""),As={},Ds={_is_supported:()=>!0,_error(e){Zi.error("memoryStorage error: "+e)},_get:e=>e in As?As[e]:null,_parse:e=>e in As?As[e]:null,_set:(e,t)=>(As[e]=t,!0),_remove(e){delete As[e]}},Ls=null,Ns={_is_supported(){if(!St(Ls))return Ls;if(Ls=!0,yt(l))Ls=!1;else try{var e="__support__";Ns._set(e,"xyz"),'"xyz"'!==Ns._get(e)&&(Ls=!1),Ns._remove(e)}catch(e){Ls=!1}return Ls},_error(e){Zi.error("sessionStorage error: ",e)},_get(e){try{return null==l?void 0:l.sessionStorage.getItem(e)}catch(e){Ns._error(e)}return null},_parse(e){try{return JSON.parse(Ns._get(e))||null}catch(e){}return null},_set(e,t){try{return null==l||l.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(e){Ns._error(e)}return!1},_remove(e){try{null==l||l.sessionStorage.removeItem(e)}catch(e){Ns._error(e)}}},Bs=class{constructor(e){this._instance=e}get _config(){return this._instance.config}get consent(){return this._getDnt()?0:this._storedConsent}isOptedOut(){return"always"===this._config.cookieless_mode||this.isRejected()||-1===this.consent&&"on_reject"===this._config.cookieless_mode}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this._config.opt_out_capturing_by_default}optInOut(e){this._storage._set(this._storageKey,e?1:0,this._config.cookie_expiration,this._config.cross_subdomain_cookie,this._config.secure_cookie)}reset(){this._storage._remove(this._storageKey,this._config.cross_subdomain_cookie)}get _storageKey(){var e=this._instance.config,t=e.token,i=e.opt_out_capturing_cookie_prefix;return e.consent_persistence_name||(i?i+t:"__ph_opt_in_out_"+t)}get _storedConsent(){var e=this._storage._get(this._storageKey);return Ft(e)?1:ut(Rt,e)?0:-1}get _storage(){var e=this._config.opt_out_capturing_persistence_type,t="localStorage"===e?ks:Ss,i=t._is_supported()?t:Ds;if(!this._persistentStore||this._persistentStore!==i){this._persistentStore=i;var s="localStorage"===e?Ss:ks;s._get(this._storageKey)&&(this._persistentStore._get(this._storageKey)||this.optInOut(Ft(s._get(this._storageKey))),s._remove(this._storageKey,this._config.cross_subdomain_cookie))}return this._persistentStore}_getDnt(){return!!this._config.respect_dnt&&[null==u?void 0:u.doNotTrack,null==u?void 0:u.msDoNotTrack,y.doNotTrack,null==u?void 0:u.globalPrivacyControl].some(e=>Ft(e))}},Us=["next","previous","prev",">","<","→","←","›","‹","»","«","▶","◀","❯","❮"],qs=(()=>[...Us,"+","-","−","–"])(),Hs=e=>{var t,i=!(null==(t=e.instance.persistence)||!t.get_property(oe)),s=e.instance.config.capture_dead_clicks;return It(s)?s:!!ft(s)||i},Gs=es("[SegmentIntegration]");function Ws(e,t,s){void 0===s&&(s=!0);var r=e.config.segment;if(!r)return t();var n,o=(e=>vt(e.register))(n=r)?{analytics:n}:n,a=o.analytics,l=o.filterProperties;!function(e,t,i,s){var r=t=>{var r=()=>t.anonymousId()||fs();e.config.get_device_id=r,s&&t.id()&&(e.register({distinct_id:t.id(),$device_id:r()}),e.persistence.set_property(Re,et)),i(s?void 0:t.anonymousId()||void 0)},n=t.user();"then"in n&&vt(n.then)?n.then(r):r(n)}(e,a,s=>{a.register(function(e,t,s){var r=(void 0===s?{}:s).filterProperties;"undefined"!=typeof Promise&&Promise.resolve||Gs.warn("This browser does not have Promise support, and can not use the segment integration");var n=(s,n)=>{if(!n)return s;var o=!!t&&s.event.anonymousId===t&&!s.event.userId;o||s.event.userId||s.event.anonymousId===e.get_distinct_id()||(Gs.info("No userId set, resetting PostHog"),e.reset()),o||(t=void 0),s.event.userId&&s.event.userId!==e.get_distinct_id()&&(Gs.info("UserId set, identifying with PostHog"),e.identify(s.event.userId));var a=e.calculateEventProperties(n,s.event.properties);if(!Pt(r)){var l=s.event.properties||{},d={};for(var u of Object.keys(a))ht.call(l,u)||(d[u]=a[u]);var _=((e,t)=>{var s=gt(e)?e:[e],r=i({},t);for(var n of s)try{if(r=n(r),Pt(r))return null}catch(e){return Gs.error("Error in Segment filterProperties:",e),null}return r})(r,d);if(Pt(_))return s;a=_}return s.event.properties=Object.assign({},a,s.event.properties),s};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(e){return n(e,e.event.event)},page(e){return n(e,st)},identify(e){return n(e,nt)},screen(e){return n(e,"$screen")}}}(e,s,{filterProperties:l})).then(()=>{t()},e=>{Gs.error("Failed to register the Segment integration",e),t()})},s)}var Vs="posthog-js";function js(e,t){var s=void 0===t?{}:t,r=s.organization,n=s.projectId,o=s.prefix,a=s.severityAllowList,l=void 0===a?["error"]:a,d=s.sendExceptionsToPostHog,u=void 0===d||d;return t=>{var s,a,d,_,c,h;if("*"!==l&&!l.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var p=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());t.tags["PostHog Person URL"]=p,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var g=(null==(s=t.exception)?void 0:s.values)||[],v=g.map(e=>i({},e,{stacktrace:e.stacktrace?i({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map(e=>i({},e,{platform:"web:javascript"}))}):void 0})),f={$exception_message:(null==(a=g[0])?void 0:a.value)||t.message,$exception_type:null==(d=g[0])?void 0:d.type,$exception_level:t.level,$exception_list:v,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(_=g[0])?void 0:_.value)||t.message,$sentry_exception_type:null==(c=g[0])?void 0:c.type,$sentry_tags:t.tags};return r&&n&&(f.$sentry_url=(o||"https://sentry.io/organizations/")+r+"/issues/?project="+n+"&query="+t.event_id),u&&(null==(h=e.exceptions)||h.sendExceptionEvent(f)),t}}var zs=class{constructor(e,t,i,s,r,n){this.name=Vs,this.setupOnce=function(o){o(js(e,{organization:t,projectId:i,prefix:s,severityAllowList:r,sendExceptionsToPostHog:null==n||n}))}}},Ks=class{constructor(e){this._onSessionIdChange=(e,t,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(Zi.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:i}),this._currentPageview=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this._setupSessionRotationHandler()}_setupSessionRotationHandler(){var e;this._unsubscribeSessionId=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(this._onSessionIdChange)}destroy(){var e;null==(e=this._unsubscribeSessionId)||e.call(this),this._unsubscribeSessionId=void 0}doPageView(e,t){var i,s=this._previousPageViewProperties(e,t);return this._currentPageview={pathname:null!==(i=null==l?void 0:l.location.pathname)&&void 0!==i?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var t;return this._previousPageViewProperties(e,null==(t=this._currentPageview)?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null==(e=this._currentPageview)?void 0:e.pageViewId}}_previousPageViewProperties(e,t){var i=this._currentPageview;if(!i)return{$pageview_id:t};var s={$pageview_id:t,$prev_pageview_id:i.pageViewId},r=this._instance.scrollManager.getContext();if(r&&!this._instance.config.disable_scroll_properties){var n=r.maxScrollHeight,o=r.lastScrollY,a=r.maxScrollY,l=r.maxContentHeight,d=r.lastContentY,u=r.maxContentY;if(!(yt(n)||yt(o)||yt(a)||yt(l)||yt(d)||yt(u))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),d=Math.ceil(d),u=Math.ceil(u);var _=n>1?Dt(o/n,0,1,Zi):1,c=n>1?Dt(a/n,0,1,Zi):1,h=l>1?Dt(d/l,0,1,Zi):1,p=l>1?Dt(u/l,0,1,Zi):1;s=ss(s,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:_,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:c,$prev_pageview_last_content:d,$prev_pageview_last_content_percentage:h,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:p})}}return i.pathname&&(s.$prev_pageview_pathname=i.pathname),i.timestamp&&(s.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),s}},Js=["flags","surveys"],Ys={[W]:{exposure:"hidden"},[K]:{exposure:"hidden"},[J]:{exposure:"hidden"},[ee]:{exposure:"hidden"},[Q]:{exposure:"hidden"},[Z]:{exposure:"hidden"},[N]:{exposure:"event"},[te]:{exposure:"hidden"},[le]:{exposure:"hidden"},[ie]:{exposure:"event"},[se]:{exposure:"hidden"},[re]:{exposure:"event"},[ne]:{exposure:"event"},[oe]:{exposure:"event"},[ae]:{exposure:"hidden"},[de]:{exposure:"event"},[ue]:{exposure:"hidden"},[_e]:{exposure:"hidden"},[fe]:{exposure:"hidden"},[me]:{exposure:"event"},[ce]:{exposure:"event",shouldSkipFromEventProperties:e=>St(e)},[ye]:{exposure:"event"},[be]:{exposure:"event"},[we]:{exposure:"event"},[Se]:{exposure:"event"},[Pe]:{exposure:"hidden"},[x]:{exposure:"hidden",storageGroup:"flags"},[S]:{exposure:"hidden",storageGroup:"flags"},[w]:{exposure:"hidden"},[P]:{exposure:"hidden",storageGroup:"flags"},[M]:{exposure:"hidden",storageGroup:"flags"},[I]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[E]:{exposure:"hidden",storageGroup:"flags"},[A]:{exposure:"hidden"},[D]:{exposure:"hidden"},[F]:{exposure:"hidden"},[T]:{exposure:"hidden"},[B]:{exposure:"hidden",storageGroup:"surveys"},[U]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[q]:{exposure:"event"},[H]:{exposure:"hidden"},[G]:{exposure:"hidden"},[Ce]:{exposure:"hidden"},[Ie]:{exposure:"hidden"},[Ee]:{exposure:"hidden"},[xe]:{exposure:"event"},[Te]:{exposure:"event"},[$e]:{exposure:"event"},[Fe]:{exposure:"event"},[R]:{exposure:"hidden"},[O]:{exposure:"hidden"},[ke]:{exposure:"event"},[k]:{exposure:"hidden"},[C]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Re]:{exposure:"hidden"},[Oe]:{exposure:"hidden"},[Me]:{exposure:"hidden"},[Ae]:{exposure:"hidden"},[De]:{exposure:"hidden"},[Le]:{exposure:"hidden"},[Ne]:{exposure:"hidden"},[he]:{exposure:"event"},[pe]:{exposure:"event"},[ge]:{exposure:"event"},[ve]:{exposure:"event"},[qe]:{exposure:"event"},[He]:{exposure:"event"},[Ge]:{exposure:"hidden"},[We]:{exposure:"hidden"},[Ve]:{exposure:"hidden"},[je]:{exposure:"hidden"},[ze]:{exposure:"hidden"},[Ke]:{exposure:"hidden"},[Je]:{exposure:"hidden"},[Ye]:{exposure:"hidden"},[Qe]:{exposure:"hidden"},[Xe]:{exposure:"event"}},Qs=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Xs=e=>{var t=Ys[e];if(t)return t;for(var i of Qs){var s=i[1];if(0===e.indexOf(i[0]))return s}};function Zs(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}var er=e=>{var t,i=null==(t=typeof document>"u"?void 0:document)?void 0:t.createElement("a");return yt(i)?null:(i.href=e,i)},tr=(e,t)=>{try{var i;return JSON.stringify(e,(e,t)=>Tt(t)?(null!=i||(i=new WeakMap),i.has(t)||i.set(t,os(t)),i.get(t)):"bigint"==typeof t?t.toString():t,t)}catch(t){return r=[],null!==(s=JSON.stringify(e,function(e,t){if("bigint"==typeof t)return t.toString();if("function"!=typeof t&&"symbol"!=typeof t){if(t instanceof Error)return{name:t.name,message:t.message,stack:t.stack};if(t&&"object"==typeof t){for(;r.length>0&&r[r.length-1]!==this;)r.pop();if(r.includes(t))return"[Circular]";r.push(t)}return t}}))&&void 0!==s?s:"null"}var s,r},ir=function(e,t){for(var i,s=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;s.length>r;r++){var n=s[r].split(/=(.*)/);if(n[0]===t){i=n;break}}if(!gt(i)||2>i.length)return"";var o=i[1].replace(/\+/g," ");try{o=decodeURIComponent(o)}catch(e){Zi.error("Skipping decoding for malformed query param: "+o)}return o},sr=function(e,t,i){if(!e||!t||!t.length)return e;for(var s=e.split(/#(.*)/),r=s[1],n=(s[0]||"").split(/\?(.*)/),o=n[1],a=n[0],l=(o||"").split("&"),d=[],u=0;l.length>u;u++){for(var _=l[u].split("?"),c=0;_.length>c&&!t.includes(_[c].split("=")[0]);)c++;d.push(_.length>c?_.slice(0,c).concat(_[c].split("=")[0]+"="+i).join("?"):l[u])}var h=a;return null!=o&&(h+="?"+d.join("&")),null!=r&&(h+="#"+r),h},rr=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","oppref","bfcid","irclid","_kx"],nr=(()=>["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...rr])(),or="<masked>",ar=["li_fat_id"];function lr(e,t){var i=nr.concat(t||[]),s={};return is(i,function(t){var i=ir(e,t);s[t]=i||null}),s}function dr(e){var t=function(e){return e?0===e.search("https?://(.*)google.([^/?]*)")?"google":0===e.search("https?://(.*)bing.com")?"bing":0===e.search("https?://(.*)yahoo.com")?"yahoo":0===e.search("https?://(.*)duckduckgo.com")?"duckduckgo":null:null}(e),i="yahoo"!=t?"q":"p",s={};if(!St(t)){s.$search_engine=t;var r=_?ir(_.referrer,i):"";r.length&&(s.ph_keyword=r)}return s}function ur(){return navigator.language||navigator.userLanguage}var _r="$direct";function cr(){return(null==_?void 0:_.referrer)||_r}function hr(e,t,i){var s;void 0===i&&(i=!1);var r=e?[...rr,...t||[]]:[],n=null==(s=i?Ui(null==c?void 0:c.href):null==c?void 0:c.href)?void 0:s.substring(0,1e3);return{r:cr().substring(0,1e3),u:n?sr(n,r,or):void 0}}function pr(e,t){var i;void 0===t&&(t=!1);var s=e.r,r=e.u,n=t?Ui(r):r,o={$referrer:s,$referring_domain:null==s?void 0:s==_r?_r:null==(i=er(s))?void 0:i.host};if(n){o.$current_url=n;var a=er(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname,ss(o,lr(n))}return s&&ss(o,dr(s)),o}function gr(){try{return(new Date).getTimezoneOffset()}catch(e){return}}var vr={flags:C,surveys:U},fr=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],mr=e=>e+"_cookie_identity_change_pending",yr=e=>{var t="",i=0;for(var s of e){var r=encodeURIComponent(JSON.stringify(s).slice(1,-1)).length;if(i+r>1e3)break;t+=s,i+=r}return t},br="main",wr=[x,S,P,M,I,C,E,F],Sr=e=>-1!==wr.indexOf(e),Pr=[Q,Z],kr=e=>-1!==Pr.indexOf(e),Cr=(e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch(i){return e===t}},Ir=e=>{if(!e)return{};var t=JSON.parse(e);return ft(t)?t:{}},Er=(e,t)=>{is(e,(i,s)=>{var r=Xs(s);r&&"event"!==r.exposure||{}.hasOwnProperty.call(t,s)||delete e[s]})},xr=class{constructor(e,t,s,r){if(void 0===s&&(s=!0),void 0===r&&(r=!e.cookieless_mode),this._slotState={},this._splitStorageEligible=!1,this._storesIdentityInCookie=!1,this._splitStorage=!1,this._cookieIdentityChangePending=!1,this._cookieSyncSuppressed=!1,this._pendingCrossTabFeatureFlagChanges=new Map,this._storageMigrationInProgress=!1,this._localIdentityChangePending=!1,this._crossTabFeatureFlagIdentityMismatch=!1,this._metaIdentifierChangePending=new Set,this._crossTabFeatureFlagHandlers=new Set,this._config=e,this._ownsSplitStorage=s,this.props={},this._campaign_params_url=void 0,this._name=(e=>{var t="";return e.token&&(t=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),e.persistence_name?"ph_"+e.persistence_name:"ph_"+t+"_posthog"})(e),this._disabled=e.disable_persistence||!!t,this._storage=this._buildStorage(e),this._splitStorage=this._resolveSplitStorage(e),this.load(r),this._markLoadedCrossTabFeatureFlagChangesPending(),e.debug&&Zi.info("Persistence loaded",e.persistence,i({},this.props)),this.update_config(e,e,t),this.save(),l){var n=()=>this.flush();ds(l,"beforeunload",n,{capture:!1}),ds(l,"pagehide",n,{capture:!1}),this._onStorage=e=>{if(this._splitStorageEligible&&(!e.storageArea||e.storageArea===(null==l?void 0:l.localStorage))&&e.key)if(e.key!==this._name){if(this._splitStorage){var t=Js.find(t=>e.key===this._groupEntryName(t));t&&this._syncCrossTabFeatureFlagProperties(e.key,t)}}else this._syncCrossTabFeatureFlagProperties(e.key,br)},ds(l,"storage",this._onStorage)}}reconcileFeatureFlagsBeforeMerge(){return!(this._disabled||this._cookieSyncSuppressed||this._storageMigrationInProgress)&&this._reconcileCrossTabFeatureFlagPropertiesBeforeWrite()}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(e=>{var t=e[0],i=e[1],s=this._pendingCrossTabFeatureFlagChanges.get(t);if(Sr(t)&&!0!==s)if(!0!==i){var r=new Set(s||[]);i.forEach(e=>r.add(e)),r.size&&this._setCrossTabFeatureFlagChangesPending(t,r)}else this._setCrossTabFeatureFlagChangesPending(t,!0)})}onCrossTabFeatureFlagChange(e){return this._crossTabFeatureFlagHandlers.add(e),()=>this._crossTabFeatureFlagHandlers.delete(e)}destroy(){this._onStorage&&l&&(l.removeEventListener("storage",this._onStorage),this._onStorage=void 0),this._crossTabFeatureFlagHandlers.clear()}_syncCrossTabFeatureFlagProperties(e,t,i){if(void 0===i&&(i=!0),this._disabled)return!1;var s,r;try{if(r=ks._get(e),St(r)){var n=this._slotWriteState(t);return n.storageValue=null,t!==br?n.persisted=!1:this._mergeMetaIdentifierProperties({}),!1}s=Ir(r)}catch(e){return!1}t===br&&this._mergeMetaIdentifierProperties(s);var o=t===br?s:ks._parse(this._name);if(o&&this._hasCrossTabFeatureFlagIdentityMismatch(o))return!1;var a=this._mergeCrossTabFeatureFlagProperties(s,t,i);return t===br&&this._splitStorage&&!Cr(this._partitionProps().main,s)||this._rememberCrossTabStorageFingerprint(s,t,!0,r),a}_hasCrossTabFeatureFlagIdentityMismatch(e){var t=this.props[V],i=e[V];return!yt(t)&&!yt(i)&&t!==i}_rememberCrossTabStorageFingerprint(e,t,i,s){var r=this._slotWriteState(t);r.storageValue=s,t!==br&&(r.persisted=i);try{r.fingerprint=this._entryFingerprint(e,t)}catch(e){r.fingerprint=void 0}}_mergeCrossTabFeatureFlagProperties(e,t,i){var s=!1;return wr.forEach(i=>{var r,n=null==(r=Xs(i))?void 0:r.storageGroup;if(!(t===br&&this._splitStorage&&n||t!==br&&n!==t)){var o=i in e,a=this._mergePendingCrossTabFeatureFlagChanges(i,o?e[i]:void 0),l=this._pendingCrossTabFeatureFlagChanges.has(i)?i in this.props:o;l===i in this.props&&Cr(a,this.props[i])||(l?this._setProp(i,a,!1):this._deleteProp(i,!1),s=!0)}}),s&&i&&this._crossTabFeatureFlagHandlers.forEach(e=>e()),s}_mergeMetaIdentifierProperties(e){var t=this._storesIdentityInCookie&&this._config.cookieWinsOnConflict?[...Is,...this._config.cookie_persisted_properties||[]]:[];Pr.forEach(i=>{this._metaIdentifierChangePending.has(i)||-1!==t.indexOf(i)||(i in e?Cr(e[i],this.props[i])||this._setProp(i,e[i],!1):i in this.props&&this._deleteProp(i,!1))})}_metaIdentifierCookieSyncEnabled(){return this._storesIdentityInCookie&&this._splitStorageEligible&&!this._config.cookieWinsOnConflict}_adoptMetaIdentifiersFromCookie(){if(this._metaIdentifierCookieSyncEnabled()){var e;try{e=Ss._get(this._name)||void 0}catch(e){return}if(e&&e!==this._lastSeenMetaIdentifierCookieValue){var t;this._lastSeenMetaIdentifierCookieValue=e;try{t=Ts(JSON.parse(e))}catch(e){return}Pr.forEach(e=>{!(e in t)||e in this.props||this._metaIdentifierChangePending.has(e)||this._setProp(e,t[e],!1)})}}}_rememberMetaIdentifierCookieValue(e){if(this._metaIdentifierCookieSyncEnabled())try{var t=JSON.stringify($s(e,this._config.cookie_persisted_properties||[])),i=Ss._get(this._name)||void 0;i===t&&(this._lastSeenMetaIdentifierCookieValue=i)}catch(e){}}_reconcileCrossTabFeatureFlagPropertiesBeforeWrite(){if(!this._splitStorageEligible)return!1;try{this._crossTabFeatureFlagIdentityMismatch=!1;var e,t=ks._get(this._name),i=this._slotWriteState(br),s=!1,r=!1;if(t!==i.storageValue)if(St(t))bt(i.storageValue)&&this._mergeMetaIdentifierProperties({}),i.storageValue=null;else{if(e=Ir(t),this._mergeMetaIdentifierProperties(e),this._crossTabFeatureFlagIdentityMismatch=!this._localIdentityChangePending&&this._hasCrossTabFeatureFlagIdentityMismatch(e),this._crossTabFeatureFlagIdentityMismatch)return!1;r=this._mergeCrossTabFeatureFlagProperties(e,br,!1),!this._splitStorage||Cr(this._partitionProps().main,e)?this._rememberCrossTabStorageFingerprint(e,br,!0,t):i.storageValue=t,s=!0}return this._splitStorage&&Js.forEach(t=>{var i=ks._get(this._groupEntryName(t)),n=this._slotWriteState(t),o=e||{},a=s&&wr.some(e=>{var i;return(null==(i=Xs(e))?void 0:i.storageGroup)===t&&e in o});if(i!==n.storageValue||a){if(St(i))return n.storageValue=null,n.persisted=!1,void(a&&(r=this._mergeCrossTabFeatureFlagProperties(o,t,!1)||r));var l=Ir(i);r=this._mergeCrossTabFeatureFlagProperties(l,t,!1)||r,this._rememberCrossTabStorageFingerprint(l,t,!0,i)}}),r}catch(e){return!1}}_setCrossTabFeatureFlagChangesPending(e,t){this._pendingCrossTabFeatureFlagChanges.set(e,t);var i=Xs(e);null!=i&&i.volatile||(this._slotWriteState((this._splitStorage?null==i?void 0:i.storageGroup:void 0)||br).fingerprint=void 0,this._markGroupDirty(e))}_markAllCrossTabFeatureFlagChangesPending(){wr.forEach(e=>this._pendingCrossTabFeatureFlagChanges.set(e,!0))}_markLoadedCrossTabFeatureFlagChangesPending(){if(this._splitStorageEligible)try{var e=ks._get(this._name),t=Ir(e);this._slotWriteState(br).storageValue=e,wr.forEach(e=>{var i,s=this._splitStorage?null==(i=Xs(e))?void 0:i.storageGroup:void 0,r=s?ks._get(this._groupEntryName(s)):null;if(s){var n=this._slotWriteState(s);n.storageValue=r,n.persisted=!St(r)}var o=s&&!St(r)?Ir(r):t;e in this.props?this._markPendingCrossTabFeatureFlagChanges(e,o[e],this.props[e]):e in o&&this._setCrossTabFeatureFlagChangesPending(e,!0)})}catch(e){}}_mergePendingCrossTabFeatureFlagChanges(e,t){var s=this._pendingCrossTabFeatureFlagChanges.get(e);if(!s)return t;if(!0===s)return this.props[e];if("$active_feature_flags"===e){var r=new Set(gt(t)?t:[]),n=new Set(gt(this.props[e])?this.props[e]:[]);return s.forEach(e=>n.has(e)?r.add(e):r.delete(e)),Array.from(r)}var o=ft(t)?i({},t):{},a=ft(this.props[e])?this.props[e]:{};return s.forEach(e=>{e in a?o[e]=a[e]:delete o[e]}),o}_markPendingCrossTabFeatureFlagChanges(e,t,i){if(Sr(e)){var s=this._pendingCrossTabFeatureFlagChanges.get(e);if(!0!==s){var r=t;if(this._splitStorageEligible)try{var n,o=this._splitStorage?null==(n=Xs(e))?void 0:n.storageGroup:void 0,a=o?this._groupEntryName(o):this._name;r=Ir(ks._get(a))[e]}catch(e){}var l=new Set(s||[]);if("$active_feature_flags"===e){if(!yt(t)&&!gt(t)||!yt(r)&&!gt(r)||!gt(i))return void this._setCrossTabFeatureFlagChangesPending(e,!0);var d=new Set(t||[]),u=new Set(r||[]),_=new Set(i);new Set([...d,..._]).forEach(e=>{d.has(e)!==_.has(e)&&l.add(e)}),l.forEach(e=>{u.has(e)===_.has(e)&&l.delete(e)})}else{if(!ft(i))return void(Cr(r,i)?this._pendingCrossTabFeatureFlagChanges.delete(e):this._setCrossTabFeatureFlagChangesPending(e,!0));if(!yt(t)&&!ft(t)||yt(t)&&mt(i)&&yt(r))return void this._setCrossTabFeatureFlagChangesPending(e,!0);var c=ft(t)?t:{},h=ft(r)?r:{};new Set([...Object.keys(c),...Object.keys(i)]).forEach(e=>{e in c==e in i&&Cr(c[e],i[e])||l.add(e)}),l.forEach(e=>{e in h==e in i&&Cr(h[e],i[e])&&l.delete(e)})}l.size?this._setCrossTabFeatureFlagChangesPending(e,l):this._pendingCrossTabFeatureFlagChanges.delete(e)}}}_saveDebounceMs(){var e,t=null==(e=this._config)?void 0:e.persistence_save_debounce_ms;return kt(t)&&t>0?t:0}_rememberCurrentCookieProperties(e){if(this._config.cookieWinsOnConflict&&"localstorage+cookie"===this._config.persistence.toLowerCase())if(e)try{var t=$s(e,this._config.cookie_persisted_properties||[]),i=Rs(t,this._config.cookie_persisted_properties||[]),s=JSON.stringify(t)+"|"+JSON.stringify(i),r=Ss._get(this._name)||void 0;r&&Ms(this._name,r)===s&&(this._lastSeenCookiePropertiesFingerprint=s,this._lastSeenMainCookieValue=r)}catch(e){}else try{var n=Ss._get(this._name)||void 0;this._lastSeenCookiePropertiesFingerprint=n?Ms(this._name,n):void 0,this._lastSeenMainCookieValue=n}catch(e){}}syncCookieProperties(){return this._syncCookieProperties(this._config)}_syncCookieProperties(e,t){if(void 0===t&&(t=!1),this._disabled&&!t||this._cookieSyncSuppressed||!e.cookieWinsOnConflict||"localstorage+cookie"!==e.persistence.toLowerCase())return!1;var i;try{i=Ss._get(this._name)||void 0}catch(e){}if(!i||i===this._lastSeenMainCookieValue)return!1;var s,r=Ms(this._name,i);try{s=Ts(JSON.parse(i))}catch(e){return!1}if((Ss._get(this._name)||void 0)!==i)return!1;this._lastSeenCookiePropertiesFingerprint=r,this._lastSeenMainCookieValue=i;var n=Os(this._name,i),o=[...Is,...n.properties],a={};if(Object.keys(s).forEach(e=>{var t=s[e];(yt(t)||St(t)||""===t||"$user_state"===e&&"anonymous"!==t&&"identified"!==t)&&(a[e]=!0,delete s[e])}),mt(s))return!1;var l="distinct_id"in s||"anonymous"===s.$user_state||"identified"===s.$user_state,d=this.props,u=d[V],_=d[Re],c=ss({},d);[...Is,...e.cookie_persisted_properties||[]].forEach(e=>{if(-1!==o.indexOf(e)&&!(e in s)&&!a[e]&&(l||"distinct_id"!==e&&"$user_state"!==e)){var t=c[e];(n.isValid||-1===Is.indexOf(e)||!1!==t&&0!==t)&&delete c[e]}}),this.props=ss(c,s),wr.forEach(e=>{var t=e in this.props;e in d===t&&Cr(d[e],this.props[e])||(t?this._markPendingCrossTabFeatureFlagChanges(e,d[e],this.props[e]):this._setCrossTabFeatureFlagChangesPending(e,!0))}),!l||"$user_state"in s||"$user_state"in this.props||this._setProp(Re,Ze);var h=this.props[V],p=this.props[Re];return!l||h===u&&p===_||(this._localIdentityChangePending=!0,this._cookieIdentityChangePending=!0,Ns._set(mr(this._name),!0),this._deleteProp(F),this._deleteProp(S),this._deleteProp(x),this._deleteProp(P),this._deleteProp(M),this._deleteProp(I),this._deleteProp(C),this._deleteProp(k),this._deleteProp(R),"anonymous"!==p||"identified"!==_&&"anonymous"!==s.$user_state&&(yt(u)||h===u)||(Er(this.props,s),this._deleteProp(T)),"identified"===p?this.props.$user_id=h:delete this.props.$user_id,this._deleteProp(K)),!0}consumeCookieIdentityChange(){var e=mr(this._name),t=this._cookieIdentityChangePending||!!Ns._get(e);return this._cookieIdentityChangePending=!1,t&&Ns._remove(e),t}_beginCookieSyncSuppression(e){return void 0===e&&(e=!1),!(this._cookieSyncSuppressed||this._disabled&&!e||!this._config.cookieWinsOnConflict||"localstorage+cookie"!==this._config.persistence.toLowerCase()||(this._cookieSyncSuppressed=!0,0))}_publishSuppressedCookieSnapshot(){this._cookieSyncSuppressed&&(yt(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0),delete this._slotState[br],this._writeNow(!0))}_endCookieSyncSuppression(e){if(void 0===e&&(e=!0),this._cookieSyncSuppressed)try{e?this._publishSuppressedCookieSnapshot():yt(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0)}finally{this._cookieSyncSuppressed=!1}}isDisabled(){return!!this._disabled}_buildStorage(e){-1===fr.indexOf(e.persistence.toLowerCase())&&(Zi.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t,s=function(e,t,s){void 0===e&&(e=[]),void 0===t&&(t=!1),void 0===s&&(s=()=>!1);var r=[...Is,...e];return i({},ks,{_parse(e){try{var i,n={};try{i=Ss._get(e)||void 0,n=i?Ts(JSON.parse(i)):{}}catch(e){}var o,a=JSON.parse(ks._get(e)||"{}");if(t){var l=Os(e,i),d=[...Is,...l.properties],u={};Object.keys(n).forEach(e=>{var t=n[e];St(t)||""===t||"$user_state"===e&&"anonymous"!==t&&"identified"!==t||(u[e]=t)});var _="distinct_id"in u||"anonymous"===u.$user_state||"identified"===u.$user_state;if(Object.keys(u).length>0){var c,h=a[V],p=null!==(c=a.$user_state)&&void 0!==c?c:"anonymous";r.forEach(e=>{if(-1!==d.indexOf(e)&&!(e in n)&&(_||"distinct_id"!==e&&"$user_state"!==e)){var t=a[e];(l.isValid||-1===Is.indexOf(e)||!1!==t&&0!==t)&&delete a[e]}}),!_||"$user_state"in n||"$user_state"in a||(a[Re]=Ze),!_||("distinct_id"in u?u[V]:a[V])===h&&("$user_state"in u?u[Re]:a[Re])===p||(Cs.forEach(e=>delete a[e]),"identified"===u.$user_state&&"distinct_id"in u?a.$user_id=u[V]:delete a.$user_id,"identified"!==u.$user_state&&(delete a[ke],delete a[T]),delete a.__alias)}o=ss(a,u)}else o=ss(n,a);return s()||ks._set(e,o),o}catch(e){}return null},_set(i,s,r,n,o,a){var l=ks._set(i,s,void 0,void 0,a);try{var d=$s(s,e);if(Object.keys(d).length){if(t){var u=Es(i),_=Rs(d,e);if(Ss._set(u,_,r,n,o,a),Ss._get(u)!==JSON.stringify(_)){Ss._remove(u,n);var c=$s(s);return Ss._set(i,c,r,n,o,a),l}}Ss._set(i,d,r,n,o,a)}}catch(e){ks._error(e)}return l},_remove(e,t){try{null==l||l.localStorage.removeItem(e),Ss._remove(e,t),Ss._remove(Es(e),t)}catch(e){ks._error(e)}}})}(e.cookie_persisted_properties||[],e.cookieWinsOnConflict,()=>!!this._disabled),r=!1,n=!1,o=e.persistence.toLowerCase();return"localstorage"===o&&ks._is_supported()?(t=ks,n=!0):"localstorage+cookie"===o&&s._is_supported()?(t=s,n=!0,r=!0):"sessionstorage"===o&&Ns._is_supported()?t=Ns:"memory"===o?t=Ds:"cookie"===o&&Ss._is_supported()?(t=Ss,r=!0):s._is_supported()?(t=s,n=!0,r=!0):Ss._is_supported()?(t=Ss,r=!0):t=Ds,this._splitStorageEligible=n,this._storesIdentityInCookie=r,t}_groupEntryName(e){return this._name+"__"+e}_resolveSplitStorage(e){return this._splitStorageEligible&&!!e.split_storage}properties(){var e={};return is(this.props,(t,i)=>{var s=Xs(i);if(!s||"event"===s.exposure){if(null!=s&&null!=s.shouldSkipFromEventProperties&&s.shouldSkipFromEventProperties(t))return;e[i]=t}}),e}load(e){if(void 0===e&&(e=!1),!this._disabled||e){var t=this._config.cookieWinsOnConflict&&"localstorage+cookie"===this._config.persistence.toLowerCase(),i=t?ks._parse(this._name):null,s={};if(t)try{is(s=Ts(Ss._parse(this._name)),(e,t)=>{(yt(e)||St(e)||""===e)&&delete s[t]})}catch(e){}var r=this._storage._parse(this._name);if(r&&(this.props=ss({},r)),this._splitStorage&&this._loadGroupEntries(),t&&r){var n,o,a=null==i?void 0:i[V],l=null!==(n=null==i?void 0:i.$user_state)&&void 0!==n?n:"anonymous",d=r[V],u=null!==(o=r.$user_state)&&void 0!==o?o:"anonymous";if(d!==a||u!==l){this._cookieIdentityChangePending=!0,this._disabled||Ns._set(mr(this._name),!0);var _=ss({},this.props);Cs.forEach(e=>delete _[e]),"anonymous"!==u||"identified"!==l&&"anonymous"!==s.$user_state&&(yt(a)||d===a)||(Er(_,s),delete _[T]),this.props=_;var c=new Set;Cs.forEach(e=>{var t,i=null==(t=Xs(e))?void 0:t.storageGroup;i&&c.add(i)}),c.forEach(e=>{if(!this._disabled){var t={};is(this.props,(i,s)=>{var r;(null==(r=Xs(s))?void 0:r.storageGroup)===e&&(t[s]=i)}),mt(t)?(ks._remove(this._groupEntryName(e)),this._slotState[e]={}):ks._set(this._groupEntryName(e),t)&&(this._slotState[e]={persisted:!0,fingerprint:this._entryFingerprint(t,e)})}})}}Ns._get(mr(this._name))&&(this._cookieIdentityChangePending=!0)}}_loadGroupEntries(){for(var e of Js){var t=ks._parse(this._groupEntryName(e));if(t&&!mt(t)){var i=this._slotWriteState(e);i.persisted=!0,this._mainCarriesGroupKey(e)||(i.fingerprint=this._entryFingerprint(t,e)),this._groupEntryIsStale(e,t)||ss(this.props,t)}}}_mainCarriesGroupKey(e){return Object.keys(this.props).some(t=>{var i;return(null==(i=Xs(t))?void 0:i.storageGroup)===e})}_groupEntryIsStale(e,t){var i=vr[e];if(!i)return!1;var s=t[i],r=this.props[i];return kt(s)&&kt(r)&&r>s}refreshKey(e){this._refreshKeys([e])}_refreshKeys(e){if(!this._disabled){var t,i=!1,s=()=>(i||(t=this._storage._parse(this._name),i=!0),t);e.forEach(e=>{var t;if(!this._metaIdentifierChangePending.has(e)){var i=this._splitStorage?null==(t=Xs(e))?void 0:t.storageGroup:void 0,r=i?ks._parse(this._groupEntryName(i)):s();if(r&&e in r)this._setProp(e,r[e],!1);else{if(i){var n=s();if(n&&e in n)return void this._setProp(e,n[e],!1)}this._deleteProp(e,!1)}}})}}refreshMetaIdentifiers(){this._disabled||(this._usesMetaIdentifierSnapshotRefresh()?this._refreshMetaIdentifiersIfStorageChanged():this._refreshKeys(Pr))}_refreshMetaIdentifiersIfStorageChanged(){var e=this._storageSnapshot();(yt(e)||e!==this._metaIdentifierStorageSnapshot)&&(this._refreshKeys(Pr),this._rememberMetaIdentifierStorageSnapshot(e))}_rememberMetaIdentifierStorageSnapshot(e){void 0===e&&(e=this._storageSnapshot()),this._metaIdentifierStorageSnapshot=0===this._metaIdentifierChangePending.size?e:void 0}refreshMetaIdentifiersBeforeCapture(){this._disabled||this._cookieSyncSuppressed||(this._usesMetaIdentifierSnapshotRefresh()||this._adoptMetaIdentifiersFromCookie(),this._refreshMetaIdentifiersIfStorageChanged())}_usesMetaIdentifierSnapshotRefresh(){return this._storage===Ss||this._storage===Ns||this._storage===Ds}_storageSnapshot(){var e=this._storage._get(this._name);return bt(e)?e:void 0}save(){if(!this._disabled){var e=this._saveDebounceMs();e>0?yt(this._pendingSaveTimer)&&(this._pendingSaveTimer=setTimeout(()=>{this._pendingSaveTimer=void 0,this._writeNow()},e)):this._writeNow()}}flush(){yt(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0,this._writeNow())}_writeNow(e){if(void 0===e&&(e=!1),!(this._disabled||this._cookieSyncSuppressed&&!e)){e||(this.syncCookieProperties(),this._usesMetaIdentifierSnapshotRefresh()&&this.refreshMetaIdentifiers());var t=!e&&!this._storageMigrationInProgress;t||(this._crossTabFeatureFlagIdentityMismatch=!1);var i=!!t&&this._reconcileCrossTabFeatureFlagPropertiesBeforeWrite();if(this._crossTabFeatureFlagIdentityMismatch)this._config.debug&&Zi.warn("skipping persistence write because storage belongs to a different distinct ID");else{if(e||this._adoptMetaIdentifiersFromCookie(),this._splitStorage)return this._writeNowSplit(),void(i&&this._crossTabFeatureFlagHandlers.forEach(e=>e()));var s=this._writeEntry(this._storage,this._name,this.props,br);"written"===s&&(this._rememberCurrentCookieProperties(this.props),this._rememberMetaIdentifierCookieValue(this.props)),"failed"!==s&&(this._pendingCrossTabFeatureFlagChanges.clear(),this._localIdentityChangePending=!1,this._metaIdentifierChangePending.clear()),"written"===s&&this._rememberMetaIdentifierStorageSnapshot(),i&&this._crossTabFeatureFlagHandlers.forEach(e=>e())}}}_writeNowSplit(){var e=this,t=this._partitionProps(),i=t.main,s=t.groups,r=this._writeEntry(this._storage,this._name,i,br);"written"===r&&(this._rememberCurrentCookieProperties(i),this._rememberMetaIdentifierCookieValue(i)),"failed"!==r&&(this._localIdentityChangePending=!1,this._metaIdentifierChangePending.clear(),wr.forEach(e=>{var t;null!=(t=Xs(e))&&t.storageGroup||this._pendingCrossTabFeatureFlagChanges.delete(e)})),"written"===r&&this._rememberMetaIdentifierStorageSnapshot();var n=function(t){var i,r=s[t];if(mt(r)&&(null==(i=e._slotState[t])||!i.persisted))return wr.forEach(i=>{var s;(null==(s=Xs(i))?void 0:s.storageGroup)===t&&e._pendingCrossTabFeatureFlagChanges.delete(i)}),1;var n=e._writeEntry(ks,e._groupEntryName(t),r,t);"failed"!==n&&wr.forEach(i=>{var s=Xs(i);(null==s?void 0:s.storageGroup)!==t||"written"!==n&&s.volatile||e._pendingCrossTabFeatureFlagChanges.delete(i)})};for(var o of Js)if(n(o))continue}_partitionProps(){var e={},t={flags:{},surveys:{}};return is(this.props,(i,s)=>{var r,n=null==(r=Xs(s))?void 0:r.storageGroup;n?t[n][s]=i:e[s]=i}),{main:e,groups:t}}_entryFingerprint(e,t){if(t===br)return JSON.stringify(e)+"|"+this._expire_days+"|"+this._cross_subdomain+"|"+this._secure;var i={};return is(e,(e,t)=>{var s;i[t]=null!=(s=Xs(t))&&s.volatile?"__volatile__":e}),JSON.stringify(i)}_writeEntry(e,t,i,s){var r,n=this._slotWriteState(s);if(s!==br&&!n.dirty&&!yt(n.fingerprint))return"skipped";try{if((r=this._entryFingerprint(i,s))===n.fingerprint)return n.dirty=!1,"skipped"}catch(e){r=void 0}return e._set(t,i,this._expire_days,this._cross_subdomain,this._secure,this._config.debug)?(n.dirty=!1,s!==br&&(n.persisted=!0),yt(r)||(n.fingerprint=r),this._splitStorageEligible&&(n.storageValue=ks._get(t)),"written"):(this._config.debug&&Zi.warn('failed to persist storage entry "'+t+'"; will retry on next save'),"failed")}remove(e){var t=(void 0===e?{}:e).keepGroupEntries,i=void 0!==t&&t;if(this._markAllCrossTabFeatureFlagChangesPending(),yt(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0),this._storage._remove(this._name,!1),this._storage._remove(this._name,!0),!i&&this._ownsSplitStorage)for(var s of Js)ks._remove(this._groupEntryName(s));i?delete this._slotState[br]:this._slotState={},this._lastSeenCookiePropertiesFingerprint=void 0,this._lastSeenMainCookieValue=void 0,this._lastSeenMetaIdentifierCookieValue=void 0}clear(){this.remove(),this.props={}}register_once(e,t,i){if(ft(e)){this.syncCookieProperties(),yt(t)&&(t="None"),this._expire_days=yt(i)?this._default_expiry:i;var s=!1;if(is(e,(e,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==t||(this._setProp(i,e),s=!0)}),s)return this.save(),!0}return!1}register(e,t){if(ft(e)){this.syncCookieProperties(),this._expire_days=yt(t)?this._default_expiry:t;var i=!1;if(is(e,(t,s)=>{e.hasOwnProperty(s)&&(this.props[s]!==t||ft(t)||gt(t))&&(this._setProp(s,t),i=!0)}),i)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();var t="string"==typeof e?[e]:e,i=!1;for(var s of t)s in this.props&&(this._deleteProp(s),i=!0);i&&this.save()}update_campaign_params(){var e=null==_?void 0:_.URL;if(e!==this._campaign_params_url){var t=function(e,t,i){if(!_)return{};var s,r=t?[...rr,...i||[]]:[],n=lr(sr(_.URL,r,or),e);return ss((s={},is(ar,function(e){var t=cs(e);s[e]=t||null}),s),n)}(this._config.custom_campaign_params,this._config.mask_personal_data_properties,this._config.custom_personal_data_properties),i=!mt(ns(t));return i&&this.register(t),this._campaign_params_url=e,i?t:void 0}}update_search_keyword(){var e;this.register((e=null==_?void 0:_.referrer)?dr(e):{})}update_referrer_info(){var e;this.register_once({$referrer:cr(),$referring_domain:null!=_&&_.referrer&&(null==(e=er(_.referrer))?void 0:e.host)||_r},void 0)}set_initial_person_info(){if(!this.props.$initial_campaign_params&&!this.props.$initial_referrer_info){var e=hr(this._config.mask_personal_data_properties,this._config.custom_personal_data_properties,this._config.disable_capture_url_hashes);this.register_once({[Le]:this._storesIdentityInCookie?{r:yr(e.r),u:e.u?yr(e.u):void 0}:e},void 0)}}get_initial_props(){var e={};is([De,Ae],t=>{var i=this.props[t];i&&is(i,function(t,i){e["$initial_"+_t(i)]=t})});var t=this.props[Le];return t&&ss(e,function(e,t){void 0===t&&(t=!1);var i=pr(e,t),s={};return is(i,function(e,t){s["$initial_"+_t(t)]=e}),s}(t,this._config.disable_capture_url_hashes)),e}safe_merge(e){return is(this.props,function(t,i){i in e||(e[i]=t)}),e}update_config(e,t,s){var r=e.persistence!==t.persistence,n=!((e,t)=>{if(e.length!==t.length)return!1;var i=[...e].sort(),s=[...t].sort();return i.every((e,t)=>e===s[t])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),o=r||n,a=e.cookieWinsOnConflict!==t.cookieWinsOnConflict,l=e.disable_persistence||!!s,d=!!this._disabled&&!l;l||this._syncCookieProperties(t,d),this._config=e,!l&&(r||n||a)&&(this._lastSeenCookiePropertiesFingerprint=void 0,this._lastSeenMainCookieValue=void 0,this._lastSeenMetaIdentifierCookieValue=void 0,this._syncCookieProperties(i({},e,{cookie_persisted_properties:t.cookie_persisted_properties}),d));var u=o||a?this._buildStorage(e):this._storage;this._truncateExistingPersonInfoForCookie();var _=this._resolveSplitStorage(e),c=o||_!==this._splitStorage,h=!l&&(c||e.cross_subdomain_cookie!==this._cross_subdomain||e.secure_cookie!==this._secure)&&this._beginCookieSyncSuppression(d);this._storageMigrationInProgress=c;try{if(this._default_expiry=this._expire_days=e.cookie_expiration,this.set_disabled(l),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),c){var p=this.props;this.clear(),this._storage=u,this._splitStorage=_,this.props=p,this.save()}else a&&(this._storage=u,l||(delete this._slotState[br],this._writeNow()))}finally{this._storageMigrationInProgress=!1,h&&this._endCookieSyncSuppression()}}_truncateExistingPersonInfoForCookie(){var e=this.props[Le];if(this._storesIdentityInCookie&&ft(e)&&"string"==typeof e.r){var t=yr(e.r),s="string"==typeof e.u?yr(e.u):e.u;t===e.r&&s===e.u||this._setProp(Le,i({},e,{r:t,u:s}))}}set_disabled(e){this._disabled=e,this._disabled?this.remove():this.save()}set_cross_subdomain(e){e!==this._cross_subdomain&&(this._cross_subdomain=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this._secure&&(this._secure=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){var i=this.props.__timers||{};i[e]=t,this._setProp(ee,i),this.save()}remove_event_timer(e){var t=this.props.__timers||{},i=t[e];return yt(i)||(delete t[e],this._setProp(ee,t),this.save()),i}get_property(e){return this.props[e]}set_property(e,t){this._setProp(e,t),this.save()}_setProp(e,t,i){var s;void 0===i&&(i=!0);var r=this.props[e];this.props[e]=t,i&&("distinct_id"!==e&&"$user_state"!==e||r===t||(this._localIdentityChangePending=!0),kr(e)&&!Cr(r,t)&&this._metaIdentifierChangePending.add(e),this._markPendingCrossTabFeatureFlagChanges(e,r,t),null!=(s=Xs(e))&&s.volatile||this._markGroupDirty(e))}_deleteProp(e,t){void 0===t&&(t=!0),delete this.props[e],t&&(Sr(e)&&this._setCrossTabFeatureFlagChangesPending(e,!0),kr(e)&&this._metaIdentifierChangePending.add(e),this._markGroupDirty(e))}_markGroupDirty(e){var t,i=null==(t=Xs(e))?void 0:t.storageGroup;i&&(this._slotWriteState(i).dirty=!0)}_slotWriteState(e){return this._slotState[e]||(this._slotState[e]={})}},Tr={GZipJS:"gzip-js",Base64:"base64"},$r={Activation:"events",Cancellation:"cancelEvents"},Fr={Button:"button",Tab:"tab",Selector:"selector"},Rr={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"},Or={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},Mr={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},Ar={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},Dr={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},Lr={Once:"once",Recurring:"recurring",Always:"always"},Nr={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Br={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"},Ur={Popover:"popover",Inline:"inline"};function qr(e){var t=!0;return{dispose(){if(t){t=!1;var i=e();i&&vt(i.then)&&i.then(void 0,()=>{})}}}}var Hr={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},Gr={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"},Wr={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"},Vr=es("[RateLimiter]"),jr=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach(e=>{Vr.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4})}catch(e){return void Vr.warn('could not rate limit - continuing. Error: "'+(null==e?void 0:e.message)+'"',{text:t})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return(null==(e=this.instance.config.rate_limiting)?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max((null==(e=this.instance.config.rate_limiting)?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}get isClientRateLimited(){return 1>this._refilledBucket().tokens}clientRateLimitContext(e){var t;void 0===e&&(e=!1);var i=this._refilledBucket(),s=1>i.tokens;if(s||e||(i.tokens=Math.max(0,i.tokens-1)),s&&!e){var r=(kt(i.dropped)?i.dropped:0)+1;i.dropped=r,!this.lastEventRateLimited&&this._captureWarning(r)&&(i.dropped=0)}return this.lastEventRateLimited=s,null==(t=this.instance.persistence)||t.set_property(Me,i),{isRateLimited:s,remainingTokens:i.tokens}}_refilledBucket(){var e,t=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,r=(new Date).getTime(),n=null==(e=this.instance.persistence)?void 0:e.get_property(Me),o=n?i({},n):{tokens:t,last:r};return o.tokens+=Math.max(0,r-o.last)/1e3*s,o.last=Math.max(o.last,r),o.tokens>t&&(o.tokens=t),o}_isPropertyAllowed(e){var t=this.instance.config.property_denylist;return!gt(t)||!t.includes(e)}_triggeringPage(){var e;if(this._isPropertyAllowed("$current_url")&&this._isPropertyAllowed("$pathname")&&null!=c&&c.pathname)return""+(null!==(e=c.origin)&&void 0!==e?e:"")+c.pathname}_captureWarning(e){var t,i,s=this.captureEventsBurstLimit,r=this.captureEventsPerSecond,n=this._triggeringPage(),o=this._isPropertyAllowed("$session_id")?null==(t=(i=this.instance).get_session_id)?void 0:t.call(i):void 0,a=[e+" 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 "+r+" events per second and "+s+" events burst limit."},{skip_client_rate_limiting:!0})}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}},zr=es("[RemoteConfig]"),Kr=class{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=y._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}_loadRemoteConfigJs(e){var t=b(this._instance);t?t(this._instance,"remote-config",()=>e(this.remoteConfig)):e()}_loadRemoteConfigJSON(e){var t=this._instance.__pending_remote_config_callbacks;if(t)t.push(e);else{var i=[e];this._instance.__pending_remote_config_callbacks=i;try{this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),batchKey:"remote_config",fireCallbackOnDrop:!0,callback:e=>{this._instance.__pending_remote_config_callbacks=void 0,i.forEach(t=>t(e))}})}catch(e){throw this._instance.__pending_remote_config_callbacks=void 0,e}}}load(){try{if(this.remoteConfig)return zr.info("Using preloaded remote config",this.remoteConfig),void this._onRemoteConfig(this.remoteConfig);if(this._instance._shouldDisableFlags())return void zr.warn("Remote config is disabled. Falling back to local config.");if(!this._instance.config.opt_in_site_apps)return void this._loadRemoteConfigJSON(e=>{this._onRemoteConfig(e.json,e)});this._loadRemoteConfigJs(e=>{if(!e)return zr.info("No config found after loading remote JS config. Falling back to JSON."),void this._loadRemoteConfigJSON(e=>{this._onRemoteConfig(e.json,e)});this._onRemoteConfig(e)})}catch(e){zr.error("Error loading remote config",e),this._onRemoteConfig()}}_onRemoteConfig(e,t){!e&&t&&(0===t.statusCode?t.error||zr.warn("Failed to fetch remote config from PostHog."):zr.error("Failed to fetch remote config from PostHog."));try{this._instance._onRemoteConfig(e?{ok:!0,config:e}:{ok:!1})}catch(e){zr.error("Error applying remote config",e)}if(!1!==(null==e?void 0:e.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var i;null==(i=this._instance.featureFlags)||i.ensureFlagsLoaded()}catch(e){zr.error("Error loading feature flags",e)}}},Jr=["fatal","error","warning","log","info","debug"],Yr=Uint8Array,Qr=Uint16Array,Xr=Uint32Array,Zr=new Yr([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]),en=new Yr([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]),tn=new Yr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),sn=function(e,t){for(var i=new Qr(31),s=0;31>s;++s)i[s]=t+=1<<e[s-1];var r=new Xr(i[30]);for(s=1;30>s;++s)for(var n=i[s];i[s+1]>n;++n)r[n]=n-i[s]<<5|s;return[i,r]},rn=sn(Zr,2),nn=rn[1];rn[0][28]=258,nn[258]=28;for(var on=sn(en,0)[1],an=new Qr(32768),ln=0;32768>ln;++ln){var dn=(43690&ln)>>>1|(21845&ln)<<1;an[ln]=((65280&(dn=(61680&(dn=(52428&dn)>>>2|(13107&dn)<<2))>>>4|(3855&dn)<<4))>>>8|(255&dn)<<8)>>>1}var un=function(e,t,i){for(var s=e.length,r=0,n=new Qr(t);s>r;++r)++n[e[r]-1];var o,a=new Qr(t);for(r=0;t>r;++r)a[r]=a[r-1]+n[r-1]<<1;if(i){o=new Qr(1<<t);var l=15-t;for(r=0;s>r;++r)if(e[r])for(var d=r<<4|e[r],u=t-e[r],_=a[e[r]-1]++<<u,c=_|(1<<u)-1;c>=_;++_)o[an[_]>>>l]=d}else for(o=new Qr(s),r=0;s>r;++r)o[r]=an[a[e[r]-1]++]>>>15-e[r];return o},_n=new Yr(288);for(ln=0;144>ln;++ln)_n[ln]=8;for(ln=144;256>ln;++ln)_n[ln]=9;for(ln=256;280>ln;++ln)_n[ln]=7;for(ln=280;288>ln;++ln)_n[ln]=8;var cn=new Yr(32);for(ln=0;32>ln;++ln)cn[ln]=5;var hn=un(_n,9,0),pn=un(cn,5,0),gn=function(e){return(e/8|0)+(7&e&&1)},vn=function(e,t,i){(null==t||0>t)&&(t=0),(null==i||i>e.length)&&(i=e.length);var s=new(e instanceof Qr?Qr:e instanceof Xr?Xr:Yr)(i-t);return s.set(e.subarray(t,i)),s},fn=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8},mn=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8,e[s+2]|=i>>>16},yn=function(e,t){for(var i=[],s=0;e.length>s;++s)e[s]&&i.push({s:s,f:e[s]});var r=i.length,n=i.slice();if(!r)return[new Yr(0),0];if(1==r){var o=new Yr(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort(function(e,t){return e.f-t.f}),i.push({s:-1,f:25001});var a=i[0],l=i[1],d=0,u=1,_=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=r-1;)a=i[i[_].f>i[d].f?d++:_++],l=i[d!=u&&i[_].f>i[d].f?d++:_++],i[u++]={s:-1,f:a.f+l.f,l:a,r:l};var c=n[0].s;for(s=1;r>s;++s)n[s].s>c&&(c=n[s].s);var h=new Qr(c+1),p=bn(i[u-1],h,0);if(p>t){s=0;var g=0,v=p-t,f=1<<v;for(n.sort(function(e,t){return h[t.s]-h[e.s]||e.f-t.f});r>s;++s){var m=n[s].s;if(t>=h[m])break;g+=f-(1<<p-h[m]),h[m]=t}for(g>>>=v;g>0;){var y=n[s].s;t>h[y]?g-=1<<t-h[y]++-1:++s}for(;s>=0&&g;--s){var b=n[s].s;h[b]==t&&(--h[b],++g)}p=t}return[new Yr(h),p]},bn=function(e,t,i){return-1==e.s?Math.max(bn(e.l,t,i+1),bn(e.r,t,i+1)):t[e.s]=i},wn=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new Qr(++t),s=0,r=e[0],n=1,o=function(e){i[s++]=e},a=1;t>=a;++a)if(e[a]==r&&a!=t)++n;else{if(!r&&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(r),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(r);n=1,r=e[a]}return[i.subarray(0,s),t]},Sn=function(e,t){for(var i=0,s=0;t.length>s;++s)i+=e[s]*t[s];return i},Pn=function(e,t,i){var s=i.length,r=gn(t+2);e[r]=255&s,e[r+1]=s>>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var n=0;s>n;++n)e[r+n+4]=i[n];return 8*(r+4+s)},kn=function(e,t,i,s,r,n,o,a,l,d,u){fn(t,u++,i),++r[256];for(var _=yn(r,15),c=_[0],h=_[1],p=yn(n,15),g=p[0],v=p[1],f=wn(c),m=f[0],y=f[1],b=wn(g),w=b[0],S=b[1],P=new Qr(19),k=0;m.length>k;++k)P[31&m[k]]++;for(k=0;w.length>k;++k)P[31&w[k]]++;for(var C=yn(P,7),I=C[0],E=C[1],x=19;x>4&&!I[tn[x-1]];--x);var T,F,R,O,M=d+5<<3,A=Sn(r,_n)+Sn(n,cn)+o,D=Sn(r,c)+Sn(n,g)+o+14+3*x+Sn(P,I)+(2*P[16]+3*P[17]+7*P[18]);if(A>=M&&D>=M)return Pn(t,u,e.subarray(l,l+d));if(fn(t,u,1+(A>D)),u+=2,A>D){T=un(c,h,0),F=c,R=un(g,v,0),O=g;var L=un(I,E,0);for(fn(t,u,y-257),fn(t,u+5,S-1),fn(t,u+10,x-4),u+=14,k=0;x>k;++k)fn(t,u+3*k,I[tn[k]]);u+=3*x;for(var N=[m,w],B=0;2>B;++B){var U=N[B];for(k=0;U.length>k;++k)fn(t,u,L[q=31&U[k]]),u+=I[q],q>15&&(fn(t,u,U[k]>>>5&127),u+=U[k]>>>12)}}else T=hn,F=_n,R=pn,O=cn;for(k=0;a>k;++k)if(s[k]>255){var q;mn(t,u,T[257+(q=s[k]>>>18&31)]),u+=F[q+257],q>7&&(fn(t,u,s[k]>>>23&31),u+=Zr[q]);var H=31&s[k];mn(t,u,R[H]),u+=O[H],H>3&&(mn(t,u,s[k]>>>5&8191),u+=en[H])}else mn(t,u,T[s[k]]),u+=F[s[k]];return mn(t,u,T[256]),u+F[256]},Cn=new Xr([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),In=new Yr(0),En=function(){for(var e=new Xr(256),t=0;256>t;++t){for(var i=t,s=9;--s;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e}(),xn=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};function Tn(e,t){void 0===t&&(t={});var i=function(){var e=4294967295;return{p(t){for(var i=e,s=0;t.length>s;++s)i=En[255&i^t[s]]^i>>>8;e=i},d(){return 4294967295^e}}}(),s=e.length;i.p(e);var r,n,o,a,l,d,u=(a=10+((r=t).filename&&r.filename.length+1||0),l=8,function(e,t,i,s,r,n){var o=e.length,a=new Yr(s+o+5*(1+Math.floor(o/7e3))+r),l=a.subarray(s,a.length-r),d=0;if(!t||8>o)for(var u=0;o>=u;u+=65535){var _=u+65535;o>_?d=Pn(l,d,e.subarray(u,_)):(l[u]=n,d=Pn(l,d,e.subarray(u,o)))}else{for(var c=Cn[t-1],h=c>>>13,p=8191&c,g=(1<<i)-1,v=new Qr(32768),f=new Qr(g+1),m=Math.ceil(i/3),y=2*m,b=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<y)&g},w=new Xr(25e3),S=new Qr(288),P=new Qr(32),k=0,C=0,I=(u=0,0),E=0,x=0;o>u;++u){var T=b(u),F=32767&u,R=f[T];if(v[F]=R,f[T]=F,u>=E){var O=o-u;if((k>7e3||I>24576)&&O>423){d=kn(e,l,0,w,S,P,C,I,x,u-x,d),I=k=C=0,x=u;for(var M=0;286>M;++M)S[M]=0;for(M=0;30>M;++M)P[M]=0}var A=2,D=0,L=p,N=F-R&32767;if(O>2&&T==b(u-N))for(var B=Math.min(h,O)-1,U=Math.min(32767,u),q=Math.min(258,O);U>=N&&--L&&F!=R;){if(e[u+A]==e[u+A-N]){for(var H=0;q>H&&e[u+H]==e[u+H-N];++H);if(H>A){if(A=H,D=N,H>B)break;var G=Math.min(N,H-2),W=0;for(M=0;G>M;++M){var V=u-N+M+32768&32767,j=V-v[V]+32768&32767;j>W&&(W=j,R=V)}}}N+=(F=R)-(R=v[F])+32768&32767}if(D){w[I++]=268435456|nn[A]<<18|on[D];var z=31&nn[A],K=31&on[D];C+=Zr[z]+en[K],++S[257+z],++P[K],E=u+A,++k}else w[I++]=e[u],++S[e[u]]}}d=kn(e,l,n,w,S,P,C,I,x,u-x,d),n||(d=Pn(l,d,In))}return vn(a,0,s+gn(d)+r)}(n=e,null==(o=t).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,!d)),_=u.length;return function(e,t){var i=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=2>t.level?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&xn(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var s=0;i.length>=s;++s)e[s+10]=i.charCodeAt(s)}}(u,t),xn(u,_-8,i.d()),xn(u,_-4,s),u}var $n=!!p||!!h,Fn=new WeakMap,Rn="text/plain",On=0,Mn=!1,An=(e,t)=>{var i=e.split("#"),s=i[1],r=i[0].split("?"),n=r[0],o=r[1];if(!o)return e;var a=o.split("&").filter(e=>e.split("=")[0]!==t).join("&");return n+(a?"?"+a:"")+(s?"#"+s:"")},Dn=function(e,t,s){var r;void 0===s&&(s=!0);var n=e.split("?"),o=n[0],a=n[1],l=i({},t),d=null!==(r=null==a?void 0:a.split("&").map(e=>{var t,i=e.split("="),r=i[0],n=s&&null!==(t=l[r])&&void 0!==t?t:i[1];return delete l[r],r+"="+n}))&&void 0!==r?r:[],u=function(e,t){var i,s;void 0===t&&(t="&");var r=[];return is(e,function(e,t){yt(e)||yt(t)||"undefined"===t||(i=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),s=encodeURIComponent(t),r[r.length]=s+"="+i)}),r.join(t)}(l);return u&&d.push(u),d.length>0?o+"?"+d.join("&"):o},Ln=e=>{if(e._encodedBody)return e._encodedBody;var t=e.data,i=e.compression;if(t){if(i===Tr.GZipJS){var s=Tn(function(e){var t=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var i=new Yr(e.length+(e.length>>>1)),s=0,r=function(e){i[s++]=e},n=0;t>n;++n){if(s+5>i.length){var o=new Yr(s+8+(t-n<<1));o.set(i),i=o}var a=e.charCodeAt(n);128>a?r(a):2048>a?(r(192|a>>>6),r(128|63&a)):a>55295&&57344>a?(r(240|(a=65536+(1047552&a)|1023&e.charCodeAt(++n))>>>18),r(128|a>>>12&63),r(128|a>>>6&63),r(128|63&a)):(r(224|a>>>12),r(128|a>>>6&63),r(128|63&a))}return vn(i,0,s)}(tr(t)),{mtime:0});return{contentType:Rn,body:s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength),estimatedSize:s.byteLength}}if(i===Tr.Base64){var r=function(e){return e?btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16)))):e}(tr(t)),n="sendBeacon"===e.transport,o=n?r:(e=>"data="+encodeURIComponent("string"==typeof e?e:tr(e)))(r);return{contentType:n?Rn:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var a=tr(t);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},Nn=e=>{var t,s,r=()=>"sendBeacon"===e.transport?{url:Dn(e.url,{compression:Tr.Base64}),encodedBody:Ln(i({},e,{compression:Tr.Base64,_encodedBody:void 0}))}:{url:An(e.url,"compression"),encodedBody:Ln(i({},e,{compression:void 0,_encodedBody:void 0}))};try{t=Ln(e)}catch(t){if(Vi(e.compression,ir(e.url,"compression")))return Zi.error("Failed to gzip request body, sending uncompressed payload",t),r();throw t}return t&&Vi(e.compression,ir(e.url,"compression"))&&!((s=t.body)instanceof ArrayBuffer?Wi(new Uint8Array(s)):ArrayBuffer.isView(s)&&Wi(new Uint8Array(s.buffer,s.byteOffset,s.byteLength)))?(Mn=!0,r()):{url:e.url,encodedBody:t}},Bn=e=>{try{return Nn(e)}catch(t){return Zi.error(t),void(null==e.callback||e.callback({statusCode:0,error:t}))}},Un=function(){var e=r(function*(e){var t=yield function(e,t,i){return Qi.apply(this,arguments)}(tr(e.data),a.DEBUG,{rethrow:!0});if(!t)return e;var s=yield t.arrayBuffer();return i({},e,{_encodedBody:{contentType:Rn,body:s,estimatedSize:s.byteLength}})});return function(t){return e.apply(this,arguments)}}(),qn=e=>Bi("AbortError","PostHog request timed out"+(e?" after "+e+"ms":"")),Hn=/Failed to fetch|NetworkError|Load failed/i,Gn=e=>"TypeError"===(null==e?void 0:e.name)&&Hn.test((null==e?void 0:e.message)||""),Wn=e=>{try{var t=function(e,t,i){if(void 0===t&&(t=Date.now()),void 0===i&&(i=3e5),"string"==typeof e&&e){var s=e.trim(),r=/^\d+\s*,/.test(s)?s.slice(0,s.indexOf(",")).trim():s;if(/^\d+$/.test(r)){var n=1e3*Math.min(Number(r),i/1e3);return n>0?n:void 0}if(/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(r)){var o=/^\w{3} \w{3} /.test(r)?r+" GMT":r,a=Date.parse(o)-t;if(Number.isFinite(a)&&a>0)return Math.min(a,i)}}}(e());return yt(t)?void 0:Math.min(t,3e4)}catch(e){return}},Vn=e=>{var t=Bn(e);if(t){var i=new p;Fn.set(i,!0);var s=t.url,r=t.encodedBody;i.open(e.method||"GET",s,!0);var n=null!=r?r:{},o=n.contentType,a=n.body;is(e.headers,function(e,t){i.setRequestHeader(t,e)}),o&&i.setRequestHeader("Content-Type",o),e.timeout&&(i.timeout=e.timeout);var l=!1;i.ontimeout=()=>{l=!0},i.onloadend=()=>{if(l){var t=qn(e.timeout);return Zi.warn(t),void(null==e.callback||e.callback({statusCode:0,error:t}))}var s={statusCode:i.status,text:i.responseText};if(200===i.status)try{s.json=JSON.parse(i.responseText)}catch(e){}null==e.callback||e.callback(s,Wn(()=>i.getResponseHeader("Retry-After")))},null==e.onSend||e.onSend(s),i.send(a)}},jn=e=>{var t=Bn(e);if(t){var s=t.url,r=t.encodedBody,n=null!=r?r:{},o=n.contentType,a=n.body,l=n.estimatedSize,d=new Headers;is(e.headers,function(e,t){d.append(t,e)}),o&&d.append("Content-Type",o);var u=null,_=!1;if(g){var c=new g;u={signal:c.signal,timeout:setTimeout(()=>{_=!0;try{c.abort(qn(e.timeout))}catch(e){v(e)}},e.timeout)}}var p=!1,v=t=>{p||(p=!0,_&&"AbortError"===(null==t?void 0:t.name)||Gn(t)?Zi.warn(t):Zi.error(t),null==e.callback||e.callback({statusCode:0,error:t}))},f=0,m=()=>{On-=f,f=0,u&&clearTimeout(u.timeout)};try{var y,b=i({method:(null==e?void 0:e.method)||"GET",headers:d,referrerPolicy:"strict-origin",body:a,signal:null==(y=u)?void 0:y.signal},e.fetchOptions);null==e.onSend||e.onSend(s);var w=null!=l?l:yt(a)?0:void 0;b.keepalive="POST"===b.method&&!e._keepaliveDisabled&&!1!==b.keepalive&&b.body===a&&!yt(w)&&w>=0&&52428.8>On+w,b.keepalive&&(On+=f=w),h(s,b).then(t=>t.text().then(i=>{if(!p){var s={statusCode:t.status,text:i};if(200===t.status)try{s.json=JSON.parse(i)}catch(e){Zi.error(e)}p=!0,m(),null==e.callback||e.callback(s,Wn(()=>t.headers.get("Retry-After")))}})).catch(e=>{m(),v(e)}).finally(m)}catch(e){m(),v(e)}}},zn=e=>{try{var t,s=Nn(e),r=s.url,n=s.encodedBody,o=null!=n?n:{},a=o.body,l=o.estimatedSize;if(!a)return;var d=a instanceof Blob?a:new Blob([a],{type:o.contentType});if(u.sendBeacon(r,d))return;var _=gt(e.data)?e.data:null==(t=e.data)?void 0:t.batch;if(gt(_)&&_.length>1&&(null!=l?l:0)>16384){var c=Math.ceil(_.length/2),p=t=>gt(e.data)?t:i({},e.data,{batch:t});return zn(i({},e,{data:p(_.slice(0,c))})),void zn(i({},e,{data:p(_.slice(c))}))}Zi.warn("Beacon of ~"+(null!=l?l:0)+" bytes was rejected by the browser, falling back to "+(h?"fetch":"XHR")),h?jn(i({},e,{_keepaliveDisabled:!0})):Vn(e)}catch(e){Zi.warn("Beacon send failed",e)}},Kn=(e,t,s,r)=>{var n="query"===r?"POST"===t?"sent_at":"_":void 0;return Dn(s===Tr.GZipJS?An(e,"compression"):e,i({},n?{[n]:Date.now().toString()}:{},s===Tr.GZipJS?{}:{compression:s}))},Jn=(()=>{var e=[];return h&&e.push({transport:"fetch",method:jn}),p&&e.push({transport:"XHR",method:Vn}),null!=u&&u.sendBeacon&&e.push({transport:"sendBeacon",method:zn}),e})(),Yn=!$n&&-1===(null==f?void 0:f.indexOf("MSIE"))&&-1===(null==f?void 0:f.indexOf("Mozilla"));function Qn(e,t,s){var r;s&&(t=i({},t,{callback:e=>s(e)})),e.__loaded?Yn?e.__request_queue.push(t):e.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:429})):(t.transport=t.transport||e.config.api_transport,t.headers=i({},e.config.request_headers,t.headers),t.compression="best-available"===t.compression?null!==(r=e.compression)&&void 0!==r?r:t.compressionFallback:t.compression,(yt(e.config.disable_beacon)?e.config.__preview_disable_beacon:e.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||e.config.fetch_options,null==t.onDispatch||t.onDispatch(),((e,t)=>{var s,r,n,o=i({},e,{callback:null!=t?t:t=>null==e.callback?void 0:e.callback(t)});o.timeout=o.timeout||6e4;var a,l,d,u,_,c=null!==(s=o.transport)&&void 0!==s?s:"fetch";"sendBeacon"===c&&yt(o.compression)&&o.data&&(o.compression=Tr.Base64),"POST"===o.method&&o.data&&("capture-body"===o.timestampMode?o.data={api_key:null!==(l=null==(_=(u=(gt(a=o.data)?a:[a]).map(e=>i({},e,e.timestamp instanceof Date&&!isNaN(e.timestamp.getTime())?{timestamp:e.timestamp.toISOString()}:{})))[0])||null==(d=_.properties)?void 0:d.token)&&void 0!==l?l:null==_?void 0:_.token,batch:u,sent_at:(new Date).toISOString()}:"body"===o.timestampMode&&(o.data=function(e,t){return void 0===t&&(t=(new Date).toISOString()),gt(e)?e.map(e=>i({},e,{sent_at:t})):i({},e,{sent_at:t})}(o.data))),o.url=Kn(o.url,o.method,o.compression,o.timestampMode);var h=Jn.filter(e=>!o.disableTransport||!e.transport||!o.disableTransport.includes(e.transport)),p=null!==(r=null==(n=function(e,t){for(var i=0;e.length>i;i++)if(t(e[i]))return e[i]}(h,e=>e.transport===c))?void 0:n.method)&&void 0!==r?r:h[0].method;if(!p)throw new Error("No available transport method");var g=e=>{try{p(e)}catch(e){Gn(e)?Zi.warn(e):Zi.error(e),null==o.callback||o.callback({statusCode:0,error:e})}};"sendBeacon"!==c&&!o.preferSyncCompression&&o.data&&o.compression===Tr.GZipJS&&v&&"undefined"!=typeof Promise&&!Mn?Un(o).then(e=>{g(e)}).catch(t=>{if(ji(t))return Mn=!0,void g(i({},o,{compression:void 0,url:Kn(e.url,e.method,void 0,e.timestampMode)}));(e=>{if(!e||"object"!=typeof e)return!1;var t="name"in e?String(e.name):"";return ji(e)||t===Gi})(t)&&(Mn=!0),g(o)}):g(o)})(t,(i,r)=>{e.rateLimiter.checkForLimiting(i),400>i.statusCode||null==e.config.on_request_error||e.config.on_request_error(i),s?s(i,r):null==t.callback||t.callback(i)})):t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:0}))}var Xn=class{constructor(e,t){this._isPaused=!0,this._queue=[],this._flushTimeoutMs=Dt((null==t?void 0:t.flush_interval_ms)||3e3,250,5e3,Zi.createLogger("flush interval"),3e3),this._sendRequest=e}enqueue(e){this._queue.push(e),this._flushTimeout||this._setFlushTimeout()}unload(){this._clearFlushTimeout();var e=this._queue.length>0?this._formatQueue():{},t=Object.values(e);[...t.filter(e=>0===e.url.indexOf("/e")),...t.filter(e=>0!==e.url.indexOf("/e"))].map(e=>{this._sendRequestSafely(i({},e,{callback:void 0}),"sendBeacon")})}enable(){this._isPaused=!1,this._setFlushTimeout()}_setFlushTimeout(){this._isPaused||(this._flushTimeout=setTimeout(()=>{this._clearFlushTimeout(),this._flush()},this._flushTimeoutMs))}_flush(){if(this._queue.length>0){var e=this._formatQueue();for(var t in e)this._sendRequestSafely(e[t])}}_sendRequestSafely(e,t){try{this._sendRequest(e,t)}catch(e){Zi.error(e)}}_clearFlushTimeout(){clearTimeout(this._flushTimeout),this._flushTimeout=void 0}_formatQueue(){var e={},t={};is(this._queue,s=>{var r,n=s,o=((n?n.batchKey:null)||n.url)+(n.batchGroup?":"+n.batchGroup:"");yt(e[o])&&(e[o]=i({},n,{data:[],callback:void 0,fireCallbackOnDrop:void 0}),t[o]=[]),null==(r=e[o].data)||r.push(n.data),n.callback&&t[o].push(n.callback)});var s=function(){var i=t[r];i.length&&(e[r].callback=e=>{for(var t of i)t(e)})};for(var r in t)s();return this._queue=[],e}},Zn=class{constructor(e){this._instance=e,this._isPolling=!1,this._pollIntervalMs=3e3,this._queue=[],this._queue=[],this._areWeOnline=!0,this.resume()}resume(){if(!yt(l)&&"onLine"in l.navigator){if(this._areWeOnline=l.navigator.onLine,this._onlineListener)return;this._onlineListener=()=>{this._areWeOnline=!0,this._flush()},this._offlineListener=()=>{this._areWeOnline=!1},ds(l,"online",this._onlineListener),ds(l,"offline",this._offlineListener)}}get length(){return this._queue.length}retriableRequest(e,s){var r=e.retriesPerformedSoFar,n=function(e,t){if(null==e)return{};var i={};for(var s in e)if({}.hasOwnProperty.call(e,s)){if(-1!==t.indexOf(s))continue;i[s]=e[s]}return i}(e,t);Ct(r)&&(n.url=Dn(n.url,{retry_count:r})),Qn(this._instance,s?i({},n,{transport:s}):n,(e,t)=>{if(200!==e.statusCode&&(400>e.statusCode||e.statusCode>=500)){if((0===e.statusCode?3:10)>(null!=r?r:0))return void this._enqueue(i({retriesPerformedSoFar:r},n),t);0===e.statusCode&&Zi.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!=r?r:0)+" retries.")}null==n.callback||n.callback(e)})}_enqueue(e,t){var i=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=i+1;var s=Math.max(function(e){var t=3e3*Math.pow(2,e),i=t/2,s=Math.min(18e5,t),r=(Math.random()-.5)*(s-i);return Math.ceil(s+r)}(i),null!=t?t:0),r=Date.now()+s;this._queue.push({retryAt:r,requestOptions:e});var n="Enqueued failed request for retry in "+s;navigator.onLine||(n+=" (Browser is offline)"),Zi.warn(n),this._isPolling||(this._isPolling=!0,this._poll())}_poll(){if(this._poller&&clearTimeout(this._poller),0===this._queue.length)return this._isPolling=!1,void(this._poller=void 0);this._poller=setTimeout(()=>{this._areWeOnline&&this._queue.length>0&&this._flush(),this._poll()},this._pollIntervalMs)}_flush(){var e=Date.now(),t=[],i=this._queue.filter(i=>e>i.retryAt||(t.push(i),!1));if(this._queue=t,i.length>0)for(var s of i)this.retriableRequest(s.requestOptions)}unload(){for(var e of(this._poller&&(clearTimeout(this._poller),this._poller=void 0),this._isPolling=!1,yt(l)||(this._onlineListener&&(l.removeEventListener("online",this._onlineListener),this._onlineListener=void 0),this._offlineListener&&(l.removeEventListener("offline",this._offlineListener),this._offlineListener=void 0)),this._queue)){var t=e.requestOptions;try{this._instance._send_request(i({},t,{callback:gt(t.data)?void 0:t.callback,transport:"sendBeacon"}))}catch(e){Zi.error(e)}}this._queue=[]}},eo=class{constructor(e){this._instance=e,this._updateScrollData=()=>{var e,t,i,s;this._context||(this._context={});var r=this.scrollElement(),n=this.scrollY(),o=r?Math.max(0,r.scrollHeight-r.clientHeight):0,a=n+((null==r?void 0:r.clientHeight)||0),l=(null==r?void 0:r.scrollHeight)||0;this._context.lastScrollY=Math.ceil(n),this._context.maxScrollY=Math.max(n,null!==(e=this._context.maxScrollY)&&void 0!==e?e:0),this._context.maxScrollHeight=Math.max(o,null!==(t=this._context.maxScrollHeight)&&void 0!==t?t:0),this._context.lastContentY=a,this._context.maxContentY=Math.max(a,null!==(i=this._context.maxContentY)&&void 0!==i?i:0),this._context.maxContentHeight=Math.max(l,null!==(s=this._context.maxContentHeight)&&void 0!==s?s:0)}}get _scrollRoot(){return this._instance.config.scroll_root_selector}getContext(){return this._context}resetContext(){var e=this._context;return this._context=void 0,setTimeout(this._updateScrollData,0),e}startMeasuringScrollPosition(){ds(l,"scroll",this._updateScrollData,{capture:!0}),ds(l,"scrollend",this._updateScrollData,{capture:!0}),ds(l,"resize",this._updateScrollData)}scrollElement(){var e;if(!this._scrollRoot)return null==l||null==(e=l.document)?void 0:e.documentElement;for(var t of gt(this._scrollRoot)?this._scrollRoot:[this._scrollRoot]){var i,s=null==l||null==(i=l.document)?void 0:i.querySelector(t);if(s)return s}}_scrollPosition(e){var t,i,s="y"===e?"scrollTop":"scrollLeft";if(this._scrollRoot){var r=this.scrollElement();return r&&r[s]||0}return l?"y"===e?l.scrollY||l.pageYOffset||(null==(t=l.document)||null==(t=t.documentElement)?void 0:t.scrollTop)||0:l.scrollX||l.pageXOffset||(null==(i=l.document)||null==(i=i.documentElement)?void 0:i.scrollLeft)||0:0}scrollY(){return this._scrollPosition("y")}scrollX(){return this._scrollPosition("x")}},to=e=>hr(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties,null==e?void 0:e.config.disable_capture_url_hashes),io=class{constructor(e,t,i,s){this._onSessionIdCallback=e=>{var t=this._getStored();if(!t||t.sessionId!==e){var i={sessionId:e,props:this._sessionSourceParamGenerator(this._instance)};this._persistence.register({[Oe]:i})}},this._instance=e,this._sessionIdManager=t,this._persistence=i,this._sessionSourceParamGenerator=s||to,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStored(){return this._persistence.props[Oe]}getSetOnceProps(){var e,t=null==(e=this._getStored())?void 0:e.props;return t?"r"in t?pr(t,this._instance.config.disable_capture_url_hashes):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return is(ns(this.getSetOnceProps()),(t,i)=>{"$current_url"===i&&(i="url"),e["$session_entry_"+_t(i)]=t}),e}},so=class{on(e,t){return this._events[e]||(this._events[e]=[]),this._events[e].push(t),()=>{this._events[e]=this._events[e].filter(e=>e!==t)}}emit(e,t){for(var i of this._events[e]||[])i(t);for(var s of this._events["*"]||[])s(e,t)}constructor(){this._events={}}},ro=es("[SessionId]"),no=864e5,oo=class{on(e,t){return this._eventEmitter.on(e,t)}constructor(e,t,i){var s;if(this._lastPersistedActivityTimestamp=null,this._lastCookieSyncTimestamp=null,this._sessionIdChangedHandlers=[],this._beforeUnloadListener=void 0,this._destroyed=!1,this._eventEmitter=new so,this._sessionHasBeenIdleTooLong=(e,t)=>!(!Ct(e)||!Ct(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if("always"===e.config.cookieless_mode)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this._config=e.config,this._persistence=e.persistence,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._pendingBootstrapSession=void 0,this._sessionActivityTimestamp=null,this._sessionIdGenerator=t||fs,this._windowIdGenerator=i||fs;var r=this._config.persistence_name||this._config.token;if(this._sessionTimeoutMs=1e3*Dt(this._config.session_idle_timeout_seconds||1800,60,36e3,ro.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this._resetIdleTimer(),this._window_id_storage_key="ph_"+r+"_window_id",this._primary_window_exists_storage_key="ph_"+r+"_primary_window_exists",this._canUseSessionStorage()){var n=Ns._parse(this._window_id_storage_key),o=Ns._parse(this._primary_window_exists_storage_key);n&&!o?this._windowId=n:Ns._remove(this._window_id_storage_key),Ns._set(this._primary_window_exists_storage_key,!0)}null!=(s=this._config.bootstrap)&&s.sessionID&&this.setBootstrapSessionId(this._config.bootstrap.sessionID),this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return yt(this._sessionIdChangedHandlers)&&(this._sessionIdChangedHandlers=[]),this._sessionIdChangedHandlers.push(e),this._sessionId&&e(this._sessionId,this._windowId),()=>{this._sessionIdChangedHandlers=this._sessionIdChangedHandlers.filter(t=>t!==e)}}_canUseSessionStorage(){return"memory"!==this._config.persistence&&!this._persistence._disabled&&Ns._is_supported()}_setWindowId(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&Ns._set(this._window_id_storage_key,e))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?Ns._parse(this._window_id_storage_key):null}_isActivityChangeBelowGranularity(e){var t=this._lastPersistedActivityTimestamp;return!St(t)&&!St(e)&&5e3>Math.abs(e-t)}_setSessionId(e,t,i){var s=t!==this._sessionActivityTimestamp,r=!(e!==this._sessionId||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this._sessionId=e,r&&!s||r&&this._isActivityChangeBelowGranularity(t)||(this._lastPersistedActivityTimestamp=t,this._persistence.register({[fe]:[t,e,i]}))}_useCrossTabRefreshHardening(){var e,t=null==(e=this._config)?void 0:e.persistence_save_debounce_ms;return Ct(t)&&t>0}_refreshSessionIdFromStorage(){this._useCrossTabRefreshHardening()?this._persistence.refreshKey(fe):(this._persistence.flush(),this._persistence.load())}_flushPendingActivityTimestamp(){var e;if(!St(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this._lastPersistedActivityTimestamp){this._refreshSessionIdFromStorage();var t=this._getSessionId();t[1]===this._sessionId&&t[2]===this._sessionStartTimestamp&&(this._lastPersistedActivityTimestamp=this._sessionActivityTimestamp,this._persistence.register({[fe]:[this._sessionActivityTimestamp,null!==(e=this._sessionId)&&void 0!==e?e:null,this._sessionStartTimestamp]}),this._persistence.flush())}}_freshestActivityTimestamp(){var e=this._getSessionId()[0],t=Ct(e)?e:0,i=Ct(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,i)}_isSessionIdleAfterCrossTabRefresh(e){return this._refreshSessionIdFromStorage(),this._sessionHasBeenIdleTooLong(e,this._freshestActivityTimestamp())}_getSessionId(){var e=this._persistence.props[fe];return gt(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this._lastPersistedActivityTimestamp=null,this._pendingBootstrapSession=void 0,clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._setSessionId(null,null,null)}setBootstrapSessionId(e,t){void 0===t&&(t=!1);var i=function(e,t){void 0===t&&(t=(new Date).getTime());try{var i=(e=>{var t=e.replace(/-/g,"");if(32!==t.length)throw new Error("Not a valid UUID");if("7"!==t[12])throw new Error("Not a UUIDv7");return parseInt(t.substring(0,12),16)})(e);return i>t+6e4?void ro.error("Bootstrap sessionID cannot be in the future"):i}catch(e){return void ro.error("Invalid sessionID in bootstrap",e)}}(e);return!yt(i)&&(t?this._pendingBootstrapSession={sessionId:e,sessionStartTimestamp:i}:this._setSessionId(e,(new Date).getTime(),i),!0)}destroy(){this._destroyed=!0,this._flushPendingActivityTimestamp(),clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._beforeUnloadListener&&l&&(l.removeEventListener(it,this._beforeUnloadListener,{capture:!1}),this._beforeUnloadListener=void 0),this._sessionIdChangedHandlers=[]}_listenToReloadWindow(){this._beforeUnloadListener=()=>{this._flushPendingActivityTimestamp(),this._canUseSessionStorage()&&Ns._remove(this._primary_window_exists_storage_key)},ds(l,it,this._beforeUnloadListener,{capture:!1})}checkAndGetSessionAndWindowId(e,t,i){if(void 0===e&&(e=!1),void 0===t&&(t=null),void 0===i&&(i=!1),"always"===this._config.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var s=t||(new Date).getTime(),r=this._sessionId;if(i)this._lastCookieSyncTimestamp=s;else if(St(this._lastCookieSyncTimestamp)||this._lastCookieSyncTimestamp>s||s-this._lastCookieSyncTimestamp>=1e3){var n,o;null==(n=(o=this._persistence).syncCookieProperties)||n.call(o),this._lastCookieSyncTimestamp=s}var a=this._getSessionId(),l=a[1],d=a[2],u=!yt(r)&&l!==r,_=this._freshestActivityTimestamp(),c=this._getWindowId(),h=this._pendingBootstrapSession,p=!!h&&(h.sessionStartTimestamp>s+6e4||s-h.sessionStartTimestamp>no),g=h?p:Ct(d)&&Math.abs(s-d)>no,v=!1,f=u,m=!l||!!h,y=l,b=!m&&!e&&this._sessionHasBeenIdleTooLong(s,_);if(b){(b=this._isSessionIdleAfterCrossTabRefresh(s))||ro.info("cross-tab refresh kept the session alive",{sessionId:l});var w=this._getSessionId();l=w[1],d=w[2],b||(m=!l||!!h)}if(m||b||g){f=!1;var S=h&&!p;l=S?h.sessionId:this._sessionIdGenerator(),c=this._windowIdGenerator(),ro.info("new session ID assigned",{sessionId:l,windowId:c,bootstrapped:!!S,changeReason:{noSessionId:m,activityTimeout:b,sessionPastMaximumLength:g}}),d=S?h.sessionStartTimestamp:s,this._pendingBootstrapSession=void 0,v=!0}else c||(c=this._windowIdGenerator(),v=!0),(f=f||l!==y)&&(ro.info("adopted cross-tab session id",{sessionId:l,windowId:c}),v=!0);var P=Ct(_)&&e&&!g?_:s,k=Ct(d)?d:(new Date).getTime();this._setWindowId(c),this._setSessionId(l,P,k),e||this._resetIdleTimer();var C={noSessionId:m,activityTimeout:b,sessionPastMaximumLength:g,crossTabAdoption:f};return v&&this._sessionIdChangedHandlers.forEach(e=>e(l,c,C)),{sessionId:l,windowId:c,sessionStartTimestamp:k,changeReason:v?C:void 0,lastActivityTimestamp:_}}_resetIdleTimer(){this._destroyed||(clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=setTimeout(()=>{if(!this._destroyed)if(this._isSessionIdleAfterCrossTabRefresh((new Date).getTime())){var e=this._sessionId;this.resetSessionId(),this._eventEmitter.emit("forcedIdleReset",{idleSessionId:e})}else this._resetIdleTimer()},1.1*this.sessionTimeoutMs))}},ao=Object.freeze(["2026-08-30","2026-08-29","2026-06-25","2026-05-30","2026-01-30","2025-11-30","2025-05-24"]);function lo(){return(lo=r(function*(){var e=null==u?void 0:u.userAgentData;if(null!=e&&e.getHighEntropyValues)try{var t,i=null==(t=yield e.getHighEntropyValues(["model"]))?void 0:t.model;return bt(i)&&i.length>0?i:void 0}catch(e){return void Zi.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",e)}})).apply(this,arguments)}function uo(e,t){var i="$survey_"+t+"/"+e.id;return e.current_iteration&&e.current_iteration>0&&(i="$survey_"+t+"/"+e.id+"/"+e.current_iteration),i}function _o(e,t,i){return tr({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}var co,ho="custom",po="i.posthog.com",go=/^\/static\//,vo=["/s/","/e/","/i/"],fo=class{constructor(e){this._regionCache={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,t=null==(e=this.instance.config.ui_host)?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+po,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this._regionCache[this.apiHost]||(this._regionCache[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":ho),this._regionCache[this.apiHost]}_staticAssetHostOverride(e){if(go.test(e)){var t=this.instance.config.asset_host;if("string"==typeof t)return t.trim().replace(/\/$/,"")||void 0}}_urlKey(e){var t=er(e);return t?t.protocol+"//"+t.host+t.pathname:void 0}_prepareEndpoint(e,t,i){if("ui"===e)return i;var s=i,r=this.instance.config.rewriteRequestPath;if(r){var n,o=(null==(n=er(i))?void 0:n.href)||i;s=r(new URL(o)).toString()}if(r&&"api"===e&&vo.some(e=>0===t.indexOf(e))){var a=this._urlKey(s);if(a){var l,d=this.apiHost,u=this._ingestionEndpoints;(null==(l=u)?void 0:l.apiHost)===d&&u.rewriteRequestPath===r||(this._ingestionEndpoints=u={apiHost:d,rewriteRequestPath:r,urls:new Set}),u.urls.add(a)}}return s}isIngestionEndpoint(e){var t=this._ingestionEndpoints,i=this._urlKey(e);return(null==t?void 0:t.apiHost)===this.apiHost&&t.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!i&&t.urls.has(i)}endpointFor(e,t){if(void 0===t&&(t=""),t&&(t="/"===t[0]?t:"/"+t),"ui"===e)return this._prepareEndpoint(e,t,this.uiHost+t);if("flags"===e)return this._prepareEndpoint(e,t,this.flagsApiHost+t);if("assets"===e){var i=this._staticAssetHostOverride(t);if(i)return this._prepareEndpoint(e,t,""+i+t)}if(this.region===ho)return this._prepareEndpoint(e,t,this.apiHost+t);var s=po+t;switch(e){case"assets":return this._prepareEndpoint(e,t,"https://"+this.region+"-assets."+s);case"api":return this._prepareEndpoint(e,t,"https://"+this.region+"."+s)}}},mo=es("[Surveys]"),yo={ignoreConditions:!1,ignoreDelay:!1,displayType:Ur.Popover},bo=es("[PostHog ExternalIntegrations]"),wo={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},So=class{constructor(e){this._instance=e}_loadScript(e,t){var i;null==(i=b(this._instance))||i(this._instance,e,e=>{if(e)return bo.error("failed to load script",e);t()})}startIfEnabledOrStop(){var e=this,t=function(){var t,s,r,n=i[0],o=i[1];!o||null!=(t=y.__PosthogExtensions__)&&null!=(t=t.integrations)&&t[n]||e._loadScript(wo[n],()=>{var t;null==(t=y.__PosthogExtensions__)||null==(t=t.integrations)||null==(t=t[n])||t.start(e._instance)}),!o&&null!=(s=y.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[n]&&(null==(r=y.__PosthogExtensions__)||null==(r=r.integrations)||null==(r=r[n])||r.stop())};for(var i of Object.entries(null!==(s=this._instance.config.integrations)&&void 0!==s?s:{})){var s;t()}}},Po=()=>{var e;return null!=l&&null!=(e=l.performance)&&e.now?l.performance.now():Date.now()},ko=[],Co=[50,75,100,150,200,300,400,500,750,1e3,1500,2e3,3e3,5e3,1e4],Io=[5,10,25,...Co],Eo=class{constructor(e){this._instance=e}initialize(){}get(e){var t=this._instance.persistence;if("string"==typeof e)return null==t?void 0:t.get_property(e);var i={};for(var s of e){var r=null==t?void 0:t.get_property(s);yt(r)||(i[s]=r)}return i}set(e,t){var i;null==(i=this._instance.persistence)||i.register("string"==typeof e?{[e]:t}:e)}remove(e){var t;null==(t=this._instance.persistence)||t.unregister(e)}},xo=class{constructor(e){this.instance=e,this._logger=Zi,this.kv=new Eo(e),this.onSession=e=>qr(this.instance.onSessionId(t=>{try{e(t)}catch(e){this._logger.error("Browser extension session listener failed",e)}})),this.onEvent=e=>qr(this.instance._addCaptureHook((t,i)=>{if(i)try{e({event:t,properties:i.properties})}catch(e){this._logger.error("Browser extension event listener failed",e)}})),this.onRemoteConfig=e=>{var t=t=>{try{e(t)}catch(e){this._logger.error("Browser extension remote config listener failed",e)}},i=this.instance._internalEventEmitter.on("extensionsRemoteConfig",t);return this.instance._lastRemoteConfig&&t(this.instance._lastRemoteConfig),qr(i)}}get logger(){return this._logger}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return null!==(e=this.instance.get_property("$device_id"))&&void 0!==e?e:this.distinctId}get deviceId(){var e=this.instance.get_property(j);return"string"==typeof e?e:void 0}get library(){return{name:a.LIB_NAME,version:a.LIB_VERSION}}get initialPersonProperties(){var e,t;return null!==(e=null==(t=this.instance.persistence)?void 0:t.get_initial_props())&&void 0!==e?e:{}}get groups(){return this.instance.getGroups()}get session(){try{var e,t,i,s,r,n=null==(e=this.instance.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(t=null==n?void 0:n.sessionId)&&void 0!==t?t:"",windowId:null!==(i=null==n?void 0:n.windowId)&&void 0!==i?i:"",sessionStartTimestamp:null!==(s=null==n?void 0:n.sessionStartTimestamp)&&void 0!==s?s:0,lastActivityTimestamp:null!==(r=null==n?void 0:n.lastActivityTimestamp)&&void 0!==r?r:0}}catch(e){return{sessionId:"",windowId:"",sessionStartTimestamp:0,lastActivityTimestamp:0}}}get isOptedOut(){return this.instance.has_opted_out_capturing()}get canCapture(){return vt(this.instance.is_capturing)?this.instance.is_capturing():!this.isOptedOut}get isRateLimited(){var e;return!(null==(e=this.instance.rateLimiter)||!e.isClientRateLimited)}get projectToken(){return this.instance.config.token}getExtension(e){var t;switch(e){case"featureFlags":case"featureFlagsCommon":t=this.instance.featureFlags;break;case"logs":t=this.instance.logs;break;case"surveys":t=this.instance.surveys;break;case"autocapture":t=this.instance.autocapture}return t}capture(e,t,s){if(!s)return this._notRateLimited(this.instance.capture(e,t));var r=i({timestamp:s.timestamp,uuid:s.uuid,$set:s.set,$set_once:s.setOnce},"unload"===s.delivery?{transport:"sendBeacon",send_instantly:!0}:{});return this._notRateLimited(this.instance.capture(e,t,r))}_notRateLimited(e){var t;return!yt(e)||!(null!=(t=this.instance.rateLimiter)&&t.lastEventRateLimited)}registerDynamicEventProperties(e){return qr(this.instance._registerExtensionEventProperties(e))}sendRequest(e,t){var i=this;return r(function*(){var s;void 0===t&&(t={});var r=null!==(s=t.target)&&void 0!==s?s:"api",n=t.query?Dn(e,t.query):e,o=i.instance.requestRouter.endpointFor(r,n),a={method:t.method,url:o,data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,compressionFallback:"flags"===t.target&&"best-available"===t.compression?at.Base64:void 0,timestampMode:t.sentAt};return"api"===r&&"/i/v1/logs"===e&&(a.batchKey="logs"),"sendBeacon"===t.transport?(i.instance._send_request(a),{statusCode:202}):new Promise(e=>{var t,s,n;a.callback=e,"flags"===r&&null!=(t=i.instance.config.metrics)&&t.flags&&(a.onDispatch=()=>{s=Po()},a.onSend=e=>{n=(e=>{try{return(e=>{var t,i=null==l?void 0:l.PerformanceObserver,s=null==(t=er(e))?void 0:t.href;if(i&&s){var r,n,o,a=Po(),d={name:s,before:1/0,inFlight:!0},u=1/0,_=!1,c=()=>{_||(_=!0,clearTimeout(o),g.disconnect(),ko.splice(ko.indexOf(d),1))},h=!1,p=e=>{for(var t of e){var i=t.startTime;t.name!==s||(h?a>=i:a>i)||i>=d.before||r&&i>=r.startTime||(r=t)}if(r&&n&&u>=r.startTime){var o=n;c(),o(r)}},g=new i(e=>p(e.getEntriesByName(s,"resource")));for(var v of(g.observe({entryTypes:["resource"]}),ko))v.name===s&&(v.before=Math.min(v.before,a),h=h||v.inFlight);return ko.push(d),{take(e,t){_||(u=e,d.inFlight=!1,n=t,o=setTimeout(c,5e3),vt(g.takeRecords)&&p(g.takeRecords()))},stop:c}}})(e)}catch(e){return}})(e)},a.callback=t=>{var r;if(e(t),!yt(s)){var a=s,l=Po();try{var d=((e,t)=>{var i,s,r=t.statusCode||void 0,n={"server.address":(null!==(i=null==(s=er(e))?void 0:s.hostname)&&void 0!==i?i:e).replace(/^\[(.*)\]$/,"$1")};r&&(n["http.response.status_code"]=r);var o=((e,t)=>e?400>e?void 0:String(e):"AbortError"===(null==t?void 0:t.name)?"timeout":"_OTHER")(r,t.error);o&&(n["error.type"]=o);var a=Zs();return a&&(n["client.timezone"]=a),n})(o,t);if(i._recordFlagsHistogram("posthog.flags.request.duration",l-a,Co,d),t.statusCode&&n)return void n.take(l,e=>i._recordFlagsSplit(e,a,l,d))}catch(e){Zi.error("Failed to record the /flags request timing",e)}null==(r=n)||r.stop()}}),i.instance._send_request(a)})})()}_recordFlagsSplit(e,t,i,s){if(e.responseEnd>=e.startTime)try{var r=Math.min(e.responseEnd,i);this._recordFlagsHistogram("posthog.flags.request.pre_send_duration",e.startTime-t,Io,s),this._recordFlagsHistogram("posthog.flags.request.network_duration",r-e.startTime,Co,s),this._recordFlagsHistogram("posthog.flags.request.main_thread_duration",i-r,Io,s)}catch(e){Zi.error("Failed to record the /flags request timing split",e)}}_recordFlagsHistogram(e,t,s,r){var n;null==(n=this.instance.metrics)||n.histogram(e,t,{unit:"ms",attributes:i({},r),bounds:s})}},To={},$o=0,Fo=()=>{},Ro='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Oo="Surveys module not available",Mo="sanitize_properties is deprecated. Use before_send instead",Ao="Invalid value for property_denylist config: ",Do=["$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"],Lo=["$feature_flag_called","$$heatmap","$snapshot"],No=e=>"$"===e.charAt(0)&&!ut(Lo,e),Bo=/^[A-Za-z0-9_-]{1,400}$/,Uo=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,qo=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,Ho=["token","distinct_id",Ue],Go="posthog",Wo=[...ao].sort()[ao.length-1],Vo=e=>{var t={};return e&&"unset"!==e?("2025-11-30">e||(t.strictMinimumDuration=!0),"2026-05-30">e||(t.canvasCapture={resolutionScale:.6}),"2026-06-25">e||(t.streamNetworkBody=!0),"2026-08-30">e||(t.captureJsonLd=!0),t):t},jo=e=>{var t;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:ls(null==_?void 0:_.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Fo,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,__preview_replay_sync_fetch:!0,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:c&&bt(null==c?void 0:c.search)&&-1!==c.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==l||null==(t=l.location)?void 0:t.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(e){Zi.error("Bad HTTP status: "+e.statusCode+" "+e.text)},get_device_id:e=>e,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:tt,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:Fo},(e=>({rageclick:e&&e>="2026-05-30"?{content_ignorelist:qs,ignore_text_selection:!0}:!e||"2025-11-30">e||{content_ignorelist:!0},capture_pageview:!e||"2025-05-24">e||"history_change",session_recording:Vo(e),external_scripts_inject_target:e&&e>="2026-01-30"?"head":"body",internal_or_test_user_hostname:e&&e>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:e&&e>="2026-05-30"?250:0,split_storage:!(!e||"2026-05-30">e),detect_google_search_app:!(!e||"2026-05-30">e),disable_capture_url_hashes:!(!e||"2026-06-25">e),cookieWinsOnConflict:!(!e||"unset"===e||"2026-08-29">e)}))(e))},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"]],Ko=e=>{var t={};for(var i of zo){var s=i[0],r=i[1];yt(e[s])||(t[r]=e[s])}var n=ss({},t,e),o=e.__preview_external_dependency_versioned_paths;return yt(o)||(yt(e.strict_script_versioning)&&(n.strict_script_versioning=!!o),bt(o)&&yt(e.asset_host)&&(n.asset_host=o)),gt(e.property_blacklist)&&(yt(e.property_denylist)?n.property_denylist=e.property_blacklist:gt(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:Zi.error(Ao+e.property_denylist)),n},Jo=class{constructor(){this.__forceAllowLocalhost=!1}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){Zi.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},Yo=(e=class e{_removeExtension(e){if(e){var t=this._extensions.indexOf(e);-1!==t&&this._extensions.splice(t,1)}}_replaceExtension(e,t){return this._removeExtension(e),this._extensions.push(t),null==t.initialize||t.initialize(),t}_inCookielessMode(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}_warnIfHistoryAutocaptureMissing(){if(!this._hasWarnedAboutMissingHistoryAutocapture&&this._originalUserConfig&&"capture_pageview"in this._originalUserConfig&&!i({},e.__defaultExtensionClasses,this.config.__extensionClasses).historyAutocapture){var t=this.config.capture_pageview;("history_change"===t||ft(t)&&(t.path||t.search||t.hash&&!this.config.disable_capture_url_hashes))&&(this._hasWarnedAboutMissingHistoryAutocapture=!0,Zi.warn("capture_pageview is set to capture history changes, but the history autocapture extension is not loaded, so only the first pageview of each page load is captured. With the slim bundle, pass __extensionClasses: { historyAutocapture: AnalyticsExtensions.historyAutocapture } from 'posthog-js/dist/extension-bundles', or set capture_pageview: true to capture page loads only."))}}_warnIfVolatileIdentityWithoutStableId(){if(!(this._hasWarnedAboutVolatileIdentity||this.config.reuseAnonymousId||this.config.segment||this._inCookielessMode())){var e,t,i,s="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;(s||this.config.disable_persistence)&&(this._hasStableInitialDistinctId||(s?(e="persistence is set to '"+this.config.persistence+"'",t="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."):(e="persistence is disabled (disable_persistence is true)",t="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._hasWarnedAboutVolatileIdentity=!0,console.warn("[PostHog.js]",e+" but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID "+t+", 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)))}}_syncCookielessIdentity(){var e=this.persistence;if(e&&!this._isConsentTransition)if(this._inCookielessMode())"on_reject"===this.config.cookieless_mode&&"$posthog_cookieless"!==this.get_distinct_id()&&(this._sync_opt_out_with_persistence(),this._enterCookielessMode());else if("$posthog_cookieless"===this.get_distinct_id()){this._is_persistence_disabled()||e.load(!0);var t=this.get_distinct_id();if(!t||"$posthog_cookieless"===t){var i=this.config.get_device_id(fs());this.register({distinct_id:i,$device_id:i}),e.set_property(Re,Ze)}this._sync_opt_out_with_persistence()}}get decideEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}get flagsEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}constructor(){var t;this._botFilterWarned=!1,this._isPageUnloading=!1,this._isShutdown=!1,this.webPerformance=new Jo,this._personProcessingSetOncePropertiesSent=!1,this.version=a.LIB_VERSION,this.__loadExternalDependency=void 0,this._sessionRegisteredPropKeys=new Set,this._sessionRegisteredPropertiesStorageKey="",this._internalEventEmitter=new so,this._extensions=[],this._extensionEventPropertyProducers=[],this._replayDebugPropertiesPaused=!1,this._hasStableInitialDistinctId=!1,this._hasWarnedAboutVolatileIdentity=!1,this._hasWarnedAboutMissingHistoryAutocapture=!1,this._isConsentTransition=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=jo(),this.SentryIntegration=zs,this.sentryIntegration=e=>function(e,t){var i=js(e,t);return{name:Vs,processEvent:e=>i(e)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this._visibilityStateListener=null,this._initialPersonProfilesConfig=null,this._cachedPersonProperties=null,this.scrollManager=new eo(this),this.pageViewManager=new Ks(this),this.rateLimiter=new jr(this),this.requestRouter=new fo(this),this.consent=new Bs(this),this.externalIntegrations=new So(this);var i=null!==(t=e.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.metrics=i.metrics&&new i.metrics(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(e,t,i)=>{var s=bt(e)?{[e]:t}:e;this.setPersonProperties(s),null==i||i({})},set_once:(e,t,i)=>{var s=bt(e)?{[e]:t}:e;this.setPersonProperties(void 0,s),null==i||i({})}},this.on("eventCaptured",e=>Zi.info('send "'+(null==e?void 0:e.event)+'"',e))}init(t,i,s){if(s&&s!==Go){var r,n=null!==(r=To[s])&&void 0!==r?r:new e;return n._init(t,i,s),To[s]=n,To[Go][s]=n,n}return this._init(t,i,s)}_init(e,t,s){var r,n,o;void 0===t&&(t={});var d,u=bt(e)?e.trim():"";if(!u)return Zi.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 u!==(null==(d=this.config)?void 0:d.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('"+u+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=jo(t.defaults),t.debug=this._checkLocalStorageForDebug(t.debug),this._originalUserConfig=t,this._triggered_notifs=[],t.person_profiles?this._initialPersonProfilesConfig=t.person_profiles:t.process_person&&(this._initialPersonProfilesConfig=t.process_person);var _=jo(t.defaults),c=Ko(t),h=ss({},_,c,{name:s,token:u});ft(_.rageclick)&&ft(c.rageclick)&&(h.rageclick=ss({},_.rageclick,c.rageclick)),ft(_.session_recording)&&ft(c.session_recording)&&(h.session_recording=ss({},_.session_recording,c.session_recording)),this.set_config(h),this.config.on_xhr_error&&Zi.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:Tr.GZipJS;var p=this._is_persistence_disabled(),g=!this._inCookielessMode();if(this.persistence=new xr(this.config,p,!0,g),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new xr(i({},this.config,{persistence:"sessionStorage"}),p,!1,g),this._sessionRegisteredPropertiesStorageKey="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!p&&Ns._is_supported()){var v=Ns._parse(this._sessionRegisteredPropertiesStorageKey);gt(v)&&v.forEach(e=>{bt(e)&&this._sessionRegisteredPropKeys.add(e)})}else Ns._remove(this._sessionRegisteredPropertiesStorageKey);var f=i({},this.persistence.props),m=i({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this._requestQueue=new Xn((e,t)=>this._send_retriable_request(e,t),this.config.request_queue_config),this._retryQueue=new Zn(this),this.__request_queue=[];var y=this._inCookielessMode();y||(this.sessionManager=new oo(this),this.sessionPropsManager=new io(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((e,t,i)=>{(null!=i&&i.activityTimeout||null!=i&&i.sessionPastMaximumLength||null!=i&&i.crossTabAdoption)&&this._clearSessionRegisteredProps()})),this._enrollFeatureFlags(),this.config.__preview_deferred_init_extensions?(Zi.info("Deferring extension initialization to improve startup performance"),this._extensionInitTimeout=setTimeout(()=>{this._extensionInitTimeout=void 0,this._initExtensions(y)},0)):(Zi.info("Initializing extensions synchronously"),this._initExtensions(y)),a.DEBUG=a.DEBUG||this.config.debug,a.DEBUG&&Zi.info("Starting in debug mode",{this:this,config:t,thisC:i({},this.config),p:f,s:m}),!this.config.identity_distinct_id||null!=(r=t.bootstrap)&&r.distinctID||(t.bootstrap=i({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));var b=null==(n=t.bootstrap)?void 0:n.distinctID;if(this._hasStableInitialDistinctId=!!b&&!wt(b),null!=(o=t.bootstrap)&&o.distinctID){var w=t.bootstrap.distinctID,S=this.get_distinct_id(),P=this.persistence.get_property(Re);if(t.bootstrap.isIdentifiedID&&null!=S&&S!==w&&"anonymous"===P)this.identify(w);else if(t.bootstrap.isIdentifiedID&&null!=S&&S!==w&&"identified"===P)Zi.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 k=this.config.get_device_id(fs()),C=t.bootstrap.isIdentifiedID?k:w;this.persistence.set_property(Re,t.bootstrap.isIdentifiedID?et:Ze),this.register({distinct_id:w,$device_id:C})}}if(y)this.register_once({distinct_id:Be,$device_id:null},"");else if(!this.get_distinct_id()){var I=this.config.get_device_id(fs());this.register_once({distinct_id:I,$device_id:I},""),this.persistence.set_property(Re,Ze)}return ds(l,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),ds(l,"pageshow",e=>{if(this._isPageUnloading=!1,!this._isShutdown){var t;if(e.persisted&&this.persistence){var i=this.persistence.get_property(V),s=this.persistence.get_property(Re);this.persistence.load(),this._processCookieIdentityChange()||i===this.persistence.get_property("distinct_id")&&s===this.persistence.get_property("$user_state")||this._processIdentityChange()}null==(t=this._retryQueue)||t.resume()}}),t.segment?Ws(this,()=>this._loaded()):this._loaded(),vt(this.config._onCapture)&&this.config._onCapture!==Fo&&(Zi.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",e=>this.config._onCapture(e.event,e))),this.config.ip&&Zi.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(e=>{e&&this.register({[z]:e})}).catch(Fo),this}_isSharedExtension(e){var t=e;return bt(t.name)&&vt(t.setup)}_enrollExtension(e,t){var i=this;this._isSharedExtension(e)?t.push(r(function*(){try{yield e.setup(i._getBrowserClientAdapter())}catch(t){Zi.error('Failed to set up extension "'+e.name+'"',t);try{yield null==e.dispose?void 0:e.dispose()}catch(t){Zi.error('Failed to dispose extension "'+e.name+'"',t)}}})):this._extensions.push(e)}_enrollFeatureFlags(){var t,i,s,n,o,a,l=this,d=null!==(t=null==(i=this.config.__extensionClasses)?void 0:i.featureFlags)&&void 0!==t?t:null==(s=e.__defaultExtensionClasses)?void 0:s.featureFlags;if(d)if(this.featureFlags&&this.featureFlags instanceof d||(null==(a=this._featureFlagsReloadingUnsubscribe)||a.call(this),this._featureFlagsReloadingUnsubscribe=void 0,this.featureFlags=new d(this)),vt(this.featureFlags.onReloading)&&vt(this.featureFlags.setup)){if(!this._featureFlagsReloadingUnsubscribe){this._featureFlagsReloadingUnsubscribe=this.featureFlags.onReloading(()=>{this._internalEventEmitter.emit("featureFlagsReloading",!0)});var u=this.featureFlags;r(function*(){try{yield u.setup(l._getBrowserClientAdapter())}catch(t){Zi.error("Failed to set up feature flags",t);var e=l._featureFlagsReloadingUnsubscribe;l._featureFlagsReloadingUnsubscribe=void 0;try{null==e||e()}catch(e){Zi.error("Failed to unsubscribe feature flag reloading",e)}try{yield u.dispose()}catch(e){Zi.error("Failed to dispose feature flags",e)}}})()}}else null==(n=(o=this.featureFlags).initialize)||n.call(o)}_initExtensions(t){var s,r,n,o,a,l,d,u,_=performance.now(),c=i({},e.__defaultExtensionClasses,this.config.__extensionClasses),h=[];c.exceptions&&this._extensions.push(this.exceptions=null!==(s=this.exceptions)&&void 0!==s?s:new c.exceptions(this)),c.historyAutocapture&&this._extensions.push(this.historyAutocapture=new c.historyAutocapture(this)),this._warnIfHistoryAutocaptureMissing(),c.tracingHeaders&&this._extensions.push(this.tracingHeaders=new c.tracingHeaders(this)),c.siteApps&&this._extensions.push(this.siteApps=new c.siteApps(this)),c.sessionRecording&&!t&&this._extensions.push(this.sessionRecording=new c.sessionRecording(this)),c.autocapture&&this._enrollExtension(this.autocapture=new c.autocapture(this),h),c.surveys&&this._enrollExtension(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new c.surveys(this),h),c.logs&&this._enrollExtension(this.logs=null!==(n=this.logs)&&void 0!==n?n:new c.logs(this),h),c.metrics&&this._extensions.push(this.metrics=null!==(o=this.metrics)&&void 0!==o?o:new c.metrics(this)),c.conversations&&this._extensions.push(this.conversations=null!==(a=this.conversations)&&void 0!==a?a:new c.conversations(this)),c.productTours&&this._extensions.push(this.productTours=new c.productTours(this)),c.heatmaps&&this._extensions.push(this.heatmaps=new c.heatmaps(this)),c.webVitalsAutocapture&&this._extensions.push(this.webVitalsAutocapture=new c.webVitalsAutocapture(this)),c.exceptionObserver&&this._extensions.push(this.exceptionObserver=new c.exceptionObserver(this)),c.deadClicksAutocapture&&this._extensions.push(this.deadClicksAutocapture=new c.deadClicksAutocapture(this,Hs)),c.toolbar&&this._extensions.push(this.toolbar=null!==(l=this.toolbar)&&void 0!==l?l:new c.toolbar(this)),c.experiments&&this._extensions.push(this.experiments=null!==(d=this.experiments)&&void 0!==d?d:new c.experiments(this)),c.webMCP&&this._extensions.push(this.webMCP=null!==(u=this.webMCP)&&void 0!==u?u:new c.webMCP(this));var p=this._extensions.length>0||h.length>0;this.config.disable_scroll_properties||h.unshift(()=>{this.scrollManager.startMeasuringScrollPosition()}),this._extensions.forEach(e=>{e.initialize&&h.push(()=>{null==e.initialize||e.initialize()})}),h.push(()=>{if(this._pendingRemoteConfig){var e=this._pendingRemoteConfig;this._pendingRemoteConfig=void 0,this._extensions.forEach(t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e))}}),this._processInitTaskQueue(h,_,p)}_processInitTaskQueue(e,t,i){for(var s,r;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void(this._extensionInitTimeout=setTimeout(()=>{this._extensionInitTimeout=void 0,this._processInitTaskQueue(e,t,i)},0));var n=e.shift();if(n)try{n()}catch(e){Zi.error("Error initializing extension:",e)}}var o=Math.round(performance.now()-t);i&&o>0?this.register_for_session({[qe]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[He]:o}):yt(null==(s=this.sessionPersistence)?void 0:s.props.$sdk_debug_extensions_init_method)&&yt(null==(r=this.sessionPersistence)?void 0:r.props.$sdk_debug_extensions_init_time_ms)||(this.unregister_for_session(qe),this.unregister_for_session(He)),this.config.__preview_deferred_init_extensions&&Zi.info("PostHog extensions initialized ("+o+"ms)")}_onRemoteConfig(e){if(!_||!_.body)return Zi.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this._onRemoteConfig(e)},500);if(this.config.__preview_deferred_init_extensions&&(this._pendingRemoteConfig=e),this._lastRemoteConfig=e,this.compression=void 0,e.ok){var t,i=e.config;i.supportedCompression&&!this.config.disable_compression&&(this.compression=ut(i.supportedCompression,Tr.GZipJS)?Tr.GZipJS:ut(i.supportedCompression,Tr.Base64)?Tr.Base64:void 0),null!=(t=i.analytics)&&t.endpoint&&(this.analyticsDefaultEndpoint=i.analytics.endpoint)}this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:tt}),this._internalEventEmitter.emit("extensionsRemoteConfig",e),this._extensions.forEach(t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e))}_loaded(){try{this.config.loaded(this)}catch(e){Zi.critical("`loaded` function failed",e)}if(this._start_queue_if_opted_in(),this.config.internal_or_test_user_hostname&&null!=c&&c.hostname){var e=c.hostname,t=this.config.internal_or_test_user_hostname;("string"==typeof t?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this._inCookielessMode())&&this._captureInitialPageview()},1),this._remoteConfigLoader=new Kr(this),this._remoteConfigLoader.load()}_start_queue_if_opted_in(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this._requestQueue)||e.enable())}_dom_loaded(){this.is_capturing()&&ts(this.__request_queue,e=>this._send_retriable_request(e)),this.__request_queue=[],this._start_queue_if_opted_in()}_handle_unload(){var e,t,i,s,r;this._isPageUnloading=!0,null==(e=this.surveys)||null==e.handlePageUnload||e.handlePageUnload(),null==(t=this.metrics)||t.flush("sendBeacon"),this.config.request_batching?(this._shouldCapturePageleave()&&this.capture(rt),null==(i=this.logs)||i.flushLogs("sendBeacon"),null==(s=this._requestQueue)||s.unload(),null==(r=this._retryQueue)||r.unload()):this._shouldCapturePageleave()&&this.capture(rt,null,{transport:"sendBeacon"})}_send_request(e){Qn(this,e)}_send_retriable_request(e,t){this._retryQueue?this._retryQueue.retriableRequest(e,t):this._send_request(t?i({},e,{transport:t}):e)}_execute_array(e){$o++;try{var t,i=[],s=[],r=[];ts(e,e=>{if(e)if(gt(t=e[0]))r.push(e);else if(vt(e))try{e.call(this)}catch(t){Zi.error("Error executing queued PostHog call",e,t)}else gt(e)&&"alias"===t?i.push(e):gt(e)&&-1!==t.indexOf("capture")&&vt(this[t])?r.push(e):s.push(e)});var n=function(e,t){ts(e,function(e){try{if(gt(e[0])){var i=t;is(e,function(e){i=i[e[0]].apply(i,e.slice(1))})}else t[e[0]].apply(t,e.slice(1))}catch(t){Zi.error("Error executing queued PostHog call",e,t)}})};n(i,this),n(s,this),n(r,this)}finally{$o--}}push(t){if($o>0&>(t)&&bt(t[0])){var i=e.prototype[t[0]];vt(i)&&i.apply(this,t.slice(1))}else this._execute_array([t])}get _facebookClickIdChannel(){return{property:Y,persistenceKey:Q,cookieName:"_fbc",pattern:Uo,register:(e,t)=>{var i;return null==(i=this.persistence)?void 0:i.register({[Q]:{value:e,delivered:t}})},unregister:()=>{var e;return null==(e=this.persistence)?void 0:e.unregister(Q)}}}get _facebookBrowserIdChannel(){return{property:X,persistenceKey:Z,cookieName:"_fbp",pattern:qo,register:(e,t)=>{var i;return null==(i=this.persistence)?void 0:i.register({[Z]:{value:e,delivered:t}})},unregister:()=>{var e;return null==(e=this.persistence)?void 0:e.unregister(Z)}}}_getPersistedMetaIdentifier(e){var t,i=null==(t=this.persistence)?void 0:t.get_property(e.persistenceKey);return bt(i)&&e.pattern.test(i)?{value:i,delivered:!1}:ft(i)&&bt(i.value)&&e.pattern.test(i.value)?{value:i.value,delivered:!0===i.delivered}:void 0}_storeMetaIdentifier(e,t,i){return t===(null==i?void 0:i.value)?{value:t,pending:!i.delivered}:(e.register(t,!1),{value:t,pending:!0})}_readMetaCookie(e){if(this.config.save_campaign_params&&!this._inCookielessMode()){var t=cs(e.cookieName);return bt(t)&&e.pattern.test(t)?t:void 0}}_updateFacebookClickId(e,t,i,s){if(this.persistence){var r=this._facebookClickIdChannel,n=this._getPersistedMetaIdentifier(r);if(!s){if(i)return bt(t)&&Uo.test(t)?this._storeMetaIdentifier(r,t,n):void r.unregister();var o=bt(e)&&Bo.test(e)?e:void 0,a=this._readMetaCookie(r);return a&&((e,t,i)=>{var s=e.split(".");if(t)return s[3]===t;if(!i)return!0;var r=i.value.split(".");return s[3]===r[3]||Number(s[2])>Number(r[2])})(a,o,n)?this._storeMetaIdentifier(r,a,n):o?(null==n?void 0:n.value.split(".")[3])===o?{value:n.value,pending:!n.delivered}:this._storeMetaIdentifier(r,"fb.1."+Date.now()+"."+o,n):n?{value:n.value,pending:!n.delivered}:void 0}r.unregister()}}_updateFacebookBrowserId(e,t,i){if(this.persistence){var s=this._facebookBrowserIdChannel,r=this._getPersistedMetaIdentifier(s);if(!i){if(t)return bt(e)&&qo.test(e)?this._storeMetaIdentifier(s,e,r):void s.unregister();var n=this._readMetaCookie(s);return n?this._storeMetaIdentifier(s,n,r):r?{value:r.value,pending:!r.delivered}:void 0}s.unregister()}}_markMetaIdentifiersDelivered(e){if(this.persistence){var t=e=>{var t=e.value,i=this._getPersistedMetaIdentifier(e.channel);return(null==i?void 0:i.value)===t&&!i.delivered},i=e.filter(t);i.length&&(this.persistence.refreshMetaIdentifiers(),i.filter(t).forEach(e=>e.channel.register(e.value,!0)))}}capture(e,t,s){var r,n,o,a,l,d,u,_;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue)if(this.is_capturing())if(!yt(e)&&bt(e)){if(this._syncCookielessIdentity(),"$snapshot"!==e||!this._inCookielessMode()){var c=!this.config.opt_out_useragent_filter&&this._is_bot();if(c&&!this.config.__preview_capture_bot_pageviews)return this._botFilterWarned||(this._botFilterWarned=!0,console.warn("[PostHog.js] Events are being dropped because the user agent looks like a bot. Set `opt_out_useragent_filter: true` to capture them, e.g. in end-to-end tests. Note that logs from `captureLog` are not subject to this filter.")),void Zi.info('Event "'+e+'" was not captured because the user agent looks like a bot. Set `opt_out_useragent_filter: true` to capture it.');var h=null!=s&&s.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==h||!h.isRateLimited){var p;null!=t&&t.$current_url&&!bt(null==t?void 0:t.$current_url)&&(Zi.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==t||delete t.$current_url),"$exception"!==e||null!=s&&s._originatedFromCaptureException||Zi.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&&(p=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 g=new Date,v=(null==s?void 0:s.timestamp)||g,f=Ni(null==s?void 0:s.uuid,fs),m={uuid:f,event:e,properties:this.calculateEventProperties(e,t||{},v,f)};"$pageview"===e&&this.config.__preview_capture_bot_pageviews&&c&&(m.event="$bot_pageview",m.properties.$browser_type="bot"),h&&(m.properties.$lib_rate_limit_remaining_tokens=h.remainingTokens);var y="$feature_flag_called"===e&&!1===m.properties.$feature_flag_has_experiment&&!0===this.get_property("$minimal_flag_called_events");null!=s&&s.$set&&!y&&(m.$set=null==s?void 0:s.$set);var b=ft(null==t?void 0:t.$set)?t.$set:void 0,w=gt(null==t?void 0:t.$unset)?t.$unset:[],S=(null==s?void 0:s.$unset)||[],P=e=>{var t,i=!(null==s||!s.$set)&&e in s.$set;return{hasProvided:i||!!b&&e in b,provided:i?null==s||null==(t=s.$set)?void 0:t[e]:null==b?void 0:b[e],unset:-1!==w.indexOf(e)||-1!==S.indexOf(e)}};this.persistence.refreshMetaIdentifiersBeforeCapture();var k=P(Y),C=P(X),I=[{channel:this._facebookClickIdChannel,hasProvided:k.hasProvided,update:this._updateFacebookClickId(null==(r=p)?void 0:r.fbclid,k.provided,k.hasProvided,k.unset)},{channel:this._facebookBrowserIdChannel,hasProvided:C.hasProvided,update:this._updateFacebookBrowserId(C.provided,C.hasProvided,C.unset)}];for(var E of I){var x=E.channel,T=E.update;T&&!0===m.properties.$process_person_profile&&T.pending&&!E.hasProvided&&!y&&(m.$set=i({[x.property]:T.value},m.$set))}var F=null==s?void 0:s.$unset;F&&(m.$unset=F);var R=y?void 0:this._calculate_set_once_properties(null==s?void 0:s.$set_once,e!==ot,e===nt);if(R&&(m.$set_once=R),null!=s&&s._noTruncate||(l=this.config.properties_string_max_length,d=m,u=e=>bt(e)?e.slice(0,l):e,_=new Set,m=function e(t,i){if(t!==Object(t))return u?u(t):t;if(!_.has(t)){var s;if(_.add(t),gt(t))s=[],ts(t,t=>{s.push(e(t))});else{var r={};is(Tt(t)?os(t):t,(t,i)=>{_.has(t)||(r[i]=e(t,i))}),s=r}return s}}(d)),m.timestamp=v,yt(null==s?void 0:s.timestamp)||(m.properties.$event_time_override_provided=!0,m.properties.$event_time_override_system_time=g),y&&(m.properties=function(e,t){void 0===t&&(t=[]);var i={},s=t=>{void 0!==e[t]&&(i[t]=e[t])};return Hi.forEach(s),t.forEach(s),i}(m.properties,Ho)),e===Nr.DISMISSED||e===Nr.SENT){var O=null==t?void 0:t[Br.SURVEY_ID],M=null==t?void 0:t[Br.SURVEY_ITERATION];(e=>{try{var t=(e=>((e,t)=>"seenSurvey_"+function(e){return e.current_iteration&&e.current_iteration>0?e.id+"_"+e.current_iteration:e.id}(t))(0,e))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(e){mo.error("Failed to persist survey seen state",e)}})({id:O,current_iteration:M}),m.$set=i({},m.$set,{[uo({id:O,current_iteration:M},e===Nr.SENT?"responded":"dismissed")]:!0})}else e===Nr.SHOWN&&(m.$set=i({},m.$set,{[Br.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(e===Gr.SHOWN){var A=null==t?void 0:t[Wr.TOUR_TYPE];A&&(m.$set=i({},m.$set,{[Wr.TOUR_LAST_SEEN_DATE+"/"+A]:(new Date).toISOString()}))}var D=i({},m.properties.$set,m.$set);if(mt(D)||this.setPersonPropertiesForFlags(D),!Pt(this.config.before_send)){var L=this._runBeforeSend(m);if(!L)return;(m=L).uuid=Ni(m.uuid,fs)}this.sessionRecording&&!this._replayDebugPropertiesPaused&&No(e)&&(this._replayDebugPropertiesPaused=!0,setTimeout(()=>this._replayDebugPropertiesPaused=!1,3e4));var N=[];I.forEach(e=>{var t,i,s,r=e.channel,n=e.update,o=null!==(t=null==(i=m.$set)?void 0:i[r.property])&&void 0!==t?t:ft(null==(s=m.properties)?void 0:s.$set)?m.properties.$set[r.property]:void 0;null!=n&&n.pending&&o===n.value&&N.push({channel:r,value:n.value})}),this._internalEventEmitter.emit("eventCaptured",m);var B,U,q=null!==(n=null==s?void 0:s._url)&&void 0!==n?n:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),H="recordings"===(null==s?void 0:s._batchKey)||/\/s\/(?:\?|$)/.test(q),G=i({method:"POST",url:q,data:m,compression:"best-available",preferSyncCompression:null==s?void 0:s.send_instantly,timestampMode:H?"body":"capture-body",batchKey:null==s?void 0:s._batchKey},H&&null!=(o=m.properties)&&o.$session_id?{batchGroup:m.properties.$session_id+(m.properties.$window_id?"-"+m.properties.$window_id:"")}:{},null!=s&&s.transport?{transport:s.transport}:{},N.length?{fireCallbackOnDrop:!0,callback:e=>{e.statusCode>=200&&300>e.statusCode&&this._markMetaIdentifiersDelivered(N)}}:{});return!this.config.request_batching||s&&(null==s||!s._batchKey)||null!=s&&s.send_instantly?(!G.transport&&!G.callback&&mt(null!==(B=this.config.request_headers)&&void 0!==B?B:{})&&this._isPageUnloading&&(U="sendBeacon"),this._send_retriable_request(G,U)):this._requestQueue.enqueue(G),null==(a=this.featureFlags)||a.sendFlagCallsPendingCapture(),m}Zi.critical("This capture call is ignored due to client rate limiting.")}}else Zi.error("No event name provided to posthog.capture");else Zi.info('Event "'+e+'" was not captured because capturing is disabled (opted out or consent pending).');else Zi.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",t=>e(t.event,t))}getExtension(e){var t;return null==(t=this._browserClientAdapter)?void 0:t.getExtension(e)}_getBrowserClientAdapter(){var e;return null!==(e=this._browserClientAdapter)&&void 0!==e?e:this._browserClientAdapter=new xo(this)}_registerExtensionEventProperties(e){this._extensionEventPropertyProducers.push(e);var t=!0;return()=>{if(t){t=!1;var i=this._extensionEventPropertyProducers.indexOf(e);-1!==i&&this._extensionEventPropertyProducers.splice(i,1)}}}_processCookieIdentityChange(e){var t;return void 0===e&&(e=!0),!(null==(t=this.persistence)||!t.consumeCookieIdentityChange()||(this._processIdentityChange(e),0))}_processIdentityChange(e){var t,i,s;void 0===e&&(e=!0),this._cachedPersonProperties=null,"anonymous"===(null==(t=this.persistence)?void 0:t.get_property("$user_state"))&&(null==(s=this.sessionPersistence)||s.clear(),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys()),null==(i=this.featureFlags)||i.reset(),e&&this.reloadFeatureFlags()}calculateEventProperties(e,t,s,r,n){if(s=s||new Date,!this.persistence||!this.sessionPersistence)return t;this._syncCookielessIdentity(),this.persistence.syncCookieProperties(),this._processCookieIdentityChange();var a=n?void 0:this.persistence.remove_event_timer(e),d=i({},t);if(d.token=this.config.token,d.$config_defaults="latest"===this.config.defaults?Wo:this.config.defaults,this._inCookielessMode()&&(d[Ue]=!0),"$snapshot"===e){var u=i({},this.persistence.properties(),this.sessionPersistence.properties());return d.distinct_id=u.distinct_id,(!bt(d.distinct_id)&&!kt(d.distinct_id)||wt(d.distinct_id))&&Zi.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),d}var h,p,g=function(e,t,i,s){var r,n,a,d;if(void 0===s&&(s=!1),!f)return{};var u,_=e?[...rr,...t||[]]:[],h=function(e){for(var t=0;Oi.length>t;t++){var i=Oi[t],s=i[1],r=i[0].exec(e),n=r&&(vt(s)?s(r,e):s);if(n)return n}return["",""]}(f),p=h[0],g=h[1],v=function(e){for(var t=0;Di.length>t;t++){var i,s=Di[t],r=s[1],n=s[2],o=e.match(s[0]);if(o)return[r,(null==(i=n&&e.match(n)||o)?void 0:i[1])||""]}return["",""]}(f),m=v[0],y=v[1],b=null!=(u="u">typeof navigator?navigator:void 0)&&u.brave?{brave:!0}:{},w={};yt(i)||(w.detectGoogleSearchApp=i);var S={},P=null==(r=navigator)||null==(r=r.userAgentData)?void 0:r.platform,k=null==(n=navigator)?void 0:n.maxTouchPoints,C=null==l||null==(a=l.screen)?void 0:a.width,I=null==l||null==(d=l.screen)?void 0:d.height,E=null==l?void 0:l.devicePixelRatio;yt(P)||(S.userAgentDataPlatform=P),yt(k)||(S.maxTouchPoints=k),yt(C)||(S.screenWidth=C),yt(I)||(S.screenHeight=I),yt(E)||(S.devicePixelRatio=E);var x,T,F,R,O,M,A,D,L=ss(ns({$os:p,$os_version:g,$browser:$i(f,navigator.vendor,b,w),$webview_app:m,$webview_app_version:y,$device:Mi(f),$device_type:(T=f,F=S,D=Mi(T),D===qt||D===Ut||"Kobo"===D||"Kindle Fire"===D||D===di?Bt:D===ei||D===ii||D===ti||D===li?"Console":D===Ht?"Wearable":D?Lt:"Android"===(null==F?void 0:F.userAgentDataPlatform)&&(null!==(R=null==F?void 0:F.maxTouchPoints)&&void 0!==R?R:0)>0?600>Math.min(null!==(O=null==F?void 0:F.screenWidth)&&void 0!==O?O:0,null!==(M=null==F?void 0:F.screenHeight)&&void 0!==M?M:0)/(null!==(A=null==F?void 0:F.devicePixelRatio)&&void 0!==A?A:1)?Lt:Bt:"Desktop"),$timezone:Zs(),$timezone_offset:gr()}),{$current_url:sr(s?Ui(null==c?void 0:c.href):null==c?void 0:c.href,_,or),$host:null==c?void 0:c.host,$pathname:null==c?void 0:c.pathname,$raw_user_agent:f.length>1e3?f.substring(0,997)+"...":f,$browser_version:Ri(f,navigator.vendor,b,w),$browser_language:ur(),$browser_language_prefix:(x=ur(),"string"==typeof x?x.split("-")[0]:void 0),$screen_height:null==l?void 0:l.screen.height,$screen_width:null==l?void 0:l.screen.width,$viewport_height:null==l?void 0:l.innerHeight,$viewport_width:null==l?void 0:l.innerWidth,$lib:o.LIB_NAME,$lib_version:o.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return o.SDK_DIST_CHANNEL&&(L.$sdk_dist_channel=o.SDK_DIST_CHANNEL),L}(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 v=this.sessionManager.checkAndGetSessionAndWindowId(n,s.getTime(),!0),m=v.windowId;d.$session_id=v.sessionId,d.$window_id=m}this.sessionPropsManager&&ss(d,this.sessionPropsManager.getSessionProps());try{var y;if(this.sessionRecording){var b=this.sessionRecording.sdkDebugProperties,w=!this._replayDebugPropertiesPaused&&No(e);for(var S in b)(w||ut(Do,S))&&(d[S]=b[S])}h=null==(y=this._retryQueue)?void 0:y.length}catch(e){d.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===ho&&(d.$lib_custom_api_host=this.config.api_host),p="$pageview"!==e||n?"$pageleave"!==e||n?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(s):this.pageViewManager.doPageView(s,r),d=ss(d,p),"$pageview"===e&&_&&(d.title=_.title),!yt(a)){var P=s.getTime()-a;d.$duration=parseFloat((P/1e3).toFixed(3))}f&&this.config.opt_out_useragent_filter&&(d.$browser_type=this._is_bot()?"bot":"browser");var k=this.persistence.properties(),C=this.sessionPersistence.properties(),I=d.$groups,E=k.$groups;ft(I)&&!mt(I)&&(d.$groups=i({},ft(E)?E:{},I)),is(["$referrer","$referring_domain"],e=>{e in k&&delete C[e]});var x={};if(this._extensionEventPropertyProducers.length>0)for(var T of this._extensionEventPropertyProducers.slice())try{ss(x,T())}catch(e){Zi.error("Failed to produce browser extension event properties",e)}d=ss({},g,k,C,i({},x,d)),h?d.$sdk_debug_retry_queue_size=h:delete d.$sdk_debug_retry_queue_size,d.$is_identified=this._isIdentified(),gt(this.config.property_denylist)?is(this.config.property_denylist,function(e){delete d[e]}):Zi.error(Ao+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var F=this.config.sanitize_properties;F&&(Zi.error(Mo),d=F(d,e));var R=this._hasPersonProcessing();return d.$process_person_profile=R,R&&!n&&this._requirePersonProcessing("_calculate_event_properties"),d}_calculate_set_once_properties(e,t,i){var s;if(void 0===t&&(t=!0),void 0===i&&(i=!1),!this.persistence||!this._hasPersonProcessing())return e;if(this._personProcessingSetOncePropertiesSent&&!i)return e;var r=ss({},this.persistence.get_initial_props(),(null==(s=this.sessionPropsManager)?void 0:s.getSetOnceProps())||{},e||{}),n=this.config.sanitize_properties;return n&&(Zi.error(Mo),r=n(r,"$set_once")),t&&(this._personProcessingSetOncePropertiesSent=!0),mt(r)?void 0:r}register(e,t){var i;null==(i=this.persistence)||i.register(e,t)}register_once(e,t,i){var s;null==(s=this.persistence)||s.register_once(e,t,i)}register_for_session(e){var t,i;null==(t=this.persistence)||t.syncCookieProperties(),this._processCookieIdentityChange(),null==(i=this.sessionPersistence)||i.register(e),Object.keys(e).forEach(e=>this._sessionRegisteredPropKeys.add(e)),this._persistSessionRegisteredPropKeys()}unregister(e){var t;null==(t=this.persistence)||t.unregister(e)}unregister_for_session(e){var t;null==(t=this.sessionPersistence)||t.unregister(e),this._sessionRegisteredPropKeys.delete(e),this._persistSessionRegisteredPropKeys()}_register_single(e,t){this.register({[e]:t})}_clearSessionRegisteredProps(){this._sessionRegisteredPropKeys.forEach(e=>{var t;null==(t=this.sessionPersistence)||t.unregister(e)}),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys()}_persistSessionRegisteredPropKeys(){var e;if(this._sessionRegisteredPropertiesStorageKey)if("memory"===this.config.persistence||null!=(e=this.sessionPersistence)&&e._disabled||!Ns._is_supported())Ns._remove(this._sessionRegisteredPropertiesStorageKey);else{var t=[];this._sessionRegisteredPropKeys.forEach(e=>t.push(e)),t.length>0?Ns._set(this._sessionRegisteredPropertiesStorageKey,t):Ns._remove(this._sessionRegisteredPropertiesStorageKey)}}getFeatureFlag(e,t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return null==(t=this.featureFlags)?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagResult(e,t)}getAllFeatureFlags(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.getAllFeatureFlags())&&void 0!==e?e:[]}isFeatureEnabled(e,t){var i,s;return null!==(i=null==(s=this.featureFlags)?void 0:s.isFeatureEnabled(e,t))&&void 0!==i?i:null==t?void 0:t.defaultValue}reloadFeatureFlags(){var e;null==(e=this.featureFlags)||e.reloadFeatureFlags()}updateFlags(e,t,i){var s;null==(s=this.featureFlags)||s.updateFlags(e,t,i)}updateEarlyAccessFeatureEnrollment(e,t,i){var s;null==(s=this.featureFlags)||s.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t,i){var s;return void 0===t&&(t=!1),null==(s=this.featureFlags)?void 0:s.getEarlyAccessFeatures(e,t,i)}on(e,t){return this._internalEventEmitter.on(e,t)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:Oo}),()=>{})}onSessionId(e){var t,i;return null!==(t=null==(i=this.sessionManager)?void 0:i.onSessionId(e))&&void 0!==t?t:()=>{}}getSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:Oo})}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:Oo})}onActiveMatchingSurveysChanged(e){return this.surveys?this.surveys.onActiveMatchingSurveysChanged(e):(e([],{isLoaded:!1,error:Oo}),()=>{})}renderSurvey(e,t){var i;null==(i=this.surveys)||i.renderSurvey(e,t)}displaySurvey(e,t){var i;void 0===t&&(t=yo),null==(i=this.surveys)||i.displaySurvey(e,t)}cancelPendingSurvey(e){var t;null==(t=this.surveys)||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,i;return null!==(t=null==(i=this.surveys)?void 0:i.canRenderSurvey(e))&&void 0!==t?t:{visible:!1,disabledReason:Oo}}canRenderSurveyAsync(e,t){var i,s;return void 0===t&&(t=!1),null!==(i=null==(s=this.surveys)?void 0:s.canRenderSurveyAsync(e,t))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:Oo})}_validateIdentifyId(e){return!e||wt(e)?(Zi.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===e?(Zi.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(Zi.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(e,t,i){if(!this.__loaded||!this.persistence)return Zi.uninitializedWarning("posthog.identify");if(kt(e)&&(e=e.toString(),Zi.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this._validateIdentifyId(e)&&this._requirePersonProcessing("posthog.identify")){this._syncCookielessIdentity();var s=this.get_distinct_id(),r=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==s,n=this._processCookieIdentityChange(!1),o=this.persistence._beginCookieSyncSuppression(),a=!1;try{var l=this.get_distinct_id();this.register({$user_id:e}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:l},""),e!==l&&e!==this.get_property("__alias")&&(this.unregister(K),this.register({distinct_id:e}));var d=(this.persistence.get_property("$user_state")||"anonymous")===Ze,u=e!==l,_=!u&&d;if(u&&d){var c,h=this.config.reuseAnonymousId?{distinct_id:e}:{distinct_id:e,$anon_distinct_id:l};this.persistence.set_property(Re,et),this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence._publishSuppressedCookieSnapshot(),this.capture("$identify",h,{$set:t||{},$set_once:i||{}})&&(this._cachedPersonProperties=_o(e,t,i)),null==(c=this.featureFlags)||c.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:l)}else if(_){this.persistence.set_property(Re,et);var p=t||{},g=i||{};this.setPersonPropertiesForFlags({$set:p,$set_once:g},!1),this.config.cookieWinsOnConflict&&this.persistence._publishSuppressedCookieSnapshot(),this.capture("$set",{$set:p,$set_once:g})&&(this._cachedPersonProperties=_o(e,t,i))}else(t||i)&&this.setPersonProperties(t,i);u||r||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(R)):_&&(t||i)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence._endCookieSyncSuppression(a)}}}setPersonProperties(e,t){if((e||t)&&this._requirePersonProcessing("posthog.setPersonProperties")){var i=_o(this.get_distinct_id(),e,t);this._cachedPersonProperties!==i?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}})&&(this._cachedPersonProperties=i)):Zi.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(e){var t,i=(gt(e)?e:[e]).filter(e=>bt(e)&&e.length>0);0!==i.length&&this._requirePersonProcessing("posthog.unsetPersonProperties")&&(null==(t=this.featureFlags)||t.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this._cachedPersonProperties=null)}group(e,t,s){var r;if(e&&t){null==(r=this.persistence)||r.syncCookieProperties(),this._processCookieIdentityChange();var n=this.getGroups(),o=n[e]!==t;if(o&&this.resetGroupPropertiesForFlags(e),this.register({$groups:i({},n,{[e]:t})}),(o||s)&&this._hasPersonProcessing()){var a={$group_type:e,$group_key:t};s&&(a.$group_set=s),this.capture(ot,a)}s&&this.setGroupPropertiesForFlags({[e]:s}),o&&!s&&this.reloadFeatureFlags()}else Zi.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){var i;void 0===t&&(t=!0),null==(i=this.featureFlags)||i.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(e){var t;void 0===e&&(e=!0),null==(t=this.featureFlags)||t.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,t){var i;void 0===t&&(t=!0),this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;null==(t=this.featureFlags)||t.resetGroupPropertiesForFlags(e)}reset(e){var t=It(e)?e:null==e?void 0:e.resetDeviceID,i=It(e)||null==e?void 0:e.bootstrap;this._reset(t,!1,i)}_reset(e,t,s){var r,n,o,a,l;if(void 0===t&&(t=!1),Zi.info("reset"),!this.__loaded)return Zi.uninitializedWarning("posthog.reset");var d=null==s?void 0:s.sessionID;this.config.bootstrap=s||(null==(r=this._originalUserConfig)?void 0:r.bootstrap)||{},null==(n=this.featureFlags)||null==n.updateConfig||n.updateConfig(this.config,this._shouldDisableFlags());var u=this.get_property(j),_=this.get_property(z),c=this.get_property(ue);null==(o=this.sessionRecording)||o.flushBeforeIdentityReset();var h=this.is_capturing();t||this.consent.reset(),t||!h||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 p=null==(a=this.persistence)||null==a._beginCookieSyncSuppression?void 0:a._beginCookieSyncSuppression(),g=this._isConsentTransition;this._isConsentTransition=g||t;var v=!1;try{var f,m,y,b,w,S,P,k,C,I,E,x,T;if(null==(f=this.persistence)||f.clear(),null==(m=this.sessionPersistence)||m.clear(),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys(),yt(c)||null==(y=this.persistence)||y.register({[ue]:c}),null==(b=this.surveys)||b.reset(),null==(w=this.featureFlags)||w.reset(),null==(S=this.conversations)||S.reset(),null==(P=this.logs)||P.reset(),null==(k=this.metrics)||k.reset(),null==(C=this.persistence)||C.set_property(Re,Ze),null==(I=this.sessionManager)||I.resetSessionId(),this._cachedPersonProperties=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:Be,$device_id:null},"");else{var F=this.config.get_device_id(fs());this.register_once({distinct_id:F,$device_id:e?F:u},""),e||yt(_)||this.register({[z]:_})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),s)if(s.distinctID&&!this._inCookielessMode()&&(null==(T=this.persistence)||T.set_property(Re,s.isIdentifiedID?et:Ze),this.register({distinct_id:s.distinctID})),null==(E=this.featureFlags)||E.initialize(),!(Pt(d)||null!=(x=this.sessionManager)&&x.setBootstrapSessionId(d,!0))){var R=i({},s);delete R.sessionID,this.config.bootstrap=R}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,v=!0}finally{var O;this._isConsentTransition=g,p&&(null==(O=this.persistence)||null==O._endCookieSyncSuppression||O._endCookieSyncSuppression(v))}this._lastRemoteConfig&&(null==(l=this.conversations)||l.onRemoteConfig(this._lastRemoteConfig)),this.reloadFeatureFlags()}shutdown(e){var t=this;return r(function*(){if(t.__loaded){t._isShutdown=!0,clearTimeout(t._extensionInitTimeout),t._extensionInitTimeout=void 0;var e=t._featureFlagsReloadingUnsubscribe;for(var i of(t._featureFlagsReloadingUnsubscribe=void 0,[()=>{var e;return null==(e=t.sessionRecording)?void 0:e.dispose()},()=>{var e;return null==(e=t.logs)?void 0:e.flushLogs("sendBeacon")},()=>{var e;return null==(e=t.metrics)?void 0:e.flush("sendBeacon")},()=>{var e;return null==(e=t.metrics)?void 0:e.dispose()},()=>{var e;return null==(e=t.logs)?void 0:e.dispose()},()=>{var e;return null==(e=t.surveys)?void 0:e.dispose()},()=>{var e;return null==(e=t.autocapture)?void 0:e.dispose()},()=>null==e?void 0:e(),()=>{var e;return null==(e=t._requestQueue)?void 0:e.unload()},()=>{var e;return null==(e=t._retryQueue)?void 0:e.unload()},()=>{var e;return null==(e=t.featureFlags)?void 0:e.destroy()},()=>{var e;return null==(e=t.persistence)?void 0:e.destroy()},()=>{var e;return null==(e=t.sessionPersistence)?void 0:e.destroy()}]))try{var s=i();s&&vt(s.then)&&s.then(void 0,e=>{Zi.error("Error during shutdown",e)})}catch(e){Zi.error("Error during shutdown",e)}}else Zi.uninitializedWarning("posthog.shutdown")})()}setIdentity(e,t){var i;delete this.config.identity_claims,this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),null==(i=this.conversations)||i._onIdentityChanged()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,null==(e=this.conversations)||e._onIdentityCleared()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return null!==(e=null==(t=this.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==e?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var t=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=t.sessionStartTimestamp,s=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t.sessionId);if(null!=e&&e.withTimestamp&&i){var r,n=null!==(r=e.timestampLookBack)&&void 0!==r?r:10;if(!i)return s;s+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return s}alias(e,t){return e===this.get_property("$people_distinct_id")?(Zi.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(yt(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(K,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(Zi.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=i({},this.config);if(ft(e)){var s,r,n,o,l,d,u,_,c,h,p,g,v,f;ss(this.config,Ko(e));var m=this._is_persistence_disabled();if(this.persistence){var y,b,w,S="sessionStorage"===this.config.persistence||"memory"===this.config.persistence;S&&this.sessionPersistence!==this.persistence&&(null==(b=this.sessionPersistence)||b.remove(),null==(w=this.sessionPersistence)||w.destroy()),this.persistence.update_config(this.config,t,m),S?this.sessionPersistence=this.persistence:this.sessionPersistence===this.persistence?this.sessionPersistence=new xr(i({},this.config,{persistence:"sessionStorage"}),m,!1):null==(y=this.sessionPersistence)||y.update_config(i({},this.config,{persistence:"sessionStorage"}),i({},t,{persistence:"sessionStorage"}),m)}var P=this._checkLocalStorageForDebug(this.config.debug);It(P)&&(this.config.debug=P),It(this.config.debug)&&(this.config.debug?(a.DEBUG=!0,ks._is_supported()&&ks._set("ph_debug",!0),Zi.info("set_config",{config:e,oldConfig:t,newConfig:i({},this.config)})):(a.DEBUG=!1,ks._is_supported()&&ks._remove("ph_debug"))),null==(s=this.featureFlags)||null==s.updateConfig||s.updateConfig(this.config,this._shouldDisableFlags()),null==(r=this.exceptionObserver)||r.onConfigChange(),null==(n=this.exceptions)||n.onConfigChange(),null==(o=this.metrics)||o.onConfigChange(),null==(l=this.webMCP)||l.startIfEnabled(),null==(d=this.sessionRecording)||d.startIfEnabledOrStop(),null==(u=this.tracingHeaders)||u.startIfEnabledOrStop(),null==(_=this.autocapture)||_.startIfEnabled(),null==(c=this.heatmaps)||c.startIfEnabled(),("capture_pageview"in e||"disable_capture_url_hashes"in e)&&(null==(h=this.historyAutocapture)||h.startIfEnabledOrStop()),null==(p=this.exceptionObserver)||p.startIfEnabledOrStop(),null==(g=this.deadClicksAutocapture)||g.startIfEnabledOrStop(),null==(v=this.surveys)||v.loadIfEnabled(),this._sync_opt_out_with_persistence(),null==(f=this.externalIntegrations)||f.startIfEnabledOrStop(),!t.segment&&this.config.segment&&this.persistence&&Ws(this,Fo,!1)}}_overrideSDKInfo(e,t){a.LIB_NAME=e,a.LIB_VERSION=t}startSessionRecording(e){var t,i,s,r,n,o=!0===e,a={sampling:o||!(null==e||!e.sampling),linked_flag:o||!(null==e||!e.linked_flag),url_trigger:o||!(null==e||!e.url_trigger),event_trigger:o||!(null==e||!e.event_trigger)};Object.values(a).some(Boolean)&&(null==(t=this.sessionManager)||t.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(s=this.sessionRecording)||s.overrideLinkedFlag()),a.url_trigger&&(null==(r=this.sessionRecording)||r.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 e;return!(null==(e=this.sessionRecording)||!e.started)}captureException(e,t){try{if(!this.exceptions)return;var s=this.exceptions.buildProperties(e,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(i({},s,t))}catch(e){return}}addExceptionStep(e,t){var i;null==(i=this.exceptions)||i.addExceptionStep(e,t)}captureLog(e){var t;null==(t=this.logs)||t.captureLog(e)}get logger(){var t,i;return null!==(t=null==(i=this.logs)?void 0:i.logger)&&void 0!==t?t:e._noopLogger}startExceptionAutocapture(e){this.set_config({capture_exceptions:null==e||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,i;return null!==(t=null==(i=this.toolbar)?void 0:i.loadToolbar(e))&&void 0!==t&&t}get_property(e){var t;return null==(t=this.persistence)?void 0:t.props[e]}getSessionProperty(e){var t;return null==(t=this.sessionPersistence)?void 0:t.props[e]}toString(){var e,t=null!==(e=this.config.name)&&void 0!==e?e:Go;return t!==Go&&(t="posthog."+t),t}_isIdentified(){var e,t;return"identified"===(null==(e=this.persistence)?void 0:e.get_property("$user_state"))||"identified"===(null==(t=this.sessionPersistence)?void 0:t.get_property("$user_state"))}_hasPersonProcessing(){var e,t;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&mt(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e.__alias)&&(null==(t=this.persistence)||null==(t=t.props)||!t.$epp))}_shouldCapturePageleave(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this._hasPersonProcessing()||this._requirePersonProcessing("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this._requirePersonProcessing("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}_requirePersonProcessing(e){return"never"===this.config.person_profiles?(Zi.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._warnIfVolatileIdentityWithoutStableId(),this._register_single(Ne,!0),!0)}_is_persistence_disabled(){if("always"===this.config.cookieless_mode)return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&"on_reject"!==this.config.cookieless_mode)}_sync_opt_out_with_persistence(){var e,t,i,s,r,n=this._is_persistence_disabled();return this.is_capturing()||null==(e=this.logs)||e._onOptOut(),(null==(t=this.persistence)?void 0:t._disabled)!==n&&(null==(i=this.persistence)||i.set_disabled(n)),(null==(s=this.sessionPersistence)?void 0:s._disabled)!==n&&(null==(r=this.sessionPersistence)||r.set_disabled(n)),this._persistSessionRegisteredPropKeys(),n}opt_in_capturing(t){var i,s,r,n;if("always"!==this.config.cookieless_mode){if(this._inCookielessMode()){var o,a,l,d,u,_;null==(o=this.sessionRecording)||o.dispose({discardBufferedEvents:!0}),this._reset(!0,!0),null==(a=this.sessionManager)||a.destroy(),null==(l=this.pageViewManager)||l.destroy(),this.sessionManager=new oo(this),this.pageViewManager=new Ks(this),this.persistence&&(this.sessionPropsManager=new io(this,this.sessionManager,this.persistence));var c,h=null!==(d=null==(u=this.config.__extensionClasses)?void 0:u.sessionRecording)&&void 0!==d?d:null==(_=e.__defaultExtensionClasses)?void 0:_.sessionRecording;h&&(this.sessionRecording=this._replaceExtension(this.sessionRecording,new h(this)),this._lastRemoteConfig&&(null==(c=this.sessionRecording)||null==c.onRemoteConfig||c.onRemoteConfig(this._lastRemoteConfig)))}var p,g,v=1===this.consent.consent;v&&this._syncCookielessIdentity(),this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),this._start_queue_if_opted_in(),null==(i=this.sessionRecording)||i.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null==(p=this.surveys)||p.loadIfEnabled(),null==(g=this.conversations)||g.loadIfEnabled()),!v&&(yt(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)&&this.capture(null!==(s=null==t?void 0:t.captureEventName)&&void 0!==s?s:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),null==(r=this.persistence)||r.syncCookieProperties(),this._processCookieIdentityChange(),null==(n=this.featureFlags)||n.sendFlagCallsPendingCapture(),this.config.capture_pageview&&this._captureInitialPageview()}else Zi.warn(Ro)}opt_out_capturing(){"always"!==this.config.cookieless_mode?(this.consent.optInOut(!1),this._sync_opt_out_with_persistence(),"on_reject"===this.config.cookieless_mode&&this._enterCookielessMode()):Zi.warn(Ro)}_enterCookielessMode(){var e,t,i=this.sessionRecording;null==i||i.dispose({discardBufferedEvents:!0}),"$posthog_cookieless"!==this.get_distinct_id()&&this._reset(!0,!0),this.register({distinct_id:Be,$device_id:null}),this._removeExtension(i),this.sessionRecording=void 0,null==(e=this.sessionManager)||e.destroy(),null==(t=this.pageViewManager)||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this._captureInitialPageview(),this._start_queue_if_opted_in()}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return 1===e?"granted":0===e?"denied":"pending"}is_capturing(){return!this._isConsentTransition&&("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._sync_opt_out_with_persistence()}_is_bot(){return u?function(e,t){if(!e)return!1;var i=e.userAgent;if(i&&At(i,t))return!0;try{var s=null==e?void 0:e.userAgentData;if(null!=s&&s.brands&&s.brands.some(e=>At(null==e?void 0:e.brand,t)))return!0}catch(e){}return!!e.webdriver}(u,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){_&&("visible"===_.visibilityState?this._initialPageviewCaptured||(this._initialPageviewCaptured=!0,this.capture(st,{title:_.title},{send_instantly:!0}),this._visibilityStateListener&&(_.removeEventListener(L,this._visibilityStateListener),this._visibilityStateListener=null)):this._visibilityStateListener||(this._visibilityStateListener=this._captureInitialPageview.bind(this),ds(_,L,this._visibilityStateListener)))}debug(e){!1===e?(null==l||l.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==l||l.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 e=this._originalUserConfig||{};return"advanced_disable_flags"in e?!!e.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(Zi.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(e,t,i,s,r){var n=t in e&&!Pt(e[t]),o=i in e&&!Pt(e[i]);return n?e[t]:!!o&&(r&&r.warn("Config field '"+i+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[i])}(e,"advanced_disable_flags","advanced_disable_decide",0,Zi)}_runBeforeSend(e){var t;if(Pt(this.config.before_send))return e;var i=Object.keys(null!==(t=e.properties)&&void 0!==t?t:{}).filter(xt),s=gt(this.config.before_send)?this.config.before_send:[this.config.before_send],r=e;for(var n of s)try{if(r=n(r),Pt(r)){var o="Event '"+e.event+"' was rejected in beforeSend function";return Et(e.event)?Zi.warn(o+". This can cause unexpected behavior."):Zi.info(o),null}r.properties&&!mt(r.properties)||Zi.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}catch(t){return Zi.error("Error in beforeSend function for event '"+e.event+"':",t),null}for(var a of i)if(r.properties&&Pt(r.properties[a]))return Zi.warn("Event '"+e.event+"' had its '"+a+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return r}getPageViewId(){var e;return null==(e=this.pageViewManager._currentPageview)?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}_checkLocalStorageForDebug(e){var t=It(e)&&!e,i=ks._is_supported()&&"true"===ks._get("ph_debug");return!t&&(!!i||e)}},e.__defaultExtensionClasses={},e._noopLogger={trace:co=()=>{},debug:co,info:co,warn:co,error:co,fatal:co},e);!function(e,t){for(var i=0;t.length>i;i++)e.prototype[t[i]]=rs(e.prototype[t[i]])}(Yo,["identify"]);var Qo=function(){a.SDK_DIST_CHANNEL="npm";var e=To[Go]=new Yo;return function(){function e(){e.done||(e.done=!0,Yn=!1,is(To,function(e){e._dom_loaded()}))}null!=_&&_.addEventListener?"complete"===_.readyState?e():ds(_,"DOMContentLoaded",e,{capture:!1}):l&&Zi.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),e}();export{Tr as Compression,Hr as DEFAULT_PRODUCT_TOUR_APPEARANCE,Ur as DisplaySurveyType,Yo as PostHog,Gr as ProductTourEventName,Wr as ProductTourEventProperties,Nr as SurveyEventName,Br as SurveyEventProperties,$r as SurveyEventType,Rr as SurveyPosition,Dr as SurveyQuestionBranchingType,Ar as SurveyQuestionType,Lr as SurveySchedule,Or as SurveyTabPosition,Mr as SurveyType,Fr as SurveyWidgetType,Qo as default,Qo as posthog,Jr as severityLevels};
|
|
2
2
|
//# sourceMappingURL=module.slim.no-external.js.map
|