PageSourceSearch

https://www.academicjobs.com/_next/static/chunks/b468fba8.56e6ca5f05932c04.js

js academicjobs.com collected 2026-10-02 10:05:04 UTC 306,220 bytes, 2 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[89432],{56122:(e,t,i)=>{let s,r,n,o,a,l,u,h;i.r(t),i.d(t,{Compression:()=>nF,DEFAULT_PRODUCT_TOUR_APPEARANCE:()=>nW,DisplaySurveyType:()=>nz,PostHog:()=>aC,ProductTourEventName:()=>nG,ProductTourEventProperties:()=>nJ,SurveyEventName:()=>nq,SurveyEventProperties:()=>nH,SurveyEventType:()=>nA,SurveyPosition:()=>nL,SurveyQuestionBranchingType:()=>nB,SurveyQuestionType:()=>nj,SurveySchedule:()=>nU,SurveyTabPosition:()=>nD,SurveyType:()=>nN,SurveyWidgetType:()=>nM,default:()=>lW,posthog:()=>lV,severityLevels:()=>nZ});let c="u">typeof window?window:void 0,d="u">typeof globalThis?globalThis:c,p=null==d?void 0:d.navigator,f=null==d?void 0:d.document,g=null==d?void 0:d.location,_=null==d?void 0:d.fetch,v=(null==d?void 0:d.XMLHttpRequest)&&"withCredentials"in new d.XMLHttpRequest?d.XMLHttpRequest:void 0,m=null==d?void 0:d.AbortController,y=null==d?void 0:d.CompressionStream,b=null==p?void 0:p.userAgent;function w(){return!(!c||!1===c.navigator.onLine)}let E="u">typeof globalThis?globalThis:c;E&&"u"<typeof self&&(E.self=E),E&&"u"<typeof File&&(E.File=function(){});let x=null!=c?c:{},k="0.9.0",S={DEBUG:!1,LIB_VERSION:k,LIB_NAME:"browser-common",JS_SDK_VERSION:k};var $,I,P,T,O=((I={}).AnonymousId="anonymous_id",I.DistinctId="distinct_id",I.Props="props",I.EnablePersonProcessing="enable_person_processing",I.PersonMode="person_mode",I.FeatureFlagDetails="feature_flag_details",I.FeatureFlags="feature_flags",I.FeatureFlagPayloads="feature_flag_payloads",I.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",I.BootstrapFeatureFlags="bootstrap_feature_flags",I.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",I.OverrideFeatureFlags="override_feature_flags",I.Queue="queue",I.AiQueue="ai_queue",I.AiCaptureQueue="ai_capture_queue",I.LogsQueue="logs_queue",I.OptedOut="opted_out",I.SessionId="session_id",I.SessionStartTimestamp="session_start_timestamp",I.SessionLastTimestamp="session_timestamp",I.PersonProperties="person_properties",I.GroupProperties="group_properties",I.InstalledAppBuild="installed_app_build",I.InstalledAppVersion="installed_app_version",I.SessionReplay="session_replay",I.PushRegistered="push_registered",I.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",I.SurveyLastSeenDate="survey_last_seen_date",I.SurveysInProgress="surveys_in_progress",I.SurveysSeen="surveys_seen",I.Surveys="surveys",I.RemoteConfig="remote_config",I.FlagsEndpointWasHit="flags_endpoint_was_hit",I.DeviceId="device_id",I),C=((P={}).GZipJS="gzip-js",P.Base64="base64",P);let R=["$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"],F=["token"];function A(e,t){return -1!==e.indexOf(t)}let M=function(e){return e.trim()},L=function(e){return e.replace(/^\$/,"")};function D(e){var t;let i=[];return null!=(t=JSON.stringify(e,function(e,t){if("bigint"==typeof t)return t.toString();if("function"!=typeof t&&"symbol"!=typeof t){if(t instanceof Error)return{name:t.name,message:t.message,stack:t.stack};if(t&&"object"==typeof t){for(;i.length>0&&i[i.length-1]!==this;)i.pop();if(i.includes(t))return"[Circular]";i.push(t)}return t}}))?t:"null"}let N=Object.prototype,j=N.hasOwnProperty,B=N.toString,U=Array.isArray||function(e){return"[object Array]"===B.call(e)},q=e=>"function"==typeof e,H=e=>e===Object(e)&&!U(e),z=e=>{if(H(e)){for(let t in e)if(j.call(e,t))return!1;return!0}return!1},V=e=>void 0===e,W=e=>"[object String]"==B.call(e),G=e=>W(e)&&0===e.trim().length,J=e=>null===e,K=e=>V(e)||J(e),Y=e=>"[object Number]"==B.call(e)&&e==e,X=e=>Y(e)&&e>0,Q=e=>"[object Boolean]"===B.call(e),Z=e=>A(R,e),ee=e=>A(F,e);function et(e){return null===e||"object"!=typeof e}function ei(e,t){return({}).toString.call(e)===`[object ${t}]`}function es(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 en(e,Error)}}function er(e){return"u">typeof Event&&en(e,Event)}function en(e,t){try{return e instanceof t}catch(e){return!1}}let eo=[!0,"true",1,"1","yes"],ea=[!1,"false",0,"0","no"];function el(e,t,i,s,r,n,o){try{var a=e[n](o),l=a.value}catch(e){return void i(e)}a.done?t(l):Promise.resolve(l).then(s,r)}function eu(e){return function(){var t=this,i=arguments;return new Promise(function(s,r){var n=e.apply(t,i);function o(e){el(n,s,r,o,a,"next",e)}function a(e){el(n,s,r,o,a,"throw",e)}o(void 0)})}}let eh=["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","hub
1spot","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"],ec=function(e,t=[]){if(!e)return!1;let i=e.toLowerCase();return eh.concat(t).some(e=>{let t=e.toLowerCase();return -1!==i.indexOf(t)})};function ed(e,t,i,s,r){return t>i&&(s.warn("min cannot be greater than max."),t=i),Y(e)?e>i?(s.warn(" cannot be  greater than max: "+i+". Using max value instead."),i):t>e?(s.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(s.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+r),ed(null!=r?r:i,t,i,s))}var ep=class{constructor(e){this.C={},this.I=e.I,this.R=ed(e.bucketSize,0,100,e.A),this.$=ed(e.refillRate,0,this.R,e.A),this.O=ed(e.refillInterval,0,864e5,e.A)}F(e,t){let i=Math.floor((t-e.lastAccess)/this.O);i>0&&(e.tokens=Math.min(e.tokens+i*this.$,this.R),e.lastAccess=e.lastAccess+i*this.O)}consumeRateLimit(e){var t;let i=Date.now(),s=String(e),r=this.C[s];return r?this.F(r,i):(r={tokens:this.R,lastAccess:i},this.C[s]=r),0===r.tokens||(r.tokens--,0===r.tokens&&(null==(t=this.I)||t.call(this,e)),0===r.tokens)}stop(){this.C={}}};let ef="Mobile",eg="Android",e_="Tablet",ev="Android Tablet",em="iPad",ey="Apple Watch",eb="Safari",ew="BlackBerry",eE="Samsung Internet",ex="Chrome",ek="Chrome iOS",eS="Internet Explorer",e$="Internet Explorer Mobile",eI="Opera",eP="Microsoft Edge",eT="Firefox",eO="Firefox iOS",eC="Nintendo",eR="PlayStation",eF="Xbox",eA="Android Mobile",eM="Mobile Safari",eL="Windows",eD="Windows Phone",eN="Nokia",ej="Ouya",eB="Generic "+ef.toLowerCase(),eU="Generic "+e_.toLowerCase(),eq="Konqueror",eH="Oculus Browser",ez="Vivaldi",eV="Yandex",eW="Whale",eG="DuckDuckGo",eJ="Pale Moon",eK="Waterfox",eY="Brave",eX="Claude",eQ="Codex",eZ="ChatGPT",e0="Google Search App",e1=RegExp("Version/(\\d+(\\.\\d+)?)"),e2=RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),e3=RegExp(eF,"i"),e5=RegExp("PlayStation \\w+","i"),e4=RegExp("Nintendo \\w+","i"),e6=RegExp("BlackBerry|PlayBook|BB10","i"),e8={"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"},e9=function(e,t,i,s){var r;return t=t||"",((null==i?void 0:i.brave)?eY:null)||((null==s?void 0:s.detectGoogleSearchApp)&&A(e,"GSA/")?e0:A(e," OPR/")&&A(e,"Mini")?"Opera Mini":A(e," OPR/")?eI:e6.test(e)?ew:A(e,"IEMobile")||A(e,"WPDesktop")?e$:A(e,"OculusBrowser")?eH:A(e,"SamsungBrowser")?eE:A(e,"Edge")||A(e,"Edg/")?eP:A(e,"Vivaldi/")?ez:A(e,"YaBrowser/")?eV:A(e,"Whale/")?eW:A(e,"DuckDuckGo/")||A(e,"Ddg/")?eG:A(e,"Claude/")?eX:A(e,"Codex/")?eQ:A(e,"ChatGPT/")?eZ:A(e,"FBIOS")?"Facebook Mobile":A(e,"UCWEB")||A(e,"UCBrowser")?"UC Browser":A(e,"CriOS")?ek:A(e,"CrMo")||A(e,ex)?ex:A(e,eg)&&A(e,eb)?eA:A(e,"FxiOS")?eO:A(e.toLowerCase(),eq.toLowerCase())?eq:A(e,"Brave/")?eY:(r=t)&&A(r,"Apple")||A(e,eb)&&!A(e,ex)&&!A(e,eg)?A(e,ef)?eM:eb:A(e,"PaleMoon/")?eJ:A(e,"Waterfox/")?eK:A(e,eT)?eT:A(e,"MSIE")||A(e,"Trident/")?eS:A(e,"Gecko")?eT:"")},e7={[e$]:[RegExp("rv:(\\d+(\\.\\d+)?)")],[eP]:[RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[ex]:[RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[ek]:[RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[eb]:[e1],[eM]:[e1],[eI]:[RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[eT]:[RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[eO]:[RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[eq]:[RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[ew]:[RegExp("BlackBerry (\\d+(\\.\\d+)?)"),e1],[eA]:[RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[eE]:[RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[eH]:[RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[ez]:[RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[eV]:[RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[eW]:[RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[eY]:[RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[eX]:[e2],[eQ]:[e2],[eZ]:[e2],[eG]:[RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[eJ]:[RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[eK]:[RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[e0]:[RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[eS]:[RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[RegExp("rv:(\\d+(\\.\\d+)?)")]},te=function(e,t,i,s){let r=e7[e9(e,t,i,s)];if(V(r))return null;for(let t=0;r.length>t;t++){let i=e.match(r[t]);if(i)return parseFloat(i[i.length-2])}return null},tt=[[RegExp("Xbox; Xbox (.*?)[);]","i"),e=>[eF,e&&e[1]||""]],[RegExp(eC,"i"),[eC,""]],[RegExp(eR,"i"),[eR,""]],[e6,[ew,""]],[RegExp(eL,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[eD,""];if(new RegExp(ef).test(t)&&!/IEMobile\b/.test(t))return["Windows Mobile",""];let i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){let e=e8[i[1]]||"";return/arm/i.test(t)&&(e="RT"),[eL,e]}return[eL,""]}],[/((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=V(e[2])?e[3]:e[2]),["watchOS",t]}],[RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),e=>e&&e[2]?[eg,[e[2],e[3],e[4]||"0"].join(".")]:[eg,""]],[/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",""]]],ti=function(e){for(let t=0;tt.length>t;t++){let[i,s]=tt[t],r=i.exec(e),n=r&&(q(s)?s(r,e):s);if(n)return n}return["",""]},ts=function(e){return e4.test(e)?eC:e5.test(e)?eR:e3.test(e)?eF:RegExp(ej,"i").test(e)?ej:RegExp("(Windows Phone|WPDesktop)","i").test(e)?eD:/iPad/.test(e)?em:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?ey:e6.test(e)?ew:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":RegExp(eN,"i").test(e)?eN:/(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(ef).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)?eg:ev:RegExp("(pda|Mobile)","i").test(e)?eB:RegExp(e_,"i").test(e)&&!RegExp("Tablet pc","i").test(e)?eU:""},tr=function(e,t){var i,s,r,n;let o=ts(e);return o===em||o===ev||"Kobo"===o||"Kindle Fire"===o||o===eU?e_:o===eC||o===eF||o===eR||o===ej?"Console":o===ey?"Wearable":o?ef:"Android"===(null==t?void 0:t.userAgentDataPlatform)&&(null!=(n=null==t?void 0:t.maxTouchPoints)?n:0)>0?600>Math.min(null!=(i=null==t?void 0:t.screenWidth)?i:0,null!=(s=null==t?void 0:t.screenHeight)?s:0)/(null!=(r=null==t?void 0:t.devicePixelRatio)?r:1)?ef:e_:"Desktop"},tn=/\bFBAV\/(\d+(?:\.\d+)*)/i,to=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",tn],[/\bFBAN\/EMA\b/i,"Facebook Lite",tn],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",tn],[/\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"]],ta="[Truncated]",tl="[Unserializable]";function tu(e){let t="";for(let i=0;e.length>i;i++){let s=e.charCodeAt(i);if(55296>s||s>56319)t+=56320>s||s>57343?e[i]:"�";else{let s=e.charCodeAt(i+1);56320>s||s>57343?t+="�":(t+=e[i]+e[i+1],i++)}}return t}function th(e,t){if(!t)return e;let i=[];try{i=Object.keys(t)}catch(e){i=[]}for(let s of i){let i;try{i=t[s]}catch(e){i=tl}Object.defineProperty(e,s,{value:i,enumerable:!0,writable:!0,configurable:!0})}return e}var tc=class{record(e){if("too-large"===e.kind)return;if("retry-later"!==e.kind)return void this.reset();if(!e.retryAfterMs)return;let t=this.isOpen(),i=Date.now(),s=Math.min(e.retryAfterMs,3e5);t?this.es=Math.max(this.es,Math.min(i+s,this.ts+3e5)):(this.ts=i,this.es=i+s)}remainingMs(){let e=Date.now();if(this.ts-5e3>e)return this.reset(),0;let t=Math.min(3e5,Math.max(0,this.es-e));return 0===t&&this.reset(),t}isOpen(){return this.remainingMs()>0}reset(){this.es=0,this.ts=0}constructor(){this.es=0,this.ts=0}};let td=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function tp(e,t){return"string"==typeof e&&td.test(e)?e:t()}function tf(e,t){let i=Error(t);try{Object.defineProperty(i,"name",{value:e,writable:!0,enumerable:!0,configurable:!0})}catch(e){}return i}function tg(e){return e?e.split("#")[0]:e}function t_(e){try{return e()}catch(e){return}}function tv(e,t){let i=setTimeout(e,t);return null!=i&&i.unref&&(null==i||i.unref()),i}function tm(e,t,i){return ty.apply(this,arguments)}function ty(){return(ty=eu(function*(e,t,i){let s;try{return yield Promise.race([e,new Promise((e,r)=>{s=tv(()=>{try{null==i||i(),e()}catch(e){r(e)}},t)})])}finally{clearTimeout(s)}})).apply(this,arguments)}function tb(e){return(tb="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function tw(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,s)}return i}function tE(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?tw(Object(i),!0).forEach(function(t){!function(e,t,i){var s;(s=function(e){if("object"!=tb(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var i=t.call(e,"string");if("object"!=tb(i))return i;throw TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t),(t="symbol"==tb(s)?s:s+"")in e)?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i}(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):tw(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}var tx=class{constructor(e,t,i=[]){this.coercers=e,this.stackParser=t,this.modifiers=i}buildFromUnknown(e,t={}){let i=t&&t.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(i,t,0).apply(e),r=this.buildParsingContext(t),n=this.parseStacktrace(s,r);return{$exception_list:this.convertToExceptionList(n,i),$exception_level:"error"}}modifyFrames(e){var t=this;return eu(function*(){for(let i of e)i.stacktrace&&i.stacktrace.frames&&U(i.stacktrace.frames)&&(i.stacktrace.frames=yield t.applyModifiers(i.stacktrace.frames));return e})()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:null==(t=e.syntheticException)?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var i;let s,r;if(null!=e.cause&&(s=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack)try{r=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.ski
1pFirstLines:0),t.chunkIdMap)}catch(e){}return tE(tE({},e),{},{cause:s,stack:r,errors:null==(i=e.errors)?void 0:i.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 i of this.coercers)if(i.match(e))return i.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return eu(function*(){let i=e;for(let e of t.modifiers)i=yield e(i);return i})()}convertToExceptionList(e,t){let i=[],s=(e,r,n)=>{var o;let a=i.length,l=void 0===r?tE(tE({type:"string"==typeof t.type&&t.type.length>0?t.type:"generic"},"boolean"==typeof t.handled?{handled:t.handled}:void 0===t.handled?{handled:!0}:{}),{},{synthetic:"boolean"==typeof t.synthetic?t.synthetic:e.synthetic,exception_id:a}):{type:"chained",source:n,synthetic:e.synthetic,exception_id:a,parent_id:r},u={type:e.type,value:e.value,mechanism:l};for(let t of(e.stack&&(u.stacktrace={type:"raw",frames:e.stack}),i.push(u),e.cause&&s(e.cause,a,"cause"),null!=(o=e.errors)?o:[]))s(t,a,"member")};return s(e),i}buildParsingContext(e){var t;return{chunkIdMap:function(e){let t=globalThis._posthogChunkIds;if(!t)return;let i=Object.keys(t);return n&&i.length===r||(r=i.length,n=i.reduce((i,r)=>{s||(s={});let n=s[r];if(n)i[n[0]]=n[1];else{let n=e(r);for(let e=n.length-1;e>=0;e--){let o=n[e],a=null==o?void 0:o.filename,l=t[r];if(a&&l){i[a]=l,s[r]=[a,l];break}}}return i},{})),n}(this.stackParser),skipFirstLines:null!=(t=e.skipFirstLines)?t:1}}getAggregateErrors(e){try{if(es(e)){let i=Object.getPrototypeOf(e);for(let s=0;i&&100>s;s++){var t;let s=null==(t=Object.getOwnPropertyDescriptor(i,"constructor"))?void 0:t.value;if("function"==typeof s&&"AggregateError"===s.name){let t=e.errors;return U(t)?t:void 0}i=Object.getPrototypeOf(i)}}}catch(e){}}buildCoercingContext(e,t,i=0){let s=0,r=0,n=!1,o=new Set,a=[],l={},u=(e,t,i=0)=>{let u,c,d=h(t,i),p=d.apply;if(d.apply=t=>{a.push(e);try{return p(t)}finally{a.pop()}},i>4||i>0&&-1!==a.indexOf(e))return this.coerceFallback(d);let f="object"==typeof e&&null!==e||"function"==typeof e;if(0===i&&s>=50||f&&o.has(e))return;f&&o.add(e),0===i&&s++;let g=this.getAggregateErrors(e);n||(n=!!g);try{if(!(u=this.applyCoercers(e,d)))throw l}catch(e){if(e===l)return void(0===i&&s--);if(!n)throw e;u=this.coerceFallback(d)}if(!g||s>=50)return u;try{c=g.length}catch(e){return u}if(!Number.isInteger(c)||0>c||c>0xffffffff)return u;let _=[];for(let e=0;50>s&&1e3>r&&c>e;e++){let i;r++;try{i=d.next(g[e])}catch(e){s++,i=this.coerceFallback(h(t+1))}i&&_.push(i)}return tE(tE({},u),{},{errors:_})},h=(i,s=0)=>tE(tE({},t),{},{syntheticException:0==i?t.syntheticException:void 0,mechanism:0==i?e:{},apply(e){let t=u(e,i,s+1);if(!t)throw l;return t},next:e=>u(e,i+1)}),c=h(i);return tE(tE({},c),{},{apply:e=>{var t;return null!=(t=u(e,i))?t:this.coerceFallback(c)}})}};let tk=/^([a-z][a-z0-9.+-]+):/i,tS=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function t$(e,t,i,s,r){let n={platform:e,filename:t,function:"<anonymous>"===i?"?":i,in_app:function(e){if(!e||"<anonymous>"===e)return!1;let t=tk.exec(e);return!t||tS.includes(t[1].toLowerCase())}(t)};return V(s)||(n.lineno=s),V(r)||(n.colno=r),n}let tI=(e,t)=>{let i=-1!==e.indexOf("safari-extension"),s=-1!==e.indexOf("safari-web-extension");return i||s?[-1!==e.indexOf("@")?e.split("@")[0]:"?",i?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},tP=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,tT=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,tO=/\((\S*)(?::(\d+))(?::(\d+))\)/,tC=(e,t)=>{let i=tP.exec(e);if(i){let[,e,s,r]=i;return t$(t,e,"?",+s,+r)}let s=tT.exec(e);if(s){if(s[2]&&0===s[2].indexOf("eval")){let e=tO.exec(s[2]);e&&(s[2]=e[1],s[3]=e[2],s[4]=e[3])}let[e,i]=tI(s[1]||"?",s[2]);return t$(t,i,e,s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}},tR=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,tF=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,tA=(e,t)=>
1{let i=tR.exec(e);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){let e=tF.exec(i[3]);e&&(i[1]=i[1]||"eval",i[3]=e[1],i[4]=e[2],i[5]="")}let e=i[3],s=i[1]||"?";return[s,e]=tI(s,e),t$(t,e,s,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},tM=/\(error: (.*)\)/;function tL(e,t){return e.filename===t.filename&&e.function===t.function&&e.module===t.module&&e.lineno===t.lineno&&e.colno===t.colno}function tD(e,t){let i=t.start;for(;i>0&&tL(e[i-1],e[i-1+t.length]);)i--;return t.start-i}function tN(e,t){let i=t.start+t.length,s=i;for(;e.length>s&&tL(e[s],e[s-t.length]);)s++;return s-i}var tj=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){let i=W(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:i?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 ei(e,"DOMException")}isDOMError(e){return ei(e,"DOMError")}},tB=class{match(e){return es(e)}coerce(e,t){var i;let s=this.getStack(e),r=void 0===s?null==(i=t.syntheticException)?void 0:i.stack:void 0;return{type:this.getType(e),value:this.getMessage(e,t),stack:null!=s?s:r,cause:e.cause?t.next(e.cause):void 0,synthetic:!!r}}getType(e){return e.name||e.constructor.name}getMessage(e,t){let i=e.message;return String(i.error&&"string"==typeof i.error.message?i.error.message:i)}getStack(e){try{let t=e.stacktrace;if("string"==typeof t&&t.length>0)return t;let i=e.stack;return"string"==typeof i&&i.length>0?i:void 0}catch(e){return}}},tU=class{match(e){return!!ei(e,"ErrorEvent")&&(null!=e.error||this.ar(e))}coerce(e,t){var i;if(null!=e.error)return t.apply(e.error);let s=t.apply(e.message);return tE(tE({},s),{},{stack:null!=(i=this.lr(e))?i:s.stack,synthetic:!0})}ar(e){return W(e.message)&&e.message.length>0}lr(e){var t,i;let s=null!=(t=e.lineno)?t:0,r=null!=(i=e.colno)?i:0;if(W(e.filename)&&0!==e.filename.length&&0!==s)return`Error
2    at ${e.filename}:${s}:${r}`}};let tq=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var tH=class{match(e){return"string"==typeof e}coerce(e,t){var i;let[s,r]=this.getInfos(e);return{type:null!=s?s:"Error",value:null!=r?r:e,stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}getInfos(e){let t="Error",i=e,s=e.match(tq);return s&&(t=s[1],i=s[2]),[t,i]}};let tz=["fatal","error","warning","log","info","debug"];function tV(e,t=40){let i=Object.keys(e);if(i.sort(),!i.length)return"[object has no keys]";for(let e=i.length;e>0;e--){let s=i.slice(0,e).join(", ");if(t>=s.length)return e===i.length?s:s.length>t?`${s.slice(0,t)}...`:s}return""}var tW=class{match(e){return"object"==typeof e&&null!==e}coerce(e,t){var i,s;let r=this.getErrorPropertyFromObject(e);return r?t.apply(r):{type:this.getType(e),value:this.getValue(e),stack:null!=(i=this.getStack(e))?i:null==(s=t.syntheticException)?void 0:s.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){if(er(e))return e.constructor.name;let t="name"in e?e.name:void 0;return W(t)&&!G(t)?t:"Error"}getValue(e){if("name"in e&&"string"==typeof e.name){let t=`'${e.name}' captured as exception`;return"message"in e&&"string"==typeof e.message&&(t+=` with message: '${e.message}'`),t}if("message"in e&&"string"==typeof e.message)return e.message;let t=this.getObjectClassName(e);return`${t&&"Object"!==t?`'${t}'`:"Object"} captured as exception with keys: ${tV(e)}`}isSeverityLevel(e){return W(e)&&!G(e)&&tz.indexOf(e)>=0}getStack(e){try{return W(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:W(e.stack)&&e.stack.length>0?e.stack:void 0}catch(e){return}}getErrorPropertyFromObject(e){for(let t in e)if(({}).hasOwnProperty.call(e,t)){let i=e[t];if(es(i))return i}}getObjectClassName(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}},tG=class{match(e){return er(e)}coerce(e,t){var i;let s=e.constructor.name;return{type:s,value:`${s} captured as exception with keys: ${tV(e)}`,stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}},tJ=class{match(e){return et(e)}coerce(e,t){var i;return{type:"Error",value:`Primitive value captured as exception: ${String(e)}`,stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}},tK=class{match(e){return ei(e,"PromiseRejectionEvent")||this.isCu
2stomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!er(e))return!1;try{let t=e.detail;return null!=t&&"object"==typeof t&&"reason"in t}catch(e){return!1}}coerce(e,t){var i;let s=this.getUnhandledRejectionReason(e);return et(s)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(s)}`,stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}:t.apply(s)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&null!=e.detail&&"object"==typeof e.detail&&"reason"in e.detail)return e.detail.reason}catch(e){}return e}};let tY="$message",tX="$timestamp",tQ=new Set([tY,tX]),tZ={enabled:!0,max_bytes:32768};function t0(e){var t;return e?{enabled:null!=(t=e.enabled)?t:tZ.enabled,max_bytes:function(e,t){if(!Y(e)||1/0===e||-1/0===e)return t;let i=Math.floor(e);return 0>i?t:i}(e.max_bytes,tZ.max_bytes)}:tE({},tZ)}var t1=class{constructor(e){this.ns=[],this.ss=0,this.Ir=t0(e)}setConfig(e){this.Ir=t0(e),this.rs()}add(e){let t=function(e){let t;try{t=D(e)}catch(e){return}try{let e=JSON.parse(t);if(!H(e))return;let i=e[tY],s=e[tX];if(!W(i)||0===i.trim().length||!W(s)&&!Y(s))return;return{step:e,json:t}}catch(e){return}}(e);if(!t)return;let i=function(e){if("u">typeof TextEncoder)return(new TextEncoder).encode(e).length;let t=encodeURIComponent(e),i=0;for(let e=0;t.length>e;e++)"%"===t[e]?(i+=1,e+=2):i+=1;return i}(t.json);i>this.Ir.max_bytes||(this.ns.push({step:t.step,bytes:i}),this.ss+=i,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)}}};let t2=e=>{if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){return e}};function t3(e){return"string"==typeof e||e}function t5(e){return"string"==typeof e?e:void 0}let t4=["$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"],t6="NativeGzipValidationError",t8=e=>e.length>=2&&31===e[0]&&139===e[1],t9=(e,t)=>
2e===C.GZipJS||t===C.GZipJS||"gzip"===t,t7=e=>!(!e||"object"!=typeof e)&&"NotReadableError"===("name"in e?String(e.name):""),ie=e=>{throw tf(t6,`Native gzip produced invalid output: ${e}`)},it=(T=eu(function*(e,t){18>e.size&&ie("too-short");let i=new Uint8Array((yield e.slice(0,10).arrayBuffer()));t8(i)&&8===i[2]||ie("invalid-header");let s=new DataView((yield e.slice(e.size-8).arrayBuffer()));s.getUint32(0,!0)!==(e=>{let t=(()=>{if(o)return o;o=[];for(let e=0;256>e;e++){let t=e;for(let e=0;8>e;e++)t=1&t?0xedb88320^t>>>1:t>>>1;o[e]=t>>>0}return o})(),i=0xffffffff;for(let s=0;e.length>s;s++)i=t[255&(i^e[s])]^i>>>8;return(0xffffffff^i)>>>0})(t)&&ie("invalid-crc");let r=t.length>>>0;s.getUint32(4,!0)!==r&&ie("invalid-size")}),function(e,t){return T.apply(this,arguments)});function ii(){return(ii=eu(function*(e,t=!0,i){var s;try{let t=(new TextEncoder).encode(e),i=new globalThis.CompressionStream("gzip"),r=i.writable.getWriter(),n=r.write(t).then(()=>r.close()).catch((s=eu(function*(e){try{yield r.abort(e)}catch(e){}throw e}),function(e){return s.apply(this,arguments)})),o=new Response(i.readable).blob(),[a]=yield Promise.all([o,n]);return yield it(a,t),a}catch(e){if(null==i?void 0:i.rethrow)throw e;return t&&console.error("Failed to gzip compress data",e),null}})).apply(this,arguments)}function is(e,t){if(null==e)return{};var i,s,r=function(e,t){if(null==e)return{};var i={};for(var s in e)if(({}).hasOwnProperty.call(e,s)){if(t.includes(s))continue;i[s]=e[s]}return i}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(s=0;n.length>s;s++)t.includes(i=n[s])||({}).propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}let ir={}.propertyIsEnumerable;function io(e,t){try{return ia(e,t,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch(e){return[]}}function ia(e,t,i,s){let r=[];for(let n in e)if(ir.call(e,n)){if(!n){null==t||t.debug("Dropping an attribute with an empty key");continue}if(r.length>=1e3||0>=i.remainingNodes){null==t||t.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{let o=e[n];if(J(o)||V(o))continue;r.push({key:tu(n),value:function e(t,i,s,r){if(0>=s.remainingNodes)return{stringValue:ta};if(s.remainingNodes--,Q(t))return{boolValue:t};if("bigint"==typeof t){let e,s;return e=t.toString(),t>=(s=BigInt("9223372036854775808"))||-s>t?(null==i||i.debug(`Attribute ${e} is outside the int64 range; encoding it as a string`),{stringValue:e}):{intValue:e}}if("number"==typeof t){if(!Number.isFinite(t))return{stringValue:String(t)};if(Number.isInteger(t)){if(Number.isSafeInteger(t))return{intValue:String(t)};if(typeof BigInt>"u")return{stringValue:String(t)};let e=BigInt(t).toString();return t>=0x8000000000000000||-0x8000000000000000>t?(null==i||i.debug(`Attribute ${e} is outside the int64 range; encoding it as a string`),{stringValue:e}):{intValue:e}}return{doubleValue:t}}if("string"==typeof t)return{stringValue:tu(t)};if("function"==typeof t)return{stringValue:"[Function]"};if("symbol"==typeof t)return{stringValue:String(t)};if("object"==typeof t&&null!==t){if(s.ancestors.has(t))return{stringValue:"[Circular]"};if(r>=20)return{stringValue:ta};if(t instanceof Date){let e=Number.isFinite(t.getTime())?t.toISOString():String(t);return{stringValue:"string"==typeof e?tu(e):String(e)}}s.ancestors.add(t);try{try{let n=t.toJSON;if("function"==typeof n)return e(n.call(t),i,s,r+1)}catch(e){}return U(t)?{arrayValue:{values:function(t,i,s,r){let n=[],o=Math.min(t.length,1e3),a=0;for(;o>a&&s.remainingNodes>0;a++)try{let o=a in t?t[a]:void 0;if(K(o))continue;n.push(e(o,i,s,r))}catch(e){n.push({stringValue:tl})}return t.length>a&&n.push({stringValue:ta}),n}(t,i,s,r+1)}}:{kvlistValue:{values:ia(t,i,s,r+1)}}}finally{s.ancestors.delete(t)}}return{stringValue:tu(String(t))}}(o,t,i,s)})}catch(e){r.push({key:tu(n),value:{stringValue:tl}})}}return r}function il(e,t,i){return tE(tE(tE(tE({},th({},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":i})}let iu=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function ih(e,t){let i=th({},e),s={};for(let e of iu)({}).hasOwnProperty.call(i,e)&&(s[e]=i[e],delete i[e]);
2return[...io(i,t),...io(s,t)]}let ic={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"},id={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}},ip=id.info;function ig(e,t,i,s){return{resourceLogs:[{resource:{attributes:ih(t)},scopeLogs:[{scope:{name:i,version:s},logRecords:e}]}]}}var i_=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=tv(()=>{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),this.hs=void 0)}};function iv(){return .75+.5*Math.random()}function im(e,t,i,s){let r=e*Math.pow(2,Math.min(Math.max(0,t-1),6));return Math.round((void 0===s?r:Math.min(r,Math.max(s,e)))*i)}var iy=class{constructor(e,t,i,s,r,n=()=>Promise.resolve(),o){var a;this._instance=e,this.Ir=t,this.A=i,this.cs=s,this.ds=r,this.vs=n,this.fs=o,this.ps=new i_(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new tc,this.ks=0,this.Ss=1,this.xs=0,this.Cs=0,this.$s=!1,this.Ts=t.maxBufferSize,this.Is=Math.max(null!=(a=t.maxQueueSize)?a: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(O.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){var i;if(this._instance.isDisabled||this._instance.optedOut||!(null==e?void 0:e.body))return;let s=this.Os(e);if(null===s)return;if(!s.body)return void this.A.info("Log was rejected in beforeSend function");if(!this.Ds())return;let r={record:function(e,t,i,s){let{text:r,number:n}=id[e.level||"info"]||ip,o=function(e=Date.now()){return String(e)+"000000"}(Y(s)?s:void 0),a={};t.distinctId&&(a.posthogDistinctId=t.distinctId),t.sessionId&&(a.sessionId=t.sessionId),t.windowId&&(a["window.id"]=t.windowId),K(t.sessionStartTimestamp)||(a.sessionStartTimestamp=String(t.sessionStartTimestamp)),K(t.lastActivityTimestamp)||(a.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(a["url.full"]=t.currentUrl),t.screenName&&(a["screen.name"]=t.screenName),t.appState&&(a["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(a.feature_flags=t.activeFeatureFlags);let l=tE({},a),u=e.attributes;if(u){let e=[];try{e=Object.keys(u)}catch(t){e=[]}for(let t of e){let e;try{e=u[t]}catch(t){e=tl}Object.defineProperty(l,t,{value:e,enumerable:!0,writable:!0,configurable:!0})}}let h={timeUnixNano:o,observedTimeUnixNano:o,severityNumber:n,severityText:r,body:{stringValue:function(e){try{return tu(String(e))}catch(e){return tl}}(e.body)},attributes:io(l,i)};return e.trace_id&&(h.traceId=e.trace_id),e.span_id&&(h.spanId=e.span_id),V(e.trace_flags)||(h.flags=e.trace_flags),h}(s,null!=(i=null==t?void 0:t.context)?i:this.cs(),this.A,null==t?void 0:t.occurredAtMs)};this.ds(()=>this.Ls(r))}Os(e){let t=this.Ir.beforeSend;if(!t)return e;let i=U(t)?t:[t],s=e;for(let e of i)try{let t=e(s);if(!t)return this.A.info("Log was rejected in beforeSend function"),null;s=t}catch(e){return this.A.error("Error in beforeSend function for log:",e),null}return s}Ds(){if(void 0===this.Rs)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.A.warn(`captureLog dropping logs: exceeded ${this.Rs} logs per ${this.Ps}ms`),this.$s=!0),!1)}flush(){var e=this;return eu(function*(){if(!e._instance.isDisabled)return e.ys||(e.ys=e.Ns().finally(()=>{e.ys=null})),e.ys})()}Ns(){var e=this;return eu(function*(){var t,i,s;e.ps.clear();let r=null!=(t=e._instance.getPersistedProperty(O.LogsQueue))?t:[];if(0===r.length)return;let n=r.length,o=0;for(;r.length>0&&n>o;){let t=e._s;e.bs=0;
2let n=Math.min(r.length,e.Es),a=r.slice(0,n),l=ig(a.map(e=>e.record),e.qs(),null!=(i=e.fs)?i:e._instance.getLibraryId(),e._instance.getLibraryVersion()),u=yield e._instance.js(l);if(e._s!==t)return;if("too-large"===u.kind&&a.length>1)e.Es=Math.max(1,Math.floor(a.length/2)),e.A.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(u),e.ps.pending&&e.ps.arm(Math.max(e.Ms,e.ws.remainingMs())),"retry-later"===u.kind||("too-large"===u.kind?e.A.warn("Dropping a single log record with batch size 1 — the record is larger than the server cap and cannot be split further."):"ok"===u.kind&&e.Ir.maxBatchRecordsPerPost>e.Es&&(e.Es=Math.min(e.Ir.maxBatchRecordsPerPost,e.Es+1)),yield e.Bs(a.length),r=null!=(s=e._instance.getPersistedProperty(O.LogsQueue))?s:[],o+=a.length,"fatal"===u.kind))throw u.error}})()}Bs(e){var t=this;return eu(function*(){var i;let s=Math.max(0,e-t.bs),r=null!=(i=t._instance.getPersistedProperty(O.LogsQueue))?i:[];t._instance.setPersistedProperty(O.LogsQueue,r.slice(s)),yield t.vs()})()}qs(){var e;return e=this.Ir,il(e,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(e){var t;if(this._instance.optedOut)return;let i=null!=(t=this._instance.getPersistedProperty(O.LogsQueue))?t:[];this.Is>i.length||(i.shift(),this.bs++,this.A.info("Logs queue is full, dropping oldest record.")),i.push(e),this._instance.setPersistedProperty(O.LogsQueue,i),this.Ts>i.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(im(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){let e=this._instance.getPersistedProperty(O.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return eu(function*(){t.ps.clear();let i=t.flush().catch(()=>{});void 0!==e?yield tm(i,e):yield i})()}flushWithTimeout(e){var t=this;return eu(function*(){let i=t.flush();yield tm(i,e,()=>{i.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},e=>{this.ks++,this.Ss=iv(),this.A.error("PostHog logs flush failed:",e)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.Hs())})}};let ib=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function iw(e){return String(e)+"000000"}function iE(e,t,i,s){let r="";return s&&(r=Object.keys(s).sort().map(e=>`${JSON.stringify(e)}:${JSON.stringify(s[e])}`).join(",")),`${e}\0${t}\0${null!=i?i:""}\0${r}`}var ix=class{constructor(e,t,i){this._instance=e,this.Ir=t,this.A=i,this.zs=new Map,this.ps=new i_(()=>this.flush().catch(e=>{this.A.error("Metrics flush failed:",e)})),this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.ws=new tc,this.ks=0,this.Ss=1,this.Gs=0}count(e,t=1,i){this.Zs({name:e,type:"count",value:t,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}gauge(e,t,i){this.Zs({name:e,type:"gauge",value:t,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}histogram(e,t,i){this.Zs({name:e,type:"histogram",value:t,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}flush(){var e,t=this;let i=this.ys,s=(e=eu(function*(){i&&(yield i.catch(()=>{})),yield t.Qs()}),function(){return e.apply(this,arguments)})().finally(()=>{this.ys===s&&(this.ys=null)});return this.ys=s,s}drainWindow(){if(0===this.zs.size)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){let t,i;if(this._instance.isDisabled||this._instance.optedOut)return;let s=this.Os(e);if(null===s)return;if(!s.name||"string"!=typeof s.name)return void this.A.warn("Dropping metric with empty name");if("number"!=typeof s.value||!Number.isFinite(s.value))return void this.A.warn(`Dropping metric '${s.name}': value must be a finite number`);if("count"===s.type&&0>s.value)return void this.A.warn(`Dropping count '${s.name}': counters are monotonic, value must be >= 0`);try{t=s.attributes?tE({},s.attributes):void 0,i=iE(s.type,s.name,s.unit,t)}catch(e){return void this.A.warn(`Dropping metric '${s.name}': attributes could not be serialized`,e)}let r=this.zs.get(i);if(!r){if(!this.Ks())return;r={name:s.name,type:s.type,unit:s.unit,attributes:t,windowStartMs:Date.now()},this.zs.set(i,r)}let n=this.Ws.get(s.name);
2void 0===n?this.Ws.set(s.name,s.type):n===s.type||this.Vs.has(s.name)||(this.Vs.add(s.name),this.A.warn(`Metric name '${s.name}' is already used as a ${n}; recording it as a ${s.type} too will blend both series in charts. Use a distinct name.`)),this.Xs(r,s.value),this.Fs()}Ks(){return this.Ir.maxSeriesPerFlush>this.zs.size||(this.Us||(this.Us=!0,this.A.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":var i;e.total=(null!=(i=e.total)?i:0)+t;break;case"gauge":e.last=t;break;case"histogram":{e.hist||(e.hist={count:0,sum:0,min:t,max:t,bucketCounts:Array(ib.length+1).fill(0)});let i=e.hist;i.count+=1,i.sum+=t,i.min=Math.min(i.min,t),i.max=Math.max(i.max,t),i.bucketCounts[function(e,t){for(let i=0;t.length>i;i++)if(t[i]>=e)return i;return t.length}(t,ib)]+=1}}}Os(e){let t=this.Ir.beforeSend;if(!t)return e;let i=U(t)?t:[t],s=e;for(let e of i)try{let t=e(s);if(!t)return this.A.info("Metric was rejected in beforeSend function"),null;s=t}catch(e){return this.A.error("Error in beforeSend function for metric:",e),null}return s}Fs(){this.ps.pending||this.ps.arm(this.Hs())}Hs(){return Math.max(im(this.Ir.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Qs(){var e=this;return eu(function*(){if(e.ps.clear(),0===e.zs.size)return;let t=e.zs;e.zs=new Map,e.Us=!1,e.Ws=new Map,e.Vs=new Set;let i=e.Gs,s=yield e._instance.Ys(e.Js(t));if(i===e.Gs)switch(e.ws.record(s),"retry-later"===s.kind?(e.ks++,e.Ss=iv()):(e.ks=0,e.Ss=1),e.ps.pending&&e.ps.arm(e.Hs()),s.kind){case"ok":return;case"retry-later":return e.ho(t),void e.ps.armNoEarlierThan(e.Hs());case"too-large":return void e.A.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e.A.error("Failed to send metrics batch:",s.error)}})()}Js(e){var t,i,s,r;return t=this.co(e),i=il(this.Ir,this._instance.getLibraryId(),this._instance.getLibraryVersion()),s=this._instance.getLibraryId(),r=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:ih(i)},scopeMetrics:[{scope:{name:s,version:r},metrics:t}]}]}}co(e){let t=iw(Date.now()),i=new Map;for(let o of e.values()){var s,r,n;let e=iE(o.type,o.name,o.unit,void 0),a=i.get(e);a||(a=tE({name:o.name},o.unit&&{unit:o.unit}),"count"===o.type?a.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===o.type?a.gauge={dataPoints:[]}:a.histogram={aggregationTemporality:1,dataPoints:[]},i.set(e,a));let l=io(null!=(s=o.attributes)?s:{},this.A),u=iw(o.windowStartMs);if("count"===o.type){let e={attributes:l,startTimeUnixNano:u,timeUnixNano:t,asDouble:null!=(r=o.total)?r:0};a.sum.dataPoints.push(e)}else if("gauge"===o.type){let e={attributes:l,timeUnixNano:t,asDouble:null!=(n=o.last)?n:0};a.gauge.dataPoints.push(e)}else o.hist&&a.histogram.dataPoints.push({attributes:l,startTimeUnixNano:u,timeUnixNano:t,count:o.hist.count,sum:o.hist.sum,min:o.hist.min,max:o.hist.max,bucketCounts:o.hist.bucketCounts,explicitBounds:ib})}return Array.from(i.values())}ho(e){for(let[s,r]of e){let e=this.zs.get(s);if(e)switch(e.windowStartMs=Math.min(e.windowStartMs,r.windowStartMs),e.type){case"count":var t,i;e.total=(null!=(t=e.total)?t:0)+(null!=(i=r.total)?i:0);break;case"gauge":break;case"histogram":if(r.hist)if(e.hist){e.hist.count+=r.hist.count,e.hist.sum+=r.hist.sum,e.hist.min=Math.min(e.hist.min,r.hist.min),e.hist.max=Math.max(e.hist.max,r.hist.max);for(let t=0;e.hist.bucketCounts.length>t;t++)e.hist.bucketCounts[t]+=r.hist.bucketCounts[t]}else e.hist=r.hist}else this.Ks()&&this.zs.set(s,r)}}};let ik=(e,{debugEnabled:t}={})=>{let i={N(i,...s){c&&(S.DEBUG||c.POSTHOG_DEBUG||t)&&!V(c.console)&&c.console&&("__rrweb_original__"in c.console[i]?c.console[i].__rrweb_original__:c.console[i])(e,...s)},debug(...e){i.N("debug",...e)},info(...e){i.N("log",...e)},warn(...e){i.N("warn",...e)},error(...e){i.N("error",...e)},critical(...t){console.error(e,...t)},uninitializedWarning(e){i.error(`You must initialize PostHog before calling ${e}`)},createLogger:(t,i)=>ik(`${e} ${t}`,i)};return i},iS=ik("[PostHog.js]"),i$=iS.createLogger,iI=i$("[ExternalScriptsLoader]"),iP=e=>{let t=null==f?void 0:f.querySelectorAll("script");
2if(t){for(let i=0;t.length>i;i++)if(t[i].src===e||t[i].getAttribute("src")===e)return t[i]}},iT=(e,t,i)=>{if(e.config.disable_external_dependency_loading)return iI.warn(`${t} was requested but loading of external scripts is disabled.`),i("Loading of external scripts is disabled");let s=iP(t);if(s){if(s.__posthog_loading_callback_fired)return i();let e=s.__posthog_loading_error;return e?i(e):(s.addEventListener("load",e=>{s.__posthog_loading_callback_fired=!0,i(void 0,e)}),void s.addEventListener("error",e=>{s.__posthog_loading_error=e,i(e)}))}let r=()=>{if(!f)return i("document not found");if(iP(t))return iT(e,t,i);let s=f.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=t,s.onload=e=>{s.__posthog_loading_callback_fired=!0,i(void 0,e)},s.onerror=e=>{s.__posthog_loading_error=e,i(e)},e.config.prepare_external_dependency_script&&(s=e.config.prepare_external_dependency_script(s)),!s)return i("prepare_external_dependency_script returned null");if("head"===e.config.external_scripts_inject_target)f.head.appendChild(s);else{var r;let e=f.querySelectorAll("body > script");e.length>0?null==(r=e[0].parentNode)||r.insertBefore(s,e[0]):f.body.appendChild(s)}};(null==f?void 0:f.body)?r():null==f||f.addEventListener("DOMContentLoaded",r)},iO={},iC=(e,t)=>{let i=`/static/${t}.js?v=${e.version}`;return"toolbar"===t&&(i=`${i}&t=${3e5*Math.floor(Date.now()/3e5)}`),e.requestRouter.endpointFor("assets",i)};x.__PosthogExtensions__=x.__PosthogExtensions__||{},x.__PosthogExtensions__.loadExternalDependency=(e,t,i)=>{if("remote-config"===t){let t=e.requestRouter.endpointFor("assets",`/array/${e.config.token}/config.js`);return void iT(e,t,i)}let s=e.config.strict_script_versioning;if(s){let r=e.requestRouter.endpointFor("assets",`/static/${e.version}/${t}.js`),n=iO[r];if("fallback"===s&&n){if(iP(n))return void iT(e,n,i);delete iO[r]}return void iT(e,r,"fallback"===s?(s,n)=>{if(s)if("string"==typeof s)i(s);else{var o;let s=iC(e,t);iO[r]=s;let n=iP(r);null==n||null==(o=n.parentNode)||o.removeChild(n),iT(e,s,i)}else i(void 0,n)}:i)}iT(e,iC(e,t),i)},x.__PosthogExtensions__.loadSiteApp=(e,t,i)=>{let s=e.requestRouter.endpointFor("api",t);iT(e,s,i)},S.DEBUG=!1,S.LIB_VERSION="1.435.5",S.LIB_NAME="web";let iR="distinct_id",iF="$device_id",iA="$device_model",iM="__alias",iL="$fbc",iD="$fbc_persistence",iN="$fbp",ij="$fbp_persistence",iB="__timers",iU="$autocapture_disabled_server_side",iq="$heatmaps_enabled_server_side",iH="$exception_capture_enabled_server_side",iz="$error_tracking_suppression_rules",iV="$error_tracking_capture_extension_exceptions",iW="$web_vitals_enabled_server_side",iG="$dead_clicks_enabled_server_side",iJ="$product_tours_enabled_server_side",iK="$logs_capture_enabled_server_side",iY="$web_vitals_allowed_metrics",iX="$session_recording_remote_config",iQ="$sesid",iZ="$session_is_sampled",i0="$enabled_feature_flags",i1="$active_feature_flags",i2="$early_access_features",i3="$feature_flag_details",i5="$feature_flag_payloads",i4="$feature_flag_request_id",i6="$minimal_flag_called_events",i8="$override_feature_flags",i9="$override_feature_flag_payloads",i7="$stored_person_properties",se="$stored_group_properties",st="$groups",si="$surveys",ss="$surveys_loaded_at",sr="$surveys_activated",sn="$surveys_activated_session",so="$surveys_activated_timestamps",sa="ph_product_tours",sl="$flag_call_reported",su="$flag_call_reported_session_id",sh="$feature_flag_errors",sc="$feature_flag_evaluated_at",sd="$user_state",sp="$client_session_props",sf="$initial_campaign_params",sg="$initial_referrer_info",s_="$initial_person_info",sv="$epp",sm="$posthog_cookieless",sy="$cookieless_mode",sb="$sdk_debug_extensions_init_method",sw="$sdk_debug_extensions_init_time_ms",sE="$sdk_debug_recording_script_not_loaded",sx="$sdk_debug_replay_stale_config",sk="$sdk_debug_replay_event_trigger_status",sS="$sdk_debug_replay_linked_flag_trigger_status",s$="$sdk_debug_replay_matched_recording_trigger_groups",sI="$sdk_debug_replay_pen
2ding_trigger_conditions",sP="$sdk_debug_replay_remote_trigger_matching_config",sT="$sdk_debug_replay_trigger_groups_count",sO="$sdk_debug_replay_url_trigger_status",sC="PostHog loadExternalDependency extension not found.",sR="anonymous",sF="identified",sA="identified_only",sM="visibilitychange",sL="beforeunload",sD="$pageview",sN="$pageleave",sj="$identify",sB="$groupidentify";function sU(e,t){U(e)&&e.forEach(t)}function sq(e,t){if(!K(e))if(U(e))e.forEach(t);else if(e instanceof FormData)e.forEach((e,i)=>t(e,i));else for(let i in e)j.call(e,i)&&t(e[i],i)}let sH=function(e,...t){for(let i of t)for(let t in i)void 0!==i[t]&&(e[t]=i[t]);return e};function sz(e){let t=Object.keys(e),i=t.length,s=Array(i);for(;i--;)s[i]=[t[i],e[t[i]]];return s}let sV=function(e){return function(...t){try{return e.apply(this,t)}catch(e){iS.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),iS.critical(e)}}},sW=function(e){let t={};return sq(e,function(e,i){(W(e)&&e.length>0||Y(e))&&(t[i]=e)}),t};function sG(e){let t=tE({},e);for(let i of["name","message","stack","cause","errors"])try{i in e&&(t[i]=e[i])}catch(e){}return t}let sJ=["herokuapp.com","vercel.app","netlify.app"];function sK(e,t,i,s){let{capture:r=!1,passive:n=!0}=null!=s?s:{};null==e||e.addEventListener(t,i,{capture:r,passive:n})}function sY(e){return"ph_toolbar_internal"===e.name}let sX=e=>{if(f){try{let t=e+"=",i=f.cookie.split(";").filter(e=>e.length);for(let e=0;i.length>e;e++){let s=i[e];for(;" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(t))return decodeURIComponent(s.substring(t.length,s.length))}}catch(e){}return null}};Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Y(e)&&isFinite(e)&&Math.floor(e)===e});var sQ=class e{constructor(e){if(this.bytes=e,16!==e.length)throw TypeError("not 128-bit length")}static fromFieldsV7(t,i,s,r){if(!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||!Number.isInteger(r)||0>t||0>i||0>s||0>r||t>0xffffffffffff||i>4095||s>0x3fffffff||r>0xffffffff)throw RangeError("invalid field value");let n=new Uint8Array(16);return n[0]=t/0x10000000000,n[1]=t/0x100000000,n[2]=t/0x1000000,n[3]=t/65536,n[4]=t/256,n[5]=t,n[6]=112|i>>>8,n[7]=i,n[8]=128|s>>>24,n[9]=s>
2>>16,n[10]=s>>>8,n[11]=s,n[12]=r>>>24,n[13]=r>>>16,n[14]=r>>>8,n[15]=r,new e(n)}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),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw Error("Invalid UUIDv7 was generated");return e}clone(){return new e(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(let t=0;16>t;t++){let i=this.bytes[t]-e.bytes[t];if(0!==i)return Math.sign(i)}return 0}},sZ=class{generate(){let e=this.generateOrAbort();if(!V(e))return e;{this.Ct=0;let e=this.generateOrAbort();if(V(e))throw Error("Could not generate UUID after timestamp reset");return e}}generateOrAbort(){let e,t=Y(e=Date.now())&&isFinite(e)?Math.min(Math.max(Math.floor(e),0),0xffffffffffff):0;if(t>this.Ct)this.Ct=t,this.Mt();else{if(this.Ct>=t+1e4)return;this.It++,this.It>0x3ffffffffff&&(this.Ct++,this.Mt())}return sQ.fromFieldsV7(this.Ct,Math.trunc(this.It/0x40000000),0x3fffffff&this.It,this.Tt.nextUint32())}Mt(){this.It=1024*this.Tt.nextUint32()+(1023&this.Tt.nextUint32())}constructor(){this.Ct=0,this.It=0,this.Tt=new s1}};let s0=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};c&&!V(c.crypto)&&crypto.getRandomValues&&(s0=e=>crypto.getRandomValues(e));var s1=class{nextUint32(){return this.Rt.length>this.At||(s0(this.Rt),this.At=0),this.Rt[this.At++]}constructor(){this.Rt=new Uint32Array(8),this.At=1/0}};let s2=()=>s3().toString(),s3=()=>(a||(a=new sZ)).generate(),s5="",s4=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,s6=null,s8={Et(){if(!J(s6))return s6;if(s6=!1,f)try{let e=`__ph_cookie_support_${s2()}`;s8.$t(e,"xyz"),s6='"xyz"'===sX(e),s8.Lt(e)}catch(e){s6=!1}return s6},Pt(e){iS.error("cookieStore error: "+e)},Ot:sX,Dt(e){let t;try{t=JSON.parse(s8.Ot(e))||{}}catch(e){}return t},$t(e,t,i,s,r){if(!f)return!1;try{let n="",o="",a=function(e,t){if(t){let t=function(e,t=f){if(s5)return s5;if(!t||["localhost","127.0.0.1"].includes(e))return"";let i=e.split("."),s=Math.min(i.length,8),r="dmn_chk_"+s2();for(;!s5&&s--;){let e=i.slice(s).join("."),n=r+"=1;domain=."+e+";path=/";t.cookie=n+";max-age=3",t.cookie.includes(r)&&(t.cookie=n+";max-age=0",s5=e)}return s5}(e);if(!t){let i,s=(i=e.match(s4))?i[0]:"";s!==t&&iS.info("Warning: cookie subdomain discovery mismatch",s,t),t=s}return t?"; domain=."+t:""}return""}(f.location.hostname,s);if(i){let e=new Date;e.setTime(e.getTime()+864e5*i),n="; expires="+e.toUTCString()}r&&(o="; secure");let l=e+"="+encodeURIComponent(JSON.stringify(t))+n+"; SameSite=Lax; path=/"+a+o;return l.length>3686.4&&iS.warn("cookieStore warning: large cookie, len="+l.length),f.cookie=l,!0}catch(e){return!1}},Lt(e,t){if((null==f?void 0:f.cookie)&&(!t||!J(sX(e))))try{s8.$t(e,"",-1,t)}catch(e){return}}},s9=null,s7={Et(){if(!J(s9))return s9;let e=!0;if(V(c))e=!1;else try{let t="__mplssupport__";s7.$t(t,"xyz"),'"xyz"'!==s7.Ot(t)&&(e=!1),s7.Lt(t)}catch(t){e=!1}return e||iS.error("localStorage unsupported; falling back to cookie store"),s9=e,e},Pt(e){iS.error("localStorage error: "+e)},Ot(e){try{return null==c?void 0:c.localStorage.getItem(e)}catch(e){s7.Pt(e)}return null},Dt(e){try{return JSON.parse(s7.Ot(e))||{}}catch(e){}return null},$t(e,t){try{return null==c||c.localStorage.setItem(e,JSON.stringify(t)),!0}catch(e){s7.Pt(e)}return!1},Lt(e){try{null==c||c.localStorage.removeItem(e)}catch(e){s7.Pt(e)}}},re=[i7,i1,i0,i3,i5,i4,sc,sh,sl],rt=[iF,iR,iQ,iZ,sv,s_,iD,sd],ri=["__proto__","constructor","prototype"],rs=e=>{if(!H(e))return{};let t={};return Object.keys(e).forEach(i=>{-1===ri.indexOf(i)&&(t[i]=e[i])}),t},rr=(e,t=[])=>{let i={};return[...rt,...t].forEach(t=>{let s=e[t];V(s)||J(s)||""===s||(i[t]=s)}),i},rn=e=>{let t=5381,i=0x811c9dc5;for(let s=0;e.length>s;s++){let r=e.charCodeAt(s);t=33*t^r,i=Math.imul(i^r,0x1000193)}return e.length.toString(36)+"."+(t>>>0).toString(36)+"."+(i>>>0).toString(36)},ro=(e,t)=>({p:t,f:rn(JSON.stringify(e))}),ra=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{let i=s8.Dt(e+"_cpm"),s=(null==i?void 0:i.f)===rn(t)&&U(i.p);return{properties:s?i.p:[],isValid:s}}catch(e){return{properties:[],isValid:!1}}},rl=(e,t)=>
2t+"|"+(s8.Ot(e+"_cpm")||""),ru={},rh={Et:()=>!0,Pt(e){iS.error("memoryStorage error: "+e)},Ot:e=>e in ru?ru[e]:null,Dt:e=>e in ru?ru[e]:null,$t:(e,t)=>(ru[e]=t,!0),Lt(e){delete ru[e]}},rc=null,rd={Et(){if(!J(rc))return rc;if(rc=!0,V(c))rc=!1;else try{let e="__support__";rd.$t(e,"xyz"),'"xyz"'!==rd.Ot(e)&&(rc=!1),rd.Lt(e)}catch(e){rc=!1}return rc},Pt(e){iS.error("sessionStorage error: ",e)},Ot(e){try{return null==c?void 0:c.sessionStorage.getItem(e)}catch(e){rd.Pt(e)}return null},Dt(e){try{return JSON.parse(rd.Ot(e))||null}catch(e){}return null},$t(e,t){try{return null==c||c.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(e){rd.Pt(e)}return!1},Lt(e){try{null==c||c.sessionStorage.removeItem(e)}catch(e){rd.Pt(e)}}};var rp=class{constructor(e){this._instance=e}get Ir(){return this._instance.config}get consent(){return this.Do()?0:this.Lo}isOptedOut(){return"always"===this.Ir.cookieless_mode||this.isRejected()||-1===this.consent&&"on_reject"===this.Ir.cookieless_mode}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Ir.opt_out_capturing_by_default}optInOut(e){this.No.$t(this.qo,+!!e,this.Ir.cookie_expiration,this.Ir.cross_subdomain_cookie,this.Ir.secure_cookie)}reset(){this.No.Lt(this.qo,this.Ir.cross_subdomain_cookie)}get qo(){let{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:i}=this._instance.config;return i||(t?t+e:"__ph_opt_in_out_"+e)}get Lo(){let e=this.No.Ot(this.qo);return A(eo,e)?1:A(ea,e)?0:-1}get No(){let e=this.Ir.opt_out_capturing_persistence_type,t="localStorage"===e?s7:s8,i=t.Et()?t:rh;if(!this.jo||this.jo!==i){this.jo=i;let t="localStorage"===e?s8:s7;t.Ot(this.qo)&&(this.jo.Ot(this.qo)||this.optInOut(A(eo,t.Ot(this.qo))),t.Lt(this.qo,this.Ir.cross_subdomain_cookie))}return this.jo}Do(){return!!this.Ir.respect_dnt&&[null==p?void 0:p.doNotTrack,null==p?void 0:p.msDoNotTrack,x.doNotTrack,null==p?void 0:p.globalPrivacyControl].some(e=>A(eo,e))}};function rf(e,t){var i;let s=null==e||null==(i=e.config)?void 0:i.get_current_url;if(!q(s))return t;try{let e=s(t);return W(e)&&e?e:t}catch(e){return iS.error("Error in get_current_url, falling back to window.location.href",e),t}}function rg(e){var t;return e instanceof Element&&("__POSTHOG_TOOLBAR__"===e.id||!!(null==(t=e.closest)?void 0:t.call(e,".toolbar-global-fade-container")))}function r_(e){return!!e&&1===e.nodeType}function rv(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function rm(e){return!!e&&3===e.nodeType}function ry(e){return!!e&&11===e.nodeType&&r_(e.host)}function rb(e){return e?M(e).split(/\s+/):[]}function rw(e,t){var i;let s,r=V(s=null==c||null==(i=c.location)?void 0:i.href)?void 0:rf(t,s);return!!(r&&e&&e.some(e=>r.match(e)))}function rE(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 rb(t)}function rx(e){return K(e)?null:M(e).split(/(\s+)/).filter(e=>rG(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function rk(e){let t="";return rj(e)&&!rB(e)&&e.childNodes&&e.childNodes.length&&sq(e.childNodes,function(e){var i;rm(e)&&e.textContent&&(t+=null!=(i=rx(e.textContent))?i:"")}),M(t)}function rS(e){var t;return V(e.target)?e.srcElement||null:(null==(t=e.target)?void 0:t.shadowRoot)?e.composedPath()[0]||null:e.target||null}let r$=["a","button","form","input","select","textarea","label"];function rI(e,t){let i=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;try{return!!i&&i.call(e,t)}catch(e){return!1}}function rP(e,t){if(V(t))return!0;for(let i of e)if(t.some(e=>rI(i,e)))return!0;return!1}function rT(e){let t=e.parentNode;return!(!t||!r_(t))&&t}let rO=[".ph-no-autocapture","[data-ph-no-autocapture]"],rC=["next","previous","prev",">","<"],rR=[...rC,"+","-","−","–"],rF=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,rA=[".ph-no-rageclick",".ph-no-capture"],rM=["","text","search","email","password","url","tel","number"];function rL(e,t){var i,s,r;let n,o,a;if(!c||rD(e)||(Q(t)?(n=!!t&&rA,o=void 0,a=!1):(n=null!=(i=null==t?void 0:t.css_selector_ignorelist)?i:rA,o=null==t?void 0:t.content_ignorelist,a=null!=(s=null==t?void 0:t.ignore_text_selection)&&s),!1===n)||a&&!(!(r=e)||!r_(r))&&(rv(r,"textarea")||(rv(r,"input")?A(rM,(r.getAttribute("type")||"").toLowerCase()):function(e){var t;if(e.isContentEditable)return!0;let i=null==(t=e.getAttribute)?void 0:t.call(e,"contenteditable");return"true"===i||""===i}(r))))return!1;let{targetElementList:l}=rN(e,!1);return!function(e,t){let i;if(!1===e||V(e))return!1;if(!0===e)i=rC;else{if(!U(e))return!1;if(e.length>10)return iS.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;i=e.map(e=>e.toLowerCase())}return t.some(({safeText:e,ariaLabel:t})=>i.some(i=>rF(e,i)||rF(t,i)))}(o,l.map(e=>{var t;return{safeText:rk(e).toLowerCase(),ariaLabel:(null==(t=e.getAttribute("aria-label"))?void 0:t.toLowerCase().trim())||""}}))&&!rP(l,n)}let rD=e=>!e||rv(e,"html")||!r_(e),rN=(e,t)=>{if(!c||rD(e))return{parentIsUsefulElement:!1,targetElementList:[]};let i=!1,s=[e],r=e;for(;r.parentNode&&!rv(r,"body");){if(ry(r.parentNode)){s.push(r.parentNode.host),r=r.parentNode.host;continue}let e=rT(r);if(!e)break;if(t||r$.indexOf(e.tagName.toLowerCase())>-1)i=!0;else try{let t=c.getComputedStyle(e);t&&"pointer"===t.getPropertyValue("cursor")&&(i=!0)}catch(e){}s.push(e),r=e}return{parentIsUsefulElement:i,targetElementList:s}};function rj(e){let t=new Set,i=0;for(let s=e;s.parentNode&&!rv(s,"body");s=s.parentNode){if(i++>=1e3||t.has(s))return!1;t.add(s);let e=rE(s);if(A(e,"ph-sensitive")||A(e,"ph-no-capture"))return!1}if(A(rE(e),"ph-include"))return!0;let s=e.type||"";if(W(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}
2let r=e.name||e.id||"";return!W(r)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(r.replace(/[^a-zA-Z0-9]/g,""))}function rB(e){return!!(rv(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||rv(e,"select")||rv(e,"textarea")||"true"===e.getAttribute("contenteditable"))}let rU=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}))$"),rq=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,rH=[16,15,14,13],rz=RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),rV=RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),rW=/[0-9A-Za-z_]/;function rG(e,t=!0){return!(K(e)||W(e)&&(e=M(e),(t?rU.test((e||"").replace(/[- ]/g,"")):function(e){let t;for(rq.lastIndex=0;t=rq.exec(e);){let e=t[2];if(!e)continue;let i=e.replace(/[- ]/g,"");for(let e=0;i.length>e;e++)for(let t of rH){let s=e+t;if(i.length>=s){let t=i.slice(e,s);if(rU.test(t)&&function(e){let t=0,i=!1;for(let s=e.length-1;s>=0;s--){let r=e.charCodeAt(s)-48;i&&(r*=2)>9&&(r-=9),t+=r,i=!i}return t%10==0}(t))return!0}}}return!1}(e))||(t?rz.test(e):function(e){let t;for(rV.lastIndex=0;t=rV.exec(e);){let e=t[1],i=t[3];if(!(e&&i&&rW.test(e)&&rW.test(i)))return!0}return!1}(e))))&&!0}function rJ(e){let t=rk(e);return rG(t=`${t} ${(function e(t){let i="";return t&&t.childNodes&&t.childNodes.length&&sq(t.childNodes,function(t){var s;if(t&&"span"===(null==(s=t.tagName)?void 0:s.toLowerCase()))try{let s=rk(t);i=`${i} ${s}`.trim(),t.childNodes&&t.childNodes.length&&(i=`${i} ${e(t)}`.trim())}catch(e){iS.error("[AutoCapture]",e)}}),i})(e)}`.trim())?t:""}function rK(e){return e.replace(/"|\\"/g,'\\"')}let rY=i$("[Dead Clicks]"),rX=()=>!0,rQ=e=>{var t;let i=!!(null==(t=e.instance.persistence)?void 0:t.get_property(iG)),s=e.instance.config.capture_dead_clicks;return Q(s)?s:!!H(s)||i};var rZ=class{get lazyLoadedDeadClicksAutocapture(){return this.Bo}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(e){if(!e.ok)return;let t=e.config;"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[iG]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.Ho(()=>{this.zo()}):this.stop()}Ho(e){var t,i,s;(null==(t=x.__PosthogExtensions__)?void 0:t.initDeadClicksAutocapture)?e():null==(i=x.__PosthogExtensions__)||null==(s=i.loadExternalDependency)||s.call(i,this.instance,"dead-clicks-autocapture",t=>{t?rY.error("failed to load script",t):e()})}zo(){var e;if(f){if(!this.Bo&&(null==(e=x.__PosthogExtensions__)?void 0:e.initDeadClicksAutocapture)){let e=H(this.instance.config.capture_dead_clicks)?tE({},this.instance.config.capture_dead_clicks):{};e.__onCapture=this.onCapture,this.onCapture&&(e.capture_dead_swipes=!1),this.Bo=x.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,e),this.Bo.start(f),rY.info("starting...")}}else rY.error("`document` not found. Cannot start.")}stop(){this.Bo&&(this.Bo.stop(),this.Bo=void 0,rY.info("stopping..."))}};let r0=i$("[SegmentIntegration]");function r1(e,t,i=!0){let s,r,n=e.config.segment;if(!n)return t();let{analytics:o,filterProperties:a}=q(n.register)?{analytics:n}:n;s=s=>{let r=()=>s.anonymousId()||s2();e.config.get_device_id=r,i&&s.id()&&(e.register({distinct_id:s.id(),$device_id:r()}),e.persistence.set_property(sd,sF)),(i=>{o.register(((e,t,{filterProperties:i}={})=>{"u">typeof Promise&&Promise.resolve||r0.warn("This browser does not have Promise support, and can not use the segment integration");let s=(s,r)=>{if(!r)return s;let n=!!t&&s.event.anonymousId===t&&!s.event.userId;n||s.event.userId||s.event.anonymousId===e.get_distinct_id()||(r0.info("No userId set, resetting PostHog"),e.reset()),n||(t=void 0),s.event.userId&&s.event.userId!==e.get_distinct_id()&&(r0.info("UserId set, identifying with PostHog"),e.identify(s.event.userId));let o=e.calculateEventProperties(r,s.event.properties);if(!K(i)){let e=s.event.properties||{},t={};for(let i of Object.keys(o))j.call(e,i)||(t[i]=o[i]);let r=((e,t)=>{let i=U(e)?e:[e],s=tE({},t);
2for(let e of i)try{if(s=e(s),K(s))return null}catch(e){return r0.error("Error in Segment filterProperties:",e),null}return s})(i,t);if(K(r))return s;o=r}return s.event.properties=Object.assign({},o,s.event.properties),s};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>s(e,e.event.event),page:e=>s(e,sD),identify:e=>s(e,sj),screen:e=>s(e,"$screen")}})(e,i,{filterProperties:a})).then(()=>{t()},e=>{r0.error("Failed to register the Segment integration",e),t()})})(i?void 0:s.anonymousId()||void 0)},"then"in(r=o.user())&&q(r.then)?r.then(s):s(r)}let r2="posthog-js";function r3(e,{organization:t,projectId:i,prefix:s,severityAllowList:r=["error"],sendExceptionsToPostHog:n=!0}={}){return o=>{var a,l,u,h,c,d;if("*"!==r&&!r.includes(o.level)||!e.__loaded)return o;o.tags||(o.tags={});let p=e.requestRouter.endpointFor("ui",`/project/${e.config.token}/person/${e.get_distinct_id()}`);o.tags["PostHog Person URL"]=p,e.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));let f=(null==(a=o.exception)?void 0:a.values)||[],g=f.map(e=>tE(tE({},e),{},{stacktrace:e.stacktrace?tE(tE({},e.stacktrace),{},{type:"raw",frames:(e.stacktrace.frames||[]).map(e=>tE(tE({},e),{},{platform:"web:javascript"}))}):void 0})),_={$exception_message:(null==(l=f[0])?void 0:l.value)||o.message,$exception_type:null==(u=f[0])?void 0:u.type,$exception_level:o.level,$exception_list:g,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:(null==(h=f[0])?void 0:h.value)||o.message,$sentry_exception_type:null==(c=f[0])?void 0:c.type,$sentry_tags:o.tags};return t&&i&&(_.$sentry_url=(s||"https://sentry.io/organizations/")+t+"/issues/?project="+i+"&query="+o.event_id),n&&(null==(d=e.exceptions)||d.sendExceptionEvent(_)),o}}var r5=class{constructor(e,t,i,s,r,n){this.name=r2,this.setupOnce=function(o){o(r3(e,{organization:t,projectId:i,prefix:s,severityAllowList:r,sendExceptionsToPostHog:null==n||n}))}}},r4=class{constructor(e){this.Uo=(e,t,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(iS.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:i}),this.Wo=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.Vo()}Vo(){var e;this.Go=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(this.Uo)}destroy(){var e;null==(e=this.Go)||e.call(this),this.Go=void 0}doPageView(e,t){var i;let s=this.Zo(e,t);return this.Wo={pathname:null!=(i=null==c?void 0:c.location.pathname)?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var t;return this.Zo(e,null==(t=this.Wo)?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null==(e=this.Wo)?void 0:e.pageViewId}}Zo(e,t){let i=this.Wo;if(!i)return{$pageview_id:t};let s={$pageview_id:t,$prev_pageview_id:i.pageViewId},r=this._instance.scrollManager.getContext();if(r&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:e,lastScrollY:t,maxScrollY:i,maxContentHeight:n,lastContentY:o,maxContentY:a}=r;if(!(V(e)||V(t)||V(i)||V(n)||V(o)||V(a))){e=Math.ceil(e),t=Math.ceil(t),i=Math.ceil(i),n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a);let r=e>1?ed(t/e,0,1,iS):1,l=e>1?ed(i/e,0,1,iS):1,u=n>1?ed(o/n,0,1,iS):1,h=n>1?ed(a/n,0,1,iS):1;s=sH(s,{$prev_pageview_last_scroll:t,$prev_pageview_last_scroll_percentage:r,$prev_pageview_max_scroll:i,$prev_pageview_max_scroll_percentage:l,$prev_pageview_last_content:o,$prev_pageview_last_content_percentage:u,$prev_pageview_max_content:a,$prev_pageview_max_content_percentage:h})}}return i.pathname&&(s.$prev_pageview_pathname=i.pathname),i.timestamp&&(s.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),s}};let r6=["flags","surveys"],r8={$people_distinct_id:{exposure:"hidden"},[iM]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[iB]:{exposure:"hidden"},[iD]:{exposure:"hidden"},[ij]:{exposure:"hidden"},[iU]:{exposure:"event"},[iq]:{exposure:"hidden"},[iK]:{exposure:"hidden"},[iH]:{exposure:"event"},[iz]:{exposure:"hidden"},[iV]:{exposure:"event"},[iW]:{exposure:"event"},[iG]:{exposure:"event"},[iJ]:{exposure:"hidden"},[iY]:{exposure:"event"},[iX]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"}
2,[iQ]:{exposure:"hidden"},[iZ]:{exposure:"event"},$replay_sample_rate:{exposure:"event",shouldSkipFromEventProperties:e=>J(e)},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},$sess_rec_flush_size:{exposure:"hidden"},[i0]:{exposure:"hidden",storageGroup:"flags"},[i1]:{exposure:"hidden",storageGroup:"flags"},[i2]:{exposure:"hidden"},[i3]:{exposure:"hidden",storageGroup:"flags"},[i5]:{exposure:"hidden",storageGroup:"flags"},[i4]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[i6]:{exposure:"hidden",storageGroup:"flags"},[i8]:{exposure:"hidden"},[i9]:{exposure:"hidden"},[i7]:{exposure:"hidden"},[se]:{exposure:"hidden"},[si]:{exposure:"hidden",storageGroup:"surveys"},[ss]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[sr]:{exposure:"event"},[sn]:{exposure:"hidden"},[so]:{exposure:"hidden"},[sa]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$product_tours_activated_session:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[sl]:{exposure:"hidden"},[su]:{exposure:"hidden"},[st]:{exposure:"event"},[sh]:{exposure:"hidden"},[sc]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[sd]:{exposure:"hidden"},[sp]:{exposure:"hidden"},$capture_rate_limit:{exposure:"hidden"},[sf]:{exposure:"hidden"},[sg]:{exposure:"hidden"},[s_]:{exposure:"hidden"},[sv]:{exposure:"hidden"},$replay_override_sampling:{exposure:"event"},$replay_override_linked_flag:{exposure:"event"},$replay_override_url_trigger:{exposure:"event"},$replay_override_event_trigger:{exposure:"event"},[sb]:{exposure:"event"},[sw]:{exposure:"event"},[sE]:{exposure:"hidden"},[sx]:{exposure:"hidden"},[sk]:{exposure:"hidden"},[sS]:{exposure:"hidden"},[s$]:{exposure:"hidden"},[sI]:{exposure:"hidden"},[sP]:{exposure:"hidden"},[sT]:{exposure:"hidden"},[sO]:{exposure:"hidden"},$session_recording_start_reason:{exposure:"event"}},r9=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],r7=e=>{let t=r8[e];if(t)return t;for(let[t,i]of r9)if(0===e.indexOf(t))return i},ne=(e,t)=>{try{let i;return JSON.stringify(e,(e,t)=>es(t)?(null!=i||(i=new WeakMap),i.has(t)||i.set(t,sG(t)),i.get(t)):"bigint"==typeof t?t.toString():t,t)}catch(t){return D(e)}},nt=e=>{let t=null==f?void 0:f.createElement("a");return V(t)?null:(t.href=e,t)},ni=function(e,t){let i,s=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&");for(let e=0;s.length>e;e++){let r=s[e].split("=");if(r[0]===t){i=r;break}}if(!U(i)||2>i.length)return"";{let e=i[1];try{e=decodeURIComponent(e)}catch(t){iS.error("Skipping decoding for malformed query param: "+e)}return e.replace(/\+/g," ")}},ns=function(e,t,i){if(!e||!t||!t.length)return e;let s=e.split("#"),r=s[1],n=(s[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),u=[];for(let e=0;l.length>e;e++){let s=l[e].split("=");U(s)&&(t.includes(s[0])?u.push(s[0]+"="+i):u.push(l[e]))}let h=a;return null!=o&&(h+="?"+u.join("&")),null!=r&&(h+="#"+r),h},nr=function(e,t){let i=e.match(RegExp(t+"=([^&]*)"));return i?i[1]:null},nn=(e,t)=>e>=t&&w(),no=(e,t,i,s)=>{if(0===e){if(w()){let e=t+1;return e===i&&s(),e}return t}return 0},na=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],nl=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...na],nu="<masked>",nh=["li_fat_id"];function nc(e,t,i){let s;if(!f)return{};let r=t?[...na,...i||[]]:[],n=nd(ns(f.URL,r,nu),e);return sH((s={},sq(nh,function(e){let t=sX(e);s[e]=t||null}),s),n)}function nd(e,t){let i=nl.concat(t||[]),s={};return sq(i,function(t){let i=ni(e,t);s[t]=i||null}),s}function np(e){let t=e?0===e.search("https?://(.*)google.([^/?]*)")?"google":0===e.search("https?://(.*)bing.com")?"bing":0===e.search("https?://(.*)yahoo.com")?"yahoo":0===e.search("https?://(.*)duckduckgo.com")?"duckduckgo":null:null,i={};if(!J(t)){i.$search_engine=t;let e=f?ni(f.referrer,"yahoo"!=t?"q":"p"):"";e.length&&(i.ph_keyword=e)}return i}function nf(){return navigator.language||navigator.userLanguage}let ng="$direct";function n_(){return(null==f?void 0:f.referrer)||ng}function nv(e,t,i=!1){let s=e?[...na,...t||[]]:[],r=i?tg(null==g?void 0:g.href):null==g?void 0:g.href,n=null==r?void 0:r.substring(0,1e3);return{r:n_().substring(0,1e3),u:n?ns(n,s,nu):void 0}}function nm(e,t=!1){var i;let{r:s,u:r}=e,n=t?tg(r):r,o={$referrer:s,$referring_domain:null==s?void 0:s==ng?ng:null==(i=nt(s))?void 0:i.host};
2if(n){o.$current_url=n;let e=nt(n);o.$host=null==e?void 0:e.host,o.$pathname=null==e?void 0:e.pathname,sH(o,nd(n))}return s&&sH(o,np(s)),o}function ny(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}let nb={flags:sc,surveys:ss},nw=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],nE=e=>`${e}_cookie_identity_change_pending`,nx=e=>{let t="",i=0;for(let s of e){let e=encodeURIComponent(JSON.stringify(s).slice(1,-1)).length;if(i+e>1e3)break;t+=s,i+=e}return t},nk="main",nS=[i0,i1,i3,i5,i4,sc,i6,i7],n$=e=>-1!==nS.indexOf(e),nI=[iD,ij],nP=e=>-1!==nI.indexOf(e),nT=(e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch(i){return e===t}},nO=e=>{if(!e)return{};let t=JSON.parse(e);return H(t)?t:{}},nC=(e,t)=>{sq(e,(i,s)=>{let r=r7(s);r&&"event"!==r.exposure||({}).hasOwnProperty.call(t,s)||delete e[s]})};var nR=class{constructor(e,t,i=!0){if(this.Qo={},this.Jo=!1,this.Ko=!1,this.Xo=!1,this.Yo=!1,this.ta=!1,this.ea=new Map,this.ia=!1,this.na=!1,this.sa=!1,this.ra=new Set,this.oa=new Set,this.Ir=e,this.aa=i,this.props={},this.la=void 0,this.ua=(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.hi=e.disable_persistence||!!t,this.No=this.ha(e),this.Xo=this.ca(e),this.load(),this.da(),e.debug&&iS.info("Persistence loaded",e.persistence,tE({},this.props)),this.update_config(e,e,t),this.save(),c){const e=()=>this.flush();sK(c,"beforeunload",e,{capture:!1}),sK(c,"pagehide",e,{capture:!1}),this.va=e=>{if(this.Jo&&(!e.storageArea||e.storageArea===(null==c?void 0:c.localStorage))&&e.key)if(e.key!==this.ua){if(this.Xo){let t=r6.find(t=>e.key===this.fa(t));t&&this.pa(e.key,t)}}else this.pa(e.key,nk)},sK(c,"storage",this.va)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(([e,t])=>{let i=this.ea.get(e);if(!n$(e)||!0===i)return;if(!0===t)return void this.ga(e,!0);let s=new Set(i||[]);t.forEach(e=>s.add(e)),s.size&&this.ga(e,s)})}onCrossTabFeatureFlagChange(e){return this.oa.add(e),()=>this.oa.delete(e)}destroy(){this.va&&c&&(c.removeEventListener("storage",this.va),this.va=void 0),this.oa.clear()}pa(e,t,i=!0){let s,r;if(this.hi)return!1;try{if(r=s7.Ot(e),J(r)){let e=this.ma(t);return e.storageValue=null,t!==nk&&(e.persisted=!1),!1}s=nO(r)}catch(e){return!1}let n=t===nk?s:s7.Dt(this.ua);if(n&&this.ya(n))return!1;let o=this.ba(s,t,i);return t===nk&&this.Xo&&!nT(this._a().main,s)||this.wa(s,t,!0,r),o}ya(e){let t=this.props[iR],i=e[iR];return!V(t)&&!V(i)&&t!==i}wa(e,t,i,s){let r=this.ma(t);r.storageValue=s,t!==nk&&(r.persisted=i);try{r.fingerprint=this.ka(e,t)}catch(e){r.fingerprint=void 0}}ba(e,t,i){let s=!1;return nS.forEach(i=>{var r;let n=null==(r=r7(i))?void 0:r.storageGroup;if(t===nk&&this.Xo&&n||t!==nk&&n!==t)return;let o=i in e,a=this.Sa(i,o?e[i]:void 0),l=this.ea.has(i)?i in this.props:o;l===i in this.props&&nT(a,this.props[i])||(l?this.xa(i,a,!1):this.Ca(i,!1),s=!0)}),s&&i&&this.oa.forEach(e=>e()),s}$a(){if(!this.Jo)return!1;try{this.sa=!1;let e=s7.Ot(this.ua),t=this.ma(nk),i,s=!1,r=!1;if(e!==t.storageValue)if(J(e))t.storageValue=null;else{if(i=nO(e),this.sa=!this.na&&this.ya(i),this.sa)return!1;r=this.ba(i,nk,!1),!this.Xo||nT(this._a().main,i)?this.wa(i,nk,!0,e):t.storageValue=e,s=!0}return this.Xo&&r6.forEach(e=>{let t=s7.Ot(this.fa(e)),n=this.ma(e),o=i||{},a=s&&nS.some(t=>{var i;return(null==(i=r7(t))?void 0:i.storageGroup)===e&&t in o});if(t===n.storageValue&&!a)return;if(J(t))return n.storageValue=null,n.persisted=!1,void(a&&(r=this.ba(o,e,!1)||r));let l=nO(t);r=this.ba(l,e,!1)||r,this.wa(l,e,!0,t)}),r}catch(e){return!1}}ga(e,t){this.ea.set(e,t);let i=r7(e);(null==i?void 0:i.volatile)||(this.ma((this.Xo?null==i?void 0:i.storageGroup:void 0)||nk).fingerprint=void 0,this.Ta(e))}Ia(){nS.forEach(e=>this.ea.set(e,!0))}da(){if(this.Jo)try{let e=s7.Ot(this.ua),t=nO(e);this.ma(nk).storageValue=e,nS.forEach(e=>{var i;let s=this.Xo?null==(i=r7(e))?void 0:i.storageGroup:void 0,r=s?s7.Ot(this.fa(s)):null;if(s){let e=this.ma(s);e.storageValue=r,e.persisted=!J(r)}let n=s&&!J(r)?nO(r):t;e in this.props?this.Ma(e,n[e],this.props[e]):e in n&&this.ga(e,!0)})}catch(e){}}Sa(e,t){let i=this.ea.get(e);if(!i)return t;if(!0===i)return this.props[e];if("$active_feature_flags"===e){let s=new Set(U(t)?t:[]),r=new Set(U(this.props[e])?this.props[e]:[]);
2return i.forEach(e=>r.has(e)?s.add(e):s.delete(e)),Array.from(s)}let s=H(t)?tE({},t):{},r=H(this.props[e])?this.props[e]:{};return i.forEach(e=>{e in r?s[e]=r[e]:delete s[e]}),s}Ma(e,t,i){if(!n$(e))return;let s=this.ea.get(e);if(!0===s)return;let r=t;if(this.Jo)try{var n;let t=this.Xo?null==(n=r7(e))?void 0:n.storageGroup:void 0,i=t?this.fa(t):this.ua;r=nO(s7.Ot(i))[e]}catch(e){}let o=new Set(s||[]);if("$active_feature_flags"===e){if(!V(t)&&!U(t)||!V(r)&&!U(r)||!U(i))return void this.ga(e,!0);let s=new Set(t||[]),n=new Set(r||[]),a=new Set(i);new Set([...s,...a]).forEach(e=>{s.has(e)!==a.has(e)&&o.add(e)}),o.forEach(e=>{n.has(e)===a.has(e)&&o.delete(e)})}else{if(!H(i))return void(nT(r,i)?this.ea.delete(e):this.ga(e,!0));{if(!V(t)&&!H(t)||V(t)&&z(i)&&V(r))return void this.ga(e,!0);let s=H(t)?t:{},n=H(r)?r:{};new Set([...Object.keys(s),...Object.keys(i)]).forEach(e=>{e in s==e in i&&nT(s[e],i[e])||o.add(e)}),o.forEach(e=>{e in n==e in i&&nT(n[e],i[e])&&o.delete(e)})}}o.size?this.ga(e,o):this.ea.delete(e)}Ea(){var e;let t=null==(e=this.Ir)?void 0:e.persistence_save_debounce_ms;return Y(t)&&t>0?t:0}Pa(e){if(this.Ir.cookieWinsOnConflict&&"localstorage+cookie"===this.Ir.persistence.toLowerCase())if(e)try{let t=rr(e,this.Ir.cookie_persisted_properties||[]),i=ro(t,this.Ir.cookie_persisted_properties||[]),s=JSON.stringify(t)+"|"+JSON.stringify(i),r=s8.Ot(this.ua)||void 0;r&&rl(this.ua,r)===s&&(this.Ra=s,this.Aa=r)}catch(e){}else try{let e=s8.Ot(this.ua)||void 0;this.Ra=e?rl(this.ua,e):void 0,this.Aa=e}catch(e){}}syncCookieProperties(){return this.Fa(this.Ir)}Fa(e,t=!1){let i,s;if(this.hi&&!t||this.ta||!e.cookieWinsOnConflict||"localstorage+cookie"!==e.persistence.toLowerCase())return!1;try{i=s8.Ot(this.ua)||void 0}catch(e){}if(!i||i===this.Aa)return!1;let r=rl(this.ua,i);try{s=rs(JSON.parse(i))}catch(e){return!1}if((s8.Ot(this.ua)||void 0)!==i)return!1;this.Ra=r,this.Aa=i;let n=ra(this.ua,i),o=[...rt,...n.properties],a={};if(Object.keys(s).forEach(e=>{let t=s[e];(V(t)||J(t)||""===t||"$user_state"===e&&"anonymous"!==t&&"identified"!==t)&&(a[e]=!0,delete s[e])}),z(s))return!1;let l="distinct_id"in s||"anonymous"===s.$user_state||"identified"===s.$user_state,u=this.props,h=u[iR],c=u[sd],d=sH({},u);[...rt,...e.cookie_persisted_properties||[]].forEach(e=>{if(-1!==o.indexOf(e)&&!(e in s)&&!a[e]&&(l||"distinct_id"!==e&&"$user_state"!==e)){let t=d[e];(n.isValid||-1===rt.indexOf(e)||!1!==t&&0!==t)&&delete d[e]}}),this.props=sH(d,s),nS.forEach(e=>{let t=e in this.props;e in u===t&&nT(u[e],this.props[e])||(t?this.Ma(e,u[e],this.props[e]):this.ga(e,!0))}),!l||"$user_state"in s||"$user_state"in this.props||this.xa(sd,sR);let p=this.props[iR],f=this.props[sd];return l&&(p!==h||f!==c)&&(this.na=!0,this.Yo=!0,rd.$t(nE(this.ua),!0),this.Ca(i7),this.Ca(i1),this.Ca(i0),this.Ca(i3),this.Ca(i5),this.Ca(i4),this.Ca(sc),this.Ca(sh),this.Ca(sl),"anonymous"!==f||"identified"!==c&&"anonymous"!==s.$user_state&&(V(h)||p===h)||(nC(this.props,s),this.Ca(se)),"identified"===f?this.props.$user_id=p:delete this.props.$user_id,this.Ca(iM)),!0}
2consumeCookieIdentityChange(){let e=nE(this.ua),t=this.Yo||!!rd.Ot(e);return this.Yo=!1,t&&rd.Lt(e),t}Oa(e=!1){return!(this.ta||this.hi&&!e||!this.Ir.cookieWinsOnConflict||"localstorage+cookie"!==this.Ir.persistence.toLowerCase()||(this.ta=!0,0))}Da(){this.ta&&(V(this.La)||(clearTimeout(this.La),this.La=void 0),delete this.Qo[nk],this.Na(!0))}qa(e=!0){if(this.ta)try{e?this.Da():V(this.La)||(clearTimeout(this.La),this.La=void 0)}finally{this.ta=!1}}isDisabled(){return!!this.hi}ha(e){-1===nw.indexOf(e.persistence.toLowerCase())&&(iS.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");let t=((e=[],t=!1)=>{let i=[...rt,...e];return tE(tE({},s7),{},{Dt(e){try{let r,n,o={};try{o=(n=s8.Ot(e)||void 0)?rs(JSON.parse(n)):{}}catch(e){}let a=JSON.parse(s7.Ot(e)||"{}");if(t){let t=ra(e,n),l=[...rt,...t.properties],u={};Object.keys(o).forEach(e=>{let t=o[e];J(t)||""===t||"$user_state"===e&&"anonymous"!==t&&"identified"!==t||(u[e]=t)});let h="distinct_id"in u||"anonymous"===u.$user_state||"identified"===u.$user_state;if(Object.keys(u).length>0){var s;let e=a[iR],r=null!=(s=a.$user_state)?s:sR;i.forEach(e=>{if(-1!==l.indexOf(e)&&!(e in o)&&(h||"distinct_id"!==e&&"$user_state"!==e)){let i=a[e];(t.isValid||-1===rt.indexOf(e)||!1!==i&&0!==i)&&delete a[e]}}),!h||"$user_state"in o||"$user_state"in a||(a[sd]=sR),h&&(("distinct_id"in u?u[iR]:a[iR])!==e||("$user_state"in u?u[sd]:a[sd])!==r)&&(re.forEach(e=>delete a[e]),"identified"===u.$user_state&&"distinct_id"in u?a.$user_id=u[iR]:delete a.$user_id,"identified"!==u.$user_state&&(delete a[st],delete a[se]),delete a.__alias)}r=sH(a,u)}else r=sH(o,a);return s7.$t(e,r),r}catch(e){}return null},$t(i,s,r,n,o,a){let l=s7.$t(i,s,void 0,void 0,a);try{let u=rr(s,e);if(Object.keys(u).length){if(t){let t=i+"_cpm",h=ro(u,e);if(s8.$t(t,h,r,n,o,a),s8.Ot(t)!==JSON.stringify(h)){s8.Lt(t,n);let e=rr(s);return s8.$t(i,e,r,n,o,a),l}}s8.$t(i,u,r,n,o,a)}}catch(e){s7.Pt(e)}return l},Lt(e,t){try{null==c||c.localStorage.removeItem(e),s8.Lt(e,t),s8.Lt(e+"_cpm",t)}catch(e){s7.Pt(e)}}})})(e.cookie_persisted_properties||[],e.cookieWinsOnConflict),i,s=!1,r=!1,n=e.persistence.toLowerCase();return"localstorage"===n&&s7.Et()?(i=s7,r=!0):"localstorage+cookie"===n&&t.Et()?(i=t,r=!0,s=!0):"sessionstorage"===n&&rd.Et()?i=rd:"memory"===n?i=rh:"cookie"===n&&s8.Et()?(i=s8,s=!0):t.Et()?(i=t,r=!0,s=!0):s8.Et()?(i=s8,s=!0):i=rh,this.Jo=r,this.Ko=s,i}fa(e){return`${this.ua}__${e}`}ca(e){return this.Jo&&!!e.split_storage}properties(){let e={};return sq(this.props,(t,i)=>{let s=r7(i);if(!s||"event"===s.exposure){var r;if(null==s||null==(r=s.shouldSkipFromEventProperties)?void 0:r.call(s,t))return;e[i]=t}}),e}load(e=!1){if(this.hi&&!e)return;let t=this.Ir.cookieWinsOnConflict&&"localstorage+cookie"===this.Ir.persistence.toLowerCase(),i=t?s7.Dt(this.ua):null,s={};if(t)try{s=rs(s8.Dt(this.ua)),sq(s,(e,t)=>{(V(e)||J(e)||""===e)&&delete s[t]})}catch(e){}let r=this.No.Dt(this.ua);if(r&&(this.props=sH({},r)),this.Xo&&this.ja(),t&&r){var n,o;let e=null==i?void 0:i[iR],t=null!=(n=null==i?void 0:i.$user_state)?n:sR,a=r[iR],l=null!=(o=r.$user_state)?o:sR;if(a!==e||l!==t){this.Yo=!0,rd.$t(nE(this.ua),!0);let i=sH({},this.props);re.forEach(e=>delete i[e]),"anonymous"!==l||"identified"!==t&&"anonymous"!==s.$user_state&&(V(e)||a===e)||(nC(i,s),delete i[se]),this.props=i;let r=new Set;re.forEach(e=>{var t;let i=null==(t=r7(e))?void 0:t.storageGroup;i&&r.add(i)}),r.forEach(e=>{let t={};sq(this.props,(i,s)=>{var r;(null==(r=r7(s))?void 0:r.storageGroup)===e&&(t[s]=i)}),z(t)?(s7.Lt(this.fa(e)),this.Qo[e]={}):s7.$t(this.fa(e),t)&&(this.Qo[e]={persisted:!0,fingerprint:this.ka(t,e)})})}}rd.Ot(nE(this.ua))&&(this.Yo=!0)}ja(){for(let e of r6){let t=s7.Dt(this.fa(e));if(t&&!z(t)){let i=this.ma(e);i.persisted=!0,this.Ba(e)||(i.fingerprint=this.ka(t,e)),this.Ha(e,t)||sH(this.props,t)}}}Ba(e){return Object.keys(this.props).some(t=>{var i;return(null==(i=r7(t))?void 0:i.storageGroup)===e})}Ha(e,t){let i=nb[e];if(!i)return!1;let s=t[i],r=this.props[i];return Y(s)&&Y(r)&&r>s}refreshKey(e){var t;if(this.hi||this.ra.has(e))return;let i=this.Xo?null==(t=r7(e))?void 0:t.storageGroup:void 0,s=i?s7.Dt(this.fa(i)):this.No.Dt(this.ua);if(s&&e in s)this.xa(e,s[e],!1);else{if(i){let t=this.No.Dt(this.ua);if(t&&e in t)return void this.xa(e,t[e],!1)}this.Ca(e,!1)}}save(){if(this.hi)return;let e=this.Ea();e>0?V(this.La)&&(this.La=setTimeout(()=>{this.La=void 0,this.Na()},e)):this.Na()}flush(){V(this.La)||(clearTimeout(this.La),this.La=void 0,this.Na())}Na(e=!1){if(this.hi||this.ta&&!e)return;e||(this.syncCookieProperties(),this.Ir.cookieWinsOnConflict&&"localstorage+cookie"===this.Ir.persistence.toLowerCase()||nI.forEac
2h(e=>this.refreshKey(e)));let t=!e&&!this.ia;t||(this.sa=!1);let i=!!t&&this.$a();if(this.sa)return void(this.Ir.debug&&iS.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this.Xo)return this.za(),void(i&&this.oa.forEach(e=>e()));let s=this.Ua(this.No,this.ua,this.props,nk);"written"===s&&this.Pa(this.props),"failed"!==s&&(this.ea.clear(),this.na=!1,this.ra.clear()),i&&this.oa.forEach(e=>e())}za(){let{main:e,groups:t}=this._a(),i=this.Ua(this.No,this.ua,e,nk);for(let r of("written"===i&&this.Pa(e),"failed"!==i&&(this.na=!1,this.ra.clear(),nS.forEach(e=>{var t;(null==(t=r7(e))?void 0:t.storageGroup)||this.ea.delete(e)})),r6)){var s;let e=t[r];if(z(e)&&!(null==(s=this.Qo[r])?void 0:s.persisted)){nS.forEach(e=>{var t;(null==(t=r7(e))?void 0:t.storageGroup)===r&&this.ea.delete(e)});continue}let i=this.Ua(s7,this.fa(r),e,r);"failed"!==i&&nS.forEach(e=>{let t=r7(e);(null==t?void 0:t.storageGroup)!==r||"written"!==i&&t.volatile||this.ea.delete(e)})}}_a(){let e={},t={flags:{},surveys:{}};return sq(this.props,(i,s)=>{var r;let n=null==(r=r7(s))?void 0:r.storageGroup;n?t[n][s]=i:e[s]=i}),{main:e,groups:t}}ka(e,t){if(t===nk)return JSON.stringify(e)+"|"+this.Wa+"|"+this.Va+"|"+this.Ga;let i={};return sq(e,(e,t)=>{var s;i[t]=(null==(s=r7(t))?void 0:s.volatile)?"__volatile__":e}),JSON.stringify(i)}Ua(e,t,i,s){let r,n=this.ma(s);if(s!==nk&&!n.dirty&&!V(n.fingerprint))return"skipped";try{if((r=this.ka(i,s))===n.fingerprint)return n.dirty=!1,"skipped"}catch(e){r=void 0}return e.$t(t,i,this.Wa,this.Va,this.Ga,this.Ir.debug)?(n.dirty=!1,s!==nk&&(n.persisted=!0),V(r)||(n.fingerprint=r),this.Jo&&(n.storageValue=s7.Ot(t)),"written"):(this.Ir.debug&&iS.warn(`failed to persist storage entry "${t}"; will retry on next save`),"failed")}remove({keepGroupEntries:e=!1}={}){if(this.Ia(),V(this.La)||(clearTimeout(this.La),this.La=void 0),this.No.Lt(this.ua,!1),this.No.Lt(this.ua,!0),!e&&this.aa)for(let e of r6)s7.Lt(this.fa(e));e?delete this.Qo[nk]:this.Qo={},this.Ra=void 0,this.Aa=void 0}clear(){this.remove(),this.props={}}register_once(e,t,i){if(H(e)){this.syncCookieProperties(),V(t)&&(t="None"),this.Wa=V(i)?this.Za:i;let s=!1;if(sq(e,(e,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==t||(this.xa(i,e),s=!0)}),s)return this.save(),!0}return!1}register(e,t){if(H(e)){this.syncCookieProperties(),this.Wa=V(t)?this.Za:t;let i=!1;if(sq(e,(t,s)=>{e.hasOwnProperty(s)&&(this.props[s]!==t||H(t)||U(t))&&(this.xa(s,t),i=!0)}),i)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();let t=!1;for(let i of"string"==typeof e?[e]:e)i in this.props&&(this.Ca(i),t=!0);t&&this.save()}update_campaign_params(){let e=null==f?void 0:f.URL;if(e===this.la)return;let t=nc(this.Ir.custom_campaign_params,this.Ir.mask_personal_data_properties,this.Ir.custom_personal_data_properties),i=!z(sW(t));return i&&this.register(t),this.la=e,i?t:void 0}update_search_keyword(){let e;this.register((e=null==f?void 0:f.referrer)?np(e):{})}update_referrer_info(){var e;this.register_once({$referrer:n_(),$referring_domain:(null==f?void 0:f.referrer)&&(null==(e=nt(f.referrer))?void 0:e.host)||ng},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;let e=nv(this.Ir.mask_personal_data_properties,this.Ir.custom_personal_data_properties,this.Ir.disable_capture_url_hashes);this.register_once({[s_]:this.Ko?{r:nx(e.r),u:e.u?nx(e.u):void 0}:e},void 0)}get_initial_props(){let e={};sq([sg,sf],t=>{let i=this.props[t];i&&sq(i,function(t,i){e["$initial_"+L(i)]=t})});let t=this.props[s_];return t&&sH(e,function(e,t=!1){let i=nm(e,t),s={};return sq(i,function(e,t){s[`$initial_${L(t)}`]=e}),s}(t,this.Ir.disable_capture_url_hashes)),e}safe_merge(e){return sq(this.props,function(t,i){i in e||(e[i]=t)}),e}update_config(e,t,i){let s=e.persistence!==t.persistence,r=!((e,t)=>{if(e.length!==t.length)return!1;let i=[...e].sort(),s=[...t].sort();return i.every((e,t)=>e===s[t])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),n=s||r,o=e.cookieWinsOnConflict!==t.cookieWinsOnConflict,a=e.disable_persistence||!!i,l=!!this.hi&&!a;a||this.Fa(t,l),this.Ir=e,!a&&(s||r||o)&&(this.Ra=void 0,this.Aa=void 0,this.Fa(tE(tE({},e),{},{cookie_persisted_properties:t.cookie_persisted_properties}),l));let u=n||o?this.ha(e):this.No;this.Qa();let h=this.ca(e),c=n||h!==this.Xo,d=!a&&(c||e.cross_subdomain_cookie!==this.Va||e.secure_cookie!==this.Ga)&&this.Oa(l);this.ia=c;try{if(this.Za=this.Wa=e.cookie_expiration,this.set_disabled(a),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),c){let e=this.props;this.clear(),this.No=u,this.Xo=h,this.props=e,this.save()}else o&&(this.No=u,a||(delete this.Qo[nk],this.Na()))}finally{this.ia=!1,d&&this.qa()}}Qa(){let e=this.props[s_];if(!this.Ko||!H(e)||"string"!=typeof e.r)return;let t=nx(e.r),i="string"==typeof e.u?nx(e.u):e.u;t===e.r&&i===e.u||this.xa(s_,tE(tE({},e),{},{r:t,u:i}))}set_disabled(e){this.hi=e,this.hi?this.remove():this.save()}set_cross_subdomain(e){e!==this.Va&&(this.Va=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.Ga&&(this.Ga=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){let i=this.props.__timers||{};i[e]=t,this.xa(iB,i),this.save()}remove_event_timer(e){let t=this.props.__timers||{},i=t[e];return V(i)||(delete t[e],this.xa(iB,t),this.save()),i}get_property(e){return this.props[e]}set_property(e,t){this.xa(e,t),this.save()}xa(e,t,i=!0){var s;let r=this.props[e];this.props[e]=t,i&&("distinct_id"!==e&&"$user_state"!==e||r===t||(this.na=!0),nP(e)&&!nT(r,t)&&this.ra.add(e),this.Ma(e,r,t),(null==(s=r7(e))?void 0:s.volatile)||this.Ta(e))}Ca(e,t=!0){delete this.props[e],t&&(n$(e)&&this.ga(e,!0),nP(e)&&this.ra.add(e),this.Ta(e))}Ta(e){var t;let i=null==(t=r7(e))?void 0:t.storageGroup;i&&(this.ma(i).dirty=!0)}ma(e){return this.Qo[e]||(this.Qo[e]={})}};let nF={GZipJS:"gzip-js",Base64:"base64"},nA={Activation:"events",Cancellation:"cancelEvents"},nM={Button:"button",Tab:"tab",Selector:"selector"},nL={TopLeft:"top_left",TopRight:"top_right",TopCenter:"top_center",MiddleLeft:"middle_left",MiddleRight:"middle_right",MiddleCenter:"middle_center",Left:"left",Center:"center",Right:"right",NextToTrigger:"next_to_trigger"},nD={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},nN={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},nj={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},nB={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},nU={Once:"once",Recurring:"recurring",Always:"always"},nq={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},nH={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_
2START_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"},nz={Popover:"popover",Inline:"inline"};function nV(e){let t=!0;return{dispose(){if(t){t=!1;let i=e();i&&q(i.then)&&i.then(void 0,()=>{})}}}}let nW={backgroundColor:"#ffffff",textColor:"#1d1f27",buttonColor:"#1d1f27",borderRadius:8,buttonBorderRadius:6,borderColor:"#e5e7eb",fontFamily:"system-ui",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",showOverlay:!0,whiteLabel:!1,dismissOnClickOutside:!0,zIndex:0x7ffffffe},nG={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"},nJ={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"},nK=i$("[RateLimiter]");var nY=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=>{nK.info(`${e||"events"} is quota limited.`),this.serverLimits[e]=(new Date).getTime()+6e4})}catch(e){return void nK.warn(`could not rate limit - continuing. Error: "${null==e?void 0:e.message}"`,{text:t})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return(null==(e=this.instance.config.rate_limiting)?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max((null==(e=this.instance.config.rate_limiting)?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e=!1){var t,i,s;let{captureEventsBurstLimit:r,captureEventsPerSecond:n}=this,o=(new Date).getTime(),a=null!=(t=null==(i=this.instance.persistence)?void 0:i.get_property("$capture_rate_limit"))?t:{tokens:r,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>r&&(a.tokens=r);let l=1>a.tokens;if(l||e||(a.tokens=Math.max(0,a.tokens-1)),l&&!e){let e=(Y(a.dropped)?a.dropped:0)+1;a.dropped=e,!this.lastEventRateLimited&&this.Ja(e)&&(a.dropped=0)}return this.lastEventRateLimited=l,null==(s=this.instance.persistence)||s.set_property("$capture_rate_limit",a),{isRateLimited:l,remainingTokens:a.tokens}}Ka(e){let t=this.instance.config.property_denylist;return!U(t)||!t.includes(e)}Xa(){var e;if(this.Ka("$current_url")&&this.Ka("$pathname")&&(null==g?void 0:g.pathname))return`${null!=(e=g.origin)?e:""}${g.pathname}`}Ja(e){var t,i;let{captureEventsBurstLimit:s,captureEventsPerSecond:r}=this,n=this.Xa(),o=this.Ka("$session_id")?null==(t=(i=this.instance).get_session_id)?void 0:t.call(i):void 0,a=[`${e} event(s) dropped since the last warning`,n?`triggered on ${n}`:void 0,o?`session ${o}
vendor: 9,528 bytes, line 2
2`:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:`posthog-js client rate limited: ${a}. Config is set to ${r} events per second and ${s} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(e){let t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}};let nX=i$("[RemoteConfig]");var nQ=class{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=x._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}Ya(e){var t,i,s;(null==(t=x.__PosthogExtensions__)?void 0:t.loadExternalDependency)?null==(i=x.__PosthogExtensions__)||null==(s=i.loadExternalDependency)||s.call(i,this._instance,"remote-config",()=>e(this.remoteConfig)):e()}tl(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 nX.info("Using preloaded remote config",this.remoteConfig),void this.el(this.remoteConfig);if(this._instance.il())return void nX.warn("Remote config is disabled. Falling back to local config.");this.Ya(e=>{e?this.el(e):(nX.info("No config found after loading remote JS config. Falling back to JSON."),this.tl(e=>{this.el(e.json,e)}))})}catch(e){nX.error("Error loading remote config",e),this.el()}}el(e,t){!e&&t&&(0===t.statusCode?t.error||nX.warn("Failed to fetch remote config from PostHog."):nX.error("Failed to fetch remote config from PostHog."));try{this._instance.el(e?{ok:!0,config:e}:{ok:!1})}catch(e){nX.error("Error applying remote config",e)}if(!1!==(null==e?void 0:e.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var i;null==(i=this._instance.featureFlags)||i.ensureFlagsLoaded()}catch(e){nX.error("Error loading feature flags",e)}}};let nZ=["fatal","error","warning","log","info","debug"];var n0=Uint8Array,n1=Uint16Array,n2=Uint32Array,n3=new n0([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]),n5=new n0([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]),n4=new n0([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),n6=function(e,t){for(var i=new n1(31),s=0;31>s;++s)i[s]=t+=1<<e[s-1];var r=new n2(i[30]);for(s=1;30>s;++s)for(var n=i[s];i[s+1]>n;++n)r[n]=n-i[s]<<5|s;return[i,r]},n8=n6(n3,2),n9=n8[1];n8[0][28]=258,n9[258]=28;for(var n7=n6(n5,0)[1],oe=new n1(32768),ot=0;32768>ot;++ot){var oi=(43690&ot)>>>1|(21845&ot)<<1;oe[ot]=((65280&(oi=(61680&(oi=(52428&oi)>>>2|(13107&oi)<<2))>>>4|(3855&oi)<<4))>>>8|(255&oi)<<8)>>>1}var os=function(e,t,i){for(var s=e.length,r=0,n=new n1(t);s>r;++r)++n[e[r]-1];var o,a=new n1(t);for(r=0;t>r;++r)a[r]=a[r-1]+n[r-1]<<1;if(i){o=new n1(1<<t);var l=15-t;for(r=0;s>r;++r)if(e[r])for(var u=r<<4|e[r],h=t-e[r],c=a[e[r]-1]++<<h,d=c|(1<<h)-1;d>=c;++c)o[oe[c]>>>l]=u}else for(o=new n1(s),r=0;s>r;++r)o[r]=oe[a[e[r]-1]++]>>>15-e[r];return o},or=new n0(288);for(ot=0;144>ot;++ot)or[ot]=8;for(ot=144;256>ot;++ot)or[ot]=9;for(ot=256;280>ot;++ot)or[ot]=7;for(ot=280;288>ot;++ot)or[ot]=8;var on=new n0(32);for(ot=0;32>ot;++ot)on[ot]=5;var oo=os(or,9,0),oa=os(on,5,0),ol=function(e){return(e/8|0)+(7&e&&1)},ou=function(e,t,i){(null==t||0>t)&&(t=0),(null==i||i>e.length)&&(i=e.length);var s=new(e instanceof n1?n1:e instanceof n2?n2:n0)(i-t);return s.set(e.subarray(t,i)),s},oh=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8},oc=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8,e[s+2]|=i>>>16},od=function(e,t){for(var i=[],s=0;e.length>s;++s)e[s]&&i.push({s:s,f:e[s]});var r=i.length,n=i.slice();if(!r)return[new n0(0),0];if(1==r){var o=new n0(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort(function(e,t){return e.f-t.f}),i.push({s:-1,f:25001});var a=i[0],l=i[1],u=0,h=1,c=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};h!=r-1;)a=i[i[c].f>i[u].f?u++:c++],l=i[u!=h&&i[c].f>i[u].f?u++:c++],i[h++]={s:-1,f:a.f+l.f,l:a,r:l};var d=n[0].s;for(s=1;r>s;++s)n[s].s>d&&(d=n[s].s);var p=new n1(d+1),f=op(i[h-1],p,0);if(f>t){s=0;var g=0,_=f-t,v=1<<_;for(n.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});r>s;++s){var m=n[s].s;if(t>=p[m])break;g+=v-(1<<f-p[m]),p[m]=t}for(g>>>=_;g>0;){var y=n[s].s;t>p[y]?g-=1<<t-p[y]++-1:++s}for(;s>=0&&g;--s){var b=n[s].s;p[b]==t&&(--p[b],++g)}f=t}return[new n0(p),f]},op=function(e,t,i){return -1==e.s?Math.max(op(e.l,t,i+1),op(e.r,t,i+1)):t[e.s]=i},of=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new n1(++t),s=0,r=e[0],n=1,o=function(e){i[s++]=e},a=1;t>=a;++a)if(e[a]==r&&a!=t)++n;else{if(!r&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(r),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(r);n=1,r=e[a]}return[i.subarray(0,s),t]},og=function(e,t){for(var i=0,s=0;t.length>s;++s)i+=e[s]*t[s];return i},o_=function(e,t,i){var s=i.length,r=ol(t+2);e[r]=255&s,e[r+1]=s>>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var n=0;s>n;++n)e[r+n+4]=i[n];return 8*(r+4+s)},ov=function(e,t,i,s,r,n,o,a,l,u,h){oh(t,h++,i),++r[256];for(var c=od(r,15),d=c[0],p=c[1],f=od(n,15),g=f[0],_=f[1],v=of(d),m=v[0],y=v[1],b=of(g),w=b[0],E=b[1],x=new n1(19),k=0;m.length>k;++k)x[31&m[k]]++;for(k=0;w.length>k;++k)x[31&w[k]]++;for(var S=od(x,7),$=S[0],I=S[1],P=19;P>4&&!$[n4[P-1]];--P);var T,O,C,R,F=u+5<<3,A=og(r,or)+og(n,on)+o,M=og(r,d)+og(n,g)+o+14+3*P+og(x,$)+(2*x[16]+3*x[17]+7*x[18]);if(A>=F&&M>=F)return o_(t,h,e.subarray(l,l+u));if(oh(t,h,1+(A>M)),h+=2,A>M){T=os(d,p,0),O=d,C=os(g,_,0),R=g;var L=os($,I,0);for(oh(t,h,y-257),oh(t,h+5,E-1),oh(t,h+10,P-4),h+=14,k=0;P>k;++k)oh(t,h+3*k,$[n4[k]]);h+=3*P;for(var D=[m,w],N=0;2>N;++N){var j=D[N];for(k=0;j.length>k;++k)oh(t,h,L[B=31&j[k]]),h+=$[B],B>15&&(oh(t,h,j[k]>>>5&127),h+=j[k]>>>12)}}else T=oo,O=or,C=oa,R=on;for(k=0;a>k;++k)if(s[k]>255){oc(t,h,T[257+(B=s[k]>>>18&31)]),h+=O[B+257],B>7&&(oh(t,h,s[k]>>>23&31),h+=n3[B]);var B,U=31&s[k];oc(t,h,C[U]),h+=R[U],U>3&&(oc(t,h,s[k]>>>5&8191),h+=n5[U])}else oc(t,h,T[s[k]]),h+=O[s[k]];return oc(t,h,T[256]),h+O[256]},om=new n2([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),oy=new n0(0),ob=function(){for(var e=new n2(256),t=0;256>t;++t){for(var i=t,s=9;--s;)i=(1&i&&0xedb88320)^i>>>1;e[t]=i}return e}(),ow=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};let oE=!!v||!!_,ox=new WeakMap,ok="text/plain",oS=0,o$=!1,oI=(e,t)=>{let[i,s]=e.split("#"),[r,n]=i.split("?");if(!n)return e;let o=n.split("&").filter(e=>e.split("=")[0]!==t).join("&");return`${r}${o?`?${o}`:""}${s?`#${s}`:""}`},oP=(e,t,i=!0)=>{var s;let[r,n]=e.split("?"),o=tE({},t),a=null!=(s=null==n?void 0:n.split("&").map(e=>{var t;let[s,r]=e.split("="),n=i&&null!=(t=o[s])?t:r;return delete o[s],`${s}=${n}`}))?s:[],l=function(e,t="&"){let i,s,r=[];return sq(e,function(e,t){V(e)||V(t)||"undefined"===t||(i=encodeURIComponent(e instanceof File?e.name:e.toString()),s=encodeURIComponent(t),r[r.length]=s+"="+i)}),r.join(t)}(o);return l&&a.push(l),a.length>0?`${r}?${a.join("&")}`:r},oT=e=>{var t,i,s,r,n,o,a,l,u,h;if(e.nl)return e.nl;let{data:c,compression:d}=e;if(!c)return;if(d===nF.GZipJS){let e=(t=function(e){var t=e.length;if("u">typeof TextEncoder)return(new TextEncoder).encode(e);for(var i=new n0(e.length+(e.length>>>1)),s=0,r=function(e){i[s++]=e},n=0;t>n;++n){if(s+5>i.length){var o=new n0(s+8+(t-n<<1));o.set(i),i=o}var a=e.charCodeAt(n);128>a?r(a):(2048>a?r(192|a>>>6):(a>55295&&57344>a?(r(240|(a=65536+(1047552&a)|1023&e.charCodeAt(++n))>>>18),r(128|a>>>12&63)):r(224|a>>>12),r(128|a>>>6&63)),r(128|63&a))}return ou(i,0,s)}(ne(c)),i={mtime:0},s=0xffffffff,r={p(e){for(var t=s,i=0;e.length>i;++i)t=ob[255&t^e[i]]^t>>>8;s=t},d:()=>0xffffffff^s},n=t.length,r.p(t),u=(o=10+(i.filename&&i.filename.length+1||0),l=function(e,t,i,s,r){var n=e.length,o=new n0(s+n+5*(1+Math.floor(n/7e3))+8),a=o.subarray(s,o.length-8),l=0;if(!t||8>n)for(var u=0;n>=u;u+=65535){var h=u+65535;n>h?l=o_(a,l,e.subarray(u,h)):(a[u]=r,l=o_(a,l,e.subarray(u,n)))}else{for(var c=om[t-1],d=c>>>13,p=8191&c,f=(1<<i)-1,g=new n1(32768),_=new n1(f+1),v=Math.ceil(i/3),m=2*v,y=function(t){return(e[t]^e[t+1]<<v^e[t+2]<<m)&f},b=new n2(25e3),w=new n1(288),E=new n1(32),x=0,k=0,S=(u=0,0),$=0,I=0;n>u;++u){var P=y(u),T=32767&u,O=_[P];if(g[T]=O,_[P]=T,u>=$){var C=n-u;if((x>7e3||S>24576)&&C>423){l=ov(e,a,0,b,w,E,k,S,I,u-I,l),S=x=k=0,I=u;for(var R=0;286>R;++R)w[R]=0;for(R=0;30>R;++R)E[R]=0}var F=2,A=0,M=p,L=T-O&32767;if(C>2&&P==y(u-L))for(var D=Math.min(d,C)-1,N=Math.min(32767,u),j=Math.min(258,C);N>=L&&--M&&T!=O;){if(e[u+F]==e[u+F-L]){for(var B=0;j>B&&e[u+B]==e[u+B-L];++B);if(B>F){if(F=B,A=L,B>D)break;var U=Math.min(L,B-2),q=0;for(R=0;U>R;++R){var H=u-L+R+32768&32767,z=H-g[H]+32768&32767;z>q&&(q=z,O=H)}}}L+=(T=O)-(O=g[T])+32768&32767}if(A){b[S++]=0x10000000|n9[F]<<18|n7[A];var V=31&n9[F],W=31&n7[A];k+=n3[V]+n5[W],++w[257+V],++E[W],$=u+F,++x}else b[S++]=e[u],++w[e[u]]}}l=ov(e,a,r,b,w,E,k,S,I,u-I,l),r||(l=o_(a,l,oy))}return ou(o,0,s+ol(l)+8)}(t,null==i.level?6:i.level,null==i.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+i.mem,o,!a)).length,function(e,t){var i=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=2>t.level?4:2*(9==t.level),e[9]=3,0!=t.mtime&&ow(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var s=0;i.length>=s;++s)e[s+10]=i.charCodeAt(s)}}(l,i),ow(l,u-8,r.d()),ow(l,u-4,n),l);return{contentType:ok,body:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength),estimatedSize:e.byteLength}}if(d===nF.Base64){let e,t="data="+encodeURIComponent("string"==typeof(e=(h=ne(c))?btoa(encodeURIComponent(h).replace(/%([0-9A-F]{2})/g,(e,t)=>
2String.fromCharCode(parseInt(t,16)))):h)?e:ne(e));return{contentType:"application/x-www-form-urlencoded",body:t,estimatedSize:new Blob([t]).size}}let p=ne(c);return{contentType:"application/json",body:p,estimatedSize:new Blob([p]).size}},oO=e=>{var t;let i,s=()=>"sendBeacon"===e.transport?{url:oP(e.url,{compression:nF.Base64}),encodedBody:oT(tE(tE({},e),{},{compression:nF.Base64,nl:void 0}))}:{url:oI(e.url,"compression"),encodedBody:oT(tE(tE({},e),{},{compression:void 0,nl:void 0}))};try{i=oT(e)}catch(t){if(t9(e.compression,ni(e.url,"compression")))return iS.error("Failed to gzip request body, sending uncompressed payload",t),s();throw t}return!(i&&t9(e.compression,ni(e.url,"compression")))||((t=i.body)instanceof ArrayBuffer?t8(new Uint8Array(t)):ArrayBuffer.isView(t)&&t8(new Uint8Array(t.buffer,t.byteOffset,t.byteLength)))?{url:e.url,encodedBody:i}:(o$=!0,s())},oC=e=>{try{return oO(e)}catch(i){var t;return iS.error(i),void(null==(t=e.callback)||t.call(e,{statusCode:0,error:i}))}},oR=($=eu(function*(e){let t=yield function(e){return ii.apply(this,arguments)}(ne(e.data),S.DEBUG,{rethrow:!0});if(!t)return e;let i=yield t.arrayBuffer();return tE(tE({},e),{},{nl:{contentType:ok,body:i,estimatedSize:i.byteLength}})}),function(e){return $.apply(this,arguments)}),oF=/Failed to fetch|NetworkError|Load failed/i,oA=e=>"TypeError"===(null==e?void 0:e.name)&&oF.test((null==e?void 0:e.message)||""),oM=e=>{try{let t=function(e,t=Date.now()){if("string"!=typeof e||!e)return;let i=e.trim(),s=/^\d+\s*,/.test(i)?i.slice(0,i.indexOf(",")).trim():i;if(/^\d+$/.test(s)){let e=1e3*Math.min(Number(s),300);return e>0?e:void 0}if(!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(s))return;let r=/^\w{3} \w{3} /.test(s)?s+" GMT":s,n=Date.parse(r)-t;return Number.isFinite(n)&&n>0?Math.min(n,3e5):void 0}(e());return V(t)?void 0:Math.min(t,3e4)}catch(e){return}},oL=e=>{let t=oC(e);if(!t)return;let i=new v;ox.set(i,!0);let{url:s,encodedBody:r}=t;i.open(e.method||"GET",s,!0);let{contentType:n,body:o}=null!=r?r:{};sq(e.headers,function(e,t){i.setRequestHeader(t,e)}),n&&i.setRequestHeader("Content-Type",n),e.timeout&&(i.timeout=e.timeout),i.onreadystatechange=()=>{if(4===i.readyState){var t;let s={statusCode:i.status,text:i.responseText};if(200===i.status)try{s.json=JSON.parse(i.responseText)}catch(e){}null==(t=e.callback)||t.call(e,s,oM(()=>i.getResponseHeader("Retry-After")))}},i.send(o)},oD=e=>{let t=oC(e);if(!t)return;let{url:i,encodedBody:s}=t,{contentType:r,body:n,estimatedSize:o}=null!=s?s:{},a=new Headers;sq(e.headers,function(e,t){a.append(t,e)}),r&&a.append("Content-Type",r);let l=null,u=!1;if(m){let t=new m;l={signal:t.signal,timeout:setTimeout(()=>{var i;u=!0;try{t.abort(tf("AbortError","PostHog request timed out"+((i=e.timeout)?` after ${i}ms`:"")))}catch(e){c(e)}},e.timeout)}}let h=!1,c=t=>{var i;h||(h=!0,u&&"AbortError"===(null==t?void 0:t.name)||oA(t)?iS.warn(t):iS.error(t),null==(i=e.callback)||i.call(e,{statusCode:0,error:t}))},d=0,p=()=>{oS-=d,d=0,l&&clearTimeout(l.timeout)};try{let t=tE({method:(null==e?void 0:e.method)||"GET",headers:a,referrerPolicy:"strict-origin",body:n,signal:null==l?void 0:l.signal},e.fetchOptions),s=null!=o?o:V(n)?0:void 0;t.keepalive="POST"===t.method&&!e.sl&&!1!==t.keepalive&&t.body===n&&!V(s)&&s>=0&&52428.8>oS+s,t.keepalive&&(d=s,oS+=d),_(i,t).then(t=>t.text().then(i=>{var s;if(h)return;let r={statusCode:t.status,text:i};if(200===t.status)try{r.json=JSON.parse(i)}catch(e){iS.error(e)}h=!0,p(),null==(s=e.callback)||s.call(e,r,oM(()=>t.headers.get("Retry-After")))})).catch(e=>{p(),c(e)}).finally(p)}catch(e){p(),c(e)}},oN=e=>{try{var t;let{url:i,encodedBody:s}=oO(e),{contentType:r,body:n,estimatedSize:o}=null!=s?s:{};if(!n)return;let a=n instanceof Blob?n:new Blob([n],{type:r});if(p.sendBeacon(i,a))return;let l=U(e.data)?e.data:null==(t=e.data)?void 0:t.batch;if(U(l)&&l.length>1&&(null!=o?o:0)>16384){let t=Math.ceil(l.length/2),i=t=>U(e.data)?t:tE(tE({},e.data),{},{batch:t});return oN(tE(tE({},e),{},{data:i(l.slice(0,t))})),void oN(tE(tE({},e),{},{data:i(l.slice(t))}))}iS.warn(`Beacon of ~${null!=o?o:0} bytes was rejected by the browser, falling back to ${_?"fetch":"XHR"}`),_?oD(tE(tE({},e),{},{sl:!0})):oL(e)}catch(e){iS.warn("Beacon send failed",e)}},oj=(e,t,i,s)=>{let r="query"===s?"POST"===t?"sent_at":"_":void 0;return oP(i===nF.GZipJS?oI(e,"compression"):e,tE(tE({},r?{[r]:Date.now().toString()}:{}),i===nF.GZipJS?{}:{compression:i}))},oB=(l=[],_&&l.push({transport:"fetch",method:oD}),v&&l.push({transport:"XHR",method:oL}),(null==p?void 0:p.sendBeacon)&&l.push({transport:"sendBeacon",method:oN}),l),oU=!oE&&-1===(null==b?void 0:b.indexOf("MSIE"))&&-1===(null==b?void 0:b.indexOf("Mozilla"));function oq(e,t,i){var s,r,n;i&&(t=tE(tE({},t),{},{callback:e=>i(e)})),e.__loaded?oU?e.__request_queue.push(t):e.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&(null==(r=t.callback)||r.call(t,{statusCode:429})):(t.transport=t.transport||e.config.api_transport,t.headers=tE(tE({},e.config.request_headers),t.headers),t.compression="best-available"===t.compression?null!=(s=e.compression)?s:t.compressionFallback:t.compression,(V(e.config.disable_beacon)?e.config.__preview_disable_beacon:e.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||e.config.fetch_options,
2((e,t)=>{var i,s,r,n,o,a;let l,u,h=tE(tE({},e),{},{callback:null!=t?t:t=>{var i;return null==(i=e.callback)?void 0:i.call(e,t)}});h.timeout=h.timeout||6e4;let c=null!=(i=h.transport)?i:"fetch";"sendBeacon"===c&&V(h.compression)&&h.data&&(h.compression=nF.Base64),"POST"===h.method&&h.data&&("capture-body"===h.timestampMode?(u=(l=(U(n=h.data)?n:[n]).map(e=>tE(tE({},e),e.timestamp instanceof Date&&!isNaN(e.timestamp.getTime())?{timestamp:e.timestamp.toISOString()}:{})))[0],h.data={api_key:null!=(o=null==u||null==(a=u.properties)?void 0:a.token)?o:null==u?void 0:u.token,batch:l,sent_at:(new Date).toISOString()}):"body"===h.timestampMode&&(h.data=((e,t=(new Date).toISOString())=>U(e)?e.map(e=>tE(tE({},e),{},{sent_at:t})):tE(tE({},e),{},{sent_at:t}))(h.data))),h.url=oj(h.url,h.method,h.compression,h.timestampMode);let d=oB.filter(e=>!h.disableTransport||!e.transport||!h.disableTransport.includes(e.transport)),p=null!=(s=null==(r=function(e,t){for(let i=0;e.length>i;i++)if(t(e[i]))return e[i]}(d,e=>e.transport===c))?void 0:r.method)?s:d[0].method;if(!p)throw Error("No available transport method");let f=e=>{try{p(e)}catch(e){var t;oA(e)?iS.warn(e):iS.error(e),null==(t=h.callback)||t.call(h,{statusCode:0,error:e})}};"sendBeacon"!==c&&!h.preferSyncCompression&&h.data&&h.compression===nF.GZipJS&&y&&"u">typeof Promise&&!o$?oR(h).then(e=>{f(e)}).catch(t=>{t7(t)?(o$=!0,f(tE(tE({},h),{},{compression:void 0,url:oj(e.url,e.method,void 0,e.timestampMode)}))):((e=>{if(!e||"object"!=typeof e)return!1;let t="name"in e?String(e.name):"";return t7(e)||t===t6})(t)&&(o$=!0),f(h))}):f(h)})(t,(s,r)=>{var n,o,a;e.rateLimiter.checkForLimiting(s),400>s.statusCode||null==(n=(o=e.config).on_request_error)||n.call(o,s),i?i(s,r):null==(a=t.callback)||a.call(t,s)})):t.fireCallbackOnDrop&&(null==(n=t.callback)||n.call(t,{statusCode:0}))}var oH=class{constructor(e,t){this.rl=!0,this.ol=[],this.al=ed((null==t?void 0:t.flush_interval_ms)||3e3,250,5e3,iS.createLogger("flush interval"),3e3),this.ll=e}enqueue(e){this.ol.push(e),this.ul||this.hl()}unload(){this.cl();let e=Object.values(this.ol.length>0?this.dl():{});[...e.filter(e=>0===e.url.indexOf("/e")),...e.filter(e=>0!==e.url.indexOf("/e"))].map(e=>{this.vl(e,"sendBeacon")})}enable(){this.rl=!1,this.hl()}hl(){this.rl||(this.ul=setTimeout(()=>{if(this.cl(),this.ol.length>0){let e=this.dl();for(let t in e)this.vl(e[t])}},this.al))}vl(e,t){try{this.ll(e,t)}catch(e){iS.error(e)}}cl(){clearTimeout(this.ul),this.ul=void 0}dl(){let e={};return sq(this.ol,t=>{var i;let s=((t?t.batchKey:null)||t.url)+(t.batchGroup?`:${t.batchGroup}`:"");V(e[s])&&(e[s]=tE(tE({},t),{},{data:[]})),null==(i=e[s].data)||i.push(t.data)}),this.ol=[],e}};let oz=["retriesPerformedSoFar"];var oV=class{constructor(e){this._instance=e,this.fl=!1,this.pl=3e3,this.ol=[],this.ol=[],this.gl=!0,this.resume()}resume(){!V(c)&&"onLine"in c.navigator&&(this.gl=c.navigator.onLine,this.ml||(this.ml=()=>{this.gl=!0,this.yl()},this.bl=()=>{this.gl=!1},sK(c,"online",this.ml),sK(c,"offline",this.bl)))}get length(){return this.ol.length}retriableRequest(e,t){let{retriesPerformedSoFar:i}=e,s=is(e,oz);X(i)&&(s.url=oP(s.url,{retry_count:i})),oq(this._instance,t?tE(tE({},s),{},{transport:t}):s,(e,t)=>{var r;if(200!==e.statusCode&&(400>e.statusCode||e.statusCode>=500)){if((0===e.statusCode?3:10)>(null!=i?i:0))return void this.Ls(tE({retriesPerformedSoFar:i},s),t);0===e.statusCode&&iS.warn(`Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after ${null!=i?i:0} retries.`)}null==(r=s.callback)||r.call(s,e)})}Ls(e,t){let i,s,r,n=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=n+1;let o=Math.max((r=(Math.random()-.5)*((s=Math.min(18e5,i=3e3*Math.pow(2,n)))-i/2),Math.ceil(s+r)),null!=t?t:0),a=Date.now()+o;this.ol.push({retryAt:a,requestOptions:e});let l=`Enqueued failed request for retry in ${o}`;navigator.onLine||(l+=" (Browser is offline)"),iS.warn(l),this.fl||(this.fl=!0,this._l())}_l(){(this.wl&&clearTimeout(this.wl),0===this.ol.length)?(this.fl=!1,this.wl=void 0):this.wl=setTimeout(()=>{this.gl&&this.ol.length>0&&this.yl(),this._l()},this.pl)}
2yl(){let e=Date.now(),t=[],i=this.ol.filter(i=>e>i.retryAt||(t.push(i),!1));if(this.ol=t,i.length>0)for(let{requestOptions:e}of i)this.retriableRequest(e)}unload(){for(let{requestOptions:e}of(this.wl&&(clearTimeout(this.wl),this.wl=void 0),this.fl=!1,V(c)||(this.ml&&(c.removeEventListener("online",this.ml),this.ml=void 0),this.bl&&(c.removeEventListener("offline",this.bl),this.bl=void 0)),this.ol))try{this._instance._send_request(tE(tE({},e),{},{transport:"sendBeacon"}))}catch(e){iS.error(e)}this.ol=[]}},oW=class{constructor(e){this._instance=e,this.kl=()=>{var e,t,i,s;this.Sl||(this.Sl={});let r=this.scrollElement(),n=this.scrollY(),o=r?Math.max(0,r.scrollHeight-r.clientHeight):0,a=n+((null==r?void 0:r.clientHeight)||0),l=(null==r?void 0:r.scrollHeight)||0;this.Sl.lastScrollY=Math.ceil(n),this.Sl.maxScrollY=Math.max(n,null!=(e=this.Sl.maxScrollY)?e:0),this.Sl.maxScrollHeight=Math.max(o,null!=(t=this.Sl.maxScrollHeight)?t:0),this.Sl.lastContentY=a,this.Sl.maxContentY=Math.max(a,null!=(i=this.Sl.maxContentY)?i:0),this.Sl.maxContentHeight=Math.max(l,null!=(s=this.Sl.maxContentHeight)?s:0)}}get xl(){return this._instance.config.scroll_root_selector}getContext(){return this.Sl}resetContext(){let e=this.Sl;return this.Sl=void 0,setTimeout(this.kl,0),e}startMeasuringScrollPosition(){sK(c,"scroll",this.kl,{capture:!0}),sK(c,"scrollend",this.kl,{capture:!0}),sK(c,"resize",this.kl)}scrollElement(){var e,t;if(this.xl){for(let t of U(this.xl)?this.xl:[this.xl]){let i=null==c||null==(e=c.document)?void 0:e.querySelector(t);if(i)return i}return}return null==c||null==(t=c.document)?void 0:t.documentElement}Cl(e){var t,i;if(this.xl){let t=this.scrollElement();return t&&t["y"===e?"scrollTop":"scrollLeft"]||0}return c?"y"===e?c.scrollY||c.pageYOffset||(null==(t=c.document)||null==(t=t.documentElement)?void 0:t.scrollTop)||0:c.scrollX||c.pageXOffset||(null==(i=c.document)||null==(i=i.documentElement)?void 0:i.scrollLeft)||0:0}scrollY(){return this.Cl("y")}scrollX(){return this.Cl("x")}};let oG=e=>nv(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties,null==e?void 0:e.config.disable_capture_url_hashes);var oJ=class{constructor(e,t,i,s){this.qe=e=>{let t=this.$l();if(t&&t.sessionId===e)return;let i={sessionId:e,props:this.Tl(this._instance)};this.Il.register({[sp]:i})},this._instance=e,this.Ml=t,this.Il=i,this.Tl=s||oG,this.Ml.onSessionId(this.qe)}$l(){return this.Il.props[sp]}getSetOnceProps(){var e;let t=null==(e=this.$l())?void 0:e.props;return t?"r"in t?nm(t,this._instance.config.disable_capture_url_hashes):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){let e={};return sq(sW(this.getSetOnceProps()),(t,i)=>{"$current_url"===i&&(i="url"),e[`$session_entry_${L(i)}`]=t}),e}},oK=class{on(e,t){return this.El[e]||(this.El[e]=[]),this.El[e].push(t),()=>{this.El[e]=this.El[e].filter(e=>e!==t)}}emit(e,t){for(let i of this.El[e]||[])i(t);for(let i of this.El["*"]||[])i(e,t)}constructor(){this.El={}}};let oY=i$("[SessionId]");var oX=class{on(e,t){return this.Pl.on(e,t)}constructor(e,t,i){var s;if(this.Rl=null,this.Al=null,this.Fl=[],this.Ol=void 0,this.Dl=!1,this.Pl=new oK,this.Ll=(e,t)=>!(!X(e)||!X(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw Error("SessionIdManager requires a PostHogPersistence instance");if("always"===e.config.cookieless_mode)throw Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Ir=e.config,this.Il=e.persistence,this.je=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.Nl=void 0,this._sessionActivityTimestamp=null,this.ql=t||s2,this.jl=i||s2;const r=this.Ir.persistence_name||this.Ir.token;if(this._sessionTimeoutMs=1e3*ed(this.Ir.session_idle_timeout_seconds||1800,60,36e3,oY.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Bl(),this.Hl="ph_"+r+"_window_id",this.zl="ph_"+r+"_primary_window_exists",this.Ul()){const e=rd.Dt(this.Hl),t=rd.Dt(this.zl);e&&!t?this.je=e:rd.Lt(this.Hl),rd.$t(this.zl,!0)}(null==(s=this.Ir.bootstrap)?void 0:s.sessionID)&&this.setBootstrapSessionId(this.Ir.bootstrap.sessionID),this.Wl()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return V(this.Fl)&&(this.Fl=[]),this.Fl.push(e),this.Xt&&e(this.Xt,this.je),()=>{this.Fl=this.Fl.filter(t=>t!==e)}}Ul(){return"memory"!==this.Ir.persistence&&!this.Il.hi&&rd.Et()}Vl(e){e!==this.je&&(this.je=e,this.Ul()&&rd.$t(this.Hl,e))}Gl(){return this.je?this.je:this.Ul()?rd.Dt(this.Hl):null}Zl(e){let t=this.Rl;return!J(t)&&!J(e)&&5e3>Math.abs(e-t)}Ql(e,t,i){let s=t!==this._sessionActivityTimestamp,r=e===this.Xt&&i===this._sessionStartTimestamp;this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this.Xt=e,r&&!s||r&&this.Zl(t)||(this.Rl=t,this.Il.register({[iQ]:[t,e,i]}))}Jl(){var e;let t=null==(e=this.Ir)?void 0:e.persistence_save_debounce_ms;return X(t)&&t>0}Kl(){this.Jl()?this.Il.refreshKey(iQ):(this.Il.flush(),this.Il.load())}Xl(){var e;if(J(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.Rl)return;this.Kl();let[,t,i]=this.Yl();t===this.Xt&&i===this._sessionStartTimestamp&&(this.Rl=this._sessionActivityTimestamp,this.Il.register({[iQ]:[this._sessionActivityTimestamp,null!=(e=this.Xt)?e:null,this._sessionStartTimestamp]}),this.Il.flush())}tu(){let[e]=this.Yl();return Math.max(X(e)?e:0,X(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0)}eu(e){return this.Kl(),this.Ll(e,this.tu())}Yl(){let e=this.Il.props[iQ];return U(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Rl=null,this.Nl=void 0,clearTimeout(this.iu),this.iu=void 0,this.Ql(null,null,null)}setBootstrapSessionId(e,t=!1){let i=((e,t=(new Date).getTime())=>{try{let i=(e=>{let t=e.replace(/-/g,"");if(32!==t.length)throw Error("Not a valid UUID");if("7"!==t[12])throw Error("Not a UUIDv7");return parseInt(t.substring(0,12),16)})(e);return i>t+6e4?void oY.error("Bootstrap sessionID cannot be in the future"):i}catch(e){return void oY.error("Invalid sessionID in bootstrap",e)}})(e);return!V(i)&&(t?this.Nl={sessionId:e,sessionStartTimestamp:i}:this.Ql(e,(new Date).getTime(),i),!0)}destroy(){this.Dl=!0,this.Xl(),clearTimeout(this.iu),this.iu=void 0,this.Ol&&c&&(c.removeEventListener(sL,this.Ol,{capture:!1}),this.Ol=void 0),this.Fl=[]}Wl(){this.Ol=()=>{this.Xl(),this.Ul()&&rd.Lt(this.zl)},sK(c,sL,this.Ol,{capture:!1})}
2checkAndGetSessionAndWindowId(e=!1,t=null,i=!1){if("always"===this.Ir.cookieless_mode)throw Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');let s=t||(new Date).getTime(),r=this.Xt;if(i)this.Al=s;else if(J(this.Al)||this.Al>s||s-this.Al>=1e3){var n,o;null==(n=(o=this.Il).syncCookieProperties)||n.call(o),this.Al=s}let[,a,l]=this.Yl(),u=!V(r)&&a!==r,h=this.tu(),c=this.Gl(),d=this.Nl,p=!!d&&(d.sessionStartTimestamp>s+6e4||s-d.sessionStartTimestamp>864e5),f=d?p:X(l)&&Math.abs(s-l)>864e5,g=!1,_=u,v=!a||!!d,m=a,y=!v&&!e&&this.Ll(s,h);if(y&&((y=this.eu(s))||oY.info("cross-tab refresh kept the session alive",{sessionId:a}),[,a,l]=this.Yl(),y||(v=!a||!!d)),v||y||f){_=!1;let e=d&&!p;a=e?d.sessionId:this.ql(),c=this.jl(),oY.info("new session ID assigned",{sessionId:a,windowId:c,bootstrapped:!!e,changeReason:{noSessionId:v,activityTimeout:y,sessionPastMaximumLength:f}}),l=e?d.sessionStartTimestamp:s,this.Nl=void 0,g=!0}else c||(c=this.jl(),g=!0),(_=_||a!==m)&&(oY.info("adopted cross-tab session id",{sessionId:a,windowId:c}),g=!0);let b=X(h)&&e&&!f?h:s,w=X(l)?l:(new Date).getTime();this.Vl(c),this.Ql(a,b,w),e||this.Bl();let E={noSessionId:v,activityTimeout:y,sessionPastMaximumLength:f,crossTabAdoption:_};return g&&this.Fl.forEach(e=>e(a,c,E)),{sessionId:a,windowId:c,sessionStartTimestamp:w,changeReason:g?E:void 0,lastActivityTimestamp:h}}Bl(){this.Dl||(clearTimeout(this.iu),this.iu=setTimeout(()=>{if(!this.Dl)if(this.eu((new Date).getTime())){let e=this.Xt;this.resetSessionId(),this.Pl.emit("forcedIdleReset",{idleSessionId:e})}else this.Bl()},1.1*this.sessionTimeoutMs))}};let oQ=function(e,t){if(!e)return!1;let i=e.userAgent;if(i&&ec(i,t))return!0;try{let i=null==e?void 0:e.userAgentData;if((null==i?void 0:i.brands)&&i.brands.some(e=>ec(null==e?void 0:e.brand,t)))return!0}catch(e){}return!!e.webdriver};function oZ(){return(oZ=eu(function*(){let e=null==p?void 0:p.userAgentData;if(null==e?void 0:e.getHighEntropyValues)try{let t=yield e.getHighEntropyValues(["model"]),i=null==t?void 0:t.model;return W(i)&&i.length>0?i:void 0}catch(e){return void iS.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",e)}})).apply(this,arguments)}function o0(e){var t;return!!(null==(t=e.conditions)||null==(t=t.events)||null==(t=t.values)?void 0:t.length)}let o1=(e,t)=>{if(!(e=>{try{new RegExp(e)}catch(e){return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch(e){return!1}},o2=e=>e.toLowerCase(),o3={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=>o1(t,e))),not_regex:(e,t)=>t.every(t=>e.every(e=>!o1(t,e))),icontains:(e,t)=>t.map(o2).some(t=>e.map(o2).some(e=>t.includes(e))),not_icontains:(e,t)=>t.map(o2).every(t=>e.map(o2).every(e=>!t.includes(e))),gt:(e,t)=>t.some(t=>{let i=parseFloat(t);return!isNaN(i)&&e.some(e=>i>parseFloat(e))}),lt:(e,t)=>t.some(t=>{let i=parseFloat(t);return!isNaN(i)&&e.some(e=>i<parseFloat(e))})};function o5(e,t){return!e||Object.entries(e).every(([e,i])=>{let s=null==t?void 0:t[e];if(null==s)return!1;let r=o3[i.operator];return!!r&&r(i.values.map(String),[String(s)])})}function o4(e,t,i){return ne({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}let o6="custom",o8="i.posthog.com",o9=/^\/static\//,o7=["/s/","/e/","/i/"];var ae=class{constructor(e){this.nu={},this.instance=e}get apiHost(){let e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"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(){var e;let t=null==(e=this.instance.config.ui_host)?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace(`.${o8}`,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this.nu[this.apiHost]||(this.nu[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":o6),this.nu[this.apiHost]}su(e){if(!o9.test(e))return;let t=this.instance.config.asset_host;return"string"==typeof t&&t.trim().replace(/\/$/,"")||void 0}ru(e){let t=nt(e);return t?t.protocol+"//"+t.host+t.pathname:void 0}ou(e,t,i){if("ui"===e)return i;let s=i,r=this.instance.config.rewriteRequestPath;if(r){var n;s=r(new URL((null==(n=nt(i))?void 0:n.href)||i)).toString()}if(r&&"api"===e&&o7.some(e=>0===t.indexOf(e))){let e=this.ru(s);if(e){let t=this.apiHost,i=this.au;(null==i?void 0:i.apiHost)===t&&i.rewriteRequestPath===r||(i={apiHost:t,rewriteRequestPath:r,urls:new Set},this.au=i),i.urls.add(e)}}return s}isIngestionEndpoint(e){let t=this.au,i=this.ru(e);return(null==t?void 0:t.apiHost)===this.apiHost&&t.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!i&&t.urls.has(i)}endpointFor(e,t=""){if(t&&(t="/"===t[0]?t:`/${t}`),"ui"===e)return this.ou(e,t,this.uiHost+t);if("flags"===e)return this.ou(e,t,this.flagsApiHost+t);if("assets"===e){let i=this.su(t);if(i)return this.ou(e,t,`${i}${t}`)}if(this.region===o6)return this.ou(e,t,this.apiHost+t);let i=o8+t;switch(e){case"assets":return this.ou(e,t,`https://${this.region}-assets.${i}`);case"api":return this.ou(e,t,`https://${this.region}.${i}`)}}};let at=i$("[Surveys]"),ai=e=>{try{let t=`seenSurvey_${e.current_iteration&&e.current_iteration>0?`${e.id}_${e.current_iteration}`:e.id}`;if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(e){at.error("Failed to persist survey seen state",e)}},as=[nN.Popover,nN.Widget,nN.API],ar={ignoreConditions:!1,ignoreDelay:!1,displayType:nz.Popover}
2,an=i$("[PostHog ExternalIntegrations]"),ao={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var aa=class{constructor(e){this._instance=e}Ho(e,t){var i,s;null==(i=x.__PosthogExtensions__)||null==(s=i.loadExternalDependency)||s.call(i,this._instance,e,e=>{if(e)return an.error("failed to load script",e);t()})}startIfEnabledOrStop(){var e,t,i,s;for(let[r,n]of Object.entries(null!=(e=this._instance.config.integrations)?e:{}))!n||(null==(t=x.__PosthogExtensions__)||null==(t=t.integrations)?void 0:t[r])||this.Ho(ao[r],()=>{var e;null==(e=x.__PosthogExtensions__)||null==(e=e.integrations)||null==(e=e[r])||e.start(this._instance)}),!n&&(null==(i=x.__PosthogExtensions__)||null==(i=i.integrations)?void 0:i[r])&&(null==(s=x.__PosthogExtensions__)||null==(s=s.integrations)||null==(s=s[r])||s.stop())}},al=class{constructor(e,t){this.A=e,this.bo=t,this.lu=new Map,this.To=!1}add(e){var t=this;return eu(function*(){if(t.To)throw Error("Cannot add an extension to a disposed ExtensionRuntime");if(t.lu.has(e.name))throw Error(`Browser extension "${e.name}" is already registered`);t.lu.set(e.name,e);try{let i=e.setup(t.bo);i&&(yield i)}catch(s){let i=t.lu.get(e.name)===e;i&&t.lu.delete(e.name),t.A.error(`Failed to set up browser extension "${e.name}"`,s),i&&t.uu(e)}})()}getExtension(e){return this.lu.get(e)}dispose(){if(this.To)return;this.To=!0;let e=Array.from(this.lu.values()).reverse();for(let t of(this.lu.clear(),e))this.uu(t)}uu(e){try{var t;let i=null==(t=e.dispose)?void 0:t.call(e);i&&q(i.then)&&i.then(void 0,t=>{this.A.error(`Failed to dispose browser extension "${e.name}"`,t)})}catch(t){this.A.error(`Failed to dispose browser extension "${e.name}"`,t)}}},au=class{constructor(e){this._instance=e}initialize(){}get(e){let t=this._instance.persistence;if("string"==typeof e)return null==t?void 0:t.get_property(e);let i={};for(let s of e){let e=null==t?void 0:t.get_property(s);V(e)||(i[s]=e)}return i}set(e,t){var i;null==(i=this._instance.persistence)||i.register("string"==typeof e?{[e]:t}:e)}remove(e){var t;null==(t=this._instance.persistence)||t.unregister(e)}};let ah="extensionsRemoteConfig";var ac=class{constructor(e){this.instance=e,this.To=!1,this.A=iS,this.hu=e.cu,this.kv=new au(e),this.onEvent=e=>nV(this.instance.on("eventCaptured",t=>{try{e({event:t.event,properties:t.properties})}catch(e){this.A.error("Browser extension event listener failed",e)}})),this.onRemoteConfig=e=>{if(this.To)return nV(()=>{});let t=t=>{try{e(t)}catch(e){this.A.error("Browser extension remote config listener failed",e)}},i=this.instance.du.on(ah,t);return this.hu&&t(this.hu),nV(i)},this.vu=new al(iS.createLogger("[BrowserExtensions]"),this)}get logger(){return this.A}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return null!=(e=this.instance.get_property("$device_id"))?e:this.distinctId}get deviceId(){let e=this.instance.get_property(iF);return"string"==typeof e?e:void 0}get library(){return{name:S.LIB_NAME,version:S.LIB_VERSION}}get initialPersonProperties(){var e,t;return null!=(e=null==(t=this.instance.persistence)?void 0:t.get_initial_props())?e:{}}get groups(){return this.instance.getGroups()}get session(){try{var e,t,i,s;let r=null==(e=this.instance.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:null!=(t=null==r?void 0:r.sessionId)?t:"",windowId:null!=(i=null==r?void 0:r.windowId)?i:"",sessionStartTimestamp:null!=(s=null==r?void 0:r.sessionStartTimestamp)?s:0}}catch(e){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(e){return this.vu.add(e)}getExtension(e){return this.vu.getExtension(e)}capture(e,t,i){i?this.instance.capture(e,t,{timestamp:i.timestamp,uuid:i.uuid,$set:i.set,$set_once:i.setOnce}):this.instance.capture(e,t)}registerDynamicEventProperties(e){return nV(this.instance.fu(e))}handleRemoteConfig(e){this.To||(this.hu=e,this.instance.du.emit(ah,e))}sendRequest(e){var t=this;return eu(function*(e,i={}){var s;let r=t.instance.requestRouter.endpointFor(null!=(s=i.target)?s:"api",e),n={method:i.method,url:i.query?oP(r,i.query
2):r,data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,compressionFallback:"flags"===i.target&&"best-available"===i.compression?C.Base64:void 0,timestampMode:i.sentAt};return"sendBeacon"===i.transport?(t.instance._send_request(n),{statusCode:202}):new Promise(e=>{n.callback=e,t.instance._send_request(n)})}).apply(this,arguments)}dispose(){this.To||(this.To=!0,this.vu.dispose())}};let ad={},ap=0,af=()=>{},ag='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',a_="Surveys module not available",av="sanitize_properties is deprecated. Use before_send instead",am="Invalid value for property_denylist config: ",ay=["$recording_status","$sdk_debug_recording_script_not_loaded","$sdk_debug_replay_url_trigger_status","$sdk_debug_replay_event_trigger_status","$sdk_debug_replay_linked_flag_trigger_status","$sdk_debug_replay_rrweb_error","$sdk_debug_replay_internal_buffer_length","$sdk_debug_replay_flushed_size"],ab=["$feature_flag_called","$$heatmap","$snapshot"],aw=e=>"$"===e.charAt(0)&&!A(ab,e),aE=/^[A-Za-z0-9_-]{1,400}$/,ax=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,ak=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,aS=["token","distinct_id",sy],a$="posthog",aI=e=>{var t;let i;return tE({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:function(e){let t=null==e?void 0:e.hostname;if(!W(t))return!1;let i=t.split(".").slice(-2).join(".");for(let e of sJ)if(i===e)return!1;return!0}(null==f?void 0:f.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:af,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:g&&W(null==g?void 0:g.search)&&-1!==g.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,reuseAnonymousId:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:"https:"===(null==c||null==(t=c.location)?void 0:t.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,feature_flag_request_max_retries:1,surveys_request_timeout_ms:1e4,on_request_error(e){iS.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:sA,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:af},{rageclick:e&&e>="2026-05-30"?{content_ignorelist:rR,ignore_text_selection:!0}
2:!e||"2025-11-30">e||{content_ignorelist:!0},capture_pageview:!e||"2025-05-24">e||"history_change",session_recording:(i={},e&&"unset"!==e&&("2025-11-30">e||(i.strictMinimumDuration=!0),"2026-05-30">e||(i.canvasCapture={resolutionScale:.6}),"2026-06-25">e||(i.streamNetworkBody=!0),"2026-08-30">e||(i.captureJsonLd=!0)),i),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||"unset"===e||"2026-08-29">e)})},aP=[["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"]],aT=e=>{let t={};for(let[i,s]of aP)V(e[i])||(t[s]=e[i]);let i=sH({},t,e),s=e.__preview_external_dependency_versioned_paths;return V(s)||(V(e.strict_script_versioning)&&(i.strict_script_versioning=!!s),W(s)&&V(e.asset_host)&&(i.asset_host=s)),U(e.property_blacklist)&&(V(e.property_denylist)?i.property_denylist=e.property_blacklist:U(e.property_denylist)?i.property_denylist=[...e.property_blacklist,...e.property_denylist]:iS.error(am+e.property_denylist)),i};var aO=class{constructor(){this.__forceAllowLocalhost=!1}get pu(){return this.__forceAllowLocalhost}set pu(e){iS.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},aC=class e{gu(e){if(!e)return;let t=this.lu.indexOf(e);-1!==t&&this.lu.splice(t,1)}mu(e,t){var i;return this.gu(e),this.lu.push(t),null==(i=t.initialize)||i.call(t),t}yu(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}bu(){let e,t,i;if(this._u||this.config.reuseAnonymousId||this.config.segment||this.yu())return;let s="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;(s||this.config.disable_persistence)&&(this.wu||(s?(e=`persistence is set to '${this.config.persistence}'`,t="memory"===this.config.persistence?"on every page load":"for every new browser tab or window",i="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(e="persistence is disabled (disable_persistence is true)",t="on every page load",i="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this._u=!0,console.warn("[PostHog.js]",`${e} but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ${t}, 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. ${i}`)))}ku(){if(this.yu()||"$posthog_cookieless"!==this.get_distinct_id())return;let e=this.persistence;if(!e)return;this.Su()||e.load(!0);let t=this.get_distinct_id();if(!t||"$posthog_cookieless"===t){let t=this.config.get_device_id(s2());this.register({distinct_id:t,$device_id:t}),e.set_property(sd,sR)}this.xu()}get decideEndpointWasHit(){var e,t;return null!=(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&e}get flagsEndpointWasHit(){var e,t;return null!=(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&e}constructor(){var t;this.Cu=!1,this.$u=!1,this.webPerformance=new aO,this.Tu=!1,this.version=S.LIB_VERSION,this.Iu=new Set,this.Mu="",this.du=new oK,this.lu=[],this.Eu=[],this.Pu=!1,this.wu=!1,this._u=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=aI(),this.SentryIntegration=r5,this.sentryIntegration=e=>{let t;return t=r3(this,e),{name:r2,processEvent:e=>t(e)}},this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Ru=!1,this.Au=null,this.Fu=null,this.Ou=null,this.scrollManager=new oW(this),this.pageViewM
2anager=new r4(this),this.rateLimiter=new nY(this),this.requestRouter=new ae(this),this.consent=new rp(this),this.externalIntegrations=new aa(this);const i=null!=(t=e.__defaultExtensionClasses)?t:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.metrics=i.metrics&&new i.metrics(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(e,t,i)=>{let s=W(e)?{[e]:t}:e;this.setPersonProperties(s),null==i||i({})},set_once:(e,t,i)=>{let s=W(e)?{[e]:t}:e;this.setPersonProperties(void 0,s),null==i||i({})}},this.on("eventCaptured",e=>iS.info(`send "${null==e?void 0:e.event}"`,e))}init(t,i,s){if(s&&s!==a$){var r;let n=null!=(r=ad[s])?r:new e;return n._init(t,i,s),ad[s]=n,ad[a$][s]=n,n}return this._init(t,i,s)}_init(e,t={},i){var s,r,n,o;let a=W(e)?e.trim():"";if(!a)return iS.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!==(null==(o=this.config)?void 0:o.token)?console.warn("[PostHog.js]",`You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('${a}', { ... }, 'project2')`):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=aI(t.defaults),t.debug=this.Du(t.debug),this.Lu=t,this.Nu=[],t.person_profiles?this.Fu=t.person_profiles:t.process_person&&(this.Fu=t.process_person);let l=aI(t.defaults),u=aT(t),h=sH({},l,u,{name:i,token:a});H(l.rageclick)&&H(u.rageclick)&&(h.rageclick=sH({},l.rageclick,u.rageclick)),H(l.session_recording)&&H(u.session_recording)&&(h.session_recording=sH({},l.session_recording,u.session_recording)),this.set_config(h),this.config.on_xhr_error&&iS.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:nF.GZipJS;let d=this.Su();if(this.persistence=new nR(this.config,d),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new nR(tE(tE({},this.config),{},{persistence:"sessionStorage"}),d,!1),this.Mu="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!d&&rd.Et()){let e=rd.Dt(this.Mu);U(e)&&e.forEach(e=>{W(e)&&this.Iu.add(e)})}else rd.Lt(this.Mu);let p=tE({},this.persistence.props),f=tE({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.qu=new oH((e,t)=>this.ju(e,t),this.config.request_queue_config),this.Bu=new oV(this),this.__request_queue=[];let g=this.yu();g||(this.sessionManager=new oX(this),this.sessionPropsManager=new oJ(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((e,t,i)=>{((null==i?void 0:i.activityTimeout)||(null==i?void 0:i.sessionPastMaximumLength)||(null==i?void 0:i.crossTabAdoption))&&this.Hu()})),this.zu(),this.config.__preview_deferred_init_extensions?(iS.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.Uu(g)},0)):(iS.info("Initializing extensions synchronously"),this.Uu(g)),S.DEBUG=S.DEBUG||this.config.debug,S.DEBUG&&iS.info("Starting in debug mode",{this:this,config:t,thisC:tE({},this.config),p:p,s:f}),!this.config.identity_distinct_id||(null==(s=t.bootstrap)?void 0:s.distinctID)||(t.bootstrap=tE(tE({},t.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));let _=null==(r=t.bootstrap)?void 0:r.distinctID;if(this.wu=!!_&&!G(_),null==(n=t.bootstrap)?void 0:n.distinctID){let e=t.bootstrap.distinctID,i=this.get_distinct_id(),s=this.persistence.get_property(sd);if(t.bootstrap.isIdentifiedID&&null!=i&&i!==e&&"anonymous"===s)this.identify(e);else if(t.bootstrap.isIdentifiedID&&null!=i&&i!==e&&"identified"===s)iS.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 i=this.config.get_device_id(s2()),s=t.bootstrap.isIdentifiedID?i:e;this.persistence.set_property(sd,t.bootstrap.isIdentifiedID?sF:sR),this.register({distinct_id:e,$device_id:s})}}if(g)this.register_once({distinct_id:sm,$device_id:null},"");else if(!this.get_distinct_id()){let e=this.config.get_device_id(s2());this.register_once({distinct_id:e,$device_id:e},""),this.persistence.set_property(sd,sR)}return sK(c,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),sK(c,"pageshow",()=>{var e;this.Cu=!1,this.$u||null==(e=this.Bu)||e.resume()}),t.segment?r1(this,()=>this.Wu()):this.Wu(),q(this.config._onCapture)&&this.config._onCapture!==af&&(iS.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",e=>this.config._onCapture(e.event,e))),this.config.ip&&iS.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 oZ.apply(this,arguments)})().then(e=>{e&&this.register({[iA]:e})}).catch(af),this}Vu(e){return W(e.name)&&q(e.setup)}Gu(e,t){this.Vu(e)?t.push(()=>{this.Zu().add(e).catch(()=>{var t;return null==(t=e.dispose)?void 0:t.call(e)}).catch(t=>{iS.error(`Failed to dispose browser extension "${e.name}"`,t)})}):this.lu.push(e)}zu(){var t,i,s,r,n,o;let a=null!=(t=null==(i=this.config.__extensionClasses)?void 0:i.featureFlags)?t:null==(s=e.__defaultExtensionClasses)?void 0:s.featureFlags;a&&(this.featureFlags&&this.featureFlags instanceof a||(null==(r=this.Qu)||r.call(this),this.Qu=void 0,this.featureFlags=new a(this)),q(this.featureFlags.onReloading)&&q(this.featureFlags.setup)?this.Qu||(this.Qu=this.featureFlags.onReloading(()=>{this.du.emit("featureFlagsReloading",!0)}),this.Zu().add(this.featureFlags)):null==(n=(o=this.featureFlags).initialize)||n.call(o))}Uu(t){var i,s,r,n,o,a,l;let u=performance.now(),h=tE(tE({},e.__defaultExtensionClasses),this.config.__extensionClasses),c=[];h.exceptions&&this.lu.push(this.exceptions=null!=(i=this.exceptions)?i:new h.exceptions(this)),h.historyAutocapture&&this.lu.push(this.historyAutocapture=new h.historyAutocapture(this)),h.tracingHeaders&&this.lu.push(this.tracingHeaders=new h.tracingHeaders(this)),h.siteApps&&this.lu.push(this.siteApps=new h.siteApps(this)),h.sessionRecording&&!t&&this.lu.push(this.sessionRecording=new h.sessionRecording(this)),this.config.disable_scroll_properties||c.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),h.autocapture&&this.Gu(this.autocapture=new h.autocapture(this),c),h.surveys&&this.Gu(this.surveys=null!=(s=this.surveys)?s:new h.surveys(this),c),h.logs&&this.Gu(this.logs=null!=(r=this.logs)?r:new h.logs(this),c),h.metrics&&this.lu.push(this.metrics=null!=(n=this.metrics)?n:new h.metrics(this)),h.conversations&&this.lu.push(this.conversations=null!=(o=this.conversations)?o:new h.conversations(this)),h.productTours&&this.lu.push(this.productTours=new h.productTours(this)),h.heatmaps&&this.lu.push(this.heatmaps=new h.heatmaps(this)),h.webVitalsAutocapture&&this.lu.push(this.webVitalsAutocapture=new h.webVitalsAutocapture(this)),h.exceptionObserver&&this.lu.push(this.exceptionObserver=new h.exceptionObserver(this)),h.deadClicksAutocapture&&this.lu.push(this.deadClicksAutocapture=new h.deadClicksAutocapture(this,rQ)),h.toolbar&&this.lu.push(this.toolbar=null!=(a=this.toolbar)?a:new h.toolbar(this)),h.experiments&&this.lu.push(this.experiments=null!=(l=this.experiments)?l:new h.experiments(this)),this.lu.forEach(e
2=>{e.initialize&&c.push(()=>{var t;null==(t=e.initialize)||t.call(e)})}),c.push(()=>{if(this.Ju){let e=this.Ju;this.Ju=void 0,this.lu.forEach(t=>{var i;return null==(i=t.onRemoteConfig)?void 0:i.call(t,e)})}}),this.Ku(c,u)}Ku(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout(()=>{this.Ku(e,t)},0);let i=e.shift();if(i)try{i()}catch(e){iS.error("Error initializing extension:",e)}}let i=Math.round(performance.now()-t);this.register_for_session({[sb]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[sw]:i}),this.config.__preview_deferred_init_extensions&&iS.info(`PostHog extensions initialized (${i}ms)`)}el(e){var t,i;if(!f||!f.body)return iS.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.el(e)},500);if(this.config.__preview_deferred_init_extensions&&(this.Ju=e),this.cu=e,this.compression=void 0,e.ok){let t=e.config;t.supportedCompression&&!this.config.disable_compression&&(this.compression=A(t.supportedCompression,nF.GZipJS)?nF.GZipJS:A(t.supportedCompression,nF.Base64)?nF.Base64:void 0),(null==(i=t.analytics)?void 0:i.endpoint)&&(this.analyticsDefaultEndpoint=t.analytics.endpoint)}this.set_config({person_profiles:this.Fu?this.Fu:sA}),null==(t=this.Xu)||t.handleRemoteConfig(e),this.lu.forEach(t=>{var i;return null==(i=t.onRemoteConfig)?void 0:i.call(t,e)})}Wu(){try{this.config.loaded(this)}catch(e){iS.critical("`loaded` function failed",e)}if(this.Yu(),this.config.internal_or_test_user_hostname&&(null==g?void 0:g.hostname)){let e=g.hostname,t=this.config.internal_or_test_user_hostname;("string"==typeof t?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.yu())&&this.th()},1),this.eh=new nQ(this),this.eh.load()}Yu(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this.qu)||e.enable())}_dom_loaded(){this.is_capturing()&&sU(this.__request_queue,e=>this.ju(e)),this.__request_queue=[],this.Yu()}_handle_unload(){var e,t,i,s,r,n;this.Cu=!0,null==(e=this.surveys)||null==(t=e.handlePageUnload)||t.call(e),null==(i=this.metrics)||i.flush("sendBeacon"),this.config.request_batching?(this.ih()&&this.capture(sN),null==(s=this.logs)||s.flushLogs("sendBeacon"),null==(r=this.qu)||r.unload(),null==(n=this.Bu)||n.unload()):this.ih()&&this.capture(sN,null,{transport:"sendBeacon"})}_send_request(e){oq(this,e)}ju(e,t){this.Bu?this.Bu.retriableRequest(e,t):this._send_request(t?tE(tE({},e),{},{transport:t}):e)}_execute_array(e){ap++;try{let t,i=[],s=[],r=[];sU(e,e=>{if(e)if(t=e[0],U(t))r.push(e);else if(q(e))try{e.call(this)}catch(t){iS.error("Error executing queued PostHog call",e,t)}else U(e)&&"alias"===t?i.push(e):U(e)&&-1!==t.indexOf("capture")&&q(this[t])?r.push(e):s.push(e)});let n=function(e,t){sU(e,function(e){try{if(U(e[0])){let i=t;sq(e,function(e){i=i[e[0]].apply(i,e.slice(1))})}else t[e[0]].apply(t,e.slice(1))}catch(t){iS.error("Error executing queued PostHog call",e,t)}})};n(i,this),n(s,this),n(r,this)}finally{ap--}}push(t){if(ap>0&&U(t)&&W(t[0])){let i=e.prototype[t[0]];return void(q(i)&&i.apply(this,t.slice(1)))}this._execute_array([t])}get nh(){return{property:iL,persistenceKey:iD,cookieName:"_fbc",pattern:ax,register:(e,t)=>{var i;return null==(i=this.persistence)?void 0:i.register({[iD]:{value:e,delivered:t}})},unregister:()=>{var e;return null==(e=this.persistence)?void 0:e.unregister(iD)}}}get sh(){return{property:iN,persistenceKey:ij,cookieName:"_fbp",pattern:ak,register:(e,t)=>{var i;return null==(i=this.persistence)?void 0:i.register({[ij]:{value:e,delivered:t}})},unregister:()=>{var e;return null==(e=this.persistence)?void 0:e.unregister(ij)}}}rh(e){var t;let i=null==(t=this.persistence)?void 0:t.get_property(e.persistenceKey);return W(i)&&e.pattern.test(i)?{value:i,delivered:!1}:H(i)&&W(i.value)&&e.pattern.test(i.value)?{value:i.value,delivered:!0===i.delivered}:void 0}oh(e,t,i){return t===(null==i?void 0:i.value)?{value:t,pending:!i.delivered}:(e.register(t,!1),{value:t,pending:!0})}ah(e){if(!this.config.save_campaign_params||this.yu())return;let t=sX(e.cookieName);return W(t)&&e.pattern.test(t)?t:void 0}uh(e,t,i,s){if(!this.persistence)return;let r=this.nh;this.persistence.refreshKey(r.persistenceKey);let n=this.rh(r);if(s)return void r.unregister();if(i)return W(t)&&ax.test(t)?this.oh(r,t,n):void r.unregister();let o=W(e)&&aE.test(e)?e:void 0,a=this.ah(r);return a&&((e,t,i)=>{let s=e.split(".");if(t)return s[3]===t;if(!i)return!0;let r=i.value.split(".");return s[3]===r[3]||Number(s[2])>Number(r[2])})(a,o,n)?this.oh(r,a,n):o?(null==n?void 0:n.value.split(".")[3])===o?{value:n.value,pending:!n.delivered}:this.oh(r,`fb.1.${Date.now()}.${o}`,n):n?{value:n.value,pending:!n.delivered}:void 0}hh(e,t,i){if(!this.persistence)return;let s=this.sh;this.persistence.refreshKey(s.persistenceKey);let r=this.rh(s);if(i)return void s.unregister();if(t)return W(e)&&ak.test(e)?this.oh(s,e,r):void s.unregister();let n=this.ah(s);return n?this.oh(s,n,r):r?{value:r.value,pending:!r.delivered}:void 0}dh(e,t){if(!this.persistence)return;this.persistence.refreshKey(e.persistenceKey);let i=this.rh(e);(null==i?void 0:i.value)!==t||i.delivered||e.register(t,!0)}capture(e,t,i){var s,r,n,o,a,l,u,h;let c,d;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.qu))return void iS.uninitializedWarning("posthog.capture");
2if(!this.is_capturing())return;if(V(e)||!W(e))return void iS.error("No event name provided to posthog.capture");this.ku();let p=!this.config.opt_out_useragent_filter&&this._is_bot();if(p&&!this.config.__preview_capture_bot_pageviews)return;let f=(null==i?void 0:i.skip_client_rate_limiting)?void 0:this.rateLimiter.clientRateLimitContext();if(null==f?void 0:f.isRateLimited)return void iS.critical("This capture call is ignored due to client rate limiting.");(null==t?void 0:t.$current_url)&&!W(null==t?void 0:t.$current_url)&&(iS.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==t||delete t.$current_url),"$exception"!==e||(null==i?void 0:i.fh)||iS.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&&(c=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 g=new Date,_=(null==i?void 0:i.timestamp)||g,v=tp(null==i?void 0:i.uuid,s2),m={uuid:v,event:e,properties:this.calculateEventProperties(e,t||{},_,v)};"$pageview"===e&&this.config.__preview_capture_bot_pageviews&&p&&(m.event="$bot_pageview",m.properties.$browser_type="bot"),f&&(m.properties.$lib_rate_limit_remaining_tokens=f.remainingTokens);let y="$feature_flag_called"===e&&!1===m.properties.$feature_flag_has_experiment&&!0===this.get_property("$minimal_flag_called_events");(null==i?void 0:i.$set)&&!y&&(m.$set=null==i?void 0:i.$set);let b=H(null==t?void 0:t.$set)?t.$set:void 0,w=U(null==t?void 0:t.$unset)?t.$unset:[],E=(null==i?void 0:i.$unset)||[],x=e=>{var t;let s=!!(null==i?void 0:i.$set)&&e in i.$set;return{hasProvided:s||!!b&&e in b,provided:s?null==i||null==(t=i.$set)?void 0:t[e]:null==b?void 0:b[e],unset:-1!==w.indexOf(e)||-1!==E.indexOf(e)}},k=x(iL),S=x(iN),$=[{channel:this.nh,hasProvided:k.hasProvided,update:this.uh(null==c?void 0:c.fbclid,k.provided,k.hasProvided,k.unset)},{channel:this.sh,hasProvided:S.hasProvided,update:this.hh(S.provided,S.hasProvided,S.unset)}];for(let{channel:e,hasProvided:t,update:i}of $)i&&!0===m.properties.$process_person_profile&&i.pending&&!t&&!y&&(m.$set=tE({[e.property]:i.value},m.$set));let I=null==i?void 0:i.$unset;I&&(m.$unset=I);let P=y?void 0:this.ph(null==i?void 0:i.$set_once,e!==sB,e===sj);if(P&&(m.$set_once=P),(null==i?void 0:i._noTruncate)||(n=this.config.properties_string_max_length,a=m,l=e=>W(e)?e.slice(0,n):e,d=new Set,m=function e(t,i){let s;if(t!==Object(t))return l?l(t):t;if(!d.has(t)){if(d.add(t),U(t))s=[],sU(t,t=>{s.push(e(t))});else{let i={};sq(es(t)?sG(t):t,(t,s)=>{d.has(t)||(i[s]=e(t,s))}),s=i}return s}}(a)),m.timestamp=_,V(null==i?void 0:i.timestamp)||(m.properties.$event_time_override_provided=!0,m.properties.$event_time_override_system_time=g),y&&(m.properties=((e,t=[])=>{let i={},s=t=>{void 0!==e[t]&&(i[t]=e[t])};return t4.forEach(s),t.forEach(s),i})(m.properties,aS)),e===nq.DISMISSED||e===nq.SENT){let i,s=null==t?void 0:t[nH.SURVEY_ID],r=null==t?void 0:t[nH.SURVEY_ITERATION];ai({id:s,current_iteration:r}),m.$set=tE(tE({},m.$set),{},{[(u={id:s,current_iteration:r},h=e===nq.SENT?"responded":"dismissed",i=`$survey_${h}/${u.id}`,u.current_iteration&&u.current_iteration>0&&(i=`$survey_${h}/${u.id}/${u.current_iteration}`),i)]:!0})}else e===nq.SHOWN&&(m.$set=tE(tE({},m.$set),{},{[nH.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(e===nG.SHOWN){let e=null==t?void 0:t[nJ.TOUR_TYPE];e&&(m.$set=tE(tE({},m.$set),{},{[`${nJ.TOUR_LAST_SEEN_DATE}/${e}`]:(new Date).toISOString()}))}let T=tE(tE({},m.properties.$set),m.$set);if(z(T)||this.setPersonPropertiesForFlags(T),!K(this.config.before_send)){let e=this.Os(m);if(!e)return;(m=e).uuid=tp(m.uuid,s2)}this.sessionRecording&&!this.Pu&&aw(e)&&(this.Pu=!0,setTimeout(()=>this.Pu=!1,3e4));let O=$.filter(({channel:e,update:t})=>{var i,s,r;let n=null!=(i=null==(s=m.$set)?void 0:s[e.property])?i:H(null==(r=m.properties)?void 0:r.$set)?m.properties.$set[e.property]:void 0;return(null==t?void 0:t.pending)&&n===t.value});this.du.emit("eventCaptured",m);let C=null!=(s=null==i?void 0:i._url)?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),R="recordings"===(null==i?void 0:i._batchKey)||/\/s\/(?:\?|$)/.test(C),F=tE(tE(tE({method:"POST",url:C,data:m,compression:"best-available",preferSyncCompression:null==i?void 0:i.send_instantly,timestampMode:R?"body":"capture-body",batchKey:null==i?void 0:i._batchKey},R&&(null==(r=m.properties)?void 0:r.$session_id)?{batchGroup:m.properties.$session_id+(m.properties.$window_id?`-${m.properties.$window_id}`:"")}:{}),(null==i?void 0:i.transport)?{transport:i.transport}:{}),O.length?{fireCallbackOnDrop:!0,callback:e=>{if(e.statusCode>=200&&300>e.statusCode)for(let{channel:e,update:t}of O)this.dh(e,t.value)}}:{});if(!this.config.request_batching||i&&!(null==i?void 0:i._batchKey)||(null==i?void 0:i.send_instantly)||O.length){let e;!F.transport&&!F.callback&&z(null!=(o=this.config.request_headers)?o:{})&&this.Cu&&(e="sendBeacon"),this.ju(F,e)}else this.qu.enqueue(F);return m}_addCaptureHook(e){return this.on("eventCaptured",t=>e(t.event,t))}getExtension(e){var t;return null==(t=this.Xu)?void 0:t.getExtension(e)}Zu(){var e;
2return null!=(e=this.Xu)?e:this.Xu=new ac(this)}fu(e){this.Eu.push(e);let t=!0;return()=>{if(!t)return;t=!1;let i=this.Eu.indexOf(e);-1!==i&&this.Eu.splice(i,1)}}gh(e=!0){var t,i,s;return!!(null==(t=this.persistence)?void 0:t.consumeCookieIdentityChange())&&(this.Ou=null,"anonymous"===this.persistence.get_property("$user_state")&&(null==(s=this.sessionPersistence)||s.clear(),this.Iu.clear(),this.mh()),null==(i=this.featureFlags)||i.reset(),e&&this.reloadFeatureFlags(),!0)}calculateEventProperties(e,t,i,s,r){let n;if(i=i||new Date,!this.persistence||!this.sessionPersistence)return t;this.persistence.syncCookieProperties(),this.gh();let o=r?void 0:this.persistence.remove_event_timer(e),a=tE({},t);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,this.yu()&&(a[sy]=!0),"$snapshot"===e){let e=tE(tE({},this.persistence.properties()),this.sessionPersistence.properties());return a.distinct_id=e.distinct_id,(!W(a.distinct_id)&&!Y(a.distinct_id)||G(a.distinct_id))&&iS.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}let l=function(e,t,i,s=!1){var r,n,o,a;let l,u;if(!b)return{};let h=e?[...na,...t||[]]:[],[d,p]=ti(b),[f,_]=function(e){for(let t=0;to.length>t;t++){let[i,s,r]=to[t],n=e.match(i);if(n){let t=r&&e.match(r)||n;return[s,(null==t?void 0:t[1])||""]}}return["",""]}(b),v=(null==(l="u">typeof navigator?navigator:void 0)?void 0:l.brave)?{brave:!0}:{},m={};V(i)||(m.detectGoogleSearchApp=i);let y={},w=null==(r=navigator)||null==(r=r.userAgentData)?void 0:r.platform,E=null==(n=navigator)?void 0:n.maxTouchPoints,x=null==c||null==(o=c.screen)?void 0:o.width,k=null==c||null==(a=c.screen)?void 0:a.height,$=null==c?void 0:c.devicePixelRatio;V(w)||(y.userAgentDataPlatform=w),V(E)||(y.maxTouchPoints=E),V(x)||(y.screenWidth=x),V(k)||(y.screenHeight=k),V($)||(y.devicePixelRatio=$);let I=sH(sW({$os:d,$os_version:p,$browser:e9(b,navigator.vendor,v,m),$webview_app:f,$webview_app_version:_,$device:ts(b),$device_type:tr(b,y),$timezone:ny(),$timezone_offset:function(){try{return(new Date).getTimezoneOffset()}catch(e){return}}()}),{$current_url:ns(s?tg(null==g?void 0:g.href):null==g?void 0:g.href,h,nu),$host:null==g?void 0:g.host,$pathname:null==g?void 0:g.pathname,$raw_user_agent:b.length>1e3?b.substring(0,997)+"...":b,$browser_version:te(b,navigator.vendor,v,m),$browser_language:nf(),$browser_language_prefix:"string"==typeof(u=nf())?u.split("-")[0]:void 0,$screen_height:null==c?void 0:c.screen.height,$screen_width:null==c?void 0:c.screen.width,$viewport_height:null==c?void 0:c.innerHeight,$viewport_width:null==c?void 0:c.innerWidth,$lib:S.LIB_NAME,$lib_version:S.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return S.SDK_DIST_CHANNEL&&(I.$sdk_dist_channel=S.SDK_DIST_CHANNEL),I}(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(r,i.getTime(),!0);a.$session_id=e,a.$window_id=t}this.sessionPropsManager&&sH(a,this.sessionPropsManager.getSessionProps());try{var u;if(this.sessionRecording){let t=this.sessionRecording.sdkDebugProperties,i=!this.Pu&&aw(e);for(let e in t)(i||A(ay,e))&&(a[e]=t[e])}a.$sdk_debug_retry_queue_size=null==(u=this.Bu)?void 0:u.length}catch(e){a.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===o6&&(a.$lib_custom_api_host=this.config.api_host),n="$pageview"!==e||r?"$pageleave"!==e||r?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,s),a=sH(a,n),"$pageview"===e&&f&&(a.title=f.title),!V(o)){let e=i.getTime()-o;a.$duration=parseFloat((e/1e3).toFixed(3))}b&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser");let h=this.persistence.properties(),d=this.sessionPersistence.properties(),p=a.$groups,_=h.$groups;H(p)&&!z(p)&&(a.$groups=tE(tE({},H(_)?_:{}),p)),sq(["$referrer","$referring_domain"],e=>{e in h&&delete d[e]});let v={};if(this.Eu.length>0)for(let e of this.Eu.slice())try{sH(v,e())}catch(e){iS.error("Failed to produce browser extension event properties",e)}(a=sH({},l,h,d,tE(tE({},v),a))).$is_identified=this._isIdentified(),U(this.config.property_denylist)?sq(this.config.property_denylist,function(e){delete a[e]}):iS.error(am+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);let m=this.config.sanitize_properties;m&&(iS.error(av),a=m(a,e));let y=this.yh();return a.$process_person_profile=y,y&&!r&&this.bh("_calculate_event_properties"),a}ph(e,t=!0,i=!1){var s;if(!this.persistence||!this.yh()||this.Tu&&!i)return e;let r=sH({},this.persistence.get_initial_props(),(null==(s=this.sessionPropsManager)?void 0:s.getSetOnceProps())||{},e||{}),n=this.config.sanitize_properties;return n&&(iS.error(av),r=n(r,"$set_once")),t&&(this.Tu=!0),z(r)?void 0:r}register(e,t){var i;null==(i=this.persistence)||i.register(e,t)}register_once(e,t,i){var s;null==(s=this.persistence)||s.register_once(e,t,i)}register_for_session(e){var t,i;null==(t=this.persistence)||t.syncCookieProperties(),this.gh(),null==(i=this.sessionPersistence)||i.register(e),Object.keys(e).forEach(e
2=>this.Iu.add(e)),this.mh()}unregister(e){var t;null==(t=this.persistence)||t.unregister(e)}unregister_for_session(e){var t;null==(t=this.sessionPersistence)||t.unregister(e),this.Iu.delete(e),this.mh()}_h(e,t){this.register({[e]:t})}Hu(){this.Iu.forEach(e=>{var t;null==(t=this.sessionPersistence)||t.unregister(e)}),this.Iu.clear(),this.mh()}mh(){var e;if(!this.Mu)return;if("memory"===this.config.persistence||(null==(e=this.sessionPersistence)?void 0:e.hi)||!rd.Et())return void rd.Lt(this.Mu);let t=[];this.Iu.forEach(e=>t.push(e)),t.length>0?rd.$t(this.Mu,t):rd.Lt(this.Mu)}getFeatureFlag(e,t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return null==(t=this.featureFlags)?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagResult(e,t)}getAllFeatureFlags(){var e,t;return null!=(e=null==(t=this.featureFlags)?void 0:t.getAllFeatureFlags())?e:[]}isFeatureEnabled(e,t){var i,s;return null!=(i=null==(s=this.featureFlags)?void 0:s.isFeatureEnabled(e,t))?i:null==t?void 0:t.defaultValue}reloadFeatureFlags(){var e;null==(e=this.featureFlags)||e.reloadFeatureFlags()}updateFlags(e,t,i){var s;null==(s=this.featureFlags)||s.updateFlags(e,t,i)}updateEarlyAccessFeatureEnrollment(e,t,i){var s;null==(s=this.featureFlags)||s.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t=!1,i){var s;return null==(s=this.featureFlags)?void 0:s.getEarlyAccessFeatures(e,t,i)}on(e,t){return this.du.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:a_}),()=>{})}onSessionId(e){var t,i;return null!=(t=null==(i=this.sessionManager)?void 0:i.onSessionId(e))?t:()=>{}}getSurveys(e,t=!1){this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:a_})}getActiveMatchingSurveys(e,t=!1){this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:a_})}onActiveMatchingSurveysChanged(e){return this.surveys?this.surveys.onActiveMatchingSurveysChanged(e):(e([],{isLoaded:!1,error:a_}),()=>{})}renderSurvey(e,t){var i;null==(i=this.surveys)||i.renderSurvey(e,t)}displaySurvey(e,t=ar){var i;null==(i=this.surveys)||i.displaySurvey(e,t)}cancelPendingSurvey(e){var t;null==(t=this.surveys)||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,i;return null!=(t=null==(i=this.surveys)?void 0:i.canRenderSurvey(e))?t:{visible:!1,disabledReason:a_}}canRenderSurveyAsync(e,t=!1){var i,s;return null!=(i=null==(s=this.surveys)?void 0:s.canRenderSurveyAsync(e,t))?i:Promise.resolve({visible:!1,disabledReason:a_})}wh(e){return!e||G(e)?(iS.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===e?(iS.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())||(iS.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,i){if(!this.__loaded||!this.persistence)return iS.uninitializedWarning("posthog.identify");if(Y(e)&&(e=e.toString(),iS.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this.wh(e)||!this.bh("posthog.identify"))return;this.ku();let s=this.get_distinct_id(),r=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==s,n=this.gh(!1),o=this.persistence.Oa(),a=!1;try{let s=this.get_distinct_id();this.register({$user_id:e}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:s},""),e!==s&&e!==this.get_property("__alias")&&(this.unregister(iM),this.register({distinct_id:e}));let o=(this.persistence.get_property("$user_state")||"anonymous")===sR,u=e!==s,h=!u&&o;if(u&&o){var l;let r=this.config.reuseAnonymousId?{distinct_id:e}:{distinct_id:e,$anon_distinct_id:s};this.persistence.set_property(sd,sF),this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Da(),this.capture("$identify",r,{$set:t||{},$set_once:i||{}})&&(this.Ou=o4(e,t,i)),null==(l=this.featureFlags)||l.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:s)}else if(h){this.persistence.set_property(sd,sF);let s=t||{},r=i||{};this.setPersonPropertiesForFlags({$set:s,$set_once:r},!1),this.config.cookieWinsOnConflict&&this.persistence.Da(),this.capture("$set",{$set:s,$set_once:r})&&(this.Ou=o4(e,t,i))}else(t||i)&&this.setPersonProperties(t,i);u||r||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(sl)):h&&(t||i)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence.qa(a)}}setPersonProperties(e,t){if(!e&&!t||!this.bh("posthog.setPersonProperties"))return;let i=o4(this.get_distinct_id(),e,t);this.Ou!==i?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}})&&(this.Ou=i)):iS.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(e){var t;let i=(U(e)?e:[e]).filter(e=>W(e)&&e.length>0);0!==i.length&&this.bh("posthog.unsetPersonProperties")&&(null==(t=this.featureFlags)||t.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.Ou=null)}group(e,t,i){var s;if(!e||!t)return void iS.error("posthog.group requires a group type and group key");null==(s=this.persistence)||s.syncCookieProperties(),this.gh();let r=this.getGroups(),n=r[e]!==t;if(n&&this.resetGroupPropertiesForFlags(e),this.register({$groups:tE(tE({},r),{},{[e]:t})}),(n||i)&&this.yh()){let s={$group_type:e,$group_key:t};
2i&&(s.$group_set=i),this.capture(sB,s)}i&&this.setGroupPropertiesForFlags({[e]:i}),n&&!i&&this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t=!0){var i;null==(i=this.featureFlags)||i.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(e=!0){var t;null==(t=this.featureFlags)||t.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,t=!0){var i;this.bh("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;null==(t=this.featureFlags)||t.resetGroupPropertiesForFlags(e)}reset(e){let t=Q(e)?e:null==e?void 0:e.resetDeviceID,i=Q(e)||null==e?void 0:e.bootstrap;this.kh(t,!1,i)}kh(e,t=!1,i){var s,r,n,o,a,l,u,h,c,d,p,f,g,_,v,m,y,b,w,E,x;if(iS.info("reset"),!this.__loaded)return iS.uninitializedWarning("posthog.reset");let k=null==i?void 0:i.sessionID;this.config.bootstrap=i||(null==(s=this.Lu)?void 0:s.bootstrap)||{},null==(r=this.featureFlags)||null==(n=r.updateConfig)||n.call(r,this.config,this.il());let S=this.get_property(iF),$=this.get_property(iA),I=this.get_property(iX);null==(o=this.sessionRecording)||o.flushBeforeIdentityReset();let P=this.is_capturing();this.consent.reset(),t||!P||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 T=null==(a=this.persistence)||null==(l=a.Oa)?void 0:l.call(a),O=!1;try{if(null==(u=this.persistence)||u.clear(),null==(h=this.sessionPersistence)||h.clear(),this.Iu.clear(),this.mh(),V(I)||null==(m
2=this.persistence)||m.register({$session_recording_remote_config:I}),null==(c=this.surveys)||c.reset(),null==(d=this.featureFlags)||d.reset(),null==(p=this.conversations)||p.reset(),null==(f=this.logs)||f.reset(),null==(g=this.metrics)||g.reset(),null==(_=this.persistence)||_.set_property("$user_state","anonymous"),null==(v=this.sessionManager)||v.resetSessionId(),this.Ou=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:sm,$device_id:null},"");else{let t=this.config.get_device_id(s2());this.register_once({distinct_id:t,$device_id:e?t:S},""),e||V($)||this.register({[iA]:$})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),i&&(i.distinctID&&!this.yu()&&(null==(w=this.persistence)||w.set_property("$user_state",i.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:i.distinctID})),null==(y=this.featureFlags)||y.initialize(),!K(k)&&!(null==(b=this.sessionManager)?void 0:b.setBootstrapSessionId(k,!0)))){let e=tE({},i);delete e.sessionID,this.config.bootstrap=e}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,O=!0}finally{T&&(null==(E=this.persistence)||null==(x=E.qa)||x.call(E,O))}this.reloadFeatureFlags()}shutdown(e){var t=this;return eu(function*(){var e,i,s,r,n,o,a,l,u;if(t.__loaded){t.$u=!0,t.Zu().dispose(),null==(e=t.sessionRecording)||e.dispose(),null==(i=t.logs)||i.flushLogs("sendBeacon"),null==(s=t.metrics)||s.flush("sendBeacon"),null==(r=t.metrics)||r.dispose(),null==(n=t.qu)||n.unload(),null==(o=t.Bu)||o.unload();try{null==(u=t.featureFlags)||u.destroy()}catch(e){iS.error("Error while destroying feature flags",e)}null==(a=t.persistence)||a.destroy(),null==(l=t.sessionPersistence)||l.destroy()}else iS.uninitializedWarning("posthog.shutdown")})()}setIdentity(e,t){var i;delete this.config.identity_claims,this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),null==(i=this.conversations)||i.Sh()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,null==(e=this.conversations)||e.xh()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return null!=(e=null==(t=this.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";let{sessionId:t,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),s=this.requestRouter.endpointFor("ui",`/project/${this.config.token}/replay/${t}`);if((null==e?void 0:e.withTimestamp)&&i){var r;let t=null!=(r=e.timestampLookBack)?r:10;if(!i)return s;s+=`?t=${Math.max(Math.floor(((new Date).getTime()-i)/1e3)-t,0)}`}return s}alias(e,t){return e===this.get_property("$people_distinct_id")?(iS.critical("Attempting to create alias for existing People user - aborting."),-2):this.bh("posthog.alias")?(V(t)&&(t=this.get_distinct_id()),e!==t?(this._h(iM,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(iS.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){let t=tE({},this.config);if(H(e)){var i,s,r,n,o,a,l,u,h,c,d,p,f,g,_,v,m;sH(this.config,aT(e));let y=this.Su();if(this.persistence){let e="sessionStorage"===this.config.persistence||"memory"===this.config.persistence;(e&&this.sessionPersistence!==this.persistence&&(null==(g=this.sessionPersistence)||g.remove(),null==(_=this.sessionPersistence)||_.destroy()),this.persistence.update_config(this.config,t,y),e)?this.sessionPersistence=this.persistence:this.sessionPersistence===this.persistence?this.sessionPersistence=new nR(tE(tE({},this.config),{},{persistence:"sessionStorage"}),y,!1):null==(v=this.sessionPersistence)||v.update_config(tE(tE({},this.config),{},{persistence:"sessionStorage"}),tE(tE({},t),{},{persistence:"sessionStorage"}),y)}let b=this.Du(this.config.debug);Q(b)&&(this.config.debug=b),Q(this.config.debug)&&(this.config.debug?(S.DEBUG=!0,s7.Et()&&s7.$t("ph_debug",!0),iS.info("set_config",{config:e,oldConfig:t,newConfig:tE({},this.config)})):(S.DEBUG=!1,s7.Et()&&s7.Lt("ph_debug"))),null==(i=this.featureFlags)||null==(s=i.updateConfig)||s.call(i,this.config,this.il()),null==(r=this.exceptionObserver)||r.onConfigChange(),null==(n=this.exceptions)||n.onConfigChange(),null==(o=this.metrics)||o.onConfigChange(),null==(a=this.sessionRecording)||a.startIfEnabledOrStop(),null==(l=this.tracingHeaders)||l.startIfEnabledOrStop(),null==(u=this.autocapture)||u.startIfEnabled(),null==(h=this.heatmaps)||h.startIfEnabled(),("capture_pageview"in e||"disable_capture_url_hashes"in e)&&(null==(m=this.historyAutocapture)||m.startIfEnabledOrStop()),null==(c=this.exceptionObserver)||c.startIfEnabledOrStop(),null==(d=this.deadClicksAutocapture)||d.startIfEnabledOrStop(),null==(p=this.surveys)||p.loadIfEnabled(),this.xu(),null==(f=this.externalIntegrations)||f.startIfEnabledOrStop(),!t.segment&&this.config.segment&&this.persistence&&r1(this,af,!1)}}_overrideSDKInfo(e,t){S.LIB_NAME=e,S.LIB_VERSION=t}startSessionRecording(e){var t,i,s,r,n;let o=!0===e,a={sampling:o||!!(null==e?void 0:e.sampling),linked_flag:o||!!(null==e?void 0:e.linked_flag),url_trigger:o||!!(null==e?void 0:e.url_trigger),event_trigger:o||!!(null==e?void 0:e.event_trigger)};Object.values(a).some(Boolean)&&(null==(t=this.sessionManager)||t.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(s=this.sessionRecording)||s.overrideLinkedFlag()),a.url_trigger&&(null==(r=this.sessionRecording)||r.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!!(null==(e=this.sessionRecording)?void 0:e.started)}captureException(e,t){try{if(!this.exceptions)return;let i=this.exceptions.buildProperties(e,{handled:!0,syntheticException:Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(tE(tE({},i),t))}catch(e){return}}addExceptionStep(e,t){var i;null==(i=this.exceptions)||i.addExceptionStep(e,t)}captureLog(e){var t;null==(t=this.logs)||t.captureLog(e)}get logger(){var t,i;return null!=(t=null==(i=this.logs)?void 0:i.logger)?t:e.Ch}startExceptionAutocapture(e){this.set_config({capture_exceptions:null==e||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,i;return null!=(t=null==(i=this.toolbar)?void 0:i.loadToolbar(e))&&t}get_property(e){var t;return null==(t=this.persistence)?void 0:t.props[e]}getSessionProperty(e){var t;return null==(t=this.sessionPersistence)?void 0:t.props[e]}toString(){var e;let t=null!=(e=this.config.name)?e:a$;return t!==a$&&(t="posthog."+t),t}_isIdentified(){var e,t;return"identified"===(null==(e=this.persistence)?void 0:e.get_property("$user_state"))||"identified"===(null==(t=this.sessionPersistence)?void 0:t.get_property("$user_state"))}yh(){var e,t;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&
2!this._isIdentified()&&z(this.getGroups())&&!(null==(e=this.persistence)||null==(e=e.props)?void 0:e.__alias)&&!(null==(t=this.persistence)||null==(t=t.props)?void 0:t.$epp))}ih(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.yh()||this.bh("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.bh("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}bh(e){return"never"===this.config.person_profiles?(iS.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.bu(),this._h(sv,!0),!0)}Su(){if("always"===this.config.cookieless_mode)return!0;let e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&"on_reject"!==this.config.cookieless_mode)}xu(){var e,t,i,s,r;let n=this.Su();return this.is_capturing()||null==(i=this.logs)||i.$h(),(null==(e=this.persistence)?void 0:e.hi)!==n&&(null==(s=this.persistence)||s.set_disabled(n)),(null==(t=this.sessionPersistence)?void 0:t.hi)!==n&&(null==(r=this.sessionPersistence)||r.set_disabled(n)),this.mh(),n}opt_in_capturing(t){var i,s,r,n,o,a,l,u,h,c,d;if("always"!==this.config.cookieless_mode){if(this.yu()){null==(s=this.sessionRecording)||s.dispose({discardBufferedEvents:!0}),this.kh(!0,!0),null==(r=this.sessionManager)||r.destroy(),null==(n=this.pageViewManager)||n.destroy(),this.sessionManager=new oX(this),this.pageViewManager=new r4(this),this.persistence&&(this.sessionPropsManager=new oJ(this,this.sessionManager,this.persistence));let t=null!=(o=null==(a=this.config.__extensionClasses)?void 0:a.sessionRecording)?o:null==(l=e.__defaultExtensionClasses)?void 0:l.sessionRecording;t&&(this.sessionRecording=this.mu(this.sessionRecording,new t(this)),this.cu&&(null==(u=this.sessionRecording)||null==(h=u.onRemoteConfig)||h.call(u,this.cu)))}this.consent.optInOut(!0),this.xu(),this.Yu(),null==(i=this.sessionRecording)||i.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null==(c=this.surveys)||c.loadIfEnabled()),(V(null==t?void 0:t.captureEventName)||(null==t?void 0:t.captureEventName))&&this.capture(null!=(d=null==t?void 0:t.captureEventName)?d:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.th()}else iS.warn(ag)}opt_out_capturing(){var e,t;if("always"===this.config.cookieless_mode)return void iS.warn(ag);let i="on_reject"===this.config.cookieless_mode?this.sessionRecording:void 0;null==i||i.dispose({discardBufferedEvents:!0}),"on_reject"===this.config.cookieless_mode&&this.consent.isOptedIn()&&this.kh(!0,!0),this.consent.optInOut(!1),this.xu(),"on_reject"===this.config.cookieless_mode&&(this.register({distinct_id:sm,$device_id:null}),this.gu(i),this.sessionRecording=void 0,null==(e=this.sessionManager)||e.destroy(),null==(t=this.pageViewManager)||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.th(),this.Yu())}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 1===e?"granted":0===e?"denied":"pending"}is_capturing(){return"always"===this.config.cookieless_mode||("on_reject"===this.config.cookieless_mode?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.xu()}_is_bot(){return p?oQ(p,this.config.custom_blocked_useragents):void 0}th(){f&&("visible"===f.visibilityState?this.Ru||(this.Ru=!0,this.capture(sD,{title:f.title},{send_instantly:!0}),this.Au&&(f.removeEventListener(sM,this.Au),this.Au=null)):this.Au||(this.Au=this.th.bind(this),sK(f,sM,this.Au)))}debug(e){!1===e?(null==c||c.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==c||c.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}))}il(){var e,t;let i,s,r=this.Lu||{};return"advanced_disable_flags"in r?!!r.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(iS.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):(t="advanced_disable_decide",i=(e="advanced_disable_flags")in r&&!K(r[e]),s=t in r&&!K(r[t]),i?r[e]:!!s&&(iS&&iS.warn(`Config field '${t}' is deprecated. Please use '${e}' instead. The old field will be removed in a future major version.`),r[t]))}Os(e){var t;if(K(this.config.before_send))return e;let i=Object.keys(null!=(t=e.properties)?t:{}).filter(ee),s=U(this.config.before_send)?this.config.before_send:[this.config.before_send],r=e;
2for(let t of s)try{if(r=t(r),K(r)){let t=`Event '${e.event}' was rejected in beforeSend function`;return Z(e.event)?iS.warn(`${t}. This can cause unexpected behavior.`):iS.info(t),null}r.properties&&!z(r.properties)||iS.warn(`Event '${e.event}' has no properties after beforeSend function, this is likely an error.`)}catch(t){return iS.error(`Error in beforeSend function for event '${e.event}':`,t),null}for(let t of i)if(r.properties&&K(r.properties[t]))return iS.warn(`Event '${e.event}' had its '${t}' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return r}getPageViewId(){var e;return null==(e=this.pageViewManager.Wo)?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}Du(e){let t=Q(e)&&!e,i=s7.Et()&&"true"===s7.Ot("ph_debug");return!t&&(!!i||e)}};aC.__defaultExtensionClasses={},aC.Ch={trace:u=()=>{},debug:u,info:u,warn:u,error:u,fatal:u},function(e,t){for(let i=0;t.length>i;i++)e.prototype[t[i]]=sV(e.prototype[t[i]])}(aC,["identify"]);var aR=class{constructor(e){this.disabled=!1===e;const t=H(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,i){if(this.disabled)return!1;let s=this.clicks[this.clicks.length-1];if(s&&Math.abs(e-s.x)+Math.abs(t-s.y)<this.thresholdPx&&this.timeoutMs>i-s.timestamp){if(this.clicks.push({x:e,y:t,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:i}];return!1}};let aF="$copy_autocapture",aA=i$("[AutoCapture]");function aM(e,t){return t.length>e?t.slice(0,e)+"...":t}var aL=class{do(){this.vo=void 0,clearTimeout(this.fo),this.fo=void 0}po(e){var t;if(!rj(e))return!0;let i=null!=(t=this.mo().css_selector_ignorelist)?t:rO,s=new Set,r=e;for(;r;){if(s.size>=1e3||s.has(r))return!0;s.add(r);let e=r,t=rE(e);if(A(t,"ph-no-capture")||A(t,"ph-sensitive")||rB(e)||i.some(t=>rI(e,t)))return!0;let n=r.parentNode;r=ry(n)?n.host:n&&r_(n)?n:null}return!1}yo(e){if(!this.isEnabled||"pointercancel"===e.type)return void this.do();if("pointerdown"===e.type){var t;this.do();let i=rS(e);return void(e.isPrimary&&0===e.button&&!e.ctrlKey&&i&&r_(i)&&(this.vo={target:i,excluded:this.po(i),id:e.pointerId,x:e.clientX,y:e.clientY,released:!1,distinctId:null==(t=this.bo)?void 0:t.distinctId}))}let i=this.vo;i&&(e.pointerId!==i.id||Math.abs(e.clientX-i.x)>5||Math.abs(e.clientY-i.y)>5?this.do():"pointerup"===e.type&&(i.released=!0,this.fo=setTimeout(()=>this.do(),0)))}_o(e){var t,i;let s=this.vo;this.do();let r=rS(e);if((null==s?void 0:s.released)&&s.target.isConnected&&s.distinctId===(null==(t=this.bo)?void 0:t.distinctId)&&e.pointerId===s.id&&(e.detail>0||"touch"===e.pointerType||"pen"===e.pointerType)&&0===e.button&&5>=Math.abs(e.clientX-s.x)&&5>=Math.abs(e.clientY-s.y)&&r&&(rv(r,"html")||rv(r,"body"))){if(s.excluded)return null;let e=null!=(i=this.mo().css_selector_ignorelist)?i:rO;return[r,null==f?void 0:f.documentElement,null==f?void 0:f.body].some(t=>{if(!t)return!1;let i=rE(t);return A(i,"ph-no-capture")||A(i,"ph-sensitive")||!rj(t)||rB(t)||e.some(e=>rI(t,e))})?null:s.target}}constructor(e){this.wo=e,this.name="autocapture",this.ko=!1,this.So=null,this.xo=!1,this.Co=new Map,this.$o=!1,this.Ir={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.To=!1,this.wo.refresh(this.Ir),this.rageclicks=new aR(this.Ir.rageclick),this.Io=null}setup(e){this.Mo(),this.bo=e;let t=e.onRemoteConfig(this.onRemoteConfig.bind(this));this.To?t.dispose():(this.Eo=t,this.startIfEnabled())}dispose(){var e;this.To||(this.To=!0,this.bo=void 0,null==(e=this.Eo)||e.dispose(),this.Eo=void 0,this.Co.clear(),this.Io=null,this.Po())}mo(){return this.wo.refresh(this.Ir),this.Ir}Mo(){var e,t;return this.mo(),this.Ir.url_allowlist=null==(e=this.Ir.url_allowlist)?void 0:e.map(e=>new RegExp(e)),this.Ir.url_ignorelist=null==(t=this.Ir.url_ignorelist)?void 0:t.map(e=>new RegExp(e)),this.Ir}Ro(){if(!this.isBrowserSupported())return void aA.info("Disabling Automatic Event Collection because this browser is not supported");if(!c||!f)return;let e=this.Ao=e=>{e=e||(null==c?void 0:c.event);try{if("blur"===e.type)return void this.do();if(0===e.type.indexOf("pointer"))return void this.yo(e);let t="click"===e.type?this._o(e):void 0;if(J(t))return;this.Fo(e,"$autocapture",t)}catch(e){aA.error("Failed to capture event",e)}};if(sK(c,"blur",e),sK(f,"submit",e,{capture:!0}),sK(f,"change",e,{capture:!0}),sK(f,"click",e,{capture:!0}),sq(["pointerdown","pointermove","pointerup","pointercancel"],t=>{sK(f,t,e,{capture:!0})}),this.mo().capture_copied_text){let e=this.Oo=e=>{e=e||(null==c?void 0:c.event);try{this.Fo(e,aF)}catch(e){aA.error("Failed to capture clipboard event",e)}};sK(f,"copy",e,{capture:!0}),sK(f,"cut",e,{capture:!0}),sK(f,"paste",e,{capture:!0})}}Po(){this.do(),this.Ao&&(null==c||c.removeEventListener("blur",this.Ao),sq(["pointerdown","pointermove","pointerup","pointercancel"],e=>{null==f||f.removeEventListener(e,this.Ao,!0)}),null==f||f.removeEventListener("submit",this.Ao,!0),null==f||f.removeEventListener("change",this.Ao,!0),null==f||f.removeEventListener("click",this.Ao,!0),this.Ao=void 0),this.Oo&&(null==f||f.removeEventListener("copy",this.Oo,!0),null==f||f.removeEventListener("cut",this.Oo,!0),null==f||f.removeEventListener("paste",this.Oo,!0),this.Oo=void 0),this.ko=!1}startIfEnabled(){this.isEnabled||this.do(),!this.To&&this.bo&&this.isEnabled&&!this.ko&&(this.Ro(),this.ko=!0)}onRemoteConfig(e){var t;if(this.To)return;if(this.xo=!0,!e.ok)return void this.startIfEnabled();let i=e.config;
2i.elementsChainAsString&&(this.$o=i.elementsChainAsString);let s=i.autocapture_opt_out;Q(s)&&(null==(t=this.bo)||t.kv.set("$autocapture_disabled_server_side",s),this.So=s),this.startIfEnabled()}setElementSelectors(e,t=this){if(this.To)return;e.size?this.Co.set(t,new Set(e)):this.Co.delete(t);let i=new Set;this.Co.forEach(e=>{e.forEach(e=>i.add(e))}),this.Io=i}getElementSelectors(e,t){var i;let s=[];return null==(i=this.Io)||i.forEach(i=>{let r=null==f?void 0:f.querySelectorAll(i);null==r||r.forEach(r=>{e!==r&&t!==r||A(s,i)||s.push(i)})}),s}get isEnabled(){var e,t;if(this.To)return!1;let i=null==(e=this.bo)?void 0:e.kv.get(iU),s=this.So,r=this.mo();if(!r.remoteRequestsDisabled&&!this.xo)return!1;let n=r.remoteRequestsDisabled&&!this.xo;if(J(s)&&!Q(i)&&!n)return!1;let o=null!=(t=this.So)?t:!!i;return!!r.enabled&&!o}Fo(e,t="$autocapture",i){var s,r,n,o;if(!this.isEnabled)return void this.do();let a=i||rS(e);rm(a)&&(a=a.parentNode||null);let l=this.Mo();"$autocapture"===t&&"click"===e.type&&e instanceof MouseEvent&&l.rageclick&&(null==(s=this.rageclicks)?void 0:s.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime()))&&rL(a,l.rageclick)&&this.Fo(e,"$rageclick",i);let u=t===aF,h=u?tE(tE({},l),{},{dom_event_allowlist:void 0}):l;if(a&&function(e,t,i,s,r,n){var o;if(!c||rD(e)||(null==i?void 0:i.url_allowlist)&&!rw(i.url_allowlist,n)||(null==i?void 0:i.url_ignorelist)&&rw(i.url_ignorelist,n))return!1;if(null==i?void 0:i.dom_event_allowlist){let e=i.dom_event_allowlist;if(e&&!e.some(e=>t.type===e))return!1}let{parentIsUsefulElement:a,targetElementList:l}=rN(e,s);if(!function(e,t){let i=null==t?void 0:t.element_allowlist;if(V(i))return!0;for(let t of e)if(i.some(e=>t.tagName.toLowerCase()===e))return!0;return!1}(l,i)||!rP(l,null==i?void 0:i.css_selector_allowlist)||rP(l,null!=(o=null==i?void 0:i.css_selector_ignorelist)?o:rO))return!1;try{let i=c.getComputedStyle(e);if(i&&"pointer"===i.getPropertyValue("cursor")&&"click"===t.type)return!0}catch(e){}let u=e.tagName.toLowerCase();switch(u){case"html":return!1;case"form":return(r||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(r||["change","click"]).indexOf(t.type)>=0;default:return a?(r||["click"]).indexOf(t.type)>=0:(r||["click"]).indexOf(t.type)>=0&&(r$.indexOf(u)>-1||"true"===e.getAttribute("contenteditable"))}}(a,e,h,u,u?["copy","cut","paste"]:void 0,{config:{get_current_url:l.getCurrentUrl}})){let{props:i,explicitNoCapture:s,target:u}=function(e,{e:t,maskAllElementAttributes:i,maskAllText:s,elementAttributeIgnoreList:r,elementsChainAsString:n,disableCaptureUrlHashes:o}){var a,l,u,h;if(!r_(e))return{props:{}};let d=[e],p=new Set([e]),f=e;for(;f.parentNode&&!rv(f,"body")&&1e3>d.length;){if(ry(f.parentNode)){let e=f.parentNode.host;if(p.has(e))break;p.add(e),d.push(e),f=e;continue}if(!r_(f.parentNode)||p.has(f.parentNode))break;p.add(f.parentNode),d.push(f.parentNode),f=f.parentNode}let g="click"===t.type&&"http://www.w3.org/2000/svg"===e.namespaceURI?d.findIndex(e=>rv(e,"button")||rv(e,"a")):-1;g>0&&(s=s||d.slice(0,g+1).some(e=>!rj(e)||rB(e)));let _=[],v={},m,y=!1,b=!1;if(sq(d,e=>{let t=rj(e);if(rv(e,"a")&&!i&&!(null==r?void 0:r.includes("href"))){let i=e.getAttribute("href");y=!!(t&&i&&rG(i))&&(o?tg(i):i)}A(rE(e),"ph-no-capture")&&(b=!0),_.push(function(e,t,i,s,r=!1){let n=e.tagName.toLowerCase(),o={tag_name:n};r$.indexOf(n)>-1&&!i&&(o.$el_text="a"===n.toLowerCase()||"button"===n.toLowerCase()?aM(1024,rJ(e)):aM(1024,rk(e)));let a=rE(e);t||(null==s?void 0:s.includes("class"))||0>=a.length||(o.classes=a.filter(function(e){return""!==e})),sq(e.attributes,function(i){var n;if((!rB(e)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&!(null==s?void 0:s.includes(i.name))&&!t&&rG(i.value)&&(!W(n=i.name)||"_ngcontent"!==n.substring(0,10)&&"_nghost"!==n.substring(0,7))){let e=i.value;"class"===i.name&&(e=rb(e).join(" ")),o["attr__"+i.name]=aM(1024,"href"===i.name&&r?tg(e):e)}});let l=1,u=1,h=e;for(;h=function(e){if(e.previousElementSibling)return e.previousElementSibling;let t=e;do t=t.previousSibling;while(t&&!r_(t));return t}(h);)l++,h.tagName===e.tagName&&u++;return o.nth_child=l,o.nth_of_type=u,o}(e,i,s,r,o)),sq(function(e){if(!rj(e))return{};let t={};return sq(e.attributes,function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){let i=e.name.replace("data-ph-capture-attribute-",""),s=e.value;i&&s&&rG(s)&&(t[i]=s)}}),t}(e),(e,t)=>{({}).hasOwnProperty.call(v,t)||(v[t]=e)})}),b)return{props:{},explicitNoCapture:b};if(g>0&&(e=d[g],_.splice(0,g)),s||(_[0].$el_text=rv(e,"a")||rv(e,"button")?rJ(e):rk(e)),y){_[0].attr__href=y;let e=null==(u=nt(y))?void 0:u.host,t=null==c||null==(h=c.location)?void 0:h.host;e&&t&&e!==t&&(m=y)}return{props:sH({$event_type:t.type,$ce_version:1},n?{}:{$elements:_},{$elements_chain:U(_)?_.map(e=>{var t,i;let s={text:null==(t=e.$el_text)?void 0:t.slice(0,400),tag_name:e.tag_name,href:null==(i=e.attr__href)?void 0:i.slice(0,2048),attr_class:function(e){let t=e.attr__class;if(t)return U(t)?t:rb(t)}(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return sz(e).filter(([e])=>
20===e.indexOf("attr__")).forEach(([e,t])=>s.attributes[e]=t),s}).map(e=>{var t,i;let s="";if(e.tag_name&&(s+=e.tag_name),e.attr_class)for(let t of(e.attr_class.sort(),e.attr_class))s+=`.${t.replace(/"/g,"")}`;let r=tE(tE(tE(tE({},e.text?{text:e.text}:{}),{},{"nth-child":null!=(t=e.nth_child)?t:0,"nth-of-type":null!=(i=e.nth_of_type)?i:0},e.href?{href:e.href}:{}),e.attr_id?{attr_id:e.attr_id}:{}),e.attributes),n={};return sz(r).sort(([e],[t])=>t>e?-1:+(e>t)).forEach(([e,t])=>n[rK(e.toString())]=rK(t.toString())),s+=":",s+=sz(n).map(([e,t])=>`${e}="${t}"`).join("")}).join(";"):""},(null==(a=_[0])?void 0:a.$el_text)?{$el_text:null==(l=_[0])?void 0:l.$el_text}:{},m&&"click"===t.type?{$external_click_url:m}:{},v),target:e}}(a,{e:e,maskAllElementAttributes:l.maskAllElementAttributes,maskAllText:l.maskAllText,elementAttributeIgnoreList:l.element_attribute_ignorelist,elementsChainAsString:this.$o,disableCaptureUrlHashes:l.disableCaptureUrlHashes});if(s)return!1;let h=this.getElementSelectors(a,u);if(h&&h.length>0&&(i.$element_selectors=h),t===aF){let t=e.type||"clipboard";if("paste"!==t){let e=null==c||null==(n=c.getSelection())?void 0:n.toString(),t=rx(e);if(!t)return!1;i.$selected_content=t,i.$clipboard_text_length=null!=(o=null==e?void 0:e.length)?o:0}i.$copy_type=t}return null==(r=this.bo)||r.capture(t,i),!0}}isBrowserSupported(){return q(null==f?void 0:f.querySelectorAll)}},aD=class{constructor(e){this._instance=e}refresh(e){let t=this._instance.config,i=H(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.il(),e.url_allowlist=null==i?void 0:i.url_allowlist,e.url_ignorelist=null==i?void 0:i.url_ignorelist,e.dom_event_allowlist=null==i?void 0:i.dom_event_allowlist,e.element_allowlist=null==i?void 0:i.element_allowlist,e.css_selector_allowlist=null==i?void 0:i.css_selector_allowlist,e.css_selector_ignorelist=null==i?void 0:i.css_selector_ignorelist,e.element_attribute_ignorelist=null==i?void 0:i.element_attribute_ignorelist,e.capture_copied_text=null==i?void 0:i.capture_copied_text}};let aN=i$("[ExceptionAutocapture]"),aj=()=>{},aB=e=>{var t;if(q(e))return null!=(t=e.__posthog_layer__)?t:e.__rrweb_layer__};function aU(e,t,i){try{if(!(t in e))return aj;let s={next:e[t]},r=i(function(...e){return s.next.apply(this,e)});return q(r)&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:s}})),e[t]=r,()=>{if(e[t]===r)return void(e[t]=s.next);let i=e[t],n=aB(i);for(;n;){if(n.next===r)return void(n.next=s.next);i=n.next,n=aB(i)}}}catch(e){return aj}}let aq=i$("[TracingHeaders]"),aH=i$("[Web Vitals]"),az=["CLS","FCP","INP","LCP"],aV=["INP","LCP"],aW=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],aG="disabled",aJ="lazy_loading",aK=i$("[SessionRecording]"),aY=[sE,sx,sk,sS,s$,sI,sP,sT,sO],aX=i$("[Heatmaps]");function aQ(e){return H(e)&&"clientX"in e&&"clientY"in e&&Y(e.clientX)&&Y(e.clientY)}let aZ=i$("[Product Tours]"),a0=e=>{var t;return!e.config.disable_product_tours&&!!(null==(t=e.persistence)?void 0:t.get_property(iJ))},a1=["$set_once","$set"],a2=i$("[SiteApps]"),a3="Error while initializing PostHog app with config id ",a5=(e,t)=>(null==e?void 0:e.then)?e.then(t):t(e),a4="SDK is not enabled or survey functionality is not yet loaded",a6="Disabled. Not loading surveys.";var a8=class{constructor(e,t){this.wo=e,this.Th=t,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Ih=!1,this.Mh=!1,this.Eh=[],this.Ph=[],this.Rh=null,this.Ah=null,this.To=!1,this.Fh=new Set,this.onRemoteConfig=e=>{if(this.To||this.Ir.disableSurveys)return;if(!e.ok)return this.Mh=!0,this.Oh({isLoaded:!1,error:"Remote config unavailable. Not loading surveys."}),at.warn("Remote config unavailable. Not loading surveys.");let t=e.config.surveys;if(K(t))return at.warn("Flags not loaded yet. Not loading surveys.");this.Dh=Q(t)?t:t.length>0,at.info(`flags response received, isSurveysEnabled: ${this.Dh}`),this.loadIfEnabled()},this.Oh=e=>
2{this.Ph.slice().forEach(t=>this.Lh(t,e))}}setup(e){if(!this.To)return this.Nh=e,a5(e.kv.initialize(),()=>{if(this.Nh!==e||this.To)return;this.Nh=void 0,this.bo=e;let t=e.onRemoteConfig(this.onRemoteConfig);this.To?t.dispose():(this.Eo=t,this.loadIfEnabled())})}dispose(){var e,t,i,s,r;this.To||(this.To=!0,this.Nh=void 0,this.bo=void 0,null==(e=this.Eo)||e.dispose(),this.Eo=void 0,null==(t=this._surveyEventReceiver)||t.dispose(),this._surveyEventReceiver=null,null==(i=this._surveyManager)||null==(s=i.dispose)||s.call(i),this._surveyManager=null,this.Eh=[],this.Ph.forEach(e=>{e.active=!1}),this.Ph=[],null==(r=this.qh)||r.call(this),this.qh=void 0,this.Rh=null,this.Fh.forEach(e=>clearTimeout(e)),this.Fh.clear())}get Ir(){return this.wo.get()}initialize(){this.loadIfEnabled()}reset(){var e,t,i;null==(e=this._surveyManager)||null==(t=e.clearInMemoryInProgressSurveyState)||t.call(e);try{null==(i=this._surveyEventReceiver)||i.reset(),localStorage.removeItem("lastSeenSurveyDate");let e=[];for(let t=0;t<localStorage.length;t++){let i=localStorage.key(t);((null==i?void 0:i.startsWith("seenSurvey_"))||(null==i?void 0:i.startsWith("inProgressSurvey_")))&&e.push(i)}e.forEach(e=>localStorage.removeItem(e))}catch(e){}this.Oh()}loadIfEnabled(){if(this.To||!this.bo)return;let e=this.Ir;if(this._surveyManager)return;if(this.Ih)return void at.info("Already initializing surveys, skipping...");if(e.disableSurveys)return void at.info(a6);if(e.cookielessMode&&this.wo.isOptedOut())return void at.info("Not loading surveys in cookieless mode without consent.");let t=this.wo.getExtensions();if(!t)return void this.jh("PostHog Extensions not found.");if(V(this.Dh)&&!e.advancedEnableSurveys)return;let i=this.Dh||e.advancedEnableSurveys;this.Ih=!0,this.Mh=!1;try{let e=t.generateSurveys;if(e)return this.Bh(e,i),void(this.Ih=!1);let s=t.loadExternalDependency;if(!s)return this.jh(sC),void(this.Ih=!1);s(e=>{try{if(this.To)return;let t=this.wo.getExtensions();!e&&(null==t?void 0:t.generateSurveys)?this.Bh(t.generateSurveys,i):this.jh("Could not load surveys script",e)}finally{this.Ih=!1}})}catch(e){throw this.Ih=!1,this.jh("Error initializing surveys",e),e}}Bh(e,t){var i,s;if(this.To)return;this._surveyManager=e(t),this._surveyEventReceiver=this.wo.createEventReceiver(this.Oh);let r=null==(i=null!=(s=this.bo)?s:this.Th)?void 0:i.kv.get(si);r&&this.Hh(r),at.info("Surveys loaded successfully"),this.zh(),this.Oh(),this.Uh({isLoaded:!0})}jh(e,t){this.Mh=!0,at.error(e,t),this.Oh({isLoaded:!1,error:e}),this.Uh({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Eh.push(e),this._surveyManager&&this.Uh({isLoaded:!0}),()=>{this.Eh=this.Eh.filter(t=>t!==e)}}getSurveys(e,t=!1){var i;let s=null!=(i=this.bo)?i:this.Th;if(!s||this.To)return;if(this.Ir.disableSurveys)return at.info(a6),e([]);let r=s.kv.get(si);if(r&&!t)return e(r,{isLoaded:!0}),void(this.Wh()&&this.getSurveys(()=>{},!0));if(this.Rh)return void this.Rh.then(({surveys:t,context:i})=>{this.To||e(t,i)}).catch(e=>at.error("Error in survey callback",e));let n=this.Vh("/api/surveys/",{method:"GET",query:{token:s.projectToken},sentAt:"query",timeoutMs:this.Ir.requestTimeoutMs}).then(e=>{try{return this.Gh(s,e)}catch(e){return at.error("Error processing surveys response",e),this.Gh(s,{statusCode:0,error:e})}},e=>this.Gh(s,{statusCode:0,error:e}));this.Rh=n;let o=()=>{this.Rh===n&&(this.Rh=null)};n.then(t=>{o(),this.To||(this.Oh(t.context),e(t.surveys,t.context))},o).catch(e=>at.error("Error in survey callback",e))}Vh(e,t){let i=this.bo;return i?i.sendRequest(e,t):new Promise(e=>e({statusCode:0,error:Error(a4)}))}Gh(e,t){if(this.To)return{surveys:[],context:{isLoaded:!1,error:a4}};let i=t.statusCode;if(200!==i||!t.json){let e=`Surveys API could not be loaded, status: ${i}`;return 0!==i?at.error(e):t.error||at.warn(e),this.Ah=Date.now(),{surveys:[],context:{isLoaded:!1,error:e}}}this.Ah=null;let s=t.json.surveys||[];return e.kv.set({[si]:s,[ss]:Date.now()}),this.Hh(s),{surveys:s,context:{isLoaded:!0}}}Hh(e){var t;let i=e.filter(e=>{var t;return!(!e.start_date||e.end_date)&&(o0(e)||!!(null==(t=e.conditions)||null==(t=t.actions)||null==(t=t.values)?void 0:t.length))});null==(t=this._surveyEventReceiver)||t.replace(i)}Wh(){return this.Zh()&&!this.Rh&&!this.Qh()}Zh(){var e,t;let i=null==(e=null!=(t=this.bo)?t:this.Th)?void 0:e.kv.get(ss);return Y(i)&&Date.now()-i>3e5}Qh(){return Y(this.Ah)&&3e5>Date.now()-this.Ah}markSurveyAsSeen(e,t){var i;ai({id:e,current_iteration:null!=(i=null==t?void 0:t.iteration)?i:null});try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(e){}this.Oh()}
2Uh(e){for(let t of this.Eh)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(e){at.error("Error in survey callback",e)}}getActiveMatchingSurveys(e,t=!1){if(!K(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);at.warn("init was not called")}onActiveMatchingSurveysChanged(e){var t,i;if(this.To)return()=>{};let s={callback:e,active:!0,revision:0};this.Ph.push(s),this.zh();let r=null==(t=null!=(i=this.bo)?i:this.Th)?void 0:t.kv.get(si);return!this.Ir.disableSurveys&&(this._surveyManager||!this.Mh||this.Ih)&&(r||K(this.Ah)||this.Rh)?this._surveyManager&&this.Lh(s):this.Lh(s,{isLoaded:!1}),()=>{var e;s.active=!1,this.Ph=this.Ph.filter(e=>e!==s),0===this.Ph.length&&(null==(e=this.qh)||e.call(this),this.qh=void 0)}}zh(){var e,t;this._surveyManager&&this.Ph.length>0&&(null!=this.qh||(this.qh=null==(e=(t=this.wo).onMatchingConditionsChanged)?void 0:e.call(t,this.Oh)))}Lh(e,t){if(this.To||!e.active)return;let i=++e.revision,s=s=>{if(!this.To&&e.active&&i===e.revision)try{let i=null!=t?t:{isLoaded:!0},r=JSON.stringify([s,i]);if(r===e.lastResult)return;e.lastResult=r,e.callback(s,i)}catch(e){at.error("Error in active matching surveys callback",e)}};try{t&&!t.isLoaded?s([]):this.getActiveMatchingSurveys(s)}catch(e){at.error("Error in active matching surveys callback",e)}}Jh(e){let t=null;return this.getSurveys(i=>{var s;t=null!=(s=i.find(t=>t.id===e))?s:null}),t}Kh(e){if(K(this._surveyManager))return{eligible:!1,reason:a4};let t="string"==typeof e?this.Jh(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}Xh(e){if(!this.wo.isCapturing())return{eligible:!1,reason:"PostHog is not capturing, so a survey response cannot be recorded"};if(K(this._surveyManager))return{eligible:!1,reason:a4};let t="string"==typeof e?this.Jh(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(K(this._surveyManager))return at.warn("init was not called"),{visible:!1,disabledReason:a4};let t=this.Xh(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return K(this._surveyManager)?(at.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:a4})):new Promise(i=>{this.getSurveys(t=>{var s;let r=null!=(s=t.find(t=>t.id===e))?s:null;if(r){let e=this.Xh(r);i({visible:e.eligible,disabledReason:e.reason})}else i({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t,i){var s;if(!this.wo.isCapturing())return;if(K(this._surveyManager))return void at.warn("init was not called");let r="string"==typeof e?this.Jh(e):e;if(!(null==r?void 0:r.id))return void at.warn("Survey not found");if(!as.includes(r.type))return void at.warn(`Surveys of type ${r.type} cannot be rendered in the app`);let n=null==f?void 0:f.querySelector(t);if(n){if(null==(s=r.appearance)?void 0:s.surveyPopupDelaySeconds){at.info(`Rendering survey ${r.id} with delay of ${r.appearance.surveyPopupDelaySeconds} seconds`);let e=setTimeout(()=>{var t,s;this.Fh.delete(e),!this.To&&this.wo.isCapturing()&&(at.info(`Rendering survey ${r.id} with delay of ${null==(t=r.appearance)?void 0:t.surveyPopupDelaySeconds} seconds`),null==(s=this._surveyManager)||s.renderSurvey(r,n,i),at.info(`Survey ${r.id} rendered`))},1e3*r.appearance.surveyPopupDelaySeconds);return void this.Fh.add(e)}this._surveyManager.renderSurvey(r,n,i)}else at.warn("Survey element not found")}displaySurvey(e,t){var i;if(!this.wo.isCapturing())return;if(K(this._surveyManager))return void at.warn("init was not called");let s=this.Jh(e);if(!s)return void at.warn("Survey not found");let r=s;if((null==(i=s.appearance)?void 0:i.surveyPopupDelaySeconds)&&t.ignoreDelay&&(r=tE(tE({},s),{},{appearance:tE(tE({},s.appearance),{},{surveyPopupDelaySeconds:0})})),t.displayType!==nz.Popover&&t.initialResponses&&at.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===t.ignoreConditions){let e=this.Kh(s);if(!e.eligible)return void at.warn("Survey is not eligible to be displayed: ",e.reason)}t.displayType!==nz.Inline?this._surveyManager.handlePopoverSurvey(r,t):this.renderSurvey(r,t.selector,t.properties)}cancelPendingSurvey(e){K(this._surveyManager)?at.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e,t;null==(e=this._surveyManager)||null==(t=e.handlePageUnload)||t.call(e)}};function a9(e,t,i){if(K(e))return!1;switch(i){case"exact":return e===t;case"contains":return RegExp(t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*"),"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch(e){return!1}default:return!1}}var a7=class{constructor(e){this._instance=e,this.Yh=new Set,this.tc=new Set,this.ec=new oK,this.nc=(e,t)=>this.sc(e,t)&&this.rc(e,t)&&this.oc(e,t)&&this.ac(e,t),this.sc=(e,t)=>!(null==t?void 0:t.event)||(null==e?void 0:e.event)===(null==t?void 0:t.event)}init(){var e,t;V(null==(e=this._instance)?void 0:e._addCaptureHook)||(this.lc=null==(t=this._instance)?void 0:t._addCaptureHook((e,t)=>{this.on(e,t)}))}dispose(){var e,t;null==(e=this.lc)||e.call(this),this.lc=void 0,null==(t=this._instance)||null==(t=t.autocapture)||t.setElementSelectors(new Set,this),this.ec=new oK}register(e){var t,i;if(!V(null==(t=this._instance)?void 0:t._addCaptureHook)&&(e.forEach(e
2=>{var t;this.Yh.add(e),null==(t=e.steps)||t.forEach(e=>{this.tc.add((null==e?void 0:e.event)||"")})}),null==(i=this._instance)?void 0:i.autocapture)){let e=new Set;this.Yh.forEach(t=>{var i;null==(i=t.steps)||i.forEach(t=>{(null==t?void 0:t.selector)&&e.add(t.selector)})}),this._instance.autocapture.setElementSelectors(e,this)}}replace(e){this.Yh.clear(),this.tc.clear(),this.register(e)}on(e,t){null!=t&&0!=e.length&&(this.tc.has(e)||this.tc.has(t.event))&&this.Yh.forEach(e=>{this.uc(t,e)&&this.ec.emit("actionCaptured",e.name)})}hc(e){this.onAction("actionCaptured",t=>e(t))}uc(e,t){if(null==(null==t?void 0:t.steps))return!1;for(let i of t.steps)if(this.nc(e,i))return!0;return!1}onAction(e,t){return this.ec.on(e,t)}rc(e,t){if(null==t?void 0:t.url){var i;let s=null==e||null==(i=e.properties)?void 0:i.$current_url;if(!s||"string"!=typeof s||!a9(s,t.url,t.url_matching||"contains"))return!1}return!0}oc(e,t){return!!this.cc(e,t)&&!!this.dc(e,t)&&!!this.vc(e,t)}cc(e,t){var i;let s;if(!(null==t?void 0:t.href))return!0;let r=this.fc(e);if(r.length>0)return r.some(e=>a9(e.href,t.href,t.href_matching||"exact"));let n=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";return!!n&&a9((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",t.href,t.href_matching||"exact")}dc(e,t){var i,s,r,n;if(!(null==t?void 0:t.text))return!0;let o=this.fc(e);if(o.length>0)return o.some(e=>a9(e.text,t.text,t.text_matching||"exact")||a9(e.$el_text,t.text,t.text_matching||"exact"));let a=(null==e||null==(n=e.properties)?void 0:n.$elements_chain)||"";return!!a&&(i=function(e){let t,i=[],s=/(?::|")text="(.*?)"/g;for(;!K(t=s.exec(e));)i.includes(t[1])||i.push(t[1]);return i}(a),s=t.text,r=t.text_matching||"exact",i.some(e=>a9(e,s,r)))}vc(e,t){var i,s;if(!(null==t?void 0:t.selector))return!0;let r=null==e||null==(i=e.properties)?void 0:i.$element_selectors;if(null==r?void 0:r.includes(t.selector))return!0;let n=(null==e||null==(s=e.properties)?void 0:s.$elements_chain)||"";if(t.selector_regex&&n)try{return new RegExp(t.selector_regex).test(n)}catch(e){}return!1}fc(e){var t;return null==(null==e||null==(t=e.properties)?void 0:t.$elements)?[]:null==e?void 0:e.properties.$elements}ac(e,t){return!(null==t?void 0:t.properties)||0===t.properties.length||o5(t.properties.reduce((e,t)=>{let i=U(t.value)?t.value.map(String):null!=t.value?[String(t.value)]:[];return e[t.key]={values:i,operator:t.operator||"exact"},e},{}),null==e?void 0:e.properties)}},le=class{constructor(e,t){var i,s;this.gc=[],this._instance=e,this.mc=t,this.yc=new Map,this.bc=new Map,this._c=new Map,this.wc=null==(i=this._instance)||null==(s=i.onSessionId)?void 0:s.call(i,e=>this.kc(e))}Sc(e){return!1}xc(){return null}Cc(e){}$c(){}Tc(e,t){return!!e&&o5(e.propertyFilters,null==t?void 0:t.properties)}Ic(e,t){let i=new Map;return e.forEach(e=>{var s;null==(s=e.conditions)||null==(s=s[t])||null==(s=s.values)||s.forEach(t=>{if(null==t?void 0:t.name){let s=i.get(t.name)||[];s.push(e.id),i.set(t.name,s)}})}),i}Mc(e,t,i){let s=(i===nA.Activation?this.yc:this.bc).get(e),r=[];return this.Ec(e=>{r=e.filter(e=>null==s?void 0:s.includes(e.id))}),r.filter(s=>{var r;let n=null==(r=s.conditions)||null==(r=r[i])||null==(r=r.values)?void 0:r.find(t=>t.name===e);return this.Tc(n,t)})}register(e){this.Pc(e,!1)}replace(e){this.Pc(e,!0)}Pc(e,t){var i;V(null==(i=this._instance)?void 0:i._addCaptureHook)||(this.Rc(e,t),this.Ac(e,t))}Ac(e,t){var i;let s=e.filter(e=>{var t;return null==(t=e.conditions)||null==(t=t.actions)||null==(t=t.values)?void 0:t.length});if(t&&this._c.clear(),0===s.length)return void(t&&(null==(i=this.Fc)||i.replace([])));this.Fc||(this.Fc=new a7(this._instance),this.Fc.init(),this.Fc.hc(e=>this.onAction(e)));let r=[];s.forEach(e=>{var t;null==(t=e.conditions)||null==(t=t.actions)||t.values.forEach(t=>{if(r.push(t),t.name){var i;let s=null!=(i=this._c.get(t.name))?i:[];s.includes(e.id)||s.push(e.id),this._c.set(t.name,s)}})}),t?this.Fc.replace(r):this.Fc.register(r)}Oc(e,t){t.forEach((t,i)=>{var s;let r=null!=(s=e.get(i))?s:[];t.forEach(e=>{r.includes(e)||r.push(e)}),e.set(i,r)})}Rc(e,t){var i;let s=e.filter(e=>{var t,i;return(null==(t=e.conditions)?void 0:t.events)&&(null==(i=e.conditions)||null==(i=i.events)||null==(i=i.values)?void 0:i.length)>0}),r=e.filter(e=>{var t,i;return(null==(t=e.conditions)?void 0:t.cancelEvents)&&(null==(i=e.conditions)||null==(i=i.cancelEvents)||null==(i=i.values)?void 0:i.length)>0}),n=this.Ic(e,nA.Activation),o=this.Ic(e,nA.Cancellation);t?(this.yc=n,this.bc=o):(this.Oc(this.yc,n),this.Oc(this.bc,o)),(0!==s.length||0!==r.length||e.some(e=>{var t;return null==(t=e.conditions)||null==(t=t.actions)||null==(t=t.values)?void 0:t.length}))&&(null!=this.lc||(this.lc=null==(i=this._instance)?void 0:i._addCaptureHook((e,t)=>{this.onEvent(e,t)})))}onEvent(e,t){var i,s;let r=this.Dc(),n=(null==t||null==(i=t.properties)?void 0:i.$survey_id)||(null==t||null==(s=t.properties)?void 0:s.$product_tour_id);if(n&&this.getActivatedIds().includes(n)){let i=this.Lc(e,n,t);if("consume"===i)return r.info("event consumed activated item, remov
2ing it",{event:e,itemId:n}),void this.Nc([n]);if("persist"===i)return r.info("shown item promoted to persisted activation",{event:e,itemId:n}),this.qc(n),void this.jc([n])}if(this.bc.has(e)){let i=this.Mc(e,t,nA.Cancellation);i.length>0&&(r.info("cancel event matched, cancelling items",{event:e,itemsToCancel:i.map(e=>e.id)}),this.Nc(i.map(e=>e.id)),i.forEach(e=>this.Bc(e.id)))}if(!this.yc.has(e))return;r.info("event name matched",{event:e,eventPayload:t,items:this.yc.get(e)});let o=this.Mc(e,t,nA.Activation);this.Hc(o.map(e=>e.id))}onAction(e){this._c.has(e)&&this.Hc(this._c.get(e)||[])}Hc(e){var t,i;if(0===e.length)return;let s=!!(null==(t=this._instance)||null==(i=t.get_session_id)?void 0:i.call(t)),r=[];for(let t of e)s&&this.Sc(t)?this.qc(t)&&this.zc(t):r.push(t);r.length>0&&(this.gc=[...new Set([...this.gc,...r])]),this.Dc().info("updating activated items",{activatedItems:this.getActivatedIds()}),this.Uc()}qc(e){this.gc=this.gc.filter(t=>t!==e);let t=this.Wc();return!t.includes(e)&&(this.Vc([...t,e]),this.Gc(),!0)}Nc(e){let t=new Set(e);this.gc=this.gc.filter(e=>!t.has(e));let i=this.Zc(),s=i.filter(e=>!t.has(e));s.length!==i.length&&(this.Vc(s),0===s.length&&this.Qc()),this.jc(e),this.Uc()}Uc(){try{var e;null==(e=this.mc)||e.call(this)}catch(e){this.Dc().error("Error while handling activated items change",e)}}Jc(){var e;let t=this.xc();if(!t)return{};let i=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[t];return i&&"object"==typeof i?i:{}}zc(e){if(!this.xc())return;let t=this.Jc();this.Cc(tE(tE({},t),{},{[e]:Date.now()}))}jc(e){if(!this.xc())return;let t=this.Jc(),i={},s=!1;for(let[r,n]of Object.entries(t))e.includes(r)?s=!0:i[r]=n;s&&(z(i)?this.$c():this.Cc(i))}Kc(){this.xc()&&this.$c()}getActivationTimestamp(e){if(!this.Wc().includes(e))return;let t=this.Jc()[e];return Y(t)?t:void 0}Zc(){var e;let t=this.Xc();return(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[t])||[]}Wc(){var e,t,i;let s=this.Zc();if(0===s.length)return[];let r=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[this.Yc()],n=null==(t=this._instance)||null==(i=t.get_session_id)?void 0:i.call(t);return n&&r===n?s:[]}Gc(){var e,t;let i=null==(e=this._instance)||null==(t=e.get_session_id)?void 0:t.call(e);i&&this.td(i)}Qc(){this.ed()}kc(e){var t;let i=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[this.Yc()];if(i&&i!==e){let e=this.Zc(),t=this.Jc();e.length>0&&(this.Vc([]),e.filter(e=>Y(t[e])).forEach(e=>this.Bc(e))),this.Qc(),this.Kc(),e.length>0&&this.Uc()}}getActivatedIds(){return[...new Set([...this.Wc(),...this.gc])].filter(e=>!this.nd(e))}dispose(){var e,t,i;null==(e=this.wc)||e.call(this),this.wc=void 0,null==(t=this.lc)||t.call(this),this.lc=void 0,null==(i=this.Fc)||i.dispose(),this.Fc=void 0}reset(){this.gc=[],this.Zc().length>0&&this.Vc([]),this.Qc(),this.Kc(),this.Uc()}getEventToItemsMap(){return this.yc}sd(){return this.Fc}},lt=class extends le{constructor(e,t){super(e,t)}Xc(){return sr}Yc(){return sn}xc(){return so}Cc(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({$surveys_activated_timestamps:e})}$c(){var e;null==(e=this._instance)||null==(e=e.persistence)||e.unregister("$surveys_activated_timestamps")}Sc(e){var t;let i;this.Ec(t=>{i=t.find(t=>t.id===e)});let s=null==i||null==(t=i.appearance)?void 0:t.surveyPopupDelaySeconds;return Y(s)&&s>0}rd(){return nq.SHOWN}Ec(e){var t;null==(t=this._instance)||t.getSurveys(e)}Bc(e){var t;null==(t=this._instance)||t.cancelPendingSurvey(e)}Dc(){return at}Vc(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({$surveys_activated:e})}td(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({$surveys_activated_session:e})}ed(){var e;null==(e=this._instance)||null==(e=e.persistence)||e.unregister("$surveys_activated_session")}nd(){return!1}Lc(e,t,i){var s,r,n;let o;return e===nq.SENT&&!1===(null==i||null==(s=i.properties)?void 0:s.$survey_completed)?"ignore":(this.Ec(e=>{o=e.find(e=>e.id===t)}),!o||o0(r=o)&&(null==(n=r.conditions)||null==(n=n.events)?void 0:n.repeatedActivation)||"always"===r.schedule?e===nq.SHOWN?"consume":"ignore":e===nq.SHOWN?"persist":e===nq.DISMISSED||e===nq.SENT?"consume":"ignore")}getSurveys(){return this.getActivatedIds()}
2getEventToSurveys(){return this.getEventToItemsMap()}},li=class{constructor(e){this._instance=e}initialize(){}get(e){if("string"==typeof e)return this._instance.get_property(e);let t={};for(let i of e){let e=this._instance.get_property(i);V(e)||(t[i]=e)}return t}set(e,t){this._instance.register("string"==typeof e?{[e]:t}:e)}remove(e){"string"!=typeof e?e.forEach(e=>this._instance.unregister(e)):this._instance.unregister(e)}},ls=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=null==x?void 0:x.__PosthogExtensions__;if(!e)return;let{generateSurveys:t,loadExternalDependency:i}=e;return{generateSurveys:t?e=>t(this._instance,e):void 0,loadExternalDependency:i?e=>i(this._instance,"surveys",e):void 0}}createEventReceiver(e){return new lt(this._instance,e)}onMatchingConditionsChanged(e){let t=this._instance._addCaptureHook(t=>{"$pageview"!==t&&t!==nq.SHOWN&&t!==nq.DISMISSED&&t!==nq.SENT||e()}),i=()=>e();sK(c,"PHSurveyShown",i);let s=!1,r=this._instance.onFeatureFlags(()=>{s&&e()});return s=!0,()=>{s=!1,t(),r(),null==c||c.removeEventListener("PHSurveyShown",i)}}};let lr=(null==c?void 0:c.location)?nr(c.location.hash,"__posthog")||nr(location.hash,"state"):null,ln="_postHogToolbarParams",lo=i$("[Toolbar]"),la=i$("[FeatureFlags]");var ll=class{constructor(e,t=!1){this.od=!1,this.update(e,t)}update(e,t){var i,s,r,n,o,a,l,u;this.ad={bootstrap:{featureFlags:null!=(i=null==(s=e.bootstrap)?void 0:s.featureFlags)?i:void 0,featureFlagPayloads:null!=(r=null==(n=e.bootstrap)?void 0:n.featureFlagPayloads)?r: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:null!=(o=e.remote_config_refresh_interval_ms)?o:3e5,idleRefreshBackoff:V(e.remote_config_refresh_interval_ms),requestTimeoutMs:e.feature_flag_request_timeout_ms,requestMaxRetries:Math.max(0,null!=(a=e.feature_flag_request_max_retries)?a:1),compression:e.disable_compression?void 0:"best-available",evaluationContexts:null!=(l=null!=(u=e.evaluation_contexts)?u:e.evaluation_environments)?l:[],flagKeys:U(e.flag_keys)?e.flag_keys:void 0},!e.evaluation_environments||e.evaluation_contexts||this.od||(la.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.od=!0),V(e.flag_keys)||U(e.flag_keys)||la.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this.ad}};let lu=i$("[FeatureFlags]"),lh=i$("[FeatureFlags]",{debugEnabled:!0}),lc="\" failed. Feature flags didn't load in time.",ld=[502,504],lp=["click","keydown","wheel","touchstart","pointerdown"],lf="connection_error",lg=e=>{let t={};for(let i=0;e.length>i;i++)t[e[i]]=!0;return t},l_=e=>{let t={};for(let[i,s]of sz(e||{}))s&&(t[i]=s);return t},lv=e=>es(e)&&("RangeError"===e.name&&0===e.message.indexOf("Maximum call stack size exceeded")||"InternalError"===e.name&&"too much recursion"===e.message),lm=i$("[Error tracking]"),ly="webkit-masked-url:",lb=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],lw=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",ly],lE=["__firefox__","__gCrWeb"],lx="Refusing to render web experiment since the viewer is a likely bot",lk={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>-1===t.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>o1(t,e),not_regex:(e,t)=>!o1(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e},lS=i$("[Conversations]"),l$="Conversations not available yet.";function lI(e,t){var i,s,r,n,o,a,l;let u=null!=(i=null==e?void 0:e.flushIntervalMs)?i:3e3,h=null!=(s=null==e?void 0:e.maxBufferSize)?s:100,c=(null==t?void 0:t.consoleCapture)?void 0:null!=(r=null==e?void 0:e.maxLogsPerInterval)?r:1e3,d=V(c)?Math.max(h,2048):Math.max(h,c),f=tE(tE({},function(){var e,t;let i,s="",r="";try{let e=null==p?void 0:p.userAgent;e&&([s,r]=ti(e))}catch(e){}return e=s,t=r,tE(tE({},(i=function(e){if(e)return({}).hasOwnProperty.call(ic,e)?ic[e]:e}(e))?{"os.name":i}:{}),t?{"os.version":t}:{})}()),null==e?void 0:e.resourceAttributes);return{serviceName:null!=(n=null!=(o=null==f?void 0:f["service.name"])?o:null==e?void 0:e.serviceName)?n:null==t?void 0:t.serviceNameDefault,serviceVersion:null!=(a=null==f?void 0:f["service.version"])?a:null==e?void 0:e.serviceVersion,environment:null!=(l=null==f?void 0:f["deployment.environment"])?l:null==e?void 0:e.environment,resourceAttributes:f,beforeSend:null==e?void 0:e.beforeSend,flushIntervalMs:u,maxBufferSize:h,maxQueueSize:d,maxBatchRecordsPerPost:100,rateCapWindowMs:u,maxLogsPerInterval:c,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}
2let lP=["debug","log","warn","error","info"],lT=e=>{for(;null==e?void 0:e.__rrweb_original__;)e=e.__rrweb_original__;return e},lO="console",lC="__posthogHandledLogsRequestError",lR=(e,t)=>{let i=e instanceof Error?e:Error(t);return i[lC]=!0,i},lF=e=>!!e&&"object"==typeof e&&!0===e[lC],lA=i$("[NetworkMetrics]"),lM=()=>{var e;return(null==c||null==(e=c.performance)?void 0:e.now)?c.performance.now():Date.now()},lL={"http:":80,"https:":443},lD=new Set(["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"]),lN=(e,t)=>{var i;let s=String(t);return{method:String(e).toUpperCase(),url:(null==(i=nt(s))?void 0:i.href)||s}},lj=(e,t,i,s,r,n,o=!1)=>{try{var a,l,u;let h,c=r();if(!c)return;let d=i||void 0,p=lM()-s,f=nt(t.url);if(f&&"http:"!==f.protocol&&"https:"!==f.protocol)return;let g={url:(null==f?void 0:f.href)||t.url,method:t.method},_=q(c.name)?c.name(g):W(c.name)?c.name:"http.client.request.duration";if(!_)return;let v=o&&!d?void 0:d?400>d?void 0:String(d):(null==n?void 0:n.name)||"_OTHER",m=tE(tE(tE(tE(tE({},(u=g.method,h=lD.has(u)?u:"_OTHER",tE({"http.request.method":h},"_OTHER"===h&&u!==h?{"http.request.method_original":u}:{}))),f?{"server.address":f.hostname.startsWith("[")&&f.hostname.endsWith("]")?f.hostname.slice(1,-1):f.hostname,"server.port":Number(f.port)||lL[f.protocol],"url.scheme":f.protocol.slice(0,-1),"url.template":f.pathname.split("/").map(e=>/^\d+$/.test(e)||e.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(e)?":id":e).join("/")}:{}),d?{"http.response.status_code":d}:{}),v?{"error.type":v}:{}),null==(a=c.attributes)?void 0:a.call(c,g,{status:d,durationMs:p}));null==(l=e.metrics)||l.histogram(_,p,{unit:"ms",attributes:m})}catch(e){lA.error("Failed to record network metric",e)}},lB=()=>{},lU={featureFlags:class{constructor(e){this.name="featureFlags",this.ld=!1,this.featureFlagEventHandlers=[],this.A=lu,this.ud={},this.hd={},this.dd=[],this.vd=!1,this.fd=!1,this.pd=0,this.gd=!1,this.md=!1,this.yd=!1,this.bd=!1,this._d=0,this.wd=!1,this.rn=()=>{let e=this.kd();this._d=0,e&&this.reloadFeatureFlags()},this.Sd=()=>{var e,t;let i=this.xd,s=null!=(e=this.Cd)?e:i;V(i)||V(s)||this.Ir.remoteRequestsDisabled||!f||"hidden"===f.visibilityState||Date.now()-(null!=(t=this.$d)?t:0)<s||(this.Cd=this.wd||!this.Ir.idleRefreshBackoff?i:Math.min(2*s,36e5),this.wd=!1,this.reloadFeatureFlags(),this.Td())},this.Id=()=>{this.wd&&this.Cd===this.xd||this.Md()},this.sn=()=>{"visible"===(null==f?void 0:f.visibilityState)&&this.Md()},"get"in e?this.wo=e:(this._instance=e,this.Ed=new ll(e.config,e.il()),this.wo=this.Ed)}updateConfig(e,t){var i;null==(i=this.Ed)||i.update(e,t),this.bo&&this.Pd()}setup(e){return this.Nh=e,this.A=e.logger.createLogger("[FeatureFlags]"),a5(e.kv.initialize(),()=>{this.Nh===e&&(this.Nh=void 0,this.bo=e,this.Rd(e))})}Rd(e){var t;if(this.bo===e)return c&&sK(c,"online",this.rn),this.Pd(),this.Ad=e.registerDynamicEventProperties(()=>this.Fd()?this.ud:this.hd),this.Od=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.onCrossTabFeatureFlagChange(()=>{this.Dd(),this.Ld(),this.Nd()}),this.Ld(),this.initialize()}Md(){this.wd=!0,this.Cd=this.xd,this.Sd()}Pd(){let e=this.Ir.refreshIntervalMs,t=!this.Ir.remoteRequestsDisabled&&f&&!V(e)&&e>0?e:void 0;this.Ir.idleRefreshBackoff||(this.Cd=t),t!==this.xd&&(this.qd(),V(t)||(this.xd=t,this.Cd=t,this.Td(),(null==f?void 0:f.addEventListener)&&(sK(f,sM,this.sn),sU(lp,e=>{sK(f,e,this.Id,{capture:!0})}))))}Td(){V(this.xd)||(V(this.jd)||clearInterval(this.jd),this.$d=Date.now(),this.jd=setInterval(this.Sd,this.xd))}qd(){var e;V(this.jd)||(clearInterval(this.jd),this.jd=void 0,null==f||null==(e=f.removeEventListener)||e.call(f,"visibilitychange",this.sn),sU(lp,e=>{var t;null==f||null==(t=f.removeEventListener)||t.call(f,e,this.Id,{capture:!0})})),this.xd=void 0,this.Cd=void 0,this.wd=!1,this.$d=void 0}destroy(){this.Bd()}dispose(){this.Bd()}Bd(){var e,t;this.qd(),this.pd++,this.md=!1,this.Nh=void 0,this.bo&&(this.Hd(),null==(e=this.Ad)||e.dispose(),this.Ad=void 0,null==(t=this.Od)||t.call(this),this.Od=void 0,this.dd=[],null==c||c.removeEventListener("online",this.rn),this.bo=void 0)}get Ir(){return this.wo.get()}zd(e){var t;return this.Ud&&e in this.Ud?this.Ud[e]:null==(t=this.bo)?void 0:t.kv.get(e)}Dd(){return!!this.Ud&&(this.Ud=void 0,!0)}Wd(){var e;return!V(null==(e=this.bo)?void 0:e.kv.get("$enabled_feature_flags"))&&this.Dd()}$t(e){this.Vd(()=>{var t;return null==(t=this.bo)?void 0:t.kv.set(e)})}Gd(e,t,i){var s;if(!(null==(s=this._instance)?void 0:s.persistence)||!e.$enabled_feature_flags)return;let r=this.zd("$enabled_feature_flags")||{},n=e.$enabled_feature_flags||{},o=t.flags||t.featureFlags,a=t.flags?Object.entries(t.flags).filter(([,e])=>!(null==e?void 0:e.failed)).map(([e])=>e):[],l=!!t.errorsWhileComputingFlags&&!!t.flags,u=l?a:i&&!U(o)?Object.keys(o||{}):Array.from(new Set([...Object.keys(r),...Object.keys(n)])),h=this.zd("$feature_flag_payloads")||{},c=e.$feature_flag_payloads||{},d=l||i?u:Array.from(new Set([...Object.keys(h),...Object.keys(c)])),p=!l&&!i,f=!!p||u,g={[i1]:f,[i0]:f,[i5]:!!p||d};for(let t of(e.$feature_flag_details&&(g[i3]=f),[i4,sc,i6]))V(e[t])||(g[t]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(g)}Lt(e){this.Vd(()=>{var t;return null==(t=this.bo)?void 0:t.kv.remove(e)})}Vd(e){try{e()}catch(e){this.A.error("Failed to update feature flag persistence",e)}}Ld(){let e={};for(let t of[i1,i5,i4,i8]){let i=this.zd(t);V(i)||(e[t]=i)}this.ud=e;let t=tE({},e),i=this.zd(i0);if(i)for(let[e,s]of Object.entries(i))t[`$feature/${e}`]=s;this.hd=t}Fd(){let e=this.Ir.cacheTtlMs;
2if(!e||0>=e)return!1;let t=this.zd(sc);return"number"!=typeof t||Date.now()-t>e}Zd(){return!!this.Fd()&&(this.bd||this.fd||(this.bd=!0,this.A.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Qd(){let e=this.Ir.evaluationContexts;return(null==e?void 0:e.length)?e.filter(e=>{let t=e&&"string"==typeof e&&e.trim().length>0;return t||this.A.error("Invalid evaluation context found:",e,"Expected non-empty string"),t}):[]}Jd(){let e=this.Ir.flagKeys;if(!V(e))return e.filter(e=>{let t=e&&"string"==typeof e&&e.trim().length>0;return t||this.A.error("Invalid flag key found:",e,"Expected non-empty string"),t})}initialize(){var e,t,i,s;let r=this.Ir,n=null!=(e=null==(t=r.bootstrap)?void 0:t.featureFlags)?e:{};if(Object.keys(n).length){let e=null!=(i=null==(s=r.bootstrap)?void 0:s.featureFlagPayloads)?i:{},t=Object.keys(n).filter(e=>!V(n[e])).reduce((e,t)=>(e[t]=n[t],e),{}),o=Object.keys(e).filter(e=>t[e]).reduce((t,i)=>(t[i]=e[i],t),{});return this.Kd({featureFlags:t,featureFlagPayloads:o},void 0,{persist:!1})}}updateFlags(e,t,i){var s,r;let n=(null==i?void 0:i.merge)&&null!=(s=this.zd("$enabled_feature_flags"))?s:{},o=(null==i?void 0:i.merge)&&null!=(r=this.zd("$feature_flag_payloads"))?r:{},a=tE(tE({},n),e),l=tE(tE({},o),t),u={};for(let[e,t]of Object.entries(a))u[e]={key:e,enabled:t3(t),variant:t5(t),reason:void 0,metadata:V(null==l?void 0:l[e])?void 0:{id:0,version:void 0,description:void 0,payload:l[e]}};this.Kd({flags:u})}get hasLoadedFlags(){return this.vd}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){let e=this.zd(i3),t=this.zd(i8),i=this.zd(i9);if(!i&&!t)return e||{};let s=sH({},e||{});for(let e of[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])]){var r,n;let o=s[e],a=null==t?void 0:t[e],l=V(a)?null!=(r=null==o?void 0:o.enabled)&&r:!!a,u=V(a)?null==o?void 0:o.variant:"string"==typeof a?a:void 0,h=null==i?void 0:i[e],c=tE(tE({},o),{},{enabled:l,variant:l?null!=u?u:null==o?void 0:o.variant:void 0});l!==(null==o?void 0:o.enabled)&&(c.original_enabled=null==o?void 0:o.enabled),u!==(null==o?void 0:o.variant)&&(c.original_variant=null==o?void 0:o.variant),h&&(c.metadata=tE(tE({},null==o?void 0:o.metadata),{},{payload:h,original_payload:null==o||null==(n=o.metadata)?void 0:n.payload})),s[e]=c}return this.ld||(this.A.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:s}),this.ld=!0),s}getAllFeatureFlags(){let e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map(i=>{let s=e[i];return{key:i,enabled:t3(s),variant:t5(s),payload:t2(t[i])}})}getFlagVariants(){let e=this.zd(i0),t=this.zd(i8);if(!t)return e||{};let i=sH({},e||{}),s=Object.keys(t);for(let e=0;s.length>e;e++)i[s[e]]=t[s[e]];return this.ld||(this.A.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this.ld=!0),i}getFlagPayloads(){let e=this.zd(i5),t=this.zd(i9);if(!t)return e||{};let i=sH({},e||{}),s=Object.keys(t);for(let e=0;s.length>e;e++)i[s[e]]=t[s[e]];return this.ld||(this.A.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this.ld=!0),i}reloadFeatureFlags(){this.gd||this.Ir.featureFlagsDisabled||this.kd()||(this.fd&&(this.md=!0),this.Xd||(this.dd.slice().forEach(e=>{try{e()}catch(e){this.A.error("Error while running feature flags reloading callback",e)}}),this.Xd=setTimeout(()=>{this.Yd()},5)))}Hd(){clearTimeout(this.Xd),this.Xd=void 0}onReloading(e){return this.dd.push(e),()=>{this.dd=this.dd.filter(t=>t!==e)}}ensureFlagsLoaded(){this.vd||this.fd||this.Xd||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.gd=e}resetFlagCallReported(){this.Lt(sl)}Yd(e){this.Hd();let t=this.bo;if(!t||this.Ir.remoteRequestsDisabled||this.kd())return;if(this.fd)return void(this.md=!0);let i={token:t.projectToken,distinct_id:t.distinctId,groups:t.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:tE(tE(tE({},t.initialPersonProperties),this.zd("$stored_person_properties")||{}),{},{$lib:t.library.name,$lib_version:t.library.version}),group_properties:this.zd(se),timezone:ny()};V(t.deviceId)||(i.$device_id=t.deviceId),((null==e?void 0:e.disableFlags)||this.Ir.featureFlagsDisabled)&&(i.disable_flags=!0);let s=this.Qd();s.length&&(i.evaluation_contexts=s);let r=this.Jd();V(r)||(i.flag_keys=r);let n=this.Ir.onlyEvaluateSurveyFeatureFlags,o="/flags/?v=2"+(n?"&only_evaluate_survey_feature_flags=true":""),a=this.pd;this.fd=!0;let l=()=>{this.md&&(this.md=!1,this.Yd())},u=e=>{var t,s;let r=null!=(t=e.json)?t:{},o=200!==e.statusCode;if(this.fd=!1,a!==this.pd)return void l();if(this.tv(e.statusCode),o||this.md||(this.$anon_distinct_id=void 0),i.disable_flags&&!this.md)return;this.yd=!o;let u=[];e.error?u.push(e.error instanceof Error&&"AbortError"===e.error.name?"timeout":e.error instanceof Error?lf:"unknown_error"):200!==e.statusCode&&u.push(`api_error_${e.statusCode}`),r.errorsWhileComputingFlags&&u.push("errors_while_computing_flags");let h=!!(null==(s=r.quotaLimited)?void 0:s.includes("feature_flags"));h&&u.push("quota_limited"),this.$t({[sh]:u}),h?this.A.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."):i.disable_flags||this.Kd(r,o,{partialResponse:n}),l()},h=e=>{this.fd=!1,a===this.pd&&(this.$t({[sh]:[lf]}),this.A.error("Feature flag request failed",e),this.Wd()&&this.Nd(!0)),l()},c=this.Ir.requestMaxRetries,d=()=>c>0&&a===this.pd,p=()=>
2{if(a!==this.pd||!this.bo||this.Ir.remoteRequestsDisabled)return this.fd=!1,void l();try{t.sendRequest(o,{target:"flags",method:"POST",body:i,compression:this.Ir.compression,sentAt:"body",timeoutMs:this.Ir.requestTimeoutMs}).then(e=>{(ld.includes(e.statusCode)||0===e.statusCode&&e.error instanceof Error&&"AbortError"===e.error.name)&&d()?(c--,setTimeout(p,500)):u(e)}).catch(h)}catch(e){h(e)}};p()}kd(){return nn(this._d,3)}tv(e){this._d=no(e,this._d,3,()=>this.A.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={}){var i;if(t.fresh&&!this.yd)return;if(!(this.vd||this.getFlags()&&this.getFlags().length>0))return void this.A.warn('getFeatureFlag for key "'+e+lc);if(this.Zd())return;let s=this.getFeatureFlagResult(e,t);return null!=(i=null==s?void 0:s.variant)?i:null==s?void 0:s.enabled}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){let t=this.getFeatureFlagResult(e,{send_event:!1});return null==t?void 0:t.payload}getFeatureFlagResult(e,t={}){var i,s,r,n,o,a,l,u,h,c,d,p,f,g;if(t.fresh&&!this.yd)return;if(!(this.vd||this.getFlags()&&this.getFlags().length>0))return void this.A.warn('getFeatureFlagResult for key "'+e+lc);if(this.Zd())return;let _=this.getFlagVariants(),v=e in _,m=_[e],y=this.getFlagPayloads()[e],b=String(m),w=this.zd("$feature_flag_request_id")||void 0,E=this.zd("$feature_flag_evaluated_at")||void 0,x,k=this.zd("$flag_call_reported")||{};if(this.Ir.deduplicateCallsPerSession){let e=null==(i=this.bo)?void 0:i.session.sessionId,t=this.zd(su);e&&e!==t&&(k={},x=e)}if(!t.send_event&&"send_event"in t)x&&this.$t({[sl]:k,[su]:x});else if(e in k&&k[e].includes(b))x&&this.$t({[sl]:k,[su]:x});else{U(k[e])?k[e].push(b):k[e]=[b],this.$t(tE({[sl]:k},x?{[su]:x}:{}));let t=this.getFeatureFlagDetails(e),i=[...null!=(s=this.zd("$feature_flag_errors"))?s:[]];V(m)&&i.push("flag_missing");let _={$feature_flag:e,$feature_flag_response:m,$feature_flag_payload:null!=y?y:null,$feature_flag_request_id:w,$feature_flag_evaluated_at:E,$feature_flag_bootstrapped_response:null!=(r=null==(n=this.Ir.bootstrap)||null==(n=n.featureFlags)?void 0:n[e])?r:null,$feature_flag_bootstrapped_payload:null!=(o=null==(a=this.Ir.bootstrap)||null==(a=a.featureFlagPayloads)?void 0:a[e])?o:null,$used_bootstrap_value:!this.yd};V(null==t||null==(l=t.metadata)?void 0:l.has_experiment)||(_.$feature_flag_has_experiment=t.metadata.has_experiment),V(null==t||null==(u=t.metadata)?void 0:u.version)||(_.$feature_flag_version=t.metadata.version);let v=null!=(h=null==t||null==(c=t.reason)?void 0:c.description)?h:null==t||null==(d=t.reason)?void 0:d.code;v&&(_.$feature_flag_reason=v),(null==t||null==(p=t.metadata)?void 0:p.id)&&(_.$feature_flag_id=t.metadata.id),V(null==t?void 0:t.original_variant)&&V(null==t?void 0:t.original_enabled)||(_.$feature_flag_original_response=V(t.original_variant)?t.original_enabled:t.original_variant),(null==t||null==(f=t.metadata)?void 0:f.original_payload)&&(_.$feature_flag_original_payload=null==t||null==(g=t.metadata)?void 0:g.original_payload),i.length&&(_.$feature_flag_error=i.join(",")),this.ev(_)}return v?{key:e,enabled:!!m,variant:"string"==typeof m?m:void 0,payload:t2(y)}:void 0}ev(e){try{var t;null==(t=this.bo)||t.capture("$feature_flag_called",e)}catch(e){this.A.error("Failed to capture feature flag call",e)}}getRemoteConfigPayload(e,t){this.iv(e,t)}iv(e,t){var i=this;return eu(function*(){let s,r=i.bo;if(!r)return;let n={distinct_id:r.distinctId,token:r.projectToken,person_properties:{$lib:r.library.name,$lib_version:r.library.version}},o=i.Qd();o.length&&(n.evaluation_contexts=o);let a=i.Jd();V(a)||(n.flag_keys=a);try{var l;let t=null==(l=(yield r.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:n,compression:i.Ir.compression,sentAt:"body",timeoutMs:i.Ir.requestTimeoutMs})).json)?void 0:l.featureFlagPayloads;s=(null==t?void 0:t[e])||void 0}catch(e){return void i.A.error("Remote config feature flag request failed",e)}try{t(s)}catch(e){i.A.error("Remote config feature flag callback failed",e)}})()}isFeatureEnabled(e,t={}){if(t.fresh&&!this.yd)return t.defaultValue;if(!(this.vd||this.getFlags()&&this.getFlags().length>0))return this.A.warn('isFeatureEnabled for key "'+e+lc),t.defaultValue;let i=this.getFeatureFlag(e,t);return V(i)?t.defaultValue:!!i}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t,i){this.Kd(e,t,i)}Kd(e,t,i){if(!this.bo)return;this.vd=!0;let s=((e,t={},i={},s={},r,n=lu)=>{let o=((e,t)=>{let i=e.flags;if(i){let t=Object.fromEntries(Object.keys(i).map(e=>{var t;return[e,null!=(t=i[e].variant)?t:i[e].enabled]})),s=Object.fromEntries(Object.keys(i).filter(e=>i[e].enabled).filter(e=>{var t;return!V(null==(t=i[e].metadata)?void 0:t.payload)}).map(e=>{var t;return[e,null==(t=i[e].metadata)?void 0:t.payload]}));return tE(tE({},e),{},{featureFlags:t,featureFlagPayloads:s})}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,n),a=o.flags,l=o.featureFlags,u=o.featureFlagPayloads;if(!l)return;let h=e.requestId,c=e.evaluatedAt;if(U(l)){n.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");let e={};if(l)for(let t=0;l.length>t;t++)e[l[t]]=!0;return{[i1]:l,[i0]:e,[i6]:!1}}let d=l,p=u,f=a;if(null==r?void 0:r.partialResponse){let e=Object.keys(d),r=p||{};d=tE(tE({},t),d),p=tE(tE({}
2,i),r),e.forEach(e=>{e in r||null==p||delete p[e]}),f=tE(tE({},s),f)}else if(e.errorsWhileComputingFlags)if(a){let e=new Set(Object.keys(a).filter(e=>{var t;return!(null==(t=a[e])?void 0:t.failed)}));d=tE(tE({},t),Object.fromEntries(Object.entries(d).filter(([t])=>e.has(t))));let r=Object.fromEntries(Object.entries(p||{}).filter(([t])=>e.has(t)));p=tE(tE({},i),r),e.forEach(e=>{e in r||null==p||delete p[e]}),f=tE(tE({},s),Object.fromEntries(Object.entries(f||{}).filter(([t])=>e.has(t))))}else d=tE(tE({},t),d),p=tE(tE({},i),p),f=tE(tE({},s),f);return tE(tE({[i1]:Object.keys(l_(d)),[i0]:d||{},[i5]:p||{},[i3]:f||{},[i6]:!0===e.minimalFlagCalledEvents},h?{[i4]:h}:{}),c?{[sc]:c}:{})})(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),i,this.A);if(s)if(!1===(null==i?void 0:i.persist)){let e=!V(this.bo.kv.get(i0));this.Ud=s,e||this.$t(s)}else this.Dd(),this.Gd(s,e,!!(null==i?void 0:i.partialResponse)),this.$t(s);else t&&this.Wd();t||(this.bd=!1),this.Nd(t)}override(e,t=!1){this.A.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){this.nv(e)}nv(e){if(this.bo){if(!1===e)return this.Lt([i8,i9]),this.Nd(),void lh.info("All overrides cleared");if(U(e))return this.$t({[i8]:lg(e)}),this.Nd(),void lh.info("Flag overrides set",{flags:e});if(e&&"object"==typeof e&&("flags"in e||"payloads"in e)){var t;this.ld=!!(null!=(t=e.suppressWarning)&&t);let i={},s=e.flags,r=e.payloads;return s&&(i[i8]=U(s)?lg(s):s),r&&(i[i9]=r),Object.keys(i).length&&this.$t(i),!1===s&&!1===r?this.Lt([i8,i9]):!1===s?this.Lt(i8):!1===r&&this.Lt(i9),this.Nd(),!1===s?lh.info("Flag overrides cleared"):s&&lh.info("Flag overrides set",{flags:s}),void(!1===r?lh.info("Payload overrides cleared"):r&&lh.info("Payload overrides set",{payloads:r}))}if(e&&"object"==typeof e)return this.$t({[i8]:e}),this.Nd(),void lh.info("Flag overrides set",{flags:e});this.A.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}else this.A.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.vd){let{flags:t,flagVariants:i}=this.sv();try{e(t,i)}catch(e){this.A.error("Error while running feature flags callback",e)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var s,r;let n=(this.zd("$early_access_features")||[]).find(t=>t.flagKey===e),o={[`$feature_enrollment/${e}`]:t},a={$feature_flag:e,$feature_enrollment:t,$set:o};n&&(a.$early_access_feature_name=n.name),i&&(a.$feature_enrollment_stage=i);let l=tE(tE({},this.getFlagVariants()),{},{[e]:t});null==(s=this._instance)||null==(s=s.persistence)||s.markCrossTabFeatureFlagChanges({$active_feature_flags:[e],$enabled_feature_flags:[e],$stored_person_properties:Object.keys(o)}),this.$t({[i1]:Object.keys(l_(l)),[i0]:l,[i7]:tE(tE({},this.zd("$stored_person_properties")||{}),o)}),this.Nd();try{null==(r=this.bo)||r.capture("$feature_enrollment_update",a)}catch(e){this.A.error("Failed to capture early access feature enrollment",e)}}getEarlyAccessFeatures(e,t=!1,i){let s=this.zd(i2);!s||t?this.rv(e,i):e(s)}rv(e,t){var i=this;return eu(function*(){let s,r=i.bo;if(!r)return;let n=t?`&${t.map(e=>`stage=${e}`).join("&")}`:"";try{let e=yield r.sendRequest(`/api/early_access_features/?token=${r.projectToken}${n}`,{target:"api",method:"GET",sentAt:"query"});if(!e.json)return;s=e.json.earlyAccessFeatures,i.$t({[i2]:s})}catch(e){return void i.A.error("Early access feature request failed",e)}try{e(s)}catch(e){i.A.error("Early access feature callback failed",e)}})()}sv(){let e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(e=>t[e]),flagVariants:Object.keys(t).filter(e=>t[e]).reduce((e,i)=>(e[i]=t[i],e),{})}}Nd(e){this.Ld();let{flags:t,flagVariants:i}=this.sv();this.featureFlagEventHandlers.forEach(s=>{try{s(t,i,{errorsLoading:e})}catch(e){this.A.error("Error while running feature flags callback",e)}})}setPersonPropertiesForFlags(e,t=!0){this.ov(e,t)}ov(e,t=!0){let i=this.zd("$stored_person_properties")||{},s=(null==e?void 0:e.$set)||((null==e?void 0:e.$set_once)?{}:e),r=null==e?void 0:e.$set_once,n={};if(r)for(let e in r)({}).hasOwnProperty.call(r,e)&&(e in i||(n[e]=r[e]));this.$t({[i7]:tE(tE(tE({},i),n),s)}),t&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t=!0){let i=tE({},this.zd("$stored_person_properties")||{});
2e.forEach(e=>{delete i[e]}),this.$t({[i7]:i}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e=!0){this.Lt(i7),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t=!0){let i=this.zd("$stored_group_properties")||{},s=tE({},i);for(let t of Object.keys(e))s[t]=tE(tE({},i[t]),e[t]);this.$t({[se]:s}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){let t=this.zd("$stored_group_properties")||{};this.$t({[se]:tE(tE({},t),{},{[e]:{}})})}else this.Lt(se)}reset(){this.pd++,this.md=!1,this.ud={},this.hd={},this.Ud=void 0,this.vd=!1,this.gd=!1,this.yd=!1,this.$anon_distinct_id=void 0,this.Hd(),this.ld=!1,this._d=0}}},lq=tE({productTours:class{get Il(){return this._instance.persistence}constructor(e){this.Cf=null,this.$f=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!e.ok)return;let t=e.config;if("productTours"in t){var i,s;if(this.Il&&this.Il.register({[iJ]:!!t.productTours}),!a0(this._instance))return!this.Cf&&K(null==(i=this.Il)?void 0:i.props.ph_product_tours)||aZ.info("product tours disabled; stopping and clearing cached tours"),null==(s=this.Cf)||s.stop(),this.Cf=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.Cf&&a0(this._instance)&&this.Ho(()=>this.Tf())}Ho(e){var t,i,s;(null==(t=x.__PosthogExtensions__)?void 0:t.generateProductTours)?e():null==(i=x.__PosthogExtensions__)||null==(s=i.loadExternalDependency)||s.call(i,this._instance,"product-tours",t=>{t?aZ.error("Could not load product tours script",t):e()})}Tf(){var e;!this.Cf&&(null==(e=x.__PosthogExtensions__)?void 0:e.generateProductTours)&&(this.Cf=x.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t=!1){if(U(this.$f)&&!t)return void e(this.$f,{isLoaded:!0});let i=this.Il;if(i){let s=i.props[sa];if(U(s)&&!t)return this.$f=s,void e(s,{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(!a0(this._instance))return void e([],{isLoaded:!0});let s=t.statusCode;if(200!==s||!t.json){let i=`Product Tours API could not be loaded, status: ${s}`;return 0===s?t.error||aZ.warn(i):aZ.error(i),void e([],{isLoaded:!1,error:i})}let r=U(t.json.product_tours)?t.json.product_tours:[];this.$f=r,i&&i.register({[sa]:r}),e(r,{isLoaded:!0})}})}getActiveProductTours(e){K(this.Cf)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.Cf.getActiveProductTours(e)}showProductTour(e){var t;null==(t=this.Cf)||t.showTourById(e)}previewTour(e){this.Cf?this.Cf.previewTour(e):this.Ho(()=>{var t;this.Tf(),null==(t=this.Cf)||t.previewTour(e)})}dismissProductTour(){var e;null==(e=this.Cf)||e.dismissTour("user_clicked_skip")}nextStep(){var e;null==(e=this.Cf)||e.nextStep()}previousStep(){var e;null==(e=this.Cf)||e.previousStep()}clearCache(){var e;this.$f=null,null==(e=this.Il)||e.unregister("ph_product_tours")}resetTour(e){var t;null==(t=this.Cf)||t.resetTour(e)}resetAllTours(){var e;null==(e=this.Cf)||e.resetAllTours()}cancelPendingTour(e){var t;null==(t=this.Cf)||t.cancelPendingTour(e)}}},lU),lH=tE({surveys:class extends a8{constructor(e){super(new ls(e),{get projectToken(){return e.config.token},kv:new li(e)}),this._instance=e}Vh(e,t){let i=t.query?oP(e,t.query):e;return new Promise(e=>{var s;this._instance._send_request({method:t.method,url:this._instance.requestRouter.endpointFor(null!=(s=t.target)?s:"api",i),data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,timestampMode:t.sentAt,callback:e})})}}},lU),lz=tE({experiments:class e{get Ir(){return this._instance.config}constructor(t){this._instance=t,this.getWebExperimentsAndEvaluateDisplayLogic=(t=!1)=>{this.getWebExperiments(t=>{e.Zf("retrieved web experiments from the server"),this.Qf=new Map,t.forEach(t=>{if(t.feature_flag_key){var i;this.Qf&&(e.Zf("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(i=this.Qf)||i.set(t.feature_flag_key,t));
2let s=this._instance.getFeatureFlag(t.feature_flag_key);W(s)&&t.variants[s]&&this.Jf(t.name,s,t.variants[s].transforms)}else if(t.variants)for(let i in t.variants){let s=t.variants[i];e.Kf(s,this._instance)&&this.Jf(t.name,i,s.transforms)}})},t)},this._instance.onFeatureFlags(e=>{this.onFeatureFlags(e)})}initialize(){}onFeatureFlags(t){if(this._is_bot())e.Zf(lx);else if(!this.Ir.disable_web_experiments){if(K(this.Qf))return this.Qf=new Map,this.loadIfEnabled(),void this.previewWebExperiment();e.Zf("applying feature flags",t),t.forEach(e=>{var t,i;if(this.Qf&&(null==(t=this.Qf)?void 0:t.has(e))){let t=this._instance.getFeatureFlag(e),s=null==(i=this.Qf)?void 0:i.get(e);t&&(null==s?void 0:s.variants[t])&&this.Jf(s.name,t,s.variants[t].transforms)}})}}previewWebExperiment(){let t=e.getWindowLocation();if(null==t?void 0:t.search){let i=ni(null==t?void 0:t.search,"__experiment_id"),s=ni(null==t?void 0:t.search,"__experiment_variant");i&&s&&(e.Zf(`previewing web experiments ${i} && ${s}`),this.getWebExperiments(e=>{this.Xf(parseInt(i),s,e)},!1,!0))}}loadIfEnabled(){this.Ir.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,i){if(this.Ir.disable_web_experiments&&!i)return e([]);let s=this._instance.get_property("$web_experiments");if(s&&!t)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/web_experiments/?token=${this.Ir.token}`),method:"GET",timestampMode:"query",callback:t=>e(200===t.statusCode&&t.json&&t.json.experiments||[])})}Xf(t,i,s){let r=s.filter(e=>e.id===t);r&&r.length>0&&(e.Zf(`Previewing web experiment [${r[0].name}] with variant [${i}]`),this.Jf(r[0].name,i,r[0].variants[i].transforms))}static Kf(t,i){return!K(t.conditions)&&e.Yf(t,i)&&e.tp(t)}static Yf(t,i){var s,r,n,o;if(K(t.conditions)||K(null==(s=t.conditions)?void 0:s.url))return!0;let a=e.getWindowLocation();if(a){let e=rf(i,a.href);return!(null==(r=t.conditions)?void 0:r.url)||lk[null!=(n=null==(o=t.conditions)?void 0:o.urlMatchType)?n:"icontains"](t.conditions.url,e)}return!1}
2static getWindowLocation(){return null==c?void 0:c.location}static tp(e){var t,i,s,r,n,o,a,l,u;if(K(e.conditions)||K(null==(t=e.conditions)?void 0:t.utm))return!0;let h=nc();if(h.utm_source){let t=!(null==(i=e.conditions)||null==(i=i.utm)?void 0:i.utm_campaign)||(null==(s=e.conditions)||null==(s=s.utm)?void 0:s.utm_campaign)==h.utm_campaign,c=!(null==(r=e.conditions)||null==(r=r.utm)?void 0:r.utm_source)||(null==(n=e.conditions)||null==(n=n.utm)?void 0:n.utm_source)==h.utm_source,d=!(null==(o=e.conditions)||null==(o=o.utm)?void 0:o.utm_medium)||(null==(a=e.conditions)||null==(a=a.utm)?void 0:a.utm_medium)==h.utm_medium,p=!(null==(l=e.conditions)||null==(l=l.utm)?void 0:l.utm_term)||(null==(u=e.conditions)||null==(u=u.utm)?void 0:u.utm_term)==h.utm_term;return t&&d&&p&&c}return!1}static Zf(e,...t){iS.info(`[WebExperiments] ${e}`,t)}Jf(t,i,s){this._is_bot()?e.Zf(lx):"control"!==i?s.forEach(s=>{if(s.selector){var r;e.Zf(`applying transform of variant ${i} for experiment ${t} `,s);let n=null==(r=document)?void 0:r.querySelectorAll(s.selector);null==n||n.forEach(e=>{s.html&&(e.innerHTML=s.html),s.css&&e.setAttribute("style",s.css)})}}):e.Zf("Control variants leave the page unmodified.")}_is_bot(){return p&&this._instance?oQ(p,this.Ir.custom_blocked_useragents):void 0}}},lU);aC.__defaultExtensionClasses=tE({},tE(tE(tE(tE(tE(tE(tE(tE(tE(tE(tE(tE(tE({},lU),{sessionRecording:class{get Ir(){return this._instance.config}get Il(){return this._instance.persistence}get started(){var e;return!!(null==(e=this.av)?void 0:e.isStarted)}get status(){var e,t;return"awaiting_config"===this.lv||"missing_config"===this.lv?this.lv:null!=(e=null==(t=this.av)?void 0:t.status)?e:this.lv}constructor(e){if(this._instance=e,this._forceAllowLocalhostNetworkCapture=!1,this.lv=aG,this.uv=void 0,this.hv=!1,this.Je=(()=>{var e,t;if(!(null==f?void 0:f.visibilityState)||"visible"===f.visibilityState)return!0;let i=null==c||null==(e=c.performance)||null==(t=e.getEntriesByType)?void 0:t.call(e,"visibility-state");return!(null==i?void 0:i.length)||i.some(e=>"visible"===e.name)})(),this.sn=()=>{var e,t;"visible"===(null==f?void 0:f.visibilityState)&&(this.Je=!0,null==(e=this.av)||null==(t=e.setDocumentWasEverVisible)||t.call(e,!0))},!this._instance.sessionManager)throw aK.error("started without valid sessionManager"),Error("[SessionRecording] started without valid sessionManager. This is a bug.");if("always"===this.Ir.cookieless_mode)throw Error('[SessionRecording] cannot be used with cookieless_mode="always"');(null==f?void 0:f.addEventListener)&&sK(f,"visibilitychange",this.sn)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:e=!1}={}){var t;this.hv=!0,null==f||null==(t=f.removeEventListener)||t.call(f,"visibilitychange",this.sn),e?this.dv(!0):this.stopRecording()}get vv(){var e;let t=!!(null==(e=this._instance.get_property("$session_recording_remote_config"))?void 0:e.enabled),i=!this.Ir.disable_session_recording,s=this.Ir.disable_session_recording||this._instance.consent.isOptedOut();return c&&t&&i&&!s}startIfEnabledOrStop(e){var t;if(this.hv||this.vv&&(null==(t=this.av)?void 0:t.isStarted))return;let i=!V(Object.assign)&&!V(Array.from);this.vv&&i?(this.fv(e),aK.info("starting")):(this.lv=aG,this.stopRecording())}fv(e){var t,i,s,r;if(this.vv)if("awaiting_config"!==this.lv&&"missing_config"!==this.lv&&(this.lv=aJ),(null==x||null==(t=x.__PosthogExtensions__)||null==(t=t.rrweb)?void 0:t.record)&&(null==(i=x.__PosthogExtensions__)?void 0:i.initSessionRecording))this.pv(e);else{let t=this._instance.sessionManager;null==(s=x.__PosthogExtensions__)||null==(r=s.loadExternalDependency)||r.call(s,this._instance,this.gv,i=>{if(!this.hv&&this.vv&&this._instance.sessionManager===t)return i?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),aK.error("could not load recorder",i)):void this.pv(e);this.lv="disabled"})}}stopRecording(){var e,t;null==(e=this.uv)||e.call(this),this.uv=void 0,null==(t=this.av)||t.stop()}dv(e=!1){var t,i;null==(t=this.uv)||t.call(this),this.uv=void 0,null==(i=this.av)||i.discard({discardProducerEvents:e})}mv(){var e,t;null==(e=this.Il)||e.unregister("$session_is_sampled"),null==(t=this.Il)||t.unregister("$replay_sample_rate")}yv(e,t){if(K(e))return null;let i=Y(e)?e:parseFloat(e);return"number"!=typeof i||!Number.isFinite(i)||0>i||i>1?(aK.warn(`${t} must be between 0 and 1. Ignoring invalid value:`,e),null):i}bv(e){if(this.Il){var t,i;let s=this.Il,r=()=>{var t;let i=!1===e.sessionRecording?void 0:e.sessionRecording,r=this.yv(null==(t=this.Ir.session_recording)?void 0:t.sampleRate,"session_recording.sampleRate"),n=this.yv(null==i?void 0:i.sampleRate,"remote config sampleRate"),o=null!=r?r:n;K(o)&&this.mv();let a=null==i?void 0:i.minimumDurationMilliseconds;s.register({[iX]:tE(tE({cache_timestamp:Date.now(),enabled:!!i},i),{},{networkPayloadCapture:tE({capturePerformance:e.capturePerformance},null==i?void 0:i.networkPayloadCapture),canvasRecording:{enabled:null==i?void 0:i.recordCanvas,fps:null==i?void 0:i.canvasFps,quality:null==i?void 0:i.canvasQuality},sampleRate:o,minimumDurationMilliseconds:V(a)?null:a,endpoint:null==i?void 0:i.endpoint,triggerMatchType:null==i?void 0:i.triggerMatchType,masking:null==i?void 0:i.masking,urlTriggers:null==i?void 0:i.urlTriggers,version:null==i?void 0:i.version,triggerGroups:null==i?void 0:i.triggerGroups})})};r(),null==(t=this.uv)||t.call(this),this.uv=null==(i=this._instance.sessionManager)?void 0:i.onSessionId(r)}}onRemoteConfig(e){let t=e.ok?e.config:void 0;return t&&"sessionRecording"in t?!1===t.sessionRecording?(this.bv(t),void this.dv()):(this.bv(t),void this.startIfEnabledOrStop()):("awaiting_config"===this.lv&&(this.lv="missing_config",this._instance.register_for_session({[sx]:!0}),aK.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t="log"){var i;(null==(i=this.av)?void 0:i.log)?this.av.log(e,t):aK.warn("log called before recorder was ready")}get gv(){var e,t;let i=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.get_property(iX);return(null==i||null==(t=i.scriptConfig)?void 0:t.script)||"lazy-recorder"}_v(){let e,t=this._instance.get_property(iX);if(!t)return!1;try{e="object"==typeof t?t:JSON.parse(t)}catch(e){return aK.warn("persisted remote config for session recording is invali
2d and will be ignored",e),!1}return!K(e.cache_timestamp)&&36e5>=Date.now()-e.cache_timestamp}pv(e){var t,i,s,r;if(!this.hv&&this.vv&&this._instance.sessionManager){if(!(null==(t=x.__PosthogExtensions__)?void 0:t.initSessionRecording))return aK.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[sE]:!0});if(this.av||(this.av=null==(r=x.__PosthogExtensions__)?void 0:r.initSessionRecording(this._instance,this.Je),this.av._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this._v()){if("missing_config"===this.lv||"awaiting_config"===this.lv)return;return this.lv="awaiting_config",aK.info("persisted remote config is stale, requesting fresh config before starting"),void new nQ(this._instance).load()}this.lv=aJ,null==(i=(s=this.av).setDocumentWasEverVisible)||i.call(s,this.Je),this.av.start(e)}else this.lv=aG}onRRwebEmit(e){var t,i;null==(t=this.av)||null==(i=t.onRRwebEmit)||i.call(t,e)}overrideLinkedFlag(){var e,t;this.av||null==(t=this.Il)||t.register({$replay_override_linked_flag:!0}),null==(e=this.av)||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.av||null==(t=this.Il)||t.register({$replay_override_sampling:!0}),null==(e=this.av)||e.overrideSampling()}overrideTrigger(e){var t,i;this.av||null==(i=this.Il)||i.register({["url"===e?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null==(t=this.av)||t.overrideTrigger(e)}get sdkDebugProperties(){var e,t;let i={};for(let e of aY){let s=null==(t=this._instance.sessionPersistence)?void 0:t.get_property(e);V(s)||(i[e]=s)}return tE(tE({},i),(null==(e=this.av)?void 0:e.sdkDebugProperties)||{$recording_status:this.status})}tryAddCustomEvent(e,t){var i;return!!(null==(i=this.av)?void 0:i.tryAddCustomEvent(e,t))}flushBeforeIdentityReset(){var e,t;null==(e=this.av)||null==(t=e.flushBeforeIdentityReset)||t.call(e)}}}),{autocapture:class extends aL{constructor(e){super(new aD(e)),this.instance=e}},historyAutocapture:class{constructor(e){this.wv=!1,this._instance=e,this.Sv=this.xv()}initialize(){this.startIfEnabled()}get isEnabled(){let e=this.Cv();return!!(e.path||e.search||this.$v(e))}startIfEnabled(){this.isEnabled&&(iS.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.Sv=this.xv(),this.startIfEnabled()}stop(){this.Tv&&this.Tv(),this.Tv=void 0,this.Iv&&this.Iv(),this.Iv=void 0,iS.info("History API monitoring stopped")}monitorHistoryChanges(){c&&c.history&&(this.Mv("pushState"),this.Mv("replaceState"),this.Ev(),this.$v()&&this.Pv())}Mv(e){var t;if(!c||(null==(t=c.history[e])?void 0:t.__posthog_wrapped__))return;let i=this;aU(c.history,e,t=>function(s,r,n){var o;i.Rv(n)&&i.Av(),t.call(this,s,r,n),i.Fv(e,!i.wv&&"popstate"!==(null==c||null==(o=c.event)?void 0:o.type))})}xv(){let e=null==c?void 0:c.location;if(null==e?void 0:e.pathname)return{pathname:e.pathname,search:e.search,hash:e.hash}}Cv(){let e=this._instance.config.capture_pageview;return"history_change"===e?{path:!0}:H(e)?e:{}}$v(e=this.Cv()){return!!e.hash&&!this._instance.config.disable_capture_url_hashes}Ov(e){let t=this.Cv(),i=this.Sv;return!(!i||!(t.path&&e.pathname!==i.pathname||t.search&&e.search!==i.search||this.$v(t)&&e.hash!==i.hash))}Fv(e,t=!1){try{t||this.Av();let i=this.xv();if(!i)return;if(this.Ov(i)){let i=()=>this._instance.capture(sD,{navigation_type:e});t?(this.Dv=i,Promise.resolve().then(()=>this.Av())):i()}this.Sv=i}catch(t){iS.error(`Error capturing ${e} pageview`,t)}}Rv(e){var t,i;return!(K(e)||!c)&&(null==(t=nt(String(e)))?void 0:t.href)!==(null==(i=c.location)?void 0:i.href)}Av(){let e=this.Dv;if(e){this.Dv=void 0,this.wv=!0;try{e()}catch(e){iS.error("Error capturing deferred pageview",e)}finally{this.wv=!1}this.Sv=this.xv()}}Ev(){if(this.Tv)return;let e=()=>{this.Fv("popstate")};sK(c,"popstate",e),this.Tv=()=>{c&&c.removeEventListener("popstate",e)}}Pv(){if(this.Iv)return;let e=()=>{this.Fv("hashchange")};sK(c,"hashchange",e),this.Iv=()=>{c&&c.removeEventListener("hashchange",e)}}},heatmaps:class{get Ir(){return this.instance.config}constructor(e){var t;this.Lv=!1,this.ko=!1,this.Nv=null,this.instance=e,this.Lv=!!(null==(t=this.instance.persistence)?void 0:t.props[iq]),this.rageclicks=new aR(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let e=5e3;return H(this.Ir.capture_heatmaps)&&this.Ir.capture_heatmaps.flush_interval_milliseconds&&(e=this.Ir.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return K(this.Ir.capture_heatmaps)?K(this.Ir.enable_heatmaps)?this.Lv:this.Ir.enable_heatmaps:!1!==this.Ir.capture_heatmaps}startIfEnabled(){if(this.isEnabled)this.ko||(aX.info("starting..."),this.qv(),this.sn());else{var e;clearInterval(null!=(e=this.Nv)?e:void 0),this.jv(),this.getAndClearBuffer()}}onRemoteConfig(e){if(!e.ok)return;let t=e.config;if(!("heatmaps"in t))return;let i=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[iq]:i}),this.Lv=i,this.startIfEnabled()}getAndClearBuffer(){let e=this.Rt;return this.Rt=void 0,e}Bv(e){aQ(e.originalEvent)&&this.Mr(e.originalEvent,"deadclick")}sn(){this.Nv&&clearInterval(this.Nv),this.Nv="visible"===(null==f?void 0:f.visibilityState)?setInterval(this.yl.bind(this),this.flushIntervalMilliseconds):null}qv(){c&&f&&(this.Hv=this.yl.bind(this),sK(c,sL,this.Hv),this.zv=e=>this.Mr(e||(null==c?void 0:c.event)),sK(f,"click",this.zv,{capture:!0}),this.Uv=e=>this.Wv(e||(null==c?void 0:c.event)),sK(f,"mousemove",this.Uv,{capture:!0}),this.Vv=new rZ(this.instance,rX,this.Bv.bind(this)),this.Vv.startIfEnabledOrStop(),this.Gv=this.sn.bind(this),sK(f,sM,this.Gv),this.ko=!0)}jv(){var e;c&&f&&(this.Hv&&c.removeEventListener(sL,this.Hv),this.zv&&f.removeEventListener("click",this.zv,{capture:!0}),this.Uv&&f.removeEventListener("mousemove",this.Uv,{capture:!0}),this.Gv&&f.removeEventListener(sM,this.Gv),clearTimeout(this.Zv),null==(e=this.Vv)||e.stop(),this.ko=!1)}Qv(e,t){let i=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),n=function(e,t,i){let s=e;for(;s&&r_(s)&&!rv(s,"body");){let e;if(s===i)break;try{var r,n,o;e=null==(r=null!=(n=null==(o=s.ownerDocument)?void 0:o.defaultView)?n:c)?void 0:r.getComputedStyle(s).position}catch(e){break}if(A(t,e))return!0;s=rT(s)}return!1}(rS(e),["fixed","sticky"],r);return{x:e.clientX+(n?0:s),y:e.clientY+(n?0:i),target_fixed:n,type:t}}Mr(e,t="click"){var i;if(rg(e.target)||!aQ(e))return;let s=this.Qv(e,t);(null==(i=this.rageclicks)?void 0:i.isRageClick(e.clientX,e.clientY,(new Date).getTime()))&&rL(rS(e),this.instance.config.rageclick)&&this.Zs(tE(tE({},s),{},{type:"rageclick"})),this.Zs(s)}Wv(e){!rg(e.target)&&aQ(e)&&(clearTimeout(this.Zv),this.Zv=setTimeout(()=>{this.Zs(this.Qv(e,"mousemove"))},500))}Zs(e){if(!c)return;let t=this.Ir.disable_capture_url_hashes?tg(c.location.href):c.location.href,i=this.Ir.custom_personal_data_properties,s=ns(t,this.Ir.mask_personal_data_properties?[...na,...i||[]]:[],nu);this.Rt=this.Rt||{},this.Rt[s]||(this.Rt[s]=[]),this.Rt[s].push(e)}yl(){this.Rt&&!z(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:rZ,webVitalsAutocapture:class{constructor(e){var t;this._instance=e,this.Lv=!1,this.ko=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Jv=()=>{clearTimeout(this.Kv),this.Kv=void 0,0!==this.Rt.metrics.length&&(this._instance.capture("$web_vitals",tE({$current_url:this.Rt.url},this.Rt.metrics.reduce((e,t)=>
2tE(tE({},e),{},{[`$web_vitals_${t.name}_event`]:tE({},t),[`$web_vitals_${t.name}_value`]:t.value}),{}))),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Xv=e=>{var t;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},K(null==e?void 0:e.name)||K(null==e?void 0:e.value))return void aH.error("Invalid metric received",e);let i="string"==typeof e.navigationURL?e.navigationURL:void 0,s=this.Yv(i);if(V(s))return;let r=Y(e.navigationId)||"string"==typeof e.navigationId?`navigation:${e.navigationId}`:`url:${s}`;if(this.tf&&e.value>=this.tf)return void aH.error("Ignoring metric with value >= "+this.tf,e);this.Rt.navigationKey!==r&&(this.Jv(),this.Kv=setTimeout(this.Jv,this.flushToCaptureTimeoutMs)),V(this.Rt.navigationKey)&&(this.Rt.navigationKey=r,this.Rt.url=s),this.Rt.firstMetricTimestamp=V(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;let n=null==(t=this._instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0),o=tE(tE(tE({},e),i?{navigationURL:s}:{}),{},{$current_url:s,timestamp:Date.now()});if(delete o.entries,H(e.attribution)&&this.attributionMetrics.indexOf(e.name)>-1){let t={};for(let i of aW){let s="url"===i&&"string"==typeof e.attribution[i]?this.Yv(e.attribution[i]):e.attribution[i];V(s)||(t[i]=s)}o.attribution=t}else delete o.attribution;V(n)||(o.$session_id=n.sessionId,o.$window_id=n.windowId),this.Rt.metrics.push(o),this.Rt.metrics.length===this.allowedMetrics.length&&this.Jv()},this.ef=()=>{if(this.ko)return;let e,t,i,s,r=!1,n=x.__PosthogExtensions__,o=null==n?void 0:n.postHogWebVitalsCallbacksByFlavor,a=(null==o?void 0:o[this.if])||("web-vitals"===this.if&&V(o)?null==n?void 0:n.postHogWebVitalsCallbacks:void 0);if(!V(a)){let n=a.withoutAttribution,o=this.attributionMetrics;r=!V(n),e=o.indexOf("LCP")>-1?a.onLCP:(null==n?void 0:n.onLCP)||a.onLCP,t=o.indexOf("CLS")>-1?a.onCLS:(null==n?void 0:n.onCLS)||a.onCLS,i=o.indexOf("FCP")>-1?a.onFCP:(null==n?void 0:n.onFCP)||a.onFCP,s=o.indexOf("INP")>-1?a.onINP:(null==n?void 0:n.onINP)||a.onINP}if(!(e&&t&&i&&s))return void aH.error("web vitals callbacks not loaded - not starting");let l={reportSoftNavs:this.useSoftNavs},u=r&&this.attributionMetrics.indexOf("INP")>-1?tE(tE({},l),{},{includeProcessedEventEntries:!1}):l;this.allowedMetrics.indexOf("LCP")>-1&&e(this.Xv.bind(this),l),this.allowedMetrics.indexOf("CLS")>-1&&t(this.Xv.bind(this),l),this.allowedMetrics.indexOf("FCP")>-1&&i(this.Xv.bind(this),l),this.allowedMetrics.indexOf("INP")>-1&&s(this.Xv.bind(this),u),this.ko=!0},this.Lv=!!(null==(t=this._instance.persistence)?void 0:t.props[iW]),this.startIfEnabled()}get nf(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t;let i=H(this.nf)?null==(e=this.nf)?void 0:e.web_vitals_allowed_metrics:void 0;return K(i)?(null==(t=this._instance.persistence)?void 0:t.props.$web_vitals_allowed_metrics)||az:i}get flushToCaptureTimeoutMs(){return(H(this.nf)?this.nf.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){let e=H(this.nf)?this.nf.web_vitals_attribution:void 0;return Q(e)?e?az:[]:U(e)?e:aV}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){let e=H(this.nf)?this.nf.__preview_web_vitals_soft_navs:void 0;return null!=e&&e}get tf(){let e=H(this.nf)&&Y(this.nf.__web_vitals_max_value)?this.nf.__web_vitals_max_value:9e5;return e>0&&6e4>=e?9e5:e}get isEnabled(){let e=null==g?void 0:g.protocol;if("http:"!==e&&"https:"!==e)return aH.info("Web Vitals are disabled on non-http/https protocols"),!1;let t=H(this.nf)?this.nf.web_vitals:Q(this.nf)?this.nf:void 0;return Q(t)?t:this.Lv}startIfEnabled(){this.isEnabled&&!this.ko&&(aH.info("enabled, starting..."),this.Ho(this.ef))}onRemoteConfig(e){if(!e.ok)return;let t=e.config;if(!("capturePerformance"in t))return;let i=H(t.capturePerformance)&&!!t.capturePerformance.web_vitals,s=H(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[iW]:i}),this._instance.persistence.register({[iY]:s})),this.Lv=i,this.startIfEnabled()}get if(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}Ho(e){var t;let i=x.__PosthogExtensions__,s=this.if,r=null==i?void 0:i.postHogWebVitalsCallbacksByFlavor;(null==r?void 0:r[s])||"web-vitals"===s&&V(r)&&(null==i?void 0:i.postHogWebVitalsCallbacks)?e():null==i||null==(t=i.loadExternalDependency)||t.call(i,this._instance,s,t=>{t?aH.error("failed to load script",t):e()})}
2Yv(e){let t=e||(null==c?void 0:c.location.href);if(!t)return void aH.error("Could not determine current URL");let i=this._instance.config.disable_capture_url_hashes?tg(t):t,s=this._instance.config.custom_personal_data_properties;return ns(i,this._instance.config.mask_personal_data_properties?[...na,...s||[]]:[],nu)}}}),{exceptionObserver:class{constructor(e){var t;this.ef=()=>{var e;if(!c||!this.isEnabled||!(null==(e=x.__PosthogExtensions__)?void 0:e.errorWrappingFunctions))return;let t=x.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=x.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=x.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.sf&&this.Ir.capture_unhandled_errors&&(this.sf=t(this.captureException.bind(this))),!this.rf&&this.Ir.capture_unhandled_rejections&&(this.rf=i(this.captureException.bind(this))),!this.af&&this.Ir.capture_console_errors&&(this.af=s(this.captureException.bind(this)))}catch(e){aN.error("failed to start",e),this.lf()}},this._instance=e,this.uf=!!(null==(t=this._instance.persistence)?void 0:t.props[iH]),this.wt=new ep(tE(tE({},function(e={}){var t,i,s,r;return{refillRate:null!=(t=null!=(i=e.exceptionRateLimiterRefillRate)?i:e.__exceptionRateLimiterRefillRate)?t:1,bucketSize:null!=(s=null!=(r=e.exceptionRateLimiterBucketSize)?r:e.__exceptionRateLimiterBucketSize)?s:10}}(this._instance.config.error_tracking)),{},{refillInterval:1e4,A:aN})),this.Ir=this.hf(),this.startIfEnabledOrStop()}hf(){let e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return H(e)?t=tE(tE({},t),e):(V(e)?this.uf:e)&&(t=tE(tE({},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?(aN.info("enabled"),this.lf(),this.Ho(this.ef)):this.lf()}Ho(e){var t,i,s;(null==(t=x.__PosthogExtensions__)?void 0:t.errorWrappingFunctions)?e():null==(i=x.__PosthogExtensions__)||null==(s=i.loadExternalDependency)||s.call(i,this._instance,"exception-autocapture",t=>{if(t)return aN.error("failed to load script",t);e()})}lf(){var e,t,i;null==(e=this.sf)||e.call(this),this.sf=void 0,null==(t=this.rf)||t.call(this),this.rf=void 0,null==(i=this.af)||i.call(this),this.af=void 0}onRemoteConfig(e){if(!e.ok)return;let t=e.config;"autocaptureExceptions"in t&&(this.uf=!!t.autocaptureExceptions,this._instance.persistence&&this._instance.persistence.register({[iH]:this.uf}),this.Ir=this.hf(),this.startIfEnabledOrStop())}onConfigChange(){this.Ir=this.hf()}captureException(e){try{var t,i,s;let r=null!=(t=null==e||null==(i=e.$exception_list)||null==(i=i[0])?void 0:i.type)?t:"Exception";if(this.wt.consumeRateLimit(r))return void aN.info("Skipping exception capture because of client rate limiting.",{exception:r});null==(s=this._instance.exceptions)||s.sendExceptionEvent(e)}catch(e){}}},exceptions:class{constructor(e){var t,i;this.cf=[],this.df=new tx([new tj,new tK,new tU,new tB,new tG,new tW,new tH,new tJ],function(e,...t){return(i,s=0)=>{let r=[],n=i.split("\n"),o=Math.min(n.length,s+1e3),a=[];for(let i=s;o>i;i++){let s=n[i];if(s.length>1024)continue;let o=tM.test(s)?s.replace(tM,"$1"):s;if(!o.match(/\S*Error: /)){for(let i of t){let t=i(o,e);if(t){r.push(t);let e=function(e){for(let t=1;10>=t;t++){let i=e.length-2*t;if(0>i)break;let s=!0;for(let r=0;t>r;r++)if(!tL(e[i+r],e[i+t+r])){s=!1;break}if(s){for(let s=0;t>s;s++)e[i+s]=e[i+t+s];return e.length=i+t,{start:i,length:t}}}}(r);if(e){for(let t=a.length-1;t>=0;t--){let i=a[t];if(e.start>=i.start+i.length)break;a.pop()}a.push(e)}break}}if(function(e,t){let i=t[0],s=e.length-(i?tD(e,i):0);for(let i of t)s-=tN(e,i);return s}(r,a)>=50)break}}let l=[...a].sort((e,t)=>t.start-e.start),u=l[l.length-1];if(u){let e=tD(r,u);for(let t of(r.splice(u.start-e,e),l))t.start-=e}for(let e of l)!function(e,t){let i=t.start+t.length,s=tN(e,t);s&&e.splice(i+s===e.length?i:t.start,s)}(r,e);return a.some(e=>0===e.start&&r.length===e.length)&&function(e){let t=e.map(e=>`${e.function}|${e.filename}|${e.lineno}|${e.colno}|${e.module}`),i=0;for(let e=1;t.length>e;e++)(function(e,t,i){for(let s=0;e.length>s;s++){let r=e[(t+s)%e.length],n=e[(i+s)%e.length];if(r!==n)return n>r}return!1}
2)(t,e,i)&&(i=e);e.push(...e.splice(0,i))}(r),function(e){if(!e.length)return[];let t=Array.from(e);return t.reverse(),t.slice(0,50).map(e=>tE(tE({},e),{},{filename:e.filename||(t[t.length-1]||{}).filename,function:e.function||"?"}))}(r)}}("web:javascript",tC,tA)),this._instance=e,this.cf=null!=(t=null==(i=this._instance.persistence)?void 0:i.get_property("$error_tracking_suppression_rules"))?t:[],this.vf=t0(this.ff()),this.pf=new t1(this.vf)}onConfigChange(){this.vf=t0(this.ff()),this.pf.setConfig(this.vf)}onRemoteConfig(e){var t,i,s;if(!e.ok)return;let r=e.config;if(!("errorTracking"in r))return;let n=null!=(t=null==(i=r.errorTracking)?void 0:i.suppressionRules)?t:[],o=null==(s=r.errorTracking)?void 0:s.captureExtensionExceptions;this.cf=n,this._instance.persistence&&this._instance.persistence.register({[iz]:this.cf,[iV]:o})}get gf(){var e;let t=!!this._instance.get_property(iV),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!=(e=null!=i?i:t)&&e}buildProperties(e,t){return this.df.buildFromUnknown(e,{syntheticException:null==t?void 0:t.syntheticException,mechanism:{handled:null==t?void 0:t.handled}})}addExceptionStep(e,t){if(this.vf.enabled)try{if(!W(e)||0===e.trim().length)return void lm.warn("Ignoring exception step because message must be a non-empty string");let{sanitizedProperties:i,droppedKeys:s}=function(e){if(!e)return{sanitizedProperties:{},droppedKeys:[]};let t=[];return{sanitizedProperties:Object.keys(e).reduce((i,s)=>(tQ.has(s)?t.push(s):i[s]=e[s],i),{}),droppedKeys:t}}(this.mf(t));s.length>0&&lm.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this.pf.add(tE({[tY]:e,[tX]:(new Date).toISOString()},i))}catch(e){lm.error("Failed to add exception step. Ignoring breadcrumb.",e)}}sendExceptionEvent(e){try{let t,i=e.$exception_list;if(this.yf(i)){if(this.bf(i))return this._f("Exception dropped: matched a suppression rule"),void lm.info("Skipping exception capture because a suppression rule matched");if(!this.gf&&this.wf(i))return this._f("Exception dropped: thrown by a browser extension"),void lm.info("Skipping exception capture because it was thrown by an extension");if(!this.gf&&this.kf(i))return this._f("Exception dropped: thrown by an injected browser script"),void lm.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Sf(i))return this._f("Exception dropped: thrown by the PostHog SDK"),void lm.info("Skipping exception capture because it was thrown by the PostHog SDK")}let s=this.vf.enabled&&K(e.$exception_steps)?this.xf(e):e,r=(t=globalThis._posthogReleaseId,"string"==typeof t&&t.length>0?t:void 0);r&&(s.$release_id=r);try{let e=this._instance.capture("$exception",s,{_noTruncate:!0,_batchKey:"exceptionEvent",fh:!0});return e&&this.pf.clear(),e}catch(e){return lv(e)||lm.error("Failed to capture exception event. Dropping this exception.",e),void this.pf.clear()}}catch(e){return void(lv(e)||lm.error("Failed to process exception event. Ignoring this exception.",e))}}xf(e){try{let t=this.pf.getAttachable();return 0===t.length?e:tE(tE({},e),{},{$exception_steps:t})}catch(t){return lm.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}_f(e){this.vf.enabled&&this.pf.add({[tY]:e,[tX]:(new Date).toISOString()})}mf(e){return H(e)?tE({},e):{}}ff(){var e,t;return null!=(e=null==(t=this._instance.config.error_tracking)?void 0:t.exception_steps)?e:{}}bf(e){if(0===e.length)return!1;try{let t=e.reduce((e,{type:t,value:i})=>(W(t)&&t.length>0&&e.$exception_types.push(t),W(i)&&i.length>0&&e.$exception_values.push(i),e),{$exception_types:[],$exception_values:[]});return this.cf.some(e=>{let i=e.values.map(e=>{let i=o3[e.operator],s=t[e.key];if(!i||!s)return!1;let r=U(e.value)?e.value:[e.value];return r.length>0&&i(r,s)});return"OR"===e.type?i.some(Boolean):i.every(Boolean)})}catch(e){return lm.warn("Failed to evaluate suppression rules. Capturing the exception.",e),!1}}wf(e){let t=e.flatMap(e=>{var t,i;return null!=(t=null==(i=e.stacktrace)?void 0:i.frames)?t:[]}),i=t.filter(({filename:e})=>!!e&&lw.some(t=>e.startsWith(t)));return 0!==i.length&&(!i.every(({filename:e})=>!!e&&e.startsWith(ly))||e.some(({type:e,value:t})=>"NoResponse"===e||W(t)&&lb.some(({value:e,exact:i})=>i?t===e:t.includes(e)))&&!t.some(({in_app:e,filename:t})=>e&&!(null==t?void 0:t.startsWith(ly))))}kf(e){return e.some(({value:e})=>W(e)&&lE.some(t=>e.includes(t)))}Sf(e){if(e.length>0){var t,i,s,r;let n=null!=(t=null==(i=e[0].stacktrace)?void 0:i.frames)?t:[],o=n[n.length-1];return null!=(s=null==o||null==(r=o.filename)?void 0:r.includes("posthog.com/static"))&&s}return!1}yf(e){return!K(e)&&U(e)}}}),lq),{siteApps:class{constructor(e){this._instance=e,this.If=0,this.Mf=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Ef(e,t){if(!t)return;let i=this.globalsForEvent(t);this.Mf.push(i),this.Mf.length>1e3&&(this.Mf=this.Mf.slice(10))}get siteAppLoaders(){var e;return null==(e=x._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.siteApps}initialize(){if(this.isEnabled){let e=this._instance._addCaptureHook(this.Ef.bind(this));this.Pf=()=>{e(),this.Mf=[],this.Pf=void 0}}}globalsForEvent(e){var t,i,s,r,n,o,a;if(!e)throw Error("Event payload is required");let l={},u=this._instance.get_property("$groups")||[];for(let[e,t]of Object.entries(this._instance.get_property("$stored_group_properties")||{}))l[e]={id:u[e],type:e,properties:t};let{$set_once:h,$set:c}=e;return{event:tE(tE({},is(e,a1)),{},{properties:tE(tE(tE({},e.properties),c?{$set:tE(tE({},null!=(t=null==(i=e.properties)?void 0:i.$set)?t:{}),c)}:{}),h?{$set_once:tE(tE({},null!=(s=null==(r=e.properties)?void 0:r.$set_once)?s:{}),h)}:{}),elements_chain:null!=(n=null==(o=e.properties)?void 0:o.$elements_chain)?n:"",distinct_id:null==(a=e.properties)?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}Rf(e){var t;let i=null==(t=e.tagName)?void 0:t.toLowerCase();return"style"===i&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||(a2.error("prepare_external_dependency_stylesheet returned null"),null):"script"===i&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(e)||(a2.error("prepare_external_dependency_script returned null"),null):e}Af(){var e,t,i,s,r,n,o,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};let l=null==f?void 0:f.defaultView,u=null==l||null==(e=l.Node)?void 0:e.prototype;if(!l||!u)return()=>{};if(this.If++,this.Ff)return this.Of();let h=[],c=this,d=new WeakSet,p=(e,t,i)=>{if(!(null==e?void 0:e[t]))return;let s=e[t];e[t]=i(s),h.push(()=>{e[t]=s})},g=e=>{if(d.has(e))return e;let t=c.Rf(e);return t&&d.add(t),t},_=e=>e.map(e=>"string"==typeof e?e:g(e)).filter(e=>!J(e));return p(u,"appendChild",e=>function(t){let i=g(t);return i?e.call(this,i):t}),p(u,"insertBefore",e=>function(t,i){let s=g(t);return s?e.call(this,s,i):t}),p(u,"replaceChild",e=>function(t,i){let s=g(t);return s?e.call(this,s,i):i}),[null==(t=l.Element)?void 0:t.prototype,null==(i=l.Document)?void 0:i.prototype,null==(s=l.DocumentFragment)?void 0:s.prototype].forEach(e
2=>{p(e,"append",e=>function(...t){return e.apply(this,_(t))}),p(e,"prepend",e=>function(...t){return e.apply(this,_(t))})}),[null==(r=l.Element)?void 0:r.prototype,null==(n=l.CharacterData)?void 0:n.prototype,null==(o=l.DocumentType)?void 0:o.prototype].forEach(e=>{p(e,"before",e=>function(...t){return e.apply(this,_(t))}),p(e,"after",e=>function(...t){return e.apply(this,_(t))}),p(e,"replaceWith",e=>function(...t){let i=_(t);return t.length&&!i.length?void 0:e.apply(this,i)})}),p(null==(a=l.Element)?void 0:a.prototype,"insertAdjacentElement",e=>function(t,i){let s=g(i);return s?e.call(this,t,s):null}),this.Ff=()=>{h.forEach(e=>e()),this.Ff=void 0},this.Of()}Of(){let e=!1;return()=>{var t;e||(e=!0,this.If--,0===this.If&&(null==(t=this.Ff)||t.call(this)))}}Df(e,t=!0){let i=this.Af();try{let s=e(i);return t&&i(),s}catch(e){throw i(),e}}setupSiteApp(e){let t=this.apps[e.id],i=()=>{var i;!t.errored&&this.Mf.length&&(a2.info(`Processing ${this.Mf.length} events for site app with id ${e.id}`),this.Mf.forEach(e=>this.Df(()=>{var i;return null==(i=t.processEvent)?void 0:i.call(t,e)})),t.processedBuffer=!0),Object.values(this.apps).every(e=>e.processedBuffer||e.errored)&&(null==(i=this.Pf)||i.call(this))},s=!1,r=r=>{t.errored=!r,t.loaded=!0,a2.info(`Site app with id ${e.id} ${r?"loaded":"errored"}`),s&&i()};try{let{processEvent:i}=this.Df(t=>e.init({posthog:this._instance,callback(e){t(),r(e)}}),!1);i&&(t.processEvent=i),s=!0}catch(t){a2.error(a3+e.id,t),r(!1)}if(s&&t.loaded)try{i()}catch(i){a2.error(`Error while processing buffered events PostHog app with config id ${e.id}`,i),t.errored=!0}}Lf(){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)}Nf(e){if(0===Object.keys(this.apps).length)return;let t=this.globalsForEvent(e);for(let i of Object.values(this.apps))try{this.Df(()=>{var e;return null==(e=i.processEvent)?void 0:e.call(i,t)})}catch(t){a2.error(`Error while processing event ${e.event} for site app ${i.id}`,t)}}onRemoteConfig(e){var t,i,s,r,n;if(null==(t=this.siteAppLoaders)?void 0:t.length)return this.isEnabled?(this.Lf(),void this._instance.on("eventCaptured",e=>this.Nf(e))):void a2.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this.Pf)||i.call(this),!e.ok)return;let o=e.config;if(null==(s=o.siteApps)?void 0:s.length)if(this.isEnabled)for(let{id:e,url:t}of o.siteApps)x[`__$$ph_site_app_${e}`]=this._instance,null==(r=x.__PosthogExtensions__)||null==(n=r.loadSiteApp)||n.call(r,this._instance,t,t=>{if(t)return a2.error(a3+e,t)});else a2.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}),lH),{tracingHeaders:class{constructor(e){this._instance=e,this.qf=void 0,this.jf=void 0,this.Bf=void 0,this.ef=()=>{var e,t;let i=this.Hf();i?(V(this.qf)&&(this.qf=null==(e=x.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)?void 0:e._patchXHR(i,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),V(this.jf)&&(this.jf=null==(t=x.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchFetch(i,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.lf()}}initialize(){this.startIfEnabledOrStop()}Ho(e){var t,i,s;(null==(t=x.__PosthogExtensions__)?void 0:t.tracingHeadersPatchFns)?e():null==(i=x.__PosthogExtensions__)||null==(s=i.loadExternalDependency)||s.call(i,this._instance,"tracing-headers",t=>{if(t)return aq.error("failed to load script",t);e()})}zf(){var e,t;return null!=(e=null!=(t=this._instance.config.tracing_headers)?t:this._instance.config.addTracingHeaders)?e:this._instance.config.__add_tracing_headers}Hf(){let e=this.zf();return U(e)?(U(this.Bf)?this.Bf.splice(0,this.Bf.length,...e):this.Bf=[...e],e.length>0?this.Bf:void 0):(U(this.Bf)&&this.Bf.splice(0),this.Bf=e||void 0,this.Bf)}lf(){var e,t;null==(e=this.qf)||e.call(this),null==(t=this.jf)||t.call(this),this.qf=void 0,this.jf=void 0}startIfEnabledOrStop(){this.Hf()?this.Ho(this.ef):this.lf()}}}),{toolbar:class{constructor(e){this.instance=e}Uf(e){x.ph_toolbar_state=e}Wf(){var e;return null!=(e=x.ph_toolbar_state)?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,t,i){var s,r;if(sY(this.instance.config)||!c||!f)return!1;e=null!=(s=e)?s:c.location,i=null!=(r=i)?r:c.history;try{let s;if(!t){try{c.localStorage.setItem("test","test"),c.localStorage.removeItem("test")}catch(e){return!1}t=null==c?void 0:c.localStorage}let r=lr||nr(e.hash,"__posthog")||nr(e.hash,"state"),n=r?t_(()=>JSON.parse(atob(decodeURIComponent(r))))||t_(()=>JSON.parse(decodeURIComponent(r))):null;return n&&"ph_authorize"===n.action?((s=n).source="url",s&&Object.keys(s).length>0&&(n.desiredHash?e.hash=n.desiredHash:i?i.replaceState(i.state,"",e.pathname+e.search):e.hash="")):((s=JSON.parse(t.getItem(ln)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token||(this.loadToolbar(s),0))}catch(e){return!1}}Vf(e){let t=x.ph_load_toolbar||x.ph_load_editor;!K(t)&&q(t)?t(e,this.instance):lo.warn("No toolbar load function found")}loadToolbar(e){let t=!!(null==f?void 0:f.getElementById("__POSTHOG_TOOLBAR__"));if(!c||t)return!1;let i="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=tE(tE({token:this.instance.config.token},e),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},i?{instrument:!1}:{});if(c.localStorage.setItem(ln,JSON.stringify(tE(tE({},s),{},{source:void 0}))),2===this.Wf())this.Vf(s);else if(0===this.Wf()){var r,n;this.Uf(1),null==(r=x.__PosthogExtensions__)||null==(n=r.loadExternalDependency)||n.call(r,this.instance,"toolbar",e=>{e?(lo.error("[Toolbar] Failed to load",e),this.Uf(0)):(this.Uf(2),this.Vf(s))}),sK(c,"turbolinks:load",()=>{this.Uf(0),this.loadToolbar(s)})}return!0}Gf(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,i){return this.maybeLoadToolbar(e,t,i)}}}),lz),{conversations:class{constructor(e){this._instance=e,this.ep=void 0,this._conversationsManager=null,this.np=!1,this.ne=null,this.sp=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(this._instance.config.disable_conversations||(this.rp=e.ok,!e.ok))return;let t=e.config.conversations;K(t)||(Q(t)?this.ep=t:(this.ep=t.enabled,this.ne=t),this.loadIfEnabled())}reset(){var e;null==(e=this._conversationsManager)||e.reset(),this._conversationsManager=null,this.ep=void 0,this.ne=null,this.rp=void 0,this.sp=!1}loadIfEnabled(){if(this._conversationsManager||this.np||this._instance.config.disable_conversations||sY(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;let e=null==x?void 0:x.__PosthogExtensions__;if(e&&!V(this.ep)&&this.ep)if(this.ne&&this.ne.token){this.np=!0;try{let t=e.initConversations;if(t)return this.op(t),void(this.np=!1);let i=e.loadExternalDependency;if(!i)return void this.ap(sC);i(this._instance,"conversations",t=>{t||!e.initConversations?this.ap("Could not load conversations script",t):this.op(e.initConversations),this.np=!1})}catch(e){this.ap("Error initializing conversations",e),this.np=!1}}else lS.error("Conversations enabled but missing token in remote config.")}op(e){if(this.ne)try{this._conversationsManager=e(this.ne,this._instance),this.sp=!1,lS.info("Conversations loaded successfully")}catch(e){this.ap("Error completing conversations initialization",e)}else lS.error("Cannot complete initialization: remote config is null")}ap(e,t){lS.error(e,t),this._conversationsManager=null,this.np=!1,this.sp=!0}show(){this._conversationsManager?this._conversationsManager.show():lS.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.ep&&!J(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":sY(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.rp?"remote_config_failed":V(this.ep)?this.rp?"disabled_in_project":"remote_config_pending":this.ep?K(this.ne)||!this.ne.token?"missing_token":(null==x?void 0:x.__PosthogExtensions__)?this.np?"initializing":this.sp?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var e,t;return null!=(e=null==(t=this._conversationsManager)?void 0:t.isVisible())&&e}sendMessage(e,t,i){var s=this;return eu(function*(){return s._conversationsManager?s._conversationsManager.sendMessage(e,t,i):(lS.warn(l$),null)})()}getMessages(e,t){var i=this;return eu(function*(){return i._conversationsManager?i._conversationsManager.getMessages(e,t):(lS.warn(l$),null)})()}markAsRead(e){var t=this;return eu(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(lS.warn(l$),null)})()}getTickets(e){var t=this;return eu(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(lS.warn(l$),null)})()}requestRestoreLink(e){var t=this;return eu(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(lS.warn(l$),null)})()}restoreFromToken(e){var t=this;return eu(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(lS.warn(l$),null)})()}restoreFromUrlToken(){var e=this;return eu(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(lS.warn(l$),null)})()}getCurrentTicketId(){var e,t;return null!=(e=null==(t=this._conversationsManager)?void 0:t.getCurrentTicketId())?e:null}getWidgetSessionId(){var e,t;return null!=(e=null==(t=this._conversationsManager)?void 0:t.getWidgetSessionId())?e:null}Sh(){var e;null==(e=this._conversationsManager)||e.setIdentity()}xh(){var e;null==(e=this._conversationsManager)||e.clearIdentity()}}}),{logs:class{constructor(e){var t;this._instance=e,this.name="logs",this.lp=!1,this.up=!1,this.hp=!1,this.A=i$("[logs]"),this.cp=tE(tE({},this.A),{},{error:(...e)=>{e.some(lF)||this.A.error(...e)}}),this.ol=[],this.dp=[],this._d=0,this.To=!1,this.vp=[],this.fp=[],this.pp=!1,this.gp=!1,this.mp=()=>{var e,t;this.To||(this._d=0,null==(e=this.yp)||e.onReconnect(),null==(t=this.bp)||t.onReconnect())},this._instance&&(null==(t=this._instance.config.logs)?void 0:t.captureConsoleLogs)&&(this.lp=!0),c&&sK(c,"online",this.mp)}_p(e,t,i,s){var r;let n=lI(null==(r=this._instance)||null==(r=r.config)?void 0:r.logs,i);return[new iy(this.wp(e,t),n,this.cp,()=>this.kp(),e=>e(),void 0,s),n]}Sp(){var e,t;let i=null==(e=this._instance)||null==(e=e.config)?void 0:e.logs;return this.yp&&this.xp===i||(null==(t=this.yp)||t.reset(),this.xp=i,[this.yp,this.Cp]=this._p(()=>this.ol,e=>{this.ol=e})),this.yp}$p(){var e,t;let i=null==(e=this._instance)||null==(e=e.config)?void 0:e.logs;return this.bp&&this.Tp===i||(null==(t=this.bp)||t.reset(),this.Tp=i,[this.bp,this.Ip]=this._p(()=>this.dp,e=>{this.dp=e},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},lO)),this.bp}setup(e){var t;if(this.To)return;this.bo=e,(null==(t=this._instance)||null==(t=t.config)||null==(t=t.logs)?void 0:t.captureConsoleLogs)&&(this.lp=!0),(this.lp||this.Mp()&&this.Ep())&&this.Pp();let i=!1,s=e.onRemoteConfig(e=>{var t;i=e.ok&&!0===(null==(t=e.config.logs)?void 0:t.captureConsoleLogs),this.onRemoteConfig(e)});this.To?s.dispose():(this.Eo=s,i||this.loadIfEnabled())}dispose(){var e,t,i,s;this.To||(this.To=!0,this.Rp(),null==(e=this.Eo)||e.dispose(),this.Eo=void 0,this.bo=void 0,this.hp=!1,null==c||c.removeEventListener("online",this.mp),null==(t=this.Ap)||t.call(this),this.Ap=void 0,null==(i=this.yp)||i.reset(),null==(s=this.bp)||s.reset())}onRemoteConfig(e){var t,i;if(this.To)return;let s=e.ok?null==(t=e.config.logs)?void 0:t.captureConsoleLogs:void 0;K(s)?this.Fp():(null==(i=this._instance)||null==(i=i.persistence)||i.register({$logs_capture_enabled_server_side:!!s}),s?(this.lp=!0,this.up||this.Pp(),this.loadIfEnabled()):this.Fp())}reset(){var e,t,i,s;this.Rp(),null==(e=this.yp)||e.clearQueue(),this.ol=[],null==(t=this.yp)||t.reset(),null==(i=this.bp)||i.clearQueue(),this.dp=[],null==(s=this.bp)||s.reset(),this._d=0}captureLog(e){this.To||this.Sp().captureLog(e)}captureConsoleLog(e){this.To||this.$p().captureLog(e)}captureBufferedConsoleLog(e,t,i){this.To||this.$p().captureLog(e,{context:t,occurredAtMs:i})}Ep(){var e;return!!(null==(e=this._instance)||null==(e=e.persistence)||null==(e=e.props)?void 0:e[iK])}Mp(){var e,t,i;return!(null==(e=this._instance)||null==(t=e.il)?void 0:t.call(e))||!!(null==(i=x._POSTHOG_REMOTE_CONFIG)||null==(i=i[this._instance.config.token])?void 0:i.config)}$h(){var e;this.Rp(),null==(e=this.bp)||e.clearQueue(),this.dp=[]}Fp(){this.lp||this.Rp()}Pp(){var e;if(this.pp||!(null==x?void 0:x.console))return;let t=lI(null==(e=this._instance)||null==(e=e.config)?void 0:e.logs).maxBufferSize,i=!0;for(let e of(this.fp.push(()=>{i=!1}),lP)){let s;try{s=lT(x.console[e])}catch(e){continue}s&&this.fp.push(aU(x.console,e,r=>{let n=(...s)=>{try{i&&this.Op(e,s,t)}catch(e){}return r.apply(x.console,s)};return n.__rrweb_original__=s,n}))}this.pp=!0,this.Dp=setTimeout(()=>{this.Rp()},3e4)}Op(e,t,i){var s;if(this.pp&&!this.gp&&0!==t.length)if(null==(s=this._instance)?void 0:s.is_capturing()){if(i>this.vp.length){this.gp=!0;try{this.vp.push({level:e,args:t,occurredAtMs:Date.now(),context:this.kp()})}finally{this.gp=!1}}}else this.Rp()}Rp(){if(this.vp=[],this.pp){for(let e of(this.pp=!1,this.Dp&&(clearTimeout(this.Dp),this.Dp=void 0),this.fp))e();this.fp=[]}}Lp(){let e=this.vp;return this.Rp(),e}get logger(){return this.Np||(this.Np={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.Np}flushLogs(e){e?this.qp(e):(this.yp&&this.yp.flush().catch(e=>this.jp(e)),this.bp&&this.bp.flush().catch(e=>this.jp(e)))}jp(e){lF(e)||this.A.error("PostHog logs flush failed:",e)}loadIfEnabled(){if(this.To||!this.lp||this.up||this.hp)return;let e=null==x?void 0:x.__PosthogExtensions__;if(!e)return this.A.error("PostHog Extensions not found."),void this.Rp();let t=e.loadExternalDependency;if(!t)return this.A.error(sC),void this.Rp();this.hp=!0;try{t(this._instance,"logs",t=>{if(this.hp=!1,this.To||!this.lp)return;let i=e.logs;if(!t&&(null==i?void 0:i.initializeLogs)){var s,r,n;let e=this.Lp();this.Ap=i.initializeLogs(null!=(s=this.bo)?s:this._instance),this.up=!0,e.length>0&&(null==(r=i.replayConsoleBuffer)||r.call(i,null!=(n=this.bo)?n:this._instance,e))}else this.A.error("Could not load logs script",t),this.Rp()})}catch(e){throw this.hp=!1,e}}wp(e,t){let i=this._instance;return{get isDisabled(){return!1},get optedOut(){return!i.is_capturing()},getPersistedProperty:t=>t===O.LogsQueue?e():void 0,setPersistedProperty(e,i){e===O.LogsQueue&&t(null!=i?i:[])},js:e=>this.js(e),getLibraryId:()=>S.LIB_NAME,getLibraryVersion:()=>S.LIB_VERSION}}js(e){return new Promise(t=>{if(nn(this._d,3))return void t({kind:"fatal",error:lR(void 0,"logs endpoint is unreachable, dropping batch")});let i=!1,s=e=>{i||(i=!0,clearTimeout(r),t(e))},r=setTimeout(()=>{this.A.warn("Logs request timed out before receiving a response"),s({kind:"retry-later",error:lR(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this.Bp(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:e=>{let t=e.statusCode;if(this.Hp(t),t>=200&&300>t)s({kind:"ok"});else if(413===t)s({kind:"too-large"});else if(0!==t&&408!==t&&429!==t&&500>t)s({kind:"fatal",error:Error(`logs request failed with status ${t}`)});else{var i;0===t?(e.error||this.A.warn("Logs request failed before receiving an HTTP response"),s({kind:"retry-later",error:lR(e.error,"logs request failed before receiving an HTTP response")})):s({kind:"retry-later",error:null!=(i=e.error)?i:Error(`logs request failed with status ${t}`)})}}})})}Hp(e){(0!==e||this._instance.__loaded)&&(this._d=no(e,this._d,3,()=>this.A.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.")))}qp(e){this.ol.length>0&&this.zp(e,this.ol,this.Cp,S.LIB_NAME,e=>{this.ol=e}),this.dp.length>0&&this.zp(e,this.dp,this.Ip,lO,e=>{this.dp=e})}zp(e,t,i,s,r){if(0===t.length)return;let n=t.map(e=>e.record);r([]);let o=ig(n,il(i,S.LIB_NAME,S.LIB_VERSION),s,S.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Bp(),data:o,compression:"best-available",batchKey:"logs",transport:e})}Bp(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}kp(){var e;let t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){let{sessionId:e,windowId:i,sessionStartTimestamp:s,lastActivityTimestamp:r}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);t.sessionId=e,t.windowId=i,K(s)||(t.sessionStartTimestamp=s),K(r)||(t.lastActivityTimestamp=r)}if((null==x||null==(e=x.location)?void 0:e.href)&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?tg(x.location.href):x.location.href),this._instance.featureFlags){let e=this._instance.featureFlags.getFlags();e&&e.length>0&&(t.activeFeatureFlags=e)}return t}}}),{metrics:class{constructor(e){this._instance=e,this.A=i$("[metrics]"),this.To=!1}initialize(){this.onConfigChange()}onConfigChange(){var e,t;let i,s,r,n;if(this.To)return;let o=!!(null==(e=this._instance.config.metrics)?void 0:e.network);o&&!this.Up?this.Up=(t=this._instance,i=!0,s=()=>{var e;let s;return i?!0===(s=null==(e=t.config.metrics)?void 0:e.network)?{}:s||void 0:void 0},r=q(null==c?void 0:c.fetch)?aU(c,"fetch",e=>function(...i){let r=lM(),n=e.apply(this,i);if(!s())return n;try{var o,a,l;let[e,u]=i,h=lN(null!=(o=null!=(a=null==u?void 0:u.method)?a:null==e?void 0:e.method)?o:"GET",null!=(l=null==e?void 0:e.url)?l:e);return n.then(e=>(lj(t,h,null==e?void 0:e.status,r,s,void 0,!0),e),e=>{throw lj(t,h,void 0,r,s,e),e})}catch(e){return lA.error("Failed to observe fetch",e),n}}):lB,n=((e,t)=>{var i;let s=null==c||null==(i=c.XMLHttpRequest)?void 0:i.prototype;if(!s)return lB;let r=new WeakMap,n=aU(s,"open",e=>function(...t){try{ox.has(this)||r.set(this,lN(t[0],t[1]))}catch(e){lA.error("Failed to observe XHR open",e)}return e.apply(this,t)}),o=aU(s,"send",i=>function(...s){let n;try{let i=r.get(this);if(i&&t()){let s=lM();n=()=>{this.removeEventListener("loadend",n),lj(e,i,this.status,s,t)},sK(this,"loadend",n)}}catch(e){lA.error("Failed to observe XHR send",e)}try{return i.apply(this,s)}catch(e){throw n&&this.removeEventListener("loadend",n),e}});return()=>{n(),o()}})(t,s),()=>{i=!1,r(),n()}):!o&&this.Up&&(this.Up(),this.Up=void 0)}Sp(){var e,t,i,s,r,n,o;let a,l=null==(e=this._instance)||null==(e=e.config)?void 0:e.metrics;return this.yp&&this.xp===l||(null==(t=this.yp)||t.reset(),this.xp=l,this.yp=new ix(this.wp(),{serviceName:null!=(i=null==(a=null==l?void 0:l.resourceAttributes)?void 0:a["service.name"])?i:null==l?void 0:l.serviceName,serviceVersion:null!=(s=null==a?void 0:a["service.version"])?s:null==l?void 0:l.serviceVersion,environment:null!=(r=null==a?void 0:a["deployment.environment"])?r:null==l?void 0:l.environment,resourceAttributes:a,beforeSend:null==l?void 0:l.beforeSend,flushIntervalMs:null!=(n=null==l?void 0:l.flushIntervalMs)?n:1e4,maxSeriesPerFlush:null!=(o=null==l?void 0:l.maxSeriesPerFlush)?o:1e3},this.A)),this.yp}count(e,t=1,i){this.Sp().count(e,t,i)}
2gauge(e,t,i){this.Sp().gauge(e,t,i)}histogram(e,t,i){this.Sp().histogram(e,t,i)}flush(e){if(!this.yp)return Promise.resolve();if(e){let t=this.yp.drainWindow();return t&&this.Ys(t,e),Promise.resolve()}return this.yp.flush().catch(e=>this.A.error("PostHog metrics flush failed:",e))}reset(){var e;null==(e=this.yp)||e.reset()}dispose(){var e,t;this.To=!0,null==(e=this.Up)||e.call(this),this.Up=void 0,null==(t=this.yp)||t.reset()}wp(){let e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},Ys:e=>t.Ys(e),getLibraryId:()=>S.LIB_NAME,getLibraryVersion:()=>S.LIB_VERSION}}Ys(e,t){return new Promise(i=>{let s=!1,r=e=>{s||(s=!0,clearTimeout(n),i(e))},n=setTimeout(()=>r({kind:"retry-later",error:Error("metrics request timed out")}),9e4);this._instance._send_request(tE(tE({method:"POST",url:this.Wp(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t}),{},{fireCallbackOnDrop:!0,callback(e){let t=e.statusCode;if(t>=200&&300>t)r({kind:"ok"});else if(413===t)r({kind:"too-large"});else if(0!==t&&408!==t&&429!==t&&500>t)r({kind:"fatal",error:Error(`metrics request failed with status ${t}`)});else{var i;r({kind:"retry-later",error:null!=(i=e.error)?i:Error(`metrics request failed with status ${t}`)})}}}))})}Wp(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}}));let lV=(S.SDK_DIST_CHANNEL="npm",h=ad[a$]=new aC,function(){function e(){e.done||(e.done=!0,oU=!1,sq(ad,function(e){e._dom_loaded()}))}(null==f?void 0:f.addEventListener)?"complete"===f.readyState?e():sK(f,"DOMContentLoaded",e,{capture:!1}):c&&iS.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),h);var lW=lV}}]);

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.