(function(X,z){typeof exports=="object"&&typeof module<"u"?module.exports=z():typeof define=="function"&&define.amd?define(z):(X=typeof globalThis<"u"?globalThis:X||self,X.$insights=z())})(this,function(){"use strict";var Lu=Object.defineProperty;var ju=(X,z,le)=>z in X?Lu(X,z,{enumerable:!0,configurable:!0,writable:!0,value:le}):X[z]=le;var ur=(X,z,le)=>(ju(X,typeof z!="symbol"?z+"":z,le),le),xa=(X,z,le)=>{if(!z.has(X))throw TypeError("Cannot "+le)};var vi=(X,z,le)=>(xa(X,z,"read from private field"),le?le.call(X):z.get(X)),dr=(X,z,le)=>{if(z.has(X))throw TypeError("Cannot add the same private member more than once");z instanceof WeakSet?z.add(X):z.set(X,le)},Pn=(X,z,le,Dt)=>(xa(X,z,"write to private field"),Dt?Dt.call(X,le):z.set(X,le),le);var ar,lr,Mt;function X(r,e,t,i,n){for(e=e.split?e.split("."):e,i=0;i1&&(Da(i,l.map(function(c){return c.replace(/[?[\]\\ ]/g,"")}),i[a]),delete i[a])}return i}(function(e){if(e){var t=e.match(/\?(.*)/);return t&&t[1]?t[1].split("#")[0]:""}return Pe&&window.location.search.substring(1)}(r))}function Da(r,e,t){for(var i=e.length-1,n=0;n>4}return r}var jt="global",gt=Ze+"global"+Ze,ft=typeof self===le&&self.self===self&&self||typeof global===le&&global.global===global&&global||void 0;function et(r){return ft[gt][r]}function tt(r,e){return ft[gt][r]=e}function vt(r){delete ft[gt][r]}function _t(r,e,t){var i;try{if(hr(r)){var n=window[r];i=n[e].bind(n)}}catch{}return i||t}ft[gt]||(ft[gt]={});var Ei={};function hr(r){if(typeof Ei[r]!==z)return Ei[r];try{var e=window[r];e.setItem(z,z),e.removeItem(z)}catch{return Ei[r]=!1}return Ei[r]=!0}function R(){return R=Object.assign||function(r){for(var e=1;e1;return rt===!1&&(o?tt(r,e):et(r)),o?document.cookie=r+"="+encodeURIComponent(e)+(t?"; expires="+new Date(+new Date+1e3*t).toUTCString()+(i?"; path="+i:"")+(n?"; domain="+n:"")+(s?"; secure":""):""):decodeURIComponent((("; "+document.cookie).split("; "+r+"=")[1]||"").split(";")[0])}}var Ht="localStorage",cl=hr.bind(null,"localStorage");_t("localStorage","getItem",et),_t("localStorage","setItem",tt),_t("localStorage","removeItem",vt);var Bt="sessionStorage",ul=hr.bind(null,"sessionStorage");_t("sessionStorage","getItem",et),_t("sessionStorage","setItem",tt),_t("sessionStorage","removeItem",vt);function Et(r){var e=r;try{if((e=JSON.parse(r))==="true")return!0;if(e==="false")return!1;if(me(e))return e;parseFloat(e)===e&&(e=parseFloat(e))}catch{}if(e!==null&&e!=="")return e}var dl=cl(),hl=ul(),pl=Vt();function ds(r,e){if(r){var t=br(e),i=!Sr(t),n=wr(t)?Et(localStorage.getItem(r)):void 0;if(i&&!pt(n))return n;var s=Er(t)?Et(cs(r)):void 0;if(i&&s)return s;var o=xr(t)?Et(sessionStorage.getItem(r)):void 0;if(i&&o)return o;var a=et(r);return i?a:{localStorage:n,sessionStorage:o,cookie:s,global:a}}}function gl(r,e,t){if(r&&!pt(e)){var i={},n=br(t),s=JSON.stringify(e),o=!Sr(n);return wr(n)&&(i[Ht]=Oi(Ht,e,Et(localStorage.getItem(r))),localStorage.setItem(r,s),o)?i[Ht]:Er(n)&&(i[Gt]=Oi(Gt,e,Et(cs(r))),yr(r,s),o)?i[Gt]:xr(n)&&(i[Bt]=Oi(Bt,e,Et(sessionStorage.getItem(r))),sessionStorage.setItem(r,s),o)?i[Bt]:(i[jt]=Oi(jt,e,et(r)),tt(r,e),o?i[jt]:i)}}function fl(r,e){if(r){var t=br(e),i=ds(r,On),n={};return!pt(i.localStorage)&&wr(t)&&(localStorage.removeItem(r),n[Ht]=i.localStorage),!pt(i.cookie)&&Er(t)&&(us(r),n[Gt]=i.cookie),!pt(i.sessionStorage)&&xr(t)&&(sessionStorage.removeItem(r),n[Bt]=i.sessionStorage),!pt(i.global)&&Pi(t,jt)&&(vt(r),n[jt]=i.global),n}}function br(r){return r?ht(r)?r:r.storage:Dt}function wr(r){return dl&&Pi(r,Ht)}function Er(r){return pl&&Pi(r,Gt)}function xr(r){return hl&&Pi(r,Bt)}function Sr(r){return r===On||r==="all"}function Pi(r,e){return r===Dt||r===e||Sr(r)}function Oi(r,e,t){return{location:r,current:e,previous:t}}var vl={setItem:gl,getItem:ds,removeItem:fl};function _l(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function hs(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(r);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(r,n).enumerable})),t.push.apply(t,i)}return t}function ps(r){for(var e=1;e0&&arguments[0]!==void 0?arguments[0]:{},e={storage:vl};return ll(ps(ps({},e),r))}const kr={ping:"__INSIGHT_PING___",anonId:"__anon_id",anonIdCookie:"$$A_U_ID"};function Fi(r){return["projectworks.com","projectworks.io","projectworksapp.com"].find(t=>r.toLowerCase().includes(t))}const $n=class $n{constructor(){dr(this,ar,kr.ping);dr(this,lr,void 0);dr(this,Mt,[]);ur(this,"$analytics");ur(this,"isInitialised",!1);ur(this,"isReady",!1)}async init(e={}){return this.isReady=!1,this.isInitialised=!1,vi(this,lr)??Pn(this,lr,e),this.$analytics=ml({app:e.app,version:e.version,debug:e.debug,plugins:await this.initPlugins(e.plugins)}),this.isInitialised=!0,this.once("ready",async()=>{this.isReady=!0;for await(const{method:t,args:i}of vi(this,Mt))try{await this[t].apply(this,i)}catch(n){console.error(n)}Pn(this,Mt,[])}),this}plugins(){return this.$analytics.plugins}async track(e,t={},i={}){this.isReady?await new Promise(n=>{this.$analytics.track(e,t,i,()=>n())}):this.deferActionOnReady("track",arguments)}async identify(e,t={},i={}){if(this.isReady){if(!i.force&&this.isIdentified().user)return;await new Promise(n=>{this.$analytics.identify(e,t,i,()=>n())})}else this.deferActionOnReady("identify",arguments)}async page(e={},t={}){this.isReady?await new Promise(i=>{this.$analytics.page(e,t,()=>i())}):this.deferActionOnReady("page",arguments)}async reset(e={}){if(this.isReady){if(!e.force&&!this.isIdentified().user)return;if(e.clearCookies)for(const[t]of this.getCookies())this.removeCookie(t),this.removeCookie(t,`.${location.hostname}`),this.removeCookie(t,`.${Fi(location.hostname)}`);await new Promise(t=>{this.$analytics.reset(()=>t())})}else this.deferActionOnReady("reset",arguments)}async abTest(e){return new Promise((t,i)=>{const n=Date.now(),s=setInterval(()=>{if(this.isReady&&this.$analytics.plugins.posthog){clearInterval(s);const o=this.$analytics.plugins.posthog.abtest(e);t(o)}else Date.now()-n>2500&&(clearInterval(s),i("Timeout: Plugin not ready"))},10)})}ready(e){if(this.isInitialised)return this.$analytics.ready(e)}on(e,t){if(this.isInitialised)return this.$analytics.on(e,t)}once(e,t){if(this.isInitialised)return this.$analytics.once(e,t)}getState(){return this.$analytics.getState()}getCookies(){return document.cookie.split("; ").map(e=>e.split("="))}setCookie(e,t,i,n,s){Vt()&&e&&(yr(e,t,i,s,n),this.pingStorageEventListeners())}removeCookie(e,t,i){Vt()&&e&&(yr(e,"",-1,i,t),this.pingStorageEventListeners())}removeFromStorage(e,t="*"){this.$analytics.storage.removeItem(e,{storage:t})}getFromStorage(e,t="*"){return this.$analytics.storage.getItem(e,{storage:t})||void 0}setToStorage(e,t,i="*"){this.$analytics.storage.setItem(e,t,{storage:i})}newInstance(){return new $n}async initPlugins(e){const t=[];for await(const[i,n]of Object.entries(e))if(n)switch(i){case"anonIdfromCookie":{const s=(await Promise.resolve().then(()=>kl)).default;t.push(s());break}case"posthog":{const s=(await Promise.resolve().then(()=>Du)).default,o="https://web-ins-ph.projectworks.com";typeof n=="string"?t.push(s({token:n,proxyDomain:o})):t.push(s({token:n.token,proxyDomain:o,autocaptureEvents:n.autocaptureEvents}));break}}return t}pingStorageEventListeners(){this.$analytics.storage.setItem(vi(this,ar),Date.now(),{storage:"global"})}isIdentified(){const{user:e}=this.getState();return{user:!!(e!=null&&e.userId),anonymous:!!(e!=null&&e.anonymousId)}}deferActionOnReady(e,t){vi(this,Mt).push({method:e,args:t})}};ar=new WeakMap,lr=new WeakMap,Mt=new WeakMap;let $r=$n;const yl=new $r;let Ti;const bl=new Uint8Array(16);function wl(){if(!Ti&&(Ti=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Ti))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ti(bl)}const he=[];for(let r=0;r<256;++r)he.push((r+256).toString(16).slice(1));function El(r,e=0){return he[r[e+0]]+he[r[e+1]]+he[r[e+2]]+he[r[e+3]]+"-"+he[r[e+4]]+he[r[e+5]]+"-"+he[r[e+6]]+he[r[e+7]]+"-"+he[r[e+8]]+he[r[e+9]]+"-"+he[r[e+10]]+he[r[e+11]]+he[r[e+12]]+he[r[e+13]]+he[r[e+14]]+he[r[e+15]]}const gs={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function xl(r,e,t){if(gs.randomUUID&&!e&&!r)return gs.randomUUID();r=r||{};const i=r.random||(r.rng||wl)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,e){t=t||0;for(let n=0;n<16;++n)e[t+n]=i[n];return e}return El(i)}function Sl(r={}){const e=kr.anonIdCookie,t=kr.anonId,i=n=>{const s=Fi(location.hostname);window.$insights.setCookie(e,n,365*24*60*60,s?`.${s}`:location.hostname)};return{name:"anon-id-from-cookie",config:Object.assign({},r),initializeStart:n=>{if(!Vt())return n.abort("Browser has disabled cookies, or user has specified do-not-track");const s=n.instance.storage.getItem(e,{storage:"cookie"});if(s)n.instance.storage.setItem(t,s,{storage:"localStorage"});else{const o=n.instance.storage.getItem(t,{storage:"localStorage"});o&&i(o)}},setItemStart:n=>{if(n.payload.key===t){Fi(location.hostname)&&window.$insights.removeCookie(e,location.hostname);const o=n.instance.storage.getItem(e,{storage:"cookie"});if(o)return{...n.payload,value:o};i(n.payload.value)}},resetEnd:n=>{window.$insights.removeCookie(e,`.${Fi(location.hostname)}`),window.$insights.removeCookie(e,location.hostname),n.instance.storage.setItem(t,xl(),{storage:"localStorage"})}}}const kl=Object.freeze(Object.defineProperty({__proto__:null,default:Sl},Symbol.toStringTag,{value:"Module"}));var f=typeof window<"u"?window:void 0,ye=typeof globalThis<"u"?globalThis:f,fs=Array.prototype,vs=fs.forEach,_s=fs.indexOf,xe=ye==null?void 0:ye.navigator,S=ye==null?void 0:ye.document,be=ye==null?void 0:ye.location,Ir=ye==null?void 0:ye.fetch,Pr=ye!=null&&ye.XMLHttpRequest&&"withCredentials"in new ye.XMLHttpRequest?ye.XMLHttpRequest:void 0,ms=ye==null?void 0:ye.AbortController,we=xe==null?void 0:xe.userAgent,N=f??{},Ne={DEBUG:!1,LIB_VERSION:"1.277.0"};function ys(r,e,t,i,n,s,o){try{var a=r[s](o),l=a.value}catch(c){return void t(c)}a.done?e(l):Promise.resolve(l).then(i,n)}function bs(r){return function(){var e=this,t=arguments;return new Promise(function(i,n){var s=r.apply(e,t);function o(l){ys(s,i,n,o,a,"next",l)}function a(l){ys(s,i,n,o,a,"throw",l)}o(void 0)})}}function $(){return $=Object.assign?Object.assign.bind():function(r){for(var e=1;etypeof r=="function",ge=r=>r===Object(r)&&!J(r),xt=r=>{if(ge(r)){for(var e in r)if(xs.call(r,e))return!1;return!0}return!1},x=r=>r===void 0,ce=r=>Ci.call(r)=="[object String]",Fr=r=>ce(r)&&r.trim().length===0,De=r=>r===null,ee=r=>x(r)||De(r),Te=r=>Ci.call(r)=="[object Number]",ze=r=>Ci.call(r)==="[object Boolean]",Pl=r=>r instanceof FormData,Ol=r=>q($l,r);function Tr(r){return r===null||typeof r!="object"}function Ri(r,e){return Object.prototype.toString.call(r)==="[object "+e+"]"}function Ss(r){return!x(Event)&&function(e,t){try{return e instanceof t}catch{return!1}}(r,Event)}var Fl=[!0,"true",1,"1","yes"],Ar=r=>q(Fl,r),Tl=[!1,"false",0,"0","no"];function Ae(r,e,t,i,n){return e>t&&(i.warn("min cannot be greater than max."),e=t),Te(r)?r>t?(i.warn(" cannot be greater than max: "+t+". Using max value instead."),t):r{Object.keys(this.i).forEach(t=>{var i=this.h(t)+this.m;i>=this.S?delete this.i[t]:this.$(t,i)})},this.h=t=>this.i[String(t)],this.$=(t,i)=>{this.i[String(t)]=i},this.consumeRateLimit=t=>{var i,n,s=(i=this.h(t))!==null&&i!==void 0?i:this.S;if((s=Math.max(s-1,0))===0)return!0;this.$(t,s);var o=s===0;return o&&((n=this.k)==null||n.call(this,t)),o},this.k=this.t.k,this.S=Ae(this.t.bucketSize,0,100,this.t.P),this.m=Ae(this.t.refillRate,0,this.S,this.t.P),this.T=Ae(this.t.refillInterval,0,864e5,this.t.P),this.I=setInterval(()=>{this.o()},this.T)}stop(){this.I&&(clearInterval(this.I),this.I=void 0)}}var Mi,ks,Cr,Cl=r=>r instanceof Error;function Rl(r){var e=globalThis._posthogChunkIds;if(e){var t=Object.keys(e);return Cr&&t.length===ks||(ks=t.length,Cr=t.reduce((i,n)=>{Mi||(Mi={});var s=Mi[n];if(s)i[s[0]]=s[1];else for(var o=r(n),a=o.length-1;a>=0;a--){var l=o[a],c=l==null?void 0:l.filename,u=e[n];if(c&&u){i[c]=u,Mi[n]=[c,u];break}}return i},{})),Cr}}var St="?";function Rr(r,e,t,i){var n={platform:"web:javascript",filename:r,function:e===""?St:e,in_app:!0};return x(t)||(n.lineno=t),x(i)||(n.colno=i),n}var $s=(r,e)=>{var t=r.indexOf("safari-extension")!==-1,i=r.indexOf("safari-web-extension")!==-1;return t||i?[r.indexOf("@")!==-1?r.split("@")[0]:St,t?"safari-extension:"+e:"safari-web-extension:"+e]:[r,e]},Ml=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Nl=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Dl=/\((\S*)(?::(\d+))(?::(\d+))\)/,Ll=r=>{var e=Ml.exec(r);if(e){var[,t,i,n]=e;return Rr(t,St,+i,+n)}var s=Nl.exec(r);if(s){if(s[2]&&s[2].indexOf("eval")===0){var o=Dl.exec(s[2]);o&&(s[2]=o[1],s[3]=o[2],s[4]=o[3])}var[a,l]=$s(s[1]||St,s[2]);return Rr(l,a,s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}},jl=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Ul=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,ql=r=>{var e=jl.exec(r);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){var t=Ul.exec(e[3]);t&&(e[1]=e[1]||"eval",e[3]=t[1],e[4]=t[2],e[5]="")}var i=e[3],n=e[1]||St;return[n,i]=$s(n,i),Rr(i,n,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},Is=/\(error: (.*)\)/,Ps=50;function Gl(){for(var r=arguments.length,e=new Array(r),t=0;t1024)){var c=Is.test(l)?l.replace(Is,"$1"):l;if(!c.match(/\S*Error: /)){for(var u of e){var d=u(c);if(d){s.push(d);break}}if(s.length>=Ps)break}}}return function(p){if(!p.length)return[];var h=Array.from(p);return h.reverse(),h.slice(0,Ps).map(m=>{return $({},m,{filename:m.filename||(v=h,v[v.length-1]||{}).filename,function:m.function||St});var v})}(s)}}class Vl{constructor(e,t,i){e===void 0&&(e=[]),t===void 0&&(t=[]),i===void 0&&(i=[]),this.coercers=e,this.modifiers=i,this.stackParser=Gl(...t)}buildFromUnknown(e,t){t===void 0&&(t={});var i=t&&t.mechanism||{handled:!0,type:"generic"},n=this.buildCoercingContext(i,t,0).apply(e),s=this.buildParsingContext(),o=this.parseStacktrace(n,s);return{$exception_list:this.convertToExceptionList(o,i),$exception_level:"error"}}modifyFrames(e){var t=this;return bs(function*(){for(var i of e)i.stacktrace&&i.stacktrace.frames&&J(i.stacktrace.frames)&&(i.stacktrace.frames=yield t.applyModifiers(i.stacktrace.frames));return e})()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:(t=e.syntheticException)==null?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var i,n;return e.cause!=null&&(i=this.parseStacktrace(e.cause,t)),e.stack!=""&&e.stack!=null&&(n=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?1:0),t.chunkIdMap)),$({},e,{cause:i,stack:n})}applyChunkIds(e,t){return e.map(i=>(i.filename&&t&&(i.chunk_id=t[i.filename]),i))}applyCoercers(e,t){for(var i of this.coercers)if(i.match(e))return i.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return bs(function*(){var i=e;for(var n of t.modifiers)i=yield n(i);return i})()}convertToExceptionList(e,t){var i,n,s,o={type:e.type,value:e.value,mechanism:{type:(i=t.type)!==null&&i!==void 0?i:"generic",handled:(n=t.handled)===null||n===void 0||n,synthetic:(s=e.synthetic)!==null&&s!==void 0&&s}};e.stack&&(o.stacktrace={type:"raw",frames:e.stack});var a=[o];return e.cause!=null&&a.push(...this.convertToExceptionList(e.cause,$({},t,{handled:!0}))),a}buildParsingContext(){return{chunkIdMap:Rl(this.stackParser)}}buildCoercingContext(e,t,i){i===void 0&&(i=0);var n=(s,o)=>{if(o<=4){var a=this.buildCoercingContext(e,t,o);return this.applyCoercers(s,a)}};return $({},t,{syntheticException:i==0?t.syntheticException:void 0,mechanism:e,apply:s=>n(s,i),next:s=>n(s,i+1)})}}class Hl{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var i=ce(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:i?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?t+": "+e.message:t}isDOMException(e){return Ri(e,"DOMException")}isDOMError(e){return Ri(e,"DOMError")}}class Bl{match(e){return(t=>t 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 i=e.message;return i.error&&typeof i.error.message=="string"?String(i.error.message):String(i)}getStack(e){return e.stacktrace||e.stack||void 0}}class zl{constructor(){}match(e){return Ri(e,"ErrorEvent")&&e.error!=null}coerce(e,t){var i,n=t.apply(e.error);return n||{type:"ErrorEvent",value:e.message,stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}}var Wl=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class Yl{match(e){return typeof e=="string"}coerce(e,t){var i,[n,s]=this.getInfos(e);return{type:n??"Error",value:s??e,stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}getInfos(e){var t="Error",i=e,n=e.match(Wl);return n&&(t=n[1],i=n[2]),[t,i]}}var Xl=["fatal","error","warning","log","info","debug"];function Os(r,e){e===void 0&&(e=40);var t=Object.keys(r);if(t.sort(),!t.length)return"[object has no keys]";for(var i=t.length;i>0;i--){var n=t.slice(0,i).join(", ");if(!(n.length>e))return i===t.length||n.length<=e?n:n.slice(0,e)+"..."}return""}class Jl{match(e){return typeof e=="object"&&e!==null}coerce(e,t){var i,n=this.getErrorPropertyFromObject(e);return n?t.apply(n):{type:this.getType(e),value:this.getValue(e),stack:(i=t.syntheticException)==null?void 0:i.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return Ss(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 i=this.getObjectClassName(e);return(i&&i!=="Object"?"'"+i+"'":"Object")+" captured as exception with keys: "+Os(e)}isSeverityLevel(e){return ce(e)&&!Fr(e)&&Xl.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var i=e[t];if(Cl(i))return i}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}}class Kl{match(e){return Ss(e)}coerce(e,t){var i,n=e.constructor.name;return{type:n,value:n+" captured as exception with keys: "+Os(e),stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}}class Ql{match(e){return Tr(e)}coerce(e,t){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}}class Zl{match(e){return Ri(e,"PromiseRejectionEvent")}coerce(e,t){var i,n=this.getUnhandledRejectionReason(e);return Tr(n)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(n),stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}:t.apply(n)}getUnhandledRejectionReason(e){if(Tr(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}}var Fs=r=>{var e={R:function(t){if(f&&(Ne.DEBUG||N.POSTHOG_DEBUG)&&!x(f.console)&&f.console){for(var i=("__rrweb_original__"in f.console[t])?f.console[t].__rrweb_original__:f.console[t],n=arguments.length,s=new Array(n>1?n-1:0),o=1;o{e.error("You must initialize PostHog before calling "+t)},createLogger:t=>Fs(r+" "+t)};return e},k=Fs("[PostHog.js]"),de=k.createLogger,ec=de("[ExternalScriptsLoader]"),Ts=(r,e,t)=>{if(r.config.disable_external_dependency_loading)return ec.warn(e+" was requested but loading of external scripts is disabled."),t("Loading of external scripts is disabled");var i=S==null?void 0:S.querySelectorAll("script");if(i){for(var n,s=function(){if(i[o].src===e){var l=i[o];return l.__posthog_loading_callback_fired?{v:t()}:(l.addEventListener("load",c=>{l.__posthog_loading_callback_fired=!0,t(void 0,c)}),l.onerror=c=>t(c),{v:void 0})}},o=0;o{if(!S)return t("document not found");var l=S.createElement("script");if(l.type="text/javascript",l.crossOrigin="anonymous",l.src=e,l.onload=d=>{l.__posthog_loading_callback_fired=!0,t(void 0,d)},l.onerror=d=>t(d),r.config.prepare_external_dependency_script&&(l=r.config.prepare_external_dependency_script(l)),!l)return t("prepare_external_dependency_script returned null");var c,u=S.querySelectorAll("body > script");u.length>0?(c=u[0].parentNode)==null||c.insertBefore(l,u[0]):S.body.appendChild(l)};S!=null&&S.body?a():S==null||S.addEventListener("DOMContentLoaded",a)};N.__PosthogExtensions__=N.__PosthogExtensions__||{},N.__PosthogExtensions__.loadExternalDependency=(r,e,t)=>{var i="/static/"+e+".js?v="+r.version;if(e==="remote-config"&&(i="/array/"+r.config.token+"/config.js"),e==="toolbar"){var n=3e5;i=i+"&t="+Math.floor(Date.now()/n)*n}var s=r.requestRouter.endpointFor("assets",i);Ts(r,s,t)},N.__PosthogExtensions__.loadSiteApp=(r,e,t)=>{var i=r.requestRouter.endpointFor("api",e);Ts(r,i,t)};var Ni={};function We(r,e,t){if(J(r)){if(vs&&r.forEach===vs)r.forEach(e,t);else if("length"in r&&r.length===+r.length){for(var i=0,n=r.length;i1?e-1:0),i=1;i1?e-1:0),i=1;i0||Te(t))&&(e[i]=t)}),e};function ic(r,e){return t=r,i=s=>ce(s)&&!De(e)?s.slice(0,e):s,n=new Set,function s(o,a){return o!==Object(o)?i?i(o,a):o:n.has(o)?void 0:(n.add(o),J(o)?(l=[],We(o,c=>{l.push(s(c))})):(l={},K(o,(c,u)=>{n.has(c)||(l[u]=s(c,u))})),l);var l}(t);var t,i,n}var rc=["herokuapp.com","vercel.app","netlify.app"];function nc(r){var e=r==null?void 0:r.hostname;if(!ce(e))return!1;var t=e.split(".").slice(-2).join(".");for(var i of rc)if(t===i)return!1;return!0}function Cs(r,e){for(var t=0;te.match(t)))}function Hi(r){var e="";switch(typeof r.className){case"string":e=r.className;break;case"object":e=(r.className&&"baseVal"in r.className?r.className.baseVal:null)||r.getAttribute("class")||"";break;default:e=""}return Br(e)}function Ws(r){return ee(r)?null:Ai(r).split(/(\s+)/).filter(e=>Kt(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Bi(r){var e="";return Yr(r)&&!Zs(r)&&r.childNodes&&r.childNodes.length&&K(r.childNodes,function(t){var i;Hs(t)&&t.textContent&&(e+=(i=Ws(t.textContent))!==null&&i!==void 0?i:"")}),Ai(e)}function Ys(r){return x(r.target)?r.srcElement||null:(e=r.target)!=null&&e.shadowRoot?r.composedPath()[0]||null:r.target||null;var e}var zr=["a","button","form","input","select","textarea","label"];function Xs(r,e){if(x(e))return!0;var t,i=function(s){if(e.some(o=>s.matches(o)))return{v:!0}};for(var n of r)if(t=i(n))return t.v;return!1}function Js(r){var e=r.parentNode;return!(!e||!Vi(e))&&e}var Ks=[".ph-no-rageclick",".ph-no-capture"],Wr=r=>!r||Ye(r,"html")||!Vi(r),Qs=(r,e)=>{if(!f||Wr(r))return{parentIsUsefulElement:!1,targetElementList:[]};for(var t=!1,i=[r],n=r;n.parentNode&&!Ye(n,"body");)if(Bs(n.parentNode))i.push(n.parentNode.host),n=n.parentNode.host;else{var s=Js(n);if(!s)break;if(e||zr.indexOf(s.tagName.toLowerCase())>-1)t=!0;else{var o=f.getComputedStyle(s);o&&o.getPropertyValue("cursor")==="pointer"&&(t=!0)}i.push(s),n=s}return{parentIsUsefulElement:t,targetElementList:i}};function oc(r,e,t,i,n){var s,o,a,l;if(t===void 0&&(t=void 0),!f||Wr(r)||(s=t)!=null&&s.url_allowlist&&!zs(t.url_allowlist)||(o=t)!=null&&o.url_ignorelist&&zs(t.url_ignorelist))return!1;if((a=t)!=null&&a.dom_event_allowlist){var c=t.dom_event_allowlist;if(c&&!c.some(m=>e.type===m))return!1}var{parentIsUsefulElement:u,targetElementList:d}=Qs(r,i);if(!function(m,v){var y=v==null?void 0:v.element_allowlist;if(x(y))return!0;var E,F=function(b){if(y.some(w=>b.tagName.toLowerCase()===w))return{v:!0}};for(var I of m)if(E=F(I))return E.v;return!1}(d,t)||!Xs(d,(l=t)==null?void 0:l.css_selector_allowlist))return!1;var p=f.getComputedStyle(r);if(p&&p.getPropertyValue("cursor")==="pointer"&&e.type==="click")return!0;var h=r.tagName.toLowerCase();switch(h){case"html":return!1;case"form":return(n||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(e.type)>=0;default:return u?(n||["click"]).indexOf(e.type)>=0:(n||["click"]).indexOf(e.type)>=0&&(zr.indexOf(h)>-1||r.getAttribute("contenteditable")==="true")}}function Yr(r){for(var e=r;e.parentNode&&!Ye(e,"body");e=e.parentNode){var t=Hi(e);if(q(t,"ph-sensitive")||q(t,"ph-no-capture"))return!1}if(q(Hi(r),"ph-include"))return!0;var i=r.type||"";if(ce(i))switch(i.toLowerCase()){case"hidden":case"password":return!1}var n=r.name||r.id||"";return!(ce(n)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(n.replace(/[^a-zA-Z0-9]/g,"")))}function Zs(r){return!!(Ye(r,"input")&&!["button","checkbox","submit","reset"].includes(r.type)||Ye(r,"select")||Ye(r,"textarea")||r.getAttribute("contenteditable")==="true")}var eo="(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})",ac=new RegExp("^(?:"+eo+")$"),lc=new RegExp(eo),to="\\d{3}-?\\d{2}-?\\d{4}",cc=new RegExp("^("+to+")$"),uc=new RegExp("("+to+")");function Kt(r,e){return e===void 0&&(e=!0),!(ee(r)||ce(r)&&(r=Ai(r),(e?ac:lc).test((r||"").replace(/[- ]/g,""))||(e?cc:uc).test(r)))}function io(r){var e=Bi(r);return Kt(e=(e+" "+ro(r)).trim())?e:""}function ro(r){var e="";return r&&r.childNodes&&r.childNodes.length&&K(r.childNodes,function(t){var i;if(t&&((i=t.tagName)==null?void 0:i.toLowerCase())==="span")try{var n=Bi(t);e=(e+" "+n).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+ro(t)).trim())}catch(s){k.error("[AutoCapture]",s)}}),e}function dc(r){return function(e){var t=e.map(i=>{var n,s,o="";if(i.tag_name&&(o+=i.tag_name),i.attr_class)for(var a of(i.attr_class.sort(),i.attr_class))o+="."+a.replace(/"/g,"");var l=$({},i.text?{text:i.text}:{},{"nth-child":(n=i.nth_child)!==null&&n!==void 0?n:0,"nth-of-type":(s=i.nth_of_type)!==null&&s!==void 0?s:0},i.href?{href:i.href}:{},i.attr_id?{attr_id:i.attr_id}:{},i.attributes),c={};return Di(l).sort((u,d)=>{var[p]=u,[h]=d;return p.localeCompare(h)}).forEach(u=>{var[d,p]=u;return c[no(d.toString())]=no(p.toString())}),o+=":",o+=Di(c).map(u=>{var[d,p]=u;return d+'="'+p+'"'}).join("")});return t.join(";")}(function(e){return e.map(t=>{var i,n,s={text:(i=t.$el_text)==null?void 0:i.slice(0,400),tag_name:t.tag_name,href:(n=t.attr__href)==null?void 0:n.slice(0,2048),attr_class:hc(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Di(t).filter(o=>{var[a]=o;return a.indexOf("attr__")===0}).forEach(o=>{var[a,l]=o;return s.attributes[a]=l}),s})}(r))}function no(r){return r.replace(/"|\\"/g,'\\"')}function hc(r){var e=r.attr__class;return e?J(e)?e:Br(e):void 0}class so{constructor(){this.clicks=[]}isRageClick(e,t,i){var n=this.clicks[this.clicks.length-1];if(n&&Math.abs(e-n.x)+Math.abs(t-n.y)<30&&i-n.timestamp<1e3){if(this.clicks.push({x:e,y:t,timestamp:i}),this.clicks.length===3)return!0}else this.clicks=[{x:e,y:t,timestamp:i}];return!1}}var Xr="$copy_autocapture",je=function(r){return r.GZipJS="gzip-js",r.Base64="base64",r}({}),zi=r=>{var e=S==null?void 0:S.createElement("a");return x(e)?null:(e.href=r,e)},pc=function(r,e){var t,i;e===void 0&&(e="&");var n=[];return K(r,function(s,o){x(s)||x(o)||o==="undefined"||(t=encodeURIComponent((a=>a instanceof File)(s)?s.name:s.toString()),i=encodeURIComponent(o),n[n.length]=i+"="+t)}),n.join(e)},Wi=function(r,e){for(var t,i=((r.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),n=0;nr?e.slice(0,r)+"...":e}function gc(r){if(r.previousElementSibling)return r.previousElementSibling;var e=r;do e=e.previousSibling;while(e&&!Vi(e));return e}function fc(r,e,t,i){var n=r.tagName.toLowerCase(),s={tag_name:n};zr.indexOf(n)>-1&&!t&&(n.toLowerCase()==="a"||n.toLowerCase()==="button"?s.$el_text=Jr(1024,io(r)):s.$el_text=Jr(1024,Bi(r)));var o=Hi(r);o.length>0&&(s.classes=o.filter(function(u){return u!==""})),K(r.attributes,function(u){var d;if((!Zs(r)||["name","id","class","aria-label"].indexOf(u.name)!==-1)&&(i==null||!i.includes(u.name))&&!e&&Kt(u.value)&&(d=u.name,!ce(d)||d.substring(0,10)!=="_ngcontent"&&d.substring(0,7)!=="_nghost")){var p=u.value;u.name==="class"&&(p=Br(p).join(" ")),s["attr__"+u.name]=Jr(1024,p)}});for(var a=1,l=1,c=r;c=gc(c);)a++,c.tagName===r.tagName&&l++;return s.nth_child=a,s.nth_of_type=l,s}function vc(r,e){for(var t,i,{e:n,maskAllElementAttributes:s,maskAllText:o,elementAttributeIgnoreList:a,elementsChainAsString:l}=e,c=[r],u=r;u.parentNode&&!Ye(u,"body");)Bs(u.parentNode)?(c.push(u.parentNode.host),u=u.parentNode.host):(c.push(u.parentNode),u=u.parentNode);var d,p=[],h={},m=!1,v=!1;if(K(c,b=>{var w=Yr(b);b.tagName.toLowerCase()==="a"&&(m=b.getAttribute("href"),m=w&&m&&Kt(m)&&m),q(Hi(b),"ph-no-capture")&&(v=!0),p.push(fc(b,s,o,a));var j=function(D){if(!Yr(D))return{};var P={};return K(D.attributes,function(B){if(B.name&&B.name.indexOf("data-ph-capture-attribute")===0){var G=B.name.replace("data-ph-capture-attribute-",""),Z=B.value;G&&Z&&Kt(Z)&&(P[G]=Z)}}),P}(b);oe(h,j)}),v)return{props:{},explicitNoCapture:v};if(o||(r.tagName.toLowerCase()==="a"||r.tagName.toLowerCase()==="button"?p[0].$el_text=io(r):p[0].$el_text=Bi(r)),m){var y,E;p[0].attr__href=m;var F=(y=zi(m))==null?void 0:y.host,I=f==null||(E=f.location)==null?void 0:E.host;F&&I&&F!==I&&(d=m)}return{props:oe({$event_type:n.type,$ce_version:1},l?{}:{$elements:p},{$elements_chain:dc(p)},(t=p[0])!=null&&t.$el_text?{$el_text:(i=p[0])==null?void 0:i.$el_text}:{},d&&n.type==="click"?{$external_click_url:d}:{},h)}}class _c{constructor(e){this.C=!1,this.O=null,this.rageclicks=new so,this.F=!1,this.instance=e,this.M=null}get A(){var e,t,i=ge(this.instance.config.autocapture)?this.instance.config.autocapture:{};return i.url_allowlist=(e=i.url_allowlist)==null?void 0:e.map(n=>new RegExp(n)),i.url_ignorelist=(t=i.url_ignorelist)==null?void 0:t.map(n=>new RegExp(n)),i}j(){if(this.isBrowserSupported()){if(f&&S){var e=i=>{i=i||(f==null?void 0:f.event);try{this.D(i)}catch(n){oo.error("Failed to capture event",n)}};if(ue(S,"submit",e,{capture:!0}),ue(S,"change",e,{capture:!0}),ue(S,"click",e,{capture:!0}),this.A.capture_copied_text){var t=i=>{i=i||(f==null?void 0:f.event),this.D(i,Xr)};ue(S,"copy",t,{capture:!0}),ue(S,"cut",t,{capture:!0})}}}else oo.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.C&&(this.j(),this.C=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.F=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[Ms]:!!e.autocapture_opt_out}),this.O=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.M=e}getElementSelectors(e){var t,i=[];return(t=this.M)==null||t.forEach(n=>{var s=S==null?void 0:S.querySelectorAll(n);s==null||s.forEach(o=>{e===o&&i.push(n)})}),i}get isEnabled(){var e,t,i=(e=this.instance.persistence)==null?void 0:e.props[Ms],n=this.O;if(De(n)&&!ze(i)&&!this.instance.L())return!1;var s=(t=this.O)!==null&&t!==void 0?t:!!i;return!!this.instance.config.autocapture&&!s}D(e,t){if(t===void 0&&(t="$autocapture"),this.isEnabled){var i,n=Ys(e);Hs(n)&&(n=n.parentNode||null),t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&this.instance.config.rageclick&&(i=this.rageclicks)!=null&&i.isRageClick(e.clientX,e.clientY,new Date().getTime())&&function(p,h){if(!f||Wr(p))return!1;var m,v;if((m=ze(h)?!!h&&Ks:(v=h==null?void 0:h.css_selector_ignorelist)!==null&&v!==void 0?v:Ks)===!1)return!1;var{targetElementList:y}=Qs(p,!1);return!Xs(y,m)}(n,this.instance.config.rageclick)&&this.D(e,"$rageclick");var s=t===Xr;if(n&&oc(n,e,this.A,s,s?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=vc(n,{e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.A.element_attribute_ignorelist,elementsChainAsString:this.F});if(a)return!1;var l=this.getElementSelectors(n);if(l&&l.length>0&&(o.$element_selectors=l),t===Xr){var c,u=Ws(f==null||(c=f.getSelection())==null?void 0:c.toString()),d=e.type||"clipboard";if(!u)return!1;o.$selected_content=u,o.$copy_type=d}return this.instance.capture(t,o),!0}}}isBrowserSupported(){return Be(S==null?void 0:S.querySelectorAll)}}Math.trunc||(Math.trunc=function(r){return r<0?Math.ceil(r):Math.floor(r)}),Number.isInteger||(Number.isInteger=function(r){return Te(r)&&isFinite(r)&&Math.floor(r)===r});var ao="0123456789abcdef";class Xi{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,i,n){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(n)||e<0||t<0||i<0||n<0||e>0xffffffffffff||t>4095||i>1073741823||n>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=e/Math.pow(2,40),s[1]=e/Math.pow(2,32),s[2]=e/Math.pow(2,24),s[3]=e/Math.pow(2,16),s[4]=e/Math.pow(2,8),s[5]=e,s[6]=112|t>>>8,s[7]=t,s[8]=128|i>>>24,s[9]=i>>>16,s[10]=i>>>8,s[11]=i,s[12]=n>>>24,s[13]=n>>>16,s[14]=n>>>8,s[15]=n,new Xi(s)}toString(){for(var e="",t=0;t>>4)+ao.charAt(15&this.bytes[t]),t!==3&&t!==5&&t!==7&&t!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new Xi(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var t=0;t<16;t++){var i=this.bytes[t]-e.bytes[t];if(i!==0)return Math.sign(i)}return 0}}class mc{constructor(){this.N=0,this.U=0,this.H=new yc}generate(){var e=this.generateOrAbort();if(x(e)){this.N=0;var t=this.generateOrAbort();if(x(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this.N)this.N=e,this.B();else{if(!(e+1e4>this.N))return;this.U++,this.U>4398046511103&&(this.N++,this.B())}return Xi.fromFieldsV7(this.N,Math.trunc(this.U/Math.pow(2,30)),this.U&Math.pow(2,30)-1,this.H.nextUint32())}B(){this.U=1024*this.H.nextUint32()+(1023&this.H.nextUint32())}}var lo,co=r=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;ecrypto.getRandomValues(r));class yc{constructor(){this.q=new Uint32Array(8),this.W=1/0}nextUint32(){return this.W>=this.q.length&&(co(this.q),this.W=0),this.q[this.W++]}}var Xe=()=>bc().toString(),bc=()=>(lo||(lo=new mc)).generate(),Zt="",wc=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function Ec(r,e){if(e){var t=function(n,s){if(s===void 0&&(s=S),Zt)return Zt;if(!s||["localhost","127.0.0.1"].includes(n))return"";for(var o=n.split("."),a=Math.min(o.length,8),l="dmn_chk_"+Xe();!Zt&&a--;){var c=o.slice(a).join("."),u=l+"=1;domain=."+c+";path=/";s.cookie=u+";max-age=3",s.cookie.includes(l)&&(s.cookie=u+";max-age=0",Zt=c)}return Zt}(r);if(!t){var i=(n=>{var s=n.match(wc);return s?s[0]:""})(r);i!==t&&k.info("Warning: cookie subdomain discovery mismatch",i,t),t=i}return t?"; domain=."+t:""}return""}var Ce={G:()=>!!S,V:function(r){k.error("cookieStore error: "+r)},J:function(r){if(S){try{for(var e=r+"=",t=S.cookie.split(";").filter(s=>s.length),i=0;i3686.4&&k.warn("cookieStore warning: large cookie, len="+c.length),S.cookie=c,c}catch{return}},X:function(r,e){if(S!=null&&S.cookie)try{Ce.Y(r,"",-1,e)}catch{return}}},Kr=null,ie={G:function(){if(!De(Kr))return Kr;var r=!0;if(x(f))r=!1;else try{var e="__mplssupport__";ie.Y(e,"xyz"),ie.J(e)!=='"xyz"'&&(r=!1),ie.X(e)}catch{r=!1}return r||k.error("localStorage unsupported; falling back to cookie store"),Kr=r,r},V:function(r){k.error("localStorage error: "+r)},J:function(r){try{return f==null?void 0:f.localStorage.getItem(r)}catch(e){ie.V(e)}return null},K:function(r){try{return JSON.parse(ie.J(r))||{}}catch{}return null},Y:function(r,e){try{f==null||f.localStorage.setItem(r,JSON.stringify(e))}catch(t){ie.V(t)}},X:function(r){try{f==null||f.localStorage.removeItem(r)}catch(e){ie.V(e)}}},xc=["distinct_id",Li,qs,Gi,qi],Ji=$({},ie,{K:function(r){try{var e={};try{e=Ce.K(r)||{}}catch{}var t=oe(e,JSON.parse(ie.J(r)||"{}"));return ie.Y(r,t),t}catch{}return null},Y:function(r,e,t,i,n,s){try{ie.Y(r,e,void 0,void 0,s);var o={};xc.forEach(a=>{e[a]&&(o[a]=e[a])}),Object.keys(o).length&&Ce.Y(r,o,t,i,n,s)}catch(a){ie.V(a)}},X:function(r,e){try{f==null||f.localStorage.removeItem(r),Ce.X(r,e)}catch(t){ie.V(t)}}}),Ki={},Sc={G:function(){return!0},V:function(r){k.error("memoryStorage error: "+r)},J:function(r){return Ki[r]||null},K:function(r){return Ki[r]||null},Y:function(r,e){Ki[r]=e},X:function(r){delete Ki[r]}},st=null,pe={G:function(){if(!De(st))return st;if(st=!0,x(f))st=!1;else try{var r="__support__";pe.Y(r,"xyz"),pe.J(r)!=='"xyz"'&&(st=!1),pe.X(r)}catch{st=!1}return st},V:function(r){k.error("sessionStorage error: ",r)},J:function(r){try{return f==null?void 0:f.sessionStorage.getItem(r)}catch(e){pe.V(e)}return null},K:function(r){try{return JSON.parse(pe.J(r))||null}catch{}return null},Y:function(r,e){try{f==null||f.sessionStorage.setItem(r,JSON.stringify(e))}catch(t){pe.V(t)}},X:function(r){try{f==null||f.sessionStorage.removeItem(r)}catch(e){pe.V(e)}}},Ue=function(r){return r[r.PENDING=-1]="PENDING",r[r.DENIED=0]="DENIED",r[r.GRANTED=1]="GRANTED",r}({});class kc{constructor(e){this._instance=e}get A(){return this._instance.config}get consent(){return this.Z()?Ue.DENIED:this.tt}isOptedOut(){return this.A.cookieless_mode==="always"||this.consent===Ue.DENIED||this.consent===Ue.PENDING&&(this.A.opt_out_capturing_by_default||this.A.cookieless_mode==="on_reject")}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===Ue.DENIED}optInOut(e){this.it.Y(this.et,e?1:0,this.A.cookie_expiration,this.A.cross_subdomain_cookie,this.A.secure_cookie)}reset(){this.it.X(this.et,this.A.cross_subdomain_cookie)}get et(){var{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:i}=this._instance.config;return i||(t?t+e:"__ph_opt_in_out_"+e)}get tt(){var e=this.it.J(this.et);return Ar(e)?Ue.GRANTED:q(Tl,e)?Ue.DENIED:Ue.PENDING}get it(){if(!this.rt){var e=this.A.opt_out_capturing_persistence_type;this.rt=e==="localStorage"?ie:Ce;var t=e==="localStorage"?Ce:ie;t.J(this.et)&&(this.rt.J(this.et)||this.optInOut(Ar(t.J(this.et))),t.X(this.et,this.A.cross_subdomain_cookie))}return this.rt}Z(){return!!this.A.respect_dnt&&!!Cs([xe==null?void 0:xe.doNotTrack,xe==null?void 0:xe.msDoNotTrack,N.doNotTrack],e=>Ar(e))}}var Qi=de("[Dead Clicks]"),$c=()=>!0,Ic=r=>{var e,t=!((e=r.instance.persistence)==null||!e.get_property(js)),i=r.instance.config.capture_dead_clicks;return ze(i)?i:t};class uo{get lazyLoadedDeadClicksAutocapture(){return this.st}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabled()}onRemoteConfig(e){this.instance.persistence&&this.instance.persistence.register({[js]:e==null?void 0:e.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.nt(()=>{this.ot()})}nt(e){var t,i;(t=N.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture&&e(),(i=N.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",n=>{n?Qi.error("failed to load script",n):e()})}ot(){var e;if(S){if(!this.st&&(e=N.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var t=ge(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.st=N.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.st.start(S),Qi.info("starting...")}}else Qi.error("`document` not found. Cannot start.")}stop(){this.st&&(this.st.stop(),this.st=void 0,Qi.info("stopping..."))}}var ei=de("[ExceptionAutocapture]");class Pc{constructor(e){var t,i,n;this.lt=()=>{var s;if(f&&this.isEnabled&&(s=N.__PosthogExtensions__)!=null&&s.errorWrappingFunctions){var o=N.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,a=N.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,l=N.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.ut&&this.A.capture_unhandled_errors&&(this.ut=o(this.captureException.bind(this))),!this.ht&&this.A.capture_unhandled_rejections&&(this.ht=a(this.captureException.bind(this))),!this.dt&&this.A.capture_console_errors&&(this.dt=l(this.captureException.bind(this)))}catch(c){ei.error("failed to start",c),this.vt()}}},this._instance=e,this.ct=!((t=this._instance.persistence)==null||!t.props[Ns]),this.A=this.ft(),this.gt=new Al({refillRate:(i=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&i!==void 0?i:1,bucketSize:(n=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&n!==void 0?n:10,refillInterval:1e4,P:ei}),this.startIfEnabled()}ft(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return ge(e)?t=$({},t,e):(x(e)?this.ct:e)&&(t=$({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.A.capture_console_errors||this.A.capture_unhandled_errors||this.A.capture_unhandled_rejections}startIfEnabled(){this.isEnabled&&(ei.info("enabled"),this.nt(this.lt))}nt(e){var t,i;(t=N.__PosthogExtensions__)!=null&&t.errorWrappingFunctions&&e(),(i=N.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"exception-autocapture",n=>{if(n)return ei.error("failed to load script",n);e()})}vt(){var e,t,i;(e=this.ut)==null||e.call(this),this.ut=void 0,(t=this.ht)==null||t.call(this),this.ht=void 0,(i=this.dt)==null||i.call(this),this.dt=void 0}onRemoteConfig(e){var t=e.autocaptureExceptions;this.ct=!!t||!1,this.A=this.ft(),this._instance.persistence&&this._instance.persistence.register({[Ns]:this.ct}),this.startIfEnabled()}captureException(e){var t,i,n=(t=e==null||(i=e.$exception_list)==null||(i=i[0])==null?void 0:i.type)!==null&&t!==void 0?t:"Exception";this.gt.consumeRateLimit(n)?ei.info("Skipping exception capture because of client rate limiting.",{exception:n}):this._instance.exceptions.sendExceptionEvent(e)}}function ho(r,e,t){try{if(!(e in r))return()=>{};var i=r[e],n=t(i);return Be(n)&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__posthog_wrapped__:{enumerable:!1,value:!0}})),r[e]=n,()=>{r[e]=i}}catch{return()=>{}}}class Oc{constructor(e){var t;this._instance=e,this._t=(f==null||(t=f.location)==null?void 0:t.pathname)||""}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(k.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.yt&&this.yt(),this.yt=void 0,k.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(f&&f.history){var i=this;(e=f.history.pushState)!=null&&e.__posthog_wrapped__||ho(f.history,"pushState",n=>function(s,o,a){n.call(this,s,o,a),i.bt("pushState")}),(t=f.history.replaceState)!=null&&t.__posthog_wrapped__||ho(f.history,"replaceState",n=>function(s,o,a){n.call(this,s,o,a),i.bt("replaceState")}),this.wt()}}bt(e){try{var t,i=f==null||(t=f.location)==null?void 0:t.pathname;if(!i)return;i!==this._t&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:e}),this._t=i}catch(n){k.error("Error capturing "+e+" pageview",n)}}wt(){if(!this.yt){var e=()=>{this.bt("popstate")};ue(f,"popstate",e),this.yt=()=>{f&&f.removeEventListener("popstate",e)}}}}var Qr=de("[SegmentIntegration]");function Fc(r,e){var t=r.config.segment;if(!t)return e();(function(i,n){var s=i.config.segment;if(!s)return n();var o=l=>{var c=()=>l.anonymousId()||Xe();i.config.get_device_id=c,l.id()&&(i.register({distinct_id:l.id(),$device_id:c()}),i.persistence.set_property(Le,"identified")),n()},a=s.user();"then"in a&&Be(a.then)?a.then(l=>o(l)):o(a)})(r,()=>{t.register((i=>{Promise&&Promise.resolve||Qr.warn("This browser does not have Promise support, and can not use the segment integration");var n=(s,o)=>{if(!o)return s;s.event.userId||s.event.anonymousId===i.get_distinct_id()||(Qr.info("No userId set, resetting PostHog"),i.reset()),s.event.userId&&s.event.userId!==i.get_distinct_id()&&(Qr.info("UserId set, identifying with PostHog"),i.identify(s.event.userId));var a=i.calculateEventProperties(o,s.event.properties);return s.event.properties=Object.assign({},a,s.event.properties),s};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:s=>n(s,s.event.event),page:s=>n(s,"$pageview"),identify:s=>n(s,"$identify"),screen:s=>n(s,"$screen")}})(r)).then(()=>{e()})})}var po="posthog-js";function go(r,e){var{organization:t,projectId:i,prefix:n,severityAllowList:s=["error"],sendExceptionsToPostHog:o=!0}=e===void 0?{}:e;return a=>{var l,c,u,d,p;if(!(s==="*"||s.includes(a.level))||!r.__loaded)return a;a.tags||(a.tags={});var h=r.requestRouter.endpointFor("ui","/project/"+r.config.token+"/person/"+r.get_distinct_id());a.tags["PostHog Person URL"]=h,r.sessionRecordingStarted()&&(a.tags["PostHog Recording URL"]=r.get_session_replay_url({withTimestamp:!0}));var m=((l=a.exception)==null?void 0:l.values)||[],v=m.map(E=>$({},E,{stacktrace:E.stacktrace?$({},E.stacktrace,{type:"raw",frames:(E.stacktrace.frames||[]).map(F=>$({},F,{platform:"web:javascript"}))}):void 0})),y={$exception_message:((c=m[0])==null?void 0:c.value)||a.message,$exception_type:(u=m[0])==null?void 0:u.type,$exception_level:a.level,$exception_list:v,$sentry_event_id:a.event_id,$sentry_exception:a.exception,$sentry_exception_message:((d=m[0])==null?void 0:d.value)||a.message,$sentry_exception_type:(p=m[0])==null?void 0:p.type,$sentry_tags:a.tags};return t&&i&&(y.$sentry_url=(n||"https://sentry.io/organizations/")+t+"/issues/?project="+i+"&query="+a.event_id),o&&r.exceptions.sendExceptionEvent(y),a}}class Tc{constructor(e,t,i,n,s,o){this.name=po,this.setupOnce=function(a){a(go(e,{organization:t,projectId:i,prefix:n,severityAllowList:s,sendExceptionsToPostHog:o==null||o}))}}}var Ac=f!=null&&f.location?Yi(f.location.hash,"__posthog")||Yi(location.hash,"state"):null,fo="_postHogToolbarParams",vo=de("[Toolbar]"),Je=function(r){return r[r.UNINITIALIZED=0]="UNINITIALIZED",r[r.LOADING=1]="LOADING",r[r.LOADED=2]="LOADED",r}(Je||{});class Cc{constructor(e){this.instance=e}xt(e){N.ph_toolbar_state=e}St(){var e;return(e=N.ph_toolbar_state)!==null&&e!==void 0?e:Je.UNINITIALIZED}maybeLoadToolbar(e,t,i){if(e===void 0&&(e=void 0),t===void 0&&(t=void 0),i===void 0&&(i=void 0),!f||!S)return!1;e=e??f.location,i=i??f.history;try{if(!t){try{f.localStorage.setItem("test","test"),f.localStorage.removeItem("test")}catch{return!1}t=f==null?void 0:f.localStorage}var n,s=Ac||Yi(e.hash,"__posthog")||Yi(e.hash,"state"),o=s?As(()=>JSON.parse(atob(decodeURIComponent(s))))||As(()=>JSON.parse(decodeURIComponent(s))):null;return o&&o.action==="ph_authorize"?((n=o).source="url",n&&Object.keys(n).length>0&&(o.desiredHash?e.hash=o.desiredHash:i?i.replaceState(i.state,"",e.pathname+e.search):e.hash="")):((n=JSON.parse(t.getItem(fo)||"{}")).source="localstorage",delete n.userIntent),!(!n.token||this.instance.config.token!==n.token)&&(this.loadToolbar(n),!0)}catch{return!1}}Et(e){var t=N.ph_load_toolbar||N.ph_load_editor;!ee(t)&&Be(t)?t(e,this.instance):vo.warn("No toolbar load function found")}loadToolbar(e){var t=!(S==null||!S.getElementById(Gs));if(!f||t)return!1;var i=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,n=$({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},i?{instrument:!1}:{});if(f.localStorage.setItem(fo,JSON.stringify($({},n,{source:void 0}))),this.St()===Je.LOADED)this.Et(n);else if(this.St()===Je.UNINITIALIZED){var s;this.xt(Je.LOADING),(s=N.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this.instance,"toolbar",o=>{if(o)return vo.error("[Toolbar] Failed to load",o),void this.xt(Je.UNINITIALIZED);this.xt(Je.LOADED),this.Et(n)}),ue(f,"turbolinks:load",()=>{this.xt(Je.UNINITIALIZED),this.loadToolbar(n)})}return!0}$t(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,i){return e===void 0&&(e=void 0),t===void 0&&(t=void 0),i===void 0&&(i=void 0),this.maybeLoadToolbar(e,t,i)}}var Rc=de("[TracingHeaders]");class Mc{constructor(e){this.kt=void 0,this.Pt=void 0,this.lt=()=>{var t,i;x(this.kt)&&((t=N.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null||t._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),x(this.Pt)&&((i=N.__PosthogExtensions__)==null||(i=i.tracingHeadersPatchFns)==null||i._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=e}nt(e){var t,i;(t=N.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns&&e(),(i=N.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"tracing-headers",n=>{if(n)return Rc.error("failed to load script",n);e()})}startIfEnabledOrStop(){var e,t;this._instance.config.__add_tracing_headers?this.nt(this.lt):((e=this.kt)==null||e.call(this),(t=this.Pt)==null||t.call(this),this.kt=void 0,this.Pt=void 0)}}var ke="Mobile",Zi="iOS",Re="Android",ti="Tablet",_o=Re+" "+ti,mo="iPad",yo="Apple",bo=yo+" Watch",ii="Safari",It="BlackBerry",wo="Samsung",Eo=wo+"Browser",xo=wo+" Internet",ot="Chrome",Nc=ot+" OS",So=ot+" "+Zi,Zr="Internet Explorer",ko=Zr+" "+ke,en="Opera",Dc=en+" Mini",tn="Edge",$o="Microsoft "+tn,Pt="Firefox",Io=Pt+" "+Zi,ri="Nintendo",ni="PlayStation",Ot="Xbox",Po=Re+" "+ke,Oo=ke+" "+ii,si="Windows",rn=si+" Phone",Fo="Nokia",nn="Ouya",To="Generic",Lc=To+" "+ke.toLowerCase(),Ao=To+" "+ti.toLowerCase(),sn="Konqueror",ve="(\\d+(\\.\\d+)?)",on=new RegExp("Version/"+ve),jc=new RegExp(Ot,"i"),Uc=new RegExp(ni+" \\w+","i"),qc=new RegExp(ri+" \\w+","i"),an=new RegExp(It+"|PlayBook|BB10","i"),Gc={"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"},Vc=(r,e)=>e&&q(e,yo)||function(t){return q(t,ii)&&!q(t,ot)&&!q(t,Re)}(r),Co=function(r,e){return e=e||"",q(r," OPR/")&&q(r,"Mini")?Dc:q(r," OPR/")?en:an.test(r)?It:q(r,"IE"+ke)||q(r,"WPDesktop")?ko:q(r,Eo)?xo:q(r,tn)||q(r,"Edg/")?$o:q(r,"FBIOS")?"Facebook "+ke:q(r,"UCWEB")||q(r,"UCBrowser")?"UC Browser":q(r,"CriOS")?So:q(r,"CrMo")||q(r,ot)?ot:q(r,Re)&&q(r,ii)?Po:q(r,"FxiOS")?Io:q(r.toLowerCase(),sn.toLowerCase())?sn:Vc(r,e)?q(r,ke)?Oo:ii:q(r,Pt)?Pt:q(r,"MSIE")||q(r,"Trident/")?Zr:q(r,"Gecko")?Pt:""},Hc={[ko]:[new RegExp("rv:"+ve)],[$o]:[new RegExp(tn+"?\\/"+ve)],[ot]:[new RegExp("("+ot+"|CrMo)\\/"+ve)],[So]:[new RegExp("CriOS\\/"+ve)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+ve)],[ii]:[on],[Oo]:[on],[en]:[new RegExp("(Opera|OPR)\\/"+ve)],[Pt]:[new RegExp(Pt+"\\/"+ve)],[Io]:[new RegExp("FxiOS\\/"+ve)],[sn]:[new RegExp("Konqueror[:/]?"+ve,"i")],[It]:[new RegExp(It+" "+ve),on],[Po]:[new RegExp("android\\s"+ve,"i")],[xo]:[new RegExp(Eo+"\\/"+ve)],[Zr]:[new RegExp("(rv:|MSIE )"+ve)],Mozilla:[new RegExp("rv:"+ve)]},Bc=function(r,e){var t=Co(r,e),i=Hc[t];if(x(i))return null;for(var n=0;n[Ot,r&&r[1]||""]],[new RegExp(ri,"i"),[ri,""]],[new RegExp(ni,"i"),[ni,""]],[an,[It,""]],[new RegExp(si,"i"),(r,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[rn,""];if(new RegExp(ke).test(e)&&!/IEMobile\b/.test(e))return[si+" "+ke,""];var t=/Windows NT ([0-9.]+)/i.exec(e);if(t&&t[1]){var i=t[1],n=Gc[i]||"";return/arm/i.test(e)&&(n="RT"),[si,n]}return[si,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,r=>{if(r&&r[3]){var e=[r[3],r[4],r[5]||"0"];return[Zi,e.join(".")]}return[Zi,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,r=>{var e="";return r&&r.length>=3&&(e=x(r[2])?r[3]:r[2]),["watchOS",e]}],[new RegExp("("+Re+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Re+")","i"),r=>{if(r&&r[2]){var e=[r[2],r[3],r[4]||"0"];return[Re,e.join(".")]}return[Re,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,r=>{var e=["Mac OS X",""];if(r&&r[1]){var t=[r[1],r[2],r[3]||"0"];e[1]=t.join(".")}return e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Nc,""]],[/Linux|debian/i,["Linux",""]]],Mo=function(r){return qc.test(r)?ri:Uc.test(r)?ni:jc.test(r)?Ot:new RegExp(nn,"i").test(r)?nn:new RegExp("("+rn+"|WPDesktop)","i").test(r)?rn:/iPad/.test(r)?mo:/iPod/.test(r)?"iPod Touch":/iPhone/.test(r)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(r)?bo:an.test(r)?It:/(kobo)\s(ereader|touch)/i.test(r)?"Kobo":new RegExp(Fo,"i").test(r)?Fo:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(r)||/(kf[a-z]+)( bui|\)).+silk\//i.test(r)?"Kindle Fire":/(Android|ZTE)/i.test(r)?!new RegExp(ke).test(r)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(r)?/pixel[\daxl ]{1,6}/i.test(r)&&!/pixel c/i.test(r)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(r)||/lmy47v/i.test(r)&&!/QTAQZ3/i.test(r)?Re:_o:Re:new RegExp("(pda|"+ke+")","i").test(r)?Lc:new RegExp(ti,"i").test(r)&&!new RegExp(ti+" pc","i").test(r)?Ao:""},er="https?://(.*)",Ft=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],zc=kt(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],Ft),oi="",Wc=["li_fat_id"];function No(r,e,t){if(!S)return{};var i,n=e?kt([],Ft,t||[]):[],s=Do(Qt(S.URL,n,oi),r),o=(i={},K(Wc,function(a){var l=Ce.J(a);i[a]=l||null}),i);return oe(o,s)}function Do(r,e){var t=zc.concat(e||[]),i={};return K(t,function(n){var s=Wi(r,n);i[n]=s||null}),i}function Lo(r){var e=function(s){return s?s.search(er+"google.([^/?]*)")===0?"google":s.search(er+"bing.com")===0?"bing":s.search(er+"yahoo.com")===0?"yahoo":s.search(er+"duckduckgo.com")===0?"duckduckgo":null:null}(r),t=e!="yahoo"?"q":"p",i={};if(!De(e)){i.$search_engine=e;var n=S?Wi(S.referrer,t):"";n.length&&(i.ph_keyword=n)}return i}function jo(){return navigator.language||navigator.userLanguage}function Uo(){return(S==null?void 0:S.referrer)||"$direct"}function qo(r,e){var t=r?kt([],Ft,e||[]):[],i=be==null?void 0:be.href.substring(0,1e3);return{r:Uo().substring(0,1e3),u:i?Qt(i,t,oi):void 0}}function Go(r){var e,{r:t,u:i}=r,n={$referrer:t,$referring_domain:t==null?void 0:t=="$direct"?"$direct":(e=zi(t))==null?void 0:e.host};if(i){n.$current_url=i;var s=zi(i);n.$host=s==null?void 0:s.host,n.$pathname=s==null?void 0:s.pathname;var o=Do(i);oe(n,o)}if(t){var a=Lo(t);oe(n,a)}return n}function Vo(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function Yc(){try{return new Date().getTimezoneOffset()}catch{return}}function Xc(r,e){if(!we)return{};var t,i,n,s=r?kt([],Ft,e||[]):[],[o,a]=function(l){for(var c=0;c1e3?we.substring(0,997)+"...":we,$browser_version:Bc(we,navigator.vendor),$browser_language:jo(),$browser_language_prefix:(t=jo(),typeof t=="string"?t.split("-")[0]:void 0),$screen_height:f==null?void 0:f.screen.height,$screen_width:f==null?void 0:f.screen.width,$viewport_height:f==null?void 0:f.innerHeight,$viewport_width:f==null?void 0:f.innerWidth,$lib:"web",$lib_version:Ne.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var Ke=de("[Web Vitals]"),Ho=9e5;class Jc{constructor(e){var t;this.Tt=!1,this.C=!1,this.q={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.It=()=>{clearTimeout(this.Rt),this.q.metrics.length!==0&&(this._instance.capture("$web_vitals",this.q.metrics.reduce((i,n)=>$({},i,{["$web_vitals_"+n.name+"_event"]:$({},n),["$web_vitals_"+n.name+"_value"]:n.value}),{})),this.q={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Ct=i=>{var n,s=(n=this._instance.sessionManager)==null?void 0:n.checkAndGetSessionAndWindowId(!0);if(x(s))Ke.error("Could not read session ID. Dropping metrics!");else{this.q=this.q||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var o=this.Ot();x(o)||(ee(i==null?void 0:i.name)||ee(i==null?void 0:i.value)?Ke.error("Invalid metric received",i):this.Ft&&i.value>=this.Ft?Ke.error("Ignoring metric with value >= "+this.Ft,i):(this.q.url!==o&&(this.It(),this.Rt=setTimeout(this.It,this.flushToCaptureTimeoutMs)),x(this.q.url)&&(this.q.url=o),this.q.firstMetricTimestamp=x(this.q.firstMetricTimestamp)?Date.now():this.q.firstMetricTimestamp,i.attribution&&i.attribution.interactionTargetElement&&(i.attribution.interactionTargetElement=void 0),this.q.metrics.push($({},i,{$current_url:o,$session_id:s.sessionId,$window_id:s.windowId,timestamp:Date.now()})),this.q.metrics.length===this.allowedMetrics.length&&this.It()))}},this.lt=()=>{var i,n,s,o,a=N.__PosthogExtensions__;x(a)||x(a.postHogWebVitalsCallbacks)||({onLCP:i,onCLS:n,onFCP:s,onINP:o}=a.postHogWebVitalsCallbacks),i&&n&&s&&o?(this.allowedMetrics.indexOf("LCP")>-1&&i(this.Ct.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&n(this.Ct.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&s(this.Ct.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&o(this.Ct.bind(this)),this.C=!0):Ke.error("web vitals callbacks not loaded - not starting")},this._instance=e,this.Tt=!((t=this._instance.persistence)==null||!t.props[Ls]),this.startIfEnabled()}get allowedMetrics(){var e,t,i=ge(this._instance.config.capture_performance)?(e=this._instance.config.capture_performance)==null?void 0:e.web_vitals_allowed_metrics:void 0;return x(i)?((t=this._instance.persistence)==null?void 0:t.props[Us])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(ge(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get Ft(){var e=ge(this._instance.config.capture_performance)&&Te(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:Ho;return 0{n?Ke.error("failed to load script",n):e()})}Ot(){var e=f?f.location.href:void 0;if(e){var t=this._instance.config.mask_personal_data_properties,i=this._instance.config.custom_personal_data_properties,n=t?kt([],Ft,i||[]):[];return Qt(e,n,oi)}Ke.error("Could not determine current URL")}}var Kc=de("[Heatmaps]");function Bo(r){return ge(r)&&"clientX"in r&&"clientY"in r&&Te(r.clientX)&&Te(r.clientY)}class Qc{constructor(e){var t;this.rageclicks=new so,this.Tt=!1,this.C=!1,this.Mt=null,this.instance=e,this.Tt=!((t=this.instance.persistence)==null||!t.props[Nr])}get flushIntervalMilliseconds(){var e=5e3;return ge(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 x(this.instance.config.capture_heatmaps)?x(this.instance.config.enable_heatmaps)?this.Tt:this.instance.config.enable_heatmaps:this.instance.config.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.C)return;Kc.info("starting..."),this.At(),this.Mt=setInterval(this.jt.bind(this),this.flushIntervalMilliseconds)}else{var e,t;clearInterval((e=this.Mt)!==null&&e!==void 0?e:void 0),(t=this.Dt)==null||t.stop(),this.getAndClearBuffer()}}onRemoteConfig(e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Nr]:t}),this.Tt=t,this.startIfEnabled()}getAndClearBuffer(){var e=this.q;return this.q=void 0,e}Lt(e){this.Nt(e.originalEvent,"deadclick")}At(){f&&S&&(ue(f,"beforeunload",this.jt.bind(this)),ue(S,"click",e=>this.Nt(e||(f==null?void 0:f.event)),{capture:!0}),ue(S,"mousemove",e=>this.Ut(e||(f==null?void 0:f.event)),{capture:!0}),this.Dt=new uo(this.instance,$c,this.Lt.bind(this)),this.Dt.startIfEnabled(),this.C=!0)}zt(e,t){var i=this.instance.scrollManager.scrollY(),n=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),o=function(a,l,c){for(var u=a;u&&Vi(u)&&!Ye(u,"body");){if(u===c)return!1;if(q(l,f==null?void 0:f.getComputedStyle(u).position))return!0;u=Js(u)}return!1}(Ys(e),["fixed","sticky"],s);return{x:e.clientX+(o?0:n),y:e.clientY+(o?0:i),target_fixed:o,type:t}}Nt(e,t){var i;if(t===void 0&&(t="click"),!Vs(e.target)&&Bo(e)){var n=this.zt(e,t);(i=this.rageclicks)!=null&&i.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this.Ht($({},n,{type:"rageclick"})),this.Ht(n)}}Ut(e){!Vs(e.target)&&Bo(e)&&(clearTimeout(this.Bt),this.Bt=setTimeout(()=>{this.Ht(this.zt(e,"mousemove"))},500))}Ht(e){if(f){var t=f.location.href,i=this.instance.config.mask_personal_data_properties,n=this.instance.config.custom_personal_data_properties,s=i?kt([],Ft,n||[]):[],o=Qt(t,s,oi);this.q=this.q||{},this.q[o]||(this.q[o]=[]),this.q[o].push(e)}}jt(){this.q&&!xt(this.q)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class Zc{constructor(e){this._instance=e}doPageView(e,t){var i,n=this.qt(e,t);return this.Wt={pathname:(i=f==null?void 0:f.location.pathname)!==null&&i!==void 0?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),n}doPageLeave(e){var t;return this.qt(e,(t=this.Wt)==null?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.Wt)==null?void 0:e.pageViewId}}qt(e,t){var i=this.Wt;if(!i)return{$pageview_id:t};var n={$pageview_id:t,$prev_pageview_id:i.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:o,lastScrollY:a,maxScrollY:l,maxContentHeight:c,lastContentY:u,maxContentY:d}=s;if(!(x(o)||x(a)||x(l)||x(c)||x(u)||x(d))){o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),c=Math.ceil(c),u=Math.ceil(u),d=Math.ceil(d);var p=o<=1?1:Ae(a/o,0,1,k),h=o<=1?1:Ae(l/o,0,1,k),m=c<=1?1:Ae(u/c,0,1,k),v=c<=1?1:Ae(d/c,0,1,k);n=oe(n,{$prev_pageview_last_scroll:a,$prev_pageview_last_scroll_percentage:p,$prev_pageview_max_scroll:l,$prev_pageview_max_scroll_percentage:h,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:m,$prev_pageview_max_content:d,$prev_pageview_max_content_percentage:v})}}return i.pathname&&(n.$prev_pageview_pathname=i.pathname),i.timestamp&&(n.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),n}}var $e=Uint8Array,_e=Uint16Array,Tt=Uint32Array,ln=new $e([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]),cn=new $e([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]),zo=new $e([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Wo=function(r,e){for(var t=new _e(31),i=0;i<31;++i)t[i]=e+=1<>>1|(21845&Q)<<1;at=(61680&(at=(52428&at)>>>2|(13107&at)<<2))>>>4|(3855&at)<<4,dn[Q]=((65280&at)>>>8|(255&at)<<8)>>>1}var ai=function(r,e,t){for(var i=r.length,n=0,s=new _e(e);n>>l]=c}else for(o=new _e(i),n=0;n>>15-r[n];return o},lt=new $e(288);for(Q=0;Q<144;++Q)lt[Q]=8;for(Q=144;Q<256;++Q)lt[Q]=9;for(Q=256;Q<280;++Q)lt[Q]=7;for(Q=280;Q<288;++Q)lt[Q]=8;var tr=new $e(32);for(Q=0;Q<32;++Q)tr[Q]=5;var tu=ai(lt,9,0),iu=ai(tr,5,0),Jo=function(r){return(r/8>>0)+(7&r&&1)},Ko=function(r,e,t){(t==null||t>r.length)&&(t=r.length);var i=new(r instanceof _e?_e:r instanceof Tt?Tt:$e)(t-e);return i.set(r.subarray(e,t)),i},qe=function(r,e,t){t<<=7&e;var i=e/8>>0;r[i]|=t,r[i+1]|=t>>>8},li=function(r,e,t){t<<=7&e;var i=e/8>>0;r[i]|=t,r[i+1]|=t>>>8,r[i+2]|=t>>>16},hn=function(r,e){for(var t=[],i=0;ip&&(p=s[i].s);var h=new _e(p+1),m=pn(t[u-1],h,0);if(m>e){i=0;var v=0,y=m-e,E=1<e))break;v+=E-(1<>>=y;v>0;){var I=s[i].s;h[I]=0&&v;--i){var b=s[i].s;h[b]==e&&(--h[b],++v)}m=e}return[new $e(h),m]},pn=function(r,e,t){return r.s==-1?Math.max(pn(r.l,e,t+1),pn(r.r,e,t+1)):e[r.s]=t},Qo=function(r){for(var e=r.length;e&&!r[--e];);for(var t=new _e(++e),i=0,n=r[0],s=1,o=function(l){t[i++]=l},a=1;a<=e;++a)if(r[a]==n&&a!=e)++s;else{if(!n&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(n),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(n);s=1,n=r[a]}return[t.subarray(0,i),e]},ci=function(r,e){for(var t=0,i=0;i>>8,r[n+2]=255^r[n],r[n+3]=255^r[n+1];for(var s=0;s4&&!G[zo[V-1]];--V);var re,W,T,se,ne=c+5<<3,Se=ci(n,lt)+ci(s,tr)+o,g=ci(n,p)+ci(s,v)+o+14+3*V+ci(D,G)+(2*D[16]+3*D[17]+7*D[18]);if(ne<=Se&&ne<=g)return gn(e,u,r.subarray(l,l+c));if(qe(e,u,1+(g15&&(qe(e,u,C[P]>>>5&127),u+=C[P]>>>12)}}}else re=tu,W=lt,T=iu,se=tr;for(P=0;P255){L=i[P]>>>18&31,li(e,u,re[L+257]),u+=W[L+257],L>7&&(qe(e,u,i[P]>>>23&31),u+=ln[L]);var te=31&i[P];li(e,u,T[te]),u+=se[te],te>3&&(li(e,u,i[P]>>>5&8191),u+=cn[te])}else li(e,u,re[i[P]]),u+=W[i[P]];return li(e,u,re[256]),u+W[256]},ru=new Tt([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),nu=function(){for(var r=new Tt(256),e=0;e<256;++e){for(var t=e,i=9;--i;)t=(1&t&&3988292384)^t>>>1;r[e]=t}return r}(),su=function(r,e,t,i,n){return function(s,o,a,l,c,u){var d=s.length,p=new $e(l+d+5*(1+Math.floor(d/7e3))+c),h=p.subarray(l,p.length-c),m=0;if(!o||d<8)for(var v=0;v<=d;v+=65535){var y=v+65535;y>>13,I=8191&E,b=(1<7e3||T>24576)&&O>423){m=Zo(s,h,0,G,Z,V,W,T,ne,v-ne,m),T=re=W=0,ne=v;for(var A=0;A<286;++A)Z[A]=0;for(A=0;A<30;++A)V[A]=0}var C=2,L=0,te=I,U=g-_&32767;if(O>2&&Se==B(v-U))for(var ae=Math.min(F,O)-1,H=Math.min(32767,v),Ie=Math.min(258,O);U<=H&&--te&&g!=_;){if(s[v+C]==s[v+C-U]){for(var Ee=0;EeC){if(C=Ee,L=U,Ee>ae)break;var Nt=Math.min(U,Ee-2),fi=0;for(A=0;Afi&&(fi=cr,_=dt)}}}U+=(g=_)-(_=w[g])+32768&32767}if(L){G[T++]=268435456|un[C]<<18|Xo[L];var wa=31&un[C],Ea=31&Xo[L];W+=ln[wa]+cn[Ea],++Z[257+wa],++V[Ea],se=v+C,++re}else G[T++]=s[v],++Z[s[v]]}}m=Zo(s,h,u,G,Z,V,W,T,ne,v-ne,m)}return Ko(p,0,l+Jo(m)+c)}(r,e.level==null?6:e.level,e.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(r.length)))):12+e.mem,t,i,!0)},fn=function(r,e,t){for(;t;++e)r[e]=t,t>>>=8};function ou(r,e){e===void 0&&(e={});var t=function(){var a=4294967295;return{p:function(l){for(var c=a,u=0;u>>8;a=c},d:function(){return 4294967295^a}}}(),i=r.length;t.p(r);var n,s=su(r,e,10+((n=e).filename&&n.filename.length+1||0),8),o=s.length;return function(a,l){var c=l.filename;if(a[0]=31,a[1]=139,a[2]=8,a[8]=l.level<2?4:l.level==9?2:0,a[9]=3,l.mtime!=0&&fn(a,4,Math.floor(new Date(l.mtime||Date.now())/1e3)),c){a[3]=8;for(var u=0;u<=c.length;++u)a[u+10]=c.charCodeAt(u)}}(s,e),fn(s,o-8,t.d()),fn(s,o-4,i),s}var au=function(r){var e,t,i,n,s="";for(e=t=0,i=(r=(r+"").replace(/\r\n/g,` `).replace(/\r/g,` `)).length,n=0;n127&&o<2048?String.fromCharCode(o>>6|192,63&o|128):String.fromCharCode(o>>12|224,o>>6&63|128,63&o|128),De(a)||(t>e&&(s+=r.substring(e,t)),s+=a,e=t=n+1)}return t>e&&(s+=r.substring(e,r.length)),s},lu=!!Pr||!!Ir,ea="text/plain",ir=(r,e)=>{var[t,i]=r.split("?"),n=$({},e);i==null||i.split("&").forEach(o=>{var[a]=o.split("=");delete n[a]});var s=pc(n);return t+"?"+(s=s?(i?i+"&":"")+s:i)},ui=(r,e)=>JSON.stringify(r,(t,i)=>typeof i=="bigint"?i.toString():i,e),vn=r=>{var{data:e,compression:t}=r;if(e){if(t===je.GZipJS){var i=ou(function(l,c){var u=l.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(l);for(var d=new $e(l.length+(l.length>>>1)),p=0,h=function(E){d[p++]=E},m=0;md.length){var v=new $e(p+8+(u-m<<1));v.set(d),d=v}var y=l.charCodeAt(m);y<128||c?h(y):y<2048?(h(192|y>>>6),h(128|63&y)):y>55295&&y<57344?(h(240|(y=65536+(1047552&y)|1023&l.charCodeAt(++m))>>>18),h(128|y>>>12&63),h(128|y>>>6&63),h(128|63&y)):(h(224|y>>>12),h(128|y>>>6&63),h(128|63&y))}return Ko(d,0,p)}(ui(e)),{mtime:0}),n=new Blob([i],{type:ea});return{contentType:ea,body:n,estimatedSize:n.size}}if(t===je.Base64){var s=function(l){var c,u,d,p,h,m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",v=0,y=0,E="",F=[];if(!l)return l;l=au(l);do c=(h=l.charCodeAt(v++)<<16|l.charCodeAt(v++)<<8|l.charCodeAt(v++))>>18&63,u=h>>12&63,d=h>>6&63,p=63&h,F[y++]=m.charAt(c)+m.charAt(u)+m.charAt(d)+m.charAt(p);while(v"data="+encodeURIComponent(typeof l=="string"?l:ui(l)))(s);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var a=ui(e);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},rr=[];Ir&&rr.push({transport:"fetch",method:r=>{var e,t,{contentType:i,body:n,estimatedSize:s}=(e=vn(r))!==null&&e!==void 0?e:{},o=new Headers;K(r.headers,function(u,d){o.append(d,u)}),i&&o.append("Content-Type",i);var a=r.url,l=null;if(ms){var c=new ms;l={signal:c.signal,timeout:setTimeout(()=>c.abort(),r.timeout)}}Ir(a,$({method:(r==null?void 0:r.method)||"GET",headers:o,keepalive:r.method==="POST"&&(s||0)<52428.8,body:n,signal:(t=l)==null?void 0:t.signal},r.fetchOptions)).then(u=>u.text().then(d=>{var p={statusCode:u.status,text:d};if(u.status===200)try{p.json=JSON.parse(d)}catch(h){k.error(h)}r.callback==null||r.callback(p)})).catch(u=>{k.error(u),r.callback==null||r.callback({statusCode:0,text:u})}).finally(()=>l?clearTimeout(l.timeout):null)}}),Pr&&rr.push({transport:"XHR",method:r=>{var e,t=new Pr;t.open(r.method||"GET",r.url,!0);var{contentType:i,body:n}=(e=vn(r))!==null&&e!==void 0?e:{};K(r.headers,function(s,o){t.setRequestHeader(o,s)}),i&&t.setRequestHeader("Content-Type",i),r.timeout&&(t.timeout=r.timeout),r.disableXHRCredentials||(t.withCredentials=!0),t.onreadystatechange=()=>{if(t.readyState===4){var s={statusCode:t.status,text:t.responseText};if(t.status===200)try{s.json=JSON.parse(t.responseText)}catch{}r.callback==null||r.callback(s)}},t.send(n)}}),xe!=null&&xe.sendBeacon&&rr.push({transport:"sendBeacon",method:r=>{var e=ir(r.url,{beacon:"1"});try{var t,{contentType:i,body:n}=(t=vn(r))!==null&&t!==void 0?t:{},s=typeof n=="string"?new Blob([n],{type:i}):n;xe.sendBeacon(e,s)}catch{}}});var At=function(r,e){if(!function(t){try{new RegExp(t)}catch{return!1}return!0}(e))return!1;try{return new RegExp(e).test(r)}catch{return!1}};function ta(r,e,t){return ui({distinct_id:r,userPropertiesToSet:e,userPropertiesToSetOnce:t})}var ia={exact:(r,e)=>e.some(t=>r.some(i=>t===i)),is_not:(r,e)=>e.every(t=>r.every(i=>t!==i)),regex:(r,e)=>e.some(t=>r.some(i=>At(t,i))),not_regex:(r,e)=>e.every(t=>r.every(i=>!At(t,i))),icontains:(r,e)=>e.map(nr).some(t=>r.map(nr).some(i=>t.includes(i))),not_icontains:(r,e)=>e.map(nr).every(t=>r.map(nr).every(i=>!t.includes(i)))},nr=r=>r.toLowerCase(),ra=de("[Error tracking]");class cu{constructor(e){var t,i;this.Gt=[],this.Vt=new Vl([new Hl,new Zl,new zl,new Bl,new Kl,new Jl,new Yl,new Ql],[Ll,ql]),this._instance=e,this.Gt=(t=(i=this._instance.persistence)==null?void 0:i.get_property(Dr))!==null&&t!==void 0?t:[]}onRemoteConfig(e){var t,i,n,s=(t=(i=e.errorTracking)==null?void 0:i.suppressionRules)!==null&&t!==void 0?t:[],o=(n=e.errorTracking)==null?void 0:n.captureExtensionExceptions;this.Gt=s,this._instance.persistence&&this._instance.persistence.register({[Dr]:this.Gt,[Ds]:o})}get Jt(){var e,t=!!this._instance.get_property(Ds),i=this._instance.config.error_tracking.captureExtensionExceptions;return(e=i??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.Vt.buildFromUnknown(e,{syntheticException:t==null?void 0:t.syntheticException,mechanism:{handled:t==null?void 0:t.handled}})}sendExceptionEvent(e){if(this.Kt(e))ra.info("Skipping exception capture because a suppression rule matched");else{if(this.Jt||!this.Yt(e))return this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"});ra.info("Skipping exception capture because it was thrown by an extension")}}Kt(e){var t=e.$exception_list;if(!t||!J(t)||t.length===0)return!1;var i=t.reduce((n,s)=>{var{type:o,value:a}=s;return ce(o)&&o.length>0&&n.$exception_types.push(o),ce(a)&&a.length>0&&n.$exception_values.push(a),n},{$exception_types:[],$exception_values:[]});return this.Gt.some(n=>{var s=n.values.map(o=>{var a,l=ia[o.operator],c=J(o.value)?o.value:[o.value],u=(a=i[o.key])!==null&&a!==void 0?a:[];return c.length>0&&l(c,u)});return n.type==="OR"?s.some(Boolean):s.every(Boolean)})}Yt(e){var t=e.$exception_list;return!(!t||!J(t))&&t.flatMap(i=>{var n,s;return(n=(s=i.stacktrace)==null?void 0:s.frames)!==null&&n!==void 0?n:[]}).some(i=>i.filename&&i.filename.startsWith("chrome-extension://"))}}var Oe=de("[FeatureFlags]"),_n="$active_feature_flags",Ct="$override_feature_flags",na="$feature_flag_payloads",di="$override_feature_flag_payloads",sa="$feature_flag_request_id",oa=r=>{var e={};for(var[t,i]of Di(r||{}))i&&(e[t]=i);return e},uu=r=>{var e=r.flags;return e?(r.featureFlags=Object.fromEntries(Object.keys(e).map(t=>{var i;return[t,(i=e[t].variant)!==null&&i!==void 0?i:e[t].enabled]})),r.featureFlagPayloads=Object.fromEntries(Object.keys(e).filter(t=>e[t].enabled).filter(t=>{var i;return(i=e[t].metadata)==null?void 0:i.payload}).map(t=>{var i;return[t,(i=e[t].metadata)==null?void 0:i.payload]}))):Oe.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),r},du=function(r){return r.FeatureFlags="feature_flags",r.Recordings="recordings",r}({});class hu{constructor(e){this.Xt=!1,this.Qt=!1,this.Zt=!1,this.ti=!1,this.ii=!1,this.ei=!1,this.ri=!1,this._instance=e,this.featureFlagEventHandlers=[]}si(){var e=this._instance.config.evaluation_environments;return e!=null&&e.length?e.filter(t=>{var i=t&&typeof t=="string"&&t.trim().length>0;return i||Oe.error("Invalid evaluation environment found:",t,"Expected non-empty string"),i}):[]}ni(){return this.si().length>0}flags(){if(this._instance.config.__preview_remote_config)this.ei=!0;else{var e=!this.oi&&(this._instance.config.advanced_disable_feature_flags||this._instance.config.advanced_disable_feature_flags_on_first_load);this.ai({disableFlags:e})}}get hasLoadedFlags(){return this.Qt}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._instance.get_property(jr),t=this._instance.get_property(Ct),i=this._instance.get_property(di);if(!i&&!t)return e||{};var n=oe({},e||{}),s=[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])];for(var o of s){var a,l,c=n[o],u=t==null?void 0:t[o],d=x(u)?(a=c==null?void 0:c.enabled)!==null&&a!==void 0&&a:!!u,p=x(u)?c.variant:typeof u=="string"?u:void 0,h=i==null?void 0:i[o],m=$({},c,{enabled:d,variant:d?p??(c==null?void 0:c.variant):void 0});d!==(c==null?void 0:c.enabled)&&(m.original_enabled=c==null?void 0:c.enabled),p!==(c==null?void 0:c.variant)&&(m.original_variant=c==null?void 0:c.variant),h&&(m.metadata=$({},c==null?void 0:c.metadata,{payload:h,original_payload:c==null||(l=c.metadata)==null?void 0:l.payload})),n[o]=m}return this.Xt||(Oe.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:n}),this.Xt=!0),n}getFlagVariants(){var e=this._instance.get_property($t),t=this._instance.get_property(Ct);if(!t)return e||{};for(var i=oe({},e),n=Object.keys(t),s=0;s{this.ai()},5))}li(){clearTimeout(this.oi),this.oi=void 0}ensureFlagsLoaded(){this.Qt||this.Zt||this.oi||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.ti=e}ai(e){var t;if(this.li(),!this._instance.L())if(this.Zt)this.ii=!0;else{var i={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:$({},((t=this._instance.persistence)==null?void 0:t.get_initial_props())||{},this._instance.get_property(Xt)||{}),group_properties:this._instance.get_property(nt)};(e!=null&&e.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(i.disable_flags=!0),this.ni()&&(i.evaluation_environments=this.si());var n=this._instance.config.__preview_remote_config,s=n?"/flags/?v=2":"/flags/?v=2&config=true",o=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",a=this._instance.requestRouter.endpointFor("api",s+o);n&&(i.timezone=Vo()),this.Zt=!0,this._instance.ui({method:"POST",url:a,data:i,compression:this._instance.config.disable_compression?void 0:je.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:l=>{var c,u,d=!0;if(l.statusCode===200&&(this.ii||(this.$anon_distinct_id=void 0),d=!1),this.Zt=!1,this.ei||(this.ei=!0,this._instance.hi((u=l.json)!==null&&u!==void 0?u:{})),!i.disable_flags||this.ii)if(this.ri=!d,l.json&&(c=l.json.quotaLimited)!=null&&c.includes(du.FeatureFlags))Oe.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.");else{var p;i.disable_flags||this.receivedFeatureFlags((p=l.json)!==null&&p!==void 0?p:{},d),this.ii&&(this.ii=!1,this.ai())}}})}}getFeatureFlag(e,t){if(t===void 0&&(t={}),this.Qt||this.getFlags()&&this.getFlags().length>0){var i=this.getFlagVariants()[e],n=""+i,s=this._instance.get_property(sa)||void 0,o=this._instance.get_property(Ui)||{};if((t.send_event||!("send_event"in t))&&(!(e in o)||!o[e].includes(n))){var a,l,c,u,d,p,h,m,v;J(o[e])?o[e].push(n):o[e]=[n],(a=this._instance.persistence)==null||a.register({[Ui]:o});var y=this.getFeatureFlagDetails(e),E={$feature_flag:e,$feature_flag_response:i,$feature_flag_payload:this.getFeatureFlagPayload(e)||null,$feature_flag_request_id:s,$feature_flag_bootstrapped_response:((l=this._instance.config.bootstrap)==null||(l=l.featureFlags)==null?void 0:l[e])||null,$feature_flag_bootstrapped_payload:((c=this._instance.config.bootstrap)==null||(c=c.featureFlagPayloads)==null?void 0:c[e])||null,$used_bootstrap_value:!this.ri};x(y==null||(u=y.metadata)==null?void 0:u.version)||(E.$feature_flag_version=y.metadata.version);var F,I=(d=y==null||(p=y.reason)==null?void 0:p.description)!==null&&d!==void 0?d:y==null||(h=y.reason)==null?void 0:h.code;I&&(E.$feature_flag_reason=I),y!=null&&(m=y.metadata)!=null&&m.id&&(E.$feature_flag_id=y.metadata.id),x(y==null?void 0:y.original_variant)&&x(y==null?void 0:y.original_enabled)||(E.$feature_flag_original_response=x(y.original_variant)?y.original_enabled:y.original_variant),y!=null&&(v=y.metadata)!=null&&v.original_payload&&(E.$feature_flag_original_payload=y==null||(F=y.metadata)==null?void 0:F.original_payload),this._instance.capture("$feature_flag_called",E)}return i}Oe.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 i=this._instance.config.token,n={distinct_id:this._instance.get_distinct_id(),token:i};this.ni()&&(n.evaluation_environments=this.si()),this._instance.ui({method:"POST",url:this._instance.requestRouter.endpointFor("api","/flags/?v=2&config=true"),data:n,compression:this._instance.config.disable_compression?void 0:je.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:s=>{var o,a=(o=s.json)==null?void 0:o.featureFlagPayloads;t((a==null?void 0:a[e])||void 0)}})}isFeatureEnabled(e,t){if(t===void 0&&(t={}),this.Qt||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlag(e,t);return x(i)?void 0:!!i}Oe.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.Qt=!0;var i=this.getFlagVariants(),n=this.getFlagPayloads(),s=this.getFlagsWithDetails();(function(o,a,l,c,u){l===void 0&&(l={}),c===void 0&&(c={}),u===void 0&&(u={});var d=uu(o),p=d.flags,h=d.featureFlags,m=d.featureFlagPayloads;if(h){var v=o.requestId;if(J(h)){Oe.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var y={};if(h)for(var E=0;Ethis.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var n,s=(this._instance.get_property(Yt)||[]).find(c=>c.flagKey===e),o={["$feature_enrollment/"+e]:t},a={$feature_flag:e,$feature_enrollment:t,$set:o};s&&(a.$early_access_feature_name=s.name),i&&(a.$feature_enrollment_stage=i),this._instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(o,!1);var l=$({},this.getFlagVariants(),{[e]:t});(n=this._instance.persistence)==null||n.register({[_n]:Object.keys(oa(l)),[$t]:l}),this.di()}getEarlyAccessFeatures(e,t,i){t===void 0&&(t=!1);var n=this._instance.get_property(Yt),s=i?"&"+i.map(o=>"stage="+o).join("&"):"";if(n&&!t)return e(n);this._instance.ui({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+s),method:"GET",callback:o=>{var a,l;if(o.json){var c=o.json.earlyAccessFeatures;return(a=this._instance.persistence)==null||a.unregister(Yt),(l=this._instance.persistence)==null||l.register({[Yt]:c}),e(c)}}})}vi(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(i=>t[i]),flagVariants:Object.keys(t).filter(i=>t[i]).reduce((i,n)=>(i[n]=t[n],i),{})}}di(e){var{flags:t,flagVariants:i}=this.vi();this.featureFlagEventHandlers.forEach(n=>n(t,i,{errorsLoading:e}))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var i=this._instance.get_property(Xt)||{};this._instance.register({[Xt]:$({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(Xt)}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var i=this._instance.get_property(nt)||{};Object.keys(i).length!==0&&Object.keys(i).forEach(n=>{i[n]=$({},i[n],e[n]),delete e[n]}),this._instance.register({[nt]:$({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(nt)||{};this._instance.register({[nt]:$({},t,{[e]:{}})})}else this._instance.unregister(nt)}reset(){this.Qt=!1,this.Zt=!1,this.ti=!1,this.ii=!1,this.ei=!1,this.ri=!1,this.$anon_distinct_id=void 0,this.li(),this.Xt=!1}}var pu=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class mn{constructor(e,t){this.A=e,this.props={},this.ci=!1,this.fi=(i=>{var n="";return i.token&&(n=i.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),i.persistence_name?"ph_"+i.persistence_name:"ph_"+n+"_posthog"})(e),this.it=this.pi(e),this.load(),e.debug&&k.info("Persistence loaded",e.persistence,$({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this.gi}pi(e){pu.indexOf(e.persistence.toLowerCase())===-1&&(k.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=e.persistence.toLowerCase();return t==="localstorage"&&ie.G()?ie:t==="localstorage+cookie"&&Ji.G()?Ji:t==="sessionstorage"&&pe.G()?pe:t==="memory"?Sc:t==="cookie"?Ce:Ji.G()?Ji:Ce}properties(){var e={};return K(this.props,function(t,i){if(i===$t&&ge(t))for(var n=Object.keys(t),s=0;s{this.props.hasOwnProperty(o)&&this.props[o]!==t||(this.props[o]=s,n=!0)}),n)return this.save(),!0}return!1}register(e,t){if(ge(e)){this.mi=x(t)?this.wi:t;var i=!1;if(K(e,(n,s)=>{e.hasOwnProperty(s)&&this.props[s]!==n&&(this.props[s]=n,i=!0)}),i)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.ci){var e=No(this.A.custom_campaign_params,this.A.mask_personal_data_properties,this.A.custom_personal_data_properties);xt(Mr(e))||this.register(e),this.ci=!0}}update_search_keyword(){var e;this.register((e=S==null?void 0:S.referrer)?Lo(e):{})}update_referrer_info(){var e;this.register_once({$referrer:Uo(),$referring_domain:S!=null&&S.referrer&&((e=zi(S.referrer))==null?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[Vr]||this.props[Hr]||this.register_once({[qi]:qo(this.A.mask_personal_data_properties,this.A.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};K([Hr,Vr],o=>{var a=this.props[o];a&&K(a,function(l,c){e["$initial_"+Or(c)]=l})});var t,i,n=this.props[qi];if(n){var s=(t=Go(n),i={},K(t,function(o,a){i["$initial_"+Or(a)]=o}),i);oe(e,s)}return e}safe_merge(e){return K(this.props,function(t,i){i in e||(e[i]=t)}),e}update_config(e,t,i){if(this.wi=this.mi=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!i),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence){var n=this.pi(e),s=this.props;this.clear(),this.it=n,this.props=s,this.save()}}set_disabled(e){this.gi=e,this.gi?this.remove():this.save()}set_cross_subdomain(e){e!==this.yi&&(this.yi=e,this.remove(),this.save())}set_secure(e){e!==this.bi&&(this.bi=e,this.remove(),this.save())}set_event_timer(e,t){var i=this.props[Wt]||{};i[e]=t,this.props[Wt]=i,this.save()}remove_event_timer(e){var t=(this.props[Wt]||{})[e];return x(t)||(delete this.props[Wt][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}}(function(r){return r.Button="button",r.Tab="tab",r.Selector="selector",r})({}),function(r){return r.TopLeft="top_left",r.TopRight="top_right",r.TopCenter="top_center",r.MiddleLeft="middle_left",r.MiddleRight="middle_right",r.MiddleCenter="middle_center",r.Left="left",r.Center="center",r.Right="right",r.NextToTrigger="next_to_trigger",r}({});var yn=function(r){return r.Popover="popover",r.API="api",r.Widget="widget",r.ExternalSurvey="external_survey",r}({});(function(r){return r.Open="open",r.MultipleChoice="multiple_choice",r.SingleChoice="single_choice",r.Rating="rating",r.Link="link",r})({}),function(r){return r.NextQuestion="next_question",r.End="end",r.ResponseBased="response_based",r.SpecificQuestion="specific_question",r}({}),function(r){return r.Once="once",r.Recurring="recurring",r.Always="always",r}({});var sr=function(r){return r.SHOWN="survey shown",r.DISMISSED="survey dismissed",r.SENT="survey sent",r}({}),aa=function(r){return r.SURVEY_ID="$survey_id",r.SURVEY_NAME="$survey_name",r.SURVEY_RESPONSE="$survey_response",r.SURVEY_ITERATION="$survey_iteration",r.SURVEY_ITERATION_START_DATE="$survey_iteration_start_date",r.SURVEY_PARTIALLY_COMPLETED="$survey_partially_completed",r.SURVEY_SUBMISSION_ID="$survey_submission_id",r.SURVEY_QUESTIONS="$survey_questions",r.SURVEY_COMPLETED="$survey_completed",r}({}),la=function(r){return r.Popover="popover",r.Inline="inline",r}({});class bn{constructor(){this.xi={},this.xi={}}on(e,t){return this.xi[e]||(this.xi[e]=[]),this.xi[e].push(t),()=>{this.xi[e]=this.xi[e].filter(i=>i!==t)}}emit(e,t){for(var i of this.xi[e]||[])i(t);for(var n of this.xi["*"]||[])n(e,t)}}class ct{constructor(e){this.Si=new bn,this.Ei=(t,i)=>this.$i(t,i)&&this.ki(t,i)&&this.Pi(t,i),this.$i=(t,i)=>i==null||!i.event||(t==null?void 0:t.event)===(i==null?void 0:i.event),this._instance=e,this.Ti=new Set,this.Ii=new Set}init(){var e;if(!x((e=this._instance)==null?void 0:e.Ri)){var t;(t=this._instance)==null||t.Ri((i,n)=>{this.on(i,n)})}}register(e){var t,i;if(!x((t=this._instance)==null?void 0:t.Ri)&&(e.forEach(o=>{var a,l;(a=this.Ii)==null||a.add(o),(l=o.steps)==null||l.forEach(c=>{var u;(u=this.Ti)==null||u.add((c==null?void 0:c.event)||"")})}),(i=this._instance)!=null&&i.autocapture)){var n,s=new Set;e.forEach(o=>{var a;(a=o.steps)==null||a.forEach(l=>{l!=null&&l.selector&&s.add(l==null?void 0:l.selector)})}),(n=this._instance)==null||n.autocapture.setElementSelectors(s)}}on(e,t){var i;t!=null&&e.length!=0&&(this.Ti.has(e)||this.Ti.has(t==null?void 0:t.event))&&this.Ii&&((i=this.Ii)==null?void 0:i.size)>0&&this.Ii.forEach(n=>{this.Ci(t,n)&&this.Si.emit("actionCaptured",n.name)})}Oi(e){this.onAction("actionCaptured",t=>e(t))}Ci(e,t){if((t==null?void 0:t.steps)==null)return!1;for(var i of t.steps)if(this.Ei(e,i))return!0;return!1}onAction(e,t){return this.Si.on(e,t)}ki(e,t){if(t!=null&&t.url){var i,n=e==null||(i=e.properties)==null?void 0:i.$current_url;if(!n||typeof n!="string"||!ct.Fi(n,t==null?void 0:t.url,(t==null?void 0:t.url_matching)||"contains"))return!1}return!0}static Fi(e,t,i){switch(i){case"regex":return!!f&&At(e,t);case"exact":return t===e;case"contains":var n=ct.Mi(t).replace(/_/g,".").replace(/%/g,".*");return At(e,n);default:return!1}}static Mi(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}Pi(e,t){if((t!=null&&t.href||t!=null&&t.tag_name||t!=null&&t.text)&&!this.Ai(e).some(s=>!(t!=null&&t.href&&!ct.Fi(s.href||"",t==null?void 0:t.href,(t==null?void 0:t.href_matching)||"exact"))&&(t==null||!t.tag_name||s.tag_name===(t==null?void 0:t.tag_name))&&!(t!=null&&t.text&&!ct.Fi(s.text||"",t==null?void 0:t.text,(t==null?void 0:t.text_matching)||"exact")&&!ct.Fi(s.$el_text||"",t==null?void 0:t.text,(t==null?void 0:t.text_matching)||"exact"))))return!1;if(t!=null&&t.selector){var i,n=e==null||(i=e.properties)==null?void 0:i.$element_selectors;if(!n||!n.includes(t==null?void 0:t.selector))return!1}return!0}Ai(e){return(e==null?void 0:e.properties.$elements)==null?[]:e==null?void 0:e.properties.$elements}}var Y=de("[Surveys]"),wn="seenSurvey_",gu=(r,e)=>{var t="$survey_"+e+"/"+r.id;return r.current_iteration&&r.current_iteration>0&&(t="$survey_"+e+"/"+r.id+"/"+r.current_iteration),t},ca=r=>{var e=""+wn+r.id;return r.current_iteration&&r.current_iteration>0&&(e=""+wn+r.id+"_"+r.current_iteration),e},fu=[yn.Popover,yn.Widget,yn.API],vu={ignoreConditions:!1,ignoreDelay:!1,displayType:la.Popover};class _u{constructor(e){this._instance=e,this.ji=new Map,this.Di=new Map}register(e){var t;x((t=this._instance)==null?void 0:t.Ri)||(this.Li(e),this.Ni(e))}Ni(e){var t=e.filter(i=>{var n,s;return((n=i.conditions)==null?void 0:n.actions)&&((s=i.conditions)==null||(s=s.actions)==null||(s=s.values)==null?void 0:s.length)>0});t.length!==0&&(this.Ui==null&&(this.Ui=new ct(this._instance),this.Ui.init(),this.Ui.Oi(i=>{this.onAction(i)})),t.forEach(i=>{var n,s,o,a,l;i.conditions&&(n=i.conditions)!=null&&n.actions&&(s=i.conditions)!=null&&(s=s.actions)!=null&&s.values&&((o=i.conditions)==null||(o=o.actions)==null||(o=o.values)==null?void 0:o.length)>0&&((a=this.Ui)==null||a.register(i.conditions.actions.values),(l=i.conditions)==null||(l=l.actions)==null||(l=l.values)==null||l.forEach(c=>{if(c&&c.name){var u=this.Di.get(c.name);u&&u.push(i.id),this.Di.set(c.name,u||[i.id])}}))}))}Li(e){var t;e.filter(i=>{var n,s;return((n=i.conditions)==null?void 0:n.events)&&((s=i.conditions)==null||(s=s.events)==null||(s=s.values)==null?void 0:s.length)>0}).length!==0&&((t=this._instance)==null||t.Ri((i,n)=>{this.onEvent(i,n)}),e.forEach(i=>{var n;(n=i.conditions)==null||(n=n.events)==null||(n=n.values)==null||n.forEach(s=>{if(s&&s.name){var o=this.ji.get(s.name);o&&o.push(i.id),this.ji.set(s.name,o||[i.id])}})}))}onEvent(e,t){var i,n,s=((i=this._instance)==null||(i=i.persistence)==null?void 0:i.props[ji])||[];if(sr.SHOWN===e&&t&&s.length>0){var o;Y.info("survey event matched, removing survey from activated surveys",{event:e,eventPayload:t,existingActivatedSurveys:s});var a=t==null||(o=t.properties)==null?void 0:o.$survey_id;if(a){var l=s.indexOf(a);l>=0&&(s.splice(l,1),this.zi(s))}}else if(this.ji.has(e)){Y.info("survey event name matched",{event:e,eventPayload:t,surveys:this.ji.get(e)});var c=[];(n=this._instance)==null||n.getSurveys(d=>{c=d.filter(p=>{var h;return(h=this.ji.get(e))==null?void 0:h.includes(p.id)})});var u=c.filter(d=>{var p,h=(p=d.conditions)==null||(p=p.events)==null||(p=p.values)==null?void 0:p.find(m=>m.name===e);return!!h&&(!h.propertyFilters||Object.entries(h.propertyFilters).every(m=>{var v,[y,E]=m,F=t==null||(v=t.properties)==null?void 0:v[y];if(x(F)||De(F))return!1;var I=[String(F)],b=ia[E.operator];return b?b(E.values,I):(Y.warn("Unknown property comparison operator: "+E.operator),!1)}))});this.zi(s.concat(u.map(d=>d.id)||[]))}}onAction(e){var t,i=((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[ji])||[];this.Di.has(e)&&this.zi(i.concat(this.Di.get(e)||[]))}zi(e){var t;Y.info("updating activated surveys",{activatedSurveys:e}),(t=this._instance)==null||(t=t.persistence)==null||t.register({[ji]:[...new Set(e)]})}getSurveys(){var e,t=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[ji];return t||[]}getEventToSurveys(){return this.ji}Hi(){return this.Ui}}class mu{constructor(e){this.Bi=void 0,this._surveyManager=null,this.qi=!1,this.Wi=!1,this.Gi=[],this._instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){if(!this._instance.config.disable_surveys){var t=e.surveys;if(ee(t))return Y.warn("Flags not loaded yet. Not loading surveys.");var i=J(t);this.Bi=i?t.length>0:t,Y.info("flags response received, isSurveysEnabled: "+this.Bi),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;tlocalStorage.removeItem(n))}loadIfEnabled(){if(!this._surveyManager)if(this.Wi)Y.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)Y.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())Y.info("Not loading surveys in cookieless mode without consent.");else{var e=N==null?void 0:N.__PosthogExtensions__;if(e){if(!x(this.Bi)||this._instance.config.advanced_enable_surveys){var t=this.Bi||this._instance.config.advanced_enable_surveys;this.Wi=!0;try{var i=e.generateSurveys;if(i)return void this.Vi(i,t);var n=e.loadExternalDependency;if(!n)return void this.Ji("PostHog loadExternalDependency extension not found.");n(this._instance,"surveys",s=>{s||!e.generateSurveys?this.Ji("Could not load surveys script",s):this.Vi(e.generateSurveys,t)})}catch(s){throw this.Ji("Error initializing surveys",s),s}finally{this.Wi=!1}}}else Y.error("PostHog Extensions not found.")}}Vi(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new _u(this._instance),Y.info("Surveys loaded successfully"),this.Ki({isLoaded:!0})}Ji(e,t){Y.error(e,t),this.Ki({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Gi.push(e),this._surveyManager&&this.Ki({isLoaded:!0}),()=>{this.Gi=this.Gi.filter(t=>t!==e)}}getSurveys(e,t){if(t===void 0&&(t=!1),this._instance.config.disable_surveys)return Y.info("Disabled. Not loading surveys."),e([]);var i=this._instance.get_property(Ur);if(i&&!t)return e(i,{isLoaded:!0});if(this.qi)return e([],{isLoaded:!1,error:"Surveys are already being loaded"});try{this.qi=!0,this._instance.ui({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:n=>{var s;this.qi=!1;var o=n.statusCode;if(o!==200||!n.json){var a="Surveys API could not be loaded, status: "+o;return Y.error(a),e([],{isLoaded:!1,error:a})}var l,c=n.json.surveys||[],u=c.filter(d=>function(p){return!(!p.start_date||p.end_date)}(d)&&(function(p){var h;return!((h=p.conditions)==null||(h=h.events)==null||(h=h.values)==null||!h.length)}(d)||function(p){var h;return!((h=p.conditions)==null||(h=h.actions)==null||(h=h.values)==null||!h.length)}(d)));return u.length>0&&((l=this._surveyEventReceiver)==null||l.register(u)),(s=this._instance.persistence)==null||s.register({[Ur]:c}),e(c,{isLoaded:!0})}})}catch(n){throw this.qi=!1,n}}Ki(e){for(var t of this.Gi)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(i){Y.error("Error in survey callback",i)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!ee(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);Y.warn("init was not called")}Yi(e){var t=null;return this.getSurveys(i=>{var n;t=(n=i.find(s=>s.id===e))!==null&&n!==void 0?n:null}),t}Xi(e){if(ee(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var t=typeof e=="string"?this.Yi(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(ee(this._surveyManager))return Y.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var t=this.Xi(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return ee(this._surveyManager)?(Y.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise(i=>{this.getSurveys(n=>{var s,o=(s=n.find(l=>l.id===e))!==null&&s!==void 0?s:null;if(o){var a=this.Xi(o);i({visible:a.eligible,disabledReason:a.reason})}else i({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t){var i;if(ee(this._surveyManager))Y.warn("init was not called");else{var n=typeof e=="string"?this.Yi(e):e;if(n!=null&&n.id)if(fu.includes(n.type)){var s=S==null?void 0:S.querySelector(t);if(s)return(i=n.appearance)!=null&&i.surveyPopupDelaySeconds?(Y.info("Rendering survey "+n.id+" with delay of "+n.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout(()=>{var o,a;Y.info("Rendering survey "+n.id+" with delay of "+((o=n.appearance)==null?void 0:o.surveyPopupDelaySeconds)+" seconds"),(a=this._surveyManager)==null||a.renderSurvey(n,s),Y.info("Survey "+n.id+" rendered")},1e3*n.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(n,s);Y.warn("Survey element not found")}else Y.warn("Surveys of type "+n.type+" cannot be rendered in the app");else Y.warn("Survey not found")}}displaySurvey(e,t){var i;if(ee(this._surveyManager))Y.warn("init was not called");else{var n=this.Yi(e);if(n){var s=n;if((i=n.appearance)!=null&&i.surveyPopupDelaySeconds&&t.ignoreDelay&&(s=$({},n,{appearance:$({},n.appearance,{surveyPopupDelaySeconds:0})})),t.ignoreConditions===!1){var o=this.canRenderSurvey(n);if(!o.visible)return void Y.warn("Survey is not eligible to be displayed: ",o.disabledReason)}t.displayType!==la.Inline?this._surveyManager.handlePopoverSurvey(s):this.renderSurvey(s,t.selector)}else Y.warn("Survey not found")}}}var ua=de("[RateLimiter]");class yu{constructor(e){var t,i;this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=n=>{var s=n.text;if(s&&s.length)try{(JSON.parse(s).quota_limited||[]).forEach(o=>{ua.info((o||"events")+" is quota limited."),this.serverLimits[o]=new Date().getTime()+6e4})}catch(o){return void ua.warn('could not rate limit - continuing. Error: "'+(o==null?void 0:o.message)+'"',{text:s})}},this.instance=e,this.captureEventsPerSecond=((t=e.config.rate_limiting)==null?void 0:t.events_per_second)||10,this.captureEventsBurstLimit=Math.max(((i=e.config.rate_limiting)==null?void 0:i.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(e){var t,i,n;e===void 0&&(e=!1);var s=new Date().getTime(),o=(t=(i=this.instance.persistence)==null?void 0:i.get_property(Gr))!==null&&t!==void 0?t:{tokens:this.captureEventsBurstLimit,last:s};o.tokens+=(s-o.last)/1e3*this.captureEventsPerSecond,o.last=s,o.tokens>this.captureEventsBurstLimit&&(o.tokens=this.captureEventsBurstLimit);var a=o.tokens<1;return a||e||(o.tokens=Math.max(0,o.tokens-1)),!a||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=a,(n=this.instance.persistence)==null||n.set_property(Gr,o),{isRateLimited:a,remainingTokens:o.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()e(this.remoteConfig)):(ut.error("PostHog Extensions not found. Cannot load remote config."),e())}Zi(e){this._instance.ui({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 ut.info("Using preloaded remote config",this.remoteConfig),void this.hi(this.remoteConfig);if(this._instance.L())return void ut.warn("Remote config is disabled. Falling back to local config.");this.Qi(e=>{if(!e)return ut.info("No config found after loading remote JS config. Falling back to JSON."),void this.Zi(t=>{this.hi(t)});this.hi(e)})}catch(e){ut.error("Error loading remote config",e)}}hi(e){e?this._instance.config.__preview_remote_config?(this._instance.hi(e),e.hasFeatureFlags!==!1&&this._instance.featureFlags.ensureFlagsLoaded()):ut.info("__preview_remote_config is disabled. Logging config instead",e):ut.error("Failed to fetch remote config from PostHog.")}}var En=3e3;class wu{constructor(e,t){this.te=!0,this.ie=[],this.ee=Ae((t==null?void 0:t.flush_interval_ms)||En,250,5e3,k.createLogger("flush interval"),En),this.re=e}enqueue(e){this.ie.push(e),this.se||this.ne()}unload(){this.oe();var e=this.ie.length>0?this.ae():{},t=Object.values(e);[...t.filter(i=>i.url.indexOf("/e")===0),...t.filter(i=>i.url.indexOf("/e")!==0)].map(i=>{this.re($({},i,{transport:"sendBeacon"}))})}enable(){this.te=!1,this.ne()}ne(){var e=this;this.te||(this.se=setTimeout(()=>{if(this.oe(),this.ie.length>0){var t=this.ae(),i=function(){var s=t[n],o=new Date().getTime();s.data&&J(s.data)&&K(s.data,a=>{a.offset=Math.abs(a.timestamp-o),delete a.timestamp}),e.re(s)};for(var n in t)i()}},this.ee))}oe(){clearTimeout(this.se),this.se=void 0}ae(){var e={};return K(this.ie,t=>{var i,n=t,s=(n?n.batchKey:null)||n.url;x(e[s])&&(e[s]=$({},n,{data:[]})),(i=e[s].data)==null||i.push(n.data)}),this.ie=[],e}}var Eu=["retriesPerformedSoFar"];class xu{constructor(e){this.le=!1,this.ue=3e3,this.ie=[],this._instance=e,this.ie=[],this.he=!0,!x(f)&&"onLine"in f.navigator&&(this.he=f.navigator.onLine,ue(f,"online",()=>{this.he=!0,this.jt()}),ue(f,"offline",()=>{this.he=!1}))}get length(){return this.ie.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,i=ws(e,Eu);Te(t)&&t>0&&(i.url=ir(i.url,{retry_count:t})),this._instance.ui($({},i,{callback:n=>{n.statusCode!==200&&(n.statusCode<400||n.statusCode>=500)&&(t??0)<10?this.de($({retriesPerformedSoFar:t},i)):i.callback==null||i.callback(n)}}))}de(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var i=function(o){var a=3e3*Math.pow(2,o),l=a/2,c=Math.min(18e5,a),u=(Math.random()-.5)*(c-l);return Math.ceil(c+u)}(t),n=Date.now()+i;this.ie.push({retryAt:n,requestOptions:e});var s="Enqueued failed request for retry in "+i;navigator.onLine||(s+=" (Browser is offline)"),k.warn(s),this.le||(this.le=!0,this.ve())}ve(){this.ce&&clearTimeout(this.ce),this.ce=setTimeout(()=>{this.he&&this.ie.length>0&&this.jt(),this.ve()},this.ue)}jt(){var e=Date.now(),t=[],i=this.ie.filter(s=>s.retryAt0)for(var{requestOptions:n}of i)this.retriableRequest(n)}unload(){for(var{requestOptions:e}of(this.ce&&(clearTimeout(this.ce),this.ce=void 0),this.ie))try{this._instance.ui($({},e,{transport:"sendBeacon"}))}catch(t){k.error(t)}this.ie=[]}}class Su{constructor(e){this.fe=()=>{var t,i,n,s;this.pe||(this.pe={});var o=this.scrollElement(),a=this.scrollY(),l=o?Math.max(0,o.scrollHeight-o.clientHeight):0,c=a+((o==null?void 0:o.clientHeight)||0),u=(o==null?void 0:o.scrollHeight)||0;this.pe.lastScrollY=Math.ceil(a),this.pe.maxScrollY=Math.max(a,(t=this.pe.maxScrollY)!==null&&t!==void 0?t:0),this.pe.maxScrollHeight=Math.max(l,(i=this.pe.maxScrollHeight)!==null&&i!==void 0?i:0),this.pe.lastContentY=c,this.pe.maxContentY=Math.max(c,(n=this.pe.maxContentY)!==null&&n!==void 0?n:0),this.pe.maxContentHeight=Math.max(u,(s=this.pe.maxContentHeight)!==null&&s!==void 0?s:0)},this._instance=e}getContext(){return this.pe}resetContext(){var e=this.pe;return setTimeout(this.fe,0),e}startMeasuringScrollPosition(){ue(f,"scroll",this.fe,{capture:!0}),ue(f,"scrollend",this.fe,{capture:!0}),ue(f,"resize",this.fe)}scrollElement(){if(!this._instance.config.scroll_root_selector)return f==null?void 0:f.document.documentElement;var e=J(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var t of e){var i=f==null?void 0:f.document.querySelector(t);if(i)return i}}scrollY(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return f&&(f.scrollY||f.pageYOffset||f.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return f&&(f.scrollX||f.pageXOffset||f.document.documentElement.scrollLeft)||0}}var ku=r=>qo(r==null?void 0:r.config.mask_personal_data_properties,r==null?void 0:r.config.custom_personal_data_properties);class da{constructor(e,t,i,n){this.ge=s=>{var o=this._e();if(!o||o.sessionId!==s){var a={sessionId:s,props:this.me(this._instance)};this.ye.register({[qr]:a})}},this._instance=e,this.be=t,this.ye=i,this.me=n||ku,this.be.onSessionId(this.ge)}_e(){return this.ye.props[qr]}getSetOnceProps(){var e,t=(e=this._e())==null?void 0:e.props;return t?"r"in t?Go(t):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return K(Mr(this.getSetOnceProps()),(t,i)=>{i==="$current_url"&&(i="url"),e["$session_entry_"+Or(i)]=t}),e}}var xn=de("[SessionId]");class ha{on(e,t){return this.we.on(e,t)}constructor(e,t,i){var n;if(this.xe=[],this.Se=void 0,this.we=new bn,this.Ee=(u,d)=>Math.abs(u-d)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.A=e.config,this.ye=e.persistence,this.$e=void 0,this.ke=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Pe=t||Xe,this.Te=i||Xe;var s=this.A.persistence_name||this.A.token,o=this.A.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*Ae(o,60,36e3,xn.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Ie(),this.Re="ph_"+s+"_window_id",this.Ce="ph_"+s+"_primary_window_exists",this.Oe()){var a=pe.K(this.Re),l=pe.K(this.Ce);a&&!l?this.$e=a:pe.X(this.Re),pe.Y(this.Ce,!0)}if((n=this.A.bootstrap)!=null&&n.sessionID)try{var c=(u=>{var d=u.replace(/-/g,"");if(d.length!==32)throw new Error("Not a valid UUID");if(d[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(d.substring(0,12),16)})(this.A.bootstrap.sessionID);this.Fe(this.A.bootstrap.sessionID,new Date().getTime(),c)}catch(u){xn.error("Invalid sessionID in bootstrap",u)}this.Me()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return x(this.xe)&&(this.xe=[]),this.xe.push(e),this.ke&&e(this.ke,this.$e),()=>{this.xe=this.xe.filter(t=>t!==e)}}Oe(){return this.A.persistence!=="memory"&&!this.ye.gi&&pe.G()}Ae(e){e!==this.$e&&(this.$e=e,this.Oe()&&pe.Y(this.Re,e))}je(){return this.$e?this.$e:this.Oe()?pe.K(this.Re):null}Fe(e,t,i){e===this.ke&&t===this._sessionActivityTimestamp&&i===this._sessionStartTimestamp||(this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this.ke=e,this.ye.register({[Li]:[t,e,i]}))}De(){if(this.ke&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this.ke,this._sessionStartTimestamp];var e=this.ye.props[Li];return J(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Fe(null,null,null)}destroy(){clearTimeout(this.Le),this.Le=void 0,this.Se&&f&&(f.removeEventListener("beforeunload",this.Se,{capture:!1}),this.Se=void 0),this.xe=[]}Me(){this.Se=()=>{this.Oe()&&pe.X(this.Ce)},ue(f,"beforeunload",this.Se,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(e===void 0&&(e=!1),t===void 0&&(t=null),this.A.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=t||new Date().getTime(),[n,s,o]=this.De(),a=this.je(),l=Te(o)&&o>0&&Math.abs(i-o)>864e5,c=!1,u=!s,d=!e&&this.Ee(i,n);u||d||l?(s=this.Pe(),a=this.Te(),xn.info("new session ID generated",{sessionId:s,windowId:a,changeReason:{noSessionId:u,activityTimeout:d,sessionPastMaximumLength:l}}),o=i,c=!0):a||(a=this.Te(),c=!0);var p=n===0||!e||l?i:n,h=o===0?new Date().getTime():o;return this.Ae(a),this.Fe(s,p,h),e||this.Ie(),c&&this.xe.forEach(m=>m(s,a,c?{noSessionId:u,activityTimeout:d,sessionPastMaximumLength:l}:void 0)),{sessionId:s,windowId:a,sessionStartTimestamp:h,changeReason:c?{noSessionId:u,activityTimeout:d,sessionPastMaximumLength:l}:void 0,lastActivityTimestamp:n}}Ie(){clearTimeout(this.Le),this.Le=setTimeout(()=>{var[e]=this.De();if(this.Ee(new Date().getTime(),e)){var t=this.ke;this.resetSessionId(),this.we.emit("forcedIdleReset",{idleSessionId:t})}},1.1*this.sessionTimeoutMs)}}var $u=["$set_once","$set"],Qe=de("[SiteApps]");class Iu{constructor(e){this._instance=e,this.Ne=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Ue(e,t){if(t){var i=this.globalsForEvent(t);this.Ne.push(i),this.Ne.length>1e3&&(this.Ne=this.Ne.slice(10))}}get siteAppLoaders(){var e;return(e=N._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}init(){if(this.isEnabled){var e=this._instance.Ri(this.Ue.bind(this));this.ze=()=>{e(),this.Ne=[],this.ze=void 0}}}globalsForEvent(e){var t,i,n,s,o,a,l;if(!e)throw new Error("Event payload is required");var c={},u=this._instance.get_property("$groups")||[],d=this._instance.get_property("$stored_group_properties")||{};for(var[p,h]of Object.entries(d))c[p]={id:u[p],type:p,properties:h};var{$set_once:m,$set:v}=e;return{event:$({},ws(e,$u),{properties:$({},e.properties,v?{$set:$({},(t=(i=e.properties)==null?void 0:i.$set)!==null&&t!==void 0?t:{},v)}:{},m?{$set_once:$({},(n=(s=e.properties)==null?void 0:s.$set_once)!==null&&n!==void 0?n:{},m)}:{}),elements_chain:(o=(a=e.properties)==null?void 0:a.$elements_chain)!==null&&o!==void 0?o:"",distinct_id:(l=e.properties)==null?void 0:l.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:c}}setupSiteApp(e){var t=this.apps[e.id],i=()=>{var a;!t.errored&&this.Ne.length&&(Qe.info("Processing "+this.Ne.length+" events for site app with id "+e.id),this.Ne.forEach(l=>t.processEvent==null?void 0:t.processEvent(l)),t.processedBuffer=!0),Object.values(this.apps).every(l=>l.processedBuffer||l.errored)&&((a=this.ze)==null||a.call(this))},n=!1,s=a=>{t.errored=!a,t.loaded=!0,Qe.info("Site app with id "+e.id+" "+(a?"loaded":"errored")),n&&i()};try{var{processEvent:o}=e.init({posthog:this._instance,callback:a=>{s(a)}});o&&(t.processEvent=o),n=!0}catch(a){Qe.error("Error while initializing PostHog app with config id "+e.id,a),s(!1)}if(n&&t.loaded)try{i()}catch(a){Qe.error("Error while processing buffered events PostHog app with config id "+e.id,a),t.errored=!0}}He(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var i of e)this.setupSiteApp(i)}Be(e){if(Object.keys(this.apps).length!==0){var t=this.globalsForEvent(e);for(var i of Object.values(this.apps))try{i.processEvent==null||i.processEvent(t)}catch(n){Qe.error("Error while processing event "+e.event+" for site app "+i.id,n)}}}onRemoteConfig(e){var t,i,n,s=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.He(),void this._instance.on("eventCaptured",c=>this.Be(c))):void Qe.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((i=this.ze)==null||i.call(this),(n=e.siteApps)!=null&&n.length)if(this.isEnabled){var o=function(c){var u;N["__$$ph_site_app_"+c]=s._instance,(u=N.__PosthogExtensions__)==null||u.loadSiteApp==null||u.loadSiteApp(s._instance,l,d=>{if(d)return Qe.error("Error while initializing PostHog app with config id "+c,d)})};for(var{id:a,url:l}of e.siteApps)o(a)}else Qe.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}var Pu=["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"],pa=function(r,e){if(!r)return!1;var t=r.toLowerCase();return Pu.concat(e||[]).some(i=>{var n=i.toLowerCase();return t.indexOf(n)!==-1})},ga=function(r,e){if(!r)return!1;var t=r.userAgent;if(t&&pa(t,e))return!0;try{var i=r==null?void 0:r.userAgentData;if(i!=null&&i.brands&&i.brands.some(n=>pa(n==null?void 0:n.brand,e)))return!0}catch{}return!!r.webdriver},hi=function(r){return r.US="us",r.EU="eu",r.CUSTOM="custom",r}({}),fa="i.posthog.com";class Ou{constructor(e){this.qe={},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 uiHost(){var e,t=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+fa,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.qe[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.qe[this.apiHost]=hi.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.qe[this.apiHost]=hi.EU:this.qe[this.apiHost]=hi.CUSTOM),this.qe[this.apiHost]}endpointFor(e,t){if(t===void 0&&(t=""),t&&(t=t[0]==="/"?t:"/"+t),e==="ui")return this.uiHost+t;if(this.region===hi.CUSTOM)return this.apiHost+t;var i=fa+t;switch(e){case"assets":return"https://"+this.region+"-assets."+i;case"api":return"https://"+this.region+"."+i}}}var Fu={icontains:(r,e)=>!!f&&e.href.toLowerCase().indexOf(r.toLowerCase())>-1,not_icontains:(r,e)=>!!f&&e.href.toLowerCase().indexOf(r.toLowerCase())===-1,regex:(r,e)=>!!f&&At(e.href,r),not_regex:(r,e)=>!!f&&!At(e.href,r),exact:(r,e)=>e.href===r,is_not:(r,e)=>e.href!==r};class fe{constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(i){i===void 0&&(i=!1),t.getWebExperiments(n=>{fe.We("retrieved web experiments from the server"),t.Ge=new Map,n.forEach(s=>{if(s.feature_flag_key){var o;t.Ge&&(fe.We("setting flag key ",s.feature_flag_key," to web experiment ",s),(o=t.Ge)==null||o.set(s.feature_flag_key,s));var a=t._instance.getFeatureFlag(s.feature_flag_key);ce(a)&&s.variants[a]&&t.Ve(s.name,a,s.variants[a].transforms)}else if(s.variants)for(var l in s.variants){var c=s.variants[l];fe.Je(c)&&t.Ve(s.name,l,c.transforms)}})},i)},this._instance=e,this._instance.onFeatureFlags(i=>{this.onFeatureFlags(i)})}onFeatureFlags(e){if(this._is_bot())fe.We("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(ee(this.Ge))return this.Ge=new Map,this.loadIfEnabled(),void this.previewWebExperiment();fe.We("applying feature flags",e),e.forEach(t=>{var i;if(this.Ge&&(i=this.Ge)!=null&&i.has(t)){var n,s=this._instance.getFeatureFlag(t),o=(n=this.Ge)==null?void 0:n.get(t);s&&o!=null&&o.variants[s]&&this.Ve(o.name,s,o.variants[s].transforms)}})}}previewWebExperiment(){var e=fe.getWindowLocation();if(e!=null&&e.search){var t=Wi(e==null?void 0:e.search,"__experiment_id"),i=Wi(e==null?void 0:e.search,"__experiment_variant");t&&i&&(fe.We("previewing web experiments "+t+" && "+i),this.getWebExperiments(n=>{this.Ke(parseInt(t),i,n)},!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,i){if(this._instance.config.disable_web_experiments&&!i)return e([]);var n=this._instance.get_property("$web_experiments");if(n&&!t)return e(n);this._instance.ui({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:s=>{if(s.statusCode!==200||!s.json)return e([]);var o=s.json.experiments||[];return e(o)}})}Ke(e,t,i){var n=i.filter(s=>s.id===e);n&&n.length>0&&(fe.We("Previewing web experiment ["+n[0].name+"] with variant ["+t+"]"),this.Ve(n[0].name,t,n[0].variants[t].transforms))}static Je(e){return!ee(e.conditions)&&fe.Ye(e)&&fe.Xe(e)}static Ye(e){var t;if(ee(e.conditions)||ee((t=e.conditions)==null?void 0:t.url))return!0;var i,n,s,o=fe.getWindowLocation();return!!o&&((i=e.conditions)==null||!i.url||Fu[(n=(s=e.conditions)==null?void 0:s.urlMatchType)!==null&&n!==void 0?n:"icontains"](e.conditions.url,o))}static getWindowLocation(){return f==null?void 0:f.location}static Xe(e){var t;if(ee(e.conditions)||ee((t=e.conditions)==null?void 0:t.utm))return!0;var i=No();if(i.utm_source){var n,s,o,a,l,c,u,d,p=(n=e.conditions)==null||(n=n.utm)==null||!n.utm_campaign||((s=e.conditions)==null||(s=s.utm)==null?void 0:s.utm_campaign)==i.utm_campaign,h=(o=e.conditions)==null||(o=o.utm)==null||!o.utm_source||((a=e.conditions)==null||(a=a.utm)==null?void 0:a.utm_source)==i.utm_source,m=(l=e.conditions)==null||(l=l.utm)==null||!l.utm_medium||((c=e.conditions)==null||(c=c.utm)==null?void 0:c.utm_medium)==i.utm_medium,v=(u=e.conditions)==null||(u=u.utm)==null||!u.utm_term||((d=e.conditions)==null||(d=d.utm)==null?void 0:d.utm_term)==i.utm_term;return p&&m&&v&&h}return!1}static We(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n{if(n.selector){var s;fe.We("applying transform of variant "+t+" for experiment "+e+" ",n);var o=(s=document)==null?void 0:s.querySelectorAll(n.selector);o==null||o.forEach(a=>{var l=a;n.html&&(l.innerHTML=n.html),n.css&&l.setAttribute("style",n.css)})}}):fe.We("Control variants leave the page unmodified.")}_is_bot(){return xe&&this._instance?ga(xe,this._instance.config.custom_blocked_useragents):void 0}}var Tu=de("[PostHog ExternalIntegrations]"),Au={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Cu{constructor(e){this._instance=e}nt(e,t){var i;(i=N.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,e,n=>{if(n)return Tu.error("failed to load script",n);t()})}startIfEnabledOrStop(){var e=this,t=function(o){var a,l,c;!n||(a=N.__PosthogExtensions__)!=null&&(a=a.integrations)!=null&&a[o]||e.nt(Au[o],()=>{var u;(u=N.__PosthogExtensions__)==null||(u=u.integrations)==null||(u=u[o])==null||u.start(e._instance)}),!n&&(l=N.__PosthogExtensions__)!=null&&(l=l.integrations)!=null&&l[o]&&((c=N.__PosthogExtensions__)==null||(c=c.integrations)==null||(c=c[o])==null||c.stop())};for(var[i,n]of Object.entries((s=this._instance.config.integrations)!==null&&s!==void 0?s:{})){var s;t(i)}}}var Sn="[SessionRecording]",pi=de(Sn);class va{get started(){var e;return!((e=this.Qe)==null||!e.isStarted)}get status(){return this.Qe?this.Qe.status:this.Ze&&!this.tr?"disabled":"lazy_loading"}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.Ze=!1,this.ir=void 0,this._instance=e,!this._instance.sessionManager)throw pi.error("started without valid sessionManager"),new Error(Sn+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(Sn+' cannot be used with cookieless_mode="always"')}get tr(){var e,t=!((e=this._instance.get_property(Lr))==null||!e.enabled),i=!this._instance.config.disable_session_recording,n=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return f&&t&&i&&!n}startIfEnabledOrStop(e){var t;if(!this.tr||(t=this.Qe)==null||!t.isStarted){var i=!x(Object.assign)&&!x(Array.from);this.tr&&i?(this.er(e),pi.info("starting")):this.stopRecording()}}er(e){var t,i,n;this.tr&&(N!=null&&(t=N.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(i=N.__PosthogExtensions__)!=null&&i.initSessionRecording?this.rr(e):(n=N.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,this.sr,s=>{if(s)return pi.error("could not load recorder",s);this.rr(e)}))}stopRecording(){var e,t;(e=this.ir)==null||e.call(this),this.ir=void 0,(t=this.Qe)==null||t.stop()}nr(){var e;(e=this._instance.persistence)==null||e.unregister(qs)}ar(e){if(this._instance.persistence){var t,i,n=this._instance.persistence,s=()=>{var o=e.sessionRecording===!1?void 0:e.sessionRecording,a=o==null?void 0:o.sampleRate,l=ee(a)?null:parseFloat(a);ee(l)&&this.nr();var c=o==null?void 0:o.minimumDurationMilliseconds;n.register({[Lr]:$({enabled:!!o},o,{networkPayloadCapture:$({capturePerformance:e.capturePerformance},o==null?void 0:o.networkPayloadCapture),canvasRecording:{enabled:o==null?void 0:o.recordCanvas,fps:o==null?void 0:o.canvasFps,quality:o==null?void 0:o.canvasQuality},sampleRate:l,minimumDurationMilliseconds:x(c)?null:c,endpoint:o==null?void 0:o.endpoint,triggerMatchType:o==null?void 0:o.triggerMatchType,masking:o==null?void 0:o.masking,urlTriggers:o==null?void 0:o.urlTriggers})})};s(),(t=this.ir)==null||t.call(this),this.ir=(i=this._instance.sessionManager)==null?void 0:i.onSessionId(s)}}onRemoteConfig(e){"sessionRecording"in e?e.sessionRecording!==!1?(this.ar(e),this.Ze=!0,this.startIfEnabledOrStop()):this.Ze=!0:pi.info("skipping remote config with no sessionRecording",e)}log(e,t){var i;t===void 0&&(t="log"),(i=this.Qe)!=null&&i.log?this.Qe.log(e,t):pi.warn("log called before recorder was ready")}get sr(){var e,t,i=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(Lr);return(i==null||(t=i.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}rr(e){var t,i;if((t=N.__PosthogExtensions__)==null||!t.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.Qe||(this.Qe=(i=N.__PosthogExtensions__)==null?void 0:i.initSessionRecording(this._instance),this.Qe._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),this.Qe.start(e)}onRRwebEmit(e){var t;(t=this.Qe)==null||t.onRRwebEmit==null||t.onRRwebEmit(e)}overrideLinkedFlag(){var e;(e=this.Qe)==null||e.overrideLinkedFlag()}overrideSampling(){var e;(e=this.Qe)==null||e.overrideSampling()}overrideTrigger(e){var t;(t=this.Qe)==null||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.Qe)==null?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var i;return!((i=this.Qe)==null||!i.tryAddCustomEvent(e,t))}}var gi={},kn=()=>{},Rt="posthog",_a=!lu&&(we==null?void 0:we.indexOf("MSIE"))===-1&&(we==null?void 0:we.indexOf("Mozilla"))===-1,ma=r=>{var e;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:nc(S==null?void 0:S.location),persistence:"localStorage+cookie",persistence_name:"",loaded:kn,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:r!=="2025-05-24"||"history_change",capture_pageleave:"if_capture_pageview",defaults:r??"unset",debug:be&&ce(be==null?void 0:be.search)&&be.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_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(f==null||(e=f.location)==null?void 0:e.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,session_recording:{},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:t=>{var i="Bad HTTP status: "+t.statusCode+" "+t.text;k.error(i)},get_device_id:t=>t,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:En},error_tracking:{},_onCapture:kn,__preview_eager_load_replay:!1}},ya=r=>{var e={};x(r.process_person)||(e.person_profiles=r.process_person),x(r.xhr_headers)||(e.request_headers=r.xhr_headers),x(r.cookie_name)||(e.persistence_name=r.cookie_name),x(r.disable_cookie)||(e.disable_persistence=r.disable_cookie),x(r.store_google)||(e.save_campaign_params=r.store_google),x(r.verbose)||(e.debug=r.verbose);var t=oe({},e,r);return J(r.property_blacklist)&&(x(r.property_denylist)?t.property_denylist=r.property_blacklist:J(r.property_denylist)?t.property_denylist=[...r.property_blacklist,...r.property_denylist]:k.error("Invalid value for property_denylist config: "+r.property_denylist)),t};class Ru{constructor(){this.__forceAllowLocalhost=!1}get lr(){return this.__forceAllowLocalhost}set lr(e){k.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class or{get decideEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){this.webPerformance=new Ru,this.ur=!1,this.version=Ne.LIB_VERSION,this.hr=new bn,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=ma(),this.SentryIntegration=Tc,this.sentryIntegration=e=>function(t,i){var n=go(t,i);return{name:po,processEvent:s=>n(s)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.dr=!1,this.vr=null,this.cr=null,this.pr=null,this.featureFlags=new hu(this),this.toolbar=new Cc(this),this.scrollManager=new Su(this),this.pageViewManager=new Zc(this),this.surveys=new mu(this),this.experiments=new fe(this),this.exceptions=new cu(this),this.rateLimiter=new yu(this),this.requestRouter=new Ou(this),this.consent=new kc(this),this.externalIntegrations=new Cu(this),this.people={set:(e,t,i)=>{var n=ce(e)?{[e]:t}:e;this.setPersonProperties(n),i==null||i({})},set_once:(e,t,i)=>{var n=ce(e)?{[e]:t}:e;this.setPersonProperties(void 0,n),i==null||i({})}},this.on("eventCaptured",e=>k.info('send "'+(e==null?void 0:e.event)+'"',e))}init(e,t,i){if(i&&i!==Rt){var n,s=(n=gi[i])!==null&&n!==void 0?n:new or;return s._init(e,t,i),gi[i]=s,gi[Rt][i]=s,s}return this._init(e,t,i)}_init(e,t,i){var n,s;if(t===void 0&&(t={}),x(e)||Fr(e))return k.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.gr(t.debug),this._r=t,this.mr=[],t.person_profiles&&(this.cr=t.person_profiles),this.set_config(oe({},ma(t.defaults),ya(t),{name:i,token:e})),this.config.on_xhr_error&&k.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:je.GZipJS;var o=this.yr();this.persistence=new mn(this.config,o),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new mn($({},this.config,{persistence:"sessionStorage"}),o);var a=$({},this.persistence.props),l=$({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.br=new wu(I=>this.wr(I),this.config.request_queue_config),this.Sr=new xu(this),this.__request_queue=[];var c=this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut();if(c||(this.sessionManager=new ha(this),this.sessionPropsManager=new da(this,this.sessionManager,this.persistence)),new Mc(this).startIfEnabledOrStop(),this.siteApps=new Iu(this),(n=this.siteApps)==null||n.init(),c||(this.sessionRecording=new va(this),this.sessionRecording.startIfEnabledOrStop()),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new _c(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new Qc(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new Jc(this),this.exceptionObserver=new Pc(this),this.exceptionObserver.startIfEnabled(),this.deadClicksAutocapture=new uo(this,Ic),this.deadClicksAutocapture.startIfEnabled(),this.historyAutocapture=new Oc(this),this.historyAutocapture.startIfEnabled(),Ne.DEBUG=Ne.DEBUG||this.config.debug,Ne.DEBUG&&k.info("Starting in debug mode",{this:this,config:t,thisC:$({},this.config),p:a,s:l}),((s=t.bootstrap)==null?void 0:s.distinctID)!==void 0){var u,d,p=this.config.get_device_id(Xe()),h=(u=t.bootstrap)!=null&&u.isIdentifiedID?p:t.bootstrap.distinctID;this.persistence.set_property(Le,(d=t.bootstrap)!=null&&d.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:t.bootstrap.distinctID,$device_id:h})}if(this.Er()){var m,v,y=Object.keys(((m=t.bootstrap)==null?void 0:m.featureFlags)||{}).filter(I=>{var b;return!((b=t.bootstrap)==null||(b=b.featureFlags)==null||!b[I])}).reduce((I,b)=>{var w;return I[b]=((w=t.bootstrap)==null||(w=w.featureFlags)==null?void 0:w[b])||!1,I},{}),E=Object.keys(((v=t.bootstrap)==null?void 0:v.featureFlagPayloads)||{}).filter(I=>y[I]).reduce((I,b)=>{var w,j;return(w=t.bootstrap)!=null&&(w=w.featureFlagPayloads)!=null&&w[b]&&(I[b]=(j=t.bootstrap)==null||(j=j.featureFlagPayloads)==null?void 0:j[b]),I},{});this.featureFlags.receivedFeatureFlags({featureFlags:y,featureFlagPayloads:E})}if(c)this.register_once({distinct_id:Jt,$device_id:null},"");else if(!this.get_distinct_id()){var F=this.config.get_device_id(Xe());this.register_once({distinct_id:F,$device_id:F},""),this.persistence.set_property(Le,"anonymous")}return ue(f,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),t.segment?Fc(this,()=>this.$r()):this.$r(),Be(this.config._onCapture)&&this.config._onCapture!==kn&&(k.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",I=>this.config._onCapture(I.event,I))),this.config.ip&&k.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}hi(e){var t,i,n,s,o,a,l,c;if(!S||!S.body)return k.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.hi(e)},500);this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=q(e.supportedCompression,je.GZipJS)?je.GZipJS:q(e.supportedCompression,je.Base64)?je.Base64:void 0),(t=e.analytics)!=null&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.cr?this.cr:"identified_only"}),(i=this.siteApps)==null||i.onRemoteConfig(e),(n=this.sessionRecording)==null||n.onRemoteConfig(e),(s=this.autocapture)==null||s.onRemoteConfig(e),(o=this.heatmaps)==null||o.onRemoteConfig(e),this.surveys.onRemoteConfig(e),(a=this.webVitalsAutocapture)==null||a.onRemoteConfig(e),(l=this.exceptionObserver)==null||l.onRemoteConfig(e),this.exceptions.onRemoteConfig(e),(c=this.deadClicksAutocapture)==null||c.onRemoteConfig(e)}$r(){try{this.config.loaded(this)}catch(e){k.critical("`loaded` function failed",e)}this.kr(),this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.config.cookieless_mode==="always")&&this.Pr()},1),new bu(this).load(),this.featureFlags.flags()}kr(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.br)==null||e.enable())}_dom_loaded(){this.is_capturing()&&We(this.__request_queue,e=>this.wr(e)),this.__request_queue=[],this.kr()}_handle_unload(){var e,t;this.config.request_batching?(this.Tr()&&this.capture("$pageleave"),(e=this.br)==null||e.unload(),(t=this.Sr)==null||t.unload()):this.Tr()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}ui(e){this.__loaded&&(_a?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=ir(e.url,{ip:this.config.ip?1:0}),e.headers=$({},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,(t=>{var i,n,s,o=$({},t);o.timeout=o.timeout||6e4,o.url=ir(o.url,{_:new Date().getTime().toString(),ver:Ne.LIB_VERSION,compression:o.compression});var a=(i=o.transport)!==null&&i!==void 0?i:"fetch",l=rr.filter(u=>!o.disableTransport||!u.transport||!o.disableTransport.includes(u.transport)),c=(n=(s=Cs(l,u=>u.transport===a))==null?void 0:s.method)!==null&&n!==void 0?n:l[0].method;if(!c)throw new Error("No available transport method");c(o)})($({},e,{callback:t=>{var i,n;this.rateLimiter.checkForLimiting(t),t.statusCode>=400&&((i=(n=this.config).on_request_error)==null||i.call(n,t)),e.callback==null||e.callback(t)}}))))}wr(e){this.Sr?this.Sr.retriableRequest(e):this.ui(e)}_execute_array(e){var t,i=[],n=[],s=[];We(e,a=>{a&&(t=a[0],J(t)?s.push(a):Be(a)?a.call(this):J(a)&&t==="alias"?i.push(a):J(a)&&t.indexOf("capture")!==-1&&Be(this[t])?s.push(a):n.push(a))});var o=function(a,l){We(a,function(c){if(J(c[0])){var u=l;K(c,function(d){u=u[d[0]].apply(u,d.slice(1))})}else this[c[0]].apply(this,c.slice(1))},l)};o(i,this),o(n,this),o(s,this)}Er(){var e,t;return((e=this.config.bootstrap)==null?void 0:e.featureFlags)&&Object.keys((t=this.config.bootstrap)==null?void 0:t.featureFlags).length>0||!1}push(e){this._execute_array([e])}capture(e,t,i){var n;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.br){if(this.is_capturing())if(!x(e)&&ce(e)){if(this.config.opt_out_useragent_filter||!this._is_bot()){var s=i!=null&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(s==null||!s.isRateLimited){t!=null&&t.$current_url&&!ce(t==null?void 0:t.$current_url)&&(k.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 o=new Date,a=(i==null?void 0:i.timestamp)||o,l=Xe(),c={uuid:l,event:e,properties:this.calculateEventProperties(e,t||{},a,l)};s&&(c.properties.$lib_rate_limit_remaining_tokens=s.remainingTokens),i!=null&&i.$set&&(c.$set=i==null?void 0:i.$set);var u,d=this.Ir(i==null?void 0:i.$set_once);if(d&&(c.$set_once=d),(c=ic(c,i!=null&&i._noTruncate?null:this.config.properties_string_max_length)).timestamp=a,x(i==null?void 0:i.timestamp)||(c.properties.$event_time_override_provided=!0,c.properties.$event_time_override_system_time=o),e===sr.DISMISSED||e===sr.SENT){var p=t==null?void 0:t[aa.SURVEY_ID],h=t==null?void 0:t[aa.SURVEY_ITERATION];u={id:p,current_iteration:h},localStorage.getItem(ca(u))||localStorage.setItem(ca(u),"true"),c.$set=$({},c.$set,{[gu({id:p,current_iteration:h},e===sr.SENT?"responded":"dismissed")]:!0})}var m=$({},c.properties.$set,c.$set);if(xt(m)||this.setPersonPropertiesForFlags(m),!ee(this.config.before_send)){var v=this.Rr(c);if(!v)return;c=v}this.hr.emit("eventCaptured",c);var y={method:"POST",url:(n=i==null?void 0:i._url)!==null&&n!==void 0?n:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:c,compression:"best-available",batchKey:i==null?void 0:i._batchKey};return!this.config.request_batching||i&&(i==null||!i._batchKey)||i!=null&&i.send_instantly?this.wr(y):this.br.enqueue(y),c}k.critical("This capture call is ignored due to client rate limiting.")}}else k.error("No event name provided to posthog.capture")}else k.uninitializedWarning("posthog.capture")}Ri(e){return this.on("eventCaptured",t=>e(t.event,t))}calculateEventProperties(e,t,i,n,s){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return t;var o=s?void 0:this.persistence.remove_event_timer(e),a=$({},t);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,(this.config.cookieless_mode=="always"||this.config.cookieless_mode=="on_reject"&&this.consent.isExplicitlyOptedOut())&&(a.$cookieless_mode=!0),e==="$snapshot"){var l=$({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=l.distinct_id,(!ce(a.distinct_id)&&!Te(a.distinct_id)||Fr(a.distinct_id))&&k.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var c,u=Xc(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:d,windowId:p}=this.sessionManager.checkAndGetSessionAndWindowId(s,i.getTime());a.$session_id=d,a.$window_id=p}this.sessionPropsManager&&oe(a,this.sessionPropsManager.getSessionProps());try{var h;this.sessionRecording&&oe(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(h=this.Sr)==null?void 0:h.length}catch(E){a.$sdk_debug_error_capturing_properties=String(E)}if(this.requestRouter.region===hi.CUSTOM&&(a.$lib_custom_api_host=this.config.api_host),c=e!=="$pageview"||s?e!=="$pageleave"||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,n),a=oe(a,c),e==="$pageview"&&S&&(a.title=S.title),!x(o)){var m=i.getTime()-o;a.$duration=parseFloat((m/1e3).toFixed(3))}we&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=oe({},u,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),J(this.config.property_denylist)?K(this.config.property_denylist,function(E){delete a[E]}):k.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var v=this.config.sanitize_properties;v&&(k.error("sanitize_properties is deprecated. Use before_send instead"),a=v(a,e));var y=this.Cr();return a.$process_person_profile=y,y&&!s&&this.Or("_calculate_event_properties"),a}Ir(e){var t;if(!this.persistence||!this.Cr()||this.ur)return e;var i=this.persistence.get_initial_props(),n=(t=this.sessionPropsManager)==null?void 0:t.getSetOnceProps(),s=oe({},i,n||{},e||{}),o=this.config.sanitize_properties;return o&&(k.error("sanitize_properties is deprecated. Use before_send instead"),s=o(s,"$set_once")),this.ur=!0,xt(s)?void 0:s}register(e,t){var i;(i=this.persistence)==null||i.register(e,t)}register_once(e,t,i){var n;(n=this.persistence)==null||n.register_once(e,t,i)}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)}Fr(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,i){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t,i){return t===void 0&&(t=!1),this.featureFlags.getEarlyAccessFeatures(e,t,i)}on(e,t){return this.hr.on(e,t)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSurveysLoaded(e){return this.surveys.onSurveysLoaded(e)}onSessionId(e){var t,i;return(t=(i=this.sessionManager)==null?void 0:i.onSessionId(e))!==null&&t!==void 0?t:()=>{}}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=vu),this.surveys.displaySurvey(e,t)}canRenderSurvey(e){return this.surveys.canRenderSurvey(e)}canRenderSurveyAsync(e,t){return t===void 0&&(t=!1),this.surveys.canRenderSurveyAsync(e,t)}identify(e,t,i){if(!this.__loaded||!this.persistence)return k.uninitializedWarning("posthog.identify");if(Te(e)&&(e=e.toString(),k.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),e)if(["distinct_id","distinctid"].includes(e.toLowerCase()))k.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!==Jt){if(this.Or("posthog.identify")){var n=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var s=n;this.register_once({$had_persisted_distinct_id:!0,$device_id:s},"")}e!==n&&e!==this.get_property(zt)&&(this.unregister(zt),this.register({distinct_id:e}));var o=(this.persistence.get_property(Le)||"anonymous")==="anonymous";e!==n&&o?(this.persistence.set_property(Le,"identified"),this.setPersonPropertiesForFlags($({},i||{},t||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:n},{$set:t||{},$set_once:i||{}}),this.pr=ta(e,t,i),this.featureFlags.setAnonymousDistinctId(n)):(t||i)&&this.setPersonProperties(t,i),e!==n&&(this.reloadFeatureFlags(),this.unregister(Ui))}}else k.critical('The string "'+Jt+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else k.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,t){if((e||t)&&this.Or("posthog.setPersonProperties")){var i=ta(this.get_distinct_id(),e,t);this.pr!==i?(this.setPersonPropertiesForFlags($({},t||{},e||{})),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.pr=i):k.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,i){if(e&&t){if(this.Or("posthog.group")){var n=this.getGroups();n[e]!==t&&this.resetGroupPropertiesForFlags(e),this.register({$groups:$({},n,{[e]:t})}),i&&(this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:i}),this.setGroupPropertiesForFlags({[e]:i})),n[e]===t||i||this.reloadFeatureFlags()}}else k.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(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.Or("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,t)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var t,i,n,s;if(k.info("reset"),!this.__loaded)return k.uninitializedWarning("posthog.reset");var o=this.get_property("$device_id");if(this.consent.reset(),(t=this.persistence)==null||t.clear(),(i=this.sessionPersistence)==null||i.clear(),this.surveys.reset(),this.featureFlags.reset(),(n=this.persistence)==null||n.set_property(Le,"anonymous"),(s=this.sessionManager)==null||s.resetSessionId(),this.pr=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:Jt,$device_id:null},"");else{var a=this.config.get_device_id(Xe());this.register_once({distinct_id:a,$device_id:e?a:o},"")}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(){var e,t;return(e=(t=this.sessionManager)==null?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),n=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(e!=null&&e.withTimestamp&&i){var s,o=(s=e.timestampLookBack)!==null&&s!==void 0?s:10;if(!i)return n;n+="?t="+Math.max(Math.floor((new Date().getTime()-i)/1e3)-o,0)}return n}alias(e,t){return e===this.get_property(Rs)?(k.critical("Attempting to create alias for existing People user - aborting."),-2):this.Or("posthog.alias")?(x(t)&&(t=this.get_distinct_id()),e!==t?(this.Fr(zt,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(k.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=$({},this.config);if(ge(e)){var i,n,s,o,a;oe(this.config,ya(e));var l=this.yr();(i=this.persistence)==null||i.update_config(this.config,t,l),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new mn($({},this.config,{persistence:"sessionStorage"}),l);var c=this.gr(this.config.debug);ze(c)&&(this.config.debug=c),ze(this.config.debug)&&(this.config.debug?(Ne.DEBUG=!0,ie.G()&&ie.Y("ph_debug","true"),k.info("set_config",{config:e,oldConfig:t,newConfig:$({},this.config)})):(Ne.DEBUG=!1,ie.G()&&ie.X("ph_debug"))),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),(s=this.autocapture)==null||s.startIfEnabled(),(o=this.heatmaps)==null||o.startIfEnabled(),this.surveys.loadIfEnabled(),this.Mr(),(a=this.externalIntegrations)==null||a.startIfEnabledOrStop()}}startSessionRecording(e){var t=e===!0,i={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(i).some(Boolean)){var n,s,o,a,l;(n=this.sessionManager)==null||n.checkAndGetSessionAndWindowId(),i.sampling&&((s=this.sessionRecording)==null||s.overrideSampling()),i.linked_flag&&((o=this.sessionRecording)==null||o.overrideLinkedFlag()),i.url_trigger&&((a=this.sessionRecording)==null||a.overrideTrigger("url")),i.event_trigger&&((l=this.sessionRecording)==null||l.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 i=new Error("PostHog syntheticException"),n=this.exceptions.buildProperties(e,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent($({},n,t))}loadToolbar(e){return this.toolbar.loadToolbar(e)}get_property(e){var t;return(t=this.persistence)==null?void 0:t.props[e]}getSessionProperty(e){var t;return(t=this.sessionPersistence)==null?void 0:t.props[e]}toString(){var e,t=(e=this.config.name)!==null&&e!==void 0?e:Rt;return t!==Rt&&(t=Rt+"."+t),t}_isIdentified(){var e,t;return((e=this.persistence)==null?void 0:e.get_property(Le))==="identified"||((t=this.sessionPersistence)==null?void 0:t.get_property(Le))==="identified"}Cr(){var e,t;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&xt(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[zt])&&((t=this.persistence)==null||(t=t.props)==null||!t[Gi]))}Tr(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.Cr()||this.Or("posthog.createPersonProfile")&&this.setPersonProperties({},{})}Or(e){return this.config.person_profiles==="never"?(k.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Fr(Gi,!0),!0)}yr(){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}Mr(){var e,t,i,n,s=this.yr();return((e=this.persistence)==null?void 0:e.gi)!==s&&((i=this.persistence)==null||i.set_disabled(s)),((t=this.sessionPersistence)==null?void 0:t.gi)!==s&&((n=this.sessionPersistence)==null||n.set_disabled(s)),s}opt_in_capturing(e){if(this.config.cookieless_mode!=="always"){var t,i;this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut()&&(this.reset(!0),(t=this.sessionManager)==null||t.destroy(),this.sessionManager=new ha(this),this.persistence&&(this.sessionPropsManager=new da(this,this.sessionManager,this.persistence)),this.sessionRecording=new va(this),this.sessionRecording.startIfEnabledOrStop()),this.consent.optInOut(!0),this.Mr(),this.kr(),this.config.cookieless_mode=="on_reject"&&this.surveys.loadIfEnabled(),(x(e==null?void 0:e.captureEventName)||e!=null&&e.captureEventName)&&this.capture((i=e==null?void 0:e.captureEventName)!==null&&i!==void 0?i:"$opt_in",e==null?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Pr()}else k.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"?(this.config.cookieless_mode==="on_reject"&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.Mr(),this.config.cookieless_mode==="on_reject"&&(this.register({distinct_id:Jt,$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.Pr())):k.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}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===Ue.GRANTED?"granted":e===Ue.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.Mr()}_is_bot(){return xe?ga(xe,this.config.custom_blocked_useragents):void 0}Pr(){S&&(S.visibilityState==="visible"?this.dr||(this.dr=!0,this.capture("$pageview",{title:S.title},{send_instantly:!0}),this.vr&&(S.removeEventListener("visibilitychange",this.vr),this.vr=null)):this.vr||(this.vr=this.Pr.bind(this),ue(S,"visibilitychange",this.vr)))}debug(e){e===!1?(f==null||f.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(f==null||f.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}))}L(){var e,t,i,n,s,o,a,l=this._r||{};return"advanced_disable_flags"in l?!!l.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(k.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(i="advanced_disable_decide",n=!1,s=k,o=(t="advanced_disable_flags")in(e=l)&&!x(e[t]),a=i in e&&!x(e[i]),o?e[t]:a?(s&&s.warn("Config field '"+i+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[i]):n)}Rr(e){if(ee(this.config.before_send))return e;var t=J(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e;for(var n of t){if(i=n(i),ee(i)){var s="Event '"+e.event+"' was rejected in beforeSend function";return Ol(e.event)?k.warn(s+". This can cause unexpected behavior."):k.info(s),null}i.properties&&!xt(i.properties)||k.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return i}getPageViewId(){var e;return(e=this.pageViewManager.Wt)==null?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}gr(e){var t=ze(e)&&!e,i=ie.G()&&ie.J("ph_debug")==="true";return!t&&(!!i||e)}}(function(r,e){for(var t=0;t{Mu(),window.posthog.init(r.token,e)},reset:()=>{window.posthog.reset()},track:({payload:t})=>{t.properties?window.posthog.capture(t.event,t.properties):window.posthog.capture(t.event)},identify:({payload:t})=>{t.userId&&(window.posthog.identify(t.userId,t.traits),window.posthog.alias(t.anonymousId,t.userId))},page:()=>{},methods:{abtest:t=>window.posthog.getFeatureFlag(t),abtestOverride:t=>window.posthog.featureFlags.overrideFeatureFlags(t),group:(t,i,n)=>{if((window.posthog.getGroups()??{})[t]!=i)return n=n||{},n.name=i,window.posthog.group(t,i,n)},posthogClient:()=>window.posthog}}}const Du=Object.freeze(Object.defineProperty({__proto__:null,default:Nu},Symbol.toStringTag,{value:"Module"}));return yl});