posthog-js 1.422.2 → 1.422.4
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.js.map +1 -1
- package/dist/array.no-external.js +1 -1
- package/dist/array.no-external.js.map +1 -1
- package/dist/conversations.js +1 -1
- package/dist/customizations.d.ts +11 -0
- package/dist/customizations.full.js +1 -1
- package/dist/customizations.js +1 -1
- package/dist/dead-clicks-autocapture.js +1 -1
- package/dist/dead-clicks-autocapture.js.map +1 -1
- package/dist/default-extensions.js +1 -1
- package/dist/default-extensions.js.map +1 -1
- package/dist/exception-autocapture.js +1 -1
- package/dist/extension-bundles.js +1 -1
- package/dist/extension-bundles.js.map +1 -1
- package/dist/lazy-recorder.js +1 -1
- package/dist/main.d.ts +11 -0
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/module.d.ts +11 -0
- package/dist/module.full.d.ts +11 -0
- package/dist/module.full.js +1 -1
- package/dist/module.full.js.map +1 -1
- package/dist/module.full.no-external.d.ts +11 -0
- 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.js.map +1 -1
- package/dist/module.no-external.d.ts +11 -0
- package/dist/module.no-external.js +1 -1
- package/dist/module.no-external.js.map +1 -1
- package/dist/module.slim.js +1 -1
- package/dist/module.slim.no-external.d.ts +11 -0
- package/dist/module.slim.no-external.js +1 -1
- package/dist/posthog-recorder.js +1 -1
- package/dist/product-tours-preview.js.map +1 -1
- package/dist/product-tours.js +1 -1
- package/dist/product-tours.js.map +1 -1
- package/dist/src/extensions/surveys/surveys-extension-utils.d.ts +4 -1
- package/dist/src/extensions/surveys.d.ts +11 -0
- package/dist/surveys-preview.js +1 -1
- package/dist/surveys-preview.js.map +1 -1
- package/dist/surveys.d.ts +11 -0
- package/dist/surveys.js +1 -1
- package/dist/surveys.js.map +1 -1
- package/lib/package.json +1 -1
- package/lib/src/extensions/surveys/surveys-extension-utils.d.ts +4 -1
- package/lib/src/extensions/surveys/surveys-extension-utils.js +10 -4
- package/lib/src/extensions/surveys/surveys-extension-utils.js.map +1 -1
- package/lib/src/extensions/surveys.d.ts +11 -0
- package/lib/src/extensions/surveys.js +120 -6
- package/lib/src/extensions/surveys.js.map +1 -1
- package/package.json +7 -7
package/dist/main.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";function t(t,e,i,r,s,n,o){try{var a=t[n](o),l=a.value}catch(t){return void i(t)}a.done?e(l):Promise.resolve(l).then(r,s)}function e(e){return function(){var i=this,r=arguments;return new Promise((function(s,n){var o=e.apply(i,r);function a(e){t(o,s,n,a,l,"next",e)}function l(e){t(o,s,n,a,l,"throw",e)}a(void 0)}))}}function i(){return i=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var i=arguments[e];for(var r in i)({}).hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t},i.apply(null,arguments)}function r(t,e){if(null==t)return{};var i={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==e.indexOf(r))continue;i[r]=t[r]}return i}Object.defineProperty(exports,"__esModule",{value:!0});var s={DEBUG:!1,LIB_VERSION:"0.6.1",LIB_NAME:"browser-common"};s.DEBUG=!1,s.LIB_VERSION="1.422.2",s.LIB_NAME="web";var n="$people_distinct_id",o="distinct_id",a="$device_id",l="$device_model",h="__alias",u="__timers",d="$autocapture_disabled_server_side",v="$heatmaps_enabled_server_side",c="$exception_capture_enabled_server_side",f="$error_tracking_suppression_rules",p="$error_tracking_capture_extension_exceptions",_="$web_vitals_enabled_server_side",g="$dead_clicks_enabled_server_side",m="$product_tours_enabled_server_side",y="$logs_capture_enabled_server_side",b="$web_vitals_allowed_metrics",w="$session_recording_remote_config",x="$replay_sample_rate",E="$replay_override_sampling",S="$replay_override_linked_flag",k="$replay_override_url_trigger",T="$replay_override_event_trigger",P="$sesid",R="$session_is_sampled",C="$enabled_feature_flags",O="$active_feature_flags",I="$early_access_features",A="$feature_flag_details",F="$feature_flag_payloads",M="$feature_flag_request_id",D="$minimal_flag_called_events",N="$override_feature_flags",L="$override_feature_flag_payloads",U="$stored_person_properties",j="$stored_group_properties",B="$groups",z="$surveys",q="$surveys_loaded_at",H="$surveys_activated",V="$surveys_activated_session",W="$surveys_activated_timestamps",G="ph_product_tours",K="$flag_call_reported",J="$flag_call_reported_session_id",Y="$feature_flag_errors",Q="$feature_flag_evaluated_at",X="$user_state",Z="$client_session_props",tt="$capture_rate_limit",et="$initial_campaign_params",it="$initial_referrer_info",rt="$initial_person_info",st="$epp",nt="$posthog_cookieless",ot="$cookieless_mode",at="$sdk_debug_extensions_init_method",lt="$sdk_debug_extensions_init_time_ms",ht="$sdk_debug_recording_script_not_loaded",ut="PostHog loadExternalDependency extension not found.",dt="on_reject",vt="always",ct="anonymous",ft="identified",pt="identified_only",_t="visibilitychange",gt="beforeunload",mt="$pageview",yt="$pageleave",bt="$identify",wt="$groupidentify",xt="undefined"!=typeof window?window:void 0,Et="undefined"!=typeof globalThis?globalThis:xt,St=null==Et?void 0:Et.navigator,kt=null==Et?void 0:Et.document,Tt=null==Et?void 0:Et.location,$t=null==Et?void 0:Et.fetch,Pt=null!=Et&&Et.XMLHttpRequest&&"withCredentials"in new Et.XMLHttpRequest?Et.XMLHttpRequest:void 0,Rt=null==Et?void 0:Et.AbortController,Ct=null==Et?void 0:Et.CompressionStream,Ot=null==St?void 0:St.userAgent;function It(){return!(!xt||!1===xt.navigator.onLine)}var At="undefined"!=typeof globalThis?globalThis:xt;At&&"undefined"==typeof self&&(At.self=At),At&&"undefined"==typeof File&&(At.File=function(){});var Ft=null!=xt?xt:{},Mt=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(e){return t}};function Dt(t){return"string"==typeof t||t}function Nt(t){return"string"==typeof t?t:void 0}var Lt=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],Ut=function(t){return t.AnonymousId="anonymous_id",t.DistinctId="distinct_id",t.Props="props",t.EnablePersonProcessing="enable_person_processing",t.PersonMode="person_mode",t.FeatureFlagDetails="feature_flag_details",t.FeatureFlags="feature_flags",t.FeatureFlagPayloads="feature_flag_payloads",t.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",t.BootstrapFeatureFlags="bootstrap_feature_flags",t.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",t.OverrideFeatureFlags="override_feature_flags",t.Queue="queue",t.AiQueue="ai_queue",t.AiCaptureQueue="ai_capture_queue",t.LogsQueue="logs_queue",t.OptedOut="opted_out",t.SessionId="session_id",t.SessionStartTimestamp="session_start_timestamp",t.SessionLastTimestamp="session_timestamp",t.PersonProperties="person_properties",t.GroupProperties="group_properties",t.InstalledAppBuild="installed_app_build",t.InstalledAppVersion="installed_app_version",t.SessionReplay="session_replay",t.PushRegistered="push_registered",t.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",t.SurveyLastSeenDate="survey_last_seen_date",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t}({}),jt=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),Bt=["$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"],zt=["token"],qt=20,Ht=1e3,Vt=1e4,Wt="[Circular]",Gt="[Truncated]",Kt="[Unserializable]",Jt="[Function]";function Yt(t){for(var e="",i=0;t.length>i;i++){var r=t.charCodeAt(i);if(55296>r||r>56319)e+=56320>r||r>57343?t[i]:"�";else{var s=t.charCodeAt(i+1);56320>s||s>57343?e+="�":(e+=t[i]+t[i+1],i++)}}return e}var Qt=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterestbot","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],Xt=function(t,e){if(void 0===e&&(e=[]),!t)return!1;var i=t.toLowerCase();return Qt.concat(e).some((t=>{var e=t.toLowerCase();return-1!==i.indexOf(e)}))};function Zt(t,e){return-1!==t.indexOf(e)}var te=function(t){return t.trim()},ee=function(t){return t.replace(/^\$/,"")};function ie(t){var e,i=[];return null!==(e=JSON.stringify(t,(function(t,e){if("bigint"==typeof e)return e.toString();if("function"!=typeof e&&"symbol"!=typeof e){if(e instanceof Error)return{name:e.name,message:e.message,stack:e.stack};if(e&&"object"==typeof e){for(;i.length>0&&i[i.length-1]!==this;)i.pop();if(i.includes(e))return"[Circular]";i.push(e)}return e}})))&&void 0!==e?e:"null"}var re=Object.prototype,se=re.hasOwnProperty,ne=re.toString,oe=Array.isArray||function(t){return"[object Array]"===ne.call(t)},ae=t=>"function"==typeof t,le=t=>t===Object(t)&&!oe(t),he=t=>{if(le(t)){for(var e in t)if(se.call(t,e))return!1;return!0}return!1},ue=t=>void 0===t,de=t=>"[object String]"==ne.call(t),ve=t=>de(t)&&0===t.trim().length,ce=t=>null===t,fe=t=>ue(t)||ce(t),pe=t=>"[object Number]"==ne.call(t)&&t==t,_e=t=>pe(t)&&t>0,ge=t=>"[object Boolean]"===ne.call(t),me=t=>t instanceof FormData,ye=t=>Zt(Bt,t),be=t=>Zt(zt,t);function we(t){return null===t||"object"!=typeof t}function xe(t,e){return{}.toString.call(t)==="[object "+e+"]"}function Ee(t){switch({}.toString.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return ke(t,Error)}}function Se(t){return"undefined"!=typeof Event&&ke(t,Event)}function ke(t,e){try{return t instanceof e}catch(t){return!1}}var Te=[!0,"true",1,"1","yes"],$e=t=>Zt(Te,t),Pe=[!1,"false",0,"0","no"];function Re(t,e,i,r,s){return e>i&&(r.warn("min cannot be greater than max."),e=i),pe(t)?t>i?(r.warn(" cannot be greater than max: "+i+". Using max value instead."),i):e>t?(r.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(r.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+s),Re(s||i,e,i,r))}class Ce{constructor(t){this.k={},this.S=t.S,this.C=Re(t.bucketSize,0,100,t.I),this.R=Re(t.refillRate,0,this.C,t.I),this.A=Re(t.refillInterval,0,864e5,t.I)}O(t,e){var i=Math.floor((e-t.lastAccess)/this.A);i>0&&(t.tokens=Math.min(t.tokens+i*this.R,this.C),t.lastAccess=t.lastAccess+i*this.A)}consumeRateLimit(t){var e,i=Date.now(),r=String(t),s=this.k[r];return s?this.O(s,i):this.k[r]=s={tokens:this.C,lastAccess:i},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(e=this.S)||e.call(this,t)),0===s.tokens)}stop(){this.k={}}}var Oe="Mobile",Ie="iOS",Ae="Android",Fe="Tablet",Me=Ae+" "+Fe,De="iPad",Ne="Apple",Le=Ne+" Watch",Ue="Safari",je="BlackBerry",Be="Samsung",ze=Be+"Browser",qe=Be+" Internet",He="Chrome",Ve=He+" OS",We=He+" "+Ie,Ge="Internet Explorer",Ke=Ge+" "+Oe,Je="Opera",Ye=Je+" Mini",Qe="Edge",Xe="Microsoft "+Qe,Ze="Firefox",ti=Ze+" "+Ie,ei="Nintendo",ii="PlayStation",ri="Xbox",si=Ae+" "+Oe,ni=Oe+" "+Ue,oi="Windows",ai=oi+" Phone",li="Nokia",hi="Ouya",ui="Generic",di=ui+" "+Oe.toLowerCase(),vi=ui+" "+Fe.toLowerCase(),ci="Konqueror",fi="Oculus Browser",pi="Vivaldi",_i="Yandex",gi="Whale",mi="DuckDuckGo",yi="Pale Moon",bi="Waterfox",wi="Brave",xi="Google Search App",Ei="(\\d+(\\.\\d+)?)",Si=new RegExp("Version/"+Ei),ki=new RegExp(ri,"i"),Ti=new RegExp(ii+" \\w+","i"),$i=new RegExp(ei+" \\w+","i"),Pi=new RegExp(je+"|PlayBook|BB10","i"),Ri={"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"},Ci=function(t,e,i,r){e=e||"";var s=function(t){return null!=t&&t.brave?wi:null}(i);return s||(null!=r&&r.detectGoogleSearchApp&&Zt(t,"GSA/")?xi:Zt(t," OPR/")&&Zt(t,"Mini")?Ye:Zt(t," OPR/")?Je:Pi.test(t)?je:Zt(t,"IE"+Oe)||Zt(t,"WPDesktop")?Ke:Zt(t,"OculusBrowser")?fi:Zt(t,ze)?qe:Zt(t,Qe)||Zt(t,"Edg/")?Xe:Zt(t,pi+"/")?pi:Zt(t,"YaBrowser/")?_i:Zt(t,gi+"/")?gi:Zt(t,mi+"/")||Zt(t,"Ddg/")?mi:Zt(t,"FBIOS")?"Facebook "+Oe:Zt(t,"UCWEB")||Zt(t,"UCBrowser")?"UC Browser":Zt(t,"CriOS")?We:Zt(t,"CrMo")||Zt(t,He)?He:Zt(t,Ae)&&Zt(t,Ue)?si:Zt(t,"FxiOS")?ti:Zt(t.toLowerCase(),ci.toLowerCase())?ci:Zt(t,wi+"/")?wi:((t,e)=>e&&Zt(e,Ne)||function(t){return Zt(t,Ue)&&!Zt(t,He)&&!Zt(t,Ae)}(t))(t,e)?Zt(t,Oe)?ni:Ue:Zt(t,"PaleMoon/")?yi:Zt(t,bi+"/")?bi:Zt(t,Ze)?Ze:Zt(t,"MSIE")||Zt(t,"Trident/")?Ge:Zt(t,"Gecko")?Ze:"")},Oi={[Ke]:[new RegExp("rv:"+Ei)],[Xe]:[new RegExp(Qe+"?\\/"+Ei)],[He]:[new RegExp("("+He+"|CrMo)\\/"+Ei)],[We]:[new RegExp("CriOS\\/"+Ei)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Ei)],[Ue]:[Si],[ni]:[Si],[Je]:[new RegExp("(Opera|OPR)\\/"+Ei)],[Ze]:[new RegExp(Ze+"\\/"+Ei)],[ti]:[new RegExp("FxiOS\\/"+Ei)],[ci]:[new RegExp("Konqueror[:/]?"+Ei,"i")],[je]:[new RegExp(je+" "+Ei),Si],[si]:[new RegExp("android\\s"+Ei,"i")],[qe]:[new RegExp(ze+"\\/"+Ei)],[fi]:[new RegExp("OculusBrowser\\/"+Ei)],[pi]:[new RegExp(pi+"\\/"+Ei)],[_i]:[new RegExp("YaBrowser\\/"+Ei)],[gi]:[new RegExp(gi+"\\/"+Ei)],[wi]:[new RegExp(wi+"\\/"+Ei)],[mi]:[new RegExp("(DuckDuckGo|Ddg)\\/"+Ei)],[yi]:[new RegExp("PaleMoon\\/"+Ei)],[bi]:[new RegExp(bi+"\\/"+Ei)],[xi]:[new RegExp("GSA\\/"+Ei)],[Ge]:[new RegExp("(rv:|MSIE )"+Ei)],Mozilla:[new RegExp("rv:"+Ei)]},Ii=function(t,e,i,r){var s=Ci(t,e,i,r),n=Oi[s];if(ue(n))return null;for(var o=0;n.length>o;o++){var a=t.match(n[o]);if(a)return parseFloat(a[a.length-2])}return null},Ai=[[new RegExp(ri+"; "+ri+" (.*?)[);]","i"),t=>[ri,t&&t[1]||""]],[new RegExp(ei,"i"),[ei,""]],[new RegExp(ii,"i"),[ii,""]],[Pi,[je,""]],[new RegExp(oi,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[ai,""];if(new RegExp(Oe).test(e)&&!/IEMobile\b/.test(e))return[oi+" "+Oe,""];var i=/Windows NT ([0-9.]+)/i.exec(e);if(i&&i[1]){var r=Ri[i[1]]||"";return/arm/i.test(e)&&(r="RT"),[oi,r]}return[oi,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[Ie,[t[3],t[4],t[5]||"0"].join(".")]:[Ie,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=ue(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+Ae+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Ae+")","i"),t=>t&&t[2]?[Ae,[t[2],t[3],t[4]||"0"].join(".")]:[Ae,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var e=["Mac OS X",""];return t&&t[1]&&(e[1]=[t[1],t[2],t[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Ve,""]],[/Linux|debian/i,["Linux",""]]],Fi=function(t){return $i.test(t)?ei:Ti.test(t)?ii:ki.test(t)?ri:new RegExp(hi,"i").test(t)?hi:new RegExp("("+ai+"|WPDesktop)","i").test(t)?ai:/iPad/.test(t)?De:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?Le:Pi.test(t)?je:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(li,"i").test(t)?li:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(Oe).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?Ae:Me:new RegExp("(pda|"+Oe+")","i").test(t)?di:new RegExp(Fe,"i").test(t)&&!new RegExp(Fe+" pc","i").test(t)?vi:""},Mi=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Di(t,e){return"string"==typeof(i=t)&&Mi.test(i)?t:e();var i}function Ni(t,e){var i=new Error(e);try{Object.defineProperty(i,"name",{value:t,writable:!0,enumerable:!0,configurable:!0})}catch(t){}return i}function Li(t){return t?t.split("#")[0]:t}function Ui(t,e){var i=setTimeout(t,e);return(null==i?void 0:i.unref)&&(null==i||i.unref()),i}function ji(t,e,i){return Bi.apply(this,arguments)}function Bi(){return(Bi=e((function*(t,e,i){var r;try{return yield Promise.race([t,new Promise(((t,s)=>{r=Ui((()=>{try{null==i||i(),t()}catch(t){s(t)}}),e)}))])}finally{clearTimeout(r)}}))).apply(this,arguments)}var zi,qi="NativeGzipValidationError",Hi=t=>t.length>=2&&31===t[0]&&139===t[1],Vi=(t,e)=>t===jt.GZipJS||e===jt.GZipJS||"gzip"===e,Wi=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),Gi=t=>{throw Ni(qi,"Native gzip produced invalid output: "+t)},Ki=function(){var t=e((function*(t,e){18>t.size&&Gi("too-short");var i=new Uint8Array(yield t.slice(0,10).arrayBuffer());Hi(i)&&8===i[2]||Gi("invalid-header");var r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{for(var e=(()=>{if(zi)return zi;zi=[];for(var t=0;256>t;t++){for(var e=t,i=0;8>i;i++)e=1&e?3988292384^e>>>1:e>>>1;zi[t]=e>>>0}return zi})(),i=4294967295,r=0;t.length>r;r++)i=e[255&(i^t[r])]^i>>>8;return(4294967295^i)>>>0})(e)&&Gi("invalid-crc");var s=e.length>>>0;r.getUint32(4,!0)!==s&&Gi("invalid-size")}));return function(e,i){return t.apply(this,arguments)}}();function Ji(){return Ji=e((function*(t,i,r){void 0===i&&(i=!0);try{var s=(new TextEncoder).encode(t),n=new globalThis.CompressionStream("gzip"),o=n.writable.getWriter(),a=o.write(s).then((()=>o.close())).catch(function(){var t=e((function*(t){try{yield o.abort(t)}catch(t){}throw t}));return function(e){return t.apply(this,arguments)}}()),l=new Response(n.readable).blob(),h=(yield Promise.all([l,a]))[0];return yield Ki(h,s),h}catch(t){if(null!=r&&r.rethrow)throw t;return i&&console.error("Failed to gzip compress data",t),null}})),Ji.apply(this,arguments)}var Yi={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},Qi=Yi.info,Xi=0x8000000000000000,Zi={}.propertyIsEnumerable;function tr(t,e){try{return rr(t,e,{ancestors:new WeakSet,remainingNodes:Vt},0)}catch(t){return[]}}function er(t,e,i,r){if(0>=i.remainingNodes)return{stringValue:Gt};if(i.remainingNodes--,ge(t))return{boolValue:t};if("number"==typeof t){if(!Number.isFinite(t))return{stringValue:String(t)};if(Number.isInteger(t)){if(Number.isSafeInteger(t))return{intValue:String(t)};if("undefined"==typeof BigInt)return{stringValue:String(t)};var s=BigInt(t).toString();return t>=Xi||-Xi>t?(null==e||e.debug("Attribute "+s+" is outside the int64 range; encoding it as a string"),{stringValue:s}):{intValue:s}}return{doubleValue:t}}if("string"==typeof t)return{stringValue:Yt(t)};if("function"==typeof t)return{stringValue:Jt};if("symbol"==typeof t)return{stringValue:String(t)};if("object"==typeof t&&null!==t){if(i.ancestors.has(t))return{stringValue:Wt};if(r>=qt)return{stringValue:Gt};if(t instanceof Date){var n=t.getTime(),o=Number.isFinite(n)?t.toISOString():String(t);return{stringValue:"string"==typeof o?Yt(o):String(o)}}i.ancestors.add(t);try{try{var a=t.toJSON;if("function"==typeof a)return er(a.call(t),e,i,r+1)}catch(t){}return oe(t)?{arrayValue:{values:ir(t,e,i,r+1)}}:{kvlistValue:{values:rr(t,e,i,r+1)}}}finally{i.ancestors.delete(t)}}return{stringValue:Yt(String(t))}}function ir(t,e,i,r){for(var s=[],n=Math.min(t.length,Ht),o=0;n>o&&i.remainingNodes>0;o++)try{var a=o in t?t[o]:void 0;if(fe(a))continue;s.push(er(a,e,i,r))}catch(t){s.push({stringValue:Kt})}return t.length>o&&s.push({stringValue:Gt}),s}function rr(t,e,i,r){var s=[];for(var n in t)if(Zi.call(t,n)){if(s.length>=Ht||0>=i.remainingNodes){null==e||e.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{var o=t[n];if(ce(o)||ue(o))continue;s.push({key:Yt(n),value:er(o,e,i,r)})}catch(t){s.push({key:Yt(n),value:{stringValue:Kt}})}}return s}function sr(t){try{return Yt(String(t))}catch(t){return Kt}}function nr(t,e,r,s){var n,o=Yi[t.level||"info"]||Qi,a=o.text,l=o.number,h=(void 0===(n=pe(s)?s:void 0)&&(n=Date.now()),String(n)+"000000"),u={};e.distinctId&&(u.posthogDistinctId=e.distinctId),e.sessionId&&(u.sessionId=e.sessionId),e.windowId&&(u["window.id"]=e.windowId),fe(e.sessionStartTimestamp)||(u.sessionStartTimestamp=String(e.sessionStartTimestamp)),fe(e.lastActivityTimestamp)||(u.lastActivityTimestamp=String(e.lastActivityTimestamp)),e.currentUrl&&(u["url.full"]=e.currentUrl),e.screenName&&(u["screen.name"]=e.screenName),e.appState&&(u["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(u.feature_flags=e.activeFeatureFlags);var d=i({},u),v=t.attributes;if(v){var c=[];try{c=Object.keys(v)}catch(t){c=[]}for(var f of c){var p=void 0;try{p=v[f]}catch(t){p=Kt}Object.defineProperty(d,f,{value:p,enumerable:!0,writable:!0,configurable:!0})}}var _={timeUnixNano:h,observedTimeUnixNano:h,severityNumber:l,severityText:a,body:{stringValue:sr(t.body)},attributes:tr(d,r)};return t.trace_id&&(_.traceId=t.trace_id),t.span_id&&(_.spanId=t.span_id),ue(t.trace_flags)||(_.flags=t.trace_flags),_}function or(t,e,r){return i({},t.resourceAttributes,{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment},t.serviceVersion&&{"service.version":t.serviceVersion},{"telemetry.sdk.name":e,"telemetry.sdk.version":r})}function ar(t,e,i,r){return{resourceLogs:[{resource:{attributes:tr(e)},scopeLogs:[{scope:{name:i,version:r},logRecords:t}]}]}}let lr=class{constructor(t,e,i,r,s,n,o){var a;void 0===n&&(n=()=>Promise.resolve()),this._instance=t,this.nn=e,this.I=i,this.Sn=r,this.xn=s,this.Cn=n,this.Tn=o,this.Mn=null,this.En=0,this.In=0,this.Rn=0,this.Pn=0,this.An=0,this.Fn=!1,this.On=e.maxBufferSize,this.Ln=Math.max(null!==(a=e.maxQueueSize)&&void 0!==a?a:e.maxBufferSize,e.maxBufferSize),this.Dn=e.flushIntervalMs,this.$n=e.maxBatchRecordsPerPost,this.Nn=e.rateCapWindowMs,this.qn=e.maxLogsPerInterval}clearQueue(){this.In++,this._instance.setPersistedProperty(Ut.LogsQueue,[])}reset(){this.jn(),this.Pn=0,this.An=0,this.Fn=!1,this.Rn=0,this.$n=this.nn.maxBatchRecordsPerPost}onReconnect(){this.Rn=0,this.Bn()}captureLog(t,e){var i;if(!this._instance.isDisabled&&!this._instance.optedOut&&null!=t&&t.body){var r=this.Hn(t);if(null!==r)if(r.body){if(this.zn()){var s={record:nr(r,null!==(i=null==e?void 0:e.context)&&void 0!==i?i:this.Sn(),this.I,null==e?void 0:e.occurredAtMs)};this.xn((()=>this.Un(s)))}}else this.I.info("Log was rejected in beforeSend function")}}Hn(t){var e=this.nn.beforeSend;if(!e)return t;var i=oe(e)?e:[e],r=t;for(var s of i)try{var n=s(r);if(!n)return this.I.info("Log was rejected in beforeSend function"),null;r=n}catch(t){return this.I.error("Error in beforeSend function for log:",t),null}return r}zn(){if(void 0===this.qn)return!0;var t=Date.now(),e=t-this.Pn;return this.Nn>e&&e>=0||(this.Pn=t,this.An=0,this.Fn=!1),this.qn>this.An?(this.An++,!0):(this.Fn||(this.I.warn("captureLog dropping logs: exceeded "+this.qn+" logs per "+this.Nn+"ms"),this.Fn=!0),!1)}flush(){var t=this;return e((function*(){if(!t._instance.isDisabled)return t.Mn||(t.Mn=t.Wn().finally((()=>{t.Mn=null}))),t.Mn}))()}Wn(){var t=this;return e((function*(){var e;t.jn();var i=null!==(e=t._instance.getPersistedProperty(Ut.LogsQueue))&&void 0!==e?e:[];if(0!==i.length)for(var r=i.length,s=0;i.length>0&&r>s;){var n,o,a=t.In;t.En=0;var l=Math.min(i.length,t.$n),h=i.slice(0,l),u=ar(h.map((t=>t.record)),t.Vn(),null!==(n=t.Tn)&&void 0!==n?n:t._instance.getLibraryId(),t._instance.getLibraryVersion()),d=yield t._instance.Gn(u);if(t.In!==a)return;if("too-large"===d.kind&&h.length>1)t.$n=Math.max(1,Math.floor(h.length/2)),t.I.warn("Received 413 when sending logs batch of size "+h.length+", reducing batch size to "+t.$n);else{if("retry-later"===d.kind)throw d.error;if("too-large"===d.kind?t.I.warn("Dropping a single log record after 413 with batch size 1 — the record is larger than the server cap and cannot be split further."):"ok"===d.kind&&t.nn.maxBatchRecordsPerPost>t.$n&&(t.$n=Math.min(t.nn.maxBatchRecordsPerPost,t.$n+1)),yield t.Zn(h.length),i=null!==(o=t._instance.getPersistedProperty(Ut.LogsQueue))&&void 0!==o?o:[],s+=h.length,"fatal"===d.kind)throw d.error}}}))()}Zn(t){var i=this;return e((function*(){var e,r=Math.max(0,t-i.En),s=null!==(e=i._instance.getPersistedProperty(Ut.LogsQueue))&&void 0!==e?e:[];i._instance.setPersistedProperty(Ut.LogsQueue,s.slice(r)),yield i.Cn()}))()}Vn(){return or(this.nn,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Un(t){var e;if(!this._instance.optedOut){var i=null!==(e=this._instance.getPersistedProperty(Ut.LogsQueue))&&void 0!==e?e:[];this.Ln>i.length||(i.shift(),this.En++,this.I.info("Logs queue is full, dropping oldest record.")),i.push(t),this._instance.setPersistedProperty(Ut.LogsQueue,i),this.On>i.length?this.Qn():this.Bn()}}Qn(t){void 0===t&&(t=this.Dn),this.Jn||(this.Jn=Ui((()=>{this.Jn=void 0,this.Bn()}),t))}Kn(){var t=Math.min(Math.max(0,this.Rn-1),6);return this.Dn*Math.pow(2,t)}Yn(){var t=this._instance.getPersistedProperty(Ut.LogsQueue);return!!t&&t.length>0}shutdown(t){var i=this;return e((function*(){i.jn();var e=i.flush().catch((()=>{}));void 0!==t?yield ji(e,t):yield e}))()}flushWithTimeout(t){var i=this;return e((function*(){var e=i.flush();yield ji(e,t,(()=>{e.catch((()=>{}))}))}))()}Bn(){this.flush().then((()=>{this.Rn=0}),(t=>{this.Rn++,this.I.error("PostHog logs flush failed:",t)})).finally((()=>{!this._instance.isDisabled&&this.Yn()&&this.Qn(this.Kn())}))}jn(){this.Jn&&(clearTimeout(this.Jn),this.Jn=void 0)}};var hr=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function ur(t){return String(t)+"000000"}function dr(t,e,i,r){var s="";return r&&(s=Object.keys(r).sort().map((t=>JSON.stringify(t)+":"+JSON.stringify(r[t]))).join(",")),t+"\0"+e+"\0"+(null!=i?i:"")+"\0"+s}let vr=class{constructor(t,e,i){this._instance=t,this.nn=e,this.I=i,this.Xn=new Map,this.Mn=null,this.ts=!1,this.es=new Map,this.rs=new Set,this.ns=0}count(t,e,i){void 0===e&&(e=1),this.ss({name:t,type:"count",value:e,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}gauge(t,e,i){this.ss({name:t,type:"gauge",value:e,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}histogram(t,e,i){this.ss({name:t,type:"histogram",value:e,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}flush(){var t=this,i=this.Mn,r=function(){var r=e((function*(){i&&(yield i.catch((()=>{}))),yield t.os()}));return function(){return r.apply(this,arguments)}}(),s=r().finally((()=>{this.Mn===s&&(this.Mn=null)}));return this.Mn=s,s}drainWindow(){if(0===this.Xn.size)return null;var t=this.Xn;return this.Xn=new Map,this.ts=!1,this.es=new Map,this.rs=new Set,this.ls(t)}reset(){this.ns++,this.jn(),this.Xn=new Map,this.Mn=null,this.ts=!1,this.es=new Map,this.rs=new Set}ss(t){if(!this._instance.isDisabled&&!this._instance.optedOut){var e=this.Hn(t);if(null!==e)if(e.name&&"string"==typeof e.name)if("number"==typeof e.value&&Number.isFinite(e.value))if("count"===e.type&&0>e.value)this.I.warn("Dropping count '"+e.name+"': counters are monotonic, value must be >= 0");else{var r,s;try{r=e.attributes?i({},e.attributes):void 0,s=dr(e.type,e.name,e.unit,r)}catch(t){return void this.I.warn("Dropping metric '"+e.name+"': attributes could not be serialized",t)}var n=this.Xn.get(s);if(!n){if(!this.us())return;n={name:e.name,type:e.type,unit:e.unit,attributes:r,windowStartMs:Date.now()},this.Xn.set(s,n)}var o=this.es.get(e.name);void 0===o?this.es.set(e.name,e.type):o===e.type||this.rs.has(e.name)||(this.rs.add(e.name),this.I.warn("Metric name '"+e.name+"' is already used as a "+o+"; recording it as a "+e.type+" too will blend both series in charts. Use a distinct name.")),this.hs(n,e.value),this.Qn()}else this.I.warn("Dropping metric '"+e.name+"': value must be a finite number");else this.I.warn("Dropping metric with empty name")}}us(){return this.nn.maxSeriesPerFlush>this.Xn.size||(this.ts||(this.ts=!0,this.I.warn("Metric series cap reached ("+this.nn.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}hs(t,e){var i;switch(t.type){case"count":t.total=(null!==(i=t.total)&&void 0!==i?i:0)+e;break;case"gauge":t.last=e;break;case"histogram":t.hist||(t.hist={count:0,sum:0,min:e,max:e,bucketCounts:new Array(hr.length+1).fill(0)});var r=t.hist;r.count+=1,r.sum+=e,r.min=Math.min(r.min,e),r.max=Math.max(r.max,e),r.bucketCounts[function(t,e){for(var i=0;e.length>i;i++)if(e[i]>=t)return i;return e.length}(e,hr)]+=1}}Hn(t){var e=this.nn.beforeSend;if(!e)return t;var i=oe(e)?e:[e],r=t;for(var s of i)try{var n=s(r);if(!n)return this.I.info("Metric was rejected in beforeSend function"),null;r=n}catch(t){return this.I.error("Error in beforeSend function for metric:",t),null}return r}Qn(){this.Jn||(this.Jn=Ui((()=>{this.Jn=void 0,this.flush().catch((t=>{this.I.error("Metrics flush failed:",t)}))}),this.nn.flushIntervalMs))}jn(){this.Jn&&(clearTimeout(this.Jn),this.Jn=void 0)}os(){var t=this;return e((function*(){if(0!==t.Xn.size){var e=t.Xn;t.Xn=new Map,t.ts=!1,t.es=new Map,t.rs=new Set;var i=t.ns,r=yield t._instance.ds(t.ls(e));if(i===t.ns)switch(r.kind){case"ok":return;case"retry-later":return t.vs(e),void t.Qn();case"too-large":return void t.I.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.I.error("Failed to send metrics batch:",r.error)}}}))()}ls(t){return e=this.cs(t),r=function(t,e,r){return i({},t.resourceAttributes,{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment},t.serviceVersion&&{"service.version":t.serviceVersion},{"telemetry.sdk.name":e,"telemetry.sdk.version":r})}(this.nn,this._instance.getLibraryId(),this._instance.getLibraryVersion()),s=this._instance.getLibraryId(),n=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:tr(r)},scopeMetrics:[{scope:{name:s,version:n},metrics:e}]}]};var e,r,s,n}cs(t){var e=ur(Date.now()),r=new Map;for(var s of t.values()){var n,o=dr(s.type,s.name,s.unit,void 0),a=r.get(o);a||(a=i({name:s.name},s.unit&&{unit:s.unit}),"count"===s.type?a.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===s.type?a.gauge={dataPoints:[]}:a.histogram={aggregationTemporality:1,dataPoints:[]},r.set(o,a));var l=tr(null!==(n=s.attributes)&&void 0!==n?n:{},this.I),h=ur(s.windowStartMs);if("count"===s.type){var u,d={attributes:l,startTimeUnixNano:h,timeUnixNano:e,asDouble:null!==(u=s.total)&&void 0!==u?u:0};a.sum.dataPoints.push(d)}else if("gauge"===s.type){var v,c={attributes:l,timeUnixNano:e,asDouble:null!==(v=s.last)&&void 0!==v?v:0};a.gauge.dataPoints.push(c)}else s.hist&&a.histogram.dataPoints.push({attributes:l,startTimeUnixNano:h,timeUnixNano:e,count:s.hist.count,sum:s.hist.sum,min:s.hist.min,max:s.hist.max,bucketCounts:s.hist.bucketCounts,explicitBounds:hr})}return Array.from(r.values())}vs(t){var e,i;for(var r of t){var s=r[0],n=r[1],o=this.Xn.get(s);if(o)switch(o.windowStartMs=Math.min(o.windowStartMs,n.windowStartMs),o.type){case"count":o.total=(null!==(e=o.total)&&void 0!==e?e:0)+(null!==(i=n.total)&&void 0!==i?i:0);break;case"gauge":break;case"histogram":if(n.hist)if(o.hist){o.hist.count+=n.hist.count,o.hist.sum+=n.hist.sum,o.hist.min=Math.min(o.hist.min,n.hist.min),o.hist.max=Math.max(o.hist.max,n.hist.max);for(var a=0;o.hist.bucketCounts.length>a;a++)o.hist.bucketCounts[a]+=n.hist.bucketCounts[a]}else o.hist=n.hist}else this.us()&&this.Xn.set(s,n)}}};var cr,fr,pr;function _r(t){var e=globalThis._posthogChunkIds;if(e){var i=Object.keys(e);return pr&&i.length===fr||(fr=i.length,pr=i.reduce(((i,r)=>{cr||(cr={});var s=cr[r];if(s)i[s[0]]=s[1];else for(var n=t(r),o=n.length-1;o>=0;o--){var a=n[o],l=null==a?void 0:a.filename,h=e[r];if(l&&h){i[l]=h,cr[r]=[l,h];break}}return i}),{})),pr}}class gr{constructor(t,e,i){void 0===i&&(i=[]),this.coercers=t,this.stackParser=e,this.modifiers=i}buildFromUnknown(t,e){void 0===e&&(e={});var i=e&&e.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(i,e,0).apply(t),s=this.buildParsingContext(e),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,i),$exception_level:"error"}}modifyFrames(t){var i=this;return e((function*(){for(var e of t)e.stacktrace&&e.stacktrace.frames&&oe(e.stacktrace.frames)&&(e.stacktrace.frames=yield i.applyModifiers(e.stacktrace.frames));return t}))()}coerceFallback(t){var e;return{type:"Error",value:"Unknown error",stack:null==(e=t.syntheticException)?void 0:e.stack,synthetic:!0}}parseStacktrace(t,e){var r,s;return null!=t.cause&&(r=this.parseStacktrace(t.cause,e)),""!=t.stack&&null!=t.stack&&(s=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?e.skipFirstLines:0),e.chunkIdMap)),i({},t,{cause:r,stack:s})}applyChunkIds(t,e){return t.map((t=>(t.filename&&e&&(t.chunk_id=e[t.filename]),t)))}applyCoercers(t,e){for(var i of this.coercers)if(i.match(t))return i.coerce(t,e);return this.coerceFallback(e)}applyModifiers(t){var i=this;return e((function*(){var e=t;for(var r of i.modifiers)e=yield r(e);return e}))()}convertToExceptionList(t,e){var r,s,n,o={type:t.type,value:t.value,mechanism:{type:null!==(r=e.type)&&void 0!==r?r:"generic",handled:null===(s=e.handled)||void 0===s||s,synthetic:null!==(n=t.synthetic)&&void 0!==n&&n}};t.stack&&(o.stacktrace={type:"raw",frames:t.stack});var a=[o];return null!=t.cause&&a.push(...this.convertToExceptionList(t.cause,i({},e,{handled:!0}))),a}buildParsingContext(t){var e;return{chunkIdMap:_r(this.stackParser),skipFirstLines:null!==(e=t.skipFirstLines)&&void 0!==e?e:1}}buildCoercingContext(t,e,r){void 0===r&&(r=0);var s=(i,r)=>{if(4>=r){var s=this.buildCoercingContext(t,e,r);return this.applyCoercers(i,s)}};return i({},e,{syntheticException:0==r?e.syntheticException:void 0,mechanism:t,apply:t=>s(t,r),next:t=>s(t,r+1)})}}var mr="?";function yr(t,e,i,r,s){var n={platform:t,filename:e,function:"<anonymous>"===i?mr:i,in_app:!(null!=e&&e.startsWith("webkit-masked-url://"))&&"<anonymous>"!==e};return ue(r)||(n.lineno=r),ue(s)||(n.colno=s),n}var br=(t,e)=>{var i=-1!==t.indexOf("safari-extension"),r=-1!==t.indexOf("safari-web-extension");return i||r?[-1!==t.indexOf("@")?t.split("@")[0]:mr,i?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},wr=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,xr=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Er=/\((\S*)(?::(\d+))(?::(\d+))\)/,Sr=(t,e)=>{var i=wr.exec(t);if(i)return yr(e,i[1],mr,+i[2],+i[3]);var r=xr.exec(t);if(r){if(r[2]&&0===r[2].indexOf("eval")){var s=Er.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}var n=br(r[1]||mr,r[2]);return yr(e,n[1],n[0],r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},kr=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Tr=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,$r=(t,e)=>{var i=kr.exec(t);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var r=Tr.exec(i[3]);r&&(i[1]=i[1]||"eval",i[3]=r[1],i[4]=r[2],i[5]="")}var s=i[3],n=i[1]||mr,o=br(n,s);return yr(e,s=o[1],n=o[0],i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},Pr=/\(error: (.*)\)/;class Rr{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,e){var i=de(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:i?t.stack:void 0,cause:t.cause?e.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var e=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?e+": "+t.message:e}isDOMException(t){return xe(t,"DOMException")}isDOMError(t){return xe(t,"DOMError")}}class Cr{match(t){return Ee(t)}coerce(t,e){var i,r=this.getStack(t),s=void 0===r;return{type:this.getType(t),value:this.getMessage(t,e),stack:null!=r?r:null==(i=e.syntheticException)?void 0:i.stack,cause:t.cause?e.next(t.cause):void 0,synthetic:s}}getType(t){return t.name||t.constructor.name}getMessage(t,e){var i=t.message;return String(i.error&&"string"==typeof i.error.message?i.error.message:i)}getStack(t){return t.stacktrace||t.stack||void 0}}class Or{constructor(){}match(t){return!!xe(t,"ErrorEvent")&&(null!=t.error||this.Pi(t))}coerce(t,e){var r;if(null!=t.error)return e.apply(t.error);var s=e.apply(t.message);return i({},s,{stack:null!==(r=this.Di(t))&&void 0!==r?r:s.stack,synthetic:!0})}Pi(t){return de(t.message)&&t.message.length>0}Di(t){var e,i,r=t,s=null!==(e=r.lineno)&&void 0!==e?e:0,n=null!==(i=r.colno)&&void 0!==i?i:0;if(de(r.filename)&&0!==r.filename.length&&0!==s)return"Error\n at "+r.filename+":"+s+":"+n}}var Ir=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class Ar{match(t){return"string"==typeof t}coerce(t,e){var i,r=this.getInfos(t),s=r[0],n=r[1];return{type:null!=s?s:"Error",value:null!=n?n:t,stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}getInfos(t){var e="Error",i=t,r=t.match(Ir);return r&&(e=r[1],i=r[2]),[e,i]}}var Fr=["fatal","error","warning","log","info","debug"];function Mr(t,e){void 0===e&&(e=40);var i=Object.keys(t);if(i.sort(),!i.length)return"[object has no keys]";for(var r=i.length;r>0;r--){var s=i.slice(0,r).join(", ");if(e>=s.length)return r===i.length?s:s.length>e?s.slice(0,e)+"...":s}return""}class Dr{match(t){return"object"==typeof t&&null!==t}coerce(t,e){var i,r,s=this.getErrorPropertyFromObject(t);return s?e.apply(s):{type:this.getType(t),value:this.getValue(t),stack:null!==(i=this.getStack(t))&&void 0!==i?i:null==(r=e.syntheticException)?void 0:r.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){if(Se(t))return t.constructor.name;var e="name"in t?t.name:void 0;return de(e)&&!ve(e)?e:"Error"}getValue(t){if("name"in t&&"string"==typeof t.name){var e="'"+t.name+"' captured as exception";return"message"in t&&"string"==typeof t.message&&(e+=" with message: '"+t.message+"'"),e}if("message"in t&&"string"==typeof t.message)return t.message;var i=this.getObjectClassName(t);return(i&&"Object"!==i?"'"+i+"'":"Object")+" captured as exception with keys: "+Mr(t)}isSeverityLevel(t){return de(t)&&!ve(t)&&Fr.indexOf(t)>=0}getStack(t){try{return de(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:de(t.stack)&&t.stack.length>0?t.stack:void 0}catch(t){return}}getErrorPropertyFromObject(t){for(var e in t)if({}.hasOwnProperty.call(t,e)){var i=t[e];if(Ee(i))return i}}getObjectClassName(t){try{var e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch(t){return}}}class Nr{match(t){return Se(t)}coerce(t,e){var i,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+Mr(t),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}}class Lr{match(t){return we(t)}coerce(t,e){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}}class Ur{match(t){return xe(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!Se(t))return!1;try{var e=t.detail;return null!=e&&"object"==typeof e&&"reason"in e}catch(t){return!1}}coerce(t,e){var i,r=this.getUnhandledRejectionReason(t);return we(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}:e.apply(r)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&null!=t.detail&&"object"==typeof t.detail&&"reason"in t.detail)return t.detail.reason}catch(t){}return t}}var jr="$message",Br="$timestamp",zr=new Set([jr,Br]),qr={enabled:!0,max_bytes:32768};function Hr(t){var e;return t?{enabled:null!==(e=t.enabled)&&void 0!==e?e:qr.enabled,max_bytes:Wr(t.max_bytes,qr.max_bytes)}:i({},qr)}class Vr{constructor(t){this.fs=[],this.ps=0,this.nn=Hr(t)}setConfig(t){this.nn=Hr(t),this.gs()}add(t){var e=function(t){var e;try{e=ie(t)}catch(t){return}try{var i=JSON.parse(e);if(!le(i))return;var r=i,s=r[jr],n=r[Br];if(!de(s)||0===s.trim().length)return;if(!de(n)&&!pe(n))return;return{step:r,json:e}}catch(t){return}}(t);if(e){var i=function(t){if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t).length;for(var e=encodeURIComponent(t),i=0,r=0;e.length>r;r++)"%"===e[r]?(i+=1,r+=2):i+=1;return i}(e.json);i>this.nn.max_bytes||(this.fs.push({step:e.step,bytes:i}),this.ps+=i,this.gs())}}getAttachable(){return this.fs.map((t=>t.step))}clear(){this.fs=[],this.ps=0}size(){return this.fs.length}gs(){for(;this.ps>this.nn.max_bytes&&this.fs.length>0;){var t=this.fs.shift();t&&(this.ps-=t.bytes)}}}function Wr(t,e){if(!pe(t)||t===1/0||t===-1/0)return e;var i=Math.floor(t);return 0>i?e:i}var Gr=function(t,e){var i=(void 0===e?{}:e).debugEnabled,r={P(e){if(xt&&(s.DEBUG||xt.POSTHOG_DEBUG||i)&&!ue(xt.console)&&xt.console){for(var r=("__rrweb_original__"in xt.console[e]?xt.console[e].__rrweb_original__:xt.console[e]),n=arguments.length,o=new Array(n>1?n-1:0),a=1;n>a;a++)o[a-1]=arguments[a];r(t,...o)}},debug(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.P("debug",...e)},info(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.P("log",...e)},warn(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.P("warn",...e)},error(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.P("error",...e)},critical(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];console.error(t,...i)},uninitializedWarning(t){r.error("You must initialize PostHog before calling "+t)},createLogger:(e,i)=>Gr(t+" "+e,i)};return r},Kr=Gr("[PostHog.js]"),Jr=Kr.createLogger;function Yr(t,e){oe(t)&&t.forEach(e)}function Qr(t,e){if(!fe(t))if(oe(t))t.forEach(e);else if(me(t))t.forEach(((t,i)=>e(t,i)));else for(var i in t)se.call(t,i)&&e(t[i],i)}var Xr=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];for(var s of i)for(var n in s)void 0!==s[n]&&(t[n]=s[n]);return t};function Zr(t){for(var e=Object.keys(t),i=e.length,r=new Array(i);i--;)r[i]=[e[i],t[e[i]]];return r}var ts=function(t){try{return t()}catch(t){return}},es=function(t){return function(){try{for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,i)}catch(t){Kr.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Kr.critical(t)}}},is=function(t){var e={};return Qr(t,(function(t,i){(de(t)&&t.length>0||pe(t))&&(e[i]=t)})),e};var rs=["herokuapp.com","vercel.app","netlify.app"];function ss(t){var e=null==t?void 0:t.hostname;if(!de(e))return!1;var i=e.split(".").slice(-2).join(".");for(var r of rs)if(i===r)return!1;return!0}function ns(t,e,i,r){var s=null!=r?r:{},n=s.capture,o=s.passive;null==t||t.addEventListener(e,i,{capture:void 0!==n&&n,passive:void 0===o||o})}function os(t){return"ph_toolbar_internal"===t.name}var as=t=>{if(kt){try{for(var e=t+"=",i=kt.cookie.split(";").filter((t=>t.length)),r=0;i.length>r;r++){for(var s=i[r];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(e))return decodeURIComponent(s.substring(e.length,s.length))}}catch(t){}return null}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return pe(t)&&isFinite(t)&&Math.floor(t)===t});class ls{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,e,i,r){if(!Number.isInteger(t)||!Number.isInteger(e)||!Number.isInteger(i)||!Number.isInteger(r)||0>t||0>e||0>i||0>r||t>0xffffffffffff||e>4095||i>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=t/Math.pow(2,40),s[1]=t/Math.pow(2,32),s[2]=t/Math.pow(2,24),s[3]=t/Math.pow(2,16),s[4]=t/256,s[5]=t,s[6]=112|e>>>8,s[7]=e,s[8]=128|i>>>24,s[9]=i>>>16,s[10]=i>>>8,s[11]=i,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new ls(s)}toString(){for(var t="",e=0;this.bytes.length>e;e++)t=t+(this.bytes[e]>>>4).toString(16)+(15&this.bytes[e]).toString(16),3!==e&&5!==e&&7!==e&&9!==e||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new ls(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(var e=0;16>e;e++){var i=this.bytes[e]-t.bytes[e];if(0!==i)return Math.sign(i)}return 0}}class hs{generate(){var t=this.generateOrAbort();if(!ue(t))return t;this.Gr=0;var e=this.generateOrAbort();if(ue(e))throw new Error("Could not generate UUID after timestamp reset");return e}generateOrAbort(){var t=Date.now();if(t>this.Gr)this.Gr=t,this.Qr();else{if(this.Gr>=t+1e4)return;this.Jr++,this.Jr>4398046511103&&(this.Gr++,this.Qr())}return ls.fromFieldsV7(this.Gr,Math.trunc(this.Jr/Math.pow(2,30)),this.Jr&Math.pow(2,30)-1,this.Yr.nextUint32())}Qr(){this.Jr=1024*this.Yr.nextUint32()+(1023&this.Yr.nextUint32())}constructor(){this.Gr=0,this.Jr=0,this.Yr=new vs}}var us,ds=t=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};xt&&!ue(xt.crypto)&&crypto.getRandomValues&&(ds=t=>crypto.getRandomValues(t));class vs{nextUint32(){return this.At.length>this.Kr||(ds(this.At),this.Kr=0),this.At[this.Kr++]}constructor(){this.At=new Uint32Array(8),this.Kr=1/0}}var cs=()=>fs().toString(),fs=()=>(us||(us=new hs)).generate(),ps="",_s=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var gs={Xr:()=>!!kt,ii(t){Kr.error("cookieStore error: "+t)},ti:as,ni(t){var e;try{e=JSON.parse(gs.ti(t))||{}}catch(t){}return e},ei(t,e,i,r,s){if(!kt)return!1;try{var n="",o="",a=function(t,e){if(e){var i=function(t,e){if(void 0===e&&(e=kt),ps)return ps;if(!e)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var i=t.split("."),r=Math.min(i.length,8),s="dmn_chk_"+cs();!ps&&r--;){var n=i.slice(r).join("."),o=s+"=1;domain=."+n+";path=/";e.cookie=o+";max-age=3",e.cookie.includes(s)&&(e.cookie=o+";max-age=0",ps=n)}return ps}(t);if(!i){var r=(t=>{var e=t.match(_s);return e?e[0]:""})(t);r!==i&&Kr.info("Warning: cookie subdomain discovery mismatch",r,i),i=r}return i?"; domain=."+i:""}return""}(kt.location.hostname,r);if(i){var l=new Date;l.setTime(l.getTime()+864e5*i),n="; expires="+l.toUTCString()}s&&(o="; secure");var h=t+"="+encodeURIComponent(JSON.stringify(e))+n+"; SameSite=Lax; path=/"+a+o;return h.length>3686.4&&Kr.warn("cookieStore warning: large cookie, len="+h.length),kt.cookie=h,!0}catch(t){return!1}},ri(t,e){if(null!=kt&&kt.cookie)try{gs.ei(t,"",-1,e)}catch(t){return}}},ms=null,ys={Xr(){if(!ce(ms))return ms;var t=!0;if(ue(xt))t=!1;else try{var e="__mplssupport__";ys.ei(e,"xyz"),'"xyz"'!==ys.ti(e)&&(t=!1),ys.ri(e)}catch(e){t=!1}return t||Kr.error("localStorage unsupported; falling back to cookie store"),ms=t,t},ii(t){Kr.error("localStorage error: "+t)},ti(t){try{return null==xt?void 0:xt.localStorage.getItem(t)}catch(t){ys.ii(t)}return null},ni(t){try{return JSON.parse(ys.ti(t))||{}}catch(t){}return null},ei(t,e){try{return null==xt||xt.localStorage.setItem(t,JSON.stringify(e)),!0}catch(t){ys.ii(t)}return!1},ri(t){try{null==xt||xt.localStorage.removeItem(t)}catch(t){ys.ii(t)}}},bs=[U,O,C,A,F,M,Q,Y,K],ws=[a,o,P,R,st,rt,X],xs=t=>t+"_cpm",Es=["__proto__","constructor","prototype"],Ss=t=>{if(!le(t))return{};var e={};return Object.keys(t).forEach((i=>{-1===Es.indexOf(i)&&(e[i]=t[i])})),e},ks=function(t,e){void 0===e&&(e=[]);var i={};return[...ws,...e].forEach((e=>{var r=t[e];ue(r)||ce(r)||""===r||(i[e]=r)})),i},Ts=t=>{for(var e=5381,i=2166136261,r=0;t.length>r;r++){var s=t.charCodeAt(r);e=33*e^s,i=Math.imul(i^s,16777619)}return t.length.toString(36)+"."+(e>>>0).toString(36)+"."+(i>>>0).toString(36)},$s=(t,e)=>({p:e,f:Ts(JSON.stringify(t))}),Ps=(t,e)=>{if(!e)return{properties:[],isValid:!1};try{var i=gs.ni(xs(t)),r=(null==i?void 0:i.f)===Ts(e)&&oe(i.p);return{properties:r?i.p:[],isValid:r}}catch(t){return{properties:[],isValid:!1}}},Rs=(t,e)=>e+"|"+(gs.ti(xs(t))||""),Cs={},Os={Xr:()=>!0,ii(t){Kr.error("memoryStorage error: "+t)},ti:t=>Cs[t]||null,ni:t=>Cs[t]||null,ei:(t,e)=>(Cs[t]=e,!0),ri(t){delete Cs[t]}},Is=null,As={Xr(){if(!ce(Is))return Is;if(Is=!0,ue(xt))Is=!1;else try{var t="__support__";As.ei(t,"xyz"),'"xyz"'!==As.ti(t)&&(Is=!1),As.ri(t)}catch(t){Is=!1}return Is},ii(t){Kr.error("sessionStorage error: ",t)},ti(t){try{return null==xt?void 0:xt.sessionStorage.getItem(t)}catch(t){As.ii(t)}return null},ni(t){try{return JSON.parse(As.ti(t))||null}catch(t){}return null},ei(t,e){try{return null==xt||xt.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch(t){As.ii(t)}return!1},ri(t){try{null==xt||xt.sessionStorage.removeItem(t)}catch(t){As.ii(t)}}};class Fs{constructor(t){this._instance=t}get nn(){return this._instance.config}get consent(){return this.Os()?0:this.Ls}isOptedOut(){return this.nn.cookieless_mode===vt||this.isRejected()||-1===this.consent&&this.nn.cookieless_mode===dt}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.nn.opt_out_capturing_by_default}optInOut(t){this.Ds.ei(this.$s,t?1:0,this.nn.cookie_expiration,this.nn.cross_subdomain_cookie,this.nn.secure_cookie)}reset(){this.Ds.ri(this.$s,this.nn.cross_subdomain_cookie)}get $s(){var t=this._instance.config,e=t.token,i=t.opt_out_capturing_cookie_prefix;return t.consent_persistence_name||(i?i+e:"__ph_opt_in_out_"+e)}get Ls(){var t=this.Ds.ti(this.$s);return $e(t)?1:Zt(Pe,t)?0:-1}get Ds(){var t=this.nn.opt_out_capturing_persistence_type,e="localStorage"===t?ys:gs;if(!this.Ns||this.Ns!==e){this.Ns=e;var i="localStorage"===t?gs:ys;i.ti(this.$s)&&(this.Ns.ti(this.$s)||this.optInOut($e(i.ti(this.$s))),i.ri(this.$s,this.nn.cross_subdomain_cookie))}return this.Ns}Os(){return!!this.nn.respect_dnt&&[null==St?void 0:St.doNotTrack,null==St?void 0:St.msDoNotTrack,Ft.doNotTrack].some((t=>$e(t)))}}function Ms(t,e){var i,r=null==t||null==(i=t.config)?void 0:i.get_current_url;if(!ae(r))return e;try{var s=r(e);return de(s)&&s?s:e}catch(t){return Kr.error("Error in get_current_url, falling back to window.location.href",t),e}}var Ds="__POSTHOG_TOOLBAR__",Ns=1,Ls=3,Us=11;function js(t){return t instanceof Element&&(t.id===Ds||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function Bs(t){return!!t&&t.nodeType===Ns}function zs(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function qs(t){return!!t&&t.nodeType===Ls}function Hs(t){return!!t&&t.nodeType===Us&&Bs(t.host)}var Vs=1e3;function Ws(t){return t?te(t).split(/\s+/):[]}function Gs(t,e){var i=function(t){var e,i=null==xt||null==(e=xt.location)?void 0:e.href;return ue(i)?void 0:Ms(t,i)}(e);return!!(i&&t&&t.some((t=>i.match(t))))}function Ks(t){var e="";switch(typeof t.className){case"string":e=t.className;break;case"object":e=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:e=""}return Ws(e)}function Js(t){return fe(t)?null:te(t).split(/(\s+)/).filter((t=>bn(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Ys(t){var e="";return dn(t)&&!vn(t)&&t.childNodes&&t.childNodes.length&&Qr(t.childNodes,(function(t){var i;qs(t)&&t.textContent&&(e+=null!==(i=Js(t.textContent))&&void 0!==i?i:"")})),te(e)}function Qs(t){var e;return ue(t.target)?t.srcElement||null:null!=(e=t.target)&&e.shadowRoot?t.composedPath()[0]||null:t.target||null}var Xs=["a","button","form","input","select","textarea","label"];function Zs(t,e){if(ue(e))return!0;var i,r=function(t){if(e.some((e=>function(t,e){var i=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector;try{return!!i&&i.call(t,e)}catch(t){return!1}}(t,e))))return{v:!0}};for(var s of t)if(i=r(s))return i.v;return!1}function tn(t){var e=t.parentNode;return!(!e||!Bs(e))&&e}var en=[".ph-no-autocapture","[data-ph-no-autocapture]"],rn=["next","previous","prev",">","<"],sn=[...rn,"+","-","−","–"],nn=(t,e)=>/[a-z0-9]/i.test(e)?t.includes(e):t===e,on=[".ph-no-rageclick",".ph-no-capture"],an=["","text","search","email","password","url","tel","number"];function ln(t,e){if(!xt||hn(t))return!1;var i,r,s,n,o;if(ge(e)?(i=!!e&&on,r=void 0,s=!1):(i=null!==(n=null==e?void 0:e.css_selector_ignorelist)&&void 0!==n?n:on,r=null==e?void 0:e.content_ignorelist,s=null!==(o=null==e?void 0:e.ignore_text_selection)&&void 0!==o&&o),!1===i)return!1;if(s&&function(t){return!(!t||!Bs(t))&&(!!zs(t,"textarea")||(zs(t,"input")?Zt(an,(t.getAttribute("type")||"").toLowerCase()):function(t){if(t.isContentEditable)return!0;var e=null==t.getAttribute?void 0:t.getAttribute("contenteditable");return"true"===e||""===e}(t)))}(t))return!1;var a=un(t,!1).targetElementList;return!function(t,e){if(!1===t||ue(t))return!1;var i;if(!0===t)i=rn;else{if(!oe(t))return!1;if(t.length>10)return Kr.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;i=t.map((t=>t.toLowerCase()))}return e.some((t=>{var e=t.safeText,r=t.ariaLabel;return i.some((t=>nn(e,t)||nn(r,t)))}))}(r,a.map((t=>{var e;return{safeText:Ys(t).toLowerCase(),ariaLabel:(null==(e=t.getAttribute("aria-label"))?void 0:e.toLowerCase().trim())||""}})))&&!Zs(a,i)}var hn=t=>!t||zs(t,"html")||!Bs(t),un=(t,e)=>{if(!xt||hn(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,r=[t],s=t;s.parentNode&&!zs(s,"body");)if(Hs(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var n=tn(s);if(!n)break;if(e||Xs.indexOf(n.tagName.toLowerCase())>-1)i=!0;else try{var o=xt.getComputedStyle(n);o&&"pointer"===o.getPropertyValue("cursor")&&(i=!0)}catch(t){}r.push(n),s=n}return{parentIsUsefulElement:i,targetElementList:r}};function dn(t){for(var e=new Set,i=0,r=t;r.parentNode&&!zs(r,"body");r=r.parentNode){if(i++>=Vs||e.has(r))return!1;e.add(r);var s=Ks(r);if(Zt(s,"ph-sensitive")||Zt(s,"ph-no-capture"))return!1}if(Zt(Ks(t),"ph-include"))return!0;var n=t.type||"";if(de(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var o=t.name||t.id||"";return!de(o)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(o.replace(/[^a-zA-Z0-9]/g,""))}function vn(t){return!!(zs(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||zs(t,"select")||zs(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var cn=new RegExp("^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$"),fn=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,pn=[16,15,14,13],_n=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),gn=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),mn=/[0-9A-Za-z_]/;function yn(t){for(var e=0,i=!1,r=t.length-1;r>=0;r--){var s=t.charCodeAt(r)-48;i&&(s*=2)>9&&(s-=9),e+=s,i=!i}return e%10==0}function bn(t,e){if(void 0===e&&(e=!0),fe(t))return!1;if(de(t)){t=te(t);var i=e?cn.test((t||"").replace(/[- ]/g,"")):function(t){var e;for(fn.lastIndex=0;e=fn.exec(t);){var i=e[2];if(i)for(var r=i.replace(/[- ]/g,""),s=0;r.length>s;s++)for(var n of pn){var o=s+n;if(r.length>=o){var a=r.slice(s,o);if(cn.test(a)&&yn(a))return!0}}}return!1}(t);if(i)return!1;var r=e?_n.test(t):function(t){var e;for(gn.lastIndex=0;e=gn.exec(t);){var i=e[1],r=e[3];if(!(i&&r&&mn.test(i)&&mn.test(r)))return!0}return!1}(t);if(r)return!1}return!0}function wn(t){var e=Ys(t);return bn(e=(e+" "+xn(t)).trim())?e:""}function xn(t){var e="";return t&&t.childNodes&&t.childNodes.length&&Qr(t.childNodes,(function(t){var i;if(t&&"span"===(null==(i=t.tagName)?void 0:i.toLowerCase()))try{var r=Ys(t);e=(e+" "+r).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+xn(t)).trim())}catch(t){Kr.error("[AutoCapture]",t)}})),e}function En(t){return t.replace(/"|\\"/g,'\\"')}function Sn(t){var e=t.attr__class;if(e)return oe(e)?e:Ws(e)}var kn=Jr("[Dead Clicks]"),Tn=()=>!0,$n=t=>{var e,i=!(null==(e=t.instance.persistence)||!e.get_property(g)),r=t.instance.config.capture_dead_clicks;return ge(r)?r:!!le(r)||i};class Pn{get lazyLoadedDeadClicksAutocapture(){return this.qs}constructor(t,e,i){this.instance=t,this.isEnabled=e,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(t){if(t.ok){var e=t.config;"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[g]:e.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.js((()=>{this.Bs()})):this.stop()}js(t){var e,i;null!=(e=Ft.__PosthogExtensions__)&&e.initDeadClicksAutocapture?t():null==(i=Ft.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(e=>{e?kn.error("failed to load script",e):t()}))}Bs(){var t;if(kt){if(!this.qs&&null!=(t=Ft.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var e=le(this.instance.config.capture_dead_clicks)?i({},this.instance.config.capture_dead_clicks):{};e.__onCapture=this.onCapture,this.onCapture&&(e.capture_dead_swipes=!1),this.qs=Ft.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,e),this.qs.start(kt),kn.info("starting...")}}else kn.error("`document` not found. Cannot start.")}stop(){this.qs&&(this.qs.stop(),this.qs=void 0,kn.info("stopping..."))}}var Rn=Jr("[SegmentIntegration]");var Cn="posthog-js";function On(t,e){var r=void 0===e?{}:e,s=r.organization,n=r.projectId,o=r.prefix,a=r.severityAllowList,l=void 0===a?["error"]:a,h=r.sendExceptionsToPostHog,u=void 0===h||h;return e=>{var r,a,h,d,v;if("*"!==l&&!l.includes(e.level)||!t.__loaded)return e;e.tags||(e.tags={});var c=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());e.tags["PostHog Person URL"]=c,t.sessionRecordingStarted()&&(e.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var f,p=(null==(r=e.exception)?void 0:r.values)||[],_=p.map((t=>i({},t,{stacktrace:t.stacktrace?i({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map((t=>i({},t,{platform:"web:javascript"})))}):void 0}))),g={$exception_message:(null==(a=p[0])?void 0:a.value)||e.message,$exception_type:null==(h=p[0])?void 0:h.type,$exception_level:e.level,$exception_list:_,$sentry_event_id:e.event_id,$sentry_exception:e.exception,$sentry_exception_message:(null==(d=p[0])?void 0:d.value)||e.message,$sentry_exception_type:null==(v=p[0])?void 0:v.type,$sentry_tags:e.tags};return s&&n&&(g.$sentry_url=(o||"https://sentry.io/organizations/")+s+"/issues/?project="+n+"&query="+e.event_id),u&&(null==(f=t.exceptions)||f.sendExceptionEvent(g)),e}}class In{constructor(t,e,i,r,s,n){this.name=Cn,this.setupOnce=function(o){o(On(t,{organization:e,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class An{constructor(t){this.Hs=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(Kr.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.zs=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.Us()}Us(){var t;this.Ws=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.Hs)}destroy(){var t;null==(t=this.Ws)||t.call(this),this.Ws=void 0}doPageView(t,e){var i,r=this.Vs(t,e);return this.zs={pathname:null!==(i=null==xt?void 0:xt.location.pathname)&&void 0!==i?i:"",pageViewId:e,timestamp:t},this._instance.scrollManager.resetContext(),r}doPageLeave(t){var e;return this.Vs(t,null==(e=this.zs)?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.zs)?void 0:t.pageViewId}}Vs(t,e){var i=this.zs;if(!i)return{$pageview_id:e};var r={$pageview_id:e,$prev_pageview_id:i.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var n=s.maxScrollHeight,o=s.lastScrollY,a=s.maxScrollY,l=s.maxContentHeight,h=s.lastContentY,u=s.maxContentY;if(!(ue(n)||ue(o)||ue(a)||ue(l)||ue(h)||ue(u))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),h=Math.ceil(h),u=Math.ceil(u);var d=n>1?Re(o/n,0,1,Kr):1,v=n>1?Re(a/n,0,1,Kr):1,c=l>1?Re(h/l,0,1,Kr):1,f=l>1?Re(u/l,0,1,Kr):1;r=Xr(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:v,$prev_pageview_last_content:h,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:f})}}return i.pathname&&(r.$prev_pageview_pathname=i.pathname),i.timestamp&&(r.$prev_pageview_duration=(t.getTime()-i.timestamp.getTime())/1e3),r}}var Fn=["flags","surveys"],Mn={[n]:{exposure:"hidden"},[h]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[u]:{exposure:"hidden"},[d]:{exposure:"event"},[v]:{exposure:"hidden"},[y]:{exposure:"hidden"},[c]:{exposure:"event"},[f]:{exposure:"hidden"},[p]:{exposure:"event"},[_]:{exposure:"event"},[g]:{exposure:"event"},[m]:{exposure:"hidden"},[b]:{exposure:"event"},[w]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[P]:{exposure:"hidden"},[R]:{exposure:"event"},[x]:{exposure:"event",shouldSkipFromEventProperties:t=>ce(t)},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},$sess_rec_flush_size:{exposure:"hidden"},[C]:{exposure:"hidden",storageGroup:"flags"},[O]:{exposure:"hidden",storageGroup:"flags"},[I]:{exposure:"hidden"},[A]:{exposure:"hidden",storageGroup:"flags"},[F]:{exposure:"hidden",storageGroup:"flags"},[M]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[D]:{exposure:"hidden",storageGroup:"flags"},[N]:{exposure:"hidden"},[L]:{exposure:"hidden"},[U]:{exposure:"hidden"},[j]:{exposure:"hidden"},[z]:{exposure:"hidden",storageGroup:"surveys"},[q]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[H]:{exposure:"event"},[V]:{exposure:"hidden"},[W]:{exposure:"hidden"},[G]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$product_tours_activated_session:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[K]:{exposure:"hidden"},[J]:{exposure:"hidden"},[B]:{exposure:"event"},[Y]:{exposure:"hidden"},[Q]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[X]:{exposure:"hidden"},[Z]:{exposure:"hidden"},[tt]:{exposure:"hidden"},[et]:{exposure:"hidden"},[it]:{exposure:"hidden"},[rt]:{exposure:"hidden"},[st]:{exposure:"hidden"},[E]:{exposure:"event"},[S]:{exposure:"event"},[k]:{exposure:"event"},[T]:{exposure:"event"},[at]:{exposure:"event"},[lt]:{exposure:"event"},[ht]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_pending_trigger_conditions:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},Dn=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Nn=t=>{var e=Mn[t];if(e)return e;for(var i of Dn){var r=i[1];if(0===t.indexOf(i[0]))return r}},Ln=(t,e)=>{try{return JSON.stringify(t,((t,e)=>"bigint"==typeof e?e.toString():e),e)}catch(e){return ie(t)}},Un=t=>{var e=null==kt?void 0:kt.createElement("a");return ue(e)?null:(e.href=t,e)},jn=function(t,e){for(var i,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===e){i=n;break}}if(!oe(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(t){Kr.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Bn=function(t,e,i){if(!t||!e||!e.length)return t;for(var r=t.split("#"),s=r[1],n=(r[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),h=[],u=0;l.length>u;u++){var d=l[u].split("=");oe(d)&&(e.includes(d[0])?h.push(d[0]+"="+i):h.push(l[u]))}var v=a;return null!=o&&(v+="?"+h.join("&")),null!=s&&(v+="#"+s),v},zn=function(t,e){var i=t.match(new RegExp(e+"=([^&]*)"));return i?i[1]:null},qn=(t,e)=>t>=e&&It(),Hn=(t,e,i,r)=>{if(0===t){if(It()){var s=e+1;return s===i&&r(),s}return e}return 0},Vn="https?://(.*)",Wn=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Gn=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Wn],Kn="<masked>",Jn=["li_fat_id"];function Yn(t,e,i){if(!kt)return{};var r,s=e?[...Wn,...i||[]]:[],n=Qn(Bn(kt.URL,s,Kn),t),o=(r={},Qr(Jn,(function(t){var e=as(t);r[t]=e||null})),r);return Xr(o,n)}function Qn(t,e){var i=Gn.concat(e||[]),r={};return Qr(i,(function(e){var i=jn(t,e);r[e]=i||null})),r}function Xn(t){var e=function(t){return t?0===t.search(Vn+"google.([^/?]*)")?"google":0===t.search(Vn+"bing.com")?"bing":0===t.search(Vn+"yahoo.com")?"yahoo":0===t.search(Vn+"duckduckgo.com")?"duckduckgo":null:null}(t),i="yahoo"!=e?"q":"p",r={};if(!ce(e)){r.$search_engine=e;var s=kt?jn(kt.referrer,i):"";s.length&&(r.ph_keyword=s)}return r}function Zn(){return navigator.language||navigator.userLanguage}var to="$direct";function eo(){return(null==kt?void 0:kt.referrer)||to}function io(t,e,i){void 0===i&&(i=!1);var r=t?[...Wn,...e||[]]:[],s=i?Li(null==Tt?void 0:Tt.href):null==Tt?void 0:Tt.href,n=null==s?void 0:s.substring(0,1e3);return{r:eo().substring(0,1e3),u:n?Bn(n,r,Kn):void 0}}function ro(t,e){var i;void 0===e&&(e=!1);var r=t.r,s=t.u,n=e?Li(s):s,o={$referrer:r,$referring_domain:null==r?void 0:r==to?to:null==(i=Un(r))?void 0:i.host};if(n){o.$current_url=n;var a=Un(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname;var l=Qn(n);Xr(o,l)}if(r){var h=Xn(r);Xr(o,h)}return o}function so(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function no(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var oo={flags:Q,surveys:q},ao=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],lo=t=>t+"_cookie_identity_change_pending",ho="main",uo=(t,e)=>{Qr(t,((i,r)=>{var s=Nn(r);s&&"event"!==s.exposure||{}.hasOwnProperty.call(e,r)||delete t[r]}))};class vo{constructor(t,e,r){if(void 0===r&&(r=!0),this.Gs={},this.Zs=!1,this.Qs=!1,this.Js=!1,this.Ks=!1,this.nn=t,this.Ys=r,this.props={},this.Xs=void 0,this.ta=(t=>{var e="";return t.token&&(e=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+e+"_posthog"})(t),this.Ds=this.ea(t),this.Qs=this.ia(t),this.load(),t.debug&&Kr.info("Persistence loaded",t.persistence,i({},this.props)),this.update_config(t,t,e),this.save(),xt){var s=()=>this.flush();ns(xt,"beforeunload",s,{capture:!1}),ns(xt,"pagehide",s,{capture:!1})}}ra(){var t,e=null==(t=this.nn)?void 0:t.persistence_save_debounce_ms;return pe(e)&&e>0?e:0}na(t){if(this.nn.cookieWinsOnConflict&&"localstorage+cookie"===this.nn.persistence.toLowerCase())if(t)try{var e=ks(t,this.nn.cookie_persisted_properties||[]),i=$s(e,this.nn.cookie_persisted_properties||[]),r=JSON.stringify(e)+"|"+JSON.stringify(i),s=gs.ti(this.ta)||void 0;s&&Rs(this.ta,s)===r&&(this.sa=r,this.aa=s)}catch(t){}else try{var n=gs.ti(this.ta)||void 0;this.sa=n?Rs(this.ta,n):void 0,this.aa=n}catch(t){}}syncCookieProperties(){return this.oa(this.nn)}oa(t,e){if(void 0===e&&(e=!1),this.la&&!e||this.Ks||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;var i;try{i=gs.ti(this.ta)||void 0}catch(t){}if(!i||i===this.aa)return!1;var r,s=Rs(this.ta,i);try{r=Ss(JSON.parse(i))}catch(t){return!1}if((gs.ti(this.ta)||void 0)!==i)return!1;this.sa=s,this.aa=i;var n=Ps(this.ta,i),a=[...ws,...n.properties],l={};if(Object.keys(r).forEach((t=>{var e=r[t];(ue(e)||ce(e)||""===e||t===X&&e!==ct&&e!==ft)&&(l[t]=!0,delete r[t])})),he(r))return!1;var u=o in r||r[X]===ct||r[X]===ft,d=this.props[o],v=this.props[X],c=Xr({},this.props);[...ws,...t.cookie_persisted_properties||[]].forEach((t=>{if(-1!==a.indexOf(t)&&!(t in r)&&!l[t]&&(u||t!==o&&t!==X)){var e=c[t];!n.isValid&&-1!==ws.indexOf(t)&&(!1===e||0===e)||delete c[t]}})),this.props=Xr(c,r),!u||X in r||X in this.props||this.ua(X,ct);var f=this.props[o],p=this.props[X];return!u||f===d&&p===v||(this.Js=!0,As.ei(lo(this.ta),!0),this.ha(U),this.ha(O),this.ha(C),this.ha(A),this.ha(F),this.ha(M),this.ha(Q),this.ha(Y),this.ha(K),p===ct&&(v===ft||r[X]===ct||!ue(d)&&f!==d)&&(uo(this.props,r),this.ha(j)),p===ft?this.props.$user_id=f:delete this.props.$user_id,this.ha(h)),!0}consumeCookieIdentityChange(){var t=lo(this.ta),e=this.Js||!!As.ti(t);return this.Js=!1,e&&As.ri(t),e}da(t){return void 0===t&&(t=!1),!(this.Ks||this.la&&!t||!this.nn.cookieWinsOnConflict||"localstorage+cookie"!==this.nn.persistence.toLowerCase()||(this.Ks=!0,0))}va(){this.Ks&&(ue(this.ca)||(clearTimeout(this.ca),this.ca=void 0),delete this.Gs[ho],this.fa(!0))}pa(t){if(void 0===t&&(t=!0),this.Ks)try{t?this.va():ue(this.ca)||(clearTimeout(this.ca),this.ca=void 0)}finally{this.Ks=!1}}isDisabled(){return!!this.la}ea(t){-1===ao.indexOf(t.persistence.toLowerCase())&&(Kr.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var e,r=function(t,e){void 0===t&&(t=[]),void 0===e&&(e=!1);var r=[...ws,...t];return i({},ys,{ni(t){try{var i,s={};try{i=gs.ti(t)||void 0,s=i?Ss(JSON.parse(i)):{}}catch(t){}var n,a=JSON.parse(ys.ti(t)||"{}");if(e){var l=Ps(t,i),h=[...ws,...l.properties],u={};Object.keys(s).forEach((t=>{var e=s[t];ce(e)||""===e||t===X&&e!==ct&&e!==ft||(u[t]=e)}));var d=o in u||u[X]===ct||u[X]===ft;if(Object.keys(u).length>0){var v,c=a[o],f=null!==(v=a[X])&&void 0!==v?v:ct;r.forEach((t=>{if(-1!==h.indexOf(t)&&!(t in s)&&(d||t!==o&&t!==X)){var e=a[t];!l.isValid&&-1!==ws.indexOf(t)&&(!1===e||0===e)||delete a[t]}})),!d||X in s||X in a||(a[X]=ct),!d||(o in u?u[o]:a[o])===c&&(X in u?u[X]:a[X])===f||(bs.forEach((t=>delete a[t])),u[X]===ft&&o in u?a.$user_id=u[o]:delete a.$user_id,u[X]!==ft&&(delete a[B],delete a[j]),delete a.__alias)}n=Xr(a,u)}else n=Xr(s,a);return ys.ei(t,n),n}catch(t){}return null},ei(i,r,s,n,o,a){var l=ys.ei(i,r,void 0,void 0,a);try{var h=ks(r,t);if(Object.keys(h).length){if(e){var u=xs(i),d=$s(h,t);if(gs.ei(u,d,s,n,o,a),gs.ti(u)!==JSON.stringify(d)){gs.ri(u,n);var v=ks(r);return gs.ei(i,v,s,n,o,a),l}}gs.ei(i,h,s,n,o,a)}}catch(t){ys.ii(t)}return l},ri(t,e){try{null==xt||xt.localStorage.removeItem(t),gs.ri(t,e),gs.ri(xs(t),e)}catch(t){ys.ii(t)}}})}(t.cookie_persisted_properties||[],t.cookieWinsOnConflict),s=!1,n=t.persistence.toLowerCase();return"localstorage"===n&&ys.Xr()?(e=ys,s=!0):"localstorage+cookie"===n&&r.Xr()?(e=r,s=!0):"sessionstorage"===n&&As.Xr()?e=As:"memory"===n?e=Os:"cookie"===n?e=gs:r.Xr()?(e=r,s=!0):e=gs,this.Zs=s,e}ga(t){return this.ta+"__"+t}ia(t){return this.Zs&&!!t.split_storage}properties(){var t={};return Qr(this.props,((e,i)=>{var r=Nn(i);if(!r||"event"===r.exposure){if(null!=r&&null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(e))return;t[i]=e}})),t}load(t){if(void 0===t&&(t=!1),!this.la||t){var e=this.nn.cookieWinsOnConflict&&"localstorage+cookie"===this.nn.persistence.toLowerCase(),i=e?ys.ni(this.ta):null,r={};if(e)try{Qr(r=Ss(gs.ni(this.ta)),((t,e)=>{(ue(t)||ce(t)||""===t)&&delete r[e]}))}catch(t){}var s=this.Ds.ni(this.ta);if(s&&(this.props=Xr({},s)),this.Qs&&this.ma(),e&&s){var n,a,l=null==i?void 0:i[o],h=null!==(n=null==i?void 0:i[X])&&void 0!==n?n:ct,u=s[o],d=null!==(a=s[X])&&void 0!==a?a:ct;if(u!==l||d!==h){this.Js=!0,As.ei(lo(this.ta),!0);var v=Xr({},this.props);bs.forEach((t=>delete v[t])),d===ct&&(h===ft||r[X]===ct||!ue(l)&&u!==l)&&(uo(v,r),delete v[j]),this.props=v;var c=new Set;bs.forEach((t=>{var e,i=null==(e=Nn(t))?void 0:e.storageGroup;i&&c.add(i)})),c.forEach((t=>{var e={};Qr(this.props,((i,r)=>{var s;(null==(s=Nn(r))?void 0:s.storageGroup)===t&&(e[r]=i)})),he(e)?(ys.ri(this.ga(t)),this.Gs[t]={}):ys.ei(this.ga(t),e)&&(this.Gs[t]={persisted:!0,fingerprint:this.ya(e,t)})}))}}As.ti(lo(this.ta))&&(this.Js=!0)}}ma(){for(var t of Fn){var e=ys.ni(this.ga(t));if(e&&!he(e)){var i=this.ba(t);i.persisted=!0,this._a(t)||(i.fingerprint=this.ya(e,t)),this.wa(t,e)||Xr(this.props,e)}}}_a(t){return Object.keys(this.props).some((e=>{var i;return(null==(i=Nn(e))?void 0:i.storageGroup)===t}))}wa(t,e){var i=oo[t];if(!i)return!1;var r=e[i],s=this.props[i];return pe(r)&&pe(s)&&s>r}refreshKey(t){var e;if(!this.la){var i=this.Qs?null==(e=Nn(t))?void 0:e.storageGroup:void 0,r=i?ys.ni(this.ga(i)):this.Ds.ni(this.ta);if(r&&t in r)this.ua(t,r[t]);else{if(i){var s=this.Ds.ni(this.ta);if(s&&t in s)return void this.ua(t,s[t])}this.ha(t)}}}save(){if(!this.la){var t=this.ra();t>0?ue(this.ca)&&(this.ca=setTimeout((()=>{this.ca=void 0,this.fa()}),t)):this.fa()}}flush(){ue(this.ca)||(clearTimeout(this.ca),this.ca=void 0,this.fa())}fa(t){void 0===t&&(t=!1),this.la||this.Ks&&!t||(t||this.syncCookieProperties(),this.Qs?this.ka():this.Sa(this.Ds,this.ta,this.props,ho)&&this.na(this.props))}ka(){var t=this.xa(),e=t.main,i=t.groups;for(var r of(this.Sa(this.Ds,this.ta,e,ho)&&this.na(e),Fn)){var s,n=i[r];(!he(n)||null!=(s=this.Gs[r])&&s.persisted)&&this.Sa(ys,this.ga(r),n,r)}}xa(){var t={},e={flags:{},surveys:{}};return Qr(this.props,((i,r)=>{var s,n=null==(s=Nn(r))?void 0:s.storageGroup;n?e[n][r]=i:t[r]=i})),{main:t,groups:e}}ya(t,e){if(e===ho)return JSON.stringify(t)+"|"+this.Ca+"|"+this.Ta+"|"+this.Ma;var i={};return Qr(t,((t,e)=>{var r;i[e]=null!=(r=Nn(e))&&r.volatile?"__volatile__":t})),JSON.stringify(i)}Sa(t,e,i,r){var s,n=this.ba(r);if(r!==ho&&!n.dirty&&!ue(n.fingerprint))return!1;try{if((s=this.ya(i,r))===n.fingerprint)return n.dirty=!1,!1}catch(t){s=void 0}return t.ei(e,i,this.Ca,this.Ta,this.Ma,this.nn.debug)?(n.dirty=!1,r!==ho&&(n.persisted=!0),ue(s)||(n.fingerprint=s),!0):(this.nn.debug&&Kr.warn('failed to persist storage entry "'+e+'"; will retry on next save'),!1)}remove(t){var e=(void 0===t?{}:t).keepGroupEntries,i=void 0!==e&&e;if(ue(this.ca)||(clearTimeout(this.ca),this.ca=void 0),this.Ds.ri(this.ta,!1),this.Ds.ri(this.ta,!0),!i&&this.Ys)for(var r of Fn)ys.ri(this.ga(r));i?delete this.Gs[ho]:this.Gs={},this.sa=void 0,this.aa=void 0}clear(){this.remove(),this.props={}}register_once(t,e,i){if(le(t)){this.syncCookieProperties(),ue(e)&&(e="None"),this.Ca=ue(i)?this.Ea:i;var r=!1;if(Qr(t,((t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this.ua(i,t),r=!0)})),r)return this.save(),!0}return!1}register(t,e){if(le(t)){this.syncCookieProperties(),this.Ca=ue(e)?this.Ea:e;var i=!1;if(Qr(t,((e,r)=>{t.hasOwnProperty(r)&&(this.props[r]!==e||le(e)||oe(e))&&(this.ua(r,e),i=!0)})),i)return this.save(),!0}return!1}unregister(t){this.syncCookieProperties();var e="string"==typeof t?[t]:t,i=!1;for(var r of e)r in this.props&&(this.ha(r),i=!0);i&&this.save()}update_campaign_params(){var t=null==kt?void 0:kt.URL;if(t!==this.Xs){var e=Yn(this.nn.custom_campaign_params,this.nn.mask_personal_data_properties,this.nn.custom_personal_data_properties);he(is(e))||this.register(e),this.Xs=t}}update_search_keyword(){var t;this.register((t=null==kt?void 0:kt.referrer)?Xn(t):{})}update_referrer_info(){var t;this.register_once({$referrer:eo(),$referring_domain:null!=kt&&kt.referrer&&(null==(t=Un(kt.referrer))?void 0:t.host)||to},void 0)}set_initial_person_info(){this.props[et]||this.props[it]||this.register_once({[rt]:io(this.nn.mask_personal_data_properties,this.nn.custom_personal_data_properties,this.nn.disable_capture_url_hashes)},void 0)}get_initial_props(){var t={};Qr([it,et],(e=>{var i=this.props[e];i&&Qr(i,(function(e,i){t["$initial_"+ee(i)]=e}))}));var e=this.props[rt];if(e){var i=function(t,e){void 0===e&&(e=!1);var i=ro(t,e),r={};return Qr(i,(function(t,e){r["$initial_"+ee(e)]=t})),r}(e,this.nn.disable_capture_url_hashes);Xr(t,i)}return t}safe_merge(t){return Qr(this.props,(function(e,i){i in t||(t[i]=e)})),t}update_config(t,e,r){var s=t.persistence!==e.persistence,n=!((t,e)=>{if(t.length!==e.length)return!1;var i=[...t].sort(),r=[...e].sort();return i.every(((t,e)=>t===r[e]))})(t.cookie_persisted_properties||[],e.cookie_persisted_properties||[]),o=s||n,a=t.cookieWinsOnConflict!==e.cookieWinsOnConflict,l=t.disable_persistence||!!r,h=!!this.la&&!l;l||this.oa(e,h),this.nn=t,!l&&(s||n||a)&&(this.sa=void 0,this.aa=void 0,this.oa(i({},t,{cookie_persisted_properties:e.cookie_persisted_properties}),h));var u=o||a?this.ea(t):this.Ds,d=this.ia(t),v=o||d!==this.Qs,c=!l&&(v||t.cross_subdomain_cookie!==this.Ta||t.secure_cookie!==this.Ma)&&this.da(h);try{if(this.Ea=this.Ca=t.cookie_expiration,this.set_disabled(l),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),v){var f=this.props;this.clear(),this.Ds=u,this.Qs=d,this.props=f,this.save()}else a&&(this.Ds=u,l||(delete this.Gs[ho],this.fa()))}finally{c&&this.pa()}}set_disabled(t){this.la=t,this.la?this.remove():this.save()}set_cross_subdomain(t){t!==this.Ta&&(this.Ta=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.Ma&&(this.Ma=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,e){var i=this.props[u]||{};i[t]=e,this.ua(u,i),this.save()}remove_event_timer(t){var e=this.props[u]||{},i=e[t];return ue(i)||(delete e[t],this.ua(u,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this.ua(t,e),this.save()}ua(t,e){var i;this.props[t]=e,null!=(i=Nn(t))&&i.volatile||this.Ia(t)}ha(t){delete this.props[t],this.Ia(t)}Ia(t){var e,i=null==(e=Nn(t))?void 0:e.storageGroup;i&&(this.ba(i).dirty=!0)}ba(t){return this.Gs[t]||(this.Gs[t]={})}}function co(t){var e=!0;return{dispose(){if(e){e=!1;var i=t();i&&ae(i.then)&&i.then(void 0,(()=>{}))}}}}var fo={GZipJS:"gzip-js",Base64:"base64"},po={Activation:"events",Cancellation:"cancelEvents"},_o={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},go={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},mo={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"},yo={Popover:"popover",Inline:"inline"},bo={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"},wo={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"},xo=Jr("[RateLimiter]");class Eo{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var e=t.text;if(e&&e.length)try{(JSON.parse(e).quota_limited||[]).forEach((t=>{xo.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void xo.warn('could not rate limit - continuing. Error: "'+(null==t?void 0:t.message)+'"',{text:e})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return(null==(t=this.instance.config.rate_limiting)?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null==(t=this.instance.config.rate_limiting)?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var e,i,r;void 0===t&&(t=!1);var s=this.captureEventsBurstLimit,n=this.captureEventsPerSecond,o=(new Date).getTime(),a=null!==(e=null==(i=this.instance.persistence)?void 0:i.get_property(tt))&&void 0!==e?e:{tokens:s,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>s&&(a.tokens=s);var l=1>a.tokens;if(l||t||(a.tokens=Math.max(0,a.tokens-1)),l&&!t){var h=(pe(a.dropped)?a.dropped:0)+1;a.dropped=h,!this.lastEventRateLimited&&this.Ra(h)&&(a.dropped=0)}return this.lastEventRateLimited=l,null==(r=this.instance.persistence)||r.set_property(tt,a),{isRateLimited:l,remainingTokens:a.tokens}}Pa(t){var e=this.instance.config.property_denylist;return!oe(e)||!e.includes(t)}Aa(){var t;if(this.Pa("$current_url")&&this.Pa("$pathname")&&null!=Tt&&Tt.pathname)return""+(null!==(t=Tt.origin)&&void 0!==t?t:"")+Tt.pathname}Ra(t){var e,i,r=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,n=this.Aa(),o=this.Pa("$session_id")?null==(e=(i=this.instance).get_session_id)?void 0:e.call(i):void 0,a=[t+" event(s) dropped since the last warning",n?"triggered on "+n:void 0,o?"session "+o:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited: "+a+". Config is set to "+s+" events per second and "+r+" events burst limit."},{skip_client_rate_limiting:!0})}isServerRateLimited(t){var e=this.serverLimits[t||"events"]||!1;return!1!==e&&(new Date).getTime()<e}}var So=Jr("[RemoteConfig]");class ko{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=Ft._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}Fa(t){var e,i;null!=(e=Ft.__PosthogExtensions__)&&e.loadExternalDependency?null==(i=Ft.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}Oa(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t})}load(){try{if(this.remoteConfig)return So.info("Using preloaded remote config",this.remoteConfig),void this.La(this.remoteConfig);if(this._instance.Da())return void So.warn("Remote config is disabled. Falling back to local config.");this.Fa((t=>{if(!t)return So.info("No config found after loading remote JS config. Falling back to JSON."),void this.Oa((t=>{this.La(t.json,t)}));this.La(t)}))}catch(t){So.error("Error loading remote config",t),this.La()}}La(t,e){!t&&e&&(0===e.statusCode?e.error||So.warn("Failed to fetch remote config from PostHog."):So.error("Failed to fetch remote config from PostHog."));try{this._instance.La(t?{ok:!0,config:t}:{ok:!1})}catch(t){So.error("Error applying remote config",t)}if(!1!==(null==t?void 0:t.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var i;null==(i=this._instance.featureFlags)||i.ensureFlagsLoaded()}catch(t){So.error("Error loading feature flags",t)}}}var To=Uint8Array,$o=Uint16Array,Po=Uint32Array,Ro=new To([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]),Co=new To([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]),Oo=new To([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Io=function(t,e){for(var i=new $o(31),r=0;31>r;++r)i[r]=e+=1<<t[r-1];var s=new Po(i[30]);for(r=1;30>r;++r)for(var n=i[r];i[r+1]>n;++n)s[n]=n-i[r]<<5|r;return[i,s]},Ao=Io(Ro,2),Fo=Ao[1];Ao[0][28]=258,Fo[258]=28;for(var Mo=Io(Co,0)[1],Do=new $o(32768),No=0;32768>No;++No){var Lo=(43690&No)>>>1|(21845&No)<<1;Do[No]=((65280&(Lo=(61680&(Lo=(52428&Lo)>>>2|(13107&Lo)<<2))>>>4|(3855&Lo)<<4))>>>8|(255&Lo)<<8)>>>1}var Uo=function(t,e,i){for(var r=t.length,s=0,n=new $o(e);r>s;++s)++n[t[s]-1];var o,a=new $o(e);for(s=0;e>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new $o(1<<e);var l=15-e;for(s=0;r>s;++s)if(t[s])for(var h=s<<4|t[s],u=e-t[s],d=a[t[s]-1]++<<u,v=d|(1<<u)-1;v>=d;++d)o[Do[d]>>>l]=h}else for(o=new $o(r),s=0;r>s;++s)o[s]=Do[a[t[s]-1]++]>>>15-t[s];return o},jo=new To(288);for(No=0;144>No;++No)jo[No]=8;for(No=144;256>No;++No)jo[No]=9;for(No=256;280>No;++No)jo[No]=7;for(No=280;288>No;++No)jo[No]=8;var Bo=new To(32);for(No=0;32>No;++No)Bo[No]=5;var zo=Uo(jo,9,0),qo=Uo(Bo,5,0),Ho=function(t){return(t/8>>0)+(7&t&&1)},Vo=function(t,e,i){(null==i||i>t.length)&&(i=t.length);var r=new(t instanceof $o?$o:t instanceof Po?Po:To)(i-e);return r.set(t.subarray(e,i)),r},Wo=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8},Go=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8,t[r+2]|=i>>>16},Ko=function(t,e){for(var i=[],r=0;t.length>r;++r)t[r]&&i.push({s:r,f:t[r]});var s=i.length,n=i.slice();if(!s)return[new To(0),0];if(1==s){var o=new To(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort((function(t,e){return t.f-e.f})),i.push({s:-1,f:25001});var a=i[0],l=i[1],h=0,u=1,d=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=s-1;)a=i[i[d].f>i[h].f?h++:d++],l=i[h!=u&&i[d].f>i[h].f?h++:d++],i[u++]={s:-1,f:a.f+l.f,l:a,r:l};var v=n[0].s;for(r=1;s>r;++r)n[r].s>v&&(v=n[r].s);var c=new $o(v+1),f=Jo(i[u-1],c,0);if(f>e){r=0;var p=0,_=f-e,g=1<<_;for(n.sort((function(t,e){return c[e.s]-c[t.s]||t.f-e.f}));s>r;++r){var m=n[r].s;if(e>=c[m])break;p+=g-(1<<f-c[m]),c[m]=e}for(p>>>=_;p>0;){var y=n[r].s;e>c[y]?p-=1<<e-c[y]++-1:++r}for(;r>=0&&p;--r){var b=n[r].s;c[b]==e&&(--c[b],++p)}f=e}return[new To(c),f]},Jo=function(t,e,i){return-1==t.s?Math.max(Jo(t.l,e,i+1),Jo(t.r,e,i+1)):e[t.s]=i},Yo=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new $o(++e),r=0,s=t[0],n=1,o=function(t){i[r++]=t},a=1;e>=a;++a)if(t[a]==s&&a!=e)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=t[a]}return[i.subarray(0,r),e]},Qo=function(t,e){for(var i=0,r=0;e.length>r;++r)i+=t[r]*e[r];return i},Xo=function(t,e,i){var r=i.length,s=Ho(e+2);t[s]=255&r,t[s+1]=r>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var n=0;r>n;++n)t[s+n+4]=i[n];return 8*(s+4+r)},Zo=function(t,e,i,r,s,n,o,a,l,h,u){Wo(e,u++,i),++s[256];for(var d=Ko(s,15),v=d[0],c=d[1],f=Ko(n,15),p=f[0],_=f[1],g=Yo(v),m=g[0],y=g[1],b=Yo(p),w=b[0],x=b[1],E=new $o(19),S=0;m.length>S;++S)E[31&m[S]]++;for(S=0;w.length>S;++S)E[31&w[S]]++;for(var k=Ko(E,7),T=k[0],P=k[1],R=19;R>4&&!T[Oo[R-1]];--R);var C,O,I,A,F=h+5<<3,M=Qo(s,jo)+Qo(n,Bo)+o,D=Qo(s,v)+Qo(n,p)+o+14+3*R+Qo(E,T)+(2*E[16]+3*E[17]+7*E[18]);if(M>=F&&D>=F)return Xo(e,u,t.subarray(l,l+h));if(Wo(e,u,1+(M>D)),u+=2,M>D){C=Uo(v,c,0),O=v,I=Uo(p,_,0),A=p;var N=Uo(T,P,0);for(Wo(e,u,y-257),Wo(e,u+5,x-1),Wo(e,u+10,R-4),u+=14,S=0;R>S;++S)Wo(e,u+3*S,T[Oo[S]]);u+=3*R;for(var L=[m,w],U=0;2>U;++U){var j=L[U];for(S=0;j.length>S;++S)Wo(e,u,N[B=31&j[S]]),u+=T[B],B>15&&(Wo(e,u,j[S]>>>5&127),u+=j[S]>>>12)}}else C=zo,O=jo,I=qo,A=Bo;for(S=0;a>S;++S)if(r[S]>255){var B;Go(e,u,C[257+(B=r[S]>>>18&31)]),u+=O[B+257],B>7&&(Wo(e,u,r[S]>>>23&31),u+=Ro[B]);var z=31&r[S];Go(e,u,I[z]),u+=A[z],z>3&&(Go(e,u,r[S]>>>5&8191),u+=Co[z])}else Go(e,u,C[r[S]]),u+=O[r[S]];return Go(e,u,C[256]),u+O[256]},ta=new Po([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ea=function(){for(var t=new Po(256),e=0;256>e;++e){for(var i=e,r=9;--r;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),ia=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function ra(t,e){void 0===e&&(e={});var i=function(){var t=4294967295;return{p(e){for(var i=t,r=0;e.length>r;++r)i=ea[255&i^e[r]]^i>>>8;t=i},d(){return 4294967295^t}}}(),r=t.length;i.p(t);var s,n,o,a,l,h=(a=10+((s=e).filename&&s.filename.length+1||0),l=8,function(t,e,i,r,s,n){var o=t.length,a=new To(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),h=0;if(!e||8>o)for(var u=0;o>=u;u+=65535){var d=u+65535;o>d?h=Xo(l,h,t.subarray(u,d)):(l[u]=!0,h=Xo(l,h,t.subarray(u,o)))}else{for(var v=ta[e-1],c=v>>>13,f=8191&v,p=(1<<i)-1,_=new $o(32768),g=new $o(p+1),m=Math.ceil(i/3),y=2*m,b=function(e){return(t[e]^t[e+1]<<m^t[e+2]<<y)&p},w=new Po(25e3),x=new $o(288),E=new $o(32),S=0,k=0,T=(u=0,0),P=0,R=0;o>u;++u){var C=b(u),O=32767&u,I=g[C];if(_[O]=I,g[C]=O,u>=P){var A=o-u;if((S>7e3||T>24576)&&A>423){h=Zo(t,l,0,w,x,E,k,T,R,u-R,h),T=S=k=0,R=u;for(var F=0;286>F;++F)x[F]=0;for(F=0;30>F;++F)E[F]=0}var M=2,D=0,N=f,L=O-I&32767;if(A>2&&C==b(u-L))for(var U=Math.min(c,A)-1,j=Math.min(32767,u),B=Math.min(258,A);j>=L&&--N&&O!=I;){if(t[u+M]==t[u+M-L]){for(var z=0;B>z&&t[u+z]==t[u+z-L];++z);if(z>M){if(M=z,D=L,z>U)break;var q=Math.min(L,z-2),H=0;for(F=0;q>F;++F){var V=u-L+F+32768&32767,W=V-_[V]+32768&32767;W>H&&(H=W,I=V)}}}L+=(O=I)-(I=_[O])+32768&32767}if(D){w[T++]=268435456|Fo[M]<<18|Mo[D];var G=31&Fo[M],K=31&Mo[D];k+=Ro[G]+Co[K],++x[257+G],++E[K],P=u+M,++S}else w[T++]=t[u],++x[t[u]]}}h=Zo(t,l,!0,w,x,E,k,T,R,u-R,h)}return Vo(a,0,r+Ho(h)+s)}(n=t,null==(o=e).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+o.mem,a,l)),u=h.length;return function(t,e){var i=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>e.level?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&ia(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),i){t[3]=8;for(var r=0;i.length>=r;++r)t[r+10]=i.charCodeAt(r)}}(h,e),ia(h,u-8,i.d()),ia(h,u-4,r),h}var sa=!!Pt||!!$t,na="text/plain",oa=!1,aa=(t,e)=>{var i=t.split("#"),r=i[1],s=i[0].split("?"),n=s[0],o=s[1];if(!o)return t;var a=o.split("&").filter((t=>t.split("=")[0]!==e)).join("&");return n+(a?"?"+a:"")+(r?"#"+r:"")},la=function(t,e,r){var s;void 0===r&&(r=!0);var n=t.split("?"),o=n[0],a=n[1],l=i({},e),h=null!==(s=null==a?void 0:a.split("&").map((t=>{var e,i=t.split("="),s=i[0],n=r&&null!==(e=l[s])&&void 0!==e?e:i[1];return delete l[s],s+"="+n})))&&void 0!==s?s:[],u=function(t,e){var i,r;void 0===e&&(e="&");var s=[];return Qr(t,(function(t,e){ue(t)||ue(e)||"undefined"===e||(i=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),r=encodeURIComponent(e),s[s.length]=r+"="+i)})),s.join(e)}(l);return u&&h.push(u),h.length>0?o+"?"+h.join("&"):o},ha=t=>{if(t.$a)return t.$a;var e=t.data,i=t.compression;if(e){if(i===fo.GZipJS){var r=ra(function(t,e){var i=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new To(t.length+(t.length>>>1)),s=0,n=function(t){r[s++]=t},o=0;i>o;++o){if(s+5>r.length){var a=new To(s+8+(i-o<<1));a.set(r),r=a}var l=t.charCodeAt(o);128>l?n(l):2048>l?(n(192|l>>>6),n(128|63&l)):l>55295&&57344>l?(n(240|(l=65536+(1047552&l)|1023&t.charCodeAt(++o))>>>18),n(128|l>>>12&63),n(128|l>>>6&63),n(128|63&l)):(n(224|l>>>12),n(128|l>>>6&63),n(128|63&l))}return Vo(r,0,s)}(Ln(e)),{mtime:0});return{contentType:na,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===fo.Base64){var s=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,e)=>String.fromCharCode(parseInt(e,16))))):t}(Ln(e)),n=(t=>"data="+encodeURIComponent("string"==typeof t?t:Ln(t)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=Ln(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},ua=t=>{var e,r,s=()=>"sendBeacon"===t.transport?{url:la(t.url,{compression:fo.Base64}),encodedBody:ha(i({},t,{compression:fo.Base64,$a:void 0}))}:{url:aa(t.url,"compression"),encodedBody:ha(i({},t,{compression:void 0,$a:void 0}))};try{e=ha(t)}catch(e){if(Vi(t.compression,jn(t.url,"compression")))return Kr.error("Failed to gzip request body, sending uncompressed payload",e),s();throw e}return e&&Vi(t.compression,jn(t.url,"compression"))&&!((r=e.body)instanceof ArrayBuffer?Hi(new Uint8Array(r)):ArrayBuffer.isView(r)&&Hi(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)))?(oa=!0,s()):{url:t.url,encodedBody:e}},da=t=>{try{return ua(t)}catch(e){return Kr.error(e),void(null==t.callback||t.callback({statusCode:0,error:e}))}},va=function(){var t=e((function*(t){var e=Ln(t.data),r=yield function(t,e,i){return Ji.apply(this,arguments)}(e,s.DEBUG,{rethrow:!0});if(!r)return t;var n=yield r.arrayBuffer();return i({},t,{$a:{contentType:na,body:n,estimatedSize:n.byteLength}})}));return function(e){return t.apply(this,arguments)}}(),ca=/Failed to fetch|NetworkError|Load failed/i,fa=t=>"TypeError"===(null==t?void 0:t.name)&&ca.test((null==t?void 0:t.message)||""),pa=t=>{var e=da(t);if(e){var r=e.url,s=e.encodedBody,n=null!=s?s:{},o=n.contentType,a=n.body,l=n.estimatedSize,h=new Headers;Qr(t.headers,(function(t,e){h.append(e,t)})),o&&h.append("Content-Type",o);var u=null,d=!1;if(Rt){var v=new Rt;u={signal:v.signal,timeout:setTimeout((()=>{var e;d=!0,v.abort(Ni("AbortError","PostHog request timed out"+((e=t.timeout)?" after "+e+"ms":"")))}),t.timeout)}}var c=e=>{d&&"AbortError"===(null==e?void 0:e.name)||fa(e)?Kr.warn(e):Kr.error(e),null==t.callback||t.callback({statusCode:0,error:e})};try{var f;$t(r,i({method:(null==t?void 0:t.method)||"GET",headers:h,keepalive:"POST"===t.method&&!t.Na&&52428.8>(l||0),body:a,signal:null==(f=u)?void 0:f.signal},t.fetchOptions)).then((e=>e.text().then((i=>{var r={statusCode:e.status,text:i};if(200===e.status)try{r.json=JSON.parse(i)}catch(t){Kr.error(t)}null==t.callback||t.callback(r)})))).catch(c).finally((()=>u?clearTimeout(u.timeout):null))}catch(t){u&&clearTimeout(u.timeout),c(t)}}},_a=t=>{try{var e,r=ua(t),s=r.url,n=r.encodedBody,o=null!=n?n:{},a=o.body,l=o.estimatedSize;if(!a)return;var h=a instanceof Blob?a:new Blob([a],{type:o.contentType});if(St.sendBeacon(s,h))return;var u=oe(t.data)?t.data:null==(e=t.data)?void 0:e.batch;if(oe(u)&&u.length>1&&(null!=l?l:0)>16384){var d=Math.ceil(u.length/2),v=e=>oe(t.data)?e:i({},t.data,{batch:e});return _a(i({},t,{data:v(u.slice(0,d))})),void _a(i({},t,{data:v(u.slice(d))}))}Kr.warn("Beacon of ~"+(null!=l?l:0)+" bytes was rejected by the browser, falling back to fetch"),pa(i({},t,{Na:!0}))}catch(t){Kr.warn("Beacon send failed",t)}},ga=(t,e,r,s)=>{var n="query"===s?"POST"===e?"sent_at":"_":void 0;return la(r===fo.GZipJS?aa(t,"compression"):t,i({},n?{[n]:Date.now().toString()}:{},r===fo.GZipJS?{}:{compression:r}))},ma=[];$t&&ma.push({transport:"fetch",method:pa}),Pt&&ma.push({transport:"XHR",method(t){var e=da(t);if(e){var i=new Pt,r=e.encodedBody;i.open(t.method||"GET",e.url,!0);var s=null!=r?r:{},n=s.contentType,o=s.body;Qr(t.headers,(function(t,e){i.setRequestHeader(e,t)})),n&&i.setRequestHeader("Content-Type",n),t.timeout&&(i.timeout=t.timeout),i.onreadystatechange=()=>{if(4===i.readyState){var e={statusCode:i.status,text:i.responseText};if(200===i.status)try{e.json=JSON.parse(i.responseText)}catch(t){}null==t.callback||t.callback(e)}},i.send(o)}}}),null!=St&&St.sendBeacon&&ma.push({transport:"sendBeacon",method:_a});var ya=3e3;class ba{constructor(t,e){this.qa=!0,this.ja=[],this.Ba=Re((null==e?void 0:e.flush_interval_ms)||ya,250,5e3,Kr.createLogger("flush interval"),ya),this.Ha=t}enqueue(t){this.ja.push(t),this.za||this.Ua()}unload(){this.Wa();var t=this.ja.length>0?this.Va():{},e=Object.values(t);[...e.filter((t=>0===t.url.indexOf("/e"))),...e.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.Ga(i({},t,{transport:"sendBeacon"}))}))}enable(){this.qa=!1,this.Ua()}Ua(){var t=this;this.qa||(this.za=setTimeout((()=>{if(this.Wa(),this.ja.length>0){var e=this.Va(),i=function(){var i=e[r],s=(new Date).getTime();i.data&&oe(i.data)&&Qr(i.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.Ga(i)};for(var r in e)i()}}),this.Ba))}Ga(t){try{this.Ha(t)}catch(t){Kr.error(t)}}Wa(){clearTimeout(this.za),this.za=void 0}Va(){var t={};return Qr(this.ja,(e=>{var r,s=e,n=(s?s.batchKey:null)||s.url;ue(t[n])&&(t[n]=i({},s,{data:[]})),null==(r=t[n].data)||r.push(s.data)})),this.ja=[],t}}var wa=["retriesPerformedSoFar"];class xa{constructor(t){this.Za=!1,this.Qa=3e3,this.ja=[],this._instance=t,this.ja=[],this.Ja=!0,!ue(xt)&&"onLine"in xt.navigator&&(this.Ja=xt.navigator.onLine,this.Ka=()=>{this.Ja=!0,this.Ya()},this.Xa=()=>{this.Ja=!1},ns(xt,"online",this.Ka),ns(xt,"offline",this.Xa))}get length(){return this.ja.length}retriableRequest(t){var e=t.retriesPerformedSoFar,s=r(t,wa);_e(e)&&(s.url=la(s.url,{retry_count:e})),this._instance._send_request(i({},s,{callback:t=>{if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=e?e:0))return void this.Un(i({retriesPerformedSoFar:e},s));0===t.statusCode&&Kr.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(null!=e?e:0)+" retries.")}null==s.callback||s.callback(t)}}))}Un(t){var e=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=e+1;var i=function(t){var e=3e3*Math.pow(2,t),i=e/2,r=Math.min(18e5,e),s=Math.random()-.5;return Math.ceil(r+s*(r-i))}(e),r=Date.now()+i;this.ja.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+i;navigator.onLine||(s+=" (Browser is offline)"),Kr.warn(s),this.Za||(this.Za=!0,this.eo())}eo(){if(this.io&&clearTimeout(this.io),0===this.ja.length)return this.Za=!1,void(this.io=void 0);this.io=setTimeout((()=>{this.Ja&&this.ja.length>0&&this.Ya(),this.eo()}),this.Qa)}Ya(){var t=Date.now(),e=[],i=this.ja.filter((i=>t>i.retryAt||(e.push(i),!1)));if(this.ja=e,i.length>0)for(var r of i)this.retriableRequest(r.requestOptions)}unload(){for(var t of(this.io&&(clearTimeout(this.io),this.io=void 0),this.Za=!1,ue(xt)||(this.Ka&&(xt.removeEventListener("online",this.Ka),this.Ka=void 0),this.Xa&&(xt.removeEventListener("offline",this.Xa),this.Xa=void 0)),this.ja)){var e=t.requestOptions;try{this._instance._send_request(i({},e,{transport:"sendBeacon"}))}catch(t){Kr.error(t)}}this.ja=[]}}class Ea{constructor(t){this.ro=()=>{var t,e,i,r;this.no||(this.no={});var s=this.scrollElement(),n=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=n+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;this.no.lastScrollY=Math.ceil(n),this.no.maxScrollY=Math.max(n,null!==(t=this.no.maxScrollY)&&void 0!==t?t:0),this.no.maxScrollHeight=Math.max(o,null!==(e=this.no.maxScrollHeight)&&void 0!==e?e:0),this.no.lastContentY=a,this.no.maxContentY=Math.max(a,null!==(i=this.no.maxContentY)&&void 0!==i?i:0),this.no.maxContentHeight=Math.max(l,null!==(r=this.no.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}get so(){return this._instance.config.scroll_root_selector}getContext(){return this.no}resetContext(){var t=this.no;return setTimeout(this.ro,0),t}startMeasuringScrollPosition(){ns(xt,"scroll",this.ro,{capture:!0}),ns(xt,"scrollend",this.ro,{capture:!0}),ns(xt,"resize",this.ro)}scrollElement(){if(!this.so)return null==xt?void 0:xt.document.documentElement;var t=oe(this.so)?this.so:[this.so];for(var e of t){var i=null==xt?void 0:xt.document.querySelector(e);if(i)return i}}ao(t){var e="y"===t?"scrollTop":"scrollLeft";if(this.so){var i=this.scrollElement();return i&&i[e]||0}return xt?"y"===t?xt.scrollY||xt.pageYOffset||xt.document.documentElement.scrollTop||0:xt.scrollX||xt.pageXOffset||xt.document.documentElement.scrollLeft||0:0}scrollY(){return this.ao("y")}scrollX(){return this.ao("x")}}var Sa=t=>io(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties,null==t?void 0:t.config.disable_capture_url_hashes);class ka{constructor(t,e,i,r){this.xt=t=>{var e=this.oo();if(!e||e.sessionId!==t){var i={sessionId:t,props:this.lo(this._instance)};this.uo.register({[Z]:i})}},this._instance=t,this.ho=e,this.uo=i,this.lo=r||Sa,this.ho.onSessionId(this.xt)}oo(){return this.uo.props[Z]}getSetOnceProps(){var t,e=null==(t=this.oo())?void 0:t.props;return e?"r"in e?ro(e,this._instance.config.disable_capture_url_hashes):{$referring_domain:e.referringDomain,$pathname:e.initialPathName,utm_source:e.utm_source,utm_campaign:e.utm_campaign,utm_medium:e.utm_medium,utm_content:e.utm_content,utm_term:e.utm_term}:{}}getSessionProps(){var t={};return Qr(is(this.getSetOnceProps()),((e,i)=>{"$current_url"===i&&(i="url"),t["$session_entry_"+ee(i)]=e})),t}}class Ta{on(t,e){return this.do[t]||(this.do[t]=[]),this.do[t].push(e),()=>{this.do[t]=this.do[t].filter((t=>t!==e))}}emit(t,e){for(var i of this.do[t]||[])i(e);for(var r of this.do["*"]||[])r(t,e)}constructor(){this.do={}}}var $a=Jr("[SessionId]"),Pa=864e5;class Ra{on(t,e){return this.vo.on(t,e)}constructor(t,e,i){var r;if(this.co=null,this.fo=null,this.po=[],this.mo=void 0,this.yo=!1,this.vo=new Ta,this.bo=(t,e)=>!(!_e(t)||!_e(e))&&Math.abs(t-e)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===vt)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.nn=t.config,this.uo=t.persistence,this.Ct=void 0,this.Le=void 0,this._sessionStartTimestamp=null,this._o=void 0,this._sessionActivityTimestamp=null,this.wo=e||cs,this.ko=i||cs;var s=this.nn.persistence_name||this.nn.token;if(this._sessionTimeoutMs=1e3*Re(this.nn.session_idle_timeout_seconds||1800,60,36e3,$a.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.So(),this.xo="ph_"+s+"_window_id",this.Co="ph_"+s+"_primary_window_exists",this.To()){var n=As.ni(this.xo),o=As.ni(this.Co);n&&!o?this.Ct=n:As.ri(this.xo),As.ei(this.Co,!0)}null!=(r=this.nn.bootstrap)&&r.sessionID&&this.setBootstrapSessionId(this.nn.bootstrap.sessionID),this.Mo()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return ue(this.po)&&(this.po=[]),this.po.push(t),this.Le&&t(this.Le,this.Ct),()=>{this.po=this.po.filter((e=>e!==t))}}To(){return"memory"!==this.nn.persistence&&!this.uo.la&&As.Xr()}Eo(t){t!==this.Ct&&(this.Ct=t,this.To()&&As.ei(this.xo,t))}Io(){return this.Ct?this.Ct:this.To()?As.ni(this.xo):null}Ro(t){var e=this.co;return!ce(e)&&!ce(t)&&5e3>Math.abs(t-e)}Po(t,e,i){var r=e!==this._sessionActivityTimestamp,s=!(t!==this.Le||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=e,this.Le=t,s&&!r||s&&this.Ro(e)||(this.co=e,this.uo.register({[P]:[e,t,i]}))}Ao(){var t,e=null==(t=this.nn)?void 0:t.persistence_save_debounce_ms;return _e(e)&&e>0}Fo(){this.Ao()?this.uo.refreshKey(P):(this.uo.flush(),this.uo.load())}Oo(){var t;if(!ce(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.co){this.Fo();var e=this.Lo();e[1]===this.Le&&e[2]===this._sessionStartTimestamp&&(this.co=this._sessionActivityTimestamp,this.uo.register({[P]:[this._sessionActivityTimestamp,null!==(t=this.Le)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.uo.flush())}}Do(){var t=this.Lo()[0],e=_e(t)?t:0,i=_e(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(e,i)}$o(t){return this.Fo(),this.bo(t,this.Do())}Lo(){var t=this.uo.props[P];return oe(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.co=null,this._o=void 0,clearTimeout(this.No),this.No=void 0,this.Po(null,null,null)}setBootstrapSessionId(t,e){void 0===e&&(e=!1);var i=function(t,e){void 0===e&&(e=(new Date).getTime());try{var i=(t=>{var e=t.replace(/-/g,"");if(32!==e.length)throw new Error("Not a valid UUID");if("7"!==e[12])throw new Error("Not a UUIDv7");return parseInt(e.substring(0,12),16)})(t);return i>e+6e4?void $a.error("Bootstrap sessionID cannot be in the future"):i}catch(t){return void $a.error("Invalid sessionID in bootstrap",t)}}(t);return!ue(i)&&(e?this._o={sessionId:t,sessionStartTimestamp:i}:this.Po(t,(new Date).getTime(),i),!0)}destroy(){this.yo=!0,this.Oo(),clearTimeout(this.No),this.No=void 0,this.mo&&xt&&(xt.removeEventListener(gt,this.mo,{capture:!1}),this.mo=void 0),this.po=[]}Mo(){this.mo=()=>{this.Oo(),this.To()&&As.ri(this.Co)},ns(xt,gt,this.mo,{capture:!1})}checkAndGetSessionAndWindowId(t,e,i){if(void 0===t&&(t=!1),void 0===e&&(e=null),void 0===i&&(i=!1),this.nn.cookieless_mode===vt)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=e||(new Date).getTime(),s=this.Le;if(i)this.fo=r;else if(ce(this.fo)||this.fo>r||r-this.fo>=1e3){var n,o;null==(n=(o=this.uo).syncCookieProperties)||n.call(o),this.fo=r}var a=this.Lo(),l=a[1],h=a[2],u=!ue(s)&&l!==s,d=this.Do(),v=this.Io(),c=this._o,f=!!c&&(c.sessionStartTimestamp>r+6e4||r-c.sessionStartTimestamp>Pa),p=c?f:_e(h)&&Math.abs(r-h)>Pa,_=!1,g=u,m=!l||!!c,y=l,b=!m&&!t&&this.bo(r,d);if(b){(b=this.$o(r))||$a.info("cross-tab refresh kept the session alive",{sessionId:l});var w=this.Lo();l=w[1],h=w[2]}if(m||b||p){g=!1;var x=c&&!f;l=x?c.sessionId:this.wo(),v=this.ko(),$a.info("new session ID assigned",{sessionId:l,windowId:v,bootstrapped:!!x,changeReason:{noSessionId:m,activityTimeout:b,sessionPastMaximumLength:p}}),h=x?c.sessionStartTimestamp:r,this._o=void 0,_=!0}else v||(v=this.ko(),_=!0),(g=g||l!==y)&&($a.info("adopted cross-tab session id",{sessionId:l,windowId:v}),_=!0);var E=_e(d)&&t&&!p?d:r,S=_e(h)?h:(new Date).getTime();this.Eo(v),this.Po(l,E,S),t||this.So();var k={noSessionId:m,activityTimeout:b,sessionPastMaximumLength:p,crossTabAdoption:g};return _&&this.po.forEach((t=>t(l,v,k))),{sessionId:l,windowId:v,sessionStartTimestamp:S,changeReason:_?k:void 0,lastActivityTimestamp:d}}So(){this.yo||(clearTimeout(this.No),this.No=setTimeout((()=>{if(!this.yo)if(this.$o((new Date).getTime())){var t=this.Le;this.resetSessionId(),this.vo.emit("forcedIdleReset",{idleSessionId:t})}else this.So()}),1.1*this.sessionTimeoutMs))}}var Ca=function(t,e){if(!t)return!1;var i=t.userAgent;if(i&&Xt(i,e))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>Xt(null==t?void 0:t.brand,e))))return!0}catch(t){}return!!t.webdriver};function Oa(){return(Oa=e((function*(){var t=null==St?void 0:St.userAgentData;if(null!=t&&t.getHighEntropyValues)try{var e=yield t.getHighEntropyValues(["model"]),i=null==e?void 0:e.model;return de(i)&&i.length>0?i:void 0}catch(t){return void Kr.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}}))).apply(this,arguments)}function Ia(t){var e;return!(null==(e=t.conditions)||null==(e=e.events)||null==(e=e.values)||!e.length)}var Aa=(t,e)=>{if(!(t=>{try{new RegExp(t)}catch(t){return!1}return!0})(e))return!1;try{return new RegExp(e).test(t)}catch(t){return!1}},Fa=t=>t.toLowerCase(),Ma={exact:(t,e)=>e.some((e=>t.some((t=>e===t)))),is_not:(t,e)=>e.every((e=>t.every((t=>e!==t)))),regex:(t,e)=>e.some((e=>t.some((t=>Aa(e,t))))),not_regex:(t,e)=>e.every((e=>t.every((t=>!Aa(e,t))))),icontains:(t,e)=>e.map(Fa).some((e=>t.map(Fa).some((t=>e.includes(t))))),not_icontains:(t,e)=>e.map(Fa).every((e=>t.map(Fa).every((t=>!e.includes(t))))),gt:(t,e)=>e.some((e=>{var i=parseFloat(e);return!isNaN(i)&&t.some((t=>i>parseFloat(t)))})),lt:(t,e)=>e.some((e=>{var i=parseFloat(e);return!isNaN(i)&&t.some((t=>i<parseFloat(t)))}))};function Da(t,e){return!t||Object.entries(t).every((t=>{var i=t[1],r=null==e?void 0:e[t[0]];if(null==r)return!1;var s=Ma[i.operator];return!!s&&s(i.values,[String(r)])}))}function Na(t,e,i){return Ln({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}var La="custom",Ua="i.posthog.com",ja=/^\/static\//,Ba=["/s/","/e/","/i/"];class za{constructor(t){this.qo={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,e=null==(t=this.instance.config.ui_host)?void 0:t.replace(/\/$/,"");return e||(e=this.apiHost.replace("."+Ua,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}get region(){return this.qo[this.apiHost]||(this.qo[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":La),this.qo[this.apiHost]}jo(t){if(ja.test(t)){var e=this.instance.config.asset_host;if("string"==typeof e)return e.trim().replace(/\/$/,"")||void 0}}Bo(t){var e=Un(t);return e?e.protocol+"//"+e.host+e.pathname:void 0}Ho(t,e,i){if("ui"===t)return i;var r=i,s=this.instance.config.rewriteRequestPath;if(s){var n,o=(null==(n=Un(i))?void 0:n.href)||i;r=s(new URL(o)).toString()}if(s&&"api"===t&&Ba.some((t=>0===e.indexOf(t)))){var a=this.Bo(r);if(a){var l,h=this.apiHost,u=this.zo;(null==(l=u)?void 0:l.apiHost)===h&&u.rewriteRequestPath===s||(u={apiHost:h,rewriteRequestPath:s,urls:new Set},this.zo=u),u.urls.add(a)}}return r}isIngestionEndpoint(t){var e=this.zo,i=this.Bo(t);return(null==e?void 0:e.apiHost)===this.apiHost&&e.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!i&&e.urls.has(i)}endpointFor(t,e){if(void 0===e&&(e=""),e&&(e="/"===e[0]?e:"/"+e),"ui"===t)return this.Ho(t,e,this.uiHost+e);if("flags"===t)return this.Ho(t,e,this.flagsApiHost+e);if("assets"===t){var i=this.jo(e);if(i)return this.Ho(t,e,""+i+e)}if(this.region===La)return this.Ho(t,e,this.apiHost+e);var r=Ua+e;switch(t){case"assets":return this.Ho(t,e,"https://"+this.region+"-assets."+r);case"api":return this.Ho(t,e,"https://"+this.region+"."+r)}}}var qa=Jr("[Surveys]"),Ha="seenSurvey_",Va=t=>{try{var e=(t=>((t,e)=>""+Ha+function(t){return t.current_iteration&&t.current_iteration>0?t.id+"_"+t.current_iteration:t.id}(e))(0,t))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(t){qa.error("Failed to persist survey seen state",t)}},Wa=[_o.Popover,_o.Widget,_o.API],Ga={ignoreConditions:!1,ignoreDelay:!1,displayType:yo.Popover},Ka=Jr("[PostHog ExternalIntegrations]"),Ja={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Ya{constructor(t){this._instance=t}js(t,e){var i;null==(i=Ft.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,t,(t=>{if(t)return Ka.error("failed to load script",t);e()}))}startIfEnabledOrStop(){var t=this,e=function(){var e,r,s,n=i[0],o=i[1];!o||null!=(e=Ft.__PosthogExtensions__)&&null!=(e=e.integrations)&&e[n]||t.js(Ja[n],(()=>{var e;null==(e=Ft.__PosthogExtensions__)||null==(e=e.integrations)||null==(e=e[n])||e.start(t._instance)})),!o&&null!=(r=Ft.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[n]&&(null==(s=Ft.__PosthogExtensions__)||null==(s=s.integrations)||null==(s=s[n])||s.stop())};for(var i of Object.entries(null!==(r=this._instance.config.integrations)&&void 0!==r?r:{})){var r;e()}}}class Qa{constructor(t,e){this.I=t,this.Ts=e,this.Uo=new Map,this.ks=!1}add(t){var i=this;return e((function*(){if(i.ks)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(i.Uo.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');i.Uo.set(t.name,t);try{var e=t.setup(i.Ts);e&&(yield e)}catch(e){var r=i.Uo.get(t.name)===t;r&&i.Uo.delete(t.name),i.I.error('Failed to set up browser extension "'+t.name+'"',e),r&&i.Wo(t)}}))()}getExtension(t){return this.Uo.get(t)}dispose(){if(!this.ks){this.ks=!0;var t=Array.from(this.Uo.values()).reverse();for(var e of(this.Uo.clear(),t))this.Wo(e)}}Wo(t){try{var e=null==t.dispose?void 0:t.dispose();e&&ae(e.then)&&e.then(void 0,(e=>{this.I.error('Failed to dispose browser extension "'+t.name+'"',e)}))}catch(e){this.I.error('Failed to dispose browser extension "'+t.name+'"',e)}}}class Xa{constructor(t){this._instance=t}initialize(){}get(t){var e=this._instance.persistence;if("string"==typeof t)return null==e?void 0:e.get_property(t);var i={};for(var r of t){var s=null==e?void 0:e.get_property(r);ue(s)||(i[r]=s)}return i}set(t,e){var i;null==(i=this._instance.persistence)||i.register("string"==typeof t?{[t]:e}:t)}remove(t){var e;null==(e=this._instance.persistence)||e.unregister(t)}}var Za="extensionsRemoteConfig";class tl{constructor(t){this.ks=!1,this.instance=t,this.I=Kr,this.Vo=t.Go,this.kv=new Xa(t),this.onEvent=t=>co(this.instance.on("eventCaptured",(e=>{try{t({event:e.event,properties:e.properties})}catch(t){this.I.error("Browser extension event listener failed",t)}}))),this.onRemoteConfig=t=>{if(this.ks)return co((()=>{}));var e=e=>{try{t(e)}catch(t){this.I.error("Browser extension remote config listener failed",t)}},i=this.instance.Zo.on(Za,e);return this.Vo&&e(this.Vo),co(i)},this.Qo=new Qa(Kr.createLogger("[BrowserExtensions]"),this)}get logger(){return this.I}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return null!==(t=this.instance.get_property(a))&&void 0!==t?t:this.distinctId}get deviceId(){var t=this.instance.get_property(a);return"string"==typeof t?t:void 0}get library(){return{name:s.LIB_NAME,version:s.LIB_VERSION}}get initialPersonProperties(){var t,e;return null!==(t=null==(e=this.instance.persistence)?void 0:e.get_initial_props())&&void 0!==t?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,e,i,r,s=null==(t=this.instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(e=null==s?void 0:s.sessionId)&&void 0!==e?e:"",windowId:null!==(i=null==s?void 0:s.windowId)&&void 0!==i?i:"",sessionStartTimestamp:null!==(r=null==s?void 0:s.sessionStartTimestamp)&&void 0!==r?r:0}}catch(t){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(t){return this.Qo.add(t)}getExtension(t){return this.Qo.getExtension(t)}capture(t,i,r){var s=this;return e((function*(){r?s.instance.capture(t,i,{timestamp:r.timestamp,uuid:r.uuid,$set:r.set,$set_once:r.setOnce}):s.instance.capture(t,i)}))()}registerDynamicEventProperties(t){return co(this.instance.Jo(t))}handleRemoteConfig(t){this.ks||(this.Vo=t,this.instance.Zo.emit(Za,t))}sendRequest(t,i){var r=this;return e((function*(){var e;void 0===i&&(i={});var s=r.instance.requestRouter.endpointFor(null!==(e=i.target)&&void 0!==e?e:"api",t),n={method:i.method,url:i.query?la(s,i.query):s,data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,compressionFallback:"flags"===i.target&&"best-available"===i.compression?jt.Base64:void 0,timestampMode:i.sentAt};return"sendBeacon"===i.transport?(r.instance._send_request(n),{statusCode:202}):new Promise((t=>{n.callback=t,r.instance._send_request(n)}))}))()}dispose(){this.ks||(this.ks=!0,this.Qo.dispose())}}var el={},il=0,rl=()=>{},sl='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',nl="Surveys module not available",ol="sanitize_properties is deprecated. Use before_send instead",al="Invalid value for property_denylist config: ",ll=["token","distinct_id",ot],hl="posthog",ul=!sa&&-1===(null==Ot?void 0:Ot.indexOf("MSIE"))&&-1===(null==Ot?void 0:Ot.indexOf("Mozilla")),dl=t=>{var e={};return t&&"unset"!==t?("2025-11-30">t||(e.strictMinimumDuration=!0),"2026-05-30">t||(e.canvasCapture={resolutionScale:.6}),"2026-06-25">t||(e.streamNetworkBody=!0),"2026-08-30">t||(e.captureJsonLd=!0),e):e},vl=t=>{var e;return i({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:ss(null==kt?void 0:kt.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:rl,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=t?t:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:Tt&&de(null==Tt?void 0:Tt.search)&&-1!==Tt.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,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:"https:"===(null==xt||null==(e=xt.location)?void 0:e.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(t){Kr.error("Bad HTTP status: "+t.statusCode+" "+t.text)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:pt,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:ya},error_tracking:{},_onCapture:rl},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:sn,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:dl(t),external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body",internal_or_test_user_hostname:t&&t>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:t&&t>="2026-05-30"?250:0,split_storage:!(!t||"2026-05-30">t),detect_google_search_app:!(!t||"2026-05-30">t),disable_capture_url_hashes:!(!t||"2026-06-25">t),cookieWinsOnConflict:!(!t||"unset"===t||"2026-08-29">t)}))(t))},cl=[["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"]],fl=t=>{var e={};for(var i of cl){var r=i[0],s=i[1];ue(t[r])||(e[s]=t[r])}var n=Xr({},e,t),o=t.__preview_external_dependency_versioned_paths;return ue(o)||(ue(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),de(o)&&ue(t.asset_host)&&(n.asset_host=o)),oe(t.property_blacklist)&&(ue(t.property_denylist)?n.property_denylist=t.property_blacklist:oe(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:Kr.error(al+t.property_denylist)),n};class pl{constructor(){this.__forceAllowLocalhost=!1}get Ko(){return this.__forceAllowLocalhost}set Ko(t){Kr.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class _l{Yo(t,e){if(t){var i=this.Uo.indexOf(t);-1!==i&&this.Uo.splice(i,1)}return this.Uo.push(e),null==e.initialize||e.initialize(),e}Xo(){return this.config.cookieless_mode===vt||this.config.cookieless_mode===dt&&this.consent.isRejected()}tl(){if(!this.Xo()&&this.get_distinct_id()===nt){var t=this.persistence;if(t){this.el()||t.load(!0);var e=this.get_distinct_id();if(!e||e===nt){var i=this.config.get_device_id(cs());this.register({distinct_id:i,$device_id:i}),t.set_property(X,ct)}this.il()}}}get decideEndpointWasHit(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.hasLoadedFlags)&&void 0!==t&&t}constructor(){var t;this.webPerformance=new pl,this.rl=!1,this.version=s.LIB_VERSION,this.nl=new Set,this.sl="",this.Zo=new Ta,this.Uo=[],this.al=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=vl(),this.SentryIntegration=In,this.sentryIntegration=t=>function(t,e){var i=On(t,e);return{name:Cn,processEvent:t=>i(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.ol=!1,this.ll=null,this.ul=null,this.hl=null,this.scrollManager=new Ea(this),this.pageViewManager=new An(this),this.rateLimiter=new Eo(this),this.requestRouter=new za(this),this.consent=new Fs(this),this.externalIntegrations=new Ya(this);var e=null!==(t=_l.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=e.featureFlags&&new e.featureFlags(this),this.toolbar=e.toolbar&&new e.toolbar(this),this.surveys=e.surveys&&new e.surveys(this),this.conversations=e.conversations&&new e.conversations(this),this.logs=e.logs&&new e.logs(this),this.metrics=e.metrics&&new e.metrics(this),this.experiments=e.experiments&&new e.experiments(this),this.exceptions=e.exceptions&&new e.exceptions(this),this.people={set:(t,e,i)=>{var r=de(t)?{[t]:e}:t;this.setPersonProperties(r),null==i||i({})},set_once:(t,e,i)=>{var r=de(t)?{[t]:e}:t;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",(t=>Kr.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,e,i){if(i&&i!==hl){var r,s=null!==(r=el[i])&&void 0!==r?r:new _l;return s._init(t,e,i),el[i]=s,el[hl][i]=s,s}return this._init(t,e,i)}_init(t,e,r){var n,o;void 0===e&&(e={});var a,h=de(t)?t.trim():"";if(!h)return Kr.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return h!==(null==(a=this.config)?void 0:a.token)?console.warn("[PostHog.js]","You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('"+h+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=vl(e.defaults),e.debug=this.dl(e.debug),this.vl=e,this.cl=[],e.person_profiles?this.ul=e.person_profiles:e.process_person&&(this.ul=e.process_person);var u=vl(e.defaults),d=fl(e),v=Xr({},u,d,{name:r,token:h});le(u.rageclick)&&le(d.rageclick)&&(v.rageclick=Xr({},u.rageclick,d.rageclick)),le(u.session_recording)&&le(d.session_recording)&&(v.session_recording=Xr({},u.session_recording,d.session_recording)),this.set_config(v),this.config.on_xhr_error&&Kr.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=e.disable_compression?void 0:fo.GZipJS;var c=this.el();if(this.persistence=new vo(this.config,c),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new vo(i({},this.config,{persistence:"sessionStorage"}),c,!1),this.sl="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!c&&As.Xr()){var f=As.ni(this.sl);oe(f)&&f.forEach((t=>{de(t)&&this.nl.add(t)}))}else As.ri(this.sl);var p=i({},this.persistence.props),_=i({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.fl=new ba((t=>this.pl(t)),this.config.request_queue_config),this.gl=new xa(this),this.__request_queue=[];var g=this.Xo();if(g||(this.sessionManager=new Ra(this),this.sessionPropsManager=new ka(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId(((t,e,i)=>{(null!=i&&i.activityTimeout||null!=i&&i.sessionPastMaximumLength||null!=i&&i.crossTabAdoption)&&this.ml()}))),this.yl(),this.config.__preview_deferred_init_extensions?(Kr.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.bl(g)}),0)):(Kr.info("Initializing extensions synchronously"),this.bl(g)),s.DEBUG=s.DEBUG||this.config.debug,s.DEBUG&&Kr.info("Starting in debug mode",{this:this,config:e,thisC:i({},this.config),p:p,s:_}),!this.config.identity_distinct_id||null!=(n=e.bootstrap)&&n.distinctID||(e.bootstrap=i({},e.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(o=e.bootstrap)?void 0:o.distinctID)){var m=e.bootstrap.distinctID,y=this.get_distinct_id(),b=this.persistence.get_property(X);if(e.bootstrap.isIdentifiedID&&null!=y&&y!==m&&b===ct)this.identify(m);else if(e.bootstrap.isIdentifiedID&&null!=y&&y!==m&&b===ft)Kr.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 w=this.config.get_device_id(cs()),x=e.bootstrap.isIdentifiedID?w:m;this.persistence.set_property(X,e.bootstrap.isIdentifiedID?ft:ct),this.register({distinct_id:m,$device_id:x})}}if(g)this.register_once({distinct_id:nt,$device_id:null},"");else if(!this.get_distinct_id()){var E=this.config.get_device_id(cs());this.register_once({distinct_id:E,$device_id:E},""),this.persistence.set_property(X,ct)}return ns(xt,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),e.segment?function(t,e){var i=t.config.segment;if(!i)return e();!function(t,e){var i=t.config.segment;if(!i)return e();var r=i=>{var r=()=>i.anonymousId()||cs();t.config.get_device_id=r,i.id()&&(t.register({distinct_id:i.id(),$device_id:r()}),t.persistence.set_property(X,ft)),e()},s=i.user();"then"in s&&ae(s.then)?s.then(r):r(s)}(t,(()=>{i.register((t=>{"undefined"!=typeof Promise&&Promise.resolve||Rn.warn("This browser does not have Promise support, and can not use the segment integration");var e=(e,i)=>{if(!i)return e;e.event.userId||e.event.anonymousId===t.get_distinct_id()||(Rn.info("No userId set, resetting PostHog"),t.reset()),e.event.userId&&e.event.userId!==t.get_distinct_id()&&(Rn.info("UserId set, identifying with PostHog"),t.identify(e.event.userId));var r=t.calculateEventProperties(i,e.event.properties);return e.event.properties=Object.assign({},r,e.event.properties),e};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:t=>e(t,t.event.event),page:t=>e(t,mt),identify:t=>e(t,bt),screen:t=>e(t,"$screen")}})(t)).then((()=>{e()}))}))}(this,(()=>this._l())):this._l(),ae(this.config._onCapture)&&this.config._onCapture!==rl&&(Kr.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&Kr.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 Oa.apply(this,arguments)}().then((t=>{t&&this.register({[l]:t})})).catch(rl),this}wl(t){var e=t;return de(e.name)&&ae(e.setup)}kl(t,e){this.wl(t)?e.push((()=>{this.Sl().add(t).catch((()=>null==t.dispose?void 0:t.dispose())).catch((e=>{Kr.error('Failed to dispose browser extension "'+t.name+'"',e)}))})):this.Uo.push(t)}yl(){var t,e,i,r,s,n,o=null!==(t=null==(e=this.config.__extensionClasses)?void 0:e.featureFlags)&&void 0!==t?t:null==(i=_l.__defaultExtensionClasses)?void 0:i.featureFlags;o&&(this.featureFlags&&this.featureFlags instanceof o||(null==(r=this.xl)||r.call(this),this.xl=void 0,this.featureFlags=new o(this)),ae(this.featureFlags.onReloading)&&ae(this.featureFlags.setup)?this.xl||(this.xl=this.featureFlags.onReloading((()=>{this.Zo.emit("featureFlagsReloading",!0)})),this.Sl().add(this.featureFlags)):null==(s=(n=this.featureFlags).initialize)||s.call(n))}bl(t){var e,r,s,n,o,a,l,h=performance.now(),u=i({},_l.__defaultExtensionClasses,this.config.__extensionClasses),d=[];u.exceptions&&this.Uo.push(this.exceptions=null!==(e=this.exceptions)&&void 0!==e?e:new u.exceptions(this)),u.historyAutocapture&&this.Uo.push(this.historyAutocapture=new u.historyAutocapture(this)),u.tracingHeaders&&this.Uo.push(this.tracingHeaders=new u.tracingHeaders(this)),u.siteApps&&this.Uo.push(this.siteApps=new u.siteApps(this)),u.sessionRecording&&!t&&this.Uo.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||d.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),u.autocapture&&this.kl(this.autocapture=new u.autocapture(this),d),u.surveys&&this.kl(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new u.surveys(this),d),u.logs&&this.kl(this.logs=null!==(s=this.logs)&&void 0!==s?s:new u.logs(this),d),u.metrics&&this.Uo.push(this.metrics=null!==(n=this.metrics)&&void 0!==n?n:new u.metrics(this)),u.conversations&&this.Uo.push(this.conversations=null!==(o=this.conversations)&&void 0!==o?o:new u.conversations(this)),u.productTours&&this.Uo.push(this.productTours=new u.productTours(this)),u.heatmaps&&this.Uo.push(this.heatmaps=new u.heatmaps(this)),u.webVitalsAutocapture&&this.Uo.push(this.webVitalsAutocapture=new u.webVitalsAutocapture(this)),u.exceptionObserver&&this.Uo.push(this.exceptionObserver=new u.exceptionObserver(this)),u.deadClicksAutocapture&&this.Uo.push(this.deadClicksAutocapture=new u.deadClicksAutocapture(this,$n)),u.toolbar&&this.Uo.push(this.toolbar=null!==(a=this.toolbar)&&void 0!==a?a:new u.toolbar(this)),u.experiments&&this.Uo.push(this.experiments=null!==(l=this.experiments)&&void 0!==l?l:new u.experiments(this)),this.Uo.forEach((t=>{t.initialize&&d.push((()=>{null==t.initialize||t.initialize()}))})),d.push((()=>{if(this.Cl){var t=this.Cl;this.Cl=void 0,this.Uo.forEach((e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t)))}})),this.Tl(d,h)}Tl(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void setTimeout((()=>{this.Tl(t,e)}),0);var i=t.shift();if(i)try{i()}catch(t){Kr.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-e);this.register_for_session({[at]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[lt]:r}),this.config.__preview_deferred_init_extensions&&Kr.info("PostHog extensions initialized ("+r+"ms)")}La(t){var e;if(!kt||!kt.body)return Kr.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.La(t)}),500);if(this.config.__preview_deferred_init_extensions&&(this.Cl=t),this.Go=t,this.compression=void 0,t.ok){var i,r=t.config;r.supportedCompression&&!this.config.disable_compression&&(this.compression=Zt(r.supportedCompression,fo.GZipJS)?fo.GZipJS:Zt(r.supportedCompression,fo.Base64)?fo.Base64:void 0),null!=(i=r.analytics)&&i.endpoint&&(this.analyticsDefaultEndpoint=r.analytics.endpoint)}this.set_config({person_profiles:this.ul?this.ul:pt}),null==(e=this.Ml)||e.handleRemoteConfig(t),this.Uo.forEach((e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t)))}_l(){try{this.config.loaded(this)}catch(t){Kr.critical("`loaded` function failed",t)}if(this.El(),this.config.internal_or_test_user_hostname&&null!=Tt&&Tt.hostname){var t=Tt.hostname,e=this.config.internal_or_test_user_hostname;("string"==typeof e?t===e:e.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.Xo())&&this.Il()}),1),this.Rl=new ko(this),this.Rl.load()}El(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.fl)||t.enable())}_dom_loaded(){this.is_capturing()&&Yr(this.__request_queue,(t=>this.pl(t))),this.__request_queue=[],this.El()}_handle_unload(){var t,e,i,r,s;null==(t=this.surveys)||null==t.handlePageUnload||t.handlePageUnload(),null==(e=this.metrics)||e.flush("sendBeacon"),this.config.request_batching?(this.Pl()&&this.capture(yt),null==(i=this.logs)||i.flushLogs("sendBeacon"),null==(r=this.fl)||r.unload(),null==(s=this.gl)||s.unload()):this.Pl()&&this.capture(yt,null,{transport:"sendBeacon"})}_send_request(t){var e;this.__loaded?ul?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:429})):(t.transport=t.transport||this.config.api_transport,t.headers=i({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?null!==(e=this.compression)&&void 0!==e?e:t.compressionFallback:t.compression,(ue(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(t=>{var e,r,s,n=i({},t);n.timeout=n.timeout||6e4;var o,a,l,h,u,d=null!==(e=n.transport)&&void 0!==e?e:"fetch";"sendBeacon"===d&&ue(n.compression)&&n.data&&(n.compression=fo.Base64),"POST"===n.method&&n.data&&("capture-body"===n.timestampMode?n.data={api_key:null!==(a=null==(u=(h=(oe(o=n.data)?o:[o]).map((t=>i({},t,t.timestamp instanceof Date&&!isNaN(t.timestamp.getTime())?{timestamp:t.timestamp.toISOString()}:{}))))[0])||null==(l=u.properties)?void 0:l.token)&&void 0!==a?a:null==u?void 0:u.token,batch:h,sent_at:(new Date).toISOString()}:"body"===n.timestampMode&&(n.data=function(t,e){return void 0===e&&(e=(new Date).toISOString()),oe(t)?t.map((t=>i({},t,{sent_at:e}))):i({},t,{sent_at:e})}(n.data))),n.url=ga(n.url,n.method,n.compression,n.timestampMode);var v=ma.filter((t=>!n.disableTransport||!t.transport||!n.disableTransport.includes(t.transport))),c=null!==(r=null==(s=function(t,e){for(var i=0;t.length>i;i++)if(t[i].transport===d)return t[i]}(v))?void 0:s.method)&&void 0!==r?r:v[0].method;if(!c)throw new Error("No available transport method");var f=t=>{try{c(t)}catch(t){fa(t)?Kr.warn(t):Kr.error(t),null==n.callback||n.callback({statusCode:0,error:t})}};"sendBeacon"!==d&&n.data&&n.compression===fo.GZipJS&&Ct&&"undefined"!=typeof Promise&&!oa?va(n).then((t=>{f(t)})).catch((e=>{if(Wi(e))return oa=!0,void f(i({},n,{compression:void 0,url:ga(t.url,t.method,void 0,t.timestampMode)}));(t=>{if(!t||"object"!=typeof t)return!1;var e="name"in t?String(t.name):"";return Wi(t)||e===qi})(e)&&(oa=!0),f(n)})):c(n)})(i({},t,{callback:e=>{var i,r;this.rateLimiter.checkForLimiting(e),400>e.statusCode||null==(i=(r=this.config).on_request_error)||i.call(r,e),null==t.callback||t.callback(e)}}))):t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:0}))}pl(t){this.gl?this.gl.retriableRequest(t):this._send_request(t)}_execute_array(t){il++;try{var e,i=[],r=[],s=[];Yr(t,(t=>{if(t)if(oe(e=t[0]))s.push(t);else if(ae(t))try{t.call(this)}catch(e){Kr.error("Error executing queued PostHog call",t,e)}else oe(t)&&"alias"===e?i.push(t):oe(t)&&-1!==e.indexOf("capture")&&ae(this[e])?s.push(t):r.push(t)}));var n=function(t,e){Yr(t,(function(t){try{if(oe(t[0])){var i=e;Qr(t,(function(t){i=i[t[0]].apply(i,t.slice(1))}))}else e[t[0]].apply(e,t.slice(1))}catch(e){Kr.error("Error executing queued PostHog call",t,e)}}))};n(i,this),n(r,this),n(s,this)}finally{il--}}push(t){if(il>0&&oe(t)&&de(t[0])){var e=_l.prototype[t[0]];ae(e)&&e.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,e,r){var s,n,o,a,l;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.fl){if(this.is_capturing())if(!ue(t)&&de(t)){this.tl();var h=!this.config.opt_out_useragent_filter&&this._is_bot();if(!h||this.config.__preview_capture_bot_pageviews){var u=null!=r&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==u||!u.isRateLimited){null!=e&&e.$current_url&&!de(null==e?void 0:e.$current_url)&&(Kr.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==e||delete e.$current_url),"$exception"!==t||null!=r&&r.Al||Kr.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&&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 d=new Date,v=(null==r?void 0:r.timestamp)||d,c=Di(null==r?void 0:r.uuid,cs),f={uuid:c,event:t,properties:this.calculateEventProperties(t,e||{},v,c)};t===mt&&this.config.__preview_capture_bot_pageviews&&h&&(f.event="$bot_pageview",f.properties.$browser_type="bot"),u&&(f.properties.$lib_rate_limit_remaining_tokens=u.remainingTokens);var p="$feature_flag_called"===t&&!1===f.properties.$feature_flag_has_experiment&&!0===this.get_property(D);(null==r?void 0:r.$set)&&!p&&(f.$set=null==r?void 0:r.$set);var _=null==r?void 0:r.$unset;_&&(f.$unset=_);var g,m,y,b=p?void 0:this.Fl(null==r?void 0:r.$set_once,t!==wt,t===bt);if(b&&(f.$set_once=b),null!=r&&r._noTruncate||(n=this.config.properties_string_max_length,o=f,a=t=>de(t)?t.slice(0,n):t,l=new Set,f=function t(e,i){if(e!==Object(e))return a?a(e):e;if(!l.has(e)){var r;if(l.add(e),oe(e))r=[],Yr(e,(e=>{r.push(t(e))}));else{var s={};Qr(e,((e,i)=>{l.has(e)||(s[i]=t(e,i))})),r=s}return r}}(o)),f.timestamp=v,ue(null==r?void 0:r.timestamp)||(f.properties.$event_time_override_provided=!0,f.properties.$event_time_override_system_time=d),p&&(f.properties=function(t,e){void 0===e&&(e=[]);var i={},r=e=>{void 0!==t[e]&&(i[e]=t[e])};return Lt.forEach(r),e.forEach(r),i}(f.properties,ll)),t===go.DISMISSED||t===go.SENT){var w=null==e?void 0:e[mo.SURVEY_ID],x=null==e?void 0:e[mo.SURVEY_ITERATION];Va({id:w,current_iteration:x}),f.$set=i({},f.$set,{[(g={id:w,current_iteration:x},m=t===go.SENT?"responded":"dismissed",y="$survey_"+m+"/"+g.id,g.current_iteration&&g.current_iteration>0&&(y="$survey_"+m+"/"+g.id+"/"+g.current_iteration),y)]:!0})}else t===go.SHOWN&&(f.$set=i({},f.$set,{[mo.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(t===bo.SHOWN){var E=null==e?void 0:e[wo.TOUR_TYPE];E&&(f.$set=i({},f.$set,{[wo.TOUR_LAST_SEEN_DATE+"/"+E]:(new Date).toISOString()}))}var S=i({},f.properties.$set,f.$set);if(he(S)||this.setPersonPropertiesForFlags(S),!fe(this.config.before_send)){var k=this.Hn(f);if(!k)return;(f=k).uuid=Di(f.uuid,cs)}this.Zo.emit("eventCaptured",f);var T=null!==(s=null==r?void 0:r._url)&&void 0!==s?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),P={method:"POST",url:T,data:f,compression:"best-available",timestampMode:"recordings"===(null==r?void 0:r._batchKey)||/\/s\/(?:\?|$)/.test(T)?"body":"capture-body",batchKey:null==r?void 0:r._batchKey,transport:null==r?void 0:r.transport};return!this.config.request_batching||r&&(null==r||!r._batchKey)||null!=r&&r.send_instantly?this.pl(P):this.fl.enqueue(P),f}Kr.critical("This capture call is ignored due to client rate limiting.")}}else Kr.error("No event name provided to posthog.capture")}else Kr.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(e=>t(e.event,e)))}getExtension(t){var e;return null==(e=this.Ml)?void 0:e.getExtension(t)}Sl(){var t;return null!==(t=this.Ml)&&void 0!==t?t:this.Ml=new tl(this)}Jo(t){this.al.push(t);var e=!0;return()=>{if(e){e=!1;var i=this.al.indexOf(t);-1!==i&&this.al.splice(i,1)}}}Ol(t){var e,i,r;return void 0===t&&(t=!0),!(null==(e=this.persistence)||!e.consumeCookieIdentityChange())&&(this.hl=null,this.persistence.get_property(X)===ct&&(null==(r=this.sessionPersistence)||r.clear(),this.nl.clear(),this.Ll()),null==(i=this.featureFlags)||i.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,e,r,n,o){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return e;this.persistence.syncCookieProperties(),this.Ol();var a=o?void 0:this.persistence.remove_event_timer(t),l=i({},e);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,this.Xo()&&(l[ot]=!0),"$snapshot"===t){var h=i({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=h.distinct_id,(!de(l.distinct_id)&&!pe(l.distinct_id)||ve(l.distinct_id))&&Kr.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var u,d=function(t,e,i,r){var n,o,a,l;if(void 0===r&&(r=!1),!Ot)return{};var h,u=t?[...Wn,...e||[]]:[],d=function(t){for(var e=0;Ai.length>e;e++){var i=Ai[e],r=i[1],s=i[0].exec(t),n=s&&(ae(r)?r(s,t):r);if(n)return n}return["",""]}(Ot),v=d[0],c=d[1],f=null!=(h="undefined"!=typeof navigator?navigator:void 0)&&h.brave?{brave:!0}:{},p={};ue(i)||(p.detectGoogleSearchApp=i);var _={},g=null==(n=navigator)||null==(n=n.userAgentData)?void 0:n.platform,m=null==(o=navigator)?void 0:o.maxTouchPoints,y=null==xt||null==(a=xt.screen)?void 0:a.width,b=null==xt||null==(l=xt.screen)?void 0:l.height,w=null==xt?void 0:xt.devicePixelRatio;ue(g)||(_.userAgentDataPlatform=g),ue(m)||(_.maxTouchPoints=m),ue(y)||(_.screenWidth=y),ue(b)||(_.screenHeight=b),ue(w)||(_.devicePixelRatio=w);var x,E,S,k,T,P,R,C,O=Xr(is({$os:v,$os_version:c,$browser:Ci(Ot,navigator.vendor,f,p),$device:Fi(Ot),$device_type:(E=Ot,S=_,C=Fi(E),C===De||C===Me||"Kobo"===C||"Kindle Fire"===C||C===vi?Fe:C===ei||C===ri||C===ii||C===hi?"Console":C===Le?"Wearable":C?Oe:"Android"===(null==S?void 0:S.userAgentDataPlatform)&&(null!==(k=null==S?void 0:S.maxTouchPoints)&&void 0!==k?k:0)>0?600>Math.min(null!==(T=null==S?void 0:S.screenWidth)&&void 0!==T?T:0,null!==(P=null==S?void 0:S.screenHeight)&&void 0!==P?P:0)/(null!==(R=null==S?void 0:S.devicePixelRatio)&&void 0!==R?R:1)?Oe:Fe:"Desktop"),$timezone:so(),$timezone_offset:no()}),{$current_url:Bn(r?Li(null==Tt?void 0:Tt.href):null==Tt?void 0:Tt.href,u,Kn),$host:null==Tt?void 0:Tt.host,$pathname:null==Tt?void 0:Tt.pathname,$raw_user_agent:Ot.length>1e3?Ot.substring(0,997)+"...":Ot,$browser_version:Ii(Ot,navigator.vendor,f,p),$browser_language:Zn(),$browser_language_prefix:(x=Zn(),"string"==typeof x?x.split("-")[0]:void 0),$screen_height:null==xt?void 0:xt.screen.height,$screen_width:null==xt?void 0:xt.screen.width,$viewport_height:null==xt?void 0:xt.innerHeight,$viewport_width:null==xt?void 0:xt.innerWidth,$lib:s.LIB_NAME,$lib_version:s.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return s.SDK_DIST_CHANNEL&&(O.$sdk_dist_channel=s.SDK_DIST_CHANNEL),O}(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(o,r.getTime(),!0),c=v.windowId;l.$session_id=v.sessionId,l.$window_id=c}this.sessionPropsManager&&Xr(l,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&Xr(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=null==(f=this.gl)?void 0:f.length}catch(t){l.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===La&&(l.$lib_custom_api_host=this.config.api_host),u=t!==mt||o?t!==yt||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,n),l=Xr(l,u),t===mt&&kt&&(l.title=kt.title),!ue(a)){var p=r.getTime()-a;l.$duration=parseFloat((p/1e3).toFixed(3))}Ot&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser");var _=this.persistence.properties(),g=this.sessionPersistence.properties();Qr(["$referrer","$referring_domain"],(t=>{t in _&&delete g[t]}));var m={};if(this.al.length>0)for(var y of this.al.slice())try{Xr(m,y())}catch(t){Kr.error("Failed to produce browser extension event properties",t)}(l=Xr({},d,_,g,i({},m,l))).$is_identified=this._isIdentified(),oe(this.config.property_denylist)?Qr(this.config.property_denylist,(function(t){delete l[t]})):Kr.error(al+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var b=this.config.sanitize_properties;b&&(Kr.error(ol),l=b(l,t));var w=this.Dl();return l.$process_person_profile=w,w&&!o&&this.$l("_calculate_event_properties"),l}Fl(t,e,i){var r;if(void 0===e&&(e=!0),void 0===i&&(i=!1),!this.persistence||!this.Dl())return t;if(this.rl&&!i)return t;var s=this.persistence.get_initial_props(),n=null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps(),o=Xr({},s,n||{},t||{}),a=this.config.sanitize_properties;return a&&(Kr.error(ol),o=a(o,"$set_once")),e&&(this.rl=!0),he(o)?void 0:o}register(t,e){var i;null==(i=this.persistence)||i.register(t,e)}register_once(t,e,i){var r;null==(r=this.persistence)||r.register_once(t,e,i)}register_for_session(t){var e,i;null==(e=this.persistence)||e.syncCookieProperties(),this.Ol(),null==(i=this.sessionPersistence)||i.register(t),Object.keys(t).forEach((t=>this.nl.add(t))),this.Ll()}unregister(t){var e;null==(e=this.persistence)||e.unregister(t)}unregister_for_session(t){var e;null==(e=this.sessionPersistence)||e.unregister(t),this.nl.delete(t),this.Ll()}Nl(t,e){this.register({[t]:e})}ml(){this.nl.forEach((t=>{var e;null==(e=this.sessionPersistence)||e.unregister(t)})),this.nl.clear(),this.Ll()}Ll(){var t;if(this.sl)if("memory"===this.config.persistence||null!=(t=this.sessionPersistence)&&t.la||!As.Xr())As.ri(this.sl);else{var e=[];this.nl.forEach((t=>e.push(t))),e.length>0?As.ei(this.sl,e):As.ri(this.sl)}}getFeatureFlag(t,e){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlag(t,e)}getFeatureFlagPayload(t){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlagPayload(t)}getFeatureFlagResult(t,e){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagResult(t,e)}getAllFeatureFlags(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.getAllFeatureFlags())&&void 0!==t?t:[]}isFeatureEnabled(t,e){var i,r;return null!==(i=null==(r=this.featureFlags)?void 0:r.isFeatureEnabled(t,e))&&void 0!==i?i:null==e?void 0:e.defaultValue}reloadFeatureFlags(){var t;null==(t=this.featureFlags)||t.reloadFeatureFlags()}updateFlags(t,e,i){var r;null==(r=this.featureFlags)||r.updateFlags(t,e,i)}updateEarlyAccessFeatureEnrollment(t,e,i){var r;null==(r=this.featureFlags)||r.updateEarlyAccessFeatureEnrollment(t,e,i)}getEarlyAccessFeatures(t,e,i){var r;return void 0===e&&(e=!1),null==(r=this.featureFlags)?void 0:r.getEarlyAccessFeatures(t,e,i)}on(t,e){return this.Zo.on(t,e)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:nl}),()=>{})}onSessionId(t){var e,i;return null!==(e=null==(i=this.sessionManager)?void 0:i.onSessionId(t))&&void 0!==e?e:()=>{}}getSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getSurveys(t,e):t([],{isLoaded:!1,error:nl})}getActiveMatchingSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:nl})}renderSurvey(t,e){var i;null==(i=this.surveys)||i.renderSurvey(t,e)}displaySurvey(t,e){var i;void 0===e&&(e=Ga),null==(i=this.surveys)||i.displaySurvey(t,e)}cancelPendingSurvey(t){var e;null==(e=this.surveys)||e.cancelPendingSurvey(t)}canRenderSurvey(t){var e,i;return null!==(e=null==(i=this.surveys)?void 0:i.canRenderSurvey(t))&&void 0!==e?e:{visible:!1,disabledReason:nl}}canRenderSurveyAsync(t,e){var i,r;return void 0===e&&(e=!1),null!==(i=null==(r=this.surveys)?void 0:r.canRenderSurveyAsync(t,e))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:nl})}ql(t){return!t||ve(t)?(Kr.critical("Unique user id has not been set in posthog.identify"),!1):t===nt?(Kr.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(Kr.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(t,e,i){if(!this.__loaded||!this.persistence)return Kr.uninitializedWarning("posthog.identify");if(pe(t)&&(t=t.toString(),Kr.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.ql(t)&&this.$l("posthog.identify")){this.tl();var r=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==r,n=this.Ol(!1),o=this.persistence.da(),l=!1;try{var u=this.get_distinct_id();this.register({$user_id:t}),this.get_property(a)||this.register_once({$had_persisted_distinct_id:!0,$device_id:u},""),t!==u&&t!==this.get_property(h)&&(this.unregister(h),this.register({distinct_id:t}));var d,v=(this.persistence.get_property(X)||ct)===ct,c=t!==u,f=!c&&v;if(c&&v)this.persistence.set_property(X,ft),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.va(),this.capture(bt,{distinct_id:t,$anon_distinct_id:u},{$set:e||{},$set_once:i||{}}),this.hl=Na(t,e,i),null==(d=this.featureFlags)||d.setAnonymousDistinctId(u);else if(f){this.persistence.set_property(X,ft);var p=e||{},_=i||{};this.setPersonPropertiesForFlags({$set:p,$set_once:_},!1),this.config.cookieWinsOnConflict&&this.persistence.va(),this.capture("$set",{$set:p,$set_once:_}),this.hl=Na(t,e,i)}else(e||i)&&this.setPersonProperties(e,i);c||s||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(K)):f&&(e||i)&&this.reloadFeatureFlags(),l=!0}finally{o&&this.persistence.pa(l)}}}setPersonProperties(t,e){if((t||e)&&this.$l("posthog.setPersonProperties")){var i=Na(this.get_distinct_id(),t,e);this.hl!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}}),this.hl=i):Kr.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var e,i=(oe(t)?t:[t]).filter((t=>de(t)&&t.length>0));0!==i.length&&this.$l("posthog.unsetPersonProperties")&&(null==(e=this.featureFlags)||e.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.hl=null)}group(t,e,r){var s;if(t&&e){null==(s=this.persistence)||s.syncCookieProperties(),this.Ol();var n=this.getGroups(),o=n[t]!==e;if(o&&this.resetGroupPropertiesForFlags(t),this.register({$groups:i({},n,{[t]:e})}),o||r){var a={$group_type:t,$group_key:e};r&&(a.$group_set=r),this.capture(wt,a)}r&&this.setGroupPropertiesForFlags({[t]:r}),o&&!r&&this.reloadFeatureFlags()}else Kr.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,e){var i;void 0===e&&(e=!0),null==(i=this.featureFlags)||i.setPersonPropertiesForFlags(t,e)}resetPersonPropertiesForFlags(t){var e;void 0===t&&(t=!0),null==(e=this.featureFlags)||e.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,e){var i;void 0===e&&(e=!0),this.$l("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(t,e))}resetGroupPropertiesForFlags(t){var e;null==(e=this.featureFlags)||e.resetGroupPropertiesForFlags(t)}reset(t){var e=ge(t)?t:null==t?void 0:t.resetDeviceID,i=ge(t)||null==t?void 0:t.bootstrap;this.jl(e,!1,i)}jl(t,e,r){var s,n,o;if(void 0===e&&(e=!1),Kr.info("reset"),!this.__loaded)return Kr.uninitializedWarning("posthog.reset");var h=null==r?void 0:r.sessionID;this.config.bootstrap=r||(null==(s=this.vl)?void 0:s.bootstrap)||{},null==(n=this.featureFlags)||null==n.updateConfig||n.updateConfig(this.config,this.Da());var u=this.get_property(a),d=this.get_property(l),v=this.get_property(w),c=this.is_capturing();this.consent.reset(),e||!c||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");var f=null==(o=this.persistence)||null==o.da?void 0:o.da(),p=!1;try{var _,g,m,y,b,x,E,S,k,T,P,R,C;if(null==(_=this.persistence)||_.clear(),null==(g=this.sessionPersistence)||g.clear(),this.nl.clear(),this.Ll(),ue(v)||null==(T=this.persistence)||T.register({[w]:v}),null==(m=this.surveys)||m.reset(),null==(y=this.featureFlags)||y.reset(),null==(b=this.conversations)||b.reset(),null==(x=this.logs)||x.reset(),null==(E=this.metrics)||E.reset(),null==(S=this.persistence)||S.set_property(X,ct),null==(k=this.sessionManager)||k.resetSessionId(),this.hl=null,this.config.cookieless_mode===vt)this.register_once({distinct_id:nt,$device_id:null},"");else{var O=this.config.get_device_id(cs());this.register_once({distinct_id:O,$device_id:t?O:u},""),t||ue(d)||this.register({[l]:d})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),r)if(void 0===r.distinctID||this.Xo()||(null==(C=this.persistence)||C.set_property(X,r.isIdentifiedID?ft:ct),this.register({distinct_id:r.distinctID})),null==(P=this.featureFlags)||P.initialize(),!(ue(h)||null!=(R=this.sessionManager)&&R.setBootstrapSessionId(h,!0))){var I=i({},r);delete I.sessionID,this.config.bootstrap=I}delete this.config.identity_distinct_id,delete this.config.identity_hash,p=!0}finally{var A;f&&(null==(A=this.persistence)||null==A.pa||A.pa(p))}this.reloadFeatureFlags()}shutdown(t){var i=this;return e((function*(){var t,e,r,s,n;if(i.__loaded){i.Sl().dispose(),null==(t=i.sessionRecording)||t.dispose(),null==(e=i.logs)||e.flushLogs("sendBeacon"),null==(r=i.metrics)||r.flush("sendBeacon"),null==(s=i.fl)||s.unload(),null==(n=i.gl)||n.unload();try{var o;null==(o=i.featureFlags)||o.destroy()}catch(t){Kr.error("Error while destroying feature flags",t)}}else Kr.uninitializedWarning("posthog.shutdown")}))()}setIdentity(t,e){var i;this.config.identity_distinct_id=t,this.config.identity_hash=e,this.alias(t),null==(i=this.conversations)||i.Bl()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(t=this.conversations)||t.Hl()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,e;return null!==(t=null==(e=this.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var e=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=e.sessionStartTimestamp,r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+e.sessionId);if(null!=t&&t.withTimestamp&&i){var s,n=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!i)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return r}alias(t,e){return t===this.get_property(n)?(Kr.critical("Attempting to create alias for existing People user - aborting."),-2):this.$l("posthog.alias")?(ue(e)&&(e=this.get_distinct_id()),t!==e?(this.Nl(h,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(Kr.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var e=i({},this.config);if(le(t)){var r,n,o,a,l,h,u,d,v,c,f,p;Xr(this.config,fl(t));var _=this.el();null==(r=this.persistence)||r.update_config(this.config,e,_),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new vo(i({},this.config,{persistence:"sessionStorage"}),_,!1);var g,m=this.dl(this.config.debug);ge(m)&&(this.config.debug=m),ge(this.config.debug)&&(this.config.debug?(s.DEBUG=!0,ys.Xr()&&ys.ei("ph_debug",!0),Kr.info("set_config",{config:t,oldConfig:e,newConfig:i({},this.config)})):(s.DEBUG=!1,ys.Xr()&&ys.ri("ph_debug"))),null==(n=this.featureFlags)||null==n.updateConfig||n.updateConfig(this.config,this.Da()),null==(o=this.exceptionObserver)||o.onConfigChange(),null==(a=this.exceptions)||a.onConfigChange(),null==(l=this.sessionRecording)||l.startIfEnabledOrStop(),null==(h=this.tracingHeaders)||h.startIfEnabledOrStop(),null==(u=this.autocapture)||u.startIfEnabled(),null==(d=this.heatmaps)||d.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null==(g=this.historyAutocapture)||g.startIfEnabledOrStop()),null==(v=this.exceptionObserver)||v.startIfEnabledOrStop(),null==(c=this.deadClicksAutocapture)||c.startIfEnabledOrStop(),null==(f=this.surveys)||f.loadIfEnabled(),this.il(),null==(p=this.externalIntegrations)||p.startIfEnabledOrStop()}}_overrideSDKInfo(t,e){s.LIB_NAME=t,s.LIB_VERSION=e}startSessionRecording(t){var e,i,r,s,n,o=!0===t,a={sampling:o||!(null==t||!t.sampling),linked_flag:o||!(null==t||!t.linked_flag),url_trigger:o||!(null==t||!t.url_trigger),event_trigger:o||!(null==t||!t.event_trigger)};Object.values(a).some(Boolean)&&(null==(e=this.sessionManager)||e.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(r=this.sessionRecording)||r.overrideLinkedFlag()),a.url_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event")));this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!(null==(t=this.sessionRecording)||!t.started)}captureException(t,e){if(this.exceptions){var r=new Error("PostHog syntheticException"),s=this.exceptions.buildProperties(t,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(i({},s,e))}}addExceptionStep(t,e){var i;null==(i=this.exceptions)||i.addExceptionStep(t,e)}captureLog(t){var e;null==(e=this.logs)||e.captureLog(t)}get logger(){var t,e;return null!==(t=null==(e=this.logs)?void 0:e.logger)&&void 0!==t?t:_l.zl}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var e,i;return null!==(e=null==(i=this.toolbar)?void 0:i.loadToolbar(t))&&void 0!==e&&e}get_property(t){var e;return null==(e=this.persistence)?void 0:e.props[t]}getSessionProperty(t){var e;return null==(e=this.sessionPersistence)?void 0:e.props[t]}toString(){var t,e=null!==(t=this.config.name)&&void 0!==t?t:hl;return e!==hl&&(e=hl+"."+e),e}_isIdentified(){var t,e;return(null==(t=this.persistence)?void 0:t.get_property(X))===ft||(null==(e=this.sessionPersistence)?void 0:e.get_property(X))===ft}Dl(){var t,e;return!("never"===this.config.person_profiles||this.config.person_profiles===pt&&!this._isIdentified()&&he(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[h])&&(null==(e=this.persistence)||null==(e=e.props)||!e[st]))}Pl(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.Dl()||this.$l("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.$l("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}$l(t){return"never"===this.config.person_profiles?(Kr.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Nl(st,!0),!0)}el(){if("always"===this.config.cookieless_mode)return!0;var t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==dt)}il(){var t,e,i,r,s,n=this.el();return this.is_capturing()||null==(i=this.logs)||i.Ul(),(null==(t=this.persistence)?void 0:t.la)!==n&&(null==(r=this.persistence)||r.set_disabled(n)),(null==(e=this.sessionPersistence)?void 0:e.la)!==n&&(null==(s=this.sessionPersistence)||s.set_disabled(n)),n&&(this.nl.clear(),this.Ll()),n}opt_in_capturing(t){var e;if(this.config.cookieless_mode!==vt){if(this.Xo()){var i,r,s,n,o;this.jl(!0,!0),null==(i=this.sessionManager)||i.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new Ra(this),this.pageViewManager=new An(this),this.persistence&&(this.sessionPropsManager=new ka(this,this.sessionManager,this.persistence));var a,l=null!==(s=null==(n=this.config.__extensionClasses)?void 0:n.sessionRecording)&&void 0!==s?s:null==(o=_l.__defaultExtensionClasses)?void 0:o.sessionRecording;l&&(this.sessionRecording=this.Yo(this.sessionRecording,new l(this)),this.Go&&(null==(a=this.sessionRecording)||null==a.onRemoteConfig||a.onRemoteConfig(this.Go)))}var h,u;this.consent.optInOut(!0),this.il(),this.El(),null==(e=this.sessionRecording)||e.startIfEnabledOrStop(),this.config.cookieless_mode==dt&&(null==(h=this.surveys)||h.loadIfEnabled()),(ue(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)&&this.capture(null!==(u=null==t?void 0:t.captureEventName)&&void 0!==u?u:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Il()}else Kr.warn(sl)}opt_out_capturing(){var t,e,i;this.config.cookieless_mode!==vt?(this.config.cookieless_mode===dt&&this.consent.isOptedIn()&&this.jl(!0,!0),this.consent.optInOut(!1),this.il(),this.config.cookieless_mode===dt&&(this.register({distinct_id:nt,$device_id:null}),null==(t=this.sessionRecording)||t.stopRecording(),this.sessionRecording=void 0,null==(e=this.sessionManager)||e.destroy(),null==(i=this.pageViewManager)||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.Il(),this.El())):Kr.warn(sl)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return 1===t?"granted":0===t?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===vt||(this.config.cookieless_mode===dt?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.il()}_is_bot(){return St?Ca(St,this.config.custom_blocked_useragents):void 0}Il(){kt&&("visible"===kt.visibilityState?this.ol||(this.ol=!0,this.capture(mt,{title:kt.title},{send_instantly:!0}),this.ll&&(kt.removeEventListener(_t,this.ll),this.ll=null)):this.ll||(this.ll=this.Il.bind(this),ns(kt,_t,this.ll)))}debug(t){!1===t?(null==xt||xt.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==xt||xt.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}))}Da(){var t=this.vl||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(Kr.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):function(t,e,i,r,s){var n=e in t&&!fe(t[e]),o=i in t&&!fe(t[i]);return n?t[e]:!!o&&(s&&s.warn("Config field '"+i+"' is deprecated. Please use '"+e+"' instead. The old field will be removed in a future major version."),t[i])}(t,"advanced_disable_flags","advanced_disable_decide",0,Kr)}Hn(t){var e;if(fe(this.config.before_send))return t;var i=Object.keys(null!==(e=t.properties)&&void 0!==e?e:{}).filter(be),r=oe(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var n of r)try{if(s=n(s),fe(s)){var o="Event '"+t.event+"' was rejected in beforeSend function";return ye(t.event)?Kr.warn(o+". This can cause unexpected behavior."):Kr.info(o),null}s.properties&&!he(s.properties)||Kr.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}catch(e){return Kr.error("Error in beforeSend function for event '"+t.event+"':",e),null}for(var a of i)if(s.properties&&fe(s.properties[a]))return Kr.warn("Event '"+t.event+"' had its '"+a+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return s}getPageViewId(){var t;return null==(t=this.pageViewManager.zs)?void 0:t.pageViewId}captureTraceFeedback(t,e){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:e})}captureTraceMetric(t,e,i){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:e,$ai_metric_value:String(i)})}dl(t){var e=ge(t)&&!t,i=ys.Xr()&&"true"===ys.ti("ph_debug");return!e&&(!!i||t)}}_l.__defaultExtensionClasses={},_l.zl=(()=>{var t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),function(t,e){for(var i=0;e.length>i;i++)t.prototype[e[i]]=es(t.prototype[e[i]])}(_l,["identify"]);class gl{constructor(t){this.disabled=!1===t;var e=le(t)?t:{};this.thresholdPx=e.threshold_px||30,this.timeoutMs=e.timeout_ms||1e3,this.clickCount=e.click_count||3,this.clicks=[]}isRageClick(t,e,i){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(t-r.x)+Math.abs(e-r.y)<this.thresholdPx&&this.timeoutMs>i-r.timestamp){if(this.clicks.push({x:t,y:e,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:e,timestamp:i}];return!1}}var ml="$copy_autocapture",yl=Jr("[AutoCapture]");function bl(t,e){return e.length>t?e.slice(0,t)+"...":e}function wl(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do{e=e.previousSibling}while(e&&!Bs(e));return e}function xl(t,e){var r,s,n=e.e,o=e.maskAllElementAttributes,a=e.maskAllText,l=e.elementAttributeIgnoreList,h=e.elementsChainAsString,u=e.disableCaptureUrlHashes;if(!Bs(t))return{props:{}};for(var d=[t],v=new Set([t]),c=t;c.parentNode&&!zs(c,"body")&&Vs>d.length;)if(Hs(c.parentNode)){var f=c.parentNode.host;if(v.has(f))break;v.add(f),d.push(f),c=f}else{if(!Bs(c.parentNode))break;if(v.has(c.parentNode))break;v.add(c.parentNode),d.push(c.parentNode),c=c.parentNode}var p,_,g=[],m={},y=!1,b=!1;if(Qr(d,(t=>{var e=dn(t);if(zs(t,"a")){var i=t.getAttribute("href");y=!!(e&&i&&bn(i))&&(u?Li(i):i)}Zt(Ks(t),"ph-no-capture")&&(b=!0),g.push(function(t,e,i,r,s){void 0===s&&(s=!1);var n=t.tagName.toLowerCase(),o={tag_name:n};Xs.indexOf(n)>-1&&!i&&(o.$el_text="a"===n.toLowerCase()||"button"===n.toLowerCase()?bl(1024,wn(t)):bl(1024,Ys(t)));var a=Ks(t);a.length>0&&(o.classes=a.filter((function(t){return""!==t}))),Qr(t.attributes,(function(i){var n;if((!vn(t)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==r||!r.includes(i.name))&&!e&&bn(i.value)&&(!de(n=i.name)||"_ngcontent"!==n.substring(0,10)&&"_nghost"!==n.substring(0,7))){var a=i.value;"class"===i.name&&(a=Ws(a).join(" ")),o["attr__"+i.name]=bl(1024,"href"===i.name&&s?Li(a):a)}}));for(var l=1,h=1,u=t;u=wl(u);)l++,u.tagName===t.tagName&&h++;return o.nth_child=l,o.nth_of_type=h,o}(t,o,a,l,u));var r=function(t){if(!dn(t))return{};var e={};return Qr(t.attributes,(function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){var i=t.name.replace("data-ph-capture-attribute-",""),r=t.value;i&&r&&bn(r)&&(e[i]=r)}})),e}(t);Xr(m,r)})),b)return{props:{},explicitNoCapture:b};if(a||(g[0].$el_text=zs(t,"a")||zs(t,"button")?wn(t):Ys(t)),y){var w,x;g[0].attr__href=y;var E=null==(w=Un(y))?void 0:w.host,S=null==xt||null==(x=xt.location)?void 0:x.host;E&&S&&E!==S&&(p=y)}return{props:Xr({$event_type:n.type,$ce_version:1},h?{}:{$elements:g},{$elements_chain:(_=g,function(t){return t.map((t=>{var e,r,s="";if(t.tag_name&&(s+=t.tag_name),t.attr_class)for(var n of(t.attr_class.sort(),t.attr_class))s+="."+n.replace(/"/g,"");var o=i({},t.text?{text:t.text}:{},{"nth-child":null!==(e=t.nth_child)&&void 0!==e?e:0,"nth-of-type":null!==(r=t.nth_of_type)&&void 0!==r?r:0},t.href?{href:t.href}:{},t.attr_id?{attr_id:t.attr_id}:{},t.attributes),a={};return Zr(o).sort(((t,e)=>t[0].localeCompare(e[0]))).forEach((t=>{var e=t[1];return a[En(t[0].toString())]=En(e.toString())})),(s+=":")+Zr(a).map((t=>t[0]+'="'+t[1]+'"')).join("")})).join(";")}(function(t){return t.map((t=>{var e,i,r={text:null==(e=t.$el_text)?void 0:e.slice(0,400),tag_name:t.tag_name,href:null==(i=t.attr__href)?void 0:i.slice(0,2048),attr_class:Sn(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Zr(t).filter((t=>0===t[0].indexOf("attr__"))).forEach((t=>r.attributes[t[0]]=t[1])),r}))}(_)))},null!=(r=g[0])&&r.$el_text?{$el_text:null==(s=g[0])?void 0:s.$el_text}:{},p&&"click"===n.type?{$external_click_url:p}:{},m)}}class El{constructor(t){this.name="autocapture",this.ys=!1,this.bs=null,this._s=!1,this.ws=!1,this.nn={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.ks=!1,this.Ss=t,this.Ss.refresh(this.nn),this.rageclicks=new gl(this.nn.rageclick),this.xs=null}setup(t){this.Cs(),this.Ts=t;var e=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.ks?e.dispose():(this.Ms=e,this.startIfEnabled())}dispose(){var t;this.ks||(this.ks=!0,this.Ts=void 0,null==(t=this.Ms)||t.dispose(),this.Ms=void 0,this.Es())}Is(){return this.Ss.refresh(this.nn),this.nn}Cs(){var t,e;return this.Is(),this.nn.url_allowlist=null==(t=this.nn.url_allowlist)?void 0:t.map((t=>new RegExp(t))),this.nn.url_ignorelist=null==(e=this.nn.url_ignorelist)?void 0:e.map((t=>new RegExp(t))),this.nn}Rs(){if(this.isBrowserSupported()){if(xt&&kt){var t=this.Ps=t=>{t=t||(null==xt?void 0:xt.event);try{this.As(t)}catch(t){yl.error("Failed to capture event",t)}};if(ns(kt,"submit",t,{capture:!0}),ns(kt,"change",t,{capture:!0}),ns(kt,"click",t,{capture:!0}),this.Is().capture_copied_text){var e=this.Fs=t=>{t=t||(null==xt?void 0:xt.event);try{this.As(t,ml)}catch(t){yl.error("Failed to capture clipboard event",t)}};ns(kt,"copy",e,{capture:!0}),ns(kt,"cut",e,{capture:!0}),ns(kt,"paste",e,{capture:!0})}}}else yl.info("Disabling Automatic Event Collection because this browser is not supported")}Es(){this.Ps&&(null==kt||kt.removeEventListener("submit",this.Ps,!0),null==kt||kt.removeEventListener("change",this.Ps,!0),null==kt||kt.removeEventListener("click",this.Ps,!0),this.Ps=void 0),this.Fs&&(null==kt||kt.removeEventListener("copy",this.Fs,!0),null==kt||kt.removeEventListener("cut",this.Fs,!0),null==kt||kt.removeEventListener("paste",this.Fs,!0),this.Fs=void 0),this.ys=!1}startIfEnabled(){!this.ks&&this.Ts&&this.isEnabled&&!this.ys&&(this.Rs(),this.ys=!0)}onRemoteConfig(t){if(!this.ks)if(this._s=!0,t.ok){var e=t.config;e.elementsChainAsString&&(this.ws=e.elementsChainAsString);var i,r=e.autocapture_opt_out;ge(r)&&(null==(i=this.Ts)||i.kv.set(d,r),this.bs=r),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(t){this.xs=t}getElementSelectors(t){var e,i=[];return null==(e=this.xs)||e.forEach((e=>{var r=null==kt?void 0:kt.querySelectorAll(e);null==r||r.forEach((r=>{t===r&&i.push(e)}))})),i}get isEnabled(){var t,e;if(this.ks)return!1;var i=null==(t=this.Ts)?void 0:t.kv.get(d),r=this.bs,s=this.Is(),n=s.remoteRequestsDisabled&&!this._s;if(ce(r)&&!ge(i)&&!n)return!1;var o=null!==(e=this.bs)&&void 0!==e?e:!!i;return!!s.enabled&&!o}As(t,e){if(void 0===e&&(e="$autocapture"),this.isEnabled){var r=Qs(t);qs(r)&&(r=r.parentNode||null);var s,n=this.Cs();"$autocapture"===e&&"click"===t.type&&t instanceof MouseEvent&&n.rageclick&&null!=(s=this.rageclicks)&&s.isRageClick(t.clientX,t.clientY,t.timeStamp||(new Date).getTime())&&ln(r,n.rageclick)&&this.As(t,"$rageclick");var o=e===ml,a=o?i({},n,{dom_event_allowlist:void 0}):n;if(r&&function(t,e,i,r,s,n){var o;if(!xt||hn(t))return!1;if(null!=i&&i.url_allowlist&&!Gs(i.url_allowlist,n))return!1;if(null!=i&&i.url_ignorelist&&Gs(i.url_ignorelist,n))return!1;if(null!=i&&i.dom_event_allowlist){var a=i.dom_event_allowlist;if(a&&!a.some((t=>e.type===t)))return!1}var l=un(t,r),h=l.parentIsUsefulElement,u=l.targetElementList;if(!function(t,e){var i=null==e?void 0:e.element_allowlist;if(ue(i))return!0;var r,s=function(t){if(i.some((e=>t.tagName.toLowerCase()===e)))return{v:!0}};for(var n of t)if(r=s(n))return r.v;return!1}(u,i))return!1;if(!Zs(u,null==i?void 0:i.css_selector_allowlist))return!1;if(Zs(u,null!==(o=null==i?void 0:i.css_selector_ignorelist)&&void 0!==o?o:en))return!1;try{var d=xt.getComputedStyle(t);if(d&&"pointer"===d.getPropertyValue("cursor")&&"click"===e.type)return!0}catch(t){}var v=t.tagName.toLowerCase();switch(v){case"html":return!1;case"form":return(s||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(e.type)>=0;default:return h?(s||["click"]).indexOf(e.type)>=0:(s||["click"]).indexOf(e.type)>=0&&(Xs.indexOf(v)>-1||"true"===t.getAttribute("contenteditable"))}}(r,t,a,o,o?["copy","cut","paste"]:void 0,{config:{get_current_url:n.getCurrentUrl}})){var l,h=xl(r,{e:t,maskAllElementAttributes:n.maskAllElementAttributes,maskAllText:n.maskAllText,elementAttributeIgnoreList:n.element_attribute_ignorelist,elementsChainAsString:this.ws,disableCaptureUrlHashes:n.disableCaptureUrlHashes}),u=h.props;if(h.explicitNoCapture)return!1;var d=this.getElementSelectors(r);if(d&&d.length>0&&(u.$element_selectors=d),e===ml){var v=t.type||"clipboard";if("paste"!==v){var c,f,p=null==xt||null==(c=xt.getSelection())?void 0:c.toString(),_=Js(p);if(!_)return!1;u.$selected_content=_,u.$clipboard_text_length=null!==(f=null==p?void 0:p.length)&&void 0!==f?f:0}u.$copy_type=v}return null==(l=this.Ts)||l.capture(e,u).catch((t=>yl.error("Failed to capture event",t))),!0}}}isBrowserSupported(){return ae(null==kt?void 0:kt.querySelectorAll)}}class Sl{constructor(t){this._instance=t}refresh(t){var e=this._instance.config,i=le(e.autocapture)?e.autocapture:void 0;t.enabled=!!e.autocapture,t.rageclick=e.rageclick,t.maskAllElementAttributes=e.mask_all_element_attributes,t.maskAllText=e.mask_all_text,t.disableCaptureUrlHashes=e.disable_capture_url_hashes,t.getCurrentUrl=e.get_current_url,t.remoteRequestsDisabled=this._instance.Da(),t.url_allowlist=null==i?void 0:i.url_allowlist,t.url_ignorelist=null==i?void 0:i.url_ignorelist,t.dom_event_allowlist=null==i?void 0:i.dom_event_allowlist,t.element_allowlist=null==i?void 0:i.element_allowlist,t.css_selector_allowlist=null==i?void 0:i.css_selector_allowlist,t.css_selector_ignorelist=null==i?void 0:i.css_selector_ignorelist,t.element_attribute_ignorelist=null==i?void 0:i.element_attribute_ignorelist,t.capture_copied_text=null==i?void 0:i.capture_copied_text}}var kl=Jr("[ExceptionAutocapture]"),Tl=()=>{},$l=t=>{var e;if(ae(t))return null!==(e=t.__posthog_layer__)&&void 0!==e?e:t.__rrweb_layer__};function Pl(t,e,i){try{if(!(e in t))return Tl;var r={next:t[e]},s=i((function(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];return r.next.apply(this,e)}));return ae(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:r}})),t[e]=s,()=>{if(t[e]!==s)for(var i=t[e],n=$l(i);n;){if(n.next===s)return void(n.next=r.next);n=$l(i=n.next)}else t[e]=r.next}}catch(t){return Tl}}var Rl=Jr("[TracingHeaders]"),Cl=Jr("[Web Vitals]"),Ol=9e5,Il=["CLS","FCP","INP","LCP"],Al=["INP","LCP"],Fl=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],Ml="disabled",Dl="lazy_loading",Nl="awaiting_config",Ll="missing_config";Jr("[SessionRecording]"),Jr("[SessionRecording]");var Ul="[SessionRecording]",jl=Jr(Ul),Bl=Jr("[Heatmaps]");function zl(t){return le(t)&&"clientX"in t&&"clientY"in t&&pe(t.clientX)&&pe(t.clientY)}var ql=Jr("[Product Tours]"),Hl=t=>{var e;return!t.config.disable_product_tours&&!(null==(e=t.persistence)||!e.get_property(m))},Vl=["$set_once","$set"],Wl=Jr("[SiteApps]"),Gl="Error while initializing PostHog app with config id ",Kl=(t,e)=>null!=t&&t.then?t.then(e):e(t),Jl="SDK is not enabled or survey functionality is not yet loaded",Yl="Disabled. Not loading surveys.";class Ql{constructor(t,e){this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Wl=!1,this.Vl=[],this.Gl=null,this.Zl=null,this.ks=!1,this.Ql=new Set,this.onRemoteConfig=t=>{if(!this.ks&&!this.nn.disableSurveys){if(!t.ok)return qa.warn("Remote config unavailable. Not loading surveys.");var e=t.config.surveys;if(fe(e))return qa.warn("Flags not loaded yet. Not loading surveys.");this.Jl=ge(e)?e:e.length>0,qa.info("flags response received, isSurveysEnabled: "+this.Jl),this.loadIfEnabled()}},this.Ss=t,this.Kl=e}setup(t){if(!this.ks)return this.Yl=t,Kl(t.kv.initialize(),(()=>{if(this.Yl===t&&!this.ks){this.Yl=void 0,this.Ts=t;var e=t.onRemoteConfig(this.onRemoteConfig);this.ks?e.dispose():(this.Ms=e,this.loadIfEnabled())}}))}dispose(){var t,e,i;this.ks||(this.ks=!0,this.Yl=void 0,this.Ts=void 0,null==(t=this.Ms)||t.dispose(),this.Ms=void 0,null==(e=this._surveyEventReceiver)||e.dispose(),this._surveyEventReceiver=null,null==(i=this._surveyManager)||null==i.dispose||i.dispose(),this._surveyManager=null,this.Vl=[],this.Gl=null,this.Ql.forEach((t=>clearTimeout(t))),this.Ql.clear())}get nn(){return this.Ss.get()}initialize(){this.loadIfEnabled()}reset(){try{var t;null==(t=this._surveyEventReceiver)||t.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var e=[],i=0;i<localStorage.length;i++){var r=localStorage.key(i);(null!=r&&r.startsWith(Ha)||null!=r&&r.startsWith("inProgressSurvey_"))&&e.push(r)}e.forEach((t=>localStorage.removeItem(t)))}catch(t){}}loadIfEnabled(){if(!this.ks&&this.Ts){var t=this.nn;if(!this._surveyManager)if(this.Wl)qa.info("Already initializing surveys, skipping...");else if(t.disableSurveys)qa.info(Yl);else if(t.cookielessMode&&this.Ss.isOptedOut())qa.info("Not loading surveys in cookieless mode without consent.");else{var e=this.Ss.getExtensions();if(e){if(!ue(this.Jl)||t.advancedEnableSurveys){var i=this.Jl||t.advancedEnableSurveys;this.Wl=!0;try{var r=e.generateSurveys;if(r)return this.Xl(r,i),void(this.Wl=!1);var s=e.loadExternalDependency;if(!s)return this.tu(ut),void(this.Wl=!1);s((t=>{try{if(this.ks)return;var e=this.Ss.getExtensions();t||null==e||!e.generateSurveys?this.tu("Could not load surveys script",t):this.Xl(e.generateSurveys,i)}finally{this.Wl=!1}}))}catch(t){throw this.Wl=!1,this.tu("Error initializing surveys",t),t}}}else qa.error("PostHog Extensions not found.")}}}Xl(t,e){this.ks||(this._surveyManager=t(e),this._surveyEventReceiver=this.Ss.createEventReceiver(),qa.info("Surveys loaded successfully"),this.eu({isLoaded:!0}))}tu(t,e){qa.error(t,e),this.eu({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.Vl.push(t),this._surveyManager&&this.eu({isLoaded:!0}),()=>{this.Vl=this.Vl.filter((e=>e!==t))}}getSurveys(t,e){var i;void 0===e&&(e=!1);var r=null!==(i=this.Ts)&&void 0!==i?i:this.Kl;if(r&&!this.ks){if(this.nn.disableSurveys)return qa.info(Yl),t([]);var s=r.kv.get(z);if(s&&!e)return t(s,{isLoaded:!0}),void(this.iu()&&this.getSurveys((()=>{}),!0));if(this.Gl)this.Gl.then((e=>{this.ks||t(e.surveys,e.context)})).catch((t=>qa.error("Error in survey callback",t)));else{var n=this.ru("/api/surveys/",{method:"GET",query:{token:r.projectToken},sentAt:"query",timeoutMs:this.nn.requestTimeoutMs}).then((t=>{try{return this.nu(r,t)}catch(t){return qa.error("Error processing surveys response",t),this.nu(r,{statusCode:0,error:t})}}),(t=>this.nu(r,{statusCode:0,error:t})));this.Gl=n;var o=()=>{this.Gl===n&&(this.Gl=null)};n.then((e=>{o(),this.ks||t(e.surveys,e.context)}),o).catch((t=>qa.error("Error in survey callback",t)))}}}ru(t,e){var i=this.Ts;return i?i.sendRequest(t,e):new Promise((t=>t({statusCode:0,error:new Error(Jl)})))}nu(t,e){if(this.ks)return{surveys:[],context:{isLoaded:!1,error:Jl}};var i=e.statusCode;if(200!==i||!e.json){var r="Surveys API could not be loaded, status: "+i;return 0!==i?qa.error(r):e.error||qa.warn(r),this.Zl=Date.now(),{surveys:[],context:{isLoaded:!1,error:r}}}this.Zl=null;var s,n=e.json.surveys||[],o=n.filter((t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(Ia(t)||function(t){var e;return!(null==(e=t.conditions)||null==(e=e.actions)||null==(e=e.values)||!e.length)}(t))));return o.length>0&&(null==(s=this._surveyEventReceiver)||s.register(o)),t.kv.set({[z]:n,[q]:Date.now()}),{surveys:n,context:{isLoaded:!0}}}iu(){return this.su()&&!this.Gl&&!this.au()}su(){var t,e,i=null==(t=null!==(e=this.Ts)&&void 0!==e?e:this.Kl)?void 0:t.kv.get(q);return pe(i)&&Date.now()-i>3e5}au(){return pe(this.Zl)&&3e5>Date.now()-this.Zl}markSurveyAsSeen(t,e){var i,r={id:t,current_iteration:null!==(i=null==e?void 0:e.iteration)&&void 0!==i?i:null};Va(r);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}}eu(t){for(var e of this.Vl)try{if(!t.isLoaded)return e([],t);this.getSurveys(e)}catch(t){qa.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,e){if(void 0===e&&(e=!1),!fe(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);qa.warn("init was not called")}ou(t){var e=null;return this.getSurveys((i=>{var r;e=null!==(r=i.find((e=>e.id===t)))&&void 0!==r?r:null})),e}lu(t){if(fe(this._surveyManager))return{eligible:!1,reason:Jl};var e="string"==typeof t?this.ou(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}uu(t){if(fe(this._surveyManager))return{eligible:!1,reason:Jl};var e="string"==typeof t?this.ou(t):t;return e?this._surveyManager.checkSurveyRenderability(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(fe(this._surveyManager))return qa.warn("init was not called"),{visible:!1,disabledReason:Jl};var e=this.uu(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return fe(this._surveyManager)?(qa.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Jl})):new Promise((i=>{this.getSurveys((e=>{var r,s=null!==(r=e.find((e=>e.id===t)))&&void 0!==r?r:null;if(s){var n=this.uu(s);i({visible:n.eligible,disabledReason:n.reason})}else i({visible:!1,disabledReason:"Survey not found"})}),e)}))}renderSurvey(t,e,i){var r;if(fe(this._surveyManager))qa.warn("init was not called");else{var s="string"==typeof t?this.ou(t):t;if(null!=s&&s.id)if(Wa.includes(s.type)){var n=null==kt?void 0:kt.querySelector(e);if(n)if(null!=(r=s.appearance)&&r.surveyPopupDelaySeconds){qa.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds");var o=setTimeout((()=>{var t,e;this.Ql.delete(o),this.ks||(qa.info("Rendering survey "+s.id+" with delay of "+(null==(t=s.appearance)?void 0:t.surveyPopupDelaySeconds)+" seconds"),null==(e=this._surveyManager)||e.renderSurvey(s,n,i),qa.info("Survey "+s.id+" rendered"))}),1e3*s.appearance.surveyPopupDelaySeconds);this.Ql.add(o)}else this._surveyManager.renderSurvey(s,n,i);else qa.warn("Survey element not found")}else qa.warn("Surveys of type "+s.type+" cannot be rendered in the app");else qa.warn("Survey not found")}}displaySurvey(t,e){var r;if(fe(this._surveyManager))qa.warn("init was not called");else{var s=this.ou(t);if(s){var n=s;if(null!=(r=s.appearance)&&r.surveyPopupDelaySeconds&&e.ignoreDelay&&(n=i({},s,{appearance:i({},s.appearance,{surveyPopupDelaySeconds:0})})),e.displayType!==yo.Popover&&e.initialResponses&&qa.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===e.ignoreConditions){var o=this.lu(s);if(!o.eligible)return void qa.warn("Survey is not eligible to be displayed: ",o.reason)}e.displayType!==yo.Inline?this._surveyManager.handlePopoverSurvey(n,e):this.renderSurvey(n,e.selector,e.properties)}else qa.warn("Survey not found")}}cancelPendingSurvey(t){fe(this._surveyManager)?qa.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||null==t.handlePageUnload||t.handlePageUnload()}}function Xl(t,e,i){if(fe(t))return!1;switch(i){case"exact":return t===e;case"contains":var r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(t);case"regex":try{return new RegExp(e).test(t)}catch(t){return!1}default:return!1}}class Zl{constructor(t){this.hu=new Set,this.du=new Set,this.vu=new Ta,this.cu=(t,e)=>this.fu(t,e)&&this.pu(t,e)&&this.gu(t,e)&&this.mu(t,e),this.fu=(t,e)=>null==e||!e.event||(null==t?void 0:t.event)===(null==e?void 0:e.event),this._instance=t}init(){var t,e;ue(null==(t=this._instance)?void 0:t._addCaptureHook)||(this.yu=null==(e=this._instance)?void 0:e._addCaptureHook(((t,e)=>{this.on(t,e)})))}dispose(){var t;null==(t=this.yu)||t.call(this),this.yu=void 0,this.vu=new Ta}register(t){var e,i;if(!ue(null==(e=this._instance)?void 0:e._addCaptureHook)&&(t.forEach((t=>{var e;this.hu.add(t),null==(e=t.steps)||e.forEach((t=>{this.du.add((null==t?void 0:t.event)||"")}))})),null!=(i=this._instance)&&i.autocapture)){var r=new Set;this.hu.forEach((t=>{var e;null==(e=t.steps)||e.forEach((t=>{null!=t&&t.selector&&r.add(t.selector)}))})),this._instance.autocapture.setElementSelectors(r)}}replace(t){this.hu.clear(),this.du.clear(),this.register(t)}on(t,e){null!=e&&0!=t.length&&(this.du.has(t)||this.du.has(e.event))&&this.hu.forEach((t=>{this.bu(e,t)&&this.vu.emit("actionCaptured",t.name)}))}_u(t){this.onAction("actionCaptured",(e=>t(e)))}bu(t,e){if(null==(null==e?void 0:e.steps))return!1;for(var i of e.steps)if(this.cu(t,i))return!0;return!1}onAction(t,e){return this.vu.on(t,e)}pu(t,e){if(null!=e&&e.url){var i,r=null==t||null==(i=t.properties)?void 0:i.$current_url;if(!r||"string"!=typeof r)return!1;if(!Xl(r,e.url,e.url_matching||"contains"))return!1}return!0}gu(t,e){return!!this.wu(t,e)&&!!this.ku(t,e)&&!!this.Su(t,e)}wu(t,e){var i;if(null==e||!e.href)return!0;var r=this.xu(t);if(r.length>0)return r.some((t=>Xl(t.href,e.href,e.href_matching||"exact")));var s,n=(null==t||null==(i=t.properties)?void 0:i.$elements_chain)||"";return!!n&&Xl((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",e.href,e.href_matching||"exact")}ku(t,e){var i;if(null==e||!e.text)return!0;var r=this.xu(t);if(r.length>0)return r.some((t=>Xl(t.text,e.text,e.text_matching||"exact")||Xl(t.$el_text,e.text,e.text_matching||"exact")));var s,n,o,a=(null==t||null==(i=t.properties)?void 0:i.$elements_chain)||"";return!!a&&(s=function(t){for(var e,i=[],r=/(?::|")text="(.*?)"/g;!fe(e=r.exec(t));)i.includes(e[1])||i.push(e[1]);return i}(a),n=e.text,o=e.text_matching||"exact",s.some((t=>Xl(t,n,o))))}Su(t,e){var i,r;if(null==e||!e.selector)return!0;var s=null==t||null==(i=t.properties)?void 0:i.$element_selectors;if(null!=s&&s.includes(e.selector))return!0;var n=(null==t||null==(r=t.properties)?void 0:r.$elements_chain)||"";if(e.selector_regex&&n)try{return new RegExp(e.selector_regex).test(n)}catch(t){return!1}return!1}xu(t){var e;return null==(null==t||null==(e=t.properties)?void 0:e.$elements)?[]:null==t?void 0:t.properties.$elements}mu(t,e){return null==e||!e.properties||0===e.properties.length||Da(e.properties.reduce(((t,e)=>{var i=oe(e.value)?e.value.map(String):null!=e.value?[String(e.value)]:[];return t[e.key]={values:i,operator:e.operator||"exact"},t}),{}),null==t?void 0:t.properties)}}class th{constructor(t){var e;this.Cu=[],this._instance=t,this.Tu=new Map,this.Mu=new Map,this.Eu=new Map,this.Iu=null==(e=this._instance)||null==e.onSessionId?void 0:e.onSessionId((t=>this.Ru(t)))}Pu(t){return!1}Au(){return null}Fu(t){}Ou(){}Lu(t,e){return!!t&&Da(t.propertyFilters,null==e?void 0:e.properties)}Du(t,e){var i=new Map;return t.forEach((t=>{var r;null==(r=t.conditions)||null==(r=r[e])||null==(r=r.values)||r.forEach((e=>{if(null!=e&&e.name){var r=i.get(e.name)||[];r.push(t.id),i.set(e.name,r)}}))})),i}$u(t,e,i){var r=(i===po.Activation?this.Tu:this.Mu).get(t),s=[];return this.Nu((t=>{s=t.filter((t=>null==r?void 0:r.includes(t.id)))})),s.filter((r=>{var s,n=null==(s=r.conditions)||null==(s=s[i])||null==(s=s.values)?void 0:s.find((e=>e.name===t));return this.Lu(n,e)}))}register(t){this.qu(t,!1)}replace(t){this.qu(t,!0)}qu(t,e){var i;ue(null==(i=this._instance)?void 0:i._addCaptureHook)||(this.ju(t,e),this.Bu(t,e))}Bu(t,e){var i=t.filter((t=>{var e;return null==(e=t.conditions)||null==(e=e.actions)||null==(e=e.values)?void 0:e.length}));if(e&&this.Eu.clear(),0!==i.length){this.Hu||(this.Hu=new Zl(this._instance),this.Hu.init(),this.Hu._u((t=>this.onAction(t))));var r=[];i.forEach((t=>{var e;null==(e=t.conditions)||null==(e=e.actions)||e.values.forEach((e=>{if(r.push(e),e.name){var i,s=null!==(i=this.Eu.get(e.name))&&void 0!==i?i:[];s.includes(t.id)||s.push(t.id),this.Eu.set(e.name,s)}}))})),e?this.Hu.replace(r):this.Hu.register(r)}else{var s;e&&(null==(s=this.Hu)||s.replace([]))}}zu(t,e){e.forEach(((e,i)=>{var r,s=null!==(r=t.get(i))&&void 0!==r?r:[];e.forEach((t=>{s.includes(t)||s.push(t)})),t.set(i,s)}))}ju(t,e){var i,r,s=t.filter((t=>{var e,i;return(null==(e=t.conditions)?void 0:e.events)&&(null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)?void 0:i.length)>0})),n=t.filter((t=>{var e,i;return(null==(e=t.conditions)?void 0:e.cancelEvents)&&(null==(i=t.conditions)||null==(i=i.cancelEvents)||null==(i=i.values)?void 0:i.length)>0})),o=this.Du(t,po.Activation),a=this.Du(t,po.Cancellation);e?(this.Tu=o,this.Mu=a):(this.zu(this.Tu,o),this.zu(this.Mu,a)),(0!==s.length||0!==n.length)&&(null!==(i=this.yu)&&void 0!==i||(this.yu=null==(r=this._instance)?void 0:r._addCaptureHook(((t,e)=>{this.onEvent(t,e)}))))}onEvent(t,e){var i,r,s=this.Uu(),n=(null==e||null==(i=e.properties)?void 0:i.$survey_id)||(null==e||null==(r=e.properties)?void 0:r.$product_tour_id);if(n&&this.getActivatedIds().includes(n)){var o=this.Wu(t,n);if("consume"===o)return s.info("event consumed activated item, removing it",{event:t,itemId:n}),void this.Vu([n]);if("persist"===o)return s.info("shown item promoted to persisted activation",{event:t,itemId:n}),this.Gu(n),void this.Zu([n])}if(this.Mu.has(t)){var a=this.$u(t,e,po.Cancellation);a.length>0&&(s.info("cancel event matched, cancelling items",{event:t,itemsToCancel:a.map((t=>t.id))}),this.Vu(a.map((t=>t.id))),a.forEach((t=>this.Qu(t.id))))}if(this.Tu.has(t)){s.info("event name matched",{event:t,eventPayload:e,items:this.Tu.get(t)});var l=this.$u(t,e,po.Activation);this.Ju(l.map((t=>t.id)))}}onAction(t){this.Eu.has(t)&&this.Ju(this.Eu.get(t)||[])}Ju(t){var e;if(0!==t.length){var i=!(null==(e=this._instance)||null==e.get_session_id||!e.get_session_id()),r=[];for(var s of t)i&&this.Pu(s)?this.Gu(s)&&this.Ku(s):r.push(s);r.length>0&&(this.Cu=[...new Set([...this.Cu,...r])]),this.Uu().info("updating activated items",{activatedItems:this.getActivatedIds()})}}Gu(t){this.Cu=this.Cu.filter((e=>e!==t));var e=this.Yu();return!e.includes(t)&&(this.Xu([...e,t]),this.th(),!0)}Vu(t){var e=new Set(t);this.Cu=this.Cu.filter((t=>!e.has(t)));var i=this.eh(),r=i.filter((t=>!e.has(t)));r.length!==i.length&&(this.Xu(r),0===r.length&&this.ih()),this.Zu(t)}rh(){var t,e=this.Au();if(!e)return{};var i=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[e];return i&&"object"==typeof i?i:{}}Ku(t){if(this.Au()){var e=this.rh();this.Fu(i({},e,{[t]:Date.now()}))}}Zu(t){if(this.Au()){var e=this.rh(),i={},r=!1;for(var s of Object.entries(e)){var n=s[0],o=s[1];t.includes(n)?r=!0:i[n]=o}r&&(he(i)?this.Ou():this.Fu(i))}}nh(){this.Au()&&this.Ou()}getActivationTimestamp(t){if(this.Yu().includes(t)){var e=this.rh()[t];return pe(e)?e:void 0}}eh(){var t,e=this.sh();return(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[e])||[]}Yu(){var t,e,i=this.eh();if(0===i.length)return[];var r=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[this.ah()],s=null==(e=this._instance)||null==e.get_session_id?void 0:e.get_session_id();return s&&r===s?i:[]}th(){var t,e=null==(t=this._instance)||null==t.get_session_id?void 0:t.get_session_id();e&&this.oh(e)}ih(){this.lh()}Ru(t){var e,i=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[this.ah()];if(i&&i!==t){var r=this.eh(),s=this.rh();r.length>0&&(this.Xu([]),r.filter((t=>pe(s[t]))).forEach((t=>this.Qu(t)))),this.ih(),this.nh()}}getActivatedIds(){return[...new Set([...this.Yu(),...this.Cu])].filter((t=>!this.uh(t)))}dispose(){var t,e,i;null==(t=this.Iu)||t.call(this),this.Iu=void 0,null==(e=this.yu)||e.call(this),this.yu=void 0,null==(i=this.Hu)||i.dispose(),this.Hu=void 0}reset(){this.Cu=[],this.eh().length>0&&this.Xu([]),this.ih(),this.nh()}getEventToItemsMap(){return this.Tu}hh(){return this.Hu}}class eh extends th{constructor(t){super(t)}sh(){return H}ah(){return V}Au(){return W}Fu(t){var e;null==(e=this._instance)||null==(e=e.persistence)||e.register({[W]:t})}Ou(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(W)}Pu(t){var e,i;this.Nu((e=>{i=e.find((e=>e.id===t))}));var r=null==(e=i)||null==(e=e.appearance)?void 0:e.surveyPopupDelaySeconds;return pe(r)&&r>0}dh(){return go.SHOWN}Nu(t){var e;null==(e=this._instance)||e.getSurveys(t)}Qu(t){var e;null==(e=this._instance)||e.cancelPendingSurvey(t)}Uu(){return qa}Xu(t){var e;null==(e=this._instance)||null==(e=e.persistence)||e.register({[H]:t})}oh(t){var e;null==(e=this._instance)||null==(e=e.persistence)||e.register({[V]:t})}lh(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(V)}uh(){return!1}Wu(t,e){var i;this.Nu((t=>{i=t.find((t=>t.id===e))}));var r=!i||function(t){var e;return Ia(t)&&!(null==(e=t.conditions)||null==(e=e.events)||!e.repeatedActivation)||"always"===t.schedule}(i);return r?t===go.SHOWN?"consume":"ignore":t===go.SHOWN?"persist":t===go.DISMISSED||t===go.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}class ih{constructor(t){this._instance=t}initialize(){}get(t){if("string"==typeof t)return this._instance.get_property(t);var e={};for(var i of t){var r=this._instance.get_property(i);ue(r)||(e[i]=r)}return e}set(t,e){this._instance.register("string"==typeof t?{[t]:e}:t)}remove(t){"string"!=typeof t?t.forEach((t=>this._instance.unregister(t))):this._instance.unregister(t)}}class rh{constructor(t){this._instance=t}get(){var t=this._instance.config;return{disableSurveys:t.disable_surveys,cookielessMode:!!t.cookieless_mode,advancedEnableSurveys:t.advanced_enable_surveys,requestTimeoutMs:t.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}getExtensions(){var t=null==Ft?void 0:Ft.__PosthogExtensions__;if(t){var e=t.generateSurveys,i=t.loadExternalDependency;return{generateSurveys:e?t=>e(this._instance,t):void 0,loadExternalDependency:i?t=>i(this._instance,"surveys",t):void 0}}}createEventReceiver(){return new eh(this._instance)}}var sh=null!=xt&&xt.location?zn(xt.location.hash,"__posthog")||zn(location.hash,"state"):null,nh="_postHogToolbarParams",oh=Jr("[Toolbar]"),ah=Jr("[FeatureFlags]");class lh{constructor(t,e){void 0===e&&(e=!1),this.fh=!1,this.update(t,e)}update(t,e){this.ph=((t,e)=>{var i,r,s,n,o;return{bootstrap:{featureFlags:null==(i=t.bootstrap)?void 0:i.featureFlags,featureFlagPayloads:null==(r=t.bootstrap)?void 0:r.featureFlagPayloads},remoteRequestsDisabled:e,featureFlagsDisabled:!!t.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!t.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!t.advanced_feature_flags_dedup_per_session,cacheTtlMs:t.feature_flag_cache_ttl_ms,refreshIntervalMs:null!==(s=t.remote_config_refresh_interval_ms)&&void 0!==s?s:3e5,requestTimeoutMs:t.feature_flag_request_timeout_ms,compression:t.disable_compression?void 0:"best-available",evaluationContexts:null!==(n=null!==(o=t.evaluation_contexts)&&void 0!==o?o:t.evaluation_environments)&&void 0!==n?n:[],flagKeys:oe(t.flag_keys)?t.flag_keys:void 0}})(t,e),!t.evaluation_environments||t.evaluation_contexts||this.fh||(ah.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.fh=!0),ue(t.flag_keys)||oe(t.flag_keys)||ah.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.ph}}var hh=Jr("[FeatureFlags]"),uh=Jr("[FeatureFlags]",{debugEnabled:!0}),dh="\" failed. Feature flags didn't load in time.",vh="connection_error",ch=t=>{for(var e={},i=0;t.length>i;i++)e[t[i]]=!0;return e},fh=t=>{var e={};for(var i of Zr(t||{})){var r=i[1];r&&(e[i[0]]=r)}return e},ph=Jr("[Error tracking]"),_h=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:"],gh=["__firefox__","__gCrWeb"],mh="Refusing to render web experiment since the viewer is a likely bot",yh={icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>-1===e.toLowerCase().indexOf(t.toLowerCase()),regex:(t,e)=>Aa(e,t),not_regex:(t,e)=>!Aa(e,t),exact:(t,e)=>e===t,is_not:(t,e)=>e!==t};class bh{get nn(){return this._instance.config}constructor(t){var e=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),e.getWebExperiments((t=>{bh.gh("retrieved web experiments from the server"),e.mh=new Map,t.forEach((t=>{if(t.feature_flag_key){var i;e.mh&&(bh.gh("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(i=e.mh)||i.set(t.feature_flag_key,t));var r=e._instance.getFeatureFlag(t.feature_flag_key);de(r)&&t.variants[r]&&e.yh(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var n=t.variants[s];bh.bh(n,e._instance)&&e.yh(t.name,s,n.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((t=>{this.onFeatureFlags(t)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())bh.gh(mh);else if(!this.nn.disable_web_experiments){if(fe(this.mh))return this.mh=new Map,this.loadIfEnabled(),void this.previewWebExperiment();bh.gh("applying feature flags",t),t.forEach((t=>{var e;if(this.mh&&null!=(e=this.mh)&&e.has(t)){var i,r=this._instance.getFeatureFlag(t),s=null==(i=this.mh)?void 0:i.get(t);r&&null!=s&&s.variants[r]&&this.yh(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var t=bh.getWindowLocation();if(null!=t&&t.search){var e=jn(null==t?void 0:t.search,"__experiment_id"),i=jn(null==t?void 0:t.search,"__experiment_variant");e&&i&&(bh.gh("previewing web experiments "+e+" && "+i),this.getWebExperiments((t=>{this._h(parseInt(e),i,t)}),!1,!0))}}loadIfEnabled(){this.nn.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,e,i){if(this.nn.disable_web_experiments&&!i)return t([]);var r=this._instance.get_property("$web_experiments");if(r&&!e)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.nn.token),method:"GET",timestampMode:"query",callback:e=>t(200===e.statusCode&&e.json&&e.json.experiments||[])})}_h(t,e,i){var r=i.filter((e=>e.id===t));r&&r.length>0&&(bh.gh("Previewing web experiment ["+r[0].name+"] with variant ["+e+"]"),this.yh(r[0].name,e,r[0].variants[e].transforms))}static bh(t,e){return!fe(t.conditions)&&bh.wh(t,e)&&bh.kh(t)}static wh(t,e){var i;if(fe(t.conditions)||fe(null==(i=t.conditions)?void 0:i.url))return!0;var r=bh.getWindowLocation();if(r){var s,n,o,a=Ms(e,r.href);return null==(s=t.conditions)||!s.url||yh[null!==(n=null==(o=t.conditions)?void 0:o.urlMatchType)&&void 0!==n?n:"icontains"](t.conditions.url,a)}return!1}static getWindowLocation(){return null==xt?void 0:xt.location}static kh(t){var e;if(fe(t.conditions)||fe(null==(e=t.conditions)?void 0:e.utm))return!0;var i=Yn();if(i.utm_source){var r,s,n,o,a,l,h,u,d=null==(r=t.conditions)||null==(r=r.utm)||!r.utm_campaign||(null==(s=t.conditions)||null==(s=s.utm)?void 0:s.utm_campaign)==i.utm_campaign,v=null==(n=t.conditions)||null==(n=n.utm)||!n.utm_source||(null==(o=t.conditions)||null==(o=o.utm)?void 0:o.utm_source)==i.utm_source,c=null==(a=t.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=t.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==i.utm_medium,f=null==(h=t.conditions)||null==(h=h.utm)||!h.utm_term||(null==(u=t.conditions)||null==(u=u.utm)?void 0:u.utm_term)==i.utm_term;return d&&c&&f&&v}return!1}static gh(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];Kr.info("[WebExperiments] "+t,i)}yh(t,e,i){this._is_bot()?bh.gh(mh):"control"!==e?i.forEach((i=>{if(i.selector){var r;bh.gh("applying transform of variant "+e+" for experiment "+t+" ",i);var s=null==(r=document)?void 0:r.querySelectorAll(i.selector);null==s||s.forEach((t=>{var e=t;i.html&&(e.innerHTML=i.html),i.css&&e.setAttribute("style",i.css)}))}})):bh.gh("Control variants leave the page unmodified.")}_is_bot(){return St&&this._instance?Ca(St,this.nn.custom_blocked_useragents):void 0}}var wh=Jr("[Conversations]"),xh="Conversations not available yet.";function Eh(t,e){var i,r,s,n,o,a,l,h=null!==(i=null==t?void 0:t.flushIntervalMs)&&void 0!==i?i:3e3,u=null!==(r=null==t?void 0:t.maxBufferSize)&&void 0!==r?r:100,d=null!=e&&e.consoleCapture?void 0:null!==(s=null==t?void 0:t.maxLogsPerInterval)&&void 0!==s?s:1e3,v=ue(d)?Math.max(u,2048):Math.max(u,d),c=null==t?void 0:t.resourceAttributes;return{serviceName:null!==(n=null!==(o=null==c?void 0:c["service.name"])&&void 0!==o?o:null==t?void 0:t.serviceName)&&void 0!==n?n:null==e?void 0:e.serviceNameDefault,serviceVersion:null!==(a=null==c?void 0:c["service.version"])&&void 0!==a?a:null==t?void 0:t.serviceVersion,environment:null!==(l=null==c?void 0:c["deployment.environment"])&&void 0!==l?l:null==t?void 0:t.environment,resourceAttributes:c,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:h,maxBufferSize:u,maxQueueSize:v,maxBatchRecordsPerPost:100,rateCapWindowMs:h,maxLogsPerInterval:d,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}var Sh=["debug","log","warn","error","info"],kh="console",Th="__posthogHandledLogsRequestError",$h=(t,e)=>{var i=t instanceof Error?t:new Error(e);return i[Th]=!0,i},Ph=t=>!!t&&"object"==typeof t&&!0===t[Th],Rh={featureFlags:class{constructor(t){this.name="featureFlags",this.Sh=!1,this.featureFlagEventHandlers=[],this.I=hh,this.xh={},this.Ch={},this.Th=[],this.Mh=!1,this.Eh=!1,this.Ih=0,this.Rh=!1,this.Ph=!1,this.Ah=!1,this.Fh=!1,this.Oh=0,this.Ht=()=>{var t=this.Lh();this.Oh=0,t&&this.reloadFeatureFlags()},this.Dh=()=>{var t,e=this.$h;ue(e)||this.nn.remoteRequestsDisabled||!kt||"hidden"===kt.visibilityState||Date.now()-(null!==(t=this.Nh)&&void 0!==t?t:0)<e||(this.reloadFeatureFlags(),this.qh())},this.$t=()=>{"visible"===(null==kt?void 0:kt.visibilityState)&&this.Dh()},"get"in t?this.Ss=t:(this.jh=new lh(t.config,t.Da()),this.Ss=this.jh)}updateConfig(t,e){var i;null==(i=this.jh)||i.update(t,e),this.Ts&&this.Bh()}setup(t){return this.Yl=t,this.I=t.logger.createLogger("[FeatureFlags]"),Kl(t.kv.initialize(),(()=>{this.Yl===t&&(this.Yl=void 0,this.Ts=t,this.Hh(t))}))}Hh(t){if(this.Ts===t)return xt&&ns(xt,"online",this.Ht),this.Bh(),this.zh=t.registerDynamicEventProperties((()=>this.Uh()?this.xh:this.Ch)),this.Wh(),this.initialize()}Bh(){var t=this.nn.refreshIntervalMs,e=!this.nn.remoteRequestsDisabled&&kt&&!ue(t)&&t>0?t:void 0;e!==this.$h&&(this.Vh(),ue(e)||(this.$h=e,this.qh(),null!=kt&&kt.addEventListener&&ns(kt,_t,this.$t)))}qh(){ue(this.$h)||(ue(this.Gh)||clearInterval(this.Gh),this.Nh=Date.now(),this.Gh=setInterval(this.Dh,this.$h))}Vh(){ue(this.Gh)||(clearInterval(this.Gh),this.Gh=void 0,null==kt||null==kt.removeEventListener||kt.removeEventListener(_t,this.$t)),this.$h=void 0,this.Nh=void 0}destroy(){this.Zh()}dispose(){this.Zh()}Zh(){var t;this.Vh(),this.Ih++,this.Ph=!1,this.Yl=void 0,this.Ts&&(this.Qh(),null==(t=this.zh)||t.dispose(),this.zh=void 0,this.Th=[],null==xt||xt.removeEventListener("online",this.Ht),this.Ts=void 0)}get nn(){return this.Ss.get()}Jh(t){var e;return null==(e=this.Ts)?void 0:e.kv.get(t)}ei(t){this.Kh((()=>{var e;return null==(e=this.Ts)?void 0:e.kv.set(t)}))}ri(t){this.Kh((()=>{var e;return null==(e=this.Ts)?void 0:e.kv.remove(t)}))}Kh(t){try{t()}catch(t){this.I.error("Failed to update feature flag persistence",t)}}Wh(){var t={};for(var e of[O,F,M,N]){var r=this.Jh(e);ue(r)||(t[e]=r)}this.xh=t;var s=i({},t),n=this.Jh(C);if(n)for(var o of Object.entries(n))s["$feature/"+o[0]]=o[1];this.Ch=s}Uh(){var t=this.nn.cacheTtlMs;if(!t||0>=t)return!1;var e=this.Jh(Q);return"number"!=typeof e||Date.now()-e>t}Yh(){return!!this.Uh()&&(this.Fh||this.Eh||(this.Fh=!0,this.I.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Xh(){var t=this.nn.evaluationContexts;return null!=t&&t.length?t.filter((t=>{var e=t&&"string"==typeof t&&t.trim().length>0;return e||this.I.error("Invalid evaluation context found:",t,"Expected non-empty string"),e})):[]}td(){var t=this.nn.flagKeys;if(!ue(t))return t.filter((t=>{var e=t&&"string"==typeof t&&t.trim().length>0;return e||this.I.error("Invalid flag key found:",t,"Expected non-empty string"),e}))}initialize(){var t,e,i=this.nn,r=null!==(t=null==(e=i.bootstrap)?void 0:e.featureFlags)&&void 0!==t?t:{};if(Object.keys(r).length){var s,n,o=null!==(s=null==(n=i.bootstrap)?void 0:n.featureFlagPayloads)&&void 0!==s?s:{},a=Object.keys(r).filter((t=>!!r[t])).reduce(((t,e)=>(t[e]=r[e]||!1,t)),{}),l=Object.keys(o).filter((t=>a[t])).reduce(((t,e)=>(t[e]=o[e],t)),{});return this.ed({featureFlags:a,featureFlagPayloads:l})}}updateFlags(t,e,r){var s,n,o=null!=r&&r.merge&&null!==(s=this.Jh(C))&&void 0!==s?s:{},a=null!=r&&r.merge&&null!==(n=this.Jh(F))&&void 0!==n?n:{},l=i({},o,t),h=i({},a,e),u={};for(var d of Object.entries(l)){var v=d[0],c=d[1];u[v]={key:v,enabled:Dt(c),variant:Nt(c),reason:void 0,metadata:ue(null==h?void 0:h[v])?void 0:{id:0,version:void 0,description:void 0,payload:h[v]}}}this.ed({flags:u})}get hasLoadedFlags(){return this.Mh}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.Jh(A),e=this.Jh(N),r=this.Jh(L);if(!r&&!e)return t||{};var s=Xr({},t||{}),n=[...new Set([...Object.keys(r||{}),...Object.keys(e||{})])];for(var o of n){var a,l,h=s[o],u=null==e?void 0:e[o],d=ue(u)?null!==(a=null==h?void 0:h.enabled)&&void 0!==a&&a:!!u,v=ue(u)?null==h?void 0:h.variant:"string"==typeof u?u:void 0,c=null==r?void 0:r[o],f=i({},h,{enabled:d,variant:d?null!=v?v:null==h?void 0:h.variant:void 0});d!==(null==h?void 0:h.enabled)&&(f.original_enabled=null==h?void 0:h.enabled),v!==(null==h?void 0:h.variant)&&(f.original_variant=null==h?void 0:h.variant),c&&(f.metadata=i({},null==h?void 0:h.metadata,{payload:c,original_payload:null==h||null==(l=h.metadata)?void 0:l.payload})),s[o]=f}return this.Sh||(this.I.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:r,finalDetails:s}),this.Sh=!0),s}getAllFeatureFlags(){var t=this.getFlagVariants(),e=this.getFlagPayloads();return Object.keys(t).map((i=>{var r=t[i];return{key:i,enabled:Dt(r),variant:Nt(r),payload:Mt(e[i])}}))}getFlagVariants(){var t=this.Jh(C),e=this.Jh(N);if(!e)return t||{};for(var i=Xr({},t||{}),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.Sh||(this.I.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:i}),this.Sh=!0),i}getFlagPayloads(){var t=this.Jh(F),e=this.Jh(L);if(!e)return t||{};for(var i=Xr({},t||{}),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.Sh||(this.I.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:i}),this.Sh=!0),i}reloadFeatureFlags(){this.Rh||this.nn.featureFlagsDisabled||this.Lh()||this.rd||(this.Th.slice().forEach((t=>{try{t()}catch(t){this.I.error("Error while running feature flags reloading callback",t)}})),this.rd=setTimeout((()=>{this.nd()}),5))}Qh(){clearTimeout(this.rd),this.rd=void 0}onReloading(t){return this.Th.push(t),()=>{this.Th=this.Th.filter((e=>e!==t))}}ensureFlagsLoaded(){this.Mh||this.Eh||this.rd||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.Rh=t}resetFlagCallReported(){this.ri(K)}nd(t){this.Qh();var e=this.Ts;if(e&&!this.nn.remoteRequestsDisabled&&!this.Lh())if(this.Eh)this.Ph=!0;else{var r={token:e.projectToken,distinct_id:e.distinctId,groups:e.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:i({},e.initialPersonProperties,this.Jh(U)||{},{$lib:e.library.name,$lib_version:e.library.version}),group_properties:this.Jh(j),timezone:so()};ue(e.deviceId)||(r.$device_id=e.deviceId),(null!=t&&t.disableFlags||this.nn.featureFlagsDisabled)&&(r.disable_flags=!0);var s=this.Xh();s.length&&(r.evaluation_contexts=s);var n=this.td();ue(n)||(r.flag_keys=n);var o=this.nn.onlyEvaluateSurveyFeatureFlags,a="/flags/?v=2"+(o?"&only_evaluate_survey_feature_flags=true":""),l=this.Ih;this.Eh=!0;var h=()=>{this.Ph&&(this.Ph=!1,this.nd())},u=t=>{this.Eh=!1,l===this.Ih?(this.ei({[Y]:[vh]}),this.I.error("Feature flag request failed",t),h()):h()};try{e.sendRequest(a,{target:"flags",method:"POST",body:r,compression:this.nn.compression,sentAt:"body",timeoutMs:this.nn.requestTimeoutMs}).then((t=>{var e,i,s=null!==(e=t.json)&&void 0!==e?e:{},n=200!==t.statusCode;if(this.Eh=!1,l===this.Ih){if(this.sd(t.statusCode),n||this.Ph||(this.$anon_distinct_id=void 0),!r.disable_flags||this.Ph){this.Ah=!n;var a=[];t.error?a.push(t.error instanceof Error&&"AbortError"===t.error.name?"timeout":t.error instanceof Error?vh:"unknown_error"):200!==t.statusCode&&a.push("api_error_"+t.statusCode),s.errorsWhileComputingFlags&&a.push("errors_while_computing_flags");var u=!(null==(i=s.quotaLimited)||!i.includes("feature_flags"));u&&a.push("quota_limited"),this.ei({[Y]:a}),u?this.I.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):r.disable_flags||this.ed(s,n,{partialResponse:o}),h()}}else h()})).catch(u)}catch(t){u(t)}}}Lh(){return qn(this.Oh,3)}sd(t){this.Oh=Hn(t,this.Oh,3,(()=>this.I.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes.")))}getFeatureFlag(t,e){var i;if(void 0===e&&(e={}),!e.fresh||this.Ah)if(this.Mh||this.getFlags()&&this.getFlags().length>0){if(!this.Yh()){var r=this.getFeatureFlagResult(t,e);return null!==(i=null==r?void 0:r.variant)&&void 0!==i?i:null==r?void 0:r.enabled}}else this.I.warn('getFeatureFlag for key "'+t+dh)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var e=this.getFeatureFlagResult(t,{send_event:!1});return null==e?void 0:e.payload}getFeatureFlagResult(t,e){if(void 0===e&&(e={}),!e.fresh||this.Ah)if(this.Mh||this.getFlags()&&this.getFlags().length>0){if(!this.Yh()){var r,s=this.getFlagVariants(),n=t in s,o=s[t],a=this.getFlagPayloads()[t],l=String(o),h=this.Jh(M)||void 0,u=this.Jh(Q)||void 0,d=this.Jh(K)||{};if(this.nn.deduplicateCallsPerSession){var v,c=null==(v=this.Ts)?void 0:v.session.sessionId,f=this.Jh(J);c&&c!==f&&(d={},r=c)}if(e.send_event||!("send_event"in e))if(t in d&&d[t].includes(l))r&&this.ei({[K]:d,[J]:r});else{var p,_,g,m,y,b,w,x,E,S,k,T;oe(d[t])?d[t].push(l):d[t]=[l],this.ei(i({[K]:d},r?{[J]:r}:{}));var P=this.getFeatureFlagDetails(t),R=[...null!==(p=this.Jh(Y))&&void 0!==p?p:[]];ue(o)&&R.push("flag_missing");var C={$feature_flag:t,$feature_flag_response:o,$feature_flag_payload:null!=a?a:null,$feature_flag_request_id:h,$feature_flag_evaluated_at:u,$feature_flag_bootstrapped_response:null!==(_=null==(g=this.nn.bootstrap)||null==(g=g.featureFlags)?void 0:g[t])&&void 0!==_?_:null,$feature_flag_bootstrapped_payload:null!==(m=null==(y=this.nn.bootstrap)||null==(y=y.featureFlagPayloads)?void 0:y[t])&&void 0!==m?m:null,$used_bootstrap_value:!this.Ah};ue(null==P||null==(b=P.metadata)?void 0:b.has_experiment)||(C.$feature_flag_has_experiment=P.metadata.has_experiment),ue(null==P||null==(w=P.metadata)?void 0:w.version)||(C.$feature_flag_version=P.metadata.version);var O,I=null!==(x=null==P||null==(E=P.reason)?void 0:E.description)&&void 0!==x?x:null==P||null==(S=P.reason)?void 0:S.code;I&&(C.$feature_flag_reason=I),null!=P&&null!=(k=P.metadata)&&k.id&&(C.$feature_flag_id=P.metadata.id),ue(null==P?void 0:P.original_variant)&&ue(null==P?void 0:P.original_enabled)||(C.$feature_flag_original_response=ue(P.original_variant)?P.original_enabled:P.original_variant),null!=P&&null!=(T=P.metadata)&&T.original_payload&&(C.$feature_flag_original_payload=null==P||null==(O=P.metadata)?void 0:O.original_payload),R.length&&(C.$feature_flag_error=R.join(",")),this.ad(C)}else r&&this.ei({[K]:d,[J]:r});if(n)return{key:t,enabled:!!o,variant:"string"==typeof o?o:void 0,payload:Mt(a)}}}else this.I.warn('getFeatureFlagResult for key "'+t+dh)}ad(t){try{var e;null==(e=this.Ts)||e.capture("$feature_flag_called",t).catch((t=>{this.I.error("Failed to capture feature flag call",t)}))}catch(t){this.I.error("Failed to capture feature flag call",t)}}getRemoteConfigPayload(t,e){this.od(t,e)}od(t,i){var r=this;return e((function*(){var e=r.Ts;if(e){var s={distinct_id:e.distinctId,token:e.projectToken,person_properties:{$lib:e.library.name,$lib_version:e.library.version}},n=r.Xh();n.length&&(s.evaluation_contexts=n);var o,a=r.td();ue(a)||(s.flag_keys=a);try{var l,h=null==(l=(yield e.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:s,compression:r.nn.compression,sentAt:"body",timeoutMs:r.nn.requestTimeoutMs})).json)?void 0:l.featureFlagPayloads;o=(null==h?void 0:h[t])||void 0}catch(t){return void r.I.error("Remote config feature flag request failed",t)}try{i(o)}catch(t){r.I.error("Remote config feature flag callback failed",t)}}}))()}isFeatureEnabled(t,e){if(void 0===e&&(e={}),e.fresh&&!this.Ah)return e.defaultValue;if(!(this.Mh||this.getFlags()&&this.getFlags().length>0))return this.I.warn('isFeatureEnabled for key "'+t+dh),e.defaultValue;var i=this.getFeatureFlag(t,e);return ue(i)?e.defaultValue:!!i}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((e=>e!==t))}receivedFeatureFlags(t,e,i){this.ed(t,e,i)}ed(t,e,r){if(this.Ts){this.Mh=!0;var s=function(t,e,r,s,n,o){void 0===e&&(e={}),void 0===r&&(r={}),void 0===s&&(s={}),void 0===o&&(o=hh);var a=((t,e)=>{var r=t.flags;return r?i({},t,{featureFlags:Object.fromEntries(Object.keys(r).map((t=>{var e;return[t,null!==(e=r[t].variant)&&void 0!==e?e:r[t].enabled]}))),featureFlagPayloads:Object.fromEntries(Object.keys(r).filter((t=>r[t].enabled)).filter((t=>{var e;return null==(e=r[t].metadata)?void 0:e.payload})).map((t=>{var e;return[t,null==(e=r[t].metadata)?void 0:e.payload]})))}):(t.featureFlags&&e.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t)})(t,o),l=a.flags,h=a.featureFlags,u=a.featureFlagPayloads;if(h){var d=t.requestId,v=t.evaluatedAt;if(oe(h)){o.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var c={};if(h)for(var f=0;h.length>f;f++)c[h[f]]=!0;return{[O]:h,[C]:c,[D]:!1}}var p=h,_=u,g=l;if(null!=n&&n.partialResponse)p=i({},e,p),_=i({},r,_),g=i({},s,g);else if(t.errorsWhileComputingFlags)if(l){var m=new Set(Object.keys(l).filter((t=>{var e;return!(null!=(e=l[t])&&e.failed)})));p=i({},e,Object.fromEntries(Object.entries(p).filter((t=>m.has(t[0]))))),_=i({},r,Object.fromEntries(Object.entries(_||{}).filter((t=>m.has(t[0]))))),g=i({},s,Object.fromEntries(Object.entries(g||{}).filter((t=>m.has(t[0])))))}else p=i({},e,p),_=i({},r,_),g=i({},s,g);return i({[O]:Object.keys(fh(p)),[C]:p||{},[F]:_||{},[A]:g||{},[D]:!0===t.minimalFlagCalledEvents},d?{[M]:d}:{},v?{[Q]:v}:{})}}(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),r,this.I);s&&this.ei(s),e||(this.Fh=!1),this.ld(e)}}override(t,e){void 0===e&&(e=!1),this.I.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){this.ud(t)}ud(t){if(this.Ts){if(!1===t)return this.ri([N,L]),this.ld(),void uh.info("All overrides cleared");if(oe(t))return this.ei({[N]:ch(t)}),this.ld(),void uh.info("Flag overrides set",{flags:t});if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var e,i=t;this.Sh=Boolean(null!==(e=i.suppressWarning)&&void 0!==e&&e);var r={},s=i.flags,n=i.payloads;return s&&(r[N]=oe(s)?ch(s):s),n&&(r[L]=n),Object.keys(r).length&&this.ei(r),!1===s&&!1===n?this.ri([N,L]):!1===s?this.ri(N):!1===n&&this.ri(L),this.ld(),!1===s?uh.info("Flag overrides cleared"):s&&uh.info("Flag overrides set",{flags:s}),void(!1===n?uh.info("Payload overrides cleared"):n&&uh.info("Payload overrides set",{payloads:n}))}if(t&&"object"==typeof t)return this.ei({[N]:t}),this.ld(),void uh.info("Flag overrides set",{flags:t});this.I.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}else this.I.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.Mh){var e=this.hd(),i=e.flags,r=e.flagVariants;try{t(i,r)}catch(t){this.I.error("Error while running feature flags callback",t)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,r){var s=(this.Jh(I)||[]).find((e=>e.flagKey===t)),n={["$feature_enrollment/"+t]:e},o={$feature_flag:t,$feature_enrollment:e,$set:n};s&&(o.$early_access_feature_name=s.name),r&&(o.$feature_enrollment_stage=r);var a=i({},this.getFlagVariants(),{[t]:e});this.ei({[O]:Object.keys(fh(a)),[C]:a,[U]:i({},this.Jh(U)||{},n)}),this.ld();try{var l;null==(l=this.Ts)||l.capture("$feature_enrollment_update",o).catch((t=>{this.I.error("Failed to capture early access feature enrollment",t)}))}catch(t){this.I.error("Failed to capture early access feature enrollment",t)}}getEarlyAccessFeatures(t,e,i){void 0===e&&(e=!1);var r=this.Jh(I);!r||e?this.dd(t,i):t(r)}dd(t,i){var r=this;return e((function*(){var e=r.Ts;if(e){var s,n=i?"&"+i.map((t=>"stage="+t)).join("&"):"";try{var o=yield e.sendRequest("/api/early_access_features/?token="+e.projectToken+n,{target:"api",method:"GET",sentAt:"query"});if(!o.json)return;r.ei({[I]:s=o.json.earlyAccessFeatures})}catch(t){return void r.I.error("Early access feature request failed",t)}try{t(s)}catch(t){r.I.error("Early access feature callback failed",t)}}}))()}hd(){var t=this.getFlags(),e=this.getFlagVariants();return{flags:t.filter((t=>e[t])),flagVariants:Object.keys(e).filter((t=>e[t])).reduce(((t,i)=>(t[i]=e[i],t)),{})}}ld(t){this.Wh();var e=this.hd(),i=e.flags,r=e.flagVariants;this.featureFlagEventHandlers.forEach((e=>{try{e(i,r,{errorsLoading:t})}catch(t){this.I.error("Error while running feature flags callback",t)}}))}setPersonPropertiesForFlags(t,e){void 0===e&&(e=!0),this.vd(t,e)}vd(t,e){void 0===e&&(e=!0);var r=this.Jh(U)||{},s=(null==t?void 0:t.$set)||(null!=t&&t.$set_once?{}:t),n=null==t?void 0:t.$set_once,o={};if(n)for(var a in n)({}).hasOwnProperty.call(n,a)&&(a in r||(o[a]=n[a]));this.ei({[U]:i({},r,o,s)}),e&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,e){void 0===e&&(e=!0);var r=i({},this.Jh(U)||{});t.forEach((t=>{delete r[t]})),this.ei({[U]:r}),e&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t){void 0===t&&(t=!0),this.ri(U),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,e){void 0===e&&(e=!0);var r=this.Jh(j)||{},s=i({},r);for(var n of Object.keys(t))s[n]=i({},r[n],t[n]);this.ei({[j]:s}),e&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var e=this.Jh(j)||{};this.ei({[j]:i({},e,{[t]:{}})})}else this.ri(j)}reset(){this.Ih++,this.Ph=!1,this.xh={},this.Ch={},this.Mh=!1,this.Rh=!1,this.Ah=!1,this.$anon_distinct_id=void 0,this.Qh(),this.Sh=!1,this.Oh=0}}},Ch={sessionRecording:class{get nn(){return this._instance.config}get uo(){return this._instance.persistence}get started(){var t;return!(null==(t=this.fd)||!t.isStarted)}get status(){var t,e;return this.pd===Nl||this.pd===Ll?this.pd:null!==(t=null==(e=this.fd)?void 0:e.status)&&void 0!==t?t:this.pd}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.pd=Ml,this.gd=void 0,this.md=!1,this.Dt=(()=>{var t;if(null==kt||!kt.visibilityState||"visible"===kt.visibilityState)return!0;var e=null==xt||null==(t=xt.performance)||null==t.getEntriesByType?void 0:t.getEntriesByType("visibility-state");return!(null!=e&&e.length)||e.some((t=>"visible"===t.name))})(),this.$t=()=>{var t;"visible"===(null==kt?void 0:kt.visibilityState)&&(this.Dt=!0,null==(t=this.fd)||null==t.setDocumentWasEverVisible||t.setDocumentWasEverVisible(!0))},this._instance=t,!this._instance.sessionManager)throw jl.error("started without valid sessionManager"),new Error(Ul+" started without valid sessionManager. This is a bug.");if(this.nn.cookieless_mode===vt)throw new Error(Ul+' cannot be used with cookieless_mode="always"');null!=kt&&kt.addEventListener&&ns(kt,"visibilitychange",this.$t)}initialize(){this.startIfEnabledOrStop()}dispose(){this.md=!0,null==kt||null==kt.removeEventListener||kt.removeEventListener("visibilitychange",this.$t),this.stopRecording()}get yd(){var t,e=!(null==(t=this._instance.get_property(w))||!t.enabled),i=!this.nn.disable_session_recording,r=this.nn.disable_session_recording||this._instance.consent.isOptedOut();return xt&&e&&i&&!r}startIfEnabledOrStop(t){var e;if(!(this.md||this.yd&&null!=(e=this.fd)&&e.isStarted)){var i=!ue(Object.assign)&&!ue(Array.from);this.yd&&i?(this.bd(t),jl.info("starting")):(this.pd=Ml,this.stopRecording())}}bd(t){var e,i,r;this.yd&&(this.pd!==Nl&&this.pd!==Ll&&(this.pd=Dl),null!=Ft&&null!=(e=Ft.__PosthogExtensions__)&&null!=(e=e.rrweb)&&e.record&&null!=(i=Ft.__PosthogExtensions__)&&i.initSessionRecording?this._d(t):null==(r=Ft.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.wd,(e=>{if(e)return this._instance.register_for_session({[ht]:!0}),jl.error("could not load recorder",e);this._d(t)})))}stopRecording(){var t,e;null==(t=this.gd)||t.call(this),this.gd=void 0,null==(e=this.fd)||e.stop()}kd(){var t,e;null==(t=this.gd)||t.call(this),this.gd=void 0,null==(e=this.fd)||e.discard()}Sd(){var t,e;null==(t=this.uo)||t.unregister(R),null==(e=this.uo)||e.unregister(x)}xd(t,e){if(fe(t))return null;var i,r=pe(t)?t:parseFloat(t);return"number"!=typeof(i=r)||!Number.isFinite(i)||0>i||i>1?(jl.warn(e+" must be between 0 and 1. Ignoring invalid value:",t),null):r}Cd(t){if(this.uo){var e,r,s=this.uo,n=()=>{var e,r=!1===t.sessionRecording?void 0:t.sessionRecording,n=this.xd(null==(e=this.nn.session_recording)?void 0:e.sampleRate,"session_recording.sampleRate"),o=this.xd(null==r?void 0:r.sampleRate,"remote config sampleRate"),a=null!=n?n:o;fe(a)&&this.Sd();var l=null==r?void 0:r.minimumDurationMilliseconds;s.register({[w]:i({cache_timestamp:Date.now(),enabled:!!r},r,{networkPayloadCapture:i({capturePerformance:t.capturePerformance},null==r?void 0:r.networkPayloadCapture),canvasRecording:{enabled:null==r?void 0:r.recordCanvas,fps:null==r?void 0:r.canvasFps,quality:null==r?void 0:r.canvasQuality},sampleRate:a,minimumDurationMilliseconds:ue(l)?null:l,endpoint:null==r?void 0:r.endpoint,triggerMatchType:null==r?void 0:r.triggerMatchType,masking:null==r?void 0:r.masking,urlTriggers:null==r?void 0:r.urlTriggers,version:null==r?void 0:r.version,triggerGroups:null==r?void 0:r.triggerGroups})})};n(),null==(e=this.gd)||e.call(this),this.gd=null==(r=this._instance.sessionManager)?void 0:r.onSessionId(n)}}onRemoteConfig(t){var e=t.ok?t.config:void 0;return e&&"sessionRecording"in e?!1===e.sessionRecording?(this.Cd(e),void this.kd()):(this.Cd(e),void this.startIfEnabledOrStop()):(this.pd===Nl&&(this.pd=Ll,jl.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e){var i;void 0===e&&(e="log"),null!=(i=this.fd)&&i.log?this.fd.log(t,e):jl.warn("log called before recorder was ready")}get wd(){var t,e,i=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.get_property(w);return(null==i||null==(e=i.scriptConfig)?void 0:e.script)||"lazy-recorder"}Td(){var t,e=this._instance.get_property(w);if(!e)return!1;try{t="object"==typeof e?e:JSON.parse(e)}catch(t){return jl.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}return!fe(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}_d(t){var e,i,r;if(!this.md){if(null==(e=Ft.__PosthogExtensions__)||!e.initSessionRecording)return jl.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[ht]:!0});var s;if(this.fd||(this.fd=null==(s=Ft.__PosthogExtensions__)?void 0:s.initSessionRecording(this._instance,this.Dt),this.fd._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Td()){if(this.pd===Ll||this.pd===Nl)return;return this.pd=Nl,jl.info("persisted remote config is stale, requesting fresh config before starting"),void new ko(this._instance).load()}this.pd=Dl,null==(i=(r=this.fd).setDocumentWasEverVisible)||i.call(r,this.Dt),this.fd.start(t)}}onRRwebEmit(t){var e;null==(e=this.fd)||null==e.onRRwebEmit||e.onRRwebEmit(t)}overrideLinkedFlag(){var t,e;this.fd||null==(e=this.uo)||e.register({[S]:!0}),null==(t=this.fd)||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.fd||null==(e=this.uo)||e.register({[E]:!0}),null==(t=this.fd)||t.overrideSampling()}overrideTrigger(t){var e,i;this.fd||null==(i=this.uo)||i.register({["url"===t?k:T]:!0}),null==(e=this.fd)||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.fd)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var i;return!(null==(i=this.fd)||!i.tryAddCustomEvent(t,e))}}},Oh={autocapture:class extends El{constructor(t){super(new Sl(t)),this.instance=t}},historyAutocapture:class{constructor(t){this._instance=t,this.Md=this.Ed()}initialize(){this.startIfEnabled()}get isEnabled(){var t=this.Id();return!!(t.path||t.search||this.Rd(t))}startIfEnabled(){this.isEnabled&&(Kr.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.Md=this.Ed(),this.startIfEnabled()}stop(){this.Pd&&this.Pd(),this.Pd=void 0,this.Ad&&this.Ad(),this.Ad=void 0,Kr.info("History API monitoring stopped")}monitorHistoryChanges(){xt&&xt.history&&(this.Fd("pushState"),this.Fd("replaceState"),this.Od(),this.Rd()&&this.Ld())}Fd(t){var e;if(xt&&(null==(e=xt.history[t])||!e.__posthog_wrapped__)){var i=this;Pl(xt.history,t,(e=>function(r,s,n){e.call(this,r,s,n),i.Dd(t)}))}}Ed(){var t=null==xt?void 0:xt.location;if(null!=t&&t.pathname)return{pathname:t.pathname,search:t.search,hash:t.hash}}Id(){var t=this._instance.config.capture_pageview;return"history_change"===t?{path:!0}:le(t)?t:{}}Rd(t){return void 0===t&&(t=this.Id()),!!t.hash&&!this._instance.config.disable_capture_url_hashes}$d(t){var e=this.Id(),i=this.Md;return!(!i||!(e.path&&t.pathname!==i.pathname||e.search&&t.search!==i.search||this.Rd(e)&&t.hash!==i.hash))}Dd(t){try{var e=this.Ed();if(!e)return;this.$d(e)&&this._instance.capture(mt,{navigation_type:t}),this.Md=e}catch(e){Kr.error("Error capturing "+t+" pageview",e)}}Od(){if(!this.Pd){var t=()=>{this.Dd("popstate")};ns(xt,"popstate",t),this.Pd=()=>{xt&&xt.removeEventListener("popstate",t)}}}Ld(){if(!this.Ad){var t=()=>{this.Dd("hashchange")};ns(xt,"hashchange",t),this.Ad=()=>{xt&&xt.removeEventListener("hashchange",t)}}}},heatmaps:class{get nn(){return this.instance.config}constructor(t){var e;this.Nd=!1,this.ys=!1,this.qd=null,this.instance=t,this.Nd=!(null==(e=this.instance.persistence)||!e.props[v]),this.rageclicks=new gl(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return le(this.nn.capture_heatmaps)&&this.nn.capture_heatmaps.flush_interval_milliseconds&&(t=this.nn.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return fe(this.nn.capture_heatmaps)?fe(this.nn.enable_heatmaps)?this.Nd:this.nn.enable_heatmaps:!1!==this.nn.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.ys)return;Bl.info("starting..."),this.jd(),this.$t()}else{var t;clearInterval(null!==(t=this.qd)&&void 0!==t?t:void 0),this.Bd(),this.getAndClearBuffer()}}onRemoteConfig(t){if(t.ok){var e=t.config;if("heatmaps"in e){var i=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[v]:i}),this.Nd=i,this.startIfEnabled()}}}getAndClearBuffer(){var t=this.At;return this.At=void 0,t}Hd(t){zl(t.originalEvent)&&this.Hi(t.originalEvent,"deadclick")}$t(){this.qd&&clearInterval(this.qd),this.qd="visible"===(null==kt?void 0:kt.visibilityState)?setInterval(this.Ya.bind(this),this.flushIntervalMilliseconds):null}jd(){xt&&kt&&(this.zd=this.Ya.bind(this),ns(xt,gt,this.zd),this.Ud=t=>this.Hi(t||(null==xt?void 0:xt.event)),ns(kt,"click",this.Ud,{capture:!0}),this.Wd=t=>this.Vd(t||(null==xt?void 0:xt.event)),ns(kt,"mousemove",this.Wd,{capture:!0}),this.Gd=new Pn(this.instance,Tn,this.Hd.bind(this)),this.Gd.startIfEnabledOrStop(),this.Zd=this.$t.bind(this),ns(kt,_t,this.Zd),this.ys=!0)}Bd(){var t;xt&&kt&&(this.zd&&xt.removeEventListener(gt,this.zd),this.Ud&&kt.removeEventListener("click",this.Ud,{capture:!0}),this.Wd&&kt.removeEventListener("mousemove",this.Wd,{capture:!0}),this.Zd&&kt.removeEventListener(_t,this.Zd),clearTimeout(this.Qd),null==(t=this.Gd)||t.stop(),this.ys=!1)}Jd(t,e){var i=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),n=function(t,e,i){for(var r=t;r&&Bs(r)&&!zs(r,"body");){if(r===i)return!1;var s=void 0;try{var n,o,a;s=null==(n=null!==(o=null==(a=r.ownerDocument)?void 0:a.defaultView)&&void 0!==o?o:xt)?void 0:n.getComputedStyle(r).position}catch(t){return!1}if(Zt(e,s))return!0;r=tn(r)}return!1}(Qs(t),["fixed","sticky"],s);return{x:t.clientX+(n?0:r),y:t.clientY+(n?0:i),target_fixed:n,type:e}}Hi(t,e){var r;if(void 0===e&&(e="click"),!js(t.target)&&zl(t)){var s=this.Jd(t,e);null!=(r=this.rageclicks)&&r.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&ln(Qs(t),this.instance.config.rageclick)&&this.ss(i({},s,{type:"rageclick"})),this.ss(s)}}Vd(t){!js(t.target)&&zl(t)&&(clearTimeout(this.Qd),this.Qd=setTimeout((()=>{this.ss(this.Jd(t,"mousemove"))}),500))}ss(t){if(xt){var e=this.nn.disable_capture_url_hashes?Li(xt.location.href):xt.location.href,i=this.nn.custom_personal_data_properties,r=this.nn.mask_personal_data_properties?[...Wn,...i||[]]:[],s=Bn(e,r,Kn);this.At=this.At||{},this.At[s]||(this.At[s]=[]),this.At[s].push(t)}}Ya(){this.At&&!he(this.At)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Pn,webVitalsAutocapture:class{constructor(t){var e;this.Nd=!1,this.ys=!1,this.At={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Kd=()=>{clearTimeout(this.Yd),this.Yd=void 0,0!==this.At.metrics.length&&(this._instance.capture("$web_vitals",i({$current_url:this.At.url},this.At.metrics.reduce(((t,e)=>i({},t,{["$web_vitals_"+e.name+"_event"]:i({},e),["$web_vitals_"+e.name+"_value"]:e.value})),{}))),this.At={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Xd=t=>{var e;if(this.At=this.At||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},fe(null==t?void 0:t.name)||fe(null==t?void 0:t.value))Cl.error("Invalid metric received",t);else{var r="string"==typeof t.navigationURL?t.navigationURL:void 0,s=this.tv(r);if(!ue(s)){var n=pe(t.navigationId)||"string"==typeof t.navigationId?"navigation:"+t.navigationId:"url:"+s;if(!this.ev||this.ev>t.value){this.At.navigationKey!==n&&(this.Kd(),this.Yd=setTimeout(this.Kd,this.flushToCaptureTimeoutMs)),ue(this.At.navigationKey)&&(this.At.navigationKey=n,this.At.url=s),this.At.firstMetricTimestamp=ue(this.At.firstMetricTimestamp)?Date.now():this.At.firstMetricTimestamp;var o=null==(e=this._instance.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0),a=i({},t,r?{navigationURL:s}:{},{$current_url:s,timestamp:Date.now()});if(delete a.entries,le(t.attribution)&&this.attributionMetrics.indexOf(t.name)>-1){var l={};for(var h of Fl){var u="url"===h&&"string"==typeof t.attribution[h]?this.tv(t.attribution[h]):t.attribution[h];ue(u)||(l[h]=u)}a.attribution=l}else delete a.attribution;ue(o)||(a.$session_id=o.sessionId,a.$window_id=o.windowId),this.At.metrics.push(a),this.At.metrics.length===this.allowedMetrics.length&&this.Kd()}else Cl.error("Ignoring metric with value >= "+this.ev,t)}}},this.iv=()=>{if(!this.ys){var t,e,r,s,n=!1,o=Ft.__PosthogExtensions__,a=null==o?void 0:o.postHogWebVitalsCallbacksByFlavor,l=(null==a?void 0:a[this.rv])||("web-vitals"===this.rv&&ue(a)?null==o?void 0:o.postHogWebVitalsCallbacks:void 0);if(!ue(l)){var h=l.withoutAttribution,u=this.attributionMetrics;n=!ue(h),t=u.indexOf("LCP")>-1?l.onLCP:(null==h?void 0:h.onLCP)||l.onLCP,e=u.indexOf("CLS")>-1?l.onCLS:(null==h?void 0:h.onCLS)||l.onCLS,r=u.indexOf("FCP")>-1?l.onFCP:(null==h?void 0:h.onFCP)||l.onFCP,s=u.indexOf("INP")>-1?l.onINP:(null==h?void 0:h.onINP)||l.onINP}if(t&&e&&r&&s){var d={reportSoftNavs:this.useSoftNavs},v=n&&this.attributionMetrics.indexOf("INP")>-1?i({},d,{includeProcessedEventEntries:!1}):d;this.allowedMetrics.indexOf("LCP")>-1&&t(this.Xd.bind(this),d),this.allowedMetrics.indexOf("CLS")>-1&&e(this.Xd.bind(this),d),this.allowedMetrics.indexOf("FCP")>-1&&r(this.Xd.bind(this),d),this.allowedMetrics.indexOf("INP")>-1&&s(this.Xd.bind(this),v),this.ys=!0}else Cl.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.Nd=!(null==(e=this._instance.persistence)||!e.props[_]),this.startIfEnabled()}get nv(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e,i=le(this.nv)?null==(t=this.nv)?void 0:t.web_vitals_allowed_metrics:void 0;return fe(i)?(null==(e=this._instance.persistence)?void 0:e.props[b])||Il:i}get flushToCaptureTimeoutMs(){return(le(this.nv)?this.nv.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){var t=le(this.nv)?this.nv.web_vitals_attribution:void 0;return ge(t)?t?Il:[]:oe(t)?t:Al}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){var t=le(this.nv)?this.nv.__preview_web_vitals_soft_navs:void 0;return null!=t&&t}get ev(){var t=le(this.nv)&&pe(this.nv.__web_vitals_max_value)?this.nv.__web_vitals_max_value:Ol;return t>0&&6e4>=t?Ol:t}get isEnabled(){var t=null==Tt?void 0:Tt.protocol;if("http:"!==t&&"https:"!==t)return Cl.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=le(this.nv)?this.nv.web_vitals:ge(this.nv)?this.nv:void 0;return ge(e)?e:this.Nd}startIfEnabled(){this.isEnabled&&!this.ys&&(Cl.info("enabled, starting..."),this.js(this.iv))}onRemoteConfig(t){if(t.ok){var e=t.config;if("capturePerformance"in e){var i=le(e.capturePerformance)&&!!e.capturePerformance.web_vitals,r=le(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[_]:i}),this._instance.persistence.register({[b]:r})),this.Nd=i,this.startIfEnabled()}}}get rv(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}js(t){var e=Ft.__PosthogExtensions__,i=this.rv,r=null==e?void 0:e.postHogWebVitalsCallbacksByFlavor;null!=r&&r[i]||"web-vitals"===i&&ue(r)&&null!=e&&e.postHogWebVitalsCallbacks?t():null==e||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,i,(e=>{e?Cl.error("failed to load script",e):t()}))}tv(t){var e=t||(null==xt?void 0:xt.location.href);if(e){var i=this._instance.config.disable_capture_url_hashes?Li(e):e,r=this._instance.config.custom_personal_data_properties,s=this._instance.config.mask_personal_data_properties?[...Wn,...r||[]]:[];return Bn(i,s,Kn)}Cl.error("Could not determine current URL")}}},Ih={exceptionObserver:class{constructor(t){var e;this.iv=()=>{var t;if(xt&&this.isEnabled&&null!=(t=Ft.__PosthogExtensions__)&&t.errorWrappingFunctions){var e=Ft.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=Ft.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=Ft.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.sv&&this.nn.capture_unhandled_errors&&(this.sv=e(this.captureException.bind(this))),!this.av&&this.nn.capture_unhandled_rejections&&(this.av=i(this.captureException.bind(this))),!this.ov&&this.nn.capture_console_errors&&(this.ov=r(this.captureException.bind(this)))}catch(t){kl.error("failed to start",t),this.lv()}}},this._instance=t,this.uv=!(null==(e=this._instance.persistence)||!e.props[c]),this.de=new Ce(i({},function(t){var e,i,r,s;return void 0===t&&(t={}),{refillRate:null!==(e=null!==(i=t.exceptionRateLimiterRefillRate)&&void 0!==i?i:t.__exceptionRateLimiterRefillRate)&&void 0!==e?e:1,bucketSize:null!==(r=null!==(s=t.exceptionRateLimiterBucketSize)&&void 0!==s?s:t.__exceptionRateLimiterBucketSize)&&void 0!==r?r:10}}(this._instance.config.error_tracking),{refillInterval:1e4,I:kl})),this.nn=this.hv(),this.startIfEnabledOrStop()}hv(){var t=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return le(t)?e=i({},e,t):(ue(t)?this.uv:t)&&(e=i({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.nn.capture_console_errors||this.nn.capture_unhandled_errors||this.nn.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(kl.info("enabled"),this.lv(),this.js(this.iv)):this.lv()}js(t){var e,i;null!=(e=Ft.__PosthogExtensions__)&&e.errorWrappingFunctions?t():null==(i=Ft.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",(e=>{if(e)return kl.error("failed to load script",e);t()}))}lv(){var t,e,i;null==(t=this.sv)||t.call(this),this.sv=void 0,null==(e=this.av)||e.call(this),this.av=void 0,null==(i=this.ov)||i.call(this),this.ov=void 0}onRemoteConfig(t){if(t.ok){var e=t.config;"autocaptureExceptions"in e&&(this.uv=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[c]:this.uv}),this.nn=this.hv(),this.startIfEnabledOrStop())}}onConfigChange(){this.nn=this.hv()}captureException(t){var e,i,r,s=null!==(e=null==t||null==(i=t.$exception_list)||null==(i=i[0])?void 0:i.type)&&void 0!==e?e:"Exception";this.de.consumeRateLimit(s)?kl.info("Skipping exception capture because of client rate limiting.",{exception:s}):null==(r=this._instance.exceptions)||r.sendExceptionEvent(t)}},exceptions:class{constructor(t){var e,r;this.dv=[],this.vv=new gr([new Rr,new Ur,new Or,new Cr,new Nr,new Dr,new Ar,new Lr],function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),s=1;e>s;s++)r[s-1]=arguments[s];return function(e,s){void 0===s&&(s=0);for(var n=[],o=e.split("\n"),a=s;o.length>a;a++){var l=o[a];if(1024>=l.length){var h=Pr.test(l)?l.replace(Pr,"$1"):l;if(!h.match(/\S*Error: /)){for(var u of r){var d=u(h,t);if(d){n.push(d);break}}if(n.length>=50)break}}}return function(t){if(!t.length)return[];var e=Array.from(t);return e.reverse(),e.slice(0,50).map((t=>{return i({},t,{filename:t.filename||(r=e,r[r.length-1]||{}).filename,function:t.function||mr});var r}))}(n)}}("web:javascript",Sr,$r)),this._instance=t,this.dv=null!==(e=null==(r=this._instance.persistence)?void 0:r.get_property(f))&&void 0!==e?e:[],this.fv=Hr(this.pv()),this.gv=new Vr(this.fv)}onConfigChange(){this.fv=Hr(this.pv()),this.gv.setConfig(this.fv)}onRemoteConfig(t){var e,i,r;if(t.ok){var s=t.config;if("errorTracking"in s){var n=null!==(e=null==(i=s.errorTracking)?void 0:i.suppressionRules)&&void 0!==e?e:[],o=null==(r=s.errorTracking)?void 0:r.captureExtensionExceptions;this.dv=n,this._instance.persistence&&this._instance.persistence.register({[f]:this.dv,[p]:o})}}}get mv(){var t,e=!!this._instance.get_property(p),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=i?i:e)&&void 0!==t&&t}buildProperties(t,e){return this.vv.buildFromUnknown(t,{syntheticException:null==e?void 0:e.syntheticException,mechanism:{handled:null==e?void 0:e.handled}})}addExceptionStep(t,e){if(this.fv.enabled)try{if(!de(t)||0===t.trim().length)return void ph.warn("Ignoring exception step because message must be a non-empty string");var r=function(t){if(!t)return{sanitizedProperties:{},droppedKeys:[]};var e=[];return{sanitizedProperties:Object.keys(t).reduce(((i,r)=>zr.has(r)?(e.push(r),i):(i[r]=t[r],i)),{}),droppedKeys:e}}(this.yv(e)),s=r.sanitizedProperties,n=r.droppedKeys;n.length>0&&ph.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.gv.add(i({[jr]:t,[Br]:(new Date).toISOString()},s))}catch(t){ph.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{var e=t.$exception_list;if(this.bv(e)){if(this._v(e))return this.wv("Exception dropped: matched a suppression rule"),void ph.info("Skipping exception capture because a suppression rule matched");if(!this.mv&&this.Sv(e))return this.wv("Exception dropped: thrown by a browser extension"),void ph.info("Skipping exception capture because it was thrown by an extension");if(!this.mv&&this.xv(e))return this.wv("Exception dropped: thrown by an injected browser script"),void ph.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Cv(e))return this.wv("Exception dropped: thrown by the PostHog SDK"),void ph.info("Skipping exception capture because it was thrown by the PostHog SDK")}var i=this.fv.enabled&&fe(t.$exception_steps)?this.Tv(t):t,r="string"==typeof(n=globalThis._posthogReleaseId)&&n.length>0?n:void 0;r&&(i.$release_id=r);try{var s=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",Al:!0});return s&&this.gv.clear(),s}catch(t){return ph.error("Failed to capture exception event. Dropping this exception.",t),void this.gv.clear()}}catch(t){return void ph.error("Failed to process exception event. Ignoring this exception.",t)}var n}Tv(t){try{var e=this.gv.getAttachable();return 0===e.length?t:i({},t,{$exception_steps:e})}catch(e){return ph.error("Failed to read buffered exception steps. Capturing exception without steps.",e),t}}wv(t){this.fv.enabled&&this.gv.add({[jr]:t,[Br]:(new Date).toISOString()})}yv(t){return le(t)?i({},t):{}}pv(){var t,e;return null!==(t=null==(e=this._instance.config.error_tracking)?void 0:e.exception_steps)&&void 0!==t?t:{}}_v(t){if(0===t.length)return!1;try{var e=t.reduce(((t,e)=>{var i=e.type,r=e.value;return de(i)&&i.length>0&&t.$exception_types.push(i),de(r)&&r.length>0&&t.$exception_values.push(r),t}),{$exception_types:[],$exception_values:[]});return this.dv.some((t=>{var i=t.values.map((t=>{var i=Ma[t.operator],r=e[t.key];if(!i||!r)return!1;var s=oe(t.value)?t.value:[t.value];return s.length>0&&i(s,r)}));return"OR"===t.type?i.some(Boolean):i.every(Boolean)}))}catch(t){return ph.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}Sv(t){return t.flatMap((t=>{var e,i;return null!==(e=null==(i=t.stacktrace)?void 0:i.frames)&&void 0!==e?e:[]})).some((t=>{var e=t.filename;return!!e&&_h.some((t=>e.startsWith(t)))}))}xv(t){return t.some((t=>{var e=t.value;return de(e)&&gh.some((t=>e.includes(t)))}))}Cv(t){if(t.length>0){var e,i,r,s,n=null!==(e=null==(i=t[0].stacktrace)?void 0:i.frames)&&void 0!==e?e:[],o=n[n.length-1];return null!==(r=null==o||null==(s=o.filename)?void 0:s.includes("posthog.com/static"))&&void 0!==r&&r}return!1}bv(t){return!fe(t)&&oe(t)}}},Ah=i({productTours:class{get uo(){return this._instance.persistence}constructor(t){this.Mv=null,this.Ev=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(t.ok){var e=t.config;if("productTours"in e){var i,r;if(this.uo&&this.uo.register({[m]:!!e.productTours}),!Hl(this._instance))return!this.Mv&&fe(null==(i=this.uo)?void 0:i.props[G])||ql.info("product tours disabled; stopping and clearing cached tours"),null==(r=this.Mv)||r.stop(),this.Mv=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.Mv&&Hl(this._instance)&&this.js((()=>this.Iv()))}js(t){var e,i;null!=(e=Ft.__PosthogExtensions__)&&e.generateProductTours?t():null==(i=Ft.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"product-tours",(e=>{e?ql.error("Could not load product tours script",e):t()}))}Iv(){var t;!this.Mv&&null!=(t=Ft.__PosthogExtensions__)&&t.generateProductTours&&(this.Mv=Ft.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e){if(void 0===e&&(e=!1),!oe(this.Ev)||e){var i=this.uo;if(i){var r=i.props[G];if(oe(r)&&!e)return this.Ev=r,void t(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",timestampMode:"query",callback:e=>{if(Hl(this._instance)){var r=e.statusCode;if(200!==r||!e.json){var s="Product Tours API could not be loaded, status: "+r;return 0===r?e.error||ql.warn(s):ql.error(s),void t([],{isLoaded:!1,error:s})}var n=oe(e.json.product_tours)?e.json.product_tours:[];this.Ev=n,i&&i.register({[G]:n}),t(n,{isLoaded:!0})}else t([],{isLoaded:!0})}})}else t(this.Ev,{isLoaded:!0})}getActiveProductTours(t){fe(this.Mv)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.Mv.getActiveProductTours(t)}showProductTour(t){var e;null==(e=this.Mv)||e.showTourById(t)}previewTour(t){this.Mv?this.Mv.previewTour(t):this.js((()=>{var e;this.Iv(),null==(e=this.Mv)||e.previewTour(t)}))}dismissProductTour(){var t;null==(t=this.Mv)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.Mv)||t.nextStep()}previousStep(){var t;null==(t=this.Mv)||t.previousStep()}clearCache(){var t;this.Ev=null,null==(t=this.uo)||t.unregister(G)}resetTour(t){var e;null==(e=this.Mv)||e.resetTour(t)}resetAllTours(){var t;null==(t=this.Mv)||t.resetAllTours()}cancelPendingTour(t){var e;null==(e=this.Mv)||e.cancelPendingTour(t)}}},Rh),Fh={siteApps:class{constructor(t){this.Rv=0,this._instance=t,this.Pv=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Av(t,e){if(e){var i=this.globalsForEvent(e);this.Pv.push(i),this.Pv.length>1e3&&(this.Pv=this.Pv.slice(10))}}get siteAppLoaders(){var t;return null==(t=Ft._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.Av.bind(this));this.Fv=()=>{t(),this.Pv=[],this.Fv=void 0}}}globalsForEvent(t){var e,s,n,o,a,l,h;if(!t)throw new Error("Event payload is required");var u={},d=this._instance.get_property("$groups")||[],v=this._instance.get_property("$stored_group_properties")||{};for(var c of Object.entries(v)){var f=c[0];u[f]={id:d[f],type:f,properties:c[1]}}var p=t.$set_once,_=t.$set;return{event:i({},r(t,Vl),{properties:i({},t.properties,_?{$set:i({},null!==(e=null==(s=t.properties)?void 0:s.$set)&&void 0!==e?e:{},_)}:{},p?{$set_once:i({},null!==(n=null==(o=t.properties)?void 0:o.$set_once)&&void 0!==n?n:{},p)}:{}),elements_chain:null!==(a=null==(l=t.properties)?void 0:l.$elements_chain)&&void 0!==a?a:"",distinct_id:null==(h=t.properties)?void 0:h.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:u}}Ov(t){var e,i=null==(e=t.tagName)?void 0:e.toLowerCase();return"style"===i&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(t)||(Wl.error("prepare_external_dependency_stylesheet returned null"),null):"script"===i&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(t)||(Wl.error("prepare_external_dependency_script returned null"),null):t}Lv(){var t,e,i,r,s,n,o,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var l=null==kt?void 0:kt.defaultView,h=null==l||null==(t=l.Node)?void 0:t.prototype;if(!l||!h)return()=>{};if(this.Rv++,this.Dv)return this.$v();var u=[],d=this,v=new WeakSet,c=(t,e,i)=>{if(null!=t&&t[e]){var r=t[e];t[e]=i(r),u.push((()=>{t[e]=r}))}},f=t=>{if(v.has(t))return t;var e=d.Ov(t);return e&&v.add(e),e},p=t=>t.map((t=>"string"==typeof t?t:f(t))).filter((t=>!ce(t)));return c(h,"appendChild",(t=>function(e){var i=f(e);return i?t.call(this,i):e})),c(h,"insertBefore",(t=>function(e,i){var r=f(e);return r?t.call(this,r,i):e})),c(h,"replaceChild",(t=>function(e,i){var r=f(e);return r?t.call(this,r,i):i})),[null==(e=l.Element)?void 0:e.prototype,null==(i=l.Document)?void 0:i.prototype,null==(r=l.DocumentFragment)?void 0:r.prototype].forEach((t=>{c(t,"append",(t=>function(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,p(i))})),c(t,"prepend",(t=>function(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,p(i))}))})),[null==(s=l.Element)?void 0:s.prototype,null==(n=l.CharacterData)?void 0:n.prototype,null==(o=l.DocumentType)?void 0:o.prototype].forEach((t=>{c(t,"before",(t=>function(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,p(i))})),c(t,"after",(t=>function(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,p(i))})),c(t,"replaceWith",(t=>function(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];var s=p(i);return i.length&&!s.length?void 0:t.apply(this,s)}))})),c(null==(a=l.Element)?void 0:a.prototype,"insertAdjacentElement",(t=>function(e,i){var r=f(i);return r?t.call(this,e,r):null})),this.Dv=()=>{u.forEach((t=>t())),this.Dv=void 0},this.$v()}$v(){var t=!1;return()=>{var e;t||(t=!0,this.Rv--,0===this.Rv&&(null==(e=this.Dv)||e.call(this)))}}Nv(t,e){void 0===e&&(e=!0);var i=this.Lv();try{var r=t(i);return e&&i(),r}catch(t){throw i(),t}}setupSiteApp(t){var e=this.apps[t.id],i=()=>{var i;!e.errored&&this.Pv.length&&(Wl.info("Processing "+this.Pv.length+" events for site app with id "+t.id),this.Pv.forEach((t=>this.Nv((()=>null==e.processEvent?void 0:e.processEvent(t))))),e.processedBuffer=!0),Object.values(this.apps).every((t=>t.processedBuffer||t.errored))&&(null==(i=this.Fv)||i.call(this))},r=!1,s=s=>{e.errored=!s,e.loaded=!0,Wl.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&i()};try{var n=this.Nv((e=>t.init({posthog:this._instance,callback(t){e(),s(t)}})),!1).processEvent;n&&(e.processEvent=n),r=!0}catch(e){Wl.error(Gl+t.id,e),s(!1)}if(r&&e.loaded)try{i()}catch(i){Wl.error("Error while processing buffered events PostHog app with config id "+t.id,i),e.errored=!0}}qv(){var t=this.siteAppLoaders||[];for(var e of t)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(var i of t)this.setupSiteApp(i)}jv(t){var e=this;if(0!==Object.keys(this.apps).length){var i=this.globalsForEvent(t),r=function(r){try{e.Nv((()=>null==r.processEvent?void 0:r.processEvent(i)))}catch(e){Wl.error("Error while processing event "+t.event+" for site app "+r.id,e)}};for(var s of Object.values(this.apps))r(s)}}onRemoteConfig(t){var e,i,r,s=this;if(null!=(e=this.siteAppLoaders)&&e.length)return this.isEnabled?(this.qv(),void this._instance.on("eventCaptured",(t=>this.jv(t)))):void Wl.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this.Fv)||i.call(this),t.ok){var n=t.config;if(null!=(r=n.siteApps)&&r.length)if(this.isEnabled){var o=function(){var t,e=a.id,i=a.url;Ft["__$$ph_site_app_"+e]=s._instance,null==(t=Ft.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(s._instance,i,(t=>{if(t)return Wl.error(Gl+e,t)}))};for(var a of n.siteApps)o()}else Wl.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},Mh={tracingHeaders:class{constructor(t){this.Bv=void 0,this.Hv=void 0,this.zv=void 0,this.iv=()=>{var t,e,i=this.Uv();i?(ue(this.Bv)&&(this.Bv=null==(t=Ft.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchXHR(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),ue(this.Hv)&&(this.Hv=null==(e=Ft.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)?void 0:e._patchFetch(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.lv()},this._instance=t}initialize(){this.startIfEnabledOrStop()}js(t){var e,i;null!=(e=Ft.__PosthogExtensions__)&&e.tracingHeadersPatchFns?t():null==(i=Ft.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",(e=>{if(e)return Rl.error("failed to load script",e);t()}))}Wv(){var t,e;return null!==(t=null!==(e=this._instance.config.tracing_headers)&&void 0!==e?e:this._instance.config.addTracingHeaders)&&void 0!==t?t:this._instance.config.__add_tracing_headers}Uv(){var t=this.Wv();return oe(t)?(oe(this.zv)?this.zv.splice(0,this.zv.length,...t):this.zv=[...t],t.length>0?this.zv:void 0):(oe(this.zv)&&this.zv.splice(0),this.zv=t||void 0,this.zv)}lv(){var t,e;null==(t=this.Bv)||t.call(this),null==(e=this.Hv)||e.call(this),this.Bv=void 0,this.Hv=void 0}startIfEnabledOrStop(){this.Uv()?this.js(this.iv):this.lv()}}},Dh=i({surveys:class extends Ql{constructor(t){var e;super(new rh(t),{get projectToken(){return e.config.token},kv:new ih(e=t)}),this._instance=t}ru(t,e){var i=e.query?la(t,e.query):t;return new Promise((t=>{var r;this._instance._send_request({method:e.method,url:this._instance.requestRouter.endpointFor(null!==(r=e.target)&&void 0!==r?r:"api",i),data:e.body,headers:e.headers,timeout:e.timeoutMs,fireCallbackOnDrop:!0,transport:e.transport,compression:e.compression,timestampMode:e.sentAt,callback:t})}))}}},Rh),Nh={toolbar:class{constructor(t){this.instance=t}Vv(t){Ft.ph_toolbar_state=t}Gv(){var t;return null!==(t=Ft.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t,e,i){if(void 0===t&&(t=void 0),void 0===e&&(e=void 0),void 0===i&&(i=void 0),os(this.instance.config))return!1;if(!xt||!kt)return!1;t=null!=t?t:xt.location,i=null!=i?i:xt.history;try{if(!e){try{xt.localStorage.setItem("test","test"),xt.localStorage.removeItem("test")}catch(t){return!1}e=null==xt?void 0:xt.localStorage}var r,s=sh||zn(t.hash,"__posthog")||zn(t.hash,"state"),n=s?ts((()=>JSON.parse(atob(decodeURIComponent(s)))))||ts((()=>JSON.parse(decodeURIComponent(s)))):null;return n&&"ph_authorize"===n.action?((r=n).source="url",r&&Object.keys(r).length>0&&(n.desiredHash?t.hash=n.desiredHash:i?i.replaceState(i.state,"",t.pathname+t.search):t.hash="")):((r=JSON.parse(e.getItem(nh)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}Zv(t){var e=Ft.ph_load_toolbar||Ft.ph_load_editor;!fe(e)&&ae(e)?e(t,this.instance):oh.warn("No toolbar load function found")}loadToolbar(t){var e=!(null==kt||!kt.getElementById(Ds));if(!xt||e)return!1;var r="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=i({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(xt.localStorage.setItem(nh,JSON.stringify(i({},s,{source:void 0}))),2===this.Gv())this.Zv(s);else if(0===this.Gv()){var n;this.Vv(1),null==(n=Ft.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",(t=>{if(t)return oh.error("[Toolbar] Failed to load",t),void this.Vv(0);this.Vv(2),this.Zv(s)})),ns(xt,"turbolinks:load",(()=>{this.Vv(0),this.loadToolbar(s)}))}return!0}Qv(t){return this.loadToolbar(t)}maybeLoadEditor(t,e,i){return void 0===t&&(t=void 0),void 0===e&&(e=void 0),void 0===i&&(i=void 0),this.maybeLoadToolbar(t,e,i)}}},Lh=i({experiments:bh},Rh),Uh={conversations:class{constructor(t){this.Jv=void 0,this._conversationsManager=null,this.Kv=!1,this.Fe=null,this.Yv=!1,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations&&(this.Xv=t.ok,t.ok)){var e=t.config.conversations;fe(e)||(ge(e)?this.Jv=e:(this.Jv=e.enabled,this.Fe=e),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.Jv=void 0,this.Fe=null,this.Xv=void 0,this.Yv=!1}loadIfEnabled(){if(!(this._conversationsManager||this.Kv||this._instance.config.disable_conversations||os(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==Ft?void 0:Ft.__PosthogExtensions__;if(t&&!ue(this.Jv)&&this.Jv)if(this.Fe&&this.Fe.token){this.Kv=!0;try{var e=t.initConversations;if(e)return this.tc(e),void(this.Kv=!1);var i=t.loadExternalDependency;if(!i)return void this.ec(ut);i(this._instance,"conversations",(e=>{e||!t.initConversations?this.ec("Could not load conversations script",e):this.tc(t.initConversations),this.Kv=!1}))}catch(t){this.ec("Error initializing conversations",t),this.Kv=!1}}else wh.error("Conversations enabled but missing token in remote config.")}}tc(t){if(this.Fe)try{this._conversationsManager=t(this.Fe,this._instance),this.Yv=!1,wh.info("Conversations loaded successfully")}catch(t){this.ec("Error completing conversations initialization",t)}else wh.error("Cannot complete initialization: remote config is null")}ec(t,e){wh.error(t,e),this._conversationsManager=null,this.Kv=!1,this.Yv=!0}show(){this._conversationsManager?this._conversationsManager.show():wh.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Jv&&!ce(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":os(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.Xv?"remote_config_failed":ue(this.Jv)?this.Xv?"disabled_in_project":"remote_config_pending":this.Jv?fe(this.Fe)||!this.Fe.token?"missing_token":null!=Ft&&Ft.__PosthogExtensions__?this.Kv?"initializing":this.Yv?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var t,e;return null!==(t=null==(e=this._conversationsManager)?void 0:e.isVisible())&&void 0!==t&&t}sendMessage(t,i,r){var s=this;return e((function*(){return s._conversationsManager?s._conversationsManager.sendMessage(t,i,r):(wh.warn(xh),null)}))()}getMessages(t,i){var r=this;return e((function*(){return r._conversationsManager?r._conversationsManager.getMessages(t,i):(wh.warn(xh),null)}))()}markAsRead(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.markAsRead(t):(wh.warn(xh),null)}))()}getTickets(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.getTickets(t):(wh.warn(xh),null)}))()}requestRestoreLink(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(t):(wh.warn(xh),null)}))()}restoreFromToken(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(t):(wh.warn(xh),null)}))()}restoreFromUrlToken(){var t=this;return e((function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(wh.warn(xh),null)}))()}getCurrentTicketId(){var t,e;return null!==(t=null==(e=this._conversationsManager)?void 0:e.getCurrentTicketId())&&void 0!==t?t:null}getWidgetSessionId(){var t,e;return null!==(t=null==(e=this._conversationsManager)?void 0:e.getWidgetSessionId())&&void 0!==t?t:null}Bl(){var t;null==(t=this._conversationsManager)||t.setIdentity()}Hl(){var t;null==(t=this._conversationsManager)||t.clearIdentity()}}},jh={logs:class{constructor(t){var e,r=this;this.name="logs",this.ic=!1,this.rc=!1,this.nc=!1,this.I=Jr("[logs]"),this.sc=i({},this.I,{error(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];e.some(Ph)||r.I.error(...e)}}),this.ja=[],this.ac=[],this.Oh=0,this.ks=!1,this.oc=[],this.lc=[],this.uc=!1,this.hc=!1,this.dc=()=>{var t,e;this.ks||(this.Oh=0,null==(t=this.vc)||t.onReconnect(),null==(e=this.cc)||e.onReconnect())},this._instance=t,this._instance&&null!=(e=this._instance.config.logs)&&e.captureConsoleLogs&&(this.ic=!0),xt&&ns(xt,"online",this.dc)}fc(t,e,i,r){var s,n=Eh(null==(s=this._instance)||null==(s=s.config)?void 0:s.logs,i);return[new lr(this.gc(t,e),n,this.sc,(()=>this.mc()),(t=>t()),void 0,r),n]}yc(){var t,e=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.vc||this.bc!==e){var i;null==(i=this.vc)||i.reset(),this.bc=e;var r=this.fc((()=>this.ja),(t=>{this.ja=t}));this.vc=r[0],this._c=r[1]}return this.vc}wc(){var t,e=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.cc||this.kc!==e){var i;null==(i=this.cc)||i.reset(),this.kc=e;var r=this.fc((()=>this.ac),(t=>{this.ac=t}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},kh);this.cc=r[0],this.Sc=r[1]}return this.cc}setup(t){var e;if(!this.ks){this.Ts=t,null!=(e=this._instance)&&null!=(e=e.config)&&null!=(e=e.logs)&&e.captureConsoleLogs&&(this.ic=!0),(this.ic||this.xc()&&this.Cc())&&this.Tc();var i=!1,r=t.onRemoteConfig((t=>{var e;i=t.ok&&!0===(null==(e=t.config.logs)?void 0:e.captureConsoleLogs),this.onRemoteConfig(t)}));this.ks?r.dispose():(this.Ms=r,i||this.loadIfEnabled())}}dispose(){var t,e,i,r;this.ks||(this.ks=!0,this.Mc(),null==(t=this.Ms)||t.dispose(),this.Ms=void 0,this.Ts=void 0,this.nc=!1,null==xt||xt.removeEventListener("online",this.dc),null==(e=this.Ec)||e.call(this),this.Ec=void 0,null==(i=this.vc)||i.reset(),null==(r=this.cc)||r.reset())}onRemoteConfig(t){var e,i;if(!this.ks){var r=t.ok?null==(e=t.config.logs)?void 0:e.captureConsoleLogs:void 0;fe(r)?this.Ic():(null==(i=this._instance)||null==(i=i.persistence)||i.register({[y]:!!r}),r?(this.ic=!0,this.rc||this.Tc(),this.loadIfEnabled()):this.Ic())}}reset(){var t,e,i,r;this.Mc(),null==(t=this.vc)||t.clearQueue(),this.ja=[],null==(e=this.vc)||e.reset(),null==(i=this.cc)||i.clearQueue(),this.ac=[],null==(r=this.cc)||r.reset(),this.Oh=0}captureLog(t){this.ks||this.yc().captureLog(t)}captureConsoleLog(t){this.ks||this.wc().captureLog(t)}captureBufferedConsoleLog(t,e,i){this.ks||this.wc().captureLog(t,{context:e,occurredAtMs:i})}Cc(){var t;return!(null==(t=this._instance)||null==(t=t.persistence)||null==(t=t.props)||!t[y])}xc(){var t,e;return null==(t=this._instance)||null==t.Da||!t.Da()||!(null==(e=Ft._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])||!e.config)}Ul(){var t;this.Mc(),null==(t=this.cc)||t.clearQueue(),this.ac=[]}Ic(){this.ic||this.Mc()}Tc(){var t,e=this;if(!this.uc&&null!=Ft&&Ft.console){var i=Eh(null==(t=this._instance)||null==(t=t.config)?void 0:t.logs).maxBufferSize,r=function(t){var r;try{r=(t=>{for(;null!=(e=t)&&e.__rrweb_original__;){var e;t=t.__rrweb_original__}return t})(Ft.console[t])}catch(t){return 0}if(!r)return 0;e.lc.push(Pl(Ft.console,t,(s=>{var n=function(){for(var r=arguments.length,n=new Array(r),o=0;r>o;o++)n[o]=arguments[o];try{e.Rc(t,n,i)}catch(t){}return s.apply(Ft.console,n)};return n.__rrweb_original__=r,n})))};for(var s of Sh)r(s);this.uc=!0,this.Pc=setTimeout((()=>{this.Mc()}),3e4)}}Rc(t,e,i){var r;if(this.uc&&!this.hc&&0!==e.length)if(null!=(r=this._instance)&&r.is_capturing()){if(i>this.oc.length){this.hc=!0;try{this.oc.push({level:t,args:e,occurredAtMs:Date.now(),context:this.mc()})}finally{this.hc=!1}}}else this.Mc()}Mc(){if(this.oc=[],this.uc){for(var t of(this.uc=!1,this.Pc&&(clearTimeout(this.Pc),this.Pc=void 0),this.lc))t();this.lc=[]}}Ac(){var t=this.oc;return this.Mc(),t}get logger(){return this.Fc||(this.Fc={trace:(t,e)=>this.captureLog({body:t,level:"trace",attributes:e}),debug:(t,e)=>this.captureLog({body:t,level:"debug",attributes:e}),info:(t,e)=>this.captureLog({body:t,level:"info",attributes:e}),warn:(t,e)=>this.captureLog({body:t,level:"warn",attributes:e}),error:(t,e)=>this.captureLog({body:t,level:"error",attributes:e}),fatal:(t,e)=>this.captureLog({body:t,level:"fatal",attributes:e})}),this.Fc}flushLogs(t){t?this.Oc(t):(this.vc&&this.vc.flush().catch((t=>this.Lc(t))),this.cc&&this.cc.flush().catch((t=>this.Lc(t))))}Lc(t){Ph(t)||this.I.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(!this.ks&&this.ic&&!this.rc&&!this.nc){var t=null==Ft?void 0:Ft.__PosthogExtensions__;if(!t)return this.I.error("PostHog Extensions not found."),void this.Mc();var e=t.loadExternalDependency;if(!e)return this.I.error(ut),void this.Mc();this.nc=!0;try{e(this._instance,"logs",(e=>{if(this.nc=!1,!this.ks&&this.ic){var i=t.logs;if(e||null==i||!i.initializeLogs)this.I.error("Could not load logs script",e),this.Mc();else{var r,s,n=this.Ac();this.Ec=i.initializeLogs(null!==(r=this.Ts)&&void 0!==r?r:this._instance),this.rc=!0,n.length>0&&(null==i.replayConsoleBuffer||i.replayConsoleBuffer(null!==(s=this.Ts)&&void 0!==s?s:this._instance,n))}}}))}catch(t){throw this.nc=!1,t}}}gc(t,e){var i=this._instance;return{get isDisabled(){return!1},get optedOut(){return!i.is_capturing()},getPersistedProperty:e=>e===Ut.LogsQueue?t():void 0,setPersistedProperty(t,i){var r;t===Ut.LogsQueue&&e(null!==(r=i)&&void 0!==r?r:[])},Gn:t=>this.Gn(t),getLibraryId:()=>s.LIB_NAME,getLibraryVersion:()=>s.LIB_VERSION}}Gn(t){return new Promise((e=>{if(qn(this.Oh,3))e({kind:"fatal",error:$h(void 0,"logs endpoint is unreachable, dropping batch")});else{var i=!1,r=t=>{i||(i=!0,clearTimeout(s),e(t))},s=setTimeout((()=>{this.I.warn("Logs request timed out before receiving a response"),r({kind:"retry-later",error:$h(void 0,"logs request timed out")})}),9e4);this._instance._send_request({method:"POST",url:this.Dc(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:t=>{var e=t.statusCode;if(this.$c(e),e>=200&&300>e)r({kind:"ok"});else if(413===e)r({kind:"too-large"});else if(0!==e&&408!==e&&429!==e&&500>e)r({kind:"fatal",error:new Error("logs request failed with status "+e)});else{var i;0===e?(t.error||this.I.warn("Logs request failed before receiving an HTTP response"),r({kind:"retry-later",error:$h(t.error,"logs request failed before receiving an HTTP response")})):r({kind:"retry-later",error:null!==(i=t.error)&&void 0!==i?i:new Error("logs request failed with status "+e)})}}})}}))}$c(t){(0!==t||this._instance.__loaded)&&(this.Oh=Hn(t,this.Oh,3,(()=>this.I.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes."))))}Oc(t){this.ja.length>0&&this.Nc(t,this.ja,this._c,s.LIB_NAME,(t=>{this.ja=t})),this.ac.length>0&&this.Nc(t,this.ac,this.Sc,kh,(t=>{this.ac=t}))}Nc(t,e,i,r,n){if(0!==e.length){var o=e.map((t=>t.record));n([]);var a=ar(o,or(i,s.LIB_NAME,s.LIB_VERSION),r,s.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Dc(),data:a,compression:"best-available",batchKey:"logs",transport:t})}}Dc(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}mc(){var t,e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var i=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),r=i.windowId,s=i.sessionStartTimestamp,n=i.lastActivityTimestamp;e.sessionId=i.sessionId,e.windowId=r,fe(s)||(e.sessionStartTimestamp=s),fe(n)||(e.lastActivityTimestamp=n)}if(null!=Ft&&null!=(t=Ft.location)&&t.href&&(e.currentUrl=this._instance.config.disable_capture_url_hashes?Li(Ft.location.href):Ft.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(e.activeFeatureFlags=o)}return e}}},Bh={metrics:class{constructor(t){this.I=Jr("[metrics]"),this._instance=t}initialize(){}yc(){var t,e,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.metrics;return this.vc&&this.bc===i||(null==(e=this.vc)||e.reset(),this.bc=i,this.vc=new vr(this.gc(),function(t){var e,i,r,s,n,o=null==t?void 0:t.resourceAttributes;return{serviceName:null!==(e=null==o?void 0:o["service.name"])&&void 0!==e?e:null==t?void 0:t.serviceName,serviceVersion:null!==(i=null==o?void 0:o["service.version"])&&void 0!==i?i:null==t?void 0:t.serviceVersion,environment:null!==(r=null==o?void 0:o["deployment.environment"])&&void 0!==r?r:null==t?void 0:t.environment,resourceAttributes:o,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:null!==(s=null==t?void 0:t.flushIntervalMs)&&void 0!==s?s:1e4,maxSeriesPerFlush:null!==(n=null==t?void 0:t.maxSeriesPerFlush)&&void 0!==n?n:1e3}}(i),this.I)),this.vc}count(t,e,i){void 0===e&&(e=1),this.yc().count(t,e,i)}gauge(t,e,i){this.yc().gauge(t,e,i)}histogram(t,e,i){this.yc().histogram(t,e,i)}flush(t){if(!this.vc)return Promise.resolve();if(t){var e=this.vc.drainWindow();return e&&this.ds(e,t),Promise.resolve()}return this.vc.flush().catch((t=>this.I.error("PostHog metrics flush failed:",t)))}reset(){var t;null==(t=this.vc)||t.reset()}gc(){var t=this._instance,e=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},ds:t=>e.ds(t),getLibraryId:()=>s.LIB_NAME,getLibraryVersion:()=>s.LIB_VERSION}}ds(t,e){return new Promise((r=>{var s=!1,n=t=>{s||(s=!0,clearTimeout(o),r(t))},o=setTimeout((()=>n({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request(i({method:"POST",url:this.qc(),data:t,compression:"best-available",batchKey:"metrics"},e&&{transport:e},{fireCallbackOnDrop:!0,callback(t){var e=t.statusCode;if(e>=200&&300>e)n({kind:"ok"});else if(413===e)n({kind:"too-large"});else if(0!==e&&408!==e&&429!==e&&500>e)n({kind:"fatal",error:new Error("metrics request failed with status "+e)});else{var i;n({kind:"retry-later",error:null!==(i=t.error)&&void 0!==i?i:new Error("metrics request failed with status "+e)})}}}))}))}qc(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},zh=i({},Rh,Ch,Oh,Ih,Ah,Fh,Dh,Mh,Nh,Lh,Uh,jh,Bh);_l.__defaultExtensionClasses=i({},zh);var qh=Jr("[ExternalScriptsLoader]"),Hh=t=>{var e=null==kt?void 0:kt.querySelectorAll("script");if(e)for(var i=0;e.length>i;i++)if(e[i].src===t||e[i].getAttribute("src")===t)return e[i]},Vh=(t,e,i)=>{if(t.config.disable_external_dependency_loading)return qh.warn(e+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var r=Hh(e);if(r){if(r.__posthog_loading_callback_fired)return i();var s=r.__posthog_loading_error;return s?i(s):(r.addEventListener("load",(t=>{r.__posthog_loading_callback_fired=!0,i(void 0,t)})),void r.addEventListener("error",(t=>{r.__posthog_loading_error=t,i(t)})))}var n=()=>{if(!kt)return i("document not found");if(Hh(e))return Vh(t,e,i);var r=kt.createElement("script");if(r.type="text/javascript",r.crossOrigin="anonymous",r.src=e,r.onload=t=>{r.__posthog_loading_callback_fired=!0,i(void 0,t)},r.onerror=t=>{r.__posthog_loading_error=t,i(t)},t.config.prepare_external_dependency_script&&(r=t.config.prepare_external_dependency_script(r)),!r)return i("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)kt.head.appendChild(r);else{var s,n=kt.querySelectorAll("body > script");n.length>0?null==(s=n[0].parentNode)||s.insertBefore(r,n[0]):kt.body.appendChild(r)}};null!=kt&&kt.body?n():null==kt||kt.addEventListener("DOMContentLoaded",n)},Wh={},Gh=(t,e)=>{var i="/static/"+e+".js?v="+t.version;if("toolbar"===e){var r=3e5;i=i+"&t="+Math.floor(Date.now()/r)*r}return t.requestRouter.endpointFor("assets",i)};Ft.__PosthogExtensions__=Ft.__PosthogExtensions__||{},Ft.__PosthogExtensions__.loadExternalDependency=(t,e,i)=>{if("remote-config"!==e){var r=t.config.strict_script_versioning;if(r){var s=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+e+".js"),n=Wh[s];if("fallback"===r&&n){if(Hh(n))return void Vh(t,n,i);delete Wh[s]}Vh(t,s,"fallback"===r?(r,n)=>{if(r)if("string"==typeof r)i(r);else{var o,a=Gh(t,e);Wh[s]=a;var l=Hh(s);null==l||null==(o=l.parentNode)||o.removeChild(l),Vh(t,a,i)}else i(void 0,n)}:i)}else Vh(t,Gh(t,e),i)}else{var o=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");Vh(t,o,i)}},Ft.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{var r=t.requestRouter.endpointFor("api",e);Vh(t,r,i)};var Kh=function(){s.SDK_DIST_CHANNEL="npm";var t=el[hl]=new _l;return function(){function t(){t.done||(t.done=!0,ul=!1,Qr(el,(function(t){t._dom_loaded()})))}null!=kt&&kt.addEventListener?"complete"===kt.readyState?t():ns(kt,"DOMContentLoaded",t,{capture:!1}):xt&&Kr.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),t}();exports.Compression=fo,exports.DEFAULT_PRODUCT_TOUR_APPEARANCE={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},exports.DisplaySurveyType=yo,exports.PostHog=_l,exports.ProductTourEventName=bo,exports.ProductTourEventProperties=wo,exports.SurveyEventName=go,exports.SurveyEventProperties=mo,exports.SurveyEventType=po,exports.SurveyPosition={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"},exports.SurveyQuestionBranchingType={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},exports.SurveyQuestionType={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},exports.SurveySchedule={Once:"once",Recurring:"recurring",Always:"always"},exports.SurveyTabPosition={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},exports.SurveyType=_o,exports.SurveyWidgetType={Button:"button",Tab:"tab",Selector:"selector"},exports.default=Kh,exports.posthog=Kh,exports.severityLevels=["fatal","error","warning","log","info","debug"];
|
|
1
|
+
"use strict";function t(t,e,i,r,s,n,o){try{var a=t[n](o),l=a.value}catch(t){return void i(t)}a.done?e(l):Promise.resolve(l).then(r,s)}function e(e){return function(){var i=this,r=arguments;return new Promise((function(s,n){var o=e.apply(i,r);function a(e){t(o,s,n,a,l,"next",e)}function l(e){t(o,s,n,a,l,"throw",e)}a(void 0)}))}}function i(){return i=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var i=arguments[e];for(var r in i)({}).hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t},i.apply(null,arguments)}function r(t,e){if(null==t)return{};var i={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==e.indexOf(r))continue;i[r]=t[r]}return i}Object.defineProperty(exports,"__esModule",{value:!0});var s={DEBUG:!1,LIB_VERSION:"0.6.2",LIB_NAME:"browser-common"};s.DEBUG=!1,s.LIB_VERSION="1.422.4",s.LIB_NAME="web";var n="$people_distinct_id",o="distinct_id",a="$device_id",l="$device_model",h="__alias",u="__timers",d="$autocapture_disabled_server_side",v="$heatmaps_enabled_server_side",c="$exception_capture_enabled_server_side",f="$error_tracking_suppression_rules",p="$error_tracking_capture_extension_exceptions",_="$web_vitals_enabled_server_side",g="$dead_clicks_enabled_server_side",m="$product_tours_enabled_server_side",y="$logs_capture_enabled_server_side",b="$web_vitals_allowed_metrics",w="$session_recording_remote_config",x="$replay_sample_rate",E="$replay_override_sampling",S="$replay_override_linked_flag",k="$replay_override_url_trigger",T="$replay_override_event_trigger",P="$sesid",R="$session_is_sampled",C="$enabled_feature_flags",O="$active_feature_flags",I="$early_access_features",A="$feature_flag_details",F="$feature_flag_payloads",M="$feature_flag_request_id",D="$minimal_flag_called_events",N="$override_feature_flags",L="$override_feature_flag_payloads",U="$stored_person_properties",j="$stored_group_properties",B="$groups",z="$surveys",q="$surveys_loaded_at",H="$surveys_activated",V="$surveys_activated_session",W="$surveys_activated_timestamps",G="ph_product_tours",K="$flag_call_reported",J="$flag_call_reported_session_id",Y="$feature_flag_errors",Q="$feature_flag_evaluated_at",X="$user_state",Z="$client_session_props",tt="$capture_rate_limit",et="$initial_campaign_params",it="$initial_referrer_info",rt="$initial_person_info",st="$epp",nt="$posthog_cookieless",ot="$cookieless_mode",at="$sdk_debug_extensions_init_method",lt="$sdk_debug_extensions_init_time_ms",ht="$sdk_debug_recording_script_not_loaded",ut="PostHog loadExternalDependency extension not found.",dt="on_reject",vt="always",ct="anonymous",ft="identified",pt="identified_only",_t="visibilitychange",gt="beforeunload",mt="$pageview",yt="$pageleave",bt="$identify",wt="$groupidentify",xt="undefined"!=typeof window?window:void 0,Et="undefined"!=typeof globalThis?globalThis:xt,St=null==Et?void 0:Et.navigator,kt=null==Et?void 0:Et.document,Tt=null==Et?void 0:Et.location,$t=null==Et?void 0:Et.fetch,Pt=null!=Et&&Et.XMLHttpRequest&&"withCredentials"in new Et.XMLHttpRequest?Et.XMLHttpRequest:void 0,Rt=null==Et?void 0:Et.AbortController,Ct=null==Et?void 0:Et.CompressionStream,Ot=null==St?void 0:St.userAgent;function It(){return!(!xt||!1===xt.navigator.onLine)}var At="undefined"!=typeof globalThis?globalThis:xt;At&&"undefined"==typeof self&&(At.self=At),At&&"undefined"==typeof File&&(At.File=function(){});var Ft=null!=xt?xt:{},Mt=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(e){return t}};function Dt(t){return"string"==typeof t||t}function Nt(t){return"string"==typeof t?t:void 0}var Lt=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],Ut=function(t){return t.AnonymousId="anonymous_id",t.DistinctId="distinct_id",t.Props="props",t.EnablePersonProcessing="enable_person_processing",t.PersonMode="person_mode",t.FeatureFlagDetails="feature_flag_details",t.FeatureFlags="feature_flags",t.FeatureFlagPayloads="feature_flag_payloads",t.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",t.BootstrapFeatureFlags="bootstrap_feature_flags",t.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",t.OverrideFeatureFlags="override_feature_flags",t.Queue="queue",t.AiQueue="ai_queue",t.AiCaptureQueue="ai_capture_queue",t.LogsQueue="logs_queue",t.OptedOut="opted_out",t.SessionId="session_id",t.SessionStartTimestamp="session_start_timestamp",t.SessionLastTimestamp="session_timestamp",t.PersonProperties="person_properties",t.GroupProperties="group_properties",t.InstalledAppBuild="installed_app_build",t.InstalledAppVersion="installed_app_version",t.SessionReplay="session_replay",t.PushRegistered="push_registered",t.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",t.SurveyLastSeenDate="survey_last_seen_date",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t}({}),jt=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),Bt=["$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"],zt=["token"],qt=20,Ht=1e3,Vt=1e4,Wt="[Circular]",Gt="[Truncated]",Kt="[Unserializable]",Jt="[Function]";function Yt(t){for(var e="",i=0;t.length>i;i++){var r=t.charCodeAt(i);if(55296>r||r>56319)e+=56320>r||r>57343?t[i]:"�";else{var s=t.charCodeAt(i+1);56320>s||s>57343?e+="�":(e+=t[i]+t[i+1],i++)}}return e}var Qt=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterestbot","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],Xt=function(t,e){if(void 0===e&&(e=[]),!t)return!1;var i=t.toLowerCase();return Qt.concat(e).some((t=>{var e=t.toLowerCase();return-1!==i.indexOf(e)}))};function Zt(t,e){return-1!==t.indexOf(e)}var te=function(t){return t.trim()},ee=function(t){return t.replace(/^\$/,"")};function ie(t){var e,i=[];return null!==(e=JSON.stringify(t,(function(t,e){if("bigint"==typeof e)return e.toString();if("function"!=typeof e&&"symbol"!=typeof e){if(e instanceof Error)return{name:e.name,message:e.message,stack:e.stack};if(e&&"object"==typeof e){for(;i.length>0&&i[i.length-1]!==this;)i.pop();if(i.includes(e))return"[Circular]";i.push(e)}return e}})))&&void 0!==e?e:"null"}var re=Object.prototype,se=re.hasOwnProperty,ne=re.toString,oe=Array.isArray||function(t){return"[object Array]"===ne.call(t)},ae=t=>"function"==typeof t,le=t=>t===Object(t)&&!oe(t),he=t=>{if(le(t)){for(var e in t)if(se.call(t,e))return!1;return!0}return!1},ue=t=>void 0===t,de=t=>"[object String]"==ne.call(t),ve=t=>de(t)&&0===t.trim().length,ce=t=>null===t,fe=t=>ue(t)||ce(t),pe=t=>"[object Number]"==ne.call(t)&&t==t,_e=t=>pe(t)&&t>0,ge=t=>"[object Boolean]"===ne.call(t),me=t=>t instanceof FormData,ye=t=>Zt(Bt,t),be=t=>Zt(zt,t);function we(t){return null===t||"object"!=typeof t}function xe(t,e){return{}.toString.call(t)==="[object "+e+"]"}function Ee(t){switch({}.toString.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return ke(t,Error)}}function Se(t){return"undefined"!=typeof Event&&ke(t,Event)}function ke(t,e){try{return t instanceof e}catch(t){return!1}}var Te=[!0,"true",1,"1","yes"],$e=t=>Zt(Te,t),Pe=[!1,"false",0,"0","no"];function Re(t,e,i,r,s){return e>i&&(r.warn("min cannot be greater than max."),e=i),pe(t)?t>i?(r.warn(" cannot be greater than max: "+i+". Using max value instead."),i):e>t?(r.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(r.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+s),Re(s||i,e,i,r))}class Ce{constructor(t){this.k={},this.S=t.S,this.C=Re(t.bucketSize,0,100,t.I),this.R=Re(t.refillRate,0,this.C,t.I),this.A=Re(t.refillInterval,0,864e5,t.I)}O(t,e){var i=Math.floor((e-t.lastAccess)/this.A);i>0&&(t.tokens=Math.min(t.tokens+i*this.R,this.C),t.lastAccess=t.lastAccess+i*this.A)}consumeRateLimit(t){var e,i=Date.now(),r=String(t),s=this.k[r];return s?this.O(s,i):this.k[r]=s={tokens:this.C,lastAccess:i},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(e=this.S)||e.call(this,t)),0===s.tokens)}stop(){this.k={}}}var Oe="Mobile",Ie="iOS",Ae="Android",Fe="Tablet",Me=Ae+" "+Fe,De="iPad",Ne="Apple",Le=Ne+" Watch",Ue="Safari",je="BlackBerry",Be="Samsung",ze=Be+"Browser",qe=Be+" Internet",He="Chrome",Ve=He+" OS",We=He+" "+Ie,Ge="Internet Explorer",Ke=Ge+" "+Oe,Je="Opera",Ye=Je+" Mini",Qe="Edge",Xe="Microsoft "+Qe,Ze="Firefox",ti=Ze+" "+Ie,ei="Nintendo",ii="PlayStation",ri="Xbox",si=Ae+" "+Oe,ni=Oe+" "+Ue,oi="Windows",ai=oi+" Phone",li="Nokia",hi="Ouya",ui="Generic",di=ui+" "+Oe.toLowerCase(),vi=ui+" "+Fe.toLowerCase(),ci="Konqueror",fi="Oculus Browser",pi="Vivaldi",_i="Yandex",gi="Whale",mi="DuckDuckGo",yi="Pale Moon",bi="Waterfox",wi="Brave",xi="Google Search App",Ei="(\\d+(\\.\\d+)?)",Si=new RegExp("Version/"+Ei),ki=new RegExp(ri,"i"),Ti=new RegExp(ii+" \\w+","i"),$i=new RegExp(ei+" \\w+","i"),Pi=new RegExp(je+"|PlayBook|BB10","i"),Ri={"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"},Ci=function(t,e,i,r){e=e||"";var s=function(t){return null!=t&&t.brave?wi:null}(i);return s||(null!=r&&r.detectGoogleSearchApp&&Zt(t,"GSA/")?xi:Zt(t," OPR/")&&Zt(t,"Mini")?Ye:Zt(t," OPR/")?Je:Pi.test(t)?je:Zt(t,"IE"+Oe)||Zt(t,"WPDesktop")?Ke:Zt(t,"OculusBrowser")?fi:Zt(t,ze)?qe:Zt(t,Qe)||Zt(t,"Edg/")?Xe:Zt(t,pi+"/")?pi:Zt(t,"YaBrowser/")?_i:Zt(t,gi+"/")?gi:Zt(t,mi+"/")||Zt(t,"Ddg/")?mi:Zt(t,"FBIOS")?"Facebook "+Oe:Zt(t,"UCWEB")||Zt(t,"UCBrowser")?"UC Browser":Zt(t,"CriOS")?We:Zt(t,"CrMo")||Zt(t,He)?He:Zt(t,Ae)&&Zt(t,Ue)?si:Zt(t,"FxiOS")?ti:Zt(t.toLowerCase(),ci.toLowerCase())?ci:Zt(t,wi+"/")?wi:((t,e)=>e&&Zt(e,Ne)||function(t){return Zt(t,Ue)&&!Zt(t,He)&&!Zt(t,Ae)}(t))(t,e)?Zt(t,Oe)?ni:Ue:Zt(t,"PaleMoon/")?yi:Zt(t,bi+"/")?bi:Zt(t,Ze)?Ze:Zt(t,"MSIE")||Zt(t,"Trident/")?Ge:Zt(t,"Gecko")?Ze:"")},Oi={[Ke]:[new RegExp("rv:"+Ei)],[Xe]:[new RegExp(Qe+"?\\/"+Ei)],[He]:[new RegExp("("+He+"|CrMo)\\/"+Ei)],[We]:[new RegExp("CriOS\\/"+Ei)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Ei)],[Ue]:[Si],[ni]:[Si],[Je]:[new RegExp("(Opera|OPR)\\/"+Ei)],[Ze]:[new RegExp(Ze+"\\/"+Ei)],[ti]:[new RegExp("FxiOS\\/"+Ei)],[ci]:[new RegExp("Konqueror[:/]?"+Ei,"i")],[je]:[new RegExp(je+" "+Ei),Si],[si]:[new RegExp("android\\s"+Ei,"i")],[qe]:[new RegExp(ze+"\\/"+Ei)],[fi]:[new RegExp("OculusBrowser\\/"+Ei)],[pi]:[new RegExp(pi+"\\/"+Ei)],[_i]:[new RegExp("YaBrowser\\/"+Ei)],[gi]:[new RegExp(gi+"\\/"+Ei)],[wi]:[new RegExp(wi+"\\/"+Ei)],[mi]:[new RegExp("(DuckDuckGo|Ddg)\\/"+Ei)],[yi]:[new RegExp("PaleMoon\\/"+Ei)],[bi]:[new RegExp(bi+"\\/"+Ei)],[xi]:[new RegExp("GSA\\/"+Ei)],[Ge]:[new RegExp("(rv:|MSIE )"+Ei)],Mozilla:[new RegExp("rv:"+Ei)]},Ii=function(t,e,i,r){var s=Ci(t,e,i,r),n=Oi[s];if(ue(n))return null;for(var o=0;n.length>o;o++){var a=t.match(n[o]);if(a)return parseFloat(a[a.length-2])}return null},Ai=[[new RegExp(ri+"; "+ri+" (.*?)[);]","i"),t=>[ri,t&&t[1]||""]],[new RegExp(ei,"i"),[ei,""]],[new RegExp(ii,"i"),[ii,""]],[Pi,[je,""]],[new RegExp(oi,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[ai,""];if(new RegExp(Oe).test(e)&&!/IEMobile\b/.test(e))return[oi+" "+Oe,""];var i=/Windows NT ([0-9.]+)/i.exec(e);if(i&&i[1]){var r=Ri[i[1]]||"";return/arm/i.test(e)&&(r="RT"),[oi,r]}return[oi,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[Ie,[t[3],t[4],t[5]||"0"].join(".")]:[Ie,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=ue(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+Ae+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Ae+")","i"),t=>t&&t[2]?[Ae,[t[2],t[3],t[4]||"0"].join(".")]:[Ae,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var e=["Mac OS X",""];return t&&t[1]&&(e[1]=[t[1],t[2],t[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Ve,""]],[/Linux|debian/i,["Linux",""]]],Fi=function(t){return $i.test(t)?ei:Ti.test(t)?ii:ki.test(t)?ri:new RegExp(hi,"i").test(t)?hi:new RegExp("("+ai+"|WPDesktop)","i").test(t)?ai:/iPad/.test(t)?De:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?Le:Pi.test(t)?je:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(li,"i").test(t)?li:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(Oe).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?Ae:Me:new RegExp("(pda|"+Oe+")","i").test(t)?di:new RegExp(Fe,"i").test(t)&&!new RegExp(Fe+" pc","i").test(t)?vi:""},Mi=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Di(t,e){return"string"==typeof(i=t)&&Mi.test(i)?t:e();var i}function Ni(t,e){var i=new Error(e);try{Object.defineProperty(i,"name",{value:t,writable:!0,enumerable:!0,configurable:!0})}catch(t){}return i}function Li(t){return t?t.split("#")[0]:t}function Ui(t,e){var i=setTimeout(t,e);return(null==i?void 0:i.unref)&&(null==i||i.unref()),i}function ji(t,e,i){return Bi.apply(this,arguments)}function Bi(){return(Bi=e((function*(t,e,i){var r;try{return yield Promise.race([t,new Promise(((t,s)=>{r=Ui((()=>{try{null==i||i(),t()}catch(t){s(t)}}),e)}))])}finally{clearTimeout(r)}}))).apply(this,arguments)}var zi,qi="NativeGzipValidationError",Hi=t=>t.length>=2&&31===t[0]&&139===t[1],Vi=(t,e)=>t===jt.GZipJS||e===jt.GZipJS||"gzip"===e,Wi=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),Gi=t=>{throw Ni(qi,"Native gzip produced invalid output: "+t)},Ki=function(){var t=e((function*(t,e){18>t.size&&Gi("too-short");var i=new Uint8Array(yield t.slice(0,10).arrayBuffer());Hi(i)&&8===i[2]||Gi("invalid-header");var r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{for(var e=(()=>{if(zi)return zi;zi=[];for(var t=0;256>t;t++){for(var e=t,i=0;8>i;i++)e=1&e?3988292384^e>>>1:e>>>1;zi[t]=e>>>0}return zi})(),i=4294967295,r=0;t.length>r;r++)i=e[255&(i^t[r])]^i>>>8;return(4294967295^i)>>>0})(e)&&Gi("invalid-crc");var s=e.length>>>0;r.getUint32(4,!0)!==s&&Gi("invalid-size")}));return function(e,i){return t.apply(this,arguments)}}();function Ji(){return Ji=e((function*(t,i,r){void 0===i&&(i=!0);try{var s=(new TextEncoder).encode(t),n=new globalThis.CompressionStream("gzip"),o=n.writable.getWriter(),a=o.write(s).then((()=>o.close())).catch(function(){var t=e((function*(t){try{yield o.abort(t)}catch(t){}throw t}));return function(e){return t.apply(this,arguments)}}()),l=new Response(n.readable).blob(),h=(yield Promise.all([l,a]))[0];return yield Ki(h,s),h}catch(t){if(null!=r&&r.rethrow)throw t;return i&&console.error("Failed to gzip compress data",t),null}})),Ji.apply(this,arguments)}var Yi={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},Qi=Yi.info,Xi=0x8000000000000000,Zi={}.propertyIsEnumerable;function tr(t,e){try{return rr(t,e,{ancestors:new WeakSet,remainingNodes:Vt},0)}catch(t){return[]}}function er(t,e,i,r){if(0>=i.remainingNodes)return{stringValue:Gt};if(i.remainingNodes--,ge(t))return{boolValue:t};if("number"==typeof t){if(!Number.isFinite(t))return{stringValue:String(t)};if(Number.isInteger(t)){if(Number.isSafeInteger(t))return{intValue:String(t)};if("undefined"==typeof BigInt)return{stringValue:String(t)};var s=BigInt(t).toString();return t>=Xi||-Xi>t?(null==e||e.debug("Attribute "+s+" is outside the int64 range; encoding it as a string"),{stringValue:s}):{intValue:s}}return{doubleValue:t}}if("string"==typeof t)return{stringValue:Yt(t)};if("function"==typeof t)return{stringValue:Jt};if("symbol"==typeof t)return{stringValue:String(t)};if("object"==typeof t&&null!==t){if(i.ancestors.has(t))return{stringValue:Wt};if(r>=qt)return{stringValue:Gt};if(t instanceof Date){var n=t.getTime(),o=Number.isFinite(n)?t.toISOString():String(t);return{stringValue:"string"==typeof o?Yt(o):String(o)}}i.ancestors.add(t);try{try{var a=t.toJSON;if("function"==typeof a)return er(a.call(t),e,i,r+1)}catch(t){}return oe(t)?{arrayValue:{values:ir(t,e,i,r+1)}}:{kvlistValue:{values:rr(t,e,i,r+1)}}}finally{i.ancestors.delete(t)}}return{stringValue:Yt(String(t))}}function ir(t,e,i,r){for(var s=[],n=Math.min(t.length,Ht),o=0;n>o&&i.remainingNodes>0;o++)try{var a=o in t?t[o]:void 0;if(fe(a))continue;s.push(er(a,e,i,r))}catch(t){s.push({stringValue:Kt})}return t.length>o&&s.push({stringValue:Gt}),s}function rr(t,e,i,r){var s=[];for(var n in t)if(Zi.call(t,n)){if(s.length>=Ht||0>=i.remainingNodes){null==e||e.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{var o=t[n];if(ce(o)||ue(o))continue;s.push({key:Yt(n),value:er(o,e,i,r)})}catch(t){s.push({key:Yt(n),value:{stringValue:Kt}})}}return s}function sr(t){try{return Yt(String(t))}catch(t){return Kt}}function nr(t,e,r,s){var n,o=Yi[t.level||"info"]||Qi,a=o.text,l=o.number,h=(void 0===(n=pe(s)?s:void 0)&&(n=Date.now()),String(n)+"000000"),u={};e.distinctId&&(u.posthogDistinctId=e.distinctId),e.sessionId&&(u.sessionId=e.sessionId),e.windowId&&(u["window.id"]=e.windowId),fe(e.sessionStartTimestamp)||(u.sessionStartTimestamp=String(e.sessionStartTimestamp)),fe(e.lastActivityTimestamp)||(u.lastActivityTimestamp=String(e.lastActivityTimestamp)),e.currentUrl&&(u["url.full"]=e.currentUrl),e.screenName&&(u["screen.name"]=e.screenName),e.appState&&(u["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(u.feature_flags=e.activeFeatureFlags);var d=i({},u),v=t.attributes;if(v){var c=[];try{c=Object.keys(v)}catch(t){c=[]}for(var f of c){var p=void 0;try{p=v[f]}catch(t){p=Kt}Object.defineProperty(d,f,{value:p,enumerable:!0,writable:!0,configurable:!0})}}var _={timeUnixNano:h,observedTimeUnixNano:h,severityNumber:l,severityText:a,body:{stringValue:sr(t.body)},attributes:tr(d,r)};return t.trace_id&&(_.traceId=t.trace_id),t.span_id&&(_.spanId=t.span_id),ue(t.trace_flags)||(_.flags=t.trace_flags),_}function or(t,e,r){return i({},t.resourceAttributes,{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment},t.serviceVersion&&{"service.version":t.serviceVersion},{"telemetry.sdk.name":e,"telemetry.sdk.version":r})}function ar(t,e,i,r){return{resourceLogs:[{resource:{attributes:tr(e)},scopeLogs:[{scope:{name:i,version:r},logRecords:t}]}]}}let lr=class{constructor(t,e,i,r,s,n,o){var a;void 0===n&&(n=()=>Promise.resolve()),this._instance=t,this.vn=e,this.I=i,this.Pn=r,this.An=s,this.Fn=n,this.On=o,this.Ln=null,this.Dn=0,this.$n=0,this.Nn=0,this.qn=0,this.jn=0,this.Bn=!1,this.Hn=e.maxBufferSize,this.zn=Math.max(null!==(a=e.maxQueueSize)&&void 0!==a?a:e.maxBufferSize,e.maxBufferSize),this.Un=e.flushIntervalMs,this.Wn=e.maxBatchRecordsPerPost,this.Vn=e.rateCapWindowMs,this.Gn=e.maxLogsPerInterval}clearQueue(){this.$n++,this._instance.setPersistedProperty(Ut.LogsQueue,[])}reset(){this.Zn(),this.qn=0,this.jn=0,this.Bn=!1,this.Nn=0,this.Wn=this.vn.maxBatchRecordsPerPost}onReconnect(){this.Nn=0,this.Qn()}captureLog(t,e){var i;if(!this._instance.isDisabled&&!this._instance.optedOut&&null!=t&&t.body){var r=this.Jn(t);if(null!==r)if(r.body){if(this.Kn()){var s={record:nr(r,null!==(i=null==e?void 0:e.context)&&void 0!==i?i:this.Pn(),this.I,null==e?void 0:e.occurredAtMs)};this.An((()=>this.Yn(s)))}}else this.I.info("Log was rejected in beforeSend function")}}Jn(t){var e=this.vn.beforeSend;if(!e)return t;var i=oe(e)?e:[e],r=t;for(var s of i)try{var n=s(r);if(!n)return this.I.info("Log was rejected in beforeSend function"),null;r=n}catch(t){return this.I.error("Error in beforeSend function for log:",t),null}return r}Kn(){if(void 0===this.Gn)return!0;var t=Date.now(),e=t-this.qn;return this.Vn>e&&e>=0||(this.qn=t,this.jn=0,this.Bn=!1),this.Gn>this.jn?(this.jn++,!0):(this.Bn||(this.I.warn("captureLog dropping logs: exceeded "+this.Gn+" logs per "+this.Vn+"ms"),this.Bn=!0),!1)}flush(){var t=this;return e((function*(){if(!t._instance.isDisabled)return t.Ln||(t.Ln=t.Xn().finally((()=>{t.Ln=null}))),t.Ln}))()}Xn(){var t=this;return e((function*(){var e;t.Zn();var i=null!==(e=t._instance.getPersistedProperty(Ut.LogsQueue))&&void 0!==e?e:[];if(0!==i.length)for(var r=i.length,s=0;i.length>0&&r>s;){var n,o,a=t.$n;t.Dn=0;var l=Math.min(i.length,t.Wn),h=i.slice(0,l),u=ar(h.map((t=>t.record)),t.ts(),null!==(n=t.On)&&void 0!==n?n:t._instance.getLibraryId(),t._instance.getLibraryVersion()),d=yield t._instance.es(u);if(t.$n!==a)return;if("too-large"===d.kind&&h.length>1)t.Wn=Math.max(1,Math.floor(h.length/2)),t.I.warn("Received 413 when sending logs batch of size "+h.length+", reducing batch size to "+t.Wn);else{if("retry-later"===d.kind)throw d.error;if("too-large"===d.kind?t.I.warn("Dropping a single log record after 413 with batch size 1 — the record is larger than the server cap and cannot be split further."):"ok"===d.kind&&t.vn.maxBatchRecordsPerPost>t.Wn&&(t.Wn=Math.min(t.vn.maxBatchRecordsPerPost,t.Wn+1)),yield t.rs(h.length),i=null!==(o=t._instance.getPersistedProperty(Ut.LogsQueue))&&void 0!==o?o:[],s+=h.length,"fatal"===d.kind)throw d.error}}}))()}rs(t){var i=this;return e((function*(){var e,r=Math.max(0,t-i.Dn),s=null!==(e=i._instance.getPersistedProperty(Ut.LogsQueue))&&void 0!==e?e:[];i._instance.setPersistedProperty(Ut.LogsQueue,s.slice(r)),yield i.Fn()}))()}ts(){return or(this.vn,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Yn(t){var e;if(!this._instance.optedOut){var i=null!==(e=this._instance.getPersistedProperty(Ut.LogsQueue))&&void 0!==e?e:[];this.zn>i.length||(i.shift(),this.Dn++,this.I.info("Logs queue is full, dropping oldest record.")),i.push(t),this._instance.setPersistedProperty(Ut.LogsQueue,i),this.Hn>i.length?this.ns():this.Qn()}}ns(t){void 0===t&&(t=this.Un),this.ss||(this.ss=Ui((()=>{this.ss=void 0,this.Qn()}),t))}os(){var t=Math.min(Math.max(0,this.Nn-1),6);return this.Un*Math.pow(2,t)}ls(){var t=this._instance.getPersistedProperty(Ut.LogsQueue);return!!t&&t.length>0}shutdown(t){var i=this;return e((function*(){i.Zn();var e=i.flush().catch((()=>{}));void 0!==t?yield ji(e,t):yield e}))()}flushWithTimeout(t){var i=this;return e((function*(){var e=i.flush();yield ji(e,t,(()=>{e.catch((()=>{}))}))}))()}Qn(){this.flush().then((()=>{this.Nn=0}),(t=>{this.Nn++,this.I.error("PostHog logs flush failed:",t)})).finally((()=>{!this._instance.isDisabled&&this.ls()&&this.ns(this.os())}))}Zn(){this.ss&&(clearTimeout(this.ss),this.ss=void 0)}};var hr=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function ur(t){return String(t)+"000000"}function dr(t,e,i,r){var s="";return r&&(s=Object.keys(r).sort().map((t=>JSON.stringify(t)+":"+JSON.stringify(r[t]))).join(",")),t+"\0"+e+"\0"+(null!=i?i:"")+"\0"+s}let vr=class{constructor(t,e,i){this._instance=t,this.vn=e,this.I=i,this.us=new Map,this.Ln=null,this.hs=!1,this.ds=new Map,this.vs=new Set,this.cs=0}count(t,e,i){void 0===e&&(e=1),this.fs({name:t,type:"count",value:e,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}gauge(t,e,i){this.fs({name:t,type:"gauge",value:e,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}histogram(t,e,i){this.fs({name:t,type:"histogram",value:e,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}flush(){var t=this,i=this.Ln,r=function(){var r=e((function*(){i&&(yield i.catch((()=>{}))),yield t.ps()}));return function(){return r.apply(this,arguments)}}(),s=r().finally((()=>{this.Ln===s&&(this.Ln=null)}));return this.Ln=s,s}drainWindow(){if(0===this.us.size)return null;var t=this.us;return this.us=new Map,this.hs=!1,this.ds=new Map,this.vs=new Set,this.gs(t)}reset(){this.cs++,this.Zn(),this.us=new Map,this.Ln=null,this.hs=!1,this.ds=new Map,this.vs=new Set}fs(t){if(!this._instance.isDisabled&&!this._instance.optedOut){var e=this.Jn(t);if(null!==e)if(e.name&&"string"==typeof e.name)if("number"==typeof e.value&&Number.isFinite(e.value))if("count"===e.type&&0>e.value)this.I.warn("Dropping count '"+e.name+"': counters are monotonic, value must be >= 0");else{var r,s;try{r=e.attributes?i({},e.attributes):void 0,s=dr(e.type,e.name,e.unit,r)}catch(t){return void this.I.warn("Dropping metric '"+e.name+"': attributes could not be serialized",t)}var n=this.us.get(s);if(!n){if(!this.ys())return;n={name:e.name,type:e.type,unit:e.unit,attributes:r,windowStartMs:Date.now()},this.us.set(s,n)}var o=this.ds.get(e.name);void 0===o?this.ds.set(e.name,e.type):o===e.type||this.vs.has(e.name)||(this.vs.add(e.name),this.I.warn("Metric name '"+e.name+"' is already used as a "+o+"; recording it as a "+e.type+" too will blend both series in charts. Use a distinct name.")),this.bs(n,e.value),this.ns()}else this.I.warn("Dropping metric '"+e.name+"': value must be a finite number");else this.I.warn("Dropping metric with empty name")}}ys(){return this.vn.maxSeriesPerFlush>this.us.size||(this.hs||(this.hs=!0,this.I.warn("Metric series cap reached ("+this.vn.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}bs(t,e){var i;switch(t.type){case"count":t.total=(null!==(i=t.total)&&void 0!==i?i:0)+e;break;case"gauge":t.last=e;break;case"histogram":t.hist||(t.hist={count:0,sum:0,min:e,max:e,bucketCounts:new Array(hr.length+1).fill(0)});var r=t.hist;r.count+=1,r.sum+=e,r.min=Math.min(r.min,e),r.max=Math.max(r.max,e),r.bucketCounts[function(t,e){for(var i=0;e.length>i;i++)if(e[i]>=t)return i;return e.length}(e,hr)]+=1}}Jn(t){var e=this.vn.beforeSend;if(!e)return t;var i=oe(e)?e:[e],r=t;for(var s of i)try{var n=s(r);if(!n)return this.I.info("Metric was rejected in beforeSend function"),null;r=n}catch(t){return this.I.error("Error in beforeSend function for metric:",t),null}return r}ns(){this.ss||(this.ss=Ui((()=>{this.ss=void 0,this.flush().catch((t=>{this.I.error("Metrics flush failed:",t)}))}),this.vn.flushIntervalMs))}Zn(){this.ss&&(clearTimeout(this.ss),this.ss=void 0)}ps(){var t=this;return e((function*(){if(0!==t.us.size){var e=t.us;t.us=new Map,t.hs=!1,t.ds=new Map,t.vs=new Set;var i=t.cs,r=yield t._instance._s(t.gs(e));if(i===t.cs)switch(r.kind){case"ok":return;case"retry-later":return t.ws(e),void t.ns();case"too-large":return void t.I.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.I.error("Failed to send metrics batch:",r.error)}}}))()}gs(t){return e=this.ks(t),r=function(t,e,r){return i({},t.resourceAttributes,{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment},t.serviceVersion&&{"service.version":t.serviceVersion},{"telemetry.sdk.name":e,"telemetry.sdk.version":r})}(this.vn,this._instance.getLibraryId(),this._instance.getLibraryVersion()),s=this._instance.getLibraryId(),n=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:tr(r)},scopeMetrics:[{scope:{name:s,version:n},metrics:e}]}]};var e,r,s,n}ks(t){var e=ur(Date.now()),r=new Map;for(var s of t.values()){var n,o=dr(s.type,s.name,s.unit,void 0),a=r.get(o);a||(a=i({name:s.name},s.unit&&{unit:s.unit}),"count"===s.type?a.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===s.type?a.gauge={dataPoints:[]}:a.histogram={aggregationTemporality:1,dataPoints:[]},r.set(o,a));var l=tr(null!==(n=s.attributes)&&void 0!==n?n:{},this.I),h=ur(s.windowStartMs);if("count"===s.type){var u,d={attributes:l,startTimeUnixNano:h,timeUnixNano:e,asDouble:null!==(u=s.total)&&void 0!==u?u:0};a.sum.dataPoints.push(d)}else if("gauge"===s.type){var v,c={attributes:l,timeUnixNano:e,asDouble:null!==(v=s.last)&&void 0!==v?v:0};a.gauge.dataPoints.push(c)}else s.hist&&a.histogram.dataPoints.push({attributes:l,startTimeUnixNano:h,timeUnixNano:e,count:s.hist.count,sum:s.hist.sum,min:s.hist.min,max:s.hist.max,bucketCounts:s.hist.bucketCounts,explicitBounds:hr})}return Array.from(r.values())}ws(t){var e,i;for(var r of t){var s=r[0],n=r[1],o=this.us.get(s);if(o)switch(o.windowStartMs=Math.min(o.windowStartMs,n.windowStartMs),o.type){case"count":o.total=(null!==(e=o.total)&&void 0!==e?e:0)+(null!==(i=n.total)&&void 0!==i?i:0);break;case"gauge":break;case"histogram":if(n.hist)if(o.hist){o.hist.count+=n.hist.count,o.hist.sum+=n.hist.sum,o.hist.min=Math.min(o.hist.min,n.hist.min),o.hist.max=Math.max(o.hist.max,n.hist.max);for(var a=0;o.hist.bucketCounts.length>a;a++)o.hist.bucketCounts[a]+=n.hist.bucketCounts[a]}else o.hist=n.hist}else this.ys()&&this.us.set(s,n)}}};var cr,fr,pr;function _r(t){var e=globalThis._posthogChunkIds;if(e){var i=Object.keys(e);return pr&&i.length===fr||(fr=i.length,pr=i.reduce(((i,r)=>{cr||(cr={});var s=cr[r];if(s)i[s[0]]=s[1];else for(var n=t(r),o=n.length-1;o>=0;o--){var a=n[o],l=null==a?void 0:a.filename,h=e[r];if(l&&h){i[l]=h,cr[r]=[l,h];break}}return i}),{})),pr}}class gr{constructor(t,e,i){void 0===i&&(i=[]),this.coercers=t,this.stackParser=e,this.modifiers=i}buildFromUnknown(t,e){void 0===e&&(e={});var i=e&&e.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(i,e,0).apply(t),s=this.buildParsingContext(e),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,i),$exception_level:"error"}}modifyFrames(t){var i=this;return e((function*(){for(var e of t)e.stacktrace&&e.stacktrace.frames&&oe(e.stacktrace.frames)&&(e.stacktrace.frames=yield i.applyModifiers(e.stacktrace.frames));return t}))()}coerceFallback(t){var e;return{type:"Error",value:"Unknown error",stack:null==(e=t.syntheticException)?void 0:e.stack,synthetic:!0}}parseStacktrace(t,e){var r,s;return null!=t.cause&&(r=this.parseStacktrace(t.cause,e)),""!=t.stack&&null!=t.stack&&(s=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?e.skipFirstLines:0),e.chunkIdMap)),i({},t,{cause:r,stack:s})}applyChunkIds(t,e){return t.map((t=>(t.filename&&e&&(t.chunk_id=e[t.filename]),t)))}applyCoercers(t,e){for(var i of this.coercers)if(i.match(t))return i.coerce(t,e);return this.coerceFallback(e)}applyModifiers(t){var i=this;return e((function*(){var e=t;for(var r of i.modifiers)e=yield r(e);return e}))()}convertToExceptionList(t,e){var r,s,n,o={type:t.type,value:t.value,mechanism:{type:null!==(r=e.type)&&void 0!==r?r:"generic",handled:null===(s=e.handled)||void 0===s||s,synthetic:null!==(n=t.synthetic)&&void 0!==n&&n}};t.stack&&(o.stacktrace={type:"raw",frames:t.stack});var a=[o];return null!=t.cause&&a.push(...this.convertToExceptionList(t.cause,i({},e,{handled:!0}))),a}buildParsingContext(t){var e;return{chunkIdMap:_r(this.stackParser),skipFirstLines:null!==(e=t.skipFirstLines)&&void 0!==e?e:1}}buildCoercingContext(t,e,r){void 0===r&&(r=0);var s=(i,r)=>{if(4>=r){var s=this.buildCoercingContext(t,e,r);return this.applyCoercers(i,s)}};return i({},e,{syntheticException:0==r?e.syntheticException:void 0,mechanism:t,apply:t=>s(t,r),next:t=>s(t,r+1)})}}var mr="?";function yr(t,e,i,r,s){var n={platform:t,filename:e,function:"<anonymous>"===i?mr:i,in_app:!(null!=e&&e.startsWith("webkit-masked-url://"))&&"<anonymous>"!==e};return ue(r)||(n.lineno=r),ue(s)||(n.colno=s),n}var br=(t,e)=>{var i=-1!==t.indexOf("safari-extension"),r=-1!==t.indexOf("safari-web-extension");return i||r?[-1!==t.indexOf("@")?t.split("@")[0]:mr,i?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},wr=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,xr=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Er=/\((\S*)(?::(\d+))(?::(\d+))\)/,Sr=(t,e)=>{var i=wr.exec(t);if(i)return yr(e,i[1],mr,+i[2],+i[3]);var r=xr.exec(t);if(r){if(r[2]&&0===r[2].indexOf("eval")){var s=Er.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}var n=br(r[1]||mr,r[2]);return yr(e,n[1],n[0],r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},kr=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Tr=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,$r=(t,e)=>{var i=kr.exec(t);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var r=Tr.exec(i[3]);r&&(i[1]=i[1]||"eval",i[3]=r[1],i[4]=r[2],i[5]="")}var s=i[3],n=i[1]||mr,o=br(n,s);return yr(e,s=o[1],n=o[0],i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},Pr=/\(error: (.*)\)/;class Rr{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,e){var i=de(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:i?t.stack:void 0,cause:t.cause?e.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var e=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?e+": "+t.message:e}isDOMException(t){return xe(t,"DOMException")}isDOMError(t){return xe(t,"DOMError")}}class Cr{match(t){return Ee(t)}coerce(t,e){var i,r=this.getStack(t),s=void 0===r;return{type:this.getType(t),value:this.getMessage(t,e),stack:null!=r?r:null==(i=e.syntheticException)?void 0:i.stack,cause:t.cause?e.next(t.cause):void 0,synthetic:s}}getType(t){return t.name||t.constructor.name}getMessage(t,e){var i=t.message;return String(i.error&&"string"==typeof i.error.message?i.error.message:i)}getStack(t){return t.stacktrace||t.stack||void 0}}class Or{constructor(){}match(t){return!!xe(t,"ErrorEvent")&&(null!=t.error||this.$i(t))}coerce(t,e){var r;if(null!=t.error)return e.apply(t.error);var s=e.apply(t.message);return i({},s,{stack:null!==(r=this.Ui(t))&&void 0!==r?r:s.stack,synthetic:!0})}$i(t){return de(t.message)&&t.message.length>0}Ui(t){var e,i,r=t,s=null!==(e=r.lineno)&&void 0!==e?e:0,n=null!==(i=r.colno)&&void 0!==i?i:0;if(de(r.filename)&&0!==r.filename.length&&0!==s)return"Error\n at "+r.filename+":"+s+":"+n}}var Ir=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class Ar{match(t){return"string"==typeof t}coerce(t,e){var i,r=this.getInfos(t),s=r[0],n=r[1];return{type:null!=s?s:"Error",value:null!=n?n:t,stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}getInfos(t){var e="Error",i=t,r=t.match(Ir);return r&&(e=r[1],i=r[2]),[e,i]}}var Fr=["fatal","error","warning","log","info","debug"];function Mr(t,e){void 0===e&&(e=40);var i=Object.keys(t);if(i.sort(),!i.length)return"[object has no keys]";for(var r=i.length;r>0;r--){var s=i.slice(0,r).join(", ");if(e>=s.length)return r===i.length?s:s.length>e?s.slice(0,e)+"...":s}return""}class Dr{match(t){return"object"==typeof t&&null!==t}coerce(t,e){var i,r,s=this.getErrorPropertyFromObject(t);return s?e.apply(s):{type:this.getType(t),value:this.getValue(t),stack:null!==(i=this.getStack(t))&&void 0!==i?i:null==(r=e.syntheticException)?void 0:r.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){if(Se(t))return t.constructor.name;var e="name"in t?t.name:void 0;return de(e)&&!ve(e)?e:"Error"}getValue(t){if("name"in t&&"string"==typeof t.name){var e="'"+t.name+"' captured as exception";return"message"in t&&"string"==typeof t.message&&(e+=" with message: '"+t.message+"'"),e}if("message"in t&&"string"==typeof t.message)return t.message;var i=this.getObjectClassName(t);return(i&&"Object"!==i?"'"+i+"'":"Object")+" captured as exception with keys: "+Mr(t)}isSeverityLevel(t){return de(t)&&!ve(t)&&Fr.indexOf(t)>=0}getStack(t){try{return de(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:de(t.stack)&&t.stack.length>0?t.stack:void 0}catch(t){return}}getErrorPropertyFromObject(t){for(var e in t)if({}.hasOwnProperty.call(t,e)){var i=t[e];if(Ee(i))return i}}getObjectClassName(t){try{var e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch(t){return}}}class Nr{match(t){return Se(t)}coerce(t,e){var i,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+Mr(t),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}}class Lr{match(t){return we(t)}coerce(t,e){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}}class Ur{match(t){return xe(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!Se(t))return!1;try{var e=t.detail;return null!=e&&"object"==typeof e&&"reason"in e}catch(t){return!1}}coerce(t,e){var i,r=this.getUnhandledRejectionReason(t);return we(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}:e.apply(r)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&null!=t.detail&&"object"==typeof t.detail&&"reason"in t.detail)return t.detail.reason}catch(t){}return t}}var jr="$message",Br="$timestamp",zr=new Set([jr,Br]),qr={enabled:!0,max_bytes:32768};function Hr(t){var e;return t?{enabled:null!==(e=t.enabled)&&void 0!==e?e:qr.enabled,max_bytes:Wr(t.max_bytes,qr.max_bytes)}:i({},qr)}class Vr{constructor(t){this.Ss=[],this.xs=0,this.vn=Hr(t)}setConfig(t){this.vn=Hr(t),this.Cs()}add(t){var e=function(t){var e;try{e=ie(t)}catch(t){return}try{var i=JSON.parse(e);if(!le(i))return;var r=i,s=r[jr],n=r[Br];if(!de(s)||0===s.trim().length)return;if(!de(n)&&!pe(n))return;return{step:r,json:e}}catch(t){return}}(t);if(e){var i=function(t){if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t).length;for(var e=encodeURIComponent(t),i=0,r=0;e.length>r;r++)"%"===e[r]?(i+=1,r+=2):i+=1;return i}(e.json);i>this.vn.max_bytes||(this.Ss.push({step:e.step,bytes:i}),this.xs+=i,this.Cs())}}getAttachable(){return this.Ss.map((t=>t.step))}clear(){this.Ss=[],this.xs=0}size(){return this.Ss.length}Cs(){for(;this.xs>this.vn.max_bytes&&this.Ss.length>0;){var t=this.Ss.shift();t&&(this.xs-=t.bytes)}}}function Wr(t,e){if(!pe(t)||t===1/0||t===-1/0)return e;var i=Math.floor(t);return 0>i?e:i}var Gr=function(t,e){var i=(void 0===e?{}:e).debugEnabled,r={P(e){if(xt&&(s.DEBUG||xt.POSTHOG_DEBUG||i)&&!ue(xt.console)&&xt.console){for(var r=("__rrweb_original__"in xt.console[e]?xt.console[e].__rrweb_original__:xt.console[e]),n=arguments.length,o=new Array(n>1?n-1:0),a=1;n>a;a++)o[a-1]=arguments[a];r(t,...o)}},debug(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.P("debug",...e)},info(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.P("log",...e)},warn(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.P("warn",...e)},error(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.P("error",...e)},critical(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];console.error(t,...i)},uninitializedWarning(t){r.error("You must initialize PostHog before calling "+t)},createLogger:(e,i)=>Gr(t+" "+e,i)};return r},Kr=Gr("[PostHog.js]"),Jr=Kr.createLogger;function Yr(t,e){oe(t)&&t.forEach(e)}function Qr(t,e){if(!fe(t))if(oe(t))t.forEach(e);else if(me(t))t.forEach(((t,i)=>e(t,i)));else for(var i in t)se.call(t,i)&&e(t[i],i)}var Xr=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];for(var s of i)for(var n in s)void 0!==s[n]&&(t[n]=s[n]);return t};function Zr(t){for(var e=Object.keys(t),i=e.length,r=new Array(i);i--;)r[i]=[e[i],t[e[i]]];return r}var ts=function(t){try{return t()}catch(t){return}},es=function(t){return function(){try{for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,i)}catch(t){Kr.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Kr.critical(t)}}},is=function(t){var e={};return Qr(t,(function(t,i){(de(t)&&t.length>0||pe(t))&&(e[i]=t)})),e};var rs=["herokuapp.com","vercel.app","netlify.app"];function ss(t){var e=null==t?void 0:t.hostname;if(!de(e))return!1;var i=e.split(".").slice(-2).join(".");for(var r of rs)if(i===r)return!1;return!0}function ns(t,e,i,r){var s=null!=r?r:{},n=s.capture,o=s.passive;null==t||t.addEventListener(e,i,{capture:void 0!==n&&n,passive:void 0===o||o})}function os(t){return"ph_toolbar_internal"===t.name}var as=t=>{if(kt){try{for(var e=t+"=",i=kt.cookie.split(";").filter((t=>t.length)),r=0;i.length>r;r++){for(var s=i[r];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(e))return decodeURIComponent(s.substring(e.length,s.length))}}catch(t){}return null}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return pe(t)&&isFinite(t)&&Math.floor(t)===t});class ls{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,e,i,r){if(!Number.isInteger(t)||!Number.isInteger(e)||!Number.isInteger(i)||!Number.isInteger(r)||0>t||0>e||0>i||0>r||t>0xffffffffffff||e>4095||i>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=t/Math.pow(2,40),s[1]=t/Math.pow(2,32),s[2]=t/Math.pow(2,24),s[3]=t/Math.pow(2,16),s[4]=t/256,s[5]=t,s[6]=112|e>>>8,s[7]=e,s[8]=128|i>>>24,s[9]=i>>>16,s[10]=i>>>8,s[11]=i,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new ls(s)}toString(){for(var t="",e=0;this.bytes.length>e;e++)t=t+(this.bytes[e]>>>4).toString(16)+(15&this.bytes[e]).toString(16),3!==e&&5!==e&&7!==e&&9!==e||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new ls(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(var e=0;16>e;e++){var i=this.bytes[e]-t.bytes[e];if(0!==i)return Math.sign(i)}return 0}}class hs{generate(){var t=this.generateOrAbort();if(!ue(t))return t;this.Gr=0;var e=this.generateOrAbort();if(ue(e))throw new Error("Could not generate UUID after timestamp reset");return e}generateOrAbort(){var t=Date.now();if(t>this.Gr)this.Gr=t,this.Qr();else{if(this.Gr>=t+1e4)return;this.Jr++,this.Jr>4398046511103&&(this.Gr++,this.Qr())}return ls.fromFieldsV7(this.Gr,Math.trunc(this.Jr/Math.pow(2,30)),this.Jr&Math.pow(2,30)-1,this.Yr.nextUint32())}Qr(){this.Jr=1024*this.Yr.nextUint32()+(1023&this.Yr.nextUint32())}constructor(){this.Gr=0,this.Jr=0,this.Yr=new vs}}var us,ds=t=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};xt&&!ue(xt.crypto)&&crypto.getRandomValues&&(ds=t=>crypto.getRandomValues(t));class vs{nextUint32(){return this.At.length>this.Kr||(ds(this.At),this.Kr=0),this.At[this.Kr++]}constructor(){this.At=new Uint32Array(8),this.Kr=1/0}}var cs=()=>fs().toString(),fs=()=>(us||(us=new hs)).generate(),ps="",_s=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var gs={Xr:()=>!!kt,ii(t){Kr.error("cookieStore error: "+t)},ti:as,ni(t){var e;try{e=JSON.parse(gs.ti(t))||{}}catch(t){}return e},ei(t,e,i,r,s){if(!kt)return!1;try{var n="",o="",a=function(t,e){if(e){var i=function(t,e){if(void 0===e&&(e=kt),ps)return ps;if(!e)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var i=t.split("."),r=Math.min(i.length,8),s="dmn_chk_"+cs();!ps&&r--;){var n=i.slice(r).join("."),o=s+"=1;domain=."+n+";path=/";e.cookie=o+";max-age=3",e.cookie.includes(s)&&(e.cookie=o+";max-age=0",ps=n)}return ps}(t);if(!i){var r=(t=>{var e=t.match(_s);return e?e[0]:""})(t);r!==i&&Kr.info("Warning: cookie subdomain discovery mismatch",r,i),i=r}return i?"; domain=."+i:""}return""}(kt.location.hostname,r);if(i){var l=new Date;l.setTime(l.getTime()+864e5*i),n="; expires="+l.toUTCString()}s&&(o="; secure");var h=t+"="+encodeURIComponent(JSON.stringify(e))+n+"; SameSite=Lax; path=/"+a+o;return h.length>3686.4&&Kr.warn("cookieStore warning: large cookie, len="+h.length),kt.cookie=h,!0}catch(t){return!1}},ri(t,e){if(null!=kt&&kt.cookie)try{gs.ei(t,"",-1,e)}catch(t){return}}},ms=null,ys={Xr(){if(!ce(ms))return ms;var t=!0;if(ue(xt))t=!1;else try{var e="__mplssupport__";ys.ei(e,"xyz"),'"xyz"'!==ys.ti(e)&&(t=!1),ys.ri(e)}catch(e){t=!1}return t||Kr.error("localStorage unsupported; falling back to cookie store"),ms=t,t},ii(t){Kr.error("localStorage error: "+t)},ti(t){try{return null==xt?void 0:xt.localStorage.getItem(t)}catch(t){ys.ii(t)}return null},ni(t){try{return JSON.parse(ys.ti(t))||{}}catch(t){}return null},ei(t,e){try{return null==xt||xt.localStorage.setItem(t,JSON.stringify(e)),!0}catch(t){ys.ii(t)}return!1},ri(t){try{null==xt||xt.localStorage.removeItem(t)}catch(t){ys.ii(t)}}},bs=[U,O,C,A,F,M,Q,Y,K],ws=[a,o,P,R,st,rt,X],xs=t=>t+"_cpm",Es=["__proto__","constructor","prototype"],Ss=t=>{if(!le(t))return{};var e={};return Object.keys(t).forEach((i=>{-1===Es.indexOf(i)&&(e[i]=t[i])})),e},ks=function(t,e){void 0===e&&(e=[]);var i={};return[...ws,...e].forEach((e=>{var r=t[e];ue(r)||ce(r)||""===r||(i[e]=r)})),i},Ts=t=>{for(var e=5381,i=2166136261,r=0;t.length>r;r++){var s=t.charCodeAt(r);e=33*e^s,i=Math.imul(i^s,16777619)}return t.length.toString(36)+"."+(e>>>0).toString(36)+"."+(i>>>0).toString(36)},$s=(t,e)=>({p:e,f:Ts(JSON.stringify(t))}),Ps=(t,e)=>{if(!e)return{properties:[],isValid:!1};try{var i=gs.ni(xs(t)),r=(null==i?void 0:i.f)===Ts(e)&&oe(i.p);return{properties:r?i.p:[],isValid:r}}catch(t){return{properties:[],isValid:!1}}},Rs=(t,e)=>e+"|"+(gs.ti(xs(t))||""),Cs={},Os={Xr:()=>!0,ii(t){Kr.error("memoryStorage error: "+t)},ti:t=>Cs[t]||null,ni:t=>Cs[t]||null,ei:(t,e)=>(Cs[t]=e,!0),ri(t){delete Cs[t]}},Is=null,As={Xr(){if(!ce(Is))return Is;if(Is=!0,ue(xt))Is=!1;else try{var t="__support__";As.ei(t,"xyz"),'"xyz"'!==As.ti(t)&&(Is=!1),As.ri(t)}catch(t){Is=!1}return Is},ii(t){Kr.error("sessionStorage error: ",t)},ti(t){try{return null==xt?void 0:xt.sessionStorage.getItem(t)}catch(t){As.ii(t)}return null},ni(t){try{return JSON.parse(As.ti(t))||null}catch(t){}return null},ei(t,e){try{return null==xt||xt.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch(t){As.ii(t)}return!1},ri(t){try{null==xt||xt.sessionStorage.removeItem(t)}catch(t){As.ii(t)}}};class Fs{constructor(t){this._instance=t}get vn(){return this._instance.config}get consent(){return this.Hs()?0:this.zs}isOptedOut(){return this.vn.cookieless_mode===vt||this.isRejected()||-1===this.consent&&this.vn.cookieless_mode===dt}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.vn.opt_out_capturing_by_default}optInOut(t){this.Us.ei(this.Ws,t?1:0,this.vn.cookie_expiration,this.vn.cross_subdomain_cookie,this.vn.secure_cookie)}reset(){this.Us.ri(this.Ws,this.vn.cross_subdomain_cookie)}get Ws(){var t=this._instance.config,e=t.token,i=t.opt_out_capturing_cookie_prefix;return t.consent_persistence_name||(i?i+e:"__ph_opt_in_out_"+e)}get zs(){var t=this.Us.ti(this.Ws);return $e(t)?1:Zt(Pe,t)?0:-1}get Us(){var t=this.vn.opt_out_capturing_persistence_type,e="localStorage"===t?ys:gs;if(!this.Vs||this.Vs!==e){this.Vs=e;var i="localStorage"===t?gs:ys;i.ti(this.Ws)&&(this.Vs.ti(this.Ws)||this.optInOut($e(i.ti(this.Ws))),i.ri(this.Ws,this.vn.cross_subdomain_cookie))}return this.Vs}Hs(){return!!this.vn.respect_dnt&&[null==St?void 0:St.doNotTrack,null==St?void 0:St.msDoNotTrack,Ft.doNotTrack].some((t=>$e(t)))}}function Ms(t,e){var i,r=null==t||null==(i=t.config)?void 0:i.get_current_url;if(!ae(r))return e;try{var s=r(e);return de(s)&&s?s:e}catch(t){return Kr.error("Error in get_current_url, falling back to window.location.href",t),e}}var Ds="__POSTHOG_TOOLBAR__",Ns=1,Ls=3,Us=11;function js(t){return t instanceof Element&&(t.id===Ds||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function Bs(t){return!!t&&t.nodeType===Ns}function zs(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function qs(t){return!!t&&t.nodeType===Ls}function Hs(t){return!!t&&t.nodeType===Us&&Bs(t.host)}var Vs=1e3;function Ws(t){return t?te(t).split(/\s+/):[]}function Gs(t,e){var i=function(t){var e,i=null==xt||null==(e=xt.location)?void 0:e.href;return ue(i)?void 0:Ms(t,i)}(e);return!!(i&&t&&t.some((t=>i.match(t))))}function Ks(t){var e="";switch(typeof t.className){case"string":e=t.className;break;case"object":e=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:e=""}return Ws(e)}function Js(t){return fe(t)?null:te(t).split(/(\s+)/).filter((t=>bn(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Ys(t){var e="";return dn(t)&&!vn(t)&&t.childNodes&&t.childNodes.length&&Qr(t.childNodes,(function(t){var i;qs(t)&&t.textContent&&(e+=null!==(i=Js(t.textContent))&&void 0!==i?i:"")})),te(e)}function Qs(t){var e;return ue(t.target)?t.srcElement||null:null!=(e=t.target)&&e.shadowRoot?t.composedPath()[0]||null:t.target||null}var Xs=["a","button","form","input","select","textarea","label"];function Zs(t,e){if(ue(e))return!0;var i,r=function(t){if(e.some((e=>function(t,e){var i=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector;try{return!!i&&i.call(t,e)}catch(t){return!1}}(t,e))))return{v:!0}};for(var s of t)if(i=r(s))return i.v;return!1}function tn(t){var e=t.parentNode;return!(!e||!Bs(e))&&e}var en=[".ph-no-autocapture","[data-ph-no-autocapture]"],rn=["next","previous","prev",">","<"],sn=[...rn,"+","-","−","–"],nn=(t,e)=>/[a-z0-9]/i.test(e)?t.includes(e):t===e,on=[".ph-no-rageclick",".ph-no-capture"],an=["","text","search","email","password","url","tel","number"];function ln(t,e){if(!xt||hn(t))return!1;var i,r,s,n,o;if(ge(e)?(i=!!e&&on,r=void 0,s=!1):(i=null!==(n=null==e?void 0:e.css_selector_ignorelist)&&void 0!==n?n:on,r=null==e?void 0:e.content_ignorelist,s=null!==(o=null==e?void 0:e.ignore_text_selection)&&void 0!==o&&o),!1===i)return!1;if(s&&function(t){return!(!t||!Bs(t))&&(!!zs(t,"textarea")||(zs(t,"input")?Zt(an,(t.getAttribute("type")||"").toLowerCase()):function(t){if(t.isContentEditable)return!0;var e=null==t.getAttribute?void 0:t.getAttribute("contenteditable");return"true"===e||""===e}(t)))}(t))return!1;var a=un(t,!1).targetElementList;return!function(t,e){if(!1===t||ue(t))return!1;var i;if(!0===t)i=rn;else{if(!oe(t))return!1;if(t.length>10)return Kr.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;i=t.map((t=>t.toLowerCase()))}return e.some((t=>{var e=t.safeText,r=t.ariaLabel;return i.some((t=>nn(e,t)||nn(r,t)))}))}(r,a.map((t=>{var e;return{safeText:Ys(t).toLowerCase(),ariaLabel:(null==(e=t.getAttribute("aria-label"))?void 0:e.toLowerCase().trim())||""}})))&&!Zs(a,i)}var hn=t=>!t||zs(t,"html")||!Bs(t),un=(t,e)=>{if(!xt||hn(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,r=[t],s=t;s.parentNode&&!zs(s,"body");)if(Hs(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var n=tn(s);if(!n)break;if(e||Xs.indexOf(n.tagName.toLowerCase())>-1)i=!0;else try{var o=xt.getComputedStyle(n);o&&"pointer"===o.getPropertyValue("cursor")&&(i=!0)}catch(t){}r.push(n),s=n}return{parentIsUsefulElement:i,targetElementList:r}};function dn(t){for(var e=new Set,i=0,r=t;r.parentNode&&!zs(r,"body");r=r.parentNode){if(i++>=Vs||e.has(r))return!1;e.add(r);var s=Ks(r);if(Zt(s,"ph-sensitive")||Zt(s,"ph-no-capture"))return!1}if(Zt(Ks(t),"ph-include"))return!0;var n=t.type||"";if(de(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var o=t.name||t.id||"";return!de(o)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(o.replace(/[^a-zA-Z0-9]/g,""))}function vn(t){return!!(zs(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||zs(t,"select")||zs(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var cn=new RegExp("^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$"),fn=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,pn=[16,15,14,13],_n=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),gn=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),mn=/[0-9A-Za-z_]/;function yn(t){for(var e=0,i=!1,r=t.length-1;r>=0;r--){var s=t.charCodeAt(r)-48;i&&(s*=2)>9&&(s-=9),e+=s,i=!i}return e%10==0}function bn(t,e){if(void 0===e&&(e=!0),fe(t))return!1;if(de(t)){t=te(t);var i=e?cn.test((t||"").replace(/[- ]/g,"")):function(t){var e;for(fn.lastIndex=0;e=fn.exec(t);){var i=e[2];if(i)for(var r=i.replace(/[- ]/g,""),s=0;r.length>s;s++)for(var n of pn){var o=s+n;if(r.length>=o){var a=r.slice(s,o);if(cn.test(a)&&yn(a))return!0}}}return!1}(t);if(i)return!1;var r=e?_n.test(t):function(t){var e;for(gn.lastIndex=0;e=gn.exec(t);){var i=e[1],r=e[3];if(!(i&&r&&mn.test(i)&&mn.test(r)))return!0}return!1}(t);if(r)return!1}return!0}function wn(t){var e=Ys(t);return bn(e=(e+" "+xn(t)).trim())?e:""}function xn(t){var e="";return t&&t.childNodes&&t.childNodes.length&&Qr(t.childNodes,(function(t){var i;if(t&&"span"===(null==(i=t.tagName)?void 0:i.toLowerCase()))try{var r=Ys(t);e=(e+" "+r).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+xn(t)).trim())}catch(t){Kr.error("[AutoCapture]",t)}})),e}function En(t){return t.replace(/"|\\"/g,'\\"')}function Sn(t){var e=t.attr__class;if(e)return oe(e)?e:Ws(e)}var kn=Jr("[Dead Clicks]"),Tn=()=>!0,$n=t=>{var e,i=!(null==(e=t.instance.persistence)||!e.get_property(g)),r=t.instance.config.capture_dead_clicks;return ge(r)?r:!!le(r)||i};class Pn{get lazyLoadedDeadClicksAutocapture(){return this.Gs}constructor(t,e,i){this.instance=t,this.isEnabled=e,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(t){if(t.ok){var e=t.config;"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[g]:e.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.Zs((()=>{this.Qs()})):this.stop()}Zs(t){var e,i;null!=(e=Ft.__PosthogExtensions__)&&e.initDeadClicksAutocapture?t():null==(i=Ft.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(e=>{e?kn.error("failed to load script",e):t()}))}Qs(){var t;if(kt){if(!this.Gs&&null!=(t=Ft.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var e=le(this.instance.config.capture_dead_clicks)?i({},this.instance.config.capture_dead_clicks):{};e.__onCapture=this.onCapture,this.onCapture&&(e.capture_dead_swipes=!1),this.Gs=Ft.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,e),this.Gs.start(kt),kn.info("starting...")}}else kn.error("`document` not found. Cannot start.")}stop(){this.Gs&&(this.Gs.stop(),this.Gs=void 0,kn.info("stopping..."))}}var Rn=Jr("[SegmentIntegration]");var Cn="posthog-js";function On(t,e){var r=void 0===e?{}:e,s=r.organization,n=r.projectId,o=r.prefix,a=r.severityAllowList,l=void 0===a?["error"]:a,h=r.sendExceptionsToPostHog,u=void 0===h||h;return e=>{var r,a,h,d,v;if("*"!==l&&!l.includes(e.level)||!t.__loaded)return e;e.tags||(e.tags={});var c=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());e.tags["PostHog Person URL"]=c,t.sessionRecordingStarted()&&(e.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var f,p=(null==(r=e.exception)?void 0:r.values)||[],_=p.map((t=>i({},t,{stacktrace:t.stacktrace?i({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map((t=>i({},t,{platform:"web:javascript"})))}):void 0}))),g={$exception_message:(null==(a=p[0])?void 0:a.value)||e.message,$exception_type:null==(h=p[0])?void 0:h.type,$exception_level:e.level,$exception_list:_,$sentry_event_id:e.event_id,$sentry_exception:e.exception,$sentry_exception_message:(null==(d=p[0])?void 0:d.value)||e.message,$sentry_exception_type:null==(v=p[0])?void 0:v.type,$sentry_tags:e.tags};return s&&n&&(g.$sentry_url=(o||"https://sentry.io/organizations/")+s+"/issues/?project="+n+"&query="+e.event_id),u&&(null==(f=t.exceptions)||f.sendExceptionEvent(g)),e}}class In{constructor(t,e,i,r,s,n){this.name=Cn,this.setupOnce=function(o){o(On(t,{organization:e,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class An{constructor(t){this.Js=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(Kr.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.Ks=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.Ys()}Ys(){var t;this.Xs=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.Js)}destroy(){var t;null==(t=this.Xs)||t.call(this),this.Xs=void 0}doPageView(t,e){var i,r=this.ta(t,e);return this.Ks={pathname:null!==(i=null==xt?void 0:xt.location.pathname)&&void 0!==i?i:"",pageViewId:e,timestamp:t},this._instance.scrollManager.resetContext(),r}doPageLeave(t){var e;return this.ta(t,null==(e=this.Ks)?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.Ks)?void 0:t.pageViewId}}ta(t,e){var i=this.Ks;if(!i)return{$pageview_id:e};var r={$pageview_id:e,$prev_pageview_id:i.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var n=s.maxScrollHeight,o=s.lastScrollY,a=s.maxScrollY,l=s.maxContentHeight,h=s.lastContentY,u=s.maxContentY;if(!(ue(n)||ue(o)||ue(a)||ue(l)||ue(h)||ue(u))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),h=Math.ceil(h),u=Math.ceil(u);var d=n>1?Re(o/n,0,1,Kr):1,v=n>1?Re(a/n,0,1,Kr):1,c=l>1?Re(h/l,0,1,Kr):1,f=l>1?Re(u/l,0,1,Kr):1;r=Xr(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:v,$prev_pageview_last_content:h,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:f})}}return i.pathname&&(r.$prev_pageview_pathname=i.pathname),i.timestamp&&(r.$prev_pageview_duration=(t.getTime()-i.timestamp.getTime())/1e3),r}}var Fn=["flags","surveys"],Mn={[n]:{exposure:"hidden"},[h]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[u]:{exposure:"hidden"},[d]:{exposure:"event"},[v]:{exposure:"hidden"},[y]:{exposure:"hidden"},[c]:{exposure:"event"},[f]:{exposure:"hidden"},[p]:{exposure:"event"},[_]:{exposure:"event"},[g]:{exposure:"event"},[m]:{exposure:"hidden"},[b]:{exposure:"event"},[w]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[P]:{exposure:"hidden"},[R]:{exposure:"event"},[x]:{exposure:"event",shouldSkipFromEventProperties:t=>ce(t)},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},$sess_rec_flush_size:{exposure:"hidden"},[C]:{exposure:"hidden",storageGroup:"flags"},[O]:{exposure:"hidden",storageGroup:"flags"},[I]:{exposure:"hidden"},[A]:{exposure:"hidden",storageGroup:"flags"},[F]:{exposure:"hidden",storageGroup:"flags"},[M]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[D]:{exposure:"hidden",storageGroup:"flags"},[N]:{exposure:"hidden"},[L]:{exposure:"hidden"},[U]:{exposure:"hidden"},[j]:{exposure:"hidden"},[z]:{exposure:"hidden",storageGroup:"surveys"},[q]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[H]:{exposure:"event"},[V]:{exposure:"hidden"},[W]:{exposure:"hidden"},[G]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$product_tours_activated_session:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[K]:{exposure:"hidden"},[J]:{exposure:"hidden"},[B]:{exposure:"event"},[Y]:{exposure:"hidden"},[Q]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[X]:{exposure:"hidden"},[Z]:{exposure:"hidden"},[tt]:{exposure:"hidden"},[et]:{exposure:"hidden"},[it]:{exposure:"hidden"},[rt]:{exposure:"hidden"},[st]:{exposure:"hidden"},[E]:{exposure:"event"},[S]:{exposure:"event"},[k]:{exposure:"event"},[T]:{exposure:"event"},[at]:{exposure:"event"},[lt]:{exposure:"event"},[ht]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_pending_trigger_conditions:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},Dn=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Nn=t=>{var e=Mn[t];if(e)return e;for(var i of Dn){var r=i[1];if(0===t.indexOf(i[0]))return r}},Ln=(t,e)=>{try{return JSON.stringify(t,((t,e)=>"bigint"==typeof e?e.toString():e),e)}catch(e){return ie(t)}},Un=t=>{var e=null==kt?void 0:kt.createElement("a");return ue(e)?null:(e.href=t,e)},jn=function(t,e){for(var i,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===e){i=n;break}}if(!oe(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(t){Kr.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Bn=function(t,e,i){if(!t||!e||!e.length)return t;for(var r=t.split("#"),s=r[1],n=(r[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),h=[],u=0;l.length>u;u++){var d=l[u].split("=");oe(d)&&(e.includes(d[0])?h.push(d[0]+"="+i):h.push(l[u]))}var v=a;return null!=o&&(v+="?"+h.join("&")),null!=s&&(v+="#"+s),v},zn=function(t,e){var i=t.match(new RegExp(e+"=([^&]*)"));return i?i[1]:null},qn=(t,e)=>t>=e&&It(),Hn=(t,e,i,r)=>{if(0===t){if(It()){var s=e+1;return s===i&&r(),s}return e}return 0},Vn="https?://(.*)",Wn=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Gn=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Wn],Kn="<masked>",Jn=["li_fat_id"];function Yn(t,e,i){if(!kt)return{};var r,s=e?[...Wn,...i||[]]:[],n=Qn(Bn(kt.URL,s,Kn),t),o=(r={},Qr(Jn,(function(t){var e=as(t);r[t]=e||null})),r);return Xr(o,n)}function Qn(t,e){var i=Gn.concat(e||[]),r={};return Qr(i,(function(e){var i=jn(t,e);r[e]=i||null})),r}function Xn(t){var e=function(t){return t?0===t.search(Vn+"google.([^/?]*)")?"google":0===t.search(Vn+"bing.com")?"bing":0===t.search(Vn+"yahoo.com")?"yahoo":0===t.search(Vn+"duckduckgo.com")?"duckduckgo":null:null}(t),i="yahoo"!=e?"q":"p",r={};if(!ce(e)){r.$search_engine=e;var s=kt?jn(kt.referrer,i):"";s.length&&(r.ph_keyword=s)}return r}function Zn(){return navigator.language||navigator.userLanguage}var to="$direct";function eo(){return(null==kt?void 0:kt.referrer)||to}function io(t,e,i){void 0===i&&(i=!1);var r=t?[...Wn,...e||[]]:[],s=i?Li(null==Tt?void 0:Tt.href):null==Tt?void 0:Tt.href,n=null==s?void 0:s.substring(0,1e3);return{r:eo().substring(0,1e3),u:n?Bn(n,r,Kn):void 0}}function ro(t,e){var i;void 0===e&&(e=!1);var r=t.r,s=t.u,n=e?Li(s):s,o={$referrer:r,$referring_domain:null==r?void 0:r==to?to:null==(i=Un(r))?void 0:i.host};if(n){o.$current_url=n;var a=Un(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname;var l=Qn(n);Xr(o,l)}if(r){var h=Xn(r);Xr(o,h)}return o}function so(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function no(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var oo={flags:Q,surveys:q},ao=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],lo=t=>t+"_cookie_identity_change_pending",ho="main",uo=(t,e)=>{Qr(t,((i,r)=>{var s=Nn(r);s&&"event"!==s.exposure||{}.hasOwnProperty.call(e,r)||delete t[r]}))};class vo{constructor(t,e,r){if(void 0===r&&(r=!0),this.ea={},this.ia=!1,this.ra=!1,this.na=!1,this.sa=!1,this.vn=t,this.aa=r,this.props={},this.oa=void 0,this.la=(t=>{var e="";return t.token&&(e=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+e+"_posthog"})(t),this.Us=this.ua(t),this.ra=this.ha(t),this.load(),t.debug&&Kr.info("Persistence loaded",t.persistence,i({},this.props)),this.update_config(t,t,e),this.save(),xt){var s=()=>this.flush();ns(xt,"beforeunload",s,{capture:!1}),ns(xt,"pagehide",s,{capture:!1})}}da(){var t,e=null==(t=this.vn)?void 0:t.persistence_save_debounce_ms;return pe(e)&&e>0?e:0}va(t){if(this.vn.cookieWinsOnConflict&&"localstorage+cookie"===this.vn.persistence.toLowerCase())if(t)try{var e=ks(t,this.vn.cookie_persisted_properties||[]),i=$s(e,this.vn.cookie_persisted_properties||[]),r=JSON.stringify(e)+"|"+JSON.stringify(i),s=gs.ti(this.la)||void 0;s&&Rs(this.la,s)===r&&(this.ca=r,this.fa=s)}catch(t){}else try{var n=gs.ti(this.la)||void 0;this.ca=n?Rs(this.la,n):void 0,this.fa=n}catch(t){}}syncCookieProperties(){return this.pa(this.vn)}pa(t,e){if(void 0===e&&(e=!1),this.ga&&!e||this.sa||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;var i;try{i=gs.ti(this.la)||void 0}catch(t){}if(!i||i===this.fa)return!1;var r,s=Rs(this.la,i);try{r=Ss(JSON.parse(i))}catch(t){return!1}if((gs.ti(this.la)||void 0)!==i)return!1;this.ca=s,this.fa=i;var n=Ps(this.la,i),a=[...ws,...n.properties],l={};if(Object.keys(r).forEach((t=>{var e=r[t];(ue(e)||ce(e)||""===e||t===X&&e!==ct&&e!==ft)&&(l[t]=!0,delete r[t])})),he(r))return!1;var u=o in r||r[X]===ct||r[X]===ft,d=this.props[o],v=this.props[X],c=Xr({},this.props);[...ws,...t.cookie_persisted_properties||[]].forEach((t=>{if(-1!==a.indexOf(t)&&!(t in r)&&!l[t]&&(u||t!==o&&t!==X)){var e=c[t];!n.isValid&&-1!==ws.indexOf(t)&&(!1===e||0===e)||delete c[t]}})),this.props=Xr(c,r),!u||X in r||X in this.props||this.ma(X,ct);var f=this.props[o],p=this.props[X];return!u||f===d&&p===v||(this.na=!0,As.ei(lo(this.la),!0),this.ya(U),this.ya(O),this.ya(C),this.ya(A),this.ya(F),this.ya(M),this.ya(Q),this.ya(Y),this.ya(K),p===ct&&(v===ft||r[X]===ct||!ue(d)&&f!==d)&&(uo(this.props,r),this.ya(j)),p===ft?this.props.$user_id=f:delete this.props.$user_id,this.ya(h)),!0}consumeCookieIdentityChange(){var t=lo(this.la),e=this.na||!!As.ti(t);return this.na=!1,e&&As.ri(t),e}ba(t){return void 0===t&&(t=!1),!(this.sa||this.ga&&!t||!this.vn.cookieWinsOnConflict||"localstorage+cookie"!==this.vn.persistence.toLowerCase()||(this.sa=!0,0))}_a(){this.sa&&(ue(this.wa)||(clearTimeout(this.wa),this.wa=void 0),delete this.ea[ho],this.ka(!0))}Sa(t){if(void 0===t&&(t=!0),this.sa)try{t?this._a():ue(this.wa)||(clearTimeout(this.wa),this.wa=void 0)}finally{this.sa=!1}}isDisabled(){return!!this.ga}ua(t){-1===ao.indexOf(t.persistence.toLowerCase())&&(Kr.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var e,r=function(t,e){void 0===t&&(t=[]),void 0===e&&(e=!1);var r=[...ws,...t];return i({},ys,{ni(t){try{var i,s={};try{i=gs.ti(t)||void 0,s=i?Ss(JSON.parse(i)):{}}catch(t){}var n,a=JSON.parse(ys.ti(t)||"{}");if(e){var l=Ps(t,i),h=[...ws,...l.properties],u={};Object.keys(s).forEach((t=>{var e=s[t];ce(e)||""===e||t===X&&e!==ct&&e!==ft||(u[t]=e)}));var d=o in u||u[X]===ct||u[X]===ft;if(Object.keys(u).length>0){var v,c=a[o],f=null!==(v=a[X])&&void 0!==v?v:ct;r.forEach((t=>{if(-1!==h.indexOf(t)&&!(t in s)&&(d||t!==o&&t!==X)){var e=a[t];!l.isValid&&-1!==ws.indexOf(t)&&(!1===e||0===e)||delete a[t]}})),!d||X in s||X in a||(a[X]=ct),!d||(o in u?u[o]:a[o])===c&&(X in u?u[X]:a[X])===f||(bs.forEach((t=>delete a[t])),u[X]===ft&&o in u?a.$user_id=u[o]:delete a.$user_id,u[X]!==ft&&(delete a[B],delete a[j]),delete a.__alias)}n=Xr(a,u)}else n=Xr(s,a);return ys.ei(t,n),n}catch(t){}return null},ei(i,r,s,n,o,a){var l=ys.ei(i,r,void 0,void 0,a);try{var h=ks(r,t);if(Object.keys(h).length){if(e){var u=xs(i),d=$s(h,t);if(gs.ei(u,d,s,n,o,a),gs.ti(u)!==JSON.stringify(d)){gs.ri(u,n);var v=ks(r);return gs.ei(i,v,s,n,o,a),l}}gs.ei(i,h,s,n,o,a)}}catch(t){ys.ii(t)}return l},ri(t,e){try{null==xt||xt.localStorage.removeItem(t),gs.ri(t,e),gs.ri(xs(t),e)}catch(t){ys.ii(t)}}})}(t.cookie_persisted_properties||[],t.cookieWinsOnConflict),s=!1,n=t.persistence.toLowerCase();return"localstorage"===n&&ys.Xr()?(e=ys,s=!0):"localstorage+cookie"===n&&r.Xr()?(e=r,s=!0):"sessionstorage"===n&&As.Xr()?e=As:"memory"===n?e=Os:"cookie"===n?e=gs:r.Xr()?(e=r,s=!0):e=gs,this.ia=s,e}xa(t){return this.la+"__"+t}ha(t){return this.ia&&!!t.split_storage}properties(){var t={};return Qr(this.props,((e,i)=>{var r=Nn(i);if(!r||"event"===r.exposure){if(null!=r&&null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(e))return;t[i]=e}})),t}load(t){if(void 0===t&&(t=!1),!this.ga||t){var e=this.vn.cookieWinsOnConflict&&"localstorage+cookie"===this.vn.persistence.toLowerCase(),i=e?ys.ni(this.la):null,r={};if(e)try{Qr(r=Ss(gs.ni(this.la)),((t,e)=>{(ue(t)||ce(t)||""===t)&&delete r[e]}))}catch(t){}var s=this.Us.ni(this.la);if(s&&(this.props=Xr({},s)),this.ra&&this.Ca(),e&&s){var n,a,l=null==i?void 0:i[o],h=null!==(n=null==i?void 0:i[X])&&void 0!==n?n:ct,u=s[o],d=null!==(a=s[X])&&void 0!==a?a:ct;if(u!==l||d!==h){this.na=!0,As.ei(lo(this.la),!0);var v=Xr({},this.props);bs.forEach((t=>delete v[t])),d===ct&&(h===ft||r[X]===ct||!ue(l)&&u!==l)&&(uo(v,r),delete v[j]),this.props=v;var c=new Set;bs.forEach((t=>{var e,i=null==(e=Nn(t))?void 0:e.storageGroup;i&&c.add(i)})),c.forEach((t=>{var e={};Qr(this.props,((i,r)=>{var s;(null==(s=Nn(r))?void 0:s.storageGroup)===t&&(e[r]=i)})),he(e)?(ys.ri(this.xa(t)),this.ea[t]={}):ys.ei(this.xa(t),e)&&(this.ea[t]={persisted:!0,fingerprint:this.Ta(e,t)})}))}}As.ti(lo(this.la))&&(this.na=!0)}}Ca(){for(var t of Fn){var e=ys.ni(this.xa(t));if(e&&!he(e)){var i=this.Ma(t);i.persisted=!0,this.Ea(t)||(i.fingerprint=this.Ta(e,t)),this.Ia(t,e)||Xr(this.props,e)}}}Ea(t){return Object.keys(this.props).some((e=>{var i;return(null==(i=Nn(e))?void 0:i.storageGroup)===t}))}Ia(t,e){var i=oo[t];if(!i)return!1;var r=e[i],s=this.props[i];return pe(r)&&pe(s)&&s>r}refreshKey(t){var e;if(!this.ga){var i=this.ra?null==(e=Nn(t))?void 0:e.storageGroup:void 0,r=i?ys.ni(this.xa(i)):this.Us.ni(this.la);if(r&&t in r)this.ma(t,r[t]);else{if(i){var s=this.Us.ni(this.la);if(s&&t in s)return void this.ma(t,s[t])}this.ya(t)}}}save(){if(!this.ga){var t=this.da();t>0?ue(this.wa)&&(this.wa=setTimeout((()=>{this.wa=void 0,this.ka()}),t)):this.ka()}}flush(){ue(this.wa)||(clearTimeout(this.wa),this.wa=void 0,this.ka())}ka(t){void 0===t&&(t=!1),this.ga||this.sa&&!t||(t||this.syncCookieProperties(),this.ra?this.Ra():this.Pa(this.Us,this.la,this.props,ho)&&this.va(this.props))}Ra(){var t=this.Aa(),e=t.main,i=t.groups;for(var r of(this.Pa(this.Us,this.la,e,ho)&&this.va(e),Fn)){var s,n=i[r];(!he(n)||null!=(s=this.ea[r])&&s.persisted)&&this.Pa(ys,this.xa(r),n,r)}}Aa(){var t={},e={flags:{},surveys:{}};return Qr(this.props,((i,r)=>{var s,n=null==(s=Nn(r))?void 0:s.storageGroup;n?e[n][r]=i:t[r]=i})),{main:t,groups:e}}Ta(t,e){if(e===ho)return JSON.stringify(t)+"|"+this.Fa+"|"+this.Oa+"|"+this.La;var i={};return Qr(t,((t,e)=>{var r;i[e]=null!=(r=Nn(e))&&r.volatile?"__volatile__":t})),JSON.stringify(i)}Pa(t,e,i,r){var s,n=this.Ma(r);if(r!==ho&&!n.dirty&&!ue(n.fingerprint))return!1;try{if((s=this.Ta(i,r))===n.fingerprint)return n.dirty=!1,!1}catch(t){s=void 0}return t.ei(e,i,this.Fa,this.Oa,this.La,this.vn.debug)?(n.dirty=!1,r!==ho&&(n.persisted=!0),ue(s)||(n.fingerprint=s),!0):(this.vn.debug&&Kr.warn('failed to persist storage entry "'+e+'"; will retry on next save'),!1)}remove(t){var e=(void 0===t?{}:t).keepGroupEntries,i=void 0!==e&&e;if(ue(this.wa)||(clearTimeout(this.wa),this.wa=void 0),this.Us.ri(this.la,!1),this.Us.ri(this.la,!0),!i&&this.aa)for(var r of Fn)ys.ri(this.xa(r));i?delete this.ea[ho]:this.ea={},this.ca=void 0,this.fa=void 0}clear(){this.remove(),this.props={}}register_once(t,e,i){if(le(t)){this.syncCookieProperties(),ue(e)&&(e="None"),this.Fa=ue(i)?this.Da:i;var r=!1;if(Qr(t,((t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this.ma(i,t),r=!0)})),r)return this.save(),!0}return!1}register(t,e){if(le(t)){this.syncCookieProperties(),this.Fa=ue(e)?this.Da:e;var i=!1;if(Qr(t,((e,r)=>{t.hasOwnProperty(r)&&(this.props[r]!==e||le(e)||oe(e))&&(this.ma(r,e),i=!0)})),i)return this.save(),!0}return!1}unregister(t){this.syncCookieProperties();var e="string"==typeof t?[t]:t,i=!1;for(var r of e)r in this.props&&(this.ya(r),i=!0);i&&this.save()}update_campaign_params(){var t=null==kt?void 0:kt.URL;if(t!==this.oa){var e=Yn(this.vn.custom_campaign_params,this.vn.mask_personal_data_properties,this.vn.custom_personal_data_properties);he(is(e))||this.register(e),this.oa=t}}update_search_keyword(){var t;this.register((t=null==kt?void 0:kt.referrer)?Xn(t):{})}update_referrer_info(){var t;this.register_once({$referrer:eo(),$referring_domain:null!=kt&&kt.referrer&&(null==(t=Un(kt.referrer))?void 0:t.host)||to},void 0)}set_initial_person_info(){this.props[et]||this.props[it]||this.register_once({[rt]:io(this.vn.mask_personal_data_properties,this.vn.custom_personal_data_properties,this.vn.disable_capture_url_hashes)},void 0)}get_initial_props(){var t={};Qr([it,et],(e=>{var i=this.props[e];i&&Qr(i,(function(e,i){t["$initial_"+ee(i)]=e}))}));var e=this.props[rt];if(e){var i=function(t,e){void 0===e&&(e=!1);var i=ro(t,e),r={};return Qr(i,(function(t,e){r["$initial_"+ee(e)]=t})),r}(e,this.vn.disable_capture_url_hashes);Xr(t,i)}return t}safe_merge(t){return Qr(this.props,(function(e,i){i in t||(t[i]=e)})),t}update_config(t,e,r){var s=t.persistence!==e.persistence,n=!((t,e)=>{if(t.length!==e.length)return!1;var i=[...t].sort(),r=[...e].sort();return i.every(((t,e)=>t===r[e]))})(t.cookie_persisted_properties||[],e.cookie_persisted_properties||[]),o=s||n,a=t.cookieWinsOnConflict!==e.cookieWinsOnConflict,l=t.disable_persistence||!!r,h=!!this.ga&&!l;l||this.pa(e,h),this.vn=t,!l&&(s||n||a)&&(this.ca=void 0,this.fa=void 0,this.pa(i({},t,{cookie_persisted_properties:e.cookie_persisted_properties}),h));var u=o||a?this.ua(t):this.Us,d=this.ha(t),v=o||d!==this.ra,c=!l&&(v||t.cross_subdomain_cookie!==this.Oa||t.secure_cookie!==this.La)&&this.ba(h);try{if(this.Da=this.Fa=t.cookie_expiration,this.set_disabled(l),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),v){var f=this.props;this.clear(),this.Us=u,this.ra=d,this.props=f,this.save()}else a&&(this.Us=u,l||(delete this.ea[ho],this.ka()))}finally{c&&this.Sa()}}set_disabled(t){this.ga=t,this.ga?this.remove():this.save()}set_cross_subdomain(t){t!==this.Oa&&(this.Oa=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.La&&(this.La=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,e){var i=this.props[u]||{};i[t]=e,this.ma(u,i),this.save()}remove_event_timer(t){var e=this.props[u]||{},i=e[t];return ue(i)||(delete e[t],this.ma(u,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this.ma(t,e),this.save()}ma(t,e){var i;this.props[t]=e,null!=(i=Nn(t))&&i.volatile||this.$a(t)}ya(t){delete this.props[t],this.$a(t)}$a(t){var e,i=null==(e=Nn(t))?void 0:e.storageGroup;i&&(this.Ma(i).dirty=!0)}Ma(t){return this.ea[t]||(this.ea[t]={})}}function co(t){var e=!0;return{dispose(){if(e){e=!1;var i=t();i&&ae(i.then)&&i.then(void 0,(()=>{}))}}}}var fo={GZipJS:"gzip-js",Base64:"base64"},po={Activation:"events",Cancellation:"cancelEvents"},_o={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},go={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},mo={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"},yo={Popover:"popover",Inline:"inline"},bo={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"},wo={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"},xo=Jr("[RateLimiter]");class Eo{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var e=t.text;if(e&&e.length)try{(JSON.parse(e).quota_limited||[]).forEach((t=>{xo.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void xo.warn('could not rate limit - continuing. Error: "'+(null==t?void 0:t.message)+'"',{text:e})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return(null==(t=this.instance.config.rate_limiting)?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null==(t=this.instance.config.rate_limiting)?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var e,i,r;void 0===t&&(t=!1);var s=this.captureEventsBurstLimit,n=this.captureEventsPerSecond,o=(new Date).getTime(),a=null!==(e=null==(i=this.instance.persistence)?void 0:i.get_property(tt))&&void 0!==e?e:{tokens:s,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>s&&(a.tokens=s);var l=1>a.tokens;if(l||t||(a.tokens=Math.max(0,a.tokens-1)),l&&!t){var h=(pe(a.dropped)?a.dropped:0)+1;a.dropped=h,!this.lastEventRateLimited&&this.Na(h)&&(a.dropped=0)}return this.lastEventRateLimited=l,null==(r=this.instance.persistence)||r.set_property(tt,a),{isRateLimited:l,remainingTokens:a.tokens}}qa(t){var e=this.instance.config.property_denylist;return!oe(e)||!e.includes(t)}ja(){var t;if(this.qa("$current_url")&&this.qa("$pathname")&&null!=Tt&&Tt.pathname)return""+(null!==(t=Tt.origin)&&void 0!==t?t:"")+Tt.pathname}Na(t){var e,i,r=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,n=this.ja(),o=this.qa("$session_id")?null==(e=(i=this.instance).get_session_id)?void 0:e.call(i):void 0,a=[t+" event(s) dropped since the last warning",n?"triggered on "+n:void 0,o?"session "+o:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited: "+a+". Config is set to "+s+" events per second and "+r+" events burst limit."},{skip_client_rate_limiting:!0})}isServerRateLimited(t){var e=this.serverLimits[t||"events"]||!1;return!1!==e&&(new Date).getTime()<e}}var So=Jr("[RemoteConfig]");class ko{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=Ft._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}Ba(t){var e,i;null!=(e=Ft.__PosthogExtensions__)&&e.loadExternalDependency?null==(i=Ft.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}Ha(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t})}load(){try{if(this.remoteConfig)return So.info("Using preloaded remote config",this.remoteConfig),void this.za(this.remoteConfig);if(this._instance.Ua())return void So.warn("Remote config is disabled. Falling back to local config.");this.Ba((t=>{if(!t)return So.info("No config found after loading remote JS config. Falling back to JSON."),void this.Ha((t=>{this.za(t.json,t)}));this.za(t)}))}catch(t){So.error("Error loading remote config",t),this.za()}}za(t,e){!t&&e&&(0===e.statusCode?e.error||So.warn("Failed to fetch remote config from PostHog."):So.error("Failed to fetch remote config from PostHog."));try{this._instance.za(t?{ok:!0,config:t}:{ok:!1})}catch(t){So.error("Error applying remote config",t)}if(!1!==(null==t?void 0:t.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var i;null==(i=this._instance.featureFlags)||i.ensureFlagsLoaded()}catch(t){So.error("Error loading feature flags",t)}}}var To=Uint8Array,$o=Uint16Array,Po=Uint32Array,Ro=new To([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]),Co=new To([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]),Oo=new To([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Io=function(t,e){for(var i=new $o(31),r=0;31>r;++r)i[r]=e+=1<<t[r-1];var s=new Po(i[30]);for(r=1;30>r;++r)for(var n=i[r];i[r+1]>n;++n)s[n]=n-i[r]<<5|r;return[i,s]},Ao=Io(Ro,2),Fo=Ao[1];Ao[0][28]=258,Fo[258]=28;for(var Mo=Io(Co,0)[1],Do=new $o(32768),No=0;32768>No;++No){var Lo=(43690&No)>>>1|(21845&No)<<1;Do[No]=((65280&(Lo=(61680&(Lo=(52428&Lo)>>>2|(13107&Lo)<<2))>>>4|(3855&Lo)<<4))>>>8|(255&Lo)<<8)>>>1}var Uo=function(t,e,i){for(var r=t.length,s=0,n=new $o(e);r>s;++s)++n[t[s]-1];var o,a=new $o(e);for(s=0;e>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new $o(1<<e);var l=15-e;for(s=0;r>s;++s)if(t[s])for(var h=s<<4|t[s],u=e-t[s],d=a[t[s]-1]++<<u,v=d|(1<<u)-1;v>=d;++d)o[Do[d]>>>l]=h}else for(o=new $o(r),s=0;r>s;++s)o[s]=Do[a[t[s]-1]++]>>>15-t[s];return o},jo=new To(288);for(No=0;144>No;++No)jo[No]=8;for(No=144;256>No;++No)jo[No]=9;for(No=256;280>No;++No)jo[No]=7;for(No=280;288>No;++No)jo[No]=8;var Bo=new To(32);for(No=0;32>No;++No)Bo[No]=5;var zo=Uo(jo,9,0),qo=Uo(Bo,5,0),Ho=function(t){return(t/8>>0)+(7&t&&1)},Vo=function(t,e,i){(null==i||i>t.length)&&(i=t.length);var r=new(t instanceof $o?$o:t instanceof Po?Po:To)(i-e);return r.set(t.subarray(e,i)),r},Wo=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8},Go=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8,t[r+2]|=i>>>16},Ko=function(t,e){for(var i=[],r=0;t.length>r;++r)t[r]&&i.push({s:r,f:t[r]});var s=i.length,n=i.slice();if(!s)return[new To(0),0];if(1==s){var o=new To(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort((function(t,e){return t.f-e.f})),i.push({s:-1,f:25001});var a=i[0],l=i[1],h=0,u=1,d=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=s-1;)a=i[i[d].f>i[h].f?h++:d++],l=i[h!=u&&i[d].f>i[h].f?h++:d++],i[u++]={s:-1,f:a.f+l.f,l:a,r:l};var v=n[0].s;for(r=1;s>r;++r)n[r].s>v&&(v=n[r].s);var c=new $o(v+1),f=Jo(i[u-1],c,0);if(f>e){r=0;var p=0,_=f-e,g=1<<_;for(n.sort((function(t,e){return c[e.s]-c[t.s]||t.f-e.f}));s>r;++r){var m=n[r].s;if(e>=c[m])break;p+=g-(1<<f-c[m]),c[m]=e}for(p>>>=_;p>0;){var y=n[r].s;e>c[y]?p-=1<<e-c[y]++-1:++r}for(;r>=0&&p;--r){var b=n[r].s;c[b]==e&&(--c[b],++p)}f=e}return[new To(c),f]},Jo=function(t,e,i){return-1==t.s?Math.max(Jo(t.l,e,i+1),Jo(t.r,e,i+1)):e[t.s]=i},Yo=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new $o(++e),r=0,s=t[0],n=1,o=function(t){i[r++]=t},a=1;e>=a;++a)if(t[a]==s&&a!=e)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=t[a]}return[i.subarray(0,r),e]},Qo=function(t,e){for(var i=0,r=0;e.length>r;++r)i+=t[r]*e[r];return i},Xo=function(t,e,i){var r=i.length,s=Ho(e+2);t[s]=255&r,t[s+1]=r>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var n=0;r>n;++n)t[s+n+4]=i[n];return 8*(s+4+r)},Zo=function(t,e,i,r,s,n,o,a,l,h,u){Wo(e,u++,i),++s[256];for(var d=Ko(s,15),v=d[0],c=d[1],f=Ko(n,15),p=f[0],_=f[1],g=Yo(v),m=g[0],y=g[1],b=Yo(p),w=b[0],x=b[1],E=new $o(19),S=0;m.length>S;++S)E[31&m[S]]++;for(S=0;w.length>S;++S)E[31&w[S]]++;for(var k=Ko(E,7),T=k[0],P=k[1],R=19;R>4&&!T[Oo[R-1]];--R);var C,O,I,A,F=h+5<<3,M=Qo(s,jo)+Qo(n,Bo)+o,D=Qo(s,v)+Qo(n,p)+o+14+3*R+Qo(E,T)+(2*E[16]+3*E[17]+7*E[18]);if(M>=F&&D>=F)return Xo(e,u,t.subarray(l,l+h));if(Wo(e,u,1+(M>D)),u+=2,M>D){C=Uo(v,c,0),O=v,I=Uo(p,_,0),A=p;var N=Uo(T,P,0);for(Wo(e,u,y-257),Wo(e,u+5,x-1),Wo(e,u+10,R-4),u+=14,S=0;R>S;++S)Wo(e,u+3*S,T[Oo[S]]);u+=3*R;for(var L=[m,w],U=0;2>U;++U){var j=L[U];for(S=0;j.length>S;++S)Wo(e,u,N[B=31&j[S]]),u+=T[B],B>15&&(Wo(e,u,j[S]>>>5&127),u+=j[S]>>>12)}}else C=zo,O=jo,I=qo,A=Bo;for(S=0;a>S;++S)if(r[S]>255){var B;Go(e,u,C[257+(B=r[S]>>>18&31)]),u+=O[B+257],B>7&&(Wo(e,u,r[S]>>>23&31),u+=Ro[B]);var z=31&r[S];Go(e,u,I[z]),u+=A[z],z>3&&(Go(e,u,r[S]>>>5&8191),u+=Co[z])}else Go(e,u,C[r[S]]),u+=O[r[S]];return Go(e,u,C[256]),u+O[256]},ta=new Po([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ea=function(){for(var t=new Po(256),e=0;256>e;++e){for(var i=e,r=9;--r;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),ia=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function ra(t,e){void 0===e&&(e={});var i=function(){var t=4294967295;return{p(e){for(var i=t,r=0;e.length>r;++r)i=ea[255&i^e[r]]^i>>>8;t=i},d(){return 4294967295^t}}}(),r=t.length;i.p(t);var s,n,o,a,l,h=(a=10+((s=e).filename&&s.filename.length+1||0),l=8,function(t,e,i,r,s,n){var o=t.length,a=new To(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),h=0;if(!e||8>o)for(var u=0;o>=u;u+=65535){var d=u+65535;o>d?h=Xo(l,h,t.subarray(u,d)):(l[u]=!0,h=Xo(l,h,t.subarray(u,o)))}else{for(var v=ta[e-1],c=v>>>13,f=8191&v,p=(1<<i)-1,_=new $o(32768),g=new $o(p+1),m=Math.ceil(i/3),y=2*m,b=function(e){return(t[e]^t[e+1]<<m^t[e+2]<<y)&p},w=new Po(25e3),x=new $o(288),E=new $o(32),S=0,k=0,T=(u=0,0),P=0,R=0;o>u;++u){var C=b(u),O=32767&u,I=g[C];if(_[O]=I,g[C]=O,u>=P){var A=o-u;if((S>7e3||T>24576)&&A>423){h=Zo(t,l,0,w,x,E,k,T,R,u-R,h),T=S=k=0,R=u;for(var F=0;286>F;++F)x[F]=0;for(F=0;30>F;++F)E[F]=0}var M=2,D=0,N=f,L=O-I&32767;if(A>2&&C==b(u-L))for(var U=Math.min(c,A)-1,j=Math.min(32767,u),B=Math.min(258,A);j>=L&&--N&&O!=I;){if(t[u+M]==t[u+M-L]){for(var z=0;B>z&&t[u+z]==t[u+z-L];++z);if(z>M){if(M=z,D=L,z>U)break;var q=Math.min(L,z-2),H=0;for(F=0;q>F;++F){var V=u-L+F+32768&32767,W=V-_[V]+32768&32767;W>H&&(H=W,I=V)}}}L+=(O=I)-(I=_[O])+32768&32767}if(D){w[T++]=268435456|Fo[M]<<18|Mo[D];var G=31&Fo[M],K=31&Mo[D];k+=Ro[G]+Co[K],++x[257+G],++E[K],P=u+M,++S}else w[T++]=t[u],++x[t[u]]}}h=Zo(t,l,!0,w,x,E,k,T,R,u-R,h)}return Vo(a,0,r+Ho(h)+s)}(n=t,null==(o=e).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+o.mem,a,l)),u=h.length;return function(t,e){var i=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>e.level?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&ia(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),i){t[3]=8;for(var r=0;i.length>=r;++r)t[r+10]=i.charCodeAt(r)}}(h,e),ia(h,u-8,i.d()),ia(h,u-4,r),h}var sa=!!Pt||!!$t,na="text/plain",oa=!1,aa=(t,e)=>{var i=t.split("#"),r=i[1],s=i[0].split("?"),n=s[0],o=s[1];if(!o)return t;var a=o.split("&").filter((t=>t.split("=")[0]!==e)).join("&");return n+(a?"?"+a:"")+(r?"#"+r:"")},la=function(t,e,r){var s;void 0===r&&(r=!0);var n=t.split("?"),o=n[0],a=n[1],l=i({},e),h=null!==(s=null==a?void 0:a.split("&").map((t=>{var e,i=t.split("="),s=i[0],n=r&&null!==(e=l[s])&&void 0!==e?e:i[1];return delete l[s],s+"="+n})))&&void 0!==s?s:[],u=function(t,e){var i,r;void 0===e&&(e="&");var s=[];return Qr(t,(function(t,e){ue(t)||ue(e)||"undefined"===e||(i=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),r=encodeURIComponent(e),s[s.length]=r+"="+i)})),s.join(e)}(l);return u&&h.push(u),h.length>0?o+"?"+h.join("&"):o},ha=t=>{if(t.Wa)return t.Wa;var e=t.data,i=t.compression;if(e){if(i===fo.GZipJS){var r=ra(function(t,e){var i=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new To(t.length+(t.length>>>1)),s=0,n=function(t){r[s++]=t},o=0;i>o;++o){if(s+5>r.length){var a=new To(s+8+(i-o<<1));a.set(r),r=a}var l=t.charCodeAt(o);128>l?n(l):2048>l?(n(192|l>>>6),n(128|63&l)):l>55295&&57344>l?(n(240|(l=65536+(1047552&l)|1023&t.charCodeAt(++o))>>>18),n(128|l>>>12&63),n(128|l>>>6&63),n(128|63&l)):(n(224|l>>>12),n(128|l>>>6&63),n(128|63&l))}return Vo(r,0,s)}(Ln(e)),{mtime:0});return{contentType:na,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===fo.Base64){var s=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,e)=>String.fromCharCode(parseInt(e,16))))):t}(Ln(e)),n=(t=>"data="+encodeURIComponent("string"==typeof t?t:Ln(t)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=Ln(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},ua=t=>{var e,r,s=()=>"sendBeacon"===t.transport?{url:la(t.url,{compression:fo.Base64}),encodedBody:ha(i({},t,{compression:fo.Base64,Wa:void 0}))}:{url:aa(t.url,"compression"),encodedBody:ha(i({},t,{compression:void 0,Wa:void 0}))};try{e=ha(t)}catch(e){if(Vi(t.compression,jn(t.url,"compression")))return Kr.error("Failed to gzip request body, sending uncompressed payload",e),s();throw e}return e&&Vi(t.compression,jn(t.url,"compression"))&&!((r=e.body)instanceof ArrayBuffer?Hi(new Uint8Array(r)):ArrayBuffer.isView(r)&&Hi(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)))?(oa=!0,s()):{url:t.url,encodedBody:e}},da=t=>{try{return ua(t)}catch(e){return Kr.error(e),void(null==t.callback||t.callback({statusCode:0,error:e}))}},va=function(){var t=e((function*(t){var e=Ln(t.data),r=yield function(t,e,i){return Ji.apply(this,arguments)}(e,s.DEBUG,{rethrow:!0});if(!r)return t;var n=yield r.arrayBuffer();return i({},t,{Wa:{contentType:na,body:n,estimatedSize:n.byteLength}})}));return function(e){return t.apply(this,arguments)}}(),ca=/Failed to fetch|NetworkError|Load failed/i,fa=t=>"TypeError"===(null==t?void 0:t.name)&&ca.test((null==t?void 0:t.message)||""),pa=t=>{var e=da(t);if(e){var r=e.url,s=e.encodedBody,n=null!=s?s:{},o=n.contentType,a=n.body,l=n.estimatedSize,h=new Headers;Qr(t.headers,(function(t,e){h.append(e,t)})),o&&h.append("Content-Type",o);var u=null,d=!1;if(Rt){var v=new Rt;u={signal:v.signal,timeout:setTimeout((()=>{var e;d=!0,v.abort(Ni("AbortError","PostHog request timed out"+((e=t.timeout)?" after "+e+"ms":"")))}),t.timeout)}}var c=e=>{d&&"AbortError"===(null==e?void 0:e.name)||fa(e)?Kr.warn(e):Kr.error(e),null==t.callback||t.callback({statusCode:0,error:e})};try{var f;$t(r,i({method:(null==t?void 0:t.method)||"GET",headers:h,keepalive:"POST"===t.method&&!t.Va&&52428.8>(l||0),body:a,signal:null==(f=u)?void 0:f.signal},t.fetchOptions)).then((e=>e.text().then((i=>{var r={statusCode:e.status,text:i};if(200===e.status)try{r.json=JSON.parse(i)}catch(t){Kr.error(t)}null==t.callback||t.callback(r)})))).catch(c).finally((()=>u?clearTimeout(u.timeout):null))}catch(t){u&&clearTimeout(u.timeout),c(t)}}},_a=t=>{try{var e,r=ua(t),s=r.url,n=r.encodedBody,o=null!=n?n:{},a=o.body,l=o.estimatedSize;if(!a)return;var h=a instanceof Blob?a:new Blob([a],{type:o.contentType});if(St.sendBeacon(s,h))return;var u=oe(t.data)?t.data:null==(e=t.data)?void 0:e.batch;if(oe(u)&&u.length>1&&(null!=l?l:0)>16384){var d=Math.ceil(u.length/2),v=e=>oe(t.data)?e:i({},t.data,{batch:e});return _a(i({},t,{data:v(u.slice(0,d))})),void _a(i({},t,{data:v(u.slice(d))}))}Kr.warn("Beacon of ~"+(null!=l?l:0)+" bytes was rejected by the browser, falling back to fetch"),pa(i({},t,{Va:!0}))}catch(t){Kr.warn("Beacon send failed",t)}},ga=(t,e,r,s)=>{var n="query"===s?"POST"===e?"sent_at":"_":void 0;return la(r===fo.GZipJS?aa(t,"compression"):t,i({},n?{[n]:Date.now().toString()}:{},r===fo.GZipJS?{}:{compression:r}))},ma=[];$t&&ma.push({transport:"fetch",method:pa}),Pt&&ma.push({transport:"XHR",method(t){var e=da(t);if(e){var i=new Pt,r=e.encodedBody;i.open(t.method||"GET",e.url,!0);var s=null!=r?r:{},n=s.contentType,o=s.body;Qr(t.headers,(function(t,e){i.setRequestHeader(e,t)})),n&&i.setRequestHeader("Content-Type",n),t.timeout&&(i.timeout=t.timeout),i.onreadystatechange=()=>{if(4===i.readyState){var e={statusCode:i.status,text:i.responseText};if(200===i.status)try{e.json=JSON.parse(i.responseText)}catch(t){}null==t.callback||t.callback(e)}},i.send(o)}}}),null!=St&&St.sendBeacon&&ma.push({transport:"sendBeacon",method:_a});var ya=3e3;class ba{constructor(t,e){this.Ga=!0,this.Za=[],this.Qa=Re((null==e?void 0:e.flush_interval_ms)||ya,250,5e3,Kr.createLogger("flush interval"),ya),this.Ja=t}enqueue(t){this.Za.push(t),this.Ka||this.Ya()}unload(){this.Xa();var t=this.Za.length>0?this.eo():{},e=Object.values(t);[...e.filter((t=>0===t.url.indexOf("/e"))),...e.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.io(i({},t,{transport:"sendBeacon"}))}))}enable(){this.Ga=!1,this.Ya()}Ya(){var t=this;this.Ga||(this.Ka=setTimeout((()=>{if(this.Xa(),this.Za.length>0){var e=this.eo(),i=function(){var i=e[r],s=(new Date).getTime();i.data&&oe(i.data)&&Qr(i.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.io(i)};for(var r in e)i()}}),this.Qa))}io(t){try{this.Ja(t)}catch(t){Kr.error(t)}}Xa(){clearTimeout(this.Ka),this.Ka=void 0}eo(){var t={};return Qr(this.Za,(e=>{var r,s=e,n=(s?s.batchKey:null)||s.url;ue(t[n])&&(t[n]=i({},s,{data:[]})),null==(r=t[n].data)||r.push(s.data)})),this.Za=[],t}}var wa=["retriesPerformedSoFar"];class xa{constructor(t){this.ro=!1,this.no=3e3,this.Za=[],this._instance=t,this.Za=[],this.so=!0,!ue(xt)&&"onLine"in xt.navigator&&(this.so=xt.navigator.onLine,this.ao=()=>{this.so=!0,this.oo()},this.lo=()=>{this.so=!1},ns(xt,"online",this.ao),ns(xt,"offline",this.lo))}get length(){return this.Za.length}retriableRequest(t){var e=t.retriesPerformedSoFar,s=r(t,wa);_e(e)&&(s.url=la(s.url,{retry_count:e})),this._instance._send_request(i({},s,{callback:t=>{if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=e?e:0))return void this.Yn(i({retriesPerformedSoFar:e},s));0===t.statusCode&&Kr.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(null!=e?e:0)+" retries.")}null==s.callback||s.callback(t)}}))}Yn(t){var e=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=e+1;var i=function(t){var e=3e3*Math.pow(2,t),i=e/2,r=Math.min(18e5,e),s=Math.random()-.5;return Math.ceil(r+s*(r-i))}(e),r=Date.now()+i;this.Za.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+i;navigator.onLine||(s+=" (Browser is offline)"),Kr.warn(s),this.ro||(this.ro=!0,this.uo())}uo(){if(this.ho&&clearTimeout(this.ho),0===this.Za.length)return this.ro=!1,void(this.ho=void 0);this.ho=setTimeout((()=>{this.so&&this.Za.length>0&&this.oo(),this.uo()}),this.no)}oo(){var t=Date.now(),e=[],i=this.Za.filter((i=>t>i.retryAt||(e.push(i),!1)));if(this.Za=e,i.length>0)for(var r of i)this.retriableRequest(r.requestOptions)}unload(){for(var t of(this.ho&&(clearTimeout(this.ho),this.ho=void 0),this.ro=!1,ue(xt)||(this.ao&&(xt.removeEventListener("online",this.ao),this.ao=void 0),this.lo&&(xt.removeEventListener("offline",this.lo),this.lo=void 0)),this.Za)){var e=t.requestOptions;try{this._instance._send_request(i({},e,{transport:"sendBeacon"}))}catch(t){Kr.error(t)}}this.Za=[]}}class Ea{constructor(t){this.do=()=>{var t,e,i,r;this.vo||(this.vo={});var s=this.scrollElement(),n=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=n+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;this.vo.lastScrollY=Math.ceil(n),this.vo.maxScrollY=Math.max(n,null!==(t=this.vo.maxScrollY)&&void 0!==t?t:0),this.vo.maxScrollHeight=Math.max(o,null!==(e=this.vo.maxScrollHeight)&&void 0!==e?e:0),this.vo.lastContentY=a,this.vo.maxContentY=Math.max(a,null!==(i=this.vo.maxContentY)&&void 0!==i?i:0),this.vo.maxContentHeight=Math.max(l,null!==(r=this.vo.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}get co(){return this._instance.config.scroll_root_selector}getContext(){return this.vo}resetContext(){var t=this.vo;return setTimeout(this.do,0),t}startMeasuringScrollPosition(){ns(xt,"scroll",this.do,{capture:!0}),ns(xt,"scrollend",this.do,{capture:!0}),ns(xt,"resize",this.do)}scrollElement(){if(!this.co)return null==xt?void 0:xt.document.documentElement;var t=oe(this.co)?this.co:[this.co];for(var e of t){var i=null==xt?void 0:xt.document.querySelector(e);if(i)return i}}fo(t){var e="y"===t?"scrollTop":"scrollLeft";if(this.co){var i=this.scrollElement();return i&&i[e]||0}return xt?"y"===t?xt.scrollY||xt.pageYOffset||xt.document.documentElement.scrollTop||0:xt.scrollX||xt.pageXOffset||xt.document.documentElement.scrollLeft||0:0}scrollY(){return this.fo("y")}scrollX(){return this.fo("x")}}var Sa=t=>io(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties,null==t?void 0:t.config.disable_capture_url_hashes);class ka{constructor(t,e,i,r){this.xt=t=>{var e=this.po();if(!e||e.sessionId!==t){var i={sessionId:t,props:this.mo(this._instance)};this.yo.register({[Z]:i})}},this._instance=t,this.bo=e,this.yo=i,this.mo=r||Sa,this.bo.onSessionId(this.xt)}po(){return this.yo.props[Z]}getSetOnceProps(){var t,e=null==(t=this.po())?void 0:t.props;return e?"r"in e?ro(e,this._instance.config.disable_capture_url_hashes):{$referring_domain:e.referringDomain,$pathname:e.initialPathName,utm_source:e.utm_source,utm_campaign:e.utm_campaign,utm_medium:e.utm_medium,utm_content:e.utm_content,utm_term:e.utm_term}:{}}getSessionProps(){var t={};return Qr(is(this.getSetOnceProps()),((e,i)=>{"$current_url"===i&&(i="url"),t["$session_entry_"+ee(i)]=e})),t}}class Ta{on(t,e){return this._o[t]||(this._o[t]=[]),this._o[t].push(e),()=>{this._o[t]=this._o[t].filter((t=>t!==e))}}emit(t,e){for(var i of this._o[t]||[])i(e);for(var r of this._o["*"]||[])r(t,e)}constructor(){this._o={}}}var $a=Jr("[SessionId]"),Pa=864e5;class Ra{on(t,e){return this.wo.on(t,e)}constructor(t,e,i){var r;if(this.ko=null,this.So=null,this.xo=[],this.Co=void 0,this.To=!1,this.wo=new Ta,this.Mo=(t,e)=>!(!_e(t)||!_e(e))&&Math.abs(t-e)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===vt)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.vn=t.config,this.yo=t.persistence,this.Ct=void 0,this.Le=void 0,this._sessionStartTimestamp=null,this.Eo=void 0,this._sessionActivityTimestamp=null,this.Io=e||cs,this.Ro=i||cs;var s=this.vn.persistence_name||this.vn.token;if(this._sessionTimeoutMs=1e3*Re(this.vn.session_idle_timeout_seconds||1800,60,36e3,$a.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Po(),this.Ao="ph_"+s+"_window_id",this.Fo="ph_"+s+"_primary_window_exists",this.Oo()){var n=As.ni(this.Ao),o=As.ni(this.Fo);n&&!o?this.Ct=n:As.ri(this.Ao),As.ei(this.Fo,!0)}null!=(r=this.vn.bootstrap)&&r.sessionID&&this.setBootstrapSessionId(this.vn.bootstrap.sessionID),this.Lo()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return ue(this.xo)&&(this.xo=[]),this.xo.push(t),this.Le&&t(this.Le,this.Ct),()=>{this.xo=this.xo.filter((e=>e!==t))}}Oo(){return"memory"!==this.vn.persistence&&!this.yo.ga&&As.Xr()}Do(t){t!==this.Ct&&(this.Ct=t,this.Oo()&&As.ei(this.Ao,t))}$o(){return this.Ct?this.Ct:this.Oo()?As.ni(this.Ao):null}No(t){var e=this.ko;return!ce(e)&&!ce(t)&&5e3>Math.abs(t-e)}qo(t,e,i){var r=e!==this._sessionActivityTimestamp,s=!(t!==this.Le||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=e,this.Le=t,s&&!r||s&&this.No(e)||(this.ko=e,this.yo.register({[P]:[e,t,i]}))}jo(){var t,e=null==(t=this.vn)?void 0:t.persistence_save_debounce_ms;return _e(e)&&e>0}Bo(){this.jo()?this.yo.refreshKey(P):(this.yo.flush(),this.yo.load())}Ho(){var t;if(!ce(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.ko){this.Bo();var e=this.zo();e[1]===this.Le&&e[2]===this._sessionStartTimestamp&&(this.ko=this._sessionActivityTimestamp,this.yo.register({[P]:[this._sessionActivityTimestamp,null!==(t=this.Le)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.yo.flush())}}Uo(){var t=this.zo()[0],e=_e(t)?t:0,i=_e(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(e,i)}Wo(t){return this.Bo(),this.Mo(t,this.Uo())}zo(){var t=this.yo.props[P];return oe(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.ko=null,this.Eo=void 0,clearTimeout(this.Vo),this.Vo=void 0,this.qo(null,null,null)}setBootstrapSessionId(t,e){void 0===e&&(e=!1);var i=function(t,e){void 0===e&&(e=(new Date).getTime());try{var i=(t=>{var e=t.replace(/-/g,"");if(32!==e.length)throw new Error("Not a valid UUID");if("7"!==e[12])throw new Error("Not a UUIDv7");return parseInt(e.substring(0,12),16)})(t);return i>e+6e4?void $a.error("Bootstrap sessionID cannot be in the future"):i}catch(t){return void $a.error("Invalid sessionID in bootstrap",t)}}(t);return!ue(i)&&(e?this.Eo={sessionId:t,sessionStartTimestamp:i}:this.qo(t,(new Date).getTime(),i),!0)}destroy(){this.To=!0,this.Ho(),clearTimeout(this.Vo),this.Vo=void 0,this.Co&&xt&&(xt.removeEventListener(gt,this.Co,{capture:!1}),this.Co=void 0),this.xo=[]}Lo(){this.Co=()=>{this.Ho(),this.Oo()&&As.ri(this.Fo)},ns(xt,gt,this.Co,{capture:!1})}checkAndGetSessionAndWindowId(t,e,i){if(void 0===t&&(t=!1),void 0===e&&(e=null),void 0===i&&(i=!1),this.vn.cookieless_mode===vt)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=e||(new Date).getTime(),s=this.Le;if(i)this.So=r;else if(ce(this.So)||this.So>r||r-this.So>=1e3){var n,o;null==(n=(o=this.yo).syncCookieProperties)||n.call(o),this.So=r}var a=this.zo(),l=a[1],h=a[2],u=!ue(s)&&l!==s,d=this.Uo(),v=this.$o(),c=this.Eo,f=!!c&&(c.sessionStartTimestamp>r+6e4||r-c.sessionStartTimestamp>Pa),p=c?f:_e(h)&&Math.abs(r-h)>Pa,_=!1,g=u,m=!l||!!c,y=l,b=!m&&!t&&this.Mo(r,d);if(b){(b=this.Wo(r))||$a.info("cross-tab refresh kept the session alive",{sessionId:l});var w=this.zo();l=w[1],h=w[2]}if(m||b||p){g=!1;var x=c&&!f;l=x?c.sessionId:this.Io(),v=this.Ro(),$a.info("new session ID assigned",{sessionId:l,windowId:v,bootstrapped:!!x,changeReason:{noSessionId:m,activityTimeout:b,sessionPastMaximumLength:p}}),h=x?c.sessionStartTimestamp:r,this.Eo=void 0,_=!0}else v||(v=this.Ro(),_=!0),(g=g||l!==y)&&($a.info("adopted cross-tab session id",{sessionId:l,windowId:v}),_=!0);var E=_e(d)&&t&&!p?d:r,S=_e(h)?h:(new Date).getTime();this.Do(v),this.qo(l,E,S),t||this.Po();var k={noSessionId:m,activityTimeout:b,sessionPastMaximumLength:p,crossTabAdoption:g};return _&&this.xo.forEach((t=>t(l,v,k))),{sessionId:l,windowId:v,sessionStartTimestamp:S,changeReason:_?k:void 0,lastActivityTimestamp:d}}Po(){this.To||(clearTimeout(this.Vo),this.Vo=setTimeout((()=>{if(!this.To)if(this.Wo((new Date).getTime())){var t=this.Le;this.resetSessionId(),this.wo.emit("forcedIdleReset",{idleSessionId:t})}else this.Po()}),1.1*this.sessionTimeoutMs))}}var Ca=function(t,e){if(!t)return!1;var i=t.userAgent;if(i&&Xt(i,e))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>Xt(null==t?void 0:t.brand,e))))return!0}catch(t){}return!!t.webdriver};function Oa(){return(Oa=e((function*(){var t=null==St?void 0:St.userAgentData;if(null!=t&&t.getHighEntropyValues)try{var e=yield t.getHighEntropyValues(["model"]),i=null==e?void 0:e.model;return de(i)&&i.length>0?i:void 0}catch(t){return void Kr.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}}))).apply(this,arguments)}function Ia(t){var e;return!(null==(e=t.conditions)||null==(e=e.events)||null==(e=e.values)||!e.length)}var Aa=(t,e)=>{if(!(t=>{try{new RegExp(t)}catch(t){return!1}return!0})(e))return!1;try{return new RegExp(e).test(t)}catch(t){return!1}},Fa=t=>t.toLowerCase(),Ma={exact:(t,e)=>e.some((e=>t.some((t=>e===t)))),is_not:(t,e)=>e.every((e=>t.every((t=>e!==t)))),regex:(t,e)=>e.some((e=>t.some((t=>Aa(e,t))))),not_regex:(t,e)=>e.every((e=>t.every((t=>!Aa(e,t))))),icontains:(t,e)=>e.map(Fa).some((e=>t.map(Fa).some((t=>e.includes(t))))),not_icontains:(t,e)=>e.map(Fa).every((e=>t.map(Fa).every((t=>!e.includes(t))))),gt:(t,e)=>e.some((e=>{var i=parseFloat(e);return!isNaN(i)&&t.some((t=>i>parseFloat(t)))})),lt:(t,e)=>e.some((e=>{var i=parseFloat(e);return!isNaN(i)&&t.some((t=>i<parseFloat(t)))}))};function Da(t,e){return!t||Object.entries(t).every((t=>{var i=t[1],r=null==e?void 0:e[t[0]];if(null==r)return!1;var s=Ma[i.operator];return!!s&&s(i.values,[String(r)])}))}function Na(t,e,i){return Ln({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}var La="custom",Ua="i.posthog.com",ja=/^\/static\//,Ba=["/s/","/e/","/i/"];class za{constructor(t){this.Go={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,e=null==(t=this.instance.config.ui_host)?void 0:t.replace(/\/$/,"");return e||(e=this.apiHost.replace("."+Ua,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}get region(){return this.Go[this.apiHost]||(this.Go[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":La),this.Go[this.apiHost]}Zo(t){if(ja.test(t)){var e=this.instance.config.asset_host;if("string"==typeof e)return e.trim().replace(/\/$/,"")||void 0}}Qo(t){var e=Un(t);return e?e.protocol+"//"+e.host+e.pathname:void 0}Jo(t,e,i){if("ui"===t)return i;var r=i,s=this.instance.config.rewriteRequestPath;if(s){var n,o=(null==(n=Un(i))?void 0:n.href)||i;r=s(new URL(o)).toString()}if(s&&"api"===t&&Ba.some((t=>0===e.indexOf(t)))){var a=this.Qo(r);if(a){var l,h=this.apiHost,u=this.Ko;(null==(l=u)?void 0:l.apiHost)===h&&u.rewriteRequestPath===s||(u={apiHost:h,rewriteRequestPath:s,urls:new Set},this.Ko=u),u.urls.add(a)}}return r}isIngestionEndpoint(t){var e=this.Ko,i=this.Qo(t);return(null==e?void 0:e.apiHost)===this.apiHost&&e.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!i&&e.urls.has(i)}endpointFor(t,e){if(void 0===e&&(e=""),e&&(e="/"===e[0]?e:"/"+e),"ui"===t)return this.Jo(t,e,this.uiHost+e);if("flags"===t)return this.Jo(t,e,this.flagsApiHost+e);if("assets"===t){var i=this.Zo(e);if(i)return this.Jo(t,e,""+i+e)}if(this.region===La)return this.Jo(t,e,this.apiHost+e);var r=Ua+e;switch(t){case"assets":return this.Jo(t,e,"https://"+this.region+"-assets."+r);case"api":return this.Jo(t,e,"https://"+this.region+"."+r)}}}var qa=Jr("[Surveys]"),Ha="seenSurvey_",Va=t=>{try{var e=(t=>((t,e)=>""+Ha+function(t){return t.current_iteration&&t.current_iteration>0?t.id+"_"+t.current_iteration:t.id}(e))(0,t))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(t){qa.error("Failed to persist survey seen state",t)}},Wa=[_o.Popover,_o.Widget,_o.API],Ga={ignoreConditions:!1,ignoreDelay:!1,displayType:yo.Popover},Ka=Jr("[PostHog ExternalIntegrations]"),Ja={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Ya{constructor(t){this._instance=t}Zs(t,e){var i;null==(i=Ft.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,t,(t=>{if(t)return Ka.error("failed to load script",t);e()}))}startIfEnabledOrStop(){var t=this,e=function(){var e,r,s,n=i[0],o=i[1];!o||null!=(e=Ft.__PosthogExtensions__)&&null!=(e=e.integrations)&&e[n]||t.Zs(Ja[n],(()=>{var e;null==(e=Ft.__PosthogExtensions__)||null==(e=e.integrations)||null==(e=e[n])||e.start(t._instance)})),!o&&null!=(r=Ft.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[n]&&(null==(s=Ft.__PosthogExtensions__)||null==(s=s.integrations)||null==(s=s[n])||s.stop())};for(var i of Object.entries(null!==(r=this._instance.config.integrations)&&void 0!==r?r:{})){var r;e()}}}class Qa{constructor(t,e){this.I=t,this.Os=e,this.Yo=new Map,this.Rs=!1}add(t){var i=this;return e((function*(){if(i.Rs)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(i.Yo.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');i.Yo.set(t.name,t);try{var e=t.setup(i.Os);e&&(yield e)}catch(e){var r=i.Yo.get(t.name)===t;r&&i.Yo.delete(t.name),i.I.error('Failed to set up browser extension "'+t.name+'"',e),r&&i.Xo(t)}}))()}getExtension(t){return this.Yo.get(t)}dispose(){if(!this.Rs){this.Rs=!0;var t=Array.from(this.Yo.values()).reverse();for(var e of(this.Yo.clear(),t))this.Xo(e)}}Xo(t){try{var e=null==t.dispose?void 0:t.dispose();e&&ae(e.then)&&e.then(void 0,(e=>{this.I.error('Failed to dispose browser extension "'+t.name+'"',e)}))}catch(e){this.I.error('Failed to dispose browser extension "'+t.name+'"',e)}}}class Xa{constructor(t){this._instance=t}initialize(){}get(t){var e=this._instance.persistence;if("string"==typeof t)return null==e?void 0:e.get_property(t);var i={};for(var r of t){var s=null==e?void 0:e.get_property(r);ue(s)||(i[r]=s)}return i}set(t,e){var i;null==(i=this._instance.persistence)||i.register("string"==typeof t?{[t]:e}:t)}remove(t){var e;null==(e=this._instance.persistence)||e.unregister(t)}}var Za="extensionsRemoteConfig";class tl{constructor(t){this.Rs=!1,this.instance=t,this.I=Kr,this.tl=t.el,this.kv=new Xa(t),this.onEvent=t=>co(this.instance.on("eventCaptured",(e=>{try{t({event:e.event,properties:e.properties})}catch(t){this.I.error("Browser extension event listener failed",t)}}))),this.onRemoteConfig=t=>{if(this.Rs)return co((()=>{}));var e=e=>{try{t(e)}catch(t){this.I.error("Browser extension remote config listener failed",t)}},i=this.instance.il.on(Za,e);return this.tl&&e(this.tl),co(i)},this.rl=new Qa(Kr.createLogger("[BrowserExtensions]"),this)}get logger(){return this.I}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return null!==(t=this.instance.get_property(a))&&void 0!==t?t:this.distinctId}get deviceId(){var t=this.instance.get_property(a);return"string"==typeof t?t:void 0}get library(){return{name:s.LIB_NAME,version:s.LIB_VERSION}}get initialPersonProperties(){var t,e;return null!==(t=null==(e=this.instance.persistence)?void 0:e.get_initial_props())&&void 0!==t?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,e,i,r,s=null==(t=this.instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(e=null==s?void 0:s.sessionId)&&void 0!==e?e:"",windowId:null!==(i=null==s?void 0:s.windowId)&&void 0!==i?i:"",sessionStartTimestamp:null!==(r=null==s?void 0:s.sessionStartTimestamp)&&void 0!==r?r:0}}catch(t){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(t){return this.rl.add(t)}getExtension(t){return this.rl.getExtension(t)}capture(t,i,r){var s=this;return e((function*(){r?s.instance.capture(t,i,{timestamp:r.timestamp,uuid:r.uuid,$set:r.set,$set_once:r.setOnce}):s.instance.capture(t,i)}))()}registerDynamicEventProperties(t){return co(this.instance.nl(t))}handleRemoteConfig(t){this.Rs||(this.tl=t,this.instance.il.emit(Za,t))}sendRequest(t,i){var r=this;return e((function*(){var e;void 0===i&&(i={});var s=r.instance.requestRouter.endpointFor(null!==(e=i.target)&&void 0!==e?e:"api",t),n={method:i.method,url:i.query?la(s,i.query):s,data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,compressionFallback:"flags"===i.target&&"best-available"===i.compression?jt.Base64:void 0,timestampMode:i.sentAt};return"sendBeacon"===i.transport?(r.instance._send_request(n),{statusCode:202}):new Promise((t=>{n.callback=t,r.instance._send_request(n)}))}))()}dispose(){this.Rs||(this.Rs=!0,this.rl.dispose())}}var el={},il=0,rl=()=>{},sl='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',nl="Surveys module not available",ol="sanitize_properties is deprecated. Use before_send instead",al="Invalid value for property_denylist config: ",ll=["token","distinct_id",ot],hl="posthog",ul=!sa&&-1===(null==Ot?void 0:Ot.indexOf("MSIE"))&&-1===(null==Ot?void 0:Ot.indexOf("Mozilla")),dl=t=>{var e={};return t&&"unset"!==t?("2025-11-30">t||(e.strictMinimumDuration=!0),"2026-05-30">t||(e.canvasCapture={resolutionScale:.6}),"2026-06-25">t||(e.streamNetworkBody=!0),"2026-08-30">t||(e.captureJsonLd=!0),e):e},vl=t=>{var e;return i({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:ss(null==kt?void 0:kt.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:rl,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=t?t:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:Tt&&de(null==Tt?void 0:Tt.search)&&-1!==Tt.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,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:"https:"===(null==xt||null==(e=xt.location)?void 0:e.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(t){Kr.error("Bad HTTP status: "+t.statusCode+" "+t.text)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:pt,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:ya},error_tracking:{},_onCapture:rl},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:sn,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:dl(t),external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body",internal_or_test_user_hostname:t&&t>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:t&&t>="2026-05-30"?250:0,split_storage:!(!t||"2026-05-30">t),detect_google_search_app:!(!t||"2026-05-30">t),disable_capture_url_hashes:!(!t||"2026-06-25">t),cookieWinsOnConflict:!(!t||"unset"===t||"2026-08-29">t)}))(t))},cl=[["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"]],fl=t=>{var e={};for(var i of cl){var r=i[0],s=i[1];ue(t[r])||(e[s]=t[r])}var n=Xr({},e,t),o=t.__preview_external_dependency_versioned_paths;return ue(o)||(ue(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),de(o)&&ue(t.asset_host)&&(n.asset_host=o)),oe(t.property_blacklist)&&(ue(t.property_denylist)?n.property_denylist=t.property_blacklist:oe(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:Kr.error(al+t.property_denylist)),n};class pl{constructor(){this.__forceAllowLocalhost=!1}get sl(){return this.__forceAllowLocalhost}set sl(t){Kr.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class _l{al(t,e){if(t){var i=this.Yo.indexOf(t);-1!==i&&this.Yo.splice(i,1)}return this.Yo.push(e),null==e.initialize||e.initialize(),e}ol(){return this.config.cookieless_mode===vt||this.config.cookieless_mode===dt&&this.consent.isRejected()}ll(){if(!this.ol()&&this.get_distinct_id()===nt){var t=this.persistence;if(t){this.ul()||t.load(!0);var e=this.get_distinct_id();if(!e||e===nt){var i=this.config.get_device_id(cs());this.register({distinct_id:i,$device_id:i}),t.set_property(X,ct)}this.hl()}}}get decideEndpointWasHit(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.hasLoadedFlags)&&void 0!==t&&t}constructor(){var t;this.webPerformance=new pl,this.dl=!1,this.version=s.LIB_VERSION,this.vl=new Set,this.cl="",this.il=new Ta,this.Yo=[],this.fl=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=vl(),this.SentryIntegration=In,this.sentryIntegration=t=>function(t,e){var i=On(t,e);return{name:Cn,processEvent:t=>i(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.pl=!1,this.gl=null,this.ml=null,this.yl=null,this.scrollManager=new Ea(this),this.pageViewManager=new An(this),this.rateLimiter=new Eo(this),this.requestRouter=new za(this),this.consent=new Fs(this),this.externalIntegrations=new Ya(this);var e=null!==(t=_l.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=e.featureFlags&&new e.featureFlags(this),this.toolbar=e.toolbar&&new e.toolbar(this),this.surveys=e.surveys&&new e.surveys(this),this.conversations=e.conversations&&new e.conversations(this),this.logs=e.logs&&new e.logs(this),this.metrics=e.metrics&&new e.metrics(this),this.experiments=e.experiments&&new e.experiments(this),this.exceptions=e.exceptions&&new e.exceptions(this),this.people={set:(t,e,i)=>{var r=de(t)?{[t]:e}:t;this.setPersonProperties(r),null==i||i({})},set_once:(t,e,i)=>{var r=de(t)?{[t]:e}:t;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",(t=>Kr.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,e,i){if(i&&i!==hl){var r,s=null!==(r=el[i])&&void 0!==r?r:new _l;return s._init(t,e,i),el[i]=s,el[hl][i]=s,s}return this._init(t,e,i)}_init(t,e,r){var n,o;void 0===e&&(e={});var a,h=de(t)?t.trim():"";if(!h)return Kr.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return h!==(null==(a=this.config)?void 0:a.token)?console.warn("[PostHog.js]","You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('"+h+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=vl(e.defaults),e.debug=this.bl(e.debug),this._l=e,this.wl=[],e.person_profiles?this.ml=e.person_profiles:e.process_person&&(this.ml=e.process_person);var u=vl(e.defaults),d=fl(e),v=Xr({},u,d,{name:r,token:h});le(u.rageclick)&&le(d.rageclick)&&(v.rageclick=Xr({},u.rageclick,d.rageclick)),le(u.session_recording)&&le(d.session_recording)&&(v.session_recording=Xr({},u.session_recording,d.session_recording)),this.set_config(v),this.config.on_xhr_error&&Kr.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=e.disable_compression?void 0:fo.GZipJS;var c=this.ul();if(this.persistence=new vo(this.config,c),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new vo(i({},this.config,{persistence:"sessionStorage"}),c,!1),this.cl="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!c&&As.Xr()){var f=As.ni(this.cl);oe(f)&&f.forEach((t=>{de(t)&&this.vl.add(t)}))}else As.ri(this.cl);var p=i({},this.persistence.props),_=i({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.kl=new ba((t=>this.Sl(t)),this.config.request_queue_config),this.xl=new xa(this),this.__request_queue=[];var g=this.ol();if(g||(this.sessionManager=new Ra(this),this.sessionPropsManager=new ka(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId(((t,e,i)=>{(null!=i&&i.activityTimeout||null!=i&&i.sessionPastMaximumLength||null!=i&&i.crossTabAdoption)&&this.Cl()}))),this.Tl(),this.config.__preview_deferred_init_extensions?(Kr.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Ml(g)}),0)):(Kr.info("Initializing extensions synchronously"),this.Ml(g)),s.DEBUG=s.DEBUG||this.config.debug,s.DEBUG&&Kr.info("Starting in debug mode",{this:this,config:e,thisC:i({},this.config),p:p,s:_}),!this.config.identity_distinct_id||null!=(n=e.bootstrap)&&n.distinctID||(e.bootstrap=i({},e.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(o=e.bootstrap)?void 0:o.distinctID)){var m=e.bootstrap.distinctID,y=this.get_distinct_id(),b=this.persistence.get_property(X);if(e.bootstrap.isIdentifiedID&&null!=y&&y!==m&&b===ct)this.identify(m);else if(e.bootstrap.isIdentifiedID&&null!=y&&y!==m&&b===ft)Kr.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 w=this.config.get_device_id(cs()),x=e.bootstrap.isIdentifiedID?w:m;this.persistence.set_property(X,e.bootstrap.isIdentifiedID?ft:ct),this.register({distinct_id:m,$device_id:x})}}if(g)this.register_once({distinct_id:nt,$device_id:null},"");else if(!this.get_distinct_id()){var E=this.config.get_device_id(cs());this.register_once({distinct_id:E,$device_id:E},""),this.persistence.set_property(X,ct)}return ns(xt,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),e.segment?function(t,e){var i=t.config.segment;if(!i)return e();!function(t,e){var i=t.config.segment;if(!i)return e();var r=i=>{var r=()=>i.anonymousId()||cs();t.config.get_device_id=r,i.id()&&(t.register({distinct_id:i.id(),$device_id:r()}),t.persistence.set_property(X,ft)),e()},s=i.user();"then"in s&&ae(s.then)?s.then(r):r(s)}(t,(()=>{i.register((t=>{"undefined"!=typeof Promise&&Promise.resolve||Rn.warn("This browser does not have Promise support, and can not use the segment integration");var e=(e,i)=>{if(!i)return e;e.event.userId||e.event.anonymousId===t.get_distinct_id()||(Rn.info("No userId set, resetting PostHog"),t.reset()),e.event.userId&&e.event.userId!==t.get_distinct_id()&&(Rn.info("UserId set, identifying with PostHog"),t.identify(e.event.userId));var r=t.calculateEventProperties(i,e.event.properties);return e.event.properties=Object.assign({},r,e.event.properties),e};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:t=>e(t,t.event.event),page:t=>e(t,mt),identify:t=>e(t,bt),screen:t=>e(t,"$screen")}})(t)).then((()=>{e()}))}))}(this,(()=>this.El())):this.El(),ae(this.config._onCapture)&&this.config._onCapture!==rl&&(Kr.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&Kr.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 Oa.apply(this,arguments)}().then((t=>{t&&this.register({[l]:t})})).catch(rl),this}Il(t){var e=t;return de(e.name)&&ae(e.setup)}Rl(t,e){this.Il(t)?e.push((()=>{this.Pl().add(t).catch((()=>null==t.dispose?void 0:t.dispose())).catch((e=>{Kr.error('Failed to dispose browser extension "'+t.name+'"',e)}))})):this.Yo.push(t)}Tl(){var t,e,i,r,s,n,o=null!==(t=null==(e=this.config.__extensionClasses)?void 0:e.featureFlags)&&void 0!==t?t:null==(i=_l.__defaultExtensionClasses)?void 0:i.featureFlags;o&&(this.featureFlags&&this.featureFlags instanceof o||(null==(r=this.Al)||r.call(this),this.Al=void 0,this.featureFlags=new o(this)),ae(this.featureFlags.onReloading)&&ae(this.featureFlags.setup)?this.Al||(this.Al=this.featureFlags.onReloading((()=>{this.il.emit("featureFlagsReloading",!0)})),this.Pl().add(this.featureFlags)):null==(s=(n=this.featureFlags).initialize)||s.call(n))}Ml(t){var e,r,s,n,o,a,l,h=performance.now(),u=i({},_l.__defaultExtensionClasses,this.config.__extensionClasses),d=[];u.exceptions&&this.Yo.push(this.exceptions=null!==(e=this.exceptions)&&void 0!==e?e:new u.exceptions(this)),u.historyAutocapture&&this.Yo.push(this.historyAutocapture=new u.historyAutocapture(this)),u.tracingHeaders&&this.Yo.push(this.tracingHeaders=new u.tracingHeaders(this)),u.siteApps&&this.Yo.push(this.siteApps=new u.siteApps(this)),u.sessionRecording&&!t&&this.Yo.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||d.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),u.autocapture&&this.Rl(this.autocapture=new u.autocapture(this),d),u.surveys&&this.Rl(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new u.surveys(this),d),u.logs&&this.Rl(this.logs=null!==(s=this.logs)&&void 0!==s?s:new u.logs(this),d),u.metrics&&this.Yo.push(this.metrics=null!==(n=this.metrics)&&void 0!==n?n:new u.metrics(this)),u.conversations&&this.Yo.push(this.conversations=null!==(o=this.conversations)&&void 0!==o?o:new u.conversations(this)),u.productTours&&this.Yo.push(this.productTours=new u.productTours(this)),u.heatmaps&&this.Yo.push(this.heatmaps=new u.heatmaps(this)),u.webVitalsAutocapture&&this.Yo.push(this.webVitalsAutocapture=new u.webVitalsAutocapture(this)),u.exceptionObserver&&this.Yo.push(this.exceptionObserver=new u.exceptionObserver(this)),u.deadClicksAutocapture&&this.Yo.push(this.deadClicksAutocapture=new u.deadClicksAutocapture(this,$n)),u.toolbar&&this.Yo.push(this.toolbar=null!==(a=this.toolbar)&&void 0!==a?a:new u.toolbar(this)),u.experiments&&this.Yo.push(this.experiments=null!==(l=this.experiments)&&void 0!==l?l:new u.experiments(this)),this.Yo.forEach((t=>{t.initialize&&d.push((()=>{null==t.initialize||t.initialize()}))})),d.push((()=>{if(this.Fl){var t=this.Fl;this.Fl=void 0,this.Yo.forEach((e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t)))}})),this.Ol(d,h)}Ol(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void setTimeout((()=>{this.Ol(t,e)}),0);var i=t.shift();if(i)try{i()}catch(t){Kr.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-e);this.register_for_session({[at]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[lt]:r}),this.config.__preview_deferred_init_extensions&&Kr.info("PostHog extensions initialized ("+r+"ms)")}za(t){var e;if(!kt||!kt.body)return Kr.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.za(t)}),500);if(this.config.__preview_deferred_init_extensions&&(this.Fl=t),this.el=t,this.compression=void 0,t.ok){var i,r=t.config;r.supportedCompression&&!this.config.disable_compression&&(this.compression=Zt(r.supportedCompression,fo.GZipJS)?fo.GZipJS:Zt(r.supportedCompression,fo.Base64)?fo.Base64:void 0),null!=(i=r.analytics)&&i.endpoint&&(this.analyticsDefaultEndpoint=r.analytics.endpoint)}this.set_config({person_profiles:this.ml?this.ml:pt}),null==(e=this.Ll)||e.handleRemoteConfig(t),this.Yo.forEach((e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t)))}El(){try{this.config.loaded(this)}catch(t){Kr.critical("`loaded` function failed",t)}if(this.Dl(),this.config.internal_or_test_user_hostname&&null!=Tt&&Tt.hostname){var t=Tt.hostname,e=this.config.internal_or_test_user_hostname;("string"==typeof e?t===e:e.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.ol())&&this.$l()}),1),this.Nl=new ko(this),this.Nl.load()}Dl(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.kl)||t.enable())}_dom_loaded(){this.is_capturing()&&Yr(this.__request_queue,(t=>this.Sl(t))),this.__request_queue=[],this.Dl()}_handle_unload(){var t,e,i,r,s;null==(t=this.surveys)||null==t.handlePageUnload||t.handlePageUnload(),null==(e=this.metrics)||e.flush("sendBeacon"),this.config.request_batching?(this.ql()&&this.capture(yt),null==(i=this.logs)||i.flushLogs("sendBeacon"),null==(r=this.kl)||r.unload(),null==(s=this.xl)||s.unload()):this.ql()&&this.capture(yt,null,{transport:"sendBeacon"})}_send_request(t){var e;this.__loaded?ul?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:429})):(t.transport=t.transport||this.config.api_transport,t.headers=i({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?null!==(e=this.compression)&&void 0!==e?e:t.compressionFallback:t.compression,(ue(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(t=>{var e,r,s,n=i({},t);n.timeout=n.timeout||6e4;var o,a,l,h,u,d=null!==(e=n.transport)&&void 0!==e?e:"fetch";"sendBeacon"===d&&ue(n.compression)&&n.data&&(n.compression=fo.Base64),"POST"===n.method&&n.data&&("capture-body"===n.timestampMode?n.data={api_key:null!==(a=null==(u=(h=(oe(o=n.data)?o:[o]).map((t=>i({},t,t.timestamp instanceof Date&&!isNaN(t.timestamp.getTime())?{timestamp:t.timestamp.toISOString()}:{}))))[0])||null==(l=u.properties)?void 0:l.token)&&void 0!==a?a:null==u?void 0:u.token,batch:h,sent_at:(new Date).toISOString()}:"body"===n.timestampMode&&(n.data=function(t,e){return void 0===e&&(e=(new Date).toISOString()),oe(t)?t.map((t=>i({},t,{sent_at:e}))):i({},t,{sent_at:e})}(n.data))),n.url=ga(n.url,n.method,n.compression,n.timestampMode);var v=ma.filter((t=>!n.disableTransport||!t.transport||!n.disableTransport.includes(t.transport))),c=null!==(r=null==(s=function(t,e){for(var i=0;t.length>i;i++)if(t[i].transport===d)return t[i]}(v))?void 0:s.method)&&void 0!==r?r:v[0].method;if(!c)throw new Error("No available transport method");var f=t=>{try{c(t)}catch(t){fa(t)?Kr.warn(t):Kr.error(t),null==n.callback||n.callback({statusCode:0,error:t})}};"sendBeacon"!==d&&n.data&&n.compression===fo.GZipJS&&Ct&&"undefined"!=typeof Promise&&!oa?va(n).then((t=>{f(t)})).catch((e=>{if(Wi(e))return oa=!0,void f(i({},n,{compression:void 0,url:ga(t.url,t.method,void 0,t.timestampMode)}));(t=>{if(!t||"object"!=typeof t)return!1;var e="name"in t?String(t.name):"";return Wi(t)||e===qi})(e)&&(oa=!0),f(n)})):c(n)})(i({},t,{callback:e=>{var i,r;this.rateLimiter.checkForLimiting(e),400>e.statusCode||null==(i=(r=this.config).on_request_error)||i.call(r,e),null==t.callback||t.callback(e)}}))):t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:0}))}Sl(t){this.xl?this.xl.retriableRequest(t):this._send_request(t)}_execute_array(t){il++;try{var e,i=[],r=[],s=[];Yr(t,(t=>{if(t)if(oe(e=t[0]))s.push(t);else if(ae(t))try{t.call(this)}catch(e){Kr.error("Error executing queued PostHog call",t,e)}else oe(t)&&"alias"===e?i.push(t):oe(t)&&-1!==e.indexOf("capture")&&ae(this[e])?s.push(t):r.push(t)}));var n=function(t,e){Yr(t,(function(t){try{if(oe(t[0])){var i=e;Qr(t,(function(t){i=i[t[0]].apply(i,t.slice(1))}))}else e[t[0]].apply(e,t.slice(1))}catch(e){Kr.error("Error executing queued PostHog call",t,e)}}))};n(i,this),n(r,this),n(s,this)}finally{il--}}push(t){if(il>0&&oe(t)&&de(t[0])){var e=_l.prototype[t[0]];ae(e)&&e.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,e,r){var s,n,o,a,l;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.kl){if(this.is_capturing())if(!ue(t)&&de(t)){this.ll();var h=!this.config.opt_out_useragent_filter&&this._is_bot();if(!h||this.config.__preview_capture_bot_pageviews){var u=null!=r&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==u||!u.isRateLimited){null!=e&&e.$current_url&&!de(null==e?void 0:e.$current_url)&&(Kr.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==e||delete e.$current_url),"$exception"!==t||null!=r&&r.jl||Kr.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&&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 d=new Date,v=(null==r?void 0:r.timestamp)||d,c=Di(null==r?void 0:r.uuid,cs),f={uuid:c,event:t,properties:this.calculateEventProperties(t,e||{},v,c)};t===mt&&this.config.__preview_capture_bot_pageviews&&h&&(f.event="$bot_pageview",f.properties.$browser_type="bot"),u&&(f.properties.$lib_rate_limit_remaining_tokens=u.remainingTokens);var p="$feature_flag_called"===t&&!1===f.properties.$feature_flag_has_experiment&&!0===this.get_property(D);(null==r?void 0:r.$set)&&!p&&(f.$set=null==r?void 0:r.$set);var _=null==r?void 0:r.$unset;_&&(f.$unset=_);var g,m,y,b=p?void 0:this.Bl(null==r?void 0:r.$set_once,t!==wt,t===bt);if(b&&(f.$set_once=b),null!=r&&r._noTruncate||(n=this.config.properties_string_max_length,o=f,a=t=>de(t)?t.slice(0,n):t,l=new Set,f=function t(e,i){if(e!==Object(e))return a?a(e):e;if(!l.has(e)){var r;if(l.add(e),oe(e))r=[],Yr(e,(e=>{r.push(t(e))}));else{var s={};Qr(e,((e,i)=>{l.has(e)||(s[i]=t(e,i))})),r=s}return r}}(o)),f.timestamp=v,ue(null==r?void 0:r.timestamp)||(f.properties.$event_time_override_provided=!0,f.properties.$event_time_override_system_time=d),p&&(f.properties=function(t,e){void 0===e&&(e=[]);var i={},r=e=>{void 0!==t[e]&&(i[e]=t[e])};return Lt.forEach(r),e.forEach(r),i}(f.properties,ll)),t===go.DISMISSED||t===go.SENT){var w=null==e?void 0:e[mo.SURVEY_ID],x=null==e?void 0:e[mo.SURVEY_ITERATION];Va({id:w,current_iteration:x}),f.$set=i({},f.$set,{[(g={id:w,current_iteration:x},m=t===go.SENT?"responded":"dismissed",y="$survey_"+m+"/"+g.id,g.current_iteration&&g.current_iteration>0&&(y="$survey_"+m+"/"+g.id+"/"+g.current_iteration),y)]:!0})}else t===go.SHOWN&&(f.$set=i({},f.$set,{[mo.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(t===bo.SHOWN){var E=null==e?void 0:e[wo.TOUR_TYPE];E&&(f.$set=i({},f.$set,{[wo.TOUR_LAST_SEEN_DATE+"/"+E]:(new Date).toISOString()}))}var S=i({},f.properties.$set,f.$set);if(he(S)||this.setPersonPropertiesForFlags(S),!fe(this.config.before_send)){var k=this.Jn(f);if(!k)return;(f=k).uuid=Di(f.uuid,cs)}this.il.emit("eventCaptured",f);var T=null!==(s=null==r?void 0:r._url)&&void 0!==s?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),P={method:"POST",url:T,data:f,compression:"best-available",timestampMode:"recordings"===(null==r?void 0:r._batchKey)||/\/s\/(?:\?|$)/.test(T)?"body":"capture-body",batchKey:null==r?void 0:r._batchKey,transport:null==r?void 0:r.transport};return!this.config.request_batching||r&&(null==r||!r._batchKey)||null!=r&&r.send_instantly?this.Sl(P):this.kl.enqueue(P),f}Kr.critical("This capture call is ignored due to client rate limiting.")}}else Kr.error("No event name provided to posthog.capture")}else Kr.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(e=>t(e.event,e)))}getExtension(t){var e;return null==(e=this.Ll)?void 0:e.getExtension(t)}Pl(){var t;return null!==(t=this.Ll)&&void 0!==t?t:this.Ll=new tl(this)}nl(t){this.fl.push(t);var e=!0;return()=>{if(e){e=!1;var i=this.fl.indexOf(t);-1!==i&&this.fl.splice(i,1)}}}Hl(t){var e,i,r;return void 0===t&&(t=!0),!(null==(e=this.persistence)||!e.consumeCookieIdentityChange())&&(this.yl=null,this.persistence.get_property(X)===ct&&(null==(r=this.sessionPersistence)||r.clear(),this.vl.clear(),this.zl()),null==(i=this.featureFlags)||i.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,e,r,n,o){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return e;this.persistence.syncCookieProperties(),this.Hl();var a=o?void 0:this.persistence.remove_event_timer(t),l=i({},e);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,this.ol()&&(l[ot]=!0),"$snapshot"===t){var h=i({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=h.distinct_id,(!de(l.distinct_id)&&!pe(l.distinct_id)||ve(l.distinct_id))&&Kr.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var u,d=function(t,e,i,r){var n,o,a,l;if(void 0===r&&(r=!1),!Ot)return{};var h,u=t?[...Wn,...e||[]]:[],d=function(t){for(var e=0;Ai.length>e;e++){var i=Ai[e],r=i[1],s=i[0].exec(t),n=s&&(ae(r)?r(s,t):r);if(n)return n}return["",""]}(Ot),v=d[0],c=d[1],f=null!=(h="undefined"!=typeof navigator?navigator:void 0)&&h.brave?{brave:!0}:{},p={};ue(i)||(p.detectGoogleSearchApp=i);var _={},g=null==(n=navigator)||null==(n=n.userAgentData)?void 0:n.platform,m=null==(o=navigator)?void 0:o.maxTouchPoints,y=null==xt||null==(a=xt.screen)?void 0:a.width,b=null==xt||null==(l=xt.screen)?void 0:l.height,w=null==xt?void 0:xt.devicePixelRatio;ue(g)||(_.userAgentDataPlatform=g),ue(m)||(_.maxTouchPoints=m),ue(y)||(_.screenWidth=y),ue(b)||(_.screenHeight=b),ue(w)||(_.devicePixelRatio=w);var x,E,S,k,T,P,R,C,O=Xr(is({$os:v,$os_version:c,$browser:Ci(Ot,navigator.vendor,f,p),$device:Fi(Ot),$device_type:(E=Ot,S=_,C=Fi(E),C===De||C===Me||"Kobo"===C||"Kindle Fire"===C||C===vi?Fe:C===ei||C===ri||C===ii||C===hi?"Console":C===Le?"Wearable":C?Oe:"Android"===(null==S?void 0:S.userAgentDataPlatform)&&(null!==(k=null==S?void 0:S.maxTouchPoints)&&void 0!==k?k:0)>0?600>Math.min(null!==(T=null==S?void 0:S.screenWidth)&&void 0!==T?T:0,null!==(P=null==S?void 0:S.screenHeight)&&void 0!==P?P:0)/(null!==(R=null==S?void 0:S.devicePixelRatio)&&void 0!==R?R:1)?Oe:Fe:"Desktop"),$timezone:so(),$timezone_offset:no()}),{$current_url:Bn(r?Li(null==Tt?void 0:Tt.href):null==Tt?void 0:Tt.href,u,Kn),$host:null==Tt?void 0:Tt.host,$pathname:null==Tt?void 0:Tt.pathname,$raw_user_agent:Ot.length>1e3?Ot.substring(0,997)+"...":Ot,$browser_version:Ii(Ot,navigator.vendor,f,p),$browser_language:Zn(),$browser_language_prefix:(x=Zn(),"string"==typeof x?x.split("-")[0]:void 0),$screen_height:null==xt?void 0:xt.screen.height,$screen_width:null==xt?void 0:xt.screen.width,$viewport_height:null==xt?void 0:xt.innerHeight,$viewport_width:null==xt?void 0:xt.innerWidth,$lib:s.LIB_NAME,$lib_version:s.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return s.SDK_DIST_CHANNEL&&(O.$sdk_dist_channel=s.SDK_DIST_CHANNEL),O}(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(o,r.getTime(),!0),c=v.windowId;l.$session_id=v.sessionId,l.$window_id=c}this.sessionPropsManager&&Xr(l,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&Xr(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=null==(f=this.xl)?void 0:f.length}catch(t){l.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===La&&(l.$lib_custom_api_host=this.config.api_host),u=t!==mt||o?t!==yt||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,n),l=Xr(l,u),t===mt&&kt&&(l.title=kt.title),!ue(a)){var p=r.getTime()-a;l.$duration=parseFloat((p/1e3).toFixed(3))}Ot&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser");var _=this.persistence.properties(),g=this.sessionPersistence.properties();Qr(["$referrer","$referring_domain"],(t=>{t in _&&delete g[t]}));var m={};if(this.fl.length>0)for(var y of this.fl.slice())try{Xr(m,y())}catch(t){Kr.error("Failed to produce browser extension event properties",t)}(l=Xr({},d,_,g,i({},m,l))).$is_identified=this._isIdentified(),oe(this.config.property_denylist)?Qr(this.config.property_denylist,(function(t){delete l[t]})):Kr.error(al+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var b=this.config.sanitize_properties;b&&(Kr.error(ol),l=b(l,t));var w=this.Ul();return l.$process_person_profile=w,w&&!o&&this.Wl("_calculate_event_properties"),l}Bl(t,e,i){var r;if(void 0===e&&(e=!0),void 0===i&&(i=!1),!this.persistence||!this.Ul())return t;if(this.dl&&!i)return t;var s=this.persistence.get_initial_props(),n=null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps(),o=Xr({},s,n||{},t||{}),a=this.config.sanitize_properties;return a&&(Kr.error(ol),o=a(o,"$set_once")),e&&(this.dl=!0),he(o)?void 0:o}register(t,e){var i;null==(i=this.persistence)||i.register(t,e)}register_once(t,e,i){var r;null==(r=this.persistence)||r.register_once(t,e,i)}register_for_session(t){var e,i;null==(e=this.persistence)||e.syncCookieProperties(),this.Hl(),null==(i=this.sessionPersistence)||i.register(t),Object.keys(t).forEach((t=>this.vl.add(t))),this.zl()}unregister(t){var e;null==(e=this.persistence)||e.unregister(t)}unregister_for_session(t){var e;null==(e=this.sessionPersistence)||e.unregister(t),this.vl.delete(t),this.zl()}Vl(t,e){this.register({[t]:e})}Cl(){this.vl.forEach((t=>{var e;null==(e=this.sessionPersistence)||e.unregister(t)})),this.vl.clear(),this.zl()}zl(){var t;if(this.cl)if("memory"===this.config.persistence||null!=(t=this.sessionPersistence)&&t.ga||!As.Xr())As.ri(this.cl);else{var e=[];this.vl.forEach((t=>e.push(t))),e.length>0?As.ei(this.cl,e):As.ri(this.cl)}}getFeatureFlag(t,e){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlag(t,e)}getFeatureFlagPayload(t){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlagPayload(t)}getFeatureFlagResult(t,e){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagResult(t,e)}getAllFeatureFlags(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.getAllFeatureFlags())&&void 0!==t?t:[]}isFeatureEnabled(t,e){var i,r;return null!==(i=null==(r=this.featureFlags)?void 0:r.isFeatureEnabled(t,e))&&void 0!==i?i:null==e?void 0:e.defaultValue}reloadFeatureFlags(){var t;null==(t=this.featureFlags)||t.reloadFeatureFlags()}updateFlags(t,e,i){var r;null==(r=this.featureFlags)||r.updateFlags(t,e,i)}updateEarlyAccessFeatureEnrollment(t,e,i){var r;null==(r=this.featureFlags)||r.updateEarlyAccessFeatureEnrollment(t,e,i)}getEarlyAccessFeatures(t,e,i){var r;return void 0===e&&(e=!1),null==(r=this.featureFlags)?void 0:r.getEarlyAccessFeatures(t,e,i)}on(t,e){return this.il.on(t,e)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:nl}),()=>{})}onSessionId(t){var e,i;return null!==(e=null==(i=this.sessionManager)?void 0:i.onSessionId(t))&&void 0!==e?e:()=>{}}getSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getSurveys(t,e):t([],{isLoaded:!1,error:nl})}getActiveMatchingSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:nl})}renderSurvey(t,e){var i;null==(i=this.surveys)||i.renderSurvey(t,e)}displaySurvey(t,e){var i;void 0===e&&(e=Ga),null==(i=this.surveys)||i.displaySurvey(t,e)}cancelPendingSurvey(t){var e;null==(e=this.surveys)||e.cancelPendingSurvey(t)}canRenderSurvey(t){var e,i;return null!==(e=null==(i=this.surveys)?void 0:i.canRenderSurvey(t))&&void 0!==e?e:{visible:!1,disabledReason:nl}}canRenderSurveyAsync(t,e){var i,r;return void 0===e&&(e=!1),null!==(i=null==(r=this.surveys)?void 0:r.canRenderSurveyAsync(t,e))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:nl})}Gl(t){return!t||ve(t)?(Kr.critical("Unique user id has not been set in posthog.identify"),!1):t===nt?(Kr.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(Kr.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(t,e,i){if(!this.__loaded||!this.persistence)return Kr.uninitializedWarning("posthog.identify");if(pe(t)&&(t=t.toString(),Kr.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Gl(t)&&this.Wl("posthog.identify")){this.ll();var r=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==r,n=this.Hl(!1),o=this.persistence.ba(),l=!1;try{var u=this.get_distinct_id();this.register({$user_id:t}),this.get_property(a)||this.register_once({$had_persisted_distinct_id:!0,$device_id:u},""),t!==u&&t!==this.get_property(h)&&(this.unregister(h),this.register({distinct_id:t}));var d,v=(this.persistence.get_property(X)||ct)===ct,c=t!==u,f=!c&&v;if(c&&v)this.persistence.set_property(X,ft),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence._a(),this.capture(bt,{distinct_id:t,$anon_distinct_id:u},{$set:e||{},$set_once:i||{}}),this.yl=Na(t,e,i),null==(d=this.featureFlags)||d.setAnonymousDistinctId(u);else if(f){this.persistence.set_property(X,ft);var p=e||{},_=i||{};this.setPersonPropertiesForFlags({$set:p,$set_once:_},!1),this.config.cookieWinsOnConflict&&this.persistence._a(),this.capture("$set",{$set:p,$set_once:_}),this.yl=Na(t,e,i)}else(e||i)&&this.setPersonProperties(e,i);c||s||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(K)):f&&(e||i)&&this.reloadFeatureFlags(),l=!0}finally{o&&this.persistence.Sa(l)}}}setPersonProperties(t,e){if((t||e)&&this.Wl("posthog.setPersonProperties")){var i=Na(this.get_distinct_id(),t,e);this.yl!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}}),this.yl=i):Kr.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var e,i=(oe(t)?t:[t]).filter((t=>de(t)&&t.length>0));0!==i.length&&this.Wl("posthog.unsetPersonProperties")&&(null==(e=this.featureFlags)||e.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.yl=null)}group(t,e,r){var s;if(t&&e){null==(s=this.persistence)||s.syncCookieProperties(),this.Hl();var n=this.getGroups(),o=n[t]!==e;if(o&&this.resetGroupPropertiesForFlags(t),this.register({$groups:i({},n,{[t]:e})}),o||r){var a={$group_type:t,$group_key:e};r&&(a.$group_set=r),this.capture(wt,a)}r&&this.setGroupPropertiesForFlags({[t]:r}),o&&!r&&this.reloadFeatureFlags()}else Kr.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,e){var i;void 0===e&&(e=!0),null==(i=this.featureFlags)||i.setPersonPropertiesForFlags(t,e)}resetPersonPropertiesForFlags(t){var e;void 0===t&&(t=!0),null==(e=this.featureFlags)||e.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,e){var i;void 0===e&&(e=!0),this.Wl("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(t,e))}resetGroupPropertiesForFlags(t){var e;null==(e=this.featureFlags)||e.resetGroupPropertiesForFlags(t)}reset(t){var e=ge(t)?t:null==t?void 0:t.resetDeviceID,i=ge(t)||null==t?void 0:t.bootstrap;this.Zl(e,!1,i)}Zl(t,e,r){var s,n,o;if(void 0===e&&(e=!1),Kr.info("reset"),!this.__loaded)return Kr.uninitializedWarning("posthog.reset");var h=null==r?void 0:r.sessionID;this.config.bootstrap=r||(null==(s=this._l)?void 0:s.bootstrap)||{},null==(n=this.featureFlags)||null==n.updateConfig||n.updateConfig(this.config,this.Ua());var u=this.get_property(a),d=this.get_property(l),v=this.get_property(w),c=this.is_capturing();this.consent.reset(),e||!c||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");var f=null==(o=this.persistence)||null==o.ba?void 0:o.ba(),p=!1;try{var _,g,m,y,b,x,E,S,k,T,P,R,C;if(null==(_=this.persistence)||_.clear(),null==(g=this.sessionPersistence)||g.clear(),this.vl.clear(),this.zl(),ue(v)||null==(T=this.persistence)||T.register({[w]:v}),null==(m=this.surveys)||m.reset(),null==(y=this.featureFlags)||y.reset(),null==(b=this.conversations)||b.reset(),null==(x=this.logs)||x.reset(),null==(E=this.metrics)||E.reset(),null==(S=this.persistence)||S.set_property(X,ct),null==(k=this.sessionManager)||k.resetSessionId(),this.yl=null,this.config.cookieless_mode===vt)this.register_once({distinct_id:nt,$device_id:null},"");else{var O=this.config.get_device_id(cs());this.register_once({distinct_id:O,$device_id:t?O:u},""),t||ue(d)||this.register({[l]:d})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),r)if(void 0===r.distinctID||this.ol()||(null==(C=this.persistence)||C.set_property(X,r.isIdentifiedID?ft:ct),this.register({distinct_id:r.distinctID})),null==(P=this.featureFlags)||P.initialize(),!(ue(h)||null!=(R=this.sessionManager)&&R.setBootstrapSessionId(h,!0))){var I=i({},r);delete I.sessionID,this.config.bootstrap=I}delete this.config.identity_distinct_id,delete this.config.identity_hash,p=!0}finally{var A;f&&(null==(A=this.persistence)||null==A.Sa||A.Sa(p))}this.reloadFeatureFlags()}shutdown(t){var i=this;return e((function*(){var t,e,r,s,n;if(i.__loaded){i.Pl().dispose(),null==(t=i.sessionRecording)||t.dispose(),null==(e=i.logs)||e.flushLogs("sendBeacon"),null==(r=i.metrics)||r.flush("sendBeacon"),null==(s=i.kl)||s.unload(),null==(n=i.xl)||n.unload();try{var o;null==(o=i.featureFlags)||o.destroy()}catch(t){Kr.error("Error while destroying feature flags",t)}}else Kr.uninitializedWarning("posthog.shutdown")}))()}setIdentity(t,e){var i;this.config.identity_distinct_id=t,this.config.identity_hash=e,this.alias(t),null==(i=this.conversations)||i.Ql()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(t=this.conversations)||t.Jl()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,e;return null!==(t=null==(e=this.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var e=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=e.sessionStartTimestamp,r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+e.sessionId);if(null!=t&&t.withTimestamp&&i){var s,n=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!i)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return r}alias(t,e){return t===this.get_property(n)?(Kr.critical("Attempting to create alias for existing People user - aborting."),-2):this.Wl("posthog.alias")?(ue(e)&&(e=this.get_distinct_id()),t!==e?(this.Vl(h,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(Kr.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var e=i({},this.config);if(le(t)){var r,n,o,a,l,h,u,d,v,c,f,p;Xr(this.config,fl(t));var _=this.ul();null==(r=this.persistence)||r.update_config(this.config,e,_),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new vo(i({},this.config,{persistence:"sessionStorage"}),_,!1);var g,m=this.bl(this.config.debug);ge(m)&&(this.config.debug=m),ge(this.config.debug)&&(this.config.debug?(s.DEBUG=!0,ys.Xr()&&ys.ei("ph_debug",!0),Kr.info("set_config",{config:t,oldConfig:e,newConfig:i({},this.config)})):(s.DEBUG=!1,ys.Xr()&&ys.ri("ph_debug"))),null==(n=this.featureFlags)||null==n.updateConfig||n.updateConfig(this.config,this.Ua()),null==(o=this.exceptionObserver)||o.onConfigChange(),null==(a=this.exceptions)||a.onConfigChange(),null==(l=this.sessionRecording)||l.startIfEnabledOrStop(),null==(h=this.tracingHeaders)||h.startIfEnabledOrStop(),null==(u=this.autocapture)||u.startIfEnabled(),null==(d=this.heatmaps)||d.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null==(g=this.historyAutocapture)||g.startIfEnabledOrStop()),null==(v=this.exceptionObserver)||v.startIfEnabledOrStop(),null==(c=this.deadClicksAutocapture)||c.startIfEnabledOrStop(),null==(f=this.surveys)||f.loadIfEnabled(),this.hl(),null==(p=this.externalIntegrations)||p.startIfEnabledOrStop()}}_overrideSDKInfo(t,e){s.LIB_NAME=t,s.LIB_VERSION=e}startSessionRecording(t){var e,i,r,s,n,o=!0===t,a={sampling:o||!(null==t||!t.sampling),linked_flag:o||!(null==t||!t.linked_flag),url_trigger:o||!(null==t||!t.url_trigger),event_trigger:o||!(null==t||!t.event_trigger)};Object.values(a).some(Boolean)&&(null==(e=this.sessionManager)||e.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(r=this.sessionRecording)||r.overrideLinkedFlag()),a.url_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event")));this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!(null==(t=this.sessionRecording)||!t.started)}captureException(t,e){if(this.exceptions){var r=new Error("PostHog syntheticException"),s=this.exceptions.buildProperties(t,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(i({},s,e))}}addExceptionStep(t,e){var i;null==(i=this.exceptions)||i.addExceptionStep(t,e)}captureLog(t){var e;null==(e=this.logs)||e.captureLog(t)}get logger(){var t,e;return null!==(t=null==(e=this.logs)?void 0:e.logger)&&void 0!==t?t:_l.Kl}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var e,i;return null!==(e=null==(i=this.toolbar)?void 0:i.loadToolbar(t))&&void 0!==e&&e}get_property(t){var e;return null==(e=this.persistence)?void 0:e.props[t]}getSessionProperty(t){var e;return null==(e=this.sessionPersistence)?void 0:e.props[t]}toString(){var t,e=null!==(t=this.config.name)&&void 0!==t?t:hl;return e!==hl&&(e=hl+"."+e),e}_isIdentified(){var t,e;return(null==(t=this.persistence)?void 0:t.get_property(X))===ft||(null==(e=this.sessionPersistence)?void 0:e.get_property(X))===ft}Ul(){var t,e;return!("never"===this.config.person_profiles||this.config.person_profiles===pt&&!this._isIdentified()&&he(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[h])&&(null==(e=this.persistence)||null==(e=e.props)||!e[st]))}ql(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.Ul()||this.Wl("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Wl("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Wl(t){return"never"===this.config.person_profiles?(Kr.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Vl(st,!0),!0)}ul(){if("always"===this.config.cookieless_mode)return!0;var t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==dt)}hl(){var t,e,i,r,s,n=this.ul();return this.is_capturing()||null==(i=this.logs)||i.Yl(),(null==(t=this.persistence)?void 0:t.ga)!==n&&(null==(r=this.persistence)||r.set_disabled(n)),(null==(e=this.sessionPersistence)?void 0:e.ga)!==n&&(null==(s=this.sessionPersistence)||s.set_disabled(n)),n&&(this.vl.clear(),this.zl()),n}opt_in_capturing(t){var e;if(this.config.cookieless_mode!==vt){if(this.ol()){var i,r,s,n,o;this.Zl(!0,!0),null==(i=this.sessionManager)||i.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new Ra(this),this.pageViewManager=new An(this),this.persistence&&(this.sessionPropsManager=new ka(this,this.sessionManager,this.persistence));var a,l=null!==(s=null==(n=this.config.__extensionClasses)?void 0:n.sessionRecording)&&void 0!==s?s:null==(o=_l.__defaultExtensionClasses)?void 0:o.sessionRecording;l&&(this.sessionRecording=this.al(this.sessionRecording,new l(this)),this.el&&(null==(a=this.sessionRecording)||null==a.onRemoteConfig||a.onRemoteConfig(this.el)))}var h,u;this.consent.optInOut(!0),this.hl(),this.Dl(),null==(e=this.sessionRecording)||e.startIfEnabledOrStop(),this.config.cookieless_mode==dt&&(null==(h=this.surveys)||h.loadIfEnabled()),(ue(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)&&this.capture(null!==(u=null==t?void 0:t.captureEventName)&&void 0!==u?u:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.$l()}else Kr.warn(sl)}opt_out_capturing(){var t,e,i;this.config.cookieless_mode!==vt?(this.config.cookieless_mode===dt&&this.consent.isOptedIn()&&this.Zl(!0,!0),this.consent.optInOut(!1),this.hl(),this.config.cookieless_mode===dt&&(this.register({distinct_id:nt,$device_id:null}),null==(t=this.sessionRecording)||t.stopRecording(),this.sessionRecording=void 0,null==(e=this.sessionManager)||e.destroy(),null==(i=this.pageViewManager)||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.$l(),this.Dl())):Kr.warn(sl)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return 1===t?"granted":0===t?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===vt||(this.config.cookieless_mode===dt?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.hl()}_is_bot(){return St?Ca(St,this.config.custom_blocked_useragents):void 0}$l(){kt&&("visible"===kt.visibilityState?this.pl||(this.pl=!0,this.capture(mt,{title:kt.title},{send_instantly:!0}),this.gl&&(kt.removeEventListener(_t,this.gl),this.gl=null)):this.gl||(this.gl=this.$l.bind(this),ns(kt,_t,this.gl)))}debug(t){!1===t?(null==xt||xt.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==xt||xt.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}))}Ua(){var t=this._l||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(Kr.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):function(t,e,i,r,s){var n=e in t&&!fe(t[e]),o=i in t&&!fe(t[i]);return n?t[e]:!!o&&(s&&s.warn("Config field '"+i+"' is deprecated. Please use '"+e+"' instead. The old field will be removed in a future major version."),t[i])}(t,"advanced_disable_flags","advanced_disable_decide",0,Kr)}Jn(t){var e;if(fe(this.config.before_send))return t;var i=Object.keys(null!==(e=t.properties)&&void 0!==e?e:{}).filter(be),r=oe(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var n of r)try{if(s=n(s),fe(s)){var o="Event '"+t.event+"' was rejected in beforeSend function";return ye(t.event)?Kr.warn(o+". This can cause unexpected behavior."):Kr.info(o),null}s.properties&&!he(s.properties)||Kr.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}catch(e){return Kr.error("Error in beforeSend function for event '"+t.event+"':",e),null}for(var a of i)if(s.properties&&fe(s.properties[a]))return Kr.warn("Event '"+t.event+"' had its '"+a+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return s}getPageViewId(){var t;return null==(t=this.pageViewManager.Ks)?void 0:t.pageViewId}captureTraceFeedback(t,e){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:e})}captureTraceMetric(t,e,i){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:e,$ai_metric_value:String(i)})}bl(t){var e=ge(t)&&!t,i=ys.Xr()&&"true"===ys.ti("ph_debug");return!e&&(!!i||t)}}_l.__defaultExtensionClasses={},_l.Kl=(()=>{var t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),function(t,e){for(var i=0;e.length>i;i++)t.prototype[e[i]]=es(t.prototype[e[i]])}(_l,["identify"]);class gl{constructor(t){this.disabled=!1===t;var e=le(t)?t:{};this.thresholdPx=e.threshold_px||30,this.timeoutMs=e.timeout_ms||1e3,this.clickCount=e.click_count||3,this.clicks=[]}isRageClick(t,e,i){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(t-r.x)+Math.abs(e-r.y)<this.thresholdPx&&this.timeoutMs>i-r.timestamp){if(this.clicks.push({x:t,y:e,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:e,timestamp:i}];return!1}}var ml="$copy_autocapture",yl=Jr("[AutoCapture]");function bl(t,e){return e.length>t?e.slice(0,t)+"...":e}function wl(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do{e=e.previousSibling}while(e&&!Bs(e));return e}function xl(t,e){var r,s,n=e.e,o=e.maskAllElementAttributes,a=e.maskAllText,l=e.elementAttributeIgnoreList,h=e.elementsChainAsString,u=e.disableCaptureUrlHashes;if(!Bs(t))return{props:{}};for(var d=[t],v=new Set([t]),c=t;c.parentNode&&!zs(c,"body")&&Vs>d.length;)if(Hs(c.parentNode)){var f=c.parentNode.host;if(v.has(f))break;v.add(f),d.push(f),c=f}else{if(!Bs(c.parentNode))break;if(v.has(c.parentNode))break;v.add(c.parentNode),d.push(c.parentNode),c=c.parentNode}var p,_,g=[],m={},y=!1,b=!1;if(Qr(d,(t=>{var e=dn(t);if(zs(t,"a")){var i=t.getAttribute("href");y=!!(e&&i&&bn(i))&&(u?Li(i):i)}Zt(Ks(t),"ph-no-capture")&&(b=!0),g.push(function(t,e,i,r,s){void 0===s&&(s=!1);var n=t.tagName.toLowerCase(),o={tag_name:n};Xs.indexOf(n)>-1&&!i&&(o.$el_text="a"===n.toLowerCase()||"button"===n.toLowerCase()?bl(1024,wn(t)):bl(1024,Ys(t)));var a=Ks(t);a.length>0&&(o.classes=a.filter((function(t){return""!==t}))),Qr(t.attributes,(function(i){var n;if((!vn(t)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==r||!r.includes(i.name))&&!e&&bn(i.value)&&(!de(n=i.name)||"_ngcontent"!==n.substring(0,10)&&"_nghost"!==n.substring(0,7))){var a=i.value;"class"===i.name&&(a=Ws(a).join(" ")),o["attr__"+i.name]=bl(1024,"href"===i.name&&s?Li(a):a)}}));for(var l=1,h=1,u=t;u=wl(u);)l++,u.tagName===t.tagName&&h++;return o.nth_child=l,o.nth_of_type=h,o}(t,o,a,l,u));var r=function(t){if(!dn(t))return{};var e={};return Qr(t.attributes,(function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){var i=t.name.replace("data-ph-capture-attribute-",""),r=t.value;i&&r&&bn(r)&&(e[i]=r)}})),e}(t);Xr(m,r)})),b)return{props:{},explicitNoCapture:b};if(a||(g[0].$el_text=zs(t,"a")||zs(t,"button")?wn(t):Ys(t)),y){var w,x;g[0].attr__href=y;var E=null==(w=Un(y))?void 0:w.host,S=null==xt||null==(x=xt.location)?void 0:x.host;E&&S&&E!==S&&(p=y)}return{props:Xr({$event_type:n.type,$ce_version:1},h?{}:{$elements:g},{$elements_chain:(_=g,function(t){return t.map((t=>{var e,r,s="";if(t.tag_name&&(s+=t.tag_name),t.attr_class)for(var n of(t.attr_class.sort(),t.attr_class))s+="."+n.replace(/"/g,"");var o=i({},t.text?{text:t.text}:{},{"nth-child":null!==(e=t.nth_child)&&void 0!==e?e:0,"nth-of-type":null!==(r=t.nth_of_type)&&void 0!==r?r:0},t.href?{href:t.href}:{},t.attr_id?{attr_id:t.attr_id}:{},t.attributes),a={};return Zr(o).sort(((t,e)=>{return(r=e[0])>(i=t[0])?-1:i>r?1:0;var i,r})).forEach((t=>{var e=t[1];return a[En(t[0].toString())]=En(e.toString())})),(s+=":")+Zr(a).map((t=>t[0]+'="'+t[1]+'"')).join("")})).join(";")}(function(t){return t.map((t=>{var e,i,r={text:null==(e=t.$el_text)?void 0:e.slice(0,400),tag_name:t.tag_name,href:null==(i=t.attr__href)?void 0:i.slice(0,2048),attr_class:Sn(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Zr(t).filter((t=>0===t[0].indexOf("attr__"))).forEach((t=>r.attributes[t[0]]=t[1])),r}))}(_)))},null!=(r=g[0])&&r.$el_text?{$el_text:null==(s=g[0])?void 0:s.$el_text}:{},p&&"click"===n.type?{$external_click_url:p}:{},m)}}class El{constructor(t){this.name="autocapture",this.Ts=!1,this.Ms=null,this.Es=!1,this.Is=!1,this.vn={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.Rs=!1,this.Ps=t,this.Ps.refresh(this.vn),this.rageclicks=new gl(this.vn.rageclick),this.As=null}setup(t){this.Fs(),this.Os=t;var e=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.Rs?e.dispose():(this.Ls=e,this.startIfEnabled())}dispose(){var t;this.Rs||(this.Rs=!0,this.Os=void 0,null==(t=this.Ls)||t.dispose(),this.Ls=void 0,this.Ds())}$s(){return this.Ps.refresh(this.vn),this.vn}Fs(){var t,e;return this.$s(),this.vn.url_allowlist=null==(t=this.vn.url_allowlist)?void 0:t.map((t=>new RegExp(t))),this.vn.url_ignorelist=null==(e=this.vn.url_ignorelist)?void 0:e.map((t=>new RegExp(t))),this.vn}Ns(){if(this.isBrowserSupported()){if(xt&&kt){var t=this.qs=t=>{t=t||(null==xt?void 0:xt.event);try{this.js(t)}catch(t){yl.error("Failed to capture event",t)}};if(ns(kt,"submit",t,{capture:!0}),ns(kt,"change",t,{capture:!0}),ns(kt,"click",t,{capture:!0}),this.$s().capture_copied_text){var e=this.Bs=t=>{t=t||(null==xt?void 0:xt.event);try{this.js(t,ml)}catch(t){yl.error("Failed to capture clipboard event",t)}};ns(kt,"copy",e,{capture:!0}),ns(kt,"cut",e,{capture:!0}),ns(kt,"paste",e,{capture:!0})}}}else yl.info("Disabling Automatic Event Collection because this browser is not supported")}Ds(){this.qs&&(null==kt||kt.removeEventListener("submit",this.qs,!0),null==kt||kt.removeEventListener("change",this.qs,!0),null==kt||kt.removeEventListener("click",this.qs,!0),this.qs=void 0),this.Bs&&(null==kt||kt.removeEventListener("copy",this.Bs,!0),null==kt||kt.removeEventListener("cut",this.Bs,!0),null==kt||kt.removeEventListener("paste",this.Bs,!0),this.Bs=void 0),this.Ts=!1}startIfEnabled(){!this.Rs&&this.Os&&this.isEnabled&&!this.Ts&&(this.Ns(),this.Ts=!0)}onRemoteConfig(t){if(!this.Rs)if(this.Es=!0,t.ok){var e=t.config;e.elementsChainAsString&&(this.Is=e.elementsChainAsString);var i,r=e.autocapture_opt_out;ge(r)&&(null==(i=this.Os)||i.kv.set(d,r),this.Ms=r),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(t){this.As=t}getElementSelectors(t){var e,i=[];return null==(e=this.As)||e.forEach((e=>{var r=null==kt?void 0:kt.querySelectorAll(e);null==r||r.forEach((r=>{t===r&&i.push(e)}))})),i}get isEnabled(){var t,e;if(this.Rs)return!1;var i=null==(t=this.Os)?void 0:t.kv.get(d),r=this.Ms,s=this.$s(),n=s.remoteRequestsDisabled&&!this.Es;if(ce(r)&&!ge(i)&&!n)return!1;var o=null!==(e=this.Ms)&&void 0!==e?e:!!i;return!!s.enabled&&!o}js(t,e){if(void 0===e&&(e="$autocapture"),this.isEnabled){var r=Qs(t);qs(r)&&(r=r.parentNode||null);var s,n=this.Fs();"$autocapture"===e&&"click"===t.type&&t instanceof MouseEvent&&n.rageclick&&null!=(s=this.rageclicks)&&s.isRageClick(t.clientX,t.clientY,t.timeStamp||(new Date).getTime())&&ln(r,n.rageclick)&&this.js(t,"$rageclick");var o=e===ml,a=o?i({},n,{dom_event_allowlist:void 0}):n;if(r&&function(t,e,i,r,s,n){var o;if(!xt||hn(t))return!1;if(null!=i&&i.url_allowlist&&!Gs(i.url_allowlist,n))return!1;if(null!=i&&i.url_ignorelist&&Gs(i.url_ignorelist,n))return!1;if(null!=i&&i.dom_event_allowlist){var a=i.dom_event_allowlist;if(a&&!a.some((t=>e.type===t)))return!1}var l=un(t,r),h=l.parentIsUsefulElement,u=l.targetElementList;if(!function(t,e){var i=null==e?void 0:e.element_allowlist;if(ue(i))return!0;var r,s=function(t){if(i.some((e=>t.tagName.toLowerCase()===e)))return{v:!0}};for(var n of t)if(r=s(n))return r.v;return!1}(u,i))return!1;if(!Zs(u,null==i?void 0:i.css_selector_allowlist))return!1;if(Zs(u,null!==(o=null==i?void 0:i.css_selector_ignorelist)&&void 0!==o?o:en))return!1;try{var d=xt.getComputedStyle(t);if(d&&"pointer"===d.getPropertyValue("cursor")&&"click"===e.type)return!0}catch(t){}var v=t.tagName.toLowerCase();switch(v){case"html":return!1;case"form":return(s||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(e.type)>=0;default:return h?(s||["click"]).indexOf(e.type)>=0:(s||["click"]).indexOf(e.type)>=0&&(Xs.indexOf(v)>-1||"true"===t.getAttribute("contenteditable"))}}(r,t,a,o,o?["copy","cut","paste"]:void 0,{config:{get_current_url:n.getCurrentUrl}})){var l,h=xl(r,{e:t,maskAllElementAttributes:n.maskAllElementAttributes,maskAllText:n.maskAllText,elementAttributeIgnoreList:n.element_attribute_ignorelist,elementsChainAsString:this.Is,disableCaptureUrlHashes:n.disableCaptureUrlHashes}),u=h.props;if(h.explicitNoCapture)return!1;var d=this.getElementSelectors(r);if(d&&d.length>0&&(u.$element_selectors=d),e===ml){var v=t.type||"clipboard";if("paste"!==v){var c,f,p=null==xt||null==(c=xt.getSelection())?void 0:c.toString(),_=Js(p);if(!_)return!1;u.$selected_content=_,u.$clipboard_text_length=null!==(f=null==p?void 0:p.length)&&void 0!==f?f:0}u.$copy_type=v}return null==(l=this.Os)||l.capture(e,u).catch((t=>yl.error("Failed to capture event",t))),!0}}}isBrowserSupported(){return ae(null==kt?void 0:kt.querySelectorAll)}}class Sl{constructor(t){this._instance=t}refresh(t){var e=this._instance.config,i=le(e.autocapture)?e.autocapture:void 0;t.enabled=!!e.autocapture,t.rageclick=e.rageclick,t.maskAllElementAttributes=e.mask_all_element_attributes,t.maskAllText=e.mask_all_text,t.disableCaptureUrlHashes=e.disable_capture_url_hashes,t.getCurrentUrl=e.get_current_url,t.remoteRequestsDisabled=this._instance.Ua(),t.url_allowlist=null==i?void 0:i.url_allowlist,t.url_ignorelist=null==i?void 0:i.url_ignorelist,t.dom_event_allowlist=null==i?void 0:i.dom_event_allowlist,t.element_allowlist=null==i?void 0:i.element_allowlist,t.css_selector_allowlist=null==i?void 0:i.css_selector_allowlist,t.css_selector_ignorelist=null==i?void 0:i.css_selector_ignorelist,t.element_attribute_ignorelist=null==i?void 0:i.element_attribute_ignorelist,t.capture_copied_text=null==i?void 0:i.capture_copied_text}}var kl=Jr("[ExceptionAutocapture]"),Tl=()=>{},$l=t=>{var e;if(ae(t))return null!==(e=t.__posthog_layer__)&&void 0!==e?e:t.__rrweb_layer__};function Pl(t,e,i){try{if(!(e in t))return Tl;var r={next:t[e]},s=i((function(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];return r.next.apply(this,e)}));return ae(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:r}})),t[e]=s,()=>{if(t[e]!==s)for(var i=t[e],n=$l(i);n;){if(n.next===s)return void(n.next=r.next);n=$l(i=n.next)}else t[e]=r.next}}catch(t){return Tl}}var Rl=Jr("[TracingHeaders]"),Cl=Jr("[Web Vitals]"),Ol=9e5,Il=["CLS","FCP","INP","LCP"],Al=["INP","LCP"],Fl=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],Ml="disabled",Dl="lazy_loading",Nl="awaiting_config",Ll="missing_config";Jr("[SessionRecording]"),Jr("[SessionRecording]");var Ul="[SessionRecording]",jl=Jr(Ul),Bl=Jr("[Heatmaps]");function zl(t){return le(t)&&"clientX"in t&&"clientY"in t&&pe(t.clientX)&&pe(t.clientY)}var ql=Jr("[Product Tours]"),Hl=t=>{var e;return!t.config.disable_product_tours&&!(null==(e=t.persistence)||!e.get_property(m))},Vl=["$set_once","$set"],Wl=Jr("[SiteApps]"),Gl="Error while initializing PostHog app with config id ",Kl=(t,e)=>null!=t&&t.then?t.then(e):e(t),Jl="SDK is not enabled or survey functionality is not yet loaded",Yl="Disabled. Not loading surveys.";class Ql{constructor(t,e){this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Xl=!1,this.tu=[],this.eu=null,this.iu=null,this.Rs=!1,this.ru=new Set,this.onRemoteConfig=t=>{if(!this.Rs&&!this.vn.disableSurveys){if(!t.ok)return qa.warn("Remote config unavailable. Not loading surveys.");var e=t.config.surveys;if(fe(e))return qa.warn("Flags not loaded yet. Not loading surveys.");this.nu=ge(e)?e:e.length>0,qa.info("flags response received, isSurveysEnabled: "+this.nu),this.loadIfEnabled()}},this.Ps=t,this.su=e}setup(t){if(!this.Rs)return this.au=t,Kl(t.kv.initialize(),(()=>{if(this.au===t&&!this.Rs){this.au=void 0,this.Os=t;var e=t.onRemoteConfig(this.onRemoteConfig);this.Rs?e.dispose():(this.Ls=e,this.loadIfEnabled())}}))}dispose(){var t,e,i;this.Rs||(this.Rs=!0,this.au=void 0,this.Os=void 0,null==(t=this.Ls)||t.dispose(),this.Ls=void 0,null==(e=this._surveyEventReceiver)||e.dispose(),this._surveyEventReceiver=null,null==(i=this._surveyManager)||null==i.dispose||i.dispose(),this._surveyManager=null,this.tu=[],this.eu=null,this.ru.forEach((t=>clearTimeout(t))),this.ru.clear())}get vn(){return this.Ps.get()}initialize(){this.loadIfEnabled()}reset(){try{var t;null==(t=this._surveyEventReceiver)||t.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var e=[],i=0;i<localStorage.length;i++){var r=localStorage.key(i);(null!=r&&r.startsWith(Ha)||null!=r&&r.startsWith("inProgressSurvey_"))&&e.push(r)}e.forEach((t=>localStorage.removeItem(t)))}catch(t){}}loadIfEnabled(){if(!this.Rs&&this.Os){var t=this.vn;if(!this._surveyManager)if(this.Xl)qa.info("Already initializing surveys, skipping...");else if(t.disableSurveys)qa.info(Yl);else if(t.cookielessMode&&this.Ps.isOptedOut())qa.info("Not loading surveys in cookieless mode without consent.");else{var e=this.Ps.getExtensions();if(e){if(!ue(this.nu)||t.advancedEnableSurveys){var i=this.nu||t.advancedEnableSurveys;this.Xl=!0;try{var r=e.generateSurveys;if(r)return this.ou(r,i),void(this.Xl=!1);var s=e.loadExternalDependency;if(!s)return this.lu(ut),void(this.Xl=!1);s((t=>{try{if(this.Rs)return;var e=this.Ps.getExtensions();t||null==e||!e.generateSurveys?this.lu("Could not load surveys script",t):this.ou(e.generateSurveys,i)}finally{this.Xl=!1}}))}catch(t){throw this.Xl=!1,this.lu("Error initializing surveys",t),t}}}else qa.error("PostHog Extensions not found.")}}}ou(t,e){this.Rs||(this._surveyManager=t(e),this._surveyEventReceiver=this.Ps.createEventReceiver(),qa.info("Surveys loaded successfully"),this.uu({isLoaded:!0}))}lu(t,e){qa.error(t,e),this.uu({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.tu.push(t),this._surveyManager&&this.uu({isLoaded:!0}),()=>{this.tu=this.tu.filter((e=>e!==t))}}getSurveys(t,e){var i;void 0===e&&(e=!1);var r=null!==(i=this.Os)&&void 0!==i?i:this.su;if(r&&!this.Rs){if(this.vn.disableSurveys)return qa.info(Yl),t([]);var s=r.kv.get(z);if(s&&!e)return t(s,{isLoaded:!0}),void(this.hu()&&this.getSurveys((()=>{}),!0));if(this.eu)this.eu.then((e=>{this.Rs||t(e.surveys,e.context)})).catch((t=>qa.error("Error in survey callback",t)));else{var n=this.du("/api/surveys/",{method:"GET",query:{token:r.projectToken},sentAt:"query",timeoutMs:this.vn.requestTimeoutMs}).then((t=>{try{return this.vu(r,t)}catch(t){return qa.error("Error processing surveys response",t),this.vu(r,{statusCode:0,error:t})}}),(t=>this.vu(r,{statusCode:0,error:t})));this.eu=n;var o=()=>{this.eu===n&&(this.eu=null)};n.then((e=>{o(),this.Rs||t(e.surveys,e.context)}),o).catch((t=>qa.error("Error in survey callback",t)))}}}du(t,e){var i=this.Os;return i?i.sendRequest(t,e):new Promise((t=>t({statusCode:0,error:new Error(Jl)})))}vu(t,e){if(this.Rs)return{surveys:[],context:{isLoaded:!1,error:Jl}};var i=e.statusCode;if(200!==i||!e.json){var r="Surveys API could not be loaded, status: "+i;return 0!==i?qa.error(r):e.error||qa.warn(r),this.iu=Date.now(),{surveys:[],context:{isLoaded:!1,error:r}}}this.iu=null;var s,n=e.json.surveys||[],o=n.filter((t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(Ia(t)||function(t){var e;return!(null==(e=t.conditions)||null==(e=e.actions)||null==(e=e.values)||!e.length)}(t))));return o.length>0&&(null==(s=this._surveyEventReceiver)||s.register(o)),t.kv.set({[z]:n,[q]:Date.now()}),{surveys:n,context:{isLoaded:!0}}}hu(){return this.cu()&&!this.eu&&!this.fu()}cu(){var t,e,i=null==(t=null!==(e=this.Os)&&void 0!==e?e:this.su)?void 0:t.kv.get(q);return pe(i)&&Date.now()-i>3e5}fu(){return pe(this.iu)&&3e5>Date.now()-this.iu}markSurveyAsSeen(t,e){var i,r={id:t,current_iteration:null!==(i=null==e?void 0:e.iteration)&&void 0!==i?i:null};Va(r);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}}uu(t){for(var e of this.tu)try{if(!t.isLoaded)return e([],t);this.getSurveys(e)}catch(t){qa.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,e){if(void 0===e&&(e=!1),!fe(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);qa.warn("init was not called")}pu(t){var e=null;return this.getSurveys((i=>{var r;e=null!==(r=i.find((e=>e.id===t)))&&void 0!==r?r:null})),e}gu(t){if(fe(this._surveyManager))return{eligible:!1,reason:Jl};var e="string"==typeof t?this.pu(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}mu(t){if(fe(this._surveyManager))return{eligible:!1,reason:Jl};var e="string"==typeof t?this.pu(t):t;return e?this._surveyManager.checkSurveyRenderability(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(fe(this._surveyManager))return qa.warn("init was not called"),{visible:!1,disabledReason:Jl};var e=this.mu(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return fe(this._surveyManager)?(qa.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Jl})):new Promise((i=>{this.getSurveys((e=>{var r,s=null!==(r=e.find((e=>e.id===t)))&&void 0!==r?r:null;if(s){var n=this.mu(s);i({visible:n.eligible,disabledReason:n.reason})}else i({visible:!1,disabledReason:"Survey not found"})}),e)}))}renderSurvey(t,e,i){var r;if(fe(this._surveyManager))qa.warn("init was not called");else{var s="string"==typeof t?this.pu(t):t;if(null!=s&&s.id)if(Wa.includes(s.type)){var n=null==kt?void 0:kt.querySelector(e);if(n)if(null!=(r=s.appearance)&&r.surveyPopupDelaySeconds){qa.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds");var o=setTimeout((()=>{var t,e;this.ru.delete(o),this.Rs||(qa.info("Rendering survey "+s.id+" with delay of "+(null==(t=s.appearance)?void 0:t.surveyPopupDelaySeconds)+" seconds"),null==(e=this._surveyManager)||e.renderSurvey(s,n,i),qa.info("Survey "+s.id+" rendered"))}),1e3*s.appearance.surveyPopupDelaySeconds);this.ru.add(o)}else this._surveyManager.renderSurvey(s,n,i);else qa.warn("Survey element not found")}else qa.warn("Surveys of type "+s.type+" cannot be rendered in the app");else qa.warn("Survey not found")}}displaySurvey(t,e){var r;if(fe(this._surveyManager))qa.warn("init was not called");else{var s=this.pu(t);if(s){var n=s;if(null!=(r=s.appearance)&&r.surveyPopupDelaySeconds&&e.ignoreDelay&&(n=i({},s,{appearance:i({},s.appearance,{surveyPopupDelaySeconds:0})})),e.displayType!==yo.Popover&&e.initialResponses&&qa.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===e.ignoreConditions){var o=this.gu(s);if(!o.eligible)return void qa.warn("Survey is not eligible to be displayed: ",o.reason)}e.displayType!==yo.Inline?this._surveyManager.handlePopoverSurvey(n,e):this.renderSurvey(n,e.selector,e.properties)}else qa.warn("Survey not found")}}cancelPendingSurvey(t){fe(this._surveyManager)?qa.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||null==t.handlePageUnload||t.handlePageUnload()}}function Xl(t,e,i){if(fe(t))return!1;switch(i){case"exact":return t===e;case"contains":var r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(t);case"regex":try{return new RegExp(e).test(t)}catch(t){return!1}default:return!1}}class Zl{constructor(t){this.yu=new Set,this.bu=new Set,this._u=new Ta,this.wu=(t,e)=>this.ku(t,e)&&this.Su(t,e)&&this.xu(t,e)&&this.Cu(t,e),this.ku=(t,e)=>null==e||!e.event||(null==t?void 0:t.event)===(null==e?void 0:e.event),this._instance=t}init(){var t,e;ue(null==(t=this._instance)?void 0:t._addCaptureHook)||(this.Tu=null==(e=this._instance)?void 0:e._addCaptureHook(((t,e)=>{this.on(t,e)})))}dispose(){var t;null==(t=this.Tu)||t.call(this),this.Tu=void 0,this._u=new Ta}register(t){var e,i;if(!ue(null==(e=this._instance)?void 0:e._addCaptureHook)&&(t.forEach((t=>{var e;this.yu.add(t),null==(e=t.steps)||e.forEach((t=>{this.bu.add((null==t?void 0:t.event)||"")}))})),null!=(i=this._instance)&&i.autocapture)){var r=new Set;this.yu.forEach((t=>{var e;null==(e=t.steps)||e.forEach((t=>{null!=t&&t.selector&&r.add(t.selector)}))})),this._instance.autocapture.setElementSelectors(r)}}replace(t){this.yu.clear(),this.bu.clear(),this.register(t)}on(t,e){null!=e&&0!=t.length&&(this.bu.has(t)||this.bu.has(e.event))&&this.yu.forEach((t=>{this.Mu(e,t)&&this._u.emit("actionCaptured",t.name)}))}Eu(t){this.onAction("actionCaptured",(e=>t(e)))}Mu(t,e){if(null==(null==e?void 0:e.steps))return!1;for(var i of e.steps)if(this.wu(t,i))return!0;return!1}onAction(t,e){return this._u.on(t,e)}Su(t,e){if(null!=e&&e.url){var i,r=null==t||null==(i=t.properties)?void 0:i.$current_url;if(!r||"string"!=typeof r)return!1;if(!Xl(r,e.url,e.url_matching||"contains"))return!1}return!0}xu(t,e){return!!this.Iu(t,e)&&!!this.Ru(t,e)&&!!this.Pu(t,e)}Iu(t,e){var i;if(null==e||!e.href)return!0;var r=this.Au(t);if(r.length>0)return r.some((t=>Xl(t.href,e.href,e.href_matching||"exact")));var s,n=(null==t||null==(i=t.properties)?void 0:i.$elements_chain)||"";return!!n&&Xl((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",e.href,e.href_matching||"exact")}Ru(t,e){var i;if(null==e||!e.text)return!0;var r=this.Au(t);if(r.length>0)return r.some((t=>Xl(t.text,e.text,e.text_matching||"exact")||Xl(t.$el_text,e.text,e.text_matching||"exact")));var s,n,o,a=(null==t||null==(i=t.properties)?void 0:i.$elements_chain)||"";return!!a&&(s=function(t){for(var e,i=[],r=/(?::|")text="(.*?)"/g;!fe(e=r.exec(t));)i.includes(e[1])||i.push(e[1]);return i}(a),n=e.text,o=e.text_matching||"exact",s.some((t=>Xl(t,n,o))))}Pu(t,e){var i,r;if(null==e||!e.selector)return!0;var s=null==t||null==(i=t.properties)?void 0:i.$element_selectors;if(null!=s&&s.includes(e.selector))return!0;var n=(null==t||null==(r=t.properties)?void 0:r.$elements_chain)||"";if(e.selector_regex&&n)try{return new RegExp(e.selector_regex).test(n)}catch(t){return!1}return!1}Au(t){var e;return null==(null==t||null==(e=t.properties)?void 0:e.$elements)?[]:null==t?void 0:t.properties.$elements}Cu(t,e){return null==e||!e.properties||0===e.properties.length||Da(e.properties.reduce(((t,e)=>{var i=oe(e.value)?e.value.map(String):null!=e.value?[String(e.value)]:[];return t[e.key]={values:i,operator:e.operator||"exact"},t}),{}),null==t?void 0:t.properties)}}class th{constructor(t){var e;this.Fu=[],this._instance=t,this.Ou=new Map,this.Lu=new Map,this.Du=new Map,this.$u=null==(e=this._instance)||null==e.onSessionId?void 0:e.onSessionId((t=>this.Nu(t)))}qu(t){return!1}ju(){return null}Bu(t){}Hu(){}zu(t,e){return!!t&&Da(t.propertyFilters,null==e?void 0:e.properties)}Uu(t,e){var i=new Map;return t.forEach((t=>{var r;null==(r=t.conditions)||null==(r=r[e])||null==(r=r.values)||r.forEach((e=>{if(null!=e&&e.name){var r=i.get(e.name)||[];r.push(t.id),i.set(e.name,r)}}))})),i}Wu(t,e,i){var r=(i===po.Activation?this.Ou:this.Lu).get(t),s=[];return this.Vu((t=>{s=t.filter((t=>null==r?void 0:r.includes(t.id)))})),s.filter((r=>{var s,n=null==(s=r.conditions)||null==(s=s[i])||null==(s=s.values)?void 0:s.find((e=>e.name===t));return this.zu(n,e)}))}register(t){this.Gu(t,!1)}replace(t){this.Gu(t,!0)}Gu(t,e){var i;ue(null==(i=this._instance)?void 0:i._addCaptureHook)||(this.Zu(t,e),this.Qu(t,e))}Qu(t,e){var i=t.filter((t=>{var e;return null==(e=t.conditions)||null==(e=e.actions)||null==(e=e.values)?void 0:e.length}));if(e&&this.Du.clear(),0!==i.length){this.Ju||(this.Ju=new Zl(this._instance),this.Ju.init(),this.Ju.Eu((t=>this.onAction(t))));var r=[];i.forEach((t=>{var e;null==(e=t.conditions)||null==(e=e.actions)||e.values.forEach((e=>{if(r.push(e),e.name){var i,s=null!==(i=this.Du.get(e.name))&&void 0!==i?i:[];s.includes(t.id)||s.push(t.id),this.Du.set(e.name,s)}}))})),e?this.Ju.replace(r):this.Ju.register(r)}else{var s;e&&(null==(s=this.Ju)||s.replace([]))}}Ku(t,e){e.forEach(((e,i)=>{var r,s=null!==(r=t.get(i))&&void 0!==r?r:[];e.forEach((t=>{s.includes(t)||s.push(t)})),t.set(i,s)}))}Zu(t,e){var i,r,s=t.filter((t=>{var e,i;return(null==(e=t.conditions)?void 0:e.events)&&(null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)?void 0:i.length)>0})),n=t.filter((t=>{var e,i;return(null==(e=t.conditions)?void 0:e.cancelEvents)&&(null==(i=t.conditions)||null==(i=i.cancelEvents)||null==(i=i.values)?void 0:i.length)>0})),o=this.Uu(t,po.Activation),a=this.Uu(t,po.Cancellation);e?(this.Ou=o,this.Lu=a):(this.Ku(this.Ou,o),this.Ku(this.Lu,a)),(0!==s.length||0!==n.length)&&(null!==(i=this.Tu)&&void 0!==i||(this.Tu=null==(r=this._instance)?void 0:r._addCaptureHook(((t,e)=>{this.onEvent(t,e)}))))}onEvent(t,e){var i,r,s=this.Yu(),n=(null==e||null==(i=e.properties)?void 0:i.$survey_id)||(null==e||null==(r=e.properties)?void 0:r.$product_tour_id);if(n&&this.getActivatedIds().includes(n)){var o=this.Xu(t,n);if("consume"===o)return s.info("event consumed activated item, removing it",{event:t,itemId:n}),void this.th([n]);if("persist"===o)return s.info("shown item promoted to persisted activation",{event:t,itemId:n}),this.eh(n),void this.ih([n])}if(this.Lu.has(t)){var a=this.Wu(t,e,po.Cancellation);a.length>0&&(s.info("cancel event matched, cancelling items",{event:t,itemsToCancel:a.map((t=>t.id))}),this.th(a.map((t=>t.id))),a.forEach((t=>this.rh(t.id))))}if(this.Ou.has(t)){s.info("event name matched",{event:t,eventPayload:e,items:this.Ou.get(t)});var l=this.Wu(t,e,po.Activation);this.nh(l.map((t=>t.id)))}}onAction(t){this.Du.has(t)&&this.nh(this.Du.get(t)||[])}nh(t){var e;if(0!==t.length){var i=!(null==(e=this._instance)||null==e.get_session_id||!e.get_session_id()),r=[];for(var s of t)i&&this.qu(s)?this.eh(s)&&this.sh(s):r.push(s);r.length>0&&(this.Fu=[...new Set([...this.Fu,...r])]),this.Yu().info("updating activated items",{activatedItems:this.getActivatedIds()})}}eh(t){this.Fu=this.Fu.filter((e=>e!==t));var e=this.ah();return!e.includes(t)&&(this.oh([...e,t]),this.lh(),!0)}th(t){var e=new Set(t);this.Fu=this.Fu.filter((t=>!e.has(t)));var i=this.uh(),r=i.filter((t=>!e.has(t)));r.length!==i.length&&(this.oh(r),0===r.length&&this.hh()),this.ih(t)}dh(){var t,e=this.ju();if(!e)return{};var i=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[e];return i&&"object"==typeof i?i:{}}sh(t){if(this.ju()){var e=this.dh();this.Bu(i({},e,{[t]:Date.now()}))}}ih(t){if(this.ju()){var e=this.dh(),i={},r=!1;for(var s of Object.entries(e)){var n=s[0],o=s[1];t.includes(n)?r=!0:i[n]=o}r&&(he(i)?this.Hu():this.Bu(i))}}fh(){this.ju()&&this.Hu()}getActivationTimestamp(t){if(this.ah().includes(t)){var e=this.dh()[t];return pe(e)?e:void 0}}uh(){var t,e=this.ph();return(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[e])||[]}ah(){var t,e,i=this.uh();if(0===i.length)return[];var r=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[this.gh()],s=null==(e=this._instance)||null==e.get_session_id?void 0:e.get_session_id();return s&&r===s?i:[]}lh(){var t,e=null==(t=this._instance)||null==t.get_session_id?void 0:t.get_session_id();e&&this.mh(e)}hh(){this.yh()}Nu(t){var e,i=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[this.gh()];if(i&&i!==t){var r=this.uh(),s=this.dh();r.length>0&&(this.oh([]),r.filter((t=>pe(s[t]))).forEach((t=>this.rh(t)))),this.hh(),this.fh()}}getActivatedIds(){return[...new Set([...this.ah(),...this.Fu])].filter((t=>!this.bh(t)))}dispose(){var t,e,i;null==(t=this.$u)||t.call(this),this.$u=void 0,null==(e=this.Tu)||e.call(this),this.Tu=void 0,null==(i=this.Ju)||i.dispose(),this.Ju=void 0}reset(){this.Fu=[],this.uh().length>0&&this.oh([]),this.hh(),this.fh()}getEventToItemsMap(){return this.Ou}_h(){return this.Ju}}class eh extends th{constructor(t){super(t)}ph(){return H}gh(){return V}ju(){return W}Bu(t){var e;null==(e=this._instance)||null==(e=e.persistence)||e.register({[W]:t})}Hu(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(W)}qu(t){var e,i;this.Vu((e=>{i=e.find((e=>e.id===t))}));var r=null==(e=i)||null==(e=e.appearance)?void 0:e.surveyPopupDelaySeconds;return pe(r)&&r>0}wh(){return go.SHOWN}Vu(t){var e;null==(e=this._instance)||e.getSurveys(t)}rh(t){var e;null==(e=this._instance)||e.cancelPendingSurvey(t)}Yu(){return qa}oh(t){var e;null==(e=this._instance)||null==(e=e.persistence)||e.register({[H]:t})}mh(t){var e;null==(e=this._instance)||null==(e=e.persistence)||e.register({[V]:t})}yh(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(V)}bh(){return!1}Xu(t,e){var i;this.Vu((t=>{i=t.find((t=>t.id===e))}));var r=!i||function(t){var e;return Ia(t)&&!(null==(e=t.conditions)||null==(e=e.events)||!e.repeatedActivation)||"always"===t.schedule}(i);return r?t===go.SHOWN?"consume":"ignore":t===go.SHOWN?"persist":t===go.DISMISSED||t===go.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}class ih{constructor(t){this._instance=t}initialize(){}get(t){if("string"==typeof t)return this._instance.get_property(t);var e={};for(var i of t){var r=this._instance.get_property(i);ue(r)||(e[i]=r)}return e}set(t,e){this._instance.register("string"==typeof t?{[t]:e}:t)}remove(t){"string"!=typeof t?t.forEach((t=>this._instance.unregister(t))):this._instance.unregister(t)}}class rh{constructor(t){this._instance=t}get(){var t=this._instance.config;return{disableSurveys:t.disable_surveys,cookielessMode:!!t.cookieless_mode,advancedEnableSurveys:t.advanced_enable_surveys,requestTimeoutMs:t.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}getExtensions(){var t=null==Ft?void 0:Ft.__PosthogExtensions__;if(t){var e=t.generateSurveys,i=t.loadExternalDependency;return{generateSurveys:e?t=>e(this._instance,t):void 0,loadExternalDependency:i?t=>i(this._instance,"surveys",t):void 0}}}createEventReceiver(){return new eh(this._instance)}}var sh=null!=xt&&xt.location?zn(xt.location.hash,"__posthog")||zn(location.hash,"state"):null,nh="_postHogToolbarParams",oh=Jr("[Toolbar]"),ah=Jr("[FeatureFlags]");class lh{constructor(t,e){void 0===e&&(e=!1),this.kh=!1,this.update(t,e)}update(t,e){this.Sh=((t,e)=>{var i,r,s,n,o;return{bootstrap:{featureFlags:null==(i=t.bootstrap)?void 0:i.featureFlags,featureFlagPayloads:null==(r=t.bootstrap)?void 0:r.featureFlagPayloads},remoteRequestsDisabled:e,featureFlagsDisabled:!!t.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!t.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!t.advanced_feature_flags_dedup_per_session,cacheTtlMs:t.feature_flag_cache_ttl_ms,refreshIntervalMs:null!==(s=t.remote_config_refresh_interval_ms)&&void 0!==s?s:3e5,requestTimeoutMs:t.feature_flag_request_timeout_ms,compression:t.disable_compression?void 0:"best-available",evaluationContexts:null!==(n=null!==(o=t.evaluation_contexts)&&void 0!==o?o:t.evaluation_environments)&&void 0!==n?n:[],flagKeys:oe(t.flag_keys)?t.flag_keys:void 0}})(t,e),!t.evaluation_environments||t.evaluation_contexts||this.kh||(ah.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.kh=!0),ue(t.flag_keys)||oe(t.flag_keys)||ah.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.Sh}}var hh=Jr("[FeatureFlags]"),uh=Jr("[FeatureFlags]",{debugEnabled:!0}),dh="\" failed. Feature flags didn't load in time.",vh="connection_error",ch=t=>{for(var e={},i=0;t.length>i;i++)e[t[i]]=!0;return e},fh=t=>{var e={};for(var i of Zr(t||{})){var r=i[1];r&&(e[i[0]]=r)}return e},ph=Jr("[Error tracking]"),_h=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:"],gh=["__firefox__","__gCrWeb"],mh="Refusing to render web experiment since the viewer is a likely bot",yh={icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>-1===e.toLowerCase().indexOf(t.toLowerCase()),regex:(t,e)=>Aa(e,t),not_regex:(t,e)=>!Aa(e,t),exact:(t,e)=>e===t,is_not:(t,e)=>e!==t};class bh{get vn(){return this._instance.config}constructor(t){var e=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),e.getWebExperiments((t=>{bh.xh("retrieved web experiments from the server"),e.Ch=new Map,t.forEach((t=>{if(t.feature_flag_key){var i;e.Ch&&(bh.xh("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(i=e.Ch)||i.set(t.feature_flag_key,t));var r=e._instance.getFeatureFlag(t.feature_flag_key);de(r)&&t.variants[r]&&e.Th(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var n=t.variants[s];bh.Mh(n,e._instance)&&e.Th(t.name,s,n.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((t=>{this.onFeatureFlags(t)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())bh.xh(mh);else if(!this.vn.disable_web_experiments){if(fe(this.Ch))return this.Ch=new Map,this.loadIfEnabled(),void this.previewWebExperiment();bh.xh("applying feature flags",t),t.forEach((t=>{var e;if(this.Ch&&null!=(e=this.Ch)&&e.has(t)){var i,r=this._instance.getFeatureFlag(t),s=null==(i=this.Ch)?void 0:i.get(t);r&&null!=s&&s.variants[r]&&this.Th(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var t=bh.getWindowLocation();if(null!=t&&t.search){var e=jn(null==t?void 0:t.search,"__experiment_id"),i=jn(null==t?void 0:t.search,"__experiment_variant");e&&i&&(bh.xh("previewing web experiments "+e+" && "+i),this.getWebExperiments((t=>{this.Eh(parseInt(e),i,t)}),!1,!0))}}loadIfEnabled(){this.vn.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,e,i){if(this.vn.disable_web_experiments&&!i)return t([]);var r=this._instance.get_property("$web_experiments");if(r&&!e)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.vn.token),method:"GET",timestampMode:"query",callback:e=>t(200===e.statusCode&&e.json&&e.json.experiments||[])})}Eh(t,e,i){var r=i.filter((e=>e.id===t));r&&r.length>0&&(bh.xh("Previewing web experiment ["+r[0].name+"] with variant ["+e+"]"),this.Th(r[0].name,e,r[0].variants[e].transforms))}static Mh(t,e){return!fe(t.conditions)&&bh.Ih(t,e)&&bh.Rh(t)}static Ih(t,e){var i;if(fe(t.conditions)||fe(null==(i=t.conditions)?void 0:i.url))return!0;var r=bh.getWindowLocation();if(r){var s,n,o,a=Ms(e,r.href);return null==(s=t.conditions)||!s.url||yh[null!==(n=null==(o=t.conditions)?void 0:o.urlMatchType)&&void 0!==n?n:"icontains"](t.conditions.url,a)}return!1}static getWindowLocation(){return null==xt?void 0:xt.location}static Rh(t){var e;if(fe(t.conditions)||fe(null==(e=t.conditions)?void 0:e.utm))return!0;var i=Yn();if(i.utm_source){var r,s,n,o,a,l,h,u,d=null==(r=t.conditions)||null==(r=r.utm)||!r.utm_campaign||(null==(s=t.conditions)||null==(s=s.utm)?void 0:s.utm_campaign)==i.utm_campaign,v=null==(n=t.conditions)||null==(n=n.utm)||!n.utm_source||(null==(o=t.conditions)||null==(o=o.utm)?void 0:o.utm_source)==i.utm_source,c=null==(a=t.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=t.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==i.utm_medium,f=null==(h=t.conditions)||null==(h=h.utm)||!h.utm_term||(null==(u=t.conditions)||null==(u=u.utm)?void 0:u.utm_term)==i.utm_term;return d&&c&&f&&v}return!1}static xh(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];Kr.info("[WebExperiments] "+t,i)}Th(t,e,i){this._is_bot()?bh.xh(mh):"control"!==e?i.forEach((i=>{if(i.selector){var r;bh.xh("applying transform of variant "+e+" for experiment "+t+" ",i);var s=null==(r=document)?void 0:r.querySelectorAll(i.selector);null==s||s.forEach((t=>{var e=t;i.html&&(e.innerHTML=i.html),i.css&&e.setAttribute("style",i.css)}))}})):bh.xh("Control variants leave the page unmodified.")}_is_bot(){return St&&this._instance?Ca(St,this.vn.custom_blocked_useragents):void 0}}var wh=Jr("[Conversations]"),xh="Conversations not available yet.";function Eh(t,e){var i,r,s,n,o,a,l,h=null!==(i=null==t?void 0:t.flushIntervalMs)&&void 0!==i?i:3e3,u=null!==(r=null==t?void 0:t.maxBufferSize)&&void 0!==r?r:100,d=null!=e&&e.consoleCapture?void 0:null!==(s=null==t?void 0:t.maxLogsPerInterval)&&void 0!==s?s:1e3,v=ue(d)?Math.max(u,2048):Math.max(u,d),c=null==t?void 0:t.resourceAttributes;return{serviceName:null!==(n=null!==(o=null==c?void 0:c["service.name"])&&void 0!==o?o:null==t?void 0:t.serviceName)&&void 0!==n?n:null==e?void 0:e.serviceNameDefault,serviceVersion:null!==(a=null==c?void 0:c["service.version"])&&void 0!==a?a:null==t?void 0:t.serviceVersion,environment:null!==(l=null==c?void 0:c["deployment.environment"])&&void 0!==l?l:null==t?void 0:t.environment,resourceAttributes:c,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:h,maxBufferSize:u,maxQueueSize:v,maxBatchRecordsPerPost:100,rateCapWindowMs:h,maxLogsPerInterval:d,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}var Sh=["debug","log","warn","error","info"],kh="console",Th="__posthogHandledLogsRequestError",$h=(t,e)=>{var i=t instanceof Error?t:new Error(e);return i[Th]=!0,i},Ph=t=>!!t&&"object"==typeof t&&!0===t[Th],Rh={featureFlags:class{constructor(t){this.name="featureFlags",this.Ph=!1,this.featureFlagEventHandlers=[],this.I=hh,this.Ah={},this.Fh={},this.Oh=[],this.Lh=!1,this.Dh=!1,this.$h=0,this.Nh=!1,this.qh=!1,this.jh=!1,this.Bh=!1,this.Hh=0,this.Ht=()=>{var t=this.zh();this.Hh=0,t&&this.reloadFeatureFlags()},this.Uh=()=>{var t,e=this.Wh;ue(e)||this.vn.remoteRequestsDisabled||!kt||"hidden"===kt.visibilityState||Date.now()-(null!==(t=this.Vh)&&void 0!==t?t:0)<e||(this.reloadFeatureFlags(),this.Gh())},this.$t=()=>{"visible"===(null==kt?void 0:kt.visibilityState)&&this.Uh()},"get"in t?this.Ps=t:(this.Zh=new lh(t.config,t.Ua()),this.Ps=this.Zh)}updateConfig(t,e){var i;null==(i=this.Zh)||i.update(t,e),this.Os&&this.Qh()}setup(t){return this.au=t,this.I=t.logger.createLogger("[FeatureFlags]"),Kl(t.kv.initialize(),(()=>{this.au===t&&(this.au=void 0,this.Os=t,this.Jh(t))}))}Jh(t){if(this.Os===t)return xt&&ns(xt,"online",this.Ht),this.Qh(),this.Kh=t.registerDynamicEventProperties((()=>this.Yh()?this.Ah:this.Fh)),this.Xh(),this.initialize()}Qh(){var t=this.vn.refreshIntervalMs,e=!this.vn.remoteRequestsDisabled&&kt&&!ue(t)&&t>0?t:void 0;e!==this.Wh&&(this.td(),ue(e)||(this.Wh=e,this.Gh(),null!=kt&&kt.addEventListener&&ns(kt,_t,this.$t)))}Gh(){ue(this.Wh)||(ue(this.ed)||clearInterval(this.ed),this.Vh=Date.now(),this.ed=setInterval(this.Uh,this.Wh))}td(){ue(this.ed)||(clearInterval(this.ed),this.ed=void 0,null==kt||null==kt.removeEventListener||kt.removeEventListener(_t,this.$t)),this.Wh=void 0,this.Vh=void 0}destroy(){this.rd()}dispose(){this.rd()}rd(){var t;this.td(),this.$h++,this.qh=!1,this.au=void 0,this.Os&&(this.nd(),null==(t=this.Kh)||t.dispose(),this.Kh=void 0,this.Oh=[],null==xt||xt.removeEventListener("online",this.Ht),this.Os=void 0)}get vn(){return this.Ps.get()}sd(t){var e;return null==(e=this.Os)?void 0:e.kv.get(t)}ei(t){this.ad((()=>{var e;return null==(e=this.Os)?void 0:e.kv.set(t)}))}ri(t){this.ad((()=>{var e;return null==(e=this.Os)?void 0:e.kv.remove(t)}))}ad(t){try{t()}catch(t){this.I.error("Failed to update feature flag persistence",t)}}Xh(){var t={};for(var e of[O,F,M,N]){var r=this.sd(e);ue(r)||(t[e]=r)}this.Ah=t;var s=i({},t),n=this.sd(C);if(n)for(var o of Object.entries(n))s["$feature/"+o[0]]=o[1];this.Fh=s}Yh(){var t=this.vn.cacheTtlMs;if(!t||0>=t)return!1;var e=this.sd(Q);return"number"!=typeof e||Date.now()-e>t}od(){return!!this.Yh()&&(this.Bh||this.Dh||(this.Bh=!0,this.I.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}ld(){var t=this.vn.evaluationContexts;return null!=t&&t.length?t.filter((t=>{var e=t&&"string"==typeof t&&t.trim().length>0;return e||this.I.error("Invalid evaluation context found:",t,"Expected non-empty string"),e})):[]}ud(){var t=this.vn.flagKeys;if(!ue(t))return t.filter((t=>{var e=t&&"string"==typeof t&&t.trim().length>0;return e||this.I.error("Invalid flag key found:",t,"Expected non-empty string"),e}))}initialize(){var t,e,i=this.vn,r=null!==(t=null==(e=i.bootstrap)?void 0:e.featureFlags)&&void 0!==t?t:{};if(Object.keys(r).length){var s,n,o=null!==(s=null==(n=i.bootstrap)?void 0:n.featureFlagPayloads)&&void 0!==s?s:{},a=Object.keys(r).filter((t=>!!r[t])).reduce(((t,e)=>(t[e]=r[e]||!1,t)),{}),l=Object.keys(o).filter((t=>a[t])).reduce(((t,e)=>(t[e]=o[e],t)),{});return this.hd({featureFlags:a,featureFlagPayloads:l})}}updateFlags(t,e,r){var s,n,o=null!=r&&r.merge&&null!==(s=this.sd(C))&&void 0!==s?s:{},a=null!=r&&r.merge&&null!==(n=this.sd(F))&&void 0!==n?n:{},l=i({},o,t),h=i({},a,e),u={};for(var d of Object.entries(l)){var v=d[0],c=d[1];u[v]={key:v,enabled:Dt(c),variant:Nt(c),reason:void 0,metadata:ue(null==h?void 0:h[v])?void 0:{id:0,version:void 0,description:void 0,payload:h[v]}}}this.hd({flags:u})}get hasLoadedFlags(){return this.Lh}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.sd(A),e=this.sd(N),r=this.sd(L);if(!r&&!e)return t||{};var s=Xr({},t||{}),n=[...new Set([...Object.keys(r||{}),...Object.keys(e||{})])];for(var o of n){var a,l,h=s[o],u=null==e?void 0:e[o],d=ue(u)?null!==(a=null==h?void 0:h.enabled)&&void 0!==a&&a:!!u,v=ue(u)?null==h?void 0:h.variant:"string"==typeof u?u:void 0,c=null==r?void 0:r[o],f=i({},h,{enabled:d,variant:d?null!=v?v:null==h?void 0:h.variant:void 0});d!==(null==h?void 0:h.enabled)&&(f.original_enabled=null==h?void 0:h.enabled),v!==(null==h?void 0:h.variant)&&(f.original_variant=null==h?void 0:h.variant),c&&(f.metadata=i({},null==h?void 0:h.metadata,{payload:c,original_payload:null==h||null==(l=h.metadata)?void 0:l.payload})),s[o]=f}return this.Ph||(this.I.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:r,finalDetails:s}),this.Ph=!0),s}getAllFeatureFlags(){var t=this.getFlagVariants(),e=this.getFlagPayloads();return Object.keys(t).map((i=>{var r=t[i];return{key:i,enabled:Dt(r),variant:Nt(r),payload:Mt(e[i])}}))}getFlagVariants(){var t=this.sd(C),e=this.sd(N);if(!e)return t||{};for(var i=Xr({},t||{}),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.Ph||(this.I.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:i}),this.Ph=!0),i}getFlagPayloads(){var t=this.sd(F),e=this.sd(L);if(!e)return t||{};for(var i=Xr({},t||{}),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.Ph||(this.I.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:i}),this.Ph=!0),i}reloadFeatureFlags(){this.Nh||this.vn.featureFlagsDisabled||this.zh()||this.dd||(this.Oh.slice().forEach((t=>{try{t()}catch(t){this.I.error("Error while running feature flags reloading callback",t)}})),this.dd=setTimeout((()=>{this.vd()}),5))}nd(){clearTimeout(this.dd),this.dd=void 0}onReloading(t){return this.Oh.push(t),()=>{this.Oh=this.Oh.filter((e=>e!==t))}}ensureFlagsLoaded(){this.Lh||this.Dh||this.dd||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.Nh=t}resetFlagCallReported(){this.ri(K)}vd(t){this.nd();var e=this.Os;if(e&&!this.vn.remoteRequestsDisabled&&!this.zh())if(this.Dh)this.qh=!0;else{var r={token:e.projectToken,distinct_id:e.distinctId,groups:e.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:i({},e.initialPersonProperties,this.sd(U)||{},{$lib:e.library.name,$lib_version:e.library.version}),group_properties:this.sd(j),timezone:so()};ue(e.deviceId)||(r.$device_id=e.deviceId),(null!=t&&t.disableFlags||this.vn.featureFlagsDisabled)&&(r.disable_flags=!0);var s=this.ld();s.length&&(r.evaluation_contexts=s);var n=this.ud();ue(n)||(r.flag_keys=n);var o=this.vn.onlyEvaluateSurveyFeatureFlags,a="/flags/?v=2"+(o?"&only_evaluate_survey_feature_flags=true":""),l=this.$h;this.Dh=!0;var h=()=>{this.qh&&(this.qh=!1,this.vd())},u=t=>{this.Dh=!1,l===this.$h?(this.ei({[Y]:[vh]}),this.I.error("Feature flag request failed",t),h()):h()};try{e.sendRequest(a,{target:"flags",method:"POST",body:r,compression:this.vn.compression,sentAt:"body",timeoutMs:this.vn.requestTimeoutMs}).then((t=>{var e,i,s=null!==(e=t.json)&&void 0!==e?e:{},n=200!==t.statusCode;if(this.Dh=!1,l===this.$h){if(this.fd(t.statusCode),n||this.qh||(this.$anon_distinct_id=void 0),!r.disable_flags||this.qh){this.jh=!n;var a=[];t.error?a.push(t.error instanceof Error&&"AbortError"===t.error.name?"timeout":t.error instanceof Error?vh:"unknown_error"):200!==t.statusCode&&a.push("api_error_"+t.statusCode),s.errorsWhileComputingFlags&&a.push("errors_while_computing_flags");var u=!(null==(i=s.quotaLimited)||!i.includes("feature_flags"));u&&a.push("quota_limited"),this.ei({[Y]:a}),u?this.I.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):r.disable_flags||this.hd(s,n,{partialResponse:o}),h()}}else h()})).catch(u)}catch(t){u(t)}}}zh(){return qn(this.Hh,3)}fd(t){this.Hh=Hn(t,this.Hh,3,(()=>this.I.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes.")))}getFeatureFlag(t,e){var i;if(void 0===e&&(e={}),!e.fresh||this.jh)if(this.Lh||this.getFlags()&&this.getFlags().length>0){if(!this.od()){var r=this.getFeatureFlagResult(t,e);return null!==(i=null==r?void 0:r.variant)&&void 0!==i?i:null==r?void 0:r.enabled}}else this.I.warn('getFeatureFlag for key "'+t+dh)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var e=this.getFeatureFlagResult(t,{send_event:!1});return null==e?void 0:e.payload}getFeatureFlagResult(t,e){if(void 0===e&&(e={}),!e.fresh||this.jh)if(this.Lh||this.getFlags()&&this.getFlags().length>0){if(!this.od()){var r,s=this.getFlagVariants(),n=t in s,o=s[t],a=this.getFlagPayloads()[t],l=String(o),h=this.sd(M)||void 0,u=this.sd(Q)||void 0,d=this.sd(K)||{};if(this.vn.deduplicateCallsPerSession){var v,c=null==(v=this.Os)?void 0:v.session.sessionId,f=this.sd(J);c&&c!==f&&(d={},r=c)}if(e.send_event||!("send_event"in e))if(t in d&&d[t].includes(l))r&&this.ei({[K]:d,[J]:r});else{var p,_,g,m,y,b,w,x,E,S,k,T;oe(d[t])?d[t].push(l):d[t]=[l],this.ei(i({[K]:d},r?{[J]:r}:{}));var P=this.getFeatureFlagDetails(t),R=[...null!==(p=this.sd(Y))&&void 0!==p?p:[]];ue(o)&&R.push("flag_missing");var C={$feature_flag:t,$feature_flag_response:o,$feature_flag_payload:null!=a?a:null,$feature_flag_request_id:h,$feature_flag_evaluated_at:u,$feature_flag_bootstrapped_response:null!==(_=null==(g=this.vn.bootstrap)||null==(g=g.featureFlags)?void 0:g[t])&&void 0!==_?_:null,$feature_flag_bootstrapped_payload:null!==(m=null==(y=this.vn.bootstrap)||null==(y=y.featureFlagPayloads)?void 0:y[t])&&void 0!==m?m:null,$used_bootstrap_value:!this.jh};ue(null==P||null==(b=P.metadata)?void 0:b.has_experiment)||(C.$feature_flag_has_experiment=P.metadata.has_experiment),ue(null==P||null==(w=P.metadata)?void 0:w.version)||(C.$feature_flag_version=P.metadata.version);var O,I=null!==(x=null==P||null==(E=P.reason)?void 0:E.description)&&void 0!==x?x:null==P||null==(S=P.reason)?void 0:S.code;I&&(C.$feature_flag_reason=I),null!=P&&null!=(k=P.metadata)&&k.id&&(C.$feature_flag_id=P.metadata.id),ue(null==P?void 0:P.original_variant)&&ue(null==P?void 0:P.original_enabled)||(C.$feature_flag_original_response=ue(P.original_variant)?P.original_enabled:P.original_variant),null!=P&&null!=(T=P.metadata)&&T.original_payload&&(C.$feature_flag_original_payload=null==P||null==(O=P.metadata)?void 0:O.original_payload),R.length&&(C.$feature_flag_error=R.join(",")),this.pd(C)}else r&&this.ei({[K]:d,[J]:r});if(n)return{key:t,enabled:!!o,variant:"string"==typeof o?o:void 0,payload:Mt(a)}}}else this.I.warn('getFeatureFlagResult for key "'+t+dh)}pd(t){try{var e;null==(e=this.Os)||e.capture("$feature_flag_called",t).catch((t=>{this.I.error("Failed to capture feature flag call",t)}))}catch(t){this.I.error("Failed to capture feature flag call",t)}}getRemoteConfigPayload(t,e){this.gd(t,e)}gd(t,i){var r=this;return e((function*(){var e=r.Os;if(e){var s={distinct_id:e.distinctId,token:e.projectToken,person_properties:{$lib:e.library.name,$lib_version:e.library.version}},n=r.ld();n.length&&(s.evaluation_contexts=n);var o,a=r.ud();ue(a)||(s.flag_keys=a);try{var l,h=null==(l=(yield e.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:s,compression:r.vn.compression,sentAt:"body",timeoutMs:r.vn.requestTimeoutMs})).json)?void 0:l.featureFlagPayloads;o=(null==h?void 0:h[t])||void 0}catch(t){return void r.I.error("Remote config feature flag request failed",t)}try{i(o)}catch(t){r.I.error("Remote config feature flag callback failed",t)}}}))()}isFeatureEnabled(t,e){if(void 0===e&&(e={}),e.fresh&&!this.jh)return e.defaultValue;if(!(this.Lh||this.getFlags()&&this.getFlags().length>0))return this.I.warn('isFeatureEnabled for key "'+t+dh),e.defaultValue;var i=this.getFeatureFlag(t,e);return ue(i)?e.defaultValue:!!i}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((e=>e!==t))}receivedFeatureFlags(t,e,i){this.hd(t,e,i)}hd(t,e,r){if(this.Os){this.Lh=!0;var s=function(t,e,r,s,n,o){void 0===e&&(e={}),void 0===r&&(r={}),void 0===s&&(s={}),void 0===o&&(o=hh);var a=((t,e)=>{var r=t.flags;return r?i({},t,{featureFlags:Object.fromEntries(Object.keys(r).map((t=>{var e;return[t,null!==(e=r[t].variant)&&void 0!==e?e:r[t].enabled]}))),featureFlagPayloads:Object.fromEntries(Object.keys(r).filter((t=>r[t].enabled)).filter((t=>{var e;return null==(e=r[t].metadata)?void 0:e.payload})).map((t=>{var e;return[t,null==(e=r[t].metadata)?void 0:e.payload]})))}):(t.featureFlags&&e.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t)})(t,o),l=a.flags,h=a.featureFlags,u=a.featureFlagPayloads;if(h){var d=t.requestId,v=t.evaluatedAt;if(oe(h)){o.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var c={};if(h)for(var f=0;h.length>f;f++)c[h[f]]=!0;return{[O]:h,[C]:c,[D]:!1}}var p=h,_=u,g=l;if(null!=n&&n.partialResponse)p=i({},e,p),_=i({},r,_),g=i({},s,g);else if(t.errorsWhileComputingFlags)if(l){var m=new Set(Object.keys(l).filter((t=>{var e;return!(null!=(e=l[t])&&e.failed)})));p=i({},e,Object.fromEntries(Object.entries(p).filter((t=>m.has(t[0]))))),_=i({},r,Object.fromEntries(Object.entries(_||{}).filter((t=>m.has(t[0]))))),g=i({},s,Object.fromEntries(Object.entries(g||{}).filter((t=>m.has(t[0])))))}else p=i({},e,p),_=i({},r,_),g=i({},s,g);return i({[O]:Object.keys(fh(p)),[C]:p||{},[F]:_||{},[A]:g||{},[D]:!0===t.minimalFlagCalledEvents},d?{[M]:d}:{},v?{[Q]:v}:{})}}(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),r,this.I);s&&this.ei(s),e||(this.Bh=!1),this.md(e)}}override(t,e){void 0===e&&(e=!1),this.I.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){this.yd(t)}yd(t){if(this.Os){if(!1===t)return this.ri([N,L]),this.md(),void uh.info("All overrides cleared");if(oe(t))return this.ei({[N]:ch(t)}),this.md(),void uh.info("Flag overrides set",{flags:t});if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var e,i=t;this.Ph=Boolean(null!==(e=i.suppressWarning)&&void 0!==e&&e);var r={},s=i.flags,n=i.payloads;return s&&(r[N]=oe(s)?ch(s):s),n&&(r[L]=n),Object.keys(r).length&&this.ei(r),!1===s&&!1===n?this.ri([N,L]):!1===s?this.ri(N):!1===n&&this.ri(L),this.md(),!1===s?uh.info("Flag overrides cleared"):s&&uh.info("Flag overrides set",{flags:s}),void(!1===n?uh.info("Payload overrides cleared"):n&&uh.info("Payload overrides set",{payloads:n}))}if(t&&"object"==typeof t)return this.ei({[N]:t}),this.md(),void uh.info("Flag overrides set",{flags:t});this.I.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}else this.I.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.Lh){var e=this.bd(),i=e.flags,r=e.flagVariants;try{t(i,r)}catch(t){this.I.error("Error while running feature flags callback",t)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,r){var s=(this.sd(I)||[]).find((e=>e.flagKey===t)),n={["$feature_enrollment/"+t]:e},o={$feature_flag:t,$feature_enrollment:e,$set:n};s&&(o.$early_access_feature_name=s.name),r&&(o.$feature_enrollment_stage=r);var a=i({},this.getFlagVariants(),{[t]:e});this.ei({[O]:Object.keys(fh(a)),[C]:a,[U]:i({},this.sd(U)||{},n)}),this.md();try{var l;null==(l=this.Os)||l.capture("$feature_enrollment_update",o).catch((t=>{this.I.error("Failed to capture early access feature enrollment",t)}))}catch(t){this.I.error("Failed to capture early access feature enrollment",t)}}getEarlyAccessFeatures(t,e,i){void 0===e&&(e=!1);var r=this.sd(I);!r||e?this._d(t,i):t(r)}_d(t,i){var r=this;return e((function*(){var e=r.Os;if(e){var s,n=i?"&"+i.map((t=>"stage="+t)).join("&"):"";try{var o=yield e.sendRequest("/api/early_access_features/?token="+e.projectToken+n,{target:"api",method:"GET",sentAt:"query"});if(!o.json)return;r.ei({[I]:s=o.json.earlyAccessFeatures})}catch(t){return void r.I.error("Early access feature request failed",t)}try{t(s)}catch(t){r.I.error("Early access feature callback failed",t)}}}))()}bd(){var t=this.getFlags(),e=this.getFlagVariants();return{flags:t.filter((t=>e[t])),flagVariants:Object.keys(e).filter((t=>e[t])).reduce(((t,i)=>(t[i]=e[i],t)),{})}}md(t){this.Xh();var e=this.bd(),i=e.flags,r=e.flagVariants;this.featureFlagEventHandlers.forEach((e=>{try{e(i,r,{errorsLoading:t})}catch(t){this.I.error("Error while running feature flags callback",t)}}))}setPersonPropertiesForFlags(t,e){void 0===e&&(e=!0),this.wd(t,e)}wd(t,e){void 0===e&&(e=!0);var r=this.sd(U)||{},s=(null==t?void 0:t.$set)||(null!=t&&t.$set_once?{}:t),n=null==t?void 0:t.$set_once,o={};if(n)for(var a in n)({}).hasOwnProperty.call(n,a)&&(a in r||(o[a]=n[a]));this.ei({[U]:i({},r,o,s)}),e&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,e){void 0===e&&(e=!0);var r=i({},this.sd(U)||{});t.forEach((t=>{delete r[t]})),this.ei({[U]:r}),e&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t){void 0===t&&(t=!0),this.ri(U),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,e){void 0===e&&(e=!0);var r=this.sd(j)||{},s=i({},r);for(var n of Object.keys(t))s[n]=i({},r[n],t[n]);this.ei({[j]:s}),e&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var e=this.sd(j)||{};this.ei({[j]:i({},e,{[t]:{}})})}else this.ri(j)}reset(){this.$h++,this.qh=!1,this.Ah={},this.Fh={},this.Lh=!1,this.Nh=!1,this.jh=!1,this.$anon_distinct_id=void 0,this.nd(),this.Ph=!1,this.Hh=0}}},Ch={sessionRecording:class{get vn(){return this._instance.config}get yo(){return this._instance.persistence}get started(){var t;return!(null==(t=this.kd)||!t.isStarted)}get status(){var t,e;return this.Sd===Nl||this.Sd===Ll?this.Sd:null!==(t=null==(e=this.kd)?void 0:e.status)&&void 0!==t?t:this.Sd}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.Sd=Ml,this.xd=void 0,this.Cd=!1,this.Dt=(()=>{var t;if(null==kt||!kt.visibilityState||"visible"===kt.visibilityState)return!0;var e=null==xt||null==(t=xt.performance)||null==t.getEntriesByType?void 0:t.getEntriesByType("visibility-state");return!(null!=e&&e.length)||e.some((t=>"visible"===t.name))})(),this.$t=()=>{var t;"visible"===(null==kt?void 0:kt.visibilityState)&&(this.Dt=!0,null==(t=this.kd)||null==t.setDocumentWasEverVisible||t.setDocumentWasEverVisible(!0))},this._instance=t,!this._instance.sessionManager)throw jl.error("started without valid sessionManager"),new Error(Ul+" started without valid sessionManager. This is a bug.");if(this.vn.cookieless_mode===vt)throw new Error(Ul+' cannot be used with cookieless_mode="always"');null!=kt&&kt.addEventListener&&ns(kt,"visibilitychange",this.$t)}initialize(){this.startIfEnabledOrStop()}dispose(){this.Cd=!0,null==kt||null==kt.removeEventListener||kt.removeEventListener("visibilitychange",this.$t),this.stopRecording()}get Td(){var t,e=!(null==(t=this._instance.get_property(w))||!t.enabled),i=!this.vn.disable_session_recording,r=this.vn.disable_session_recording||this._instance.consent.isOptedOut();return xt&&e&&i&&!r}startIfEnabledOrStop(t){var e;if(!(this.Cd||this.Td&&null!=(e=this.kd)&&e.isStarted)){var i=!ue(Object.assign)&&!ue(Array.from);this.Td&&i?(this.Md(t),jl.info("starting")):(this.Sd=Ml,this.stopRecording())}}Md(t){var e,i,r;this.Td&&(this.Sd!==Nl&&this.Sd!==Ll&&(this.Sd=Dl),null!=Ft&&null!=(e=Ft.__PosthogExtensions__)&&null!=(e=e.rrweb)&&e.record&&null!=(i=Ft.__PosthogExtensions__)&&i.initSessionRecording?this.Ed(t):null==(r=Ft.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.Id,(e=>{if(e)return this._instance.register_for_session({[ht]:!0}),jl.error("could not load recorder",e);this.Ed(t)})))}stopRecording(){var t,e;null==(t=this.xd)||t.call(this),this.xd=void 0,null==(e=this.kd)||e.stop()}Rd(){var t,e;null==(t=this.xd)||t.call(this),this.xd=void 0,null==(e=this.kd)||e.discard()}Pd(){var t,e;null==(t=this.yo)||t.unregister(R),null==(e=this.yo)||e.unregister(x)}Ad(t,e){if(fe(t))return null;var i,r=pe(t)?t:parseFloat(t);return"number"!=typeof(i=r)||!Number.isFinite(i)||0>i||i>1?(jl.warn(e+" must be between 0 and 1. Ignoring invalid value:",t),null):r}Fd(t){if(this.yo){var e,r,s=this.yo,n=()=>{var e,r=!1===t.sessionRecording?void 0:t.sessionRecording,n=this.Ad(null==(e=this.vn.session_recording)?void 0:e.sampleRate,"session_recording.sampleRate"),o=this.Ad(null==r?void 0:r.sampleRate,"remote config sampleRate"),a=null!=n?n:o;fe(a)&&this.Pd();var l=null==r?void 0:r.minimumDurationMilliseconds;s.register({[w]:i({cache_timestamp:Date.now(),enabled:!!r},r,{networkPayloadCapture:i({capturePerformance:t.capturePerformance},null==r?void 0:r.networkPayloadCapture),canvasRecording:{enabled:null==r?void 0:r.recordCanvas,fps:null==r?void 0:r.canvasFps,quality:null==r?void 0:r.canvasQuality},sampleRate:a,minimumDurationMilliseconds:ue(l)?null:l,endpoint:null==r?void 0:r.endpoint,triggerMatchType:null==r?void 0:r.triggerMatchType,masking:null==r?void 0:r.masking,urlTriggers:null==r?void 0:r.urlTriggers,version:null==r?void 0:r.version,triggerGroups:null==r?void 0:r.triggerGroups})})};n(),null==(e=this.xd)||e.call(this),this.xd=null==(r=this._instance.sessionManager)?void 0:r.onSessionId(n)}}onRemoteConfig(t){var e=t.ok?t.config:void 0;return e&&"sessionRecording"in e?!1===e.sessionRecording?(this.Fd(e),void this.Rd()):(this.Fd(e),void this.startIfEnabledOrStop()):(this.Sd===Nl&&(this.Sd=Ll,jl.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e){var i;void 0===e&&(e="log"),null!=(i=this.kd)&&i.log?this.kd.log(t,e):jl.warn("log called before recorder was ready")}get Id(){var t,e,i=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.get_property(w);return(null==i||null==(e=i.scriptConfig)?void 0:e.script)||"lazy-recorder"}Od(){var t,e=this._instance.get_property(w);if(!e)return!1;try{t="object"==typeof e?e:JSON.parse(e)}catch(t){return jl.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}return!fe(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}Ed(t){var e,i,r;if(!this.Cd){if(null==(e=Ft.__PosthogExtensions__)||!e.initSessionRecording)return jl.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[ht]:!0});var s;if(this.kd||(this.kd=null==(s=Ft.__PosthogExtensions__)?void 0:s.initSessionRecording(this._instance,this.Dt),this.kd._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Od()){if(this.Sd===Ll||this.Sd===Nl)return;return this.Sd=Nl,jl.info("persisted remote config is stale, requesting fresh config before starting"),void new ko(this._instance).load()}this.Sd=Dl,null==(i=(r=this.kd).setDocumentWasEverVisible)||i.call(r,this.Dt),this.kd.start(t)}}onRRwebEmit(t){var e;null==(e=this.kd)||null==e.onRRwebEmit||e.onRRwebEmit(t)}overrideLinkedFlag(){var t,e;this.kd||null==(e=this.yo)||e.register({[S]:!0}),null==(t=this.kd)||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.kd||null==(e=this.yo)||e.register({[E]:!0}),null==(t=this.kd)||t.overrideSampling()}overrideTrigger(t){var e,i;this.kd||null==(i=this.yo)||i.register({["url"===t?k:T]:!0}),null==(e=this.kd)||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.kd)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var i;return!(null==(i=this.kd)||!i.tryAddCustomEvent(t,e))}}},Oh={autocapture:class extends El{constructor(t){super(new Sl(t)),this.instance=t}},historyAutocapture:class{constructor(t){this._instance=t,this.Ld=this.Dd()}initialize(){this.startIfEnabled()}get isEnabled(){var t=this.$d();return!!(t.path||t.search||this.Nd(t))}startIfEnabled(){this.isEnabled&&(Kr.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.Ld=this.Dd(),this.startIfEnabled()}stop(){this.qd&&this.qd(),this.qd=void 0,this.jd&&this.jd(),this.jd=void 0,Kr.info("History API monitoring stopped")}monitorHistoryChanges(){xt&&xt.history&&(this.Bd("pushState"),this.Bd("replaceState"),this.Hd(),this.Nd()&&this.zd())}Bd(t){var e;if(xt&&(null==(e=xt.history[t])||!e.__posthog_wrapped__)){var i=this;Pl(xt.history,t,(e=>function(r,s,n){e.call(this,r,s,n),i.Ud(t)}))}}Dd(){var t=null==xt?void 0:xt.location;if(null!=t&&t.pathname)return{pathname:t.pathname,search:t.search,hash:t.hash}}$d(){var t=this._instance.config.capture_pageview;return"history_change"===t?{path:!0}:le(t)?t:{}}Nd(t){return void 0===t&&(t=this.$d()),!!t.hash&&!this._instance.config.disable_capture_url_hashes}Wd(t){var e=this.$d(),i=this.Ld;return!(!i||!(e.path&&t.pathname!==i.pathname||e.search&&t.search!==i.search||this.Nd(e)&&t.hash!==i.hash))}Ud(t){try{var e=this.Dd();if(!e)return;this.Wd(e)&&this._instance.capture(mt,{navigation_type:t}),this.Ld=e}catch(e){Kr.error("Error capturing "+t+" pageview",e)}}Hd(){if(!this.qd){var t=()=>{this.Ud("popstate")};ns(xt,"popstate",t),this.qd=()=>{xt&&xt.removeEventListener("popstate",t)}}}zd(){if(!this.jd){var t=()=>{this.Ud("hashchange")};ns(xt,"hashchange",t),this.jd=()=>{xt&&xt.removeEventListener("hashchange",t)}}}},heatmaps:class{get vn(){return this.instance.config}constructor(t){var e;this.Vd=!1,this.Ts=!1,this.Gd=null,this.instance=t,this.Vd=!(null==(e=this.instance.persistence)||!e.props[v]),this.rageclicks=new gl(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return le(this.vn.capture_heatmaps)&&this.vn.capture_heatmaps.flush_interval_milliseconds&&(t=this.vn.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return fe(this.vn.capture_heatmaps)?fe(this.vn.enable_heatmaps)?this.Vd:this.vn.enable_heatmaps:!1!==this.vn.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.Ts)return;Bl.info("starting..."),this.Zd(),this.$t()}else{var t;clearInterval(null!==(t=this.Gd)&&void 0!==t?t:void 0),this.Qd(),this.getAndClearBuffer()}}onRemoteConfig(t){if(t.ok){var e=t.config;if("heatmaps"in e){var i=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[v]:i}),this.Vd=i,this.startIfEnabled()}}}getAndClearBuffer(){var t=this.At;return this.At=void 0,t}Jd(t){zl(t.originalEvent)&&this.Qi(t.originalEvent,"deadclick")}$t(){this.Gd&&clearInterval(this.Gd),this.Gd="visible"===(null==kt?void 0:kt.visibilityState)?setInterval(this.oo.bind(this),this.flushIntervalMilliseconds):null}Zd(){xt&&kt&&(this.Kd=this.oo.bind(this),ns(xt,gt,this.Kd),this.Yd=t=>this.Qi(t||(null==xt?void 0:xt.event)),ns(kt,"click",this.Yd,{capture:!0}),this.Xd=t=>this.tv(t||(null==xt?void 0:xt.event)),ns(kt,"mousemove",this.Xd,{capture:!0}),this.ev=new Pn(this.instance,Tn,this.Jd.bind(this)),this.ev.startIfEnabledOrStop(),this.iv=this.$t.bind(this),ns(kt,_t,this.iv),this.Ts=!0)}Qd(){var t;xt&&kt&&(this.Kd&&xt.removeEventListener(gt,this.Kd),this.Yd&&kt.removeEventListener("click",this.Yd,{capture:!0}),this.Xd&&kt.removeEventListener("mousemove",this.Xd,{capture:!0}),this.iv&&kt.removeEventListener(_t,this.iv),clearTimeout(this.rv),null==(t=this.ev)||t.stop(),this.Ts=!1)}nv(t,e){var i=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),n=function(t,e,i){for(var r=t;r&&Bs(r)&&!zs(r,"body");){if(r===i)return!1;var s=void 0;try{var n,o,a;s=null==(n=null!==(o=null==(a=r.ownerDocument)?void 0:a.defaultView)&&void 0!==o?o:xt)?void 0:n.getComputedStyle(r).position}catch(t){return!1}if(Zt(e,s))return!0;r=tn(r)}return!1}(Qs(t),["fixed","sticky"],s);return{x:t.clientX+(n?0:r),y:t.clientY+(n?0:i),target_fixed:n,type:e}}Qi(t,e){var r;if(void 0===e&&(e="click"),!js(t.target)&&zl(t)){var s=this.nv(t,e);null!=(r=this.rageclicks)&&r.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&ln(Qs(t),this.instance.config.rageclick)&&this.fs(i({},s,{type:"rageclick"})),this.fs(s)}}tv(t){!js(t.target)&&zl(t)&&(clearTimeout(this.rv),this.rv=setTimeout((()=>{this.fs(this.nv(t,"mousemove"))}),500))}fs(t){if(xt){var e=this.vn.disable_capture_url_hashes?Li(xt.location.href):xt.location.href,i=this.vn.custom_personal_data_properties,r=this.vn.mask_personal_data_properties?[...Wn,...i||[]]:[],s=Bn(e,r,Kn);this.At=this.At||{},this.At[s]||(this.At[s]=[]),this.At[s].push(t)}}oo(){this.At&&!he(this.At)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Pn,webVitalsAutocapture:class{constructor(t){var e;this.Vd=!1,this.Ts=!1,this.At={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.sv=()=>{clearTimeout(this.av),this.av=void 0,0!==this.At.metrics.length&&(this._instance.capture("$web_vitals",i({$current_url:this.At.url},this.At.metrics.reduce(((t,e)=>i({},t,{["$web_vitals_"+e.name+"_event"]:i({},e),["$web_vitals_"+e.name+"_value"]:e.value})),{}))),this.At={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.ov=t=>{var e;if(this.At=this.At||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},fe(null==t?void 0:t.name)||fe(null==t?void 0:t.value))Cl.error("Invalid metric received",t);else{var r="string"==typeof t.navigationURL?t.navigationURL:void 0,s=this.lv(r);if(!ue(s)){var n=pe(t.navigationId)||"string"==typeof t.navigationId?"navigation:"+t.navigationId:"url:"+s;if(!this.uv||this.uv>t.value){this.At.navigationKey!==n&&(this.sv(),this.av=setTimeout(this.sv,this.flushToCaptureTimeoutMs)),ue(this.At.navigationKey)&&(this.At.navigationKey=n,this.At.url=s),this.At.firstMetricTimestamp=ue(this.At.firstMetricTimestamp)?Date.now():this.At.firstMetricTimestamp;var o=null==(e=this._instance.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0),a=i({},t,r?{navigationURL:s}:{},{$current_url:s,timestamp:Date.now()});if(delete a.entries,le(t.attribution)&&this.attributionMetrics.indexOf(t.name)>-1){var l={};for(var h of Fl){var u="url"===h&&"string"==typeof t.attribution[h]?this.lv(t.attribution[h]):t.attribution[h];ue(u)||(l[h]=u)}a.attribution=l}else delete a.attribution;ue(o)||(a.$session_id=o.sessionId,a.$window_id=o.windowId),this.At.metrics.push(a),this.At.metrics.length===this.allowedMetrics.length&&this.sv()}else Cl.error("Ignoring metric with value >= "+this.uv,t)}}},this.hv=()=>{if(!this.Ts){var t,e,r,s,n=!1,o=Ft.__PosthogExtensions__,a=null==o?void 0:o.postHogWebVitalsCallbacksByFlavor,l=(null==a?void 0:a[this.dv])||("web-vitals"===this.dv&&ue(a)?null==o?void 0:o.postHogWebVitalsCallbacks:void 0);if(!ue(l)){var h=l.withoutAttribution,u=this.attributionMetrics;n=!ue(h),t=u.indexOf("LCP")>-1?l.onLCP:(null==h?void 0:h.onLCP)||l.onLCP,e=u.indexOf("CLS")>-1?l.onCLS:(null==h?void 0:h.onCLS)||l.onCLS,r=u.indexOf("FCP")>-1?l.onFCP:(null==h?void 0:h.onFCP)||l.onFCP,s=u.indexOf("INP")>-1?l.onINP:(null==h?void 0:h.onINP)||l.onINP}if(t&&e&&r&&s){var d={reportSoftNavs:this.useSoftNavs},v=n&&this.attributionMetrics.indexOf("INP")>-1?i({},d,{includeProcessedEventEntries:!1}):d;this.allowedMetrics.indexOf("LCP")>-1&&t(this.ov.bind(this),d),this.allowedMetrics.indexOf("CLS")>-1&&e(this.ov.bind(this),d),this.allowedMetrics.indexOf("FCP")>-1&&r(this.ov.bind(this),d),this.allowedMetrics.indexOf("INP")>-1&&s(this.ov.bind(this),v),this.Ts=!0}else Cl.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.Vd=!(null==(e=this._instance.persistence)||!e.props[_]),this.startIfEnabled()}get vv(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e,i=le(this.vv)?null==(t=this.vv)?void 0:t.web_vitals_allowed_metrics:void 0;return fe(i)?(null==(e=this._instance.persistence)?void 0:e.props[b])||Il:i}get flushToCaptureTimeoutMs(){return(le(this.vv)?this.vv.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){var t=le(this.vv)?this.vv.web_vitals_attribution:void 0;return ge(t)?t?Il:[]:oe(t)?t:Al}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){var t=le(this.vv)?this.vv.__preview_web_vitals_soft_navs:void 0;return null!=t&&t}get uv(){var t=le(this.vv)&&pe(this.vv.__web_vitals_max_value)?this.vv.__web_vitals_max_value:Ol;return t>0&&6e4>=t?Ol:t}get isEnabled(){var t=null==Tt?void 0:Tt.protocol;if("http:"!==t&&"https:"!==t)return Cl.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=le(this.vv)?this.vv.web_vitals:ge(this.vv)?this.vv:void 0;return ge(e)?e:this.Vd}startIfEnabled(){this.isEnabled&&!this.Ts&&(Cl.info("enabled, starting..."),this.Zs(this.hv))}onRemoteConfig(t){if(t.ok){var e=t.config;if("capturePerformance"in e){var i=le(e.capturePerformance)&&!!e.capturePerformance.web_vitals,r=le(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[_]:i}),this._instance.persistence.register({[b]:r})),this.Vd=i,this.startIfEnabled()}}}get dv(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}Zs(t){var e=Ft.__PosthogExtensions__,i=this.dv,r=null==e?void 0:e.postHogWebVitalsCallbacksByFlavor;null!=r&&r[i]||"web-vitals"===i&&ue(r)&&null!=e&&e.postHogWebVitalsCallbacks?t():null==e||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,i,(e=>{e?Cl.error("failed to load script",e):t()}))}lv(t){var e=t||(null==xt?void 0:xt.location.href);if(e){var i=this._instance.config.disable_capture_url_hashes?Li(e):e,r=this._instance.config.custom_personal_data_properties,s=this._instance.config.mask_personal_data_properties?[...Wn,...r||[]]:[];return Bn(i,s,Kn)}Cl.error("Could not determine current URL")}}},Ih={exceptionObserver:class{constructor(t){var e;this.hv=()=>{var t;if(xt&&this.isEnabled&&null!=(t=Ft.__PosthogExtensions__)&&t.errorWrappingFunctions){var e=Ft.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=Ft.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=Ft.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.fv&&this.vn.capture_unhandled_errors&&(this.fv=e(this.captureException.bind(this))),!this.pv&&this.vn.capture_unhandled_rejections&&(this.pv=i(this.captureException.bind(this))),!this.gv&&this.vn.capture_console_errors&&(this.gv=r(this.captureException.bind(this)))}catch(t){kl.error("failed to start",t),this.mv()}}},this._instance=t,this.yv=!(null==(e=this._instance.persistence)||!e.props[c]),this.de=new Ce(i({},function(t){var e,i,r,s;return void 0===t&&(t={}),{refillRate:null!==(e=null!==(i=t.exceptionRateLimiterRefillRate)&&void 0!==i?i:t.__exceptionRateLimiterRefillRate)&&void 0!==e?e:1,bucketSize:null!==(r=null!==(s=t.exceptionRateLimiterBucketSize)&&void 0!==s?s:t.__exceptionRateLimiterBucketSize)&&void 0!==r?r:10}}(this._instance.config.error_tracking),{refillInterval:1e4,I:kl})),this.vn=this.bv(),this.startIfEnabledOrStop()}bv(){var t=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return le(t)?e=i({},e,t):(ue(t)?this.yv:t)&&(e=i({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.vn.capture_console_errors||this.vn.capture_unhandled_errors||this.vn.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(kl.info("enabled"),this.mv(),this.Zs(this.hv)):this.mv()}Zs(t){var e,i;null!=(e=Ft.__PosthogExtensions__)&&e.errorWrappingFunctions?t():null==(i=Ft.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",(e=>{if(e)return kl.error("failed to load script",e);t()}))}mv(){var t,e,i;null==(t=this.fv)||t.call(this),this.fv=void 0,null==(e=this.pv)||e.call(this),this.pv=void 0,null==(i=this.gv)||i.call(this),this.gv=void 0}onRemoteConfig(t){if(t.ok){var e=t.config;"autocaptureExceptions"in e&&(this.yv=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[c]:this.yv}),this.vn=this.bv(),this.startIfEnabledOrStop())}}onConfigChange(){this.vn=this.bv()}captureException(t){var e,i,r,s=null!==(e=null==t||null==(i=t.$exception_list)||null==(i=i[0])?void 0:i.type)&&void 0!==e?e:"Exception";this.de.consumeRateLimit(s)?kl.info("Skipping exception capture because of client rate limiting.",{exception:s}):null==(r=this._instance.exceptions)||r.sendExceptionEvent(t)}},exceptions:class{constructor(t){var e,r;this._v=[],this.wv=new gr([new Rr,new Ur,new Or,new Cr,new Nr,new Dr,new Ar,new Lr],function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),s=1;e>s;s++)r[s-1]=arguments[s];return function(e,s){void 0===s&&(s=0);for(var n=[],o=e.split("\n"),a=s;o.length>a;a++){var l=o[a];if(1024>=l.length){var h=Pr.test(l)?l.replace(Pr,"$1"):l;if(!h.match(/\S*Error: /)){for(var u of r){var d=u(h,t);if(d){n.push(d);break}}if(n.length>=50)break}}}return function(t){if(!t.length)return[];var e=Array.from(t);return e.reverse(),e.slice(0,50).map((t=>{return i({},t,{filename:t.filename||(r=e,r[r.length-1]||{}).filename,function:t.function||mr});var r}))}(n)}}("web:javascript",Sr,$r)),this._instance=t,this._v=null!==(e=null==(r=this._instance.persistence)?void 0:r.get_property(f))&&void 0!==e?e:[],this.Sv=Hr(this.xv()),this.Cv=new Vr(this.Sv)}onConfigChange(){this.Sv=Hr(this.xv()),this.Cv.setConfig(this.Sv)}onRemoteConfig(t){var e,i,r;if(t.ok){var s=t.config;if("errorTracking"in s){var n=null!==(e=null==(i=s.errorTracking)?void 0:i.suppressionRules)&&void 0!==e?e:[],o=null==(r=s.errorTracking)?void 0:r.captureExtensionExceptions;this._v=n,this._instance.persistence&&this._instance.persistence.register({[f]:this._v,[p]:o})}}}get Tv(){var t,e=!!this._instance.get_property(p),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=i?i:e)&&void 0!==t&&t}buildProperties(t,e){return this.wv.buildFromUnknown(t,{syntheticException:null==e?void 0:e.syntheticException,mechanism:{handled:null==e?void 0:e.handled}})}addExceptionStep(t,e){if(this.Sv.enabled)try{if(!de(t)||0===t.trim().length)return void ph.warn("Ignoring exception step because message must be a non-empty string");var r=function(t){if(!t)return{sanitizedProperties:{},droppedKeys:[]};var e=[];return{sanitizedProperties:Object.keys(t).reduce(((i,r)=>zr.has(r)?(e.push(r),i):(i[r]=t[r],i)),{}),droppedKeys:e}}(this.Mv(e)),s=r.sanitizedProperties,n=r.droppedKeys;n.length>0&&ph.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.Cv.add(i({[jr]:t,[Br]:(new Date).toISOString()},s))}catch(t){ph.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{var e=t.$exception_list;if(this.Ev(e)){if(this.Iv(e))return this.Rv("Exception dropped: matched a suppression rule"),void ph.info("Skipping exception capture because a suppression rule matched");if(!this.Tv&&this.Pv(e))return this.Rv("Exception dropped: thrown by a browser extension"),void ph.info("Skipping exception capture because it was thrown by an extension");if(!this.Tv&&this.Av(e))return this.Rv("Exception dropped: thrown by an injected browser script"),void ph.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Fv(e))return this.Rv("Exception dropped: thrown by the PostHog SDK"),void ph.info("Skipping exception capture because it was thrown by the PostHog SDK")}var i=this.Sv.enabled&&fe(t.$exception_steps)?this.Ov(t):t,r="string"==typeof(n=globalThis._posthogReleaseId)&&n.length>0?n:void 0;r&&(i.$release_id=r);try{var s=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",jl:!0});return s&&this.Cv.clear(),s}catch(t){return ph.error("Failed to capture exception event. Dropping this exception.",t),void this.Cv.clear()}}catch(t){return void ph.error("Failed to process exception event. Ignoring this exception.",t)}var n}Ov(t){try{var e=this.Cv.getAttachable();return 0===e.length?t:i({},t,{$exception_steps:e})}catch(e){return ph.error("Failed to read buffered exception steps. Capturing exception without steps.",e),t}}Rv(t){this.Sv.enabled&&this.Cv.add({[jr]:t,[Br]:(new Date).toISOString()})}Mv(t){return le(t)?i({},t):{}}xv(){var t,e;return null!==(t=null==(e=this._instance.config.error_tracking)?void 0:e.exception_steps)&&void 0!==t?t:{}}Iv(t){if(0===t.length)return!1;try{var e=t.reduce(((t,e)=>{var i=e.type,r=e.value;return de(i)&&i.length>0&&t.$exception_types.push(i),de(r)&&r.length>0&&t.$exception_values.push(r),t}),{$exception_types:[],$exception_values:[]});return this._v.some((t=>{var i=t.values.map((t=>{var i=Ma[t.operator],r=e[t.key];if(!i||!r)return!1;var s=oe(t.value)?t.value:[t.value];return s.length>0&&i(s,r)}));return"OR"===t.type?i.some(Boolean):i.every(Boolean)}))}catch(t){return ph.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}Pv(t){return t.flatMap((t=>{var e,i;return null!==(e=null==(i=t.stacktrace)?void 0:i.frames)&&void 0!==e?e:[]})).some((t=>{var e=t.filename;return!!e&&_h.some((t=>e.startsWith(t)))}))}Av(t){return t.some((t=>{var e=t.value;return de(e)&&gh.some((t=>e.includes(t)))}))}Fv(t){if(t.length>0){var e,i,r,s,n=null!==(e=null==(i=t[0].stacktrace)?void 0:i.frames)&&void 0!==e?e:[],o=n[n.length-1];return null!==(r=null==o||null==(s=o.filename)?void 0:s.includes("posthog.com/static"))&&void 0!==r&&r}return!1}Ev(t){return!fe(t)&&oe(t)}}},Ah=i({productTours:class{get yo(){return this._instance.persistence}constructor(t){this.Lv=null,this.Dv=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(t.ok){var e=t.config;if("productTours"in e){var i,r;if(this.yo&&this.yo.register({[m]:!!e.productTours}),!Hl(this._instance))return!this.Lv&&fe(null==(i=this.yo)?void 0:i.props[G])||ql.info("product tours disabled; stopping and clearing cached tours"),null==(r=this.Lv)||r.stop(),this.Lv=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.Lv&&Hl(this._instance)&&this.Zs((()=>this.$v()))}Zs(t){var e,i;null!=(e=Ft.__PosthogExtensions__)&&e.generateProductTours?t():null==(i=Ft.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"product-tours",(e=>{e?ql.error("Could not load product tours script",e):t()}))}$v(){var t;!this.Lv&&null!=(t=Ft.__PosthogExtensions__)&&t.generateProductTours&&(this.Lv=Ft.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e){if(void 0===e&&(e=!1),!oe(this.Dv)||e){var i=this.yo;if(i){var r=i.props[G];if(oe(r)&&!e)return this.Dv=r,void t(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",timestampMode:"query",callback:e=>{if(Hl(this._instance)){var r=e.statusCode;if(200!==r||!e.json){var s="Product Tours API could not be loaded, status: "+r;return 0===r?e.error||ql.warn(s):ql.error(s),void t([],{isLoaded:!1,error:s})}var n=oe(e.json.product_tours)?e.json.product_tours:[];this.Dv=n,i&&i.register({[G]:n}),t(n,{isLoaded:!0})}else t([],{isLoaded:!0})}})}else t(this.Dv,{isLoaded:!0})}getActiveProductTours(t){fe(this.Lv)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.Lv.getActiveProductTours(t)}showProductTour(t){var e;null==(e=this.Lv)||e.showTourById(t)}previewTour(t){this.Lv?this.Lv.previewTour(t):this.Zs((()=>{var e;this.$v(),null==(e=this.Lv)||e.previewTour(t)}))}dismissProductTour(){var t;null==(t=this.Lv)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.Lv)||t.nextStep()}previousStep(){var t;null==(t=this.Lv)||t.previousStep()}clearCache(){var t;this.Dv=null,null==(t=this.yo)||t.unregister(G)}resetTour(t){var e;null==(e=this.Lv)||e.resetTour(t)}resetAllTours(){var t;null==(t=this.Lv)||t.resetAllTours()}cancelPendingTour(t){var e;null==(e=this.Lv)||e.cancelPendingTour(t)}}},Rh),Fh={siteApps:class{constructor(t){this.Nv=0,this._instance=t,this.qv=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}jv(t,e){if(e){var i=this.globalsForEvent(e);this.qv.push(i),this.qv.length>1e3&&(this.qv=this.qv.slice(10))}}get siteAppLoaders(){var t;return null==(t=Ft._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.jv.bind(this));this.Bv=()=>{t(),this.qv=[],this.Bv=void 0}}}globalsForEvent(t){var e,s,n,o,a,l,h;if(!t)throw new Error("Event payload is required");var u={},d=this._instance.get_property("$groups")||[],v=this._instance.get_property("$stored_group_properties")||{};for(var c of Object.entries(v)){var f=c[0];u[f]={id:d[f],type:f,properties:c[1]}}var p=t.$set_once,_=t.$set;return{event:i({},r(t,Vl),{properties:i({},t.properties,_?{$set:i({},null!==(e=null==(s=t.properties)?void 0:s.$set)&&void 0!==e?e:{},_)}:{},p?{$set_once:i({},null!==(n=null==(o=t.properties)?void 0:o.$set_once)&&void 0!==n?n:{},p)}:{}),elements_chain:null!==(a=null==(l=t.properties)?void 0:l.$elements_chain)&&void 0!==a?a:"",distinct_id:null==(h=t.properties)?void 0:h.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:u}}Hv(t){var e,i=null==(e=t.tagName)?void 0:e.toLowerCase();return"style"===i&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(t)||(Wl.error("prepare_external_dependency_stylesheet returned null"),null):"script"===i&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(t)||(Wl.error("prepare_external_dependency_script returned null"),null):t}zv(){var t,e,i,r,s,n,o,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var l=null==kt?void 0:kt.defaultView,h=null==l||null==(t=l.Node)?void 0:t.prototype;if(!l||!h)return()=>{};if(this.Nv++,this.Uv)return this.Wv();var u=[],d=this,v=new WeakSet,c=(t,e,i)=>{if(null!=t&&t[e]){var r=t[e];t[e]=i(r),u.push((()=>{t[e]=r}))}},f=t=>{if(v.has(t))return t;var e=d.Hv(t);return e&&v.add(e),e},p=t=>t.map((t=>"string"==typeof t?t:f(t))).filter((t=>!ce(t)));return c(h,"appendChild",(t=>function(e){var i=f(e);return i?t.call(this,i):e})),c(h,"insertBefore",(t=>function(e,i){var r=f(e);return r?t.call(this,r,i):e})),c(h,"replaceChild",(t=>function(e,i){var r=f(e);return r?t.call(this,r,i):i})),[null==(e=l.Element)?void 0:e.prototype,null==(i=l.Document)?void 0:i.prototype,null==(r=l.DocumentFragment)?void 0:r.prototype].forEach((t=>{c(t,"append",(t=>function(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,p(i))})),c(t,"prepend",(t=>function(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,p(i))}))})),[null==(s=l.Element)?void 0:s.prototype,null==(n=l.CharacterData)?void 0:n.prototype,null==(o=l.DocumentType)?void 0:o.prototype].forEach((t=>{c(t,"before",(t=>function(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,p(i))})),c(t,"after",(t=>function(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,p(i))})),c(t,"replaceWith",(t=>function(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];var s=p(i);return i.length&&!s.length?void 0:t.apply(this,s)}))})),c(null==(a=l.Element)?void 0:a.prototype,"insertAdjacentElement",(t=>function(e,i){var r=f(i);return r?t.call(this,e,r):null})),this.Uv=()=>{u.forEach((t=>t())),this.Uv=void 0},this.Wv()}Wv(){var t=!1;return()=>{var e;t||(t=!0,this.Nv--,0===this.Nv&&(null==(e=this.Uv)||e.call(this)))}}Vv(t,e){void 0===e&&(e=!0);var i=this.zv();try{var r=t(i);return e&&i(),r}catch(t){throw i(),t}}setupSiteApp(t){var e=this.apps[t.id],i=()=>{var i;!e.errored&&this.qv.length&&(Wl.info("Processing "+this.qv.length+" events for site app with id "+t.id),this.qv.forEach((t=>this.Vv((()=>null==e.processEvent?void 0:e.processEvent(t))))),e.processedBuffer=!0),Object.values(this.apps).every((t=>t.processedBuffer||t.errored))&&(null==(i=this.Bv)||i.call(this))},r=!1,s=s=>{e.errored=!s,e.loaded=!0,Wl.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&i()};try{var n=this.Vv((e=>t.init({posthog:this._instance,callback(t){e(),s(t)}})),!1).processEvent;n&&(e.processEvent=n),r=!0}catch(e){Wl.error(Gl+t.id,e),s(!1)}if(r&&e.loaded)try{i()}catch(i){Wl.error("Error while processing buffered events PostHog app with config id "+t.id,i),e.errored=!0}}Gv(){var t=this.siteAppLoaders||[];for(var e of t)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(var i of t)this.setupSiteApp(i)}Zv(t){var e=this;if(0!==Object.keys(this.apps).length){var i=this.globalsForEvent(t),r=function(r){try{e.Vv((()=>null==r.processEvent?void 0:r.processEvent(i)))}catch(e){Wl.error("Error while processing event "+t.event+" for site app "+r.id,e)}};for(var s of Object.values(this.apps))r(s)}}onRemoteConfig(t){var e,i,r,s=this;if(null!=(e=this.siteAppLoaders)&&e.length)return this.isEnabled?(this.Gv(),void this._instance.on("eventCaptured",(t=>this.Zv(t)))):void Wl.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this.Bv)||i.call(this),t.ok){var n=t.config;if(null!=(r=n.siteApps)&&r.length)if(this.isEnabled){var o=function(){var t,e=a.id,i=a.url;Ft["__$$ph_site_app_"+e]=s._instance,null==(t=Ft.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(s._instance,i,(t=>{if(t)return Wl.error(Gl+e,t)}))};for(var a of n.siteApps)o()}else Wl.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},Mh={tracingHeaders:class{constructor(t){this.Qv=void 0,this.Jv=void 0,this.Kv=void 0,this.hv=()=>{var t,e,i=this.Yv();i?(ue(this.Qv)&&(this.Qv=null==(t=Ft.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchXHR(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),ue(this.Jv)&&(this.Jv=null==(e=Ft.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)?void 0:e._patchFetch(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.mv()},this._instance=t}initialize(){this.startIfEnabledOrStop()}Zs(t){var e,i;null!=(e=Ft.__PosthogExtensions__)&&e.tracingHeadersPatchFns?t():null==(i=Ft.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",(e=>{if(e)return Rl.error("failed to load script",e);t()}))}Xv(){var t,e;return null!==(t=null!==(e=this._instance.config.tracing_headers)&&void 0!==e?e:this._instance.config.addTracingHeaders)&&void 0!==t?t:this._instance.config.__add_tracing_headers}Yv(){var t=this.Xv();return oe(t)?(oe(this.Kv)?this.Kv.splice(0,this.Kv.length,...t):this.Kv=[...t],t.length>0?this.Kv:void 0):(oe(this.Kv)&&this.Kv.splice(0),this.Kv=t||void 0,this.Kv)}mv(){var t,e;null==(t=this.Qv)||t.call(this),null==(e=this.Jv)||e.call(this),this.Qv=void 0,this.Jv=void 0}startIfEnabledOrStop(){this.Yv()?this.Zs(this.hv):this.mv()}}},Dh=i({surveys:class extends Ql{constructor(t){var e;super(new rh(t),{get projectToken(){return e.config.token},kv:new ih(e=t)}),this._instance=t}du(t,e){var i=e.query?la(t,e.query):t;return new Promise((t=>{var r;this._instance._send_request({method:e.method,url:this._instance.requestRouter.endpointFor(null!==(r=e.target)&&void 0!==r?r:"api",i),data:e.body,headers:e.headers,timeout:e.timeoutMs,fireCallbackOnDrop:!0,transport:e.transport,compression:e.compression,timestampMode:e.sentAt,callback:t})}))}}},Rh),Nh={toolbar:class{constructor(t){this.instance=t}tc(t){Ft.ph_toolbar_state=t}ec(){var t;return null!==(t=Ft.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t,e,i){if(void 0===t&&(t=void 0),void 0===e&&(e=void 0),void 0===i&&(i=void 0),os(this.instance.config))return!1;if(!xt||!kt)return!1;t=null!=t?t:xt.location,i=null!=i?i:xt.history;try{if(!e){try{xt.localStorage.setItem("test","test"),xt.localStorage.removeItem("test")}catch(t){return!1}e=null==xt?void 0:xt.localStorage}var r,s=sh||zn(t.hash,"__posthog")||zn(t.hash,"state"),n=s?ts((()=>JSON.parse(atob(decodeURIComponent(s)))))||ts((()=>JSON.parse(decodeURIComponent(s)))):null;return n&&"ph_authorize"===n.action?((r=n).source="url",r&&Object.keys(r).length>0&&(n.desiredHash?t.hash=n.desiredHash:i?i.replaceState(i.state,"",t.pathname+t.search):t.hash="")):((r=JSON.parse(e.getItem(nh)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}ic(t){var e=Ft.ph_load_toolbar||Ft.ph_load_editor;!fe(e)&&ae(e)?e(t,this.instance):oh.warn("No toolbar load function found")}loadToolbar(t){var e=!(null==kt||!kt.getElementById(Ds));if(!xt||e)return!1;var r="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=i({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(xt.localStorage.setItem(nh,JSON.stringify(i({},s,{source:void 0}))),2===this.ec())this.ic(s);else if(0===this.ec()){var n;this.tc(1),null==(n=Ft.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",(t=>{if(t)return oh.error("[Toolbar] Failed to load",t),void this.tc(0);this.tc(2),this.ic(s)})),ns(xt,"turbolinks:load",(()=>{this.tc(0),this.loadToolbar(s)}))}return!0}rc(t){return this.loadToolbar(t)}maybeLoadEditor(t,e,i){return void 0===t&&(t=void 0),void 0===e&&(e=void 0),void 0===i&&(i=void 0),this.maybeLoadToolbar(t,e,i)}}},Lh=i({experiments:bh},Rh),Uh={conversations:class{constructor(t){this.nc=void 0,this._conversationsManager=null,this.sc=!1,this.Fe=null,this.ac=!1,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations&&(this.oc=t.ok,t.ok)){var e=t.config.conversations;fe(e)||(ge(e)?this.nc=e:(this.nc=e.enabled,this.Fe=e),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.nc=void 0,this.Fe=null,this.oc=void 0,this.ac=!1}loadIfEnabled(){if(!(this._conversationsManager||this.sc||this._instance.config.disable_conversations||os(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==Ft?void 0:Ft.__PosthogExtensions__;if(t&&!ue(this.nc)&&this.nc)if(this.Fe&&this.Fe.token){this.sc=!0;try{var e=t.initConversations;if(e)return this.lc(e),void(this.sc=!1);var i=t.loadExternalDependency;if(!i)return void this.uc(ut);i(this._instance,"conversations",(e=>{e||!t.initConversations?this.uc("Could not load conversations script",e):this.lc(t.initConversations),this.sc=!1}))}catch(t){this.uc("Error initializing conversations",t),this.sc=!1}}else wh.error("Conversations enabled but missing token in remote config.")}}lc(t){if(this.Fe)try{this._conversationsManager=t(this.Fe,this._instance),this.ac=!1,wh.info("Conversations loaded successfully")}catch(t){this.uc("Error completing conversations initialization",t)}else wh.error("Cannot complete initialization: remote config is null")}uc(t,e){wh.error(t,e),this._conversationsManager=null,this.sc=!1,this.ac=!0}show(){this._conversationsManager?this._conversationsManager.show():wh.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.nc&&!ce(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":os(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.oc?"remote_config_failed":ue(this.nc)?this.oc?"disabled_in_project":"remote_config_pending":this.nc?fe(this.Fe)||!this.Fe.token?"missing_token":null!=Ft&&Ft.__PosthogExtensions__?this.sc?"initializing":this.ac?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var t,e;return null!==(t=null==(e=this._conversationsManager)?void 0:e.isVisible())&&void 0!==t&&t}sendMessage(t,i,r){var s=this;return e((function*(){return s._conversationsManager?s._conversationsManager.sendMessage(t,i,r):(wh.warn(xh),null)}))()}getMessages(t,i){var r=this;return e((function*(){return r._conversationsManager?r._conversationsManager.getMessages(t,i):(wh.warn(xh),null)}))()}markAsRead(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.markAsRead(t):(wh.warn(xh),null)}))()}getTickets(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.getTickets(t):(wh.warn(xh),null)}))()}requestRestoreLink(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(t):(wh.warn(xh),null)}))()}restoreFromToken(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(t):(wh.warn(xh),null)}))()}restoreFromUrlToken(){var t=this;return e((function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(wh.warn(xh),null)}))()}getCurrentTicketId(){var t,e;return null!==(t=null==(e=this._conversationsManager)?void 0:e.getCurrentTicketId())&&void 0!==t?t:null}getWidgetSessionId(){var t,e;return null!==(t=null==(e=this._conversationsManager)?void 0:e.getWidgetSessionId())&&void 0!==t?t:null}Ql(){var t;null==(t=this._conversationsManager)||t.setIdentity()}Jl(){var t;null==(t=this._conversationsManager)||t.clearIdentity()}}},jh={logs:class{constructor(t){var e,r=this;this.name="logs",this.hc=!1,this.dc=!1,this.vc=!1,this.I=Jr("[logs]"),this.cc=i({},this.I,{error(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];e.some(Ph)||r.I.error(...e)}}),this.Za=[],this.fc=[],this.Hh=0,this.Rs=!1,this.gc=[],this.mc=[],this.yc=!1,this.bc=!1,this._c=()=>{var t,e;this.Rs||(this.Hh=0,null==(t=this.wc)||t.onReconnect(),null==(e=this.kc)||e.onReconnect())},this._instance=t,this._instance&&null!=(e=this._instance.config.logs)&&e.captureConsoleLogs&&(this.hc=!0),xt&&ns(xt,"online",this._c)}Sc(t,e,i,r){var s,n=Eh(null==(s=this._instance)||null==(s=s.config)?void 0:s.logs,i);return[new lr(this.xc(t,e),n,this.cc,(()=>this.Cc()),(t=>t()),void 0,r),n]}Tc(){var t,e=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.wc||this.Mc!==e){var i;null==(i=this.wc)||i.reset(),this.Mc=e;var r=this.Sc((()=>this.Za),(t=>{this.Za=t}));this.wc=r[0],this.Ec=r[1]}return this.wc}Ic(){var t,e=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.kc||this.Rc!==e){var i;null==(i=this.kc)||i.reset(),this.Rc=e;var r=this.Sc((()=>this.fc),(t=>{this.fc=t}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},kh);this.kc=r[0],this.Pc=r[1]}return this.kc}setup(t){var e;if(!this.Rs){this.Os=t,null!=(e=this._instance)&&null!=(e=e.config)&&null!=(e=e.logs)&&e.captureConsoleLogs&&(this.hc=!0),(this.hc||this.Ac()&&this.Fc())&&this.Oc();var i=!1,r=t.onRemoteConfig((t=>{var e;i=t.ok&&!0===(null==(e=t.config.logs)?void 0:e.captureConsoleLogs),this.onRemoteConfig(t)}));this.Rs?r.dispose():(this.Ls=r,i||this.loadIfEnabled())}}dispose(){var t,e,i,r;this.Rs||(this.Rs=!0,this.Lc(),null==(t=this.Ls)||t.dispose(),this.Ls=void 0,this.Os=void 0,this.vc=!1,null==xt||xt.removeEventListener("online",this._c),null==(e=this.Dc)||e.call(this),this.Dc=void 0,null==(i=this.wc)||i.reset(),null==(r=this.kc)||r.reset())}onRemoteConfig(t){var e,i;if(!this.Rs){var r=t.ok?null==(e=t.config.logs)?void 0:e.captureConsoleLogs:void 0;fe(r)?this.$c():(null==(i=this._instance)||null==(i=i.persistence)||i.register({[y]:!!r}),r?(this.hc=!0,this.dc||this.Oc(),this.loadIfEnabled()):this.$c())}}reset(){var t,e,i,r;this.Lc(),null==(t=this.wc)||t.clearQueue(),this.Za=[],null==(e=this.wc)||e.reset(),null==(i=this.kc)||i.clearQueue(),this.fc=[],null==(r=this.kc)||r.reset(),this.Hh=0}captureLog(t){this.Rs||this.Tc().captureLog(t)}captureConsoleLog(t){this.Rs||this.Ic().captureLog(t)}captureBufferedConsoleLog(t,e,i){this.Rs||this.Ic().captureLog(t,{context:e,occurredAtMs:i})}Fc(){var t;return!(null==(t=this._instance)||null==(t=t.persistence)||null==(t=t.props)||!t[y])}Ac(){var t,e;return null==(t=this._instance)||null==t.Ua||!t.Ua()||!(null==(e=Ft._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])||!e.config)}Yl(){var t;this.Lc(),null==(t=this.kc)||t.clearQueue(),this.fc=[]}$c(){this.hc||this.Lc()}Oc(){var t,e=this;if(!this.yc&&null!=Ft&&Ft.console){var i=Eh(null==(t=this._instance)||null==(t=t.config)?void 0:t.logs).maxBufferSize,r=function(t){var r;try{r=(t=>{for(;null!=(e=t)&&e.__rrweb_original__;){var e;t=t.__rrweb_original__}return t})(Ft.console[t])}catch(t){return 0}if(!r)return 0;e.mc.push(Pl(Ft.console,t,(s=>{var n=function(){for(var r=arguments.length,n=new Array(r),o=0;r>o;o++)n[o]=arguments[o];try{e.Nc(t,n,i)}catch(t){}return s.apply(Ft.console,n)};return n.__rrweb_original__=r,n})))};for(var s of Sh)r(s);this.yc=!0,this.qc=setTimeout((()=>{this.Lc()}),3e4)}}Nc(t,e,i){var r;if(this.yc&&!this.bc&&0!==e.length)if(null!=(r=this._instance)&&r.is_capturing()){if(i>this.gc.length){this.bc=!0;try{this.gc.push({level:t,args:e,occurredAtMs:Date.now(),context:this.Cc()})}finally{this.bc=!1}}}else this.Lc()}Lc(){if(this.gc=[],this.yc){for(var t of(this.yc=!1,this.qc&&(clearTimeout(this.qc),this.qc=void 0),this.mc))t();this.mc=[]}}jc(){var t=this.gc;return this.Lc(),t}get logger(){return this.Bc||(this.Bc={trace:(t,e)=>this.captureLog({body:t,level:"trace",attributes:e}),debug:(t,e)=>this.captureLog({body:t,level:"debug",attributes:e}),info:(t,e)=>this.captureLog({body:t,level:"info",attributes:e}),warn:(t,e)=>this.captureLog({body:t,level:"warn",attributes:e}),error:(t,e)=>this.captureLog({body:t,level:"error",attributes:e}),fatal:(t,e)=>this.captureLog({body:t,level:"fatal",attributes:e})}),this.Bc}flushLogs(t){t?this.Hc(t):(this.wc&&this.wc.flush().catch((t=>this.zc(t))),this.kc&&this.kc.flush().catch((t=>this.zc(t))))}zc(t){Ph(t)||this.I.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(!this.Rs&&this.hc&&!this.dc&&!this.vc){var t=null==Ft?void 0:Ft.__PosthogExtensions__;if(!t)return this.I.error("PostHog Extensions not found."),void this.Lc();var e=t.loadExternalDependency;if(!e)return this.I.error(ut),void this.Lc();this.vc=!0;try{e(this._instance,"logs",(e=>{if(this.vc=!1,!this.Rs&&this.hc){var i=t.logs;if(e||null==i||!i.initializeLogs)this.I.error("Could not load logs script",e),this.Lc();else{var r,s,n=this.jc();this.Dc=i.initializeLogs(null!==(r=this.Os)&&void 0!==r?r:this._instance),this.dc=!0,n.length>0&&(null==i.replayConsoleBuffer||i.replayConsoleBuffer(null!==(s=this.Os)&&void 0!==s?s:this._instance,n))}}}))}catch(t){throw this.vc=!1,t}}}xc(t,e){var i=this._instance;return{get isDisabled(){return!1},get optedOut(){return!i.is_capturing()},getPersistedProperty:e=>e===Ut.LogsQueue?t():void 0,setPersistedProperty(t,i){var r;t===Ut.LogsQueue&&e(null!==(r=i)&&void 0!==r?r:[])},es:t=>this.es(t),getLibraryId:()=>s.LIB_NAME,getLibraryVersion:()=>s.LIB_VERSION}}es(t){return new Promise((e=>{if(qn(this.Hh,3))e({kind:"fatal",error:$h(void 0,"logs endpoint is unreachable, dropping batch")});else{var i=!1,r=t=>{i||(i=!0,clearTimeout(s),e(t))},s=setTimeout((()=>{this.I.warn("Logs request timed out before receiving a response"),r({kind:"retry-later",error:$h(void 0,"logs request timed out")})}),9e4);this._instance._send_request({method:"POST",url:this.Uc(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:t=>{var e=t.statusCode;if(this.Wc(e),e>=200&&300>e)r({kind:"ok"});else if(413===e)r({kind:"too-large"});else if(0!==e&&408!==e&&429!==e&&500>e)r({kind:"fatal",error:new Error("logs request failed with status "+e)});else{var i;0===e?(t.error||this.I.warn("Logs request failed before receiving an HTTP response"),r({kind:"retry-later",error:$h(t.error,"logs request failed before receiving an HTTP response")})):r({kind:"retry-later",error:null!==(i=t.error)&&void 0!==i?i:new Error("logs request failed with status "+e)})}}})}}))}Wc(t){(0!==t||this._instance.__loaded)&&(this.Hh=Hn(t,this.Hh,3,(()=>this.I.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes."))))}Hc(t){this.Za.length>0&&this.Vc(t,this.Za,this.Ec,s.LIB_NAME,(t=>{this.Za=t})),this.fc.length>0&&this.Vc(t,this.fc,this.Pc,kh,(t=>{this.fc=t}))}Vc(t,e,i,r,n){if(0!==e.length){var o=e.map((t=>t.record));n([]);var a=ar(o,or(i,s.LIB_NAME,s.LIB_VERSION),r,s.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Uc(),data:a,compression:"best-available",batchKey:"logs",transport:t})}}Uc(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}Cc(){var t,e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var i=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),r=i.windowId,s=i.sessionStartTimestamp,n=i.lastActivityTimestamp;e.sessionId=i.sessionId,e.windowId=r,fe(s)||(e.sessionStartTimestamp=s),fe(n)||(e.lastActivityTimestamp=n)}if(null!=Ft&&null!=(t=Ft.location)&&t.href&&(e.currentUrl=this._instance.config.disable_capture_url_hashes?Li(Ft.location.href):Ft.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(e.activeFeatureFlags=o)}return e}}},Bh={metrics:class{constructor(t){this.I=Jr("[metrics]"),this._instance=t}initialize(){}Tc(){var t,e,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.metrics;return this.wc&&this.Mc===i||(null==(e=this.wc)||e.reset(),this.Mc=i,this.wc=new vr(this.xc(),function(t){var e,i,r,s,n,o=null==t?void 0:t.resourceAttributes;return{serviceName:null!==(e=null==o?void 0:o["service.name"])&&void 0!==e?e:null==t?void 0:t.serviceName,serviceVersion:null!==(i=null==o?void 0:o["service.version"])&&void 0!==i?i:null==t?void 0:t.serviceVersion,environment:null!==(r=null==o?void 0:o["deployment.environment"])&&void 0!==r?r:null==t?void 0:t.environment,resourceAttributes:o,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:null!==(s=null==t?void 0:t.flushIntervalMs)&&void 0!==s?s:1e4,maxSeriesPerFlush:null!==(n=null==t?void 0:t.maxSeriesPerFlush)&&void 0!==n?n:1e3}}(i),this.I)),this.wc}count(t,e,i){void 0===e&&(e=1),this.Tc().count(t,e,i)}gauge(t,e,i){this.Tc().gauge(t,e,i)}histogram(t,e,i){this.Tc().histogram(t,e,i)}flush(t){if(!this.wc)return Promise.resolve();if(t){var e=this.wc.drainWindow();return e&&this._s(e,t),Promise.resolve()}return this.wc.flush().catch((t=>this.I.error("PostHog metrics flush failed:",t)))}reset(){var t;null==(t=this.wc)||t.reset()}xc(){var t=this._instance,e=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},_s:t=>e._s(t),getLibraryId:()=>s.LIB_NAME,getLibraryVersion:()=>s.LIB_VERSION}}_s(t,e){return new Promise((r=>{var s=!1,n=t=>{s||(s=!0,clearTimeout(o),r(t))},o=setTimeout((()=>n({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request(i({method:"POST",url:this.Gc(),data:t,compression:"best-available",batchKey:"metrics"},e&&{transport:e},{fireCallbackOnDrop:!0,callback(t){var e=t.statusCode;if(e>=200&&300>e)n({kind:"ok"});else if(413===e)n({kind:"too-large"});else if(0!==e&&408!==e&&429!==e&&500>e)n({kind:"fatal",error:new Error("metrics request failed with status "+e)});else{var i;n({kind:"retry-later",error:null!==(i=t.error)&&void 0!==i?i:new Error("metrics request failed with status "+e)})}}}))}))}Gc(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},zh=i({},Rh,Ch,Oh,Ih,Ah,Fh,Dh,Mh,Nh,Lh,Uh,jh,Bh);_l.__defaultExtensionClasses=i({},zh);var qh=Jr("[ExternalScriptsLoader]"),Hh=t=>{var e=null==kt?void 0:kt.querySelectorAll("script");if(e)for(var i=0;e.length>i;i++)if(e[i].src===t||e[i].getAttribute("src")===t)return e[i]},Vh=(t,e,i)=>{if(t.config.disable_external_dependency_loading)return qh.warn(e+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var r=Hh(e);if(r){if(r.__posthog_loading_callback_fired)return i();var s=r.__posthog_loading_error;return s?i(s):(r.addEventListener("load",(t=>{r.__posthog_loading_callback_fired=!0,i(void 0,t)})),void r.addEventListener("error",(t=>{r.__posthog_loading_error=t,i(t)})))}var n=()=>{if(!kt)return i("document not found");if(Hh(e))return Vh(t,e,i);var r=kt.createElement("script");if(r.type="text/javascript",r.crossOrigin="anonymous",r.src=e,r.onload=t=>{r.__posthog_loading_callback_fired=!0,i(void 0,t)},r.onerror=t=>{r.__posthog_loading_error=t,i(t)},t.config.prepare_external_dependency_script&&(r=t.config.prepare_external_dependency_script(r)),!r)return i("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)kt.head.appendChild(r);else{var s,n=kt.querySelectorAll("body > script");n.length>0?null==(s=n[0].parentNode)||s.insertBefore(r,n[0]):kt.body.appendChild(r)}};null!=kt&&kt.body?n():null==kt||kt.addEventListener("DOMContentLoaded",n)},Wh={},Gh=(t,e)=>{var i="/static/"+e+".js?v="+t.version;if("toolbar"===e){var r=3e5;i=i+"&t="+Math.floor(Date.now()/r)*r}return t.requestRouter.endpointFor("assets",i)};Ft.__PosthogExtensions__=Ft.__PosthogExtensions__||{},Ft.__PosthogExtensions__.loadExternalDependency=(t,e,i)=>{if("remote-config"!==e){var r=t.config.strict_script_versioning;if(r){var s=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+e+".js"),n=Wh[s];if("fallback"===r&&n){if(Hh(n))return void Vh(t,n,i);delete Wh[s]}Vh(t,s,"fallback"===r?(r,n)=>{if(r)if("string"==typeof r)i(r);else{var o,a=Gh(t,e);Wh[s]=a;var l=Hh(s);null==l||null==(o=l.parentNode)||o.removeChild(l),Vh(t,a,i)}else i(void 0,n)}:i)}else Vh(t,Gh(t,e),i)}else{var o=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");Vh(t,o,i)}},Ft.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{var r=t.requestRouter.endpointFor("api",e);Vh(t,r,i)};var Kh=function(){s.SDK_DIST_CHANNEL="npm";var t=el[hl]=new _l;return function(){function t(){t.done||(t.done=!0,ul=!1,Qr(el,(function(t){t._dom_loaded()})))}null!=kt&&kt.addEventListener?"complete"===kt.readyState?t():ns(kt,"DOMContentLoaded",t,{capture:!1}):xt&&Kr.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),t}();exports.Compression=fo,exports.DEFAULT_PRODUCT_TOUR_APPEARANCE={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},exports.DisplaySurveyType=yo,exports.PostHog=_l,exports.ProductTourEventName=bo,exports.ProductTourEventProperties=wo,exports.SurveyEventName=go,exports.SurveyEventProperties=mo,exports.SurveyEventType=po,exports.SurveyPosition={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"},exports.SurveyQuestionBranchingType={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},exports.SurveyQuestionType={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},exports.SurveySchedule={Once:"once",Recurring:"recurring",Always:"always"},exports.SurveyTabPosition={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},exports.SurveyType=_o,exports.SurveyWidgetType={Button:"button",Tab:"tab",Selector:"selector"},exports.default=Kh,exports.posthog=Kh,exports.severityLevels=["fatal","error","warning","log","info","debug"];
|
|
2
2
|
//# sourceMappingURL=main.js.map
|