PageSourceSearch

https://www.listening.com/assets/client-CPFuoOry.js

js listening.com collected 2026-10-01 10:24:25 UTC 301,127 bytes, 12 lines download raw bytes

1(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{};e.SENTRY_RELEASE={id:`798154dfe6f02312abe2ebb46dcac5b55267091e`},e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:listening-web":!0});var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`1a1f717c-3d79-4470-ac77-2e841b6d3b41`,e._sentryDebugIdIdentifier=`sentry-dbid-1a1f717c-3d79-4470-ac77-2e841b6d3b41`)}catch{}})();import{a as e,n as t}from"./jsx-runtime-HLTtilDO.js";import{t as n}from"./compiler-runtime-UO9gZYRt.js";var r=n(),i=`u`>typeof window?window:void 0,a=`u`>typeof globalThis?globalThis:i,o=a?.navigator,s=a?.document,c=a?.location,l=a?.fetch,u=a?.XMLHttpRequest&&`withCredentials`in new a.XMLHttpRequest?a.XMLHttpRequest:void 0,d=a?.AbortController,f=a?.CompressionStream,p=o?.userAgent;function m(){return!(!i||!1===i.navigator.onLine)}var h=typeof globalThis<`u`?globalThis:i;h&&typeof self>`u`&&(h.self=h),h&&typeof File>`u`&&(h.File=function(){});var g=i??{},_=`0.9.0`,v={DEBUG:!1,LIB_VERSION:_,LIB_NAME:`browser-common`,JS_SDK_VERSION:_},y=function(e){return e.AnonymousId=`anonymous_id`,e.DistinctId=`distinct_id`,e.Props=`props`,e.EnablePersonProcessing=`enable_person_processing`,e.PersonMode=`person_mode`,e.FeatureFlagDetails=`feature_flag_details`,e.FeatureFlags=`feature_flags`,e.FeatureFlagPayloads=`feature_flag_payloads`,e.BootstrapFeatureFlagDetails=`bootstrap_feature_flag_details`,e.BootstrapFeatureFlags=`bootstrap_feature_flags`,e.BootstrapFeatureFlagPayloads=`bootstrap_feature_flag_payloads`,e.OverrideFeatureFlags=`override_feature_flags`,e.Queue=`queue`,e.AiQueue=`ai_queue`,e.AiCaptureQueue=`ai_capture_queue`,e.LogsQueue=`logs_queue`,e.OptedOut=`opted_out`,e.SessionId=`session_id`,e.SessionStartTimestamp=`session_start_timestamp`,e.SessionLastTimestamp=`session_timestamp`,e.PersonProperties=`person_properties`,e.GroupProperties=`group_properties`,e.InstalledAppBuild=`installed_app_build`,e.InstalledAppVersion=`installed_app_version`,e.SessionReplay=`session_replay`,e.PushRegistered=`push_registered`,e.SessionReplayEventTriggerActivatedSession=`session_replay_event_trigger_activated_session`,e.SurveyLastSeenDate=`survey_last_seen_date`,e.SurveysSeen=`surveys_seen`,e.Surveys=`surveys`,e.RemoteConfig=`remote_config`,e.FlagsEndpointWasHit=`flags_endpoint_was_hit`,e.DeviceId=`device_id`,e}({}),b=function(e){return e.GZipJS=`gzip-js`,e.Base64=`base64`,e}({}),x=[`$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`],S=[`token`];function C(e,t){return e.indexOf(t)!==-1}var w=function(e){return e.trim()},ee=function(e){return e.replace(/^\$/,``)};function te(e){let t=[];return JSON.stringify(e,function(e,n){if(typeof n==`bigint`)return n.toString();if(typeof n!=`function`&&typeof n!=`symbol`){if(n instanceof Error)return{name:n.name,message:n.message,stack:n.stack};if(n&&typeof n==`object`){for(;t.length>0&&t[t.length-1]!==this;)t.pop();if(t.includes(n))return`[Circular]`;t.push(n)}return n}})??`null`}var ne=Object.prototype,T=ne.hasOwnProperty,re=ne.toString,E=Array.isArray||function(e){return re.call(e)===`[object Array]`},D=e=>typeof e==`function`,O=e=>e===Object(e)&&!E(e),k=e=>{if(O(e)){for(let t in e)if(T.call(e,t))return!1;return!0}return!1},A=e=>e===void 0,j=e=>re.call(e)==`[object String]`,ie=e=>j(e)&&e.trim().length===0,M=e=>e===null,N=e=>A(e)||M(e),P=e=>re.call(e)==`[object Number]`&&e==e,F=e=>P(e)&&e>0,I=e=>re.call(e)===`[object Boolean]`,ae=e=>C(x,e),oe=e=>C(S,e);function se(e){return typeof e!=`object`||!e}function ce(e,t){return{}.toString.call(e)===`[object ${t}]`}function le(e){switch({}
1.toString.call(e)){case`[object Error]`:case`[object Exception]`:case`[object DOMException]`:case`[object DOMError]`:case`[object WebAssembly.Exception]`:return!0;default:return de(e,Error)}}function ue(e){return`u`>typeof Event&&de(e,Event)}function de(e,t){try{return e instanceof t}catch{return!1}}var fe=[!0,`true`,1,`1`,`yes`],pe=e=>C(fe,e),me=[!1,`false`,0,`0`,`no`];function he(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function L(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){he(a,r,i,o,s,`next`,e)}function s(e){he(a,r,i,o,s,`throw`,e)}o(void 0)})}}var ge=`amazonbot,amazonproductbot,app.hypefactors.com,applebot,archive.org_bot,awariobot,backlinksextendedbot,baiduspider,bingbot,bingpreview,chrome-lighthouse,dataforseobot,deepscan,duckduckbot,facebookexternal,facebookcatalog,http://yandex.com/bots,hubspot,ia_archiver,leikibot,linkedinbot,meta-externalagent,mj12bot,msnbot,nessus,petalbot,pinterestbot,prerender,rogerbot,screaming frog,sebot-wa,sitebulb,slackbot,slurp,trendictionbot,turnitin,twitterbot,vercel-screenshot,vercelbot,yahoo! slurp,yandexbot,zoombot,bot.htm,bot.php,(bot;,bot/,crawler,ahrefsbot,ahrefssiteaudit,semrushbot,siteauditbot,splitsignalbot,gptbot,oai-searchbot,chatgpt-user,perplexitybot,better uptime bot,sentryuptimebot,uptimerobot,headlesschrome,cypress,google-hoteladsverifier,adsbot-google,apis-google,duplexweb-google,feedfetcher-google,google favicon,google web preview,google-read-aloud,googlebot,googleother,google-cloudvertexbot,googleweblight,mediapartners-google,storebot-google,google-inspectiontool,bytespider`.split(`,`),_e=function(e,t=[]){if(!e)return!1;let n=e.toLowerCase();return ge.concat(t).some(e=>{let t=e.toLowerCase();return n.indexOf(t)!==-1})};function ve(e,t,n,r,i){return t>n&&(r.warn(`min cannot be greater than max.`),t=n),P(e)?e>n?(r.warn(` cannot be  greater than max: `+n+`. Using max value instead.`),n):t>e?(r.warn(` cannot be less than min: `+t+`. Using min value instead.`),t):e:(r.warn(` must be a number. using max or fallback. max: `+n+`, fallback: `+i),ve(i??n,t,n,r))}var ye=class{constructor(e){this.C={},this.I=e.I,this.R=ve(e.bucketSize,0,100,e.$),this.A=ve(e.refillRate,0,this.R,e.$),this.O=ve(e.refillInterval,0,864e5,e.$)}F(e,t){let n=Math.floor((t-e.lastAccess)/this.O);n>0&&(e.tokens=Math.min(e.tokens+n*this.A,this.R),e.lastAccess+=n*this.O)}consumeRateLimit(e){var t;let n=Date.now(),r=String(e),i=this.C[r];return i?this.F(i,n):(i={tokens:this.R,lastAccess:n},this.C[r]=i),i.tokens===0||(i.tokens--,i.tokens===0&&((t=this.I)==null||t.call(this,e)),i.tokens===0)}stop(){this.C={}}},be=`Mobile`,xe=`Android`,Se=`Tablet`,Ce=`Android Tablet`,we=`iPad`,Te=`Apple Watch`,Ee=`Safari`,De=`BlackBerry`,Oe=`Samsung Internet`,ke=`Chrome`,Ae=`Chrome iOS`,je=`Internet Explorer`,Me=`Internet Explorer Mobile`,Ne=`Opera`,Pe=`Microsoft Edge`,Fe=`Firefox`,Ie=`Firefox iOS`,Le=`Nintendo`,Re=`PlayStation`,ze=`Xbox`,Be=`Android Mobile`,Ve=`Mobile Safari`,He=`Windows`,Ue=`Windows Phone`,We=`Nokia`,Ge=`Ouya`,Ke=`Generic `+be.toLowerCase(),qe=`Generic `+Se.toLowerCase(),Je=`Konqueror`,Ye=`Oculus Browser`,Xe=`Vivaldi`,Ze=`Yandex`,Qe=`Whale`,$e=`DuckDuckGo`,et=`Pale Moon`,tt=`Waterfox`,nt=`Brave`,rt=`Claude`,it=`Codex`,at=`ChatGPT`,ot=`Google Search App`,st=RegExp(`Version/(\\d+(\\.\\d+)?)`),ct=RegExp(`(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)`),lt=new RegExp(ze,`i`),ut=RegExp(`PlayStation \\w+`,`i`),dt=RegExp(`Nintendo \\w+`,`i`),ft=RegExp(`BlackBerry|PlayBook|BB10`,`i`),pt={"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`},mt=function(e,t,n,r){return t||=``,function(e){return e?.brave?nt:null}(n)||(r?.detectGoogleSearchApp&&C(e,`GSA/`)?ot:C(e,` OPR/`)&&C(e,`Mini`)?`Opera Mini`:C(e,` OPR/`)?Ne:ft.test(e)?De:C(e,`IEMobile`)||C(e,`WPDesktop`)?Me:C(e,`OculusBrowser`)?Ye:C(e,`SamsungBrowser`)?Oe:C(e,`Edge`)||C(e,`Edg/`)?Pe:C(e,`Vivaldi/`)?Xe:C(e,`YaBrowser/`)?Ze:C(e,`Whale/`)?Qe:C(e,`DuckDuckGo/`)||C(e,`Ddg/`)?$e:C(e,`Claude/`)?rt:C(e,`Codex/`)?it:C(e,`ChatGPT/`)?at:C(e,`FBIOS`)?`Facebook Mobile`:C(e,`UCWEB`)||C(e,`UCBrowser`)?`UC Browser`:C(e,`CriOS`)?Ae:C(e,`CrMo`)||C(e,ke)?ke:C(e,xe)&&C(e,Ee)?Be:C(e,`FxiOS`)?Ie:C(e.toLowerCase(),Je.toLowerCase())?Je:C(e,`Brave/`)?nt:((e,t)=>t&&C(t,`Apple`)||function(e){return C(e,Ee)&&!C(e,ke)&&!C(e,xe)}(e))(e,t)?C(e,be)?Ve:Ee:C(e,`PaleMoon/`)?et:C(e,`Waterfox/`)?tt:C(e,Fe)?Fe:C(e,`MSIE`)||C(e,`Trident/`)?je:C(e,`Gecko`)?Fe:``)},ht={[Me]:[RegExp(`rv:(\\d+(\\.\\d+)?)`)],[Pe]:[RegExp(`Edge?\\/(\\d+(\\.\\d+)?)`)],[ke]:[RegExp(`(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)`)],[Ae]:[RegExp(`CriOS\\/(\\d+(\\.\\d+)?)`)],"UC Browser":[RegExp(`(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)`)],[Ee]:[st],[Ve]:[st],[Ne]:[RegExp(`(Opera|OPR)\\/(\\d+(\\.\\d+)?)`)],[Fe]:[RegExp(`Firefox\\/(\\d+(\\.\\d+)?)`)],[Ie]:[RegExp(`FxiOS\\/(\\d+(\\.\\d+)?)`)],[Je]:[RegExp(`Konqueror[:/]?(\\d+(\\.\\d+)?)`,`i`)],[De]:[RegExp(`BlackBerry (\\d+(\\.\\d+)?)`),st],[Be]:[RegExp(`android\\s(\\d+(\\.\\d+)?)`,`i`)],[Oe]:[RegExp(`SamsungBrowser\\/(\\d+(\\.\\d+)?)`)],[Ye]:[RegExp(`OculusBrowser\\/(\\d+(\\.\\d+)?)`)],[Xe]:[RegExp(`Vivaldi\\/(\\d+(\\.\\d+)?)`)],[Ze]:[RegExp(`YaBrowser\\/(\\d+(\\.\\d+)?)`)],[Qe]:[RegExp(`Whale\\/(\\d+(\\.\\d+)?)`)],[nt]:[RegExp(`Brave\\/(\\d+(\\.\\d+)?)`)],[rt]:[ct],[it]:[ct],[at]:[ct],[$e]:[RegExp(`(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)`)],[et]:[RegExp(`PaleMoon\\/(\\d+(\\.\\d+)?)`)],[tt]:[RegExp(`Waterfox\\/(\\d+(\\.\\d+)?)`)],[ot]:[RegExp(`GSA\\/(\\d+(\\.\\d+)?)`)],[je]:[RegExp(`(rv:|MSIE )(\\d+(\\.\\d+)?)`)],Mozilla:[RegExp(`rv:(\\d+(\\.\\d+)?)`)]},gt=function(e,t,n,r){let i=ht[mt(e,t,n,r)];if(A(i))return null;for(let t=0;i.length>t;t++){let n=e.match(i[t]);if(n)return parseFloat(n[n.length-2])}return null},_t=[[RegExp(`Xbox; Xbox (.*?)[);]`,`i`),e=>[ze,e&&e[1]||``]],[new RegExp(Le,`i`),[Le,``]],[new RegExp(Re,`i`),[Re,``]],[ft,[De,``]],[new RegExp(He,`i`),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Ue,``];if(new RegExp(be).test(t)&&!/IEMobile\b/.test(t))return[`Windows Mobile`,``];let n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){let e=pt[n[1]]||``;return/arm/i.test(t)&&(e=`RT`),[He,e]}return[He,``]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[`iOS`,[e[3],e[4],e[5]||`0`].join(`.`)]:[`iOS`,``]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{let t=``;return e&&e.length>=3&&(t=A(e[2])?e[3]:e[2]),[`watchOS`,t]}],[RegExp(`(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)`,`i`),e=>e&&e[2]?[xe,[e[2],e[3],e[4]||`0`].join(`.`)]:[xe,``]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{let t=[`Mac OS X`,``];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||`0`].join(`.`)),t}],[/Mac/i,[`Mac OS X`,``]],[/CrOS/,[`Chrome OS`,``]],[/Linux|debian/i,[`Linux`,``]]],vt=function(e){for(let t=0;_t.length>t;t++){let[n,r]=_t[t],i=n.exec(e),a=i&&(D(r)?r(i,e):r);if(a)return a}return[``,``]},yt=function(e){return dt.test(e)?Le:ut.test(e)?Re:lt.test(e)?ze:new RegExp(Ge,`i`).test(e)?Ge:RegExp(`(Windows Phone|WPDesktop)`,`i`).test(e)?Ue:/iPad/.test(e)?we:/iPod/.test(e)?`iPod Touch`:/iPhone/.test(e)?`iPhone`:/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?Te:ft.test(e)?De:/(kobo)\s(ereader|touch)/i.test(e)?`Kobo`:new RegExp(We,`i`).test(e)?We:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?`Kindle Fire`:/(Android|ZTE)/i.test(e)?new RegExp(be).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?xe:Ce:RegExp(`(pda|Mobile)`,`i`).test(e)?Ke:new RegExp(Se,`i`).test(e)&&!RegExp(`Tablet pc`,`i`).test(e)?qe:``},bt=function(e,t){let n=yt(e);return n===we||n===Ce||n===`Kobo`||n===`Kindle Fire`||n===qe?Se:n===Le||n===ze||n===Re||n===Ge?`Console`:n===Te?`Wearable`:n?be:t?.userAgentDataPlatform===`Android`&&(t?.maxTouchPoints??0)>0?600>Math.min((r=t?.screenWidth)??0,(i=t?.screenHeight)??0)/((a=t?.devicePixelRatio)??1)?be:Se:`Desktop`;var r,i,a},xt=/\bFBAV\/(\d+(?:\.\d+)*)/i,St=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,`Instagram`],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,`Threads`],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,`Messenger`,xt],[/\bFBAN\/EMA\b/i,`Facebook Lite`,xt],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,`Facebook`,xt],[/\bLinkedInApp(?:\]?\/(\d+(?:\.\d+)*))?\b/i,`LinkedIn`],[/\bTwitter(?:Android| for (?:iPhone|iPad|Android))(?
1:\/(\d+(?:\.\d+)*))?\b/i,`Twitter`],[/\b(?:musical_ly|trill)(?:[_/](\d+\.\d+(?:\.\d+)*))?(?=\b|_)/i,`TikTok`,/\bapp_version\/(\d+(?:\.\d+)*)/i],[/\b(?:MicroMessenger|WeChat)\/(\d+(?:\.\d+)*)?/i,`WeChat`],[/\bLine\/(\d+(?:\.\d+)*)?/i,`Line`],[/\bGSA\/(\d+(?:\.\d+)*)?/i,`Google`],[/\[Pinterest\/(?:iOS|Android)\b|\bPinterest(?: for (?:Android(?: Tablet)?|iOS))?\/(\d+(?:\.\d+)*)/i,`Pinterest`],[/\b(?:WA4A|WAiOS)\/(\d+(?:\.\d+)*)?/i,`WhatsApp`],[/\bSnapchat[ /](\d+(?:\.\d+)*)?/i,`Snapchat`],[/\bBing(?:Web|Sapphire)\/(\d+(?:\.\d+)*)?/i,`Bing`],[/\bNAVER\(inapp; search;/i,`Naver`,/\bNAVER\(inapp; search;[^;)]*; (\d+(?:\.\d+)*)/i],[/\bKAKAOTALK[ /](\d+\.\d+(?:\.\d+)*)?/i,`KakaoTalk`]],Ct=`[Truncated]`,wt=`[Unserializable]`;function Tt(e){let t=``;for(let n=0;e.length>n;n++){let r=e.charCodeAt(n);if(55296>r||r>56319)t+=56320>r||r>57343?e[n]:`�`;else{let r=e.charCodeAt(n+1);56320>r||r>57343?t+=`�`:(t+=e[n]+e[n+1],n++)}}return t}function Et(e,t){if(!t)return e;let n=[];try{n=Object.keys(t)}catch{n=[]}for(let r of n){let n;try{n=t[r]}catch{n=wt}Object.defineProperty(e,r,{value:n,enumerable:!0,writable:!0,configurable:!0})}return e}var Dt=3e5,Ot=class{record(e){if(e.kind===`too-large`)return;if(e.kind!==`retry-later`)return void this.reset();if(!e.retryAfterMs)return;let t=this.isOpen(),n=Date.now(),r=Math.min(e.retryAfterMs,Dt);if(!t)return this.ts=n,void(this.es=n+r);this.es=Math.max(this.es,Math.min(n+r,this.ts+Dt))}remainingMs(){let e=Date.now();if(this.ts-5e3>e)return this.reset(),0;let t=Math.min(Dt,Math.max(0,this.es-e));return t===0&&this.reset(),t}isOpen(){return this.remainingMs()>0}reset(){this.es=0,this.ts=0}constructor(){this.es=0,this.ts=0}},kt=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function At(e,t){return typeof(n=e)==`string`&&kt.test(n)?e:t();var n}function jt(e,t){let n=Error(t);try{Object.defineProperty(n,"name",{value:e,writable:!0,enumerable:!0,configurable:!0})}catch{}return n}function Mt(e){return e&&e.split(`#`)[0]}function Nt(e){try{return e()}catch{return}}function Pt(e,t){let n=setTimeout(e,t);return n!=null&&n.unref&&n?.unref(),n}function Ft(e,t,n){return It.apply(this,arguments)}function It(){return(It=L(function*(e,t,n){let r;try{return yield Promise.race([e,new Promise((e,i)=>{r=Pt(()=>{try{n?.(),e()}catch(e){i(e)}},t)})])}finally{clearTimeout(r)}})).apply(this,arguments)}var Lt,Rt,zt;function Bt(e){let t=globalThis._posthogChunkIds;if(!t)return;let n=Object.keys(t);return zt&&n.length===Rt||(Rt=n.length,zt=n.reduce((n,r)=>{Lt||={};let i=Lt[r];if(i)n[i[0]]=i[1];else{let i=e(r);for(let e=i.length-1;e>=0;e--){let a=i[e]?.filename,o=t[r];if(a&&o){n[a]=o,Lt[r]=[a,o];break}}}return n},{})),zt}function Vt(e){return Vt=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Vt(e)}function Ht(e,t,n){return(t=function(e){var t=function(e){if(Vt(e)!=`object`||!e)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var n=t.call(e,`string`);if(Vt(n)!=`object`)return n;throw TypeError(`@@toPrimitive must return a primitive value.`)}return String(e)}(e);return Vt(t)==`symbol`?t:t+``}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ut(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function R(e){for(var t=1;arguments.length>t;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Ut(Object(n),!0).forEach(function(t){Ht(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ut(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Wt=class{constructor(e,t,n=[]){this.coercers=e,this.stackParser=t,this.modifiers=n}buildFromUnknown(e,t={}){let n=t&&t.mechanism||{handled:!0,type:`generic`},r=this.buildCoercingContext(n,t,0).apply(e),i=this.buildParsingContext(t),a=this.parseStacktrace(r,i);return{$exception_list:this.convertToExceptionList(a,n),$exception_level:`error`}}modifyFrames(e){var t=this;return L(function*(){for(let n of e)n.stacktrace&&n.stacktrace.frames&&E(n.stacktrace.frames)&&(n.stacktrace.frames=yield t.applyModifiers(n.stacktrace.frames));return e})()}coerceFallback(e){return{type:`Error`,value:`Unknown error`,stack:e.syntheticException?.stack,synthetic:!0}}parseStacktrace(e,t){let n,r;if(e.cause!=null&&(n=this.parseStacktrace(e.cause,t)),e.stack!=``&&e.stack!=null)try{r=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.ski
1pFirstLines:0),t.chunkIdMap)}catch{}return R(R({},e),{},{cause:n,stack:r,errors:e.errors?.map(e=>this.parseStacktrace(e,t))})}applyChunkIds(e,t){return e.map(e=>(e.filename&&t&&(e.chunk_id=t[e.filename]),e))}applyCoercers(e,t){for(let n of this.coercers)if(n.match(e))return n.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return L(function*(){let n=e;for(let e of t.modifiers)n=yield e(n);return n})()}convertToExceptionList(e,t){let n=[],r=(e,i,a)=>{let o=n.length,s=i===void 0?R(R({type:typeof t.type==`string`&&t.type.length>0?t.type:`generic`},typeof t.handled==`boolean`?{handled:t.handled}:t.handled===void 0?{handled:!0}:{}),{},{synthetic:typeof t.synthetic==`boolean`?t.synthetic:e.synthetic,exception_id:o}):{type:`chained`,source:a,synthetic:e.synthetic,exception_id:o,parent_id:i},c={type:e.type,value:e.value,mechanism:s};e.stack&&(c.stacktrace={type:`raw`,frames:e.stack}),n.push(c),e.cause&&r(e.cause,o,`cause`);for(let t of e.errors??[])r(t,o,`member`)};return r(e),n}buildParsingContext(e){return{chunkIdMap:Bt(this.stackParser),skipFirstLines:e.skipFirstLines??1}}getAggregateErrors(e){try{if(le(e)){let t=Object.getPrototypeOf(e);for(let n=0;t&&100>n;n++){let n=Object.getOwnPropertyDescriptor(t,`constructor`)?.value;if(typeof n==`function`&&n.name===`AggregateError`){let t=e.errors;return E(t)?t:void 0}t=Object.getPrototypeOf(t)}}}catch{}}buildCoercingContext(e,t,n=0){let r=0,i=0,a=!1,o=new Set,s=[],c={},l=(e,t,n=0)=>{let l=u(t,n),d=l.apply;if(l.apply=t=>{s.push(e);try{return d(t)}finally{s.pop()}},n>4||n>0&&s.indexOf(e)!==-1)return this.coerceFallback(l);let f=typeof e==`object`&&!!e||typeof e==`function`;if(n===0&&r>=50||f&&o.has(e))return;f&&o.add(e),n===0&&r++;let p=this.getAggregateErrors(e),m,h;a||=!!p;try{if(m=this.applyCoercers(e,l),!m)throw c}catch(e){if(e===c)return void(n===0&&r--);if(!a)throw e;m=this.coerceFallback(l)}if(!p||r>=50)return m;try{h=p.length}catch{return m}if(!Number.isInteger(h)||0>h||h>4294967295)return m;let g=[];for(let e=0;50>r&&1e3>i&&h>e;e++){let n;i++;try{n=l.next(p[e])}catch{r++,n=this.coerceFallback(u(t+1))}n&&g.push(n)}return R(R({},m),{},{errors:g})},u=(n,r=0)=>R(R({},t),{},{syntheticException:n==0?t.syntheticException:void 0,mechanism:n==0?e:{},apply(e){let t=l(e,n,r+1);if(!t)throw c;return t},next:e=>l(e,n+1)}),d=u(n);return R(R({},d),{},{apply:e=>l(e,n)??this.coerceFallback(d)})}},Gt=/^([a-z][a-z0-9.+-]+):/i,Kt=[`http`,`https`,`file`,`blob`,`app`,`capacitor`,`ionic`,`webpack`,`webpack-internal`,`ng`];function qt(e){if(!e||e===`<anonymous>`)return!1;let t=Gt.exec(e);return!t||Kt.includes(t[1].toLowerCase())}function Jt(e,t,n,r,i){let a={platform:e,filename:t,function:n===`<anonymous>`?`?`:n,in_app:qt(t)};return A(r)||(a.lineno=r),A(i)||(a.colno=i),a}var Yt=(e,t)=>{let n=e.indexOf(`safari-extension`)!==-1,r=e.indexOf(`safari-web-extension`)!==-1;return n||r?[e.indexOf(`@`)===-1?`?`:e.split(`@`)[0],n?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},Xt=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Zt=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Qt=/\((\S*)(?::(\d+))(?::(\d+))\)/,$t=(e,t)=>{let n=Xt.exec(e);if(n){let[,e,r,i]=n;return Jt(t,e,`?`,+r,+i)}let r=Zt.exec(e);if(r){if(r[2]&&r[2].indexOf(`eval`)===0){let e=Qt.exec(r[2]);e&&(r[2]=e[1],r[3]=e[2],r[4]=e[3])}let[e,n]=Yt(r[1]||`?`,r[2]);return Jt(t,n,e,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},en=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,tn=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,nn=(e,t)=>{let n=en.exec(e);if(n){if(n[3]&&n[3].indexOf(` > eval`)>-1){let e=tn.exec(n[3]);e&&(n[1]=n[1]||`eval`,n[3]=e[1],n[4]=e[2],n[5]=``)}let e=n[3],r=n[1]||`?`;return[r,e]=Yt(r,e),Jt(t,e,r,n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},rn=/\(error: (.*)\)/;function an(e,t){return e.filename===t.filename&&e.function===t.function&&e.module===t.module&&e.lineno===t.lineno&&e.colno===t.colno}function on(e){for(let t=1;10>=t;t++){let n=e.length-2*t;if(0>n)break;let r=!0;for(let i=0;t>i;i++)if(!an(e[n+i],e[n+t+i])){r=!1;break}if(r){for(let r=0;t>r;r++)e[n+r]=e[n+t+r];return e.length=n+t,{start:n,length:t}}}}function sn(e,t){let n=t.start+t.length,r=ln(e,t);r&&e.splice(n+r===e.length?n:t.start,r)}function cn(e,t){let n=t.start;for(;n>0&&an(e[n-1],e[n-1+t.length]);)n--;return t.start-n}function ln(e,t){let n=t.start+t.length,r=n;for(;e.length>r&&an(e[r],e[r-t.length]);)r++;return r-n}function un(e,t){let n=t[0],r=e.length-(n?cn(e,n):0);for(let n of t)r-=ln(e,n);return r}function dn(e,t,n){for(let r=0;e.length>r;r++){let i=e[(t+r)%e.length],a=e[(n+r)%e.length];if(i!==a)return a>i}return!1}var fn=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){let n=j(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:n?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?`DOMError`:`DOMException`}getValue(e){let t=e.name||(this.isDOMError(e)?`DOMError`:`DOMException`);return e.message?`${t}: ${e.message}`:t}isDOMException(e){return ce(e,`DOMException`)}isDOMError(e){return ce(e,`DOMError`)}},pn=class{match(e){return le(e)}coerce(e,t){let n=this.getStack(e),r=n===void 0?t.syntheticException?.stack:void 0,i=!!r;return{type:this.getType(e),value:this.getMessage(e,t),stack:n??r,cause:e.cause?t.next(e.cause):void 0,synthetic:i}}getType(e){return e.name||e.constructor.name}getMessage(e,t){let n=e.message;return String(n.error&&typeof n.error.message==`string`?n.error.message:n)}getStack(e){try{let t=e.stacktrace;if(typeof t==`string`&&t.length>0)return t;let n=e.stack;return typeof n==`string`&&n.length>0?n:void 0}catch{return}}},mn=class{match(e){return!!ce(e,`ErrorEvent`)&&(e.error!=null||this.ur(e))}coerce(e,t){if(e.error!=null)return t.apply(e.error);let n=t.apply(e.message);return R(R({},n),{},{stack:this.cr(e)??n.stack,synthetic:!0})}ur(e){return j(e.message)&&e.message.length>0}cr(e){let t=e,n=t.lineno??0,r=t.colno??0;if(j(t.filename)&&t.filename.length!==0&&n!==0)return`Error\n    at ${t.filename}:${n}:${r}`}},hn=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,gn=class{match(e){return typeof e==`string`}coerce(e,t){let[n,r]=this.getInfos(e);return{type:n??`Error`,value:r??e,stack:t.syntheticException?.stack,synthetic:!0}}getInfos(e){let t=`Error`,n=e,r=e.match(hn);return r&&(t=r[1],n=r[2]),[t,n]}},_n=[`fatal`,`error`,`warning`,`log`,`info`,`debug`];function vn(e,t=40){let n=Object.keys(e);if(n.sort(),!n.length)return`[object has no keys]`;for(let e=n.length;e>0;e--){let r=n.slice(0,e).join(`, `);if(t>=r.length)return e===n.length?r:r.length>t?`${r.slice(0,t)}...`:r}return``}var yn=class{match(e){return typeof e==`object`&&!!e}coerce(e,t){let n=this.getErrorPropertyFromObject(e);return n?t.apply(n):{type:this.getType(e),value:this.getValue(e),stack:this.getStack(e)??t.syntheticException?.stack,level:this.isSeverityLevel(e.level)?e.level:`error`,synthetic:!0}}getType(e){if(ue(e))return e.constructor.name;let t=`name`in e?e.name:void 0;return j(t)&&!ie(t)?t:`Error`}getValue(e){if(`name`in e&&typeof e.name==`string`){let t=`'${e.name}' captured as exception`;return`message`in e&&typeof e.message==`string`&&(t+=` with message: '${e.message}'`),t}if(`message`in e&&typeof e.message==`string`)return e.message;let t=this.getObjectClassName(e);return`${t&&t!==`Object`?`'${t}'`:`Object`} captured as exception with keys: ${vn(e)}`}isSeverityLevel(e){return j(e)&&!ie(e)&&_n.indexOf(e)>=0}getStack(e){try{return j(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:j(e.stack)&&e.stack.length>0?e.stack:void 0}catch{return}}getErrorPropertyFromObject(e){for(let t in e)if({}.hasOwnProperty.call(e,t)){let n=e[t];if(le(n))return n}}getObjectClassName(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},bn=class{match(e){return ue(e)}coerce(e,t){let n=e.constructor.name;return{type:n,value:`${n} captured as exception with keys: ${vn(e)}`,stack:t.syntheticException?.stack,synthetic:!0}}},xn=class{match(e){return se(e)}coerce(e,t){return{type:`Error`,value:`Primitive value captured as exception: ${String(e)}`,stack:t.syntheticException?.stack,synthetic:!0}}},Sn=class{match(e){return ce(e,`PromiseRejectionEvent`)||this.isCu
1stomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!ue(e))return!1;try{let t=e.detail;return typeof t==`object`&&!!t&&`reason`in t}catch{return!1}}coerce(e,t){let n=this.getUnhandledRejectionReason(e);return se(n)?{type:`UnhandledRejection`,value:`Non-Error promise rejection captured with value: ${String(n)}`,stack:t.syntheticException?.stack,synthetic:!0}:t.apply(n)}getUnhandledRejectionReason(e){try{if(`reason`in e)return e.reason;if(`detail`in e&&e.detail!=null&&typeof e.detail==`object`&&`reason`in e.detail)return e.detail.reason}catch{}return e}},Cn=`$message`,wn=`$timestamp`,Tn=new Set([Cn,wn]),En={enabled:!0,max_bytes:32768};function Dn(e){return e?{enabled:e.enabled??En.enabled,max_bytes:kn(e.max_bytes,En.max_bytes)}:R({},En)}var On=class{constructor(e){this.ns=[],this.ss=0,this.Ir=Dn(e)}setConfig(e){this.Ir=Dn(e),this.rs()}add(e){let t=function(e){let t;try{t=te(e)}catch{return}try{let e=JSON.parse(t);if(!O(e))return;let n=e,r=n[Cn],i=n[wn];return!j(r)||r.trim().length===0||!j(i)&&!P(i)?void 0:{step:n,json:t}}catch{return}}(e);if(!t)return;let n=function(e){if(`u`>typeof TextEncoder)return new TextEncoder().encode(e).length;let t=encodeURIComponent(e),n=0;for(let e=0;t.length>e;e++)t[e]===`%`?(n+=1,e+=2):n+=1;return n}(t.json);n>this.Ir.max_bytes||(this.ns.push({step:t.step,bytes:n}),this.ss+=n,this.rs())}getAttachable(){return this.ns.map(e=>e.step)}clear(){this.ns=[],this.ss=0}size(){return this.ns.length}rs(){for(;this.ss>this.Ir.max_bytes&&this.ns.length>0;){let e=this.ns.shift();e&&(this.ss-=e.bytes)}}};function kn(e,t){if(!P(e)||1/0===e||-1/0===e)return t;let n=Math.floor(e);return 0>n?t:n}var An=e=>{if(typeof e!=`string`)return e;try{return JSON.parse(e)}catch{return e}};function jn(e){return typeof e==`string`||e}function Mn(e){return typeof e==`string`?e:void 0}var Nn=`$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`.split(`.`),Pn=`NativeGzipValidationError`,Fn=e=>e.length>=2&&e[0]===31&&e[1]===139,In=(e,t)=>e===b.GZipJS||t===b.GZipJS||t===`gzip`,Ln=e=>!(!e||typeof e!=`object`)&&(`name`in e?String(e.name):``)===`NotReadableError`,Rn,zn=e=>{throw jt(Pn,`Native gzip produced invalid output: ${e}`)},Bn=(Vn=L(function*(e,t){18>e.size&&zn(`too-short`);let n=new Uint8Array(yield e.slice(0,10).arrayBuffer());Fn(n)&&n[2]===8||zn(`invalid-header`);let r=new DataView(yield e.slice(e.size-8).arrayBuffer());r.getUint32(0,!0)!==(e=>{let t=(()=>{if(Rn)return Rn;Rn=[];for(let e=0;256>e;e++){let t=e;for(let e=0;8>e;e++)t=1&t?3988292384^t>>>1:t>>>1;Rn[e]=t>>>0}return Rn})(),n=4294967295;for(let r=0;e.length>r;r++)n=t[255&(n^e[r])]^n>>>8;return(4294967295^n)>>>0})(t)&&zn(`invalid-crc`);let i=t.length>>>0;r.getUint32(4,!0)!==i&&zn(`invalid-size`)}),function(e,t){return Vn.apply(this,arguments)}),Vn;function Hn(){return Hn=L(function*(e,t=!0,n){try{let t=new TextEncoder().encode(e),n=new globalThis.CompressionStream(`gzip`),i=n.writable.getWriter(),a=i.write(t).then(()=>i.close()).catch((r=L(function*(e){try{yield i.abort(e)}catch{}throw e}),function(e){return r.apply(this,arguments)})),o=new Response(n.readable).blob(),[s]=yield Promise.all([o,a]);return yield Bn(s,t),s}catch(e){if(n?.rethrow)throw e;return t&&console.error(`Failed to gzip compress data`,e),null}var r}),Hn.apply(this,arguments)}function Un(e,t){if(e==null)return{};var n,r,i=function(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;a.length>r;r++)t.includes(n=a[r])||{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var Wn={}.propertyIsEnumerable;function Gn(e,t){try{return Jn(e,t,{ancestors:new WeakSet,remainingNodes:1e4}
1,0)}catch{return[]}}function Kn(e,t,n,r){if(0>=n.remainingNodes)return{stringValue:Ct};if(n.remainingNodes--,I(e))return{boolValue:e};if(typeof e==`bigint`)return function(e,t){let n=e.toString(),r=BigInt(`9223372036854775808`);return e>=r||-r>e?(t?.debug(`Attribute ${n} is outside the int64 range; encoding it as a string`),{stringValue:n}):{intValue:n}}(e,t);if(typeof e==`number`){if(!Number.isFinite(e))return{stringValue:String(e)};if(Number.isInteger(e)){if(Number.isSafeInteger(e))return{intValue:String(e)};if(typeof BigInt>`u`)return{stringValue:String(e)};let n=BigInt(e).toString();return e>=0x8000000000000000||-0x8000000000000000>e?(t?.debug(`Attribute ${n} is outside the int64 range; encoding it as a string`),{stringValue:n}):{intValue:n}}return{doubleValue:e}}if(typeof e==`string`)return{stringValue:Tt(e)};if(typeof e==`function`)return{stringValue:`[Function]`};if(typeof e==`symbol`)return{stringValue:String(e)};if(typeof e==`object`&&e){if(n.ancestors.has(e))return{stringValue:`[Circular]`};if(r>=20)return{stringValue:Ct};if(e instanceof Date){let t=e.getTime(),n=Number.isFinite(t)?e.toISOString():String(e);return{stringValue:typeof n==`string`?Tt(n):String(n)}}n.ancestors.add(e);try{try{let i=e.toJSON;if(typeof i==`function`)return Kn(i.call(e),t,n,r+1)}catch{}return E(e)?{arrayValue:{values:qn(e,t,n,r+1)}}:{kvlistValue:{values:Jn(e,t,n,r+1)}}}finally{n.ancestors.delete(e)}}return{stringValue:Tt(String(e))}}function qn(e,t,n,r){let i=[],a=Math.min(e.length,1e3),o=0;for(;a>o&&n.remainingNodes>0;o++)try{let a=o in e?e[o]:void 0;if(N(a))continue;i.push(Kn(a,t,n,r))}catch{i.push({stringValue:wt})}return e.length>o&&i.push({stringValue:Ct}),i}function Jn(e,t,n,r){let i=[];for(let a in e)if(Wn.call(e,a)){if(!a){t?.debug(`Dropping an attribute with an empty key`);continue}if(i.length>=1e3||0>=n.remainingNodes){t?.debug(`Attributes truncated: the value exceeds the OTLP encoder budget`);break}try{let o=e[a];if(M(o)||A(o))continue;i.push({key:Tt(a),value:Kn(o,t,n,r)})}catch{i.push({key:Tt(a),value:{stringValue:wt}})}}return i}function Yn(e,t,n){return R(R(R(R({},Et({},e.resourceAttributes)),{},{"service.name":e.serviceName||`unknown_service`},e.environment&&{"deployment.environment":e.environment}),e.serviceVersion&&{"service.version":e.serviceVersion}),{},{"telemetry.sdk.name":t,"telemetry.sdk.version":n})}var Xn=[`service.name`,`deployment.environment`,`service.version`,`telemetry.sdk.name`,`telemetry.sdk.version`];function Zn(e,t){let n=Et({},e),r={};for(let e of Xn)({}).hasOwnProperty.call(n,e)&&(r[e]=n[e],delete n[e]);return[...Gn(n,t),...Gn(r,t)]}var Qn={darwin:`macOS`,win32:`Windows`,cygwin:`Windows`,linux:`Linux`,android:`Android`,freebsd:`FreeBSD`,openbsd:`OpenBSD`,netbsd:`NetBSD`,sunos:`SunOS`,aix:`AIX`,haiku:`Haiku`,"Mac OS X":`macOS`},$n={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}},er=$n.info;function tr(e){try{return Tt(String(e))}catch{return wt}}function nr(e,t,n,r){let{text:i,number:a}=$n[e.level||`info`]||er,o=function(e=Date.now()){return String(e)+`000000`}(P(r)?r:void 0),s={};t.distinctId&&(s.posthogDistinctId=t.distinctId),t.sessionId&&(s.sessionId=t.sessionId),t.windowId&&(s[`window.id`]=t.windowId),N(t.sessionStartTimestamp)||(s.sessionStartTimestamp=String(t.sessionStartTimestamp)),N(t.lastActivityTimestamp)||(s.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(s[`url.full`]=t.currentUrl),t.screenName&&(s[`screen.name`]=t.screenName),t.appState&&(s[`app.state`]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(s.feature_flags=t.activeFeatureFlags);let c=R({},s),l=e.attributes;if(l){let e=[];try{e=Object.keys(l)}catch{e=[]}for(let t of e){let e;try{e=l[t]}catch{e=wt}Object.defineProperty(c,t,{value:e,enumerable:!0,writable:!0,configurable:!0})}}let u={timeUnixNano:o,observedTimeUnixNano:o,severityNumber:a,severityText:i,body:{stringValue:tr(e.body)},attributes:Gn(c,n)};return e.trace_id&&(u.traceId=e.trace_id),e.span_id&&(u.spanId=e.span_id),A(e.trace_flags)||(u.flags=e.trace_flags),u}
1function rr(e,t,n){return Yn(e,t,n)}function ir(e,t,n,r){return{resourceLogs:[{resource:{attributes:Zn(t)},scopeLogs:[{scope:{name:n,version:r},logRecords:e}]}]}}var ar=class{constructor(e){this.ls=e,this.us=0}get pending(){return!!this.hs}arm(e){this.clear(),this.us=Date.now()+e,this.hs=Pt(()=>{this.hs=void 0,this.ls()},e)}armNoEarlierThan(e){this.hs&&Date.now()+e<=this.us||this.arm(e)}clear(){this.hs&&=(clearTimeout(this.hs),void 0)}};function or(){return .75+.5*Math.random()}function sr(e,t,n,r){let i=e*2**Math.min(Math.max(0,t-1),6);return Math.round((r===void 0?i:Math.min(i,Math.max(r,e)))*n)}var cr=class{constructor(e,t,n,r,i,a=()=>Promise.resolve(),o){this._instance=e,this.Ir=t,this.$=n,this.cs=r,this.ds=i,this.vs=a,this.fs=o,this.ps=new ar(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new Ot,this.ks=0,this.Ss=1,this.xs=0,this.Cs=0,this.$s=!1,this.Is=t.maxBufferSize,this.Ts=Math.max(t.maxQueueSize??t.maxBufferSize,t.maxBufferSize),this.Ms=t.flushIntervalMs,this.Es=t.maxBatchRecordsPerPost,this.Ps=t.rateCapWindowMs,this.Rs=t.maxLogsPerInterval}clearQueue(){this._s++,this._instance.setPersistedProperty(y.LogsQueue,[])}reset(){this.ps.clear(),this.xs=0,this.Cs=0,this.$s=!1,this.ks=0,this.Ss=1,this.ws.reset(),this.Es=this.Ir.maxBatchRecordsPerPost}onReconnect(){this.ks=0,this.Ss=1,this.ws.isOpen()?this.As()&&this.Fs():this.gs()}captureLog(e,t){if(this._instance.isDisabled||this._instance.optedOut||!e?.body)return;let n=this.Os(e);if(n===null)return;if(!n.body)return void this.$.info(`Log was rejected in beforeSend function`);if(!this.Ds())return;let r={record:nr(n,t?.context??this.cs(),this.$,t?.occurredAtMs)};this.ds(()=>this.Ls(r))}Os(e){let t=this.Ir.beforeSend;if(!t)return e;let n=E(t)?t:[t],r=e;for(let e of n)try{let t=e(r);if(!t)return this.$.info(`Log was rejected in beforeSend function`),null;r=t}catch(e){return this.$.error(`Error in beforeSend function for log:`,e),null}return r}Ds(){if(this.Rs===void 0)return!0;let e=Date.now(),t=e-this.xs;return this.Ps>t&&t>=0||(this.xs=e,this.Cs=0,this.$s=!1),this.Rs>this.Cs?(this.Cs++,!0):(this.$s||=(this.$.warn(`captureLog dropping logs: exceeded ${this.Rs} logs per ${this.Ps}ms`),!0),!1)}flush(){var e=this;return L(function*(){if(!e._instance.isDisabled)return e.ys||=e.Ns().finally(()=>{e.ys=null}),e.ys})()}Ns(){var e=this;return L(function*(){e.ps.clear();let t=e._instance.getPersistedProperty(y.LogsQueue)??[];if(t.length===0)return;let n=t.length,r=0;for(;t.length>0&&n>r;){let n=e._s;e.bs=0;let i=Math.min(t.length,e.Es),a=t.slice(0,i),o=ir(a.map(e=>e.record),e.qs(),e.fs??e._instance.getLibraryId(),e._instance.getLibraryVersion()),s=yield e._instance.js(o);if(e._s!==n)return;if(s.kind===`too-large`&&a.length>1)e.Es=Math.max(1,Math.floor(a.length/2)),e.$.warn(`Logs batch of size ${a.length} was too large for the ingestion endpoint, reducing batch size to ${e.Es}`);else if(e.ws.record(s),e.ps.pending&&e.ps.arm(Math.max(e.Ms,e.ws.remainingMs())),s.kind===`retry-later`||(s.kind===`too-large`?e.$.warn(`Dropping a single log record with batch size 1 — the record is larger than the server cap and cannot be split further.`):s.kind===`ok`&&e.Ir.maxBatchRecordsPerPost>e.Es&&(e.Es=Math.min(e.Ir.maxBatchRecordsPerPost,e.Es+1)),yield e.Bs(a.length),t=e._instance.getPersistedProperty(y.LogsQueue)??[],r+=a.length,s.kind===`fatal`))throw s.error}})()}Bs(e){var t=this;return L(function*(){let n=Math.max(0,e-t.bs),r=t._instance.getPersistedProperty(y.LogsQueue)??[];t._instance.setPersistedProperty(y.LogsQueue,r.slice(n)),yield t.vs()})()}qs(){return rr(this.Ir,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(e){if(this._instance.optedOut)return;let t=this._instance.getPersistedProperty(y.LogsQueue)??[];this.Ts>t.length||(t.shift(),this.bs++,this.$.info(`Logs queue is full, dropping oldest record.`)),t.push(e),this._instance.setPersistedProperty(y.LogsQueue,t),this.Is>t.length||this.ws.isOpen()?this.Fs():this.gs()}Fs(){this.ps.pending||this.ps.arm(Math.max(this.Ms,this.ws.remainingMs()))}Hs(){return Math.max(sr(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){let e=this._instance.getPersistedProperty(y.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return L(function*(){t.ps.clear();let n=t.flush().catch(()=>{});e===void 0?yield n:yield Ft(n,e)})()}flushWithTimeout(e){var t=this;return L(function*(){let n=t.flush();yield Ft(n,e,()=>{n.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},e=>{this.ks++,this.Ss=or(),this.$.error(`PostHog logs flush failed:`,e)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.Hs())})}},lr=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function ur(e){return String(e)+`000000`}function dr(e,t,n,r){let i=``;return r&&(i=Object.keys(r).sort().map(e=>`${JSON.stringify(e)}:${JSON.stringify(r[e])}`).join(`,`)),`${e}\0${t}\0${n??``}\0${i}`}var fr=class{constructor(e,t,n){this._instance=e,this.Ir=t,this.$=n,this.zs=new Map,this.ps=new ar(()=>this.flush().catch(e=>{this.$.error(`Metrics flush failed:`,e)})),this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.ws=new Ot,this.ks=0,this.Ss=1,this.Gs=0}count(e,t=1,n){this.Zs({name:e,type:`count`,value:t,unit:n?.unit,attributes:n?.attributes})}
1gauge(e,t,n){this.Zs({name:e,type:`gauge`,value:t,unit:n?.unit,attributes:n?.attributes})}histogram(e,t,n){this.Zs({name:e,type:`histogram`,value:t,unit:n?.unit,attributes:n?.attributes})}flush(){var e=this;let t=this.ys,n=function(){var n=L(function*(){t&&(yield t.catch(()=>{})),yield e.Qs()});return function(){return n.apply(this,arguments)}}()().finally(()=>{this.ys===n&&(this.ys=null)});return this.ys=n,n}drainWindow(){if(this.zs.size===0)return null;let e=this.zs;return this.zs=new Map,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.Js(e)}reset(){this.Gs++,this.ws.reset(),this.ks=0,this.Ss=1,this.ps.clear(),this.zs=new Map,this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set}Zs(e){if(this._instance.isDisabled||this._instance.optedOut)return;let t=this.Os(e);if(t===null)return;if(!t.name||typeof t.name!=`string`)return void this.$.warn(`Dropping metric with empty name`);if(typeof t.value!=`number`||!Number.isFinite(t.value))return void this.$.warn(`Dropping metric '${t.name}': value must be a finite number`);if(t.type===`count`&&0>t.value)return void this.$.warn(`Dropping count '${t.name}': counters are monotonic, value must be >= 0`);let n,r;try{n=t.attributes?R({},t.attributes):void 0,r=dr(t.type,t.name,t.unit,n)}catch(e){this.$.warn(`Dropping metric '${t.name}': attributes could not be serialized`,e);return}let i=this.zs.get(r);if(!i){if(!this.Ks())return;i={name:t.name,type:t.type,unit:t.unit,attributes:n,windowStartMs:Date.now()},this.zs.set(r,i)}let a=this.Ws.get(t.name);a===void 0?this.Ws.set(t.name,t.type):a===t.type||this.Vs.has(t.name)||(this.Vs.add(t.name),this.$.warn(`Metric name '${t.name}' is already used as a ${a}; recording it as a ${t.type} too will blend both series in charts. Use a distinct name.`)),this.Xs(i,t.value),this.Fs()}Ks(){return this.Ir.maxSeriesPerFlush>this.zs.size||(this.Us||(this.Us=!0,this.$.warn(`Metric series cap reached (${this.Ir.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}Xs(e,t){switch(e.type){case`count`:e.total=(e.total??0)+t;break;case`gauge`:e.last=t;break;case`histogram`:{e.hist||={count:0,sum:0,min:t,max:t,bucketCounts:Array(lr.length+1).fill(0)};let n=e.hist;n.count+=1,n.sum+=t,n.min=Math.min(n.min,t),n.max=Math.max(n.max,t),n.bucketCounts[function(e,t){for(let n=0;t.length>n;n++)if(t[n]>=e)return n;return t.length}(t,lr)]+=1;break}}}Os(e){let t=this.Ir.beforeSend;if(!t)return e;let n=E(t)?t:[t],r=e;for(let e of n)try{let t=e(r);if(!t)return this.$.info(`Metric was rejected in beforeSend function`),null;r=t}catch(e){return this.$.error(`Error in beforeSend function for metric:`,e),null}return r}Fs(){this.ps.pending||this.ps.arm(this.Hs())}Hs(){return Math.max(sr(this.Ir.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Qs(){var e=this;return L(function*(){if(e.ps.clear(),e.zs.size===0)return;let t=e.zs;e.zs=new Map,e.Us=!1,e.Ws=new Map,e.Vs=new Set;let n=e.Gs,r=yield e._instance.Ys(e.Js(t));if(n===e.Gs)switch(e.ws.record(r),r.kind===`retry-later`?(e.ks++,e.Ss=or()):(e.ks=0,e.Ss=1),e.ps.pending&&e.ps.arm(e.Hs()),r.kind){case`ok`:return;case`retry-later`:e.lo(t),e.ps.armNoEarlierThan(e.Hs());return;case`too-large`:e.$.warn(`Metrics batch exceeded the server size limit and was dropped`);return;case`fatal`:e.$.error(`Failed to send metrics batch:`,r.error);return}})()}Js(e){return t=this.uo(e),n=function(e,t,n){return Yn(e,t,n)}(this.Ir,this._instance.getLibraryId(),this._instance.getLibraryVersion()),r=this._instance.getLibraryId(),i=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:Zn(n)},scopeMetrics:[{scope:{name:r,version:i},metrics:t}]}]};var t,n,r,i}uo(e){let t=ur(Date.now()),n=new Map;for(let r of e.values()){let e=dr(r.type,r.name,r.unit,void 0),i=n.get(e);i||(i=R({name:r.name},r.unit&&{unit:r.unit}),r.type===`count`?i.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:r.type===`gauge`?i.gauge={dataPoints:[]}:i.histogram={aggregationTemporality:1,dataPoints:[]},n.set(e,i));let a=Gn(r.attributes??{},this.$),o=ur(r.windowStartMs);if(r.type===`count`){let e={attributes:a,startTimeUnixNano:o,timeUnixNano:t,asDouble:r.total??0};i.sum.dataPoints.push(e)}else if(r.type===`gauge`){let e={attributes:a,timeUnixNano:t,asDouble:r.last??0};i.gauge.dataPoints.push(e)}else r.hist&&i.histogram.dataPoints.push({attributes:a,startTimeUnixNano:o,timeUnixNano:t,count:r.hist.count,sum:r.hist.sum,min:r.hist.min,max:r.hist.max,bucketCounts:r.hist.bucketCounts,explicitBounds:lr})}return Array.from(n.values())}lo(e){for(let[t,n]of e){let e=this.zs.get(t);if(e)switch(e.windowStartMs=Math.min(e.windowStartMs,n.windowStartMs),e.type){case`count`:e.total=(e.total??0)+(n.total??0);break;case`gauge`:break;case`histogram`:if(n.hist){if(e.hist){e.hist.count+=n.hist.count,e.hist.sum+=n.hist.sum,e.hist.min=Math.min(e.hist.min,n.hist.min),e.hist.max=Math.max(e.hist.max,n.hist.max);for(let t=0;e.hist.bucketCounts.length>t;t++)e.hist.bucketCounts[t]+=n.hist.bucketCounts[t]}else e.hist=n.hist}}else this.Ks()&&this.zs.set(t,n)}}},pr=(e,{debugEnabled:t}={})=>{let n={N(n,...r){i&&(v.DEBUG||i.POSTHOG_DEBUG||t)&&!A(i.console)&&i.console&&(`__rrweb_original__`in i.console[n]?i.console[n].__rrweb_original__:i.console[n])(e,...r)},debug(...e){n.N(`debug`,...e)},info(...e){n.N(`log`,...e)},warn(...e){n.N(`warn`,...e)},error(...e){n.N(`error`,...e)},critical(...t){console.error(e,...t)},uninitializedWarning(e){n.error(`You must initialize PostHog before calling ${e}`)},createLogger:(t,n)=>pr(`${e} ${t}`,n)};return n},z=pr(`[PostHog.js]`),B=z.createLogger,mr=B(`[ExternalScriptsLoader]`),hr=e=>{let t=s?.querySelectorAll(`script`);if(t){for(let n=0;t.length>n;n++)if(t[n].src===e||t[n].getAttribute(`src`)===e)return t[n]}},gr=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return mr.warn(`${t} was requested but loading of external scripts is disabled.`),n(`Loa
1ding of external scripts is disabled`);let r=hr(t);if(r){if(r.__posthog_loading_callback_fired)return n();let e=r.__posthog_loading_error;return e?n(e):(r.addEventListener(`load`,e=>{r.__posthog_loading_callback_fired=!0,n(void 0,e)}),void r.addEventListener(`error`,e=>{r.__posthog_loading_error=e,n(e)}))}let i=()=>{if(!s)return n(`document not found`);if(hr(t))return gr(e,t,n);let r=s.createElement(`script`);if(r.type=`text/javascript`,r.crossOrigin=`anonymous`,r.src=t,r.onload=e=>{r.__posthog_loading_callback_fired=!0,n(void 0,e)},r.onerror=e=>{r.__posthog_loading_error=e,n(e)},e.config.prepare_external_dependency_script&&(r=e.config.prepare_external_dependency_script(r)),!r)return n(`prepare_external_dependency_script returned null`);if(e.config.external_scripts_inject_target===`head`)s.head.appendChild(r);else{let e=s.querySelectorAll(`body > script`);var i;e.length>0?(i=e[0].parentNode)==null||i.insertBefore(r,e[0]):s.body.appendChild(r)}};s?.body?i():s?.addEventListener(`DOMContentLoaded`,i)},_r={},vr=(e,t)=>{let n=`/static/${t}.js?v=${e.version}`;if(t===`toolbar`){let e=3e5;n=`${n}&t=${Math.floor(Date.now()/e)*e}`}return e.requestRouter.endpointFor(`assets`,n)};g.__PosthogExtensions__=g.__PosthogExtensions__||{},g.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{if(t===`remote-config`){gr(e,e.requestRouter.endpointFor(`assets`,`/array/${e.config.token}/config.js`),n);return}let r=e.config.strict_script_versioning;if(r){let i=e.requestRouter.endpointFor(`assets`,`/static/${e.version}/${t}.js`),a=_r[i];if(r===`fallback`&&a){if(hr(a))return void gr(e,a,n);delete _r[i]}gr(e,i,r===`fallback`?(r,a)=>{if(r){if(typeof r==`string`)n(r);else{var o;let r=vr(e,t);_r[i]=r;let a=hr(i);a==null||(o=a.parentNode)==null||o.removeChild(a),gr(e,r,n)}}else n(void 0,a)}:n);return}gr(e,vr(e,t),n)},g.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{gr(e,e.requestRouter.endpointFor(`api`,t),n)},v.DEBUG=!1,v.LIB_VERSION=`1.433.7`,v.LIB_NAME=`web`;var V=v,yr=`$people_distinct_id`,br=`distinct_id`,xr=`$device_id`,Sr=`$device_model`,Cr=`__alias`,wr=`__cmpns`,Tr=`$fbc`,Er=`$fbc_persistence`,Dr=`$fbp`,Or=`$fbp_persistence`,kr=`__timers`,Ar=`$autocapture_disabled_server_side`,jr=`$heatmaps_enabled_server_side`,Mr=`$exception_capture_enabled_server_side`,Nr=`$error_tracking_suppression_rules`,Pr=`$error_tracking_capture_extension_exceptions`,Fr=`$web_vitals_enabled_server_side`,Ir=`$dead_clicks_enabled_server_side`,Lr=`$product_tours_enabled_server_side`,Rr=`$logs_capture_enabled_server_side`,zr=`$web_vitals_allowed_metrics`,Br=`$session_recording_remote_config`,Vr=`$session_recording_enabled_server_side`,Hr=`$replay_sample_rate`,Ur=`$replay_override_sampling`,Wr=`$replay_override_linked_flag`,Gr=`$replay_override_url_trigger`,Kr=`$replay_override_event_trigger`,qr=`$sesid`,Jr=`$session_is_sampled`,Yr=`$session_past_minimum_duration`,Xr=`$session_recording_url_trigger_activated_session`,Zr=`$session_recording_event_trigger_activated_session`,Qr=`$debug_first_full_snapshot_timestamp`,$r=`$sess_rec_flush_size`,ei=`$enabled_feature_flags`,ti=`$active_feature_flags`,ni=`$early_access_features`,ri=`$feature_flag_details`,ii=`$feature_flag_payloads`,ai=`$feature_flag_request_id`,oi=`$minimal_flag_called_events`,si=`$override_feature_flags`,ci=`$override_feature_flag_payloads`,li=`$stored_person_properties`,ui=`$stored_group_properties`,di=`$groups`,fi=`$surveys`,pi=`$surveys_loaded_at`,mi=`$surveys_activated`,hi=`$surveys_activated_session`,gi=`$surveys_activated_timestamps`,_i=`ph_product_tours`,vi=`$product_tours_activated`,yi=`$product_tours_activated_session`,bi=`$conversations_widget_session_id`,xi=`$conversations_ticket_id`,Si=`$conversations_widget_state`,Ci=`$conversations_user_traits`,wi=`$flag_call_reported`,Ti=`$flag_call_reported_session_id`,Ei=`$feature_flag_errors`,Di=`$feature_flag_evaluated_at`,Oi=`$user_state`,ki=`$client_session_props`,Ai=`$capture_rate_limit`,ji=`$initial_campaign_params`,Mi=`$initial_referrer_info`,Ni=`$initial_person_info`,Pi=`$epp`,Fi=`$posthog_cookieless`,Ii=`$cookieless_mode`,Li=`$sdk_debug_extensions_init_method`,Ri=`$s
1dk_debug_extensions_init_time_ms`,zi=`$sdk_debug_recording_script_not_loaded`,Bi=`$sdk_debug_replay_event_trigger_status`,Vi=`$sdk_debug_replay_linked_flag_trigger_status`,Hi=`$sdk_debug_replay_matched_recording_trigger_groups`,Ui=`$sdk_debug_replay_pending_trigger_conditions`,Wi=`$sdk_debug_replay_remote_trigger_matching_config`,Gi=`$sdk_debug_replay_trigger_groups_count`,Ki=`$sdk_debug_replay_url_trigger_status`,qi=`$session_recording_start_reason`,Ji=`PostHog loadExternalDependency extension not found.`,Yi=`anonymous`,Xi=`identified`,Zi=`identified_only`,Qi=`visibilitychange`,$i=`beforeunload`,ea=`$pageview`,ta=`$pageleave`,na=`$identify`,ra=`$groupidentify`;function ia(e,t){E(e)&&e.forEach(t)}function H(e,t){if(!N(e)){if(E(e))e.forEach(t);else if((e=>e instanceof FormData)(e))e.forEach((e,n)=>t(e,n));else for(let n in e)T.call(e,n)&&t(e[n],n)}}var U=function(e,...t){for(let n of t)for(let t in n)n[t]!==void 0&&(e[t]=n[t]);return e};function aa(e){let t=Object.keys(e),n=t.length,r=Array(n);for(;n--;)r[n]=[t[n],e[t[n]]];return r}var oa=function(e){return function(...t){try{return e.apply(this,t)}catch(e){z.critical(`Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A.`),z.critical(e)}}},sa=function(e){let t={};return H(e,function(e,n){(j(e)&&e.length>0||P(e))&&(t[n]=e)}),t};function ca(e){let t=R({},e);for(let n of[`name`,`message`,`stack`,`cause`,`errors`])try{n in e&&(t[n]=e[n])}catch{}return t}var la=[`herokuapp.com`,`vercel.app`,`netlify.app`];function ua(e){let t=e?.hostname;if(!j(t))return!1;let n=t.split(`.`).slice(-2).join(`.`);for(let e of la)if(n===e)return!1;return!0}function W(e,t,n,r){let{capture:i=!1,passive:a=!0}=r??{};e?.addEventListener(t,n,{capture:i,passive:a})}function da(e){return e.name===`ph_toolbar_internal`}var fa=e=>{if(s){try{let t=e+`=`,n=s.cookie.split(`;`).filter(e=>e.length);for(let e=0;n.length>e;e++){let r=n[e];for(;r.charAt(0)==` `;)r=r.substring(1,r.length);if(r.indexOf(t)===0)return decodeURIComponent(r.substring(t.length,r.length))}}catch{}return null}};Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return P(e)&&isFinite(e)&&Math.floor(e)===e});var pa=class e{constructor(e){if(this.bytes=e,e.length!==16)throw TypeError(`not 128-bit length`)}static fromFieldsV7(t,n,r,i){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(r)||!Number.isInteger(i)||0>t||0>n||0>r||0>i||t>0xffffffffffff||n>4095||r>1073741823||i>4294967295)throw RangeError(`invalid field value`);let a=new Uint8Array(16);return a[0]=t/2**40,a[1]=t/2**32,a[2]=t/2**24,a[3]=t/2**16,a[4]=t/256,a[5]=t,a[6]=112|n>>>8,a[7]=n,a[8]=128|r>>>24,a[9]=r>>>16,a[10]=r>>>8,a[11]=r,a[12]=i>>>24,a[13]=i>>>16,a[14]=i>>>8,a[15]=i,new e(a)}toString(){let e=``;for(let t=0;this.bytes.length>t;t++)e=e+(this.bytes[t]>>>4).toString(16)+(15&this.bytes[t]).toString(16),t!==3&&t!==5&&t!==7&&t!==9||(e+=`-`);if(e.length!==36)throw Error(`Invalid UUIDv7 was generated`);return e}clone(){return new e(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(let t=0;16>t;t++){let n=this.bytes[t]-e.bytes[t];if(n!==0)return Math.sign(n)}return 0}},ma=class{generate(){let e=this.generateOrAbort();if(!A(e))return e;{this.Ct=0;let e=this.generateOrAbort();if(A(e))throw Error(`Could not generate UUID after timestamp reset`);return e}}generateOrAbort(){let e=(()=>{let e=Date.now();return P(e)&&isFinite(e)?Math.min(Math.max(Math.floor(e),0),0xffffffffffff):0})();if(e>this.Ct)this.Ct=e,this.Mt();else{if(this.Ct>=e+1e4)return;this.It++,this.It>4398046511103&&(this.Ct++,this.Mt())}return pa.fromFieldsV7(this.Ct,Math.trunc(this.It/2**30),this.It&2**30-1,this.Tt.nextUint32())}Mt(){this.It=1024*this.Tt.nextUint32()+(1023&this.Tt.nextUint32())}constructor(){this.Ct=0,this.It=0,this.Tt=new ga}},ha=e=>{if(`u`>typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw Error(`no cryptographically strong RNG available`);for(let t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};i&&!A(i.crypto)&&crypto.getRandomValues&&(ha=e=>crypto.getRandomValues(e));var ga=class{nextUint32(){return this.Rt.length>this.$t||(ha(this.Rt),this.$t=0),this.Rt[this.$t++]}constructor(){this.Rt=new Uint32Array(8),this.$t=1/0}},_a,va=()=>ya().toString(),ya=()=>(_a||=new ma).generate(),ba=``,xa=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,Sa=null,G={Et(){if(!M(Sa))return Sa;if(Sa=!1,s)try{let e=`__ph_cookie_support_${va()}`;G.At(e,`xyz`),Sa=fa(e)===`"xyz"`,G.Lt(e)}catch{Sa=!1}return Sa},Pt(e){z.error(`cookieStore error: `+e)},Ot:fa,Dt(e){let t;try{t=JSON.parse(G.Ot(e))||{}}catch{}return t},At(e,t,n,r,i){if(!s)return!1;try{let a=``,o=``,c=function(e,t){if(t){let t=function(e,t=s){if(ba)return ba;if(!t||[`localhost`,`127.0.0.1`].includes(e))return``;let n=e.split(`.`),r=Math.min(n.length,8),i=`dmn_chk_`+va();for(;!ba&&r--;){let e=n.slice(r).join(`.`),a=i+`=1;domain=.`+e+`;path=/`;
1t.cookie=a+`;max-age=3`,t.cookie.includes(i)&&(t.cookie=a+`;max-age=0`,ba=e)}return ba}(e);if(!t){let n=(e=>{let t=e.match(xa);return t?t[0]:``})(e);n!==t&&z.info(`Warning: cookie subdomain discovery mismatch`,n,t),t=n}return t?`; domain=.`+t:``}return``}(s.location.hostname,r);if(n){let e=new Date;e.setTime(e.getTime()+864e5*n),a=`; expires=`+e.toUTCString()}i&&(o=`; secure`);let l=e+`=`+encodeURIComponent(JSON.stringify(t))+a+`; SameSite=Lax; path=/`+c+o;return l.length>3686.4&&z.warn(`cookieStore warning: large cookie, len=`+l.length),s.cookie=l,!0}catch{return!1}},Lt(e,t){if(s?.cookie)try{G.At(e,``,-1,t)}catch{return}}},Ca=null,K={Et(){if(!M(Ca))return Ca;let e=!0;if(A(i))e=!1;else try{let t=`__mplssupport__`;K.At(t,`xyz`),K.Ot(t)!==`"xyz"`&&(e=!1),K.Lt(t)}catch{e=!1}return e||z.error(`localStorage unsupported; falling back to cookie store`),Ca=e,e},Pt(e){z.error(`localStorage error: `+e)},Ot(e){try{return i?.localStorage.getItem(e)}catch(e){K.Pt(e)}return null},Dt(e){try{return JSON.parse(K.Ot(e))||{}}catch{}return null},At(e,t){try{return i?.localStorage.setItem(e,JSON.stringify(t)),!0}catch(e){K.Pt(e)}return!1},Lt(e){try{i?.localStorage.removeItem(e)}catch(e){K.Pt(e)}}},wa=[li,ti,ei,ri,ii,ai,Di,Ei,wi],Ta=[xr,br,qr,Jr,Pi,Ni,Er,Oi],Ea=e=>e+`_cpm`,Da=[`__proto__`,`constructor`,`prototype`],Oa=e=>{if(!O(e))return{};let t={};return Object.keys(e).forEach(n=>{Da.indexOf(n)===-1&&(t[n]=e[n])}),t},ka=(e,t=[])=>{let n={};return[...Ta,...t].forEach(t=>{let r=e[t];A(r)||M(r)||r===``||(n[t]=r)}),n},Aa=e=>{let t=5381,n=2166136261;for(let r=0;e.length>r;r++){let i=e.charCodeAt(r);t=33*t^i,n=Math.imul(n^i,16777619)}return e.length.toString(36)+`.`+(t>>>0).toString(36)+`.`+(n>>>0).toString(36)},ja=(e,t)=>({p:t,f:Aa(JSON.stringify(e))}),Ma=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{let n=G.Dt(Ea(e)),r=n?.f===Aa(t)&&E(n.p);return{properties:r?n.p:[],isValid:r}}catch{return{properties:[],isValid:!1}}},Na=(e,t)=>t+`|`+(G.Ot(Ea(e))||``),Pa={},Fa={Et:()=>!0,Pt(e){z.error(`memoryStorage error: `+e)},Ot:e=>e in Pa?Pa[e]:null,Dt:e=>e in Pa?Pa[e]:null,At:(e,t)=>(Pa[e]=t,!0),Lt(e){delete Pa[e]}},Ia=null,q={Et(){if(!M(Ia))return Ia;if(Ia=!0,A(i))Ia=!1;else try{let e=`__support__`;q.At(e,`xyz`),q.Ot(e)!==`"xyz"`&&(Ia=!1),q.Lt(e)}catch{Ia=!1}return Ia},Pt(e){z.error(`sessionStorage error: `,e)},Ot(e){try{return i?.sessionStorage.getItem(e)}catch(e){q.Pt(e)}return null},Dt(e){try{return JSON.parse(q.Ot(e))||null}catch{}return null},At(e,t){try{return i?.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(e){q.Pt(e)}return!1},Lt(e){try{i?.sessionStorage.removeItem(e)}catch(e){q.Pt(e)}}},La=class{constructor(e){this._instance=e}get Ir(){return this._instance.config}get consent(){return this.Ao()?0:this.Fo}isOptedOut(){return this.Ir.cookieless_mode===`always`||this.isRejected()||this.consent===-1&&this.Ir.cookieless_mode===`on_reject`}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Ir.opt_out_capturing_by_default}optInOut(e){this.Oo.At(this.Do,+!!e,this.Ir.cookie_expiration,this.Ir.cross_subdomain_cookie,this.Ir.secure_cookie)}reset(){this.Oo.Lt(this.Do,this.Ir.cross_subdomain_cookie)}get Do(){let{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:n}=this._instance.config;return n||(t?t+e:`__ph_opt_in_out_`+e)}get Fo(){let e=this.Oo.Ot(this.Do);return pe(e)?1:C(me,e)?0:-1}get Oo(){let e=this.Ir.opt_out_capturing_persistence_type,t=e===`localStorage`?K:G,n=t.Et()?t:Fa;if(!this.Lo||this.Lo!==n){this.Lo=n;let t=e===`localStorage`?G:K;t.Ot(this.Do)&&(this.Lo.Ot(this.Do)||this.optInOut(pe(t.Ot(this.Do))),t.Lt(this.Do,this.Ir.cross_subdomain_cookie))}return this.Lo}Ao(){return!!this.Ir.respect_dnt&&[o?.doNotTrack,o?.msDoNotTrack,g.doNotTrack,o?.globalPrivacyControl].some(e=>pe(e))}};function Ra(e,t){var n;let r=e==null||(n=e.config)==null?void 0:n.get_current_url;if(!D(r))return t;try{let e=r(t);return j(e)&&e?e:t}catch(e){return z.error(`Error in get_current_url, falling back to window.location.href`,e),t}}function za(e){return e instanceof Element&&(e.id===`__POSTHOG_TOOLBAR__`||!!e.closest?.call(e,`.toolbar-global-fade-container`))}function Ba(e){return!!e&&e.nodeType===1}function J(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function Va(e){return!!e&&e.nodeType===3}function Ha(e){return!!e&&e.nodeType===11&&Ba(e.host)}function Ua(e){return e?w(e).split(/\s+/):[]}function Wa(e,t){let n=function(e){var t;let n=i==null||(t=i.location)==null?void 0:t.href;return A(n)?void 0:Ra(e,n)}(t);return!!(n&&e&&e.some(e=>n.match(e)))}function Ga(e){let t=``;switch(typeof e.className){case`string`:t=e.className;break;case`object`:t=(e.className&&`baseVal`in e.className?e.className.baseVal:null)||e.getAttribute(`class`)||``;break;default:t=``}return Ua(t)}function Ka(e){return N(e)?null:w(e).split(/(\s+)/).filter(e=>vo(e)).join(``).replace(/[\r\n]/g,` `).replace(/[ ]+/g,` `).substring(0,255)}function qa(e){let t=``;return co(e)&&!lo(e)&&e.childNodes&&e.childNodes.length&&H(e.childNodes,function(e){Va(e)&&e.textContent&&(t+=Ka(e.textContent)??``)}),w(t)}function Ja(e){return A(e.target)?e.srcElement||null:e.target?.shadowRoot?e.composedPath()[0]||null:e.target||null}var Ya=[`a`,`button`,`form`,`input`,`select`,`textarea`,`label`];function Xa(e,t){let n=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;try{return!!n&&n.call(e,t)}catch{return!1}}function Za(e,t){if(A(t))return!0;for(let n of e)if(t.some(e=>Xa(n,e)))return!0;return!1}function Qa(e){let t=e.parentNode;return!(!t||!Ba(t))&&t}var $a=[`.ph-no-autocapture`,`[data-ph-no-autocapture]`],eo=[`next`,`previous`,`prev`,`>`,`<`],to=[...eo,`+`,`-`,`−`,`–`],no=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,ro=[`.ph-no-rageclick`,`.ph-no-capture`],io=[``,`text`,`search`,`email`,`password`,`url`,`tel`,`number`];function ao(e,t){if(!i||oo(e))return!1;let n,r,a;var o;if(I(t)?(n=!!t&&ro,r=void 0,a=!1):(n=t?.css_selector_ignorelist??ro,r=t?.content_ignorelist,a=(o=t?.ignore_text_selection)!=null&&o),!1===n||a&&function(e){return!(!e||!Ba(e))&&(!!J(e,`textarea`)||(J(e,`input`)?C(io,(e.getAttribute(`type`)||``).toLowerCase()):function(e){if(e.isContentEditable)return!0;let t=e.getAttribute?.call(e,`contenteditable`);return t===`true`||t===``}(e)))}(e))return!1;let{targetElementList:s}=so(e,!1);return!function(e,t){if(!1===e||A(e))return!1;let n;if(!0===e)n=eo;else{if(!E(e))return!1;if(e.length>10)return z.error(`[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching.`),!1;n=e.map(e=>e.toLowerCase())}return t.some(({safeText:e,ariaLabel:t})=>n.some(n=>no(e,n)||no(t,n)))}(r,s.map(e=>({safeText:qa(e).toLowerCase(),ariaLabel:e.getAttribute(`aria-label`)?.toLowerCase().trim()||``})))&&!Za(s,n)}var oo=e=>!e||J(e,`html`)||!Ba(e),so=(e,t)=>{if(!i||oo(e))return{parentIsUsefulElement:!1,targetElementList:[]};let n=!1,r=[e],a=e;for(;a.parentNode&&!J(a,`body`);){if(Ha(a.parentNode)){r.push(a.parentNode.host),a=a.parentNode.host;continue}let e=Qa(a);if(!e)break;if(t||Ya.indexOf(e.tagName.toLowerCase())>-1)n=!0;else try{let t=i.getComputedStyle(e);t&&t.getPropertyValue(`cursor`)===`pointer`&&(n=!0)}catch{}r.push(e),a=e}return{parentIsUsefulElement:n,targetElementList:r}};function co(e){let t=new Set,n=0;for(let r=e;r.parentNode&&!J(r,`body`);r=r.parentNode){if(n++>=1e3||t.has(r))return!1;t.add(r);let e=Ga(r);if(C(e,`ph-sensitive`)||C(e,`ph-no-capture`))return!1}if(C(Ga(e),`ph-include`))return!0;let r=e.type||``;if(j(r))switch(r.toLowerCase()){case`hidden`:case`password`:return!1}
1let i=e.name||e.id||``;return!j(i)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(i.replace(/[^a-zA-Z0-9]/g,``))}function lo(e){return!!(J(e,`input`)&&![`button`,`checkbox`,`submit`,`reset`].includes(e.type)||J(e,`select`)||J(e,`textarea`)||e.getAttribute(`contenteditable`)===`true`)}var uo=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}))$`),fo=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,po=[16,15,14,13],mo=RegExp(`^(\\d{3}-?\\d{2}-?\\d{4})$`),ho=RegExp(`(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))`,`g`),go=/[0-9A-Za-z_]/;function _o(e){let t=0,n=!1;for(let r=e.length-1;r>=0;r--){let i=e.charCodeAt(r)-48;n&&(i*=2,i>9&&(i-=9)),t+=i,n=!n}return t%10==0}function vo(e,t=!0){return!(N(e)||j(e)&&(e=w(e),(t?uo.test((e||``).replace(/[- ]/g,``)):function(e){let t;for(fo.lastIndex=0;t=fo.exec(e);){let e=t[2];if(!e)continue;let n=e.replace(/[- ]/g,``);for(let e=0;n.length>e;e++)for(let t of po){let r=e+t;if(n.length>=r){let t=n.slice(e,r);if(uo.test(t)&&_o(t))return!0}}}return!1}(e))||(t?mo.test(e):function(e){let t;for(ho.lastIndex=0;t=ho.exec(e);){let e=t[1],n=t[3];if(!(e&&n&&go.test(e)&&go.test(n)))return!0}return!1}(e))))}function yo(e){let t=qa(e);return t=`${t} ${bo(e)}`.trim(),vo(t)?t:``}function bo(e){let t=``;return e&&e.childNodes&&e.childNodes.length&&H(e.childNodes,function(e){if(e&&e.tagName?.toLowerCase()===`span`)try{let n=qa(e);t=`${t} ${n}`.trim(),e.childNodes&&e.childNodes.length&&(t=`${t} ${bo(e)}`.trim())}catch(e){z.error(`[AutoCapture]`,e)}}),t}function xo(e){return e.replace(/"|\\"/g,`\\"`)}function So(e){let t=e.attr__class;if(t)return E(t)?t:Ua(t)}var Co=B(`[Dead Clicks]`),wo=()=>!0,To=e=>{let t=!!e.instance.persistence?.get_property(Ir),n=e.instance.config.capture_dead_clicks;return I(n)?n:!!O(n)||t},Eo=class{get lazyLoadedDeadClicksAutocapture(){return this.No}constructor(e,t,n){this.instance=e,this.isEnabled=t,this.onCapture=n,this.startIfEnabledOrStop()}onRemoteConfig(e){if(!e.ok)return;let t=e.config;`captureDeadClicks`in t&&(this.instance.persistence&&this.instance.persistence.register({[Ir]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.qo(()=>{this.jo()}):this.stop()}qo(e){var t,n;g.__PosthogExtensions__?.initDeadClicksAutocapture?e():(t=g.__PosthogExtensions__)==null||(n=t.loadExternalDependency)==null||n.call(t,this.instance,`dead-clicks-autocapture`,t=>{t?Co.error(`failed to load script`,t):e()})}jo(){if(s){if(!this.No&&g.__PosthogExtensions__?.initDeadClicksAutocapture){let e=O(this.instance.config.capture_dead_clicks)?R({},this.instance.config.capture_dead_clicks):{};e.__onCapture=this.onCapture,this.onCapture&&(e.capture_dead_swipes=!1),this.No=g.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,e),this.No.start(s),Co.info(`starting...`)}}else Co.error("`document` not found. Cannot start.")}stop(){this.No&&(this.No.stop(),this.No=void 0,Co.info(`stopping...`))}},Do=B(`[SegmentIntegration]`);function Oo(e,t,n=!0){let r=e.config.segment;if(!r)return t();let{analytics:i,filterProperties:a}=(e=>D(e.register))(o=r)?{analytics:o}:o;var o;(function(e,t,n,r){let i=t=>{let i=()=>t.anonymousId()||va();e.config.get_device_id=i,r&&t.id()&&(e.register({distinct_id:t.id(),$device_id:i()}),e.persistence.set_property(Oi,Xi)),n(r?void 0:t.anonymousId()||void 0)},a=t.user();`then`in a&&D(a.then)?a.then(i):i(a)})(e,i,n=>{i.register(((e,t,{filterProperties:n}={})=>{typeof Promise<`u`&&Promise.resolve||Do.warn(`This browser does not have Promise support, and can not use the segment integration`);let r=(r,i)=>{if(!i)return r;let a=!!t&&r.event.anonymousId===t&&!r.event.userId;a||r.event.userId||r.event.anonymousId===e.get_distinct_id()||(Do.info(`No userId set, resetting PostHog`),e.reset()),a||(t=void 0),r.event.userId&&r.event.userId!==e.get_distinct_id()&&(Do.info(`UserId set, identifying with PostHog`),e.identify(r.event.userId)
1);let o=e.calculateEventProperties(i,r.event.properties);if(!N(n)){let e=r.event.properties||{},t={};for(let n of Object.keys(o))T.call(e,n)||(t[n]=o[n]);let i=((e,t)=>{let n=E(e)?e:[e],r=R({},t);for(let e of n)try{if(r=e(r),N(r))return null}catch(e){return Do.error(`Error in Segment filterProperties:`,e),null}return r})(n,t);if(N(i))return r;o=i}return r.event.properties=Object.assign({},o,r.event.properties),r};return{name:`PostHog JS`,type:`enrichment`,version:`1.0.0`,isLoaded(){return!0},load(){return Promise.resolve()},track(e){return r(e,e.event.event)},page(e){return r(e,ea)},identify(e){return r(e,na)},screen(e){return r(e,`$screen`)}}})(e,n,{filterProperties:a})).then(()=>{t()},e=>{Do.error(`Failed to register the Segment integration`,e),t()})},n)}var ko=`posthog-js`;function Ao(e,{organization:t,projectId:n,prefix:r,severityAllowList:i=[`error`],sendExceptionsToPostHog:a=!0}={}){return o=>{if(i!==`*`&&!i.includes(o.level)||!e.__loaded)return o;o.tags||={};let s=e.requestRouter.endpointFor(`ui`,`/project/${e.config.token}/person/${e.get_distinct_id()}`);o.tags[`PostHog Person URL`]=s,e.sessionRecordingStarted()&&(o.tags[`PostHog Recording URL`]=e.get_session_replay_url({withTimestamp:!0}));let c=o.exception?.values||[],l=c.map(e=>R(R({},e),{},{stacktrace:e.stacktrace?R(R({},e.stacktrace),{},{type:`raw`,frames:(e.stacktrace.frames||[]).map(e=>R(R({},e),{},{platform:`web:javascript`}))}):void 0})),u={$exception_message:c[0]?.value||o.message,$exception_type:c[0]?.type,$exception_level:o.level,$exception_list:l,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:c[0]?.value||o.message,$sentry_exception_type:c[0]?.type,$sentry_tags:o.tags};var d;return t&&n&&(u.$sentry_url=(r||`https://sentry.io/organizations/`)+t+`/issues/?project=`+n+`&query=`+o.event_id),a&&((d=e.exceptions)==null||d.sendExceptionEvent(u)),o}}var jo=class{constructor(e,t,n,r,i,a){this.name=ko,this.setupOnce=function(o){o(Ao(e,{organization:t,projectId:n,prefix:r,severityAllowList:i,sendExceptionsToPostHog:a==null||a}))}}},Mo=class{constructor(e){this.Bo=(e,t,n)=>{n&&(n.noSessionId||n.activityTimeout||n.sessionPastMaximumLength||n.crossTabAdoption)&&(z.info(`[PageViewManager] Session rotated, clearing pageview state`,{sessionId:e,changeReason:n}),this.Ho=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.zo()}zo(){this.Uo=this._instance.sessionManager?.onSessionId(this.Bo)}destroy(){var e;(e=this.Uo)==null||e.call(this),this.Uo=void 0}doPageView(e,t){let n=this.Wo(e,t);return this.Ho={pathname:i?.location.pathname??``,pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),n}doPageLeave(e){return this.Wo(e,this.Ho?.pageViewId)}doEvent(){return{$pageview_id:this.Ho?.pageViewId}}Wo(e,t){let n=this.Ho;if(!n)return{$pageview_id:t};let r={$pageview_id:t,$prev_pageview_id:n.pageViewId},i=this._instance.scrollManager.getContext();if(i&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:e,lastScrollY:t,maxScrollY:n,maxContentHeight:a,lastContentY:o,maxContentY:s}=i;if(!(A(e)||A(t)||A(n)||A(a)||A(o)||A(s))){e=Math.ceil(e),t=Math.ceil(t),n=Math.ceil(n),a=Math.ceil(a),o=Math.ceil(o),s=Math.ceil(s);let i=e>1?ve(t/e,0,1,z):1,c=e>1?ve(n/e,0,1,z):1,l=a>1?ve(o/a,0,1,z):1,u=a>1?ve(s/a,0,1,z):1;r=U(r,{$prev_pageview_last_scroll:t,$prev_pageview_last_scroll_percentage:i,$prev_pageview_max_scroll:n,$prev_pageview_max_scroll_percentage:c,$prev_pageview_last_content:o,$prev_pageview_last_content_percentage:l,$prev_pageview_max_content:s,$prev_pageview_max_content_percentage:u})}}return n.pathname&&(r.$prev_pageview_pathname=n.pathname),n.timestamp&&(r.$prev_pageview_duration=(e.getTime()-n.timestamp.getTime())/1e3),r}},No=[`flags`,`surveys`],Po={[yr]:{exposure:`hidden`},[Cr]:{exposure:`hidden`},[wr]:{exposure:`hidden`},[kr]:{exposure:`hidden`},[Er]:{exposure:`hidden`},[Or]:{exposure:`hidden`},[Ar]:{exposure:`event`},[jr]:{exposure:`hidden`},[Rr]:{exposure:`hidden`},[Mr]:{exposure:`event`},[Nr]:{exposure:`hidden`},[Pr]:{exposure:`event`},[Fr]:{exposure:`event`},[Ir]:{exposure:`event`},[Lr]:{exposure:`hidden`},[zr]:{exposure:`event`},[Br]:{exposure:`hidden`},[Vr]:{exposure:`hidden`},[qr]:{exposure:`hidden`},[Jr]:{exposure:`event`},[Hr]:{exposure:`event`,shouldSkipFromEventProperties:e=>M(e)},[Yr]:{exposure:`event`},[Xr]:{exposure:`event`},[Zr]:{exposure:`event`},[Qr]:{exposure:`event`},[$r]:{exposure:`hidden`}
1,[ei]:{exposure:`hidden`,storageGroup:`flags`},[ti]:{exposure:`hidden`,storageGroup:`flags`},[ni]:{exposure:`hidden`},[ri]:{exposure:`hidden`,storageGroup:`flags`},[ii]:{exposure:`hidden`,storageGroup:`flags`},[ai]:{exposure:`hidden`,storageGroup:`flags`,volatile:!0},[oi]:{exposure:`hidden`,storageGroup:`flags`},[si]:{exposure:`hidden`},[ci]:{exposure:`hidden`},[li]:{exposure:`hidden`},[ui]:{exposure:`hidden`},[fi]:{exposure:`hidden`,storageGroup:`surveys`},[pi]:{exposure:`hidden`,storageGroup:`surveys`,volatile:!0},[mi]:{exposure:`event`},[hi]:{exposure:`hidden`},[gi]:{exposure:`hidden`},[_i]:{exposure:`hidden`},[vi]:{exposure:`hidden`},[yi]:{exposure:`hidden`},[bi]:{exposure:`event`},[xi]:{exposure:`event`},[Si]:{exposure:`event`},[Ci]:{exposure:`event`},[wi]:{exposure:`hidden`},[Ti]:{exposure:`hidden`},[di]:{exposure:`event`},[Ei]:{exposure:`hidden`},[Di]:{exposure:`hidden`,storageGroup:`flags`,volatile:!0},[Oi]:{exposure:`hidden`},[ki]:{exposure:`hidden`},[Ai]:{exposure:`hidden`},[ji]:{exposure:`hidden`},[Mi]:{exposure:`hidden`},[Ni]:{exposure:`hidden`},[Pi]:{exposure:`hidden`},[Ur]:{exposure:`event`},[Wr]:{exposure:`event`},[Gr]:{exposure:`event`},[Kr]:{exposure:`event`},[Li]:{exposure:`event`},[Ri]:{exposure:`event`},[zi]:{exposure:`event`},[Bi]:{exposure:`event`},[Vi]:{exposure:`event`},[Hi]:{exposure:`event`},[Ui]:{exposure:`event`},[Wi]:{exposure:`event`},[Gi]:{exposure:`event`},[Ki]:{exposure:`event`},[qi]:{exposure:`event`}},Fo=[[`$posthog_sr_group_event_trigger_`,{exposure:`hidden`}],[`$posthog_sr_group_url_trigger_`,{exposure:`hidden`}],[`$posthog_sr_group_sampling_`,{exposure:`hidden`}]],Y=e=>{let t=Po[e];if(t)return t;for(let[t,n]of Fo)if(e.indexOf(t)===0)return n},Io=(e,t)=>{try{let n;return JSON.stringify(e,(e,t)=>le(t)?(n??=new WeakMap,n.has(t)||n.set(t,ca(t)),n.get(t)):typeof t==`bigint`?t.toString():t,t)}catch{return te(e)}},Lo=e=>{let t=s?.createElement(`a`);return A(t)?null:(t.href=e,t)},Ro=function(e,t){let n=((e.split(`#`)[0]||``).split(/\?(.*)/)[1]||``).replace(/^\?+/g,``).split(`&`),r;for(let e=0;n.length>e;e++){let i=n[e].split(`=`);
1if(i[0]===t){r=i;break}}if(!E(r)||2>r.length)return``;{let e=r[1];try{e=decodeURIComponent(e)}catch{z.error(`Skipping decoding for malformed query param: `+e)}return e.replace(/\+/g,` `)}},zo=function(e,t,n){if(!e||!t||!t.length)return e;let r=e.split(`#`),i=r[1],a=(r[0]||``).split(`?`),o=a[1],s=a[0],c=(o||``).split(`&`),l=[];for(let e=0;c.length>e;e++){let r=c[e].split(`=`);E(r)&&(t.includes(r[0])?l.push(r[0]+`=`+n):l.push(c[e]))}let u=s;return o!=null&&(u+=`?`+l.join(`&`)),i!=null&&(u+=`#`+i),u},Bo=function(e,t){let n=e.match(RegExp(t+`=([^&]*)`));return n?n[1]:null},Vo=(e,t)=>e>=t&&m(),Ho=(e,t,n,r)=>{if(e===0){if(m()){let e=t+1;return e===n&&r(),e}return t}return 0},Uo=[`gclid`,`gclsrc`,`dclid`,`gbraid`,`wbraid`,`fbclid`,`msclkid`,`twclid`,`li_fat_id`,`igshid`,`ttclid`,`rdt_cid`,`epik`,`qclid`,`sccid`,`irclid`,`_kx`],Wo=[`utm_source`,`utm_medium`,`utm_campaign`,`utm_content`,`utm_term`,`gad_source`,`mc_cid`,...Uo],Go=`<masked>`,Ko=[`li_fat_id`];function qo(e,t,n){if(!s)return{};let r=t?[...Uo,...n||[]]:[],i=Jo(zo(s.URL,r,Go),e);return U(function(){let e={};return H(Ko,function(t){let n=fa(t);e[t]=n||null}),e}(),i)}function Jo(e,t){let n=Wo.concat(t||[]),r={};return H(n,function(t){let n=Ro(e,t);r[t]=n||null}),r}function Yo(e){let t=function(e){return e?e.search(`https?://(.*)google.([^/?]*)`)===0?`google`:e.search(`https?://(.*)bing.com`)===0?`bing`:e.search(`https?://(.*)yahoo.com`)===0?`yahoo`:e.search(`https?://(.*)duckduckgo.com`)===0?`duckduckgo`:null:null}(e),n=t==`yahoo`?`p`:`q`,r={};if(!M(t)){r.$search_engine=t;let e=s?Ro(s.referrer,n):``;e.length&&(r.ph_keyword=e)}return r}function Xo(){return navigator.language||navigator.userLanguage}function Zo(){let e=Xo();return typeof e==`string`?e.split(`-`)[0]:void 0}var Qo=`$direct`;function $o(){return s?.referrer||Qo}function es(e,t,n=!1){let r=e?[...Uo,...t||[]]:[],i=(n?Mt(c?.href):c?.href)?.substring(0,1e3);return{r:$o().substring(0,1e3),u:i?zo(i,r,Go):void 0}}function ts(e,t=!1){let{r:n,u:r}=e,i=t?Mt(r):r,a={$referrer:n,$referring_domain:n==null?void 0:n==Qo?Qo:Lo(n)?.host};if(i){a.$current_url=i;let e=Lo(i);a.$host=e?.host,a.$pathname=e?.pathname,U(a,Jo(i))}return n&&U(a,Yo(n)),a}function ns(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function rs(){try{return new Date().getTimezoneOffset()}catch{return}}var is={flags:Di,surveys:pi},as=[`cookie`,`localstorage`,`localstorage+cookie`,`sessionstorage`,`memory`],os=e=>`${e}_cookie_identity_change_pending`,ss=e=>{let t=``,n=0;for(let r of e){let e=encodeURIComponent(JSON.stringify(r).slice(1,-1)).length;if(n+e>1e3)break;t+=r,n+=e}return t},X=`main`,cs=[ei,ti,ri,ii,ai,Di,oi,li],ls=e=>cs.indexOf(e)!==-1,us=[Er,Or],ds=e=>us.indexOf(e)!==-1,fs=(e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch{return e===t}},ps=e=>{if(!e)return{};let t=JSON.parse(e);return O(t)?t:{}},ms=(e,t)=>{H(e,(n,r)=>{let i=Y(r);i&&i.exposure!==`event`||{}.hasOwnProperty.call(t,r)||delete e[r]})},hs=class{constructor(e,t,n=!0){if(this.Vo={},this.Go=!1,this.Zo=!1,this.Qo=!1,this.Jo=!1,this.Ko=!1,this.Xo=new Map,this.Yo=!1,this.tl=!1,this.el=!1,this.il=new Set,this.nl=new Set,this.Ir=e,this.sl=n,this.props={},this.rl=void 0,this.ol=(e=>{let t=``;return e.token&&(t=e.token.replace(/\+/g,`PL`).replace(/\//g,`SL`).replace(/=/g,`EQ`)),e.persistence_name?`ph_`+e.persistence_name:`ph_`+t+`_posthog`})(e),this.Oo=this.ll(e),this.Qo=this.al(e),this.load(),this.ul(),e.debug&&z.info(`Persistence loaded`,e.persistence,R({},this.props)),this.update_config(e,e,t),this.save(),i){let e=()=>this.flush();W(i,`beforeunload`,e,{capture:!1}),W(i,`pagehide`,e,{capture:!1}),this.hl=e=>{if(this.Go&&(!e.storageArea||e.storageArea===i?.localStorage)&&e.key){if(e.key!==this.ol){if(this.Qo){let t=No.find(t=>e.key===this.cl(t));t&&this.dl(e.key,t)}}else this.dl(e.key,X)}},W(i,`storage`,this.hl)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(([e,t])=>{let n=this.Xo.get(e);if(!ls(e)||!0===n)return;if(!0===t)return void this.vl(e,!0);let r=new Set(n||[]);t.forEach(e=>r.add(e)),r.size&&this.vl(e,r)})}onCrossTabFeatureFlagChange(e){return this.nl.add(e),()=>this.nl.delete(e)}destroy(){this.hl&&i&&(i.removeEventListener(`storage`,this.hl),this.hl=void 0),this.nl.clear()}dl(e,t,n=!0){if(this.mi)return!1;let r,i;try{if(i=K.Ot(e),M(i)){let e=this.fl(t);return e.storageValue=null,t!==X&&(e.persisted=!1),!1}r=ps(i)}catch{return!1}let a=t===X?r:K.Dt(this.ol);if(a&&this.pl(a))return!1;let o=this.gl(r,t,n);return t===X&&this.Qo&&!fs(this.ml().main,r)||this.yl(r,t,!0,i),o}pl(e){let t=this.props[br],n=e[br];return!A(t)&&!A(n)&&t!==n}yl(e,t,n,r){let i=this.fl(t);i.storageValue=r,t!==X&&(i.persisted=n);try{i.fingerprint=this.bl(e,t)}catch{i.fingerprint=void 0}}gl(e,t,n){let r=!1;return cs.forEach(n=>{let i=Y(n)?.storageGroup;if(t===X&&this.Qo&&i||t!==X&&i!==t)return;let a=n in e,o=this._l(n,a?e[n]:void 0),s=this.Xo.has(n)?n in this.props:a;s===n in this.props&&fs(o,this.props[n])||(s?this.wl(n,o,!1):this.kl(n,!1),r=!0)}
1),r&&n&&this.nl.forEach(e=>e()),r}Sl(){if(!this.Go)return!1;try{this.el=!1;let e=K.Ot(this.ol),t=this.fl(X),n,r=!1,i=!1;if(e!==t.storageValue){if(M(e))t.storageValue=null;else{if(n=ps(e),this.el=!this.tl&&this.pl(n),this.el)return!1;i=this.gl(n,X,!1),!this.Qo||fs(this.ml().main,n)?this.yl(n,X,!0,e):t.storageValue=e,r=!0}}return this.Qo&&No.forEach(e=>{let t=K.Ot(this.cl(e)),a=this.fl(e),o=n||{},s=r&&cs.some(t=>Y(t)?.storageGroup===e&&t in o);if(t===a.storageValue&&!s)return;if(M(t))return a.storageValue=null,a.persisted=!1,void(s&&(i=this.gl(o,e,!1)||i));let c=ps(t);i=this.gl(c,e,!1)||i,this.yl(c,e,!0,t)}),i}catch{return!1}}vl(e,t){this.Xo.set(e,t);let n=Y(e);n!=null&&n.volatile||(this.fl((this.Qo?n?.storageGroup:void 0)||X).fingerprint=void 0,this.xl(e))}Cl(){cs.forEach(e=>this.Xo.set(e,!0))}ul(){if(this.Go)try{let e=K.Ot(this.ol),t=ps(e);this.fl(X).storageValue=e,cs.forEach(e=>{let n=this.Qo?Y(e)?.storageGroup:void 0,r=n?K.Ot(this.cl(n)):null;if(n){let e=this.fl(n);e.storageValue=r,e.persisted=!M(r)}let i=n&&!M(r)?ps(r):t;e in this.props?this.$l(e,i[e],this.props[e]):e in i&&this.vl(e,!0)})}catch{}}_l(e,t){let n=this.Xo.get(e);if(!n)return t;if(!0===n)return this.props[e];if(e===`$active_feature_flags`){let r=new Set(E(t)?t:[]),i=new Set(E(this.props[e])?this.props[e]:[]);return n.forEach(e=>i.has(e)?r.add(e):r.delete(e)),Array.from(r)}let r=O(t)?R({},t):{},i=O(this.props[e])?this.props[e]:{};return n.forEach(e=>{e in i?r[e]=i[e]:delete r[e]}),r}$l(e,t,n){if(!ls(e))return;let r=this.Xo.get(e);if(!0===r)return;let i=t;if(this.Go)try{let t=this.Qo?Y(e)?.storageGroup:void 0,n=t?this.cl(t):this.ol;i=ps(K.Ot(n))[e]}catch{}let a=new Set(r||[]);if(e===`$active_feature_flags`){if(!A(t)&&!E(t)||!A(i)&&!E(i)||!E(n))return void this.vl(e,!0);let r=new Set(t||[]),o=new Set(i||[]),s=new Set(n);new Set([...r,...s]).forEach(e=>{r.has(e)!==s.has(e)&&a.add(e)}),a.forEach(e=>{o.has(e)===s.has(e)&&a.delete(e)})}
1else{if(!O(n))return void(fs(i,n)?this.Xo.delete(e):this.vl(e,!0));{if(!A(t)&&!O(t)||A(t)&&k(n)&&A(i))return void this.vl(e,!0);let r=O(t)?t:{},o=O(i)?i:{};new Set([...Object.keys(r),...Object.keys(n)]).forEach(e=>{e in r==e in n&&fs(r[e],n[e])||a.add(e)}),a.forEach(e=>{e in o==e in n&&fs(o[e],n[e])&&a.delete(e)})}}a.size?this.vl(e,a):this.Xo.delete(e)}Il(){let e=this.Ir?.persistence_save_debounce_ms;return P(e)&&e>0?e:0}Tl(e){if(this.Ir.cookieWinsOnConflict&&this.Ir.persistence.toLowerCase()===`localstorage+cookie`){if(e)try{let t=ka(e,this.Ir.cookie_persisted_properties||[]),n=ja(t,this.Ir.cookie_persisted_properties||[]),r=JSON.stringify(t)+`|`+JSON.stringify(n),i=G.Ot(this.ol)||void 0;i&&Na(this.ol,i)===r&&(this.Ml=r,this.El=i)}catch{}else try{let e=G.Ot(this.ol)||void 0;this.Ml=e?Na(this.ol,e):void 0,this.El=e}catch{}}}syncCookieProperties(){return this.Pl(this.Ir)}Pl(e,t=!1){if(this.mi&&!t||this.Ko||!e.cookieWinsOnConflict||e.persistence.toLowerCase()!==`localstorage+cookie`)return!1;let n;try{n=G.Ot(this.ol)||void 0}catch{}if(!n||n===this.El)return!1;let r=Na(this.ol,n),i;try{i=Oa(JSON.parse(n))}catch{return!1}if((G.Ot(this.ol)||void 0)!==n)return!1;this.Ml=r,this.El=n;let a=Ma(this.ol,n),o=[...Ta,...a.properties],s={};
1if(Object.keys(i).forEach(e=>{let t=i[e];(A(t)||M(t)||t===``||e===`$user_state`&&t!==`anonymous`&&t!==`identified`)&&(s[e]=!0,delete i[e])}),k(i))return!1;let c=`distinct_id`in i||i.$user_state===`anonymous`||i.$user_state===`identified`,l=this.props,u=l[br],d=l[Oi],f=U({},l);[...Ta,...e.cookie_persisted_properties||[]].forEach(e=>{if(o.indexOf(e)!==-1&&!(e in i)&&!s[e]&&(c||e!==`distinct_id`&&e!==`$user_state`)){let t=f[e];(a.isValid||Ta.indexOf(e)===-1||!1!==t&&t!==0)&&delete f[e]}}),this.props=U(f,i),cs.forEach(e=>{let t=e in this.props;e in l===t&&fs(l[e],this.props[e])||(t?this.$l(e,l[e],this.props[e]):this.vl(e,!0))}),!c||`$user_state`in i||`$user_state`in this.props||this.wl(Oi,Yi);let p=this.props[br],m=this.props[Oi];return!c||p===u&&m===d||(this.tl=!0,this.Jo=!0,q.At(os(this.ol),!0),this.kl(li),this.kl(ti),this.kl(ei),this.kl(ri),this.kl(ii),this.kl(ai),this.kl(Di),this.kl(Ei),this.kl(wi),m!==`anonymous`||d!==`identified`&&i.$user_state!==`anonymous`&&(A(u)||p===u)||(ms(this.props,i),this.kl(ui)),m===`identified`?this.props.$user_id=p:delete this.props.$user_id,this.kl(Cr)),!0}
1consumeCookieIdentityChange(){let e=os(this.ol),t=this.Jo||!!q.Ot(e);return this.Jo=!1,t&&q.Lt(e),t}Rl(e=!1){return!(this.Ko||this.mi&&!e||!this.Ir.cookieWinsOnConflict||this.Ir.persistence.toLowerCase()!==`localstorage+cookie`||(this.Ko=!0,0))}Al(){this.Ko&&(A(this.Fl)||(clearTimeout(this.Fl),this.Fl=void 0),delete this.Vo[X],this.Ol(!0))}Dl(e=!0){if(this.Ko)try{e?this.Al():A(this.Fl)||(clearTimeout(this.Fl),this.Fl=void 0)}finally{this.Ko=!1}}isDisabled(){return!!this.mi}ll(e){as.indexOf(e.persistence.toLowerCase())===-1&&(z.critical(`Unknown persistence type `+e.persistence+`; falling back to localStorage+cookie`),e.persistence=`localStorage+cookie`);let t=((e=[],t=!1)=>{let n=[...Ta,...e];return R(R({},K),{},{Dt(e){try{let r,i={};try{r=G.Ot(e)||void 0,i=r?Oa(JSON.parse(r)):{}}catch{}let a=JSON.parse(K.Ot(e)||`{}`),o;if(t){let t=Ma(e,r),s=[...Ta,...t.properties],c={};Object.keys(i).forEach(e=>{let t=i[e];M(t)||t===``||e===`$user_state`&&t!==`anonymous`&&t!==`identified`||(c[e]=t)});let l=`distinct_id`in c||c.$user_state===`anonymous`||c.$user_state===`identified`;if(Object.keys(c).length>0){let e=a[br],r=a.$user_state??Yi;n.forEach(e=>{if(s.indexOf(e)!==-1&&!(e in i)&&(l||e!==`distinct_id`&&e!==`$user_state`)){let n=a[e];(t.isValid||Ta.indexOf(e)===-1||!1!==n&&n!==0)&&delete a[e]}}),!l||`$user_state`in i||`$user_state`in a||(a[Oi]=Yi),!l||(`distinct_id`in c?c[br]:a[br])===e&&(`$user_state`in c?c[Oi]:a[Oi])===r||(wa.forEach(e=>delete a[e]),c.$user_state===`identified`&&`distinct_id`in c?a.$user_id=c[br]:delete a.$user_id,c.$user_state!==`identified`&&(delete a[di],delete a[ui]),delete a.__alias)}o=U(a,c)}else o=U(i,a);return K.At(e,o),o}catch{}return null},At(n,r,i,a,o,s){let c=K.At(n,r,void 0,void 0,s);try{let l=ka(r,e);if(Object.keys(l).length){if(t){let t=Ea(n),u=ja(l,e);if(G.At(t,u,i,a,o,s),G.Ot(t)!==JSON.stringify(u)){G.Lt(t,a);let e=ka(r);return G.At(n,e,i,a,o,s),c}}G.At(n,l,i,a,o,s)}}catch(e){K.Pt(e)}return c},Lt(e,t){try{i?.localStorage.removeItem(e),G.Lt(e,t),G.Lt(Ea(e),t)}catch(e){K.Pt(e)}}})})(e.cookie_persisted_properties||[],e.cookieWinsOnConflict),n,r=!1,a=!1,o=e.persistence.toLowerCase();return o===`localstorage`&&K.Et()?(n=K,a=!0):o===`localstorage+cookie`&&t.Et()?(n=t,a=!0,r=!0):o===`sessionstorage`&&q.Et()?n=q:o===`memory`?n=Fa:o===`cookie`&&G.Et()?(n=G,r=!0):t.Et()?(n=t,a=!0,r=!0):G.Et()?(n=G,r=!0):n=Fa,this.Go=a,this.Zo=r,n}cl(e){return`${this.ol}__${e}`}al(e){return this.Go&&!!e.split_storage}properties(){let e={};return H(this.props,(t,n)=>{let r=Y(n);if(!r||r.exposure===`event`){var i;if(r!=null&&(i=r.shouldSkipFromEventProperties)!=null&&i.call(r,t))return;e[n]=t}}),e}load(e=!1){if(this.mi&&!e)return;let t=this.Ir.cookieWinsOnConflict&&this.Ir.persistence.toLowerCase()===`localstorage+cookie`,n=t?K.Dt(this.ol):null,r={};if(t)try{r=Oa(G.Dt(this.ol)),H(r,(e,t)=>{(A(e)||M(e)||e===``)&&delete r[t]})}catch{}let i=this.Oo.Dt(this.ol);if(i&&(this.props=U({},i)),this.Qo&&this.Ll(),t&&i){let e=n?.[br],t=n?.$user_state??Yi,a=i[br],o=i.$user_state??Yi;if(a!==e||o!==t){this.Jo=!0,q.At(os(this.ol),!0);let n=U({},this.props);wa.forEach(e=>delete n[e]),o!==`anonymous`||t!==`identified`&&r.$user_state!==`anonymous`&&(A(e)||a===e)||(ms(n,r),delete n[ui]),this.props=n;let i=new Set;wa.forEach(e=>{let t=Y(e)?.storageGroup;t&&i.add(t)}),i.forEach(e=>{let t={};H(this.props,(n,r)=>{Y(r)?.storageGroup===e&&(t[r]=n)}),k(t)?(K.Lt(this.cl(e)),this.Vo[e]={}):K.At(this.cl(e),t)&&(this.Vo[e]={persisted:!0,fingerprint:this.bl(t,e)})})}}q.Ot(os(this.ol))&&(this.Jo=!0)}Ll(){for(let e of No){let t=K.Dt(this.cl(e));if(t&&!k(t)){let n=this.fl(e);n.persisted=!0,this.Nl(e)||(n.fingerprint=this.bl(t,e)),this.ql(e,t)||U(this.props,t)}}}Nl(e){return Object.keys(this.props).some(t=>Y(t)?.storageGroup===e)}ql(e,t){let n=is[e];if(!n)return!1;let r=t[n],i=this.props[n];return P(r)&&P(i)&&i>r}refreshKey(e){if(this.mi||this.il.has(e))return;let t=this.Qo?Y(e)?.storageGroup:void 0,n=t?K.Dt(this.cl(t)):this.Oo.Dt(this.ol);if(n&&e in n)this.wl(e,n[e],!1);else{if(t){let t=this.Oo.Dt(this.ol);if(t&&e in t)return void this.wl(e,t[e],!1)}this.kl(e,!1)}}save(){if(this.mi)return;let e=this.Il();e>0?A(this.Fl)&&(this.Fl=setTimeout(()=>{this.Fl=void 0,this.Ol()},e)):this.Ol()}flush(){A(this.Fl)||(clearTimeout(this.Fl),this.Fl=void 0,this.Ol())}Ol(e=!1){if(this.mi||this.Ko&&!e)return;e||(this.syncCookieProperties(),this.Ir.cookieWinsOnConflict&&this.Ir.persistence.toLowerCase()===`localstorage+cookie`||us.forEac
1h(e=>this.refreshKey(e)));let t=!e&&!this.Yo;t||(this.el=!1);let n=!!t&&this.Sl();if(this.el)return void(this.Ir.debug&&z.warn(`skipping persistence write because storage belongs to a different distinct ID`));if(this.Qo)return this.jl(),void(n&&this.nl.forEach(e=>e()));let r=this.Bl(this.Oo,this.ol,this.props,X);r===`written`&&this.Tl(this.props),r!==`failed`&&(this.Xo.clear(),this.tl=!1,this.il.clear()),n&&this.nl.forEach(e=>e())}jl(){let{main:e,groups:t}=this.ml(),n=this.Bl(this.Oo,this.ol,e,X);n===`written`&&this.Tl(e),n!==`failed`&&(this.tl=!1,this.il.clear(),cs.forEach(e=>{var t;(t=Y(e))!=null&&t.storageGroup||this.Xo.delete(e)}));for(let e of No){let n=t[e];if(k(n)&&!this.Vo[e]?.persisted){cs.forEach(t=>{Y(t)?.storageGroup===e&&this.Xo.delete(t)});continue}let r=this.Bl(K,this.cl(e),n,e);r!==`failed`&&cs.forEach(t=>{let n=Y(t);n?.storageGroup!==e||r!==`written`&&n.volatile||this.Xo.delete(t)})}}ml(){let e={},t={flags:{},surveys:{}};return H(this.props,(n,r)=>{let i=Y(r)?.storageGroup;i?t[i][r]=n:e[r]=n}),{main:e,groups:t}}bl(e,t){if(t===X)return JSON.stringify(e)+`|`+this.Hl+`|`+this.zl+`|`+this.Ul;let n={};return H(e,(e,t)=>{n[t]=Y(t)?.volatile?`__volatile__`:e}),JSON.stringify(n)}Bl(e,t,n,r){let i=this.fl(r);if(r!==X&&!i.dirty&&!A(i.fingerprint))return`skipped`;let a;try{if(a=this.bl(n,r),a===i.fingerprint)return i.dirty=!1,`skipped`}catch{a=void 0}return e.At(t,n,this.Hl,this.zl,this.Ul,this.Ir.debug)?(i.dirty=!1,r!==X&&(i.persisted=!0),A(a)||(i.fingerprint=a),this.Go&&(i.storageValue=K.Ot(t)),`written`):(this.Ir.debug&&z.warn(`failed to persist storage entry "${t}"; will retry on next save`),`failed`)}remove({keepGroupEntries:e=!1}={}){if(this.Cl(),A(this.Fl)||(clearTimeout(this.Fl),this.Fl=void 0),this.Oo.Lt(this.ol,!1),this.Oo.Lt(this.ol,!0),!e&&this.sl)for(let e of No)K.Lt(this.cl(e));e?delete this.Vo[X]:this.Vo={},this.Ml=void 0,this.El=void 0}clear(){this.remove(),this.props={}}register_once(e,t,n){if(O(e)){this.syncCookieProperties(),A(t)&&(t=`None`),this.Hl=A(n)?this.Wl:n;let r=!1;if(H(e,(e,n)=>{this.props.hasOwnProperty(n)&&this.props[n]!==t||(this.wl(n,e),r=!0)}),r)return this.save(),!0}return!1}register(e,t){if(O(e)){this.syncCookieProperties(),this.Hl=A(t)?this.Wl:t;let n=!1;if(H(e,(t,r)=>{e.hasOwnProperty(r)&&(this.props[r]!==t||O(t)||E(t))&&(this.wl(r,t),n=!0)}),n)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();let t=typeof e==`string`?[e]:e,n=!1;for(let e of t)e in this.props&&(this.kl(e),n=!0);n&&this.save()}update_campaign_params(){let e=s?.URL;if(e===this.rl)return;let t=qo(this.Ir.custom_campaign_params,this.Ir.mask_personal_data_properties,this.Ir.custom_personal_data_properties),n=!k(sa(t));return n&&this.register(t),this.rl=e,n?t:void 0}update_search_keyword(){this.register(function(){let e=s?.referrer;return e?Yo(e):{}}())}update_referrer_info(){this.register_once({$referrer:$o(),$referring_domain:s?.referrer&&Lo(s.referrer)?.host||Qo},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;let e=es(this.Ir.mask_personal_data_properties,this.Ir.custom_personal_data_properties,this.Ir.disable_capture_url_hashes);this.register_once({[Ni]:this.Zo?{r:ss(e.r),u:e.u?ss(e.u):void 0}:e},void 0)}get_initial_props(){let e={};H([Mi,ji],t=>{let n=this.props[t];n&&H(n,function(t,n){e[`$initial_`+ee(n)]=t})});let t=this.props[Ni];return t&&U(e,function(e,t=!1){let n=ts(e,t),r={};return H(n,function(e,t){r[`$initial_${ee(t)}`]=e}),r}(t,this.Ir.disable_capture_url_hashes)),e}safe_merge(e){return H(this.props,function(t,n){n in e||(e[n]=t)}),e}update_config(e,t,n){let r=e.persistence!==t.persistence,i=!((e,t)=>{if(e.length!==t.length)return!1;let n=[...e].sort(),r=[...t].sort();return n.every((e,t)=>e===r[t])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),a=r||i,o=e.cookieWinsOnConflict!==t.cookieWinsOnConflict,s=e.disable_persistence||!!n,c=!!this.mi&&!s;s||this.Pl(t,c),this.Ir=e,!s&&(r||i||o)&&(this.Ml=void 0,this.El=void 0,this.Pl(R(R({},e),{},{cookie_persisted_properties:t.cookie_persisted_properties}),c));let l=a||o?this.ll(e):this.Oo;this.Vl();let u=this.al(e),d=a||u!==this.Qo,f=!s&&(d||e.cross_subdomain_cookie!==this.zl||e.secure_cookie!==this.Ul)&&this.Rl(c);this.Yo=d;try{if(this.Wl=this.Hl=e.cookie_expiration,this.set_disabled(s),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),d){let e=this.props;this.clear(),this.Oo=l,this.Qo=u,this.props=e,this.save()}else o&&(this.Oo=l,s||(delete this.Vo[X],this.Ol()))}finally{this.Yo=!1,f&&this.Dl()}}Vl(){let e=this.props[Ni];if(!this.Zo||!O(e)||typeof e.r!=`string`)return;let t=ss(e.r),n=typeof e.u==`string`?ss(e.u):e.u;t===e.r&&n===e.u||this.wl(Ni,R(R({},e),{},{r:t,u:n}))}set_disabled(e){this.mi=e,this.mi?this.remove():this.save()}set_cross_subdomain(e){e!==this.zl&&(this.zl=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.Ul&&(this.Ul=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){let n=this.props.__timers||{};n[e]=t,this.wl(kr,n),this.save()}remove_event_timer(e){let t=this.props.__timers||{},n=t[e];return A(n)||(delete t[e],this.wl(kr,t),this.save()),n}get_property(e){return this.props[e]}set_property(e,t){this.wl(e,t),this.save()}wl(e,t,n=!0){var r;let i=this.props[e];this.props[e]=t,n&&(e!==`distinct_id`&&e!==`$user_state`||i===t||(this.tl=!0),ds(e)&&!fs(i,t)&&this.il.add(e),this.$l(e,i,t),(r=Y(e))!=null&&r.volatile||this.xl(e))}kl(e,t=!0){delete this.props[e],t&&(ls(e)&&this.vl(e,!0),ds(e)&&this.il.add(e),this.xl(e))}xl(e){let t=Y(e)?.storageGroup;t&&(this.fl(t).dirty=!0)}fl(e){return this.Vo[e]||(this.Vo[e]={})}},gs={GZipJS:`gzip-js`,Base64:`base64`},_s={Activation:`events`,Cancellation:`cancelEvents`},vs={Popover:`popover`,API:`api`,Widget:`widget`,ExternalSurvey:`external_survey`},ys={SHOWN:`survey shown`,DISMISSED:`survey dismissed`,SENT:`survey sent`,ABANDONED:`survey abandoned`},bs={SURVEY_ID:`$survey_id`,SURVEY_NAME:`$survey_name`,SURVEY_RESPONSE:`$survey_response`,SURVEY_ITERATION:`$survey_iteration`,SURVEY_ITERATION_
1START_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`},xs={Popover:`popover`,Inline:`inline`};function Ss(e){let t=!0;return{dispose(){if(t){t=!1;let n=e();n&&D(n.then)&&n.then(void 0,()=>{})}}}}var Cs={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`},ws={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`},Ts=B(`[RateLimiter]`),Es=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{let t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach(e=>{Ts.info(`${e||`events`} is quota limited.`),this.serverLimits[e]=new Date().getTime()+6e4})}catch(e){Ts.warn(`could not rate limit - continuing. Error: "${e?.message}"`,{text:t});return}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){return this.instance.config.rate_limiting?.events_per_second||10}get captureEventsBurstLimit(){return Math.max(this.instance.config.rate_limiting?.events_burst_limit||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e=!1){var t;let{captureEventsBurstLimit:n,captureEventsPerSecond:r}=this,i=new Date().getTime(),a=this.instance.persistence?.get_property(`$capture_rate_limit`)??{tokens:n,last:i};a.tokens+=(i-a.last)/1e3*r,a.last=i,a.tokens>n&&(a.tokens=n);let o=1>a.tokens;if(o||e||(a.tokens=Math.max(0,a.tokens-1)),o&&!e){let e=(P(a.dropped)?a.dropped:0)+1;a.dropped=e,!this.lastEventRateLimited&&this.Gl(e)&&(a.dropped=0)}return this.lastEventRateLimited=o,(t=this.instance.persistence)==null||t.set_property(`$capture_rate_limit`,a),{isRateLimited:o,remainingTokens:a.tokens}}Zl(e){let t=this.instance.config.property_denylist;return!E(t)||!t.includes(e)}Ql(){if(this.Zl(`$current_url`)&&this.Zl(`$pathname`)&&c?.pathname)return`${c.origin??``}${c.pathname}`}Gl(e){var t;let{captureEventsBurstLimit:n,captureEventsPerSecond:r}=this,i=this.Ql(),a=this.Zl(`$session_id`)?(t=this.instance).get_session_id?.call(t):void 0,o=[`${e} event(s) dropped since the last warning`,i?`triggered on ${i}`:void 0,a?`session ${a}
1`:void 0].filter(Boolean).join(`, `);return!!this.instance.capture(`$$client_ingestion_warning`,{$$client_ingestion_warning_message:`posthog-js client rate limited: ${o}. Config is set to ${r} events per second and ${n} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(e){let t=this.serverLimits[e||`events`]||!1;return!1!==t&&new Date().getTime()<t}},Ds=B(`[RemoteConfig]`),Os=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=g._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}Jl(e){var t,n;g.__PosthogExtensions__?.loadExternalDependency?(t=g.__PosthogExtensions__)==null||(n=t.loadExternalDependency)==null||n.call(t,this._instance,`remote-config`,()=>e(this.remoteConfig)):e()}Kl(e){this._instance._send_request({method:`GET`,url:this._instance.requestRouter.endpointFor(`assets`,`/array/${this._instance.config.token}/config`),callback:e})}load(){try{if(this.remoteConfig)return Ds.info(`Using preloaded remote config`,this.remoteConfig),void this.Xl(this.remoteConfig);if(this._instance.Yl())return void Ds.warn(`Remote config is disabled. Falling back to local config.`);this.Jl(e=>{if(!e)return Ds.info(`No config found after loading remote JS config. Falling back to JSON.`),void this.Kl(e=>{this.Xl(e.json,e)});this.Xl(e)})}catch(e){Ds.error(`Error loading remote config`,e),this.Xl()}}Xl(e,t){!e&&t&&(t.statusCode===0?t.error||Ds.warn(`Failed to fetch remote config from PostHog.`):Ds.error(`Failed to fetch remote config from PostHog.`));try{this._instance.Xl(e?{ok:!0,config:e}:{ok:!1})}catch(e){Ds.error(`Error applying remote config`,e)}if(!1!==e?.hasFeatureFlags&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var n;(n=this._instance.featureFlags)==null||n.ensureFlagsLoaded()}catch(e){Ds.error(`Error loading feature flags`,e)}}},ks=Uint8Array,As=Uint16Array,js=Uint32Array,Ms=new ks([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]),Ns=new ks([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]),Ps=new ks([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Fs=function(e,t){for(var n=new As(31),r=0;31>r;++r)n[r]=t+=1<<e[r-1];var i=new js(n[30]);for(r=1;30>r;++r)for(var a=n[r];n[r+1]>a;++a)i[a]=a-n[r]<<5|r;return[n,i]},Is=Fs(Ms,2),Ls=Is[1];Is[0][28]=258,Ls[258]=28;for(var Rs=Fs(Ns,0)[1],zs=new As(32768),Z=0;32768>Z;++Z){var Bs=(43690&Z)>>>1|(21845&Z)<<1;zs[Z]=((65280&(Bs=(61680&(Bs=(52428&Bs)>>>2|(13107&Bs)<<2))>>>4|(3855&Bs)<<4))>>>8|(255&Bs)<<8)>>>1}var Vs=function(e,t,n){for(var r=e.length,i=0,a=new As(t);r>i;++i)++a[e[i]-1];var o,s=new As(t);for(i=0;t>i;++i)s[i]=s[i-1]+a[i-1]<<1;if(n){o=new As(1<<t);var c=15-t;for(i=0;r>i;++i)if(e[i])for(var l=i<<4|e[i],u=t-e[i],d=s[e[i]-1]++<<u,f=d|(1<<u)-1;f>=d;++d)o[zs[d]>>>c]=l}else for(o=new As(r),i=0;r>i;++i)o[i]=zs[s[e[i]-1]++]>>>15-e[i];return o},Hs=new ks(288);for(Z=0;144>Z;++Z)Hs[Z]=8;for(Z=144;256>Z;++Z)Hs[Z]=9;for(Z=256;280>Z;++Z)Hs[Z]=7;for(Z=280;288>Z;++Z)Hs[Z]=8;var Us=new ks(32);for(Z=0;32>Z;++Z)Us[Z]=5;var Ws=Vs(Hs,9,0),Gs=Vs(Us,5,0),Ks=function(e){return(e/8|0)+(7&e&&1)},qs=function(e,t,n){(t==null||0>t)&&(t=0),(n==null||n>e.length)&&(n=e.length);var r=new(e instanceof As?As:e instanceof js?js:ks)(n-t);return r.set(e.subarray(t,n)),r},Js=function(e,t,n){var r=t/8|0;e[r]|=n<<=7&t,e[r+1]|=n>>>8},Ys=function(e,t,n){var r=t/8|0;e[r]|=n<<=7&t,e[r+1]|=n>>>8,e[r+2]|=n>>>16},Xs=function(e,t){for(var n=[],r=0;e.length>r;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,a=n.slice();if(!i)return[new ks(0),0];if(i==1){var o=new ks(n[0].s+1);return o[n[0].s]=1,[o,1]}n.sort(function(e,t){return e.f-t.f}),n.push({s:-1,f:25001});var s=n[0],c=n[1],l=0,u=1,d=2;for(n[0]={s:-1,f:s.f+c.f,l:s,r:c};u!=i-1;)s=n[n[d].f>n[l].f?l++:d++],c=n[l!=u&&n[d].f>n[l].f?l++:d++],n[u++]={s:-1,f:s.f+c.f,l:s,r:c};var f=a[0].s;for(r=1;i>r;++r)a[r].s>f&&(f=a[r].s);var p=new As(f+1),m=Zs(n[u-1],p,0);if(m>t){r=0;var h=0,g=m-t,_=1<<g;for(a.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});i>r;++r){var v=a[r].s;if(t>=p[v])break;h+=_-(1<<m-p[v]),p[v]=t}for(h>>>=g;h>0;){var y=a[r].s;t>p[y]?h-=1<<t-p[y]++-1:++r}for(;r>=0&&h;--r){var b=a[r].s;p[b]==t&&(--p[b],++h)}m=t}
vendor: 5,417 bytes, line 1
1return[new ks(p),m]},Zs=function(e,t,n){return e.s==-1?Math.max(Zs(e.l,t,n+1),Zs(e.r,t,n+1)):t[e.s]=n},Qs=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new As(++t),r=0,i=e[0],a=1,o=function(e){n[r++]=e},s=1;t>=s;++s)if(e[s]==i&&s!=t)++a;else{if(!i&&a>2){for(;a>138;a-=138)o(32754);a>2&&(o(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(o(i),--a;a>6;a-=6)o(8304);a>2&&(o(a-3<<5|8208),a=0)}for(;a--;)o(i);a=1,i=e[s]}return[n.subarray(0,r),t]},$s=function(e,t){for(var n=0,r=0;t.length>r;++r)n+=e[r]*t[r];return n},ec=function(e,t,n){var r=n.length,i=Ks(t+2);e[i]=255&r,e[i+1]=r>>>8,e[i+2]=255^e[i],e[i+3]=255^e[i+1];for(var a=0;r>a;++a)e[i+a+4]=n[a];return 8*(i+4+r)},tc=function(e,t,n,r,i,a,o,s,c,l,u){Js(t,u++,n),++i[256];for(var d=Xs(i,15),f=d[0],p=d[1],m=Xs(a,15),h=m[0],g=m[1],_=Qs(f),v=_[0],y=_[1],b=Qs(h),x=b[0],S=b[1],C=new As(19),w=0;v.length>w;++w)C[31&v[w]]++;for(w=0;x.length>w;++w)C[31&x[w]]++;for(var ee=Xs(C,7),te=ee[0],ne=ee[1],T=19;T>4&&!te[Ps[T-1]];--T);var re,E,D,O,k=l+5<<3,A=$s(i,Hs)+$s(a,Us)+o,j=$s(i,f)+$s(a,h)+o+14+3*T+$s(C,te)+(2*C[16]+3*C[17]+7*C[18]);if(A>=k&&j>=k)return ec(t,u,e.subarray(c,c+l));if(Js(t,u,1+(A>j)),u+=2,A>j){re=Vs(f,p,0),E=f,D=Vs(h,g,0),O=h;var ie=Vs(te,ne,0);for(Js(t,u,y-257),Js(t,u+5,S-1),Js(t,u+10,T-4),u+=14,w=0;T>w;++w)Js(t,u+3*w,te[Ps[w]]);u+=3*T;for(var M=[v,x],N=0;2>N;++N){var P=M[N];for(w=0;P.length>w;++w)Js(t,u,ie[F=31&P[w]]),u+=te[F],F>15&&(Js(t,u,P[w]>>>5&127),u+=P[w]>>>12)}}else re=Ws,E=Hs,D=Gs,O=Us;for(w=0;s>w;++w)if(r[w]>255){var F;Ys(t,u,re[257+(F=r[w]>>>18&31)]),u+=E[F+257],F>7&&(Js(t,u,r[w]>>>23&31),u+=Ms[F]);var I=31&r[w];Ys(t,u,D[I]),u+=O[I],I>3&&(Ys(t,u,r[w]>>>5&8191),u+=Ns[I])}else Ys(t,u,re[r[w]]),u+=E[r[w]];return Ys(t,u,re[256]),u+E[256]},nc=new js([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),rc=new ks(0),ic=function(){for(var e=new js(256),t=0;256>t;++t){for(var n=t,r=9;--r;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),ac=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function oc(e,t){t===void 0&&(t={});var n=function(){var e=4294967295;return{p(t){for(var n=e,r=0;t.length>r;++r)n=ic[255&n^t[r]]^n>>>8;e=n},d(){return 4294967295^e}}}(),r=e.length;n.p(e);var i,a,o,s,c,l,u=(s=10+((i=t).filename&&i.filename.length+1||0),c=8,function(e,t,n,r,i,a){var o=e.length,s=new ks(r+o+5*(1+Math.floor(o/7e3))+i),c=s.subarray(r,s.length-i),l=0;if(!t||8>o)for(var u=0;o>=u;u+=65535){var d=u+65535;o>d?l=ec(c,l,e.subarray(u,d)):(c[u]=a,l=ec(c,l,e.subarray(u,o)))}else{for(var f=nc[t-1],p=f>>>13,m=8191&f,h=(1<<n)-1,g=new As(32768),_=new As(h+1),v=Math.ceil(n/3),y=2*v,b=function(t){return(e[t]^e[t+1]<<v^e[t+2]<<y)&h},x=new js(25e3),S=new As(288),C=new As(32),w=0,ee=0,te=(u=0,0),ne=0,T=0;o>u;++u){var re=b(u),E=32767&u,D=_[re];if(g[E]=D,_[re]=E,u>=ne){var O=o-u;if((w>7e3||te>24576)&&O>423){l=tc(e,c,0,x,S,C,ee,te,T,u-T,l),te=w=ee=0,T=u;for(var k=0;286>k;++k)S[k]=0;for(k=0;30>k;++k)C[k]=0}var A=2,j=0,ie=m,M=E-D&32767;if(O>2&&re==b(u-M))for(var N=Math.min(p,O)-1,P=Math.min(32767,u),F=Math.min(258,O);P>=M&&--ie&&E!=D;){if(e[u+A]==e[u+A-M]){for(var I=0;F>I&&e[u+I]==e[u+I-M];++I);if(I>A){if(A=I,j=M,I>N)break;var ae=Math.min(M,I-2),oe=0;for(k=0;ae>k;++k){var se=u-M+k+32768&32767,ce=se-g[se]+32768&32767;ce>oe&&(oe=ce,D=se)}}}M+=(E=D)-(D=g[E])+32768&32767}if(j){x[te++]=268435456|Ls[A]<<18|Rs[j];var le=31&Ls[A],ue=31&Rs[j];ee+=Ms[le]+Ns[ue],++S[257+le],++C[ue],ne=u+A,++w}else x[te++]=e[u],++S[e[u]]}}l=tc(e,c,a,x,S,C,ee,te,T,u-T,l),a||(l=ec(c,l,rc))}return qs(s,0,r+Ks(l)+i)}(a=e,(o=t).level==null?6:o.level,o.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(a.length)))):12+o.mem,s,c,!l)),d=u.length;return function(e,t){var n=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=2>t.level?4:t.level==9?2:0,e[9]=3,t.mtime!=0&&ac(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var r=0;n.length>=r;++r)e[r+10]=n.charCodeAt(r)}}(u,t),ac(u,d-8,n.d()),ac(u,d-4,r),u}var sc=!!u||!!l,cc=new WeakMap,lc=`text/plain`,uc=0,dc=!1,fc=(e,t)=>{let[n,r]=e.split(`#`),[i,a]=n.split(`?`);if(!a)return e;let o=a.split(`&`).filter(e=>e.split(`=`)[0]!==t).join(`&`);return`${i}${o?`?${o}`:``}${r?`#${r}`:``}`},pc=(e,t,n=!0)=>{let[r,i]=e.split(`?`),a=R({},t),o=i?.split(`&`).map(e=>{var t;let[r,i]=e.split(`=`),o=n&&(t=a[r])!=null?t:i;return delete a[r],`${r}=${o}`})??[],s=function(e,t=`&`){let n,r,i=[];return H(e,function(e,t){A(e)||A(t)||t===`undefined`||(n=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),r=encodeURIComponent(t),i[i.length]=r+`=`+n)}),i.join(t)}(a);return s&&o.push(s),o.length>0?`${r}?${o.join(`&`)}`:r},mc=e=>{if(e.ta)return e.ta;let{data:t,compression:n}=e;if(!t)return;if(n===gs.GZipJS){let e=oc(function(e){var t=e.length;if(typeof TextEncoder<`u`)return new TextEncoder().encode(e);for(var n=new ks(e.length+(e.length>>>1)),r=0,i=function(e){n[r++]=e},a=0;t>a;++a){if(r+5>n.length){var o=new ks(r+8+(t-a<<1));o.set(n),n=o}var s=e.charCodeAt(a);128>s?i(s):2048>s?(i(192|s>>>6),i(128|63&s)):s>55295&&57344>s?(i(240|(s=65536+(1047552&s)|1023&e.charCodeAt(++a))>>>18),i(128|s>>>12&63),i(128|s>>>6&63),i(128|63&s)):(i(224|s>>>12),i(128|s>>>6&63),i(128|63&s))}return qs(n,0,r)}(Io(t)),{mtime:0});return{contentType:lc,body:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength),estimatedSize:e.byteLength}}if(n===gs.Base64){let e=(e=>`data=`+encodeURIComponent(typeof e==`string`?e:Io(e)))(function(e){return e&&btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(e,t)=>
1String.fromCharCode(parseInt(t,16))))}(Io(t)));return{contentType:`application/x-www-form-urlencoded`,body:e,estimatedSize:new Blob([e]).size}}let r=Io(t);return{contentType:`application/json`,body:r,estimatedSize:new Blob([r]).size}},hc=e=>{let t=()=>e.transport===`sendBeacon`?{url:pc(e.url,{compression:gs.Base64}),encodedBody:mc(R(R({},e),{},{compression:gs.Base64,ta:void 0}))}:{url:fc(e.url,`compression`),encodedBody:mc(R(R({},e),{},{compression:void 0,ta:void 0}))},n;try{n=mc(e)}catch(n){if(In(e.compression,Ro(e.url,`compression`)))return z.error(`Failed to gzip request body, sending uncompressed payload`,n),t();throw n}return n&&In(e.compression,Ro(e.url,`compression`))&&!((r=n.body)instanceof ArrayBuffer?Fn(new Uint8Array(r)):ArrayBuffer.isView(r)&&Fn(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)))?(dc=!0,t()):{url:e.url,encodedBody:n};var r},gc=e=>{try{return hc(e)}catch(n){var t;z.error(n),(t=e.callback)==null||t.call(e,{statusCode:0,error:n});return}},_c=function(){var e=L(function*(e){let t=yield function(e){return Hn.apply(this,arguments)}(Io(e.data),V.DEBUG,{rethrow:!0});if(!t)return e;let n=yield t.arrayBuffer();return R(R({},e),{},{ta:{contentType:lc,body:n,estimatedSize:n.byteLength}})});return function(t){return e.apply(this,arguments)}}(),vc=/Failed to fetch|NetworkError|Load failed/i,yc=e=>e?.name===`TypeError`&&vc.test(e?.message||``),bc=e=>{try{let t=function(e,t=Date.now()){if(typeof e!=`string`||!e)return;let n=e.trim(),r=/^\d+\s*,/.test(n)?n.slice(0,n.indexOf(`,`)).trim():n;if(/^\d+$/.test(r)){let e=1e3*Math.min(Number(r),300);return e>0?e:void 0}if(!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(r))return;let i=/^\w{3} \w{3} /.test(r)?r+` GMT`:r,a=Date.parse(i)-t;return Number.isFinite(a)&&a>0?Math.min(a,Dt):void 0}(e());return A(t)?void 0:Math.min(t,3e4)}catch{return}},xc=e=>{let t=gc(e);if(!t)return;let n=new u;cc.set(n,!0);let{url:r,encodedBody:i}=t;n.open(e.method||`GET`,r,!0);let{contentType:a,body:o}=i??{};H(e.headers,function(e,t){n.setRequestHeader(t,e)}),a&&n.setRequestHeader(`Content-Type`,a),e.timeout&&(n.timeout=e.timeout),n.onreadystatechange=()=>{if(n.readyState===4){var t;let r={statusCode:n.status,text:n.responseText};if(n.status===200)try{r.json=JSON.parse(n.responseText)}catch{}(t=e.callback)==null||t.call(e,r,bc(()=>n.getResponseHeader(`Retry-After`)))}},n.send(o)},Sc=e=>{let t=gc(e);if(!t)return;let{url:n,encodedBody:r}=t,{contentType:i,body:a,estimatedSize:o}=r??{},s=new Headers;H(e.headers,function(e,t){s.append(t,e)}),i&&s.append(`Content-Type`,i);let c=null,u=!1;if(d){let t=new d;c={signal:t.signal,timeout:setTimeout(()=>{u=!0;try{t.abort(jt(`AbortError`,`PostHog request timed out`+((n=e.timeout)?` after ${n}ms`:``)))}catch(e){p(e)}var n},e.timeout)}}let f=!1,p=t=>{var n;f||(f=!0,u&&t?.name===`AbortError`||yc(t)?z.warn(t):z.error(t),(n=e.callback)==null||n.call(e,{statusCode:0,error:t}))},m=0,h=()=>{uc-=m,m=0,c&&clearTimeout(c.timeout)};try{let t=R({method:e?.method||`GET`,headers:s,referrerPolicy:`strict-origin`,body:a,signal:c?.signal},e.fetchOptions),r=o??(A(a)?0:void 0);t.keepalive=t.method===`POST`&&!e.ea&&!1!==t.keepalive&&t.body===a&&!A(r)&&r>=0&&52428.8>uc+r,t.keepalive&&(m=r,uc+=m),l(n,t).then(t=>t.text().then(n=>{var r;if(f)return;let i={statusCode:t.status,text:n};if(t.status===200)try{i.json=JSON.parse(n)}catch(e){z.error(e)}f=!0,h(),(r=e.callback)==null||r.call(e,i,bc(()=>t.headers.get(`Retry-After`)))})).catch(e=>{h(),p(e)}).finally(h)}catch(e){h(),p(e)}},Cc=e=>{try{let{url:t,encodedBody:n}=hc(e),{contentType:r,body:i,estimatedSize:a}=n??{};if(!i)return;let s=i instanceof Blob?i:new Blob([i],{type:r});if(o.sendBeacon(t,s))return;let c=E(e.data)?e.data:e.data?.batch;if(E(c)&&c.length>1&&(a??0)>16384){let t=Math.ceil(c.length/2),n=t=>E(e.data)?t:R(R({},e.data),{},{batch:t});Cc(R(R({},e),{},{data:n(c.slice(0,t))})),Cc(R(R({},e),{},{data:n(c.slice(t))}));return}z.warn(`Beacon of ~${a??0} bytes was rejected by the browser, falling back to ${l?`fetch`:`XHR`}`),l?Sc(R(R({},e),{},{ea:!0})):xc(e)}catch(e){z.warn(`Beacon send failed`,e)}},wc=(e,t,n,r)=>{let i=r===`query`?t===`POST`?`sent_at`:`_`:void 0;return pc(n===gs.GZipJS?fc(e,`compression`):e,R(R({},i?{[i]:Date.now().toString()}:{}),n===gs.GZipJS?{}:{compression:n}))},Tc=(()=>{let e=[];return l&&e.push({transport:`fetch`,method:Sc}),u&&e.push({transport:`XHR`,method:xc}),o!=null&&o.sendBeacon&&e.push({transport:`sendBeacon`,method:Cc}),e})(),Ec=!sc&&p?.indexOf(`MSIE`)===-1&&p?.indexOf(`Mozilla`)===-1;function Dc(e,t,n){var r,i;n&&(t=R(R({},t),{},{callback:e=>n(e)})),e.__loaded?Ec?e.__request_queue.push(t):e.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&((r=t.callback)==null||r.call(t,{statusCode:429})):(t.transport=t.transport||e.config.api_transport,t.headers=R(R({},e.config.request_headers),t.headers),t.compression=t.compression===`best-available`?e.compression??t.compressionFallback:t.compression,(A(e.config.disable_beacon)?e.config.__preview_disable_beacon:e.config.disable_beacon)&&(t.disableTransport=[`sendBeacon`]),t.fetchOptions=t.fetchOptions||e.config.fetch_options,
1((e,t)=>{let n=R(R({},e),{},{callback:t??(t=>e.callback?.call(e,t))});n.timeout=n.timeout||6e4;let r=n.transport??`fetch`;r===`sendBeacon`&&A(n.compression)&&n.data&&(n.compression=gs.Base64),n.method===`POST`&&n.data&&(n.timestampMode===`capture-body`?n.data=(e=>{var t;let n=(E(e)?e:[e]).map(e=>R(R({},e),e.timestamp instanceof Date&&!isNaN(e.timestamp.getTime())?{timestamp:e.timestamp.toISOString()}:{})),r=n[0];return{api_key:(r==null||(t=r.properties)==null?void 0:t.token)??r?.token,batch:n,sent_at:new Date().toISOString()}})(n.data):n.timestampMode===`body`&&(n.data=((e,t=new Date().toISOString())=>E(e)?e.map(e=>R(R({},e),{},{sent_at:t})):R(R({},e),{},{sent_at:t}))(n.data))),n.url=wc(n.url,n.method,n.compression,n.timestampMode);let i=Tc.filter(e=>!n.disableTransport||!e.transport||!n.disableTransport.includes(e.transport)),a=function(e,t){for(let n=0;e.length>n;n++)if(t(e[n]))return e[n]}(i,e=>e.transport===r)?.method??i[0].method;if(!a)throw Error(`No available transport method`);let o=e=>{try{a(e)}catch(e){var t;yc(e)?z.warn(e):z.error(e),(t=n.callback)==null||t.call(n,{statusCode:0,error:e})}};r!==`sendBeacon`&&n.data&&n.compression===gs.GZipJS&&f&&typeof Promise<`u`&&!dc?_c(n).then(e=>{o(e)}).catch(t=>{if(Ln(t))return dc=!0,void o(R(R({},n),{},{compression:void 0,url:wc(e.url,e.method,void 0,e.timestampMode)}));(e=>{if(!e||typeof e!=`object`)return!1;let t=`name`in e?String(e.name):``;return Ln(e)||t===Pn})(t)&&(dc=!0),o(n)}):a(n)})(t,(r,i)=>{var a,o,s;e.rateLimiter.checkForLimiting(r),400>r.statusCode||(a=(o=e.config).on_request_error)==null||a.call(o,r),n?n(r,i):(s=t.callback)==null||s.call(t,r)})):t.fireCallbackOnDrop&&((i=t.callback)==null||i.call(t,{statusCode:0}))}var Oc=class{constructor(e,t){this.ia=!0,this.na=[],this.sa=ve(t?.flush_interval_ms||3e3,250,5e3,z.createLogger(`flush interval`),3e3),this.ra=e}enqueue(e){this.na.push(e),this.oa||this.la()}unload(){this.aa();let e=this.na.length>0?this.ua():{},t=Object.values(e);[...t.filter(e=>e.url.indexOf(`/e`)===0),...t.filter(e=>e.url.indexOf(`/e`)!==0)].map(e=>{this.ha(e,`sendBeacon`)})}enable(){this.ia=!1,this.la()}la(){this.ia||(this.oa=setTimeout(()=>{if(this.aa(),this.na.length>0){let e=this.ua();for(let t in e)this.ha(e[t])}},this.sa))}ha(e,t){try{this.ra(e,t)}catch(e){z.error(e)}}aa(){clearTimeout(this.oa),this.oa=void 0}ua(){let e={};return H(this.na,t=>{var n;let r=t,i=((r?r.batchKey:null)||r.url)+(r.batchGroup?`:${r.batchGroup}`:``);A(e[i])&&(e[i]=R(R({},r),{},{data:[]})),(n=e[i].data)==null||n.push(r.data)}),this.na=[],e}},kc=[`retriesPerformedSoFar`],Ac=class{constructor(e){this._instance=e,this.ca=!1,this.da=3e3,this.na=[],this.na=[],this.va=!0,this.resume()}resume(){if(!A(i)&&`onLine`in i.navigator){if(this.va=i.navigator.onLine,this.fa)return;this.fa=()=>{this.va=!0,this.pa()},this.ga=()=>{this.va=!1},W(i,`online`,this.fa),W(i,`offline`,this.ga)}}get length(){return this.na.length}retriableRequest(e,t){let{retriesPerformedSoFar:n}=e,r=Un(e,kc);F(n)&&(r.url=pc(r.url,{retry_count:n})),Dc(this._instance,t?R(R({},r),{},{transport:t}):r,(e,t)=>{var i;if(e.statusCode!==200&&(400>e.statusCode||e.statusCode>=500)){if((e.statusCode===0?3:10)>(n??0))return void this.Ls(R({retriesPerformedSoFar:n},r),t);e.statusCode===0&&z.warn(`Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after ${n??0} retries.`)}(i=r.callback)==null||i.call(r,e)})}Ls(e,t){let n=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=n+1;let r=Math.max(function(e){let t=3e3*2**e,n=t/2,r=Math.min(18e5,t),i=(Math.random()-.5)*(r-n);return Math.ceil(r+i)}(n),t??0),i=Date.now()+r;this.na.push({retryAt:i,requestOptions:e});let a=`Enqueued failed request for retry in ${r}`;navigator.onLine||(a+=` (Browser is offline)`),z.warn(a),this.ca||(this.ca=!0,this.ma())}ma(){if(this.ya&&clearTimeout(this.ya),this.na.length===0)return this.ca=!1,void(this.ya=void 0);this.ya=setTimeout(()=>{this.va&&this.na.length>0&&this.pa(),this.ma()},this.da)}pa(){let e=Date.now(),t=[],n=this.na.filter(n=>e>n.retryAt||(t.push(n),!1));if(this.na=t,n.length>0)for(let{requestOptions:e}of n)this.retriableRequest(e)}unload(){this.ya&&=(clearTimeout(this.ya),void 0),this.ca=!1,A(i)||(this.fa&&=(i.removeEventListener(`online`,this.fa),void 0),this.ga&&=(i.removeEventListener(`offline`,this.ga),void 0));for(let{requestOptions:e}of this.na)try{this._instance._send_request(R(R({},e),{},{transport:`sendBeacon`}))}catch(e){z.error(e)}this.na=[]}},jc=class{constructor(e){this._instance=e,this.ba=()=>{this._a||={};let e=this.scrollElement(),t=this.scrollY(),n=e?Math.max(0,e.scrollHeight-e.clientHeight):0,r=t+(e?.clientHeight||0),i=e?.scrollHeight||0;this._a.lastScrollY=Math.ceil(t),this._a.maxScrollY=Math.max(t,this._a.maxScrollY??0),this._a.maxScrollHeight=Math.max(n,this._a.maxScrollHeight??0),this._a.lastContentY=r,this._a.maxContentY=Math.max(r,this._a.maxContentY??0),this._a.maxContentHeight=Math.max(i,this._a.maxContentHeight??0)}}get wa(){return this._instance.config.scroll_root_selector}getContext(){return this._a}resetContext(){let e=this._a;return this._a=void 0,setTimeout(this.ba,0),e}startMeasuringScrollPosition(){W(i,`scroll`,this.ba,{capture:!0}),W(i,`scrollend`,this.ba,{capture:!0}),W(i,`resize`,this.ba)}scrollElement(){if(this.wa){let t=E(this.wa)?this.wa:[this.wa];for(let n of t){var e;let t=i==null||(e=i.document)==null?void 0:e.querySelector(n);if(t)return t}return}var t;return i==null||(t=i.document)==null?void 0:t.documentElement}ka(e){var t,n;let r=e===`y`?`scrollTop`:`scrollLeft`;if(this.wa){let e=this.scrollElement();return e&&e[r]||0}return i?e===`y`?i.scrollY||i.pageYOffset||((t=i.document)==null||(t=t.documentElement)==null?void 0:t.scrollTop)||0:i.scrollX||i.pageXOffset||((n=i.document)==null||(n=n.documentElement)==null?void 0:n.scrollLeft)||0:0}scrollY(){return this.ka(`y`)}scrollX(){return this.ka(`x`)}},Mc=e=>es(e?.config.mask_personal_data_properties,e?.config.custom_personal_data_properties,e?.config.disable_capture_url_hashes
1),Nc=class{constructor(e,t,n,r){this.Be=e=>{let t=this.Sa();if(t&&t.sessionId===e)return;let n={sessionId:e,props:this.xa(this._instance)};this.Ca.register({[ki]:n})},this._instance=e,this.$a=t,this.Ca=n,this.xa=r||Mc,this.$a.onSessionId(this.Be)}Sa(){return this.Ca.props[ki]}getSetOnceProps(){let e=this.Sa()?.props;return e?`r`in e?ts(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(){let e={};return H(sa(this.getSetOnceProps()),(t,n)=>{n===`$current_url`&&(n=`url`),e[`$session_entry_${ee(n)}`]=t}),e}},Pc=class{on(e,t){return this.Ia[e]||(this.Ia[e]=[]),this.Ia[e].push(t),()=>{this.Ia[e]=this.Ia[e].filter(e=>e!==t)}}emit(e,t){for(let n of this.Ia[e]||[])n(t);for(let n of this.Ia[`*`]||[])n(e,t)}constructor(){this.Ia={}}},Fc=B(`[SessionId]`),Ic=864e5,Lc=class{on(e,t){return this.Ta.on(e,t)}constructor(e,t,n){var r;if(this.Ma=null,this.Ea=null,this.Pa=[],this.Ra=void 0,this.Aa=!1,this.Ta=new Pc,this.Fa=(e,t)=>!(!F(e)||!F(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw Error(`SessionIdManager requires a PostHogPersistence instance`);if(e.config.cookieless_mode===`always`)throw Error(`SessionIdManager cannot be used with cookieless_mode="always"`);this.Ir=e.config,this.Ca=e.persistence,this.He=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.Oa=void 0,this._sessionActivityTimestamp=null,this.Da=t||va,this.La=n||va;let i=this.Ir.persistence_name||this.Ir.token;if(this._sessionTimeoutMs=1e3*ve(this.Ir.session_idle_timeout_seconds||1800,60,36e3,Fc.createLogger(`session_idle_timeout_seconds`),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Na(),this.qa=`ph_`+i+`_window_id`,this.ja=`ph_`+i+`_primary_window_exists`,this.Ba()){let e=q.Dt(this.qa),t=q.Dt(this.ja);e&&!t?this.He=e:q.Lt(this.qa),q.At(this.ja,!0)}(r=this.Ir.bootstrap)!=null&&r.sessionID&&this.setBootstrapSessionId(this.Ir.bootstrap.sessionID),this.Ha()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return A(this.Pa)&&(this.Pa=[]),this.Pa.push(e),this.Xt&&e(this.Xt,this.He),()=>{this.Pa=this.Pa.filter(t=>t!==e)}}Ba(){return this.Ir.persistence!==`memory`&&!this.Ca.mi&&q.Et()}za(e){e!==this.He&&(this.He=e,this.Ba()&&q.At(this.qa,e))}Ua(){return this.He?this.He:this.Ba()?q.Dt(this.qa):null}Wa(e){let t=this.Ma;return!M(t)&&!M(e)&&5e3>Math.abs(e-t)}Va(e,t,n){let r=t!==this._sessionActivityTimestamp,i=e===this.Xt&&n===this._sessionStartTimestamp;this._sessionStartTimestamp=n,this._sessionActivityTimestamp=t,this.Xt=e,i&&!r||i&&this.Wa(t)||(this.Ma=t,this.Ca.register({[qr]:[t,e,n]}))}Ga(){let e=this.Ir?.persistence_save_debounce_ms;return F(e)&&e>0}Za(){this.Ga()?this.Ca.refreshKey(qr):(this.Ca.flush(),this.Ca.load())}Qa(){if(M(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.Ma)return;this.Za();let[,e,t]=this.Ja();e===this.Xt&&t===this._sessionStartTimestamp&&(this.Ma=this._sessionActivityTimestamp,this.Ca.register({[qr]:[this._sessionActivityTimestamp,this.Xt??null,this._sessionStartTimestamp]}),this.Ca.flush())}Ka(){let[e]=this.Ja(),t=F(e)?e:0,n=F(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,n)}Xa(e){return this.Za(),this.Fa(e,this.Ka())}Ja(){let e=this.Ca.props[qr];return E(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Ma=null,this.Oa=void 0,clearTimeout(this.Ya),this.Ya=void 0,this.Va(null,null,null)}setBootstrapSessionId(e,t=!1){let n=((e,t=new Date().getTime())=>{try{let n=(e=>{let t=e.replace(/-/g,``);if(t.length!==32)throw Error(`Not a valid UUID`);if(t[12]!==`7`)throw Error(`Not a UUIDv7`);return parseInt(t.substring(0,12),16)})(e);return n>t+6e4?void Fc.error(`Bootstrap sessionID cannot be in the future`):n}catch(e){Fc.error(`Invalid sessionID in bootstrap`,e);return}})(e);return!A(n)&&(t?this.Oa={sessionId:e,sessionStartTimestamp:n}:this.Va(e,new Date().getTime(),n),!0)}destroy(){this.Aa=!0,this.Qa(),clearTimeout(this.Ya),this.Ya=void 0,this.Ra&&i&&(i.removeEventListener($i,this.Ra,{capture:!1}),this.Ra=void 0),this.Pa=[]}Ha(){this.Ra=()=>{this.Qa(),this.Ba()&&q.Lt(this.ja)},W(i,$i,this.Ra,{capture:!1})}
1checkAndGetSessionAndWindowId(e=!1,t=null,n=!1){if(this.Ir.cookieless_mode===`always`)throw Error(`checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"`);let r=t||new Date().getTime(),i=this.Xt;if(n)this.Ea=r;else if(M(this.Ea)||this.Ea>r||r-this.Ea>=1e3){var a,o;(a=(o=this.Ca).syncCookieProperties)==null||a.call(o),this.Ea=r}let[,s,c]=this.Ja(),l=!A(i)&&s!==i,u=this.Ka(),d=this.Ua(),f=this.Oa,p=!!f&&(f.sessionStartTimestamp>r+6e4||r-f.sessionStartTimestamp>Ic),m=f?p:F(c)&&Math.abs(r-c)>Ic,h=!1,g=l,_=!s||!!f,v=s,y=!_&&!e&&this.Fa(r,u);if(y&&(y=this.Xa(r),y||Fc.info(`cross-tab refresh kept the session alive`,{sessionId:s}),[,s,c]=this.Ja()),_||y||m){g=!1;let e=f&&!p;s=e?f.sessionId:this.Da(),d=this.La(),Fc.info(`new session ID assigned`,{sessionId:s,windowId:d,bootstrapped:!!e,changeReason:{noSessionId:_,activityTimeout:y,sessionPastMaximumLength:m}}),c=e?f.sessionStartTimestamp:r,this.Oa=void 0,h=!0}else d||(d=this.La(),h=!0),g||=s!==v,g&&(Fc.info(`adopted cross-tab session id`,{sessionId:s,windowId:d}),h=!0);let b=F(u)&&e&&!m?u:r,x=F(c)?c:new Date().getTime();this.za(d),this.Va(s,b,x),e||this.Na();let S={noSessionId:_,activityTimeout:y,sessionPastMaximumLength:m,crossTabAdoption:g};return h&&this.Pa.forEach(e=>e(s,d,S)),{sessionId:s,windowId:d,sessionStartTimestamp:x,changeReason:h?S:void 0,lastActivityTimestamp:u}}Na(){this.Aa||(clearTimeout(this.Ya),this.Ya=setTimeout(()=>{if(!this.Aa){if(this.Xa(new Date().getTime())){let e=this.Xt;this.resetSessionId(),this.Ta.emit(`forcedIdleReset`,{idleSessionId:e})}else this.Na()}},1.1*this.sessionTimeoutMs))}},Rc=function(e,t){if(!e)return!1;let n=e.userAgent;if(n&&_e(n,t))return!0;try{let n=e?.userAgentData;if(n?.brands&&n.brands.some(e=>_e(e?.brand,t)))return!0}catch{}return!!e.webdriver};function zc(){return(zc=L(function*(){let e=o?.userAgentData;if(e?.getHighEntropyValues)try{let t=(yield e.getHighEntropyValues([`model`]))?.model;return j(t)&&t.length>0?t:void 0}catch(e){z.info(`Unable to resolve $device_model from userAgentData.getHighEntropyValues`,e);return}})).apply(this,arguments)}function Bc(e,t){let n=`$survey_${t}/${e.id}`;return e.current_iteration&&e.current_iteration>0&&(n=`$survey_${t}/${e.id}/${e.current_iteration}`),n}function Vc(e){var t;return!!((t=e.conditions)!=null&&(t=t.events)!=null&&(t=t.values)!=null&&t.length)}var Hc=(e,t)=>{if(!(e=>{try{new RegExp(e)}catch{return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}},Uc=e=>e.toLowerCase(),Wc={exact:(e,t)=>t.some(t=>e.some(e=>t===e)),is_not:(e,t)=>t.every(t=>e.every(e=>t!==e)),regex:(e,t)=>t.some(t=>e.some(e=>Hc(t,e))),not_regex:(e,t)=>t.every(t=>e.every(e=>!Hc(t,e))),icontains:(e,t)=>t.map(Uc).some(t=>e.map(Uc).some(e=>t.includes(e))),not_icontains:(e,t)=>t.map(Uc).every(t=>e.map(Uc).every(e=>!t.includes(e))),gt:(e,t)=>t.some(t=>{let n=parseFloat(t);return!isNaN(n)&&e.some(e=>n>parseFloat(e))}),lt:(e,t)=>t.some(t=>{let n=parseFloat(t);return!isNaN(n)&&e.some(e=>n<parseFloat(e))})};function Gc(e,t){return!e||Object.entries(e).every(([e,n])=>{let r=t?.[e];if(r==null)return!1;let i=Wc[n.operator];return!!i&&i(n.values,[String(r)])})}function Kc(e,t,n){return Io({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}var qc=`custom`,Jc=`i.posthog.com`,Yc=/^\/static\//,Xc=[`/s/`,`/e/`,`/i/`],Zc=class{constructor(e){this.tu={},this.instance=e}get apiHost(){let e=this.instance.config.api_host.trim().replace(/\/$/,``);return e===`https://app.posthog.com`?`https://us.i.posthog.com`:e}get flagsApiHost(){let e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,``):this.apiHost}get uiHost(){let e=this.instance.config.ui_host?.replace(/\/$/,``);return e||=this.apiHost.replace(`.${Jc}`,`.posthog.com`),e===`https://app.posthog.com`?`https://us.posthog.com`:e}get region(){return this.tu[this.apiHost]||(this.tu[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`:qc),this.tu[this.apiHost]}eu(e){if(!Yc.test(e))return;let t=this.instance.config.asset_host;return typeof t==`string`&&t.trim().replace(/\/$/,``)||void 0}iu(e){let t=Lo(e);return t?t.protocol+`//`+t.host+t.pathname:void 0}nu(e,t,n){if(e===`ui`)return n;let r=n,i=this.instance.config.rewriteRequestPath;if(i){let e=Lo(n)?.href||n;r=i(new URL(e)).toString()}if(i&&e===`api`&&Xc.some(e=>t.indexOf(e)===0)){let e=this.iu(r);if(e){let t=this.apiHost,n=this.su;n?.apiHost===t&&n.rewriteRequestPath===i||(n={apiHost:t,rewriteRequestPath:i,urls:new Set},this.su=n),n.urls.add(e)}}return r}isIngestionEndpoint(e){let t=this.su,n=this.iu(e);return t?.apiHost===this.apiHost&&t.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!n&&t.urls.has(n)}endpointFor(e,t=``){if(t&&=t[0]===`/`?t:`/${t}`,e===`ui`)return this.nu(e,t,this.uiHost+t);if(e===`flags`)return this.nu(e,t,this.flagsApiHost+t);if(e===`assets`){let n=this.eu(t);if(n)return this.nu(e,t,`${n}${t}`)}if(this.region===qc)return this.nu(e,t,this.apiHost+t);let n=Jc+t;switch(e){case`assets`:return this.nu(e,t,`https://${this.region}-assets.${n}`);case`api`:return this.nu(e,t,`https://${this.region}.${n}`)}}},Q=B(`[Surveys]`),Qc=e=>{try{let t=(e=>((e,t)=>`seenSurvey_${function(e){return e.current_iteration&&e.current_iteration>0?`${e.id}_${e.current_iteration}`:e.id}(t)}`)(0,e))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,`true`)}catch(e){Q.error(`Failed to persist survey seen state`,e)}},$c=[vs.Popover,vs.Widget,vs.API],el={ignoreConditions:!1,ignoreDelay:!1,displayType:xs.Popover}
1,tl=B(`[PostHog ExternalIntegrations]`),nl={intercom:`intercom-integration`,crispChat:`crisp-chat-integration`},rl=class{constructor(e){this._instance=e}qo(e,t){var n,r;(n=g.__PosthogExtensions__)==null||(r=n.loadExternalDependency)==null||r.call(n,this._instance,e,e=>{if(e)return tl.error(`failed to load script`,e);t()})}startIfEnabledOrStop(){for(let[r,i]of Object.entries(this._instance.config.integrations??{})){var e,t,n;i&&!((e=g.__PosthogExtensions__)!=null&&(e=e.integrations)!=null&&e[r])&&this.qo(nl[r],()=>{var e;(e=g.__PosthogExtensions__)==null||(e=e.integrations)==null||(e=e[r])==null||e.start(this._instance)}),!i&&(t=g.__PosthogExtensions__)!=null&&(t=t.integrations)!=null&&t[r]&&((n=g.__PosthogExtensions__)==null||(n=n.integrations)==null||(n=n[r])==null||n.stop())}}},il=class{constructor(e,t){this.$=e,this.mo=t,this.ru=new Map,this.xo=!1}add(e){var t=this;return L(function*(){if(t.xo)throw Error(`Cannot add an extension to a disposed ExtensionRuntime`);if(t.ru.has(e.name))throw Error(`Browser extension "${e.name}" is already registered`);t.ru.set(e.name,e);try{let n=e.setup(t.mo);n&&(yield n)}catch(n){let r=t.ru.get(e.name)===e;r&&t.ru.delete(e.name),t.$.error(`Failed to set up browser extension "${e.name}"`,n),r&&t.ou(e)}})()}getExtension(e){return this.ru.get(e)}dispose(){if(this.xo)return;this.xo=!0;let e=Array.from(this.ru.values()).reverse();this.ru.clear();for(let t of e)this.ou(t)}ou(e){try{let t=e.dispose?.call(e);t&&D(t.then)&&t.then(void 0,t=>{this.$.error(`Failed to dispose browser extension "${e.name}"`,t)})}catch(t){this.$.error(`Failed to dispose browser extension "${e.name}"`,t)}}},al=class{constructor(e){this._instance=e}initialize(){}get(e){let t=this._instance.persistence;if(typeof e==`string`)return t?.get_property(e);let n={};for(let r of e){let e=t?.get_property(r);A(e)||(n[r]=e)}return n}set(e,t){var n;(n=this._instance.persistence)==null||n.register(typeof e==`string`?{[e]:t}:e)}remove(e){var t;(t=this._instance.persistence)==null||t.unregister(e)}},ol=`extensionsRemoteConfig`,sl=class{constructor(e){this.instance=e,this.xo=!1,this.$=z,this.lu=e.au,this.kv=new al(e),this.onEvent=e=>Ss(this.instance.on(`eventCaptured`,t=>{try{e({event:t.event,properties:t.properties})}catch(e){this.$.error(`Browser extension event listener failed`,e)}})),this.onRemoteConfig=e=>{if(this.xo)return Ss(()=>{});let t=t=>{try{e(t)}catch(e){this.$.error(`Browser extension remote config listener failed`,e)}},n=this.instance.uu.on(ol,t);return this.lu&&t(this.lu),Ss(n)},this.hu=new il(z.createLogger(`[BrowserExtensions]`),this)}get logger(){return this.$}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){return this.instance.get_property(`$device_id`)??this.distinctId}get deviceId(){let e=this.instance.get_property(xr);return typeof e==`string`?e:void 0}get library(){return{name:V.LIB_NAME,version:V.LIB_VERSION}}get initialPersonProperties(){return this.instance.persistence?.get_initial_props()??{}}get groups(){return this.instance.getGroups()}get session(){try{let e=this.instance.sessionManager?.checkAndGetSessionAndWindowId(!0);return{sessionId:e?.sessionId??``,windowId:e?.windowId??``,sessionStartTimestamp:e?.sessionStartTimestamp??0}}catch{return{sessionId:``,windowId:``,sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(e){return this.hu.add(e)}getExtension(e){return this.hu.getExtension(e)}capture(e,t,n){n?this.instance.capture(e,t,{timestamp:n.timestamp,uuid:n.uuid,$set:n.set,$set_once:n.setOnce}):this.instance.capture(e,t)}registerDynamicEventProperties(e){return Ss(this.instance.cu(e))}handleRemoteConfig(e){this.xo||(this.lu=e,this.instance.uu.emit(ol,e))}sendRequest(e){var t=this;return L(function*(e,n={}){let r=t.instance.requestRouter.endpointFor(n.target??`api`,e),i={method:n.method,url:n.query?pc(r,n.query):r,data:n.body,headers:n.headers,timeout:n.timeoutMs,fireCallbackOnDrop:!0,transport:n.transport,compression:n.compression,compressionFallback:n.target===`flags`&&n.compression===`best-available`?b.Base64:void 0,timestampMode:n.sentAt};return n.transport===`sendBeacon`?(t.instance._send_request(i),{statusCode:202}):new Promise(e=>{i.callback=e,t.instance._send_request(i)})}).apply(this,arguments)}dispose(){this.xo||(this.xo=!0,this.hu.dispose())}},cl={},ll=0,ul=()=>{}
1,dl=`Consent opt in/out is not valid with cookieless_mode="always" and will be ignored`,fl=`Surveys module not available`,pl=`sanitize_properties is deprecated. Use before_send instead`,ml=`Invalid value for property_denylist config: `,hl=/^[A-Za-z0-9_-]{1,400}$/,gl=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,_l=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,vl=[`token`,`distinct_id`,Ii],yl=`posthog`,bl=e=>{let t={};return e&&e!==`unset`?(`2025-11-30`>e||(t.strictMinimumDuration=!0),`2026-05-30`>e||(t.canvasCapture={resolutionScale:.6}),`2026-06-25`>e||(t.streamNetworkBody=!0),`2026-08-30`>e||(t.captureJsonLd=!0),t):t},xl=e=>{var t;return R({api_host:`https://us.i.posthog.com`,flags_api_host:null,ui_host:null,asset_host:null,token:``,autocapture:!0,cross_subdomain_cookie:ua(s?.location),persistence:`localStorage+cookie`,persistence_name:``,cookie_persisted_properties:[],loaded:ul,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:`if_capture_pageview`,defaults:e??`unset`,__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:c&&j(c?.search)&&c.search.indexOf(`__posthog_debug=true`)!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,reuseAnonymousId:!1,disable_external_dependency_loading:!1,strict_script_versioning:`fallback`,enable_recording_console_log:void 0,secure_cookie:(i==null||(t=i.location)==null?void 0:t.protocol)===`https:`,ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:`localStorage`,consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(e){z.error(`Bad HTTP status: `+e.statusCode+` `+e.text)},get_device_id:e=>e,capture_performance:void 0,name:`posthog`,bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:Zi,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:ul},(e=>({rageclick:e&&e>=`2026-05-30`?{content_ignorelist:to,ignore_text_selection:!0}
1:!e||`2025-11-30`>e||{content_ignorelist:!0},capture_pageview:!e||`2025-05-24`>e||`history_change`,session_recording:bl(e),external_scripts_inject_target:e&&e>=`2026-01-30`?`head`:`body`,internal_or_test_user_hostname:e&&e>=`2026-01-30`?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:e&&e>=`2026-05-30`?250:0,split_storage:!(!e||`2026-05-30`>e),detect_google_search_app:!(!e||`2026-05-30`>e),disable_capture_url_hashes:!(!e||`2026-06-25`>e),cookieWinsOnConflict:!(!e||e===`unset`||`2026-08-29`>e)}))(e))},Sl=[[`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`]],Cl=e=>{let t={};for(let[n,r]of Sl)A(e[n])||(t[r]=e[n]);let n=U({},t,e),r=e.__preview_external_dependency_versioned_paths;return A(r)||(A(e.strict_script_versioning)&&(n.strict_script_versioning=!!r),j(r)&&A(e.asset_host)&&(n.asset_host=r)),E(e.property_blacklist)&&(A(e.property_denylist)?n.property_denylist=e.property_blacklist:E(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:z.error(ml+e.property_denylist)),n},wl=class{constructor(){this.__forceAllowLocalhost=!1}get du(){return this.__forceAllowLocalhost}set du(e){z.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},Tl=class e{vu(e){if(!e)return;let t=this.ru.indexOf(e);t!==-1&&this.ru.splice(t,1)}fu(e,t){var n;return this.vu(e),this.ru.push(t),(n=t.initialize)==null||n.call(t),t}pu(){return this.config.cookieless_mode===`always`||this.config.cookieless_mode===`on_reject`&&this.consent.isRejected()}gu(){if(this.mu||this.config.reuseAnonymousId||this.config.segment||this.pu())return;let e=this.config.persistence===`memory`||this.config.persistence===`sessionStorage`;if(!e&&!this.config.disable_persistence||this.yu)return;let t,n,r;e?(t=`persistence is set to '${this.config.persistence}'`,n=this.config.persistence===`memory`?`on every page load`:`for every new browser tab or window`,r=`Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId.`):(t=`persistence is disabled (disable_persistence is true)`,n=`on every page load`,r=`Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId.`),this.mu=!0,console.warn(`[PostHog.js]`,`${t} but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ${n}, so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. ${r}`)}bu(){if(this.pu()||this.get_distinct_id()!==`$posthog_cookieless`)return;let e=this.persistence;if(!e)return;this._u()||e.load(!0);let t=this.get_distinct_id();if(!t||t===`$posthog_cookieless`){let t=this.config.get_device_id(va());this.register({distinct_id:t,$device_id:t}),e.set_property(Oi,Yi)}this.wu()}get decideEndpointWasHit(){var e;return(e=this.featureFlags?.hasLoadedFlags)!=null&&e}get flagsEndpointWasHit(){var e;return(e=this.featureFlags?.hasLoadedFlags)!=null&&e}constructor(){this.ku=!1,this.Su=!1,this.webPerformance=new wl,this.xu=!1,this.version=V.LIB_VERSION,this.Cu=new Set,this.$u=``,this.uu=new Pc,this.ru=[],this.Iu=[],this.yu=!1,this.mu=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=xl(),this.SentryIntegration=jo,this.sentryIntegration=e=>function(e,t){let n=Ao(e,t);return{name:ko,processEvent:e=>n(e)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint=`/e/`,this.Tu=!1,this.Mu=null,this.Eu=null,this.Pu=null,this.scrollManager=new jc(this),this.pageViewManager=new Mo(this),this.rateLimiter=new Es(this),this.requestRouter=new Zc(this),this.consent=new La(this),this.externalIntegrations=new rl(this);let t=e.__defaultExtensionClasses??{};this.featureFlags=t.featureFlags&&new t.featureFlags(this),this.toolbar=t.toolbar&&new t.toolbar(this),this.surveys=t.surveys&&new t.surveys(this),this.conversations=t.conversations&&new t.conversations(this),this.logs=t.logs&&new t.logs(this),this.metrics=t.metrics&&new t.metrics(this),this.experiments=t.experiments&&new t.experiments(this),this.exceptions=t.exceptions&&new t.exceptions(this),this.people={set:(e,t,n)=>{let r=j(e)?{[e]:t}:e;this.setPersonProperties(r),n?.({})},set_once:(e,t,n)=>{let r=j(e)?{[e]:t}:e;this.setPersonProperties(void 0,r),n?.({})}},this.on(`eventCaptured`,e=>z.info(`send "${e?.event}"`,e))}init(t,n,r){if(r&&r!==yl){let i=cl[r]??new e;return i._init(t,n,r),cl[r]=i,cl[yl][r]=i,i}return this._init(t,n,r)}_init(e,t={},n){var r;let a=j(e)?e.trim():``;if(!a)return z.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 a===this.config?.token?console.warn(`[PostHog.js]`,`You have already initialized PostHog! Re-initializing is a no-op`):console.warn(`[PostHog.js]`,`You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('${a}', { ... }, 'project2')`),this;this.__loaded=!0,this.config=xl(t.defaults),t.debug=this.Ru(t.debug),this.Au=t,this.Fu=[],t.person_profiles?this.Eu=t.person_profiles:t.process_person&&(this.Eu=t.process_person);let o=xl(t.defaults),s=Cl(t),c=U({},o,s,{name:n,token:a});O(o.rageclick)&&O(s.rageclick)&&(c.rageclick=U({},o.rageclick,s.rageclick)),O(o.session_recording)&&O(s.session_recording)&&(c.session_recording=U({},o.session_recording,s.session_recording)),this.set_config(c),this.config.on_xhr_error&&z.error(`on_xhr_error is deprecated. Use on_request_error instead`),this.compression=t.disable_compression?void 0:gs.GZipJS;let l=this._u();if(this.persistence=new hs(this.config,l),this.sessionPersistence=this.config.persistence===`
1sessionStorage`||this.config.persistence===`memory`?this.persistence:new hs(R(R({},this.config),{},{persistence:`sessionStorage`}),l,!1),this.$u=`ph_`+(this.config.persistence_name||this.config.token)+`_session_registered_properties`,this.config.persistence!==`memory`&&!l&&q.Et()){let e=q.Dt(this.$u);E(e)&&e.forEach(e=>{j(e)&&this.Cu.add(e)})}else q.Lt(this.$u);let u=R({},this.persistence.props),d=R({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Ou=new Oc((e,t)=>this.Du(e,t),this.config.request_queue_config),this.Lu=new Ac(this),this.__request_queue=[];let f=this.pu();f||(this.sessionManager=new Lc(this),this.sessionPropsManager=new Nc(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((e,t,n)=>{(n!=null&&n.activityTimeout||n!=null&&n.sessionPastMaximumLength||n!=null&&n.crossTabAdoption)&&this.Nu()})),this.qu(),this.config.__preview_deferred_init_extensions?(z.info(`Deferring extension initialization to improve startup performance`),setTimeout(()=>{this.ju(f)},0)):(z.info(`Initializing extensions synchronously`),this.ju(f)),V.DEBUG=V.DEBUG||this.config.debug,V.DEBUG&&z.info(`Starting in debug mode`,{this:this,config:t,thisC:R({},this.config),p:u,s:d}),this.config.identity_distinct_id&&!((r=t.bootstrap)!=null&&r.distinctID)&&(t.bootstrap=R(R({},t.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));let p=t.bootstrap?.distinctID;if(this.yu=!!p&&!ie(p),t.bootstrap?.distinctID){let e=t.bootstrap.distinctID,n=this.get_distinct_id(),r=this.persistence.get_property(Oi);if(t.bootstrap.isIdentifiedID&&n!=null&&n!==e&&r===`anonymous`)this.identify(e);else if(t.bootstrap.isIdentifiedID&&n!=null&&n!==e&&r===`identified`)z.warn(`Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.`);else{let n=this.config.get_device_id(va()),r=t.bootstrap.isIdentifiedID?n:e;this.persistence.set_property(Oi,t.bootstrap.isIdentifiedID?Xi:Yi),this.register({distinct_id:e,$device_id:r})}}if(f)this.register_once({distinct_id:Fi,$device_id:null},``);else if(!this.get_distinct_id()){let e=this.config.get_device_id(va());this.register_once({distinct_id:e,$device_id:e},``),this.persistence.set_property(Oi,Yi)}return W(i,`onpagehide`in self?`pagehide`:`unload`,this._handle_unload.bind(this),{passive:!1}),W(i,`pageshow`,()=>{var e;this.ku=!1,this.Su||(e=this.Lu)==null||e.resume()}),t.segment?Oo(this,()=>this.Bu()):this.Bu(),D(this.config._onCapture)&&this.config._onCapture!==ul&&(z.warn("onCapture is deprecated. Please use `before_send` instead"),this.on(`eventCaptured`,e=>this.config._onCapture(e.event,e))),this.config.ip&&z.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 zc.apply(this,arguments)}().then(e=>{e&&this.register({[Sr]:e})}).catch(ul),this}Hu(e){let t=e;return j(t.name)&&D(t.setup)}zu(e,t){this.Hu(e)?t.push(()=>{this.Uu().add(e).catch(()=>
1e.dispose?.call(e)).catch(t=>{z.error(`Failed to dispose browser extension "${e.name}"`,t)})}):this.ru.push(e)}qu(){let t=this.config.__extensionClasses?.featureFlags??e.__defaultExtensionClasses?.featureFlags;var n,r,i;t&&(this.featureFlags&&this.featureFlags instanceof t||((n=this.Wu)==null||n.call(this),this.Wu=void 0,this.featureFlags=new t(this)),D(this.featureFlags.onReloading)&&D(this.featureFlags.setup)?this.Wu||(this.Wu=this.featureFlags.onReloading(()=>{this.uu.emit(`featureFlagsReloading`,!0)}),this.Uu().add(this.featureFlags)):(r=(i=this.featureFlags).initialize)==null||r.call(i))}ju(t){let n=performance.now(),r=R(R({},e.__defaultExtensionClasses),this.config.__extensionClasses),i=[];r.exceptions&&this.ru.push(this.exceptions=this.exceptions??new r.exceptions(this)),r.historyAutocapture&&this.ru.push(this.historyAutocapture=new r.historyAutocapture(this)),r.tracingHeaders&&this.ru.push(this.tracingHeaders=new r.tracingHeaders(this)),r.siteApps&&this.ru.push(this.siteApps=new r.siteApps(this)),r.sessionRecording&&!t&&this.ru.push(this.sessionRecording=new r.sessionRecording(this)),this.config.disable_scroll_properties||i.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),r.autocapture&&this.zu(this.autocapture=new r.autocapture(this),i),r.surveys&&this.zu(this.surveys=this.surveys??new r.surveys(this),i),r.logs&&this.zu(this.logs=this.logs??new r.logs(this),i),r.metrics&&this.ru.push(this.metrics=this.metrics??new r.metrics(this)),r.conversations&&this.ru.push(this.conversations=this.conversations??new r.conversations(this)),r.productTours&&this.ru.push(this.productTours=new r.productTours(this)),r.heatmaps&&this.ru.push(this.heatmaps=new r.heatmaps(this)),r.webVitalsAutocapture&&this.ru.push(this.webVitalsAutocapture=new r.webVitalsAutocapture(this)),r.exceptionObserver&&this.ru.push(this.exceptionObserver=new r.exceptionObserver(this)),r.deadClicksAutocapture&&this.ru.push(this.deadClicksAutocapture=new r.deadClicksAutocapture(this,To)),r.toolbar&&this.ru.push(this.toolbar=this.toolbar??new r.toolbar(this)),r.experiments&&this.ru.push(this.experiments=this.experiments??new r.experiments(this)),this.ru.forEach(e=>{e.initialize&&i.push(()=>{var t;(t=e.initialize)==null||t.call(e)})}),i.push(()=>{if(this.Vu){let e=this.Vu;this.Vu=void 0,this.ru.forEach(t=>t.onRemoteConfig?.call(t,e))}}),this.Gu(i,n)}Gu(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout(()=>{this.Gu(e,t)},0);let n=e.shift();if(n)try{n()}catch(e){z.error(`Error initializing extension:`,e)}}let n=Math.round(performance.now()-t);this.register_for_session({[Li]:this.config.__preview_deferred_init_extensions?`deferred`:`synchronous`,[Ri]:n}),this.config.__preview_deferred_init_extensions&&z.info(`PostHog extensions initialized (${n}ms)`)}Xl(e){var t;if(!s||!s.body)return z.info(`document not ready yet, trying again in 500 milliseconds...`),void setTimeout(()=>{this.Xl(e)},500);if(this.config.__preview_deferred_init_extensions&&(this.Vu=e),this.au=e,this.compression=void 0,e.ok){var n;let t=e.config;t.supportedCompression&&!this.config.disable_compression&&(this.compression=C(t.supportedCompression,gs.GZipJS)?gs.GZipJS:C(t.supportedCompression,gs.Base64)?gs.Base64:void 0),(n=t.analytics)!=null&&n.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint)}this.set_config({person_profiles:this.Eu?this.Eu:Zi}),(t=this.Zu)==null||t.handleRemoteConfig(e),this.ru.forEach(t=>t.onRemoteConfig?.call(t,e))}Bu(){try{this.config.loaded(this)}catch(e){z.critical("`loaded` function failed",e)}if(this.Qu(),this.config.internal_or_test_user_hostname&&c?.hostname){let e=c.hostname,t=this.config.internal_or_test_user_hostname;(typeof t==`string`?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.pu())&&this.Ju()},1),this.Ku=new Os(this),this.Ku.load()}Qu(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.Ou)==null||e.enable())}_dom_loaded(){this.is_capturing()&&ia(this.__request_queue,e=>this.Du(e)),this.__request_queue=[],this.Qu()}_handle_unload(){var e,t,n,r,i,a;this.ku=!0,(e=this.surveys)==null||(t=e.handlePageUnload)==null||t.call(e),(n=this.metrics)==null||n.flush(`sendBeacon`),this.config.request_batching?(this.Xu()&&this.capture(ta),(r=this.logs)==null||r.flushLogs(`sendBeacon`),(i=this.Ou)==null||i.unload(),(a=this.Lu)==null||a.unload()):this.Xu()&&this.capture(ta,null,{transport:`sendBeacon`})}_send_request(e){Dc(this,e)}Du(e,t){this.Lu?this.Lu.retriableRequest(e,t):this._send_request(t?R(R({},e),{},{transport:t}):e)}_execute_array(e){ll++;try{let t,n=[],r=[],i=[];ia(e,e=>{if(e){if(t=e[0],E(t))i.push(e);else if(D(e))try{e.call(this)}catch(t){z.error(`Error executing queued PostHog call`,e,t)}else E(e)&&t===`alias`?n.push(e):E(e)&&t.indexOf(`capture`)!==-1&&D(this[t])?i.push(e):r.push(e)}});let a=function(e,t){ia(e,function(e){try{if(E(e[0])){let n=t;H(e,function(e){n=n[e[0]].apply(n,e.slice(1))})}else t[e[0]].apply(t,e.slice(1))}catch(t){z.error(`Error executing queued PostHog call`,e,t)}})};a(n,this),a(r,this),a(i,this)}finally{ll--}
1}push(t){if(ll>0&&E(t)&&j(t[0])){let n=e.prototype[t[0]];D(n)&&n.apply(this,t.slice(1));return}this._execute_array([t])}get Yu(){return{property:Tr,persistenceKey:Er,cookieName:`_fbc`,pattern:gl,register:(e,t)=>this.persistence?.register({[Er]:{value:e,delivered:t}}),unregister:()=>this.persistence?.unregister(Er)}}get th(){return{property:Dr,persistenceKey:Or,cookieName:`_fbp`,pattern:_l,register:(e,t)=>this.persistence?.register({[Or]:{value:e,delivered:t}}),unregister:()=>this.persistence?.unregister(Or)}}eh(e){let t=this.persistence?.get_property(e.persistenceKey);return j(t)&&e.pattern.test(t)?{value:t,delivered:!1}:O(t)&&j(t.value)&&e.pattern.test(t.value)?{value:t.value,delivered:!0===t.delivered}:void 0}ih(e,t,n){return t===n?.value?{value:t,pending:!n.delivered}:(e.register(t,!1),{value:t,pending:!0})}nh(e){if(!this.config.save_campaign_params||this.pu())return;let t=fa(e.cookieName);return j(t)&&e.pattern.test(t)?t:void 0}sh(e,t,n,r){if(!this.persistence)return;let i=this.Yu;this.persistence.refreshKey(i.persistenceKey);let a=this.eh(i);if(r)return void i.unregister();if(n)return j(t)&&gl.test(t)?this.ih(i,t,a):void i.unregister();let o=j(e)&&hl.test(e)?e:void 0,s=this.nh(i);return s&&((e,t,n)=>{let r=e.split(`.`);if(t)return r[3]===t;if(!n)return!0;let i=n.value.split(`.`);return r[3]===i[3]||Number(r[2])>Number(i[2])})(s,o,a)?this.ih(i,s,a):o?a?.value.split(`.`)[3]===o?{value:a.value,pending:!a.delivered}:this.ih(i,`fb.1.${Date.now()}.${o}`,a):a?{value:a.value,pending:!a.delivered}:void 0}rh(e,t,n){if(!this.persistence)return;let r=this.th;this.persistence.refreshKey(r.persistenceKey);let i=this.eh(r);if(n)return void r.unregister();if(t)return j(e)&&_l.test(e)?this.ih(r,e,i):void r.unregister();let a=this.nh(r);return a?this.ih(r,a,i):i?{value:i.value,pending:!i.delivered}:void 0}oh(e,t){if(!this.persistence)return;this.persistence.refreshKey(e.persistenceKey);let n=this.eh(e);n?.value!==t||n.delivered||e.register(t,!0)}capture(e,t,n){if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Ou))return void z.uninitializedWarning(`posthog.capture`);if(!this.is_capturing())return;if(A(e)||!j(e))return void z.error(`No event name provided to posthog.capture`);this.bu();let r=!this.config.opt_out_useragent_filter&&this._is_bot();if(r&&!this.config.__preview_capture_bot_pageviews)return;let i=n?.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(i?.isRateLimited)return void z.critical(`This capture call is ignored due to client rate limiting.`);let a;t!=null&&t.$current_url&&!j(t?.$current_url)&&(z.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),t==null||delete t.$current_url),e!==`$exception`||n!=null&&n.ah||z.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&&(a=this.sessionPersistence.update_campaign_params()),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();let o=new Date,s=n?.timestamp||o,c=At(n?.uuid,va),l={uuid:c,event:e,properties:this.calculateEventProperties(e,t||{},s,c)};e===`$pageview`&&this.config.__preview_capture_bot_pageviews&&r&&(l.event=`$bot_pageview`,l.properties.$browser_type=`bot`),i&&(l.properties.$lib_rate_limit_remaining_tokens=i.remainingTokens);let u=e===`$feature_flag_called`&&!1===l.properties.$feature_flag_has_experiment&&!0===this.get_property(`$minimal_flag_called_events`);n!=null&&n.$set&&!u&&(l.$set=n?.$set);let d=O(t?.$set)?t.$set:void 0,f=E(t?.$unset)?t.$unset:[],p=n?.$unset||[],m=e=>{var t;let r=!!n?.$set&&e in n.$set;return{hasProvided:r||!!d&&e in d,provided:r?n==null||(t=n.$set)==null?void 0:t[e]:d?.[e],unset:f.indexOf(e)!==-1||p.indexOf(e)!==-1}},h=m(Tr),g=m(Dr),_=[{channel:this.Yu,hasProvided:h.hasProvided,update:this.sh(a?.fbclid,h.provided,h.hasProvided,h.unset)},{channel:this.th,hasProvided:g.hasProvided,update:this.rh(g.provided,g.hasProvided,g.unset)}];for(let{channel:e,hasProvided:t,update:n}of _)n&&!0===l.properties.$process_person_profile&&n.pending&&!t&&!u&&(l.$set=R({[e.property]:n.value},l.$set));let v=n?.$unset;v&&(l.$unset=v);let y=u?void 0:this.uh(n?.$set_once,e!==ra,e===na);if(y&&(l.$set_once=y),n!=null&&n._noTruncate||(b=this.config.properties_string_max_length,l=function(e,t){let n=new Set;return function e(r,i){if(r!==Object(r))return t?t(r):r;if(n.has(r))return;let a;if(n.add(r),E(r))a=[],ia(r,t=>{a.push(e(t))});else{let t={};H(le(r)?ca(r):r,(r,i)=>{n.has(r)||(t[i]=e(r,i))}),a=t}return a}(e)}(l,e=>j(e)?e.slice(0,b):e)),l.timestamp=s,A(n?.timestamp)||(l.properties.$event_time_override_provided=!0,l.properties.$event_time_override_system_time=o),u&&(l.properties=((e,t=[])=>{let n={},r=t=>{e[t]!==void 0&&(n[t]=e[t])};return Nn.forEach(r),t.forEach(r),n}
1)(l.properties,vl)),e===ys.DISMISSED||e===ys.SENT){let n=t?.[bs.SURVEY_ID],r=t?.[bs.SURVEY_ITERATION];Qc({id:n,current_iteration:r}),l.$set=R(R({},l.$set),{},{[Bc({id:n,current_iteration:r},e===ys.SENT?`responded`:`dismissed`)]:!0})}else e===ys.SHOWN&&(l.$set=R(R({},l.$set),{},{[bs.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var b;if(e===Cs.SHOWN){let e=t?.[ws.TOUR_TYPE];e&&(l.$set=R(R({},l.$set),{},{[`${ws.TOUR_LAST_SEEN_DATE}/${e}`]:new Date().toISOString()}))}let x=R(R({},l.properties.$set),l.$set);if(k(x)||this.setPersonPropertiesForFlags(x),!N(this.config.before_send)){let e=this.Os(l);if(!e)return;l=e,l.uuid=At(l.uuid,va)}let S=_.filter(({channel:e,update:t})=>{let n=l.$set?.[e.property]??(O(l.properties?.$set)?l.properties.$set[e.property]:void 0);return t?.pending&&n===t.value});this.uu.emit(`eventCaptured`,l);let C=n?._url??this.requestRouter.endpointFor(`api`,this.analyticsDefaultEndpoint),w=n?._batchKey===`recordings`||/\/s\/(?:\?|$)/.test(C),ee=R(R(R({method:`POST`,url:C,data:l,compression:`best-available`,timestampMode:w?`body`:`capture-body`,batchKey:n?._batchKey},w&&l.properties?.$session_id?{batchGroup:l.properties.$session_id+(l.properties.$window_id?`-${l.properties.$window_id}`:``)}:{}),n?.transport?{transport:n.transport}:{}),S.length?{fireCallbackOnDrop:!0,callback:e=>{if(e.statusCode>=200&&300>e.statusCode)for(let{channel:e,update:t}of S)this.oh(e,t.value)}}:{});if(!this.config.request_batching||n&&!n?._batchKey||n?.send_instantly||S.length){let e;!ee.transport&&!ee.callback&&k(this.config.request_headers??{})&&this.ku&&(e=`sendBeacon`),this.Du(ee,e)}else this.Ou.enqueue(ee);return l}_addCaptureHook(e){return this.on(`eventCaptured`,t=>e(t.event,t))}getExtension(e){return this.Zu?.getExtension(e)}Uu(){return this.Zu??=new sl(this)}cu(e){this.Iu.push(e);let t=!0;return()=>{if(!t)return;t=!1;let n=this.Iu.indexOf(e);n!==-1&&this.Iu.splice(n,1)}}hh(e=!0){var t,n;return!!this.persistence?.consumeCookieIdentityChange()&&(this.Pu=null,this.persistence.get_property(`$user_state`)===`anonymous`&&((n=this.sessionPersistence)==null||n.clear(),this.Cu.clear(),this.dh()),(t=this.featureFlags)==null||t.reset(),e&&this.reloadFeatureFlags(),!0)}calculateEventProperties(e,t,n,r,a){if(n||=new Date,!this.persistence||!this.sessionPersistence)return t;this.persistence.syncCookieProperties(),this.hh();let o=a?void 0:this.persistence.remove_event_timer(e),l=R({},t);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,this.pu()&&(l[Ii]=!0),e===`$snapshot`){let e=R(R({},this.persistence.properties()),this.sessionPersistence.properties());return l.distinct_id=e.distinct_id,(!j(l.distinct_id)&&!P(l.distinct_id)||ie(l.distinct_id))&&z.error(`Invalid distinct_id for replay event. This indicates a bug in your implementation`),l}let u=function(e,t,n,r=!1){var a,o,s;if(!p)return{};let l=e?[...Uo,...t||[]]:[],[u,d]=vt(p),[f,m]=function(e){for(let t=0;St.length>t;t++){let[n,r,i]=St[t],a=e.match(n);if(a)return[r,(i&&e.match(i)||a)?.[1]||``]}return[``,``]}(p),h=function(){return(`u`>typeof navigator?navigator:void 0)?.brave?{brave:!0}:{}}(),g={};A(n)||(g.detectGoogleSearchApp=n);let _={},y=(a=navigator)==null||(a=a.userAgentData)==null?void 0:a.platform,b=navigator?.maxTouchPoints,x=i==null||(o=i.screen)==null?void 0:o.width,S=i==null||(s=i.screen)==null?void 0:s.height,C=i?.devicePixelRatio;A(y)||(_.userAgentDataPlatform=y),A(b)||(_.maxTouchPoints=b),A(x)||(_.screenWidth=x),A(S)||(_.screenHeight=S),A(C)||(_.devicePixelRatio=C);let w=U(sa({$os:u,$os_version:d,$browser:mt(p,navigator.vendor,h,g),$webview_app:f,$webview_app_version:m,$device:yt(p),$device_type:bt(p,_),$timezone:ns(),$timezone_offset:rs()}),{$current_url:zo(r?Mt(c?.href):c?.href,l,Go),$host:c?.host,$pathname:c?.pathname,$raw_user_agent:p.length>1e3?p.substring(0,997)+`...`:p,$browser_version:gt(p,navigator.vendor,h,g),$browser_language:Xo(),$browser_language_prefix:Zo(),$screen_height:i?.screen.height,$screen_width:i?.screen.width,$viewport_height:i?.innerHeight,$viewport_width:i?.innerWidth,$lib:v.LIB_NAME,$lib_version:v.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return v.SDK_DIST_CHANNEL&&(w.$sdk_dist_channel=v.SDK_DIST_CHANNEL),w}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes
1);if(this.sessionManager){let{sessionId:e,windowId:t}=this.sessionManager.checkAndGetSessionAndWindowId(a,n.getTime(),!0);l.$session_id=e,l.$window_id=t}this.sessionPropsManager&&U(l,this.sessionPropsManager.getSessionProps());try{this.sessionRecording&&U(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=this.Lu?.length}catch(e){l.$sdk_debug_error_capturing_properties=String(e)}let d;if(this.requestRouter.region===qc&&(l.$lib_custom_api_host=this.config.api_host),d=e!==`$pageview`||a?e!==`$pageleave`||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,r),l=U(l,d),e===`$pageview`&&s&&(l.title=s.title),!A(o)){let e=n.getTime()-o;l.$duration=parseFloat((e/1e3).toFixed(3))}p&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?`bot`:`browser`);let f=this.persistence.properties(),m=this.sessionPersistence.properties(),h=l.$groups,g=f.$groups;O(h)&&!k(h)&&(l.$groups=R(R({},O(g)?g:{}),h)),H([`$referrer`,`$referring_domain`],e=>{e in f&&delete m[e]});let _={};if(this.Iu.length>0)for(let e of this.Iu.slice())try{U(_,e())}catch(e){z.error(`Failed to produce browser extension event properties`,e)}l=U({},u,f,m,R(R({},_),l)),l.$is_identified=this._isIdentified(),E(this.config.property_denylist)?H(this.config.property_denylist,function(e){delete l[e]}):z.error(ml+this.config.property_denylist+` or property_blacklist config: `+this.config.property_blacklist);let y=this.config.sanitize_properties;y&&(z.error(pl),l=y(l,e));let b=this.fh();return l.$process_person_profile=b,b&&!a&&this.ph(`_calculate_event_properties`),l}uh(e,t=!0,n=!1){if(!this.persistence||!this.fh()||this.xu&&!n)return e;let r=this.persistence.get_initial_props(),i=this.sessionPropsManager?.getSetOnceProps(),a=U({},r,i||{},e||{}),o=this.config.sanitize_properties;return o&&(z.error(pl),a=o(a,`$set_once`)),t&&(this.xu=!0),k(a)?void 0:a}register(e,t){var n;(n=this.persistence)==null||n.register(e,t)}register_once(e,t,n){var r;(r=this.persistence)==null||r.register_once(e,t,n)}register_for_session(e){var t,n;(t=this.persistence)==null||t.syncCookieProperties(),this.hh(),(n=this.sessionPersistence)==null||n.register(e),Object.keys(e).forEach(e=>this.Cu.add(e)),this.dh()}unregister(e){var t;(t=this.persistence)==null||t.unregister(e)}unregister_for_session(e){var t;(t=this.sessionPersistence)==null||t.unregister(e),this.Cu.delete(e),this.dh()}gh(e,t){this.register({[e]:t})}Nu(){this.Cu.forEach(e=>{var t;(t=this.sessionPersistence)==null||t.unregister(e)}),this.Cu.clear(),this.dh()}dh(){if(!this.$u)return;if(this.config.persistence===`memory`||this.sessionPersistence?.mi||!q.Et())return void q.Lt(this.$u);let e=[];this.Cu.forEach(t=>e.push(t)),e.length>0?q.At(this.$u,e):q.Lt(this.$u)}getFeatureFlag(e,t){return this.featureFlags?.getFeatureFlag(e,t)}getFeatureFlagPayload(e){return this.featureFlags?.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){return this.featureFlags?.getFeatureFlagResult(e,t)}getAllFeatureFlags(){return this.featureFlags?.getAllFeatureFlags()??[]}isFeatureEnabled(e,t){return this.featureFlags?.isFeatureEnabled(e,t)??t?.defaultValue}reloadFeatureFlags(){var e;(e=this.featureFlags)==null||e.reloadFeatureFlags()}updateFlags(e,t,n){var r;(r=this.featureFlags)==null||r.updateFlags(e,t,n)}updateEarlyAccessFeatureEnrollment(e,t,n){var r;(r=this.featureFlags)==null||r.updateEarlyAccessFeatureEnrollment(e,t,n)}getEarlyAccessFeatures(e,t=!1,n){return this.featureFlags?.getEarlyAccessFeatures(e,t,n)}on(e,t){return this.uu.on(e,t)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:fl}),()=>{})}onSessionId(e){return this.sessionManager?.onSessionId(e)??(()=>{})}getSurveys(e,t=!1){this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:fl})}getActiveMatchingSurveys(e,t=!1){this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:fl})}renderSurvey(e,t){var n;(n=this.surveys)==null||n.renderSurvey(e,t)}displaySurvey(e,t=el){var n;(n=this.surveys)==null||n.displaySurvey(e,t)}cancelPendingSurvey(e){var t;(t=this.surveys)==null||t.cancelPendingSurvey(e)}canRenderSurvey(e){return this.surveys?.canRenderSurvey(e)??{visible:!1,disabledReason:fl}}canRenderSurveyAsync(e,t=!1){return this.surveys?.canRenderSurveyAsync(e,t)??Promise.resolve({visible:!1,disabledReason:fl})}mh(e){return!e||ie(e)?(z.critical(`Unique user id has not been set in posthog.identify`),!1):e===`$posthog_cookieless`?(z.critical(`The string "${e}" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.`),!1):![`distinct_id`,`distinctid`].includes(e.toLowerCase())&&![`undefined`,`null`].includes(e.toLowerCase())||(z.critical(`The string "${e}" was set in posthog.identify which indicates an error. This ID should be unique to the user and n
1ot a hardcoded string.`),!1)}identify(e,t,n){if(!this.__loaded||!this.persistence)return z.uninitializedWarning(`posthog.identify`);if(P(e)&&(e=e.toString(),z.warn(`The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.`)),!this.mh(e)||!this.ph(`posthog.identify`))return;this.bu();let r=this.get_distinct_id(),i=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==r,a=this.hh(!1),o=this.persistence.Rl(),s=!1;try{let r=this.get_distinct_id();this.register({$user_id:e}),this.get_property(`$device_id`)||this.register_once({$had_persisted_distinct_id:!0,$device_id:r},``),e!==r&&e!==this.get_property(`__alias`)&&(this.unregister(Cr),this.register({distinct_id:e}));let o=(this.persistence.get_property(`$user_state`)||`anonymous`)===Yi,l=e!==r,u=!l&&o;if(l&&o){var c;let i=this.config.reuseAnonymousId?{distinct_id:e}:{distinct_id:e,$anon_distinct_id:r};this.persistence.set_property(Oi,Xi),this.setPersonPropertiesForFlags({$set:t||{},$set_once:n||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Al(),this.capture(`$identify`,i,{$set:t||{},$set_once:n||{}})&&(this.Pu=Kc(e,t,n)),(c=this.featureFlags)==null||c.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:r)}else if(u){this.persistence.set_property(Oi,Xi);let r=t||{},i=n||{};this.setPersonPropertiesForFlags({$set:r,$set_once:i},!1),this.config.cookieWinsOnConflict&&this.persistence.Al(),this.capture(`$set`,{$set:r,$set_once:i})&&(this.Pu=Kc(e,t,n))}else(t||n)&&this.setPersonProperties(t,n);l||i||a?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(wi)):u&&(t||n)&&this.reloadFeatureFlags(),s=!0}finally{o&&this.persistence.Dl(s)}}setPersonProperties(e,t){if(!e&&!t||!this.ph(`posthog.setPersonProperties`))return;let n=Kc(this.get_distinct_id(),e,t);this.Pu===n?z.info(`A duplicate setPersonProperties call was made with the same properties. It has been ignored.`):(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture(`$set`,{$set:e||{},$set_once:t||{}})&&(this.Pu=n))}unsetPersonProperties(e){var t;let n=(E(e)?e:[e]).filter(e=>j(e)&&e.length>0);n.length!==0&&this.ph(`posthog.unsetPersonProperties`)&&((t=this.featureFlags)==null||t.unsetPersonPropertiesForFlags(n,!0),this.capture(`$set`,{$unset:n}),this.Pu=null)}group(e,t,n){var r;if(!e||!t)return void z.error(`posthog.group requires a group type and group key`);(r=this.persistence)==null||r.syncCookieProperties(),this.hh();let i=this.getGroups(),a=i[e]!==t;if(a&&this.resetGroupPropertiesForFlags(e),this.register({$groups:R(R({},i),{},{[e]:t})}),(a||n)&&this.fh()){let r={$group_type:e,$group_key:t};n&&(r.$group_set=n),this.capture(ra,r)}n&&this.setGroupPropertiesForFlags({[e]:n}),a&&!n&&this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t=!0){var n;(n=this.featureFlags)==null||n.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(e=!0){var t;(t=this.featureFlags)==null||t.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,t=!0){var n;this.ph(`posthog.setGroupPropertiesForFlags`)&&((n=this.featureFlags)==null||n.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;(t=this.featureFlags)==null||t.resetGroupPropertiesForFlags(e)}reset(e){let t=I(e)?e:e?.resetDeviceID,n=I(e)||e==null?void 0:e.bootstrap;this.yh(t,!1,n)}yh(e,t=!1,n){var r,i,a,o,s;if(z.info(`reset`),!this.__loaded)return z.uninitializedWarning(`posthog.reset`);let c=n?.sessionID;this.config.bootstrap=n||this.Au?.bootstrap||{},(r=this.featureFlags)==null||(i=r.updateConfig)==null||i.call(r,this.config,this.Yl());let l=this.get_property(xr),u=this.get_property(Sr),d=this.get_property(Br);(a=this.sessionRecording)==null||a.flushBeforeIdentityReset();let f=this.is_capturing();this.consent.reset(),t||!f||this.is_capturing()||console.warn(`[PostHog.js]`,"reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");let p=(o=this.persistence)==null||(s=o.Rl)==null?void 0:s.call(o),m=!1;try{var h,g,_,v,y,b,x,S,C,w,ee,te;if((h=this.persistence)==null||h.clear(),(g=this.sessionPersistence)==null||g.clear(),this.Cu.clear(),this.dh(),A(d)||(w=this.persistence)==null||w.register({$session_recording_remote_config:d}),(_=this.surveys)==null||_.reset(),(v=this.featureFlags)==null||v.reset(),(y=this.conversations)==null||y.reset(),(b=this.logs)==null||b.reset(),(x=this.metrics)==null||x.reset(),(S=this.persistence)==null||S.set_property(`$user_state`,`anonymous`),(C=this.sessionManager)==null||C.resetSessionId(),this.Pu=null,this.config.cookieless_mode===`always`)this.register_once({distinct_id:Fi,$device_id:null},``);else{let t=this.config.get_device_id(va());this.register_once({distinct_id:t,$device_id:e?t:l},``),e||A(u)||this.register({[Sr]:u})}if(this.register({$last_posthog_reset:new Date().toISOString()},1),n&&(n.distinctID&&!this.pu()&&((te=this.persistence)==null||te.set_property(`$user_state`,n.isIdentifiedID?`identified`:`anonymous`),this.register({distinct_id:n.distinctID})),(ee=this.featureFlags)==null||ee.initialize(),!N(c)&&!this.sessionManager?.setBootstrapSessionId(c,!0))){let e=R({},n);delete e.sessionID,this.config.bootstrap=e}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,m=!0}finally{var ne,T;p&&((ne=this.persistence)==null||(T=ne.Dl)==null||T.call(ne,m))}this.reloadFeatureFlags()}shutdown(e){var t=this;return L(function*(){var e,n,r,i,a,o,s,c;if(t.__loaded){t.Su=!0,t.Uu().dispose(),(e=t.sessionRecording)==null||e.dispose(),(n=t.logs)==null||n.flushLogs(`sendBeacon`),(r=t.metrics)==null||r.flush(`sendBeacon`),(i=t.metrics)==null||i.dispose(),(a=t.Ou)==null||a.unload(),(o=t.Lu)==null||o.unload();try{var l;(l=t.featureFlags)==null||l.destroy()}catch(e){z.error(`Error while destroying feature flags`,e)}(s=t.persistence)==null||s.destroy(),(c=t.sessionPersistence)==null||c.destroy()}else z.uninitializedWarning(`posthog.shutdown`)})()}setIdentity(e,t){var n;delete this.config.identity_claims,this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),(n=this.conversations)==null||n.bh()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,(e=this.conversations)==null||e._h()}get_distinct_id(){return this.get_property(`distinct_id`)}getGroups(){return this.get_property(`$groups`)||{}}get_session_id(){return this.sessionManager?.checkAndGetSessionAndWindowId(!0).sessionId??``}get_session_replay_url(e){if(!this.sessionManager)return``;let{sessionId:t,sessionStartTimestamp:n}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor(`ui`,`/project/${this.config.token}/replay/${t}`);if(e?.withTimestamp&&n){let t=e.timestampLookBack??10;if(!n)return r;r+=`?t=${Math.max(Math.floor((new Date().getTime()-n)/1e3)-t,0)}`}return r}alias(e,t){return e===this.get_property(`$people_distinct_id`)?(z.critical(`Attempting to create alias for existing People user - aborting.`),-2):this.ph(`posthog.alias`)?(A(t)&&(t=this.get_distinct_id()),e===t?(z.warn(`alias matches current distinct_id - skipping api call.`),this.identify(e),-1):(this.gh(Cr,e),this.capture(`$create_alias`,{alias:e,distinct_id:t}))):void 0}set_config(e){let t=R({},this.config);if(O(e)){var n,r,i,a,o,s,c,l,u,d,f,p,m,h;U(this.config,Cl(e));let _=this._u();(n=this.persistence)==null||n.update_config(this.config,t,_),this.sessionPersistence=this.config.persistence===`
1sessionStorage`||this.config.persistence===`memory`?this.persistence:new hs(R(R({},this.config),{},{persistence:`sessionStorage`}),_,!1);let v=this.Ru(this.config.debug);var g;I(v)&&(this.config.debug=v),I(this.config.debug)&&(this.config.debug?(V.DEBUG=!0,K.Et()&&K.At(`ph_debug`,!0),z.info(`set_config`,{config:e,oldConfig:t,newConfig:R({},this.config)})):(V.DEBUG=!1,K.Et()&&K.Lt(`ph_debug`))),(r=this.featureFlags)==null||(i=r.updateConfig)==null||i.call(r,this.config,this.Yl()),(a=this.exceptionObserver)==null||a.onConfigChange(),(o=this.exceptions)==null||o.onConfigChange(),(s=this.metrics)==null||s.onConfigChange(),(c=this.sessionRecording)==null||c.startIfEnabledOrStop(),(l=this.tracingHeaders)==null||l.startIfEnabledOrStop(),(u=this.autocapture)==null||u.startIfEnabled(),(d=this.heatmaps)==null||d.startIfEnabled(),(`capture_pageview`in e||`disable_capture_url_hashes`in e)&&((g=this.historyAutocapture)==null||g.startIfEnabledOrStop()),(f=this.exceptionObserver)==null||f.startIfEnabledOrStop(),(p=this.deadClicksAutocapture)==null||p.startIfEnabledOrStop(),(m=this.surveys)==null||m.loadIfEnabled(),this.wu(),(h=this.externalIntegrations)==null||h.startIfEnabledOrStop(),!t.segment&&this.config.segment&&this.persistence&&Oo(this,ul,!1)}}_overrideSDKInfo(e,t){V.LIB_NAME=e,V.LIB_VERSION=t}startSessionRecording(e){let t=!0===e,n={sampling:t||!!e?.sampling,linked_flag:t||!!e?.linked_flag,url_trigger:t||!!e?.url_trigger,event_trigger:t||!!e?.event_trigger};var r,i,a,o,s;Object.values(n).some(Boolean)&&((r=this.sessionManager)==null||r.checkAndGetSessionAndWindowId(),n.sampling&&((i=this.sessionRecording)==null||i.overrideSampling()),n.linked_flag&&((a=this.sessionRecording)==null||a.overrideLinkedFlag()),n.url_trigger&&((o=this.sessionRecording)==null||o.overrideTrigger(`url`)),n.event_trigger&&((s=this.sessionRecording)==null||s.overrideTrigger(`event`))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){return!!this.sessionRecording?.started}captureException(e,t){try{if(!this.exceptions)return;let n=this.exceptions.buildProperties(e,{handled:!0,syntheticException:Error(`PostHog syntheticException`)});return this.exceptions.sendExceptionEvent(R(R({},n),t))}catch{return}}addExceptionStep(e,t){var n;(n=this.exceptions)==null||n.addExceptionStep(e,t)}captureLog(e){var t;(t=this.logs)==null||t.captureLog(e)}get logger(){return this.logs?.logger??e.wh}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t;return(t=this.toolbar?.loadToolbar(e))!=null&&t}get_property(e){return this.persistence?.props[e]}getSessionProperty(e){return this.sessionPersistence?.props[e]}toString(){let e=this.config.name??yl;return e!==yl&&(e=`posthog.`+e),e}_isIdentified(){return this.persistence?.get_property(`$user_state`)===`identified`||this.sessionPersistence?.get_property(`$user_state`)===`identified`}fh(){var e,t;return!(this.config.person_profiles===`never`||this.config.person_profiles===`identified_only`&&!this._isIdentified()&&k(this.getGroups())&&!((e=this.persistence)!=null&&(e=e.props)!=null&&e.__alias)&&!((t=this.persistence)!=null&&(t=t.props)!=null&&t.$epp))}Xu(){return!0===this.config.capture_pageleave||this.config.capture_pageleave===`if_capture_pageview`&&!!this.config.capture_pageview}createPersonProfile(){this.fh()||this.ph(`posthog.createPersonProfile`)&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.ph(`posthog.setInternalOrTestUser`)&&this.setPersonProperties({$internal_or_test_user:!0})}ph(e){return this.config.person_profiles===`never`?(z.error(e+` was called, but process_person is set to "never". This call will be ignored.`),!1):(this.gu(),this.gh(Pi,!0),!0)}_u(){if(this.config.cookieless_mode===`always`)return!0;let e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==`on_reject`)}wu(){let e=this._u();var t,n,r;return this.is_capturing()||(t=this.logs)==null||t.kh(),this.persistence?.mi!==e&&((n=this.persistence)==null||n.set_disabled(e)),this.sessionPersistence?.mi!==e&&((r=this.sessionPersistence)==null||r.set_disabled(e)),e&&(this.Cu.clear(),this.dh()),e}opt_in_capturing(t){var n;if(this.config.cookieless_mode!==`always`){if(this.pu()){var r,i,a;(r=this.sessionRecording)==null||r.dispose({discardBufferedEvents:!0}),this.yh(!0,!0),(i=this.sessionManager)==null||i.destroy(),(a=this.pageViewM
1anager)==null||a.destroy(),this.sessionManager=new Lc(this),this.pageViewManager=new Mo(this),this.persistence&&(this.sessionPropsManager=new Nc(this,this.sessionManager,this.persistence));let t=this.config.__extensionClasses?.sessionRecording??e.__defaultExtensionClasses?.sessionRecording;var o,s;t&&(this.sessionRecording=this.fu(this.sessionRecording,new t(this)),this.au&&((o=this.sessionRecording)==null||(s=o.onRemoteConfig)==null||s.call(o,this.au)))}var c;this.consent.optInOut(!0),this.wu(),this.Qu(),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),this.config.cookieless_mode==`on_reject`&&((c=this.surveys)==null||c.loadIfEnabled()),(A(t?.captureEventName)||t!=null&&t.captureEventName)&&this.capture(t?.captureEventName??`$opt_in`,t?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Ju()}else z.warn(dl)}opt_out_capturing(){if(this.config.cookieless_mode===`always`)return void z.warn(dl);let e=this.config.cookieless_mode===`on_reject`?this.sessionRecording:void 0;var t,n;e?.dispose({discardBufferedEvents:!0}),this.config.cookieless_mode===`on_reject`&&this.consent.isOptedIn()&&this.yh(!0,!0),this.consent.optInOut(!1),this.wu(),this.config.cookieless_mode===`on_reject`&&(this.register({distinct_id:Fi,$device_id:null}),this.vu(e),this.sessionRecording=void 0,(t=this.sessionManager)==null||t.destroy(),(n=this.pageViewManager)==null||n.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.Ju(),this.Qu())}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){let e=this.consent.consent;return e===1?`granted`:e===0?`denied`:`pending`}is_capturing(){return this.config.cookieless_mode===`always`||(this.config.cookieless_mode===`on_reject`?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.wu()}_is_bot(){return o?Rc(o,this.config.custom_blocked_useragents):void 0}Ju(){s&&(s.visibilityState===`visible`?this.Tu||(this.Tu=!0,this.capture(ea,{title:s.title},{send_instantly:!0}),this.Mu&&=(s.removeEventListener(Qi,this.Mu),null)):this.Mu||(this.Mu=this.Ju.bind(this),W(s,Qi,this.Mu)))}debug(e){!1===e?(i?.console.log(`You've disabled debug mode.`),this.set_config({debug:!1})):(i?.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}))}Yl(){let e=this.Au||{};return`advanced_disable_flags`in e?!!e.advanced_disable_flags:!1===this.config.advanced_disable_flags?!0===this.config.advanced_disable_decide?(z.warn(`Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version.`),!0):function(e,t,n,r,i){let a=t in e&&!N(e[t]),o=n in e&&!N(e[n]);return a?e[t]:!!o&&(i&&i.warn(`Config field '${n}' is deprecated. Please use '${t}' instead. The old field will be removed in a future major version.`),e[n])}(e,`advanced_disable_flags`,`advanced_disable_decide`,0,z):!!this.config.advanced_disable_flags}Os(e){if(N(this.config.before_send))return e;let t=Object.keys(e.properties??{}).filter(oe),n=E(this.config.before_send)?this.config.before_send:[this.config.before_send],r=e;for(let t of n)try{if(r=t(r),N(r)){let t=`Event '${e.event}' was rejected in beforeSend function`;return ae(e.event)?z.warn(`${t}. This can cause unexpected behavior.`):z.info(t),null}r.properties&&!k(r.properties)||z.warn(`Event '${e.event}' has no properties after beforeSend function, this is likely an error.`)}catch(t){return z.error(`Error in beforeSend function for event '${e.event}':`,t),null}for(let n of t)if(r.properties&&N(r.properties[n]))return z.warn(`Event '${e.event}' had its '${n}' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return r}getPageViewId(){return this.pageViewManager.Ho?.pageViewId}captureTraceFeedback(e,t){this.capture(`$ai_feedback`,{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,n){this.capture(`$ai_metric`,{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(n)})}Ru(e){let t=I(e)&&!e,n=K.Et()&&K.Ot(`ph_debug`)===`true`;return!t&&(!!n||e)}};Tl.__defaultExtensionClasses={},Tl.wh=(()=>{let e=()=>{};return{trace:e,debug:e,info:e,warn:e,error:e,fatal:e}})(),function(e,t){for(let n=0;t.length>n;n++)e.prototype[t[n]]=oa(e.prototype[t[n]])}(Tl,[`identify`]);var El=class{constructor(e){this.disabled=!1===e;let t=O(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,n){if(this.disabled)return!1;let r=this.clicks[this.clicks.length-1];if(r&&Math.abs(e-r.x)+Math.abs(t-r.y)<this.thresholdPx&&this.timeoutMs>n-r.timestamp){if(this.clicks.push({x:e,y:t,timestamp:n}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:n}];return!1}},Dl=`$copy_autocapture`,Ol=B(`[AutoCapture]`);function kl(e,t){return t.length>e?t.slice(0,e)+`...`:t}function Al(e){if(e.previousElementSibling)return e.previousElementSibling;let t=e;do t=t.previousSibling;while(t&&!Ba(t));return t}function jl(e,{e:t,maskAllElementAttributes:n,maskAllText:r,elementAttributeIgnoreList:a,elementsC
1hainAsString:o,disableCaptureUrlHashes:s}){if(!Ba(e))return{props:{}};let c=[e],l=new Set([e]),u=e;for(;u.parentNode&&!J(u,`body`)&&1e3>c.length;){if(Ha(u.parentNode)){let e=u.parentNode.host;if(l.has(e))break;l.add(e),c.push(e),u=e;continue}if(!Ba(u.parentNode)||l.has(u.parentNode))break;l.add(u.parentNode),c.push(u.parentNode),u=u.parentNode}let d=t.type===`click`&&e.namespaceURI===`http://www.w3.org/2000/svg`?c.findIndex(e=>J(e,`button`)||J(e,`a`)):-1;d>0&&(r||=c.slice(0,d+1).some(e=>!co(e)||lo(e)));let f=[],p={},m,h=!1,g=!1;if(H(c,e=>{let t=co(e);if(J(e,`a`)&&!n&&!a?.includes(`href`)){let n=e.getAttribute(`href`);h=!!(t&&n&&vo(n))&&(s?Mt(n):n)}C(Ga(e),`ph-no-capture`)&&(g=!0),f.push(function(e,t,n,r,i=!1){let a=e.tagName.toLowerCase(),o={tag_name:a};Ya.indexOf(a)>-1&&!n&&(o.$el_text=a.toLowerCase()===`a`||a.toLowerCase()===`button`?kl(1024,yo(e)):kl(1024,qa(e)));let s=Ga(e);t||r!=null&&r.includes(`class`)||0>=s.length||(o.classes=s.filter(function(e){return e!==``})),H(e.attributes,function(n){var a;if((!lo(e)||[`name`,`id`,`class`,`aria-label`].indexOf(n.name)!==-1)&&!r?.includes(n.name)&&!t&&vo(n.value)&&(!j(a=n.name)||a.substring(0,10)!==`_ngcontent`&&a.substring(0,7)!==`_nghost`)){let e=n.value;n.name===`class`&&(e=Ua(e).join(` `)),o[`attr__`+n.name]=kl(1024,n.name===`href`&&i?Mt(e):e)}});let c=1,l=1,u=e;for(;u=Al(u);)c++,u.tagName===e.tagName&&l++;return o.nth_child=c,o.nth_of_type=l,o}(e,n,r,a,s)),H(function(e){if(!co(e))return{};let t={};return H(e.attributes,function(e){if(e.name&&e.name.indexOf(`data-ph-capture-attribute`)===0){let n=e.name.replace(`data-ph-capture-attribute-`,``),r=e.value;n&&r&&vo(r)&&(t[n]=r)}}),t}(e),(e,t)=>{({}).hasOwnProperty.call(p,t)||(p[t]=e)})}),g)return{props:{},explicitNoCapture:g};if(d>0&&(e=c[d],f.splice(0,d)),r||(f[0].$el_text=J(e,`a`)||J(e,`button`)?yo(e):qa(e)),h){var _;f[0].attr__href=h;let e=Lo(h)?.host,t=i==null||(_=i.location)==null?void 0:_.host;e&&t&&e!==t&&(m=h)}return{props:U((y=t.type,{$event_type:y,$ce_version:1}),o?{}:{$elements:f},{$elements_chain:(v=f,E(v)?function(e){return e.map(e=>{let t=``;if(e.tag_name&&(t+=e.tag_name),e.attr_class){e.attr_class.sort();for(let n of e.attr_class)t+=`.${n.replace(/"/g,``)}`}let n=R(R(R(R({},e.text?{text:e.text}:{}),{},{"nth-child":e.nth_child??0,"nth-of-type":e.nth_of_type??0},e.href?{href:e.href}:{}),e.attr_id?{attr_id:e.attr_id}:{}),e.attributes),r={};return aa(n).sort(([e],[t])=>function(e,t){return t>e?-1:+(e>t)}(e,t)).forEach(([e,t])=>r[xo(e.toString())]=xo(t.toString())),t+=`:`,t+=aa(r).map(([e,t])=>`${e}="${t}"`).join(``),t}).join(`;`)}(function(e){return e.map(e=>{let t={text:e.$el_text?.slice(0,400),tag_name:e.tag_name,href:e.attr__href?.slice(0,2048),attr_class:So(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return aa(e).filter(([e])=>e.indexOf(`attr__`)===0).forEach(([e,n])=>t.attributes[e]=n),t})}(v)):``)},f[0]?.$el_text?{$el_text:f[0]?.$el_text}:{},m&&t.type===`click`?{$external_click_url:m}:{},p),target:e};var v,y}var Ml=class{ho(){this.co=void 0,clearTimeout(this.do),this.do=void 0}vo(e){if(!co(e))return!0;let t=this.fo().css_selector_ignorelist??$a,n=new Set,r=e;for(;r;){if(n.size>=1e3||n.has(r))return!0;n.add(r);let e=r,i=Ga(e);if(C(i,`ph-no-capture`)||C(i,`ph-sensitive`)||lo(e)||t.some(t=>Xa(e,t)))return!0;let a=r.parentNode;r=Ha(a)?a.host:a&&Ba(a)?a:null}return!1}po(e){if(!this.isEnabled||e.type===`pointercancel`)return void this.ho();if(e.type===`pointerdown`){this.ho();let t=Ja(e);e.isPrimary&&e.button===0&&!e.ctrlKey&&t&&Ba(t)&&(this.co={target:t,excluded:this.vo(t),id:e.pointerId,x:e.clientX,y:e.clientY,released:!1,distinctId:this.mo?.distinctId});return}let t=this.co;t&&(e.pointerId!==t.id||Math.abs(e.clientX-t.x)>5||Math.abs(e.clientY-t.y)>5?this.ho():e.type===`pointerup`&&(t.released=!0,this.do=setTimeout(()=>this.ho(),0)))}yo(e){let t=this.co;this.ho();let n=Ja(e);if(t?.released&&t.target.isConnected&&t.distinctId===this.mo?.distinctId&&e.pointerId===t.id&&(e.detail>0||e.pointerType===`touch`||e.pointerType===`pen`)&&e.button===0&&5>=Math.abs(e.clientX-t.x)&&5>=Math.abs(e.clientY-t.y)&&n&&(J(n,`html`)||J(n,`body`))){if(t.excluded)return null;let e=this.fo().css_selector_ignorelist??$a;return[n,s?.documentElement,s?.body].some(t=>{if(!t)return!1;let n=Ga(t);return C(n,`ph-no-capture`)||C(n,`ph-sensitive`)||!co(t)||lo(t)||e.some(e=>Xa(t,e))})?null:t.target}}constructor(e){this.bo=e,this.name=`autocapture`,this._o=!1,this.wo=null,this.ko=!1,this.So=!1,this.Ir={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.xo=!1,this.bo.refresh(this.Ir),this.rageclicks=new El(this.Ir.rageclick),this.Co=null}setup(e){this.$o(),this.mo=e;let t=e.onRemoteConfig(this.onRemoteConfig.bind(this));this.xo?t.dispose():(this.Io=t,this.startIfEnabled())}dispose(){var e;this.xo||(this.xo=!0,this.mo=void 0,(e=this.Io)==null||e.dispose(),this.Io=void 0,this.To())}fo(){return this.bo.refresh(this.Ir),this.Ir}$o(){return this.fo(),this.Ir.url_allowlist=this.Ir.url_allowlist?.map(e=>new RegExp(e)),this.Ir.url_ignorelist=this.Ir.url_ignorelist?.map(e=>new RegExp(e)),this.Ir}Mo(){if(!this.isBrowserSupported())return void Ol.info(`Disabling Automatic Event Collection because this browser is not supported`);if(!i||!s)return;let e=this.Eo=e=>{e||=i?.event;try{if(e.type===`blur`)return void this.ho();if(e.type.indexOf(`pointer`)===0)return void this.po(e);let t=e.type===`click`?this.yo(e):void 0;if(M(t))return;this.Po(e,`$autocapture`,t)}catch(e){Ol.error(`Failed to capture event`,e)}};if(W(i,`blur`,e),W(s,`submit`,e,{capture:!0}),W(s,`change`,e,{capture:!0}),W(s,`click`,e,{capture:!0}),H([`pointerdown`,`pointermove`,`pointerup`,`pointercancel`],t=>{W(s,t,e,{capture:!0})}),this.fo().capture_copied_text){let e=this.Ro=e=>{e||=i?.event;try{this.Po(e,Dl)}catch(e){Ol.error(`Failed to capture clipboard event`,e)}};
1W(s,`copy`,e,{capture:!0}),W(s,`cut`,e,{capture:!0}),W(s,`paste`,e,{capture:!0})}}To(){this.ho(),this.Eo&&=(i?.removeEventListener(`blur`,this.Eo),H([`pointerdown`,`pointermove`,`pointerup`,`pointercancel`],e=>{s?.removeEventListener(e,this.Eo,!0)}),s?.removeEventListener(`submit`,this.Eo,!0),s?.removeEventListener(`change`,this.Eo,!0),s?.removeEventListener(`click`,this.Eo,!0),void 0),this.Ro&&=(s?.removeEventListener(`copy`,this.Ro,!0),s?.removeEventListener(`cut`,this.Ro,!0),s?.removeEventListener(`paste`,this.Ro,!0),void 0),this._o=!1}startIfEnabled(){this.isEnabled||this.ho(),!this.xo&&this.mo&&this.isEnabled&&!this._o&&(this.Mo(),this._o=!0)}onRemoteConfig(e){if(this.xo)return;if(this.ko=!0,!e.ok)return void this.startIfEnabled();let t=e.config;t.elementsChainAsString&&(this.So=t.elementsChainAsString);let n=t.autocapture_opt_out;var r;I(n)&&((r=this.mo)==null||r.kv.set(`$autocapture_disabled_server_side`,n),this.wo=n),this.startIfEnabled()}setElementSelectors(e){this.Co=e}getElementSelectors(e,t){var n;let r=[];return(n=this.Co)==null||n.forEach(n=>{(s?.querySelectorAll(n))?.forEach(i=>{e!==i&&t!==i||C(r,n)||r.push(n)})}),r}get isEnabled(){if(this.xo)return!1;let e=this.mo?.kv.get(Ar),t=this.wo,n=this.fo();if(!n.remoteRequestsDisabled&&!this.ko)return!1;let r=n.remoteRequestsDisabled&&!this.ko;if(M(t)&&!I(e)&&!r)return!1;let i=this.wo??!!e;return!!n.enabled&&!i}Po(e,t=`$autocapture`,n){if(!this.isEnabled)return void this.ho();let r=n||Ja(e);Va(r)&&(r=r.parentNode||null);let a=this.$o();var o;t===`$autocapture`&&e.type===`click`&&e instanceof MouseEvent&&a.rageclick&&(o=this.rageclicks)!=null&&o.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime())&&ao(r,a.rageclick)&&this.Po(e,`$rageclick`,n);let s=t===Dl,c=s?R(R({},a),{},{dom_event_allowlist:void 0}):a;if(r&&function(e,t,n,r,a,o){if(!i||oo(e)||n?.url_allowlist&&!Wa(n.url_allowlist,o)||n?.url_ignorelist&&Wa(n.url_ignorelist,o))return!1;if(n?.dom_event_allowlist){let e=n.dom_event_allowlist;if(e&&!e.some(e=>t.type===e))return!1}let{parentIsUsefulElement:s,targetElementList:c}=so(e,r);if(!function(e,t){let n=t?.element_allowlist;if(A(n))return!0;for(let t of e)if(n.some(e=>t.tagName.toLowerCase()===e))return!0;return!1}(c,n)||!Za(c,n?.css_selector_allowlist)||Za(c,n?.css_selector_ignorelist??$a))return!1;try{let n=i.getComputedStyle(e);if(n&&n.getPropertyValue(`cursor`)===`pointer`&&t.type===`click`)return!0}catch{}let l=e.tagName.toLowerCase();switch(l){case`html`:return!1;case`form`:return(a||[`submit`]).indexOf(t.type)>=0;case`input`:case`select`:case`textarea`:return(a||[`change`,`click`]).indexOf(t.type)>=0;default:return s?(a||[`click`]).indexOf(t.type)>=0:(a||[`click`]).indexOf(t.type)>=0&&(Ya.indexOf(l)>-1||e.getAttribute(`contenteditable`)===`true`)}}(r,e,c,s,s?[`copy`,`cut`,`paste`]:void 0,{config:{get_current_url:a.getCurrentUrl}})){var l;let{props:n,explicitNoCapture:o,target:s}=jl(r,{e,maskAllElementAttributes:a.maskAllElementAttributes,maskAllText:a.maskAllText,elementAttributeIgnoreList:a.element_attribute_ignorelist,elementsChainAsString:this.So,disableCaptureUrlHashes:a.disableCaptureUrlHashes});if(o)return!1;let c=this.getElementSelectors(r,s);if(c&&c.length>0&&(n.$element_selectors=c),t===Dl){let t=e.type||`clipboard`;if(t!==`paste`){var u;let e=i==null||(u=i.getSelection())==null?void 0:u.toString(),t=Ka(e);if(!t)return!1;n.$selected_content=t,n.$clipboard_text_length=e?.length??0}n.$copy_type=t}return(l=this.mo)==null||l.capture(t,n),!0}}isBrowserSupported(){return D(s?.querySelectorAll)}},Nl=class{constructor(e){this._instance=e}refresh(e){let t=this._instance.config,n=O(t.autocapture)?t.autocapture:void 0;e.enabled=!!t.autocapture,e.rageclick=t.rageclick,e.maskAllElementAttributes=t.mask_all_element_attributes,e.maskAllText=t.mask_all_text,e.disableCaptureUrlHashes=t.disable_capture_url_hashes,e.getCurrentUrl=t.get_current_url,e.remoteRequestsDisabled=this._instance.Yl(),e.url_allowlist=n?.url_allowlist,e.url_ignorelist=n?.url_ignorelist,e.dom_event_allowlist=n?.dom_event_allowlist,e.element_allowlist=n?.element_allowlist,e.css_selector_allowlist=n?.css_selector_allowlist,e.css_selector_ignorelist=n?.css_selector_ignorelist,e.element_attribute_ignorelist=n?.element_attribute_ignorelist,e.capture_copied_text=n?.capture_copied_text}},Pl=B(`[ExceptionAutocapture]`),Fl=()=>{},Il=e=>{if(D(e))return e.__posthog_layer__??e.__rrweb_layer__};function Ll(e,t,n){try{if(!(t in e))return Fl;let r={next:e[t]},i=n(function(...e){return r.next.apply(this,e)});return D(i)&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:r}})),e[t]=i,()=>{if(e[t]===i)return void(e[t]=r.next);let n=e[t],a=Il(n);for(;a;){if(a.next===i)return void(a.next=r.next);n=a.next,a=Il(n)}}}catch{return Fl}}var Rl=B(`[TracingHeaders]`),zl=B(`[Web Vitals]`),Bl=9e5,Vl=[`CLS`,`FCP`,`INP`,`LCP`],Hl=[`INP`,`LCP`],Ul=[`interactionTarget`,`interactionType`,`inputDelay`,`processingDuration`,`presentationDelay`,`loadState`,`target`,`url`,`timeToFirstByte`,`resourceLoadDelay`,`resourceLoadDuration`,`elementRenderDelay`,`largestShiftTarget`,`largestShiftTime`,`largestShiftValue`,`firstByteToFCP`],Wl=`disabled`,Gl=`lazy_loading`,Kl=B(`[SessionRecording]`),ql=B(`[Heatmaps]`);function Jl(e){return O(e)&&`clientX`in e&&`clientY`in e&&P(e.clientX)&&P(e.clientY)}var Yl=B(`[Product Tours]`),Xl=e=>!e.config.disable_product_tours&&!!e.persistence?.get_property(Lr),Zl=[`$set_once`,`$set`],Ql=B(`[SiteApps]`),$l=`Error while initializing PostHog app with config id `,eu=(e,t)=>
1e?.then?e.then(t):t(e),tu=`SDK is not enabled or survey functionality is not yet loaded`,nu=`Disabled. Not loading surveys.`,ru=class{constructor(e,t){this.bo=e,this.Sh=t,this.name=`surveys`,this._surveyEventReceiver=null,this._surveyManager=null,this.xh=!1,this.Ch=[],this.$h=null,this.Ih=null,this.xo=!1,this.Th=new Set,this.onRemoteConfig=e=>{if(this.xo||this.Ir.disableSurveys)return;if(!e.ok)return Q.warn(`Remote config unavailable. Not loading surveys.`);let t=e.config.surveys;if(N(t))return Q.warn(`Flags not loaded yet. Not loading surveys.`);this.Mh=I(t)?t:t.length>0,Q.info(`flags response received, isSurveysEnabled: ${this.Mh}`),this.loadIfEnabled()}}setup(e){if(!this.xo)return this.Eh=e,eu(e.kv.initialize(),()=>{if(this.Eh!==e||this.xo)return;this.Eh=void 0,this.mo=e;let t=e.onRemoteConfig(this.onRemoteConfig);this.xo?t.dispose():(this.Io=t,this.loadIfEnabled())})}dispose(){var e,t,n,r;this.xo||(this.xo=!0,this.Eh=void 0,this.mo=void 0,(e=this.Io)==null||e.dispose(),this.Io=void 0,(t=this._surveyEventReceiver)==null||t.dispose(),this._surveyEventReceiver=null,(n=this._surveyManager)==null||(r=n.dispose)==null||r.call(n),this._surveyManager=null,this.Ch=[],this.$h=null,this.Th.forEach(e=>clearTimeout(e)),this.Th.clear())}get Ir(){return this.bo.get()}initialize(){this.loadIfEnabled()}reset(){var e,t;(e=this._surveyManager)==null||(t=e.clearInMemoryInProgressSurveyState)==null||t.call(e);try{var n;(n=this._surveyEventReceiver)==null||n.reset(),localStorage.removeItem(`lastSeenSurveyDate`);let e=[];for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);(n!=null&&n.startsWith(`seenSurvey_`)||n!=null&&n.startsWith(`inProgressSurvey_`))&&e.push(n)}e.forEach(e=>localStorage.removeItem(e))}catch{}}loadIfEnabled(){if(this.xo||!this.mo)return;let e=this.Ir;if(this._surveyManager)return;if(this.xh)return void Q.info(`Already initializing surveys, skipping...`);if(e.disableSurveys)return void Q.info(nu);if(e.cookielessMode&&this.bo.isOptedOut())return void Q.info(`Not loading surveys in cookieless mode without consent.`);let t=this.bo.getExtensions();if(!t)return void Q.error(`PostHog Extensions not found.`);if(A(this.Mh)&&!e.advancedEnableSurveys)return;let n=this.Mh||e.advancedEnableSurveys;this.xh=!0;try{let e=t.generateSurveys;if(e)return this.Ph(e,n),void(this.xh=!1);let r=t.loadExternalDependency;if(!r)return this.Rh(Ji),void(this.xh=!1);r(e=>{try{if(this.xo)return;let t=this.bo.getExtensions();e||!t?.generateSurveys?this.Rh(`Could not load surveys script`,e):this.Ph(t.generateSurveys,n)}finally{this.xh=!1}})}catch(e){throw this.xh=!1,this.Rh(`Error initializing surveys`,e),e}}Ph(e,t){this.xo||(this._surveyManager=e(t),this._surveyEventReceiver=this.bo.createEventReceiver(),Q.info(`Surveys loaded successfully`),this.Ah({isLoaded:!0}))}Rh(e,t){Q.error(e,t),this.Ah({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Ch.push(e),this._surveyManager&&this.Ah({isLoaded:!0}),()=>{this.Ch=this.Ch.filter(t=>t!==e)}}getSurveys(e,t=!1){let n=this.mo??this.Sh;if(!n||this.xo)return;if(this.Ir.disableSurveys)return Q.info(nu),e([]);let r=n.kv.get(fi);if(r&&!t)return e(r,{isLoaded:!0}),void(this.Fh()&&this.getSurveys(()=>{},!0));if(this.$h)return void this.$h.then(({surveys:t,context:n})=>{this.xo||e(t,n)}).catch(e=>Q.error(`Error in survey callback`,e));let i=this.Oh(`/api/surveys/`,{method:`GET`,query:{token:n.projectToken},sentAt:`query`,timeoutMs:this.Ir.requestTimeoutMs}).then(e=>{try{return this.Dh(n,e)}catch(e){return Q.error(`Error processing surveys response`,e),this.Dh(n,{statusCode:0,error:e})}},e=>this.Dh(n,{statusCode:0,error:e}));this.$h=i;let a=()=>{this.$h===i&&(this.$h=null)};i.then(t=>{a(),this.xo||e(t.surveys,t.context)},a).catch(e=>Q.error(`Error in survey callback`,e))}Oh(e,t){let n=this.mo;return n?n.sendRequest(e,t):new Promise(e=>e({statusCode:0,error:Error(tu)}))}Dh(e,t){if(this.xo)return{surveys:[],context:{isLoaded:!1,error:tu}};let n=t.statusCode;if(n!==200||!t.json){let e=`Surveys API could not be loaded, status: ${n}`;return n===0?t.error||Q.warn(e):Q.error(e),this.Ih=Date.now(),{surveys:[],context:{isLoaded:!1,error:e}}}this.Ih=null;let r=t.json.surveys||[],i=r.filter(e=>function(e){return!(!e.start_date||e.end_date)}(e)&&(Vc(e)||function(e){var t;return!!((t=e.conditions)!=null&&(t=t.actions)!=null&&(t=t.values)!=null&&t.length)}(e)));var a;return i.length>0&&((a=this._surveyEventReceiver)==null||a.register(i)),e.kv.set({[fi]:r,[pi]:Date.now()}),{surveys:r,context:{isLoaded:!0}}}Fh(){return this.Lh()&&!this.$h&&!this.Nh()}Lh(){let e=(this.mo??this.Sh)?.kv.get(pi);return P(e)&&Date.now()-e>3e5}Nh(){return P(this.Ih)&&3e5>Date.now()-this.Ih}markSurveyAsSeen(e,t){Qc({id:e,current_iteration:t?.iteration??null});try{localStorage.setItem(`lastSeenSurveyDate`,new Date().toISOString())}catch{}}
1Ah(e){for(let t of this.Ch)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(e){Q.error(`Error in survey callback`,e)}}getActiveMatchingSurveys(e,t=!1){if(!N(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);Q.warn(`init was not called`)}qh(e){let t=null;return this.getSurveys(n=>{t=n.find(t=>t.id===e)??null}),t}jh(e){if(N(this._surveyManager))return{eligible:!1,reason:tu};let t=typeof e==`string`?this.qh(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:`Survey not found`}}Bh(e){if(!this.bo.isCapturing())return{eligible:!1,reason:`PostHog is not capturing, so a survey response cannot be recorded`};if(N(this._surveyManager))return{eligible:!1,reason:tu};let t=typeof e==`string`?this.qh(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:`Survey not found`}}canRenderSurvey(e){if(N(this._surveyManager))return Q.warn(`init was not called`),{visible:!1,disabledReason:tu};let t=this.Bh(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return N(this._surveyManager)?(Q.warn(`init was not called`),Promise.resolve({visible:!1,disabledReason:tu})):new Promise(n=>{this.getSurveys(t=>{let r=t.find(t=>t.id===e)??null;if(r){let e=this.Bh(r);n({visible:e.eligible,disabledReason:e.reason})}else n({visible:!1,disabledReason:`Survey not found`})},t)})}renderSurvey(e,t,n){if(!this.bo.isCapturing())return;if(N(this._surveyManager))return void Q.warn(`init was not called`);let r=typeof e==`string`?this.qh(e):e;if(!r?.id)return void Q.warn(`Survey not found`);if(!$c.includes(r.type))return void Q.warn(`Surveys of type ${r.type} cannot be rendered in the app`);let i=s?.querySelector(t);if(i){if(r.appearance?.surveyPopupDelaySeconds){Q.info(`Rendering survey ${r.id} with delay of ${r.appearance.surveyPopupDelaySeconds} seconds`);let e=setTimeout(()=>{var t;this.Th.delete(e),!this.xo&&this.bo.isCapturing()&&(Q.info(`Rendering survey ${r.id} with delay of ${r.appearance?.surveyPopupDelaySeconds} seconds`),(t=this._surveyManager)==null||t.renderSurvey(r,i,n),Q.info(`Survey ${r.id} rendered`))},1e3*r.appearance.surveyPopupDelaySeconds);this.Th.add(e);return}this._surveyManager.renderSurvey(r,i,n)}else Q.warn(`Survey element not found`)}displaySurvey(e,t){var n;if(!this.bo.isCapturing())return;if(N(this._surveyManager))return void Q.warn(`init was not called`);let r=this.qh(e);if(!r)return void Q.warn(`Survey not found`);let i=r;if((n=r.appearance)!=null&&n.surveyPopupDelaySeconds&&t.ignoreDelay&&(i=R(R({},r),{},{appearance:R(R({},r.appearance),{},{surveyPopupDelaySeconds:0})})),t.displayType!==xs.Popover&&t.initialResponses&&Q.warn(`initialResponses is only supported for popover surveys. prefill will not be applied.`),!1===t.ignoreConditions){let e=this.jh(r);if(!e.eligible)return void Q.warn(`Survey is not eligible to be displayed: `,e.reason)}t.displayType===xs.Inline?this.renderSurvey(i,t.selector,t.properties):this._surveyManager.handlePopoverSurvey(i,t)}cancelPendingSurvey(e){N(this._surveyManager)?Q.warn(`init was not called`):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e,t;(e=this._surveyManager)==null||(t=e.handlePageUnload)==null||t.call(e)}};function iu(e,t,n){if(N(e))return!1;switch(n){case`exact`:return e===t;case`contains`:{let n=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`).replace(/_/g,`.`).replace(/%/g,`.*`);return new RegExp(n,`i`).test(e)}case`regex`:try{return new RegExp(t).test(e)}catch{return!1}default:return!1}}var au=class{constructor(e){this._instance=e,this.Hh=new Set,this.zh=new Set,this.Uh=new Pc,this.Wh=(e,t)=>this.Vh(e,t)&&this.Gh(e,t)&&this.Zh(e,t)&&this.Qh(e,t),this.Vh=(e,t)=>!t?.event||e?.event===t?.event}init(){A(this._instance?._addCaptureHook)||(this.Jh=this._instance?._addCaptureHook((e,t)=>{this.on(e,t)}))}dispose(){var e;(e=this.Jh)==null||e.call(this),this.Jh=void 0,this.Uh=new Pc}register(e){if(!A(this._instance?._addCaptureHook)&&(e.forEach(e=>{var t;this.Hh.add(e),(t=e.steps)==null||t.forEach(e=>{this.zh.add(e?.event||``)})}),this._instance?.autocapture)){let e=new Set;
1this.Hh.forEach(t=>{var n;(n=t.steps)==null||n.forEach(t=>{t!=null&&t.selector&&e.add(t.selector)})}),this._instance.autocapture.setElementSelectors(e)}}replace(e){this.Hh.clear(),this.zh.clear(),this.register(e)}on(e,t){t!=null&&e.length!=0&&(this.zh.has(e)||this.zh.has(t.event))&&this.Hh.forEach(e=>{this.Kh(t,e)&&this.Uh.emit(`actionCaptured`,e.name)})}Xh(e){this.onAction(`actionCaptured`,t=>e(t))}Kh(e,t){if(t?.steps==null)return!1;for(let n of t.steps)if(this.Wh(e,n))return!0;return!1}onAction(e,t){return this.Uh.on(e,t)}Gh(e,t){if(t?.url){var n;let r=e==null||(n=e.properties)==null?void 0:n.$current_url;if(!r||typeof r!=`string`||!iu(r,t.url,t.url_matching||`contains`))return!1}return!0}Zh(e,t){return!!this.Yh(e,t)&&!!this.tc(e,t)&&!!this.ec(e,t)}Yh(e,t){var n;if(!t?.href)return!0;let r=this.nc(e);if(r.length>0)return r.some(e=>iu(e.href,t.href,t.href_matching||`exact`));let i=(e==null||(n=e.properties)==null?void 0:n.$elements_chain)||``;return!!i&&iu(function(e){let t=e.match(/(?::|")href="(.*?)"/);return t?t[1]:``}(i),t.href,t.href_matching||`exact`)}tc(e,t){var n;if(!t?.text)return!0;let r=this.nc(e);if(r.length>0)return r.some(e=>iu(e.text,t.text,t.text_matching||`exact`)||iu(e.$el_text,t.text,t.text_matching||`exact`));let i=(e==null||(n=e.properties)==null?void 0:n.$elements_chain)||``;return!!i&&(a=function(e){let t=[],n=/(?::|")text="(.*?)"/g,r;for(;!N(r=n.exec(e));)t.includes(r[1])||t.push(r[1]);return t}(i),o=t.text,s=t.text_matching||`exact`,a.some(e=>iu(e,o,s)));var a,o,s}ec(e,t){var n,r;if(!t?.selector||(e==null||(n=e.properties)==null?void 0:n.$element_selectors)?.includes(t.selector))return!0;let i=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||``;if(t.selector_regex&&i)try{return new RegExp(t.selector_regex).test(i)}catch{return!1}return!1}nc(e){var t;return(e==null||(t=e.properties)==null?void 0:t.$elements)==null?[]:e?.properties.$elements}Qh(e,t){return!t?.properties||t.properties.length===0||Gc(t.properties.reduce((e,t)=>{let n=E(t.value)?t.value.map(String):t.value==null?[]:[String(t.value)];return e[t.key]={values:n,operator:t.operator||`exact`},e},{}),e?.properties)}},ou=class{constructor(e){var t,n;this.sc=[],this._instance=e,this.rc=new Map,this.oc=new Map,this.lc=new Map,this.ac=(t=this._instance)==null||(n=t.onSessionId)==null?void 0:n.call(t,e=>this.uc(e))}hc(e){return!1}cc(){return null}dc(e){}vc(){}fc(e,t){return!!e&&Gc(e.propertyFilters,t?.properties)}gc(e,t){let n=new Map;return e.forEach(e=>{var r;(r=e.conditions)==null||(r=r[t])==null||(r=r.values)==null||r.forEach(t=>{if(t?.name){let r=n.get(t.name)||[];r.push(e.id),n.set(t.name,r)}})}),n}mc(e,t,n){let r=(n===_s.Activation?this.rc:this.oc).get(e),i=[];return this.yc(e=>{i=e.filter(e=>r?.includes(e.id))}),i.filter(r=>{var i;let a=(i=r.conditions)==null||(i=i[n])==null||(i=i.values)==null?void 0:i.find(t=>t.name===e);return this.fc(a,t)})}register(e){this.bc(e,!1)}replace(e){this.bc(e,!0)}bc(e,t){A(this._instance?._addCaptureHook)||(this._c(e,t),this.wc(e,t))}wc(e,t){let n=e.filter(e=>{var t;return(t=e.conditions)==null||(t=t.actions)==null||(t=t.values)==null?void 0:t.length});var r;if(t&&this.lc.clear(),n.length===0)return void(t&&((r=this.kc)==null||r.replace([])));this.kc||(this.kc=new au(this._instance),this.kc.init(),this.kc.Xh(e=>this.onAction(e)));let i=[];n.forEach(e=>{var t;(t=e.conditions)==null||(t=t.actions)==null||t.values.forEach(t=>{if(i.push(t),t.name){let n=this.lc.get(t.name)??[];n.includes(e.id)||n.push(e.id),this.lc.set(t.name,n)}})}),t?this.kc.replace(i):this.kc.register(i)}Sc(e,t){t.forEach((t,n)=>{let r=e.get(n)??[];t.forEach(e=>{r.includes(e)||r.push(e)}),e.set(n,r)})}_c(e,t){let n=e.filter(e=>{var t;return e.conditions?.events&&((t=e.conditions)==null||(t=t.events)==null||(t=t.values)==null?void 0:t.length)>0}),r=e.filter(e=>{var t;return e.conditions?.cancelEvents&&((t=e.conditions)==null||(t=t.cancelEvents)==null||(t=t.values)==null?void 0:t.length)>0}),i=this.gc(e,_s.Activation),a=this.gc(e,_s.Cancellation);t?(this.rc=i,this.oc=a):(this.Sc(this.rc,i),this.Sc(this.oc,a)),(n.length!==0||r.length!==0)&&(this.Jh??=this._instance?._addCaptureHook((e,t)=>{this.onEvent(e,t)}))}onEvent(e,t){var n,r;let i=this.xc(),a=(t==null||(n=t.properties)==null?void 0:n.$survey_id)||(t==null||(r=t.properties)==null?void 0:r.$product_tour_id);if(a&&this.getActivatedIds().includes(a)){let t=this.Cc(e,a);if(t===`consume`)return i.info(`event consumed activated item, remov
1ing it`,{event:e,itemId:a}),void this.$c([a]);if(t===`persist`)return i.info(`shown item promoted to persisted activation`,{event:e,itemId:a}),this.Ic(a),void this.Tc([a])}if(this.oc.has(e)){let n=this.mc(e,t,_s.Cancellation);n.length>0&&(i.info(`cancel event matched, cancelling items`,{event:e,itemsToCancel:n.map(e=>e.id)}),this.$c(n.map(e=>e.id)),n.forEach(e=>this.Mc(e.id)))}if(!this.rc.has(e))return;i.info(`event name matched`,{event:e,eventPayload:t,items:this.rc.get(e)});let o=this.mc(e,t,_s.Activation);this.Ec(o.map(e=>e.id))}onAction(e){this.lc.has(e)&&this.Ec(this.lc.get(e)||[])}Ec(e){var t,n;if(e.length===0)return;let r=!!((t=this._instance)!=null&&(n=t.get_session_id)!=null&&n.call(t)),i=[];for(let t of e)r&&this.hc(t)?this.Ic(t)&&this.Pc(t):i.push(t);i.length>0&&(this.sc=[...new Set([...this.sc,...i])]),this.xc().info(`updating activated items`,{activatedItems:this.getActivatedIds()})}Ic(e){this.sc=this.sc.filter(t=>t!==e);let t=this.Rc();return!t.includes(e)&&(this.Ac([...t,e]),this.Fc(),!0)}$c(e){let t=new Set(e);this.sc=this.sc.filter(e=>!t.has(e));let n=this.Oc(),r=n.filter(e=>!t.has(e));r.length!==n.length&&(this.Ac(r),r.length===0&&this.Dc()),this.Tc(e)}Lc(){var e;let t=this.cc();if(!t)return{};let n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[t];return n&&typeof n==`object`?n:{}}Pc(e){if(!this.cc())return;let t=this.Lc();this.dc(R(R({},t),{},{[e]:Date.now()}))}Tc(e){if(!this.cc())return;let t=this.Lc(),n={},r=!1;for(let[i,a]of Object.entries(t))e.includes(i)?r=!0:n[i]=a;r&&(k(n)?this.vc():this.dc(n))}Nc(){this.cc()&&this.vc()}getActivationTimestamp(e){if(!this.Rc().includes(e))return;let t=this.Lc()[e];return P(t)?t:void 0}Oc(){var e;let t=this.qc();return((e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[t])||[]}Rc(){var e,t,n;let r=this.Oc();if(r.length===0)return[];let i=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[this.jc()],a=(t=this._instance)==null||(n=t.get_session_id)==null?void 0:n.call(t);return a&&i===a?r:[]}Fc(){var e,t;let n=(e=this._instance)==null||(t=e.get_session_id)==null?void 0:t.call(e);n&&this.Bc(n)}Dc(){this.Hc()}uc(e){var t;let n=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[this.jc()];if(n&&n!==e){let e=this.Oc(),t=this.Lc();e.length>0&&(this.Ac([]),e.filter(e=>P(t[e])).forEach(e=>this.Mc(e))),this.Dc(),this.Nc()}}getActivatedIds(){return[...new Set([...this.Rc(),...this.sc])].filter(e=>!this.zc(e))}dispose(){var e,t,n;(e=this.ac)==null||e.call(this),this.ac=void 0,(t=this.Jh)==null||t.call(this),this.Jh=void 0,(n=this.kc)==null||n.dispose(),this.kc=void 0}reset(){this.sc=[],this.Oc().length>0&&this.Ac([]),this.Dc(),this.Nc()}getEventToItemsMap(){return this.rc}Uc(){return this.kc}},su=class extends ou{constructor(e){super(e)}qc(){return mi}jc(){return hi}cc(){return gi}dc(e){var t;(t=this._instance)==null||(t=t.persistence)==null||t.register({$surveys_activated_timestamps:e})}vc(){var e;(e=this._instance)==null||(e=e.persistence)==null||e.unregister(`$surveys_activated_timestamps`)}hc(e){var t;let n;this.yc(t=>{n=t.find(t=>t.id===e)});let r=n==null||(t=n.appearance)==null?void 0:t.surveyPopupDelaySeconds;return P(r)&&r>0}Wc(){return ys.SHOWN}yc(e){var t;(t=this._instance)==null||t.getSurveys(e)}Mc(e){var t;(t=this._instance)==null||t.cancelPendingSurvey(e)}xc(){return Q}Ac(e){var t;(t=this._instance)==null||(t=t.persistence)==null||t.register({$surveys_activated:e})}Bc(e){var t;(t=this._instance)==null||(t=t.persistence)==null||t.register({$surveys_activated_session:e})}Hc(){var e;(e=this._instance)==null||(e=e.persistence)==null||e.unregister(`$surveys_activated_session`)}zc(){return!1}Cc(e,t){let n;return this.yc(e=>{n=e.find(e=>e.id===t)}),!n||function(e){var t;return Vc(e)&&!!((t=e.conditions)!=null&&(t=t.events)!=null&&t.repeatedActivation)||e.schedule===`always`}(n)?e===ys.SHOWN?`consume`:`ignore`:e===ys.SHOWN?`persist`:e===ys.DISMISSED||e===ys.SENT?`consume`:`ignore`}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},cu=class{constructor(e){this._instance=e}initialize(){}get(e){if(typeof e==`string`)return this._instance.get_property(e);let t={};for(let n of e){let e=this._instance.get_property(n);A(e)||(t[n]=e)}return t}set(e,t){this._instance.register(typeof e==`string`?{[e]:t}:e)}remove(e){typeof e==`string`?this._instance.unregister(e):e.forEach(e
1=>this._instance.unregister(e))}},lu=class{constructor(e){this._instance=e}get(){let e=this._instance.config;return{disableSurveys:e.disable_surveys,cookielessMode:!!e.cookieless_mode,advancedEnableSurveys:e.advanced_enable_surveys,requestTimeoutMs:e.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}isCapturing(){return this._instance.is_capturing()}getExtensions(){let e=g?.__PosthogExtensions__;if(!e)return;let{generateSurveys:t,loadExternalDependency:n}=e;return{generateSurveys:t?e=>t(this._instance,e):void 0,loadExternalDependency:n?e=>n(this._instance,`surveys`,e):void 0}}createEventReceiver(){return new su(this._instance)}},uu=i?.location?Bo(i.location.hash,`__posthog`)||Bo(location.hash,`state`):null,du=`_postHogToolbarParams`,fu=B(`[Toolbar]`),pu=B(`[FeatureFlags]`),mu=class{constructor(e,t=!1){this.Vc=!1,this.update(e,t)}update(e,t){this.Gc=((e,t)=>({bootstrap:{featureFlags:e.bootstrap?.featureFlags??void 0,featureFlagPayloads:e.bootstrap?.featureFlagPayloads??void 0},remoteRequestsDisabled:t,featureFlagsDisabled:!!e.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!e.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!e.advanced_feature_flags_dedup_per_session,cacheTtlMs:e.feature_flag_cache_ttl_ms,refreshIntervalMs:e.remote_config_refresh_interval_ms??3e5,idleRefreshBackoff:A(e.remote_config_refresh_interval_ms),requestTimeoutMs:e.feature_flag_request_timeout_ms,compression:e.disable_compression?void 0:`best-available`,evaluationContexts:e.evaluation_contexts??e.evaluation_environments??[],flagKeys:E(e.flag_keys)?e.flag_keys:void 0}))(e,t),!e.evaluation_environments||e.evaluation_contexts||this.Vc||(pu.warn(`evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version.`),this.Vc=!0),A(e.flag_keys)||E(e.flag_keys)||pu.error(`Invalid flag_keys found:`,e.flag_keys,`Expected array of non-empty strings`)}get(){return this.Gc}},hu=B(`[FeatureFlags]`),gu=B(`[FeatureFlags]`,{debugEnabled:!0}),_u=`" failed. Feature flags didn't load in time.`,vu=[`click`,`keydown`,`wheel`,`touchstart`,`pointerdown`],yu=`connection_error`,bu=e=>{let t={};for(let n=0;e.length>n;n++)t[e[n]]=!0;return t},xu=e=>{let t={};for(let[n,r]of aa(e||{}))r&&(t[n]=r);return t},Su=e=>le(e)&&(e.name===`RangeError`&&e.message.indexOf(`Maximum call stack size exceeded`)===0||e.name===`InternalError`&&e.message===`too much recursion`),Cu=B(`[Error tracking]`),wu=`webkit-masked-url:`,Tu=[{value:`isolatedAPI.contexts.topHostname`,exact:!1},{value:`No response from target`,exact:!0}],Eu=[`chrome-extension://`,`moz-extension://`,`safari-extension:`,`safari-web-extension:`,wu],Du=[`__firefox__`,`__gCrWeb`],Ou=`Refusing to render web experiment since the viewer is a likely bot`,ku={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>Hc(t,e),not_regex:(e,t)=>!Hc(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e},Au=B(`[Conversations]`),ju=`Conversations not available yet.`;function Mu(e,t){let n=e?.flushIntervalMs??3e3,r=e?.maxBufferSize??100,i=t?.consoleCapture?void 0:e?.maxLogsPerInterval??1e3,a=A(i)?Math.max(r,2048):Math.max(r,i),s=R(R({},function(){let e=``,t=``;try{let n=o?.userAgent;n&&([e,t]=vt(n))}catch{}return function(e,t){let n=function(e){if(e)return{}.hasOwnProperty.call(Qn,e)?Qn[e]:e}(e);return R(R({},n?{"os.name":n}:{}),t?{"os.version":t}:{})}(e,t)}()),e?.resourceAttributes);return{serviceName:s?.[`service.name`]??e?.serviceName??t?.serviceNameDefault,serviceVersion:s?.[`service.version`]??e?.serviceVersion,environment:s?.[`deployment.environment`]??e?.environment,resourceAttributes:s,beforeSend:e?.beforeSend,flushIntervalMs:n,maxBufferSize:r,maxQueueSize:a,maxBatchRecordsPerPost:100,rateCapWindowMs:n,maxLogsPerInterval:i,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}var Nu=[`debug`,`log`,`warn`,`error`,`info`],Pu=e=>{for(;e?.__rrweb_original__;)e=e.__rrweb_original__;return e},Fu=`console`,Iu=`__posthogHandledLogsRequestError`,Lu=(e,t)=>{let n=e instanceof Error?e:Error(t);return n[Iu]=!0,n},Ru=e=>
1!!e&&typeof e==`object`&&!0===e[Iu],zu=B(`[NetworkMetrics]`),Bu=()=>{var e;return i!=null&&(e=i.performance)!=null&&e.now?i.performance.now():Date.now()},Vu=e=>e?`${Math.floor(e/100)}xx`:`missing`,Hu=(e,t)=>{let n=String(t);return{method:String(e).toUpperCase(),url:Lo(n)?.href||n}},Uu=(e,t,n,r,i)=>{try{var a;let s=i();if(!s)return;let c=n||void 0,l=Bu()-r,u=Lo(t.url);if(u&&u.protocol!==`http:`&&u.protocol!==`https:`)return;let d={url:u?.href||t.url,method:t.method},f=D(s.name)?s.name(d):j(s.name)?s.name:`http.client.request.duration`;if(!f)return;let p=R({method:d.method,host:u?.hostname??``,path:u?(o=u.pathname,o.split(`/`).map(e=>(e=>/^\d+$/.test(e)||e.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(e))(e)?`:id`:e).join(`/`)):``,status_class:Vu(c)},s.attributes?.call(s,d,{status:c,durationMs:l}));(a=e.metrics)==null||a.histogram(f,l,{unit:`ms`,attributes:p})}catch(e){zu.error(`Failed to record network metric`,e)}var o},Wu=()=>{},Gu=(e,t)=>D(i?.fetch)?Ll(i,`fetch`,n=>function(...r){let i=Bu(),a=n.apply(this,r);if(!t())return a;try{let[n,o]=r,s=Hu(o?.method??n?.method??`GET`,n?.url??n);return a.then(n=>(Uu(e,s,n?.status,i,t),n),n=>{throw Uu(e,s,void 0,i,t),n})}catch(e){return zu.error(`Failed to observe fetch`,e),a}}):Wu,Ku=(e,t)=>{var n;let r=i==null||(n=i.XMLHttpRequest)==null?void 0:n.prototype;if(!r)return Wu;let a=new WeakMap,o=Ll(r,`open`,e=>function(...t){try{cc.has(this)||a.set(this,Hu(t[0],t[1]))}catch(e){zu.error(`Failed to observe XHR open`,e)}return e.apply(this,t)}),s=Ll(r,`send`,n=>function(...r){let i;try{let n=a.get(this);if(n&&t()){let r=Bu();i=()=>{this.removeEventListener(`loadend`,i),Uu(e,n,this.status,r,t)},W(this,`loadend`,i)}}catch(e){zu.error(`Failed to observe XHR send`,e)}try{return n.apply(this,r)}catch(e){throw i&&this.removeEventListener(`loadend`,i),e}});return()=>{o(),s()}},qu={featureFlags:class{constructor(e){this.name=`featureFlags`,this.Zc=!1,this.featureFlagEventHandlers=[],this.$=hu,this.Qc={},this.Jc={},this.Kc=[],this.Xc=!1,this.Yc=!1,this.td=0,this.ed=!1,this.nd=!1,this.sd=!1,this.rd=!1,this.od=0,this.ld=!1,this.an=()=>{let e=this.ad();this.od=0,e&&this.reloadFeatureFlags()},this.ud=()=>{let e=this.hd,t=this.dd??e;A(e)||A(t)||this.Ir.remoteRequestsDisabled||!s||s.visibilityState===`hidden`||Date.now()-(this.vd??0)<t||(this.dd=this.ld||!this.Ir.idleRefreshBackoff?e:Math.min(2*t,36e5),this.ld=!1,this.reloadFeatureFlags(),this.fd())},this.pd=()=>{this.ld&&this.dd===this.hd||this.gd()},this.ln=()=>{s?.visibilityState===`visible`&&this.gd()},`get`in e?this.bo=e:(this._instance=e,this.md=new mu(e.config,e.Yl()),this.bo=this.md)}updateConfig(e,t){var n;(n=this.md)==null||n.update(e,t),this.mo&&this.yd()}setup(e){return this.Eh=e,this.$=e.logger.createLogger(`[FeatureFlags]`),eu(e.kv.initialize(),()=>{this.Eh===e&&(this.Eh=void 0,this.mo=e,this.bd(e))})}bd(e){var t;if(this.mo===e)return i&&W(i,`online`,this.an),this.yd(),this._d=e.registerDynamicEventProperties(()=>this.wd()?this.Qc:this.Jc),this.kd=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.onCrossTabFeatureFlagChange(()=>{this.Sd(),this.xd(),this.Cd()}),this.xd(),this.initialize()}gd(){this.ld=!0,this.dd=this.hd,this.ud()}yd(){let e=this.Ir.refreshIntervalMs,t=!this.Ir.remoteRequestsDisabled&&s&&!A(e)&&e>0?e:void 0;this.Ir.idleRefreshBackoff||(this.dd=t),t!==this.hd&&(this.$d(),A(t)||(this.hd=t,this.dd=t,this.fd(),s!=null&&s.addEventListener&&(W(s,Qi,this.ln),ia(vu,e=>{W(s,e,this.pd,{capture:!0})}))))}fd(){A(this.hd)||(A(this.Id)||clearInterval(this.Id),this.vd=Date.now(),this.Id=setInterval(this.ud,this.hd))}$d(){var e;A(this.Id)||(clearInterval(this.Id),this.Id=void 0,s==null||(e=s.removeEventListener)==null||e.call(s,`visibilitychange`,this.ln),ia(vu,e=>{var t;s==null||(t=s.removeEventListener)==null||t.call(s,e,this.pd,{capture:!0})})),this.hd=void 0,this.dd=void 0,this.ld=!1,this.vd=void 0}destroy(){this.Td()}dispose(){this.Td()}Td(){var e,t;this.$d(),this.td++,this.nd=!1,this.Eh=void 0,this.mo&&=(this.Md(),(e=this._d)==null||e.dispose(),this._d=void 0,(t=this.kd)==null||t.call(this),this.kd=void 0,this.Kc=[],i?.removeEventListener(`online`,this.an),void 0)}get Ir(){return this.bo.get()}Ed(e){return this.Pd&&e in this.Pd?this.Pd[e]:this.mo?.kv.get(e)}Sd(){return!!this.Pd&&(this.Pd=void 0,!0)}Rd(){return!A(this.mo?.kv.get(`$enabled_feature_flags`))&&this.Sd()}At(e){this.Ad(()=>this.mo?.kv.set(e))}Fd(e,t,n){if(!this._instance?.persistence||!e.$enabled_feature_flags)return;let r=this.Ed(`$enabled_feature_flags`)||{},i=e.$enabled_feature_flags||{},a=t.flags||t.featureFlags,o=t.flags?Object.entries(t.flags).filter(([,e])=>!e?.failed).map(([e])=>e):[],s=!!t.errorsWhileComputingFlags&&!!t.flags,c=s?o:n&&!E(a)?Object.keys(a||{}):Array.from(new Set([...Object.keys(r),...Object.keys(i)])),l=this.Ed(`$feature_flag_payloads`)||{},u=e.$feature_flag_payloads||{},d=s||n?c:Array.from(new Set([...Object.keys(l),...Object.keys(u)])),f=!s&&!n,p=!!f||c,m=!!f||d,h={[ti]:p,[ei]:p,[ii]:m};e.$feature_flag_details&&(h[ri]=p);
1for(let t of[ai,Di,oi])A(e[t])||(h[t]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(h)}Lt(e){this.Ad(()=>this.mo?.kv.remove(e))}Ad(e){try{e()}catch(e){this.$.error(`Failed to update feature flag persistence`,e)}}xd(){let e={};for(let t of[ti,ii,ai,si]){let n=this.Ed(t);A(n)||(e[t]=n)}this.Qc=e;let t=R({},e),n=this.Ed(ei);if(n)for(let[e,r]of Object.entries(n))t[`$feature/${e}`]=r;this.Jc=t}wd(){let e=this.Ir.cacheTtlMs;if(!e||0>=e)return!1;let t=this.Ed(Di);return typeof t!=`number`||Date.now()-t>e}Od(){return!!this.wd()&&(this.rd||this.Yc||(this.rd=!0,this.$.warn(`Feature flag cache is stale, triggering refresh...`),this.reloadFeatureFlags()),!0)}Dd(){let e=this.Ir.evaluationContexts;return e?.length?e.filter(e=>{let t=e&&typeof e==`string`&&e.trim().length>0;return t||this.$.error(`Invalid evaluation context found:`,e,`Expected non-empty string`),t}):[]}Ld(){let e=this.Ir.flagKeys;if(!A(e))return e.filter(e=>{let t=e&&typeof e==`string`&&e.trim().length>0;return t||this.$.error(`Invalid flag key found:`,e,`Expected non-empty string`),t})}initialize(){let e=this.Ir,t=e.bootstrap?.featureFlags??{};if(Object.keys(t).length){let n=e.bootstrap?.featureFlagPayloads??{},r=Object.keys(t).filter(e=>!A(t[e])).reduce((e,n)=>(e[n]=t[n],e),{}),i=Object.keys(n).filter(e=>r[e]).reduce((e,t)=>(e[t]=n[t],e),{});return this.Nd({featureFlags:r,featureFlagPayloads:i},void 0,{persist:!1})}}updateFlags(e,t,n){var r,i;let a=n?.merge&&(r=this.Ed(`$enabled_feature_flags`))!=null?r:{},o=n?.merge&&(i=this.Ed(`$feature_flag_payloads`))!=null?i:{},s=R(R({},a),e),c=R(R({},o),t),l={};for(let[e,t]of Object.entries(s))l[e]={key:e,enabled:jn(t),variant:Mn(t),reason:void 0,metadata:A(c?.[e])?void 0:{id:0,version:void 0,description:void 0,payload:c[e]}};this.Nd({flags:l})}get hasLoadedFlags(){return this.Xc}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){let e=this.Ed(ri),t=this.Ed(si),n=this.Ed(ci);if(!n&&!t)return e||{};let r=U({},e||{}),i=[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])];for(let e of i){var a;let i=r[e],s=t?.[e],c=A(s)?(a=i?.enabled)!=null&&a:!!s,l=A(s)?i?.variant:typeof s==`string`?s:void 0,u=n?.[e],d=R(R({},i),{},{enabled:c,variant:c?l??i?.variant:void 0});var o;c!==i?.enabled&&(d.original_enabled=i?.enabled),l!==i?.variant&&(d.original_variant=i?.variant),u&&(d.metadata=R(R({},i?.metadata),{},{payload:u,original_payload:i==null||(o=i.metadata)==null?void 0:o.payload})),r[e]=d}return this.Zc||=(this.$.warn(` Overriding feature flag details!`,{flagDetails:e,overriddenPayloads:n,finalDetails:r}),!0),r}getAllFeatureFlags(){let e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map(n=>{let r=e[n];return{key:n,enabled:jn(r),variant:Mn(r),payload:An(t[n])}})}getFlagVariants(){let e=this.Ed(ei),t=this.Ed(si);if(!t)return e||{};let n=U({},e||{}),r=Object.keys(t);for(let e=0;r.length>e;e++)n[r[e]]=t[r[e]];return this.Zc||=(this.$.warn(` Overriding feature flags!`,{enabledFlags:e,overriddenFlags:t,finalFlags:n}),!0),n}getFlagPayloads(){let e=this.Ed(ii),t=this.Ed(ci);if(!t)return e||{};let n=U({},e||{}),r=Object.keys(t);for(let e=0;r.length>e;e++)n[r[e]]=t[r[e]];return this.Zc||=(this.$.warn(` Overriding feature flag payloads!`,{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),!0),n}reloadFeatureFlags(){this.ed||this.Ir.featureFlagsDisabled||this.ad()||(this.Yc&&(this.nd=!0),this.qd||=(this.Kc.slice().forEach(e=>{try{e()}catch(e){this.$.error(`Error while running feature flags reloading callback`,e)}}),setTimeout(()=>{this.jd()},5)))}Md(){clearTimeout(this.qd),this.qd=void 0}onReloading(e){return this.Kc.push(e),()=>{this.Kc=this.Kc.filter(t=>t!==e)}}ensureFlagsLoaded(){this.Xc||this.Yc||this.qd||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.ed=e}resetFlagCallReported(){this.Lt(wi)}jd(e){this.Md();let t=this.mo;if(!t||this.Ir.remoteRequestsDisabled||this.ad())return;if(this.Yc)return void(this.nd=!0);let n={token:t.projectToken,distinct_id:t.distinctId,groups:t.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:R(R(R({},t.initialPersonProperties),this.Ed(`$stored_person_properties`)||{}),{},{$lib:t.library.name,$lib_version:t.library.version}),group_properties:this.Ed(ui),timezone:ns()};A(t.deviceId)||(n.$device_id=t.deviceId),(e!=null&&e.disableFlags||this.Ir.featureFlagsDisabled)&&(n.disable_flags=!0);let r=this.Dd();r.length&&(n.evaluation_contexts=r);let i=this.Ld();A(i)||(n.flag_keys=i);let a=this.Ir.onlyEvaluateSurveyFeatureFlags,o=`/flags/?v=2`+(a?`&only_evaluate_survey_feature_flags=true`:``),s=this.td;this.Yc=!0;let c=()=>{this.nd&&(this.nd=!1,this.jd())},l=e=>{let t=e.json??{},r=e.statusCode!==200;if(this.Yc=!1,s!==this.td)return void c();if(this.Bd(e.statusCode),r||this.nd||(this.$anon_distinct_id=void 0),n.disable_flags&&!this.nd)return;this.sd=!r;let i=[];e.error?i.push(e.error instanceof Error&&e.error.name===`AbortError`?`timeout`:e.error instanceof Error?yu:`unknown_error`):e.statusCode!==200&&i.push(`api_error_${e.statusCode}`),t.errorsWhileComputingFlags&&i.push(`errors_while_computing_flags`);let o=!!t.quotaLimited?.includes(`feature_flags`);o&&i.push(`quota_limited`),this.At({[Ei]:i}),o?this.$.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.`):n.disable_flags||this.Nd(t,r,{partialResponse:a}),c()},u=e=>{this.Yc=!1,s===this.td?(this.At({[Ei]:[yu]}),this.$.error(`Feature flag request failed`,e),this.Rd()&&this.Cd(!0),c()):c()};try{t.sendRequest(o,{target:`flags`,method:`POST`,body:n,compression:this.Ir.compression,sentAt:`body`,timeoutMs:this.Ir.requestTimeoutMs}).then(l).catch(u)}catch(e){u(e)}}ad(){return Vo(this.od,3)}Bd(e){this.od=Ho(e,this.od,3,()=>this.$.warn(`Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes.`))}getFeatureFlag(e,t={}){if(t.fresh&&!this.sd)return;if(!(this.Xc||this.getFlags()&&this.getFlags().length>0))return void this.$.warn(`getFeatureFlag for key "`+e+_u);if(this.Od())return;let n=this.getFeatureFlagResult(e,t);return n?.variant??n?.enabled}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){return this.getFeatureFlagResult(e,{send_event:!1})?.payload}getFeatureFlagResult(e,t={}){if(t.fresh&&!this.sd)return;if(!(this.Xc||this.getFlags()&&this.getFlags().length>0))return void this.$.warn(`getFeatureFlagResult for key "`+e+_u);if(this.Od())return;let n=this.getFlagVariants(),r=e in n,i=n[e],a=this.getFlagPayloads()[e],o=String(i),s=this.Ed(`$feature_flag_request_id`)||void 0,c=this.Ed(`$feature_flag_evaluated_at`)||void 0,l,u=this.Ed(`$flag_call_reported`)||{};if(this.Ir.deduplicateCallsPerSession){let e=this.mo?.session.sessionId,t=this.Ed(Ti);e&&e!==t&&(u={},l=e)}if(t.send_event||!(`send_event`in t)){if(e in u&&u[e].includes(o))l&&this.At({[wi]:u,[Ti]:l});else{var d,f,p,m,h,g,_,v;E(u[e])?u[e].push(o):u[e]=[o],this.At(R({[wi]:u},l?{[Ti]:l}:{}));let t=this.getFeatureFlagDetails(e),n=[...this.Ed(`$feature_flag_errors`)??[]];A(i)&&n.push(`flag_missing`);let r={$feature_flag:e,$feature_flag_response:i,$feature_flag_payload:a??null,$feature_flag_request_id:s,$feature_flag_evaluated_at:c,$feature_flag_bootstrapped_response:((d=this.Ir.bootstrap)==null||(d=d.featureFlags)==null?void 0:d[e])??null,$feature_flag_bootstrapped_payload:((f=this.Ir.bootstrap)==null||(f=f.featureFlagPayloads)==null?void 0:f[e])??null,$used_bootstrap_value:!this.sd};A(t==null||(p=t.metadata)==null?void 0:p.has_experiment)||(r.$feature_flag_has_experiment=t.metadata.has_experiment),A(t==null||(m=t.metadata)==null?void 0:m.version)||(r.$feature_flag_version=t.metadata.version);let b=(t==null||(h=t.reason)==null?void 0:h.description)??(t==null||(g=t.reason)==null?void 0:g.code);var y;b&&(r.$feature_flag_reason=b),t!=null&&(_=t.metadata)!=null&&_.id&&(r.$feature_flag_id=t.metadata.id),A(t?.original_variant)&&A(t?.original_enabled)||(r.$feature_flag_original_response=A(t.original_variant)?t.original_enabled:t.original_variant),t!=null&&(v=t.metadata)!=null&&v.original_payload&&(r.$feature_flag_original_payload=t==null||(y=t.metadata)==null?void 0:y.original_payload),n.length&&(r.$feature_flag_error=n.join(`,`)),this.Hd(r)}}else l&&this.At({[wi]:u,[Ti]:l});return r?{key:e,enabled:!!i,variant:typeof i==`string`?i:void 0,payload:An(a)}:void 0}Hd(e){try{var t;(t=this.mo)==null||t.capture(`$feature_flag_called`,e)}catch(e){this.$.error(`Failed to capture feature flag call`,e)}}getRemoteConfigPayload(e,t){this.zd(e,t)}zd(e,t){var n=this;return L(function*(){let r=n.mo;if(!r)return;let i={distinct_id:r.distinctId,token:r.projectToken,person_properties:{$lib:r.library.name,$lib_version:r.library.version}},a=n.Dd();a.length&&(i.evaluation_contexts=a);let o=n.Ld(),s;A(o)||(i.flag_keys=o);try{s=(yield r.sendRequest(`/flags/?v=2`,{target:`flags`,method:`POST`,body:i,compression:n.Ir.compression,sentAt:`body`,timeoutMs:n.Ir.requestTimeoutMs})).json?.featureFlagPayloads?.[e]||void 0}catch(e){n.$.error(`Remote config feature flag request failed`,e);return}try{t(s)}catch(e){n.$.error(`Remote config feature flag callback failed`,e)}})()}isFeatureEnabled(e,t={}){if(t.fresh&&!this.sd)return t.defaultValue;if(!(this.Xc||this.getFlags()&&this.getFlags().length>
10))return this.$.warn(`isFeatureEnabled for key "`+e+_u),t.defaultValue;let n=this.getFeatureFlag(e,t);return A(n)?t.defaultValue:!!n}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t,n){this.Nd(e,t,n)}Nd(e,t,n){if(!this.mo)return;this.Xc=!0;let r=((e,t={},n={},r={},i,a=hu)=>{let o=((e,t)=>{let n=e.flags;if(n){let t=Object.fromEntries(Object.keys(n).map(e=>[e,n[e].variant??n[e].enabled])),r=Object.fromEntries(Object.keys(n).filter(e=>n[e].enabled).filter(e=>!A(n[e].metadata?.payload)).map(e=>[e,n[e].metadata?.payload]));return R(R({},e),{},{featureFlags:t,featureFlagPayloads:r})}return e.featureFlags&&t.warn(`Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version`),e})(e,a),s=o.flags,c=o.featureFlags,l=o.featureFlagPayloads;if(!c)return;let u=e.requestId,d=e.evaluatedAt;if(E(c)){a.warn(`v1 of the feature flags endpoint is deprecated. Please use the latest version.`);let e={};if(c)for(let t=0;c.length>t;t++)e[c[t]]=!0;return{[ti]:c,[ei]:e,[oi]:!1}}let f=c,p=l,m=s;if(i?.partialResponse){let e=Object.keys(f),i=p||{};f=R(R({},t),f),p=R(R({},n),i),e.forEach(e=>{e in i||p==null||delete p[e]}),m=R(R({},r),m)}else if(e.errorsWhileComputingFlags){if(s){let e=new Set(Object.keys(s).filter(e=>!s[e]?.failed));f=R(R({},t),Object.fromEntries(Object.entries(f).filter(([t])=>e.has(t))));let i=Object.fromEntries(Object.entries(p||{}).filter(([t])=>e.has(t)));p=R(R({},n),i),e.forEach(e=>{e in i||p==null||delete p[e]}),m=R(R({},r),Object.fromEntries(Object.entries(m||{}).filter(([t])=>e.has(t))))}else f=R(R({},t),f),p=R(R({},n),p),m=R(R({},r),m)}return R(R({[ti]:Object.keys(xu(f)),[ei]:f||{},[ii]:p||{},[ri]:m||{},[oi]:!0===e.minimalFlagCalledEvents},u?{[ai]:u}:{}),d?{[Di]:d}:{})})(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),n,this.$);if(r){if(!1===n?.persist){let e=!A(this.mo.kv.get(ei));this.Pd=r,e||this.At(r)}else this.Sd(),this.Fd(r,e,!!n?.partialResponse),this.At(r)}else t&&this.Rd();t||(this.rd=!1),this.Cd(t)}override(e,t=!1){this.$.warn(`override is deprecated. Please use overrideFeatureFlags instead.`),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){this.Ud(e)}Ud(e){if(this.mo){if(!1===e)return this.Lt([si,ci]),this.Cd(),void gu.info(`All overrides cleared`);if(E(e))return this.At({[si]:bu(e)}),this.Cd(),void gu.info(`Flag overrides set`,{flags:e});if(e&&typeof e==`object`&&(`flags`in e||`payloads`in e)){var t;let n=e;this.Zc=!!((t=n.suppressWarning)!=null&&t);let r={},i=n.flags,a=n.payloads;i&&(r[si]=E(i)?bu(i):i),a&&(r[ci]=a),Object.keys(r).length&&this.At(r),!1===i&&!1===a?this.Lt([si,ci]):!1===i?this.Lt(si):!1===a&&this.Lt(ci),this.Cd(),!1===i?gu.info(`Flag overrides cleared`):i&&gu.info(`Flag overrides set`,{flags:i}),!1===a?gu.info(`Payload overrides cleared`):a&&gu.info(`Payload overrides set`,{payloads:a});return}if(e&&typeof e==`object`)return this.At({[si]:e}),this.Cd(),void gu.info(`Flag overrides set`,{flags:e});this.$.warn(`Invalid overrideOptions provided to overrideFeatureFlags`,{overrideOptions:e})}else this.$.warn(`posthog.featureFlags.overrideFeatureFlags called before feature flags were ready`)}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.Xc){let{flags:t,flagVariants:n}=this.Wd();try{e(t,n)}catch(e){this.$.error(`Error while running feature flags callback`,e)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,n){var r;let i=(this.Ed(`$early_access_features`)||[]).find(t=>t.flagKey===e),a={[`$feature_enrollment/${e}`]:t},o={$feature_flag:e,$feature_enrollment:t,$set:a};i&&(o.$early_access_feature_name=i.name),n&&(o.$feature_enrollment_stage=n);let s=R(R({},this.getFlagVariants()),{},{[e]:t});(r=this._instance)==null||(r=r.persistence)==null||r.markCrossTabFeatureFlagChanges({$active_feature_flags:[e],$enabled_feature_flags:[e],$stored_person_properties:Object.keys(a)}),this.At({[ti]:Object.keys(xu(s)),[ei]:s,[li]:R(R({},this.Ed(`$stored_person_properties`)||{}),a)}),this.Cd();try{var c;(c=this.mo)==null||c.capture(`$feature_enrollment_update`,o)}catch(e){this.$.error(`Failed to capture early access feature enrollment`,e)}}getEarlyAccessFeatures(e,t=!1,n){let r=this.Ed(ni);!r||t?this.Vd(e,n):e(r)}Vd(e,t){var n=this;return L(function*(){let r=n.mo;if(!r)return;let i=t?`&${t.map(e=>`stage=${e}`).join(`&`)}`:``,a;try{let e=yield r.sendRequest(`/api/early_access_features/?token=${r.projectToken}${i}`,{target:`api`,method:`GET`,sentAt:`query`});if(!e.json)return;a=e.json.earlyAccessFeatures,n.At({[ni]:a})}catch(e){n.$.error(`Early access feature request failed`,e);return}try{e(a)}catch(e){n.$.error(`Early access feature callback failed`,e)}})()}Wd(){let e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(e=>t[e]),flagVariants:Object.keys(t).filter(e=>t[e]).reduce((e,n)=>(e[n]=t[n],e),{})}}Cd(e){this.xd();let{flags:t,flagVariants:n}=this.Wd();
1this.featureFlagEventHandlers.forEach(r=>{try{r(t,n,{errorsLoading:e})}catch(e){this.$.error(`Error while running feature flags callback`,e)}})}setPersonPropertiesForFlags(e,t=!0){this.Gd(e,t)}Gd(e,t=!0){let n=this.Ed(`$stored_person_properties`)||{},r=e?.$set||(e?.$set_once?{}:e),i=e?.$set_once,a={};if(i)for(let e in i)({}).hasOwnProperty.call(i,e)&&(e in n||(a[e]=i[e]));this.At({[li]:R(R(R({},n),a),r)}),t&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t=!0){let n=R({},this.Ed(`$stored_person_properties`)||{});e.forEach(e=>{delete n[e]}),this.At({[li]:n}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e=!0){this.Lt(li),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t=!0){let n=this.Ed(`$stored_group_properties`)||{},r=R({},n);for(let t of Object.keys(e))r[t]=R(R({},n[t]),e[t]);this.At({[ui]:r}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){let t=this.Ed(`$stored_group_properties`)||{};this.At({[ui]:R(R({},t),{},{[e]:{}})})}else this.Lt(ui)}reset(){this.td++,this.nd=!1,this.Qc={},this.Jc={},this.Pd=void 0,this.Xc=!1,this.ed=!1,this.sd=!1,this.$anon_distinct_id=void 0,this.Md(),this.Zc=!1,this.od=0}}},Ju={sessionRecording:class{get Ir(){return this._instance.config}get Ca(){return this._instance.persistence}get started(){return!!this.Zd?.isStarted}get status(){return this.Qd===`awaiting_config`||this.Qd===`missing_config`?this.Qd:this.Zd?.status??this.Qd}constructor(e){if(this._instance=e,this._forceAllowLocalhostNetworkCapture=!1,this.Qd=Wl,this.Jd=void 0,this.Kd=!1,this.Xe=(()=>{var e,t;if(!s?.visibilityState||s.visibilityState===`visible`)return!0;let n=i==null||(e=i.performance)==null||(t=e.getEntriesByType)==null?void 0:t.call(e,`visibility-state`);return!n?.length||n.some(e=>e.name===`visible`)})(),this.ln=()=>{var e,t;s?.visibilityState===`visible`&&(this.Xe=!0,(e=this.Zd)==null||(t=e.setDocumentWasEverVisible)==null||t.call(e,!0))},!this._instance.sessionManager)throw Kl.error(`started without valid sessionManager`),Error(`[SessionRecording] started without valid sessionManager. This is a bug.`);if(this.Ir.cookieless_mode===`always`)throw Error(`[SessionRecording] cannot be used with cookieless_mode="always"`);s!=null&&s.addEventListener&&W(s,`visibilitychange`,this.ln)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:e=!1}={}){var t;this.Kd=!0,s==null||(t=s.removeEventListener)==null||t.call(s,`visibilitychange`,this.ln),e?this.Xd(!0):this.stopRecording()}get Yd(){let e=!!this._instance.get_property(`$session_recording_remote_config`)?.enabled,t=!this.Ir.disable_session_recording,n=this.Ir.disable_session_recording||this._instance.consent.isOptedOut();return i&&e&&t&&!n}startIfEnabledOrStop(e){if(this.Kd||this.Yd&&this.Zd?.isStarted)return;let t=!A(Object.assign)&&!A(Array.from);this.Yd&&t?(this.tv(e),Kl.info(`starting`)):(this.Qd=Wl,this.stopRecording())}tv(e){var t;if(this.Yd){if(this.Qd!==`awaiting_config`&&this.Qd!==`missing_config`&&(this.Qd=Gl),g!=null&&(t=g.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&g.__PosthogExtensions__?.initSessionRecording)this.ev(e);else{var n,r;let t=this._instance.sessionManager;(n=g.__PosthogExtensions__)==null||(r=n.loadExternalDependency)==null||r.call(n,this._instance,this.iv,n=>{if(!this.Kd&&this.Yd&&this._instance.sessionManager===t)return n?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),Kl.error(`could not load recorder`,n)):void this.ev(e);this.Qd=`disabled`})}}}stopRecording(){var e,t;(e=this.Jd)==null||e.call(this),this.Jd=void 0,(t=this.Zd)==null||t.stop()}Xd(e=!1){var t,n;(t=this.Jd)==null||t.call(this),this.Jd=void 0,(n=this.Zd)==null||n.discard({discardProducerEvents:e})}nv(){var e,t;(e=this.Ca)==null||e.unregister(`$session_is_sampled`),(t=this.Ca)==null||t.unregister(`$replay_sample_rate`)}sv(e,t){if(N(e))return null;let n=P(e)?e:parseFloat(e);return typeof(r=n)!=`number`||!Number.isFinite(r)||0>r||r>1?(Kl.warn(`${t} must be between 0 and 1. Ignoring invalid value:`,e),null):n;var r}rv(e){if(this.Ca){var t;let n=this.Ca,r=()=>{let t=!1===e.sessionRecording?void 0:e.sessionRecording,r=this.sv(this.Ir.session_recording?.sampleRate,`session_recording.sampleRate`),i=this.sv(t?.sampleRate,`remote config sampleRate`),a=r??i;N(a)&&this.nv();let o=t?.minimumDurationMilliseconds;n.register({[Br]:R(R({cache_timestamp:Date.now(),enabled:!!t},t),{},{networkPayloadCapture:R({capturePerformance:e.capturePerformance},t?.networkPayloadCapture),canvasRecording:{enabled:t?.recordCanvas,fps:t?.canvasFps,quality:t?.canvasQuality}
1,sampleRate:a,minimumDurationMilliseconds:A(o)?null:o,endpoint:t?.endpoint,triggerMatchType:t?.triggerMatchType,masking:t?.masking,urlTriggers:t?.urlTriggers,version:t?.version,triggerGroups:t?.triggerGroups})})};r(),(t=this.Jd)==null||t.call(this),this.Jd=this._instance.sessionManager?.onSessionId(r)}}onRemoteConfig(e){let t=e.ok?e.config:void 0;t&&`sessionRecording`in t?!1===t.sessionRecording?(this.rv(t),this.Xd()):(this.rv(t),this.startIfEnabledOrStop()):(this.Qd===`awaiting_config`&&(this.Qd=`missing_config`,Kl.warn(`config refresh failed, recording will not start until page reload`)),this.startIfEnabledOrStop())}log(e,t=`log`){this.Zd?.log?this.Zd.log(e,t):Kl.warn(`log called before recorder was ready`)}get iv(){var e,t;let n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(Br);return(n==null||(t=n.scriptConfig)==null?void 0:t.script)||`lazy-recorder`}ov(){let e=this._instance.get_property(Br);if(!e)return!1;let t;try{t=typeof e==`object`?e:JSON.parse(e)}catch(e){return Kl.warn(`persisted remote config for session recording is invalid and will be ignored`,e),!1}return!N(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}ev(e){var t,n;if(!this.Kd&&this.Yd&&this._instance.sessionManager){if(!g.__PosthogExtensions__?.initSessionRecording)return Kl.warn(`Called on script loaded before session recording is available. This can be caused by adblockers.`),void this._instance.register_for_session({[zi]:!0});if(this.Zd||(this.Zd=g.__PosthogExtensions__?.initSessionRecording(this._instance,this.Xe),this.Zd._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.ov()){if(this.Qd===`missing_config`||this.Qd===`awaiting_config`)return;this.Qd=`awaiting_config`,Kl.info(`persisted remote config is stale, requesting fresh config before starting`),new Os(this._instance).load();return}this.Qd=Gl,(t=(n=this.Zd).setDocumentWasEverVisible)==null||t.call(n,this.Xe),this.Zd.start(e)}else this.Qd=Wl}onRRwebEmit(e){var t,n;(t=this.Zd)==null||(n=t.onRRwebEmit)==null||n.call(t,e)}overrideLinkedFlag(){var e,t;this.Zd||(t=this.Ca)==null||t.register({$replay_override_linked_flag:!0}),(e=this.Zd)==null||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.Zd||(t=this.Ca)==null||t.register({$replay_override_sampling:!0}),(e=this.Zd)==null||e.overrideSampling()}overrideTrigger(e){var t,n;this.Zd||(n=this.Ca)==null||n.register({[e===`url`?`$replay_override_url_trigger`:`$replay_override_event_trigger`]:!0}),(t=this.Zd)==null||t.overrideTrigger(e)}get sdkDebugProperties(){return this.Zd?.sdkDebugProperties||{$recording_status:this.status}}tryAddCustomEvent(e,t){return!!this.Zd?.tryAddCustomEvent(e,t)}flushBeforeIdentityReset(){var e,t;(e=this.Zd)==null||(t=e.flushBeforeIdentityReset)==null||t.call(e)}}},Yu={autocapture:class extends Ml{constructor(e){super(new Nl(e)),this.instance=e}},historyAutocapture:class{constructor(e){this._instance=e,this.lv=this.av()}initialize(){this.startIfEnabled()}get isEnabled(){let e=this.uv();return!!(e.path||e.search||this.hv(e))}startIfEnabled(){this.isEnabled&&(z.info(`History API monitoring enabled, starting...`),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.lv=this.av(),this.startIfEnabled()}stop(){this.dv&&this.dv(),this.dv=void 0,this.vv&&this.vv(),this.vv=void 0,z.info(`History API monitoring stopped`)}monitorHistoryChanges(){i&&i.history&&(this.fv(`pushState`),this.fv(`replaceState`),this.pv(),this.hv()&&this.gv())}fv(e){if(!i||i.history[e]?.__posthog_wrapped__)return;let t=this;Ll(i.history,e,n=>function(r,i,a){n.call(this,r,i,a),t.mv(e)})}av(){let e=i?.location;if(e?.pathname)return{pathname:e.pathname,search:e.search,hash:e.hash}}uv(){let e=this._instance.config.capture_pageview;return e===`history_change`?{path:!0}:O(e)?e:{}}hv(e=this.uv()){return!!e.hash&&!this._instance.config.disable_capture_url_hashes}yv(e){let t=this.uv(),n=this.lv;return!(!n||!(t.path&&e.pathname!==n.pathname||t.search&&e.search!==n.search||this.hv(t)&&e.hash!==n.hash))}mv(e){try{let t=this.av();if(!t)return;this.yv(t)&&this._instance.capture(ea,{navigation_type:e}),this.lv=t}catch(t){z.error(`Error capturing ${e} pageview`,t)}}
1pv(){if(this.dv)return;let e=()=>{this.mv(`popstate`)};W(i,`popstate`,e),this.dv=()=>{i&&i.removeEventListener(`popstate`,e)}}gv(){if(this.vv)return;let e=()=>{this.mv(`hashchange`)};W(i,`hashchange`,e),this.vv=()=>{i&&i.removeEventListener(`hashchange`,e)}}},heatmaps:class{get Ir(){return this.instance.config}constructor(e){this.bv=!1,this._o=!1,this._v=null,this.instance=e,this.bv=!!this.instance.persistence?.props[jr],this.rageclicks=new El(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let e=5e3;return O(this.Ir.capture_heatmaps)&&this.Ir.capture_heatmaps.flush_interval_milliseconds&&(e=this.Ir.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return N(this.Ir.capture_heatmaps)?N(this.Ir.enable_heatmaps)?this.bv:this.Ir.enable_heatmaps:!1!==this.Ir.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this._o)return;ql.info(`starting...`),this.wv(),this.ln()}else clearInterval(this._v??void 0),this.Sv(),this.getAndClearBuffer()}onRemoteConfig(e){if(!e.ok)return;let t=e.config;if(!(`heatmaps`in t))return;let n=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[jr]:n}),this.bv=n,this.startIfEnabled()}getAndClearBuffer(){let e=this.Rt;return this.Rt=void 0,e}xv(e){Jl(e.originalEvent)&&this.Mr(e.originalEvent,`deadclick`)}ln(){this._v&&clearInterval(this._v),this._v=s?.visibilityState===`visible`?setInterval(this.pa.bind(this),this.flushIntervalMilliseconds):null}wv(){i&&s&&(this.Cv=this.pa.bind(this),W(i,$i,this.Cv),this.$v=e=>this.Mr(e||i?.event),W(s,`click`,this.$v,{capture:!0}),this.Iv=e=>this.Tv(e||i?.event),W(s,`mousemove`,this.Iv,{capture:!0}),this.Mv=new Eo(this.instance,wo,this.xv.bind(this)),this.Mv.startIfEnabledOrStop(),this.Ev=this.ln.bind(this),W(s,Qi,this.Ev),this._o=!0)}Sv(){var e;i&&s&&(this.Cv&&i.removeEventListener($i,this.Cv),this.$v&&s.removeEventListener(`click`,this.$v,{capture:!0}),this.Iv&&s.removeEventListener(`mousemove`,this.Iv,{capture:!0}),this.Ev&&s.removeEventListener(Qi,this.Ev),clearTimeout(this.Pv),(e=this.Mv)==null||e.stop(),this._o=!1)}Rv(e,t){let n=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),a=this.instance.scrollManager.scrollElement(),o=function(e,t,n){let r=e;for(;r&&Ba(r)&&!J(r,`body`);){if(r===n)return!1;let e;try{e=(r.ownerDocument?.defaultView??i)?.getComputedStyle(r).position}catch{return!1}if(C(t,e))return!0;r=Qa(r)}return!1}(Ja(e),[`fixed`,`sticky`],a);return{x:e.clientX+(o?0:r),y:e.clientY+(o?0:n),target_fixed:o,type:t}}Mr(e,t=`click`){var n;if(za(e.target)||!Jl(e))return;let r=this.Rv(e,t);(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&ao(Ja(e),this.instance.config.rageclick)&&this.Zs(R(R({},r),{},{type:`rageclick`})),this.Zs(r)}Tv(e){!za(e.target)&&Jl(e)&&(clearTimeout(this.Pv),this.Pv=setTimeout(()=>{this.Zs(this.Rv(e,`mousemove`))},500))}Zs(e){if(!i)return;let t=this.Ir.disable_capture_url_hashes?Mt(i.location.href):i.location.href,n=this.Ir.custom_personal_data_properties,r=zo(t,this.Ir.mask_personal_data_properties?[...Uo,...n||[]]:[],Go);this.Rt=this.Rt||{},this.Rt[r]||(this.Rt[r]=[]),this.Rt[r].push(e)}pa(){this.Rt&&!k(this.Rt)&&this.instance.capture(`$$heatmap`,{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Eo,webVitalsAutocapture:class{constructor(e){this._instance=e,this.bv=!1,this._o=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Av=()=>{clearTimeout(this.Fv),this.Fv=void 0,this.Rt.metrics.length!==0&&(this._instance.capture(`$web_vitals`,R({$current_url:this.Rt.url},this.Rt.metrics.reduce((e,t)=>R(R({},e),{},{[`$web_vitals_${t.name}_event`]:R({},t),[`$web_vitals_${t.name}_value`]:t.value}),{}))),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Ov=e=>{if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},N(e?.name)||N(e?.value))return void zl.error(`Invalid metric received`,e);let t=typeof e.navigationURL==`string`?e.navigationURL:void 0,n=this.Dv(t);if(A(n))return;let r=P(e.navigationId)||typeof e.navigationId==`string`?`navigation:${e.navigationId}`:`url:${n}`;if(this.Lv&&e.value>=this.Lv)return void zl.error(`Ignoring metric with value >= `+this.Lv,e);
1this.Rt.navigationKey!==r&&(this.Av(),this.Fv=setTimeout(this.Av,this.flushToCaptureTimeoutMs)),A(this.Rt.navigationKey)&&(this.Rt.navigationKey=r,this.Rt.url=n),this.Rt.firstMetricTimestamp=A(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;let i=this._instance.sessionManager?.checkAndGetSessionAndWindowId(!0),a=R(R(R({},e),t?{navigationURL:n}:{}),{},{$current_url:n,timestamp:Date.now()});if(delete a.entries,O(e.attribution)&&this.attributionMetrics.indexOf(e.name)>-1){let t={};for(let n of Ul){let r=n===`url`&&typeof e.attribution[n]==`string`?this.Dv(e.attribution[n]):e.attribution[n];A(r)||(t[n]=r)}a.attribution=t}else delete a.attribution;A(i)||(a.$session_id=i.sessionId,a.$window_id=i.windowId),this.Rt.metrics.push(a),this.Rt.metrics.length===this.allowedMetrics.length&&this.Av()},this.Nv=()=>{if(this._o)return;let e,t,n,r,i=!1,a=g.__PosthogExtensions__,o=a?.postHogWebVitalsCallbacksByFlavor,s=o?.[this.qv]||(this.qv===`web-vitals`&&A(o)?a?.postHogWebVitalsCallbacks:void 0);if(!A(s)){let a=s.withoutAttribution,o=this.attributionMetrics;i=!A(a),e=o.indexOf(`LCP`)>-1?s.onLCP:a?.onLCP||s.onLCP,t=o.indexOf(`CLS`)>-1?s.onCLS:a?.onCLS||s.onCLS,n=o.indexOf(`FCP`)>-1?s.onFCP:a?.onFCP||s.onFCP,r=o.indexOf(`INP`)>-1?s.onINP:a?.onINP||s.onINP}if(!(e&&t&&n&&r))return void zl.error(`web vitals callbacks not loaded - not starting`);let c={reportSoftNavs:this.useSoftNavs},l=i&&this.attributionMetrics.indexOf(`INP`)>-1?R(R({},c),{},{includeProcessedEventEntries:!1}):c;this.allowedMetrics.indexOf(`LCP`)>-1&&e(this.Ov.bind(this),c),this.allowedMetrics.indexOf(`CLS`)>-1&&t(this.Ov.bind(this),c),this.allowedMetrics.indexOf(`FCP`)>-1&&n(this.Ov.bind(this),c),this.allowedMetrics.indexOf(`INP`)>-1&&r(this.Ov.bind(this),l),this._o=!0},this.bv=!!this._instance.persistence?.props[Fr],this.startIfEnabled()}get jv(){return this._instance.config.capture_performance}get allowedMetrics(){let e=O(this.jv)?this.jv?.web_vitals_allowed_metrics:void 0;return N(e)?this._instance.persistence?.props.$web_vitals_allowed_metrics||Vl:e}get flushToCaptureTimeoutMs(){return(O(this.jv)?this.jv.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){let e=O(this.jv)?this.jv.web_vitals_attribution:void 0;return I(e)?e?Vl:[]:E(e)?e:Hl}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){let e=O(this.jv)?this.jv.__preview_web_vitals_soft_navs:void 0;return e!=null&&e}get Lv(){let e=O(this.jv)&&P(this.jv.__web_vitals_max_value)?this.jv.__web_vitals_max_value:Bl;return e>0&&6e4>=e?Bl:e}get isEnabled(){let e=c?.protocol;if(e!==`http:`&&e!==`https:`)return zl.info(`Web Vitals are disabled on non-http/https protocols`),!1;let t=O(this.jv)?this.jv.web_vitals:I(this.jv)?this.jv:void 0;return I(t)?t:this.bv}startIfEnabled(){this.isEnabled&&!this._o&&(zl.info(`enabled, starting...`),this.qo(this.Nv))}onRemoteConfig(e){if(!e.ok)return;let t=e.config;if(!(`capturePerformance`in t))return;let n=O(t.capturePerformance)&&!!t.capturePerformance.web_vitals,r=O(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Fr]:n}),this._instance.persistence.register({[zr]:r})),this.bv=n,this.startIfEnabled()}get qv(){return this.useSoftNavs?this.useAttribution?`web-vitals-with-attribution-soft-navs`:`web-vitals-soft-navs`:this.useAttribution?`web-vitals-with-attribution`:`web-vitals`}qo(e){var t;let n=g.__PosthogExtensions__,r=this.qv,i=n?.postHogWebVitalsCallbacksByFlavor;i?.[r]||r===`web-vitals`&&A(i)&&n?.postHogWebVitalsCallbacks?e():n==null||(t=n.loadExternalDependency)==null||t.call(n,this._instance,r,t=>{t?zl.error(`failed to load script`,t):e()})}Dv(e){let t=e||i?.location.href;if(!t)return void zl.error(`Could not determine current URL`);let n=this._instance.config.disable_capture_url_hashes?Mt(t):t,r=this._instance.config.custom_personal_data_properties;return zo(n,this._instance.config.mask_personal_data_properties?[...Uo,...r||[]]:[],Go)}}},Xu={exceptionObserver:class{constructor(e){this.Nv=()=>{if(!i||!this.isEnabled||!g.__PosthogExtensions__?.errorWrappingFunctions)return;let e=g.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,t=g.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,n=g.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Bv&&this.Ir.capture_unhandled_errors&&(this.Bv=e(this.captureException.bind(this))),!this.Hv&&this.Ir.capture_unhandled_rejections&&(this.Hv=t(this.captureException.bind(this))),!this.zv&&this.Ir.capture_console_errors&&(this.zv=n(this.captureException.bind(this)))}catch(e){Pl.error(`failed to start`,e),this.Uv()}},this._instance=e,this.Wv=!!this._instance.persistence?.props[Mr],this.wt=new ye(R(R({},function(e={}){return{refillRate:e.exceptionRateLimiterRefillRate??e.__exceptionRateLimiterRefillRate??1,bucketSize:e.exceptionRateLimiterBucketSize??e.__exceptionRateLimiterBucketSize??10}}(this._instance.config.error_tracking)),{},{refillInterval:1e4,$:Pl})),this.Ir=this.Vv(),this.startIfEnabledOrStop()}Vv(){let e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return O(e)?t=R(R({},t),e):(A(e)?this.Wv:e)&&(t=R(R({},t),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.Ir.capture_console_errors||this.Ir.capture_unhandled_errors||this.Ir.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Pl.info(`enabled`),this.Uv(),this.qo(this.Nv)):this.Uv()}qo(e){var t,n;g.__PosthogExtensions__?.errorWrappingFunctions?e():(t=g.__PosthogExtensions__)==null||(n=t.loadExternalDependency)==null||n.call(t,this._instance,`exception-autocapture`,t=>{if(t)return Pl.error(`failed to load script`,t);
1e()})}Uv(){var e,t,n;(e=this.Bv)==null||e.call(this),this.Bv=void 0,(t=this.Hv)==null||t.call(this),this.Hv=void 0,(n=this.zv)==null||n.call(this),this.zv=void 0}onRemoteConfig(e){if(!e.ok)return;let t=e.config;`autocaptureExceptions`in t&&(this.Wv=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Mr]:this.Wv}),this.Ir=this.Vv(),this.startIfEnabledOrStop())}onConfigChange(){this.Ir=this.Vv()}captureException(e){try{var t,n;let r=(e==null||(t=e.$exception_list)==null||(t=t[0])==null?void 0:t.type)??`Exception`;if(this.wt.consumeRateLimit(r))return void Pl.info(`Skipping exception capture because of client rate limiting.`,{exception:r});(n=this._instance.exceptions)==null||n.sendExceptionEvent(e)}catch{}}},exceptions:class{constructor(e){this.Gv=[],this.Zv=new Wt([new fn,new Sn,new mn,new pn,new bn,new yn,new gn,new xn],function(e,...t){return(n,r=0)=>{let i=[],a=n.split(`
2`),o=Math.min(a.length,r+1e3),s=[];for(let n=r;o>n;n++){let r=a[n];if(r.length>1024)continue;let o=rn.test(r)?r.replace(rn,`$1`):r;if(!o.match(/\S*Error: /)){for(let n of t){let t=n(o,e);if(t){i.push(t);let e=on(i);if(e){for(let t=s.length-1;t>=0;t--){let n=s[t];if(e.start>=n.start+n.length)break;s.pop()}s.push(e)}break}}if(un(i,s)>=50)break}}let c=[...s].sort((e,t)=>t.start-e.start),l=c[c.length-1];if(l){let e=cn(i,l);i.splice(l.start-e,e);for(let t of c)t.start-=e}for(let e of c)sn(i,e);return s.some(e=>e.start===0&&i.length===e.length)&&function(e){let t=e.map(e=>`${e.function}|${e.filename}|${e.lineno}|${e.colno}|${e.module}`),n=0;for(let e=1;t.length>e;e++)dn(t,e,n)&&(n=e);e.push(...e.splice(0,n))}(i),function(e){if(!e.length)return[];let t=Array.from(e);return t.reverse(),t.slice(0,50).map(e=>{return R(R({},e),{},{filename:e.filename||(n=t,n[n.length-1]||{}).filename,function:e.function||`?`});var n})}(i)}}(`web:javascript`,$t,nn)),this._instance=e,this.Gv=this._instance.persistence?.get_property(`$error_tracking_suppression_rules`)??[],this.Qv=Dn(this.Jv()),this.Kv=new On(this.Qv)}onConfigChange(){this.Qv=Dn(this.Jv()),this.Kv.setConfig(this.Qv)}onRemoteConfig(e){if(!e.ok)return;let t=e.config;if(!(`errorTracking`in t))return;let n=t.errorTracking?.suppressionRules??[],r=t.errorTracking?.captureExtensionExceptions;this.Gv=n,this._instance.persistence&&this._instance.persistence.register({[Nr]:this.Gv,[Pr]:r})}get Xv(){var e;let t=!!this._instance.get_property(Pr);return(e=this._instance.config.error_tracking.captureExtensionExceptions??t)!=null&&e}buildProperties(e,t){return this.Zv.buildFromUnknown(e,{syntheticException:t?.syntheticException,mechanism:{handled:t?.handled}})}addExceptionStep(e,t){if(this.Qv.enabled)try{if(!j(e)||e.trim().length===0)return void Cu.warn(`Ignoring exception step because message must be a non-empty string`);let{sanitizedProperties:n,droppedKeys:r}=function(e){if(!e)return{sanitizedProperties:{},droppedKeys:[]};let t=[];return{sanitizedProperties:Object.keys(e).reduce((n,r)=>Tn.has(r)?(t.push(r),n):(n[r]=e[r],n),{}),droppedKeys:t}}(this.Yv(t));r.length>0&&Cu.warn(`Ignoring reserved exception step fields`,{droppedKeys:r}),this.Kv.add(R({[Cn]:e,[wn]:new Date().toISOString()},n))}catch(e){Cu.error(`Failed to add exception step. Ignoring breadcrumb.`,e)}}sendExceptionEvent(e){try{let t=e.$exception_list;if(this.tf(t)){if(this.ef(t))return this.if(`Exception dropped: matched a suppression rule`),void Cu.info(`Skipping exception capture because a suppression rule matched`);if(!this.Xv&&this.nf(t))return this.if(`Exception dropped: thrown by a browser extension`),void Cu.info(`Skipping exception capture because it was thrown by an extension`);if(!this.Xv&&this.sf(t))return this.if(`Exception dropped: thrown by an injected browser script`),void Cu.info(`Skipping exception capture because it was thrown by an injected browser script`);if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.rf(t))return this.if(`Exception dropped: thrown by the PostHog SDK`),void Cu.info(`Skipping exception capture because it was thrown by the PostHog SDK`)}let n=this.Qv.enabled&&N(e.$exception_steps)?this.lf(e):e,r=function(){let e=globalThis._posthogReleaseId;return typeof e==`string`&&e.length>0?e:void 0}();r&&(n.$release_id=r);try{let e=this._instance.capture(`$exception`,n,{_noTruncate:!0,_batchKey:`exceptionEvent`,ah:!0});return e&&this.Kv.clear(),e}catch(e){Su(e)||Cu.error(`Failed to capture exception event. Dropping this exception.`,e),this.Kv.clear();return}}catch(e){Su(e)||Cu.error(`Failed to process exception event. Ignoring this exception.`,e);return}}lf(e){try{let t=this.Kv.getAttachable();return t.length===0?e:R(R({},e),{},{$exception_steps:t})}catch(t){return Cu.error(`Failed to read buffered exception steps. Capturing exception without steps.`,t),e}}if(e){this.Qv.enabled&&this.Kv.add({[Cn]:e,[wn]:new Date().toISOString()})}Yv(e){return O(e)?R({},e):{}}Jv(){return this._instance.config.error_tracking?.exception_steps??{}}ef(e){if(e.length===0)return!1;try{let t=e.reduce((e,{type:t,value:n})=>(j(t)&&t.length>0&&e.$exception_types.push(t),j(n)&&n.length>0&&e.$exception_values.push(n),e),{$exception_types:[],$exception_values:[]});return this.Gv.some(e=>{let n=e.values.map(e=>{let n=Wc[e.operator],r=t[e.key];if(!n||!r)return!1;let i=E(e.value)?e.value:[e.value];return i.length>0&&n(i,r)});return e.type===`OR`?n.some(Boolean):n.every(Boolean)})}catch(e){return Cu.warn(`Failed to evaluate suppression rules. Capturing the exception.`,e),!1}}nf(e){let t=e.flatMap(e=>e.stacktrace?.frames??[]),n=t.filter(({filename:e})=>!!e&&Eu.some(t=>e.startsWith(t)));return n.length!==0&&(!n.every(({filename:e})=>!!e&&e.startsWith(wu))||e.some(({type:e,value:t})=>e===`NoResponse`||j(t)&&Tu.some(({value:e,exact:n})=>n?t===e:t.includes(e)))&&!t.some(({in_app:e,filename:t})=>e&&!t?.startsWith(wu)))}sf(e){return e.some(({value:e})=>j(e)&&Du.some(t=>e.includes(t)))}rf(e){if(e.length>0){var t,n;let r=e[0].stacktrace?.frames??[],i=r[r.length-1];return(t=i==null||(n=i.filename)==null?void 0:n.includes(`posthog.com/static`))!=null&&t}return!1}tf(e){return!N(e)&&E(e)}}},Zu=R({productTours:class{get Ca(){return this._instance.persistence}constructor(e){this.af=null,this.uf=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!e.ok)return;let t=e.config;if(`productTours`in t){var n;if(this.Ca&&this.Ca.register({[Lr]:!!t.productTours}),!Xl(this._instance))return!this.af&&N(this.Ca?.props.ph_product_tours)||Yl.info(`product tours disabled; stopping and clearing cached tours`),(n=this.af)==null||n.stop(),this.af=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.af&&Xl(this._instance)&&this.qo(()=>this.hf())}qo(e){var t,n;g.__PosthogExtensions__?.generateProductTours?e():(t=g.__PosthogExtensions__)==null||(n=t.loadExternalDependency)==null||n.call(t,this._instance,`product-tours`,t=>{t?Yl.error(`Could not load product tours script`,t):e()})}hf(){var e;!this.af&&(e=g.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.af=g.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t=!1){if(E(this.uf)&&!t)return void e(this.uf,{isLoaded:!0});let n=this.Ca;if(n){let r=n.props[_i];if(E(r)&&!t)return this.uf=r,void e(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:t=>{if(!Xl(this._instance))return void e([],{isLoaded:!0});let r=t.statusCode;if(r!==200||!t.json){let n=`Product Tours API could not be loaded, status: ${r}`;r===0?t.error||Yl.warn(n):Yl.error(n),e([],{isLoaded:!1,error:n});return}let i=E(t.json.product_tours)?t.json.product_tours:[];this.uf=i,n&&n.register({[_i]:i}),e(i,{isLoaded:!0})}})}getActiveProductTours(e){N(this.af)?e([],{isLoaded:!1,error:`Product tours not loaded`}):this.af.getActiveProductTours(e)}showProductTour(e){var t;(t=this.af)==null||t.showTourById(e)}previewTour(e){this.af?this.af.previewTour(e):this.qo(()=>{var t;this.hf(),(t=this.af)==null||t.previewTour(e)})}dismissProductTour(){var e;(e=this.af)==null||e.dismissTour(`user_clicked_skip`)}nextStep(){var e;(e=this.af)==null||e.nextStep()}previousStep(){var e;(e=this.af)==null||e.previousStep()}clearCache(){var e;this.uf=null,(e=this.Ca)==null||e.unregister(`ph_product_tours`)}resetTour(e){var t;(t=this.af)==null||t.resetTour(e)}resetAllTours(){var e;(e=this.af)==null||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.af)==null||t.cancelPendingTour(e)}}},qu),Qu={siteApps:class{constructor(e){this._instance=e,this.cf=0,this.df=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}vf(e,t){if(!t)return;let n=this.globalsForEvent(t);this.df.push(n),this.df.length>1e3&&(this.df=this.df.slice(10))}get siteAppLoaders(){var e;return(e=g._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}initialize(){if(this.isEnabled){let e=this._instance._addCaptureHook(this.vf.bind(this));this.ff=()=>{e(),this.df=[],this.ff=void 0}}}globalsForEvent(e){if(!e)throw Error(`Event payload is required`);let t={},n=this._instance.get_property(`$groups`)||[],r=this._instance.get_property(`$stored_group_properties`)||{};for(let[e,i]of Object.entries(r))t[e]={id:n[e],type:e,properties:i};let{$set_once:i,$set:a}=e;return{event:R(R({},Un(e,Zl)),{},{properties:R(R(R({},e.properties),a?{$set:R(R({},e.properties?.$set??{}),a)}:{}),i?{$set_once:R(R({},e.properties?.$set_once??{}),i)}:{}),elements_chain:e.properties?.$elements_chain??``,distinct_id:e.properties?.distinct_id}),person:{properties:this._instance.get_property(`$stored_person_properties`)},groups:t}}pf(e){let t=e.tagName?.toLowerCase();
2return t===`style`&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||(Ql.error(`prepare_external_dependency_stylesheet returned null`),null):t===`script`&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(e)||(Ql.error(`prepare_external_dependency_script returned null`),null):e}gf(){var e;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};let t=s?.defaultView,n=t==null||(e=t.Node)==null?void 0:e.prototype;if(!t||!n)return()=>{};if(this.cf++,this.mf)return this.yf();let r=[],i=this,a=new WeakSet,o=(e,t,n)=>{if(!e?.[t])return;let i=e[t];e[t]=n(i),r.push(()=>{e[t]=i})},c=e=>{if(a.has(e))return e;let t=i.pf(e);return t&&a.add(t),t},l=e=>e.map(e=>typeof e==`string`?e:c(e)).filter(e=>!M(e));return o(n,`appendChild`,e=>function(t){let n=c(t);return n?e.call(this,n):t}),o(n,`insertBefore`,e=>function(t,n){let r=c(t);return r?e.call(this,r,n):t}),o(n,`replaceChild`,e=>function(t,n){let r=c(t);return r?e.call(this,r,n):n}),[t.Element?.prototype,t.Document?.prototype,t.DocumentFragment?.prototype].forEach(e=>{o(e,`append`,e=>function(...t){return e.apply(this,l(t))}),o(e,`prepend`,e=>function(...t){return e.apply(this,l(t))})}),[t.Element?.prototype,t.CharacterData?.prototype,t.DocumentType?.prototype].forEach(e=>{o(e,`before`,e=>function(...t){return e.apply(this,l(t))}),o(e,`after`,e=>function(...t){return e.apply(this,l(t))}),o(e,`replaceWith`,e=>function(...t){let n=l(t);return t.length&&!n.length?void 0:e.apply(this,n)})}),o(t.Element?.prototype,`insertAdjacentElement`,e=>function(t,n){let r=c(n);return r?e.call(this,t,r):null}),this.mf=()=>{r.forEach(e=>e()),this.mf=void 0},this.yf()}yf(){let e=!1;return()=>{var t;e||(e=!0,this.cf--,this.cf===0&&((t=this.mf)==null||t.call(this)))}}bf(e,t=!0){let n=this.gf();try{let r=e(n);return t&&n(),r}catch(e){throw n(),e}}setupSiteApp(e){let t=this.apps[e.id],n=()=>{var n;!t.errored&&this.df.length&&(Ql.info(`Processing ${this.df.length} events for site app with id ${e.id}`),this.df.forEach(e=>this.bf(()=>t.processEvent?.call(t,e))),t.processedBuffer=!0),Object.values(this.apps).every(e=>e.processedBuffer||e.errored)&&((n=this.ff)==null||n.call(this))},r=!1,i=i=>{t.errored=!i,t.loaded=!0,Ql.info(`Site app with id ${e.id} ${i?`loaded`:`errored`}`),r&&n()};try{let{processEvent:n}=this.bf(t=>e.init({posthog:this._instance,callback(e){t(),i(e)}}),!1);n&&(t.processEvent=n),r=!0}catch(t){Ql.error($l+e.id,t),i(!1)}if(r&&t.loaded)try{n()}catch(n){Ql.error(`Error while processing buffered events PostHog app with config id ${e.id}`,n),t.errored=!0}}_f(){let e=this.siteAppLoaders||[];for(let t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(let t of e)this.setupSiteApp(t)}wf(e){if(Object.keys(this.apps).length===0)return;let t=this.globalsForEvent(e);for(let n of Object.values(this.apps))try{this.bf(()=>n.processEvent?.call(n,t))}catch(t){Ql.error(`Error while processing event ${e.event} for site app ${n.id}`,t)}}onRemoteConfig(e){var t;if(this.siteAppLoaders?.length)return this.isEnabled?(this._f(),void this._instance.on(`eventCaptured`,e=>this.wf(e))):void Ql.error(`PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.`);if((t=this.ff)==null||t.call(this),!e.ok)return;let n=e.config;if(n.siteApps?.length){if(this.isEnabled)for(let{id:e,url:t}of n.siteApps){var r,i;g[`__$$ph_site_app_${e}`]=this._instance,(r=g.__PosthogExtensions__)==null||(i=r.loadSiteApp)==null||i.call(r,this._instance,t,t=>{if(t)return Ql.error($l+e,t)})}else Ql.error(`PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.`)}}}},$u={tracingHeaders:class{constructor(e){this._instance=e,this.kf=void 0,this.Sf=void 0,this.xf=void 0,this.Nv=()=>{let e=this.Cf();var t,n;e?(A(this.kf)&&(this.kf=(t=g.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null?void 0:t._patchXHR(e,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),A(this.Sf)&&(this.Sf=(n=g.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null?void 0:n._patchFetch(e,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.Uv()}}initialize(){this.startIfEnabledOrStop()}qo(e){var t,n;g.__PosthogExtensions__?.tracingHeadersPatchFns?e():(t=g.__PosthogExtensions__)==null||(n=t.loadExternalDependency)==null||n.call(t,this._instance,`tracing-headers`,t=>{if(t)return Rl.error(`failed to load script`,t);
2e()})}$f(){return this._instance.config.tracing_headers??this._instance.config.addTracingHeaders??this._instance.config.__add_tracing_headers}Cf(){let e=this.$f();return E(e)?(E(this.xf)?this.xf.splice(0,this.xf.length,...e):this.xf=[...e],e.length>0?this.xf:void 0):(E(this.xf)&&this.xf.splice(0),this.xf=e||void 0,this.xf)}Uv(){var e,t;(e=this.kf)==null||e.call(this),(t=this.Sf)==null||t.call(this),this.kf=void 0,this.Sf=void 0}startIfEnabledOrStop(){this.Cf()?this.qo(this.Nv):this.Uv()}}},ed=R({surveys:class extends ru{constructor(e){var t;super(new lu(e),(t=e,{get projectToken(){return t.config.token},kv:new cu(t)})),this._instance=e}Oh(e,t){let n=t.query?pc(e,t.query):e;return new Promise(e=>{this._instance._send_request({method:t.method,url:this._instance.requestRouter.endpointFor(t.target??`api`,n),data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,timestampMode:t.sentAt,callback:e})})}}},qu),td={toolbar:class{constructor(e){this.instance=e}If(e){g.ph_toolbar_state=e}Tf(){return g.ph_toolbar_state??0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e=void 0,t=void 0,n=void 0){if(da(this.instance.config)||!i||!s)return!1;e??=i.location,n??=i.history;try{if(!t){try{i.localStorage.setItem(`test`,`test`),i.localStorage.removeItem(`test`)}catch{return!1}t=i?.localStorage}let r=uu||Bo(e.hash,`__posthog`)||Bo(e.hash,`state`),a,o=r?Nt(()=>JSON.parse(atob(decodeURIComponent(r))))||Nt(()=>JSON.parse(decodeURIComponent(r))):null;return o&&o.action===`ph_authorize`?(a=o,a.source=`url`,a&&Object.keys(a).length>0&&(o.desiredHash?e.hash=o.desiredHash:n?n.replaceState(n.state,``,e.pathname+e.search):e.hash=``)):(a=JSON.parse(t.getItem(du)||`{}`),a.source=`localstorage`,delete a.userIntent),!(!a.token||this.instance.config.token!==a.token||(this.loadToolbar(a),0))}catch{return!1}}Mf(e){let t=g.ph_load_toolbar||g.ph_load_editor;!N(t)&&D(t)?t(e,this.instance):fu.warn(`No toolbar load function found`)}loadToolbar(e){let t=!!s?.getElementById(`__POSTHOG_TOOLBAR__`);if(!i||t)return!1;let n=this.instance.requestRouter.region===`custom`&&this.instance.config.advanced_disable_toolbar_metrics,r=R(R({token:this.instance.config.token},e),{},{apiURL:this.instance.requestRouter.endpointFor(`ui`)},n?{instrument:!1}:{});if(i.localStorage.setItem(du,JSON.stringify(R(R({},r),{},{source:void 0}))),this.Tf()===2)this.Mf(r);else if(this.Tf()===0){var a,o;this.If(1),(a=g.__PosthogExtensions__)==null||(o=a.loadExternalDependency)==null||o.call(a,this.instance,`toolbar`,e=>{if(e)return fu.error(`[Toolbar] Failed to load`,e),void this.If(0);this.If(2),this.Mf(r)}),W(i,`turbolinks:load`,()=>{this.If(0),this.loadToolbar(r)})}return!0}Ef(e){return this.loadToolbar(e)}maybeLoadEditor(e=void 0,t=void 0,n=void 0){return this.maybeLoadToolbar(e,t,n)}}},nd=R({experiments:class e{get Ir(){return this._instance.config}constructor(t){this._instance=t,this.getWebExperimentsAndEvaluateDisplayLogic=(t=!1)=>{this.getWebExperiments(t=>{e.Pf(`retrieved web experiments from the server`),this.Rf=new Map,t.forEach(t=>{if(t.feature_flag_key){var n;this.Rf&&(e.Pf(`setting flag key `,t.feature_flag_key,` to web experiment `,t),(n=this.Rf)==null||n.set(t.feature_flag_key,t));let r=this._instance.getFeatureFlag(t.feature_flag_key);j(r)&&t.variants[r]&&this.Af(t.name,r,t.variants[r].transforms)}else if(t.variants)for(let n in t.variants){let r=t.variants[n];e.Ff(r,this._instance)&&this.Af(t.name,n,r.transforms)}})},t)},this._instance.onFeatureFlags(e=>{this.onFeatureFlags(e)})}initialize(){}onFeatureFlags(t){if(this._is_bot())e.Pf(Ou);else if(!this.Ir.disable_web_experiments){if(N(this.Rf))return this.Rf=new Map,this.loadIfEnabled(),void this.previewWebExperiment();e.Pf(`applying feature flags`,t),t.forEach(e=>{if(this.Rf&&this.Rf?.has(e)){let t=this._instance.getFeatureFlag(e),n=this.Rf?.get(e);t&&n!=null&&n.variants[t]&&this.Af(n.name,t,n.variants[t].transforms)}})}}previewWebExperiment(){let t=e.getWindowLocation();if(t?.search){let n=Ro(t?.search,`__experiment_id`),r=Ro(t?.search,`__experiment_variant`);n&&r&&(e.Pf(`previewing web experiments ${n} && ${r}`),this.getWebExperiments(e=>{this.Of(parseInt(n),r,e)},!1,!0))}}loadIfEnabled(){this.Ir.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}
2getWebExperiments(e,t,n){if(this.Ir.disable_web_experiments&&!n)return e([]);let r=this._instance.get_property(`$web_experiments`);if(r&&!t)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor(`api`,`/api/web_experiments/?token=${this.Ir.token}`),method:`GET`,timestampMode:`query`,callback:t=>e(t.statusCode===200&&t.json&&t.json.experiments||[])})}Of(t,n,r){let i=r.filter(e=>e.id===t);i&&i.length>0&&(e.Pf(`Previewing web experiment [${i[0].name}] with variant [${n}]`),this.Af(i[0].name,n,i[0].variants[n].transforms))}static Ff(t,n){return!N(t.conditions)&&e.Df(t,n)&&e.Lf(t)}static Df(t,n){if(N(t.conditions)||N(t.conditions?.url))return!0;let r=e.getWindowLocation();if(r){let e=Ra(n,r.href);return!t.conditions?.url||ku[t.conditions?.urlMatchType??`icontains`](t.conditions.url,e)}return!1}static getWindowLocation(){return i?.location}static Lf(e){if(N(e.conditions)||N(e.conditions?.utm))return!0;let t=qo();if(t.utm_source){var n,r,i,a,o,s,c,l;let u=!((n=e.conditions)!=null&&(n=n.utm)!=null&&n.utm_campaign)||((r=e.conditions)==null||(r=r.utm)==null?void 0:r.utm_campaign)==t.utm_campaign,d=!((i=e.conditions)!=null&&(i=i.utm)!=null&&i.utm_source)||((a=e.conditions)==null||(a=a.utm)==null?void 0:a.utm_source)==t.utm_source,f=!((o=e.conditions)!=null&&(o=o.utm)!=null&&o.utm_medium)||((s=e.conditions)==null||(s=s.utm)==null?void 0:s.utm_medium)==t.utm_medium,p=!((c=e.conditions)!=null&&(c=c.utm)!=null&&c.utm_term)||((l=e.conditions)==null||(l=l.utm)==null?void 0:l.utm_term)==t.utm_term;return u&&f&&p&&d}return!1}static Pf(e,...t){z.info(`[WebExperiments] ${e}`,t)}Af(t,n,r){this._is_bot()?e.Pf(Ou):n===`control`?e.Pf(`Control variants leave the page unmodified.`):r.forEach(r=>{r.selector&&(e.Pf(`applying transform of variant ${n} for experiment ${t} `,r),(document?.querySelectorAll(r.selector))?.forEach(e=>{let t=e;r.html&&(t.innerHTML=r.html),r.css&&t.setAttribute(`style`,r.css)}))})}_is_bot(){return o&&this._instance?Rc(o,this.Ir.custom_blocked_useragents):void 0}}},qu),rd={conversations:class{constructor(e){this._instance=e,this.Nf=void 0,this._conversationsManager=null,this.qf=!1,this.ne=null,this.jf=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(this._instance.config.disable_conversations||(this.Bf=e.ok,!e.ok))return;let t=e.config.conversations;N(t)||(I(t)?this.Nf=t:(this.Nf=t.enabled,this.ne=t),this.loadIfEnabled())}reset(){var e;(e=this._conversationsManager)==null||e.reset(),this._conversationsManager=null,this.Nf=void 0,this.ne=null,this.Bf=void 0,this.jf=!1}loadIfEnabled(){if(this._conversationsManager||this.qf||this._instance.config.disable_conversations||da(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;let e=g?.__PosthogExtensions__;if(e&&!A(this.Nf)&&this.Nf){if(this.ne&&this.ne.token){this.qf=!0;try{let t=e.initConversations;if(t)return this.Hf(t),void(this.qf=!1);let n=e.loadExternalDependency;if(!n)return void this.zf(Ji);n(this._instance,`conversations`,t=>{t||!e.initConversations?this.zf(`Could not load conversations script`,t):this.Hf(e.initConversations),this.qf=!1})}catch(e){this.zf(`Error initializing conversations`,e),this.qf=!1}}else Au.error(`Conversations enabled but missing token in remote config.`)}}Hf(e){if(this.ne)try{this._conversationsManager=e(this.ne,this._instance),this.jf=!1,Au.info(`Conversations loaded successfully`)}catch(e){this.zf(`Error completing conversations initialization`,e)}else Au.error(`Cannot complete initialization: remote config is null`)}zf(e,t){Au.error(e,t),this._conversationsManager=null,this.qf=!1,this.jf=!0}show(){this._conversationsManager?this._conversationsManager.show():Au.warn(`Conversations not loaded yet.`)}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Nf&&!M(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?`disabled_by_config`:da(this._instance.config)?`disabled_for_toolbar`:this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?`consent_opted_out`:!1===this.Bf?`remote_config_failed`:A(this.Nf)?this.Bf?`disabled_in_project`:`remote_config_pending`:this.Nf?N(this.ne)||!this.ne.token?`missing_token`:g?.__PosthogExtensions__?this.qf?`initializing`:this.jf?`load_failed`:`not_loaded`:`extensions_unavailable`:`disabled_in_project`}isVisible(){var e;return(e=this._conversationsManager?.isVisible())!=null&&e}sendMessage(e,t,n){var r=this;return L(function*(){return r._conversationsManager?r._conversationsManager.sendMessage(e,t,n):(Au.warn(ju),null)})()}getMessages(e,t){var n=this;return L(function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(Au.warn(ju),null)})()}markAsRead(e){var t=this;return L(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(Au.warn(ju),null)})()}getTickets(e){var t=this;return L(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(Au.warn(ju),null)})()}requestRestoreLink(e){var t=this;return L(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(Au.warn(ju),null)})()}restoreFromToken(e){var t=this;return L(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(Au.warn(ju),null)})()}restoreFromUrlToken(){var e=this;return L(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(Au.warn(ju),null)})()}getCurrentTicketId(){return this._conversationsManager?.getCurrentTicketId()??null}getWidgetSessionId(){return this._conversationsManager?.getWidgetSessionId()??null}bh(){var e;(e=this._conversationsManager)==null||e.setIdentity()}_h(){var e;(e=this._conversationsManager)==null||e.clearIdentity()}}},id={logs:class{constructor(e){var t;this._instance=e,this.name=`logs`,this.Uf=!1,this.Wf=!1,this.Vf=!1,this.$=B(`[logs]`),this.Gf=R(R({},this.$),{},{error:(...e)=>{e.some(Ru)||this.$.error(...e)}}),this.na=[],this.Zf=[],this.od=0,this.xo=!1,this.Qf=[],this.Jf=[],this.Kf=!1,this.Xf=!1,this.Yf=()=>{var e,t;this.xo||(this.od=0,(e=this.tp)==null||e.onReconnect(),(t=this.ep)==null||t.onReconnect())},this._instance&&(t=this._instance.config.logs)!=null&&t.captureConsoleLogs&&(this.Uf=!0),i&&W(i,`online`,this.Yf)}np(e,t,n,r){var i;let a=Mu((i=this._instance)==null||(i=i.config)==null?void 0:i.logs,n);return[new cr(this.sp(e,t),a,this.Gf,()=>this.rp(),e=>e(),void 0,r),a]}op(){var e;let t=(e=this._instance)==null||(e=e.config)==null?void 0:e.logs;var n;return this.tp&&this.lp===t||((n=this.tp)==null||n.reset(),this.lp=t,[this.tp,this.ap]=this.np(()=>this.na,e=>{this.na=e})),this.tp}up(){var e;let t=(e=this._instance)==null||(e=e.config)==null?void 0:e.logs;var n;return this.ep&&this.hp===t||((n=this.ep)==null||n.reset(),this.hp=t,[this.ep,this.cp]=this.np(()=>this.Zf,e=>{this.Zf=e},{serviceNameDefault:`posthog-browser-logs`,consoleCapture:!0},Fu)),this.ep}setup(e){var t;if(this.xo)return;this.mo=e,(t=this._instance)!=null&&(t=t.config)!=null&&(t=t.logs)!=null&&t.captureConsoleLogs&&(this.Uf=!0),(this.Uf||this.dp()&&this.vp())&&this.fp();let n=!1,r=e.onRemoteConfig(e=>{n=e.ok&&!0===e.config.logs?.captureConsoleLogs,this.onRemoteConfig(e)});this.xo?r.dispose():(this.Io=r,n||this.loadIfEnabled())}dispose(){var e,t,n,r;this.xo||(this.xo=!0,this.pp(),(e=this.Io)==null||e.dispose(),this.Io=void 0,this.mo=void 0,this.Vf=!1,i?.removeEventListener(`online`,this.Yf),(t=this.gp)==null||t.call(this),this.gp=void 0,(n=this.tp)==null||n.reset(),(r=this.ep)==null||r.reset())}onRemoteConfig(e){var t;if(this.xo)return;let n=e.ok?e.config.logs?.captureConsoleLogs:void 0;N(n)?this.mp():((t=this._instance)==null||(t=t.persistence)==null||t.register({$logs_capture_enabled_server_side:!!n}),n?(this.Uf=!0,this.Wf||this.fp(),this.loadIfEnabled()):this.mp())}reset(){var e,t,n,r;this.pp(),(e=this.tp)==null||e.clearQueue(),this.na=[],(t=this.tp)==null||t.reset(),(n=this.ep)==null||n.clearQueue(),this.Zf=[],(r=this.ep)==null||r.reset(),this.od=0}captureLog(e){this.xo||this.op().captureLog(e)}captureConsoleLog(e){this.xo||this.up().captureLog(e)}captureBufferedConsoleLog(e,t,n){this.xo||this.up().captureLog(e,{context:t,occurredAtMs:n})}vp(){var e;return!!((e=this._instance)!=null&&(e=e.persistence)!=null&&(e=e.props)!=null&&e[Rr])}dp(){var e,t,n;return!((e=this._instance)!=null&&(t=e.Yl)!=null&&t.call(e))||!!((n=g._POSTHOG_REMOTE_CONFIG)!=null&&(n=n[this._instance.config.token])!=null&&n.config)}kh(){var e;this.pp(),(e=this.ep)==null||e.clearQueue(),this.Zf=[]}mp(){this.Uf||this.pp()}fp(){var e;if(this.Kf||!g?.console)return;let t=Mu((e=this._instance)==null||(e=e.config)==null?void 0:e.logs).maxBufferSize,n=!0;this.Jf.push(()=>{n=!1});for(let e of Nu){let r;try{r=Pu(g.console[e])}catch{continue}r&&this.Jf.push(Ll(g.console,e,i=>{let a=(...r)=>{try{n&&this.yp(e,r,t)}catch{}return i.apply(g.console,r)};return a.__rrweb_original__=r,a}))}this.Kf=!0,this.bp=setTimeout(()=>{this.pp()},3e4)}yp(e,t,n){if(this.Kf&&!this.Xf&&t.length!==0){if(this._instance?.is_capturing()){if(n>this.Qf.length){this.Xf=!0;try{this.Qf.push({level:e,args:t,occurredAtMs:Date.now(),context:this.rp()})}finally{this.Xf=!1}}}else this.pp()}}pp(){if(this.Qf=[],this.Kf){this.Kf=!1,this.bp&&=(clearTimeout(this.bp),void 0);for(let e of this.Jf)e();this.Jf=[]}}_p(){let e=this.Qf;return this.pp(),e}get logger(){return this.wp||={trace:(e,t)=>this.captureLog({body:e,level:`trace`,attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:`debug`,attributes:t}),info:(e,t)=>this.captureLog({body:e,level:`info`,attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:`warn`,attributes:t}),error:(e,t)=>
2this.captureLog({body:e,level:`error`,attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:`fatal`,attributes:t})},this.wp}flushLogs(e){e?this.kp(e):(this.tp&&this.tp.flush().catch(e=>this.Sp(e)),this.ep&&this.ep.flush().catch(e=>this.Sp(e)))}Sp(e){Ru(e)||this.$.error(`PostHog logs flush failed:`,e)}loadIfEnabled(){if(this.xo||!this.Uf||this.Wf||this.Vf)return;let e=g?.__PosthogExtensions__;if(!e)return this.$.error(`PostHog Extensions not found.`),void this.pp();let t=e.loadExternalDependency;if(!t)return this.$.error(Ji),void this.pp();this.Vf=!0;try{t(this._instance,`logs`,t=>{if(this.Vf=!1,this.xo||!this.Uf)return;let n=e.logs;if(t||!n?.initializeLogs)this.$.error(`Could not load logs script`,t),this.pp();else{let e=this._p();var r;this.gp=n.initializeLogs(this.mo??this._instance),this.Wf=!0,e.length>0&&((r=n.replayConsoleBuffer)==null||r.call(n,this.mo??this._instance,e))}})}catch(e){throw this.Vf=!1,e}}sp(e,t){let n=this._instance;return{get isDisabled(){return!1},get optedOut(){return!n.is_capturing()},getPersistedProperty:t=>t===y.LogsQueue?e():void 0,setPersistedProperty(e,n){e===y.LogsQueue&&t(n??[])},js:e=>this.js(e),getLibraryId:()=>V.LIB_NAME,getLibraryVersion:()=>V.LIB_VERSION}}js(e){return new Promise(t=>{if(Vo(this.od,3))return void t({kind:`fatal`,error:Lu(void 0,`logs endpoint is unreachable, dropping batch`)});let n=!1,r=e=>{n||(n=!0,clearTimeout(i),t(e))},i=setTimeout(()=>{this.$.warn(`Logs request timed out before receiving a response`),r({kind:`retry-later`,error:Lu(void 0,`logs request timed out`)})},9e4);this._instance._send_request({method:`POST`,url:this.xp(),data:e,compression:`best-available`,batchKey:`logs`,fireCallbackOnDrop:!0,callback:e=>{let t=e.statusCode;this.Cp(t),t>=200&&300>t?r({kind:`ok`}):t===413?r({kind:`too-large`}):t!==0&&t!==408&&t!==429&&500>t?r({kind:`fatal`,error:Error(`logs request failed with status ${t}`)}):t===0?(e.error||this.$.warn(`Logs request failed before receiving an HTTP response`),r({kind:`retry-later`,error:Lu(e.error,`logs request failed before receiving an HTTP response`)})):r({kind:`retry-later`,error:e.error??Error(`logs request failed with status ${t}`)})}})})}Cp(e){(e!==0||this._instance.__loaded)&&(this.od=Ho(e,this.od,3,()=>this.$.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.`)))}kp(e){this.na.length>0&&this.$p(e,this.na,this.ap,V.LIB_NAME,e=>{this.na=e}),this.Zf.length>0&&this.$p(e,this.Zf,this.cp,Fu,e=>{this.Zf=e})}$p(e,t,n,r,i){if(t.length===0)return;let a=t.map(e=>e.record);i([]);let o=ir(a,rr(n,V.LIB_NAME,V.LIB_VERSION),r,V.LIB_VERSION);this._instance._send_request({method:`POST`,url:this.xp(),data:o,compression:`best-available`,batchKey:`logs`,transport:e})}xp(){return this._instance.requestRouter.endpointFor(`api`,`/i/v1/logs`)+`?token=`+encodeURIComponent(this._instance.config.token)}rp(){var e;let t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){let{sessionId:e,windowId:n,sessionStartTimestamp:r,lastActivityTimestamp:i}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);t.sessionId=e,t.windowId=n,N(r)||(t.sessionStartTimestamp=r),N(i)||(t.lastActivityTimestamp=i)}if(g!=null&&(e=g.location)!=null&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?Mt(g.location.href):g.location.href),this._instance.featureFlags){let e=this._instance.featureFlags.getFlags();e&&e.length>0&&(t.activeFeatureFlags=e)}return t}}},ad={metrics:class{constructor(e){this._instance=e,this.$=B(`[metrics]`),this.xo=!1}initialize(){this.onConfigChange()}onConfigChange(){if(this.xo)return;let e=!!this._instance.config.metrics?.network;e&&!this.Ip?this.Ip=(e=>{let t=!0,n=()=>t?(e=>{let t=e.config.metrics?.network;return!0===t?{}:t||void 0})(e):void 0,r=Gu(e,n),i=Ku(e,n);return()=>{t=!1,r(),i()}})(this._instance):!e&&this.Ip&&(this.Ip(),this.Ip=void 0)}op(){var e;let t=(e=this._instance)==null||(e=e.config)==null?void 0:e.metrics;var n;return this.tp&&this.lp===t||((n=this.tp)==null||n.reset(),this.lp=t,this.tp=new fr(this.sp(),function(e){let t=e?.resourceAttributes;return{serviceName:t?.[`service.name`]??e?.serviceName,serviceVersion:t?.[`service.version`]??e?.serviceVersion,environment:t?.[`deployment.environment`]??e?.environment,resourceAttributes:t,beforeSend:e?.beforeSend,flushIntervalMs:e?.flushIntervalMs??1e4,maxSeriesPerFlush:e?.maxSeriesPerFlush??1e3}}(t),this.$)),this.tp}count(e,t=1,n){this.op().count(e,t,n)}
2gauge(e,t,n){this.op().gauge(e,t,n)}histogram(e,t,n){this.op().histogram(e,t,n)}flush(e){if(!this.tp)return Promise.resolve();if(e){let t=this.tp.drainWindow();return t&&this.Ys(t,e),Promise.resolve()}return this.tp.flush().catch(e=>this.$.error(`PostHog metrics flush failed:`,e))}reset(){var e;(e=this.tp)==null||e.reset()}dispose(){var e,t;this.xo=!0,(e=this.Ip)==null||e.call(this),this.Ip=void 0,(t=this.tp)==null||t.reset()}sp(){let e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},Ys:e=>t.Ys(e),getLibraryId:()=>V.LIB_NAME,getLibraryVersion:()=>V.LIB_VERSION}}Ys(e,t){return new Promise(n=>{let r=!1,i=e=>{r||(r=!0,clearTimeout(a),n(e))},a=setTimeout(()=>i({kind:`retry-later`,error:Error(`metrics request timed out`)}),9e4);this._instance._send_request(R(R({method:`POST`,url:this.Tp(),data:e,compression:`best-available`,batchKey:`metrics`},t&&{transport:t}),{},{fireCallbackOnDrop:!0,callback(e){let t=e.statusCode;i(t>=200&&300>t?{kind:`ok`}:t===413?{kind:`too-large`}:t!==0&&t!==408&&t!==429&&500>t?{kind:`fatal`,error:Error(`metrics request failed with status ${t}`)}:{kind:`retry-later`,error:e.error??Error(`metrics request failed with status ${t}`)})}}))})}Tp(){return this._instance.requestRouter.endpointFor(`api`,`/i/v1/metrics`)+`?token=`+encodeURIComponent(this._instance.config.token)}}};Tl.__defaultExtensionClasses=R({},R(R(R(R(R(R(R(R(R(R(R(R(R({},qu),Ju),Yu),Xu),Zu),Qu),ed),$u),td),nd),rd),id),ad));var $=function(){V.SDK_DIST_CHANNEL=`npm`;let e=cl[yl]=new Tl;return function(){function e(){e.done||(e.done=!0,Ec=!1,H(cl,function(e){e._dom_loaded()}))}s?.addEventListener?s.readyState===`complete`?e():W(s,`DOMContentLoaded`,e,{capture:!1}):i&&z.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),e}(),od=e(t(),1),sd={control:{annualTierUsd:39,trialDays:0},"price-59-no-trial":{annualTierUsd:59,trialDays:0},"price-79-no-trial":{annualTierUsd:79,trialDays:0},"price-39-trial":{annualTierUsd:39,trialDays:3},"price-59-trial":{annualTierUsd:59,trialDays:3},"price-79-trial":{annualTierUsd:79,trialDays:3}},cd=`pricing-test-v2`,ld=[`control`,`price-59-trial`],ud={control:`pricing-test-v2:control`,"price-59-trial":`pricing-test-v2:price-59-trial`},dd={control:`a`,"price-59-trial":`b`},fd=e=>ld.find(t=>dd[t]===e)??null,pd={...sd,[ud.control]:{annualTierUsd:39,trialDays:3},[ud[`price-59-trial`]]:{annualTierUsd:59,trialDays:3}},md=e=>{let t=fd(e);return t===null?null:ud[t]},hd=e=>{let t=e=>fd(e)??ld.find(t=>t===e)??null,n=e=>pd[ud[e]].annualTierUsd,r=t=>(e.split[t]??0)>0,i=t(e.fallbackVariant);if(i===null)return`${e.key} declares fallbackVariant "${e.fallbackVariant}", which is not a ${cd} arm, so no price can be implied for the viewers who receive it.`;if(!r(e.fallbackVariant))return`${e.key} declares fallbackVariant "${e.fallbackVariant}", which the split does not assign; crawlers and cookie-less viewers would be advertised a price no visitor can be quoted.`;let a=i;for(let i of e.variants){let o=t(i);if(o===null)return`${e.key} lists variant "${i}", which is not a ${cd} arm; a price experiment's arms must all be priceable.`;r(i)&&n(o)>n(a)&&(a=o)}return n(i)>=n(a)?null:`${e.key} declares fallbackVariant "${i}" ($${n(i)}/yr) while arm "${a}" charges $${n(a)}/yr. Crawlers and cookie-less viewers are served the fallback, so this advertises $${n(i)} for a page whose checkout can charge $${n(a)} — the advertised-below-charged direction design C4 exists to make impossible.`},gd=/bot[/)-]|bot$|crawl|spider[/);+]|spider$|slurp/i;function _d(e){return e!==void 0&&gd.test(e)}var vd={academicLandingFunnelV1:{key:`academic-landing-funnel-v1`,enrollment:1,split:{control:.5,treatment:.5},fallbackVariant:`control`},homepageCtaFunnelV1:{key:`homepage-cta-funnel-v1`,enrollment:1,split:{control:.5,treatment:.5},fallbackVariant:`control`},pricingTestV2:{key:`pricing-test-v2`,enrollment:1,split:{a:.5,b:.5},fallbackVariant:`b`}},yd=e=>({mode:`edge`,enrollment:e.enrollment,split:e.split,fallbackVariant:e.fallbackVariant}),bd={academicLandingFunnelV1:{key:vd.academicLandingFunnelV1.key,variants:[`control`,`treatment`],default:`control`,bucketing:yd(vd.academicLandingFunnelV1)}
2,homepageCtaFunnelV1:{key:vd.homepageCtaFunnelV1.key,variants:[`control`,`treatment`],default:`control`,bucketing:yd(vd.homepageCtaFunnelV1)},pricingTestV2:{key:vd.pricingTestV2.key,variants:[`a`,`b`],default:`a`,bucketing:yd(vd.pricingTestV2)}},xd={marketingPublicDocGiantTitleV1:{key:`marketing-public-doc-giant-title-v1`,label:`Giant Title On Top (Centered)`,variants:[`control`,`treatment`],variantLabels:{control:`Hide title`,treatment:`Show title`},default:`control`,bucketing:{mode:`local`}},marketingPublicDocReadTimeV1:{key:`marketing-public-doc-reading-time-v1`,label:`How Long It Is to Read`,variants:[`control`,`treatment`],variantLabels:{control:`Hide reading time`,treatment:`Show reading time`},default:`control`,bucketing:{mode:`local`}},marketingPublicDocOverviewPopupV1:{key:`marketing-public-doc-overview-popup-v1`,label:`Overview / Main Ideas Popup`,variants:[`control`,`treatment`],variantLabels:{control:`Keep current sidebar`,treatment:`Use overview popup`},default:`control`,bucketing:{mode:`local`}},simulateFreeCountry:{key:`simulate-free-country`,variants:[`true`,`false`],default:`false`,bucketing:{mode:`local`}},bypassClientUploadPrecheck:{key:`bypass-client-upload-precheck`,variants:[`true`,`false`],default:`false`,bucketing:{mode:`local`}},bypassFreePlanPrivateAudioLimit:{key:`bypass-free-plan-private-audio-limit`,variants:[`true`,`false`],default:`false`,bucketing:{mode:`local`}},fastDarkModeSwitch:{key:`fast-dark-mode-switch`,variants:[`true`,`false`],default:`false`,bucketing:{mode:`local`}},mockSubscriptionEndpoint:{key:`mock-subscription-endpoint`,variants:[`true`,`false`],default:`false`,bucketing:{mode:`local`}},disableDocPackLoading:{key:`disable-doc-pack-loading`,variants:[`true`,`false`],default:`false`,bucketing:{mode:`local`}},usePageImagePdfRendering:{key:`use-page-image-pdf-rendering`,variants:[`true`,`false`],default:`false`,bucketing:{mode:`local`}}},Sd={...bd,...xd};{let e=Sd.pricingTestV2;if(e!==void 0&&e.bucketing.mode===`edge`){let t=hd({key:e.key,variants:e.variants,split:e.bucketing.split,fallbackVariant:e.bucketing.fallbackVariant});if(t!==null)throw Error(t)}}var Cd={academicLandingFunnelV1:{pinning:`none`,exposureAt:`academic-landing-view`},homepageCtaFunnelV1:{pinning:`none`,exposureAt:`homepage-view`},pricingTestV2:{pinning:`at-signup`,exposureAt:`paywall-view`}},wd={"academic-landing-view":`page-load`,"homepage-view":`page-load`,"paywall-view":`deferred`},Td=Ed();function Ed(){let e=Cd,t=new Map;for(let[n,r]of Object.entries(bd)){let i=e[n];i&&t.set(r.key,i.exposureAt)}return t}function Dd(e){let t=Td.get(e);return t===void 0?`page-load`:wd[t]??`deferred`}function Od(e){$.init(e.posthogKey,{api_host:e.posthogHost,ui_host:e.posthogUiHost??null,defaults:e.defaults,person_profiles:`always`,bootstrap:e.bootstrap?{distinctID:e.bootstrap.distinctId,featureFlags:e.bootstrap.featureFlags,isIdentifiedID:e.bootstrap.isIdentifiedID}:void 0,advanced_disable_feature_flags_on_first_load:!!e.bootstrap,disable_surveys:!0,session_recording:{maskAllInputs:!1,maskTextSelector:void 0,blockSelector:void 0}});let t=e.edgeFlags??e.bootstrap?.edgeFlags;return t&&Kd(t),$}var kd=(0,od.createContext)(void 0);function Ad({edgeFlags:e,children:t}){return(0,od.createElement)(kd.Provider,{value:e},t)}var jd=new Map,Md=new Set,Nd=new Set;function Pd(e,t,n){let r=`${e}:${t}`;Nd.has(r)||(Nd.add(r),$.capture(`edge_stale_override_reclaimed`,{flag_key:e,stale_value:Jd(e,t),edge_variant:n===null?null:Jd(e,n)}))}var Fd=new Map;function Id(){return typeof navigator>`u`?!1:_d(navigator.userAgent)}var Ld=`listening_manual_flag_overrides`,Rd=new Set;function zd(e){return Rd.add(e),()=>{Rd.delete(e)}}function Bd(){for(let e of Rd)e()}function Vd(){try{let e=localStorage.getItem(Ld);return e?JSON.parse(e):{}}catch{return{}}}function Hd(e){try{Object.keys(e).length===0?localStorage.removeItem(Ld):localStorage.setItem(Ld,JSON.stringify(e))}catch{}}function Ud(e,t){Hd({...Vd(),[e]:t}),$.featureFlags.overrideFeatureFlags({flags:{...vf(),[e]:t}}),$.unregister(`$feature/${e}`),Bd()}function Wd(e){let t=Vd();delete t[e],Hd(t);let{[e]:n,...r}=vf();Object.keys(r).length===0?$.featureFlags.overrideFeatureFlags(!1):$.featureFlags.overrideFeatureFlags({flags:r}),Bd()}function Gd(){Hd({}),$.featureFlags.overrideFeatureFlags(!1),Bd()}function Kd(e){jd.clear();let t=vf(),n=Vd(),r=[],i=[],a=Id();for(let[o,s]of Object.entries(e)){jd.set(o,s),Fd.delete(o);let e=t[o],c=typeof e==`string`&&n[o]===e;if(s.enrolled&&!a){if(c)continue;typeof e==`string`&&e!==s.variant&&Pd(o,e,s.variant),r.push({key:o,variant:s.variant}),Fd.set(o,s.variant),t[o]=s.variant}else{if(c)continue;typeof e==`string`&&Pd(o,e,null),i.push(o),delete t[o]}}$.featureFlags.overrideFeatureFlags({flags:t});for(let{key:e,variant:t}of r)$.register({[`$feature/${e}`]:Jd(e,t)});for(let e of i)$.unregister(`$feature/${e}`);let o=$.get_distinct_id();for(let{key:e,variant:t}of r)Dd(e)===`page-load`&&Yd(o,e,t)}var qd={[cd]:e=>fd(e)??e};function Jd(e,t){return qd[e]?.(t)??t}function Yd(e,t,n){let r=Jd(t,n),i=`${e}:${t}:${r}`;Md.has(i)||(Md.add(i),$.capture(`$feature_flag_called`,{$feature_flag:t,$feature_flag_response:r}))}function Xd(){return $}function Zd(){$.startSessionRecording({sampling:!0})}Object.fromEntries(Object.entries(Sd).map(([e,t])=>[e,t.key]));function Qd(e){let t=Sd[e];
2return t.bucketing.mode===`local`?mf()[t.key]??t.default:t.bucketing.mode===`edge`?$d(t.key,t.default):$.getFeatureFlag(t.key)??t.default}function $d(e,t,n){let r=$.persistence?vf()[e]:Vd()[e];if(typeof r==`string`)return r;let i=n?.[e];if(i?.enrolled)return i.variant;if(i&&!i.enrolled)return t;let a=jd.get(e);return a?.enrolled?a.variant:t}function ef(e){let t=Sd[e];return t.bucketing.mode===`local`?tf(t):t.bucketing.mode===`edge`?nf(t):rf(t)}function tf(e){let t=(0,r.c)(10),n;t[0]!==e.default||t[1]!==e.key?(n=()=>mf()[e.key]??e.default,t[0]=e.default,t[1]=e.key,t[2]=n):n=t[2];let i=n,[a,o]=(0,od.useState)(i),s,c;t[3]===i?(s=t[4],c=t[5]):(s=()=>{let e=()=>o(i());return window.addEventListener(pf,e),()=>window.removeEventListener(pf,e)},c=[i],t[3]=i,t[4]=s,t[5]=c),(0,od.useEffect)(s,c);let l=e.key,u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=mf(),t[6]=u):u=t[6];let d=l in u,f;return t[7]!==d||t[8]!==a?(f={value:a,isLoading:!1,isOverridden:d},t[7]=d,t[8]=a,t[9]=f):f=t[9],f}function nf(e){let t=(0,r.c)(12),n=(0,od.useContext)(kd),i;t[0]!==n||t[1]!==e.default||t[2]!==e.key?(i=()=>({value:$d(e.key,e.default,n),isOverridden:af(e.key)||!$.persistence&&e.key in Vd()}),t[0]=n,t[1]=e.default,t[2]=e.key,t[3]=i):i=t[3];let a=i,[o,s]=(0,od.useState)(a),c,l;t[4]===a?(c=t[5],l=t[6]):(c=()=>{s(a())},l=[a],t[4]=a,t[5]=c,t[6]=l),(0,od.useEffect)(c,l);let u,d;t[7]===a?(u=t[8],d=t[9]):(u=()=>{let e=()=>s(a()),t=$.onFeatureFlags(e),n=zd(e);return()=>{t(),n()}},d=[a],t[7]=a,t[8]=u,t[9]=d),(0,od.useEffect)(u,d);let f;return t[10]===o?f=t[11]:(f={...o,isLoading:!1},t[10]=o,t[11]=f),f}function rf(e){let t=(0,r.c)(12),n;t[0]!==e.default||t[1]!==e.key?(n=()=>$.getFeatureFlag(e.key)??e.default,t[0]=e.default,t[1]=e.key,t[2]=n):n=t[2];let i=n,[a,o]=(0,od.useState)(i),[s,c]=(0,od.useState)(!$.featureFlags?.hasLoadedFlags),l,u;t[3]===i?(l=t[4],u=t[5]):(l=()=>{let e=$.onFeatureFlags(()=>{o(i()),c(!1)}),t=$.on(`featureFlagsReloading`,()=>c(!0));return()=>{e(),t()}},u=[i],t[3]=i,t[4]=l,t[5]=u),(0,od.useEffect)(l,u);let d;t[6]===e.key?d=t[7]:(d=af(e.key),t[6]=e.key,t[7]=d);let f=d,p;return t[8]!==s||t[9]!==f||t[10]!==a?(p={value:a,isLoading:s,isOverridden:f},t[8]=s,t[9]=f,t[10]=a,t[11]=p):p=t[11],p}function af(e){try{let t=$.persistence?.props?.$override_feature_flags;return typeof t!=`object`||!t?!1:e in t}catch{return!1}}var of={platform:`web`,category:`web-app`};function sf(){let e=(0,r.c)(1),t=uf,n=lf,i=cf,a;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={capture:t,identify:n,reset:i},e[0]=a):a=e[0],a}function cf(){$.reset(),_f()}function lf(e,t){$.identify(e,t)}function uf(e,t){$.capture(e,{...of,...t})}function df(e){if(typeof window>`u`)return;let t=Object.entries(e);window.analytics={flags:{list:()=>{let e=$.featureFlags?.getFlagVariants?.()??{},n=vf(),r=mf(),i=t.map(([t,i])=>({name:t,key:i.key,bucketing:i.bucketing.mode,value:i.bucketing.mode===`local`?r[i.key]??i.default:e[i.key]??i.default,default:i.default,variants:i.variants.join(`, `),overridden:i.bucketing.mode===`local`?i.key in r:i.key in n}));console.table(i)},set:(n,r)=>{let i=e[n];if(!i){console.error(`Unknown flag "${n}". Available: ${t.map(([e])=>e).join(`, `)}`);return}if(!i.variants.includes(r)){console.error(`Invalid value "${r}" for flag "${n}". Valid: ${i.variants.join(`, `)}`);return}i.bucketing.mode===`local`?hf(i.key,r):Ud(i.key,r),console.log(`✓ ${n} → ${r}`)},clear:t=>{let n=e[t];if(!n){console.error(`Unknown flag "${t}".`);return}n.bucketing.mode===`local`?gf(n.key):Wd(n.key),console.log(`✓ Cleared override for ${t}`)},reset:()=>{Gd(),_f(),console.log(`✓ All overrides cleared`)}},identity:{current:()=>$.get_distinct_id(),isIdentified:()=>$.persistence?.props?.$user_state===`identified`},help:()=>{console.log(`
3Analytics Console API:
4  analytics.flags.list()                  — Print all flags with current values
5  analytics.flags.set('name', 'variant')  — Override a flag
6  analytics.flags.clear('name')           — Remove a flag override
7  analytics.flags.reset()                 — Clear all overrides
8  analytics.identity.current()            — Print current distinct_id
9  analytics.identity.isIdentified()       — Check if user is identified
10  analytics.help()                        — Print this help
11      `)}}}var ff=`listening_local_flags`,pf=`listening:local-flags-changed`;function mf(){try{let e=localStorage.getItem(ff);return e?JSON.parse(e):{}}catch{return{}}}function hf(e,t){let n=mf();n[e]=t,localStorage.setItem(ff,JSON.stringify(n)),window.dispatchEvent(new Event(pf))}function gf(e){let t=mf();delete t[e],Object.keys(t).length===0?localStorage.removeItem(ff):localStorage.setItem(ff,JSON.stringify(t)),window.dispatchEvent(new Event(pf))}function _f(){localStorage.removeItem(ff),window.dispatchEvent(new Event(pf))}function vf(){try{let e=$.persistence?.props?.$override_feature_flags;return typeof e==`object`&&e&&!Array.isArray(e)?{...e}:{}}catch{return{}}}function yf(){return{...Vd()}}export{md as C,fd as S,ef as _,gf as a,ud as b,Qd as c,yf as d,vf as f,sf as g,zd as h,_f as i,Xd as l,Ud as m,Kd as n,Wd as o,hf as p,df as r,Zd as s,Ad as t,Od as u,Sd as v,$ as w,cd as x,pd as y};
12//# sourceMappingURL=client-CPFuoOry.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.