1import{t as e}from"./client-D3LRlNjy.js";import{s as t}from"./runtime-U9TDBVFh.js";var n=`u`>typeof window?window:void 0,r=`u`>typeof globalThis?globalThis:n,i=r?.navigator,a=r?.document,o=r?.location,s=r?.fetch,c=r?.XMLHttpRequest&&`withCredentials`in new r.XMLHttpRequest?r.XMLHttpRequest:void 0,l=r?.AbortController,u=r?.CompressionStream,d=i?.userAgent;function f(){return!(!n||!1===n.navigator.onLine)}var p=typeof globalThis<`u`?globalThis:n;p&&typeof self>`u`&&(p.self=p),p&&typeof File>`u`&&(p.File=function(){});var m=n??{},h=`0.9.0`,g={DEBUG:!1,LIB_VERSION:h,LIB_NAME:`browser-common`,JS_SDK_VERSION:h},_=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}({}),v=function(e){return e.GZipJS=`gzip-js`,e.Base64=`base64`,e}({}),y=[`$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`],b=[`token`];function x(e,t){return e.indexOf(t)!==-1}var S=function(e){return e.trim()},C=function(e){return e.replace(/^\$/,``)};function w(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 ee=Object.prototype,T=ee.hasOwnProperty,te=ee.toString,E=Array.isArray||function(e){return te.call(e)===`[object Array]`},D=e=>typeof e==`function`,O=e=>e===Object(e)&&!E(e),k=e=>{if(O(e)){for(let t in e)if(T.call(e,t))return!1;return!0}return!1},A=e=>e===void 0,j=e=>te.call(e)==`[object String]`,ne=e=>j(e)&&e.trim().length===0,M=e=>e===null,N=e=>A(e)||M(e),P=e=>te.call(e)==`[object Number]`&&e==e,re=e=>P(e)&&e>0,F=e=>te.call(e)===`[object Boolean]`,ie=e=>x(y,e),ae=e=>x(b,e);function oe(e){return typeof e!=`object`||!e}function se(e,t){return{}.toString.call(e)===`[object ${t}]`}function ce(e){switch({}.toString.call(e)){case`[object Error]`:case`[object Exception]`:case`[object DOMException]`:case`[object DOMError]`:case`[object WebAssembly.Exception]`:return!0;default:return ue(e,Error)}}function le(e){return`u`>typeof Event&&ue(e,Event)}function ue(e,t){try{return e instanceof t}catch{return!1}}var de=[!0,`true`,1,`1`,`yes`],fe=e=>x(de,e),pe=[!1,`false`,0,`0`,`no`];function me(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 I(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){me(a,r,i,o,s,`next`,e)}function s(e){me(a,r,i,o,s,`throw`,e)}o(void 0)})}}var he=`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(`,`),ge=function(e,t=[]){if(!e)return!1;let n=e.toLowerCase();return he.concat(t).some(e=>{let t=e.toLowerCase();return n.indexOf(t)!==-1})};function _e(e,t,n,r,i){return t>n&&(r.warn(`min cannot be greater than max.`),t=n),P(e)?e>n?(r.warn(` cannot be greater than max: `+n+`. Using max value instead.`),n):t>e?(r.warn(` cannot be less than min: `+t+`. Using min value instead.`),t):e:(r.warn(` must be a number. using max or fallback. max: `+n+`, fallback: `+i),_e(i??n,t,n,r))}var ve=class{constructor(e){this.C={},this.I=e.I,this.R=_e(e.bucketSize,0,100,e.$),this.A=_e(e.refillRate,0,this.R,e.$),this.O=_e(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={}}},ye=`Mobile`,be=`Android`,xe=`Tablet`,Se=`Android Tablet`,Ce=`iPad`,we=`Apple Watch`,Te=`Safari`,Ee=`BlackBerry`,De=`Samsung Internet`,Oe=`Chrome`,ke=`Chrome iOS`,Ae=`Internet Explorer`,je=`Internet Explorer Mobile`,Me=`Opera`,Ne=`Microsoft Edge`,Pe=`Firefox`,Fe=`Firefox iOS`,Ie
1=`Nintendo`,Le=`PlayStation`,Re=`Xbox`,ze=`Android Mobile`,Be=`Mobile Safari`,Ve=`Windows`,He=`Windows Phone`,Ue=`Nokia`,We=`Ouya`,Ge=`Generic `+ye.toLowerCase(),Ke=`Generic `+xe.toLowerCase(),qe=`Konqueror`,Je=`Oculus Browser`,Ye=`Vivaldi`,Xe=`Yandex`,Ze=`Whale`,Qe=`DuckDuckGo`,$e=`Pale Moon`,et=`Waterfox`,tt=`Brave`,nt=`Claude`,rt=`Codex`,it=`ChatGPT`,at=`Google Search App`,ot=RegExp(`Version/(\\d+(\\.\\d+)?)`),st=RegExp(`(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)`),ct=new RegExp(Re,`i`),lt=RegExp(`PlayStation \\w+`,`i`),ut=RegExp(`Nintendo \\w+`,`i`),dt=RegExp(`BlackBerry|PlayBook|BB10`,`i`),ft={"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`},pt=function(e,t,n,r){return t||=``,function(e){return e?.brave?tt:null}(n)||(r?.detectGoogleSearchApp&&x(e,`GSA/`)?at:x(e,` OPR/`)&&x(e,`Mini`)?`Opera Mini`:x(e,` OPR/`)?Me:dt.test(e)?Ee:x(e,`IEMobile`)||x(e,`WPDesktop`)?je:x(e,`OculusBrowser`)?Je:x(e,`SamsungBrowser`)?De:x(e,`Edge`)||x(e,`Edg/`)?Ne:x(e,`Vivaldi/`)?Ye:x(e,`YaBrowser/`)?Xe:x(e,`Whale/`)?Ze:x(e,`DuckDuckGo/`)||x(e,`Ddg/`)?Qe:x(e,`Claude/`)?nt:x(e,`Codex/`)?rt:x(e,`ChatGPT/`)?it:x(e,`FBIOS`)?`Facebook Mobile`:x(e,`UCWEB`)||x(e,`UCBrowser`)?`UC Browser`:x(e,`CriOS`)?ke:x(e,`CrMo`)||x(e,Oe)?Oe:x(e,be)&&x(e,Te)?ze:x(e,`FxiOS`)?Fe:x(e.toLowerCase(),qe.toLowerCase())?qe:x(e,`Brave/`)?tt:((e,t)=>t&&x(t,`Apple`)||function(e){return x(e,Te)&&!x(e,Oe)&&!x(e,be)}(e))(e,t)?x(e,ye)?Be:Te:x(e,`PaleMoon/`)?$e:x(e,`Waterfox/`)?et:x(e,Pe)?Pe:x(e,`MSIE`)||x(e,`Trident/`)?Ae:x(e,`Gecko`)?Pe:``)},mt={[je]:[RegExp(`rv:(\\d+(\\.\\d+)?)`)],[Ne]:[RegExp(`Edge?\\/(\\d+(\\.\\d+)?)`)],[Oe]:[RegExp(`(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)`)],[ke]:[RegExp(`CriOS\\/(\\d+(\\.\\d+)?)`)],"UC Browser":[RegExp(`(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)`)],[Te]:[ot],[Be]:[ot],[Me]:[RegExp(`(Opera|OPR)\\/(\\d+(\\.\\d+)?)`)],[Pe]:[RegExp(`Firefox\\/(\\d+(\\.\\d+)?)`)],[Fe]:[RegExp(`FxiOS\\/(\\d+(\\.\\d+)?)`)],[qe]:[RegExp(`Konqueror[:/]?(\\d+(\\.\\d+)?)`,`i`)],[Ee]:[RegExp(`BlackBerry (\\d+(\\.\\d+)?)`),ot],[ze]:[RegExp(`android\\s(\\d+(\\.\\d+)?)`,`i`)],[De]:[RegExp(`SamsungBrowser\\/(\\d+(\\.\\d+)?)`)],[Je]:[RegExp(`OculusBrowser\\/(\\d+(\\.\\d+)?)`)],[Ye]:[RegExp(`Vivaldi\\/(\\d+(\\.\\d+)?)`)],[Xe]:[RegExp(`YaBrowser\\/(\\d+(\\.\\d+)?)`)],[Ze]:[RegExp(`Whale\\/(\\d+(\\.\\d+)?)`)],[tt]:[RegExp(`Brave\\/(\\d+(\\.\\d+)?)`)],[nt]:[st],[rt]:[st],[it]:[st],[Qe]:[RegExp(`(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)`)],[$e]:[RegExp(`PaleMoon\\/(\\d+(\\.\\d+)?)`)],[et]:[RegExp(`Waterfox\\/(\\d+(\\.\\d+)?)`)],[at]:[RegExp(`GSA\\/(\\d+(\\.\\d+)?)`)],[Ae]:[RegExp(`(rv:|MSIE )(\\d+(\\.\\d+)?)`)],Mozilla:[RegExp(`rv:(\\d+(\\.\\d+)?)`)]},ht=function(e,t,n,r){let i=mt[pt(e,t,n,r)];if(A(i))return null;for(let t=0;i.length>t;t++){let n=e.match(i[t]);if(n)return parseFloat(n[n.length-2])}return null},gt=[[RegExp(`Xbox; Xbox (.*?)[);]`,`i`),e=>[Re,e&&e[1]||``]],[new RegExp(Ie,`i`),[Ie,``]],[new RegExp(Le,`i`),[Le,``]],[dt,[Ee,``]],[new RegExp(Ve,`i`),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[He,``];if(new RegExp(ye).test(t)&&!/IEMobile\b/.test(t))return[`Windows Mobile`,``];let n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){let e=ft[n[1]]||``;return/arm/i.test(t)&&(e=`RT`),[Ve,e]}return[Ve,``]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[`iOS`,[e[3],e[4],e[5]||`0`].join(`.`)]:[`iOS`,``]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{let t=``;return e&&e.length>=3&&(t=A(e[2])?e[3]:e[2]),[`watchOS`,t]}],[RegExp(`(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)`,`i`),e=>e&&e[2]?[be,[e[2],e[3],e[4]||`0`].join(`.`)]:[be,``]],[/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`,``]]],_t=function(e){for(let t=0;gt.length>t;t++){let[n,r]=gt[t],i=n.exec(e),a=i&&(D(r)?r(i,e):r);if(a)return a}return[``,``]},vt=function(e){return ut.test(e)?Ie:lt.test(e)?Le:ct.test(e)?Re:new RegExp(We,`i`).test(e)?We:RegExp(`(Windows Phone|WPDesktop)`,`i`).test(e)?He:/iPad/.test(e)?Ce:/iPod/.test(e)?`iPod Touch`:/iPhone/.test(e)?`iPhone`:/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?we:dt.test(e)?Ee:/(kobo)\s(ereader|touch)/i.test(e)?`Kobo`:new RegExp(Ue,`i`).test(e)?Ue:/(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(ye).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)?be:Se:RegExp(`(pda|Mobile)`,`i`).test(e)?Ge:new RegExp(xe,`i`).test(e)&&!RegExp(`Tablet pc`,`i`).test(e)?Ke:``},yt=function(e,t){let n=vt(e);return n===Ce||n===Se||n===`Kobo`||n===`Kindle Fire`||n===Ke?xe:n===Ie||n===Re||n===Le||n===We?`Console`:n===we?`Wearable`:n?ye:t?.userAgentDataPlatform===`Android`&&(t?.maxTouchPoints??0)>0?600>Math.min((r=t?.screenWidth)??0,(i=t?.screenHeight)??0)/((a=t?.devicePixelRatio)??1)?ye:xe:`Desktop`;var r,i,a},bt=/\bFBAV\/(\d+(?:\.\d+)*)/i,xt=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,`Instagram`],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,`Threads`],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,`Messenger`,bt],[/\bFBAN\/EMA\b/i,`Facebook Lite`,bt],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,`Facebook`,bt],[/\bLinkedInApp(?:\]?\/(\d+(?:\.\d+)*))?\b/i,`LinkedIn`],[/\bTwitter(?:Android| for (?:iPhone|iPad|Android))(?
1:\/(\d+(?:\.\d+)*))?\b/i,`Twitter`],[/\b(?:musical_ly|trill)(?:[_/](\d+\.\d+(?:\.\d+)*))?(?=\b|_)/i,`TikTok`,/\bapp_version\/(\d+(?:\.\d+)*)/i],[/\b(?:MicroMessenger|WeChat)\/(\d+(?:\.\d+)*)?/i,`WeChat`],[/\bLine\/(\d+(?:\.\d+)*)?/i,`Line`],[/\bGSA\/(\d+(?:\.\d+)*)?/i,`Google`],[/\[Pinterest\/(?:iOS|Android)\b|\bPinterest(?: for (?:Android(?: Tablet)?|iOS))?\/(\d+(?:\.\d+)*)/i,`Pinterest`],[/\b(?:WA4A|WAiOS)\/(\d+(?:\.\d+)*)?/i,`WhatsApp`],[/\bSnapchat[ /](\d+(?:\.\d+)*)?/i,`Snapchat`],[/\bBing(?:Web|Sapphire)\/(\d+(?:\.\d+)*)?/i,`Bing`],[/\bNAVER\(inapp; search;/i,`Naver`,/\bNAVER\(inapp; search;[^;)]*; (\d+(?:\.\d+)*)/i],[/\bKAKAOTALK[ /](\d+\.\d+(?:\.\d+)*)?/i,`KakaoTalk`]],St=`[Truncated]`,Ct=`[Unserializable]`;function wt(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 Tt(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=Ct}Object.defineProperty(e,r,{value:n,enumerable:!0,writable:!0,configurable:!0})}return e}var Et=3e5,Dt=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,Et);if(!t)return this.ts=n,void(this.es=n+r);this.es=Math.max(this.es,Math.min(n+r,this.ts+Et))}remainingMs(){let e=Date.now();if(this.ts-5e3>e)return this.reset(),0;let t=Math.min(Et,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}},Ot=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function kt(e,t){return typeof(n=e)==`string`&&Ot.test(n)?e:t();var n}function At(e,t){let n=Error(t);try{Object.defineProperty(n,"name",{value:e,writable:!0,enumerable:!0,configurable:!0})}catch{}return n}function jt(e){return e&&e.split(`#`)[0]}function Mt(e){try{return e()}catch{return}}function Nt(e,t){let n=setTimeout(e,t);return n!=null&&n.unref&&n?.unref(),n}function Pt(e,t,n){return Ft.apply(this,arguments)}function Ft(){return(Ft=I(function*(e,t,n){let r;try{return yield Promise.race([e,new Promise((e,i)=>{r=Nt(()=>{try{n?.(),e()}catch(e){i(e)}},t)})])}finally{clearTimeout(r)}})).apply(this,arguments)}var It,Lt,Rt;function zt(e){let t=globalThis._posthogChunkIds;if(!t)return;let n=Object.keys(t);return Rt&&n.length===Lt||(Lt=n.length,Rt=n.reduce((n,r)=>{It||={};let i=It[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,It[r]=[a,o];break}}}return n},{})),Rt}function Bt(e){return Bt=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},Bt(e)}function Vt(e,t,n){return(t=function(e){var t=function(e){if(Bt(e)!=`object`||!e)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var n=t.call(e,`string`);if(Bt(n)!=`object`)return n;throw TypeError(`@@toPrimitive must return a primitive value.`)}return String(e)}(e);return Bt(t)==`symbol`?t:t+``}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ht(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 L(e){for(var t=1;arguments.length>t;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Ht(Object(n),!0).forEach(function(t){Vt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ht(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Ut=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 I(function*(){for(let n of e)n.stacktrace&&n.stacktrace.frames&&E(n.stacktrace.frames)&&(n.stacktrace.frames=yield t.applyModifiers(n.stacktrace.frames));return e})()}coerceFallback(e){return{type:`Error`,value:`Unknown error`,stack:e.syntheticException?.stack,synthetic:!0}}parseStacktrace(e,t){let n,r;if(e.cause!=null&&(n=this.parseStacktrace(e.cause,t)),e.stack!=``&&e.stack!=null)try{r=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.ski
1pFirstLines:0),t.chunkIdMap)}catch{}return L(L({},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 I(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?L(L({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:zt(this.stackParser),skipFirstLines:e.skipFirstLines??1}}getAggregateErrors(e){try{if(ce(e)){let t=Object.getPrototypeOf(e);for(let n=0;t&&100>n;n++){let n=Object.getOwnPropertyDescriptor(t,`constructor`)?.value;if(typeof n==`function`&&n.name===`AggregateError`){let t=e.errors;return E(t)?t:void 0}t=Object.getPrototypeOf(t)}}}catch{}}buildCoercingContext(e,t,n=0){let r=0,i=0,a=!1,o=new Set,s=[],c={},l=(e,t,n=0)=>{let l=u(t,n),d=l.apply;if(l.apply=t=>{s.push(e);try{return d(t)}finally{s.pop()}},n>4||n>0&&s.indexOf(e)!==-1)return this.coerceFallback(l);let f=typeof e==`object`&&!!e||typeof e==`function`;if(n===0&&r>=50||f&&o.has(e))return;f&&o.add(e),n===0&&r++;let p=this.getAggregateErrors(e),m,h;a||=!!p;try{if(m=this.applyCoercers(e,l),!m)throw c}catch(e){if(e===c)return void(n===0&&r--);if(!a)throw e;m=this.coerceFallback(l)}if(!p||r>=50)return m;try{h=p.length}catch{return m}if(!Number.isInteger(h)||0>h||h>4294967295)return m;let g=[];for(let e=0;50>r&&1e3>i&&h>e;e++){let n;i++;try{n=l.next(p[e])}catch{r++,n=this.coerceFallback(u(t+1))}n&&g.push(n)}return L(L({},m),{},{errors:g})},u=(n,r=0)=>L(L({},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 L(L({},d),{},{apply:e=>l(e,n)??this.coerceFallback(d)})}},Wt=/^([a-z][a-z0-9.+-]+):/i,Gt=[`http`,`https`,`file`,`blob`,`app`,`capacitor`,`ionic`,`webpack`,`webpack-internal`,`ng`];function Kt(e){if(!e||e===`<anonymous>`)return!1;let t=Wt.exec(e);return!t||Gt.includes(t[1].toLowerCase())}function qt(e,t,n,r,i){let a={platform:e,filename:t,function:n===`<anonymous>`?`?`:n,in_app:Kt(t)};return A(r)||(a.lineno=r),A(i)||(a.colno=i),a}var Jt=(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]},Yt=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Xt=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Zt=/\((\S*)(?::(\d+))(?::(\d+))\)/,Qt=(e,t)=>{let n=Yt.exec(e);if(n){let[,e,r,i]=n;return qt(t,e,`?`,+r,+i)}let r=Xt.exec(e);if(r){if(r[2]&&r[2].indexOf(`eval`)===0){let e=Zt.exec(r[2]);e&&(r[2]=e[1],r[3]=e[2],r[4]=e[3])}let[e,n]=Jt(r[1]||`?`,r[2]);return qt(t,n,e,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},$t=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,en=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,tn=(e,t)=>{let n=$t.exec(e);if(n){if(n[3]&&n[3].indexOf(` > eval`)>-1){let e=en.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]=Jt(r,e),qt(t,e,r,n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},nn=/\(error: (.*)\)/;function rn(e,t){return e.filename===t.filename&&e.function===t.function&&e.module===t.module&&e.lineno===t.lineno&&e.colno===t.colno}function an(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(!rn(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 on(e,t){let n=t.start+t.length,r=cn(e,t);r&&e.splice(n+r===e.length?n:t.start,r)}function sn(e,t){let n=t.start;for(;n>0&&rn(e[n-1],e[n-1+t.length]);)n--;return t.start-n}function cn(e,t){let n=t.start+t.length,r=n;for(;e.length>
1r&&rn(e[r],e[r-t.length]);)r++;return r-n}function ln(e,t){let n=t[0],r=e.length-(n?sn(e,n):0);for(let n of t)r-=cn(e,n);return r}function un(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 dn=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){let n=j(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:n?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?`DOMError`:`DOMException`}getValue(e){let t=e.name||(this.isDOMError(e)?`DOMError`:`DOMException`);return e.message?`${t}: ${e.message}`:t}isDOMException(e){return se(e,`DOMException`)}isDOMError(e){return se(e,`DOMError`)}},fn=class{match(e){return ce(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}}},pn=class{match(e){return!!se(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 L(L({},n),{},{stack:this.cr(e)??n.stack,synthetic:!0})}ur(e){return j(e.message)&&e.message.length>0}cr(e){let t=e,n=t.lineno??0,r=t.colno??0;if(j(t.filename)&&t.filename.length!==0&&n!==0)return`Error\n at ${t.filename}:${n}:${r}`}},mn=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,hn=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(mn);return r&&(t=r[1],n=r[2]),[t,n]}},gn=[`fatal`,`error`,`warning`,`log`,`info`,`debug`];function _n(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 vn=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(le(e))return e.constructor.name;let t=`name`in e?e.name:void 0;return j(t)&&!ne(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: ${_n(e)}`}isSeverityLevel(e){return j(e)&&!ne(e)&&gn.indexOf(e)>=0}getStack(e){try{return j(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:j(e.stack)&&e.stack.length>0?e.stack:void 0}catch{return}}getErrorPropertyFromObject(e){for(let t in e)if({}.hasOwnProperty.call(e,t)){let n=e[t];if(ce(n))return n}}getObjectClassName(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},yn=class{match(e){return le(e)}coerce(e,t){let n=e.constructor.name;return{type:n,value:`${n} captured as exception with keys: ${_n(e)}`,stack:t.syntheticException?.stack,synthetic:!0}}},bn=class{match(e){return oe(e)}coerce(e,t){return{type:`Error`,value:`Primitive value captured as exception: ${String(e)}`,stack:t.syntheticException?.stack,synthetic:!0}}},xn=class{match(e){return se(e,`PromiseRejectionEvent`)||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!le(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 oe(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}},Sn=`$message`,Cn=`$timestamp`,wn=new Set([Sn,Cn]),Tn={enabled:!0,max_bytes:32768};function En(e){return e?{enabled:e.enabled??Tn.enabled,max_bytes:On(e.max_bytes,Tn.max_bytes)}:L({},Tn)}var Dn=class{constructor(e){this.ns=[],this.ss=0,this.Ir=En(e)}setConfig(e){this.Ir=En(e),this.rs()}add(e){let t=function(e){let t;try{t=w(e)}catch{return}try{let e=JSON.parse(t);if(!O(e))return;let n=e,r=n[Sn],i=n[Cn];return!j(r)||r.trim().length===0||!j(i)&&!P(i)?void 0:{step:n,json:t}}catch{return}}(e);if(!t)return;let n=function(e){if(`u`>typeof TextEncoder)return new TextEncoder().encode(e).length;let t=encodeURIComponent(e),n=0;for(let e=0;t.length>e;e++)t[e]===`%`?(n+=1,e+=2):n+=1;return n}(t.json);n>this.Ir.max_bytes||(this.ns.push({step:t.step,bytes:n}),this.ss+=n,this.rs())}getAttachable(){return this.ns.map(e=>e.step)}clear(){this.ns=[],this.ss=0}size(){return this.ns.length}rs(){for(;this.ss>this.Ir.max_bytes&&this.ns.length>0;){let e=this.ns.shift();e&&(this.ss-=e.bytes)}}};function On(e,t){if(!P(e)||1/0===e||-1/0===e)return t;let n=Math.floor(e);return 0>n?t:n}var kn=e=>{if(typeof e!=`string`)return e;try{return JSON.parse(e)}catch{return e}};function An(e){return typeof e==`string`||e}function jn(e){return typeof e==`string`?e:void 0}var Mn=`$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(`.`),Nn=`NativeGzipValidationError`,Pn=e=>e.length>=2&&e[0]===31&&e[1]===139,Fn=(e,t)=>
1e===v.GZipJS||t===v.GZipJS||t===`gzip`,In=e=>!(!e||typeof e!=`object`)&&(`name`in e?String(e.name):``)===`NotReadableError`,Ln,Rn=e=>{throw At(Nn,`Native gzip produced invalid output: ${e}`)},zn=(Bn=I(function*(e,t){18>e.size&&Rn(`too-short`);let n=new Uint8Array(yield e.slice(0,10).arrayBuffer());Pn(n)&&n[2]===8||Rn(`invalid-header`);let r=new DataView(yield e.slice(e.size-8).arrayBuffer());r.getUint32(0,!0)!==(e=>{let t=(()=>{if(Ln)return Ln;Ln=[];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;Ln[e]=t>>>0}return Ln})(),n=4294967295;for(let r=0;e.length>r;r++)n=t[255&(n^e[r])]^n>>>8;return(4294967295^n)>>>0})(t)&&Rn(`invalid-crc`);let i=t.length>>>0;r.getUint32(4,!0)!==i&&Rn(`invalid-size`)}),function(e,t){return Bn.apply(this,arguments)}),Bn;function Vn(){return Vn=I(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=I(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 zn(s,t),s}catch(e){if(n?.rethrow)throw e;return t&&console.error(`Failed to gzip compress data`,e),null}var r}),Vn.apply(this,arguments)}function Hn(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 Un={}.propertyIsEnumerable;function Wn(e,t){try{return qn(e,t,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch{return[]}}function Gn(e,t,n,r){if(0>=n.remainingNodes)return{stringValue:St};if(n.remainingNodes--,F(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:wt(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:St};if(e instanceof Date){let t=e.getTime(),n=Number.isFinite(t)?e.toISOString():String(e);return{stringValue:typeof n==`string`?wt(n):String(n)}}n.ancestors.add(e);try{try{let i=e.toJSON;if(typeof i==`function`)return Gn(i.call(e),t,n,r+1)}catch{}return E(e)?{arrayValue:{values:Kn(e,t,n,r+1)}}:{kvlistValue:{values:qn(e,t,n,r+1)}}}finally{n.ancestors.delete(e)}}return{stringValue:wt(String(e))}}function Kn(e,t,n,r){let i=[],a=Math.min(e.length,1e3),o=0;for(;a>o&&n.remainingNodes>0;o++)try{let a=o in e?e[o]:void 0;if(N(a))continue;i.push(Gn(a,t,n,r))}catch{i.push({stringValue:Ct})}return e.length>o&&i.push({stringValue:St}),i}function qn(e,t,n,r){let i=[];for(let a in e)if(Un.call(e,a)){if(!a){t?.debug(`Dropping an attribute with an empty key`);continue}if(i.length>=1e3||0>=n.remainingNodes){t?.debug(`Attributes truncated: the value exceeds the OTLP encoder budget`);break}try{let o=e[a];if(M(o)||A(o))continue;i.push({key:wt(a),value:Gn(o,t,n,r)})}catch{i.push({key:wt(a),value:{stringValue:Ct}})}}return i}function Jn(e,t,n){return L(L(L(L({},Tt({},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 Yn=[`service.name`,`deployment.environment`,`service.version`,`telemetry.sdk.name`,`telemetry.sdk.version`];function Xn(e,t){let n=Tt({},e),r={};for(let e of Yn)({}).hasOwnProperty.call(n,e)&&(r[e]=n[e],delete n[e]);return[...Wn(n,t),...Wn(r,t)]}var Zn={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`},Qn={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}},$n=Qn.info;function er(e){try{return wt(String(e))}catch{return Ct}}function tr(e,t,n,r){let{text:i,number:a}=Qn[e.level||`info`]||$n,o=function(e=Date.now()){return String(e)+`000000`}(P(r)?r:void 0),s={};t.distinctId&&(s.posthogDistinctId=t.distinctId),t.sessionId&&(s.sessionId=t.sessionId),t.windowId&&(s[`window.id`]=t.windowId),N(t.sessionStartTimestamp)||(s.sessionStartTimestamp=String(t.sessionStartTimestamp)),N(t.lastActivityTimestamp)||(s.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(s[`url.full`]=t.currentUrl),t.screenName&&(s[`screen.name`]=t.screenName),t.appState&&(s[`app.state`]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(s.feature_flags=t.activeFeatureFlags);let c=L({},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=Ct}Object.defineProperty(c,t,{value:e,enumerable:!0,writable:!0,configurable:!0})}}
1let u={timeUnixNano:o,observedTimeUnixNano:o,severityNumber:a,severityText:i,body:{stringValue:er(e.body)},attributes:Wn(c,n)};return e.trace_id&&(u.traceId=e.trace_id),e.span_id&&(u.spanId=e.span_id),A(e.trace_flags)||(u.flags=e.trace_flags),u}function nr(e,t,n){return Jn(e,t,n)}function rr(e,t,n,r){return{resourceLogs:[{resource:{attributes:Xn(t)},scopeLogs:[{scope:{name:n,version:r},logRecords:e}]}]}}var ir=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=Nt(()=>{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 ar(){return .75+.5*Math.random()}function or(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 sr=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 ir(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new Dt,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(_.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:tr(n,t?.context??this.cs(),this.$,t?.occurredAtMs)};this.ds(()=>this.Ls(r))}Os(e){let t=this.Ir.beforeSend;if(!t)return e;let n=E(t)?t:[t],r=e;for(let e of n)try{let t=e(r);if(!t)return this.$.info(`Log was rejected in beforeSend function`),null;r=t}catch(e){return this.$.error(`Error in beforeSend function for log:`,e),null}return r}Ds(){if(this.Rs===void 0)return!0;let e=Date.now(),t=e-this.xs;return this.Ps>t&&t>=0||(this.xs=e,this.Cs=0,this.$s=!1),this.Rs>this.Cs?(this.Cs++,!0):(this.$s||=(this.$.warn(`captureLog dropping logs: exceeded ${this.Rs} logs per ${this.Ps}ms`),!0),!1)}flush(){var e=this;return I(function*(){if(!e._instance.isDisabled)return e.ys||=e.Ns().finally(()=>{e.ys=null}),e.ys})()}Ns(){var e=this;return I(function*(){e.ps.clear();let t=e._instance.getPersistedProperty(_.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=rr(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(_.LogsQueue)??[],r+=a.length,s.kind===`fatal`))throw s.error}})()}Bs(e){var t=this;return I(function*(){let n=Math.max(0,e-t.bs),r=t._instance.getPersistedProperty(_.LogsQueue)??[];t._instance.setPersistedProperty(_.LogsQueue,r.slice(n)),yield t.vs()})()}qs(){return nr(this.Ir,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(e){if(this._instance.optedOut)return;let t=this._instance.getPersistedProperty(_.LogsQueue)??[];this.Is>t.length||(t.shift(),this.bs++,this.$.info(`Logs queue is full, dropping oldest record.`)),t.push(e),this._instance.setPersistedProperty(_.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(or(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){let e=this._instance.getPersistedProperty(_.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return I(function*(){t.ps.clear();let n=t.flush().catch(()=>{});e===void 0?yield n:yield Pt(n,e)})()}flushWithTimeout(e){var t=this;return I(function*(){let n=t.flush();yield Pt(n,e,()=>{n.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},e=>{this.ks++,this.Ss=ar(),this.$.error(`PostHog logs flush failed:`,e)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.Hs())})}},cr=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function lr(e){return String(e)+`000000`}function ur(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 dr=class{constructor(e,t,n){this._instance=e,this.Ir=t,this.$=n,this.zs=new Map,this.ps=new ir(()=>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 Dt,this.ks=0,this.Ss=1,this.Gs=0}count(e,t=1,n){this.Zs({name:e,type:`count`,value:t,unit:n?.unit,attributes:n?.attributes})}
1gauge(e,t,n){this.Zs({name:e,type:`gauge`,value:t,unit:n?.unit,attributes:n?.attributes})}histogram(e,t,n){this.Zs({name:e,type:`histogram`,value:t,unit:n?.unit,attributes:n?.attributes})}flush(){var e=this;let t=this.ys,n=function(){var n=I(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?L({},t.attributes):void 0,r=ur(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(cr.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,cr)]+=1;break}}}Os(e){let t=this.Ir.beforeSend;if(!t)return e;let n=E(t)?t:[t],r=e;for(let e of n)try{let t=e(r);if(!t)return this.$.info(`Metric was rejected in beforeSend function`),null;r=t}catch(e){return this.$.error(`Error in beforeSend function for metric:`,e),null}return r}Fs(){this.ps.pending||this.ps.arm(this.Hs())}Hs(){return Math.max(or(this.Ir.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Qs(){var e=this;return I(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=ar()):(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 Jn(e,t,n)}(this.Ir,this._instance.getLibraryId(),this._instance.getLibraryVersion()),r=this._instance.getLibraryId(),i=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:Xn(n)},scopeMetrics:[{scope:{name:r,version:i},metrics:t}]}]};var t,n,r,i}uo(e){let t=lr(Date.now()),n=new Map;for(let r of e.values()){let e=ur(r.type,r.name,r.unit,void 0),i=n.get(e);i||(i=L({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=Wn(r.attributes??{},this.$),o=lr(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:cr})}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)}}},fr=(e,{debugEnabled:t}={})=>{let r={N(r,...i){n&&(g.DEBUG||n.POSTHOG_DEBUG||t)&&!A(n.console)&&n.c
1onsole&&(`__rrweb_original__`in n.console[r]?n.console[r].__rrweb_original__:n.console[r])(e,...i)},debug(...e){r.N(`debug`,...e)},info(...e){r.N(`log`,...e)},warn(...e){r.N(`warn`,...e)},error(...e){r.N(`error`,...e)},critical(...t){console.error(e,...t)},uninitializedWarning(e){r.error(`You must initialize PostHog before calling ${e}`)},createLogger:(t,n)=>fr(`${e} ${t}`,n)};return r},R=fr(`[PostHog.js]`),z=R.createLogger,pr=z(`[ExternalScriptsLoader]`),mr=e=>{let t=a?.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]}},hr=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return pr.warn(`${t} was requested but loading of external scripts is disabled.`),n(`Loading of external scripts is disabled`);let r=mr(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(!a)return n(`document not found`);if(mr(t))return hr(e,t,n);let r=a.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`)a.head.appendChild(r);else{let e=a.querySelectorAll(`body > script`);var i;e.length>0?(i=e[0].parentNode)==null||i.insertBefore(r,e[0]):a.body.appendChild(r)}};a?.body?i():a?.addEventListener(`DOMContentLoaded`,i)},gr={},_r=(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)};m.__PosthogExtensions__=m.__PosthogExtensions__||{},m.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{if(t===`remote-config`){hr(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=gr[i];if(r===`fallback`&&a){if(mr(a))return void hr(e,a,n);delete gr[i]}hr(e,i,r===`fallback`?(r,a)=>{if(r){if(typeof r==`string`)n(r);else{var o;let r=_r(e,t);gr[i]=r;let a=mr(i);a==null||(o=a.parentNode)==null||o.removeChild(a),hr(e,r,n)}}else n(void 0,a)}:n);return}hr(e,_r(e,t),n)},m.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{hr(e,e.requestRouter.endpointFor(`api`,t),n)},g.DEBUG=!1,g.LIB_VERSION=`1.434.2`,g.LIB_NAME=`web`;var B=g,vr=`$people_distinct_id`,yr=`distinct_id`,br=`$device_id`,xr=`$device_model`,Sr=`__alias`,Cr=`__cmpns`,wr=`$fbc`,Tr=`$fbc_persistence`,Er=`$fbp`,Dr=`$fbp_persistence`,Or=`__timers`,kr=`$autocapture_disabled_server_side`,Ar=`$heatmaps_enabled_server_side`,jr=`$exception_capture_enabled_server_side`,Mr=`$error_tracking_suppression_rules`,Nr=`$error_tracking_capture_extension_exceptions`,Pr=`$web_vitals_enabled_server_side`,Fr=`$dead_clicks_enabled_server_side`,Ir=`$product_tours_enabled_server_side`,Lr=`$logs_capture_enabled_server_side`,Rr=`$web_vitals_allowed_metrics`,zr=`$session_recording_remote_config`,Br=`$session_recording_enabled_server_side`,Vr=`$replay_sample_rate`,Hr=`$replay_override_sampling`,Ur=`$replay_override_linked_flag`,Wr=`$replay_override_url_trigger`,Gr=`$replay_override_event_trigger`,Kr=`$sesid`,qr=`$session_is_sampled`,Jr=`$session_past_minimum_duration`,Yr=`$session_recording_url_trigger_activated_session`,Xr=`$session_recording_event_trigger_activated_session`,Zr=`$debug_first_full_snapshot_timestamp`,Qr=`$sess_rec_flush_size`,$r=`$enabled_feature_flags`,ei=`$active_feature_flags`,ti=`$early_access_features`,ni=`$feature_flag_details`,ri=`$feature_flag_payloads`,ii=`$feature_flag_request_id`,ai=`$minimal_flag_called_events`,oi=`$override_feature_flags`,si=`$override_feature_flag_payloads`,ci=`$stored_person_properties`,li=`$stored_group_properties`,ui=`$groups`,di=`$surveys`,fi=`$surveys_loaded_at`,pi=`$surveys_activated`,mi=`$surveys_activated_session`,hi=`$surveys_activated_timestamps`,gi=`ph_product_tours`,_i=`$product_tours_activated`,vi=`$product_tours_activated_session`,yi=`$conversations_widget_session_id`,bi=`$conversations_ticket_id`,xi=`$conversations_widget_state`,Si=`$conversations_user_traits`,Ci=`$flag_call_reported`,wi=`$flag_call_reported_session_id`,Ti=`$feature_flag_errors`,Ei=`$feature_flag_evaluated_at`,V=`$user_state`,Di=`$client_session_props`,Oi=`$capture_rate_limit`,ki=`$initial_campaign_params`,Ai=`$initial_referrer_info`,ji=`$initial_person_info`,Mi=`$epp`,Ni=`$posthog_cookieless`,Pi=`$cookieless_mode`,Fi=`$sdk_debug_extensions_init_method`,Ii=`$sdk_debug_extensions_init_time_ms`,Li=`$sdk_debug_recording_script_not_loaded`,Ri=`$s
1dk_debug_replay_stale_config`,zi=`$sdk_debug_replay_event_trigger_status`,Bi=`$sdk_debug_replay_linked_flag_trigger_status`,Vi=`$sdk_debug_replay_matched_recording_trigger_groups`,Hi=`$sdk_debug_replay_pending_trigger_conditions`,Ui=`$sdk_debug_replay_remote_trigger_matching_config`,Wi=`$sdk_debug_replay_trigger_groups_count`,Gi=`$sdk_debug_replay_url_trigger_status`,Ki=`$session_recording_start_reason`,qi=`PostHog loadExternalDependency extension not found.`,Ji=`anonymous`,Yi=`identified`,Xi=`identified_only`,Zi=`visibilitychange`,Qi=`beforeunload`,$i=`$pageview`,ea=`$pageleave`,ta=`$identify`,na=`$groupidentify`;function ra(e,t){E(e)&&e.forEach(t)}function H(e,t){if(!N(e)){if(E(e))e.forEach(t);else if((e=>e instanceof FormData)(e))e.forEach((e,n)=>t(e,n));else for(let n in e)T.call(e,n)&&t(e[n],n)}}var U=function(e,...t){for(let n of t)for(let t in n)n[t]!==void 0&&(e[t]=n[t]);return e};function ia(e){let t=Object.keys(e),n=t.length,r=Array(n);for(;n--;)r[n]=[t[n],e[t[n]]];return r}var aa=function(e){return function(...t){try{return e.apply(this,t)}catch(e){R.critical(`Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A.`),R.critical(e)}}},oa=function(e){let t={};return H(e,function(e,n){(j(e)&&e.length>0||P(e))&&(t[n]=e)}),t};function sa(e){let t=L({},e);for(let n of[`name`,`message`,`stack`,`cause`,`errors`])try{n in e&&(t[n]=e[n])}catch{}return t}var ca=[`herokuapp.com`,`vercel.app`,`netlify.app`];function la(e){let t=e?.hostname;if(!j(t))return!1;let n=t.split(`.`).slice(-2).join(`.`);for(let e of ca)if(n===e)return!1;return!0}function W(e,t,n,r){let{capture:i=!1,passive:a=!0}=r??{};e?.addEventListener(t,n,{capture:i,passive:a})}function ua(e){return e.name===`ph_toolbar_internal`}var da=e=>{if(a){try{let t=e+`=`,n=a.cookie.split(`;`).filter(e=>e.length);for(let e=0;n.length>e;e++){let r=n[e];for(;r.charAt(0)==` `;)r=r.substring(1,r.length);if(r.indexOf(t)===0)return decodeURIComponent(r.substring(t.length,r.length))}}catch{}return null}};Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return P(e)&&isFinite(e)&&Math.floor(e)===e});var fa=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}},pa=class{generate(){let e=this.generateOrAbort();if(!A(e))return e;{this.Ct=0;let e=this.generateOrAbort();if(A(e))throw Error(`Could not generate UUID after timestamp reset`);return e}}generateOrAbort(){let e=(()=>{let e=Date.now();return P(e)&&isFinite(e)?Math.min(Math.max(Math.floor(e),0),0xffffffffffff):0})();if(e>this.Ct)this.Ct=e,this.Mt();else{if(this.Ct>=e+1e4)return;this.It++,this.It>4398046511103&&(this.Ct++,this.Mt())}return fa.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 ha}},ma=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};n&&!A(n.crypto)&&crypto.getRandomValues&&(ma=e=>crypto.getRandomValues(e));var ha=class{nextUint32(){return this.Rt.length>this.$t||(ma(this.Rt),this.$t=0),this.Rt[this.$t++]}constructor(){this.Rt=new Uint32Array(8),this.$t=1/0}},ga,_a=()=>va().toString(),va=()=>(ga||=new pa).generate(),ya=``,ba=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,xa=null,G={Et(){if(!M(xa))return xa;if(xa=!1,a)try{let e=`__ph_cookie_support_${_a()}`;G.At(e,`xyz`),xa=da(e)===`"xyz"`,G.Lt(e)}catch{xa=!1}return xa},Pt(e){R.error(`cookieStore error: `+e)}
1,Ot:da,Dt(e){let t;try{t=JSON.parse(G.Ot(e))||{}}catch{}return t},At(e,t,n,r,i){if(!a)return!1;try{let o=``,s=``,c=function(e,t){if(t){let t=function(e,t=a){if(ya)return ya;if(!t||[`localhost`,`127.0.0.1`].includes(e))return``;let n=e.split(`.`),r=Math.min(n.length,8),i=`dmn_chk_`+_a();for(;!ya&&r--;){let e=n.slice(r).join(`.`),a=i+`=1;domain=.`+e+`;path=/`;t.cookie=a+`;max-age=3`,t.cookie.includes(i)&&(t.cookie=a+`;max-age=0`,ya=e)}return ya}(e);if(!t){let n=(e=>{let t=e.match(ba);return t?t[0]:``})(e);n!==t&&R.info(`Warning: cookie subdomain discovery mismatch`,n,t),t=n}return t?`; domain=.`+t:``}return``}(a.location.hostname,r);if(n){let e=new Date;e.setTime(e.getTime()+864e5*n),o=`; expires=`+e.toUTCString()}i&&(s=`; secure`);let l=e+`=`+encodeURIComponent(JSON.stringify(t))+o+`; SameSite=Lax; path=/`+c+s;return l.length>3686.4&&R.warn(`cookieStore warning: large cookie, len=`+l.length),a.cookie=l,!0}catch{return!1}},Lt(e,t){if(a?.cookie)try{G.At(e,``,-1,t)}catch{return}}},Sa=null,K={Et(){if(!M(Sa))return Sa;let e=!0;if(A(n))e=!1;else try{let t=`__mplssupport__`;K.At(t,`xyz`),K.Ot(t)!==`"xyz"`&&(e=!1),K.Lt(t)}catch{e=!1}return e||R.error(`localStorage unsupported; falling back to cookie store`),Sa=e,e},Pt(e){R.error(`localStorage error: `+e)},Ot(e){try{return n?.localStorage.getItem(e)}catch(e){K.Pt(e)}return null},Dt(e){try{return JSON.parse(K.Ot(e))||{}}catch{}return null},At(e,t){try{return n?.localStorage.setItem(e,JSON.stringify(t)),!0}catch(e){K.Pt(e)}return!1},Lt(e){try{n?.localStorage.removeItem(e)}catch(e){K.Pt(e)}}},Ca=[ci,ei,$r,ni,ri,ii,Ei,Ti,Ci],wa=[br,yr,Kr,qr,Mi,ji,Tr,V],Ta=e=>e+`_cpm`,Ea=[`__proto__`,`constructor`,`prototype`],Da=e=>{if(!O(e))return{};let t={};return Object.keys(e).forEach(n=>{Ea.indexOf(n)===-1&&(t[n]=e[n])}),t},Oa=(e,t=[])=>{let n={};return[...wa,...t].forEach(t=>{let r=e[t];A(r)||M(r)||r===``||(n[t]=r)}),n},ka=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)},Aa=(e,t)=>({p:t,f:ka(JSON.stringify(e))}),ja=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{let n=G.Dt(Ta(e)),r=n?.f===ka(t)&&E(n.p);return{properties:r?n.p:[],isValid:r}}catch{return{properties:[],isValid:!1}}},Ma=(e,t)=>t+`|`+(G.Ot(Ta(e))||``),Na={},Pa={Et:()=>!0,Pt(e){R.error(`memoryStorage error: `+e)},Ot:e=>e in Na?Na[e]:null,Dt:e=>e in Na?Na[e]:null,At:(e,t)=>(Na[e]=t,!0),Lt(e){delete Na[e]}},Fa=null,q={Et(){if(!M(Fa))return Fa;if(Fa=!0,A(n))Fa=!1;else try{let e=`__support__`;q.At(e,`xyz`),q.Ot(e)!==`"xyz"`&&(Fa=!1),q.Lt(e)}catch{Fa=!1}return Fa},Pt(e){R.error(`sessionStorage error: `,e)},Ot(e){try{return n?.sessionStorage.getItem(e)}catch(e){q.Pt(e)}return null},Dt(e){try{return JSON.parse(q.Ot(e))||null}catch{}return null},At(e,t){try{return n?.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(e){q.Pt(e)}return!1},Lt(e){try{n?.sessionStorage.removeItem(e)}catch(e){q.Pt(e)}}},Ia=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 fe(e)?1:x(pe,e)?0:-1}get Oo(){let e=this.Ir.opt_out_capturing_persistence_type,t=e===`localStorage`?K:G,n=t.Et()?t:Pa;if(!this.Lo||this.Lo!==n){this.Lo=n;let t=e===`localStorage`?G:K;t.Ot(this.Do)&&(this.Lo.Ot(this.Do)||this.optInOut(fe(t.Ot(this.Do))),t.Lt(this.Do,this.Ir.cross_subdomain_cookie))}return this.Lo}Ao(){return!!this.Ir.respect_dnt&&[i?.doNotTrack,i?.msDoNotTrack,m.doNotTrack,i?.globalPrivacyControl].some(e=>fe(e))}};function La(e,t){var n;let r=e==null||(n=e.config)==null?void 0:n.get_current_url;if(!D(r))return t;try{let e=r(t);return j(e)&&e?e:t}catch(e){return R.error(`Error in get_current_url, falling back to window.location.href`,e),t}}function Ra(e){return e instanceof Element&&(e.id===`__POSTHOG_TOOLBAR__`||!!e.closest?.call(e,`.toolbar-global-fade-container`))}function za(e){return!!e&&e.nodeType===1}function J(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function Ba(e){return!!e&&e.nodeType===3}function Va(e){return!!e&&e.nodeType===11&&za(e.host)}function Ha(e){return e?S(e).split(/\s+/):[]}function Ua(e,t){let r=function(e){var t;let r=n==null||(t=n.location)==null?void 0:t.href;return A(r)?void 0:La(e,r)}(t);return!!(r&&e&&e.some(e=>r.match(e)))}function Wa(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 Ha(t)}function Ga(e){return N(e)?null:S(e).split(/(\s+)/).filter(e=>_o(e)).join(``).replace(/[\r\n]/g,` `).replace(/[ ]+/g,` `).substring(0,255)}function Ka(e){let t=``;return so(e)&&!co(e)&&e.childNodes&&e.childNodes.length&&H(e.childNodes,function(e){Ba(e)&&e.textContent&&(t+=Ga(e.textContent)??``)}),S(t)}function qa(e){return A(e.target)?e.srcElement||null:e.target?.shadowRoot?e.composedPath()[0]||null:e.target||null}var Ja=[`a`,`button`,`form`,`input`,`select`,`textarea`,`label`];function Ya(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 Xa(e,t){if(A(t))return!0;for(let n of e)if(t.some(e=>Ya(n,e)))return!0;return!1}function Za(e){let t=e.parentNode;return!(!t||!za(t))&&t}var Qa=[`.ph-no-autocapture`,`[data-ph-no-autocapture]`],$a=[`next`,`previous`,`prev`,`>`,`<`],eo=[...$a,`+`,`-`,`â`,`â`],to=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,no=[`.ph-no-rageclick`,`.ph-no-capture`],ro=[``,`text`,`search`,`email`,`password`,`url`,`tel`,`number`];function io(e,t){if(!n||ao(e))return!1;let r,i,a;var o;if(F(t)?(r=!!t&&no,i=void 0,a=!1):(r=t?.css_selector_ignorelist??no,i=t?.content_ignorelist,a=(o=t?.ignore_text_selection)!=null&&o),!1===r||a&&function(e){return!(!e||!za(e))&&(!!J(e,`textarea`)||(J(e,`input`)?x(ro,(e.getAttribute(`type`)||``).toLowerCase()):function(e){if(e.isContentEditable)return!0;let t=e.getAttribute?.call(e,`contenteditable`);return t===`true`||t===``}(e)))}(e))return!1;let{targetElementList:s}=oo(e,!1);return!function(e,t){if(!1===e||A(e))return!1;let n;if(!0===e)n=$a;else{if(!E(e))return!1;if(e.length>10)return R.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=>to(e,n)||to(t,n)))}(i,s.map(e=>({safeText:Ka(e).toLowerCase(),ariaLabel:e.getAttribute(`aria-label`)?.toLowerCase().trim()||``})))&&!Xa(s,r)}var ao=e=>!e||J(e,`html`)||!za(e),oo=(e,t)=>{if(!n||ao(e))return{parentIsUsefulElement:!1,targetElementList:[]};let r=!1,i=[e],a=e;for(;a.parentNode&&!J(a,`body`);){if(Va(a.parentNode)){i.push(a.parentNode.host),a=a.parentNode.host;continue}let e=Za(a);if(!e)break;if(t||Ja.indexOf(e.tagName.toLowerCase())>-1)r=!0;else try{let t=n.getComputedStyle(e);t&&t.getPropertyValue(`cursor`)===`pointer`&&(r=!0)}catch{}i.push(e),a=e}return{parentIsUsefulElement:r,targetElementList:i}};function so(e){let t=new Set,n=0;for(let r=e;r.parentNode&&!J(r,`body`);r=r.parentNode){if(n++>=1e3||t.has(r))return!1;t.add(r);let e=Wa(r);if(x(e,`ph-sensitive`)||x(e,`ph-no-capture`))return!1}if(x(Wa(e),`ph-include`))return!0;let r=e.type||``;if(j(r))switch(r.toLowerCase()){case`hidden`:case`password`:return!1}
1let i=e.name||e.id||``;return!j(i)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(i.replace(/[^a-zA-Z0-9]/g,``))}function co(e){return!!(J(e,`input`)&&![`button`,`checkbox`,`submit`,`reset`].includes(e.type)||J(e,`select`)||J(e,`textarea`)||e.getAttribute(`contenteditable`)===`true`)}var lo=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}))$`),uo=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,fo=[16,15,14,13],po=RegExp(`^(\\d{3}-?\\d{2}-?\\d{4})$`),mo=RegExp(`(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))`,`g`),ho=/[0-9A-Za-z_]/;function go(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 _o(e,t=!0){return!(N(e)||j(e)&&(e=S(e),(t?lo.test((e||``).replace(/[- ]/g,``)):function(e){let t;for(uo.lastIndex=0;t=uo.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 fo){let r=e+t;if(n.length>=r){let t=n.slice(e,r);if(lo.test(t)&&go(t))return!0}}}return!1}(e))||(t?po.test(e):function(e){let t;for(mo.lastIndex=0;t=mo.exec(e);){let e=t[1],n=t[3];if(!(e&&n&&ho.test(e)&&ho.test(n)))return!0}return!1}(e))))}function vo(e){let t=Ka(e);return t=`${t} ${yo(e)}`.trim(),_o(t)?t:``}function yo(e){let t=``;return e&&e.childNodes&&e.childNodes.length&&H(e.childNodes,function(e){if(e&&e.tagName?.toLowerCase()===`span`)try{let n=Ka(e);t=`${t} ${n}`.trim(),e.childNodes&&e.childNodes.length&&(t=`${t} ${yo(e)}`.trim())}catch(e){R.error(`[AutoCapture]`,e)}}),t}function bo(e){return e.replace(/"|\\"/g,`\\"`)}function xo(e){let t=e.attr__class;if(t)return E(t)?t:Ha(t)}var So=z(`[Dead Clicks]`),Co=()=>!0,wo=e=>{let t=!!e.instance.persistence?.get_property(Fr),n=e.instance.config.capture_dead_clicks;return F(n)?n:!!O(n)||t},To=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({[Fr]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.qo(()=>{this.jo()}):this.stop()}qo(e){var t,n;m.__PosthogExtensions__?.initDeadClicksAutocapture?e():(t=m.__PosthogExtensions__)==null||(n=t.loadExternalDependency)==null||n.call(t,this.instance,`dead-clicks-autocapture`,t=>{t?So.error(`failed to load script`,t):e()})}jo(){if(a){if(!this.No&&m.__PosthogExtensions__?.initDeadClicksAutocapture){let e=O(this.instance.config.capture_dead_clicks)?L({},this.instance.config.capture_dead_clicks):{};e.__onCapture=this.onCapture,this.onCapture&&(e.capture_dead_swipes=!1),this.No=m.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,e),this.No.start(a),So.info(`starting...`)}}else So.error("`document` not found. Cannot start.")}stop(){this.No&&(this.No.stop(),this.No=void 0,So.info(`stopping...`))}},Eo=z(`[SegmentIntegration]`);function Do(e,t,n=!0){let r=e.config.segment;if(!r)return t();let{analytics:i,filterProperties:a}=(e=>D(e.register))(o=r)?{analytics:o}:o;var o;(function(e,t,n,r){let i=t=>{let i=()=>t.anonymousId()||_a();e.config.get_device_id=i,r&&t.id()&&(e.register({distinct_id:t.id(),$device_id:i()}),e.persistence.set_property(V,Yi)),n(r?void 0:t.anonymousId()||void 0)},a=t.user();`then`in a&&D(a.then)?a.then(i):i(a)})(e,i,n=>{i.register(((e,t,{filterProperties:n}={})=>{typeof Promise<`u`&&Promise.resolve||Eo.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()||(Eo.info(`No userId set, resetting PostHog`),e.reset()),a||(t=void 0),r.event.userId&&r.event.userId!==e.get_distinct_id()&&(Eo.info(`UserId set, identifying with PostHog`),e.identify(r.event.userId)
1);let o=e.calculateEventProperties(i,r.event.properties);if(!N(n)){let e=r.event.properties||{},t={};for(let n of Object.keys(o))T.call(e,n)||(t[n]=o[n]);let i=((e,t)=>{let n=E(e)?e:[e],r=L({},t);for(let e of n)try{if(r=e(r),N(r))return null}catch(e){return Eo.error(`Error in Segment filterProperties:`,e),null}return r})(n,t);if(N(i))return r;o=i}return r.event.properties=Object.assign({},o,r.event.properties),r};return{name:`PostHog JS`,type:`enrichment`,version:`1.0.0`,isLoaded(){return!0},load(){return Promise.resolve()},track(e){return r(e,e.event.event)},page(e){return r(e,$i)},identify(e){return r(e,ta)},screen(e){return r(e,`$screen`)}}})(e,n,{filterProperties:a})).then(()=>{t()},e=>{Eo.error(`Failed to register the Segment integration`,e),t()})},n)}var Oo=`posthog-js`;function ko(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=>L(L({},e),{},{stacktrace:e.stacktrace?L(L({},e.stacktrace),{},{type:`raw`,frames:(e.stacktrace.frames||[]).map(e=>L(L({},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 Ao=class{constructor(e,t,n,r,i,a){this.name=Oo,this.setupOnce=function(o){o(ko(e,{organization:t,projectId:n,prefix:r,severityAllowList:i,sendExceptionsToPostHog:a==null||a}))}}},jo=class{constructor(e){this.Bo=(e,t,n)=>{n&&(n.noSessionId||n.activityTimeout||n.sessionPastMaximumLength||n.crossTabAdoption)&&(R.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 r=this.Wo(e,t);return this.Ho={pathname:n?.location.pathname??``,pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),r}doPageLeave(e){return this.Wo(e,this.Ho?.pageViewId)}doEvent(){return{$pageview_id:this.Ho?.pageViewId}}Wo(e,t){let n=this.Ho;if(!n)return{$pageview_id:t};let r={$pageview_id:t,$prev_pageview_id:n.pageViewId},i=this._instance.scrollManager.getContext();if(i&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:e,lastScrollY:t,maxScrollY:n,maxContentHeight:a,lastContentY:o,maxContentY:s}=i;if(!(A(e)||A(t)||A(n)||A(a)||A(o)||A(s))){e=Math.ceil(e),t=Math.ceil(t),n=Math.ceil(n),a=Math.ceil(a),o=Math.ceil(o),s=Math.ceil(s);let i=e>1?_e(t/e,0,1,R):1,c=e>1?_e(n/e,0,1,R):1,l=a>1?_e(o/a,0,1,R):1,u=a>1?_e(s/a,0,1,R):1;r=U(r,{$prev_pageview_last_scroll:t,$prev_pageview_last_scroll_percentage:i,$prev_pageview_max_scroll:n,$prev_pageview_max_scroll_percentage:c,$prev_pageview_last_content:o,$prev_pageview_last_content_percentage:l,$prev_pageview_max_content:s,$prev_pageview_max_content_percentage:u})}}return n.pathname&&(r.$prev_pageview_pathname=n.pathname),n.timestamp&&(r.$prev_pageview_duration=(e.getTime()-n.timestamp.getTime())/1e3),r}},Mo=[`flags`,`surveys`],No={[vr]:{exposure:`hidden`},[Sr]:{exposure:`hidden`},[Cr]:{exposure:`hidden`},[Or]:{exposure:`hidden`},[Tr]:{exposure:`hidden`},[Dr]:{exposure:`hidden`},[kr]:{exposure:`event`},[Ar]:{exposure:`hidden`},[Lr]:{exposure:`hidden`},[jr]:{exposure:`event`},[Mr]:{exposure:`hidden`},[Nr]:{exposure:`event`},[Pr]:{exposure:`event`},[Fr]:{exposure:`event`},[Ir]:{exposure:`hidden`},[Rr]:{exposure:`event`},[zr]:{exposure:`hidden`},[Br]:{exposure:`hidden`},[Kr]:{exposure:`hidden`},[qr]:{exposure:`event`},[Vr]:{exposure:`event`,shouldSkipFromEventProperties:e=>M(e)},[Jr]:{exposure:`event`},[Yr]:{exposure:`event`},[Xr]:{exposure:`event`},[Zr]:{exposure:`event`},[Qr]:{exposure:`hidden`},[$r]:{exposure:`hidden`,storageGroup:`flags`}
1,[ei]:{exposure:`hidden`,storageGroup:`flags`},[ti]:{exposure:`hidden`},[ni]:{exposure:`hidden`,storageGroup:`flags`},[ri]:{exposure:`hidden`,storageGroup:`flags`},[ii]:{exposure:`hidden`,storageGroup:`flags`,volatile:!0},[ai]:{exposure:`hidden`,storageGroup:`flags`},[oi]:{exposure:`hidden`},[si]:{exposure:`hidden`},[ci]:{exposure:`hidden`},[li]:{exposure:`hidden`},[di]:{exposure:`hidden`,storageGroup:`surveys`},[fi]:{exposure:`hidden`,storageGroup:`surveys`,volatile:!0},[pi]:{exposure:`event`},[mi]:{exposure:`hidden`},[hi]:{exposure:`hidden`},[gi]:{exposure:`hidden`},[_i]:{exposure:`hidden`},[vi]:{exposure:`hidden`},[yi]:{exposure:`event`},[bi]:{exposure:`event`},[xi]:{exposure:`event`},[Si]:{exposure:`event`},[Ci]:{exposure:`hidden`},[wi]:{exposure:`hidden`},[ui]:{exposure:`event`},[Ti]:{exposure:`hidden`},[Ei]:{exposure:`hidden`,storageGroup:`flags`,volatile:!0},[V]:{exposure:`hidden`},[Di]:{exposure:`hidden`},[Oi]:{exposure:`hidden`},[ki]:{exposure:`hidden`},[Ai]:{exposure:`hidden`},[ji]:{exposure:`hidden`},[Mi]:{exposure:`hidden`},[Hr]:{exposure:`event`},[Ur]:{exposure:`event`},[Wr]:{exposure:`event`},[Gr]:{exposure:`event`},[Fi]:{exposure:`event`},[Ii]:{exposure:`event`},[Li]:{exposure:`event`},[Ri]:{exposure:`event`},[zi]:{exposure:`event`},[Bi]:{exposure:`event`},[Vi]:{exposure:`event`},[Hi]:{exposure:`event`},[Ui]:{exposure:`event`},[Wi]:{exposure:`event`},[Gi]:{exposure:`event`},[Ki]:{exposure:`event`}},Po=[[`$posthog_sr_group_event_trigger_`,{exposure:`hidden`}],[`$posthog_sr_group_url_trigger_`,{exposure:`hidden`}],[`$posthog_sr_group_sampling_`,{exposure:`hidden`}]],Y=e=>{let t=No[e];if(t)return t;for(let[t,n]of Po)if(e.indexOf(t)===0)return n},Fo=(e,t)=>{try{let n;return JSON.stringify(e,(e,t)=>ce(t)?(n??=new WeakMap,n.has(t)||n.set(t,sa(t)),n.get(t)):typeof t==`bigint`?t.toString():t,t)}catch{return w(e)}},Io=e=>{let t=a?.createElement(`a`);return A(t)?null:(t.href=e,t)},Lo=function(e,t){let n=((e.split(`#`)[0]||``).split(/\?(.*)/)[1]||``).replace(/^\?+/g,``).split(`&`),r;for(let e=0;n.length>e;e++){let i=n[e].split(`=`);
1if(i[0]===t){r=i;break}}if(!E(r)||2>r.length)return``;{let e=r[1];try{e=decodeURIComponent(e)}catch{R.error(`Skipping decoding for malformed query param: `+e)}return e.replace(/\+/g,` `)}},Ro=function(e,t,n){if(!e||!t||!t.length)return e;let r=e.split(`#`),i=r[1],a=(r[0]||``).split(`?`),o=a[1],s=a[0],c=(o||``).split(`&`),l=[];for(let e=0;c.length>e;e++){let r=c[e].split(`=`);E(r)&&(t.includes(r[0])?l.push(r[0]+`=`+n):l.push(c[e]))}let u=s;return o!=null&&(u+=`?`+l.join(`&`)),i!=null&&(u+=`#`+i),u},zo=function(e,t){let n=e.match(RegExp(t+`=([^&]*)`));return n?n[1]:null},Bo=(e,t)=>e>=t&&f(),Vo=(e,t,n,r)=>{if(e===0){if(f()){let e=t+1;return e===n&&r(),e}return t}return 0},Ho=[`gclid`,`gclsrc`,`dclid`,`gbraid`,`wbraid`,`fbclid`,`msclkid`,`twclid`,`li_fat_id`,`igshid`,`ttclid`,`rdt_cid`,`epik`,`qclid`,`sccid`,`irclid`,`_kx`],Uo=[`utm_source`,`utm_medium`,`utm_campaign`,`utm_content`,`utm_term`,`gad_source`,`mc_cid`,...Ho],Wo=`<masked>`,Go=[`li_fat_id`];function Ko(e,t,n){if(!a)return{};let r=t?[...Ho,...n||[]]:[],i=qo(Ro(a.URL,r,Wo),e);return U(function(){let e={};return H(Go,function(t){let n=da(t);e[t]=n||null}),e}(),i)}function qo(e,t){let n=Uo.concat(t||[]),r={};return H(n,function(t){let n=Lo(e,t);r[t]=n||null}),r}function Jo(e){let t=function(e){return e?e.search(`https?://(.*)google.([^/?]*)`)===0?`google`:e.search(`https?://(.*)bing.com`)===0?`bing`:e.search(`https?://(.*)yahoo.com`)===0?`yahoo`:e.search(`https?://(.*)duckduckgo.com`)===0?`duckduckgo`:null:null}(e),n=t==`yahoo`?`p`:`q`,r={};if(!M(t)){r.$search_engine=t;let e=a?Lo(a.referrer,n):``;e.length&&(r.ph_keyword=e)}return r}function Yo(){return navigator.language||navigator.userLanguage}function Xo(){let e=Yo();return typeof e==`string`?e.split(`-`)[0]:void 0}var Zo=`$direct`;function Qo(){return a?.referrer||Zo}function $o(e,t,n=!1){let r=e?[...Ho,...t||[]]:[],i=(n?jt(o?.href):o?.href)?.substring(0,1e3);return{r:Qo().substring(0,1e3),u:i?Ro(i,r,Wo):void 0}}function es(e,t=!1){let{r:n,u:r}=e,i=t?jt(r):r,a={$referrer:n,$referring_domain:n==null?void 0:n==Zo?Zo:Io(n)?.host};if(i){a.$current_url=i;let e=Io(i);a.$host=e?.host,a.$pathname=e?.pathname,U(a,qo(i))}return n&&U(a,Jo(n)),a}function ts(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function ns(){try{return new Date().getTimezoneOffset()}catch{return}}var rs={flags:Ei,surveys:fi},is=[`cookie`,`localstorage`,`localstorage+cookie`,`sessionstorage`,`memory`],as=e=>`${e}_cookie_identity_change_pending`,os=e=>{let t=``,n=0;for(let r of e){let e=encodeURIComponent(JSON.stringify(r).slice(1,-1)).length;if(n+e>1e3)break;t+=r,n+=e}return t},X=`main`,ss=[$r,ei,ni,ri,ii,Ei,ai,ci],cs=e=>ss.indexOf(e)!==-1,ls=[Tr,Dr],us=e=>ls.indexOf(e)!==-1,ds=(e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch{return e===t}},fs=e=>{if(!e)return{};let t=JSON.parse(e);return O(t)?t:{}},ps=(e,t)=>{H(e,(n,r)=>{let i=Y(r);i&&i.exposure!==`event`||{}.hasOwnProperty.call(t,r)||delete e[r]})},ms=class{constructor(e,t,r=!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=r,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&&R.info(`Persistence loaded`,e.persistence,L({},this.props)),this.update_config(e,e,t),this.save(),n){let e=()=>this.flush();W(n,`beforeunload`,e,{capture:!1}),W(n,`pagehide`,e,{capture:!1}),this.ha=e=>{if(this.Go&&(!e.storageArea||e.storageArea===n?.localStorage)&&e.key){if(e.key!==this.oa){if(this.Qo){let t=Mo.find(t=>e.key===this.ca(t));t&&this.da(e.key,t)}}else this.da(e.key,X)}},W(n,`storage`,this.ha)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(([e,t])=>{let n=this.Xo.get(e);if(!cs(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&&n&&(n.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=K.Ot(e),M(i)){let e=this.fa(t);return e.storageValue=null,t!==X&&(e.persisted=!1),!1}r=fs(i)}catch{return!1}let a=t===X?r:K.Dt(this.oa);if(a&&this.pa(a))return!1;let o=this.ga(r,t,n);return t===X&&this.Qo&&!ds(this.ma().main,r)||this.ya(r,t,!0,i),o}pa(e){let t=this.props[yr],n=e[yr];return!A(t)&&!A(n)&&t!==n}ya(e,t,n,r){let i=this.fa(t);i.storageValue=r,t!==X&&(i.persisted=n);try{i.fingerprint=this.ba(e,t)}catch{i.fingerprint=void 0}}ga(e,t,n){let r=!1;return ss.forEach(n=>{let i=Y(n)?.storageGroup;if(t===X&&this.Qo&&i||t!==X&&i!==t)return;let a=n in e,o=this._a(n,a?e[n]:void 0),s=this.Xo.has(n)?n in this.props:a;s===n in this.props&&ds(o,this.props[n])||(s?this.wa(n,o,!1):this.ka(n,!1),r=!0)}
1),r&&n&&this.na.forEach(e=>e()),r}Sa(){if(!this.Go)return!1;try{this.ea=!1;let e=K.Ot(this.oa),t=this.fa(X),n,r=!1,i=!1;if(e!==t.storageValue){if(M(e))t.storageValue=null;else{if(n=fs(e),this.ea=!this.ta&&this.pa(n),this.ea)return!1;i=this.ga(n,X,!1),!this.Qo||ds(this.ma().main,n)?this.ya(n,X,!0,e):t.storageValue=e,r=!0}}return this.Qo&&Mo.forEach(e=>{let t=K.Ot(this.ca(e)),a=this.fa(e),o=n||{},s=r&&ss.some(t=>Y(t)?.storageGroup===e&&t in o);if(t===a.storageValue&&!s)return;if(M(t))return a.storageValue=null,a.persisted=!1,void(s&&(i=this.ga(o,e,!1)||i));let c=fs(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=Y(e);n!=null&&n.volatile||(this.fa((this.Qo?n?.storageGroup:void 0)||X).fingerprint=void 0,this.xa(e))}Ca(){ss.forEach(e=>this.Xo.set(e,!0))}ua(){if(this.Go)try{let e=K.Ot(this.oa),t=fs(e);this.fa(X).storageValue=e,ss.forEach(e=>{let n=this.Qo?Y(e)?.storageGroup:void 0,r=n?K.Ot(this.ca(n)):null;if(n){let e=this.fa(n);e.storageValue=r,e.persisted=!M(r)}let i=n&&!M(r)?fs(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(E(t)?t:[]),i=new Set(E(this.props[e])?this.props[e]:[]);return n.forEach(e=>i.has(e)?r.add(e):r.delete(e)),Array.from(r)}let r=O(t)?L({},t):{},i=O(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(!cs(e))return;let r=this.Xo.get(e);if(!0===r)return;let i=t;if(this.Go)try{let t=this.Qo?Y(e)?.storageGroup:void 0,n=t?this.ca(t):this.oa;i=fs(K.Ot(n))[e]}catch{}let a=new Set(r||[]);if(e===`$active_feature_flags`){if(!A(t)&&!E(t)||!A(i)&&!E(i)||!E(n))return void this.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)})}
1else{if(!O(n))return void(ds(i,n)?this.Xo.delete(e):this.va(e,!0));{if(!A(t)&&!O(t)||A(t)&&k(n)&&A(i))return void this.va(e,!0);let r=O(t)?t:{},o=O(i)?i:{};new Set([...Object.keys(r),...Object.keys(n)]).forEach(e=>{e in r==e in n&&ds(r[e],n[e])||a.add(e)}),a.forEach(e=>{e in o==e in n&&ds(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 P(e)&&e>0?e:0}Ia(e){if(this.Ir.cookieWinsOnConflict&&this.Ir.persistence.toLowerCase()===`localstorage+cookie`){if(e)try{let t=Oa(e,this.Ir.cookie_persisted_properties||[]),n=Aa(t,this.Ir.cookie_persisted_properties||[]),r=JSON.stringify(t)+`|`+JSON.stringify(n),i=G.Ot(this.oa)||void 0;i&&Ma(this.oa,i)===r&&(this.Ma=r,this.Ea=i)}catch{}else try{let e=G.Ot(this.oa)||void 0;this.Ma=e?Ma(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=G.Ot(this.oa)||void 0}catch{}if(!n||n===this.Ea)return!1;let r=Ma(this.oa,n),i;try{i=Da(JSON.parse(n))}catch{return!1}if((G.Ot(this.oa)||void 0)!==n)return!1;this.Ma=r,this.Ea=n;let a=ja(this.oa,n),o=[...wa,...a.properties],s={};
1if(Object.keys(i).forEach(e=>{let t=i[e];(A(t)||M(t)||t===``||e===`$user_state`&&t!==`anonymous`&&t!==`identified`)&&(s[e]=!0,delete i[e])}),k(i))return!1;let c=`distinct_id`in i||i.$user_state===`anonymous`||i.$user_state===`identified`,l=this.props,u=l[yr],d=l[V],f=U({},l);[...wa,...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||wa.indexOf(e)===-1||!1!==t&&t!==0)&&delete f[e]}}),this.props=U(f,i),ss.forEach(e=>{let t=e in this.props;e in l===t&&ds(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(V,Ji);let p=this.props[yr],m=this.props[V];return!c||p===u&&m===d||(this.ta=!0,this.Jo=!0,q.At(as(this.oa),!0),this.ka(ci),this.ka(ei),this.ka($r),this.ka(ni),this.ka(ri),this.ka(ii),this.ka(Ei),this.ka(Ti),this.ka(Ci),m!==`anonymous`||d!==`identified`&&i.$user_state!==`anonymous`&&(A(u)||p===u)||(ps(this.props,i),this.ka(li)),m===`identified`?this.props.$user_id=p:delete this.props.$user_id,this.ka(Sr)),!0}
1consumeCookieIdentityChange(){let e=as(this.oa),t=this.Jo||!!q.Ot(e);return this.Jo=!1,t&&q.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&&(A(this.Fa)||(clearTimeout(this.Fa),this.Fa=void 0),delete this.Vo[X],this.Oa(!0))}Da(e=!0){if(this.Ko)try{e?this.Aa():A(this.Fa)||(clearTimeout(this.Fa),this.Fa=void 0)}finally{this.Ko=!1}}isDisabled(){return!!this.mi}aa(e){is.indexOf(e.persistence.toLowerCase())===-1&&(R.critical(`Unknown persistence type `+e.persistence+`; falling back to localStorage+cookie`),e.persistence=`localStorage+cookie`);let t=((e=[],t=!1)=>{let r=[...wa,...e];return L(L({},K),{},{Dt(e){try{let n,i={};try{n=G.Ot(e)||void 0,i=n?Da(JSON.parse(n)):{}}catch{}let a=JSON.parse(K.Ot(e)||`{}`),o;if(t){let t=ja(e,n),s=[...wa,...t.properties],c={};Object.keys(i).forEach(e=>{let t=i[e];M(t)||t===``||e===`$user_state`&&t!==`anonymous`&&t!==`identified`||(c[e]=t)});let l=`distinct_id`in c||c.$user_state===`anonymous`||c.$user_state===`identified`;if(Object.keys(c).length>0){let e=a[yr],n=a.$user_state??Ji;r.forEach(e=>{if(s.indexOf(e)!==-1&&!(e in i)&&(l||e!==`distinct_id`&&e!==`$user_state`)){let n=a[e];(t.isValid||wa.indexOf(e)===-1||!1!==n&&n!==0)&&delete a[e]}}),!l||`$user_state`in i||`$user_state`in a||(a[V]=Ji),!l||(`distinct_id`in c?c[yr]:a[yr])===e&&(`$user_state`in c?c[V]:a[V])===n||(Ca.forEac
1h(e=>delete a[e]),c.$user_state===`identified`&&`distinct_id`in c?a.$user_id=c[yr]:delete a.$user_id,c.$user_state!==`identified`&&(delete a[ui],delete a[li]),delete a.__alias)}o=U(a,c)}else o=U(i,a);return K.At(e,o),o}catch{}return null},At(n,r,i,a,o,s){let c=K.At(n,r,void 0,void 0,s);try{let l=Oa(r,e);if(Object.keys(l).length){if(t){let t=Ta(n),u=Aa(l,e);if(G.At(t,u,i,a,o,s),G.Ot(t)!==JSON.stringify(u)){G.Lt(t,a);let e=Oa(r);return G.At(n,e,i,a,o,s),c}}G.At(n,l,i,a,o,s)}}catch(e){K.Pt(e)}return c},Lt(e,t){try{n?.localStorage.removeItem(e),G.Lt(e,t),G.Lt(Ta(e),t)}catch(e){K.Pt(e)}}})})(e.cookie_persisted_properties||[],e.cookieWinsOnConflict),r,i=!1,a=!1,o=e.persistence.toLowerCase();return o===`localstorage`&&K.Et()?(r=K,a=!0):o===`localstorage+cookie`&&t.Et()?(r=t,a=!0,i=!0):o===`sessionstorage`&&q.Et()?r=q:o===`memory`?r=Pa:o===`cookie`&&G.Et()?(r=G,i=!0):t.Et()?(r=t,a=!0,i=!0):G.Et()?(r=G,i=!0):r=Pa,this.Go=a,this.Zo=i,r}ca(e){return`${this.oa}__${e}`}la(e){return this.Go&&!!e.split_storage}properties(){let e={};return H(this.props,(t,n)=>{let r=Y(n);if(!r||r.exposure===`event`){var i;if(r!=null&&(i=r.shouldSkipFromEventProperties)!=null&&i.call(r,t))return;e[n]=t}}),e}load(e=!1){if(this.mi&&!e)return;let t=this.Ir.cookieWinsOnConflict&&this.Ir.persistence.toLowerCase()===`localstorage+cookie`,n=t?K.Dt(this.oa):null,r={};if(t)try{r=Da(G.Dt(this.oa)),H(r,(e,t)=>{(A(e)||M(e)||e===``)&&delete r[t]})}catch{}let i=this.Oo.Dt(this.oa);if(i&&(this.props=U({},i)),this.Qo&&this.La(),t&&i){let e=n?.[yr],t=n?.$user_state??Ji,a=i[yr],o=i.$user_state??Ji;if(a!==e||o!==t){this.Jo=!0,q.At(as(this.oa),!0);let n=U({},this.props);Ca.forEach(e=>delete n[e]),o!==`anonymous`||t!==`identified`&&r.$user_state!==`anonymous`&&(A(e)||a===e)||(ps(n,r),delete n[li]),this.props=n;let i=new Set;Ca.forEach(e=>{let t=Y(e)?.storageGroup;t&&i.add(t)}),i.forEach(e=>{let t={};H(this.props,(n,r)=>{Y(r)?.storageGroup===e&&(t[r]=n)}),k(t)?(K.Lt(this.ca(e)),this.Vo[e]={}):K.At(this.ca(e),t)&&(this.Vo[e]={persisted:!0,fingerprint:this.ba(t,e)})})}}q.Ot(as(this.oa))&&(this.Jo=!0)}La(){for(let e of Mo){let t=K.Dt(this.ca(e));if(t&&!k(t)){let n=this.fa(e);n.persisted=!0,this.Na(e)||(n.fingerprint=this.ba(t,e)),this.qa(e,t)||U(this.props,t)}}}Na(e){return Object.keys(this.props).some(t=>Y(t)?.storageGroup===e)}qa(e,t){let n=rs[e];if(!n)return!1;let r=t[n],i=this.props[n];return P(r)&&P(i)&&i>r}refreshKey(e){if(this.mi||this.ia.has(e))return;let t=this.Qo?Y(e)?.storageGroup:void 0,n=t?K.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?A(this.Fa)&&(this.Fa=setTimeout(()=>{this.Fa=void 0,this.Oa()},e)):this.Oa()}flush(){A(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`||ls.forEac
1h(e=>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&&R.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,X);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,X);n===`written`&&this.Ia(e),n!==`failed`&&(this.ta=!1,this.ia.clear(),ss.forEach(e=>{var t;(t=Y(e))!=null&&t.storageGroup||this.Xo.delete(e)}));for(let e of Mo){let n=t[e];if(k(n)&&!this.Vo[e]?.persisted){ss.forEach(t=>{Y(t)?.storageGroup===e&&this.Xo.delete(t)});continue}let r=this.Ba(K,this.ca(e),n,e);r!==`failed`&&ss.forEach(t=>{let n=Y(t);n?.storageGroup!==e||r!==`written`&&n.volatile||this.Xo.delete(t)})}}ma(){let e={},t={flags:{},surveys:{}};return H(this.props,(n,r)=>{let i=Y(r)?.storageGroup;i?t[i][r]=n:e[r]=n}),{main:e,groups:t}}ba(e,t){if(t===X)return JSON.stringify(e)+`|`+this.Ha+`|`+this.za+`|`+this.Ua;let n={};return H(e,(e,t)=>{n[t]=Y(t)?.volatile?`__volatile__`:e}),JSON.stringify(n)}Ba(e,t,n,r){let i=this.fa(r);if(r!==X&&!i.dirty&&!A(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!==X&&(i.persisted=!0),A(a)||(i.fingerprint=a),this.Go&&(i.storageValue=K.Ot(t)),`written`):(this.Ir.debug&&R.warn(`failed to persist storage entry "${t}"; will retry on next save`),`failed`)}remove({keepGroupEntries:e=!1}={}){if(this.Ca(),A(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 Mo)K.Lt(this.ca(e));e?delete this.Vo[X]:this.Vo={},this.Ma=void 0,this.Ea=void 0}clear(){this.remove(),this.props={}}register_once(e,t,n){if(O(e)){this.syncCookieProperties(),A(t)&&(t=`None`),this.Ha=A(n)?this.Wa:n;let r=!1;if(H(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(O(e)){this.syncCookieProperties(),this.Ha=A(t)?this.Wa:t;let n=!1;if(H(e,(t,r)=>{e.hasOwnProperty(r)&&(this.props[r]!==t||O(t)||E(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=a?.URL;if(e===this.ra)return;let t=Ko(this.Ir.custom_campaign_params,this.Ir.mask_personal_data_properties,this.Ir.custom_personal_data_properties),n=!k(oa(t));return n&&this.register(t),this.ra=e,n?t:void 0}update_search_keyword(){this.register(function(){let e=a?.referrer;return e?Jo(e):{}}())}update_referrer_info(){this.register_once({$referrer:Qo(),$referring_domain:a?.referrer&&Io(a.referrer)?.host||Zo},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;let e=$o(this.Ir.mask_personal_data_properties,this.Ir.custom_personal_data_properties,this.Ir.disable_capture_url_hashes);this.register_once({[ji]:this.Zo?{r:os(e.r),u:e.u?os(e.u):void 0}:e},void 0)}get_initial_props(){let e={};H([Ai,ki],t=>{let n=this.props[t];n&&H(n,function(t,n){e[`$initial_`+C(n)]=t})});let t=this.props[ji];return t&&U(e,function(e,t=!1){let n=es(e,t),r={};return H(n,function(e,t){r[`$initial_${C(t)}`]=e}),r}(t,this.Ir.disable_capture_url_hashes)),e}safe_merge(e){return H(this.props,function(t,n){n in e||(e[n]=t)}),e}update_config(e,t,n){let r=e.persistence!==t.persistence,i=!((e,t)=>{if(e.length!==t.length)return!1;let n=[...e].sort(),r=[...t].sort();return n.every((e,t)=>e===r[t])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),a=r||i,o=e.cookieWinsOnConflict!==t.cookieWinsOnConflict,s=e.disable_persistence||!!n,c=!!this.mi&&!s;s||this.Pa(t,c),this.Ir=e,!s&&(r||i||o)&&(this.Ma=void 0,this.Ea=void 0,this.Pa(L(L({},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[X],this.Oa()))}finally{this.Yo=!1,f&&this.Da()}}Va(){let e=this.props[ji];if(!this.Zo||!O(e)||typeof e.r!=`string`)return;let t=os(e.r),n=typeof e.u==`string`?os(e.u):e.u;t===e.r&&n===e.u||this.wa(ji,L(L({},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(Or,n),this.save()}remove_event_timer(e){let t=this.props.__timers||{},n=t[e];return A(n)||(delete t[e],this.wa(Or,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),us(e)&&!
1ds(i,t)&&this.ia.add(e),this.$a(e,i,t),(r=Y(e))!=null&&r.volatile||this.xa(e))}ka(e,t=!0){delete this.props[e],t&&(cs(e)&&this.va(e,!0),us(e)&&this.ia.add(e),this.xa(e))}xa(e){let t=Y(e)?.storageGroup;t&&(this.fa(t).dirty=!0)}fa(e){return this.Vo[e]||(this.Vo[e]={})}},hs={GZipJS:`gzip-js`,Base64:`base64`},gs={Activation:`events`,Cancellation:`cancelEvents`},_s={Popover:`popover`,API:`api`,Widget:`widget`,ExternalSurvey:`external_survey`},vs={SHOWN:`survey shown`,DISMISSED:`survey dismissed`,SENT:`survey sent`,ABANDONED:`survey abandoned`},ys={SURVEY_ID:`$survey_id`,SURVEY_NAME:`$survey_name`,SURVEY_RESPONSE:`$survey_response`,SURVEY_ITERATION:`$survey_iteration`,SURVEY_ITERATION_START_DATE:`$survey_iteration_start_date`,SURVEY_PARTIALLY_COMPLETED:`$survey_partially_completed`,SURVEY_SUBMISSION_ID:`$survey_submission_id`,SURVEY_QUESTIONS:`$survey_questions`,SURVEY_COMPLETED:`$survey_completed`,PRODUCT_TOUR_ID:`$product_tour_id`,SURVEY_LAST_SEEN_DATE:`$survey_last_seen_date`,SURVEY_LANGUAGE:`$survey_language`},bs={Popover:`popover`,Inline:`inline`};function xs(e){let t=!0;return{dispose(){if(t){t=!1;let n=e();n&&D(n.then)&&n.then(void 0,()=>{})}}}}var Ss={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`},Cs={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`},ws=z(`[RateLimiter]`),Ts=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=>{ws.info(`${e||`events`} is quota limited.`),this.serverLimits[e]=new Date().getTime()+6e4})}catch(e){ws.warn(`could not rate limit - continuing. Error: "${e?.message}"`,{text:t});return}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){return this.instance.config.rate_limiting?.events_per_second||10}get captureEventsBurstLimit(){return Math.max(this.instance.config.rate_limiting?.events_burst_limit||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e=!1){var t;let{captureEventsBurstLimit:n,captureEventsPerSecond:r}=this,i=new Date().getTime(),a=this.instance.persistence?.get_property(`$capture_rate_limit`)??{tokens:n,last:i};a.tokens+=(i-a.last)/1e3*r,a.last=i,a.tokens>n&&(a.tokens=n);let o=1>a.tokens;if(o||e||(a.tokens=Math.max(0,a.tokens-1)),o&&!e){let e=(P(a.dropped)?a.dropped:0)+1;a.dropped=e,!this.lastEventRateLimited&&this.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!E(t)||!t.includes(e)}Qa(){if(this.Za(`$current_url`)&&this.Za(`$pathname`)&&o?.pathname)return`${o.origin??``}${o.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}},Es=z(`[RemoteConfig]`),Ds=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=m._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}Ja(e){var t,n;m.__PosthogExtensions__?.loadExternalDependency?(t=m.__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 Es.info(`Using preloaded remote config`,this.remoteConfig),void this.Xa(this.remoteConfig);if(this._instance.Ya())return void Es.warn(`Remote config is disabled. Falling back to local config.`);this.Ja(e=>{if(!e)return Es.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){Es.error(`Error loading remote config`,e),this.Xa()}}Xa(e,t){!e&&t&&(t.statusCode===0?t.error||Es.warn(`Failed to fetch remote config from PostHog.`):Es.error(`Failed to fetch remote config from PostHog.`));try{this._instance.Xa(e?{ok:!0,config:e}:{ok:!1})}catch(e){Es.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){Es.error(`Error loading feature flags`,e)}}},Os=Uint8Array,Z=Uint16Array,ks=Uint32Array,As=new Os([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]),js=new Os([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]),Ms=new Os([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ns=function(e,t){for(var n=new Z(31),r=0;31>r;++r)n[r]=t+=1<<e[r-1];var i=new ks(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]},Ps=Ns(As,2),Fs=Ps[1];Ps[0][28]=258,Fs[258]=28;for(var Is=Ns(js,0)[1],Ls=new Z(32768),Q=0;32768>Q;++Q){var Rs=(43690&Q)>>>1|(21845&Q)<<1;Ls[Q]=((65280&(Rs=(61680&(Rs=(52428&Rs)>>>2|(13107&Rs)<<2))>>>4|(3855&Rs)<<4))>>>8|(255&Rs)<<8)>>>1}var zs=function(e,t,n){for(var r=e.length,i=0,a=new Z(t);r>i;++i)++a[e[i]-1];var o,s=new Z(t);for(i=0;t>i;++i)s[i]=s[i-1]+a[i-1]<<1;if(n){o=new Z(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[Ls[d]>>>c]=l}else for(o=new Z(r),i=0;r>i;++i)o[i]=Ls[s[e[i]-1]++]>>>15-e[i];return o},Bs=new Os(288);for(Q=0;144>Q;++Q)Bs[Q]=8;for(Q=144;256>Q;++Q)Bs[Q]=9;for(Q=256;280>Q;++Q)Bs[Q]=7;for(Q=280;288>Q;++Q)Bs[Q]=8;var Vs=new Os(32);for(Q=0;32>Q;++Q)Vs[Q]=5;var Hs=zs(Bs,9,0),Us=zs(Vs,5,0),Ws=function(e){return(e/8|0)+(7&e&&1)},Gs=function(e,t,n){(t==null||0>t)&&(t=0),(n==null||n>e.length)&&(n=e.length);var r=new(e instanceof Z?Z:e instanceof ks?ks:Os)(n-t);return r.set(e.subarray(t,n)),r},Ks=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},Js=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 Os(0),0];if(i==1){var o=new Os(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 Z(f+1),m=Ys(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 Os(p),m]},Ys=function(e,t,n){return e.s==-1?Math.max(Ys(e.l,t,n+1),Ys(e.r,t,n+1)):t[e.s]=n},Xs=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Z(++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,136 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]},Zs=function(e,t){for(var n=0,r=0;t.length>r;++r)n+=e[r]*t[r];return n},Qs=function(e,t,n){var r=n.length,i=Ws(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)},$s=function(e,t,n,r,i,a,o,s,c,l,u){Ks(t,u++,n),++i[256];for(var d=Js(i,15),f=d[0],p=d[1],m=Js(a,15),h=m[0],g=m[1],_=Xs(f),v=_[0],y=_[1],b=Xs(h),x=b[0],S=b[1],C=new Z(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=Js(C,7),T=ee[0],te=ee[1],E=19;E>4&&!T[Ms[E-1]];--E);var D,O,k,A,j=l+5<<3,ne=Zs(i,Bs)+Zs(a,Vs)+o,M=Zs(i,f)+Zs(a,h)+o+14+3*E+Zs(C,T)+(2*C[16]+3*C[17]+7*C[18]);if(ne>=j&&M>=j)return Qs(t,u,e.subarray(c,c+l));if(Ks(t,u,1+(ne>M)),u+=2,ne>M){D=zs(f,p,0),O=f,k=zs(h,g,0),A=h;var N=zs(T,te,0);for(Ks(t,u,y-257),Ks(t,u+5,S-1),Ks(t,u+10,E-4),u+=14,w=0;E>w;++w)Ks(t,u+3*w,T[Ms[w]]);u+=3*E;for(var P=[v,x],re=0;2>re;++re){var F=P[re];for(w=0;F.length>w;++w)Ks(t,u,N[ie=31&F[w]]),u+=T[ie],ie>15&&(Ks(t,u,F[w]>>>5&127),u+=F[w]>>>12)}}else D=Hs,O=Bs,k=Us,A=Vs;for(w=0;s>w;++w)if(r[w]>255){var ie;qs(t,u,D[257+(ie=r[w]>>>18&31)]),u+=O[ie+257],ie>7&&(Ks(t,u,r[w]>>>23&31),u+=As[ie]);var ae=31&r[w];qs(t,u,k[ae]),u+=A[ae],ae>3&&(qs(t,u,r[w]>>>5&8191),u+=js[ae])}else qs(t,u,D[r[w]]),u+=O[r[w]];return qs(t,u,D[256]),u+O[256]},ec=new ks([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),tc=new Os(0),nc=function(){for(var e=new ks(256),t=0;256>t;++t){for(var n=t,r=9;--r;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),rc=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function ic(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=nc[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 Os(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=Qs(c,l,e.subarray(u,d)):(c[u]=a,l=Qs(c,l,e.subarray(u,o)))}else{for(var f=ec[t-1],p=f>>>13,m=8191&f,h=(1<<n)-1,g=new Z(32768),_=new Z(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 ks(25e3),S=new Z(288),C=new Z(32),w=0,ee=0,T=(u=0,0),te=0,E=0;o>u;++u){var D=b(u),O=32767&u,k=_[D];if(g[O]=k,_[D]=O,u>=te){var A=o-u;if((w>7e3||T>24576)&&A>423){l=$s(e,c,0,x,S,C,ee,T,E,u-E,l),T=w=ee=0,E=u;for(var j=0;286>j;++j)S[j]=0;for(j=0;30>j;++j)C[j]=0}var ne=2,M=0,N=m,P=O-k&32767;if(A>2&&D==b(u-P))for(var re=Math.min(p,A)-1,F=Math.min(32767,u),ie=Math.min(258,A);F>=P&&--N&&O!=k;){if(e[u+ne]==e[u+ne-P]){for(var ae=0;ie>ae&&e[u+ae]==e[u+ae-P];++ae);if(ae>ne){if(ne=ae,M=P,ae>re)break;var oe=Math.min(P,ae-2),se=0;for(j=0;oe>j;++j){var ce=u-P+j+32768&32767,le=ce-g[ce]+32768&32767;le>se&&(se=le,k=ce)}}}P+=(O=k)-(k=g[O])+32768&32767}if(M){x[T++]=268435456|Fs[ne]<<18|Is[M];var ue=31&Fs[ne],de=31&Is[M];ee+=As[ue]+js[de],++S[257+ue],++C[de],te=u+ne,++w}else x[T++]=e[u],++S[e[u]]}}l=$s(e,c,a,x,S,C,ee,T,E,u-E,l),a||(l=Qs(c,l,tc))}return Gs(s,0,r+Ws(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&&rc(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),rc(u,d-8,n.d()),rc(u,d-4,r),u}var ac=!!c||!!s,oc=new WeakMap,sc=`text/plain`,cc=0,lc=!1,uc=(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}`:``}`},dc=(e,t,n=!0)=>{let[r,i]=e.split(`?`),a=L({},t),o=i?.split(`&`).map(e=>{var t;let[r,i]=e.split(`=`),o=n&&(t=a[r])!=null?t:i;return delete a[r],`${r}=${o}`})??[],s=function(e,t=`&`){let n,r,i=[];return H(e,function(e,t){A(e)||A(t)||t===`undefined`||(n=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),r=encodeURIComponent(t),i[i.length]=r+`=`+n)}),i.join(t)}(a);return s&&o.push(s),o.length>0?`${r}?${o.join(`&`)}`:r},fc=e=>{if(e.tl)return e.tl;let{data:t,compression:n}=e;if(!t)return;if(n===hs.GZipJS){let e=ic(function(e){var t=e.length;if(typeof TextEncoder<`u`)return new TextEncoder().encode(e);for(var n=new Os(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 Os(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 Gs(n,0,r)}(Fo(t)),{mtime:0});return{contentType:sc,body:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength),estimatedSize:e.byteLength}}if(n===hs.Base64){let e=(e=>`data=`+encodeURIComponent(typeof e==`string`?e:Fo(e)))(function(e){return e&&btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(e,t)=>
1String.fromCharCode(parseInt(t,16))))}(Fo(t)));return{contentType:`application/x-www-form-urlencoded`,body:e,estimatedSize:new Blob([e]).size}}let r=Fo(t);return{contentType:`application/json`,body:r,estimatedSize:new Blob([r]).size}},pc=e=>{let t=()=>e.transport===`sendBeacon`?{url:dc(e.url,{compression:hs.Base64}),encodedBody:fc(L(L({},e),{},{compression:hs.Base64,tl:void 0}))}:{url:uc(e.url,`compression`),encodedBody:fc(L(L({},e),{},{compression:void 0,tl:void 0}))},n;try{n=fc(e)}catch(n){if(Fn(e.compression,Lo(e.url,`compression`)))return R.error(`Failed to gzip request body, sending uncompressed payload`,n),t();throw n}return n&&Fn(e.compression,Lo(e.url,`compression`))&&!((r=n.body)instanceof ArrayBuffer?Pn(new Uint8Array(r)):ArrayBuffer.isView(r)&&Pn(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)))?(lc=!0,t()):{url:e.url,encodedBody:n};var r},mc=e=>{try{return pc(e)}catch(n){var t;R.error(n),(t=e.callback)==null||t.call(e,{statusCode:0,error:n});return}},hc=function(){var e=I(function*(e){let t=yield function(e){return Vn.apply(this,arguments)}(Fo(e.data),B.DEBUG,{rethrow:!0});if(!t)return e;let n=yield t.arrayBuffer();return L(L({},e),{},{tl:{contentType:sc,body:n,estimatedSize:n.byteLength}})});return function(t){return e.apply(this,arguments)}}(),gc=/Failed to fetch|NetworkError|Load failed/i,_c=e=>e?.name===`TypeError`&&gc.test(e?.message||``),vc=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,Et):void 0}(e());return A(t)?void 0:Math.min(t,3e4)}catch{return}},yc=e=>{let t=mc(e);if(!t)return;let n=new c;oc.set(n,!0);let{url:r,encodedBody:i}=t;n.open(e.method||`GET`,r,!0);let{contentType:a,body:o}=i??{};H(e.headers,function(e,t){n.setRequestHeader(t,e)}),a&&n.setRequestHeader(`Content-Type`,a),e.timeout&&(n.timeout=e.timeout),n.onreadystatechange=()=>{if(n.readyState===4){var t;let r={statusCode:n.status,text:n.responseText};if(n.status===200)try{r.json=JSON.parse(n.responseText)}catch{}(t=e.callback)==null||t.call(e,r,vc(()=>n.getResponseHeader(`Retry-After`)))}},n.send(o)},bc=e=>{let t=mc(e);if(!t)return;let{url:n,encodedBody:r}=t,{contentType:i,body:a,estimatedSize:o}=r??{},c=new Headers;H(e.headers,function(e,t){c.append(t,e)}),i&&c.append(`Content-Type`,i);let u=null,d=!1;if(l){let t=new l;u={signal:t.signal,timeout:setTimeout(()=>{d=!0;try{t.abort(At(`AbortError`,`PostHog request timed out`+((n=e.timeout)?` after ${n}ms`:``)))}catch(e){p(e)}var n},e.timeout)}}let f=!1,p=t=>{var n;f||(f=!0,d&&t?.name===`AbortError`||_c(t)?R.warn(t):R.error(t),(n=e.callback)==null||n.call(e,{statusCode:0,error:t}))},m=0,h=()=>{cc-=m,m=0,u&&clearTimeout(u.timeout)};try{let t=L({method:e?.method||`GET`,headers:c,referrerPolicy:`strict-origin`,body:a,signal:u?.signal},e.fetchOptions),r=o??(A(a)?0:void 0);t.keepalive=t.method===`POST`&&!e.el&&!1!==t.keepalive&&t.body===a&&!A(r)&&r>=0&&52428.8>cc+r,t.keepalive&&(m=r,cc+=m),s(n,t).then(t=>t.text().then(n=>{var r;if(f)return;let i={statusCode:t.status,text:n};if(t.status===200)try{i.json=JSON.parse(n)}catch(e){R.error(e)}f=!0,h(),(r=e.callback)==null||r.call(e,i,vc(()=>t.headers.get(`Retry-After`)))})).catch(e=>{h(),p(e)}).finally(h)}catch(e){h(),p(e)}},xc=e=>{try{let{url:t,encodedBody:n}=pc(e),{contentType:r,body:a,estimatedSize:o}=n??{};if(!a)return;let c=a instanceof Blob?a:new Blob([a],{type:r});if(i.sendBeacon(t,c))return;let l=E(e.data)?e.data:e.data?.batch;if(E(l)&&l.length>1&&(o??0)>16384){let t=Math.ceil(l.length/2),n=t=>E(e.data)?t:L(L({},e.data),{},{batch:t});xc(L(L({},e),{},{data:n(l.slice(0,t))})),xc(L(L({},e),{},{data:n(l.slice(t))}));return}R.warn(`Beacon of ~${o??0} bytes was rejected by the browser, falling back to ${s?`fetch`:`XHR`}`),s?bc(L(L({},e),{},{el:!0})):yc(e)}catch(e){R.warn(`Beacon send failed`,e)}},Sc=(e,t,n,r)=>{let i=r===`query`?t===`POST`?`sent_at`:`_`:void 0;return dc(n===hs.GZipJS?uc(e,`compression`):e,L(L({},i?{[i]:Date.now().toString()}:{}),n===hs.GZipJS?{}:{compression:n}))},Cc=(()=>{let e=[];return s&&e.push({transport:`fetch`,method:bc}),c&&e.push({transport:`XHR`,method:yc}),i!=null&&i.sendBeacon&&e.push({transport:`sendBeacon`,method:xc}),e})(),wc=!ac&&d?.indexOf(`MSIE`)===-1&&d?.indexOf(`Mozilla`)===-1;function Tc(e,t,n){var r,i;n&&(t=L(L({},t),{},{callback:e=>n(e)})),e.__loaded?wc?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=L(L({},e.config.request_headers),t.headers),t.compression=t.compression===`best-available`?e.compression??t.compressionFallback:t.compression,(A(e.config.disable_beacon)?e.config.__preview_disable_beacon:e.config.disable_beacon)&&(t.disableTransport=[`sendBeacon`]),t.fetchOptions=t.fetchOptions||e.config.fetch_options,
1((e,t)=>{let n=L(L({},e),{},{callback:t??(t=>e.callback?.call(e,t))});n.timeout=n.timeout||6e4;let r=n.transport??`fetch`;r===`sendBeacon`&&A(n.compression)&&n.data&&(n.compression=hs.Base64),n.method===`POST`&&n.data&&(n.timestampMode===`capture-body`?n.data=(e=>{var t;let n=(E(e)?e:[e]).map(e=>L(L({},e),e.timestamp instanceof Date&&!isNaN(e.timestamp.getTime())?{timestamp:e.timestamp.toISOString()}:{})),r=n[0];return{api_key:(r==null||(t=r.properties)==null?void 0:t.token)??r?.token,batch:n,sent_at:new Date().toISOString()}})(n.data):n.timestampMode===`body`&&(n.data=((e,t=new Date().toISOString())=>E(e)?e.map(e=>L(L({},e),{},{sent_at:t})):L(L({},e),{},{sent_at:t}))(n.data))),n.url=Sc(n.url,n.method,n.compression,n.timestampMode);let i=Cc.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;_c(e)?R.warn(e):R.error(e),(t=n.callback)==null||t.call(n,{statusCode:0,error:e})}};r!==`sendBeacon`&&!n.preferSyncCompression&&n.data&&n.compression===hs.GZipJS&&u&&typeof Promise<`u`&&!lc?hc(n).then(e=>{o(e)}).catch(t=>{if(In(t))return lc=!0,void o(L(L({},n),{},{compression:void 0,url:Sc(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 In(e)||t===Nn})(t)&&(lc=!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 Ec=class{constructor(e,t){this.il=!0,this.nl=[],this.sl=_e(t?.flush_interval_ms||3e3,250,5e3,R.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){R.error(e)}}ll(){clearTimeout(this.ol),this.ol=void 0}ul(){let e={};return H(this.nl,t=>{var n;let r=t,i=((r?r.batchKey:null)||r.url)+(r.batchGroup?`:${r.batchGroup}`:``);A(e[i])&&(e[i]=L(L({},r),{},{data:[]})),(n=e[i].data)==null||n.push(r.data)}),this.nl=[],e}},Dc=[`retriesPerformedSoFar`],Oc=class{constructor(e){this._instance=e,this.cl=!1,this.dl=3e3,this.nl=[],this.nl=[],this.vl=!0,this.resume()}resume(){if(!A(n)&&`onLine`in n.navigator){if(this.vl=n.navigator.onLine,this.fl)return;this.fl=()=>{this.vl=!0,this.pl()},this.gl=()=>{this.vl=!1},W(n,`online`,this.fl),W(n,`offline`,this.gl)}}get length(){return this.nl.length}retriableRequest(e,t){let{retriesPerformedSoFar:n}=e,r=Hn(e,Dc);re(n)&&(r.url=dc(r.url,{retry_count:n})),Tc(this._instance,t?L(L({},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(L({retriesPerformedSoFar:n},r),t);e.statusCode===0&&R.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)`),R.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,A(n)||(this.fl&&=(n.removeEventListener(`online`,this.fl),void 0),this.gl&&=(n.removeEventListener(`offline`,this.gl),void 0));for(let{requestOptions:e}of this.nl)try{this._instance._send_request(L(L({},e),{},{transport:`sendBeacon`}))}catch(e){R.error(e)}this.nl=[]}},kc=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(){W(n,`scroll`,this.bl,{capture:!0}),W(n,`scrollend`,this.bl,{capture:!0}),W(n,`resize`,this.bl)}scrollElement(){if(this.wl){let t=E(this.wl)?this.wl:[this.wl];for(let r of t){var e;let t=n==null||(e=n.document)==null?void 0:e.querySelector(r);if(t)return t}return}var t;return n==null||(t=n.document)==null?void 0:t.documentElement}kl(e){var t,r;let i=e===`y`?`scrollTop`:`scrollLeft`;if(this.wl){let e=this.scrollElement();return e&&e[i]||0}return n?e===`y`?n.scrollY||n.pageYOffset||((t=n.document)==null||(t=t.documentElement)==null?void 0:t.scrollTop)||0:n.scrollX||n.pageXOffset||((r=n.document)==null||(r=r.documentElement)==null?void 0:r.scrollLeft)||0:0}
1scrollY(){return this.kl(`y`)}scrollX(){return this.kl(`x`)}},Ac=e=>$o(e?.config.mask_personal_data_properties,e?.config.custom_personal_data_properties,e?.config.disable_capture_url_hashes),jc=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({[Di]:n})},this._instance=e,this.$l=t,this.Cl=n,this.xl=r||Ac,this.$l.onSessionId(this.Be)}Sl(){return this.Cl.props[Di]}getSetOnceProps(){let e=this.Sl()?.props;return e?`r`in e?es(e,this._instance.config.disable_capture_url_hashes):{$referring_domain:e.referringDomain,$pathname:e.initialPathName,utm_source:e.utm_source,utm_campaign:e.utm_campaign,utm_medium:e.utm_medium,utm_content:e.utm_content,utm_term:e.utm_term}:{}}getSessionProps(){let e={};return H(oa(this.getSetOnceProps()),(t,n)=>{n===`$current_url`&&(n=`url`),e[`$session_entry_${C(n)}`]=t}),e}},Mc=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={}}},Nc=z(`[SessionId]`),Pc=864e5,Fc=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 Mc,this.Fl=(e,t)=>!(!re(e)||!re(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||_a,this.Ll=n||_a;let i=this.Ir.persistence_name||this.Ir.token;if(this._sessionTimeoutMs=1e3*_e(this.Ir.session_idle_timeout_seconds||1800,60,36e3,Nc.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=q.Dt(this.ql),t=q.Dt(this.jl);e&&!t?this.He=e:q.Lt(this.ql),q.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 A(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&&q.Et()}zl(e){e!==this.He&&(this.He=e,this.Bl()&&q.At(this.ql,e))}Ul(){return this.He?this.He:this.Bl()?q.Dt(this.ql):null}Wl(e){let t=this.Ml;return!M(t)&&!M(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({[Kr]:[t,e,n]}))}Gl(){let e=this.Ir?.persistence_save_debounce_ms;return re(e)&&e>0}Zl(){this.Gl()?this.Cl.refreshKey(Kr):(this.Cl.flush(),this.Cl.load())}Ql(){if(M(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({[Kr]:[this._sessionActivityTimestamp,this.Xt??null,this._sessionStartTimestamp]}),this.Cl.flush())}Kl(){let[e]=this.Jl(),t=re(e)?e:0,n=re(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[Kr];return E(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 Nc.error(`Bootstrap sessionID cannot be in the future`):n}catch(e){Nc.error(`Invalid sessionID in bootstrap`,e);return}})(e);return!A(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&&n&&(n.removeEventListener(Qi,this.Rl,{capture:!1}),this.Rl=void 0),this.Pl=[]}Hl(){this.Rl=()=>{this.Ql(),this.Bl()&&q.Lt(this.jl)},W(n,Qi,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(M(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=!A(i)&&s!==i,u=this.Kl(),d=this.Ul(),f=this.Ol,p=!!f&&(f.sessionStartTimestamp>r+6e4||r-f.sessionStartTimestamp>Pc),m=f?p:re(c)&&Math.abs(r-c)>Pc,h=!1,g=l,_=!s||!!f,v=s,y=!_&&!e&&this.Fl(r,u);if(y&&(y=this.Xl(r),y||Nc.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(),Nc.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&&(Nc.info(`adopted cross-tab session id`,{sessionId:s,windowId:d}),h=!0);let b=re(u)&&e&&!m?u:r,x=re(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))}},Ic=function(e,t){if(!e)return!1;let n=e.userAgent;if(n&&ge(n,t))return!0;try{let n=e?.userAgentData;if(n?.brands&&n.brands.some(e=>ge(e?.brand,t)))return!0}catch{}return!!e.webdriver};function Lc(){return(Lc=I(function*(){let e=i?.userAgentData;if(e?.getHighEntropyValues)try{let t=(yield e.getHighEntropyValues([`model`]))?.model;return j(t)&&t.length>0?t:void 0}catch(e){R.info(`Unable to resolve $device_model from userAgentData.getHighEntropyValues`,e);return}})).apply(this,arguments)}function Rc(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 zc(e){var t;return!!((t=e.conditions)!=null&&(t=t.events)!=null&&(t=t.values)!=null&&t.length)}var Bc=(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}},Vc=e=>e.toLowerCase(),Hc={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=>Bc(t,e))),not_regex:(e,t)=>t.every(t=>e.every(e=>!Bc(t,e))),icontains:(e,t)=>t.map(Vc).some(t=>e.map(Vc).some(e=>t.includes(e))),not_icontains:(e,t)=>t.map(Vc).every(t=>e.map(Vc).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 Uc(e,t){return!e||Object.entries(e).every(([e,n])=>{let r=t?.[e];if(r==null)return!1;let i=Hc[n.operator];return!!i&&i(n.values.map(String),[String(r)])})}function Wc(e,t,n){return Fo({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}var Gc=`custom`,Kc=`i.posthog.com`,qc=/^\/static\//,Jc=[`/s/`,`/e/`,`/i/`],Yc=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(`.${Kc}`,`.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`:Gc),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=Io(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=Io(n)?.href||n;r=i(new URL(e)).toString()}if(i&&e===`api`&&Jc.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===Gc)return this.nu(e,t,this.apiHost+t);let n=Kc+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}`)}}},$=z(`[Surveys]`),Xc=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)}},Zc=[_s.Popover,_s.Widget,_s.API],Qc={ignoreConditions:!1,ignoreDelay:!1,displayType:bs.Popover}
1,$c=z(`[PostHog ExternalIntegrations]`),el={intercom:`intercom-integration`,crispChat:`crisp-chat-integration`},tl=class{constructor(e){this._instance=e}qo(e,t){var n,r;(n=m.__PosthogExtensions__)==null||(r=n.loadExternalDependency)==null||r.call(n,this._instance,e,e=>{if(e)return $c.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=m.__PosthogExtensions__)!=null&&(e=e.integrations)!=null&&e[r])&&this.qo(el[r],()=>{var e;(e=m.__PosthogExtensions__)==null||(e=e.integrations)==null||(e=e[r])==null||e.start(this._instance)}),!i&&(t=m.__PosthogExtensions__)!=null&&(t=t.integrations)!=null&&t[r]&&((n=m.__PosthogExtensions__)==null||(n=n.integrations)==null||(n=n[r])==null||n.stop())}}},nl=class{constructor(e,t){this.$=e,this.mo=t,this.ru=new Map,this.xo=!1}add(e){var t=this;return I(function*(){if(t.xo)throw Error(`Cannot add an extension to a disposed ExtensionRuntime`);if(t.ru.has(e.name))throw Error(`Browser extension "${e.name}" is already registered`);t.ru.set(e.name,e);try{let n=e.setup(t.mo);n&&(yield n)}catch(n){let r=t.ru.get(e.name)===e;r&&t.ru.delete(e.name),t.$.error(`Failed to set up browser extension "${e.name}"`,n),r&&t.ou(e)}})()}getExtension(e){return this.ru.get(e)}dispose(){if(this.xo)return;this.xo=!0;let e=Array.from(this.ru.values()).reverse();this.ru.clear();for(let t of e)this.ou(t)}ou(e){try{let t=e.dispose?.call(e);t&&D(t.then)&&t.then(void 0,t=>{this.$.error(`Failed to dispose browser extension "${e.name}"`,t)})}catch(t){this.$.error(`Failed to dispose browser extension "${e.name}"`,t)}}},rl=class{constructor(e){this._instance=e}initialize(){}get(e){let t=this._instance.persistence;if(typeof e==`string`)return t?.get_property(e);let n={};for(let r of e){let e=t?.get_property(r);A(e)||(n[r]=e)}return n}set(e,t){var n;(n=this._instance.persistence)==null||n.register(typeof e==`string`?{[e]:t}:e)}remove(e){var t;(t=this._instance.persistence)==null||t.unregister(e)}},il=`extensionsRemoteConfig`,al=class{constructor(e){this.instance=e,this.xo=!1,this.$=R,this.au=e.lu,this.kv=new rl(e),this.onEvent=e=>xs(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 xs(()=>{});let t=t=>{try{e(t)}catch(e){this.$.error(`Browser extension remote config listener failed`,e)}},n=this.instance.uu.on(il,t);return this.au&&t(this.au),xs(n)},this.hu=new nl(R.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(br);return typeof e==`string`?e:void 0}get library(){return{name:B.LIB_NAME,version:B.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 xs(this.instance.cu(e))}handleRemoteConfig(e){this.xo||(this.au=e,this.instance.uu.emit(il,e))}sendRequest(e){var t=this;return I(function*(e,n={}){let r=t.instance.requestRouter.endpointFor(n.target??`api`,e),i={method:n.method,url:n.query?dc(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`?v.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())}},ol={},sl=0,cl=()=>{}
1,ll=`Consent opt in/out is not valid with cookieless_mode="always" and will be ignored`,ul=`Surveys module not available`,dl=`sanitize_properties is deprecated. Use before_send instead`,fl=`Invalid value for property_denylist config: `,pl=/^[A-Za-z0-9_-]{1,400}$/,ml=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,hl=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,gl=[`token`,`distinct_id`,Pi],_l=`posthog`,vl=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},yl=e=>{var t;return L({api_host:`https://us.i.posthog.com`,flags_api_host:null,ui_host:null,asset_host:null,token:``,autocapture:!0,cross_subdomain_cookie:la(a?.location),persistence:`localStorage+cookie`,persistence_name:``,cookie_persisted_properties:[],loaded:cl,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:o&&j(o?.search)&&o.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:(n==null||(t=n.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){R.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:Xi,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:cl},(e=>({rageclick:e&&e>=`2026-05-30`?{content_ignorelist:eo,ignore_text_selection:!0}
1:!e||`2025-11-30`>e||{content_ignorelist:!0},capture_pageview:!e||`2025-05-24`>e||`history_change`,session_recording:vl(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))},bl=[[`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`]],xl=e=>{let t={};for(let[n,r]of bl)A(e[n])||(t[r]=e[n]);let n=U({},t,e),r=e.__preview_external_dependency_versioned_paths;return A(r)||(A(e.strict_script_versioning)&&(n.strict_script_versioning=!!r),j(r)&&A(e.asset_host)&&(n.asset_host=r)),E(e.property_blacklist)&&(A(e.property_denylist)?n.property_denylist=e.property_blacklist:E(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:R.error(fl+e.property_denylist)),n},Sl=class{constructor(){this.__forceAllowLocalhost=!1}get du(){return this.__forceAllowLocalhost}set du(e){R.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},Cl=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(_a());this.register({distinct_id:t,$device_id:t}),e.set_property(V,Ji)}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 Sl,this.xu=!1,this.version=B.LIB_VERSION,this.Cu=new Set,this.$u=``,this.uu=new Mc,this.ru=[],this.Tu=[],this.yu=!1,this.mu=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=yl(),this.SentryIntegration=Ao,this.sentryIntegration=e=>function(e,t){let n=ko(e,t);return{name:Oo,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 kc(this),this.pageViewManager=new jo(this),this.rateLimiter=new Ts(this),this.requestRouter=new Yc(this),this.consent=new Ia(this),this.externalIntegrations=new tl
1(this);let t=e.__defaultExtensionClasses??{};this.featureFlags=t.featureFlags&&new t.featureFlags(this),this.toolbar=t.toolbar&&new t.toolbar(this),this.surveys=t.surveys&&new t.surveys(this),this.conversations=t.conversations&&new t.conversations(this),this.logs=t.logs&&new t.logs(this),this.metrics=t.metrics&&new t.metrics(this),this.experiments=t.experiments&&new t.experiments(this),this.exceptions=t.exceptions&&new t.exceptions(this),this.people={set:(e,t,n)=>{let r=j(e)?{[e]:t}:e;this.setPersonProperties(r),n?.({})},set_once:(e,t,n)=>{let r=j(e)?{[e]:t}:e;this.setPersonProperties(void 0,r),n?.({})}},this.on(`eventCaptured`,e=>R.info(`send "${e?.event}"`,e))}init(t,n,r){if(r&&r!==_l){let i=ol[r]??new e;return i._init(t,n,r),ol[r]=i,ol[_l][r]=i,i}return this._init(t,n,r)}_init(e,t={},r){var i;let a=j(e)?e.trim():``;if(!a)return R.critical(`PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()`),this;if(this.__loaded)return a===this.config?.token?console.warn(`[PostHog.js]`,`You have already initialized PostHog! Re-initializing is a no-op`):console.warn(`[PostHog.js]`,`You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('${a}', { ... }, 'project2')`),this;this.__loaded=!0,this.config=yl(t.defaults),t.debug=this.Ru(t.debug),this.Au=t,this.Fu=[],t.person_profiles?this.Eu=t.person_profiles:t.process_person&&(this.Eu=t.process_person);let o=yl(t.defaults),s=xl(t),c=U({},o,s,{name:r,token:a});O(o.rageclick)&&O(s.rageclick)&&(c.rageclick=U({},o.rageclick,s.rageclick)),O(o.session_recording)&&O(s.session_recording)&&(c.session_recording=U({},o.session_recording,s.session_recording)),this.set_config(c),this.config.on_xhr_error&&R.error(`on_xhr_error is deprecated. Use on_request_error instead`),this.compression=t.disable_compression?void 0:hs.GZipJS;let l=this._u();if(this.persistence=new ms(this.config,l),this.sessionPersistence=this.config.persistence===`sessionStorage`||this.config.persistence===`memory`?this.persistence:new ms(L(L({},this.config),{},{persistence:`sessionStorage`}),l,!1),this.$u=`ph_`+(this.config.persistence_name||this.config.token)+`_session_registered_properties`,this.config.persistence!==`memory`&&!l&&q.Et()){let e=q.Dt(this.$u);E(e)&&e.forEach(e=>{j(e)&&this.Cu.add(e)})}else q.Lt(this.$u);let u=L({},this.persistence.props),d=L({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Ou=new Ec((e,t)=>this.Du(e,t),this.config.request_queue_config),this.Lu=new Oc(this),this.__request_queue=[];let f=this.pu();f||(this.sessionManager=new Fc(this),this.sessionPropsManager=new jc(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?(R.info(`Deferring extension initialization to improve startup performance`),setTimeout(()=>{this.ju(f)},0)):(R.info(`Initializing extensions synchronously`),this.ju(f)),B.DEBUG=B.DEBUG||this.config.debug,B.DEBUG&&R.info(`Starting in debug mode`,{this:this,config:t,thisC:L({},this.config),p:u,s:d}),this.config.identity_distinct_id&&!((i=t.bootstrap)!=null&&i.distinctID)&&(t.bootstrap=L(L({},t.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));let p=t.bootstrap?.distinctID;if(this.yu=!!p&&!ne(p),t.bootstrap?.distinctID){let e=t.bootstrap.distinctID,n=this.get_distinct_id(),r=this.persistence.get_property(V);if(t.bootstrap.isIdentifiedID&&n!=null&&n!==e&&r===`anonymous`)this.identify(e);else if(t.bootstrap.isIdentifiedID&&n!=null&&n!==e&&r===`identified`)R.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(_a()),r=t.bootstrap.isIdentifiedID?n:e;this.persistence.set_property(V,t.bootstrap.isIdentifiedID?Yi:Ji),this.register({distinct_id:e,$device_id:r})}}if(f)this.register_once({distinct_id:Ni,$device_id:null},``);else if(!this.get_distinct_id()){let e=this.config.get_device_id(_a());this.register_once({distinct_id:e,$device_id:e},``),this.persistence.set_property(V,Ji)}return W(n,`onpagehide`in self?`pagehide`:`unload`,this._handle_unload.bind(this),{passive:!1}),W(n,`pageshow`,()=>{var e;this.ku=!1,this.Su||(e=this.Lu)==null||e.resume()}),t.segment?Do(this,()=>this.Bu()):this.Bu(),D(this.config._onCapture)&&this.config._onCapture!==cl&&(R.warn("onCapture is deprecated. Please use `before_send` instead"),this.on(`eventCaptured`,e=>this.config._onCapture(e.event,e))),this.config.ip&&R.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 Lc.apply(this,arguments)}().then(e=>{e&&this.register({[xr]:e})}).catch(cl),this}Hu(e){let t=e;return j(t.name)&&D(t.setup)}zu(e,t){this.Hu(e)?t.push(()=>{this.Uu().add(e).catch(()=>
1e.dispose?.call(e)).catch(t=>{R.error(`Failed to dispose browser extension "${e.name}"`,t)})}):this.ru.push(e)}qu(){let t=this.config.__extensionClasses?.featureFlags??e.__defaultExtensionClasses?.featureFlags;var n,r,i;t&&(this.featureFlags&&this.featureFlags instanceof t||((n=this.Wu)==null||n.call(this),this.Wu=void 0,this.featureFlags=new t(this)),D(this.featureFlags.onReloading)&&D(this.featureFlags.setup)?this.Wu||(this.Wu=this.featureFlags.onReloading(()=>{this.uu.emit(`featureFlagsReloading`,!0)}),this.Uu().add(this.featureFlags)):(r=(i=this.featureFlags).initialize)==null||r.call(i))}ju(t){let n=performance.now(),r=L(L({},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,wo)),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){R.error(`Error initializing extension:`,e)}}let n=Math.round(performance.now()-t);this.register_for_session({[Fi]:this.config.__preview_deferred_init_extensions?`deferred`:`synchronous`,[Ii]:n}),this.config.__preview_deferred_init_extensions&&R.info(`PostHog extensions initialized (${n}ms)`)}Xa(e){var t;if(!a||!a.body)return R.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=x(t.supportedCompression,hs.GZipJS)?hs.GZipJS:x(t.supportedCompression,hs.Base64)?hs.Base64:void 0),(n=t.analytics)!=null&&n.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint)}this.set_config({person_profiles:this.Eu?this.Eu:Xi}),(t=this.Zu)==null||t.handleRemoteConfig(e),this.ru.forEach(t=>t.onRemoteConfig?.call(t,e))}Bu(){try{this.config.loaded(this)}catch(e){R.critical("`loaded` function failed",e)}if(this.Qu(),this.config.internal_or_test_user_hostname&&o?.hostname){let e=o.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 Ds(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()&&ra(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(ea),(r=this.logs)==null||r.flushLogs(`sendBeacon`),(i=this.Ou)==null||i.unload(),(a=this.Lu)==null||a.unload()):this.Xu()&&this.capture(ea,null,{transport:`sendBeacon`})}_send_request(e){Tc(this,e)}Du(e,t){this.Lu?this.Lu.retriableRequest(e,t):this._send_request(t?L(L({},e),{},{transport:t}):e)}_execute_array(e){sl++;try{let t,n=[],r=[],i=[];ra(e,e=>{if(e){if(t=e[0],E(t))i.push(e);else if(D(e))try{e.call(this)}catch(t){R.error(`Error executing queued PostHog call`,e,t)}else E(e)&&t===`alias`?n.push(e):E(e)&&t.indexOf(`capture`)!==-1&&D(this[t])?i.push(e):r.push(e)}});let a=function(e,t){ra(e,function(e){try{if(E(e[0])){let n=t;H(e,function(e){n=n[e[0]].apply(n,e.slice(1))})}else t[e[0]].apply(t,e.slice(1))}catch(t){R.error(`Error executing queued PostHog call`,e,t)}})};a(n,this),a(r,this),a(i,this)}finally{sl--}}push(t){if(sl>0&&E(t)&&j(t[0])){let n=e.prototype[t[0]];D(n)&&n.apply(this,t.slice(1));return}this._execute_array([t])}get Yu(){return{property:wr,persistenceKey:Tr,cookieName:`_fbc`,pattern:ml,register:(e,t)=>this.persistence?.register({[Tr]:{value:e,delivered:t}}),unregister:()=>this.persistence?.unregister(Tr)}}get th(){return{property:Er,persistenceKey:Dr,cookieName:`_fbp`,pattern:hl,register:(e,t)=>this.persistence?.register({[Dr]:{value:e,delivered:t}}),unregister:()=>this.persistence?.unregister(Dr)}}eh(e){let t=this.persistence?.get_property(e.persistenceKey);return j(t)&&e.pattern.test(t)?{value:t,delivered:!1}:O(t)&&j(t.value)&&e.pattern.test(t.value)?{value:t.value,delivered:!0===t.delivered}:void 0}ih(e,t,n){return t===n?.value?{value:t,pending:!n.delivered}:(e.register(t,!1),{value:t,pending:!0})}nh(e){if(!this.config.save_campaign_params||this.pu())return;let t=da(e.cookieName);return j(t)&&e.pattern.test(t)?t:void 0}sh(e,t,n,r){if(!this.persistence)return;let i=this.Yu;this.persistence.refreshKey(i.persistenceKey);let a=this.eh(i);if(r)return void i.unregister();if(n)return j(t)&&ml.test(t)?this.ih(i,t,a):void i.unregister();let o=j(e)&&pl.test(e)?e:void 0,s=this.nh(i);return s&&((e,t,n)=>{let r=e.split(`.`);if(t)return r[3]===t;if(!n)return!0;let i=n.value.split(`.`);return r[3]===i[3]||Number(r[2])>Number(i[2])})(s,o,a)?this.ih(i,s,a):o?a?.value.split(`.`)[3]===o?{value:a.value,pending:!a.delivered}:this.ih(i,`fb.1.${Date.now()}.${o}`,a):a?{value:a.value,pending:!a.delivered}:void 0}rh(e,t,n){if(!this.persistence)return;let r=this.th;this.persistence.refreshKey(r.persistenceKey);let i=this.eh(r);if(n)return void r.unregister();if(t)return j(e)&&hl.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 R.uninitializedWarning(`posthog.capture`);if(!this.is_capturing())return;if(A(e)||!j(e))return void R.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 R.critical(`This capture call is ignored due to client rate limiting.`);let a;t!=null&&t.$current_url&&!j(t?.$current_url)&&(R.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||R.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=kt(n?.uuid,_a),l={uuid:c,event:e,properties:this.calculateEventProperties(e,t||{},s,c)};e===`$pageview`&&this.config.__preview_capture_bot_pageviews&&r&&(l.event=`$bot_pageview`,l.properties.$browser_type=`bot`),i&&(l.properties.$lib_rate_limit_remaining_tokens=i.remainingTokens);let u=e===`$feature_flag_called`&&!1===l.properties.$feature_flag_has_experiment&&!0===this.get_property(`$minimal_flag_called_events`);n!=null&&n.$set&&!u&&(l.$set=n?.$set);let d=O(t?.$set)?t.$set:void 0,f=E(t?.$unset)?t.$unset:[],p=n?.$unset||[],m=e=>{var t;let r=!!n?.$set&&e in n.$set;return{hasProvided:r||!!d&&e in d,provided:r?n==null||(t=n.$set)==null?void 0:t[e]:d?.[e],unset:f.indexOf(e)!==-1||p.indexOf(e)!==-1}},h=m(wr),g=m(Er),_=[{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=L({[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!==na,e===ta);if(y&&(l.$set_once=y),n!=null&&n._noTruncate||(b=this.config.properties_string_max_length,l=function(e,t){let n=new Set;return function e(r,i){if(r!==Object(r))return t?t(r):r;if(n.has(r))return;let a;if(n.add(r),E(r))a=[],ra(r,t=>{a.push(e(t))});else{let t={};H(ce(r)?sa(r):r,(r,i)=>{n.has(r)||(t[i]=e(r,i))}),a=t}return a}(e)}(l,e=>j(e)?e.slice(0,b):e)),l.timestamp=s,A(n?.timestamp)||(l.properties.$event_time_override_provided=!0,l.properties.$event_time_override_system_time=o),u&&(l.properties=((e,t=[])=>{let n={},r=t=>{e[t]!==void 0&&(n[t]=e[t])};return Mn.forEach(r),t.forEach(r),n})(l.properties,gl)),e===vs.DISMISSED||e===vs.SENT){let n=t?.[ys.SURVEY_ID],r=t?.[ys.SURVEY_ITERATION];Xc({id:n,current_iteration:r}),l.$set=L(L({},l.$set),{},{[Rc({id:n,current_iteration:r},e===vs.SENT?`responded`:`dismissed`)]:!0})}else e===vs.SHOWN&&(l.$set=L(L({},l.$set),{},{[ys.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var b;if(e===Ss.SHOWN){let e=t?.[Cs.TOUR_TYPE];e&&(l.$set=L(L({},l.$set),{},{[`${Cs.TOUR_LAST_SEEN_DATE}/${e}`]:new Date().toISOString()}))}let x=L(L({},l.properties.$set),l.$set);if(k(x)||this.setPersonPropertiesForFlags(x),!N(this.config.before_send)){let e=this.Os(l);if(!e)return;l=e,l.uuid=kt(l.uuid,_a)}let S=_.filter(({channel:e,update:t})=>{let n=l.$set?.[e.property]??(O(l.properties?.$set)?l.properties.$set[e.property]:void 0);return t?.pending&&n===t.value});this.uu.emit(`eventCaptured`,l);let C=n?._url??this.requestRouter.endpointFor(`api`,this.analyticsDefaultEndpoint),w=n?._batchKey===`recordings`||/\/s\/(?:\?|$)/.test(C),ee=L(L(L({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}`:``)}
1:{}),n?.transport?{transport:n.transport}:{}),S.length?{fireCallbackOnDrop:!0,callback:e=>{if(e.statusCode>=200&&300>e.statusCode)for(let{channel:e,update:t}of S)this.oh(e,t.value)}}:{});if(!this.config.request_batching||n&&!n?._batchKey||n?.send_instantly||S.length){let e;!ee.transport&&!ee.callback&&k(this.config.request_headers??{})&&this.ku&&(e=`sendBeacon`),this.Du(ee,e)}else this.Ou.enqueue(ee);return l}_addCaptureHook(e){return this.on(`eventCaptured`,t=>e(t.event,t))}getExtension(e){return this.Zu?.getExtension(e)}Uu(){return this.Zu??=new al(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,r,i,s){if(r||=new Date,!this.persistence||!this.sessionPersistence)return t;this.persistence.syncCookieProperties(),this.hh();let c=s?void 0:this.persistence.remove_event_timer(e),l=L({},t);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,this.pu()&&(l[Pi]=!0),e===`$snapshot`){let e=L(L({},this.persistence.properties()),this.sessionPersistence.properties());return l.distinct_id=e.distinct_id,(!j(l.distinct_id)&&!P(l.distinct_id)||ne(l.distinct_id))&&R.error(`Invalid distinct_id for replay event. This indicates a bug in your implementation`),l}let u=function(e,t,r,i=!1){var a,s,c;if(!d)return{};let l=e?[...Ho,...t||[]]:[],[u,f]=_t(d),[p,m]=function(e){for(let t=0;xt.length>t;t++){let[n,r,i]=xt[t],a=e.match(n);if(a)return[r,(i&&e.match(i)||a)?.[1]||``]}return[``,``]}(d),h=function(){return(`u`>typeof navigator?navigator:void 0)?.brave?{brave:!0}:{}}(),_={};A(r)||(_.detectGoogleSearchApp=r);let v={},y=(a=navigator)==null||(a=a.userAgentData)==null?void 0:a.platform,b=navigator?.maxTouchPoints,x=n==null||(s=n.screen)==null?void 0:s.width,S=n==null||(c=n.screen)==null?void 0:c.height,C=n?.devicePixelRatio;A(y)||(v.userAgentDataPlatform=y),A(b)||(v.maxTouchPoints=b),A(x)||(v.screenWidth=x),A(S)||(v.screenHeight=S),A(C)||(v.devicePixelRatio=C);let w=U(oa({$os:u,$os_version:f,$browser:pt(d,navigator.vendor,h,_),$webview_app:p,$webview_app_version:m,$device:vt(d),$device_type:yt(d,v),$timezone:ts(),$timezone_offset:ns()}),{$current_url:Ro(i?jt(o?.href):o?.href,l,Wo),$host:o?.host,$pathname:o?.pathname,$raw_user_agent:d.length>1e3?d.substring(0,997)+`...`:d,$browser_version:ht(d,navigator.vendor,h,_),$browser_language:Yo(),$browser_language_prefix:Xo(),$screen_height:n?.screen.height,$screen_width:n?.screen.width,$viewport_height:n?.innerHeight,$viewport_width:n?.innerWidth,$lib:g.LIB_NAME,$lib_version:g.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return g.SDK_DIST_CHANNEL&&(w.$sdk_dist_channel=g.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);if(this.sessionManager){let{sessionId:e,windowId:t}=this.sessionManager.checkAndGetSessionAndWindowId(s,r.getTime(),!0);l.$session_id=e,l.$window_id=t}this.sessionPropsManager&&U(l,this.sessionPropsManager.getSessionProps());try{this.sessionRecording&&U(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=this.Lu?.length}catch(e){l.$sdk_debug_error_capturing_properties=String(e)}let f;if(this.requestRouter.region===Gc&&(l.$lib_custom_api_host=this.config.api_host),f=e!==`$pageview`||s?e!==`$pageleave`||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,i),l=U(l,f),e===`$pageview`&&a&&(l.title=a.title),!A(c)){let e=r.getTime()-c;l.$duration=parseFloat((e/1e3).toFixed(3))}d&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?`bot`:`browser`);let p=this.persistence.properties(),m=this.sessionPersistence.properties(),h=l.$groups,_=p.$groups;O(h)&&!k(h)&&(l.$groups=L(L({},O(_)?_:{}),h)),H([`$referrer`,`$referring_domain`],e=>{e in p&&delete m[e]});let v={};if(this.Tu.length>0)for(let e of this.Tu.slice())try{U(v,e())}catch(e){R.error(`Failed to produce browser extension event properties`,e)}l=U({},u,p,m,L(L({},v),l)),l.$is_identified=this._isIdentified(),E(this.config.property_denylist)?H(this.config.property_denylist,function(e){delete l[e]}):R.error(fl+this.config.property_denylist+` or property_blacklist config: `+this.config.property_blacklist);let y=this.config.sanitize_properties;y&&(R.error(dl),l=y(l,e));let b=this.fh();return l.$process_person_profile=b,b&&!s&&this.ph(`_calculate_event_properties`),l}uh(e,t=!0,n=!1){if(!this.persistence||!this.fh()||this.xu&&!n)return e;let r=this.persistence.get_initial_props(),i=this.sessionPropsManager?.getSetOnceProps(),a=U({},r,i||{},e||{}),o=this.config.sanitize_properties;return o&&(R.error(dl),a=o(a,`$set_once`)),t&&(this.xu=!0),k(a)?void 0:a}register(e,t){var n;(n=this.persistence)==null||n.register(e,t)}register_once(e,t,n){var r;(r=this.persistence)==null||r.register_once(e,t,n)}register_for_session(e){var t,n;(t=this.persistence)==null||t.syncCookieProperties(),this.hh(),(n=this.sessionPersistence)==null||n.register(e),Object.keys(e).forEach(e
1=>this.Cu.add(e)),this.dh()}unregister(e){var t;(t=this.persistence)==null||t.unregister(e)}unregister_for_session(e){var t;(t=this.sessionPersistence)==null||t.unregister(e),this.Cu.delete(e),this.dh()}gh(e,t){this.register({[e]:t})}Nu(){this.Cu.forEach(e=>{var t;(t=this.sessionPersistence)==null||t.unregister(e)}),this.Cu.clear(),this.dh()}dh(){if(!this.$u)return;if(this.config.persistence===`memory`||this.sessionPersistence?.mi||!q.Et())return void q.Lt(this.$u);let e=[];this.Cu.forEach(t=>e.push(t)),e.length>0?q.At(this.$u,e):q.Lt(this.$u)}getFeatureFlag(e,t){return this.featureFlags?.getFeatureFlag(e,t)}getFeatureFlagPayload(e){return this.featureFlags?.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){return this.featureFlags?.getFeatureFlagResult(e,t)}getAllFeatureFlags(){return this.featureFlags?.getAllFeatureFlags()??[]}isFeatureEnabled(e,t){return this.featureFlags?.isFeatureEnabled(e,t)??t?.defaultValue}reloadFeatureFlags(){var e;(e=this.featureFlags)==null||e.reloadFeatureFlags()}updateFlags(e,t,n){var r;(r=this.featureFlags)==null||r.updateFlags(e,t,n)}updateEarlyAccessFeatureEnrollment(e,t,n){var r;(r=this.featureFlags)==null||r.updateEarlyAccessFeatureEnrollment(e,t,n)}getEarlyAccessFeatures(e,t=!1,n){return this.featureFlags?.getEarlyAccessFeatures(e,t,n)}on(e,t){return this.uu.on(e,t)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:ul}),()=>{})}onSessionId(e){return this.sessionManager?.onSessionId(e)??(()=>{})}getSurveys(e,t=!1){this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:ul})}getActiveMatchingSurveys(e,t=!1){this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:ul})}renderSurvey(e,t){var n;(n=this.surveys)==null||n.renderSurvey(e,t)}displaySurvey(e,t=Qc){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:ul}}canRenderSurveyAsync(e,t=!1){return this.surveys?.canRenderSurveyAsync(e,t)??Promise.resolve({visible:!1,disabledReason:ul})}mh(e){return!e||ne(e)?(R.critical(`Unique user id has not been set in posthog.identify`),!1):e===`$posthog_cookieless`?(R.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())||(R.critical(`The string "${e}" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.`),!1)}identify(e,t,n){if(!this.__loaded||!this.persistence)return R.uninitializedWarning(`posthog.identify`);if(P(e)&&(e=e.toString(),R.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(Sr),this.register({distinct_id:e}));let o=(this.persistence.get_property(`$user_state`)||`anonymous`)===Ji,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(V,Yi),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=Wc(e,t,n)),(c=this.featureFlags)==null||c.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:r)}else if(u){this.persistence.set_property(V,Yi);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=Wc(e,t,n))}else(t||n)&&this.setPersonProperties(t,n);l||i||a?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(Ci)):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=Wc(this.get_distinct_id(),e,t);this.Pu===n?R.info(`A duplicate setPersonProperties call was made with the same properties. It has been ignored.`):(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture(`$set`,{$set:e||{},$set_once:t||{}})&&(this.Pu=n))}unsetPersonProperties(e){var t;let n=(E(e)?e:[e]).filter(e=>j(e)&&e.length>0);n.length!==0&&this.ph(`posthog.unsetPersonProperties`)&&((t=this.featureFlags)==null||t.unsetPersonPropertiesForFlags(n,!0),this.capture(`$set`,{$unset:n}),this.Pu=null)}group(e,t,n){var r;if(!e||!t)return void R.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:L(L({},i),{},{[e]:t})}),(a||n)&&this.fh()){let r={$group_type:e,$group_key:t};n&&(r.$group_set=n),this.capture(na,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=F(e)?e:e?.resetDeviceID,n=F(e)||e==null?void 0:e.bootstrap;this.yh(t,!1,n)}yh(e,t=!1,n){var r,i,a,o,s;if(R.info(`reset`),!this.__loaded)return R.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(br),u=this.get_property(xr),d=this.get_property(zr);(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(),A(d)||(w=this.persistence)==null||w.register({$session_recording_remote_config:d}),(_=this.surveys)==null||_.reset(),(v=this.featureFlags)==null||v.reset(),(y=this.conversations)==null||y.reset(),(b=this.logs)==null||b.reset(),(x=this.metrics)==null||x.reset(),(S=this.persistence)==null||S.set_property(`$user_state`,`anonymous`),(C=this.sessionManager)==null||C.resetSessionId(),this.Pu=null,this.config.cookieless_mode===`always`)this.register_once({distinct_id:Ni,$device_id:null},``);else{let t=this.config.get_device_id(_a());this.register_once({distinct_id:t,$device_id:e?t:l},``),e||A(u)||this.register({[xr]: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(),!N(c)&&!this.sessionManager?.setBootstrapSessionId(c,!0))){let e=L({},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 I(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){R.error(`Error while destroying feature flags`,e)}(s=t.persistence)==null||s.destroy(),(c=t.sessionPersistence)==null||c.destroy()}else R.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`)?(R.critical(`Attempting to create alias for existing People user - aborting.`),-2):this.ph(`posthog.alias`)?(A(t)&&(t=this.get_distinct_id()),e===t?(R.warn(`alias matches current distinct_id - skipping api call.`),this.identify(e),-1):(this.gh(Sr,e),this.capture(`$create_alias`,{alias:e,distinct_id:t}))):void 0}set_config(e){let t=L({},this.config);if(O(e)){var n,r,i,a,o,s,c,l,u,d,f,p,m,h;U(this.config,xl(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 ms(L(L({},this.config),{},{persistence:`sessionStorage`}),_,!1);let v=this.Ru(this.config.debug);var g;F(v)&&(this.config.debug=v),F(this.config.debug)&&(this.config.debug?(B.DEBUG=!0,K.Et()&&K.At(`ph_debug`,!0),R.info(`set_config`,{config:e,oldConfig:t,newConfig:L({},this.config)})):(B.DEBUG=!1,K.Et()&&K.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&&Do(this,cl,!1)}}_overrideSDKInfo(e,t){B.LIB_NAME=e,B.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(L(L({},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??_l;return e!==_l&&(e=`posthog.`+e),e}_isIdentified(){return this.persistence?.get_property(`$user_state`)===`identified`||this.sessionPersistence?.get_property(`$user_state`)===`identified`}fh(){var e,t;return!(this.config.person_profiles===`never`||this.config.person_profiles===`identified_only`&&!this._isIdentified()&&k(this.getGroups())&&!((e=this.persistence)!=null&&(e=e.props)!=null&&e.__alias)&&
1!((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`?(R.error(e+` was called, but process_person is set to "never". This call will be ignored.`),!1):(this.gu(),this.gh(Mi,!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 Fc(this),this.pageViewManager=new jo(this),this.persistence&&(this.sessionPropsManager=new jc(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()),(A(t?.captureEventName)||t!=null&&t.captureEventName)&&this.capture(t?.captureEventName??`$opt_in`,t?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Ju()}else R.warn(ll)}opt_out_capturing(){if(this.config.cookieless_mode===`always`)return void R.warn(ll);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:Ni,$device_id:null}),this.vu(e),this.sessionRecording=void 0,(t=this.sessionManager)==null||t.destroy(),(n=this.pageViewManager)==null||n.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.Ju(),this.Qu())}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){let e=this.consent.consent;return e===1?`granted`:e===0?`denied`:`pending`}is_capturing(){return this.config.cookieless_mode===`always`||(this.config.cookieless_mode===`on_reject`?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.wu()}_is_bot(){return i?Ic(i,this.config.custom_blocked_useragents):void 0}Ju(){a&&(a.visibilityState===`visible`?this.Iu||(this.Iu=!0,this.capture($i,{title:a.title},{send_instantly:!0}),this.Mu&&=(a.removeEventListener(Zi,this.Mu),null)):this.Mu||(this.Mu=this.Ju.bind(this),W(a,Zi,this.Mu)))}debug(e){!1===e?(n?.console.log(`You've disabled debug mode.`),this.set_config({debug:!1})):(n?.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?(R.warn(`Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version.`),!0):function(e,t,n,r,i){let a=t in e&&!N(e[t]),o=n in e&&!N(e[n]);return a?e[t]:!!o&&(i&&i.warn(`Config field '${n}' is deprecated. Please use '${t}' instead. The old field will be removed in a future major version.`),e[n])}(e,`advanced_disable_flags`,`advanced_disable_decide`,0,R):!!this.config.advanced_disable_flags}Os(e){if(N(this.config.before_send))return e;let t=Object.keys(e.properties??{}).filter(ae),n=E(this.config.before_send)?this.config.before_send:[this.config.before_send],r=e;
1for(let t of n)try{if(r=t(r),N(r)){let t=`Event '${e.event}' was rejected in beforeSend function`;return ie(e.event)?R.warn(`${t}. This can cause unexpected behavior.`):R.info(t),null}r.properties&&!k(r.properties)||R.warn(`Event '${e.event}' has no properties after beforeSend function, this is likely an error.`)}catch(t){return R.error(`Error in beforeSend function for event '${e.event}':`,t),null}for(let n of t)if(r.properties&&N(r.properties[n]))return R.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=F(e)&&!e,n=K.Et()&&K.Ot(`ph_debug`)===`true`;return!t&&(!!n||e)}};Cl.__defaultExtensionClasses={},Cl.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]]=aa(e.prototype[t[n]])}(Cl,[`identify`]);var wl=class{constructor(e){this.disabled=!1===e;let t=O(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,n){if(this.disabled)return!1;let r=this.clicks[this.clicks.length-1];if(r&&Math.abs(e-r.x)+Math.abs(t-r.y)<this.thresholdPx&&this.timeoutMs>n-r.timestamp){if(this.clicks.push({x:e,y:t,timestamp:n}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:n}];return!1}},Tl=`$copy_autocapture`,El=z(`[AutoCapture]`);function Dl(e,t){return t.length>e?t.slice(0,e)+`...`:t}function Ol(e){if(e.previousElementSibling)return e.previousElementSibling;let t=e;do t=t.previousSibling;while(t&&!za(t));return t}function kl(e,{e:t,maskAllElementAttributes:r,maskAllText:i,elementAttributeIgnoreList:a,elementsC
1hainAsString:o,disableCaptureUrlHashes:s}){if(!za(e))return{props:{}};let c=[e],l=new Set([e]),u=e;for(;u.parentNode&&!J(u,`body`)&&1e3>c.length;){if(Va(u.parentNode)){let e=u.parentNode.host;if(l.has(e))break;l.add(e),c.push(e),u=e;continue}if(!za(u.parentNode)||l.has(u.parentNode))break;l.add(u.parentNode),c.push(u.parentNode),u=u.parentNode}let d=t.type===`click`&&e.namespaceURI===`http://www.w3.org/2000/svg`?c.findIndex(e=>J(e,`button`)||J(e,`a`)):-1;d>0&&(i||=c.slice(0,d+1).some(e=>!so(e)||co(e)));let f=[],p={},m,h=!1,g=!1;if(H(c,e=>{let t=so(e);if(J(e,`a`)&&!r&&!a?.includes(`href`)){let n=e.getAttribute(`href`);h=!!(t&&n&&_o(n))&&(s?jt(n):n)}x(Wa(e),`ph-no-capture`)&&(g=!0),f.push(function(e,t,n,r,i=!1){let a=e.tagName.toLowerCase(),o={tag_name:a};Ja.indexOf(a)>-1&&!n&&(o.$el_text=a.toLowerCase()===`a`||a.toLowerCase()===`button`?Dl(1024,vo(e)):Dl(1024,Ka(e)));let s=Wa(e);t||r!=null&&r.includes(`class`)||0>=s.length||(o.classes=s.filter(function(e){return e!==``})),H(e.attributes,function(n){var a;if((!co(e)||[`name`,`id`,`class`,`aria-label`].indexOf(n.name)!==-1)&&!r?.includes(n.name)&&!t&&_o(n.value)&&(!j(a=n.name)||a.substring(0,10)!==`_ngcontent`&&a.substring(0,7)!==`_nghost`)){let e=n.value;n.name===`class`&&(e=Ha(e).join(` `)),o[`attr__`+n.name]=Dl(1024,n.name===`href`&&i?jt(e):e)}});let c=1,l=1,u=e;for(;u=Ol(u);)c++,u.tagName===e.tagName&&l++;return o.nth_child=c,o.nth_of_type=l,o}(e,r,i,a,s)),H(function(e){if(!so(e))return{};let t={};return H(e.attributes,function(e){if(e.name&&e.name.indexOf(`data-ph-capture-attribute`)===0){let n=e.name.replace(`data-ph-capture-attribute-`,``),r=e.value;n&&r&&_o(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)),i||(f[0].$el_text=J(e,`a`)||J(e,`button`)?vo(e):Ka(e)),h){var _;f[0].attr__href=h;let e=Io(h)?.host,t=n==null||(_=n.location)==null?void 0:_.host;e&&t&&e!==t&&(m=h)}return{props:U((y=t.type,{$event_type:y,$ce_version:1}),o?{}:{$elements:f},{$elements_chain:(v=f,E(v)?function(e){return e.map(e=>{let t=``;if(e.tag_name&&(t+=e.tag_name),e.attr_class){e.attr_class.sort();for(let n of e.attr_class)t+=`.${n.replace(/"/g,``)}`}let n=L(L(L(L({},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 ia(n).sort(([e],[t])=>function(e,t){return t>e?-1:+(e>t)}(e,t)).forEach(([e,t])=>r[bo(e.toString())]=bo(t.toString())),t+=`:`,t+=ia(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:xo(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return ia(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 Al=class{ho(){this.co=void 0,clearTimeout(this.do),this.do=void 0}vo(e){if(!so(e))return!0;let t=this.fo().css_selector_ignorelist??Qa,n=new Set,r=e;for(;r;){if(n.size>=1e3||n.has(r))return!0;n.add(r);let e=r,i=Wa(e);if(x(i,`ph-no-capture`)||x(i,`ph-sensitive`)||co(e)||t.some(t=>Ya(e,t)))return!0;let a=r.parentNode;r=Va(a)?a.host:a&&za(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=qa(e);e.isPrimary&&e.button===0&&!e.ctrlKey&&t&&za(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=qa(e);if(t?.released&&t.target.isConnected&&t.distinctId===this.mo?.distinctId&&e.pointerId===t.id&&(e.detail>0||e.pointerType===`touch`||e.pointerType===`pen`)&&e.button===0&&5>=Math.abs(e.clientX-t.x)&&5>=Math.abs(e.clientY-t.y)&&n&&(J(n,`html`)||J(n,`body`))){if(t.excluded)return null;let e=this.fo().css_selector_ignorelist??Qa;return[n,a?.documentElement,a?.body].some(t=>{if(!t)return!1;let n=Wa(t);return x(n,`ph-no-capture`)||x(n,`ph-sensitive`)||!so(t)||co(t)||e.some(e=>Ya(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 wl(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 El.info(`Disabling Automatic Event Collection because this browser is not supported`);if(!n||!a)return;let e=this.Eo=e=>{e||=n?.event;try{if(e.type===`blur`)return void this.ho();if(e.type.indexOf(`pointer`)===0)return void this.po(e);let t=e.type===`click`?this.yo(e):void 0;if(M(t))return;this.Po(e,`$autocapture`,t)}catch(e){El.error(`Failed to capture event`,e)}};if(W(n,`blur`,e),W(a,`submit`,e,{capture:!0}),W(a,`change`,e,{capture:!0}),W(a,`click`,e,{capture:!0}),H([`pointerdown`,`pointermove`,`pointerup`,`pointercancel`],t=>{W(a,t,e,{capture:!0})}),this.fo().capture_copied_text){let e=this.Ro=e=>{e||=n?.event;try{this.Po(e,Tl)}catch(e){El.error(`Failed to capture clipboard event`,e)}};W(a,`copy`,e,{capture:!0}),W(a,`cut`,e,{capture:!0}),W(a,`paste`,e,{capture:!0})}}Io(){this.ho(),this.Eo&&=(n?.removeEventListener(`blur`,this.Eo),H([`pointerdown`,`pointermove`,`pointerup`,`pointercancel`],e=>{a?.removeEventListener(e,this.Eo,!0)}),a?.removeEventListener(`submit`,this.Eo,!0),a?.removeEventListener(`change`,this.Eo,!0),a?.removeEventListener(`click`,this.Eo,!0),void 0),this.Ro&&=(a?.removeEventListener(`copy`,this.Ro,!0),a?.removeEventListener(`cut`,this.Ro,!0),a?.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;F(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=>{(a?.querySelectorAll(n))?.forEach(i=>{e!==i&&t!==i||x(r,n)||r.push(n)})}),r}get isEnabled(){if(this.xo)return!1;let e=this.mo?.kv.get(kr),t=this.wo,n=this.fo();if(!n.remoteRequestsDisabled&&!this.ko)return!1;let r=n.remoteRequestsDisabled&&!this.ko;if(M(t)&&!F(e)&&!r)return!1;let i=this.wo??!!e;return!!n.enabled&&!i}Po(e,t=`$autocapture`,r){if(!this.isEnabled)return void this.ho();let i=r||qa(e);Ba(i)&&(i=i.parentNode||null);let a=this.$o();var o;t===`$autocapture`&&e.type===`click`&&e instanceof MouseEvent&&a.rageclick&&(o=this.rageclicks)!=null&&o.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime())&&io(i,a.rageclick)&&this.Po(e,`$rageclick`,r);let s=t===Tl,c=s?L(L({},a),{},{dom_event_allowlist:void 0}):a;if(i&&function(e,t,r,i,a,o){if(!n||ao(e)||r?.url_allowlist&&!Ua(r.url_allowlist,o)||r?.url_ignorelist&&Ua(r.url_ignorelist,o))return!1;if(r?.dom_event_allowlist){let e=r.dom_event_allowlist;if(e&&!e.some(e=>t.type===e))return!1}let{parentIsUsefulElement:s,targetElementList:c}=oo(e,i);if(!function(e,t){let n=t?.element_allowlist;if(A(n))return!0;for(let t of e)if(n.some(e=>t.tagName.toLowerCase()===e))return!0;return!1}(c,r)||!Xa(c,r?.css_selector_allowlist)||Xa(c,r?.css_selector_ignorelist??Qa))return!1;try{let r=n.getComputedStyle(e);if(r&&r.getPropertyValue(`cursor`)===`pointer`&&t.type===`click`)return!0}catch{}let l=e.tagName.toLowerCase();switch(l){case`html`:return!1;case`form`:return(a||[`submit`]).indexOf(t.type)>=0;case`input`:case`select`:case`textarea`:return(a||[`change`,`click`]).indexOf(t.type)>=0;default:return s?(a||[`click`]).indexOf(t.type)>=0:(a||[`click`]).indexOf(t.type)>=0&&(Ja.indexOf(l)>-1||e.getAttribute(`contenteditable`)===`true`)}}(i,e,c,s,s?[`copy`,`cut`,`paste`]:void 0,{config:{get_current_url:a.getCurrentUrl}})){var l;let{props:r,explicitNoCapture:o,target:s}=kl(i,{e,maskAllElementAttributes:a.maskAllElementAttributes,maskAllText:a.maskAllText,elementAttributeIgnoreList:a.element_attribute_ignorelist,elementsChainAsString:this.So,disableCaptureUrlHashes:a.disableCaptureUrlHashes});if(o)return!1;let c=this.getElementSelectors(i,s);if(c&&c.length>0&&(r.$element_selectors=c),t===Tl){let t=e.type||`clipboard`;if(t!==`paste`){var u;let e=n==null||(u=n.getSelection())==null?void 0:u.toString(),t=Ga(e);if(!t)return!1;r.$selected_content=t,r.$clipboard_text_length=e?.length??0}r.$copy_type=t}return(l=this.mo)==null||l.capture(t,r),!0}}isBrowserSupported(){return D(a?.querySelectorAll)}},jl=class{constructor(e){this._instance=e}refresh(e){let t=this._instance.config,n=O(t.autocapture)?t.autocapture:void 0;e.enabled=!!t.autocapture,e.rageclick=t.rageclick,e.maskAllElementAttributes=t.mask_all_element_attributes,e.maskAllText=t.mask_all_text,e.disableCaptureUrlHashes=t.disable_capture_url_hashes,e.getCurrentUrl=t.get_current_url,e.remoteRequestsDisabled=this._instance.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}},Ml=z(`[ExceptionAutocapture]`),Nl=()=>{},Pl=e=>{if(D(e))return e.__posthog_layer__??e.__rrweb_layer__};function Fl(e,t,n){try{if(!(t in e))return Nl;let r={next:e[t]},i=n(function(...e){return r.next.apply(this,e)});return D(i)&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:r}})),e[t]=i,()=>{if(e[t]===i)return void(e[t]=r.next);let n=e[t],a=Pl(n);for(;a;){if(a.next===i)return void(a.next=r.next);n=a.next,a=Pl(n)}}}catch{return Nl}}var Il=z(`[TracingHeaders]`),Ll=z(`[Web Vitals]`),Rl=9e5,zl=[`CLS`,`FCP`,`INP`,`LCP`],Bl=[`INP`,`LCP`],Vl=[`interactionTarget`,`interactionType`,`inputDelay`,`processingDuration`,`presentationDelay`,`loadState`,`target`,`url`,`timeToFirstByte`,`resourceLoadDelay`,`resourceLoadDuration`,`elementRenderDelay`,`largestShiftTarget`,`largestShiftTime`,`largestShiftValue`,`firstByteToFCP`],Hl=`disabled`,Ul=`lazy_loading`,Wl=z(`[SessionRecording]`),Gl=z(`[Heatmaps]`);function Kl(e){return O(e)&&`clientX`in e&&`clientY`in e&&P(e.clientX)&&P(e.clientY)}var ql=z(`[Product Tours]`),Jl=e=>!e.config.disable_product_tours&&!!e.persistence?.get_property(Ir),Yl=[`$set_once`,`$set`],Xl=z(`[SiteApps]`),Zl=`Error while initializing PostHog app with config id `,Ql=(e,t)=>e?.then?e.then(t):t(e),$l=`SDK is not enabled or survey functionality is not yet loaded`,eu=`Disabled. Not loading surveys.`,tu=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(N(t))return $.warn(`Flags not loaded yet. Not loading surveys.`);this.Mh=F(t)?t:t.length>0,$.info(`flags response received, isSurveysEnabled: ${this.Mh}`),this.loadIfEnabled()}}setup(e){if(!this.xo)return this.Eh=e,Ql(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.dis
1pose(),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(eu);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(A(this.Mh)&&!e.advancedEnableSurveys)return;let n=this.Mh||e.advancedEnableSurveys;this.xh=!0;try{let e=t.generateSurveys;if(e)return this.Ph(e,n),void(this.xh=!1);let r=t.loadExternalDependency;if(!r)return this.Rh(qi),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(eu),e([]);let r=n.kv.get(di);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($l)}))}Dh(e,t){if(this.xo)return{surveys:[],context:{isLoaded:!1,error:$l}};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)&&(zc(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({[di]:r,[fi]:Date.now()}),{surveys:r,context:{isLoaded:!0}}}Fh(){return this.Lh()&&!this.$h&&!this.Nh()}Lh(){let e=(this.mo??this.Sh)?.kv.get(fi);return P(e)&&Date.now()-e>3e5}Nh(){return P(this.Th)&&3e5>Date.now()-this.Th}markSurveyAsSeen(e,t){Xc({id:e,current_iteration:t?.iteration??null});try{localStorage.setItem(`lastSeenSurveyDate`,new Date().toISOString())}catch{}}Ah(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(!N(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(N(this._surveyManager))return{eligible:!1,reason:$l};let t=typeof e==`string`?this.qh(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:`Survey not found`}}Bh(e){if(!this.bo.isCapturing())return{eligible:!1,reason:`PostHog is not capturing, so a survey response cannot be recorded`};if(N(this._surveyManager))return{eligible:!1,reason:$l};let t=typeof e==`string`?this.qh(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:`Survey not found`}}canRenderSurvey(e){if(N(this._surveyManager))return $.warn(`init was not called`),{visible:!1,disabledReason:$l};let t=this.Bh(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return N(this._surveyManager)?($.warn(`init was not called`),Promise.resolve({visible:!1,disabledReason:$l})):new Promise(n=>
1{this.getSurveys(t=>{let r=t.find(t=>t.id===e)??null;if(r){let e=this.Bh(r);n({visible:e.eligible,disabledReason:e.reason})}else n({visible:!1,disabledReason:`Survey not found`})},t)})}renderSurvey(e,t,n){if(!this.bo.isCapturing())return;if(N(this._surveyManager))return void $.warn(`init was not called`);let r=typeof e==`string`?this.qh(e):e;if(!r?.id)return void $.warn(`Survey not found`);if(!Zc.includes(r.type))return void $.warn(`Surveys of type ${r.type} cannot be rendered in the app`);let i=a?.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(N(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=L(L({},r),{},{appearance:L(L({},r.appearance),{},{surveyPopupDelaySeconds:0})})),t.displayType!==bs.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===bs.Inline?this.renderSurvey(i,t.selector,t.properties):this._surveyManager.handlePopoverSurvey(i,t)}cancelPendingSurvey(e){N(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 nu(e,t,n){if(N(e))return!1;switch(n){case`exact`:return e===t;case`contains`:{let n=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`).replace(/_/g,`.`).replace(/%/g,`.*`);return new RegExp(n,`i`).test(e)}case`regex`:try{return new RegExp(t).test(e)}catch{return!1}default:return!1}}var ru=class{constructor(e){this._instance=e,this.Hh=new Set,this.zh=new Set,this.Uh=new Mc,this.Wh=(e,t)=>this.Vh(e,t)&&this.Gh(e,t)&&this.Zh(e,t)&&this.Qh(e,t),this.Vh=(e,t)=>!t?.event||e?.event===t?.event}init(){A(this._instance?._addCaptureHook)||(this.Jh=this._instance?._addCaptureHook((e,t)=>{this.on(e,t)}))}dispose(){var e;(e=this.Jh)==null||e.call(this),this.Jh=void 0,this.Uh=new Mc}register(e){if(!A(this._instance?._addCaptureHook)&&(e.forEach(e=>{var t;this.Hh.add(e),(t=e.steps)==null||t.forEach(e=>{this.zh.add(e?.event||``)})}),this._instance?.autocapture)){let e=new Set;this.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`||!nu(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=>nu(e.href,t.href,t.href_matching||`exact`));let i=(e==null||(n=e.properties)==null?void 0:n.$elements_chain)||``;return!!i&&nu(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=>nu(e.text,t.text,t.text_matching||`exact`)||nu(e.$el_text,t.text,t.text_matching||`exact`));let i=(e==null||(n=e.properties)==null?void 0:n.$elements_chain)||``;return!!i&&(a=function(e){let t=[],n=/(?::|")text="(.*?)"/g,r;for(;!N(r=n.exec(e));
1)t.includes(r[1])||t.push(r[1]);return t}(i),o=t.text,s=t.text_matching||`exact`,a.some(e=>nu(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||Uc(t.properties.reduce((e,t)=>{let n=E(t.value)?t.value.map(String):t.value==null?[]:[String(t.value)];return e[t.key]={values:n,operator:t.operator||`exact`},e},{}),e?.properties)}},iu=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&&Uc(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===gs.Activation?this.rc:this.oc).get(e),i=[];return this.yc(e=>{i=e.filter(e=>r?.includes(e.id))}),i.filter(r=>{var i;let a=(i=r.conditions)==null||(i=i[n])==null||(i=i.values)==null?void 0:i.find(t=>t.name===e);return this.fc(a,t)})}register(e){this.bc(e,!1)}replace(e){this.bc(e,!0)}bc(e,t){A(this._instance?._addCaptureHook)||(this._c(e,t),this.wc(e,t))}wc(e,t){let n=e.filter(e=>{var t;return(t=e.conditions)==null||(t=t.actions)==null||(t=t.values)==null?void 0:t.length});var r;if(t&&this.ac.clear(),n.length===0)return void(t&&((r=this.kc)==null||r.replace([])));this.kc||(this.kc=new ru(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,gs.Activation),a=this.gc(e,gs.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, removing 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,gs.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,gs.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(L(L({},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&&(k(n)?this.vc():this.dc(n))}Nc(){this.cc()&&this.vc()}getActivationTimestamp(e){if(!this.Rc().includes(e))return;let t=this.Lc()[e];return P(t)?t:void 0}Oc(){var e;let t=this.qc();return((e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[t])||[]}Rc(){var e,t,n;let r=this.Oc();if(r.length===0)return[];let i=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[this.jc()],a=(t=this._instance)==null||(n=t.get_session_id)==null?void 0:n.call(t);return a&&i===a?r:[]}Fc(){var e,t;let n=(e=this._instance)==null||(t=e.get_session_id)==null?void 0:t.call(e);n&&this.Bc(n)}Dc(){this.Hc()}uc(e){var t;let n=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[this.jc()];if(n&&n!==e){let e=this.Oc(),t=this.Lc();e.length>0&&(this.Ac([]),e.filter(e=>
1P(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}},au=class extends iu{constructor(e){super(e)}qc(){return pi}jc(){return mi}cc(){return hi}dc(e){var t;(t=this._instance)==null||(t=t.persistence)==null||t.register({$surveys_activated_timestamps:e})}vc(){var e;(e=this._instance)==null||(e=e.persistence)==null||e.unregister(`$surveys_activated_timestamps`)}hc(e){var t;let n;this.yc(t=>{n=t.find(t=>t.id===e)});let r=n==null||(t=n.appearance)==null?void 0:t.surveyPopupDelaySeconds;return P(r)&&r>0}Wc(){return vs.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 zc(e)&&!!((t=e.conditions)!=null&&(t=t.events)!=null&&t.repeatedActivation)||e.schedule===`always`}(n)?e===vs.SHOWN?`consume`:`ignore`:e===vs.SHOWN?`persist`:e===vs.DISMISSED||e===vs.SENT?`consume`:`ignore`}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},ou=class{constructor(e){this._instance=e}initialize(){}get(e){if(typeof e==`string`)return this._instance.get_property(e);let t={};for(let n of e){let e=this._instance.get_property(n);A(e)||(t[n]=e)}return t}set(e,t){this._instance.register(typeof e==`string`?{[e]:t}:e)}remove(e){typeof e==`string`?this._instance.unregister(e):e.forEach(e=>this._instance.unregister(e))}},su=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=m?.__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 au(this._instance)}},cu=n?.location?zo(n.location.hash,`__posthog`)||zo(location.hash,`state`):null,lu=`_postHogToolbarParams`,uu=z(`[Toolbar]`),du=z(`[FeatureFlags]`),fu=class{constructor(e,t=!1){this.Vc=!1,this.update(e,t)}update(e,t){this.Gc=((e,t)=>({bootstrap:{featureFlags:e.bootstrap?.featureFlags??void 0,featureFlagPayloads:e.bootstrap?.featureFlagPayloads??void 0},remoteRequestsDisabled:t,featureFlagsDisabled:!!e.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!e.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!e.advanced_feature_flags_dedup_per_session,cacheTtlMs:e.feature_flag_cache_ttl_ms,refreshIntervalMs:e.remote_config_refresh_interval_ms??3e5,idleRefreshBackoff:A(e.remote_config_refresh_interval_ms),requestTimeoutMs:e.feature_flag_request_timeout_ms,compression:e.disable_compression?void 0:`best-available`,evaluationContexts:e.evaluation_contexts??e.evaluation_environments??[],flagKeys:E(e.flag_keys)?e.flag_keys:void 0}))(e,t),!e.evaluation_environments||e.evaluation_contexts||this.Vc||(du.warn(`evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version.`),this.Vc=!0),A(e.flag_keys)||E(e.flag_keys)||du.error(`Invalid flag_keys found:`,e.flag_keys,`Expected array of non-empty strings`)}get(){return this.Gc}},pu=z(`[FeatureFlags]`),mu=z(`[FeatureFlags]`,{debugEnabled:!0}),hu=`" failed. Feature flags didn't load in time.`,gu=[`click`,`keydown`,`wheel`,`touchstart`,`pointerdown`],_u=`connection_error`,vu=e=>{let t={};for(let n=0;e.length>n;n++)t[e[n]]=!0;return t},yu=e=>{let t={};for(let[n,r]of ia(e||{}))r&&(t[n]=r);return t},bu=e=>ce(e)&&(e.name===`RangeError`&&e.message.indexOf(`Maximum call stack size exceeded`)===0||e.name===`InternalError`&&e.message===`too much recursion`),xu=z(`[Error tracking]`),Su=`webkit-masked-url:`,Cu=[{value:`isolatedAPI.contexts.topHostname`,exact:!1},{value:`No response from target`,exact:!0}],wu=[`chrome-extension://`,`moz-extension://`,`safari-extension:`,`safari-web-extension:`,Su],Tu=[`__firefox__`,`__gCrWeb`],Eu=`Refusing to render web experiment since the viewer is a likely bot`,Du={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>Bc(t,e),not_regex:(e,t)=>!Bc(t,e),exact:(e,t)=>
1t===e,is_not:(e,t)=>t!==e},Ou=z(`[Conversations]`),ku=`Conversations not available yet.`;function Au(e,t){let n=e?.flushIntervalMs??3e3,r=e?.maxBufferSize??100,a=t?.consoleCapture?void 0:e?.maxLogsPerInterval??1e3,o=A(a)?Math.max(r,2048):Math.max(r,a),s=L(L({},function(){let e=``,t=``;try{let n=i?.userAgent;n&&([e,t]=_t(n))}catch{}return function(e,t){let n=function(e){if(e)return{}.hasOwnProperty.call(Zn,e)?Zn[e]:e}(e);return L(L({},n?{"os.name":n}:{}),t?{"os.version":t}:{})}(e,t)}()),e?.resourceAttributes);return{serviceName:s?.[`service.name`]??e?.serviceName??t?.serviceNameDefault,serviceVersion:s?.[`service.version`]??e?.serviceVersion,environment:s?.[`deployment.environment`]??e?.environment,resourceAttributes:s,beforeSend:e?.beforeSend,flushIntervalMs:n,maxBufferSize:r,maxQueueSize:o,maxBatchRecordsPerPost:100,rateCapWindowMs:n,maxLogsPerInterval:a,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}var ju=[`debug`,`log`,`warn`,`error`,`info`],Mu=e=>{for(;e?.__rrweb_original__;)e=e.__rrweb_original__;return e},Nu=`console`,Pu=`__posthogHandledLogsRequestError`,Fu=(e,t)=>{let n=e instanceof Error?e:Error(t);return n[Pu]=!0,n},Iu=e=>!!e&&typeof e==`object`&&!0===e[Pu],Lu=z(`[NetworkMetrics]`),Ru=()=>{var e;return n!=null&&(e=n.performance)!=null&&e.now?n.performance.now():Date.now()},zu={"http:":80,"https:":443},Bu=new Set([`CONNECT`,`DELETE`,`GET`,`HEAD`,`OPTIONS`,`PATCH`,`POST`,`PUT`,`TRACE`]),Vu=(e,t)=>{let n=String(t);return{method:String(e).toUpperCase(),url:Io(n)?.href||n}},Hu=(e,t,n,r,i,a,o=!1)=>{try{var s;let c=i();if(!c)return;let l=n||void 0,u=Ru()-r,d=Io(t.url);if(d&&d.protocol!==`http:`&&d.protocol!==`https:`)return;let f={url:d?.href||t.url,method:t.method},p=D(c.name)?c.name(f):j(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=L(L(L(L(L({},(e=>{let t=Bu.has(e)?e:`_OTHER`;return L({"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)||zu[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){Lu.error(`Failed to record network metric`,e)}},Uu=()=>{},Wu=(e,t)=>D(n?.fetch)?Fl(n,`fetch`,n=>function(...r){let i=Ru(),a=n.apply(this,r);if(!t())return a;try{let[n,o]=r,s=Vu(o?.method??n?.method??`GET`,n?.url??n);return a.then(n=>(Hu(e,s,n?.status,i,t,void 0,!0),n),n=>{throw Hu(e,s,void 0,i,t,n),n})}catch(e){return Lu.error(`Failed to observe fetch`,e),a}}):Uu,Gu=(e,t)=>{var r;let i=n==null||(r=n.XMLHttpRequest)==null?void 0:r.prototype;if(!i)return Uu;let a=new WeakMap,o=Fl(i,`open`,e=>function(...t){try{oc.has(this)||a.set(this,Vu(t[0],t[1]))}catch(e){Lu.error(`Failed to observe XHR open`,e)}return e.apply(this,t)}),s=Fl(i,`send`,n=>function(...r){let i;try{let n=a.get(this);if(n&&t()){let r=Ru();i=()=>{this.removeEventListener(`loadend`,i),Hu(e,n,this.status,r,t)},W(this,`loadend`,i)}}catch(e){Lu.error(`Failed to observe XHR send`,e)}try{return n.apply(this,r)}catch(e){throw i&&this.removeEventListener(`loadend`,i),e}});return()=>{o(),s()}},Ku={featureFlags:class{constructor(e){this.name=`featureFlags`,this.Zc=!1,this.featureFlagEventHandlers=[],this.$=pu,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;A(e)||A(t)||this.Ir.remoteRequestsDisabled||!a||a.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=()=>{a?.visibilityState===`visible`&&this.gd()},`get`in e?this.bo=e:(this._instance=e,this.md=new fu(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]`),Ql(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 n&&W(n,`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&&a&&!A(e)&&e>0?e:void 0;this.Ir.idleRefreshBackoff||(this.dd=t),t!==this.hd&&(this.$d(),A(t)||(this.hd=t,this.dd=t,this.fd(),a!=null&&a.addEventListener&&(W(a,Zi,this.ln),ra(gu,e=>{W(a,e,this.pd,{capture:!0})}
1))))}fd(){A(this.hd)||(A(this.Td)||clearInterval(this.Td),this.vd=Date.now(),this.Td=setInterval(this.ud,this.hd))}$d(){var e;A(this.Td)||(clearInterval(this.Td),this.Td=void 0,a==null||(e=a.removeEventListener)==null||e.call(a,`visibilitychange`,this.ln),ra(gu,e=>{var t;a==null||(t=a.removeEventListener)==null||t.call(a,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=[],n?.removeEventListener(`online`,this.an),void 0)}get Ir(){return this.bo.get()}Ed(e){return this.Pd&&e in this.Pd?this.Pd[e]:this.mo?.kv.get(e)}Sd(){return!!this.Pd&&(this.Pd=void 0,!0)}Rd(){return!A(this.mo?.kv.get(`$enabled_feature_flags`))&&this.Sd()}At(e){this.Ad(()=>this.mo?.kv.set(e))}Fd(e,t,n){if(!this._instance?.persistence||!e.$enabled_feature_flags)return;let r=this.Ed(`$enabled_feature_flags`)||{},i=e.$enabled_feature_flags||{},a=t.flags||t.featureFlags,o=t.flags?Object.entries(t.flags).filter(([,e])=>!e?.failed).map(([e])=>e):[],s=!!t.errorsWhileComputingFlags&&!!t.flags,c=s?o:n&&!E(a)?Object.keys(a||{}):Array.from(new Set([...Object.keys(r),...Object.keys(i)])),l=this.Ed(`$feature_flag_payloads`)||{},u=e.$feature_flag_payloads||{},d=s||n?c:Array.from(new Set([...Object.keys(l),...Object.keys(u)])),f=!s&&!n,p=!!f||c,m=!!f||d,h={[ei]:p,[$r]:p,[ri]:m};e.$feature_flag_details&&(h[ni]=p);for(let t of[ii,Ei,ai])A(e[t])||(h[t]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(h)}Lt(e){this.Ad(()=>this.mo?.kv.remove(e))}Ad(e){try{e()}catch(e){this.$.error(`Failed to update feature flag persistence`,e)}}xd(){let e={};for(let t of[ei,ri,ii,oi]){let n=this.Ed(t);A(n)||(e[t]=n)}this.Qc=e;let t=L({},e),n=this.Ed($r);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(Ei);return typeof t!=`number`||Date.now()-t>e}Od(){return!!this.wd()&&(this.rd||this.Yc||(this.rd=!0,this.$.warn(`Feature flag cache is stale, triggering refresh...`),this.reloadFeatureFlags()),!0)}Dd(){let e=this.Ir.evaluationContexts;return e?.length?e.filter(e=>{let t=e&&typeof e==`string`&&e.trim().length>0;return t||this.$.error(`Invalid evaluation context found:`,e,`Expected non-empty string`),t}):[]}Ld(){let e=this.Ir.flagKeys;if(!A(e))return e.filter(e=>{let t=e&&typeof e==`string`&&e.trim().length>0;return t||this.$.error(`Invalid flag key found:`,e,`Expected non-empty string`),t})}initialize(){let e=this.Ir,t=e.bootstrap?.featureFlags??{};if(Object.keys(t).length){let n=e.bootstrap?.featureFlagPayloads??{},r=Object.keys(t).filter(e=>!A(t[e])).reduce((e,n)=>(e[n]=t[n],e),{}),i=Object.keys(n).filter(e=>r[e]).reduce((e,t)=>(e[t]=n[t],e),{});return this.Nd({featureFlags:r,featureFlagPayloads:i},void 0,{persist:!1})}}updateFlags(e,t,n){var r,i;let a=n?.merge&&(r=this.Ed(`$enabled_feature_flags`))!=null?r:{},o=n?.merge&&(i=this.Ed(`$feature_flag_payloads`))!=null?i:{},s=L(L({},a),e),c=L(L({},o),t),l={};for(let[e,t]of Object.entries(s))l[e]={key:e,enabled:An(t),variant:jn(t),reason:void 0,metadata:A(c?.[e])?void 0:{id:0,version:void 0,description:void 0,payload:c[e]}};this.Nd({flags:l})}get hasLoadedFlags(){return this.Xc}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){let e=this.Ed(ni),t=this.Ed(oi),n=this.Ed(si);if(!n&&!t)return e||{};let r=U({},e||{}),i=[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])];for(let e of i){var a;let i=r[e],s=t?.[e],c=A(s)?(a=i?.enabled)!=null&&a:!!s,l=A(s)?i?.variant:typeof s==`string`?s:void 0,u=n?.[e],d=L(L({},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=L(L({},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:An(r),variant:jn(r),payload:kn(t[n])}})}getFlagVariants(){let e=this.Ed($r),t=this.Ed(oi);if(!t)return e||{};let n=U({},e||{}),r=Object.keys(t);for(let e=0;r.length>e;e++)n[r[e]]=t[r[e]];return this.Zc||=(this.$.warn(` Overriding feature flags!`,{enabledFlags:e,overriddenFlags:t,finalFlags:n}),!0),n}getFlagPayloads(){let e=this.Ed(ri),t=this.Ed(si);if(!t)return e||{};let n=U({},e||{}),r=Object.keys(t);for(let e=0;r.length>e;e++)n[r[e]]=t[r[e]];return this.Zc||=(this.$.warn(` Overriding feature 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().forEac
1h(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(Ci)}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:L(L(L({},t.initialPersonProperties),this.Ed(`$stored_person_properties`)||{}),{},{$lib:t.library.name,$lib_version:t.library.version}),group_properties:this.Ed(li),timezone:ts()};A(t.deviceId)||(n.$device_id=t.deviceId),(e!=null&&e.disableFlags||this.Ir.featureFlagsDisabled)&&(n.disable_flags=!0);let r=this.Dd();r.length&&(n.evaluation_contexts=r);let i=this.Ld();A(i)||(n.flag_keys=i);let a=this.Ir.onlyEvaluateSurveyFeatureFlags,o=`/flags/?v=2`+(a?`&only_evaluate_survey_feature_flags=true`:``),s=this.td;this.Yc=!0;let c=()=>{this.nd&&(this.nd=!1,this.jd())},l=e=>{let t=e.json??{},r=e.statusCode!==200;if(this.Yc=!1,s!==this.td)return void c();if(this.Bd(e.statusCode),r||this.nd||(this.$anon_distinct_id=void 0),n.disable_flags&&!this.nd)return;this.sd=!r;let i=[];e.error?i.push(e.error instanceof Error&&e.error.name===`AbortError`?`timeout`:e.error instanceof Error?_u:`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({[Ti]: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({[Ti]:[_u]}),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 Bo(this.od,3)}Bd(e){this.od=Vo(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+hu);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+hu);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(wi);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({[Ci]:u,[wi]:l});else{var d,f,p,m,h,g,_,v;E(u[e])?u[e].push(o):u[e]=[o],this.At(L({[Ci]:u},l?{[wi]:l}:{}));let t=this.getFeatureFlagDetails(e),n=[...this.Ed(`$feature_flag_errors`)??[]];A(i)&&n.push(`flag_missing`);let r={$feature_flag:e,$feature_flag_response:i,$feature_flag_payload:a??null,$feature_flag_request_id:s,$feature_flag_evaluated_at:c,$feature_flag_bootstrapped_response:((d=this.Ir.bootstrap)==null||(d=d.featureFlags)==null?void 0:d[e])??null,$feature_flag_bootstrapped_payload:((f=this.Ir.bootstrap)==null||(f=f.featureFlagPayloads)==null?void 0:f[e])??null,$used_bootstrap_value:!this.sd};A(t==null||(p=t.metadata)==null?void 0:p.has_experiment)||(r.$feature_flag_has_experiment=t.metadata.has_experiment),A(t==null||(m=t.metadata)==null?void 0:m.version)||(r.$feature_flag_version=t.metadata.version);let b=(t==null||(h=t.reason)==null?void 0:h.description)??(t==null||(g=t.reason)==null?void 0:g.code);var y;b&&(r.$feature_flag_reason=b),t!=null&&(_=t.metadata)!=null&&_.id&&(r.$feature_flag_id=t.metadata.id),A(t?.original_variant)&&A(t?.original_enabled)||(r.$feature_flag_original_response=A(t.original_variant)?t.original_enabled:t.original_variant),t!=null&&(v=t.metadata)!=null&&v.original_payload&&(r.$feature_flag_original_payload=t==null||(y=t.metadata)==null?void 0:y.original_payload),n.length&&(r.$feature_flag_error=n.join(`,`)),this.Hd(r)}}else l&&this.At({[Ci]:u,[wi]:l});return r?{key:e,enabled:!!i,variant:typeof i==`string`?i:void 0,payload:kn(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 I(function*(){let r=n.mo;if(!r)return;let i={distinct_id:r.distinctId,token:r.projectToken,person_properties:{$lib:r.library.name,$lib_version:r.library.version}},a=n.Dd();a.length&&(i.evaluation_contexts=a);let o=n.Ld(),s;A(o)||(i.flag_keys=o);try{s=(yield r.sendRequest(`/flags/?v=2`,{target:`flags`,method:`POST`,body:i,compression:n.Ir.compression,sentAt:`body`,timeoutMs:n.Ir.requestTimeoutMs})).json?.featureFlagPayloads?.[e]||void 0}catch(e){n.$.error(`Remote config feature flag request failed`,e);return}try{t(s)}catch(e){n.$.error(`Remote config feature flag callback failed`,e)}})()}isFeatureEnabled(e,t={}){if(t.fresh&&!this.sd)return t.defaultValue;if(!(this.Xc||this.getFlags()&&this.getFlags().length>
10))return this.$.warn(`isFeatureEnabled for key "`+e+hu),t.defaultValue;let n=this.getFeatureFlag(e,t);return A(n)?t.defaultValue:!!n}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t,n){this.Nd(e,t,n)}Nd(e,t,n){if(!this.mo)return;this.Xc=!0;let r=((e,t={},n={},r={},i,a=pu)=>{let o=((e,t)=>{let n=e.flags;if(n){let t=Object.fromEntries(Object.keys(n).map(e=>[e,n[e].variant??n[e].enabled])),r=Object.fromEntries(Object.keys(n).filter(e=>n[e].enabled).filter(e=>!A(n[e].metadata?.payload)).map(e=>[e,n[e].metadata?.payload]));return L(L({},e),{},{featureFlags:t,featureFlagPayloads:r})}return e.featureFlags&&t.warn(`Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version`),e})(e,a),s=o.flags,c=o.featureFlags,l=o.featureFlagPayloads;if(!c)return;let u=e.requestId,d=e.evaluatedAt;if(E(c)){a.warn(`v1 of the feature flags endpoint is deprecated. Please use the latest version.`);let e={};if(c)for(let t=0;c.length>t;t++)e[c[t]]=!0;return{[ei]:c,[$r]:e,[ai]:!1}}let f=c,p=l,m=s;if(i?.partialResponse){let e=Object.keys(f),i=p||{};f=L(L({},t),f),p=L(L({},n),i),e.forEach(e=>{e in i||p==null||delete p[e]}),m=L(L({},r),m)}else if(e.errorsWhileComputingFlags){if(s){let e=new Set(Object.keys(s).filter(e=>!s[e]?.failed));f=L(L({},t),Object.fromEntries(Object.entries(f).filter(([t])=>e.has(t))));let i=Object.fromEntries(Object.entries(p||{}).filter(([t])=>e.has(t)));p=L(L({},n),i),e.forEach(e=>{e in i||p==null||delete p[e]}),m=L(L({},r),Object.fromEntries(Object.entries(m||{}).filter(([t])=>e.has(t))))}else f=L(L({},t),f),p=L(L({},n),p),m=L(L({},r),m)}return L(L({[ei]:Object.keys(yu(f)),[$r]:f||{},[ri]:p||{},[ni]:m||{},[ai]:!0===e.minimalFlagCalledEvents},u?{[ii]:u}:{}),d?{[Ei]:d}:{})})(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),n,this.$);if(r){if(!1===n?.persist){let e=!A(this.mo.kv.get($r));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([oi,si]),this.Cd(),void mu.info(`All overrides cleared`);if(E(e))return this.At({[oi]:vu(e)}),this.Cd(),void mu.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[oi]=E(i)?vu(i):i),a&&(r[si]=a),Object.keys(r).length&&this.At(r),!1===i&&!1===a?this.Lt([oi,si]):!1===i?this.Lt(oi):!1===a&&this.Lt(si),this.Cd(),!1===i?mu.info(`Flag overrides cleared`):i&&mu.info(`Flag overrides set`,{flags:i}),!1===a?mu.info(`Payload overrides cleared`):a&&mu.info(`Payload overrides set`,{payloads:a});return}if(e&&typeof e==`object`)return this.At({[oi]:e}),this.Cd(),void mu.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=L(L({},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({[ei]:Object.keys(yu(s)),[$r]:s,[ci]:L(L({},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(ti);!r||t?this.Vd(e,n):e(r)}Vd(e,t){var n=this;return I(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({[ti]: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({[ci]:L(L(L({},n),a),r)}),t&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t=!0){let n=L({},this.Ed(`$stored_person_properties`)||{});e.forEach(e=>{delete n[e]}),this.At({[ci]:n}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e=!0){this.Lt(ci),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t=!0){let n=this.Ed(`$stored_group_properties`)||{},r=L({},n);for(let t of Object.keys(e))r[t]=L(L({},n[t]),e[t]);this.At({[li]:r}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){let t=this.Ed(`$stored_group_properties`)||{};this.At({[li]:L(L({},t),{},{[e]:{}})})}else this.Lt(li)}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=Hl,this.Jd=void 0,this.Kd=!1,this.Xe=(()=>{var e,t;if(!a?.visibilityState||a.visibilityState===`visible`)return!0;let r=n==null||(e=n.performance)==null||(t=e.getEntriesByType)==null?void 0:t.call(e,`visibility-state`);return!r?.length||r.some(e=>e.name===`visible`)})(),this.ln=()=>{var e,t;a?.visibilityState===`visible`&&(this.Xe=!0,(e=this.Zd)==null||(t=e.setDocumentWasEverVisible)==null||t.call(e,!0))},!this._instance.sessionManager)throw Wl.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"`);a!=null&&a.addEventListener&&W(a,`visibilitychange`,this.ln)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:e=!1}={}){var t;this.Kd=!0,a==null||(t=a.removeEventListener)==null||t.call(a,`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,r=this.Ir.disable_session_recording||this._instance.consent.isOptedOut();return n&&e&&t&&!r}startIfEnabledOrStop(e){if(this.Kd||this.Yd&&this.Zd?.isStarted)return;let t=!A(Object.assign)&&!A(Array.from);this.Yd&&t?(this.tv(e),Wl.info(`starting`)):(this.Qd=Hl,this.stopRecording())}tv(e){var t;if(this.Yd){if(this.Qd!==`awaiting_config`&&this.Qd!==`missing_config`&&(this.Qd=Ul),m!=null&&(t=m.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&m.__PosthogExtensions__?.initSessionRecording)this.ev(e);else{var n,r;let t=this._instance.sessionManager;(n=m.__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}),Wl.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(N(e))return null;let n=P(e)?e:parseFloat(e);return typeof(r=n)!=`number`||!Number.isFinite(r)||0>r||r>1?(Wl.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;N(a)&&this.nv();let o=t?.minimumDurationMilliseconds;n.register({[zr]:L(L({cache_timestamp:Date.now(),enabled:!!t},t),{},{networkPayloadCapture:L({capturePerformance:e.capturePerformance},t?.networkPayloadCapture),canvasRecording:{enabled:t?.recordCanvas,fps:t?.canvasFps,quality:t?.canvasQuality}
1,sampleRate:a,minimumDurationMilliseconds:A(o)?null:o,endpoint:t?.endpoint,triggerMatchType:t?.triggerMatchType,masking:t?.masking,urlTriggers:t?.urlTriggers,version:t?.version,triggerGroups:t?.triggerGroups})})};r(),(t=this.Jd)==null||t.call(this),this.Jd=this._instance.sessionManager?.onSessionId(r)}}onRemoteConfig(e){let t=e.ok?e.config:void 0;t&&`sessionRecording`in t?!1===t.sessionRecording?(this.rv(t),this.Xd()):(this.rv(t),this.startIfEnabledOrStop()):(this.Qd===`awaiting_config`&&(this.Qd=`missing_config`,this._instance.register_for_session({[Ri]:!0}),Wl.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):Wl.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(zr);return(n==null||(t=n.scriptConfig)==null?void 0:t.script)||`lazy-recorder`}ov(){let e=this._instance.get_property(zr);if(!e)return!1;let t;try{t=typeof e==`object`?e:JSON.parse(e)}catch(e){return Wl.warn(`persisted remote config for session recording is invalid and will be ignored`,e),!1}return!N(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}ev(e){var t,n;if(!this.Kd&&this.Yd&&this._instance.sessionManager){if(!m.__PosthogExtensions__?.initSessionRecording)return Wl.warn(`Called on script loaded before session recording is available. This can be caused by adblockers.`),void this._instance.register_for_session({[Li]:!0});if(this.Zd||(this.Zd=m.__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`,Wl.info(`persisted remote config is stale, requesting fresh config before starting`),new Ds(this._instance).load();return}this.Qd=Ul,(t=(n=this.Zd).setDocumentWasEverVisible)==null||t.call(n,this.Xe),this.Zd.start(e)}else this.Qd=Hl}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)}}},Ju={autocapture:class extends Al{constructor(e){super(new jl(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&&(R.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,R.info(`History API monitoring stopped`)}monitorHistoryChanges(){n&&n.history&&(this.fv(`pushState`),this.fv(`replaceState`),this.pv(),this.hv()&&this.gv())}fv(e){if(!n||n.history[e]?.__posthog_wrapped__)return;let t=this;Fl(n.history,e,n=>function(r,i,a){n.call(this,r,i,a),t.mv(e)})}lv(){let e=n?.location;if(e?.pathname)return{pathname:e.pathname,search:e.search,hash:e.hash}}uv(){let e=this._instance.config.capture_pageview;return e===`history_change`?{path:!0}:O(e)?e:{}}hv(e=this.uv()){return!!e.hash&&!this._instance.config.disable_capture_url_hashes}yv(e){let t=this.uv(),n=this.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($i,{navigation_type:e}),this.av=t}catch(t){R.error(`Error capturing ${e} pageview`,t)}}
1pv(){if(this.dv)return;let e=()=>{this.mv(`popstate`)};W(n,`popstate`,e),this.dv=()=>{n&&n.removeEventListener(`popstate`,e)}}gv(){if(this.vv)return;let e=()=>{this.mv(`hashchange`)};W(n,`hashchange`,e),this.vv=()=>{n&&n.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[Ar],this.rageclicks=new wl(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let e=5e3;return O(this.Ir.capture_heatmaps)&&this.Ir.capture_heatmaps.flush_interval_milliseconds&&(e=this.Ir.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return N(this.Ir.capture_heatmaps)?N(this.Ir.enable_heatmaps)?this.bv:this.Ir.enable_heatmaps:!1!==this.Ir.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this._o)return;Gl.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({[Ar]:n}),this.bv=n,this.startIfEnabled()}getAndClearBuffer(){let e=this.Rt;return this.Rt=void 0,e}xv(e){Kl(e.originalEvent)&&this.Mr(e.originalEvent,`deadclick`)}ln(){this._v&&clearInterval(this._v),this._v=a?.visibilityState===`visible`?setInterval(this.pl.bind(this),this.flushIntervalMilliseconds):null}wv(){n&&a&&(this.Cv=this.pl.bind(this),W(n,Qi,this.Cv),this.$v=e=>this.Mr(e||n?.event),W(a,`click`,this.$v,{capture:!0}),this.Tv=e=>this.Iv(e||n?.event),W(a,`mousemove`,this.Tv,{capture:!0}),this.Mv=new To(this.instance,Co,this.xv.bind(this)),this.Mv.startIfEnabledOrStop(),this.Ev=this.ln.bind(this),W(a,Zi,this.Ev),this._o=!0)}Sv(){var e;n&&a&&(this.Cv&&n.removeEventListener(Qi,this.Cv),this.$v&&a.removeEventListener(`click`,this.$v,{capture:!0}),this.Tv&&a.removeEventListener(`mousemove`,this.Tv,{capture:!0}),this.Ev&&a.removeEventListener(Zi,this.Ev),clearTimeout(this.Pv),(e=this.Mv)==null||e.stop(),this._o=!1)}Rv(e,t){let r=this.instance.scrollManager.scrollY(),i=this.instance.scrollManager.scrollX(),a=this.instance.scrollManager.scrollElement(),o=function(e,t,r){let i=e;for(;i&&za(i)&&!J(i,`body`);){if(i===r)return!1;let e;try{e=(i.ownerDocument?.defaultView??n)?.getComputedStyle(i).position}catch{return!1}if(x(t,e))return!0;i=Za(i)}return!1}(qa(e),[`fixed`,`sticky`],a);return{x:e.clientX+(o?0:i),y:e.clientY+(o?0:r),target_fixed:o,type:t}}Mr(e,t=`click`){var n;if(Ra(e.target)||!Kl(e))return;let r=this.Rv(e,t);(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&io(qa(e),this.instance.config.rageclick)&&this.Zs(L(L({},r),{},{type:`rageclick`})),this.Zs(r)}Iv(e){!Ra(e.target)&&Kl(e)&&(clearTimeout(this.Pv),this.Pv=setTimeout(()=>{this.Zs(this.Rv(e,`mousemove`))},500))}Zs(e){if(!n)return;let t=this.Ir.disable_capture_url_hashes?jt(n.location.href):n.location.href,r=this.Ir.custom_personal_data_properties,i=Ro(t,this.Ir.mask_personal_data_properties?[...Ho,...r||[]]:[],Wo);this.Rt=this.Rt||{},this.Rt[i]||(this.Rt[i]=[]),this.Rt[i].push(e)}pl(){this.Rt&&!k(this.Rt)&&this.instance.capture(`$$heatmap`,{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:To,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`,L({$current_url:this.Rt.url},this.Rt.metrics.reduce((e,t)=>L(L({},e),{},{[`$web_vitals_${t.name}_event`]:L({},t),[`$web_vitals_${t.name}_value`]:t.value}),{}))),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Ov=e=>{if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},N(e?.name)||N(e?.value))return void Ll.error(`Invalid metric received`,e);let t=typeof e.navigationURL==`string`?e.navigationURL:void 0,n=this.Dv(t);if(A(n))return;let r=P(e.navigationId)||typeof e.navigationId==`string`?`navigation:${e.navigationId}`:`url:${n}`;if(this.Lv&&e.value>=this.Lv)return void Ll.error(`Ignoring metric with value >= `+this.Lv,e);
1this.Rt.navigationKey!==r&&(this.Av(),this.Fv=setTimeout(this.Av,this.flushToCaptureTimeoutMs)),A(this.Rt.navigationKey)&&(this.Rt.navigationKey=r,this.Rt.url=n),this.Rt.firstMetricTimestamp=A(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;let i=this._instance.sessionManager?.checkAndGetSessionAndWindowId(!0),a=L(L(L({},e),t?{navigationURL:n}:{}),{},{$current_url:n,timestamp:Date.now()});if(delete a.entries,O(e.attribution)&&this.attributionMetrics.indexOf(e.name)>-1){let t={};for(let n of Vl){let r=n===`url`&&typeof e.attribution[n]==`string`?this.Dv(e.attribution[n]):e.attribution[n];A(r)||(t[n]=r)}a.attribution=t}else delete a.attribution;A(i)||(a.$session_id=i.sessionId,a.$window_id=i.windowId),this.Rt.metrics.push(a),this.Rt.metrics.length===this.allowedMetrics.length&&this.Av()},this.Nv=()=>{if(this._o)return;let e,t,n,r,i=!1,a=m.__PosthogExtensions__,o=a?.postHogWebVitalsCallbacksByFlavor,s=o?.[this.qv]||(this.qv===`web-vitals`&&A(o)?a?.postHogWebVitalsCallbacks:void 0);if(!A(s)){let a=s.withoutAttribution,o=this.attributionMetrics;i=!A(a),e=o.indexOf(`LCP`)>-1?s.onLCP:a?.onLCP||s.onLCP,t=o.indexOf(`CLS`)>-1?s.onCLS:a?.onCLS||s.onCLS,n=o.indexOf(`FCP`)>-1?s.onFCP:a?.onFCP||s.onFCP,r=o.indexOf(`INP`)>-1?s.onINP:a?.onINP||s.onINP}if(!(e&&t&&n&&r))return void Ll.error(`web vitals callbacks not loaded - not starting`);let c={reportSoftNavs:this.useSoftNavs},l=i&&this.attributionMetrics.indexOf(`INP`)>-1?L(L({},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[Pr],this.startIfEnabled()}get jv(){return this._instance.config.capture_performance}get allowedMetrics(){let e=O(this.jv)?this.jv?.web_vitals_allowed_metrics:void 0;return N(e)?this._instance.persistence?.props.$web_vitals_allowed_metrics||zl:e}get flushToCaptureTimeoutMs(){return(O(this.jv)?this.jv.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){let e=O(this.jv)?this.jv.web_vitals_attribution:void 0;return F(e)?e?zl:[]:E(e)?e:Bl}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){let e=O(this.jv)?this.jv.__preview_web_vitals_soft_navs:void 0;return e!=null&&e}get Lv(){let e=O(this.jv)&&P(this.jv.__web_vitals_max_value)?this.jv.__web_vitals_max_value:Rl;return e>0&&6e4>=e?Rl:e}get isEnabled(){let e=o?.protocol;if(e!==`http:`&&e!==`https:`)return Ll.info(`Web Vitals are disabled on non-http/https protocols`),!1;let t=O(this.jv)?this.jv.web_vitals:F(this.jv)?this.jv:void 0;return F(t)?t:this.bv}startIfEnabled(){this.isEnabled&&!this._o&&(Ll.info(`enabled, starting...`),this.qo(this.Nv))}onRemoteConfig(e){if(!e.ok)return;let t=e.config;if(!(`capturePerformance`in t))return;let n=O(t.capturePerformance)&&!!t.capturePerformance.web_vitals,r=O(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Pr]:n}),this._instance.persistence.register({[Rr]: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=m.__PosthogExtensions__,r=this.qv,i=n?.postHogWebVitalsCallbacksByFlavor;i?.[r]||r===`web-vitals`&&A(i)&&n?.postHogWebVitalsCallbacks?e():n==null||(t=n.loadExternalDependency)==null||t.call(n,this._instance,r,t=>{t?Ll.error(`failed to load script`,t):e()})}Dv(e){let t=e||n?.location.href;if(!t)return void Ll.error(`Could not determine current URL`);let r=this._instance.config.disable_capture_url_hashes?jt(t):t,i=this._instance.config.custom_personal_data_properties;return Ro(r,this._instance.config.mask_personal_data_properties?[...Ho,...i||[]]:[],Wo)}}},Yu={exceptionObserver:class{constructor(e){this.Nv=()=>{if(!n||!this.isEnabled||!m.__PosthogExtensions__?.errorWrappingFunctions)return;let e=m.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,t=m.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=m.__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=r(this.captureException.bind(this)))}catch(e){Ml.error(`failed to start`,e),this.Uv()}},this._instance=e,this.Wv=!!this._instance.persistence?.props[jr],this.wt=new ve(L(L({},function(e={}){return{refillRate:e.exceptionRateLimiterRefillRate??e.__exceptionRateLimiterRefillRate??1,bucketSize:e.exceptionRateLimiterBucketSize??e.__exceptionRateLimiterBucketSize??10}}(this._instance.config.error_tracking)),{},{refillInterval:1e4,$:Ml})),this.Ir=this.Vv(),this.startIfEnabledOrStop()}Vv(){let e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return O(e)?t=L(L({},t),e):(A(e)?this.Wv:e)&&(t=L(L({},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?(Ml.info(`enabled`),this.Uv(),this.qo(this.Nv)):this.Uv()}qo(e){var t,n;m.__PosthogExtensions__?.errorWrappingFunctions?e():(t=m.__PosthogExtensions__)==null||(n=t.loadExternalDependency)==null||n.call(t,this._instance,`exception-autocapture`,t=>{if(t)return Ml.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({[jr]: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 Ml.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 Ut([new dn,new xn,new pn,new fn,new yn,new vn,new hn,new bn],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=nn.test(r)?r.replace(nn,`$1`):r;if(!o.match(/\S*Error: /)){for(let n of t){let t=n(o,e);if(t){i.push(t);let e=an(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(ln(i,s)>=50)break}}let c=[...s].sort((e,t)=>t.start-e.start),l=c[c.length-1];if(l){let e=sn(i,l);i.splice(l.start-e,e);for(let t of c)t.start-=e}for(let e of c)on(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++)un(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 L(L({},e),{},{filename:e.filename||(n=t,n[n.length-1]||{}).filename,function:e.function||`?`});var n})}(i)}}(`web:javascript`,Qt,tn)),this._instance=e,this.Gv=this._instance.persistence?.get_property(`$error_tracking_suppression_rules`)??[],this.Qv=En(this.Jv()),this.Kv=new Dn(this.Qv)}onConfigChange(){this.Qv=En(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({[Mr]:this.Gv,[Nr]:r})}get Xv(){var e;let t=!!this._instance.get_property(Nr);return(e=this._instance.config.error_tracking.captureExtensionExceptions??t)!=null&&e}buildProperties(e,t){return this.Zv.buildFromUnknown(e,{syntheticException:t?.syntheticException,mechanism:{handled:t?.handled}})}addExceptionStep(e,t){if(this.Qv.enabled)try{if(!j(e)||e.trim().length===0)return void xu.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)=>wn.has(r)?(t.push(r),n):(n[r]=e[r],n),{}),droppedKeys:t}}(this.Yv(t));r.length>0&&xu.warn(`Ignoring reserved exception step fields`,{droppedKeys:r}),this.Kv.add(L({[Sn]:e,[Cn]:new Date().toISOString()},n))}catch(e){xu.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 xu.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 xu.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 xu.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 xu.info(`Skipping exception capture because it was thrown by the PostHog SDK`)}let n=this.Qv.enabled&&N(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){bu(e)||xu.error(`Failed to capture exception event. Dropping this exception.`,e),this.Kv.clear();return}}catch(e){bu(e)||xu.error(`Failed to process exception event. Ignoring this exception.`,e);return}}af(e){try{let t=this.Kv.getAttachable();return t.length===0?e:L(L({},e),{},{$exception_steps:t})}catch(t){return xu.error(`Failed to read buffered exception steps. Capturing exception without steps.`,t),e}}if(e){this.Qv.enabled&&this.Kv.add({[Sn]:e,[Cn]:new Date().toISOString()})}Yv(e){return O(e)?L({},e):{}}Jv(){return this._instance.config.error_tracking?.exception_steps??{}}ef(e){if(e.length===0)return!1;try{let t=e.reduce((e,{type:t,value:n})=>(j(t)&&t.length>0&&e.$exception_types.push(t),j(n)&&n.length>0&&e.$exception_values.push(n),e),{$exception_types:[],$exception_values:[]});return this.Gv.some(e=>{let n=e.values.map(e=>{let n=Hc[e.operator],r=t[e.key];if(!n||!r)return!1;let i=E(e.value)?e.value:[e.value];return i.length>0&&n(i,r)});return e.type===`OR`?n.some(Boolean):n.every(Boolean)})}
2catch(e){return xu.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&&wu.some(t=>e.startsWith(t)));return n.length!==0&&(!n.every(({filename:e})=>!!e&&e.startsWith(Su))||e.some(({type:e,value:t})=>e===`NoResponse`||j(t)&&Cu.some(({value:e,exact:n})=>n?t===e:t.includes(e)))&&!t.some(({in_app:e,filename:t})=>e&&!t?.startsWith(Su)))}sf(e){return e.some(({value:e})=>j(e)&&Tu.some(t=>e.includes(t)))}rf(e){if(e.length>0){var t,n;let r=e[0].stacktrace?.frames??[],i=r[r.length-1];return(t=i==null||(n=i.filename)==null?void 0:n.includes(`posthog.com/static`))!=null&&t}return!1}tf(e){return!N(e)&&E(e)}}},Xu=L({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({[Ir]:!!t.productTours}),!Jl(this._instance))return!this.lf&&N(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&&Jl(this._instance)&&this.qo(()=>this.hf())}qo(e){var t,n;m.__PosthogExtensions__?.generateProductTours?e():(t=m.__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=m.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.lf=m.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t=!1){if(E(this.uf)&&!t)return void e(this.uf,{isLoaded:!0});let n=this.Cl;if(n){let r=n.props[gi];if(E(r)&&!t)return this.uf=r,void e(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor(`api`,`/api/product_tours/?token=${this._instance.config.token}`),method:`GET`,timestampMode:`query`,callback:t=>{if(!Jl(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=E(t.json.product_tours)?t.json.product_tours:[];this.uf=i,n&&n.register({[gi]:i}),e(i,{isLoaded:!0})}})}getActiveProductTours(e){N(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)}}},Ku),Zu={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=m._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:L(L({},Hn(e,Yl)),{},{properties:L(L(L({},e.properties),a?{$set:L(L({},e.properties?.$set??{}),a)}:{}),i?{$set_once:L(L({},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)||(Xl.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)||(Xl.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=a?.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,o=new WeakSet,s=(e,t,n)=>{if(!e?.[t])return;let i=e[t];e[t]=n(i),r.push(()=>{e[t]=i})},c=e=>{if(o.has(e))return e;let t=i.pf(e);return t&&o.add(t),t},l=e=>e.map(e=>typeof e==`string`?e:c(e)).filter(e=>!M(e));return s(n,`appendChild`,e=>function(t){let n=c(t);return n?e.call(this,n):t}),s(n,`insertBefore`,e=>function(t,n){let r=c(t);return r?e.call(this,r,n):t}),s(n,`replaceChild`,e=>function(t,n){let r=c(t);return r?e.call(this,r,n):n}),[t.Element?.prototype,t.Document?.prototype,t.DocumentFragment?.prototype].forEach(e=>{s(e,`append`,e=>function(...t){return e.apply(this,l(t))}),s(e,`prepend`,e=>function(...t){return e.apply(this,l(t))})}),[t.Element?.prototype,t.CharacterData?.prototype,t.DocumentType?.prototype].forEach(e=>{s(e,`before`,e=>function(...t){return e.apply(this,l(t))}),s(e,`after`,e=>function(...t){return e.apply(this,l(t))}),s(e,`replaceWith`,e=>function(...t){let n=l(t);return t.length&&!n.length?void 0:e.apply(this,n)})}),s(t.Element?.prototype,`insertAdjacentElement`,e=>function(t,n){let r=c(n);return r?e.call(this,t,r):null}),this.mf=()=>{r.forEach(e=>e()),this.mf=void 0},this.yf()}yf(){let e=!1;return()=>{var t;e||(e=!0,this.cf--,this.cf===0&&((t=this.mf)==null||t.call(this)))}}bf(e,t=!0){let n=this.gf();try{let r=e(n);return t&&n(),r}catch(e){throw n(),e}}setupSiteApp(e){let t=this.apps[e.id],n=()=>{var n;!t.errored&&this.df.length&&(Xl.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,Xl.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){Xl.error(Zl+e.id,t),i(!1)}if(r&&t.loaded)try{n()}catch(n){Xl.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){Xl.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 Xl.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;m[`__$$ph_site_app_${e}`]=this._instance,(r=m.__PosthogExtensions__)==null||(i=r.loadSiteApp)==null||i.call(r,this._instance,t,t=>{if(t)return Xl.error(Zl+e,t)})}else Xl.error(`PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.`)}}}},Qu={tracingHeaders:class{constructor(e){this._instance=e,this.kf=void 0,this.Sf=void 0,this.xf=void 0,this.Nv=()=>{let e=this.Cf();var t,n;e?(A(this.kf)&&(this.kf=(t=m.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null?void 0:t._patchXHR(e,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),A(this.Sf)&&(this.Sf=(n=m.__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;m.__PosthogExtensions__?.tracingHeadersPatchFns?e():(t=m.__PosthogExtensions__)==null||(n=t.loadExternalDependency)==null||n.call(t,this._instance,`tracing-headers`,t=>{if(t)return Il.error(`failed to load script`,t);
2e()})}$f(){return this._instance.config.tracing_headers??this._instance.config.addTracingHeaders??this._instance.config.__add_tracing_headers}Cf(){let e=this.$f();return E(e)?(E(this.xf)?this.xf.splice(0,this.xf.length,...e):this.xf=[...e],e.length>0?this.xf:void 0):(E(this.xf)&&this.xf.splice(0),this.xf=e||void 0,this.xf)}Uv(){var e,t;(e=this.kf)==null||e.call(this),(t=this.Sf)==null||t.call(this),this.kf=void 0,this.Sf=void 0}startIfEnabledOrStop(){this.Cf()?this.qo(this.Nv):this.Uv()}}},$u=L({surveys:class extends tu{constructor(e){var t;super(new su(e),(t=e,{get projectToken(){return t.config.token},kv:new ou(t)})),this._instance=e}Oh(e,t){let n=t.query?dc(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})})}}},Ku),ed={toolbar:class{constructor(e){this.instance=e}Tf(e){m.ph_toolbar_state=e}If(){return m.ph_toolbar_state??0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e=void 0,t=void 0,r=void 0){if(ua(this.instance.config)||!n||!a)return!1;e??=n.location,r??=n.history;try{if(!t){try{n.localStorage.setItem(`test`,`test`),n.localStorage.removeItem(`test`)}catch{return!1}t=n?.localStorage}let i=cu||zo(e.hash,`__posthog`)||zo(e.hash,`state`),a,o=i?Mt(()=>JSON.parse(atob(decodeURIComponent(i))))||Mt(()=>JSON.parse(decodeURIComponent(i))):null;return o&&o.action===`ph_authorize`?(a=o,a.source=`url`,a&&Object.keys(a).length>0&&(o.desiredHash?e.hash=o.desiredHash:r?r.replaceState(r.state,``,e.pathname+e.search):e.hash=``)):(a=JSON.parse(t.getItem(lu)||`{}`),a.source=`localstorage`,delete a.userIntent),!(!a.token||this.instance.config.token!==a.token||(this.loadToolbar(a),0))}catch{return!1}}Mf(e){let t=m.ph_load_toolbar||m.ph_load_editor;!N(t)&&D(t)?t(e,this.instance):uu.warn(`No toolbar load function found`)}loadToolbar(e){let t=!!a?.getElementById(`__POSTHOG_TOOLBAR__`);if(!n||t)return!1;let r=this.instance.requestRouter.region===`custom`&&this.instance.config.advanced_disable_toolbar_metrics,i=L(L({token:this.instance.config.token},e),{},{apiURL:this.instance.requestRouter.endpointFor(`ui`)},r?{instrument:!1}:{});if(n.localStorage.setItem(lu,JSON.stringify(L(L({},i),{},{source:void 0}))),this.If()===2)this.Mf(i);else if(this.If()===0){var o,s;this.Tf(1),(o=m.__PosthogExtensions__)==null||(s=o.loadExternalDependency)==null||s.call(o,this.instance,`toolbar`,e=>{if(e)return uu.error(`[Toolbar] Failed to load`,e),void this.Tf(0);this.Tf(2),this.Mf(i)}),W(n,`turbolinks:load`,()=>{this.Tf(0),this.loadToolbar(i)})}return!0}Ef(e){return this.loadToolbar(e)}maybeLoadEditor(e=void 0,t=void 0,n=void 0){return this.maybeLoadToolbar(e,t,n)}}},td=L({experiments:class e{get Ir(){return this._instance.config}constructor(t){this._instance=t,this.getWebExperimentsAndEvaluateDisplayLogic=(t=!1)=>{this.getWebExperiments(t=>{e.Pf(`retrieved web experiments from the server`),this.Rf=new Map,t.forEach(t=>{if(t.feature_flag_key){var n;this.Rf&&(e.Pf(`setting flag key `,t.feature_flag_key,` to web experiment `,t),(n=this.Rf)==null||n.set(t.feature_flag_key,t));let r=this._instance.getFeatureFlag(t.feature_flag_key);j(r)&&t.variants[r]&&this.Af(t.name,r,t.variants[r].transforms)}else if(t.variants)for(let n in t.variants){let r=t.variants[n];e.Ff(r,this._instance)&&this.Af(t.name,n,r.transforms)}})},t)},this._instance.onFeatureFlags(e=>{this.onFeatureFlags(e)})}initialize(){}onFeatureFlags(t){if(this._is_bot())e.Pf(Eu);else if(!this.Ir.disable_web_experiments){if(N(this.Rf))return this.Rf=new Map,this.loadIfEnabled(),void this.previewWebExperiment();e.Pf(`applying feature flags`,t),t.forEach(e=>{if(this.Rf&&this.Rf?.has(e)){let t=this._instance.getFeatureFlag(e),n=this.Rf?.get(e);t&&n!=null&&n.variants[t]&&this.Af(n.name,t,n.variants[t].transforms)}})}}previewWebExperiment(){let t=e.getWindowLocation();if(t?.search){let n=Lo(t?.search,`__experiment_id`),r=Lo(t?.search,`__experiment_variant`);n&&r&&(e.Pf(`previewing web experiments ${n} && ${r}`),this.getWebExperiments(e=>{this.Of(parseInt(n),r,e)},!1,!0))}}loadIfEnabled(){this.Ir.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}
2getWebExperiments(e,t,n){if(this.Ir.disable_web_experiments&&!n)return e([]);let r=this._instance.get_property(`$web_experiments`);if(r&&!t)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor(`api`,`/api/web_experiments/?token=${this.Ir.token}`),method:`GET`,timestampMode:`query`,callback:t=>e(t.statusCode===200&&t.json&&t.json.experiments||[])})}Of(t,n,r){let i=r.filter(e=>e.id===t);i&&i.length>0&&(e.Pf(`Previewing web experiment [${i[0].name}] with variant [${n}]`),this.Af(i[0].name,n,i[0].variants[n].transforms))}static Ff(t,n){return!N(t.conditions)&&e.Df(t,n)&&e.Lf(t)}static Df(t,n){if(N(t.conditions)||N(t.conditions?.url))return!0;let r=e.getWindowLocation();if(r){let e=La(n,r.href);return!t.conditions?.url||Du[t.conditions?.urlMatchType??`icontains`](t.conditions.url,e)}return!1}static getWindowLocation(){return n?.location}static Lf(e){if(N(e.conditions)||N(e.conditions?.utm))return!0;let t=Ko();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){R.info(`[WebExperiments] ${e}`,t)}Af(t,n,r){this._is_bot()?e.Pf(Eu):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 i&&this._instance?Ic(i,this.Ir.custom_blocked_useragents):void 0}}},Ku),nd={conversations:class{constructor(e){this._instance=e,this.Nf=void 0,this._conversationsManager=null,this.qf=!1,this.ne=null,this.jf=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(this._instance.config.disable_conversations||(this.Bf=e.ok,!e.ok))return;let t=e.config.conversations;N(t)||(F(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||ua(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;let e=m?.__PosthogExtensions__;if(e&&!A(this.Nf)&&this.Nf){if(this.ne&&this.ne.token){this.qf=!0;try{let t=e.initConversations;if(t)return this.Hf(t),void(this.qf=!1);let n=e.loadExternalDependency;if(!n)return void this.zf(qi);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 Ou.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,Ou.info(`Conversations loaded successfully`)}catch(e){this.zf(`Error completing conversations initialization`,e)}else Ou.error(`Cannot complete initialization: remote config is null`)}zf(e,t){Ou.error(e,t),this._conversationsManager=null,this.qf=!1,this.jf=!0}show(){this._conversationsManager?this._conversationsManager.show():Ou.warn(`Conversations not loaded yet.`)}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Nf&&!M(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?`disabled_by_config`:ua(this._instance.config)?`disabled_for_toolbar`:this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?`consent_opted_out`:!1===this.Bf?`remote_config_failed`:A(this.Nf)?this.Bf?`disabled_in_project`:`remote_config_pending`:this.Nf?N(this.ne)||!this.ne.token?`missing_token`:m?.__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 I(function*(){return r._conversationsManager?r._conversationsManager.sendMessage(e,t,n):(Ou.
2warn(ku),null)})()}getMessages(e,t){var n=this;return I(function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(Ou.warn(ku),null)})()}markAsRead(e){var t=this;return I(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(Ou.warn(ku),null)})()}getTickets(e){var t=this;return I(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(Ou.warn(ku),null)})()}requestRestoreLink(e){var t=this;return I(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(Ou.warn(ku),null)})()}restoreFromToken(e){var t=this;return I(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(Ou.warn(ku),null)})()}restoreFromUrlToken(){var e=this;return I(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(Ou.warn(ku),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()}}},rd={logs:class{constructor(e){var t;this._instance=e,this.name=`logs`,this.Uf=!1,this.Wf=!1,this.Vf=!1,this.$=z(`[logs]`),this.Gf=L(L({},this.$),{},{error:(...e)=>{e.some(Iu)||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),n&&W(n,`online`,this.Yf)}np(e,t,n,r){var i;let a=Au((i=this._instance)==null||(i=i.config)==null?void 0:i.logs,n);return[new sr(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},Nu)),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,r,i;this.xo||(this.xo=!0,this.pp(),(e=this.To)==null||e.dispose(),this.To=void 0,this.mo=void 0,this.Vf=!1,n?.removeEventListener(`online`,this.Yf),(t=this.gp)==null||t.call(this),this.gp=void 0,(r=this.tp)==null||r.reset(),(i=this.ep)==null||i.reset())}onRemoteConfig(e){var t;if(this.xo)return;let n=e.ok?e.config.logs?.captureConsoleLogs:void 0;N(n)?this.mp():((t=this._instance)==null||(t=t.persistence)==null||t.register({$logs_capture_enabled_server_side:!!n}),n?(this.Uf=!0,this.Wf||this.fp(),this.loadIfEnabled()):this.mp())}reset(){var e,t,n,r;this.pp(),(e=this.tp)==null||e.clearQueue(),this.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[Lr])}dp(){var e,t,n;return!((e=this._instance)!=null&&(t=e.Ya)!=null&&t.call(e))||!!((n=m._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||!m?.console)return;let t=Au((e=this._instance)==null||(e=e.config)==null?void 0:e.logs).maxBufferSize,n=!0;this.Jf.push(()=>{n=!1});for(let e of ju){let r;try{r=Mu(m.console[e])}catch{continue}r&&this.Jf.push(Fl(m.console,e,i=>{let a=(...r)=>{try{n&&this.yp(e,r,t)}catch{}return i.apply(m.console,r)};return a.__rrweb_original__=r,a}))}this.Kf=!0,this.bp=setTimeout(()=>{this.pp()},3e4)}yp(e,t,n){if(this.Kf&&!this.Xf&&t.length!==0){if(this._instance?.is_capturing()){if(n>this.Qf.length){this.Xf=!0;try{this.Qf.push({level:e,args:t,occurredAtMs:Date.now(),context:this.rp()})}finally{this.Xf=!1}}}else this.pp()}}pp(){if(this.Qf=[],this.Kf){this.Kf=!1,this.bp&&=(clearTimeout(this.bp),void 0);for(let e of this.Jf)e();this.Jf=[]}}_p(){let e=this.Qf;return this.pp(),e}get logger(){return this.wp||={trace:(e,t)=>this.captureLog({body:e,level:`trace`,attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:`debug`,attributes:t}),info:(e,t)=>this.captureLog({body:e,level:`info`,attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:`warn`,attributes:t}),error:(e,t)=>
2this.captureLog({body:e,level:`error`,attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:`fatal`,attributes:t})},this.wp}flushLogs(e){e?this.kp(e):(this.tp&&this.tp.flush().catch(e=>this.Sp(e)),this.ep&&this.ep.flush().catch(e=>this.Sp(e)))}Sp(e){Iu(e)||this.$.error(`PostHog logs flush failed:`,e)}loadIfEnabled(){if(this.xo||!this.Uf||this.Wf||this.Vf)return;let e=m?.__PosthogExtensions__;if(!e)return this.$.error(`PostHog Extensions not found.`),void this.pp();let t=e.loadExternalDependency;if(!t)return this.$.error(qi),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===_.LogsQueue?e():void 0,setPersistedProperty(e,n){e===_.LogsQueue&&t(n??[])},js:e=>this.js(e),getLibraryId:()=>B.LIB_NAME,getLibraryVersion:()=>B.LIB_VERSION}}js(e){return new Promise(t=>{if(Bo(this.od,3))return void t({kind:`fatal`,error:Fu(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:Fu(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:Fu(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=Vo(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,B.LIB_NAME,e=>{this.nl=e}),this.Zf.length>0&&this.$p(e,this.Zf,this.cp,Nu,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=rr(a,nr(n,B.LIB_NAME,B.LIB_VERSION),r,B.LIB_VERSION);this._instance._send_request({method:`POST`,url:this.xp(),data:o,compression:`best-available`,batchKey:`logs`,transport:e})}xp(){return this._instance.requestRouter.endpointFor(`api`,`/i/v1/logs`)+`?token=`+encodeURIComponent(this._instance.config.token)}rp(){var e;let t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){let{sessionId:e,windowId:n,sessionStartTimestamp:r,lastActivityTimestamp:i}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);t.sessionId=e,t.windowId=n,N(r)||(t.sessionStartTimestamp=r),N(i)||(t.lastActivityTimestamp=i)}if(m!=null&&(e=m.location)!=null&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?jt(m.location.href):m.location.href),this._instance.featureFlags){let e=this._instance.featureFlags.getFlags();e&&e.length>0&&(t.activeFeatureFlags=e)}return t}}},id={metrics:class{constructor(e){this._instance=e,this.$=z(`[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=Wu(e,n),i=Gu(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 dr(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:()=>B.LIB_NAME,getLibraryVersion:()=>B.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(L(L({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)}}};Cl.__defaultExtensionClasses=L({},L(L(L(L(L(L(L(L(L(L(L(L(L({},Ku),qu),Ju),Yu),Xu),Zu),$u),Qu),ed),td),nd),rd),id));var ad=function(){B.SDK_DIST_CHANNEL=`npm`;let e=ol[_l]=new Cl;return function(){function e(){e.done||(e.done=!0,wc=!1,H(ol,function(e){e._dom_loaded()}))}a?.addEventListener?a.readyState===`complete`?e():W(a,`DOMContentLoaded`,e,{capture:!1}):n&&R.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),e}(),od=!1,sd=new Map(t.map(e=>[e.toLowerCase(),e]));function cd(e){if(typeof e==`string`&&e.length!==0)try{let t=typeof window<`u`&&window.location?.origin?window.location.origin:`https://readfrog.local`;return new URL(e,t).pathname}catch{return}}function ld(e){let t=cd(e);if(!t)return;let[n,...r]=t.split(`/`).filter(Boolean),i=n?sd.get(n.toLowerCase()):void 0,a=i?r:[n,...r].filter(Boolean);return{...i?{page_locale:i}:{},page_path_normalized:a.length>0?`/${a.join(`/`)}`:`/`}}var ud=new Set([`token`]),dd=`redacted`,fd=/url|referr/i,pd=`https://readfrog.local`,md=2;function hd(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)}function gd(e,t=0){if(typeof e!=`string`||!e.includes(`?`)||t>md)return;let n=hd(e),r;try{r=new URL(e,pd)}catch{return}let i=!1;for(let[e,n]of[...r.searchParams]){if(ud.has(e)){r.searchParams.set(e,dd),i=!0;continue}let a=gd(n,t+1);a!==void 0&&(r.searchParams.set(e,a),i=!0)}if(i)return n?r.toString():`${r.pathname}${r.search}${r.hash}`}function _d(e){if(!e)return;let t;for(let[n,r]of Object.entries(e)){if(!fd.test(n))continue;let i=gd(r);i!==void 0&&(t??={...e},t[n]=i)}return t}var vd=e=>{if(!e)return e;let t=e,n=_d(t.properties);n&&(t={...t,properties:n});for(let e of[`$set`,`$set_once`]){let n=_d(t[e]);n&&(t={...t,[e]:n})}if(t.event!==`$pageview`)return t;let r=ld(t.properties.$current_url);return r?{...t,properties:{...t.properties,...r}}:t};function yd(){if(typeof window>`u`||od||!e.VITE_POSTHOG_API_KEY)return od;let t={api_host:e.VITE_POSTHOG_HOST,autocapture:!1,before_send:vd,capture_pageleave:!0,capture_pageview:`history_change`,disable_session_recording:!0};try{ad.init(e.VITE_POSTHOG_API_KEY,t),od=!0}catch(e){console.error(`Failed to initialize website analytics`,e)}return od}function bd(e,t){if(yd())try{ad.capture(e,t)}catch(e){console.error(`Failed to capture website analytics event`,e)}}function xd(e,t){if(yd())try{ad.identify(e,t)}catch(e){console.error(`Failed to identify website analytics user`,e)}}function Sd(){if(od)try{ad.reset()}catch(e){console.error(`Failed to reset website analytics`,e)}}export{Sd as i,xd as n,yd as r,bd as t};
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.