posthog-js 1.421.1 → 1.421.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/all-external-dependencies.js +1 -1
- package/dist/all-external-dependencies.js.map +1 -1
- package/dist/array.full.es5.js +1 -1
- package/dist/array.full.es5.js.map +1 -1
- package/dist/array.full.js +1 -1
- package/dist/array.full.js.map +1 -1
- package/dist/array.full.no-external.js +1 -1
- package/dist/array.full.no-external.js.map +1 -1
- package/dist/array.js +1 -1
- package/dist/array.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/conversations.js.map +1 -1
- package/dist/crisp-chat-integration.js.map +1 -1
- package/dist/customizations.d.ts +23 -1
- package/dist/customizations.full.js +1 -1
- package/dist/customizations.full.js.map +1 -1
- package/dist/customizations.js +1 -1
- package/dist/customizations.js.map +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.map +1 -1
- package/dist/extension-bundles.js +1 -1
- package/dist/extension-bundles.js.map +1 -1
- package/dist/external-scripts-loader.js.map +1 -1
- package/dist/intercom-integration.js.map +1 -1
- package/dist/lazy-recorder.js +1 -1
- package/dist/lazy-recorder.js.map +1 -1
- package/dist/logs.js +1 -1
- package/dist/logs.js.map +1 -1
- package/dist/main.d.ts +23 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/module.d.ts +23 -1
- package/dist/module.full.d.ts +23 -1
- package/dist/module.full.js +1 -1
- package/dist/module.full.js.map +1 -1
- package/dist/module.full.no-external.d.ts +23 -1
- package/dist/module.full.no-external.js +1 -1
- package/dist/module.full.no-external.js.map +1 -1
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/dist/module.no-external.d.ts +23 -1
- 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.js.map +1 -1
- package/dist/module.slim.no-external.d.ts +23 -1
- package/dist/module.slim.no-external.js +1 -1
- package/dist/module.slim.no-external.js.map +1 -1
- package/dist/posthog-recorder.js +1 -1
- package/dist/posthog-recorder.js.map +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/recorder-v2.js +1 -1
- package/dist/recorder-v2.js.map +1 -1
- package/dist/recorder.js +1 -1
- package/dist/recorder.js.map +1 -1
- package/dist/rrweb-plugin-console-record.js +1 -1
- package/dist/rrweb-plugin-console-record.js.map +1 -1
- package/dist/rrweb.js +1 -1
- package/dist/rrweb.js.map +1 -1
- package/dist/src/constants.d.ts +1 -0
- package/dist/src/logs-types.d.ts +24 -0
- package/dist/src/posthog-logs.d.ts +24 -1
- package/dist/src/utils/console-original.d.ts +6 -0
- package/dist/src/utils/globals.d.ts +2 -0
- package/dist/surveys-preview.js.map +1 -1
- package/dist/surveys.js.map +1 -1
- package/dist/tracing-headers.js +1 -1
- package/dist/tracing-headers.js.map +1 -1
- package/dist/web-vitals-soft-navs.js.map +1 -1
- package/dist/web-vitals-with-attribution-soft-navs.js.map +1 -1
- package/dist/web-vitals-with-attribution.js.map +1 -1
- package/dist/web-vitals.js.map +1 -1
- package/lib/package.json +1 -1
- package/lib/src/constants.d.ts +1 -0
- package/lib/src/constants.js +4 -3
- package/lib/src/constants.js.map +1 -1
- package/lib/src/entrypoints/logs.js +47 -18
- package/lib/src/entrypoints/logs.js.map +1 -1
- package/lib/src/extensions/replay/rrweb-plugins/patch.js +16 -5
- package/lib/src/extensions/replay/rrweb-plugins/patch.js.map +1 -1
- package/lib/src/logs-types.d.ts +24 -0
- package/lib/src/logs-types.js +11 -0
- package/lib/src/logs-types.js.map +1 -0
- package/lib/src/persistence-key-policy.js +1 -0
- package/lib/src/persistence-key-policy.js.map +1 -1
- package/lib/src/posthog-core.js +10 -5
- package/lib/src/posthog-core.js.map +1 -1
- package/lib/src/posthog-logs.d.ts +24 -1
- package/lib/src/posthog-logs.js +266 -10
- package/lib/src/posthog-logs.js.map +1 -1
- package/lib/src/request.js +1 -3
- package/lib/src/request.js.map +1 -1
- package/lib/src/utils/console-original.d.ts +6 -0
- package/lib/src/utils/console-original.js +16 -0
- package/lib/src/utils/console-original.js.map +1 -0
- package/lib/src/utils/globals.d.ts +2 -0
- package/lib/src/utils/globals.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -5
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.0",LIB_NAME:"browser-common"};s.DEBUG=!1,s.LIB_VERSION="1.421.1",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="$web_vitals_allowed_metrics",b="$session_recording_remote_config",w="$replay_sample_rate",x="$replay_override_sampling",E="$replay_override_linked_flag",S="$replay_override_url_trigger",k="$replay_override_event_trigger",T="$sesid",P="$session_is_sampled",R="$enabled_feature_flags",C="$active_feature_flags",O="$early_access_features",I="$feature_flag_details",A="$feature_flag_payloads",F="$feature_flag_request_id",M="$minimal_flag_called_events",D="$override_feature_flags",N="$override_feature_flag_payloads",L="$stored_person_properties",U="$stored_group_properties",j="$groups",B="$surveys",z="$surveys_loaded_at",q="$surveys_activated",H="$surveys_activated_session",V="$surveys_activated_timestamps",W="ph_product_tours",G="$flag_call_reported",K="$flag_call_reported_session_id",J="$feature_flag_errors",Y="$feature_flag_evaluated_at",Q="$user_state",X="$client_session_props",Z="$capture_rate_limit",tt="$initial_campaign_params",et="$initial_referrer_info",it="$initial_person_info",rt="$epp",st="$posthog_cookieless",nt="$cookieless_mode",ot="$sdk_debug_extensions_init_method",at="$sdk_debug_extensions_init_time_ms",lt="$sdk_debug_recording_script_not_loaded",ht="PostHog loadExternalDependency extension not found.",ut="on_reject",dt="always",vt="anonymous",ct="identified",ft="identified_only",pt="visibilitychange",_t="beforeunload",gt="$pageview",mt="$pageleave",yt="$identify",bt="$groupidentify",wt="undefined"!=typeof window?window:void 0,xt="undefined"!=typeof globalThis?globalThis:wt,Et=null==xt?void 0:xt.navigator,St=null==xt?void 0:xt.document,kt=null==xt?void 0:xt.location,Tt=null==xt?void 0:xt.fetch,$t=null!=xt&&xt.XMLHttpRequest&&"withCredentials"in new xt.XMLHttpRequest?xt.XMLHttpRequest:void 0,Pt=null==xt?void 0:xt.AbortController,Rt=null==xt?void 0:xt.CompressionStream,Ct=null==Et?void 0:Et.userAgent;function Ot(){return!(!wt||!1===wt.navigator.onLine)}var It="undefined"!=typeof globalThis?globalThis:wt;It&&"undefined"==typeof self&&(It.self=It),It&&"undefined"==typeof File&&(It.File=function(){});var At=null!=wt?wt:{},Ft=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(e){return t}};function Mt(t){return"string"==typeof t||t}function Dt(t){return"string"==typeof t?t:void 0}var Nt,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="NativeGzipValidationError",Ht=t=>t.length>=2&&31===t[0]&&139===t[1],Vt=(t,e)=>t===jt.GZipJS||e===jt.GZipJS||"gzip"===e,Wt=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),Gt=t=>{var e=new Error("Native gzip produced invalid output: "+t);throw e.name=qt,e},Kt=function(){var t=e((function*(t,e){18>t.size&&Gt("too-short");var i=new Uint8Array(yield t.slice(0,10).arrayBuffer());Ht(i)&&8===i[2]||Gt("invalid-header");var r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{for(var e=(()=>{if(Nt)return Nt;Nt=[];for(var t=0;256>t;t++){for(var e=t,i=0;8>i;i++)e=1&e?3988292384^e>>>1:e>>>1;Nt[t]=e>>>0}return Nt})(),i=4294967295,r=0;t.length>r;r++)i=e[255&(i^t[r])]^i>>>8;return(4294967295^i)>>>0})(e)&&Gt("invalid-crc");var s=e.length>>>0;r.getUint32(4,!0)!==s&&Gt("invalid-size")}));return function(e,i){return t.apply(this,arguments)}}();function Jt(){return Jt=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 Kt(h,s),h}catch(t){if(null!=r&&r.rethrow)throw t;return i&&console.error("Failed to gzip compress data",t),null}})),Jt.apply(this,arguments)}var Yt=20,Qt=1e3,Xt=1e4,Zt="[Circular]",te="[Truncated]",ee="[Unserializable]",ie="[Function]";function re(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 se=["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","pinterest","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"],ne=function(t,e){if(void 0===e&&(e=[]),!t)return!1;var i=t.toLowerCase();return se.concat(e).some((t=>{var e=t.toLowerCase();return-1!==i.indexOf(e)}))};function oe(t,e){return-1!==t.indexOf(e)}var ae=function(t){return t.trim()},le=function(t){return t.replace(/^\$/,"")};function he(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 ue=Object.prototype,de=ue.hasOwnProperty,ve=ue.toString,ce=Array.isArray||function(t){return"[object Array]"===ve.call(t)},fe=t=>"function"==typeof t,pe=t=>t===Object(t)&&!ce(t),_e=t=>{if(pe(t)){for(var e in t)if(de.call(t,e))return!1;return!0}return!1},ge=t=>void 0===t,me=t=>"[object String]"==ve.call(t),ye=t=>me(t)&&0===t.trim().length,be=t=>null===t,we=t=>ge(t)||be(t),xe=t=>"[object Number]"==ve.call(t)&&t==t,Ee=t=>xe(t)&&t>0,Se=t=>"[object Boolean]"===ve.call(t),ke=t=>t instanceof FormData,Te=t=>oe(Bt,t),$e=t=>oe(zt,t);function Pe(t){return null===t||"object"!=typeof t}function Re(t,e){return{}.toString.call(t)==="[object "+e+"]"}function Ce(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 Ie(t,Error)}}function Oe(t){return"undefined"!=typeof Event&&Ie(t,Event)}function Ie(t,e){try{return t instanceof e}catch(t){return!1}}var Ae=[!0,"true",1,"1","yes"],Fe=t=>oe(Ae,t),Me=[!1,"false",0,"0","no"];function De(t,e,i,r,s){return e>i&&(r.warn("min cannot be greater than max."),e=i),xe(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),De(s||i,e,i,r))}class Ne{constructor(t){this.k={},this.S=t.S,this.C=De(t.bucketSize,0,100,t.I),this.R=De(t.refillRate,0,this.C,t.I),this.A=De(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 Le="Mobile",Ue="iOS",je="Android",Be="Tablet",ze=je+" "+Be,qe="iPad",He="Apple",Ve=He+" Watch",We="Safari",Ge="BlackBerry",Ke="Samsung",Je=Ke+"Browser",Ye=Ke+" Internet",Qe="Chrome",Xe=Qe+" OS",Ze=Qe+" "+Ue,ti="Internet Explorer",ei=ti+" "+Le,ii="Opera",ri=ii+" Mini",si="Edge",ni="Microsoft "+si,oi="Firefox",ai=oi+" "+Ue,li="Nintendo",hi="PlayStation",ui="Xbox",di=je+" "+Le,vi=Le+" "+We,ci="Windows",fi=ci+" Phone",pi="Nokia",_i="Ouya",gi="Generic",mi=gi+" "+Le.toLowerCase(),yi=gi+" "+Be.toLowerCase(),bi="Konqueror",wi="Oculus Browser",xi="Vivaldi",Ei="Yandex",Si="Whale",ki="DuckDuckGo",Ti="Pale Moon",$i="Waterfox",Pi="Brave",Ri="Google Search App",Ci="(\\d+(\\.\\d+)?)",Oi=new RegExp("Version/"+Ci),Ii=new RegExp(ui,"i"),Ai=new RegExp(hi+" \\w+","i"),Fi=new RegExp(li+" \\w+","i"),Mi=new RegExp(Ge+"|PlayBook|BB10","i"),Di={"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"},Ni=function(t,e,i,r){e=e||"";var s=function(t){return null!=t&&t.brave?Pi:null}(i);return s||(null!=r&&r.detectGoogleSearchApp&&oe(t,"GSA/")?Ri:oe(t," OPR/")&&oe(t,"Mini")?ri:oe(t," OPR/")?ii:Mi.test(t)?Ge:oe(t,"IE"+Le)||oe(t,"WPDesktop")?ei:oe(t,"OculusBrowser")?wi:oe(t,Je)?Ye:oe(t,si)||oe(t,"Edg/")?ni:oe(t,xi+"/")?xi:oe(t,"YaBrowser/")?Ei:oe(t,Si+"/")?Si:oe(t,ki+"/")||oe(t,"Ddg/")?ki:oe(t,"FBIOS")?"Facebook "+Le:oe(t,"UCWEB")||oe(t,"UCBrowser")?"UC Browser":oe(t,"CriOS")?Ze:oe(t,"CrMo")||oe(t,Qe)?Qe:oe(t,je)&&oe(t,We)?di:oe(t,"FxiOS")?ai:oe(t.toLowerCase(),bi.toLowerCase())?bi:oe(t,Pi+"/")?Pi:((t,e)=>e&&oe(e,He)||function(t){return oe(t,We)&&!oe(t,Qe)&&!oe(t,je)}(t))(t,e)?oe(t,Le)?vi:We:oe(t,"PaleMoon/")?Ti:oe(t,$i+"/")?$i:oe(t,oi)?oi:oe(t,"MSIE")||oe(t,"Trident/")?ti:oe(t,"Gecko")?oi:"")},Li={[ei]:[new RegExp("rv:"+Ci)],[ni]:[new RegExp(si+"?\\/"+Ci)],[Qe]:[new RegExp("("+Qe+"|CrMo)\\/"+Ci)],[Ze]:[new RegExp("CriOS\\/"+Ci)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Ci)],[We]:[Oi],[vi]:[Oi],[ii]:[new RegExp("(Opera|OPR)\\/"+Ci)],[oi]:[new RegExp(oi+"\\/"+Ci)],[ai]:[new RegExp("FxiOS\\/"+Ci)],[bi]:[new RegExp("Konqueror[:/]?"+Ci,"i")],[Ge]:[new RegExp(Ge+" "+Ci),Oi],[di]:[new RegExp("android\\s"+Ci,"i")],[Ye]:[new RegExp(Je+"\\/"+Ci)],[wi]:[new RegExp("OculusBrowser\\/"+Ci)],[xi]:[new RegExp(xi+"\\/"+Ci)],[Ei]:[new RegExp("YaBrowser\\/"+Ci)],[Si]:[new RegExp(Si+"\\/"+Ci)],[Pi]:[new RegExp(Pi+"\\/"+Ci)],[ki]:[new RegExp("(DuckDuckGo|Ddg)\\/"+Ci)],[Ti]:[new RegExp("PaleMoon\\/"+Ci)],[$i]:[new RegExp($i+"\\/"+Ci)],[Ri]:[new RegExp("GSA\\/"+Ci)],[ti]:[new RegExp("(rv:|MSIE )"+Ci)],Mozilla:[new RegExp("rv:"+Ci)]},Ui=function(t,e,i,r){var s=Ni(t,e,i,r),n=Li[s];if(ge(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},ji=[[new RegExp(ui+"; "+ui+" (.*?)[);]","i"),t=>[ui,t&&t[1]||""]],[new RegExp(li,"i"),[li,""]],[new RegExp(hi,"i"),[hi,""]],[Mi,[Ge,""]],[new RegExp(ci,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[fi,""];if(new RegExp(Le).test(e)&&!/IEMobile\b/.test(e))return[ci+" "+Le,""];var i=/Windows NT ([0-9.]+)/i.exec(e);if(i&&i[1]){var r=Di[i[1]]||"";return/arm/i.test(e)&&(r="RT"),[ci,r]}return[ci,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[Ue,[t[3],t[4],t[5]||"0"].join(".")]:[Ue,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=ge(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+je+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+je+")","i"),t=>t&&t[2]?[je,[t[2],t[3],t[4]||"0"].join(".")]:[je,""]],[/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/,[Xe,""]],[/Linux|debian/i,["Linux",""]]],Bi=function(t){return Fi.test(t)?li:Ai.test(t)?hi:Ii.test(t)?ui:new RegExp(_i,"i").test(t)?_i:new RegExp("("+fi+"|WPDesktop)","i").test(t)?fi:/iPad/.test(t)?qe:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?Ve:Mi.test(t)?Ge:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(pi,"i").test(t)?pi:/(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(Le).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)?je:ze:new RegExp("(pda|"+Le+")","i").test(t)?mi:new RegExp(Be,"i").test(t)&&!new RegExp(Be+" pc","i").test(t)?yi:""},zi=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function qi(t,e){return"string"==typeof(i=t)&&zi.test(i)?t:e();var i}function Hi(t){return t?t.split("#")[0]:t}function Vi(t,e){var i=setTimeout(t,e);return(null==i?void 0:i.unref)&&(null==i||i.unref()),i}function Wi(t,e,i){return Gi.apply(this,arguments)}function Gi(){return(Gi=e((function*(t,e,i){var r;try{return yield Promise.race([t,new Promise(((t,s)=>{r=Vi((()=>{try{null==i||i(),t()}catch(t){s(t)}}),e)}))])}finally{clearTimeout(r)}}))).apply(this,arguments)}var Ki={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}},Ji=Ki.info,Yi=0x8000000000000000,Qi={}.propertyIsEnumerable;function Xi(t,e){try{return er(t,e,{ancestors:new WeakSet,remainingNodes:Xt},0)}catch(t){return[]}}function Zi(t,e,i,r){if(0>=i.remainingNodes)return{stringValue:te};if(i.remainingNodes--,Se(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>=Yi||-Yi>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:re(t)};if("function"==typeof t)return{stringValue:ie};if("symbol"==typeof t)return{stringValue:String(t)};if("object"==typeof t&&null!==t){if(i.ancestors.has(t))return{stringValue:Zt};if(r>=Yt)return{stringValue:te};if(t instanceof Date){var n=t.getTime(),o=Number.isFinite(n)?t.toISOString():String(t);return{stringValue:"string"==typeof o?re(o):String(o)}}i.ancestors.add(t);try{try{var a=t.toJSON;if("function"==typeof a)return Zi(a.call(t),e,i,r+1)}catch(t){}return ce(t)?{arrayValue:{values:tr(t,e,i,r+1)}}:{kvlistValue:{values:er(t,e,i,r+1)}}}finally{i.ancestors.delete(t)}}return{stringValue:re(String(t))}}function tr(t,e,i,r){for(var s=[],n=Math.min(t.length,Qt),o=0;n>o&&i.remainingNodes>0;o++)try{var a=o in t?t[o]:void 0;if(we(a))continue;s.push(Zi(a,e,i,r))}catch(t){s.push({stringValue:ee})}return t.length>o&&s.push({stringValue:te}),s}function er(t,e,i,r){var s=[];for(var n in t)if(Qi.call(t,n)){if(s.length>=Qt||0>=i.remainingNodes){null==e||e.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{var o=t[n];if(be(o)||ge(o))continue;s.push({key:re(n),value:Zi(o,e,i,r)})}catch(t){s.push({key:re(n),value:{stringValue:ee}})}}return s}function ir(t){try{return re(String(t))}catch(t){return ee}}function rr(t,e,r){var s=Ki[t.level||"info"]||Ji,n=s.text,o=s.number,a=String(Date.now())+"000000",l={};e.distinctId&&(l.posthogDistinctId=e.distinctId),e.sessionId&&(l.sessionId=e.sessionId),e.windowId&&(l["window.id"]=e.windowId),we(e.sessionStartTimestamp)||(l.sessionStartTimestamp=String(e.sessionStartTimestamp)),we(e.lastActivityTimestamp)||(l.lastActivityTimestamp=String(e.lastActivityTimestamp)),e.currentUrl&&(l["url.full"]=e.currentUrl),e.screenName&&(l["screen.name"]=e.screenName),e.appState&&(l["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(l.feature_flags=e.activeFeatureFlags);var h=i({},l),u=t.attributes;if(u){var d=[];try{d=Object.keys(u)}catch(t){d=[]}for(var v of d){var c=void 0;try{c=u[v]}catch(t){c=ee}Object.defineProperty(h,v,{value:c,enumerable:!0,writable:!0,configurable:!0})}}var f={timeUnixNano:a,observedTimeUnixNano:a,severityNumber:o,severityText:n,body:{stringValue:ir(t.body)},attributes:Xi(h,r)};return t.trace_id&&(f.traceId=t.trace_id),t.span_id&&(f.spanId=t.span_id),ge(t.trace_flags)||(f.flags=t.trace_flags),f}function sr(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 nr(t,e,i,r){return{resourceLogs:[{resource:{attributes:Xi(e)},scopeLogs:[{scope:{name:i,version:r},logRecords:t}]}]}}let or=class{constructor(t,e,i,r,s,n,o){var a;void 0===n&&(n=()=>Promise.resolve()),this._instance=t,this.Wi=e,this.I=i,this.hn=r,this.dn=s,this.vn=n,this.cn=o,this.fn=null,this.pn=0,this.gn=0,this.mn=0,this.yn=0,this.bn=!1,this._n=e.maxBufferSize,this.wn=Math.max(null!==(a=e.maxQueueSize)&&void 0!==a?a:e.maxBufferSize,e.maxBufferSize),this.kn=e.flushIntervalMs,this.Sn=e.maxBatchRecordsPerPost,this.xn=e.rateCapWindowMs,this.Cn=e.maxLogsPerInterval}reset(){this.Tn(),this.fn=null,this.mn=0,this.yn=0,this.bn=!1,this.pn=0,this.gn=0,this.Sn=this.Wi.maxBatchRecordsPerPost}onReconnect(){this.gn=0,this.Mn()}captureLog(t){if(!this._instance.isDisabled&&!this._instance.optedOut&&null!=t&&t.body){var e=this.En(t);if(null!==e)if(e.body){if(this.In()){var i={record:rr(e,this.hn(),this.I)};this.dn((()=>this.Rn(i)))}}else this.I.info("Log was rejected in beforeSend function")}}En(t){var e=this.Wi.beforeSend;if(!e)return t;var i=ce(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}In(){if(void 0===this.Cn)return!0;var t=Date.now(),e=t-this.mn;return this.xn>e&&e>=0||(this.mn=t,this.yn=0,this.bn=!1),this.Cn>this.yn?(this.yn++,!0):(this.bn||(this.I.warn("captureLog dropping logs: exceeded "+this.Cn+" logs per "+this.xn+"ms"),this.bn=!0),!1)}flush(){var t=this;return e((function*(){if(!t._instance.isDisabled)return t.fn||(t.fn=t.Pn().finally((()=>{t.fn=null}))),t.fn}))()}Pn(){var t=this;return e((function*(){var e;t.Tn();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;t.pn=0;var a=Math.min(i.length,t.Sn),l=i.slice(0,a),h=nr(l.map((t=>t.record)),t.An(),null!==(n=t.cn)&&void 0!==n?n:t._instance.getLibraryId(),t._instance.getLibraryVersion()),u=yield t._instance.Fn(h);if("too-large"===u.kind&&l.length>1)t.Sn=Math.max(1,Math.floor(l.length/2)),t.I.warn("Received 413 when sending logs batch of size "+l.length+", reducing batch size to "+t.Sn);else{if("retry-later"===u.kind)throw u.error;if("too-large"===u.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"===u.kind&&t.Wi.maxBatchRecordsPerPost>t.Sn&&(t.Sn=Math.min(t.Wi.maxBatchRecordsPerPost,t.Sn+1)),yield t.On(l.length),i=null!==(o=t._instance.getPersistedProperty(Ut.LogsQueue))&&void 0!==o?o:[],s+=l.length,"fatal"===u.kind)throw u.error}}}))()}On(t){var i=this;return e((function*(){var e,r=Math.max(0,t-i.pn),s=null!==(e=i._instance.getPersistedProperty(Ut.LogsQueue))&&void 0!==e?e:[];i._instance.setPersistedProperty(Ut.LogsQueue,s.slice(r)),yield i.vn()}))()}An(){return sr(this.Wi,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Rn(t){var e;if(!this._instance.optedOut){var i=null!==(e=this._instance.getPersistedProperty(Ut.LogsQueue))&&void 0!==e?e:[];this.wn>i.length||(i.shift(),this.pn++,this.I.info("Logs queue is full, dropping oldest record.")),i.push(t),this._instance.setPersistedProperty(Ut.LogsQueue,i),this._n>i.length?this.Ln():this.Mn()}}Ln(t){void 0===t&&(t=this.kn),this.Dn||(this.Dn=Vi((()=>{this.Dn=void 0,this.Mn()}),t))}$n(){var t=Math.min(Math.max(0,this.gn-1),6);return this.kn*Math.pow(2,t)}Nn(){var t=this._instance.getPersistedProperty(Ut.LogsQueue);return!!t&&t.length>0}shutdown(t){var i=this;return e((function*(){i.Tn();var e=i.flush().catch((()=>{}));void 0!==t?yield Wi(e,t):yield e}))()}flushWithTimeout(t){var i=this;return e((function*(){var e=i.flush();yield Wi(e,t,(()=>{e.catch((()=>{}))}))}))()}Mn(){this.flush().then((()=>{this.gn=0}),(t=>{this.gn++,this.I.error("PostHog logs flush failed:",t)})).finally((()=>{!this._instance.isDisabled&&this.Nn()&&this.Ln(this.$n())}))}Tn(){this.Dn&&(clearTimeout(this.Dn),this.Dn=void 0)}};var ar=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function lr(t){return String(t)+"000000"}function hr(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 ur=class{constructor(t,e,i){this._instance=t,this.Wi=e,this.I=i,this.qn=new Map,this.fn=null,this.jn=!1,this.Bn=new Map,this.Hn=new Set,this.Un=0}count(t,e,i){void 0===e&&(e=1),this.zn({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.zn({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.zn({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.fn,r=function(){var r=e((function*(){i&&(yield i.catch((()=>{}))),yield t.Wn()}));return function(){return r.apply(this,arguments)}}(),s=r().finally((()=>{this.fn===s&&(this.fn=null)}));return this.fn=s,s}drainWindow(){if(0===this.qn.size)return null;var t=this.qn;return this.qn=new Map,this.jn=!1,this.Bn=new Map,this.Hn=new Set,this.Vn(t)}reset(){this.Un++,this.Tn(),this.qn=new Map,this.fn=null,this.jn=!1,this.Bn=new Map,this.Hn=new Set}zn(t){if(!this._instance.isDisabled&&!this._instance.optedOut){var e=this.En(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=hr(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.qn.get(s);if(!n){if(!this.Gn())return;n={name:e.name,type:e.type,unit:e.unit,attributes:r,windowStartMs:Date.now()},this.qn.set(s,n)}var o=this.Bn.get(e.name);void 0===o?this.Bn.set(e.name,e.type):o===e.type||this.Hn.has(e.name)||(this.Hn.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.Zn(n,e.value),this.Ln()}else this.I.warn("Dropping metric '"+e.name+"': value must be a finite number");else this.I.warn("Dropping metric with empty name")}}Gn(){return this.Wi.maxSeriesPerFlush>this.qn.size||(this.jn||(this.jn=!0,this.I.warn("Metric series cap reached ("+this.Wi.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}Zn(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(ar.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,ar)]+=1}}En(t){var e=this.Wi.beforeSend;if(!e)return t;var i=ce(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}Ln(){this.Dn||(this.Dn=Vi((()=>{this.Dn=void 0,this.flush().catch((t=>{this.I.error("Metrics flush failed:",t)}))}),this.Wi.flushIntervalMs))}Tn(){this.Dn&&(clearTimeout(this.Dn),this.Dn=void 0)}Wn(){var t=this;return e((function*(){if(0!==t.qn.size){var e=t.qn;t.qn=new Map,t.jn=!1,t.Bn=new Map,t.Hn=new Set;var i=t.Un,r=yield t._instance.Qn(t.Vn(e));if(i===t.Un)switch(r.kind){case"ok":return;case"retry-later":return t.Jn(e),void t.Ln();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)}}}))()}Vn(t){return e=this.Kn(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.Wi,this._instance.getLibraryId(),this._instance.getLibraryVersion()),s=this._instance.getLibraryId(),n=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:Xi(r)},scopeMetrics:[{scope:{name:s,version:n},metrics:e}]}]};var e,r,s,n}Kn(t){var e=lr(Date.now()),r=new Map;for(var s of t.values()){var n,o=hr(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=Xi(null!==(n=s.attributes)&&void 0!==n?n:{},this.I),h=lr(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:ar})}return Array.from(r.values())}Jn(t){var e,i;for(var r of t){var s=r[0],n=r[1],o=this.qn.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.Gn()&&this.qn.set(s,n)}}};var dr,vr,cr;function fr(t){var e=globalThis._posthogChunkIds;if(e){var i=Object.keys(e);return cr&&i.length===vr||(vr=i.length,cr=i.reduce(((i,r)=>{dr||(dr={});var s=dr[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,dr[r]=[l,h];break}}return i}),{})),cr}}class pr{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&&ce(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:fr(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 _r="?";function gr(t,e,i,r,s){var n={platform:t,filename:e,function:"<anonymous>"===i?_r:i,in_app:!(null!=e&&e.startsWith("webkit-masked-url://"))&&"<anonymous>"!==e};return ge(r)||(n.lineno=r),ge(s)||(n.colno=s),n}var mr=(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]:_r,i?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},yr=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,br=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,wr=/\((\S*)(?::(\d+))(?::(\d+))\)/,xr=(t,e)=>{var i=yr.exec(t);if(i)return gr(e,i[1],_r,+i[2],+i[3]);var r=br.exec(t);if(r){if(r[2]&&0===r[2].indexOf("eval")){var s=wr.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}var n=mr(r[1]||_r,r[2]);return gr(e,n[1],n[0],r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},Er=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Sr=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,kr=(t,e)=>{var i=Er.exec(t);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var r=Sr.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]||_r,o=mr(n,s);return gr(e,s=o[1],n=o[0],i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},Tr=/\(error: (.*)\)/;class $r{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,e){var i=me(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 Re(t,"DOMException")}isDOMError(t){return Re(t,"DOMError")}}class Pr{match(t){return Ce(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 Rr{constructor(){}match(t){return!!Re(t,"ErrorEvent")&&(null!=t.error||this.wi(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.ki(t))&&void 0!==r?r:s.stack,synthetic:!0})}wi(t){return me(t.message)&&t.message.length>0}ki(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(me(r.filename)&&0!==r.filename.length&&0!==s)return"Error\n at "+r.filename+":"+s+":"+n}}var Cr=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class Or{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(Cr);return r&&(e=r[1],i=r[2]),[e,i]}}var Ir=["fatal","error","warning","log","info","debug"];function Ar(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 Fr{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(Oe(t))return t.constructor.name;var e="name"in t?t.name:void 0;return me(e)&&!ye(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: "+Ar(t)}isSeverityLevel(t){return me(t)&&!ye(t)&&Ir.indexOf(t)>=0}getStack(t){try{return me(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:me(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(Ce(i))return i}}getObjectClassName(t){try{var e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch(t){return}}}class Mr{match(t){return Oe(t)}coerce(t,e){var i,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+Ar(t),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}}class Dr{match(t){return Pe(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 Nr{match(t){return Re(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!Oe(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 Pe(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 Lr="$message",Ur="$timestamp",jr=new Set([Lr,Ur]),Br={enabled:!0,max_bytes:32768};function zr(t){var e;return t?{enabled:null!==(e=t.enabled)&&void 0!==e?e:Br.enabled,max_bytes:Hr(t.max_bytes,Br.max_bytes)}:i({},Br)}class qr{constructor(t){this.Yn=[],this.Xn=0,this.Wi=zr(t)}setConfig(t){this.Wi=zr(t),this.ts()}add(t){var e=function(t){var e;try{e=he(t)}catch(t){return}try{var i=JSON.parse(e);if(!pe(i))return;var r=i,s=r[Lr],n=r[Ur];if(!me(s)||0===s.trim().length)return;if(!me(n)&&!xe(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.Wi.max_bytes||(this.Yn.push({step:e.step,bytes:i}),this.Xn+=i,this.ts())}}getAttachable(){return this.Yn.map((t=>t.step))}clear(){this.Yn=[],this.Xn=0}size(){return this.Yn.length}ts(){for(;this.Xn>this.Wi.max_bytes&&this.Yn.length>0;){var t=this.Yn.shift();t&&(this.Xn-=t.bytes)}}}function Hr(t,e){if(!xe(t)||t===1/0||t===-1/0)return e;var i=Math.floor(t);return 0>i?e:i}var Vr=function(t,e){var i=(void 0===e?{}:e).debugEnabled,r={P(e){if(wt&&(s.DEBUG||wt.POSTHOG_DEBUG||i)&&!ge(wt.console)&&wt.console){for(var r=("__rrweb_original__"in wt.console[e]?wt.console[e].__rrweb_original__:wt.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)=>Vr(t+" "+e,i)};return r},Wr=Vr("[PostHog.js]"),Gr=Wr.createLogger;function Kr(t,e){ce(t)&&t.forEach(e)}function Jr(t,e){if(!we(t))if(ce(t))t.forEach(e);else if(ke(t))t.forEach(((t,i)=>e(t,i)));else for(var i in t)de.call(t,i)&&e(t[i],i)}var Yr=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 Qr(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 Xr=function(t){try{return t()}catch(t){return}},Zr=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){Wr.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Wr.critical(t)}}},ts=function(t){var e={};return Jr(t,(function(t,i){(me(t)&&t.length>0||xe(t))&&(e[i]=t)})),e};var es=["herokuapp.com","vercel.app","netlify.app"];function is(t){var e=null==t?void 0:t.hostname;if(!me(e))return!1;var i=e.split(".").slice(-2).join(".");for(var r of es)if(i===r)return!1;return!0}function rs(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 ss(t){return"ph_toolbar_internal"===t.name}var ns=t=>{if(St){try{for(var e=t+"=",i=St.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 xe(t)&&isFinite(t)&&Math.floor(t)===t});class os{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 os(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 os(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 as{generate(){var t=this.generateOrAbort();if(!ge(t))return t;this.Dr=0;var e=this.generateOrAbort();if(ge(e))throw new Error("Could not generate UUID after timestamp reset");return e}generateOrAbort(){var t=Date.now();if(t>this.Dr)this.Dr=t,this.Fr();else{if(this.Dr>=t+1e4)return;this.Nr++,this.Nr>4398046511103&&(this.Dr++,this.Fr())}return os.fromFieldsV7(this.Dr,Math.trunc(this.Nr/Math.pow(2,30)),this.Nr&Math.pow(2,30)-1,this.qr.nextUint32())}Fr(){this.Nr=1024*this.qr.nextUint32()+(1023&this.qr.nextUint32())}constructor(){this.Dr=0,this.Nr=0,this.qr=new us}}var ls,hs=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};wt&&!ge(wt.crypto)&&crypto.getRandomValues&&(hs=t=>crypto.getRandomValues(t));class us{nextUint32(){return this.yt.length>this.jr||(hs(this.yt),this.jr=0),this.yt[this.jr++]}constructor(){this.yt=new Uint32Array(8),this.jr=1/0}}var ds=()=>vs().toString(),vs=()=>(ls||(ls=new as)).generate(),cs="",fs=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var ps={Br:()=>!!St,Wr(t){Wr.error("cookieStore error: "+t)},Ur:ns,zr(t){var e;try{e=JSON.parse(ps.Ur(t))||{}}catch(t){}return e},Hr(t,e,i,r,s){if(!St)return!1;try{var n="",o="",a=function(t,e){if(e){var i=function(t,e){if(void 0===e&&(e=St),cs)return cs;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_"+ds();!cs&&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",cs=n)}return cs}(t);if(!i){var r=(t=>{var e=t.match(fs);return e?e[0]:""})(t);r!==i&&Wr.info("Warning: cookie subdomain discovery mismatch",r,i),i=r}return i?"; domain=."+i:""}return""}(St.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&&Wr.warn("cookieStore warning: large cookie, len="+h.length),St.cookie=h,!0}catch(t){return!1}},$r(t,e){if(null!=St&&St.cookie)try{ps.Hr(t,"",-1,e)}catch(t){return}}},_s=null,gs={Br(){if(!be(_s))return _s;var t=!0;if(ge(wt))t=!1;else try{var e="__mplssupport__";gs.Hr(e,"xyz"),'"xyz"'!==gs.Ur(e)&&(t=!1),gs.$r(e)}catch(e){t=!1}return t||Wr.error("localStorage unsupported; falling back to cookie store"),_s=t,t},Wr(t){Wr.error("localStorage error: "+t)},Ur(t){try{return null==wt?void 0:wt.localStorage.getItem(t)}catch(t){gs.Wr(t)}return null},zr(t){try{return JSON.parse(gs.Ur(t))||{}}catch(t){}return null},Hr(t,e){try{return null==wt||wt.localStorage.setItem(t,JSON.stringify(e)),!0}catch(t){gs.Wr(t)}return!1},$r(t){try{null==wt||wt.localStorage.removeItem(t)}catch(t){gs.Wr(t)}}},ms=[L,C,R,I,A,F,Y,J,G],ys=[a,o,T,P,rt,it,Q],bs=t=>t+"_cpm",ws=["__proto__","constructor","prototype"],xs=t=>{if(!pe(t))return{};var e={};return Object.keys(t).forEach((i=>{-1===ws.indexOf(i)&&(e[i]=t[i])})),e},Es=function(t,e){void 0===e&&(e=[]);var i={};return[...ys,...e].forEach((e=>{var r=t[e];ge(r)||be(r)||""===r||(i[e]=r)})),i},Ss=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)},ks=(t,e)=>({p:e,f:Ss(JSON.stringify(t))}),Ts=(t,e)=>{if(!e)return{properties:[],isValid:!1};try{var i=ps.zr(bs(t)),r=(null==i?void 0:i.f)===Ss(e)&&ce(i.p);return{properties:r?i.p:[],isValid:r}}catch(t){return{properties:[],isValid:!1}}},$s=(t,e)=>e+"|"+(ps.Ur(bs(t))||""),Ps={},Rs={Br:()=>!0,Wr(t){Wr.error("memoryStorage error: "+t)},Ur:t=>Ps[t]||null,zr:t=>Ps[t]||null,Hr:(t,e)=>(Ps[t]=e,!0),$r(t){delete Ps[t]}},Cs=null,Os={Br(){if(!be(Cs))return Cs;if(Cs=!0,ge(wt))Cs=!1;else try{var t="__support__";Os.Hr(t,"xyz"),'"xyz"'!==Os.Ur(t)&&(Cs=!1),Os.$r(t)}catch(t){Cs=!1}return Cs},Wr(t){Wr.error("sessionStorage error: ",t)},Ur(t){try{return null==wt?void 0:wt.sessionStorage.getItem(t)}catch(t){Os.Wr(t)}return null},zr(t){try{return JSON.parse(Os.Ur(t))||null}catch(t){}return null},Hr(t,e){try{return null==wt||wt.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch(t){Os.Wr(t)}return!1},$r(t){try{null==wt||wt.sessionStorage.removeItem(t)}catch(t){Os.Wr(t)}}};class Is{constructor(t){this._instance=t}get Wi(){return this._instance.config}get consent(){return this._s()?0:this.ws}isOptedOut(){return this.Wi.cookieless_mode===dt||this.isRejected()||-1===this.consent&&this.Wi.cookieless_mode===ut}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Wi.opt_out_capturing_by_default}optInOut(t){this.ks.Hr(this.Ss,t?1:0,this.Wi.cookie_expiration,this.Wi.cross_subdomain_cookie,this.Wi.secure_cookie)}reset(){this.ks.$r(this.Ss,this.Wi.cross_subdomain_cookie)}get Ss(){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 ws(){var t=this.ks.Ur(this.Ss);return Fe(t)?1:oe(Me,t)?0:-1}get ks(){var t=this.Wi.opt_out_capturing_persistence_type,e="localStorage"===t?gs:ps;if(!this.xs||this.xs!==e){this.xs=e;var i="localStorage"===t?ps:gs;i.Ur(this.Ss)&&(this.xs.Ur(this.Ss)||this.optInOut(Fe(i.Ur(this.Ss))),i.$r(this.Ss,this.Wi.cross_subdomain_cookie))}return this.xs}_s(){return!!this.Wi.respect_dnt&&[null==Et?void 0:Et.doNotTrack,null==Et?void 0:Et.msDoNotTrack,At.doNotTrack].some((t=>Fe(t)))}}function As(t,e){var i,r=null==t||null==(i=t.config)?void 0:i.get_current_url;if(!fe(r))return e;try{var s=r(e);return me(s)&&s?s:e}catch(t){return Wr.error("Error in get_current_url, falling back to window.location.href",t),e}}var Fs="__POSTHOG_TOOLBAR__",Ms=1,Ds=3,Ns=11;function Ls(t){return t instanceof Element&&(t.id===Fs||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function Us(t){return!!t&&t.nodeType===Ms}function js(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function Bs(t){return!!t&&t.nodeType===Ds}function zs(t){return!!t&&t.nodeType===Ns&&Us(t.host)}var qs=1e3;function Hs(t){return t?ae(t).split(/\s+/):[]}function Vs(t,e){var i=function(t){var e,i=null==wt||null==(e=wt.location)?void 0:e.href;return ge(i)?void 0:As(t,i)}(e);return!!(i&&t&&t.some((t=>i.match(t))))}function Ws(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 Hs(e)}function Gs(t){return we(t)?null:ae(t).split(/(\s+)/).filter((t=>mn(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Ks(t){var e="";return hn(t)&&!un(t)&&t.childNodes&&t.childNodes.length&&Jr(t.childNodes,(function(t){var i;Bs(t)&&t.textContent&&(e+=null!==(i=Gs(t.textContent))&&void 0!==i?i:"")})),ae(e)}function Js(t){var e;return ge(t.target)?t.srcElement||null:null!=(e=t.target)&&e.shadowRoot?t.composedPath()[0]||null:t.target||null}var Ys=["a","button","form","input","select","textarea","label"];function Qs(t,e){if(ge(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 Xs(t){var e=t.parentNode;return!(!e||!Us(e))&&e}var Zs=[".ph-no-autocapture","[data-ph-no-autocapture]"],tn=["next","previous","prev",">","<"],en=[...tn,"+","-","−","–"],rn=(t,e)=>/[a-z0-9]/i.test(e)?t.includes(e):t===e,sn=[".ph-no-rageclick",".ph-no-capture"],nn=["","text","search","email","password","url","tel","number"];function on(t,e){if(!wt||an(t))return!1;var i,r,s,n,o;if(Se(e)?(i=!!e&&sn,r=void 0,s=!1):(i=null!==(n=null==e?void 0:e.css_selector_ignorelist)&&void 0!==n?n:sn,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||!Us(t))&&(!!js(t,"textarea")||(js(t,"input")?oe(nn,(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=ln(t,!1).targetElementList;return!function(t,e){if(!1===t||ge(t))return!1;var i;if(!0===t)i=tn;else{if(!ce(t))return!1;if(t.length>10)return Wr.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=>rn(e,t)||rn(r,t)))}))}(r,a.map((t=>{var e;return{safeText:Ks(t).toLowerCase(),ariaLabel:(null==(e=t.getAttribute("aria-label"))?void 0:e.toLowerCase().trim())||""}})))&&!Qs(a,i)}var an=t=>!t||js(t,"html")||!Us(t),ln=(t,e)=>{if(!wt||an(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,r=[t],s=t;s.parentNode&&!js(s,"body");)if(zs(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var n=Xs(s);if(!n)break;if(e||Ys.indexOf(n.tagName.toLowerCase())>-1)i=!0;else try{var o=wt.getComputedStyle(n);o&&"pointer"===o.getPropertyValue("cursor")&&(i=!0)}catch(t){}r.push(n),s=n}return{parentIsUsefulElement:i,targetElementList:r}};function hn(t){for(var e=new Set,i=0,r=t;r.parentNode&&!js(r,"body");r=r.parentNode){if(i++>=qs||e.has(r))return!1;e.add(r);var s=Ws(r);if(oe(s,"ph-sensitive")||oe(s,"ph-no-capture"))return!1}if(oe(Ws(t),"ph-include"))return!0;var n=t.type||"";if(me(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var o=t.name||t.id||"";return!me(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 un(t){return!!(js(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||js(t,"select")||js(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var dn=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}))$"),vn=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,cn=[16,15,14,13],fn=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),pn=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),_n=/[0-9A-Za-z_]/;function gn(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 mn(t,e){if(void 0===e&&(e=!0),we(t))return!1;if(me(t)){t=ae(t);var i=e?dn.test((t||"").replace(/[- ]/g,"")):function(t){var e;for(vn.lastIndex=0;e=vn.exec(t);){var i=e[2];if(i)for(var r=i.replace(/[- ]/g,""),s=0;r.length>s;s++)for(var n of cn){var o=s+n;if(r.length>=o){var a=r.slice(s,o);if(dn.test(a)&&gn(a))return!0}}}return!1}(t);if(i)return!1;var r=e?fn.test(t):function(t){var e;for(pn.lastIndex=0;e=pn.exec(t);){var i=e[1],r=e[3];if(!(i&&r&&_n.test(i)&&_n.test(r)))return!0}return!1}(t);if(r)return!1}return!0}function yn(t){var e=Ks(t);return mn(e=(e+" "+bn(t)).trim())?e:""}function bn(t){var e="";return t&&t.childNodes&&t.childNodes.length&&Jr(t.childNodes,(function(t){var i;if(t&&"span"===(null==(i=t.tagName)?void 0:i.toLowerCase()))try{var r=Ks(t);e=(e+" "+r).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+bn(t)).trim())}catch(t){Wr.error("[AutoCapture]",t)}})),e}function wn(t){return t.replace(/"|\\"/g,'\\"')}function xn(t){var e=t.attr__class;if(e)return ce(e)?e:Hs(e)}var En=Gr("[Dead Clicks]"),Sn=()=>!0,kn=t=>{var e,i=!(null==(e=t.instance.persistence)||!e.get_property(g)),r=t.instance.config.capture_dead_clicks;return Se(r)?r:!!pe(r)||i};class Tn{get lazyLoadedDeadClicksAutocapture(){return this.Cs}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.Ts((()=>{this.Ms()})):this.stop()}Ts(t){var e,i;null!=(e=At.__PosthogExtensions__)&&e.initDeadClicksAutocapture?t():null==(i=At.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(e=>{e?En.error("failed to load script",e):t()}))}Ms(){var t;if(St){if(!this.Cs&&null!=(t=At.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var e=pe(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.Cs=At.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,e),this.Cs.start(St),En.info("starting...")}}else En.error("`document` not found. Cannot start.")}stop(){this.Cs&&(this.Cs.stop(),this.Cs=void 0,En.info("stopping..."))}}var $n=Gr("[SegmentIntegration]");var Pn="posthog-js";function Rn(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 Cn{constructor(t,e,i,r,s,n){this.name=Pn,this.setupOnce=function(o){o(Rn(t,{organization:e,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class On{constructor(t){this.Es=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(Wr.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.Is=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.Rs()}Rs(){var t;this.Ps=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.Es)}destroy(){var t;null==(t=this.Ps)||t.call(this),this.Ps=void 0}doPageView(t,e){var i,r=this.As(t,e);return this.Is={pathname:null!==(i=null==wt?void 0:wt.location.pathname)&&void 0!==i?i:"",pageViewId:e,timestamp:t},this._instance.scrollManager.resetContext(),r}doPageLeave(t){var e;return this.As(t,null==(e=this.Is)?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.Is)?void 0:t.pageViewId}}As(t,e){var i=this.Is;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(!(ge(n)||ge(o)||ge(a)||ge(l)||ge(h)||ge(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?De(o/n,0,1,Wr):1,v=n>1?De(a/n,0,1,Wr):1,c=l>1?De(h/l,0,1,Wr):1,f=l>1?De(u/l,0,1,Wr):1;r=Yr(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 In=["flags","surveys"],An={[n]:{exposure:"hidden"},[h]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[u]:{exposure:"hidden"},[d]:{exposure:"event"},[v]:{exposure:"hidden"},[c]:{exposure:"event"},[f]:{exposure:"hidden"},[p]:{exposure:"event"},[_]:{exposure:"event"},[g]:{exposure:"event"},[m]:{exposure:"hidden"},[y]:{exposure:"event"},[b]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[T]:{exposure:"hidden"},[P]:{exposure:"event"},[w]:{exposure:"event",shouldSkipFromEventProperties:t=>be(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"},[R]:{exposure:"hidden",storageGroup:"flags"},[C]:{exposure:"hidden",storageGroup:"flags"},[O]:{exposure:"hidden"},[I]:{exposure:"hidden",storageGroup:"flags"},[A]:{exposure:"hidden",storageGroup:"flags"},[F]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[M]:{exposure:"hidden",storageGroup:"flags"},[D]:{exposure:"hidden"},[N]:{exposure:"hidden"},[L]:{exposure:"hidden"},[U]:{exposure:"hidden"},[B]:{exposure:"hidden",storageGroup:"surveys"},[z]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[q]:{exposure:"event"},[H]:{exposure:"hidden"},[V]:{exposure:"hidden"},[W]:{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"},[G]:{exposure:"hidden"},[K]:{exposure:"hidden"},[j]:{exposure:"event"},[J]:{exposure:"hidden"},[Y]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Q]:{exposure:"hidden"},[X]:{exposure:"hidden"},[Z]:{exposure:"hidden"},[tt]:{exposure:"hidden"},[et]:{exposure:"hidden"},[it]:{exposure:"hidden"},[rt]:{exposure:"hidden"},[x]:{exposure:"event"},[E]:{exposure:"event"},[S]:{exposure:"event"},[k]:{exposure:"event"},[ot]:{exposure:"event"},[at]:{exposure:"event"},[lt]:{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"}},Fn=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Mn=t=>{var e=An[t];if(e)return e;for(var i of Fn){var r=i[1];if(0===t.indexOf(i[0]))return r}},Dn=(t,e)=>{try{return JSON.stringify(t,((t,e)=>"bigint"==typeof e?e.toString():e),e)}catch(e){return he(t)}},Nn=t=>{var e=null==St?void 0:St.createElement("a");return ge(e)?null:(e.href=t,e)},Ln=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(!ce(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(t){Wr.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Un=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("=");ce(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},jn=function(t,e){var i=t.match(new RegExp(e+"=([^&]*)"));return i?i[1]:null},Bn=(t,e)=>t>=e&&Ot(),zn=(t,e,i,r)=>{if(0===t){if(Ot()){var s=e+1;return s===i&&r(),s}return e}return 0},qn="https?://(.*)",Hn=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Vn=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Hn],Wn="<masked>",Gn=["li_fat_id"];function Kn(t,e,i){if(!St)return{};var r,s=e?[...Hn,...i||[]]:[],n=Jn(Un(St.URL,s,Wn),t),o=(r={},Jr(Gn,(function(t){var e=ns(t);r[t]=e||null})),r);return Yr(o,n)}function Jn(t,e){var i=Vn.concat(e||[]),r={};return Jr(i,(function(e){var i=Ln(t,e);r[e]=i||null})),r}function Yn(t){var e=function(t){return t?0===t.search(qn+"google.([^/?]*)")?"google":0===t.search(qn+"bing.com")?"bing":0===t.search(qn+"yahoo.com")?"yahoo":0===t.search(qn+"duckduckgo.com")?"duckduckgo":null:null}(t),i="yahoo"!=e?"q":"p",r={};if(!be(e)){r.$search_engine=e;var s=St?Ln(St.referrer,i):"";s.length&&(r.ph_keyword=s)}return r}function Qn(){return navigator.language||navigator.userLanguage}var Xn="$direct";function Zn(){return(null==St?void 0:St.referrer)||Xn}function to(t,e,i){void 0===i&&(i=!1);var r=t?[...Hn,...e||[]]:[],s=i?Hi(null==kt?void 0:kt.href):null==kt?void 0:kt.href,n=null==s?void 0:s.substring(0,1e3);return{r:Zn().substring(0,1e3),u:n?Un(n,r,Wn):void 0}}function eo(t,e){var i;void 0===e&&(e=!1);var r=t.r,s=t.u,n=e?Hi(s):s,o={$referrer:r,$referring_domain:null==r?void 0:r==Xn?Xn:null==(i=Nn(r))?void 0:i.host};if(n){o.$current_url=n;var a=Nn(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname;var l=Jn(n);Yr(o,l)}if(r){var h=Yn(r);Yr(o,h)}return o}function io(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function ro(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var so={flags:Y,surveys:z},no=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],oo=t=>t+"_cookie_identity_change_pending",ao="main",lo=(t,e)=>{Jr(t,((i,r)=>{var s=Mn(r);s&&"event"!==s.exposure||{}.hasOwnProperty.call(e,r)||delete t[r]}))};class ho{constructor(t,e,r){if(void 0===r&&(r=!0),this.Fs={},this.Os=!1,this.Ls=!1,this.Ds=!1,this.$s=!1,this.Wi=t,this.Ns=r,this.props={},this.qs=void 0,this.js=(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.ks=this.Bs(t),this.Ls=this.Hs(t),this.load(),t.debug&&Wr.info("Persistence loaded",t.persistence,i({},this.props)),this.update_config(t,t,e),this.save(),wt){var s=()=>this.flush();rs(wt,"beforeunload",s,{capture:!1}),rs(wt,"pagehide",s,{capture:!1})}}Us(){var t,e=null==(t=this.Wi)?void 0:t.persistence_save_debounce_ms;return xe(e)&&e>0?e:0}zs(t){if(this.Wi.cookieWinsOnConflict&&"localstorage+cookie"===this.Wi.persistence.toLowerCase())if(t)try{var e=Es(t,this.Wi.cookie_persisted_properties||[]),i=ks(e,this.Wi.cookie_persisted_properties||[]),r=JSON.stringify(e)+"|"+JSON.stringify(i),s=ps.Ur(this.js)||void 0;s&&$s(this.js,s)===r&&(this.Ws=r,this.Vs=s)}catch(t){}else try{var n=ps.Ur(this.js)||void 0;this.Ws=n?$s(this.js,n):void 0,this.Vs=n}catch(t){}}syncCookieProperties(){return this.Gs(this.Wi)}Gs(t,e){if(void 0===e&&(e=!1),this.Zs&&!e||this.$s||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;var i;try{i=ps.Ur(this.js)||void 0}catch(t){}if(!i||i===this.Vs)return!1;var r,s=$s(this.js,i);try{r=xs(JSON.parse(i))}catch(t){return!1}if((ps.Ur(this.js)||void 0)!==i)return!1;this.Ws=s,this.Vs=i;var n=Ts(this.js,i),a=[...ys,...n.properties],l={};if(Object.keys(r).forEach((t=>{var e=r[t];(ge(e)||be(e)||""===e||t===Q&&e!==vt&&e!==ct)&&(l[t]=!0,delete r[t])})),_e(r))return!1;var u=o in r||r[Q]===vt||r[Q]===ct,d=this.props[o],v=this.props[Q],c=Yr({},this.props);[...ys,...t.cookie_persisted_properties||[]].forEach((t=>{if(-1!==a.indexOf(t)&&!(t in r)&&!l[t]&&(u||t!==o&&t!==Q)){var e=c[t];!n.isValid&&-1!==ys.indexOf(t)&&(!1===e||0===e)||delete c[t]}})),this.props=Yr(c,r),!u||Q in r||Q in this.props||this.Qs(Q,vt);var f=this.props[o],p=this.props[Q];return!u||f===d&&p===v||(this.Ds=!0,Os.Hr(oo(this.js),!0),this.Js(L),this.Js(C),this.Js(R),this.Js(I),this.Js(A),this.Js(F),this.Js(Y),this.Js(J),this.Js(G),p===vt&&(v===ct||r[Q]===vt||!ge(d)&&f!==d)&&(lo(this.props,r),this.Js(U)),p===ct?this.props.$user_id=f:delete this.props.$user_id,this.Js(h)),!0}consumeCookieIdentityChange(){var t=oo(this.js),e=this.Ds||!!Os.Ur(t);return this.Ds=!1,e&&Os.$r(t),e}Ks(t){return void 0===t&&(t=!1),!(this.$s||this.Zs&&!t||!this.Wi.cookieWinsOnConflict||"localstorage+cookie"!==this.Wi.persistence.toLowerCase()||(this.$s=!0,0))}Ys(){this.$s&&(ge(this.Xs)||(clearTimeout(this.Xs),this.Xs=void 0),delete this.Fs[ao],this.ta(!0))}ea(t){if(void 0===t&&(t=!0),this.$s)try{t?this.Ys():ge(this.Xs)||(clearTimeout(this.Xs),this.Xs=void 0)}finally{this.$s=!1}}isDisabled(){return!!this.Zs}Bs(t){-1===no.indexOf(t.persistence.toLowerCase())&&(Wr.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=[...ys,...t];return i({},gs,{zr(t){try{var i,s={};try{i=ps.Ur(t)||void 0,s=i?xs(JSON.parse(i)):{}}catch(t){}var n,a=JSON.parse(gs.Ur(t)||"{}");if(e){var l=Ts(t,i),h=[...ys,...l.properties],u={};Object.keys(s).forEach((t=>{var e=s[t];be(e)||""===e||t===Q&&e!==vt&&e!==ct||(u[t]=e)}));var d=o in u||u[Q]===vt||u[Q]===ct;if(Object.keys(u).length>0){var v,c=a[o],f=null!==(v=a[Q])&&void 0!==v?v:vt;r.forEach((t=>{if(-1!==h.indexOf(t)&&!(t in s)&&(d||t!==o&&t!==Q)){var e=a[t];!l.isValid&&-1!==ys.indexOf(t)&&(!1===e||0===e)||delete a[t]}})),!d||Q in s||Q in a||(a[Q]=vt),!d||(o in u?u[o]:a[o])===c&&(Q in u?u[Q]:a[Q])===f||(ms.forEach((t=>delete a[t])),u[Q]===ct&&o in u?a.$user_id=u[o]:delete a.$user_id,u[Q]!==ct&&(delete a[j],delete a[U]),delete a.__alias)}n=Yr(a,u)}else n=Yr(s,a);return gs.Hr(t,n),n}catch(t){}return null},Hr(i,r,s,n,o,a){var l=gs.Hr(i,r,void 0,void 0,a);try{var h=Es(r,t);if(Object.keys(h).length){if(e){var u=bs(i),d=ks(h,t);if(ps.Hr(u,d,s,n,o,a),ps.Ur(u)!==JSON.stringify(d)){ps.$r(u,n);var v=Es(r);return ps.Hr(i,v,s,n,o,a),l}}ps.Hr(i,h,s,n,o,a)}}catch(t){gs.Wr(t)}return l},$r(t,e){try{null==wt||wt.localStorage.removeItem(t),ps.$r(t,e),ps.$r(bs(t),e)}catch(t){gs.Wr(t)}}})}(t.cookie_persisted_properties||[],t.cookieWinsOnConflict),s=!1,n=t.persistence.toLowerCase();return"localstorage"===n&&gs.Br()?(e=gs,s=!0):"localstorage+cookie"===n&&r.Br()?(e=r,s=!0):"sessionstorage"===n&&Os.Br()?e=Os:"memory"===n?e=Rs:"cookie"===n?e=ps:r.Br()?(e=r,s=!0):e=ps,this.Os=s,e}ia(t){return this.js+"__"+t}Hs(t){return this.Os&&!!t.split_storage}properties(){var t={};return Jr(this.props,((e,i)=>{var r=Mn(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.Zs||t){var e=this.Wi.cookieWinsOnConflict&&"localstorage+cookie"===this.Wi.persistence.toLowerCase(),i=e?gs.zr(this.js):null,r={};if(e)try{Jr(r=xs(ps.zr(this.js)),((t,e)=>{(ge(t)||be(t)||""===t)&&delete r[e]}))}catch(t){}var s=this.ks.zr(this.js);if(s&&(this.props=Yr({},s)),this.Ls&&this.ra(),e&&s){var n,a,l=null==i?void 0:i[o],h=null!==(n=null==i?void 0:i[Q])&&void 0!==n?n:vt,u=s[o],d=null!==(a=s[Q])&&void 0!==a?a:vt;if(u!==l||d!==h){this.Ds=!0,Os.Hr(oo(this.js),!0);var v=Yr({},this.props);ms.forEach((t=>delete v[t])),d===vt&&(h===ct||r[Q]===vt||!ge(l)&&u!==l)&&(lo(v,r),delete v[U]),this.props=v;var c=new Set;ms.forEach((t=>{var e,i=null==(e=Mn(t))?void 0:e.storageGroup;i&&c.add(i)})),c.forEach((t=>{var e={};Jr(this.props,((i,r)=>{var s;(null==(s=Mn(r))?void 0:s.storageGroup)===t&&(e[r]=i)})),_e(e)?(gs.$r(this.ia(t)),this.Fs[t]={}):gs.Hr(this.ia(t),e)&&(this.Fs[t]={persisted:!0,fingerprint:this.na(e,t)})}))}}Os.Ur(oo(this.js))&&(this.Ds=!0)}}ra(){for(var t of In){var e=gs.zr(this.ia(t));if(e&&!_e(e)){var i=this.sa(t);i.persisted=!0,this.aa(t)||(i.fingerprint=this.na(e,t)),this.oa(t,e)||Yr(this.props,e)}}}aa(t){return Object.keys(this.props).some((e=>{var i;return(null==(i=Mn(e))?void 0:i.storageGroup)===t}))}oa(t,e){var i=so[t];if(!i)return!1;var r=e[i],s=this.props[i];return xe(r)&&xe(s)&&s>r}refreshKey(t){var e;if(!this.Zs){var i=this.Ls?null==(e=Mn(t))?void 0:e.storageGroup:void 0,r=i?gs.zr(this.ia(i)):this.ks.zr(this.js);if(r&&t in r)this.Qs(t,r[t]);else{if(i){var s=this.ks.zr(this.js);if(s&&t in s)return void this.Qs(t,s[t])}this.Js(t)}}}save(){if(!this.Zs){var t=this.Us();t>0?ge(this.Xs)&&(this.Xs=setTimeout((()=>{this.Xs=void 0,this.ta()}),t)):this.ta()}}flush(){ge(this.Xs)||(clearTimeout(this.Xs),this.Xs=void 0,this.ta())}ta(t){void 0===t&&(t=!1),this.Zs||this.$s&&!t||(t||this.syncCookieProperties(),this.Ls?this.la():this.ua(this.ks,this.js,this.props,ao)&&this.zs(this.props))}la(){var t=this.ha(),e=t.main,i=t.groups;for(var r of(this.ua(this.ks,this.js,e,ao)&&this.zs(e),In)){var s,n=i[r];(!_e(n)||null!=(s=this.Fs[r])&&s.persisted)&&this.ua(gs,this.ia(r),n,r)}}ha(){var t={},e={flags:{},surveys:{}};return Jr(this.props,((i,r)=>{var s,n=null==(s=Mn(r))?void 0:s.storageGroup;n?e[n][r]=i:t[r]=i})),{main:t,groups:e}}na(t,e){if(e===ao)return JSON.stringify(t)+"|"+this.da+"|"+this.va+"|"+this.ca;var i={};return Jr(t,((t,e)=>{var r;i[e]=null!=(r=Mn(e))&&r.volatile?"__volatile__":t})),JSON.stringify(i)}ua(t,e,i,r){var s,n=this.sa(r);if(r!==ao&&!n.dirty&&!ge(n.fingerprint))return!1;try{if((s=this.na(i,r))===n.fingerprint)return n.dirty=!1,!1}catch(t){s=void 0}return t.Hr(e,i,this.da,this.va,this.ca,this.Wi.debug)?(n.dirty=!1,r!==ao&&(n.persisted=!0),ge(s)||(n.fingerprint=s),!0):(this.Wi.debug&&Wr.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(ge(this.Xs)||(clearTimeout(this.Xs),this.Xs=void 0),this.ks.$r(this.js,!1),this.ks.$r(this.js,!0),!i&&this.Ns)for(var r of In)gs.$r(this.ia(r));i?delete this.Fs[ao]:this.Fs={},this.Ws=void 0,this.Vs=void 0}clear(){this.remove(),this.props={}}register_once(t,e,i){if(pe(t)){this.syncCookieProperties(),ge(e)&&(e="None"),this.da=ge(i)?this.fa:i;var r=!1;if(Jr(t,((t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this.Qs(i,t),r=!0)})),r)return this.save(),!0}return!1}register(t,e){if(pe(t)){this.syncCookieProperties(),this.da=ge(e)?this.fa:e;var i=!1;if(Jr(t,((e,r)=>{t.hasOwnProperty(r)&&(this.props[r]!==e||pe(e)||ce(e))&&(this.Qs(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.Js(r),i=!0);i&&this.save()}update_campaign_params(){var t=null==St?void 0:St.URL;if(t!==this.qs){var e=Kn(this.Wi.custom_campaign_params,this.Wi.mask_personal_data_properties,this.Wi.custom_personal_data_properties);_e(ts(e))||this.register(e),this.qs=t}}update_search_keyword(){var t;this.register((t=null==St?void 0:St.referrer)?Yn(t):{})}update_referrer_info(){var t;this.register_once({$referrer:Zn(),$referring_domain:null!=St&&St.referrer&&(null==(t=Nn(St.referrer))?void 0:t.host)||Xn},void 0)}set_initial_person_info(){this.props[tt]||this.props[et]||this.register_once({[it]:to(this.Wi.mask_personal_data_properties,this.Wi.custom_personal_data_properties,this.Wi.disable_capture_url_hashes)},void 0)}get_initial_props(){var t={};Jr([et,tt],(e=>{var i=this.props[e];i&&Jr(i,(function(e,i){t["$initial_"+le(i)]=e}))}));var e=this.props[it];if(e){var i=function(t,e){void 0===e&&(e=!1);var i=eo(t,e),r={};return Jr(i,(function(t,e){r["$initial_"+le(e)]=t})),r}(e,this.Wi.disable_capture_url_hashes);Yr(t,i)}return t}safe_merge(t){return Jr(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.Zs&&!l;l||this.Gs(e,h),this.Wi=t,!l&&(s||n||a)&&(this.Ws=void 0,this.Vs=void 0,this.Gs(i({},t,{cookie_persisted_properties:e.cookie_persisted_properties}),h));var u=o||a?this.Bs(t):this.ks,d=this.Hs(t),v=o||d!==this.Ls,c=!l&&(v||t.cross_subdomain_cookie!==this.va||t.secure_cookie!==this.ca)&&this.Ks(h);try{if(this.fa=this.da=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.ks=u,this.Ls=d,this.props=f,this.save()}else a&&(this.ks=u,l||(delete this.Fs[ao],this.ta()))}finally{c&&this.ea()}}set_disabled(t){this.Zs=t,this.Zs?this.remove():this.save()}set_cross_subdomain(t){t!==this.va&&(this.va=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.ca&&(this.ca=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,e){var i=this.props[u]||{};i[t]=e,this.Qs(u,i),this.save()}remove_event_timer(t){var e=this.props[u]||{},i=e[t];return ge(i)||(delete e[t],this.Qs(u,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this.Qs(t,e),this.save()}Qs(t,e){var i;this.props[t]=e,null!=(i=Mn(t))&&i.volatile||this.pa(t)}Js(t){delete this.props[t],this.pa(t)}pa(t){var e,i=null==(e=Mn(t))?void 0:e.storageGroup;i&&(this.sa(i).dirty=!0)}sa(t){return this.Fs[t]||(this.Fs[t]={})}}function uo(t){var e=!0;return{dispose(){if(e){e=!1;var i=t();i&&fe(i.then)&&i.then(void 0,(()=>{}))}}}}var vo={GZipJS:"gzip-js",Base64:"base64"},co={Activation:"events",Cancellation:"cancelEvents"},fo={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},po={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},_o={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"},go={Popover:"popover",Inline:"inline"},mo={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"},yo={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"},bo=Gr("[RateLimiter]");class wo{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=>{bo.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void bo.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(Z))&&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=(xe(a.dropped)?a.dropped:0)+1;a.dropped=h,!this.lastEventRateLimited&&this.ga(h)&&(a.dropped=0)}return this.lastEventRateLimited=l,null==(r=this.instance.persistence)||r.set_property(Z,a),{isRateLimited:l,remainingTokens:a.tokens}}ma(t){var e=this.instance.config.property_denylist;return!ce(e)||!e.includes(t)}ya(){var t;if(this.ma("$current_url")&&this.ma("$pathname")&&null!=kt&&kt.pathname)return""+(null!==(t=kt.origin)&&void 0!==t?t:"")+kt.pathname}ga(t){var e,i,r=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,n=this.ya(),o=this.ma("$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 xo=Gr("[RemoteConfig]");class Eo{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=At._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}ba(t){var e,i;null!=(e=At.__PosthogExtensions__)&&e.loadExternalDependency?null==(i=At.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}_a(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 xo.info("Using preloaded remote config",this.remoteConfig),void this.wa(this.remoteConfig);if(this._instance.ka())return void xo.warn("Remote config is disabled. Falling back to local config.");this.ba((t=>{if(!t)return xo.info("No config found after loading remote JS config. Falling back to JSON."),void this._a((t=>{this.wa(t.json,t)}));this.wa(t)}))}catch(t){xo.error("Error loading remote config",t),this.wa()}}wa(t,e){!t&&e&&(0===e.statusCode?e.error||xo.warn("Failed to fetch remote config from PostHog."):xo.error("Failed to fetch remote config from PostHog."));try{this._instance.wa(t?{ok:!0,config:t}:{ok:!1})}catch(t){xo.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){xo.error("Error loading feature flags",t)}}}var So=Uint8Array,ko=Uint16Array,To=Uint32Array,$o=new So([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]),Po=new So([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]),Ro=new So([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Co=function(t,e){for(var i=new ko(31),r=0;31>r;++r)i[r]=e+=1<<t[r-1];var s=new To(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]},Oo=Co($o,2),Io=Oo[1];Oo[0][28]=258,Io[258]=28;for(var Ao=Co(Po,0)[1],Fo=new ko(32768),Mo=0;32768>Mo;++Mo){var Do=(43690&Mo)>>>1|(21845&Mo)<<1;Fo[Mo]=((65280&(Do=(61680&(Do=(52428&Do)>>>2|(13107&Do)<<2))>>>4|(3855&Do)<<4))>>>8|(255&Do)<<8)>>>1}var No=function(t,e,i){for(var r=t.length,s=0,n=new ko(e);r>s;++s)++n[t[s]-1];var o,a=new ko(e);for(s=0;e>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new ko(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[Fo[d]>>>l]=h}else for(o=new ko(r),s=0;r>s;++s)o[s]=Fo[a[t[s]-1]++]>>>15-t[s];return o},Lo=new So(288);for(Mo=0;144>Mo;++Mo)Lo[Mo]=8;for(Mo=144;256>Mo;++Mo)Lo[Mo]=9;for(Mo=256;280>Mo;++Mo)Lo[Mo]=7;for(Mo=280;288>Mo;++Mo)Lo[Mo]=8;var Uo=new So(32);for(Mo=0;32>Mo;++Mo)Uo[Mo]=5;var jo=No(Lo,9,0),Bo=No(Uo,5,0),zo=function(t){return(t/8>>0)+(7&t&&1)},qo=function(t,e,i){(null==i||i>t.length)&&(i=t.length);var r=new(t instanceof ko?ko:t instanceof To?To:So)(i-e);return r.set(t.subarray(e,i)),r},Ho=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8},Vo=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8,t[r+2]|=i>>>16},Wo=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 So(0),0];if(1==s){var o=new So(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 ko(v+1),f=Go(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 So(c),f]},Go=function(t,e,i){return-1==t.s?Math.max(Go(t.l,e,i+1),Go(t.r,e,i+1)):e[t.s]=i},Ko=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new ko(++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]},Jo=function(t,e){for(var i=0,r=0;e.length>r;++r)i+=t[r]*e[r];return i},Yo=function(t,e,i){var r=i.length,s=zo(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)},Qo=function(t,e,i,r,s,n,o,a,l,h,u){Ho(e,u++,i),++s[256];for(var d=Wo(s,15),v=d[0],c=d[1],f=Wo(n,15),p=f[0],_=f[1],g=Ko(v),m=g[0],y=g[1],b=Ko(p),w=b[0],x=b[1],E=new ko(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=Wo(E,7),T=k[0],P=k[1],R=19;R>4&&!T[Ro[R-1]];--R);var C,O,I,A,F=h+5<<3,M=Jo(s,Lo)+Jo(n,Uo)+o,D=Jo(s,v)+Jo(n,p)+o+14+3*R+Jo(E,T)+(2*E[16]+3*E[17]+7*E[18]);if(M>=F&&D>=F)return Yo(e,u,t.subarray(l,l+h));if(Ho(e,u,1+(M>D)),u+=2,M>D){C=No(v,c,0),O=v,I=No(p,_,0),A=p;var N=No(T,P,0);for(Ho(e,u,y-257),Ho(e,u+5,x-1),Ho(e,u+10,R-4),u+=14,S=0;R>S;++S)Ho(e,u+3*S,T[Ro[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)Ho(e,u,N[B=31&j[S]]),u+=T[B],B>15&&(Ho(e,u,j[S]>>>5&127),u+=j[S]>>>12)}}else C=jo,O=Lo,I=Bo,A=Uo;for(S=0;a>S;++S)if(r[S]>255){var B;Vo(e,u,C[257+(B=r[S]>>>18&31)]),u+=O[B+257],B>7&&(Ho(e,u,r[S]>>>23&31),u+=$o[B]);var z=31&r[S];Vo(e,u,I[z]),u+=A[z],z>3&&(Vo(e,u,r[S]>>>5&8191),u+=Po[z])}else Vo(e,u,C[r[S]]),u+=O[r[S]];return Vo(e,u,C[256]),u+O[256]},Xo=new To([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Zo=function(){for(var t=new To(256),e=0;256>e;++e){for(var i=e,r=9;--r;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),ta=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function ea(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=Zo[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 So(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=Yo(l,h,t.subarray(u,d)):(l[u]=!0,h=Yo(l,h,t.subarray(u,o)))}else{for(var v=Xo[e-1],c=v>>>13,f=8191&v,p=(1<<i)-1,_=new ko(32768),g=new ko(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 To(25e3),x=new ko(288),E=new ko(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=Qo(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|Io[M]<<18|Ao[D];var G=31&Io[M],K=31&Ao[D];k+=$o[G]+Po[K],++x[257+G],++E[K],P=u+M,++S}else w[T++]=t[u],++x[t[u]]}}h=Qo(t,l,!0,w,x,E,k,T,R,u-R,h)}return qo(a,0,r+zo(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&&ta(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),ta(h,u-8,i.d()),ta(h,u-4,r),h}var ia=!!$t||!!Tt,ra="text/plain",sa=!1,na=(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:"")},oa=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 Jr(t,(function(t,e){ge(t)||ge(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},aa=t=>{if(t.Sa)return t.Sa;var e=t.data,i=t.compression;if(e){if(i===vo.GZipJS){var r=ea(function(t,e){var i=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new So(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 So(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 qo(r,0,s)}(Dn(e)),{mtime:0});return{contentType:ra,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===vo.Base64){var s=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,e)=>String.fromCharCode(parseInt(e,16))))):t}(Dn(e)),n=(t=>"data="+encodeURIComponent("string"==typeof t?t:Dn(t)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=Dn(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},la=t=>{var e,r,s=()=>"sendBeacon"===t.transport?{url:oa(t.url,{compression:vo.Base64}),encodedBody:aa(i({},t,{compression:vo.Base64,Sa:void 0}))}:{url:na(t.url,"compression"),encodedBody:aa(i({},t,{compression:void 0,Sa:void 0}))};try{e=aa(t)}catch(e){if(Vt(t.compression,Ln(t.url,"compression")))return Wr.error("Failed to gzip request body, sending uncompressed payload",e),s();throw e}return e&&Vt(t.compression,Ln(t.url,"compression"))&&!((r=e.body)instanceof ArrayBuffer?Ht(new Uint8Array(r)):ArrayBuffer.isView(r)&&Ht(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)))?(sa=!0,s()):{url:t.url,encodedBody:e}},ha=t=>{try{return la(t)}catch(e){return Wr.error(e),void(null==t.callback||t.callback({statusCode:0,error:e}))}},ua=function(){var t=e((function*(t){var e=Dn(t.data),r=yield function(t,e,i){return Jt.apply(this,arguments)}(e,s.DEBUG,{rethrow:!0});if(!r)return t;var n=yield r.arrayBuffer();return i({},t,{Sa:{contentType:ra,body:n,estimatedSize:n.byteLength}})}));return function(e){return t.apply(this,arguments)}}(),da=/Failed to fetch|NetworkError|Load failed/i,va=t=>"TypeError"===(null==t?void 0:t.name)&&da.test((null==t?void 0:t.message)||""),ca=t=>{var e=ha(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;Jr(t.headers,(function(t,e){h.append(e,t)})),o&&h.append("Content-Type",o);var u=null,d=!1;if(Pt){var v=new Pt;u={signal:v.signal,timeout:setTimeout((()=>{var e,i;d=!0,v.abort((e=t.timeout,(i=new Error("PostHog request timed out"+(e?" after "+e+"ms":""))).name="AbortError",i))}),t.timeout)}}var c=e=>{d&&"AbortError"===(null==e?void 0:e.name)||va(e)?Wr.warn(e):Wr.error(e),null==t.callback||t.callback({statusCode:0,error:e})};try{var f;Tt(r,i({method:(null==t?void 0:t.method)||"GET",headers:h,keepalive:"POST"===t.method&&!t.xa&&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){Wr.error(t)}null==t.callback||t.callback(r)})))).catch(c).finally((()=>u?clearTimeout(u.timeout):null))}catch(t){u&&clearTimeout(u.timeout),c(t)}}},fa=t=>{try{var e,r=la(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(Et.sendBeacon(s,h))return;var u=ce(t.data)?t.data:null==(e=t.data)?void 0:e.batch;if(ce(u)&&u.length>1&&(null!=l?l:0)>16384){var d=Math.ceil(u.length/2),v=e=>ce(t.data)?e:i({},t.data,{batch:e});return fa(i({},t,{data:v(u.slice(0,d))})),void fa(i({},t,{data:v(u.slice(d))}))}Wr.warn("Beacon of ~"+(null!=l?l:0)+" bytes was rejected by the browser, falling back to fetch"),ca(i({},t,{xa:!0}))}catch(t){Wr.warn("Beacon send failed",t)}},pa=(t,e,r,s)=>{var n="query"===s?"POST"===e?"sent_at":"_":void 0;return oa(r===vo.GZipJS?na(t,"compression"):t,i({},n?{[n]:Date.now().toString()}:{},r===vo.GZipJS?{}:{compression:r}))},_a=[];Tt&&_a.push({transport:"fetch",method:ca}),$t&&_a.push({transport:"XHR",method(t){var e=ha(t);if(e){var i=new $t,r=e.encodedBody;i.open(t.method||"GET",e.url,!0);var s=null!=r?r:{},n=s.contentType,o=s.body;Jr(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!=Et&&Et.sendBeacon&&_a.push({transport:"sendBeacon",method:fa});var ga=3e3;class ma{constructor(t,e){this.Ca=!0,this.Ta=[],this.Ma=De((null==e?void 0:e.flush_interval_ms)||ga,250,5e3,Wr.createLogger("flush interval"),ga),this.Ea=t}enqueue(t){this.Ta.push(t),this.Ia||this.Ra()}unload(){this.Pa();var t=this.Ta.length>0?this.Aa():{},e=Object.values(t);[...e.filter((t=>0===t.url.indexOf("/e"))),...e.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.Fa(i({},t,{transport:"sendBeacon"}))}))}enable(){this.Ca=!1,this.Ra()}Ra(){var t=this;this.Ca||(this.Ia=setTimeout((()=>{if(this.Pa(),this.Ta.length>0){var e=this.Aa(),i=function(){var i=e[r],s=(new Date).getTime();i.data&&ce(i.data)&&Jr(i.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.Fa(i)};for(var r in e)i()}}),this.Ma))}Fa(t){try{this.Ea(t)}catch(t){Wr.error(t)}}Pa(){clearTimeout(this.Ia),this.Ia=void 0}Aa(){var t={};return Jr(this.Ta,(e=>{var r,s=e,n=(s?s.batchKey:null)||s.url;ge(t[n])&&(t[n]=i({},s,{data:[]})),null==(r=t[n].data)||r.push(s.data)})),this.Ta=[],t}}var ya=["retriesPerformedSoFar"];class ba{constructor(t){this.Oa=!1,this.La=3e3,this.Ta=[],this._instance=t,this.Ta=[],this.Da=!0,!ge(wt)&&"onLine"in wt.navigator&&(this.Da=wt.navigator.onLine,this.$a=()=>{this.Da=!0,this.Na()},this.qa=()=>{this.Da=!1},rs(wt,"online",this.$a),rs(wt,"offline",this.qa))}get length(){return this.Ta.length}retriableRequest(t){var e=t.retriesPerformedSoFar,s=r(t,ya);Ee(e)&&(s.url=oa(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.Rn(i({retriesPerformedSoFar:e},s));0===t.statusCode&&Wr.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)}}))}Rn(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.Ta.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+i;navigator.onLine||(s+=" (Browser is offline)"),Wr.warn(s),this.Oa||(this.Oa=!0,this.ja())}ja(){if(this.Ba&&clearTimeout(this.Ba),0===this.Ta.length)return this.Oa=!1,void(this.Ba=void 0);this.Ba=setTimeout((()=>{this.Da&&this.Ta.length>0&&this.Na(),this.ja()}),this.La)}Na(){var t=Date.now(),e=[],i=this.Ta.filter((i=>t>i.retryAt||(e.push(i),!1)));if(this.Ta=e,i.length>0)for(var r of i)this.retriableRequest(r.requestOptions)}unload(){for(var t of(this.Ba&&(clearTimeout(this.Ba),this.Ba=void 0),this.Oa=!1,ge(wt)||(this.$a&&(wt.removeEventListener("online",this.$a),this.$a=void 0),this.qa&&(wt.removeEventListener("offline",this.qa),this.qa=void 0)),this.Ta)){var e=t.requestOptions;try{this._instance._send_request(i({},e,{transport:"sendBeacon"}))}catch(t){Wr.error(t)}}this.Ta=[]}}class wa{constructor(t){this.Ha=()=>{var t,e,i,r;this.Ua||(this.Ua={});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.Ua.lastScrollY=Math.ceil(n),this.Ua.maxScrollY=Math.max(n,null!==(t=this.Ua.maxScrollY)&&void 0!==t?t:0),this.Ua.maxScrollHeight=Math.max(o,null!==(e=this.Ua.maxScrollHeight)&&void 0!==e?e:0),this.Ua.lastContentY=a,this.Ua.maxContentY=Math.max(a,null!==(i=this.Ua.maxContentY)&&void 0!==i?i:0),this.Ua.maxContentHeight=Math.max(l,null!==(r=this.Ua.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}get za(){return this._instance.config.scroll_root_selector}getContext(){return this.Ua}resetContext(){var t=this.Ua;return setTimeout(this.Ha,0),t}startMeasuringScrollPosition(){rs(wt,"scroll",this.Ha,{capture:!0}),rs(wt,"scrollend",this.Ha,{capture:!0}),rs(wt,"resize",this.Ha)}scrollElement(){if(!this.za)return null==wt?void 0:wt.document.documentElement;var t=ce(this.za)?this.za:[this.za];for(var e of t){var i=null==wt?void 0:wt.document.querySelector(e);if(i)return i}}Wa(t){var e="y"===t?"scrollTop":"scrollLeft";if(this.za){var i=this.scrollElement();return i&&i[e]||0}return wt?"y"===t?wt.scrollY||wt.pageYOffset||wt.document.documentElement.scrollTop||0:wt.scrollX||wt.pageXOffset||wt.document.documentElement.scrollLeft||0:0}scrollY(){return this.Wa("y")}scrollX(){return this.Wa("x")}}var xa=t=>to(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 Ea{constructor(t,e,i,r){this.st=t=>{var e=this.Va();if(!e||e.sessionId!==t){var i={sessionId:t,props:this.Ga(this._instance)};this.Za.register({[X]:i})}},this._instance=t,this.Qa=e,this.Za=i,this.Ga=r||xa,this.Qa.onSessionId(this.st)}Va(){return this.Za.props[X]}getSetOnceProps(){var t,e=null==(t=this.Va())?void 0:t.props;return e?"r"in e?eo(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 Jr(ts(this.getSetOnceProps()),((e,i)=>{"$current_url"===i&&(i="url"),t["$session_entry_"+le(i)]=e})),t}}class Sa{on(t,e){return this.Ja[t]||(this.Ja[t]=[]),this.Ja[t].push(e),()=>{this.Ja[t]=this.Ja[t].filter((t=>t!==e))}}emit(t,e){for(var i of this.Ja[t]||[])i(e);for(var r of this.Ja["*"]||[])r(t,e)}constructor(){this.Ja={}}}var ka=Gr("[SessionId]"),Ta=864e5;class $a{on(t,e){return this.Ka.on(t,e)}constructor(t,e,i){var r;if(this.Ya=null,this.Xa=null,this.eo=[],this.io=void 0,this.ro=!1,this.Ka=new Sa,this.no=(t,e)=>!(!Ee(t)||!Ee(e))&&Math.abs(t-e)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===dt)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Wi=t.config,this.Za=t.persistence,this.ut=void 0,this._e=void 0,this._sessionStartTimestamp=null,this.so=void 0,this._sessionActivityTimestamp=null,this.ao=e||ds,this.oo=i||ds;var s=this.Wi.persistence_name||this.Wi.token;if(this._sessionTimeoutMs=1e3*De(this.Wi.session_idle_timeout_seconds||1800,60,36e3,ka.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.lo(),this.uo="ph_"+s+"_window_id",this.ho="ph_"+s+"_primary_window_exists",this.do()){var n=Os.zr(this.uo),o=Os.zr(this.ho);n&&!o?this.ut=n:Os.$r(this.uo),Os.Hr(this.ho,!0)}null!=(r=this.Wi.bootstrap)&&r.sessionID&&this.setBootstrapSessionId(this.Wi.bootstrap.sessionID),this.vo()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return ge(this.eo)&&(this.eo=[]),this.eo.push(t),this._e&&t(this._e,this.ut),()=>{this.eo=this.eo.filter((e=>e!==t))}}do(){return"memory"!==this.Wi.persistence&&!this.Za.Zs&&Os.Br()}co(t){t!==this.ut&&(this.ut=t,this.do()&&Os.Hr(this.uo,t))}fo(){return this.ut?this.ut:this.do()?Os.zr(this.uo):null}po(t){var e=this.Ya;return!be(e)&&!be(t)&&5e3>Math.abs(t-e)}mo(t,e,i){var r=e!==this._sessionActivityTimestamp,s=!(t!==this._e||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=e,this._e=t,s&&!r||s&&this.po(e)||(this.Ya=e,this.Za.register({[T]:[e,t,i]}))}yo(){var t,e=null==(t=this.Wi)?void 0:t.persistence_save_debounce_ms;return Ee(e)&&e>0}bo(){this.yo()?this.Za.refreshKey(T):(this.Za.flush(),this.Za.load())}_o(){var t;if(!be(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Ya){this.bo();var e=this.wo();e[1]===this._e&&e[2]===this._sessionStartTimestamp&&(this.Ya=this._sessionActivityTimestamp,this.Za.register({[T]:[this._sessionActivityTimestamp,null!==(t=this._e)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.Za.flush())}}ko(){var t=this.wo()[0],e=Ee(t)?t:0,i=Ee(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(e,i)}So(t){return this.bo(),this.no(t,this.ko())}wo(){var t=this.Za.props[T];return ce(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Ya=null,this.so=void 0,clearTimeout(this.xo),this.xo=void 0,this.mo(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 ka.error("Bootstrap sessionID cannot be in the future"):i}catch(t){return void ka.error("Invalid sessionID in bootstrap",t)}}(t);return!ge(i)&&(e?this.so={sessionId:t,sessionStartTimestamp:i}:this.mo(t,(new Date).getTime(),i),!0)}destroy(){this.ro=!0,this._o(),clearTimeout(this.xo),this.xo=void 0,this.io&&wt&&(wt.removeEventListener(_t,this.io,{capture:!1}),this.io=void 0),this.eo=[]}vo(){this.io=()=>{this._o(),this.do()&&Os.$r(this.ho)},rs(wt,_t,this.io,{capture:!1})}checkAndGetSessionAndWindowId(t,e,i){if(void 0===t&&(t=!1),void 0===e&&(e=null),void 0===i&&(i=!1),this.Wi.cookieless_mode===dt)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=e||(new Date).getTime(),s=this._e;if(i)this.Xa=r;else if(be(this.Xa)||this.Xa>r||r-this.Xa>=1e3){var n,o;null==(n=(o=this.Za).syncCookieProperties)||n.call(o),this.Xa=r}var a=this.wo(),l=a[1],h=a[2],u=!ge(s)&&l!==s,d=this.ko(),v=this.fo(),c=this.so,f=!!c&&(c.sessionStartTimestamp>r+6e4||r-c.sessionStartTimestamp>Ta),p=c?f:Ee(h)&&Math.abs(r-h)>Ta,_=!1,g=u,m=!l||!!c,y=l,b=!m&&!t&&this.no(r,d);if(b){(b=this.So(r))||ka.info("cross-tab refresh kept the session alive",{sessionId:l});var w=this.wo();l=w[1],h=w[2]}if(m||b||p){g=!1;var x=c&&!f;l=x?c.sessionId:this.ao(),v=this.oo(),ka.info("new session ID assigned",{sessionId:l,windowId:v,bootstrapped:!!x,changeReason:{noSessionId:m,activityTimeout:b,sessionPastMaximumLength:p}}),h=x?c.sessionStartTimestamp:r,this.so=void 0,_=!0}else v||(v=this.oo(),_=!0),(g=g||l!==y)&&(ka.info("adopted cross-tab session id",{sessionId:l,windowId:v}),_=!0);var E=Ee(d)&&t&&!p?d:r,S=Ee(h)?h:(new Date).getTime();this.co(v),this.mo(l,E,S),t||this.lo();var k={noSessionId:m,activityTimeout:b,sessionPastMaximumLength:p,crossTabAdoption:g};return _&&this.eo.forEach((t=>t(l,v,k))),{sessionId:l,windowId:v,sessionStartTimestamp:S,changeReason:_?k:void 0,lastActivityTimestamp:d}}lo(){this.ro||(clearTimeout(this.xo),this.xo=setTimeout((()=>{if(!this.ro)if(this.So((new Date).getTime())){var t=this._e;this.resetSessionId(),this.Ka.emit("forcedIdleReset",{idleSessionId:t})}else this.lo()}),1.1*this.sessionTimeoutMs))}}var Pa=function(t,e){if(!t)return!1;var i=t.userAgent;if(i&&ne(i,e))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>ne(null==t?void 0:t.brand,e))))return!0}catch(t){}return!!t.webdriver};function Ra(){return(Ra=e((function*(){var t=null==Et?void 0:Et.userAgentData;if(null!=t&&t.getHighEntropyValues)try{var e=yield t.getHighEntropyValues(["model"]),i=null==e?void 0:e.model;return me(i)&&i.length>0?i:void 0}catch(t){return void Wr.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}}))).apply(this,arguments)}function Ca(t){var e;return!(null==(e=t.conditions)||null==(e=e.events)||null==(e=e.values)||!e.length)}var Oa=(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}},Ia=t=>t.toLowerCase(),Aa={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=>Oa(e,t))))),not_regex:(t,e)=>e.every((e=>t.every((t=>!Oa(e,t))))),icontains:(t,e)=>e.map(Ia).some((e=>t.map(Ia).some((t=>e.includes(t))))),not_icontains:(t,e)=>e.map(Ia).every((e=>t.map(Ia).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 Fa(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=Aa[i.operator];return!!s&&s(i.values,[String(r)])}))}function Ma(t,e,i){return Dn({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}var Da="custom",Na="i.posthog.com",La=/^\/static\//,Ua=["/s/","/e/","/i/"];class ja{constructor(t){this.Co={},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("."+Na,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}get region(){return this.Co[this.apiHost]||(this.Co[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":Da),this.Co[this.apiHost]}To(t){if(La.test(t)){var e=this.instance.config.asset_host;if("string"==typeof e)return e.trim().replace(/\/$/,"")||void 0}}Mo(t){var e=Nn(t);return e?e.protocol+"//"+e.host+e.pathname:void 0}Eo(t,e,i){if("ui"===t)return i;var r=i,s=this.instance.config.rewriteRequestPath;if(s){var n,o=(null==(n=Nn(i))?void 0:n.href)||i;r=s(new URL(o)).toString()}if(s&&"api"===t&&Ua.some((t=>0===e.indexOf(t)))){var a=this.Mo(r);if(a){var l,h=this.apiHost,u=this.Io;(null==(l=u)?void 0:l.apiHost)===h&&u.rewriteRequestPath===s||(u={apiHost:h,rewriteRequestPath:s,urls:new Set},this.Io=u),u.urls.add(a)}}return r}isIngestionEndpoint(t){var e=this.Io,i=this.Mo(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.Eo(t,e,this.uiHost+e);if("flags"===t)return this.Eo(t,e,this.flagsApiHost+e);if("assets"===t){var i=this.To(e);if(i)return this.Eo(t,e,""+i+e)}if(this.region===Da)return this.Eo(t,e,this.apiHost+e);var r=Na+e;switch(t){case"assets":return this.Eo(t,e,"https://"+this.region+"-assets."+r);case"api":return this.Eo(t,e,"https://"+this.region+"."+r)}}}var Ba=Gr("[Surveys]"),za="seenSurvey_",qa=t=>{try{var e=(t=>((t,e)=>""+za+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){Ba.error("Failed to persist survey seen state",t)}},Ha=[fo.Popover,fo.Widget,fo.API],Va={ignoreConditions:!1,ignoreDelay:!1,displayType:go.Popover},Wa=Gr("[PostHog ExternalIntegrations]"),Ga={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Ka{constructor(t){this._instance=t}Ts(t,e){var i;null==(i=At.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,t,(t=>{if(t)return Wa.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=At.__PosthogExtensions__)&&null!=(e=e.integrations)&&e[n]||t.Ts(Ga[n],(()=>{var e;null==(e=At.__PosthogExtensions__)||null==(e=e.integrations)||null==(e=e[n])||e.start(t._instance)})),!o&&null!=(r=At.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[n]&&(null==(s=At.__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 Ja{constructor(t,e){this.I=t,this.ds=e,this.Ro=new Map,this.os=!1}add(t){var i=this;return e((function*(){if(i.os)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(i.Ro.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');i.Ro.set(t.name,t);try{var e=t.setup(i.ds);e&&(yield e)}catch(e){var r=i.Ro.get(t.name)===t;r&&i.Ro.delete(t.name),i.I.error('Failed to set up browser extension "'+t.name+'"',e),r&&i.Po(t)}}))()}getExtension(t){return this.Ro.get(t)}dispose(){if(!this.os){this.os=!0;var t=Array.from(this.Ro.values()).reverse();for(var e of(this.Ro.clear(),t))this.Po(e)}}Po(t){try{var e=null==t.dispose?void 0:t.dispose();e&&fe(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 Ya{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);ge(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 Qa="extensionsRemoteConfig";class Xa{constructor(t){this.os=!1,this.instance=t,this.I=Wr,this.Ao=t.Fo,this.kv=new Ya(t),this.onEvent=t=>uo(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.os)return uo((()=>{}));var e=e=>{try{t(e)}catch(t){this.I.error("Browser extension remote config listener failed",t)}},i=this.instance.Oo.on(Qa,e);return this.Ao&&e(this.Ao),uo(i)},this.Lo=new Ja(Wr.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.Lo.add(t)}getExtension(t){return this.Lo.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 uo(this.instance.Do(t))}handleRemoteConfig(t){this.os||(this.Ao=t,this.instance.Oo.emit(Qa,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?oa(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.os||(this.os=!0,this.Lo.dispose())}}var Za={},tl=0,el=()=>{},il='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',rl="Surveys module not available",sl="sanitize_properties is deprecated. Use before_send instead",nl="Invalid value for property_denylist config: ",ol=["token","distinct_id",nt],al="posthog",ll=!ia&&-1===(null==Ct?void 0:Ct.indexOf("MSIE"))&&-1===(null==Ct?void 0:Ct.indexOf("Mozilla")),hl=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},ul=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:is(null==St?void 0:St.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:el,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:kt&&me(null==kt?void 0:kt.search)&&-1!==kt.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==wt||null==(e=wt.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){Wr.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:ft,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:ga},error_tracking:{},_onCapture:el},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:en,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:hl(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))},dl=[["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"]],vl=t=>{var e={};for(var i of dl){var r=i[0],s=i[1];ge(t[r])||(e[s]=t[r])}var n=Yr({},e,t),o=t.__preview_external_dependency_versioned_paths;return ge(o)||(ge(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),me(o)&&ge(t.asset_host)&&(n.asset_host=o)),ce(t.property_blacklist)&&(ge(t.property_denylist)?n.property_denylist=t.property_blacklist:ce(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:Wr.error(nl+t.property_denylist)),n};class cl{constructor(){this.__forceAllowLocalhost=!1}get $o(){return this.__forceAllowLocalhost}set $o(t){Wr.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class fl{No(t,e){if(t){var i=this.Ro.indexOf(t);-1!==i&&this.Ro.splice(i,1)}return this.Ro.push(e),null==e.initialize||e.initialize(),e}qo(){return this.config.cookieless_mode===dt||this.config.cookieless_mode===ut&&this.consent.isRejected()}jo(){if(!this.qo()&&this.get_distinct_id()===st){var t=this.persistence;if(t){this.Bo()||t.load(!0);var e=this.get_distinct_id();if(!e||e===st){var i=this.config.get_device_id(ds());this.register({distinct_id:i,$device_id:i}),t.set_property(Q,vt)}this.Ho()}}}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 cl,this.Uo=!1,this.version=s.LIB_VERSION,this.zo=new Set,this.Wo="",this.Oo=new Sa,this.Ro=[],this.Vo=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=ul(),this.SentryIntegration=Cn,this.sentryIntegration=t=>function(t,e){var i=Rn(t,e);return{name:Pn,processEvent:t=>i(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Go=!1,this.Zo=null,this.Qo=null,this.Jo=null,this.scrollManager=new wa(this),this.pageViewManager=new On(this),this.rateLimiter=new wo(this),this.requestRouter=new ja(this),this.consent=new Is(this),this.externalIntegrations=new Ka(this);var e=null!==(t=fl.__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=me(t)?{[t]:e}:t;this.setPersonProperties(r),null==i||i({})},set_once:(t,e,i)=>{var r=me(t)?{[t]:e}:t;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",(t=>Wr.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,e,i){if(i&&i!==al){var r,s=null!==(r=Za[i])&&void 0!==r?r:new fl;return s._init(t,e,i),Za[i]=s,Za[al][i]=s,s}return this._init(t,e,i)}_init(t,e,r){var n,o;void 0===e&&(e={});var a,h=me(t)?t.trim():"";if(!h)return Wr.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=ul(e.defaults),e.debug=this.Ko(e.debug),this.Yo=e,this.Xo=[],e.person_profiles?this.Qo=e.person_profiles:e.process_person&&(this.Qo=e.process_person);var u=ul(e.defaults),d=vl(e),v=Yr({},u,d,{name:r,token:h});pe(u.rageclick)&&pe(d.rageclick)&&(v.rageclick=Yr({},u.rageclick,d.rageclick)),pe(u.session_recording)&&pe(d.session_recording)&&(v.session_recording=Yr({},u.session_recording,d.session_recording)),this.set_config(v),this.config.on_xhr_error&&Wr.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=e.disable_compression?void 0:vo.GZipJS;var c=this.Bo();if(this.persistence=new ho(this.config,c),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new ho(i({},this.config,{persistence:"sessionStorage"}),c,!1),this.Wo="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!c&&Os.Br()){var f=Os.zr(this.Wo);ce(f)&&f.forEach((t=>{me(t)&&this.zo.add(t)}))}else Os.$r(this.Wo);var p=i({},this.persistence.props),_=i({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.tl=new ma((t=>this.el(t)),this.config.request_queue_config),this.il=new ba(this),this.__request_queue=[];var g=this.qo();if(g||(this.sessionManager=new $a(this),this.sessionPropsManager=new Ea(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId(((t,e,i)=>{(null!=i&&i.activityTimeout||null!=i&&i.sessionPastMaximumLength||null!=i&&i.crossTabAdoption)&&this.rl()}))),this.nl(),this.config.__preview_deferred_init_extensions?(Wr.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.sl(g)}),0)):(Wr.info("Initializing extensions synchronously"),this.sl(g)),s.DEBUG=s.DEBUG||this.config.debug,s.DEBUG&&Wr.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(Q);if(e.bootstrap.isIdentifiedID&&null!=y&&y!==m&&b===vt)this.identify(m);else if(e.bootstrap.isIdentifiedID&&null!=y&&y!==m&&b===ct)Wr.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(ds()),x=e.bootstrap.isIdentifiedID?w:m;this.persistence.set_property(Q,e.bootstrap.isIdentifiedID?ct:vt),this.register({distinct_id:m,$device_id:x})}}if(g)this.register_once({distinct_id:st,$device_id:null},"");else if(!this.get_distinct_id()){var E=this.config.get_device_id(ds());this.register_once({distinct_id:E,$device_id:E},""),this.persistence.set_property(Q,vt)}return rs(wt,"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()||ds();t.config.get_device_id=r,i.id()&&(t.register({distinct_id:i.id(),$device_id:r()}),t.persistence.set_property(Q,ct)),e()},s=i.user();"then"in s&&fe(s.then)?s.then(r):r(s)}(t,(()=>{i.register((t=>{"undefined"!=typeof Promise&&Promise.resolve||$n.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()||($n.info("No userId set, resetting PostHog"),t.reset()),e.event.userId&&e.event.userId!==t.get_distinct_id()&&($n.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,gt),identify:t=>e(t,yt),screen:t=>e(t,"$screen")}})(t)).then((()=>{e()}))}))}(this,(()=>this.al())):this.al(),fe(this.config._onCapture)&&this.config._onCapture!==el&&(Wr.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&Wr.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 Ra.apply(this,arguments)}().then((t=>{t&&this.register({[l]:t})})).catch(el),this}ol(t){var e=t;return me(e.name)&&fe(e.setup)}ll(t,e){this.ol(t)?e.push((()=>{this.ul().add(t).catch((()=>null==t.dispose?void 0:t.dispose())).catch((e=>{Wr.error('Failed to dispose browser extension "'+t.name+'"',e)}))})):this.Ro.push(t)}nl(){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=fl.__defaultExtensionClasses)?void 0:i.featureFlags;o&&(this.featureFlags&&this.featureFlags instanceof o||(null==(r=this.hl)||r.call(this),this.hl=void 0,this.featureFlags=new o(this)),fe(this.featureFlags.onReloading)&&fe(this.featureFlags.setup)?this.hl||(this.hl=this.featureFlags.onReloading((()=>{this.Oo.emit("featureFlagsReloading",!0)})),this.ul().add(this.featureFlags)):null==(s=(n=this.featureFlags).initialize)||s.call(n))}sl(t){var e,r,s,n,o,a,l,h=performance.now(),u=i({},fl.__defaultExtensionClasses,this.config.__extensionClasses),d=[];u.exceptions&&this.Ro.push(this.exceptions=null!==(e=this.exceptions)&&void 0!==e?e:new u.exceptions(this)),u.historyAutocapture&&this.Ro.push(this.historyAutocapture=new u.historyAutocapture(this)),u.tracingHeaders&&this.Ro.push(this.tracingHeaders=new u.tracingHeaders(this)),u.siteApps&&this.Ro.push(this.siteApps=new u.siteApps(this)),u.sessionRecording&&!t&&this.Ro.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||d.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),u.autocapture&&this.ll(this.autocapture=new u.autocapture(this),d),u.surveys&&this.ll(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new u.surveys(this),d),u.logs&&this.ll(this.logs=null!==(s=this.logs)&&void 0!==s?s:new u.logs(this),d),u.metrics&&this.Ro.push(this.metrics=null!==(n=this.metrics)&&void 0!==n?n:new u.metrics(this)),u.conversations&&this.Ro.push(this.conversations=null!==(o=this.conversations)&&void 0!==o?o:new u.conversations(this)),u.productTours&&this.Ro.push(this.productTours=new u.productTours(this)),u.heatmaps&&this.Ro.push(this.heatmaps=new u.heatmaps(this)),u.webVitalsAutocapture&&this.Ro.push(this.webVitalsAutocapture=new u.webVitalsAutocapture(this)),u.exceptionObserver&&this.Ro.push(this.exceptionObserver=new u.exceptionObserver(this)),u.deadClicksAutocapture&&this.Ro.push(this.deadClicksAutocapture=new u.deadClicksAutocapture(this,kn)),u.toolbar&&this.Ro.push(this.toolbar=null!==(a=this.toolbar)&&void 0!==a?a:new u.toolbar(this)),u.experiments&&this.Ro.push(this.experiments=null!==(l=this.experiments)&&void 0!==l?l:new u.experiments(this)),this.Ro.forEach((t=>{t.initialize&&d.push((()=>{null==t.initialize||t.initialize()}))})),d.push((()=>{if(this.dl){var t=this.dl;this.dl=void 0,this.Ro.forEach((e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t)))}})),this.vl(d,h)}vl(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void setTimeout((()=>{this.vl(t,e)}),0);var i=t.shift();if(i)try{i()}catch(t){Wr.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-e);this.register_for_session({[ot]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[at]:r}),this.config.__preview_deferred_init_extensions&&Wr.info("PostHog extensions initialized ("+r+"ms)")}wa(t){var e;if(!St||!St.body)return Wr.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.wa(t)}),500);if(this.config.__preview_deferred_init_extensions&&(this.dl=t),this.Fo=t,this.compression=void 0,t.ok){var i,r=t.config;r.supportedCompression&&!this.config.disable_compression&&(this.compression=oe(r.supportedCompression,vo.GZipJS)?vo.GZipJS:oe(r.supportedCompression,vo.Base64)?vo.Base64:void 0),null!=(i=r.analytics)&&i.endpoint&&(this.analyticsDefaultEndpoint=r.analytics.endpoint)}this.set_config({person_profiles:this.Qo?this.Qo:ft}),null==(e=this.cl)||e.handleRemoteConfig(t),this.Ro.forEach((e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t)))}al(){try{this.config.loaded(this)}catch(t){Wr.critical("`loaded` function failed",t)}if(this.fl(),this.config.internal_or_test_user_hostname&&null!=kt&&kt.hostname){var t=kt.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.qo())&&this.pl()}),1),this.gl=new Eo(this),this.gl.load()}fl(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.tl)||t.enable())}_dom_loaded(){this.is_capturing()&&Kr(this.__request_queue,(t=>this.el(t))),this.__request_queue=[],this.fl()}_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.ml()&&this.capture(mt),null==(i=this.logs)||i.flushLogs("sendBeacon"),null==(r=this.tl)||r.unload(),null==(s=this.il)||s.unload()):this.ml()&&this.capture(mt,null,{transport:"sendBeacon"})}_send_request(t){var e;this.__loaded?ll?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,(ge(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&&ge(n.compression)&&n.data&&(n.compression=vo.Base64),"POST"===n.method&&n.data&&("capture-body"===n.timestampMode?n.data={api_key:null!==(a=null==(u=(h=(ce(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()),ce(t)?t.map((t=>i({},t,{sent_at:e}))):i({},t,{sent_at:e})}(n.data))),n.url=pa(n.url,n.method,n.compression,n.timestampMode);var v=_a.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){va(t)?Wr.warn(t):Wr.error(t),null==n.callback||n.callback({statusCode:0,error:t})}};"sendBeacon"!==d&&n.data&&n.compression===vo.GZipJS&&Rt&&"undefined"!=typeof Promise&&!sa?ua(n).then((t=>{f(t)})).catch((e=>{if(Wt(e))return sa=!0,void f(i({},n,{compression:void 0,url:pa(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 Wt(t)||e===qt})(e)&&(sa=!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}))}el(t){this.il?this.il.retriableRequest(t):this._send_request(t)}_execute_array(t){tl++;try{var e,i=[],r=[],s=[];Kr(t,(t=>{if(t)if(ce(e=t[0]))s.push(t);else if(fe(t))try{t.call(this)}catch(e){Wr.error("Error executing queued PostHog call",t,e)}else ce(t)&&"alias"===e?i.push(t):ce(t)&&-1!==e.indexOf("capture")&&fe(this[e])?s.push(t):r.push(t)}));var n=function(t,e){Kr(t,(function(t){try{if(ce(t[0])){var i=e;Jr(t,(function(t){i=i[t[0]].apply(i,t.slice(1))}))}else e[t[0]].apply(e,t.slice(1))}catch(e){Wr.error("Error executing queued PostHog call",t,e)}}))};n(i,this),n(r,this),n(s,this)}finally{tl--}}push(t){if(tl>0&&ce(t)&&me(t[0])){var e=fl.prototype[t[0]];fe(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.tl){if(this.is_capturing())if(!ge(t)&&me(t)){this.jo();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&&!me(null==e?void 0:e.$current_url)&&(Wr.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.yl||Wr.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=qi(null==r?void 0:r.uuid,ds),f={uuid:c,event:t,properties:this.calculateEventProperties(t,e||{},v,c)};t===gt&&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(M);(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!==bt,t===yt);if(b&&(f.$set_once=b),null!=r&&r._noTruncate||(n=this.config.properties_string_max_length,o=f,a=t=>me(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),ce(e))r=[],Kr(e,(e=>{r.push(t(e))}));else{var s={};Jr(e,((e,i)=>{l.has(e)||(s[i]=t(e,i))})),r=s}return r}}(o)),f.timestamp=v,ge(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,ol)),t===po.DISMISSED||t===po.SENT){var w=null==e?void 0:e[_o.SURVEY_ID],x=null==e?void 0:e[_o.SURVEY_ITERATION];qa({id:w,current_iteration:x}),f.$set=i({},f.$set,{[(g={id:w,current_iteration:x},m=t===po.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===po.SHOWN&&(f.$set=i({},f.$set,{[_o.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(t===mo.SHOWN){var E=null==e?void 0:e[yo.TOUR_TYPE];E&&(f.$set=i({},f.$set,{[yo.TOUR_LAST_SEEN_DATE+"/"+E]:(new Date).toISOString()}))}var S=i({},f.properties.$set,f.$set);if(_e(S)||this.setPersonPropertiesForFlags(S),!we(this.config.before_send)){var k=this.En(f);if(!k)return;(f=k).uuid=qi(f.uuid,ds)}this.Oo.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.el(P):this.tl.enqueue(P),f}Wr.critical("This capture call is ignored due to client rate limiting.")}}else Wr.error("No event name provided to posthog.capture")}else Wr.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(e=>t(e.event,e)))}getExtension(t){var e;return null==(e=this.cl)?void 0:e.getExtension(t)}ul(){var t;return null!==(t=this.cl)&&void 0!==t?t:this.cl=new Xa(this)}Do(t){this.Vo.push(t);var e=!0;return()=>{if(e){e=!1;var i=this.Vo.indexOf(t);-1!==i&&this.Vo.splice(i,1)}}}_l(t){var e,i,r;return void 0===t&&(t=!0),!(null==(e=this.persistence)||!e.consumeCookieIdentityChange())&&(this.Jo=null,this.persistence.get_property(Q)===vt&&(null==(r=this.sessionPersistence)||r.clear(),this.zo.clear(),this.wl()),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._l();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.qo()&&(l[nt]=!0),"$snapshot"===t){var h=i({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=h.distinct_id,(!me(l.distinct_id)&&!xe(l.distinct_id)||ye(l.distinct_id))&&Wr.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),!Ct)return{};var h,u=t?[...Hn,...e||[]]:[],d=function(t){for(var e=0;ji.length>e;e++){var i=ji[e],r=i[1],s=i[0].exec(t),n=s&&(fe(r)?r(s,t):r);if(n)return n}return["",""]}(Ct),v=d[0],c=d[1],f=null!=(h="undefined"!=typeof navigator?navigator:void 0)&&h.brave?{brave:!0}:{},p={};ge(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==wt||null==(a=wt.screen)?void 0:a.width,b=null==wt||null==(l=wt.screen)?void 0:l.height,w=null==wt?void 0:wt.devicePixelRatio;ge(g)||(_.userAgentDataPlatform=g),ge(m)||(_.maxTouchPoints=m),ge(y)||(_.screenWidth=y),ge(b)||(_.screenHeight=b),ge(w)||(_.devicePixelRatio=w);var x,E,S,k,T,P,R,C,O=Yr(ts({$os:v,$os_version:c,$browser:Ni(Ct,navigator.vendor,f,p),$device:Bi(Ct),$device_type:(E=Ct,S=_,C=Bi(E),C===qe||C===ze||"Kobo"===C||"Kindle Fire"===C||C===yi?Be:C===li||C===ui||C===hi||C===_i?"Console":C===Ve?"Wearable":C?Le:"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)?Le:Be:"Desktop"),$timezone:io(),$timezone_offset:ro()}),{$current_url:Un(r?Hi(null==kt?void 0:kt.href):null==kt?void 0:kt.href,u,Wn),$host:null==kt?void 0:kt.host,$pathname:null==kt?void 0:kt.pathname,$raw_user_agent:Ct.length>1e3?Ct.substring(0,997)+"...":Ct,$browser_version:Ui(Ct,navigator.vendor,f,p),$browser_language:Qn(),$browser_language_prefix:(x=Qn(),"string"==typeof x?x.split("-")[0]:void 0),$screen_height:null==wt?void 0:wt.screen.height,$screen_width:null==wt?void 0:wt.screen.width,$viewport_height:null==wt?void 0:wt.innerHeight,$viewport_width:null==wt?void 0:wt.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&&Yr(l,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&Yr(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=null==(f=this.il)?void 0:f.length}catch(t){l.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===Da&&(l.$lib_custom_api_host=this.config.api_host),u=t!==gt||o?t!==mt||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,n),l=Yr(l,u),t===gt&&St&&(l.title=St.title),!ge(a)){var p=r.getTime()-a;l.$duration=parseFloat((p/1e3).toFixed(3))}Ct&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser");var _=this.persistence.properties(),g=this.sessionPersistence.properties();Jr(["$referrer","$referring_domain"],(t=>{t in _&&delete g[t]}));var m={};if(this.Vo.length>0)for(var y of this.Vo.slice())try{Yr(m,y())}catch(t){Wr.error("Failed to produce browser extension event properties",t)}(l=Yr({},d,_,g,i({},m,l))).$is_identified=this._isIdentified(),ce(this.config.property_denylist)?Jr(this.config.property_denylist,(function(t){delete l[t]})):Wr.error(nl+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var b=this.config.sanitize_properties;b&&(Wr.error(sl),l=b(l,t));var w=this.kl();return l.$process_person_profile=w,w&&!o&&this.Sl("_calculate_event_properties"),l}bl(t,e,i){var r;if(void 0===e&&(e=!0),void 0===i&&(i=!1),!this.persistence||!this.kl())return t;if(this.Uo&&!i)return t;var s=this.persistence.get_initial_props(),n=null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps(),o=Yr({},s,n||{},t||{}),a=this.config.sanitize_properties;return a&&(Wr.error(sl),o=a(o,"$set_once")),e&&(this.Uo=!0),_e(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._l(),null==(i=this.sessionPersistence)||i.register(t),Object.keys(t).forEach((t=>this.zo.add(t))),this.wl()}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.zo.delete(t),this.wl()}xl(t,e){this.register({[t]:e})}rl(){this.zo.forEach((t=>{var e;null==(e=this.sessionPersistence)||e.unregister(t)})),this.zo.clear(),this.wl()}wl(){var t;if(this.Wo)if("memory"===this.config.persistence||null!=(t=this.sessionPersistence)&&t.Zs||!Os.Br())Os.$r(this.Wo);else{var e=[];this.zo.forEach((t=>e.push(t))),e.length>0?Os.Hr(this.Wo,e):Os.$r(this.Wo)}}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.Oo.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:rl}),()=>{})}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:rl})}getActiveMatchingSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:rl})}renderSurvey(t,e){var i;null==(i=this.surveys)||i.renderSurvey(t,e)}displaySurvey(t,e){var i;void 0===e&&(e=Va),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:rl}}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:rl})}Cl(t){return!t||ye(t)?(Wr.critical("Unique user id has not been set in posthog.identify"),!1):t===st?(Wr.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())||(Wr.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 Wr.uninitializedWarning("posthog.identify");if(xe(t)&&(t=t.toString(),Wr.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Cl(t)&&this.Sl("posthog.identify")){this.jo();var r=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==r,n=this._l(!1),o=this.persistence.Ks(),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(Q)||vt)===vt,c=t!==u,f=!c&&v;if(c&&v)this.persistence.set_property(Q,ct),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Ys(),this.capture(yt,{distinct_id:t,$anon_distinct_id:u},{$set:e||{},$set_once:i||{}}),this.Jo=Ma(t,e,i),null==(d=this.featureFlags)||d.setAnonymousDistinctId(u);else if(f){this.persistence.set_property(Q,ct);var p=e||{},_=i||{};this.setPersonPropertiesForFlags({$set:p,$set_once:_},!1),this.config.cookieWinsOnConflict&&this.persistence.Ys(),this.capture("$set",{$set:p,$set_once:_}),this.Jo=Ma(t,e,i)}else(e||i)&&this.setPersonProperties(e,i);c||s||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(G)):f&&(e||i)&&this.reloadFeatureFlags(),l=!0}finally{o&&this.persistence.ea(l)}}}setPersonProperties(t,e){if((t||e)&&this.Sl("posthog.setPersonProperties")){var i=Ma(this.get_distinct_id(),t,e);this.Jo!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}}),this.Jo=i):Wr.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var e,i=(ce(t)?t:[t]).filter((t=>me(t)&&t.length>0));0!==i.length&&this.Sl("posthog.unsetPersonProperties")&&(null==(e=this.featureFlags)||e.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.Jo=null)}group(t,e,r){var s;if(t&&e){null==(s=this.persistence)||s.syncCookieProperties(),this._l();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(bt,a)}r&&this.setGroupPropertiesForFlags({[t]:r}),o&&!r&&this.reloadFeatureFlags()}else Wr.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.Sl("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=Se(t)?t:null==t?void 0:t.resetDeviceID,i=Se(t)||null==t?void 0:t.bootstrap;this.Tl(e,!1,i)}Tl(t,e,r){var s,n,o;if(void 0===e&&(e=!1),Wr.info("reset"),!this.__loaded)return Wr.uninitializedWarning("posthog.reset");var h=null==r?void 0:r.sessionID;this.config.bootstrap=r||(null==(s=this.Yo)?void 0:s.bootstrap)||{},null==(n=this.featureFlags)||null==n.updateConfig||n.updateConfig(this.config,this.ka());var u=this.get_property(a),d=this.get_property(l),v=this.get_property(b),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.Ks?void 0:o.Ks(),p=!1;try{var _,g,m,y,w,x,E,S,k,T,P,R,C;if(null==(_=this.persistence)||_.clear(),null==(g=this.sessionPersistence)||g.clear(),this.zo.clear(),this.wl(),ge(v)||null==(T=this.persistence)||T.register({[b]:v}),null==(m=this.surveys)||m.reset(),null==(y=this.featureFlags)||y.reset(),null==(w=this.conversations)||w.reset(),null==(x=this.logs)||x.reset(),null==(E=this.metrics)||E.reset(),null==(S=this.persistence)||S.set_property(Q,vt),null==(k=this.sessionManager)||k.resetSessionId(),this.Jo=null,this.config.cookieless_mode===dt)this.register_once({distinct_id:st,$device_id:null},"");else{var O=this.config.get_device_id(ds());this.register_once({distinct_id:O,$device_id:t?O:u},""),t||ge(d)||this.register({[l]:d})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),r)if(void 0===r.distinctID||this.qo()||(null==(C=this.persistence)||C.set_property(Q,r.isIdentifiedID?ct:vt),this.register({distinct_id:r.distinctID})),null==(P=this.featureFlags)||P.initialize(),!(ge(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.ea||A.ea(p))}this.reloadFeatureFlags()}shutdown(t){var i=this;return e((function*(){var t,e,r,s,n;if(i.__loaded){i.ul().dispose(),null==(t=i.sessionRecording)||t.dispose(),null==(e=i.logs)||e.flushLogs("sendBeacon"),null==(r=i.metrics)||r.flush("sendBeacon"),null==(s=i.tl)||s.unload(),null==(n=i.il)||n.unload();try{var o;null==(o=i.featureFlags)||o.destroy()}catch(t){Wr.error("Error while destroying feature flags",t)}}else Wr.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.Ml()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(t=this.conversations)||t.El()}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)?(Wr.critical("Attempting to create alias for existing People user - aborting."),-2):this.Sl("posthog.alias")?(ge(e)&&(e=this.get_distinct_id()),t!==e?(this.xl(h,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(Wr.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var e=i({},this.config);if(pe(t)){var r,n,o,a,l,h,u,d,v,c,f,p;Yr(this.config,vl(t));var _=this.Bo();null==(r=this.persistence)||r.update_config(this.config,e,_),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new ho(i({},this.config,{persistence:"sessionStorage"}),_,!1);var g,m=this.Ko(this.config.debug);Se(m)&&(this.config.debug=m),Se(this.config.debug)&&(this.config.debug?(s.DEBUG=!0,gs.Br()&&gs.Hr("ph_debug",!0),Wr.info("set_config",{config:t,oldConfig:e,newConfig:i({},this.config)})):(s.DEBUG=!1,gs.Br()&&gs.$r("ph_debug"))),null==(n=this.featureFlags)||null==n.updateConfig||n.updateConfig(this.config,this.ka()),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.Ho(),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:fl.Il}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:al;return e!==al&&(e=al+"."+e),e}_isIdentified(){var t,e;return(null==(t=this.persistence)?void 0:t.get_property(Q))===ct||(null==(e=this.sessionPersistence)?void 0:e.get_property(Q))===ct}kl(){var t,e;return!("never"===this.config.person_profiles||this.config.person_profiles===ft&&!this._isIdentified()&&_e(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[h])&&(null==(e=this.persistence)||null==(e=e.props)||!e[rt]))}ml(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.kl()||this.Sl("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Sl("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Sl(t){return"never"===this.config.person_profiles?(Wr.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.xl(rt,!0),!0)}Bo(){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!==ut)}Ho(){var t,e,i,r,s=this.Bo();return(null==(t=this.persistence)?void 0:t.Zs)!==s&&(null==(i=this.persistence)||i.set_disabled(s)),(null==(e=this.sessionPersistence)?void 0:e.Zs)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s)),s&&(this.zo.clear(),this.wl()),s}opt_in_capturing(t){var e;if(this.config.cookieless_mode!==dt){if(this.qo()){var i,r,s,n,o;this.Tl(!0,!0),null==(i=this.sessionManager)||i.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new $a(this),this.pageViewManager=new On(this),this.persistence&&(this.sessionPropsManager=new Ea(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=fl.__defaultExtensionClasses)?void 0:o.sessionRecording;l&&(this.sessionRecording=this.No(this.sessionRecording,new l(this)),this.Fo&&(null==(a=this.sessionRecording)||null==a.onRemoteConfig||a.onRemoteConfig(this.Fo)))}var h,u;this.consent.optInOut(!0),this.Ho(),this.fl(),null==(e=this.sessionRecording)||e.startIfEnabledOrStop(),this.config.cookieless_mode==ut&&(null==(h=this.surveys)||h.loadIfEnabled()),(ge(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.pl()}else Wr.warn(il)}opt_out_capturing(){var t,e,i;this.config.cookieless_mode!==dt?(this.config.cookieless_mode===ut&&this.consent.isOptedIn()&&this.Tl(!0,!0),this.consent.optInOut(!1),this.Ho(),this.config.cookieless_mode===ut&&(this.register({distinct_id:st,$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.pl(),this.fl())):Wr.warn(il)}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===dt||(this.config.cookieless_mode===ut?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Ho()}_is_bot(){return Et?Pa(Et,this.config.custom_blocked_useragents):void 0}pl(){St&&("visible"===St.visibilityState?this.Go||(this.Go=!0,this.capture(gt,{title:St.title},{send_instantly:!0}),this.Zo&&(St.removeEventListener(pt,this.Zo),this.Zo=null)):this.Zo||(this.Zo=this.pl.bind(this),rs(St,pt,this.Zo)))}debug(t){!1===t?(null==wt||wt.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==wt||wt.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}))}ka(){var t=this.Yo||{};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?(Wr.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&&!we(t[e]),o=i in t&&!we(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,Wr)}En(t){var e;if(we(this.config.before_send))return t;var i=Object.keys(null!==(e=t.properties)&&void 0!==e?e:{}).filter($e),r=ce(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var n of r)try{if(s=n(s),we(s)){var o="Event '"+t.event+"' was rejected in beforeSend function";return Te(t.event)?Wr.warn(o+". This can cause unexpected behavior."):Wr.info(o),null}s.properties&&!_e(s.properties)||Wr.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}catch(e){return Wr.error("Error in beforeSend function for event '"+t.event+"':",e),null}for(var a of i)if(s.properties&&we(s.properties[a]))return Wr.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.Is)?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)})}Ko(t){var e=Se(t)&&!t,i=gs.Br()&&"true"===gs.Ur("ph_debug");return!e&&(!!i||t)}}fl.__defaultExtensionClasses={},fl.Il=(()=>{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]]=Zr(t.prototype[e[i]])}(fl,["identify"]);class pl{constructor(t){this.disabled=!1===t;var e=pe(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 _l="$copy_autocapture",gl=Gr("[AutoCapture]");function ml(t,e){return e.length>t?e.slice(0,t)+"...":e}function yl(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do{e=e.previousSibling}while(e&&!Us(e));return e}function bl(t,e){var r,s,n=e.e,o=e.maskAllElementAttributes,a=e.maskAllText,l=e.elementAttributeIgnoreList,h=e.elementsChainAsString,u=e.disableCaptureUrlHashes;if(!Us(t))return{props:{}};for(var d=[t],v=new Set([t]),c=t;c.parentNode&&!js(c,"body")&&qs>d.length;)if(zs(c.parentNode)){var f=c.parentNode.host;if(v.has(f))break;v.add(f),d.push(f),c=f}else{if(!Us(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(Jr(d,(t=>{var e=hn(t);if(js(t,"a")){var i=t.getAttribute("href");y=!!(e&&i&&mn(i))&&(u?Hi(i):i)}oe(Ws(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};Ys.indexOf(n)>-1&&!i&&(o.$el_text="a"===n.toLowerCase()||"button"===n.toLowerCase()?ml(1024,yn(t)):ml(1024,Ks(t)));var a=Ws(t);a.length>0&&(o.classes=a.filter((function(t){return""!==t}))),Jr(t.attributes,(function(i){var n;if((!un(t)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==r||!r.includes(i.name))&&!e&&mn(i.value)&&(!me(n=i.name)||"_ngcontent"!==n.substring(0,10)&&"_nghost"!==n.substring(0,7))){var a=i.value;"class"===i.name&&(a=Hs(a).join(" ")),o["attr__"+i.name]=ml(1024,"href"===i.name&&s?Hi(a):a)}}));for(var l=1,h=1,u=t;u=yl(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(!hn(t))return{};var e={};return Jr(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&&mn(r)&&(e[i]=r)}})),e}(t);Yr(m,r)})),b)return{props:{},explicitNoCapture:b};if(a||(g[0].$el_text=js(t,"a")||js(t,"button")?yn(t):Ks(t)),y){var w,x;g[0].attr__href=y;var E=null==(w=Nn(y))?void 0:w.host,S=null==wt||null==(x=wt.location)?void 0:x.host;E&&S&&E!==S&&(p=y)}return{props:Yr({$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 Qr(o).sort(((t,e)=>t[0].localeCompare(e[0]))).forEach((t=>{var e=t[1];return a[wn(t[0].toString())]=wn(e.toString())})),(s+=":")+Qr(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:xn(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Qr(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 wl{constructor(t){this.name="autocapture",this.es=!1,this.rs=null,this.ns=!1,this.ss=!1,this.Wi={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.os=!1,this.ls=t,this.ls.refresh(this.Wi),this.rageclicks=new pl(this.Wi.rageclick),this.us=null}setup(t){this.hs(),this.ds=t;var e=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.os?e.dispose():(this.vs=e,this.startIfEnabled())}dispose(){var t;this.os||(this.os=!0,this.ds=void 0,null==(t=this.vs)||t.dispose(),this.vs=void 0,this.cs())}fs(){return this.ls.refresh(this.Wi),this.Wi}hs(){var t,e;return this.fs(),this.Wi.url_allowlist=null==(t=this.Wi.url_allowlist)?void 0:t.map((t=>new RegExp(t))),this.Wi.url_ignorelist=null==(e=this.Wi.url_ignorelist)?void 0:e.map((t=>new RegExp(t))),this.Wi}ps(){if(this.isBrowserSupported()){if(wt&&St){var t=this.gs=t=>{t=t||(null==wt?void 0:wt.event);try{this.ys(t)}catch(t){gl.error("Failed to capture event",t)}};if(rs(St,"submit",t,{capture:!0}),rs(St,"change",t,{capture:!0}),rs(St,"click",t,{capture:!0}),this.fs().capture_copied_text){var e=this.bs=t=>{t=t||(null==wt?void 0:wt.event);try{this.ys(t,_l)}catch(t){gl.error("Failed to capture clipboard event",t)}};rs(St,"copy",e,{capture:!0}),rs(St,"cut",e,{capture:!0}),rs(St,"paste",e,{capture:!0})}}}else gl.info("Disabling Automatic Event Collection because this browser is not supported")}cs(){this.gs&&(null==St||St.removeEventListener("submit",this.gs,!0),null==St||St.removeEventListener("change",this.gs,!0),null==St||St.removeEventListener("click",this.gs,!0),this.gs=void 0),this.bs&&(null==St||St.removeEventListener("copy",this.bs,!0),null==St||St.removeEventListener("cut",this.bs,!0),null==St||St.removeEventListener("paste",this.bs,!0),this.bs=void 0),this.es=!1}startIfEnabled(){!this.os&&this.ds&&this.isEnabled&&!this.es&&(this.ps(),this.es=!0)}onRemoteConfig(t){if(!this.os)if(this.ns=!0,t.ok){var e=t.config;e.elementsChainAsString&&(this.ss=e.elementsChainAsString);var i,r=e.autocapture_opt_out;Se(r)&&(null==(i=this.ds)||i.kv.set(d,r),this.rs=r),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(t){this.us=t}getElementSelectors(t){var e,i=[];return null==(e=this.us)||e.forEach((e=>{var r=null==St?void 0:St.querySelectorAll(e);null==r||r.forEach((r=>{t===r&&i.push(e)}))})),i}get isEnabled(){var t,e;if(this.os)return!1;var i=null==(t=this.ds)?void 0:t.kv.get(d),r=this.rs,s=this.fs(),n=s.remoteRequestsDisabled&&!this.ns;if(be(r)&&!Se(i)&&!n)return!1;var o=null!==(e=this.rs)&&void 0!==e?e:!!i;return!!s.enabled&&!o}ys(t,e){if(void 0===e&&(e="$autocapture"),this.isEnabled){var r=Js(t);Bs(r)&&(r=r.parentNode||null);var s,n=this.hs();"$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())&&on(r,n.rageclick)&&this.ys(t,"$rageclick");var o=e===_l,a=o?i({},n,{dom_event_allowlist:void 0}):n;if(r&&function(t,e,i,r,s,n){var o;if(!wt||an(t))return!1;if(null!=i&&i.url_allowlist&&!Vs(i.url_allowlist,n))return!1;if(null!=i&&i.url_ignorelist&&Vs(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=ln(t,r),h=l.parentIsUsefulElement,u=l.targetElementList;if(!function(t,e){var i=null==e?void 0:e.element_allowlist;if(ge(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(!Qs(u,null==i?void 0:i.css_selector_allowlist))return!1;if(Qs(u,null!==(o=null==i?void 0:i.css_selector_ignorelist)&&void 0!==o?o:Zs))return!1;try{var d=wt.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&&(Ys.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=bl(r,{e:t,maskAllElementAttributes:n.maskAllElementAttributes,maskAllText:n.maskAllText,elementAttributeIgnoreList:n.element_attribute_ignorelist,elementsChainAsString:this.ss,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===_l){var v=t.type||"clipboard";if("paste"!==v){var c,f,p=null==wt||null==(c=wt.getSelection())?void 0:c.toString(),_=Gs(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.ds)||l.capture(e,u).catch((t=>gl.error("Failed to capture event",t))),!0}}}isBrowserSupported(){return fe(null==St?void 0:St.querySelectorAll)}}class xl{constructor(t){this._instance=t}refresh(t){var e=this._instance.config,i=pe(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.ka(),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 El=Gr("[ExceptionAutocapture]"),Sl=()=>{},kl=Gr("[TracingHeaders]"),Tl=Gr("[Web Vitals]"),$l=9e5,Pl=["CLS","FCP","INP","LCP"],Rl=["INP","LCP"],Cl=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],Ol="disabled",Il="lazy_loading",Al="awaiting_config",Fl="missing_config";Gr("[SessionRecording]"),Gr("[SessionRecording]");var Ml="[SessionRecording]",Dl=Gr(Ml),Nl=Gr("[Heatmaps]");function Ll(t){return pe(t)&&"clientX"in t&&"clientY"in t&&xe(t.clientX)&&xe(t.clientY)}var Ul=Gr("[Product Tours]"),jl=t=>{var e;return!t.config.disable_product_tours&&!(null==(e=t.persistence)||!e.get_property(m))},Bl=["$set_once","$set"],zl=Gr("[SiteApps]"),ql="Error while initializing PostHog app with config id ",Hl=(t,e)=>null!=t&&t.then?t.then(e):e(t),Vl="SDK is not enabled or survey functionality is not yet loaded",Wl="Disabled. Not loading surveys.";class Gl{constructor(t,e){this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Rl=!1,this.Pl=[],this.Al=null,this.Fl=null,this.os=!1,this.Ol=new Set,this.onRemoteConfig=t=>{if(!this.os&&!this.Wi.disableSurveys){if(!t.ok)return Ba.warn("Remote config unavailable. Not loading surveys.");var e=t.config.surveys;if(we(e))return Ba.warn("Flags not loaded yet. Not loading surveys.");this.Ll=Se(e)?e:e.length>0,Ba.info("flags response received, isSurveysEnabled: "+this.Ll),this.loadIfEnabled()}},this.ls=t,this.Dl=e}setup(t){if(!this.os)return this.$l=t,Hl(t.kv.initialize(),(()=>{if(this.$l===t&&!this.os){this.$l=void 0,this.ds=t;var e=t.onRemoteConfig(this.onRemoteConfig);this.os?e.dispose():(this.vs=e,this.loadIfEnabled())}}))}dispose(){var t,e,i;this.os||(this.os=!0,this.$l=void 0,this.ds=void 0,null==(t=this.vs)||t.dispose(),this.vs=void 0,null==(e=this._surveyEventReceiver)||e.dispose(),this._surveyEventReceiver=null,null==(i=this._surveyManager)||null==i.dispose||i.dispose(),this._surveyManager=null,this.Pl=[],this.Al=null,this.Ol.forEach((t=>clearTimeout(t))),this.Ol.clear())}get Wi(){return this.ls.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(za)||null!=r&&r.startsWith("inProgressSurvey_"))&&e.push(r)}e.forEach((t=>localStorage.removeItem(t)))}catch(t){}}loadIfEnabled(){if(!this.os&&this.ds){var t=this.Wi;if(!this._surveyManager)if(this.Rl)Ba.info("Already initializing surveys, skipping...");else if(t.disableSurveys)Ba.info(Wl);else if(t.cookielessMode&&this.ls.isOptedOut())Ba.info("Not loading surveys in cookieless mode without consent.");else{var e=this.ls.getExtensions();if(e){if(!ge(this.Ll)||t.advancedEnableSurveys){var i=this.Ll||t.advancedEnableSurveys;this.Rl=!0;try{var r=e.generateSurveys;if(r)return this.Nl(r,i),void(this.Rl=!1);var s=e.loadExternalDependency;if(!s)return this.ql(ht),void(this.Rl=!1);s((t=>{try{if(this.os)return;var e=this.ls.getExtensions();t||null==e||!e.generateSurveys?this.ql("Could not load surveys script",t):this.Nl(e.generateSurveys,i)}finally{this.Rl=!1}}))}catch(t){throw this.Rl=!1,this.ql("Error initializing surveys",t),t}}}else Ba.error("PostHog Extensions not found.")}}}Nl(t,e){this.os||(this._surveyManager=t(e),this._surveyEventReceiver=this.ls.createEventReceiver(),Ba.info("Surveys loaded successfully"),this.jl({isLoaded:!0}))}ql(t,e){Ba.error(t,e),this.jl({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.Pl.push(t),this._surveyManager&&this.jl({isLoaded:!0}),()=>{this.Pl=this.Pl.filter((e=>e!==t))}}getSurveys(t,e){var i;void 0===e&&(e=!1);var r=null!==(i=this.ds)&&void 0!==i?i:this.Dl;if(r&&!this.os){if(this.Wi.disableSurveys)return Ba.info(Wl),t([]);var s=r.kv.get(B);if(s&&!e)return t(s,{isLoaded:!0}),void(this.Bl()&&this.getSurveys((()=>{}),!0));if(this.Al)this.Al.then((e=>{this.os||t(e.surveys,e.context)})).catch((t=>Ba.error("Error in survey callback",t)));else{var n=this.Hl("/api/surveys/",{method:"GET",query:{token:r.projectToken},sentAt:"query",timeoutMs:this.Wi.requestTimeoutMs}).then((t=>{try{return this.Ul(r,t)}catch(t){return Ba.error("Error processing surveys response",t),this.Ul(r,{statusCode:0,error:t})}}),(t=>this.Ul(r,{statusCode:0,error:t})));this.Al=n;var o=()=>{this.Al===n&&(this.Al=null)};n.then((e=>{o(),this.os||t(e.surveys,e.context)}),o).catch((t=>Ba.error("Error in survey callback",t)))}}}Hl(t,e){var i=this.ds;return i?i.sendRequest(t,e):new Promise((t=>t({statusCode:0,error:new Error(Vl)})))}Ul(t,e){if(this.os)return{surveys:[],context:{isLoaded:!1,error:Vl}};var i=e.statusCode;if(200!==i||!e.json){var r="Surveys API could not be loaded, status: "+i;return 0!==i?Ba.error(r):e.error||Ba.warn(r),this.Fl=Date.now(),{surveys:[],context:{isLoaded:!1,error:r}}}this.Fl=null;var s,n=e.json.surveys||[],o=n.filter((t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(Ca(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({[B]:n,[z]:Date.now()}),{surveys:n,context:{isLoaded:!0}}}Bl(){return this.zl()&&!this.Al&&!this.Wl()}zl(){var t,e,i=null==(t=null!==(e=this.ds)&&void 0!==e?e:this.Dl)?void 0:t.kv.get(z);return xe(i)&&Date.now()-i>3e5}Wl(){return xe(this.Fl)&&3e5>Date.now()-this.Fl}markSurveyAsSeen(t,e){var i,r={id:t,current_iteration:null!==(i=null==e?void 0:e.iteration)&&void 0!==i?i:null};qa(r);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}}jl(t){for(var e of this.Pl)try{if(!t.isLoaded)return e([],t);this.getSurveys(e)}catch(t){Ba.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,e){if(void 0===e&&(e=!1),!we(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);Ba.warn("init was not called")}Vl(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}Gl(t){if(we(this._surveyManager))return{eligible:!1,reason:Vl};var e="string"==typeof t?this.Vl(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}Zl(t){if(we(this._surveyManager))return{eligible:!1,reason:Vl};var e="string"==typeof t?this.Vl(t):t;return e?this._surveyManager.checkSurveyRenderability(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(we(this._surveyManager))return Ba.warn("init was not called"),{visible:!1,disabledReason:Vl};var e=this.Zl(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return we(this._surveyManager)?(Ba.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Vl})):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.Zl(s);i({visible:n.eligible,disabledReason:n.reason})}else i({visible:!1,disabledReason:"Survey not found"})}),e)}))}renderSurvey(t,e,i){var r;if(we(this._surveyManager))Ba.warn("init was not called");else{var s="string"==typeof t?this.Vl(t):t;if(null!=s&&s.id)if(Ha.includes(s.type)){var n=null==St?void 0:St.querySelector(e);if(n)if(null!=(r=s.appearance)&&r.surveyPopupDelaySeconds){Ba.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds");var o=setTimeout((()=>{var t,e;this.Ol.delete(o),this.os||(Ba.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),Ba.info("Survey "+s.id+" rendered"))}),1e3*s.appearance.surveyPopupDelaySeconds);this.Ol.add(o)}else this._surveyManager.renderSurvey(s,n,i);else Ba.warn("Survey element not found")}else Ba.warn("Surveys of type "+s.type+" cannot be rendered in the app");else Ba.warn("Survey not found")}}displaySurvey(t,e){var r;if(we(this._surveyManager))Ba.warn("init was not called");else{var s=this.Vl(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!==go.Popover&&e.initialResponses&&Ba.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===e.ignoreConditions){var o=this.Gl(s);if(!o.eligible)return void Ba.warn("Survey is not eligible to be displayed: ",o.reason)}e.displayType!==go.Inline?this._surveyManager.handlePopoverSurvey(n,e):this.renderSurvey(n,e.selector,e.properties)}else Ba.warn("Survey not found")}}cancelPendingSurvey(t){we(this._surveyManager)?Ba.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||null==t.handlePageUnload||t.handlePageUnload()}}function Kl(t,e,i){if(we(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 Jl{constructor(t){this.Ql=new Set,this.Jl=new Set,this.Kl=new Sa,this.Yl=(t,e)=>this.Xl(t,e)&&this.tu(t,e)&&this.eu(t,e)&&this.iu(t,e),this.Xl=(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;ge(null==(t=this._instance)?void 0:t._addCaptureHook)||(this.ru=null==(e=this._instance)?void 0:e._addCaptureHook(((t,e)=>{this.on(t,e)})))}dispose(){var t;null==(t=this.ru)||t.call(this),this.ru=void 0,this.Kl=new Sa}register(t){var e,i;if(!ge(null==(e=this._instance)?void 0:e._addCaptureHook)&&(t.forEach((t=>{var e;this.Ql.add(t),null==(e=t.steps)||e.forEach((t=>{this.Jl.add((null==t?void 0:t.event)||"")}))})),null!=(i=this._instance)&&i.autocapture)){var r=new Set;this.Ql.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.Ql.clear(),this.Jl.clear(),this.register(t)}on(t,e){null!=e&&0!=t.length&&(this.Jl.has(t)||this.Jl.has(e.event))&&this.Ql.forEach((t=>{this.nu(e,t)&&this.Kl.emit("actionCaptured",t.name)}))}su(t){this.onAction("actionCaptured",(e=>t(e)))}nu(t,e){if(null==(null==e?void 0:e.steps))return!1;for(var i of e.steps)if(this.Yl(t,i))return!0;return!1}onAction(t,e){return this.Kl.on(t,e)}tu(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(!Kl(r,e.url,e.url_matching||"contains"))return!1}return!0}eu(t,e){return!!this.au(t,e)&&!!this.ou(t,e)&&!!this.lu(t,e)}au(t,e){var i;if(null==e||!e.href)return!0;var r=this.uu(t);if(r.length>0)return r.some((t=>Kl(t.href,e.href,e.href_matching||"exact")));var s,n=(null==t||null==(i=t.properties)?void 0:i.$elements_chain)||"";return!!n&&Kl((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",e.href,e.href_matching||"exact")}ou(t,e){var i;if(null==e||!e.text)return!0;var r=this.uu(t);if(r.length>0)return r.some((t=>Kl(t.text,e.text,e.text_matching||"exact")||Kl(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;!we(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=>Kl(t,n,o))))}lu(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}uu(t){var e;return null==(null==t||null==(e=t.properties)?void 0:e.$elements)?[]:null==t?void 0:t.properties.$elements}iu(t,e){return null==e||!e.properties||0===e.properties.length||Fa(e.properties.reduce(((t,e)=>{var i=ce(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 Yl{constructor(t){var e;this.hu=[],this._instance=t,this.du=new Map,this.vu=new Map,this.cu=new Map,this.fu=null==(e=this._instance)||null==e.onSessionId?void 0:e.onSessionId((t=>this.pu(t)))}gu(t){return!1}mu(){return null}yu(t){}bu(){}_u(t,e){return!!t&&Fa(t.propertyFilters,null==e?void 0:e.properties)}wu(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}ku(t,e,i){var r=(i===co.Activation?this.du:this.vu).get(t),s=[];return this.Su((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._u(n,e)}))}register(t){this.xu(t,!1)}replace(t){this.xu(t,!0)}xu(t,e){var i;ge(null==(i=this._instance)?void 0:i._addCaptureHook)||(this.Cu(t,e),this.Tu(t,e))}Tu(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.cu.clear(),0!==i.length){this.Mu||(this.Mu=new Jl(this._instance),this.Mu.init(),this.Mu.su((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.cu.get(e.name))&&void 0!==i?i:[];s.includes(t.id)||s.push(t.id),this.cu.set(e.name,s)}}))})),e?this.Mu.replace(r):this.Mu.register(r)}else{var s;e&&(null==(s=this.Mu)||s.replace([]))}}Eu(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)}))}Cu(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.wu(t,co.Activation),a=this.wu(t,co.Cancellation);e?(this.du=o,this.vu=a):(this.Eu(this.du,o),this.Eu(this.vu,a)),(0!==s.length||0!==n.length)&&(null!==(i=this.ru)&&void 0!==i||(this.ru=null==(r=this._instance)?void 0:r._addCaptureHook(((t,e)=>{this.onEvent(t,e)}))))}onEvent(t,e){var i,r,s=this.Iu(),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.Ru(t,n);if("consume"===o)return s.info("event consumed activated item, removing it",{event:t,itemId:n}),void this.Pu([n]);if("persist"===o)return s.info("shown item promoted to persisted activation",{event:t,itemId:n}),this.Au(n),void this.Fu([n])}if(this.vu.has(t)){var a=this.ku(t,e,co.Cancellation);a.length>0&&(s.info("cancel event matched, cancelling items",{event:t,itemsToCancel:a.map((t=>t.id))}),this.Pu(a.map((t=>t.id))),a.forEach((t=>this.Ou(t.id))))}if(this.du.has(t)){s.info("event name matched",{event:t,eventPayload:e,items:this.du.get(t)});var l=this.ku(t,e,co.Activation);this.Lu(l.map((t=>t.id)))}}onAction(t){this.cu.has(t)&&this.Lu(this.cu.get(t)||[])}Lu(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.gu(s)?this.Au(s)&&this.Du(s):r.push(s);r.length>0&&(this.hu=[...new Set([...this.hu,...r])]),this.Iu().info("updating activated items",{activatedItems:this.getActivatedIds()})}}Au(t){this.hu=this.hu.filter((e=>e!==t));var e=this.$u();return!e.includes(t)&&(this.Nu([...e,t]),this.qu(),!0)}Pu(t){var e=new Set(t);this.hu=this.hu.filter((t=>!e.has(t)));var i=this.ju(),r=i.filter((t=>!e.has(t)));r.length!==i.length&&(this.Nu(r),0===r.length&&this.Bu()),this.Fu(t)}Hu(){var t,e=this.mu();if(!e)return{};var i=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[e];return i&&"object"==typeof i?i:{}}Du(t){if(this.mu()){var e=this.Hu();this.yu(i({},e,{[t]:Date.now()}))}}Fu(t){if(this.mu()){var e=this.Hu(),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&&(_e(i)?this.bu():this.yu(i))}}Uu(){this.mu()&&this.bu()}getActivationTimestamp(t){if(this.$u().includes(t)){var e=this.Hu()[t];return xe(e)?e:void 0}}ju(){var t,e=this.zu();return(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[e])||[]}$u(){var t,e,i=this.ju();if(0===i.length)return[];var r=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[this.Wu()],s=null==(e=this._instance)||null==e.get_session_id?void 0:e.get_session_id();return s&&r===s?i:[]}qu(){var t,e=null==(t=this._instance)||null==t.get_session_id?void 0:t.get_session_id();e&&this.Vu(e)}Bu(){this.Gu()}pu(t){var e,i=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[this.Wu()];if(i&&i!==t){var r=this.ju(),s=this.Hu();r.length>0&&(this.Nu([]),r.filter((t=>xe(s[t]))).forEach((t=>this.Ou(t)))),this.Bu(),this.Uu()}}getActivatedIds(){return[...new Set([...this.$u(),...this.hu])].filter((t=>!this.Zu(t)))}dispose(){var t,e,i;null==(t=this.fu)||t.call(this),this.fu=void 0,null==(e=this.ru)||e.call(this),this.ru=void 0,null==(i=this.Mu)||i.dispose(),this.Mu=void 0}reset(){this.hu=[],this.ju().length>0&&this.Nu([]),this.Bu(),this.Uu()}getEventToItemsMap(){return this.du}Qu(){return this.Mu}}class Ql extends Yl{constructor(t){super(t)}zu(){return q}Wu(){return H}mu(){return V}yu(t){var e;null==(e=this._instance)||null==(e=e.persistence)||e.register({[V]:t})}bu(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(V)}gu(t){var e,i;this.Su((e=>{i=e.find((e=>e.id===t))}));var r=null==(e=i)||null==(e=e.appearance)?void 0:e.surveyPopupDelaySeconds;return xe(r)&&r>0}Ju(){return po.SHOWN}Su(t){var e;null==(e=this._instance)||e.getSurveys(t)}Ou(t){var e;null==(e=this._instance)||e.cancelPendingSurvey(t)}Iu(){return Ba}Nu(t){var e;null==(e=this._instance)||null==(e=e.persistence)||e.register({[q]:t})}Vu(t){var e;null==(e=this._instance)||null==(e=e.persistence)||e.register({[H]:t})}Gu(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(H)}Zu(){return!1}Ru(t,e){var i;this.Su((t=>{i=t.find((t=>t.id===e))}));var r=!i||function(t){var e;return Ca(t)&&!(null==(e=t.conditions)||null==(e=e.events)||!e.repeatedActivation)||"always"===t.schedule}(i);return r?t===po.SHOWN?"consume":"ignore":t===po.SHOWN?"persist":t===po.DISMISSED||t===po.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}class Xl{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);ge(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 Zl{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==At?void 0:At.__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 Ql(this._instance)}}var th=null!=wt&&wt.location?jn(wt.location.hash,"__posthog")||jn(location.hash,"state"):null,eh="_postHogToolbarParams",ih=Gr("[Toolbar]"),rh=Gr("[FeatureFlags]");class sh{constructor(t,e){void 0===e&&(e=!1),this.Ku=!1,this.update(t,e)}update(t,e){this.Yu=((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:ce(t.flag_keys)?t.flag_keys:void 0}})(t,e),!t.evaluation_environments||t.evaluation_contexts||this.Ku||(rh.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Ku=!0),ge(t.flag_keys)||ce(t.flag_keys)||rh.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.Yu}}var nh=Gr("[FeatureFlags]"),oh=Gr("[FeatureFlags]",{debugEnabled:!0}),ah="\" failed. Feature flags didn't load in time.",lh="connection_error",hh=t=>{for(var e={},i=0;t.length>i;i++)e[t[i]]=!0;return e},uh=t=>{var e={};for(var i of Qr(t||{})){var r=i[1];r&&(e[i[0]]=r)}return e},dh=Gr("[Error tracking]"),vh=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:"],ch=["__firefox__","__gCrWeb"],fh="Refusing to render web experiment since the viewer is a likely bot",ph={icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>-1===e.toLowerCase().indexOf(t.toLowerCase()),regex:(t,e)=>Oa(e,t),not_regex:(t,e)=>!Oa(e,t),exact:(t,e)=>e===t,is_not:(t,e)=>e!==t};class _h{get Wi(){return this._instance.config}constructor(t){var e=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),e.getWebExperiments((t=>{_h.Xu("retrieved web experiments from the server"),e.th=new Map,t.forEach((t=>{if(t.feature_flag_key){var i;e.th&&(_h.Xu("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(i=e.th)||i.set(t.feature_flag_key,t));var r=e._instance.getFeatureFlag(t.feature_flag_key);me(r)&&t.variants[r]&&e.eh(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var n=t.variants[s];_h.ih(n,e._instance)&&e.eh(t.name,s,n.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((t=>{this.onFeatureFlags(t)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())_h.Xu(fh);else if(!this.Wi.disable_web_experiments){if(we(this.th))return this.th=new Map,this.loadIfEnabled(),void this.previewWebExperiment();_h.Xu("applying feature flags",t),t.forEach((t=>{var e;if(this.th&&null!=(e=this.th)&&e.has(t)){var i,r=this._instance.getFeatureFlag(t),s=null==(i=this.th)?void 0:i.get(t);r&&null!=s&&s.variants[r]&&this.eh(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var t=_h.getWindowLocation();if(null!=t&&t.search){var e=Ln(null==t?void 0:t.search,"__experiment_id"),i=Ln(null==t?void 0:t.search,"__experiment_variant");e&&i&&(_h.Xu("previewing web experiments "+e+" && "+i),this.getWebExperiments((t=>{this.rh(parseInt(e),i,t)}),!1,!0))}}loadIfEnabled(){this.Wi.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,e,i){if(this.Wi.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.Wi.token),method:"GET",timestampMode:"query",callback:e=>t(200===e.statusCode&&e.json&&e.json.experiments||[])})}rh(t,e,i){var r=i.filter((e=>e.id===t));r&&r.length>0&&(_h.Xu("Previewing web experiment ["+r[0].name+"] with variant ["+e+"]"),this.eh(r[0].name,e,r[0].variants[e].transforms))}static ih(t,e){return!we(t.conditions)&&_h.nh(t,e)&&_h.sh(t)}static nh(t,e){var i;if(we(t.conditions)||we(null==(i=t.conditions)?void 0:i.url))return!0;var r=_h.getWindowLocation();if(r){var s,n,o,a=As(e,r.href);return null==(s=t.conditions)||!s.url||ph[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==wt?void 0:wt.location}static sh(t){var e;if(we(t.conditions)||we(null==(e=t.conditions)?void 0:e.utm))return!0;var i=Kn();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 Xu(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];Wr.info("[WebExperiments] "+t,i)}eh(t,e,i){this._is_bot()?_h.Xu(fh):"control"!==e?i.forEach((i=>{if(i.selector){var r;_h.Xu("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)}))}})):_h.Xu("Control variants leave the page unmodified.")}_is_bot(){return Et&&this._instance?Pa(Et,this.Wi.custom_blocked_useragents):void 0}}var gh=Gr("[Conversations]"),mh="Conversations not available yet.",yh="console",bh="__posthogHandledLogsRequestError",wh=(t,e)=>{var i=t instanceof Error?t:new Error(e);return i[bh]=!0,i},xh=t=>!!t&&"object"==typeof t&&!0===t[bh],Eh={featureFlags:class{constructor(t){this.name="featureFlags",this.ah=!1,this.featureFlagEventHandlers=[],this.I=nh,this.oh={},this.lh={},this.uh=[],this.hh=!1,this.dh=!1,this.fh=0,this.ph=!1,this.gh=!1,this.mh=!1,this.yh=!1,this.bh=0,this.It=()=>{var t=this._h();this.bh=0,t&&this.reloadFeatureFlags()},this.wh=()=>{var t,e=this.kh;ge(e)||this.Wi.remoteRequestsDisabled||!St||"hidden"===St.visibilityState||Date.now()-(null!==(t=this.Sh)&&void 0!==t?t:0)<e||(this.reloadFeatureFlags(),this.xh())},this.Et=()=>{"visible"===(null==St?void 0:St.visibilityState)&&this.wh()},"get"in t?this.ls=t:(this.Ch=new sh(t.config,t.ka()),this.ls=this.Ch)}updateConfig(t,e){var i;null==(i=this.Ch)||i.update(t,e),this.ds&&this.Th()}setup(t){return this.$l=t,this.I=t.logger.createLogger("[FeatureFlags]"),Hl(t.kv.initialize(),(()=>{this.$l===t&&(this.$l=void 0,this.ds=t,this.Mh(t))}))}Mh(t){if(this.ds===t)return wt&&rs(wt,"online",this.It),this.Th(),this.Eh=t.registerDynamicEventProperties((()=>this.Ih()?this.oh:this.lh)),this.Rh(),this.initialize()}Th(){var t=this.Wi.refreshIntervalMs,e=!this.Wi.remoteRequestsDisabled&&St&&!ge(t)&&t>0?t:void 0;e!==this.kh&&(this.Ph(),ge(e)||(this.kh=e,this.xh(),null!=St&&St.addEventListener&&rs(St,pt,this.Et)))}xh(){ge(this.kh)||(ge(this.Ah)||clearInterval(this.Ah),this.Sh=Date.now(),this.Ah=setInterval(this.wh,this.kh))}Ph(){ge(this.Ah)||(clearInterval(this.Ah),this.Ah=void 0,null==St||null==St.removeEventListener||St.removeEventListener(pt,this.Et)),this.kh=void 0,this.Sh=void 0}destroy(){this.Fh()}dispose(){this.Fh()}Fh(){var t;this.Ph(),this.fh++,this.gh=!1,this.$l=void 0,this.ds&&(this.Oh(),null==(t=this.Eh)||t.dispose(),this.Eh=void 0,this.uh=[],null==wt||wt.removeEventListener("online",this.It),this.ds=void 0)}get Wi(){return this.ls.get()}Lh(t){var e;return null==(e=this.ds)?void 0:e.kv.get(t)}Hr(t){this.Dh((()=>{var e;return null==(e=this.ds)?void 0:e.kv.set(t)}))}$r(t){this.Dh((()=>{var e;return null==(e=this.ds)?void 0:e.kv.remove(t)}))}Dh(t){try{t()}catch(t){this.I.error("Failed to update feature flag persistence",t)}}Rh(){var t={};for(var e of[C,A,F,D]){var r=this.Lh(e);ge(r)||(t[e]=r)}this.oh=t;var s=i({},t),n=this.Lh(R);if(n)for(var o of Object.entries(n))s["$feature/"+o[0]]=o[1];this.lh=s}Ih(){var t=this.Wi.cacheTtlMs;if(!t||0>=t)return!1;var e=this.Lh(Y);return"number"!=typeof e||Date.now()-e>t}$h(){return!!this.Ih()&&(this.yh||this.dh||(this.yh=!0,this.I.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Nh(){var t=this.Wi.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})):[]}qh(){var t=this.Wi.flagKeys;if(!ge(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.Wi,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.jh({featureFlags:a,featureFlagPayloads:l})}}updateFlags(t,e,r){var s,n,o=null!=r&&r.merge&&null!==(s=this.Lh(R))&&void 0!==s?s:{},a=null!=r&&r.merge&&null!==(n=this.Lh(A))&&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:Mt(c),variant:Dt(c),reason:void 0,metadata:ge(null==h?void 0:h[v])?void 0:{id:0,version:void 0,description:void 0,payload:h[v]}}}this.jh({flags:u})}get hasLoadedFlags(){return this.hh}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.Lh(I),e=this.Lh(D),r=this.Lh(N);if(!r&&!e)return t||{};var s=Yr({},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=ge(u)?null!==(a=null==h?void 0:h.enabled)&&void 0!==a&&a:!!u,v=ge(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.ah||(this.I.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:r,finalDetails:s}),this.ah=!0),s}getAllFeatureFlags(){var t=this.getFlagVariants(),e=this.getFlagPayloads();return Object.keys(t).map((i=>{var r=t[i];return{key:i,enabled:Mt(r),variant:Dt(r),payload:Ft(e[i])}}))}getFlagVariants(){var t=this.Lh(R),e=this.Lh(D);if(!e)return t||{};for(var i=Yr({},t||{}),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.ah||(this.I.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:i}),this.ah=!0),i}getFlagPayloads(){var t=this.Lh(A),e=this.Lh(N);if(!e)return t||{};for(var i=Yr({},t||{}),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.ah||(this.I.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:i}),this.ah=!0),i}reloadFeatureFlags(){this.ph||this.Wi.featureFlagsDisabled||this._h()||this.Bh||(this.uh.slice().forEach((t=>{try{t()}catch(t){this.I.error("Error while running feature flags reloading callback",t)}})),this.Bh=setTimeout((()=>{this.Hh()}),5))}Oh(){clearTimeout(this.Bh),this.Bh=void 0}onReloading(t){return this.uh.push(t),()=>{this.uh=this.uh.filter((e=>e!==t))}}ensureFlagsLoaded(){this.hh||this.dh||this.Bh||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.ph=t}resetFlagCallReported(){this.$r(G)}Hh(t){this.Oh();var e=this.ds;if(e&&!this.Wi.remoteRequestsDisabled&&!this._h())if(this.dh)this.gh=!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.Lh(L)||{},{$lib:e.library.name,$lib_version:e.library.version}),group_properties:this.Lh(U),timezone:io()};ge(e.deviceId)||(r.$device_id=e.deviceId),(null!=t&&t.disableFlags||this.Wi.featureFlagsDisabled)&&(r.disable_flags=!0);var s=this.Nh();s.length&&(r.evaluation_contexts=s);var n=this.qh();ge(n)||(r.flag_keys=n);var o=this.Wi.onlyEvaluateSurveyFeatureFlags,a="/flags/?v=2"+(o?"&only_evaluate_survey_feature_flags=true":""),l=this.fh;this.dh=!0;var h=()=>{this.gh&&(this.gh=!1,this.Hh())},u=t=>{this.dh=!1,l===this.fh?(this.Hr({[J]:[lh]}),this.I.error("Feature flag request failed",t),h()):h()};try{e.sendRequest(a,{target:"flags",method:"POST",body:r,compression:this.Wi.compression,sentAt:"body",timeoutMs:this.Wi.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.fh){if(this.Uh(t.statusCode),n||this.gh||(this.$anon_distinct_id=void 0),!r.disable_flags||this.gh){this.mh=!n;var a=[];t.error?a.push(t.error instanceof Error&&"AbortError"===t.error.name?"timeout":t.error instanceof Error?lh:"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.Hr({[J]: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.jh(s,n,{partialResponse:o}),h()}}else h()})).catch(u)}catch(t){u(t)}}}_h(){return Bn(this.bh,3)}Uh(t){this.bh=zn(t,this.bh,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.mh)if(this.hh||this.getFlags()&&this.getFlags().length>0){if(!this.$h()){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+ah)}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.mh)if(this.hh||this.getFlags()&&this.getFlags().length>0){if(!this.$h()){var r,s=this.getFlagVariants(),n=t in s,o=s[t],a=this.getFlagPayloads()[t],l=String(o),h=this.Lh(F)||void 0,u=this.Lh(Y)||void 0,d=this.Lh(G)||{};if(this.Wi.deduplicateCallsPerSession){var v,c=null==(v=this.ds)?void 0:v.session.sessionId,f=this.Lh(K);c&&c!==f&&(d={},r=c)}if(e.send_event||!("send_event"in e))if(t in d&&d[t].includes(l))r&&this.Hr({[G]:d,[K]:r});else{var p,_,g,m,y,b,w,x,E,S,k,T;ce(d[t])?d[t].push(l):d[t]=[l],this.Hr(i({[G]:d},r?{[K]:r}:{}));var P=this.getFeatureFlagDetails(t),R=[...null!==(p=this.Lh(J))&&void 0!==p?p:[]];ge(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.Wi.bootstrap)||null==(g=g.featureFlags)?void 0:g[t])&&void 0!==_?_:null,$feature_flag_bootstrapped_payload:null!==(m=null==(y=this.Wi.bootstrap)||null==(y=y.featureFlagPayloads)?void 0:y[t])&&void 0!==m?m:null,$used_bootstrap_value:!this.mh};ge(null==P||null==(b=P.metadata)?void 0:b.has_experiment)||(C.$feature_flag_has_experiment=P.metadata.has_experiment),ge(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),ge(null==P?void 0:P.original_variant)&&ge(null==P?void 0:P.original_enabled)||(C.$feature_flag_original_response=ge(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.zh(C)}else r&&this.Hr({[G]:d,[K]:r});if(n)return{key:t,enabled:!!o,variant:"string"==typeof o?o:void 0,payload:Ft(a)}}}else this.I.warn('getFeatureFlagResult for key "'+t+ah)}zh(t){try{var e;null==(e=this.ds)||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.Wh(t,e)}Wh(t,i){var r=this;return e((function*(){var e=r.ds;if(e){var s={distinct_id:e.distinctId,token:e.projectToken,person_properties:{$lib:e.library.name,$lib_version:e.library.version}},n=r.Nh();n.length&&(s.evaluation_contexts=n);var o,a=r.qh();ge(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.Wi.compression,sentAt:"body",timeoutMs:r.Wi.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.mh)return e.defaultValue;if(!(this.hh||this.getFlags()&&this.getFlags().length>0))return this.I.warn('isFeatureEnabled for key "'+t+ah),e.defaultValue;var i=this.getFeatureFlag(t,e);return ge(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.jh(t,e,i)}jh(t,e,r){if(this.ds){this.hh=!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=nh);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(ce(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{[C]:h,[R]:c,[M]:!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({[C]:Object.keys(uh(p)),[R]:p||{},[A]:_||{},[I]:g||{},[M]:!0===t.minimalFlagCalledEvents},d?{[F]:d}:{},v?{[Y]:v}:{})}}(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),r,this.I);s&&this.Hr(s),e||(this.yh=!1),this.Vh(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.Gh(t)}Gh(t){if(this.ds){if(!1===t)return this.$r([D,N]),this.Vh(),void oh.info("All overrides cleared");if(ce(t))return this.Hr({[D]:hh(t)}),this.Vh(),void oh.info("Flag overrides set",{flags:t});if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var e,i=t;this.ah=Boolean(null!==(e=i.suppressWarning)&&void 0!==e&&e);var r={},s=i.flags,n=i.payloads;return s&&(r[D]=ce(s)?hh(s):s),n&&(r[N]=n),Object.keys(r).length&&this.Hr(r),!1===s&&!1===n?this.$r([D,N]):!1===s?this.$r(D):!1===n&&this.$r(N),this.Vh(),!1===s?oh.info("Flag overrides cleared"):s&&oh.info("Flag overrides set",{flags:s}),void(!1===n?oh.info("Payload overrides cleared"):n&&oh.info("Payload overrides set",{payloads:n}))}if(t&&"object"==typeof t)return this.Hr({[D]:t}),this.Vh(),void oh.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.hh){var e=this.Zh(),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.Lh(O)||[]).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.Hr({[C]:Object.keys(uh(a)),[R]:a,[L]:i({},this.Lh(L)||{},n)}),this.Vh();try{var l;null==(l=this.ds)||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.Lh(O);!r||e?this.Qh(t,i):t(r)}Qh(t,i){var r=this;return e((function*(){var e=r.ds;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.Hr({[O]: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)}}}))()}Zh(){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)),{})}}Vh(t){this.Rh();var e=this.Zh(),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.Jh(t,e)}Jh(t,e){void 0===e&&(e=!0);var r=this.Lh(L)||{},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.Hr({[L]:i({},r,o,s)}),e&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,e){void 0===e&&(e=!0);var r=i({},this.Lh(L)||{});t.forEach((t=>{delete r[t]})),this.Hr({[L]:r}),e&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t){void 0===t&&(t=!0),this.$r(L),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,e){void 0===e&&(e=!0);var r=this.Lh(U)||{},s=i({},r);for(var n of Object.keys(t))s[n]=i({},r[n],t[n]);this.Hr({[U]:s}),e&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var e=this.Lh(U)||{};this.Hr({[U]:i({},e,{[t]:{}})})}else this.$r(U)}reset(){this.fh++,this.gh=!1,this.oh={},this.lh={},this.hh=!1,this.ph=!1,this.mh=!1,this.$anon_distinct_id=void 0,this.Oh(),this.ah=!1,this.bh=0}}},Sh={sessionRecording:class{get Wi(){return this._instance.config}get Za(){return this._instance.persistence}get started(){var t;return!(null==(t=this.Kh)||!t.isStarted)}get status(){var t,e;return this.Yh===Al||this.Yh===Fl?this.Yh:null!==(t=null==(e=this.Kh)?void 0:e.status)&&void 0!==t?t:this.Yh}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.Yh=Ol,this.Xh=void 0,this.td=!1,this._t=(()=>{var t;if(null==St||!St.visibilityState||"visible"===St.visibilityState)return!0;var e=null==wt||null==(t=wt.performance)||null==t.getEntriesByType?void 0:t.getEntriesByType("visibility-state");return!(null!=e&&e.length)||e.some((t=>"visible"===t.name))})(),this.Et=()=>{var t;"visible"===(null==St?void 0:St.visibilityState)&&(this._t=!0,null==(t=this.Kh)||null==t.setDocumentWasEverVisible||t.setDocumentWasEverVisible(!0))},this._instance=t,!this._instance.sessionManager)throw Dl.error("started without valid sessionManager"),new Error(Ml+" started without valid sessionManager. This is a bug.");if(this.Wi.cookieless_mode===dt)throw new Error(Ml+' cannot be used with cookieless_mode="always"');null!=St&&St.addEventListener&&rs(St,"visibilitychange",this.Et)}initialize(){this.startIfEnabledOrStop()}dispose(){this.td=!0,null==St||null==St.removeEventListener||St.removeEventListener("visibilitychange",this.Et),this.stopRecording()}get ed(){var t,e=!(null==(t=this._instance.get_property(b))||!t.enabled),i=!this.Wi.disable_session_recording,r=this.Wi.disable_session_recording||this._instance.consent.isOptedOut();return wt&&e&&i&&!r}startIfEnabledOrStop(t){var e;if(!(this.td||this.ed&&null!=(e=this.Kh)&&e.isStarted)){var i=!ge(Object.assign)&&!ge(Array.from);this.ed&&i?(this.rd(t),Dl.info("starting")):(this.Yh=Ol,this.stopRecording())}}rd(t){var e,i,r;this.ed&&(this.Yh!==Al&&this.Yh!==Fl&&(this.Yh=Il),null!=At&&null!=(e=At.__PosthogExtensions__)&&null!=(e=e.rrweb)&&e.record&&null!=(i=At.__PosthogExtensions__)&&i.initSessionRecording?this.nd(t):null==(r=At.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.sd,(e=>{if(e)return this._instance.register_for_session({[lt]:!0}),Dl.error("could not load recorder",e);this.nd(t)})))}stopRecording(){var t,e;null==(t=this.Xh)||t.call(this),this.Xh=void 0,null==(e=this.Kh)||e.stop()}ad(){var t,e;null==(t=this.Xh)||t.call(this),this.Xh=void 0,null==(e=this.Kh)||e.discard()}od(){var t,e;null==(t=this.Za)||t.unregister(P),null==(e=this.Za)||e.unregister(w)}ld(t,e){if(we(t))return null;var i,r=xe(t)?t:parseFloat(t);return"number"!=typeof(i=r)||!Number.isFinite(i)||0>i||i>1?(Dl.warn(e+" must be between 0 and 1. Ignoring invalid value:",t),null):r}ud(t){if(this.Za){var e,r,s=this.Za,n=()=>{var e,r=!1===t.sessionRecording?void 0:t.sessionRecording,n=this.ld(null==(e=this.Wi.session_recording)?void 0:e.sampleRate,"session_recording.sampleRate"),o=this.ld(null==r?void 0:r.sampleRate,"remote config sampleRate"),a=null!=n?n:o;we(a)&&this.od();var l=null==r?void 0:r.minimumDurationMilliseconds;s.register({[b]: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:ge(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.Xh)||e.call(this),this.Xh=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.ud(e),void this.ad()):(this.ud(e),void this.startIfEnabledOrStop()):(this.Yh===Al&&(this.Yh=Fl,Dl.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.Kh)&&i.log?this.Kh.log(t,e):Dl.warn("log called before recorder was ready")}get sd(){var t,e,i=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.get_property(b);return(null==i||null==(e=i.scriptConfig)?void 0:e.script)||"lazy-recorder"}hd(){var t,e=this._instance.get_property(b);if(!e)return!1;try{t="object"==typeof e?e:JSON.parse(e)}catch(t){return Dl.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}return!we(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}nd(t){var e,i,r;if(!this.td){if(null==(e=At.__PosthogExtensions__)||!e.initSessionRecording)return Dl.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[lt]:!0});var s;if(this.Kh||(this.Kh=null==(s=At.__PosthogExtensions__)?void 0:s.initSessionRecording(this._instance,this._t),this.Kh._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.hd()){if(this.Yh===Fl||this.Yh===Al)return;return this.Yh=Al,Dl.info("persisted remote config is stale, requesting fresh config before starting"),void new Eo(this._instance).load()}this.Yh=Il,null==(i=(r=this.Kh).setDocumentWasEverVisible)||i.call(r,this._t),this.Kh.start(t)}}onRRwebEmit(t){var e;null==(e=this.Kh)||null==e.onRRwebEmit||e.onRRwebEmit(t)}overrideLinkedFlag(){var t,e;this.Kh||null==(e=this.Za)||e.register({[E]:!0}),null==(t=this.Kh)||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.Kh||null==(e=this.Za)||e.register({[x]:!0}),null==(t=this.Kh)||t.overrideSampling()}overrideTrigger(t){var e,i;this.Kh||null==(i=this.Za)||i.register({["url"===t?S:k]:!0}),null==(e=this.Kh)||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.Kh)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var i;return!(null==(i=this.Kh)||!i.tryAddCustomEvent(t,e))}}},kh={autocapture:class extends wl{constructor(t){super(new xl(t)),this.instance=t}},historyAutocapture:class{constructor(t){this._instance=t,this.dd=this.vd()}initialize(){this.startIfEnabled()}get isEnabled(){var t=this.fd();return!!(t.path||t.search||this.pd(t))}startIfEnabled(){this.isEnabled&&(Wr.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.dd=this.vd(),this.startIfEnabled()}stop(){this.gd&&this.gd(),this.gd=void 0,this.md&&this.md(),this.md=void 0,Wr.info("History API monitoring stopped")}monitorHistoryChanges(){wt&&wt.history&&(this.yd("pushState"),this.yd("replaceState"),this.bd(),this.pd()&&this._d())}yd(t){var e;if(wt&&(null==(e=wt.history[t])||!e.__posthog_wrapped__)){var i=this;!function(t,e,i){try{if(!(e in t))return Sl;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 fe(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];fe(i)&&i.__posthog_layer__;){var n=i.__posthog_layer__;if(n.next===s)return void(n.next=r.next);i=n.next}else t[e]=r.next}}catch(t){return Sl}}(wt.history,t,(e=>function(r,s,n){e.call(this,r,s,n),i.wd(t)}))}}vd(){var t=null==wt?void 0:wt.location;if(null!=t&&t.pathname)return{pathname:t.pathname,search:t.search,hash:t.hash}}fd(){var t=this._instance.config.capture_pageview;return"history_change"===t?{path:!0}:pe(t)?t:{}}pd(t){return void 0===t&&(t=this.fd()),!!t.hash&&!this._instance.config.disable_capture_url_hashes}kd(t){var e=this.fd(),i=this.dd;return!(!i||!(e.path&&t.pathname!==i.pathname||e.search&&t.search!==i.search||this.pd(e)&&t.hash!==i.hash))}wd(t){try{var e=this.vd();if(!e)return;this.kd(e)&&this._instance.capture(gt,{navigation_type:t}),this.dd=e}catch(e){Wr.error("Error capturing "+t+" pageview",e)}}bd(){if(!this.gd){var t=()=>{this.wd("popstate")};rs(wt,"popstate",t),this.gd=()=>{wt&&wt.removeEventListener("popstate",t)}}}_d(){if(!this.md){var t=()=>{this.wd("hashchange")};rs(wt,"hashchange",t),this.md=()=>{wt&&wt.removeEventListener("hashchange",t)}}}},heatmaps:class{get Wi(){return this.instance.config}constructor(t){var e;this.Sd=!1,this.es=!1,this.xd=null,this.instance=t,this.Sd=!(null==(e=this.instance.persistence)||!e.props[v]),this.rageclicks=new pl(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return pe(this.Wi.capture_heatmaps)&&this.Wi.capture_heatmaps.flush_interval_milliseconds&&(t=this.Wi.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return we(this.Wi.capture_heatmaps)?we(this.Wi.enable_heatmaps)?this.Sd:this.Wi.enable_heatmaps:!1!==this.Wi.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.es)return;Nl.info("starting..."),this.Cd(),this.Et()}else{var t;clearInterval(null!==(t=this.xd)&&void 0!==t?t:void 0),this.Td(),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.Sd=i,this.startIfEnabled()}}}getAndClearBuffer(){var t=this.yt;return this.yt=void 0,t}Md(t){Ll(t.originalEvent)&&this.Ii(t.originalEvent,"deadclick")}Et(){this.xd&&clearInterval(this.xd),this.xd="visible"===(null==St?void 0:St.visibilityState)?setInterval(this.Na.bind(this),this.flushIntervalMilliseconds):null}Cd(){wt&&St&&(this.Ed=this.Na.bind(this),rs(wt,_t,this.Ed),this.Id=t=>this.Ii(t||(null==wt?void 0:wt.event)),rs(St,"click",this.Id,{capture:!0}),this.Rd=t=>this.Pd(t||(null==wt?void 0:wt.event)),rs(St,"mousemove",this.Rd,{capture:!0}),this.Ad=new Tn(this.instance,Sn,this.Md.bind(this)),this.Ad.startIfEnabledOrStop(),this.Fd=this.Et.bind(this),rs(St,pt,this.Fd),this.es=!0)}Td(){var t;wt&&St&&(this.Ed&&wt.removeEventListener(_t,this.Ed),this.Id&&St.removeEventListener("click",this.Id,{capture:!0}),this.Rd&&St.removeEventListener("mousemove",this.Rd,{capture:!0}),this.Fd&&St.removeEventListener(pt,this.Fd),clearTimeout(this.Od),null==(t=this.Ad)||t.stop(),this.es=!1)}Ld(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&&Us(r)&&!js(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:wt)?void 0:n.getComputedStyle(r).position}catch(t){return!1}if(oe(e,s))return!0;r=Xs(r)}return!1}(Js(t),["fixed","sticky"],s);return{x:t.clientX+(n?0:r),y:t.clientY+(n?0:i),target_fixed:n,type:e}}Ii(t,e){var r;if(void 0===e&&(e="click"),!Ls(t.target)&&Ll(t)){var s=this.Ld(t,e);null!=(r=this.rageclicks)&&r.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&on(Js(t),this.instance.config.rageclick)&&this.zn(i({},s,{type:"rageclick"})),this.zn(s)}}Pd(t){!Ls(t.target)&&Ll(t)&&(clearTimeout(this.Od),this.Od=setTimeout((()=>{this.zn(this.Ld(t,"mousemove"))}),500))}zn(t){if(wt){var e=this.Wi.disable_capture_url_hashes?Hi(wt.location.href):wt.location.href,i=this.Wi.custom_personal_data_properties,r=this.Wi.mask_personal_data_properties?[...Hn,...i||[]]:[],s=Un(e,r,Wn);this.yt=this.yt||{},this.yt[s]||(this.yt[s]=[]),this.yt[s].push(t)}}Na(){this.yt&&!_e(this.yt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Tn,webVitalsAutocapture:class{constructor(t){var e;this.Sd=!1,this.es=!1,this.yt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Dd=()=>{clearTimeout(this.$d),this.$d=void 0,0!==this.yt.metrics.length&&(this._instance.capture("$web_vitals",i({$current_url:this.yt.url},this.yt.metrics.reduce(((t,e)=>i({},t,{["$web_vitals_"+e.name+"_event"]:i({},e),["$web_vitals_"+e.name+"_value"]:e.value})),{}))),this.yt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Nd=t=>{var e;if(this.yt=this.yt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},we(null==t?void 0:t.name)||we(null==t?void 0:t.value))Tl.error("Invalid metric received",t);else{var r="string"==typeof t.navigationURL?t.navigationURL:void 0,s=this.qd(r);if(!ge(s)){var n=xe(t.navigationId)||"string"==typeof t.navigationId?"navigation:"+t.navigationId:"url:"+s;if(!this.jd||this.jd>t.value){this.yt.navigationKey!==n&&(this.Dd(),this.$d=setTimeout(this.Dd,this.flushToCaptureTimeoutMs)),ge(this.yt.navigationKey)&&(this.yt.navigationKey=n,this.yt.url=s),this.yt.firstMetricTimestamp=ge(this.yt.firstMetricTimestamp)?Date.now():this.yt.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,pe(t.attribution)&&this.attributionMetrics.indexOf(t.name)>-1){var l={};for(var h of Cl){var u="url"===h&&"string"==typeof t.attribution[h]?this.qd(t.attribution[h]):t.attribution[h];ge(u)||(l[h]=u)}a.attribution=l}else delete a.attribution;ge(o)||(a.$session_id=o.sessionId,a.$window_id=o.windowId),this.yt.metrics.push(a),this.yt.metrics.length===this.allowedMetrics.length&&this.Dd()}else Tl.error("Ignoring metric with value >= "+this.jd,t)}}},this.Bd=()=>{if(!this.es){var t,e,r,s,n=!1,o=At.__PosthogExtensions__,a=null==o?void 0:o.postHogWebVitalsCallbacksByFlavor,l=(null==a?void 0:a[this.Hd])||("web-vitals"===this.Hd&&ge(a)?null==o?void 0:o.postHogWebVitalsCallbacks:void 0);if(!ge(l)){var h=l.withoutAttribution,u=this.attributionMetrics;n=!ge(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.Nd.bind(this),d),this.allowedMetrics.indexOf("CLS")>-1&&e(this.Nd.bind(this),d),this.allowedMetrics.indexOf("FCP")>-1&&r(this.Nd.bind(this),d),this.allowedMetrics.indexOf("INP")>-1&&s(this.Nd.bind(this),v),this.es=!0}else Tl.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.Sd=!(null==(e=this._instance.persistence)||!e.props[_]),this.startIfEnabled()}get Ud(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e,i=pe(this.Ud)?null==(t=this.Ud)?void 0:t.web_vitals_allowed_metrics:void 0;return we(i)?(null==(e=this._instance.persistence)?void 0:e.props[y])||Pl:i}get flushToCaptureTimeoutMs(){return(pe(this.Ud)?this.Ud.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){var t=pe(this.Ud)?this.Ud.web_vitals_attribution:void 0;return Se(t)?t?Pl:[]:ce(t)?t:Rl}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){var t=pe(this.Ud)?this.Ud.__preview_web_vitals_soft_navs:void 0;return null!=t&&t}get jd(){var t=pe(this.Ud)&&xe(this.Ud.__web_vitals_max_value)?this.Ud.__web_vitals_max_value:$l;return t>0&&6e4>=t?$l:t}get isEnabled(){var t=null==kt?void 0:kt.protocol;if("http:"!==t&&"https:"!==t)return Tl.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=pe(this.Ud)?this.Ud.web_vitals:Se(this.Ud)?this.Ud:void 0;return Se(e)?e:this.Sd}startIfEnabled(){this.isEnabled&&!this.es&&(Tl.info("enabled, starting..."),this.Ts(this.Bd))}onRemoteConfig(t){if(t.ok){var e=t.config;if("capturePerformance"in e){var i=pe(e.capturePerformance)&&!!e.capturePerformance.web_vitals,r=pe(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[_]:i}),this._instance.persistence.register({[y]:r})),this.Sd=i,this.startIfEnabled()}}}get Hd(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}Ts(t){var e=At.__PosthogExtensions__,i=this.Hd,r=null==e?void 0:e.postHogWebVitalsCallbacksByFlavor;null!=r&&r[i]||"web-vitals"===i&&ge(r)&&null!=e&&e.postHogWebVitalsCallbacks?t():null==e||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,i,(e=>{e?Tl.error("failed to load script",e):t()}))}qd(t){var e=t||(null==wt?void 0:wt.location.href);if(e){var i=this._instance.config.disable_capture_url_hashes?Hi(e):e,r=this._instance.config.custom_personal_data_properties,s=this._instance.config.mask_personal_data_properties?[...Hn,...r||[]]:[];return Un(i,s,Wn)}Tl.error("Could not determine current URL")}}},Th={exceptionObserver:class{constructor(t){var e;this.Bd=()=>{var t;if(wt&&this.isEnabled&&null!=(t=At.__PosthogExtensions__)&&t.errorWrappingFunctions){var e=At.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=At.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=At.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.zd&&this.Wi.capture_unhandled_errors&&(this.zd=e(this.captureException.bind(this))),!this.Wd&&this.Wi.capture_unhandled_rejections&&(this.Wd=i(this.captureException.bind(this))),!this.Vd&&this.Wi.capture_console_errors&&(this.Vd=r(this.captureException.bind(this)))}catch(t){El.error("failed to start",t),this.Gd()}}},this._instance=t,this.Zd=!(null==(e=this._instance.persistence)||!e.props[c]),this.oe=new Ne(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:El})),this.Wi=this.Qd(),this.startIfEnabledOrStop()}Qd(){var t=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return pe(t)?e=i({},e,t):(ge(t)?this.Zd:t)&&(e=i({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Wi.capture_console_errors||this.Wi.capture_unhandled_errors||this.Wi.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(El.info("enabled"),this.Gd(),this.Ts(this.Bd)):this.Gd()}Ts(t){var e,i;null!=(e=At.__PosthogExtensions__)&&e.errorWrappingFunctions?t():null==(i=At.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",(e=>{if(e)return El.error("failed to load script",e);t()}))}Gd(){var t,e,i;null==(t=this.zd)||t.call(this),this.zd=void 0,null==(e=this.Wd)||e.call(this),this.Wd=void 0,null==(i=this.Vd)||i.call(this),this.Vd=void 0}onRemoteConfig(t){if(t.ok){var e=t.config;"autocaptureExceptions"in e&&(this.Zd=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[c]:this.Zd}),this.Wi=this.Qd(),this.startIfEnabledOrStop())}}onConfigChange(){this.Wi=this.Qd()}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.oe.consumeRateLimit(s)?El.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.Jd=[],this.Kd=new pr([new $r,new Nr,new Rr,new Pr,new Mr,new Fr,new Or,new Dr],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=Tr.test(l)?l.replace(Tr,"$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||_r});var r}))}(n)}}("web:javascript",xr,kr)),this._instance=t,this.Jd=null!==(e=null==(r=this._instance.persistence)?void 0:r.get_property(f))&&void 0!==e?e:[],this.Yd=zr(this.Xd()),this.tv=new qr(this.Yd)}onConfigChange(){this.Yd=zr(this.Xd()),this.tv.setConfig(this.Yd)}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.Jd=n,this._instance.persistence&&this._instance.persistence.register({[f]:this.Jd,[p]:o})}}}get ev(){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.Kd.buildFromUnknown(t,{syntheticException:null==e?void 0:e.syntheticException,mechanism:{handled:null==e?void 0:e.handled}})}addExceptionStep(t,e){if(this.Yd.enabled)try{if(!me(t)||0===t.trim().length)return void dh.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)=>jr.has(r)?(e.push(r),i):(i[r]=t[r],i)),{}),droppedKeys:e}}(this.iv(e)),s=r.sanitizedProperties,n=r.droppedKeys;n.length>0&&dh.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.tv.add(i({[Lr]:t,[Ur]:(new Date).toISOString()},s))}catch(t){dh.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{var e=t.$exception_list;if(this.rv(e)){if(this.nv(e))return this.sv("Exception dropped: matched a suppression rule"),void dh.info("Skipping exception capture because a suppression rule matched");if(!this.ev&&this.av(e))return this.sv("Exception dropped: thrown by a browser extension"),void dh.info("Skipping exception capture because it was thrown by an extension");if(!this.ev&&this.ov(e))return this.sv("Exception dropped: thrown by an injected browser script"),void dh.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.lv(e))return this.sv("Exception dropped: thrown by the PostHog SDK"),void dh.info("Skipping exception capture because it was thrown by the PostHog SDK")}var i=this.Yd.enabled&&we(t.$exception_steps)?this.uv(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",yl:!0});return s&&this.tv.clear(),s}catch(t){return dh.error("Failed to capture exception event. Dropping this exception.",t),void this.tv.clear()}}catch(t){return void dh.error("Failed to process exception event. Ignoring this exception.",t)}var n}uv(t){try{var e=this.tv.getAttachable();return 0===e.length?t:i({},t,{$exception_steps:e})}catch(e){return dh.error("Failed to read buffered exception steps. Capturing exception without steps.",e),t}}sv(t){this.Yd.enabled&&this.tv.add({[Lr]:t,[Ur]:(new Date).toISOString()})}iv(t){return pe(t)?i({},t):{}}Xd(){var t,e;return null!==(t=null==(e=this._instance.config.error_tracking)?void 0:e.exception_steps)&&void 0!==t?t:{}}nv(t){if(0===t.length)return!1;try{var e=t.reduce(((t,e)=>{var i=e.type,r=e.value;return me(i)&&i.length>0&&t.$exception_types.push(i),me(r)&&r.length>0&&t.$exception_values.push(r),t}),{$exception_types:[],$exception_values:[]});return this.Jd.some((t=>{var i=t.values.map((t=>{var i=Aa[t.operator],r=e[t.key];if(!i||!r)return!1;var s=ce(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 dh.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}av(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&&vh.some((t=>e.startsWith(t)))}))}ov(t){return t.some((t=>{var e=t.value;return me(e)&&ch.some((t=>e.includes(t)))}))}lv(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}rv(t){return!we(t)&&ce(t)}}},$h=i({productTours:class{get Za(){return this._instance.persistence}constructor(t){this.hv=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.Za&&this.Za.register({[m]:!!e.productTours}),!jl(this._instance))return!this.hv&&we(null==(i=this.Za)?void 0:i.props[W])||Ul.info("product tours disabled; stopping and clearing cached tours"),null==(r=this.hv)||r.stop(),this.hv=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.hv&&jl(this._instance)&&this.Ts((()=>this.vv()))}Ts(t){var e,i;null!=(e=At.__PosthogExtensions__)&&e.generateProductTours?t():null==(i=At.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"product-tours",(e=>{e?Ul.error("Could not load product tours script",e):t()}))}vv(){var t;!this.hv&&null!=(t=At.__PosthogExtensions__)&&t.generateProductTours&&(this.hv=At.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e){if(void 0===e&&(e=!1),!ce(this.dv)||e){var i=this.Za;if(i){var r=i.props[W];if(ce(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(jl(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||Ul.warn(s):Ul.error(s),void t([],{isLoaded:!1,error:s})}var n=ce(e.json.product_tours)?e.json.product_tours:[];this.dv=n,i&&i.register({[W]:n}),t(n,{isLoaded:!0})}else t([],{isLoaded:!0})}})}else t(this.dv,{isLoaded:!0})}getActiveProductTours(t){we(this.hv)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.hv.getActiveProductTours(t)}showProductTour(t){var e;null==(e=this.hv)||e.showTourById(t)}previewTour(t){this.hv?this.hv.previewTour(t):this.Ts((()=>{var e;this.vv(),null==(e=this.hv)||e.previewTour(t)}))}dismissProductTour(){var t;null==(t=this.hv)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.hv)||t.nextStep()}previousStep(){var t;null==(t=this.hv)||t.previousStep()}clearCache(){var t;this.dv=null,null==(t=this.Za)||t.unregister(W)}resetTour(t){var e;null==(e=this.hv)||e.resetTour(t)}resetAllTours(){var t;null==(t=this.hv)||t.resetAllTours()}cancelPendingTour(t){var e;null==(e=this.hv)||e.cancelPendingTour(t)}}},Eh),Ph={siteApps:class{constructor(t){this.fv=0,this._instance=t,this.pv=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}gv(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=At._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.gv.bind(this));this.mv=()=>{t(),this.pv=[],this.mv=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,Bl),{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}}yv(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)||(zl.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)||(zl.error("prepare_external_dependency_script returned null"),null):t}bv(){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==St?void 0:St.defaultView,h=null==l||null==(t=l.Node)?void 0:t.prototype;if(!l||!h)return()=>{};if(this.fv++,this._v)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.yv(t);return e&&v.add(e),e},p=t=>t.map((t=>"string"==typeof t?t:f(t))).filter((t=>!be(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._v=()=>{u.forEach((t=>t())),this._v=void 0},this.wv()}wv(){var t=!1;return()=>{var e;t||(t=!0,this.fv--,0===this.fv&&(null==(e=this._v)||e.call(this)))}}Sv(t,e){void 0===e&&(e=!0);var i=this.bv();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&&(zl.info("Processing "+this.pv.length+" events for site app with id "+t.id),this.pv.forEach((t=>this.Sv((()=>null==e.processEvent?void 0:e.processEvent(t))))),e.processedBuffer=!0),Object.values(this.apps).every((t=>t.processedBuffer||t.errored))&&(null==(i=this.mv)||i.call(this))},r=!1,s=s=>{e.errored=!s,e.loaded=!0,zl.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&i()};try{var n=this.Sv((e=>t.init({posthog:this._instance,callback(t){e(),s(t)}})),!1).processEvent;n&&(e.processEvent=n),r=!0}catch(e){zl.error(ql+t.id,e),s(!1)}if(r&&e.loaded)try{i()}catch(i){zl.error("Error while processing buffered events PostHog app with config id "+t.id,i),e.errored=!0}}xv(){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)}Cv(t){var e=this;if(0!==Object.keys(this.apps).length){var i=this.globalsForEvent(t),r=function(r){try{e.Sv((()=>null==r.processEvent?void 0:r.processEvent(i)))}catch(e){zl.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.xv(),void this._instance.on("eventCaptured",(t=>this.Cv(t)))):void zl.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this.mv)||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;At["__$$ph_site_app_"+e]=s._instance,null==(t=At.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(s._instance,i,(t=>{if(t)return zl.error(ql+e,t)}))};for(var a of n.siteApps)o()}else zl.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},Rh={tracingHeaders:class{constructor(t){this.Tv=void 0,this.Mv=void 0,this.Ev=void 0,this.Bd=()=>{var t,e,i=this.Iv();i?(ge(this.Tv)&&(this.Tv=null==(t=At.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchXHR(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),ge(this.Mv)&&(this.Mv=null==(e=At.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)?void 0:e._patchFetch(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.Gd()},this._instance=t}initialize(){this.startIfEnabledOrStop()}Ts(t){var e,i;null!=(e=At.__PosthogExtensions__)&&e.tracingHeadersPatchFns?t():null==(i=At.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",(e=>{if(e)return kl.error("failed to load script",e);t()}))}Rv(){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}Iv(){var t=this.Rv();return ce(t)?(ce(this.Ev)?this.Ev.splice(0,this.Ev.length,...t):this.Ev=[...t],t.length>0?this.Ev:void 0):(ce(this.Ev)&&this.Ev.splice(0),this.Ev=t||void 0,this.Ev)}Gd(){var t,e;null==(t=this.Tv)||t.call(this),null==(e=this.Mv)||e.call(this),this.Tv=void 0,this.Mv=void 0}startIfEnabledOrStop(){this.Iv()?this.Ts(this.Bd):this.Gd()}}},Ch=i({surveys:class extends Gl{constructor(t){var e;super(new Zl(t),{get projectToken(){return e.config.token},kv:new Xl(e=t)}),this._instance=t}Hl(t,e){var i=e.query?oa(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})}))}}},Eh),Oh={toolbar:class{constructor(t){this.instance=t}Pv(t){At.ph_toolbar_state=t}Av(){var t;return null!==(t=At.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),ss(this.instance.config))return!1;if(!wt||!St)return!1;t=null!=t?t:wt.location,i=null!=i?i:wt.history;try{if(!e){try{wt.localStorage.setItem("test","test"),wt.localStorage.removeItem("test")}catch(t){return!1}e=null==wt?void 0:wt.localStorage}var r,s=th||jn(t.hash,"__posthog")||jn(t.hash,"state"),n=s?Xr((()=>JSON.parse(atob(decodeURIComponent(s)))))||Xr((()=>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(eh)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}Fv(t){var e=At.ph_load_toolbar||At.ph_load_editor;!we(e)&&fe(e)?e(t,this.instance):ih.warn("No toolbar load function found")}loadToolbar(t){var e=!(null==St||!St.getElementById(Fs));if(!wt||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(wt.localStorage.setItem(eh,JSON.stringify(i({},s,{source:void 0}))),2===this.Av())this.Fv(s);else if(0===this.Av()){var n;this.Pv(1),null==(n=At.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",(t=>{if(t)return ih.error("[Toolbar] Failed to load",t),void this.Pv(0);this.Pv(2),this.Fv(s)})),rs(wt,"turbolinks:load",(()=>{this.Pv(0),this.loadToolbar(s)}))}return!0}Ov(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)}}},Ih=i({experiments:_h},Eh),Ah={conversations:class{constructor(t){this.Lv=void 0,this._conversationsManager=null,this.Dv=!1,this.Me=null,this.$v=!1,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations&&(this.Nv=t.ok,t.ok)){var e=t.config.conversations;we(e)||(Se(e)?this.Lv=e:(this.Lv=e.enabled,this.Me=e),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.Lv=void 0,this.Me=null,this.Nv=void 0,this.$v=!1}loadIfEnabled(){if(!(this._conversationsManager||this.Dv||this._instance.config.disable_conversations||ss(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==At?void 0:At.__PosthogExtensions__;if(t&&!ge(this.Lv)&&this.Lv)if(this.Me&&this.Me.token){this.Dv=!0;try{var e=t.initConversations;if(e)return this.qv(e),void(this.Dv=!1);var i=t.loadExternalDependency;if(!i)return void this.jv(ht);i(this._instance,"conversations",(e=>{e||!t.initConversations?this.jv("Could not load conversations script",e):this.qv(t.initConversations),this.Dv=!1}))}catch(t){this.jv("Error initializing conversations",t),this.Dv=!1}}else gh.error("Conversations enabled but missing token in remote config.")}}qv(t){if(this.Me)try{this._conversationsManager=t(this.Me,this._instance),this.$v=!1,gh.info("Conversations loaded successfully")}catch(t){this.jv("Error completing conversations initialization",t)}else gh.error("Cannot complete initialization: remote config is null")}jv(t,e){gh.error(t,e),this._conversationsManager=null,this.Dv=!1,this.$v=!0}show(){this._conversationsManager?this._conversationsManager.show():gh.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Lv&&!be(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":ss(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.Nv?"remote_config_failed":ge(this.Lv)?this.Nv?"disabled_in_project":"remote_config_pending":this.Lv?we(this.Me)||!this.Me.token?"missing_token":null!=At&&At.__PosthogExtensions__?this.Dv?"initializing":this.$v?"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):(gh.warn(mh),null)}))()}getMessages(t,i){var r=this;return e((function*(){return r._conversationsManager?r._conversationsManager.getMessages(t,i):(gh.warn(mh),null)}))()}markAsRead(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.markAsRead(t):(gh.warn(mh),null)}))()}getTickets(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.getTickets(t):(gh.warn(mh),null)}))()}requestRestoreLink(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(t):(gh.warn(mh),null)}))()}restoreFromToken(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(t):(gh.warn(mh),null)}))()}restoreFromUrlToken(){var t=this;return e((function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(gh.warn(mh),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}Ml(){var t;null==(t=this._conversationsManager)||t.setIdentity()}El(){var t;null==(t=this._conversationsManager)||t.clearIdentity()}}},Fh={logs:class{constructor(t){var e,r=this;this.name="logs",this.Bv=!1,this.Hv=!1,this.Uv=!1,this.I=Gr("[logs]"),this.zv=i({},this.I,{error(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];e.some(xh)||r.I.error(...e)}}),this.Ta=[],this.Wv=[],this.bh=0,this.os=!1,this.Vv=()=>{var t,e;this.os||(this.bh=0,null==(t=this.Gv)||t.onReconnect(),null==(e=this.Zv)||e.onReconnect())},this._instance=t,this._instance&&null!=(e=this._instance.config.logs)&&e.captureConsoleLogs&&(this.Bv=!0),wt&&rs(wt,"online",this.Vv)}Qv(t,e,i,r){var s,n=function(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=ge(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}}(null==(s=this._instance)||null==(s=s.config)?void 0:s.logs,i);return[new or(this.Jv(t,e),n,this.zv,(()=>this.Kv()),(t=>t()),void 0,r),n]}Yv(){var t,e=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.Gv||this.Xv!==e){var i;null==(i=this.Gv)||i.reset(),this.Xv=e;var r=this.Qv((()=>this.Ta),(t=>{this.Ta=t}));this.Gv=r[0],this.tc=r[1]}return this.Gv}ec(){var t,e=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.Zv||this.ic!==e){var i;null==(i=this.Zv)||i.reset(),this.ic=e;var r=this.Qv((()=>this.Wv),(t=>{this.Wv=t}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},yh);this.Zv=r[0],this.rc=r[1]}return this.Zv}setup(t){if(!this.os){this.ds=t;var e=!1,i=t.onRemoteConfig((t=>{var i;e=t.ok&&!0===(null==(i=t.config.logs)?void 0:i.captureConsoleLogs),this.onRemoteConfig(t)}));this.os?i.dispose():(this.vs=i,e||this.loadIfEnabled())}}dispose(){var t,e,i,r;this.os||(this.os=!0,null==(t=this.vs)||t.dispose(),this.vs=void 0,this.ds=void 0,this.Uv=!1,null==wt||wt.removeEventListener("online",this.Vv),null==(e=this.nc)||e.call(this),this.nc=void 0,null==(i=this.Gv)||i.reset(),null==(r=this.Zv)||r.reset())}onRemoteConfig(t){var e;if(!this.os&&t.ok){var i=null==(e=t.config.logs)?void 0:e.captureConsoleLogs;!we(i)&&i&&(this.Bv=!0,this.loadIfEnabled())}}reset(){var t,e;this.Ta=[],null==(t=this.Gv)||t.reset(),this.Wv=[],null==(e=this.Zv)||e.reset(),this.bh=0}captureLog(t){this.os||this.Yv().captureLog(t)}captureConsoleLog(t){this.os||this.ec().captureLog(t)}get logger(){return this.sc||(this.sc={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.sc}flushLogs(t){t?this.ac(t):(this.Gv&&this.Gv.flush().catch((t=>this.oc(t))),this.Zv&&this.Zv.flush().catch((t=>this.oc(t))))}oc(t){xh(t)||this.I.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(!this.os&&this.Bv&&!this.Hv&&!this.Uv){var t=null==At?void 0:At.__PosthogExtensions__;if(t){var e=t.loadExternalDependency;if(e){this.Uv=!0;try{e(this._instance,"logs",(e=>{if(this.Uv=!1,!this.os){var i,r=t.logs;e||null==r||!r.initializeLogs?this.I.error("Could not load logs script",e):(this.nc=r.initializeLogs(null!==(i=this.ds)&&void 0!==i?i:this._instance),this.Hv=!0)}}))}catch(t){throw this.Uv=!1,t}}else this.I.error(ht)}else this.I.error("PostHog Extensions not found.")}}Jv(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:[])},Fn:t=>this.Fn(t),getLibraryId:()=>s.LIB_NAME,getLibraryVersion:()=>s.LIB_VERSION}}Fn(t){return new Promise((e=>{if(Bn(this.bh,3))e({kind:"fatal",error:wh(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:wh(void 0,"logs request timed out")})}),9e4);this._instance._send_request({method:"POST",url:this.lc(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:t=>{var e=t.statusCode;if(this.uc(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:wh(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)})}}})}}))}uc(t){(0!==t||this._instance.__loaded)&&(this.bh=zn(t,this.bh,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."))))}ac(t){this.Ta.length>0&&this.hc(t,this.Ta,this.tc,s.LIB_NAME,(t=>{this.Ta=t})),this.Wv.length>0&&this.hc(t,this.Wv,this.rc,yh,(t=>{this.Wv=t}))}hc(t,e,i,r,n){if(0!==e.length){var o=e.map((t=>t.record));n([]);var a=nr(o,sr(i,s.LIB_NAME,s.LIB_VERSION),r,s.LIB_VERSION);this._instance._send_request({method:"POST",url:this.lc(),data:a,compression:"best-available",batchKey:"logs",transport:t})}}lc(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}Kv(){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,we(s)||(e.sessionStartTimestamp=s),we(n)||(e.lastActivityTimestamp=n)}if(null!=At&&null!=(t=At.location)&&t.href&&(e.currentUrl=this._instance.config.disable_capture_url_hashes?Hi(At.location.href):At.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(e.activeFeatureFlags=o)}return e}}},Mh={metrics:class{constructor(t){this.I=Gr("[metrics]"),this._instance=t}initialize(){}Yv(){var t,e,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.metrics;return this.Gv&&this.Xv===i||(null==(e=this.Gv)||e.reset(),this.Xv=i,this.Gv=new ur(this.Jv(),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.Gv}count(t,e,i){void 0===e&&(e=1),this.Yv().count(t,e,i)}gauge(t,e,i){this.Yv().gauge(t,e,i)}histogram(t,e,i){this.Yv().histogram(t,e,i)}flush(t){if(!this.Gv)return Promise.resolve();if(t){var e=this.Gv.drainWindow();return e&&this.Qn(e,t),Promise.resolve()}return this.Gv.flush().catch((t=>this.I.error("PostHog metrics flush failed:",t)))}reset(){var t;null==(t=this.Gv)||t.reset()}Jv(){var t=this._instance,e=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},Qn:t=>e.Qn(t),getLibraryId:()=>s.LIB_NAME,getLibraryVersion:()=>s.LIB_VERSION}}Qn(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.dc(),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)})}}}))}))}dc(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},Dh=i({},Eh,Sh,kh,Th,$h,Ph,Ch,Rh,Oh,Ih,Ah,Fh,Mh);fl.__defaultExtensionClasses=i({},Dh);var Nh=Gr("[ExternalScriptsLoader]"),Lh=t=>{var e=null==St?void 0:St.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]},Uh=(t,e,i)=>{if(t.config.disable_external_dependency_loading)return Nh.warn(e+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var r=Lh(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(!St)return i("document not found");if(Lh(e))return Uh(t,e,i);var r=St.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)St.head.appendChild(r);else{var s,n=St.querySelectorAll("body > script");n.length>0?null==(s=n[0].parentNode)||s.insertBefore(r,n[0]):St.body.appendChild(r)}};null!=St&&St.body?n():null==St||St.addEventListener("DOMContentLoaded",n)},jh={},Bh=(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)};At.__PosthogExtensions__=At.__PosthogExtensions__||{},At.__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=jh[s];if("fallback"===r&&n){if(Lh(n))return void Uh(t,n,i);delete jh[s]}Uh(t,s,"fallback"===r?(r,n)=>{if(r)if("string"==typeof r)i(r);else{var o,a=Bh(t,e);jh[s]=a;var l=Lh(s);null==l||null==(o=l.parentNode)||o.removeChild(l),Uh(t,a,i)}else i(void 0,n)}:i)}else Uh(t,Bh(t,e),i)}else{var o=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");Uh(t,o,i)}},At.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{var r=t.requestRouter.endpointFor("api",e);Uh(t,r,i)};var zh=function(){s.SDK_DIST_CHANNEL="npm";var t=Za[al]=new fl;return function(){function t(){t.done||(t.done=!0,ll=!1,Jr(Za,(function(t){t._dom_loaded()})))}null!=St&&St.addEventListener?"complete"===St.readyState?t():rs(St,"DOMContentLoaded",t,{capture:!1}):wt&&Wr.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),t}();exports.Compression=vo,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=go,exports.PostHog=fl,exports.ProductTourEventName=mo,exports.ProductTourEventProperties=yo,exports.SurveyEventName=po,exports.SurveyEventProperties=_o,exports.SurveyEventType=co,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=fo,exports.SurveyWidgetType={Button:"button",Tab:"tab",Selector:"selector"},exports.default=zh,exports.posthog=zh,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.0",LIB_NAME:"browser-common"};s.DEBUG=!1,s.LIB_VERSION="1.421.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","pinterest","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.Wi=e,this.I=i,this.hn=r,this.dn=s,this.vn=n,this.cn=o,this.fn=null,this.pn=0,this.gn=0,this.mn=0,this.yn=0,this.bn=0,this._n=!1,this.wn=e.maxBufferSize,this.kn=Math.max(null!==(a=e.maxQueueSize)&&void 0!==a?a:e.maxBufferSize,e.maxBufferSize),this.Sn=e.flushIntervalMs,this.xn=e.maxBatchRecordsPerPost,this.Cn=e.rateCapWindowMs,this.Tn=e.maxLogsPerInterval}clearQueue(){this.gn++,this._instance.setPersistedProperty(Ut.LogsQueue,[])}reset(){this.Mn(),this.yn=0,this.bn=0,this._n=!1,this.mn=0,this.xn=this.Wi.maxBatchRecordsPerPost}onReconnect(){this.mn=0,this.En()}captureLog(t,e){var i;if(!this._instance.isDisabled&&!this._instance.optedOut&&null!=t&&t.body){var r=this.In(t);if(null!==r)if(r.body){if(this.Rn()){var s={record:nr(r,null!==(i=null==e?void 0:e.context)&&void 0!==i?i:this.hn(),this.I,null==e?void 0:e.occurredAtMs)};this.dn((()=>this.Pn(s)))}}else this.I.info("Log was rejected in beforeSend function")}}In(t){var e=this.Wi.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}Rn(){if(void 0===this.Tn)return!0;var t=Date.now(),e=t-this.yn;return this.Cn>e&&e>=0||(this.yn=t,this.bn=0,this._n=!1),this.Tn>this.bn?(this.bn++,!0):(this._n||(this.I.warn("captureLog dropping logs: exceeded "+this.Tn+" logs per "+this.Cn+"ms"),this._n=!0),!1)}flush(){var t=this;return e((function*(){if(!t._instance.isDisabled)return t.fn||(t.fn=t.An().finally((()=>{t.fn=null}))),t.fn}))()}An(){var t=this;return e((function*(){var e;t.Mn();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.gn;t.pn=0;var l=Math.min(i.length,t.xn),h=i.slice(0,l),u=ar(h.map((t=>t.record)),t.Fn(),null!==(n=t.cn)&&void 0!==n?n:t._instance.getLibraryId(),t._instance.getLibraryVersion()),d=yield t._instance.On(u);if(t.gn!==a)return;if("too-large"===d.kind&&h.length>1)t.xn=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.xn);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.Wi.maxBatchRecordsPerPost>t.xn&&(t.xn=Math.min(t.Wi.maxBatchRecordsPerPost,t.xn+1)),yield t.Ln(h.length),i=null!==(o=t._instance.getPersistedProperty(Ut.LogsQueue))&&void 0!==o?o:[],s+=h.length,"fatal"===d.kind)throw d.error}}}))()}Ln(t){var i=this;return e((function*(){var e,r=Math.max(0,t-i.pn),s=null!==(e=i._instance.getPersistedProperty(Ut.LogsQueue))&&void 0!==e?e:[];i._instance.setPersistedProperty(Ut.LogsQueue,s.slice(r)),yield i.vn()}))()}Fn(){return or(this.Wi,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Pn(t){var e;if(!this._instance.optedOut){var i=null!==(e=this._instance.getPersistedProperty(Ut.LogsQueue))&&void 0!==e?e:[];this.kn>i.length||(i.shift(),this.pn++,this.I.info("Logs queue is full, dropping oldest record.")),i.push(t),this._instance.setPersistedProperty(Ut.LogsQueue,i),this.wn>i.length?this.Dn():this.En()}}Dn(t){void 0===t&&(t=this.Sn),this.$n||(this.$n=Ui((()=>{this.$n=void 0,this.En()}),t))}Nn(){var t=Math.min(Math.max(0,this.mn-1),6);return this.Sn*Math.pow(2,t)}qn(){var t=this._instance.getPersistedProperty(Ut.LogsQueue);return!!t&&t.length>0}shutdown(t){var i=this;return e((function*(){i.Mn();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((()=>{}))}))}))()}En(){this.flush().then((()=>{this.mn=0}),(t=>{this.mn++,this.I.error("PostHog logs flush failed:",t)})).finally((()=>{!this._instance.isDisabled&&this.qn()&&this.Dn(this.Nn())}))}Mn(){this.$n&&(clearTimeout(this.$n),this.$n=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.Wi=e,this.I=i,this.jn=new Map,this.fn=null,this.Bn=!1,this.Hn=new Map,this.Un=new Set,this.zn=0}count(t,e,i){void 0===e&&(e=1),this.Wn({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.Wn({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.Wn({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.fn,r=function(){var r=e((function*(){i&&(yield i.catch((()=>{}))),yield t.Vn()}));return function(){return r.apply(this,arguments)}}(),s=r().finally((()=>{this.fn===s&&(this.fn=null)}));return this.fn=s,s}drainWindow(){if(0===this.jn.size)return null;var t=this.jn;return this.jn=new Map,this.Bn=!1,this.Hn=new Map,this.Un=new Set,this.Gn(t)}reset(){this.zn++,this.Mn(),this.jn=new Map,this.fn=null,this.Bn=!1,this.Hn=new Map,this.Un=new Set}Wn(t){if(!this._instance.isDisabled&&!this._instance.optedOut){var e=this.In(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.jn.get(s);if(!n){if(!this.Zn())return;n={name:e.name,type:e.type,unit:e.unit,attributes:r,windowStartMs:Date.now()},this.jn.set(s,n)}var o=this.Hn.get(e.name);void 0===o?this.Hn.set(e.name,e.type):o===e.type||this.Un.has(e.name)||(this.Un.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.Qn(n,e.value),this.Dn()}else this.I.warn("Dropping metric '"+e.name+"': value must be a finite number");else this.I.warn("Dropping metric with empty name")}}Zn(){return this.Wi.maxSeriesPerFlush>this.jn.size||(this.Bn||(this.Bn=!0,this.I.warn("Metric series cap reached ("+this.Wi.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}Qn(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}}In(t){var e=this.Wi.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}Dn(){this.$n||(this.$n=Ui((()=>{this.$n=void 0,this.flush().catch((t=>{this.I.error("Metrics flush failed:",t)}))}),this.Wi.flushIntervalMs))}Mn(){this.$n&&(clearTimeout(this.$n),this.$n=void 0)}Vn(){var t=this;return e((function*(){if(0!==t.jn.size){var e=t.jn;t.jn=new Map,t.Bn=!1,t.Hn=new Map,t.Un=new Set;var i=t.zn,r=yield t._instance.Jn(t.Gn(e));if(i===t.zn)switch(r.kind){case"ok":return;case"retry-later":return t.Kn(e),void t.Dn();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)}}}))()}Gn(t){return e=this.Yn(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.Wi,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}Yn(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())}Kn(t){var e,i;for(var r of t){var s=r[0],n=r[1],o=this.jn.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.Zn()&&this.jn.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.wi(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.ki(t))&&void 0!==r?r:s.stack,synthetic:!0})}wi(t){return de(t.message)&&t.message.length>0}ki(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.Xn=[],this.ts=0,this.Wi=Hr(t)}setConfig(t){this.Wi=Hr(t),this.es()}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.Wi.max_bytes||(this.Xn.push({step:e.step,bytes:i}),this.ts+=i,this.es())}}getAttachable(){return this.Xn.map((t=>t.step))}clear(){this.Xn=[],this.ts=0}size(){return this.Xn.length}es(){for(;this.ts>this.Wi.max_bytes&&this.Xn.length>0;){var t=this.Xn.shift();t&&(this.ts-=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.Dr=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.Dr)this.Dr=t,this.Fr();else{if(this.Dr>=t+1e4)return;this.Nr++,this.Nr>4398046511103&&(this.Dr++,this.Fr())}return ls.fromFieldsV7(this.Dr,Math.trunc(this.Nr/Math.pow(2,30)),this.Nr&Math.pow(2,30)-1,this.qr.nextUint32())}Fr(){this.Nr=1024*this.qr.nextUint32()+(1023&this.qr.nextUint32())}constructor(){this.Dr=0,this.Nr=0,this.qr=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.yt.length>this.jr||(ds(this.yt),this.jr=0),this.yt[this.jr++]}constructor(){this.yt=new Uint32Array(8),this.jr=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={Br:()=>!!kt,Wr(t){Kr.error("cookieStore error: "+t)},Ur:as,zr(t){var e;try{e=JSON.parse(gs.Ur(t))||{}}catch(t){}return e},Hr(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}},$r(t,e){if(null!=kt&&kt.cookie)try{gs.Hr(t,"",-1,e)}catch(t){return}}},ms=null,ys={Br(){if(!ce(ms))return ms;var t=!0;if(ue(xt))t=!1;else try{var e="__mplssupport__";ys.Hr(e,"xyz"),'"xyz"'!==ys.Ur(e)&&(t=!1),ys.$r(e)}catch(e){t=!1}return t||Kr.error("localStorage unsupported; falling back to cookie store"),ms=t,t},Wr(t){Kr.error("localStorage error: "+t)},Ur(t){try{return null==xt?void 0:xt.localStorage.getItem(t)}catch(t){ys.Wr(t)}return null},zr(t){try{return JSON.parse(ys.Ur(t))||{}}catch(t){}return null},Hr(t,e){try{return null==xt||xt.localStorage.setItem(t,JSON.stringify(e)),!0}catch(t){ys.Wr(t)}return!1},$r(t){try{null==xt||xt.localStorage.removeItem(t)}catch(t){ys.Wr(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.zr(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.Ur(xs(t))||""),Cs={},Os={Br:()=>!0,Wr(t){Kr.error("memoryStorage error: "+t)},Ur:t=>Cs[t]||null,zr:t=>Cs[t]||null,Hr:(t,e)=>(Cs[t]=e,!0),$r(t){delete Cs[t]}},Is=null,As={Br(){if(!ce(Is))return Is;if(Is=!0,ue(xt))Is=!1;else try{var t="__support__";As.Hr(t,"xyz"),'"xyz"'!==As.Ur(t)&&(Is=!1),As.$r(t)}catch(t){Is=!1}return Is},Wr(t){Kr.error("sessionStorage error: ",t)},Ur(t){try{return null==xt?void 0:xt.sessionStorage.getItem(t)}catch(t){As.Wr(t)}return null},zr(t){try{return JSON.parse(As.Ur(t))||null}catch(t){}return null},Hr(t,e){try{return null==xt||xt.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch(t){As.Wr(t)}return!1},$r(t){try{null==xt||xt.sessionStorage.removeItem(t)}catch(t){As.Wr(t)}}};class Fs{constructor(t){this._instance=t}get Wi(){return this._instance.config}get consent(){return this.ws()?0:this.ks}isOptedOut(){return this.Wi.cookieless_mode===vt||this.isRejected()||-1===this.consent&&this.Wi.cookieless_mode===dt}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Wi.opt_out_capturing_by_default}optInOut(t){this.Ss.Hr(this.xs,t?1:0,this.Wi.cookie_expiration,this.Wi.cross_subdomain_cookie,this.Wi.secure_cookie)}reset(){this.Ss.$r(this.xs,this.Wi.cross_subdomain_cookie)}get xs(){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 ks(){var t=this.Ss.Ur(this.xs);return $e(t)?1:Zt(Pe,t)?0:-1}get Ss(){var t=this.Wi.opt_out_capturing_persistence_type,e="localStorage"===t?ys:gs;if(!this.Cs||this.Cs!==e){this.Cs=e;var i="localStorage"===t?gs:ys;i.Ur(this.xs)&&(this.Cs.Ur(this.xs)||this.optInOut($e(i.Ur(this.xs))),i.$r(this.xs,this.Wi.cross_subdomain_cookie))}return this.Cs}ws(){return!!this.Wi.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.Ts}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.Ms((()=>{this.Es()})):this.stop()}Ms(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()}))}Es(){var t;if(kt){if(!this.Ts&&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.Ts=Ft.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,e),this.Ts.start(kt),kn.info("starting...")}}else kn.error("`document` not found. Cannot start.")}stop(){this.Ts&&(this.Ts.stop(),this.Ts=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.Is=(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.Rs=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.Ps()}Ps(){var t;this.As=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.Is)}destroy(){var t;null==(t=this.As)||t.call(this),this.As=void 0}doPageView(t,e){var i,r=this.Fs(t,e);return this.Rs={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.Fs(t,null==(e=this.Rs)?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.Rs)?void 0:t.pageViewId}}Fs(t,e){var i=this.Rs;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.Os={},this.Ls=!1,this.Ds=!1,this.$s=!1,this.Ns=!1,this.Wi=t,this.qs=r,this.props={},this.js=void 0,this.Bs=(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.Ss=this.Hs(t),this.Ds=this.Us(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})}}zs(){var t,e=null==(t=this.Wi)?void 0:t.persistence_save_debounce_ms;return pe(e)&&e>0?e:0}Ws(t){if(this.Wi.cookieWinsOnConflict&&"localstorage+cookie"===this.Wi.persistence.toLowerCase())if(t)try{var e=ks(t,this.Wi.cookie_persisted_properties||[]),i=$s(e,this.Wi.cookie_persisted_properties||[]),r=JSON.stringify(e)+"|"+JSON.stringify(i),s=gs.Ur(this.Bs)||void 0;s&&Rs(this.Bs,s)===r&&(this.Vs=r,this.Gs=s)}catch(t){}else try{var n=gs.Ur(this.Bs)||void 0;this.Vs=n?Rs(this.Bs,n):void 0,this.Gs=n}catch(t){}}syncCookieProperties(){return this.Zs(this.Wi)}Zs(t,e){if(void 0===e&&(e=!1),this.Qs&&!e||this.Ns||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;var i;try{i=gs.Ur(this.Bs)||void 0}catch(t){}if(!i||i===this.Gs)return!1;var r,s=Rs(this.Bs,i);try{r=Ss(JSON.parse(i))}catch(t){return!1}if((gs.Ur(this.Bs)||void 0)!==i)return!1;this.Vs=s,this.Gs=i;var n=Ps(this.Bs,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.Js(X,ct);var f=this.props[o],p=this.props[X];return!u||f===d&&p===v||(this.$s=!0,As.Hr(lo(this.Bs),!0),this.Ks(U),this.Ks(O),this.Ks(C),this.Ks(A),this.Ks(F),this.Ks(M),this.Ks(Q),this.Ks(Y),this.Ks(K),p===ct&&(v===ft||r[X]===ct||!ue(d)&&f!==d)&&(uo(this.props,r),this.Ks(j)),p===ft?this.props.$user_id=f:delete this.props.$user_id,this.Ks(h)),!0}consumeCookieIdentityChange(){var t=lo(this.Bs),e=this.$s||!!As.Ur(t);return this.$s=!1,e&&As.$r(t),e}Ys(t){return void 0===t&&(t=!1),!(this.Ns||this.Qs&&!t||!this.Wi.cookieWinsOnConflict||"localstorage+cookie"!==this.Wi.persistence.toLowerCase()||(this.Ns=!0,0))}Xs(){this.Ns&&(ue(this.ta)||(clearTimeout(this.ta),this.ta=void 0),delete this.Os[ho],this.ea(!0))}ia(t){if(void 0===t&&(t=!0),this.Ns)try{t?this.Xs():ue(this.ta)||(clearTimeout(this.ta),this.ta=void 0)}finally{this.Ns=!1}}isDisabled(){return!!this.Qs}Hs(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,{zr(t){try{var i,s={};try{i=gs.Ur(t)||void 0,s=i?Ss(JSON.parse(i)):{}}catch(t){}var n,a=JSON.parse(ys.Ur(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.Hr(t,n),n}catch(t){}return null},Hr(i,r,s,n,o,a){var l=ys.Hr(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.Hr(u,d,s,n,o,a),gs.Ur(u)!==JSON.stringify(d)){gs.$r(u,n);var v=ks(r);return gs.Hr(i,v,s,n,o,a),l}}gs.Hr(i,h,s,n,o,a)}}catch(t){ys.Wr(t)}return l},$r(t,e){try{null==xt||xt.localStorage.removeItem(t),gs.$r(t,e),gs.$r(xs(t),e)}catch(t){ys.Wr(t)}}})}(t.cookie_persisted_properties||[],t.cookieWinsOnConflict),s=!1,n=t.persistence.toLowerCase();return"localstorage"===n&&ys.Br()?(e=ys,s=!0):"localstorage+cookie"===n&&r.Br()?(e=r,s=!0):"sessionstorage"===n&&As.Br()?e=As:"memory"===n?e=Os:"cookie"===n?e=gs:r.Br()?(e=r,s=!0):e=gs,this.Ls=s,e}ra(t){return this.Bs+"__"+t}Us(t){return this.Ls&&!!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.Qs||t){var e=this.Wi.cookieWinsOnConflict&&"localstorage+cookie"===this.Wi.persistence.toLowerCase(),i=e?ys.zr(this.Bs):null,r={};if(e)try{Qr(r=Ss(gs.zr(this.Bs)),((t,e)=>{(ue(t)||ce(t)||""===t)&&delete r[e]}))}catch(t){}var s=this.Ss.zr(this.Bs);if(s&&(this.props=Xr({},s)),this.Ds&&this.na(),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.$s=!0,As.Hr(lo(this.Bs),!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.$r(this.ra(t)),this.Os[t]={}):ys.Hr(this.ra(t),e)&&(this.Os[t]={persisted:!0,fingerprint:this.sa(e,t)})}))}}As.Ur(lo(this.Bs))&&(this.$s=!0)}}na(){for(var t of Fn){var e=ys.zr(this.ra(t));if(e&&!he(e)){var i=this.aa(t);i.persisted=!0,this.oa(t)||(i.fingerprint=this.sa(e,t)),this.la(t,e)||Xr(this.props,e)}}}oa(t){return Object.keys(this.props).some((e=>{var i;return(null==(i=Nn(e))?void 0:i.storageGroup)===t}))}la(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.Qs){var i=this.Ds?null==(e=Nn(t))?void 0:e.storageGroup:void 0,r=i?ys.zr(this.ra(i)):this.Ss.zr(this.Bs);if(r&&t in r)this.Js(t,r[t]);else{if(i){var s=this.Ss.zr(this.Bs);if(s&&t in s)return void this.Js(t,s[t])}this.Ks(t)}}}save(){if(!this.Qs){var t=this.zs();t>0?ue(this.ta)&&(this.ta=setTimeout((()=>{this.ta=void 0,this.ea()}),t)):this.ea()}}flush(){ue(this.ta)||(clearTimeout(this.ta),this.ta=void 0,this.ea())}ea(t){void 0===t&&(t=!1),this.Qs||this.Ns&&!t||(t||this.syncCookieProperties(),this.Ds?this.ua():this.ha(this.Ss,this.Bs,this.props,ho)&&this.Ws(this.props))}ua(){var t=this.da(),e=t.main,i=t.groups;for(var r of(this.ha(this.Ss,this.Bs,e,ho)&&this.Ws(e),Fn)){var s,n=i[r];(!he(n)||null!=(s=this.Os[r])&&s.persisted)&&this.ha(ys,this.ra(r),n,r)}}da(){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}}sa(t,e){if(e===ho)return JSON.stringify(t)+"|"+this.va+"|"+this.ca+"|"+this.fa;var i={};return Qr(t,((t,e)=>{var r;i[e]=null!=(r=Nn(e))&&r.volatile?"__volatile__":t})),JSON.stringify(i)}ha(t,e,i,r){var s,n=this.aa(r);if(r!==ho&&!n.dirty&&!ue(n.fingerprint))return!1;try{if((s=this.sa(i,r))===n.fingerprint)return n.dirty=!1,!1}catch(t){s=void 0}return t.Hr(e,i,this.va,this.ca,this.fa,this.Wi.debug)?(n.dirty=!1,r!==ho&&(n.persisted=!0),ue(s)||(n.fingerprint=s),!0):(this.Wi.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.ta)||(clearTimeout(this.ta),this.ta=void 0),this.Ss.$r(this.Bs,!1),this.Ss.$r(this.Bs,!0),!i&&this.qs)for(var r of Fn)ys.$r(this.ra(r));i?delete this.Os[ho]:this.Os={},this.Vs=void 0,this.Gs=void 0}clear(){this.remove(),this.props={}}register_once(t,e,i){if(le(t)){this.syncCookieProperties(),ue(e)&&(e="None"),this.va=ue(i)?this.pa:i;var r=!1;if(Qr(t,((t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this.Js(i,t),r=!0)})),r)return this.save(),!0}return!1}register(t,e){if(le(t)){this.syncCookieProperties(),this.va=ue(e)?this.pa:e;var i=!1;if(Qr(t,((e,r)=>{t.hasOwnProperty(r)&&(this.props[r]!==e||le(e)||oe(e))&&(this.Js(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.Ks(r),i=!0);i&&this.save()}update_campaign_params(){var t=null==kt?void 0:kt.URL;if(t!==this.js){var e=Yn(this.Wi.custom_campaign_params,this.Wi.mask_personal_data_properties,this.Wi.custom_personal_data_properties);he(is(e))||this.register(e),this.js=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.Wi.mask_personal_data_properties,this.Wi.custom_personal_data_properties,this.Wi.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.Wi.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.Qs&&!l;l||this.Zs(e,h),this.Wi=t,!l&&(s||n||a)&&(this.Vs=void 0,this.Gs=void 0,this.Zs(i({},t,{cookie_persisted_properties:e.cookie_persisted_properties}),h));var u=o||a?this.Hs(t):this.Ss,d=this.Us(t),v=o||d!==this.Ds,c=!l&&(v||t.cross_subdomain_cookie!==this.ca||t.secure_cookie!==this.fa)&&this.Ys(h);try{if(this.pa=this.va=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.Ss=u,this.Ds=d,this.props=f,this.save()}else a&&(this.Ss=u,l||(delete this.Os[ho],this.ea()))}finally{c&&this.ia()}}set_disabled(t){this.Qs=t,this.Qs?this.remove():this.save()}set_cross_subdomain(t){t!==this.ca&&(this.ca=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.fa&&(this.fa=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,e){var i=this.props[u]||{};i[t]=e,this.Js(u,i),this.save()}remove_event_timer(t){var e=this.props[u]||{},i=e[t];return ue(i)||(delete e[t],this.Js(u,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this.Js(t,e),this.save()}Js(t,e){var i;this.props[t]=e,null!=(i=Nn(t))&&i.volatile||this.ga(t)}Ks(t){delete this.props[t],this.ga(t)}ga(t){var e,i=null==(e=Nn(t))?void 0:e.storageGroup;i&&(this.aa(i).dirty=!0)}aa(t){return this.Os[t]||(this.Os[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.ma(h)&&(a.dropped=0)}return this.lastEventRateLimited=l,null==(r=this.instance.persistence)||r.set_property(tt,a),{isRateLimited:l,remainingTokens:a.tokens}}ya(t){var e=this.instance.config.property_denylist;return!oe(e)||!e.includes(t)}ba(){var t;if(this.ya("$current_url")&&this.ya("$pathname")&&null!=Tt&&Tt.pathname)return""+(null!==(t=Tt.origin)&&void 0!==t?t:"")+Tt.pathname}ma(t){var e,i,r=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,n=this.ba(),o=this.ya("$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}_a(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()}wa(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.ka(this.remoteConfig);if(this._instance.Sa())return void So.warn("Remote config is disabled. Falling back to local config.");this._a((t=>{if(!t)return So.info("No config found after loading remote JS config. Falling back to JSON."),void this.wa((t=>{this.ka(t.json,t)}));this.ka(t)}))}catch(t){So.error("Error loading remote config",t),this.ka()}}ka(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.ka(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.xa)return t.xa;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,xa:void 0}))}:{url:aa(t.url,"compression"),encodedBody:ha(i({},t,{compression:void 0,xa: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,{xa:{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.Ca&&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,{Ca:!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.Ta=!0,this.Ma=[],this.Ea=Re((null==e?void 0:e.flush_interval_ms)||ya,250,5e3,Kr.createLogger("flush interval"),ya),this.Ia=t}enqueue(t){this.Ma.push(t),this.Ra||this.Pa()}unload(){this.Aa();var t=this.Ma.length>0?this.Fa():{},e=Object.values(t);[...e.filter((t=>0===t.url.indexOf("/e"))),...e.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.Oa(i({},t,{transport:"sendBeacon"}))}))}enable(){this.Ta=!1,this.Pa()}Pa(){var t=this;this.Ta||(this.Ra=setTimeout((()=>{if(this.Aa(),this.Ma.length>0){var e=this.Fa(),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.Oa(i)};for(var r in e)i()}}),this.Ea))}Oa(t){try{this.Ia(t)}catch(t){Kr.error(t)}}Aa(){clearTimeout(this.Ra),this.Ra=void 0}Fa(){var t={};return Qr(this.Ma,(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.Ma=[],t}}var wa=["retriesPerformedSoFar"];class xa{constructor(t){this.La=!1,this.Da=3e3,this.Ma=[],this._instance=t,this.Ma=[],this.$a=!0,!ue(xt)&&"onLine"in xt.navigator&&(this.$a=xt.navigator.onLine,this.Na=()=>{this.$a=!0,this.qa()},this.ja=()=>{this.$a=!1},ns(xt,"online",this.Na),ns(xt,"offline",this.ja))}get length(){return this.Ma.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.Pn(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)}}))}Pn(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.Ma.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+i;navigator.onLine||(s+=" (Browser is offline)"),Kr.warn(s),this.La||(this.La=!0,this.Ba())}Ba(){if(this.Ha&&clearTimeout(this.Ha),0===this.Ma.length)return this.La=!1,void(this.Ha=void 0);this.Ha=setTimeout((()=>{this.$a&&this.Ma.length>0&&this.qa(),this.Ba()}),this.Da)}qa(){var t=Date.now(),e=[],i=this.Ma.filter((i=>t>i.retryAt||(e.push(i),!1)));if(this.Ma=e,i.length>0)for(var r of i)this.retriableRequest(r.requestOptions)}unload(){for(var t of(this.Ha&&(clearTimeout(this.Ha),this.Ha=void 0),this.La=!1,ue(xt)||(this.Na&&(xt.removeEventListener("online",this.Na),this.Na=void 0),this.ja&&(xt.removeEventListener("offline",this.ja),this.ja=void 0)),this.Ma)){var e=t.requestOptions;try{this._instance._send_request(i({},e,{transport:"sendBeacon"}))}catch(t){Kr.error(t)}}this.Ma=[]}}class Ea{constructor(t){this.Ua=()=>{var t,e,i,r;this.za||(this.za={});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.za.lastScrollY=Math.ceil(n),this.za.maxScrollY=Math.max(n,null!==(t=this.za.maxScrollY)&&void 0!==t?t:0),this.za.maxScrollHeight=Math.max(o,null!==(e=this.za.maxScrollHeight)&&void 0!==e?e:0),this.za.lastContentY=a,this.za.maxContentY=Math.max(a,null!==(i=this.za.maxContentY)&&void 0!==i?i:0),this.za.maxContentHeight=Math.max(l,null!==(r=this.za.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}get Wa(){return this._instance.config.scroll_root_selector}getContext(){return this.za}resetContext(){var t=this.za;return setTimeout(this.Ua,0),t}startMeasuringScrollPosition(){ns(xt,"scroll",this.Ua,{capture:!0}),ns(xt,"scrollend",this.Ua,{capture:!0}),ns(xt,"resize",this.Ua)}scrollElement(){if(!this.Wa)return null==xt?void 0:xt.document.documentElement;var t=oe(this.Wa)?this.Wa:[this.Wa];for(var e of t){var i=null==xt?void 0:xt.document.querySelector(e);if(i)return i}}Va(t){var e="y"===t?"scrollTop":"scrollLeft";if(this.Wa){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.Va("y")}scrollX(){return this.Va("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.st=t=>{var e=this.Ga();if(!e||e.sessionId!==t){var i={sessionId:t,props:this.Za(this._instance)};this.Qa.register({[Z]:i})}},this._instance=t,this.Ja=e,this.Qa=i,this.Za=r||Sa,this.Ja.onSessionId(this.st)}Ga(){return this.Qa.props[Z]}getSetOnceProps(){var t,e=null==(t=this.Ga())?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.Ka[t]||(this.Ka[t]=[]),this.Ka[t].push(e),()=>{this.Ka[t]=this.Ka[t].filter((t=>t!==e))}}emit(t,e){for(var i of this.Ka[t]||[])i(e);for(var r of this.Ka["*"]||[])r(t,e)}constructor(){this.Ka={}}}var $a=Jr("[SessionId]"),Pa=864e5;class Ra{on(t,e){return this.Ya.on(t,e)}constructor(t,e,i){var r;if(this.Xa=null,this.eo=null,this.io=[],this.ro=void 0,this.no=!1,this.Ya=new Ta,this.so=(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.Wi=t.config,this.Qa=t.persistence,this.ut=void 0,this._e=void 0,this._sessionStartTimestamp=null,this.ao=void 0,this._sessionActivityTimestamp=null,this.oo=e||cs,this.lo=i||cs;var s=this.Wi.persistence_name||this.Wi.token;if(this._sessionTimeoutMs=1e3*Re(this.Wi.session_idle_timeout_seconds||1800,60,36e3,$a.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.uo(),this.ho="ph_"+s+"_window_id",this.do="ph_"+s+"_primary_window_exists",this.vo()){var n=As.zr(this.ho),o=As.zr(this.do);n&&!o?this.ut=n:As.$r(this.ho),As.Hr(this.do,!0)}null!=(r=this.Wi.bootstrap)&&r.sessionID&&this.setBootstrapSessionId(this.Wi.bootstrap.sessionID),this.co()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return ue(this.io)&&(this.io=[]),this.io.push(t),this._e&&t(this._e,this.ut),()=>{this.io=this.io.filter((e=>e!==t))}}vo(){return"memory"!==this.Wi.persistence&&!this.Qa.Qs&&As.Br()}fo(t){t!==this.ut&&(this.ut=t,this.vo()&&As.Hr(this.ho,t))}po(){return this.ut?this.ut:this.vo()?As.zr(this.ho):null}mo(t){var e=this.Xa;return!ce(e)&&!ce(t)&&5e3>Math.abs(t-e)}yo(t,e,i){var r=e!==this._sessionActivityTimestamp,s=!(t!==this._e||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=e,this._e=t,s&&!r||s&&this.mo(e)||(this.Xa=e,this.Qa.register({[P]:[e,t,i]}))}bo(){var t,e=null==(t=this.Wi)?void 0:t.persistence_save_debounce_ms;return _e(e)&&e>0}_o(){this.bo()?this.Qa.refreshKey(P):(this.Qa.flush(),this.Qa.load())}wo(){var t;if(!ce(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Xa){this._o();var e=this.ko();e[1]===this._e&&e[2]===this._sessionStartTimestamp&&(this.Xa=this._sessionActivityTimestamp,this.Qa.register({[P]:[this._sessionActivityTimestamp,null!==(t=this._e)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.Qa.flush())}}So(){var t=this.ko()[0],e=_e(t)?t:0,i=_e(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(e,i)}xo(t){return this._o(),this.so(t,this.So())}ko(){var t=this.Qa.props[P];return oe(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Xa=null,this.ao=void 0,clearTimeout(this.Co),this.Co=void 0,this.yo(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.ao={sessionId:t,sessionStartTimestamp:i}:this.yo(t,(new Date).getTime(),i),!0)}destroy(){this.no=!0,this.wo(),clearTimeout(this.Co),this.Co=void 0,this.ro&&xt&&(xt.removeEventListener(gt,this.ro,{capture:!1}),this.ro=void 0),this.io=[]}co(){this.ro=()=>{this.wo(),this.vo()&&As.$r(this.do)},ns(xt,gt,this.ro,{capture:!1})}checkAndGetSessionAndWindowId(t,e,i){if(void 0===t&&(t=!1),void 0===e&&(e=null),void 0===i&&(i=!1),this.Wi.cookieless_mode===vt)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=e||(new Date).getTime(),s=this._e;if(i)this.eo=r;else if(ce(this.eo)||this.eo>r||r-this.eo>=1e3){var n,o;null==(n=(o=this.Qa).syncCookieProperties)||n.call(o),this.eo=r}var a=this.ko(),l=a[1],h=a[2],u=!ue(s)&&l!==s,d=this.So(),v=this.po(),c=this.ao,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.so(r,d);if(b){(b=this.xo(r))||$a.info("cross-tab refresh kept the session alive",{sessionId:l});var w=this.ko();l=w[1],h=w[2]}if(m||b||p){g=!1;var x=c&&!f;l=x?c.sessionId:this.oo(),v=this.lo(),$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.ao=void 0,_=!0}else v||(v=this.lo(),_=!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.fo(v),this.yo(l,E,S),t||this.uo();var k={noSessionId:m,activityTimeout:b,sessionPastMaximumLength:p,crossTabAdoption:g};return _&&this.io.forEach((t=>t(l,v,k))),{sessionId:l,windowId:v,sessionStartTimestamp:S,changeReason:_?k:void 0,lastActivityTimestamp:d}}uo(){this.no||(clearTimeout(this.Co),this.Co=setTimeout((()=>{if(!this.no)if(this.xo((new Date).getTime())){var t=this._e;this.resetSessionId(),this.Ya.emit("forcedIdleReset",{idleSessionId:t})}else this.uo()}),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.To={},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.To[this.apiHost]||(this.To[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.To[this.apiHost]}Mo(t){if(ja.test(t)){var e=this.instance.config.asset_host;if("string"==typeof e)return e.trim().replace(/\/$/,"")||void 0}}Eo(t){var e=Un(t);return e?e.protocol+"//"+e.host+e.pathname:void 0}Io(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.Eo(r);if(a){var l,h=this.apiHost,u=this.Ro;(null==(l=u)?void 0:l.apiHost)===h&&u.rewriteRequestPath===s||(u={apiHost:h,rewriteRequestPath:s,urls:new Set},this.Ro=u),u.urls.add(a)}}return r}isIngestionEndpoint(t){var e=this.Ro,i=this.Eo(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.Io(t,e,this.uiHost+e);if("flags"===t)return this.Io(t,e,this.flagsApiHost+e);if("assets"===t){var i=this.Mo(e);if(i)return this.Io(t,e,""+i+e)}if(this.region===La)return this.Io(t,e,this.apiHost+e);var r=Ua+e;switch(t){case"assets":return this.Io(t,e,"https://"+this.region+"-assets."+r);case"api":return this.Io(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}Ms(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.Ms(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.vs=e,this.Po=new Map,this.ls=!1}add(t){var i=this;return e((function*(){if(i.ls)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(i.Po.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');i.Po.set(t.name,t);try{var e=t.setup(i.vs);e&&(yield e)}catch(e){var r=i.Po.get(t.name)===t;r&&i.Po.delete(t.name),i.I.error('Failed to set up browser extension "'+t.name+'"',e),r&&i.Ao(t)}}))()}getExtension(t){return this.Po.get(t)}dispose(){if(!this.ls){this.ls=!0;var t=Array.from(this.Po.values()).reverse();for(var e of(this.Po.clear(),t))this.Ao(e)}}Ao(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.ls=!1,this.instance=t,this.I=Kr,this.Fo=t.Oo,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.ls)return co((()=>{}));var e=e=>{try{t(e)}catch(t){this.I.error("Browser extension remote config listener failed",t)}},i=this.instance.Lo.on(Za,e);return this.Fo&&e(this.Fo),co(i)},this.Do=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.Do.add(t)}getExtension(t){return this.Do.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.$o(t))}handleRemoteConfig(t){this.ls||(this.Fo=t,this.instance.Lo.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.ls||(this.ls=!0,this.Do.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 No(){return this.__forceAllowLocalhost}set No(t){Kr.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class _l{qo(t,e){if(t){var i=this.Po.indexOf(t);-1!==i&&this.Po.splice(i,1)}return this.Po.push(e),null==e.initialize||e.initialize(),e}jo(){return this.config.cookieless_mode===vt||this.config.cookieless_mode===dt&&this.consent.isRejected()}Bo(){if(!this.jo()&&this.get_distinct_id()===nt){var t=this.persistence;if(t){this.Ho()||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.Uo()}}}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.zo=!1,this.version=s.LIB_VERSION,this.Wo=new Set,this.Vo="",this.Lo=new Ta,this.Po=[],this.Go=[],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.Zo=!1,this.Qo=null,this.Jo=null,this.Ko=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.Yo(e.debug),this.Xo=e,this.tl=[],e.person_profiles?this.Jo=e.person_profiles:e.process_person&&(this.Jo=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.Ho();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.Vo="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!c&&As.Br()){var f=As.zr(this.Vo);oe(f)&&f.forEach((t=>{de(t)&&this.Wo.add(t)}))}else As.$r(this.Vo);var p=i({},this.persistence.props),_=i({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.el=new ba((t=>this.il(t)),this.config.request_queue_config),this.rl=new xa(this),this.__request_queue=[];var g=this.jo();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.nl()}))),this.sl(),this.config.__preview_deferred_init_extensions?(Kr.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.al(g)}),0)):(Kr.info("Initializing extensions synchronously"),this.al(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.ol())):this.ol(),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}ll(t){var e=t;return de(e.name)&&ae(e.setup)}ul(t,e){this.ll(t)?e.push((()=>{this.hl().add(t).catch((()=>null==t.dispose?void 0:t.dispose())).catch((e=>{Kr.error('Failed to dispose browser extension "'+t.name+'"',e)}))})):this.Po.push(t)}sl(){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.dl)||r.call(this),this.dl=void 0,this.featureFlags=new o(this)),ae(this.featureFlags.onReloading)&&ae(this.featureFlags.setup)?this.dl||(this.dl=this.featureFlags.onReloading((()=>{this.Lo.emit("featureFlagsReloading",!0)})),this.hl().add(this.featureFlags)):null==(s=(n=this.featureFlags).initialize)||s.call(n))}al(t){var e,r,s,n,o,a,l,h=performance.now(),u=i({},_l.__defaultExtensionClasses,this.config.__extensionClasses),d=[];u.exceptions&&this.Po.push(this.exceptions=null!==(e=this.exceptions)&&void 0!==e?e:new u.exceptions(this)),u.historyAutocapture&&this.Po.push(this.historyAutocapture=new u.historyAutocapture(this)),u.tracingHeaders&&this.Po.push(this.tracingHeaders=new u.tracingHeaders(this)),u.siteApps&&this.Po.push(this.siteApps=new u.siteApps(this)),u.sessionRecording&&!t&&this.Po.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||d.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),u.autocapture&&this.ul(this.autocapture=new u.autocapture(this),d),u.surveys&&this.ul(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new u.surveys(this),d),u.logs&&this.ul(this.logs=null!==(s=this.logs)&&void 0!==s?s:new u.logs(this),d),u.metrics&&this.Po.push(this.metrics=null!==(n=this.metrics)&&void 0!==n?n:new u.metrics(this)),u.conversations&&this.Po.push(this.conversations=null!==(o=this.conversations)&&void 0!==o?o:new u.conversations(this)),u.productTours&&this.Po.push(this.productTours=new u.productTours(this)),u.heatmaps&&this.Po.push(this.heatmaps=new u.heatmaps(this)),u.webVitalsAutocapture&&this.Po.push(this.webVitalsAutocapture=new u.webVitalsAutocapture(this)),u.exceptionObserver&&this.Po.push(this.exceptionObserver=new u.exceptionObserver(this)),u.deadClicksAutocapture&&this.Po.push(this.deadClicksAutocapture=new u.deadClicksAutocapture(this,$n)),u.toolbar&&this.Po.push(this.toolbar=null!==(a=this.toolbar)&&void 0!==a?a:new u.toolbar(this)),u.experiments&&this.Po.push(this.experiments=null!==(l=this.experiments)&&void 0!==l?l:new u.experiments(this)),this.Po.forEach((t=>{t.initialize&&d.push((()=>{null==t.initialize||t.initialize()}))})),d.push((()=>{if(this.vl){var t=this.vl;this.vl=void 0,this.Po.forEach((e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t)))}})),this.cl(d,h)}cl(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void setTimeout((()=>{this.cl(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)")}ka(t){var e;if(!kt||!kt.body)return Kr.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.ka(t)}),500);if(this.config.__preview_deferred_init_extensions&&(this.vl=t),this.Oo=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.Jo?this.Jo:pt}),null==(e=this.fl)||e.handleRemoteConfig(t),this.Po.forEach((e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t)))}ol(){try{this.config.loaded(this)}catch(t){Kr.critical("`loaded` function failed",t)}if(this.pl(),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.jo())&&this.gl()}),1),this.ml=new ko(this),this.ml.load()}pl(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.el)||t.enable())}_dom_loaded(){this.is_capturing()&&Yr(this.__request_queue,(t=>this.il(t))),this.__request_queue=[],this.pl()}_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.yl()&&this.capture(yt),null==(i=this.logs)||i.flushLogs("sendBeacon"),null==(r=this.el)||r.unload(),null==(s=this.rl)||s.unload()):this.yl()&&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}))}il(t){this.rl?this.rl.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.el){if(this.is_capturing())if(!ue(t)&&de(t)){this.Bo();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.bl||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._l(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.In(f);if(!k)return;(f=k).uuid=Di(f.uuid,cs)}this.Lo.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.il(P):this.el.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.fl)?void 0:e.getExtension(t)}hl(){var t;return null!==(t=this.fl)&&void 0!==t?t:this.fl=new tl(this)}$o(t){this.Go.push(t);var e=!0;return()=>{if(e){e=!1;var i=this.Go.indexOf(t);-1!==i&&this.Go.splice(i,1)}}}wl(t){var e,i,r;return void 0===t&&(t=!0),!(null==(e=this.persistence)||!e.consumeCookieIdentityChange())&&(this.Ko=null,this.persistence.get_property(X)===ct&&(null==(r=this.sessionPersistence)||r.clear(),this.Wo.clear(),this.kl()),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.wl();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.jo()&&(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.rl)?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.Go.length>0)for(var y of this.Go.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.Sl();return l.$process_person_profile=w,w&&!o&&this.xl("_calculate_event_properties"),l}_l(t,e,i){var r;if(void 0===e&&(e=!0),void 0===i&&(i=!1),!this.persistence||!this.Sl())return t;if(this.zo&&!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.zo=!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.wl(),null==(i=this.sessionPersistence)||i.register(t),Object.keys(t).forEach((t=>this.Wo.add(t))),this.kl()}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.Wo.delete(t),this.kl()}Cl(t,e){this.register({[t]:e})}nl(){this.Wo.forEach((t=>{var e;null==(e=this.sessionPersistence)||e.unregister(t)})),this.Wo.clear(),this.kl()}kl(){var t;if(this.Vo)if("memory"===this.config.persistence||null!=(t=this.sessionPersistence)&&t.Qs||!As.Br())As.$r(this.Vo);else{var e=[];this.Wo.forEach((t=>e.push(t))),e.length>0?As.Hr(this.Vo,e):As.$r(this.Vo)}}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.Lo.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})}Tl(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.Tl(t)&&this.xl("posthog.identify")){this.Bo();var r=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==r,n=this.wl(!1),o=this.persistence.Ys(),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.Xs(),this.capture(bt,{distinct_id:t,$anon_distinct_id:u},{$set:e||{},$set_once:i||{}}),this.Ko=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.Xs(),this.capture("$set",{$set:p,$set_once:_}),this.Ko=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.ia(l)}}}setPersonProperties(t,e){if((t||e)&&this.xl("posthog.setPersonProperties")){var i=Na(this.get_distinct_id(),t,e);this.Ko!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}}),this.Ko=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.xl("posthog.unsetPersonProperties")&&(null==(e=this.featureFlags)||e.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.Ko=null)}group(t,e,r){var s;if(t&&e){null==(s=this.persistence)||s.syncCookieProperties(),this.wl();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.xl("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.Ml(e,!1,i)}Ml(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.Xo)?void 0:s.bootstrap)||{},null==(n=this.featureFlags)||null==n.updateConfig||n.updateConfig(this.config,this.Sa());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.Ys?void 0:o.Ys(),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.Wo.clear(),this.kl(),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.Ko=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.jo()||(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.ia||A.ia(p))}this.reloadFeatureFlags()}shutdown(t){var i=this;return e((function*(){var t,e,r,s,n;if(i.__loaded){i.hl().dispose(),null==(t=i.sessionRecording)||t.dispose(),null==(e=i.logs)||e.flushLogs("sendBeacon"),null==(r=i.metrics)||r.flush("sendBeacon"),null==(s=i.el)||s.unload(),null==(n=i.rl)||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.El()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(t=this.conversations)||t.Il()}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.xl("posthog.alias")?(ue(e)&&(e=this.get_distinct_id()),t!==e?(this.Cl(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.Ho();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.Yo(this.config.debug);ge(m)&&(this.config.debug=m),ge(this.config.debug)&&(this.config.debug?(s.DEBUG=!0,ys.Br()&&ys.Hr("ph_debug",!0),Kr.info("set_config",{config:t,oldConfig:e,newConfig:i({},this.config)})):(s.DEBUG=!1,ys.Br()&&ys.$r("ph_debug"))),null==(n=this.featureFlags)||null==n.updateConfig||n.updateConfig(this.config,this.Sa()),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.Uo(),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.Rl}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}Sl(){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]))}yl(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.Sl()||this.xl("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.xl("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}xl(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.Cl(st,!0),!0)}Ho(){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)}Uo(){var t,e,i,r,s,n=this.Ho();return this.is_capturing()||null==(i=this.logs)||i.Pl(),(null==(t=this.persistence)?void 0:t.Qs)!==n&&(null==(r=this.persistence)||r.set_disabled(n)),(null==(e=this.sessionPersistence)?void 0:e.Qs)!==n&&(null==(s=this.sessionPersistence)||s.set_disabled(n)),n&&(this.Wo.clear(),this.kl()),n}opt_in_capturing(t){var e;if(this.config.cookieless_mode!==vt){if(this.jo()){var i,r,s,n,o;this.Ml(!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.qo(this.sessionRecording,new l(this)),this.Oo&&(null==(a=this.sessionRecording)||null==a.onRemoteConfig||a.onRemoteConfig(this.Oo)))}var h,u;this.consent.optInOut(!0),this.Uo(),this.pl(),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.gl()}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.Ml(!0,!0),this.consent.optInOut(!1),this.Uo(),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.gl(),this.pl())):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.Uo()}_is_bot(){return St?Ca(St,this.config.custom_blocked_useragents):void 0}gl(){kt&&("visible"===kt.visibilityState?this.Zo||(this.Zo=!0,this.capture(mt,{title:kt.title},{send_instantly:!0}),this.Qo&&(kt.removeEventListener(_t,this.Qo),this.Qo=null)):this.Qo||(this.Qo=this.gl.bind(this),ns(kt,_t,this.Qo)))}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}))}Sa(){var t=this.Xo||{};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)}In(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.Rs)?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)})}Yo(t){var e=ge(t)&&!t,i=ys.Br()&&"true"===ys.Ur("ph_debug");return!e&&(!!i||t)}}_l.__defaultExtensionClasses={},_l.Rl=(()=>{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.rs=!1,this.ns=null,this.ss=!1,this.os=!1,this.Wi={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.ls=!1,this.us=t,this.us.refresh(this.Wi),this.rageclicks=new gl(this.Wi.rageclick),this.hs=null}setup(t){this.ds(),this.vs=t;var e=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.ls?e.dispose():(this.cs=e,this.startIfEnabled())}dispose(){var t;this.ls||(this.ls=!0,this.vs=void 0,null==(t=this.cs)||t.dispose(),this.cs=void 0,this.fs())}ps(){return this.us.refresh(this.Wi),this.Wi}ds(){var t,e;return this.ps(),this.Wi.url_allowlist=null==(t=this.Wi.url_allowlist)?void 0:t.map((t=>new RegExp(t))),this.Wi.url_ignorelist=null==(e=this.Wi.url_ignorelist)?void 0:e.map((t=>new RegExp(t))),this.Wi}gs(){if(this.isBrowserSupported()){if(xt&&kt){var t=this.ys=t=>{t=t||(null==xt?void 0:xt.event);try{this.bs(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.ps().capture_copied_text){var e=this._s=t=>{t=t||(null==xt?void 0:xt.event);try{this.bs(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")}fs(){this.ys&&(null==kt||kt.removeEventListener("submit",this.ys,!0),null==kt||kt.removeEventListener("change",this.ys,!0),null==kt||kt.removeEventListener("click",this.ys,!0),this.ys=void 0),this._s&&(null==kt||kt.removeEventListener("copy",this._s,!0),null==kt||kt.removeEventListener("cut",this._s,!0),null==kt||kt.removeEventListener("paste",this._s,!0),this._s=void 0),this.rs=!1}startIfEnabled(){!this.ls&&this.vs&&this.isEnabled&&!this.rs&&(this.gs(),this.rs=!0)}onRemoteConfig(t){if(!this.ls)if(this.ss=!0,t.ok){var e=t.config;e.elementsChainAsString&&(this.os=e.elementsChainAsString);var i,r=e.autocapture_opt_out;ge(r)&&(null==(i=this.vs)||i.kv.set(d,r),this.ns=r),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(t){this.hs=t}getElementSelectors(t){var e,i=[];return null==(e=this.hs)||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.ls)return!1;var i=null==(t=this.vs)?void 0:t.kv.get(d),r=this.ns,s=this.ps(),n=s.remoteRequestsDisabled&&!this.ss;if(ce(r)&&!ge(i)&&!n)return!1;var o=null!==(e=this.ns)&&void 0!==e?e:!!i;return!!s.enabled&&!o}bs(t,e){if(void 0===e&&(e="$autocapture"),this.isEnabled){var r=Qs(t);qs(r)&&(r=r.parentNode||null);var s,n=this.ds();"$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.bs(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.os,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.vs)||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.Sa(),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.Al=!1,this.Fl=[],this.Ol=null,this.Ll=null,this.ls=!1,this.Dl=new Set,this.onRemoteConfig=t=>{if(!this.ls&&!this.Wi.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.$l=ge(e)?e:e.length>0,qa.info("flags response received, isSurveysEnabled: "+this.$l),this.loadIfEnabled()}},this.us=t,this.Nl=e}setup(t){if(!this.ls)return this.ql=t,Kl(t.kv.initialize(),(()=>{if(this.ql===t&&!this.ls){this.ql=void 0,this.vs=t;var e=t.onRemoteConfig(this.onRemoteConfig);this.ls?e.dispose():(this.cs=e,this.loadIfEnabled())}}))}dispose(){var t,e,i;this.ls||(this.ls=!0,this.ql=void 0,this.vs=void 0,null==(t=this.cs)||t.dispose(),this.cs=void 0,null==(e=this._surveyEventReceiver)||e.dispose(),this._surveyEventReceiver=null,null==(i=this._surveyManager)||null==i.dispose||i.dispose(),this._surveyManager=null,this.Fl=[],this.Ol=null,this.Dl.forEach((t=>clearTimeout(t))),this.Dl.clear())}get Wi(){return this.us.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.ls&&this.vs){var t=this.Wi;if(!this._surveyManager)if(this.Al)qa.info("Already initializing surveys, skipping...");else if(t.disableSurveys)qa.info(Yl);else if(t.cookielessMode&&this.us.isOptedOut())qa.info("Not loading surveys in cookieless mode without consent.");else{var e=this.us.getExtensions();if(e){if(!ue(this.$l)||t.advancedEnableSurveys){var i=this.$l||t.advancedEnableSurveys;this.Al=!0;try{var r=e.generateSurveys;if(r)return this.jl(r,i),void(this.Al=!1);var s=e.loadExternalDependency;if(!s)return this.Bl(ut),void(this.Al=!1);s((t=>{try{if(this.ls)return;var e=this.us.getExtensions();t||null==e||!e.generateSurveys?this.Bl("Could not load surveys script",t):this.jl(e.generateSurveys,i)}finally{this.Al=!1}}))}catch(t){throw this.Al=!1,this.Bl("Error initializing surveys",t),t}}}else qa.error("PostHog Extensions not found.")}}}jl(t,e){this.ls||(this._surveyManager=t(e),this._surveyEventReceiver=this.us.createEventReceiver(),qa.info("Surveys loaded successfully"),this.Hl({isLoaded:!0}))}Bl(t,e){qa.error(t,e),this.Hl({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.Fl.push(t),this._surveyManager&&this.Hl({isLoaded:!0}),()=>{this.Fl=this.Fl.filter((e=>e!==t))}}getSurveys(t,e){var i;void 0===e&&(e=!1);var r=null!==(i=this.vs)&&void 0!==i?i:this.Nl;if(r&&!this.ls){if(this.Wi.disableSurveys)return qa.info(Yl),t([]);var s=r.kv.get(z);if(s&&!e)return t(s,{isLoaded:!0}),void(this.Ul()&&this.getSurveys((()=>{}),!0));if(this.Ol)this.Ol.then((e=>{this.ls||t(e.surveys,e.context)})).catch((t=>qa.error("Error in survey callback",t)));else{var n=this.zl("/api/surveys/",{method:"GET",query:{token:r.projectToken},sentAt:"query",timeoutMs:this.Wi.requestTimeoutMs}).then((t=>{try{return this.Wl(r,t)}catch(t){return qa.error("Error processing surveys response",t),this.Wl(r,{statusCode:0,error:t})}}),(t=>this.Wl(r,{statusCode:0,error:t})));this.Ol=n;var o=()=>{this.Ol===n&&(this.Ol=null)};n.then((e=>{o(),this.ls||t(e.surveys,e.context)}),o).catch((t=>qa.error("Error in survey callback",t)))}}}zl(t,e){var i=this.vs;return i?i.sendRequest(t,e):new Promise((t=>t({statusCode:0,error:new Error(Jl)})))}Wl(t,e){if(this.ls)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.Ll=Date.now(),{surveys:[],context:{isLoaded:!1,error:r}}}this.Ll=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}}}Ul(){return this.Vl()&&!this.Ol&&!this.Gl()}Vl(){var t,e,i=null==(t=null!==(e=this.vs)&&void 0!==e?e:this.Nl)?void 0:t.kv.get(q);return pe(i)&&Date.now()-i>3e5}Gl(){return pe(this.Ll)&&3e5>Date.now()-this.Ll}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){}}Hl(t){for(var e of this.Fl)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")}Zl(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}Ql(t){if(fe(this._surveyManager))return{eligible:!1,reason:Jl};var e="string"==typeof t?this.Zl(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}Jl(t){if(fe(this._surveyManager))return{eligible:!1,reason:Jl};var e="string"==typeof t?this.Zl(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.Jl(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.Jl(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.Zl(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.Dl.delete(o),this.ls||(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.Dl.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.Zl(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.Ql(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.Kl=new Set,this.Yl=new Set,this.Xl=new Ta,this.tu=(t,e)=>this.eu(t,e)&&this.iu(t,e)&&this.ru(t,e)&&this.nu(t,e),this.eu=(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.su=null==(e=this._instance)?void 0:e._addCaptureHook(((t,e)=>{this.on(t,e)})))}dispose(){var t;null==(t=this.su)||t.call(this),this.su=void 0,this.Xl=new Ta}register(t){var e,i;if(!ue(null==(e=this._instance)?void 0:e._addCaptureHook)&&(t.forEach((t=>{var e;this.Kl.add(t),null==(e=t.steps)||e.forEach((t=>{this.Yl.add((null==t?void 0:t.event)||"")}))})),null!=(i=this._instance)&&i.autocapture)){var r=new Set;this.Kl.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.Kl.clear(),this.Yl.clear(),this.register(t)}on(t,e){null!=e&&0!=t.length&&(this.Yl.has(t)||this.Yl.has(e.event))&&this.Kl.forEach((t=>{this.au(e,t)&&this.Xl.emit("actionCaptured",t.name)}))}ou(t){this.onAction("actionCaptured",(e=>t(e)))}au(t,e){if(null==(null==e?void 0:e.steps))return!1;for(var i of e.steps)if(this.tu(t,i))return!0;return!1}onAction(t,e){return this.Xl.on(t,e)}iu(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}ru(t,e){return!!this.lu(t,e)&&!!this.uu(t,e)&&!!this.hu(t,e)}lu(t,e){var i;if(null==e||!e.href)return!0;var r=this.du(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")}uu(t,e){var i;if(null==e||!e.text)return!0;var r=this.du(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))))}hu(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}du(t){var e;return null==(null==t||null==(e=t.properties)?void 0:e.$elements)?[]:null==t?void 0:t.properties.$elements}nu(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.vu=[],this._instance=t,this.cu=new Map,this.fu=new Map,this.pu=new Map,this.gu=null==(e=this._instance)||null==e.onSessionId?void 0:e.onSessionId((t=>this.mu(t)))}yu(t){return!1}bu(){return null}_u(t){}wu(){}ku(t,e){return!!t&&Da(t.propertyFilters,null==e?void 0:e.properties)}Su(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}xu(t,e,i){var r=(i===po.Activation?this.cu:this.fu).get(t),s=[];return this.Cu((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.ku(n,e)}))}register(t){this.Tu(t,!1)}replace(t){this.Tu(t,!0)}Tu(t,e){var i;ue(null==(i=this._instance)?void 0:i._addCaptureHook)||(this.Mu(t,e),this.Eu(t,e))}Eu(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.pu.clear(),0!==i.length){this.Iu||(this.Iu=new Zl(this._instance),this.Iu.init(),this.Iu.ou((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.pu.get(e.name))&&void 0!==i?i:[];s.includes(t.id)||s.push(t.id),this.pu.set(e.name,s)}}))})),e?this.Iu.replace(r):this.Iu.register(r)}else{var s;e&&(null==(s=this.Iu)||s.replace([]))}}Ru(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)}))}Mu(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.Su(t,po.Activation),a=this.Su(t,po.Cancellation);e?(this.cu=o,this.fu=a):(this.Ru(this.cu,o),this.Ru(this.fu,a)),(0!==s.length||0!==n.length)&&(null!==(i=this.su)&&void 0!==i||(this.su=null==(r=this._instance)?void 0:r._addCaptureHook(((t,e)=>{this.onEvent(t,e)}))))}onEvent(t,e){var i,r,s=this.Pu(),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.Au(t,n);if("consume"===o)return s.info("event consumed activated item, removing it",{event:t,itemId:n}),void this.Fu([n]);if("persist"===o)return s.info("shown item promoted to persisted activation",{event:t,itemId:n}),this.Ou(n),void this.Lu([n])}if(this.fu.has(t)){var a=this.xu(t,e,po.Cancellation);a.length>0&&(s.info("cancel event matched, cancelling items",{event:t,itemsToCancel:a.map((t=>t.id))}),this.Fu(a.map((t=>t.id))),a.forEach((t=>this.Du(t.id))))}if(this.cu.has(t)){s.info("event name matched",{event:t,eventPayload:e,items:this.cu.get(t)});var l=this.xu(t,e,po.Activation);this.$u(l.map((t=>t.id)))}}onAction(t){this.pu.has(t)&&this.$u(this.pu.get(t)||[])}$u(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.yu(s)?this.Ou(s)&&this.Nu(s):r.push(s);r.length>0&&(this.vu=[...new Set([...this.vu,...r])]),this.Pu().info("updating activated items",{activatedItems:this.getActivatedIds()})}}Ou(t){this.vu=this.vu.filter((e=>e!==t));var e=this.qu();return!e.includes(t)&&(this.ju([...e,t]),this.Bu(),!0)}Fu(t){var e=new Set(t);this.vu=this.vu.filter((t=>!e.has(t)));var i=this.Hu(),r=i.filter((t=>!e.has(t)));r.length!==i.length&&(this.ju(r),0===r.length&&this.Uu()),this.Lu(t)}zu(){var t,e=this.bu();if(!e)return{};var i=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[e];return i&&"object"==typeof i?i:{}}Nu(t){if(this.bu()){var e=this.zu();this._u(i({},e,{[t]:Date.now()}))}}Lu(t){if(this.bu()){var e=this.zu(),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.wu():this._u(i))}}Wu(){this.bu()&&this.wu()}getActivationTimestamp(t){if(this.qu().includes(t)){var e=this.zu()[t];return pe(e)?e:void 0}}Hu(){var t,e=this.Vu();return(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[e])||[]}qu(){var t,e,i=this.Hu();if(0===i.length)return[];var r=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[this.Gu()],s=null==(e=this._instance)||null==e.get_session_id?void 0:e.get_session_id();return s&&r===s?i:[]}Bu(){var t,e=null==(t=this._instance)||null==t.get_session_id?void 0:t.get_session_id();e&&this.Zu(e)}Uu(){this.Qu()}mu(t){var e,i=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[this.Gu()];if(i&&i!==t){var r=this.Hu(),s=this.zu();r.length>0&&(this.ju([]),r.filter((t=>pe(s[t]))).forEach((t=>this.Du(t)))),this.Uu(),this.Wu()}}getActivatedIds(){return[...new Set([...this.qu(),...this.vu])].filter((t=>!this.Ju(t)))}dispose(){var t,e,i;null==(t=this.gu)||t.call(this),this.gu=void 0,null==(e=this.su)||e.call(this),this.su=void 0,null==(i=this.Iu)||i.dispose(),this.Iu=void 0}reset(){this.vu=[],this.Hu().length>0&&this.ju([]),this.Uu(),this.Wu()}getEventToItemsMap(){return this.cu}Ku(){return this.Iu}}class eh extends th{constructor(t){super(t)}Vu(){return H}Gu(){return V}bu(){return W}_u(t){var e;null==(e=this._instance)||null==(e=e.persistence)||e.register({[W]:t})}wu(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(W)}yu(t){var e,i;this.Cu((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}Yu(){return go.SHOWN}Cu(t){var e;null==(e=this._instance)||e.getSurveys(t)}Du(t){var e;null==(e=this._instance)||e.cancelPendingSurvey(t)}Pu(){return qa}ju(t){var e;null==(e=this._instance)||null==(e=e.persistence)||e.register({[H]:t})}Zu(t){var e;null==(e=this._instance)||null==(e=e.persistence)||e.register({[V]:t})}Qu(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(V)}Ju(){return!1}Au(t,e){var i;this.Cu((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.Xu=!1,this.update(t,e)}update(t,e){this.th=((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.Xu||(ah.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Xu=!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.th}}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 Wi(){return this._instance.config}constructor(t){var e=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),e.getWebExperiments((t=>{bh.eh("retrieved web experiments from the server"),e.ih=new Map,t.forEach((t=>{if(t.feature_flag_key){var i;e.ih&&(bh.eh("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(i=e.ih)||i.set(t.feature_flag_key,t));var r=e._instance.getFeatureFlag(t.feature_flag_key);de(r)&&t.variants[r]&&e.rh(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var n=t.variants[s];bh.nh(n,e._instance)&&e.rh(t.name,s,n.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((t=>{this.onFeatureFlags(t)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())bh.eh(mh);else if(!this.Wi.disable_web_experiments){if(fe(this.ih))return this.ih=new Map,this.loadIfEnabled(),void this.previewWebExperiment();bh.eh("applying feature flags",t),t.forEach((t=>{var e;if(this.ih&&null!=(e=this.ih)&&e.has(t)){var i,r=this._instance.getFeatureFlag(t),s=null==(i=this.ih)?void 0:i.get(t);r&&null!=s&&s.variants[r]&&this.rh(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.eh("previewing web experiments "+e+" && "+i),this.getWebExperiments((t=>{this.sh(parseInt(e),i,t)}),!1,!0))}}loadIfEnabled(){this.Wi.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,e,i){if(this.Wi.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.Wi.token),method:"GET",timestampMode:"query",callback:e=>t(200===e.statusCode&&e.json&&e.json.experiments||[])})}sh(t,e,i){var r=i.filter((e=>e.id===t));r&&r.length>0&&(bh.eh("Previewing web experiment ["+r[0].name+"] with variant ["+e+"]"),this.rh(r[0].name,e,r[0].variants[e].transforms))}static nh(t,e){return!fe(t.conditions)&&bh.ah(t,e)&&bh.oh(t)}static ah(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 oh(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 eh(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)}rh(t,e,i){this._is_bot()?bh.eh(mh):"control"!==e?i.forEach((i=>{if(i.selector){var r;bh.eh("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.eh("Control variants leave the page unmodified.")}_is_bot(){return St&&this._instance?Ca(St,this.Wi.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.lh=!1,this.featureFlagEventHandlers=[],this.I=hh,this.uh={},this.hh={},this.dh=[],this.fh=!1,this.ph=!1,this.gh=0,this.mh=!1,this.yh=!1,this.bh=!1,this._h=!1,this.wh=0,this.It=()=>{var t=this.kh();this.wh=0,t&&this.reloadFeatureFlags()},this.Sh=()=>{var t,e=this.xh;ue(e)||this.Wi.remoteRequestsDisabled||!kt||"hidden"===kt.visibilityState||Date.now()-(null!==(t=this.Ch)&&void 0!==t?t:0)<e||(this.reloadFeatureFlags(),this.Th())},this.Et=()=>{"visible"===(null==kt?void 0:kt.visibilityState)&&this.Sh()},"get"in t?this.us=t:(this.Mh=new lh(t.config,t.Sa()),this.us=this.Mh)}updateConfig(t,e){var i;null==(i=this.Mh)||i.update(t,e),this.vs&&this.Eh()}setup(t){return this.ql=t,this.I=t.logger.createLogger("[FeatureFlags]"),Kl(t.kv.initialize(),(()=>{this.ql===t&&(this.ql=void 0,this.vs=t,this.Ih(t))}))}Ih(t){if(this.vs===t)return xt&&ns(xt,"online",this.It),this.Eh(),this.Rh=t.registerDynamicEventProperties((()=>this.Ph()?this.uh:this.hh)),this.Ah(),this.initialize()}Eh(){var t=this.Wi.refreshIntervalMs,e=!this.Wi.remoteRequestsDisabled&&kt&&!ue(t)&&t>0?t:void 0;e!==this.xh&&(this.Fh(),ue(e)||(this.xh=e,this.Th(),null!=kt&&kt.addEventListener&&ns(kt,_t,this.Et)))}Th(){ue(this.xh)||(ue(this.Oh)||clearInterval(this.Oh),this.Ch=Date.now(),this.Oh=setInterval(this.Sh,this.xh))}Fh(){ue(this.Oh)||(clearInterval(this.Oh),this.Oh=void 0,null==kt||null==kt.removeEventListener||kt.removeEventListener(_t,this.Et)),this.xh=void 0,this.Ch=void 0}destroy(){this.Lh()}dispose(){this.Lh()}Lh(){var t;this.Fh(),this.gh++,this.yh=!1,this.ql=void 0,this.vs&&(this.Dh(),null==(t=this.Rh)||t.dispose(),this.Rh=void 0,this.dh=[],null==xt||xt.removeEventListener("online",this.It),this.vs=void 0)}get Wi(){return this.us.get()}$h(t){var e;return null==(e=this.vs)?void 0:e.kv.get(t)}Hr(t){this.Nh((()=>{var e;return null==(e=this.vs)?void 0:e.kv.set(t)}))}$r(t){this.Nh((()=>{var e;return null==(e=this.vs)?void 0:e.kv.remove(t)}))}Nh(t){try{t()}catch(t){this.I.error("Failed to update feature flag persistence",t)}}Ah(){var t={};for(var e of[O,F,M,N]){var r=this.$h(e);ue(r)||(t[e]=r)}this.uh=t;var s=i({},t),n=this.$h(C);if(n)for(var o of Object.entries(n))s["$feature/"+o[0]]=o[1];this.hh=s}Ph(){var t=this.Wi.cacheTtlMs;if(!t||0>=t)return!1;var e=this.$h(Q);return"number"!=typeof e||Date.now()-e>t}qh(){return!!this.Ph()&&(this._h||this.ph||(this._h=!0,this.I.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}jh(){var t=this.Wi.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})):[]}Bh(){var t=this.Wi.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.Wi,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.Hh({featureFlags:a,featureFlagPayloads:l})}}updateFlags(t,e,r){var s,n,o=null!=r&&r.merge&&null!==(s=this.$h(C))&&void 0!==s?s:{},a=null!=r&&r.merge&&null!==(n=this.$h(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.Hh({flags:u})}get hasLoadedFlags(){return this.fh}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.$h(A),e=this.$h(N),r=this.$h(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.lh||(this.I.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:r,finalDetails:s}),this.lh=!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.$h(C),e=this.$h(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.lh||(this.I.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:i}),this.lh=!0),i}getFlagPayloads(){var t=this.$h(F),e=this.$h(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.lh||(this.I.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:i}),this.lh=!0),i}reloadFeatureFlags(){this.mh||this.Wi.featureFlagsDisabled||this.kh()||this.Uh||(this.dh.slice().forEach((t=>{try{t()}catch(t){this.I.error("Error while running feature flags reloading callback",t)}})),this.Uh=setTimeout((()=>{this.zh()}),5))}Dh(){clearTimeout(this.Uh),this.Uh=void 0}onReloading(t){return this.dh.push(t),()=>{this.dh=this.dh.filter((e=>e!==t))}}ensureFlagsLoaded(){this.fh||this.ph||this.Uh||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.mh=t}resetFlagCallReported(){this.$r(K)}zh(t){this.Dh();var e=this.vs;if(e&&!this.Wi.remoteRequestsDisabled&&!this.kh())if(this.ph)this.yh=!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.$h(U)||{},{$lib:e.library.name,$lib_version:e.library.version}),group_properties:this.$h(j),timezone:so()};ue(e.deviceId)||(r.$device_id=e.deviceId),(null!=t&&t.disableFlags||this.Wi.featureFlagsDisabled)&&(r.disable_flags=!0);var s=this.jh();s.length&&(r.evaluation_contexts=s);var n=this.Bh();ue(n)||(r.flag_keys=n);var o=this.Wi.onlyEvaluateSurveyFeatureFlags,a="/flags/?v=2"+(o?"&only_evaluate_survey_feature_flags=true":""),l=this.gh;this.ph=!0;var h=()=>{this.yh&&(this.yh=!1,this.zh())},u=t=>{this.ph=!1,l===this.gh?(this.Hr({[Y]:[vh]}),this.I.error("Feature flag request failed",t),h()):h()};try{e.sendRequest(a,{target:"flags",method:"POST",body:r,compression:this.Wi.compression,sentAt:"body",timeoutMs:this.Wi.requestTimeoutMs}).then((t=>{var e,i,s=null!==(e=t.json)&&void 0!==e?e:{},n=200!==t.statusCode;if(this.ph=!1,l===this.gh){if(this.Wh(t.statusCode),n||this.yh||(this.$anon_distinct_id=void 0),!r.disable_flags||this.yh){this.bh=!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.Hr({[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.Hh(s,n,{partialResponse:o}),h()}}else h()})).catch(u)}catch(t){u(t)}}}kh(){return qn(this.wh,3)}Wh(t){this.wh=Hn(t,this.wh,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.bh)if(this.fh||this.getFlags()&&this.getFlags().length>0){if(!this.qh()){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.bh)if(this.fh||this.getFlags()&&this.getFlags().length>0){if(!this.qh()){var r,s=this.getFlagVariants(),n=t in s,o=s[t],a=this.getFlagPayloads()[t],l=String(o),h=this.$h(M)||void 0,u=this.$h(Q)||void 0,d=this.$h(K)||{};if(this.Wi.deduplicateCallsPerSession){var v,c=null==(v=this.vs)?void 0:v.session.sessionId,f=this.$h(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.Hr({[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.Hr(i({[K]:d},r?{[J]:r}:{}));var P=this.getFeatureFlagDetails(t),R=[...null!==(p=this.$h(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.Wi.bootstrap)||null==(g=g.featureFlags)?void 0:g[t])&&void 0!==_?_:null,$feature_flag_bootstrapped_payload:null!==(m=null==(y=this.Wi.bootstrap)||null==(y=y.featureFlagPayloads)?void 0:y[t])&&void 0!==m?m:null,$used_bootstrap_value:!this.bh};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.Vh(C)}else r&&this.Hr({[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)}Vh(t){try{var e;null==(e=this.vs)||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.Gh(t,e)}Gh(t,i){var r=this;return e((function*(){var e=r.vs;if(e){var s={distinct_id:e.distinctId,token:e.projectToken,person_properties:{$lib:e.library.name,$lib_version:e.library.version}},n=r.jh();n.length&&(s.evaluation_contexts=n);var o,a=r.Bh();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.Wi.compression,sentAt:"body",timeoutMs:r.Wi.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.bh)return e.defaultValue;if(!(this.fh||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.Hh(t,e,i)}Hh(t,e,r){if(this.vs){this.fh=!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.Hr(s),e||(this._h=!1),this.Zh(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.Qh(t)}Qh(t){if(this.vs){if(!1===t)return this.$r([N,L]),this.Zh(),void uh.info("All overrides cleared");if(oe(t))return this.Hr({[N]:ch(t)}),this.Zh(),void uh.info("Flag overrides set",{flags:t});if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var e,i=t;this.lh=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.Hr(r),!1===s&&!1===n?this.$r([N,L]):!1===s?this.$r(N):!1===n&&this.$r(L),this.Zh(),!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.Hr({[N]:t}),this.Zh(),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.fh){var e=this.Jh(),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.$h(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.Hr({[O]:Object.keys(fh(a)),[C]:a,[U]:i({},this.$h(U)||{},n)}),this.Zh();try{var l;null==(l=this.vs)||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.$h(I);!r||e?this.Kh(t,i):t(r)}Kh(t,i){var r=this;return e((function*(){var e=r.vs;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.Hr({[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)}}}))()}Jh(){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)),{})}}Zh(t){this.Ah();var e=this.Jh(),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.Yh(t,e)}Yh(t,e){void 0===e&&(e=!0);var r=this.$h(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.Hr({[U]:i({},r,o,s)}),e&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,e){void 0===e&&(e=!0);var r=i({},this.$h(U)||{});t.forEach((t=>{delete r[t]})),this.Hr({[U]:r}),e&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t){void 0===t&&(t=!0),this.$r(U),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,e){void 0===e&&(e=!0);var r=this.$h(j)||{},s=i({},r);for(var n of Object.keys(t))s[n]=i({},r[n],t[n]);this.Hr({[j]:s}),e&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var e=this.$h(j)||{};this.Hr({[j]:i({},e,{[t]:{}})})}else this.$r(j)}reset(){this.gh++,this.yh=!1,this.uh={},this.hh={},this.fh=!1,this.mh=!1,this.bh=!1,this.$anon_distinct_id=void 0,this.Dh(),this.lh=!1,this.wh=0}}},Ch={sessionRecording:class{get Wi(){return this._instance.config}get Qa(){return this._instance.persistence}get started(){var t;return!(null==(t=this.Xh)||!t.isStarted)}get status(){var t,e;return this.td===Nl||this.td===Ll?this.td:null!==(t=null==(e=this.Xh)?void 0:e.status)&&void 0!==t?t:this.td}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.td=Ml,this.ed=void 0,this.rd=!1,this._t=(()=>{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.Et=()=>{var t;"visible"===(null==kt?void 0:kt.visibilityState)&&(this._t=!0,null==(t=this.Xh)||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.Wi.cookieless_mode===vt)throw new Error(Ul+' cannot be used with cookieless_mode="always"');null!=kt&&kt.addEventListener&&ns(kt,"visibilitychange",this.Et)}initialize(){this.startIfEnabledOrStop()}dispose(){this.rd=!0,null==kt||null==kt.removeEventListener||kt.removeEventListener("visibilitychange",this.Et),this.stopRecording()}get nd(){var t,e=!(null==(t=this._instance.get_property(w))||!t.enabled),i=!this.Wi.disable_session_recording,r=this.Wi.disable_session_recording||this._instance.consent.isOptedOut();return xt&&e&&i&&!r}startIfEnabledOrStop(t){var e;if(!(this.rd||this.nd&&null!=(e=this.Xh)&&e.isStarted)){var i=!ue(Object.assign)&&!ue(Array.from);this.nd&&i?(this.sd(t),jl.info("starting")):(this.td=Ml,this.stopRecording())}}sd(t){var e,i,r;this.nd&&(this.td!==Nl&&this.td!==Ll&&(this.td=Dl),null!=Ft&&null!=(e=Ft.__PosthogExtensions__)&&null!=(e=e.rrweb)&&e.record&&null!=(i=Ft.__PosthogExtensions__)&&i.initSessionRecording?this.ad(t):null==(r=Ft.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.od,(e=>{if(e)return this._instance.register_for_session({[ht]:!0}),jl.error("could not load recorder",e);this.ad(t)})))}stopRecording(){var t,e;null==(t=this.ed)||t.call(this),this.ed=void 0,null==(e=this.Xh)||e.stop()}ld(){var t,e;null==(t=this.ed)||t.call(this),this.ed=void 0,null==(e=this.Xh)||e.discard()}ud(){var t,e;null==(t=this.Qa)||t.unregister(R),null==(e=this.Qa)||e.unregister(x)}hd(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}dd(t){if(this.Qa){var e,r,s=this.Qa,n=()=>{var e,r=!1===t.sessionRecording?void 0:t.sessionRecording,n=this.hd(null==(e=this.Wi.session_recording)?void 0:e.sampleRate,"session_recording.sampleRate"),o=this.hd(null==r?void 0:r.sampleRate,"remote config sampleRate"),a=null!=n?n:o;fe(a)&&this.ud();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.ed)||e.call(this),this.ed=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.dd(e),void this.ld()):(this.dd(e),void this.startIfEnabledOrStop()):(this.td===Nl&&(this.td=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.Xh)&&i.log?this.Xh.log(t,e):jl.warn("log called before recorder was ready")}get od(){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"}vd(){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}ad(t){var e,i,r;if(!this.rd){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.Xh||(this.Xh=null==(s=Ft.__PosthogExtensions__)?void 0:s.initSessionRecording(this._instance,this._t),this.Xh._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.vd()){if(this.td===Ll||this.td===Nl)return;return this.td=Nl,jl.info("persisted remote config is stale, requesting fresh config before starting"),void new ko(this._instance).load()}this.td=Dl,null==(i=(r=this.Xh).setDocumentWasEverVisible)||i.call(r,this._t),this.Xh.start(t)}}onRRwebEmit(t){var e;null==(e=this.Xh)||null==e.onRRwebEmit||e.onRRwebEmit(t)}overrideLinkedFlag(){var t,e;this.Xh||null==(e=this.Qa)||e.register({[S]:!0}),null==(t=this.Xh)||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.Xh||null==(e=this.Qa)||e.register({[E]:!0}),null==(t=this.Xh)||t.overrideSampling()}overrideTrigger(t){var e,i;this.Xh||null==(i=this.Qa)||i.register({["url"===t?k:T]:!0}),null==(e=this.Xh)||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.Xh)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var i;return!(null==(i=this.Xh)||!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.fd=this.pd()}initialize(){this.startIfEnabled()}get isEnabled(){var t=this.gd();return!!(t.path||t.search||this.md(t))}startIfEnabled(){this.isEnabled&&(Kr.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.fd=this.pd(),this.startIfEnabled()}stop(){this.yd&&this.yd(),this.yd=void 0,this.bd&&this.bd(),this.bd=void 0,Kr.info("History API monitoring stopped")}monitorHistoryChanges(){xt&&xt.history&&(this._d("pushState"),this._d("replaceState"),this.wd(),this.md()&&this.kd())}_d(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.Sd(t)}))}}pd(){var t=null==xt?void 0:xt.location;if(null!=t&&t.pathname)return{pathname:t.pathname,search:t.search,hash:t.hash}}gd(){var t=this._instance.config.capture_pageview;return"history_change"===t?{path:!0}:le(t)?t:{}}md(t){return void 0===t&&(t=this.gd()),!!t.hash&&!this._instance.config.disable_capture_url_hashes}xd(t){var e=this.gd(),i=this.fd;return!(!i||!(e.path&&t.pathname!==i.pathname||e.search&&t.search!==i.search||this.md(e)&&t.hash!==i.hash))}Sd(t){try{var e=this.pd();if(!e)return;this.xd(e)&&this._instance.capture(mt,{navigation_type:t}),this.fd=e}catch(e){Kr.error("Error capturing "+t+" pageview",e)}}wd(){if(!this.yd){var t=()=>{this.Sd("popstate")};ns(xt,"popstate",t),this.yd=()=>{xt&&xt.removeEventListener("popstate",t)}}}kd(){if(!this.bd){var t=()=>{this.Sd("hashchange")};ns(xt,"hashchange",t),this.bd=()=>{xt&&xt.removeEventListener("hashchange",t)}}}},heatmaps:class{get Wi(){return this.instance.config}constructor(t){var e;this.Cd=!1,this.rs=!1,this.Td=null,this.instance=t,this.Cd=!(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.Wi.capture_heatmaps)&&this.Wi.capture_heatmaps.flush_interval_milliseconds&&(t=this.Wi.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return fe(this.Wi.capture_heatmaps)?fe(this.Wi.enable_heatmaps)?this.Cd:this.Wi.enable_heatmaps:!1!==this.Wi.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.rs)return;Bl.info("starting..."),this.Md(),this.Et()}else{var t;clearInterval(null!==(t=this.Td)&&void 0!==t?t:void 0),this.Ed(),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.Cd=i,this.startIfEnabled()}}}getAndClearBuffer(){var t=this.yt;return this.yt=void 0,t}Id(t){zl(t.originalEvent)&&this.Ii(t.originalEvent,"deadclick")}Et(){this.Td&&clearInterval(this.Td),this.Td="visible"===(null==kt?void 0:kt.visibilityState)?setInterval(this.qa.bind(this),this.flushIntervalMilliseconds):null}Md(){xt&&kt&&(this.Rd=this.qa.bind(this),ns(xt,gt,this.Rd),this.Pd=t=>this.Ii(t||(null==xt?void 0:xt.event)),ns(kt,"click",this.Pd,{capture:!0}),this.Ad=t=>this.Fd(t||(null==xt?void 0:xt.event)),ns(kt,"mousemove",this.Ad,{capture:!0}),this.Od=new Pn(this.instance,Tn,this.Id.bind(this)),this.Od.startIfEnabledOrStop(),this.Ld=this.Et.bind(this),ns(kt,_t,this.Ld),this.rs=!0)}Ed(){var t;xt&&kt&&(this.Rd&&xt.removeEventListener(gt,this.Rd),this.Pd&&kt.removeEventListener("click",this.Pd,{capture:!0}),this.Ad&&kt.removeEventListener("mousemove",this.Ad,{capture:!0}),this.Ld&&kt.removeEventListener(_t,this.Ld),clearTimeout(this.Dd),null==(t=this.Od)||t.stop(),this.rs=!1)}$d(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}}Ii(t,e){var r;if(void 0===e&&(e="click"),!js(t.target)&&zl(t)){var s=this.$d(t,e);null!=(r=this.rageclicks)&&r.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&ln(Qs(t),this.instance.config.rageclick)&&this.Wn(i({},s,{type:"rageclick"})),this.Wn(s)}}Fd(t){!js(t.target)&&zl(t)&&(clearTimeout(this.Dd),this.Dd=setTimeout((()=>{this.Wn(this.$d(t,"mousemove"))}),500))}Wn(t){if(xt){var e=this.Wi.disable_capture_url_hashes?Li(xt.location.href):xt.location.href,i=this.Wi.custom_personal_data_properties,r=this.Wi.mask_personal_data_properties?[...Wn,...i||[]]:[],s=Bn(e,r,Kn);this.yt=this.yt||{},this.yt[s]||(this.yt[s]=[]),this.yt[s].push(t)}}qa(){this.yt&&!he(this.yt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Pn,webVitalsAutocapture:class{constructor(t){var e;this.Cd=!1,this.rs=!1,this.yt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Nd=()=>{clearTimeout(this.qd),this.qd=void 0,0!==this.yt.metrics.length&&(this._instance.capture("$web_vitals",i({$current_url:this.yt.url},this.yt.metrics.reduce(((t,e)=>i({},t,{["$web_vitals_"+e.name+"_event"]:i({},e),["$web_vitals_"+e.name+"_value"]:e.value})),{}))),this.yt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.jd=t=>{var e;if(this.yt=this.yt||{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.Bd(r);if(!ue(s)){var n=pe(t.navigationId)||"string"==typeof t.navigationId?"navigation:"+t.navigationId:"url:"+s;if(!this.Hd||this.Hd>t.value){this.yt.navigationKey!==n&&(this.Nd(),this.qd=setTimeout(this.Nd,this.flushToCaptureTimeoutMs)),ue(this.yt.navigationKey)&&(this.yt.navigationKey=n,this.yt.url=s),this.yt.firstMetricTimestamp=ue(this.yt.firstMetricTimestamp)?Date.now():this.yt.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.Bd(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.yt.metrics.push(a),this.yt.metrics.length===this.allowedMetrics.length&&this.Nd()}else Cl.error("Ignoring metric with value >= "+this.Hd,t)}}},this.Ud=()=>{if(!this.rs){var t,e,r,s,n=!1,o=Ft.__PosthogExtensions__,a=null==o?void 0:o.postHogWebVitalsCallbacksByFlavor,l=(null==a?void 0:a[this.zd])||("web-vitals"===this.zd&&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.jd.bind(this),d),this.allowedMetrics.indexOf("CLS")>-1&&e(this.jd.bind(this),d),this.allowedMetrics.indexOf("FCP")>-1&&r(this.jd.bind(this),d),this.allowedMetrics.indexOf("INP")>-1&&s(this.jd.bind(this),v),this.rs=!0}else Cl.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.Cd=!(null==(e=this._instance.persistence)||!e.props[_]),this.startIfEnabled()}get Wd(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e,i=le(this.Wd)?null==(t=this.Wd)?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.Wd)?this.Wd.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){var t=le(this.Wd)?this.Wd.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.Wd)?this.Wd.__preview_web_vitals_soft_navs:void 0;return null!=t&&t}get Hd(){var t=le(this.Wd)&&pe(this.Wd.__web_vitals_max_value)?this.Wd.__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.Wd)?this.Wd.web_vitals:ge(this.Wd)?this.Wd:void 0;return ge(e)?e:this.Cd}startIfEnabled(){this.isEnabled&&!this.rs&&(Cl.info("enabled, starting..."),this.Ms(this.Ud))}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.Cd=i,this.startIfEnabled()}}}get zd(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}Ms(t){var e=Ft.__PosthogExtensions__,i=this.zd,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()}))}Bd(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.Ud=()=>{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.Vd&&this.Wi.capture_unhandled_errors&&(this.Vd=e(this.captureException.bind(this))),!this.Gd&&this.Wi.capture_unhandled_rejections&&(this.Gd=i(this.captureException.bind(this))),!this.Zd&&this.Wi.capture_console_errors&&(this.Zd=r(this.captureException.bind(this)))}catch(t){kl.error("failed to start",t),this.Qd()}}},this._instance=t,this.Jd=!(null==(e=this._instance.persistence)||!e.props[c]),this.oe=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.Wi=this.Kd(),this.startIfEnabledOrStop()}Kd(){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.Jd:t)&&(e=i({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Wi.capture_console_errors||this.Wi.capture_unhandled_errors||this.Wi.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(kl.info("enabled"),this.Qd(),this.Ms(this.Ud)):this.Qd()}Ms(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()}))}Qd(){var t,e,i;null==(t=this.Vd)||t.call(this),this.Vd=void 0,null==(e=this.Gd)||e.call(this),this.Gd=void 0,null==(i=this.Zd)||i.call(this),this.Zd=void 0}onRemoteConfig(t){if(t.ok){var e=t.config;"autocaptureExceptions"in e&&(this.Jd=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[c]:this.Jd}),this.Wi=this.Kd(),this.startIfEnabledOrStop())}}onConfigChange(){this.Wi=this.Kd()}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.oe.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.Yd=[],this.Xd=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.Yd=null!==(e=null==(r=this._instance.persistence)?void 0:r.get_property(f))&&void 0!==e?e:[],this.tv=Hr(this.ev()),this.iv=new Vr(this.tv)}onConfigChange(){this.tv=Hr(this.ev()),this.iv.setConfig(this.tv)}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.Yd=n,this._instance.persistence&&this._instance.persistence.register({[f]:this.Yd,[p]:o})}}}get rv(){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.Xd.buildFromUnknown(t,{syntheticException:null==e?void 0:e.syntheticException,mechanism:{handled:null==e?void 0:e.handled}})}addExceptionStep(t,e){if(this.tv.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.nv(e)),s=r.sanitizedProperties,n=r.droppedKeys;n.length>0&&ph.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.iv.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.sv(e)){if(this.av(e))return this.ov("Exception dropped: matched a suppression rule"),void ph.info("Skipping exception capture because a suppression rule matched");if(!this.rv&&this.lv(e))return this.ov("Exception dropped: thrown by a browser extension"),void ph.info("Skipping exception capture because it was thrown by an extension");if(!this.rv&&this.uv(e))return this.ov("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.hv(e))return this.ov("Exception dropped: thrown by the PostHog SDK"),void ph.info("Skipping exception capture because it was thrown by the PostHog SDK")}var i=this.tv.enabled&&fe(t.$exception_steps)?this.dv(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",bl:!0});return s&&this.iv.clear(),s}catch(t){return ph.error("Failed to capture exception event. Dropping this exception.",t),void this.iv.clear()}}catch(t){return void ph.error("Failed to process exception event. Ignoring this exception.",t)}var n}dv(t){try{var e=this.iv.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}}ov(t){this.tv.enabled&&this.iv.add({[jr]:t,[Br]:(new Date).toISOString()})}nv(t){return le(t)?i({},t):{}}ev(){var t,e;return null!==(t=null==(e=this._instance.config.error_tracking)?void 0:e.exception_steps)&&void 0!==t?t:{}}av(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.Yd.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}}lv(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)))}))}uv(t){return t.some((t=>{var e=t.value;return de(e)&&gh.some((t=>e.includes(t)))}))}hv(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}sv(t){return!fe(t)&&oe(t)}}},Ah=i({productTours:class{get Qa(){return this._instance.persistence}constructor(t){this.vv=null,this.fv=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.Qa&&this.Qa.register({[m]:!!e.productTours}),!Hl(this._instance))return!this.vv&&fe(null==(i=this.Qa)?void 0:i.props[G])||ql.info("product tours disabled; stopping and clearing cached tours"),null==(r=this.vv)||r.stop(),this.vv=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.vv&&Hl(this._instance)&&this.Ms((()=>this.pv()))}Ms(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()}))}pv(){var t;!this.vv&&null!=(t=Ft.__PosthogExtensions__)&&t.generateProductTours&&(this.vv=Ft.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e){if(void 0===e&&(e=!1),!oe(this.fv)||e){var i=this.Qa;if(i){var r=i.props[G];if(oe(r)&&!e)return this.fv=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.fv=n,i&&i.register({[G]:n}),t(n,{isLoaded:!0})}else t([],{isLoaded:!0})}})}else t(this.fv,{isLoaded:!0})}getActiveProductTours(t){fe(this.vv)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.vv.getActiveProductTours(t)}showProductTour(t){var e;null==(e=this.vv)||e.showTourById(t)}previewTour(t){this.vv?this.vv.previewTour(t):this.Ms((()=>{var e;this.pv(),null==(e=this.vv)||e.previewTour(t)}))}dismissProductTour(){var t;null==(t=this.vv)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.vv)||t.nextStep()}previousStep(){var t;null==(t=this.vv)||t.previousStep()}clearCache(){var t;this.fv=null,null==(t=this.Qa)||t.unregister(G)}resetTour(t){var e;null==(e=this.vv)||e.resetTour(t)}resetAllTours(){var t;null==(t=this.vv)||t.resetAllTours()}cancelPendingTour(t){var e;null==(e=this.vv)||e.cancelPendingTour(t)}}},Rh),Fh={siteApps:class{constructor(t){this.gv=0,this._instance=t,this.mv=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}yv(t,e){if(e){var i=this.globalsForEvent(e);this.mv.push(i),this.mv.length>1e3&&(this.mv=this.mv.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.yv.bind(this));this.bv=()=>{t(),this.mv=[],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}}_v(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}wv(){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.gv++,this.Sv)return this.xv();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._v(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.Sv=()=>{u.forEach((t=>t())),this.Sv=void 0},this.xv()}xv(){var t=!1;return()=>{var e;t||(t=!0,this.gv--,0===this.gv&&(null==(e=this.Sv)||e.call(this)))}}Cv(t,e){void 0===e&&(e=!0);var i=this.wv();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.mv.length&&(Wl.info("Processing "+this.mv.length+" events for site app with id "+t.id),this.mv.forEach((t=>this.Cv((()=>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.Cv((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}}Tv(){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)}Mv(t){var e=this;if(0!==Object.keys(this.apps).length){var i=this.globalsForEvent(t),r=function(r){try{e.Cv((()=>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.Tv(),void this._instance.on("eventCaptured",(t=>this.Mv(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.Ev=void 0,this.Iv=void 0,this.Rv=void 0,this.Ud=()=>{var t,e,i=this.Pv();i?(ue(this.Ev)&&(this.Ev=null==(t=Ft.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchXHR(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),ue(this.Iv)&&(this.Iv=null==(e=Ft.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)?void 0:e._patchFetch(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.Qd()},this._instance=t}initialize(){this.startIfEnabledOrStop()}Ms(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()}))}Av(){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}Pv(){var t=this.Av();return oe(t)?(oe(this.Rv)?this.Rv.splice(0,this.Rv.length,...t):this.Rv=[...t],t.length>0?this.Rv:void 0):(oe(this.Rv)&&this.Rv.splice(0),this.Rv=t||void 0,this.Rv)}Qd(){var t,e;null==(t=this.Ev)||t.call(this),null==(e=this.Iv)||e.call(this),this.Ev=void 0,this.Iv=void 0}startIfEnabledOrStop(){this.Pv()?this.Ms(this.Ud):this.Qd()}}},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}zl(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}Fv(t){Ft.ph_toolbar_state=t}Ov(){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}}Lv(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.Ov())this.Lv(s);else if(0===this.Ov()){var n;this.Fv(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.Fv(0);this.Fv(2),this.Lv(s)})),ns(xt,"turbolinks:load",(()=>{this.Fv(0),this.loadToolbar(s)}))}return!0}Dv(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.$v=void 0,this._conversationsManager=null,this.Nv=!1,this.Me=null,this.qv=!1,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations&&(this.jv=t.ok,t.ok)){var e=t.config.conversations;fe(e)||(ge(e)?this.$v=e:(this.$v=e.enabled,this.Me=e),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.$v=void 0,this.Me=null,this.jv=void 0,this.qv=!1}loadIfEnabled(){if(!(this._conversationsManager||this.Nv||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.$v)&&this.$v)if(this.Me&&this.Me.token){this.Nv=!0;try{var e=t.initConversations;if(e)return this.Bv(e),void(this.Nv=!1);var i=t.loadExternalDependency;if(!i)return void this.Hv(ut);i(this._instance,"conversations",(e=>{e||!t.initConversations?this.Hv("Could not load conversations script",e):this.Bv(t.initConversations),this.Nv=!1}))}catch(t){this.Hv("Error initializing conversations",t),this.Nv=!1}}else wh.error("Conversations enabled but missing token in remote config.")}}Bv(t){if(this.Me)try{this._conversationsManager=t(this.Me,this._instance),this.qv=!1,wh.info("Conversations loaded successfully")}catch(t){this.Hv("Error completing conversations initialization",t)}else wh.error("Cannot complete initialization: remote config is null")}Hv(t,e){wh.error(t,e),this._conversationsManager=null,this.Nv=!1,this.qv=!0}show(){this._conversationsManager?this._conversationsManager.show():wh.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.$v&&!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.jv?"remote_config_failed":ue(this.$v)?this.jv?"disabled_in_project":"remote_config_pending":this.$v?fe(this.Me)||!this.Me.token?"missing_token":null!=Ft&&Ft.__PosthogExtensions__?this.Nv?"initializing":this.qv?"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}El(){var t;null==(t=this._conversationsManager)||t.setIdentity()}Il(){var t;null==(t=this._conversationsManager)||t.clearIdentity()}}},jh={logs:class{constructor(t){var e,r=this;this.name="logs",this.Uv=!1,this.zv=!1,this.Wv=!1,this.I=Jr("[logs]"),this.Vv=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.Ma=[],this.Gv=[],this.wh=0,this.ls=!1,this.Zv=[],this.Qv=[],this.Jv=!1,this.Kv=!1,this.Yv=()=>{var t,e;this.ls||(this.wh=0,null==(t=this.Xv)||t.onReconnect(),null==(e=this.tc)||e.onReconnect())},this._instance=t,this._instance&&null!=(e=this._instance.config.logs)&&e.captureConsoleLogs&&(this.Uv=!0),xt&&ns(xt,"online",this.Yv)}ec(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.ic(t,e),n,this.Vv,(()=>this.rc()),(t=>t()),void 0,r),n]}nc(){var t,e=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.Xv||this.sc!==e){var i;null==(i=this.Xv)||i.reset(),this.sc=e;var r=this.ec((()=>this.Ma),(t=>{this.Ma=t}));this.Xv=r[0],this.ac=r[1]}return this.Xv}oc(){var t,e=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.tc||this.lc!==e){var i;null==(i=this.tc)||i.reset(),this.lc=e;var r=this.ec((()=>this.Gv),(t=>{this.Gv=t}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},kh);this.tc=r[0],this.uc=r[1]}return this.tc}setup(t){var e;if(!this.ls){this.vs=t,null!=(e=this._instance)&&null!=(e=e.config)&&null!=(e=e.logs)&&e.captureConsoleLogs&&(this.Uv=!0),(this.Uv||this.hc()&&this.dc())&&this.vc();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.ls?r.dispose():(this.cs=r,i||this.loadIfEnabled())}}dispose(){var t,e,i,r;this.ls||(this.ls=!0,this.cc(),null==(t=this.cs)||t.dispose(),this.cs=void 0,this.vs=void 0,this.Wv=!1,null==xt||xt.removeEventListener("online",this.Yv),null==(e=this.fc)||e.call(this),this.fc=void 0,null==(i=this.Xv)||i.reset(),null==(r=this.tc)||r.reset())}onRemoteConfig(t){var e,i;if(!this.ls){var r=t.ok?null==(e=t.config.logs)?void 0:e.captureConsoleLogs:void 0;fe(r)?this.gc():(null==(i=this._instance)||null==(i=i.persistence)||i.register({[y]:!!r}),r?(this.Uv=!0,this.zv||this.vc(),this.loadIfEnabled()):this.gc())}}reset(){var t,e,i,r;this.cc(),null==(t=this.Xv)||t.clearQueue(),this.Ma=[],null==(e=this.Xv)||e.reset(),null==(i=this.tc)||i.clearQueue(),this.Gv=[],null==(r=this.tc)||r.reset(),this.wh=0}captureLog(t){this.ls||this.nc().captureLog(t)}captureConsoleLog(t){this.ls||this.oc().captureLog(t)}captureBufferedConsoleLog(t,e,i){this.ls||this.oc().captureLog(t,{context:e,occurredAtMs:i})}dc(){var t;return!(null==(t=this._instance)||null==(t=t.persistence)||null==(t=t.props)||!t[y])}hc(){var t,e;return null==(t=this._instance)||null==t.Sa||!t.Sa()||!(null==(e=Ft._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])||!e.config)}Pl(){var t;this.cc(),null==(t=this.tc)||t.clearQueue(),this.Gv=[]}gc(){this.Uv||this.cc()}vc(){var t,e=this;if(!this.Jv&&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.Qv.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.mc(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.Jv=!0,this.yc=setTimeout((()=>{this.cc()}),3e4)}}mc(t,e,i){var r;if(this.Jv&&!this.Kv&&0!==e.length)if(null!=(r=this._instance)&&r.is_capturing()){if(i>this.Zv.length){this.Kv=!0;try{this.Zv.push({level:t,args:e,occurredAtMs:Date.now(),context:this.rc()})}finally{this.Kv=!1}}}else this.cc()}cc(){if(this.Zv=[],this.Jv){for(var t of(this.Jv=!1,this.yc&&(clearTimeout(this.yc),this.yc=void 0),this.Qv))t();this.Qv=[]}}bc(){var t=this.Zv;return this.cc(),t}get logger(){return this._c||(this._c={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._c}flushLogs(t){t?this.wc(t):(this.Xv&&this.Xv.flush().catch((t=>this.kc(t))),this.tc&&this.tc.flush().catch((t=>this.kc(t))))}kc(t){Ph(t)||this.I.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(!this.ls&&this.Uv&&!this.zv&&!this.Wv){var t=null==Ft?void 0:Ft.__PosthogExtensions__;if(!t)return this.I.error("PostHog Extensions not found."),void this.cc();var e=t.loadExternalDependency;if(!e)return this.I.error(ut),void this.cc();this.Wv=!0;try{e(this._instance,"logs",(e=>{if(this.Wv=!1,!this.ls&&this.Uv){var i=t.logs;if(e||null==i||!i.initializeLogs)this.I.error("Could not load logs script",e),this.cc();else{var r,s,n=this.bc();this.fc=i.initializeLogs(null!==(r=this.vs)&&void 0!==r?r:this._instance),this.zv=!0,n.length>0&&(null==i.replayConsoleBuffer||i.replayConsoleBuffer(null!==(s=this.vs)&&void 0!==s?s:this._instance,n))}}}))}catch(t){throw this.Wv=!1,t}}}ic(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:[])},On:t=>this.On(t),getLibraryId:()=>s.LIB_NAME,getLibraryVersion:()=>s.LIB_VERSION}}On(t){return new Promise((e=>{if(qn(this.wh,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.Sc(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:t=>{var e=t.statusCode;if(this.xc(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)})}}})}}))}xc(t){(0!==t||this._instance.__loaded)&&(this.wh=Hn(t,this.wh,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."))))}wc(t){this.Ma.length>0&&this.Cc(t,this.Ma,this.ac,s.LIB_NAME,(t=>{this.Ma=t})),this.Gv.length>0&&this.Cc(t,this.Gv,this.uc,kh,(t=>{this.Gv=t}))}Cc(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.Sc(),data:a,compression:"best-available",batchKey:"logs",transport:t})}}Sc(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}rc(){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(){}nc(){var t,e,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.metrics;return this.Xv&&this.sc===i||(null==(e=this.Xv)||e.reset(),this.sc=i,this.Xv=new vr(this.ic(),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.Xv}count(t,e,i){void 0===e&&(e=1),this.nc().count(t,e,i)}gauge(t,e,i){this.nc().gauge(t,e,i)}histogram(t,e,i){this.nc().histogram(t,e,i)}flush(t){if(!this.Xv)return Promise.resolve();if(t){var e=this.Xv.drainWindow();return e&&this.Jn(e,t),Promise.resolve()}return this.Xv.flush().catch((t=>this.I.error("PostHog metrics flush failed:",t)))}reset(){var t;null==(t=this.Xv)||t.reset()}ic(){var t=this._instance,e=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},Jn:t=>e.Jn(t),getLibraryId:()=>s.LIB_NAME,getLibraryVersion:()=>s.LIB_VERSION}}Jn(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.Tc(),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)})}}}))}))}Tc(){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
|