PageSourceSearch

https://crawlkit.sh/chunk-ADIG5ULT.js

js crawlkit.sh collected 2026-10-07 18:56:12 UTC 309,543 bytes, 3 lines download raw bytes

1import"./chunk-OSQMNGTH.js";var y="u">typeof window?window:void 0,ge="u">typeof globalThis?globalThis:y,de=ge?.navigator,x=ge?.document,ie=ge?.location,li=ge?.fetch,xn=ge?.XMLHttpRequest&&"withCredentials"in new ge.XMLHttpRequest?ge.XMLHttpRequest:void 0,Gn=ge?.AbortController,Ul=ge?.CompressionStream,me=de?.userAgent;function wo(){return!(!y||y.navigator.onLine===!1)}var Nt=typeof globalThis<"u"?globalThis:y;Nt&&typeof self>"u"&&(Nt.self=Nt),Nt&&typeof File>"u"&&(Nt.File=function(){});var F=y??{},Yn="0.9.0",We={DEBUG:!1,LIB_VERSION:Yn,LIB_NAME:"browser-common",JS_SDK_VERSION:Yn},Le=(function(e){return e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.EnablePersonProcessing="enable_person_processing",e.PersonMode="person_mode",e.FeatureFlagDetails="feature_flag_details",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",e.BootstrapFeatureFlags="bootstrap_feature_flags",e.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.AiQueue="ai_queue",e.AiCaptureQueue="ai_capture_queue",e.LogsQueue="logs_queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionStartTimestamp="session_start_timestamp",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay",e.PushRegistered="push_registered",e.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",e.SurveyLastSeenDate="survey_last_seen_date",e.SurveysInProgress="surveys_in_progress",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config",e.FlagsEndpointWasHit="flags_endpoint_was_hit",e.DeviceId="device_id",e})({}),zs=(function(e){return e.GZipJS="gzip-js",e.Base64="base64",e})({}),Vl=["$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"],Hl=["token"];function M(e,t){return e.indexOf(t)!==-1}var is=function(e){return e.trim()},Ws=function(e){return e.replace(/^\$/,"")};function Eo(e){var t;let i=[];return(t=JSON.stringify(e,function(s,n){if(typeof n=="bigint")return n.toString();if(typeof n!="function"&&typeof n!="symbol"){if(n instanceof Error)return{name:n.name,message:n.message,stack:n.stack};if(n&&typeof n=="object"){for(;i.length>0&&i[i.length-1]!==this;)i.pop();if(i.includes(n))return"[Circular]";i.push(n)}return n}}))!==null&&t!==void 0?t:"null"}var xo=Object.prototype,$n=xo.hasOwnProperty,ss=xo.toString,C=Array.isArray||function(e){return ss.call(e)==="[object Array]"},ce=e=>typeof e=="function",N=e=>e===Object(e)&&!C(e),xe=e=>{if(N(e)){for(let t in e)if($n.call(e,t))return!1;return!0}return!1},E=e=>e===void 0,L=e=>ss.call(e)=="[object String]",Kt=e=>L(e)&&e.trim().length===0,se=e=>e===null,A=e=>E(e)||se(e),re=e=>ss.call(e)=="[object Number]"&&e==e,qe=e=>re(e)&&e>0,be=e=>ss.call(e)==="[object Boolean]",zl=e=>M(Vl,e),Wl=e=>M(Hl,e);function $o(e){return e===null||typeof e!="object"}function Li(e,t){return{}.toString.call(e)===`[object ${t}]`}function Dt(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 ko(e,Error)}}function kn(e){return"u">typeof Event&&ko(e,Event)}function ko(e,t){try{return e instanceof t}catch{return!1}}var Gl=[!0,"true",1,"1","yes"],us=e=>M(Gl,e),Yl=[!1,"false",0,"0","no"];function Xn(e,t,i,s,n,r,o){try{var a=e[r](o),l=a.value}catch(u){return void i(u)}a.done?t(l):Promise.resolve(l).then(s,n)}function Z(e){return function(){var t=this,i=arguments;return new Promise(function(s,n){var r=e.apply(t,i);function o(l){Xn(r,s,n,o,a,"next",l)}function a(l){Xn(r,s,n,o,a,"throw",l)}o(void 0)})}}var Xl=["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"],Kn=function(e,t=[]){if(!e)return!1;let i=e.toLowerCase();return Xl.concat(t).some(s=>{let n=s.toLowerCase();return i.indexOf(n)!==-1})};function De(e,t,i,s,n){return t>i&&(s.warn("min cannot be greater than max."),t=i),re(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: "+n),De(n??i,t,i,s))}var Kl=class{constructor(e){this.C={},this.I=e.I,this.R=De(e.bucketSize,0,100,e.$),this.A=De(e.refillRate,0,this.R,e.$),this.O=De(e.refillInterval,0,864e5,e.$)}F(e,t){let i=Math.floor((t-e.lastAccess)/this.O);i>0&&(e.tokens=Math.min(e.tokens+i*this.A,this.R),e.lastAccess=e.lastAccess+i*this.O)}consumeRateLimit(e){var t;let i=Date.now(),s=String(e),n=this.C[s];return n?this.F(n,i):(n={tokens:this.R,lastAccess:i},this.C[s]=n),n.tokens===0||(n.tokens--,n.tokens===0&&((t=this.I)===null||t===void 0||t.call(this,e)),n.tokens===0)}stop(){this.C={}}},Tt="Mobile",ui="Android",Di="Tablet",So="Android Tablet",Ro="iPad",Po="Apple Watch",Pi="Safari",ns="BlackBerry",Oo="Samsung Internet",Oi="Chrome",Io="Chrome iOS",Fo="Internet Explorer",To="Internet Explorer Mobile",Co="Opera",Mo="Microsoft Edge",Ii="Firefox",Ao="Firefox iOS",Ni="Nintendo",ji="PlayStation",rs="Xbox",Lo="Android Mobile",Do="Mobile Safari",cs="Windows",No="Windows Phone",Jn="Nokia",Gs="Ouya",Jl="Generic "+Tt.toLowerCase(),jo="Generic "+Di.toLowerCase(),Ys="Konqueror",Bo="Oculus Browser",qo="Vivaldi",Uo="Yandex",Vo="Whale",Ho="DuckDuckGo",zo="Pale Moon",Wo="Waterfox",Xs="Brave",Go="Claude",Yo="Codex",Xo="ChatGPT",Ko="Google Search App",ds=new RegExp("Version/(\\d+(\\.\\d+)?)"),hs=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),Zl=new RegExp(rs,"i"),Ql=new RegExp("PlayStation \\w+","i"),eu=new RegExp("Nintendo \\w+","i"),Sn=new RegExp("BlackBerry|PlayBook|BB10","i"),tu={"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"},Jo=function(e,t,i,s){return t=t||"",(function(r){return r?.brave?Xs:null})(i)||(s?.detectGoogleSearchApp&&M(e,"GSA/")?Ko:M(e," OPR/")&&M(e,"Mini")?"Opera Mini":M(e," OPR/")?Co:Sn.test(e)?ns:M(e,"IEMobile")||M(e,"WPDesktop")?To:M(e,"OculusBrowser")?Bo:M(e,"SamsungBrowser")?Oo:M(e,"Edge")||M(e,"Edg/")?Mo:M(e,"Vivaldi/")?qo:M(e,"YaBrowser/")?Uo:M(e,"Whale/")?Vo:M(e,"DuckDuckGo/")||M(e,"Ddg/")?Ho:M(e,"Claude/")?Go:M(e,"Codex/")?Yo:M(e,"ChatGPT/")?Xo:M(e,"FBIOS")?"Facebook Mobile":M(e,"UCWEB")||M(e,"UCBrowser")?"UC Browser":M(e,"CriOS")?Io:M(e,"CrMo")||M(e,Oi)?Oi:M(e,ui)&&M(e,Pi)?Lo:M(e,"FxiOS")?Ao:M(e.toLowerCase(),Ys.toLowerCase())?Ys:M(e,"Brave/")?Xs:((r,o)=>o&&M(o,"Apple")||(function(a){return M(a,Pi)&&!M(a,Oi)&&!M(a,ui)})(r))(e,t)?M(e,Tt)?Do:Pi:M(e,"PaleMoon/")?zo:M(e,"Waterfox/")?Wo:M(e,Ii)?Ii:M(e,"MSIE")||M(e,"Trident/")?Fo:M(e,"Gecko")?Ii:"")},iu={[To]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[Mo]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[Oi]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[Io]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[Pi]:[ds],[Do]:[ds],[Co]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[Ii]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[Ao]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[Ys]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[ns]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),ds],[Lo]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[Oo]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[Bo]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[qo]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[Uo]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[Vo]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[Xs]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[Go]:[hs],[Yo]:[hs],[Xo]:[hs],[Ho]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[zo]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[Wo]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[Ko]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[Fo]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},su=function(e,t,i,s){let n=Jo(e,t,i,s),r=iu[n];if(E(r))return null;for(let o=0;r.length>
1o;o++){let a=e.match(r[o]);if(a)return parseFloat(a[a.length-2])}return null},Zn=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),e=>[rs,e&&e[1]||""]],[new RegExp(Ni,"i"),[Ni,""]],[new RegExp(ji,"i"),[ji,""]],[Sn,[ns,""]],[new RegExp(cs,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[No,""];if(new RegExp(Tt).test(t)&&!/IEMobile\b/.test(t))return["Windows Mobile",""];let i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){let s=tu[i[1]]||"";return/arm/i.test(t)&&(s="RT"),[cs,s]}return[cs,""]}],[/((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=E(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),e=>e&&e[2]?[ui,[e[2],e[3],e[4]||"0"].join(".")]:[ui,""]],[/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",""]]],Zo=function(e){for(let t=0;Zn.length>t;t++){let[i,s]=Zn[t],n=i.exec(e),r=n&&(ce(s)?s(n,e):s);if(r)return r}return["",""]},Qo=function(e){return eu.test(e)?Ni:Ql.test(e)?ji:Zl.test(e)?rs:new RegExp(Gs,"i").test(e)?Gs:new RegExp("(Windows Phone|WPDesktop)","i").test(e)?No:/iPad/.test(e)?Ro:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?Po:Sn.test(e)?ns:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Jn,"i").test(e)?Jn:/(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(Tt).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)?ui:So:new RegExp("(pda|Mobile)","i").test(e)?Jl:new RegExp(Di,"i").test(e)&&!new RegExp("Tablet pc","i").test(e)?jo:""},nu=function(e,t){var i;let s=Qo(e);return s===Ro||s===So||s==="Kobo"||s==="Kindle Fire"||s===jo?Di:s===Ni||s===rs||s===ji||s===Gs?"Console":s===Po?"Wearable":s?Tt:t?.userAgentDataPlatform==="Android"&&((i=t?.maxTouchPoints)!==null&&i!==void 0?i:0)>0?600>Math.min((n=t?.screenWidth)!==null&&n!==void 0?n:0,(r=t?.screenHeight)!==null&&r!==void 0?r:0)/((o=t?.devicePixelRatio)!==null&&o!==void 0?o:1)?Tt:Di:"Desktop";var n,r,o},ps=/\bFBAV\/(\d+(?:\.\d+)*)/i,Qn=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",ps],[/\bFBAN\/EMA\b/i,"Facebook Lite",ps],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",ps],[/\bLinkedInApp(?:\]?\/(\d+(?:\.\d+)*))?\b/i,"LinkedIn"],[/\bTwitter(?:Android| for (?:iPhone|iPad|Android))(?:\/(\d+(?:\.\d+)*))?\b/i,"Twitter"],[/\b(?:musical_ly|trill)(?:[_/](\d+\.\d+(?:\.\d+)*))?(?=\b|_)/i,"TikTok",/\bapp_version\/(\d+(?:\.\d+)*)/i],[/\b(?:MicroMessenger|WeChat)\/(\d+(?:\.\d+)*)?/i,"WeChat"],[/\bLine\/(\d+(?:\.\d+)*)?/i,"Line"],[/\bGSA\/(\d+(?:\.\d+)*)?/i,"Google"],[/\[Pinterest\/(?:iOS|Android)\b|\bPinterest(?: for (?:Android(?: Tablet)?|iOS))?\/(\d+(?:\.\d+)*)/i,"Pinterest"],[/\b(?:WA4A|WAiOS)\/(\d+(?:\.\d+)*)?/i,"WhatsApp"],[/\bSnapchat[ /](\d+(?:\.\d+)*)?/i,"Snapchat"],[/\bBing(?:Web|Sapphire)\/(\d+(?:\.\d+)*)?/i,"Bing"],[/\bNAVER\(inapp; search;/i,"Naver",/\bNAVER\(inapp; search;[^;)]*; (\d+(?:\.\d+)*)/i],[/\bKAKAOTALK[ /](\d+\.\d+(?:\.\d+)*)?/i,"KakaoTalk"]],Ks="[Truncated]",_i="[Unserializable]";function Ot(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]:"\uFFFD";else{let n=e.charCodeAt(i+1);56320>n||n>57343?t+="\uFFFD":(t+=e[i]+e[i+1],i++)}}return t}function ea(e,t){if(!t)return e;let i=[];try{i=Object.keys(t)}catch{i=[]}for(let s of i){let n;try{n=t[s]}catch{n=_i}Object.defineProperty(e,s,{value:n,enumerable:!0,writable:!0,configurable:!0})}return e}var Fi=3e5,ta=class{record(e){if(e.kind==="too-large")return;if(e.kind!=="retry-later")return void this.reset();if(!e.retryAfterMs)return;let t=this.isOpen(),i=Date.now(),s=Math.min(e.retryAfterMs,Fi);if(!t)return this.ts=i,void(this.es=i+s);this.es=Math.max(this.es,Math.min(i+s,this.ts+Fi))}remainingMs(){let e=Date.now();if(this.ts-5e3>e)return this.reset(),0;let t=Math.min(Fi,Math.max(0,this.es-e));return t===0&&this.reset(),t}isOpen(){return this.remainingMs()>0}reset(){this.es=0,this.ts=0}constructor(){this.es=0,this.ts=0}},ru=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function er(e,t){return typeof(i=e)=="string"&&ru.test(i)?e:t();var i}function ia(e,t){let i=new Error(t);try{Object.defineProperty(i,"name",{value:e,writable:!0,enumerable:!0,configurable:!0})}catch{}return i}function ot(e){return e&&e.split("#")[0]}function tr(e){try{return e()}catch{return}}function sa(e,t){let i=setTimeout(e,t);return i!=null&&i.unref&&i?.unref(),i}function ir(e,t,i){return na.apply(this,arguments)}function na(){return(na=Z(function*(e,t,i){let s;try{return yield Promise.race([e,new Promise((n,r)=>{s=sa(()=>{try{i?.(),n()}catch(o){r(o)}},t)})])}finally{clearTimeout(s)}})).apply(this,arguments)}var bi,sr,vs;function ou(e){let t=globalThis._posthogChunkIds;if(!t)return;let i=Object.keys(t);return vs&&i.length===sr||(sr=i.length,vs=i.reduce((s,n)=>{bi||(bi={});let r=bi[n];if(r)s[r[0]]=r[1];else{let o=e(n);for(let a=o.length-1;a>=0;a--){let l=o[a],u=l?.filename,c=t[n];if(u&&c){s[u]=c,bi[n]=[u,c];break}}}return s},{})),vs}function Jt(e){return Jt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Jt(e)}function au(e,t,i){return(t=(function(s){var n=(function(r){if(Jt(r)!="object"||!r)return r;var o=r[Symbol.toPrimitive];if(o!==void 0){var a=o.call(r,"string");if(Jt(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)})(s);return Jt(n)=="symbol"?n:n+""})(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function nr(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),i.push.apply(i,s)}return i}function v(e){for(var t=1;arguments.length>t;t++){var i=arguments[t]!=null?arguments[t]:{};
1t%2?nr(Object(i),!0).forEach(function(s){au(e,s,i[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):nr(Object(i)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(i,s))})}return e}var lu=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),n=this.buildParsingContext(t),r=this.parseStacktrace(s,n);return{$exception_list:this.convertToExceptionList(r,i),$exception_level:"error"}}modifyFrames(e){var t=this;return Z(function*(){for(let i of e)i.stacktrace&&i.stacktrace.frames&&C(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:(t=e.syntheticException)===null||t===void 0?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var i;let s,n;if(e.cause!=null&&(s=this.parseStacktrace(e.cause,t)),e.stack!=""&&e.stack!=null)try{n=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)}catch{}return v(v({},e),{},{cause:s,stack:n,errors:(i=e.errors)===null||i===void 0?void 0:i.map(r=>this.parseStacktrace(r,t))})}applyChunkIds(e,t){return e.map(i=>(i.filename&&t&&(i.chunk_id=t[i.filename]),i))}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 Z(function*(){let i=e;for(let s of t.modifiers)i=yield s(i);return i})()}convertToExceptionList(e,t){let i=[],s=(n,r,o)=>{var a;let l=i.length,u=r===void 0?v(v({type:typeof t.type=="string"&&t.type.length>0?t.type:"generic"},typeof t.handled=="boolean"?{handled:t.handled}:t.handled===void 0?{handled:!0}:{}),{},{synthetic:typeof t.synthetic=="boolean"?t.synthetic:n.synthetic,exception_id:l}):{type:"chained",source:o,synthetic:n.synthetic,exception_id:l,parent_id:r},c={type:n.type,value:n.value,mechanism:u};n.stack&&(c.stacktrace={type:"raw",frames:n.stack}),i.push(c),n.cause&&s(n.cause,l,"cause");for(let h of(a=n.errors)!==null&&a!==void 0?a:[])s(h,l,"member")};return s(e),i}buildParsingContext(e){var t;return{chunkIdMap:ou(this.stackParser),skipFirstLines:(t=e.skipFirstLines)!==null&&t!==void 0?t:1}}getAggregateErrors(e){try{if(Dt(e)){let i=Object.getPrototypeOf(e);for(let s=0;i&&100>s;s++){var t;let n=(t=Object.getOwnPropertyDescriptor(i,"constructor"))===null||t===void 0?void 0:t.value;if(typeof n=="function"&&n.name==="AggregateError"){let r=e.errors;return C(r)?r:void 0}i=Object.getPrototypeOf(i)}}}catch{}}buildCoercingContext(e,t,i=0){let s=0,n=0,r=!1,o=new Set,a=[],l={},u=(d,p,g=0)=>{let m=c(p,g),_=m.apply;if(m.apply=$=>{a.push(d);try{return _($)}finally{a.pop()}},g>4||g>0&&a.indexOf(d)!==-1)return this.coerceFallback(m);let f=typeof d=="object"&&d!==null||typeof d=="function";if(g===0&&s>=50||f&&o.has(d))return;f&&o.add(d),g===0&&s++;let b=this.getAggregateErrors(d),w,P;r||(r=!!b);try{if(w=this.applyCoercers(d,m),!w)throw l}catch($){if($===l)return void(g===0&&s--);if(!r)throw $;w=this.coerceFallback(m)}if(!b||s>=50)return w;try{P=b.length}catch{return w}if(!Number.isInteger(P)||0>P||P>4294967295)return w;let S=[];for(let $=0;50>s&&1e3>n&&P>$;$++){let I;n++;try{I=m.next(b[$])}catch{s++,I=this.coerceFallback(c(p+1))}I&&S.push(I)}return v(v({},w),{},{errors:S})},c=(d,p=0)=>v(v({},t),{},{syntheticException:d==0?t.syntheticException:void 0,mechanism:d==0?e:{},apply(g){let m=u(g,d,p+1);if(!m)throw l;return m},next:g=>u(g,d+1)}),h=c(i);return v(v({},h),{},{apply:d=>{var p;return(p=u(d,i))!==null&&p!==void 0?p:this.coerceFallback(h)}})}},uu=/^([a-z][a-z0-9.+-]+):/i,cu=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function du(e){if(!e||e==="<anonymous>")return!1;let t=uu.exec(e);return!t||cu.includes(t[1].toLowerCase())}function Js(e,t,i,s,n){let r={platform:e,filename:t,function:i==="<anonymous>"?"?":i,in_app:du(t)};return E(s)||(r.lineno=s),E(n)||(r.colno=n),r}var ra=(e,t)=>{let i=e.indexOf("safari-extension")!==-1,s=e.indexOf("safari-web-extension")!==-1;return i||s?[e.indexOf("@")!==-1?e.split("@")[0]:"?",i?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},hu=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,pu=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,vu=/\((\S*)(?::(\d+))(?::(\d+))\)/,fu=(e,t)=>
1{let i=hu.exec(e);if(i){let[,n,r,o]=i;return Js(t,n,"?",+r,+o)}let s=pu.exec(e);if(s){if(s[2]&&s[2].indexOf("eval")===0){let o=vu.exec(s[2]);o&&(s[2]=o[1],s[3]=o[2],s[4]=o[3])}let[n,r]=ra(s[1]||"?",s[2]);return Js(t,r,n,s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}},gu=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,_u=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,mu=(e,t)=>{let i=gu.exec(e);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){let r=_u.exec(i[3]);r&&(i[1]=i[1]||"eval",i[3]=r[1],i[4]=r[2],i[5]="")}let s=i[3],n=i[1]||"?";return[n,s]=ra(n,s),Js(t,s,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},rr=/\(error: (.*)\)/;function Rn(e,t){return e.filename===t.filename&&e.function===t.function&&e.module===t.module&&e.lineno===t.lineno&&e.colno===t.colno}function yu(e){for(let t=1;10>=t;t++){let i=e.length-2*t;if(0>i)break;let s=!0;for(let n=0;t>n;n++)if(!Rn(e[i+n],e[i+t+n])){s=!1;break}if(s){for(let n=0;t>n;n++)e[i+n]=e[i+t+n];return e.length=i+t,{start:i,length:t}}}}function bu(e,t){let i=t.start+t.length,s=aa(e,t);s&&e.splice(i+s===e.length?i:t.start,s)}function oa(e,t){let i=t.start;for(;i>0&&Rn(e[i-1],e[i-1+t.length]);)i--;return t.start-i}function aa(e,t){let i=t.start+t.length,s=i;for(;e.length>s&&Rn(e[s],e[s-t.length]);)s++;return s-i}function wu(e,t){let i=t[0],s=e.length-(i?oa(e,i):0);for(let n of t)s-=aa(e,n);return s}function Eu(e,t,i){for(let s=0;e.length>s;s++){let n=e[(t+s)%e.length],r=e[(i+s)%e.length];if(n!==r)return r>n}return!1}var xu=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){let i=L(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 Li(e,"DOMException")}isDOMError(e){return Li(e,"DOMError")}},$u=class{match(e){return Dt(e)}coerce(e,t){var i;let s=this.getStack(e),n=s===void 0?(i=t.syntheticException)===null||i===void 0?void 0:i.stack:void 0,r=!!n;return{type:this.getType(e),value:this.getMessage(e,t),stack:s??n,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&&typeof i.error.message=="string"?i.error.message:i)}getStack(e){try{let t=e.stacktrace;if(typeof t=="string"&&t.length>0)return t;let i=e.stack;return typeof i=="string"&&i.length>0?i:void 0}catch{return}}},ku=class{match(e){return!!Li(e,"ErrorEvent")&&(e.error!=null||this.ur(e))}coerce(e,t){var i;if(e.error!=null)return t.apply(e.error);let s=t.apply(e.message);return v(v({},s),{},{stack:(i=this.cr(e))!==null&&i!==void 0?i:s.stack,synthetic:!0})}ur(e){return L(e.message)&&e.message.length>0}cr(e){var t,i;let s=e,n=(t=s.lineno)!==null&&t!==void 0?t:0,r=(i=s.colno)!==null&&i!==void 0?i:0;if(L(s.filename)&&s.filename.length!==0&&n!==0)return`Error
2    at ${s.filename}:${n}:${r}`}},Su=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Ru=class{match(e){return typeof e=="string"}coerce(e,t){var i;let[s,n]=this.getInfos(e);return{type:s??"Error",value:n??e,stack:(i=t.syntheticException)===null||i===void 0?void 0:i.stack,synthetic:!0}}getInfos(e){let t="Error",i=e,s=e.match(Su);return s&&(t=s[1],i=s[2]),[t,i]}},Pu=["fatal","error","warning","log","info","debug"];function la(e,t=40){let i=Object.keys(e);if(i.sort(),!i.length)return"[object has no keys]";for(let s=i.length;s>0;s--){let n=i.slice(0,s).join(", ");if(t>=n.length)return s===i.length?n:n.length>t?`${n.slice(0,t)}...`:n}return""}var Ou=class{match(e){return typeof e=="object"&&e!==null}coerce(e,t){var i,s;let n=this.getErrorPropertyFromObject(e);return n?t.apply(n):{type:this.getType(e),value:this.getValue(e),stack:(i=this.getStack(e))!==null&&i!==void 0?i:(s=t.syntheticException)===null||s===void 0?void 0:s.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){if(kn(e))return e.constructor.name;let t="name"in e?e.name:void 0;return L(t)&&!Kt(t)?t:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){let i=`'${e.name}' captured as exception`;return"message"in e&&typeof e.message=="string"&&(i+=` with message: '${e.message}'`),i}if("message"in e&&typeof e.message=="string")return e.message;let t=this.getObjectClassName(e);return`${t&&t!=="Object"?`'${t}'`:"Object"} captured as exception with keys: ${la(e)}`}isSeverityLevel(e){return L(e)&&!Kt(e)&&Pu.indexOf(e)>=0}getStack(e){try{return L(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:L(e.stack)&&e.stack.length>0?e.stack:void 0}catch{return}}getErrorPropertyFromObject(e){for(let t in e)if({}.hasOwnProperty.call(e,t)){let i=e[t];if(Dt(i))return i}}getObjectClassName(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},Iu=class{match(e){return kn(e)}coerce(e,t){var i;let s=e.constructor.name;return{type:s,value:`${s} captured as exception with keys: ${la(e)}`,stack:(i=t.syntheticException)===null||i===void 0?void 0:i.stack,synthetic:!0}}},Fu=class{match(e){return $o(e)}coerce(e,t){var i;return{type:"Error",value:`Primitive value captured as exception: ${String(e)}`,stack:(i=t.syntheticException)===null||i===void 0?void 0:i.stack,synthetic:!0}}},Tu=class{match(e){return Li(e,"PromiseRejectionEvent")||this.isCu
2stomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!kn(e))return!1;try{let t=e.detail;return t!=null&&typeof t=="object"&&"reason"in t}catch{return!1}}coerce(e,t){var i;let s=this.getUnhandledRejectionReason(e);return $o(s)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(s)}`,stack:(i=t.syntheticException)===null||i===void 0?void 0:i.stack,synthetic:!0}:t.apply(s)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&e.detail!=null&&typeof e.detail=="object"&&"reason"in e.detail)return e.detail.reason}catch{}return e}},Bi="$message",qi="$timestamp",Cu=new Set([Bi,qi]),fs={enabled:!0,max_bytes:32768};function Ui(e){var t;return e?{enabled:(t=e.enabled)!==null&&t!==void 0?t:fs.enabled,max_bytes:Au(e.max_bytes,fs.max_bytes)}:v({},fs)}var Mu=class{constructor(e){this.ns=[],this.ss=0,this.Rr=Ui(e)}setConfig(e){this.Rr=Ui(e),this.rs()}add(e){let t=(function(s){let n;try{n=Eo(s)}catch{return}try{let r=JSON.parse(n);if(!N(r))return;let o=r,a=o[Bi],l=o[qi];return!L(a)||a.trim().length===0||!L(l)&&!re(l)?void 0:{step:o,json:n}}catch{return}})(e);if(!t)return;let i=(function(s){if("u">typeof TextEncoder)return new TextEncoder().encode(s).length;let n=encodeURIComponent(s),r=0;for(let o=0;n.length>o;o++)n[o]==="%"?(r+=1,o+=2):r+=1;return r})(t.json);i>this.Rr.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.Rr.max_bytes&&this.ns.length>0;){let e=this.ns.shift();e&&(this.ss-=e.bytes)}}};function Au(e,t){if(!re(e)||e===1/0||e===-1/0)return t;let i=Math.floor(e);return 0>i?t:i}var or=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}};function ar(e){return typeof e=="string"||e}function lr(e){return typeof e=="string"?e:void 0}var Lu=["$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"],ua="NativeGzipValidationError",Zs=e=>e.length>=2&&e[0]===31&&e[1]===139,ur=(e,t)=>e===zs.GZipJS||t===zs.GZipJS||t==="gzip",cr=e=>!(!e||typeof e!="object")&&("name"in e?String(e.name):"")==="NotReadableError",jt,wi=e=>{throw ia(ua,`Native gzip produced invalid output: ${e}`)},Du=(dr=Z(function*(e,t){18>e.size&&wi("too-short");let i=new Uint8Array(yield e.slice(0,10).arrayBuffer());Zs(i)&&i[2]===8||wi("invalid-header");let s=new DataView(yield e.slice(e.size-8).arrayBuffer());s.getUint32(0,!0)!==(r=>{let o=(()=>{if(jt)return jt;jt=[];for(let l=0;256>l;l++){let u=l;for(let c=0;8>c;c++)u=1&u?3988292384^u>>>1:u>>>1;jt[l]=u>>>0}return jt})(),a=4294967295;for(let l=0;r.length>l;l++)a=o[255&(a^r[l])]^a>>>8;return(4294967295^a)>>>0})(t)&&wi("invalid-crc");let n=t.length>>>0;s.getUint32(4,!0)!==n&&wi("invalid-size")}),function(e,t){return dr.apply(this,arguments)}),dr;function Qs(){return Qs=Z(function*(e,t=!0,i){try{let n=new TextEncoder().encode(e),r=new globalThis.CompressionStream("gzip"),o=r.writable.getWriter(),a=o.write(n).then(()=>o.close()).catch((s=Z(function*(c){try{yield o.abort(c)}catch{}throw c}),function(c){return s.apply(this,arguments)})),l=new Response(r.readable).blob(),[u]=yield Promise.all([l,a]);return yield Du(u,n),u}catch(n){if(i?.rethrow)throw n;return t&&console.error("Failed to gzip compress data",n),null}var s}),Qs.apply(this,arguments)}function ca(e,t){if(e==null)return{};var i,s,n=(function(o,a){if(o==null)return{};var l={};for(var u in o)if({}.hasOwnProperty.call(o,u)){if(a.includes(u))continue;l[u]=o[u]}return l})(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(s=0;r.length>s;s++)t.includes(i=r[s])||{}.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}var Nu={}.propertyIsEnumerable;function Vi(e,t){try{return da(e,t,{ancestors:new WeakSet,remainingNodes:1e4}
2,0)}catch{return[]}}function Pn(e,t,i,s){if(0>=i.remainingNodes)return{stringValue:Ks};if(i.remainingNodes--,be(e))return{boolValue:e};if(typeof e=="bigint")return(function(n,r){let o=n.toString(),a=BigInt("9223372036854775808");return n>=a||-a>n?(r?.debug(`Attribute ${o} is outside the int64 range; encoding it as a string`),{stringValue:o}):{intValue:o}})(e,t);if(typeof e=="number"){if(!Number.isFinite(e))return{stringValue:String(e)};if(Number.isInteger(e)){if(Number.isSafeInteger(e))return{intValue:String(e)};if(typeof BigInt>"u")return{stringValue:String(e)};let n=BigInt(e).toString();return e>=9223372036854776e3||-9223372036854776e3>e?(t?.debug(`Attribute ${n} is outside the int64 range; encoding it as a string`),{stringValue:n}):{intValue:n}}return{doubleValue:e}}if(typeof e=="string")return{stringValue:Ot(e)};if(typeof e=="function")return{stringValue:"[Function]"};if(typeof e=="symbol")return{stringValue:String(e)};if(typeof e=="object"&&e!==null){if(i.ancestors.has(e))return{stringValue:"[Circular]"};if(s>=20)return{stringValue:Ks};if(e instanceof Date){let n=e.getTime(),r=Number.isFinite(n)?e.toISOString():String(e);return{stringValue:typeof r=="string"?Ot(r):String(r)}}i.ancestors.add(e);try{try{let n=e.toJSON;if(typeof n=="function")return Pn(n.call(e),t,i,s+1)}catch{}return C(e)?{arrayValue:{values:ju(e,t,i,s+1)}}:{kvlistValue:{values:da(e,t,i,s+1)}}}finally{i.ancestors.delete(e)}}return{stringValue:Ot(String(e))}}function ju(e,t,i,s){let n=[],r=Math.min(e.length,1e3),o=0;for(;r>o&&i.remainingNodes>0;o++)try{let a=o in e?e[o]:void 0;if(A(a))continue;n.push(Pn(a,t,i,s))}catch{n.push({stringValue:_i})}return e.length>o&&n.push({stringValue:Ks}),n}function da(e,t,i,s){let n=[];for(let r in e)if(Nu.call(e,r)){if(!r){t?.debug("Dropping an attribute with an empty key");continue}if(n.length>=1e3||0>=i.remainingNodes){t?.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{let o=e[r];if(se(o)||E(o))continue;n.push({key:Ot(r),value:Pn(o,t,i,s)})}catch{n.push({key:Ot(r),value:{stringValue:_i}})}}return n}function ha(e,t,i){return v(v(v(v({},ea({},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})}var Bu=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function pa(e,t){let i=ea({},e),s={};for(let n of Bu)({}).hasOwnProperty.call(i,n)&&(s[n]=i[n],delete i[n]);return[...Vi(i,t),...Vi(s,t)]}var hr={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"},va={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}},qu=va.info;function Uu(e){try{return Ot(String(e))}catch{return _i}}function Vu(e,t,i,s){let n=e.level||"info",{text:r,number:o}=va[n]||qu,a=(function(d=Date.now()){return String(d)+"000000"})(re(s)?s:void 0),l={};t.distinctId&&(l.posthogDistinctId=t.distinctId),t.sessionId&&(l.sessionId=t.sessionId),t.windowId&&(l["window.id"]=t.windowId),A(t.sessionStartTimestamp)||(l.sessionStartTimestamp=String(t.sessionStartTimestamp)),A(t.lastActivityTimestamp)||(l.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(l["url.full"]=t.currentUrl),t.screenName&&(l["screen.name"]=t.screenName),t.appState&&(l["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(l.feature_flags=t.activeFeatureFlags);let u=v({}
2,l),c=e.attributes;if(c){let d=[];try{d=Object.keys(c)}catch{d=[]}for(let p of d){let g;try{g=c[p]}catch{g=_i}Object.defineProperty(u,p,{value:g,enumerable:!0,writable:!0,configurable:!0})}}let h={timeUnixNano:a,observedTimeUnixNano:a,severityNumber:o,severityText:r,body:{stringValue:Uu(e.body)},attributes:Vi(u,i)};return e.trace_id&&(h.traceId=e.trace_id),e.span_id&&(h.spanId=e.span_id),E(e.trace_flags)||(h.flags=e.trace_flags),h}function fa(e,t,i){return ha(e,t,i)}function ga(e,t,i,s){return{resourceLogs:[{resource:{attributes:pa(t)},scopeLogs:[{scope:{name:i,version:s},logRecords:e}]}]}}var _a=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=sa(()=>{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 ma(){return .75+.5*Math.random()}function ya(e,t,i,s){let n=Math.min(Math.max(0,t-1),6),r=e*Math.pow(2,n);return Math.round((s===void 0?r:Math.min(r,Math.max(s,e)))*i)}var Hu=class{constructor(e,t,i,s,n,r=()=>Promise.resolve(),o){var a;this._instance=e,this.Rr=t,this.$=i,this.cs=s,this.ds=n,this.vs=r,this.fs=o,this.ps=new _a(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new ta,this.ks=0,this.Ss=1,this.xs=0,this.Cs=0,this.$s=!1,this.Ts=t.maxBufferSize,this.Is=Math.max((a=t.maxQueueSize)!==null&&a!==void 0?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(Le.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.Rr.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||!e?.body)return;let s=this.Os(e);if(s===null)return;if(!s.body)return void this.$.info("Log was rejected in beforeSend function");if(!this.Ds())return;let n={record:Vu(s,(i=t?.context)!==null&&i!==void 0?i:this.cs(),this.$,t?.occurredAtMs)};this.ds(()=>this.Ls(n))}Os(e){let t=this.Rr.beforeSend;if(!t)return e;let i=C(t)?t:[t],s=e;for(let n of i)try{let r=n(s);if(!r)return this.$.info("Log was rejected in beforeSend function"),null;s=r}catch(r){return this.$.error("Error in beforeSend function for log:",r),null}return s}Ds(){if(this.Rs===void 0)return!0;let e=Date.now(),t=e-this.xs;return this.Ps>t&&t>=0||(this.xs=e,this.Cs=0,this.$s=!1),this.Rs>this.Cs?(this.Cs++,!0):(this.$s||(this.$.warn(`captureLog dropping logs: exceeded ${this.Rs} logs per ${this.Ps}ms`),this.$s=!0),!1)}flush(){var e=this;return Z(function*(){if(!e._instance.isDisabled)return e.ys||(e.ys=e.Ns().finally(()=>{e.ys=null})),e.ys})()}Ns(){var e=this;return Z(function*(){var t;e.ps.clear();let i=(t=e._instance.getPersistedProperty(Le.LogsQueue))!==null&&t!==void 0?t:[];if(i.length===0)return;let s=i.length,n=0;for(;i.length>0&&s>n;){var r,o;let a=e._s;e.bs=0;let l=Math.min(i.length,e.Es),u=i.slice(0,l),c=ga(u.map(d=>d.record),e.qs(),(r=e.fs)!==null&&r!==void 0?r:e._instance.getLibraryId(),e._instance.getLibraryVersion()),h=yield e._instance.js(c);if(e._s!==a)return;if(h.kind==="too-large"&&u.length>1)e.Es=Math.max(1,Math.floor(u.length/2)),e.$.warn(`Logs batch of size ${u.length} was too large for the ingestion endpoint, reducing batch size to ${e.Es}`);else if(e.ws.record(h),e.ps.pending&&e.ps.arm(Math.max(e.Ms,e.ws.remainingMs())),h.kind==="retry-later"||(h.kind==="too-large"?e.$.warn("Dropping a single log record with batch size 1 \u2014 the record is larger than the server cap and cannot be split further."):h.kind==="ok"&&e.Rr.maxBatchRecordsPerPost>e.Es&&(e.Es=Math.min(e.Rr.maxBatchRecordsPerPost,e.Es+1)),yield e.Bs(u.length),i=(o=e._instance.getPersistedProperty(Le.LogsQueue))!==null&&o!==void 0?o:[],n+=u.length,h.kind==="fatal"))throw h.error}})()}Bs(e){var t=this;return Z(function*(){var i;let s=Math.max(0,e-t.bs),n=(i=t._instance.getPersistedProperty(Le.LogsQueue))!==null&&i!==void 0?i:[];
2t._instance.setPersistedProperty(Le.LogsQueue,n.slice(s)),yield t.vs()})()}qs(){return fa(this.Rr,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(e){var t;if(this._instance.optedOut)return;let i=(t=this._instance.getPersistedProperty(Le.LogsQueue))!==null&&t!==void 0?t:[];this.Is>i.length||(i.shift(),this.bs++,this.$.info("Logs queue is full, dropping oldest record.")),i.push(e),this._instance.setPersistedProperty(Le.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(ya(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){let e=this._instance.getPersistedProperty(Le.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return Z(function*(){t.ps.clear();let i=t.flush().catch(()=>{});e!==void 0?yield ir(i,e):yield i})()}flushWithTimeout(e){var t=this;return Z(function*(){let i=t.flush();yield ir(i,e,()=>{i.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},e=>{this.ks++,this.Ss=ma(),this.$.error("PostHog logs flush failed:",e)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.Hs())})}},gs=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function pr(e){return String(e)+"000000"}function vr(e,t,i,s){let n="";return s&&(n=Object.keys(s).sort().map(r=>`${JSON.stringify(r)}:${JSON.stringify(s[r])}`).join(",")),`${e}\0${t}\0${i??""}\0${n}`}var zu=class{constructor(e,t,i){this._instance=e,this.Rr=t,this.$=i,this.zs=new Map,this.ps=new _a(()=>this.flush().catch(s=>{this.$.error("Metrics flush failed:",s)})),this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.ws=new ta,this.ks=0,this.Ss=1,this.Gs=0}count(e,t=1,i){this.Zs({name:e,type:"count",value:t,unit:i?.unit,attributes:i?.attributes})}gauge(e,t,i){this.Zs({name:e,type:"gauge",value:t,unit:i?.unit,attributes:i?.attributes})}histogram(e,t,i){this.Zs({name:e,type:"histogram",value:t,unit:i?.unit,attributes:i?.attributes})}flush(){var e=this;let t=this.ys,i=(function(){var s=Z(function*(){t&&(yield t.catch(()=>{})),yield e.Qs()});return function(){return s.apply(this,arguments)}})()().finally(()=>{this.ys===i&&(this.ys=null)});return this.ys=i,i}drainWindow(){if(this.zs.size===0)return null;let e=this.zs;return this.zs=new Map,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.Js(e)}reset(){this.Gs++,this.ws.reset(),this.ks=0,this.Ss=1,this.ps.clear(),this.zs=new Map,this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set}Zs(e){if(this._instance.isDisabled||this._instance.optedOut)return;let t=this.Os(e);if(t===null)return;if(!t.name||typeof t.name!="string")return void this.$.warn("Dropping metric with empty name");if(typeof t.value!="number"||!Number.isFinite(t.value))return void this.$.warn(`Dropping metric '${t.name}': value must be a finite number`);if(t.type==="count"&&0>t.value)return void this.$.warn(`Dropping count '${t.name}': counters are monotonic, value must be >= 0`);let i,s;try{i=t.attributes?v({},t.attributes):void 0,s=vr(t.type,t.name,t.unit,i)}catch(o){return void this.$.warn(`Dropping metric '${t.name}': attributes could not be serialized`,o)}let n=this.zs.get(s);if(!n){if(!this.Ks())return;n={name:t.name,type:t.type,unit:t.unit,attributes:i,windowStartMs:Date.now()},this.zs.set(s,n)}let r=this.Ws.get(t.name);r===void 0?this.Ws.set(t.name,t.type):r===t.type||this.Vs.has(t.name)||(this.Vs.add(t.name),this.$.warn(`Metric name '${t.name}' is already used as a ${r}; recording it as a ${t.type} too will blend both series in charts. Use a distinct name.`)),this.Xs(n,t.value),this.Fs()}Ks(){return this.Rr.maxSeriesPerFlush>this.zs.size||(this.Us||(this.Us=!0,this.$.warn(`Metric series cap reached (${this.Rr.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=((i=e.total)!==null&&i!==void 0?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:new Array(gs.length+1).fill(0)});let s=e.hist;s.count+=1,s.sum+=t,s.min=Math.min(s.min,t),s.max=Math.max(s.max,t),s.bucketCounts[(function(n,r){for(let o=0;r.length>
2o;o++)if(r[o]>=n)return o;return r.length})(t,gs)]+=1;break}}}Os(e){let t=this.Rr.beforeSend;if(!t)return e;let i=C(t)?t:[t],s=e;for(let n of i)try{let r=n(s);if(!r)return this.$.info("Metric was rejected in beforeSend function"),null;s=r}catch(r){return this.$.error("Error in beforeSend function for metric:",r),null}return s}Fs(){this.ps.pending||this.ps.arm(this.Hs())}Hs(){return Math.max(ya(this.Rr.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Qs(){var e=this;return Z(function*(){if(e.ps.clear(),e.zs.size===0)return;let t=e.zs;e.zs=new Map,e.Us=!1,e.Ws=new Map,e.Vs=new Set;let i=e.Gs,s=yield e._instance.Ys(e.Js(t));if(i===e.Gs)switch(e.ws.record(s),s.kind==="retry-later"?(e.ks++,e.Ss=ma()):(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.$.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e.$.error("Failed to send metrics batch:",s.error)}})()}Js(e){return t=this.vo(e),i=(function(r,o,a){return ha(r,o,a)})(this.Rr,this._instance.getLibraryId(),this._instance.getLibraryVersion()),s=this._instance.getLibraryId(),n=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:pa(i)},scopeMetrics:[{scope:{name:s,version:n},metrics:t}]}]};var t,i,s,n}vo(e){let t=pr(Date.now()),i=new Map;for(let o of e.values()){var s;let a=vr(o.type,o.name,o.unit,void 0),l=i.get(a);l||(l=v({name:o.name},o.unit&&{unit:o.unit}),o.type==="count"?l.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:o.type==="gauge"?l.gauge={dataPoints:[]}:l.histogram={aggregationTemporality:1,dataPoints:[]},i.set(a,l));let u=Vi((s=o.attributes)!==null&&s!==void 0?s:{},this.$),c=pr(o.windowStartMs);if(o.type==="count"){var n;let h={attributes:u,startTimeUnixNano:c,timeUnixNano:t,asDouble:(n=o.total)!==null&&n!==void 0?n:0};l.sum.dataPoints.push(h)}else if(o.type==="gauge"){var r;let h={attributes:u,timeUnixNano:t,asDouble:(r=o.last)!==null&&r!==void 0?r:0};l.gauge.dataPoints.push(h)}else o.hist&&l.histogram.dataPoints.push({attributes:u,startTimeUnixNano:c,timeUnixNano:t,count:o.hist.count,sum:o.hist.sum,min:o.hist.min,max:o.hist.max,bucketCounts:o.hist.bucketCounts,explicitBounds:gs})}return Array.from(i.values())}ho(e){for(let[s,n]of e){let r=this.zs.get(s);if(r)switch(r.windowStartMs=Math.min(r.windowStartMs,n.windowStartMs),r.type){case"count":var t,i;r.total=((t=r.total)!==null&&t!==void 0?t:0)+((i=n.total)!==null&&i!==void 0?i:0);break;case"gauge":break;case"histogram":if(n.hist)if(r.hist){r.hist.count+=n.hist.count,r.hist.sum+=n.hist.sum,r.hist.min=Math.min(r.hist.min,n.hist.min),r.hist.max=Math.max(r.hist.max,n.hist.max);for(let o=0;r.hist.bucketCounts.length>o;o++)r.hist.bucketCounts[o]+=n.hist.bucketCounts[o]}else r.hist=n.hist}else this.Ks()&&this.zs.set(s,n)}}},ba=(e,{debugEnabled:t}={})=>{let i={N(s,...n){y&&(We.DEBUG||y.POSTHOG_DEBUG||t)&&!E(y.console)&&y.console&&("__rrweb_original__"in y.console[s]?y.console[s].__rrweb_original__:y.console[s])(e,...n)},debug(...s){i.N("debug",...s)},info(...s){i.N("log",...s)},warn(...s){i.N("warn",...s)},error(...s){i.N("error",...s)},critical(...s){console.error(e,...s)},uninitializedWarning(s){i.error(`You must initialize PostHog before calling ${s}`)},createLogger:(s,n)=>ba(`${e} ${s}`,n)};return i},k=ba("[PostHog.js]"),ne=k.createLogger,Wu=ne("[ExternalScriptsLoader]"),Hi=e=>{let t=x?.querySelectorAll("script");if(t){for(let i=0;t.length>i;i++)if(t[i].src===e||t[i].getAttribute("src")===e)return t[i]}},pt=(e,t,i)=>{if(e.config.disable_external_dependency_loading)return Wu.warn(`${t} was requested but loading of external scripts is disabled.`),i("Loading of external scripts is disabled");let s=Hi(t);if(s){if(s.__posthog_loading_callback_fired)return i();let r=s.__posthog_loading_error;return r?i(r):(s.addEventListener("load",o=>{s.__posthog_loading_callback_fired=!0,i(void 0,o)}),void s.addEventListener("error",o=>{s.__posthog_loading_error=o,i(o)}))}let n=()=>{if(!x)return i("document not found");if(Hi(t))return pt(e,t,i);let r=x.createElement("script");
2if(r.type="text/javascript",r.crossOrigin="anonymous",r.src=t,r.onload=a=>{r.__posthog_loading_callback_fired=!0,i(void 0,a)},r.onerror=a=>{r.__posthog_loading_error=a,i(a)},e.config.prepare_external_dependency_script&&(r=e.config.prepare_external_dependency_script(r)),!r)return i("prepare_external_dependency_script returned null");if(e.config.external_scripts_inject_target==="head")x.head.appendChild(r);else{let a=x.querySelectorAll("body > script");var o;a.length>0?(o=a[0].parentNode)===null||o===void 0||o.insertBefore(r,a[0]):x.body.appendChild(r)}};x?.body?n():x?.addEventListener("DOMContentLoaded",n)},_s={},fr=(e,t)=>{let i=`/static/${t}.js?v=${e.version}`;return t==="toolbar"&&(i=`${i}&t=${Math.floor(Date.now()/3e5)*3e5}`),e.requestRouter.endpointFor("assets",i)};F.__PosthogExtensions__=F.__PosthogExtensions__||{},F.__PosthogExtensions__.loadExternalDependency=(e,t,i)=>{if(t==="remote-config"){let n=e.requestRouter.endpointFor("assets",`/array/${e.config.token}/config.js`);return void pt(e,n,i)}let s=e.config.strict_script_versioning;if(s){let n=e.requestRouter.endpointFor("assets",`/static/${e.version}/${t}.js`),r=_s[n];if(s==="fallback"&&r){if(Hi(r))return void pt(e,r,i);delete _s[n]}return void pt(e,n,s==="fallback"?(o,a)=>{if(o)if(typeof o=="string")i(o);else{var l;let u=fr(e,t);_s[n]=u;let c=Hi(n);c==null||(l=c.parentNode)===null||l===void 0||l.removeChild(c),pt(e,u,i)}else i(void 0,a)}:i)}pt(e,fr(e,t),i)},F.__PosthogExtensions__.loadSiteApp=(e,t,i)=>{let s=e.requestRouter.endpointFor("api",t);pt(e,s,i)},We.DEBUG=!1,We.LIB_VERSION="1.434.15",We.LIB_NAME="web";var ae=We,Gu="$people_distinct_id",Ie="distinct_id",On="$device_id",ms="$device_model",zi="__alias",Yu="__cmpns",gr="$fbc",It="$fbc_persistence",_r="$fbp",Zt="$fbp_persistence",en="__timers",wa="$autocapture_disabled_server_side",tn="$heatmaps_enabled_server_side",sn="$exception_capture_enabled_server_side",Ea="$error_tracking_suppression_rules",nn="$error_tracking_capture_extension_exceptions",rn="$web_vitals_enabled_server_side",In="$dead_clicks_enabled_server_side",Fn="$product_tours_enabled_server_side",xa="$logs_capture_enabled_server_side",$a="$web_vitals_allowed_metrics",Qt="$session_recording_remote_config",Xu="$session_recording_enabled_server_side",Ku="$replay_sample_rate",Ju="$replay_override_sampling",Zu="$replay_override_linked_flag",Qu="$replay_override_url_trigger",ec="$replay_override_event_trigger",kt="$sesid",ka="$session_is_sampled",tc="$session_past_minimum_duration",ic="$session_recording_url_trigger_activated_session",sc="$session_recording_event_trigger_activated_session",nc="$debug_first_full_snapshot_timestamp",rc="$sess_rec_flush_size",Fe="$enabled_feature_flags",Ve="$active_feature_flags",on="$early_access_features",gt="$feature_flag_details",tt="$feature_flag_payloads",_t="$feature_flag_request_id",ei="$minimal_flag_called_events",Ae="$override_feature_flags",vt="$override_feature_flag_payloads",it="$stored_person_properties",st="$stored_group_properties",Sa="$groups",an="$surveys",Wi="$surveys_loaded_at",Ra="$surveys_activated",Pa="$surveys_activated_session",Oa="$surveys_activated_timestamps",ln="ph_product_tours",oc="$product_tours_activated",ac="$product_tours_activated_session",lc="$conversations_widget_session_id",uc="$conversations_ticket_id",cc="$conversations_widget_state",dc="$conversations_user_traits",nt="$flag_call_reported",Yt="$flag_call_reported_session_id",ci="$feature_flag_errors",rt="$feature_flag_evaluated_at",ye="$user_state",un="$client_session_props",hc="$capture_rate_limit",Ia="$initial_campaign_params",Fa="$initial_referrer_info",St="$initial_person_info",Tn="$epp",ys="$posthog_cookieless",Ta="$cookieless_mode",Ca="$sdk_debug_extensions_init_method",Ma="$sdk_debug_extensions_init_time_ms",Aa="$sdk_debug_recording_script_not_loaded",La="$sdk_debug_replay_stale_config",pc="$sdk_debug_replay_event_trigger_status",vc="$sdk_debug_replay_linked_flag_trigger_status",fc="$sdk_debug_replay_matched_recording_trigger_groups",gc="$sdk_debug_replay_pen
2ding_trigger_conditions",_c="$sdk_debug_replay_remote_trigger_matching_config",mc="$sdk_debug_replay_trigger_groups_count",yc="$sdk_debug_replay_url_trigger_status",bc="$session_recording_start_reason",Cn="PostHog loadExternalDependency extension not found.",He="anonymous",Ti="identified",Da="identified_only",di="visibilitychange",Gi="beforeunload",Mn="$pageview",mr="$pageleave",Na="$identify",yr="$groupidentify";function Rt(e,t){C(e)&&e.forEach(t)}function G(e,t){if(!A(e))if(C(e))e.forEach(t);else if((i=>i instanceof FormData)(e))e.forEach((i,s)=>t(i,s));else for(let i in e)$n.call(e,i)&&t(e[i],i)}var K=function(e,...t){for(let i of t)for(let s in i)i[s]!==void 0&&(e[s]=i[s]);return e};function Ci(e){let t=Object.keys(e),i=t.length,s=new Array(i);for(;i--;)s[i]=[t[i],e[t[i]]];return s}var wc=function(e){return function(...t){try{return e.apply(this,t)}catch(i){k.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),k.critical(i)}}},An=function(e){let t={};return G(e,function(i,s){(L(i)&&i.length>0||re(i))&&(t[s]=i)}),t};function ja(e){let t=v({},e);for(let i of["name","message","stack","cause","errors"])try{i in e&&(t[i]=e[i])}catch{}return t}var Ec=["herokuapp.com","vercel.app","netlify.app"];function xc(e){let t=e?.hostname;if(!L(t))return!1;let i=t.split(".").slice(-2).join(".");for(let s of Ec)if(i===s)return!1;return!0}function z(e,t,i,s){let{capture:n=!1,passive:r=!0}=s??{};e?.addEventListener(t,i,{capture:n,passive:r})}function cn(e){return e.name==="ph_toolbar_internal"}var ti=e=>{if(x){try{let t=e+"=",i=x.cookie.split(";").filter(s=>s.length);for(let s=0;i.length>s;s++){let n=i[s];for(;n.charAt(0)==" ";)n=n.substring(1,n.length);if(n.indexOf(t)===0)return decodeURIComponent(n.substring(t.length,n.length))}}catch{}return null}};Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return re(e)&&isFinite(e)&&Math.floor(e)===e});var $c=class dn{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,i,s,n){if(!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||!Number.isInteger(n)||0>t||0>i||0>s||0>n||t>0xffffffffffff||i>4095||s>1073741823||n>4294967295)throw new RangeError("invalid field value");let r=new Uint8Array(16);return r[0]=t/Math.pow(2,40),r[1]=t/Math.pow(2,32),r[2]=t/Math.pow(2,24),r[3]=t/Math.pow(2,16),r[4]=t/256,r[5]=t,r[6]=112|i>>>8,r[7]=i,r[8]=128|s>>>24,r[9]=s>>>16,r[10]=s>>>8,r[11]=s,r[12]=n>>>24,r[13]=n>>>16,r[14]=n>>>8,r[15]=n,new dn(r)}toString(){let t="";for(let i=0;this.bytes.length>i;i++)t=t+(this.bytes[i]>>>4).toString(16)+(15&this.bytes[i]).toString(16),i!==3&&i!==5&&i!==7&&i!==9||(t+="-");if(t.length!==36)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new dn(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(let i=0;16>i;i++){let s=this.bytes[i]-t.bytes[i];if(s!==0)return Math.sign(s)}return 0}},kc=class{generate(){let e=this.generateOrAbort();if(!E(e))return e;{this.Ct=0;let t=this.generateOrAbort();if(E(t))throw new Error("Could not generate UUID after timestamp reset");return t}}generateOrAbort(){let e=(()=>{let t=Date.now();return re(t)&&isFinite(t)?Math.min(Math.max(Math.floor(t),0),0xffffffffffff):0})();if(e>this.Ct)this.Ct=e,this.Mt();else{if(this.Ct>=e+1e4)return;this.It++,this.It>4398046511103&&(this.Ct++,this.Mt())}return $c.fromFieldsV7(this.Ct,Math.trunc(this.It/Math.pow(2,30)),this.It&Math.pow(2,30)-1,this.Tt.nextUint32())}Mt(){this.It=1024*this.Tt.nextUint32()+(1023&this.Tt.nextUint32())}constructor(){this.Ct=0,this.It=0,this.Tt=new Sc}},Ba=e=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new 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};y&&!E(y.crypto)&&crypto.getRandomValues&&(Ba=e=>crypto.getRandomValues(e));var Sc=class{nextUint32(){return this.Rt.length>this.$t||(Ba(this.Rt),this.$t=0),this.Rt[this.$t++]}constructor(){this.Rt=new Uint32Array(8),this.$t=1/0}},br,Te=()=>Rc().toString(),Rc=()=>(br||(br=new kc)).generate(),Bt="",Pc=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,yt=null,te={Et(){if(!se(yt))return yt;if(yt=!1,x)try{let e=`__ph_cookie_support_${Te()}`;te.At(e,"xyz"),yt=ti(e)==='"xyz"',te.Lt(e)}catch{yt=!1}return yt},Pt(e){k.error("cookieStore error: "+e)},Ot:ti,Dt(e){let t;try{t=JSON.parse(te.Ot(e))||{}}catch{}return t},At(e,t,i,s,n){if(!x)return!1;
2try{let r="",o="",a=(function(u,c){if(c){let h=(function(d,p=x){if(Bt)return Bt;if(!p||["localhost","127.0.0.1"].includes(d))return"";let g=d.split("."),m=Math.min(g.length,8),_="dmn_chk_"+Te();for(;!Bt&&m--;){let f=g.slice(m).join("."),b=_+"=1;domain=."+f+";path=/";p.cookie=b+";max-age=3",p.cookie.includes(_)&&(p.cookie=b+";max-age=0",Bt=f)}return Bt})(u);if(!h){let d=(p=>{let g=p.match(Pc);return g?g[0]:""})(u);d!==h&&k.info("Warning: cookie subdomain discovery mismatch",d,h),h=d}return h?"; domain=."+h:""}return""})(x.location.hostname,s);if(i){let u=new Date;u.setTime(u.getTime()+864e5*i),r="; expires="+u.toUTCString()}n&&(o="; secure");let l=e+"="+encodeURIComponent(JSON.stringify(t))+r+"; SameSite=Lax; path=/"+a+o;return l.length>3686.4&&k.warn("cookieStore warning: large cookie, len="+l.length),x.cookie=l,!0}catch{return!1}},Lt(e,t){if(x?.cookie&&(!t||!se(ti(e))))try{te.At(e,"",-1,t)}catch{return}}},bs=null,q={Et(){if(!se(bs))return bs;let e=!0;if(E(y))e=!1;else try{let t="__mplssupport__";q.At(t,"xyz"),q.Ot(t)!=='"xyz"'&&(e=!1),q.Lt(t)}catch{e=!1}return e||k.error("localStorage unsupported; falling back to cookie store"),bs=e,e},Pt(e){k.error("localStorage error: "+e)},Ot(e){try{return y?.localStorage.getItem(e)}catch(t){q.Pt(t)}return null},Dt(e){try{return JSON.parse(q.Ot(e))||{}}catch{}return null},At(e,t){try{return y?.localStorage.setItem(e,JSON.stringify(t)),!0}catch(i){q.Pt(i)}return!1},Lt(e){try{y?.localStorage.removeItem(e)}catch(t){q.Pt(t)}}},ws=[it,Ve,Fe,gt,tt,_t,rt,ci,nt],ft=[On,Ie,kt,ka,Tn,St,It,ye],Yi=e=>e+"_cpm",Oc=["__proto__","constructor","prototype"],Es=e=>{if(!N(e))return{};let t={};return Object.keys(e).forEach(i=>{Oc.indexOf(i)===-1&&(t[i]=e[i])}),t},xs=(e,t=[])=>{let i={};return[...ft,...t].forEach(s=>{let n=e[s];E(n)||se(n)||n===""||(i[s]=n)}),i},qa=e=>{let t=5381,i=2166136261;for(let s=0;e.length>s;s++){let n=e.charCodeAt(s);t=33*t^n,i=Math.imul(i^n,16777619)}return e.length.toString(36)+"."+(t>>>0).toString(36)+"."+(i>>>0).toString(36)},wr=(e,t)=>
2({p:t,f:qa(JSON.stringify(e))}),Er=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{let i=te.Dt(Yi(e)),s=i?.f===qa(t)&&C(i.p);return{properties:s?i.p:[],isValid:s}}catch{return{properties:[],isValid:!1}}},$s=(e,t)=>t+"|"+(te.Ot(Yi(e))||""),bt={},hn={Et:()=>!0,Pt(e){k.error("memoryStorage error: "+e)},Ot:e=>e in bt?bt[e]:null,Dt:e=>e in bt?bt[e]:null,At:(e,t)=>(bt[e]=t,!0),Lt(e){delete bt[e]}},lt=null,X={Et(){if(!se(lt))return lt;if(lt=!0,E(y))lt=!1;else try{let e="__support__";X.At(e,"xyz"),X.Ot(e)!=='"xyz"'&&(lt=!1),X.Lt(e)}catch{lt=!1}return lt},Pt(e){k.error("sessionStorage error: ",e)},Ot(e){try{return y?.sessionStorage.getItem(e)}catch(t){X.Pt(t)}return null},Dt(e){try{return JSON.parse(X.Ot(e))||null}catch{}return null},At(e,t){try{return y?.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(i){X.Pt(i)}return!1},Lt(e){try{y?.sessionStorage.removeItem(e)}catch(t){X.Pt(t)}}},Ic=class{constructor(e){this._instance=e}get Rr(){return this._instance.config}get consent(){return this.Lo()?0:this.No}isOptedOut(){return this.Rr.cookieless_mode==="always"||this.isRejected()||this.consent===-1&&this.Rr.cookieless_mode==="on_reject"}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Rr.opt_out_capturing_by_default}optInOut(e){this.qo.At(this.jo,e?1:0,this.Rr.cookie_expiration,this.Rr.cross_subdomain_cookie,this.Rr.secure_cookie)}reset(){this.qo.Lt(this.jo,this.Rr.cross_subdomain_cookie)}get jo(){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 No(){let e=this.qo.Ot(this.jo);return us(e)?1:M(Yl,e)?0:-1}get qo(){let e=this.Rr.opt_out_capturing_persistence_type,t=e==="localStorage"?q:te,i=t.Et()?t:hn;if(!this.Bo||this.Bo!==i){this.Bo=i;let s=e==="localStorage"?te:q;s.Ot(this.jo)&&(this.Bo.Ot(this.jo)||this.optInOut(us(s.Ot(this.jo))),s.Lt(this.jo,this.Rr.cross_subdomain_cookie))}return this.Bo}Lo(){return!!this.Rr.respect_dnt&&[de?.doNotTrack,de?.msDoNotTrack,F.doNotTrack,de?.globalPrivacyControl].some(e=>us(e))}};function Ua(e,t){var i;let s=e==null||(i=e.config)===null||i===void 0?void 0:i.get_current_url;if(!ce(s))return t;try{let n=s(t);return L(n)&&n?n:t}catch(n){return k.error("Error in get_current_url, falling back to window.location.href",n),t}}function xr(e){var t;return e instanceof Element&&(e.id==="__POSTHOG_TOOLBAR__"||!!(!((t=e.closest)===null||t===void 0)&&t.call(e,".toolbar-global-fade-container")))}function Ne(e){return!!e&&e.nodeType===1}function ve(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function Va(e){return!!e&&e.nodeType===3}function Ln(e){return!!e&&e.nodeType===11&&Ne(e.host)}function Dn(e){return e?is(e).split(/\s+/):[]}function $r(e,t){let i=(function(s){var n;let r=y==null||(n=y.location)===null||n===void 0?void 0:n.href;return E(r)?void 0:Ua(s,r)})(t);return!!(i&&e&&e.some(s=>i.match(s)))}function Ct(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 Dn(t)}function Ha(e){return A(e)?null:is(e).split(/(\s+)/).filter(t=>si(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function hi(e){let t="";return Ft(e)&&!pi(e)&&e.childNodes&&e.childNodes.length&&G(e.childNodes,function(i){var s;Va(i)&&i.textContent&&(t+=(s=Ha(i.textContent))!==null&&s!==void 0?s:"")}),is(t)}function ii(e){var t;return E(e.target)?e.srcElement||null:!((t=e.target)===null||t===void 0)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}var Nn=["a","button","form","input","select","textarea","label"];function pn(e,t){let i=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;try{return!!i&&i.call(e,t)}catch{return!1}}function vn(e,t){if(E(t))return!0;for(let i of e)if(t.some(s=>pn(i,s)))return!0;return!1}function za(e){let t=e.parentNode;return!(!t||!Ne(t))&&t}var ks=[".ph-no-autocapture","[data-ph-no-autocapture]"],Wa=["next","previous","prev",">","<"],Fc=[...Wa,"+","-","\u2212","\u2013"],kr=(e,t)=>
2/[a-z0-9]/i.test(t)?e.includes(t):e===t,Sr=[".ph-no-rageclick",".ph-no-capture"],Tc=["","text","search","email","password","url","tel","number"];function Ga(e,t){if(!y||jn(e))return!1;let i,s,n;var r,o;if(be(t)?(i=!!t&&Sr,s=void 0,n=!1):(i=(r=t?.css_selector_ignorelist)!==null&&r!==void 0?r:Sr,s=t?.content_ignorelist,n=(o=t?.ignore_text_selection)!==null&&o!==void 0&&o),i===!1||n&&(function(l){return!(!l||!Ne(l))&&(!!ve(l,"textarea")||(ve(l,"input")?M(Tc,(l.getAttribute("type")||"").toLowerCase()):(function(u){var c;if(u.isContentEditable)return!0;let h=(c=u.getAttribute)===null||c===void 0?void 0:c.call(u,"contenteditable");return h==="true"||h===""})(l)))})(e))return!1;let{targetElementList:a}=Ya(e,!1);return!(function(l,u){if(l===!1||E(l))return!1;let c;if(l===!0)c=Wa;else{if(!C(l))return!1;if(l.length>10)return k.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;c=l.map(h=>h.toLowerCase())}return u.some(({safeText:h,ariaLabel:d})=>c.some(p=>kr(h,p)||kr(d,p)))})(s,a.map(l=>{var u;return{safeText:hi(l).toLowerCase(),ariaLabel:((u=l.getAttribute("aria-label"))===null||u===void 0?void 0:u.toLowerCase().trim())||""}}))&&!vn(a,i)}var jn=e=>!e||ve(e,"html")||!Ne(e),Ya=(e,t)=>{if(!y||jn(e))return{parentIsUsefulElement:!1,targetElementList:[]};let i=!1,s=[e],n=e;for(;n.parentNode&&!ve(n,"body");){if(Ln(n.parentNode)){s.push(n.parentNode.host),n=n.parentNode.host;continue}let r=za(n);if(!r)break;if(t||Nn.indexOf(r.tagName.toLowerCase())>-1)i=!0;else try{let o=y.getComputedStyle(r);o&&o.getPropertyValue("cursor")==="pointer"&&(i=!0)}catch{}s.push(r),n=r}return{parentIsUsefulElement:i,targetElementList:s}};function Ft(e){let t=new Set,i=0;for(let r=e;r.parentNode&&!ve(r,"body");r=r.parentNode){if(i++>=1e3||t.has(r))return!1;t.add(r);let o=Ct(r);if(M(o,"ph-sensitive")||M(o,"ph-no-capture"))return!1}if(M(Ct(e),"ph-include"))return!0;let s=e.type||"";if(L(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}let n=e.name||e.id||"";return!L(n)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(n.replace(/[^a-zA-Z0-9]/g,""))}function pi(e){return!!(ve(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||ve(e,"select")||ve(e,"textarea")||e.getAttribute("contenteditable")==="true")}var Rr=new RegExp("^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$"),Pr=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Cc=[16,15,14,13],Mc=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Or=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Ir=/[0-9A-Za-z_]/;function Ac(e){let t=0,i=!1;for(let s=e.length-1;s>=0;s--){let n=e.charCodeAt(s)-48;i&&(n*=2,n>9&&(n-=9)),t+=n,i=!i}return t%10==0}function si(e,t=!0){return!(A(e)||L(e)&&(e=is(e),(t?Rr.test((e||"").replace(/[- ]/g,"")):(function(i){let s;for(Pr.lastIndex=0;s=Pr.exec(i);){let n=s[2];if(!n)continue;let r=n.replace(/[- ]/g,"");for(let o=0;r.length>o;o++)for(let a of Cc){let l=o+a;if(r.length>=l){let u=r.slice(o,l);if(Rr.test(u)&&Ac(u))return!0}}}return!1})(e))||(t?Mc.test(e):(function(i){let s;for(Or.lastIndex=0;s=Or.exec(i);){let n=s[1],r=s[3];if(!(n&&r&&Ir.test(n)&&Ir.test(r)))return!0}return!1})(e))))}function Fr(e){let t=hi(e);return t=`${t} ${Xa(e)}`.trim(),si(t)?t:""}function Xa(e){let t="";return e&&e.childNodes&&e.childNodes.length&&G(e.childNodes,function(i){var s;if(i&&((s=i.tagName)===null||s===void 0?void 0:s.toLowerCase())==="span")try{let n=hi(i);t=`${t} ${n}`.trim(),i.childNodes&&i.childNodes.length&&(t=`${t} ${Xa(i)}`.trim())}catch(n){k.error("[AutoCapture]",n)}}),t}function Tr(e){return e.replace(/"|\\"/g,'\\"')}function Lc(e){let t=e.attr__class;if(t)return C(t)?t:Dn(t)}var Ei=ne("[Dead Clicks]"),Dc=()=>!0,Nc=e=>{var t;let i=!!(!((t=e.instance.persistence)===null||t===void 0)&&t.get_property(In)),s=e.instance.config.capture_dead_clicks;return be(s)?s:!!N(s)||i},Cr=class{get lazyLoadedDeadClicksAutocapture(){return this.Ho}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({[In]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.zo(()=>{this.Uo()}):this.stop()}zo(e){var t,i,s;!((t=F.__PosthogExtensions__)===null||t===void 0)&&t.initDeadClicksAutocapture?e():(i=F.__PosthogExtensions__)===null||i===void 0||(s=i.loadExternalDependency)===null||s===void 0||s.call(i,this.instance,"dead-clicks-autocapture",n=>{n?Ei.error("failed to load script",n):e()})}Uo(){var e;
2if(x){if(!this.Ho&&(!((e=F.__PosthogExtensions__)===null||e===void 0)&&e.initDeadClicksAutocapture)){let t=N(this.instance.config.capture_dead_clicks)?v({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this.Ho=F.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.Ho.start(x),Ei.info("starting...")}}else Ei.error("`document` not found. Cannot start.")}stop(){this.Ho&&(this.Ho.stop(),this.Ho=void 0,Ei.info("stopping..."))}},qt=ne("[SegmentIntegration]");function Mr(e,t,i=!0){let s=e.config.segment;if(!s)return t();let{analytics:n,filterProperties:r}=(a=>ce(a.register))(o=s)?{analytics:o}:o;var o;(function(a,l,u,c){let h=p=>{let g=()=>p.anonymousId()||Te();a.config.get_device_id=g,c&&p.id()&&(a.register({distinct_id:p.id(),$device_id:g()}),a.persistence.set_property(ye,Ti)),u(c?void 0:p.anonymousId()||void 0)},d=l.user();"then"in d&&ce(d.then)?d.then(h):h(d)})(e,n,a=>{n.register(((l,u,{filterProperties:c}={})=>{typeof Promise<"u"&&Promise.resolve||qt.warn("This browser does not have Promise support, and can not use the segment integration");let h=(d,p)=>{if(!p)return d;let g=!!u&&d.event.anonymousId===u&&!d.event.userId;g||d.event.userId||d.event.anonymousId===l.get_distinct_id()||(qt.info("No userId set, resetting PostHog"),l.reset()),g||(u=void 0),d.event.userId&&d.event.userId!==l.get_distinct_id()&&(qt.info("UserId set, identifying with PostHog"),l.identify(d.event.userId));let m=l.calculateEventProperties(p,d.event.properties);if(!A(c)){let _=d.event.properties||{},f={};for(let w of Object.keys(m))$n.call(_,w)||(f[w]=m[w]);let b=((w,P)=>{let S=C(w)?w:[w],$=v({},P);for(let I of S)try{if($=I($),A($))return null}catch(R){return qt.error("Error in Segment filterProperties:",R),null}return $})(c,f);if(A(b))return d;m=b}return d.event.properties=Object.assign({},m,d.event.properties),d};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(d){return h(d,d.event.event)},page(d){return h(d,Mn)},identify(d){return h(d,Na)},screen(d){return h(d,"$screen")}}})(e,a,{filterProperties:r})).then(()=>{t()},l=>{qt.error("Failed to register the Segment integration",l),t()})},i)}var Ka="posthog-js";function Ja(e,{organization:t,projectId:i,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:r=!0}={}){return o=>{var a,l,u,c,h;if(n!=="*"&&!n.includes(o.level)||!e.__loaded)return o;o.tags||(o.tags={});let d=e.requestRouter.endpointFor("ui",`/project/${e.config.token}/person/${e.get_distinct_id()}`);o.tags["PostHog Person URL"]=d,e.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));let p=((a=o.exception)===null||a===void 0?void 0:a.values)||[],g=p.map(f=>v(v({},f),{},{stacktrace:f.stacktrace?v(v({},f.stacktrace),{},{type:"raw",frames:(f.stacktrace.frames||[]).map(b=>v(v({},b),{},{platform:"web:javascript"}))}):void 0})),m={$exception_message:((l=p[0])===null||l===void 0?void 0:l.value)||o.message,$exception_type:(u=p[0])===null||u===void 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:((c=p[
20])===null||c===void 0?void 0:c.value)||o.message,$sentry_exception_type:(h=p[0])===null||h===void 0?void 0:h.type,$sentry_tags:o.tags};var _;return t&&i&&(m.$sentry_url=(s||"https://sentry.io/organizations/")+t+"/issues/?project="+i+"&query="+o.event_id),r&&((_=e.exceptions)===null||_===void 0||_.sendExceptionEvent(m)),o}}var jc=class{constructor(e,t,i,s,n,r){this.name=Ka,this.setupOnce=function(o){o(Ja(e,{organization:t,projectId:i,prefix:s,severityAllowList:n,sendExceptionsToPostHog:r==null||r}))}}},Ar=class{constructor(e){this.Wo=(t,i,s)=>{s&&(s.noSessionId||s.activityTimeout||s.sessionPastMaximumLength||s.crossTabAdoption)&&(k.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:s}),this.Vo=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.Go()}Go(){var e;this.Zo=(e=this._instance.sessionManager)===null||e===void 0?void 0:e.onSessionId(this.Wo)}destroy(){var e;(e=this.Zo)===null||e===void 0||e.call(this),this.Zo=void 0}doPageView(e,t){var i;let s=this.Qo(e,t);return this.Vo={pathname:(i=y?.location.pathname)!==null&&i!==void 0?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var t;return this.Qo(e,(t=this.Vo)===null||t===void 0?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.Vo)===null||e===void 0?void 0:e.pageViewId}}Qo(e,t){let i=this.Vo;if(!i)return{$pageview_id:t};let s={$pageview_id:t,$prev_pageview_id:i.pageViewId},n=this._instance.scrollManager.getContext();if(n&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:r,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:u,maxContentY:c}=n;if(!(E(r)||E(o)||E(a)||E(l)||E(u)||E(c))){r=Math.ceil(r),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),c=Math.ceil(c);let h=r>1?De(o/r,0,1,k):1,d=r>1?De(a/r,0,1,k):1,p=l>1?De(u/l,0,1,k):1,g=l>1?De(c/l,0,1,k):1;s=K(s,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:h,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:d,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:c,$prev_pageview_max_content_percentage:g})}}return i.pathname&&(s.$prev_pageview_pathname=i.pathname),i.timestamp&&(s.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),s}},Ut=["flags","surveys"],Bc={[Gu]:{exposure:"hidden"},[zi]:{exposure:"hidden"},[Yu]:{exposure:"hidden"},[en]:{exposure:"hidden"},[It]:{exposure:"hidden"},[Zt]:{exposure:"hidden"},[wa]:{exposure:"event"},[tn]:{exposure:"hidden"},[xa]:{exposure:"hidden"},[sn]:{exposure:"event"},[Ea]:{exposure:"hidden"},[nn]:{exposure:"event"},[rn]:{exposure:"event"},[In]:{exposure:"event"},[Fn]:{exposure:"hidden"},[$a]:{exposure:"event"},[Qt]:{exposure:"hidden"},[Xu]:{exposure:"hidden"},[kt]:{exposure:"hidden"},[ka]:{exposure:"event"},[Ku]:{exposure:"event",shouldSkipFromEventProperties:e=>se(e)}
2,[tc]:{exposure:"event"},[ic]:{exposure:"event"},[sc]:{exposure:"event"},[nc]:{exposure:"event"},[rc]:{exposure:"hidden"},[Fe]:{exposure:"hidden",storageGroup:"flags"},[Ve]:{exposure:"hidden",storageGroup:"flags"},[on]:{exposure:"hidden"},[gt]:{exposure:"hidden",storageGroup:"flags"},[tt]:{exposure:"hidden",storageGroup:"flags"},[_t]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[ei]:{exposure:"hidden",storageGroup:"flags"},[Ae]:{exposure:"hidden"},[vt]:{exposure:"hidden"},[it]:{exposure:"hidden"},[st]:{exposure:"hidden"},[an]:{exposure:"hidden",storageGroup:"surveys"},[Wi]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[Ra]:{exposure:"event"},[Pa]:{exposure:"hidden"},[Oa]:{exposure:"hidden"},[ln]:{exposure:"hidden"},[oc]:{exposure:"hidden"},[ac]:{exposure:"hidden"},[lc]:{exposure:"event"},[uc]:{exposure:"event"},[cc]:{exposure:"event"},[dc]:{exposure:"event"},[nt]:{exposure:"hidden"},[Yt]:{exposure:"hidden"},[Sa]:{exposure:"event"},[ci]:{exposure:"hidden"},[rt]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[ye]:{exposure:"hidden"},[un]:{exposure:"hidden"},[hc]:{exposure:"hidden"},[Ia]:{exposure:"hidden"},[Fa]:{exposure:"hidden"},[St]:{exposure:"hidden"},[Tn]:{exposure:"hidden"},[Ju]:{exposure:"event"},[Zu]:{exposure:"event"},[Qu]:{exposure:"event"},[ec]:{exposure:"event"},[Ca]:{exposure:"event"},[Ma]:{exposure:"event"},[Aa]:{exposure:"event"},[La]:{exposure:"event"},[pc]:{exposure:"event"},[vc]:{exposure:"event"},[fc]:{exposure:"event"},[gc]:{exposure:"event"},[_c]:{exposure:"event"},[mc]:{exposure:"event"},[yc]:{exposure:"event"},[bc]:{exposure:"event"}},qc=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],he=e=>{let t=Bc[e];if(t)return t;for(let[i,s]of qc)if(e.indexOf(i)===0)return s},Pt=(e,t)=>{try{let i;return JSON.stringify(e,(s,n)=>{var r;return Dt(n)?((r=i)!==null&&r!==void 0||(i=new WeakMap),i.has(n)||i.set(n,ja(n)),i.get(n)):typeof n=="bigint"?n.toString():n},t)}catch{return Eo(e)}},Ge=e=>{let t=x?.createElement("a");return E(t)?null:(t.href=e,t)},Mt=function(e,t){let i=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s;for(let n=0;i.length>n;n++){let r=i[n].split("=");if(r[0]===t){s=r;break}}if(!C(s)||2>s.length)return"";{let n=s[1];try{n=decodeURIComponent(n)}catch{k.error("Skipping decoding for malformed query param: "+n)}return n.replace(/\+/g," ")}},vi=function(e,t,i){if(!e||!t||!t.length)return e;let s=e.split("#"),n=s[1],r=(s[0]||"").split("?"),o=r[1],a=r[0],l=(o||"").split("&"),u=[];for(let h=0;l.length>h;h++){let d=l[h].split("=");C(d)&&(t.includes(d[0])?u.push(d[0]+"="+i):u.push(l[h]))}let c=a;return o!=null&&(c+="?"+u.join("&")),n!=null&&(c+="#"+n),c},Xi=function(e,t){let i=e.match(new RegExp(t+"=([^&]*)"));return i?i[1]:null},Za=(e,t)=>e>=t&&wo(),Qa=(e,t,i,s)=>{if(e===0){if(wo()){let n=t+1;return n===i&&s(),n}return t}return 0},At=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Uc=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...At],fi="<masked>",Vc=["li_fat_id"];function el(e,t,i){if(!x)return{};let s=t?[...At,...i||[]]:[],n=tl(vi(x.URL,s,fi),e),r=(function(){let o={};return G(Vc,function(a){let l=ti(a);o[a]=l||null}),o})();return K(r,n)}function tl(e,t){let i=Uc.concat(t||[]),s={};return G(i,function(n){let r=Mt(e,n);s[n]=r||null}),s}function il(e){let t=(function(n){return n?n.search("https?://(.*)google.([^/?]*)")===0?"google":n.search("https?://(.*)bing.com")===0?"bing":n.search("https?://(.*)yahoo.com")===0?"yahoo":n.search("https?://(.*)duckduckgo.com")===0?"duckduckgo":null:null})(e),i=t!="yahoo"?"q":"p",s={};if(!se(t)){s.$search_engine=t;let n=x?Mt(x.referrer,i):"";n.length&&(s.ph_keyword=n)}return s}function sl(){return navigator.language||navigator.userLanguage}function Hc(){let e=sl();return typeof e=="string"?e.split("-")[0]:void 0}var Ki="$direct";function nl(){return x?.referrer||Ki}function rl(e,t,i=!1){let s=e?[...At,...t||[]]:[],n=i?ot(ie?.href):ie?.href,r=n?.substring(0,1e3);return{r:nl().substring(0,1e3),u:r?vi(r,s,fi):void 0}}function ol(e,t=!1){var i;let{r:s,u:n}=e,r=t?ot(n):n,o={$referrer:s,$referring_domain:s==null?void 0:s==Ki?Ki:(i=Ge(s))===null||i===void 0?void 0:i.host};
2if(r){o.$current_url=r;let a=Ge(r);o.$host=a?.host,o.$pathname=a?.pathname;let l=tl(r);K(o,l)}if(s){let a=il(s);K(o,a)}return o}function al(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function zc(){try{return new Date().getTimezoneOffset()}catch{return}}var Wc={flags:rt,surveys:Wi},Gc=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],xi=e=>`${e}_cookie_identity_change_pending`,$i=e=>{let t="",i=0;for(let s of e){let n=encodeURIComponent(JSON.stringify(s).slice(1,-1)).length;if(i+n>1e3)break;t+=s,i+=n}return t},oe="main",Ue=[Fe,Ve,gt,tt,_t,rt,ei,it],Ss=e=>Ue.indexOf(e)!==-1,ll=[It,Zt],Lr=e=>ll.indexOf(e)!==-1,Ze=(e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch{return e===t}},wt=e=>{if(!e)return{};let t=JSON.parse(e);return N(t)?t:{}},Dr=(e,t)=>{G(e,(i,s)=>{let n=he(s);n&&n.exposure!=="event"||{}.hasOwnProperty.call(t,s)||delete e[s]})},Rs=class{constructor(e,t,i=!0){if(this.Jo={},this.Ko=!1,this.Xo=!1,this.Yo=!1,this.ta=!1,this.ea=!1,this.ia=new Map,this.na=!1,this.sa=!1,this.ra=!1,this.oa=new Set,this.aa=new Set,this.Rr=e,this.la=i,this.props={},this.ua=void 0,this.ha=(s=>{let n="";return s.token&&(n=s.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),s.persistence_name?"ph_"+s.persistence_name:"ph_"+n+"_posthog"})(e),this.qo=this.ca(e),this.Yo=this.da(e),this.load(),this.va(),e.debug&&k.info("Persistence loaded",e.persistence,v({},this.props)),this.update_config(e,e,t),this.save(),y){let s=()=>this.flush();z(y,"beforeunload",s,{capture:!1}),z(y,"pagehide",s,{capture:!1}),this.fa=n=>{if(this.Ko&&(!n.storageArea||n.storageArea===y?.localStorage)&&n.key)if(n.key!==this.ha){if(this.Yo){let r=Ut.find(o=>n.key===this.pa(o));r&&this.ga(n.key,r)}}else this.ga(n.key,oe)},z(y,"storage",this.fa)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(([t,i])=>{let s=this.ia.get(t);if(!Ss(t)||s===!0)return;if(i===!0)return void this.ma(t,!0);let n=new Set(s||[]);i.forEach(r=>n.add(r)),n.size&&this.ma(t,n)})}onCrossTabFeatureFlagChange(e){return this.aa.add(e),()=>this.aa.delete(e)}destroy(){this.fa&&y&&(y.removeEventListener("storage",this.fa),this.fa=void 0),this.aa.clear()}ga(e,t,i=!0){if(this.mi)return!1;let s,n;try{if(n=q.Ot(e),se(n)){let a=this.ya(t);return a.storageValue=null,t!==oe&&(a.persisted=!1),!1}s=wt(n)}catch{return!1}let r=t===oe?s:q.Dt(this.ha);if(r&&this.ba(r))return!1;let o=this._a(s,t,i);return t===oe&&this.Yo&&!Ze(this.wa().main,s)||this.ka(s,t,!0,n),o}ba(e){let t=this.props[Ie],i=e[Ie];return!E(t)&&!E(i)&&t!==i}ka(e,t,i,s){let n=this.ya(t);n.storageValue=s,t!==oe&&(n.persisted=i);try{n.fingerprint=this.Sa(e,t)}catch{n.fingerprint=void 0}}_a(e,t,i){let s=!1;return Ue.forEach(n=>{var r;let o=(r=he(n))===null||r===void 0?void 0:r.storageGroup;if(t===oe&&this.Yo&&o||t!==oe&&o!==t)return;let a=n in e,l=this.xa(n,a?e[n]:void 0),u=this.ia.has(n)?n in this.props:a;u===n in this.props&&Ze(l,this.props[n])||(u?this.Ca(n,l,!1):this.$a(n,!1),s=!0)}),s&&i&&this.aa.forEach(n=>n()),s}Ta(){if(!this.Ko)return!1;try{this.ra=!1;let e=q.Ot(this.ha),t=this.ya(oe),i,s=!1,n=!1;if(e!==t.storageValue)if(se(e))t.storageValue=null;else{if(i=wt(e),this.ra=!this.sa&&this.ba(i),this.ra)return!1;n=this._a(i,oe,!1),!this.Yo||Ze(this.wa().main,i)?this.ka(i,oe,!0,e):t.storageValue=e,s=!0}return this.Yo&&Ut.forEach(r=>{let o=q.Ot(this.pa(r)),a=this.ya(r),l=i||{},u=s&&Ue.some(h=>{var d;return((d=he(h))===null||d===void 0?void 0:d.storageGroup)===r&&h in l});if(o===a.storageValue&&!u)return;if(se(o))return a.storageValue=null,a.persisted=!1,void(u&&(n=this._a(l,r,!1)||n));let c=wt(o);n=this._a(c,r,!1)||n,this.ka(c,r,!0,o)}),n}catch{return!1}}ma(e,t){this.ia.set(e,t);let i=he(e);i?.volatile||(this.ya((this.Yo?i?.storageGroup:void 0)||oe).fingerprint=void 0,this.Ia(e))}Ma(){Ue.forEach(e=>this.ia.set(e,!0))}va(){if(this.Ko)try{let e=q.Ot(this.ha),t=wt(e);this.ya(oe).storageValue=e,Ue.forEach(i=>{var s;let n=this.Yo?(s=he(i))===null||s===void 0?void 0:s.storageGroup:void 0,r=n?q.Ot(this.pa(n)):null;if(n){let a=this.ya(n);a.storageValue=r,a.persisted=!se(r)}let o=n&&!se(r)?wt(r):t;i in this.props?this.Ea(i,o[i],this.props[i]):i in o&&this.ma(i,!0)})}catch{}}xa(e,t){let i=this.ia.get(e);if(!i)return t;if(i===!0)return this.props[e];if(e==="$active_feature_flags"){let r=new Set(C(t)?t:[]),o=new Set(C(this.props[e])?this.props[e]:[]);
2return i.forEach(a=>o.has(a)?r.add(a):r.delete(a)),Array.from(r)}let s=N(t)?v({},t):{},n=N(this.props[e])?this.props[e]:{};return i.forEach(r=>{r in n?s[r]=n[r]:delete s[r]}),s}Ea(e,t,i){if(!Ss(e))return;let s=this.ia.get(e);if(s===!0)return;let n=t;if(this.Ko)try{var r;let a=this.Yo?(r=he(e))===null||r===void 0?void 0:r.storageGroup:void 0,l=a?this.pa(a):this.ha;n=wt(q.Ot(l))[e]}catch{}let o=new Set(s||[]);if(e==="$active_feature_flags"){if(!E(t)&&!C(t)||!E(n)&&!C(n)||!C(i))return void this.ma(e,!0);let a=new Set(t||[]),l=new Set(n||[]),u=new Set(i);new Set([...a,...u]).forEach(c=>{a.has(c)!==u.has(c)&&o.add(c)}),o.forEach(c=>{l.has(c)===u.has(c)&&o.delete(c)})}else{if(!N(i))return void(Ze(n,i)?this.ia.delete(e):this.ma(e,!0));{if(!E(t)&&!N(t)||E(t)&&xe(i)&&E(n))return void this.ma(e,!0);let a=N(t)?t:{},l=N(n)?n:{};new Set([...Object.keys(a),...Object.keys(i)]).forEach(u=>{u in a==u in i&&Ze(a[u],i[u])||o.add(u)}),o.forEach(u=>{u in l==u in i&&Ze(l[u],i[u])&&o.delete(u)})}}o.size?this.ma(e,o):this.ia.delete(e)}Pa(){var e;let t=(e=this.Rr)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return re(t)&&t>0?t:0}Ra(e){if(this.Rr.cookieWinsOnConflict&&this.Rr.persistence.toLowerCase()==="localstorage+cookie")if(e)try{let t=xs(e,this.Rr.cookie_persisted_properties||[]),i=wr(t,this.Rr.cookie_persisted_properties||[]),s=JSON.stringify(t)+"|"+JSON.stringify(i),n=te.Ot(this.ha)||void 0;n&&$s(this.ha,n)===s&&(this.Aa=s,this.Fa=n)}catch{}else try{let t=te.Ot(this.ha)||void 0;this.Aa=t?$s(this.ha,t):void 0,this.Fa=t}catch{}}syncCookieProperties(){return this.Oa(this.Rr)}Oa(e,t=!1){if(this.mi&&!t||this.ea||!e.cookieWinsOnConflict||e.persistence.toLowerCase()!=="localstorage+cookie")return!1;let i;try{i=te.Ot(this.ha)||void 0}catch{}if(!i||i===this.Fa)return!1;let s=$s(this.ha,i),n;try{n=Es(JSON.parse(i))}catch{return!1}if((te.Ot(this.ha)||void 0)!==i)return!1;this.Aa=s,this.Fa=i;let r=Er(this.ha,i),o=[...ft,...r.properties],a={};if(Object.keys(n).forEach(m=>{let _=n[m];(E(_)||se(_)||_===""||m==="$user_state"&&_!=="anonymous"&&_!=="identified")&&(a[m]=!0,delete n[m])}),xe(n))return!1;let l="distinct_id"in n||n.$user_state==="anonymous"||n.$user_state==="identified",u=this.props,c=u[Ie],h=u[ye],d=K({},u);[...ft,...e.cookie_persisted_properties||[]].forEach(m=>{if(o.indexOf(m)!==-1&&!(m in n)&&!a[m]&&(l||m!=="distinct_id"&&m!=="$user_state")){let _=d[m];(r.isValid||ft.indexOf(m)===-1||_!==!1&&_!==0)&&delete d[m]}}),this.props=K(d,n),Ue.forEach(m=>{let _=m in this.props;m in u===_&&Ze(u[m],this.props[m])||(_?this.Ea(m,u[m],this.props[m]):this.ma(m,!0))}),!l||"$user_state"in n||"$user_state"in this.props||this.Ca(ye,He);let p=this.props[Ie],g=this.props[ye];return!l||p===c&&g===h||(this.sa=!0,this.ta=!0,X.At(xi(this.ha),!0),this.$a(it),this.$a(Ve),this.$a(Fe),this.$a(gt),this.$a(tt),this.$a(_t),this.$a(rt),this.$a(ci),this.$a(nt),g!=="anonymous"||h!=="identified"&&n.$user_state!=="anonymous"&&(E(c)||p===c)||(Dr(this.props,n),this.$a(st)),g==="identified"?this.props.$user_id=p:delete this.props.$user_id,this.$a(zi)),!0}
2consumeCookieIdentityChange(){let e=xi(this.ha),t=this.ta||!!X.Ot(e);return this.ta=!1,t&&X.Lt(e),t}Da(e=!1){return!(this.ea||this.mi&&!e||!this.Rr.cookieWinsOnConflict||this.Rr.persistence.toLowerCase()!=="localstorage+cookie"||(this.ea=!0,0))}La(){this.ea&&(E(this.Na)||(clearTimeout(this.Na),this.Na=void 0),delete this.Jo[oe],this.qa(!0))}ja(e=!0){if(this.ea)try{e?this.La():E(this.Na)||(clearTimeout(this.Na),this.Na=void 0)}finally{this.ea=!1}}isDisabled(){return!!this.mi}ca(e){Gc.indexOf(e.persistence.toLowerCase())===-1&&(k.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");let t=((o=[],a=!1)=>{let l=[...ft,...o];return v(v({},q),{},{Dt(u){try{let h,d={};try{h=te.Ot(u)||void 0,d=h?Es(JSON.parse(h)):{}}catch{}let p=JSON.parse(q.Ot(u)||"{}"),g;if(a){let m=Er(u,h),_=[...ft,...m.properties],f={};Object.keys(d).forEach(w=>{let P=d[w];se(P)||P===""||w==="$user_state"&&P!=="anonymous"&&P!=="identified"||(f[w]=P)});let b="distinct_id"in f||f.$user_state==="anonymous"||f.$user_state==="identified";if(Object.keys(f).length>0){var c;let w=p[Ie],P=(c=p.$user_state)!==null&&c!==void 0?c:He;l.forEach(S=>{if(_.indexOf(S)!==-1&&!(S in d)&&(b||S!=="distinct_id"&&S!=="$user_state")){let $=p[S];(m.isValid||ft.indexOf(S)===-1||$!==!1&&$!==0)&&delete p[S]}}),!b||"$user_state"in d||"$user_state"in p||(p[ye]=He),!b||("distinct_id"in f?f[Ie]:p[Ie])===w&&("$user_state"in f?f[ye]:p[ye])===P||(ws.forEach(S=>delete p[S]),f.$user_state==="identified"&&"distinct_id"in f?p.$user_id=f[Ie]:delete p.$user_id,f.$user_state!=="identified"&&(delete p[Sa],delete p[st]),delete p.__alias)}g=K(p,f)}else g=K(d,p);return q.At(u,g),g}catch{}return null},At(u,c,h,d,p,g){let m=q.At(u,c,void 0,void 0,g);try{let _=xs(c,o);if(Object.keys(_).length){if(a){let f=Yi(u),b=wr(_,o);if(te.At(f,b,h,d,p,g),te.Ot(f)!==JSON.stringify(b)){te.Lt(f,d);let w=xs(c);return te.At(u,w,h,d,p,g),m}}te.At(u,_,h,d,p,g)}}catch(_){q.Pt(_)}return m},Lt(u,c){try{y?.localStorage.removeItem(u),te.Lt(u,c),te.Lt(Yi(u),c)}catch(h){q.Pt(h)}}})})(e.cookie_persisted_properties||[],e.cookieWinsOnConflict),i,s=!1,n=!1,r=e.persistence.toLowerCase();return r==="localstorage"&&q.Et()?(i=q,n=!0):r==="localstorage+cookie"&&t.Et()?(i=t,n=!0,s=!0):r==="sessionstorage"&&X.Et()?i=X:r==="memory"?i=hn:r==="cookie"&&te.Et()?(i=te,s=!0):t.Et()?(i=t,n=!0,s=!0):te.Et()?(i=te,s=!0):i=hn,this.Ko=n,this.Xo=s,i}pa(e){return`${this.ha}__${e}`}da(e){return this.Ko&&!!e.split_storage}properties(){let e={};return G(this.props,(t,i)=>{let s=he(i);if(!s||s.exposure==="event"){var n;if(!(s==null||(n=s.shouldSkipFromEventProperties)===null||n===void 0)&&n.call(s,t))return;e[i]=t}}),e}load(e=!1){if(this.mi&&!e)return;let t=this.Rr.cookieWinsOnConflict&&this.Rr.persistence.toLowerCase()==="localstorage+cookie",i=t?q.Dt(this.ha):null,s={};if(t)try{s=Es(te.Dt(this.ha)),G(s,(a,l)=>{(E(a)||se(a)||a==="")&&delete s[l]})}catch{}let n=this.qo.Dt(this.ha);if(n&&(this.props=K({},n)),this.Yo&&this.Ba(),t&&n){var r,o;let a=i?.[Ie],l=(r=i?.$user_state)!==null&&r!==void 0?r:He,u=n[Ie],c=(o=n.$user_state)!==null&&o!==void 0?o:He;if(u!==a||c!==l){this.ta=!0,X.At(xi(this.ha),!0);let h=K({},this.props);ws.forEach(p=>delete h[p]),c!=="anonymous"||l!=="identified"&&s.$user_state!=="anonymous"&&(E(a)||u===a)||(Dr(h,s),delete h[st]),this.props=h;let d=new Set;ws.forEach(p=>{var g;let m=(g=he(p))===null||g===void 0?void 0:g.storageGroup;m&&d.add(m)}),d.forEach(p=>{let g={};G(this.props,(m,_)=>{var f;((f=he(_))===null||f===void 0?void 0:f.storageGroup)===p&&(g[_]=m)}),xe(g)?(q.Lt(this.pa(p)),this.Jo[p]={}):q.At(this.pa(p),g)&&(this.Jo[p]={persisted:!0,fingerprint:this.Sa(g,p)})})}}X.Ot(xi(this.ha))&&(this.ta=!0)}Ba(){for(let e of Ut){let t=q.Dt(this.pa(e));if(t&&!xe(t)){let i=this.ya(e);i.persisted=!0,this.Ha(e)||(i.fingerprint=this.Sa(t,e)),this.za(e,t)||K(this.props,t)}}}Ha(e){return Object.keys(this.props).some(t=>{var i;return((i=he(t))===null||i===void 0?void 0:i.storageGroup)===e})}za(e,t){let i=Wc[e];if(!i)return!1;let s=t[i],n=this.props[i];return re(s)&&re(n)&&n>s}refreshKey(e){var t;if(this.mi||this.oa.has(e))return;let i=this.Yo?(t=he(e))===null||t===void 0?void 0:t.storageGroup:void 0,s=i?q.Dt(this.pa(i)):this.qo.Dt(this.ha);if(s&&e in s)this.Ca(e,s[e],!1);else{if(i){let n=this.qo.Dt(this.ha);if(n&&e in n)return void this.Ca(e,n[e],!1)}this.$a(e,!1)}}save(){if(this.mi)return;let e=this.Pa();e>0?E(this.Na)&&(this.Na=setTimeout(()=>{this.Na=void 0,this.qa()},e)):this.qa()}flush(){E(this.Na)||(clearTimeout(this.Na),this.Na=void 0,this.qa())}qa(e=!1){if(this.mi||this.ea&&!e)return;e||(this.syncCookieProperties(),this.Rr.cookieWinsOnConflict&&this.Rr.persistence.toLowerCase()==="localstorage+cookie"||ll.forEach(n=>this.refreshKey(n)));let t=!e&&!this.na;t||(this.ra=!1);let i=!!t&&this.Ta();
2if(this.ra)return void(this.Rr.debug&&k.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this.Yo)return this.Ua(),void(i&&this.aa.forEach(n=>n()));let s=this.Wa(this.qo,this.ha,this.props,oe);s==="written"&&this.Ra(this.props),s!=="failed"&&(this.ia.clear(),this.sa=!1,this.oa.clear()),i&&this.aa.forEach(n=>n())}Ua(){let{main:e,groups:t}=this.wa(),i=this.Wa(this.qo,this.ha,e,oe);i==="written"&&this.Ra(e),i!=="failed"&&(this.sa=!1,this.oa.clear(),Ue.forEach(n=>{var r;!((r=he(n))===null||r===void 0)&&r.storageGroup||this.ia.delete(n)}));for(let n of Ut){var s;let r=t[n];if(xe(r)&&!(!((s=this.Jo[n])===null||s===void 0)&&s.persisted)){Ue.forEach(a=>{var l;((l=he(a))===null||l===void 0?void 0:l.storageGroup)===n&&this.ia.delete(a)});continue}let o=this.Wa(q,this.pa(n),r,n);o!=="failed"&&Ue.forEach(a=>{let l=he(a);l?.storageGroup!==n||o!=="written"&&l.volatile||this.ia.delete(a)})}}wa(){let e={},t={flags:{},surveys:{}};return G(this.props,(i,s)=>{var n;let r=(n=he(s))===null||n===void 0?void 0:n.storageGroup;r?t[r][s]=i:e[s]=i}),{main:e,groups:t}}Sa(e,t){if(t===oe)return JSON.stringify(e)+"|"+this.Va+"|"+this.Ga+"|"+this.Za;let i={};return G(e,(s,n)=>{var r;i[n]=!((r=he(n))===null||r===void 0)&&r.volatile?"__volatile__":s}),JSON.stringify(i)}Wa(e,t,i,s){let n=this.ya(s);if(s!==oe&&!n.dirty&&!E(n.fingerprint))return"skipped";let r;try{if(r=this.Sa(i,s),r===n.fingerprint)return n.dirty=!1,"skipped"}catch{r=void 0}return e.At(t,i,this.Va,this.Ga,this.Za,this.Rr.debug)?(n.dirty=!1,s!==oe&&(n.persisted=!0),E(r)||(n.fingerprint=r),this.Ko&&(n.storageValue=q.Ot(t)),"written"):(this.Rr.debug&&k.warn(`failed to persist storage entry "${t}"; will retry on next save`),"failed")}remove({keepGroupEntries:e=!1}={}){if(this.Ma(),E(this.Na)||(clearTimeout(this.Na),this.Na=void 0),this.qo.Lt(this.ha,!1),this.qo.Lt(this.ha,!0),!e&&this.la)for(let t of Ut)q.Lt(this.pa(t));e?delete this.Jo[oe]:this.Jo={},this.Aa=void 0,this.Fa=void 0}clear(){this.remove(),this.props={}}register_once(e,t,i){if(N(e)){this.syncCookieProperties(),E(t)&&(t="None"),this.Va=E(i)?this.Qa:i;let s=!1;if(G(e,(n,r)=>{this.props.hasOwnProperty(r)&&this.props[r]!==t||(this.Ca(r,n),s=!0)}),s)return this.save(),!0}return!1}register(e,t){if(N(e)){this.syncCookieProperties(),this.Va=E(t)?this.Qa:t;let i=!1;if(G(e,(s,n)=>{e.hasOwnProperty(n)&&(this.props[n]!==s||N(s)||C(s))&&(this.Ca(n,s),i=!0)}),i)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();let t=typeof e=="string"?[e]:e,i=!1;for(let s of t)s in this.props&&(this.$a(s),i=!0);i&&this.save()}update_campaign_params(){let e=x?.URL;if(e===this.ua)return;let t=el(this.Rr.custom_campaign_params,this.Rr.mask_personal_data_properties,this.Rr.custom_personal_data_properties),i=!xe(An(t));return i&&this.register(t),this.ua=e,i?t:void 0}update_search_keyword(){this.register((function(){let e=x?.referrer;return e?il(e):{}})())}update_referrer_info(){var e;this.register_once({$referrer:nl(),$referring_domain:x?.referrer&&((e=Ge(x.referrer))===null||e===void 0?void 0:e.host)||Ki},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;let e=rl(this.Rr.mask_personal_data_properties,this.Rr.custom_personal_data_properties,this.Rr.disable_capture_url_hashes);this.register_once({[St]:this.Xo?{r:$i(e.r),u:e.u?$i(e.u):void 0}:e},void 0)}get_initial_props(){let e={};G([Fa,Ia],i=>{let s=this.props[i];s&&G(s,function(n,r){e["$initial_"+Ws(r)]=n})});let t=this.props[St];
2if(t){let i=(function(s,n=!1){let r=ol(s,n),o={};return G(r,function(a,l){o[`$initial_${Ws(l)}`]=a}),o})(t,this.Rr.disable_capture_url_hashes);K(e,i)}return e}safe_merge(e){return G(this.props,function(t,i){i in e||(e[i]=t)}),e}update_config(e,t,i){let s=e.persistence!==t.persistence,n=!((p,g)=>{if(p.length!==g.length)return!1;let m=[...p].sort(),_=[...g].sort();return m.every((f,b)=>f===_[b])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),r=s||n,o=e.cookieWinsOnConflict!==t.cookieWinsOnConflict,a=e.disable_persistence||!!i,l=!!this.mi&&!a;a||this.Oa(t,l),this.Rr=e,!a&&(s||n||o)&&(this.Aa=void 0,this.Fa=void 0,this.Oa(v(v({},e),{},{cookie_persisted_properties:t.cookie_persisted_properties}),l));let u=r||o?this.ca(e):this.qo;this.Ja();let c=this.da(e),h=r||c!==this.Yo,d=!a&&(h||e.cross_subdomain_cookie!==this.Ga||e.secure_cookie!==this.Za)&&this.Da(l);this.na=h;try{if(this.Qa=this.Va=e.cookie_expiration,this.set_disabled(a),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),h){let p=this.props;this.clear(),this.qo=u,this.Yo=c,this.props=p,this.save()}else o&&(this.qo=u,a||(delete this.Jo[oe],this.qa()))}finally{this.na=!1,d&&this.ja()}}Ja(){let e=this.props[St];
2if(!this.Xo||!N(e)||typeof e.r!="string")return;let t=$i(e.r),i=typeof e.u=="string"?$i(e.u):e.u;t===e.r&&i===e.u||this.Ca(St,v(v({},e),{},{r:t,u:i}))}set_disabled(e){this.mi=e,this.mi?this.remove():this.save()}set_cross_subdomain(e){e!==this.Ga&&(this.Ga=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.Za&&(this.Za=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){let i=this.props.__timers||{};i[e]=t,this.Ca(en,i),this.save()}remove_event_timer(e){let t=this.props.__timers||{},i=t[e];return E(i)||(delete t[e],this.Ca(en,t),this.save()),i}get_property(e){return this.props[e]}set_property(e,t){this.Ca(e,t),this.save()}Ca(e,t,i=!0){var s;let n=this.props[e];this.props[e]=t,i&&(e!=="distinct_id"&&e!=="$user_state"||n===t||(this.sa=!0),Lr(e)&&!Ze(n,t)&&this.oa.add(e),this.Ea(e,n,t),!((s=he(e))===null||s===void 0)&&s.volatile||this.Ia(e))}$a(e,t=!0){delete this.props[e],t&&(Ss(e)&&this.ma(e,!0),Lr(e)&&this.oa.add(e),this.Ia(e))}Ia(e){var t;let i=(t=he(e))===null||t===void 0?void 0:t.storageGroup;i&&(this.ya(i).dirty=!0)}ya(e){return this.Jo[e]||(this.Jo[e]={})}},ke={GZipJS:"gzip-js",Base64:"base64"},Vt={Activation:"events",Cancellation:"cancelEvents"},fh={Button:"button",Tab:"tab",Selector:"selector"},gh={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"},_h={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},Ps={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},mh={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},yh={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},bh={Once:"once",Recurring:"recurring",Always:"always"},ze={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Os={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date",SURVEY_LANGUAGE:"$survey_language"},fn={Popover:"popover",Inline:"inline"};function ki(e){let t=!0;return{dispose(){if(t){t=!1;let i=e();i&&ce(i.then)&&i.then(void 0,()=>{})}}}}var wh={backgroundColor:"#ffffff",textColor:"#1d1f27",buttonColor:"#1d1f27",borderRadius:8,buttonBorderRadius:6,borderColor:"#e5e7eb",fontFamily:"system-ui",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",showOverlay:!0,whiteLabel:!1,dismissOnClickOutside:!0,zIndex:2147483646},Yc={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"},Nr={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"},jr=ne("[RateLimiter]"),Xc=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{let i=t.text;
2if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach(s=>{jr.info(`${s||"events"} is quota limited.`),this.serverLimits[s]=new Date().getTime()+6e4})}catch(s){return void jr.warn(`could not rate limit - continuing. Error: "${s?.message}"`,{text:i})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)===null||e===void 0?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)===null||e===void 0?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e=!1){var t,i,s;let{captureEventsBurstLimit:n,captureEventsPerSecond:r}=this,o=new Date().getTime(),a=(t=(i=this.instance.persistence)===null||i===void 0?void 0:i.get_property("$capture_rate_limit"))!==null&&t!==void 0?t:{tokens:n,last:o};a.tokens+=(o-a.last)/1e3*r,a.last=o,a.tokens>n&&(a.tokens=n);let l=1>a.tokens;if(l||e||(a.tokens=Math.max(0,a.tokens-1)),l&&!e){let u=(re(a.dropped)?a.dropped:0)+1;a.dropped=u,!this.lastEventRateLimited&&this.Ka(u)&&(a.dropped=0)}return this.lastEventRateLimited=l,(s=this.instance.persistence)===null||s===void 0||s.set_property("$capture_rate_limit",a),{isRateLimited:l,remainingTokens:a.tokens}}Xa(e){let t=this.instance.config.property_denylist;return!C(t)||!t.includes(e)}Ya(){var e;if(this.Xa("$current_url")&&this.Xa("$pathname")&&ie?.pathname)return`${(e=ie.origin)!==null&&e!==void 0?e:""}${ie.pathname}`}Ka(e){var t,i;let{captureEventsBurstLimit:s,captureEventsPerSecond:n}=this,r=this.Ya(),o=this.Xa("$session_id")?(t=(i=this.instance).get_session_id)===null||t===void 0?void 0:t.call(i):void 0,a=[`${e} event(s) dropped since the last warning`,r?`triggered on ${r}`:void 0,o?`session ${o}`:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:`posthog-js client rate limited: ${a}. Config is set to ${n} events per second and ${s} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(e){let t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}},Qe=ne("[RemoteConfig]"),ul=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=F._POSTHOG_REMOTE_CONFIG)===null||e===void 0||(e=e[this._instance.config.token])===null||e===void 0?void 0:e.config}tl(e){var t,i,s;!((t=F.__PosthogExtensions__)===null||t===void 0)&&t.loadExternalDependency?(i=F.__PosthogExtensions__)===null||i===void 0||(s=i.loadExternalDependency)===null||s===void 0||s.call(i,this._instance,"remote-config",()=>e(this.remoteConfig)):e()}el(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 Qe.info("Using preloaded remote config",this.remoteConfig),void this.il(this.remoteConfig);if(this._instance.nl())return void Qe.warn("Remote config is disabled. Falling back to local config.");this.tl(e=>{if(!e)return Qe.info("No config found after loading remote JS config. Falling back to JSON."),void this.el(t=>{this.il(t.json,t)});this.il(e)})}catch(e){Qe.error("Error loading remote config",e),this.il()}}il(e,t){!e&&t&&(t.statusCode===0?t.error||Qe.warn("Failed to fetch remote config from PostHog."):Qe.error("Failed to fetch remote config from PostHog."));try{this._instance.il(e?{ok:!0,config:e}:{ok:!1})}catch(s){Qe.error("Error applying remote config",s)}if(e?.hasFeatureFlags!==!1&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var i;(i=this._instance.featureFlags)===null||i===void 0||i.ensureFlagsLoaded()}catch(s){Qe.error("Error loading feature flags",s)}}},Eh=["fatal","error","warning","log","info","debug"],Se=Uint8Array,we=Uint16Array,Lt=Uint32Array,Bn=new Se([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]),qn=new Se([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]),Br=new Se([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),cl=function(e,t){for(var i=new we(31),s=0;31>s;++s)i[s]=t+=1<<e[s-1];var n=new Lt(i[30]);for(s=1;30>s;++s)for(var r=i[s];i[s+1]>r;
vendor: 5,985 bytes, line 2
2++r)n[r]=r-i[s]<<5|s;return[i,n]},dl=cl(Bn,2),gn=dl[1];dl[0][28]=258,gn[258]=28;for(_n=cl(qn,0)[1],Ji=new we(32768),Q=0;32768>Q;++Q)ut=(43690&Q)>>>1|(21845&Q)<<1,Ji[Q]=((65280&(ut=(61680&(ut=(52428&ut)>>>2|(13107&ut)<<2))>>>4|(3855&ut)<<4))>>>8|(255&ut)<<8)>>>1;var ut,_n,Ji,Q,ni=function(e,t,i){for(var s=e.length,n=0,r=new we(t);s>n;++n)++r[e[n]-1];var o,a=new we(t);for(n=0;t>n;++n)a[n]=a[n-1]+r[n-1]<<1;if(i){o=new we(1<<t);var l=15-t;for(n=0;s>n;++n)if(e[n])for(var u=n<<4|e[n],c=t-e[n],h=a[e[n]-1]++<<c,d=h|(1<<c)-1;d>=h;++h)o[Ji[h]>>>l]=u}else for(o=new we(s),n=0;s>n;++n)o[n]=Ji[a[e[n]-1]++]>>>15-e[n];return o},mt=new Se(288);for(Q=0;144>Q;++Q)mt[Q]=8;for(Q=144;256>Q;++Q)mt[Q]=9;for(Q=256;280>Q;++Q)mt[Q]=7;for(Q=280;288>Q;++Q)mt[Q]=8;var Zi=new Se(32);for(Q=0;32>Q;++Q)Zi[Q]=5;var Kc=ni(mt,9,0),Jc=ni(Zi,5,0),hl=function(e){return(e/8|0)+(7&e&&1)},pl=function(e,t,i){(t==null||0>t)&&(t=0),(i==null||i>e.length)&&(i=e.length);var s=new(e instanceof we?we:e instanceof Lt?Lt:Se)(i-t);return s.set(e.subarray(t,i)),s},je=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8},Ht=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8,e[s+2]|=i>>>16},Is=function(e,t){for(var i=[],s=0;e.length>s;++s)e[s]&&i.push({s,f:e[s]});var n=i.length,r=i.slice();if(!n)return[new Se(0),0];if(n==1){var o=new Se(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort(function(S,$){return S.f-$.f}),i.push({s:-1,f:25001});var a=i[0],l=i[1],u=0,c=1,h=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=n-1;)a=i[i[h].f>i[u].f?u++:h++],l=i[u!=c&&i[h].f>i[u].f?u++:h++],i[c++]={s:-1,f:a.f+l.f,l:a,r:l};var d=r[0].s;for(s=1;n>s;++s)r[s].s>d&&(d=r[s].s);var p=new we(d+1),g=mn(i[c-1],p,0);if(g>t){s=0;var m=0,_=g-t,f=1<<_;for(r.sort(function(S,$){return p[$.s]-p[S.s]||S.f-$.f});n>s;++s){var b=r[s].s;if(t>=p[b])break;m+=f-(1<<g-p[b]),p[b]=t}for(m>>>=_;m>0;){var w=r[s].s;t>p[w]?m-=1<<t-p[w]++-1:++s}for(;s>=0&&m;--s){var P=r[s].s;p[P]==t&&(--p[P],++m)}g=t}return[new Se(p),g]},mn=function(e,t,i){return e.s==-1?Math.max(mn(e.l,t,i+1),mn(e.r,t,i+1)):t[e.s]=i},qr=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new we(++t),s=0,n=e[0],r=1,o=function(l){i[s++]=l},a=1;t>=a;++a)if(e[a]==n&&a!=t)++r;else{if(!n&&r>2){for(;r>138;r-=138)o(32754);r>2&&(o(r>10?r-11<<5|28690:r-3<<5|12305),r=0)}else if(r>3){for(o(n),--r;r>6;r-=6)o(8304);r>2&&(o(r-3<<5|8208),r=0)}for(;r--;)o(n);r=1,n=e[a]}return[i.subarray(0,s),t]},zt=function(e,t){for(var i=0,s=0;t.length>s;++s)i+=e[s]*t[s];return i},Mi=function(e,t,i){var s=i.length,n=hl(t+2);e[n]=255&s,e[n+1]=s>>>8,e[n+2]=255^e[n],e[n+3]=255^e[n+1];for(var r=0;s>r;++r)e[n+r+4]=i[r];return 8*(n+4+s)},Ur=function(e,t,i,s,n,r,o,a,l,u,c){je(t,c++,i),++n[256];for(var h=Is(n,15),d=h[0],p=h[1],g=Is(r,15),m=g[0],_=g[1],f=qr(d),b=f[0],w=f[1],P=qr(m),S=P[0],$=P[1],I=new we(19),R=0;b.length>R;++R)I[31&b[R]]++;for(R=0;S.length>R;++R)I[31&S[R]]++;for(var O=Is(I,7),j=O[0],U=O[1],V=19;V>4&&!j[Br[V-1]];--V);var Y,T,B,D,J=u+5<<3,H=zt(n,mt)+zt(r,Zi)+o,ee=zt(n,d)+zt(r,m)+o+14+3*V+zt(I,j)+(2*I[16]+3*I[17]+7*I[18]);if(H>=J&&ee>=J)return Mi(t,c,e.subarray(l,l+u));if(je(t,c,1+(H>ee)),c+=2,H>ee){Y=ni(d,p,0),T=d,B=ni(m,_,0),D=m;var pe=ni(j,U,0);for(je(t,c,w-257),je(t,c+5,$-1),je(t,c+10,V-4),c+=14,R=0;V>R;++R)je(t,c+3*R,j[Br[R]]);c+=3*V;for(var le=[b,S],fe=0;2>fe;++fe){var $e=le[fe];for(R=0;$e.length>R;++R)je(t,c,pe[ue=31&$e[R]]),c+=j[ue],ue>15&&(je(t,c,$e[R]>>>5&127),c+=$e[R]>>>12)}}else Y=Kc,T=mt,B=Jc,D=Zi;for(R=0;a>R;++R)if(s[R]>255){var ue;Ht(t,c,Y[257+(ue=s[R]>>>18&31)]),c+=T[ue+257],ue>7&&(je(t,c,s[R]>>>23&31),c+=Bn[ue]);var Re=31&s[R];Ht(t,c,B[Re]),c+=D[Re],Re>3&&(Ht(t,c,s[R]>>>5&8191),c+=qn[Re])}else Ht(t,c,Y[s[R]]),c+=T[s[R]];return Ht(t,c,Y[256]),c+T[256]},Zc=new Lt([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Qc=new Se(0),ed=(function(){for(var e=new Lt(256),t=0;256>t;++t){for(var i=t,s=9;--s;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e})(),Fs=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};function td(e,t){t===void 0&&(t={});var i=(function(){var d=4294967295;return{p(p){for(var g=d,m=0;p.length>m;++m)g=ed[255&g^p[m]]^g>>>8;d=g},d(){return 4294967295^d}}})(),s=e.length;i.p(e);var n,r,o,a,l,u,c=(a=10+((n=t).filename&&n.filename.length+1||0),l=8,(function(d,p,g,m,_,f){var b=d.length,w=new Se(m+b+5*(1+Math.floor(b/7e3))+_),P=w.subarray(m,w.length-_),S=0;if(!p||8>b)for(var $=0;b>=$;$+=65535){var I=$+65535;b>I?S=Mi(P,S,d.subarray($,I)):(P[$]=f,S=Mi(P,S,d.subarray($,b)))}else{for(var R=Zc[p-1],O=R>>>13,j=8191&R,U=(1<<g)-1,V=new we(32768),Y=new we(U+1),T=Math.ceil(g/3),B=2*T,D=function(ls){return(d[ls]^d[ls+1]<<T^d[ls+2]<<B)&U},J=new Lt(25e3),H=new we(288),ee=new we(32),pe=0,le=0,fe=($=0,0),$e=0,ue=0;b>$;++$){var Re=D($),Ye=32767&$,Xe=Y[Re];if(V[Ye]=Xe,Y[Re]=Ye,$>=$e){var at=b-$;if((pe>7e3||fe>24576)&&at>423){S=Ur(d,P,0,J,H,ee,le,fe,ue,$-ue,S),fe=pe=le=0,ue=$;for(var Ee=0;286>Ee;++Ee)H[Ee]=0;for(Ee=0;30>Ee;++Ee)ee[Ee]=0}var Ce=2,yi=0,Dl=j,Ke=Ye-Xe&32767;if(at>2&&Re==D($-Ke))for(var Nl=Math.min(O,at)-1,jl=Math.min(32767,$),Bl=Math.min(258,at);jl>=Ke&&--Dl&&Ye!=Xe;){if(d[$+Ce]==d[$+Ce-Ke]){for(var Je=0;Bl>Je&&d[$+Je]==d[$+Je-Ke];++Je);if(Je>Ce){if(Ce=Je,yi=Ke,Je>Nl)break;var ql=Math.min(Ke,Je-2),Vn=0;for(Ee=0;ql>Ee;++Ee){var as=$-Ke+Ee+32768&32767,Hn=as-V[as]+32768&32767;Hn>Vn&&(Vn=Hn,Xe=as)}}}Ke+=(Ye=Xe)-(Xe=V[Ye])+32768&32767}if(yi){J[fe++]=268435456|gn[Ce]<<18|_n[yi];var zn=31&gn[Ce],Wn=31&_n[yi];le+=Bn[zn]+qn[Wn],++H[257+zn],++ee[Wn],$e=$+Ce,++pe}else J[fe++]=d[$],++H[d[$]]}}S=Ur(d,P,f,J,H,ee,le,fe,ue,$-ue,S),f||(S=Mi(P,S,Qc))}return pl(w,0,m+hl(S)+_)})(r=e,(o=t).level==null?6:o.level,o.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(r.length)))):12+o.mem,a,l,!u)),h=c.length;return(function(d,p){var g=p.filename;if(d[0]=31,d[1]=139,d[2]=8,d[8]=2>p.level?4:p.level==9?2:0,d[9]=3,p.mtime!=0&&Fs(d,4,Math.floor(new Date(p.mtime||Date.now())/1e3)),g){d[3]=8;for(var m=0;g.length>=m;++m)d[m+10]=g.charCodeAt(m)}})(c,t),Fs(c,h-8,i.d()),Fs(c,h-4,s),c}var id=!!xn||!!li,vl=new WeakMap,fl="text/plain",Ts=0,Ai=!1,gl=(e,t)=>
2{let[i,s]=e.split("#"),[n,r]=i.split("?");if(!r)return e;let o=r.split("&").filter(a=>a.split("=")[0]!==t).join("&");return`${n}${o?`?${o}`:""}${s?`#${s}`:""}`},mi=(e,t,i=!0)=>{var s;let[n,r]=e.split("?"),o=v({},t),a=(s=r?.split("&").map(u=>{var c;let[h,d]=u.split("="),p=i&&(c=o[h])!==null&&c!==void 0?c:d;return delete o[h],`${h}=${p}`}))!==null&&s!==void 0?s:[],l=(function(u,c="&"){let h,d,p=[];return G(u,function(g,m){E(g)||E(m)||m==="undefined"||(h=encodeURIComponent((_=>_ instanceof File)(g)?g.name:g.toString()),d=encodeURIComponent(m),p[p.length]=d+"="+h)}),p.join(c)})(o);return l&&a.push(l),a.length>0?`${n}?${a.join("&")}`:n},Cs=e=>{if(e.sl)return e.sl;let{data:t,compression:i}=e;if(!t)return;if(i===ke.GZipJS){let n=td((function(r){var o=r.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(r);for(var a=new Se(r.length+(r.length>>>1)),l=0,u=function(p){a[l++]=p},c=0;o>c;++c){if(l+5>a.length){var h=new Se(l+8+(o-c<<1));h.set(a),a=h}var d=r.charCodeAt(c);128>d?u(d):2048>d?(u(192|d>>>6),u(128|63&d)):d>55295&&57344>d?(u(240|(d=65536+(1047552&d)|1023&r.charCodeAt(++c))>>>18),u(128|d>>>12&63),u(128|d>>>6&63),u(128|63&d)):(u(224|d>>>12),u(128|d>>>6&63),u(128|63&d))}return pl(a,0,l)})(Pt(t)),{mtime:0});return{contentType:fl,body:n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength),estimatedSize:n.byteLength}}if(i===ke.Base64){let n=(function(o){return o&&btoa(encodeURIComponent(o).replace(/%([0-9A-F]{2})/g,(a,l)=>String.fromCharCode(parseInt(l,16))))})(Pt(t)),r=(o=>"data="+encodeURIComponent(typeof o=="string"?o:Pt(o)))(n);return{contentType:"application/x-www-form-urlencoded",body:r,estimatedSize:new Blob([r]).size}}let s=Pt(t);return{contentType:"application/json",body:s,estimatedSize:new Blob([s]).size}},_l=e=>{let t=()=>e.transport==="sendBeacon"?{url:mi(e.url,{compression:ke.Base64}),encodedBody:Cs(v(v({},e),{}
2,{compression:ke.Base64,sl:void 0}))}:{url:gl(e.url,"compression"),encodedBody:Cs(v(v({},e),{},{compression:void 0,sl:void 0}))},i;try{i=Cs(e)}catch(n){if(ur(e.compression,Mt(e.url,"compression")))return k.error("Failed to gzip request body, sending uncompressed payload",n),t();throw n}return i&&ur(e.compression,Mt(e.url,"compression"))&&!((s=i.body)instanceof ArrayBuffer?Zs(new Uint8Array(s)):ArrayBuffer.isView(s)&&Zs(new Uint8Array(s.buffer,s.byteOffset,s.byteLength)))?(Ai=!0,t()):{url:e.url,encodedBody:i};var s},ml=e=>{try{return _l(e)}catch(i){var t;return k.error(i),void((t=e.callback)===null||t===void 0||t.call(e,{statusCode:0,error:i}))}},sd=(function(){var e=Z(function*(t){let i=yield(function(n){return Qs.apply(this,arguments)})(Pt(t.data),ae.DEBUG,{rethrow:!0});if(!i)return t;let s=yield i.arrayBuffer();return v(v({},t),{},{sl:{contentType:fl,body:s,estimatedSize:s.byteLength}})});return function(t){return e.apply(this,arguments)}})(),nd=/Failed to fetch|NetworkError|Load failed/i,yl=e=>e?.name==="TypeError"&&nd.test(e?.message||""),bl=e=>{try{let t=(function(i,s=Date.now()){if(typeof i!="string"||!i)return;let n=i.trim(),r=/^\d+\s*,/.test(n)?n.slice(0,n.indexOf(",")).trim():n;if(/^\d+$/.test(r)){let l=1e3*Math.min(Number(r),300);return l>0?l:void 0}if(!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(r))return;let o=/^\w{3} \w{3} /.test(r)?r+" GMT":r,a=Date.parse(o)-s;return Number.isFinite(a)&&a>0?Math.min(a,Fi):void 0})(e());return E(t)?void 0:Math.min(t,3e4)}catch{return}},wl=e=>{let t=ml(e);if(!t)return;let i=new xn;vl.set(i,!0);let{url:s,encodedBody:n}=t;i.open(e.method||"GET",s,!0);let{contentType:r,body:o}=n??{};G(e.headers,function(a,l){i.setRequestHeader(l,a)}),r&&i.setRequestHeader("Content-Type",r),e.timeout&&(i.timeout=e.timeout),i.onreadystatechange=()=>{if(i.readyState===4){var a;let l={statusCode:i.status,text:i.responseText};if(i.status===200)try{l.json=JSON.parse(i.responseText)}catch{}(a=e.callback)===null||a===void 0||a.call(e,l,bl(()=>i.getResponseHeader("Retry-After")))}},i.send(o)},El=e=>{let t=ml(e);if(!t)return;let{url:i,encodedBody:s}=t,{contentType:n,body:r,estimatedSize:o}=s??{},a=new Headers;G(e.headers,function(g,m){a.append(m,g)}),n&&a.append("Content-Type",n);let l=null,u=!1;if(Gn){let g=new Gn;l={signal:g.signal,timeout:setTimeout(()=>{u=!0;try{g.abort(ia("AbortError","PostHog request timed out"+((m=e.timeout)?` after ${m}ms`:"")))}catch(_){h(_)}var m},e.timeout)}}let c=!1,h=g=>{var m;c||(c=!0,u&&g?.name==="AbortError"||yl(g)?k.warn(g):k.error(g),(m=e.callback)===null||m===void 0||m.call(e,{statusCode:0,error:g}))},d=0,p=()=>{Ts-=d,d=0,l&&clearTimeout(l.timeout)};try{let g=v({method:e?.method||"GET",headers:a,referrerPolicy:"strict-origin",body:r,signal:l?.signal},e.fetchOptions),m=o??(E(r)?0:void 0);g.keepalive=g.method==="POST"&&!e.rl&&g.keepalive!==!1&&g.body===r&&!E(m)&&m>=0&&52428.8>Ts+m,g.keepalive&&(d=m,Ts+=d),li(i,g).then(_=>_.text().then(f=>{var b;if(c)return;let w={statusCode:_.status,text:f};if(_.status===200)try{w.json=JSON.parse(f)}catch(P){k.error(P)}c=!0,p(),(b=e.callback)===null||b===void 0||b.call(e,w,bl(()=>_.headers.get("Retry-After")))})).catch(_=>{p(),h(_)}).finally(p)}catch(g){p(),h(g)}},yn=e=>{try{var t;let{url:i,encodedBody:s}=_l(e),{contentType:n,body:r,estimatedSize:o}=s??{};if(!r)return;let a=r instanceof Blob?r:new Blob([r],{type:n});if(de.sendBeacon(i,a))return;let l=C(e.data)?e.data:(t=e.data)===null||t===void 0?void 0:t.batch;if(C(l)&&l.length>1&&(o??0)>16384){let u=Math.ceil(l.length/2),c=h=>C(e.data)?h:v(v({},e.data),{},{batch:h});return yn(v(v({},e),{},{data:c(l.slice(0,u))})),void yn(v(v({},e),{},{data:c(l.slice(u))}))}k.warn(`Beacon of ~${o??0} bytes was rejected by the browser, falling back to ${li?"fetch":"XHR"}`),li?El(v(v({},e),{},{rl:!0})):wl(e)}catch(i){k.warn("Beacon send failed",i)}},Vr=(e,t,i,s)=>{let n=s==="query"?t==="POST"?"sent_at":"_":void 0;return mi(i===ke.GZipJS?gl(e,"compression"):e,v(v({},n?{[n]:Date.now().toString()}:{}),i===ke.GZipJS?{}:{compression:i}))},rd=(()=>{let e=[];return li&&e.push({transport:"fetch",method:El}),xn&&e.push({transport:"XHR",method:wl}
2),de?.sendBeacon&&e.push({transport:"sendBeacon",method:yn}),e})(),xl=!id&&me?.indexOf("MSIE")===-1&&me?.indexOf("Mozilla")===-1;function $l(e,t,i){var s,n,r;i&&(t=v(v({},t),{},{callback:o=>i(o)})),e.__loaded?xl?e.__request_queue.push(t):e.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&((n=t.callback)===null||n===void 0||n.call(t,{statusCode:429})):(t.transport=t.transport||e.config.api_transport,t.headers=v(v({},e.config.request_headers),t.headers),t.compression=t.compression==="best-available"?(s=e.compression)!==null&&s!==void 0?s:t.compressionFallback:t.compression,(E(e.config.disable_beacon)?e.config.__preview_disable_beacon:e.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||e.config.fetch_options,((o,a)=>{var l,u,c;let h=v(v({},o),{},{callback:a??(_=>{var f;return(f=o.callback)===null||f===void 0?void 0:f.call(o,_)})});h.timeout=h.timeout||6e4;let d=(l=h.transport)!==null&&l!==void 0?l:"fetch";d==="sendBeacon"&&E(h.compression)&&h.data&&(h.compression=ke.Base64),h.method==="POST"&&h.data&&(h.timestampMode==="capture-body"?h.data=(_=>{var f,b;let w=(C(_)?_:[_]).map(S=>v(v({},S),S.timestamp instanceof Date&&!isNaN(S.timestamp.getTime())?{timestamp:S.timestamp.toISOString()}:{})),P=w[0];return{api_key:(f=P==null||(b=P.properties)===null||b===void 0?void 0:b.token)!==null&&f!==void 0?f:P?.token,batch:w,sent_at:new Date().toISOString()}})(h.data):h.timestampMode==="body"&&(h.data=((_,f=new Date().toISOString())=>C(_)?_.map(b=>v(v({},b),{},{sent_at:f})):v(v({},_),{},{sent_at:f}))(h.data))),h.url=Vr(h.url,h.method,h.compression,h.timestampMode);let p=rd.filter(_=>!h.disableTransport||!_.transport||!h.disableTransport.includes(_.transport)),g=(u=(c=(function(_,f){for(let b=0;_.length>b;b++)if(f(_[b]))return _[b]})(p,_=>_.transport===d))===null||c===void 0?void 0:c.method)!==null&&u!==void 0?u:p[0].method;if(!g)throw new Error("No available transport method");let m=_=>{try{g(_)}catch(b){var f;yl(b)?k.warn(b):k.error(b),(f=h.callback)===null||f===void 0||f.call(h,{statusCode:0,error:b})}};d!=="sendBeacon"&&!h.preferSyncCompression&&h.data&&h.compression===ke.GZipJS&&Ul&&typeof Promise<"u"&&!Ai?sd(h).then(_=>{m(_)}).catch(_=>{if(cr(_))return Ai=!0,void m(v(v({},h),{},{compression:void 0,url:Vr(o.url,o.method,void 0,o.timestampMode)}));(f=>{if(!f||typeof f!="object")return!1;let b="name"in f?String(f.name):"";return cr(f)||b===ua})(_)&&(Ai=!0),m(h)}):m(h)})(t,(o,a)=>{var l,u,c;e.rateLimiter.checkForLimiting(o),400>o.statusCode||(l=(u=e.config).on_request_error)===null||l===void 0||l.call(u,o),i?i(o,a):(c=t.callback)===null||c===void 0||c.call(t,o)})):t.fireCallbackOnDrop&&((r=t.callback)===null||r===void 0||r.call(t,{statusCode:0}))}var od=class{constructor(e,t){this.ol=!0,this.al=[],this.ll=De(t?.flush_interval_ms||3e3,250,5e3,k.createLogger("flush interval"),3e3),this.ul=e}enqueue(e){this.al.push(e),this.hl||this.cl()}unload(){this.dl();let e=this.al.length>0?this.vl():{},t=Object.values(e);[...t.filter(i=>i.url.indexOf("/e")===0),...t.filter(i=>i.url.indexOf("/e")!==0)].map(i=>{this.fl(i,"sendBeacon")})}enable(){this.ol=!1,this.cl()}cl(){this.ol||(this.hl=setTimeout(()=>{if(this.dl(),this.al.length>0){let e=this.vl();for(let t in e)this.fl(e[t])}},this.ll))}fl(e,t){try{this.ul(e,t)}catch(i){k.error(i)}}dl(){clearTimeout(this.hl),this.hl=void 0}vl(){let e={};return G(this.al,t=>{var i;let s=t,n=((s?s.batchKey:null)||s.url)+(s.batchGroup?`:${s.batchGroup}`:"");E(e[n])&&(e[n]=v(v({},s),{},{data:[]})),(i=e[n].data)===null||i===void 0||i.push(s.data)}),this.al=[],e}},ad=["retriesPerformedSoFar"],ld=class{constructor(e){this._instance=e,this.pl=!1,this.gl=3e3,this.al=[],this.al=[],this.ml=!0,this.resume()}resume(){if(!E(y)&&"onLine"in y.navigator){if(this.ml=y.navigator.onLine,this.yl)return;this.yl=()=>{this.ml=!0,this.bl()},this._l=()=>{this.ml=!1},z(y,"online",this.yl),z(y,"offline",this._l)}}get length(){return this.al.length}retriableRequest(e,t){let{retriesPerformedSoFar:i}=e,s=ca(e,ad);qe(i)&&(s.url=mi(s.url,{retry_count:i})),$l(this._instance,t?v(v({},s),{},{transport:t}):s,(n,r)=>{var o;if(n.statusCode!==200&&(400>
2n.statusCode||n.statusCode>=500)){if((n.statusCode===0?3:10)>(i??0))return void this.Ls(v({retriesPerformedSoFar:i},s),r);n.statusCode===0&&k.warn(`Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after ${i??0} retries.`)}(o=s.callback)===null||o===void 0||o.call(s,n)})}Ls(e,t){let i=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=i+1;let s=Math.max((function(o){let a=3e3*Math.pow(2,o),l=a/2,u=Math.min(18e5,a),c=(Math.random()-.5)*(u-l);return Math.ceil(u+c)})(i),t??0),n=Date.now()+s;this.al.push({retryAt:n,requestOptions:e});let r=`Enqueued failed request for retry in ${s}`;navigator.onLine||(r+=" (Browser is offline)"),k.warn(r),this.pl||(this.pl=!0,this.wl())}wl(){if(this.kl&&clearTimeout(this.kl),this.al.length===0)return this.pl=!1,void(this.kl=void 0);this.kl=setTimeout(()=>{this.ml&&this.al.length>0&&this.bl(),this.wl()},this.gl)}bl(){let e=Date.now(),t=[],i=this.al.filter(s=>e>s.retryAt||(t.push(s),!1));if(this.al=t,i.length>0)for(let{requestOptions:s}of i)this.retriableRequest(s)}unload(){this.kl&&(clearTimeout(this.kl),this.kl=void 0),this.pl=!1,E(y)||(this.yl&&(y.removeEventListener("online",this.yl),this.yl=void 0),this._l&&(y.removeEventListener("offline",this._l),this._l=void 0));for(let{requestOptions:e}of this.al)try{this._instance._send_request(v(v({},e),{},{transport:"sendBeacon"}))}catch(t){k.error(t)}this.al=[]}},ud=class{constructor(e){this._instance=e,this.Sl=()=>{var t,i,s,n;this.xl||(this.xl={});let r=this.scrollElement(),o=this.scrollY(),a=r?Math.max(0,r.scrollHeight-r.clientHeight):0,l=o+(r?.clientHeight||0),u=r?.scrollHeight||0;this.xl.lastScrollY=Math.ceil(o),this.xl.maxScrollY=Math.max(o,(t=this.xl.maxScrollY)!==null&&t!==void 0?t:0),this.xl.maxScrollHeight=Math.max(a,(i=this.xl.maxScrollHeight)!==null&&i!==void 0?i:0),this.xl.lastContentY=l,this.xl.maxContentY=Math.max(l,(s=this.xl.maxContentY)!==null&&s!==void 0?s:0),this.xl.maxContentHeight=Math.max(u,(n=this.xl.maxContentHeight)!==null&&n!==void 0?n:0)}}get Cl(){return this._instance.config.scroll_root_selector}getContext(){return this.xl}resetContext(){let e=this.xl;return this.xl=void 0,setTimeout(this.Sl,0),e}startMeasuringScrollPosition(){z(y,"scroll",this.Sl,{capture:!0}),z(y,"scrollend",this.Sl,{capture:!0}),z(y,"resize",this.Sl)}scrollElement(){if(this.Cl){let i=C(this.Cl)?this.Cl:[this.Cl];for(let s of i){var e;let n=y==null||(e=y.document)===null||e===void 0?void 0:e.querySelector(s);if(n)return n}return}var t;return y==null||(t=y.document)===null||t===void 0?void 0:t.documentElement}$l(e){var t,i;let s=e==="y"?"scrollTop":"scrollLeft";if(this.Cl){let n=this.scrollElement();return n&&n[s]||0}return y?e==="y"?y.scrollY||y.pageYOffset||((t=y.document)===null||t===void 0||(t=t.documentElement)===null||t===void 0?void 0:t.scrollTop)||0:y.scrollX||y.pageXOffset||((i=y.document)===null||i===void 0||(i=i.documentElement)===null||i===void 0?void 0:i.scrollLeft)||0:0}scrollY(){return this.$l("y")}scrollX(){return this.$l("x")}},cd=e=>rl(e?.config.mask_personal_data_properties,e?.config.custom_personal_data_properties,e?.config.disable_capture_url_hashes),Hr=class{constructor(e,t,i,s){this.Be=n=>{let r=this.Tl();if(r&&r.sessionId===n)return;let o={sessionId:n,props:this.Il(this._instance)};this.Ml.register({[un]:o})},this._instance=e,this.El=t,this.Ml=i,this.Il=s||cd,this.El.onSessionId(this.Be)}Tl(){return this.Ml.props[un]}getSetOnceProps(){var e;let t=(e=this.Tl())===null||e===void 0?void 0:e.props;return t?"r"in t?ol(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 G(An(this.getSetOnceProps()),(t,i)=>{i==="$current_url"&&(i="url"),e[`$session_entry_${Ws(i)}`]=t}),e}},Qi=class{on(e,t){return this.Pl[e]||(this.Pl[e]=[]),this.Pl[e].push(t),()=>{this.Pl[e]=this.Pl[e].filter(i=>i!==t)}}emit(e,t){for(let i of this.Pl[e]||[])i(t);for(let i of this.Pl["*"]||[])i(e,t)}constructor(){this.Pl={}}},Et=ne("[SessionId]"),zr=864e5,Wr=class{on(e,t){return this.Rl.on(e,t)}constructor(e,t,i){var s;if(this.Al=null,this.Fl=null,this.Ol=[],this.Dl=void 0,this.Ll=!1,this.Rl=new Qi,this.Nl=(r,o)=>!(!qe(r)||!qe(o))&&Math.abs(r-o)>
2this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Rr=e.config,this.Ml=e.persistence,this.He=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.ql=void 0,this._sessionActivityTimestamp=null,this.jl=t||Te,this.Bl=i||Te;let n=this.Rr.persistence_name||this.Rr.token;if(this._sessionTimeoutMs=1e3*De(this.Rr.session_idle_timeout_seconds||1800,60,36e3,Et.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Hl(),this.zl="ph_"+n+"_window_id",this.Ul="ph_"+n+"_primary_window_exists",this.Wl()){let r=X.Dt(this.zl),o=X.Dt(this.Ul);r&&!o?this.He=r:X.Lt(this.zl),X.At(this.Ul,!0)}!((s=this.Rr.bootstrap)===null||s===void 0)&&s.sessionID&&this.setBootstrapSessionId(this.Rr.bootstrap.sessionID),this.Vl()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return E(this.Ol)&&(this.Ol=[]),this.Ol.push(e),this.Xt&&e(this.Xt,this.He),()=>{this.Ol=this.Ol.filter(t=>t!==e)}}Wl(){return this.Rr.persistence!=="memory"&&!this.Ml.mi&&X.Et()}Gl(e){e!==this.He&&(this.He=e,this.Wl()&&X.At(this.zl,e))}Zl(){return this.He?this.He:this.Wl()?X.Dt(this.zl):null}Ql(e){let t=this.Al;return!se(t)&&!se(e)&&5e3>Math.abs(e-t)}Jl(e,t,i){let s=t!==this._sessionActivityTimestamp,n=!(e!==this.Xt||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this.Xt=e,n&&!s||n&&this.Ql(t)||(this.Al=t,this.Ml.register({[kt]:[t,e,i]}))}Kl(){var e;let t=(e=this.Rr)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return qe(t)&&t>0}Xl(){this.Kl()?this.Ml.refreshKey(kt):(this.Ml.flush(),this.Ml.load())}Yl(){var e;if(se(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.Al)return;this.Xl();let[,t,i]=this.tu();t===this.Xt&&i===this._sessionStartTimestamp&&(this.Al=this._sessionActivityTimestamp,this.Ml.register({[kt]:[this._sessionActivityTimestamp,(e=this.Xt)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.Ml.flush())}eu(){let[e]=this.tu(),t=qe(e)?e:0,i=qe(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,i)}iu(e){return this.Xl(),this.Nl(e,this.eu())}tu(){let e=this.Ml.props[kt];return C(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Al=null,this.ql=void 0,clearTimeout(this.nu),this.nu=void 0,this.Jl(null,null,null)}setBootstrapSessionId(e,t=!1){let i=((s,n=new Date().getTime())=>{try{let r=(o=>{let a=o.replace(/-/g,"");if(a.length!==32)throw new Error("Not a valid UUID");if(a[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(a.substring(0,12),16)})(s);return r>n+6e4?void Et.error("Bootstrap sessionID cannot be in the future"):r}catch(r){return void Et.error("Invalid sessionID in bootstrap",r)}})(e);return!E(i)&&(t?this.ql={sessionId:e,sessionStartTimestamp:i}:this.Jl(e,new Date().getTime(),i),!0)}destroy(){this.Ll=!0,this.Yl(),clearTimeout(this.nu),this.nu=void 0,this.Dl&&y&&(y.removeEventListener(Gi,this.Dl,{capture:!1}),this.Dl=void 0),this.Ol=[]}Vl(){this.Dl=()=>{this.Yl(),this.Wl()&&X.Lt(this.Ul)},z(y,Gi,this.Dl,{capture:!1})}checkAndGetSessionAndWindowId(e=!1,t=null,i=!1){if(this.Rr.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');let s=t||new Date().getTime(),n=this.Xt;if(i)this.Fl=s;else if(se(this.Fl)||this.Fl>s||s-this.Fl>=1e3){var r,o;(r=(o=this.Ml).syncCookieProperties)===null||r===void 0||r.call(o),this.Fl=s}let[,a,l]=this.tu(),u=!E(n)&&a!==n,c=this.eu(),h=this.Zl(),d=this.ql,p=!!d&&(d.sessionStartTimestamp>s+6e4||s-d.sessionStartTimestamp>zr),g=d?p:qe(l)&&Math.abs(s-l)>zr,m=!1,_=u,f=!a||!!d,b=a,w=!f&&!e&&this.Nl(s,c);if(w&&(w=this.iu(s),w||Et.info("cross-tab refresh kept the session alive",{sessionId:a}),[,a,l]=this.tu(),w||(f=!a||!!d)),f||w||g){_=!1;let I=d&&!p;a=I?d.sessionId:this.jl(),h=this.Bl(),Et.info("new session ID assigned",{sessionId:a,windowId:h,bootstrapped:!!I,changeReason:{noSessionId:f,activityTimeout:w,sessionPastMaximumLength:g}}),l=I?d.sessionStartTimestamp:s,this.ql=void 0,m=!0}else h||(h=this.Bl(),m=!0),_=_||a!==b,_&&(Et.info("adopted cross-tab session id",{sessionId:a,windowId:h}),m=!0);let P=qe(c)&&e&&!g?c:s,S=qe(l)?l:new Date().getTime();this.Gl(h),this.Jl(a,P,S),e||this.Hl();let $={noSessionId:f,activityTimeout:w,sessionPastMaximumLength:g,crossTabAdoption:_};return m&&this.Ol.forEach(I=>I(a,h,$)),{sessionId:a,windowId:h,sessionStartTimestamp:S,changeReason:m?$:void 0,lastActivityTimestamp:c}}Hl(){this.Ll||(clearTimeout(this.nu),this.nu=setTimeout(()=>
2{if(!this.Ll)if(this.iu(new Date().getTime())){let e=this.Xt;this.resetSessionId(),this.Rl.emit("forcedIdleReset",{idleSessionId:e})}else this.Hl()},1.1*this.sessionTimeoutMs))}},kl=function(e,t){if(!e)return!1;let i=e.userAgent;if(i&&Kn(i,t))return!0;try{let s=e?.userAgentData;if(s?.brands&&s.brands.some(n=>Kn(n?.brand,t)))return!0}catch{}return!!e.webdriver};function Sl(){return(Sl=Z(function*(){let e=de?.userAgentData;if(e?.getHighEntropyValues)try{let t=yield e.getHighEntropyValues(["model"]),i=t?.model;return L(i)&&i.length>0?i:void 0}catch(t){return void k.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}})).apply(this,arguments)}function dd(e,t){let i=`$survey_${t}/${e.id}`;return e.current_iteration&&e.current_iteration>0&&(i=`$survey_${t}/${e.id}/${e.current_iteration}`),i}function Rl(e){var t;return!!(!((t=e.conditions)===null||t===void 0||(t=t.events)===null||t===void 0||(t=t.values)===null||t===void 0)&&t.length)}var es=(e,t)=>{if(!(i=>{try{new RegExp(i)}catch{return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}},Si=e=>e.toLowerCase(),Pl={exact:(e,t)=>t.some(i=>e.some(s=>i===s)),is_not:(e,t)=>t.every(i=>e.every(s=>i!==s)),regex:(e,t)=>t.some(i=>e.some(s=>es(i,s))),not_regex:(e,t)=>t.every(i=>e.every(s=>!es(i,s))),icontains:(e,t)=>t.map(Si).some(i=>e.map(Si).some(s=>i.includes(s))),not_icontains:(e,t)=>t.map(Si).every(i=>e.map(Si).every(s=>!i.includes(s))),gt:(e,t)=>t.some(i=>{let s=parseFloat(i);return!isNaN(s)&&e.some(n=>s>parseFloat(n))}),lt:(e,t)=>t.some(i=>{let s=parseFloat(i);return!isNaN(s)&&e.some(n=>s<parseFloat(n))})};function Ol(e,t){return!e||Object.entries(e).every(([i,s])=>{let n=t?.[i];if(n==null)return!1;let r=Pl[s.operator];return!!r&&r(s.values.map(String),[String(n)])})}function Ms(e,t,i){return Pt({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}var bn="custom",Gr="i.posthog.com",hd=/^\/static\//,pd=["/s/","/e/","/i/"],vd=class{constructor(e){this.su={},this.instance=e}get apiHost(){let e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){let e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e;let t=(e=this.instance.config.ui_host)===null||e===void 0?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace(`.${Gr}`,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.su[this.apiHost]||(this.su[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":bn),this.su[this.apiHost]}ru(e){if(!hd.test(e))return;let t=this.instance.config.asset_host;return typeof t=="string"&&t.trim().replace(/\/$/,"")||void 0}ou(e){let t=Ge(e);return t?t.protocol+"//"+t.host+t.pathname:void 0}au(e,t,i){if(e==="ui")return i;let s=i,n=this.instance.config.rewriteRequestPath;if(n){var r;let o=((r=Ge(i))===null||r===void 0?void 0:r.href)||i;s=n(new URL(o)).toString()}if(n&&e==="api"&&pd.some(o=>t.indexOf(o)===0)){let o=this.ou(s);if(o){let a=this.apiHost,l=this.lu;l?.apiHost===a&&l.rewriteRequestPath===n||(l={apiHost:a,rewriteRequestPath:n,urls:new Set},this.lu=l),l.urls.add(o)}}return s}isIngestionEndpoint(e){let t=this.lu,i=this.ou(e);return 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}`),e==="ui")return this.au(e,t,this.uiHost+t);if(e==="flags")return this.au(e,t,this.flagsApiHost+t);if(e==="assets"){let s=this.ru(t);if(s)return this.au(e,t,`${s}${t}`)}if(this.region===bn)return this.au(e,t,this.apiHost+t);let i=Gr+t;switch(e){case"assets":return this.au(e,t,`https://${this.region}-assets.${i}`);case"api":return this.au(e,t,`https://${this.region}.${i}`)}}},W=ne("[Surveys]"),Il=e=>{try{let t=(i=>((s,n)=>`seenSurvey_${(function(r){return r.current_iteration&&r.current_iteration>0?`${r.id}_${r.current_iteration}`:r.id})(n)}`)(0,i))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(t){W.error("Failed to persist survey seen state",t)}},fd=[Ps.Popover,Ps.Widget,Ps.API],gd={ignoreConditions:!1,ignoreDelay:!1,displayType:fn.Popover}
2,_d=ne("[PostHog ExternalIntegrations]"),md={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},yd=class{constructor(e){this._instance=e}zo(e,t){var i,s;(i=F.__PosthogExtensions__)===null||i===void 0||(s=i.loadExternalDependency)===null||s===void 0||s.call(i,this._instance,e,n=>{if(n)return _d.error("failed to load script",n);t()})}startIfEnabledOrStop(){var e;for(let[n,r]of Object.entries((e=this._instance.config.integrations)!==null&&e!==void 0?e:{})){var t,i,s;r&&!(!((t=F.__PosthogExtensions__)===null||t===void 0||(t=t.integrations)===null||t===void 0)&&t[n])&&this.zo(md[n],()=>{var o;(o=F.__PosthogExtensions__)===null||o===void 0||(o=o.integrations)===null||o===void 0||(o=o[n])===null||o===void 0||o.start(this._instance)}),!r&&(!((i=F.__PosthogExtensions__)===null||i===void 0||(i=i.integrations)===null||i===void 0)&&i[n])&&((s=F.__PosthogExtensions__)===null||s===void 0||(s=s.integrations)===null||s===void 0||(s=s[n])===null||s===void 0||s.stop())}}},bd=class{constructor(e,t){this.$=e,this.wo=t,this.uu=new Map,this.Io=!1}add(e){var t=this;return Z(function*(){if(t.Io)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(t.uu.has(e.name))throw new Error(`Browser extension "${e.name}" is already registered`);t.uu.set(e.name,e);try{let i=e.setup(t.wo);i&&(yield i)}catch(i){let s=t.uu.get(e.name)===e;s&&t.uu.delete(e.name),t.$.error(`Failed to set up browser extension "${e.name}"`,i),s&&t.hu(e)}})()}getExtension(e){return this.uu.get(e)}dispose(){if(this.Io)return;this.Io=!0;let e=Array.from(this.uu.values()).reverse();this.uu.clear();for(let t of e)this.hu(t)}hu(e){try{var t;let i=(t=e.dispose)===null||t===void 0?void 0:t.call(e);i&&ce(i.then)&&i.then(void 0,s=>{this.$.error(`Failed to dispose browser extension "${e.name}"`,s)})}catch(i){this.$.error(`Failed to dispose browser extension "${e.name}"`,i)}}},wd=class{constructor(e){this._instance=e}initialize(){}get(e){let t=this._instance.persistence;if(typeof e=="string")return t?.get_property(e);let i={};for(let s of e){let n=t?.get_property(s);E(n)||(i[s]=n)}return i}set(e,t){var i;(i=this._instance.persistence)===null||i===void 0||i.register(typeof e=="string"?{[e]:t}:e)}remove(e){var t;(t=this._instance.persistence)===null||t===void 0||t.unregister(e)}},Yr="extensionsRemoteConfig",Ed=class{constructor(e){this.instance=e,this.Io=!1,this.$=k,this.cu=e.du,this.kv=new wd(e),this.onEvent=t=>ki(this.instance.on("eventCaptured",i=>{try{t({event:i.event,properties:i.properties})}catch(s){this.$.error("Browser extension event listener failed",s)}})),this.onRemoteConfig=t=>{if(this.Io)return ki(()=>{});let i=n=>{try{t(n)}catch(r){this.$.error("Browser extension remote config listener failed",r)}},s=this.instance.vu.on(Yr,i);return this.cu&&i(this.cu),ki(s)},this.fu=new bd(k.createLogger("[BrowserExtensions]"),this)}get logger(){return this.$}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return(e=this.instance.get_property("$device_id"))!==null&&e!==void 0?e:this.distinctId}get deviceId(){let e=this.instance.get_property(On);return typeof e=="string"?e:void 0}get library(){return{name:ae.LIB_NAME,version:ae.LIB_VERSION}}get initialPersonProperties(){var e,t;return(e=(t=this.instance.persistence)===null||t===void 0?void 0:t.get_initial_props())!==null&&e!==void 0?e:{}}get groups(){return this.instance.getGroups()}get session(){try{var e,t,i,s;let n=(e=this.instance.sessionManager)===null||e===void 0?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:(t=n?.sessionId)!==null&&t!==void 0?t:"",windowId:(i=n?.windowId)!==null&&i!==void 0?i:"",sessionStartTimestamp:(s=n?.sessionStartTimestamp)!==null&&s!==void 0?s:0}}catch{return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(e){return this.fu.add(e)}getExtension(e){return this.fu.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 ki(this.instance.pu(e))}handleRemoteConfig(e){this.Io||(this.cu=e,this.instance.vu.emit(Yr,e))}sendRequest(e){var t=this;return Z(function*(i,s={}){var n;let r=t.instance.requestRouter.endpointFor((n=s.target)!==null&&n!==void 0?n:"api",i),o={method:s.method,url:s.query?mi(r,s.query
2):r,data:s.body,headers:s.headers,timeout:s.timeoutMs,fireCallbackOnDrop:!0,transport:s.transport,compression:s.compression,compressionFallback:s.target==="flags"&&s.compression==="best-available"?zs.Base64:void 0,timestampMode:s.sentAt};return s.transport==="sendBeacon"?(t.instance._send_request(o),{statusCode:202}):new Promise(a=>{o.callback=a,t.instance._send_request(o)})}).apply(this,arguments)}dispose(){this.Io||(this.Io=!0,this.fu.dispose())}},ri={},As=0,oi=()=>{},Xr='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Wt="Surveys module not available",Kr="sanitize_properties is deprecated. Use before_send instead",Fl="Invalid value for property_denylist config: ",xd=/^[A-Za-z0-9_-]{1,400}$/,Jr=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,Zr=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,$d=["token","distinct_id",Ta],Xt="posthog",kd=e=>{let t={};return e&&e!=="unset"&&("2025-11-30">e||(t.strictMinimumDuration=!0),"2026-05-30">e||(t.canvasCapture={resolutionScale:.6}),"2026-06-25">e||(t.streamNetworkBody=!0),"2026-08-30">e||(t.captureJsonLd=!0)),t},Ls=e=>{var t;return v({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:xc(x?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:oi,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:e??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:ie&&L(ie?.search)&&ie.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,reuseAnonymousId:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:(y==null||(t=y.location)===null||t===void 0?void 0:t.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,feature_flag_request_max_retries:1,surveys_request_timeout_ms:1e4,on_request_error(i){k.error("Bad HTTP status: "+i.statusCode+" "+i.text)},get_device_id:i=>i,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:Da,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:oi},(i=>({rageclick:i&&i>="2026-05-30"?{content_ignorelist:Fc,ignore_text_selection:!0}
2:!i||"2025-11-30">i||{content_ignorelist:!0},capture_pageview:!i||"2025-05-24">i||"history_change",session_recording:kd(i),external_scripts_inject_target:i&&i>="2026-01-30"?"head":"body",internal_or_test_user_hostname:i&&i>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:i&&i>="2026-05-30"?250:0,split_storage:!(!i||"2026-05-30">i),detect_google_search_app:!(!i||"2026-05-30">i),disable_capture_url_hashes:!(!i||"2026-06-25">i),cookieWinsOnConflict:!(!i||i==="unset"||"2026-08-29">i)}))(e))},Sd=[["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"]],Qr=e=>{let t={};for(let[n,r]of Sd)E(e[n])||(t[r]=e[n]);let i=K({},t,e),s=e.__preview_external_dependency_versioned_paths;return E(s)||(E(e.strict_script_versioning)&&(i.strict_script_versioning=!!s),L(s)&&E(e.asset_host)&&(i.asset_host=s)),C(e.property_blacklist)&&(E(e.property_denylist)?i.property_denylist=e.property_blacklist:C(e.property_denylist)?i.property_denylist=[...e.property_blacklist,...e.property_denylist]:k.error(Fl+e.property_denylist)),i},Rd=class{constructor(){this.__forceAllowLocalhost=!1}get gu(){return this.__forceAllowLocalhost}set gu(e){k.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},ai=class et{mu(t){if(!t)return;let i=this.uu.indexOf(t);i!==-1&&this.uu.splice(i,1)}yu(t,i){var s;return this.mu(t),this.uu.push(i),(s=i.initialize)===null||s===void 0||s.call(i),i}bu(){return this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isRejected()}_u(){if(this.wu||this.config.reuseAnonymousId||this.config.segment||this.bu())return;let t=this.config.persistence==="memory"||this.config.persistence==="sessionStorage";if(!t&&!this.config.disable_persistence||this.ku)return;let i,s,n;t?(i=`persistence is set to '${this.config.persistence}'`,s=this.config.persistence==="memory"?"on every page load":"for every new browser tab or window",n="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(i="persistence is disabled (disable_persistence is true)",s="on every page load",n="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this.wu=!0,console.warn("[PostHog.js]",`${i} but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ${s}, 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. ${n}`)}Su(){if(this.bu()||this.get_distinct_id()!=="$posthog_cookieless")return;let t=this.persistence;if(!t)return;this.xu()||t.load(!0);let i=this.get_distinct_id();if(!i||i==="$posthog_cookieless"){let s=this.config.get_device_id(Te());this.register({distinct_id:s,$device_id:s}),t.set_property(ye,He)}this.Cu()}get decideEndpointWasHit(){var t,i;return(t=(i=this.featureFlags)===null||i===void 0?void 0:i.hasLoadedFlags)!==null&&t!==void 0&&t}get flagsEndpointWasHit(){var t,i;return(t=(i=this.featureFlags)===null||i===void 0?void 0:i.hasLoadedFlags)!==null&&t!==void 0&&t}constructor(){var t;this.$u=!1,this.Tu=!1,this.webPerformance=new Rd,this.Iu=!1,this.version=ae.LIB_VERSION,this.Mu=new Set,this.Eu="",this.vu=new Qi,this.uu=[],this.Pu=[],this.ku=!1,this.wu=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Ls(),this.SentryIntegration=jc,this.sentryIntegration=s=>(function(n,r){let o=Ja(n,r);return{name:Ka,processEvent:a=>o(a)}})(this,s),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Ru=!1,this.Au=null,this.Fu=null,this.Ou=null,this.scrollManager=new ud(this),this.pageViewM
2anager=new Ar(this),this.rateLimiter=new Xc(this),this.requestRouter=new vd(this),this.consent=new Ic(this),this.externalIntegrations=new yd(this);let i=(t=et.__defaultExtensionClasses)!==null&&t!==void 0?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:(s,n,r)=>{let o=L(s)?{[s]:n}:s;this.setPersonProperties(o),r?.({})},set_once:(s,n,r)=>{let o=L(s)?{[s]:n}:s;this.setPersonProperties(void 0,o),r?.({})}},this.on("eventCaptured",s=>k.info(`send "${s?.event}"`,s))}init(t,i,s){if(s&&s!==Xt){var n;let r=(n=ri[s])!==null&&n!==void 0?n:new et;return r._init(t,i,s),ri[s]=r,ri[Xt][s]=r,r}return this._init(t,i,s)}_init(t,i={},s){var n,r,o;let a=L(t)?t.trim():"";if(!a)return k.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;var l;if(this.__loaded)return a!==((l=this.config)===null||l===void 0?void 0:l.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=Ls(i.defaults),i.debug=this.Du(i.debug),this.Lu=i,this.Nu=[],i.person_profiles?this.Fu=i.person_profiles:i.process_person&&(this.Fu=i.process_person);let u=Ls(i.defaults),c=Qr(i),h=K({},u,c,{name:s,token:a});N(u.rageclick)&&N(c.rageclick)&&(h.rageclick=K({},u.rageclick,c.rageclick)),N(u.session_recording)&&N(c.session_recording)&&(h.session_recording=K({},u.session_recording,c.session_recording)),this.set_config(h),this.config.on_xhr_error&&k.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:ke.GZipJS;let d=this.xu();if(this.persistence=new Rs(this.config,d),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Rs(v(v({},this.config),{},{persistence:"sessionStorage"}),d,!1),this.Eu="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties",this.config.persistence!=="memory"&&!d&&X.Et()){let f=X.Dt(this.Eu);C(f)&&f.forEach(b=>{L(b)&&this.Mu.add(b)})}else X.Lt(this.Eu);let p=v({},this.persistence.props),g=v({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.qu=new od((f,b)=>this.ju(f,b),this.config.request_queue_config),this.Bu=new ld(this),this.__request_queue=[];let m=this.bu();m||(this.sessionManager=new Wr(this),this.sessionPropsManager=new Hr(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((f,b,w)=>{(w?.activityTimeout||w?.sessionPastMaximumLength||w?.crossTabAdoption)&&this.Hu()})),this.zu(),this.config.__preview_deferred_init_extensions?(k.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.Uu(m)},0)):(k.info("Initializing extensions synchronously"),this.Uu(m)),ae.DEBUG=ae.DEBUG||this.config.debug,ae.DEBUG&&k.info("Starting in debug mode",{this:this,config:i,thisC:v({},this.config),p,s:g}),this.config.identity_distinct_id&&!(!((n=i.bootstrap)===null||n===void 0)&&n.distinctID)&&(i.bootstrap=v(v({},i.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));let _=(r=i.bootstrap)===null||r===void 0?void 0:r.distinctID;if(this.ku=!!_&&!Kt(_),(o=i.bootstrap)===null||o===void 0?void 0:o.distinctID){let f=i.bootstrap.distinctID,b=this.get_distinct_id(),w=this.persistence.get_property(ye);if(i.bootstrap.isIdentifiedID&&b!=null&&b!==f&&w==="anonymous")this.identify(f);else if(i.bootstrap.isIdentifiedID&&b!=null&&b!==f&&w==="identified")k.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 P=this.config.get_device_id(Te()),S=i.bootstrap.isIdentifiedID?P:f;this.persistence.set_property(ye,i.bootstrap.isIdentifiedID?Ti:He),this.register({distinct_id:f,$device_id:S})}}if(m)this.register_once({distinct_id:ys,$device_id:null},"");else if(!this.get_distinct_id()){let f=this.config.get_device_id(Te());this.register_once({distinct_id:f,$device_id:f},""),this.persistence.set_property(ye,He)}return z(y,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),z(y,"pageshow",()=>{var f;this.$u=!1,this.Tu||(f=this.Bu)===null||f===void 0||f.resume()}),i.segment?Mr(this,()=>this.Wu()):this.Wu(),ce(this.config._onCapture)&&this.config._onCapture!==oi&&(k.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",f=>this.config._onCapture(f.event,f))),this.config.ip&&k.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 Sl.apply(this,arguments)})().then(f=>{f&&this.register({[ms]:f})}).catch(oi),this}Vu(t){let i=t;return L(i.name)&&ce(i.setup)}Gu(t,i){this.Vu(t)?i.push(()=>
2{this.Zu().add(t).catch(()=>{var s;return(s=t.dispose)===null||s===void 0?void 0:s.call(t)}).catch(s=>{k.error(`Failed to dispose browser extension "${t.name}"`,s)})}):this.uu.push(t)}zu(){var t,i,s;let n=(t=(i=this.config.__extensionClasses)===null||i===void 0?void 0:i.featureFlags)!==null&&t!==void 0?t:(s=et.__defaultExtensionClasses)===null||s===void 0?void 0:s.featureFlags;var r,o,a;n&&(this.featureFlags&&this.featureFlags instanceof n||((r=this.Qu)===null||r===void 0||r.call(this),this.Qu=void 0,this.featureFlags=new n(this)),ce(this.featureFlags.onReloading)&&ce(this.featureFlags.setup)?this.Qu||(this.Qu=this.featureFlags.onReloading(()=>{this.vu.emit("featureFlagsReloading",!0)}),this.Zu().add(this.featureFlags)):(o=(a=this.featureFlags).initialize)===null||o===void 0||o.call(a))}Uu(t){let i=performance.now(),s=v(v({},et.__defaultExtensionClasses),this.config.__extensionClasses),n=[];var r,o,a,l,u,c,h;s.exceptions&&this.uu.push(this.exceptions=(r=this.exceptions)!==null&&r!==void 0?r:new s.exceptions(this)),s.historyAutocapture&&this.uu.push(this.historyAutocapture=new s.historyAutocapture(this)),s.tracingHeaders&&this.uu.push(this.tracingHeaders=new s.tracingHeaders(this)),s.siteApps&&this.uu.push(this.siteApps=new s.siteApps(this)),s.sessionRecording&&!t&&this.uu.push(this.sessionRecording=new s.sessionRecording(this)),this.config.disable_scroll_properties||n.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),s.autocapture&&this.Gu(this.autocapture=new s.autocapture(this),n),s.surveys&&this.Gu(this.surveys=(o=this.surveys)!==null&&o!==void 0?o:new s.surveys(this),n),s.logs&&this.Gu(this.logs=(a=this.logs)!==null&&a!==void 0?a:new s.logs(this),n),s.metrics&&this.uu.push(this.metrics=(l=this.metrics)!==null&&l!==void 0?l:new s.metrics(this)),s.conversations&&this.uu.push(this.conversations=(u=this.conversations)!==null&&u!==void 0?u:new s.conversations(this)),s.productTours&&this.uu.push(this.productTours=new s.productTours(this)),s.heatmaps&&this.uu.push(this.heatmaps=new s.heatmaps(this)),s.webVitalsAutocapture&&this.uu.push(this.webVitalsAutocapture=new s.webVitalsAutocapture(this)),s.exceptionObserver&&this.uu.push(this.exceptionObserver=new s.exceptionObserver(this)),s.deadClicksAutocapture&&this.uu.push(this.deadClicksAutocapture=new s.deadClicksAutocapture(this,Nc)),s.toolbar&&this.uu.push(this.toolbar=(c=this.toolbar)!==null&&c!==void 0?c:new s.toolbar(this)),s.experiments&&this.uu.push(this.experiments=(h=this.experiments)!==null&&h!==void 0?h:new s.experiments(this)),this.uu.forEach(d=>{d.initialize&&n.push(()=>{var p;(p=d.initialize)===null||p===void 0||p.call(d)})}),n.push(()=>{if(this.Ju){let d=this.Ju;this.Ju=void 0,this.uu.forEach(p=>{var g;return(g=p.onRemoteConfig)===null||g===void 0?void 0:g.call(p,d)})}}),this.Ku(n,i)}Ku(t,i){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-i>=30&&t.length>0)return void setTimeout(()=>{this.Ku(t,i)},0);let n=t.shift();if(n)try{n()}catch(r){k.error("Error initializing extension:",r)}}let s=Math.round(performance.now()-i);this.register_for_session({[Ca]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Ma]:s}),this.config.__preview_deferred_init_extensions&&k.info(`PostHog extensions initialized (${s}ms)`)}il(t){var i;if(!x||!x.body)return k.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.il(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.Ju=t),this.du=t,this.compression=void 0,t.ok){var s;let n=t.config;n.supportedCompression&&!this.config.disable_compression&&(this.compression=M(n.supportedCompression,ke.GZipJS)?ke.GZipJS:M(n.supportedCompression,ke.Base64)?ke.Base64:void 0),!((s=n.analytics)===null||s===void 0)&&s.endpoint&&(this.analyticsDefaultEndpoint=n.analytics.endpoint)}this.set_config({person_profiles:this.Fu?this.Fu:Da}),(i=this.Xu)===null||i===void 0||i.handleRemoteConfig(t),this.uu.forEach(n=>{var r;return(r=n.onRemoteConfig)===null||r===void 0?void 0:r.call(n,t)})}Wu(){try{this.config.loaded(this)}catch(t){k.critical("`loaded` function failed",t)}if(this.Yu(),this.config.internal_or_test_user_hostname&&ie?.hostname){let t=ie.hostname,i=this.config.internal_or_test_user_hostname;(typeof i=="string"?t===i:i.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.bu())&&this.th()},1),this.eh=new ul(this),this.eh.load()}Yu(){var t;this.is_capturing()&&this.config.request_batching&&((t=this.qu)===null||t===void 0||t.enable())}_dom_loaded(){this.is_capturing()&&Rt(this.__request_queue,t=>this.ju(t)),this.__request_queue=[],this.Yu()}_handle_unload(){var t,i,s,n,r,o;this.$u=!0,(t=this.surveys)===null||t===void 0||(i=t.handlePageUnload)===null||i===void 0||i.call(t),(s=this.metrics)===null||s===void 0||s.flush("sendBeacon"),this.config.request_batching?(this.ih()&&this.capture(mr),(n=this.logs)===null||n===void 0||n.flushLogs("sendBeacon"),(r=this.qu)===null||r===void 0||r.unload(),(o=this.Bu)===null||o===void 0||o.unload()):this.ih()&&this.capture(mr,null,{transport:"sendBeacon"})}_send_request(t){$l(this,t)}ju(t,i){this.Bu?this.Bu.retriableRequest(t,i):this._send_request(i?v(v({},t),{},{transport:i}):t)}_execute_array(t){As++;try{let i,s=[],n=[],r=[];Rt(t,a=>{if(a)if(i=a[0],C(i))r.push(a);else if(ce(a))try{a.call(this)}catch(l){k.error("Error executing queued PostHog call",a,l)}else C(a)&&i==="alias"?s.push(a):C(a)&&i.indexOf("capture")!==-1&&ce(this[i])?r.push(a):n.push(a)});let o=function(a,l){Rt(a,function(u){try{if(C(u[0])){let c=l;G(u,function(h){c=c[h[0]].apply(c,h.slice(1))})}else l[u[0]].apply(l,u.slice(1))}catch(c){k.error("Error executing queued PostHog call",u,c)}})};o(s,this),o(n,this),o(r,this)}finally{As--}}push(t){if(As>0&&C(t)&&L(t[0])){let i=et.prototype[t[0]];return void(ce(i)&&i.apply(this,t.slice(1)))}this._execute_array([t])}get nh(){return{property:gr,persistenceKey:It,cookieName:"_fbc",pattern:Jr,register:(t,i)=>{var s;return(s=this.persistence)===null||s===void 0?void 0:s.register({[It]:{value:t,delivered:i}})},unregister:()=>{var t;return(t=this.persistence)===null||t===void 0?void 0:t.unregister(It)}}}get sh(){return{property:_r,persistenceKey:Zt,cookieName:"_fbp",pattern:Zr,register:(t,i)=>{var s;return(s=this.persistence)===null||s===void 0?void 0:s.register({[Zt]:{value:t,delivered:i}})},unregister:()=>{var t;return(t=this.persistence)===null||t===void 0?void 0:t.unregister(Zt)}}}rh(t){var i;let s=(i=this.persistence)===null||i===void 0?void 0:i.get_property(t.persistenceKey);return L(s)&&t.pattern.test(s)?{value:s,delivered:!1}:N(s)&&L(s.value)&&t.pattern.test(s.value)?{value:s.value,delivered:s.delivered===!0}:void 0}oh(t,i,s){return i===s?.value?{value:i,pending:!s.delivered}:(t.register(i,!1),{value:i,pending:!0})}ah(t){if(!this.config.save_campaign_params||this.bu())return;let i=ti(t.cookieName);return L(i)&&t.pattern.test(i)?i:void 0}uh(t,i,s,n){if(!this.persistence)return;let r=this.nh;this.persistence.refreshKey(r.persistenceKey);let o=this.rh(r);if(n)return void r.unregister();if(s)return L(i)&&Jr.test(i)?this.oh(r,i,o):void r.unregister();let a=L(t)&&xd.test(t)?t:void 0,l=this.ah(r);return l&&((u,c,h)=>{let d=u.split(".");if(c)return d[3]===c;
2if(!h)return!0;let p=h.value.split(".");return d[3]===p[3]||Number(d[2])>Number(p[2])})(l,a,o)?this.oh(r,l,o):a?o?.value.split(".")[3]===a?{value:o.value,pending:!o.delivered}:this.oh(r,`fb.1.${Date.now()}.${a}`,o):o?{value:o.value,pending:!o.delivered}:void 0}hh(t,i,s){if(!this.persistence)return;let n=this.sh;this.persistence.refreshKey(n.persistenceKey);let r=this.rh(n);if(s)return void n.unregister();if(i)return L(t)&&Zr.test(t)?this.oh(n,t,r):void n.unregister();let o=this.ah(n);return o?this.oh(n,o,r):r?{value:r.value,pending:!r.delivered}:void 0}dh(t,i){if(!this.persistence)return;this.persistence.refreshKey(t.persistenceKey);let s=this.rh(t);s?.value!==i||s.delivered||t.register(i,!0)}capture(t,i,s){var n,r;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.qu))return void k.uninitializedWarning("posthog.capture");if(!this.is_capturing())return;if(E(t)||!L(t))return void k.error("No event name provided to posthog.capture");this.Su();let o=!this.config.opt_out_useragent_filter&&this._is_bot();if(o&&!this.config.__preview_capture_bot_pageviews)return;let a=s?.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(a?.isRateLimited)return void k.critical("This capture call is ignored due to client rate limiting.");let l;i?.$current_url&&!L(i?.$current_url)&&(k.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),i==null||delete i.$current_url),t!=="$exception"||s?.fh||k.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&&(l=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 u=new Date,c=s?.timestamp||u,h=er(s?.uuid,Te),d={uuid:h,event:t,properties:this.calculateEventProperties(t,i||{},c,h)};t==="$pageview"&&this.config.__preview_capture_bot_pageviews&&o&&(d.event="$bot_pageview",d.properties.$browser_type="bot"),a&&(d.properties.$lib_rate_limit_remaining_tokens=a.remainingTokens);let p=t==="$feature_flag_called"&&d.properties.$feature_flag_has_experiment===!1&&this.get_property("$minimal_flag_called_events")===!0;s?.$set&&!p&&(d.$set=s?.$set);let g=N(i?.$set)?i.$set:void 0,m=C(i?.$unset)?i.$unset:[],_=s?.$unset||[],f=T=>{var B;let D=!!s?.$set&&T in s.$set;return{hasProvided:D||!!g&&T in g,provided:D?s==null||(B=s.$set)===null||B===void 0?void 0:B[T]:g?.[T],unset:m.indexOf(T)!==-1||_.indexOf(T)!==-1}},b=f(gr),w=f(_r),P=[{channel:this.nh,hasProvided:b.hasProvided,update:this.uh(l?.fbclid,b.provided,b.hasProvided,b.unset)},{channel:this.sh,hasProvided:w.hasProvided,update:this.hh(w.provided,w.hasProvided,w.unset)}];for(let{channel:T,hasProvided:B,update:D}of P)D&&d.properties.$process_person_profile===!0&&D.pending&&!B&&!p&&(d.$set=v({[T.property]:D.value},d.$set));let S=s?.$unset;S&&(d.$unset=S);let $=p?void 0:this.ph(s?.$set_once,t!==yr,t===Na);if($&&(d.$set_once=$),s?._noTruncate||(I=this.config.properties_string_max_length,d=(function(T,B){let D=new Set;return(function J(H,ee){if(H!==Object(H))return B?B(H):H;if(D.has(H))return;let pe;if(D.add(H),C(H))pe=[],Rt(H,le=>{pe.push(J(le))});else{let le={};G(Dt(H)?ja(H):H,(fe,$e)=>{D.has(fe)||(le[$e]=J(fe,$e))}),pe=le}return pe})(T)})(d,T=>L(T)?T.slice(0,I):T)),d.timestamp=c,E(s?.timestamp)||(d.properties.$event_time_override_provided=!0,d.properties.$event_time_override_system_time=u),p&&(d.properties=((T,B=[])=>{let D={},J=H=>{T[H]!==void 0&&(D[H]=T[H])};return Lu.forEach(J),B.forEach(J),D})(d.properties,$d)),t===ze.DISMISSED||t===ze.SENT){let T=i?.[Os.SURVEY_ID],B=i?.[Os.SURVEY_ITERATION];Il({id:T,current_iteration:B}),d.$set=v(v({},d.$set),{},{[dd({id:T,current_iteration:B},t===ze.SENT?"responded":"dismissed")]:!0})}else t===ze.SHOWN&&(d.$set=v(v({},d.$set),{},{[Os.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var I;if(t===Yc.SHOWN){let T=i?.[Nr.TOUR_TYPE];T&&(d.$set=v(v({},d.$set),{},{[`${Nr.TOUR_LAST_SEEN_DATE}/${T}`]:new Date().toISOString()}))}let R=v(v({},d.properties.$set),d.$set);if(xe(R)||this.setPersonPropertiesForFlags(R),!A(this.config.before_send)){let T=this.Os(d);if(!T)return;d=T,d.uuid=er(d.uuid,Te)}let O=P.filter(({channel:T,update:B})=>{var D,J,H;let ee=(D=(J=d.$set)===null||J===void 0?void 0:J[T.property])!==null&&D!==void 0?D:N((H=d.properties)===null||H===void 0?void 0:H.$set)?d.properties.$set[T.property]:void 0;return B?.pending&&ee===B.value});this.vu.emit("eventCaptured",d);let j=(n=s?._url)!==null&&n!==void 0?n:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),U=s?._batchKey==="recordings"||/\/s\/(?:\?|$)/.test(j),V=v(v(v({method:"POST",url:j,data:d,compression:"best-available",preferSyncCompression:s?.send_instantly,timestampMode:U?"body":"capture-body",batchKey:s?._batchKey},U&&(!((r=d.properties)===null||r===void 0)&&r.$session_id)?{batchGroup:d.properties.$session_id+(d.properties.$window_id?`-${d.properties.$window_id}`:"")}:{}),s?.transport?{transport:s.transport}:{}),O.length?{fireCallbackOnDrop:!0,callback:T=>{if(T.statusCode>=200&&300>T.statusCode)for(let{channel:B,update:D}of O)this.dh(B,D.value)}}:{});if(!this.config.request_batching||s&&!s?._batchKey||s?.send_instantly||O.length){var Y;let T;!V.transport&&!V.callback&&xe((Y=this.config.request_headers)!==null&&Y!==void 0?Y:{})&&this.$u&&(T="sendBeacon"),this.ju(V,T)}else this.qu.enqueue(V);return d}_addCaptureHook(t){return this.on("eventCaptured",i=>t(i.event,i))}getExtension(t){var i;return(i=this.Xu)===null||i===void 0?void 0:i.getExtension(t)}Zu(){var t;return(t=this.Xu)!==null&&t!==void 0?t:this.Xu=new Ed(this)}pu(t){this.Pu.push(t);let i=!0;return()=>{if(!i)return;i=!1;let s=this.Pu.indexOf(t);s!==-1&&this.Pu.splice(s,1)}}gh(t=!0){var i,s,n;
2return!!(!((i=this.persistence)===null||i===void 0)&&i.consumeCookieIdentityChange())&&(this.Ou=null,this.persistence.get_property("$user_state")==="anonymous"&&((n=this.sessionPersistence)===null||n===void 0||n.clear(),this.Mu.clear(),this.mh()),(s=this.featureFlags)===null||s===void 0||s.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,i,s,n,r){if(s=s||new Date,!this.persistence||!this.sessionPersistence)return i;this.persistence.syncCookieProperties(),this.gh();let o=r?void 0:this.persistence.remove_event_timer(t),a=v({},i);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,this.bu()&&(a[Ta]=!0),t==="$snapshot"){let b=v(v({},this.persistence.properties()),this.sessionPersistence.properties());return a.distinct_id=b.distinct_id,(!L(a.distinct_id)&&!re(a.distinct_id)||Kt(a.distinct_id))&&k.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}let l=(function(b,w,P,S=!1){var $,I,R,O;if(!me)return{};let j=b?[...At,...w||[]]:[],[U,V]=Zo(me),[Y,T]=(function(ue){for(let Re=0;Qn.length>Re;Re++){let[Ye,Xe,at]=Qn[Re],Ee=ue.match(Ye);if(Ee){let Ce=at&&ue.match(at)||Ee;return[Xe,Ce?.[1]||""]}}return["",""]})(me),B=(function(){let ue="u">typeof navigator?navigator:void 0;return ue?.brave?{brave:!0}:{}})(),D={};E(P)||(D.detectGoogleSearchApp=P);let J={},H=($=navigator)===null||$===void 0||($=$.userAgentData)===null||$===void 0?void 0:$.platform,ee=(I=navigator)===null||I===void 0?void 0:I.maxTouchPoints,pe=y==null||(R=y.screen)===null||R===void 0?void 0:R.width,le=y==null||(O=y.screen)===null||O===void 0?void 0:O.height,fe=y?.devicePixelRatio;E(H)||(J.userAgentDataPlatform=H),E(ee)||(J.maxTouchPoints=ee),E(pe)||(J.screenWidth=pe),E(le)||(J.screenHeight=le),E(fe)||(J.devicePixelRatio=fe);let $e=K(An({$os:U,$os_version:V,$browser:Jo(me,navigator.vendor,B,D),$webview_app:Y,$webview_app_version:T,$device:Qo(me),$device_type:nu(me,J),$timezone:al(),$timezone_offset:zc()}),{$current_url:vi(S?ot(ie?.href):ie?.href,j,fi),$host:ie?.host,$pathname:ie?.pathname,$raw_user_agent:me.length>1e3?me.substring(0,997)+"...":me,$browser_version:su(me,navigator.vendor,B,D),$browser_language:sl(),$browser_language_prefix:Hc(),$screen_height:y?.screen.height,$screen_width:y?.screen.width,$viewport_height:y?.innerHeight,$viewport_width:y?.innerWidth,$lib:We.LIB_NAME,$lib_version:We.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return We.SDK_DIST_CHANNEL&&($e.$sdk_dist_channel=We.SDK_DIST_CHANNEL),$e})(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:b,windowId:w}=this.sessionManager.checkAndGetSessionAndWindowId(r,s.getTime(),!0);a.$session_id=b,a.$window_id=w}this.sessionPropsManager&&K(a,this.sessionPropsManager.getSessionProps());try{var u;this.sessionRecording&&K(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(u=this.Bu)===null||u===void 0?void 0:u.length}catch(b){a.$sdk_debug_error_capturing_properties=String(b)}let c;if(this.requestRouter.region===bn&&(a.$lib_custom_api_host=this.config.api_host),c=t!=="$pageview"||r?t!=="$pageleave"||r?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(s):this.pageViewManager.doPageView(s,n),a=K(a,c),t==="$pageview"&&x&&(a.title=x.title),!E(o)){let b=s.getTime()-o;a.$duration=parseFloat((b/1e3).toFixed(3))}me&&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,g=h.$groups;N(p)&&!xe(p)&&(a.$groups=v(v({},N(g)?g:{}),p)),G(["$referrer","$referring_domain"],b=>{b in h&&delete d[b]});let m={};if(this.Pu.length>0)for(let b of this.Pu.slice())try{K(m,b())}catch(w){k.error("Failed to produce browser extension event properties",w)}a=K({},l,h,d,v(v({},m),a)),a.$is_identified=this._isIdentified(),C(this.config.property_denylist)?G(this.config.property_denylist,function(b){delete a[b]}):k.error(Fl+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);let _=this.config.sanitize_properties;_&&(k.error(Kr),a=_(a,t));let f=this.yh();return a.$process_person_profile=f,f&&!r&&this.bh("_calculate_event_properties"),a}ph(t,i=!0,s=!1){var n;if(!this.persistence||!this.yh()||this.Iu&&!s)return t;let r=this.persistence.get_initial_props(),o=(n=this.sessionPropsManager)===null||n===void 0?void 0:n.getSetOnceProps(),a=K({},r,o||{},t||{}),l=this.config.sanitize_properties;return l&&(k.error(Kr),a=l(a,"$set_once")),i&&(this.Iu=!0),xe(a)?void 0:a}register(t,i){var s;(s=this.persistence)===null||s===void 0||s.register(t,i)}register_once(t,i,s){var n;(n=this.persistence)===null||n===void 0||n.register_once(t,i,s)}register_for_session(t){var i,s;(i=this.persistence)===null||i===void 0||i.syncCookieProperties(),this.gh(),(s=this.sessionPersistence)===null||s===void 0||s.register(t),Object.keys(t).forEach(n=>this.Mu.add(n)),this.mh()}unregister(t){var i;(i=this.persistence)===null||i===void 0||i.unregister(t)}unregister_for_session(t){var i;(i=this.sessionPersistence)===null||i===void 0||i.unregister(t),this.Mu.delete(t),this.mh()}_h(t,i){this.register({[t]:i})}Hu(){this.Mu.forEach(t=>{var i;(i=this.sessionPersistence)===null||i===void 0||i.unregister(t)}),this.Mu.clear(),this.mh()}mh(){var t;if(!this.Eu)return;if(this.config.persistence==="memory"||!((t=this.sessionPersistence)===null||t===void 0)&&t.mi||!X.Et())return void X.Lt(this.Eu);let i=[];this.Mu.forEach(s=>i.push(s)),i.length>0?X.At(this.Eu,i):X.Lt(this.Eu)}getFeatureFlag(t,i){var s;return(s=this.featureFlags)===null||s===void 0?void 0:s.getFeatureFlag(t,i)}getFeatureFlagPayload(t){var i;return(i=this.featureFlags)===null||i===void 0?void 0:i.getFeatureFlagPayload(t)}getFeatureFlagResult(t,i){var s;return(s=this.featureFlags)===null||s===void 0?void 0:s.getFeatureFlagResult(t,i)}getAllFeatureFlags(){var t,i;return(t=(i=this.featureFlags)===null||i===void 0?void 0:i.getAllFeatureFlags())!==null&&t!==void 0?t:[]}isFeatureEnabled(t,i){var s,n;return(s=(n=this.featureFlags)===null||n===void 0?void 0:n.isFeatureEnabled(t,i))!==null&&s!==void 0?s:i?.defaultValue}reloadFeatureFlags(){var t;(t=this.featureFlags)===null||t===void 0||t.reloadFeatureFlags()}updateFlags(t,i,s){var n;(n=this.featureFlags)===null||n===void 0||n.updateFlags(t,i,s)}updateEarlyAccessFeatureEnrollment(t,i,s){var n;(n=this.featureFlags)===null||n===void 0||n.updateEarlyAccessFeatureEnrollment(t,i,s)}getEarlyAccessFeatures(t,i=!1,s){var n;return(n=this.featureFlags)===null||n===void 0?void 0:n.getEarlyAccessFeatures(t,i,s)}on(t,i){return this.vu.on(t,i)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:Wt}),()=>{})}onSessionId(t){var i,s;return(i=(s=this.sessionManager)===null||s===void 0?void 0:s.onSessionId(t))!==null&&i!==void 0?i:()=>{}}getSurveys(t,i=!1){this.surveys?this.surveys.getSurveys(t,i):t([],{isLoaded:!1,error:Wt})}getActiveMatchingSurveys(t,i=!1){this.surveys?this.surveys.getActiveMatchingSurveys(t,i):t([],{isLoaded:!1,error:Wt})}renderSurvey(t,i){var s;(s=this.surveys)===null||s===void 0||s.renderSurvey(t,i)}displaySurvey(t,i=gd){var s;(s=this.surveys)===null||s===void 0||s.displaySurvey(t,i)}cancelPendingSurvey(t){var i;(i=this.surveys)===null||i===void 0||i.cancelPendingSurvey(t)}canRenderSurvey(t){var i,s;return(i=(s=this.surveys)===null||s===void 0?void 0:s.canRenderSurvey(t))!==null&&i!==void 0?i:{visible:!1,disabledReason:Wt}}canRenderSurveyAsync(t,i=!1){var s,n;return(s=(n=this.surveys)===null||n===void 0?void 0:n.canRenderSurveyAsync(t,i))!==null&&s!==void 0?s:Promise.resolve({visible:!1,disabledReason:Wt})}wh(t){return!t||Kt(t)?(k.critical("Unique user id has not been set in posthog.identify"),!1):t==="$posthog_cookieless"?(k.critical(`The string "${t}" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.`),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(k.critical(`The string "${t}" was set in posthog.identify which indicates an error. This ID should be unique to the user and n
2ot a hardcoded string.`),!1)}identify(t,i,s){if(!this.__loaded||!this.persistence)return k.uninitializedWarning("posthog.identify");if(re(t)&&(t=t.toString(),k.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(t)||!this.bh("posthog.identify"))return;this.Su();let n=this.get_distinct_id(),r=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==n,o=this.gh(!1),a=this.persistence.Da(),l=!1;try{let c=this.get_distinct_id();this.register({$user_id:t}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:c},""),t!==c&&t!==this.get_property("__alias")&&(this.unregister(zi),this.register({distinct_id:t}));let h=(this.persistence.get_property("$user_state")||"anonymous")===He,d=t!==c,p=!d&&h;if(d&&h){var u;let g=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:c};this.persistence.set_property(ye,Ti),this.setPersonPropertiesForFlags({$set:i||{},$set_once:s||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.La(),this.capture("$identify",g,{$set:i||{},$set_once:s||{}})&&(this.Ou=Ms(t,i,s)),(u=this.featureFlags)===null||u===void 0||u.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:c)}else if(p){this.persistence.set_property(ye,Ti);let g=i||{},m=s||{};this.setPersonPropertiesForFlags({$set:g,$set_once:m},!1),this.config.cookieWinsOnConflict&&this.persistence.La(),this.capture("$set",{$set:g,$set_once:m})&&(this.Ou=Ms(t,i,s))}else(i||s)&&this.setPersonProperties(i,s);d||r||o?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(nt)):p&&(i||s)&&this.reloadFeatureFlags(),l=!0}finally{a&&this.persistence.ja(l)}}setPersonProperties(t,i){if(!t&&!i||!this.bh("posthog.setPersonProperties"))return;let s=Ms(this.get_distinct_id(),t,i);this.Ou!==s?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!0),this.capture("$set",{$set:t||{},$set_once:i||{}})&&(this.Ou=s)):k.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(t){var i;let s=(C(t)?t:[t]).filter(n=>L(n)&&n.length>0);s.length!==0&&this.bh("posthog.unsetPersonProperties")&&((i=this.featureFlags)===null||i===void 0||i.unsetPersonPropertiesForFlags(s,!0),this.capture("$set",{$unset:s}),this.Ou=null)}group(t,i,s){var n;if(!t||!i)return void k.error("posthog.group requires a group type and group key");(n=this.persistence)===null||n===void 0||n.syncCookieProperties(),this.gh();let r=this.getGroups(),o=r[t]!==i;if(o&&this.resetGroupPropertiesForFlags(t),this.register({$groups:v(v({},r),{},{[t]:i})}),(o||s)&&this.yh()){let a={$group_type:t,$group_key:i};s&&(a.$group_set=s),this.capture(yr,a)}s&&this.setGroupPropertiesForFlags({[t]:s}),o&&!s&&this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,i=!0){var s;(s=this.featureFlags)===null||s===void 0||s.setPersonPropertiesForFlags(t,i)}resetPersonPropertiesForFlags(t=!0){var i;(i=this.featureFlags)===null||i===void 0||i.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,i=!0){var s;this.bh("posthog.setGroupPropertiesForFlags")&&((s=this.featureFlags)===null||s===void 0||s.setGroupPropertiesForFlags(t,i))}resetGroupPropertiesForFlags(t){var i;(i=this.featureFlags)===null||i===void 0||i.resetGroupPropertiesForFlags(t)}reset(t){let i=be(t)?t:t?.resetDeviceID,s=be(t)||t==null?void 0:t.bootstrap;this.kh(i,!1,s)}kh(t,i=!1,s){var n,r,o,a,l,u;if(k.info("reset"),!this.__loaded)return k.uninitializedWarning("posthog.reset");let c=s?.sessionID;this.config.bootstrap=s||((n=this.Lu)===null||n===void 0?void 0:n.bootstrap)||{},(r=this.featureFlags)===null||r===void 0||(o=r.updateConfig)===null||o===void 0||o.call(r,this.config,this.nl());let h=this.get_property(On),d=this.get_property(ms),p=this.get_property(Qt);(a=this.sessionRecording)===null||a===void 0||a.flushBeforeIdentityReset();let g=this.is_capturing();this.consent.reset(),i||!g||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 m=(l=this.persistence)===null||l===void 0||(u=l.Da)===null||u===void 0?void 0:u.call(l),_=!1;try{var f,b,w,P,S,$,I,R,O,j,U,V,Y;if((f=this.persistence)===null||f===void 0||f.clear(),(b=this.sessionPersistence)===null||b===void 0||b.clear(),this.Mu.clear(),this.mh(),E(p)||(j=this.persistence)===null||j===void 0||j.register({$session_recording_remote_config:p}),(w=this.surveys)===null||w===void 0||w.reset(),(P=this.featureFlags)===null||P===void 0||P.reset(),(S=this.conversations)===null||S===void 0||S.reset(),($=this.logs)===null||$===void 0||$.reset(),(I=this.metrics)===null||I===void 0||I.reset(),(R=this.persistence)===null||R===void 0||R.set_property("$user_state","anonymous"),(O=this.sessionManager)===null||O===void 0||O.resetSessionId(),this.Ou=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:ys,$device_id:null},"");else{let D=this.config.get_device_id(Te());this.register_once({distinct_id:D,$device_id:t?D:h},""),t||E(d)||this.register({[ms]:d})}if(this.register({$last_posthog_reset:new Date().toISOString()},1),s&&(s.distinctID&&!this.bu()&&((Y=this.persistence)===null||Y===void 0||Y.set_property("$user_state",s.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:s.distinctID})),(U=this.featureFlags)===null||U===void 0||U.initialize(),!A(c)&&!(!((V=this.sessionManager)===null||V===void 0)&&V.setBootstrapSessionId(c,!0)))){let D=v({},s);delete D.sessionID,this.config.bootstrap=D}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,_=!0}finally{var T,B;m&&((T=this.persistence)===null||T===void 0||(B=T.ja)===null||B===void 0||B.call(T,_))}this.reloadFeatureFlags()}shutdown(t){var i=this;return Z(function*(){var s,n,r,o,a,l,u,c;if(i.__loaded){i.Tu=!0,i.Zu().dispose(),(s=i.sessionRecording)===null||s===void 0||s.dispose(),(n=i.logs)===null||n===void 0||n.flushLogs("sendBeacon"),(r=i.metrics)===null||r===void 0||r.flush("sendBeacon"),(o=i.metrics)===null||o===void 0||o.dispose(),(a=i.qu)===null||a===void 0||a.unload(),(l=i.Bu)===null||l===void 0||l.unload();try{var h;(h=i.featureFlags)===null||h===void 0||h.destroy()}catch(d){k.error("Error while destroying feature flags",d)}(u=i.persistence)===null||u===void 0||u.destroy(),(c=i.sessionPersistence)===null||c===void 0||c.destroy()}else k.uninitializedWarning("posthog.shutdown")})()}setIdentity(t,i){var s;delete this.config.identity_claims,this.config.identity_distinct_id=t,this.config.identity_hash=i,this.alias(t),(s=this.conversations)===null||s===void 0||s.Sh()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,(t=this.conversations)===null||t===void 0||t.xh()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,i;return(t=(i=this.sessionManager)===null||i===void 0?void 0:i.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&t!==void 0?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";let{sessionId:i,sessionStartTimestamp:s}=this.sessionManager.checkAndGetSessionAndWindowId(!0),n=this.requestRouter.endpointFor("ui",`/project/${this.config.token}/replay/${i}`);if(t?.withTimestamp&&s){var r;let o=(r=t.timestampLookBack)!==null&&r!==void 0?r:10;if(!s)return n;n+=`?t=${Math.max(Math.floor((new Date().getTime()-s)/1e3)-o,0)}`}return n}alias(t,i){return t===this.get_property("$people_distinct_id")?(k.critical("Attempting to create alias for existing People user - aborting."),-2):this.bh("posthog.alias")?(E(i)&&(i=this.get_distinct_id()),t!==i?(this._h(zi,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(k.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){let i=v({},this.config);if(N(t)){var s,n,r,o,a,l,u,c,h,d,p,g,m,_;K(this.config,Qr(t));let b=this.xu();(s=this.persistence)===null||s===void 0||s.update_config(this.config,i,b),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Rs(v(v({},this.config),{},{persistence:"sessionStorage"}),b,!1);let w=this.Du(this.config.debug);var f;be(w)&&(this.config.debug=w),be(this.config.debug)&&(this.config.debug?(ae.DEBUG=!0,q.Et()&&q.At("ph_debug",!0),k.info("set_config",{config:t,oldConfig:i,newConfig:v({},this.config)})):(ae.DEBUG=!1,q.Et()&&q.Lt("ph_debug"))),(n=this.featureFlags)===null||n===void 0||(r=n.updateConfig)===null||r===void 0||r.call(n,this.config,this.nl()),(o=this.exceptionObserver)===null||o===void 0||o.onConfigChange(),(a=this.exceptions)===null||a===void 0||a.onConfigChange(),(l=this.metrics)===null||l===void 0||l.onConfigChange(),(u=this.sessionRecording)===null||u===void 0||u.startIfEnabledOrStop(),(c=this.tracingHeaders)===null||c===void 0||c.startIfEnabledOrStop(),(h=this.autocapture)===null||h===void 0||h.startIfEnabled(),(d=this.heatmaps)===null||d===void 0||d.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&((f=this.historyAutocapture)===null||f===void 0||f.startIfEnabledOrStop()),(p=this.exceptionObserver)===null||p===void 0||p.startIfEnabledOrStop(),(g=this.deadClicksAutocapture)===null||g===void 0||g.startIfEnabledOrStop(),(m=this.surveys)===null||m===void 0||m.loadIfEnabled(),this.Cu(),(_=this.externalIntegrations)===null||_===void 0||_.startIfEnabledOrStop(),!i.segment&&this.config.segment&&this.persistence&&Mr(this,oi,!1)}}_overrideSDKInfo(t,i){ae.LIB_NAME=t,ae.LIB_VERSION=i}startSessionRecording(t){let i=t===!0,s={sampling:i||!!t?.sampling,linked_flag:i||!!t?.linked_flag,url_trigger:i||!!t?.url_trigger,event_trigger:i||!!t?.event_trigger};var n,r,o,a,l;
2Object.values(s).some(Boolean)&&((n=this.sessionManager)===null||n===void 0||n.checkAndGetSessionAndWindowId(),s.sampling&&((r=this.sessionRecording)===null||r===void 0||r.overrideSampling()),s.linked_flag&&((o=this.sessionRecording)===null||o===void 0||o.overrideLinkedFlag()),s.url_trigger&&((a=this.sessionRecording)===null||a===void 0||a.overrideTrigger("url")),s.event_trigger&&((l=this.sessionRecording)===null||l===void 0||l.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!!(!((t=this.sessionRecording)===null||t===void 0)&&t.started)}captureException(t,i){try{if(!this.exceptions)return;let s=this.exceptions.buildProperties(t,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(v(v({},s),i))}catch{return}}addExceptionStep(t,i){var s;(s=this.exceptions)===null||s===void 0||s.addExceptionStep(t,i)}captureLog(t){var i;(i=this.logs)===null||i===void 0||i.captureLog(t)}get logger(){var t,i;return(t=(i=this.logs)===null||i===void 0?void 0:i.logger)!==null&&t!==void 0?t:et.Ch}startExceptionAutocapture(t){this.set_config({capture_exceptions:t==null||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var i,s;return(i=(s=this.toolbar)===null||s===void 0?void 0:s.loadToolbar(t))!==null&&i!==void 0&&i}get_property(t){var i;return(i=this.persistence)===null||i===void 0?void 0:i.props[t]}getSessionProperty(t){var i;return(i=this.sessionPersistence)===null||i===void 0?void 0:i.props[t]}toString(){var t;let i=(t=this.config.name)!==null&&t!==void 0?t:Xt;return i!==Xt&&(i="posthog."+i),i}_isIdentified(){var t,i;return((t=this.persistence)===null||t===void 0?void 0:t.get_property("$user_state"))==="identified"||((i=this.sessionPersistence)===null||i===void 0?void 0:i.get_property("$user_state"))==="identified"}yh(){var t,i;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&xe(this.getGroups())&&!(!((t=this.persistence)===null||t===void 0||(t=t.props)===null||t===void 0)&&t.__alias)&&!(!((i=this.persistence)===null||i===void 0||(i=i.props)===null||i===void 0)&&i.$epp))}ih(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&!!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(t){return this.config.person_profiles==="never"?(k.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._u(),this._h(Tn,!0),!0)}xu(){if(this.config.cookieless_mode==="always")return!0;let t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!=="on_reject")}Cu(){var t,i;let s=this.xu();var n,r,o;return this.is_capturing()||(n=this.logs)===null||n===void 0||n.$h(),((t=this.persistence)===null||t===void 0?void 0:t.mi)!==s&&((r=this.persistence)===null||r===void 0||r.set_disabled(s)),((i=this.sessionPersistence)===null||i===void 0?void 0:i.mi)!==s&&((o=this.sessionPersistence)===null||o===void 0||o.set_disabled(s)),s&&(this.Mu.clear(),this.mh()),s}opt_in_capturing(t){var i;if(this.config.cookieless_mode!=="always"){if(this.bu()){var s,n,r,o,a,l;(s=this.sessionRecording)===null||s===void 0||s.dispose({discardBufferedEvents:!0}),this.kh(!0,!0),(n=this.sessionManager)===null||n===void 0||n.destroy(),(r=this.pageViewManager)===null||r===void 0||r.destroy(),this.sessionManager=new Wr(this),this.pageViewManager=new Ar(this),this.persistence&&(this.sessionPropsManager=new Hr(this,this.sessionManager,this.persistence));let p=(o=(a=this.config.__extensionClasses)===null||a===void 0?void 0:a.sessionRecording)!==null&&o!==void 0?o:(l=et.__defaultExtensionClasses)===null||l===void 0?void 0:l.sessionRecording;var u,c;p&&(this.sessionRecording=this.yu(this.sessionRecording,new p(this)),this.du&&((u=this.sessionRecording)===null||u===void 0||(c=u.onRemoteConfig)===null||c===void 0||c.c
2all(u,this.du)))}var h,d;this.consent.optInOut(!0),this.Cu(),this.Yu(),(i=this.sessionRecording)===null||i===void 0||i.startIfEnabledOrStop(),this.config.cookieless_mode=="on_reject"&&((h=this.surveys)===null||h===void 0||h.loadIfEnabled()),(E(t?.captureEventName)||t?.captureEventName)&&this.capture((d=t?.captureEventName)!==null&&d!==void 0?d:"$opt_in",t?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.th()}else k.warn(Xr)}opt_out_capturing(){if(this.config.cookieless_mode==="always")return void k.warn(Xr);let t=this.config.cookieless_mode==="on_reject"?this.sessionRecording:void 0;var i,s;t?.dispose({discardBufferedEvents:!0}),this.config.cookieless_mode==="on_reject"&&this.consent.isOptedIn()&&this.kh(!0,!0),this.consent.optInOut(!1),this.Cu(),this.config.cookieless_mode==="on_reject"&&(this.register({distinct_id:ys,$device_id:null}),this.mu(t),this.sessionRecording=void 0,(i=this.sessionManager)===null||i===void 0||i.destroy(),(s=this.pageViewManager)===null||s===void 0||s.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 t=this.consent.consent;return t===1?"granted":t===0?"denied":"pending"}is_capturing(){return this.config.cookieless_mode==="always"||(this.config.cookieless_mode==="on_reject"?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Cu()}_is_bot(){return de?kl(de,this.config.custom_blocked_useragents):void 0}th(){x&&(x.visibilityState==="visible"?this.Ru||(this.Ru=!0,this.capture(Mn,{title:x.title},{send_instantly:!0}),this.Au&&(x.removeEventListener(di,this.Au),this.Au=null)):this.Au||(this.Au=this.th.bind(this),z(x,di,this.Au)))}debug(t){t===!1?(y?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(y?.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}))}nl(){let t=this.Lu||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(k.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(function(i,s,n,r,o){let a=s in i&&!A(i[s]),l=n in i&&!A(i[n]);return a?i[s]:!!l&&(o&&o.warn(`Config field '${n}' is deprecated. Please use '${s}' instead. The old field will be removed in a future major version.`),i[n])})(t,"advanced_disable_flags","advanced_disable_decide",0,k)}Os(t){var i;if(A(this.config.before_send))return t;let s=Object.keys((i=t.properties)!==null&&i!==void 0?i:{}).filter(Wl),n=C(this.config.before_send)?this.config.before_send:[this.config.before_send],r=t;for(let o of n)try{if(r=o(r),A(r)){let a=`Event '${t.event}' was rejected in beforeSend function`;return zl(t.event)?k.warn(`${a}. This can cause unexpected behavior.`):k.info(a),null}r.properties&&!xe(r.properties)||k.warn(`Event '${t.event}' has no properties after beforeSend function, this is likely an error.`)}catch(a){return k.error(`Error in beforeSend function for event '${t.event}':`,a),null}for(let o of s)if(r.properties&&A(r.properties[o]))return k.warn(`Event '${t.event}' had its '${o}' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return r}getPageViewId(){var t;return(t=this.pageViewManager.Vo)===null||t===void 0?void 0:t.pageViewId}captureTraceFeedback(t,i){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:i})}captureTraceMetric(t,i,s){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:i,$ai_metric_value:String(s)})}Du(t){let i=be(t)&&!t,s=q.Et()&&q.Ot("ph_debug")==="true";return!i&&(!!s||t)}};ai.__defaultExtensionClasses={},ai.Ch=(()=>{let e=()=>{};return{trace:e,debug:e,info:e,warn:e,error:e,fatal:e}})(),(function(e,t){for(let i=0;t.length>i;i++)e.prototype[t[i]]=wc(e.prototype[t[i]])})(ai,["identify"]);var Tl=class{constructor(e){this.disabled=e===!1;let t=N(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}},Ds="$copy_autocapture",Ns=ne("[AutoCapture]");function js(e,t){return t.length>e?t.slice(0,e)+"...":t}function Pd(e){if(e.previousElementSibling)return e.previousElementSibling;let t=e;do t=t.previousSibling;while(t&&!Ne(t));return t}function Od(e,{e:t,maskAllElementAttributes:i,maskAllText:s,elementAttributeIgnoreList:n,elementsC
2hainAsString:r,disableCaptureUrlHashes:o}){var a,l;if(!Ne(e))return{props:{}};let u=[e],c=new Set([e]),h=e;for(;h.parentNode&&!ve(h,"body")&&1e3>u.length;){if(Ln(h.parentNode)){let $=h.parentNode.host;if(c.has($))break;c.add($),u.push($),h=$;continue}if(!Ne(h.parentNode)||c.has(h.parentNode))break;c.add(h.parentNode),u.push(h.parentNode),h=h.parentNode}let d=t.type==="click"&&e.namespaceURI==="http://www.w3.org/2000/svg"?u.findIndex($=>ve($,"button")||ve($,"a")):-1;d>0&&(s=s||u.slice(0,d+1).some($=>!Ft($)||pi($)));let p=[],g={},m,_=!1,f=!1;if(G(u,$=>{let I=Ft($);if(ve($,"a")&&!i&&!n?.includes("href")){let R=$.getAttribute("href");_=!!(I&&R&&si(R))&&(o?ot(R):R)}M(Ct($),"ph-no-capture")&&(f=!0),p.push((function(R,O,j,U,V=!1){let Y=R.tagName.toLowerCase(),T={tag_name:Y};Nn.indexOf(Y)>-1&&!j&&(T.$el_text=Y.toLowerCase()==="a"||Y.toLowerCase()==="button"?js(1024,Fr(R)):js(1024,hi(R)));let B=Ct(R);O||U?.includes("class")||0>=B.length||(T.classes=B.filter(function(ee){return ee!==""})),G(R.attributes,function(ee){var pe;if((!pi(R)||["name","id","class","aria-label"].indexOf(ee.name)!==-1)&&!U?.includes(ee.name)&&!O&&si(ee.value)&&(!L(pe=ee.name)||pe.substring(0,10)!=="_ngcontent"&&pe.substring(0,7)!=="_nghost")){let le=ee.value;ee.name==="class"&&(le=Dn(le).join(" ")),T["attr__"+ee.name]=js(1024,ee.name==="href"&&V?ot(le):le)}});let D=1,J=1,H=R;for(;H=Pd(H);)D++,H.tagName===R.tagName&&J++;return T.nth_child=D,T.nth_of_type=J,T})($,i,s,n,o)),G((function(R){if(!Ft(R))return{};let O={};return G(R.attributes,function(j){if(j.name&&j.name.indexOf("data-ph-capture-attribute")===0){let U=j.name.replace("data-ph-capture-attribute-",""),V=j.value;U&&V&&si(V)&&(O[U]=V)}}),O})($),(R,O)=>{({}).hasOwnProperty.call(g,O)||(g[O]=R)})}),f)return{props:{},explicitNoCapture:f};if(d>0&&(e=u[d],p.splice(0,d)),s||(p[0].$el_text=ve(e,"a")||ve(e,"button")?Fr(e):hi(e)),_){var b,w;p[0].attr__href=_;let $=(b=Ge(_))===null||b===void 0?void 0:b.host,I=y==null||(w=y.location)===null||w===void 0?void 0:w.host;$&&I&&$!==I&&(m=_)}return{props:K((S=t.type,{$event_type:S,$ce_version:1}),r?{}:{$elements:p},{$elements_chain:(P=p,C(P)?(function($){return $.map(I=>{var R,O;let j="";if(I.tag_name&&(j+=I.tag_name),I.attr_class){I.attr_class.sort();for(let Y of I.attr_class)j+=`.${Y.replace(/"/g,"")}`}let U=v(v(v(v({},I.text?{text:I.text}:{}),{},{"nth-child":(R=I.nth_child)!==null&&R!==void 0?R:0,"nth-of-type":(O=I.nth_of_type)!==null&&O!==void 0?O:0},I.href?{href:I.href}:{}),I.attr_id?{attr_id:I.attr_id}:{}),I.attributes),V={};return Ci(U).sort(([Y],[T])=>(function(B,D){return D>B?-1:B>D?1:0})(Y,T)).forEach(([Y,T])=>V[Tr(Y.toString())]=Tr(T.toString())),j+=":",j+=Ci(V).map(([Y,T])=>`${Y}="${T}"`).join(""),j}).join(";")})((function($){return $.map(I=>{var R,O;let j={text:(R=I.$el_text)===null||R===void 0?void 0:R.slice(0,400),tag_name:I.tag_name,href:(O=I.attr__href)===null||O===void 0?void 0:O.slice(0,2048),attr_class:Lc(I),attr_id:I.attr__id,nth_child:I.nth_child,nth_of_type:I.nth_of_type,attributes:{}};return Ci(I).filter(([U])=>U.indexOf("attr__")===0).forEach(([U,V])=>j.attributes[U]=V),j})})(P)):"")},!((a=p[0])===null||a===void 0)&&a.$el_text?{$el_text:(l=p[0])===null||l===void 0?void 0:l.$el_text}:{},m&&t.type==="click"?{$external_click_url:m}:{},g),target:e};var P,S}var Id=class{fo(){this.po=void 0,clearTimeout(this.mo),this.mo=void 0}yo(e){var t;if(!Ft(e))return!0;let i=(t=this.bo().css_selector_ignorelist)!==null&&t!==void 0?t:ks,s=new Set,n=e;for(;n;){if(s.size>=1e3||s.has(n))return!0;s.add(n);let r=n,o=Ct(r);if(M(o,"ph-no-capture")||M(o,"ph-sensitive")||pi(r)||i.some(l=>pn(r,l)))return!0;let a=n.parentNode;n=Ln(a)?a.host:a&&Ne(a)?a:null}return!1}_o(e){if(!this.isEnabled||e.type==="pointercancel")return void this.fo();if(e.type==="pointerdown"){this.fo();let s=ii(e);var t;return void(e.isPrimary&&e.button===0&&!e.ctrlKey&&s&&Ne(s)&&(this.po={target:s,excluded:this.yo(s),id:e.pointerId,x:e.clientX,y:e.clientY,released:!1,distinctId:(t=this.wo)===null||t===void 0?void 0:t.distinctId}))}let i=this.po;i&&(e.pointerId!==i.id||Math.abs(e.clientX-i.x)>5||Math.abs(e.clientY-i.y)>5?this.fo():e.type==="pointerup"&&(i.released=!0,this.mo=setTimeout(()=>this.fo(),0)))}ko(e){var t;let i=this.po;this.fo();let s=ii(e);if(i?.released&&i.target.isConnected&&i.distinctId===((t=this.wo)===null||t===void 0?void 0:t.distinctId)&&e.pointerId===i.id&&(e.detail>0||e.pointerType==="touch"||e.pointerType==="pen")&&e.button===0&&5>=Math.abs(e.clientX-i.x)&&5>=Math.abs(e.clientY-i.y)&&s&&(ve(s,"html")||ve(s,"body"))){var n;if(i.excluded)return null;let r=(n=this.bo().css_selector_ignorelist)!==null&&n!==void 0?n:ks;return[s,x?.documentElement,x?.body].some(o=>{if(!o)return!1;let a=Ct(o);return M(a,"ph-no-capture")||M(a,"ph-sensitive")||!Ft(o)||pi(o)||r.some(l=>pn(o,l))})?null:i.target}}constructor(e){this.So=e,this.name="autocapture",this.xo=!1,this.Co=null,this.$o=!1,this.To=!1,this.Rr={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.Io=!1,this.So.refresh(this.Rr),this.rageclicks=new Tl(this.Rr.rageclick),this.Mo=null}setup(e){this.Eo(),this.wo=e;let t=e.onRemoteConfig(this.onRemoteConfig.bind(this));this.Io?t.dispose():(this.Po=t,this.startIfEnabled())}dispose(){var e;this.Io||(this.Io=!0,this.wo=void 0,(e=this.Po)===null||e===void 0||e.dispose(),this.Po=void 0,this.Ro())}bo(){return this.So.refresh(this.Rr),this.Rr}Eo(){var e,t;return this.bo(),this.Rr.url_allowlist=(e=this.Rr.url_allowlist)===null||e===void 0?void 0:e.map(i=>new RegExp(i)),this.Rr.url_ignorelist=(t=this.Rr.url_ignorelist)===null||t===void 0?void 0:t.map(i=>new RegExp(i)),this.Rr}Ao(){if(!this.isBrowserSupported())return void Ns.info("Disabling Automatic Event Collection because this browser is not supported");if(!y||!x)return;let e=this.Fo=t=>{t=t||y?.event;try{if(t.type==="blur")return void this.fo();if(t.type.indexOf("pointer")===0)return void this._o(t);let i=t.type==="click"?this.ko(t):void 0;if(se(i))return;this.Oo(t,"$autocapture",i)}catch(i){Ns.error("Failed to capture event",i)}};if(z(y,"blur",e),z(x,"submit",e,{capture:!0}),z(x,"change",e,{capture:!0}),z(x,"click",e,{capture:!0}),G(["pointerdown","pointermove","pointerup","pointercancel"],t=>{z(x,t,e,{capture:!0})}),this.bo().capture_copied_text){let t=this.Do=i=>{i=i||y?.event;try{this.Oo(i,Ds)}catch(s){Ns.error("Failed to capture clipboard event",s)}};z(x,"copy",t,{capture:!0}),z(x,"cut",t,{capture:!0}),z(x,"paste",t,{capture:!0})}}Ro(){this.fo(),this.Fo&&(y?.removeEventListener("blur",this.Fo),G(["pointerdown","pointermove","pointerup","pointercancel"],e=>{x?.removeEventListener(e,this.Fo,!0)}),x?.removeEventListener("submit",this.Fo,!0),x?.removeEventListener("change",this.Fo,!0),x?.removeEventListener("click",this.Fo,!0),this.Fo=void 0),this.Do&&(x?.removeEventListener("copy",this.Do,!0),x?.removeEventListener("cut",this.Do,!0),x?.removeEventListener("paste",this.Do,!0),this.Do=void 0),this.xo=!1}startIfEnabled(){this.isEnabled||this.fo(),!this.Io&&this.wo&&this.isEnabled&&!this.xo&&(this.Ao(),this.xo=!0)}onRemoteConfig(e){if(this.Io)return;if(this.$o=!0,!e.ok)return void this.startIfEnabled();let t=e.config;
2t.elementsChainAsString&&(this.To=t.elementsChainAsString);let i=t.autocapture_opt_out;var s;be(i)&&((s=this.wo)===null||s===void 0||s.kv.set("$autocapture_disabled_server_side",i),this.Co=i),this.startIfEnabled()}setElementSelectors(e){this.Mo=e}getElementSelectors(e,t){var i;let s=[];return(i=this.Mo)===null||i===void 0||i.forEach(n=>{let r=x?.querySelectorAll(n);r?.forEach(o=>{e!==o&&t!==o||M(s,n)||s.push(n)})}),s}get isEnabled(){var e,t;if(this.Io)return!1;let i=(e=this.wo)===null||e===void 0?void 0:e.kv.get(wa),s=this.Co,n=this.bo();if(!n.remoteRequestsDisabled&&!this.$o)return!1;let r=n.remoteRequestsDisabled&&!this.$o;if(se(s)&&!be(i)&&!r)return!1;let o=(t=this.Co)!==null&&t!==void 0?t:!!i;return!!n.enabled&&!o}Oo(e,t="$autocapture",i){if(!this.isEnabled)return void this.fo();let s=i||ii(e);Va(s)&&(s=s.parentNode||null);let n=this.Eo();var r;t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&n.rageclick&&(!((r=this.rageclicks)===null||r===void 0)&&r.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime()))&&Ga(s,n.rageclick)&&this.Oo(e,"$rageclick",i);let o=t===Ds,a=o?v(v({},n),{},{dom_event_allowlist:void 0}):n;if(s&&(function(h,d,p,g,m,_){var f;if(!y||jn(h)||p?.url_allowlist&&!$r(p.url_allowlist,_)||p?.url_ignorelist&&$r(p.url_ignorelist,_))return!1;if(p?.dom_event_allowlist){let S=p.dom_event_allowlist;if(S&&!S.some($=>d.type===$))return!1}let{parentIsUsefulElement:b,targetElementList:w}=Ya(h,g);if(!(function(S,$){let I=$?.element_allowlist;if(E(I))return!0;for(let R of S)if(I.some(O=>R.tagName.toLowerCase()===O))return!0;return!1})(w,p)||!vn(w,p?.css_selector_allowlist)||vn(w,(f=p?.css_selector_ignorelist)!==null&&f!==void 0?f:ks))return!1;try{let S=y.getComputedStyle(h);if(S&&S.getPropertyValue("cursor")==="pointer"&&d.type==="click")return!0}catch{}let P=h.tagName.toLowerCase();switch(P){case"html":return!1;case"form":return(m||["submit"]).indexOf(d.type)>=0;case"input":case"select":case"textarea":return(m||["change","click"]).indexOf(d.type)>=0;default:return b?(m||["click"]).indexOf(d.type)>=0:(m||["click"]).indexOf(d.type)>=0&&(Nn.indexOf(P)>-1||h.getAttribute("contenteditable")==="true")}})(s,e,a,o,o?["copy","cut","paste"]:void 0,{config:{get_current_url:n.getCurrentUrl}})){var l;let{props:h,explicitNoCapture:d,target:p}=Od(s,{e,maskAllElementAttributes:n.maskAllElementAttributes,maskAllText:n.maskAllText,elementAttributeIgnoreList:n.element_attribute_ignorelist,elementsChainAsString:this.To,disableCaptureUrlHashes:n.disableCaptureUrlHashes});if(d)return!1;let g=this.getElementSelectors(s,p);if(g&&g.length>0&&(h.$element_selectors=g),t===Ds){let m=e.type||"clipboard";if(m!=="paste"){var u,c;let _=y==null||(u=y.getSelection())===null||u===void 0?void 0:u.toString(),f=Ha(_);if(!f)return!1;h.$selected_content=f,h.$clipboard_text_length=(c=_?.length)!==null&&c!==void 0?c:0}h.$copy_type=m}return(l=this.wo)===null||l===void 0||l.capture(t,h),!0}}isBrowserSupported(){return ce(x?.querySelectorAll)}},Fd=class{constructor(e){this._instance=e}refresh(e){let t=this._instance.config,i=N(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.nl(),e.url_allowlist=i?.url_allowlist,e.url_ignorelist=i?.url_ignorelist,e.dom_event_allowlist=i?.dom_event_allowlist,e.element_allowlist=i?.element_allowlist,e.css_selector_allowlist=i?.css_selector_allowlist,e.css_selector_ignorelist=i?.css_selector_ignorelist,e.element_attribute_ignorelist=i?.element_attribute_ignorelist,e.capture_copied_text=i?.capture_copied_text}},Gt=ne("[ExceptionAutocapture]"),eo=()=>{},to=e=>{var t;if(ce(e))return(t=e.__posthog_layer__)!==null&&t!==void 0?t:e.__rrweb_layer__};function gi(e,t,i){try{if(!(t in e))return eo;let s={next:e[t]},n=i(function(...r){return s.next.apply(this,r)});return ce(n)&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:s}})),e[t]=n,()=>{if(e[t]===n)return void(e[t]=s.next);let r=e[t],o=to(r);for(;o;){if(o.next===n)return void(o.next=s.next);r=o.next,o=to(r)}}}catch{return eo}}var Td=ne("[TracingHeaders]"),ct=ne("[Web Vitals]"),io=9e5,so=["CLS","FCP","INP","LCP"],Cd=["INP","LCP"],Md=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],Bs="disabled",no="lazy_loading",Be
2=ne("[SessionRecording]"),Ad=ne("[Heatmaps]");function qs(e){return N(e)&&"clientX"in e&&"clientY"in e&&re(e.clientX)&&re(e.clientY)}var Ri=ne("[Product Tours]"),Us=e=>{var t;return!e.config.disable_product_tours&&!!(!((t=e.persistence)===null||t===void 0)&&t.get_property(Fn))},Ld=["$set_once","$set"],Me=ne("[SiteApps]"),ro="Error while initializing PostHog app with config id ",Cl=(e,t)=>e?.then?e.then(t):t(e),xt="SDK is not enabled or survey functionality is not yet loaded",oo="Disabled. Not loading surveys.",Dd=class{constructor(e,t){this.So=e,this.Th=t,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Ih=!1,this.Mh=[],this.Eh=null,this.Ph=null,this.Io=!1,this.Rh=new Set,this.onRemoteConfig=i=>{if(this.Io||this.Rr.disableSurveys)return;if(!i.ok)return W.warn("Remote config unavailable. Not loading surveys.");let s=i.config.surveys;if(A(s))return W.warn("Flags not loaded yet. Not loading surveys.");this.Ah=be(s)?s:s.length>0,W.info(`flags response received, isSurveysEnabled: ${this.Ah}`),this.loadIfEnabled()}}setup(e){if(!this.Io)return this.Fh=e,Cl(e.kv.initialize(),()=>{if(this.Fh!==e||this.Io)return;this.Fh=void 0,this.wo=e;let t=e.onRemoteConfig(this.onRemoteConfig);this.Io?t.dispose():(this.Po=t,this.loadIfEnabled())})}dispose(){var e,t,i,s;this.Io||(this.Io=!0,this.Fh=void 0,this.wo=void 0,(e=this.Po)===null||e===void 0||e.dispose(),this.Po=void 0,(t=this._surveyEventReceiver)===null||t===void 0||t.dispose(),this._surveyEventReceiver=null,(i=this._surveyManager)===null||i===void 0||(s=i.dispose)===null||s===void 0||s.call(i),this._surveyManager=null,this.Mh=[],this.Eh=null,this.Rh.forEach(n=>clearTimeout(n)),this.Rh.clear())}get Rr(){return this.So.get()}initialize(){this.loadIfEnabled()}reset(){var e,t;(e=this._surveyManager)===null||e===void 0||(t=e.clearInMemoryInProgressSurveyState)===null||t===void 0||t.call(e);try{var i;(i=this._surveyEventReceiver)===null||i===void 0||i.reset(),localStorage.removeItem("lastSeenSurveyDate");let s=[];for(let n=0;n<localStorage.length;n++){let r=localStorage.key(n);(r?.startsWith("seenSurvey_")||r?.startsWith("inProgressSurvey_"))&&s.push(r)}s.forEach(n=>localStorage.removeItem(n))}catch{}}loadIfEnabled(){if(this.Io||!this.wo)return;let e=this.Rr;if(this._surveyManager)return;if(this.Ih)return void W.info("Already initializing surveys, skipping...");if(e.disableSurveys)return void W.info(oo);if(e.cookielessMode&&this.So.isOptedOut())return void W.info("Not loading surveys in cookieless mode without consent.");let t=this.So.getExtensions();if(!t)return void W.error("PostHog Extensions not found.");if(E(this.Ah)&&!e.advancedEnableSurveys)return;let i=this.Ah||e.advancedEnableSurveys;this.Ih=!0;try{let s=t.generateSurveys;if(s)return this.Oh(s,i),void(this.Ih=!1);let n=t.loadExternalDependency;if(!n)return this.Dh(Cn),void(this.Ih=!1);n(r=>{try{if(this.Io)return;let o=this.So.getExtensions();r||!o?.generateSurveys?this.Dh("Could not load surveys script",r):this.Oh(o.generateSurveys,i)}finally{this.Ih=!1}})}catch(s){throw this.Ih=!1,this.Dh("Error initializing surveys",s),s}}Oh(e,t){this.Io||(this._surveyManager=e(t),this._surveyEventReceiver=this.So.createEventReceiver(),W.info("Surveys loaded successfully"),this.Lh({isLoaded:!0}))}Dh(e,t){W.error(e,t),this.Lh({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Mh.push(e),this._surveyManager&&this.Lh({isLoaded:!0}),()=>{this.Mh=this.Mh.filter(t=>t!==e)}}getSurveys(e,t=!1){var i;let s=(i=this.wo)!==null&&i!==void 0?i:this.Th;if(!s||this.Io)return;if(this.Rr.disableSurveys)return W.info(oo),e([]);let n=s.kv.get(an);if(n&&!t)return e(n,{isLoaded:!0}),void(this.Nh()&&this.getSurveys(()=>{},!0));if(this.Eh)return void this.Eh.then(({surveys:a,context:l})=>{this.Io||e(a,l)}).catch(a=>W.error("Error in survey callback",a));let r=this.qh("/api/surveys/",{method:"GET",query:{token:s.projectToken},sentAt:"query",timeoutMs:this.Rr.requestTimeoutMs}).then(a=>{try{return this.jh(s,a)}catch(l){return W.error("Error processing surveys response",l),this.jh(s,{statusCode:0,error:l})}},a=>this.jh(s,{statusCode:0,error:a}));this.Eh=r;let o=()=>{this.Eh===r&&(this.Eh=null)};r.then(a=>{o(),this.Io||e(a.surveys,a.context)},o).catch(a=>W.error("Error in survey callback",a))}qh(e,t){let i=this.wo;return i?i.sendRequest(e,t):new Promise(s=>s({statusCode:0,error:new Error(xt)}))}jh(e,t){if(this.Io)return{surveys:[],context:{isLoaded:!1,error:xt}};let i=t.statusCode;if(i!==200||!t.json){let o=`Surveys API could not be loaded, status: ${i}`;return i!==0?W.error(o):t.error||W.warn(o),this.Ph=Date.now(),{surveys:[],context:{isLoaded:!1,error:o}}}this.Ph=null;let s=t.json.surveys||[],n=s.filter(o=>(function(a){return!(!a.start_date||a.end_date)})(o)&&(Rl(o)||(function(a){var l;return!!(!((l=a.conditions)===null||l===void 0||(l=l.actions)===null||l===void 0||(l=l.values)===null||l===void 0)&&l.length)})(o)));var r;return n.length>0&&((r=this._surveyEventReceiver)===null||r===void 0||r.register(n)),e.kv.set({[an]:s,[Wi]:Date.now()}),{surveys:s,context:{isLoaded:!0}}}Nh(){return this.Bh()&&!this.Eh&&!this.Hh()}Bh(){var e,t;let i=(e=(t=this.wo)!==null&&t!==void 0?t:this.Th)===null||e===void 0?void 0:e.kv.get(Wi);return re(i)&&Date.now()-i>3e5}Hh(){return re(this.Ph)&&3e5>Date.now()-this.Ph}markSurveyAsSeen(e,t){var i;
2let s={id:e,current_iteration:(i=t?.iteration)!==null&&i!==void 0?i:null};Il(s);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}}Lh(e){for(let t of this.Mh)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(i){W.error("Error in survey callback",i)}}getActiveMatchingSurveys(e,t=!1){if(!A(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);W.warn("init was not called")}zh(e){let t=null;return this.getSurveys(i=>{var s;t=(s=i.find(n=>n.id===e))!==null&&s!==void 0?s:null}),t}Uh(e){if(A(this._surveyManager))return{eligible:!1,reason:xt};let t=typeof e=="string"?this.zh(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}Wh(e){if(!this.So.isCapturing())return{eligible:!1,reason:"PostHog is not capturing, so a survey response cannot be recorded"};if(A(this._surveyManager))return{eligible:!1,reason:xt};let t=typeof e=="string"?this.zh(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(A(this._surveyManager))return W.warn("init was not called"),{visible:!1,disabledReason:xt};let t=this.Wh(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return A(this._surveyManager)?(W.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:xt})):new Promise(i=>{this.getSurveys(s=>{var n;let r=(n=s.find(o=>o.id===e))!==null&&n!==void 0?n:null;if(r){let o=this.Wh(r);i({visible:o.eligible,disabledReason:o.reason})}else i({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t,i){var s;if(!this.So.isCapturing())return;if(A(this._surveyManager))return void W.warn("init was not called");let n=typeof e=="string"?this.zh(e):e;if(!n?.id)return void W.warn("Survey not found");if(!fd.includes(n.type))return void W.warn(`Surveys of type ${n.type} cannot be rendered in the app`);let r=x?.querySelector(t);if(r){if(!((s=n.appearance)===null||s===void 0)&&s.surveyPopupDelaySeconds){W.info(`Rendering survey ${n.id} with delay of ${n.appearance.surveyPopupDelaySeconds} seconds`);let o=setTimeout(()=>{var a,l;this.Rh.delete(o),!this.Io&&this.So.isCapturing()&&(W.info(`Rendering survey ${n.id} with delay of ${(a=n.appearance)===null||a===void 0?void 0:a.surveyPopupDelaySeconds} seconds`),(l=this._surveyManager)===null||l===void 0||l.renderSurvey(n,r,i),W.info(`Survey ${n.id} rendered`))},1e3*n.appearance.surveyPopupDelaySeconds);return void this.Rh.add(o)}this._surveyManager.renderSurvey(n,r,i)}else W.warn("Survey element not found")}displaySurvey(e,t){var i;if(!this.So.isCapturing())return;if(A(this._surveyManager))return void W.warn("init was not called");let s=this.zh(e);if(!s)return void W.warn("Survey not found");let n=s;if(!((i=s.appearance)===null||i===void 0)&&i.surveyPopupDelaySeconds&&t.ignoreDelay&&(n=v(v({},s),{},{appearance:v(v({},s.appearance),{},{surveyPopupDelaySeconds:0})})),t.displayType!==fn.Popover&&t.initialResponses&&W.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){let r=this.Uh(s);if(!r.eligible)return void W.warn("Survey is not eligible to be displayed: ",r.reason)}t.displayType!==fn.Inline?this._surveyManager.handlePopoverSurvey(n,t):this.renderSurvey(n,t.selector,t.properties)}cancelPendingSurvey(e){A(this._surveyManager)?W.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e,t;(e=this._surveyManager)===null||e===void 0||(t=e.handlePageUnload)===null||t===void 0||t.call(e)}};function $t(e,t,i){if(A(e))return!1;switch(i){case"exact":return e===t;case"contains":{let s=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(s,"i").test(e)}case"regex":try{return new RegExp(t).test(e)}catch{return!1}default:return!1}}var Nd=class{constructor(e){this._instance=e,this.Vh=new Set,this.Gh=new Set,this.Zh=new Qi,this.Qh=(t,i)=>this.Jh(t,i)&&this.Kh(t,i)&&this.Xh(t,i)&&this.Yh(t,i),this.Jh=(t,i)=>!i?.event||t?.event===i?.event}init(){var e,t;E((e=this._instance)===null||e===void 0?void 0:e._addCaptureHook)||(this.tc=(t=this._instance)===null||t===void 0?void 0:t._addCaptureHook((i,s)=>{this.on(i,s)}))}dispose(){var e;(e=this.tc)===null||e===void 0||e.call(this),this.tc=void 0,this.Zh=new Qi}register(e){var t,i;if(!E((t=this._instance)===null||t===void 0?void 0:t._addCaptureHook)&&(e.forEach(s=>{var n;
2this.Vh.add(s),(n=s.steps)===null||n===void 0||n.forEach(r=>{this.Gh.add(r?.event||"")})}),(i=this._instance)===null||i===void 0?void 0:i.autocapture)){let s=new Set;this.Vh.forEach(n=>{var r;(r=n.steps)===null||r===void 0||r.forEach(o=>{o?.selector&&s.add(o.selector)})}),this._instance.autocapture.setElementSelectors(s)}}replace(e){this.Vh.clear(),this.Gh.clear(),this.register(e)}on(e,t){t!=null&&e.length!=0&&(this.Gh.has(e)||this.Gh.has(t.event))&&this.Vh.forEach(i=>{this.ec(t,i)&&this.Zh.emit("actionCaptured",i.name)})}nc(e){this.onAction("actionCaptured",t=>e(t))}ec(e,t){if(t?.steps==null)return!1;for(let i of t.steps)if(this.Qh(e,i))return!0;return!1}onAction(e,t){return this.Zh.on(e,t)}Kh(e,t){if(t?.url){var i;let s=e==null||(i=e.properties)===null||i===void 0?void 0:i.$current_url;if(!s||typeof s!="string"||!$t(s,t.url,t.url_matching||"contains"))return!1}return!0}Xh(e,t){return!!this.sc(e,t)&&!!this.rc(e,t)&&!!this.oc(e,t)}sc(e,t){var i;if(!t?.href)return!0;let s=this.ac(e);if(s.length>0)return s.some(r=>$t(r.href,t.href,t.href_matching||"exact"));let n=(e==null||(i=e.properties)===null||i===void 0?void 0:i.$elements_chain)||"";return!!n&&$t((function(r){let o=r.match(/(?::|")href="(.*?)"/);return o?o[1]:""})(n),t.href,t.href_matching||"exact")}rc(e,t){var i;if(!t?.text)return!0;let s=this.ac(e);if(s.length>0)return s.some(l=>$t(l.text,t.text,t.text_matching||"exact")||$t(l.$el_text,t.text,t.text_matching||"exact"));let n=(e==null||(i=e.properties)===null||i===void 0?void 0:i.$elements_chain)||"";return!!n&&(r=(function(l){let u=[],c=/(?::|")text="(.*?)"/g,h;for(;!A(h=c.exec(l));)u.includes(h[1])||u.push(h[1]);return u})(n),o=t.text,a=t.text_matching||"exact",r.some(l=>$t(l,o,a)));var r,o,a}oc(e,t){var i,s;if(!t?.selector)return!0;let n=e==null||(i=e.properties)===null||i===void 0?void 0:i.$element_selectors;if(n?.includes(t.selector))return!0;let r=(e==null||(s=e.properties)===null||s===void 0?void 0:s.$elements_chain)||"";if(t.selector_regex&&r)try{return new RegExp(t.selector_regex).test(r)}catch{return!1}return!1}ac(e){var t;return(e==null||(t=e.properties)===null||t===void 0?void 0:t.$elements)==null?[]:e?.properties.$elements}Yh(e,t){return!t?.properties||t.properties.length===0||Ol(t.properties.reduce((i,s)=>{let n=C(s.value)?s.value.map(String):s.value!=null?[String(s.value)]:[];return i[s.key]={values:n,operator:s.operator||"exact"},i},{}),e?.properties)}},jd=class{constructor(e){var t,i;this.lc=[],this._instance=e,this.uc=new Map,this.hc=new Map,this.cc=new Map,this.dc=(t=this._instance)===null||t===void 0||(i=t.onSessionId)===null||i===void 0?void 0:i.call(t,s=>this.vc(s))}fc(e){return!1}gc(){return null}mc(e){}yc(){}bc(e,t){return!!e&&Ol(e.propertyFilters,t?.properties)}_c(e,t){let i=new Map;return e.forEach(s=>{var n;(n=s.conditions)===null||n===void 0||(n=n[t])===null||n===void 0||(n=n.values)===null||n===void 0||n.forEach(r=>{if(r?.name){let o=i.get(r.name)||[];o.push(s.id),i.set(r.name,o)}})}),i}wc(e,t,i){let s=(i===Vt.Activation?this.uc:this.hc).get(e),n=[];return this.kc(r=>{n=r.filter(o=>s?.includes(o.id))}),n.filter(r=>{var o;let a=(o=r.conditions)===null||o===void 0||(o=o[i])===null||o===void 0||(o=o.values)===null||o===void 0?void 0:o.find(l=>l.name===e);return this.bc(a,t)})}register(e){this.Sc(e,!1)}replace(e){this.Sc(e,!0)}Sc(e,t){var i;E((i=this._instance)===null||i===void 0?void 0:i._addCaptureHook)||(this.xc(e,t),this.Cc(e,t))}Cc(e,t){let i=e.filter(r=>{var o;return(o=r.conditions)===null||o===void 0||(o=o.actions)===null||o===void 0||(o=o.values)===null||o===void 0?void 0:o.length});var s;if(t&&this.cc.clear(),i.length===0)return void(t&&((s=this.$c)===null||s===void 0||s.replace([])));this.$c||(this.$c=new Nd(this._instance),this.$c.init(),this.$c.nc(r=>this.onAction(r)));let n=[];i.forEach(r=>{var o;(o=r.conditions)===null||o===void 0||(o=o.actions)===null||o===void 0||o.values.forEach(a=>{if(n.push(a),a.name){var l;let u=(l=this.cc.get(a.name))!==null&&l!==void 0?l:[];u.includes(r.id)||u.push(r.id),this.cc.set(a.name,u)}})}),t?this.$c.replace(n):this.$c.register(n)}Tc(e,t){t.forEach((i,s)=>{var n;let r=(n=e.get(s))!==null&&n!==void 0?n:[];
2i.forEach(o=>{r.includes(o)||r.push(o)}),e.set(s,r)})}xc(e,t){var i,s;let n=e.filter(l=>{var u,c;return((u=l.conditions)===null||u===void 0?void 0:u.events)&&((c=l.conditions)===null||c===void 0||(c=c.events)===null||c===void 0||(c=c.values)===null||c===void 0?void 0:c.length)>0}),r=e.filter(l=>{var u,c;return((u=l.conditions)===null||u===void 0?void 0:u.cancelEvents)&&((c=l.conditions)===null||c===void 0||(c=c.cancelEvents)===null||c===void 0||(c=c.values)===null||c===void 0?void 0:c.length)>0}),o=this._c(e,Vt.Activation),a=this._c(e,Vt.Cancellation);t?(this.uc=o,this.hc=a):(this.Tc(this.uc,o),this.Tc(this.hc,a)),(n.length!==0||r.length!==0)&&((i=this.tc)!==null&&i!==void 0||(this.tc=(s=this._instance)===null||s===void 0?void 0:s._addCaptureHook((l,u)=>{this.onEvent(l,u)})))}onEvent(e,t){var i,s;let n=this.Ic(),r=(t==null||(i=t.properties)===null||i===void 0?void 0:i.$survey_id)||(t==null||(s=t.properties)===null||s===void 0?void 0:s.$product_tour_id);if(r&&this.getActivatedIds().includes(r)){let a=this.Mc(e,r);if(a==="consume")return n.info("event consumed activated item, removing it",{event:e,itemId:r}),void this.Ec([r]);if(a==="persist")return n.info("shown item promoted to persisted activation",{event:e,itemId:r}),this.Pc(r),void this.Rc([r])}if(this.hc.has(e)){let a=this.wc(e,t,Vt.Cancellation);a.length>0&&(n.info("cancel event matched, cancelling items",{event:e,itemsToCancel:a.map(l=>l.id)}),this.Ec(a.map(l=>l.id)),a.forEach(l=>this.Ac(l.id)))}if(!this.uc.has(e))return;n.info("event name matched",{event:e,eventPayload:t,items:this.uc.get(e)});let o=this.wc(e,t,Vt.Activation);this.Fc(o.map(a=>a.id))}onAction(e){this.cc.has(e)&&this.Fc(this.cc.get(e)||[])}Fc(e){var t,i;if(e.length===0)return;let s=!!(!((t=this._instance)===null||t===void 0||(i=t.get_session_id)===null||i===void 0)&&i.call(t)),n=[];for(let r of e)s&&this.fc(r)?this.Pc(r)&&this.Oc(r):n.push(r);n.length>0&&(this.lc=[...new Set([...this.lc,...n])]),this.Ic().info("updating activated items",{activatedItems:this.getActivatedIds()})}Pc(e){this.lc=this.lc.filter(i=>i!==e);let t=this.Dc();return!t.includes(e)&&(this.Lc([...t,e]),this.Nc(),!0)}Ec(e){let t=new Set(e);this.lc=this.lc.filter(n=>!t.has(n));let i=this.qc(),s=i.filter(n=>!t.has(n));s.length!==i.length&&(this.Lc(s),s.length===0&&this.jc()),this.Rc(e)}Bc(){var e;let t=this.gc();if(!t)return{};let i=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[t];return i&&typeof i=="object"?i:{}}Oc(e){if(!this.gc())return;let t=this.Bc();this.mc(v(v({},t),{},{[e]:Date.now()}))}Rc(e){if(!this.gc())return;let t=this.Bc(),i={},s=!1;for(let[n,r]of Object.entries(t))e.includes(n)?s=!0:i[n]=r;s&&(xe(i)?this.yc():this.mc(i))}Hc(){this.gc()&&this.yc()}getActivationTimestamp(e){if(!this.Dc().includes(e))return;let t=this.Bc()[e];return re(t)?t:void 0}qc(){var e;let t=this.zc();return((e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[t])||[]}Dc(){var e,t,i;let s=this.qc();if(s.length===0)return[];let n=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[this.Uc()],r=(t=this._instance)===null||t===void 0||(i=t.get_session_id)===null||i===void 0?void 0:i.call(t);return r&&n===r?s:[]}Nc(){var e,t;let i=(e=this._instance)===null||e===void 0||(t=e.get_session_id)===null||t===void 0?void 0:t.call(e);i&&this.Wc(i)}jc(){this.Vc()}vc(e){var t;let i=(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0?void 0:t.props[this.Uc()];if(i&&i!==e){let s=this.qc(),n=this.Bc();s.length>0&&(this.Lc([]),s.filter(r=>re(n[r])).forEach(r=>this.Ac(r))),this.jc(),this.Hc()}}getActivatedIds(){return[...new Set([...this.Dc(),...this.lc])].filter(e=>!this.Gc(e))}dispose(){var e,t,i;(e=this.dc)===null||e===void 0||e.call(this),this.dc=void 0,(t=this.tc)===null||t===void 0||t.call(this),this.tc=void 0,(i=this.$c)===null||i===void 0||i.dispose(),this.$c=void 0}reset(){this.lc=[],this.qc().length>0&&this.Lc([]),this.jc(),this.Hc()}getEventToItemsMap(){return this.uc}Zc(){return this.$c}},Bd=class extends jd{constructor(e){super(e)}zc(){return Ra}Uc(){return Pa}gc(){return Oa}mc(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated_timestamps:e})}yc(){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.unregister("$surveys_activated_timestamps")}fc(e){var t;let i;this.kc(n=>{i=n.find(r=>r.id===e)});let s=i==null||(t=i.appearance)===null||t===void 0?void 0:t.surveyPopupDelaySeconds;return re(s)&&s>0}Qc(){return ze.SHOWN}kc(e){var t;(t=this._instance)===null||t===void 0||t.getSurveys(e)}Ac(e){var t;(t=this._instance)===null||t===void 0||t.cancelPendingSurvey(e)}Ic(){return W}Lc(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated:e})}Wc(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated_session:e})}Vc(){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.unregister("$surveys_activated_session")}Gc(){return!1}Mc(e,t){let i;return this.kc(s=>{i=s.find(n=>n.id===t)}),!i||(function(s){var n;return Rl(s)&&!!(!((n=s.conditions)===null||n===void 0||(n=n.events)===null||n===void 0)&&n.repeatedActivation)||s.schedule==="always"})(i)?e===ze.SHOWN?"consume":"ignore":e===ze.SHOWN?"persist":e===ze.DISMISSED||e===ze.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}
2getEventToSurveys(){return this.getEventToItemsMap()}},qd=class{constructor(e){this._instance=e}initialize(){}get(e){if(typeof e=="string")return this._instance.get_property(e);let t={};for(let i of e){let s=this._instance.get_property(i);E(s)||(t[i]=s)}return t}set(e,t){this._instance.register(typeof e=="string"?{[e]:t}:e)}remove(e){typeof e!="string"?e.forEach(t=>this._instance.unregister(t)):this._instance.unregister(e)}},Ud=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=F?.__PosthogExtensions__;if(!e)return;let{generateSurveys:t,loadExternalDependency:i}=e;return{generateSurveys:t?s=>t(this._instance,s):void 0,loadExternalDependency:i?s=>i(this._instance,"surveys",s):void 0}}createEventReceiver(){return new Bd(this._instance)}},Vd=y?.location?Xi(y.location.hash,"__posthog")||Xi(location.hash,"state"):null,ao="_postHogToolbarParams",lo=ne("[Toolbar]"),uo=ne("[FeatureFlags]"),Hd=class{constructor(e,t=!1){this.Jc=!1,this.update(e,t)}update(e,t){this.Kc=((i,s)=>{var n,r,o,a,l,u,c,h;return{bootstrap:{featureFlags:(n=(r=i.bootstrap)===null||r===void 0?void 0:r.featureFlags)!==null&&n!==void 0?n:void 0,featureFlagPayloads:(o=(a=i.bootstrap)===null||a===void 0?void 0:a.featureFlagPayloads)!==null&&o!==void 0?o:void 0},remoteRequestsDisabled:s,featureFlagsDisabled:!!i.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!i.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!i.advanced_feature_flags_dedup_per_session,cacheTtlMs:i.feature_flag_cache_ttl_ms,refreshIntervalMs:(l=i.remote_config_refresh_interval_ms)!==null&&l!==void 0?l:3e5,idleRefreshBackoff:E(i.remote_config_refresh_interval_ms),requestTimeoutMs:i.feature_flag_request_timeout_ms,requestMaxRetries:Math.max(0,(u=i.feature_flag_request_max_retries)!==null&&u!==void 0?u:1),compression:i.disable_compression?void 0:"best-available",evaluationContexts:(c=(h=i.evaluation_contexts)!==null&&h!==void 0?h:i.evaluation_environments)!==null&&c!==void 0?c:[],flagKeys:C(i.flag_keys)?i.flag_keys:void 0}})(e,t),!e.evaluation_environments||e.evaluation_contexts||this.Jc||(uo.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Jc=!0),E(e.flag_keys)||C(e.flag_keys)||uo.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this.Kc}},co=ne("[FeatureFlags]"),dt=ne("[FeatureFlags]",{debugEnabled:!0}),Vs=`" failed. Feature flags didn't load in time.`,zd=[502,504],ho=["click","keydown","wheel","touchstart","pointerdown"],po="connection_error",vo=e=>{let t={};for(let i=0;e.length>i;i++)t[e[i]]=!0;return t},fo=e=>{let t={};for(let[i,s]of Ci(e||{}))s&&(t[i]=s);return t},go=e=>Dt(e)&&(e.name==="RangeError"&&e.message.indexOf("Maximum call stack size exceeded")===0||e.name==="InternalError"&&e.message==="too much recursion"),Oe=ne("[Error tracking]"),wn="webkit-masked-url:",Wd=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],Gd=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",wn],Yd=["__firefox__","__gCrWeb"],_o="Refusing to render web experiment since the viewer is a likely bot",Xd={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>es(t,e),not_regex:(e,t)=>!es(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e},Pe=ne("[Conversations]"),ht="Conversations not available yet.";function mo(e,t){var i,s,n,r,o,a,l;let u=(i=e?.flushIntervalMs)!==null&&i!==void 0?i:3e3,c=(s=e?.maxBufferSize)!==null&&s!==void 0?s:100,h=t?.consoleCapture?void 0:(n=e?.maxLogsPerInterval)!==null&&n!==void 0?n:1e3,d=E(h)?Math.max(c,2048):Math.max(c,h),p=v(v({},(function(){let g="",m="";try{let _=de?.userAgent;_&&([g,m]=Zo(_))}catch{}return(function(_,f){let b=(function(w){if(w)return{}.hasOwnProperty.call(hr,w)?hr[w]:w})(_);return v(v({},b?{"os.name":b}:{}),f?{"os.version":f}:{})})(g,m)})()),e?.resourceAttributes);return{serviceName:(r=(o=p?.["service.name"])!==null&&o!==void 0?o:e?.serviceName)!==null&&r!==void 0?r:t?.serviceNameDefault,serviceVersion:(a=p?.["service.version"])!==null&&a!==void 0?a:e?.serviceVersion,environment:(l=p?.["deployment.environment"])!==null&&l!==void 0?l:e?.environment,resourceAttributes:p,beforeSend:e?.beforeSend,flushIntervalMs:u,maxBufferSize:c,maxQueueSize:d,maxBatchRecordsPerPost:100,rateCapWindowMs:u,maxLogsPerInterval:h,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}
2var Kd=["debug","log","warn","error","info"],Jd=e=>{for(;e?.__rrweb_original__;)e=e.__rrweb_original__;return e},yo="console",Ml="__posthogHandledLogsRequestError",Hs=(e,t)=>{let i=e instanceof Error?e:new Error(t);return i[Ml]=!0,i},bo=e=>!!e&&typeof e=="object"&&e[Ml]===!0,ts=ne("[NetworkMetrics]"),Un=()=>{var e;return!(y==null||(e=y.performance)===null||e===void 0)&&e.now?y.performance.now():Date.now()},Zd={"http:":80,"https:":443},Qd=new Set(["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"]),Al=(e,t)=>{var i;let s=String(t);return{method:String(e).toUpperCase(),url:((i=Ge(s))===null||i===void 0?void 0:i.href)||s}},En=(e,t,i,s,n,r,o=!1)=>{try{var a,l;let u=n();if(!u)return;let c=i||void 0,h=Un()-s,d=Ge(t.url);if(d&&d.protocol!=="http:"&&d.protocol!=="https:")return;let p={url:d?.href||t.url,method:t.method},g=ce(u.name)?u.name(p):L(u.name)?u.name:"http.client.request.duration";if(!g)return;let m=o&&!c?void 0:((f,b)=>f?400>f?void 0:String(f):b?.name||"_OTHER")(c,r),_=v(v(v(v(v({},(f=>{let b=Qd.has(f)?f:"_OTHER";return v({"http.request.method":b},b==="_OTHER"&&f!==b?{"http.request.method_original":f}:{})})(p.method)),d?(f=>{return{"server.address":f.hostname.startsWith("[")&&f.hostname.endsWith("]")?f.hostname.slice(1,-1):f.hostname,"server.port":Number(f.port)||Zd[f.protocol],"url.scheme":f.protocol.slice(0,-1),"url.template":(b=f.pathname,b.split("/").map(w=>(P=>/^\d+$/.test(P)||P.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(P))(w)?":id":w).join("/"))};var b})(d):{}),c?{"http.response.status_code":c}:{}),m?{"error.type":m}:{}),(a=u.attributes)===null||a===void 0?void 0:a.call(u,p,{status:c,durationMs:h}));(l=e.metrics)===null||l===void 0||l.histogram(g,h,{unit:"ms",attributes:_})}catch(u){ts.error("Failed to record network metric",u)}},Ll=()=>{},eh=(e,t)=>ce(y?.fetch)?gi(y,"fetch",i=>function(...s){let n=Un(),r=i.apply(this,s);if(!t())return r;try{var o,a,l;let[u,c]=s,h=Al((o=(a=c?.method)!==null&&a!==void 0?a:u?.method)!==null&&o!==void 0?o:"GET",(l=u?.url)!==null&&l!==void 0?l:u);return r.then(d=>(En(e,h,d?.status,n,t,void 0,!0),d),d=>{throw En(e,h,void 0,n,t,d),d})}catch(u){return ts.error("Failed to observe fetch",u),r}}):Ll,th=(e,t)=>{var i;let s=y==null||(i=y.XMLHttpRequest)===null||i===void 0?void 0:i.prototype;if(!s)return Ll;let n=new WeakMap,r=gi(s,"open",a=>function(...l){try{vl.has(this)||n.set(this,Al(l[0],l[1]))}catch(u){ts.error("Failed to observe XHR open",u)}return a.apply(this,l)}),o=gi(s,"send",a=>function(...l){let u;try{let c=n.get(this);if(c&&t()){let h=Un();u=()=>{this.removeEventListener("loadend",u),En(e,c,this.status,h,t)},z(this,"loadend",u)}}catch(c){ts.error("Failed to observe XHR send",c)}try{return a.apply(this,l)}catch(c){throw u&&this.removeEventListener("loadend",u),c}});return()=>{r(),o()}},os={featureFlags:class{constructor(e){this.name="featureFlags",this.Xc=!1,this.featureFlagEventHandlers=[],this.$=co,this.Yc={},this.td={},this.ed=[],this.nd=!1,this.sd=!1,this.rd=0,this.od=!1,this.ad=!1,this.ld=!1,this.ud=!1,this.hd=0,this.dd=!1,this.an=()=>{let t=this.vd();this.hd=0,t&&this.reloadFeatureFlags()},this.fd=()=>{var t,i;let s=this.pd,n=(t=this.gd)!==null&&t!==void 0?t:s;E(s)||E(n)||this.Rr.remoteRequestsDisabled||!x||x.visibilityState==="hidden"||Date.now()-((i=this.md)!==null&&i!==void 0?i:0)<n||(this.gd=this.dd||!this.Rr.idleRefreshBackoff?s:Math.min(2*n,36e5),this.dd=!1,this.reloadFeatureFlags(),this.yd())},this.bd=()=>{this.dd&&this.gd===this.pd||this._d()},this.ln=()=>{x?.visibilityState==="visible"&&this._d()},"get"in e?this.So=e:(this._instance=e,this.wd=new Hd(e.config,e.nl()),this.So=this.wd)}updateConfig(e,t){var i;(i=this.wd)===null||i===void 0||i.update(e,t),this.wo&&this.kd()}setup(e){return this.Fh=e,this.$=e.logger.createLogger("[FeatureFlags]"),Cl(e.kv.initialize(),()=>{this.Fh===e&&(this.Fh=void 0,this.wo=e,this.Sd(e))})}Sd(e){var t;if(this.wo===e)return y&&z(y,"online",this.an),this.kd(),this.xd=e.registerDynamicEventProperties(()=>this.Cd()?this.Yc:this.td),this.$d=(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0?void 0:t.onCrossTabFeatureFlagChange(()=>{this.Td(),this.Id(),this.Md()}),this.Id(),this.initialize()}_d(){this.dd=!0,this.gd=this.pd,this.fd()}kd(){let e=this.Rr.refreshIntervalMs,t=!this.Rr.remoteRequestsDisabled&&x&&!E(e)&&e>0?e:void 0;this.Rr.idleRefreshBackoff||(this.gd=t),t!==this.pd&&(this.Ed(),E(t)||(this.pd=t,this.gd=t,this.yd(),x?.addEventListener&&(z(x,di,this.ln),Rt(ho,i=>
2{z(x,i,this.bd,{capture:!0})}))))}yd(){E(this.pd)||(E(this.Pd)||clearInterval(this.Pd),this.md=Date.now(),this.Pd=setInterval(this.fd,this.pd))}Ed(){var e;E(this.Pd)||(clearInterval(this.Pd),this.Pd=void 0,x==null||(e=x.removeEventListener)===null||e===void 0||e.call(x,"visibilitychange",this.ln),Rt(ho,t=>{var i;x==null||(i=x.removeEventListener)===null||i===void 0||i.call(x,t,this.bd,{capture:!0})})),this.pd=void 0,this.gd=void 0,this.dd=!1,this.md=void 0}destroy(){this.Rd()}dispose(){this.Rd()}Rd(){var e,t;this.Ed(),this.rd++,this.ad=!1,this.Fh=void 0,this.wo&&(this.Ad(),(e=this.xd)===null||e===void 0||e.dispose(),this.xd=void 0,(t=this.$d)===null||t===void 0||t.call(this),this.$d=void 0,this.ed=[],y?.removeEventListener("online",this.an),this.wo=void 0)}get Rr(){return this.So.get()}Fd(e){var t;return this.Od&&e in this.Od?this.Od[e]:(t=this.wo)===null||t===void 0?void 0:t.kv.get(e)}Td(){return!!this.Od&&(this.Od=void 0,!0)}Dd(){var e;return!E((e=this.wo)===null||e===void 0?void 0:e.kv.get("$enabled_feature_flags"))&&this.Td()}At(e){this.Ld(()=>{var t;return(t=this.wo)===null||t===void 0?void 0:t.kv.set(e)})}Nd(e,t,i){var s;if(!(!((s=this._instance)===null||s===void 0)&&s.persistence)||!e.$enabled_feature_flags)return;let n=this.Fd("$enabled_feature_flags")||{},r=e.$enabled_feature_flags||{},o=t.flags||t.featureFlags,a=t.flags?Object.entries(t.flags).filter(([,f])=>!f?.failed).map(([f])=>f):[],l=!!t.errorsWhileComputingFlags&&!!t.flags,u=l?a:i&&!C(o)?Object.keys(o||{}):Array.from(new Set([...Object.keys(n),...Object.keys(r)])),c=this.Fd("$feature_flag_payloads")||{},h=e.$feature_flag_payloads||{},d=l||i?u:Array.from(new Set([...Object.keys(c),...Object.keys(h)])),p=!l&&!i,g=!!p||u,m=!!p||d,_={[Ve]:g,[Fe]:g,[tt]:m};e.$feature_flag_details&&(_[gt]=g);for(let f of[_t,rt,ei])E(e[f])||(_[f]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(_)}Lt(e){this.Ld(()=>{var t;return(t=this.wo)===null||t===void 0?void 0:t.kv.remove(e)})}Ld(e){try{e()}catch(t){this.$.error("Failed to update feature flag persistence",t)}}Id(){let e={};for(let s of[Ve,tt,_t,Ae]){let n=this.Fd(s);E(n)||(e[s]=n)}this.Yc=e;let t=v({},e),i=this.Fd(Fe);if(i)for(let[s,n]of Object.entries(i))t[`$feature/${s}`]=n;this.td=t}Cd(){let e=this.Rr.cacheTtlMs;if(!e||0>=e)return!1;let t=this.Fd(rt);return typeof t!="number"||Date.now()-t>e}qd(){return!!this.Cd()&&(this.ud||this.sd||(this.ud=!0,this.$.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}jd(){let e=this.Rr.evaluationContexts;return e?.length?e.filter(t=>{let i=t&&typeof t=="string"&&t.trim().length>0;return i||this.$.error("Invalid evaluation context found:",t,"Expected non-empty string"),i}):[]}Bd(){let e=this.Rr.flagKeys;if(!E(e))return e.filter(t=>{let i=t&&typeof t=="string"&&t.trim().length>0;return i||this.$.error("Invalid flag key found:",t,"Expected non-empty string"),i})}initialize(){var e,t;let i=this.Rr,s=(e=(t=i.bootstrap)===null||t===void 0?void 0:t.featureFlags)!==null&&e!==void 0?e:{};if(Object.keys(s).length){var n,r;let o=(n=(r=i.bootstrap)===null||r===void 0?void 0:r.featureFlagPayloads)!==null&&n!==void 0?n:{},a=Object.keys(s).filter(u=>!E(s[u])).reduce((u,c)=>(u[c]=s[c],u),{}),l=Object.keys(o).filter(u=>a[u]).reduce((u,c)=>(u[c]=o[c],u),{});return this.Hd({featureFlags:a,featureFlagPayloads:l},void 0,{persist:!1})}}updateFlags(e,t,i){var s,n;let r=i?.merge&&(s=this.Fd("$enabled_feature_flags"))!==null&&s!==void 0?s:{},o=i?.merge&&(n=this.Fd("$feature_flag_payloads"))!==null&&n!==void 0?n:{},a=v(v({},r),e),l=v(v({},o),t),u={};for(let[c,h]of Object.entries(a))u[c]={key:c,enabled:ar(h),variant:lr(h),reason:void 0,metadata:E(l?.[c])?void 0:{id:0,version:void 0,description:void 0,payload:l[c]}};this.Hd({flags:u})}get hasLoadedFlags(){return this.nd}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){let e=this.Fd(gt),t=this.Fd(Ae),i=this.Fd(vt);if(!i&&!t)return e||{};let s=K({},e||{}),n=[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])];for(let a of n){var r;let l=s[a],u=t?.[a],c=E(u)?(r=l?.enabled)!==null&&r!==void 0&&r:!!u,h=E(u)?l?.variant:typeof u=="string"?u:void 0,d=i?.[a],p=v(v({},l),{},{enabled:c,variant:c?h??l?.variant:void 0});var o;c!==l?.enabled&&(p.original_enabled=l?.enabled),h!==l?.variant&&(p.original_variant=l?.variant),d&&(p.metadata=v(v({},l?.metadata),{},{payload:d,original_payload:l==null||(o=l.metadata)===null||o===void 0?void 0:o.payload})),s[a]=p}return this.Xc||(this.$.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:s}),this.Xc=!0),s}getAllFeatureFlags(){let e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map(i=>{let s=e[i];return{key:i,enabled:ar(s),variant:lr(s),payload:or(t[i])}})}getFlagVariants(){let e=this.Fd(Fe),t=this.Fd(Ae);if(!t)return e||{};let i=K({},e||{}),s=Object.keys(t);for(let n=0;s.length>n;n++)i[s[n]]=t[s[n]];return this.Xc||(this.$.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this.Xc=!0),i}getFlagPayloads(){let e=this.Fd(tt),t=this.Fd(vt);if(!t)return e||{};let i=K({},e||{}),s=Object.keys(t);for(let n=0;s.length>n;n++)i[s[n]]=t[s[n]];return this.Xc||(this.$.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this.Xc=!0),i}reloadFeatureFlags(){this.od||this.Rr.featureFlagsDisabled||this.vd()||(this.sd&&(this.ad=!0),this.zd||(this.ed.slice().forEac
2h(e=>{try{e()}catch(t){this.$.error("Error while running feature flags reloading callback",t)}}),this.zd=setTimeout(()=>{this.Ud()},5)))}Ad(){clearTimeout(this.zd),this.zd=void 0}onReloading(e){return this.ed.push(e),()=>{this.ed=this.ed.filter(t=>t!==e)}}ensureFlagsLoaded(){this.nd||this.sd||this.zd||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.od=e}resetFlagCallReported(){this.Lt(nt)}Ud(e){this.Ad();let t=this.wo;if(!t||this.Rr.remoteRequestsDisabled||this.vd())return;if(this.sd)return void(this.ad=!0);let i={token:t.projectToken,distinct_id:t.distinctId,groups:t.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:v(v(v({},t.initialPersonProperties),this.Fd("$stored_person_properties")||{}),{},{$lib:t.library.name,$lib_version:t.library.version}),group_properties:this.Fd(st),timezone:al()};E(t.deviceId)||(i.$device_id=t.deviceId),(e?.disableFlags||this.Rr.featureFlagsDisabled)&&(i.disable_flags=!0);let s=this.jd();s.length&&(i.evaluation_contexts=s);let n=this.Bd();E(n)||(i.flag_keys=n);let r=this.Rr.onlyEvaluateSurveyFeatureFlags,o="/flags/?v=2"+(r?"&only_evaluate_survey_feature_flags=true":""),a=this.rd;this.sd=!0;let l=()=>{this.ad&&(this.ad=!1,this.Ud())},u=g=>{var m,_;let f=(m=g.json)!==null&&m!==void 0?m:{},b=g.statusCode!==200;if(this.sd=!1,a!==this.rd)return void l();if(this.Wd(g.statusCode),b||this.ad||(this.$anon_distinct_id=void 0),i.disable_flags&&!this.ad)return;this.ld=!b;let w=[];g.error?w.push(g.error instanceof Error&&g.error.name==="AbortError"?"timeout":g.error instanceof Error?po:"unknown_error"):g.statusCode!==200&&w.push(`api_error_${g.statusCode}`),f.errorsWhileComputingFlags&&w.push("errors_while_computing_flags");let P=!!(!((_=f.quotaLimited)===null||_===void 0)&&_.includes("feature_flags"));P&&w.push("quota_limited"),this.At({[ci]:w}),P?this.$.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset.  Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):i.disable_flags||this.Hd(f,b,{partialResponse:r}),l()},c=g=>{this.sd=!1,a===this.rd&&(this.At({[ci]:[po]}),this.$.error("Feature flag request failed",g),this.Dd()&&this.Md(!0)),l()},h=this.Rr.requestMaxRetries,d=()=>h>0&&a===this.rd,p=()=>{if(a!==this.rd||!this.wo||this.Rr.remoteRequestsDisabled)return this.sd=!1,void l();try{t.sendRequest(o,{target:"flags",method:"POST",body:i,compression:this.Rr.compression,sentAt:"body",timeoutMs:this.Rr.requestTimeoutMs}).then(g=>{if((m=>zd.includes(m.statusCode)||(_=>_.statusCode===0&&_.error instanceof Error&&_.error.name==="AbortError")(m))(g)&&d())return h--,void setTimeout(p,500);u(g)}).catch(c)}catch(g){c(g)}};p()}vd(){return Za(this.hd,3)}Wd(e){this.hd=Qa(e,this.hd,3,()=>this.$.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes."))}getFeatureFlag(e,t={}){var i;if(t.fresh&&!this.ld)return;if(!(this.nd||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlag for key "'+e+Vs);if(this.qd())return;let s=this.getFeatureFlagResult(e,t);return(i=s?.variant)!==null&&i!==void 0?i:s?.enabled}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){let t=this.getFeatureFlagResult(e,{send_event:!1});return t?.payload}getFeatureFlagResult(e,t={}){if(t.fresh&&!this.ld)return;if(!(this.nd||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlagResult for key "'+e+Vs);if(this.qd())return;let i=this.getFlagVariants(),s=e in i,n=i[e],r=this.getFlagPayloads()[e],o=String(n),a=this.Fd("$feature_flag_request_id")||void 0,l=this.Fd("$feature_flag_evaluated_at")||void 0,u,c=this.Fd("$flag_call_reported")||{};if(this.Rr.deduplicateCallsPerSession){var h;let O=(h=this.wo)===null||h===void 0?void 0:h.session.sessionId,j=this.Fd(Yt);O&&O!==j&&(c={},u=O)}if(t.send_event||!("send_event"in t))if(e in c&&c[e].includes(o))u&&this.At({[nt]:c,[Yt]:u});else{var d,p,g,m,_,f,b,w,P,S,$,I;C(c[e])?c[e].push(o):c[e]=[o],this.At(v({[nt]:c},u?{[Yt]:u}:{}));let O=this.getFeatureFlagDetails(e),j=[...(d=this.Fd("$feature_flag_errors"))!==null&&d!==void 0?d:[]];E(n)&&j.push("flag_missing");let U={$feature_flag:e,$feature_flag_response:n,$feature_flag_payload:r??null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:(p=(g=this.Rr.bootstrap)===null||g===void 0||(g=g.featureFlags)===null||g===void 0?void 0:g[e])!==null&&p!==void 0?p:null,$feature_flag_bootstrapped_payload:(m=(_=this.Rr.bootstrap)===null||_===void 0||(_=_.featureFlagPayloads)===null||_===void 0?void 0:_[e])!==null&&m!==void 0?m:null,$used_bootstrap_value:!this.ld};E(O==null||(f=O.metadata)===null||f===void 0?void 0:f.has_experiment)||(U.$feature_flag_has_experiment=O.metadata.has_experiment),E(O==null||(b=O.metadata)===null||b===void 0?void 0:b.version)||(U.$feature_flag_version=O.metadata.version);let V=(w=O==null||(P=O.reason)===null||P===void 0?void 0:P.description)!==null&&w!==void 0?w:O==null||(S=O.reason)===null||S===void 0?void 0:S.code;var R;V&&(U.$feature_flag_reason=V),!(O==null||($=O.metadata)===null||$===void 0)&&$.id&&(U.$feature_flag_id=O.metadata.id),E(O?.original_variant)&&E(O?.original_enabled)||(U.$feature_flag_original_response=E(O.original_variant)?O.original_enabled:O.original_variant),!(O==null||(I=O.metadata)===null||I===void 0)&&I.original_payload&&(U.$feature_flag_original_payload=O==null||(R=O.metadata)===null||R===void 0?void 0:R.original_payload),j.length&&(U.$feature_flag_error=j.join(",")),this.Vd(U)}else u&&this.At({[nt]:c,[Yt]:u});return s?{key:e,enabled:!!n,variant:typeof n=="string"?n:void 0,payload:or(r)}:void 0}Vd(e){try{var t;(t=this.wo)===null||t===void 0||t.capture("$feature_flag_called",e)}catch(i){this.$.error("Failed to capture feature flag call",i)}}getRemoteConfigPayload(e,t){this.Gd(e,t)}Gd(e,t){var i=this;return Z(function*(){let s=i.wo;if(!s)return;let n={distinct_id:s.distinctId,token:s.projectToken,person_properties:{$lib:s.library.name,$lib_version:s.library.version}},r=i.jd();r.length&&(n.evaluation_contexts=r);let o=i.Bd(),a;E(o)||(n.flag_keys=o);try{var l;let u=(l=(yield s.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:n,compression:i.Rr.compression,sentAt:"body",timeoutMs:i.Rr.requestTimeoutMs})).json)===null||l===void 0?void 0:l.featureFlagPayloads;a=u?.[e]||void 0}catch(u){return void i.$.error("Remote config feature flag request failed",u)}try{t(a)}catch(u){i.$.error("Remote config feature flag callback failed",u)}})()}isFeatureEnabled(e,t={}){if(t.fresh&&!this.ld)return t.defaultValue;if(!(this.nd||this.getFlags()&&this.getFlags().length>0))return this.$.warn('isFeatureEnabled for key "'+e+Vs),t.defaultValue;let i=this.getFeatureFlag(e,t);return E(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.Hd(e,t,i)}Hd(e,t,i){if(!this.wo)return;this.nd=!0;let s=((n,r={},o={},a={},l,u=co)=>{let c=((w,P)=>{let S=w.flags;if(S){let $=Object.fromEntries(Object.keys(S).map(R=>{var O;return[R,(O=S[R].variant)!==null&&O!==void 0?O:S[R].enabled]})),I=Object.fromEntries(Object.keys(S).filter(R=>S[R].enabled).filter(R=>{var O;return!E((O=S[R].metadata)===null||O===void 0?void 0:O.payload)}).map(R=>{var O;return[R,(O=S[R].metadata)===null||O===void 0?void 0:O.payload]}));return v(v({},w),{},{featureFlags:$,featureFlagPayloads:I})}return w.featureFlags&&P.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),w})(n,u),h=c.flags,d=c.featureFlags,p=c.featureFlagPayloads;if(!d)return;let g=n.requestId,m=n.evaluatedAt;if(C(d)){u.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");let w={};if(d)for(let P=0;d.length>P;P++)w[d[P]]=!0;return{[Ve]:d,[Fe]:w,[ei]:!1}}let _=d,f=p,b=h;if(l?.partialResponse){let w=Object.keys(_),P=f||{};_=v(v({},r),_),f=v(v({}
2,o),P),w.forEach(S=>{S in P||f==null||delete f[S]}),b=v(v({},a),b)}else if(n.errorsWhileComputingFlags)if(h){let w=new Set(Object.keys(h).filter(S=>{var $;return!(!(($=h[S])===null||$===void 0)&&$.failed)}));_=v(v({},r),Object.fromEntries(Object.entries(_).filter(([S])=>w.has(S))));let P=Object.fromEntries(Object.entries(f||{}).filter(([S])=>w.has(S)));f=v(v({},o),P),w.forEach(S=>{S in P||f==null||delete f[S]}),b=v(v({},a),Object.fromEntries(Object.entries(b||{}).filter(([S])=>w.has(S))))}else _=v(v({},r),_),f=v(v({},o),f),b=v(v({},a),b);return v(v({[Ve]:Object.keys(fo(_)),[Fe]:_||{},[tt]:f||{},[gt]:b||{},[ei]:n.minimalFlagCalledEvents===!0},g?{[_t]:g}:{}),m?{[rt]:m}:{})})(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),i,this.$);if(s)if(i?.persist===!1){let n=!E(this.wo.kv.get(Fe));this.Od=s,n||this.At(s)}else this.Td(),this.Nd(s,e,!!i?.partialResponse),this.At(s);else t&&this.Dd();t||(this.ud=!1),this.Md(t)}override(e,t=!1){this.$.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){this.Zd(e)}Zd(e){if(this.wo){if(e===!1)return this.Lt([Ae,vt]),this.Md(),void dt.info("All overrides cleared");if(C(e))return this.At({[Ae]:vo(e)}),this.Md(),void dt.info("Flag overrides set",{flags:e});if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var t;let i=e;this.Xc=!!((t=i.suppressWarning)!==null&&t!==void 0&&t);let s={},n=i.flags,r=i.payloads;return n&&(s[Ae]=C(n)?vo(n):n),r&&(s[vt]=r),Object.keys(s).length&&this.At(s),n===!1&&r===!1?this.Lt([Ae,vt]):n===!1?this.Lt(Ae):r===!1&&this.Lt(vt),this.Md(),n===!1?dt.info("Flag overrides cleared"):n&&dt.info("Flag overrides set",{flags:n}),void(r===!1?dt.info("Payload overrides cleared"):r&&dt.info("Payload overrides set",{payloads:r}))}if(e&&typeof e=="object")return this.At({[Ae]:e}),this.Md(),void dt.info("Flag overrides set",{flags:e});this.$.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}else this.$.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.nd){let{flags:t,flagVariants:i}=this.Qd();try{e(t,i)}catch(s){this.$.error("Error while running feature flags callback",s)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var s;let n=(this.Fd("$early_access_features")||[]).find(u=>u.flagKey===e),r={[`$feature_enrollment/${e}`]:t},o={$feature_flag:e,$feature_enrollment:t,$set:r};n&&(o.$early_access_feature_name=n.name),i&&(o.$feature_enrollment_stage=i);let a=v(v({},this.getFlagVariants()),{},{[e]:t});(s=this._instance)===null||s===void 0||(s=s.persistence)===null||s===void 0||s.markCrossTabFeatureFlagChanges({$active_feature_flags:[e],$enabled_feature_flags:[e],$stored_person_properties:Object.keys(r)}),this.At({[Ve]:Object.keys(fo(a)),[Fe]:a,[it]:v(v({},this.Fd("$stored_person_properties")||{}),r)}),this.Md();try{var l;(l=this.wo)===null||l===void 0||l.capture("$feature_enrollment_update",o)}catch(u){this.$.error("Failed to capture early access feature enrollment",u)}}getEarlyAccessFeatures(e,t=!1,i){let s=this.Fd(on);!s||t?this.Jd(e,i):e(s)}Jd(e,t){var i=this;return Z(function*(){let s=i.wo;if(!s)return;let n=t?`&${t.map(o=>`stage=${o}`).join("&")}`:"",r;try{let o=yield s.sendRequest(`/api/early_access_features/?token=${s.projectToken}${n}`,{target:"api",method:"GET",sentAt:"query"});if(!o.json)return;r=o.json.earlyAccessFeatures,i.At({[on]:r})}catch(o){return void i.$.error("Early access feature request failed",o)}try{e(r)}catch(o){i.$.error("Early access feature callback failed",o)}})()}Qd(){let e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(i=>t[i]),flagVariants:Object.keys(t).filter(i=>t[i]).reduce((i,s)=>(i[s]=t[s],i),{})}}Md(e){this.Id();let{flags:t,flagVariants:i}=this.Qd();this.featureFlagEventHandlers.forEach(s=>{try{s(t,i,{errorsLoading:e})}catch(n){this.$.error("Error while running feature flags callback",n)}})}setPersonPropertiesForFlags(e,t=!0){this.Kd(e,t)}Kd(e,t=!0){let i=this.Fd("$stored_person_properties")||{},s=e?.$set||(e?.$set_once?{}:e),n=e?.$set_once,r={};if(n)for(let o in n)({}).hasOwnProperty.call(n,o)&&(o in i||(r[o]=n[o]));this.At({[it]:v(v(v({},i),r),s)}),t&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t=!0){let i=v({},this.Fd("$stored_person_properties")||{});e.forEach(s=>{delete i[s]}),this.At({[it]:i}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e=!0){this.Lt(it),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t=!0){let i=this.Fd("$stored_group_properties")||{},s=v({},i);for(let n of Object.keys(e))s[n]=v(v({},i[n]),e[n]);this.At({[st]:s}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){let t=this.Fd("$stored_group_properties")||{};this.At({[st]:v(v({},t),{},{[e]:{}})})}else this.Lt(st)}reset(){this.rd++,this.ad=!1,this.Yc={},this.td={},this.Od=void 0,this.nd=!1,this.od=!1,this.ld=!1,this.$anon_distinct_id=void 0,this.Ad(),this.Xc=!1,this.hd=0}}},ih={sessionRecording:class{get Rr(){return this._instance.config}get Ml(){return this._instance.persistence}get started(){var e;return!!(!((e=this.Xd)===null||e===void 0)&&e.isStarted)}get status(){var e,t;return this.Yd==="awaiting_config"||this.Yd==="missing_config"?this.Yd:(e=(t=this.Xd)===null||t===void 0?void 0:t.status)!==null&&e!==void 0?e:this.Yd}constructor(e){if(this._instance=e,this._forceAllowLocalhostNetworkCapture=!1,this.Yd=Bs,this.tv=void 0,this.ev=!1,this.Xe=(()=>{var t,i;if(!x?.visibilityState||x.visibilityState==="visible")return!0;let s=y==null||(t=y.performance)===null||t===void 0||(i=t.getEntriesByType)===null||i===void 0?void 0:i.call(t,"visibility-state");return!s?.length||s.some(n=>n.name==="visible")})(),this.ln=()=>{var t,i;
2x?.visibilityState==="visible"&&(this.Xe=!0,(t=this.Xd)===null||t===void 0||(i=t.setDocumentWasEverVisible)===null||i===void 0||i.call(t,!0))},!this._instance.sessionManager)throw Be.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if(this.Rr.cookieless_mode==="always")throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');x?.addEventListener&&z(x,"visibilitychange",this.ln)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:e=!1}={}){var t;this.ev=!0,x==null||(t=x.removeEventListener)===null||t===void 0||t.call(x,"visibilitychange",this.ln),e?this.iv(!0):this.stopRecording()}get nv(){var e;let t=!!(!((e=this._instance.get_property("$session_recording_remote_config"))===null||e===void 0)&&e.enabled),i=!this.Rr.disable_session_recording,s=this.Rr.disable_session_recording||this._instance.consent.isOptedOut();return y&&t&&i&&!s}startIfEnabledOrStop(e){var t;if(this.ev||this.nv&&(!((t=this.
2Xd)===null||t===void 0)&&t.isStarted))return;let i=!E(Object.assign)&&!E(Array.from);this.nv&&i?(this.sv(e),Be.info("starting")):(this.Yd=Bs,this.stopRecording())}sv(e){var t,i;if(this.nv)if(this.Yd!=="awaiting_config"&&this.Yd!=="missing_config"&&(this.Yd=no),(F==null||(t=F.__PosthogExtensions__)===null||t===void 0||(t=t.rrweb)===null||t===void 0?void 0:t.record)&&((i=F.__PosthogExtensions__)===null||i===void 0?void 0:i.initSessionRecording))this.rv(e);else{var s,n;let r=this._instance.sessionManager;(s=F.__PosthogExtensions__)===null||s===void 0||(n=s.loadExternalDependency)===null||n===void 0||n.call(s,this._instance,this.ov,o=>{if(!this.ev&&this.nv&&this._instance.sessionManager===r)return o?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),Be.error("could not load recorder",o)):void this.rv(e);this.Yd="disabled"})}}stopRecording(){var e,t;(e=this.tv)===null||e===void 0||e.call(this),this.tv=void 0,(t=this.Xd)===null||t===void 0||t.stop()}iv(e=!1){var t,i;(t=this.tv)===null||t===void 0||t.call(this),this.tv=void 0,(i=this.Xd)===null||i===void 0||i.discard({discardProducerEvents:e})}av(){var e,t;(e=this.Ml)===null||e===void 0||e.unregister("$session_is_sampled"),(t=this.Ml)===null||t===void 0||t.unregister("$replay_sample_rate")}lv(e,t){if(A(e))return null;let i=re(e)?e:parseFloat(e);return typeof(s=i)!="number"||!Number.isFinite(s)||0>s||s>1?(Be.warn(`${t} must be between 0 and 1. Ignoring invalid value:`,e),null):i;var s}uv(e){if(this.Ml){var t,i;let s=this.Ml,n=()=>{var r;let o=e.sessionRecording===!1?void 0:e.sessionRecording,a=this.lv((r=this.Rr.session_recording)===null||r===void 0?void 0:r.sampleRate,"session_recording.sampleRate"),l=this.lv(o?.sampleRate,"remote config sampleRate"),u=a??l;A(u)&&this.av();let c=o?.minimumDurationMilliseconds;s.register({[Qt]:v(v({cache_timestamp:Date.now(),enabled:!!o},o),{},{networkPayloadCapture:v({capturePerformance:e.capturePerformance},o?.networkPayloadCapture),canvasRecording:{enabled:o?.recordCanvas,fps:o?.canvasFps,quality:o?.canvasQuality},sampleRate:u,minimumDurationMilliseconds:E(c)?null:c,endpoint:o?.endpoint,triggerMatchType:o?.triggerMatchType,masking:o?.masking,urlTriggers:o?.urlTriggers,version:o?.version,triggerGroups:o?.triggerGroups})})};n(),(t=this.tv)===null||t===void 0||t.call(this),this.tv=(i=this._instance.sessionManager)===null||i===void 0?void 0:i.onSessionId(n)}}onRemoteConfig(e){let t=e.ok?e.config:void 0;return t&&"sessionRecording"in t?t.sessionRecording===!1?(this.uv(t),void this.iv()):(this.uv(t),void this.startIfEnabledOrStop()):(this.Yd==="awaiting_config"&&(this.Yd="missing_config",this._instance.register_for_session({[La]:!0}),Be.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t="log"){var i;!((i=this.Xd)===null||i===void 0)&&i.log?this.Xd.log(e,t):Be.warn("log called before recorder was ready")}get ov(){var e,t;let i=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.get_property(Qt);return(i==null||(t=i.scriptConfig)===null||t===void 0?void 0:t.script)||"lazy-recorder"}hv(){let e=this._instance.get_property(Qt);if(!e)return!1;let t;try{t=typeof e=="object"?e:JSON.parse(e)}catch(i){return Be.warn("persisted remote config for session recording is invalid and will be ignored",i),!1}return!A(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}rv(e){var t,i,s;if(!this.ev&&this.nv&&this._instance.sessionManager){if(!(!((t=F.__PosthogExtensions__)===null||t===void 0)&&t.initSessionRecording))return Be.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Aa]:!0});var n;if(this.Xd||(this.Xd=(n=F.__PosthogExtensions__)===null||n===void 0?void 0:n.initSessionRecording(this._instance,this.Xe),this.Xd._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.hv())return this.Yd==="missing_config"||this.Yd==="awaiting_config"?void 0:(this.Yd="awaiting_config",Be.info("persisted remote config is stale, requesting fresh config before starting"),void new ul(this._instance).load());this.Yd=no,(i=(s=this.Xd).setDocumentWasEverVisible)===null||i===void 0||i.call(s,this.Xe),this.Xd.start(e)}else this.Yd=Bs}onRRwebEmit(e){var t,i;
2(t=this.Xd)===null||t===void 0||(i=t.onRRwebEmit)===null||i===void 0||i.call(t,e)}overrideLinkedFlag(){var e,t;this.Xd||(t=this.Ml)===null||t===void 0||t.register({$replay_override_linked_flag:!0}),(e=this.Xd)===null||e===void 0||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.Xd||(t=this.Ml)===null||t===void 0||t.register({$replay_override_sampling:!0}),(e=this.Xd)===null||e===void 0||e.overrideSampling()}overrideTrigger(e){var t,i;this.Xd||(i=this.Ml)===null||i===void 0||i.register({[e==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(t=this.Xd)===null||t===void 0||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.Xd)===null||e===void 0?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var i;return!!(!((i=this.Xd)===null||i===void 0)&&i.tryAddCustomEvent(e,t))}flushBeforeIdentityReset(){var e,t;(e=this.Xd)===null||e===void 0||(t=e.flushBeforeIdentityReset)===null||t===void 0||t.call(e)}}},sh={autocapture:class extends Id{constructor(e){super(new Fd(e)),this.instance=e}},historyAutocapture:class{constructor(e){this.dv=!1,this._instance=e,this.vv=this.fv()}initialize(){this.startIfEnabled()}get isEnabled(){let e=this.pv();return!!(e.path||e.search||this.gv(e))}startIfEnabled(){this.isEnabled&&(k.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.vv=this.fv(),this.startIfEnabled()}stop(){this.mv&&this.mv(),this.mv=void 0,this.yv&&this.yv(),this.yv=void 0,k.info("History API monitoring stopped")}monitorHistoryChanges(){y&&y.history&&(this.bv("pushState"),this.bv("replaceState"),this._v(),this.gv()&&this.wv())}bv(e){var t;if(!y||!((t=y.history[e])===null||t===void 0)&&t.__posthog_wrapped__)return;let i=this;gi(y.history,e,s=>function(n,r,o){var a;i.Sv(o)&&i.xv(),s.call(this,n,r,o),i.Cv(e,!i.dv&&(y==null||(a=y.event)===null||a===void 0?void 0:a.type)!=="popstate")})}fv(){let e=y?.location;if(e?.pathname)return{pathname:e.pathname,search:e.search,hash:e.hash}}pv(){let e=this._instance.config.capture_pageview;return e==="history_change"?{path:!0}:N(e)?e:{}}gv(e=this.pv()){return!!e.hash&&!this._instance.config.disable_capture_url_hashes}$v(e){let t=this.pv(),i=this.vv;return!(!i||!(t.path&&e.pathname!==i.pathname||t.search&&e.search!==i.search||this.gv(t)&&e.hash!==i.hash))}Cv(e,t=!1){try{t||this.xv();let i=this.fv();if(!i)return;if(this.$v(i)){let s=()=>this._instance.capture(Mn,{navigation_type:e});t?(this.Tv=s,Promise.resolve().then(()=>this.xv())):s()}this.vv=i}catch(i){k.error(`Error capturing ${e} pageview`,i)}}Sv(e){var t,i;return!(A(e)||!y)&&((t=Ge(String(e)))===null||t===void 0?void 0:t.href)!==((i=y.location)===null||i===void 0?void 0:i.href)}xv(){let e=this.Tv;if(e){this.Tv=void 0,this.dv=!0;try{e()}catch(t){k.error("Error capturing deferred pageview",t)}finally{this.dv=!1}this.vv=this.fv()}}_v(){if(this.mv)return;let e=()=>{this.Cv("popstate")};z(y,"popstate",e),this.mv=()=>{y&&y.removeEventListener("popstate",e)}}wv(){if(this.yv)return;let e=()=>{this.Cv("hashchange")};z(y,"hashchange",e),this.yv=()=>{y&&y.removeEventListener("hashchange",e)}}},heatmaps:class{get Rr(){return this.instance.config}constructor(e){var t;this.Iv=!1,this.xo=!1,this.Mv=null,this.instance=e,this.Iv=!!(!((t=this.instance.persistence)===null||t===void 0)&&t.props[tn]),this.rageclicks=new Tl(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let e=5e3;return N(this.Rr.capture_heatmaps)&&this.Rr.capture_heatmaps.flush_interval_milliseconds&&(e=this.Rr.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return A(this.Rr.capture_heatmaps)?A(this.Rr.enable_heatmaps)?this.Iv:this.Rr.enable_heatmaps:this.Rr.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.xo)return;Ad.info("starting..."),this.Ev(),this.ln()}else{var e;clearInterval((e=this.Mv)!==null&&e!==void 0?e:void 0),this.Pv(),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({[tn]:i}),this.Iv=i,this.startIfEnabled()}getAndClearBuffer(){let e=this.Rt;return this.Rt=void 0,e}Rv(e){qs(e.originalEvent)&&this.Tr(e.originalEvent,"deadclick")}ln(){this.Mv&&clearInterval(this.Mv),this.Mv=x?.visibilityState==="visible"?setInterval(this.bl.bind(this),this.flushIntervalMilliseconds):null}
2Ev(){y&&x&&(this.Av=this.bl.bind(this),z(y,Gi,this.Av),this.Fv=e=>this.Tr(e||y?.event),z(x,"click",this.Fv,{capture:!0}),this.Ov=e=>this.Dv(e||y?.event),z(x,"mousemove",this.Ov,{capture:!0}),this.Lv=new Cr(this.instance,Dc,this.Rv.bind(this)),this.Lv.startIfEnabledOrStop(),this.Nv=this.ln.bind(this),z(x,di,this.Nv),this.xo=!0)}Pv(){var e;y&&x&&(this.Av&&y.removeEventListener(Gi,this.Av),this.Fv&&x.removeEventListener("click",this.Fv,{capture:!0}),this.Ov&&x.removeEventListener("mousemove",this.Ov,{capture:!0}),this.Nv&&x.removeEventListener(di,this.Nv),clearTimeout(this.qv),(e=this.Lv)===null||e===void 0||e.stop(),this.xo=!1)}jv(e,t){let i=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),r=(function(o,a,l){let u=o;for(;u&&Ne(u)&&!ve(u,"body");){if(u===l)return!1;let p;try{var c,h,d;p=(c=(h=(d=u.ownerDocument)===null||d===void 0?void 0:d.defaultView)!==null&&h!==void 0?h:y)===null||c===void 0?void 0:c.getComputedStyle(u).position}catch{return!1}if(M(a,p))return!0;u=za(u)}return!1})(ii(e),["fixed","sticky"],n);return{x:e.clientX+(r?0:s),y:e.clientY+(r?0:i),target_fixed:r,type:t}}Tr(e,t="click"){var i;if(xr(e.target)||!qs(e))return;let s=this.jv(e,t);!((i=this.rageclicks)===null||i===void 0)&&i.isRageClick(e.clientX,e.clientY,new Date().getTime())&&Ga(ii(e),this.instance.config.rageclick)&&this.Zs(v(v({},s),{},{type:"rageclick"})),this.Zs(s)}Dv(e){!xr(e.target)&&qs(e)&&(clearTimeout(this.qv),this.qv=setTimeout(()=>{this.Zs(this.jv(e,"mousemove"))},500))}Zs(e){if(!y)return;let t=this.Rr.disable_capture_url_hashes?ot(y.location.href):y.location.href,i=this.Rr.custom_personal_data_properties,s=this.Rr.mask_personal_data_properties?[...At,...i||[]]:[],n=vi(t,s,fi);this.Rt=this.Rt||{},this.Rt[n]||(this.Rt[n]=[]),this.Rt[n].push(e)}bl(){this.Rt&&!xe(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Cr,webVitalsAutocapture:class{constructor(e){var t;this._instance=e,this.Iv=!1,this.xo=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Bv=()=>{clearTimeout(this.Hv),this.Hv=void 0,this.Rt.metrics.length!==0&&(this._instance.capture("$web_vitals",v({$current_url:this.Rt.url},this.Rt.metrics.reduce((i,s)=>v(v({},i),{},{[`$web_vitals_${s.name}_event`]:v({},s),[`$web_vitals_${s.name}_value`]:s.value}),{}))),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.zv=i=>{var s;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},A(i?.name)||A(i?.value))return void ct.error("Invalid metric received",i);let n=typeof i.navigationURL=="string"?i.navigationURL:void 0,r=this.Uv(n);if(E(r))return;let o=re(i.navigationId)||typeof i.navigationId=="string"?`navigation:${i.navigationId}`:`url:${r}`;if(this.Wv&&i.value>=this.Wv)return void ct.error("Ignoring metric with value >= "+this.Wv,i);this.Rt.navigationKey!==o&&(this.Bv(),this.Hv=setTimeout(this.Bv,this.flushToCaptureTimeoutMs)),E(this.Rt.navigationKey)&&(this.Rt.navigationKey=o,this.Rt.url=r),this.Rt.firstMetricTimestamp=E(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;let a=(s=this._instance.sessionManager)===null||s===void 0?void 0:s.checkAndGetSessionAndWindowId(!0),l=v(v(v({},i),n?{navigationURL:r}:{}),{},{$current_url:r,timestamp:Date.now()});if(delete l.entries,N(i.attribution)&&this.attributionMetrics.indexOf(i.name)>-1){let u={};for(let c of Md){let h=c==="url"&&typeof i.attribution[c]=="string"?this.Uv(i.attribution[c]):i.attribution[c];E(h)||(u[c]=h)}l.attribution=u}else delete l.attribution;E(a)||(l.$session_id=a.sessionId,l.$window_id=a.windowId),this.Rt.metrics.push(l),this.Rt.metrics.length===this.allowedMetrics.length&&this.Bv()},this.Vv=()=>{if(this.xo)return;let i,s,n,r,o=!1,a=F.__PosthogExtensions__,l=a?.postHogWebVitalsCallbacksByFlavor,u=l?.[this.Gv]||(this.Gv==="web-vitals"&&E(l)?a?.postHogWebVitalsCallbacks:void 0);if(!E(u)){let d=u.withoutAttribution,p=this.attributionMetrics;o=!E(d),i=p.indexOf("LCP")>-1?u.onLCP:d?.onLCP||u.onLCP,s=p.indexOf("CLS")>-1?u.onCLS:d?.onCLS||u.onCLS,n=p.indexOf("FCP")>-1?u.onFCP:d?.onFCP||u.onFCP,r=p.indexOf("INP")>-1?u.onINP:d?.onINP||u.onINP}if(!(i&&s&&n&&r))return void ct.error("web vitals callbacks not loaded - not starting");let c={reportSoftNavs:this.useSoftNavs},h=o&&this.attributionMetrics.indexOf("INP")>-1?v(v({},c),{},{includeProcessedEventEntries:!1}):c;this.allowedMetrics.indexOf("LCP")>-1&&i(this.zv.bind(this),c),this.allowedMetrics.indexOf("CLS")>-1&&s(this.zv.bind(this),c),this.allowedMetrics.indexOf("FCP")>-1&&n(this.zv.bind(this),c),this.allowedMetrics.indexOf("INP")>-1&&r(this.zv.bind(this),h),this.xo=!0},this.Iv=!!(!((t=this._instance.persistence)===null||t===void 0)&&t.props[rn]),this.startIfEnabled()}get Zv(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t;let i=N(this.Zv)?(e=this.Zv)===null||e===void 0?void 0:e.web_vitals_allowed_metrics:void 0;return A(i)?((t=this._instance.persistence)===null||t===void 0?void 0:t.props.$web_vitals_allowed_metrics)||so:i}get flushToCaptureTimeoutMs(){return(N(this.Zv)?this.Zv.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){let e=N(this.Zv)?this.Zv.web_vitals_attribution:void 0;return be(e)?e?so:[]:C(e)?e:Cd}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){let e=N(this.Zv)?this.Zv.__preview_web_vitals_soft_navs:void 0;return e!=null&&e}get Wv(){let e=N(this.Zv)&&re(this.Zv.__web_vitals_max_value)?this.Zv.__web_vitals_max_value:io;return e>0&&6e4>=e?io:e}get isEnabled(){let e=ie?.protocol;if(e!=="http:"&&e!=="https:")return ct.info("Web Vitals are disabled on non-http/https protocols"),!1;let t=N(this.Zv)?this.Zv.web_vitals:be(this.Zv)?this.Zv:void 0;return be(t)?t:this.Iv}startIfEnabled(){this.isEnabled&&!this.xo&&(ct.info("enabled, starting..."),this.zo(this.Vv))}onRemoteConfig(e){if(!e.ok)return;let t=e.config;if(!("capturePerformance"in t))return;let i=N(t.capturePerformance)&&!!t.capturePerformance.web_vitals,s=N(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[rn]:i}),this._instance.persistence.register({[$a]:s})),this.Iv=i,this.startIfEnabled()}get Gv(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}zo(e){var t;let i=F.__PosthogExtensions__,s=this.Gv,n=i?.postHogWebVitalsCallbacksByFlavor;n?.[s]||s==="web-vitals"&&E(n)&&i?.postHogWebVitalsCallbacks?e():i==null||(t=i.loadExternalDependency)===null||t===void 0||t.call(i,this._instance,s,r=>{r?ct.error("failed to load script",r):e()})}Uv(e){let t=e||y?.location.href;if(!t)return void ct.error("Could not determine current URL");let i=this._instance.config.disable_capture_url_hashes?ot(t):t,s=this._instance.config.custom_personal_data_properties,n=this._instance.config.mask_personal_data_properties?[...At,...s||[]]:[];return vi(i,n,fi)}}},nh={exceptionObserver:class{constructor(e){var t;this.Vv=()=>{var i;if(!y||!this.isEnabled||!(!((i=F.__PosthogExtensions__)===null||i===void 0)&&i.errorWrappingFunctions))return;let s=F.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,n=F.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=F.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Qv&&this.Rr.capture_unhandled_errors&&(this.Qv=s(this.captureException.bind(this))),!this.Jv&&this.Rr.capture_unhandled_rejections&&(this.Jv=n(this.captureException.bind(this))),!this.Kv&&this.Rr.capture_console_errors&&(this.Kv=r(this.captureException.bind(this)))}catch(o){Gt.error("failed to start",o),this.Xv()}},this._instance=e,this.Yv=!!(!((t=this._instance.persistence)===null||t===void 0)&&t.props[sn]),this.wt=new Kl(v(v({},(function(i={}){var s,n,r,o;return{refillRate:(s=(n=i.exceptionRateLimiterRefillRate)!==null&&n!==void 0?n:i.__exceptionRateLimiterRefillRate)!==null&&s!==void 0?s:1,bucketSize:(r=(o=i.exceptionRateLimiterBucketSize)!==null&&o!==void 0?o:i.__exceptionRateLimiterBucketSize)!==null&&r!==void 0?r:10}})(this._instance.config.error_tracking)),{},{refillInterval:1e4,$:Gt})),this.Rr=this.tf(),this.startIfEnabledOrStop()}tf(){let e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return N(e)?t=v(v({},t),e):(E(e)?this.Yv:e)&&(t=v(v({},t),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.Rr.capture_console_errors||this.Rr.capture_unhandled_errors||this.Rr.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Gt.info("enabled"),this.Xv(),this.zo(this.Vv)):this.Xv()}zo(e){var t,i,s;!((t=F.__PosthogExtensions__)===null||t===void 0)&&t.errorWrappingFunctions?e():(i=F.__PosthogExtensions__)===null||i===void 0||(s=i.loadExternalDependency)===null||s===void 0||s.call(i,this._instance,"exception-autocapture",n=>{if(n)return Gt.error("failed to load script",n);e()})}Xv(){var e,t,i;(e=this.Qv)===null||e===void 0||e.call(this),this.Qv=void 0,(t=this.Jv)===null||t===void 0||t.call(this),this.Jv=void 0,(i=this.Kv)===null||i===void 0||i.call(this),this.Kv=void 0}onRemoteConfig(e){if(!e.ok)return;let t=e.config;"autocaptureExceptions"in t&&(this.Yv=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[sn]:this.Yv}),this.Rr=this.tf(),this.startIfEnabledOrStop())}onConfigChange(){this.Rr=this.tf()}captureException(e){try{var t,i,s;let n=(t=e==null||(i=e.$exception_list)===null||i===void 0||(i=i[0])===null||i===void 0?void 0:i.type)!==null&&t!==void 0?t:"Exception";if(this.wt.consumeRateLimit(n))return void Gt.info("Skipping exception capture because of client rate limiting.",{exception:n});(s=this._instance.exceptions)===null||s===void 0||s.sendExceptionEvent(e)}catch{}}},exceptions:class{constructor(e){var t,i;this.ef=[],this.if=new lu([new xu,new Tu,new ku,new $u,new Iu,new Ou,new Ru,new Fu],(function(s,...n){return(r,o=0)=>{let a=[],l=r.split(`
3`),u=Math.min(l.length,o+1e3),c=[];for(let p=o;u>p;p++){let g=l[p];if(g.length>1024)continue;let m=rr.test(g)?g.replace(rr,"$1"):g;if(!m.match(/\S*Error: /)){for(let _ of n){let f=_(m,s);if(f){a.push(f);let b=yu(a);if(b){for(let w=c.length-1;w>=0;w--){let P=c[w];if(b.start>=P.start+P.length)break;c.pop()}c.push(b)}break}}if(wu(a,c)>=50)break}}let h=[...c].sort((p,g)=>g.start-p.start),d=h[h.length-1];if(d){let p=oa(a,d);a.splice(d.start-p,p);for(let g of h)g.start-=p}for(let p of h)bu(a,p);return c.some(p=>p.start===0&&a.length===p.length)&&(function(p){let g=p.map(_=>`${_.function}|${_.filename}|${_.lineno}|${_.colno}|${_.module}`),m=0;for(let _=1;g.length>_;_++)Eu(g,_,m)&&(m=_);p.push(...p.splice(0,m))})(a),(function(p){if(!p.length)return[];let g=Array.from(p);return g.reverse(),g.slice(0,50).map(m=>{return v(v({},m),{},{filename:m.filename||(_=g,_[_.length-1]||{}).filename,function:m.function||"?"});var _})})(a)}})("web:javascript",fu,mu)),this._instance=e,this.ef=(t=(i=this._instance.persistence)===null||i===void 0?void 0:i.get_property("$error_tracking_suppression_rules"))!==null&&t!==void 0?t:[],this.nf=Ui(this.sf()),this.rf=new Mu(this.nf)}onConfigChange(){this.nf=Ui(this.sf()),this.rf.setConfig(this.nf)}onRemoteConfig(e){var t,i,s;if(!e.ok)return;let n=e.config;if(!("errorTracking"in n))return;let r=(t=(i=n.errorTracking)===null||i===void 0?void 0:i.suppressionRules)!==null&&t!==void 0?t:[],o=(s=n.errorTracking)===null||s===void 0?void 0:s.captureExtensionExceptions;this.ef=r,this._instance.persistence&&this._instance.persistence.register({[Ea]:this.ef,[nn]:o})}get af(){var e;let t=!!this._instance.get_property(nn),i=this._instance.config.error_tracking.captureExtensionExceptions;return(e=i??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.if.buildFromUnknown(e,{syntheticException:t?.syntheticException,mechanism:{handled:t?.handled}})}addExceptionStep(e,t){if(this.nf.enabled)try{if(!L(e)||e.trim().length===0)return void Oe.warn("Ignoring exception step because message must be a non-empty string");let{sanitizedProperties:i,droppedKeys:s}=(function(n){if(!n)return{sanitizedProperties:{},droppedKeys:[]};let r=[];return{sanitizedProperties:Object.keys(n).reduce((o,a)=>Cu.has(a)?(r.push(a),o):(o[a]=n[a],o),{}),droppedKeys:r}})(this.lf(t));s.length>0&&Oe.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this.rf.add(v({[Bi]:e,[qi]:new Date().toISOString()},i))}catch(i){Oe.error("Failed to add exception step. Ignoring breadcrumb.",i)}}sendExceptionEvent(e){try{let t=e.$exception_list;if(this.uf(t)){if(this.hf(t))return this.cf("Exception dropped: matched a suppression rule"),void Oe.info("Skipping exception capture because a suppression rule matched");if(!this.af&&this.df(t))return this.cf("Exception dropped: thrown by a browser extension"),void Oe.info("Skipping exception capture because it was thrown by an extension");if(!this.af&&this.vf(t))return this.cf("Exception dropped: thrown by an injected browser script"),void Oe.info("Skipping exception capture because it was thrown by an injected browser script");
3if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ff(t))return this.cf("Exception dropped: thrown by the PostHog SDK"),void Oe.info("Skipping exception capture because it was thrown by the PostHog SDK")}let i=this.nf.enabled&&A(e.$exception_steps)?this.pf(e):e,s=(function(){let n=globalThis._posthogReleaseId;return typeof n=="string"&&n.length>0?n:void 0})();s&&(i.$release_id=s);try{let n=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",fh:!0});return n&&this.rf.clear(),n}catch(n){return go(n)||Oe.error("Failed to capture exception event. Dropping this exception.",n),void this.rf.clear()}}catch(t){return void(go(t)||Oe.error("Failed to process exception event. Ignoring this exception.",t))}}pf(e){try{let t=this.rf.getAttachable();return t.length===0?e:v(v({},e),{},{$exception_steps:t})}catch(t){return Oe.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}cf(e){this.nf.enabled&&this.rf.add({[Bi]:e,[qi]:new Date().toISOString()})}lf(e){return N(e)?v({},e):{}}sf(){var e,t;return(e=(t=this._instance.config.error_tracking)===null||t===void 0?void 0:t.exception_steps)!==null&&e!==void 0?e:{}}hf(e){if(e.length===0)return!1;try{let t=e.reduce((i,{type:s,value:n})=>(L(s)&&s.length>0&&i.$exception_types.push(s),L(n)&&n.length>0&&i.$exception_values.push(n),i),{$exception_types:[],$exception_values:[]});return this.ef.some(i=>{let s=i.values.map(n=>{let r=Pl[n.operator],o=t[n.key];if(!r||!o)return!1;let a=C(n.value)?n.value:[n.value];return a.length>0&&r(a,o)});return i.type==="OR"?s.some(Boolean):s.every(Boolean)})}catch(t){return Oe.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}df(e){let t=e.flatMap(s=>{var n,r;return(n=(r=s.stacktrace)===null||r===void 0?void 0:r.frames)!==null&&n!==void 0?n:[]}),i=t.filter(({filename:s})=>!!s&&Gd.some(n=>s.startsWith(n)));return i.length!==0&&(!i.every(({filename:s})=>!!s&&s.startsWith(wn))||e.some(({type:s,value:n})=>s==="NoResponse"||L(n)&&Wd.some(({value:r,exact:o})=>o?n===r:n.includes(r)))&&!t.some(({in_app:s,filename:n})=>s&&!n?.startsWith(wn)))}vf(e){return e.some(({value:t})=>L(t)&&Yd.some(i=>t.includes(i)))}ff(e){if(e.length>0){var t,i,s,n;let r=(t=(i=e[0].stacktrace)===null||i===void 0?void 0:i.frames)!==null&&t!==void 0?t:[],o=r[r.length-1];return(s=o==null||(n=o.filename)===null||n===void 0?void 0:n.includes("posthog.com/static"))!==null&&s!==void 0&&s}return!1}uf(e){return!A(e)&&C(e)}}},rh=v({productTours:class{get Ml(){return this._instance.persistence}constructor(e){this.gf=null,this.mf=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.Ml&&this.Ml.register({[Fn]:!!t.productTours}),!Us(this._instance))return!this.gf&&A((i=this.Ml)===null||i===void 0?void 0:i.props.ph_product_tours)||Ri.info("product tours disabled; stopping and clearing cached tours"),(s=this.gf)===null||s===void 0||s.stop(),this.gf=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.gf&&Us(this._instance)&&this.zo(()=>this.yf())}zo(e){var t,i,s;!((t=F.__PosthogExtensions__)===null||t===void 0)&&t.generateProductTours?e():(i=F.__PosthogExtensions__)===null||i===void 0||(s=i.loadExternalDependency)===null||s===void 0||s.call(i,this._instance,"product-tours",n=>{n?Ri.error("Could not load product tours script",n):e()})}yf(){var e;!this.gf&&(!((e=F.__PosthogExtensions__)===null||e===void 0)&&e.generateProductTours)&&(this.gf=F.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t=!1){if(C(this.mf)&&!t)return void e(this.mf,{isLoaded:!0});let i=this.Ml;if(i){let s=i.props[ln];if(C(s)&&!t)return this.mf=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:s=>{if(!Us(this._instance))return void e([],{isLoaded:!0});let n=s.statusCode;if(n!==200||!s.json){let o=`Product Tours API could not be loaded, status: ${n}`;return n===0?s.error||Ri.warn(o):Ri.error(o),void e([],{isLoaded:!1,error:o})}let r=C(s.json.product_tours)?s.json.product_tours:[];this.mf=r,i&&i.register({[ln]:r}),e(r,{isLoaded:!0})}})}getActiveProductTours(e){A(this.gf)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.gf.getActiveProductTours(e)}showProductTour(e){var t;(t=this.gf)===null||t===void 0||t.showTourById(e)}previewTour(e){this.gf?this.gf.previewTour(e):this.zo(()=>{var t;this.yf(),(t=this.gf)===null||t===void 0||t.previewTour(e)})}dismissProductTour(){var e;(e=this.gf)===null||e===void 0||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.gf)===null||e===void 0||e.nextStep()}previousStep(){var e;(e=this.gf)===null||e===void 0||e.previousStep()}clearCache(){var e;this.mf=null,(e=this.Ml)===null||e===void 0||e.unregister("ph_product_tours")}resetTour(e){var t;(t=this.gf)===null||t===void 0||t.resetTour(e)}resetAllTours(){var e;(e=this.gf)===null||e===void 0||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.gf)===null||t===void 0||t.cancelPendingTour(e)}}},os),oh={siteApps:class{constructor(e){this._instance=e,this.bf=0,this._f=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}wf(e,t){if(!t)return;let i=this.globalsForEvent(t);
3this._f.push(i),this._f.length>1e3&&(this._f=this._f.slice(10))}get siteAppLoaders(){var e;return(e=F._POSTHOG_REMOTE_CONFIG)===null||e===void 0||(e=e[this._instance.config.token])===null||e===void 0?void 0:e.siteApps}initialize(){if(this.isEnabled){let e=this._instance._addCaptureHook(this.wf.bind(this));this.kf=()=>{e(),this._f=[],this.kf=void 0}}}globalsForEvent(e){var t,i,s,n,r,o,a;if(!e)throw new Error("Event payload is required");let l={},u=this._instance.get_property("$groups")||[],c=this._instance.get_property("$stored_group_properties")||{};for(let[p,g]of Object.entries(c))l[p]={id:u[p],type:p,properties:g};let{$set_once:h,$set:d}=e;return{event:v(v({},ca(e,Ld)),{},{properties:v(v(v({},e.properties),d?{$set:v(v({},(t=(i=e.properties)===null||i===void 0?void 0:i.$set)!==null&&t!==void 0?t:{}),d)}:{}),h?{$set_once:v(v({},(s=(n=e.properties)===null||n===void 0?void 0:n.$set_once)!==null&&s!==void 0?s:{}),h)}:{}),elements_chain:(r=(o=e.properties)===null||o===void 0?void 0:o.$elements_chain)!==null&&r!==void 0?r:"",distinct_id:(a=e.properties)===null||a===void 0?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}Sf(e){var t;let i=(t=e.tagName)===null||t===void 0?void 0:t.toLowerCase();return i==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||(Me.error("prepare_external_dependency_stylesheet returned null"),null):i==="script"&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(e)||(Me.error("prepare_external_dependency_script returned null"),null):e}xf(){var e,t,i,s,n,r,o,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};let l=x?.defaultView,u=l==null||(e=l.Node)===null||e===void 0?void 0:e.prototype;if(!l||!u)return()=>{};if(this.bf++,this.Cf)return this.$f();let c=[],h=this,d=new WeakSet,p=(_,f,b)=>{if(!_?.[f])return;let w=_[f];_[f]=b(w),c.push(()=>{_[f]=w})},g=_=>{if(d.has(_))return _;let f=h.Sf(_);return f&&d.add(f),f},m=_=>_.map(f=>typeof f=="string"?f:g(f)).filter(f=>!se(f));return p(u,"appendChild",_=>function(f){let b=g(f);return b?_.call(this,b):f}),p(u,"insertBefore",_=>function(f,b){let w=g(f);return w?_.call(this,w,b):f}),p(u,"replaceChild",_=>function(f,b){let w=g(f);return w?_.call(this,w,b):b}),[(t=l.Element)===null||t===void 0?void 0:t.prototype,(i=l.Document)===null||i===void 0?void 0:i.prototype,(s=l.DocumentFragment)===null||s===void 0?void 0:s.prototype].forEach(_=>{p(_,"append",f=>function(...b){return f.apply(this,m(b))}),p(_,"prepend",f=>function(...b){return f.apply(this,m(b))})}),[(n=l.Element)===null||n===void 0?void 0:n.prototype,(r=l.CharacterData)===null||r===void 0?void 0:r.prototype,(o=l.DocumentType)===null||o===void 0?void 0:o.prototype].forEach(_=>{p(_,"before",f=>function(...b){return f.apply(this,m(b))}),p(_,"after",f=>function(...b){return f.apply(this,m(b))}),p(_,"replaceWith",f=>function(...b){let w=m(b);return b.length&&!w.length?void 0:f.apply(this,w)})}),p((a=l.Element)===null||a===void 0?void 0:a.prototype,"insertAdjacentElement",_=>function(f,b){let w=g(b);return w?_.call(this,f,w):null}),this.Cf=()=>{c.forEach(_=>_()),this.Cf=void 0},this.$f()}$f(){let e=!1;return()=>{var t;e||(e=!0,this.bf--,this.bf===0&&((t=this.Cf)===null||t===void 0||t.call(this)))}}Tf(e,t=!0){let i=this.xf();try{let s=e(i);return t&&i(),s}catch(s){throw i(),s}}setupSiteApp(e){let t=this.apps[e.id],i=()=>{var r;!t.errored&&this._f.length&&(Me.info(`Processing ${this._f.length} events for site app with id ${e.id}`),this._f.forEach(o=>this.Tf(()=>{var a;return(a=t.processEvent)===null||a===void 0?void 0:a.call(t,o)})),t.processedBuffer=!0),Object.values(this.apps).every(o=>o.processedBuffer||o.errored)&&((r=this.kf)===null||r===void 0||r.call(this))},s=!1,n=r=>{t.errored=!r,t.loaded=!0,Me.info(`Site app with id ${e.id} ${r?"loaded":"errored"}`),s&&i()};try{let{processEvent:r}=this.Tf(o=>e.init({posthog:this._instance,callback(a){o(),n(a)}}),!1);r&&(t.processEvent=r),s=!0}catch(r){Me.error(ro+e.id,r),n(!1)}if(s&&t.loaded)try{i()}catch(r){Me.error(`Error while processing buffered events PostHog app with config id ${e.id}`,r),t.errored=!0}}If(){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)}Mf(e){if(Object.keys(this.apps).length===0)return;let t=this.globalsForEvent(e);for(let i of Object.values(this.apps))try{this.Tf(()=>{var s;return(s=i.processEvent)===null||s===void 0?void 0:s.call(i,t)})}catch(s){Me.error(`Error while processing event ${e.event} for site app ${i.id}`,s)}}onRemoteConfig(e){var t,i,s;if(!((t=this.siteAppLoaders)===null||t===void 0)&&t.length)return this.isEnabled?(this.If(),void this._instance.on("eventCaptured",a=>this.Mf(a))):void Me.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((i=this.kf)===null||i===void 0||i.call(this),!e.ok)return;let n=e.config;if(!((s=n.siteApps)===null||s===void 0)&&s.length)if(this.isEnabled)for(let{id:a,url:l}of n.siteApps){var r,o;F[`__$$ph_site_app_${a}`]=this._instance,(r=F.__PosthogExtensions__)===null||r===void 0||(o=r.loadSiteApp)===null||o===void 0||o.call(r,this._instance,l,u=>{if(u)return Me.error(ro+a,u)})}else Me.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},ah={tracingHeaders:class{constructor(e){this._instance=e,this.Ef=void 0,this.Pf=void 0,this.Rf=void 0,this.Vv=()=>{let t=this.Af();var i,s;t?(E(this.Ef)&&(this.Ef=(i=F.__PosthogExtensions__)===null||i===void 0||(i=i.tracingHeadersPatchFns)===null||i===void 0?void 0:i._patchXHR(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),E(this.Pf)&&(this.Pf=(s=F.__PosthogExtensions__)===null||s===void 0||(s=s.tracingHeadersPatchFns)===null||s===void 0?void 0:s._patchFetch(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.Xv()}}initialize(){this.startIfEnabledOrStop()}zo(e){var t,i,s;!((t=F.__PosthogExtensions__)===null||t===void 0)&&t.tracingHeadersPatchFns?e():(i=F.__PosthogExtensions__)===null||i===void 0||(s=i.loadExternalDependency)===null||s===void 0||s.call(i,this._instance,"tracing-headers",n=>{if(n)return Td.error("failed to load script",n);e()})}Ff(){var e,t;return(e=(t=this._instance.config.tracing_headers)!==null&&t!==void 0?t:this._instance.config.addTracingHeaders)!==null&&e!==void 0?e:this._instance.config.__add_tracing_headers}Af(){let e=this.Ff();return C(e)?(C(this.Rf)?this.Rf.splice(0,this.Rf.length,...e):this.Rf=[...e],e.length>0?this.Rf:void 0):(C(this.Rf)&&this.Rf.splice(0),this.Rf=e||void 0,this.Rf)}Xv(){var e,t;(e=this.Ef)===null||e===void 0||e.call(this),(t=this.Pf)===null||t===void 0||t.call(this),this.Ef=void 0,this.Pf=void 0}startIfEnabledOrStop(){this.Af()?this.zo(this.Vv):this.Xv()}}},lh=v({surveys:class extends Dd{constructor(e){var t;super(new Ud(e),(t=e,{get projectToken(){return t.config.token},kv:new qd(t)})),this._instance=e}qh(e,t){let i=t.query?mi(e,t.query):e;return new Promise(s=>{var n;this._instance._send_request({method:t.method,url:this._instance.requestRouter.endpointFor((n=t.target)!==null&&n!==void 0?n:"api",i),data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,timestampMode:t.sentAt,callback:s})})}}},os),uh={toolbar:class{constructor(e){this.instance=e}Of(e){F.ph_toolbar_state=e}Df(){var e;return(e=F.ph_toolbar_state)!==null&&e!==void 0?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e=void 0,t=void 0,i=void 0){var s,n;
3if(cn(this.instance.config)||!y||!x)return!1;e=(s=e)!==null&&s!==void 0?s:y.location,i=(n=i)!==null&&n!==void 0?n:y.history;try{if(!t){try{y.localStorage.setItem("test","test"),y.localStorage.removeItem("test")}catch{return!1}t=y?.localStorage}let r=Vd||Xi(e.hash,"__posthog")||Xi(e.hash,"state"),o,a=r?tr(()=>JSON.parse(atob(decodeURIComponent(r))))||tr(()=>JSON.parse(decodeURIComponent(r))):null;return a&&a.action==="ph_authorize"?(o=a,o.source="url",o&&Object.keys(o).length>0&&(a.desiredHash?e.hash=a.desiredHash:i?i.replaceState(i.state,"",e.pathname+e.search):e.hash="")):(o=JSON.parse(t.getItem(ao)||"{}"),o.source="localstorage",delete o.userIntent),!(!o.token||this.instance.config.token!==o.token||(this.loadToolbar(o),0))}catch{return!1}}Lf(e){let t=F.ph_load_toolbar||F.ph_load_editor;!A(t)&&ce(t)?t(e,this.instance):lo.warn("No toolbar load function found")}loadToolbar(e){let t=!!x?.getElementById("__POSTHOG_TOOLBAR__");if(!y||t)return!1;let i=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,s=v(v({token:this.instance.config.token},e),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},i?{instrument:!1}:{});if(y.localStorage.setItem(ao,JSON.stringify(v(v({},s),{},{source:void 0}))),this.Df()===2)this.Lf(s);else if(this.Df()===0){var n,r;this.Of(1),(n=F.__PosthogExtensions__)===null||n===void 0||(r=n.loadExternalDependency)===null||r===void 0||r.call(n,this.instance,"toolbar",o=>{if(o)return lo.error("[Toolbar] Failed to load",o),void this.Of(0);this.Of(2),this.Lf(s)}),z(y,"turbolinks:load",()=>{this.Of(0),this.loadToolbar(s)})}return!0}Nf(e){return this.loadToolbar(e)}maybeLoadEditor(e=void 0,t=void 0,i=void 0){return this.maybeLoadToolbar(e,t,i)}}},ch=v({experiments:class _e{get Rr(){return this._instance.config}constructor(t){this._instance=t,this.getWebExperimentsAndEvaluateDisplayLogic=(i=!1)=>{this.getWebExperiments(s=>{_e.qf("retrieved web experiments from the server"),this.jf=new Map,s.forEac
3h(n=>{if(n.feature_flag_key){var r;this.jf&&(_e.qf("setting flag key ",n.feature_flag_key," to web experiment ",n),(r=this.jf)===null||r===void 0||r.set(n.feature_flag_key,n));let o=this._instance.getFeatureFlag(n.feature_flag_key);L(o)&&n.variants[o]&&this.Bf(n.name,o,n.variants[o].transforms)}else if(n.variants)for(let o in n.variants){let a=n.variants[o];_e.Hf(a,this._instance)&&this.Bf(n.name,o,a.transforms)}})},i)},this._instance.onFeatureFlags(i=>{this.onFeatureFlags(i)})}initialize(){}onFeatureFlags(t){if(this._is_bot())_e.qf(_o);else if(!this.Rr.disable_web_experiments){if(A(this.jf))return this.jf=new Map,this.loadIfEnabled(),void this.previewWebExperiment();_e.qf("applying feature flags",t),t.forEach(i=>{var s;if(this.jf&&(!((s=this.jf)===null||s===void 0)&&s.has(i))){var n;let r=this._instance.getFeatureFlag(i),o=(n=this.jf)===null||n===void 0?void 0:n.get(i);r&&o?.variants[r]&&this.Bf(o.name,r,o.variants[r].transforms)}})}}previewWebExperiment(){let t=_e.getWindowLocation();if(t?.search){let i=Mt(t?.search,"__experiment_id"),s=Mt(t?.search,"__experiment_variant");i&&s&&(_e.qf(`previewing web experiments ${i} && ${s}`),this.getWebExperiments(n=>{this.zf(parseInt(i),s,n)},!1,!0))}}loadIfEnabled(){this.Rr.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,i,s){if(this.Rr.disable_web_experiments&&!s)return t([]);let n=this._instance.get_property("$web_experiments");if(n&&!i)return t(n);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/web_experiments/?token=${this.Rr.token}`),method:"GET",timestampMode:"query",callback:r=>t(r.statusCode===200&&r.json&&r.json.experiments||[])})}zf(t,i,s){let n=s.filter(r=>r.id===t);n&&n.length>0&&(_e.qf(`Previewing web experiment [${n[0].name}] with variant [${i}]`),this.Bf(n[0].name,i,n[0].variants[i].transforms))}static Hf(t,i){return!A(t.conditions)&&_e.Uf(t,i)&&_e.Wf(t)}static Uf(t,i){var s;if(A(t.conditions)||A((s=t.conditions)===null||s===void 0?void 0:s.url))return!0;let n=_e.getWindowLocation();if(n){var r,o,a;let l=Ua(i,n.href);return!(!((r=t.conditions)===null||r===void 0)&&r.url)||Xd[(o=(a=t.conditions)===null||a===void 0?void 0:a.urlMatchType)!==null&&o!==void 0?o:"icontains"](t.conditions.url,l)}return!1}
3static getWindowLocation(){return y?.location}static Wf(t){var i;if(A(t.conditions)||A((i=t.conditions)===null||i===void 0?void 0:i.utm))return!0;let s=el();if(s.utm_source){var n,r,o,a,l,u,c,h;let d=!(!((n=t.conditions)===null||n===void 0||(n=n.utm)===null||n===void 0)&&n.utm_campaign)||((r=t.conditions)===null||r===void 0||(r=r.utm)===null||r===void 0?void 0:r.utm_campaign)==s.utm_campaign,p=!(!((o=t.conditions)===null||o===void 0||(o=o.utm)===null||o===void 0)&&o.utm_source)||((a=t.conditions)===null||a===void 0||(a=a.utm)===null||a===void 0?void 0:a.utm_source)==s.utm_source,g=!(!((l=t.conditions)===null||l===void 0||(l=l.utm)===null||l===void 0)&&l.utm_medium)||((u=t.conditions)===null||u===void 0||(u=u.utm)===null||u===void 0?void 0:u.utm_medium)==s.utm_medium,m=!(!((c=t.conditions)===null||c===void 0||(c=c.utm)===null||c===void 0)&&c.utm_term)||((h=t.conditions)===null||h===void 0||(h=h.utm)===null||h===void 0?void 0:h.utm_term)==s.utm_term;return d&&g&&m&&p}return!1}static qf(t,...i){k.info(`[WebExperiments] ${t}`,i)}Bf(t,i,s){this._is_bot()?_e.qf(_o):i!=="control"?s.forEach(n=>{if(n.selector){var r;_e.qf(`applying transform of variant ${i} for experiment ${t} `,n);let o=(r=document)===null||r===void 0?void 0:r.querySelectorAll(n.selector);o?.forEach(a=>{let l=a;n.html&&(l.innerHTML=n.html),n.css&&l.setAttribute("style",n.css)})}}):_e.qf("Control variants leave the page unmodified.")}_is_bot(){return de&&this._instance?kl(de,this.Rr.custom_blocked_useragents):void 0}}},os),dh={conversations:class{constructor(e){this._instance=e,this.Vf=void 0,this._conversationsManager=null,this.Gf=!1,this.ne=null,this.Zf=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(this._instance.config.disable_conversations||(this.Qf=e.ok,!e.ok))return;let t=e.config.conversations;A(t)||(be(t)?this.Vf=t:(this.Vf=t.enabled,this.ne=t),this.loadIfEnabled())}reset(){var e;(e=this._conversationsManager)===null||e===void 0||e.reset(),this._conversationsManager=null,this.Vf=void 0,this.ne=null,this.Qf=void 0,this.Zf=!1}loadIfEnabled(){if(this._conversationsManager||this.Gf||this._instance.config.disable_conversations||cn(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;let e=F?.__PosthogExtensions__;if(e&&!E(this.Vf)&&this.Vf)if(this.ne&&this.ne.token){this.Gf=!0;try{let t=e.initConversations;if(t)return this.Jf(t),void(this.Gf=!1);let i=e.loadExternalDependency;if(!i)return void this.Kf(Cn);i(this._instance,"conversations",s=>{s||!e.initConversations?this.Kf("Could not load conversations script",s):this.Jf(e.initConversations),this.Gf=!1})}catch(t){this.Kf("Error initializing conversations",t),this.Gf=!1}}else Pe.error("Conversations enabled but missing token in remote config.")}Jf(e){if(this.ne)try{this._conversationsManager=e(this.ne,this._instance),this.Zf=!1,Pe.info("Conversations loaded successfully")}catch(t){this.Kf("Error completing conversations initialization",t)}else Pe.error("Cannot complete initialization: remote config is null")}Kf(e,t){Pe.error(e,t),this._conversationsManager=null,this.Gf=!1,this.Zf=!0}show(){this._conversationsManager?this._conversationsManager.show():Pe.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Vf===!0&&!se(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":cn(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":this.Qf===!1?"remote_config_failed":E(this.Vf)?this.Qf?"disabled_in_project":"remote_config_pending":this.Vf?A(this.ne)||!this.ne.token?"missing_token":F?.__PosthogExtensions__?this.Gf?"initializing":this.Zf?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var e,t;return(e=(t=this._conversationsManager)===null||t===void 0?void 0:t.isVisible())!==null&&e!==void 0&&e}sendMessage(e,t,i){var s=this;return Z(function*(){return s._conversationsManager?s._conversationsManager.sendMessage(e,t,i):(Pe.warn(ht),null)})()}getMessages(e,t){var i=this;return Z(function*(){return i._conversationsManager?i._conversationsManager.getMessages(e,t):(Pe.warn(ht),null)})()}markAsRead(e){var t=this;return Z(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(Pe.warn(ht),null)})()}getTickets(e){var t=this;return Z(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(Pe.warn(ht),null)})()}requestRestoreLink(e){var t=this;return Z(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(Pe.warn(ht),null)})()}restoreFromToken(e){var t=this;return Z(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(Pe.warn(ht),null)})()}restoreFromUrlToken(){var e=this;return Z(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(Pe.warn(ht),null)})()}getCurrentTicketId(){var e,t;return(e=(t=this._conversationsManager)===null||t===void 0?void 0:t.getCurrentTicketId())!==null&&e!==void 0?e:null}getWidgetSessionId(){var e,t;return(e=(t=this._conversationsManager)===null||t===void 0?void 0:t.getWidgetSessionId())!==null&&e!==void 0?e:null}Sh(){var e;(e=this._conversationsManager)===null||e===void 0||e.setIdentity()}xh(){var e;(e=this._conversationsManager)===null||e===void 0||e.clearIdentity()}}},hh={logs:class{constructor(e){var t;this._instance=e,this.name="logs",this.Xf=!1,this.Yf=!1,this.tp=!1,this.$=ne("[logs]"),this.ep=v(v({},this.$),{},{error:(...i)=>{i.some(bo)||this.$.error(...i)}}),this.al=[],this.np=[],this.hd=0,this.Io=!1,this.sp=[],this.rp=[],this.op=!1,this.ap=!1,this.lp=()=>{var i,s;this.Io||(this.hd=0,(i=this.up)===null||i===void 0||i.onReconnect(),(s=this.hp)===null||s===void 0||s.onReconnect())},this._instance&&(!((t=this._instance.config.logs)===null||t===void 0)&&t.captureConsoleLogs)&&(this.Xf=!0),y&&z(y,"online",this.lp)}cp(e,t,i,s){var n;let r=mo((n=this._instance)===null||n===void 0||(n=n.config)===null||n===void 0?void 0:n.logs,i);return[new Hu(this.dp(e,t),r,this.ep,()=>this.vp(),o=>o(),void 0,s),r]}fp(){var e;let t=(e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.logs;var i;return this.up&&this.pp===t||((i=this.up)===null||i===void 0||i.reset(),this.pp=t,[this.up,this.gp]=this.cp(()=>this.al,s=>{this.al=s})),this.up}mp(){var e;let t=(e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.logs;var i;return this.hp&&this.yp===t||((i=this.hp)===null||i===void 0||i.reset(),this.yp=t,[this.hp,this.bp]=this.cp(()=>this.np,s=>{this.np=s},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},yo)),this.hp}setup(e){var t;if(this.Io)return;this.wo=e,!((t=this._instance)===null||t===void 0||(t=t.config)===null||t===void 0||(t=t.logs)===null||t===void 0)&&t.captureConsoleLogs&&(this.Xf=!0),(this.Xf||this._p()&&this.wp())&&this.kp();let i=!1,s=e.onRemoteConfig(n=>{var r;i=n.ok&&((r=n.config.logs)===null||r===void 0?void 0:r.captureConsoleLogs)===!0,this.onRemoteConfig(n)});this.Io?s.dispose():(this.Po=s,i||this.loadIfEnabled())}dispose(){var e,t,i,s;this.Io||(this.Io=!0,this.Sp(),(e=this.Po)===null||e===void 0||e.dispose(),this.Po=void 0,this.wo=void 0,this.tp=!1,y?.removeEventListener("online",this.lp),(t=this.xp)===null||t===void 0||t.call(this),this.xp=void 0,(i=this.up)===null||i===void 0||i.reset(),(s=this.hp)===null||s===void 0||s.reset())}onRemoteConfig(e){var t,i;if(this.Io)return;let s=e.ok?(t=e.config.logs)===null||t===void 0?void 0:t.captureConsoleLogs:void 0;A(s)?this.Cp():((i=this._instance)===null||i===void 0||(i=i.persistence)===null||i===void 0||i.register({$logs_capture_enabled_server_side:!!s}
3),s?(this.Xf=!0,this.Yf||this.kp(),this.loadIfEnabled()):this.Cp())}reset(){var e,t,i,s;this.Sp(),(e=this.up)===null||e===void 0||e.clearQueue(),this.al=[],(t=this.up)===null||t===void 0||t.reset(),(i=this.hp)===null||i===void 0||i.clearQueue(),this.np=[],(s=this.hp)===null||s===void 0||s.reset(),this.hd=0}captureLog(e){this.Io||this.fp().captureLog(e)}captureConsoleLog(e){this.Io||this.mp().captureLog(e)}captureBufferedConsoleLog(e,t,i){this.Io||this.mp().captureLog(e,{context:t,occurredAtMs:i})}wp(){var e;return!!(!((e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||(e=e.props)===null||e===void 0)&&e[xa])}_p(){var e,t,i;return!(!((e=this._instance)===null||e===void 0||(t=e.nl)===null||t===void 0)&&t.call(e))||!!(!((i=F._POSTHOG_REMOTE_CONFIG)===null||i===void 0||(i=i[this._instance.config.token])===null||i===void 0)&&i.config)}$h(){var e;this.Sp(),(e=this.hp)===null||e===void 0||e.clearQueue(),this.np=[]}Cp(){this.Xf||this.Sp()}kp(){var e;if(this.op||!F?.console)return;let t=mo((e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.logs).maxBufferSize,i=!0;this.rp.push(()=>{i=!1});for(let s of Kd){let n;try{n=Jd(F.console[s])}catch{continue}n&&this.rp.push(gi(F.console,s,r=>{let o=(...a)=>{try{i&&this.$p(s,a,t)}catch{}return r.apply(F.console,a)};return o.__rrweb_original__=n,o}))}this.op=!0,this.Tp=setTimeout(()=>{this.Sp()},3e4)}$p(e,t,i){var s;if(this.op&&!this.ap&&t.length!==0)if(!((s=this._instance)===null||s===void 0)&&s.is_capturing()){if(i>this.sp.length){this.ap=!0;try{this.sp.push({level:e,args:t,occurredAtMs:Date.now(),context:this.vp()})}finally{this.ap=!1}}}else this.Sp()}Sp(){if(this.sp=[],this.op){this.op=!1,this.Tp&&(clearTimeout(this.Tp),this.Tp=void 0);for(let e of this.rp)e();this.rp=[]}}Ip(){let e=this.sp;return this.Sp(),e}get logger(){return this.Mp||(this.Mp={trace:(e,t)=>this.captureLog({body:e,level:"trace",attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:"debug",attributes:t}),info:(e,t)=>this.captureLog({body:e,level:"info",attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:"warn",attributes:t}),error:(e,t)=>this.captureLog({body:e,level:"error",attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:"fatal",attributes:t})}),this.Mp}flushLogs(e){e?this.Ep(e):(this.up&&this.up.flush().catch(t=>this.Pp(t)),this.hp&&this.hp.flush().catch(t=>this.Pp(t)))}Pp(e){bo(e)||this.$.error("PostHog logs flush failed:",e)}loadIfEnabled(){if(this.Io||!this.Xf||this.Yf||this.tp)return;let e=F?.__PosthogExtensions__;if(!e)return this.$.error("PostHog Extensions not found."),void this.Sp();let t=e.loadExternalDependency;if(!t)return this.$.error(Cn),void this.Sp();this.tp=!0;try{t(this._instance,"logs",i=>{if(this.tp=!1,this.Io||!this.Xf)return;let s=e.logs;if(i||!s?.initializeLogs)this.$.error("Could not load logs script",i),this.Sp();else{var n;let a=this.Ip();var r,o;this.xp=s.initializeLogs((n=this.wo)!==null&&n!==void 0?n:this._instance),this.Yf=!0,a.length>0&&((r=s.replayConsoleBuffer)===null||r===void 0||r.call(s,(o=this.wo)!==null&&o!==void 0?o:this._instance,a))}})}catch(i){throw this.tp=!1,i}}dp(e,t){let i=this._instance;return{get isDisabled(){return!1},get optedOut(){return!i.is_capturing()},getPersistedProperty:s=>s===Le.LogsQueue?e():void 0,setPersistedProperty(s,n){var r;s===Le.LogsQueue&&t((r=n)!==null&&r!==void 0?r:[])},js:s=>this.js(s),getLibraryId:()=>ae.LIB_NAME,getLibraryVersion:()=>ae.LIB_VERSION}}js(e){return new Promise(t=>{if(Za(this.hd,3))return void t({kind:"fatal",error:Hs(void 0,"logs endpoint is unreachable, dropping batch")});let i=!1,s=r=>{i||(i=!0,clearTimeout(n),t(r))},n=setTimeout(()=>{this.$.warn("Logs request timed out before receiving a response"),s({kind:"retry-later",error:Hs(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this.Rp(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:r=>{let o=r.statusCode;if(this.Ap(o),o>=200&&300>o)s({kind:"ok"});else if(o===413)s({kind:"too-large"});else if(o!==0&&o!==408&&o!==429&&500>o)s({kind:"fatal",error:new Error(`logs request failed with status ${o}`)});else{var a;o===0?(r.error||this.$.warn("Logs request failed before receiving an HTTP response"),s({kind:"retry-later",error:Hs(r.error,"logs request failed before receiving an HTTP response")})):s({kind:"retry-later",error:(a=r.error)!==null&&a!==void 0?a:new Error(`logs request failed with status ${o}`)})}}})})}Ap(e){(e!==0||this._instance.__loaded)&&(this.hd=Qa(e,this.hd,3,()=>this.$.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes.")))}Ep(e){this.al.length>0&&this.Fp(e,this.al,this.gp,ae.LIB_NAME,t=>{this.al=t}),this.np.length>0&&this.Fp(e,this.np,this.bp,yo,t=>{this.np=t})}Fp(e,t,i,s,n){if(t.length===0)return;let r=t.map(a=>a.record);n([]);let o=ga(r,fa(i,ae.LIB_NAME,ae.LIB_VERSION),s,ae.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Rp(),data:o,compression:"best-available",batchKey:"logs",transport:e})}Rp(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}vp(){var e;let t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){let{sessionId:i,windowId:s,sessionStartTimestamp:n,lastActivityTimestamp:r}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);t.sessionId=i,t.windowId=s,A(n)||(t.sessionStartTimestamp=n),A(r)||(t.lastActivityTimestamp=r)}if(!(F==null||(e=F.location)===null||e===void 0)&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?ot(F.location.href):F.location.href),this._instance.featureFlags){let i=this._instance.featureFlags.getFlags();i&&i.length>0&&(t.activeFeatureFlags=i)}return t}}}
3,ph={metrics:class{constructor(e){this._instance=e,this.$=ne("[metrics]"),this.Io=!1}initialize(){this.onConfigChange()}onConfigChange(){var e;if(this.Io)return;let t=!!(!((e=this._instance.config.metrics)===null||e===void 0)&&e.network);t&&!this.Op?this.Op=(i=>{let s=!0,n=()=>s?(a=>{var l;let u=(l=a.config.metrics)===null||l===void 0?void 0:l.network;return u===!0?{}:u||void 0})(i):void 0,r=eh(i,n),o=th(i,n);return()=>{s=!1,r(),o()}})(this._instance):!t&&this.Op&&(this.Op(),this.Op=void 0)}fp(){var e;let t=(e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.metrics;var i;return this.up&&this.pp===t||((i=this.up)===null||i===void 0||i.reset(),this.pp=t,this.up=new zu(this.dp(),(function(s){var n,r,o,a,l;let u=s?.resourceAttributes;return{serviceName:(n=u?.["service.name"])!==null&&n!==void 0?n:s?.serviceName,serviceVersion:(r=u?.["service.version"])!==null&&r!==void 0?r:s?.serviceVersion,environment:(o=u?.["deployment.environment"])!==null&&o!==void 0?o:s?.environment,resourceAttributes:u,beforeSend:s?.beforeSend,flushIntervalMs:(a=s?.flushIntervalMs)!==null&&a!==void 0?a:1e4,maxSeriesPerFlush:(l=s?.maxSeriesPerFlush)!==null&&l!==void 0?l:1e3}})(t),this.$)),this.up}count(e,t=1,i){this.fp().count(e,t,i)}gauge(e,t,i){this.fp().gauge(e,t,i)}histogram(e,t,i){this.fp().histogram(e,t,i)}flush(e){if(!this.up)return Promise.resolve();if(e){let t=this.up.drainWindow();return t&&this.Ys(t,e),Promise.resolve()}return this.up.flush().catch(t=>this.$.error("PostHog metrics flush failed:",t))}reset(){var e;(e=this.up)===null||e===void 0||e.reset()}dispose(){var e,t;this.Io=!0,(e=this.Op)===null||e===void 0||e.call(this),this.Op=void 0,(t=this.up)===null||t===void 0||t.reset()}dp(){let e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},Ys:i=>t.Ys(i),getLibraryId:()=>ae.LIB_NAME,getLibraryVersion:()=>ae.LIB_VERSION}}Ys(e,t){return new Promise(i=>{let s=!1,n=o=>{s||(s=!0,clearTimeout(r),i(o))},r=setTimeout(()=>n({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(v(v({method:"POST",url:this.Dp(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t}),{},{fireCallbackOnDrop:!0,callback(o){let a=o.statusCode;if(a>=200&&300>a)n({kind:"ok"});else if(a===413)n({kind:"too-large"});else if(a!==0&&a!==408&&a!==429&&500>a)n({kind:"fatal",error:new Error(`metrics request failed with status ${a}`)});else{var l;n({kind:"retry-later",error:(l=o.error)!==null&&l!==void 0?l:new Error(`metrics request failed with status ${a}`)})}}}))})}Dp(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}};ai.__defaultExtensionClasses=v({},v(v(v(v(v(v(v(v(v(v(v(v(v({},os),ih),sh),nh),rh),oh),lh),ah),uh),ch),dh),hh),ph));var vh=(function(){ae.SDK_DIST_CHANNEL="npm";let e=ri[Xt]=new ai;return(function(){function t(){t.done||(t.done=!0,xl=!1,G(ri,function(i){i._dom_loaded()}))}x?.addEventListener?x.readyState==="complete"?t():z(x,"DOMContentLoaded",t,{capture:!1}):y&&k.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),e})(),xh=vh;export{ke as Compression,wh as DEFAULT_PRODUCT_TOUR_APPEARANCE,fn as DisplaySurveyType,ai as PostHog,Yc as ProductTourEventName,Nr as ProductTourEventProperties,ze as SurveyEventName,Os as SurveyEventProperties,Vt as SurveyEventType,gh as SurveyPosition,yh as SurveyQuestionBranchingType,mh as SurveyQuestionType,bh as SurveySchedule,_h as SurveyTabPosition,Ps as SurveyType,fh as SurveyWidgetType,xh as default,vh as posthog,Eh as severityLevels};

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.