1import{r as e}from"./chunk-BNv3lrIs.js";import{An as t,Hn as n,In as r,Ln as i,Qt as a,Xt as o,cn as s}from"./utils-DJX6_tFu.js";import{n as c}from"./constants-B3I9G520.js";import{t as l}from"./getRoundingMethod-ChFzKvaU.js";import{t as u}from"./differenceInMilliseconds-uf1fb6xy.js";import{i as d}from"./react-BX9wjTsJ.js";import{L as f,Pt as p,R as m,ha as h,kr as g,t as _}from"./api-CjWme3MJ.js";import{t as ee}from"./jsx-runtime-0CkuSBV-.js";import{t as te}from"./react-toastify.esm-DqbI73r_.js";import{n as ne,r as re}from"./distillTeam-B_hILKBN.js";import{D as ie,f as ae,n as v,p as oe,s as y,t as se,y as b}from"./ablyStore-D-66BraQ.js";import{t as ce}from"./Link-B6d2R1ma.js";import{t as x}from"./atom-C28IjVjl.js";import{t as S}from"./computed-BHMfc53M.js";import{r as le}from"./react-gY4oLycp.js";function C(e,t,n){let r=u(e,t)/c;return l(n?.roundingMethod)(r)}var w=function(e){return e[e.RESET_ON_NEW=0]=`RESET_ON_NEW`,e[e.IMMEDIATE_THEN_WAIT=1]=`IMMEDIATE_THEN_WAIT`,e[e.IGNORE_NEW=2]=`IGNORE_NEW`,e[e.QUEUE_LAST=3]=`QUEUE_LAST`,e}({}),ue=new class{constructor(){this.debounceTimers={}}debounce(e,t,n,r){let i=this.debounceTimers[e];switch(r){case w.IMMEDIATE_THEN_WAIT:if(i)return;this.debounceTimers[e]=setTimeout(()=>delete this.debounceTimers[e],n),t();return;case w.QUEUE_LAST:if(i){i.queued=t,i.wait=n;return}this.debounceTimers[e]={timer:setTimeout(()=>{let t=this.debounceTimers[e];delete this.debounceTimers[e],t.queued&&this.debounce(e,t.queued,t.wait,r)},n)},t();return;case w.IGNORE_NEW:if(i)return;this.debounceTimers[e]=setTimeout(()=>{t(),delete this.debounceTimers[e]},n);return;case w.RESET_ON_NEW:default:clearTimeout(i),this.debounceTimers[e]=setTimeout(()=>{t(),delete this.debounceTimers[e]},n);return}}clear(e){let t=this.debounceTimers[e];clearTimeout(typeof t==`object`?t.timer:t),delete this.debounceTimers[e]}},T=typeof window<`u`?window:void 0,E=typeof globalThis<`u`?globalThis:T;typeof self>`u`&&(E.self=E),typeof File>`u`&&(E.File=function(){});var de=Array.prototype,fe=de.forEach,pe=de.indexOf,D=E?.navigator,O=E?.document,me=E?.location,he=E?.fetch,ge=E!=null&&E.XMLHttpRequest&&`withCredentials`in new E.XMLHttpRequest?E.XMLHttpRequest:void 0,_e=E?.AbortController,k=D?.userAgent,A=T??{},ve={DEBUG:!1,LIB_VERSION:`1.306.0`};function ye(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function be(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){ye(a,r,i,o,s,`next`,e)}function s(e){ye(a,r,i,o,s,`throw`,e)}o(void 0)}))}}function j(){return j=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},j.apply(null,arguments)}function xe(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var Se=`amazonbot,amazonproductbot,app.hypefactors.com,applebot,archive.org_bot,awariobot,backlinksextendedbot,baiduspider,bingbot,bingpreview,chrome-lighthouse,dataforseobot,deepscan,duckduckbot,facebookexternal,facebookcatalog,http://yandex.com/bots,hubspot,ia_archiver,leikibot,linkedinbot,meta-externalagent,mj12bot,msnbot,nessus,petalbot,pinterest,prerender,rogerbot,screaming frog,sebot-wa,sitebulb,slackbot,slurp,trendictionbot,turnitin,twitterbot,vercel-screenshot,vercelbot,yahoo! slurp,yandexbot,zoombot,bot.htm,bot.php,(bot;,bot/,crawler,ahrefsbot,ahrefssiteaudit,semrushbot,siteauditbot,splitsignalbot,gptbot,oai-searchbot,chatgpt-user,perplexitybot,better uptime bot,sentryuptimebot,uptimerobot,headlesschrome,cypress,google-hoteladsverifier,adsbot-google,apis-google,duplexweb-google,feedfetcher-google,google favicon,google web preview,google-read-aloud,googlebot,googleother,google-cloudvertexbot,googleweblight,mediapartners-google,storebot-google,google-inspectiontool,bytespider`.split(`,`),Ce=function(e,t){if(t===void 0&&(t=[]),!e)return!1;var n=e.toLowerCase();return Se.concat(t).some((e=>{var t=e.toLowerCase();return n.indexOf(t)!==-1}))},we=[`$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`];function M(e,t){return e.indexOf(t)!==-1}var Te=function(e){return e.trim()},Ee=function(e){return e.replace(/^\$/,``)},De=Array.isArray,Oe=Object.prototype,ke=Oe.hasOwnProperty,Ae=Oe.toString,N=De||function(e){return Ae.call(e)===`[object Array]`},je=e=>typeof e==`function`,P=e=>e===Object(e)&&!N(e),Me=e=>{if(P(e)){for(var t in e)if(ke.call(e,t))return!1;return!0}return!1},F=e=>e===void 0,I=e=>Ae.call(e)==`[object String]`,Ne=e=>I(e)&&e.trim().length===0,Pe=e=>
1e===null,L=e=>F(e)||Pe(e),Fe=e=>Ae.call(e)==`[object Number]`,Ie=e=>Ae.call(e)===`[object Boolean]`,Le=e=>e instanceof FormData,Re=e=>M(we,e);function ze(e){return typeof e!=`object`||!e}function Be(e,t){return Object.prototype.toString.call(e)===`[object `+t+`]`}function Ve(e){return!F(Event)&&function(e,t){try{return e instanceof t}catch{return!1}}(e,Event)}var He=[!0,`true`,1,`1`,`yes`],Ue=e=>M(He,e),We=[!1,`false`,0,`0`,`no`];function Ge(e,t,n,r,i){return t>n&&(r.warn(`min cannot be greater than max.`),t=n),Fe(e)?e>n?(r.warn(` cannot be greater than max: `+n+`. Using max value instead.`),n):e<t?(r.warn(` cannot be less than min: `+t+`. Using min value instead.`),t):e:(r.warn(` must be a number. using max or fallback. max: `+n+`, fallback: `+i),Ge(i||n,t,n,r))}var Ke=class{constructor(e){this.t={},this.i=e.i,this.o=Ge(e.bucketSize,0,100,e.h),this.m=Ge(e.refillRate,0,this.o,e.h),this.S=Ge(e.refillInterval,0,864e5,e.h)}$(e,t){var n=t-e.lastAccess,r=Math.floor(n/this.S);if(r>0){var i=r*this.m;e.tokens=Math.min(e.tokens+i,this.o),e.lastAccess+=r*this.S}}consumeRateLimit(e){var t,n=Date.now(),r=String(e),i=this.t[r];return i?this.$(i,n):(i={tokens:this.o,lastAccess:n},this.t[r]=i),i.tokens===0||(i.tokens--,i.tokens===0&&((t=this.i)==null||t.call(this,e)),i.tokens===0)}stop(){this.t={}}},qe,Je,Ye,Xe=e=>e instanceof Error;function Ze(e){var t=globalThis._posthogChunkIds;if(t){var n=Object.keys(t);return Ye&&n.length===Je||(Je=n.length,Ye=n.reduce(((n,r)=>{qe||={};var i=qe[r];if(i)n[i[0]]=i[1];else for(var a=e(r),o=a.length-1;o>=0;o--){var s=a[o]?.filename,c=t[r];if(s&&c){n[s]=c,qe[r]=[s,c];break}}return n}),{})),Ye}}var Qe=class{constructor(e,t,n){n===void 0&&(n=[]),this.coercers=e,this.stackParser=t,this.modifiers=n}buildFromUnknown(e,t){t===void 0&&(t={});var n=t&&t.mechanism||{handled:!0,type:`generic`},r=this.buildCoercingContext(n,t,0).apply(e),i=this.buildParsingContext(),a=this.parseStacktrace(r,i);return{$exception_list:this.convertToExceptionList(a,n),$exception_level:`error`}}modifyFrames(e){var t=this;return be((function*(){for(var n of e)n.stacktrace&&n.stacktrace.frames&&N(n.stacktrace.frames)&&(n.stacktrace.frames=yield t.applyModifiers(n.stacktrace.frames));return e}))()}coerceFallback(e){return{type:`Error`,value:`Unknown error`,stack:e.syntheticException?.stack,synthetic:!0}}parseStacktrace(e,t){var n,r;return e.cause!=null&&(n=this.parseStacktrace(e.cause,t)),e.stack!=``&&e.stack!=null&&(r=this.applyChunkIds(this.stackParser(e.stack,+!!e.synthetic),t.chunkIdMap)),j({},e,{cause:n,stack:r})}applyChunkIds(e,t){return e.map((e=>(e.filename&&t&&(e.chunk_id=t[e.filename]),e)))}applyCoercers(e,t){for(var n of this.coercers)if(n.match(e))return n.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return be((function*(){var n=e;for(var r of t.modifiers)n=yield r(n);return n}))()}convertToExceptionList(e,t){var n,r,i={type:e.type,value:e.value,mechanism:{type:t.type??`generic`,handled:(n=t.handled)==null||n,synthetic:(r=e.synthetic)!=null&&r}};e.stack&&(i.stacktrace={type:`raw`,frames:e.stack});var a=[i];return e.cause!=null&&a.push(...this.convertToExceptionList(e.cause,j({},t,{handled:!0}))),a}buildParsingContext(){return{chunkIdMap:Ze(this.stackParser)}}buildCoercingContext(e,t,n){n===void 0&&(n=0);var r=(n,r)=>{if(r<=4){var i=this.buildCoercingContext(e,t,r);return this.applyCoercers(n,i)}};return j({},t,{syntheticException:n==0?t.syntheticException:void 0,mechanism:e,apply:e=>r(e,n),next:e=>r(e,n+1)})}},$e=`?`;function et(e,t,n,r,i){var a={platform:e,filename:t,function:n===`<anonymous>`?$e:n,in_app:!0};return F(r)||(a.lineno=r),F(i)||(a.colno=i),a}var tt=(e,t)=>{var n=e.indexOf(`safari-extension`)!==-1,r=e.indexOf(`safari-web-extension`)!==-1;return n||r?[e.indexOf(`@`)===-1?$e:e.split(`@`)[0],n?`safari-extension:`+t:`safari-web-extension:`+t]:[e,t]},nt=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,rt=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,it=/\((\S*)(?::(\d+))(?::(\d+))\)/,at=(e,t)=>{var n=nt.exec(e);if(n){var[,r,i,a]=n;return et(t,r,$e,+i,+a)}var o=rt.exec(e);if(o){if(o[2]&&o[2].indexOf(`eval`)===0){var s=it.exec(o[2]);s&&(o[2]=s[1],o[3]=s[2],o[4]=s[3])}var[c,l]=tt(o[1]||$e,o[2]);return et(t,l,c,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},ot=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,st=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,ct=(e,t)=>
1{var n=ot.exec(e);if(n){if(n[3]&&n[3].indexOf(` > eval`)>-1){var r=st.exec(n[3]);r&&(n[1]=n[1]||`eval`,n[3]=r[1],n[4]=r[2],n[5]=``)}var i=n[3],a=n[1]||$e;return[a,i]=tt(a,i),et(t,i,a,n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},lt=/\(error: (.*)\)/,ut=50;function dt(e){var t=[...arguments].slice(1);return function(n,r){r===void 0&&(r=0);for(var i=[],a=n.split(` 2`),o=r;o<a.length;o++){var s=a[o];if(!(s.length>1024)){var c=lt.test(s)?s.replace(lt,`$1`):s;if(!c.match(/\S*Error: /)){for(var l of t){var u=l(c,e);if(u){i.push(u);break}}if(i.length>=ut)break}}}return function(e){if(!e.length)return[];var t=Array.from(e);return t.reverse(),t.slice(0,ut).map((e=>{return j({},e,{filename:e.filename||(n=t,n[n.length-1]||{}).filename,function:e.function||$e});var n}))}(i)}}var ft=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var n=I(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:n?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?`DOMError`:`DOMException`}getValue(e){var t=e.name||(this.isDOMError(e)?`DOMError`:`DOMException`);return e.message?t+`: `+e.message:t}isDOMException(e){return Be(e,`DOMException`)}isDOMError(e){return Be(e,`DOMError`)}},pt=class{match(e){return(e=>e instanceof Error)(e)}coerce(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var n=e.message;return n.error&&typeof n.error.message==`string`?String(n.error.message):String(n)}getStack(e){return e.stacktrace||e.stack||void 0}},mt=class{constructor(){}match(e){return Be(e,`ErrorEvent`)&&e.error!=null}coerce(e,t){return t.apply(e.error)||{type:`ErrorEvent`,value:e.message,stack:t.syntheticException?.stack,synthetic:!0}}},ht=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,gt=class{match(e){return typeof e==`string`}coerce(e,t){var[n,r]=this.getInfos(e);return{type:n??`Error`,value:r??e,stack:t.syntheticException?.stack,synthetic:!0}}getInfos(e){var t=`Error`,n=e,r=e.match(ht);return r&&(t=r[1],n=r[2]),[t,n]}},_t=[`fatal`,`error`,`warning`,`log`,`info`,`debug`];function vt(e,t){t===void 0&&(t=40);var n=Object.keys(e);if(n.sort(),!n.length)return`[object has no keys]`;for(var r=n.length;r>0;r--){var i=n.slice(0,r).join(`, `);if(!(i.length>t))return r===n.length||i.length<=t?i:i.slice(0,t)+`...`}return``}var yt=class{match(e){return typeof e==`object`&&!!e}coerce(e,t){var n=this.getErrorPropertyFromObject(e);return n?t.apply(n):{type:this.getType(e),value:this.getValue(e),stack:t.syntheticException?.stack,level:this.isSeverityLevel(e.level)?e.level:`error`,synthetic:!0}}getType(e){return Ve(e)?e.constructor.name:`Error`}getValue(e){if(`name`in e&&typeof e.name==`string`){var t=`'`+e.name+`' captured as exception`;return`message`in e&&typeof e.message==`string`&&(t+=` with message: '`+e.message+`'`),t}if(`message`in e&&typeof e.message==`string`)return e.message;var n=this.getObjectClassName(e);return(n&&n!==`Object`?`'`+n+`'`:`Object`)+` captured as exception with keys: `+vt(e)}isSeverityLevel(e){return I(e)&&!Ne(e)&&_t.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var n=e[t];if(Xe(n))return n}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},bt=class{match(e){return Ve(e)}coerce(e,t){var n=e.constructor.name;return{type:n,value:n+` captured as exception with keys: `+vt(e),stack:t.syntheticException?.stack,synthetic:!0}}},xt=class{match(e){return ze(e)}coerce(e,t){return{type:`Error`,value:`Primitive value captured as exception: `+String(e),stack:t.syntheticException?.stack,synthetic:!0}}},St=class{match(e){return Be(e,`PromiseRejectionEvent`)}coerce(e,t){var n=this.getUnhandledRejectionReason(e);return ze(n)?{type:`UnhandledRejection`,value:`Non-Error promise rejection captured with value: `+String(n),stack:t.syntheticException?.stack,synthetic:!0}:t.apply(n)}getUnhandledRejectionReason(e){if(ze(e))return e;try{if(`reason`in e)return e.reason;if(`detail`in e&&`reason`in e.detail)return e.detail.reason}catch{}return e}},Ct=function(e,t){var{debugEnabled:n}=t===void 0?{}:t,r={k:function(t){if(T&&(ve.DEBUG||A.POSTHOG_DEBUG||n)&&!F(T.console)&&T.console){for(var r=(`__rrweb_original__`in T.console[t])?T.console[t].__rrweb_original__:T.console[t],i=arguments.length,a=Array(i>1?i-1:0),o=1;o<i;o++)a[o-1]=arguments[o];r(e,...a)}},info:function(){var e=[...arguments];r.k(`log`,...e)},warn:function(){var e=[...arguments];r.k(`warn`,...e)},error:function(){var e=[...arguments];r.k(`error`,...e)},critical:function(){console.error(e,...arguments)},uninitializedWarning:e=>{r.error(`You must initialize PostHog before calling `+e)},createLogger:(t,n)=>Ct(e+` `+t,n)};return r},R=Ct(`[PostHog.js]`),z=R.createLogger,wt=z(`[ExternalScriptsLoader]`),Tt=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return wt.warn(t+` was requested but loading of external scripts is disabled.`),n(`Loa
2ding of external scripts is disabled`);var r=O?.querySelectorAll(`script`);if(r){for(var i,a=function(){if(r[o].src===t){var e=r[o];return e.__posthog_loading_callback_fired?{v:n()}:(e.addEventListener(`load`,(t=>{e.__posthog_loading_callback_fired=!0,n(void 0,t)})),e.onerror=e=>n(e),{v:void 0})}},o=0;o<r.length;o++)if(i=a())return i.v}var s=()=>{if(!O)return n(`document not found`);var r=O.createElement(`script`);if(r.type=`text/javascript`,r.crossOrigin=`anonymous`,r.src=t,r.onload=e=>{r.__posthog_loading_callback_fired=!0,n(void 0,e)},r.onerror=e=>n(e),e.config.prepare_external_dependency_script&&(r=e.config.prepare_external_dependency_script(r)),!r)return n(`prepare_external_dependency_script returned null`);var i,a=O.querySelectorAll(`body > script`);a.length>0?(i=a[0].parentNode)==null||i.insertBefore(r,a[0]):O.body.appendChild(r)};O!=null&&O.body?s():O?.addEventListener(`DOMContentLoaded`,s)};A.__PosthogExtensions__=A.__PosthogExtensions__||{},A.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{var r=`/static/`+t+`.js?v=`+e.version;if(t===`remote-config`&&(r=`/array/`+e.config.token+`/config.js`),t===`toolbar`){var i=3e5;r=r+`&t=`+Math.floor(Date.now()/i)*i}Tt(e,e.requestRouter.endpointFor(`assets`,r),n)},A.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{Tt(e,e.requestRouter.endpointFor(`api`,t),n)};var Et={};function Dt(e,t,n){if(N(e)){if(fe&&e.forEach===fe)e.forEach(t,n);else if(`length`in e&&e.length===+e.length){for(var r=0,i=e.length;r<i;r++)if(r in e&&t.call(n,e[r],r)===Et)return}}}function B(e,t,n){if(!L(e)){if(N(e))return Dt(e,t,n);if(Le(e)){for(var r of e.entries())if(t.call(n,r[1],r[0])===Et)return}else for(var i in e)if(ke.call(e,i)&&t.call(n,e[i],i)===Et)return}}var V=function(e){return Dt([...arguments].slice(1),(function(t){for(var n in t)t[n]!==void 0&&(e[n]=t[n])})),e},Ot=function(e){return Dt([...arguments].slice(1),(function(t){Dt(t,(function(t){e.push(t)}))})),e};function kt(e){for(var t=Object.keys(e),n=t.length,r=Array(n);n--;)r[n]=[t[n],e[t[n]]];return r}var At=function(e){try{return e()}catch{return}},jt=function(e){return function(){try{var t=[...arguments];return e.apply(this,t)}catch(e){R.critical(`Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A.`),R.critical(e)}}},Mt=function(e){var t={};return B(e,(function(e,n){(I(e)&&e.length>0||Fe(e))&&(t[n]=e)})),t};function Nt(e,t){return n=e,r=e=>I(e)&&!Pe(t)?e.slice(0,t):e,i=new Set,function e(t,n){return t===Object(t)?i.has(t)?void 0:(i.add(t),N(t)?(a=[],Dt(t,(t=>{a.push(e(t))}))):(a={},B(t,((t,n)=>{i.has(t)||(a[n]=e(t,n))}))),a):r?r(t,n):t;var a}(n);var n,r,i}var Pt=[`herokuapp.com`,`vercel.app`,`netlify.app`];function Ft(e){var t=e?.hostname;if(!I(t))return!1;var n=t.split(`.`).slice(-2).join(`.`);for(var r of Pt)if(n===r)return!1;return!0}function It(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return e[n]}function H(e,t,n,r){var{capture:i=!1,passive:a=!0}=r??{};e?.addEventListener(t,n,{capture:i,passive:a})}var Lt=`$people_distinct_id`,Rt=`__alias`,zt=`__timers`,Bt=`$autocapture_disabled_server_side`,Vt=`$heatmaps_enabled_server_side`,Ht=`$exception_capture_enabled_server_side`,Ut=`$error_tracking_suppression_rules`,Wt=`$error_tracking_capture_extension_exceptions`,Gt=`$web_vitals_enabled_server_side`,Kt=`$dead_clicks_enabled_server_side`,qt=`$web_vitals_allowed_metrics`,Jt=`$session_recording_remote_config`,Yt=`$sesid`,Xt=`$session_is_sampled`,Zt=`$enabled_feature_flags`,Qt=`$early_access_features`,$t=`$feature_flag_details`,en=`$stored_person_properties`,tn=`$stored_group_properties`,nn=`$surveys`,rn=`$surveys_activated`,an=`$flag_call_reported`,on=`$user_state`,sn=`$client_session_props`,cn=`$capture_rate_limit`,ln=`$initial_campaign_params`,un=`$initial_referrer_info`,dn=`$initial_person_info`,fn=`$epp`,pn=`__POSTHOG_TOOLBAR__`,mn=`$posthog_cookieless`,hn=[Lt,Rt,`__cmpns`,zt,`$session_recording_enabled_server_side`,Vt,Yt,Zt,Ut,on,Qt,$t,tn,en,nn,an,sn,cn,ln,un,fn,dn];function gn(e){return e instanceof Element&&(e.id===pn||!(e.closest==null||!e.closest(`.toolbar-global-fade-container`)))}function _n(e){return!!e&&e.nodeType===1}function vn(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function yn(e){return!!e&&e.nodeType===3}function bn(e){return!!e&&e.nodeType===11}function xn(e){return e?Te(e).split(/\s+/):[]}function Sn(e){var t=T?.location.href;return!!(t&&e&&e.some((e=>t.match(e))))}function Cn(e){var 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 xn(t)}function wn(e){return L(e)?null:Te(e).split(/(\s+)/).filter((e=>Gn(e))).join(``).replace(/[\r\n]/g,` `).replace(/[ ]+/g,` `).substring(0,255)}function Tn(e){var t=``;return Ln(e)&&!Rn(e)&&e.childNodes&&e.childNodes.length&&B(e.childNodes,(function(e){yn(e)&&e.textContent&&(t+=wn(e.textContent)??``)})),Te(t)}function En(e){return F(e.target)?e.srcElement||null:(t=e.target)!=null&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var Dn=[`a`,`button`,`form`,`input`,`select`,`textarea`,`label`];function On(e,t){if(F(t))return!0;var n,r=function(e){if(t.some((t=>e.matches(t))))return{v:!0}};for(var i of e)if(n=r(i))return n.v;return!1}function kn(e){var t=e.parentNode;return!(!t||!_n(t))&&t}var An=[`next`,`previous`,`prev`,`>`,`<`],jn=10,Mn=[`.ph-no-rageclick`,`.ph-no-capture`];function Nn(e,t){if(!T||Pn(e))return!1;var n,r;if(Ie(t)?(n=!!t&&Mn,r=void 0):(n=t?.css_selector_ignorelist??Mn,r=t?.content_ignorelist),!1===n)return!1;var{targetElementList:i}=Fn(e,!1);return!function(e,t){if(!1===e||F(e))return!1;var n;if(!0===e)n=An;else{if(!N(e))return!1;if(e.length>jn)return R.error(`[PostHog] content_ignorelist array cannot exceed `+jn+` items. Use css_selector_ignorelist for more complex matching.`),!1;n=e.map((e=>e.toLowerCase()))}return t.some((e=>{var{safeText:t,ariaLabel:r}=e;return n.some((e=>t.includes(e)||r.includes(e)))}))}(r,i.map((e=>({safeText:Tn(e).toLowerCase(),ariaLabel:e.getAttribute(`aria-label`)?.toLowerCase().trim()||``}))))&&!On(i,n)}var Pn=e=>!e||vn(e,`html`)||!_n(e),Fn=(e,t)=>{if(!T||Pn(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,r=[e],i=e;i.parentNode&&!vn(i,`body`);)if(bn(i.parentNode))r.push(i.parentNode.host),i=i.parentNode.host;else{var a=kn(i);if(!a)break;if(t||Dn.indexOf(a.tagName.toLowerCase())>-1)n=!0;else{var o=T.getComputedStyle(a);o&&o.getPropertyValue(`cursor`)===`pointer`&&(n=!0)}r.push(a),i=a}return{parentIsUsefulElement:n,targetElementList:r}};function In(e,t,n,r,i){var a,o,s;if(n===void 0&&(n=void 0),!T||Pn(e)||(a=n)!=null&&a.url_allowlist&&!Sn(n.url_allowlist)||(o=n)!=null&&o.url_ignorelist&&Sn(n.url_ignorelist))return!1;if((s=n)!=null&&s.dom_event_allowlist){var c=n.dom_event_allowlist;if(c&&!c.some((e=>t.type===e)))return!1}var{parentIsUsefulElement:l,targetElementList:u}=Fn(e,r);if(!function(e,t){var n=t?.element_allowlist;if(F(n))return!0;var r,i=function(e){if(n.some((t=>e.tagName.toLowerCase()===t)))return{v:!0}};for(var a of e)if(r=i(a))return r.v;return!1}(u,n)||!On(u,n?.css_selector_allowlist))return!1;var d=T.getComputedStyle(e);
2if(d&&d.getPropertyValue(`cursor`)===`pointer`&&t.type===`click`)return!0;var f=e.tagName.toLowerCase();switch(f){case`html`:return!1;case`form`:return(i||[`submit`]).indexOf(t.type)>=0;case`input`:case`select`:case`textarea`:return(i||[`change`,`click`]).indexOf(t.type)>=0;default:return l?(i||[`click`]).indexOf(t.type)>=0:(i||[`click`]).indexOf(t.type)>=0&&(Dn.indexOf(f)>-1||e.getAttribute(`contenteditable`)===`true`)}}function Ln(e){for(var t=e;t.parentNode&&!vn(t,`body`);t=t.parentNode){var n=Cn(t);if(M(n,`ph-sensitive`)||M(n,`ph-no-capture`))return!1}if(M(Cn(e),`ph-include`))return!0;var r=e.type||``;if(I(r))switch(r.toLowerCase()){case`hidden`:case`password`:return!1}var i=e.name||e.id||``;return!(I(i)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(i.replace(/[^a-zA-Z0-9]/g,``)))}function Rn(e){return!!(vn(e,`input`)&&![`button`,`checkbox`,`submit`,`reset`].includes(e.type)||vn(e,`select`)||vn(e,`textarea`)||e.getAttribute(`contenteditable`)===`true`)}var zn=`(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})`,Bn=RegExp(`^(?:`+zn+`)$`),Vn=new RegExp(zn),Hn=`\\d{3}-?\\d{2}-?\\d{4}`,Un=RegExp(`^(`+Hn+`)$`),Wn=RegExp(`(`+Hn+`)`);function Gn(e,t){return t===void 0&&(t=!0),!(L(e)||I(e)&&(e=Te(e),(t?Bn:Vn).test((e||``).replace(/[- ]/g,``))||(t?Un:Wn).test(e)))}function Kn(e){var t=Tn(e);return Gn(t=(t+` `+qn(e)).trim())?t:``}function qn(e){var t=``;return e&&e.childNodes&&e.childNodes.length&&B(e.childNodes,(function(e){if(e&&e.tagName?.toLowerCase()===`span`)try{var n=Tn(e);t=(t+` `+n).trim(),e.childNodes&&e.childNodes.length&&(t=(t+` `+qn(e)).trim())}catch(e){R.error(`[AutoCapture]`,e)}})),t}function Jn(e){return function(e){return e.map((e=>{var t=``;if(e.tag_name&&(t+=e.tag_name),e.attr_class)for(var n of(e.attr_class.sort(),e.attr_class))t+=`.`+n.replace(/"/g,``);var r=j({},e.text?{text:e.text}:{},{"nth-child":e.nth_child??0,"nth-of-type":e.nth_of_type??0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),i={};return kt(r).sort(((e,t)=>{var[n]=e,[r]=t;return n.localeCompare(r)})).forEach((e=>{var[t,n]=e;return i[Yn(t.toString())]=Yn(n.toString())})),t+=`:`,t+=kt(i).map((e=>{var[t,n]=e;return t+`="`+n+`"`})).join(``)})).join(`;`)}(function(e){return e.map((e=>{var t={text:e.$el_text?.slice(0,400),tag_name:e.tag_name,href:e.attr__href?.slice(0,2048),attr_class:Xn(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return kt(e).filter((e=>{var[t]=e;return t.indexOf(`attr__`)===0})).forEach((e=>{var[n,r]=e;return t.attributes[n]=r})),t}))}(e))}function Yn(e){return e.replace(/"|\\"/g,`\\"`)}function Xn(e){var t=e.attr__class;return t?N(t)?t:xn(t):void 0}var Zn=class{constructor(e){this.disabled=!1===e;var t=P(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,n){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(e-r.x)+Math.abs(t-r.y)<this.thresholdPx&&n-r.timestamp<this.timeoutMs){if(this.clicks.push({x:e,y:t,timestamp:n}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:n}];return!1}},Qn=`$copy_autocapture`,$n=function(e){return e.GZipJS=`gzip-js`,e.Base64=`base64`,e}({}),er=e=>{var t=O?.createElement(`a`);return F(t)?null:(t.href=e,t)},tr=function(e,t){var n,r;t===void 0&&(t=`&`);var i=[];return B(e,(function(e,t){F(e)||F(t)||t===`undefined`||(n=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),r=encodeURIComponent(t),i[i.length]=r+`=`+n)})),i.join(t)},nr=function(e,t){for(var n,r=((e.split(`#`)[0]||``).split(/\?(.*)/)[1]||``).replace(/^\?+/g,``).split(`&`),i=0;i<r.length;i++){var a=r[i].split(`=`);
2if(a[0]===t){n=a;break}}if(!N(n)||n.length<2)return``;var o=n[1];try{o=decodeURIComponent(o)}catch{R.error(`Skipping decoding for malformed query param: `+o)}return o.replace(/\+/g,` `)},rr=function(e,t,n){if(!e||!t||!t.length)return e;for(var r=e.split(`#`),i=r[0]||``,a=r[1],o=i.split(`?`),s=o[1],c=o[0],l=(s||``).split(`&`),u=[],d=0;d<l.length;d++){var f=l[d].split(`=`);N(f)&&(t.includes(f[0])?u.push(f[0]+`=`+n):u.push(l[d]))}var p=c;return s!=null&&(p+=`?`+u.join(`&`)),a!=null&&(p+=`#`+a),p},ir=function(e,t){var n=e.match(RegExp(t+`=([^&]*)`));return n?n[1]:null},ar=z(`[AutoCapture]`);function or(e,t){return t.length>e?t.slice(0,e)+`...`:t}function sr(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!_n(t));return t}function cr(e,t,n,r){var i=e.tagName.toLowerCase(),a={tag_name:i};Dn.indexOf(i)>-1&&!n&&(i.toLowerCase()===`a`||i.toLowerCase()===`button`?a.$el_text=or(1024,Kn(e)):a.$el_text=or(1024,Tn(e)));var o=Cn(e);o.length>0&&(a.classes=o.filter((function(e){return e!==``}))),B(e.attributes,(function(n){var i;if((!Rn(e)||[`name`,`id`,`class`,`aria-label`].indexOf(n.name)!==-1)&&(r==null||!r.includes(n.name))&&!t&&Gn(n.value)&&(i=n.name,!I(i)||i.substring(0,10)!==`_ngcontent`&&i.substring(0,7)!==`_nghost`)){var o=n.value;n.name===`class`&&(o=xn(o).join(` `)),a[`attr__`+n.name]=or(1024,o)}}));for(var s=1,c=1,l=e;l=sr(l);)s++,l.tagName===e.tagName&&c++;return a.nth_child=s,a.nth_of_type=c,a}function lr(e,t){for(var n,{e:r,maskAllElementAttributes:i,maskAllText:a,elementAttributeIgnoreList:o,elementsC
2hainAsString:s}=t,c=[e],l=e;l.parentNode&&!vn(l,`body`);)bn(l.parentNode)?(c.push(l.parentNode.host),l=l.parentNode.host):(c.push(l.parentNode),l=l.parentNode);var u,d=[],f={},p=!1,m=!1;if(B(c,(e=>{var t=Ln(e);e.tagName.toLowerCase()===`a`&&(p=e.getAttribute(`href`),p=t&&p&&Gn(p)&&p),M(Cn(e),`ph-no-capture`)&&(m=!0),d.push(cr(e,i,a,o)),V(f,function(e){if(!Ln(e))return{};var t={};return B(e.attributes,(function(e){if(e.name&&e.name.indexOf(`data-ph-capture-attribute`)===0){var n=e.name.replace(`data-ph-capture-attribute-`,``),r=e.value;n&&r&&Gn(r)&&(t[n]=r)}})),t}(e))})),m)return{props:{},explicitNoCapture:m};if(a||(e.tagName.toLowerCase()===`a`||e.tagName.toLowerCase()===`button`?d[0].$el_text=Kn(e):d[0].$el_text=Tn(e)),p){var h;d[0].attr__href=p;var g=er(p)?.host,_=T==null||(h=T.location)==null?void 0:h.host;g&&_&&g!==_&&(u=p)}return{props:V({$event_type:r.type,$ce_version:1},s?{}:{$elements:d},{$elements_chain:Jn(d)},(n=d[0])!=null&&n.$el_text?{$el_text:d[0]?.$el_text}:{},u&&r.type===`click`?{$external_click_url:u}:{},f)}}var ur=class{constructor(e){this.P=!1,this.T=null,this.R=!1,this.instance=e,this.rageclicks=new Zn(e.config.rageclick),this.C=null}get I(){var e=P(this.instance.config.autocapture)?this.instance.config.autocapture:{};return e.url_allowlist=e.url_allowlist?.map((e=>new RegExp(e))),e.url_ignorelist=e.url_ignorelist?.map((e=>new RegExp(e))),e}F(){if(this.isBrowserSupported()){if(T&&O){var e=e=>{e||=T?.event;try{this.M(e)}catch(e){ar.error(`Failed to capture event`,e)}};if(H(O,`submit`,e,{capture:!0}),H(O,`change`,e,{capture:!0}),H(O,`click`,e,{capture:!0}),this.I.capture_copied_text){var t=e=>{e||=T?.event,this.M(e,Qn)};H(O,`copy`,t,{capture:!0}),H(O,`cut`,t,{capture:!0})}}}else ar.info(`Disabling Automatic Event Collection because this browser is not supported`)}startIfEnabled(){this.isEnabled&&!this.P&&(this.F(),this.P=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.R=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[Bt]:!!e.autocapture_opt_out}),this.T=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.C=e}getElementSelectors(e){var t,n=[];return(t=this.C)==null||t.forEach((t=>{(O?.querySelectorAll(t))?.forEach((r=>{e===r&&n.push(t)}))})),n}get isEnabled(){var e=this.instance.persistence?.props[Bt],t=this.T;if(Pe(t)&&!Ie(e)&&!this.instance.O())return!1;var n=this.T??!!e;return!!this.instance.config.autocapture&&!n}M(e,t){if(t===void 0&&(t=`$autocapture`),this.isEnabled){var n,r=En(e);yn(r)&&(r=r.parentNode||null),t===`$autocapture`&&e.type===`click`&&e instanceof MouseEvent&&this.instance.config.rageclick&&(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime())&&Nn(r,this.instance.config.rageclick)&&this.M(e,`$rageclick`);var i=t===Qn;if(r&&In(r,e,this.I,i,i?[`copy`,`cut`]:void 0)){var{props:a,explicitNoCapture:o}=lr(r,{e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.I.element_attribute_ignorelist,elementsChainAsString:this.R});if(o)return!1;var s=this.getElementSelectors(r);if(s&&s.length>0&&(a.$element_selectors=s),t===`$copy_autocapture`){var c,l=wn(T==null||(c=T.getSelection())==null?void 0:c.toString()),u=e.type||`clipboard`;if(!l)return!1;a.$selected_content=l,a.$copy_type=u}return this.instance.capture(t,a),!0}}}isBrowserSupported(){return je(O?.querySelectorAll)}};Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Fe(e)&&isFinite(e)&&Math.floor(e)===e});var dr=`0123456789abcdef`,fr=class e{constructor(e){if(this.bytes=e,e.length!==16)throw TypeError(`not 128-bit length`)}static fromFieldsV7(t,n,r,i){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(r)||!Number.isInteger(i)||t<0||n<0||r<0||i<0||t>0xffffffffffff||n>4095||r>1073741823||i>4294967295)throw RangeError(`invalid field value`);var a=new Uint8Array(16);return a[0]=t/2**40,a[1]=t/2**32,a[2]=t/2**24,a[3]=t/2**16,a[4]=t/2**8,a[5]=t,a[6]=112|n>>>8,a[7]=n,a[8]=128|r>>>24,a[9]=r>>>16,a[10]=r>>>8,a[11]=r,a[12]=i>>>24,a[13]=i>>>16,a[14]=i>>>8,a[15]=i,new e(a)}toString(){for(var e=``,t=0;t<this.bytes.length;t++)e=e+dr.charAt(this.bytes[t]>>>4)+dr.charAt(15&this.bytes[t]),t!==3&&t!==5&&t!==7&&t!==9||(e+=`-`);
vendor: 5,451 bytes, line 2
2if(e.length!==36)throw Error(`Invalid UUIDv7 was generated`);return e}clone(){return new e(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var t=0;t<16;t++){var n=this.bytes[t]-e.bytes[t];if(n!==0)return Math.sign(n)}return 0}},pr=class{constructor(){this.A=0,this.D=0,this.j=new gr}generate(){var e=this.generateOrAbort();if(F(e)){this.A=0;var t=this.generateOrAbort();if(F(t))throw Error(`Could not generate UUID after timestamp reset`);return t}return e}generateOrAbort(){var e=Date.now();if(e>this.A)this.A=e,this.L();else{if(!(e+1e4>this.A))return;this.D++,this.D>4398046511103&&(this.A++,this.L())}return fr.fromFieldsV7(this.A,Math.trunc(this.D/2**30),this.D&2**30-1,this.j.nextUint32())}L(){this.D=1024*this.j.nextUint32()+(1023&this.j.nextUint32())}},mr,hr=e=>{if(typeof UUIDV7_DENY_WEAK_RNG<`u`&&UUIDV7_DENY_WEAK_RNG)throw Error(`no cryptographically strong RNG available`);for(var t=0;t<e.length;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};T&&!F(T.crypto)&&crypto.getRandomValues&&(hr=e=>crypto.getRandomValues(e));var gr=class{constructor(){this.N=new Uint32Array(8),this.U=1/0}nextUint32(){return this.U>=this.N.length&&(hr(this.N),this.U=0),this.N[this.U++]}},_r=()=>vr().toString(),vr=()=>(mr||=new pr).generate(),yr=``,br=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function xr(e,t){if(t){var n=function(e,t){if(t===void 0&&(t=O),yr)return yr;if(!t||[`localhost`,`127.0.0.1`].includes(e))return``;for(var n=e.split(`.`),r=Math.min(n.length,8),i=`dmn_chk_`+_r();!yr&&r--;){var a=n.slice(r).join(`.`),o=i+`=1;domain=.`+a+`;path=/`;t.cookie=o+`;max-age=3`,t.cookie.includes(i)&&(t.cookie=o+`;max-age=0`,yr=a)}return yr}(e);if(!n){var r=(e=>{var t=e.match(br);return t?t[0]:``})(e);r!==n&&R.info(`Warning: cookie subdomain discovery mismatch`,r,n),n=r}return n?`; domain=.`+n:``}return``}var Sr={H:()=>!!O,B:function(e){R.error(`cookieStore error: `+e)},q:function(e){if(O){try{for(var t=e+`=`,n=O.cookie.split(`;`).filter((e=>e.length)),r=0;r<n.length;r++){for(var i=n[r];i.charAt(0)==` `;)i=i.substring(1,i.length);if(i.indexOf(t)===0)return decodeURIComponent(i.substring(t.length,i.length))}}catch{}return null}},W:function(e){var t;try{t=JSON.parse(Sr.q(e))||{}}catch{}return t},G:function(e,t,n,r,i){if(O)try{var a=``,o=``,s=xr(O.location.hostname,r);if(n){var c=new Date;c.setTime(c.getTime()+24*n*60*60*1e3),a=`; expires=`+c.toUTCString()}i&&(o=`; secure`);var l=e+`=`+encodeURIComponent(JSON.stringify(t))+a+`; SameSite=Lax; path=/`+s+o;return l.length>3686.4&&R.warn(`cookieStore warning: large cookie, len=`+l.length),O.cookie=l,l}catch{return}},V:function(e,t){if(O!=null&&O.cookie)try{Sr.G(e,``,-1,t)}catch{return}}},Cr=null,U={H:function(){if(!Pe(Cr))return Cr;var e=!0;if(F(T))e=!1;else try{var t=`__mplssupport__`;U.G(t,`xyz`),U.q(t)!==`"xyz"`&&(e=!1),U.V(t)}catch{e=!1}return e||R.error(`localStorage unsupported; falling back to cookie store`),Cr=e,e},B:function(e){R.error(`localStorage error: `+e)},q:function(e){try{return T?.localStorage.getItem(e)}catch(e){U.B(e)}return null},W:function(e){try{return JSON.parse(U.q(e))||{}}catch{}return null},G:function(e,t){try{T?.localStorage.setItem(e,JSON.stringify(t))}catch(e){U.B(e)}},V:function(e){try{T?.localStorage.removeItem(e)}catch(e){U.B(e)}}},wr=[`distinct_id`,Yt,Xt,fn,dn],Tr=j({},U,{W:function(e){try{var t={};try{t=Sr.W(e)||{}}catch{}var n=V(t,JSON.parse(U.q(e)||`{}`));return U.G(e,n),n}catch{}return null},G:function(e,t,n,r,i,a){try{U.G(e,t,void 0,void 0,a);var o={};wr.forEach((e=>{t[e]&&(o[e]=t[e])})),Object.keys(o).length&&Sr.G(e,o,n,r,i,a)}catch(e){U.B(e)}},V:function(e,t){try{T?.localStorage.removeItem(e),Sr.V(e,t)}catch(e){U.B(e)}}}),Er={},Dr={H:function(){return!0},B:function(e){R.error(`memoryStorage error: `+e)},q:function(e){return Er[e]||null},W:function(e){return Er[e]||null},G:function(e,t){Er[e]=t},V:function(e){delete Er[e]}},Or=null,W={H:function(){if(!Pe(Or))return Or;if(Or=!0,F(T))Or=!1;else try{var e=`__support__`;W.G(e,`xyz`),W.q(e)!==`"xyz"`&&(Or=!1),W.V(e)}catch{Or=!1}return Or},B:function(e){R.error(`sessionStorage error: `,e)},q:function(e){try{return T?.sessionStorage.getItem(e)}catch(e){W.B(e)}return null},W:function(e){try{return JSON.parse(W.q(e))||null}catch{}return null},G:function(e,t){try{T?.sessionStorage.setItem(e,JSON.stringify(t))}catch(e){W.B(e)}},V:function(e){try{T?.sessionStorage.removeItem(e)}catch(e){W.B(e)}}},kr=function(e){return e[e.PENDING=-1]=`PENDING`,e[e.DENIED=0]=`DENIED`,e[e.GRANTED=1]=`GRANTED`,e}({}),Ar=class{constructor(e){this._instance=e}get I(){return this._instance.config}get consent(){return this.J()?kr.DENIED:this.K}isOptedOut(){return this.I.cookieless_mode===`always`||this.consent===kr.DENIED||this.consent===kr.PENDING&&(this.I.opt_out_capturing_by_default||this.I.cookieless_mode===`on_reject`)}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===kr.DENIED}optInOut(e){this.Y.G(this.X,+!!e,this.I.cookie_expiration,this.I.cross_subdomain_cookie,this.I.secure_cookie)}reset(){this.Y.V(this.X,this.I.cross_subdomain_cookie)}get X(){var{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:n}=this._instance.config;return n||(t?t+e:`__ph_opt_in_out_`+e)}get K(){var e=this.Y.q(this.X);return Ue(e)?kr.GRANTED:M(We,e)?kr.DENIED:kr.PENDING}get Y(){if(!this.Z){var e=this.I.opt_out_capturing_persistence_type;this.Z=e===`localStorage`?U:Sr;var t=e===`localStorage`?Sr:U;
2t.q(this.X)&&(this.Z.q(this.X)||this.optInOut(Ue(t.q(this.X))),t.V(this.X,this.I.cross_subdomain_cookie))}return this.Z}J(){return!!this.I.respect_dnt&&!!It([D?.doNotTrack,D?.msDoNotTrack,A.doNotTrack],(e=>Ue(e)))}},jr=z(`[Dead Clicks]`),Mr=()=>!0,Nr=e=>{var t,n=!((t=e.instance.persistence)==null||!t.get_property(Kt)),r=e.instance.config.capture_dead_clicks;return Ie(r)?r:!!P(r)||n},Pr=class{get lazyLoadedDeadClicksAutocapture(){return this.tt}constructor(e,t,n){this.instance=e,this.isEnabled=t,this.onCapture=n,this.startIfEnabled()}onRemoteConfig(e){this.instance.persistence&&this.instance.persistence.register({[Kt]:e?.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.it((()=>{this.et()}))}it(e){var t,n;(t=A.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture&&e(),(n=A.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this.instance,`dead-clicks-autocapture`,(t=>{t?jr.error(`failed to load script`,t):e()}))}et(){var e;if(O){if(!this.tt&&(e=A.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var t=P(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.tt=A.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.tt.start(O),jr.info(`starting...`)}}else jr.error("`document` not found. Cannot start.")}stop(){this.tt&&(this.tt.stop(),this.tt=void 0,jr.info(`stopping...`))}},Fr=z(`[ExceptionAutocapture]`),Ir=class{constructor(e){var t;this.rt=()=>{var e;if(T&&this.isEnabled&&(e=A.__PosthogExtensions__)!=null&&e.errorWrappingFunctions){var t=A.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,n=A.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=A.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.st&&this.I.capture_unhandled_errors&&(this.st=t(this.captureException.bind(this))),!this.nt&&this.I.capture_unhandled_rejections&&(this.nt=n(this.captureException.bind(this))),!this.ot&&this.I.capture_console_errors&&(this.ot=r(this.captureException.bind(this)))}catch(e){Fr.error(`failed to start`,e),this.lt()}}},this._instance=e,this.ut=!((t=this._instance.persistence)==null||!t.props[Ht]),this.I=this.ht(),this.dt=new Ke({refillRate:this._instance.config.error_tracking.__exceptionRateLimiterRefillRate??1,bucketSize:this._instance.config.error_tracking.__exceptionRateLimiterBucketSize??10,refillInterval:1e4,h:Fr}),this.startIfEnabled()}ht(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return P(e)?t=j({},t,e):(F(e)?this.ut:e)&&(t=j({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.I.capture_console_errors||this.I.capture_unhandled_errors||this.I.capture_unhandled_rejections}startIfEnabled(){this.isEnabled&&(Fr.info(`enabled`),this.it(this.rt))}it(e){var t,n;(t=A.__PosthogExtensions__)!=null&&t.errorWrappingFunctions&&e(),(n=A.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,`exception-autocapture`,(t=>{if(t)return Fr.error(`failed to load script`,t);e()}))}lt(){var e,t,n;(e=this.st)==null||e.call(this),this.st=void 0,(t=this.nt)==null||t.call(this),this.nt=void 0,(n=this.ot)==null||n.call(this),this.ot=void 0}onRemoteConfig(e){var t=e.autocaptureExceptions;this.ut=!!t||!1,this.I=this.ht(),this._instance.persistence&&this._instance.persistence.register({[Ht]:this.ut}),this.startIfEnabled()}captureException(e){var t,n=(e==null||(t=e.$exception_list)==null||(t=t[0])==null?void 0:t.type)??`Exception`;this.dt.consumeRateLimit(n)?Fr.info(`Skipping exception capture because of client rate limiting.`,{exception:n}):this._instance.exceptions.sendExceptionEvent(e)}};function Lr(e,t,n){try{if(!(t in e))return()=>{};var r=e[t],i=n(r);return je(i)&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=i,()=>{e[t]=r}}catch{return()=>{}}}var Rr=class{constructor(e){var t;this._instance=e,this.vt=(T==null||(t=T.location)==null?void 0:t.pathname)||``}get isEnabled(){return this._instance.config.capture_pageview===`history_change`}startIfEnabled(){this.isEnabled&&(R.info(`History API monitoring enabled, starting...`),this.monitorHistoryChanges())}stop(){this.ct&&this.ct(),this.ct=void 0,R.info(`History API monitoring stopped`)}monitorHistoryChanges(){var e,t;if(T&&T.history){var n=this;(e=T.history.pushState)!=null&&e.__posthog_wrapped__||Lr(T.history,`pushState`,(e=>function(t,r,i){e.call(this,t,r,i),n.ft(`pushState`)})),(t=T.history.replaceState)!=null&&t.__posthog_wrapped__||Lr(T.history,`replaceState`,(e=>function(t,r,i){e.call(this,t,r,i),n.ft(`replaceState`)})),this.gt()}}ft(e){try{var t,n=T==null||(t=T.location)==null?void 0:t.pathname;if(!n)return;n!==this.vt&&this.isEnabled&&this._instance.capture(`$pageview`,{navigation_type:e}),this.vt=n}catch(t){R.error(`Error capturing `+e+` pageview`,t)}}
2gt(){if(!this.ct){var e=()=>{this.ft(`popstate`)};H(T,`popstate`,e),this.ct=()=>{T&&T.removeEventListener(`popstate`,e)}}}},zr=z(`[SegmentIntegration]`);function Br(e,t){var n=e.config.segment;if(!n)return t();(function(e,t){var n=e.config.segment;if(!n)return t();var r=n=>{var r=()=>n.anonymousId()||_r();e.config.get_device_id=r,n.id()&&(e.register({distinct_id:n.id(),$device_id:r()}),e.persistence.set_property(on,`identified`)),t()},i=n.user();`then`in i&&je(i.then)?i.then((e=>r(e))):r(i)})(e,(()=>{n.register((e=>{Promise&&Promise.resolve||zr.warn(`This browser does not have Promise support, and can not use the segment integration`);var t=(t,n)=>{if(!n)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(zr.info(`No userId set, resetting PostHog`),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(zr.info(`UserId set, identifying with PostHog`),e.identify(t.event.userId));var r=e.calculateEventProperties(n,t.event.properties);return t.event.properties=Object.assign({},r,t.event.properties),t};return{name:`PostHog JS`,type:`enrichment`,version:`1.0.0`,isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>t(e,e.event.event),page:e=>t(e,`$pageview`),identify:e=>t(e,`$identify`),screen:e=>t(e,`$screen`)}})(e)).then((()=>{t()}))}))}var Vr=`posthog-js`;function Hr(e,t){var{organization:n,projectId:r,prefix:i,severityAllowList:a=[`error`],sendExceptionsToPostHog:o=!0}=t===void 0?{}:t;return t=>{if(!(a===`*`||a.includes(t.level))||!e.__loaded)return t;t.tags||={};var s=e.requestRouter.endpointFor(`ui`,`/project/`+e.config.token+`/person/`+e.get_distinct_id());t.tags[`PostHog Person URL`]=s,e.sessionRecordingStarted()&&(t.tags[`PostHog Recording URL`]=e.get_session_replay_url({withTimestamp:!0}));var c=t.exception?.values||[],l=c.map((e=>j({},e,{stacktrace:e.stacktrace?j({},e.stacktrace,{type:`raw`,frames:(e.stacktrace.frames||[]).map((e=>j({},e,{platform:`web:javascript`})))}):void 0}))),u={$exception_message:c[0]?.value||t.message,$exception_type:c[0]?.type,$exception_level:t.level,$exception_list:l,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:c[0]?.value||t.message,$sentry_exception_type:c[0]?.type,$sentry_tags:t.tags};return n&&r&&(u.$sentry_url=(i||`https://sentry.io/organizations/`)+n+`/issues/?project=`+r+`&query=`+t.event_id),o&&e.exceptions.sendExceptionEvent(u),t}}var Ur=class{constructor(e,t,n,r,i,a){this.name=Vr,this.setupOnce=function(o){o(Hr(e,{organization:t,projectId:n,prefix:r,severityAllowList:i,sendExceptionsToPostHog:a==null||a}))}}},Wr=T!=null&&T.location?ir(T.location.hash,`__posthog`)||ir(location.hash,`state`):null,Gr=`_postHogToolbarParams`,Kr=z(`[Toolbar]`),qr=function(e){return e[e.UNINITIALIZED=0]=`UNINITIALIZED`,e[e.LOADING=1]=`LOADING`,e[e.LOADED=2]=`LOADED`,e}(qr||{}),Jr=class{constructor(e){this.instance=e}_t(e){A.ph_toolbar_state=e}yt(){return A.ph_toolbar_state??qr.UNINITIALIZED}maybeLoadToolbar(e,t,n){if(e===void 0&&(e=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),!T||!O)return!1;e??=T.location,n??=T.history;try{if(!t){try{T.localStorage.setItem(`test`,`test`),T.localStorage.removeItem(`test`)}catch{return!1}t=T?.localStorage}var r,i=Wr||ir(e.hash,`__posthog`)||ir(e.hash,`state`),a=i?At((()=>JSON.parse(atob(decodeURIComponent(i)))))||At((()=>JSON.parse(decodeURIComponent(i)))):null;return a&&a.action===`ph_authorize`?((r=a).source=`url`,r&&Object.keys(r).length>0&&(a.desiredHash?e.hash=a.desiredHash:n?n.replaceState(n.state,``,e.pathname+e.search):e.hash=``)):((r=JSON.parse(t.getItem(Gr)||`{}`)).source=`localstorage`,delete r.userIntent),!(!r.token||this.instance.config.token!==r.token)&&(this.loadToolbar(r),!0)}catch{return!1}}bt(e){var t=A.ph_load_toolbar||A.ph_load_editor;!L(t)&&je(t)?t(e,this.instance):Kr.warn(`No toolbar load function found`)}loadToolbar(e){var t=!(O==null||!O.getElementById(pn));if(!T||t)return!1;var n=this.instance.requestRouter.region===`custom`&&this.instance.config.advanced_disable_toolbar_metrics,r=j({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor(`ui`)},n?{instrument:!1}:{});if(T.localStorage.setItem(Gr,JSON.stringify(j({},r,{source:void 0}))),this.yt()===qr.LOADED)this.bt(r);else if(this.yt()===qr.UNINITIALIZED){var i;this._t(qr.LOADING),(i=A.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this.instance,`toolbar`,(e=>{if(e)return Kr.error(`[Toolbar] Failed to load`,e),void this._t(qr.UNINITIALIZED);this._t(qr.LOADED),this.bt(r)})),H(T,`turbolinks:load`,(()=>{this._t(qr.UNINITIALIZED),this.loadToolbar(r)}))}return!0}wt(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,n){return e===void 0&&(e=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),this.maybeLoadToolbar(e,t,n)}},Yr=z(`[TracingHeaders]`),Xr=class{constructor(e){this.xt=void 0,this.Et=void 0,this.rt=()=>{var e,t;F(this.xt)&&((e=A.__PosthogExtensions__)==null||(e=e.tracingHeadersPatchFns)==null||e._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),F(this.Et)&&((t=A.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null||t._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=e}it(e){var t,n;(t=A.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns&&e(),(n=A.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,`tracing-headers`,(t=>{if(t)return Yr.error(`failed to load script`,t);
2e()}))}startIfEnabledOrStop(){var e,t;this._instance.config.__add_tracing_headers?this.it(this.rt):((e=this.xt)==null||e.call(this),(t=this.Et)==null||t.call(this),this.xt=void 0,this.Et=void 0)}},G=`Mobile`,Zr=`iOS`,Qr=`Android`,$r=`Tablet`,ei=Qr+` `+$r,ti=`iPad`,ni=`Apple`,ri=ni+` Watch`,ii=`Safari`,ai=`BlackBerry`,oi=`Samsung`,si=oi+`Browser`,ci=oi+` Internet`,li=`Chrome`,ui=li+` OS`,di=li+` `+Zr,fi=`Internet Explorer`,pi=fi+` `+G,mi=`Opera`,hi=mi+` Mini`,gi=`Edge`,_i=`Microsoft `+gi,vi=`Firefox`,yi=vi+` `+Zr,bi=`Nintendo`,xi=`PlayStation`,Si=`Xbox`,Ci=Qr+` `+G,wi=G+` `+ii,Ti=`Windows`,Ei=Ti+` Phone`,Di=`Nokia`,Oi=`Ouya`,ki=`Generic`,Ai=ki+` `+G.toLowerCase(),ji=ki+` `+$r.toLowerCase(),Mi=`Konqueror`,K=`(\\d+(\\.\\d+)?)`,Ni=RegExp(`Version/`+K),Pi=new RegExp(Si,`i`),Fi=RegExp(xi+` \\w+`,`i`),Ii=RegExp(bi+` \\w+`,`i`),Li=RegExp(ai+`|PlayBook|BB10`,`i`),Ri={"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`},zi=(e,t)=>t&&M(t,ni)||function(e){return M(e,ii)&&!M(e,li)&&!M(e,Qr)}(e),Bi=function(e,t){return t||=``,M(e,` OPR/`)&&M(e,`Mini`)?hi:M(e,` OPR/`)?mi:Li.test(e)?ai:M(e,`IE`+G)||M(e,`WPDesktop`)?pi:M(e,si)?ci:M(e,gi)||M(e,`Edg/`)?_i:M(e,`FBIOS`)?`Facebook `+G:M(e,`UCWEB`)||M(e,`UCBrowser`)?`UC Browser`:M(e,`CriOS`)?di:M(e,`CrMo`)||M(e,li)?li:M(e,Qr)&&M(e,ii)?Ci:M(e,`FxiOS`)?yi:M(e.toLowerCase(),Mi.toLowerCase())?Mi:zi(e,t)?M(e,G)?wi:ii:M(e,vi)?vi:M(e,`MSIE`)||M(e,`Trident/`)?fi:M(e,`Gecko`)?vi:``},Vi={[pi]:[RegExp(`rv:`+K)],[_i]:[RegExp(gi+`?\\/`+K)],[li]:[RegExp(`(`+li+`|CrMo)\\/`+K)],[di]:[RegExp(`CriOS\\/`+K)],"UC Browser":[RegExp(`(UCBrowser|UCWEB)\\/`+K)],[ii]:[Ni],[wi]:[Ni],[mi]:[RegExp(`(Opera|OPR)\\/`+K)],[vi]:[RegExp(vi+`\\/`+K)],[yi]:[RegExp(`FxiOS\\/`+K)],[Mi]:[RegExp(`Konqueror[:/]?`+K,`i`)],[ai]:[RegExp(ai+` `+K),Ni],[Ci]:[RegExp(`android\\s`+K,`i`)],[ci]:[RegExp(si+`\\/`+K)],[fi]:[RegExp(`(rv:|MSIE )`+K)],Mozilla:[RegExp(`rv:`+K)]},Hi=function(e,t){var n=Vi[Bi(e,t)];if(F(n))return null;for(var r=0;r<n.length;r++){var i=n[r],a=e.match(i);if(a)return parseFloat(a[a.length-2])}return null},Ui=[[RegExp(Si+`; `+Si+` (.*?)[);]`,`i`),e=>[Si,e&&e[1]||``]],[new RegExp(bi,`i`),[bi,``]],[new RegExp(xi,`i`),[xi,``]],[Li,[ai,``]],[new RegExp(Ti,`i`),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Ei,``];if(new RegExp(G).test(t)&&!/IEMobile\b/.test(t))return[Ti+` `+G,``];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var r=Ri[n[1]]||``;return/arm/i.test(t)&&(r=`RT`),[Ti,r]}return[Ti,``]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[Zr,[e[3],e[4],e[5]||`0`].join(`.`)]:[Zr,``]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t=``;return e&&e.length>=3&&(t=F(e[2])?e[3]:e[2]),[`watchOS`,t]}],[RegExp(`(`+Qr+` (\\d+)\\.(\\d+)\\.?(\\d+)?|`+Qr+`)`,`i`),e=>e&&e[2]?[Qr,[e[2],e[3],e[4]||`0`].join(`.`)]:[Qr,``]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var 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/,[ui,``]],[/Linux|debian/i,[`Linux`,``]]],Wi=function(e){return Ii.test(e)?bi:Fi.test(e)?xi:Pi.test(e)?Si:new RegExp(Oi,`i`).test(e)?Oi:RegExp(`(`+Ei+`|WPDesktop)`,`i`).test(e)?Ei:/iPad/.test(e)?ti:/iPod/.test(e)?`iPod Touch`:/iPhone/.test(e)?`iPhone`:/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?ri:Li.test(e)?ai:/(kobo)\s(ereader|touch)/i.test(e)?`Kobo`:new RegExp(Di,`i`).test(e)?Di:/(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(G).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)?Qr:ei:Qr:RegExp(`(pda|`+G+`)`,`i`).test(e)?Ai:new RegExp($r,`i`).test(e)&&!RegExp($r+` pc`,`i`).test(e)?ji:``},Gi=`https?://(.*)`,Ki=[`gclid`,`gclsrc`,`dclid`,`gbraid`,`wbraid`,`fbclid`,`msclkid`,`twclid`,`li_fat_id`,`igshid`,`ttclid`,`rdt_cid`,`epik`,`qclid`,`sccid`,`irclid`,`_kx`],qi=Ot([`utm_source`,`utm_medium`,`utm_campaign`,`utm_content`,`utm_term`,`gad_source`,`mc_cid`],Ki),Ji=`<masked>`,Yi=[`li_fat_id`];function Xi(e,t,n){if(!O)return{};var r,i=t?Ot([],Ki,n||[]):[],a=Zi(rr(O.URL,i,Ji),e);return V((r={},B(Yi,(function(e){var t=Sr.q(e);r[e]=t||null})),r),a)}function Zi(e,t){var n=qi.concat(t||[]),r={};return B(n,(function(t){r[t]=nr(e,t)||null})),r}function Qi(e){var t=function(e){return e?e.search(Gi+`google.([^/?]*)`)===0?`google`:e.search(Gi+`bing.com`)===0?`bing`:e.search(Gi+`yahoo.com`)===0?`yaho
2o`:e.search(Gi+`duckduckgo.com`)===0?`duckduckgo`:null:null}(e),n=t==`yahoo`?`p`:`q`,r={};if(!Pe(t)){r.$search_engine=t;var i=O?nr(O.referrer,n):``;i.length&&(r.ph_keyword=i)}return r}function $i(){return navigator.language||navigator.userLanguage}function ea(){return O?.referrer||`$direct`}function ta(e,t){var n=e?Ot([],Ki,t||[]):[],r=me?.href.substring(0,1e3);return{r:ea().substring(0,1e3),u:r?rr(r,n,Ji):void 0}}function na(e){var{r:t,u:n}=e,r={$referrer:t,$referring_domain:t==null?void 0:t==`$direct`?`$direct`:er(t)?.host};if(n){r.$current_url=n;var i=er(n);r.$host=i?.host,r.$pathname=i?.pathname,V(r,Zi(n))}return t&&V(r,Qi(t)),r}function ra(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function ia(){try{return new Date().getTimezoneOffset()}catch{return}}function aa(e,t){if(!k)return{};var n,r,i,a=e?Ot([],Ki,t||[]):[],[o,s]=function(e){for(var t=0;t<Ui.length;t++){var[n,r]=Ui[t],i=n.exec(e),a=i&&(je(r)?r(i,e):r);if(a)return a}return[``,``]}(k);return V(Mt({$os:o,$os_version:s,$browser:Bi(k,navigator.vendor),$device:Wi(k),$device_type:(r=k,i=Wi(r),i===ti||i===ei||i===`Kobo`||i===`Kindle Fire`||i===ji?$r:i===bi||i===Si||i===xi||i===Oi?`Console`:i===ri?`Wearable`:i?G:`Desktop`),$timezone:ra(),$timezone_offset:ia()}),{$current_url:rr(me?.href,a,Ji),$host:me?.host,$pathname:me?.pathname,$raw_user_agent:k.length>1e3?k.substring(0,997)+`...`:k,$browser_version:Hi(k,navigator.vendor),$browser_language:$i(),$browser_language_prefix:(n=$i(),typeof n==`string`?n.split(`-`)[0]:void 0),$screen_height:T?.screen.height,$screen_width:T?.screen.width,$viewport_height:T?.innerHeight,$viewport_width:T?.innerWidth,$lib:`web`,$lib_version:ve.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var oa=z(`[Web Vitals]`),sa=9e5,ca=class{constructor(e){var t;this.St=!1,this.P=!1,this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.$t=()=>{clearTimeout(this.kt),this.N.metrics.length!==0&&(this._instance.capture(`$web_vitals`,this.N.metrics.reduce(((e,t)=>j({},e,{[`$web_vitals_`+t.name+`_event`]:j({},t),[`$web_vitals_`+t.name+`_value`]:t.value})),{})),this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Pt=e=>{var t=this._instance.sessionManager?.checkAndGetSessionAndWindowId(!0);if(F(t))oa.error(`Could not read session ID. Dropping metrics!`);else{this.N=this.N||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var n=this.Tt();F(n)||(L(e?.name)||L(e?.value)?oa.error(`Invalid metric received`,e):this.Rt&&e.value>=this.Rt?oa.error(`Ignoring metric with value >= `+this.Rt,e):(this.N.url!==n&&(this.$t(),this.kt=setTimeout(this.$t,this.flushToCaptureTimeoutMs)),F(this.N.url)&&(this.N.url=n),this.N.firstMetricTimestamp=F(this.N.firstMetricTimestamp)?Date.now():this.N.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0),this.N.metrics.push(j({},e,{$current_url:n,$session_id:t.sessionId,$window_id:t.windowId,timestamp:Date.now()})),this.N.metrics.length===this.allowedMetrics.length&&this.$t()))}},this.rt=()=>{var e,t,n,r,i=A.__PosthogExtensions__;F(i)||F(i.postHogWebVitalsCallbacks)||({onLCP:e,onCLS:t,onFCP:n,onINP:r}=i.postHogWebVitalsCallbacks),e&&t&&n&&r?(this.allowedMetrics.indexOf(`LCP`)>-1&&e(this.Pt.bind(this)),this.allowedMetrics.indexOf(`CLS`)>-1&&t(this.Pt.bind(this)),this.allowedMetrics.indexOf(`FCP`)>-1&&n(this.Pt.bind(this)),this.allowedMetrics.indexOf(`INP`)>-1&&r(this.Pt.bind(this)),this.P=!0):oa.error(`web vitals callbacks not loaded - not starting`)},this._instance=e,this.St=!((t=this._instance.persistence)==null||!t.props[Gt]),this.startIfEnabled()}get allowedMetrics(){var e=P(this._instance.config.capture_performance)?this._instance.config.capture_performance?.web_vitals_allowed_metrics:void 0;return F(e)?this._instance.persistence?.props[qt]||[`CLS`,`FCP`,`INP`,`LCP`]:e}get flushToCaptureTimeoutMs(){return(P(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get Rt(){var e=P(this._instance.config.capture_performance)&&Fe(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:sa;return 0<e&&e<=6e4?sa:e}get isEnabled(){var e=me?.protocol;if(e!==`http:`&&e!==`https:`)return oa.info(`Web Vitals are disabled on non-http/https protocols`),!1;var t=P(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:Ie(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return Ie(t)?t:this.St}startIfEnabled(){this.isEnabled&&!this.P&&(oa.info(`enabled, starting...`),this.it(this.rt))}onRemoteConfig(e){var t=P(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=P(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Gt]:t}),this._instance.persistence.register({[qt]:n})),this.St=t,this.startIfEnabled()}it(e){var t,n;(t=A.__PosthogExtensions__)!=null&&t.postHogWebVitalsCallbacks&&e(),(n=A.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,`web-vitals`,(t=>{t?oa.error(`failed to load script`,t):e()}))}Tt(){var e=T?T.location.href:void 0;if(e){var t=this._instance.config.mask_personal_data_properties,n=this._instance.config.custom_personal_data_properties;return rr(e,t?Ot([],Ki,n||[]):[],Ji)}
vendor: 11,225 bytes, lines 2-4
2oa.error(`Could not determine current URL`)}},la=z(`[Heatmaps]`);function ua(e){return P(e)&&`clientX`in e&&`clientY`in e&&Fe(e.clientX)&&Fe(e.clientY)}var da=class{constructor(e){var t;this.St=!1,this.P=!1,this.Ct=null,this.instance=e,this.St=!((t=this.instance.persistence)==null||!t.props[Vt]),this.rageclicks=new Zn(e.config.rageclick)}get flushIntervalMilliseconds(){var e=5e3;return P(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(e=this.instance.config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return F(this.instance.config.capture_heatmaps)?F(this.instance.config.enable_heatmaps)?this.St:this.instance.config.enable_heatmaps:!1!==this.instance.config.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.P)return;la.info(`starting...`),this.It(),this.Ft()}else clearInterval(this.Ct??void 0),this.Mt(),this.getAndClearBuffer()}onRemoteConfig(e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Vt]:t}),this.St=t,this.startIfEnabled()}getAndClearBuffer(){var e=this.N;return this.N=void 0,e}Ot(e){this.At(e.originalEvent,`deadclick`)}Ft(){this.Ct&&clearInterval(this.Ct),this.Ct=function(e){return e?.visibilityState===`visible`}(O)?setInterval(this.Dt.bind(this),this.flushIntervalMilliseconds):null}It(){T&&O&&(this.jt=this.Dt.bind(this),H(T,`beforeunload`,this.jt),this.Lt=e=>this.At(e||T?.event),H(O,`click`,this.Lt,{capture:!0}),this.Nt=e=>this.Ut(e||T?.event),H(O,`mousemove`,this.Nt,{capture:!0}),this.zt=new Pr(this.instance,Mr,this.Ot.bind(this)),this.zt.startIfEnabled(),this.Ht=this.Ft.bind(this),H(O,`visibilitychange`,this.Ht),this.P=!0)}Mt(){var e;T&&O&&(this.jt&&T.removeEventListener(`beforeunload`,this.jt),this.Lt&&O.removeEventListener(`click`,this.Lt,{capture:!0}),this.Nt&&O.removeEventListener(`mousemove`,this.Nt,{capture:!0}),this.Ht&&O.removeEventListener(`visibilitychange`,this.Ht),clearTimeout(this.Bt),(e=this.zt)==null||e.stop(),this.P=!1)}qt(e,t){var n=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),i=this.instance.scrollManager.scrollElement(),a=function(e,t,n){for(var r=e;r&&_n(r)&&!vn(r,`body`);){if(r===n)return!1;if(M(t,T?.getComputedStyle(r).position))return!0;r=kn(r)}return!1}(En(e),[`fixed`,`sticky`],i);return{x:e.clientX+(a?0:r),y:e.clientY+(a?0:n),target_fixed:a,type:t}}At(e,t){var n;if(t===void 0&&(t=`click`),!gn(e.target)&&ua(e)){var r=this.qt(e,t);(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this.Wt(j({},r,{type:`rageclick`})),this.Wt(r)}}Ut(e){!gn(e.target)&&ua(e)&&(clearTimeout(this.Bt),this.Bt=setTimeout((()=>{this.Wt(this.qt(e,`mousemove`))}),500))}Wt(e){if(T){var t=T.location.href,n=this.instance.config.mask_personal_data_properties,r=this.instance.config.custom_personal_data_properties,i=rr(t,n?Ot([],Ki,r||[]):[],Ji);this.N=this.N||{},this.N[i]||(this.N[i]=[]),this.N[i].push(e)}}Dt(){this.N&&!Me(this.N)&&this.instance.capture(`$$heatmap`,{$heatmap_data:this.getAndClearBuffer()})}},fa=class{constructor(e){this._instance=e}doPageView(e,t){var n=this.Gt(e,t);return this.Vt={pathname:T?.location.pathname??``,pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),n}doPageLeave(e){return this.Gt(e,this.Vt?.pageViewId)}doEvent(){return{$pageview_id:this.Vt?.pageViewId}}Gt(e,t){var n=this.Vt;if(!n)return{$pageview_id:t};var r={$pageview_id:t,$prev_pageview_id:n.pageViewId},i=this._instance.scrollManager.getContext();if(i&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:a,lastScrollY:o,maxScrollY:s,maxContentHeight:c,lastContentY:l,maxContentY:u}=i;if(!(F(a)||F(o)||F(s)||F(c)||F(l)||F(u))){a=Math.ceil(a),o=Math.ceil(o),s=Math.ceil(s),c=Math.ceil(c),l=Math.ceil(l),u=Math.ceil(u);var d=a<=1?1:Ge(o/a,0,1,R),f=a<=1?1:Ge(s/a,0,1,R),p=c<=1?1:Ge(l/c,0,1,R),m=c<=1?1:Ge(u/c,0,1,R);r=V(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:s,$prev_pageview_max_scroll_percentage:f,$prev_pageview_last_content:l,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:m})}}return n.pathname&&(r.$prev_pageview_pathname=n.pathname),n.timestamp&&(r.$prev_pageview_duration=(e.getTime()-n.timestamp.getTime())/1e3),r}},q=Uint8Array,J=Uint16Array,pa=Uint32Array,ma=new q([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]),ha=new q([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]),ga=new q([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),_a=function(e,t){for(var n=new J(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var i=new pa(n[30]);for(r=1;r<30;++r)for(var a=n[r];a<n[r+1];++a)i[a]=a-n[r]<<5|r;return[n,i]},va=_a(ma,2),ya=va[0],ba=va[1];ya[28]=258,ba[258]=28;for(var xa=_a(ha,0)[1],Sa=new J(32768),Y=0;Y<32768;++Y){var Ca=(43690&Y)>>>1|(21845&Y)<<1;Ca=(61680&(Ca=(52428&Ca)>>>2|(13107&Ca)<<2))>>>4|(3855&Ca)<<4,Sa[Y]=((65280&Ca)>>>8|(255&Ca)<<8)>>>1}var wa=function(e,t,n){for(var r=e.length,i=0,a=new J(t);i<r;++i)++a[e[i]-1];var o,s=new J(t);for(i=0;i<t;++i)s[i]=s[i-1]+a[i-1]<<1;if(n){o=new J(1<<t);var c=15-t;for(i=0;i<r;++i)if(e[i])for(var l=i<<4|e[i],u=t-e[i],d=s[e[i]-1]++<<u,f=d|(1<<u)-1;d<=f;++d)o[Sa[d]>>>c]=l}else for(o=new J(r),i=0;i<r;++i)o[i]=Sa[s[e[i]-1]++]>>>15-e[i];return o},Ta=new q(288);for(Y=0;Y<144;++Y)Ta[Y]=8;for(Y=144;Y<256;++Y)Ta[Y]=9;for(Y=256;Y<280;++Y)Ta[Y]=7;for(Y=280;Y<288;++Y)Ta[Y]=8;var Ea=new q(32);for(Y=0;Y<32;++Y)Ea[Y]=5;var Da=wa(Ta,9,0),Oa=wa(Ea,5,0),ka=function(e){return(e/8>>0)+(7&e&&1)},Aa=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var r=new(e instanceof J?J:e instanceof pa?pa:q)(n-t);return r.set(e.subarray(t,n)),r},ja=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8},Ma=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8,e[r+2]|=n>>>16},Na=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,a=n.slice();if(!i)return[new q(0),0];if(i==1){var o=new q(n[0].s+1);return o[n[0].s]=1,[o,1]}n.sort((function(e,t){return e.f-t.f})),n.push({s:-1,f:25001});var s=n[0],c=n[1],l=0,u=1,d=2;for(n[0]={s:-1,f:s.f+c.f,l:s,r:c};u!=i-1;)s=n[n[l].f<n[d].f?l++:d++],c=n[l!=u&&n[l].f<n[d].f?l++:d++],n[u++]={s:-1,f:s.f+c.f,l:s,r:c};var f=a[0].s;for(r=1;r<i;++r)a[r].s>f&&(f=a[r].s);var p=new J(f+1),m=Pa(n[u-1],p,0);if(m>t){r=0;var h=0,g=m-t,_=1<<g;for(a.sort((function(e,t){return p[t.s]-p[e.s]||e.f-t.f}));r<i;++r){var ee=a[r].s;if(!(p[ee]>t))break;h+=_-(1<<m-p[ee]),p[ee]=t}for(h>>>=g;h>0;){var te=a[r].s;p[te]<t?h-=1<<t-p[te]++-1:++r}for(;r>=0&&h;--r){var ne=a[r].s;p[ne]==t&&(--p[ne],++h)}m=t}return[new q(p),m]},Pa=function(e,t,n){return e.s==-1?Math.max(Pa(e.l,t,n+1),Pa(e.r,t,n+1)):t[e.s]=n},Fa=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new J(++t),r=0,i=e[0],a=1,o=function(e){n[r++]=e},s=1;s<=t;++s)if(e[s]==i&&s!=t)++a;else{if(!i&&a>2){for(;a>138;a-=138)o(32754);a>2&&(o(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(o(i),--a;a>6;a-=6)o(8304);a>2&&(o(a-3<<5|8208),a=0)}for(;a--;)o(i);a=1,i=e[s]}return[n.subarray(0,r),t]},Ia=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},La=function(e,t,n){var r=n.length,i=ka(t+2);e[i]=255&r,e[i+1]=r>>>8,e[i+2]=255^e[i],e[i+3]=255^e[i+1];for(var a=0;a<r;++a)e[i+a+4]=n[a];return 8*(i+4+r)},Ra=function(e,t,n,r,i,a,o,s,c,l,u){ja(t,u++,n),++i[256];for(var d=Na(i,15),f=d[0],p=d[1],m=Na(a,15),h=m[0],g=m[1],_=Fa(f),ee=_[0],te=_[1],ne=Fa(h),re=ne[0],ie=ne[1],ae=new J(19),v=0;v<ee.length;++v)ae[31&ee[v]]++;for(v=0;v<re.length;++v)ae[31&re[v]]++;for(var oe=Na(ae,7),y=oe[0],se=oe[1],b=19;b>4&&!y[ga[b-1]];--b);var ce,x,S,le,C=l+5<<3,w=Ia(i,Ta)+Ia(a,Ea)+o,ue=Ia(i,f)+Ia(a,h)+o+14+3*b+Ia(ae,y)+(2*ae[16]+3*ae[17]+7*ae[18]);if(C<=w&&C<=ue)return La(t,u,e.subarray(c,c+l));if(ja(t,u,1+(ue<w)),u+=2,ue<w){ce=wa(f,p,0),x=f,S=wa(h,g,0),le=h;var T=wa(y,se,0);for(ja(t,u,te-257),ja(t,u+5,ie-1),ja(t,u+10,b-4),u+=14,v=0;v<b;++v)ja(t,u+3*v,y[ga[v]]);u+=3*b;for(var E=[ee,re],de=0;de<2;++de){var fe=E[de];for(v=0;v<fe.length;++v){var pe=31&fe[v];ja(t,u,T[pe]),u+=y[pe],pe>15&&(ja(t,u,fe[v]>>>5&127),u+=fe[v]>>>12)}}}else ce=Da,x=Ta,S=Oa,le=Ea;for(v=0;v<s;++v)if(r[v]>255){pe=r[v]>>>18&31,Ma(t,u,ce[pe+257]),u+=x[pe+257],pe>7&&(ja(t,u,r[v]>>>23&31),u+=ma[pe]);var D=31&r[v];Ma(t,u,S[D]),u+=le[D],D>3&&(Ma(t,u,r[v]>>>5&8191),u+=ha[D])}else Ma(t,u,ce[r[v]]),u+=x[r[v]];return Ma(t,u,ce[256]),u+x[256]},za=new pa([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Ba=function(){for(var e=new pa(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),Va=function(e,t,n,r,i){return function(e,t,n,r,i,a){var o=e.length,s=new q(r+o+5*(1+Math.floor(o/7e3))+i),c=s.subarray(r,s.length-i),l=0;if(!t||o<8)for(var u=0;u<=o;u+=65535){var d=u+65535;d<o?l=La(c,l,e.subarray(u,d)):(c[u]=a,l=La(c,l,e.subarray(u,o)))}else{for(var f=za[t-1],p=f>>>13,m=8191&f,h=(1<<n)-1,g=new J(32768),_=new J(h+1),ee=Math.ceil(n/3),te=2*ee,ne=function(t){return(e[t]^e[t+1]<<ee^e[t+2]<<te)&h},re=new pa(25e3),ie=new J(288),ae=new J(32),v=0,oe=0,y=(u=0,0),se=0,b=0;u<o;++u){var ce=ne(u),x=32767&u,S=_[ce];if(g[x]=S,_[ce]=x,se<=u){var le=o-u;if((v>7e3||y>24576)&&le>423){l=Ra(e,c,0,re,ie,ae,oe,y,b,u-b,l),y=v=oe=0,b=u;for(var C=0;C<286;++C)ie[C]=0;for(C=0;C<30;++C)ae[C]=0}var w=2,ue=0,T=m,E=x-S&32767;if(le>2&&ce==ne(u-E))for(var de=Math.min(p,le)-1,fe=Math.min(32767,u),pe=Math.min(258,le);E<=fe&&--T&&x!=S;){if(e[u+w]==e[u+w-E]){for(var D=0;D<pe&&e[u+D]==e[u+D-E];++D);if(D>w){if(w=D,ue=E,D>de)break;var O=Math.min(E,D-2),me=0;for(C=0;C<O;++C){var he=u-E+C+32768&32767,ge=he-g[he]+32768&32767;ge>me&&(me=ge,S=he)}}}E+=(x=S)-(S=g[x])+32768&32767}if(ue){re[y++]=268435456|ba[w]<<18|xa[ue];var _e=31&ba[w],k=31&xa[ue];oe+=ma[_e]+ha[k],++ie[257+_e],++ae[k],se=u+w,++v}else re[y++]=e[u],++ie[e[u]]}}l=Ra(e,c,a,re,ie,ae,oe,y,b,u-b,l)}return Aa(s,0,r+ka(l)+i)}(e,t.level==null?6:t.level,t.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,n,r,!0)},Ha=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function Ua(e,t){t===void 0&&(t={});var n=function(){var e=4294967295;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=Ba[255&n^t[r]]^n>>>8;e=n},d:function(){return 4294967295^e}}}(),r=e.length;n.p(e);var i,a=Va(e,t,10+((i=t).filename&&i.filename.length+1||0),8),o=a.length;return function(e,t){var n=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:t.level==9?2:0,e[9]=3,t.mtime!=0&&Ha(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var r=0;r<=n.length;++r)e[r+10]=n.charCodeAt(r)}}(a,t),Ha(a,o-8,n.d()),Ha(a,o-4,r),a}var Wa=function(e){var t,n,r,i,a=``;for(t=n=0,r=(e=(e+``).replace(/\r\n/g,` 3`).replace(/\r/g,` 4`)).length,i=0;i<r;i++){var o=e.charCodeAt(i),s=null;o<128?n++:s=o>127&&o<2048?String.fromCharCode(o>>6|192,63&o|128):String.fromCharCode(o>>12|224,o>>6&63|128,63&o|128),Pe(s)||(n>t&&(a+=e.substring(t,n)),a+=s,t=n=i+1)}return n>t&&(a+=e.substring(t,e.length)),a},Ga=!!ge||!!he,Ka=`text/plain`,qa=function(e,t,n){n===void 0&&(n=!0);var[r,i]=e.split(`?`),a=j({},t),o=i?.split(`&`).map((e=>{var t,[r,i]=e.split(`=`),o=n&&(t=a[r])!=null?t:i;return delete a[r],r+`=`+o}))??[],s=tr(a);return s&&o.push(s),r+`?`+o.join(`&`)},Ja=(e,t)=>JSON.stringify(e,((e,t)=>
4typeof t==`bigint`?t.toString():t),t),Ya=e=>{var{data:t,compression:n}=e;if(t){if(n===$n.GZipJS){var r=Ua(function(e,t){var n=e.length;if(typeof TextEncoder<`u`)return new TextEncoder().encode(e);for(var r=new q(e.length+(e.length>>>1)),i=0,a=function(e){r[i++]=e},o=0;o<n;++o){if(i+5>r.length){var s=new q(i+8+(n-o<<1));s.set(r),r=s}var c=e.charCodeAt(o);c<128||t?a(c):c<2048?(a(192|c>>>6),a(128|63&c)):c>55295&&c<57344?(a(240|(c=65536+(1047552&c)|1023&e.charCodeAt(++o))>>>18),a(128|c>>>12&63),a(128|c>>>6&63),a(128|63&c)):(a(224|c>>>12),a(128|c>>>6&63),a(128|63&c))}return Aa(r,0,i)}(Ja(t)),{mtime:0}),i=new Blob([r],{type:Ka});return{contentType:Ka,body:i,estimatedSize:i.size}}if(n===$n.Base64){var a=(e=>`data=`+encodeURIComponent(typeof e==`string`?e:Ja(e)))(function(e){var t,n,r,i,a,o=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=`,s=0,c=0,l=``,u=[];if(!e)return e;e=Wa(e);do t=(a=e.charCodeAt(s++)<<16|e.charCodeAt(s++)<<8|e.charCodeAt(s++))>>18&63,n=a>>12&63,r=a>>6&63,i=63&a,u[c++]=o.charAt(t)+o.charAt(n)+o.charAt(r)+o.charAt(i);while(s<e.length);switch(l=u.join(``),e.length%3){case 1:l=l.slice(0,-2)+`==`;break;case 2:l=l.slice(0,-1)+`=`}return l}(Ja(t)));return{contentType:`application/x-www-form-urlencoded`,body:a,estimatedSize:new Blob([a]).size}}var o=Ja(t);return{contentType:`application/json`,body:o,estimatedSize:new Blob([o]).size}}},Xa=[];he&&Xa.push({transport:`fetch`,method:e=>{var{contentType:t,body:n,estimatedSize:r}=Ya(e)??{},i=new Headers;B(e.headers,(function(e,t){i.append(t,e)})),t&&i.append(`Content-Type`,t);var a=e.url,o=null;if(_e){var s=new _e;o={signal:s.signal,timeout:setTimeout((()=>s.abort()),e.timeout)}}he(a,j({method:e?.method||`GET`,headers:i,keepalive:e.method===`POST`&&(r||0)<52428.8,body:n,signal:o?.signal},e.fetchOptions)).then((t=>t.text().then((n=>{var r={statusCode:t.status,text:n};if(t.status===200)try{r.json=JSON.parse(n)}catch(e){R.error(e)}e.callback==null||e.callback(r)})))).catch((t=>{R.error(t),e.callback==null||e.callback({statusCode:0,text:t})})).finally((()=>o?clearTimeout(o.timeout):null))}}),ge&&Xa.push({transport:`XHR`,method:e=>{var t=new ge;t.open(e.method||`GET`,e.url,!0);var{contentType:n,body:r}=Ya(e)??{};B(e.headers,(function(e,n){t.setRequestHeader(n,e)})),n&&t.setRequestHeader(`Content-Type`,n),e.timeout&&(t.timeout=e.timeout),e.disableXHRCredentials||(t.withCredentials=!0),t.onreadystatechange=()=>{if(t.readyState===4){var n={statusCode:t.status,text:t.responseText};if(t.status===200)try{n.json=JSON.parse(t.responseText)}catch{}e.callback==null||e.callback(n)}},t.send(r)}}),D!=null&&D.sendBeacon&&Xa.push({transport:`sendBeacon`,method:e=>{var t=qa(e.url,{beacon:`1`});try{var{contentType:n,body:r}=Ya(e)??{},i=typeof r==`string`?new Blob([r],{type:n}):r;D.sendBeacon(t,i)}catch{}}});var Za=function(e,t){if(!function(e){try{new RegExp(e)}catch{return!1}return!0}(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}};function Qa(e,t,n){return Ja({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}var $a={exact:(e,t)=>t.some((t=>e.some((e=>t===e)))),is_not:(e,t)=>t.every((t=>e.every((e=>t!==e)))),regex:(e,t)=>t.some((t=>e.some((e=>Za(t,e))))),not_regex:(e,t)=>t.every((t=>e.every((e=>!Za(t,e))))),icontains:(e,t)=>t.map(eo).some((t=>e.map(eo).some((e=>t.includes(e))))),not_icontains:(e,t)=>t.map(eo).every((t=>e.map(eo).every((e=>!t.includes(e)))))},eo=e=>e.toLowerCase();function to(e,t){return!e||Object.entries(e).every((e=>{var[n,r]=e,i=t?.[n];if(F(i)||Pe(i))return!1;var a=[String(i)],o=$a[r.operator];return!!o&&o(r.values,a)}))}var no=z(`[Error tracking]`),ro=class{constructor(e){this.Jt=[],this.Kt=new Qe([new ft,new St,new mt,new pt,new bt,new yt,new gt,new xt],dt(`web:javascript`,at,ct)),this._instance=e,this.Jt=this._instance.persistence?.get_property(Ut)??[]}onRemoteConfig(e){var t=e.errorTracking?.suppressionRules??[],n=e.errorTracking?.captureExtensionExceptions;this.Jt=t,this._instance.persistence&&this._instance.persistence.register({[Ut]:this.Jt,[Wt]:n})}get Yt(){var e,t=!!this._instance.get_property(Wt);return(e=this._instance.config.error_tracking.captureExtensionExceptions??t)!=null&&e}buildProperties(e,t){return this.Kt.buildFromUnknown(e,{syntheticException:t?.syntheticException,mechanism:{handled:t?.handled}})}sendExceptionEvent(e){var t=e.$exception_list;if(this.Xt(t)){if(this.Qt(t))return void no.info(`Skipping exception capture because a suppression rule matched`);if(!this.Yt&&this.Zt(t))return void no.info(`Skipping exception capture because it was thrown by an extension`);if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ti(t))return void no.info(`Skipping exception capture because it was thrown by the PostHog SDK`)}return this._instance.capture(`$exception`,e,{_noTruncate:!0,_batchKey:`exceptionEvent`})}Qt(e){if(e.length===0)return!1;var t=e.reduce(((e,t)=>{var{type:n,value:r}=t;return I(n)&&n.length>0&&e.$exception_types.push(n),I(r)&&r.length>0&&e.$exception_values.push(r),e}),{$exception_types:[],$exception_values:[]});return this.Jt.some((e=>{var n=e.values.map((e=>{var n=$a[e.operator],r=N(e.value)?e.value:[e.value],i=t[e.key]??[];return r.length>0&&n(r,i)}));return e.type===`OR`?n.some(Boolean):n.every(Boolean)}))}Zt(e){return e.flatMap((e=>e.stacktrace?.frames??[])).some((e=>e.filename&&e.filename.startsWith(`chrome-extension://`)))}ti(e){if(e.length>0){var t,n,r=e[0].stacktrace?.frames??[],i=r[r.length-1];return(t=i==null||(n=i.filename)==null?void 0:n.includes(`posthog.com/static`))!=null&&t}return!1}Xt(e){return!L(e)&&N(e)}},io=z(`[FeatureFlags]`),ao=z(`[FeatureFlags]`,{debugEnabled:!0}),oo=`$active_feature_flags`,so=`$override_feature_flags`,co=`$feature_flag_payloads`,lo=`$override_feature_flag_payloads`,uo=`$feature_flag_request_id`,fo=`$feature_flag_evaluated_at`,po=e=>{var t={};for(var[n,r]of kt(e||{}))r&&(t[n]=r);return t},mo=e=>{var t=e.flags;return t?(e.featureFlags=Object.fromEntries(Object.keys(t).map((e=>[e,t[e].variant??t[e].enabled]))),e.featureFlagPayloads=Object.fromEntries(Object.keys(t).filter((e=>t[e].enabled)).filter((e=>t[e].metadata?.payload)).map((e=>[e,t[e].metadata?.payload])))):io.warn(`Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version`),e},ho=function(e){return e.FeatureFlags=`feature_flags`,e.Recordings=`recordings`,e}({}),go=class{constructor(e){this.ii=!1,this.ei=!1,this.ri=!1,this.si=!1,this.ni=!1,this.oi=!1,this.ai=!1,this._instance=e,this.featureFlagEventHandlers=[]}li(){var e=this._instance.config.evaluation_environments;return e!=null&&e.length?e.filter((e=>{var t=e&&typeof e==`string`&&e.trim().length>0;return t||io.error(`Invalid evaluation environment found:`,e,`Expected non-empty string`),t})):[]}ui(){return this.li().length>0}flags(){if(this._instance.config.__preview_remote_config)this.oi=!0;else{var e=!this.hi&&(this._instance.config.advanced_disable_feature_flags||this._instance.config.advanced_disable_feature_flags_on_first_load);this.di({disableFlags:e})}}get hasLoadedFlags(){return this.ei}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._instance.get_property($t),t=this._instance.get_property(so),n=this._instance.get_property(lo);if(!n&&!t)return e||{};var r=V({},e||{});for(var i of[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])]){var a,o,s=r[i],c=t?.[i],l=F(c)?(a=s?.enabled)!=null&&a:!!c,u=F(c)?s.variant:typeof c==`string`?c:void 0,d=n?.[i],f=j({},s,{enabled:l,variant:l?u??s?.variant:void 0});l!==s?.enabled&&(f.original_enabled=s?.enabled),u!==s?.variant&&(f.original_variant=s?.variant),d&&(f.metadata=j({},s?.metadata,{payload:d,original_payload:s==null||(o=s.metadata)==null?void 0:o.payload})),r[i]=f}return this.ii||=(io.warn(` Overriding feature flag details!`,{flagDetails:e,overriddenPayloads:n,finalDetails:r}),!0),r}getFlagVariants(){var e=this._instance.get_property(Zt),t=this._instance.get_property(so);if(!t)return e||{};for(var n=V({},e),r=Object.keys(t),i=0;i<r.length;i++)n[r[i]]=t[r[i]];return this.ii||=(io.warn(` Overriding feature flags!`,{enabledFlags:e,overriddenFlags:t,finalFlags:n}),!0),n}getFlagPayloads(){var e=this._instance.get_property(co),t=this._instance.get_property(lo);if(!t)return e||{};for(var n=V({},e||{}),r=Object.keys(t),i=0;i<r.length;i++)n[r[i]]=t[r[i]];return this.ii||=(io.warn(` Overriding feature flag payloads!`,{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),!0),n}reloadFeatureFlags(){this.si||this._instance.config.advanced_disable_feature_flags||this.hi||(this.hi=setTimeout((()=>{this.di()}),5))}vi(){clearTimeout(this.hi),this.hi=void 0}ensureFlagsLoaded(){this.ei||this.ri||this.hi||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.si=e}di(e){if(this.vi(),!this._instance.O())if(this.ri)this.ni=!0;else{var t={token:this._instance.config.token,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:j({},this._instance.persistence?.get_initial_props()||{},this._instance.get_property(en)||{}),group_properties:this._instance.get_property(tn)};(e!=null&&e.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(t.disable_flags=!0),this.ui()&&(t.evaluation_environments=this.li());var n=this._instance.config.__preview_remote_config,r=n?`/flags/?v=2`:`/flags/?v=2&config=true`,i=this._instance.config.advanced_only_evaluate_survey_feature_flags?`&only_evaluate_survey_feature_flags=true`:``,a=this._instance.requestRouter.endpointFor(`flags`,r+i);n&&(t.timezone=ra()),this.ri=!0,this._instance.ci({method:`POST`,url:a,data:t,compression:this._instance.config.disable_compression?void 0:$n.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:e=>{var n,r=!0;(e.statusCode===200&&(this.ni||(this.$anon_distinct_id=void 0),r=!1),this.ri=!1,this.oi)||(this.oi=!0,this._instance.fi(e.json??{})),(!t.disable_flags||this.ni)&&(this.ai=!r,e.json&&(n=e.json.quotaLimited)!=null&&n.includes(ho.FeatureFlags)?io.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.`):(t.disable_flags||this.receivedFeatureFlags(e.json??{},r),this.ni&&(this.ni=!1,this.di())))}})}}getFeatureFlag(e,t){if(t===void 0&&(t={}),this.ei||this.getFlags()&&this.getFlags().length>0){var n=this.getFlagVariants()[e],r=``+n,i=this._instance.get_property(uo)||void 0,a=this._instance.get_property(fo)||void 0,o=this._instance.get_property(an)||{};if((t.send_event||!(`send_event`in t))&&(!(e in o)||!o[e].includes(r))){var s,c,l,u,d,f,p,m;N(o[e])?o[e].push(r):o[e]=[r],(s=this._instance.persistence)==null||s.register({[an]:o});var h=this.getFeatureFlagDetails(e),g={$feature_flag:e,$feature_flag_response:n,$feature_flag_payload:this.getFeatureFlagPayload(e)||null,$feature_flag_request_id:i,$feature_flag_evaluated_at:a,$feature_flag_bootstrapped_response:((c=this._instance.config.bootstrap)==null||(c=c.featureFlags)==null?void 0:c[e])||null,$feature_flag_bootstrapped_payload:((l=this._instance.config.bootstrap)==null||(l=l.featureFlagPayloads)==null?void 0:l[e])||null,$used_bootstrap_value:!this.ai};F(h==null||(u=h.metadata)==null?void 0:u.version)||(g.$feature_flag_version=h.metadata.version);var _,ee=(h==null||(d=h.reason)==null?void 0:d.description)??(h==null||(f=h.reason)==null?void 0:f.code);ee&&(g.$feature_flag_reason=ee),h!=null&&(p=h.metadata)!=null&&p.id&&(g.$feature_flag_id=h.metadata.id),F(h?.original_variant)&&F(h?.original_enabled)||(g.$feature_flag_original_response=F(h.original_variant)?h.original_enabled:h.original_variant),h!=null&&(m=h.metadata)!=null&&m.original_payload&&(g.$feature_flag_original_payload=h==null||(_=h.metadata)==null?void 0:_.original_payload),this._instance.capture(`$feature_flag_called`,g)}return n}io.warn(`getFeatureFlag for key "`+e+`" failed. Feature flags didn't load in time.`)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){return this.getFlagPayloads()[e]}getRemoteConfigPayload(e,t){var n=this._instance.config.token,r={distinct_id:this._instance.get_distinct_id(),token:n};this.ui()&&(r.evaluation_environments=this.li()),this._instance.ci({method:`POST`,url:this._instance.requestRouter.endpointFor(`flags`,`/flags/?v=2&config=true`),data:r,compression:this._instance.config.disable_compression?void 0:$n.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:n=>{var r=n.json?.featureFlagPayloads;t(r?.[e]||void 0)}})}isFeatureEnabled(e,t){if(t===void 0&&(t={}),this.ei||this.getFlags()&&this.getFlags().length>0){var n=this.getFeatureFlag(e,t);return F(n)?void 0:!!n}
4io.warn(`isFeatureEnabled for key "`+e+`" failed. Feature flags didn't load in time.`)}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t){if(this._instance.persistence){this.ei=!0;var n=this.getFlagVariants(),r=this.getFlagPayloads(),i=this.getFlagsWithDetails();(function(e,t,n,r,i){n===void 0&&(n={}),r===void 0&&(r={}),i===void 0&&(i={});var a=mo(e),o=a.flags,s=a.featureFlags,c=a.featureFlagPayloads;if(s){var l=e.requestId,u=e.evaluatedAt;if(N(s)){io.warn(`v1 of the feature flags endpoint is deprecated. Please use the latest version.`);var d={};if(s)for(var f=0;f<s.length;f++)d[s[f]]=!0;t&&t.register({[oo]:s,[Zt]:d})}else{var p=s,m=c,h=o;e.errorsWhileComputingFlags&&(p=j({},n,p),m=j({},r,m),h=j({},i,h)),t&&t.register(j({[oo]:Object.keys(po(p)),[Zt]:p||{},[co]:m||{},[$t]:h||{}},l?{[uo]:l}:{},u?{[fo]:u}:{}))}}})(e,this._instance.persistence,n,r,i),this.pi(t)}}override(e,t){t===void 0&&(t=!1),io.warn(`override is deprecated. Please use overrideFeatureFlags instead.`),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return io.uninitializedWarning(`posthog.featureFlags.overrideFeatureFlags`);if(!1===e)return this._instance.persistence.unregister(so),this._instance.persistence.unregister(lo),this.pi(),ao.info(`All overrides cleared`);if(e&&typeof e==`object`&&(`flags`in e||`payloads`in e)){var t,n=e;if(this.ii=!!((t=n.suppressWarning)!=null&&t),`flags`in n){if(!1===n.flags)this._instance.persistence.unregister(so),ao.info(`Flag overrides cleared`);else if(n.flags){if(N(n.flags)){for(var r={},i=0;i<n.flags.length;i++)r[n.flags[i]]=!0;this._instance.persistence.register({[so]:r})}else this._instance.persistence.register({[so]:n.flags});ao.info(`Flag overrides set`,{flags:n.flags})}}`payloads`in n&&(!1===n.payloads?(this._instance.persistence.unregister(lo),ao.info(`Payload overrides cleared`)):n.payloads&&(this._instance.persistence.register({[lo]:n.payloads}),ao.info(`Payload overrides set`,{payloads:n.payloads}))),this.pi();return}this.pi()}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.ei){var{flags:t,flagVariants:n}=this.gi();e(t,n)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,n){var r,i=(this._instance.get_property(Qt)||[]).find((t=>t.flagKey===e)),a={[`$feature_enrollment/`+e]:t},o={$feature_flag:e,$feature_enrollment:t,$set:a};i&&(o.$early_access_feature_name=i.name),n&&(o.$feature_enrollment_stage=n),this._instance.capture(`$feature_enrollment_update`,o),this.setPersonPropertiesForFlags(a,!1);var s=j({},this.getFlagVariants(),{[e]:t});(r=this._instance.persistence)==null||r.register({[oo]:Object.keys(po(s)),[Zt]:s}),this.pi()}getEarlyAccessFeatures(e,t,n){t===void 0&&(t=!1);var r=this._instance.get_property(Qt),i=n?`&`+n.map((e=>`stage=`+e)).join(`&`):``;if(r&&!t)return e(r);this._instance.ci({url:this._instance.requestRouter.endpointFor(`api`,`/api/early_access_features/?token=`+this._instance.config.token+i),method:`GET`,callback:t=>{var n,r;if(t.json){var i=t.json.earlyAccessFeatures;return(n=this._instance.persistence)==null||n.unregister(Qt),(r=this._instance.persistence)==null||r.register({[Qt]:i}),e(i)}}})}gi(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((e=>t[e])),flagVariants:Object.keys(t).filter((e=>t[e])).reduce(((e,n)=>(e[n]=t[n],e)),{})}}pi(e){var{flags:t,flagVariants:n}=this.gi();this.featureFlagEventHandlers.forEach((r=>r(t,n,{errorsLoading:e})))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this._instance.get_property(en)||{};this._instance.register({[en]:j({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(en)}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this._instance.get_property(tn)||{};Object.keys(n).length!==0&&Object.keys(n).forEach((t=>{n[t]=j({},n[t],e[t]),delete e[t]})),this._instance.register({[tn]:j({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(tn)||{};this._instance.register({[tn]:j({},t,{[e]:{}})})}else this._instance.unregister(tn)}reset(){this.ei=!1,this.ri=!1,this.si=!1,this.ni=!1,this.oi=!1,this.ai=!1,this.$anon_distinct_id=void 0,this.vi(),this.ii=!1}},_o=[`cookie`,`localstorage`,`localstorage+cookie`,`sessionstorage`,`memory`],vo=class{constructor(e,t){this.I=e,this.props={},this.mi=!1,this.yi=(e=>{var t=``;return e.token&&(t=e.token.replace(/\+/g,`PL`).replace(/\//g,`SL`).replace(/=/g,`EQ`)),e.persistence_name?`ph_`+e.persistence_name:`ph_`+t+`_posthog`})(e),this.Y=this.bi(e),this.load(),e.debug&&R.info(`Persistence loaded`,e.persistence,j({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this.wi}bi(e){_o.indexOf(e.persistence.toLowerCase())===-1&&(R.critical(`Unknown persistence type `+e.persistence+`; falling back to localStorage+cookie`),e.persistence=`localStorage+cookie`);var t=e.persistence.toLowerCase();return t===`localstorage`&&U.H()?U:t===`localstorage+cookie`&&Tr.H()?Tr:t===`sessionstorage`&&W.H()?W:t===`memory`?Dr:t===`cookie`?Sr:Tr.H()?Tr:Sr}properties(){var e={};return B(this.props,(function(t,n){if(n===Zt&&P(t))for(var r=Object.keys(t),i=0;i<r.length;i++)e[`$feature/`+r[i]]=t[r[i]];else o=n,s=!1,(Pe(a=hn)?s:pe&&a.indexOf===pe?a.indexOf(o)!=-1:(B(a,(function(e){if(s||=e===o)return Et})),s))||(e[n]=t);var a,o,s})),e}load(){if(!this.wi){var e=this.Y.W(this.yi);e&&(this.props=V({},e))}}save(){this.wi||this.Y.G(this.yi,this.props,this.xi,this.Ei,this.Si,this.I.debug)}remove(){this.Y.V(this.yi,!1),this.Y.V(this.yi,!0)}clear(){this.remove(),this.props={}}register_once(e,t,n){if(P(e)){F(t)&&(t=`None`),this.xi=F(n)?this.$i:n;var r=!1;if(B(e,((e,n)=>{this.props.hasOwnProperty(n)&&this.props[n]!==t||(this.props[n]=e,r=!0)})),r)return this.save(),!0}return!1}register(e,t){if(P(e)){this.xi=F(t)?this.$i:t;var n=!1;if(B(e,((t,r)=>{e.hasOwnProperty(r)&&this.props[r]!==t&&(this.props[r]=t,n=!0)})),n)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.mi){var e=Xi(this.I.custom_campaign_params,this.I.mask_personal_data_properties,this.I.custom_personal_data_properties);Me(Mt(e))||this.register(e),this.mi=!0}}update_search_keyword(){var e;this.register((e=O?.referrer)?Qi(e):{})}update_referrer_info(){this.register_once({$referrer:ea(),$referring_domain:O!=null&&O.referrer&&er(O.referrer)?.host||`$direct`},void 0)}set_initial_person_info(){this.props[ln]||this.props[un]||this.register_once({[dn]:ta(this.I.mask_personal_data_properties,this.I.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};B([un,ln],(t=>{var n=this.props[t];
4n&&B(n,(function(t,n){e[`$initial_`+Ee(n)]=t}))}));var t,n,r=this.props[dn];return r&&V(e,(t=na(r),n={},B(t,(function(e,t){n[`$initial_`+Ee(t)]=e})),n)),e}safe_merge(e){return B(this.props,(function(t,n){n in e||(e[n]=t)})),e}update_config(e,t,n){if(this.$i=this.xi=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!n),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence){var r=this.bi(e),i=this.props;this.clear(),this.Y=r,this.props=i,this.save()}}set_disabled(e){this.wi=e,this.wi?this.remove():this.save()}set_cross_subdomain(e){e!==this.Ei&&(this.Ei=e,this.remove(),this.save())}set_secure(e){e!==this.Si&&(this.Si=e,this.remove(),this.save())}set_event_timer(e,t){var n=this.props[zt]||{};n[e]=t,this.props[zt]=n,this.save()}remove_event_timer(e){var t=(this.props[zt]||{})[e];return F(t)||(delete this.props[zt][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}},X=z(`[Product Tours]`),yo=`ph_product_tours`,bo=class{constructor(e){this.ki=null,this.Pi=null,this.Ti=void 0,this.Ri=!1,this._instance=e}onRemoteConfig(e){if(this._instance.config.disable_product_tours)X.info(`Product tours disabled via config`);else{var t=e.productTours;L(t)?X.info(`Product tours not enabled in remote config`):(this.Ti=t,X.info(`Remote config received, isProductToursEnabled: `+this.Ti),this.loadIfEnabled())}}loadIfEnabled(){if(!this.Pi)if(this.Ri)X.info(`Already initializing product tours, skipping...`);else if(this._instance.config.disable_product_tours)X.info(`Product tours disabled via config`);else{var e=A?.__PosthogExtensions__;if(e){var t=this._instance.featureFlags?.isFeatureEnabled(`product-tours-2025`);if(!F(this.Ti)||t){var n=this.Ti||t;if(n){this.Ri=!0;try{var r=e.generateProductTours;if(r)return void this.Ci(r,n);var i=e.loadExternalDependency;if(!i)return X.error(`PostHog loadExternalDependency extension not found.`),void(this.Ri=!1);i(this._instance,`product-tours`,(t=>{t||!e.generateProductTours?X.error(`Could not load product tours script`,t):this.Ci(e.generateProductTours,n),this.Ri=!1}))}catch(e){X.error(`Error initializing product tours`,e),this.Ri=!1}}else X.info(`Product tours not enabled`)}else X.info(`Waiting for remote config or feature flag to enable product tours`)}else X.error(`PostHog Extensions not found.`)}}Ci(e,t){this.Pi=e(this._instance,t)||null,X.info(`Product tours loaded successfully`)}getProductTours(e,t){if(t===void 0&&(t=!1),!N(this.ki)||t){var n=this._instance.persistence;if(n){var r=n.props[yo];if(N(r)&&!t)return this.ki=r,void e(r,{isLoaded:!0})}this._instance.ci({url:this._instance.requestRouter.endpointFor(`api`,`/api/product_tours/?token=`+this._instance.config.token),method:`GET`,callback:t=>{var r=t.statusCode;if(r!==200||!t.json){var i=`Product Tours API could not be loaded, status: `+r;X.error(i),e([],{isLoaded:!1,error:i});return}var a=N(t.json.product_tours)?t.json.product_tours:[];this.ki=a,n&&n.register({[yo]:a}),e(a,{isLoaded:!0})}})}else e(this.ki,{isLoaded:!0})}getActiveProductTours(e){if(L(this.Pi))return X.warn(`Product tours not loaded yet`),void e([],{isLoaded:!1,error:`Product tours not loaded`});this.Pi.getActiveProductTours(e)}showProductTour(e){var t;X.info(`showProductTour(`+e+`)`),(t=this.Pi)==null||t.showTourById(e)}dismissProductTour(){var e;(e=this.Pi)==null||e.dismissTour(`user_clicked_skip`)}nextStep(){var e;(e=this.Pi)==null||e.nextStep()}previousStep(){var e;(e=this.Pi)==null||e.previousStep()}clearCache(){this.ki=null;var e=this._instance.persistence;e&&e.unregister(yo)}resetTour(e){var t;(t=this.Pi)==null||t.resetTour(e)}resetAllTours(){var e;(e=this.Pi)==null||e.resetAllTours()}},xo=function(e){return e.Activation=`events`,e.Cancellation=`cancelEvents`,e}({});(function(e){return e.Button=`button`,e.Tab=`tab`,e.Selector=`selector`,e})({}),function(e){return e.TopLeft=`top_left`,e.TopRight=`top_right`,e.TopCenter=`top_center`,e.MiddleLeft=`middle_left`,e.MiddleRight=`middle_right`,e.MiddleCenter=`middle_center`,e.Left=`left`,e.Center=`center`,e.Right=`right`,e.NextToTrigger=`next_to_trigger`,e}({}),function(e){return e.Top=`top`,e.Left=`left`,e.Right=`right`,e.Bottom=`bottom`,e}({});var So=function(e){return e.Popover=`popover`,e.API=`api`,e.Widget=`widget`,e.ExternalSurvey=`external_survey`,e}({});(function(e){return e.Open=`open`,e.MultipleChoice=`multiple_choice`,e.SingleChoice=`single_choice`,e.Rating=`rating`,e.Link=`link`,e})({}),function(e){return e.NextQuestion=`next_question`,e.End=`end`,e.Re
4sponseBased=`response_based`,e.SpecificQuestion=`specific_question`,e}({}),function(e){return e.Once=`once`,e.Recurring=`recurring`,e.Always=`always`,e}({});var Co=function(e){return e.SHOWN=`survey shown`,e.DISMISSED=`survey dismissed`,e.SENT=`survey sent`,e}({}),wo=function(e){return e.SURVEY_ID=`$survey_id`,e.SURVEY_NAME=`$survey_name`,e.SURVEY_RESPONSE=`$survey_response`,e.SURVEY_ITERATION=`$survey_iteration`,e.SURVEY_ITERATION_START_DATE=`$survey_iteration_start_date`,e.SURVEY_PARTIALLY_COMPLETED=`$survey_partially_completed`,e.SURVEY_SUBMISSION_ID=`$survey_submission_id`,e.SURVEY_QUESTIONS=`$survey_questions`,e.SURVEY_COMPLETED=`$survey_completed`,e}({}),To=function(e){return e.Popover=`popover`,e.Inline=`inline`,e}({}),Eo=class{constructor(){this.Ii={},this.Ii={}}on(e,t){return this.Ii[e]||(this.Ii[e]=[]),this.Ii[e].push(t),()=>{this.Ii[e]=this.Ii[e].filter((e=>e!==t))}}emit(e,t){for(var n of this.Ii[e]||[])n(t);for(var r of this.Ii[`*`]||[])r(e,t)}};function Do(e,t,n){if(L(e))return!1;switch(n){case`exact`:return e===t;case`contains`:var r=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`).replace(/_/g,`.`).replace(/%/g,`.*`);return new RegExp(r,`i`).test(e);case`regex`:try{return new RegExp(t).test(e)}catch{return!1}default:return!1}}var Oo=class{constructor(e){this.Fi=new Eo,this.Mi=(e,t)=>this.Oi(e,t)&&this.Ai(e,t)&&this.Di(e,t)&&this.ji(e,t),this.Oi=(e,t)=>t==null||!t.event||e?.event===t?.event,this._instance=e,this.Li=new Set,this.Ni=new Set}init(){if(!F(this._instance?.Ui)){var e;(e=this._instance)==null||e.Ui(((e,t)=>{this.on(e,t)}))}}register(e){var t;if(!F(this._instance?.Ui)&&(e.forEach((e=>{var t,n;(t=this.Ni)==null||t.add(e),(n=e.steps)==null||n.forEach((e=>{var t;(t=this.Li)==null||t.add(e?.event||``)}))})),(t=this._instance)!=null&&t.autocapture)){var n,r=new Set;e.forEach((e=>{var t;(t=e.steps)==null||t.forEach((e=>{e!=null&&e.selector&&r.add(e?.selector)}))})),(n=this._instance)==null||n.autocapture.setElementSelectors(r)}}on(e,t){t!=null&&e.length!=0&&(this.Li.has(e)||this.Li.has(t?.event))&&this.Ni&&this.Ni?.size>0&&this.Ni.forEach((e=>{this.zi(t,e)&&this.Fi.emit(`actionCaptured`,e.name)}))}Hi(e){this.onAction(`actionCaptured`,(t=>e(t)))}zi(e,t){if(t?.steps==null)return!1;for(var n of t.steps)if(this.Mi(e,n))return!0;return!1}onAction(e,t){return this.Fi.on(e,t)}Ai(e,t){if(t!=null&&t.url){var n,r=e==null||(n=e.properties)==null?void 0:n.$current_url;if(!r||typeof r!=`string`||!Do(r,t.url,t.url_matching||`contains`))return!1}return!0}Di(e,t){return!!this.Bi(e,t)&&!!this.qi(e,t)&&!!this.Wi(e,t)}Bi(e,t){var n;if(t==null||!t.href)return!0;var r=this.Gi(e);if(r.length>0)return r.some((e=>Do(e.href,t.href,t.href_matching||`exact`)));var i,a=(e==null||(n=e.properties)==null?void 0:n.$elements_chain)||``;return!!a&&Do((i=a.match(/(?::|")href="(.*?)"/))?i[1]:``,t.href,t.href_matching||`exact`)}qi(e,t){var n;if(t==null||!t.text)return!0;var r=this.Gi(e);if(r.length>0)return r.some((e=>Do(e.text,t.text,t.text_matching||`exact`)||Do(e.$el_text,t.text,t.text_matching||`exact`)));var i,a,o,s=(e==null||(n=e.properties)==null?void 0:n.$elements_chain)||``;return!!s&&(i=function(e){for(var t,n=[],r=/(?::|")text="(.*?)"/g;!L(t=r.exec(e));)n.includes(t[1])||n.push(t[1]);return n}(s),a=t.text,o=t.text_matching||`exact`,i.some((e=>Do(e,a,o))))}Wi(e,t){var n,r;if(t==null||!t.selector)return!0;var i=e==null||(n=e.properties)==null?void 0:n.$element_selectors;if(i!=null&&i.includes(t.selector))return!0;var a=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||``;if(t.selector_regex&&a)try{return new RegExp(t.selector_regex).test(a)}catch{return!1}return!1}Gi(e){var t;return(e==null||(t=e.properties)==null?void 0:t.$elements)==null?[]:e?.properties.$elements}ji(e,t){return t==null||!t.properties||t.properties.length===0||to(t.properties.reduce(((e,t)=>{var n=N(t.value)?t.value.map(String):t.value==null?[]:[String(t.value)];return e[t.key]={values:n,operator:t.operator||`exact`},e}),{}),e?.properties)}},Z=z(`[Surveys]`),ko=`seenSurvey_`,Ao=(e,t)=>{var n=`$survey_`+t+`/`+e.id;return e.current_iteration&&e.current_iteration>0&&(n=`$survey_`+t+`/`+e.id+`/`+e.current_iteration),n},jo=e=>{var t=``+ko+e.id;return e.current_iteration&&e.current_iteration>0&&(t=``+ko+e.id+`_`+e.current_iteration),t},Mo=[So.Popover,So.Widget,So.API],No={ignoreConditions:!1,ignoreDelay:!1,displayType:To.Popover},Po=class{constructor(e){this._instance=e,this.Vi=new Map,this.Ji=new Map,this.Ki=new Map}Yi(e,t){return!!e&&to(e.propertyFilters,t?.properties)}Xi(e,t){var n=new Map;return e.forEach((e=>{var r;(r=e.conditions)==null||(r=r[t])==null||(r=r.values)==null||r.forEach((t=>{if(t!=null&&t.name){var r=n.get(t.name)||[];r.push(e.id),n.set(t.name,r)}}))})),n}Qi(e,t,n){var r,i=(n===xo.Activation?this.Vi:this.Ji).get(e),a=[];return(r=this._instance)==null||r.getSurveys((e=>{a=e.filter((e=>i?.includes(e.id)))})),a.filter((r=>{var i,a=(i=r.conditions)==null||(i=i[n])==null||(i=i.values)==null?void 0:i.find((t=>t.name===e));return this.Yi(a,t)}))}register(e){F(this._instance?.Ui)||(this.Zi(e),this.te(e))}te(e){var t=e.filter((e=>{var t;return e.conditions?.actions&&((t=e.conditions)==null||(t=t.actions)==null||(t=t.values)==null?void 0:t.length)>0}));t.length!==0&&(this.ie??(this.ie=new Oo(this._instance),this.ie.init(),this.ie.Hi((e=>{this.onAction(e)}))),t.forEach((e=>{var t,n,r,i,a;e.conditions&&(t=e.conditions)!=null&&t.actions&&(n=e.conditions)!=null&&(n=n.actions)!=null&&n.values&&((r=e.conditions)==null||(r=r.actions)==null||(r=r.values)==null?void 0:r.length)>0&&((i=this.ie)==null||i.register(e.conditions.actions.values),(a=e.conditions)==null||(a=a.actions)==null||(a=a.values)==null||a.forEach((t=>{if(t&&t.name){var n=this.Ki.get(t.name);n&&n.push(e.id),this.Ki.set(t.name,n||[e.id])}})))})))}Zi(e){var t,n=e.filter((e=>{var t;return e.conditions?.events&&((t=e.conditions)==null||(t=t.events)==null||(t=t.values)==null?void 0:t.length)>0})),r=e.filter((e=>{var t;return e.conditions?.cancelEvents&&((t=e.conditions)==null||(t=t.cancelEvents)==null||(t=t.values)==null?void 0:t.length)>0}));(n.length!==0||r.length!==0)&&((t=this._instance)==null||t.Ui(((e,t)=>{this.onEvent(e,t)})),this.Vi=this.Xi(e,xo.Activation),this.Ji=this.Xi(e,xo.Cancellation))}onEvent(e,t){var n,r=((n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[rn])||[];if(Co.SHOWN===e&&t&&r.length>0){var i;Z.info(`survey event matched, removing survey from activated surveys`,{event:e,eventPayload:t,existingActivatedSurveys:r});var a=t==null||(i=t.properties)==null?void 0:i.$survey_id;if(a){var o=r.indexOf(a);o>=0&&(r.splice(o,1),this.ee(r))}}else{if(this.Ji.has(e)){var s=this.Qi(e,t,xo.Cancellation);s.length>0&&(Z.info(`cancel event matched, cancelling surveys`,{event:e,surveysToCancel:s.map((e=>e.id))}
4),s.forEach((e=>{var t,n=r.indexOf(e.id);n>=0&&r.splice(n,1),(t=this._instance)==null||t.cancelPendingSurvey(e.id)})),this.ee(r))}if(this.Vi.has(e)){Z.info(`survey event name matched`,{event:e,eventPayload:t,surveys:this.Vi.get(e)});var c=this.Qi(e,t,xo.Activation);this.ee(r.concat(c.map((e=>e.id))||[]))}}}onAction(e){var t,n=((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[rn])||[];this.Ki.has(e)&&this.ee(n.concat(this.Ki.get(e)||[]))}ee(e){var t;Z.info(`updating activated surveys`,{activatedSurveys:e}),(t=this._instance)==null||(t=t.persistence)==null||t.register({[rn]:[...new Set(e)]})}getSurveys(){var e;return((e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[rn])||[]}getEventToSurveys(){return this.Vi}re(){return this.ie}},Fo=class{constructor(e){this.se=void 0,this._surveyManager=null,this.ne=!1,this.oe=!1,this.ae=[],this._instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){if(!this._instance.config.disable_surveys){var t=e.surveys;if(L(t))return Z.warn(`Flags not loaded yet. Not loading surveys.`);var n=N(t);this.se=n?t.length>0:t,Z.info(`flags response received, isSurveysEnabled: `+this.se),this.loadIfEnabled()}}reset(){localStorage.removeItem(`lastSeenSurveyDate`);for(var e=[],t=0;t<localStorage.length;t++){var n=localStorage.key(t);(n!=null&&n.startsWith(ko)||n!=null&&n.startsWith(`inProgressSurvey_`))&&e.push(n)}e.forEach((e=>localStorage.removeItem(e)))}loadIfEnabled(){if(!this._surveyManager)if(this.oe)Z.info(`Already initializing surveys, skipping...`);else if(this._instance.config.disable_surveys)Z.info(`Disabled. Not loading surveys.`);else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())Z.info(`Not loading surveys in cookieless mode without consent.`);else{var e=A?.__PosthogExtensions__;if(e){if(!F(this.se)||this._instance.config.advanced_enable_surveys){var t=this.se||this._instance.config.advanced_enable_surveys;this.oe=!0;try{var n=e.generateSurveys;if(n)return void this.le(n,t);var r=e.loadExternalDependency;if(!r)return void this.ue(`PostHog loadExternalDependency extension not found.`);r(this._instance,`surveys`,(n=>{n||!e.generateSurveys?this.ue(`Could not load surveys script`,n):this.le(e.generateSurveys,t)}))}catch(e){throw this.ue(`Error initializing surveys`,e),e}finally{this.oe=!1}}}else Z.error(`PostHog Extensions not found.`)}}le(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new Po(this._instance),Z.info(`Surveys loaded successfully`),this.he({isLoaded:!0})}ue(e,t){Z.error(e,t),this.he({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.ae.push(e),this._surveyManager&&this.he({isLoaded:!0}),()=>{this.ae=this.ae.filter((t=>t!==e))}}getSurveys(e,t){if(t===void 0&&(t=!1),this._instance.config.disable_surveys)return Z.info(`Disabled. Not loading surveys.`),e([]);var n=this._instance.get_property(nn);if(n&&!t)return e(n,{isLoaded:!0});if(this.ne)return e([],{isLoaded:!1,error:`Surveys are already being loaded`});try{this.ne=!0,this._instance.ci({url:this._instance.requestRouter.endpointFor(`api`,`/api/surveys/?token=`+this._instance.config.token),method:`GET`,timeout:this._instance.config.surveys_request_timeout_ms,callback:t=>{var n;this.ne=!1;var r=t.statusCode;if(r!==200||!t.json){var i=`Surveys API could not be loaded, status: `+r;return Z.error(i),e([],{isLoaded:!1,error:i})}var a,o=t.json.surveys||[],s=o.filter((e=>function(e){return!(!e.start_date||e.end_date)}(e)&&(function(e){var t;return!((t=e.conditions)==null||(t=t.events)==null||(t=t.values)==null||!t.length)}(e)||function(e){var t;return!((t=e.conditions)==null||(t=t.actions)==null||(t=t.values)==null||!t.length)}(e))));return s.length>0&&((a=this._surveyEventReceiver)==null||a.register(s)),(n=this._instance.persistence)==null||n.register({[nn]:o}),e(o,{isLoaded:!0})}})}catch(e){throw this.ne=!1,e}}he(e){for(var t of this.ae)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(e){Z.error(`Error in survey callback`,e)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!L(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);Z.warn(`init was not called`)}de(e){var t=null;
4return this.getSurveys((n=>{t=n.find((t=>t.id===e))??null})),t}ve(e){if(L(this._surveyManager))return{eligible:!1,reason:`SDK is not enabled or survey functionality is not yet loaded`};var t=typeof e==`string`?this.de(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:`Survey not found`}}canRenderSurvey(e){if(L(this._surveyManager))return Z.warn(`init was not called`),{visible:!1,disabledReason:`SDK is not enabled or survey functionality is not yet loaded`};var t=this.ve(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return L(this._surveyManager)?(Z.warn(`init was not called`),Promise.resolve({visible:!1,disabledReason:`SDK is not enabled or survey functionality is not yet loaded`})):new Promise((n=>{this.getSurveys((t=>{var r=t.find((t=>t.id===e))??null;if(r){var i=this.ve(r);n({visible:i.eligible,disabledReason:i.reason})}else n({visible:!1,disabledReason:`Survey not found`})}),t)}))}renderSurvey(e,t){var n;if(L(this._surveyManager))Z.warn(`init was not called`);else{var r=typeof e==`string`?this.de(e):e;if(r!=null&&r.id)if(Mo.includes(r.type)){var i=O?.querySelector(t);if(i)return(n=r.appearance)!=null&&n.surveyPopupDelaySeconds?(Z.info(`Rendering survey `+r.id+` with delay of `+r.appearance.surveyPopupDelaySeconds+` seconds`),void setTimeout((()=>{var e;Z.info(`Rendering survey `+r.id+` with delay of `+r.appearance?.surveyPopupDelaySeconds+` seconds`),(e=this._surveyManager)==null||e.renderSurvey(r,i),Z.info(`Survey `+r.id+` rendered`)}),1e3*r.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(r,i);Z.warn(`Survey element not found`)}else Z.warn(`Surveys of type `+r.type+` cannot be rendered in the app`);else Z.warn(`Survey not found`)}}displaySurvey(e,t){var n;if(L(this._surveyManager))Z.warn(`init was not called`);else{var r=this.de(e);if(r){var i=r;if((n=r.appearance)!=null&&n.surveyPopupDelaySeconds&&t.ignoreDelay&&(i=j({},r,{appearance:j({},r.appearance,{surveyPopupDelaySeconds:0})})),!1===t.ignoreConditions){var a=this.canRenderSurvey(r);if(!a.visible)return void Z.warn(`Survey is not eligible to be displayed: `,a.disabledReason)}t.displayType===To.Inline?this.renderSurvey(i,t.selector):this._surveyManager.handlePopoverSurvey(i)}else Z.warn(`Survey not found`)}}cancelPendingSurvey(e){L(this._surveyManager)?Z.warn(`init was not called`):this._surveyManager.cancelSurvey(e)}},Io=z(`[RateLimiter]`),Lo=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach((e=>{Io.info((e||`events`)+` is quota limited.`),this.serverLimits[e]=new Date().getTime()+6e4}))}catch(e){Io.warn(`could not rate limit - continuing. Error: "`+e?.message+`"`,{text:t});return}},this.instance=e,this.captureEventsPerSecond=e.config.rate_limiting?.events_per_second||10,this.captureEventsBurstLimit=Math.max(e.config.rate_limiting?.events_burst_limit||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(e){var t;e===void 0&&(e=!1);var n=new Date().getTime(),r=this.instance.persistence?.get_property(cn)??{tokens:this.captureEventsBurstLimit,last:n};r.tokens+=(n-r.last)/1e3*this.captureEventsPerSecond,r.last=n,r.tokens>this.captureEventsBurstLimit&&(r.tokens=this.captureEventsBurstLimit);var i=r.tokens<1;return i||e||(r.tokens=Math.max(0,r.tokens-1)),!i||this.lastEventRateLimited||e||this.instance.capture(`$$client_ingestion_warning`,{$$client_ingestion_warning_message:`posthog-js client rate limited. Config is set to `+this.captureEventsPerSecond+` events per second and `+this.captureEventsBurstLimit+` events burst limit.`},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=i,(t=this.instance.persistence)==null||t.set_property(cn,r),{isRateLimited:i,remainingTokens:r.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||`events`]||!1;return!1!==t&&new Date().getTime()<t}},Ro=z(`[RemoteConfig]`),zo=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=A._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}ce(e){var t,n;(t=A.__PosthogExtensions__)!=null&&t.loadExternalDependency?(n=A.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,`remote-config`,(()=>e(this.remoteConfig))):(Ro.error(`PostHog Extensions not found. Cannot load remote config.`),e(
4))}fe(e){this._instance.ci({method:`GET`,url:this._instance.requestRouter.endpointFor(`assets`,`/array/`+this._instance.config.token+`/config`),callback:t=>{e(t.json)}})}load(){try{if(this.remoteConfig)return Ro.info(`Using preloaded remote config`,this.remoteConfig),void this.fi(this.remoteConfig);if(this._instance.O())return void Ro.warn(`Remote config is disabled. Falling back to local config.`);this.ce((e=>{if(!e)return Ro.info(`No config found after loading remote JS config. Falling back to JSON.`),void this.fe((e=>{this.fi(e)}));this.fi(e)}))}catch(e){Ro.error(`Error loading remote config`,e)}}fi(e){e?this._instance.config.__preview_remote_config?(this._instance.fi(e),!1!==e.hasFeatureFlags&&this._instance.featureFlags.ensureFlagsLoaded()):Ro.info(`__preview_remote_config is disabled. Logging config instead`,e):Ro.error(`Failed to fetch remote config from PostHog.`)}},Bo=3e3,Vo=class{constructor(e,t){this.pe=!0,this.ge=[],this._e=Ge(t?.flush_interval_ms||Bo,250,5e3,R.createLogger(`flush interval`),Bo),this.me=e}enqueue(e){this.ge.push(e),this.ye||this.be()}unload(){this.we();var e=this.ge.length>0?this.xe():{},t=Object.values(e);[...t.filter((e=>e.url.indexOf(`/e`)===0)),...t.filter((e=>e.url.indexOf(`/e`)!==0))].map((e=>{this.me(j({},e,{transport:`sendBeacon`}))}))}enable(){this.pe=!1,this.be()}be(){var e=this;this.pe||(this.ye=setTimeout((()=>{if(this.we(),this.ge.length>0){var t=this.xe(),n=function(){var n=t[r],i=new Date().getTime();n.data&&N(n.data)&&B(n.data,(e=>{e.offset=Math.abs(e.timestamp-i),delete e.timestamp})),e.me(n)};for(var r in t)n()}}),this._e))}we(){clearTimeout(this.ye),this.ye=void 0}xe(){var e={};return B(this.ge,(t=>{var n,r=t,i=(r?r.batchKey:null)||r.url;F(e[i])&&(e[i]=j({},r,{data:[]})),(n=e[i].data)==null||n.push(r.data)})),this.ge=[],e}},Ho=[`retriesPerformedSoFar`],Uo=class{constructor(e){this.Ee=!1,this.Se=3e3,this.ge=[],this._instance=e,this.ge=[],this.$e=!0,!F(T)&&`onLine`in T.navigator&&(this.$e=T.navigator.onLine,this.ke=()=>{this.$e=!0,this.Dt()},this.Pe=()=>{this.$e=!1},H(T,`online`,this.ke),H(T,`offline`,this.Pe))}get length(){return this.ge.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,n=xe(e,Ho);Fe(t)&&t>0&&(n.url=qa(n.url,{retry_count:t})),this._instance.ci(j({},n,{callback:e=>{e.statusCode!==200&&(e.statusCode<400||e.statusCode>=500)&&(t??0)<10?this.Te(j({retriesPerformedSoFar:t},n)):n.callback==null||n.callback(e)}}))}Te(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var n=function(e){var t=3e3*2**e,n=t/2,r=Math.min(18e5,t),i=(Math.random()-.5)*(r-n);return Math.ceil(r+i)}(t),r=Date.now()+n;this.ge.push({retryAt:r,requestOptions:e});var i=`Enqueued failed request for retry in `+n;navigator.onLine||(i+=` (Browser is offline)`),R.warn(i),this.Ee||(this.Ee=!0,this.Re())}Re(){if(this.Ce&&clearTimeout(this.Ce),this.ge.length===0)return this.Ee=!1,void(this.Ce=void 0);this.Ce=setTimeout((()=>{this.$e&&this.ge.length>0&&this.Dt(),this.Re()}),this.Se)}Dt(){var e=Date.now(),t=[],n=this.ge.filter((n=>n.retryAt<e||(t.push(n),!1)));if(this.ge=t,n.length>0)for(var{requestOptions:r}of n)this.retriableRequest(r)}unload(){for(var{requestOptions:e}of(this.Ce&&=(clearTimeout(this.Ce),void 0),this.Ee=!1,F(T)||(this.ke&&=(T.removeEventListener(`online`,this.ke),void 0),this.Pe&&=(T.removeEventListener(`offline`,this.Pe),void 0)),this.ge))try{this._instance.ci(j({},e,{transport:`sendBeacon`}))}catch(e){R.error(e)}this.ge=[]}},Wo=class{constructor(e){this.Ie=()=>{this.Fe||={};var e=this.scrollElement(),t=this.scrollY(),n=e?Math.max(0,e.scrollHeight-e.clientHeight):0,r=t+(e?.clientHeight||0),i=e?.scrollHeight||0;this.Fe.lastScrollY=Math.ceil(t),this.Fe.maxScrollY=Math.max(t,this.Fe.maxScrollY??0),this.Fe.maxScrollHeight=Math.max(n,this.Fe.maxScrollHeight??0),this.Fe.lastContentY=r,this.Fe.maxContentY=Math.max(r,this.Fe.maxContentY??0),this.Fe.maxContentHeight=Math.max(i,this.Fe.maxContentHeight??0)},this._instance=e}getContext(){return this.Fe}resetContext(){var e=this.Fe;return setTimeout(this.Ie,0),e}startMeasuringScrollPosition(){H(T,`scroll`,this.Ie,{capture:!0}),H(T,`scrollend`,this.Ie,{capture:!0}),H(T,`resize`,this.Ie)}scrollElement(){if(!this._instance.config.scroll_root_selector)return T?.document.documentElement;for(var e of N(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector]){var t=T?.document.querySelector(e);
4if(t)return t}}scrollY(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return T&&(T.scrollY||T.pageYOffset||T.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return T&&(T.scrollX||T.pageXOffset||T.document.documentElement.scrollLeft)||0}},Go=e=>ta(e?.config.mask_personal_data_properties,e?.config.custom_personal_data_properties),Ko=class{constructor(e,t,n,r){this.Me=e=>{var t=this.Oe();if(!t||t.sessionId!==e){var n={sessionId:e,props:this.Ae(this._instance)};this.De.register({[sn]:n})}},this._instance=e,this.je=t,this.De=n,this.Ae=r||Go,this.je.onSessionId(this.Me)}Oe(){return this.De.props[sn]}getSetOnceProps(){var e=this.Oe()?.props;return e?`r`in e?na(e):{$referring_domain:e.referringDomain,$pathname:e.initialPathName,utm_source:e.utm_source,utm_campaign:e.utm_campaign,utm_medium:e.utm_medium,utm_content:e.utm_content,utm_term:e.utm_term}:{}}getSessionProps(){var e={};return B(Mt(this.getSetOnceProps()),((t,n)=>{n===`$current_url`&&(n=`url`),e[`$session_entry_`+Ee(n)]=t})),e}},qo=z(`[SessionId]`),Jo=class{on(e,t){return this.Le.on(e,t)}constructor(e,t,n){var r;if(this.Ne=[],this.Ue=void 0,this.Le=new Eo,this.ze=(e,t)=>Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw Error(`SessionIdManager requires a PostHogPersistence instance`);if(e.config.cookieless_mode===`always`)throw Error(`SessionIdManager cannot be used with cookieless_mode="always"`);this.I=e.config,this.De=e.persistence,this.He=void 0,this.Be=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.qe=t||_r,this.We=n||_r;var i=this.I.persistence_name||this.I.token,a=this.I.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*Ge(a,60,36e3,qo.createLogger(`session_idle_timeout_seconds`),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Ge(),this.Ve=`ph_`+i+`_window_id`,this.Je=`ph_`+i+`_primary_window_exists`,this.Ke()){var o=W.W(this.Ve),s=W.W(this.Je);o&&!s?this.He=o:W.V(this.Ve),W.G(this.Je,!0)}if((r=this.I.bootstrap)!=null&&r.sessionID)try{var c=(e=>{var t=e.replace(/-/g,``);if(t.length!==32)throw Error(`Not a valid UUID`);if(t[12]!==`7`)throw Error(`Not a UUIDv7`);return parseInt(t.substring(0,12),16)})(this.I.bootstrap.sessionID);this.Ye(this.I.bootstrap.sessionID,new Date().getTime(),c)}catch(e){qo.error(`Invalid sessionID in bootstrap`,e)}this.Xe()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return F(this.Ne)&&(this.Ne=[]),this.Ne.push(e),this.Be&&e(this.Be,this.He),()=>{this.Ne=this.Ne.filter((t=>t!==e))}}Ke(){return this.I.persistence!==`memory`&&!this.De.wi&&W.H()}Qe(e){e!==this.He&&(this.He=e,this.Ke()&&W.G(this.Ve,e))}Ze(){return this.He?this.He:this.Ke()?W.W(this.Ve):null}Ye(e,t,n){e===this.Be&&t===this._sessionActivityTimestamp&&n===this._sessionStartTimestamp||(this._sessionStartTimestamp=n,this._sessionActivityTimestamp=t,this.Be=e,this.De.register({[Yt]:[t,e,n]}))}tr(){var e=this.De.props[Yt];return N(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Ye(null,null,null)}destroy(){clearTimeout(this.ir),this.ir=void 0,this.Ue&&T&&(T.removeEventListener(`beforeunload`,this.Ue,{capture:!1}),this.Ue=void 0),this.Ne=[]}Xe(){this.Ue=()=>{this.Ke()&&W.V(this.Je)},H(T,`beforeunload`,this.Ue,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(e===void 0&&(e=!1),t===void 0&&(t=null),this.I.cookieless_mode===`always`)throw Error(`checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"`);var n=t||new Date().getTime(),[r,i,a]=this.tr(),o=this.Ze(),s=Fe(a)&&a>0&&Math.abs(n-a)>864e5,c=!1,l=!i,u=!l&&!e&&this.ze(n,r);l||u||s?(i=this.qe(),o=this.We(),qo.info(`new session ID generated`,{sessionId:i,windowId:o,changeReason:{noSessionId:l,activityTimeout:u,sessionPastMaximumLength:s}}),a=n,c=!0):o||(o=this.We(),c=!0);var d=r===0||!e||s?n:r,f=a===0?new Date().getTime():a;return this.Qe(o),this.Ye(i,d,f),e||this.Ge(),c&&this.Ne.forEach((e=>e(i,o,c?{noSessionId:l,activityTimeout:u,sessionPastMaximumLength:s}:void 0))),{sessionId:i,windowId:o,sessionStartTimestamp:f,changeReason:c?{noSessionId:l,activityTimeout:u,sessionPastMaximumLength:s}:void 0,lastActivityTimestamp:r}}Ge(){clearTimeout(this.ir),this.ir=setTimeout((()=>{var[e]=this.tr();if(this.ze(new Date().getTime(),e)){var t=this.Be;this.resetSessionId(),this.Le.emit(`forcedIdleReset`,{idleSessionId:t})}}),1.1*this.sessionTimeoutMs)}},Yo=[`$set_once`,`$set`],Xo=z(`[SiteApps]`),Zo=class{constructor(e){this._instance=e,this.er=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}rr(e,t){if(t){var n=this.globalsForEvent(t);this.er.push(n),this.er.length>1e3&&(this.er=this.er.slice(10))}}get siteAppLoaders(){var e;return(e=A._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}init(){if(this.isEnabled){var e=this._instance.Ui(this.rr.bind(this));this.sr=()=>{e(),this.er=[],this.sr=void 0}}}globalsForEvent(e){if(!e)throw Error(`Event payload is required`);var t={},n=this._instance.get_property(`$groups`)||[],r=this._instance.get_property(`$stored_group_properties`)||{};for(var[i,a]of Object.entries(r))t[i]={id:n[i],type:i,properties:a};var{$set_once:o,$set:s}=e;return{event:j({},xe(e,Yo),{properties:j({},e.properties,s?{$set:j({},e.properties?.$set??{},s)}:{},o?{$set_once:j({},e.properties?.$set_once??{},o)}:{}),elements_chain:e.properties?.$elements_chain??``,distinct_id:e.properties?.distinct_id}),person:{properties:this._instance.get_property(`$stored_person_properties`)},groups:t}}setupSiteApp(e){var t=this.apps[e.id],n=()=>{var n;(!t.errored&&this.er.length&&(Xo.info(`Processing `+this.er.length+` events for site app with id `+e.id),this.er.forEach((e=>t.processEvent==null?void 0:t.processEvent(e))),t.processedBuffer=!0),Object.values(this.apps).every((e=>e.processedBuffer||e.errored)))&&((n=this.sr)==null||n.call(this))},r=!1,i=i=>{t.errored=!i,t.loaded=!0,Xo.info(`Site app with id `+e.id+` `+(i?`loaded`:`errored`)),r&&n()};try{var{processEvent:a}=e.init({posthog:this._instance,callback:e=>{i(e)}});a&&(t.processEvent=a),r=!0}catch(t){Xo.error(`Error while initializing PostHog app with config id `+e.id,t),i(!1)}if(r&&t.loaded)try{n()}catch(n){Xo.error(`Error while processing buffered events PostHog app with config id `+e.id,n),t.errored=!0}}nr(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var n of e)this.setupSiteApp(n)}ar(e){if(Object.keys(this.apps).length!==0){var t=this.globalsForEvent(e);for(var n of Object.values(this.apps))try{n.processEvent==null||n.processEvent(t)}catch(t){Xo.error(`Error while processing event `+e.event+` for site app `+n.id,t)}}}onRemoteConfig(e){var t,n,r,i=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.nr(),void this._instance.on(`eventCaptured`,(e=>this.ar(e)))):void Xo.error(`PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.`);if((n=this.sr)==null||n.call(this),(r=e.siteApps)!=null&&r.length)if(this.isEnabled){var a=function(e){var t;A[`__$$ph_site_app_`+e]=i._instance,(t=A.__PosthogExtensions__)==null||t.loadSiteApp==null||t.loadSiteApp(i._instance,s,(t=>
4{if(t)return Xo.error(`Error while initializing PostHog app with config id `+e,t)}))};for(var{id:o,url:s}of e.siteApps)a(o)}else Xo.error(`PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.`)}},Qo=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&Ce(n,t))return!0;try{var r=e?.userAgentData;if(r!=null&&r.brands&&r.brands.some((e=>Ce(e?.brand,t))))return!0}catch{}return!!e.webdriver},$o=function(e){return e.US=`us`,e.EU=`eu`,e.CUSTOM=`custom`,e}({}),es=`i.posthog.com`,ts=class{constructor(e){this.lr={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,``);return e===`https://app.posthog.com`?`https://us.i.posthog.com`:e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,``):this.apiHost}get uiHost(){var e=this.instance.config.ui_host?.replace(/\/$/,``);return e||=this.apiHost.replace(`.`+es,`.posthog.com`),e===`https://app.posthog.com`?`https://us.posthog.com`:e}get region(){return this.lr[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.lr[this.apiHost]=$o.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.lr[this.apiHost]=$o.EU:this.lr[this.apiHost]=$o.CUSTOM),this.lr[this.apiHost]}endpointFor(e,t){if(t===void 0&&(t=``),t&&=t[0]===`/`?t:`/`+t,e===`ui`)return this.uiHost+t;if(e===`flags`)return this.flagsApiHost+t;if(this.region===$o.CUSTOM)return this.apiHost+t;var n=es+t;switch(e){case`assets`:return`https://`+this.region+`-assets.`+n;case`api`:return`https://`+this.region+`.`+n}}},ns={icontains:(e,t)=>!!T&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!T&&t.href.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>!!T&&Za(t.href,e),not_regex:(e,t)=>!!T&&!Za(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e},rs=class e{constructor(t){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){t===void 0&&(t=!1),n.getWebExperiments((t=>{e.ur(`retrieved web experiments from the server`),n.hr=new Map,t.forEach((t=>{if(t.feature_flag_key){var r;n.hr&&(e.ur(`setting flag key `,t.feature_flag_key,` to web experiment `,t),(r=n.hr)==null||r.set(t.feature_flag_key,t));var i=n._instance.getFeatureFlag(t.feature_flag_key);I(i)&&t.variants[i]&&n.dr(t.name,i,t.variants[i].transforms)}else if(t.variants)for(var a in t.variants){var o=t.variants[a];e.vr(o)&&n.dr(t.name,a,o.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((e=>{this.onFeatureFlags(e)}))}onFeatureFlags(t){if(this._is_bot())e.ur(`Refusing to render web experiment since the viewer is a likely bot`);else if(!this._instance.config.disable_web_experiments){if(L(this.hr))return this.hr=new Map,this.loadIfEnabled(),void this.previewWebExperiment();e.ur(`applying feature flags`,t),t.forEach((e=>{var t;if(this.hr&&(t=this.hr)!=null&&t.has(e)){var n=this._instance.getFeatureFlag(e),r=this.hr?.get(e);n&&r!=null&&r.variants[n]&&this.dr(r.name,n,r.variants[n].transforms)}}))}}previewWebExperiment(){var t=e.getWindowLocation();if(t!=null&&t.search){var n=nr(t?.search,`__experiment_id`),r=nr(t?.search,`__experiment_variant`);n&&r&&(e.ur(`previewing web experiments `+n+` && `+r),this.getWebExperiments((e=>{this.cr(parseInt(n),r,e)}),!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,n){if(this._instance.config.disable_web_experiments&&!n)return e([]);var r=this._instance.get_property(`$web_experiments`);if(r&&!t)return e(r);this._instance.ci({url:this._instance.requestRouter.endpointFor(`api`,`/api/web_experiments/?token=`+this._instance.config.token),method:`GET`,callback:t=>t.statusCode!==200||!t.json?e([]):e(t.json.experiments||[])})}cr(t,n,r){var i=r.filter((e=>e.id===t));i&&i.length>0&&(e.ur(`Previewing web experiment [`+i[0].name+`] with variant [`+n+`]`),this.dr(i[0].name,n,i[0].variants[n].transforms))}static vr(t){return!L(t.conditions)&&e.pr(t)&&e.gr(t)}static pr(t){if(L(t.conditions)||L(t.conditions?.url))return!0;var n,r=e.getWindowLocation();return!!r&&((n=t.conditions)==null||!n.url||ns[t.conditions?.urlMatchType??`icontains`](t.conditions.url,r))}
4static getWindowLocation(){return T?.location}static gr(e){if(L(e.conditions)||L(e.conditions?.utm))return!0;var t=Xi();if(t.utm_source){var n,r,i,a,o,s,c,l,u=(n=e.conditions)==null||(n=n.utm)==null||!n.utm_campaign||((r=e.conditions)==null||(r=r.utm)==null?void 0:r.utm_campaign)==t.utm_campaign,d=(i=e.conditions)==null||(i=i.utm)==null||!i.utm_source||((a=e.conditions)==null||(a=a.utm)==null?void 0:a.utm_source)==t.utm_source,f=(o=e.conditions)==null||(o=o.utm)==null||!o.utm_medium||((s=e.conditions)==null||(s=s.utm)==null?void 0:s.utm_medium)==t.utm_medium,p=(c=e.conditions)==null||(c=c.utm)==null||!c.utm_term||((l=e.conditions)==null||(l=l.utm)==null?void 0:l.utm_term)==t.utm_term;return u&&f&&p&&d}return!1}static ur(e){var t=[...arguments].slice(1);R.info(`[WebExperiments] `+e,t)}dr(t,n,r){this._is_bot()?e.ur(`Refusing to render web experiment since the viewer is a likely bot`):n===`control`?e.ur(`Control variants leave the page unmodified.`):r.forEach((r=>{r.selector&&(e.ur(`applying transform of variant `+n+` for experiment `+t+` `,r),(document?.querySelectorAll(r.selector))?.forEach((e=>{var t=e;r.html&&(t.innerHTML=r.html),r.css&&t.setAttribute(`style`,r.css)})))}))}_is_bot(){return D&&this._instance?Qo(D,this._instance.config.custom_blocked_useragents):void 0}},is=z(`[PostHog ExternalIntegrations]`),as={intercom:`intercom-integration`,crispChat:`crisp-chat-integration`},os=class{constructor(e){this._instance=e}it(e,t){var n;(n=A.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,e,(e=>{if(e)return is.error(`failed to load script`,e);t()}))}startIfEnabledOrStop(){var e=this,t=function(t){var n,i,a;(!r||(n=A.__PosthogExtensions__)!=null&&(n=n.integrations)!=null&&n[t]||e.it(as[t],(()=>{var n;(n=A.__PosthogExtensions__)==null||(n=n.integrations)==null||(n=n[t])==null||n.start(e._instance)})),!r&&(i=A.__PosthogExtensions__)!=null&&(i=i.integrations)!=null&&i[t])&&((a=A.__PosthogExtensions__)==null||(a=a.integrations)==null||(a=a[t])==null||a.stop())};for(var[n,r]of Object.entries((i=this._instance.config.integrations)??{})){var i;t(n)}}},ss=`[SessionRecording]`,cs=z(ss),ls=class{get started(){var e;return!((e=this._r)==null||!e.isStarted)}get status(){return this._r?this._r.status:this.mr&&!this.yr?`disabled`:`lazy_loading`}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.mr=!1,this.br=void 0,this._instance=e,!this._instance.sessionManager)throw cs.error(`started without valid sessionManager`),Error(ss+` started without valid sessionManager. This is a bug.`);if(this._instance.config.cookieless_mode===`always`)throw Error(ss+` cannot be used with cookieless_mode="always"`)}get yr(){var e,t=!((e=this._instance.get_property(Jt))==null||!e.enabled),n=!this._instance.config.disable_session_recording,r=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return T&&t&&n&&!r}startIfEnabledOrStop(e){var t;if(!this.yr||(t=this._r)==null||!t.isStarted){var n=!F(Object.assign)&&!F(Array.from);this.yr&&n?(this.wr(e),cs.info(`starting`)):this.stopRecording()}}wr(e){var t,n,r;this.yr&&(A!=null&&(t=A.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(n=A.__PosthogExtensions__)!=null&&n.initSessionRecording?this.Er(e):(r=A.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,this.Sr,(t=>{if(t)return cs.error(`could not load recorder`,t);this.Er(e)})))}stopRecording(){var e,t;(e=this.br)==null||e.call(this),this.br=void 0,(t=this._r)==null||t.stop()}$r(){var e;(e=this._instance.persistence)==null||e.unregister(Xt)}kr(e){if(this._instance.persistence){var t,n=this._instance.persistence,r=()=>{var t=!1===e.sessionRecording?void 0:e.sessionRecording,r=t?.sampleRate,i=L(r)?null:parseFloat(r);L(i)&&this.$r();var a=t?.minimumDurationMilliseconds;n.register({[Jt]:j({enabled:!!t},t,{networkPayloadCapture:j({capturePerformance:e.capturePerformance},t?.networkPayloadCapture),canvasRecording:{enabled:t?.recordCanvas,fps:t?.canvasFps,quality:t?.canvasQuality},sampleRate:i,minimumDurationMilliseconds:F(a)?null:a,endpoint:t?.endpoint,triggerMatchType:t?.triggerMatchType,masking:t?.masking,urlTriggers:t?.urlTriggers})})};r(),(t=this.br)==null||t.call(this),this.br=this._instance.sessionManager?.onSessionId(r)}}onRemoteConfig(e){`sessionRecording`in e?!1===e.sessionRecording?this.mr=!0:(this.kr(e),this.mr=!0,this.startIfEnabledOrStop()):cs.info(`skipping remote config with no sessionRecording`,e)}log(e,t){var n;t===void 0&&(t=`log`),(n=this._r)!=null&&n.log?this._r.log(e,t):cs.warn(`log called before recorder was ready`)}get Sr(){var e,t,n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(Jt);return(n==null||(t=n.scriptConfig)==null?void 0:t.script)||`lazy-recorder`}Er(e){var t;if((t=A.__PosthogExtensions__)==null||!t.initSessionRecording)throw Error(`Called on script loaded before session recording is available`);this._r||(this._r=A.__PosthogExtensions__?.initSessionRecording(this._instance),this._r._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),this._r.start(e)}onRRwebEmit(e){var t;(t=this._r)==null||t.onRRwebEmit==null||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this._r||(t=this._instance.persistence)==null||t.register({$replay_override_linked_flag:!0}),(e=this._r)==null||e.overrideLinkedFlag()}overrideSampling(){var e,t;this._r||(t=this._instance.persistence)==null||t.register({$replay_override_sampling:!0}),(e=this._r)==null||e.overrideSampling()}overrideTrigger(e){var t,n;this._r||(n=this._instance.persistence)==null||n.register({[e===`url`?`$replay_override_url_trigger`:`$replay_override_event_trigger`]:!0}),(t=this._r)==null||t.overrideTrigger(e)}get sdkDebugProperties(){return this._r?.sdkDebugProperties||{$recording_status:this.status}}tryAddCustomEvent(e,t){var n;return!((n=this._r)==null||!n.tryAddCustomEvent(e,t))}},us={},ds=()=>{},fs=`posthog`,ps=!Ga&&k?.indexOf(`MSIE`)===-1&&k?.indexOf(`Mozilla`)===-1,ms=e=>{var t;return j({api_host:`https://us.i.posthog.com`,flags_api_host:null,ui_host:null,token:``,autocapture:!0,cross_subdomain_cookie:Ft(O?.location),persistence:`localStorage+cookie`,persistence_name:``,loaded:ds,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,debug:me&&I(me?.search)&&me.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_product_tours:!0,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(T==null||(t=T.location)==null?void 0:t.protocol)===`https:`,ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:`localStorage`,consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:e=>{var t=`Bad HTTP status: `+e.statusCode+` `+e.text;R.error(t)},get_device_id:e=>e,capture_performance:void 0,name:`posthog`,bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:`identified_only`,before_send:void 0,request_queue_config:{flush_interval_ms:Bo},error_tracking:{},_onCapture:ds,__preview_eager_load_replay:!1},(e=>({rageclick:!(e&&e>=`2025-11-30`)||{content_ignorelist:!0},capture_pageview:!(e&&e>=`2025-05-24`)||`history_change`,session_recording:e&&e>=`2025-11-30`?{strictMinimumDuration:!0}:{}}))(e))},hs=e=>{var t={};F(e.process_person)||(t.person_profiles=e.process_person),F(e.xhr_headers)||(t.request_headers=e.x
4hr_headers),F(e.cookie_name)||(t.persistence_name=e.cookie_name),F(e.disable_cookie)||(t.disable_persistence=e.disable_cookie),F(e.store_google)||(t.save_campaign_params=e.store_google),F(e.verbose)||(t.debug=e.verbose);var n=V({},t,e);return N(e.property_blacklist)&&(F(e.property_denylist)?n.property_denylist=e.property_blacklist:N(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:R.error(`Invalid value for property_denylist config: `+e.property_denylist)),n},gs=class{constructor(){this.__forceAllowLocalhost=!1}get Pr(){return this.__forceAllowLocalhost}set Pr(e){R.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},_s=class e{get decideEndpointWasHit(){var e;return(e=this.featureFlags?.hasLoadedFlags)!=null&&e}get flagsEndpointWasHit(){var e;return(e=this.featureFlags?.hasLoadedFlags)!=null&&e}constructor(){this.webPerformance=new gs,this.Tr=!1,this.version=ve.LIB_VERSION,this.Rr=new Eo,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=ms(),this.SentryIntegration=Ur,this.sentryIntegration=e=>function(e,t){var n=Hr(e,t);return{name:Vr,processEvent:e=>n(e)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint=`/e/`,this.Cr=!1,this.Ir=null,this.Fr=null,this.Mr=null,this.featureFlags=new go(this),this.toolbar=new Jr(this),this.scrollManager=new Wo(this),this.pageViewManager=new fa(this),this.surveys=new Fo(this),this.productTours=new bo(this),this.experiments=new rs(this),this.exceptions=new ro(this),this.rateLimiter=new Lo(this),this.requestRouter=new ts(this),this.consent=new Ar(this),this.externalIntegrations=new os(this),this.people={set:(e,t,n)=>{var r=I(e)?{[e]:t}:e;this.setPersonProperties(r),n?.({})},set_once:(e,t,n)=>{var r=I(e)?{[e]:t}:e;this.setPersonProperties(void 0,r),n?.({})}},this.on(`eventCaptured`,(e=>R.info(`send "`+e?.event+`"`,e)))}init(t,n,r){if(r&&r!==fs){var i=us[r]??new e;return i._init(t,n,r),us[r]=i,us[fs][r]=i,i}return this._init(t,n,r)}_init(e,t,n){if(t===void 0&&(t={}),F(e)||Ne(e))return R.critical(`PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()`),this;if(this.__loaded)return console.warn(`[PostHog.js]`,`You have already initialized PostHog! Re-initializing is a no-op`),this;this.__loaded=!0,this.config={},t.debug=this.Or(t.debug),this.Ar=t,this.Dr=[],t.person_profiles&&(this.Fr=t.person_profiles),this.set_config(V({},ms(t.defaults),hs(t),{name:n,token:e})),this.config.on_xhr_error&&R.error(`on_xhr_error is deprecated. Use on_request_error instead`),this.compression=t.disable_compression?void 0:$n.GZipJS;var r=this.jr();this.persistence=new vo(this.config,r),this.sessionPersistence=this.config.persistence===`sessionStorage`||this.config.persistence===`memory`?this.persistence:new vo(j({},this.config,{persistence:`sessionStorage`}),r);var i=j({},this.persistence.props),a=j({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Lr=new Vo((e=>this.Nr(e)),this.config.request_queue_config),this.Ur=new Uo(this),this.__request_queue=[];var o=this.config.cookieless_mode===`always`||this.config.cookieless_mode===`on_reject`&&this.consent.isExplicitlyOptedOut();if(o||(this.sessionManager=new Jo(this),this.sessionPropsManager=new Ko(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(R.info(`Deferring extension initialization to improve startup performance`),setTimeout((()=>{this.zr(o)}),0)):(R.info(`Initializing extensions synchronously`),this.zr(o)),ve.DEBUG=ve.DEBUG||this.config.debug,ve.DEBUG&&R.info(`Starting in debug mode`,{this:this,config:t,thisC:j({},this.config),p:i,s:a}),t.bootstrap?.distinctID!==void 0){var s,c,l=this.config.get_device_id(_r()),u=(s=t.bootstrap)!=null&&s.isIdentifiedID?l:t.bootstrap.distinctID;this.persistence.set_property(on,(c=t.bootstrap)!=null&&c.isIdentifiedID?`identified`:`anonymous`),this.register({distinct_id:t.bootstrap.distinctID,$device_id:u})}if(this.Hr()){var d=Object.keys(t.bootstrap?.featureFlags||{}).filter((e=>{var n;return!((n=t.bootstrap)==null||(n=n.featureFlags)==null||!n[e])})).reduce(((e,n)=>{var r;return e[n]=((r=t.bootstrap)==null||(r=r.featureFlags)==null?void 0:r[n])||!1,e}),{}),f=Object.keys(t.bootstrap?.featureFlagPayloads||{}).filter((e=>d[e])).reduce(((e,n)=>{var r,i;return(r=t.bootstrap)!=null&&(r=r.featureFlagPayloads)!=null&&r[n]&&(e[n]=(i=t.bootstrap)==null||(i=i.featureFlagPayloads)==null?void 0:i[n]),e}),{});this.featureFlags.receivedFeatureFlags({featureFlags:d,featureFlagPayloads:f})}if(o)this.register_once({distinct_id:mn,$device_id:null},``);else if(!this.get_distinct_id()){var p=this.config.get_device_id(_r());this.register_once({distinct_id:p,$device_id:p},``),this.persistence.set_property(on,`anonymous`)}return H(T,`onpagehide`in self?`pagehide`:`unload`,this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),t.segment?Br(this,(()=>this.Br())):this.Br(),je(this.config._onCapture)&&this.config._onCapture!==ds&&(R.warn("onCapture is deprecated. Please use `before_send` instead"),this.on(`eventCaptured`,(e=>this.config._onCapture(e.event,e)))),this.config.ip&&R.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}zr(e){var t=performance.now();this.historyAutocapture=new Rr(this),this.historyAutocapture.startIfEnabled();var n=[];n.push((()=>{new Xr(this).startIfEnabledOrStop()})),n.push((()=>{var e;
4this.siteApps=new Zo(this),(e=this.siteApps)==null||e.init()})),e||n.push((()=>{this.sessionRecording=new ls(this),this.sessionRecording.startIfEnabledOrStop()})),this.config.disable_scroll_properties||n.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),n.push((()=>{this.autocapture=new ur(this),this.autocapture.startIfEnabled()})),n.push((()=>{this.surveys.loadIfEnabled()})),n.push((()=>{this.productTours.loadIfEnabled()})),n.push((()=>{this.heatmaps=new da(this),this.heatmaps.startIfEnabled()})),n.push((()=>{this.webVitalsAutocapture=new ca(this)})),n.push((()=>{this.exceptionObserver=new Ir(this),this.exceptionObserver.startIfEnabled()})),n.push((()=>{this.deadClicksAutocapture=new Pr(this,Nr),this.deadClicksAutocapture.startIfEnabled()})),n.push((()=>{if(this.qr){var e=this.qr;this.qr=void 0,this.fi(e)}})),this.Wr(n,t)}Wr(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout((()=>{this.Wr(e,t)}),0);var n=e.shift();if(n)try{n()}catch(e){R.error(`Error initializing extension:`,e)}}var r=Math.round(performance.now()-t);this.register_for_session({$sdk_debug_extensions_init_method:this.config.__preview_deferred_init_extensions?`deferred`:`synchronous`,$sdk_debug_extensions_init_time_ms:r}),this.config.__preview_deferred_init_extensions&&R.info(`PostHog extensions initialized (`+r+`ms)`)}fi(e){var t,n,r,i,a,o,s,c;if(!O||!O.body)return R.info(`document not ready yet, trying again in 500 milliseconds...`),void setTimeout((()=>{this.fi(e)}),500);this.config.__preview_deferred_init_extensions&&(this.qr=e),this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=M(e.supportedCompression,$n.GZipJS)?$n.GZipJS:M(e.supportedCompression,$n.Base64)?$n.Base64:void 0),(t=e.analytics)!=null&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.Fr?this.Fr:`identified_only`}),(n=this.siteApps)==null||n.onRemoteConfig(e),(r=this.sessionRecording)==null||r.onRemoteConfig(e),(i=this.autocapture)==null||i.onRemoteConfig(e),(a=this.heatmaps)==null||a.onRemoteConfig(e),this.surveys.onRemoteConfig(e),this.productTours.onRemoteConfig(e),(o=this.webVitalsAutocapture)==null||o.onRemoteConfig(e),(s=this.exceptionObserver)==null||s.onRemoteConfig(e),this.exceptions.onRemoteConfig(e),(c=this.deadClicksAutocapture)==null||c.onRemoteConfig(e)}Br(){try{this.config.loaded(this)}catch(e){R.critical("`loaded` function failed",e)}this.Gr(),this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.config.cookieless_mode===`always`)&&this.Vr()}),1),new zo(this).load(),this.featureFlags.flags()}Gr(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.Lr)==null||e.enable())}_dom_loaded(){this.is_capturing()&&Dt(this.__request_queue,(e=>this.Nr(e))),this.__request_queue=[],this.Gr()}_handle_unload(){var e,t;this.config.request_batching?(this.Jr()&&this.capture(`$pageleave`),(e=this.Lr)==null||e.unload(),(t=this.Ur)==null||t.unload()):this.Jr()&&this.capture(`$pageleave`,null,{transport:`sendBeacon`})}ci(e){this.__loaded&&(ps?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=qa(e.url,{ip:+!!this.config.ip}),e.headers=j({},this.config.request_headers),e.compression=e.compression===`best-available`?this.compression:e.compression,e.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(e.disableTransport=[`sendBeacon`]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(e=>{var t=j({},e);t.timeout=t.timeout||6e4,t.url=qa(t.url,{_:new Date().getTime().toString(),ver:ve.LIB_VERSION,compression:t.compression});var n=t.transport??`fetch`,r=Xa.filter((e=>!t.disableTransport||!e.transport||!t.disableTransport.includes(e.transport))),i=It
4(r,(e=>e.transport===n))?.method??r[0].method;if(!i)throw Error(`No available transport method`);i(t)})(j({},e,{callback:t=>{var n,r;(this.rateLimiter.checkForLimiting(t),t.statusCode>=400)&&((n=(r=this.config).on_request_error)==null||n.call(r,t)),e.callback==null||e.callback(t)}}))))}Nr(e){this.Ur?this.Ur.retriableRequest(e):this.ci(e)}_execute_array(e){var t,n=[],r=[],i=[];Dt(e,(e=>{e&&(t=e[0],N(t)?i.push(e):je(e)?e.call(this):N(e)&&t===`alias`?n.push(e):N(e)&&t.indexOf(`capture`)!==-1&&je(this[t])?i.push(e):r.push(e))}));var a=function(e,t){Dt(e,(function(e){if(N(e[0])){var n=t;B(e,(function(e){n=n[e[0]].apply(n,e.slice(1))}))}else this[e[0]].apply(this,e.slice(1))}),t)};a(n,this),a(r,this),a(i,this)}Hr(){return this.config.bootstrap?.featureFlags&&Object.keys(this.config.bootstrap?.featureFlags).length>0||!1}push(e){this._execute_array([e])}capture(e,t,n){if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Lr){if(this.is_capturing())if(!F(e)&&I(e)){var r=!this.config.opt_out_useragent_filter&&this._is_bot();if(!(r&&!this.config.__preview_capture_bot_pageviews)){var i=n!=null&&n.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(i==null||!i.isRateLimited){t!=null&&t.$current_url&&!I(t?.$current_url)&&(R.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),t==null||delete t.$current_url),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&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();var a=new Date,o=n?.timestamp||a,s=_r(),c={uuid:s,event:e,properties:this.calculateEventProperties(e,t||{},o,s)};e===`$pageview`&&this.config.__preview_capture_bot_pageviews&&r&&(c.event=`$bot_pageview`,c.properties.$browser_type=`bot`),i&&(c.properties.$lib_rate_limit_remaining_tokens=i.remainingTokens),n!=null&&n.$set&&(c.$set=n?.$set);var l,u=e!==`$groupidentify`,d=this.Kr(n?.$set_once,u);if(d&&(c.$set_once=d),(c=Nt(c,n!=null&&n._noTruncate?null:this.config.properties_string_max_length)).timestamp=o,F(n?.timestamp)||(c.properties.$event_time_override_provided=!0,c.properties.$event_time_override_system_time=a),e===Co.DISMISSED||e===Co.SENT){var f=t?.[wo.SURVEY_ID],p=t?.[wo.SURVEY_ITERATION];l={id:f,current_iteration:p},localStorage.getItem(jo(l))||localStorage.setItem(jo(l),`true`),c.$set=j({},c.$set,{[Ao({id:f,current_iteration:p},e===Co.SENT?`responded`:`dismissed`)]:!0})}var m=j({},c.properties.$set,c.$set);if(Me(m)||this.setPersonPropertiesForFlags(m),!L(this.config.before_send)){var h=this.Yr(c);if(!h)return;c=h}this.Rr.emit(`eventCaptured`,c);var g={method:`POST`,url:n?._url??this.requestRouter.endpointFor(`api`,this.analyticsDefaultEndpoint),data:c,compression:`best-available`,batchKey:n?._batchKey};return!this.config.request_batching||n&&(n==null||!n._batchKey)||n!=null&&n.send_instantly?this.Nr(g):this.Lr.enqueue(g),c}R.critical(`This capture call is ignored due to client rate limiting.`)}}else R.error(`No event name provided to posthog.capture`)}else R.uninitializedWarning(`posthog.capture`)}Ui(e){return this.on(`eventCaptured`,(t=>e(t.event,t)))}calculateEventProperties(e,t,n,r,i){if(n||=new Date,!this.persistence||!this.sessionPersistence)return t;var a=i?void 0:this.persistence.remove_event_timer(e),o=j({},t);if(o.token=this.config.token,o.$config_defaults=this.config.defaults,(this.config.cookieless_mode==`always`||this.config.cookieless_mode==`on_reject`&&this.consent.isExplicitlyOptedOut())&&(o.$cookieless_mode=!0),e===`$snapshot`){var s=j({},this.persistence.properties(),this.sessionPersistence.properties());return o.distinct_id=s.distinct_id,(!I(o.distinct_id)&&!Fe(o.distinct_id)||Ne(o.distinct_id))&&R.error(`Invalid distinct_id for replay event. This indicates a bug in your implementation`),o}var c,l=aa(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:u,windowId:d}=this.sessionManager.checkAndGetSessionAndWindowId(i,n.getTime());o.$session_id=u,o.$window_id=d}this.sessionPropsManager&&V(o,this.sessionPropsManager.getSessionProps());try{this.sessionRecording&&V(o,this.sessionRecording.sdkDebugProperties),o.$sdk_debug_retry_queue_size=this.Ur?.length}catch(e){o.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===$o.CUSTOM&&(o.$lib_custom_api_host=this.config.api_host),c=e!==`$pageview`||i?e!==`$pageleave`||i?this.pageViewM
4anager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,r),o=V(o,c),e===`$pageview`&&O&&(o.title=O.title),!F(a)){var f=n.getTime()-a;o.$duration=parseFloat((f/1e3).toFixed(3))}k&&this.config.opt_out_useragent_filter&&(o.$browser_type=this._is_bot()?`bot`:`browser`),(o=V({},l,this.persistence.properties(),this.sessionPersistence.properties(),o)).$is_identified=this._isIdentified(),N(this.config.property_denylist)?B(this.config.property_denylist,(function(e){delete o[e]})):R.error(`Invalid value for property_denylist config: `+this.config.property_denylist+` or property_blacklist config: `+this.config.property_blacklist);var p=this.config.sanitize_properties;p&&(R.error(`sanitize_properties is deprecated. Use before_send instead`),o=p(o,e));var m=this.Xr();return o.$process_person_profile=m,m&&!i&&this.Qr(`_calculate_event_properties`),o}Kr(e,t){if(t===void 0&&(t=!0),!this.persistence||!this.Xr()||this.Tr)return e;var n=V({},this.persistence.get_initial_props(),this.sessionPropsManager?.getSetOnceProps()||{},e||{}),r=this.config.sanitize_properties;return r&&(R.error(`sanitize_properties is deprecated. Use before_send instead`),n=r(n,`$set_once`)),t&&(this.Tr=!0),Me(n)?void 0:n}register(e,t){var n;(n=this.persistence)==null||n.register(e,t)}register_once(e,t,n){var r;(r=this.persistence)==null||r.register_once(e,t,n)}register_for_session(e){var t;(t=this.sessionPersistence)==null||t.register(e)}unregister(e){var t;(t=this.persistence)==null||t.unregister(e)}unregister_for_session(e){var t;(t=this.sessionPersistence)==null||t.unregister(e)}Zr(e,t){this.register({[e]:t})}getFeatureFlag(e,t){return this.featureFlags.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t=this.featureFlags.getFeatureFlagPayload(e);try{return JSON.parse(t)}catch{return t}}isFeatureEnabled(e,t){return this.featureFlags.isFeatureEnabled(e,t)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateEarlyAccessFeatureEnrollment(e,t,n){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t,n)}getEarlyAccessFeatures(e,t,n){return t===void 0&&(t=!1),this.featureFlags.getEarlyAccessFeatures(e,t,n)}on(e,t){return this.Rr.on(e,t)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSurveysLoaded(e){return this.surveys.onSurveysLoaded(e)}onSessionId(e){return this.sessionManager?.onSessionId(e)??(()=>{})}getSurveys(e,t){t===void 0&&(t=!1),this.surveys.getSurveys(e,t)}getActiveMatchingSurveys(e,t){t===void 0&&(t=!1),this.surveys.getActiveMatchingSurveys(e,t)}renderSurvey(e,t){this.surveys.renderSurvey(e,t)}displaySurvey(e,t){t===void 0&&(t=No),this.surveys.displaySurvey(e,t)}cancelPendingSurvey(e){this.surveys.cancelPendingSurvey(e)}canRenderSurvey(e){return this.surveys.canRenderSurvey(e)}canRenderSurveyAsync(e,t){return t===void 0&&(t=!1),this.surveys.canRenderSurveyAsync(e,t)}identify(e,t,n){if(!this.__loaded||!this.persistence)return R.uninitializedWarning(`posthog.identify`);if(Fe(e)&&(e=e.toString(),R.warn(`The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.`)),e)if([`distinct_id`,`distinctid`].includes(e.toLowerCase()))R.critical(`The string "`+e+`" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.`);else if(e!==mn){if(this.Qr(`posthog.identify`)){var r=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property(`$device_id`)){var i=r;this.register_once({$had_persisted_distinct_id:!0,$device_id:i},``)}e!==r&&e!==this.get_property(Rt)&&(this.unregister(Rt),this.register({distinct_id:e}));var a=(this.persistence.get_property(on)||`anonymous`)===`anonymous`;e!==r&&a?(this.persistence.set_property(on,`identified`),this.setPersonPropertiesForFlags(j({},n||{},t||{}),!1),this.capture(`$identify`,{distinct_id:e,$anon_distinct_id:r},{$set:t||{},$set_once:n||{}}),this.Mr=Qa(e,t,n),this.featureFlags.setAnonymousDistinctId(r)):(t||n)&&this.setPersonProperties(t,n),e!==r&&(this.reloadFeatureFlags(),this.unregister(an))}}else R.critical(`The string "`+mn+`" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.`);else R.error(`Unique user id has not been set in posthog.identify`)}setPersonProperties(e,t){if((e||t)&&this.Qr(`posthog.setPersonProperties`)){var n=Qa(this.get_distinct_id(),e,t);this.Mr===n?R.info(`A duplicate setPersonProperties call was made with the same properties. It has been ignored.`):(this.setPersonPropertiesForFlags(j({},t||{},e||{})),this.capture(`$set`,{$set:e||{},$set_once:t||{}}),this.Mr=n)}}group(e,t,n){if(e&&t){var r=this.getGroups();r[e]!==t&&this.resetGroupPropertiesForFlags(e),this.register({$groups:j({},r,{[e]:t})}),n&&(this.capture(`$groupidentify`,{$group_type:e,$group_key:t,$group_set:n}),this.setGroupPropertiesForFlags({[e]:n})),r[e]===t||n||this.reloadFeatureFlags()}else R.error(`posthog.group requires a group type and group key`)}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}
4setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0),this.featureFlags.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0),this.Qr(`posthog.setGroupPropertiesForFlags`)&&this.featureFlags.setGroupPropertiesForFlags(e,t)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var t,n,r,i;if(R.info(`reset`),!this.__loaded)return R.uninitializedWarning(`posthog.reset`);var a=this.get_property(`$device_id`);if(this.consent.reset(),(t=this.persistence)==null||t.clear(),(n=this.sessionPersistence)==null||n.clear(),this.surveys.reset(),this.featureFlags.reset(),(r=this.persistence)==null||r.set_property(on,`anonymous`),(i=this.sessionManager)==null||i.resetSessionId(),this.Mr=null,this.config.cookieless_mode===`always`)this.register_once({distinct_id:mn,$device_id:null},``);else{var o=this.config.get_device_id(_r());this.register_once({distinct_id:o,$device_id:e?o:a},``)}this.register({$last_posthog_reset:new Date().toISOString()},1)}get_distinct_id(){return this.get_property(`distinct_id`)}getGroups(){return this.get_property(`$groups`)||{}}get_session_id(){return this.sessionManager?.checkAndGetSessionAndWindowId(!0).sessionId??``}get_session_replay_url(e){if(!this.sessionManager)return``;var{sessionId:t,sessionStartTimestamp:n}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor(`ui`,`/project/`+this.config.token+`/replay/`+t);if(e!=null&&e.withTimestamp&&n){var i=e.timestampLookBack??10;if(!n)return r;r+=`?t=`+Math.max(Math.floor((new Date().getTime()-n)/1e3)-i,0)}return r}alias(e,t){return e===this.get_property(Lt)?(R.critical(`Attempting to create alias for existing People user - aborting.`),-2):this.Qr(`posthog.alias`)?(F(t)&&(t=this.get_distinct_id()),e===t?(R.warn(`alias matches current distinct_id - skipping api call.`),this.identify(e),-1):(this.Zr(Rt,e),this.capture(`$create_alias`,{alias:e,distinct_id:t}))):void 0}set_config(e){var t=j({},this.config);if(P(e)){var n,r,i,a,o;V(this.config,hs(e));var s=this.jr();(n=this.persistence)==null||n.update_config(this.config,t,s),this.sessionPersistence=this.config.persistence===`sessionStorage`||this.config.persistence===`memory`?this.persistence:new vo(j({},this.config,{persistence:`sessionStorage`}),s);var c=this.Or(this.config.debug);Ie(c)&&(this.config.debug=c),Ie(this.config.debug)&&(this.config.debug?(ve.DEBUG=!0,U.H()&&U.G(`ph_debug`,`true`),R.info(`set_config`,{config:e,oldConfig:t,newConfig:j({},this.config)})):(ve.DEBUG=!1,U.H()&&U.V(`ph_debug`))),(r=this.sessionRecording)==null||r.startIfEnabledOrStop(),(i=this.autocapture)==null||i.startIfEnabled(),(a=this.heatmaps)==null||a.startIfEnabled(),this.surveys.loadIfEnabled(),this.ts(),(o=this.externalIntegrations)==null||o.startIfEnabledOrStop()}}startSessionRecording(e){var t=!0===e,n={sampling:t||!(e==null||!e.sampling),linked_flag:t||!(e==null||!e.linked_flag),url_trigger:t||!(e==null||!e.url_trigger),event_trigger:t||!(e==null||!e.event_trigger)};if(Object.values(n).some(Boolean)){var r,i,a,o,s;(r=this.sessionManager)==null||r.checkAndGetSessionAndWindowId(),n.sampling&&((i=this.sessionRecording)==null||i.overrideSampling()),n.linked_flag&&((a=this.sessionRecording)==null||a.overrideLinkedFlag()),n.url_trigger&&((o=this.sessionRecording)==null||o.overrideTrigger(`url`)),n.event_trigger&&((s=this.sessionRecording)==null||s.overrideTrigger(`event`))}this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)==null||!e.started)}captureException(e,t){var n=Error(`PostHog syntheticException`),r=this.exceptions.buildProperties(e,{handled:!0,syntheticException:n});return this.exceptions.sendExceptionEvent(j({},r,t))}loadToolbar(e){return this.toolbar.loadToolbar(e)}get_property(e){return this.persistence?.props[e]}getSessionProperty(e){return this.sessionPersistence?.props[e]}toString(){var e=this.config.name??fs;return e!==fs&&(e=fs+`.`+e),e}_isIdentified(){return this.persistence?.get_property(on)===`identified`||this.sessionPersistence?.get_property(on)===`identified`}Xr(){var e,t;return!(this.config.person_profiles===`never`||this.config.person_profiles===`identified_only`&&!this._isIdentified()&&Me(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[Rt])&&((t=this.persistence)==null||(t=t.props)==null||!t[fn]))}Jr(){return!0===this.config.capture_pageleave||this.config.capture_pageleave===`if_capture_pageview`&&(!0===this.config.capture_pageview||this.config.capture_pageview===`history_change`)}
4createPersonProfile(){this.Xr()||this.Qr(`posthog.createPersonProfile`)&&this.setPersonProperties({},{})}Qr(e){return this.config.person_profiles===`never`?(R.error(e+` was called, but process_person is set to "never". This call will be ignored.`),!1):(this.Zr(fn,!0),!0)}jr(){if(this.config.cookieless_mode===`always`)return!0;var e=this.consent.isOptedOut(),t=this.config.opt_out_persistence_by_default||this.config.cookieless_mode===`on_reject`;return this.config.disable_persistence||e&&!!t}ts(){var e,t,n=this.jr();return this.persistence?.wi!==n&&((e=this.persistence)==null||e.set_disabled(n)),this.sessionPersistence?.wi!==n&&((t=this.sessionPersistence)==null||t.set_disabled(n)),n}opt_in_capturing(e){var t;if(this.config.cookieless_mode!==`always`){var n;this.config.cookieless_mode===`on_reject`&&this.consent.isExplicitlyOptedOut()&&(this.reset(!0),(n=this.sessionManager)==null||n.destroy(),this.sessionManager=new Jo(this),this.persistence&&(this.sessionPropsManager=new Ko(this,this.sessionManager,this.persistence)),this.sessionRecording=new ls(this),this.sessionRecording.startIfEnabledOrStop()),this.consent.optInOut(!0),this.ts(),this.Gr(),(t=this.sessionRecording)==null||t.startIfEnabledOrStop(),this.config.cookieless_mode==`on_reject`&&this.surveys.loadIfEnabled(),(F(e?.captureEventName)||e!=null&&e.captureEventName)&&this.capture(e?.captureEventName??`$opt_in`,e?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Vr()}else R.warn(`Consent opt in/out is not valid with cookieless_mode="always" and will be ignored`)}opt_out_capturing(){var e,t;this.config.cookieless_mode===`always`?R.warn(`Consent opt in/out is not valid with cookieless_mode="always" and will be ignored`):(this.config.cookieless_mode===`on_reject`&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.ts(),this.config.cookieless_mode===`on_reject`&&(this.register({distinct_id:mn,$device_id:null}),(e=this.sessionManager)==null||e.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,(t=this.sessionRecording)==null||t.stopRecording(),this.sessionRecording=void 0,this.Vr()))}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===kr.GRANTED?`granted`:e===kr.DENIED?`denied`:`pending`}is_capturing(){return this.config.cookieless_mode===`always`||(this.config.cookieless_mode===`on_reject`?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.ts()}_is_bot(){return D?Qo(D,this.config.custom_blocked_useragents):void 0}
4Vr(){O&&(O.visibilityState===`visible`?this.Cr||(this.Cr=!0,this.capture(`$pageview`,{title:O.title},{send_instantly:!0}),this.Ir&&=(O.removeEventListener(`visibilitychange`,this.Ir),null)):this.Ir||(this.Ir=this.Vr.bind(this),H(O,`visibilitychange`,this.Ir)))}debug(e){!1===e?(T?.console.log(`You've disabled debug mode.`),this.set_config({debug:!1})):(T?.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}))}O(){var e,t,n,r,i,a,o,s=this.Ar||{};return`advanced_disable_flags`in s?!!s.advanced_disable_flags:!1===this.config.advanced_disable_flags?!0===this.config.advanced_disable_decide?(R.warn(`Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version.`),!0):(n=`advanced_disable_decide`,r=!1,i=R,a=(t=`advanced_disable_flags`)in(e=s)&&!F(e[t]),o=n in e&&!F(e[n]),a?e[t]:o?(i&&i.warn(`Config field '`+n+`' is deprecated. Please use '`+t+`' instead. The old field will be removed in a future major version.`),e[n]):r):!!this.config.advanced_disable_flags}Yr(e){if(L(this.config.before_send))return e;var t=N(this.config.before_send)?this.config.before_send:[this.config.before_send],n=e;for(var r of t){if(n=r(n),L(n)){var i=`Event '`+e.event+`' was rejected in beforeSend function`;return Re(e.event)?R.warn(i+`. This can cause unexpected behavior.`):R.info(i),null}n.properties&&!Me(n.properties)||R.warn(`Event '`+e.event+`' has no properties after beforeSend function, this is likely an error.`)}return n}getPageViewId(){return this.pageViewManager.Vt?.pageViewId}captureTraceFeedback(e,t){this.capture(`$ai_feedback`,{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,n){this.capture(`$ai_metric`,{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(n)})}Or(e){var t=Ie(e)&&!e,n=U.H()&&U.q(`ph_debug`)===`true`;return!t&&(!!n||e)}};(function(e,t){for(var n=0;n<t.length;n++)e.prototype[t[n]]=jt(e.prototype[t[n]])})(_s,[`identify`]);var vs,ys=(vs=us[fs]=new _s,function(){function e(){e.done||(e.done=!0,ps=!1,B(us,(function(e){e._dom_loaded()})))}O!=null&&O.addEventListener?O.readyState===`complete`?e():H(O,`DOMContentLoaded`,e,{capture:!1}):T&&R.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),vs),bs=o(`Trackers:PostHog`);n.Union([n.Literal(`enabled`),n.Literal(`disabled`),n.Literal(`no-events`),n.Literal(`debug`)]);function xs(){return i.isCI()?`disabled`:i.isDistillProduction()?`enabled`:`no-events`}function Ss(){return`phc_L18fJzazQIJbs7e7mMtlyqU899pGVj5mweKA1nvmSNz`}var Cs={api_host:`/pulse`,defaults:`2025-05-24`,ui_host:`https://us.posthog.com`,loaded:function(e){let t={dst_env:i.getEnvironment()};i.GIT_HASH&&(t.deployment_id=i.GIT_HASH),e.register(t),e.config.autocapture&&e.opt_in_capturing()},feature_flag_request_timeout_ms:1e3,advanced_disable_feature_flags_on_first_load:!0,autocapture:!1,debug:!1,disable_session_recording:!0,opt_in_site_apps:!0};function ws(){switch(xs()){case`debug`:return{...Cs,debug:!0,autocapture:!0,disable_session_recording:!1,opt_in_site_apps:!0};case`enabled`:return{...Cs,autocapture:!0,disable_session_recording:!1,opt_in_site_apps:!0};default:return{...Cs}}}function Ts(){let e=xs();if(e===`disabled`){bs.info(`PostHog disabled, skipping initialization`);return}let t=Ss();if(!t)return;let n=ws();return bs.debug(`Initializing PostHog`,{mode:e,config:n}),ys.init(t,n)}var Q=o(`Trackers:EventTracker`),Es=class{get size(){return this.queue.length}get batchDelay(){return this.batchDelayMs}constructor(e){this.queue=[],this.maxQueueSize=50,this.batchDelayMs=5e3,this.debounceId=`event-queue-batch`,this.processEvents=e,i.isBrowser()&&document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`hidden`&&this.flush()})}queueEvent(e){if(this.queue.push(e),this.queue.length>=this.maxQueueSize){this.flush();return}ue.debounce(this.debounceId,()=>this.flush(),this.batchDelayMs,w.IGNORE_NEW)}flush(){if(this.queue.length===0)return;let e=[...this.queue];this.queue=[],ue.clear(this.debounceId);try{Q.debug(`Processing events`,{events:e}),this.processEvents(e)}catch(t){Q.warn(`Failed to process queued events`,{error:t,events:e})}}},Ds=class{set processEvents(e){this.eventQueue=new Es(e)}setIdentity(e,t){if(this.posthogNode!==void 0){Q.warn(`Should not call setIdentity for backend`);return}if(this.posthogJS===void 0){Q.warn(`EventTracker used but posthog is not initialized`);return}try{this.posthogJS.identify(e,t)}catch(e){if(String(e).includes(`AbortError`))return;Q.warn(`Error identifying user`,{error:e})}}resetIdentity(){if(this.posthogNode!==void 0){Q.warn(`Should not call resetIdentity for backend`);return}if(this.posthogJS===void 0){Q.warn(`EventTracker used but posthog is not initialized`);return}this.posthogJS.reset()}capture(e,t){this.capturePostHog({...e,distinctId:e.userId},t),this.captureDistillEvent(e)}captureFromContext(e,t){if(!i.isNode()){Q.error(`captureFromContext c
4an only be used on server-side`,{...e});return}let n=this.trackerContext?.get();Q.debug(`captureFromContext: ${e.eventName}`,{...e,...n?{...n}:{context:`none`}});let r=e.userId??n?.user?.id;if(!r){let t=`captureFromContext called without user id in context`;Q.error(t,{...e,...n??{},error:Error(t)});return}let a=!e.userId||e.userId===n?.user?.id?n?.originalUser?.id:void 0;a&&Q.debug(`Tracking event with impersonation`,{eventName:e.eventName,userId:r,impersonatedBy:a}),this.capture({...e,userId:r,impersonatedBy:a},t)}captureAnonymous(e,t){if(this.posthogNode!==void 0)throw Error(`captureAnonymous cannot be used on the server - use capture with explicit userId`);this.capturePostHog({...e,distinctId:`anonymous`},t),this.captureDistillEvent({...e,userId:`anonymous`})}async withTracking(e,t){return this.trackerContext?this.trackerContext.wrapAsync(e,t):(Q.error(`No tracker context found - withTracking called before bootstrap`,{fn:e,context:t}),e())}trackAttributes(e){if(!this.trackerContext){Q.error(`No tracker context found - trackAttributes called before bootstrap`,{attributes:e});return}this.trackerContext.set(e)}capturePostHog({eventName:e,properties:t,entityId:n,distinctId:r,impersonatedBy:i},a){if(xs()===`enabled`){if(this.posthogNode){if(!r){Q.error(`capturePostHog called with distinctId undefined, skipping event capture`,{eventName:e,properties:t,entityId:n,distinctId:r});return}this.posthogNode.capture({distinctId:r,event:e,properties:{...t,entityId:n,impersonatedBy:i}});return}if(this.posthogJS){this.posthogJS.capture(e,{...t,impersonatedBy:i},a);return}Q.warn(`EventTracker used but posthog is not initialized`)}}captureDistillEvent({eventName:e,properties:t,entityId:n,userId:r,impersonatedBy:i}){if(!this.eventQueue){Q.warn(`EventTracker used without a way to send events to internal DB`,{eventName:e,properties:t,entityId:n,userId:r});return}this.eventQueue.queueEvent({userId:r??`anonymous`,entityId:n,eventName:e,properties:t,impersonatedBy:i})}},Os=h(`__eventTracker`,()=>new Ds),ks=class{constructor(){this.flight=null}run(e){return this.flight||=e().finally(()=>{this.flight=null}),this.flight}get inFlight(){return this.flight!==null}},As=class{constructor(e=6e4){this.ttlMs=e,this.flights=new Map,this.timeouts=new Map}run(e,t){let n=this.flights.get(e);if(n)return n.promise;let r=Symbol(e),i=setTimeout(()=>this.cleanup(e,r),this.ttlMs);this.timeouts.set(e,{id:i,token:r});let a=t().finally(()=>{this.cleanup(e,r)});return this.flights.set(e,{promise:a,token:r}),a}invalidate(e){this.cleanup(e)}cleanup(e,t){let n=this.flights.get(e);if(t&&n?.token!==t)return;this.flights.delete(e);let r=this.timeouts.get(e);r&&(!t||r.token===t)&&(clearTimeout(r.id),this.timeouts.delete(e))}inFlight(e){return this.flights.has(e)}get size(){return this.flights.size}},js=/^scraper\d+@distillfyi\.com$/,Ms=new class{isDevCore(e){if(!e||e.email&&ne(e.email))return!1;let t=!!(e.email&&re(e.email)),n=!!p(e).dev,r=!!(e.email&&this.isScraperUserEmail(e.email));return t||n||r}isDevOrConcierge(e){return!e||e.email&&ne(e.email)?!1:this.isDevCore(e)?!0:!!p(e).concierge}isScraperUserEmail(e){return js.test(e)}},Ns=o(`Stores:ExtensionCookie`),Ps=class{constructor({user:e,extensionIds:t}){this.pendingTimeouts=[],this.hasResolved=!1,this.verboseLog=!0,this.user=e,this.extensionIds=t}async extract(){return chrome?.runtime?new Promise(e=>{this.findWorkingExtension(t=>{this.hasResolved||(this.hasResolved=!0,this.cleanup(),e(t))})}):(Qs.capture({eventName:`chrome-extension-no-runtime`,properties:{hasChromeGlobal:typeof chrome<`u`,hasRuntime:typeof chrome<`u`&&!!chrome.runtime,userAgent:navigator.userAgent}}),null)}cleanup(){this.pendingTimeouts.forEach(e=>clearTimeout(e)),this.pendingTimeouts.length=0}async findWorkingExtension(e){Ns.info(`Starting parallel extension discovery`,{extensionCount:this.extensionIds.length});let t=!1,n={};await Promise.all(this.extensionIds.map(async r=>{try{let i=await this.checkExtensionAvailability(r);if(n[r]=i,i.status===`unavailable`)return;this.hasResolved||(Ns.info(`Found potentially working extension`,{extensionId:r,availability:i.status}),this.verboseLog&&Qs.capture({eventName:`chrome-extension-found-working`,properties:{extensionId:r,availability:i.status}}),t=!0,this.requestCookieData(r,e))}catch(e){g.sendError(e)}}
4)),!this.hasResolved&&!t&&(Ns.info(`No working extensions found`,{results:n}),this.verboseLog&&Qs.capture({eventName:`chrome-extension-no-response`,properties:{extensionResults:JSON.stringify(n),extensionCount:this.extensionIds.length,userAgent:navigator.userAgent}}),e(null))}checkExtensionAvailability(e){return new Promise(t=>{let n=!1,r=e=>{n||(n=!0,t(e))};chrome.runtime.sendMessage(e,{user:this.user.id},e=>{let t=chrome.runtime.lastError;r(t?{status:`unavailable`,lastErrorMessage:t.message??`unknown`}:{status:`available`})});let i=setTimeout(()=>{r({status:`sleeping`})},500);this.pendingTimeouts.push(i)})}requestCookieData(e,t){let n={user:this.user.id,cookieCheck:!0};Ns.info(`Requesting cookie data from extension`,{extensionId:e,payload:n});let r=Date.now(),i=a=>{if(a>=20||this.hasResolved){if(!this.hasResolved){let n=Date.now()-r;Ns.warn(`Cookie request failed after max attempts`,{extensionId:e,attempts:a,duration:n}),Qs.capture({eventName:`chrome-extension-no-response`,properties:{extensionId:e,duration:n}}),t(null)}return}if(chrome.runtime.sendMessage(e,n,n=>{if(n&&!this.hasResolved){this.maybeUpdateExtensionVersion(e);let i=Date.now()-r;Ns.info(`Cookie data received from extension`,{extensionId:e,hasCookie:!!n.cookie,duration:i,attempts:a+1}),n.allCookies&&n.allCookies.length>1&&(Ns.debug(`Multiple cookies detected`,{extensionId:e,cookieCount:n.allCookies.length}),Qs.capture({eventName:`multiple-cookies-detected`,properties:{cookies:JSON.stringify(n.allCookies)}})),a>2&&(Ns.debug(`Slow extension response`,{extensionId:e,attempts:a+1,duration:i}),Qs.capture({eventName:`chrome-extension-slow-response`,properties:{extensionId:e,duration:i}})),t({cookie:n.cookie,id:e,li_rm:n.li_rm,li_a:n.li_a});return}}),!this.hasResolved){let e=setTimeout(()=>{i(a+1)},500);this.pendingTimeouts.push(e)}};i(0)}maybeUpdateExtensionVersion(e){chrome?.runtime?.sendMessage(e,{message:`version`},t=>{t.version&&(t.version!==this.user.meta?.ext_ver&&(Ns.info(`Updating extension version`,{extensionId:e,version:t.version}),_.updateUserMeta({meta:{ext_ver:t.version}})),Qs.capture({eventName:`chrome-extension-version`,properties:t}))})}},Fs=`https://help.distill.com/`,Is=`https://chromewebstore.google.com/detail/distill/kidifhledoijjifmngjkaclhdoffdneg`,Ls=`https://distill.com/help/What-can-I-update-on-my-Distill-profile-365a568b6b854b158eb5d89a58636fb6?pvs=21`,Rs=/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,zs=(e={})=>{let t=x(e);return t.setKey=function(e,n){let r=t.value;n===void 0&&e in t.value?(t.value={...t.value},delete t.value[e],t.notify(r,e)):t.value[e]!==n&&(t.value={...t.value,[e]:n},t.notify(r,e))},t},Bs=ee();function Vs(e,t,n){return{title:`Questions or issues?`,subtitle:``,instructions:(0,Bs.jsxs)(Bs.Fragment,{children:[(0,Bs.jsxs)(`div`,{className:`text-sm mt-4`,children:[`Current page: `,t,` (`,n,`)`]}),(0,Bs.jsxs)(`div`,{className:`text-sm mt-4`,children:[`Need help? Check out our`,` `,(0,Bs.jsx)(ce,{className:`text-brand-600 hover:underline`,href:Fs,target:`_blank`,rel:`noopener noreferrer`,children:`Help Center`}),` `,`for answers to common questions.`]}),(0,Bs.jsxs)(`div`,{className:`text-sm mt-4`,children:[`Can't find what you're looking for? Let us know and we'll get back to you right away! You can also email us anytime at`,` `,(0,Bs.jsx)(ce,{className:`text-brand-600 hover:underline`,href:`mailto:[email protected]`,children:`[email protected]`})]})]}),type:`info`,fields:[{currentValue:e?.email||``,placeholder:`Your email address`},{currentValue:``,placeholder:`Describe what's wrong`,multiline:!0}],onSubmit:async e=>{if(!e[0])throw new s(`Please enter your email address`);if(!e[1])throw new s(`Please describe what's wrong`);await _.emailSupport({email:e[0],message:e[1],currentTitle:document.title,currentHref:n})}}}var Hs=new class{constructor(){this.analyses=zs({}),this.loading=zs({}),this.pending=zs({}),this.simulatedErrorKeys=new Set}getAnalysis(e,t,n){let r=this.getAnalysisKey(e,t,n);return this.analyses.get()[r]?.analysis}getPromptVersion(e,t,n){let r=this.getAnalysisKey(e,t,n);return this.analyses.get()[r]?.promptVersion}getAnalysisKey(e,t,n){return`from${e}to${t}${n}`}isLoading(e,t,n){let r=this.getAnalysisKey(e,t,n);return this.loading.get()[r]||!1}isPending(e,t,n){let r=this.getAnalysisKey(e,t,n);return this.pending.get()[r]||!1}setPending(e,t,n,r){let i=this.getAnalysisKey(e,t,n);this.pending.setKey(i,r)}setAnalysis(e,t,n,r,i){let a=this.getAnalysisKey(e,t,n);this.analyses.setKey(a,{analysis:r,promptVersion:i})}setLoading(e,t,n,r){let i=this.getAnalysisKey(e,t,n);this.loading.setKey(i,r)}hasAnalysis(e,t,n){return this.getAnalysisKey(e,t,n)in this.analyses.get()}clear(){this.analyses.set({}),this.loading.set({}),this.pending.set({}),this.simulatedErrorKeys.clear()}clearAnalysisForEntity(e){let t=this.analyses.get(),n=Object.keys(t).filter(t=>t.includes(e));if(n.length===0)return;let r={...t};for(let e of n)delete r[e];this.analyses.set(r)}async simulateTransientError(e,t,n){if(!i.isDevelopment())return;let r=this.getAnalysisKey(e,t,n);this.simulatedErrorKeys.add(r);let a=this.analyses.get();if(r in a){let{[r]:e,...t}=a;this.analyses.set(t)}await this.analyzeMutualConnection(e,t,n)}getCachedKeys(){return Object.keys(this.analyses.get())}async analyzeMutualConnection(e,t,n,i=!1){if(!i&&this.hasAnalysis(e,t,n))return this.getAnalysis(e,t,n)||null;if(this.isLoading(e,t,n))return null;try{this.setLoading(e,t,n,!0);let r=this.getAnalysisKey(e,t,n);if(this.simulatedErrorKeys.has(r)){this.simulatedErrorKeys.delete(r);let e=Error(`Simulated transient network error`);throw e.isHttpError=!0,e}let i;i=n===f.EmailOpeners?await _.analyzeEntities({targetEntityId:t,mode:f.EmailOpeners}
4):n===f.SharedBackground?await _.analyzeEntities({targetEntityId:t,mode:f.SharedBackground}):n===f.WhatPersonDidAtCompany?await _.analyzeEntities({fromId:e,toId:t,mode:f.WhatPersonDidAtCompany}):await _.analyzeEntities({entityId:e,otherEntityIds:[t],mode:f.HowTheyKnowEachOther});let a=i?.[t];if(a?.status===m.PENDING)return this.setPending(e,t,n,!0),null;this.setPending(e,t,n,!1);let o=a?.analysis;return o||=this.getFailedAnalysisFallback(),this.setAnalysis(e,t,n,o,a?.promptVersion),o}catch(i){let a=r(i)&&!i.response;if(g.sendError(i,{source:`analyze-mutual-connection`,isTransient:a}),a)return null;let o=this.getFailedAnalysisFallback();return this.setAnalysis(e,t,n,o),o}finally{this.setLoading(e,t,n,!1)}}getFailedAnalysisFallback(){return{summary:`Failed to get analysis`,strength:0,positive:[],differences:[],speculative:[]}}applyIncomingAnalysis(e){let{fromId:t,toId:n,analysis:r,promptVersion:i,failed:a}=e,o=f.HowTheyKnowEachOther;this.setPending(t,n,o,!1),this.setLoading(t,n,o,!1),r?this.setAnalysis(t,n,o,r,i):a&&!this.hasAnalysis(t,n,o)&&this.setAnalysis(t,n,o,this.getFailedAnalysisFallback())}async regenerateEmailOpenerCategories(e,t){let n=f.EmailOpeners;if(this.isLoading(`user`,e,n))return null;try{this.setLoading(`user`,e,n,!0);let r=(await _.analyzeEntities({targetEntityId:e,mode:f.EmailOpeners,options:{regenerateCategories:t}}
4))?.[e],i=r?.analysis;return i||=this.getFailedAnalysisFallback(),this.setAnalysis(`user`,e,n,i,r?.promptVersion),i}catch(e){return g.sendError(e,{source:`regenerate-email-opener-categories`}),null}finally{this.setLoading(`user`,e,n,!1)}}isAnalysisStrongEnoughToShow(e,t=1){return!!(e&&e.positive.length>0&&e.strength>=t)}async deleteOpener(e,t,n,r){let i=f.EmailOpeners,a=this.getAnalysisKey(e,t,i),o=this.analyses.get()[a];if(!o)throw Error(`No cached analysis to delete from`);let s=o.analysis,c=s.positive?.length??0,l=s.speculative?.length??0,u;if(n<c){let e=n;u={...s,positive:[...s.positive.slice(0,e),...s.positive.slice(e+1)]}}else if(n<c+l){let e=n-c;u={...s,speculative:[...s.speculative?.slice(0,e)??[],...s.speculative?.slice(e+1)??[]]}}else{let e=n-c-l;u={...s,differences:[...s.differences?.slice(0,e)??[],...s.differences?.slice(e+1)??[]]}}this.setAnalysis(e,t,i,u,o.promptVersion);try{let a=await _.deleteOpener({entityId:t,openerIndex:n,openerText:r});this.setAnalysis(e,t,i,a.updatedAnalysis,o.promptVersion)}catch(r){throw this.setAnalysis(e,t,i,s,o.promptVersion),g.sendError(r,{context:`deleteOpener`,toId:t,openerIndex:n}),r}}},Us=e({CHROME_EXTENSION_IDS:()=>tc,PROD_CHROME_EXTENSION:()=>$s,PROD_EXTENSION_SCRAPER:()=>ec,uiStore:()=>Qs}),$=o(`Stores:UiStore`),Ws=1e3*60*5,Gs=24;function Ks(e){return e?`${e.length}:${e.slice(-12)}`:``}var qs=e=>e?i.isDevelopment()||Ms.isDevOrConcierge(e):!1,Js=e=>e?.email?re(e.email):!1,Ys={status:`unknown`,errorAccounts:[]},Xs={status:`unknown`,errorAccounts:[]};function Zs(e){if(!e||typeof e!=`object`)return null;let t=e.response;if(!t||t.status!==409)return null;let n=t.data;if(!n||typeof n!=`object`)return null;let{error:r,expectedHandle:i}=n;return r!==`cookie_identity_mismatch`||typeof i!=`string`||!i?null:{expectedHandle:i}}var Qs=new class{constructor(){this.beforeUnloadListenerAdded=!1,this.impersonationListenerAdded=!1,this.setupInProgress=!1,this.sidebarVisible=x(!1),this.bootstrapStatus=x(`pending`),this.bootstrapSession=x(null),this.bootstrapWorkspace=x(void 0),this.bootstrap$=new ks,this.user=x(),this.originalUser=x(null),this.isImpersonating=S([this.originalUser],e=>!!e),this.hasCampaigns=x(!1),this.linkedinPremium=x(),this.activeProjectId=x(null),this.connectionSyncStatus=x(null),this.connectionSyncScheduled=x(null),this.googleContactSyncStatus=x(null),this.totalContactsSyncStatus=S([this.connectionSyncStatus,this.googleContactSyncStatus],(e,t)=>e&&t?{completed:e.completed+t.completed}:e||t||null),this.isDev=x(!1),this.canBeDev=S([this.user,this.originalUser],(e,t)=>qs(e)||qs(t)),this.isDistillTeamMember=S([this.user,this.originalUser],(e,t)=>Js(e)||Js(t)),this.devModeHeader=S([this.isDev,this.canBeDev,this.isImpersonating],(e,t,n)=>t&&e&&!n?`true`:void 0),this.loadedAt=x(null),this.loadedWithGitHash=x(null),this.loadedWithVersion=x(null),this.uiVersion=x(i.GIT_HASH||``),this.showConfirmModal=x(),this.showListSelectorModal=x(),this.showSeatCountModal=x(),this.showInputModal=x(),this.editSequencesModal=x(),this.showInvitesModal=x(!1),this.showConnectionInviteModal=x(!1),this.integrations=zs({linkedin:{...Xs},gmail:{...Ys},google:{...Ys}}),this.liCookieStatus=S(this.integrations,e=>e.linkedin.status),this.linkedInAuthUpdatedAt=x(0),this.failedCookiesCount=x(),this.userProfile=x(null),this.userOrgs=x(void 0),this.userOrgsLoadFailed=x(!1),this.orgMemberEntityIds=x(new Set),this.distillConnectionEntityIds=x(new Set),this.adminOrgMembers=x(void 0),this.autofocusSearchBar=x(!1),this.smallScreen=x(!1),this.recentConversations=x([]),this.recentActivity=x([]),this.currentHash=x(null),this.hiddenIdsStore=S(this.user,e=>{if(!e)return new Set;let t=p(e).hidden_entity_ids??[];return new Set(t)}),this.hiddenEntityIds=S(this.user,e=>e?new Set(p(e).hidden_entity_ids??[]):new Set),this.mountDevKeyShortcut=(()=>{let e=!1;return()=>{e||typeof window>`u`||!qs(this.user.get())||(e=!0,window.addEventListener(`keydown`,e=>{e.key==="`"&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&!e.shiftKey&&(e.preventDefault(),this.isDev.set(!this.isDev.get()))}))}})(),this.bootstrap=()=>
4this.bootstrapStatus.get()===`pending`?this.bootstrap$.run(async()=>{if(this.bootstrapStatus.get()===`pending`)try{let e=await _.getWorkspace({});if(!e||!e.session){this.bootstrapStatus.set(`loggedOut`);return}this.bootstrapSession.set(e.session),this.bootstrapWorkspace.set(e),this.init(e),this.bootstrapStatus.set(`ready`)}catch(e){g.sendError(e instanceof Error?e:Error(String(e)),{source:`workspace-bootstrap`}),this.bootstrapStatus.set(`loggedOut`)}}):Promise.resolve(),this.init=e=>{if(typeof window>`u`||(_.setPersistentHeader(`X-Request-Dev-Mode`,this.devModeHeader.get()),this.devModeHeader.subscribe(e=>{_.setPersistentHeader(`X-Request-Dev-Mode`,e)}),this.loadedAt.get()||(this.loadedAt.set(Date.now()),this.checkVersionAndMaybeRefresh()),this.smallScreen.set(document.body.clientWidth<768),this.migrateToDotCom()))return;let t=this.user.get(),n=e.user;switch(this.originalUser.set(e.originalUser||null),!t&&n?`login`:t&&!n?`logout`:t&&n&&t.id!==n.id?`user-changed`:`no-change`){case`login`:case`user-changed`:n&&this.setupUser(n);break;case`logout`:this.setNoUser();break;case`no-change`:break}nc(e)&&(e.cookieFragments&&this.checkCookieFragments(e.cookieFragments),e.integrationErrors&&this.checkIntegrationErrors(e.integrationErrors),e.linkedinAccountStatus!==void 0&&this.setLinkedinAccountStatus(e.linkedinAccountStatus),this.failedCookiesCount.set(e.failedCookiesCount||void 0),this.hasCampaigns.set(e.hasCampaigns??!1),this.linkedinPremium.set(e.linkedinPremium??!1),this.orgMemberEntityIds.set(new Set(e.orgMemberEntityIds??[])),this.distillConnectionEntityIds.set(new Set(e.distillConnectionEntityIds??[]))),t===void 0&&!n&&this.user.set(null);let r=()=>{let e=window.location.hash,t=e.startsWith(`#`)?e.substring(1):e;t?this.currentHash.set(t):this.currentHash.get()&&this.currentHash.set(null)};window.addEventListener(`hashchange`,r),r();let i=()=>{this.smallScreen.set(window.innerWidth<768)};i(),window.addEventListener(`resize`,i),this.impersonationListenerAdded||(this.impersonationListenerAdded=!0,window.addEventListener(`storage`,e=>{if(e.key===`impersonation-change`&&e.newValue)try{let t=JSON.parse(e.newValue),n=this.user.get()?.id,r=this.isImpersonating.get();if(t.type===`start`&&r&&n===t.userId||t.type===`stop`&&!r){this.showConfirmModal.get()?.source===`impersonation-change`&&this.showConfirmModal.set(void 0);return}let i=t.type===`start`?`Impersonation changed to ${t.name}`:`Impersonation ended${t.name?`, you are back to being ${t.name}`:``}`;this.showConfirmModal.set({type:`warning`,title:i,onClick:()=>window.location.reload(),okText:`Reload this page`,cancelText:`Dismiss (be careful)`,source:`impersonation-change`})}catch{}})),this.mountDevKeyShortcut()},this.checkVersionAndMaybeRefresh=async()=>{let e=await _.getVersion().catch(e=>{setTimeout(()=>void this.checkVersionAndMaybeRefresh(),Ws)});if(!e)return;this.loadedWithVersion.get()||this.loadedWithVersion.set(e.frontendRefreshVersion),this.loadedWithGitHash.get()||this.loadedWithGitHash.set(e.gitHash);let t=this.loadedAt.get();if(this.loadedWithVersion.get()!==e.frontendRefreshVersion||this.loadedWithGitHash.get()!==e.gitHash&&t!==null&&C(new Date,t)>Gs){this.capture({eventName:`version-changed`,properties:{oldVersion:this.loadedWithVersion.get(),newVersion:e.frontendRefreshVersion,oldHash:this.loadedWithGitHash.get(),newHash:e.gitHash}}),document.visibilityState===`hidden`?(this.capture({eventName:`version-changed-refresh-now`}),location.reload()):(this.capture({eventName:`version-changed-refresh-later`}),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`hidden`&&(this.capture({eventName:`version-changed-refresh-later-happened`}),location.reload())},{once:!0}));return}setTimeout(()=>void this.checkVersionAndMaybeRefresh(),Ws)},this.setupUser=async e=>{let t=this.user.get();if(this.setupInProgress&&(!t||t.id===e.id)){$.debug(`User setup already in progress, skipping duplicate call`,{userId:e.id,userEmail:e.email,hasCurrent:!!t});return}this.setupInProgress=!0;try{this.user.set(e),se.resetAuthFailure(),t?.id!==e.id&&(se.reset(),this.resetUserOrgsForAuthChange()),i.isInCrossOriginIframe()?($.debug(`Cross-origin iframe detected, val
4idating session`,{userId:e.id,userEmail:e.email}),await this.validateSessionInBackground(e)):await this.completeUserSetup(e).catch(t=>{$.error(`User setup failed for ${e.email}`,{error:t,userId:e.id,userEmail:e.email}),g.sendError(t)})}finally{this.setupInProgress=!1}},this.validateSessionInBackground=async e=>{try{let t=await _.user.get(),n=this.user.get();if(n?.id!==e.id){$.debug(`User changed during validation, ignoring stale validation result`,{validatedUserId:e.id,validatedUserEmail:e.email,currentUserId:n?.id,currentUserEmail:n?.email});return}if(!t?.id){$.debug(`Cross-origin iframe session validation skipped (API endpoint missing id field), using SSR user`,{ssrUserId:e.id,ssrUserEmail:e.email}),await this.completeUserSetup(e);return}if(t.id!==e.id){$.warn(`Cross-origin iframe session user mismatch`,{ssrUserId:e.id,ssrUserEmail:e.email,sessionUserId:t.id,sessionUserEmail:t.email}),this.setNoUser();return}$.debug(`Cross-origin iframe session validated, completing setup`,{userId:t.id,userEmail:t.email}),await this.completeUserSetup(e)}catch(t){let n=this.user.get();if(n?.id!==e.id){$.debug(`User changed during validation, ignoring stale validation error`,{validatedUserId:e.id,validatedUserEmail:e.email,currentUserId:n?.id,currentUserEmail:n?.email});return}$.debug(`Cross-origin iframe has no valid session, clearing user`,{error:t}),this.setNoUser()}},this.hasSet=!1,this.completeUserSetup=async e=>{if(this.canBeDev.get()&&$.level===a.WARN&&($.level=a.INFO),!this.hasSet&&!this.isImpersonating.get()){let t={email:e.email,name:e.name,userId:e.id,welcomedAt:e.welcomedAt?new Date(e.welcomedAt):void 0,onboarded:p(e).onb},n=await _.getTagsByUserId({userId:e.id}).catch(()=>[]);n.length>0&&(t.tags=n),Os.setIdentity(e.id,t),g.setUser(e),this.capture({eventName:`success-ui-logged-in`,properties:{email:e.email}}),this.hasSet=!0}this.loadRecentActivity(),this.loadUserOrgs(),this.startUserListener(),this.fetchConnectionSyncStatus(),this.stampBrowserTimezone(e.id).catch(t=>{g.sendError(t,{msg:`Failed to set timezone`,userId:e.id})})},this.stampBrowserTimezone=async e=>{if(this.isImpersonating.get()||!this.isCurrentUser(e)||this.user.get()?.timezone)return;let t=await _.user.update({timezone:Intl.DateTimeFormat().resolvedOptions().timeZone});this.user.get()?.timezone||this.patchCurrentUser(e,{timezone:t.timezone,timezoneSetByUser:t.timezoneSetByUser})},this.isCurrentUser=e=>this.user.get()?.id===e,this.patchCurrentUser=(e,t)=>{let n=this.user.get();n?.id===e&&this.user.set({...n,...t})},this.getConnectionsSyncKey=e=>({storageKey:`connections-sync-${e}`,today:d(new Date,{representation:`date`})}),this.maybeTriggerConnectionsSync=(e,t)=>{if(typeof localStorage>`u`)return $.debug(`localStorage not available (SSR)`,{userId:e}),!1;let{storageKey:n,today:r}=this.getConnectionsSyncKey(e),i=localStorage.getItem(n);return!t&&i===r?($.debug(`Connections sync already triggered today`,{userId:e,lastSyncDate:i}),!1):(this.triggerConnectionsSync(e),!0)},this.triggerConnectionsSync=async e=>{let{storageKey:t,today:n}=this.getConnectionsSyncKey(e);localStorage.setItem(t,n),$.info(`Checking connections sync`,{userId:e,today:n});try{let t=await _.triggerConnectionsSync({});return t.triggered?$.info(`Connections sync triggered`,{userId:e,nextSyncType:t.nextSyncType}):$.debug(`Connections sync not needed`,{userId:e,nextSyncType:t.nextSyncType,nextSyncAt:t.nextSyncAt}),t}catch(t){throw $.warn(`Failed to check connections sync`,{error:t,userId:e}),t}},this.fetchConnectionSyncStatus=async()=>{try{let e=await _.getConnectionSyncStatus({});$.debug(`Fetched connection sync status`,{status:e});let t=null;if(e.hasActiveSync&&e.lastSyncRun&&(t={completed:e.lastSyncRun.progressCompleted}),e.hasScheduledSync&&e.scheduledAt){let t=e.lastSyncRun?{completed:e.lastSyncRun.progressCompleted,total:e.lastSyncRun.progressTotal}:void 0;this.connectionSyncScheduled.set({scheduledAt:e.scheduledAt,lastProgress:t})}else this.connectionSyncScheduled.set(null);$.debug(`Setting connection sync status`,{progress:t}),this.connectionSyncStatus.set(t)}catch(e){$.warn(`Failed to fetch connection sync status`,{error:e})}},this.setNoUser=()=>{this.user.set(null),this.resetUserOrgsForAuthChange(),this.adminOrgMembers.set(void 0),this.orgMember
4EntityIds.set(new Set),this.distillConnectionEntityIds.set(new Set)},this.showDevTools=()=>this.isDev.get(),this.getConnectedRealtime=async()=>se.getClient(),this.toggleSidebar=()=>{this.sidebarVisible.set(!this.sidebarVisible.get())},this.isSmallScreen=()=>typeof document<`u`&&document.body.clientWidth<640,this.updateUser=async e=>{let t=this.user.get()?.id;if(!t)return;let n=await _.user.update(e),r={};e.name!==void 0&&(r.name=n.name),e.image!==void 0&&(r.image=n.image),this.patchCurrentUser(t,r)},this.saveTimezone=async e=>{let t=this.user.get()?.id;if(!t)return;let n=await _.saveUserTimezone({timezone:e});this.patchCurrentUser(t,{timezone:n.timezone,timezoneSetByUser:n.timezoneSetByUser})},this.updateUserMeta=async e=>{let n=this.user.get();if(n)try{let t=await _.updateUserMeta({meta:e});return this.patchCurrentUser(n.id,{meta:t}),$.debug(`Successfully updated user meta`,{user:n}),t}catch(e){$.error(`Error updating user meta`,{error:e}),te.error(t(e));return}},this.routeTo=e=>{location.pathname!=e&&($.info(`routeTo`,{path:e}),this.router?this.router.push(e):location.href=e)},this.reloadPage=()=>{window.location.reload()},this.loadUserProfile=async()=>{if(this.userProfile.get())return this.userProfile.get();let e=await _.userProfile.get()||{};return this.userProfile.set(e),e},this.userOrgsGeneration=0,this.resetUserOrgsForAuthChange=()=>{this.userOrgsGeneration+=1,this.userOrgs.set(void 0),this.userOrgsLoadFailed.set(!1),this.userOrgsLoadPromise=void 0},this.ensureUserOrgs=()=>this.userOrgs.get()===void 0?(this.userOrgsLoadPromise??=this.loadUserOrgs().finally(()=>{this.userOrgsLoadPromise=void 0}),this.userOrgsLoadPromise):Promise.resolve(),this.loadUserOrgs=async()=>{let e=this.userOrgsGeneration;this.userOrgs.set(void 0),this.userOrgsLoadFailed.set(!1);try{let t=await _.getOrgMine({});if(this.userOrgsGeneration!==e)return;this.userOrgs.set(t)}catch(t){if($.warn(`Failed to load user orgs`,{error:t}),this.userOrgsGeneration!==e)return;this.userOrgs.set([]),this.userOrgsLoadFailed.set(!0)}},this.loadAdminOrgMembers=async()=>{if(this.adminOrgMembers.get()!==void 0)return;let e=this.userOrgs.get();if(!e)return;let t=e.filter(e=>e.role===`admin`).map(e=>e.id);if(t.length===0){this.adminOrgMembers.set([]);return}let n=this.user.get()?.id;try{let e=(await Promise.all(t.map(e=>_.getOrgMembers(e)))).flat(),r=new Set,i=e.filter(e=>e.user.id===n||r.has(e.user.id)?!1:(r.add(e.user.id),!0)).map(e=>e.user);this.adminOrgMembers.set(i)}catch(e){$.warn(`Failed to load admin org members`,{error:e}),this.adminOrgMembers.set(void 0)}},this.loadRecentActivity=async()=>{try{let{items:e}=await _.getRecentActivity({}),t=e.map(e=>({...e,viewedAt:new Date(e.viewedAt)}));return this.recentActivity.set(t),t}catch(e){return $.warn(`Failed to load recent activity`,{error:e}),this.recentActivity.set([]),[]}},this.focusSearchBar=()=>{this.autofocusSearchBar.set(!0),setTimeout(()=>{this.autofocusSearchBar.set(!1)},500)},this.migrateToDotCom=()=>{if(typeof window>`u`)return!1;let e=window.location.hostname;return e!==`distill.fyi`&&e!==`www.distill.fyi`?!1:(window.location.href=`https://distill.com${window.location.pathname}${window.location.search}${window.location.hash}`,!0)},this.logOut=async()=>(Os.resetIdentity(),localStorage.removeItem(`$set`),le({callbackUrl:`/`})),this.checkedCookies=!1,this.setLinkedInStatus=(e,t)=>{let n=this.integrations.get().linkedin,r=t?.lockedHandle===void 0?e===`wrong-account`?n.lockedHandle:void 0:t.lockedHandle;this.integrations.setKey(`linkedin`,{status:e,errorAccounts:[],...r===void 0?{}:{lockedHandle:r},...n.accountStatus===void 0?{}:{accountStatus:n.accountStatus}})},this.resetLinkedInIntegration=()=>{this.integrations.setKey(`linkedin`,{...Xs}),this.checkedCookies=!1},this.checkIntegrationErrors=e=>{for(let t of[`gmail`,`google`]){let n=e[t]||[];this.integrations.setKey(t,{status:n.length>0?`error`:`valid`,errorAccounts:n.map(e=>e.email)})}},this.checkCookieFragments=(e,t=!1)=>{if(this.checkedCookies&&!t)return;this.checkedCookies=!0;let n=this.integrations.get().linkedin.status;n!==`valid`&&this.setLinkedInStatus(`unknown`),$.info(`checkCookieFragments`,{fragments:e,status:n});let r=Object.keys(e);r.some(e=>e.includes(`linkedin.com`))||r.push(`www.linkedin.com`),Promise.allSettled(r.map(async t=>{let n=e[t]||[],r=await this.checkCookies(n,t);t.includes(`linkedin.com`)&&this.setLinkedInStatus(r)}
4)).catch(e=>{$.warn(`Unexpected error in cookie fragment checks`,{domains:r,error:e instanceof Error?e.message:String(e)})})},this.checkForCookiesWhenUserComesBack=()=>{document.removeEventListener(`visibilitychange`,rc),document.addEventListener(`visibilitychange`,rc)},this.checkCookies=async(e,t)=>{let n=this.user.get();if($.info(`checking for cookies`,{userId:n?.id,userEmail:n?.email,hostname:t}),!n||!t.includes(`linkedin.com`)||typeof chrome>`u`)return e.length>0?`valid`:`missing`;let r=await new Ps({user:n,extensionIds:tc}).extract();$.info(`foundChromeCookie`,{foundChromeCookie:r});let i=r?.cookie,a=e.length>0?`valid`:void 0;if(i&&r){let t=d(new Date,{representation:`date`}),o=r.li_rm,s=r.li_a,c=`try-save-cookie`,l=`${t}-${n.id}-${Ks(i)}-${Ks(s)}`,u=localStorage.getItem(c),f=u===l?`logged-out`:u&&u.startsWith(`${l}:`)?u.slice(l.length+1):null;if(e.find(e=>i.endsWith(e)))if(this.capture({eventName:`chrome-cookie-matched`}),$.info(`[li] chrome cookie matched`),s&&f!==`valid`)$.info(`[li] chrome li_a present; refreshing server cookie state`);else return this.maybeTriggerConnectionsSync(n.id),`valid`;if(!s&&f===`valid`)return this.maybeTriggerConnectionsSync(n.id),`valid`;let p=f!==null;if(this.capture({eventName:`chrome-cookie-no-match`,properties:{trySaveCookie:p}}),$.info(`[li] chrome cookie no match`,{cookie:r.cookie,trySaveCookie:p,storedOutcome:f}),f===`valid`)return`valid`;if(f===`logged-out`)return a||`logged-out`;try{let{updatedAuthCookie:e}=await this.updateCookies({li_at:i,li_rm:o,li_a:s});return e&&($.info(`auth cookie replaced with updated value`,{updatedAuthCookie:e}),this.updateBrowserCookies([e])),localStorage.setItem(c,`${l}:valid`),this.maybeTriggerConnectionsSync(n.id,!0),`valid`}catch(e){let t=Zs(e);if(t)return $.info(`[li] chrome cookie rejected: identity mismatch`,{lockedHandle:t.expectedHandle}),`wrong-account`;$.warn(`saving cookie failed`,{error:e}),this.capture({eventName:`chrome-cookie-set-error`,properties:{error:e}})}return localStorage.setItem(c,`${l}:logged-out`),this.maybeTriggerConnectionsSync(n.id,!0),a||`logged-out`}else if(r)return this.capture({eventName:`chrome-cookie-empty`,properties:{cookies:e.length}}),a||`logged-out`;else return this.capture({eventName:`no-chrome-extension`,properties:{cookies:e.length,userAgent:navigator.userAgent,hasChromeRuntime:typeof chrome<`u`&&!!chrome?.runtime?.sendMessage}}),a||`no-extension`},this.updateCookies=async({li_at:e,li_rm:t,li_a:n,manualImpersonatingOverride:r})=>{let i=[{domain:`www.linkedin.com`,name:`li_at`,value:e,meta:{ua:navigator.userAgent}}];t&&i.push({domain:`www.linkedin.com`,name:`li_rm`,value:t}),n&&i.push({domain:`www.linkedin.com`,name:`li_a`,value:n});let a=this.user.get(),o;try{o=await _.updateCookies({cookies:i,...r?{manualImpersonatingOverride:!0}:{}})}catch(e){let t=Zs(e);throw t&&(this.setLinkedInStatus(`wrong-account`,{lockedHandle:t.expectedHandle}),this.capture({eventName:`cookie-identity-mismatch`,properties:{lockedHandle:t.expectedHandle}})),e}let{meta:s,entity:c,updatedAuthCookie:l}=o;return $.info(`updated cookies`,{meta:s,entity:c}),a&&s&&this.isCurrentUser(a.id)&&(this.patchCurrentUser(a.id,{meta:s}),p(a).li_profile!==s.li_profile&&this.triggerConnectionsSync(a.id)),this.linkedInAuthUpdatedAt.set(this.linkedInAuthUpdatedAt.get()+1),{updatedAuthCookie:l,entity:c}},this.ingestUtmSource=(e,t)=>{let n=this.getAndDeleteUrlParam(`utm_source`);n&&this.capture({eventName:`${e}-${n}`,properties:t})},this.getAndDeleteUrlParam=e=>{if(window){let t=new URLSearchParams(window.location.search),n=t.get(e);if(n){t.delete(e);let n=t.toString().length?`${window.location.pathname}?${t.toString()}`:window.location.pathname;window.history.replaceState({},``,n)}return n}},this.cleanupUserListeners=()=>{this.userListenerCleanup?.(),this.userListenerCleanup=void 0,this.linkedinStatusRefetchTimer!==void 0&&(clearTimeout(this.linkedinStatusRefetchTimer),this.linkedinStatusRefetchTimer=void 0)},this.setLinkedinAccountStatus=e=>{if(this.integrations.setKey(`linkedin`,{...this.integrations.get().linkedin,accountStatus:e}),this.linkedinStatusRefetchTimer!==void 0&&(clearTimeout(this.linkedinStatusRefetchTimer),this.linkedinStatusRefetchTimer=void 0),e.until){let t=new Date(e.until).getTime()-Date.now();t>0&&(this.linkedinStatusRefetchTimer=setTimeout(()=>{this.linkedinStatusRefetchTimer=void 0,_.getWorkspace({}).then(e=>{e?.linkedinAccountStatus&&this.setLinkedinAccountStatus(e.linkedinAccountStatus)})},t))}},this.startUserListener=async()=>{let e=this.user.get();if(!e)return;this.cleanupUserListeners();let t=[],n=await se.subscribe(ie(e.id),`cookie-update`,e=>{let{cookies:t}=e.data;$.info(`received cookie updates`,{cookies:t.map(e=>e.name)}
4),this.updateBrowserCookies(t)},{params:{rewind:`1`}});t.push(n);let r=await se.subscribe(oe(e.id),`connection-sync`,e=>{let t=e.data===void 0?null:e.data;this.connectionSyncStatus.set(t),t===null&&this.fetchConnectionSyncStatus()},{params:{rewind:`1`}});t.push(r);let i=await se.subscribe(b(e.id),`google-contact-sync`,e=>{let t=e.data===void 0?null:e.data;this.googleContactSyncStatus.set(t)},{params:{rewind:`1`}});t.push(i);let a=await se.subscribe(ie(e.id),y.LinkedinAccountStatusChanged,e=>{let t=e.data;t&&this.setLinkedinAccountStatus({status:t.status,until:t.until})});t.push(a);let o=await se.subscribe(ae(e.id),v.AnalysisReady,e=>{let t=e.data;!t?.fromId||!t?.toId||Hs.applyIncomingAnalysis(t)},{params:{rewind:`2m`}});t.push(o),this.userListenerCleanup=()=>{for(let e of t)e()},this.beforeUnloadListenerAdded||=(window.addEventListener(`beforeunload`,this.cleanupUserListeners),!0)},this.updateBrowserCookies=async e=>{await Promise.allSettled(tc.map(async t=>{try{await chrome.runtime.sendMessage(t,{cookieSet:e})}catch{}}))},this.showSupportModal=e=>{Qs.showInputModal.set(Vs(e,document.title,decodeURI(window.location.href)))},this.trackConversion=()=>{typeof window<`u`&&window.gtag&&window.gtag(`event`,`conversion`,{send_to:`AW-17815761681/V_SmCOrU4NMbEJHmm69C`})},this.capture=({eventName:e,entityId:t,properties:n},r)=>{let i=this.user.get()?.id,a=this.originalUser.get()?.id;i?Os.capture({eventName:e,entityId:t,properties:n,userId:i,impersonatedBy:a},r):Os.captureAnonymous({eventName:e,entityId:t,properties:n},r)}}toggleHiddenEntity(e){let t=this.user.get();if(!t)return;let n=new Set(p(t).hidden_entity_ids??[]);n.has(e)?n.delete(e):n.add(e),this.updateUserMeta({hidden_entity_ids:[...n]})}},$s=`kidifhledoijjifmngjkaclhdoffdneg`,ec=`kjhpfbngafhcleeeojpfmcjenmapeeeh`,tc=i.isDevelopment()?[...[`fhomjjmbamoccgioeocggddaefiejgnl`,`fcabjmklleinfceeobnlgdeakoepgfeo`,`kcdfdhfhepehfcdhgnedkpoflmnnanfh`,`clffdpjifkbfhcnahbgponoeljliklkh`,`lefhlbmndglddnheckgmohgkkifdlppi`,`laegdoeciejjdkleiojkaccagaifhiga`,`pjnkgaijmgkalonbhgnmbfijdhheifpb`,`mifimdhaaidkglllklaachbjiocnhnel`,`hbeacmmpamflndedjefnbcnkncepgjaj`,`fnndglofggcpmmfgnffkafcpndhpmebk`,`pcobicdppplhjnpcaodceomaihbogjnp`,`aobmmijljagkpbmmopfkjdckdgnioipo`],$s,ec]:[$s,ec];function nc(e){return`cookieFragments`in e}var rc=()=>{document.visibilityState===`visible`&&Qs.checkCookieFragments({},!0)};export{ys as _,Hs as a,C as b,Is as c,Ls as d,Ms as f,Ts as g,Os as h,Us as i,Rs as l,ks as m,$s as n,Vs as o,As as p,Qs as r,zs as s,tc as t,Fs as u,w as v,ue as y};
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.