PageSourceSearch

https://www.app.thecompany.company/assets/events-CLTOOFOh.js

js thecompany.company collected 2026-09-25 21:44:51 UTC 295,428 bytes, 2 lines download raw bytes

1import{n as e,w as t,x as n}from"./src-C6CrqkOt.js";function r(e){try{return e()}catch(e){if(e instanceof ReferenceError)return;throw e}}function i(e){return{VERCEL_GIT_COMMIT_SHA:r(e.vercelGitCommitSha),NEXT_PUBLIC_POSTHOG_KEY:r(e.posthogKey),NEXT_PUBLIC_POSTHOG_HOST:r(e.posthogHost),NEXT_PUBLIC_GA_MEASUREMENT_ID:r(e.gaMeasurementId)}}function a(){return i({vercelGitCommitSha:()=>r(()=>`580d552c32cf75354ca6aa3dc965d5bf31657ba5`)??{}.NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA,posthogKey:()=>`phc_namDCFVaYsQbxNPTQjrBYnzpZ1nnawIJto0k5i6yY07`,posthogHost:()=>`https://us.i.posthog.com`,gaMeasurementId:()=>({}).NEXT_PUBLIC_GA_MEASUREMENT_ID})}var o=()=>e({shared:{VERCEL_GIT_COMMIT_SHA:n().optional()},clientPrefix:`NEXT_PUBLIC_`,client:{NEXT_PUBLIC_POSTHOG_KEY:n().startsWith(`phc_`).optional(),NEXT_PUBLIC_POSTHOG_HOST:t().optional().default(`https://us.i.posthog.com`),NEXT_PUBLIC_GA_MEASUREMENT_ID:n().startsWith(`G-`).optional()},runtimeEnv:a()}),s=`u`>typeof window?window:void 0,c=`u`>typeof globalThis?globalThis:s,l=c?.navigator,u=c?.document,d=c?.location,f=c?.fetch,p=c?.XMLHttpRequest&&`withCredentials`in new c.XMLHttpRequest?c.XMLHttpRequest:void 0,m=c?.AbortController,h=c?.CompressionStream,g=l?.userAgent;function _(){return!(!s||!1===s.navigator.onLine)}var v=typeof globalThis<`u`?globalThis:s;v&&typeof self>`u`&&(v.self=v),v&&typeof File>`u`&&(v.File=function(){});var y=s??{},b=`0.9.0`,x={DEBUG:!1,LIB_VERSION:b,LIB_NAME:`browser-common`,JS_SDK_VERSION:b},S=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.SurveysInProgress=`surveys_in_progress`,e.SurveysSeen=`surveys_seen`,e.Surveys=`surveys`,e.RemoteConfig=`remote_config`,e.FlagsEndpointWasHit=`flags_endpoint_was_hit`,e.DeviceId=`device_id`,e}({}),C=function(e){return e.GZipJS=`gzip-js`,e.Base64=`base64`,e}({}),w=[`$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`],ee=[`token`];function T(e,t){return e.indexOf(t)!==-1}var te=function(e){return e.trim()},E=function(e){return e.replace(/^\$/,``)};function ne(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 re=Object.prototype,ie=re.hasOwnProperty,ae=re.toString,D=Array.isArray||function(e){return ae.call(e)===`[object Array]`},O=e=>typeof e==`function`,k=e=>e===Object(e)&&!D(e),A=e=>{if(k(e)){for(let t in e)if(ie.call(e,t))return!1;return!0}return!1},j=e=>e===void 0,M=e=>ae.call(e)==`[object String]`,oe=e=>M(e)&&e.trim().length===0,N=e=>e===null,P=e=>j(e)||N(e),F=e=>ae.call(e)==`[object Number]`&&e==e,se=e=>F(e)&&e>0,I=e=>ae.call(e)===`[object Boolean]`,ce=e=>T(w,e),le=e=>T(ee,e);function ue(e){return typeof e!=`object`||!e}function de(e,t){return{}.toString.call(e)===`[object ${t}]`}function fe(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 me(e,Error)}}function pe(e){return`u`>typeof Event&&me(e,Event)}function me(e,t){try{return e instanceof t}catch{return!1}}var he=[!0,`true`,1,`1`,`yes`],ge=e=>T(he,e),_e=[!1,`false`,0,`0`,`no`];function ve(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){ve(a,r,i,o,s,`next`,e)}function s(e){ve(a,r,i,o,s,`throw`,e)}o(void 0)})}}var ye=`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(`,`),be=function(e,t=[]){if(!e)return!1;let n=e.toLowerCase();return ye.concat(t).some(e=>{let t=e.toLowerCase();return n.indexOf(t)!==-1})};function xe(e,t,n,r,i){return t>n&&(r.warn(`min cannot be greater than max.`),t=n),F(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),xe(i??n,t,n,r))}var Se=class{constructor(e){this.C={},this.I=e.I,this.R=xe(e.bucketSize,0,100,e.$),this.A=xe(e.refillRate,0,this.R,e.$),this.O=xe(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={}}},Ce=`Mobile`,we=`Android`,Te=`Tablet`,Ee=`Android Tablet`,De=`iPad`,Oe=`Apple Watch`,ke=`Safari`,Ae=`BlackBerry`,je=`Samsung Internet`,Me=`Chrome`,Ne=`Chrome iOS`,Pe=`Internet Explorer`,Fe=`Internet Explorer Mobile`,Ie=`Opera`,Le=`Microsoft Edge`,Re=`Firefox`,ze=`Firefox iOS`,Be=`Nintendo`,Ve=`PlayStation`,He=`Xbox`,Ue=`Android Mobile`,We=`Mobile Safari`,Ge=`Windows`,Ke=`Windows Phone`,qe=`Nokia`,Je=`Ouya`,Ye=`Generic `+Ce.toLowerCase(),Xe=`Generic `+Te.toLowerCase(),Ze=`Konqueror`,Qe=`Oculus Browser`,$e=`Vivaldi`,et=`Yandex`,tt=`Whale`,nt=`DuckDuckGo`,rt=`Pale Moon`,it=`Waterfox`,at=`Brave`,ot=`Claude`,st=`Codex`,ct=`ChatGPT`,lt=`Google Search App`,ut=RegExp(`Version/(\\d+(\\.\\d+)?)`),dt=RegExp(`(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)`),ft=new RegExp(He,`i`),pt=RegExp(`PlayStation \\w+`,`i`),mt=RegExp(`Nintendo \\w+`,`i`),ht=RegExp(`BlackBerry|PlayBook|BB10`,`i`),gt={"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`},_t=function(e,t,n,r){return t||=``,function(e){return e?.brave?at:null}(n)||(r?.detectGoogleSearchApp&&T(e,`GSA/`)?lt:T(e,` OPR/`)&&T(e,`Mini`)?`Opera Mini`:T(e,` OPR/`)?Ie:ht.test(e)?Ae:T(e,`IEMobile`)||T(e,`WPDesktop`)?Fe:T(e,`OculusBrowser`)?Qe:T(e,`SamsungBrowser`)?je:T(e,`Edge`)||T(e,`Edg/`)?Le:T(e,`Vivaldi/`)?$e:T(e,`YaBrowser/`)?et:T(e,`Whale/`)?tt:T(e,`DuckDuckGo/`)||T(e,`Ddg/`)?nt:T(e,`Claude/`)?ot:T(e,`Codex/`)?st:T(e,`ChatGPT/`)?ct:T(e,`FBIOS`)?`Facebook Mobile`:T(e,`UCWEB`)||T(e,`UCBrowser`)?`UC Browser`:T(e,`CriOS`)?Ne:T(e,`CrMo`)||T(e,Me)?Me:T(e,we)&&T(e,ke)?Ue:T(e,`FxiOS`)?ze:T(e.toLowerCase(),Ze.toLowerCase())?Ze:T(e,`Brave/`)?at:((e,t)=>t&&T(t,`Apple`)||function(e){return T(e,ke)&&!T(e,Me)&&!T(e,we)}(e))(e,t)?T(e,Ce)?We:ke:T(e,`PaleMoon/`)?rt:T(e,`Waterfox/`)?it:T(e,Re)?Re:T(e,`MSIE`)||T(e,`Trident/`)?Pe:T(e,`Gecko`)?Re:``)},vt={[Fe]:[RegExp(`rv:(\\d+(\\.\\d+)?)`)],[Le]:[RegExp(`Edge?\\/(\\d+(\\.\\d+)?)`)],[Me]:[RegExp(`(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)`)],[Ne]:[RegExp(`CriOS\\/(\\d+(\\.\\d+)?)`)],"UC Browser":[RegExp(`(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)`)],[ke]:[ut],[We]:[ut],[Ie]:[RegExp(`(Opera|OPR)\\/(\\d+(\\.\\d+)?)`)],[Re]:[RegExp(`Firefox\\/(\\d+(\\.\\d+)?)`)],[ze]:[RegExp(`FxiOS\\/(\\d+(\\.\\d+)?)`)],[Ze]:[RegExp(`Konqueror[:/]?(\\d+(\\.\\d+)?)`,`i`)],[Ae]:[RegExp(`BlackBerry (\\d+(\\.\\d+)?)`),ut],[Ue]:[RegExp(`android\\s(\\d+(\\.\\d+)?)`,`i`)],[je]:[RegExp(`SamsungBrowser\\/(\\d+(\\.\\d+)?)`)],[Qe]:[RegExp(`OculusBrowser\\/(\\d+(\\.\\d+)?)`)],[$e]:[RegExp(`Vivaldi\\/(\\d+(\\.\\d+)?)`)],[et]:[RegExp(`YaBrowser\\/(\\d+(\\.\\d+)?)`)],[tt]:[RegExp(`Whale\\/(\\d+(\\.\\d+)?)`)],[at]:[RegExp(`Brave\\/(\\d+(\\.\\d+)?)`)],[ot]:[dt],[st]:[dt],[ct]:[dt],[nt]:[RegExp(`(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)`)],[rt]:[RegExp(`PaleMoon\\/(\\d+(\\.\\d+)?)`)],[it]:[RegExp(`Waterfox\\/(\\d+(\\.\\d+)?)`)],[lt]:[RegExp(`GSA\\/(\\d+(\\.\\d+)?)`)],[Pe]:[RegExp(`(rv:|MSIE )(\\d+(\\.\\d+)?)`)],Mozilla:[RegExp(`rv:(\\d+(\\.\\d+)?)`)]},yt=function(e,t,n,r){let i=vt[_t(e,t,n,r)];if(j(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},bt=[[RegExp(`Xbox; Xbox (.*?)[);]`,`i`),e=>[He,e&&e[1]||``]],[new RegExp(Be,`i`),[Be,``]],[new RegExp(Ve,`i`),[Ve,``]],[ht,[Ae,``]],[new RegExp(Ge,`i`),
1(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Ke,``];if(new RegExp(Ce).test(t)&&!/IEMobile\b/.test(t))return[`Windows Mobile`,``];let n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){let e=gt[n[1]]||``;return/arm/i.test(t)&&(e=`RT`),[Ge,e]}return[Ge,``]}],[/((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=j(e[2])?e[3]:e[2]),[`watchOS`,t]}],[RegExp(`(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)`,`i`),e=>e&&e[2]?[we,[e[2],e[3],e[4]||`0`].join(`.`)]:[we,``]],[/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`,``]]],xt=function(e){for(let t=0;bt.length>t;t++){let[n,r]=bt[t],i=n.exec(e),a=i&&(O(r)?r(i,e):r);if(a)return a}return[``,``]},St=function(e){return mt.test(e)?Be:pt.test(e)?Ve:ft.test(e)?He:new RegExp(Je,`i`).test(e)?Je:RegExp(`(Windows Phone|WPDesktop)`,`i`).test(e)?Ke:/iPad/.test(e)?De:/iPod/.test(e)?`iPod Touch`:/iPhone/.test(e)?`iPhone`:/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?Oe:ht.test(e)?Ae:/(kobo)\s(ereader|touch)/i.test(e)?`Kobo`:new RegExp(qe,`i`).test(e)?qe:/(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(Ce).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)?we:Ee:RegExp(`(pda|Mobile)`,`i`).test(e)?Ye:new RegExp(Te,`i`).test(e)&&!RegExp(`Tablet pc`,`i`).test(e)?Xe:``},Ct=function(e,t){let n=St(e);return n===De||n===Ee||n===`Kobo`||n===`Kindle Fire`||n===Xe?Te:n===Be||n===He||n===Ve||n===Je?`Console`:n===Oe?`Wearable`:n?Ce:t?.userAgentDataPlatform===`Android`&&(t?.maxTouchPoints??0)>0?600>Math.min((r=t?.screenWidth)??0,(i=t?.screenHeight)??0)/((a=t?.devicePixelRatio)??1)?Ce:Te:`Desktop`;var r,i,a},wt=/\bFBAV\/(\d+(?:\.\d+)*)/i,Tt=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,`Instagram`],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,`Threads`],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,`Messenger`,wt],[/\bFBAN\/EMA\b/i,`Facebook Lite`,wt],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,`Facebook`,wt],[/\bLinkedInApp(?:\]?\/(\d+(?:\.\d+)*))?\b/i,`LinkedIn`],[/\bTwitter(?:Android| for (?:iPhone|iPad|Android))(?:\/(\d+(?:\.\d+)*))?\b/i,`Twitter`],[/\b(?:musical_ly|trill)(?:[_/](\d+\.\d+(?:\.\d+)*))?(?=\b|_)/i,`TikTok`,/\bapp_version\/(\d+(?:\.\d+)*)/i],[/\b(?:MicroMessenger|WeChat)\/(\d+(?:\.\d+)*)?/i,`WeChat`],[/\bLine\/(\d+(?:\.\d+)*)?/i,`Line`],[/\bGSA\/(\d+(?:\.\d+)*)?/i,`Google`],[/\[Pinterest\/(?:iOS|Android)\b|\bPinterest(?: for (?:Android(?: Tablet)?|iOS))?\/(\d+(?:\.\d+)*)/i,`Pinterest`],[/\b(?:WA4A|WAiOS)\/(\d+(?:\.\d+)*)?/i,`WhatsApp`],[/\bSnapchat[ /](\d+(?:\.\d+)*)?/i,`Snapchat`],[/\bBing(?:Web|Sapphire)\/(\d+(?:\.\d+)*)?/i,`Bing`],[/\bNAVER\(inapp; search;/i,`Naver`,/\bNAVER\(inapp; search;[^;)]*; (\d+(?:\.\d+)*)/i],[/\bKAKAOTALK[ /](\d+\.\d+(?:\.\d+)*)?/i,`KakaoTalk`]],Et=`[Truncated]`,Dt=`[Unserializable]`;function Ot(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 kt(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=Dt}Object.defineProperty(e,r,{value:n,enumerable:!0,writable:!0,configurable:!0})}return e}var At=3e5,jt=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,At);if(!t)return this.ts=n,void(this.es=n+r);this.es=Math.max(this.es,Math.min(n+r,this.ts+At))}remainingMs(){let e=Date.now();if(this.ts-5e3>e)return this.reset(),0;let t=Math.min(At,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}},Mt=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Nt(e,t){return typeof(n=e)==`string`&&Mt.test(n)?e:t();var n}function Pt(e,t){let n=Error(t);try{Object.defineProperty(n,"name",{value:e,writable:!0,enumerable:!0,configurable:!0})}catch{}return n}function Ft(e){return e&&e.split(`#`)[0]}function It(e){try{return e()}catch{return}}function Lt(e,t){let n=setTimeout(e,t);return n!=null&&n.unref&&n?.unref(),n}function Rt(e,t,n){return zt.apply(this,arguments)}
1function zt(){return(zt=L(function*(e,t,n){let r;try{return yield Promise.race([e,new Promise((e,i)=>{r=Lt(()=>{try{n?.(),e()}catch(e){i(e)}},t)})])}finally{clearTimeout(r)}})).apply(this,arguments)}var Bt,Vt,Ht;function Ut(e){let t=globalThis._posthogChunkIds;if(!t)return;let n=Object.keys(t);return Ht&&n.length===Vt||(Vt=n.length,Ht=n.reduce((n,r)=>{Bt||={};let i=Bt[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,Bt[r]=[a,o];break}}}return n},{})),Ht}function Wt(e){return Wt=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},Wt(e)}function Gt(e,t,n){return(t=function(e){var t=function(e){if(Wt(e)!=`object`||!e)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var n=t.call(e,`string`);if(Wt(n)!=`object`)return n;throw TypeError(`@@toPrimitive must return a primitive value.`)}return String(e)}(e);return Wt(t)==`symbol`?t:t+``}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Kt(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?Kt(Object(n),!0).forEach(function(t){Gt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Kt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var qt=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&&D(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.skipFirstLines: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:Ut(this.stackParser),skipFirstLines:e.skipFirstLines??1}}getAggregateErrors(e){try{if(fe(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 D(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)})}},Jt=/^([a-z][a-z0-9.+-]+):/i,Yt=[`http`,`https`,`file`,`blob`,`app`,`capacitor`,`ionic`,`webpack`,`webpack-internal`,`ng`];function Xt(e){if(!e||e===`<anonymous>`)return!1;let t=Jt.exec(e);return!t||Yt.includes(t[1].toLowerCase())}function Zt(e,t,n,r,i){let a={platform:e,filename:t,function:n===`<anonymous>`?`?`:n,in_app:Xt(t)}
1;return j(r)||(a.lineno=r),j(i)||(a.colno=i),a}var Qt=(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]},$t=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,en=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,tn=/\((\S*)(?::(\d+))(?::(\d+))\)/,nn=(e,t)=>{let n=$t.exec(e);if(n){let[,e,r,i]=n;return Zt(t,e,`?`,+r,+i)}let r=en.exec(e);if(r){if(r[2]&&r[2].indexOf(`eval`)===0){let e=tn.exec(r[2]);e&&(r[2]=e[1],r[3]=e[2],r[4]=e[3])}let[e,n]=Qt(r[1]||`?`,r[2]);return Zt(t,n,e,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},rn=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,an=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,on=(e,t)=>{let n=rn.exec(e);if(n){if(n[3]&&n[3].indexOf(` > eval`)>-1){let e=an.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]=Qt(r,e),Zt(t,e,r,n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},sn=/\(error: (.*)\)/;function cn(e,t){return e.filename===t.filename&&e.function===t.function&&e.module===t.module&&e.lineno===t.lineno&&e.colno===t.colno}function ln(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(!cn(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 un(e,t){let n=t.start+t.length,r=fn(e,t);r&&e.splice(n+r===e.length?n:t.start,r)}function dn(e,t){let n=t.start;for(;n>0&&cn(e[n-1],e[n-1+t.length]);)n--;return t.start-n}function fn(e,t){let n=t.start+t.length,r=n;for(;e.length>r&&cn(e[r],e[r-t.length]);)r++;return r-n}function pn(e,t){let n=t[0],r=e.length-(n?dn(e,n):0);for(let n of t)r-=fn(e,n);return r}function mn(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 hn=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){let n=M(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 de(e,`DOMException`)}isDOMError(e){return de(e,`DOMError`)}},gn=class{match(e){return fe(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}}},_n=class{match(e){return!!de(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 M(e.message)&&e.message.length>0}cr(e){let t=e,n=t.lineno??0,r=t.colno??0;if(M(t.filename)&&t.filename.length!==0&&n!==0)return`Error\n    at ${t.filename}:${n}:${r}`}},vn=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,yn=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(vn);return r&&(t=r[1],n=r[2]),[t,n]}},bn=[`fatal`,`error`,`warning`,`log`,`info`,`debug`];function xn(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 Sn=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(pe(e))return e.constructor.name;let t=`name`in e?e.name:void 0;return M(t)&&!oe(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: ${xn(e)}`}isSeverityLevel(e){return M(e)&&!oe(e)&&bn.indexOf(e)>=0}getStack(e){try{return M(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:M(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(fe(n))return n}}getObjectClassName(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},Cn=class{match(e){return pe(e)}coerce(e,t){let n=e.constructor.name;return{type:n,value:`${n} captured as exception with keys: ${xn(e)}`,stack:t.syntheticException?.stack,synthetic:!0}}},wn=class{match(e){return ue(e)}coerce(e,t){return{type:`Error`,value:`Primitive value captured as exception: ${String(e)}`,stack:t.syntheticException?.stack,synthetic:!0}}},Tn=class{match(e){return de(e,`PromiseRejectionEvent`)||this.isCu
1stomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!pe(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 ue(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}},En=`$message`,Dn=`$timestamp`,On=new Set([En,Dn]),kn={enabled:!0,max_bytes:32768};function An(e){return e?{enabled:e.enabled??kn.enabled,max_bytes:Mn(e.max_bytes,kn.max_bytes)}:R({},kn)}var jn=class{constructor(e){this.ns=[],this.ss=0,this.Ir=An(e)}setConfig(e){this.Ir=An(e),this.rs()}add(e){let t=function(e){let t;try{t=ne(e)}catch{return}try{let e=JSON.parse(t);if(!k(e))return;let n=e,r=n[En],i=n[Dn];return!M(r)||r.trim().length===0||!M(i)&&!F(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 Mn(e,t){if(!F(e)||1/0===e||-1/0===e)return t;let n=Math.floor(e);return 0>n?t:n}var Nn=e=>{if(typeof e!=`string`)return e;try{return JSON.parse(e)}catch{return e}};function Pn(e){return typeof e==`string`||e}function Fn(e){return typeof e==`string`?e:void 0}var In=`$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(`.`),Ln=`NativeGzipValidationError`,Rn=e=>e.length>=2&&e[0]===31&&e[1]===139,zn=(e,t)=>e===C.GZipJS||t===C.GZipJS||t===`gzip`,Bn=e=>!(!e||typeof e!=`object`)&&(`name`in e?String(e.name):``)===`NotReadableError`,Vn,Hn=e=>{throw Pt(Ln,`Native gzip produced invalid output: ${e}`)},Un=(Wn=L(function*(e,t){18>e.size&&Hn(`too-short`);let n=new Uint8Array(yield e.slice(0,10).arrayBuffer());Rn(n)&&n[2]===8||Hn(`invalid-header`);let r=new DataView(yield e.slice(e.size-8).arrayBuffer());r.getUint32(0,!0)!==(e=>{let t=(()=>{if(Vn)return Vn;Vn=[];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;Vn[e]=t>>>0}return Vn})(),n=4294967295;for(let r=0;e.length>r;r++)n=t[255&(n^e[r])]^n>>>8;return(4294967295^n)>>>0})(t)&&Hn(`invalid-crc`);let i=t.length>>>0;r.getUint32(4,!0)!==i&&Hn(`invalid-size`)}),function(e,t){return Wn.apply(this,arguments)}),Wn;function Gn(){return Gn=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 Un(s,t),s}catch(e){if(n?.rethrow)throw e;return t&&console.error(`Failed to gzip compress data`,e),null}var r}),Gn.apply(this,arguments)}function Kn(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 qn={}.propertyIsEnumerable;function Jn(e,t){try{return Zn(e,t,{ancestors:new WeakSet,remainingNodes:1e4}
1,0)}catch{return[]}}function Yn(e,t,n,r){if(0>=n.remainingNodes)return{stringValue:Et};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:Ot(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:Et};if(e instanceof Date){let t=e.getTime(),n=Number.isFinite(t)?e.toISOString():String(e);return{stringValue:typeof n==`string`?Ot(n):String(n)}}n.ancestors.add(e);try{try{let i=e.toJSON;if(typeof i==`function`)return Yn(i.call(e),t,n,r+1)}catch{}return D(e)?{arrayValue:{values:Xn(e,t,n,r+1)}}:{kvlistValue:{values:Zn(e,t,n,r+1)}}}finally{n.ancestors.delete(e)}}return{stringValue:Ot(String(e))}}function Xn(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(P(a))continue;i.push(Yn(a,t,n,r))}catch{i.push({stringValue:Dt})}return e.length>o&&i.push({stringValue:Et}),i}function Zn(e,t,n,r){let i=[];for(let a in e)if(qn.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(N(o)||j(o))continue;i.push({key:Ot(a),value:Yn(o,t,n,r)})}catch{i.push({key:Ot(a),value:{stringValue:Dt}})}}return i}function Qn(e,t,n){return R(R(R(R({},kt({},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 $n=[`service.name`,`deployment.environment`,`service.version`,`telemetry.sdk.name`,`telemetry.sdk.version`];function er(e,t){let n=kt({},e),r={};for(let e of $n)({}).hasOwnProperty.call(n,e)&&(r[e]=n[e],delete n[e]);return[...Jn(n,t),...Jn(r,t)]}var tr={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`},nr={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}},rr=nr.info;function ir(e){try{return Ot(String(e))}catch{return Dt}}function ar(e,t,n,r){let{text:i,number:a}=nr[e.level||`info`]||rr,o=function(e=Date.now()){return String(e)+`000000`}(F(r)?r:void 0),s={};t.distinctId&&(s.posthogDistinctId=t.distinctId),t.sessionId&&(s.sessionId=t.sessionId),t.windowId&&(s[`window.id`]=t.windowId),P(t.sessionStartTimestamp)||(s.sessionStartTimestamp=String(t.sessionStartTimestamp)),P(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=Dt}Object.defineProperty(c,t,{value:e,enumerable:!0,writable:!0,configurable:!0})}}let u={timeUnixNano:o,observedTimeUnixNano:o,severityNumber:a,severityText:i,body:{stringValue:ir(e.body)},attributes:Jn(c,n)};return e.trace_id&&(u.traceId=e.trace_id),e.span_id&&(u.spanId=e.span_id),j(e.trace_flags)||(u.flags=e.trace_flags),u}function or(e,t,n){return Qn(e,t,n)}function sr(e,t,n,r){return{resourceLogs:[{resource:{attributes:er(t)},scopeLogs:[{scope:{name:n,version:r},logRecords:e}]}]}}var cr=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=Lt(()=>{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 lr(){return .75+.5*Math.random()}function ur(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 dr=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 cr(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new jt,this.ks=0,this.Ss=1,this.xs=0,this.Cs=0,this.$s=!1,this.Ts=t.maxBufferSize,this.Is=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(S.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:ar(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=D(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;
1return L(function*(){e.ps.clear();let t=e._instance.getPersistedProperty(S.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=sr(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(S.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(S.LogsQueue)??[];t._instance.setPersistedProperty(S.LogsQueue,r.slice(n)),yield t.vs()})()}qs(){return or(this.Ir,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(e){if(this._instance.optedOut)return;let t=this._instance.getPersistedProperty(S.LogsQueue)??[];this.Is>t.length||(t.shift(),this.bs++,this.$.info(`Logs queue is full, dropping oldest record.`)),t.push(e),this._instance.setPersistedProperty(S.LogsQueue,t),this.Ts>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(ur(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){let e=this._instance.getPersistedProperty(S.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 Rt(n,e)})()}flushWithTimeout(e){var t=this;return L(function*(){let n=t.flush();yield Rt(n,e,()=>{n.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},e=>{this.ks++,this.Ss=lr(),this.$.error(`PostHog logs flush failed:`,e)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.Hs())})}},fr=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function pr(e){return String(e)+`000000`}function mr(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 hr=class{constructor(e,t,n){this._instance=e,this.Ir=t,this.$=n,this.zs=new Map,this.ps=new cr(()=>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 jt,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})}gauge(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=mr(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(fr.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,fr)]+=1;break}}}Os(e){let t=this.Ir.beforeSend;if(!t)return e;let n=D(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(ur(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=lr()):(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 Qn(e,t,n)}(this.Ir,this._instance.getLibraryId(),this._instance.getLibraryVersion()),r
1=this._instance.getLibraryId(),i=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:er(n)},scopeMetrics:[{scope:{name:r,version:i},metrics:t}]}]};var t,n,r,i}uo(e){let t=pr(Date.now()),n=new Map;for(let r of e.values()){let e=mr(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=Jn(r.attributes??{},this.$),o=pr(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:fr})}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)}}},gr=(e,{debugEnabled:t}={})=>{let n={N(n,...r){s&&(x.DEBUG||s.POSTHOG_DEBUG||t)&&!j(s.console)&&s.console&&(`__rrweb_original__`in s.console[n]?s.console[n].__rrweb_original__:s.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)=>gr(`${e} ${t}`,n)};return n},z=gr(`[PostHog.js]`),B=z.createLogger,_r=B(`[ExternalScriptsLoader]`),vr=e=>{let t=u?.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]}},yr=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return _r.warn(`${t} was requested but loading of external scripts is disabled.`),n(`Loading of external scripts is disabled`);let r=vr(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(!u)return n(`document not found`);if(vr(t))return yr(e,t,n);let r=u.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`)u.head.appendChild(r);else{let e=u.querySelectorAll(`body > script`);var i;e.length>0?(i=e[0].parentNode)==null||i.insertBefore(r,e[0]):u.body.appendChild(r)}};u?.body?i():u?.addEventListener(`DOMContentLoaded`,i)},br={},xr=(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)};y.__PosthogExtensions__=y.__PosthogExtensions__||{},y.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{if(t===`remote-config`){yr(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=br[i];if(r===`fallback`&&a){if(vr(a))return void yr(e,a,n);delete br[i]}yr(e,i,r===`fallback`?(r,a)=>{if(r){if(typeof r==`string`)n(r);else{var o;let r=xr(e,t);br[i]=r;let a=vr(i);a==null||(o=a.parentNode)==null||o.removeChild(a),yr(e,r,n)}}else n(void 0,a)}:n);return}yr(e,xr(e,t),n)},y.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{yr(e,e.requestRouter.endpointFor(`api`,t),n)},x.DEBUG=!1,x.LIB_VERSION=`1.434.2`,x.LIB_NAME=`web`;var V=x,Sr=`$people_distinct_id`,Cr=`distinct_id`,wr=`$device_id`,Tr=`$device_model`,Er=`__alias`,Dr=`__cmpns`,Or=`$fbc`,kr=`$fbc_persistence`,Ar=`$fbp`,jr=`$fbp_persistence`,Mr=`__timers`,Nr=`$autocapture_disabled_server_side`,Pr=`$heatmaps_enabled_server_side`,Fr=`$exception_capture_enabled_server_side`,Ir=`$error_tracking_suppression_rules`,Lr=`$error_tracking_capture_extension_exceptions`,Rr=`$web_vitals_enabled_server_side`,zr=`$dead_clicks_enabled_server_side`,Br=`$product_tours_enabled_server_side`,Vr=`$logs_capture_enabled_server_side`,Hr=`$web_vitals_allowed_metrics`,Ur=`$session_recording_remote_config`,Wr=`$session_recording_enabled_server_side`,Gr=`$replay_sample_rate`,Kr=`$replay_override_sampling`,qr=`$replay_override_linked_flag`,Jr=`$replay_override_url_trigger`,Yr=`$replay_override_event_trigger`,Xr=`$sesid`,Zr=`$session_is_sampled`,Qr=`$session_past_minimum_duration`,$r=`$session_recording_url_trigger_activated_session`,ei=`$session_recording_event_trigger_activated_session`,ti=`$debug_first_full_snapshot_timestamp`,ni=`$sess_rec_flush_size`,ri=`$enabled_feature_flags`,ii=`$active_feature_flags`,ai=`$early_access_features`,oi=`$feature_flag_details`,si=`$feature_flag_payloads`,ci=`$feature_flag_request_id`,li=`$minimal_flag_called_events`,ui=`$override_feature_flags`,di=`$override_feature_flag_payloads`,fi=`$stored_person_properties`,pi=`$stored_group_properties`,mi=`$groups`,hi=`$surveys`,gi=`$surveys_loaded_at`,_i=`$surveys_activated`,vi=`$surveys_activated_session`,yi=`$surveys_activated_timestamps`,bi=`ph_product_tours`,xi=`$product_tours_activated`,Si=`$product_tours_activated_session`,Ci=`$conversations_widget_session_id`,wi=`$conversations_ticket_id`,Ti=`$conversations_widget_state`,Ei=`$conversations_user_traits`,Di=`$flag_call_reported`,Oi=`$flag_call_reported_session_id`,ki=`$feature_flag_errors`,Ai=`$feature_flag_evaluated_at`,H=`$user_state`,ji=`$client_session_props`,Mi=`$capture_rate_limit`,Ni=`$initial_campaign_params`,Pi=`$initial_referrer_info`,Fi=`$initial_person_info`,Ii=`$epp`,Li=`$posthog_cookieless`,Ri=`$cookieless_mode`,zi=`$sdk_debug_extensions_init_method`,Bi=`$sdk_debug_extensions_init_time_ms`,Vi=`$sdk_debug_recording_script_not_loaded`,Hi=`$sdk_debug_replay_stale_config`,Ui=`$sdk_debug_replay_event_trigger_status`,W
1i=`$sdk_debug_replay_linked_flag_trigger_status`,Gi=`$sdk_debug_replay_matched_recording_trigger_groups`,Ki=`$sdk_debug_replay_pending_trigger_conditions`,qi=`$sdk_debug_replay_remote_trigger_matching_config`,Ji=`$sdk_debug_replay_trigger_groups_count`,Yi=`$sdk_debug_replay_url_trigger_status`,Xi=`$session_recording_start_reason`,Zi=`PostHog loadExternalDependency extension not found.`,Qi=`anonymous`,$i=`identified`,ea=`identified_only`,ta=`visibilitychange`,na=`beforeunload`,ra=`$pageview`,ia=`$pageleave`,aa=`$identify`,oa=`$groupidentify`;function sa(e,t){D(e)&&e.forEach(t)}function U(e,t){if(!P(e)){if(D(e))e.forEach(t);else if((e=>e instanceof FormData)(e))e.forEach((e,n)=>t(e,n));else for(let n in e)ie.call(e,n)&&t(e[n],n)}}var W=function(e,...t){for(let n of t)for(let t in n)n[t]!==void 0&&(e[t]=n[t]);return e};function ca(e){let t=Object.keys(e),n=t.length,r=Array(n);for(;n--;)r[n]=[t[n],e[t[n]]];return r}var la=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)}}},ua=function(e){let t={};return U(e,function(e,n){(M(e)&&e.length>0||F(e))&&(t[n]=e)}),t};function da(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 fa=[`herokuapp.com`,`vercel.app`,`netlify.app`];function pa(e){let t=e?.hostname;if(!M(t))return!1;let n=t.split(`.`).slice(-2).join(`.`);for(let e of fa)if(n===e)return!1;return!0}function G(e,t,n,r){let{capture:i=!1,passive:a=!0}=r??{};e?.addEventListener(t,n,{capture:i,passive:a})}function ma(e){return e.name===`ph_toolbar_internal`}var ha=e=>{if(u){try{let t=e+`=`,n=u.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 F(e)&&isFinite(e)&&Math.floor(e)===e});var ga=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}},_a=class{generate(){let e=this.generateOrAbort();if(!j(e))return e;{this.Ct=0;let e=this.generateOrAbort();if(j(e))throw Error(`Could not generate UUID after timestamp reset`);return e}}generateOrAbort(){let e=(()=>{let e=Date.now();return F(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 ga.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 ya}},va=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};s&&!j(s.crypto)&&crypto.getRandomValues&&(va=e=>crypto.getRandomValues(e));var ya=class{nextUint32(){return this.Rt.length>this.$t||(va(this.Rt),this.$t=0),this.Rt[this.$t++]}constructor(){this.Rt=new Uint32Array(8),this.$t=1/0}},ba,xa=()=>Sa().toString(),Sa=()=>(ba||=new _a).generate(),Ca=``,wa=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,Ta=null,K={Et(){if(!N(Ta))return Ta;if(Ta=!1,u)try{let e=`__ph_cookie_support_${xa()}`;K.At(e,`xyz`),Ta=ha(e)===`"xyz"`,K.Lt(e)}catch{Ta=!1}return Ta},Pt(e){z.error(`cookieStore error: `+e)},Ot:ha,Dt(e){let t;try{t=JSON.parse(K.Ot(e))||{}}catch{}return t},At(e,t,n,r,i){if(!u)return!1;try{let a=``,o=``,s=function(e,t){if(t){let t=function(e,t=u){if(Ca)return Ca;if(!t||[`localhost`,`127.0.0.1`].includes(e))return``;let n=e.split(`.`),r=Math.min(n.length,8),i=`dmn_chk_`+xa();for(;!Ca&&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`,Ca=e)}return Ca}(e);if(!t){let n=(e=>{let t=e.match(wa);return t?t[0]:``})(e);n!==t&&z.info(`Warning: cookie subdomain discovery mismatch`,n,t),t=n}return t?`; domain=.`+t:``}return``}(u.location.hostname,r);if(n){let e=new Date;e.setTime(e.getTime()+864e5*n),a=`; expires=`+e.toUTCString()}i&&(o=`; secure`);let c=e+`=`+encodeURIComponent(JSON.stringify(t))+a+`; SameSite=Lax; path=/`+s+o;return c.length>3686.4&&z.warn(`cookieStore warning: large cookie, len=`+c.length),u.cookie=c,!0}catch{return!1}},Lt(e,t){if(u?.cookie)try{K.At(e,``,-1,t)}catch{return}}},Ea=null,q={Et(){if(!N(Ea))return Ea;let e=!0;if(j(s))e=!1;else try{let t=`__mplssupport__`;q.At(t,`xyz`),q.Ot(t)!==`"xyz"`&&(e=!1),q.Lt(t)}catch{e=!1}return e||z.error(`localStorage unsupported; falling back to cookie store`),Ea=e,e},Pt(e){z.error(`localStorage error: `+e)},Ot(e){try{return s?.localStorage.getItem(e)}catch(e){q.Pt(e)}return null},Dt(e){try{return JSON.parse(q.Ot(e))||{}}catch{}return null},At(e,t){try{return s?.localStorage.setItem(e,JSON.stringify(t)),!0}catch(e){q.Pt(e)}return!1},Lt(e){try{s?.localStorage.removeItem(e)}catch(e){q.Pt(e)}}},Da=[fi,ii,ri,oi,si,ci,Ai,ki,Di],Oa=[wr,Cr,Xr,Zr,Ii,Fi,kr,H],ka=e=>e+`_cpm`,Aa=[`__proto__`,`constructor`,`prototype`],ja=e=>{if(!k(e))return{};let t={};return Object.keys(e).forEach(n=>{Aa.indexOf(n)===-1&&(t[n]=e[n])}),t},Ma=(e,t=[])=>{let n={};return[...Oa,...t].forEach(t=>{let r=e[t];j(r)||N(r)||r===``||(n[t]=r)}),n},Na=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)},Pa=(e,t)=>({p:t,f:Na(JSON.stringify(e))}),Fa=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{let n=K.Dt(ka(e)),r=n?.f===Na(t)&&D(n.p);return{properties:r?n.p:[],isValid:r}}catch{return{properties:[],isValid:!1}}},Ia=(e,t)=>t+`|`+(K.Ot(ka(e))||``),La={},Ra={Et:()=>!0,Pt(e){z.error(`memoryStorage error: `+e)},Ot:e=>e in La?La[e]:null,Dt:e=>e in La?La[e]:null,At:(e,t)=>(La[e]=t,!0),Lt(e){delete La[e]}},za=null,J={Et(){if(!N(za))return za;if(za=!0,j(s))za=!1;else try{let e=`__support__`;J.At(e,`xyz`),J.Ot(e)!==`"xyz"`&&(za=!1),J.Lt(e)}catch{za=!1}return za},Pt(e){z.error(`sessionStorage error: `,e)},Ot(e){try{return s?.sessionStorage.getItem(e)}catch(e){J.Pt(e)}return null},Dt(e){try{return JSON.parse(J.Ot(e))||null}catch{}return null},At(e,t){try{return s?.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(e){J.Pt(e)}return!1},Lt(e){try{s?.sessionStorage.removeItem(e)}catch(e){J.Pt(e)}}},Ba=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 ge(e)?1:T(_e,e)?0:-1}get Oo(){let e=this.Ir.opt_out_capturing_persistence_type,t=e===`localStorage`?q:K,n=t.Et()?t:Ra;if(!this.Lo||this.Lo!==n){this.Lo=n;let t=e===`localStorage`?K:q;t.Ot(this.Do)&&(this.Lo.Ot(this.Do)||this.optInOut(ge(t.Ot(this.Do))),t.Lt(this.Do,this.Ir.cross_subdomain_cookie))}return this.Lo}Ao(){return!!this.Ir.respect_dnt&&[l?.doNotTrack,l?.msDoNotTrack,y.doNotTrack,l?.globalPrivacyControl].some(e=>ge(e))}};function Va(e,t){var n;let r=e==null||(n=e.config)==null?void 0:n.get_current_url;if(!O(r))return t;try{let e=r(t);return M(e)&&e?e:t}catch(e){return z.error(`Error in get_current_url, falling back to window.location.href`,e),t}}function Ha(e){return e instanceof Element&&(e.id===`__POSTHOG_TOOLBAR__`||!!e.closest?.call(e,`.toolbar-global-fade-container`))}function Ua(e){return!!e&&e.nodeType===1}function Y(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function Wa(e){return!!e&&e.nodeType===3}function Ga(e){return!!e&&e.nodeType===11&&Ua(e.host)}function Ka(e){return e?te(e).split(/\s+/):[]}function qa(e,t){let n=function(e){var t;let n=s==null||(t=s.location)==null?void 0:t.href;return j(n)?void 0:Va(e,n)}(t);return!!(n&&e&&e.some(e=>n.match(e)))}function Ja(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 Ka(t)}function Ya(e){return P(e)?null:te(e).split(/(\s+)/).filter(e=>xo(e)).join(``).replace(/[\r\n]/g,` `).replace(/[ ]+/g,` `).substring(0,255)}function Xa(e){let t=``;return fo(e)&&!po(e)&&e.childNodes&&e.childNodes.length&&U(e.childNodes,function(e){Wa(e)&&e.textContent&&(t+=Ya(e.textContent)??``)}),te(t)}function Za(e){return j(e.target)?e.srcElement||null:e.target?.shadowRoot?e.composedPath()[0]||null:e.target||null}var Qa=[`a`,`button`,`form`,`input`,`select`,`textarea`,`label`];function $a(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 eo(e,t){if(j(t))return!0;for(let n of e)if(t.some(e=>$a(n,e)))return!0;return!1}function to(e){let t=e.parentNode;return!(!t||!Ua(t))&&t}var no=[`.ph-no-autocapture`,`[data-ph-no-autocapture]`],ro=[`next`,`previous`,`prev`,`>`,`<`],io=[...ro,`+`,`-`,`−`,`–`],ao=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,oo=[`.ph-no-rageclick`,`.ph-no-capture`],so=[``,`text`,`search`,`email`,`password`,`url`,`tel`,`number`];function co(e,t){if(!s||lo(e))return!1;let n,r,i;var a;if(I(t)?(n=!!t&&oo,r=void 0,i=!1):(n=t?.css_selector_ignorelist??oo,r=t?.content_ignorelist,i=(a=t?.ignore_text_selection)!=null&&a),!1===n||i&&function(e){return!(!e||!Ua(e))&&(!!Y(e,`textarea`)||(Y(e,`input`)?T(so,(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:o}=uo(e,!1);return!function(e,t){if(!1===e||j(e))return!1;let n;if(!0===e)n=ro;else{if(!D(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=>ao(e,n)||ao(t,n)))}(r,o.map(e=>({safeText:Xa(e).toLowerCase(),ariaLabel:e.getAttribute(`aria-label`)?.toLowerCase().trim()||``})))&&!eo(o,n)}var lo=e=>!e||Y(e,`html`)||!Ua(e),uo=(e,t)=>{if(!s||lo(e))return{parentIsUsefulElement:!1,targetElementList:[]};let n=!1,r=[e],i=e;for(;i.parentNode&&!Y(i,`body`);){if(Ga(i.parentNode)){r.push(i.parentNode.host),i=i.parentNode.host;continue}let e=to(i);if(!e)break;if(t||Qa.indexOf(e.tagName.toLowerCase())>-1)n=!0;else try{let t=s.getComputedStyle(e);t&&t.getPropertyValue(`cursor`)===`pointer`&&(n=!0)}catch{}r.push(e),i=e}return{parentIsUsefulElement:n,targetElementList:r}};function fo(e){let t=new Set,n=0;for(let r=e;r.parentNode&&!Y(r,`body`);r=r.parentNode){if(n++>=1e3||t.has(r))return!1;t.add(r);let e=Ja(r);if(T(e,`ph-sensitive`)||T(e,`ph-no-capture`))return!1}if(T(Ja(e),`ph-include`))return!0;let r=e.type||``;if(M(r))switch(r.toLowerCase()){case`hidden`:case`password`:return!1}
1let i=e.name||e.id||``;return!M(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 po(e){return!!(Y(e,`input`)&&![`button`,`checkbox`,`submit`,`reset`].includes(e.type)||Y(e,`select`)||Y(e,`textarea`)||e.getAttribute(`contenteditable`)===`true`)}var mo=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}))$`),ho=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,go=[16,15,14,13],_o=RegExp(`^(\\d{3}-?\\d{2}-?\\d{4})$`),vo=RegExp(`(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))`,`g`),yo=/[0-9A-Za-z_]/;function bo(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 xo(e,t=!0){return!(P(e)||M(e)&&(e=te(e),(t?mo.test((e||``).replace(/[- ]/g,``)):function(e){let t;for(ho.lastIndex=0;t=ho.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 go){let r=e+t;if(n.length>=r){let t=n.slice(e,r);if(mo.test(t)&&bo(t))return!0}}}return!1}(e))||(t?_o.test(e):function(e){let t;for(vo.lastIndex=0;t=vo.exec(e);){let e=t[1],n=t[3];if(!(e&&n&&yo.test(e)&&yo.test(n)))return!0}return!1}(e))))}function So(e){let t=Xa(e);return t=`${t} ${Co(e)}`.trim(),xo(t)?t:``}function Co(e){let t=``;return e&&e.childNodes&&e.childNodes.length&&U(e.childNodes,function(e){if(e&&e.tagName?.toLowerCase()===`span`)try{let n=Xa(e);t=`${t} ${n}`.trim(),e.childNodes&&e.childNodes.length&&(t=`${t} ${Co(e)}`.trim())}catch(e){z.error(`[AutoCapture]`,e)}}),t}function wo(e){return e.replace(/"|\\"/g,`\\"`)}function To(e){let t=e.attr__class;if(t)return D(t)?t:Ka(t)}var Eo=B(`[Dead Clicks]`),Do=()=>!0,Oo=e=>{let t=!!e.instance.persistence?.get_property(zr),n=e.instance.config.capture_dead_clicks;return I(n)?n:!!k(n)||t},ko=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({[zr]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.qo(()=>{this.jo()}):this.stop()}qo(e){var t,n;y.__PosthogExtensions__?.initDeadClicksAutocapture?e():(t=y.__PosthogExtensions__)==null||(n=t.loadExternalDependency)==null||n.call(t,this.instance,`dead-clicks-autocapture`,t=>{t?Eo.error(`failed to load script`,t):e()})}jo(){if(u){if(!this.No&&y.__PosthogExtensions__?.initDeadClicksAutocapture){let e=k(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=y.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,e),this.No.start(u),Eo.info(`starting...`)}}else Eo.error("`document` not found. Cannot start.")}stop(){this.No&&(this.No.stop(),this.No=void 0,Eo.info(`stopping...`))}},Ao=B(`[SegmentIntegration]`);function jo(e,t,n=!0){let r=e.config.segment;if(!r)return t();let{analytics:i,filterProperties:a}=(e=>O(e.register))(o=r)?{analytics:o}:o;var o;(function(e,t,n,r){let i=t=>{let i=()=>t.anonymousId()||xa();e.config.get_device_id=i,r&&t.id()&&(e.register({distinct_id:t.id(),$device_id:i()}),e.persistence.set_property(H,$i)),n(r?void 0:t.anonymousId()||void 0)},a=t.user();`then`in a&&O(a.then)?a.then(i):i(a)})(e,i,n=>{i.register(((e,t,{filterProperties:n}={})=>{typeof Promise<`u`&&Promise.resolve||Ao.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()||(Ao.info(`No userId set, resetting PostHog`),e.reset()),a||(t=void 0),r.event.userId&&r.event.userId!==e.get_distinct_id()&&(Ao.info(`UserId set, identifying with PostHog`),e.identify(r.event.userId)
1);let o=e.calculateEventProperties(i,r.event.properties);if(!P(n)){let e=r.event.properties||{},t={};for(let n of Object.keys(o))ie.call(e,n)||(t[n]=o[n]);let i=((e,t)=>{let n=D(e)?e:[e],r=R({},t);for(let e of n)try{if(r=e(r),P(r))return null}catch(e){return Ao.error(`Error in Segment filterProperties:`,e),null}return r})(n,t);if(P(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,ra)},identify(e){return r(e,aa)},screen(e){return r(e,`$screen`)}}})(e,n,{filterProperties:a})).then(()=>{t()},e=>{Ao.error(`Failed to register the Segment integration`,e),t()})},n)}var Mo=`posthog-js`;function No(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 Po=class{constructor(e,t,n,r,i,a){this.name=Mo,this.setupOnce=function(o){o(No(e,{organization:t,projectId:n,prefix:r,severityAllowList:i,sendExceptionsToPostHog:a==null||a}))}}},Fo=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:s?.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(!(j(e)||j(t)||j(n)||j(a)||j(o)||j(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?xe(t/e,0,1,z):1,c=e>1?xe(n/e,0,1,z):1,l=a>1?xe(o/a,0,1,z):1,u=a>1?xe(s/a,0,1,z):1;r=W(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}},Io=[`flags`,`surveys`],Lo={[Sr]:{exposure:`hidden`},[Er]:{exposure:`hidden`},[Dr]:{exposure:`hidden`},[Mr]:{exposure:`hidden`},[kr]:{exposure:`hidden`},[jr]:{exposure:`hidden`},[Nr]:{exposure:`event`},[Pr]:{exposure:`hidden`},[Vr]:{exposure:`hidden`},[Fr]:{exposure:`event`},[Ir]:{exposure:`hidden`},[Lr]:{exposure:`event`},[Rr]:{exposure:`event`},[zr]:{exposure:`event`},[Br]:{exposure:`hidden`},[Hr]:{exposure:`event`},[Ur]:{exposure:`hidden`},[Wr]:{exposure:`hidden`},[Xr]:{exposure:`hidden`},[Zr]:{exposure:`event`},[Gr]:{exposure:`event`,shouldSkipFromEventProperties:e=>N(e)},[Qr]:{exposure:`event`},[$r]:{exposure:`event`}
1,[ei]:{exposure:`event`},[ti]:{exposure:`event`},[ni]:{exposure:`hidden`},[ri]:{exposure:`hidden`,storageGroup:`flags`},[ii]:{exposure:`hidden`,storageGroup:`flags`},[ai]:{exposure:`hidden`},[oi]:{exposure:`hidden`,storageGroup:`flags`},[si]:{exposure:`hidden`,storageGroup:`flags`},[ci]:{exposure:`hidden`,storageGroup:`flags`,volatile:!0},[li]:{exposure:`hidden`,storageGroup:`flags`},[ui]:{exposure:`hidden`},[di]:{exposure:`hidden`},[fi]:{exposure:`hidden`},[pi]:{exposure:`hidden`},[hi]:{exposure:`hidden`,storageGroup:`surveys`},[gi]:{exposure:`hidden`,storageGroup:`surveys`,volatile:!0},[_i]:{exposure:`event`},[vi]:{exposure:`hidden`},[yi]:{exposure:`hidden`},[bi]:{exposure:`hidden`},[xi]:{exposure:`hidden`},[Si]:{exposure:`hidden`},[Ci]:{exposure:`event`},[wi]:{exposure:`event`},[Ti]:{exposure:`event`},[Ei]:{exposure:`event`},[Di]:{exposure:`hidden`},[Oi]:{exposure:`hidden`},[mi]:{exposure:`event`},[ki]:{exposure:`hidden`},[Ai]:{exposure:`hidden`,storageGroup:`flags`,volatile:!0},[H]:{exposure:`hidden`},[ji]:{exposure:`hidden`},[Mi]:{exposure:`hidden`},[Ni]:{exposure:`hidden`},[Pi]:{exposure:`hidden`},[Fi]:{exposure:`hidden`},[Ii]:{exposure:`hidden`},[Kr]:{exposure:`event`},[qr]:{exposure:`event`},[Jr]:{exposure:`event`},[Yr]:{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`},[Ji]:{exposure:`event`},[Yi]:{exposure:`event`},[Xi]:{exposure:`event`}},Ro=[[`$posthog_sr_group_event_trigger_`,{exposure:`hidden`}],[`$posthog_sr_group_url_trigger_`,{exposure:`hidden`}],[`$posthog_sr_group_sampling_`,{exposure:`hidden`}]],X=e=>{let t=Lo[e];if(t)return t;for(let[t,n]of Ro)if(e.indexOf(t)===0)return n},zo=(e,t)=>{try{let n;return JSON.stringify(e,(e,t)=>fe(t)?(n??=new WeakMap,n.has(t)||n.set(t,da(t)),n.get(t)):typeof t==`bigint`?t.toString():t,t)}catch{return ne(e)}},Bo=e=>{let t=u?.createElement(`a`);return j(t)?null:(t.href=e,t)},Vo=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(!D(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,` `)}},Ho=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(`=`);D(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},Uo=function(e,t){let n=e.match(RegExp(t+`=([^&]*)`));return n?n[1]:null},Wo=(e,t)=>e>=t&&_(),Go=(e,t,n,r)=>{if(e===0){if(_()){let e=t+1;return e===n&&r(),e}return t}return 0},Ko=[`gclid`,`gclsrc`,`dclid`,`gbraid`,`wbraid`,`fbclid`,`msclkid`,`twclid`,`li_fat_id`,`igshid`,`ttclid`,`rdt_cid`,`epik`,`qclid`,`sccid`,`irclid`,`_kx`],qo=[`utm_source`,`utm_medium`,`utm_campaign`,`utm_content`,`utm_term`,`gad_source`,`mc_cid`,...Ko],Jo=`<masked>`,Yo=[`li_fat_id`];function Xo(e,t,n){if(!u)return{};let r=t?[...Ko,...n||[]]:[],i=Zo(Ho(u.URL,r,Jo),e);return W(function(){let e={};return U(Yo,function(t){let n=ha(t);e[t]=n||null}),e}(),i)}function Zo(e,t){let n=qo.concat(t||[]),r={};return U(n,function(t){let n=Vo(e,t);r[t]=n||null}),r}function Qo(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(!N(t)){r.$search_engine=t;let e=u?Vo(u.referrer,n):``;e.length&&(r.ph_keyword=e)}return r}function $o(){return navigator.language||navigator.userLanguage}function es(){let e=$o();return typeof e==`string`?e.split(`-`)[0]:void 0}var ts=`$direct`;function ns(){return u?.referrer||ts}function rs(e,t,n=!1){let r=e?[...Ko,...t||[]]:[],i=(n?Ft(d?.href):d?.href)?.substring(0,1e3);return{r:ns().substring(0,1e3),u:i?Ho(i,r,Jo):void 0}}function is(e,t=!1){let{r:n,u:r}=e,i=t?Ft(r):r,a={$referrer:n,$referring_domain:n==null?void 0:n==ts?ts:Bo(n)?.host};if(i){a.$current_url=i;let e=Bo(i);a.$host=e?.host,a.$pathname=e?.pathname,W(a,Zo(i))}return n&&W(a,Qo(n)),a}function as(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function os(){try{return new Date().getTimezoneOffset()}catch{return}}var ss={flags:Ai,surveys:gi},cs=[`cookie`,`localstorage`,`localstorage+cookie`,`sessionstorage`,`memory`],ls=e=>`${e}_cookie_identity_change_pending`,us=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},Z=`main`,ds=[ri,ii,oi,si,ci,Ai,li,fi],fs=e=>ds.indexOf(e)!==-1,ps=[kr,jr],ms=e=>ps.indexOf(e)!==-1,hs=(e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch{return e===t}},gs=e=>{if(!e)return{};let t=JSON.parse(e);return k(t)?t:{}},_s=(e,t)=>{U(e,(n,r)=>{let i=X(r);i&&i.exposure!==`event`||{}.hasOwnProperty.call(t,r)||delete e[r]})},vs=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.ta=!1,this.ea=!1,this.ia=new Set,this.na=new Set,this.Ir=e,this.sa=n,this.props={},this.ra=void 0,this.oa=(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.aa(e),this.Qo=this.la(e),this.load(),this.ua(),e.debug&&z.info(`Persistence loaded`,e.persistence,R({},this.props)),this.update_config(e,e,t),this.save(),s){let e=()=>this.flush();G(s,`beforeunload`,e,{capture:!1}),G(s,`pagehide`,e,{capture:!1}),this.ha=e=>{if(this.Go&&(!e.storageArea||e.storageArea===s?.localStorage)&&e.key){if(e.key!==this.oa){if(this.Qo){let t=Io.find(t=>e.key===this.ca(t));t&&this.da(e.key,t)}}else this.da(e.key,Z)}},G(s,`storage`,this.ha)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(([e,t])=>{let n=this.Xo.get(e);if(!fs(e)||!0===n)return;if(!0===t)return void this.va(e,!0);let r=new Set(n||[]);t.forEach(e=>r.add(e)),r.size&&this.va(e,r)})}onCrossTabFeatureFlagChange(e){return this.na.add(e),()=>this.na.delete(e)}destroy(){this.ha&&s&&(s.removeEventListener(`storage`,this.ha),this.ha=void 0),this.na.clear()}da(e,t,n=!0){if(this.mi)return!1;let r,i;try{if(i=q.Ot(e),N(i)){let e=this.fa(t);
1return e.storageValue=null,t!==Z&&(e.persisted=!1),!1}r=gs(i)}catch{return!1}let a=t===Z?r:q.Dt(this.oa);if(a&&this.pa(a))return!1;let o=this.ga(r,t,n);return t===Z&&this.Qo&&!hs(this.ma().main,r)||this.ya(r,t,!0,i),o}pa(e){let t=this.props[Cr],n=e[Cr];return!j(t)&&!j(n)&&t!==n}ya(e,t,n,r){let i=this.fa(t);i.storageValue=r,t!==Z&&(i.persisted=n);try{i.fingerprint=this.ba(e,t)}catch{i.fingerprint=void 0}}ga(e,t,n){let r=!1;return ds.forEach(n=>{let i=X(n)?.storageGroup;if(t===Z&&this.Qo&&i||t!==Z&&i!==t)return;let a=n in e,o=this._a(n,a?e[n]:void 0),s=this.Xo.has(n)?n in this.props:a;s===n in this.props&&hs(o,this.props[n])||(s?this.wa(n,o,!1):this.ka(n,!1),r=!0)}),r&&n&&this.na.forEach(e=>e()),r}Sa(){if(!this.Go)return!1;try{this.ea=!1;let e=q.Ot(this.oa),t=this.fa(Z),n,r=!1,i=!1;if(e!==t.storageValue){if(N(e))t.storageValue=null;else{if(n=gs(e),this.ea=!this.ta&&this.pa(n),this.ea)return!1;i=this.ga(n,Z,!1),!this.Qo||hs(this.ma().main,n)?this.ya(n,Z,!0,e):t.storageValue=e,r=!0}}return this.Qo&&Io.forEach(e=>{let t=q.Ot(this.ca(e)),a=this.fa(e),o=n||{},s=r&&ds.some(t=>X(t)?.storageGroup===e&&t in o);if(t===a.storageValue&&!s)return;if(N(t))return a.storageValue=null,a.persisted=!1,void(s&&(i=this.ga(o,e,!1)||i));let c=gs(t);i=this.ga(c,e,!1)||i,this.ya(c,e,!0,t)}),i}catch{return!1}}va(e,t){this.Xo.set(e,t);let n=X(e);n!=null&&n.volatile||(this.fa((this.Qo?n?.storageGroup:void 0)||Z).fingerprint=void 0,this.xa(e))}Ca(){ds.forEach(e=>this.Xo.set(e,!0))}ua(){if(this.Go)try{let e=q.Ot(this.oa),t=gs(e);this.fa(Z).storageValue=e,ds.forEach(e=>{let n=this.Qo?X(e)?.storageGroup:void 0,r=n?q.Ot(this.ca(n)):null;if(n){let e=this.fa(n);e.storageValue=r,e.persisted=!N(r)}let i=n&&!N(r)?gs(r):t;e in this.props?this.$a(e,i[e],this.props[e]):e in i&&this.va(e,!0)})}catch{}}_a(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(D(t)?t:[]),i=new Set(D(this.props[e])?this.props[e]:[]);return n.forEach(e=>i.has(e)?r.add(e):r.delete(e)),Array.from(r)}let r=k(t)?R({},t):{},i=k(this.props[e])?this.props[e]:{};return n.forEach(e=>{e in i?r[e]=i[e]:delete r[e]}),r}$a(e,t,n){if(!fs(e))return;let r=this.Xo.get(e);if(!0===r)return;let i=t;if(this.Go)try{let t=this.Qo?X(e)?.storageGroup:void 0,n=t?this.ca(t):this.oa;i=gs(q.Ot(n))[e]}catch{}let a=new Set(r||[]);if(e===`$active_feature_flags`){if(!j(t)&&!D(t)||!j(i)&&!D(i)||!D(n))return void this.va(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)})}else{if(!k(n))return void(hs(i,n)?this.Xo.delete(e):this.va(e,!0));{if(!j(t)&&!k(t)||j(t)&&A(n)&&j(i))return void this.va(e,!0);let r=k(t)?t:{},o=k(i)?i:{};new Set([...Object.keys(r),...Object.keys(n)]).forEach(e=>{e in r==e in n&&hs(r[e],n[e])||a.add(e)}),a.forEach(e=>{e in o==e in n&&hs(o[e],n[e])&&a.delete(e)})}}a.size?this.va(e,a):this.Xo.delete(e)}Ta(){let e=this.Ir?.persistence_save_debounce_ms;return F(e)&&e>0?e:0}Ia(e){if(this.Ir.cookieWinsOnConflict&&this.Ir.persistence.toLowerCase()===`localstorage+cookie`){if(e)try{let t=Ma(e,this.Ir.cookie_persisted_properties||[]),n=Pa(t,this.Ir.cookie_persisted_properties||[]),r=JSON.stringify(t)+`|`+JSON.stringify(n),i=K.Ot(this.oa)||void 0;i&&Ia(this.oa,i)===r&&(this.Ma=r,this.Ea=i)}catch{}else try{let e=K.Ot(this.oa)||void 0;this.Ma=e?Ia(this.oa,e):void 0,this.Ea=e}catch{}}}syncCookieProperties(){return this.Pa(this.Ir)}Pa(e,t=!1){if(this.mi&&!t||this.Ko||!e.cookieWinsOnConflict||e.persistence.toLowerCase()!==`localstorage+cookie`)return!1;let n;try{n=K.Ot(this.oa)||void 0}catch{}if(!n||n===this.Ea)return!1;let r=Ia(this.oa,n),i;try{i=ja(JSON.parse(n))}catch{return!1}if((K.Ot(this.oa)||void 0)!==n)return!1;this.Ma=r,this.Ea=n;let a=Fa(this.oa,n),o=[...Oa,...a.properties],s={};
1if(Object.keys(i).forEach(e=>{let t=i[e];(j(t)||N(t)||t===``||e===`$user_state`&&t!==`anonymous`&&t!==`identified`)&&(s[e]=!0,delete i[e])}),A(i))return!1;let c=`distinct_id`in i||i.$user_state===`anonymous`||i.$user_state===`identified`,l=this.props,u=l[Cr],d=l[H],f=W({},l);[...Oa,...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||Oa.indexOf(e)===-1||!1!==t&&t!==0)&&delete f[e]}}),this.props=W(f,i),ds.forEach(e=>{let t=e in this.props;e in l===t&&hs(l[e],this.props[e])||(t?this.$a(e,l[e],this.props[e]):this.va(e,!0))}),!c||`$user_state`in i||`$user_state`in this.props||this.wa(H,Qi);let p=this.props[Cr],m=this.props[H];return!c||p===u&&m===d||(this.ta=!0,this.Jo=!0,J.At(ls(this.oa),!0),this.ka(fi),this.ka(ii),this.ka(ri),this.ka(oi),this.ka(si),this.ka(ci),this.ka(Ai),this.ka(ki),this.ka(Di),m!==`anonymous`||d!==`identified`&&i.$user_state!==`anonymous`&&(j(u)||p===u)||(_s(this.props,i),this.ka(pi)),m===`identified`?this.props.$user_id=p:delete this.props.$user_id,this.ka(Er)),!0}
1consumeCookieIdentityChange(){let e=ls(this.oa),t=this.Jo||!!J.Ot(e);return this.Jo=!1,t&&J.Lt(e),t}Ra(e=!1){return!(this.Ko||this.mi&&!e||!this.Ir.cookieWinsOnConflict||this.Ir.persistence.toLowerCase()!==`localstorage+cookie`||(this.Ko=!0,0))}Aa(){this.Ko&&(j(this.Fa)||(clearTimeout(this.Fa),this.Fa=void 0),delete this.Vo[Z],this.Oa(!0))}Da(e=!0){if(this.Ko)try{e?this.Aa():j(this.Fa)||(clearTimeout(this.Fa),this.Fa=void 0)}finally{this.Ko=!1}}isDisabled(){return!!this.mi}aa(e){cs.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=[...Oa,...e];return R(R({},q),{},{Dt(e){try{let r,i={};try{r=K.Ot(e)||void 0,i=r?ja(JSON.parse(r)):{}}catch{}let a=JSON.parse(q.Ot(e)||`{}`),o;if(t){let t=Fa(e,r),s=[...Oa,...t.properties],c={};Object.keys(i).forEach(e=>{let t=i[e];N(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[Cr],r=a.$user_state??Qi;n.forEach(e=>{if(s.indexOf(e)!==-1&&!(e in i)&&(l||e!==`distinct_id`&&e!==`$user_state`)){let n=a[e];(t.isValid||Oa.indexOf(e)===-1||!1!==n&&n!==0)&&delete a[e]}}),!l||`$user_state`in i||`$user_state`in a||(a[H]=Qi),!l||(`distinct_id`in c?c[Cr]:a[Cr])===e&&(`$user_state`in c?c[H]:a[H])===r||(Da.forEach(e=>delete a[e]),c.$user_state===`identified`&&`distinct_id`in c?a.$user_id=c[Cr]:delete a.$user_id,c.$user_state!==`identified`&&(delete a[mi],delete a[pi]),delete a.__alias)}o=W(a,c)}else o=W(i,a);return q.At(e,o),o}catch{}return null},At(n,r,i,a,o,s){let c=q.At(n,r,void 0,void 0,s);try{let l=Ma(r,e);if(Object.keys(l).length){if(t){let t=ka(n),u=Pa(l,e);if(K.At(t,u,i,a,o,s),K.Ot(t)!==JSON.stringify(u)){K.Lt(t,a);let e=Ma(r);return K.At(n,e,i,a,o,s),c}}K.At(n,l,i,a,o,s)}}catch(e){q.Pt(e)}return c},Lt(e,t){try{s?.localStorage.removeItem(e),K.Lt(e,t),K.Lt(ka(e),t)}catch(e){q.Pt(e)}}})})(e.cookie_persisted_properties||[],e.cookieWinsOnConflict),n,r=!1,i=!1,a=e.persistence.toLowerCase();return a===`localstorage`&&q.Et()?(n=q,i=!0):a===`localstorage+cookie`&&t.Et()?(n=t,i=!0,r=!0):a===`sessionstorage`&&J.Et()?n=J:a===`memory`?n=Ra:a===`cookie`&&K.Et()?(n=K,r=!0):t.Et()?(n=t,i=!0,r=!0):K.Et()?(n=K,r=!0):n=Ra,this.Go=i,this.Zo=r,n}ca(e){return`${this.oa}__${e}`}la(e){return this.Go&&!!e.split_storage}properties(){let e={};return U(this.props,(t,n)=>{let r=X(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?q.Dt(this.oa):null,r={};if(t)try{r=ja(K.Dt(this.oa)),U(r,(e,t)=>{(j(e)||N(e)||e===``)&&delete r[t]})}catch{}let i=this.Oo.Dt(this.oa);if(i&&(this.props=W({},i)),this.Qo&&this.La(),t&&i){let e=n?.[Cr],t=n?.$user_state??Qi,a=i[Cr],o=i.$user_state??Qi;if(a!==e||o!==t){this.Jo=!0,J.At(ls(this.oa),!0);let n=W({},this.props);Da.forEach(e=>delete n[e]),o!==`anonymous`||t!==`identified`&&r.$user_state!==`anonymous`&&(j(e)||a===e)||(_s(n,r),delete n[pi]),this.props=n;let i=new Set;Da.forEach(e=>{let t=X(e)?.storageGroup;t&&i.add(t)}),i.forEach(e=>{let t={};U(this.props,(n,r)=>{X(r)?.storageGroup===e&&(t[r]=n)}),A(t)?(q.Lt(this.ca(e)),this.Vo[e]={}):q.At(this.ca(e),t)&&(this.Vo[e]={persisted:!0,fingerprint:this.ba(t,e)})})}}J.Ot(ls(this.oa))&&(this.Jo=!0)}La(){for(let e of Io){let t=q.Dt(this.ca(e));if(t&&!A(t)){let n=this.fa(e);n.persisted=!0,this.Na(e)||(n.fingerprint=this.ba(t,e)),this.qa(e,t)||W(this.props,t)}}}Na(e){return Object.keys(this.props).some(t=>X(t)?.storageGroup===e)}qa(e,t){let n=ss[e];if(!n)return!1;let r=t[n],i=this.props[n];return F(r)&&F(i)&&i>r}refreshKey(e){if(this.mi||this.ia.has(e))return;let t=this.Qo?X(e)?.storageGroup:void 0,n=t?q.Dt(this.ca(t)):this.Oo.Dt(this.oa);if(n&&e in n)this.wa(e,n[e],!1);else{if(t){let t=this.Oo.Dt(this.oa);if(t&&e in t)return void this.wa(e,t[e],!1)}this.ka(e,!1)}}save(){if(this.mi)return;let e=this.Ta();e>0?j(this.Fa)&&(this.Fa=setTimeout(()=>{this.Fa=void 0,this.Oa()},e)):this.Oa()}flush(){j(this.Fa)||(clearTimeout(this.Fa),this.Fa=void 0,this.Oa())}Oa(e=!1){if(this.mi||this.Ko&&!e)return;e||(this.syncCookieProperties(),this.Ir.cookieWinsOnConflict&&this.Ir.persistence.toLowerCase()===`localstorage+cookie`||ps.forEach(e
1=>this.refreshKey(e)));let t=!e&&!this.Yo;t||(this.ea=!1);let n=!!t&&this.Sa();if(this.ea)return void(this.Ir.debug&&z.warn(`skipping persistence write because storage belongs to a different distinct ID`));if(this.Qo)return this.ja(),void(n&&this.na.forEach(e=>e()));let r=this.Ba(this.Oo,this.oa,this.props,Z);r===`written`&&this.Ia(this.props),r!==`failed`&&(this.Xo.clear(),this.ta=!1,this.ia.clear()),n&&this.na.forEach(e=>e())}ja(){let{main:e,groups:t}=this.ma(),n=this.Ba(this.Oo,this.oa,e,Z);n===`written`&&this.Ia(e),n!==`failed`&&(this.ta=!1,this.ia.clear(),ds.forEach(e=>{var t;(t=X(e))!=null&&t.storageGroup||this.Xo.delete(e)}));for(let e of Io){let n=t[e];if(A(n)&&!this.Vo[e]?.persisted){ds.forEach(t=>{X(t)?.storageGroup===e&&this.Xo.delete(t)});continue}let r=this.Ba(q,this.ca(e),n,e);r!==`failed`&&ds.forEach(t=>{let n=X(t);n?.storageGroup!==e||r!==`written`&&n.volatile||this.Xo.delete(t)})}}ma(){let e={},t={flags:{},surveys:{}};return U(this.props,(n,r)=>{let i=X(r)?.storageGroup;i?t[i][r]=n:e[r]=n}),{main:e,groups:t}}ba(e,t){if(t===Z)return JSON.stringify(e)+`|`+this.Ha+`|`+this.za+`|`+this.Ua;let n={};return U(e,(e,t)=>{n[t]=X(t)?.volatile?`__volatile__`:e}),JSON.stringify(n)}Ba(e,t,n,r){let i=this.fa(r);if(r!==Z&&!i.dirty&&!j(i.fingerprint))return`skipped`;let a;try{if(a=this.ba(n,r),a===i.fingerprint)return i.dirty=!1,`skipped`}catch{a=void 0}return e.At(t,n,this.Ha,this.za,this.Ua,this.Ir.debug)?(i.dirty=!1,r!==Z&&
1(i.persisted=!0),j(a)||(i.fingerprint=a),this.Go&&(i.storageValue=q.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.Ca(),j(this.Fa)||(clearTimeout(this.Fa),this.Fa=void 0),this.Oo.Lt(this.oa,!1),this.Oo.Lt(this.oa,!0),!e&&this.sa)for(let e of Io)q.Lt(this.ca(e));e?delete this.Vo[Z]:this.Vo={},this.Ma=void 0,this.Ea=void 0}clear(){this.remove(),this.props={}}register_once(e,t,n){if(k(e)){this.syncCookieProperties(),j(t)&&(t=`None`),this.Ha=j(n)?this.Wa:n;let r=!1;if(U(e,(e,n)=>{this.props.hasOwnProperty(n)&&this.props[n]!==t||(this.wa(n,e),r=!0)}),r)return this.save(),!0}return!1}register(e,t){if(k(e)){this.syncCookieProperties(),this.Ha=j(t)?this.Wa:t;let n=!1;if(U(e,(t,r)=>{e.hasOwnProperty(r)&&(this.props[r]!==t||k(t)||D(t))&&(this.wa(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.ka(e),n=!0);n&&this.save()}update_campaign_params(){let e=u?.URL;if(e===this.ra)return;let t=Xo(this.Ir.custom_campaign_params,this.Ir.mask_personal_data_properties,this.Ir.custom_personal_data_properties),n=!A(ua(t));return n&&this.register(t),this.ra=e,n?t:void 0}update_search_keyword(){this.register(function(){let e=u?.referrer;return e?Qo(e):{}}())}update_referrer_info(){this.register_once({$referrer:ns(),$referring_domain:u?.referrer&&Bo(u.referrer)?.host||ts},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;let e=rs(this.Ir.mask_personal_data_properties,this.Ir.custom_personal_data_properties,this.Ir.disable_capture_url_hashes);this.register_once({[Fi]:this.Zo?{r:us(e.r),u:e.u?us(e.u):void 0}:e},void 0)}get_initial_props(){let e={};U([Pi,Ni],t=>{let n=this.props[t];n&&U(n,function(t,n){e[`$initial_`+E(n)]=t})});let t=this.props[Fi];return t&&W(e,function(e,t=!1){let n=is(e,t),r={};return U(n,function(e,t){r[`$initial_${E(t)}`]=e}),r}(t,this.Ir.disable_capture_url_hashes)),e}safe_merge(e){return U(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.Pa(t,c),this.Ir=e,!s&&(r||i||o)&&(this.Ma=void 0,this.Ea=void 0,this.Pa(R(R({},e),{},{cookie_persisted_properties:t.cookie_persisted_properties}),c));let l=a||o?this.aa(e):this.Oo;this.Va();let u=this.la(e),d=a||u!==this.Qo,f=!s&&(d||e.cross_subdomain_cookie!==this.za||e.secure_cookie!==this.Ua)&&this.Ra(c);this.Yo=d;try{if(this.Wa=this.Ha=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[Z],this.Oa()))}finally{this.Yo=!1,f&&this.Da()}}Va(){let e=this.props[Fi];if(!this.Zo||!k(e)||typeof e.r!=`string`)return;let t=us(e.r),n=typeof e.u==`string`?us(e.u):e.u;t===e.r&&n===e.u||this.wa(Fi,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.za&&(this.za=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.Ua&&(this.Ua=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){let n=this.props.__timers||{};n[e]=t,this.wa(Mr,n),this.save()}remove_event_timer(e){let t=this.props.__timers||{},n=t[e];return j(n)||(delete t[e],this.wa(Mr,t),this.save()),n}get_property(e){return this.props[e]}set_property(e,t){this.wa(e,t),this.save()}wa(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.ta=!0),ms(e)&&!hs(i,t)&&this.ia.add(e),this.$a(e,i,t),(r=X(e))!=null&&r.volatile||this.xa(e))}ka(e,t=!0){delete this.props[e],t&&(fs(e)&&this.va(e,!0),ms(e)&&this.ia.add(e),this.xa(e))}xa(e){let t=X(e)?.storageGroup;t&&(this.fa(t).dirty=!0)}fa(e){return this.Vo[e]||(this.Vo[e]={})}},ys={GZipJS:`gzip-js`,Base64:`base64`},bs={Activation:`events`,Cancellation:`cancelEvents`},xs={Popover:`popover`,API:`api`,Widget:`widget`,ExternalSurvey:`external_survey`},Ss={SHOWN:`survey shown`,DISMISSED:`survey dismissed`,SENT:`survey sent`,ABANDONED:`survey abandoned`},Cs={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`},ws={Popover:`popover`,Inline:`inline`};function Ts(e){let t=!0;return{dispose(){if(t){t=!1;let n=e();n&&O(n.then)&&n.then(void 0,()=>{})}}}}var Es={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`},Ds={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`},Os=B(`[RateLimiter]`),ks=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=>{Os.info(`${e||`events`} is quota limited.`),this.serverLimits[e]=new Date().getTime()+6e4})}catch(e){Os.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=(F(a.dropped)?a.dropped:0)+1;a.dropped=e,!this.lastEventRateLimited&&this.Ga(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}}Za(e){let t=this.instance.config.property_denylist;return!D(t)||!t.includes(e)}Qa(){if(this.Za(`$current_url`)&&this.Za(`$pathname`)&&d?.pathname)return`${d.origin??``}${d.pathname}`}Ga(e){var t;let{captureEventsBurstLimit:n,captureEventsPerSecond:r}=this,i=this.Qa(),a=this.Za(`$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}},As=B(`[RemoteConfig]`),js=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=y._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}Ja(e){var t,n;y.__PosthogExtensions__?.loadExternalDependency?(t=y.__PosthogExtensions__)==null||(n=t.loadExternalDependency)==null||n.call(t,this._instance,`remote-config`,()=>e(this.remoteConfig)):e()}Ka(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 As.info(`Using preloaded remote config`,this.remoteConfig),void this.Xa(this.remoteConfig);if(this._instance.Ya())return void As.warn(`Remote config is disabled. Falling back to local config.`);this.Ja(e=>{if(!e)return As.info(`No config found after loading remote JS config. Falling back to JSON.`),void this.Ka(e=>{this.Xa(e.json,e)});this.Xa(e)})}catch(e){As.error(`Error loading remote config`,e),this.Xa()}}Xa(e,t){!e&&t&&(t.statusCode===0?t.error||As.warn(`Failed to fetch remote config from PostHog.`):As.error(`Failed to fetch remote config from PostHog.`));try{this._instance.Xa(e?{ok:!0,config:e}:{ok:!1})}catch(e){As.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){As.error(`Error loading feature flags`,e)}}},Ms=Uint8Array,Ns=Uint16Array,Ps=Uint32Array,Fs=new Ms([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]),Is=new Ms([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]),Ls=new Ms([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Rs=function(e,t){for(var n=new Ns(31),r=0;31>r;++r)n[r]=t+=1<<e[r-1];var i=new Ps(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]},zs=Rs(Fs,2),Bs=zs[1];zs[0][28]=258,Bs[258]=28;for(var Vs=Rs(Is,0)[1],Hs=new Ns(32768),Q=0;32768>Q;++Q){var Us=(43690&Q)>>>1|(21845&Q)<<1;Hs[Q]=((65280&(Us=(61680&(Us=(52428&Us)>>>2|(13107&Us)<<2))>>>4|(3855&Us)<<4))>>>8|(255&Us)<<8)>>>1}var Ws=function(e,t,n){for(var r=e.length,i=0,a=new Ns(t);r>i;++i)++a[e[i]-1];var o,s=new Ns(t);for(i=0;t>i;++i)s[i]=s[i-1]+a[i-1]<<1;if(n){o=new Ns(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[Hs[d]>>>c]=l}else for(o=new Ns(r),i=0;r>i;++i)o[i]=Hs[s[e[i]-1]++]>>>15-e[i];return o},Gs=new Ms(288);for(Q=0;144>Q;++Q)Gs[Q]=8;for(Q=144;256>Q;++Q)Gs[Q]=9;for(Q=256;280>Q;++Q)Gs[Q]=7;for(Q=280;288>Q;++Q)Gs[Q]=8;var Ks=new Ms(32);for(Q=0;32>Q;++Q)Ks[Q]=5;var qs=Ws(Gs,9,0),Js=Ws(Ks,5,0),Ys=function(e){return(e/8|0)+(7&e&&1)},Xs=function(e,t,n){(t==null||0>t)&&(t=0),(n==null||n>e.length)&&(n=e.length);var r=new(e instanceof Ns?Ns:e instanceof Ps?Ps:Ms)(n-t);return r.set(e.subarray(t,n)),r},Zs=function(e,t,n){var r=t/8|0;e[r]|=n<<=7&t,e[r+1]|=n>>>8},Qs=function(e,t,n){var r=t/8|0;e[r]|=n<<=7&t,e[r+1]|=n>>>8,e[r+2]|=n>>>16},$s=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 Ms(0),0];if(i==1){var o=new Ms(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 Ns(f+1),m=ec(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}return[new Ms(p),m]},ec=function(e,t,n){return e.s==-1?Math.max(ec(e.l,t,n+1),ec(e.r,t,n+1)):t[e.s]=n},tc=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Ns(++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>
vendor: 5,143 bytes, line 1
12&&(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]},nc=function(e,t){for(var n=0,r=0;t.length>r;++r)n+=e[r]*t[r];return n},rc=function(e,t,n){var r=n.length,i=Ys(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)},ic=function(e,t,n,r,i,a,o,s,c,l,u){Zs(t,u++,n),++i[256];for(var d=$s(i,15),f=d[0],p=d[1],m=$s(a,15),h=m[0],g=m[1],_=tc(f),v=_[0],y=_[1],b=tc(h),x=b[0],S=b[1],C=new Ns(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=$s(C,7),T=ee[0],te=ee[1],E=19;E>4&&!T[Ls[E-1]];--E);var ne,re,ie,ae,D=l+5<<3,O=nc(i,Gs)+nc(a,Ks)+o,k=nc(i,f)+nc(a,h)+o+14+3*E+nc(C,T)+(2*C[16]+3*C[17]+7*C[18]);if(O>=D&&k>=D)return rc(t,u,e.subarray(c,c+l));if(Zs(t,u,1+(O>k)),u+=2,O>k){ne=Ws(f,p,0),re=f,ie=Ws(h,g,0),ae=h;var A=Ws(T,te,0);for(Zs(t,u,y-257),Zs(t,u+5,S-1),Zs(t,u+10,E-4),u+=14,w=0;E>w;++w)Zs(t,u+3*w,T[Ls[w]]);u+=3*E;for(var j=[v,x],M=0;2>M;++M){var oe=j[M];for(w=0;oe.length>w;++w)Zs(t,u,A[N=31&oe[w]]),u+=T[N],N>15&&(Zs(t,u,oe[w]>>>5&127),u+=oe[w]>>>12)}}else ne=qs,re=Gs,ie=Js,ae=Ks;for(w=0;s>w;++w)if(r[w]>255){var N;Qs(t,u,ne[257+(N=r[w]>>>18&31)]),u+=re[N+257],N>7&&(Zs(t,u,r[w]>>>23&31),u+=Fs[N]);var P=31&r[w];Qs(t,u,ie[P]),u+=ae[P],P>3&&(Qs(t,u,r[w]>>>5&8191),u+=Is[P])}else Qs(t,u,ne[r[w]]),u+=re[r[w]];return Qs(t,u,ne[256]),u+re[256]},ac=new Ps([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),oc=new Ms(0),sc=function(){for(var e=new Ps(256),t=0;256>t;++t){for(var n=t,r=9;--r;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),cc=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function lc(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=sc[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 Ms(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=rc(c,l,e.subarray(u,d)):(c[u]=a,l=rc(c,l,e.subarray(u,o)))}else{for(var f=ac[t-1],p=f>>>13,m=8191&f,h=(1<<n)-1,g=new Ns(32768),_=new Ns(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 Ps(25e3),S=new Ns(288),C=new Ns(32),w=0,ee=0,T=(u=0,0),te=0,E=0;o>u;++u){var ne=b(u),re=32767&u,ie=_[ne];if(g[re]=ie,_[ne]=re,u>=te){var ae=o-u;if((w>7e3||T>24576)&&ae>423){l=ic(e,c,0,x,S,C,ee,T,E,u-E,l),T=w=ee=0,E=u;for(var D=0;286>D;++D)S[D]=0;for(D=0;30>D;++D)C[D]=0}var O=2,k=0,A=m,j=re-ie&32767;if(ae>2&&ne==b(u-j))for(var M=Math.min(p,ae)-1,oe=Math.min(32767,u),N=Math.min(258,ae);oe>=j&&--A&&re!=ie;){if(e[u+O]==e[u+O-j]){for(var P=0;N>P&&e[u+P]==e[u+P-j];++P);if(P>O){if(O=P,k=j,P>M)break;var F=Math.min(j,P-2),se=0;for(D=0;F>D;++D){var I=u-j+D+32768&32767,ce=I-g[I]+32768&32767;ce>se&&(se=ce,ie=I)}}}j+=(re=ie)-(ie=g[re])+32768&32767}if(k){x[T++]=268435456|Bs[O]<<18|Vs[k];var le=31&Bs[O],ue=31&Vs[k];ee+=Fs[le]+Is[ue],++S[257+le],++C[ue],te=u+O,++w}else x[T++]=e[u],++S[e[u]]}}l=ic(e,c,a,x,S,C,ee,T,E,u-E,l),a||(l=rc(c,l,oc))}return Xs(s,0,r+Ys(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&&cc(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),cc(u,d-8,n.d()),cc(u,d-4,r),u}var uc=!!p||!!f,dc=new WeakMap,fc=`text/plain`,pc=0,mc=!1,hc=(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}`:``}`},gc=(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 U(e,function(e,t){j(e)||j(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},_c=e=>{if(e.tl)return e.tl;let{data:t,compression:n}=e;if(!t)return;if(n===ys.GZipJS){let e=lc(function(e){var t=e.length;if(typeof TextEncoder<`u`)return new TextEncoder().encode(e);for(var n=new Ms(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 Ms(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 Xs(n,0,r)}(zo(t)),{mtime:0});return{contentType:fc,body:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength),estimatedSize:e.byteLength}}if(n===ys.Base64){let e=(e=>`data=`+encodeURIComponent(typeof e==`string`?e:zo(e)))(function(e){return e&&btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(e,t)=>
1String.fromCharCode(parseInt(t,16))))}(zo(t)));return{contentType:`application/x-www-form-urlencoded`,body:e,estimatedSize:new Blob([e]).size}}let r=zo(t);return{contentType:`application/json`,body:r,estimatedSize:new Blob([r]).size}},vc=e=>{let t=()=>e.transport===`sendBeacon`?{url:gc(e.url,{compression:ys.Base64}),encodedBody:_c(R(R({},e),{},{compression:ys.Base64,tl:void 0}))}:{url:hc(e.url,`compression`),encodedBody:_c(R(R({},e),{},{compression:void 0,tl:void 0}))},n;try{n=_c(e)}catch(n){if(zn(e.compression,Vo(e.url,`compression`)))return z.error(`Failed to gzip request body, sending uncompressed payload`,n),t();throw n}return n&&zn(e.compression,Vo(e.url,`compression`))&&!((r=n.body)instanceof ArrayBuffer?Rn(new Uint8Array(r)):ArrayBuffer.isView(r)&&Rn(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)))?(mc=!0,t()):{url:e.url,encodedBody:n};var r},yc=e=>{try{return vc(e)}catch(n){var t;z.error(n),(t=e.callback)==null||t.call(e,{statusCode:0,error:n});return}},bc=function(){var e=L(function*(e){let t=yield function(e){return Gn.apply(this,arguments)}(zo(e.data),V.DEBUG,{rethrow:!0});if(!t)return e;let n=yield t.arrayBuffer();return R(R({},e),{},{tl:{contentType:fc,body:n,estimatedSize:n.byteLength}})});return function(t){return e.apply(this,arguments)}}(),xc=/Failed to fetch|NetworkError|Load failed/i,Sc=e=>e?.name===`TypeError`&&xc.test(e?.message||``),Cc=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,At):void 0}(e());return j(t)?void 0:Math.min(t,3e4)}catch{return}},wc=e=>{let t=yc(e);if(!t)return;let n=new p;dc.set(n,!0);let{url:r,encodedBody:i}=t;n.open(e.method||`GET`,r,!0);let{contentType:a,body:o}=i??{};U(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,Cc(()=>n.getResponseHeader(`Retry-After`)))}},n.send(o)},Tc=e=>{let t=yc(e);if(!t)return;let{url:n,encodedBody:r}=t,{contentType:i,body:a,estimatedSize:o}=r??{},s=new Headers;U(e.headers,function(e,t){s.append(t,e)}),i&&s.append(`Content-Type`,i);let c=null,l=!1;if(m){let t=new m;c={signal:t.signal,timeout:setTimeout(()=>{l=!0;try{t.abort(Pt(`AbortError`,`PostHog request timed out`+((n=e.timeout)?` after ${n}ms`:``)))}catch(e){d(e)}var n},e.timeout)}}let u=!1,d=t=>{var n;u||(u=!0,l&&t?.name===`AbortError`||Sc(t)?z.warn(t):z.error(t),(n=e.callback)==null||n.call(e,{statusCode:0,error:t}))},p=0,h=()=>{pc-=p,p=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??(j(a)?0:void 0);t.keepalive=t.method===`POST`&&!e.el&&!1!==t.keepalive&&t.body===a&&!j(r)&&r>=0&&52428.8>pc+r,t.keepalive&&(p=r,pc+=p),f(n,t).then(t=>t.text().then(n=>{var r;if(u)return;let i={statusCode:t.status,text:n};if(t.status===200)try{i.json=JSON.parse(n)}catch(e){z.error(e)}u=!0,h(),(r=e.callback)==null||r.call(e,i,Cc(()=>t.headers.get(`Retry-After`)))})).catch(e=>{h(),d(e)}).finally(h)}catch(e){h(),d(e)}},Ec=e=>{try{let{url:t,encodedBody:n}=vc(e),{contentType:r,body:i,estimatedSize:a}=n??{};if(!i)return;let o=i instanceof Blob?i:new Blob([i],{type:r});if(l.sendBeacon(t,o))return;let s=D(e.data)?e.data:e.data?.batch;if(D(s)&&s.length>1&&(a??0)>16384){let t=Math.ceil(s.length/2),n=t=>D(e.data)?t:R(R({},e.data),{},{batch:t});Ec(R(R({},e),{},{data:n(s.slice(0,t))})),Ec(R(R({},e),{},{data:n(s.slice(t))}));return}z.warn(`Beacon of ~${a??0} bytes was rejected by the browser, falling back to ${f?`fetch`:`XHR`}`),f?Tc(R(R({},e),{},{el:!0})):wc(e)}catch(e){z.warn(`Beacon send failed`,e)}},Dc=(e,t,n,r)=>{let i=r===`query`?t===`POST`?`sent_at`:`_`:void 0;return gc(n===ys.GZipJS?hc(e,`compression`):e,R(R({},i?{[i]:Date.now().toString()}:{}),n===ys.GZipJS?{}:{compression:n}))},Oc=(()=>{let e=[];return f&&e.push({transport:`fetch`,method:Tc}),p&&e.push({transport:`XHR`,method:wc}),l!=null&&l.sendBeacon&&e.push({transport:`sendBeacon`,method:Ec}),e})(),kc=!uc&&g?.indexOf(`MSIE`)===-1&&g?.indexOf(`Mozilla`)===-1;function Ac(e,t,n){var r,i;n&&(t=R(R({},t),{},{callback:e=>n(e)})),e.__loaded?kc?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,(j(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`&&j(n.compression)&&n.data&&(n.compression=ys.Base64),n.method===`POST`&&n.data&&(n.timestampMode===`capture-body`?n.data=(e=>{var t;let n=(D(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())=>D(e)?e.map(e=>R(R({},e),{},{sent_at:t})):R(R({},e),{},{sent_at:t}))(n.data))),n.url=Dc(n.url,n.method,n.compression,n.timestampMode);let i=Oc.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;Sc(e)?z.warn(e):z.error(e),(t=n.callback)==null||t.call(n,{statusCode:0,error:e})}};r!==`sendBeacon`&&!n.preferSyncCompression&&n.data&&n.compression===ys.GZipJS&&h&&typeof Promise<`u`&&!mc?bc(n).then(e=>{o(e)}).catch(t=>{if(Bn(t))return mc=!0,void o(R(R({},n),{},{compression:void 0,url:Dc(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 Bn(e)||t===Ln})(t)&&(mc=!0),o(n)}):o(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 jc=class{constructor(e,t){this.il=!0,this.nl=[],this.sl=xe(t?.flush_interval_ms||3e3,250,5e3,z.createLogger(`flush interval`),3e3),this.rl=e}
1enqueue(e){this.nl.push(e),this.ol||this.al()}unload(){this.ll();let e=this.nl.length>0?this.ul():{},t=Object.values(e);[...t.filter(e=>e.url.indexOf(`/e`)===0),...t.filter(e=>e.url.indexOf(`/e`)!==0)].map(e=>{this.hl(e,`sendBeacon`)})}enable(){this.il=!1,this.al()}al(){this.il||(this.ol=setTimeout(()=>{if(this.ll(),this.nl.length>0){let e=this.ul();for(let t in e)this.hl(e[t])}},this.sl))}hl(e,t){try{this.rl(e,t)}catch(e){z.error(e)}}ll(){clearTimeout(this.ol),this.ol=void 0}ul(){let e={};return U(this.nl,t=>{var n;let r=t,i=((r?r.batchKey:null)||r.url)+(r.batchGroup?`:${r.batchGroup}`:``);j(e[i])&&(e[i]=R(R({},r),{},{data:[]})),(n=e[i].data)==null||n.push(r.data)}),this.nl=[],e}},Mc=[`retriesPerformedSoFar`],Nc=class{constructor(e){this._instance=e,this.cl=!1,this.dl=3e3,this.nl=[],this.nl=[],this.vl=!0,this.resume()}resume(){if(!j(s)&&`onLine`in s.navigator){if(this.vl=s.navigator.onLine,this.fl)return;this.fl=()=>{this.vl=!0,this.pl()},this.gl=()=>{this.vl=!1},G(s,`online`,this.fl),G(s,`offline`,this.gl)}}get length(){return this.nl.length}retriableRequest(e,t){let{retriesPerformedSoFar:n}=e,r=Kn(e,Mc);se(n)&&(r.url=gc(r.url,{retry_count:n})),Ac(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.nl.push({retryAt:i,requestOptions:e});let a=`Enqueued failed request for retry in ${r}`;navigator.onLine||(a+=` (Browser is offline)`),z.warn(a),this.cl||(this.cl=!0,this.ml())}ml(){if(this.yl&&clearTimeout(this.yl),this.nl.length===0)return this.cl=!1,void(this.yl=void 0);this.yl=setTimeout(()=>{this.vl&&this.nl.length>0&&this.pl(),this.ml()},this.dl)}pl(){let e=Date.now(),t=[],n=this.nl.filter(n=>e>n.retryAt||(t.push(n),!1));if(this.nl=t,n.length>0)for(let{requestOptions:e}of n)this.retriableRequest(e)}unload(){this.yl&&=(clearTimeout(this.yl),void 0),this.cl=!1,j(s)||(this.fl&&=(s.removeEventListener(`online`,this.fl),void 0),this.gl&&=(s.removeEventListener(`offline`,this.gl),void 0));for(let{requestOptions:e}of this.nl)try{this._instance._send_request(R(R({},e),{},{transport:`sendBeacon`}))}catch(e){z.error(e)}this.nl=[]}},Pc=class{constructor(e){this._instance=e,this.bl=()=>{this._l||={};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._l.lastScrollY=Math.ceil(t),this._l.maxScrollY=Math.max(t,this._l.maxScrollY??0),this._l.maxScrollHeight=Math.max(n,this._l.maxScrollHeight??0),this._l.lastContentY=r,this._l.maxContentY=Math.max(r,this._l.maxContentY??0),this._l.maxContentHeight=Math.max(i,this._l.maxContentHeight??0)}}get wl(){return this._instance.config.scroll_root_selector}getContext(){return this._l}resetContext(){let e=this._l;return this._l=void 0,setTimeout(this.bl,0),e}startMeasuringScrollPosition(){G(s,`scroll`,this.bl,{capture:!0}),G(s,`scrollend`,this.bl,{capture:!0}),G(s,`resize`,this.bl)}scrollElement(){if(this.wl){let t=D(this.wl)?this.wl:[this.wl];for(let n of t){var e;let t=s==null||(e=s.document)==null?void 0:e.querySelector(n);if(t)return t}return}var t;return s==null||(t=s.document)==null?void 0:t.documentElement}kl(e){var t,n;let r=e===`y`?`scrollTop`:`scrollLeft`;if(this.wl){let e=this.scrollElement();return e&&e[r]||0}return s?e===`y`?s.scrollY||s.pageYOffset||((t=s.document)==null||(t=t.documentElement)==null?void 0:t.scrollTop)||0:s.scrollX||s.pageXOffset||((n=s.document)==null||(n=n.documentElement)==null?void 0:n.scrollLeft)||0:0}
1scrollY(){return this.kl(`y`)}scrollX(){return this.kl(`x`)}},Fc=e=>rs(e?.config.mask_personal_data_properties,e?.config.custom_personal_data_properties,e?.config.disable_capture_url_hashes),Ic=class{constructor(e,t,n,r){this.Be=e=>{let t=this.Sl();if(t&&t.sessionId===e)return;let n={sessionId:e,props:this.xl(this._instance)};this.Cl.register({[ji]:n})},this._instance=e,this.$l=t,this.Cl=n,this.xl=r||Fc,this.$l.onSessionId(this.Be)}Sl(){return this.Cl.props[ji]}getSetOnceProps(){let e=this.Sl()?.props;return e?`r`in e?is(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 U(ua(this.getSetOnceProps()),(t,n)=>{n===`$current_url`&&(n=`url`),e[`$session_entry_${E(n)}`]=t}),e}},Lc=class{on(e,t){return this.Tl[e]||(this.Tl[e]=[]),this.Tl[e].push(t),()=>{this.Tl[e]=this.Tl[e].filter(e=>e!==t)}}emit(e,t){for(let n of this.Tl[e]||[])n(t);for(let n of this.Tl[`*`]||[])n(e,t)}constructor(){this.Tl={}}},Rc=B(`[SessionId]`),zc=864e5,Bc=class{on(e,t){return this.Il.on(e,t)}constructor(e,t,n){var r;if(this.Ml=null,this.El=null,this.Pl=[],this.Rl=void 0,this.Al=!1,this.Il=new Lc,this.Fl=(e,t)=>!(!se(e)||!se(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.Cl=e.persistence,this.He=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.Ol=void 0,this._sessionActivityTimestamp=null,this.Dl=t||xa,this.Ll=n||xa;let i=this.Ir.persistence_name||this.Ir.token;if(this._sessionTimeoutMs=1e3*xe(this.Ir.session_idle_timeout_seconds||1800,60,36e3,Rc.createLogger(`session_idle_timeout_seconds`),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Nl(),this.ql=`ph_`+i+`_window_id`,this.jl=`ph_`+i+`_primary_window_exists`,this.Bl()){let e=J.Dt(this.ql),t=J.Dt(this.jl);e&&!t?this.He=e:J.Lt(this.ql),J.At(this.jl,!0)}(r=this.Ir.bootstrap)!=null&&r.sessionID&&this.setBootstrapSessionId(this.Ir.bootstrap.sessionID),this.Hl()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return j(this.Pl)&&(this.Pl=[]),this.Pl.push(e),this.Xt&&e(this.Xt,this.He),()=>{this.Pl=this.Pl.filter(t=>t!==e)}}Bl(){return this.Ir.persistence!==`memory`&&!this.Cl.mi&&J.Et()}zl(e){e!==this.He&&(this.He=e,this.Bl()&&J.At(this.ql,e))}Ul(){return this.He?this.He:this.Bl()?J.Dt(this.ql):null}Wl(e){let t=this.Ml;return!N(t)&&!N(e)&&5e3>Math.abs(e-t)}Vl(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.Wl(t)||(this.Ml=t,this.Cl.register({[Xr]:[t,e,n]}))}Gl(){let e=this.Ir?.persistence_save_debounce_ms;return se(e)&&e>0}Zl(){this.Gl()?this.Cl.refreshKey(Xr):(this.Cl.flush(),this.Cl.load())}Ql(){if(N(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.Ml)return;this.Zl();let[,e,t]=this.Jl();e===this.Xt&&t===this._sessionStartTimestamp&&(this.Ml=this._sessionActivityTimestamp,this.Cl.register({[Xr]:[this._sessionActivityTimestamp,this.Xt??null,this._sessionStartTimestamp]}),this.Cl.flush())}Kl(){let[e]=this.Jl(),t=se(e)?e:0,n=se(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,n)}Xl(e){return this.Zl(),this.Fl(e,this.Kl())}Jl(){let e=this.Cl.props[Xr];return D(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Ml=null,this.Ol=void 0,clearTimeout(this.Yl),this.Yl=void 0,this.Vl(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 Rc.error(`Bootstrap sessionID cannot be in the future`):n}catch(e){Rc.error(`Invalid sessionID in bootstrap`,e);return}})(e);return!j(n)&&(t?this.Ol={sessionId:e,sessionStartTimestamp:n}:this.Vl(e,new Date().getTime(),n),!0)}destroy(){this.Al=!0,this.Ql(),clearTimeout(this.Yl),this.Yl=void 0,this.Rl&&s&&(s.removeEventListener(na,this.Rl,{capture:!1}),this.Rl=void 0),this.Pl=[]}Hl(){this.Rl=()=>{this.Ql(),this.Bl()&&J.Lt(this.jl)},G(s,na,this.Rl,{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.El=r;else if(N(this.El)||this.El>r||r-this.El>=1e3){var a,o;(a=(o=this.Cl).syncCookieProperties)==null||a.call(o),this.El=r}let[,s,c]=this.Jl(),l=!j(i)&&s!==i,u=this.Kl(),d=this.Ul(),f=this.Ol,p=!!f&&(f.sessionStartTimestamp>r+6e4||r-f.sessionStartTimestamp>zc),m=f?p:se(c)&&Math.abs(r-c)>zc,h=!1,g=l,_=!s||!!f,v=s,y=!_&&!e&&this.Fl(r,u);if(y&&(y=this.Xl(r),y||Rc.info(`cross-tab refresh kept the session alive`,{sessionId:s}),[,s,c]=this.Jl()),_||y||m){g=!1;let e=f&&!p;s=e?f.sessionId:this.Dl(),d=this.Ll(),Rc.info(`new session ID assigned`,{sessionId:s,windowId:d,bootstrapped:!!e,changeReason:{noSessionId:_,activityTimeout:y,sessionPastMaximumLength:m}}),c=e?f.sessionStartTimestamp:r,this.Ol=void 0,h=!0}else d||(d=this.Ll(),h=!0),g||=s!==v,g&&(Rc.info(`adopted cross-tab session id`,{sessionId:s,windowId:d}),h=!0);let b=se(u)&&e&&!m?u:r,x=se(c)?c:new Date().getTime();this.zl(d),this.Vl(s,b,x),e||this.Nl();let S={noSessionId:_,activityTimeout:y,sessionPastMaximumLength:m,crossTabAdoption:g};return h&&this.Pl.forEach(e=>e(s,d,S)),{sessionId:s,windowId:d,sessionStartTimestamp:x,changeReason:h?S:void 0,lastActivityTimestamp:u}}Nl(){this.Al||(clearTimeout(this.Yl),this.Yl=setTimeout(()=>{if(!this.Al){if(this.Xl(new Date().getTime())){let e=this.Xt;this.resetSessionId(),this.Il.emit(`forcedIdleReset`,{idleSessionId:e})}else this.Nl()}},1.1*this.sessionTimeoutMs))}},Vc=function(e,t){if(!e)return!1;let n=e.userAgent;if(n&&be(n,t))return!0;try{let n=e?.userAgentData;if(n?.brands&&n.brands.some(e=>be(e?.brand,t)))return!0}catch{}return!!e.webdriver};function Hc(){return(Hc=L(function*(){let e=l?.userAgentData;if(e?.getHighEntropyValues)try{let t=(yield e.getHighEntropyValues([`model`]))?.model;return M(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 Uc(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 Wc(e){var t;return!!((t=e.conditions)!=null&&(t=t.events)!=null&&(t=t.values)!=null&&t.length)}var Gc=(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}},Kc=e=>e.toLowerCase(),qc={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=>Gc(t,e))),not_regex:(e,t)=>t.every(t=>e.every(e=>!Gc(t,e))),icontains:(e,t)=>t.map(Kc).some(t=>e.map(Kc).some(e=>t.includes(e))),not_icontains:(e,t)=>t.map(Kc).every(t=>e.map(Kc).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 Jc(e,t){return!e||Object.entries(e).every(([e,n])=>{let r=t?.[e];if(r==null)return!1;let i=qc[n.operator];return!!i&&i(n.values.map(String),[String(r)])})}function Yc(e,t,n){return zo({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}var Xc=`custom`,Zc=`i.posthog.com`,Qc=/^\/static\//,$c=[`/s/`,`/e/`,`/i/`],el=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(`.${Zc}`,`.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`:Xc),this.tu[this.apiHost]}eu(e){if(!Qc.test(e))return;let t=this.instance.config.asset_host;return typeof t==`string`&&t.trim().replace(/\/$/,``)||void 0}iu(e){let t=Bo(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=Bo(n)?.href||n;r=i(new URL(e)).toString()}if(i&&e===`api`&&$c.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===Xc)return this.nu(e,t,this.apiHost+t);let n=Zc+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}`)}}},$=B(`[Surveys]`),tl=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){$.error(`Failed to persist survey seen state`,e)}},nl=[xs.Popover,xs.Widget,xs.API],rl={ignoreConditions:!1,ignoreDelay:!1,displayType:ws.Popover}
1,il=B(`[PostHog ExternalIntegrations]`),al={intercom:`intercom-integration`,crispChat:`crisp-chat-integration`},ol=class{constructor(e){this._instance=e}qo(e,t){var n,r;(n=y.__PosthogExtensions__)==null||(r=n.loadExternalDependency)==null||r.call(n,this._instance,e,e=>{if(e)return il.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=y.__PosthogExtensions__)!=null&&(e=e.integrations)!=null&&e[r])&&this.qo(al[r],()=>{var e;(e=y.__PosthogExtensions__)==null||(e=e.integrations)==null||(e=e[r])==null||e.start(this._instance)}),!i&&(t=y.__PosthogExtensions__)!=null&&(t=t.integrations)!=null&&t[r]&&((n=y.__PosthogExtensions__)==null||(n=n.integrations)==null||(n=n[r])==null||n.stop())}}},sl=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&&O(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)}}},cl=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);j(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)}},ll=`extensionsRemoteConfig`,ul=class{constructor(e){this.instance=e,this.xo=!1,this.$=z,this.au=e.lu,this.kv=new cl(e),this.onEvent=e=>Ts(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 Ts(()=>{});let t=t=>{try{e(t)}catch(e){this.$.error(`Browser extension remote config listener failed`,e)}},n=this.instance.uu.on(ll,t);return this.au&&t(this.au),Ts(n)},this.hu=new sl(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(wr);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 Ts(this.instance.cu(e))}handleRemoteConfig(e){this.xo||(this.au=e,this.instance.uu.emit(ll,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?gc(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`?C.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())}},dl={},fl=0,pl=()=>{}
1,ml=`Consent opt in/out is not valid with cookieless_mode="always" and will be ignored`,hl=`Surveys module not available`,gl=`sanitize_properties is deprecated. Use before_send instead`,_l=`Invalid value for property_denylist config: `,vl=/^[A-Za-z0-9_-]{1,400}$/,yl=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,bl=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,xl=[`token`,`distinct_id`,Ri],Sl=`posthog`,Cl=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},wl=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:pa(u?.location),persistence:`localStorage+cookie`,persistence_name:``,cookie_persisted_properties:[],loaded:pl,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:d&&M(d?.search)&&d.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:(s==null||(t=s.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:ea,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:pl},(e=>({rageclick:e&&e>=`2026-05-30`?{content_ignorelist:io,ignore_text_selection:!0}
1:!e||`2025-11-30`>e||{content_ignorelist:!0},capture_pageview:!e||`2025-05-24`>e||`history_change`,session_recording:Cl(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))},Tl=[[`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`]],El=e=>{let t={};for(let[n,r]of Tl)j(e[n])||(t[r]=e[n]);let n=W({},t,e),r=e.__preview_external_dependency_versioned_paths;return j(r)||(j(e.strict_script_versioning)&&(n.strict_script_versioning=!!r),M(r)&&j(e.asset_host)&&(n.asset_host=r)),D(e.property_blacklist)&&(j(e.property_denylist)?n.property_denylist=e.property_blacklist:D(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:z.error(_l+e.property_denylist)),n},Dl=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}},Ol=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(xa());this.register({distinct_id:t,$device_id:t}),e.set_property(H,Qi)}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 Dl,this.xu=!1,this.version=V.LIB_VERSION,this.Cu=new Set,this.$u=``,this.uu=new Lc,this.ru=[],this.Tu=[],this.yu=!1,this.mu=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=wl(),this.SentryIntegration=Po,this.sentryIntegration=e=>function(e,t){let n=No(e,t);return{name:Mo,processEvent:e=>n(e)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint=`/e/`,this.Iu=!1,this.Mu=null,this.Eu=null,this.Pu=null,this.scrollManager=new Pc(this),this.pageViewManager=new Fo(this),this.rateLimiter=new ks(this),this.requestRouter=new el(this),this.consent=new Ba(this),this.externalIntegrations=new ol(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=M(e)?{[e]:t}:e;this.setPersonProperties(r),n?.({})},set_once:(e,t,n)=>{let r=M(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!==Sl){let i=dl[r]??new e;return i._init(t,n,r),dl[r]=i,dl[Sl][r]=i,i}return this._init(t,n,r)}_init(e,t={},n){var r;let i=M(e)?e.trim():``;if(!i)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 i===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('${i}', { ... }, 'project2')`),this;this.__loaded=!0,this.config=wl(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 a=wl(t.defaults),o=El(t),c=W({},a,o,{name:n,token:i});k(a.rageclick)&&k(o.rageclick)&&(c.rageclick=W({},a.rageclick,o.rageclick)),k(a.session_recording)&&k(o.session_recording)&&(c.session_recording=W({},a.session_recording,o.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:ys.GZipJS;let l=this._u();if(this.persistence=new vs(this.config,l),this.sessionPersistence=this.config.persistence===`
1sessionStorage`||this.config.persistence===`memory`?this.persistence:new vs(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&&J.Et()){let e=J.Dt(this.$u);D(e)&&e.forEach(e=>{M(e)&&this.Cu.add(e)})}else J.Lt(this.$u);let u=R({},this.persistence.props),d=R({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Ou=new jc((e,t)=>this.Du(e,t),this.config.request_queue_config),this.Lu=new Nc(this),this.__request_queue=[];let f=this.pu();f||(this.sessionManager=new Bc(this),this.sessionPropsManager=new Ic(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&&!oe(p),t.bootstrap?.distinctID){let e=t.bootstrap.distinctID,n=this.get_distinct_id(),r=this.persistence.get_property(H);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(xa()),r=t.bootstrap.isIdentifiedID?n:e;this.persistence.set_property(H,t.bootstrap.isIdentifiedID?$i:Qi),this.register({distinct_id:e,$device_id:r})}}if(f)this.register_once({distinct_id:Li,$device_id:null},``);else if(!this.get_distinct_id()){let e=this.config.get_device_id(xa());this.register_once({distinct_id:e,$device_id:e},``),this.persistence.set_property(H,Qi)}return G(s,`onpagehide`in self?`pagehide`:`unload`,this._handle_unload.bind(this),{passive:!1}),G(s,`pageshow`,()=>{var e;this.ku=!1,this.Su||(e=this.Lu)==null||e.resume()}),t.segment?jo(this,()=>this.Bu()):this.Bu(),O(this.config._onCapture)&&this.config._onCapture!==pl&&(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 Hc.apply(this,arguments)}().then(e=>{e&&this.register({[Tr]:e})}).catch(pl),this}Hu(e){let t=e;return M(t.name)&&O(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)),O(this.featureFlags.onReloading)&&O(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,Oo)),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({[zi]:this.config.__preview_deferred_init_extensions?`deferred`:`synchronous`,[Bi]:n}),this.config.__preview_deferred_init_extensions&&z.info(`PostHog extensions initialized (${n}ms)`)}Xa(e){var t;if(!u||!u.body)return z.info(`document not ready yet, trying again in 500 milliseconds...`),void setTimeout(()=>{this.Xa(e)},500);if(this.config.__preview_deferred_init_extensions&&(this.Vu=e),this.lu=e,this.compression=void 0,e.ok){var n;let t=e.config;t.supportedCompression&&!this.config.disable_compression&&(this.compression=T(t.supportedCompression,ys.GZipJS)?ys.GZipJS:T(t.supportedCompression,ys.Base64)?ys.Base64:void 0),(n=t.analytics)!=null&&n.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint)}this.set_config({person_profiles:this.Eu?this.Eu:ea}),(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&&d?.hostname){let e=d.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 js(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()&&sa(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(ia),(r=this.logs)==null||r.flushLogs(`sendBeacon`),(i=this.Ou)==null||i.unload(),(a=this.Lu)==null||a.unload()):this.Xu()&&this.capture(ia,null,{transport:`sendBeacon`})}_send_request(e){Ac(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){fl++;try{let t,n=[],r=[],i=[];sa(e,e=>{if(e){if(t=e[0],D(t))i.push(e);else if(O(e))try{e.call(this)}catch(t){z.error(`Error executing queued PostHog call`,e,t)}else D(e)&&t===`alias`?n.push(e):D(e)&&t.indexOf(`capture`)!==-1&&O(this[t])?i.push(e):r.push(e)}});let a=function(e,t){sa(e,function(e){try{if(D(e[0])){let n=t;U(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{fl--}}push(t){if(fl>0&&D(t)&&M(t[0])){let n=e.prototype[t[0]];O(n)&&n.apply(this,t.slice(1));return}this._execute_array([t])}get Yu(){return{property:Or,persistenceKey:kr,cookieName:`_fbc`,pattern:yl,register:(e,t)=>this.persistence?.register({[kr]:{value:e,delivered:t}}),unregister:()=>this.persistence?.unregister(kr)}}get th(){return{property:Ar,persistenceKey:jr,cookieName:`_fbp`,pattern:bl,register:(e,t)=>this.persistence?.register({[jr]:{value:e,delivered:t}}),unregister:()=>this.persistence?.unregister(jr)}}eh(e){let t=this.persistence?.get_property(e.persistenceKey);return M(t)&&e.pattern.test(t)?{value:t,delivered:!1}:k(t)&&M(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=ha(e.cookieName);return M(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 M(t)&&yl.test(t)?this.ih(i,t,a):void i.unregister();let o=M(e)&&vl.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 M(e)&&bl.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(j(e)||!M(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&&!M(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=Nt(n?.uuid,xa),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=k(t?.$set)?t.$set:void 0,f=D(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(Or),g=m(Ar),_=[{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!==oa,e===aa);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),D(r))a=[],sa(r,t=>{a.push(e(t))});else{let t={};U(fe(r)?da(r):r,(r,i)=>{n.has(r)||(t[i]=e(r,i))}),a=t}return a}(e)}(l,e=>M(e)?e.slice(0,b):e)),l.timestamp=s,j(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 In.forEach(r),t.forEach(r),n}
1)(l.properties,xl)),e===Ss.DISMISSED||e===Ss.SENT){let n=t?.[Cs.SURVEY_ID],r=t?.[Cs.SURVEY_ITERATION];tl({id:n,current_iteration:r}),l.$set=R(R({},l.$set),{},{[Uc({id:n,current_iteration:r},e===Ss.SENT?`responded`:`dismissed`)]:!0})}else e===Ss.SHOWN&&(l.$set=R(R({},l.$set),{},{[Cs.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var b;if(e===Es.SHOWN){let e=t?.[Ds.TOUR_TYPE];e&&(l.$set=R(R({},l.$set),{},{[`${Ds.TOUR_LAST_SEEN_DATE}/${e}`]:new Date().toISOString()}))}let x=R(R({},l.properties.$set),l.$set);if(A(x)||this.setPersonPropertiesForFlags(x),!P(this.config.before_send)){let e=this.Os(l);if(!e)return;l=e,l.uuid=Nt(l.uuid,xa)}let S=_.filter(({channel:e,update:t})=>{let n=l.$set?.[e.property]??(k(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`,preferSyncCompression:n?.send_instantly,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&&A(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 ul(this)}cu(e){this.Tu.push(e);let t=!0;return()=>{if(!t)return;t=!1;let n=this.Tu.indexOf(e);n!==-1&&this.Tu.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,i){if(n||=new Date,!this.persistence||!this.sessionPersistence)return t;this.persistence.syncCookieProperties(),this.hh();let a=i?void 0:this.persistence.remove_event_timer(e),o=R({},t);if(o.token=this.config.token,o.$config_defaults=this.config.defaults,this.pu()&&(o[Ri]=!0),e===`$snapshot`){let e=R(R({},this.persistence.properties()),this.sessionPersistence.properties());return o.distinct_id=e.distinct_id,(!M(o.distinct_id)&&!F(o.distinct_id)||oe(o.distinct_id))&&z.error(`Invalid distinct_id for replay event. This indicates a bug in your implementation`),o}let c=function(e,t,n,r=!1){var i,a,o;if(!g)return{};let c=e?[...Ko,...t||[]]:[],[l,u]=xt(g),[f,p]=function(e){for(let t=0;Tt.length>t;t++){let[n,r,i]=Tt[t],a=e.match(n);if(a)return[r,(i&&e.match(i)||a)?.[1]||``]}return[``,``]}(g),m=function(){return(`u`>typeof navigator?navigator:void 0)?.brave?{brave:!0}:{}}(),h={};j(n)||(h.detectGoogleSearchApp=n);let _={},v=(i=navigator)==null||(i=i.userAgentData)==null?void 0:i.platform,y=navigator?.maxTouchPoints,b=s==null||(a=s.screen)==null?void 0:a.width,S=s==null||(o=s.screen)==null?void 0:o.height,C=s?.devicePixelRatio;j(v)||(_.userAgentDataPlatform=v),j(y)||(_.maxTouchPoints=y),j(b)||(_.screenWidth=b),j(S)||(_.screenHeight=S),j(C)||(_.devicePixelRatio=C);let w=W(ua({$os:l,$os_version:u,$browser:_t(g,navigator.vendor,m,h),$webview_app:f,$webview_app_version:p,$device:St(g),$device_type:Ct(g,_),$timezone:as(),$timezone_offset:os()}),{$current_url:Ho(r?Ft(d?.href):d?.href,c,Jo),$host:d?.host,$pathname:d?.pathname,$raw_user_agent:g.length>1e3?g.substring(0,997)+`...`:g,$browser_version:yt(g,navigator.vendor,m,h),$browser_language:$o(),$browser_language_prefix:es(),$screen_height:s?.screen.height,$screen_width:s?.screen.width,$viewport_height:s?.innerHeight,$viewport_width:s?.innerWidth,$lib:x.LIB_NAME,$lib_version:x.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return x.SDK_DIST_CHANNEL&&(w.$sdk_dist_channel=x.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(i,n.getTime(),!0);o.$session_id=e,o.$window_id=t}this.sessionPropsManager&&W(o,this.sessionPropsManager.getSessionProps());try{this.sessionRecording&&W(o,this.sessionRecording.sdkDebugProperties),o.$sdk_debug_retry_queue_size=this.Lu?.length}catch(e){o.$sdk_debug_error_capturing_properties=String(e)}let l;if(this.requestRouter.region===Xc&&(o.$lib_custom_api_host=this.config.api_host),l=e!==`$pageview`||i?e!==`$pageleave`||i?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,r),o=W(o,l),e===`$pageview`&&u&&(o.title=u.title),!j(a)){let e=n.getTime()-a;o.$duration=parseFloat((e/1e3).toFixed(3))}g&&this.config.opt_out_useragent_filter&&(o.$browser_type=this._is_bot()?`bot`:`browser`);let f=this.persistence.properties(),p=this.sessionPersistence.properties(),m=o.$groups,h=f.$groups;k(m)&&!A(m)&&(o.$groups=R(R({},k(h)?h:{}),m)),U([`$referrer`,`$referring_domain`],e=>{e in f&&delete p[e]});let _={};if(this.Tu.length>0)for(let e of this.Tu.slice())try{W(_,e())}catch(e){z.error(`Failed to produce browser extension event properties`,e)}o=W({},c,f,p,R(R({},_),o)),o.$is_identified=this._isIdentified(),D(this.config.property_denylist)?U(this.config.property_denylist,function(e){delete o[e]}):z.error(_l+this.config.property_denylist+` or property_blacklist config: `+this.config.property_blacklist);let v=this.config.sanitize_properties;v&&(z.error(gl),o=v(o,e));let y=this.fh();return o.$process_person_profile=y,y&&!i&&this.ph(`_calculate_event_properties`),o}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=W({},r,i||{},e||{}),o=this.config.sanitize_properties;return o&&(z.error(gl),a=o(a,`$set_once`)),t&&(this.xu=!0),A(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||!J.Et())return void J.Lt(this.$u);let e=[];this.Cu.forEach(t=>e.push(t)),e.length>0?J.At(this.$u,e):J.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:hl}),()=>{})}onSessionId(e){return this.sessionManager?.onSessionId(e)??(()=>{})}getSurveys(e,t=!1){this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:hl})}getActiveMatchingSurveys(e,t=!1){this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:hl})}renderSurvey(e,t){var n;(n=this.surveys)==null||n.renderSurvey(e,t)}displaySurvey(e,t=rl){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:hl}}canRenderSurveyAsync(e,t=!1){return this.surveys?.canRenderSurveyAsync(e,t)??Promise.resolve({visible:!1,disabledReason:hl})}mh(e){return!e||oe(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(F(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.Ra(),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(Er),this.register({distinct_id:e}));let o=(this.persistence.get_property(`$user_state`)||`anonymous`)===Qi,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(H,$i),this.setPersonPropertiesForFlags({$set:t||{},$set_once:n||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Aa(),this.capture(`$identify`,i,{$set:t||{},$set_once:n||{}})&&(this.Pu=Yc(e,t,n)),(c=this.featureFlags)==null||c.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:r)}else if(u){this.persistence.set_property(H,$i);let r=t||{},i=n||{};this.setPersonPropertiesForFlags({$set:r,$set_once:i},!1),this.config.cookieWinsOnConflict&&this.persistence.Aa(),this.capture(`$set`,{$set:r,$set_once:i})&&(this.Pu=Yc(e,t,n))}else(t||n)&&this.setPersonProperties(t,n);l||i||a?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(Di)):u&&(t||n)&&this.reloadFeatureFlags(),s=!0}finally{o&&this.persistence.Da(s)}}setPersonProperties(e,t){if(!e&&!t||!this.ph(`posthog.setPersonProperties`))return;let n=Yc(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=(D(e)?e:[e]).filter(e=>M(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(oa,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.Ya());let l=this.get_property(wr),u=this.get_property(Tr),d=this.get_property(Ur);(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.Ra)==null?void 0:s.call(o),m=!1;try{var h,g,_,v,y,b,x,S,C,w,ee,T;
1if((h=this.persistence)==null||h.clear(),(g=this.sessionPersistence)==null||g.clear(),this.Cu.clear(),this.dh(),j(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:Li,$device_id:null},``);else{let t=this.config.get_device_id(xa());this.register_once({distinct_id:t,$device_id:e?t:l},``),e||j(u)||this.register({[Tr]:u})}if(this.register({$last_posthog_reset:new Date().toISOString()},1),n&&(n.distinctID&&!this.pu()&&((T=this.persistence)==null||T.set_property(`$user_state`,n.isIdentifiedID?`identified`:`anonymous`),this.register({distinct_id:n.distinctID})),(ee=this.featureFlags)==null||ee.initialize(),!P(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 te,E;p&&((te=this.persistence)==null||(E=te.Da)==null||E.call(te,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`)?(j(t)&&(t=this.get_distinct_id()),e===t?(z.warn(`alias matches current distinct_id - skipping api call.`),this.identify(e),-1):(this.gh(Er,e),this.capture(`$create_alias`,{alias:e,distinct_id:t}))):void 0}set_config(e){let t=R({},this.config);if(k(e)){var n,r,i,a,o,s,c,l,u,d,f,p,m,h;W(this.config,El(e));let _=this._u();(n=this.persistence)==null||n.update_config(this.config,t,_),this.sessionPersistence=this.config.persistence===`sessionStorage`||this.config.persistence===`memory`?this.persistence:new vs(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,q.Et()&&q.At(`ph_debug`,!0),z.info(`set_config`,{config:e,oldConfig:t,newConfig:R({},this.config)})):(V.DEBUG=!1,q.Et()&&q.Lt(`ph_debug`))),(r=this.featureFlags)==null||(i=r.updateConfig)==null||i.call(r,this.config,this.Ya()),(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&&jo(this,pl,!1)}}
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??Sl;return e!==Sl&&(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()&&A(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(Ii,!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.pageViewManager)==null||a.destroy(),this.sessionManager=new Bc(this),this.pageViewManager=new Fo(this),this.persistence&&(this.sessionPropsManager=new Ic(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.lu&&((o=this.sessionRecording)==null||(s=o.onRemoteConfig)==null||s.call(o,this.lu)))}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()),(j(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(ml)}opt_out_capturing(){if(this.config.cookieless_mode===`always`)return void z.warn(ml);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:Li,$device_id:null}),this.vu(e),this.sessionRecording=void 0,(t=this.sessionManager)==null||t.destroy(),(n=this.pageViewM
1anager)==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 l?Vc(l,this.config.custom_blocked_useragents):void 0}Ju(){u&&(u.visibilityState===`visible`?this.Iu||(this.Iu=!0,this.capture(ra,{title:u.title},{send_instantly:!0}),this.Mu&&=(u.removeEventListener(ta,this.Mu),null)):this.Mu||(this.Mu=this.Ju.bind(this),G(u,ta,this.Mu)))}debug(e){!1===e?(s?.console.log(`You've disabled debug mode.`),this.set_config({debug:!1})):(s?.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}))}Ya(){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&&!P(e[t]),o=n in e&&!P(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(P(this.config.before_send))return e;let t=Object.keys(e.properties??{}).filter(le),n=D(this.config.before_send)?this.config.before_send:[this.config.before_send],r=e;for(let t of n)try{if(r=t(r),P(r)){let t=`Event '${e.event}' was rejected in beforeSend function`;return ce(e.event)?z.warn(`${t}. This can cause unexpected behavior.`):z.info(t),null}r.properties&&!A(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&&P(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=q.Et()&&q.Ot(`ph_debug`)===`true`;return!t&&(!!n||e)}};Ol.__defaultExtensionClasses={},Ol.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]]=la(e.prototype[t[n]])}(Ol,[`identify`]);var kl=class{constructor(e){this.disabled=!1===e;let t=k(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}},Al=`$copy_autocapture`,jl=B(`[AutoCapture]`);function Ml(e,t){return t.length>e?t.slice(0,e)+`...`:t}function Nl(e){if(e.previousElementSibling)return e.previousElementSibling;let t=e;do t=t.previousSibling;while(t&&!Ua(t));return t}function Pl(e,{e:t,maskAllElementAttributes:n,maskAllText:r,elementAttributeIgnoreList:i,elementsChainAsString:a,disableCaptureUrlHashes:o}){if(!Ua(e))return{props:{}};let c=[e],l=new Set([e]),u=e;for(;u.parentNode&&!Y(u,`body`)&&1e3>c.length;){if(Ga(u.parentNode)){let e=u.parentNode.host;if(l.has(e))break;l.add(e),c.push(e),u=e;continue}if(!Ua(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=>Y(e,`button`)||Y(e,`a`)):-1;d>0&&(r||=c.slice(0,d+1).some(e=>!fo(e)||po(e)));let f=[],p={},m,h=!1,g=!1;if(U(c,e=>{let t=fo(e);if(Y(e,`a`)&&!n&&!i?.includes(`href`)){let n=e.getAttribute(`href`);h=!!(t&&n&&xo(n))&&(o?Ft(n):n)}T(Ja(e),`ph-no-capture`)&&(g=!0),f.push(function(e,t,n,r,i=!1){let a=e.tagName.toLowerCase(),o={tag_name:a};Qa.indexOf(a)>-1&&!n&&(o.$el_text=a.toLowerCase()===`a`||a.toLowerCase()===`button`?Ml(1024,So(e)):Ml(1024,Xa(e)));let s=Ja(e);t||r!=null&&r.includes(`class`)||0>=s.length||(o.classes=s.filter(function(e){return e!==``})),U(e.attributes,function(n){var a;
1if((!po(e)||[`name`,`id`,`class`,`aria-label`].indexOf(n.name)!==-1)&&!r?.includes(n.name)&&!t&&xo(n.value)&&(!M(a=n.name)||a.substring(0,10)!==`_ngcontent`&&a.substring(0,7)!==`_nghost`)){let e=n.value;n.name===`class`&&(e=Ka(e).join(` `)),o[`attr__`+n.name]=Ml(1024,n.name===`href`&&i?Ft(e):e)}});let c=1,l=1,u=e;for(;u=Nl(u);)c++,u.tagName===e.tagName&&l++;return o.nth_child=c,o.nth_of_type=l,o}(e,n,r,i,o)),U(function(e){if(!fo(e))return{};let t={};return U(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&&xo(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=Y(e,`a`)||Y(e,`button`)?So(e):Xa(e)),h){var _;f[0].attr__href=h;let e=Bo(h)?.host,t=s==null||(_=s.location)==null?void 0:_.host;e&&t&&e!==t&&(m=h)}return{props:W((y=t.type,{$event_type:y,$ce_version:1}),a?{}:{$elements:f},{$elements_chain:(v=f,D(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 ca(n).sort(([e],[t])=>function(e,t){return t>e?-1:+(e>t)}(e,t)).forEach(([e,t])=>r[wo(e.toString())]=wo(t.toString())),t+=`:`,t+=ca(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:To(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return ca(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 Fl=class{ho(){this.co=void 0,clearTimeout(this.do),this.do=void 0}vo(e){if(!fo(e))return!0;let t=this.fo().css_selector_ignorelist??no,n=new Set,r=e;for(;r;){if(n.size>=1e3||n.has(r))return!0;n.add(r);let e=r,i=Ja(e);if(T(i,`ph-no-capture`)||T(i,`ph-sensitive`)||po(e)||t.some(t=>$a(e,t)))return!0;let a=r.parentNode;r=Ga(a)?a.host:a&&Ua(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=Za(e);e.isPrimary&&e.button===0&&!e.ctrlKey&&t&&Ua(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=Za(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&&(Y(n,`html`)||Y(n,`body`))){if(t.excluded)return null;let e=this.fo().css_selector_ignorelist??no;return[n,u?.documentElement,u?.body].some(t=>{if(!t)return!1;let n=Ja(t);return T(n,`ph-no-capture`)||T(n,`ph-sensitive`)||!fo(t)||po(t)||e.some(e=>$a(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 kl(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.To=t,this.startIfEnabled())}dispose(){var e;this.xo||(this.xo=!0,this.mo=void 0,(e=this.To)==null||e.dispose(),this.To=void 0,this.Io())}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 jl.info(`Disabling Automatic Event Collection because this browser is not supported`);if(!s||!u)return;let e=this.Eo=e=>{e||=s?.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(N(t))return;this.Po(e,`$autocapture`,t)}catch(e){jl.error(`Failed to capture event`,e)}};if(G(s,`blur`,e),G(u,`submit`,e,{capture:!0}),G(u,`change`,e,{capture:!0}),G(u,`click`,e,{capture:!0}),U([`pointerdown`,`pointermove`,`pointerup`,`pointercancel`],t=>{G(u,t,e,{capture:!0})}),this.fo().capture_copied_text){let e=this.Ro=e=>{e||=s?.event;try{this.Po(e,Al)}catch(e){jl.error(`Failed to capture clipboard event`,e)}};G(u,`copy`,e,{capture:!0}),G(u,`cut`,e,{capture:!0}),G(u,`paste`,e,{capture:!0})}}Io(){this.ho(),this.Eo&&=(s?.removeEventListener(`blur`,this.Eo),U([`pointerdown`,`pointermove`,`pointerup`,`pointercancel`],e=>{u?.removeEventListener(e,this.Eo,!0)}),u?.removeEventListener(`submit`,this.Eo,!0),u?.removeEventListener(`change`,this.Eo,!0),u?.removeEventListener(`click`,this.Eo,!0),void 0),this.Ro&&=(u?.removeEventListener(`copy`,this.Ro,!0),u?.removeEventListener(`cut`,this.Ro,!0),u?.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;
1t.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=>{(u?.querySelectorAll(n))?.forEach(i=>{e!==i&&t!==i||T(r,n)||r.push(n)})}),r}get isEnabled(){if(this.xo)return!1;let e=this.mo?.kv.get(Nr),t=this.wo,n=this.fo();if(!n.remoteRequestsDisabled&&!this.ko)return!1;let r=n.remoteRequestsDisabled&&!this.ko;if(N(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||Za(e);Wa(r)&&(r=r.parentNode||null);let i=this.$o();var a;t===`$autocapture`&&e.type===`click`&&e instanceof MouseEvent&&i.rageclick&&(a=this.rageclicks)!=null&&a.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime())&&co(r,i.rageclick)&&this.Po(e,`$rageclick`,n);let o=t===Al,c=o?R(R({},i),{},{dom_event_allowlist:void 0}):i;if(r&&function(e,t,n,r,i,a){if(!s||lo(e)||n?.url_allowlist&&!qa(n.url_allowlist,a)||n?.url_ignorelist&&qa(n.url_ignorelist,a))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:o,targetElementList:c}=uo(e,r);if(!function(e,t){let n=t?.element_allowlist;if(j(n))return!0;for(let t of e)if(n.some(e=>t.tagName.toLowerCase()===e))return!0;return!1}(c,n)||!eo(c,n?.css_selector_allowlist)||eo(c,n?.css_selector_ignorelist??no))return!1;try{let n=s.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(i||[`submit`]).indexOf(t.type)>=0;case`input`:case`select`:case`textarea`:return(i||[`change`,`click`]).indexOf(t.type)>=0;default:return o?(i||[`click`]).indexOf(t.type)>=0:(i||[`click`]).indexOf(t.type)>=0&&(Qa.indexOf(l)>-1||e.getAttribute(`contenteditable`)===`true`)}}(r,e,c,o,o?[`copy`,`cut`,`paste`]:void 0,{config:{get_current_url:i.getCurrentUrl}})){var l;let{props:n,explicitNoCapture:a,target:o}=Pl(r,{e,maskAllElementAttributes:i.maskAllElementAttributes,maskAllText:i.maskAllText,elementAttributeIgnoreList:i.element_attribute_ignorelist,elementsChainAsString:this.So,disableCaptureUrlHashes:i.disableCaptureUrlHashes});if(a)return!1;let c=this.getElementSelectors(r,o);if(c&&c.length>0&&(n.$element_selectors=c),t===Al){let t=e.type||`clipboard`;if(t!==`paste`){var u;let e=s==null||(u=s.getSelection())==null?void 0:u.toString(),t=Ya(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 O(u?.querySelectorAll)}},Il=class{constructor(e){this._instance=e}refresh(e){let t=this._instance.config,n=k(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.Ya(),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}},Ll=B(`[ExceptionAutocapture]`),Rl=()=>{},zl=e=>{if(O(e))return e.__posthog_layer__??e.__rrweb_layer__};function Bl(e,t,n){try{if(!(t in e))return Rl;let r={next:e[t]},i=n(function(...e){return r.next.apply(this,e)});return O(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=zl(n);for(;a;){if(a.next===i)return void(a.next=r.next);n=a.next,a=zl(n)}}}catch{return Rl}}var Vl=B(`[TracingHeaders]`),Hl=B(`[Web Vitals]`),Ul=9e5,Wl=[`CLS`,`FCP`,`INP`,`LCP`],Gl=[`INP`,`LCP`],Kl=[`interactionTarget`,`interactionType`,`inputDelay`,`processingDuration`,`presentationDelay`,`loadState`,`target`,`url`,`timeToFirstByte`,`resourceLoadDelay`,`resourceLoadDuration`,`elementRenderDelay`,`largestShiftTarget`,`largestShiftTime`,`largestShiftValue`,`firstByteToFCP`],ql=`disabled`,Jl=`lazy_loading`,Yl=B(`[SessionRecording]`),Xl=B(`[Heatmaps]`);function Zl(e){return k(e)&&`clientX`in e&&`clientY`in e&&F(e.clientX)&&F(e.clientY)}var Ql=B(`[Product Tours]`),$l=e=>!e.config.disable_product_tours&&!!e.persistence?.get_property(Br),eu=[`$set_once`,`$set`],tu=B(`[SiteApps]`),nu=`Error while initializing PostHog app with config id `,ru=(e,t)=>
1e?.then?e.then(t):t(e),iu=`SDK is not enabled or survey functionality is not yet loaded`,au=`Disabled. Not loading surveys.`,ou=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.Th=null,this.xo=!1,this.Ih=new Set,this.onRemoteConfig=e=>{if(this.xo||this.Ir.disableSurveys)return;if(!e.ok)return $.warn(`Remote config unavailable. Not loading surveys.`);let t=e.config.surveys;if(P(t))return $.warn(`Flags not loaded yet. Not loading surveys.`);this.Mh=I(t)?t:t.length>0,$.info(`flags response received, isSurveysEnabled: ${this.Mh}`),this.loadIfEnabled()}}setup(e){if(!this.xo)return this.Eh=e,ru(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.To=t,this.loadIfEnabled())})}dispose(){var e,t,n,r;this.xo||(this.xo=!0,this.Eh=void 0,this.mo=void 0,(e=this.To)==null||e.dispose(),this.To=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.Ih.forEach(e=>clearTimeout(e)),this.Ih.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 $.info(`Already initializing surveys, skipping...`);if(e.disableSurveys)return void $.info(au);if(e.cookielessMode&&this.bo.isOptedOut())return void $.info(`Not loading surveys in cookieless mode without consent.`);let t=this.bo.getExtensions();if(!t)return void $.error(`PostHog Extensions not found.`);if(j(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(Zi),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(),$.info(`Surveys loaded successfully`),this.Ah({isLoaded:!0}))}Rh(e,t){$.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 $.info(au),e([]);let r=n.kv.get(hi);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=>$.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 $.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=>$.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(iu)}))}Dh(e,t){if(this.xo)return{surveys:[],context:{isLoaded:!1,error:iu}};let n=t.statusCode;if(n!==200||!t.json){let e=`Surveys API could not be loaded, status: ${n}`;return n===0?t.error||$.warn(e):$.error(e),this.Th=Date.now(),{surveys:[],context:{isLoaded:!1,error:e}}}this.Th=null;let r=t.json.surveys||[],i=r.filter(e=>function(e){return!(!e.start_date||e.end_date)}(e)&&(Wc(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({[hi]:r,[gi]:Date.now()}),{surveys:r,context:{isLoaded:!0}}}Fh(){return this.Lh()&&!this.$h&&!this.Nh()}Lh(){let e=(this.mo??this.Sh)?.kv.get(gi);return F(e)&&Date.now()-e>3e5}Nh(){return F(this.Th)&&3e5>Date.now()-this.Th}markSurveyAsSeen(e,t){tl({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){$.error(`Error in survey callback`,e)}}getActiveMatchingSurveys(e,t=!1){if(!P(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);$.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(P(this._surveyManager))return{eligible:!1,reason:iu};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(P(this._surveyManager))return{eligible:!1,reason:iu};let t=typeof e==`string`?this.qh(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:`Survey not found`}}canRenderSurvey(e){if(P(this._surveyManager))return $.warn(`init was not called`),{visible:!1,disabledReason:iu};let t=this.Bh(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return P(this._surveyManager)?($.warn(`init was not called`),Promise.resolve({visible:!1,disabledReason:iu})):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(P(this._surveyManager))return void $.warn(`init was not called`);let r=typeof e==`string`?this.qh(e):e;if(!r?.id)return void $.warn(`Survey not found`);if(!nl.includes(r.type))return void $.warn(`Surveys of type ${r.type} cannot be rendered in the app`);let i=u?.querySelector(t);if(i){if(r.appearance?.surveyPopupDelaySeconds){$.info(`Rendering survey ${r.id} with delay of ${r.appearance.surveyPopupDelaySeconds} seconds`);let e=setTimeout(()=>{var t;this.Ih.delete(e),!this.xo&&this.bo.isCapturing()&&($.info(`Rendering survey ${r.id} with delay of ${r.appearance?.surveyPopupDelaySeconds} seconds`),(t=this._surveyManager)==null||t.renderSurvey(r,i,n),$.info(`Survey ${r.id} rendered`))},1e3*r.appearance.surveyPopupDelaySeconds);this.Ih.add(e);return}this._surveyManager.renderSurvey(r,i,n)}else $.warn(`Survey element not found`)}displaySurvey(e,t){var n;if(!this.bo.isCapturing())return;if(P(this._surveyManager))return void $.warn(`init was not called`);let r=this.qh(e);if(!r)return void $.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!==ws.Popover&&t.initialResponses&&$.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 $.warn(`Survey is not eligible to be displayed: `,e.reason)}t.displayType===ws.Inline?this.renderSurvey(i,t.selector,t.properties):this._surveyManager.handlePopoverSurvey(i,t)}cancelPendingSurvey(e){P(this._surveyManager)?$.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 su(e,t,n){if(P(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 cu=class{constructor(e){this._instance=e,this.Hh=new Set,this.zh=new Set,this.Uh=new Lc,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(){j(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 Lc}register(e){if(!j(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`||!su(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=>su(e.href,t.href,t.href_matching||`exact`));let i=(e==null||(n=e.properties)==null?void 0:n.$elements_chain)||``;return!!i&&su(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=>su(e.text,t.text,t.text_matching||`exact`)||su(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(;!P(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=>su(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||Jc(t.properties.reduce((e,t)=>{let n=D(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)}},lu=class{constructor(e){var t,n;this.sc=[],this._instance=e,this.rc=new Map,this.oc=new Map,this.ac=new Map,this.lc=(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&&Jc(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===bs.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){j(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.ac.clear(),n.length===0)return void(t&&((r=this.kc)==null||r.replace([])));this.kc||(this.kc=new cu(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.ac.get(t.name)??[];n.includes(e.id)||n.push(e.id),this.ac.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,bs.Activation),a=this.gc(e,bs.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.Tc(a),void this.Ic([a])}if(this.oc.has(e)){let n=this.mc(e,t,bs.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,bs.Activation);this.Ec(o.map(e=>e.id))}onAction(e){this.ac.has(e)&&this.Ec(this.ac.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.Tc(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()})}Tc(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.Ic(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()}))}Ic(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&&(A(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 F(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=>F(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.lc)==null||e.call(this),this.lc=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}},uu=class extends lu{constructor(e){super(e)}qc(){return _i}jc(){return vi}cc(){return yi}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 F(r)&&r>0}Wc(){return Ss.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 $}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 Wc(e)&&!!((t=e.conditions)!=null&&(t=t.events)!=null&&t.repeatedActivation)||e.schedule===`always`}(n)?e===Ss.SHOWN?`consume`:`ignore`:e===Ss.SHOWN?`persist`:e===Ss.DISMISSED||e===Ss.SENT?`consume`:`ignore`}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},du=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);j(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))}},fu=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=y?.__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 uu(this._instance)}},pu=s?.location?Uo(s.location.hash,`__posthog`)||Uo(location.hash,`state`):null,mu=`_postHogToolbarParams`,hu=B(`[Toolbar]`),gu=B(`[FeatureFlags]`),_u=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:j(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:D(e.flag_keys)?e.flag_keys:void 0}))(e,t),!e.evaluation_environments||e.evaluation_contexts||this.Vc||(gu.warn(`evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version.`),this.Vc=!0),j(e.flag_keys)||D(e.flag_keys)||gu.error(`Invalid flag_keys found:`,e.flag_keys,`Expected array of non-empty strings`)}get(){return this.Gc}},vu=B(`[FeatureFlags]`),yu=B(`[FeatureFlags]`,{debugEnabled:!0}),bu=`" failed. Feature flags didn't load in time.`,xu=[`click`,`keydown`,`wheel`,`touchstart`,`pointerdown`],Su=`connection_error`,Cu=e=>{let t={};for(let n=0;e.length>n;n++)t[e[n]]=!0;return t},wu=e=>{let t={};for(let[n,r]of ca(e||{}))r&&(t[n]=r);return t},Tu=e=>fe(e)&&(e.name===`RangeError`&&e.message.indexOf(`Maximum call stack size exceeded`)===0||e.name===`InternalError`&&e.message===`too much recursion`),Eu=B(`[Error tracking]`),Du=`webkit-masked-url:`,Ou=[{value:`isolatedAPI.contexts.topHostname`,exact:!1},{value:`No response from target`,exact:!0}],ku=[`chrome-extension://`,`moz-extension://`,`safari-extension:`,`safari-web-extension:`,Du],Au=[`__firefox__`,`__gCrWeb`],ju=`Refusing to render web experiment since the viewer is a likely bot`,Mu={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>Gc(t,e),not_regex:(e,t)=>!Gc(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e},Nu=B(`[Conversations]`),Pu=`Conversations not available yet.`;function Fu(e,t){let n=e?.flushIntervalMs??3e3,r=e?.maxBufferSize??100,i=t?.consoleCapture?void 0:e?.maxLogsPerInterval??1e3,a=j(i)?Math.max(r,2048):Math.max(r,i),o=R(R({},function(){let e=``,t=``;try{let n=l?.userAgent;n&&([e,t]=xt(n))}catch{}return function(e,t){let n=function(e){if(e)return{}.hasOwnProperty.call(tr,e)?tr[e]:e}(e);return R(R({},n?{"os.name":n}:{}),t?{"os.version":t}:{})}(e,t)}()),e?.resourceAttributes);return{serviceName:o?.[`service.name`]??e?.serviceName??t?.serviceNameDefault,serviceVersion:o?.[`service.version`]??e?.serviceVersion,environment:o?.[`deployment.environment`]??e?.environment,resourceAttributes:o,beforeSend:e?.beforeSend,flushIntervalMs:n,maxBufferSize:r,maxQueueSize:a,maxBatchRecordsPerPost:100,rateCapWindowMs:n,maxLogsPerInterval:i,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}var Iu=[`debug`,`log`,`warn`,`error`,`info`],Lu=e=>{for(;e?.__rrweb_original__;)e=e.__rrweb_original__;return e},Ru=`console`,zu=`__posthogHandledLogsRequestError`,Bu=(e,t)=>{let n=e instanceof Error?e:Error(t);return n[zu]=!0,n},Vu=e=>!!e&&typeof e==`object`&&!0===e[zu],Hu=B(`[NetworkMetrics]`),Uu=()=>{var e;return s!=null&&(e=s.performance)!=null&&e.now?s.performance.now():Date.now()},Wu={"http:":80,"https:":443},Gu=new Set([`CONNECT`,`DELETE`,`GET`,`HEAD`,`OPTIONS`,`PATCH`,`POST`,`PUT`,`TRACE`]),Ku=(e,t)=>{let n=String(t);return{method:String(e).toUpperCase(),url:Bo(n)?.href||n}},qu=(e,t,n,r,i,a,o=!1)=>{try{var s;let c=i();if(!c)return;let l=n||void 0,u=Uu()-r,d=Bo(t.url);if(d&&d.protocol!==`http:`&&d.protocol!==`https:`)return;let f={url:d?.href||t.url,method:t.method},p=O(c.name)?c.name(f):M(c.name)?c.name:`http.client.request.duration`;if(!p)return;let m=o&&!l?void 0:((e,t)=>e?400>e?void 0:String(e):t?.name||`_OTHER`)(l,a),h=R(R(R(R(R({},(e=>{let t=Gu.has(e)?e:`_OTHER`;return R({"http.request.method":t},t===`_OTHER`&&e!==t?{"http.request.method_original":e}:{})})(f.method)),d?(e=>{return{"server.address":e.hostname.startsWith(`[`)&&e.hostname.endsWith(`]`)?e.hostname.slice(1,-1):e.hostname,"server.port":Number(e.port)||Wu[e.protocol],"url.scheme":e.protocol.slice(0,-1),"url.template":(t=e.pathname,t.split(`/`).map(e=>(e=>/^\d+$/.test(e)||e.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(e))(e)?`:id`:e).join(`/`))};var t})(d):{}),l?{"http.response.status_code":l}:{}),m?{"error.type":m}:{}),c.attributes?.call(c,f,{status:l,durationMs:u}));(s=e.metrics)==null||s.histogram(p,u,{unit:`ms`,attributes:h})}catch(e){Hu.error(`Failed to record network metric`,e)}},Ju=()=>{},Yu=(e,t)=>
1O(s?.fetch)?Bl(s,`fetch`,n=>function(...r){let i=Uu(),a=n.apply(this,r);if(!t())return a;try{let[n,o]=r,s=Ku(o?.method??n?.method??`GET`,n?.url??n);return a.then(n=>(qu(e,s,n?.status,i,t,void 0,!0),n),n=>{throw qu(e,s,void 0,i,t,n),n})}catch(e){return Hu.error(`Failed to observe fetch`,e),a}}):Ju,Xu=(e,t)=>{var n;let r=s==null||(n=s.XMLHttpRequest)==null?void 0:n.prototype;if(!r)return Ju;let i=new WeakMap,a=Bl(r,`open`,e=>function(...t){try{dc.has(this)||i.set(this,Ku(t[0],t[1]))}catch(e){Hu.error(`Failed to observe XHR open`,e)}return e.apply(this,t)}),o=Bl(r,`send`,n=>function(...r){let a;try{let n=i.get(this);if(n&&t()){let r=Uu();a=()=>{this.removeEventListener(`loadend`,a),qu(e,n,this.status,r,t)},G(this,`loadend`,a)}}catch(e){Hu.error(`Failed to observe XHR send`,e)}try{return n.apply(this,r)}catch(e){throw a&&this.removeEventListener(`loadend`,a),e}});return()=>{a(),o()}},Zu={featureFlags:class{constructor(e){this.name=`featureFlags`,this.Zc=!1,this.featureFlagEventHandlers=[],this.$=vu,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.ad=!1,this.an=()=>{let e=this.ld();this.od=0,e&&this.reloadFeatureFlags()},this.ud=()=>{let e=this.hd,t=this.dd??e;j(e)||j(t)||this.Ir.remoteRequestsDisabled||!u||u.visibilityState===`hidden`||Date.now()-(this.vd??0)<t||(this.dd=this.ad||!this.Ir.idleRefreshBackoff?e:Math.min(2*t,36e5),this.ad=!1,this.reloadFeatureFlags(),this.fd())},this.pd=()=>{this.ad&&this.dd===this.hd||this.gd()},this.ln=()=>{u?.visibilityState===`visible`&&this.gd()},`get`in e?this.bo=e:(this._instance=e,this.md=new _u(e.config,e.Ya()),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]`),ru(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 s&&G(s,`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.ad=!0,this.dd=this.hd,this.ud()}yd(){let e=this.Ir.refreshIntervalMs,t=!this.Ir.remoteRequestsDisabled&&u&&!j(e)&&e>0?e:void 0;this.Ir.idleRefreshBackoff||(this.dd=t),t!==this.hd&&(this.$d(),j(t)||(this.hd=t,this.dd=t,this.fd(),u!=null&&u.addEventListener&&(G(u,ta,this.ln),sa(xu,e=>{G(u,e,this.pd,{capture:!0})}))))}fd(){j(this.hd)||(j(this.Td)||clearInterval(this.Td),this.vd=Date.now(),this.Td=setInterval(this.ud,this.hd))}$d(){var e;j(this.Td)||(clearInterval(this.Td),this.Td=void 0,u==null||(e=u.removeEventListener)==null||e.call(u,`visibilitychange`,this.ln),sa(xu,e=>{var t;u==null||(t=u.removeEventListener)==null||t.call(u,e,this.pd,{capture:!0})})),this.hd=void 0,this.dd=void 0,this.ad=!1,this.vd=void 0}destroy(){this.Id()}dispose(){this.Id()}Id(){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=[],s?.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!j(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&&!D(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={[ii]:p,[ri]:p,[si]:m};e.$feature_flag_details&&(h[oi]=p);for(let t of[ci,Ai,li])j(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)}}
1xd(){let e={};for(let t of[ii,si,ci,ui]){let n=this.Ed(t);j(n)||(e[t]=n)}this.Qc=e;let t=R({},e),n=this.Ed(ri);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(Ai);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(!j(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=>!j(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:Pn(t),variant:Fn(t),reason:void 0,metadata:j(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(oi),t=this.Ed(ui),n=this.Ed(di);if(!n&&!t)return e||{};let r=W({},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=j(s)?(a=i?.enabled)!=null&&a:!!s,l=j(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:Pn(r),variant:Fn(r),payload:Nn(t[n])}})}getFlagVariants(){let e=this.Ed(ri),t=this.Ed(ui);if(!t)return e||{};let n=W({},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(si),t=this.Ed(di);if(!t)return e||{};let n=W({},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.ld()||(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(Di)}jd(e){this.Md();let t=this.mo;if(!t||this.Ir.remoteRequestsDisabled||this.ld())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(pi),timezone:as()};j(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();j(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?Su:`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({[ki]: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({[ki]:[Su]}),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)}}ld(){return Wo(this.od,3)}Bd(e){this.od=Go(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+bu);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+bu);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(Oi);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({[Di]:u,[Oi]:l});else{var d,f,p,m,h,g,_,v;D(u[e])?u[e].push(o):u[e]=[o],this.At(R({[Di]:u},l?{[Oi]:l}:{}));let t=this.getFeatureFlagDetails(e),n=[...this.Ed(`$feature_flag_errors`)??[]];j(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};j(t==null||(p=t.metadata)==null?void 0:p.has_experiment)||(r.$feature_flag_has_experiment=t.metadata.has_experiment),j(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),j(t?.original_variant)&&j(t?.original_enabled)||(r.$feature_flag_original_response=j(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({[Di]:u,[Oi]:l});return r?{key:e,enabled:!!i,variant:typeof i==`string`?i:void 0,payload:Nn(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;j(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+bu),t.defaultValue;let n=this.getFeatureFlag(e,t);return j(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=vu)=>{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=>!j(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(D(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{[ii]:c,[ri]:e,[li]:!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({[ii]:Object.keys(wu(f)),[ri]:f||{},[si]:p||{},[oi]:m||{},[li]:!0===e.minimalFlagCalledEvents},u?{[ci]:u}:{}),d?{[Ai]:d}:{})})(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),n,this.$);if(r){if(!1===n?.persist){let e=!j(this.mo.kv.get(ri));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([ui,di]),this.Cd(),void yu.info(`All overrides cleared`);if(D(e))return this.At({[ui]:Cu(e)}),this.Cd(),void yu.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[ui]=D(i)?Cu(i):i),a&&(r[di]=a),Object.keys(r).length&&this.At(r),!1===i&&!1===a?this.Lt([ui,di]):!1===i?this.Lt(ui):!1===a&&this.Lt(di),this.Cd(),!1===i?yu.info(`Flag overrides cleared`):i&&yu.info(`Flag overrides set`,{flags:i}),!1===a?yu.info(`Payload overrides cleared`):a&&yu.info(`Payload overrides set`,{payloads:a});return}if(e&&typeof e==`object`)return this.At({[ui]:e}),this.Cd(),void yu.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({[ii]:Object.keys(wu(s)),[ri]:s,[fi]: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(ai);!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({[ai]: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({[fi]: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({[fi]:n}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e=!0){this.Lt(fi),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({[pi]:r}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){let t=this.Ed(`$stored_group_properties`)||{};this.At({[pi]:R(R({},t),{},{[e]:{}})})}else this.Lt(pi)}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}}},Qu={sessionRecording:class{get Ir(){return this._instance.config}get Cl(){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=ql,this.Jd=void 0,this.Kd=!1,this.Xe=(()=>{var e,t;if(!u?.visibilityState||u.visibilityState===`visible`)return!0;let n=s==null||(e=s.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;u?.visibilityState===`visible`&&(this.Xe=!0,(e=this.Zd)==null||(t=e.setDocumentWasEverVisible)==null||t.call(e,!0))},!this._instance.sessionManager)throw Yl.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"`);u!=null&&u.addEventListener&&G(u,`visibilitychange`,this.ln)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:e=!1}={}){var t;this.Kd=!0,u==null||(t=u.removeEventListener)==null||t.call(u,`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 s&&e&&t&&!n}startIfEnabledOrStop(e){if(this.Kd||this.Yd&&this.Zd?.isStarted)return;let t=!j(Object.assign)&&!j(Array.from);this.Yd&&t?(this.tv(e),Yl.info(`starting`)):(this.Qd=ql,this.stopRecording())}tv(e){var t;if(this.Yd){if(this.Qd!==`awaiting_config`&&this.Qd!==`missing_config`&&(this.Qd=Jl),y!=null&&(t=y.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&y.__PosthogExtensions__?.initSessionRecording)this.ev(e);else{var n,r;let t=this._instance.sessionManager;(n=y.__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}),Yl.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.Cl)==null||e.unregister(`$session_is_sampled`),(t=this.Cl)==null||t.unregister(`$replay_sample_rate`)}sv(e,t){if(P(e))return null;let n=F(e)?e:parseFloat(e);return typeof(r=n)!=`number`||!Number.isFinite(r)||0>r||r>1?(Yl.warn(`${t} must be between 0 and 1. Ignoring invalid value:`,e),null):n;var r}rv(e){if(this.Cl){var t;let n=this.Cl,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;P(a)&&this.nv();let o=t?.minimumDurationMilliseconds;n.register({[Ur]: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},sampleRate:a,minimumDurationMilliseconds:j(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`,this._instance.register_for_session({[Hi]:!0}),Yl.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):Yl.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(Ur);return(n==null||(t=n.scriptConfig)==null?void 0:t.script)||`lazy-recorder`}ov(){let e=this._instance.get_property(Ur);if(!e)return!1;let t;try{t=typeof e==`object`?e:JSON.parse(e)}catch(e){return Yl.warn(`persisted remote config for session recording is invali
1d and will be ignored`,e),!1}return!P(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}ev(e){var t,n;if(!this.Kd&&this.Yd&&this._instance.sessionManager){if(!y.__PosthogExtensions__?.initSessionRecording)return Yl.warn(`Called on script loaded before session recording is available. This can be caused by adblockers.`),void this._instance.register_for_session({[Vi]:!0});if(this.Zd||(this.Zd=y.__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`,Yl.info(`persisted remote config is stale, requesting fresh config before starting`),new js(this._instance).load();return}this.Qd=Jl,(t=(n=this.Zd).setDocumentWasEverVisible)==null||t.call(n,this.Xe),this.Zd.start(e)}else this.Qd=ql}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.Cl)==null||t.register({$replay_override_linked_flag:!0}),(e=this.Zd)==null||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.Zd||(t=this.Cl)==null||t.register({$replay_override_sampling:!0}),(e=this.Zd)==null||e.overrideSampling()}overrideTrigger(e){var t,n;this.Zd||(n=this.Cl)==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)}}},$u={autocapture:class extends Fl{constructor(e){super(new Il(e)),this.instance=e}},historyAutocapture:class{constructor(e){this._instance=e,this.av=this.lv()}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.av=this.lv(),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(){s&&s.history&&(this.fv(`pushState`),this.fv(`replaceState`),this.pv(),this.hv()&&this.gv())}fv(e){if(!s||s.history[e]?.__posthog_wrapped__)return;let t=this;Bl(s.history,e,n=>function(r,i,a){n.call(this,r,i,a),t.mv(e)})}lv(){let e=s?.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}:k(e)?e:{}}hv(e=this.uv()){return!!e.hash&&!this._instance.config.disable_capture_url_hashes}yv(e){let t=this.uv(),n=this.av;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.lv();if(!t)return;this.yv(t)&&this._instance.capture(ra,{navigation_type:e}),this.av=t}catch(t){z.error(`Error capturing ${e} pageview`,t)}}pv(){if(this.dv)return;let e=()=>{this.mv(`popstate`)};G(s,`popstate`,e),this.dv=()=>{s&&s.removeEventListener(`popstate`,e)}}gv(){if(this.vv)return;let e=()=>{this.mv(`hashchange`)};G(s,`hashchange`,e),this.vv=()=>{s&&s.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[Pr],this.rageclicks=new kl(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let e=5e3;return k(this.Ir.capture_heatmaps)&&this.Ir.capture_heatmaps.flush_interval_milliseconds&&(e=this.Ir.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return P(this.Ir.capture_heatmaps)?P(this.Ir.enable_heatmaps)?this.bv:this.Ir.enable_heatmaps:!1!==this.Ir.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this._o)return;Xl.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({[Pr]:n}),this.bv=n,this.startIfEnabled()}getAndClearBuffer(){let e=this.Rt;return this.Rt=void 0,e}xv(e){Zl(e.originalEvent)&&this.Mr(e.originalEvent,`deadclick`)}ln(){this._v&&clearInterval(this._v),this._v=u?.visibilityState===`visible`?setInterval(this.pl.bind(this),this.flushIntervalMilliseconds):null}wv(){s&&u&&(this.Cv=this.pl.bind(this),G(s,na,this.Cv),this.$v=e=>this.Mr(e||s?.event),G(u,`click`,this.$v,{capture:!0}),this.Tv=e=>
1this.Iv(e||s?.event),G(u,`mousemove`,this.Tv,{capture:!0}),this.Mv=new ko(this.instance,Do,this.xv.bind(this)),this.Mv.startIfEnabledOrStop(),this.Ev=this.ln.bind(this),G(u,ta,this.Ev),this._o=!0)}Sv(){var e;s&&u&&(this.Cv&&s.removeEventListener(na,this.Cv),this.$v&&u.removeEventListener(`click`,this.$v,{capture:!0}),this.Tv&&u.removeEventListener(`mousemove`,this.Tv,{capture:!0}),this.Ev&&u.removeEventListener(ta,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(),i=this.instance.scrollManager.scrollElement(),a=function(e,t,n){let r=e;for(;r&&Ua(r)&&!Y(r,`body`);){if(r===n)return!1;let e;try{e=(r.ownerDocument?.defaultView??s)?.getComputedStyle(r).position}catch{return!1}if(T(t,e))return!0;r=to(r)}return!1}(Za(e),[`fixed`,`sticky`],i);return{x:e.clientX+(a?0:r),y:e.clientY+(a?0:n),target_fixed:a,type:t}}Mr(e,t=`click`){var n;if(Ha(e.target)||!Zl(e))return;let r=this.Rv(e,t);(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&co(Za(e),this.instance.config.rageclick)&&this.Zs(R(R({},r),{},{type:`rageclick`})),this.Zs(r)}Iv(e){!Ha(e.target)&&Zl(e)&&(clearTimeout(this.Pv),this.Pv=setTimeout(()=>{this.Zs(this.Rv(e,`mousemove`))},500))}Zs(e){if(!s)return;let t=this.Ir.disable_capture_url_hashes?Ft(s.location.href):s.location.href,n=this.Ir.custom_personal_data_properties,r=Ho(t,this.Ir.mask_personal_data_properties?[...Ko,...n||[]]:[],Jo);this.Rt=this.Rt||{},this.Rt[r]||(this.Rt[r]=[]),this.Rt[r].push(e)}pl(){this.Rt&&!A(this.Rt)&&this.instance.capture(`$$heatmap`,{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:ko,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},P(e?.name)||P(e?.value))return void Hl.error(`Invalid metric received`,e);let t=typeof e.navigationURL==`string`?e.navigationURL:void 0,n=this.Dv(t);if(j(n))return;let r=F(e.navigationId)||typeof e.navigationId==`string`?`navigation:${e.navigationId}`:`url:${n}`;if(this.Lv&&e.value>=this.Lv)return void Hl.error(`Ignoring metric with value >= `+this.Lv,e);this.Rt.navigationKey!==r&&(this.Av(),this.Fv=setTimeout(this.Av,this.flushToCaptureTimeoutMs)),j(this.Rt.navigationKey)&&(this.Rt.navigationKey=r,this.Rt.url=n),this.Rt.firstMetricTimestamp=j(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,k(e.attribution)&&this.attributionMetrics.indexOf(e.name)>-1){let t={};for(let n of Kl){let r=n===`url`&&typeof e.attribution[n]==`string`?this.Dv(e.attribution[n]):e.attribution[n];j(r)||(t[n]=r)}a.attribution=t}else delete a.attribution;j(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=y.__PosthogExtensions__,o=a?.postHogWebVitalsCallbacksByFlavor,s=o?.[this.qv]||(this.qv===`web-vitals`&&j(o)?a?.postHogWebVitalsCallbacks:void 0);if(!j(s)){let a=s.withoutAttribution,o=this.attributionMetrics;i=!j(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 Hl.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[Rr],this.startIfEnabled()}get jv(){return this._instance.config.capture_performance}get allowedMetrics(){let e=k(this.jv)?this.jv?.web_vitals_allowed_metrics:void 0;return P(e)?this._instance.persistence?.props.$web_vitals_allowed_metrics||Wl:e}get flushToCaptureTimeoutMs(){return(k(this.jv)?this.jv.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){let e=k(this.jv)?this.jv.web_vitals_attribution:void 0;return I(e)?e?Wl:[]:D(e)?e:Gl}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){let e=k(this.jv)?this.jv.__preview_web_vitals_soft_navs:void 0;return e!=null&&e}get Lv(){let e=k(this.jv)&&F(this.jv.__web_vitals_max_value)?this.jv.__web_vitals_max_value:Ul;return e>0&&6e4>=e?Ul:e}get isEnabled(){let e=d?.protocol;if(e!==`http:`&&e!==`https:`)return Hl.info(`Web Vitals are disabled on non-http/https protocols`),!1;let t=k(this.jv)?this.jv.web_vitals:I(this.jv)?this.jv:void 0;return I(t)?t:this.bv}startIfEnabled(){this.isEnabled&&!this._o&&(Hl.info(`enabled, starting...`),this.qo(this.Nv))}onRemoteConfig(e){if(!e.ok)return;let t=e.config;if(!(`capturePerformance`in t))return;let n=k(t.capturePerformance)&&!!t.capturePerformance.web_vitals,r=k(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Rr]:n}),this._instance.persistence.register({[Hr]: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=y.__PosthogExtensions__,r=this.qv,i=n?.postHogWebVitalsCallbacksByFlavor;i?.[r]||r===`web-vitals`&&j(i)&&n?.postHogWebVitalsCallbacks?e():n==null||(t=n.loadExternalDependency)==null||t.call(n,this._instance,r,t=>{t?Hl.error(`failed to load script`,t):e()})}Dv(e){let t=e||s?.location.href;if(!t)return void Hl.error(`Could not determine current URL`);let n=this._instance.config.disable_capture_url_hashes?Ft(t):t,r=this._instance.config.custom_personal_data_properties;return Ho(n,this._instance.config.mask_personal_data_properties?[...Ko,...r||[]]:[],Jo)}}},ed={exceptionObserver:class{constructor(e){this.Nv=()=>{if(!s||!this.isEnabled||!y.__PosthogExtensions__?.errorWrappingFunctions)return;let e=y.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,t=y.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,n=y.__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){Ll.error(`failed to start`,e),this.Uv()}},this._instance=e,this.Wv=!!this._instance.persistence?.props[Fr],this.wt=new Se(R(R({},function(e={}){return{refillRate:e.exceptionRateLimiterRefillRate??e.__exceptionRateLimiterRefillRate??1,bucketSize:e.exceptionRateLimiterBucketSize??e.__exceptionRateLimiterBucketSize??10}}(this._instance.config.error_tracking)),{},{refillInterval:1e4,$:Ll})),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 k(e)?t=R(R({},t),e):(j(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?(Ll.info(`enabled`),this.Uv(),this.qo(this.Nv)):this.Uv()}qo(e){var t,n;y.__PosthogExtensions__?.errorWrappingFunctions?e():(t=y.__PosthogExtensions__)==null||(n=t.loadExternalDependency)==null||n.call(t,this._instance,`exception-autocapture`,t=>{if(t)return Ll.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({[Fr]: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 Ll.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 qt([new hn,new Tn,new _n,new gn,new Cn,new Sn,new yn,new wn],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=sn.test(r)?r.replace(sn,`$1`):r;if(!o.match(/\S*Error: /)){for(let n of t){let t=n(o,e);if(t){i.push(t);let e=ln(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(pn(i,s)>=50)break}}let c=[...s].sort((e,t)=>t.start-e.start),l=c[c.length-1];if(l){let e=dn(i,l);i.splice(l.start-e,e);for(let t of c)t.start-=e}for(let e of c)un(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++)mn(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`,nn,on)),this._instance=e,this.Gv=this._instance.persistence?.get_property(`$error_tracking_suppression_rules`)??[],this.Qv=An(this.Jv()),this.Kv=new jn(this.Qv)}onConfigChange(){this.Qv=An(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({[Ir]:this.Gv,[Lr]:r})}get Xv(){var e;let t=!!this._instance.get_property(Lr);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(!M(e)||e.trim().length===0)return void Eu.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)=>On.has(r)?(t.push(r),n):(n[r]=e[r],n),{}),droppedKeys:t}}(this.Yv(t));r.length>0&&Eu.warn(`Ignoring reserved exception step fields`,{droppedKeys:r}),this.Kv.add(R({[En]:e,[Dn]:new Date().toISOString()},n))}catch(e){Eu.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 Eu.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 Eu.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 Eu.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 Eu.info(`Skipping exception capture because it was thrown by the PostHog SDK`)}let n=this.Qv.enabled&&P(e.$exception_steps)?this.af(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){Tu(e)||Eu.error(`Failed to capture exception event. Dropping this exception.`,e),this.Kv.clear();return}}catch(e){Tu(e)||Eu.error(`Failed to process exception event. Ignoring this exception.`,e);return}}af(e){try{let t=this.Kv.getAttachable();return t.length===0?e:R(R({},e),{},{$exception_steps:t})}catch(t){return Eu.error(`Failed to read buffered exception steps. Capturing exception without steps.`,t),e}}if(e){this.Qv.enabled&&this.Kv.add({[En]:e,[Dn]:new Date().toISOString()})}Yv(e){return k(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})=>(M(t)&&t.length>0&&e.$exception_types.push(t),M(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=qc[e.operator],r=t[e.key];if(!n||!r)return!1;let i=D(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 Eu.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&&ku.some(t=>e.startsWith(t)));return n.length!==0&&(!n.every(({filename:e})=>!!e&&e.startsWith(Du))||e.some(({type:e,value:t})=>e===`NoResponse`||M(t)&&Ou.some(({value:e,exact:n})=>n?t===e:t.includes(e)))&&!t.some(({in_app:e,filename:t})=>e&&!t?.startsWith(Du)))}sf(e){return e.some(({value:e})=>M(e)&&Au.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!P(e)&&D(e)}}},td=R({productTours:class{get Cl(){return this._instance.persistence}constructor(e){this.lf=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.Cl&&this.Cl.register({[Br]:!!t.productTours}),!$l(this._instance))return!this.lf&&P(this.Cl?.props.ph_product_tours)||Ql.info(`product tours disabled; stopping and clearing cached tours`),(n=this.lf)==null||n.stop(),this.lf=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.lf&&$l(this._instance)&&this.qo(()=>this.hf())}qo(e){var t,n;y.__PosthogExtensions__?.generateProductTours?e():(t=y.__PosthogExtensions__)==null||(n=t.loadExternalDependency)==null||n.call(t,this._instance,`product-tours`,t=>{t?Ql.error(`Could not load product tours script`,t):e()})}hf(){var e;!this.lf&&(e=y.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.lf=y.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t=!1){if(D(this.uf)&&!t)return void e(this.uf,{isLoaded:!0});let n=this.Cl;if(n){let r=n.props[bi];if(D(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(!$l(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||Ql.warn(n):Ql.error(n),e([],{isLoaded:!1,error:n});return}let i=D(t.json.product_tours)?t.json.product_tours:[];this.uf=i,n&&n.register({[bi]:i}),e(i,{isLoaded:!0})}})}getActiveProductTours(e){P(this.lf)?e([],{isLoaded:!1,error:`Product tours not loaded`}):this.lf.getActiveProductTours(e)}showProductTour(e){var t;(t=this.lf)==null||t.showTourById(e)}previewTour(e){this.lf?this.lf.previewTour(e):this.qo(()=>{var t;this.hf(),(t=this.lf)==null||t.previewTour(e)})}dismissProductTour(){var e;(e=this.lf)==null||e.dismissTour(`user_clicked_skip`)}nextStep(){var e;(e=this.lf)==null||e.nextStep()}previousStep(){var e;(e=this.lf)==null||e.previousStep()}clearCache(){var e;this.uf=null,(e=this.Cl)==null||e.unregister(`ph_product_tours`)}resetTour(e){var t;(t=this.lf)==null||t.resetTour(e)}resetAllTours(){var e;(e=this.lf)==null||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.lf)==null||t.cancelPendingTour(e)}}},Zu),nd={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=y._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({},Kn(e,eu)),{},{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)||(tu.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)||(tu.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=u?.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})},s=e=>{if(a.has(e))return e;let t=i.pf(e);return t&&a.add(t),t},c=e=>e.map(e=>typeof e==`string`?e:s(e)).filter(e=>!N(e));return o(n,`appendChild`,e=>function(t){let n=s(t);return n?e.call(this,n):t}),o(n,`insertBefore`,e=>function(t,n){let r=s(t);return r?e.call(this,r,n):t}),o(n,`replaceChild`,e=>function(t,n){let r=s(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,c(t))}),o(e,`prepend`,e=>function(...t){return e.apply(this,c(t))})}),[t.Element?.prototype,t.CharacterData?.prototype,t.DocumentType?.prototype].forEach(e=>{o(e,`before`,e=>function(...t){return e.apply(this,c(t))}),o(e,`after`,e=>function(...t){return e.apply(this,c(t))}),o(e,`replaceWith`,e=>function(...t){let n=c(t);return t.length&&!n.length?void 0:e.apply(this,n)})}),o(t.Element?.prototype,`insertAdjacentElement`,e=>function(t,n){let r=s(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&&(tu.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,tu.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){tu.error(nu+e.id,t),i(!1)}if(r&&t.loaded)try{n()}catch(n){tu.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){tu.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 tu.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;y[`__$$ph_site_app_${e}`]=this._instance,(r=y.__PosthogExtensions__)==null||(i=r.loadSiteApp)==null||i.call(r,this._instance,t,t=>{if(t)return tu.error(nu+e,t)})}else tu.error(`PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.`)}}}},rd={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?(j(this.kf)&&(this.kf=(t=y.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null?void 0:t._patchXHR(e,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),j(this.Sf)&&(this.Sf=(n=y.__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;y.__PosthogExtensions__?.tracingHeadersPatchFns?e():(t=y.__PosthogExtensions__)==null||(n=t.loadExternalDependency)==null||n.call(t,this._instance,`tracing-headers`,t=>{if(t)return Vl.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 D(e)?(D(this.xf)?this.xf.splice(0,this.xf.length,...e):this.xf=[...e],e.length>0?this.xf:void 0):(D(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()}}},id=R({surveys:class extends ou{constructor(e){var t;super(new fu(e),(t=e,{get projectToken(){return t.config.token},kv:new du(t)})),this._instance=e}Oh(e,t){let n=t.query?gc(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})})}}},Zu),ad={toolbar:class{constructor(e){this.instance=e}Tf(e){y.ph_toolbar_state=e}If(){return y.ph_toolbar_state??0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e=void 0,t=void 0,n=void 0){if(ma(this.instance.config)||!s||!u)return!1;e??=s.location,n??=s.history;try{if(!t){try{s.localStorage.setItem(`test`,`test`),s.localStorage.removeItem(`test`)}catch{return!1}t=s?.localStorage}let r=pu||Uo(e.hash,`__posthog`)||Uo(e.hash,`state`),i,a=r?It(()=>JSON.parse(atob(decodeURIComponent(r))))||It(()=>JSON.parse(decodeURIComponent(r))):null;return a&&a.action===`ph_authorize`?(i=a,i.source=`url`,i&&Object.keys(i).length>0&&(a.desiredHash?e.hash=a.desiredHash:n?n.replaceState(n.state,``,e.pathname+e.search):e.hash=``)):(i=JSON.parse(t.getItem(mu)||`{}`),i.source=`localstorage`,delete i.userIntent),!(!i.token||this.instance.config.token!==i.token||(this.loadToolbar(i),0))}catch{return!1}}Mf(e){let t=y.ph_load_toolbar||y.ph_load_editor;!P(t)&&O(t)?t(e,this.instance):hu.warn(`No toolbar load function found`)}loadToolbar(e){let t=!!u?.getElementById(`__POSTHOG_TOOLBAR__`);if(!s||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(s.localStorage.setItem(mu,JSON.stringify(R(R({},r),{},{source:void 0}))),this.If()===2)this.Mf(r);else if(this.If()===0){var i,a;this.Tf(1),(i=y.__PosthogExtensions__)==null||(a=i.loadExternalDependency)==null||a.call(i,this.instance,`toolbar`,e=>{if(e)return hu.error(`[Toolbar] Failed to load`,e),void this.Tf(0);this.Tf(2),this.Mf(r)}),G(s,`turbolinks:load`,()=>{this.Tf(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)}}},od=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);M(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(ju);else if(!this.Ir.disable_web_experiments){if(P(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=Vo(t?.search,`__experiment_id`),r=Vo(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!P(t.conditions)&&e.Df(t,n)&&e.Lf(t)}static Df(t,n){if(P(t.conditions)||P(t.conditions?.url))return!0;let r=e.getWindowLocation();if(r){let e=Va(n,r.href);return!t.conditions?.url||Mu[t.conditions?.urlMatchType??`icontains`](t.conditions.url,e)}return!1}static getWindowLocation(){return s?.location}static Lf(e){if(P(e.conditions)||P(e.conditions?.utm))return!0;let t=Xo();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(ju):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 l&&this._instance?Vc(l,this.Ir.custom_blocked_useragents):void 0}}},Zu),sd={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;P(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||ma(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;let e=y?.__PosthogExtensions__;if(e&&!j(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(Zi);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 Nu.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,Nu.info(`Conversations loaded successfully`)}catch(e){this.zf(`Error completing conversations initialization`,e)}else Nu.error(`Cannot complete initialization: remote config is null`)}zf(e,t){Nu.error(e,t),this._conversationsManager=null,this.qf=!1,this.jf=!0}show(){this._conversationsManager?this._conversationsManager.show():Nu.warn(`Conversations not loaded yet.`)}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Nf&&!N(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?`disabled_by_config`:ma(this._instance.config)?`disabled_for_toolbar`:this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?`consent_opted_out`:!1===this.Bf?`remote_config_failed`:j(this.Nf)?this.Bf?`disabled_in_project`:`remote_config_pending`:this.Nf?P(this.ne)||!this.ne.token?`missing_token`:y?.__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):(Nu.warn(Pu),null)})()}getMessages(e,t){var n=this;return L(function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(Nu.w
2arn(Pu),null)})()}markAsRead(e){var t=this;return L(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(Nu.warn(Pu),null)})()}getTickets(e){var t=this;return L(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(Nu.warn(Pu),null)})()}requestRestoreLink(e){var t=this;return L(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(Nu.warn(Pu),null)})()}restoreFromToken(e){var t=this;return L(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(Nu.warn(Pu),null)})()}restoreFromUrlToken(){var e=this;return L(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(Nu.warn(Pu),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()}}},cd={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(Vu)||this.$.error(...e)}}),this.nl=[],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),s&&G(s,`online`,this.Yf)}np(e,t,n,r){var i;let a=Fu((i=this._instance)==null||(i=i.config)==null?void 0:i.logs,n);return[new dr(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.ap===t||((n=this.tp)==null||n.reset(),this.ap=t,[this.tp,this.lp]=this.np(()=>this.nl,e=>{this.nl=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},Ru)),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.To=r,n||this.loadIfEnabled())}dispose(){var e,t,n,r;this.xo||(this.xo=!0,this.pp(),(e=this.To)==null||e.dispose(),this.To=void 0,this.mo=void 0,this.Vf=!1,s?.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;P(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.nl=[],(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[Vr])}dp(){var e,t,n;return!((e=this._instance)!=null&&(t=e.Ya)!=null&&t.call(e))||!!((n=y._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||!y?.console)return;let t=Fu((e=this._instance)==null||(e=e.config)==null?void 0:e.logs).maxBufferSize,n=!0;this.Jf.push(()=>{n=!1});for(let e of Iu){let r;try{r=Lu(y.console[e])}catch{continue}r&&this.Jf.push(Bl(y.console,e,i=>{let a=(...r)=>{try{n&&this.yp(e,r,t)}catch{}
2return i.apply(y.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)=>this.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){Vu(e)||this.$.error(`PostHog logs flush failed:`,e)}loadIfEnabled(){if(this.xo||!this.Uf||this.Wf||this.Vf)return;let e=y?.__PosthogExtensions__;if(!e)return this.$.error(`PostHog Extensions not found.`),void this.pp();let t=e.loadExternalDependency;if(!t)return this.$.error(Zi),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===S.LogsQueue?e():void 0,setPersistedProperty(e,n){e===S.LogsQueue&&t(n??[])},js:e=>this.js(e),getLibraryId:()=>V.LIB_NAME,getLibraryVersion:()=>V.LIB_VERSION}}js(e){return new Promise(t=>{if(Wo(this.od,3))return void t({kind:`fatal`,error:Bu(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:Bu(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:Bu(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=Go(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.nl.length>0&&this.$p(e,this.nl,this.lp,V.LIB_NAME,e=>{this.nl=e}),this.Zf.length>0&&this.$p(e,this.Zf,this.cp,Ru,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=sr(a,or(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,P(r)||(t.sessionStartTimestamp=r),P(i)||(t.lastActivityTimestamp=i)}if(y!=null&&(e=y.location)!=null&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?Ft(y.location.href):y.location.href),this._instance.featureFlags){let e=this._instance.featureFlags.getFlags();e&&e.length>0&&(t.activeFeatureFlags=e)}return t}}},ld={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.Tp?this.Tp=(e=>{let t=!0,n=()=>t?(e=>{let t=e.config.metrics?.network;return!0===t?{}:t||void 0})(e):void 0,r=Yu(e,n),i=Xu(e,n);return()=>{t=!1,r(),i()}})(this._instance):!e&&this.Tp&&(this.Tp(),this.Tp=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.ap===t||((n=this.tp)==null||n.reset(),this.ap=t,this.tp=new hr(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.Tp)==null||e.call(this),this.Tp=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.Ip(),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}`)})}}))})}Ip(){return this._instance.requestRouter.endpointFor(`api`,`/i/v1/metrics`)+`?token=`+encodeURIComponent(this._instance.config.token)}}};Ol.__defaultExtensionClasses=R({},R(R(R(R(R(R(R(R(R(R(R(R(R({},Zu),Qu),$u),ed),td),nd),id),rd),ad),od),sd),cd),ld));var ud=function(){V.SDK_DIST_CHANNEL=`npm`;let e=dl[Sl]=new Ol;return function(){function e(){e.done||(e.done=!0,kc=!1,U(dl,function(e){e._dom_loaded()}))}u?.addEventListener?u.readyState===`complete`?e():G(u,`DOMContentLoaded`,e,{capture:!1}):s&&z.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),e}(),dd=new Set([`ResizeObserver loop completed with undelivered notifications.`,`ResizeObserver loop limit exceeded`,`Script error.`]);function fd(e){if(e?.event!==`$exception`)return e;try{let t=nf(e);return t?.length&&t.every(e=>dd.has(e))?null:e}catch{return e}}var pd=[`$current_url`,`$pathname`,`$referrer`,`$initial_current_url`,`$initial_pathname`,`$initial_referrer`,`$prev_pageview_pathname`,`$prev_pageview_current_url`,`$session_entry_url`,`$session_entry_pathname`,`$session_entry_referrer`,`navigationURL`],md=[`$set`,`$set_once`],hd=new Set([`$web_vitals`,`$pageview`,`$pageleave`,`$exception`]),gd=300,_d=new Set(`eventBucket.messageBucket.toolResultBytesBucket.prBucket.subsessionBucket.foldBucket.scenario.build.gateOpenMs.hydratedMs.hydrateMs.hydrateRowCount.networkFetchMs.networkEventCount.foldMs.foldEventCount.cacheHitMs.foldedMs.firstRowMs.liveMs.interactiveMs.outcome.droppedSinceLast.kind.durationMs.longestTaskMs.commitCount.feature.phase.visibility.hiddenMsBucket.msToFirstFrame.queuedWorkMs.queuedWorkCount.longestFeature.pageCount.cacheHitCount.networkFetchCount.networkMs.writeQueueWaitMs.writeBackMs`.split(`.`)),vd=new Set([`token`,`$lib`,`$lib_version`,`$device_id`,`distinct_id`,`$session_id`,`$window_id`,`$pageview_id`,`$insert_id`,`$time`,`commit_sha`]);function yd(e){return e.startsWith(`session.`)}function bd(e){return e===null||typeof e==`number`||typeof e==`boolean`||typeof e==`string`&&e.length<=64}function xd(e){let t=!1,n={};for(let[r,i]of Object.entries(e))(_d.has(r)||vd.has(r))&&bd(i)?n[r]=i:t=!0;return t?n:e}function Sd(e){if(e.$set!==void 0||e.$set_once!==void 0)return{$set:void 0,$set_once:void 0}}function Cd(e){let t=fd(e);if(t===null)return null;try{let e=yd(t.event),n=e?xd(t.properties):t.properties,r=hd.has(t.event)?Dd(Bd(n)):Td(n),i=e?Sd(t):wd(t);return r===t.properties&&i===void 0?t:{...t,properties:r,...i}}catch{return null}}function wd(e){let t=!1,n={};for(let r of md){let i=e[r];if(i===void 0)continue;let a=Ed(i);a!==i&&(t=!0),n[r]=a}return t?n:void 0}function Td(e){return Ed(e)}function Ed(e){let t=!1,n={...e};for(let r of pd){let i=e[r];if(typeof i==`string`&&Wd(i)){let e=Gd(i);e!==i&&(n[r]=e,t=!0)}}return t?n:e}function Dd(e){let t=e.$exception_list;if(!Array.isArray(t))return e;let n=!1,r=t.map(e=>{if(!tf(e)||typeof e.value!=`string`)return e;let t=kd(e.value.slice(0,gd));return t===e.value?e:(n=!0,{...e,value:t})});return n?{...e,$exception_list:r}:e}var Od=/[a-z][a-z0-9+.-]*:\/\/[^\s"'<>)]+/gi;function kd(e){return e.replace(Od,e=>Gd(e))}function Ad(e){let t=rf(e);return t===void 0?e:Error(t)}var jd=new Set([`accept-invitation`,`invite`,`join`,`redeem`,`reset`,`verify`]),Md=new Set([`invite`]),Nd=`:redacted`,Pd=/^[a-z][a-z0-9+.-]*:\/\//i,Fd=/^xox[a-z]-/i,Id=/^[A-Za-z0-9_-]+$/,Ld=/[0-9]/,Rd=/[A-Za-z]/,zd=/^[a-z]+_[0-9a-z]+$/;function Bd(e){let t=Vd(e,new WeakSet);return tf(t)?t:e}function Vd(e,t){if(typeof e==`string`)return Wd(e)?Gd(e):e;if(typeof e!=`object`||!e||t.has(e))return e;t.add(e);try{if(Array.isArray(e)){let n=e.map(e=>Vd(e,t));return n.every((t,n)=>t===e[n])?e:n}let n=Ud(e),r=n!==e,i={};for(let[e,a]of Object.entries(n)){let n=Vd(a,t);i[e]=n,r||=n!==a}return r?i:e}finally{t.delete(e)}}function Hd(e){if(!(`toJSON`in e)||typeof e.toJSON!=`function`)return;let t=e.toJSON();if(tf(t))return t;if(typeof t==`string`||Array.isArray(t))return{toJSON:t}}function Ud(e){let t=Hd(e);if(t!==void 0)return t;if(Object.getPrototypeOf(e)===Object.prototype&&tf(e))return e;let n={};for(let t=e;t!==null&&t!==Object.prototype;t=Object.getPrototypeOf(t))for(let r of Object.keys(t))r in n||(n[r]=Reflect.get(e,r));return n}function Wd(e){return Pd.test(e)||e.startsWith(`/`)}function Gd(e){let t=$d(e,[`?`,`#`]),n=t===-1?e:e.slice(0,t),r=n.startsWith(`/`)?0:n.indexOf(`/`,n.indexOf(`://`)+3);return r===-1?n:`${n.slice(0,r)}${Zd(n.slice(r))}`}var Kd=new Set([`Error`,`TypeError`,`RangeError`,`SyntaxError`,`ReferenceError`,`EvalError`,`URIError`,`AggregateError`,`DOMException`,`AbortError`,`TimeoutError`,`NetworkError`,`QuotaExceededError`,`SecurityError`,`NotAllowedError`,`NotFoundError`,`NotSupportedError`,`InvalidStateError`,`DataCloneError`,`DataError`,`C
2onstraintError`,`TransactionInactiveError`,`VersionError`,`UnknownError`,`ChunkLoadError`]),qd=`unknown`;function Jd(e){return typeof e==`string`&&Kd.has(e)?e:qd}var Yd=new Set([`slack`,`github`,`google`]),Xd=new Set([`complete`,`failure`,`approve`]);function Zd(e){let t=e.split(`/`),n=``,r=!1;for(let e=1;e<t.length;e+=1){let i=t[e]??``,a=ef(i).toLowerCase(),o=jd.has(n)&&Yd.has(a);(i!==``&&(r||jd.has(n))&&!o&&!Xd.has(a)||Qd(i))&&(t[e]=Nd),r=o,n=a}return t.join(`/`)}function Qd(e){if(Fd.test(e))return!0;let t=e.indexOf(`_`);return t>0&&zd.test(e)?Md.has(e.slice(0,t)):e.length>=16&&Id.test(e)&&Ld.test(e)&&Rd.test(e)}function $d(e,t){let n=-1;for(let r of t){let t=e.indexOf(r);t!==-1&&(n===-1||t<n)&&(n=t)}return n}function ef(e){try{return decodeURIComponent(e)}catch{return e}}function tf(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function nf(e){let t=e.properties.$exception_list;if(!Array.isArray(t))return;let n=[];for(let e of t){if(typeof e!=`object`||!e||!(`value`in e)||typeof e.value!=`string`)return;n.push(e.value)}return n}function rf(e){if(!(typeof e!=`object`||!e))try{return`_tag`in e&&typeof e._tag==`string`?e._tag:void 0}catch{return}}var{NEXT_PUBLIC_POSTHOG_KEY:af,NEXT_PUBLIC_POSTHOG_HOST:of,VERCEL_GIT_COMMIT_SHA:sf}=o(),cf=!!af,lf=!1,uf=[],df=100;function ff(e){if(cf){if(lf){e();return}uf.length<df&&uf.push(e)}}function pf(e,t){ff(()=>ud.capture(e,t))}function mf(e,t){ff(()=>ud.captureException(Ad(e),t))}function hf(e,t){ff(()=>ud.identify(e,t))}function gf(e,t,n){ff(()=>ud.group(e,t,n))}function _f(){if(lf)return{distinctId:ud.get_distinct_id(),sessionId:ud.get_session_id(),sessionReplayUrl:ud.get_session_replay_url({withTimestamp:!0})}}function vf(e={}){if(!(lf||!af)){ud.init(af,{api_host:`/ingest`,ui_host:of,person_profiles:`identified_only`,autocapture:e.autocapture===!0,session_recording:{maskAllInputs:!0},capture_pageview:!1,capture_pageleave:!0,capture_performance:{web_vitals:!0},capture_exceptions:!0,before_send:Cd}),ud.register({commit_sha:sf}),lf=!0;for(let e of uf.splice(0))e()}}function yf(e,t){pf(e,t)}function bf(){return{track:yf}}export{mf as a,vf as c,kd as d,o as f,pf as i,Jd as l,bf as n,gf as o,_f as r,hf as s,yf as t,Gd as u};

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.