@heycatch/sdk 0.8.5-dev.2562 → 0.8.5-dev.2662
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2 -2
- package/dist/index.js +2 -2
- package/dist/react-native.cjs +1 -1
- package/dist/server.cjs +2 -2
- package/dist/server.js +2 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";var ni=Object.defineProperty;var bd=Object.getOwnPropertyDescriptor;var xd=Object.getOwnPropertyNames;var wd=Object.prototype.hasOwnProperty;var Wo=(t,e)=>{for(var r in e)ni(t,r,{get:e[r],enumerable:!0})},kd=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of xd(e))!wd.call(t,i)&&i!==r&&ni(t,i,{get:()=>e[i],enumerable:!(n=bd(e,i))||n.enumerable});return t};var Ed=t=>kd(ni({},"__esModule",{value:!0}),t);var Rg={};Wo(Rg,{KNOWN_FRAMEWORKS:()=>nu,KNOWN_INSTALL_AGENTS:()=>iu,SDK_VERSION:()=>xt,STAGE:()=>bt,TRACING_HEADERS:()=>lr,UNKNOWN_INSTALL_VALUE:()=>ht,analytics:()=>zg});module.exports=Ed(Rg);var si="[a-z0-9]",Ig=new RegExp(`^${si}$`),oi="heycatch";var $d=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;function ii(t){let e=$d.exec(t);if(e===null)return!1;let[,r="",n=""]=e,i=Number(r),s=Number(n);return i>255||s>255?!1:i===0||i===10||i===127||i===100&&s>=64&&s<=127||i===169&&s===254||i===172&&s>=16&&s<=31||i===192&&s===168}var Sd=/^::ffff:([0-9a-f]{1,4}):([0-9a-f]{1,4})$/;function Pd(t){if(t==="::1"||t==="::")return!0;if(t.startsWith("::ffff:")){let e=Sd.exec(t);if(e===null)return ii(t.slice(7));let[,r="",n=""]=e,i=Number.parseInt(r,16),s=Number.parseInt(n,16);return ii(`${Math.floor(i/256)}.${i%256}.${Math.floor(s/256)}.${s%256}`)}return/^f[cd][0-9a-f]{2}:/.test(t)||/^fe[89ab][0-9a-f]:/.test(t)}function Jo(t){return t.toLowerCase().replace(/^\[/,"").replace(/\]$/,"").replace(/\.+$/,"")}function ai(t){let e=Jo(t);return e==="localhost"||e.endsWith(".localhost")||ii(e)||Pd(e)}function Td(t){let e=Jo(t);return e==="heycatch.ai"||e.endsWith(".heycatch.ai")}function ui(t){return ai(t)||Td(t)}var Ke={};Wo(Ke,{BIGINT_FORMAT_RANGES:()=>Kd,CONSTANT_CATCH:()=>_a,Class:()=>di,NUMBER_FORMAT_RANGES:()=>qd,aborted:()=>qe,allowsEval:()=>na,assert:()=>Od,assertEqual:()=>zd,assertIs:()=>Id,assertNever:()=>Ad,assertNotEqual:()=>Rd,assignProp:()=>ir,attachSchema:()=>ar,base64ToUint8Array:()=>fa,base64urlToUint8Array:()=>th,cached:()=>Vr,captureStackTrace:()=>qr,cleanEnum:()=>eh,cleanRegex:()=>pi,clone:()=>ze,cloneDef:()=>Dd,codePointLength:()=>Yd,constantCatch:()=>va,createTransparentProxy:()=>Vd,defineLazy:()=>Xo,defineLazyInternal:()=>Ce,derived:()=>sh,esc:()=>ta,escapeRegex:()=>or,explicitlyAborted:()=>vi,extend:()=>ua,finalizeIssue:()=>dt,floatSafeRemainder:()=>Ld,getElementAtPath:()=>jd,getEnumValues:()=>Gr,getLengthableOrigin:()=>Xd,getParsedType:()=>Gd,getSizableOrigin:()=>Wd,hexToUint8Array:()=>nh,hide:()=>yi,installLazyProp:()=>bi,isObject:()=>nr,isPlainObject:()=>sr,issue:()=>Xr,joinValues:()=>Md,jsonStringifyReplacer:()=>hi,members:()=>mi,merge:()=>da,mergeDefs:()=>Ue,normalizeParams:()=>Re,nullish:()=>Fd,numKeys:()=>Bd,objectClone:()=>Zd,omit:()=>aa,optionalKeys:()=>_i,own:()=>je,parsedType:()=>Qd,partial:()=>ha,pick:()=>oa,prefixIssues:()=>Jr,primitiveTypes:()=>ia,promiseAllObject:()=>Ud,propertyKeyTypes:()=>gi,randomString:()=>Hd,rawShape:()=>fi,required:()=>pa,safeExtend:()=>la,shallowClone:()=>Kr,sizeCaps:()=>Yr,slugify:()=>ra,stringifyPrimitive:()=>sa,toZod:()=>Cd,uint8ArrayToBase64:()=>ga,uint8ArrayToBase64url:()=>rh,uint8ArrayToHex:()=>ih,unwrapMessage:()=>Ft});function zd(t){return t}function Rd(t){return t}function Cd(){return t=>t}function Id(t){}function Ad(t){throw new Error("Unexpected value in exhaustive check")}function Od(t){}function Gr(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,i])=>e.indexOf(+n)===-1).map(([n,i])=>i)}function Md(t,e="|"){return t.map(r=>sa(r)).join(e)}function hi(t,e){return typeof e=="bigint"?e.toString():e}var li=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function Vr(t){return new li(t)}function Fd(t){return t==null}function pi(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function Ld(t,e){let r=t/e,n=Math.round(r),i=4*Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)<i?0:r-n}var Yo=Symbol("evaluating");function Xo(t,e,r){let n;Object.defineProperty(t,e,{get(){if(n!==Yo)return n===void 0&&(n=Yo,n=r()),n},set(i){Object.defineProperty(t,e,{value:i})},configurable:!0})}function Zd(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function ir(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function fi(t){let e=Object.getOwnPropertyDescriptor(t,"shape");return e?.get?e.get.raw:e?.value}function Ve(t){return fi(t._zod.def)??t._zod.def.shape}function Qo(t,e,r){Object.defineProperty(t,e,{get(){let n=r();return ir(this,e,n),n},enumerable:!0,configurable:!0})}function ea(t,e,r){e in t?ir(t,e,r):t[e]=r}function _t(t,e,r,n){let i=Ve(e);for(let s of r){let o=Object.getOwnPropertyDescriptor(i,s);o.enumerable&&(o.get?Qo(t,s,()=>{let a=e._zod.def.shape[s];return n?n(a,s):a}):ea(t,s,n?n(o.value,s):o.value))}}function Nd(t,e){for(let r of Reflect.ownKeys(e)){let n=Object.getOwnPropertyDescriptor(e,r);n.enumerable&&(n.get?Qo(t,r,()=>e[r]):ea(t,r,n.value))}}function Ue(...t){let e={};for(let r of t){let n=Object.getOwnPropertyDescriptors(r);Object.assign(e,n)}return Object.defineProperties({},e)}function Dd(t){return Ue(t._zod.def)}function jd(t,e){return e?e.reduce((r,n)=>r?.[n],t):t}function Ud(t){let e=Object.keys(t),r=e.map(n=>t[n]);return Promise.all(r).then(n=>{let i={};for(let s=0;s<e.length;s++)i[e[s]]=n[s];return i})}function Hd(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<t;n++)r+=e[Math.floor(Math.random()*e.length)];return r}function ta(t){return JSON.stringify(t)}function ra(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var qr="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function nr(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var na=Vr(()=>{if(vt.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function sr(t){if(nr(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let r=e.prototype;return!(nr(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Kr(t){return sr(t)?{...t}:Array.isArray(t)?[...t]:t instanceof Map?new Map(t):t instanceof Set?new Set(t):t}function Bd(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}var Gd=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},gi=new Set(["string","number","symbol"]),ia=new Set(["string","number","bigint","boolean","symbol","undefined"]);function or(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ze(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function Re(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function Vd(t){let e;return new Proxy({},{get(r,n,i){return e??(e=t()),Reflect.get(e,n,i)},set(r,n,i,s){return e??(e=t()),Reflect.set(e,n,i,s)},has(r,n){return e??(e=t()),Reflect.has(e,n)},deleteProperty(r,n){return e??(e=t()),Reflect.deleteProperty(e,n)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,n){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,n)},defineProperty(r,n,i){return e??(e=t()),Reflect.defineProperty(e,n,i)}})}function sa(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function _i(t){return Object.keys(t).filter(e=>t[e]._zod.optin!==void 0&&t[e]._zod.optout==="optional")}var qd={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Kd={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function oa(t,e){let r=t._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let s={};return _t(s,t,Wr(t,e)),ze(t,Ue(r,{shape:s,checks:[]}))}function Wr(t,e){let r=Ve(t),n=[];for(let i of Reflect.ownKeys(e)){if(!Object.getOwnPropertyDescriptor(r,i)?.enumerable)throw new Error(`Unrecognized key: "${String(i)}"`);e[i]&&n.push(i)}return n}function aa(t,e){let r=t._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let s=new Set(Wr(t,e)),o={};return _t(o,t,Reflect.ownKeys(Ve(t)).filter(a=>!s.has(a))),ze(t,Ue(r,{shape:o,checks:[]}))}function ua(t,e){if(!sr(e))throw new Error("Invalid input to extend: expected a plain object");let r=t._zod.def.checks;if(r&&r.length>0){let i=Ve(t);for(let s of Reflect.ownKeys(e))if(Object.getOwnPropertyDescriptor(i,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return ze(t,Ue(t._zod.def,{shape:ca(t,e)}))}function ca(t,e){let r={};return _t(r,t,Reflect.ownKeys(Ve(t))),Nd(r,e),r}function la(t,e){if(!sr(e))throw new Error("Invalid input to safeExtend: expected a plain object");return ze(t,Ue(t._zod.def,{shape:ca(t,e)}))}function da(t,e){if(!e?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(t._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};_t(r,t,Reflect.ownKeys(Ve(t))),_t(r,e,Reflect.ownKeys(Ve(e)));let n=Ue(t._zod.def,{shape:r,get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]});return ze(t,n)}function ha(t,e,r,n="partial"){let s=e._zod.def.checks;if(s&&s.length>0)throw new Error(`.${n}() cannot be used on object schemas containing refinements`);let a=r?new Set(Wr(e,r)):void 0,u={};return _t(u,e,Reflect.ownKeys(Ve(e)),t&&((c,l)=>a&&!a.has(l)?c:new t({type:"optional",innerType:c}))),ze(e,Ue(e._zod.def,{shape:u,checks:[]}))}function pa(t,e,r){let n=r?new Set(Wr(e,r)):void 0,i={};return _t(i,e,Reflect.ownKeys(Ve(e)),(s,o)=>n&&!n.has(o)?s:new t({type:"nonoptional",innerType:s})),ze(e,Ue(e._zod.def,{shape:i}))}function qe(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function vi(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue===!1)return!0;return!1}function Jr(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function Ft(t){return typeof t=="string"?t:t?.message}function Yr(t){let e=[];for(let r of t??[]){let n=r._zod.def;if(!/_(length|size)$|_equals$/.test(n.check))break;let i=n.maximum??n.length??n.size;i>=0&&e.push([i,r])}return e}function ar(t,e,r){var n;for(let i=e;i<t.length;i++)(n=t[i]).schema??(n.schema=r)}function dt(t,e,r){var n;let i=t.inst?._zod?.traits;i?.has("$ZodType")&&(i.has("$ZodCheck")?(n=t).schema??(n.schema=t.inst):t.schema=t.inst);let s=t.schema!==t.inst?t.schema?._zod.def?.error:void 0,o=t.message?t.message:Ft(t.inst?._zod.def?.error?.(t))??Ft(s?.(t))??Ft(e?.error?.(t))??Ft(r.customError?.(t))??Ft(r.localeError?.(t))??"Invalid input",a={};for(let u of Object.keys(t))u==="inst"||u==="schema"||u==="continue"||u==="input"||u==="__proto__"||(a[u]=t[u]);return a.path??(a.path=[]),a.message=o,e?.reportInput&&(a.input=t.input),a}function Wd(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}var Jd=/[\uD800-\uDBFF]/;function Yd(t){let e=t.length;if(!Jd.test(t))return e;let r=e;for(let n=0;n<e-1;n++)(t.charCodeAt(n)&64512)===55296&&(t.charCodeAt(n+1)&64512)===56320&&(r--,n++);return r}function Xd(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function Qd(t){let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"nan":"number";case"object":{if(t===null)return"null";if(Array.isArray(t))return"array";let r=t;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return e}function Xr(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function eh(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function fa(t){let e=atob(t),r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r}function ga(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}function th(t){let e=t.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-e.length%4)%4);return fa(e+r)}function rh(t){return ga(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function nh(t){let e=t.replace(/^0x/,"");if(e.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)r[n/2]=Number.parseInt(e.slice(n,n+2),16);return r}function ih(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}var di=class{constructor(...e){}};function mi(t,e){for(let r in e){let n=Object.getOwnPropertyDescriptor(e,r);n.get?Object.defineProperty(t,r,{...n,enumerable:!1}):oh(t,r,n.value)}}function je(t,e,r,n=!0){return Object.defineProperty(t,e,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function yi(t,e,r){return je(t,e,r,!1)}function sh(t,e){for(let r in t){let n=t[r];Object.defineProperty(e,r,{configurable:!0,enumerable:!0,get(){return je(this,r,n(this))},set(i){je(this,r,i)}})}return e}function oh(t,e,r){Object.defineProperty(t,e,{configurable:!0,get(){return this==null?r:je(this,e,r.bind(this))},set(n){je(this,e,n)}})}function ah(t,e){let r=Object.getPrototypeOf(t);return e in r?void 0:r}var ci,lt=!1,uh={configurable:!0,get(){lt=!0}};function Ce(t,e,r){let n=Object.getPrototypeOf(t._zod);if(e in n&&ci!==t._zod){ci=void 0;return}ci=t._zod,Object.defineProperty(n,e,{configurable:!0,get(){Object.defineProperty(this,e,uh);let i=lt;lt=!1;try{let s=r(this);return lt?delete this[e]:Object.defineProperty(this,e,{configurable:!0,writable:!0,value:s}),lt=lt||i,s}catch(s){throw delete this[e],lt=lt||i,s}},set(i){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:i})}})}function bi(t,e,r,n){let i=ah(t,e);i&&Object.defineProperty(i,e,{configurable:!0,get(){let s={configurable:!0,writable:!0,enumerable:n,value:void 0};return Object.defineProperty(this,e,s),s.value=r(this),Object.defineProperty(this,e,s),s.value},set(s){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:n,value:s})}})}var _a="~constantCatch";function va(t){let e=()=>t;return e[_a]=!0,e}var ma;var xi={value:void 0,enumerable:!1},ya="captureStackTrace"in Error?Error:null;function ch(t){let e=ya;if(e){let r=e.stackTraceLimit;if(typeof r=="number"){try{e.stackTraceLimit=0}catch{return ya=null,new t}try{return new t}finally{e.stackTraceLimit=r}}}return new t}function D(t,e,r,n){let i={};function s(h){this.def=h,this.constr=d,this.traits=new Set}s.prototype=i;let o=r,a=o&&new WeakSet;function u(h,f){if(h._zod){if(h._zod.traits.has(t))return}else{xi.value=new s(f);try{Object.defineProperty(h,"_zod",xi)}finally{xi.value=void 0}}if(h._zod.traits.add(t),e(h,f),a){let g=Object.getPrototypeOf(h),m=h._zod.constr.prototype,v=g;for(;v&&v!==m;)v=Object.getPrototypeOf(v);let w=v??g;a.has(w)||(a.add(w),mi(w,o))}let p=d.prototype;for(let g in p)Object.prototype.hasOwnProperty.call(p,g)&&(g in h||(h[g]=p[g].bind(h)))}let c=n?.Parent??Object;class l extends c{}Object.defineProperty(l,"name",{value:t});function d(h){let f=n?.Parent?ch(l):this;u(f,h);let p=f._zod.deferred;if(p){for(let m of p)m();f._zod.deferred=void 0}let g=globalThis.__zod_globalConfig?.postProcessor;return g&&g(f),f}return Object.defineProperty(d,"init",{value:u}),Object.defineProperty(d,Symbol.hasInstance,{value:h=>n?.Parent&&h instanceof n.Parent?!0:h?._zod?.traits?.has(t)}),Object.defineProperty(d,"name",{value:t}),d}var We=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};(ma=globalThis).__zod_globalConfig??(ma.__zod_globalConfig={});var vt=globalThis.__zod_globalConfig;function mt(t){return t&&Object.assign(vt,t),vt}function lh(){let t=this._zod;return t.message??(t.message=JSON.stringify(t.def,hi,2)),t.message}function dh(t){this._zod.message=t}var hh={get:lh,set:dh,enumerable:!0,configurable:!0},ki={value:void 0,enumerable:!1},ba=new WeakSet([Object.prototype,Error.prototype]),xa=(t,e)=>{t.name="$ZodError",ki.value=e,Object.defineProperty(t,"issues",ki),ki.value=void 0,Object.defineProperty(t,"message",hh);let r=Object.getPrototypeOf(t);ba.has(r)||(ba.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let n=()=>this.message;return Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0})}}))},Lg=D("$ZodError",xa),ur=D("$ZodError",xa,void 0,{Parent:Error});var fh=t=>{let e=(r,n,i,s)=>{let o=i?{...i,async:!1}:{async:!1},a=r._zod.run({value:n,issues:[]},o);if(a instanceof Promise)throw new We;if(a.issues.length){let u=new(s?.Err??t)(a.issues.map(c=>dt(c,o,mt())));throw qr(u,s?.callee??e),u}return a.value};return e},Ei=fh(ur),gh=t=>{let e=async(r,n,i,s)=>{let o=i?{...i,async:!0}:{async:!0},a=r._zod.run({value:n,issues:[]},o);if(a instanceof Promise&&(a=await a),a.issues.length){let u=new(s?.Err??t)(a.issues.map(c=>dt(c,o,mt())));throw qr(u,s?.callee??e),u}return a.value};return e},$i=gh(ur),_h=t=>(e,r,n)=>{let i=n?{...n,async:!1}:{async:!1},s=e._zod.run({value:r,issues:[]},i);if(s instanceof Promise)throw new We;return s.issues.length?wa(t,s.issues,i):{success:!0,data:s.value}},Si=_h(ur);function wa(t,e,r){let n;return{success:!1,get error(){return n||(n=new t(e.map(i=>dt(i,r,mt()))),e=void 0,r=void 0),n},set error(i){n=i,e=void 0,r=void 0}}}var vh=t=>async(e,r,n)=>{let i=n?{...n,async:!0}:{async:!0},s=e._zod.run({value:r,issues:[]},i);return s instanceof Promise&&(s=await s),s.issues.length?wa(t,s.issues,i):{success:!0,data:s.value}},Pi=vh(ur);var ka=/^[\s\S]{0,}$/;var Ea=/^-?\d+(?:\.\d+)?$/,$a=/^(?:true|false)$/i;var cr=D("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])});var Sa=D("$ZodCheckStringFormat",(t,e)=>{var r,n;cr.init(t,e),e.pattern?(r=t._zod).check??(r.check=i=>{e.pattern.lastIndex=0,!e.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:e.format,input:i.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(n=t._zod).check??(n.check=()=>{})}),Pa=D("$ZodCheckRegex",(t,e)=>{Sa.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}});var za={major:4,minor:6,patch:6};var Ee=D("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=za;let n=t._zod.def.checks,i=t._zod.traits.has("$ZodCheck")?[t,...n??[]]:n?.length?[...n]:[];for(let s of i)for(let o of s._zod.onattach)o(t);if(i.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let s=(a,u,c)=>{if(a.memo)return a;let l=qe(a),d;for(let h of u){if(h._zod.def.when){if(vi(a)||!h._zod.def.when(a))continue}else if(l)continue;let f=a.issues.length,p=h._zod.check(a);if(p instanceof Promise&&c?.async===!1)throw new We;if(d||p instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await p,a.issues.length!==f&&(ar(a.issues,f,t),l||(l=qe(a,f)))});else{if(a.issues.length===f)continue;ar(a.issues,f,t),l||(l=qe(a,f))}}return d?d.then(()=>a):a},o=(a,u,c)=>{if(qe(a))return a.aborted=!0,a;let l=s(u,i,c);if(l instanceof Promise){if(c.async===!1)throw new We;return l.then(d=>t._zod.parse(d,c))}return t._zod.parse(l,c)};t._zod.run=(a,u)=>{if(u.skipChecks)return t._zod.parse(a,u);if(u.direction==="backward"){let l=t._zod.parse({value:a.value,issues:[]},{...u,skipChecks:!0});return l instanceof Promise?l.then(d=>o(d,a,u)):o(l,a,u)}let c=t._zod.parse(a,u);if(c instanceof Promise){if(u.async===!1)throw new We;return c.then(l=>s(l,i,u))}return s(c,i,u)}}},{get"~standard"(){return yi(this,"~standard",yh(this))},set"~standard"(t){je(this,"~standard",t)}}),Ma=(t,e)=>t.issues.length?{issues:t.issues.map(r=>dt(r,e,mt()))}:{value:t.value};async function mh(t,e){let r={async:!0};return Ma(await t._zod.run({value:e,issues:[]},r),r)}function yh(t){return{validate:e=>{let r={async:!1};try{let n=t._zod.run({value:e,issues:[]},r);if(!(n instanceof Promise))return Ma(n,r)}catch{}return mh(t,e)},vendor:"zod",version:1}}var Fa=D("$ZodString",(t,e)=>{Ee.init(t,e),t._zod.pattern=e.pattern??ka,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}});var La=D("$ZodNumber",(t,e)=>{Ee.init(t,e),t._zod.pattern=Ea,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}let i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;let s=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:String(i):void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:t,...s?{received:s}:{}}),r}});var Za=D("$ZodBoolean",(t,e)=>{Ee.init(t,e),t._zod.pattern=$a,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=!!r.value}catch{}let i=r.value;return typeof i=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:t}),r}});function bh(t,e){let r=Yr(t._zod.def.checks);if(!r.length)return;let n=Math.min(...r.map(s=>s[0])),i=t._zod.parse;t._zod.parse=(s,o)=>{let a=e(s.value);if(a>n&&!o?.skipChecks&&o?.direction!=="backward"){for(let[u,c]of Yr(t._zod.def.checks))if(a>u&&c._zod.def.when(s)){let l=s.issues.length;return c._zod.check(s),s.issues[l].continue=!1,ar(s.issues,l,t),s}}return i(s,o)}}var xh=t=>Array.isArray(t)?t.length:-1;function Ra(t,e,r){t.issues.length&&e.issues.push(...Jr(r,t.issues)),e.value[r]=t.value}var Na=D("$ZodArray",(t,e)=>{Ee.init(t,e);let r=vt.memoizer;r?.attach(t),t._zod.parse=(n,i)=>{let s=n.value;if(!Array.isArray(s))return n.issues.push({expected:"array",code:"invalid_type",input:s,inst:t}),n;n.value=r?r.alloc(t,n,Array(s.length),i):Array(s.length);let o=[],a=i?.abortEarly;for(let u=0;u<s.length;u++){let c=s[u],l=e.element._zod.run({value:c,issues:[]},i);if(l instanceof Promise)o.push(l.then(d=>Ra(d,n,u)));else if(Ra(l,n,u),a&&l.issues.length!==0&&qe(l))break}return o.length?Promise.all(o).then(()=>n):n},bh(t,xh)});function Qr(t,e,r,n,i,s){let o=r in n,a=s==="optional";if(!(!o&&a&&i==="optional")){if(t.issues.length){if(i!==void 0&&a&&!o)return;e.issues.push(...Jr(r,t.issues))}if(!o&&i===void 0){t.issues.length||e.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}t.value===void 0?(o||i==="defaulted"&&!a)&&(e.value[r]=void 0):e.value[r]=t.value}}var wh=[];function kh(t){let e=Object.keys(t.shape),r=Object.getOwnPropertySymbols(t.shape),n=r.length?r:wh,i=n.length?[...e,...n]:e;for(let o of i)if(!t.shape?.[o]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(o)}": expected a Zod schema`);let s=_i(t.shape);return{...t,allKeys:i,symbolKeys:n,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(s)}}function Eh(t,e,r,n,i,s,o){let a=[],u=i.keySet,c=i.catchall._zod,l=c.def.type,d=c.optin,h=c.optout,f=0;for(let p in e){if(o&&r.issues.length!==f){if(qe(r,f))break;f=r.issues.length}if(u.has(p))continue;if(p==="__proto__"){l==="never"&&a.push(p);continue}if(l==="never"){a.push(p);continue}let g=c.run({value:e[p],issues:[]},n);g instanceof Promise?t.push(g.then(m=>Qr(m,r,p,e,d,h))):Qr(g,r,p,e,d,h)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:e,inst:s,continue:!0}),t.length?Promise.all(t).then(()=>r):r}var Da=D("$ZodObject",(t,e)=>{Ee.init(t,e);let r=Object.getOwnPropertyDescriptor(e,"shape"),n=r?.get?r.get.raw:e.shape??{};if(n){let c=()=>{let l={...n};return Object.defineProperty(e,"shape",{value:l}),c.raw=l,l};c.raw=n,Object.defineProperty(e,"shape",{get:c})}let i=Vr(()=>kh(e));Ce(t,"propValues",c=>{let l=c.def.shape,d={};for(let h in l){let f=l[h]._zod;if(f.values){Object.prototype.hasOwnProperty.call(d,h)||ir(d,h,new Set);for(let p of f.values)d[h].add(p);f.optin!==void 0&&d[h].add(void 0)}}return d});let s=nr,o=e.catchall,a,u=vt.memoizer;u?.attach(t),t._zod.parse=(c,l)=>{a??(a=i.value);let d=c.value;if(!s(d))return c.issues.push({expected:"object",code:"invalid_type",input:d,inst:t}),c;c.value=u?u.alloc(t,c,{},l):{};let h=[],f=a.shape,p=l?.abortEarly,g=c.issues.length;for(let m of a.allKeys){if(p&&c.issues.length!==g){if(qe(c,g))break;g=c.issues.length}if(m==="__proto__")continue;let v=f[m],w=v._zod.optin,y=v._zod.optout,k=v._zod.run({value:d[m],issues:[]},l);k instanceof Promise?h.push(k.then(T=>Qr(T,c,m,d,w,y))):Qr(k,c,m,d,w,y)}return o?Eh(h,d,c,l,i.value,t,p===!0):h.length?Promise.all(h).then(()=>c):c}});var ja=D("$ZodEnum",(t,e)=>{Ee.init(t,e);let r=Gr(e.entries),n=new Set(r);t._zod.values=n,Ce(t,"pattern",i=>{let s=Gr(i.def.entries).filter(o=>gi.has(typeof o));return new RegExp(s.length?`^(${s.map(o=>or(o.toString())).join("|")})$`:"^[^\\s\\S]$")}),t._zod.parse=(i,s)=>{let o=i.value;return n.has(o)||i.issues.push({code:"invalid_value",values:r,input:o,inst:t}),i}}),Ua=D("$ZodLiteral",(t,e)=>{Ee.init(t,e);let r=new Set(e.values);t._zod.values=r,Ce(t,"pattern",n=>{let i=n.def.values;return new RegExp(i.length?`^(${i.map(s=>typeof s=="string"?or(s):s?or(s.toString()):String(s)).join("|")})$`:"^[^\\s\\S]$")}),t._zod.parse=(n,i)=>{let s=n.value;return r.has(s)||n.issues.push({code:"invalid_value",values:e.values,input:s,inst:t}),n}});function Ca(t,e){return t.value=e.issues.length?void 0:e.value,t}var Ha=D("$ZodOptional",(t,e)=>{Ee.init(t,e),Ce(t,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),t._zod.optout="optional",Ce(t,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),Ce(t,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${pi(n.source)})?$`):void 0}),t._zod.parse=(r,n)=>{if(r.value===void 0){if(e.innerType._zod.optin!=="defaulted")return r;let i=e.innerType._zod.run({value:r.value,issues:[]},n);return i instanceof Promise?i.then(s=>Ca(r,s)):Ca(r,i)}return e.innerType._zod.run(r,n)}});var Ba=D("$ZodDefault",(t,e)=>{Ee.init(t,e),t._zod.optin="defaulted",Ce(t,"values",r=>r.def.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);if(r.value===void 0)return r.value=e.defaultValue,r;let i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(s=>Ia(s,e)):Ia(i,e)}});function Ia(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}function Aa(t,e,r,n){return e.issues.length?(t.value=r.catchValue({...e,value:t.value,error:{issues:e.issues.map(i=>dt(i,n,mt()))},input:t.value}),t):(t.value=e.value,e.memo&&(t.memo=!0),t)}var Ga=D("$ZodCatch",(t,e)=>{Ee.init(t,e),Ce(t,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),Ce(t,"optout",r=>r.def.innerType._zod.optout),Ce(t,"values",r=>r.def.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let i=e.innerType._zod.run({value:r.value,issues:[]},n);return i instanceof Promise?i.then(s=>Aa(r,s,e,n)):Aa(r,i,e,n)}});var Va=D("$ZodCustom",(t,e)=>{cr.init(t,e),Ee.init(t,e),t._zod.parse=(r,n)=>r,t._zod.check=r=>{let n=r.value,i=e.fn(n);if(i instanceof Promise)return i.then(s=>Oa(s,r,n,t));Oa(i,r,n,t)}});function Oa(t,e,r,n){if(!t){let i={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(i.params=n._zod.def.params),e.issues.push(Xr(i))}}function qa(t){return t.checks&&(t.checks=[...t.checks]),t}function Ka(t,e){return new t(qa({type:"string",...Re(e)}))}function Wa(t,e){return new t(qa({type:"number",checks:[],...Re(e)}))}function Ja(t,e){return new t({type:"boolean",...Re(e)})}function zi(t,e){return new Pa({check:"string_format",format:"regex",...Re(e),pattern:t})}function Ya(t,e,r){let n=Re(r);return n.abort??(n.abort=!0),new t({type:"custom",check:"custom",fn:e,...n})}var Fe=D("ZodMiniType",(t,e)=>{if(!t._zod)throw new Error("Uninitialized schema in ZodMiniType.");Ee.init(t,e),t.def=e,t.type=e.type},{get with(){return this.check},set with(t){je(this,"with",t)},parse(t,e){return Ei(this,t,e,{callee:this.parse})},parseAsync(t,e){return $i(this,t,e,{callee:this.parseAsync})},safeParse(t,e){return Si(this,t,e)},safeParseAsync(t,e){return Pi(this,t,e)},check(...t){let e=this.def;return this.clone({...e,checks:[...e.checks??[],...t.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]},{parent:!0})},clone(t,e){return ze(this,t,e)},brand(){return this},register(t,e){return t.add(this,e),this},apply(t,...e){return e.length===0?t(this):t(this,...e)}}),Ph=D("ZodMiniString",(t,e)=>{Fa.init(t,e),Fe.init(t,e)});function yt(t){return Ka(Ph,t)}var Th=D("ZodMiniNumber",(t,e)=>{La.init(t,e),Fe.init(t,e)});function Ri(t){return Wa(Th,t)}var zh=D("ZodMiniBoolean",(t,e)=>{Za.init(t,e),Fe.init(t,e)});function Je(t){return Ja(zh,t)}var Rh=D("ZodMiniArray",(t,e)=>{Na.init(t,e),Fe.init(t,e)});function Ci(t,e){return new Rh({type:"array",element:t,...Re(e)})}var Ch=D("ZodMiniObject",(t,e)=>{Da.init(t,e),Fe.init(t,e),bi(t,"shape",r=>r._zod.def.shape,!1)});function Ii(t,e){let r={type:"object",shape:t??{},...Re(e)};return new Ch(r)}var Ih=D("ZodMiniEnum",(t,e)=>{ja.init(t,e),Fe.init(t,e),t.options=[...t._zod.values]});function Xa(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new Ih({type:"enum",entries:r,...Re(e)})}var Ah=D("ZodMiniLiteral",(t,e)=>{Ua.init(t,e),Fe.init(t,e)});function Qa(t,e){return new Ah({type:"literal",values:Array.isArray(t)?t:[t],...Re(e)})}var Oh=D("ZodMiniOptional",(t,e)=>{Ha.init(t,e),Fe.init(t,e)});function he(t){return new Oh({type:"optional",innerType:t})}var Mh=D("ZodMiniDefault",(t,e)=>{Ba.init(t,e),Fe.init(t,e)});function Lt(t,e){return new Mh({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():Kr(e)}})}var Fh=D("ZodMiniCatch",(t,e)=>{Ga.init(t,e),Fe.init(t,e)});function eu(t,e){return new Fh({type:"catch",innerType:t,catchValue:typeof e=="function"?e:Ke.constantCatch(e)})}var Lh=D("ZodMiniCustom",(t,e)=>{Va.init(t,e),Fe.init(t,e)});function Ai(t,e){return Ya(Lh,t??(()=>!0),e)}var Oi="https://in.dev.heycatch.ai",bt="dev",xt="0.8.5-dev.2562",Mi="phc_CqKdgm7xbFBs3mSdtqzrHNTfzTRKrwRmCrEB9aftENY9";function He(){return typeof globalThis.window<"u"}var Dh=[".chatgpt.site",".vercel.app"];function jh(t){let e=t.toLowerCase().replace(/\.$/,"");return Dh.some(r=>e.endsWith(r))}function tu({stage:t,hostname:e}){return t!=="dev"||ui(e)||jh(e)?null:`[HeyCatch] REFUSING to start: this is an internal development build (v${xt}) running on "${e}". No events will be sent. Install the latest stable version instead - resolve it with \`npm view @heycatch/sdk version\` (never a \`-dev.N\` version) - and re-verify against https://heycatch.ai/agents.md`}var lr=["X-HeyCatch-Session-Id","X-HeyCatch-Window-Id","X-HeyCatch-Distinct-Id"],ht="unknown",Uh=["localStorage","cookie","memory","localStorage+cookie","sessionStorage"];var ru=Ii({projectKey:yt({error:'config.projectKey is missing or malformed \u2014 expected a string starting with "hck_pk_". Copy it from your project page in the HeyCatch dashboard.'}).check(zi(/^hck_pk_/,{error:'config.projectKey is missing or malformed \u2014 expected a string starting with "hck_pk_". Copy it from your project page in the HeyCatch dashboard.'})),tracingHosts:Lt(Ci(yt()),[]),install:Lt(Ii({framework:Lt(yt(),ht),frameworkVersion:Lt(yt(),ht),agent:Lt(yt(),ht)}),{framework:ht,frameworkVersion:ht,agent:ht}),autocapture:he(Je()),maskAllText:he(Je()),maskAllElementAttributes:he(Je()),propertyDenylist:he(Ci(yt())),sanitizeProperties:he(Ai(t=>typeof t=="function")),beforeSend:he(Ai(t=>typeof t=="function"||Array.isArray(t)&&t.every(e=>typeof e=="function"))),persistence:he(Xa(Uh)),disablePersistence:he(Je()),cookieExpirationDays:he(Ri()),optOutCapturingByDefault:he(Je()),respectDnt:he(Je()),collectIp:he(Je()),requestBatching:he(Je()),flushIntervalMs:he(Ri()),site:eu(he(Qa("landing")),t=>{let e=typeof t.value=="string"?JSON.stringify(t.value):`a ${typeof t.value}`;console.error(`[HeyCatch] config.site must be 'landing' or omitted - got ${e}. Ignoring it; this project is reported as untagged.`)})}),nu=["nextjs","vite-react","react","vue","svelte","astro","angular","react-native","web"],iu=["lovable","bolt","v0","replit","cursor","claude-code","codex","windsurf","other"];var Hh=new RegExp(String.raw`^\/(${si})\/?$`),Bh=1e3;function Gh(t){return new URLSearchParams({utm_source:oi,utm_campaign:t}).toString()}var Vh=["utm_source","utm_medium","utm_campaign"];function en(){if(!He())return!1;let t=Hh.exec(globalThis.location.pathname);if(!t)return!1;let e=t[1];return e===void 0?!1:(globalThis.location.replace(`/?${Gh(e)}`),!0)}function su(t){return t.get("utm_source")===oi&&t.get("utm_campaign")!==null}function tn(){su(new URLSearchParams(globalThis.location.search))&&setTimeout(()=>{let t=new URLSearchParams(globalThis.location.search);if(!su(t))return;for(let r of Vh)t.delete(r);let e=t.toString();globalThis.history.replaceState(globalThis.history.state,"",globalThis.location.pathname+(e===""?"":`?${e}`)+globalThis.location.hash)},Bh)}var _=typeof window<"u"?window:void 0,pe=typeof globalThis<"u"?globalThis:_,_e=pe?.navigator,P=pe?.document,ie=pe?.location,wo=pe?.fetch,cs=pe!=null&&pe.XMLHttpRequest&&"withCredentials"in new pe.XMLHttpRequest?pe.XMLHttpRequest:void 0,ou=pe?.AbortController,qh=pe?.CompressionStream,xe=_e?.userAgent;function nc(){return!(!_||_.navigator.onLine===!1)}var dr=typeof globalThis<"u"?globalThis:_;dr&&typeof self>"u"&&(dr.self=dr),dr&&typeof File>"u"&&(dr.File=function(){});var C=_??{},j={DEBUG:!1,LIB_VERSION:"0.2.4",LIB_NAME:"browser-common"};function au(t,e,r,n,i,s,o){try{var a=t[s](o),u=a.value}catch(c){return void r(c)}a.done?e(u):Promise.resolve(u).then(n,i)}function ne(t){return function(){var e=this,r=arguments;return new Promise((function(n,i){var s=t.apply(e,r);function o(u){au(s,n,i,o,a,"next",u)}function a(u){au(s,n,i,o,a,"throw",u)}o(void 0)}))}}function x(){return x=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var r=arguments[e];for(var n in r)({}).hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},x.apply(null,arguments)}function ic(t,e){if(t==null)return{};var r={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(e.indexOf(n)!==-1)continue;r[n]=t[n]}return r}var uu=t=>{if(typeof t!="string")return t;try{return JSON.parse(t)}catch{return t}};function cu(t){return typeof t=="string"||t}function lu(t){return typeof t=="string"?t:void 0}var hr,Kh=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],rt=(function(t){return t.AnonymousId="anonymous_id",t.DistinctId="distinct_id",t.Props="props",t.EnablePersonProcessing="enable_person_processing",t.PersonMode="person_mode",t.FeatureFlagDetails="feature_flag_details",t.FeatureFlags="feature_flags",t.FeatureFlagPayloads="feature_flag_payloads",t.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",t.BootstrapFeatureFlags="bootstrap_feature_flags",t.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",t.OverrideFeatureFlags="override_feature_flags",t.Queue="queue",t.AiQueue="ai_queue",t.LogsQueue="logs_queue",t.OptedOut="opted_out",t.SessionId="session_id",t.SessionStartTimestamp="session_start_timestamp",t.SessionLastTimestamp="session_timestamp",t.PersonProperties="person_properties",t.GroupProperties="group_properties",t.InstalledAppBuild="installed_app_build",t.InstalledAppVersion="installed_app_version",t.SessionReplay="session_replay",t.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",t.SurveyLastSeenDate="survey_last_seen_date",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t})({}),du=(function(t){return t.GZipJS="gzip-js",t.Base64="base64",t})({}),Wh=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"],Jh=["token"],sc="NativeGzipValidationError",ls=t=>t.length>=2&&t[0]===31&&t[1]===139,hu=(t,e)=>t===du.GZipJS||e===du.GZipJS||e==="gzip",pu=t=>!(!t||typeof t!="object")&&("name"in t?String(t.name):"")==="NotReadableError",rn=t=>{var e=new Error("Native gzip produced invalid output: "+t);throw e.name=sc,e},Yh=(function(){var t=ne((function*(e,r){18>e.size&&rn("too-short");var n=new Uint8Array(yield e.slice(0,10).arrayBuffer());ls(n)&&n[2]===8||rn("invalid-header");var i=new DataView(yield e.slice(e.size-8).arrayBuffer());i.getUint32(0,!0)!==(o=>{for(var a=(()=>{if(hr)return hr;hr=[];for(var l=0;256>l;l++){for(var d=l,h=0;8>h;h++)d=1&d?3988292384^d>>>1:d>>>1;hr[l]=d>>>0}return hr})(),u=4294967295,c=0;o.length>c;c++)u=a[255&(u^o[c])]^u>>>8;return(4294967295^u)>>>0})(r)&&rn("invalid-crc");var s=r.length>>>0;i.getUint32(4,!0)!==s&&rn("invalid-size")}));return function(e,r){return t.apply(this,arguments)}})();function ds(){return ds=ne((function*(t,e,r){e===void 0&&(e=!0);try{var n=new TextEncoder().encode(t),i=new globalThis.CompressionStream("gzip"),s=i.writable.getWriter(),o=s.write(n).then((()=>s.close())).catch((function(){var c=ne((function*(l){try{yield s.abort(l)}catch{}throw l}));return function(l){return c.apply(this,arguments)}})()),a=new Response(i.readable).blob(),u=(yield Promise.all([a,o]))[0];return yield Yh(u,n),u}catch(c){if(r!=null&&r.rethrow)throw c;return e&&console.error("Failed to gzip compress data",c),null}})),ds.apply(this,arguments)}var Xh=["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"],fu=function(t,e){if(e===void 0&&(e=[]),!t)return!1;var r=t.toLowerCase();return Xh.concat(e).some((n=>{var i=n.toLowerCase();return r.indexOf(i)!==-1}))};function A(t,e){return t.indexOf(e)!==-1}var Jn=function(t){return t.trim()},hs=function(t){return t.replace(/^\$/,"")};function oc(t){var e,r=[];return(e=JSON.stringify(t,(function(n,i){if(typeof i=="bigint")return i.toString();if(typeof i!="function"&&typeof i!="symbol"){if(i instanceof Error)return{name:i.name,message:i.message,stack:i.stack};if(i&&typeof i=="object"){for(;r.length>0&&r[r.length-1]!==this;)r.pop();if(r.includes(i))return"[Circular]";r.push(i)}return i}})))!==null&&e!==void 0?e:"null"}var ac=Object.prototype,uc=ac.hasOwnProperty,Yn=ac.toString,O=Array.isArray||function(t){return Yn.call(t)==="[object Array]"},Ze=t=>typeof t=="function",Y=t=>t===Object(t)&&!O(t),pt=t=>{if(Y(t)){for(var e in t)if(uc.call(t,e))return!1;return!0}return!1},E=t=>t===void 0,H=t=>Yn.call(t)=="[object String]",ps=t=>H(t)&&t.trim().length===0,me=t=>t===null,F=t=>E(t)||me(t),de=t=>Yn.call(t)=="[object Number]"&&t==t,et=t=>de(t)&&t>0,Ne=t=>Yn.call(t)==="[object Boolean]",Qh=t=>t instanceof FormData,ep=t=>A(Wh,t),tp=t=>A(Jh,t);function cc(t){return t===null||typeof t!="object"}function bn(t,e){return{}.toString.call(t)==="[object "+e+"]"}function ko(t){return typeof Event<"u"&&(function(e,r){try{return e instanceof r}catch{return!1}})(t,Event)}var rp=[!0,"true",1,"1","yes"],Fi=t=>A(rp,t),np=[!1,"false",0,"0","no"];function Ge(t,e,r,n,i){return e>r&&(n.warn("min cannot be greater than max."),e=r),de(t)?t>r?(n.warn(" cannot be greater than max: "+r+". Using max value instead."),r):e>t?(n.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(n.warn(" must be a number. using max or fallback. max: "+r+", fallback: "+i),Ge(i||r,e,r,n))}var fs=class{constructor(e){this.$e={},this.ze=e.ze,this.Ze=Ge(e.bucketSize,0,100,e.Ge),this.Qe=Ge(e.refillRate,0,this.Ze,e.Ge),this.Je=Ge(e.refillInterval,0,864e5,e.Ge)}Ke(e,r){var n=Math.floor((r-e.lastAccess)/this.Je);n>0&&(e.tokens=Math.min(e.tokens+n*this.Qe,this.Ze),e.lastAccess=e.lastAccess+n*this.Je)}consumeRateLimit(e){var r,n=Date.now(),i=String(e),s=this.$e[i];return s?this.Ke(s,n):this.$e[i]=s={tokens:this.Ze,lastAccess:n},s.tokens===0||(s.tokens--,s.tokens===0&&((r=this.ze)==null||r.call(this,e)),s.tokens===0)}stop(){this.$e={}}},Se="Mobile",xn="iOS",at="Android",Wt="Tablet",lc=at+" "+Wt,dc="iPad",hc="Apple",pc=hc+" Watch",Pr="Safari",Jt="BlackBerry",fc="Samsung",gc=fc+"Browser",_c=fc+" Internet",At="Chrome",ip=At+" OS",vc=At+" "+xn,Eo="Internet Explorer",mc=Eo+" "+Se,$o="Opera",sp=$o+" Mini",So="Edge",yc="Microsoft "+So,qt="Firefox",bc=qt+" "+xn,Or="Nintendo",Mr="PlayStation",Kt="Xbox",xc=at+" "+Se,wc=Se+" "+Pr,wr="Windows",gs=wr+" Phone",gu="Nokia",_s="Ouya",kc="Generic",op=kc+" "+Se.toLowerCase(),Ec=kc+" "+Wt.toLowerCase(),vs="Konqueror",$c="Oculus Browser",wn="Vivaldi",Sc="Yandex",kn="Whale",ms="DuckDuckGo",Pc="Pale Moon",En="Waterfox",Tr="Brave",Tc="Google Search App",te="(\\d+(\\.\\d+)?)",Li=new RegExp("Version/"+te),ap=new RegExp(Kt,"i"),up=new RegExp(Mr+" \\w+","i"),cp=new RegExp(Or+" \\w+","i"),Po=new RegExp(Jt+"|PlayBook|BB10","i"),lp={"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"},zc=function(t,e,r,n){e=e||"";var i=(function(s){return s!=null&&s.brave?Tr:null})(r);return i||(n!=null&&n.detectGoogleSearchApp&&A(t,"GSA/")?Tc:A(t," OPR/")&&A(t,"Mini")?sp:A(t," OPR/")?$o:Po.test(t)?Jt:A(t,"IE"+Se)||A(t,"WPDesktop")?mc:A(t,"OculusBrowser")?$c:A(t,gc)?_c:A(t,So)||A(t,"Edg/")?yc:A(t,wn+"/")?wn:A(t,"YaBrowser/")?Sc:A(t,kn+"/")?kn:A(t,ms+"/")||A(t,"Ddg/")?ms:A(t,"FBIOS")?"Facebook "+Se:A(t,"UCWEB")||A(t,"UCBrowser")?"UC Browser":A(t,"CriOS")?vc:A(t,"CrMo")||A(t,At)?At:A(t,at)&&A(t,Pr)?xc:A(t,"FxiOS")?bc:A(t.toLowerCase(),vs.toLowerCase())?vs:A(t,Tr+"/")?Tr:((s,o)=>o&&A(o,hc)||(function(a){return A(a,Pr)&&!A(a,At)&&!A(a,at)})(s))(t,e)?A(t,Se)?wc:Pr:A(t,"PaleMoon/")?Pc:A(t,En+"/")?En:A(t,qt)?qt:A(t,"MSIE")||A(t,"Trident/")?Eo:A(t,"Gecko")?qt:"")},dp={[mc]:[new RegExp("rv:"+te)],[yc]:[new RegExp(So+"?\\/"+te)],[At]:[new RegExp("("+At+"|CrMo)\\/"+te)],[vc]:[new RegExp("CriOS\\/"+te)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+te)],[Pr]:[Li],[wc]:[Li],[$o]:[new RegExp("(Opera|OPR)\\/"+te)],[qt]:[new RegExp(qt+"\\/"+te)],[bc]:[new RegExp("FxiOS\\/"+te)],[vs]:[new RegExp("Konqueror[:/]?"+te,"i")],[Jt]:[new RegExp(Jt+" "+te),Li],[xc]:[new RegExp("android\\s"+te,"i")],[_c]:[new RegExp(gc+"\\/"+te)],[$c]:[new RegExp("OculusBrowser\\/"+te)],[wn]:[new RegExp(wn+"\\/"+te)],[Sc]:[new RegExp("YaBrowser\\/"+te)],[kn]:[new RegExp(kn+"\\/"+te)],[Tr]:[new RegExp(Tr+"\\/"+te)],[ms]:[new RegExp("(DuckDuckGo|Ddg)\\/"+te)],[Pc]:[new RegExp("PaleMoon\\/"+te)],[En]:[new RegExp(En+"\\/"+te)],[Tc]:[new RegExp("GSA\\/"+te)],[Eo]:[new RegExp("(rv:|MSIE )"+te)],Mozilla:[new RegExp("rv:"+te)]},hp=function(t,e,r,n){var i=zc(t,e,r,n),s=dp[i];if(E(s))return null;for(var o=0;s.length>o;o++){var a=t.match(s[o]);if(a)return parseFloat(a[a.length-2])}return null},_u=[[new RegExp(Kt+"; "+Kt+" (.*?)[);]","i"),t=>[Kt,t&&t[1]||""]],[new RegExp(Or,"i"),[Or,""]],[new RegExp(Mr,"i"),[Mr,""]],[Po,[Jt,""]],[new RegExp(wr,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[gs,""];if(new RegExp(Se).test(e)&&!/IEMobile\b/.test(e))return[wr+" "+Se,""];var r=/Windows NT ([0-9.]+)/i.exec(e);if(r&&r[1]){var n=lp[r[1]]||"";return/arm/i.test(e)&&(n="RT"),[wr,n]}return[wr,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[xn,[t[3],t[4],t[5]||"0"].join(".")]:[xn,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=E(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+at+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+at+")","i"),t=>t&&t[2]?[at,[t[2],t[3],t[4]||"0"].join(".")]:[at,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var e=["Mac OS X",""];return t&&t[1]&&(e[1]=[t[1],t[2],t[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[ip,""]],[/Linux|debian/i,["Linux",""]]],vu=function(t){return cp.test(t)?Or:up.test(t)?Mr:ap.test(t)?Kt:new RegExp(_s,"i").test(t)?_s:new RegExp("("+gs+"|WPDesktop)","i").test(t)?gs:/iPad/.test(t)?dc:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?pc:Po.test(t)?Jt:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(gu,"i").test(t)?gu:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(Se).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?at:lc:new RegExp("(pda|"+Se+")","i").test(t)?op:new RegExp(Wt,"i").test(t)&&!new RegExp(Wt+" pc","i").test(t)?Ec:""},pp=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function mu(t,e){return typeof(r=t)=="string"&&pp.test(r)?t:e();var r}function ft(t){return t&&t.split("#")[0]}function pn(t,e){var r=setTimeout(t,e);return r?.unref&&r?.unref(),r}var fp=t=>t instanceof Error,Rc={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},gp=Rc.info;function Cc(t){if(Ne(t))return{boolValue:t};if(typeof t=="number")return Number.isFinite(t)?Number.isInteger(t)?{intValue:t}:{doubleValue:t}:{stringValue:String(t)};if(typeof t=="string")return{stringValue:t};if(O(t))return{arrayValue:{values:t.map((e=>Cc(e)))}};try{return{stringValue:JSON.stringify(t)}}catch{return{stringValue:String(t)}}}function $n(t){var e=[];for(var r in t){var n=t[r];me(n)||E(n)||e.push({key:r,value:Cc(n)})}return e}function _p(t,e){var r=Rc[t.level||"info"]||gp,n=r.text,i=r.number,s=String(Date.now())+"000000",o={};e.distinctId&&(o.posthogDistinctId=e.distinctId),e.sessionId&&(o.sessionId=e.sessionId),e.windowId&&(o["window.id"]=e.windowId),F(e.sessionStartTimestamp)||(o.sessionStartTimestamp=String(e.sessionStartTimestamp)),F(e.lastActivityTimestamp)||(o.lastActivityTimestamp=String(e.lastActivityTimestamp)),e.currentUrl&&(o["url.full"]=e.currentUrl),e.screenName&&(o["screen.name"]=e.screenName),e.appState&&(o["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(o.feature_flags=e.activeFeatureFlags);var a=x({},o,t.attributes||{}),u={timeUnixNano:s,observedTimeUnixNano:s,severityNumber:i,severityText:n,body:{stringValue:t.body},attributes:$n(a)};return t.trace_id&&(u.traceId=t.trace_id),t.span_id&&(u.spanId=t.span_id),E(t.trace_flags)||(u.flags=t.trace_flags),u}function Ic(t,e,r){return x({},t.resourceAttributes,{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment},t.serviceVersion&&{"service.version":t.serviceVersion},{"telemetry.sdk.name":e,"telemetry.sdk.version":r})}function Ac(t,e,r,n){return{resourceLogs:[{resource:{attributes:$n(e)},scopeLogs:[{scope:{name:r,version:n},logRecords:t}]}]}}var vp=class{constructor(t,e,r,n,i,s,o){var a;s===void 0&&(s=()=>Promise.resolve()),this._instance=t,this.Te=e,this.Ge=r,this.Ye=n,this.Xe=i,this.et=s,this.tt=o,this.rt=null,this.it=0,this.nt=0,this.st=0,this.ot=0,this.ut=!1,this.ht=e.maxBufferSize,this.dt=Math.max((a=e.maxQueueSize)!==null&&a!==void 0?a:e.maxBufferSize,e.maxBufferSize),this.ct=e.flushIntervalMs,this.vt=e.maxBatchRecordsPerPost,this.ft=e.rateCapWindowMs,this.yt=e.maxLogsPerInterval}reset(){this.bt(),this.rt=null,this.st=0,this.ot=0,this.ut=!1,this.it=0,this.nt=0,this.vt=this.Te.maxBatchRecordsPerPost}onReconnect(){this.nt=0,this._t()}captureLog(t){if(!this._instance.isDisabled&&!this._instance.optedOut&&t!=null&&t.body){var e=this.wt(t);if(e!==null)if(e.body){if(this.xt()){var r={record:_p(e,this.Ye())};this.Xe((()=>this.kt(r)))}}else this.Ge.info("Log was rejected in beforeSend function")}}wt(t){var e=this.Te.beforeSend;if(!e)return t;var r=O(e)?e:[e],n=t;for(var i of r)try{var s=i(n);if(!s)return this.Ge.info("Log was rejected in beforeSend function"),null;n=s}catch(o){return this.Ge.error("Error in beforeSend function for log:",o),null}return n}xt(){if(this.yt===void 0)return!0;var t=Date.now(),e=t-this.st;return this.ft>e&&e>=0||(this.st=t,this.ot=0,this.ut=!1),this.yt>this.ot?(this.ot++,!0):(this.ut||(this.Ge.warn("captureLog dropping logs: exceeded "+this.yt+" logs per "+this.ft+"ms"),this.ut=!0),!1)}flush(){var t=this;return ne((function*(){if(!t._instance.isDisabled)return t.rt||(t.rt=t.St().finally((()=>{t.rt=null}))),t.rt}))()}St(){var t=this;return ne((function*(){var e;t.bt();var r=(e=t._instance.getPersistedProperty(rt.LogsQueue))!==null&&e!==void 0?e:[];if(r.length!==0)for(var n=r.length,i=0;r.length>0&&n>i;){var s,o;t.it=0;var a=Math.min(r.length,t.vt),u=r.slice(0,a),c=Ac(u.map((d=>d.record)),t.Ct(),(s=t.tt)!==null&&s!==void 0?s:t._instance.getLibraryId(),t._instance.getLibraryVersion()),l=yield t._instance.Tt(c);if(l.kind==="too-large"&&u.length>1)t.vt=Math.max(1,Math.floor(u.length/2)),t.Ge.warn("Received 413 when sending logs batch of size "+u.length+", reducing batch size to "+t.vt);else if(l.kind==="retry-later"||(l.kind==="too-large"?t.Ge.warn("Dropping a single log record after 413 with batch size 1 \u2014 the record is larger than the server cap and cannot be split further."):l.kind==="ok"&&t.Te.maxBatchRecordsPerPost>t.vt&&(t.vt=Math.min(t.Te.maxBatchRecordsPerPost,t.vt+1)),yield t.It(u.length),r=(o=t._instance.getPersistedProperty(rt.LogsQueue))!==null&&o!==void 0?o:[],i+=u.length,l.kind==="fatal"))throw l.error}}))()}It(t){var e=this;return ne((function*(){var r,n=Math.max(0,t-e.it),i=(r=e._instance.getPersistedProperty(rt.LogsQueue))!==null&&r!==void 0?r:[];e._instance.setPersistedProperty(rt.LogsQueue,i.slice(n)),yield e.et()}))()}Ct(){return Ic(this.Te,this._instance.getLibraryId(),this._instance.getLibraryVersion())}kt(t){var e;if(!this._instance.optedOut){var r=(e=this._instance.getPersistedProperty(rt.LogsQueue))!==null&&e!==void 0?e:[];this.dt>r.length||(r.shift(),this.it++,this.Ge.info("Logs queue is full, dropping oldest record.")),r.push(t),this._instance.setPersistedProperty(rt.LogsQueue,r),this.ht>r.length?this.Mt():this._t()}}Mt(t){t===void 0&&(t=this.ct),this.Et||(this.Et=pn((()=>{this.Et=void 0,this._t()}),t))}Rt(){var t=Math.min(Math.max(0,this.nt-1),6);return this.ct*Math.pow(2,t)}Pt(){var t=this._instance.getPersistedProperty(rt.LogsQueue);return!!t&&t.length>0}shutdown(t){var e=this;return ne((function*(){e.bt();var r=e.flush().catch((()=>{}));t!==void 0?yield Promise.race([r,new Promise((n=>pn(n,t)))]):yield r}))()}flushWithTimeout(t){var e=this;return ne((function*(){var r=!1,n=e.flush(),i=new Promise((s=>pn((()=>{r=!0,s()}),t)));try{yield Promise.race([n,i])}finally{r&&n.catch((()=>{}))}}))()}_t(){this.flush().then((()=>{this.nt=0}),(t=>{this.nt++,this.Ge.error("PostHog logs flush failed:",t)})).finally((()=>{!this._instance.isDisabled&&this.Pt()&&this.Mt(this.Rt())}))}bt(){this.Et&&(clearTimeout(this.Et),this.Et=void 0)}},Zi=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function yu(t){return String(t)+"000000"}function bu(t,e,r,n){var i="";return n&&(i=Object.keys(n).sort().map((s=>JSON.stringify(s)+":"+JSON.stringify(n[s]))).join(",")),t+"\0"+e+"\0"+(r??"")+"\0"+i}var mp=class{constructor(t,e,r){this._instance=t,this.Te=e,this.Ge=r,this.Ot=new Map,this.rt=null,this.Ft=!1,this.Lt=new Map,this.$t=new Set,this.At=0}count(t,e,r){e===void 0&&(e=1),this.Nt({name:t,type:"count",value:e,unit:r?.unit,attributes:r?.attributes})}gauge(t,e,r){this.Nt({name:t,type:"gauge",value:e,unit:r?.unit,attributes:r?.attributes})}histogram(t,e,r){this.Nt({name:t,type:"histogram",value:e,unit:r?.unit,attributes:r?.attributes})}flush(){var t=this,e=this.rt,r=(function(){var i=ne((function*(){e&&(yield e.catch((()=>{}))),yield t.Dt()}));return function(){return i.apply(this,arguments)}})(),n=r().finally((()=>{this.rt===n&&(this.rt=null)}));return this.rt=n,n}drainWindow(){if(this.Ot.size===0)return null;var t=this.Ot;return this.Ot=new Map,this.Ft=!1,this.Lt=new Map,this.$t=new Set,this.qt(t)}reset(){this.At++,this.bt(),this.Ot=new Map,this.rt=null,this.Ft=!1,this.Lt=new Map,this.$t=new Set}Nt(t){if(!this._instance.isDisabled&&!this._instance.optedOut){var e=this.wt(t);if(e!==null)if(e.name&&typeof e.name=="string")if(typeof e.value=="number"&&Number.isFinite(e.value))if(e.type==="count"&&0>e.value)this.Ge.warn("Dropping count '"+e.name+"': counters are monotonic, value must be >= 0");else{var r,n;try{r=e.attributes?x({},e.attributes):void 0,n=bu(e.type,e.name,e.unit,r)}catch(o){return void this.Ge.warn("Dropping metric '"+e.name+"': attributes could not be serialized",o)}var i=this.Ot.get(n);if(!i){if(!this.jt())return;i={name:e.name,type:e.type,unit:e.unit,attributes:r,windowStartMs:Date.now()},this.Ot.set(n,i)}var s=this.Lt.get(e.name);s===void 0?this.Lt.set(e.name,e.type):s===e.type||this.$t.has(e.name)||(this.$t.add(e.name),this.Ge.warn("Metric name '"+e.name+"' is already used as a "+s+"; recording it as a "+e.type+" too will blend both series in charts. Use a distinct name.")),this.Ht(i,e.value),this.Mt()}else this.Ge.warn("Dropping metric '"+e.name+"': value must be a finite number");else this.Ge.warn("Dropping metric with empty name")}}jt(){return this.Te.maxSeriesPerFlush>this.Ot.size||(this.Ft||(this.Ft=!0,this.Ge.warn("Metric series cap reached ("+this.Te.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}Ht(t,e){var r;switch(t.type){case"count":t.total=((r=t.total)!==null&&r!==void 0?r:0)+e;break;case"gauge":t.last=e;break;case"histogram":t.hist||(t.hist={count:0,sum:0,min:e,max:e,bucketCounts:new Array(Zi.length+1).fill(0)});var n=t.hist;n.count+=1,n.sum+=e,n.min=Math.min(n.min,e),n.max=Math.max(n.max,e),n.bucketCounts[(function(i,s){for(var o=0;s.length>o;o++)if(s[o]>=i)return o;return s.length})(e,Zi)]+=1}}wt(t){var e=this.Te.beforeSend;if(!e)return t;var r=O(e)?e:[e],n=t;for(var i of r)try{var s=i(n);if(!s)return this.Ge.info("Metric was rejected in beforeSend function"),null;n=s}catch(o){return this.Ge.error("Error in beforeSend function for metric:",o),null}return n}Mt(){this.Et||(this.Et=pn((()=>{this.Et=void 0,this.flush().catch((t=>{this.Ge.error("Metrics flush failed:",t)}))}),this.Te.flushIntervalMs))}bt(){this.Et&&(clearTimeout(this.Et),this.Et=void 0)}Dt(){var t=this;return ne((function*(){if(t.Ot.size!==0){var e=t.Ot;t.Ot=new Map,t.Ft=!1,t.Lt=new Map,t.$t=new Set;var r=t.At,n=yield t._instance.Bt(t.qt(e));if(r===t.At)switch(n.kind){case"ok":return;case"retry-later":return t.Ut(e),void t.Mt();case"too-large":return void t.Ge.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.Ge.error("Failed to send metrics batch:",n.error)}}}))()}qt(t){return e=this.zt(t),r=(function(s,o,a){return x({},s.resourceAttributes,{"service.name":s.serviceName||"unknown_service"},s.environment&&{"deployment.environment":s.environment},s.serviceVersion&&{"service.version":s.serviceVersion},{"telemetry.sdk.name":o,"telemetry.sdk.version":a})})(this.Te,this._instance.getLibraryId(),this._instance.getLibraryVersion()),n=this._instance.getLibraryId(),i=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:$n(r)},scopeMetrics:[{scope:{name:n,version:i},metrics:e}]}]};var e,r,n,i}zt(t){var e=yu(Date.now()),r=new Map;for(var n of t.values()){var i,s=bu(n.type,n.name,n.unit,void 0),o=r.get(s);o||(o=x({name:n.name},n.unit&&{unit:n.unit}),n.type==="count"?o.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:n.type==="gauge"?o.gauge={dataPoints:[]}:o.histogram={aggregationTemporality:1,dataPoints:[]},r.set(s,o));var a=$n((i=n.attributes)!==null&&i!==void 0?i:{}),u=yu(n.windowStartMs);if(n.type==="count"){var c,l={attributes:a,startTimeUnixNano:u,timeUnixNano:e,asDouble:(c=n.total)!==null&&c!==void 0?c:0};o.sum.dataPoints.push(l)}else if(n.type==="gauge"){var d,h={attributes:a,timeUnixNano:e,asDouble:(d=n.last)!==null&&d!==void 0?d:0};o.gauge.dataPoints.push(h)}else n.hist&&o.histogram.dataPoints.push({attributes:a,startTimeUnixNano:u,timeUnixNano:e,count:n.hist.count,sum:n.hist.sum,min:n.hist.min,max:n.hist.max,bucketCounts:n.hist.bucketCounts,explicitBounds:Zi})}return Array.from(r.values())}Ut(t){var e,r;for(var n of t){var i=n[0],s=n[1],o=this.Ot.get(i);if(o)switch(o.windowStartMs=Math.min(o.windowStartMs,s.windowStartMs),o.type){case"count":o.total=((e=o.total)!==null&&e!==void 0?e:0)+((r=s.total)!==null&&r!==void 0?r:0);break;case"gauge":break;case"histogram":if(s.hist)if(o.hist){o.hist.count+=s.hist.count,o.hist.sum+=s.hist.sum,o.hist.min=Math.min(o.hist.min,s.hist.min),o.hist.max=Math.max(o.hist.max,s.hist.max);for(var a=0;o.hist.bucketCounts.length>a;a++)o.hist.bucketCounts[a]+=s.hist.bucketCounts[a]}else o.hist=s.hist}else this.jt()&&this.Ot.set(i,s)}}},nn,xu,Ni;function yp(t){var e=globalThis._posthogChunkIds;if(e){var r=Object.keys(e);return Ni&&r.length===xu||(xu=r.length,Ni=r.reduce(((n,i)=>{nn||(nn={});var s=nn[i];if(s)n[s[0]]=s[1];else for(var o=t(i),a=o.length-1;a>=0;a--){var u=o[a],c=u?.filename,l=e[i];if(c&&l){n[c]=l,nn[i]=[c,l];break}}return n}),{})),Ni}}var ys=class{constructor(e,r,n){n===void 0&&(n=[]),this.coercers=e,this.stackParser=r,this.modifiers=n}buildFromUnknown(e,r){r===void 0&&(r={});var n=r&&r.mechanism||{handled:!0,type:"generic"},i=this.buildCoercingContext(n,r,0).apply(e),s=this.buildParsingContext(r),o=this.parseStacktrace(i,s);return{$exception_list:this.convertToExceptionList(o,n),$exception_level:"error"}}modifyFrames(e){var r=this;return ne((function*(){for(var n of e)n.stacktrace&&n.stacktrace.frames&&O(n.stacktrace.frames)&&(n.stacktrace.frames=yield r.applyModifiers(n.stacktrace.frames));return e}))()}coerceFallback(e){var r;return{type:"Error",value:"Unknown error",stack:(r=e.syntheticException)==null?void 0:r.stack,synthetic:!0}}parseStacktrace(e,r){var n,i;return e.cause!=null&&(n=this.parseStacktrace(e.cause,r)),e.stack!=""&&e.stack!=null&&(i=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?r.skipFirstLines:0),r.chunkIdMap)),x({},e,{cause:n,stack:i})}applyChunkIds(e,r){return e.map((n=>(n.filename&&r&&(n.chunk_id=r[n.filename]),n)))}applyCoercers(e,r){for(var n of this.coercers)if(n.match(e))return n.coerce(e,r);return this.coerceFallback(r)}applyModifiers(e){var r=this;return ne((function*(){var n=e;for(var i of r.modifiers)n=yield i(n);return n}))()}convertToExceptionList(e,r){var n,i,s,o={type:e.type,value:e.value,mechanism:{type:(n=r.type)!==null&&n!==void 0?n:"generic",handled:(i=r.handled)===null||i===void 0||i,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,x({},r,{handled:!0}))),a}buildParsingContext(e){var r;return{chunkIdMap:yp(this.stackParser),skipFirstLines:(r=e.skipFirstLines)!==null&&r!==void 0?r:1}}buildCoercingContext(e,r,n){n===void 0&&(n=0);var i=(s,o)=>{if(4>=o){var a=this.buildCoercingContext(e,r,o);return this.applyCoercers(s,a)}};return x({},r,{syntheticException:n==0?r.syntheticException:void 0,mechanism:e,apply:s=>i(s,n),next:s=>i(s,n+1)})}},Yt="?";function bs(t,e,r,n,i){var s={platform:t,filename:e,function:r==="<anonymous>"?Yt:r,in_app:!0};return E(n)||(s.lineno=n),E(i)||(s.colno=i),s}var Oc=(t,e)=>{var r=t.indexOf("safari-extension")!==-1,n=t.indexOf("safari-web-extension")!==-1;return r||n?[t.indexOf("@")!==-1?t.split("@")[0]:Yt,r?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},bp=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,xp=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,wp=/\((\S*)(?::(\d+))(?::(\d+))\)/,kp=(t,e)=>{var r=bp.exec(t);if(r)return bs(e,r[1],Yt,+r[2],+r[3]);var n=xp.exec(t);if(n){if(n[2]&&n[2].indexOf("eval")===0){var i=wp.exec(n[2]);i&&(n[2]=i[1],n[3]=i[2],n[4]=i[3])}var s=Oc(n[1]||Yt,n[2]);return bs(e,s[1],s[0],n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}},Ep=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,$p=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Sp=(t,e)=>{var r=Ep.exec(t);if(r){if(r[3]&&r[3].indexOf(" > eval")>-1){var n=$p.exec(r[3]);n&&(r[1]=r[1]||"eval",r[3]=n[1],r[4]=n[2],r[5]="")}var i=r[3],s=r[1]||Yt,o=Oc(s,i);return bs(e,i=o[1],s=o[0],r[4]?+r[4]:void 0,r[5]?+r[5]:void 0)}},wu=/\(error: (.*)\)/,xs=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,r){var n=H(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:n?e.stack:void 0,cause:e.cause?r.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var r=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?r+": "+e.message:r}isDOMException(e){return bn(e,"DOMException")}isDOMError(e){return bn(e,"DOMError")}},ws=class{match(e){return(r=>r instanceof Error)(e)}coerce(e,r){return{type:this.getType(e),value:this.getMessage(e,r),stack:this.getStack(e),cause:e.cause?r.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,r){var n=e.message;return String(n.error&&typeof n.error.message=="string"?n.error.message:n)}getStack(e){return e.stacktrace||e.stack||void 0}},ks=class{constructor(){}match(e){return bn(e,"ErrorEvent")&&e.error!=null}coerce(e,r){var n;return r.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:(n=r.syntheticException)==null?void 0:n.stack,synthetic:!0}}},Pp=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Es=class{match(e){return typeof e=="string"}coerce(e,r){var n,i=this.getInfos(e),s=i[0],o=i[1];return{type:s??"Error",value:o??e,stack:(n=r.syntheticException)==null?void 0:n.stack,synthetic:!0}}getInfos(e){var r="Error",n=e,i=e.match(Pp);return i&&(r=i[1],n=i[2]),[r,n]}},Tp=["fatal","error","warning","log","info","debug"];function Mc(t,e){e===void 0&&(e=40);var r=Object.keys(t);if(r.sort(),!r.length)return"[object has no keys]";for(var n=r.length;n>0;n--){var i=r.slice(0,n).join(", ");if(e>=i.length)return n===r.length?i:i.length>e?i.slice(0,e)+"...":i}return""}var $s=class{match(e){return typeof e=="object"&&e!==null}coerce(e,r){var n,i=this.getErrorPropertyFromObject(e);return i?r.apply(i):{type:this.getType(e),value:this.getValue(e),stack:(n=r.syntheticException)==null?void 0:n.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return ko(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){var r="'"+e.name+"' captured as exception";return"message"in e&&typeof e.message=="string"&&(r+=" with message: '"+e.message+"'"),r}if("message"in e&&typeof e.message=="string")return e.message;var n=this.getObjectClassName(e);return(n&&n!=="Object"?"'"+n+"'":"Object")+" captured as exception with keys: "+Mc(e)}isSeverityLevel(e){return H(e)&&!ps(e)&&Tp.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var r in e)if({}.hasOwnProperty.call(e,r)){var n=e[r];if(fp(n))return n}}getObjectClassName(e){try{var r=Object.getPrototypeOf(e);return r?r.constructor.name:void 0}catch{return}}},Ss=class{match(e){return ko(e)}coerce(e,r){var n,i=e.constructor.name;return{type:i,value:i+" captured as exception with keys: "+Mc(e),stack:(n=r.syntheticException)==null?void 0:n.stack,synthetic:!0}}},Ps=class{match(e){return cc(e)}coerce(e,r){var n;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(n=r.syntheticException)==null?void 0:n.stack,synthetic:!0}}},Ts=class{match(e){return bn(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!ko(e))return!1;try{var r=e.detail;return r!=null&&typeof r=="object"&&"reason"in r}catch{return!1}}coerce(e,r){var n,i=this.getUnhandledRejectionReason(e);return cc(i)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(i),stack:(n=r.syntheticException)==null?void 0:n.stack,synthetic:!0}:r.apply(i)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&e.detail!=null&&typeof e.detail=="object"&&"reason"in e.detail)return e.detail.reason}catch{}return e}},Sn="$message",Pn="$timestamp",zp=new Set([Sn,Pn]),Di={enabled:!0,max_bytes:32768};function Tn(t){var e;return t?{enabled:(e=t.enabled)!==null&&e!==void 0?e:Di.enabled,max_bytes:Rp(t.max_bytes,Di.max_bytes)}:x({},Di)}var zs=class{constructor(e){this.Vt=[],this.Wt=0,this.Te=Tn(e)}setConfig(e){this.Te=Tn(e),this.Zt()}add(e){var r=(function(i){var s;try{s=oc(i)}catch{return}try{var o=JSON.parse(s);if(!Y(o))return;var a=o,u=a[Sn],c=a[Pn];return!H(u)||u.trim().length===0||!H(c)&&!de(c)?void 0:{step:a,json:s}}catch{return}})(e);if(r){var n=(function(i){if(typeof TextEncoder<"u")return new TextEncoder().encode(i).length;for(var s=encodeURIComponent(i),o=0,a=0;s.length>a;a++)s[a]==="%"?(o+=1,a+=2):o+=1;return o})(r.json);n>this.Te.max_bytes||(this.Vt.push({step:r.step,bytes:n}),this.Wt+=n,this.Zt())}}getAttachable(){return this.Vt.map((e=>e.step))}clear(){this.Vt=[],this.Wt=0}size(){return this.Vt.length}Zt(){for(;this.Wt>this.Te.max_bytes&&this.Vt.length>0;){var e=this.Vt.shift();e&&(this.Wt-=e.bytes)}}};function Rp(t,e){if(!de(t)||t===1/0||t===-1/0)return e;var r=Math.floor(t);return 0>r?e:r}var Fc=function(t,e){var r=(e===void 0?{}:e).debugEnabled,n={k(i){if(_&&(j.DEBUG||_.POSTHOG_DEBUG||r)&&!E(_.console)&&_.console){for(var s=("__rrweb_original__"in _.console[i])?_.console[i].__rrweb_original__:_.console[i],o=arguments.length,a=new Array(o>1?o-1:0),u=1;o>u;u++)a[u-1]=arguments[u];s(t,...a)}},debug(){for(var i=arguments.length,s=new Array(i),o=0;i>o;o++)s[o]=arguments[o];n.k("debug",...s)},info(){for(var i=arguments.length,s=new Array(i),o=0;i>o;o++)s[o]=arguments[o];n.k("log",...s)},warn(){for(var i=arguments.length,s=new Array(i),o=0;i>o;o++)s[o]=arguments[o];n.k("warn",...s)},error(){for(var i=arguments.length,s=new Array(i),o=0;i>o;o++)s[o]=arguments[o];n.k("error",...s)},critical(){for(var i=arguments.length,s=new Array(i),o=0;i>o;o++)s[o]=arguments[o];console.error(t,...s)},uninitializedWarning(i){n.error("You must initialize PostHog before calling "+i)},createLogger:(i,s)=>Fc(t+" "+i,s)};return n},$=Fc("[PostHog.js]"),X=$.createLogger,Cp=X("[ExternalScriptsLoader]"),ji=(t,e,r)=>{if(t.config.disable_external_dependency_loading)return Cp.warn(e+" was requested but loading of external scripts is disabled."),r("Loading of external scripts is disabled");var n=P?.querySelectorAll("script");if(n){for(var i,s=function(){if(n[o].src===e){var u=n[o];return u.__posthog_loading_callback_fired?{v:r()}:(u.addEventListener("load",(c=>{u.__posthog_loading_callback_fired=!0,r(void 0,c)})),u.onerror=c=>r(c),{v:void 0})}},o=0;n.length>o;o++)if(i=s())return i.v}var a=()=>{if(!P)return r("document not found");var u=P.createElement("script");if(u.type="text/javascript",u.crossOrigin="anonymous",u.src=e,u.onload=d=>{u.__posthog_loading_callback_fired=!0,r(void 0,d)},u.onerror=d=>r(d),t.config.prepare_external_dependency_script&&(u=t.config.prepare_external_dependency_script(u)),!u)return r("prepare_external_dependency_script returned null");if(t.config.external_scripts_inject_target==="head")P.head.appendChild(u);else{var c,l=P.querySelectorAll("body > script");l.length>0?(c=l[0].parentNode)==null||c.insertBefore(u,l[0]):P.body.appendChild(u)}};P!=null&&P.body?a():P?.addEventListener("DOMContentLoaded",a)};C.__PosthogExtensions__=C.__PosthogExtensions__||{},C.__PosthogExtensions__.loadExternalDependency=(t,e,r)=>{if(e!=="remote-config"){var n;if(t.config.strict_script_versioning)n=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+e+".js");else{var i="/static/"+e+".js?v="+t.version;if(e==="toolbar"){var s=3e5;i=i+"&t="+Math.floor(Date.now()/s)*s}n=t.requestRouter.endpointFor("assets",i)}ji(t,n,r)}else{var o=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");ji(t,o,r)}},C.__PosthogExtensions__.loadSiteApp=(t,e,r)=>{var n=t.requestRouter.endpointFor("api",e);ji(t,n,r)};j.DEBUG=!1,j.LIB_VERSION="1.407.6",j.LIB_NAME="web";var Lc="$people_distinct_id",zn="$device_id",Ui="$device_model",kr="__alias",Er="__timers",Rs="$autocapture_disabled_server_side",Cs="$heatmaps_enabled_server_side",Is="$exception_capture_enabled_server_side",As="$error_tracking_suppression_rules",Os="$error_tracking_capture_extension_exceptions",Ms="$web_vitals_enabled_server_side",To="$dead_clicks_enabled_server_side",zo="$product_tours_enabled_server_side",Fs="$web_vitals_allowed_metrics",It="$session_recording_remote_config",Zc="$replay_sample_rate",Nc="$replay_override_sampling",Dc="$replay_override_linked_flag",jc="$replay_override_url_trigger",Uc="$replay_override_event_trigger",Gt="$sesid",Ro="$session_is_sampled",Ct="$enabled_feature_flags",fn="$active_feature_flags",$r="$early_access_features",Ls="$feature_flag_details",gn="$feature_flag_payloads",Zs="$feature_flag_request_id",Rn="$minimal_flag_called_events",tt="$override_feature_flags",Ut="$override_feature_flag_payloads",Tt="$stored_person_properties",zt="$stored_group_properties",Ns="$surveys",Cn="$surveys_loaded_at",Ds="$surveys_activated",_n="$surveys_activated_session",Sr="ph_product_tours",zr="$flag_call_reported",js="$flag_call_reported_session_id",Us="$feature_flag_errors",Fr="$feature_flag_evaluated_at",Le="$user_state",Hs="$client_session_props",Bs="$capture_rate_limit",Gs="$initial_campaign_params",Vs="$initial_referrer_info",In="$initial_person_info",An="$epp",sn="$posthog_cookieless",Hc="$cookieless_mode",Bc="$sdk_debug_extensions_init_method",Gc="$sdk_debug_extensions_init_time_ms",Vc="$sdk_debug_recording_script_not_loaded",Co="PostHog loadExternalDependency extension not found.",Rt="on_reject",it="always",Zt="anonymous",Nt="identified",qs="identified_only",On="visibilitychange",Mn="beforeunload",Ht="$pageview",Hi="$pageleave",Bi="$identify",ku="$groupidentify";function on(t,e){O(t)&&t.forEach(e)}function B(t,e){if(!F(t))if(O(t))t.forEach(e);else if(Qh(t))t.forEach(((n,i)=>e(n,i)));else for(var r in t)uc.call(t,r)&&e(t[r],r)}var K=function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;e>n;n++)r[n-1]=arguments[n];for(var i of r)for(var s in i)i[s]!==void 0&&(t[s]=i[s]);return t};function vn(t){for(var e=Object.keys(t),r=e.length,n=new Array(r);r--;)n[r]=[e[r],t[e[r]]];return n}var Eu=function(t){try{return t()}catch{return}},Ip=function(t){return function(){try{for(var e=arguments.length,r=new Array(e),n=0;e>n;n++)r[n]=arguments[n];return t.apply(this,r)}catch(i){$.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),$.critical(i)}}},Io=function(t){var e={};return B(t,(function(r,n){(H(r)&&r.length>0||de(r))&&(e[n]=r)})),e},Ap=["herokuapp.com","vercel.app","netlify.app"];function Op(t){var e=t?.hostname;if(!H(e))return!1;var r=e.split(".").slice(-2).join(".");for(var n of Ap)if(r===n)return!1;return!0}function re(t,e,r,n){var i=n??{},s=i.capture,o=i.passive;t?.addEventListener(e,r,{capture:s!==void 0&&s,passive:o===void 0||o})}function qc(t){return t.name==="ph_toolbar_internal"}var Kc=t=>{if(P){try{for(var e=t+"=",r=P.cookie.split(";").filter((s=>s.length)),n=0;r.length>n;n++){for(var i=r[n];i.charAt(0)==" ";)i=i.substring(1,i.length);if(i.indexOf(e)===0)return decodeURIComponent(i.substring(e.length,i.length))}}catch{}return null}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return de(t)&&isFinite(t)&&Math.floor(t)===t});var Ks=class t{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,r,n,i){if(!Number.isInteger(e)||!Number.isInteger(r)||!Number.isInteger(n)||!Number.isInteger(i)||0>e||0>r||0>n||0>i||e>0xffffffffffff||r>4095||n>1073741823||i>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/256,s[5]=e,s[6]=112|r>>>8,s[7]=r,s[8]=128|n>>>24,s[9]=n>>>16,s[10]=n>>>8,s[11]=n,s[12]=i>>>24,s[13]=i>>>16,s[14]=i>>>8,s[15]=i,new t(s)}toString(){for(var e="",r=0;this.bytes.length>r;r++)e=e+(this.bytes[r]>>>4).toString(16)+(15&this.bytes[r]).toString(16),r!==3&&r!==5&&r!==7&&r!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new t(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var r=0;16>r;r++){var n=this.bytes[r]-e.bytes[r];if(n!==0)return Math.sign(n)}return 0}},Ws=class{generate(){var e=this.generateOrAbort();if(!E(e))return e;this.S=0;var r=this.generateOrAbort();if(E(r))throw new Error("Could not generate UUID after timestamp reset");return r}generateOrAbort(){var e=Date.now();if(e>this.S)this.S=e,this.C();else{if(this.S>=e+1e4)return;this.I++,this.I>4398046511103&&(this.S++,this.C())}return Ks.fromFieldsV7(this.S,Math.trunc(this.I/Math.pow(2,30)),this.I&Math.pow(2,30)-1,this.M.nextUint32())}C(){this.I=1024*this.M.nextUint32()+(1023&this.M.nextUint32())}constructor(){this.S=0,this.I=0,this.M=new Js}},$u,Wc=t=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};_&&!E(_.crypto)&&crypto.getRandomValues&&(Wc=t=>crypto.getRandomValues(t));var Js=class{nextUint32(){return this.R.length>this.O||(Wc(this.R),this.O=0),this.R[this.O++]}constructor(){this.R=new Uint32Array(8),this.O=1/0}},nt=()=>Mp().toString(),Mp=()=>($u||($u=new Ws)).generate(),pr="",Fp=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,st={N:()=>!!P,D(t){$.error("cookieStore error: "+t)},A:Kc,F(t){var e;try{e=JSON.parse(st.A(t))||{}}catch{}return e},q(t,e,r,n,i){if(!P)return!1;try{var s="",o="",a=(function(l,d){if(d){var h=(function(p,g){if(g===void 0&&(g=P),pr)return pr;if(!g||["localhost","127.0.0.1"].includes(p))return"";for(var m=p.split("."),v=Math.min(m.length,8),w="dmn_chk_"+nt();!pr&&v--;){var y=m.slice(v).join("."),k=w+"=1;domain=."+y+";path=/";g.cookie=k+";max-age=3",g.cookie.includes(w)&&(g.cookie=k+";max-age=0",pr=y)}return pr})(l);if(!h){var f=(p=>{var g=p.match(Fp);return g?g[0]:""})(l);f!==h&&$.info("Warning: cookie subdomain discovery mismatch",f,h),h=f}return h?"; domain=."+h:""}return""})(P.location.hostname,n);if(r){var u=new Date;u.setTime(u.getTime()+864e5*r),s="; expires="+u.toUTCString()}i&&(o="; secure");var c=t+"="+encodeURIComponent(JSON.stringify(e))+s+"; SameSite=Lax; path=/"+a+o;return c.length>3686.4&&$.warn("cookieStore warning: large cookie, len="+c.length),P.cookie=c,!0}catch{return!1}},P(t,e){if(P!=null&&P.cookie)try{st.q(t,"",-1,e)}catch{return}}},Gi=null,V={N(){if(!me(Gi))return Gi;var t=!0;if(E(_))t=!1;else try{var e="__mplssupport__";V.q(e,"xyz"),V.A(e)!=='"xyz"'&&(t=!1),V.P(e)}catch{t=!1}return t||$.error("localStorage unsupported; falling back to cookie store"),Gi=t,t},D(t){$.error("localStorage error: "+t)},A(t){try{return _?.localStorage.getItem(t)}catch(e){V.D(e)}return null},F(t){try{return JSON.parse(V.A(t))||{}}catch{}return null},q(t,e){try{return _?.localStorage.setItem(t,JSON.stringify(e)),!0}catch(r){V.D(r)}return!1},P(t){try{_?.localStorage.removeItem(t)}catch(e){V.D(e)}}},Lp=[zn,"distinct_id",Gt,Ro,An,In,Le],an={},Zp={N:()=>!0,D(t){$.error("memoryStorage error: "+t)},A:t=>an[t]||null,F:t=>an[t]||null,q:(t,e)=>(an[t]=e,!0),P(t){delete an[t]}},wt=null,le={N(){if(!me(wt))return wt;if(wt=!0,E(_))wt=!1;else try{var t="__support__";le.q(t,"xyz"),le.A(t)!=='"xyz"'&&(wt=!1),le.P(t)}catch{wt=!1}return wt},D(t){$.error("sessionStorage error: ",t)},A(t){try{return _?.sessionStorage.getItem(t)}catch(e){le.D(e)}return null},F(t){try{return JSON.parse(le.A(t))||null}catch{}return null},q(t,e){try{return _?.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch(r){le.D(r)}return!1},P(t){try{_?.sessionStorage.removeItem(t)}catch(e){le.D(e)}}},Ys=class{constructor(e){this._instance=e}get Te(){return this._instance.config}get consent(){return this.Gt()?0:this.Qt}isOptedOut(){return this.Te.cookieless_mode===it||this.isRejected()||this.consent===-1&&this.Te.cookieless_mode===Rt}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Te.opt_out_capturing_by_default}optInOut(e){this.Jt.q(this.Kt,e?1:0,this.Te.cookie_expiration,this.Te.cross_subdomain_cookie,this.Te.secure_cookie)}reset(){this.Jt.P(this.Kt,this.Te.cross_subdomain_cookie)}get Kt(){var e=this._instance.config,r=e.token,n=e.opt_out_capturing_cookie_prefix;return e.consent_persistence_name||(n?n+r:"__ph_opt_in_out_"+r)}get Qt(){var e=this.Jt.A(this.Kt);return Fi(e)?1:A(np,e)?0:-1}get Jt(){var e=this.Te.opt_out_capturing_persistence_type,r=e==="localStorage"?V:st;if(!this.Yt||this.Yt!==r){this.Yt=r;var n=e==="localStorage"?st:V;n.A(this.Kt)&&(this.Yt.A(this.Kt)||this.optInOut(Fi(n.A(this.Kt))),n.P(this.Kt,this.Te.cross_subdomain_cookie))}return this.Yt}Gt(){return!!this.Te.respect_dnt&&[_e?.doNotTrack,_e?.msDoNotTrack,C.doNotTrack].some((e=>Fi(e)))}};function Jc(t,e){var r,n=t==null||(r=t.config)==null?void 0:r.get_current_url;if(!Ze(n))return e;try{var i=n(e);return H(i)&&i?i:e}catch(s){return $.error("Error in get_current_url, falling back to window.location.href",s),e}}var Yc="__POSTHOG_TOOLBAR__",Np=1,Dp=3,jp=11;function Su(t){return t instanceof Element&&(t.id===Yc||!(t.closest==null||!t.closest(".toolbar-global-fade-container")))}function gt(t){return!!t&&t.nodeType===Np}function $e(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function Xc(t){return!!t&&t.nodeType===Dp}function Qc(t){return!!t&&t.nodeType===jp&>(t.host)}var el=1e3;function Ao(t){return t?Jn(t).split(/\s+/):[]}function Pu(t,e){var r=(function(n){var i,s=_==null||(i=_.location)==null?void 0:i.href;return E(s)?void 0:Jc(n,s)})(e);return!!(r&&t&&t.some((n=>r.match(n))))}function Fn(t){var e="";switch(typeof t.className){case"string":e=t.className;break;case"object":e=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:e=""}return Ao(e)}function tl(t){return F(t)?null:Jn(t).split(/(\s+)/).filter((e=>Rr(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Lr(t){var e="";return Qs(t)&&!sl(t)&&t.childNodes&&t.childNodes.length&&B(t.childNodes,(function(r){var n;Xc(r)&&r.textContent&&(e+=(n=tl(r.textContent))!==null&&n!==void 0?n:"")})),Jn(e)}function Vi(t){var e;return E(t.target)?t.srcElement||null:(e=t.target)!=null&&e.shadowRoot?t.composedPath()[0]||null:t.target||null}var Oo=["a","button","form","input","select","textarea","label"];function Xs(t,e){if(E(e))return!0;var r,n=function(s){if(e.some((o=>(function(a,u){var c=a.matches||a.matchesSelector||a.msMatchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.oMatchesSelector;try{return!!c&&c.call(a,u)}catch{return!1}})(s,o))))return{v:!0}};for(var i of t)if(r=n(i))return r.v;return!1}function rl(t){var e=t.parentNode;return!(!e||!gt(e))&&e}var Up=[".ph-no-autocapture","[data-ph-no-autocapture]"],nl=["next","previous","prev",">","<"],Hp=[...nl,"+","-","\u2212","\u2013"],Tu=(t,e)=>/[a-z0-9]/i.test(e)?t.includes(e):t===e,zu=[".ph-no-rageclick",".ph-no-capture"],Bp=["","text","search","email","password","url","tel","number"];function Ru(t,e){if(!_||Mo(t))return!1;var r,n,i,s,o;if(Ne(e)?(r=!!e&&zu,n=void 0,i=!1):(r=(s=e?.css_selector_ignorelist)!==null&&s!==void 0?s:zu,n=e?.content_ignorelist,i=(o=e?.ignore_text_selection)!==null&&o!==void 0&&o),r===!1||i&&(function(u){return!(!u||!gt(u))&&(!!$e(u,"textarea")||($e(u,"input")?A(Bp,(u.getAttribute("type")||"").toLowerCase()):(function(c){if(c.isContentEditable)return!0;var l=c.getAttribute==null?void 0:c.getAttribute("contenteditable");return l==="true"||l===""})(u)))})(t))return!1;var a=il(t,!1).targetElementList;return!(function(u,c){if(u===!1||E(u))return!1;var l;if(u===!0)l=nl;else{if(!O(u))return!1;if(u.length>10)return $.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;l=u.map((d=>d.toLowerCase()))}return c.some((d=>{var h=d.safeText,f=d.ariaLabel;return l.some((p=>Tu(h,p)||Tu(f,p)))}))})(n,a.map((u=>{var c;return{safeText:Lr(u).toLowerCase(),ariaLabel:((c=u.getAttribute("aria-label"))==null?void 0:c.toLowerCase().trim())||""}})))&&!Xs(a,r)}var Mo=t=>!t||$e(t,"html")||!gt(t),il=(t,e)=>{if(!_||Mo(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var r=!1,n=[t],i=t;i.parentNode&&!$e(i,"body");)if(Qc(i.parentNode))n.push(i.parentNode.host),i=i.parentNode.host;else{var s=rl(i);if(!s)break;if(e||Oo.indexOf(s.tagName.toLowerCase())>-1)r=!0;else try{var o=_.getComputedStyle(s);o&&o.getPropertyValue("cursor")==="pointer"&&(r=!0)}catch{}n.push(s),i=s}return{parentIsUsefulElement:r,targetElementList:n}};function Qs(t){for(var e=new Set,r=0,n=t;n.parentNode&&!$e(n,"body");n=n.parentNode){if(r++>=el||e.has(n))return!1;e.add(n);var i=Fn(n);if(A(i,"ph-sensitive")||A(i,"ph-no-capture"))return!1}if(A(Fn(t),"ph-include"))return!0;var s=t.type||"";if(H(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}var o=t.name||t.id||"";return!H(o)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(o.replace(/[^a-zA-Z0-9]/g,""))}function sl(t){return!!($e(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||$e(t,"select")||$e(t,"textarea")||t.getAttribute("contenteditable")==="true")}var ol="(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})",Gp=new RegExp("^(?:"+ol+")$"),Vp=new RegExp(ol),al="\\d{3}-?\\d{2}-?\\d{4}",qp=new RegExp("^("+al+")$"),Kp=new RegExp("("+al+")");function Rr(t,e){return e===void 0&&(e=!0),!(F(t)||H(t)&&(t=Jn(t),(e?Gp:Vp).test((t||"").replace(/[- ]/g,""))||(e?qp:Kp).test(t)))}function Cu(t){var e=Lr(t);return Rr(e=(e+" "+ul(t)).trim())?e:""}function ul(t){var e="";return t&&t.childNodes&&t.childNodes.length&&B(t.childNodes,(function(r){var n;if(r&&((n=r.tagName)==null?void 0:n.toLowerCase())==="span")try{var i=Lr(r);e=(e+" "+i).trim(),r.childNodes&&r.childNodes.length&&(e=(e+" "+ul(r)).trim())}catch(s){$.error("[AutoCapture]",s)}})),e}function Iu(t){return t.replace(/"|\\"/g,'\\"')}function Wp(t){var e=t.attr__class;if(e)return O(e)?e:Ao(e)}var un=X("[Dead Clicks]"),Jp=()=>!0,Yp=t=>{var e,r=!((e=t.instance.persistence)==null||!e.get_property(To)),n=t.instance.config.capture_dead_clicks;return Ne(n)?n:!!Y(n)||r},Ln=class{get lazyLoadedDeadClicksAutocapture(){return this.Xt}constructor(e,r,n){this.instance=e,this.isEnabled=r,this.onCapture=n,this.startIfEnabledOrStop()}onRemoteConfig(e){if(e.ok){var r=e.config;"captureDeadClicks"in r&&(this.instance.persistence&&this.instance.persistence.register({[To]:r.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.er((()=>{this.tr()})):this.stop()}er(e){var r,n;(r=C.__PosthogExtensions__)!=null&&r.initDeadClicksAutocapture?e():(n=C.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this.instance,"dead-clicks-autocapture",(i=>{i?un.error("failed to load script",i):e()}))}tr(){var e;if(P){if(!this.Xt&&(e=C.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var r=Y(this.instance.config.capture_dead_clicks)?x({},this.instance.config.capture_dead_clicks):{};r.__onCapture=this.onCapture,this.onCapture&&(r.capture_dead_swipes=!1),this.Xt=C.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,r),this.Xt.start(P),un.info("starting...")}}else un.error("`document` not found. Cannot start.")}stop(){this.Xt&&(this.Xt.stop(),this.Xt=void 0,un.info("stopping..."))}},qi=X("[SegmentIntegration]"),cl="posthog-js";function ll(t,e){var r=e===void 0?{}:e,n=r.organization,i=r.projectId,s=r.prefix,o=r.severityAllowList,a=o===void 0?["error"]:o,u=r.sendExceptionsToPostHog,c=u===void 0||u;return l=>{var d,h,f,p,g;if(a!=="*"&&!a.includes(l.level)||!t.__loaded)return l;l.tags||(l.tags={});var m=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());l.tags["PostHog Person URL"]=m,t.sessionRecordingStarted()&&(l.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var v,w=((d=l.exception)==null?void 0:d.values)||[],y=w.map((T=>x({},T,{stacktrace:T.stacktrace?x({},T.stacktrace,{type:"raw",frames:(T.stacktrace.frames||[]).map((M=>x({},M,{platform:"web:javascript"})))}):void 0}))),k={$exception_message:((h=w[0])==null?void 0:h.value)||l.message,$exception_type:(f=w[0])==null?void 0:f.type,$exception_level:l.level,$exception_list:y,$sentry_event_id:l.event_id,$sentry_exception:l.exception,$sentry_exception_message:((p=w[0])==null?void 0:p.value)||l.message,$sentry_exception_type:(g=w[0])==null?void 0:g.type,$sentry_tags:l.tags};return n&&i&&(k.$sentry_url=(s||"https://sentry.io/organizations/")+n+"/issues/?project="+i+"&query="+l.event_id),c&&((v=t.exceptions)==null||v.sendExceptionEvent(k)),l}}var eo=class{constructor(e,r,n,i,s,o){this.name=cl,this.setupOnce=function(a){a(ll(e,{organization:r,projectId:n,prefix:i,severityAllowList:s,sendExceptionsToPostHog:o==null||o}))}}},Zn=class{constructor(e){this.rr=(r,n,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&($.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:r,changeReason:i}),this.ir=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.nr()}nr(){var e;this.sr=(e=this._instance.sessionManager)==null?void 0:e.onSessionId(this.rr)}destroy(){var e;(e=this.sr)==null||e.call(this),this.sr=void 0}doPageView(e,r){var n,i=this.ar(e,r);return this.ir={pathname:(n=_?.location.pathname)!==null&&n!==void 0?n:"",pageViewId:r,timestamp:e},this._instance.scrollManager.resetContext(),i}doPageLeave(e){var r;return this.ar(e,(r=this.ir)==null?void 0:r.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.ir)==null?void 0:e.pageViewId}}ar(e,r){var n=this.ir;if(!n)return{$pageview_id:r};var i={$pageview_id:r,$prev_pageview_id:n.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var o=s.maxScrollHeight,a=s.lastScrollY,u=s.maxScrollY,c=s.maxContentHeight,l=s.lastContentY,d=s.maxContentY;if(!(E(o)||E(a)||E(u)||E(c)||E(l)||E(d))){o=Math.ceil(o),a=Math.ceil(a),u=Math.ceil(u),c=Math.ceil(c),l=Math.ceil(l),d=Math.ceil(d);var h=o>1?Ge(a/o,0,1,$):1,f=o>1?Ge(u/o,0,1,$):1,p=c>1?Ge(l/c,0,1,$):1,g=c>1?Ge(d/c,0,1,$):1;i=K(i,{$prev_pageview_last_scroll:a,$prev_pageview_last_scroll_percentage:h,$prev_pageview_max_scroll:u,$prev_pageview_max_scroll_percentage:f,$prev_pageview_last_content:l,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:d,$prev_pageview_max_content_percentage:g})}}return n.pathname&&(i.$prev_pageview_pathname=n.pathname),n.timestamp&&(i.$prev_pageview_duration=(e.getTime()-n.timestamp.getTime())/1e3),i}},Ki=["flags","surveys"],Xp={[Lc]:{exposure:"hidden"},[kr]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[Er]:{exposure:"hidden"},[Rs]:{exposure:"event"},[Cs]:{exposure:"hidden"},[Is]:{exposure:"event"},[As]:{exposure:"hidden"},[Os]:{exposure:"event"},[Ms]:{exposure:"event"},[To]:{exposure:"event"},[zo]:{exposure:"hidden"},[Fs]:{exposure:"event"},[It]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[Gt]:{exposure:"hidden"},[Ro]:{exposure:"event"},[Zc]:{exposure:"event",shouldSkipFromEventProperties:t=>me(t)},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},$sess_rec_flush_size:{exposure:"hidden"},[Ct]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(t,e)=>e(),transformToEventProperties(t){if(!Y(t))return{};for(var e={},r=Object.keys(t),n=0;r.length>n;n++)e["$feature/"+r[n]]=t[r[n]];return e}},[fn]:{exposure:"event",storageGroup:"flags"},[$r]:{exposure:"hidden"},[Ls]:{exposure:"hidden",storageGroup:"flags"},[gn]:{exposure:"event",storageGroup:"flags"},[Zs]:{exposure:"event",storageGroup:"flags",volatile:!0},[Rn]:{exposure:"hidden",storageGroup:"flags"},[tt]:{exposure:"event"},[Ut]:{exposure:"hidden"},[Tt]:{exposure:"hidden"},[zt]:{exposure:"hidden"},[Ns]:{exposure:"hidden",storageGroup:"surveys"},[Cn]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[Ds]:{exposure:"event"},[_n]:{exposure:"hidden"},[Sr]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$product_tours_activated_session:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[zr]:{exposure:"hidden"},[js]:{exposure:"hidden"},[Us]:{exposure:"hidden"},[Fr]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Le]:{exposure:"hidden"},[Hs]:{exposure:"hidden"},[Bs]:{exposure:"hidden"},[Gs]:{exposure:"hidden"},[Vs]:{exposure:"hidden"},[In]:{exposure:"hidden"},[An]:{exposure:"hidden"},[Nc]:{exposure:"event"},[Dc]:{exposure:"event"},[jc]:{exposure:"event"},[Uc]:{exposure:"event"},[Bc]:{exposure:"event"},[Gc]:{exposure:"event"},[Vc]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},Qp=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],kt=t=>{var e=Xp[t];if(e)return e;for(var r of Qp){var n=r[1];if(t.indexOf(r[0])===0)return n}},Vt=(t,e)=>{try{return JSON.stringify(t,((r,n)=>typeof n=="bigint"?n.toString():n),e)}catch{return oc(t)}},Nn=t=>{var e=P?.createElement("a");return E(e)?null:(e.href=t,e)},Xt=function(t,e){for(var r,n=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),i=0;n.length>i;i++){var s=n[i].split("=");if(s[0]===e){r=s;break}}if(!O(r)||2>r.length)return"";var o=r[1];try{o=decodeURIComponent(o)}catch{$.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Zr=function(t,e,r){if(!t||!e||!e.length)return t;for(var n=t.split("#"),i=n[1],s=(n[0]||"").split("?"),o=s[1],a=s[0],u=(o||"").split("&"),c=[],l=0;u.length>l;l++){var d=u[l].split("=");O(d)&&(e.includes(d[0])?c.push(d[0]+"="+r):c.push(u[l]))}var h=a;return o!=null&&(h+="?"+c.join("&")),i!=null&&(h+="#"+i),h},Dn=function(t,e){var r=t.match(new RegExp(e+"=([^&]*)"));return r?r[1]:null},dl=(t,e)=>t>=e&&nc(),hl=(t,e,r,n)=>{if(t===0){if(nc()){var i=e+1;return i===r&&n(),i}return e}return 0},cn="https?://(.*)",Qt=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],ef=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Qt],Nr="<masked>",tf=["li_fat_id"];function pl(t,e,r){if(!P)return{};var n,i=e?[...Qt,...r||[]]:[],s=fl(Zr(P.URL,i,Nr),t),o=(n={},B(tf,(function(a){var u=Kc(a);n[a]=u||null})),n);return K(o,s)}function fl(t,e){var r=ef.concat(e||[]),n={};return B(r,(function(i){var s=Xt(t,i);n[i]=s||null})),n}function gl(t){var e=(function(s){return s?s.search(cn+"google.([^/?]*)")===0?"google":s.search(cn+"bing.com")===0?"bing":s.search(cn+"yahoo.com")===0?"yahoo":s.search(cn+"duckduckgo.com")===0?"duckduckgo":null:null})(t),r=e!="yahoo"?"q":"p",n={};if(!me(e)){n.$search_engine=e;var i=P?Xt(P.referrer,r):"";i.length&&(n.ph_keyword=i)}return n}function Au(){return navigator.language||navigator.userLanguage}var jn="$direct";function _l(){return P?.referrer||jn}function vl(t,e,r){r===void 0&&(r=!1);var n=t?[...Qt,...e||[]]:[],i=r?ft(ie?.href):ie?.href,s=i?.substring(0,1e3);return{r:_l().substring(0,1e3),u:s?Zr(s,n,Nr):void 0}}function ml(t,e){var r;e===void 0&&(e=!1);var n=t.r,i=t.u,s=e?ft(i):i,o={$referrer:n,$referring_domain:n==null?void 0:n==jn?jn:(r=Nn(n))==null?void 0:r.host};if(s){o.$current_url=s;var a=Nn(s);o.$host=a?.host,o.$pathname=a?.pathname;var u=fl(s);K(o,u)}if(n){var c=gl(n);K(o,c)}return o}function yl(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function rf(){try{return new Date().getTimezoneOffset()}catch{return}}var nf={flags:Fr,surveys:Cn},sf=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Dt="main",Cr=class{constructor(e,r,n){if(n===void 0&&(n=!0),this.lr={},this.ur=!1,this.hr=!1,this.Te=e,this.dr=n,this.props={},this.cr=!1,this.vr=(s=>{var o="";return s.token&&(o=s.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),s.persistence_name?"ph_"+s.persistence_name:"ph_"+o+"_posthog"})(e),this.Jt=this.pr(e),this.hr=this.gr(e),this.load(),e.debug&&$.info("Persistence loaded",e.persistence,x({},this.props)),this.update_config(e,e,r),this.save(),_){var i=()=>this.flush();re(_,"beforeunload",i,{capture:!1}),re(_,"pagehide",i,{capture:!1})}}mr(){var e,r=(e=this.Te)==null?void 0:e.persistence_save_debounce_ms;return de(r)&&r>0?r:0}isDisabled(){return!!this.yr}pr(e){sf.indexOf(e.persistence.toLowerCase())===-1&&($.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var r,n=(function(o,a){o===void 0&&(o=[]),a===void 0&&(a=!1);var u=[...Lp,...o];return x({},V,{F(c){try{var l={};try{l=st.F(c)||{}}catch{}var d,h=JSON.parse(V.A(c)||"{}");if(a){var f={};for(var p in l){var g=l[p];me(g)||g===""||(f[p]=g)}d=K(h,f)}else d=K(l,h);return V.q(c,d),d}catch{}return null},q(c,l,d,h,f,p){var g=V.q(c,l,void 0,void 0,p);try{var m={};u.forEach((v=>{l[v]&&(m[v]=l[v])})),Object.keys(m).length&&st.q(c,m,d,h,f,p)}catch(v){V.D(v)}return g},P(c,l){try{_?.localStorage.removeItem(c),st.P(c,l)}catch(d){V.D(d)}}})})(e.cookie_persisted_properties||[],e.__preview_cookie_wins_on_conflict||!1),i=!1,s=e.persistence.toLowerCase();return s==="localstorage"&&V.N()?(r=V,i=!0):s==="localstorage+cookie"&&n.N()?(r=n,i=!0):s==="sessionstorage"&&le.N()?r=le:s==="memory"?r=Zp:s==="cookie"?r=st:n.N()?(r=n,i=!0):r=st,this.ur=i,r}br(e){return this.vr+"__"+e}gr(e){return this.ur&&!!e.split_storage}_r(e){var r=e??this.Te.feature_flag_cache_ttl_ms;if(!r||0>=r)return!1;var n=this.props[Fr];return!n||typeof n!="number"||Date.now()-n>r}properties(){var e={};return B(this.props,((r,n)=>{var i=kt(n);if(i?.exposure==="derived"){if(i.shouldSkipFromEventProperties!=null&&i.shouldSkipFromEventProperties(r,n===Ct?()=>this._r():()=>!1))return;i.transformToEventProperties&&K(e,i.transformToEventProperties(r))}else if(!i||i.exposure==="event"){if(i!=null&&i.shouldSkipFromEventProperties!=null&&i.shouldSkipFromEventProperties(r,(()=>!1)))return;e[n]=r}})),e}load(){if(!this.yr){var e=this.Jt.F(this.vr);e&&(this.props=K({},e)),this.hr&&this.wr()}}wr(){for(var e of Ki){var r=V.F(this.br(e));if(r&&!pt(r)){var n=this.kr(e);n.persisted=!0,this.Sr(e)||(n.fingerprint=this.Cr(r,e)),this.Tr(e,r)||K(this.props,r)}}}Sr(e){return Object.keys(this.props).some((r=>{var n;return((n=kt(r))==null?void 0:n.storageGroup)===e}))}Tr(e,r){var n=nf[e];if(!n)return!1;var i=r[n],s=this.props[n];return de(i)&&de(s)&&s>i}refreshKey(e){var r;if(!this.yr){var n=this.hr?(r=kt(e))==null?void 0:r.storageGroup:void 0,i=n?V.F(this.br(n)):this.Jt.F(this.vr);if(i&&e in i)this.Ir(e,i[e]);else{if(n){var s=this.Jt.F(this.vr);if(s&&e in s)return void this.Ir(e,s[e])}this.Mr(e)}}}save(){if(!this.yr){var e=this.mr();e>0?E(this.Er)&&(this.Er=setTimeout((()=>{this.Er=void 0,this.Rr()}),e)):this.Rr()}}flush(){E(this.Er)||(clearTimeout(this.Er),this.Er=void 0,this.Rr())}Rr(){this.yr||(this.hr?this.Pr():this.Or(this.Jt,this.vr,this.props,Dt))}Pr(){var e=this.Fr(),r=e.main,n=e.groups;for(var i of(this.Or(this.Jt,this.vr,r,Dt),Ki)){var s,o=n[i];(!pt(o)||(s=this.lr[i])!=null&&s.persisted)&&this.Or(V,this.br(i),o,i)}}Fr(){var e={},r={flags:{},surveys:{}};return B(this.props,((n,i)=>{var s,o=(s=kt(i))==null?void 0:s.storageGroup;o?r[o][i]=n:e[i]=n})),{main:e,groups:r}}Cr(e,r){if(r===Dt)return JSON.stringify(e)+"|"+this.Lr+"|"+this.$r+"|"+this.Ar;var n={};return B(e,((i,s)=>{var o;n[s]=(o=kt(s))!=null&&o.volatile?"__volatile__":i})),JSON.stringify(n)}Or(e,r,n,i){var s=this.kr(i);if(i===Dt||s.dirty||E(s.fingerprint)){var o;try{if((o=this.Cr(n,i))===s.fingerprint)return void(s.dirty=!1)}catch{o=void 0}e.q(r,n,this.Lr,this.$r,this.Ar,this.Te.debug)?(s.dirty=!1,i!==Dt&&(s.persisted=!0),E(o)||(s.fingerprint=o)):this.Te.debug&&$.warn('failed to persist storage entry "'+r+'"; will retry on next save')}}remove(e){var r=(e===void 0?{}:e).keepGroupEntries,n=r!==void 0&&r;if(E(this.Er)||(clearTimeout(this.Er),this.Er=void 0),this.Jt.P(this.vr,!1),this.Jt.P(this.vr,!0),!n&&this.dr)for(var i of Ki)V.P(this.br(i));n?delete this.lr[Dt]:this.lr={}}clear(){this.remove(),this.props={}}register_once(e,r,n){if(Y(e)){E(r)&&(r="None"),this.Lr=E(n)?this.Nr:n;var i=!1;if(B(e,((s,o)=>{this.props.hasOwnProperty(o)&&this.props[o]!==r||(this.Ir(o,s),i=!0)})),i)return this.save(),!0}return!1}register(e,r){if(Y(e)){this.Lr=E(r)?this.Nr:r;var n=!1;if(B(e,((i,s)=>{e.hasOwnProperty(s)&&this.props[s]!==i&&(this.Ir(s,i),n=!0)})),n)return this.save(),!0}return!1}unregister(e){e in this.props&&(this.Mr(e),this.save())}update_campaign_params(){if(!this.cr){var e=pl(this.Te.custom_campaign_params,this.Te.mask_personal_data_properties,this.Te.custom_personal_data_properties);pt(Io(e))||this.register(e),this.cr=!0}}update_search_keyword(){var e;this.register((e=P?.referrer)?gl(e):{})}update_referrer_info(){var e;this.register_once({$referrer:_l(),$referring_domain:P!=null&&P.referrer&&((e=Nn(P.referrer))==null?void 0:e.host)||jn},void 0)}set_initial_person_info(){this.props[Gs]||this.props[Vs]||this.register_once({[In]:vl(this.Te.mask_personal_data_properties,this.Te.custom_personal_data_properties,this.Te.disable_capture_url_hashes)},void 0)}get_initial_props(){var e={};B([Vs,Gs],(i=>{var s=this.props[i];s&&B(s,(function(o,a){e["$initial_"+hs(a)]=o}))}));var r=this.props[In];if(r){var n=(function(i,s){s===void 0&&(s=!1);var o=ml(i,s),a={};return B(o,(function(u,c){a["$initial_"+hs(c)]=u})),a})(r,this.Te.disable_capture_url_hashes);K(e,n)}return e}safe_merge(e){return B(this.props,(function(r,n){n in e||(e[n]=r)})),e}update_config(e,r,n){this.Nr=this.Lr=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!n),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie);var i=e.persistence!==r.persistence||!((u,c)=>{if(u.length!==c.length)return!1;var l=[...u].sort(),d=[...c].sort();return l.every(((h,f)=>h===d[f]))})(e.cookie_persisted_properties||[],r.cookie_persisted_properties||[]),s=i?this.pr(e):this.Jt,o=this.gr(e);if(i||o!==this.hr){var a=this.props;this.clear(),this.Jt=s,this.hr=o,this.props=a,this.save()}}set_disabled(e){this.yr=e,this.yr?this.remove():this.save()}set_cross_subdomain(e){e!==this.$r&&(this.$r=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.Ar&&(this.Ar=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,r){var n=this.props[Er]||{};n[e]=r,this.Ir(Er,n),this.save()}remove_event_timer(e){var r=this.props[Er]||{},n=r[e];return E(n)||(delete r[e],this.Ir(Er,r),this.save()),n}get_property(e){return this.props[e]}set_property(e,r){this.Ir(e,r),this.save()}Ir(e,r){var n;this.props[e]=r,(n=kt(e))!=null&&n.volatile||this.Dr(e)}Mr(e){delete this.props[e],this.Dr(e)}Dr(e){var r,n=(r=kt(e))==null?void 0:r.storageGroup;n&&(this.kr(n).dirty=!0)}kr(e){return this.lr[e]||(this.lr[e]={})}},ge={GZipJS:"gzip-js",Base64:"base64"},fr={Activation:"events",Cancellation:"cancelEvents"};var Wi={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"};var ot={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Ji={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date",SURVEY_LANGUAGE:"$survey_language"},to={Popover:"popover",Inline:"inline"};var of={SHOWN:"product tour shown",DISMISSED:"product tour dismissed",COMPLETED:"product tour completed",STEP_SHOWN:"product tour step shown",STEP_COMPLETED:"product tour step completed",BUTTON_CLICKED:"product tour button clicked",STEP_SELECTOR_FAILED:"product tour step selector failed",BANNER_CONTAINER_SELECTOR_FAILED:"product tour banner container selector failed",BANNER_ACTION_CLICKED:"product tour banner action clicked"},Ou={TOUR_ID:"$product_tour_id",TOUR_NAME:"$product_tour_name",TOUR_ITERATION:"$product_tour_iteration",TOUR_RENDER_REASON:"$product_tour_render_reason",TOUR_STEP_ID:"$product_tour_step_id",TOUR_STEP_ORDER:"$product_tour_step_order",TOUR_STEP_TYPE:"$product_tour_step_type",TOUR_DISMISS_REASON:"$product_tour_dismiss_reason",TOUR_BUTTON_TEXT:"$product_tour_button_text",TOUR_BUTTON_ACTION:"$product_tour_button_action",TOUR_BUTTON_LINK:"$product_tour_button_link",TOUR_BUTTON_TOUR_ID:"$product_tour_button_tour_id",TOUR_STEPS_COUNT:"$product_tour_steps_count",TOUR_STEP_SELECTOR:"$product_tour_step_selector",TOUR_STEP_SELECTOR_FOUND:"$product_tour_step_selector_found",TOUR_STEP_ELEMENT_TAG:"$product_tour_step_element_tag",TOUR_STEP_ELEMENT_ID:"$product_tour_step_element_id",TOUR_STEP_ELEMENT_CLASSES:"$product_tour_step_element_classes",TOUR_STEP_ELEMENT_TEXT:"$product_tour_step_element_text",TOUR_ERROR:"$product_tour_error",TOUR_MATCHES_COUNT:"$product_tour_matches_count",TOUR_FAILURE_PHASE:"$product_tour_failure_phase",TOUR_WAITED_FOR_ELEMENT:"$product_tour_waited_for_element",TOUR_WAIT_DURATION_MS:"$product_tour_wait_duration_ms",TOUR_BANNER_SELECTOR:"$product_tour_banner_selector",TOUR_LINKED_SURVEY_ID:"$product_tour_linked_survey_id",USE_MANUAL_SELECTOR:"$use_manual_selector",INFERENCE_DATA_PRESENT:"$inference_data_present",TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},Mu=X("[RateLimiter]"),ro=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=r=>{var n=r.text;if(n&&n.length)try{(JSON.parse(n).quota_limited||[]).forEach((i=>{Mu.info((i||"events")+" is quota limited."),this.serverLimits[i]=new Date().getTime()+6e4}))}catch(i){return void Mu.warn('could not rate limit - continuing. Error: "'+i?.message+'"',{text:n})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)==null?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)==null?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var r,n,i;e===void 0&&(e=!1);var s=this.captureEventsBurstLimit,o=this.captureEventsPerSecond,a=new Date().getTime(),u=(r=(n=this.instance.persistence)==null?void 0:n.get_property(Bs))!==null&&r!==void 0?r:{tokens:s,last:a};u.tokens+=(a-u.last)/1e3*o,u.last=a,u.tokens>s&&(u.tokens=s);var c=1>u.tokens;return c||e||(u.tokens=Math.max(0,u.tokens-1)),!c||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+o+" events per second and "+s+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=c,(i=this.instance.persistence)==null||i.set_property(Bs,u),{isRateLimited:c,remainingTokens:u.tokens}}isServerRateLimited(e){var r=this.serverLimits[e||"events"]||!1;return r!==!1&&new Date().getTime()<r}},gr=X("[RemoteConfig]"),Un=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=C._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}qr(e){var r,n;(r=C.__PosthogExtensions__)!=null&&r.loadExternalDependency?(n=C.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):e()}jr(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(r){e(r.json)}})}load(){try{if(this.remoteConfig)return gr.info("Using preloaded remote config",this.remoteConfig),this.Hr(this.remoteConfig),void this.Br();if(this._instance.Ur())return void gr.warn("Remote config is disabled. Falling back to local config.");this.qr((e=>{if(!e)return gr.info("No config found after loading remote JS config. Falling back to JSON."),void this.jr((r=>{this.Hr(r),this.Br()}));this.Hr(e),this.Br()}))}catch(e){gr.error("Error loading remote config",e)}}stop(){this.zr&&(clearInterval(this.zr),this.zr=void 0)}refresh(){!this._instance.Ur()&&P&&P.visibilityState!=="hidden"&&this._instance.reloadFeatureFlags()}Br(){var e;if(!this.zr){var r=(e=this._instance.config.remote_config_refresh_interval_ms)!==null&&e!==void 0?e:3e5;r!==0&&(this.zr=setInterval((()=>{this.refresh()}),r))}}Hr(e){var r;e||gr.error("Failed to fetch remote config from PostHog."),this._instance.Hr(e?{ok:!0,config:e}:{ok:!1}),e?.hasFeatureFlags!==!1&&(this._instance.config.advanced_disable_feature_flags_on_first_load||(r=this._instance.featureFlags)==null||r.ensureFlagsLoaded())}};var Ae=Uint8Array,ve=Uint16Array,er=Uint32Array,Fo=new Ae([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]),Lo=new Ae([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]),Fu=new Ae([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),bl=function(t,e){for(var r=new ve(31),n=0;31>n;++n)r[n]=e+=1<<t[n-1];var i=new er(r[30]);for(n=1;30>n;++n)for(var s=r[n];r[n+1]>s;++s)i[s]=s-r[n]<<5|n;return[r,i]},xl=bl(Fo,2),no=xl[1];xl[0][28]=258,no[258]=28;for(io=bl(Lo,0)[1],Hn=new ve(32768),W=0;32768>W;++W)Et=(43690&W)>>>1|(21845&W)<<1,Hn[W]=((65280&(Et=(61680&(Et=(52428&Et)>>>2|(13107&Et)<<2))>>>4|(3855&Et)<<4))>>>8|(255&Et)<<8)>>>1;var Et,io,Hn,W,Ir=function(t,e,r){for(var n=t.length,i=0,s=new ve(e);n>i;++i)++s[t[i]-1];var o,a=new ve(e);for(i=0;e>i;++i)a[i]=a[i-1]+s[i-1]<<1;if(r){o=new ve(1<<e);var u=15-e;for(i=0;n>i;++i)if(t[i])for(var c=i<<4|t[i],l=e-t[i],d=a[t[i]-1]++<<l,h=d|(1<<l)-1;h>=d;++d)o[Hn[d]>>>u]=c}else for(o=new ve(n),i=0;n>i;++i)o[i]=Hn[a[t[i]-1]++]>>>15-t[i];return o},Mt=new Ae(288);for(W=0;144>W;++W)Mt[W]=8;for(W=144;256>W;++W)Mt[W]=9;for(W=256;280>W;++W)Mt[W]=7;for(W=280;288>W;++W)Mt[W]=8;var Bn=new Ae(32);for(W=0;32>W;++W)Bn[W]=5;var af=Ir(Mt,9,0),uf=Ir(Bn,5,0),wl=function(t){return(t/8>>0)+(7&t&&1)},kl=function(t,e,r){(r==null||r>t.length)&&(r=t.length);var n=new(t instanceof ve?ve:t instanceof er?er:Ae)(r-e);return n.set(t.subarray(e,r)),n},Ye=function(t,e,r){var n=e/8>>0;t[n]|=r<<=7&e,t[n+1]|=r>>>8},_r=function(t,e,r){var n=e/8>>0;t[n]|=r<<=7&e,t[n+1]|=r>>>8,t[n+2]|=r>>>16},Yi=function(t,e){for(var r=[],n=0;t.length>n;++n)t[n]&&r.push({s:n,f:t[n]});var i=r.length,s=r.slice();if(!i)return[new Ae(0),0];if(i==1){var o=new Ae(r[0].s+1);return o[r[0].s]=1,[o,1]}r.sort((function(T,M){return T.f-M.f})),r.push({s:-1,f:25001});var a=r[0],u=r[1],c=0,l=1,d=2;for(r[0]={s:-1,f:a.f+u.f,l:a,r:u};l!=i-1;)a=r[r[d].f>r[c].f?c++:d++],u=r[c!=l&&r[d].f>r[c].f?c++:d++],r[l++]={s:-1,f:a.f+u.f,l:a,r:u};var h=s[0].s;for(n=1;i>n;++n)s[n].s>h&&(h=s[n].s);var f=new ve(h+1),p=so(r[l-1],f,0);if(p>e){n=0;var g=0,m=p-e,v=1<<m;for(s.sort((function(T,M){return f[M.s]-f[T.s]||T.f-M.f}));i>n;++n){var w=s[n].s;if(e>=f[w])break;g+=v-(1<<p-f[w]),f[w]=e}for(g>>>=m;g>0;){var y=s[n].s;e>f[y]?g-=1<<e-f[y]++-1:++n}for(;n>=0&&g;--n){var k=s[n].s;f[k]==e&&(--f[k],++g)}p=e}return[new Ae(f),p]},so=function(t,e,r){return t.s==-1?Math.max(so(t.l,e,r+1),so(t.r,e,r+1)):e[t.s]=r},Lu=function(t){for(var e=t.length;e&&!t[--e];);for(var r=new ve(++e),n=0,i=t[0],s=1,o=function(u){r[n++]=u},a=1;e>=a;++a)if(t[a]==i&&a!=e)++s;else{if(!i&&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(i),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(i);s=1,i=t[a]}return[r.subarray(0,n),e]},vr=function(t,e){for(var r=0,n=0;e.length>n;++n)r+=t[n]*e[n];return r},oo=function(t,e,r){var n=r.length,i=wl(e+2);t[i]=255&n,t[i+1]=n>>>8,t[i+2]=255^t[i],t[i+3]=255^t[i+1];for(var s=0;n>s;++s)t[i+s+4]=r[s];return 8*(i+4+n)},Zu=function(t,e,r,n,i,s,o,a,u,c,l){Ye(e,l++,r),++i[256];for(var d=Yi(i,15),h=d[0],f=d[1],p=Yi(s,15),g=p[0],m=p[1],v=Lu(h),w=v[0],y=v[1],k=Lu(g),T=k[0],M=k[1],R=new ve(19),b=0;w.length>b;++b)R[31&w[b]]++;for(b=0;T.length>b;++b)R[31&T[b]]++;for(var S=Yi(R,7),z=S[0],L=S[1],I=19;I>4&&!z[Fu[I-1]];--I);var Z,Q,G,N,q=c+5<<3,J=vr(i,Mt)+vr(s,Bn)+o,we=vr(i,h)+vr(s,g)+o+14+3*I+vr(R,z)+(2*R[16]+3*R[17]+7*R[18]);if(J>=q&&we>=q)return oo(e,l,t.subarray(u,u+c));if(Ye(e,l,1+(J>we)),l+=2,J>we){Z=Ir(h,f,0),Q=h,G=Ir(g,m,0),N=g;var Pe=Ir(z,L,0);for(Ye(e,l,y-257),Ye(e,l+5,M-1),Ye(e,l+10,I-4),l+=14,b=0;I>b;++b)Ye(e,l+3*b,z[Fu[b]]);l+=3*I;for(var ye=[w,T],ke=0;2>ke;++ke){var ee=ye[ke];for(b=0;ee.length>b;++b)Ye(e,l,Pe[oe=31&ee[b]]),l+=z[oe],oe>15&&(Ye(e,l,ee[b]>>>5&127),l+=ee[b]>>>12)}}else Z=af,Q=Mt,G=uf,N=Bn;for(b=0;a>b;++b)if(n[b]>255){var oe;_r(e,l,Z[257+(oe=n[b]>>>18&31)]),l+=Q[oe+257],oe>7&&(Ye(e,l,n[b]>>>23&31),l+=Fo[oe]);var ae=31&n[b];_r(e,l,G[ae]),l+=N[ae],ae>3&&(_r(e,l,n[b]>>>5&8191),l+=Lo[ae])}else _r(e,l,Z[n[b]]),l+=Q[n[b]];return _r(e,l,Z[256]),l+Q[256]},cf=new er([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),lf=(function(){for(var t=new er(256),e=0;256>e;++e){for(var r=e,n=9;--n;)r=(1&r&&3988292384)^r>>>1;t[e]=r}return t})(),Xi=function(t,e,r){for(;r;++e)t[e]=r,r>>>=8};function df(t,e){e===void 0&&(e={});var r=(function(){var d=4294967295;return{p(h){for(var f=d,p=0;h.length>p;++p)f=lf[255&f^h[p]]^f>>>8;d=f},d(){return 4294967295^d}}})(),n=t.length;r.p(t);var i,s,o,a,u,c=(a=10+((i=e).filename&&i.filename.length+1||0),u=8,(function(d,h,f,p,g,m){var v=d.length,w=new Ae(p+v+5*(1+Math.floor(v/7e3))+g),y=w.subarray(p,w.length-g),k=0;if(!h||8>v)for(var T=0;v>=T;T+=65535){var M=T+65535;v>M?k=oo(y,k,d.subarray(T,M)):(y[T]=!0,k=oo(y,k,d.subarray(T,v)))}else{for(var R=cf[h-1],b=R>>>13,S=8191&R,z=(1<<f)-1,L=new ve(32768),I=new ve(z+1),Z=Math.ceil(f/3),Q=2*Z,G=function(ri){return(d[ri]^d[ri+1]<<Z^d[ri+2]<<Q)&z},N=new er(25e3),q=new ve(288),J=new ve(32),we=0,Pe=0,ye=(T=0,0),ke=0,ee=0;v>T;++T){var oe=G(T),ae=32767&T,ce=I[oe];if(L[ae]=ce,I[oe]=ae,T>=ke){var ut=v-T;if((we>7e3||ye>24576)&&ut>423){k=Zu(d,y,0,N,q,J,Pe,ye,ee,T-ee,k),ye=we=Pe=0,ee=T;for(var fe=0;286>fe;++fe)q[fe]=0;for(fe=0;30>fe;++fe)J[fe]=0}var Oe=2,ct=0,be=S,Me=ae-ce&32767;if(ut>2&&oe==G(T-Me))for(var Ur=Math.min(b,ut)-1,tr=Math.min(32767,T),Hr=Math.min(258,ut);tr>=Me&&--be&&ae!=ce;){if(d[T+Oe]==d[T+Oe-Me]){for(var Te=0;Hr>Te&&d[T+Te]==d[T+Te-Me];++Te);if(Te>Oe){if(Oe=Te,ct=Me,Te>Ur)break;var Br=Math.min(Me,Te-2),rr=0;for(fe=0;Br>fe;++fe){var ti=T-Me+fe+32768&32767,Vo=ti-L[ti]+32768&32767;Vo>rr&&(rr=Vo,ce=ti)}}}Me+=(ae=ce)-(ce=L[ae])+32768&32767}if(ct){N[ye++]=268435456|no[Oe]<<18|io[ct];var qo=31&no[Oe],Ko=31&io[ct];Pe+=Fo[qo]+Lo[Ko],++q[257+qo],++J[Ko],ke=T+Oe,++we}else N[ye++]=d[T],++q[d[T]]}}k=Zu(d,y,!0,N,q,J,Pe,ye,ee,T-ee,k)}return kl(w,0,p+wl(k)+g)})(s=t,(o=e).level==null?6:o.level,o.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(s.length)))):12+o.mem,a,u)),l=c.length;return(function(d,h){var f=h.filename;if(d[0]=31,d[1]=139,d[2]=8,d[8]=2>h.level?4:h.level==9?2:0,d[9]=3,h.mtime!=0&&Xi(d,4,Math.floor(new Date(h.mtime||Date.now())/1e3)),f){d[3]=8;for(var p=0;f.length>=p;++p)d[p+10]=f.charCodeAt(p)}})(c,e),Xi(c,l-8,r.d()),Xi(c,l-4,n),c}var hf=!!cs||!!wo,El="text/plain",mn=!1,$l=(t,e)=>{var r=t.split("#"),n=r[1],i=r[0].split("?"),s=i[0],o=i[1];if(!o)return t;var a=o.split("&").filter((u=>u.split("=")[0]!==e)).join("&");return s+(a?"?"+a:"")+(n?"#"+n:"")},Zo=function(t,e,r){var n;r===void 0&&(r=!0);var i=t.split("?"),s=i[0],o=i[1],a=x({},e),u=(n=o?.split("&").map((l=>{var d,h=l.split("="),f=h[0],p=r&&(d=a[f])!==null&&d!==void 0?d:h[1];return delete a[f],f+"="+p})))!==null&&n!==void 0?n:[],c=(function(l,d){var h,f;d===void 0&&(d="&");var p=[];return B(l,(function(g,m){E(g)||E(m)||m==="undefined"||(h=encodeURIComponent((v=>v instanceof File)(g)?g.name:g.toString()),f=encodeURIComponent(m),p[p.length]=f+"="+h)})),p.join(d)})(a);return c&&u.push(c),u.length>0?s+"?"+u.join("&"):s},Qi=t=>{if(t.Vr)return t.Vr;var e=t.data,r=t.compression;if(e){if(r===ge.GZipJS){var n=df((function(a,u){var c=a.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(a);for(var l=new Ae(a.length+(a.length>>>1)),d=0,h=function(m){l[d++]=m},f=0;c>f;++f){if(d+5>l.length){var p=new Ae(d+8+(c-f<<1));p.set(l),l=p}var g=a.charCodeAt(f);128>g?h(g):2048>g?(h(192|g>>>6),h(128|63&g)):g>55295&&57344>g?(h(240|(g=65536+(1047552&g)|1023&a.charCodeAt(++f))>>>18),h(128|g>>>12&63),h(128|g>>>6&63),h(128|63&g)):(h(224|g>>>12),h(128|g>>>6&63),h(128|63&g))}return kl(l,0,d)})(Vt(e)),{mtime:0});return{contentType:El,body:n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength),estimatedSize:n.byteLength}}if(r===ge.Base64){var i=(function(a){return a&&btoa(encodeURIComponent(a).replace(/%([0-9A-F]{2})/g,((u,c)=>String.fromCharCode(parseInt(c,16)))))})(Vt(e)),s=(a=>"data="+encodeURIComponent(typeof a=="string"?a:Vt(a)))(i);return{contentType:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}var o=Vt(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},Sl=t=>{var e,r,n=()=>t.transport==="sendBeacon"?{url:Zo(t.url,{compression:ge.Base64}),encodedBody:Qi(x({},t,{compression:ge.Base64,Vr:void 0}))}:{url:$l(t.url,"compression"),encodedBody:Qi(x({},t,{compression:void 0,Vr:void 0}))};try{e=Qi(t)}catch(i){if(hu(t.compression,Xt(t.url,"compression")))return $.error("Failed to gzip request body, sending uncompressed payload",i),n();throw i}return e&&hu(t.compression,Xt(t.url,"compression"))&&!((r=e.body)instanceof ArrayBuffer?ls(new Uint8Array(r)):ArrayBuffer.isView(r)&&ls(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)))?(mn=!0,n()):{url:t.url,encodedBody:e}},Pl=t=>{try{return Sl(t)}catch(e){return $.error(e),void(t.callback==null||t.callback({statusCode:0,error:e}))}},pf=(function(){var t=ne((function*(e){var r=Vt(e.data),n=yield(function(s,o,a){return ds.apply(this,arguments)})(r,j.DEBUG,{rethrow:!0});if(!n)return e;var i=yield n.arrayBuffer();return x({},e,{Vr:{contentType:El,body:i,estimatedSize:i.byteLength}})}));return function(e){return t.apply(this,arguments)}})(),ff=/Failed to fetch|NetworkError|Load failed/i,Tl=t=>{var e=Pl(t);if(e){var r=e.url,n=e.encodedBody,i=n??{},s=i.contentType,o=i.body,a=i.estimatedSize,u=new Headers;B(t.headers,(function(p,g){u.append(g,p)})),s&&u.append("Content-Type",s);var c=null,l=!1;if(ou){var d=new ou;c={signal:d.signal,timeout:setTimeout((()=>{var p,g;l=!0,d.abort((p=t.timeout,(g=new Error("PostHog request timed out"+(p?" after "+p+"ms":""))).name="AbortError",g))}),t.timeout)}}var h=p=>{l&&p?.name==="AbortError"||(g=>g?.name==="TypeError"&&ff.test(g?.message||""))(p)?$.warn(p):$.error(p),t.callback==null||t.callback({statusCode:0,error:p})};try{var f;wo(r,x({method:t?.method||"GET",headers:u,keepalive:t.method==="POST"&&!t.Wr&&52428.8>(a||0),body:o,signal:(f=c)==null?void 0:f.signal},t.fetchOptions)).then((p=>p.text().then((g=>{var m={statusCode:p.status,text:g};if(p.status===200)try{m.json=JSON.parse(g)}catch(v){$.error(v)}t.callback==null||t.callback(m)})))).catch(h).finally((()=>c?clearTimeout(c.timeout):null))}catch(p){c&&clearTimeout(c.timeout),h(p)}}},ao=t=>{try{var e,r=Sl(t),n=r.url,i=r.encodedBody,s=i??{},o=s.body,a=s.estimatedSize;if(!o)return;var u=o instanceof Blob?o:new Blob([o],{type:s.contentType});if(_e.sendBeacon(n,u))return;var c=O(t.data)?t.data:(e=t.data)==null?void 0:e.batch;if(O(c)&&c.length>1&&(a??0)>16384){var l=Math.ceil(c.length/2),d=h=>O(t.data)?h:x({},t.data,{batch:h});return ao(x({},t,{data:d(c.slice(0,l))})),void ao(x({},t,{data:d(c.slice(l))}))}$.warn("Beacon of ~"+(a??0)+" bytes was rejected by the browser, falling back to fetch"),Tl(x({},t,{Wr:!0}))}catch(h){$.warn("Beacon send failed",h)}},Nu=(t,e,r,n)=>{var i=n==="query"?e==="POST"?"sent_at":"_":void 0;return Zo(r===ge.GZipJS?$l(t,"compression"):t,x({},i?{[i]:Date.now().toString()}:{},r===ge.GZipJS?{}:{compression:r}))},yn=[];wo&&yn.push({transport:"fetch",method:Tl}),cs&&yn.push({transport:"XHR",method(t){var e=Pl(t);if(e){var r=new cs,n=e.encodedBody;r.open(t.method||"GET",e.url,!0);var i=n??{},s=i.contentType,o=i.body;B(t.headers,(function(a,u){r.setRequestHeader(u,a)})),s&&r.setRequestHeader("Content-Type",s),t.timeout&&(r.timeout=t.timeout),r.onreadystatechange=()=>{if(r.readyState===4){var a={statusCode:r.status,text:r.responseText};if(r.status===200)try{a.json=JSON.parse(r.responseText)}catch{}t.callback==null||t.callback(a)}},r.send(o)}}}),_e!=null&&_e.sendBeacon&&yn.push({transport:"sendBeacon",method:ao});var uo=3e3,co=class{constructor(e,r){this.Zr=!0,this.Gr=[],this.Qr=Ge(r?.flush_interval_ms||uo,250,5e3,$.createLogger("flush interval"),uo),this.Jr=e}enqueue(e){this.Gr.push(e),this.Kr||this.Yr()}unload(){this.Xr();var e=this.Gr.length>0?this.ei():{},r=Object.values(e);[...r.filter((n=>n.url.indexOf("/e")===0)),...r.filter((n=>n.url.indexOf("/e")!==0))].map((n=>{this.ti(x({},n,{transport:"sendBeacon"}))}))}enable(){this.Zr=!1,this.Yr()}Yr(){var e=this;this.Zr||(this.Kr=setTimeout((()=>{if(this.Xr(),this.Gr.length>0){var r=this.ei(),n=function(){var s=r[i],o=new Date().getTime();s.data&&O(s.data)&&B(s.data,(a=>{a.offset=Math.abs(a.timestamp-o),delete a.timestamp})),e.ti(s)};for(var i in r)n()}}),this.Qr))}ti(e){try{this.Jr(e)}catch(r){$.error(r)}}Xr(){clearTimeout(this.Kr),this.Kr=void 0}ei(){var e={};return B(this.Gr,(r=>{var n,i=r,s=(i?i.batchKey:null)||i.url;E(e[s])&&(e[s]=x({},i,{data:[]})),(n=e[s].data)==null||n.push(i.data)})),this.Gr=[],e}},gf=["retriesPerformedSoFar"],lo=class{constructor(e){this.ri=!1,this.ii=3e3,this.Gr=[],this._instance=e,this.Gr=[],this.ni=!0,!E(_)&&"onLine"in _.navigator&&(this.ni=_.navigator.onLine,this.si=()=>{this.ni=!0,this.oi()},this.ai=()=>{this.ni=!1},re(_,"online",this.si),re(_,"offline",this.ai))}get length(){return this.Gr.length}retriableRequest(e){var r=e.retriesPerformedSoFar,n=ic(e,gf);et(r)&&(n.url=Zo(n.url,{retry_count:r})),this._instance._send_request(x({},n,{callback:i=>{if(i.statusCode!==200&&(400>i.statusCode||i.statusCode>=500)){if((i.statusCode===0?3:10)>(r??0))return void this.kt(x({retriesPerformedSoFar:r},n));i.statusCode===0&&$.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(r??0)+" retries.")}n.callback==null||n.callback(i)}}))}kt(e){var r=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=r+1;var n=(function(o){var a=3e3*Math.pow(2,o),u=a/2,c=Math.min(18e5,a),l=Math.random()-.5;return Math.ceil(c+l*(c-u))})(r),i=Date.now()+n;this.Gr.push({retryAt:i,requestOptions:e});var s="Enqueued failed request for retry in "+n;navigator.onLine||(s+=" (Browser is offline)"),$.warn(s),this.ri||(this.ri=!0,this.li())}li(){if(this.ui&&clearTimeout(this.ui),this.Gr.length===0)return this.ri=!1,void(this.ui=void 0);this.ui=setTimeout((()=>{this.ni&&this.Gr.length>0&&this.oi(),this.li()}),this.ii)}oi(){var e=Date.now(),r=[],n=this.Gr.filter((s=>e>s.retryAt||(r.push(s),!1)));if(this.Gr=r,n.length>0)for(var i of n)this.retriableRequest(i.requestOptions)}unload(){for(var e of(this.ui&&(clearTimeout(this.ui),this.ui=void 0),this.ri=!1,E(_)||(this.si&&(_.removeEventListener("online",this.si),this.si=void 0),this.ai&&(_.removeEventListener("offline",this.ai),this.ai=void 0)),this.Gr)){var r=e.requestOptions;try{this._instance._send_request(x({},r,{transport:"sendBeacon"}))}catch(n){$.error(n)}}this.Gr=[]}},ho=class{constructor(e){this.hi=()=>{var r,n,i,s;this.di||(this.di={});var o=this.scrollElement(),a=this.scrollY(),u=o?Math.max(0,o.scrollHeight-o.clientHeight):0,c=a+(o?.clientHeight||0),l=o?.scrollHeight||0;this.di.lastScrollY=Math.ceil(a),this.di.maxScrollY=Math.max(a,(r=this.di.maxScrollY)!==null&&r!==void 0?r:0),this.di.maxScrollHeight=Math.max(u,(n=this.di.maxScrollHeight)!==null&&n!==void 0?n:0),this.di.lastContentY=c,this.di.maxContentY=Math.max(c,(i=this.di.maxContentY)!==null&&i!==void 0?i:0),this.di.maxContentHeight=Math.max(l,(s=this.di.maxContentHeight)!==null&&s!==void 0?s:0)},this._instance=e}get ci(){return this._instance.config.scroll_root_selector}getContext(){return this.di}resetContext(){var e=this.di;return setTimeout(this.hi,0),e}startMeasuringScrollPosition(){re(_,"scroll",this.hi,{capture:!0}),re(_,"scrollend",this.hi,{capture:!0}),re(_,"resize",this.hi)}scrollElement(){if(!this.ci)return _?.document.documentElement;var e=O(this.ci)?this.ci:[this.ci];for(var r of e){var n=_?.document.querySelector(r);if(n)return n}}vi(e){var r=e==="y"?"scrollTop":"scrollLeft";if(this.ci){var n=this.scrollElement();return n&&n[r]||0}return _?e==="y"?_.scrollY||_.pageYOffset||_.document.documentElement.scrollTop||0:_.scrollX||_.pageXOffset||_.document.documentElement.scrollLeft||0:0}scrollY(){return this.vi("y")}scrollX(){return this.vi("x")}},_f=t=>vl(t?.config.mask_personal_data_properties,t?.config.custom_personal_data_properties,t?.config.disable_capture_url_hashes),Gn=class{constructor(e,r,n,i){this.fi=s=>{var o=this.pi();if(!o||o.sessionId!==s){var a={sessionId:s,props:this.gi(this._instance)};this.mi.register({[Hs]:a})}},this._instance=e,this.yi=r,this.mi=n,this.gi=i||_f,this.yi.onSessionId(this.fi)}pi(){return this.mi.props[Hs]}getSetOnceProps(){var e,r=(e=this.pi())==null?void 0:e.props;return r?"r"in r?ml(r,this._instance.config.disable_capture_url_hashes):{$referring_domain:r.referringDomain,$pathname:r.initialPathName,utm_source:r.utm_source,utm_campaign:r.utm_campaign,utm_medium:r.utm_medium,utm_content:r.utm_content,utm_term:r.utm_term}:{}}getSessionProps(){var e={};return B(Io(this.getSetOnceProps()),((r,n)=>{n==="$current_url"&&(n="url"),e["$session_entry_"+hs(n)]=r})),e}},Dr=class{on(e,r){return this.bi[e]||(this.bi[e]=[]),this.bi[e].push(r),()=>{this.bi[e]=this.bi[e].filter((n=>n!==r))}}emit(e,r){for(var n of this.bi[e]||[])n(r);for(var i of this.bi["*"]||[])i(e,r)}constructor(){this.bi={}}},mr=X("[SessionId]"),Vn=class{on(e,r){return this.wi.on(e,r)}constructor(e,r,n){var i;if(this.xi=null,this.ki=[],this.Si=void 0,this.Ci=!1,this.wi=new Dr,this.Ti=(c,l)=>!(!et(c)||!et(l))&&Math.abs(c-l)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===it)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Te=e.config,this.mi=e.persistence,this.Ii=void 0,this.Mi=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Ei=r||nt,this.Ri=n||nt;var s=this.Te.persistence_name||this.Te.token;if(this._sessionTimeoutMs=1e3*Ge(this.Te.session_idle_timeout_seconds||1800,60,36e3,mr.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Pi(),this.Oi="ph_"+s+"_window_id",this.Fi="ph_"+s+"_primary_window_exists",this.Li()){var o=le.F(this.Oi),a=le.F(this.Fi);o&&!a?this.Ii=o:le.P(this.Oi),le.q(this.Fi,!0)}if((i=this.Te.bootstrap)!=null&&i.sessionID)try{var u=(c=>{var l=this.Te.bootstrap.sessionID.replace(/-/g,"");if(l.length!==32)throw new Error("Not a valid UUID");if(l[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(l.substring(0,12),16)})();this.$i(this.Te.bootstrap.sessionID,new Date().getTime(),u)}catch(c){mr.error("Invalid sessionID in bootstrap",c)}this.Ai()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return E(this.ki)&&(this.ki=[]),this.ki.push(e),this.Mi&&e(this.Mi,this.Ii),()=>{this.ki=this.ki.filter((r=>r!==e))}}Li(){return this.Te.persistence!=="memory"&&!this.mi.yr&&le.N()}Ni(e){e!==this.Ii&&(this.Ii=e,this.Li()&&le.q(this.Oi,e))}Di(){return this.Ii?this.Ii:this.Li()?le.F(this.Oi):null}qi(e){var r=this.xi;return!me(r)&&!me(e)&&5e3>Math.abs(e-r)}$i(e,r,n){var i=r!==this._sessionActivityTimestamp,s=!(e!==this.Mi||n!==this._sessionStartTimestamp);this._sessionStartTimestamp=n,this._sessionActivityTimestamp=r,this.Mi=e,s&&!i||s&&this.qi(r)||(this.xi=r,this.mi.register({[Gt]:[r,e,n]}))}ji(){var e,r=(e=this.Te)==null?void 0:e.persistence_save_debounce_ms;return et(r)&&r>0}Hi(){this.ji()?this.mi.refreshKey(Gt):(this.mi.flush(),this.mi.load())}Bi(){var e;if(!me(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.xi){this.Hi();var r=this.Ui();r[1]===this.Mi&&r[2]===this._sessionStartTimestamp&&(this.xi=this._sessionActivityTimestamp,this.mi.register({[Gt]:[this._sessionActivityTimestamp,(e=this.Mi)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.mi.flush())}}zi(){var e=this.Ui()[0],r=et(e)?e:0,n=et(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(r,n)}Vi(e){return this.Hi(),this.Ti(e,this.zi())}Ui(){var e=this.mi.props[Gt];return O(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.xi=null,clearTimeout(this.Wi),this.Wi=void 0,this.$i(null,null,null)}destroy(){this.Ci=!0,this.Bi(),clearTimeout(this.Wi),this.Wi=void 0,this.Si&&_&&(_.removeEventListener(Mn,this.Si,{capture:!1}),this.Si=void 0),this.ki=[]}Ai(){this.Si=()=>{this.Bi(),this.Li()&&le.P(this.Fi)},re(_,Mn,this.Si,{capture:!1})}checkAndGetSessionAndWindowId(e,r){if(e===void 0&&(e=!1),r===void 0&&(r=null),this.Te.cookieless_mode===it)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var n=r||new Date().getTime(),i=this.Ui(),s=i[1],o=i[2],a=this.zi(),u=this.Di(),c=et(o)&&Math.abs(n-o)>864e5,l=!1,d=!1,h=!s,f=s,p=!h&&!e&&this.Ti(n,a);if(p){(p=this.Vi(n))||mr.info("cross-tab refresh kept the session alive",{sessionId:s});var g=this.Ui();s=g[1],o=g[2]}h||p||c?(s=this.Ei(),u=this.Ri(),mr.info("new session ID generated",{sessionId:s,windowId:u,changeReason:{noSessionId:h,activityTimeout:p,sessionPastMaximumLength:c}}),o=n,l=!0):(u||(u=this.Ri(),l=!0),(d=s!==f)&&(mr.info("adopted cross-tab session id",{sessionId:s,windowId:u}),l=!0));var m=et(a)&&e&&!c?a:n,v=et(o)?o:new Date().getTime();this.Ni(u),this.$i(s,m,v),e||this.Pi();var w={noSessionId:h,activityTimeout:p,sessionPastMaximumLength:c,crossTabAdoption:d};return l&&this.ki.forEach((y=>y(s,u,w))),{sessionId:s,windowId:u,sessionStartTimestamp:v,changeReason:l?w:void 0,lastActivityTimestamp:a}}Pi(){this.Ci||(clearTimeout(this.Wi),this.Wi=setTimeout((()=>{if(!this.Ci)if(this.Vi(new Date().getTime())){var e=this.Mi;this.resetSessionId(),this.wi.emit("forcedIdleReset",{idleSessionId:e})}else this.Pi()}),1.1*this.sessionTimeoutMs))}},zl=function(t,e){if(!t)return!1;var r=t.userAgent;if(r&&fu(r,e))return!0;try{var n=t?.userAgentData;if(n!=null&&n.brands&&n.brands.some((i=>fu(i?.brand,e))))return!0}catch{}return!!t.webdriver};function Rl(){return(Rl=ne((function*(){var t=_e?.userAgentData;if(t!=null&&t.getHighEntropyValues)try{var e=yield t.getHighEntropyValues(["model"]),r=e?.model;return H(r)&&r.length>0?r:void 0}catch(n){return void $.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",n)}}))).apply(this,arguments)}var qn=function(t,e){if(!(function(r){try{new RegExp(r)}catch{return!1}return!0})(e))return!1;try{return new RegExp(e).test(t)}catch{return!1}};function Du(t,e,r){return Vt({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:r})}var Cl={exact:(t,e)=>e.some((r=>t.some((n=>r===n)))),is_not:(t,e)=>e.every((r=>t.every((n=>r!==n)))),regex:(t,e)=>e.some((r=>t.some((n=>qn(r,n))))),not_regex:(t,e)=>e.every((r=>t.every((n=>!qn(r,n))))),icontains:(t,e)=>e.map(ln).some((r=>t.map(ln).some((n=>r.includes(n))))),not_icontains:(t,e)=>e.map(ln).every((r=>t.map(ln).every((n=>!r.includes(n))))),gt:(t,e)=>e.some((r=>{var n=parseFloat(r);return!isNaN(n)&&t.some((i=>n>parseFloat(i)))})),lt:(t,e)=>e.some((r=>{var n=parseFloat(r);return!isNaN(n)&&t.some((i=>n<parseFloat(i)))}))},ln=t=>t.toLowerCase();function Il(t,e){return!t||Object.entries(t).every((r=>{var n=r[1],i=e?.[r[0]];if(E(i)||me(i))return!1;var s=[String(i)],o=Cl[n.operator];return!!o&&o(n.values,s)}))}var po="custom",ju="i.posthog.com",vf=/^\/static\//,fo=class{constructor(e){this.Zi={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,r=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return r||(r=this.apiHost.replace("."+ju,".posthog.com")),r==="https://app.posthog.com"?"https://us.posthog.com":r}get region(){return this.Zi[this.apiHost]||(this.Zi[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":po),this.Zi[this.apiHost]}Gi(e){if(vf.test(e)){var r=this.instance.config.asset_host;if(typeof r=="string")return r.trim().replace(/\/$/,"")||void 0}}endpointFor(e,r){if(r===void 0&&(r=""),r&&(r=r[0]==="/"?r:"/"+r),e==="ui")return this.uiHost+r;if(e==="flags")return this.flagsApiHost+r;if(e==="assets"){var n=this.Gi(r);if(n)return""+n+r}if(this.region===po)return this.apiHost+r;var i=ju+r;switch(e){case"assets":return"https://"+this.region+"-assets."+i;case"api":return"https://"+this.region+"."+i}}};function Al(t){var e;return!((e=t.conditions)==null||(e=e.events)==null||(e=e.values)==null||!e.length)}var U=X("[Surveys]"),Ol="seenSurvey_",Ml=t=>{try{var e=(r=>((n,i)=>""+Ol+(function(s){return s.current_iteration&&s.current_iteration>0?s.id+"_"+s.current_iteration:s.id})(i))(0,r))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(r){U.error("Failed to persist survey seen state",r)}},mf=[Wi.Popover,Wi.Widget,Wi.API],yf={ignoreConditions:!1,ignoreDelay:!1,displayType:to.Popover},bf=X("[PostHog ExternalIntegrations]"),xf={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},go=class{constructor(e){this._instance=e}er(e,r){var n;(n=C.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,e,(i=>{if(i)return bf.error("failed to load script",i);r()}))}startIfEnabledOrStop(){var e=this,r=function(){var s,o,a,u=n[0],c=n[1];!c||(s=C.__PosthogExtensions__)!=null&&(s=s.integrations)!=null&&s[u]||e.er(xf[u],(()=>{var l;(l=C.__PosthogExtensions__)==null||(l=l.integrations)==null||(l=l[u])==null||l.start(e._instance)})),!c&&(o=C.__PosthogExtensions__)!=null&&(o=o.integrations)!=null&&o[u]&&((a=C.__PosthogExtensions__)==null||(a=a.integrations)==null||(a=a[u])==null||a.stop())};for(var n of Object.entries((i=this._instance.config.integrations)!==null&&i!==void 0?i:{})){var i;r()}}},Ar={},es=0,Kn=()=>{},Uu='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',yr="Surveys module not available",Hu="sanitize_properties is deprecated. Use before_send instead",Fl="Invalid value for property_denylist config: ",wf=["token","distinct_id",Hc],Bt="posthog",Ll=!hf&&xe?.indexOf("MSIE")===-1&&xe?.indexOf("Mozilla")===-1,ts=t=>{var e;return x({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Op(P?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Kn,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:t??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:ie&&H(ie?.search)&&ie.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,disable_external_dependency_loading:!1,strict_script_versioning:!1,enable_recording_console_log:void 0,secure_cookie:(_==null||(e=_.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,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(r){$.error("Bad HTTP status: "+r.statusCode+" "+r.text)},get_device_id:r=>r,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:qs,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:uo},error_tracking:{},_onCapture:Kn},(r=>({rageclick:r&&r>="2026-05-30"?{content_ignorelist:Hp,ignore_text_selection:!0}:!r||"2025-11-30">r||{content_ignorelist:!0},capture_pageview:!r||"2025-05-24">r||"history_change",session_recording:r&&r>="2026-06-25"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6},streamNetworkBody:!0}:r&&r>="2026-05-30"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6}}:r&&r>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:r&&r>="2026-01-30"?"head":"body",internal_or_test_user_hostname:r&&r>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:r&&r>="2026-05-30"?250:0,split_storage:!(!r||"2026-05-30">r),detect_google_search_app:!(!r||"2026-05-30">r),disable_capture_url_hashes:!(!r||"2026-06-25">r)}))(t))},kf=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"]],Bu=t=>{var e={};for(var r of kf){var n=r[0],i=r[1];E(t[n])||(e[i]=t[n])}var s=K({},e,t),o=t.__preview_external_dependency_versioned_paths;return E(o)||(E(t.strict_script_versioning)&&(s.strict_script_versioning=!!o),H(o)&&E(t.asset_host)&&(s.asset_host=o)),O(t.property_blacklist)&&(E(t.property_denylist)?s.property_denylist=t.property_blacklist:O(t.property_denylist)?s.property_denylist=[...t.property_blacklist,...t.property_denylist]:$.error(Fl+t.property_denylist)),s},_o=class{constructor(){this.__forceAllowLocalhost=!1}get Qi(){return this.__forceAllowLocalhost}set Qi(e){$.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},Ot=class t{Ji(e,r){if(e){var n=this.Ki.indexOf(e);n!==-1&&this.Ki.splice(n,1)}return this.Ki.push(r),r.initialize==null||r.initialize(),r}Yi(){return this.config.cookieless_mode===it||this.config.cookieless_mode===Rt&&this.consent.isRejected()}get decideEndpointWasHit(){var e,r;return(e=(r=this.featureFlags)==null?void 0:r.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,r;return(e=(r=this.featureFlags)==null?void 0:r.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){var e;this.webPerformance=new _o,this.Xi=!1,this.version=j.LIB_VERSION,this.en=new Dr,this.Ki=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=ts(),this.SentryIntegration=eo,this.sentryIntegration=n=>(function(i,s){var o=ll(i,s);return{name:cl,processEvent:a=>o(a)}})(this,n),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.tn=!1,this.rn=null,this.nn=null,this.sn=null,this.scrollManager=new ho(this),this.pageViewManager=new Zn(this),this.rateLimiter=new ro(this),this.requestRouter=new fo(this),this.consent=new Ys(this),this.externalIntegrations=new go(this);var r=(e=t.__defaultExtensionClasses)!==null&&e!==void 0?e:{};this.featureFlags=r.featureFlags&&new r.featureFlags(this),this.toolbar=r.toolbar&&new r.toolbar(this),this.surveys=r.surveys&&new r.surveys(this),this.conversations=r.conversations&&new r.conversations(this),this.logs=r.logs&&new r.logs(this),this.metrics=r.metrics&&new r.metrics(this),this.experiments=r.experiments&&new r.experiments(this),this.exceptions=r.exceptions&&new r.exceptions(this),this.people={set:(n,i,s)=>{var o=H(n)?{[n]:i}:n;this.setPersonProperties(o),s?.({})},set_once:(n,i,s)=>{var o=H(n)?{[n]:i}:n;this.setPersonProperties(void 0,o),s?.({})}},this.on("eventCaptured",(n=>$.info('send "'+n?.event+'"',n)))}init(e,r,n){if(n&&n!==Bt){var i,s=(i=Ar[n])!==null&&i!==void 0?i:new t;return s._init(e,r,n),Ar[n]=s,Ar[Bt][n]=s,s}return this._init(e,r,n)}_init(e,r,n){var i,s;r===void 0&&(r={});var o=H(e)?e.trim():"";if(!o)return $.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=ts(r.defaults),r.debug=this.an(r.debug),this.ln=r,this.un=[],r.person_profiles?this.nn=r.person_profiles:r.process_person&&(this.nn=r.process_person);var a=ts(r.defaults),u=Bu(r),c=K({},a,u,{name:n,token:o});Y(a.rageclick)&&Y(u.rageclick)&&(c.rageclick=K({},a.rageclick,u.rageclick)),Y(a.session_recording)&&Y(u.session_recording)&&(c.session_recording=K({},a.session_recording,u.session_recording)),this.set_config(c),this.config.on_xhr_error&&$.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=r.disable_compression?void 0:ge.GZipJS;var l=this.hn();this.persistence=new Cr(this.config,l),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Cr(x({},this.config,{persistence:"sessionStorage"}),l,!1);var d=x({},this.persistence.props),h=x({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.dn=new co((k=>this.cn(k)),this.config.request_queue_config),this.vn=new lo(this),this.__request_queue=[];var f=this.Yi();if(f||(this.sessionManager=new Vn(this),this.sessionPropsManager=new Gn(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?($.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.fn(f)}),0)):($.info("Initializing extensions synchronously"),this.fn(f)),j.DEBUG=j.DEBUG||this.config.debug,j.DEBUG&&$.info("Starting in debug mode",{this:this,config:r,thisC:x({},this.config),p:d,s:h}),!this.config.identity_distinct_id||(i=r.bootstrap)!=null&&i.distinctID||(r.bootstrap=x({},r.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),((s=r.bootstrap)==null?void 0:s.distinctID)!==void 0){var p=r.bootstrap.distinctID,g=this.get_distinct_id(),m=this.persistence.get_property(Le);if(r.bootstrap.isIdentifiedID&&g!=null&&g!==p&&m===Zt)this.identify(p);else if(r.bootstrap.isIdentifiedID&&g!=null&&g!==p&&m===Nt)$.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var v=this.config.get_device_id(nt()),w=r.bootstrap.isIdentifiedID?v:p;this.persistence.set_property(Le,r.bootstrap.isIdentifiedID?Nt:Zt),this.register({distinct_id:p,$device_id:w})}}if(f)this.register_once({distinct_id:sn,$device_id:null},"");else if(!this.get_distinct_id()){var y=this.config.get_device_id(nt());this.register_once({distinct_id:y,$device_id:y},""),this.persistence.set_property(Le,Zt)}return re(_,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),r.segment?(function(k,T){var M=k.config.segment;if(!M)return T();(function(R,b){var S=R.config.segment;if(!S)return b();var z=I=>{var Z=()=>I.anonymousId()||nt();R.config.get_device_id=Z,I.id()&&(R.register({distinct_id:I.id(),$device_id:Z()}),R.persistence.set_property(Le,Nt)),b()},L=S.user();"then"in L&&Ze(L.then)?L.then(z):z(L)})(k,(()=>{M.register((R=>{typeof Promise<"u"&&Promise.resolve||qi.warn("This browser does not have Promise support, and can not use the segment integration");var b=(S,z)=>{if(!z)return S;S.event.userId||S.event.anonymousId===R.get_distinct_id()||(qi.info("No userId set, resetting PostHog"),R.reset()),S.event.userId&&S.event.userId!==R.get_distinct_id()&&(qi.info("UserId set, identifying with PostHog"),R.identify(S.event.userId));var L=R.calculateEventProperties(z,S.event.properties);return S.event.properties=Object.assign({},L,S.event.properties),S};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:S=>b(S,S.event.event),page:S=>b(S,Ht),identify:S=>b(S,Bi),screen:S=>b(S,"$screen")}})(k)).then((()=>{T()}))}))})(this,(()=>this.pn())):this.pn(),Ze(this.config._onCapture)&&this.config._onCapture!==Kn&&($.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(k=>this.config._onCapture(k.event,k)))),this.config.ip&&$.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this.config.disableDeviceModel||(function(){return Rl.apply(this,arguments)})().then((k=>{k&&this.register({[Ui]:k})})).catch(Kn),this}fn(e){var r,n,i,s,o,a,u,c,l=performance.now(),d=x({},t.__defaultExtensionClasses,this.config.__extensionClasses),h=[];d.featureFlags&&this.Ki.push(this.featureFlags=(r=this.featureFlags)!==null&&r!==void 0?r:new d.featureFlags(this)),d.exceptions&&this.Ki.push(this.exceptions=(n=this.exceptions)!==null&&n!==void 0?n:new d.exceptions(this)),d.historyAutocapture&&this.Ki.push(this.historyAutocapture=new d.historyAutocapture(this)),d.tracingHeaders&&this.Ki.push(this.tracingHeaders=new d.tracingHeaders(this)),d.siteApps&&this.Ki.push(this.siteApps=new d.siteApps(this)),d.sessionRecording&&!e&&this.Ki.push(this.sessionRecording=new d.sessionRecording(this)),this.config.disable_scroll_properties||h.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),d.autocapture&&this.Ki.push(this.autocapture=new d.autocapture(this)),d.surveys&&this.Ki.push(this.surveys=(i=this.surveys)!==null&&i!==void 0?i:new d.surveys(this)),d.logs&&this.Ki.push(this.logs=(s=this.logs)!==null&&s!==void 0?s:new d.logs(this)),d.metrics&&this.Ki.push(this.metrics=(o=this.metrics)!==null&&o!==void 0?o:new d.metrics(this)),d.conversations&&this.Ki.push(this.conversations=(a=this.conversations)!==null&&a!==void 0?a:new d.conversations(this)),d.productTours&&this.Ki.push(this.productTours=new d.productTours(this)),d.heatmaps&&this.Ki.push(this.heatmaps=new d.heatmaps(this)),d.webVitalsAutocapture&&this.Ki.push(this.webVitalsAutocapture=new d.webVitalsAutocapture(this)),d.exceptionObserver&&this.Ki.push(this.exceptionObserver=new d.exceptionObserver(this)),d.deadClicksAutocapture&&this.Ki.push(this.deadClicksAutocapture=new d.deadClicksAutocapture(this,Yp)),d.toolbar&&this.Ki.push(this.toolbar=(u=this.toolbar)!==null&&u!==void 0?u:new d.toolbar(this)),d.experiments&&this.Ki.push(this.experiments=(c=this.experiments)!==null&&c!==void 0?c:new d.experiments(this)),this.Ki.forEach((f=>{f.initialize&&h.push((()=>{f.initialize==null||f.initialize()}))})),h.push((()=>{if(this.gn){var f=this.gn;this.gn=void 0,this.Hr(f)}})),this.mn(h,l)}mn(e,r){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-r>=30&&e.length>0)return void setTimeout((()=>{this.mn(e,r)}),0);var n=e.shift();if(n)try{n()}catch(s){$.error("Error initializing extension:",s)}}var i=Math.round(performance.now()-r);this.register_for_session({[Bc]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Gc]:i}),this.config.__preview_deferred_init_extensions&&$.info("PostHog extensions initialized ("+i+"ms)")}Hr(e){if(!P||!P.body)return $.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Hr(e)}),500);if(this.config.__preview_deferred_init_extensions&&(this.gn=e),this.yn=e,this.compression=void 0,e.ok){var r,n=e.config;n.supportedCompression&&!this.config.disable_compression&&(this.compression=A(n.supportedCompression,ge.GZipJS)?ge.GZipJS:A(n.supportedCompression,ge.Base64)?ge.Base64:void 0),(r=n.analytics)!=null&&r.endpoint&&(this.analyticsDefaultEndpoint=n.analytics.endpoint)}this.set_config({person_profiles:this.nn?this.nn:qs}),this.Ki.forEach((i=>i.onRemoteConfig==null?void 0:i.onRemoteConfig(e)))}pn(){try{this.config.loaded(this)}catch(n){$.critical("`loaded` function failed",n)}if(this.bn(),this.config.internal_or_test_user_hostname&&ie!=null&&ie.hostname){var e=ie.hostname,r=this.config.internal_or_test_user_hostname;(typeof r=="string"?e===r:r.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.Yi())&&this._n()}),1),this.wn=new Un(this),this.wn.load()}bn(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.dn)==null||e.enable())}_dom_loaded(){this.is_capturing()&&on(this.__request_queue,(e=>this.cn(e))),this.__request_queue=[],this.bn()}_handle_unload(){var e,r,n,i,s;(e=this.surveys)==null||e.handlePageUnload==null||e.handlePageUnload(),(r=this.metrics)==null||r.flush("sendBeacon"),this.config.request_batching?(this.xn()&&this.capture(Hi),(n=this.logs)==null||n.flushLogs("sendBeacon"),(i=this.dn)==null||i.unload(),(s=this.vn)==null||s.unload()):this.xn()&&this.capture(Hi,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded?Ll?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(e.callback==null||e.callback({statusCode:429})):(e.transport=e.transport||this.config.api_transport,e.headers=x({},this.config.request_headers,e.headers),e.compression=e.compression==="best-available"?this.compression:e.compression,(E(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(r=>{var n,i,s,o=x({},r);o.timeout=o.timeout||6e4;var a,u,c,l,d,h=(n=o.transport)!==null&&n!==void 0?n:"fetch";h==="sendBeacon"&&E(o.compression)&&o.data&&(o.compression=ge.Base64),o.method==="POST"&&o.data&&(o.timestampMode==="capture-body"?o.data={api_key:(u=(d=(l=O(a=o.data)?a:[a])[0])==null||(c=d.properties)==null?void 0:c.token)!==null&&u!==void 0?u:d?.token,batch:l,sent_at:new Date().toISOString()}:o.timestampMode==="body"&&(o.data=(function(g,m){return m===void 0&&(m=new Date().toISOString()),O(g)?g.map((v=>x({},v,{sent_at:m}))):x({},g,{sent_at:m})})(o.data))),o.url=Nu(o.url,o.method,o.compression,o.timestampMode);var f=yn.filter((g=>!o.disableTransport||!g.transport||!o.disableTransport.includes(g.transport))),p=(i=(s=(function(g,m){for(var v=0;g.length>v;v++)if(g[v].transport===h)return g[v]})(f))==null?void 0:s.method)!==null&&i!==void 0?i:f[0].method;if(!p)throw new Error("No available transport method");h!=="sendBeacon"&&o.data&&o.compression===ge.GZipJS&&qh&&typeof Promise<"u"&&!mn?pf(o).then((g=>{p(g)})).catch((g=>{if(pu(g))return mn=!0,void p(x({},o,{compression:void 0,url:Nu(r.url,r.method,void 0,r.timestampMode)}));(m=>{if(!m||typeof m!="object")return!1;var v="name"in m?String(m.name):"";return pu(m)||v===sc})(g)&&(mn=!0),p(o)})):p(o)})(x({},e,{callback:r=>{var n,i;this.rateLimiter.checkForLimiting(r),400>r.statusCode||(n=(i=this.config).on_request_error)==null||n.call(i,r),e.callback==null||e.callback(r)}}))):e.fireCallbackOnDrop&&(e.callback==null||e.callback({statusCode:0}))}cn(e){this.vn?this.vn.retriableRequest(e):this._send_request(e)}_execute_array(e){es++;try{var r,n=[],i=[],s=[];on(e,(a=>{if(a)if(O(r=a[0]))s.push(a);else if(Ze(a))try{a.call(this)}catch(u){$.error("Error executing queued PostHog call",a,u)}else O(a)&&r==="alias"?n.push(a):O(a)&&r.indexOf("capture")!==-1&&Ze(this[r])?s.push(a):i.push(a)}));var o=function(a,u){on(a,(function(c){try{if(O(c[0])){var l=u;B(c,(function(d){l=l[d[0]].apply(l,d.slice(1))}))}else u[c[0]].apply(u,c.slice(1))}catch(d){$.error("Error executing queued PostHog call",c,d)}}))};o(n,this),o(i,this),o(s,this)}finally{es--}}push(e){if(es>0&&O(e)&&H(e[0])){var r=t.prototype[e[0]];Ze(r)&&r.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,r,n){var i,s,o,a,u;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.dn){if(this.is_capturing())if(!E(e)&&H(e)){var c=!this.config.opt_out_useragent_filter&&this._is_bot();if(!c||this.config.__preview_capture_bot_pageviews){var l=n!=null&&n.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(l==null||!l.isRateLimited){r!=null&&r.$current_url&&!H(r?.$current_url)&&($.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),r==null||delete r.$current_url),e!=="$exception"||n!=null&&n.kn||$.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&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 d=new Date,h=n?.timestamp||d,f=mu(n?.uuid,nt),p={uuid:f,event:e,properties:this.calculateEventProperties(e,r||{},h,f)};e===Ht&&this.config.__preview_capture_bot_pageviews&&c&&(p.event="$bot_pageview",p.properties.$browser_type="bot"),l&&(p.properties.$lib_rate_limit_remaining_tokens=l.remainingTokens);var g=e==="$feature_flag_called"&&p.properties.$feature_flag_has_experiment===!1&&this.get_property(Rn)===!0;n?.$set&&!g&&(p.$set=n?.$set);var m=n?.$unset;m&&(p.$unset=m);var v,w,y,k=g?void 0:this.Sn(n?.$set_once,e!==ku,e===Bi);if(k&&(p.$set_once=k),n!=null&&n._noTruncate||(s=this.config.properties_string_max_length,o=p,a=I=>H(I)?I.slice(0,s):I,u=new Set,p=(function I(Z,Q){if(Z!==Object(Z))return a?a(Z):Z;if(!u.has(Z)){var G;if(u.add(Z),O(Z))G=[],on(Z,(q=>{G.push(I(q))}));else{var N={};B(Z,((q,J)=>{u.has(q)||(N[J]=I(q,J))})),G=N}return G}})(o)),p.timestamp=h,E(n?.timestamp)||(p.properties.$event_time_override_provided=!0,p.properties.$event_time_override_system_time=d),g&&(p.properties=(function(I,Z){Z===void 0&&(Z=[]);var Q={},G=N=>{I[N]!==void 0&&(Q[N]=I[N])};return Kh.forEach(G),Z.forEach(G),Q})(p.properties,wf)),e===ot.DISMISSED||e===ot.SENT){var T=r?.[Ji.SURVEY_ID],M=r?.[Ji.SURVEY_ITERATION];Ml({id:T,current_iteration:M}),p.$set=x({},p.$set,{[(v={id:T,current_iteration:M},w=e===ot.SENT?"responded":"dismissed",y="$survey_"+w+"/"+v.id,v.current_iteration&&v.current_iteration>0&&(y="$survey_"+w+"/"+v.id+"/"+v.current_iteration),y)]:!0})}else e===ot.SHOWN&&(p.$set=x({},p.$set,{[Ji.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(e===of.SHOWN){var R=r?.[Ou.TOUR_TYPE];R&&(p.$set=x({},p.$set,{[Ou.TOUR_LAST_SEEN_DATE+"/"+R]:new Date().toISOString()}))}var b=x({},p.properties.$set,p.$set);if(pt(b)||this.setPersonPropertiesForFlags(b),!F(this.config.before_send)){var S=this.wt(p);if(!S)return;(p=S).uuid=mu(p.uuid,nt)}this.en.emit("eventCaptured",p);var z=(i=n?._url)!==null&&i!==void 0?i:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),L={method:"POST",url:z,data:p,compression:"best-available",timestampMode:n?._batchKey==="recordings"||/\/s\/(?:\?|$)/.test(z)?"body":"capture-body",batchKey:n?._batchKey,transport:n?.transport};return!this.config.request_batching||n&&(n==null||!n._batchKey)||n!=null&&n.send_instantly?this.cn(L):this.dn.enqueue(L),p}$.critical("This capture call is ignored due to client rate limiting.")}}else $.error("No event name provided to posthog.capture")}else $.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(r=>e(r.event,r)))}calculateEventProperties(e,r,n,i,s){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return r;var o=s?void 0:this.persistence.remove_event_timer(e),a=x({},r);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,this.Yi()&&(a[Hc]=!0),e==="$snapshot"){var u=x({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=u.distinct_id,(!H(a.distinct_id)&&!de(a.distinct_id)||ps(a.distinct_id))&&$.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var c,l=(function(y,k,T,M){var R,b,S,z;if(M===void 0&&(M=!1),!xe)return{};var L,I=y?[...Qt,...k||[]]:[],Z=(function(Ur){for(var tr=0;_u.length>tr;tr++){var Hr=_u[tr],Te=Hr[1],Br=Hr[0].exec(Ur),rr=Br&&(Ze(Te)?Te(Br,Ur):Te);if(rr)return rr}return["",""]})(xe),Q=Z[0],G=Z[1],N=(L=typeof navigator<"u"?navigator:void 0)!=null&&L.brave?{brave:!0}:{},q={};E(T)||(q.detectGoogleSearchApp=T);var J={},we=(R=navigator)==null||(R=R.userAgentData)==null?void 0:R.platform,Pe=(b=navigator)==null?void 0:b.maxTouchPoints,ye=_==null||(S=_.screen)==null?void 0:S.width,ke=_==null||(z=_.screen)==null?void 0:z.height,ee=_?.devicePixelRatio;E(we)||(J.userAgentDataPlatform=we),E(Pe)||(J.maxTouchPoints=Pe),E(ye)||(J.screenWidth=ye),E(ke)||(J.screenHeight=ke),E(ee)||(J.devicePixelRatio=ee);var oe,ae,ce,ut,fe,Oe,ct,be,Me=K(Io({$os:Q,$os_version:G,$browser:zc(xe,navigator.vendor,N,q),$device:vu(xe),$device_type:(ae=xe,ce=J,be=vu(ae),be===dc||be===lc||be==="Kobo"||be==="Kindle Fire"||be===Ec?Wt:be===Or||be===Kt||be===Mr||be===_s?"Console":be===pc?"Wearable":be?Se:ce?.userAgentDataPlatform==="Android"&&((ut=ce?.maxTouchPoints)!==null&&ut!==void 0?ut:0)>0?600>Math.min((fe=ce?.screenWidth)!==null&&fe!==void 0?fe:0,(Oe=ce?.screenHeight)!==null&&Oe!==void 0?Oe:0)/((ct=ce?.devicePixelRatio)!==null&&ct!==void 0?ct:1)?Se:Wt:"Desktop"),$timezone:yl(),$timezone_offset:rf()}),{$current_url:Zr(M?ft(ie?.href):ie?.href,I,Nr),$host:ie?.host,$pathname:ie?.pathname,$raw_user_agent:xe.length>1e3?xe.substring(0,997)+"...":xe,$browser_version:hp(xe,navigator.vendor,N,q),$browser_language:Au(),$browser_language_prefix:(oe=Au(),typeof oe=="string"?oe.split("-")[0]:void 0),$screen_height:_?.screen.height,$screen_width:_?.screen.width,$viewport_height:_?.innerHeight,$viewport_width:_?.innerWidth,$lib:j.LIB_NAME,$lib_version:j.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return j.SDK_DIST_CHANNEL&&(Me.$sdk_dist_channel=j.SDK_DIST_CHANNEL),Me})(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){var d=this.sessionManager.checkAndGetSessionAndWindowId(s,n.getTime()),h=d.windowId;a.$session_id=d.sessionId,a.$window_id=h}this.sessionPropsManager&&K(a,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&K(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(f=this.vn)==null?void 0:f.length}catch(y){a.$sdk_debug_error_capturing_properties=String(y)}if(this.requestRouter.region===po&&(a.$lib_custom_api_host=this.config.api_host),c=e!==Ht||s?e!==Hi||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,i),a=K(a,c),e===Ht&&P&&(a.title=P.title),!E(o)){var p=n.getTime()-o;a.$duration=parseFloat((p/1e3).toFixed(3))}xe&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser");var g=this.persistence.properties(),m=this.sessionPersistence.properties();B(["$referrer","$referring_domain"],(y=>{y in g&&delete m[y]})),(a=K({},l,g,m,a)).$is_identified=this._isIdentified(),O(this.config.property_denylist)?B(this.config.property_denylist,(function(y){delete a[y]})):$.error(Fl+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var v=this.config.sanitize_properties;v&&($.error(Hu),a=v(a,e));var w=this.Cn();return a.$process_person_profile=w,w&&!s&&this.Tn("_calculate_event_properties"),a}Sn(e,r,n){var i;if(r===void 0&&(r=!0),n===void 0&&(n=!1),!this.persistence||!this.Cn()||this.Xi&&!n)return e;var s=this.persistence.get_initial_props(),o=(i=this.sessionPropsManager)==null?void 0:i.getSetOnceProps(),a=K({},s,o||{},e||{}),u=this.config.sanitize_properties;return u&&($.error(Hu),a=u(a,"$set_once")),r&&(this.Xi=!0),pt(a)?void 0:a}register(e,r){var n;(n=this.persistence)==null||n.register(e,r)}register_once(e,r,n){var i;(i=this.persistence)==null||i.register_once(e,r,n)}register_for_session(e){var r;(r=this.sessionPersistence)==null||r.register(e)}unregister(e){var r;(r=this.persistence)==null||r.unregister(e)}unregister_for_session(e){var r;(r=this.sessionPersistence)==null||r.unregister(e)}In(e,r){this.register({[e]:r})}getFeatureFlag(e,r){var n;return(n=this.featureFlags)==null?void 0:n.getFeatureFlag(e,r)}getFeatureFlagPayload(e){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlagPayload(e)}getFeatureFlagResult(e,r){var n;return(n=this.featureFlags)==null?void 0:n.getFeatureFlagResult(e,r)}getAllFeatureFlags(){var e,r;return(e=(r=this.featureFlags)==null?void 0:r.getAllFeatureFlags())!==null&&e!==void 0?e:[]}isFeatureEnabled(e,r){var n,i;return(n=(i=this.featureFlags)==null?void 0:i.isFeatureEnabled(e,r))!==null&&n!==void 0?n:r?.defaultValue}reloadFeatureFlags(){var e;(e=this.featureFlags)==null||e.reloadFeatureFlags()}updateFlags(e,r,n){var i;(i=this.featureFlags)==null||i.updateFlags(e,r,n)}updateEarlyAccessFeatureEnrollment(e,r,n){var i;(i=this.featureFlags)==null||i.updateEarlyAccessFeatureEnrollment(e,r,n)}getEarlyAccessFeatures(e,r,n){var i;return r===void 0&&(r=!1),(i=this.featureFlags)==null?void 0:i.getEarlyAccessFeatures(e,r,n)}on(e,r){return this.en.on(e,r)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:yr}),()=>{})}onSessionId(e){var r,n;return(r=(n=this.sessionManager)==null?void 0:n.onSessionId(e))!==null&&r!==void 0?r:()=>{}}getSurveys(e,r){r===void 0&&(r=!1),this.surveys?this.surveys.getSurveys(e,r):e([],{isLoaded:!1,error:yr})}getActiveMatchingSurveys(e,r){r===void 0&&(r=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,r):e([],{isLoaded:!1,error:yr})}renderSurvey(e,r){var n;(n=this.surveys)==null||n.renderSurvey(e,r)}displaySurvey(e,r){var n;r===void 0&&(r=yf),(n=this.surveys)==null||n.displaySurvey(e,r)}cancelPendingSurvey(e){var r;(r=this.surveys)==null||r.cancelPendingSurvey(e)}canRenderSurvey(e){var r,n;return(r=(n=this.surveys)==null?void 0:n.canRenderSurvey(e))!==null&&r!==void 0?r:{visible:!1,disabledReason:yr}}canRenderSurveyAsync(e,r){var n,i;return r===void 0&&(r=!1),(n=(i=this.surveys)==null?void 0:i.canRenderSurveyAsync(e,r))!==null&&n!==void 0?n:Promise.resolve({visible:!1,disabledReason:yr})}Mn(e){return!e||ps(e)?($.critical("Unique user id has not been set in posthog.identify"),!1):e===sn?($.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||($.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(e,r,n){if(!this.__loaded||!this.persistence)return $.uninitializedWarning("posthog.identify");if(de(e)&&(e=e.toString(),$.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Mn(e)&&this.Tn("posthog.identify")){var i=this.get_distinct_id();this.register({$user_id:e}),this.get_property(zn)||this.register_once({$had_persisted_distinct_id:!0,$device_id:i},""),e!==i&&e!==this.get_property(kr)&&(this.unregister(kr),this.register({distinct_id:e}));var s,o=(this.persistence.get_property(Le)||Zt)===Zt;e!==i&&o?(this.persistence.set_property(Le,Nt),this.setPersonPropertiesForFlags({$set:r||{},$set_once:n||{}},!1),this.capture(Bi,{distinct_id:e,$anon_distinct_id:i},{$set:r||{},$set_once:n||{}}),this.sn=Du(e,r,n),(s=this.featureFlags)==null||s.setAnonymousDistinctId(i)):(r||n)&&this.setPersonProperties(r,n),e!==i&&(this.reloadFeatureFlags(),this.unregister(zr))}}setPersonProperties(e,r){if((e||r)&&this.Tn("posthog.setPersonProperties")){var n=Du(this.get_distinct_id(),e,r);this.sn!==n?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:r||{}},!0),this.capture("$set",{$set:e||{},$set_once:r||{}}),this.sn=n):$.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(e){var r,n=(O(e)?e:[e]).filter((i=>H(i)&&i.length>0));n.length!==0&&this.Tn("posthog.unsetPersonProperties")&&((r=this.featureFlags)==null||r.unsetPersonPropertiesForFlags(n,!0),this.capture("$set",{$unset:n}),this.sn=null)}group(e,r,n){if(e&&r){var i=this.getGroups(),s=i[e]!==r;if(s&&this.resetGroupPropertiesForFlags(e),this.register({$groups:x({},i,{[e]:r})}),s||n){var o={$group_type:e,$group_key:r};n&&(o.$group_set=n),this.capture(ku,o)}n&&this.setGroupPropertiesForFlags({[e]:n}),s&&!n&&this.reloadFeatureFlags()}else $.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,r){var n;r===void 0&&(r=!0),(n=this.featureFlags)==null||n.setPersonPropertiesForFlags(e,r)}resetPersonPropertiesForFlags(e){var r;e===void 0&&(e=!0),(r=this.featureFlags)==null||r.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,r){var n;r===void 0&&(r=!0),this.Tn("posthog.setGroupPropertiesForFlags")&&((n=this.featureFlags)==null||n.setGroupPropertiesForFlags(e,r))}resetGroupPropertiesForFlags(e){var r;(r=this.featureFlags)==null||r.resetGroupPropertiesForFlags(e)}reset(e){var r,n,i,s,o,a,u,c,l,d;if($.info("reset"),!this.__loaded)return $.uninitializedWarning("posthog.reset");var h,f=this.get_property(zn),p=this.get_property(Ui),g=this.get_property(It);if(this.consent.reset(),(r=this.persistence)==null||r.clear(),(n=this.sessionPersistence)==null||n.clear(),E(g)||(h=this.persistence)==null||h.register({[It]:g}),(i=this.surveys)==null||i.reset(),(s=this.wn)==null||s.stop(),(o=this.featureFlags)==null||o.reset(),(a=this.conversations)==null||a.reset(),(u=this.logs)==null||u.reset(),(c=this.metrics)==null||c.reset(),(l=this.persistence)==null||l.set_property(Le,Zt),(d=this.sessionManager)==null||d.resetSessionId(),this.sn=null,this.config.cookieless_mode===it)this.register_once({distinct_id:sn,$device_id:null},"");else{var m=this.config.get_device_id(nt());this.register_once({distinct_id:m,$device_id:e?m:f},""),e||E(p)||this.register({[Ui]:p})}this.register({$last_posthog_reset:new Date().toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}shutdown(e){var r=this;return ne((function*(){var n,i,s,o,a;r.__loaded?((n=r.logs)==null||n.flushLogs("sendBeacon"),(i=r.metrics)==null||i.flush("sendBeacon"),(s=r.dn)==null||s.unload(),(o=r.vn)==null||o.unload(),(a=r.featureFlags)==null||a.destroy()):$.uninitializedWarning("posthog.shutdown")}))()}setIdentity(e,r){var n;this.config.identity_distinct_id=e,this.config.identity_hash=r,this.alias(e),(n=this.conversations)==null||n.En()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,(e=this.conversations)==null||e.Rn()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,r;return(e=(r=this.sessionManager)==null?void 0:r.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var r=this.sessionManager.checkAndGetSessionAndWindowId(!0),n=r.sessionStartTimestamp,i=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+r.sessionId);if(e!=null&&e.withTimestamp&&n){var s,o=(s=e.timestampLookBack)!==null&&s!==void 0?s:10;if(!n)return i;i+="?t="+Math.max(Math.floor((new Date().getTime()-n)/1e3)-o,0)}return i}alias(e,r){return e===this.get_property(Lc)?($.critical("Attempting to create alias for existing People user - aborting."),-2):this.Tn("posthog.alias")?(E(r)&&(r=this.get_distinct_id()),e!==r?(this.In(kr,e),this.capture("$create_alias",{alias:e,distinct_id:r})):($.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var r=x({},this.config);if(Y(e)){var n,i,s,o,a,u,c,l,d,h,f;K(this.config,Bu(e));var p=this.hn();(n=this.persistence)==null||n.update_config(this.config,r,p),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Cr(x({},this.config,{persistence:"sessionStorage"}),p,!1);var g=this.an(this.config.debug);Ne(g)&&(this.config.debug=g),Ne(this.config.debug)&&(this.config.debug?(j.DEBUG=!0,V.N()&&V.q("ph_debug",!0),$.info("set_config",{config:e,oldConfig:r,newConfig:x({},this.config)})):(j.DEBUG=!1,V.N()&&V.P("ph_debug"))),(i=this.exceptionObserver)==null||i.onConfigChange(),(s=this.exceptions)==null||s.onConfigChange(),(o=this.sessionRecording)==null||o.startIfEnabledOrStop(),(a=this.tracingHeaders)==null||a.startIfEnabledOrStop(),(u=this.autocapture)==null||u.startIfEnabled(),(c=this.heatmaps)==null||c.startIfEnabled(),(l=this.exceptionObserver)==null||l.startIfEnabledOrStop(),(d=this.deadClicksAutocapture)==null||d.startIfEnabledOrStop(),(h=this.surveys)==null||h.loadIfEnabled(),this.Pn(),(f=this.externalIntegrations)==null||f.startIfEnabledOrStop()}}_overrideSDKInfo(e,r){j.LIB_NAME=e,j.LIB_VERSION=r}startSessionRecording(e){var r,n,i,s,o,a=e===!0,u={sampling:a||!(e==null||!e.sampling),linked_flag:a||!(e==null||!e.linked_flag),url_trigger:a||!(e==null||!e.url_trigger),event_trigger:a||!(e==null||!e.event_trigger)};Object.values(u).some(Boolean)&&((r=this.sessionManager)==null||r.checkAndGetSessionAndWindowId(),u.sampling&&((n=this.sessionRecording)==null||n.overrideSampling()),u.linked_flag&&((i=this.sessionRecording)==null||i.overrideLinkedFlag()),u.url_trigger&&((s=this.sessionRecording)==null||s.overrideTrigger("url")),u.event_trigger&&((o=this.sessionRecording)==null||o.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,r){if(this.exceptions){var n=new Error("PostHog syntheticException"),i=this.exceptions.buildProperties(e,{handled:!0,syntheticException:n});return this.exceptions.sendExceptionEvent(x({},i,r))}}addExceptionStep(e,r){var n;(n=this.exceptions)==null||n.addExceptionStep(e,r)}captureLog(e){var r;(r=this.logs)==null||r.captureLog(e)}get logger(){var e,r;return(e=(r=this.logs)==null?void 0:r.logger)!==null&&e!==void 0?e:t.On}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var r,n;return(r=(n=this.toolbar)==null?void 0:n.loadToolbar(e))!==null&&r!==void 0&&r}get_property(e){var r;return(r=this.persistence)==null?void 0:r.props[e]}getSessionProperty(e){var r;return(r=this.sessionPersistence)==null?void 0:r.props[e]}toString(){var e,r=(e=this.config.name)!==null&&e!==void 0?e:Bt;return r!==Bt&&(r=Bt+"."+r),r}_isIdentified(){var e,r;return((e=this.persistence)==null?void 0:e.get_property(Le))===Nt||((r=this.sessionPersistence)==null?void 0:r.get_property(Le))===Nt}Cn(){var e,r;return!(this.config.person_profiles==="never"||this.config.person_profiles===qs&&!this._isIdentified()&&pt(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[kr])&&((r=this.persistence)==null||(r=r.props)==null||!r[An]))}xn(){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.Cn()||this.Tn("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Tn("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Tn(e){return this.config.person_profiles==="never"?($.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.In(An,!0),!0)}hn(){if(this.config.cookieless_mode==="always")return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==Rt)}Pn(){var e,r,n,i,s=this.hn();return((e=this.persistence)==null?void 0:e.yr)!==s&&((n=this.persistence)==null||n.set_disabled(s)),((r=this.sessionPersistence)==null?void 0:r.yr)!==s&&((i=this.sessionPersistence)==null||i.set_disabled(s)),s}opt_in_capturing(e){var r;if(this.config.cookieless_mode!==it){if(this.Yi()){var n,i,s,o,a;this.reset(!0),(n=this.sessionManager)==null||n.destroy(),(i=this.pageViewManager)==null||i.destroy(),this.sessionManager=new Vn(this),this.pageViewManager=new Zn(this),this.persistence&&(this.sessionPropsManager=new Gn(this,this.sessionManager,this.persistence));var u,c=(s=(o=this.config.__extensionClasses)==null?void 0:o.sessionRecording)!==null&&s!==void 0?s:(a=t.__defaultExtensionClasses)==null?void 0:a.sessionRecording;c&&(this.sessionRecording=this.Ji(this.sessionRecording,new c(this)),this.yn&&((u=this.sessionRecording)==null||u.onRemoteConfig==null||u.onRemoteConfig(this.yn)))}var l,d;this.consent.optInOut(!0),this.Pn(),this.bn(),(r=this.sessionRecording)==null||r.startIfEnabledOrStop(),this.config.cookieless_mode==Rt&&((l=this.surveys)==null||l.loadIfEnabled()),(E(e?.captureEventName)||e!=null&&e.captureEventName)&&this.capture((d=e?.captureEventName)!==null&&d!==void 0?d:"$opt_in",e?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._n()}else $.warn(Uu)}opt_out_capturing(){var e,r,n;this.config.cookieless_mode!==it?(this.config.cookieless_mode===Rt&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.Pn(),this.config.cookieless_mode===Rt&&(this.register({distinct_id:sn,$device_id:null}),(e=this.sessionRecording)==null||e.stopRecording(),this.sessionRecording=void 0,(r=this.sessionManager)==null||r.destroy(),(n=this.pageViewManager)==null||n.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this._n(),this.bn())):$.warn(Uu)}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===1?"granted":e===0?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===it||(this.config.cookieless_mode===Rt?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Pn()}_is_bot(){return _e?zl(_e,this.config.custom_blocked_useragents):void 0}_n(){P&&(P.visibilityState==="visible"?this.tn||(this.tn=!0,this.capture(Ht,{title:P.title},{send_instantly:!0}),this.rn&&(P.removeEventListener(On,this.rn),this.rn=null)):this.rn||(this.rn=this._n.bind(this),re(P,On,this.rn)))}debug(e){e===!1?(_?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(_?.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}))}Ur(){var e=this.ln||{};return"advanced_disable_flags"in e?!!e.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?($.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(function(r,n,i,s,o){var a=n in r&&!F(r[n]),u=i in r&&!F(r[i]);return a?r[n]:!!u&&(o&&o.warn("Config field '"+i+"' is deprecated. Please use '"+n+"' instead. The old field will be removed in a future major version."),r[i])})(e,"advanced_disable_flags","advanced_disable_decide",0,$)}wt(e){var r;if(F(this.config.before_send))return e;var n=Object.keys((r=e.properties)!==null&&r!==void 0?r:{}).filter(tp),i=O(this.config.before_send)?this.config.before_send:[this.config.before_send],s=e;for(var o of i){if(s=o(s),F(s)){var a="Event '"+e.event+"' was rejected in beforeSend function";return ep(e.event)?$.warn(a+". This can cause unexpected behavior."):$.info(a),null}s.properties&&!pt(s.properties)||$.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}for(var u of n)if(s.properties&&F(s.properties[u]))return $.warn("Event '"+e.event+"' had its '"+u+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return s}getPageViewId(){var e;return(e=this.pageViewManager.ir)==null?void 0:e.pageViewId}captureTraceFeedback(e,r){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:r})}captureTraceMetric(e,r,n){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:r,$ai_metric_value:String(n)})}an(e){var r=Ne(e)&&!e,n=V.N()&&V.A("ph_debug")==="true";return!r&&(!!n||e)}};Ot.__defaultExtensionClasses={},Ot.On=(()=>{var t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),(function(t,e){for(var r=0;e.length>r;r++)t.prototype[e[r]]=Ip(t.prototype[e[r]])})(Ot,["identify"]);var Wn=class{constructor(e){this.disabled=e===!1;var r=Y(e)?e:{};this.thresholdPx=r.threshold_px||30,this.timeoutMs=r.timeout_ms||1e3,this.clickCount=r.click_count||3,this.clicks=[]}isRageClick(e,r,n){if(this.disabled)return!1;var i=this.clicks[this.clicks.length-1];if(i&&Math.abs(e-i.x)+Math.abs(r-i.y)<this.thresholdPx&&this.timeoutMs>n-i.timestamp){if(this.clicks.push({x:e,y:r,timestamp:n}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:r,timestamp:n}];return!1}},rs="$copy_autocapture",ns=X("[AutoCapture]");function is(t,e){return e.length>t?e.slice(0,t)+"...":e}function Ef(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do e=e.previousSibling;while(e&&!gt(e));return e}function $f(t,e){var r,n,i=e.e,s=e.maskAllElementAttributes,o=e.maskAllText,a=e.elementAttributeIgnoreList,u=e.elementsChainAsString,c=e.disableCaptureUrlHashes;if(!gt(t))return{props:{}};for(var l=[t],d=new Set([t]),h=t;h.parentNode&&!$e(h,"body")&&el>l.length;)if(Qc(h.parentNode)){var f=h.parentNode.host;if(d.has(f))break;d.add(f),l.push(f),h=f}else{if(!gt(h.parentNode)||d.has(h.parentNode))break;d.add(h.parentNode),l.push(h.parentNode),h=h.parentNode}var p,g,m=[],v={},w=!1,y=!1;if(B(l,(b=>{var S=Qs(b);if($e(b,"a")){var z=b.getAttribute("href");w=!!(S&&z&&Rr(z))&&(c?ft(z):z)}A(Fn(b),"ph-no-capture")&&(y=!0),m.push((function(I,Z,Q,G,N){N===void 0&&(N=!1);var q=I.tagName.toLowerCase(),J={tag_name:q};Oo.indexOf(q)>-1&&!Q&&(J.$el_text=q.toLowerCase()==="a"||q.toLowerCase()==="button"?is(1024,Cu(I)):is(1024,Lr(I)));var we=Fn(I);we.length>0&&(J.classes=we.filter((function(ee){return ee!==""}))),B(I.attributes,(function(ee){var oe;if((!sl(I)||["name","id","class","aria-label"].indexOf(ee.name)!==-1)&&(G==null||!G.includes(ee.name))&&!Z&&Rr(ee.value)&&(!H(oe=ee.name)||oe.substring(0,10)!=="_ngcontent"&&oe.substring(0,7)!=="_nghost")){var ae=ee.value;ee.name==="class"&&(ae=Ao(ae).join(" ")),J["attr__"+ee.name]=is(1024,ee.name==="href"&&N?ft(ae):ae)}}));for(var Pe=1,ye=1,ke=I;ke=Ef(ke);)Pe++,ke.tagName===I.tagName&&ye++;return J.nth_child=Pe,J.nth_of_type=ye,J})(b,s,o,a,c));var L=(function(I){if(!Qs(I))return{};var Z={};return B(I.attributes,(function(Q){if(Q.name&&Q.name.indexOf("data-ph-capture-attribute")===0){var G=Q.name.replace("data-ph-capture-attribute-",""),N=Q.value;G&&N&&Rr(N)&&(Z[G]=N)}})),Z})(b);K(v,L)})),y)return{props:{},explicitNoCapture:y};if(o||(m[0].$el_text=$e(t,"a")||$e(t,"button")?Cu(t):Lr(t)),w){var k,T;m[0].attr__href=w;var M=(k=Nn(w))==null?void 0:k.host,R=_==null||(T=_.location)==null?void 0:T.host;M&&R&&M!==R&&(p=w)}return{props:K({$event_type:i.type,$ce_version:1},u?{}:{$elements:m},{$elements_chain:(g=m,(function(b){return b.map((S=>{var z,L,I="";if(S.tag_name&&(I+=S.tag_name),S.attr_class)for(var Z of(S.attr_class.sort(),S.attr_class))I+="."+Z.replace(/"/g,"");var Q=x({},S.text?{text:S.text}:{},{"nth-child":(z=S.nth_child)!==null&&z!==void 0?z:0,"nth-of-type":(L=S.nth_of_type)!==null&&L!==void 0?L:0},S.href?{href:S.href}:{},S.attr_id?{attr_id:S.attr_id}:{},S.attributes),G={};return vn(Q).sort(((N,q)=>N[0].localeCompare(q[0]))).forEach((N=>{var q=N[1];return G[Iu(N[0].toString())]=Iu(q.toString())})),(I+=":")+vn(G).map((N=>N[0]+'="'+N[1]+'"')).join("")})).join(";")})((function(b){return b.map((S=>{var z,L,I={text:(z=S.$el_text)==null?void 0:z.slice(0,400),tag_name:S.tag_name,href:(L=S.attr__href)==null?void 0:L.slice(0,2048),attr_class:Wp(S),attr_id:S.attr__id,nth_child:S.nth_child,nth_of_type:S.nth_of_type,attributes:{}};return vn(S).filter((Z=>Z[0].indexOf("attr__")===0)).forEach((Z=>I.attributes[Z[0]]=Z[1])),I}))})(g)))},(r=m[0])!=null&&r.$el_text?{$el_text:(n=m[0])==null?void 0:n.$el_text}:{},p&&i.type==="click"?{$external_click_url:p}:{},v)}}var br=X("[ExceptionAutocapture]"),Gu=()=>{},Sf=X("[TracingHeaders]"),$t=X("[Web Vitals]"),Vu=9e5,qu="disabled",Ku="lazy_loading",xr="awaiting_config",dn="missing_config";X("[SessionRecording]"),X("[SessionRecording]");var vo="[SessionRecording]",Xe=X(vo),Pf=X("[Heatmaps]");function ss(t){return Y(t)&&"clientX"in t&&"clientY"in t&&de(t.clientX)&&de(t.clientY)}var os=X("[Product Tours]"),as=t=>{var e;return!t.config.disable_product_tours&&!((e=t.persistence)==null||!e.get_property(zo))},Tf=["$set_once","$set"],Be=X("[SiteApps]"),Wu="Error while initializing PostHog app with config id ";function jt(t,e,r){if(F(t))return!1;switch(r){case"exact":return t===e;case"contains":var n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(n,"i").test(t);case"regex":try{return new RegExp(e).test(t)}catch{return!1}default:return!1}}var mo=class{constructor(e){this.Fn=new Dr,this.Ln=(r,n)=>this.$n(r,n)&&this.An(r,n)&&this.Nn(r,n)&&this.Dn(r,n),this.$n=(r,n)=>n==null||!n.event||r?.event===n?.event,this._instance=e,this.qn=new Set,this.jn=new Set}init(){var e,r;E((e=this._instance)==null?void 0:e._addCaptureHook)||(r=this._instance)==null||r._addCaptureHook(((n,i)=>{this.on(n,i)}))}register(e){var r,n;if(!E((r=this._instance)==null?void 0:r._addCaptureHook)&&(e.forEach((o=>{var a,u;(a=this.jn)==null||a.add(o),(u=o.steps)==null||u.forEach((c=>{var l;(l=this.qn)==null||l.add(c?.event||"")}))})),(n=this._instance)!=null&&n.autocapture)){var i,s=new Set;e.forEach((o=>{var a;(a=o.steps)==null||a.forEach((u=>{u!=null&&u.selector&&s.add(u?.selector)}))})),(i=this._instance)==null||i.autocapture.setElementSelectors(s)}}on(e,r){var n;r!=null&&e.length!=0&&(this.qn.has(e)||this.qn.has(r.event))&&this.jn&&((n=this.jn)==null?void 0:n.size)>0&&this.jn.forEach((i=>{this.Hn(r,i)&&this.Fn.emit("actionCaptured",i.name)}))}Bn(e){this.onAction("actionCaptured",(r=>e(r)))}Hn(e,r){if(r?.steps==null)return!1;for(var n of r.steps)if(this.Ln(e,n))return!0;return!1}onAction(e,r){return this.Fn.on(e,r)}An(e,r){if(r!=null&&r.url){var n,i=e==null||(n=e.properties)==null?void 0:n.$current_url;if(!i||typeof i!="string"||!jt(i,r.url,r.url_matching||"contains"))return!1}return!0}Nn(e,r){return!!this.Un(e,r)&&!!this.zn(e,r)&&!!this.Vn(e,r)}Un(e,r){var n;if(r==null||!r.href)return!0;var i=this.Wn(e);if(i.length>0)return i.some((a=>jt(a.href,r.href,r.href_matching||"exact")));var s,o=(e==null||(n=e.properties)==null?void 0:n.$elements_chain)||"";return!!o&&jt((s=o.match(/(?::|")href="(.*?)"/))?s[1]:"",r.href,r.href_matching||"exact")}zn(e,r){var n;if(r==null||!r.text)return!0;var i=this.Wn(e);if(i.length>0)return i.some((c=>jt(c.text,r.text,r.text_matching||"exact")||jt(c.$el_text,r.text,r.text_matching||"exact")));var s,o,a,u=(e==null||(n=e.properties)==null?void 0:n.$elements_chain)||"";return!!u&&(s=(function(c){for(var l,d=[],h=/(?::|")text="(.*?)"/g;!F(l=h.exec(c));)d.includes(l[1])||d.push(l[1]);return d})(u),o=r.text,a=r.text_matching||"exact",s.some((c=>jt(c,o,a))))}Vn(e,r){var n,i;if(r==null||!r.selector)return!0;var s=e==null||(n=e.properties)==null?void 0:n.$element_selectors;if(s!=null&&s.includes(r.selector))return!0;var o=(e==null||(i=e.properties)==null?void 0:i.$elements_chain)||"";if(r.selector_regex&&o)try{return new RegExp(r.selector_regex).test(o)}catch{return!1}return!1}Wn(e){var r;return(e==null||(r=e.properties)==null?void 0:r.$elements)==null?[]:e?.properties.$elements}Dn(e,r){return r==null||!r.properties||r.properties.length===0||Il(r.properties.reduce(((n,i)=>{var s=O(i.value)?i.value.map(String):i.value!=null?[String(i.value)]:[];return n[i.key]={values:s,operator:i.operator||"exact"},n}),{}),e?.properties)}},yo=class{constructor(e){var r;this.Zn=[],this._instance=e,this.Gn=new Map,this.Qn=new Map,this.Jn=new Map,(r=this._instance)==null||r.onSessionId==null||r.onSessionId((n=>this.Kn(n)))}Yn(e,r){return!!e&&Il(e.propertyFilters,r?.properties)}Xn(e,r){var n=new Map;return e.forEach((i=>{var s;(s=i.conditions)==null||(s=s[r])==null||(s=s.values)==null||s.forEach((o=>{if(o!=null&&o.name){var a=n.get(o.name)||[];a.push(i.id),n.set(o.name,a)}}))})),n}es(e,r,n){var i=(n===fr.Activation?this.Gn:this.Qn).get(e),s=[];return this.ts((o=>{s=o.filter((a=>i?.includes(a.id)))})),s.filter((o=>{var a,u=(a=o.conditions)==null||(a=a[n])==null||(a=a.values)==null?void 0:a.find((c=>c.name===e));return this.Yn(u,r)}))}register(e){var r;E((r=this._instance)==null?void 0:r._addCaptureHook)||(this.rs(e),this.ns(e))}ns(e){var r=e.filter((n=>{var i,s;return((i=n.conditions)==null?void 0:i.actions)&&((s=n.conditions)==null||(s=s.actions)==null||(s=s.values)==null?void 0:s.length)>0}));r.length!==0&&(this.ss==null&&(this.ss=new mo(this._instance),this.ss.init(),this.ss.Bn((n=>{this.onAction(n)}))),r.forEach((n=>{var i,s,o,a,u;n.conditions&&(i=n.conditions)!=null&&i.actions&&(s=n.conditions)!=null&&(s=s.actions)!=null&&s.values&&((o=n.conditions)==null||(o=o.actions)==null||(o=o.values)==null?void 0:o.length)>0&&((a=this.ss)==null||a.register(n.conditions.actions.values),(u=n.conditions)==null||(u=u.actions)==null||(u=u.values)==null||u.forEach((c=>{if(c&&c.name){var l=this.Jn.get(c.name);l&&l.push(n.id),this.Jn.set(c.name,l||[n.id])}})))})))}rs(e){var r,n=e.filter((s=>{var o,a;return((o=s.conditions)==null?void 0:o.events)&&((a=s.conditions)==null||(a=a.events)==null||(a=a.values)==null?void 0:a.length)>0})),i=e.filter((s=>{var o,a;return((o=s.conditions)==null?void 0:o.cancelEvents)&&((a=s.conditions)==null||(a=a.cancelEvents)==null||(a=a.values)==null?void 0:a.length)>0}));n.length===0&&i.length===0||((r=this._instance)==null||r._addCaptureHook(((s,o)=>{this.onEvent(s,o)})),this.Gn=this.Xn(e,fr.Activation),this.Qn=this.Xn(e,fr.Cancellation))}onEvent(e,r){var n,i,s=this.os(),o=(r==null||(n=r.properties)==null?void 0:n.$survey_id)||(r==null||(i=r.properties)==null?void 0:i.$product_tour_id);if(o&&this.getActivatedIds().includes(o)){var a=this.ls(e,o);if(a==="consume")return s.info("event consumed activated item, removing it",{event:e,itemId:o}),void this.us([o]);if(a==="persist")return s.info("shown item promoted to persisted activation",{event:e,itemId:o}),void this.hs(o)}if(this.Qn.has(e)){var u=this.es(e,r,fr.Cancellation);u.length>0&&(s.info("cancel event matched, cancelling items",{event:e,itemsToCancel:u.map((l=>l.id))}),this.us(u.map((l=>l.id))),u.forEach((l=>this.ds(l.id))))}if(this.Gn.has(e)){s.info("event name matched",{event:e,eventPayload:r,items:this.Gn.get(e)});var c=this.es(e,r,fr.Activation);this.cs(c.map((l=>l.id)))}}onAction(e){this.Jn.has(e)&&this.cs(this.Jn.get(e)||[])}cs(e){e.length!==0&&(this.Zn=[...new Set([...this.Zn,...e])],this.os().info("updating activated items",{activatedItems:this.getActivatedIds()}))}hs(e){this.Zn=this.Zn.filter((n=>n!==e));var r=this.vs();r.includes(e)||(this.fs([...r,e]),this.ps())}us(e){var r=new Set(e);this.Zn=this.Zn.filter((s=>!r.has(s)));var n=this.gs(),i=n.filter((s=>!r.has(s)));i.length!==n.length&&(this.fs(i),i.length===0&&this.ys())}gs(){var e,r=this.bs();return((e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[r])||[]}vs(){var e,r,n=this.gs();if(n.length===0)return[];var i=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[this._s()],s=(r=this._instance)==null||r.get_session_id==null?void 0:r.get_session_id();return s&&i===s?n:[]}ps(){var e,r=(e=this._instance)==null||e.get_session_id==null?void 0:e.get_session_id();r&&this.ws(r)}ys(){this.xs()}Kn(e){var r,n=(r=this._instance)==null||(r=r.persistence)==null?void 0:r.props[this._s()];n&&n!==e&&(this.gs().length>0&&this.fs([]),this.ys())}getActivatedIds(){return[...new Set([...this.vs(),...this.Zn])].filter((e=>!this.ks(e)))}reset(){this.Zn=[],this.gs().length>0&&this.fs([]),this.ys()}getEventToItemsMap(){return this.Gn}Ss(){return this.ss}},bo=class extends yo{constructor(e){super(e)}bs(){return Ds}_s(){return _n}Cs(){return ot.SHOWN}ts(e){var r;(r=this._instance)==null||r.getSurveys(e)}ds(e){var r;(r=this._instance)==null||r.cancelPendingSurvey(e)}os(){return U}fs(e){var r;(r=this._instance)==null||(r=r.persistence)==null||r.register({[Ds]:e})}ws(e){var r;(r=this._instance)==null||(r=r.persistence)==null||r.register({[_n]:e})}xs(){var e;(e=this._instance)==null||(e=e.persistence)==null||e.unregister(_n)}ks(){return!1}ls(e,r){var n;this.ts((s=>{n=s.find((o=>o.id===r))}));var i=!n||(function(s){var o;return Al(s)&&!((o=s.conditions)==null||(o=o.events)==null||!o.repeatedActivation)||s.schedule==="always"})(n);return i?e===ot.SHOWN?"consume":"ignore":e===ot.SHOWN?"persist":e===ot.DISMISSED||e===ot.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},hn="SDK is not enabled or survey functionality is not yet loaded",Ju="Disabled. Not loading surveys.",zf=_!=null&&_.location?Dn(_.location.hash,"__posthog")||Dn(location.hash,"state"):null,Yu="_postHogToolbarParams",Xu=X("[Toolbar]"),se=X("[FeatureFlags]"),St=X("[FeatureFlags]",{debugEnabled:!0}),us=`" failed. Feature flags didn't load in time.`,Qu=t=>{for(var e={},r=0;t.length>r;r++)e[t[r]]=!0;return e},ec=t=>{var e={};for(var r of vn(t||{})){var n=r[1];n&&(e[r[0]]=n)}return e},Qe=X("[Error tracking]"),tc="Refusing to render web experiment since the viewer is a likely bot",Rf={icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())===-1,regex:(t,e)=>qn(e,t),not_regex:(t,e)=>!qn(e,t),exact:(t,e)=>e===t,is_not:(t,e)=>e!==t},xo=class t{get Te(){return this._instance.config}constructor(e){var r=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(n){n===void 0&&(n=!1),r.getWebExperiments((i=>{t.Ts("retrieved web experiments from the server"),r.Is=new Map,i.forEach((s=>{if(s.feature_flag_key){var o;r.Is&&(t.Ts("setting flag key ",s.feature_flag_key," to web experiment ",s),(o=r.Is)==null||o.set(s.feature_flag_key,s));var a=r._instance.getFeatureFlag(s.feature_flag_key);H(a)&&s.variants[a]&&r.Ms(s.name,a,s.variants[a].transforms)}else if(s.variants)for(var u in s.variants){var c=s.variants[u];t.Es(c,r._instance)&&r.Ms(s.name,u,c.transforms)}}))}),n)},this._instance=e,this._instance.onFeatureFlags((n=>{this.onFeatureFlags(n)}))}initialize(){}onFeatureFlags(e){if(this._is_bot())t.Ts(tc);else if(!this.Te.disable_web_experiments){if(F(this.Is))return this.Is=new Map,this.loadIfEnabled(),void this.previewWebExperiment();t.Ts("applying feature flags",e),e.forEach((r=>{var n;if(this.Is&&(n=this.Is)!=null&&n.has(r)){var i,s=this._instance.getFeatureFlag(r),o=(i=this.Is)==null?void 0:i.get(r);s&&o!=null&&o.variants[s]&&this.Ms(o.name,s,o.variants[s].transforms)}}))}}previewWebExperiment(){var e=t.getWindowLocation();if(e!=null&&e.search){var r=Xt(e?.search,"__experiment_id"),n=Xt(e?.search,"__experiment_variant");r&&n&&(t.Ts("previewing web experiments "+r+" && "+n),this.getWebExperiments((i=>{this.Rs(parseInt(r),n,i)}),!1,!0))}}loadIfEnabled(){this.Te.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,r,n){if(this.Te.disable_web_experiments&&!n)return e([]);var i=this._instance.get_property("$web_experiments");if(i&&!r)return e(i);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Te.token),method:"GET",timestampMode:"query",callback:s=>e(s.statusCode===200&&s.json&&s.json.experiments||[])})}Rs(e,r,n){var i=n.filter((s=>s.id===e));i&&i.length>0&&(t.Ts("Previewing web experiment ["+i[0].name+"] with variant ["+r+"]"),this.Ms(i[0].name,r,i[0].variants[r].transforms))}static Es(e,r){return!F(e.conditions)&&t.Ps(e,r)&&t.Os(e)}static Ps(e,r){var n;if(F(e.conditions)||F((n=e.conditions)==null?void 0:n.url))return!0;var i=t.getWindowLocation();if(i){var s,o,a,u=Jc(r,i.href);return(s=e.conditions)==null||!s.url||Rf[(o=(a=e.conditions)==null?void 0:a.urlMatchType)!==null&&o!==void 0?o:"icontains"](e.conditions.url,u)}return!1}static getWindowLocation(){return _?.location}static Os(e){var r;if(F(e.conditions)||F((r=e.conditions)==null?void 0:r.utm))return!0;var n=pl();if(n.utm_source){var i,s,o,a,u,c,l,d,h=(i=e.conditions)==null||(i=i.utm)==null||!i.utm_campaign||((s=e.conditions)==null||(s=s.utm)==null?void 0:s.utm_campaign)==n.utm_campaign,f=(o=e.conditions)==null||(o=o.utm)==null||!o.utm_source||((a=e.conditions)==null||(a=a.utm)==null?void 0:a.utm_source)==n.utm_source,p=(u=e.conditions)==null||(u=u.utm)==null||!u.utm_medium||((c=e.conditions)==null||(c=c.utm)==null?void 0:c.utm_medium)==n.utm_medium,g=(l=e.conditions)==null||(l=l.utm)==null||!l.utm_term||((d=e.conditions)==null||(d=d.utm)==null?void 0:d.utm_term)==n.utm_term;return h&&p&&g&&f}return!1}static Ts(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;r>i;i++)n[i-1]=arguments[i];$.info("[WebExperiments] "+e,n)}Ms(e,r,n){this._is_bot()?t.Ts(tc):r!=="control"?n.forEach((i=>{if(i.selector){var s;t.Ts("applying transform of variant "+r+" for experiment "+e+" ",i);var o=(s=document)==null?void 0:s.querySelectorAll(i.selector);o?.forEach((a=>{var u=a;i.html&&(u.innerHTML=i.html),i.css&&u.setAttribute("style",i.css)}))}})):t.Ts("Control variants leave the page unmodified.")}_is_bot(){return _e&&this._instance?zl(_e,this.Te.custom_blocked_useragents):void 0}},Ie=X("[Conversations]"),Pt="Conversations not available yet.",rc="console",Xn={featureFlags:class{constructor(t){this.Fs=!1,this.Ls=!1,this.$s=!1,this.As=!1,this.Ns=!1,this.Ds=!1,this.qs=!1,this.js=!1,this.Hs=0,this.Bs=()=>{var e=this.Us();this.Hs=0,e&&this.reloadFeatureFlags()},this._instance=t,this.featureFlagEventHandlers=[],_&&re(_,"online",this.Bs)}destroy(){_?.removeEventListener("online",this.Bs)}get Te(){return this._instance.config}get mi(){return this._instance.persistence}zs(t){return this._instance.get_property(t)}Vs(){var t,e;return(t=(e=this.mi)==null?void 0:e._r(this.Te.feature_flag_cache_ttl_ms))!==null&&t!==void 0&&t}Ws(){return!!this.Vs()&&(this.js||this.$s||(this.js=!0,se.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Zs(){var t,e=(t=this.Te.evaluation_contexts)!==null&&t!==void 0?t:this.Te.evaluation_environments;return!this.Te.evaluation_environments||this.Te.evaluation_contexts||this.qs||(se.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.qs=!0),e!=null&&e.length?e.filter((r=>{var n=r&&typeof r=="string"&&r.trim().length>0;return n||se.error("Invalid evaluation context found:",r,"Expected non-empty string"),n})):[]}Gs(){return this.Zs().length>0}Qs(){var t=this.Te.flag_keys;if(!E(t)){if(O(t))return t.filter((e=>{var r=e&&typeof e=="string"&&e.trim().length>0;return r||se.error("Invalid flag key found:",e,"Expected non-empty string"),r}));se.error("Invalid flag_keys found:",t,"Expected array of non-empty strings")}}initialize(){var t,e,r=this._instance.config,n=(t=(e=r.bootstrap)==null?void 0:e.featureFlags)!==null&&t!==void 0?t:{};if(Object.keys(n).length){var i,s,o=(i=(s=r.bootstrap)==null?void 0:s.featureFlagPayloads)!==null&&i!==void 0?i:{},a=Object.keys(n).filter((c=>!!n[c])).reduce(((c,l)=>(c[l]=n[l]||!1,c)),{}),u=Object.keys(o).filter((c=>a[c])).reduce(((c,l)=>(o[l]&&(c[l]=o[l]),c)),{});this.receivedFeatureFlags({featureFlags:a,featureFlagPayloads:u})}}updateFlags(t,e,r){var n,i,s=r!=null&&r.merge&&(n=this.zs(Ct))!==null&&n!==void 0?n:{},o=r!=null&&r.merge&&(i=this.zs(gn))!==null&&i!==void 0?i:{},a=x({},s,t),u=x({},o,e),c={};for(var l of Object.entries(a)){var d=l[0],h=l[1];c[d]={key:d,enabled:cu(h),variant:lu(h),reason:void 0,metadata:E(u?.[d])?void 0:{id:0,version:void 0,description:void 0,payload:u[d]}}}this.receivedFeatureFlags({flags:c})}get hasLoadedFlags(){return this.Ls}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.zs(Ls),e=this.zs(tt),r=this.zs(Ut);if(!r&&!e)return t||{};var n=K({},t||{}),i=[...new Set([...Object.keys(r||{}),...Object.keys(e||{})])];for(var s of i){var o,a,u=n[s],c=e?.[s],l=E(c)?(o=u?.enabled)!==null&&o!==void 0&&o:!!c,d=E(c)?u.variant:typeof c=="string"?c:void 0,h=r?.[s],f=x({},u,{enabled:l,variant:l?d??u?.variant:void 0});l!==u?.enabled&&(f.original_enabled=u?.enabled),d!==u?.variant&&(f.original_variant=u?.variant),h&&(f.metadata=x({},u?.metadata,{payload:h,original_payload:u==null||(a=u.metadata)==null?void 0:a.payload})),n[s]=f}return this.Fs||(se.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:r,finalDetails:n}),this.Fs=!0),n}getAllFeatureFlags(){var t=this.getFlagVariants(),e=this.getFlagPayloads();return Object.keys(t).map((r=>{var n=t[r];return{key:r,enabled:cu(n),variant:lu(n),payload:uu(e[r])}}))}getFlagVariants(){var t=this.zs(Ct),e=this.zs(tt);if(!e)return t||{};for(var r=K({},t),n=Object.keys(e),i=0;n.length>i;i++)r[n[i]]=e[n[i]];return this.Fs||(se.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:r}),this.Fs=!0),r}getFlagPayloads(){var t=this.zs(gn),e=this.zs(Ut);if(!e)return t||{};for(var r=K({},t||{}),n=Object.keys(e),i=0;n.length>i;i++)r[n[i]]=e[n[i]];return this.Fs||(se.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:r}),this.Fs=!0),r}reloadFeatureFlags(){this.As||this.Te.advanced_disable_feature_flags||this.Us()||this.Js||(this._instance.en.emit("featureFlagsReloading",!0),this.Js=setTimeout((()=>{this.Ks()}),5))}Ys(){clearTimeout(this.Js),this.Js=void 0}ensureFlagsLoaded(){this.Ls||this.$s||this.Js||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.As=t}Ks(t){var e;if(this.Ys(),!this._instance.Ur()&&!this.Us())if(this.$s)this.Ns=!0;else{var r=this.Te.token,n=this.zs(zn),i={token:r,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:x({},((e=this.mi)==null?void 0:e.get_initial_props())||{},this.zs(Tt)||{},{$lib:j.LIB_NAME,$lib_version:j.LIB_VERSION}),group_properties:this.zs(zt),timezone:yl()};me(n)||E(n)||(i.$device_id=n),(t!=null&&t.disableFlags||this.Te.advanced_disable_feature_flags)&&(i.disable_flags=!0),this.Gs()&&(i.evaluation_contexts=this.Zs());var s=this.Qs();E(s)||(i.flag_keys=s);var o=!!this.Te.advanced_only_evaluate_survey_feature_flags,a=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Te.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.$s=!0,this._instance._send_request({method:"POST",url:a,data:i,compression:this.Te.disable_compression?void 0:ge.Base64,timestampMode:"body",timeout:this.Te.feature_flag_request_timeout_ms,callback:u=>{var c,l,d,h=!0;if(this.Xs(u.statusCode),u.statusCode===200&&(this.Ns||(this.$anon_distinct_id=void 0),h=!1),this.$s=!1,!i.disable_flags||this.Ns){this.Ds=!h;var f=[];u.error?u.error instanceof Error?f.push(u.error.name==="AbortError"?"timeout":"connection_error"):f.push("unknown_error"):u.statusCode!==200&&f.push("api_error_"+u.statusCode),(c=u.json)!=null&&c.errorsWhileComputingFlags&&f.push("errors_while_computing_flags");var p,g=!((l=u.json)==null||(l=l.quotaLimited)==null||!l.includes("feature_flags"));g&&f.push("quota_limited"),(d=this.mi)==null||d.register({[Us]:f}),g?se.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):(i.disable_flags||this.receivedFeatureFlags((p=u.json)!==null&&p!==void 0?p:{},h,{partialResponse:o}),this.Ns&&(this.Ns=!1,this.Ks()))}}})}}Us(){return dl(this.Hs,3)}Xs(t){this.Hs=hl(t,this.Hs,3,(()=>se.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes.")))}getFeatureFlag(t,e){var r;if(e===void 0&&(e={}),!e.fresh||this.Ds)if(this.Ls||this.getFlags()&&this.getFlags().length>0){if(!this.Ws()){var n=this.getFeatureFlagResult(t,e);return(r=n?.variant)!==null&&r!==void 0?r:n?.enabled}}else se.warn('getFeatureFlag for key "'+t+us)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var e=this.getFeatureFlagResult(t,{send_event:!1});return e?.payload}getFeatureFlagResult(t,e){if(e===void 0&&(e={}),!e.fresh||this.Ds)if(this.Ls||this.getFlags()&&this.getFlags().length>0){if(!this.Ws()){var r=this.getFlagVariants(),n=t in r,i=r[t],s=this.getFlagPayloads()[t],o=String(i),a=this.zs(Zs)||void 0,u=this.zs(Fr)||void 0,c=this.zs(zr)||{};if(this.Te.advanced_feature_flags_dedup_per_session){var l,d=this._instance.get_session_id(),h=this.zs(js);d&&d!==h&&(c={},(l=this.mi)==null||l.register({[zr]:c,[js]:d}))}if((e.send_event||!("send_event"in e))&&(!(t in c)||!c[t].includes(o))){var f,p,g,m,v,w,y,k,T,M,R;O(c[t])?c[t].push(o):c[t]=[o],(f=this.mi)==null||f.register({[zr]:c});var b=this.getFeatureFlagDetails(t),S=[...(p=this.zs(Us))!==null&&p!==void 0?p:[]];E(i)&&S.push("flag_missing");var z={$feature_flag:t,$feature_flag_response:i,$feature_flag_payload:s||null,$feature_flag_request_id:a,$feature_flag_evaluated_at:u,$feature_flag_bootstrapped_response:((g=this.Te.bootstrap)==null||(g=g.featureFlags)==null?void 0:g[t])||null,$feature_flag_bootstrapped_payload:((m=this.Te.bootstrap)==null||(m=m.featureFlagPayloads)==null?void 0:m[t])||null,$used_bootstrap_value:!this.Ds};E(b==null||(v=b.metadata)==null?void 0:v.has_experiment)||(z.$feature_flag_has_experiment=b.metadata.has_experiment),E(b==null||(w=b.metadata)==null?void 0:w.version)||(z.$feature_flag_version=b.metadata.version);var L,I=(y=b==null||(k=b.reason)==null?void 0:k.description)!==null&&y!==void 0?y:b==null||(T=b.reason)==null?void 0:T.code;I&&(z.$feature_flag_reason=I),b!=null&&(M=b.metadata)!=null&&M.id&&(z.$feature_flag_id=b.metadata.id),E(b?.original_variant)&&E(b?.original_enabled)||(z.$feature_flag_original_response=E(b.original_variant)?b.original_enabled:b.original_variant),b!=null&&(R=b.metadata)!=null&&R.original_payload&&(z.$feature_flag_original_payload=b==null||(L=b.metadata)==null?void 0:L.original_payload),S.length&&(z.$feature_flag_error=S.join(",")),this._instance.capture("$feature_flag_called",z)}if(n)return{key:t,enabled:!!i,variant:typeof i=="string"?i:void 0,payload:uu(s)}}}else se.warn('getFeatureFlagResult for key "'+t+us)}getRemoteConfigPayload(t,e){var r=this.Te.token,n={distinct_id:this._instance.get_distinct_id(),token:r,person_properties:{$lib:j.LIB_NAME,$lib_version:j.LIB_VERSION}};this.Gs()&&(n.evaluation_contexts=this.Zs());var i=this.Qs();E(i)||(n.flag_keys=i),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:n,compression:this.Te.disable_compression?void 0:ge.Base64,timestampMode:"body",timeout:this.Te.feature_flag_request_timeout_ms,callback(s){var o,a=(o=s.json)==null?void 0:o.featureFlagPayloads;e(a?.[t]||void 0)}})}isFeatureEnabled(t,e){if(e===void 0&&(e={}),e.fresh&&!this.Ds)return e.defaultValue;if(!(this.Ls||this.getFlags()&&this.getFlags().length>0))return se.warn('isFeatureEnabled for key "'+t+us),e.defaultValue;var r=this.getFeatureFlag(t,e);return E(r)?e.defaultValue:!!r}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((e=>e!==t))}receivedFeatureFlags(t,e,r){if(this.mi){this.Ls=!0;var n=this.getFlagVariants(),i=this.getFlagPayloads(),s=this.getFlagsWithDetails();(function(o,a,u,c,l,d){u===void 0&&(u={}),c===void 0&&(c={}),l===void 0&&(l={});var h=(b=>{var S=b.flags;return S?(b.featureFlags=Object.fromEntries(Object.keys(S).map((z=>{var L;return[z,(L=S[z].variant)!==null&&L!==void 0?L:S[z].enabled]}))),b.featureFlagPayloads=Object.fromEntries(Object.keys(S).filter((z=>S[z].enabled)).filter((z=>{var L;return(L=S[z].metadata)==null?void 0:L.payload})).map((z=>{var L;return[z,(L=S[z].metadata)==null?void 0:L.payload]})))):b.featureFlags&&se.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),b})(o),f=h.flags,p=h.featureFlags,g=h.featureFlagPayloads;if(p){var m=o.requestId,v=o.evaluatedAt;if(O(p)){se.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var w={};if(p)for(var y=0;p.length>y;y++)w[p[y]]=!0;a&&a.register({[fn]:p,[Ct]:w,[Rn]:!1})}else{var k=p,T=g,M=f;if(d!=null&&d.partialResponse)k=x({},u,k),T=x({},c,T),M=x({},l,M);else if(o.errorsWhileComputingFlags)if(f){var R=new Set(Object.keys(f).filter((b=>{var S;return!((S=f[b])!=null&&S.failed)})));k=x({},u,Object.fromEntries(Object.entries(k).filter((b=>R.has(b[0]))))),T=x({},c,Object.fromEntries(Object.entries(T||{}).filter((b=>R.has(b[0]))))),M=x({},l,Object.fromEntries(Object.entries(M||{}).filter((b=>R.has(b[0])))))}else k=x({},u,k),T=x({},c,T),M=x({},l,M);a&&a.register(x({[fn]:Object.keys(ec(k)),[Ct]:k||{},[gn]:T||{},[Ls]:M||{},[Rn]:o.minimalFlagCalledEvents===!0},m?{[Zs]:m}:{},v?{[Fr]:v}:{}))}}})(t,this.mi,n,i,s,r),e||(this.js=!1),this.eo(e)}}override(t,e){e===void 0&&(e=!1),se.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this.mi)return se.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(t===!1)return this.mi.unregister(tt),this.mi.unregister(Ut),this.eo(),St.info("All overrides cleared");if(O(t)){var e=Qu(t);return this.mi.register({[tt]:e}),this.eo(),St.info("Flag overrides set",{flags:t})}if(t&&typeof t=="object"&&("flags"in t||"payloads"in t)){var r,n=t;if(this.Fs=!!((r=n.suppressWarning)!==null&&r!==void 0&&r),"flags"in n){if(n.flags===!1)this.mi.unregister(tt),St.info("Flag overrides cleared");else if(n.flags){if(O(n.flags)){var i=Qu(n.flags);this.mi.register({[tt]:i})}else this.mi.register({[tt]:n.flags});St.info("Flag overrides set",{flags:n.flags})}}return"payloads"in n&&(n.payloads===!1?(this.mi.unregister(Ut),St.info("Payload overrides cleared")):n.payloads&&(this.mi.register({[Ut]:n.payloads}),St.info("Payload overrides set",{payloads:n.payloads}))),void this.eo()}if(t&&typeof t=="object")return this.mi.register({[tt]:t}),this.eo(),St.info("Flag overrides set",{flags:t});se.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.Ls){var e=this.ro(),r=e.flags,n=e.flagVariants;try{t(r,n)}catch(i){se.error("Error while running feature flags callback",i)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,r){var n,i=(this.zs($r)||[]).find((u=>u.flagKey===t)),s={["$feature_enrollment/"+t]:e},o={$feature_flag:t,$feature_enrollment:e,$set:s};i&&(o.$early_access_feature_name=i.name),r&&(o.$feature_enrollment_stage=r),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(s,!1);var a=x({},this.getFlagVariants(),{[t]:e});(n=this.mi)==null||n.register({[fn]:Object.keys(ec(a)),[Ct]:a}),this.eo()}getEarlyAccessFeatures(t,e,r){e===void 0&&(e=!1);var n=this.zs($r),i=r?"&"+r.map((s=>"stage="+s)).join("&"):"";if(n&&!e)return t(n);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Te.token+i),method:"GET",timestampMode:"query",callback:s=>{var o,a;if(s.json){var u=s.json.earlyAccessFeatures;return(o=this.mi)==null||o.unregister($r),(a=this.mi)==null||a.register({[$r]:u}),t(u)}}})}ro(){var t=this.getFlags(),e=this.getFlagVariants();return{flags:t.filter((r=>e[r])),flagVariants:Object.keys(e).filter((r=>e[r])).reduce(((r,n)=>(r[n]=e[n],r)),{})}}eo(t){var e=this.ro(),r=e.flags,n=e.flagVariants;this.featureFlagEventHandlers.forEach((i=>{try{i(r,n,{errorsLoading:t})}catch(s){se.error("Error while running feature flags callback",s)}}))}setPersonPropertiesForFlags(t,e){e===void 0&&(e=!0);var r=this.zs(Tt)||{},n=t?.$set||(t!=null&&t.$set_once?{}:t),i=t?.$set_once,s={};if(i)for(var o in i)({}).hasOwnProperty.call(i,o)&&(o in r||(s[o]=i[o]));this._instance.register({[Tt]:x({},r,s,n)}),e&&this._instance.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,e){e===void 0&&(e=!0);var r=x({},this.zs(Tt)||{});t.forEach((n=>{delete r[n]})),this._instance.register({[Tt]:r}),e&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(t){t===void 0&&(t=!0),this._instance.unregister(Tt),t&&this._instance.reloadFeatureFlags()}setGroupPropertiesForFlags(t,e){e===void 0&&(e=!0);var r=this.zs(zt)||{};Object.keys(r).length!==0&&Object.keys(r).forEach((n=>{r[n]=x({},r[n],t[n]),delete t[n]})),this._instance.register({[zt]:x({},r,t)}),e&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var e=this.zs(zt)||{};this._instance.register({[zt]:x({},e,{[t]:{}})})}else this._instance.unregister(zt)}reset(){this.Ls=!1,this.$s=!1,this.As=!1,this.Ns=!1,this.Ds=!1,this.$anon_distinct_id=void 0,this.Ys(),this.Fs=!1,this.Hs=0}}},Cf={sessionRecording:class{get Te(){return this._instance.config}get mi(){return this._instance.persistence}get started(){var t;return!((t=this.io)==null||!t.isStarted)}get status(){var t,e;return this.no===xr||this.no===dn?this.no:(t=(e=this.io)==null?void 0:e.status)!==null&&t!==void 0?t:this.no}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.no=qu,this.so=void 0,this._instance=t,!this._instance.sessionManager)throw Xe.error("started without valid sessionManager"),new Error(vo+" started without valid sessionManager. This is a bug.");if(this.Te.cookieless_mode===it)throw new Error(vo+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get oo(){var t,e=!((t=this._instance.get_property(It))==null||!t.enabled),r=!this.Te.disable_session_recording,n=this.Te.disable_session_recording||this._instance.consent.isOptedOut();return _&&e&&r&&!n}startIfEnabledOrStop(t){var e;if(!this.oo||(e=this.io)==null||!e.isStarted){var r=!E(Object.assign)&&!E(Array.from);this.oo&&r?(this.ao(t),Xe.info("starting")):(this.no=qu,this.stopRecording())}}ao(t){var e,r,n;this.oo&&(this.no!==xr&&this.no!==dn&&(this.no=Ku),C!=null&&(e=C.__PosthogExtensions__)!=null&&(e=e.rrweb)!=null&&e.record&&(r=C.__PosthogExtensions__)!=null&&r.initSessionRecording?this.lo(t):(n=C.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,this.uo,(i=>{if(i)return Xe.error("could not load recorder",i);this.lo(t)})))}stopRecording(){var t,e;(t=this.so)==null||t.call(this),this.so=void 0,(e=this.io)==null||e.stop()}ho(){var t,e;(t=this.so)==null||t.call(this),this.so=void 0,(e=this.io)==null||e.discard()}do(){var t,e;(t=this.mi)==null||t.unregister(Ro),(e=this.mi)==null||e.unregister(Zc)}co(t,e){if(F(t))return null;var r,n=de(t)?t:parseFloat(t);return typeof(r=n)!="number"||!Number.isFinite(r)||0>r||r>1?(Xe.warn(e+" must be between 0 and 1. Ignoring invalid value:",t),null):n}vo(t){if(this.mi){var e,r,n=this.mi,i=()=>{var s,o=t.sessionRecording===!1?void 0:t.sessionRecording,a=this.co((s=this.Te.session_recording)==null?void 0:s.sampleRate,"session_recording.sampleRate"),u=this.co(o?.sampleRate,"remote config sampleRate"),c=a??u;F(c)&&this.do();var l=o?.minimumDurationMilliseconds;n.register({[It]:x({cache_timestamp:Date.now(),enabled:!!o},o,{networkPayloadCapture:x({capturePerformance:t.capturePerformance},o?.networkPayloadCapture),canvasRecording:{enabled:o?.recordCanvas,fps:o?.canvasFps,quality:o?.canvasQuality},sampleRate:c,minimumDurationMilliseconds:E(l)?null:l,endpoint:o?.endpoint,triggerMatchType:o?.triggerMatchType,masking:o?.masking,urlTriggers:o?.urlTriggers,version:o?.version,triggerGroups:o?.triggerGroups})})};i(),(e=this.so)==null||e.call(this),this.so=(r=this._instance.sessionManager)==null?void 0:r.onSessionId(i)}}onRemoteConfig(t){var e=t.ok?t.config:void 0;return e&&"sessionRecording"in e?e.sessionRecording===!1?(this.vo(e),void this.ho()):(this.vo(e),void this.startIfEnabledOrStop()):(this.no===xr&&(this.no=dn,Xe.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e){var r;e===void 0&&(e="log"),(r=this.io)!=null&&r.log?this.io.log(t,e):Xe.warn("log called before recorder was ready")}get uo(){var t,e,r=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.get_property(It);return(r==null||(e=r.scriptConfig)==null?void 0:e.script)||"lazy-recorder"}fo(){var t,e,r=this._instance.get_property(It);if(!r)return!1;try{e=typeof r=="object"?r:JSON.parse(r)}catch(i){return Xe.warn("persisted remote config for session recording is invalid and will be ignored",i),!1}var n=(t=e.cache_timestamp)!==null&&t!==void 0?t:Date.now();return 36e5>=Date.now()-n}lo(t){var e,r;if((e=C.__PosthogExtensions__)==null||!e.initSessionRecording)return Xe.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Vc]:!0});if(this.io||(this.io=(r=C.__PosthogExtensions__)==null?void 0:r.initSessionRecording(this._instance),this.io._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.fo())return this.no===dn||this.no===xr?void 0:(this.no=xr,Xe.info("persisted remote config is stale, requesting fresh config before starting"),void new Un(this._instance).load());this.no=Ku,this.io.start(t)}onRRwebEmit(t){var e;(e=this.io)==null||e.onRRwebEmit==null||e.onRRwebEmit(t)}overrideLinkedFlag(){var t,e;this.io||(e=this.mi)==null||e.register({[Dc]:!0}),(t=this.io)==null||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.io||(e=this.mi)==null||e.register({[Nc]:!0}),(t=this.io)==null||t.overrideSampling()}overrideTrigger(t){var e,r;this.io||(r=this.mi)==null||r.register({[t==="url"?jc:Uc]:!0}),(e=this.io)==null||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return((t=this.io)==null?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var r;return!((r=this.io)==null||!r.tryAddCustomEvent(t,e))}}},If={autocapture:class{constructor(t){this.po=!1,this.mo=null,this.yo=!1,this.bo=!1,this.instance=t,this.rageclicks=new Wn(t.config.rageclick),this._o=null}initialize(){this.startIfEnabled()}get Te(){var t,e,r=Y(this.instance.config.autocapture)?this.instance.config.autocapture:{};return r.url_allowlist=(t=r.url_allowlist)==null?void 0:t.map((n=>new RegExp(n))),r.url_ignorelist=(e=r.url_ignorelist)==null?void 0:e.map((n=>new RegExp(n))),r}wo(){if(this.isBrowserSupported()){if(_&&P){var t=r=>{r=r||_?.event;try{this.xo(r)}catch(n){ns.error("Failed to capture event",n)}};if(re(P,"submit",t,{capture:!0}),re(P,"change",t,{capture:!0}),re(P,"click",t,{capture:!0}),this.Te.capture_copied_text){var e=r=>{r=r||_?.event;try{this.xo(r,rs)}catch(n){ns.error("Failed to capture copy/cut event",n)}};re(P,"copy",e,{capture:!0}),re(P,"cut",e,{capture:!0})}}}else ns.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.po&&(this.wo(),this.po=!0)}onRemoteConfig(t){if(this.yo=!0,t.ok){var e=t.config;e.elementsChainAsString&&(this.bo=e.elementsChainAsString);var r=e.autocapture_opt_out;Ne(r)&&(this.instance.persistence&&this.instance.persistence.register({[Rs]:r}),this.mo=r),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(t){this._o=t}getElementSelectors(t){var e,r=[];return(e=this._o)==null||e.forEach((n=>{var i=P?.querySelectorAll(n);i?.forEach((s=>{t===s&&r.push(n)}))})),r}get isEnabled(){var t,e,r=(t=this.instance.persistence)==null?void 0:t.props[Rs],n=this.mo,i=this.instance.Ur()&&!this.yo;if(me(n)&&!Ne(r)&&!i)return!1;var s=(e=this.mo)!==null&&e!==void 0?e:!!r;return!!this.instance.config.autocapture&&!s}xo(t,e){if(e===void 0&&(e="$autocapture"),this.isEnabled){var r,n=Vi(t);Xc(n)&&(n=n.parentNode||null),e==="$autocapture"&&t.type==="click"&&t instanceof MouseEvent&&this.instance.config.rageclick&&(r=this.rageclicks)!=null&&r.isRageClick(t.clientX,t.clientY,t.timeStamp||new Date().getTime())&&Ru(n,this.instance.config.rageclick)&&this.xo(t,"$rageclick");var i=e===rs;if(n&&(function(d,h,f,p,g,m){var v;if(!_||Mo(d)||f!=null&&f.url_allowlist&&!Pu(f.url_allowlist,m)||f!=null&&f.url_ignorelist&&Pu(f.url_ignorelist,m))return!1;if(f!=null&&f.dom_event_allowlist){var w=f.dom_event_allowlist;if(w&&!w.some((b=>h.type===b)))return!1}var y=il(d,p),k=y.parentIsUsefulElement,T=y.targetElementList;if(!(function(b,S){var z=S?.element_allowlist;if(E(z))return!0;var L,I=function(Q){if(z.some((G=>Q.tagName.toLowerCase()===G)))return{v:!0}};for(var Z of b)if(L=I(Z))return L.v;return!1})(T,f)||!Xs(T,f?.css_selector_allowlist)||Xs(T,(v=f?.css_selector_ignorelist)!==null&&v!==void 0?v:Up))return!1;try{var M=_.getComputedStyle(d);if(M&&M.getPropertyValue("cursor")==="pointer"&&h.type==="click")return!0}catch{}var R=d.tagName.toLowerCase();switch(R){case"html":return!1;case"form":return(g||["submit"]).indexOf(h.type)>=0;case"input":case"select":case"textarea":return(g||["change","click"]).indexOf(h.type)>=0;default:return k?(g||["click"]).indexOf(h.type)>=0:(g||["click"]).indexOf(h.type)>=0&&(Oo.indexOf(R)>-1||d.getAttribute("contenteditable")==="true")}})(n,t,this.Te,i,i?["copy","cut"]:void 0,this.instance)){var s=$f(n,{e:t,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Te.element_attribute_ignorelist,elementsChainAsString:this.bo,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes}),o=s.props;if(s.explicitNoCapture)return!1;var a=this.getElementSelectors(n);if(a&&a.length>0&&(o.$element_selectors=a),e===rs){var u,c=tl(_==null||(u=_.getSelection())==null?void 0:u.toString()),l=t.type||"clipboard";if(!c)return!1;o.$selected_content=c,o.$copy_type=l}return this.instance.capture(e,o),!0}}}isBrowserSupported(){return Ze(P?.querySelectorAll)}},historyAutocapture:class{constructor(t){var e;this._instance=t,this.ko=(_==null||(e=_.location)==null?void 0:e.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&($.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.So&&this.So(),this.So=void 0,$.info("History API monitoring stopped")}monitorHistoryChanges(){_&&_.history&&(this.Co("pushState"),this.Co("replaceState"),this.To())}Co(t){var e;if(_&&((e=_.history[t])==null||!e.__posthog_wrapped__)){var r=this;(function(n,i,s){try{if(!(i in n))return Gu;var o={next:n[i]},a=s((function(){for(var u=arguments.length,c=new Array(u),l=0;u>l;l++)c[l]=arguments[l];return o.next.apply(this,c)}));return Ze(a)&&(a.prototype=a.prototype||{},Object.defineProperties(a,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:o}})),n[i]=a,()=>{if(n[i]!==a)for(var u=n[i];Ze(u)&&u.__posthog_layer__;){var c=u.__posthog_layer__;if(c.next===a)return void(c.next=o.next);u=c.next}else n[i]=o.next}}catch{return Gu}})(_.history,t,(n=>function(i,s,o){n.call(this,i,s,o),r.Io(t)}))}}Io(t){try{var e,r=_==null||(e=_.location)==null?void 0:e.pathname;if(!r)return;r!==this.ko&&this.isEnabled&&this._instance.capture(Ht,{navigation_type:t}),this.ko=r}catch(n){$.error("Error capturing "+t+" pageview",n)}}To(){if(!this.So){var t=()=>{this.Io("popstate")};re(_,"popstate",t),this.So=()=>{_&&_.removeEventListener("popstate",t)}}}},heatmaps:class{get Te(){return this.instance.config}constructor(t){var e;this.Mo=!1,this.po=!1,this.Eo=null,this.instance=t,this.Mo=!((e=this.instance.persistence)==null||!e.props[Cs]),this.rageclicks=new Wn(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return Y(this.Te.capture_heatmaps)&&this.Te.capture_heatmaps.flush_interval_milliseconds&&(t=this.Te.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return F(this.Te.capture_heatmaps)?F(this.Te.enable_heatmaps)?this.Mo:this.Te.enable_heatmaps:this.Te.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.po)return;Pf.info("starting..."),this.Ro(),this.ke()}else{var t;clearInterval((t=this.Eo)!==null&&t!==void 0?t:void 0),this.Po(),this.getAndClearBuffer()}}onRemoteConfig(t){if(t.ok){var e=t.config;if("heatmaps"in e){var r=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Cs]:r}),this.Mo=r,this.startIfEnabled()}}}getAndClearBuffer(){var t=this.R;return this.R=void 0,t}Oo(t){ss(t.originalEvent)&&this.pe(t.originalEvent,"deadclick")}ke(){this.Eo&&clearInterval(this.Eo),this.Eo=P?.visibilityState==="visible"?setInterval(this.oi.bind(this),this.flushIntervalMilliseconds):null}Ro(){_&&P&&(this.Fo=this.oi.bind(this),re(_,Mn,this.Fo),this.Lo=t=>this.pe(t||_?.event),re(P,"click",this.Lo,{capture:!0}),this.$o=t=>this.Ao(t||_?.event),re(P,"mousemove",this.$o,{capture:!0}),this.No=new Ln(this.instance,Jp,this.Oo.bind(this)),this.No.startIfEnabledOrStop(),this.Do=this.ke.bind(this),re(P,On,this.Do),this.po=!0)}Po(){var t;_&&P&&(this.Fo&&_.removeEventListener(Mn,this.Fo),this.Lo&&P.removeEventListener("click",this.Lo,{capture:!0}),this.$o&&P.removeEventListener("mousemove",this.$o,{capture:!0}),this.Do&&P.removeEventListener(On,this.Do),clearTimeout(this.qo),(t=this.No)==null||t.stop(),this.po=!1)}jo(t,e){var r=this.instance.scrollManager.scrollY(),n=this.instance.scrollManager.scrollX(),i=this.instance.scrollManager.scrollElement(),s=(function(o,a,u){for(var c=o;c&>(c)&&!$e(c,"body");){if(c===u)return!1;var l=void 0;try{var d,h,f;l=(d=(h=(f=c.ownerDocument)==null?void 0:f.defaultView)!==null&&h!==void 0?h:_)==null?void 0:d.getComputedStyle(c).position}catch{return!1}if(A(a,l))return!0;c=rl(c)}return!1})(Vi(t),["fixed","sticky"],i);return{x:t.clientX+(s?0:n),y:t.clientY+(s?0:r),target_fixed:s,type:e}}pe(t,e){var r;if(e===void 0&&(e="click"),!Su(t.target)&&ss(t)){var n=this.jo(t,e);(r=this.rageclicks)!=null&&r.isRageClick(t.clientX,t.clientY,new Date().getTime())&&Ru(Vi(t),this.instance.config.rageclick)&&this.Nt(x({},n,{type:"rageclick"})),this.Nt(n)}}Ao(t){!Su(t.target)&&ss(t)&&(clearTimeout(this.qo),this.qo=setTimeout((()=>{this.Nt(this.jo(t,"mousemove"))}),500))}Nt(t){if(_){var e=this.Te.disable_capture_url_hashes?ft(_.location.href):_.location.href,r=this.Te.custom_personal_data_properties,n=this.Te.mask_personal_data_properties?[...Qt,...r||[]]:[],i=Zr(e,n,Nr);this.R=this.R||{},this.R[i]||(this.R[i]=[]),this.R[i].push(t)}}oi(){this.R&&!pt(this.R)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Ln,webVitalsAutocapture:class{constructor(t){var e;this.Mo=!1,this.po=!1,this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Ho=()=>{clearTimeout(this.Bo),this.R.metrics.length!==0&&(this._instance.capture("$web_vitals",this.R.metrics.reduce(((r,n)=>x({},r,{["$web_vitals_"+n.name+"_event"]:x({},n),["$web_vitals_"+n.name+"_value"]:n.value})),{})),this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Uo=r=>{var n;this.R=this.R||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var i=this.zo();if(!E(i))if(F(r?.name)||F(r?.value))$t.error("Invalid metric received",r);else if(!this.Vo||this.Vo>r.value){this.R.url!==i&&(this.Ho(),this.Bo=setTimeout(this.Ho,this.flushToCaptureTimeoutMs)),E(this.R.url)&&(this.R.url=i),this.R.firstMetricTimestamp=E(this.R.firstMetricTimestamp)?Date.now():this.R.firstMetricTimestamp,r.attribution&&r.attribution.interactionTargetElement&&(r.attribution.interactionTargetElement=void 0);var s=(n=this._instance.sessionManager)==null?void 0:n.checkAndGetSessionAndWindowId(!0),o=x({},r,{$current_url:i,timestamp:Date.now()});E(s)||(o.$session_id=s.sessionId,o.$window_id=s.windowId),this.R.metrics.push(o),this.R.metrics.length===this.allowedMetrics.length&&this.Ho()}else $t.error("Ignoring metric with value >= "+this.Vo,r)},this.Wo=()=>{if(!this.po){var r,n,i,s,o=C.__PosthogExtensions__;if(!E(o)&&!E(o.postHogWebVitalsCallbacks)){var a=o.postHogWebVitalsCallbacks;r=a.onLCP,n=a.onCLS,i=a.onFCP,s=a.onINP}r&&n&&i&&s?(this.allowedMetrics.indexOf("LCP")>-1&&r(this.Uo.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&n(this.Uo.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this.Uo.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&s(this.Uo.bind(this)),this.po=!0):$t.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.Mo=!((e=this._instance.persistence)==null||!e.props[Ms]),this.startIfEnabled()}get Zo(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e,r=Y(this.Zo)?(t=this.Zo)==null?void 0:t.web_vitals_allowed_metrics:void 0;return F(r)?((e=this._instance.persistence)==null?void 0:e.props[Fs])||["CLS","FCP","INP","LCP"]:r}get flushToCaptureTimeoutMs(){return(Y(this.Zo)?this.Zo.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var t=Y(this.Zo)?this.Zo.web_vitals_attribution:void 0;return t!=null&&t}get Vo(){var t=Y(this.Zo)&&de(this.Zo.__web_vitals_max_value)?this.Zo.__web_vitals_max_value:Vu;return t>0&&6e4>=t?Vu:t}get isEnabled(){var t=ie?.protocol;if(t!=="http:"&&t!=="https:")return $t.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=Y(this.Zo)?this.Zo.web_vitals:Ne(this.Zo)?this.Zo:void 0;return Ne(e)?e:this.Mo}startIfEnabled(){this.isEnabled&&!this.po&&($t.info("enabled, starting..."),this.er(this.Wo))}onRemoteConfig(t){if(t.ok){var e=t.config;if("capturePerformance"in e){var r=Y(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=Y(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Ms]:r}),this._instance.persistence.register({[Fs]:n})),this.Mo=r,this.startIfEnabled()}}}er(t){var e,r;(e=C.__PosthogExtensions__)!=null&&e.postHogWebVitalsCallbacks?t():(r=C.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(n=>{n?$t.error("failed to load script",n):t()}))}zo(){var t=_?this._instance.config.disable_capture_url_hashes?ft(_.location.href):_.location.href:void 0;if(t){var e=this._instance.config.custom_personal_data_properties,r=this._instance.config.mask_personal_data_properties?[...Qt,...e||[]]:[];return Zr(t,r,Nr)}$t.error("Could not determine current URL")}}},Af={exceptionObserver:class{constructor(t){var e;this.Wo=()=>{var r;if(_&&this.isEnabled&&(r=C.__PosthogExtensions__)!=null&&r.errorWrappingFunctions){var n=C.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=C.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=C.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Go&&this.Te.capture_unhandled_errors&&(this.Go=n(this.captureException.bind(this))),!this.Qo&&this.Te.capture_unhandled_rejections&&(this.Qo=i(this.captureException.bind(this))),!this.Jo&&this.Te.capture_console_errors&&(this.Jo=s(this.captureException.bind(this)))}catch(o){br.error("failed to start",o),this.Ko()}}},this._instance=t,this.Yo=!((e=this._instance.persistence)==null||!e.props[Is]),this.Xo=new fs(x({},(function(r){var n,i,s,o;return r===void 0&&(r={}),{refillRate:(n=(i=r.exceptionRateLimiterRefillRate)!==null&&i!==void 0?i:r.__exceptionRateLimiterRefillRate)!==null&&n!==void 0?n:1,bucketSize:(s=(o=r.exceptionRateLimiterBucketSize)!==null&&o!==void 0?o:r.__exceptionRateLimiterBucketSize)!==null&&s!==void 0?s:10}})(this._instance.config.error_tracking),{refillInterval:1e4,Ge:br})),this.Te=this.ea(),this.startIfEnabledOrStop()}ea(){var t=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Y(t)?e=x({},e,t):(E(t)?this.Yo:t)&&(e=x({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Te.capture_console_errors||this.Te.capture_unhandled_errors||this.Te.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(br.info("enabled"),this.Ko(),this.er(this.Wo)):this.Ko()}er(t){var e,r;(e=C.__PosthogExtensions__)!=null&&e.errorWrappingFunctions?t():(r=C.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"exception-autocapture",(n=>{if(n)return br.error("failed to load script",n);t()}))}Ko(){var t,e,r;(t=this.Go)==null||t.call(this),this.Go=void 0,(e=this.Qo)==null||e.call(this),this.Qo=void 0,(r=this.Jo)==null||r.call(this),this.Jo=void 0}onRemoteConfig(t){if(t.ok){var e=t.config;"autocaptureExceptions"in e&&(this.Yo=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Is]:this.Yo}),this.Te=this.ea(),this.startIfEnabledOrStop())}}onConfigChange(){this.Te=this.ea()}captureException(t){var e,r,n,i=(e=t==null||(r=t.$exception_list)==null||(r=r[0])==null?void 0:r.type)!==null&&e!==void 0?e:"Exception";this.Xo.consumeRateLimit(i)?br.info("Skipping exception capture because of client rate limiting.",{exception:i}):(n=this._instance.exceptions)==null||n.sendExceptionEvent(t)}},exceptions:class{constructor(t){var e,r;this.ta=[],this.ra=new ys([new xs,new Ts,new ks,new ws,new Ss,new $s,new Es,new Ps],(function(n){for(var i=arguments.length,s=new Array(i>1?i-1:0),o=1;i>o;o++)s[o-1]=arguments[o];return function(a,u){u===void 0&&(u=0);for(var c=[],l=a.split(`
|
|
2
|
-
`),d=u;l.length>d;d++){var h=l[d];if(1024>=h.length){var f=wu.test(h)?h.replace(wu,"$1"):h;if(!f.match(/\S*Error: /)){for(var p of s){var g=p(f,n);if(g){c.push(g);break}}if(c.length>=50)break}}}return(function(m){if(!m.length)return[];var v=Array.from(m);return v.reverse(),v.slice(0,50).map((w=>{return x({},w,{filename:w.filename||(y=v,y[y.length-1]||{}).filename,function:w.function||Yt});var y}))})(c)}})("web:javascript",kp,Sp)),this._instance=t,this.ta=(e=(r=this._instance.persistence)==null?void 0:r.get_property(As))!==null&&e!==void 0?e:[],this.ia=Tn(this.na()),this.sa=new zs(this.ia)}onConfigChange(){this.ia=Tn(this.na()),this.sa.setConfig(this.ia)}onRemoteConfig(t){var e,r,n;if(t.ok){var i=t.config;if("errorTracking"in i){var s=(e=(r=i.errorTracking)==null?void 0:r.suppressionRules)!==null&&e!==void 0?e:[],o=(n=i.errorTracking)==null?void 0:n.captureExtensionExceptions;this.ta=s,this._instance.persistence&&this._instance.persistence.register({[As]:this.ta,[Os]:o})}}}get oa(){var t,e=!!this._instance.get_property(Os),r=this._instance.config.error_tracking.captureExtensionExceptions;return(t=r??e)!==null&&t!==void 0&&t}buildProperties(t,e){return this.ra.buildFromUnknown(t,{syntheticException:e?.syntheticException,mechanism:{handled:e?.handled}})}addExceptionStep(t,e){if(this.ia.enabled)try{if(!H(t)||t.trim().length===0)return void Qe.warn("Ignoring exception step because message must be a non-empty string");var r=(function(s){if(!s)return{sanitizedProperties:{},droppedKeys:[]};var o=[];return{sanitizedProperties:Object.keys(s).reduce(((a,u)=>zp.has(u)?(o.push(u),a):(a[u]=s[u],a)),{}),droppedKeys:o}})(this.aa(e)),n=r.sanitizedProperties,i=r.droppedKeys;i.length>0&&Qe.warn("Ignoring reserved exception step fields",{droppedKeys:i}),this.sa.add(x({[Sn]:t,[Pn]:new Date().toISOString()},n))}catch(s){Qe.error("Failed to add exception step. Ignoring breadcrumb.",s)}}sendExceptionEvent(t){try{var e=t.$exception_list;if(this.la(e)){if(this.ua(e))return this.ha("Exception dropped: matched a suppression rule"),void Qe.info("Skipping exception capture because a suppression rule matched");if(!this.oa&&this.da(e))return this.ha("Exception dropped: thrown by a browser extension"),void Qe.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ca(e))return this.ha("Exception dropped: thrown by the PostHog SDK"),void Qe.info("Skipping exception capture because it was thrown by the PostHog SDK")}var r=this.ia.enabled&&F(t.$exception_steps)?this.va(t):t;try{var n=this._instance.capture("$exception",r,{_noTruncate:!0,_batchKey:"exceptionEvent",kn:!0});return n&&this.sa.clear(),n}catch(i){return Qe.error("Failed to capture exception event. Dropping this exception.",i),void this.sa.clear()}}catch(i){return void Qe.error("Failed to process exception event. Ignoring this exception.",i)}}va(t){try{var e=this.sa.getAttachable();return e.length===0?t:x({},t,{$exception_steps:e})}catch(r){return Qe.error("Failed to read buffered exception steps. Capturing exception without steps.",r),t}}ha(t){this.ia.enabled&&this.sa.add({[Sn]:t,[Pn]:new Date().toISOString()})}aa(t){return Y(t)?x({},t):{}}na(){var t,e;return(t=(e=this._instance.config.error_tracking)==null?void 0:e.exception_steps)!==null&&t!==void 0?t:{}}ua(t){if(t.length===0)return!1;var e=t.reduce(((r,n)=>{var i=n.type,s=n.value;return H(i)&&i.length>0&&r.$exception_types.push(i),H(s)&&s.length>0&&r.$exception_values.push(s),r}),{$exception_types:[],$exception_values:[]});return this.ta.some((r=>{var n=r.values.map((i=>{var s,o=Cl[i.operator],a=O(i.value)?i.value:[i.value],u=(s=e[i.key])!==null&&s!==void 0?s:[];return a.length>0&&o(a,u)}));return r.type==="OR"?n.some(Boolean):n.every(Boolean)}))}da(t){return t.flatMap((e=>{var r,n;return(r=(n=e.stacktrace)==null?void 0:n.frames)!==null&&r!==void 0?r:[]})).some((e=>e.filename&&e.filename.startsWith("chrome-extension://")))}ca(t){if(t.length>0){var e,r,n,i,s=(e=(r=t[0].stacktrace)==null?void 0:r.frames)!==null&&e!==void 0?e:[],o=s[s.length-1];return(n=o==null||(i=o.filename)==null?void 0:i.includes("posthog.com/static"))!==null&&n!==void 0&&n}return!1}la(t){return!F(t)&&O(t)}}},Of=x({productTours:class{get mi(){return this._instance.persistence}constructor(t){this.fa=null,this.pa=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(t.ok){var e=t.config;if("productTours"in e){var r,n;if(this.mi&&this.mi.register({[zo]:!!e.productTours}),!as(this._instance))return!this.fa&&F((r=this.mi)==null?void 0:r.props[Sr])||os.info("product tours disabled; stopping and clearing cached tours"),(n=this.fa)==null||n.stop(),this.fa=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.fa&&as(this._instance)&&this.er((()=>this.ga()))}er(t){var e,r;(e=C.__PosthogExtensions__)!=null&&e.generateProductTours?t():(r=C.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"product-tours",(n=>{n?os.error("Could not load product tours script",n):t()}))}ga(){var t;!this.fa&&(t=C.__PosthogExtensions__)!=null&&t.generateProductTours&&(this.fa=C.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e){if(e===void 0&&(e=!1),!O(this.pa)||e){var r=this.mi;if(r){var n=r.props[Sr];if(O(n)&&!e)return this.pa=n,void t(n,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",timestampMode:"query",callback:i=>{if(as(this._instance)){var s=i.statusCode;if(s!==200||!i.json){var o="Product Tours API could not be loaded, status: "+s;return os.error(o),void t([],{isLoaded:!1,error:o})}var a=O(i.json.product_tours)?i.json.product_tours:[];this.pa=a,r&&r.register({[Sr]:a}),t(a,{isLoaded:!0})}else t([],{isLoaded:!0})}})}else t(this.pa,{isLoaded:!0})}getActiveProductTours(t){F(this.fa)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.fa.getActiveProductTours(t)}showProductTour(t){var e;(e=this.fa)==null||e.showTourById(t)}previewTour(t){this.fa?this.fa.previewTour(t):this.er((()=>{var e;this.ga(),(e=this.fa)==null||e.previewTour(t)}))}dismissProductTour(){var t;(t=this.fa)==null||t.dismissTour("user_clicked_skip")}nextStep(){var t;(t=this.fa)==null||t.nextStep()}previousStep(){var t;(t=this.fa)==null||t.previousStep()}clearCache(){var t;this.pa=null,(t=this.mi)==null||t.unregister(Sr)}resetTour(t){var e;(e=this.fa)==null||e.resetTour(t)}resetAllTours(){var t;(t=this.fa)==null||t.resetAllTours()}cancelPendingTour(t){var e;(e=this.fa)==null||e.cancelPendingTour(t)}}},Xn),Mf={siteApps:class{constructor(t){this.ma=0,this._instance=t,this.ya=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}ba(t,e){if(e){var r=this.globalsForEvent(e);this.ya.push(r),this.ya.length>1e3&&(this.ya=this.ya.slice(10))}}get siteAppLoaders(){var t;return(t=C._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.ba.bind(this));this._a=()=>{t(),this.ya=[],this._a=void 0}}}globalsForEvent(t){var e,r,n,i,s,o,a;if(!t)throw new Error("Event payload is required");var u={},c=this._instance.get_property("$groups")||[],l=this._instance.get_property("$stored_group_properties")||{};for(var d of Object.entries(l)){var h=d[0];u[h]={id:c[h],type:h,properties:d[1]}}var f=t.$set_once,p=t.$set;return{event:x({},ic(t,Tf),{properties:x({},t.properties,p?{$set:x({},(e=(r=t.properties)==null?void 0:r.$set)!==null&&e!==void 0?e:{},p)}:{},f?{$set_once:x({},(n=(i=t.properties)==null?void 0:i.$set_once)!==null&&n!==void 0?n:{},f)}:{}),elements_chain:(s=(o=t.properties)==null?void 0:o.$elements_chain)!==null&&s!==void 0?s:"",distinct_id:(a=t.properties)==null?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:u}}wa(t){var e,r=(e=t.tagName)==null?void 0:e.toLowerCase();return r==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(t)||(Be.error("prepare_external_dependency_stylesheet returned null"),null):r==="script"&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(t)||(Be.error("prepare_external_dependency_script returned null"),null):t}xa(){var t,e,r,n,i,s,o,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var u=P?.defaultView,c=u==null||(t=u.Node)==null?void 0:t.prototype;if(!u||!c)return()=>{};if(this.ma++,this.ka)return this.Sa();var l=[],d=this,h=new WeakSet,f=(m,v,w)=>{if(m!=null&&m[v]){var y=m[v];m[v]=w(y),l.push((()=>{m[v]=y}))}},p=m=>{if(h.has(m))return m;var v=d.wa(m);return v&&h.add(v),v},g=m=>m.map((v=>typeof v=="string"?v:p(v))).filter((v=>!me(v)));return f(c,"appendChild",(m=>function(v){var w=p(v);return w?m.call(this,w):v})),f(c,"insertBefore",(m=>function(v,w){var y=p(v);return y?m.call(this,y,w):v})),f(c,"replaceChild",(m=>function(v,w){var y=p(v);return y?m.call(this,y,w):w})),[(e=u.Element)==null?void 0:e.prototype,(r=u.Document)==null?void 0:r.prototype,(n=u.DocumentFragment)==null?void 0:n.prototype].forEach((m=>{f(m,"append",(v=>function(){for(var w=arguments.length,y=new Array(w),k=0;w>k;k++)y[k]=arguments[k];return v.apply(this,g(y))})),f(m,"prepend",(v=>function(){for(var w=arguments.length,y=new Array(w),k=0;w>k;k++)y[k]=arguments[k];return v.apply(this,g(y))}))})),[(i=u.Element)==null?void 0:i.prototype,(s=u.CharacterData)==null?void 0:s.prototype,(o=u.DocumentType)==null?void 0:o.prototype].forEach((m=>{f(m,"before",(v=>function(){for(var w=arguments.length,y=new Array(w),k=0;w>k;k++)y[k]=arguments[k];return v.apply(this,g(y))})),f(m,"after",(v=>function(){for(var w=arguments.length,y=new Array(w),k=0;w>k;k++)y[k]=arguments[k];return v.apply(this,g(y))})),f(m,"replaceWith",(v=>function(){for(var w=arguments.length,y=new Array(w),k=0;w>k;k++)y[k]=arguments[k];var T=g(y);return y.length&&!T.length?void 0:v.apply(this,T)}))})),f((a=u.Element)==null?void 0:a.prototype,"insertAdjacentElement",(m=>function(v,w){var y=p(w);return y?m.call(this,v,y):null})),this.ka=()=>{l.forEach((m=>m())),this.ka=void 0},this.Sa()}Sa(){var t=!1;return()=>{var e;t||(t=!0,this.ma--,this.ma===0&&((e=this.ka)==null||e.call(this)))}}Ca(t,e){e===void 0&&(e=!0);var r=this.xa();try{var n=t(r);return e&&r(),n}catch(i){throw r(),i}}setupSiteApp(t){var e=this.apps[t.id],r=()=>{var o;!e.errored&&this.ya.length&&(Be.info("Processing "+this.ya.length+" events for site app with id "+t.id),this.ya.forEach((a=>this.Ca((()=>e.processEvent==null?void 0:e.processEvent(a))))),e.processedBuffer=!0),Object.values(this.apps).every((a=>a.processedBuffer||a.errored))&&((o=this._a)==null||o.call(this))},n=!1,i=o=>{e.errored=!o,e.loaded=!0,Be.info("Site app with id "+t.id+" "+(o?"loaded":"errored")),n&&r()};try{var s=this.Ca((o=>t.init({posthog:this._instance,callback(a){o(),i(a)}})),!1).processEvent;s&&(e.processEvent=s),n=!0}catch(o){Be.error(Wu+t.id,o),i(!1)}if(n&&e.loaded)try{r()}catch(o){Be.error("Error while processing buffered events PostHog app with config id "+t.id,o),e.errored=!0}}Ta(){var t=this.siteAppLoaders||[];for(var e of t)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(var r of t)this.setupSiteApp(r)}Ia(t){var e=this;if(Object.keys(this.apps).length!==0){var r=this.globalsForEvent(t),n=function(s){try{e.Ca((()=>s.processEvent==null?void 0:s.processEvent(r)))}catch(o){Be.error("Error while processing event "+t.event+" for site app "+s.id,o)}};for(var i of Object.values(this.apps))n(i)}}onRemoteConfig(t){var e,r,n,i=this;if((e=this.siteAppLoaders)!=null&&e.length)return this.isEnabled?(this.Ta(),void this._instance.on("eventCaptured",(u=>this.Ia(u)))):void Be.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((r=this._a)==null||r.call(this),t.ok){var s=t.config;if((n=s.siteApps)!=null&&n.length)if(this.isEnabled){var o=function(){var u,c=a.id,l=a.url;C["__$$ph_site_app_"+c]=i._instance,(u=C.__PosthogExtensions__)==null||u.loadSiteApp==null||u.loadSiteApp(i._instance,l,(d=>{if(d)return Be.error(Wu+c,d)}))};for(var a of s.siteApps)o()}else Be.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},Ff={tracingHeaders:class{constructor(t){this.Ma=void 0,this.Ea=void 0,this.Ra=void 0,this.Wo=()=>{var e,r,n=this.Pa();n?(E(this.Ma)&&(this.Ma=(e=C.__PosthogExtensions__)==null||(e=e.tracingHeadersPatchFns)==null?void 0:e._patchXHR(n,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),E(this.Ea)&&(this.Ea=(r=C.__PosthogExtensions__)==null||(r=r.tracingHeadersPatchFns)==null?void 0:r._patchFetch(n,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.Ko()},this._instance=t}initialize(){this.startIfEnabledOrStop()}er(t){var e,r;(e=C.__PosthogExtensions__)!=null&&e.tracingHeadersPatchFns?t():(r=C.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"tracing-headers",(n=>{if(n)return Sf.error("failed to load script",n);t()}))}Oa(){var t,e;return(t=(e=this._instance.config.tracing_headers)!==null&&e!==void 0?e:this._instance.config.addTracingHeaders)!==null&&t!==void 0?t:this._instance.config.__add_tracing_headers}Pa(){var t=this.Oa();return O(t)?(O(this.Ra)?this.Ra.splice(0,this.Ra.length,...t):this.Ra=[...t],t.length>0?this.Ra:void 0):(O(this.Ra)&&this.Ra.splice(0),this.Ra=t||void 0,this.Ra)}Ko(){var t,e;(t=this.Ma)==null||t.call(this),(e=this.Ea)==null||e.call(this),this.Ma=void 0,this.Ea=void 0}startIfEnabledOrStop(){this.Pa()?this.er(this.Wo):this.Ko()}}},Lf=x({surveys:class{get Te(){return this._instance.config}constructor(t){this.Fa=void 0,this._surveyManager=null,this.La=!1,this.$a=[],this.Aa=null,this.Na=null,this._instance=t,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this.Te.disable_surveys){if(!t.ok)return U.warn("Remote config unavailable. Not loading surveys.");var e=t.config.surveys;if(F(e))return U.warn("Flags not loaded yet. Not loading surveys.");var r=O(e);this.Fa=r?e.length>0:e,U.info("flags response received, isSurveysEnabled: "+this.Fa),this.loadIfEnabled()}}reset(){try{var t;(t=this._surveyEventReceiver)==null||t.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var e=[],r=0;r<localStorage.length;r++){var n=localStorage.key(r);(n!=null&&n.startsWith(Ol)||n!=null&&n.startsWith("inProgressSurvey_"))&&e.push(n)}e.forEach((i=>localStorage.removeItem(i)))}catch{}}loadIfEnabled(){if(!this._surveyManager)if(this.La)U.info("Already initializing surveys, skipping...");else if(this.Te.disable_surveys)U.info(Ju);else if(this.Te.cookieless_mode&&this._instance.consent.isOptedOut())U.info("Not loading surveys in cookieless mode without consent.");else{var t=C?.__PosthogExtensions__;if(t){if(!E(this.Fa)||this.Te.advanced_enable_surveys){var e=this.Fa||this.Te.advanced_enable_surveys;this.La=!0;try{var r=t.generateSurveys;if(r)return void this.Da(r,e);var n=t.loadExternalDependency;if(!n)return void this.qa(Co);n(this._instance,"surveys",(i=>{i||!t.generateSurveys?this.qa("Could not load surveys script",i):this.Da(t.generateSurveys,e)}))}catch(i){throw this.qa("Error initializing surveys",i),i}finally{this.La=!1}}}else U.error("PostHog Extensions not found.")}}Da(t,e){this._surveyManager=t(this._instance,e),this._surveyEventReceiver=new bo(this._instance),U.info("Surveys loaded successfully"),this.ja({isLoaded:!0})}qa(t,e){U.error(t,e),this.ja({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.$a.push(t),this._surveyManager&&this.ja({isLoaded:!0}),()=>{this.$a=this.$a.filter((e=>e!==t))}}getSurveys(t,e){if(e===void 0&&(e=!1),this.Te.disable_surveys)return U.info(Ju),t([]);var r,n=this._instance.get_property(Ns);if(n&&!e)return t(n,{isLoaded:!0}),void(this.Ha()&&this.getSurveys((()=>{}),!0));typeof Promise<"u"&&this.Aa?this.Aa.then((i=>t(i.surveys,i.context))):(typeof Promise<"u"&&(this.Aa=new Promise((i=>{r=i}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Te.token),method:"GET",timestampMode:"query",timeout:this.Te.surveys_request_timeout_ms,callback:i=>{var s;this.Aa=null;var o=i.statusCode;if(o!==200||!i.json){var a="Surveys API could not be loaded, status: "+o;U.error(a),this.Na=Date.now();var u={isLoaded:!1,error:a};return t([],u),void(r==null||r({surveys:[],context:u}))}this.Na=null;var c,l=i.json.surveys||[],d=l.filter((f=>(function(p){return!(!p.start_date||p.end_date)})(f)&&(Al(f)||(function(p){var g;return!((g=p.conditions)==null||(g=g.actions)==null||(g=g.values)==null||!g.length)})(f))));d.length>0&&((c=this._surveyEventReceiver)==null||c.register(d)),(s=this._instance.persistence)==null||s.register({[Ns]:l,[Cn]:Date.now()});var h={isLoaded:!0};t(l,h),r?.({surveys:l,context:h})}}))}Ha(){return this.Ba()&&!this.Aa&&!this.Ua()}Ba(){var t=this._instance.get_property(Cn);return de(t)&&Date.now()-t>3e5}Ua(){return de(this.Na)&&3e5>Date.now()-this.Na}markSurveyAsSeen(t,e){var r,n={id:t,current_iteration:(r=e?.iteration)!==null&&r!==void 0?r:null};Ml(n);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}}ja(t){for(var e of this.$a)try{if(!t.isLoaded)return e([],t);this.getSurveys(e)}catch(r){U.error("Error in survey callback",r)}}getActiveMatchingSurveys(t,e){if(e===void 0&&(e=!1),!F(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);U.warn("init was not called")}za(t){var e=null;return this.getSurveys((r=>{var n;e=(n=r.find((i=>i.id===t)))!==null&&n!==void 0?n:null})),e}Va(t){if(F(this._surveyManager))return{eligible:!1,reason:hn};var e=typeof t=="string"?this.za(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}Wa(t){if(F(this._surveyManager))return{eligible:!1,reason:hn};var e=typeof t=="string"?this.za(t):t;return e?this._surveyManager.checkSurveyRenderability(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(F(this._surveyManager))return U.warn("init was not called"),{visible:!1,disabledReason:hn};var e=this.Wa(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return F(this._surveyManager)?(U.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:hn})):new Promise((r=>{this.getSurveys((n=>{var i,s=(i=n.find((a=>a.id===t)))!==null&&i!==void 0?i:null;if(s){var o=this.Wa(s);r({visible:o.eligible,disabledReason:o.reason})}else r({visible:!1,disabledReason:"Survey not found"})}),e)}))}renderSurvey(t,e,r){var n;if(F(this._surveyManager))U.warn("init was not called");else{var i=typeof t=="string"?this.za(t):t;if(i!=null&&i.id)if(mf.includes(i.type)){var s=P?.querySelector(e);if(s)return(n=i.appearance)!=null&&n.surveyPopupDelaySeconds?(U.info("Rendering survey "+i.id+" with delay of "+i.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var o,a;U.info("Rendering survey "+i.id+" with delay of "+((o=i.appearance)==null?void 0:o.surveyPopupDelaySeconds)+" seconds"),(a=this._surveyManager)==null||a.renderSurvey(i,s,r),U.info("Survey "+i.id+" rendered")}),1e3*i.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(i,s,r);U.warn("Survey element not found")}else U.warn("Surveys of type "+i.type+" cannot be rendered in the app");else U.warn("Survey not found")}}displaySurvey(t,e){var r;if(F(this._surveyManager))U.warn("init was not called");else{var n=this.za(t);if(n){var i=n;if((r=n.appearance)!=null&&r.surveyPopupDelaySeconds&&e.ignoreDelay&&(i=x({},n,{appearance:x({},n.appearance,{surveyPopupDelaySeconds:0})})),e.displayType!==to.Popover&&e.initialResponses&&U.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),e.ignoreConditions===!1){var s=this.Va(n);if(!s.eligible)return void U.warn("Survey is not eligible to be displayed: ",s.reason)}e.displayType!==to.Inline?this._surveyManager.handlePopoverSurvey(i,e):this.renderSurvey(i,e.selector,e.properties)}else U.warn("Survey not found")}}cancelPendingSurvey(t){F(this._surveyManager)?U.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;(t=this._surveyManager)==null||t.handlePageUnload==null||t.handlePageUnload()}}},Xn),Zf={toolbar:class{constructor(t){this.instance=t}Za(t){C.ph_toolbar_state=t}Ga(){var t;return(t=C.ph_toolbar_state)!==null&&t!==void 0?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t,e,r){if(t===void 0&&(t=void 0),e===void 0&&(e=void 0),r===void 0&&(r=void 0),qc(this.instance.config)||!_||!P)return!1;t=t??_.location,r=r??_.history;try{if(!e){try{_.localStorage.setItem("test","test"),_.localStorage.removeItem("test")}catch{return!1}e=_?.localStorage}var n,i=zf||Dn(t.hash,"__posthog")||Dn(t.hash,"state"),s=i?Eu((()=>JSON.parse(atob(decodeURIComponent(i)))))||Eu((()=>JSON.parse(decodeURIComponent(i)))):null;return s&&s.action==="ph_authorize"?((n=s).source="url",n&&Object.keys(n).length>0&&(s.desiredHash?t.hash=s.desiredHash:r?r.replaceState(r.state,"",t.pathname+t.search):t.hash="")):((n=JSON.parse(e.getItem(Yu)||"{}")).source="localstorage",delete n.userIntent),!(!n.token||this.instance.config.token!==n.token||(this.loadToolbar(n),0))}catch{return!1}}Qa(t){var e=C.ph_load_toolbar||C.ph_load_editor;!F(e)&&Ze(e)?e(t,this.instance):Xu.warn("No toolbar load function found")}loadToolbar(t){var e=!(P==null||!P.getElementById(Yc));if(!_||e)return!1;var r=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,n=x({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(_.localStorage.setItem(Yu,JSON.stringify(x({},n,{source:void 0}))),this.Ga()===2)this.Qa(n);else if(this.Ga()===0){var i;this.Za(1),(i=C.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this.instance,"toolbar",(s=>{if(s)return Xu.error("[Toolbar] Failed to load",s),void this.Za(0);this.Za(2),this.Qa(n)})),re(_,"turbolinks:load",(()=>{this.Za(0),this.loadToolbar(n)}))}return!0}Ja(t){return this.loadToolbar(t)}maybeLoadEditor(t,e,r){return t===void 0&&(t=void 0),e===void 0&&(e=void 0),r===void 0&&(r=void 0),this.maybeLoadToolbar(t,e,r)}}},Nf=x({experiments:xo},Xn),Df={conversations:class{constructor(t){this.Ka=void 0,this._conversationsManager=null,this.Ya=!1,this.Xa=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations&&t.ok){var e=t.config.conversations;F(e)||(Ne(e)?this.Ka=e:(this.Ka=e.enabled,this.Xa=e),this.loadIfEnabled())}}reset(){var t;(t=this._conversationsManager)==null||t.reset(),this._conversationsManager=null,this.Ka=void 0,this.Xa=null}loadIfEnabled(){if(!(this._conversationsManager||this.Ya||this._instance.config.disable_conversations||qc(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=C?.__PosthogExtensions__;if(t&&!E(this.Ka)&&this.Ka)if(this.Xa&&this.Xa.token){this.Ya=!0;try{var e=t.initConversations;if(e)return this.el(e),void(this.Ya=!1);var r=t.loadExternalDependency;if(!r)return void this.tl(Co);r(this._instance,"conversations",(n=>{n||!t.initConversations?this.tl("Could not load conversations script",n):this.el(t.initConversations),this.Ya=!1}))}catch(n){this.tl("Error initializing conversations",n),this.Ya=!1}}else Ie.error("Conversations enabled but missing token in remote config.")}}el(t){if(this.Xa)try{this._conversationsManager=t(this.Xa,this._instance),Ie.info("Conversations loaded successfully")}catch(e){this.tl("Error completing conversations initialization",e)}else Ie.error("Cannot complete initialization: remote config is null")}tl(t,e){Ie.error(t,e),this._conversationsManager=null,this.Ya=!1}show(){this._conversationsManager?this._conversationsManager.show():Ie.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Ka===!0&&!me(this._conversationsManager)}isVisible(){var t,e;return(t=(e=this._conversationsManager)==null?void 0:e.isVisible())!==null&&t!==void 0&&t}sendMessage(t,e,r){var n=this;return ne((function*(){return n._conversationsManager?n._conversationsManager.sendMessage(t,e,r):(Ie.warn(Pt),null)}))()}getMessages(t,e){var r=this;return ne((function*(){return r._conversationsManager?r._conversationsManager.getMessages(t,e):(Ie.warn(Pt),null)}))()}markAsRead(t){var e=this;return ne((function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(Ie.warn(Pt),null)}))()}getTickets(t){var e=this;return ne((function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(Ie.warn(Pt),null)}))()}requestRestoreLink(t){var e=this;return ne((function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(Ie.warn(Pt),null)}))()}restoreFromToken(t){var e=this;return ne((function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(Ie.warn(Pt),null)}))()}restoreFromUrlToken(){var t=this;return ne((function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(Ie.warn(Pt),null)}))()}getCurrentTicketId(){var t,e;return(t=(e=this._conversationsManager)==null?void 0:e.getCurrentTicketId())!==null&&t!==void 0?t:null}getWidgetSessionId(){var t,e;return(t=(e=this._conversationsManager)==null?void 0:e.getWidgetSessionId())!==null&&t!==void 0?t:null}En(){var t;(t=this._conversationsManager)==null||t.setIdentity()}Rn(){var t;(t=this._conversationsManager)==null||t.clearIdentity()}}},jf={logs:class{constructor(t){var e;this.rl=!1,this.il=!1,this.Ge=X("[logs]"),this.Gr=[],this.nl=[],this.Hs=0,this.sl=()=>{var r,n;this.Hs=0,(r=this.ol)==null||r.onReconnect(),(n=this.al)==null||n.onReconnect()},this._instance=t,this._instance&&(e=this._instance.config.logs)!=null&&e.captureConsoleLogs&&(this.rl=!0),_&&re(_,"online",this.sl)}ll(t,e,r,n){var i,s=(function(o,a){var u,c,l,d,h,f,p,g=(u=o?.flushIntervalMs)!==null&&u!==void 0?u:3e3,m=(c=o?.maxBufferSize)!==null&&c!==void 0?c:100,v=a!=null&&a.consoleCapture?void 0:(l=o?.maxLogsPerInterval)!==null&&l!==void 0?l:1e3,w=E(v)?Math.max(m,2048):Math.max(m,v),y=o?.resourceAttributes;return{serviceName:(d=(h=y?.["service.name"])!==null&&h!==void 0?h:o?.serviceName)!==null&&d!==void 0?d:a?.serviceNameDefault,serviceVersion:(f=y?.["service.version"])!==null&&f!==void 0?f:o?.serviceVersion,environment:(p=y?.["deployment.environment"])!==null&&p!==void 0?p:o?.environment,resourceAttributes:y,beforeSend:o?.beforeSend,flushIntervalMs:g,maxBufferSize:m,maxQueueSize:w,maxBatchRecordsPerPost:100,rateCapWindowMs:g,maxLogsPerInterval:v,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}})((i=this._instance)==null||(i=i.config)==null?void 0:i.logs,r);return[new vp(this.ul(t,e),s,this.Ge,(()=>this.hl()),(o=>o()),void 0,n),s]}dl(){var t,e=(t=this._instance)==null||(t=t.config)==null?void 0:t.logs;if(!this.ol||this.cl!==e){var r;(r=this.ol)==null||r.reset(),this.cl=e;var n=this.ll((()=>this.Gr),(i=>{this.Gr=i}));this.ol=n[0],this.vl=n[1]}return this.ol}fl(){var t,e=(t=this._instance)==null||(t=t.config)==null?void 0:t.logs;if(!this.al||this.pl!==e){var r;(r=this.al)==null||r.reset(),this.pl=e;var n=this.ll((()=>this.nl),(i=>{this.nl=i}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},rc);this.al=n[0],this.gl=n[1]}return this.al}initialize(){this.loadIfEnabled()}onRemoteConfig(t){var e;if(t.ok){var r=(e=t.config.logs)==null?void 0:e.captureConsoleLogs;!F(r)&&r&&(this.rl=!0,this.loadIfEnabled())}}reset(){var t,e;this.Gr=[],(t=this.ol)==null||t.reset(),this.nl=[],(e=this.al)==null||e.reset(),this.Hs=0}captureLog(t){this.dl().captureLog(t)}le(t){this.fl().captureLog(t)}get logger(){return this.ml||(this.ml={trace:(t,e)=>this.captureLog({body:t,level:"trace",attributes:e}),debug:(t,e)=>this.captureLog({body:t,level:"debug",attributes:e}),info:(t,e)=>this.captureLog({body:t,level:"info",attributes:e}),warn:(t,e)=>this.captureLog({body:t,level:"warn",attributes:e}),error:(t,e)=>this.captureLog({body:t,level:"error",attributes:e}),fatal:(t,e)=>this.captureLog({body:t,level:"fatal",attributes:e})}),this.ml}flushLogs(t){t?this.yl(t):(this.ol&&this.ol.flush().catch((e=>this.Ge.error("PostHog logs flush failed:",e))),this.al&&this.al.flush().catch((e=>this.Ge.error("PostHog logs flush failed:",e))))}loadIfEnabled(){if(this.rl&&!this.il){var t=C?.__PosthogExtensions__;if(t){var e=t.loadExternalDependency;e?e(this._instance,"logs",(r=>{var n;r||(n=t.logs)==null||!n.initializeLogs?this.Ge.error("Could not load logs script",r):(t.logs.initializeLogs(this._instance),this.il=!0)})):this.Ge.error(Co)}else this.Ge.error("PostHog Extensions not found.")}}ul(t,e){var r=this._instance;return{get isDisabled(){return!1},get optedOut(){return!r.is_capturing()},getPersistedProperty:n=>n===rt.LogsQueue?t():void 0,setPersistedProperty(n,i){var s;n===rt.LogsQueue&&e((s=i)!==null&&s!==void 0?s:[])},Tt:n=>this.Tt(n),getLibraryId:()=>j.LIB_NAME,getLibraryVersion:()=>j.LIB_VERSION}}Tt(t){return new Promise((e=>{if(dl(this.Hs,3))e({kind:"fatal",error:new Error("logs endpoint is unreachable, dropping batch")});else{var r=!1,n=s=>{r||(r=!0,clearTimeout(i),e(s))},i=setTimeout((()=>n({kind:"retry-later",error:new Error("logs request timed out")})),9e4);this._instance._send_request({method:"POST",url:this.bl(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:s=>{var o=s.statusCode;if(this._l(o),o>=200&&300>o)n({kind:"ok"});else if(o===413)n({kind:"too-large"});else if(o!==0&&o!==429&&500>o)n({kind:"fatal",error:new Error("logs request failed with status "+o)});else{var a;n({kind:"retry-later",error:(a=s.error)!==null&&a!==void 0?a:new Error("logs request failed with status "+o)})}}})}}))}_l(t){(t!==0||this._instance.__loaded)&&(this.Hs=hl(t,this.Hs,3,(()=>this.Ge.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes."))))}yl(t){this.Gr.length>0&&this.wl(t,this.Gr,this.vl,j.LIB_NAME,(e=>{this.Gr=e})),this.nl.length>0&&this.wl(t,this.nl,this.gl,rc,(e=>{this.nl=e}))}wl(t,e,r,n,i){if(e.length!==0){var s=e.map((a=>a.record));i([]);var o=Ac(s,Ic(r,j.LIB_NAME,j.LIB_VERSION),n,j.LIB_VERSION);this._instance._send_request({method:"POST",url:this.bl(),data:o,compression:"best-available",batchKey:"logs",transport:t})}}bl(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}hl(){var t,e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var r=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),n=r.windowId,i=r.sessionStartTimestamp,s=r.lastActivityTimestamp;e.sessionId=r.sessionId,e.windowId=n,F(i)||(e.sessionStartTimestamp=i),F(s)||(e.lastActivityTimestamp=s)}if(C!=null&&(t=C.location)!=null&&t.href&&(e.currentUrl=this._instance.config.disable_capture_url_hashes?ft(C.location.href):C.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(e.activeFeatureFlags=o)}return e}}},Uf={metrics:class{constructor(t){this.Ge=X("[metrics]"),this._instance=t}initialize(){}dl(){var t,e,r=(t=this._instance)==null||(t=t.config)==null?void 0:t.metrics;return this.ol&&this.cl===r||((e=this.ol)==null||e.reset(),this.cl=r,this.ol=new mp(this.ul(),(function(n){var i,s,o,a,u,c=n?.resourceAttributes;return{serviceName:(i=c?.["service.name"])!==null&&i!==void 0?i:n?.serviceName,serviceVersion:(s=c?.["service.version"])!==null&&s!==void 0?s:n?.serviceVersion,environment:(o=c?.["deployment.environment"])!==null&&o!==void 0?o:n?.environment,resourceAttributes:c,beforeSend:n?.beforeSend,flushIntervalMs:(a=n?.flushIntervalMs)!==null&&a!==void 0?a:1e4,maxSeriesPerFlush:(u=n?.maxSeriesPerFlush)!==null&&u!==void 0?u:1e3}})(r),this.Ge)),this.ol}count(t,e,r){e===void 0&&(e=1),this.dl().count(t,e,r)}gauge(t,e,r){this.dl().gauge(t,e,r)}histogram(t,e,r){this.dl().histogram(t,e,r)}flush(t){if(!this.ol)return Promise.resolve();if(t){var e=this.ol.drainWindow();return e&&this.Bt(e,t),Promise.resolve()}return this.ol.flush().catch((r=>this.Ge.error("PostHog metrics flush failed:",r)))}reset(){var t;(t=this.ol)==null||t.reset()}ul(){var t=this._instance,e=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},Bt:r=>e.Bt(r),getLibraryId:()=>j.LIB_NAME,getLibraryVersion:()=>j.LIB_VERSION}}Bt(t,e){return new Promise((r=>{var n=!1,i=o=>{n||(n=!0,clearTimeout(s),r(o))},s=setTimeout((()=>i({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request(x({method:"POST",url:this.xl(),data:t,compression:"best-available",batchKey:"metrics"},e&&{transport:e},{fireCallbackOnDrop:!0,callback(o){var a=o.statusCode;if(a>=200&&300>a)i({kind:"ok"});else if(a===413)i({kind:"too-large"});else if(a!==0&&a!==429&&500>a)i({kind:"fatal",error:new Error("metrics request failed with status "+a)});else{var u;i({kind:"retry-later",error:(u=o.error)!==null&&u!==void 0?u:new Error("metrics request failed with status "+a)})}}}))}))}xl(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},Hf=x({},Xn,Cf,If,Af,Of,Mf,Lf,Ff,Zf,Nf,Df,jf,Uf);Ot.__defaultExtensionClasses=x({},Hf);var ue=(function(){j.SDK_DIST_CHANNEL="npm";var t=Ar[Bt]=new Ot;return(function(){function e(){e.done||(e.done=!0,Ll=!1,B(Ar,(function(r){r._dom_loaded()})))}P!=null&&P.addEventListener?P.readyState==="complete"?e():re(P,"DOMContentLoaded",e,{capture:!1}):_&&$.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),t})();var Zl="0.0.0.0",Nl="$ip",Dl="$geoip_disable";function jl(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Kf(t){return jl(t)?{...t,properties:{...jl(t.properties)?t.properties:{},[Nl]:Zl,[Dl]:!0}}:t}function Ul(t){let e=t;return{link:r=>e?r:Kf(r),set:r=>{e=r}}}function Hl(t,e){if(typeof e!="boolean"){console.warn("[HeyCatch] setIpCollection() takes true or false - the call was ignored.");return}if(t===null){console.warn(`[HeyCatch] setIpCollection(${String(e)}) was called before init(), so it was NOT applied. Pass collectIp to init() instead, or call setIpCollection() after it.`);return}t.set(e)}var Bl="[redacted]",Wf=/(^|[#&?])(access_token|refresh_token|token_hash|token)=[^\s#&"'<>]+/gi,Jf=/(^|[^\w-])eyJ[\w-]+\.[\w-]+\.[\w-]+/g;function Gl(t){return t.replaceAll(Wf,`$1$2=${Bl}`).replaceAll(Jf,`$1${Bl}`)}var Yf=new Set(["$anon_distinct_id","distinct_id"]),Xf=["$set","$set_once"];function No(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Do(t){return typeof t=="string"?Gl(t):Array.isArray(t)?Qf(t):No(t)?Vl(t,()=>!0):t}function Qf(t){let e=t.map(r=>Do(r));return e.some((r,n)=>r!==t[n])?e:t}function Vl(t,e){let r=!1,n=[];for(let[i,s]of Object.entries(t)){let o=e(i)?Do(s):s;o!==s&&(r=!0),n.push([i,o])}return r?Object.fromEntries(n):t}function ql(t){if(!No(t))return t;try{let e=!1,r={...t},{properties:n}=t;if(No(n)){let i=Vl(n,s=>!Yf.has(s));i!==n&&(e=!0,r.properties=i)}for(let i of Xf){let s=t[i],o=Do(s);o!==s&&(e=!0,r[i]=o)}return e?r:t}catch{return t}}var[eg,tg,rg]=lr,ng="$posthog_cookieless",ig=Symbol.for("heycatch.tracing-headers");function Jl(t,e){let r=globalThis,n=r[ig]??={hostnames:new Set,source:e,refused:new Set,fetchPatched:!1,xhrPatched:!1};n.hostnames=new Set(t),n.source=e;let i=[];!n.fetchPatched&&typeof globalThis.fetch=="function"&&(n.fetchPatched=ag(n),n.fetchPatched||i.push("fetch")),!n.xhrPatched&&typeof globalThis.XMLHttpRequest=="function"&&typeof globalThis.XMLHttpRequest.prototype.open=="function"&&typeof globalThis.XMLHttpRequest.prototype.send=="function"&&typeof globalThis.XMLHttpRequest.prototype.setRequestHeader=="function"&&(n.xhrPatched=cg(n),n.xhrPatched||i.push("XMLHttpRequest")),i.length>0&&n.readOnlyWarned!==!0&&(n.readOnlyWarned=!0,console.warn(`[HeyCatch] ${i.join(" and ")} is read-only on this page, so the session headers are not sent on its requests and server events lose the session link. Analytics is unaffected.`))}function sg({allowSetter:t,key:e,target:r}){for(let n=r;n!==null;n=Object.getPrototypeOf(n)){let i=Object.getOwnPropertyDescriptor(n,e);if(i!==void 0)return"value"in i||"writable"in i?i.writable===!0&&(n===r||Object.isExtensible(r)):t&&i.set!==void 0}return Object.isExtensible(r)}function Yl(t,e){let r=Object.keys(e),n=r.length===1;if(!r.every(s=>sg({allowSetter:n,key:s,target:t})))return!1;let i=new Map;try{for(let s of r)if(i.set(s,Reflect.get(t,s)),!Reflect.set(t,s,e[s]))break;if(r.every(s=>Reflect.get(t,s)===e[s]))return!0}catch{}for(let[s,o]of i)try{Reflect.set(t,s,o)}catch{}return!1}function Xl(t,e){let r;try{r=new URL(e,globalThis.location.href)}catch{return null}return!t.hostnames.has(r.hostname)||t.refused.has(r.host)?null:{url:r,sameOrigin:r.origin===globalThis.location.origin}}function Uo(t,e){let r=[],n=t.source.sessionAndWindowId();r.push([eg,n?.sessionId],[tg,n?.windowId]);let i=t.source.distinctId();r.push([rg,i===ng?void 0:i]);let s=!1;for(let[o,a]of r)a&&!e.has(o)&&(e.set(o,a),s=!0);return s}function Ql(t,e){t.refused.has(e.host)||(t.refused.add(e.host),console.warn(`[HeyCatch] a request to ${e.host} failed with the session headers on, so they are no longer sent there on this page and its server events lose the session link. If ${e.host} is your own backend, add TRACING_HEADERS (${lr.join(", ")}) to its CORS Access-Control-Allow-Headers; otherwise remove it from tracingHosts.`))}function Kl(t){return typeof Request<"u"&&(t instanceof Request||Object.prototype.toString.call(t)==="[object Request]")}function ed(t){return typeof t=="object"&&t!==null||typeof t=="function"}function og(t,e){if(t===void 0)return{headers:e};if(typeof Proxy>"u"||typeof Reflect>"u"){let i=Object.create(t);return Object.defineProperty(i,"headers",{configurable:!0,enumerable:!0,value:e,writable:!0}),i}let r=t,n={headers:e};return new Proxy(n,{get:(i,s)=>Object.hasOwn(i,s)?Reflect.get(i,s):Reflect.get(r,s,r),has:(i,s)=>Object.hasOwn(i,s)||s in r,ownKeys:i=>[...new Set([...Reflect.ownKeys(i),...Reflect.ownKeys(r)])],getOwnPropertyDescriptor:(i,s)=>{let o=Reflect.getOwnPropertyDescriptor(i,s)??Reflect.getOwnPropertyDescriptor(r,s);return o?{...o,configurable:!0}:void 0},getPrototypeOf:()=>Object.getPrototypeOf(r)})}function ag(t){let e=globalThis.fetch;return Yl(globalThis,{fetch:function(...i){let s=i,o=null;try{let[c,l]=i,d=Kl(c)?c.url:c instanceof URL?c.href:c;if(o=Xl(t,d),o!==null)if(Kl(c)){let h=new Request(c,l);Uo(t,h.headers)||(o=null),s=[h]}else if(l===void 0||ed(l)){let h=new Headers(l?.headers);Uo(t,h)?s=[c,og(l,h)]:o=null}else o=null}catch{s=i,o=null}let a=Reflect.apply(e,this,s);if(o===null||o.sameOrigin||!ug(a))return a;let{url:u}=o;return a.then(void 0,c=>{throw c instanceof TypeError&&Ql(t,u),c})}})}function ug(t){return ed(t)&&typeof t.then=="function"}var jo=new WeakMap,jr=new WeakMap,Qn=new WeakMap,Wl=new WeakSet;function cg(t){let e=globalThis.XMLHttpRequest.prototype,{open:r,send:n,setRequestHeader:i}=e;return Yl(e,{open:function(...c){let l=new Headers,d=null;try{let h=c[1];d=Xl(t,String(h instanceof URL?h.href:h)),d!==null&&!Uo(t,l)&&(d=null)}catch{d=null}if(Reflect.apply(r,this,c),Qn.delete(this),d===null){jr.delete(this),jo.set(this,null);return}jr.set(this,l);try{Wl.has(this)||(Wl.add(this),this.addEventListener("error",()=>{let h=jo.get(this);h&&this.status===0&&Ql(t,h)})),jo.set(this,d.sameOrigin?null:d.url)}catch{}},send:function(...c){let l=jr.get(this);if(l!==void 0){jr.delete(this);let d=Qn.get(this);for(let[h,f]of l)if(d?.has(h)!==!0)try{Reflect.apply(i,this,[h,f])}catch{}}Reflect.apply(n,this,c)},setRequestHeader:function(...c){Reflect.apply(i,this,c);try{if(jr.has(this)){let l=Qn.get(this)??new Set;l.add(c[0].toLowerCase()),Qn.set(this,l)}}catch{}}})}var lg=5e3,dg=60,hg=1e3,pg=60,fg=new Set(["$set"]),Ho="heycatch_volume_cap_reached",td=3,gg=6e4;function ei({bucket:t,perMinute:e,now:r}){if(t===void 0)return e;let n=Math.max(0,r-t.at);return Math.min(e,t.tokens+n*e/gg)}function _g(t){return t===void 0||t.length===0?!1:ai(vg(t))}function vg(t){if(t.startsWith("[")){let r=t.indexOf("]");return r===-1?t:t.slice(0,r+1)}let e=t.indexOf(":");return e!==-1&&e===t.lastIndexOf(":")?t.slice(0,e):t}function rd(t){let{$session_id:e,$host:r}=t.properties;return{sessionId:typeof e=="string"?e:"",host:typeof r=="string"?r:void 0}}var id=4;function nd(t){if(t!==void 0)return typeof t=="object"&&t!==null&&"tokens"in t&&typeof t.tokens=="number"&&Number.isFinite(t.tokens)&&t.tokens>=0&&"at"in t&&typeof t.at=="number"&&Number.isFinite(t.at)?{tokens:t.tokens,at:t.at}:!1}function mg(t){if(typeof t=="object"&&t!==null&&"sessionId"in t&&typeof t.sessionId=="string"&&"count"in t&&typeof t.count=="number"&&Number.isInteger(t.count)&&t.count>=0&&"markerAttempts"in t&&typeof t.markerAttempts=="number"&&Number.isInteger(t.markerAttempts)&&t.markerAttempts>=0){let e=nd("person"in t?t.person:void 0),r=nd("localhost"in t?t.localhost:void 0);if(e!==!1&&r!==!1)return{sessionId:t.sessionId,count:t.count,markerAttempts:t.markerAttempts,person:e,localhost:r}}return null}function yg(t){if(t===null)return[];try{let e=JSON.parse(t);if(Array.isArray(e))return e.flatMap(r=>{let n=mg(r);return n===null?[]:[n]}).slice(0,id)}catch{}return[]}function sd({store:t,warn:e,emitMarker:r,cap:n=lg,personUpdateBudget:i=dg,localhostFreeEvents:s=hg,localhostRatePerMinute:o=pg,now:a=Date.now}){let u=[],c=!1,l=!1,d=!1,h=!1;function f(){if(t===void 0||c)return u;try{return yg(t.read())}catch{return u}}function p(v){let w=f().filter(y=>y.sessionId!==v.sessionId);u=[v,...w].slice(0,id);try{t?.write(JSON.stringify(u))}catch{c=!0}}function g(v){let w=f().find(R=>R.sessionId===v),y=u.find(R=>R.sessionId===v),k=[w,y].filter(R=>R!==void 0),T=a();function M(R,b){let S;for(let{[R]:z}of k)z!==void 0&&ei({bucket:z,perMinute:b,now:T})<ei({bucket:S,perMinute:b,now:T})&&(S=z);return S}return{sessionId:v,count:Math.max(0,...k.map(R=>R.count)),markerAttempts:Math.max(0,...k.map(R=>R.markerAttempts)),person:M("person",i),localhost:M("localhost",o)}}function m(v,w){let y=w,k=a(),{sessionId:T,host:M}=rd(v);y.person!==void 0&&y.person.at>k&&(y={...y,person:{...y.person,at:k}},p(y)),y.localhost!==void 0&&y.localhost.at>k&&(y={...y,localhost:{...y.localhost,at:k}},p(y));let R=fg.has(v.event),b=R?ei({bucket:y.person,perMinute:i,now:k}):0;if(R&&b<1)return d||(d=!0,e(`[HeyCatch] setPersonProperties is being called more than ${i} times a minute - call it when a property changes, not on every render. Dropping the extra updates for now; other events are unaffected.`)),null;let S=y.count>=s&&_g(M),z=S?ei({bucket:y.localhost,perMinute:o,now:k}):0;return S&&z<1?(h||(h=!0,e(`[HeyCatch] this local dev session (${M??"unknown host"}, session ${T||"unknown"}) sent ${s} events - throttling it to ${o} a minute so a dev loop cannot flood your analytics. Production traffic is unaffected.`)),null):(p({...y,count:y.count+1,...R?{person:{tokens:b-1,at:k}}:{},...S?{localhost:{tokens:z-1,at:k}}:{}}),v)}return v=>{if(v===null||v.event===Ho)return v;let{sessionId:w}=rd(v),y=g(w);return y.count<n?m(v,y):(l||(l=!0,e(`[HeyCatch] this session sent ${n} events, the per-session cap - dropping the rest until a new session starts (session ${w||"unknown"}). A tracking call inside a render loop or an effect is the usual cause.`)),y.markerAttempts<td&&(p({...y,markerAttempts:td}),r({cap:n,sessionId:w})||p({...y,markerAttempts:y.markerAttempts+1})),null)}}var od="heycatch_session_volume",bg={read:()=>globalThis.localStorage.getItem(od),write:t=>{globalThis.localStorage.setItem(od,t)}};function ad(t){return sd({store:t?void 0:bg,warn:e=>{console.warn(e)},emitMarker:({cap:e})=>ue.capture(Ho,{heycatch_session_event_cap:e})!==void 0})}var cd=!1;function De(){return cd}function xg(){cd=!0}function wg(t){try{return new URL(t.includes("://")?t:`https://${t}`).hostname}catch{return t}}var kg=[{key:"autocapture",triggeredBy:!1,cost:"no automatic click/form-submit capture - the dashboard only sees events you call trackEvent for yourself (pageviews and rage-clicks are captured separately and are unaffected)"},{key:"maskAllText",triggeredBy:!0,cost:"autocaptured elements lose their text, which blanks the recap's friction labels"},{key:"maskAllElementAttributes",triggeredBy:!0,cost:"autocaptured elements lose their attributes, which blanks the recap's friction labels"}];function Eg(t){let e=kg.filter(n=>t[n.key]===n.triggeredBy);if(e.length===0)return;let r=e.map(n=>`${n.key} - ${n.cost}`).join("; ");console.info(`[HeyCatch] quality note: ${r}`)}var ud=new Set(["heycatch_agent","heycatch_custom_user_event","heycatch_framework","heycatch_framework_version","heycatch_project_key","heycatch_sdk_stage","heycatch_sdk_version","heycatch_site"]);function $g(t){let e=t.filter(r=>ud.has(r));return e.length>0&&console.error(`[HeyCatch] propertyDenylist cannot exclude HeyCatch's own attribution keys (${e.join(", ")}) - ignoring those entries.`),t.filter(r=>!ud.has(r))}function Sg(t){return{heycatch_sdk_version:xt,heycatch_sdk_stage:bt,heycatch_project_key:t.projectKey,heycatch_framework:t.install.framework,heycatch_framework_version:t.install.frameworkVersion,heycatch_agent:t.install.agent,...t.site===void 0?{}:{heycatch_site:t.site}}}function Pg(t,e,r,n){let i=s=>{if(s===null)return null;let o={...s.properties,token:Mi,...r};return"heycatch_site"in r||delete o.heycatch_site,{...s,properties:o}};return[...t===void 0?[]:Array.isArray(t)?t:[t],e,i,n,ql]}var Bo=null,ld=null;function dd(){Bo?.()}function hd(t){if(De()||!He()||en())return;let e=tu({stage:bt,hostname:globalThis.location.hostname});if(e!==null){console.error(e);return}let r=ru.safeParse(t);if(!r.success){let c=r.error.issues[0]?.message??"init() requires a config object with { projectKey }.";console.error(`[HeyCatch] ${c}`);return}let n=Ul(r.data.collectIp!==!1);console.info(`[HeyCatch] SDK v${xt} (${bt}) initialized \u2192 ${Oi}`);let i={api_host:Oi,defaults:"2026-01-30",disable_compression:!0,disable_session_recording:!0,disable_surveys:!0,advanced_disable_flags:!0,mask_personal_data_properties:!0,opt_out_persistence_by_default:!0,rageclick:!0,rate_limiting:{events_per_second:5,events_burst_limit:50},...r.data.autocapture===void 0?{}:{autocapture:r.data.autocapture},...r.data.maskAllText===void 0?{}:{mask_all_text:r.data.maskAllText},...r.data.maskAllElementAttributes===void 0?{}:{mask_all_element_attributes:r.data.maskAllElementAttributes},...r.data.propertyDenylist===void 0?{}:{property_denylist:$g(r.data.propertyDenylist)},...r.data.sanitizeProperties===void 0?{}:{sanitize_properties:r.data.sanitizeProperties},before_send:Pg(r.data.beforeSend,ad(r.data.disablePersistence===!0||r.data.persistence==="memory"),Sg(r.data),n.link),...r.data.persistence===void 0?{}:{persistence:r.data.persistence},...r.data.disablePersistence===void 0?{}:{disable_persistence:r.data.disablePersistence},...r.data.cookieExpirationDays===void 0?{}:{cookie_expiration:r.data.cookieExpirationDays},...r.data.optOutCapturingByDefault===void 0?{}:{opt_out_capturing_by_default:r.data.optOutCapturingByDefault},...r.data.respectDnt===void 0?{}:{respect_dnt:r.data.respectDnt},...r.data.requestBatching===void 0?{}:{request_batching:r.data.requestBatching},...r.data.flushIntervalMs===void 0?{}:{request_queue_config:{flush_interval_ms:r.data.flushIntervalMs}}};Eg(r.data),ue.init(Mi,i);let s=[...new Set([...globalThis.location.hostname?[globalThis.location.hostname]:[],...r.data.tracingHosts.map(c=>wg(c))])];if(s.length>0)try{Jl(s,{sessionAndWindowId:()=>ue.sessionManager?.checkAndGetSessionAndWindowId(!0),distinctId:()=>ue.get_distinct_id()})}catch(c){console.warn("[HeyCatch] could not install the session headers, so server events lose the session link. Analytics is unaffected.",c)}let{install:o,site:a}=r.data,u={heycatch_framework:o.framework,heycatch_framework_version:o.frameworkVersion,heycatch_agent:o.agent,...a===void 0?{}:{heycatch_site:a}};Bo=()=>{ue.register({heycatch_sdk_version:xt,heycatch_sdk_stage:bt,heycatch_project_key:r.data.projectKey,...u}),a===void 0&&ue.unregister("heycatch_site")},Bo(),r.data.optOutCapturingByDefault!==!0&&tn(),ld=n,xg()}function pd(t){Hl(De()?ld:null,t)}var fd={in:"[HeyCatch] optInCapturing() was called before init(), so the consent grant was NOT recorded - if init() runs with optOutCapturingByDefault: true, capturing stays off. Call init() first, then optInCapturing() once consent is granted.",out:"[HeyCatch] optOutCapturing() was called before init(), so the withdrawal was NOT recorded - capturing starts when init() runs. Call init() first, or pass optOutCapturingByDefault: true to start with capturing off."};function gd(){if(!De()){console.warn(fd.in);return}ue.opt_in_capturing(),tn()}function _d(){if(!De()){console.warn(fd.out);return}ue.opt_out_capturing()}function vd(t,e,r){if(!(!De()||!He())){if(typeof t!="string"||t.length===0){console.error("[HeyCatch] setIdentity() requires a non-empty string user id. Pass a stable internal user id from your auth provider \u2014 not an email or session token.");return}ue.get_property("$user_state")==="identified"&&ue.get_distinct_id()!==t&&Go(),ue.identify(t,e,r)}}function Go(){!De()||!He()||(ue.reset(),dd())}function md(t,e,r){if(!(!De()||!He())){if(typeof t!="string"||t.length===0){console.error('[HeyCatch] trackEvent() requires a non-empty event name, e.g. track("signup_completed").');return}if(t.startsWith("$")){console.error(`[HeyCatch] trackEvent() event names cannot start with "$" (got "${t}") - that prefix is reserved for built-in events.`);return}ue.capture(t,{...e,...Tg(r),heycatch_custom_user_event:!0})}}function yd(t,e){!De()||!He()||!t&&!e||ue.setPersonProperties(t,e)}function Tg(t){let e={};return t?.set&&(e.$set=t.set),t?.setOnce&&(e.$set_once=t.setOnce),e}var zg={init:hd,optInCapturing:gd,optOutCapturing:_d,resetIdentity:Go,setIdentity:vd,setIpCollection:pd,setPersonProperties:yd,trackEvent:md};en();0&&(module.exports={KNOWN_FRAMEWORKS,KNOWN_INSTALL_AGENTS,SDK_VERSION,STAGE,TRACING_HEADERS,UNKNOWN_INSTALL_VALUE,analytics});
|
|
1
|
+
"use strict";var ni=Object.defineProperty;var wd=Object.getOwnPropertyDescriptor;var kd=Object.getOwnPropertyNames;var Ed=Object.prototype.hasOwnProperty;var Jo=(t,e)=>{for(var r in e)ni(t,r,{get:e[r],enumerable:!0})},$d=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of kd(e))!Ed.call(t,i)&&i!==r&&ni(t,i,{get:()=>e[i],enumerable:!(n=wd(e,i))||n.enumerable});return t};var Sd=t=>$d(ni({},"__esModule",{value:!0}),t);var Ig={};Jo(Ig,{KNOWN_FRAMEWORKS:()=>su,KNOWN_INSTALL_AGENTS:()=>ou,SDK_VERSION:()=>xt,STAGE:()=>bt,TRACING_HEADERS:()=>lr,UNKNOWN_INSTALL_VALUE:()=>ht,analytics:()=>Cg});module.exports=Sd(Ig);var si="[a-z0-9]",Og=new RegExp(`^${si}$`),oi="heycatch";var Pd=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;function ii(t){let e=Pd.exec(t);if(e===null)return!1;let[,r="",n=""]=e,i=Number(r),s=Number(n);return i>255||s>255?!1:i===0||i===10||i===127||i===100&&s>=64&&s<=127||i===169&&s===254||i===172&&s>=16&&s<=31||i===192&&s===168}var Td=/^::ffff:([0-9a-f]{1,4}):([0-9a-f]{1,4})$/;function zd(t){if(t==="::1"||t==="::")return!0;if(t.startsWith("::ffff:")){let e=Td.exec(t);if(e===null)return ii(t.slice(7));let[,r="",n=""]=e,i=Number.parseInt(r,16),s=Number.parseInt(n,16);return ii(`${Math.floor(i/256)}.${i%256}.${Math.floor(s/256)}.${s%256}`)}return/^f[cd][0-9a-f]{2}:/.test(t)||/^fe[89ab][0-9a-f]:/.test(t)}function Yo(t){return t.toLowerCase().replace(/^\[/,"").replace(/\]$/,"").replace(/\.+$/,"")}function ai(t){let e=Yo(t);return e==="localhost"||e.endsWith(".localhost")||ii(e)||zd(e)}function Rd(t){let e=Yo(t);return e==="heycatch.ai"||e.endsWith(".heycatch.ai")}function ui(t){return ai(t)||Rd(t)}var Ke={};Jo(Ke,{BIGINT_FORMAT_RANGES:()=>Jd,CONSTANT_CATCH:()=>va,Class:()=>di,NUMBER_FORMAT_RANGES:()=>Wd,aborted:()=>qe,allowsEval:()=>ia,assert:()=>Fd,assertEqual:()=>Cd,assertIs:()=>Od,assertNever:()=>Md,assertNotEqual:()=>Id,assignProp:()=>ir,attachSchema:()=>ar,base64ToUint8Array:()=>ga,base64urlToUint8Array:()=>nh,cached:()=>Vr,captureStackTrace:()=>qr,cleanEnum:()=>rh,cleanRegex:()=>pi,clone:()=>ze,cloneDef:()=>Ud,codePointLength:()=>Qd,constantCatch:()=>ma,createTransparentProxy:()=>Kd,defineLazy:()=>Qo,defineLazyInternal:()=>Ce,derived:()=>ah,esc:()=>ra,escapeRegex:()=>or,explicitlyAborted:()=>vi,extend:()=>ca,finalizeIssue:()=>dt,floatSafeRemainder:()=>Nd,getElementAtPath:()=>Hd,getEnumValues:()=>Gr,getLengthableOrigin:()=>eh,getParsedType:()=>qd,getSizableOrigin:()=>Yd,hexToUint8Array:()=>sh,hide:()=>yi,installLazyProp:()=>bi,isObject:()=>nr,isPlainObject:()=>sr,issue:()=>Xr,joinValues:()=>Ld,jsonStringifyReplacer:()=>hi,members:()=>mi,merge:()=>ha,mergeDefs:()=>Ue,normalizeParams:()=>Re,nullish:()=>Zd,numKeys:()=>Vd,objectClone:()=>Dd,omit:()=>ua,optionalKeys:()=>_i,own:()=>je,parsedType:()=>th,partial:()=>pa,pick:()=>aa,prefixIssues:()=>Jr,primitiveTypes:()=>sa,promiseAllObject:()=>Bd,propertyKeyTypes:()=>gi,randomString:()=>Gd,rawShape:()=>fi,required:()=>fa,safeExtend:()=>da,shallowClone:()=>Kr,sizeCaps:()=>Yr,slugify:()=>na,stringifyPrimitive:()=>oa,toZod:()=>Ad,uint8ArrayToBase64:()=>_a,uint8ArrayToBase64url:()=>ih,uint8ArrayToHex:()=>oh,unwrapMessage:()=>Ft});function Cd(t){return t}function Id(t){return t}function Ad(){return t=>t}function Od(t){}function Md(t){throw new Error("Unexpected value in exhaustive check")}function Fd(t){}function Gr(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,i])=>e.indexOf(+n)===-1).map(([n,i])=>i)}function Ld(t,e="|"){return t.map(r=>oa(r)).join(e)}function hi(t,e){return typeof e=="bigint"?e.toString():e}var li=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function Vr(t){return new li(t)}function Zd(t){return t==null}function pi(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function Nd(t,e){let r=t/e,n=Math.round(r),i=4*Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)<i?0:r-n}var Xo=Symbol("evaluating");function Qo(t,e,r){let n;Object.defineProperty(t,e,{get(){if(n!==Xo)return n===void 0&&(n=Xo,n=r()),n},set(i){Object.defineProperty(t,e,{value:i})},configurable:!0})}function Dd(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function ir(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function fi(t){let e=Object.getOwnPropertyDescriptor(t,"shape");return e?.get?e.get.raw:e?.value}function Ve(t){return fi(t._zod.def)??t._zod.def.shape}function ea(t,e,r){Object.defineProperty(t,e,{get(){let n=r();return ir(this,e,n),n},enumerable:!0,configurable:!0})}function ta(t,e,r){e in t?ir(t,e,r):t[e]=r}function _t(t,e,r,n){let i=Ve(e);for(let s of r){let o=Object.getOwnPropertyDescriptor(i,s);o.enumerable&&(o.get?ea(t,s,()=>{let a=e._zod.def.shape[s];return n?n(a,s):a}):ta(t,s,n?n(o.value,s):o.value))}}function jd(t,e){for(let r of Reflect.ownKeys(e)){let n=Object.getOwnPropertyDescriptor(e,r);n.enumerable&&(n.get?ea(t,r,()=>e[r]):ta(t,r,n.value))}}function Ue(...t){let e={};for(let r of t){let n=Object.getOwnPropertyDescriptors(r);Object.assign(e,n)}return Object.defineProperties({},e)}function Ud(t){return Ue(t._zod.def)}function Hd(t,e){return e?e.reduce((r,n)=>r?.[n],t):t}function Bd(t){let e=Object.keys(t),r=e.map(n=>t[n]);return Promise.all(r).then(n=>{let i={};for(let s=0;s<e.length;s++)i[e[s]]=n[s];return i})}function Gd(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<t;n++)r+=e[Math.floor(Math.random()*e.length)];return r}function ra(t){return JSON.stringify(t)}function na(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var qr="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function nr(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var ia=Vr(()=>{if(vt.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function sr(t){if(nr(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let r=e.prototype;return!(nr(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Kr(t){return sr(t)?{...t}:Array.isArray(t)?[...t]:t instanceof Map?new Map(t):t instanceof Set?new Set(t):t}function Vd(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}var qd=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},gi=new Set(["string","number","symbol"]),sa=new Set(["string","number","bigint","boolean","symbol","undefined"]);function or(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ze(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function Re(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function Kd(t){let e;return new Proxy({},{get(r,n,i){return e??(e=t()),Reflect.get(e,n,i)},set(r,n,i,s){return e??(e=t()),Reflect.set(e,n,i,s)},has(r,n){return e??(e=t()),Reflect.has(e,n)},deleteProperty(r,n){return e??(e=t()),Reflect.deleteProperty(e,n)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,n){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,n)},defineProperty(r,n,i){return e??(e=t()),Reflect.defineProperty(e,n,i)}})}function oa(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function _i(t){return Object.keys(t).filter(e=>t[e]._zod.optin!==void 0&&t[e]._zod.optout==="optional")}var Wd={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Jd={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function aa(t,e){let r=t._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let s={};return _t(s,t,Wr(t,e)),ze(t,Ue(r,{shape:s,checks:[]}))}function Wr(t,e){let r=Ve(t),n=[];for(let i of Reflect.ownKeys(e)){if(!Object.getOwnPropertyDescriptor(r,i)?.enumerable)throw new Error(`Unrecognized key: "${String(i)}"`);e[i]&&n.push(i)}return n}function ua(t,e){let r=t._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let s=new Set(Wr(t,e)),o={};return _t(o,t,Reflect.ownKeys(Ve(t)).filter(a=>!s.has(a))),ze(t,Ue(r,{shape:o,checks:[]}))}function ca(t,e){if(!sr(e))throw new Error("Invalid input to extend: expected a plain object");let r=t._zod.def.checks;if(r&&r.length>0){let i=Ve(t);for(let s of Reflect.ownKeys(e))if(Object.getOwnPropertyDescriptor(i,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return ze(t,Ue(t._zod.def,{shape:la(t,e)}))}function la(t,e){let r={};return _t(r,t,Reflect.ownKeys(Ve(t))),jd(r,e),r}function da(t,e){if(!sr(e))throw new Error("Invalid input to safeExtend: expected a plain object");return ze(t,Ue(t._zod.def,{shape:la(t,e)}))}function ha(t,e){if(!e?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(t._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};_t(r,t,Reflect.ownKeys(Ve(t))),_t(r,e,Reflect.ownKeys(Ve(e)));let n=Ue(t._zod.def,{shape:r,get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]});return ze(t,n)}function pa(t,e,r,n="partial"){let s=e._zod.def.checks;if(s&&s.length>0)throw new Error(`.${n}() cannot be used on object schemas containing refinements`);let a=r?new Set(Wr(e,r)):void 0,u={};return _t(u,e,Reflect.ownKeys(Ve(e)),t&&((c,l)=>a&&!a.has(l)?c:new t({type:"optional",innerType:c}))),ze(e,Ue(e._zod.def,{shape:u,checks:[]}))}function fa(t,e,r){let n=r?new Set(Wr(e,r)):void 0,i={};return _t(i,e,Reflect.ownKeys(Ve(e)),(s,o)=>n&&!n.has(o)?s:new t({type:"nonoptional",innerType:s})),ze(e,Ue(e._zod.def,{shape:i}))}function qe(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function vi(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue===!1)return!0;return!1}function Jr(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function Ft(t){return typeof t=="string"?t:t?.message}function Yr(t){let e=[];for(let r of t??[]){let n=r._zod.def;if(!/_(length|size)$|_equals$/.test(n.check))break;let i=n.maximum??n.length??n.size;i>=0&&e.push([i,r])}return e}function ar(t,e,r){var n;for(let i=e;i<t.length;i++)(n=t[i]).schema??(n.schema=r)}function dt(t,e,r){var n;let i=t.inst?._zod?.traits;i?.has("$ZodType")&&(i.has("$ZodCheck")?(n=t).schema??(n.schema=t.inst):t.schema=t.inst);let s=t.schema!==t.inst?t.schema?._zod.def?.error:void 0,o=t.message?t.message:Ft(t.inst?._zod.def?.error?.(t))??Ft(s?.(t))??Ft(e?.error?.(t))??Ft(r.customError?.(t))??Ft(r.localeError?.(t))??"Invalid input",a={};for(let u of Object.keys(t))u==="inst"||u==="schema"||u==="continue"||u==="input"||u==="__proto__"||(a[u]=t[u]);return a.path??(a.path=[]),a.message=o,e?.reportInput&&(a.input=t.input),a}function Yd(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}var Xd=/[\uD800-\uDBFF]/;function Qd(t){let e=t.length;if(!Xd.test(t))return e;let r=e;for(let n=0;n<e-1;n++)(t.charCodeAt(n)&64512)===55296&&(t.charCodeAt(n+1)&64512)===56320&&(r--,n++);return r}function eh(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function th(t){let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"nan":"number";case"object":{if(t===null)return"null";if(Array.isArray(t))return"array";let r=t;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return e}function Xr(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function rh(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function ga(t){let e=atob(t),r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r}function _a(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}function nh(t){let e=t.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-e.length%4)%4);return ga(e+r)}function ih(t){return _a(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function sh(t){let e=t.replace(/^0x/,"");if(e.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)r[n/2]=Number.parseInt(e.slice(n,n+2),16);return r}function oh(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}var di=class{constructor(...e){}};function mi(t,e){for(let r in e){let n=Object.getOwnPropertyDescriptor(e,r);n.get?Object.defineProperty(t,r,{...n,enumerable:!1}):uh(t,r,n.value)}}function je(t,e,r,n=!0){return Object.defineProperty(t,e,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function yi(t,e,r){return je(t,e,r,!1)}function ah(t,e){for(let r in t){let n=t[r];Object.defineProperty(e,r,{configurable:!0,enumerable:!0,get(){return je(this,r,n(this))},set(i){je(this,r,i)}})}return e}function uh(t,e,r){Object.defineProperty(t,e,{configurable:!0,get(){return this==null?r:je(this,e,r.bind(this))},set(n){je(this,e,n)}})}function ch(t,e){let r=Object.getPrototypeOf(t);return e in r?void 0:r}var ci,lt=!1,lh={configurable:!0,get(){lt=!0}};function Ce(t,e,r){let n=Object.getPrototypeOf(t._zod);if(e in n&&ci!==t._zod){ci=void 0;return}ci=t._zod,Object.defineProperty(n,e,{configurable:!0,get(){Object.defineProperty(this,e,lh);let i=lt;lt=!1;try{let s=r(this);return lt?delete this[e]:Object.defineProperty(this,e,{configurable:!0,writable:!0,value:s}),lt=lt||i,s}catch(s){throw delete this[e],lt=lt||i,s}},set(i){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:i})}})}function bi(t,e,r,n){let i=ch(t,e);i&&Object.defineProperty(i,e,{configurable:!0,get(){let s={configurable:!0,writable:!0,enumerable:n,value:void 0};return Object.defineProperty(this,e,s),s.value=r(this),Object.defineProperty(this,e,s),s.value},set(s){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:n,value:s})}})}var va="~constantCatch";function ma(t){let e=()=>t;return e[va]=!0,e}var ya;var xi={value:void 0,enumerable:!1},ba="captureStackTrace"in Error?Error:null;function dh(t){let e=ba;if(e){let r=e.stackTraceLimit;if(typeof r=="number"){try{e.stackTraceLimit=0}catch{return ba=null,new t}try{return new t}finally{e.stackTraceLimit=r}}}return new t}function D(t,e,r,n){let i={};function s(h){this.def=h,this.constr=d,this.traits=new Set}s.prototype=i;let o=r,a=o&&new WeakSet;function u(h,f){if(h._zod){if(h._zod.traits.has(t))return}else{xi.value=new s(f);try{Object.defineProperty(h,"_zod",xi)}finally{xi.value=void 0}}if(h._zod.traits.add(t),e(h,f),a){let g=Object.getPrototypeOf(h),m=h._zod.constr.prototype,v=g;for(;v&&v!==m;)v=Object.getPrototypeOf(v);let w=v??g;a.has(w)||(a.add(w),mi(w,o))}let p=d.prototype;for(let g in p)Object.prototype.hasOwnProperty.call(p,g)&&(g in h||(h[g]=p[g].bind(h)))}let c=n?.Parent??Object;class l extends c{}Object.defineProperty(l,"name",{value:t});function d(h){let f=n?.Parent?dh(l):this;u(f,h);let p=f._zod.deferred;if(p){for(let m of p)m();f._zod.deferred=void 0}let g=globalThis.__zod_globalConfig?.postProcessor;return g&&g(f),f}return Object.defineProperty(d,"init",{value:u}),Object.defineProperty(d,Symbol.hasInstance,{value:h=>n?.Parent&&h instanceof n.Parent?!0:h?._zod?.traits?.has(t)}),Object.defineProperty(d,"name",{value:t}),d}var We=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};(ya=globalThis).__zod_globalConfig??(ya.__zod_globalConfig={});var vt=globalThis.__zod_globalConfig;function mt(t){return t&&Object.assign(vt,t),vt}function hh(){let t=this._zod;return t.message??(t.message=JSON.stringify(t.def,hi,2)),t.message}function ph(t){this._zod.message=t}var fh={get:hh,set:ph,enumerable:!0,configurable:!0},ki={value:void 0,enumerable:!1},xa=new WeakSet([Object.prototype,Error.prototype]),wa=(t,e)=>{t.name="$ZodError",ki.value=e,Object.defineProperty(t,"issues",ki),ki.value=void 0,Object.defineProperty(t,"message",fh);let r=Object.getPrototypeOf(t);xa.has(r)||(xa.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let n=()=>this.message;return Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0})}}))},Ng=D("$ZodError",wa),ur=D("$ZodError",wa,void 0,{Parent:Error});var _h=t=>{let e=(r,n,i,s)=>{let o=i?{...i,async:!1}:{async:!1},a=r._zod.run({value:n,issues:[]},o);if(a instanceof Promise)throw new We;if(a.issues.length){let u=new(s?.Err??t)(a.issues.map(c=>dt(c,o,mt())));throw qr(u,s?.callee??e),u}return a.value};return e},Ei=_h(ur),vh=t=>{let e=async(r,n,i,s)=>{let o=i?{...i,async:!0}:{async:!0},a=r._zod.run({value:n,issues:[]},o);if(a instanceof Promise&&(a=await a),a.issues.length){let u=new(s?.Err??t)(a.issues.map(c=>dt(c,o,mt())));throw qr(u,s?.callee??e),u}return a.value};return e},$i=vh(ur),mh=t=>(e,r,n)=>{let i=n?{...n,async:!1}:{async:!1},s=e._zod.run({value:r,issues:[]},i);if(s instanceof Promise)throw new We;return s.issues.length?ka(t,s.issues,i):{success:!0,data:s.value}},Si=mh(ur);function ka(t,e,r){let n;return{success:!1,get error(){return n||(n=new t(e.map(i=>dt(i,r,mt()))),e=void 0,r=void 0),n},set error(i){n=i,e=void 0,r=void 0}}}var yh=t=>async(e,r,n)=>{let i=n?{...n,async:!0}:{async:!0},s=e._zod.run({value:r,issues:[]},i);return s instanceof Promise&&(s=await s),s.issues.length?ka(t,s.issues,i):{success:!0,data:s.value}},Pi=yh(ur);var Ea=/^[\s\S]{0,}$/;var $a=/^-?\d+(?:\.\d+)?$/,Sa=/^(?:true|false)$/i;var cr=D("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])});var Pa=D("$ZodCheckStringFormat",(t,e)=>{var r,n;cr.init(t,e),e.pattern?(r=t._zod).check??(r.check=i=>{e.pattern.lastIndex=0,!e.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:e.format,input:i.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(n=t._zod).check??(n.check=()=>{})}),Ta=D("$ZodCheckRegex",(t,e)=>{Pa.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}});var Ra={major:4,minor:6,patch:6};var Ee=D("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=Ra;let n=t._zod.def.checks,i=t._zod.traits.has("$ZodCheck")?[t,...n??[]]:n?.length?[...n]:[];for(let s of i)for(let o of s._zod.onattach)o(t);if(i.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let s=(a,u,c)=>{if(a.memo)return a;let l=qe(a),d;for(let h of u){if(h._zod.def.when){if(vi(a)||!h._zod.def.when(a))continue}else if(l)continue;let f=a.issues.length,p=h._zod.check(a);if(p instanceof Promise&&c?.async===!1)throw new We;if(d||p instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await p,a.issues.length!==f&&(ar(a.issues,f,t),l||(l=qe(a,f)))});else{if(a.issues.length===f)continue;ar(a.issues,f,t),l||(l=qe(a,f))}}return d?d.then(()=>a):a},o=(a,u,c)=>{if(qe(a))return a.aborted=!0,a;let l=s(u,i,c);if(l instanceof Promise){if(c.async===!1)throw new We;return l.then(d=>t._zod.parse(d,c))}return t._zod.parse(l,c)};t._zod.run=(a,u)=>{if(u.skipChecks)return t._zod.parse(a,u);if(u.direction==="backward"){let l=t._zod.parse({value:a.value,issues:[]},{...u,skipChecks:!0});return l instanceof Promise?l.then(d=>o(d,a,u)):o(l,a,u)}let c=t._zod.parse(a,u);if(c instanceof Promise){if(u.async===!1)throw new We;return c.then(l=>s(l,i,u))}return s(c,i,u)}}},{get"~standard"(){return yi(this,"~standard",xh(this))},set"~standard"(t){je(this,"~standard",t)}}),Fa=(t,e)=>t.issues.length?{issues:t.issues.map(r=>dt(r,e,mt()))}:{value:t.value};async function bh(t,e){let r={async:!0};return Fa(await t._zod.run({value:e,issues:[]},r),r)}function xh(t){return{validate:e=>{let r={async:!1};try{let n=t._zod.run({value:e,issues:[]},r);if(!(n instanceof Promise))return Fa(n,r)}catch{}return bh(t,e)},vendor:"zod",version:1}}var La=D("$ZodString",(t,e)=>{Ee.init(t,e),t._zod.pattern=e.pattern??Ea,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}});var Za=D("$ZodNumber",(t,e)=>{Ee.init(t,e),t._zod.pattern=$a,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}let i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;let s=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:String(i):void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:t,...s?{received:s}:{}}),r}});var Na=D("$ZodBoolean",(t,e)=>{Ee.init(t,e),t._zod.pattern=Sa,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=!!r.value}catch{}let i=r.value;return typeof i=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:t}),r}});function wh(t,e){let r=Yr(t._zod.def.checks);if(!r.length)return;let n=Math.min(...r.map(s=>s[0])),i=t._zod.parse;t._zod.parse=(s,o)=>{let a=e(s.value);if(a>n&&!o?.skipChecks&&o?.direction!=="backward"){for(let[u,c]of Yr(t._zod.def.checks))if(a>u&&c._zod.def.when(s)){let l=s.issues.length;return c._zod.check(s),s.issues[l].continue=!1,ar(s.issues,l,t),s}}return i(s,o)}}var kh=t=>Array.isArray(t)?t.length:-1;function Ca(t,e,r){t.issues.length&&e.issues.push(...Jr(r,t.issues)),e.value[r]=t.value}var Da=D("$ZodArray",(t,e)=>{Ee.init(t,e);let r=vt.memoizer;r?.attach(t),t._zod.parse=(n,i)=>{let s=n.value;if(!Array.isArray(s))return n.issues.push({expected:"array",code:"invalid_type",input:s,inst:t}),n;n.value=r?r.alloc(t,n,Array(s.length),i):Array(s.length);let o=[],a=i?.abortEarly;for(let u=0;u<s.length;u++){let c=s[u],l=e.element._zod.run({value:c,issues:[]},i);if(l instanceof Promise)o.push(l.then(d=>Ca(d,n,u)));else if(Ca(l,n,u),a&&l.issues.length!==0&&qe(l))break}return o.length?Promise.all(o).then(()=>n):n},wh(t,kh)});function Qr(t,e,r,n,i,s){let o=r in n,a=s==="optional";if(!(!o&&a&&i==="optional")){if(t.issues.length){if(i!==void 0&&a&&!o)return;e.issues.push(...Jr(r,t.issues))}if(!o&&i===void 0){t.issues.length||e.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}t.value===void 0?(o||i==="defaulted"&&!a)&&(e.value[r]=void 0):e.value[r]=t.value}}var Eh=[];function $h(t){let e=Object.keys(t.shape),r=Object.getOwnPropertySymbols(t.shape),n=r.length?r:Eh,i=n.length?[...e,...n]:e;for(let o of i)if(!t.shape?.[o]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(o)}": expected a Zod schema`);let s=_i(t.shape);return{...t,allKeys:i,symbolKeys:n,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(s)}}function Sh(t,e,r,n,i,s,o){let a=[],u=i.keySet,c=i.catchall._zod,l=c.def.type,d=c.optin,h=c.optout,f=0;for(let p in e){if(o&&r.issues.length!==f){if(qe(r,f))break;f=r.issues.length}if(u.has(p))continue;if(p==="__proto__"){l==="never"&&a.push(p);continue}if(l==="never"){a.push(p);continue}let g=c.run({value:e[p],issues:[]},n);g instanceof Promise?t.push(g.then(m=>Qr(m,r,p,e,d,h))):Qr(g,r,p,e,d,h)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:e,inst:s,continue:!0}),t.length?Promise.all(t).then(()=>r):r}var ja=D("$ZodObject",(t,e)=>{Ee.init(t,e);let r=Object.getOwnPropertyDescriptor(e,"shape"),n=r?.get?r.get.raw:e.shape??{};if(n){let c=()=>{let l={...n};return Object.defineProperty(e,"shape",{value:l}),c.raw=l,l};c.raw=n,Object.defineProperty(e,"shape",{get:c})}let i=Vr(()=>$h(e));Ce(t,"propValues",c=>{let l=c.def.shape,d={};for(let h in l){let f=l[h]._zod;if(f.values){Object.prototype.hasOwnProperty.call(d,h)||ir(d,h,new Set);for(let p of f.values)d[h].add(p);f.optin!==void 0&&d[h].add(void 0)}}return d});let s=nr,o=e.catchall,a,u=vt.memoizer;u?.attach(t),t._zod.parse=(c,l)=>{a??(a=i.value);let d=c.value;if(!s(d))return c.issues.push({expected:"object",code:"invalid_type",input:d,inst:t}),c;c.value=u?u.alloc(t,c,{},l):{};let h=[],f=a.shape,p=l?.abortEarly,g=c.issues.length;for(let m of a.allKeys){if(p&&c.issues.length!==g){if(qe(c,g))break;g=c.issues.length}if(m==="__proto__")continue;let v=f[m],w=v._zod.optin,y=v._zod.optout,k=v._zod.run({value:d[m],issues:[]},l);k instanceof Promise?h.push(k.then(T=>Qr(T,c,m,d,w,y))):Qr(k,c,m,d,w,y)}return o?Sh(h,d,c,l,i.value,t,p===!0):h.length?Promise.all(h).then(()=>c):c}});var Ua=D("$ZodEnum",(t,e)=>{Ee.init(t,e);let r=Gr(e.entries),n=new Set(r);t._zod.values=n,Ce(t,"pattern",i=>{let s=Gr(i.def.entries).filter(o=>gi.has(typeof o));return new RegExp(s.length?`^(${s.map(o=>or(o.toString())).join("|")})$`:"^[^\\s\\S]$")}),t._zod.parse=(i,s)=>{let o=i.value;return n.has(o)||i.issues.push({code:"invalid_value",values:r,input:o,inst:t}),i}}),Ha=D("$ZodLiteral",(t,e)=>{Ee.init(t,e);let r=new Set(e.values);t._zod.values=r,Ce(t,"pattern",n=>{let i=n.def.values;return new RegExp(i.length?`^(${i.map(s=>typeof s=="string"?or(s):s?or(s.toString()):String(s)).join("|")})$`:"^[^\\s\\S]$")}),t._zod.parse=(n,i)=>{let s=n.value;return r.has(s)||n.issues.push({code:"invalid_value",values:e.values,input:s,inst:t}),n}});function Ia(t,e){return t.value=e.issues.length?void 0:e.value,t}var Ba=D("$ZodOptional",(t,e)=>{Ee.init(t,e),Ce(t,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),t._zod.optout="optional",Ce(t,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),Ce(t,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${pi(n.source)})?$`):void 0}),t._zod.parse=(r,n)=>{if(r.value===void 0){if(e.innerType._zod.optin!=="defaulted")return r;let i=e.innerType._zod.run({value:r.value,issues:[]},n);return i instanceof Promise?i.then(s=>Ia(r,s)):Ia(r,i)}return e.innerType._zod.run(r,n)}});var Ga=D("$ZodDefault",(t,e)=>{Ee.init(t,e),t._zod.optin="defaulted",Ce(t,"values",r=>r.def.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);if(r.value===void 0)return r.value=e.defaultValue,r;let i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(s=>Aa(s,e)):Aa(i,e)}});function Aa(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}function Oa(t,e,r,n){return e.issues.length?(t.value=r.catchValue({...e,value:t.value,error:{issues:e.issues.map(i=>dt(i,n,mt()))},input:t.value}),t):(t.value=e.value,e.memo&&(t.memo=!0),t)}var Va=D("$ZodCatch",(t,e)=>{Ee.init(t,e),Ce(t,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),Ce(t,"optout",r=>r.def.innerType._zod.optout),Ce(t,"values",r=>r.def.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let i=e.innerType._zod.run({value:r.value,issues:[]},n);return i instanceof Promise?i.then(s=>Oa(r,s,e,n)):Oa(r,i,e,n)}});var qa=D("$ZodCustom",(t,e)=>{cr.init(t,e),Ee.init(t,e),t._zod.parse=(r,n)=>r,t._zod.check=r=>{let n=r.value,i=e.fn(n);if(i instanceof Promise)return i.then(s=>Ma(s,r,n,t));Ma(i,r,n,t)}});function Ma(t,e,r,n){if(!t){let i={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(i.params=n._zod.def.params),e.issues.push(Xr(i))}}function Ka(t){return t.checks&&(t.checks=[...t.checks]),t}function Wa(t,e){return new t(Ka({type:"string",...Re(e)}))}function Ja(t,e){return new t(Ka({type:"number",checks:[],...Re(e)}))}function Ya(t,e){return new t({type:"boolean",...Re(e)})}function zi(t,e){return new Ta({check:"string_format",format:"regex",...Re(e),pattern:t})}function Xa(t,e,r){let n=Re(r);return n.abort??(n.abort=!0),new t({type:"custom",check:"custom",fn:e,...n})}var Fe=D("ZodMiniType",(t,e)=>{if(!t._zod)throw new Error("Uninitialized schema in ZodMiniType.");Ee.init(t,e),t.def=e,t.type=e.type},{get with(){return this.check},set with(t){je(this,"with",t)},parse(t,e){return Ei(this,t,e,{callee:this.parse})},parseAsync(t,e){return $i(this,t,e,{callee:this.parseAsync})},safeParse(t,e){return Si(this,t,e)},safeParseAsync(t,e){return Pi(this,t,e)},check(...t){let e=this.def;return this.clone({...e,checks:[...e.checks??[],...t.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]},{parent:!0})},clone(t,e){return ze(this,t,e)},brand(){return this},register(t,e){return t.add(this,e),this},apply(t,...e){return e.length===0?t(this):t(this,...e)}}),zh=D("ZodMiniString",(t,e)=>{La.init(t,e),Fe.init(t,e)});function yt(t){return Wa(zh,t)}var Rh=D("ZodMiniNumber",(t,e)=>{Za.init(t,e),Fe.init(t,e)});function Ri(t){return Ja(Rh,t)}var Ch=D("ZodMiniBoolean",(t,e)=>{Na.init(t,e),Fe.init(t,e)});function Je(t){return Ya(Ch,t)}var Ih=D("ZodMiniArray",(t,e)=>{Da.init(t,e),Fe.init(t,e)});function Ci(t,e){return new Ih({type:"array",element:t,...Re(e)})}var Ah=D("ZodMiniObject",(t,e)=>{ja.init(t,e),Fe.init(t,e),bi(t,"shape",r=>r._zod.def.shape,!1)});function Ii(t,e){let r={type:"object",shape:t??{},...Re(e)};return new Ah(r)}var Oh=D("ZodMiniEnum",(t,e)=>{Ua.init(t,e),Fe.init(t,e),t.options=[...t._zod.values]});function Qa(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new Oh({type:"enum",entries:r,...Re(e)})}var Mh=D("ZodMiniLiteral",(t,e)=>{Ha.init(t,e),Fe.init(t,e)});function eu(t,e){return new Mh({type:"literal",values:Array.isArray(t)?t:[t],...Re(e)})}var Fh=D("ZodMiniOptional",(t,e)=>{Ba.init(t,e),Fe.init(t,e)});function he(t){return new Fh({type:"optional",innerType:t})}var Lh=D("ZodMiniDefault",(t,e)=>{Ga.init(t,e),Fe.init(t,e)});function Lt(t,e){return new Lh({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():Kr(e)}})}var Zh=D("ZodMiniCatch",(t,e)=>{Va.init(t,e),Fe.init(t,e)});function tu(t,e){return new Zh({type:"catch",innerType:t,catchValue:typeof e=="function"?e:Ke.constantCatch(e)})}var Nh=D("ZodMiniCustom",(t,e)=>{qa.init(t,e),Fe.init(t,e)});function Ai(t,e){return Xa(Nh,t??(()=>!0),e)}var Mi="https://in.dev.heycatch.ai",bt="dev",xt="0.8.5-dev.2662",Fi="phc_CqKdgm7xbFBs3mSdtqzrHNTfzTRKrwRmCrEB9aftENY9";function He(){return typeof globalThis.window<"u"}var Oi=/^hck_pk_[\w-]{32}$/;function ru(t){if(Oi.test(t))return null;let e=t.trim(),r="Copy the key again from the Install page in your HeyCatch dashboard.";if(e!==t&&Oi.test(e))r="Fix: remove the surrounding whitespace.";else if(Oi.test(e.replace(/[.,;:]$/,""))){let n=`the trailing "${e.at(-1)??""}"`;r=e===t?`Fix: remove ${n}.`:`Fix: remove ${n} and the surrounding whitespace.`}return`[HeyCatch] WARNING: config.projectKey ${JSON.stringify(t)} does not look like a HeyCatch project key (expected "hck_pk_" followed by 32 letters, digits, "-" or "_"). Events sent with it will NEVER appear in your dashboard. ${r}`}var Uh=[".chatgpt.site",".vercel.app"];function Hh(t){let e=t.toLowerCase().replace(/\.$/,"");return Uh.some(r=>e.endsWith(r))}function nu({stage:t,hostname:e}){return t!=="dev"||ui(e)||Hh(e)?null:`[HeyCatch] REFUSING to start: this is an internal development build (v${xt}) running on "${e}". No events will be sent. Install the latest stable version instead - resolve it with \`npm view @heycatch/sdk version\` (never a \`-dev.N\` version) - and re-verify against https://heycatch.ai/agents.md`}var lr=["X-HeyCatch-Session-Id","X-HeyCatch-Window-Id","X-HeyCatch-Distinct-Id"],ht="unknown",Bh=["localStorage","cookie","memory","localStorage+cookie","sessionStorage"];var iu=Ii({projectKey:yt({error:'config.projectKey is missing or malformed \u2014 expected a string starting with "hck_pk_". Copy it from your project page in the HeyCatch dashboard.'}).check(zi(/^hck_pk_/,{error:'config.projectKey is missing or malformed \u2014 expected a string starting with "hck_pk_". Copy it from your project page in the HeyCatch dashboard.'})),tracingHosts:Lt(Ci(yt()),[]),install:Lt(Ii({framework:Lt(yt(),ht),frameworkVersion:Lt(yt(),ht),agent:Lt(yt(),ht)}),{framework:ht,frameworkVersion:ht,agent:ht}),autocapture:he(Je()),maskAllText:he(Je()),maskAllElementAttributes:he(Je()),propertyDenylist:he(Ci(yt())),sanitizeProperties:he(Ai(t=>typeof t=="function")),beforeSend:he(Ai(t=>typeof t=="function"||Array.isArray(t)&&t.every(e=>typeof e=="function"))),persistence:he(Qa(Bh)),disablePersistence:he(Je()),cookieExpirationDays:he(Ri()),optOutCapturingByDefault:he(Je()),respectDnt:he(Je()),collectIp:he(Je()),requestBatching:he(Je()),flushIntervalMs:he(Ri()),site:tu(he(eu("landing")),t=>{let e=typeof t.value=="string"?JSON.stringify(t.value):`a ${typeof t.value}`;console.error(`[HeyCatch] config.site must be 'landing' or omitted - got ${e}. Ignoring it; this project is reported as untagged.`)})}),su=["nextjs","vite-react","react","vue","svelte","astro","angular","react-native","web"],ou=["lovable","bolt","v0","replit","cursor","claude-code","codex","windsurf","other"];var Gh=new RegExp(String.raw`^\/(${si})\/?$`),Vh=1e3;function qh(t){return new URLSearchParams({utm_source:oi,utm_campaign:t}).toString()}var Kh=["utm_source","utm_medium","utm_campaign"];function en(){if(!He())return!1;let t=Gh.exec(globalThis.location.pathname);if(!t)return!1;let e=t[1];return e===void 0?!1:(globalThis.location.replace(`/?${qh(e)}`),!0)}function au(t){return t.get("utm_source")===oi&&t.get("utm_campaign")!==null}function tn(){au(new URLSearchParams(globalThis.location.search))&&setTimeout(()=>{let t=new URLSearchParams(globalThis.location.search);if(!au(t))return;for(let r of Kh)t.delete(r);let e=t.toString();globalThis.history.replaceState(globalThis.history.state,"",globalThis.location.pathname+(e===""?"":`?${e}`)+globalThis.location.hash)},Vh)}var _=typeof window<"u"?window:void 0,pe=typeof globalThis<"u"?globalThis:_,_e=pe?.navigator,P=pe?.document,ie=pe?.location,ko=pe?.fetch,ls=pe!=null&&pe.XMLHttpRequest&&"withCredentials"in new pe.XMLHttpRequest?pe.XMLHttpRequest:void 0,uu=pe?.AbortController,Wh=pe?.CompressionStream,xe=_e?.userAgent;function sc(){return!(!_||_.navigator.onLine===!1)}var dr=typeof globalThis<"u"?globalThis:_;dr&&typeof self>"u"&&(dr.self=dr),dr&&typeof File>"u"&&(dr.File=function(){});var C=_??{},j={DEBUG:!1,LIB_VERSION:"0.2.4",LIB_NAME:"browser-common"};function cu(t,e,r,n,i,s,o){try{var a=t[s](o),u=a.value}catch(c){return void r(c)}a.done?e(u):Promise.resolve(u).then(n,i)}function ne(t){return function(){var e=this,r=arguments;return new Promise((function(n,i){var s=t.apply(e,r);function o(u){cu(s,n,i,o,a,"next",u)}function a(u){cu(s,n,i,o,a,"throw",u)}o(void 0)}))}}function x(){return x=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var r=arguments[e];for(var n in r)({}).hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},x.apply(null,arguments)}function oc(t,e){if(t==null)return{};var r={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(e.indexOf(n)!==-1)continue;r[n]=t[n]}return r}var lu=t=>{if(typeof t!="string")return t;try{return JSON.parse(t)}catch{return t}};function du(t){return typeof t=="string"||t}function hu(t){return typeof t=="string"?t:void 0}var hr,Jh=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],rt=(function(t){return t.AnonymousId="anonymous_id",t.DistinctId="distinct_id",t.Props="props",t.EnablePersonProcessing="enable_person_processing",t.PersonMode="person_mode",t.FeatureFlagDetails="feature_flag_details",t.FeatureFlags="feature_flags",t.FeatureFlagPayloads="feature_flag_payloads",t.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",t.BootstrapFeatureFlags="bootstrap_feature_flags",t.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",t.OverrideFeatureFlags="override_feature_flags",t.Queue="queue",t.AiQueue="ai_queue",t.LogsQueue="logs_queue",t.OptedOut="opted_out",t.SessionId="session_id",t.SessionStartTimestamp="session_start_timestamp",t.SessionLastTimestamp="session_timestamp",t.PersonProperties="person_properties",t.GroupProperties="group_properties",t.InstalledAppBuild="installed_app_build",t.InstalledAppVersion="installed_app_version",t.SessionReplay="session_replay",t.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",t.SurveyLastSeenDate="survey_last_seen_date",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t})({}),pu=(function(t){return t.GZipJS="gzip-js",t.Base64="base64",t})({}),Yh=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"],Xh=["token"],ac="NativeGzipValidationError",ds=t=>t.length>=2&&t[0]===31&&t[1]===139,fu=(t,e)=>t===pu.GZipJS||e===pu.GZipJS||e==="gzip",gu=t=>!(!t||typeof t!="object")&&("name"in t?String(t.name):"")==="NotReadableError",rn=t=>{var e=new Error("Native gzip produced invalid output: "+t);throw e.name=ac,e},Qh=(function(){var t=ne((function*(e,r){18>e.size&&rn("too-short");var n=new Uint8Array(yield e.slice(0,10).arrayBuffer());ds(n)&&n[2]===8||rn("invalid-header");var i=new DataView(yield e.slice(e.size-8).arrayBuffer());i.getUint32(0,!0)!==(o=>{for(var a=(()=>{if(hr)return hr;hr=[];for(var l=0;256>l;l++){for(var d=l,h=0;8>h;h++)d=1&d?3988292384^d>>>1:d>>>1;hr[l]=d>>>0}return hr})(),u=4294967295,c=0;o.length>c;c++)u=a[255&(u^o[c])]^u>>>8;return(4294967295^u)>>>0})(r)&&rn("invalid-crc");var s=r.length>>>0;i.getUint32(4,!0)!==s&&rn("invalid-size")}));return function(e,r){return t.apply(this,arguments)}})();function hs(){return hs=ne((function*(t,e,r){e===void 0&&(e=!0);try{var n=new TextEncoder().encode(t),i=new globalThis.CompressionStream("gzip"),s=i.writable.getWriter(),o=s.write(n).then((()=>s.close())).catch((function(){var c=ne((function*(l){try{yield s.abort(l)}catch{}throw l}));return function(l){return c.apply(this,arguments)}})()),a=new Response(i.readable).blob(),u=(yield Promise.all([a,o]))[0];return yield Qh(u,n),u}catch(c){if(r!=null&&r.rethrow)throw c;return e&&console.error("Failed to gzip compress data",c),null}})),hs.apply(this,arguments)}var ep=["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"],_u=function(t,e){if(e===void 0&&(e=[]),!t)return!1;var r=t.toLowerCase();return ep.concat(e).some((n=>{var i=n.toLowerCase();return r.indexOf(i)!==-1}))};function A(t,e){return t.indexOf(e)!==-1}var Jn=function(t){return t.trim()},ps=function(t){return t.replace(/^\$/,"")};function uc(t){var e,r=[];return(e=JSON.stringify(t,(function(n,i){if(typeof i=="bigint")return i.toString();if(typeof i!="function"&&typeof i!="symbol"){if(i instanceof Error)return{name:i.name,message:i.message,stack:i.stack};if(i&&typeof i=="object"){for(;r.length>0&&r[r.length-1]!==this;)r.pop();if(r.includes(i))return"[Circular]";r.push(i)}return i}})))!==null&&e!==void 0?e:"null"}var cc=Object.prototype,lc=cc.hasOwnProperty,Yn=cc.toString,O=Array.isArray||function(t){return Yn.call(t)==="[object Array]"},Ze=t=>typeof t=="function",Y=t=>t===Object(t)&&!O(t),pt=t=>{if(Y(t)){for(var e in t)if(lc.call(t,e))return!1;return!0}return!1},E=t=>t===void 0,H=t=>Yn.call(t)=="[object String]",fs=t=>H(t)&&t.trim().length===0,me=t=>t===null,F=t=>E(t)||me(t),de=t=>Yn.call(t)=="[object Number]"&&t==t,et=t=>de(t)&&t>0,Ne=t=>Yn.call(t)==="[object Boolean]",tp=t=>t instanceof FormData,rp=t=>A(Yh,t),np=t=>A(Xh,t);function dc(t){return t===null||typeof t!="object"}function bn(t,e){return{}.toString.call(t)==="[object "+e+"]"}function Eo(t){return typeof Event<"u"&&(function(e,r){try{return e instanceof r}catch{return!1}})(t,Event)}var ip=[!0,"true",1,"1","yes"],Li=t=>A(ip,t),sp=[!1,"false",0,"0","no"];function Ge(t,e,r,n,i){return e>r&&(n.warn("min cannot be greater than max."),e=r),de(t)?t>r?(n.warn(" cannot be greater than max: "+r+". Using max value instead."),r):e>t?(n.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(n.warn(" must be a number. using max or fallback. max: "+r+", fallback: "+i),Ge(i||r,e,r,n))}var gs=class{constructor(e){this.$e={},this.ze=e.ze,this.Ze=Ge(e.bucketSize,0,100,e.Ge),this.Qe=Ge(e.refillRate,0,this.Ze,e.Ge),this.Je=Ge(e.refillInterval,0,864e5,e.Ge)}Ke(e,r){var n=Math.floor((r-e.lastAccess)/this.Je);n>0&&(e.tokens=Math.min(e.tokens+n*this.Qe,this.Ze),e.lastAccess=e.lastAccess+n*this.Je)}consumeRateLimit(e){var r,n=Date.now(),i=String(e),s=this.$e[i];return s?this.Ke(s,n):this.$e[i]=s={tokens:this.Ze,lastAccess:n},s.tokens===0||(s.tokens--,s.tokens===0&&((r=this.ze)==null||r.call(this,e)),s.tokens===0)}stop(){this.$e={}}},Se="Mobile",xn="iOS",at="Android",Wt="Tablet",hc=at+" "+Wt,pc="iPad",fc="Apple",gc=fc+" Watch",Pr="Safari",Jt="BlackBerry",_c="Samsung",vc=_c+"Browser",mc=_c+" Internet",At="Chrome",op=At+" OS",yc=At+" "+xn,$o="Internet Explorer",bc=$o+" "+Se,So="Opera",ap=So+" Mini",Po="Edge",xc="Microsoft "+Po,qt="Firefox",wc=qt+" "+xn,Or="Nintendo",Mr="PlayStation",Kt="Xbox",kc=at+" "+Se,Ec=Se+" "+Pr,wr="Windows",_s=wr+" Phone",vu="Nokia",vs="Ouya",$c="Generic",up=$c+" "+Se.toLowerCase(),Sc=$c+" "+Wt.toLowerCase(),ms="Konqueror",Pc="Oculus Browser",wn="Vivaldi",Tc="Yandex",kn="Whale",ys="DuckDuckGo",zc="Pale Moon",En="Waterfox",Tr="Brave",Rc="Google Search App",te="(\\d+(\\.\\d+)?)",Zi=new RegExp("Version/"+te),cp=new RegExp(Kt,"i"),lp=new RegExp(Mr+" \\w+","i"),dp=new RegExp(Or+" \\w+","i"),To=new RegExp(Jt+"|PlayBook|BB10","i"),hp={"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"},Cc=function(t,e,r,n){e=e||"";var i=(function(s){return s!=null&&s.brave?Tr:null})(r);return i||(n!=null&&n.detectGoogleSearchApp&&A(t,"GSA/")?Rc:A(t," OPR/")&&A(t,"Mini")?ap:A(t," OPR/")?So:To.test(t)?Jt:A(t,"IE"+Se)||A(t,"WPDesktop")?bc:A(t,"OculusBrowser")?Pc:A(t,vc)?mc:A(t,Po)||A(t,"Edg/")?xc:A(t,wn+"/")?wn:A(t,"YaBrowser/")?Tc:A(t,kn+"/")?kn:A(t,ys+"/")||A(t,"Ddg/")?ys:A(t,"FBIOS")?"Facebook "+Se:A(t,"UCWEB")||A(t,"UCBrowser")?"UC Browser":A(t,"CriOS")?yc:A(t,"CrMo")||A(t,At)?At:A(t,at)&&A(t,Pr)?kc:A(t,"FxiOS")?wc:A(t.toLowerCase(),ms.toLowerCase())?ms:A(t,Tr+"/")?Tr:((s,o)=>o&&A(o,fc)||(function(a){return A(a,Pr)&&!A(a,At)&&!A(a,at)})(s))(t,e)?A(t,Se)?Ec:Pr:A(t,"PaleMoon/")?zc:A(t,En+"/")?En:A(t,qt)?qt:A(t,"MSIE")||A(t,"Trident/")?$o:A(t,"Gecko")?qt:"")},pp={[bc]:[new RegExp("rv:"+te)],[xc]:[new RegExp(Po+"?\\/"+te)],[At]:[new RegExp("("+At+"|CrMo)\\/"+te)],[yc]:[new RegExp("CriOS\\/"+te)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+te)],[Pr]:[Zi],[Ec]:[Zi],[So]:[new RegExp("(Opera|OPR)\\/"+te)],[qt]:[new RegExp(qt+"\\/"+te)],[wc]:[new RegExp("FxiOS\\/"+te)],[ms]:[new RegExp("Konqueror[:/]?"+te,"i")],[Jt]:[new RegExp(Jt+" "+te),Zi],[kc]:[new RegExp("android\\s"+te,"i")],[mc]:[new RegExp(vc+"\\/"+te)],[Pc]:[new RegExp("OculusBrowser\\/"+te)],[wn]:[new RegExp(wn+"\\/"+te)],[Tc]:[new RegExp("YaBrowser\\/"+te)],[kn]:[new RegExp(kn+"\\/"+te)],[Tr]:[new RegExp(Tr+"\\/"+te)],[ys]:[new RegExp("(DuckDuckGo|Ddg)\\/"+te)],[zc]:[new RegExp("PaleMoon\\/"+te)],[En]:[new RegExp(En+"\\/"+te)],[Rc]:[new RegExp("GSA\\/"+te)],[$o]:[new RegExp("(rv:|MSIE )"+te)],Mozilla:[new RegExp("rv:"+te)]},fp=function(t,e,r,n){var i=Cc(t,e,r,n),s=pp[i];if(E(s))return null;for(var o=0;s.length>o;o++){var a=t.match(s[o]);if(a)return parseFloat(a[a.length-2])}return null},mu=[[new RegExp(Kt+"; "+Kt+" (.*?)[);]","i"),t=>[Kt,t&&t[1]||""]],[new RegExp(Or,"i"),[Or,""]],[new RegExp(Mr,"i"),[Mr,""]],[To,[Jt,""]],[new RegExp(wr,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[_s,""];if(new RegExp(Se).test(e)&&!/IEMobile\b/.test(e))return[wr+" "+Se,""];var r=/Windows NT ([0-9.]+)/i.exec(e);if(r&&r[1]){var n=hp[r[1]]||"";return/arm/i.test(e)&&(n="RT"),[wr,n]}return[wr,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[xn,[t[3],t[4],t[5]||"0"].join(".")]:[xn,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=E(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+at+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+at+")","i"),t=>t&&t[2]?[at,[t[2],t[3],t[4]||"0"].join(".")]:[at,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var e=["Mac OS X",""];return t&&t[1]&&(e[1]=[t[1],t[2],t[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[op,""]],[/Linux|debian/i,["Linux",""]]],yu=function(t){return dp.test(t)?Or:lp.test(t)?Mr:cp.test(t)?Kt:new RegExp(vs,"i").test(t)?vs:new RegExp("("+_s+"|WPDesktop)","i").test(t)?_s:/iPad/.test(t)?pc:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?gc:To.test(t)?Jt:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(vu,"i").test(t)?vu:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(Se).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?at:hc:new RegExp("(pda|"+Se+")","i").test(t)?up:new RegExp(Wt,"i").test(t)&&!new RegExp(Wt+" pc","i").test(t)?Sc:""},gp=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function bu(t,e){return typeof(r=t)=="string"&&gp.test(r)?t:e();var r}function ft(t){return t&&t.split("#")[0]}function pn(t,e){var r=setTimeout(t,e);return r?.unref&&r?.unref(),r}var _p=t=>t instanceof Error,Ic={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},vp=Ic.info;function Ac(t){if(Ne(t))return{boolValue:t};if(typeof t=="number")return Number.isFinite(t)?Number.isInteger(t)?{intValue:t}:{doubleValue:t}:{stringValue:String(t)};if(typeof t=="string")return{stringValue:t};if(O(t))return{arrayValue:{values:t.map((e=>Ac(e)))}};try{return{stringValue:JSON.stringify(t)}}catch{return{stringValue:String(t)}}}function $n(t){var e=[];for(var r in t){var n=t[r];me(n)||E(n)||e.push({key:r,value:Ac(n)})}return e}function mp(t,e){var r=Ic[t.level||"info"]||vp,n=r.text,i=r.number,s=String(Date.now())+"000000",o={};e.distinctId&&(o.posthogDistinctId=e.distinctId),e.sessionId&&(o.sessionId=e.sessionId),e.windowId&&(o["window.id"]=e.windowId),F(e.sessionStartTimestamp)||(o.sessionStartTimestamp=String(e.sessionStartTimestamp)),F(e.lastActivityTimestamp)||(o.lastActivityTimestamp=String(e.lastActivityTimestamp)),e.currentUrl&&(o["url.full"]=e.currentUrl),e.screenName&&(o["screen.name"]=e.screenName),e.appState&&(o["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(o.feature_flags=e.activeFeatureFlags);var a=x({},o,t.attributes||{}),u={timeUnixNano:s,observedTimeUnixNano:s,severityNumber:i,severityText:n,body:{stringValue:t.body},attributes:$n(a)};return t.trace_id&&(u.traceId=t.trace_id),t.span_id&&(u.spanId=t.span_id),E(t.trace_flags)||(u.flags=t.trace_flags),u}function Oc(t,e,r){return x({},t.resourceAttributes,{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment},t.serviceVersion&&{"service.version":t.serviceVersion},{"telemetry.sdk.name":e,"telemetry.sdk.version":r})}function Mc(t,e,r,n){return{resourceLogs:[{resource:{attributes:$n(e)},scopeLogs:[{scope:{name:r,version:n},logRecords:t}]}]}}var yp=class{constructor(t,e,r,n,i,s,o){var a;s===void 0&&(s=()=>Promise.resolve()),this._instance=t,this.Te=e,this.Ge=r,this.Ye=n,this.Xe=i,this.et=s,this.tt=o,this.rt=null,this.it=0,this.nt=0,this.st=0,this.ot=0,this.ut=!1,this.ht=e.maxBufferSize,this.dt=Math.max((a=e.maxQueueSize)!==null&&a!==void 0?a:e.maxBufferSize,e.maxBufferSize),this.ct=e.flushIntervalMs,this.vt=e.maxBatchRecordsPerPost,this.ft=e.rateCapWindowMs,this.yt=e.maxLogsPerInterval}reset(){this.bt(),this.rt=null,this.st=0,this.ot=0,this.ut=!1,this.it=0,this.nt=0,this.vt=this.Te.maxBatchRecordsPerPost}onReconnect(){this.nt=0,this._t()}captureLog(t){if(!this._instance.isDisabled&&!this._instance.optedOut&&t!=null&&t.body){var e=this.wt(t);if(e!==null)if(e.body){if(this.xt()){var r={record:mp(e,this.Ye())};this.Xe((()=>this.kt(r)))}}else this.Ge.info("Log was rejected in beforeSend function")}}wt(t){var e=this.Te.beforeSend;if(!e)return t;var r=O(e)?e:[e],n=t;for(var i of r)try{var s=i(n);if(!s)return this.Ge.info("Log was rejected in beforeSend function"),null;n=s}catch(o){return this.Ge.error("Error in beforeSend function for log:",o),null}return n}xt(){if(this.yt===void 0)return!0;var t=Date.now(),e=t-this.st;return this.ft>e&&e>=0||(this.st=t,this.ot=0,this.ut=!1),this.yt>this.ot?(this.ot++,!0):(this.ut||(this.Ge.warn("captureLog dropping logs: exceeded "+this.yt+" logs per "+this.ft+"ms"),this.ut=!0),!1)}flush(){var t=this;return ne((function*(){if(!t._instance.isDisabled)return t.rt||(t.rt=t.St().finally((()=>{t.rt=null}))),t.rt}))()}St(){var t=this;return ne((function*(){var e;t.bt();var r=(e=t._instance.getPersistedProperty(rt.LogsQueue))!==null&&e!==void 0?e:[];if(r.length!==0)for(var n=r.length,i=0;r.length>0&&n>i;){var s,o;t.it=0;var a=Math.min(r.length,t.vt),u=r.slice(0,a),c=Mc(u.map((d=>d.record)),t.Ct(),(s=t.tt)!==null&&s!==void 0?s:t._instance.getLibraryId(),t._instance.getLibraryVersion()),l=yield t._instance.Tt(c);if(l.kind==="too-large"&&u.length>1)t.vt=Math.max(1,Math.floor(u.length/2)),t.Ge.warn("Received 413 when sending logs batch of size "+u.length+", reducing batch size to "+t.vt);else if(l.kind==="retry-later"||(l.kind==="too-large"?t.Ge.warn("Dropping a single log record after 413 with batch size 1 \u2014 the record is larger than the server cap and cannot be split further."):l.kind==="ok"&&t.Te.maxBatchRecordsPerPost>t.vt&&(t.vt=Math.min(t.Te.maxBatchRecordsPerPost,t.vt+1)),yield t.It(u.length),r=(o=t._instance.getPersistedProperty(rt.LogsQueue))!==null&&o!==void 0?o:[],i+=u.length,l.kind==="fatal"))throw l.error}}))()}It(t){var e=this;return ne((function*(){var r,n=Math.max(0,t-e.it),i=(r=e._instance.getPersistedProperty(rt.LogsQueue))!==null&&r!==void 0?r:[];e._instance.setPersistedProperty(rt.LogsQueue,i.slice(n)),yield e.et()}))()}Ct(){return Oc(this.Te,this._instance.getLibraryId(),this._instance.getLibraryVersion())}kt(t){var e;if(!this._instance.optedOut){var r=(e=this._instance.getPersistedProperty(rt.LogsQueue))!==null&&e!==void 0?e:[];this.dt>r.length||(r.shift(),this.it++,this.Ge.info("Logs queue is full, dropping oldest record.")),r.push(t),this._instance.setPersistedProperty(rt.LogsQueue,r),this.ht>r.length?this.Mt():this._t()}}Mt(t){t===void 0&&(t=this.ct),this.Et||(this.Et=pn((()=>{this.Et=void 0,this._t()}),t))}Rt(){var t=Math.min(Math.max(0,this.nt-1),6);return this.ct*Math.pow(2,t)}Pt(){var t=this._instance.getPersistedProperty(rt.LogsQueue);return!!t&&t.length>0}shutdown(t){var e=this;return ne((function*(){e.bt();var r=e.flush().catch((()=>{}));t!==void 0?yield Promise.race([r,new Promise((n=>pn(n,t)))]):yield r}))()}flushWithTimeout(t){var e=this;return ne((function*(){var r=!1,n=e.flush(),i=new Promise((s=>pn((()=>{r=!0,s()}),t)));try{yield Promise.race([n,i])}finally{r&&n.catch((()=>{}))}}))()}_t(){this.flush().then((()=>{this.nt=0}),(t=>{this.nt++,this.Ge.error("PostHog logs flush failed:",t)})).finally((()=>{!this._instance.isDisabled&&this.Pt()&&this.Mt(this.Rt())}))}bt(){this.Et&&(clearTimeout(this.Et),this.Et=void 0)}},Ni=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function xu(t){return String(t)+"000000"}function wu(t,e,r,n){var i="";return n&&(i=Object.keys(n).sort().map((s=>JSON.stringify(s)+":"+JSON.stringify(n[s]))).join(",")),t+"\0"+e+"\0"+(r??"")+"\0"+i}var bp=class{constructor(t,e,r){this._instance=t,this.Te=e,this.Ge=r,this.Ot=new Map,this.rt=null,this.Ft=!1,this.Lt=new Map,this.$t=new Set,this.At=0}count(t,e,r){e===void 0&&(e=1),this.Nt({name:t,type:"count",value:e,unit:r?.unit,attributes:r?.attributes})}gauge(t,e,r){this.Nt({name:t,type:"gauge",value:e,unit:r?.unit,attributes:r?.attributes})}histogram(t,e,r){this.Nt({name:t,type:"histogram",value:e,unit:r?.unit,attributes:r?.attributes})}flush(){var t=this,e=this.rt,r=(function(){var i=ne((function*(){e&&(yield e.catch((()=>{}))),yield t.Dt()}));return function(){return i.apply(this,arguments)}})(),n=r().finally((()=>{this.rt===n&&(this.rt=null)}));return this.rt=n,n}drainWindow(){if(this.Ot.size===0)return null;var t=this.Ot;return this.Ot=new Map,this.Ft=!1,this.Lt=new Map,this.$t=new Set,this.qt(t)}reset(){this.At++,this.bt(),this.Ot=new Map,this.rt=null,this.Ft=!1,this.Lt=new Map,this.$t=new Set}Nt(t){if(!this._instance.isDisabled&&!this._instance.optedOut){var e=this.wt(t);if(e!==null)if(e.name&&typeof e.name=="string")if(typeof e.value=="number"&&Number.isFinite(e.value))if(e.type==="count"&&0>e.value)this.Ge.warn("Dropping count '"+e.name+"': counters are monotonic, value must be >= 0");else{var r,n;try{r=e.attributes?x({},e.attributes):void 0,n=wu(e.type,e.name,e.unit,r)}catch(o){return void this.Ge.warn("Dropping metric '"+e.name+"': attributes could not be serialized",o)}var i=this.Ot.get(n);if(!i){if(!this.jt())return;i={name:e.name,type:e.type,unit:e.unit,attributes:r,windowStartMs:Date.now()},this.Ot.set(n,i)}var s=this.Lt.get(e.name);s===void 0?this.Lt.set(e.name,e.type):s===e.type||this.$t.has(e.name)||(this.$t.add(e.name),this.Ge.warn("Metric name '"+e.name+"' is already used as a "+s+"; recording it as a "+e.type+" too will blend both series in charts. Use a distinct name.")),this.Ht(i,e.value),this.Mt()}else this.Ge.warn("Dropping metric '"+e.name+"': value must be a finite number");else this.Ge.warn("Dropping metric with empty name")}}jt(){return this.Te.maxSeriesPerFlush>this.Ot.size||(this.Ft||(this.Ft=!0,this.Ge.warn("Metric series cap reached ("+this.Te.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}Ht(t,e){var r;switch(t.type){case"count":t.total=((r=t.total)!==null&&r!==void 0?r:0)+e;break;case"gauge":t.last=e;break;case"histogram":t.hist||(t.hist={count:0,sum:0,min:e,max:e,bucketCounts:new Array(Ni.length+1).fill(0)});var n=t.hist;n.count+=1,n.sum+=e,n.min=Math.min(n.min,e),n.max=Math.max(n.max,e),n.bucketCounts[(function(i,s){for(var o=0;s.length>o;o++)if(s[o]>=i)return o;return s.length})(e,Ni)]+=1}}wt(t){var e=this.Te.beforeSend;if(!e)return t;var r=O(e)?e:[e],n=t;for(var i of r)try{var s=i(n);if(!s)return this.Ge.info("Metric was rejected in beforeSend function"),null;n=s}catch(o){return this.Ge.error("Error in beforeSend function for metric:",o),null}return n}Mt(){this.Et||(this.Et=pn((()=>{this.Et=void 0,this.flush().catch((t=>{this.Ge.error("Metrics flush failed:",t)}))}),this.Te.flushIntervalMs))}bt(){this.Et&&(clearTimeout(this.Et),this.Et=void 0)}Dt(){var t=this;return ne((function*(){if(t.Ot.size!==0){var e=t.Ot;t.Ot=new Map,t.Ft=!1,t.Lt=new Map,t.$t=new Set;var r=t.At,n=yield t._instance.Bt(t.qt(e));if(r===t.At)switch(n.kind){case"ok":return;case"retry-later":return t.Ut(e),void t.Mt();case"too-large":return void t.Ge.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.Ge.error("Failed to send metrics batch:",n.error)}}}))()}qt(t){return e=this.zt(t),r=(function(s,o,a){return x({},s.resourceAttributes,{"service.name":s.serviceName||"unknown_service"},s.environment&&{"deployment.environment":s.environment},s.serviceVersion&&{"service.version":s.serviceVersion},{"telemetry.sdk.name":o,"telemetry.sdk.version":a})})(this.Te,this._instance.getLibraryId(),this._instance.getLibraryVersion()),n=this._instance.getLibraryId(),i=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:$n(r)},scopeMetrics:[{scope:{name:n,version:i},metrics:e}]}]};var e,r,n,i}zt(t){var e=xu(Date.now()),r=new Map;for(var n of t.values()){var i,s=wu(n.type,n.name,n.unit,void 0),o=r.get(s);o||(o=x({name:n.name},n.unit&&{unit:n.unit}),n.type==="count"?o.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:n.type==="gauge"?o.gauge={dataPoints:[]}:o.histogram={aggregationTemporality:1,dataPoints:[]},r.set(s,o));var a=$n((i=n.attributes)!==null&&i!==void 0?i:{}),u=xu(n.windowStartMs);if(n.type==="count"){var c,l={attributes:a,startTimeUnixNano:u,timeUnixNano:e,asDouble:(c=n.total)!==null&&c!==void 0?c:0};o.sum.dataPoints.push(l)}else if(n.type==="gauge"){var d,h={attributes:a,timeUnixNano:e,asDouble:(d=n.last)!==null&&d!==void 0?d:0};o.gauge.dataPoints.push(h)}else n.hist&&o.histogram.dataPoints.push({attributes:a,startTimeUnixNano:u,timeUnixNano:e,count:n.hist.count,sum:n.hist.sum,min:n.hist.min,max:n.hist.max,bucketCounts:n.hist.bucketCounts,explicitBounds:Ni})}return Array.from(r.values())}Ut(t){var e,r;for(var n of t){var i=n[0],s=n[1],o=this.Ot.get(i);if(o)switch(o.windowStartMs=Math.min(o.windowStartMs,s.windowStartMs),o.type){case"count":o.total=((e=o.total)!==null&&e!==void 0?e:0)+((r=s.total)!==null&&r!==void 0?r:0);break;case"gauge":break;case"histogram":if(s.hist)if(o.hist){o.hist.count+=s.hist.count,o.hist.sum+=s.hist.sum,o.hist.min=Math.min(o.hist.min,s.hist.min),o.hist.max=Math.max(o.hist.max,s.hist.max);for(var a=0;o.hist.bucketCounts.length>a;a++)o.hist.bucketCounts[a]+=s.hist.bucketCounts[a]}else o.hist=s.hist}else this.jt()&&this.Ot.set(i,s)}}},nn,ku,Di;function xp(t){var e=globalThis._posthogChunkIds;if(e){var r=Object.keys(e);return Di&&r.length===ku||(ku=r.length,Di=r.reduce(((n,i)=>{nn||(nn={});var s=nn[i];if(s)n[s[0]]=s[1];else for(var o=t(i),a=o.length-1;a>=0;a--){var u=o[a],c=u?.filename,l=e[i];if(c&&l){n[c]=l,nn[i]=[c,l];break}}return n}),{})),Di}}var bs=class{constructor(e,r,n){n===void 0&&(n=[]),this.coercers=e,this.stackParser=r,this.modifiers=n}buildFromUnknown(e,r){r===void 0&&(r={});var n=r&&r.mechanism||{handled:!0,type:"generic"},i=this.buildCoercingContext(n,r,0).apply(e),s=this.buildParsingContext(r),o=this.parseStacktrace(i,s);return{$exception_list:this.convertToExceptionList(o,n),$exception_level:"error"}}modifyFrames(e){var r=this;return ne((function*(){for(var n of e)n.stacktrace&&n.stacktrace.frames&&O(n.stacktrace.frames)&&(n.stacktrace.frames=yield r.applyModifiers(n.stacktrace.frames));return e}))()}coerceFallback(e){var r;return{type:"Error",value:"Unknown error",stack:(r=e.syntheticException)==null?void 0:r.stack,synthetic:!0}}parseStacktrace(e,r){var n,i;return e.cause!=null&&(n=this.parseStacktrace(e.cause,r)),e.stack!=""&&e.stack!=null&&(i=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?r.skipFirstLines:0),r.chunkIdMap)),x({},e,{cause:n,stack:i})}applyChunkIds(e,r){return e.map((n=>(n.filename&&r&&(n.chunk_id=r[n.filename]),n)))}applyCoercers(e,r){for(var n of this.coercers)if(n.match(e))return n.coerce(e,r);return this.coerceFallback(r)}applyModifiers(e){var r=this;return ne((function*(){var n=e;for(var i of r.modifiers)n=yield i(n);return n}))()}convertToExceptionList(e,r){var n,i,s,o={type:e.type,value:e.value,mechanism:{type:(n=r.type)!==null&&n!==void 0?n:"generic",handled:(i=r.handled)===null||i===void 0||i,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,x({},r,{handled:!0}))),a}buildParsingContext(e){var r;return{chunkIdMap:xp(this.stackParser),skipFirstLines:(r=e.skipFirstLines)!==null&&r!==void 0?r:1}}buildCoercingContext(e,r,n){n===void 0&&(n=0);var i=(s,o)=>{if(4>=o){var a=this.buildCoercingContext(e,r,o);return this.applyCoercers(s,a)}};return x({},r,{syntheticException:n==0?r.syntheticException:void 0,mechanism:e,apply:s=>i(s,n),next:s=>i(s,n+1)})}},Yt="?";function xs(t,e,r,n,i){var s={platform:t,filename:e,function:r==="<anonymous>"?Yt:r,in_app:!0};return E(n)||(s.lineno=n),E(i)||(s.colno=i),s}var Fc=(t,e)=>{var r=t.indexOf("safari-extension")!==-1,n=t.indexOf("safari-web-extension")!==-1;return r||n?[t.indexOf("@")!==-1?t.split("@")[0]:Yt,r?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},wp=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,kp=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Ep=/\((\S*)(?::(\d+))(?::(\d+))\)/,$p=(t,e)=>{var r=wp.exec(t);if(r)return xs(e,r[1],Yt,+r[2],+r[3]);var n=kp.exec(t);if(n){if(n[2]&&n[2].indexOf("eval")===0){var i=Ep.exec(n[2]);i&&(n[2]=i[1],n[3]=i[2],n[4]=i[3])}var s=Fc(n[1]||Yt,n[2]);return xs(e,s[1],s[0],n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}},Sp=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Pp=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Tp=(t,e)=>{var r=Sp.exec(t);if(r){if(r[3]&&r[3].indexOf(" > eval")>-1){var n=Pp.exec(r[3]);n&&(r[1]=r[1]||"eval",r[3]=n[1],r[4]=n[2],r[5]="")}var i=r[3],s=r[1]||Yt,o=Fc(s,i);return xs(e,i=o[1],s=o[0],r[4]?+r[4]:void 0,r[5]?+r[5]:void 0)}},Eu=/\(error: (.*)\)/,ws=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,r){var n=H(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:n?e.stack:void 0,cause:e.cause?r.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var r=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?r+": "+e.message:r}isDOMException(e){return bn(e,"DOMException")}isDOMError(e){return bn(e,"DOMError")}},ks=class{match(e){return(r=>r instanceof Error)(e)}coerce(e,r){return{type:this.getType(e),value:this.getMessage(e,r),stack:this.getStack(e),cause:e.cause?r.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,r){var n=e.message;return String(n.error&&typeof n.error.message=="string"?n.error.message:n)}getStack(e){return e.stacktrace||e.stack||void 0}},Es=class{constructor(){}match(e){return bn(e,"ErrorEvent")&&e.error!=null}coerce(e,r){var n;return r.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:(n=r.syntheticException)==null?void 0:n.stack,synthetic:!0}}},zp=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,$s=class{match(e){return typeof e=="string"}coerce(e,r){var n,i=this.getInfos(e),s=i[0],o=i[1];return{type:s??"Error",value:o??e,stack:(n=r.syntheticException)==null?void 0:n.stack,synthetic:!0}}getInfos(e){var r="Error",n=e,i=e.match(zp);return i&&(r=i[1],n=i[2]),[r,n]}},Rp=["fatal","error","warning","log","info","debug"];function Lc(t,e){e===void 0&&(e=40);var r=Object.keys(t);if(r.sort(),!r.length)return"[object has no keys]";for(var n=r.length;n>0;n--){var i=r.slice(0,n).join(", ");if(e>=i.length)return n===r.length?i:i.length>e?i.slice(0,e)+"...":i}return""}var Ss=class{match(e){return typeof e=="object"&&e!==null}coerce(e,r){var n,i=this.getErrorPropertyFromObject(e);return i?r.apply(i):{type:this.getType(e),value:this.getValue(e),stack:(n=r.syntheticException)==null?void 0:n.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return Eo(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){var r="'"+e.name+"' captured as exception";return"message"in e&&typeof e.message=="string"&&(r+=" with message: '"+e.message+"'"),r}if("message"in e&&typeof e.message=="string")return e.message;var n=this.getObjectClassName(e);return(n&&n!=="Object"?"'"+n+"'":"Object")+" captured as exception with keys: "+Lc(e)}isSeverityLevel(e){return H(e)&&!fs(e)&&Rp.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var r in e)if({}.hasOwnProperty.call(e,r)){var n=e[r];if(_p(n))return n}}getObjectClassName(e){try{var r=Object.getPrototypeOf(e);return r?r.constructor.name:void 0}catch{return}}},Ps=class{match(e){return Eo(e)}coerce(e,r){var n,i=e.constructor.name;return{type:i,value:i+" captured as exception with keys: "+Lc(e),stack:(n=r.syntheticException)==null?void 0:n.stack,synthetic:!0}}},Ts=class{match(e){return dc(e)}coerce(e,r){var n;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(n=r.syntheticException)==null?void 0:n.stack,synthetic:!0}}},zs=class{match(e){return bn(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!Eo(e))return!1;try{var r=e.detail;return r!=null&&typeof r=="object"&&"reason"in r}catch{return!1}}coerce(e,r){var n,i=this.getUnhandledRejectionReason(e);return dc(i)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(i),stack:(n=r.syntheticException)==null?void 0:n.stack,synthetic:!0}:r.apply(i)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&e.detail!=null&&typeof e.detail=="object"&&"reason"in e.detail)return e.detail.reason}catch{}return e}},Sn="$message",Pn="$timestamp",Cp=new Set([Sn,Pn]),ji={enabled:!0,max_bytes:32768};function Tn(t){var e;return t?{enabled:(e=t.enabled)!==null&&e!==void 0?e:ji.enabled,max_bytes:Ip(t.max_bytes,ji.max_bytes)}:x({},ji)}var Rs=class{constructor(e){this.Vt=[],this.Wt=0,this.Te=Tn(e)}setConfig(e){this.Te=Tn(e),this.Zt()}add(e){var r=(function(i){var s;try{s=uc(i)}catch{return}try{var o=JSON.parse(s);if(!Y(o))return;var a=o,u=a[Sn],c=a[Pn];return!H(u)||u.trim().length===0||!H(c)&&!de(c)?void 0:{step:a,json:s}}catch{return}})(e);if(r){var n=(function(i){if(typeof TextEncoder<"u")return new TextEncoder().encode(i).length;for(var s=encodeURIComponent(i),o=0,a=0;s.length>a;a++)s[a]==="%"?(o+=1,a+=2):o+=1;return o})(r.json);n>this.Te.max_bytes||(this.Vt.push({step:r.step,bytes:n}),this.Wt+=n,this.Zt())}}getAttachable(){return this.Vt.map((e=>e.step))}clear(){this.Vt=[],this.Wt=0}size(){return this.Vt.length}Zt(){for(;this.Wt>this.Te.max_bytes&&this.Vt.length>0;){var e=this.Vt.shift();e&&(this.Wt-=e.bytes)}}};function Ip(t,e){if(!de(t)||t===1/0||t===-1/0)return e;var r=Math.floor(t);return 0>r?e:r}var Zc=function(t,e){var r=(e===void 0?{}:e).debugEnabled,n={k(i){if(_&&(j.DEBUG||_.POSTHOG_DEBUG||r)&&!E(_.console)&&_.console){for(var s=("__rrweb_original__"in _.console[i])?_.console[i].__rrweb_original__:_.console[i],o=arguments.length,a=new Array(o>1?o-1:0),u=1;o>u;u++)a[u-1]=arguments[u];s(t,...a)}},debug(){for(var i=arguments.length,s=new Array(i),o=0;i>o;o++)s[o]=arguments[o];n.k("debug",...s)},info(){for(var i=arguments.length,s=new Array(i),o=0;i>o;o++)s[o]=arguments[o];n.k("log",...s)},warn(){for(var i=arguments.length,s=new Array(i),o=0;i>o;o++)s[o]=arguments[o];n.k("warn",...s)},error(){for(var i=arguments.length,s=new Array(i),o=0;i>o;o++)s[o]=arguments[o];n.k("error",...s)},critical(){for(var i=arguments.length,s=new Array(i),o=0;i>o;o++)s[o]=arguments[o];console.error(t,...s)},uninitializedWarning(i){n.error("You must initialize PostHog before calling "+i)},createLogger:(i,s)=>Zc(t+" "+i,s)};return n},$=Zc("[PostHog.js]"),X=$.createLogger,Ap=X("[ExternalScriptsLoader]"),Ui=(t,e,r)=>{if(t.config.disable_external_dependency_loading)return Ap.warn(e+" was requested but loading of external scripts is disabled."),r("Loading of external scripts is disabled");var n=P?.querySelectorAll("script");if(n){for(var i,s=function(){if(n[o].src===e){var u=n[o];return u.__posthog_loading_callback_fired?{v:r()}:(u.addEventListener("load",(c=>{u.__posthog_loading_callback_fired=!0,r(void 0,c)})),u.onerror=c=>r(c),{v:void 0})}},o=0;n.length>o;o++)if(i=s())return i.v}var a=()=>{if(!P)return r("document not found");var u=P.createElement("script");if(u.type="text/javascript",u.crossOrigin="anonymous",u.src=e,u.onload=d=>{u.__posthog_loading_callback_fired=!0,r(void 0,d)},u.onerror=d=>r(d),t.config.prepare_external_dependency_script&&(u=t.config.prepare_external_dependency_script(u)),!u)return r("prepare_external_dependency_script returned null");if(t.config.external_scripts_inject_target==="head")P.head.appendChild(u);else{var c,l=P.querySelectorAll("body > script");l.length>0?(c=l[0].parentNode)==null||c.insertBefore(u,l[0]):P.body.appendChild(u)}};P!=null&&P.body?a():P?.addEventListener("DOMContentLoaded",a)};C.__PosthogExtensions__=C.__PosthogExtensions__||{},C.__PosthogExtensions__.loadExternalDependency=(t,e,r)=>{if(e!=="remote-config"){var n;if(t.config.strict_script_versioning)n=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+e+".js");else{var i="/static/"+e+".js?v="+t.version;if(e==="toolbar"){var s=3e5;i=i+"&t="+Math.floor(Date.now()/s)*s}n=t.requestRouter.endpointFor("assets",i)}Ui(t,n,r)}else{var o=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");Ui(t,o,r)}},C.__PosthogExtensions__.loadSiteApp=(t,e,r)=>{var n=t.requestRouter.endpointFor("api",e);Ui(t,n,r)};j.DEBUG=!1,j.LIB_VERSION="1.407.6",j.LIB_NAME="web";var Nc="$people_distinct_id",zn="$device_id",Hi="$device_model",kr="__alias",Er="__timers",Cs="$autocapture_disabled_server_side",Is="$heatmaps_enabled_server_side",As="$exception_capture_enabled_server_side",Os="$error_tracking_suppression_rules",Ms="$error_tracking_capture_extension_exceptions",Fs="$web_vitals_enabled_server_side",zo="$dead_clicks_enabled_server_side",Ro="$product_tours_enabled_server_side",Ls="$web_vitals_allowed_metrics",It="$session_recording_remote_config",Dc="$replay_sample_rate",jc="$replay_override_sampling",Uc="$replay_override_linked_flag",Hc="$replay_override_url_trigger",Bc="$replay_override_event_trigger",Gt="$sesid",Co="$session_is_sampled",Ct="$enabled_feature_flags",fn="$active_feature_flags",$r="$early_access_features",Zs="$feature_flag_details",gn="$feature_flag_payloads",Ns="$feature_flag_request_id",Rn="$minimal_flag_called_events",tt="$override_feature_flags",Ut="$override_feature_flag_payloads",Tt="$stored_person_properties",zt="$stored_group_properties",Ds="$surveys",Cn="$surveys_loaded_at",js="$surveys_activated",_n="$surveys_activated_session",Sr="ph_product_tours",zr="$flag_call_reported",Us="$flag_call_reported_session_id",Hs="$feature_flag_errors",Fr="$feature_flag_evaluated_at",Le="$user_state",Bs="$client_session_props",Gs="$capture_rate_limit",Vs="$initial_campaign_params",qs="$initial_referrer_info",In="$initial_person_info",An="$epp",sn="$posthog_cookieless",Gc="$cookieless_mode",Vc="$sdk_debug_extensions_init_method",qc="$sdk_debug_extensions_init_time_ms",Kc="$sdk_debug_recording_script_not_loaded",Io="PostHog loadExternalDependency extension not found.",Rt="on_reject",it="always",Zt="anonymous",Nt="identified",Ks="identified_only",On="visibilitychange",Mn="beforeunload",Ht="$pageview",Bi="$pageleave",Gi="$identify",$u="$groupidentify";function on(t,e){O(t)&&t.forEach(e)}function B(t,e){if(!F(t))if(O(t))t.forEach(e);else if(tp(t))t.forEach(((n,i)=>e(n,i)));else for(var r in t)lc.call(t,r)&&e(t[r],r)}var K=function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;e>n;n++)r[n-1]=arguments[n];for(var i of r)for(var s in i)i[s]!==void 0&&(t[s]=i[s]);return t};function vn(t){for(var e=Object.keys(t),r=e.length,n=new Array(r);r--;)n[r]=[e[r],t[e[r]]];return n}var Su=function(t){try{return t()}catch{return}},Op=function(t){return function(){try{for(var e=arguments.length,r=new Array(e),n=0;e>n;n++)r[n]=arguments[n];return t.apply(this,r)}catch(i){$.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),$.critical(i)}}},Ao=function(t){var e={};return B(t,(function(r,n){(H(r)&&r.length>0||de(r))&&(e[n]=r)})),e},Mp=["herokuapp.com","vercel.app","netlify.app"];function Fp(t){var e=t?.hostname;if(!H(e))return!1;var r=e.split(".").slice(-2).join(".");for(var n of Mp)if(r===n)return!1;return!0}function re(t,e,r,n){var i=n??{},s=i.capture,o=i.passive;t?.addEventListener(e,r,{capture:s!==void 0&&s,passive:o===void 0||o})}function Wc(t){return t.name==="ph_toolbar_internal"}var Jc=t=>{if(P){try{for(var e=t+"=",r=P.cookie.split(";").filter((s=>s.length)),n=0;r.length>n;n++){for(var i=r[n];i.charAt(0)==" ";)i=i.substring(1,i.length);if(i.indexOf(e)===0)return decodeURIComponent(i.substring(e.length,i.length))}}catch{}return null}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return de(t)&&isFinite(t)&&Math.floor(t)===t});var Ws=class t{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,r,n,i){if(!Number.isInteger(e)||!Number.isInteger(r)||!Number.isInteger(n)||!Number.isInteger(i)||0>e||0>r||0>n||0>i||e>0xffffffffffff||r>4095||n>1073741823||i>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/256,s[5]=e,s[6]=112|r>>>8,s[7]=r,s[8]=128|n>>>24,s[9]=n>>>16,s[10]=n>>>8,s[11]=n,s[12]=i>>>24,s[13]=i>>>16,s[14]=i>>>8,s[15]=i,new t(s)}toString(){for(var e="",r=0;this.bytes.length>r;r++)e=e+(this.bytes[r]>>>4).toString(16)+(15&this.bytes[r]).toString(16),r!==3&&r!==5&&r!==7&&r!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new t(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var r=0;16>r;r++){var n=this.bytes[r]-e.bytes[r];if(n!==0)return Math.sign(n)}return 0}},Js=class{generate(){var e=this.generateOrAbort();if(!E(e))return e;this.S=0;var r=this.generateOrAbort();if(E(r))throw new Error("Could not generate UUID after timestamp reset");return r}generateOrAbort(){var e=Date.now();if(e>this.S)this.S=e,this.C();else{if(this.S>=e+1e4)return;this.I++,this.I>4398046511103&&(this.S++,this.C())}return Ws.fromFieldsV7(this.S,Math.trunc(this.I/Math.pow(2,30)),this.I&Math.pow(2,30)-1,this.M.nextUint32())}C(){this.I=1024*this.M.nextUint32()+(1023&this.M.nextUint32())}constructor(){this.S=0,this.I=0,this.M=new Ys}},Pu,Yc=t=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};_&&!E(_.crypto)&&crypto.getRandomValues&&(Yc=t=>crypto.getRandomValues(t));var Ys=class{nextUint32(){return this.R.length>this.O||(Yc(this.R),this.O=0),this.R[this.O++]}constructor(){this.R=new Uint32Array(8),this.O=1/0}},nt=()=>Lp().toString(),Lp=()=>(Pu||(Pu=new Js)).generate(),pr="",Zp=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,st={N:()=>!!P,D(t){$.error("cookieStore error: "+t)},A:Jc,F(t){var e;try{e=JSON.parse(st.A(t))||{}}catch{}return e},q(t,e,r,n,i){if(!P)return!1;try{var s="",o="",a=(function(l,d){if(d){var h=(function(p,g){if(g===void 0&&(g=P),pr)return pr;if(!g||["localhost","127.0.0.1"].includes(p))return"";for(var m=p.split("."),v=Math.min(m.length,8),w="dmn_chk_"+nt();!pr&&v--;){var y=m.slice(v).join("."),k=w+"=1;domain=."+y+";path=/";g.cookie=k+";max-age=3",g.cookie.includes(w)&&(g.cookie=k+";max-age=0",pr=y)}return pr})(l);if(!h){var f=(p=>{var g=p.match(Zp);return g?g[0]:""})(l);f!==h&&$.info("Warning: cookie subdomain discovery mismatch",f,h),h=f}return h?"; domain=."+h:""}return""})(P.location.hostname,n);if(r){var u=new Date;u.setTime(u.getTime()+864e5*r),s="; expires="+u.toUTCString()}i&&(o="; secure");var c=t+"="+encodeURIComponent(JSON.stringify(e))+s+"; SameSite=Lax; path=/"+a+o;return c.length>3686.4&&$.warn("cookieStore warning: large cookie, len="+c.length),P.cookie=c,!0}catch{return!1}},P(t,e){if(P!=null&&P.cookie)try{st.q(t,"",-1,e)}catch{return}}},Vi=null,V={N(){if(!me(Vi))return Vi;var t=!0;if(E(_))t=!1;else try{var e="__mplssupport__";V.q(e,"xyz"),V.A(e)!=='"xyz"'&&(t=!1),V.P(e)}catch{t=!1}return t||$.error("localStorage unsupported; falling back to cookie store"),Vi=t,t},D(t){$.error("localStorage error: "+t)},A(t){try{return _?.localStorage.getItem(t)}catch(e){V.D(e)}return null},F(t){try{return JSON.parse(V.A(t))||{}}catch{}return null},q(t,e){try{return _?.localStorage.setItem(t,JSON.stringify(e)),!0}catch(r){V.D(r)}return!1},P(t){try{_?.localStorage.removeItem(t)}catch(e){V.D(e)}}},Np=[zn,"distinct_id",Gt,Co,An,In,Le],an={},Dp={N:()=>!0,D(t){$.error("memoryStorage error: "+t)},A:t=>an[t]||null,F:t=>an[t]||null,q:(t,e)=>(an[t]=e,!0),P(t){delete an[t]}},wt=null,le={N(){if(!me(wt))return wt;if(wt=!0,E(_))wt=!1;else try{var t="__support__";le.q(t,"xyz"),le.A(t)!=='"xyz"'&&(wt=!1),le.P(t)}catch{wt=!1}return wt},D(t){$.error("sessionStorage error: ",t)},A(t){try{return _?.sessionStorage.getItem(t)}catch(e){le.D(e)}return null},F(t){try{return JSON.parse(le.A(t))||null}catch{}return null},q(t,e){try{return _?.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch(r){le.D(r)}return!1},P(t){try{_?.sessionStorage.removeItem(t)}catch(e){le.D(e)}}},Xs=class{constructor(e){this._instance=e}get Te(){return this._instance.config}get consent(){return this.Gt()?0:this.Qt}isOptedOut(){return this.Te.cookieless_mode===it||this.isRejected()||this.consent===-1&&this.Te.cookieless_mode===Rt}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Te.opt_out_capturing_by_default}optInOut(e){this.Jt.q(this.Kt,e?1:0,this.Te.cookie_expiration,this.Te.cross_subdomain_cookie,this.Te.secure_cookie)}reset(){this.Jt.P(this.Kt,this.Te.cross_subdomain_cookie)}get Kt(){var e=this._instance.config,r=e.token,n=e.opt_out_capturing_cookie_prefix;return e.consent_persistence_name||(n?n+r:"__ph_opt_in_out_"+r)}get Qt(){var e=this.Jt.A(this.Kt);return Li(e)?1:A(sp,e)?0:-1}get Jt(){var e=this.Te.opt_out_capturing_persistence_type,r=e==="localStorage"?V:st;if(!this.Yt||this.Yt!==r){this.Yt=r;var n=e==="localStorage"?st:V;n.A(this.Kt)&&(this.Yt.A(this.Kt)||this.optInOut(Li(n.A(this.Kt))),n.P(this.Kt,this.Te.cross_subdomain_cookie))}return this.Yt}Gt(){return!!this.Te.respect_dnt&&[_e?.doNotTrack,_e?.msDoNotTrack,C.doNotTrack].some((e=>Li(e)))}};function Xc(t,e){var r,n=t==null||(r=t.config)==null?void 0:r.get_current_url;if(!Ze(n))return e;try{var i=n(e);return H(i)&&i?i:e}catch(s){return $.error("Error in get_current_url, falling back to window.location.href",s),e}}var Qc="__POSTHOG_TOOLBAR__",jp=1,Up=3,Hp=11;function Tu(t){return t instanceof Element&&(t.id===Qc||!(t.closest==null||!t.closest(".toolbar-global-fade-container")))}function gt(t){return!!t&&t.nodeType===jp}function $e(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function el(t){return!!t&&t.nodeType===Up}function tl(t){return!!t&&t.nodeType===Hp&>(t.host)}var rl=1e3;function Oo(t){return t?Jn(t).split(/\s+/):[]}function zu(t,e){var r=(function(n){var i,s=_==null||(i=_.location)==null?void 0:i.href;return E(s)?void 0:Xc(n,s)})(e);return!!(r&&t&&t.some((n=>r.match(n))))}function Fn(t){var e="";switch(typeof t.className){case"string":e=t.className;break;case"object":e=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:e=""}return Oo(e)}function nl(t){return F(t)?null:Jn(t).split(/(\s+)/).filter((e=>Rr(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Lr(t){var e="";return eo(t)&&!al(t)&&t.childNodes&&t.childNodes.length&&B(t.childNodes,(function(r){var n;el(r)&&r.textContent&&(e+=(n=nl(r.textContent))!==null&&n!==void 0?n:"")})),Jn(e)}function qi(t){var e;return E(t.target)?t.srcElement||null:(e=t.target)!=null&&e.shadowRoot?t.composedPath()[0]||null:t.target||null}var Mo=["a","button","form","input","select","textarea","label"];function Qs(t,e){if(E(e))return!0;var r,n=function(s){if(e.some((o=>(function(a,u){var c=a.matches||a.matchesSelector||a.msMatchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.oMatchesSelector;try{return!!c&&c.call(a,u)}catch{return!1}})(s,o))))return{v:!0}};for(var i of t)if(r=n(i))return r.v;return!1}function il(t){var e=t.parentNode;return!(!e||!gt(e))&&e}var Bp=[".ph-no-autocapture","[data-ph-no-autocapture]"],sl=["next","previous","prev",">","<"],Gp=[...sl,"+","-","\u2212","\u2013"],Ru=(t,e)=>/[a-z0-9]/i.test(e)?t.includes(e):t===e,Cu=[".ph-no-rageclick",".ph-no-capture"],Vp=["","text","search","email","password","url","tel","number"];function Iu(t,e){if(!_||Fo(t))return!1;var r,n,i,s,o;if(Ne(e)?(r=!!e&&Cu,n=void 0,i=!1):(r=(s=e?.css_selector_ignorelist)!==null&&s!==void 0?s:Cu,n=e?.content_ignorelist,i=(o=e?.ignore_text_selection)!==null&&o!==void 0&&o),r===!1||i&&(function(u){return!(!u||!gt(u))&&(!!$e(u,"textarea")||($e(u,"input")?A(Vp,(u.getAttribute("type")||"").toLowerCase()):(function(c){if(c.isContentEditable)return!0;var l=c.getAttribute==null?void 0:c.getAttribute("contenteditable");return l==="true"||l===""})(u)))})(t))return!1;var a=ol(t,!1).targetElementList;return!(function(u,c){if(u===!1||E(u))return!1;var l;if(u===!0)l=sl;else{if(!O(u))return!1;if(u.length>10)return $.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;l=u.map((d=>d.toLowerCase()))}return c.some((d=>{var h=d.safeText,f=d.ariaLabel;return l.some((p=>Ru(h,p)||Ru(f,p)))}))})(n,a.map((u=>{var c;return{safeText:Lr(u).toLowerCase(),ariaLabel:((c=u.getAttribute("aria-label"))==null?void 0:c.toLowerCase().trim())||""}})))&&!Qs(a,r)}var Fo=t=>!t||$e(t,"html")||!gt(t),ol=(t,e)=>{if(!_||Fo(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var r=!1,n=[t],i=t;i.parentNode&&!$e(i,"body");)if(tl(i.parentNode))n.push(i.parentNode.host),i=i.parentNode.host;else{var s=il(i);if(!s)break;if(e||Mo.indexOf(s.tagName.toLowerCase())>-1)r=!0;else try{var o=_.getComputedStyle(s);o&&o.getPropertyValue("cursor")==="pointer"&&(r=!0)}catch{}n.push(s),i=s}return{parentIsUsefulElement:r,targetElementList:n}};function eo(t){for(var e=new Set,r=0,n=t;n.parentNode&&!$e(n,"body");n=n.parentNode){if(r++>=rl||e.has(n))return!1;e.add(n);var i=Fn(n);if(A(i,"ph-sensitive")||A(i,"ph-no-capture"))return!1}if(A(Fn(t),"ph-include"))return!0;var s=t.type||"";if(H(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}var o=t.name||t.id||"";return!H(o)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(o.replace(/[^a-zA-Z0-9]/g,""))}function al(t){return!!($e(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||$e(t,"select")||$e(t,"textarea")||t.getAttribute("contenteditable")==="true")}var ul="(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})",qp=new RegExp("^(?:"+ul+")$"),Kp=new RegExp(ul),cl="\\d{3}-?\\d{2}-?\\d{4}",Wp=new RegExp("^("+cl+")$"),Jp=new RegExp("("+cl+")");function Rr(t,e){return e===void 0&&(e=!0),!(F(t)||H(t)&&(t=Jn(t),(e?qp:Kp).test((t||"").replace(/[- ]/g,""))||(e?Wp:Jp).test(t)))}function Au(t){var e=Lr(t);return Rr(e=(e+" "+ll(t)).trim())?e:""}function ll(t){var e="";return t&&t.childNodes&&t.childNodes.length&&B(t.childNodes,(function(r){var n;if(r&&((n=r.tagName)==null?void 0:n.toLowerCase())==="span")try{var i=Lr(r);e=(e+" "+i).trim(),r.childNodes&&r.childNodes.length&&(e=(e+" "+ll(r)).trim())}catch(s){$.error("[AutoCapture]",s)}})),e}function Ou(t){return t.replace(/"|\\"/g,'\\"')}function Yp(t){var e=t.attr__class;if(e)return O(e)?e:Oo(e)}var un=X("[Dead Clicks]"),Xp=()=>!0,Qp=t=>{var e,r=!((e=t.instance.persistence)==null||!e.get_property(zo)),n=t.instance.config.capture_dead_clicks;return Ne(n)?n:!!Y(n)||r},Ln=class{get lazyLoadedDeadClicksAutocapture(){return this.Xt}constructor(e,r,n){this.instance=e,this.isEnabled=r,this.onCapture=n,this.startIfEnabledOrStop()}onRemoteConfig(e){if(e.ok){var r=e.config;"captureDeadClicks"in r&&(this.instance.persistence&&this.instance.persistence.register({[zo]:r.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.er((()=>{this.tr()})):this.stop()}er(e){var r,n;(r=C.__PosthogExtensions__)!=null&&r.initDeadClicksAutocapture?e():(n=C.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this.instance,"dead-clicks-autocapture",(i=>{i?un.error("failed to load script",i):e()}))}tr(){var e;if(P){if(!this.Xt&&(e=C.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var r=Y(this.instance.config.capture_dead_clicks)?x({},this.instance.config.capture_dead_clicks):{};r.__onCapture=this.onCapture,this.onCapture&&(r.capture_dead_swipes=!1),this.Xt=C.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,r),this.Xt.start(P),un.info("starting...")}}else un.error("`document` not found. Cannot start.")}stop(){this.Xt&&(this.Xt.stop(),this.Xt=void 0,un.info("stopping..."))}},Ki=X("[SegmentIntegration]"),dl="posthog-js";function hl(t,e){var r=e===void 0?{}:e,n=r.organization,i=r.projectId,s=r.prefix,o=r.severityAllowList,a=o===void 0?["error"]:o,u=r.sendExceptionsToPostHog,c=u===void 0||u;return l=>{var d,h,f,p,g;if(a!=="*"&&!a.includes(l.level)||!t.__loaded)return l;l.tags||(l.tags={});var m=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());l.tags["PostHog Person URL"]=m,t.sessionRecordingStarted()&&(l.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var v,w=((d=l.exception)==null?void 0:d.values)||[],y=w.map((T=>x({},T,{stacktrace:T.stacktrace?x({},T.stacktrace,{type:"raw",frames:(T.stacktrace.frames||[]).map((M=>x({},M,{platform:"web:javascript"})))}):void 0}))),k={$exception_message:((h=w[0])==null?void 0:h.value)||l.message,$exception_type:(f=w[0])==null?void 0:f.type,$exception_level:l.level,$exception_list:y,$sentry_event_id:l.event_id,$sentry_exception:l.exception,$sentry_exception_message:((p=w[0])==null?void 0:p.value)||l.message,$sentry_exception_type:(g=w[0])==null?void 0:g.type,$sentry_tags:l.tags};return n&&i&&(k.$sentry_url=(s||"https://sentry.io/organizations/")+n+"/issues/?project="+i+"&query="+l.event_id),c&&((v=t.exceptions)==null||v.sendExceptionEvent(k)),l}}var to=class{constructor(e,r,n,i,s,o){this.name=dl,this.setupOnce=function(a){a(hl(e,{organization:r,projectId:n,prefix:i,severityAllowList:s,sendExceptionsToPostHog:o==null||o}))}}},Zn=class{constructor(e){this.rr=(r,n,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&($.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:r,changeReason:i}),this.ir=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.nr()}nr(){var e;this.sr=(e=this._instance.sessionManager)==null?void 0:e.onSessionId(this.rr)}destroy(){var e;(e=this.sr)==null||e.call(this),this.sr=void 0}doPageView(e,r){var n,i=this.ar(e,r);return this.ir={pathname:(n=_?.location.pathname)!==null&&n!==void 0?n:"",pageViewId:r,timestamp:e},this._instance.scrollManager.resetContext(),i}doPageLeave(e){var r;return this.ar(e,(r=this.ir)==null?void 0:r.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.ir)==null?void 0:e.pageViewId}}ar(e,r){var n=this.ir;if(!n)return{$pageview_id:r};var i={$pageview_id:r,$prev_pageview_id:n.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var o=s.maxScrollHeight,a=s.lastScrollY,u=s.maxScrollY,c=s.maxContentHeight,l=s.lastContentY,d=s.maxContentY;if(!(E(o)||E(a)||E(u)||E(c)||E(l)||E(d))){o=Math.ceil(o),a=Math.ceil(a),u=Math.ceil(u),c=Math.ceil(c),l=Math.ceil(l),d=Math.ceil(d);var h=o>1?Ge(a/o,0,1,$):1,f=o>1?Ge(u/o,0,1,$):1,p=c>1?Ge(l/c,0,1,$):1,g=c>1?Ge(d/c,0,1,$):1;i=K(i,{$prev_pageview_last_scroll:a,$prev_pageview_last_scroll_percentage:h,$prev_pageview_max_scroll:u,$prev_pageview_max_scroll_percentage:f,$prev_pageview_last_content:l,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:d,$prev_pageview_max_content_percentage:g})}}return n.pathname&&(i.$prev_pageview_pathname=n.pathname),n.timestamp&&(i.$prev_pageview_duration=(e.getTime()-n.timestamp.getTime())/1e3),i}},Wi=["flags","surveys"],ef={[Nc]:{exposure:"hidden"},[kr]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[Er]:{exposure:"hidden"},[Cs]:{exposure:"event"},[Is]:{exposure:"hidden"},[As]:{exposure:"event"},[Os]:{exposure:"hidden"},[Ms]:{exposure:"event"},[Fs]:{exposure:"event"},[zo]:{exposure:"event"},[Ro]:{exposure:"hidden"},[Ls]:{exposure:"event"},[It]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[Gt]:{exposure:"hidden"},[Co]:{exposure:"event"},[Dc]:{exposure:"event",shouldSkipFromEventProperties:t=>me(t)},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},$sess_rec_flush_size:{exposure:"hidden"},[Ct]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(t,e)=>e(),transformToEventProperties(t){if(!Y(t))return{};for(var e={},r=Object.keys(t),n=0;r.length>n;n++)e["$feature/"+r[n]]=t[r[n]];return e}},[fn]:{exposure:"event",storageGroup:"flags"},[$r]:{exposure:"hidden"},[Zs]:{exposure:"hidden",storageGroup:"flags"},[gn]:{exposure:"event",storageGroup:"flags"},[Ns]:{exposure:"event",storageGroup:"flags",volatile:!0},[Rn]:{exposure:"hidden",storageGroup:"flags"},[tt]:{exposure:"event"},[Ut]:{exposure:"hidden"},[Tt]:{exposure:"hidden"},[zt]:{exposure:"hidden"},[Ds]:{exposure:"hidden",storageGroup:"surveys"},[Cn]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[js]:{exposure:"event"},[_n]:{exposure:"hidden"},[Sr]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$product_tours_activated_session:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[zr]:{exposure:"hidden"},[Us]:{exposure:"hidden"},[Hs]:{exposure:"hidden"},[Fr]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Le]:{exposure:"hidden"},[Bs]:{exposure:"hidden"},[Gs]:{exposure:"hidden"},[Vs]:{exposure:"hidden"},[qs]:{exposure:"hidden"},[In]:{exposure:"hidden"},[An]:{exposure:"hidden"},[jc]:{exposure:"event"},[Uc]:{exposure:"event"},[Hc]:{exposure:"event"},[Bc]:{exposure:"event"},[Vc]:{exposure:"event"},[qc]:{exposure:"event"},[Kc]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},tf=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],kt=t=>{var e=ef[t];if(e)return e;for(var r of tf){var n=r[1];if(t.indexOf(r[0])===0)return n}},Vt=(t,e)=>{try{return JSON.stringify(t,((r,n)=>typeof n=="bigint"?n.toString():n),e)}catch{return uc(t)}},Nn=t=>{var e=P?.createElement("a");return E(e)?null:(e.href=t,e)},Xt=function(t,e){for(var r,n=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),i=0;n.length>i;i++){var s=n[i].split("=");if(s[0]===e){r=s;break}}if(!O(r)||2>r.length)return"";var o=r[1];try{o=decodeURIComponent(o)}catch{$.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Zr=function(t,e,r){if(!t||!e||!e.length)return t;for(var n=t.split("#"),i=n[1],s=(n[0]||"").split("?"),o=s[1],a=s[0],u=(o||"").split("&"),c=[],l=0;u.length>l;l++){var d=u[l].split("=");O(d)&&(e.includes(d[0])?c.push(d[0]+"="+r):c.push(u[l]))}var h=a;return o!=null&&(h+="?"+c.join("&")),i!=null&&(h+="#"+i),h},Dn=function(t,e){var r=t.match(new RegExp(e+"=([^&]*)"));return r?r[1]:null},pl=(t,e)=>t>=e&&sc(),fl=(t,e,r,n)=>{if(t===0){if(sc()){var i=e+1;return i===r&&n(),i}return e}return 0},cn="https?://(.*)",Qt=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],rf=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Qt],Nr="<masked>",nf=["li_fat_id"];function gl(t,e,r){if(!P)return{};var n,i=e?[...Qt,...r||[]]:[],s=_l(Zr(P.URL,i,Nr),t),o=(n={},B(nf,(function(a){var u=Jc(a);n[a]=u||null})),n);return K(o,s)}function _l(t,e){var r=rf.concat(e||[]),n={};return B(r,(function(i){var s=Xt(t,i);n[i]=s||null})),n}function vl(t){var e=(function(s){return s?s.search(cn+"google.([^/?]*)")===0?"google":s.search(cn+"bing.com")===0?"bing":s.search(cn+"yahoo.com")===0?"yahoo":s.search(cn+"duckduckgo.com")===0?"duckduckgo":null:null})(t),r=e!="yahoo"?"q":"p",n={};if(!me(e)){n.$search_engine=e;var i=P?Xt(P.referrer,r):"";i.length&&(n.ph_keyword=i)}return n}function Mu(){return navigator.language||navigator.userLanguage}var jn="$direct";function ml(){return P?.referrer||jn}function yl(t,e,r){r===void 0&&(r=!1);var n=t?[...Qt,...e||[]]:[],i=r?ft(ie?.href):ie?.href,s=i?.substring(0,1e3);return{r:ml().substring(0,1e3),u:s?Zr(s,n,Nr):void 0}}function bl(t,e){var r;e===void 0&&(e=!1);var n=t.r,i=t.u,s=e?ft(i):i,o={$referrer:n,$referring_domain:n==null?void 0:n==jn?jn:(r=Nn(n))==null?void 0:r.host};if(s){o.$current_url=s;var a=Nn(s);o.$host=a?.host,o.$pathname=a?.pathname;var u=_l(s);K(o,u)}if(n){var c=vl(n);K(o,c)}return o}function xl(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function sf(){try{return new Date().getTimezoneOffset()}catch{return}}var of={flags:Fr,surveys:Cn},af=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Dt="main",Cr=class{constructor(e,r,n){if(n===void 0&&(n=!0),this.lr={},this.ur=!1,this.hr=!1,this.Te=e,this.dr=n,this.props={},this.cr=!1,this.vr=(s=>{var o="";return s.token&&(o=s.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),s.persistence_name?"ph_"+s.persistence_name:"ph_"+o+"_posthog"})(e),this.Jt=this.pr(e),this.hr=this.gr(e),this.load(),e.debug&&$.info("Persistence loaded",e.persistence,x({},this.props)),this.update_config(e,e,r),this.save(),_){var i=()=>this.flush();re(_,"beforeunload",i,{capture:!1}),re(_,"pagehide",i,{capture:!1})}}mr(){var e,r=(e=this.Te)==null?void 0:e.persistence_save_debounce_ms;return de(r)&&r>0?r:0}isDisabled(){return!!this.yr}pr(e){af.indexOf(e.persistence.toLowerCase())===-1&&($.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var r,n=(function(o,a){o===void 0&&(o=[]),a===void 0&&(a=!1);var u=[...Np,...o];return x({},V,{F(c){try{var l={};try{l=st.F(c)||{}}catch{}var d,h=JSON.parse(V.A(c)||"{}");if(a){var f={};for(var p in l){var g=l[p];me(g)||g===""||(f[p]=g)}d=K(h,f)}else d=K(l,h);return V.q(c,d),d}catch{}return null},q(c,l,d,h,f,p){var g=V.q(c,l,void 0,void 0,p);try{var m={};u.forEach((v=>{l[v]&&(m[v]=l[v])})),Object.keys(m).length&&st.q(c,m,d,h,f,p)}catch(v){V.D(v)}return g},P(c,l){try{_?.localStorage.removeItem(c),st.P(c,l)}catch(d){V.D(d)}}})})(e.cookie_persisted_properties||[],e.__preview_cookie_wins_on_conflict||!1),i=!1,s=e.persistence.toLowerCase();return s==="localstorage"&&V.N()?(r=V,i=!0):s==="localstorage+cookie"&&n.N()?(r=n,i=!0):s==="sessionstorage"&&le.N()?r=le:s==="memory"?r=Dp:s==="cookie"?r=st:n.N()?(r=n,i=!0):r=st,this.ur=i,r}br(e){return this.vr+"__"+e}gr(e){return this.ur&&!!e.split_storage}_r(e){var r=e??this.Te.feature_flag_cache_ttl_ms;if(!r||0>=r)return!1;var n=this.props[Fr];return!n||typeof n!="number"||Date.now()-n>r}properties(){var e={};return B(this.props,((r,n)=>{var i=kt(n);if(i?.exposure==="derived"){if(i.shouldSkipFromEventProperties!=null&&i.shouldSkipFromEventProperties(r,n===Ct?()=>this._r():()=>!1))return;i.transformToEventProperties&&K(e,i.transformToEventProperties(r))}else if(!i||i.exposure==="event"){if(i!=null&&i.shouldSkipFromEventProperties!=null&&i.shouldSkipFromEventProperties(r,(()=>!1)))return;e[n]=r}})),e}load(){if(!this.yr){var e=this.Jt.F(this.vr);e&&(this.props=K({},e)),this.hr&&this.wr()}}wr(){for(var e of Wi){var r=V.F(this.br(e));if(r&&!pt(r)){var n=this.kr(e);n.persisted=!0,this.Sr(e)||(n.fingerprint=this.Cr(r,e)),this.Tr(e,r)||K(this.props,r)}}}Sr(e){return Object.keys(this.props).some((r=>{var n;return((n=kt(r))==null?void 0:n.storageGroup)===e}))}Tr(e,r){var n=of[e];if(!n)return!1;var i=r[n],s=this.props[n];return de(i)&&de(s)&&s>i}refreshKey(e){var r;if(!this.yr){var n=this.hr?(r=kt(e))==null?void 0:r.storageGroup:void 0,i=n?V.F(this.br(n)):this.Jt.F(this.vr);if(i&&e in i)this.Ir(e,i[e]);else{if(n){var s=this.Jt.F(this.vr);if(s&&e in s)return void this.Ir(e,s[e])}this.Mr(e)}}}save(){if(!this.yr){var e=this.mr();e>0?E(this.Er)&&(this.Er=setTimeout((()=>{this.Er=void 0,this.Rr()}),e)):this.Rr()}}flush(){E(this.Er)||(clearTimeout(this.Er),this.Er=void 0,this.Rr())}Rr(){this.yr||(this.hr?this.Pr():this.Or(this.Jt,this.vr,this.props,Dt))}Pr(){var e=this.Fr(),r=e.main,n=e.groups;for(var i of(this.Or(this.Jt,this.vr,r,Dt),Wi)){var s,o=n[i];(!pt(o)||(s=this.lr[i])!=null&&s.persisted)&&this.Or(V,this.br(i),o,i)}}Fr(){var e={},r={flags:{},surveys:{}};return B(this.props,((n,i)=>{var s,o=(s=kt(i))==null?void 0:s.storageGroup;o?r[o][i]=n:e[i]=n})),{main:e,groups:r}}Cr(e,r){if(r===Dt)return JSON.stringify(e)+"|"+this.Lr+"|"+this.$r+"|"+this.Ar;var n={};return B(e,((i,s)=>{var o;n[s]=(o=kt(s))!=null&&o.volatile?"__volatile__":i})),JSON.stringify(n)}Or(e,r,n,i){var s=this.kr(i);if(i===Dt||s.dirty||E(s.fingerprint)){var o;try{if((o=this.Cr(n,i))===s.fingerprint)return void(s.dirty=!1)}catch{o=void 0}e.q(r,n,this.Lr,this.$r,this.Ar,this.Te.debug)?(s.dirty=!1,i!==Dt&&(s.persisted=!0),E(o)||(s.fingerprint=o)):this.Te.debug&&$.warn('failed to persist storage entry "'+r+'"; will retry on next save')}}remove(e){var r=(e===void 0?{}:e).keepGroupEntries,n=r!==void 0&&r;if(E(this.Er)||(clearTimeout(this.Er),this.Er=void 0),this.Jt.P(this.vr,!1),this.Jt.P(this.vr,!0),!n&&this.dr)for(var i of Wi)V.P(this.br(i));n?delete this.lr[Dt]:this.lr={}}clear(){this.remove(),this.props={}}register_once(e,r,n){if(Y(e)){E(r)&&(r="None"),this.Lr=E(n)?this.Nr:n;var i=!1;if(B(e,((s,o)=>{this.props.hasOwnProperty(o)&&this.props[o]!==r||(this.Ir(o,s),i=!0)})),i)return this.save(),!0}return!1}register(e,r){if(Y(e)){this.Lr=E(r)?this.Nr:r;var n=!1;if(B(e,((i,s)=>{e.hasOwnProperty(s)&&this.props[s]!==i&&(this.Ir(s,i),n=!0)})),n)return this.save(),!0}return!1}unregister(e){e in this.props&&(this.Mr(e),this.save())}update_campaign_params(){if(!this.cr){var e=gl(this.Te.custom_campaign_params,this.Te.mask_personal_data_properties,this.Te.custom_personal_data_properties);pt(Ao(e))||this.register(e),this.cr=!0}}update_search_keyword(){var e;this.register((e=P?.referrer)?vl(e):{})}update_referrer_info(){var e;this.register_once({$referrer:ml(),$referring_domain:P!=null&&P.referrer&&((e=Nn(P.referrer))==null?void 0:e.host)||jn},void 0)}set_initial_person_info(){this.props[Vs]||this.props[qs]||this.register_once({[In]:yl(this.Te.mask_personal_data_properties,this.Te.custom_personal_data_properties,this.Te.disable_capture_url_hashes)},void 0)}get_initial_props(){var e={};B([qs,Vs],(i=>{var s=this.props[i];s&&B(s,(function(o,a){e["$initial_"+ps(a)]=o}))}));var r=this.props[In];if(r){var n=(function(i,s){s===void 0&&(s=!1);var o=bl(i,s),a={};return B(o,(function(u,c){a["$initial_"+ps(c)]=u})),a})(r,this.Te.disable_capture_url_hashes);K(e,n)}return e}safe_merge(e){return B(this.props,(function(r,n){n in e||(e[n]=r)})),e}update_config(e,r,n){this.Nr=this.Lr=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!n),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie);var i=e.persistence!==r.persistence||!((u,c)=>{if(u.length!==c.length)return!1;var l=[...u].sort(),d=[...c].sort();return l.every(((h,f)=>h===d[f]))})(e.cookie_persisted_properties||[],r.cookie_persisted_properties||[]),s=i?this.pr(e):this.Jt,o=this.gr(e);if(i||o!==this.hr){var a=this.props;this.clear(),this.Jt=s,this.hr=o,this.props=a,this.save()}}set_disabled(e){this.yr=e,this.yr?this.remove():this.save()}set_cross_subdomain(e){e!==this.$r&&(this.$r=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.Ar&&(this.Ar=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,r){var n=this.props[Er]||{};n[e]=r,this.Ir(Er,n),this.save()}remove_event_timer(e){var r=this.props[Er]||{},n=r[e];return E(n)||(delete r[e],this.Ir(Er,r),this.save()),n}get_property(e){return this.props[e]}set_property(e,r){this.Ir(e,r),this.save()}Ir(e,r){var n;this.props[e]=r,(n=kt(e))!=null&&n.volatile||this.Dr(e)}Mr(e){delete this.props[e],this.Dr(e)}Dr(e){var r,n=(r=kt(e))==null?void 0:r.storageGroup;n&&(this.kr(n).dirty=!0)}kr(e){return this.lr[e]||(this.lr[e]={})}},ge={GZipJS:"gzip-js",Base64:"base64"},fr={Activation:"events",Cancellation:"cancelEvents"};var Ji={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"};var ot={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Yi={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date",SURVEY_LANGUAGE:"$survey_language"},ro={Popover:"popover",Inline:"inline"};var uf={SHOWN:"product tour shown",DISMISSED:"product tour dismissed",COMPLETED:"product tour completed",STEP_SHOWN:"product tour step shown",STEP_COMPLETED:"product tour step completed",BUTTON_CLICKED:"product tour button clicked",STEP_SELECTOR_FAILED:"product tour step selector failed",BANNER_CONTAINER_SELECTOR_FAILED:"product tour banner container selector failed",BANNER_ACTION_CLICKED:"product tour banner action clicked"},Fu={TOUR_ID:"$product_tour_id",TOUR_NAME:"$product_tour_name",TOUR_ITERATION:"$product_tour_iteration",TOUR_RENDER_REASON:"$product_tour_render_reason",TOUR_STEP_ID:"$product_tour_step_id",TOUR_STEP_ORDER:"$product_tour_step_order",TOUR_STEP_TYPE:"$product_tour_step_type",TOUR_DISMISS_REASON:"$product_tour_dismiss_reason",TOUR_BUTTON_TEXT:"$product_tour_button_text",TOUR_BUTTON_ACTION:"$product_tour_button_action",TOUR_BUTTON_LINK:"$product_tour_button_link",TOUR_BUTTON_TOUR_ID:"$product_tour_button_tour_id",TOUR_STEPS_COUNT:"$product_tour_steps_count",TOUR_STEP_SELECTOR:"$product_tour_step_selector",TOUR_STEP_SELECTOR_FOUND:"$product_tour_step_selector_found",TOUR_STEP_ELEMENT_TAG:"$product_tour_step_element_tag",TOUR_STEP_ELEMENT_ID:"$product_tour_step_element_id",TOUR_STEP_ELEMENT_CLASSES:"$product_tour_step_element_classes",TOUR_STEP_ELEMENT_TEXT:"$product_tour_step_element_text",TOUR_ERROR:"$product_tour_error",TOUR_MATCHES_COUNT:"$product_tour_matches_count",TOUR_FAILURE_PHASE:"$product_tour_failure_phase",TOUR_WAITED_FOR_ELEMENT:"$product_tour_waited_for_element",TOUR_WAIT_DURATION_MS:"$product_tour_wait_duration_ms",TOUR_BANNER_SELECTOR:"$product_tour_banner_selector",TOUR_LINKED_SURVEY_ID:"$product_tour_linked_survey_id",USE_MANUAL_SELECTOR:"$use_manual_selector",INFERENCE_DATA_PRESENT:"$inference_data_present",TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},Lu=X("[RateLimiter]"),no=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=r=>{var n=r.text;if(n&&n.length)try{(JSON.parse(n).quota_limited||[]).forEach((i=>{Lu.info((i||"events")+" is quota limited."),this.serverLimits[i]=new Date().getTime()+6e4}))}catch(i){return void Lu.warn('could not rate limit - continuing. Error: "'+i?.message+'"',{text:n})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)==null?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)==null?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var r,n,i;e===void 0&&(e=!1);var s=this.captureEventsBurstLimit,o=this.captureEventsPerSecond,a=new Date().getTime(),u=(r=(n=this.instance.persistence)==null?void 0:n.get_property(Gs))!==null&&r!==void 0?r:{tokens:s,last:a};u.tokens+=(a-u.last)/1e3*o,u.last=a,u.tokens>s&&(u.tokens=s);var c=1>u.tokens;return c||e||(u.tokens=Math.max(0,u.tokens-1)),!c||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+o+" events per second and "+s+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=c,(i=this.instance.persistence)==null||i.set_property(Gs,u),{isRateLimited:c,remainingTokens:u.tokens}}isServerRateLimited(e){var r=this.serverLimits[e||"events"]||!1;return r!==!1&&new Date().getTime()<r}},gr=X("[RemoteConfig]"),Un=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=C._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}qr(e){var r,n;(r=C.__PosthogExtensions__)!=null&&r.loadExternalDependency?(n=C.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):e()}jr(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(r){e(r.json)}})}load(){try{if(this.remoteConfig)return gr.info("Using preloaded remote config",this.remoteConfig),this.Hr(this.remoteConfig),void this.Br();if(this._instance.Ur())return void gr.warn("Remote config is disabled. Falling back to local config.");this.qr((e=>{if(!e)return gr.info("No config found after loading remote JS config. Falling back to JSON."),void this.jr((r=>{this.Hr(r),this.Br()}));this.Hr(e),this.Br()}))}catch(e){gr.error("Error loading remote config",e)}}stop(){this.zr&&(clearInterval(this.zr),this.zr=void 0)}refresh(){!this._instance.Ur()&&P&&P.visibilityState!=="hidden"&&this._instance.reloadFeatureFlags()}Br(){var e;if(!this.zr){var r=(e=this._instance.config.remote_config_refresh_interval_ms)!==null&&e!==void 0?e:3e5;r!==0&&(this.zr=setInterval((()=>{this.refresh()}),r))}}Hr(e){var r;e||gr.error("Failed to fetch remote config from PostHog."),this._instance.Hr(e?{ok:!0,config:e}:{ok:!1}),e?.hasFeatureFlags!==!1&&(this._instance.config.advanced_disable_feature_flags_on_first_load||(r=this._instance.featureFlags)==null||r.ensureFlagsLoaded())}};var Ae=Uint8Array,ve=Uint16Array,er=Uint32Array,Lo=new Ae([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]),Zo=new Ae([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]),Zu=new Ae([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),wl=function(t,e){for(var r=new ve(31),n=0;31>n;++n)r[n]=e+=1<<t[n-1];var i=new er(r[30]);for(n=1;30>n;++n)for(var s=r[n];r[n+1]>s;++s)i[s]=s-r[n]<<5|n;return[r,i]},kl=wl(Lo,2),io=kl[1];kl[0][28]=258,io[258]=28;for(so=wl(Zo,0)[1],Hn=new ve(32768),W=0;32768>W;++W)Et=(43690&W)>>>1|(21845&W)<<1,Hn[W]=((65280&(Et=(61680&(Et=(52428&Et)>>>2|(13107&Et)<<2))>>>4|(3855&Et)<<4))>>>8|(255&Et)<<8)>>>1;var Et,so,Hn,W,Ir=function(t,e,r){for(var n=t.length,i=0,s=new ve(e);n>i;++i)++s[t[i]-1];var o,a=new ve(e);for(i=0;e>i;++i)a[i]=a[i-1]+s[i-1]<<1;if(r){o=new ve(1<<e);var u=15-e;for(i=0;n>i;++i)if(t[i])for(var c=i<<4|t[i],l=e-t[i],d=a[t[i]-1]++<<l,h=d|(1<<l)-1;h>=d;++d)o[Hn[d]>>>u]=c}else for(o=new ve(n),i=0;n>i;++i)o[i]=Hn[a[t[i]-1]++]>>>15-t[i];return o},Mt=new Ae(288);for(W=0;144>W;++W)Mt[W]=8;for(W=144;256>W;++W)Mt[W]=9;for(W=256;280>W;++W)Mt[W]=7;for(W=280;288>W;++W)Mt[W]=8;var Bn=new Ae(32);for(W=0;32>W;++W)Bn[W]=5;var cf=Ir(Mt,9,0),lf=Ir(Bn,5,0),El=function(t){return(t/8>>0)+(7&t&&1)},$l=function(t,e,r){(r==null||r>t.length)&&(r=t.length);var n=new(t instanceof ve?ve:t instanceof er?er:Ae)(r-e);return n.set(t.subarray(e,r)),n},Ye=function(t,e,r){var n=e/8>>0;t[n]|=r<<=7&e,t[n+1]|=r>>>8},_r=function(t,e,r){var n=e/8>>0;t[n]|=r<<=7&e,t[n+1]|=r>>>8,t[n+2]|=r>>>16},Xi=function(t,e){for(var r=[],n=0;t.length>n;++n)t[n]&&r.push({s:n,f:t[n]});var i=r.length,s=r.slice();if(!i)return[new Ae(0),0];if(i==1){var o=new Ae(r[0].s+1);return o[r[0].s]=1,[o,1]}r.sort((function(T,M){return T.f-M.f})),r.push({s:-1,f:25001});var a=r[0],u=r[1],c=0,l=1,d=2;for(r[0]={s:-1,f:a.f+u.f,l:a,r:u};l!=i-1;)a=r[r[d].f>r[c].f?c++:d++],u=r[c!=l&&r[d].f>r[c].f?c++:d++],r[l++]={s:-1,f:a.f+u.f,l:a,r:u};var h=s[0].s;for(n=1;i>n;++n)s[n].s>h&&(h=s[n].s);var f=new ve(h+1),p=oo(r[l-1],f,0);if(p>e){n=0;var g=0,m=p-e,v=1<<m;for(s.sort((function(T,M){return f[M.s]-f[T.s]||T.f-M.f}));i>n;++n){var w=s[n].s;if(e>=f[w])break;g+=v-(1<<p-f[w]),f[w]=e}for(g>>>=m;g>0;){var y=s[n].s;e>f[y]?g-=1<<e-f[y]++-1:++n}for(;n>=0&&g;--n){var k=s[n].s;f[k]==e&&(--f[k],++g)}p=e}return[new Ae(f),p]},oo=function(t,e,r){return t.s==-1?Math.max(oo(t.l,e,r+1),oo(t.r,e,r+1)):e[t.s]=r},Nu=function(t){for(var e=t.length;e&&!t[--e];);for(var r=new ve(++e),n=0,i=t[0],s=1,o=function(u){r[n++]=u},a=1;e>=a;++a)if(t[a]==i&&a!=e)++s;else{if(!i&&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(i),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(i);s=1,i=t[a]}return[r.subarray(0,n),e]},vr=function(t,e){for(var r=0,n=0;e.length>n;++n)r+=t[n]*e[n];return r},ao=function(t,e,r){var n=r.length,i=El(e+2);t[i]=255&n,t[i+1]=n>>>8,t[i+2]=255^t[i],t[i+3]=255^t[i+1];for(var s=0;n>s;++s)t[i+s+4]=r[s];return 8*(i+4+n)},Du=function(t,e,r,n,i,s,o,a,u,c,l){Ye(e,l++,r),++i[256];for(var d=Xi(i,15),h=d[0],f=d[1],p=Xi(s,15),g=p[0],m=p[1],v=Nu(h),w=v[0],y=v[1],k=Nu(g),T=k[0],M=k[1],R=new ve(19),b=0;w.length>b;++b)R[31&w[b]]++;for(b=0;T.length>b;++b)R[31&T[b]]++;for(var S=Xi(R,7),z=S[0],L=S[1],I=19;I>4&&!z[Zu[I-1]];--I);var Z,Q,G,N,q=c+5<<3,J=vr(i,Mt)+vr(s,Bn)+o,we=vr(i,h)+vr(s,g)+o+14+3*I+vr(R,z)+(2*R[16]+3*R[17]+7*R[18]);if(J>=q&&we>=q)return ao(e,l,t.subarray(u,u+c));if(Ye(e,l,1+(J>we)),l+=2,J>we){Z=Ir(h,f,0),Q=h,G=Ir(g,m,0),N=g;var Pe=Ir(z,L,0);for(Ye(e,l,y-257),Ye(e,l+5,M-1),Ye(e,l+10,I-4),l+=14,b=0;I>b;++b)Ye(e,l+3*b,z[Zu[b]]);l+=3*I;for(var ye=[w,T],ke=0;2>ke;++ke){var ee=ye[ke];for(b=0;ee.length>b;++b)Ye(e,l,Pe[oe=31&ee[b]]),l+=z[oe],oe>15&&(Ye(e,l,ee[b]>>>5&127),l+=ee[b]>>>12)}}else Z=cf,Q=Mt,G=lf,N=Bn;for(b=0;a>b;++b)if(n[b]>255){var oe;_r(e,l,Z[257+(oe=n[b]>>>18&31)]),l+=Q[oe+257],oe>7&&(Ye(e,l,n[b]>>>23&31),l+=Lo[oe]);var ae=31&n[b];_r(e,l,G[ae]),l+=N[ae],ae>3&&(_r(e,l,n[b]>>>5&8191),l+=Zo[ae])}else _r(e,l,Z[n[b]]),l+=Q[n[b]];return _r(e,l,Z[256]),l+Q[256]},df=new er([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),hf=(function(){for(var t=new er(256),e=0;256>e;++e){for(var r=e,n=9;--n;)r=(1&r&&3988292384)^r>>>1;t[e]=r}return t})(),Qi=function(t,e,r){for(;r;++e)t[e]=r,r>>>=8};function pf(t,e){e===void 0&&(e={});var r=(function(){var d=4294967295;return{p(h){for(var f=d,p=0;h.length>p;++p)f=hf[255&f^h[p]]^f>>>8;d=f},d(){return 4294967295^d}}})(),n=t.length;r.p(t);var i,s,o,a,u,c=(a=10+((i=e).filename&&i.filename.length+1||0),u=8,(function(d,h,f,p,g,m){var v=d.length,w=new Ae(p+v+5*(1+Math.floor(v/7e3))+g),y=w.subarray(p,w.length-g),k=0;if(!h||8>v)for(var T=0;v>=T;T+=65535){var M=T+65535;v>M?k=ao(y,k,d.subarray(T,M)):(y[T]=!0,k=ao(y,k,d.subarray(T,v)))}else{for(var R=df[h-1],b=R>>>13,S=8191&R,z=(1<<f)-1,L=new ve(32768),I=new ve(z+1),Z=Math.ceil(f/3),Q=2*Z,G=function(ri){return(d[ri]^d[ri+1]<<Z^d[ri+2]<<Q)&z},N=new er(25e3),q=new ve(288),J=new ve(32),we=0,Pe=0,ye=(T=0,0),ke=0,ee=0;v>T;++T){var oe=G(T),ae=32767&T,ce=I[oe];if(L[ae]=ce,I[oe]=ae,T>=ke){var ut=v-T;if((we>7e3||ye>24576)&&ut>423){k=Du(d,y,0,N,q,J,Pe,ye,ee,T-ee,k),ye=we=Pe=0,ee=T;for(var fe=0;286>fe;++fe)q[fe]=0;for(fe=0;30>fe;++fe)J[fe]=0}var Oe=2,ct=0,be=S,Me=ae-ce&32767;if(ut>2&&oe==G(T-Me))for(var Ur=Math.min(b,ut)-1,tr=Math.min(32767,T),Hr=Math.min(258,ut);tr>=Me&&--be&&ae!=ce;){if(d[T+Oe]==d[T+Oe-Me]){for(var Te=0;Hr>Te&&d[T+Te]==d[T+Te-Me];++Te);if(Te>Oe){if(Oe=Te,ct=Me,Te>Ur)break;var Br=Math.min(Me,Te-2),rr=0;for(fe=0;Br>fe;++fe){var ti=T-Me+fe+32768&32767,qo=ti-L[ti]+32768&32767;qo>rr&&(rr=qo,ce=ti)}}}Me+=(ae=ce)-(ce=L[ae])+32768&32767}if(ct){N[ye++]=268435456|io[Oe]<<18|so[ct];var Ko=31&io[Oe],Wo=31&so[ct];Pe+=Lo[Ko]+Zo[Wo],++q[257+Ko],++J[Wo],ke=T+Oe,++we}else N[ye++]=d[T],++q[d[T]]}}k=Du(d,y,!0,N,q,J,Pe,ye,ee,T-ee,k)}return $l(w,0,p+El(k)+g)})(s=t,(o=e).level==null?6:o.level,o.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(s.length)))):12+o.mem,a,u)),l=c.length;return(function(d,h){var f=h.filename;if(d[0]=31,d[1]=139,d[2]=8,d[8]=2>h.level?4:h.level==9?2:0,d[9]=3,h.mtime!=0&&Qi(d,4,Math.floor(new Date(h.mtime||Date.now())/1e3)),f){d[3]=8;for(var p=0;f.length>=p;++p)d[p+10]=f.charCodeAt(p)}})(c,e),Qi(c,l-8,r.d()),Qi(c,l-4,n),c}var ff=!!ls||!!ko,Sl="text/plain",mn=!1,Pl=(t,e)=>{var r=t.split("#"),n=r[1],i=r[0].split("?"),s=i[0],o=i[1];if(!o)return t;var a=o.split("&").filter((u=>u.split("=")[0]!==e)).join("&");return s+(a?"?"+a:"")+(n?"#"+n:"")},No=function(t,e,r){var n;r===void 0&&(r=!0);var i=t.split("?"),s=i[0],o=i[1],a=x({},e),u=(n=o?.split("&").map((l=>{var d,h=l.split("="),f=h[0],p=r&&(d=a[f])!==null&&d!==void 0?d:h[1];return delete a[f],f+"="+p})))!==null&&n!==void 0?n:[],c=(function(l,d){var h,f;d===void 0&&(d="&");var p=[];return B(l,(function(g,m){E(g)||E(m)||m==="undefined"||(h=encodeURIComponent((v=>v instanceof File)(g)?g.name:g.toString()),f=encodeURIComponent(m),p[p.length]=f+"="+h)})),p.join(d)})(a);return c&&u.push(c),u.length>0?s+"?"+u.join("&"):s},es=t=>{if(t.Vr)return t.Vr;var e=t.data,r=t.compression;if(e){if(r===ge.GZipJS){var n=pf((function(a,u){var c=a.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(a);for(var l=new Ae(a.length+(a.length>>>1)),d=0,h=function(m){l[d++]=m},f=0;c>f;++f){if(d+5>l.length){var p=new Ae(d+8+(c-f<<1));p.set(l),l=p}var g=a.charCodeAt(f);128>g?h(g):2048>g?(h(192|g>>>6),h(128|63&g)):g>55295&&57344>g?(h(240|(g=65536+(1047552&g)|1023&a.charCodeAt(++f))>>>18),h(128|g>>>12&63),h(128|g>>>6&63),h(128|63&g)):(h(224|g>>>12),h(128|g>>>6&63),h(128|63&g))}return $l(l,0,d)})(Vt(e)),{mtime:0});return{contentType:Sl,body:n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength),estimatedSize:n.byteLength}}if(r===ge.Base64){var i=(function(a){return a&&btoa(encodeURIComponent(a).replace(/%([0-9A-F]{2})/g,((u,c)=>String.fromCharCode(parseInt(c,16)))))})(Vt(e)),s=(a=>"data="+encodeURIComponent(typeof a=="string"?a:Vt(a)))(i);return{contentType:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}var o=Vt(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},Tl=t=>{var e,r,n=()=>t.transport==="sendBeacon"?{url:No(t.url,{compression:ge.Base64}),encodedBody:es(x({},t,{compression:ge.Base64,Vr:void 0}))}:{url:Pl(t.url,"compression"),encodedBody:es(x({},t,{compression:void 0,Vr:void 0}))};try{e=es(t)}catch(i){if(fu(t.compression,Xt(t.url,"compression")))return $.error("Failed to gzip request body, sending uncompressed payload",i),n();throw i}return e&&fu(t.compression,Xt(t.url,"compression"))&&!((r=e.body)instanceof ArrayBuffer?ds(new Uint8Array(r)):ArrayBuffer.isView(r)&&ds(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)))?(mn=!0,n()):{url:t.url,encodedBody:e}},zl=t=>{try{return Tl(t)}catch(e){return $.error(e),void(t.callback==null||t.callback({statusCode:0,error:e}))}},gf=(function(){var t=ne((function*(e){var r=Vt(e.data),n=yield(function(s,o,a){return hs.apply(this,arguments)})(r,j.DEBUG,{rethrow:!0});if(!n)return e;var i=yield n.arrayBuffer();return x({},e,{Vr:{contentType:Sl,body:i,estimatedSize:i.byteLength}})}));return function(e){return t.apply(this,arguments)}})(),_f=/Failed to fetch|NetworkError|Load failed/i,Rl=t=>{var e=zl(t);if(e){var r=e.url,n=e.encodedBody,i=n??{},s=i.contentType,o=i.body,a=i.estimatedSize,u=new Headers;B(t.headers,(function(p,g){u.append(g,p)})),s&&u.append("Content-Type",s);var c=null,l=!1;if(uu){var d=new uu;c={signal:d.signal,timeout:setTimeout((()=>{var p,g;l=!0,d.abort((p=t.timeout,(g=new Error("PostHog request timed out"+(p?" after "+p+"ms":""))).name="AbortError",g))}),t.timeout)}}var h=p=>{l&&p?.name==="AbortError"||(g=>g?.name==="TypeError"&&_f.test(g?.message||""))(p)?$.warn(p):$.error(p),t.callback==null||t.callback({statusCode:0,error:p})};try{var f;ko(r,x({method:t?.method||"GET",headers:u,keepalive:t.method==="POST"&&!t.Wr&&52428.8>(a||0),body:o,signal:(f=c)==null?void 0:f.signal},t.fetchOptions)).then((p=>p.text().then((g=>{var m={statusCode:p.status,text:g};if(p.status===200)try{m.json=JSON.parse(g)}catch(v){$.error(v)}t.callback==null||t.callback(m)})))).catch(h).finally((()=>c?clearTimeout(c.timeout):null))}catch(p){c&&clearTimeout(c.timeout),h(p)}}},uo=t=>{try{var e,r=Tl(t),n=r.url,i=r.encodedBody,s=i??{},o=s.body,a=s.estimatedSize;if(!o)return;var u=o instanceof Blob?o:new Blob([o],{type:s.contentType});if(_e.sendBeacon(n,u))return;var c=O(t.data)?t.data:(e=t.data)==null?void 0:e.batch;if(O(c)&&c.length>1&&(a??0)>16384){var l=Math.ceil(c.length/2),d=h=>O(t.data)?h:x({},t.data,{batch:h});return uo(x({},t,{data:d(c.slice(0,l))})),void uo(x({},t,{data:d(c.slice(l))}))}$.warn("Beacon of ~"+(a??0)+" bytes was rejected by the browser, falling back to fetch"),Rl(x({},t,{Wr:!0}))}catch(h){$.warn("Beacon send failed",h)}},ju=(t,e,r,n)=>{var i=n==="query"?e==="POST"?"sent_at":"_":void 0;return No(r===ge.GZipJS?Pl(t,"compression"):t,x({},i?{[i]:Date.now().toString()}:{},r===ge.GZipJS?{}:{compression:r}))},yn=[];ko&&yn.push({transport:"fetch",method:Rl}),ls&&yn.push({transport:"XHR",method(t){var e=zl(t);if(e){var r=new ls,n=e.encodedBody;r.open(t.method||"GET",e.url,!0);var i=n??{},s=i.contentType,o=i.body;B(t.headers,(function(a,u){r.setRequestHeader(u,a)})),s&&r.setRequestHeader("Content-Type",s),t.timeout&&(r.timeout=t.timeout),r.onreadystatechange=()=>{if(r.readyState===4){var a={statusCode:r.status,text:r.responseText};if(r.status===200)try{a.json=JSON.parse(r.responseText)}catch{}t.callback==null||t.callback(a)}},r.send(o)}}}),_e!=null&&_e.sendBeacon&&yn.push({transport:"sendBeacon",method:uo});var co=3e3,lo=class{constructor(e,r){this.Zr=!0,this.Gr=[],this.Qr=Ge(r?.flush_interval_ms||co,250,5e3,$.createLogger("flush interval"),co),this.Jr=e}enqueue(e){this.Gr.push(e),this.Kr||this.Yr()}unload(){this.Xr();var e=this.Gr.length>0?this.ei():{},r=Object.values(e);[...r.filter((n=>n.url.indexOf("/e")===0)),...r.filter((n=>n.url.indexOf("/e")!==0))].map((n=>{this.ti(x({},n,{transport:"sendBeacon"}))}))}enable(){this.Zr=!1,this.Yr()}Yr(){var e=this;this.Zr||(this.Kr=setTimeout((()=>{if(this.Xr(),this.Gr.length>0){var r=this.ei(),n=function(){var s=r[i],o=new Date().getTime();s.data&&O(s.data)&&B(s.data,(a=>{a.offset=Math.abs(a.timestamp-o),delete a.timestamp})),e.ti(s)};for(var i in r)n()}}),this.Qr))}ti(e){try{this.Jr(e)}catch(r){$.error(r)}}Xr(){clearTimeout(this.Kr),this.Kr=void 0}ei(){var e={};return B(this.Gr,(r=>{var n,i=r,s=(i?i.batchKey:null)||i.url;E(e[s])&&(e[s]=x({},i,{data:[]})),(n=e[s].data)==null||n.push(i.data)})),this.Gr=[],e}},vf=["retriesPerformedSoFar"],ho=class{constructor(e){this.ri=!1,this.ii=3e3,this.Gr=[],this._instance=e,this.Gr=[],this.ni=!0,!E(_)&&"onLine"in _.navigator&&(this.ni=_.navigator.onLine,this.si=()=>{this.ni=!0,this.oi()},this.ai=()=>{this.ni=!1},re(_,"online",this.si),re(_,"offline",this.ai))}get length(){return this.Gr.length}retriableRequest(e){var r=e.retriesPerformedSoFar,n=oc(e,vf);et(r)&&(n.url=No(n.url,{retry_count:r})),this._instance._send_request(x({},n,{callback:i=>{if(i.statusCode!==200&&(400>i.statusCode||i.statusCode>=500)){if((i.statusCode===0?3:10)>(r??0))return void this.kt(x({retriesPerformedSoFar:r},n));i.statusCode===0&&$.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(r??0)+" retries.")}n.callback==null||n.callback(i)}}))}kt(e){var r=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=r+1;var n=(function(o){var a=3e3*Math.pow(2,o),u=a/2,c=Math.min(18e5,a),l=Math.random()-.5;return Math.ceil(c+l*(c-u))})(r),i=Date.now()+n;this.Gr.push({retryAt:i,requestOptions:e});var s="Enqueued failed request for retry in "+n;navigator.onLine||(s+=" (Browser is offline)"),$.warn(s),this.ri||(this.ri=!0,this.li())}li(){if(this.ui&&clearTimeout(this.ui),this.Gr.length===0)return this.ri=!1,void(this.ui=void 0);this.ui=setTimeout((()=>{this.ni&&this.Gr.length>0&&this.oi(),this.li()}),this.ii)}oi(){var e=Date.now(),r=[],n=this.Gr.filter((s=>e>s.retryAt||(r.push(s),!1)));if(this.Gr=r,n.length>0)for(var i of n)this.retriableRequest(i.requestOptions)}unload(){for(var e of(this.ui&&(clearTimeout(this.ui),this.ui=void 0),this.ri=!1,E(_)||(this.si&&(_.removeEventListener("online",this.si),this.si=void 0),this.ai&&(_.removeEventListener("offline",this.ai),this.ai=void 0)),this.Gr)){var r=e.requestOptions;try{this._instance._send_request(x({},r,{transport:"sendBeacon"}))}catch(n){$.error(n)}}this.Gr=[]}},po=class{constructor(e){this.hi=()=>{var r,n,i,s;this.di||(this.di={});var o=this.scrollElement(),a=this.scrollY(),u=o?Math.max(0,o.scrollHeight-o.clientHeight):0,c=a+(o?.clientHeight||0),l=o?.scrollHeight||0;this.di.lastScrollY=Math.ceil(a),this.di.maxScrollY=Math.max(a,(r=this.di.maxScrollY)!==null&&r!==void 0?r:0),this.di.maxScrollHeight=Math.max(u,(n=this.di.maxScrollHeight)!==null&&n!==void 0?n:0),this.di.lastContentY=c,this.di.maxContentY=Math.max(c,(i=this.di.maxContentY)!==null&&i!==void 0?i:0),this.di.maxContentHeight=Math.max(l,(s=this.di.maxContentHeight)!==null&&s!==void 0?s:0)},this._instance=e}get ci(){return this._instance.config.scroll_root_selector}getContext(){return this.di}resetContext(){var e=this.di;return setTimeout(this.hi,0),e}startMeasuringScrollPosition(){re(_,"scroll",this.hi,{capture:!0}),re(_,"scrollend",this.hi,{capture:!0}),re(_,"resize",this.hi)}scrollElement(){if(!this.ci)return _?.document.documentElement;var e=O(this.ci)?this.ci:[this.ci];for(var r of e){var n=_?.document.querySelector(r);if(n)return n}}vi(e){var r=e==="y"?"scrollTop":"scrollLeft";if(this.ci){var n=this.scrollElement();return n&&n[r]||0}return _?e==="y"?_.scrollY||_.pageYOffset||_.document.documentElement.scrollTop||0:_.scrollX||_.pageXOffset||_.document.documentElement.scrollLeft||0:0}scrollY(){return this.vi("y")}scrollX(){return this.vi("x")}},mf=t=>yl(t?.config.mask_personal_data_properties,t?.config.custom_personal_data_properties,t?.config.disable_capture_url_hashes),Gn=class{constructor(e,r,n,i){this.fi=s=>{var o=this.pi();if(!o||o.sessionId!==s){var a={sessionId:s,props:this.gi(this._instance)};this.mi.register({[Bs]:a})}},this._instance=e,this.yi=r,this.mi=n,this.gi=i||mf,this.yi.onSessionId(this.fi)}pi(){return this.mi.props[Bs]}getSetOnceProps(){var e,r=(e=this.pi())==null?void 0:e.props;return r?"r"in r?bl(r,this._instance.config.disable_capture_url_hashes):{$referring_domain:r.referringDomain,$pathname:r.initialPathName,utm_source:r.utm_source,utm_campaign:r.utm_campaign,utm_medium:r.utm_medium,utm_content:r.utm_content,utm_term:r.utm_term}:{}}getSessionProps(){var e={};return B(Ao(this.getSetOnceProps()),((r,n)=>{n==="$current_url"&&(n="url"),e["$session_entry_"+ps(n)]=r})),e}},Dr=class{on(e,r){return this.bi[e]||(this.bi[e]=[]),this.bi[e].push(r),()=>{this.bi[e]=this.bi[e].filter((n=>n!==r))}}emit(e,r){for(var n of this.bi[e]||[])n(r);for(var i of this.bi["*"]||[])i(e,r)}constructor(){this.bi={}}},mr=X("[SessionId]"),Vn=class{on(e,r){return this.wi.on(e,r)}constructor(e,r,n){var i;if(this.xi=null,this.ki=[],this.Si=void 0,this.Ci=!1,this.wi=new Dr,this.Ti=(c,l)=>!(!et(c)||!et(l))&&Math.abs(c-l)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===it)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Te=e.config,this.mi=e.persistence,this.Ii=void 0,this.Mi=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Ei=r||nt,this.Ri=n||nt;var s=this.Te.persistence_name||this.Te.token;if(this._sessionTimeoutMs=1e3*Ge(this.Te.session_idle_timeout_seconds||1800,60,36e3,mr.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Pi(),this.Oi="ph_"+s+"_window_id",this.Fi="ph_"+s+"_primary_window_exists",this.Li()){var o=le.F(this.Oi),a=le.F(this.Fi);o&&!a?this.Ii=o:le.P(this.Oi),le.q(this.Fi,!0)}if((i=this.Te.bootstrap)!=null&&i.sessionID)try{var u=(c=>{var l=this.Te.bootstrap.sessionID.replace(/-/g,"");if(l.length!==32)throw new Error("Not a valid UUID");if(l[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(l.substring(0,12),16)})();this.$i(this.Te.bootstrap.sessionID,new Date().getTime(),u)}catch(c){mr.error("Invalid sessionID in bootstrap",c)}this.Ai()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return E(this.ki)&&(this.ki=[]),this.ki.push(e),this.Mi&&e(this.Mi,this.Ii),()=>{this.ki=this.ki.filter((r=>r!==e))}}Li(){return this.Te.persistence!=="memory"&&!this.mi.yr&&le.N()}Ni(e){e!==this.Ii&&(this.Ii=e,this.Li()&&le.q(this.Oi,e))}Di(){return this.Ii?this.Ii:this.Li()?le.F(this.Oi):null}qi(e){var r=this.xi;return!me(r)&&!me(e)&&5e3>Math.abs(e-r)}$i(e,r,n){var i=r!==this._sessionActivityTimestamp,s=!(e!==this.Mi||n!==this._sessionStartTimestamp);this._sessionStartTimestamp=n,this._sessionActivityTimestamp=r,this.Mi=e,s&&!i||s&&this.qi(r)||(this.xi=r,this.mi.register({[Gt]:[r,e,n]}))}ji(){var e,r=(e=this.Te)==null?void 0:e.persistence_save_debounce_ms;return et(r)&&r>0}Hi(){this.ji()?this.mi.refreshKey(Gt):(this.mi.flush(),this.mi.load())}Bi(){var e;if(!me(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.xi){this.Hi();var r=this.Ui();r[1]===this.Mi&&r[2]===this._sessionStartTimestamp&&(this.xi=this._sessionActivityTimestamp,this.mi.register({[Gt]:[this._sessionActivityTimestamp,(e=this.Mi)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.mi.flush())}}zi(){var e=this.Ui()[0],r=et(e)?e:0,n=et(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(r,n)}Vi(e){return this.Hi(),this.Ti(e,this.zi())}Ui(){var e=this.mi.props[Gt];return O(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.xi=null,clearTimeout(this.Wi),this.Wi=void 0,this.$i(null,null,null)}destroy(){this.Ci=!0,this.Bi(),clearTimeout(this.Wi),this.Wi=void 0,this.Si&&_&&(_.removeEventListener(Mn,this.Si,{capture:!1}),this.Si=void 0),this.ki=[]}Ai(){this.Si=()=>{this.Bi(),this.Li()&&le.P(this.Fi)},re(_,Mn,this.Si,{capture:!1})}checkAndGetSessionAndWindowId(e,r){if(e===void 0&&(e=!1),r===void 0&&(r=null),this.Te.cookieless_mode===it)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var n=r||new Date().getTime(),i=this.Ui(),s=i[1],o=i[2],a=this.zi(),u=this.Di(),c=et(o)&&Math.abs(n-o)>864e5,l=!1,d=!1,h=!s,f=s,p=!h&&!e&&this.Ti(n,a);if(p){(p=this.Vi(n))||mr.info("cross-tab refresh kept the session alive",{sessionId:s});var g=this.Ui();s=g[1],o=g[2]}h||p||c?(s=this.Ei(),u=this.Ri(),mr.info("new session ID generated",{sessionId:s,windowId:u,changeReason:{noSessionId:h,activityTimeout:p,sessionPastMaximumLength:c}}),o=n,l=!0):(u||(u=this.Ri(),l=!0),(d=s!==f)&&(mr.info("adopted cross-tab session id",{sessionId:s,windowId:u}),l=!0));var m=et(a)&&e&&!c?a:n,v=et(o)?o:new Date().getTime();this.Ni(u),this.$i(s,m,v),e||this.Pi();var w={noSessionId:h,activityTimeout:p,sessionPastMaximumLength:c,crossTabAdoption:d};return l&&this.ki.forEach((y=>y(s,u,w))),{sessionId:s,windowId:u,sessionStartTimestamp:v,changeReason:l?w:void 0,lastActivityTimestamp:a}}Pi(){this.Ci||(clearTimeout(this.Wi),this.Wi=setTimeout((()=>{if(!this.Ci)if(this.Vi(new Date().getTime())){var e=this.Mi;this.resetSessionId(),this.wi.emit("forcedIdleReset",{idleSessionId:e})}else this.Pi()}),1.1*this.sessionTimeoutMs))}},Cl=function(t,e){if(!t)return!1;var r=t.userAgent;if(r&&_u(r,e))return!0;try{var n=t?.userAgentData;if(n!=null&&n.brands&&n.brands.some((i=>_u(i?.brand,e))))return!0}catch{}return!!t.webdriver};function Il(){return(Il=ne((function*(){var t=_e?.userAgentData;if(t!=null&&t.getHighEntropyValues)try{var e=yield t.getHighEntropyValues(["model"]),r=e?.model;return H(r)&&r.length>0?r:void 0}catch(n){return void $.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",n)}}))).apply(this,arguments)}var qn=function(t,e){if(!(function(r){try{new RegExp(r)}catch{return!1}return!0})(e))return!1;try{return new RegExp(e).test(t)}catch{return!1}};function Uu(t,e,r){return Vt({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:r})}var Al={exact:(t,e)=>e.some((r=>t.some((n=>r===n)))),is_not:(t,e)=>e.every((r=>t.every((n=>r!==n)))),regex:(t,e)=>e.some((r=>t.some((n=>qn(r,n))))),not_regex:(t,e)=>e.every((r=>t.every((n=>!qn(r,n))))),icontains:(t,e)=>e.map(ln).some((r=>t.map(ln).some((n=>r.includes(n))))),not_icontains:(t,e)=>e.map(ln).every((r=>t.map(ln).every((n=>!r.includes(n))))),gt:(t,e)=>e.some((r=>{var n=parseFloat(r);return!isNaN(n)&&t.some((i=>n>parseFloat(i)))})),lt:(t,e)=>e.some((r=>{var n=parseFloat(r);return!isNaN(n)&&t.some((i=>n<parseFloat(i)))}))},ln=t=>t.toLowerCase();function Ol(t,e){return!t||Object.entries(t).every((r=>{var n=r[1],i=e?.[r[0]];if(E(i)||me(i))return!1;var s=[String(i)],o=Al[n.operator];return!!o&&o(n.values,s)}))}var fo="custom",Hu="i.posthog.com",yf=/^\/static\//,go=class{constructor(e){this.Zi={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,r=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return r||(r=this.apiHost.replace("."+Hu,".posthog.com")),r==="https://app.posthog.com"?"https://us.posthog.com":r}get region(){return this.Zi[this.apiHost]||(this.Zi[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":fo),this.Zi[this.apiHost]}Gi(e){if(yf.test(e)){var r=this.instance.config.asset_host;if(typeof r=="string")return r.trim().replace(/\/$/,"")||void 0}}endpointFor(e,r){if(r===void 0&&(r=""),r&&(r=r[0]==="/"?r:"/"+r),e==="ui")return this.uiHost+r;if(e==="flags")return this.flagsApiHost+r;if(e==="assets"){var n=this.Gi(r);if(n)return""+n+r}if(this.region===fo)return this.apiHost+r;var i=Hu+r;switch(e){case"assets":return"https://"+this.region+"-assets."+i;case"api":return"https://"+this.region+"."+i}}};function Ml(t){var e;return!((e=t.conditions)==null||(e=e.events)==null||(e=e.values)==null||!e.length)}var U=X("[Surveys]"),Fl="seenSurvey_",Ll=t=>{try{var e=(r=>((n,i)=>""+Fl+(function(s){return s.current_iteration&&s.current_iteration>0?s.id+"_"+s.current_iteration:s.id})(i))(0,r))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(r){U.error("Failed to persist survey seen state",r)}},bf=[Ji.Popover,Ji.Widget,Ji.API],xf={ignoreConditions:!1,ignoreDelay:!1,displayType:ro.Popover},wf=X("[PostHog ExternalIntegrations]"),kf={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},_o=class{constructor(e){this._instance=e}er(e,r){var n;(n=C.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,e,(i=>{if(i)return wf.error("failed to load script",i);r()}))}startIfEnabledOrStop(){var e=this,r=function(){var s,o,a,u=n[0],c=n[1];!c||(s=C.__PosthogExtensions__)!=null&&(s=s.integrations)!=null&&s[u]||e.er(kf[u],(()=>{var l;(l=C.__PosthogExtensions__)==null||(l=l.integrations)==null||(l=l[u])==null||l.start(e._instance)})),!c&&(o=C.__PosthogExtensions__)!=null&&(o=o.integrations)!=null&&o[u]&&((a=C.__PosthogExtensions__)==null||(a=a.integrations)==null||(a=a[u])==null||a.stop())};for(var n of Object.entries((i=this._instance.config.integrations)!==null&&i!==void 0?i:{})){var i;r()}}},Ar={},ts=0,Kn=()=>{},Bu='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',yr="Surveys module not available",Gu="sanitize_properties is deprecated. Use before_send instead",Zl="Invalid value for property_denylist config: ",Ef=["token","distinct_id",Gc],Bt="posthog",Nl=!ff&&xe?.indexOf("MSIE")===-1&&xe?.indexOf("Mozilla")===-1,rs=t=>{var e;return x({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Fp(P?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Kn,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:t??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:ie&&H(ie?.search)&&ie.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,disable_external_dependency_loading:!1,strict_script_versioning:!1,enable_recording_console_log:void 0,secure_cookie:(_==null||(e=_.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,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(r){$.error("Bad HTTP status: "+r.statusCode+" "+r.text)},get_device_id:r=>r,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:Ks,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:co},error_tracking:{},_onCapture:Kn},(r=>({rageclick:r&&r>="2026-05-30"?{content_ignorelist:Gp,ignore_text_selection:!0}:!r||"2025-11-30">r||{content_ignorelist:!0},capture_pageview:!r||"2025-05-24">r||"history_change",session_recording:r&&r>="2026-06-25"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6},streamNetworkBody:!0}:r&&r>="2026-05-30"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6}}:r&&r>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:r&&r>="2026-01-30"?"head":"body",internal_or_test_user_hostname:r&&r>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:r&&r>="2026-05-30"?250:0,split_storage:!(!r||"2026-05-30">r),detect_google_search_app:!(!r||"2026-05-30">r),disable_capture_url_hashes:!(!r||"2026-06-25">r)}))(t))},$f=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"]],Vu=t=>{var e={};for(var r of $f){var n=r[0],i=r[1];E(t[n])||(e[i]=t[n])}var s=K({},e,t),o=t.__preview_external_dependency_versioned_paths;return E(o)||(E(t.strict_script_versioning)&&(s.strict_script_versioning=!!o),H(o)&&E(t.asset_host)&&(s.asset_host=o)),O(t.property_blacklist)&&(E(t.property_denylist)?s.property_denylist=t.property_blacklist:O(t.property_denylist)?s.property_denylist=[...t.property_blacklist,...t.property_denylist]:$.error(Zl+t.property_denylist)),s},vo=class{constructor(){this.__forceAllowLocalhost=!1}get Qi(){return this.__forceAllowLocalhost}set Qi(e){$.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},Ot=class t{Ji(e,r){if(e){var n=this.Ki.indexOf(e);n!==-1&&this.Ki.splice(n,1)}return this.Ki.push(r),r.initialize==null||r.initialize(),r}Yi(){return this.config.cookieless_mode===it||this.config.cookieless_mode===Rt&&this.consent.isRejected()}get decideEndpointWasHit(){var e,r;return(e=(r=this.featureFlags)==null?void 0:r.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,r;return(e=(r=this.featureFlags)==null?void 0:r.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){var e;this.webPerformance=new vo,this.Xi=!1,this.version=j.LIB_VERSION,this.en=new Dr,this.Ki=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=rs(),this.SentryIntegration=to,this.sentryIntegration=n=>(function(i,s){var o=hl(i,s);return{name:dl,processEvent:a=>o(a)}})(this,n),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.tn=!1,this.rn=null,this.nn=null,this.sn=null,this.scrollManager=new po(this),this.pageViewManager=new Zn(this),this.rateLimiter=new no(this),this.requestRouter=new go(this),this.consent=new Xs(this),this.externalIntegrations=new _o(this);var r=(e=t.__defaultExtensionClasses)!==null&&e!==void 0?e:{};this.featureFlags=r.featureFlags&&new r.featureFlags(this),this.toolbar=r.toolbar&&new r.toolbar(this),this.surveys=r.surveys&&new r.surveys(this),this.conversations=r.conversations&&new r.conversations(this),this.logs=r.logs&&new r.logs(this),this.metrics=r.metrics&&new r.metrics(this),this.experiments=r.experiments&&new r.experiments(this),this.exceptions=r.exceptions&&new r.exceptions(this),this.people={set:(n,i,s)=>{var o=H(n)?{[n]:i}:n;this.setPersonProperties(o),s?.({})},set_once:(n,i,s)=>{var o=H(n)?{[n]:i}:n;this.setPersonProperties(void 0,o),s?.({})}},this.on("eventCaptured",(n=>$.info('send "'+n?.event+'"',n)))}init(e,r,n){if(n&&n!==Bt){var i,s=(i=Ar[n])!==null&&i!==void 0?i:new t;return s._init(e,r,n),Ar[n]=s,Ar[Bt][n]=s,s}return this._init(e,r,n)}_init(e,r,n){var i,s;r===void 0&&(r={});var o=H(e)?e.trim():"";if(!o)return $.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=rs(r.defaults),r.debug=this.an(r.debug),this.ln=r,this.un=[],r.person_profiles?this.nn=r.person_profiles:r.process_person&&(this.nn=r.process_person);var a=rs(r.defaults),u=Vu(r),c=K({},a,u,{name:n,token:o});Y(a.rageclick)&&Y(u.rageclick)&&(c.rageclick=K({},a.rageclick,u.rageclick)),Y(a.session_recording)&&Y(u.session_recording)&&(c.session_recording=K({},a.session_recording,u.session_recording)),this.set_config(c),this.config.on_xhr_error&&$.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=r.disable_compression?void 0:ge.GZipJS;var l=this.hn();this.persistence=new Cr(this.config,l),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Cr(x({},this.config,{persistence:"sessionStorage"}),l,!1);var d=x({},this.persistence.props),h=x({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.dn=new lo((k=>this.cn(k)),this.config.request_queue_config),this.vn=new ho(this),this.__request_queue=[];var f=this.Yi();if(f||(this.sessionManager=new Vn(this),this.sessionPropsManager=new Gn(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?($.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.fn(f)}),0)):($.info("Initializing extensions synchronously"),this.fn(f)),j.DEBUG=j.DEBUG||this.config.debug,j.DEBUG&&$.info("Starting in debug mode",{this:this,config:r,thisC:x({},this.config),p:d,s:h}),!this.config.identity_distinct_id||(i=r.bootstrap)!=null&&i.distinctID||(r.bootstrap=x({},r.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),((s=r.bootstrap)==null?void 0:s.distinctID)!==void 0){var p=r.bootstrap.distinctID,g=this.get_distinct_id(),m=this.persistence.get_property(Le);if(r.bootstrap.isIdentifiedID&&g!=null&&g!==p&&m===Zt)this.identify(p);else if(r.bootstrap.isIdentifiedID&&g!=null&&g!==p&&m===Nt)$.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var v=this.config.get_device_id(nt()),w=r.bootstrap.isIdentifiedID?v:p;this.persistence.set_property(Le,r.bootstrap.isIdentifiedID?Nt:Zt),this.register({distinct_id:p,$device_id:w})}}if(f)this.register_once({distinct_id:sn,$device_id:null},"");else if(!this.get_distinct_id()){var y=this.config.get_device_id(nt());this.register_once({distinct_id:y,$device_id:y},""),this.persistence.set_property(Le,Zt)}return re(_,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),r.segment?(function(k,T){var M=k.config.segment;if(!M)return T();(function(R,b){var S=R.config.segment;if(!S)return b();var z=I=>{var Z=()=>I.anonymousId()||nt();R.config.get_device_id=Z,I.id()&&(R.register({distinct_id:I.id(),$device_id:Z()}),R.persistence.set_property(Le,Nt)),b()},L=S.user();"then"in L&&Ze(L.then)?L.then(z):z(L)})(k,(()=>{M.register((R=>{typeof Promise<"u"&&Promise.resolve||Ki.warn("This browser does not have Promise support, and can not use the segment integration");var b=(S,z)=>{if(!z)return S;S.event.userId||S.event.anonymousId===R.get_distinct_id()||(Ki.info("No userId set, resetting PostHog"),R.reset()),S.event.userId&&S.event.userId!==R.get_distinct_id()&&(Ki.info("UserId set, identifying with PostHog"),R.identify(S.event.userId));var L=R.calculateEventProperties(z,S.event.properties);return S.event.properties=Object.assign({},L,S.event.properties),S};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:S=>b(S,S.event.event),page:S=>b(S,Ht),identify:S=>b(S,Gi),screen:S=>b(S,"$screen")}})(k)).then((()=>{T()}))}))})(this,(()=>this.pn())):this.pn(),Ze(this.config._onCapture)&&this.config._onCapture!==Kn&&($.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(k=>this.config._onCapture(k.event,k)))),this.config.ip&&$.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this.config.disableDeviceModel||(function(){return Il.apply(this,arguments)})().then((k=>{k&&this.register({[Hi]:k})})).catch(Kn),this}fn(e){var r,n,i,s,o,a,u,c,l=performance.now(),d=x({},t.__defaultExtensionClasses,this.config.__extensionClasses),h=[];d.featureFlags&&this.Ki.push(this.featureFlags=(r=this.featureFlags)!==null&&r!==void 0?r:new d.featureFlags(this)),d.exceptions&&this.Ki.push(this.exceptions=(n=this.exceptions)!==null&&n!==void 0?n:new d.exceptions(this)),d.historyAutocapture&&this.Ki.push(this.historyAutocapture=new d.historyAutocapture(this)),d.tracingHeaders&&this.Ki.push(this.tracingHeaders=new d.tracingHeaders(this)),d.siteApps&&this.Ki.push(this.siteApps=new d.siteApps(this)),d.sessionRecording&&!e&&this.Ki.push(this.sessionRecording=new d.sessionRecording(this)),this.config.disable_scroll_properties||h.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),d.autocapture&&this.Ki.push(this.autocapture=new d.autocapture(this)),d.surveys&&this.Ki.push(this.surveys=(i=this.surveys)!==null&&i!==void 0?i:new d.surveys(this)),d.logs&&this.Ki.push(this.logs=(s=this.logs)!==null&&s!==void 0?s:new d.logs(this)),d.metrics&&this.Ki.push(this.metrics=(o=this.metrics)!==null&&o!==void 0?o:new d.metrics(this)),d.conversations&&this.Ki.push(this.conversations=(a=this.conversations)!==null&&a!==void 0?a:new d.conversations(this)),d.productTours&&this.Ki.push(this.productTours=new d.productTours(this)),d.heatmaps&&this.Ki.push(this.heatmaps=new d.heatmaps(this)),d.webVitalsAutocapture&&this.Ki.push(this.webVitalsAutocapture=new d.webVitalsAutocapture(this)),d.exceptionObserver&&this.Ki.push(this.exceptionObserver=new d.exceptionObserver(this)),d.deadClicksAutocapture&&this.Ki.push(this.deadClicksAutocapture=new d.deadClicksAutocapture(this,Qp)),d.toolbar&&this.Ki.push(this.toolbar=(u=this.toolbar)!==null&&u!==void 0?u:new d.toolbar(this)),d.experiments&&this.Ki.push(this.experiments=(c=this.experiments)!==null&&c!==void 0?c:new d.experiments(this)),this.Ki.forEach((f=>{f.initialize&&h.push((()=>{f.initialize==null||f.initialize()}))})),h.push((()=>{if(this.gn){var f=this.gn;this.gn=void 0,this.Hr(f)}})),this.mn(h,l)}mn(e,r){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-r>=30&&e.length>0)return void setTimeout((()=>{this.mn(e,r)}),0);var n=e.shift();if(n)try{n()}catch(s){$.error("Error initializing extension:",s)}}var i=Math.round(performance.now()-r);this.register_for_session({[Vc]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[qc]:i}),this.config.__preview_deferred_init_extensions&&$.info("PostHog extensions initialized ("+i+"ms)")}Hr(e){if(!P||!P.body)return $.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Hr(e)}),500);if(this.config.__preview_deferred_init_extensions&&(this.gn=e),this.yn=e,this.compression=void 0,e.ok){var r,n=e.config;n.supportedCompression&&!this.config.disable_compression&&(this.compression=A(n.supportedCompression,ge.GZipJS)?ge.GZipJS:A(n.supportedCompression,ge.Base64)?ge.Base64:void 0),(r=n.analytics)!=null&&r.endpoint&&(this.analyticsDefaultEndpoint=n.analytics.endpoint)}this.set_config({person_profiles:this.nn?this.nn:Ks}),this.Ki.forEach((i=>i.onRemoteConfig==null?void 0:i.onRemoteConfig(e)))}pn(){try{this.config.loaded(this)}catch(n){$.critical("`loaded` function failed",n)}if(this.bn(),this.config.internal_or_test_user_hostname&&ie!=null&&ie.hostname){var e=ie.hostname,r=this.config.internal_or_test_user_hostname;(typeof r=="string"?e===r:r.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.Yi())&&this._n()}),1),this.wn=new Un(this),this.wn.load()}bn(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.dn)==null||e.enable())}_dom_loaded(){this.is_capturing()&&on(this.__request_queue,(e=>this.cn(e))),this.__request_queue=[],this.bn()}_handle_unload(){var e,r,n,i,s;(e=this.surveys)==null||e.handlePageUnload==null||e.handlePageUnload(),(r=this.metrics)==null||r.flush("sendBeacon"),this.config.request_batching?(this.xn()&&this.capture(Bi),(n=this.logs)==null||n.flushLogs("sendBeacon"),(i=this.dn)==null||i.unload(),(s=this.vn)==null||s.unload()):this.xn()&&this.capture(Bi,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded?Nl?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(e.callback==null||e.callback({statusCode:429})):(e.transport=e.transport||this.config.api_transport,e.headers=x({},this.config.request_headers,e.headers),e.compression=e.compression==="best-available"?this.compression:e.compression,(E(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(r=>{var n,i,s,o=x({},r);o.timeout=o.timeout||6e4;var a,u,c,l,d,h=(n=o.transport)!==null&&n!==void 0?n:"fetch";h==="sendBeacon"&&E(o.compression)&&o.data&&(o.compression=ge.Base64),o.method==="POST"&&o.data&&(o.timestampMode==="capture-body"?o.data={api_key:(u=(d=(l=O(a=o.data)?a:[a])[0])==null||(c=d.properties)==null?void 0:c.token)!==null&&u!==void 0?u:d?.token,batch:l,sent_at:new Date().toISOString()}:o.timestampMode==="body"&&(o.data=(function(g,m){return m===void 0&&(m=new Date().toISOString()),O(g)?g.map((v=>x({},v,{sent_at:m}))):x({},g,{sent_at:m})})(o.data))),o.url=ju(o.url,o.method,o.compression,o.timestampMode);var f=yn.filter((g=>!o.disableTransport||!g.transport||!o.disableTransport.includes(g.transport))),p=(i=(s=(function(g,m){for(var v=0;g.length>v;v++)if(g[v].transport===h)return g[v]})(f))==null?void 0:s.method)!==null&&i!==void 0?i:f[0].method;if(!p)throw new Error("No available transport method");h!=="sendBeacon"&&o.data&&o.compression===ge.GZipJS&&Wh&&typeof Promise<"u"&&!mn?gf(o).then((g=>{p(g)})).catch((g=>{if(gu(g))return mn=!0,void p(x({},o,{compression:void 0,url:ju(r.url,r.method,void 0,r.timestampMode)}));(m=>{if(!m||typeof m!="object")return!1;var v="name"in m?String(m.name):"";return gu(m)||v===ac})(g)&&(mn=!0),p(o)})):p(o)})(x({},e,{callback:r=>{var n,i;this.rateLimiter.checkForLimiting(r),400>r.statusCode||(n=(i=this.config).on_request_error)==null||n.call(i,r),e.callback==null||e.callback(r)}}))):e.fireCallbackOnDrop&&(e.callback==null||e.callback({statusCode:0}))}cn(e){this.vn?this.vn.retriableRequest(e):this._send_request(e)}_execute_array(e){ts++;try{var r,n=[],i=[],s=[];on(e,(a=>{if(a)if(O(r=a[0]))s.push(a);else if(Ze(a))try{a.call(this)}catch(u){$.error("Error executing queued PostHog call",a,u)}else O(a)&&r==="alias"?n.push(a):O(a)&&r.indexOf("capture")!==-1&&Ze(this[r])?s.push(a):i.push(a)}));var o=function(a,u){on(a,(function(c){try{if(O(c[0])){var l=u;B(c,(function(d){l=l[d[0]].apply(l,d.slice(1))}))}else u[c[0]].apply(u,c.slice(1))}catch(d){$.error("Error executing queued PostHog call",c,d)}}))};o(n,this),o(i,this),o(s,this)}finally{ts--}}push(e){if(ts>0&&O(e)&&H(e[0])){var r=t.prototype[e[0]];Ze(r)&&r.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,r,n){var i,s,o,a,u;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.dn){if(this.is_capturing())if(!E(e)&&H(e)){var c=!this.config.opt_out_useragent_filter&&this._is_bot();if(!c||this.config.__preview_capture_bot_pageviews){var l=n!=null&&n.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(l==null||!l.isRateLimited){r!=null&&r.$current_url&&!H(r?.$current_url)&&($.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),r==null||delete r.$current_url),e!=="$exception"||n!=null&&n.kn||$.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&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 d=new Date,h=n?.timestamp||d,f=bu(n?.uuid,nt),p={uuid:f,event:e,properties:this.calculateEventProperties(e,r||{},h,f)};e===Ht&&this.config.__preview_capture_bot_pageviews&&c&&(p.event="$bot_pageview",p.properties.$browser_type="bot"),l&&(p.properties.$lib_rate_limit_remaining_tokens=l.remainingTokens);var g=e==="$feature_flag_called"&&p.properties.$feature_flag_has_experiment===!1&&this.get_property(Rn)===!0;n?.$set&&!g&&(p.$set=n?.$set);var m=n?.$unset;m&&(p.$unset=m);var v,w,y,k=g?void 0:this.Sn(n?.$set_once,e!==$u,e===Gi);if(k&&(p.$set_once=k),n!=null&&n._noTruncate||(s=this.config.properties_string_max_length,o=p,a=I=>H(I)?I.slice(0,s):I,u=new Set,p=(function I(Z,Q){if(Z!==Object(Z))return a?a(Z):Z;if(!u.has(Z)){var G;if(u.add(Z),O(Z))G=[],on(Z,(q=>{G.push(I(q))}));else{var N={};B(Z,((q,J)=>{u.has(q)||(N[J]=I(q,J))})),G=N}return G}})(o)),p.timestamp=h,E(n?.timestamp)||(p.properties.$event_time_override_provided=!0,p.properties.$event_time_override_system_time=d),g&&(p.properties=(function(I,Z){Z===void 0&&(Z=[]);var Q={},G=N=>{I[N]!==void 0&&(Q[N]=I[N])};return Jh.forEach(G),Z.forEach(G),Q})(p.properties,Ef)),e===ot.DISMISSED||e===ot.SENT){var T=r?.[Yi.SURVEY_ID],M=r?.[Yi.SURVEY_ITERATION];Ll({id:T,current_iteration:M}),p.$set=x({},p.$set,{[(v={id:T,current_iteration:M},w=e===ot.SENT?"responded":"dismissed",y="$survey_"+w+"/"+v.id,v.current_iteration&&v.current_iteration>0&&(y="$survey_"+w+"/"+v.id+"/"+v.current_iteration),y)]:!0})}else e===ot.SHOWN&&(p.$set=x({},p.$set,{[Yi.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(e===uf.SHOWN){var R=r?.[Fu.TOUR_TYPE];R&&(p.$set=x({},p.$set,{[Fu.TOUR_LAST_SEEN_DATE+"/"+R]:new Date().toISOString()}))}var b=x({},p.properties.$set,p.$set);if(pt(b)||this.setPersonPropertiesForFlags(b),!F(this.config.before_send)){var S=this.wt(p);if(!S)return;(p=S).uuid=bu(p.uuid,nt)}this.en.emit("eventCaptured",p);var z=(i=n?._url)!==null&&i!==void 0?i:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),L={method:"POST",url:z,data:p,compression:"best-available",timestampMode:n?._batchKey==="recordings"||/\/s\/(?:\?|$)/.test(z)?"body":"capture-body",batchKey:n?._batchKey,transport:n?.transport};return!this.config.request_batching||n&&(n==null||!n._batchKey)||n!=null&&n.send_instantly?this.cn(L):this.dn.enqueue(L),p}$.critical("This capture call is ignored due to client rate limiting.")}}else $.error("No event name provided to posthog.capture")}else $.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(r=>e(r.event,r)))}calculateEventProperties(e,r,n,i,s){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return r;var o=s?void 0:this.persistence.remove_event_timer(e),a=x({},r);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,this.Yi()&&(a[Gc]=!0),e==="$snapshot"){var u=x({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=u.distinct_id,(!H(a.distinct_id)&&!de(a.distinct_id)||fs(a.distinct_id))&&$.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var c,l=(function(y,k,T,M){var R,b,S,z;if(M===void 0&&(M=!1),!xe)return{};var L,I=y?[...Qt,...k||[]]:[],Z=(function(Ur){for(var tr=0;mu.length>tr;tr++){var Hr=mu[tr],Te=Hr[1],Br=Hr[0].exec(Ur),rr=Br&&(Ze(Te)?Te(Br,Ur):Te);if(rr)return rr}return["",""]})(xe),Q=Z[0],G=Z[1],N=(L=typeof navigator<"u"?navigator:void 0)!=null&&L.brave?{brave:!0}:{},q={};E(T)||(q.detectGoogleSearchApp=T);var J={},we=(R=navigator)==null||(R=R.userAgentData)==null?void 0:R.platform,Pe=(b=navigator)==null?void 0:b.maxTouchPoints,ye=_==null||(S=_.screen)==null?void 0:S.width,ke=_==null||(z=_.screen)==null?void 0:z.height,ee=_?.devicePixelRatio;E(we)||(J.userAgentDataPlatform=we),E(Pe)||(J.maxTouchPoints=Pe),E(ye)||(J.screenWidth=ye),E(ke)||(J.screenHeight=ke),E(ee)||(J.devicePixelRatio=ee);var oe,ae,ce,ut,fe,Oe,ct,be,Me=K(Ao({$os:Q,$os_version:G,$browser:Cc(xe,navigator.vendor,N,q),$device:yu(xe),$device_type:(ae=xe,ce=J,be=yu(ae),be===pc||be===hc||be==="Kobo"||be==="Kindle Fire"||be===Sc?Wt:be===Or||be===Kt||be===Mr||be===vs?"Console":be===gc?"Wearable":be?Se:ce?.userAgentDataPlatform==="Android"&&((ut=ce?.maxTouchPoints)!==null&&ut!==void 0?ut:0)>0?600>Math.min((fe=ce?.screenWidth)!==null&&fe!==void 0?fe:0,(Oe=ce?.screenHeight)!==null&&Oe!==void 0?Oe:0)/((ct=ce?.devicePixelRatio)!==null&&ct!==void 0?ct:1)?Se:Wt:"Desktop"),$timezone:xl(),$timezone_offset:sf()}),{$current_url:Zr(M?ft(ie?.href):ie?.href,I,Nr),$host:ie?.host,$pathname:ie?.pathname,$raw_user_agent:xe.length>1e3?xe.substring(0,997)+"...":xe,$browser_version:fp(xe,navigator.vendor,N,q),$browser_language:Mu(),$browser_language_prefix:(oe=Mu(),typeof oe=="string"?oe.split("-")[0]:void 0),$screen_height:_?.screen.height,$screen_width:_?.screen.width,$viewport_height:_?.innerHeight,$viewport_width:_?.innerWidth,$lib:j.LIB_NAME,$lib_version:j.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return j.SDK_DIST_CHANNEL&&(Me.$sdk_dist_channel=j.SDK_DIST_CHANNEL),Me})(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){var d=this.sessionManager.checkAndGetSessionAndWindowId(s,n.getTime()),h=d.windowId;a.$session_id=d.sessionId,a.$window_id=h}this.sessionPropsManager&&K(a,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&K(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(f=this.vn)==null?void 0:f.length}catch(y){a.$sdk_debug_error_capturing_properties=String(y)}if(this.requestRouter.region===fo&&(a.$lib_custom_api_host=this.config.api_host),c=e!==Ht||s?e!==Bi||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,i),a=K(a,c),e===Ht&&P&&(a.title=P.title),!E(o)){var p=n.getTime()-o;a.$duration=parseFloat((p/1e3).toFixed(3))}xe&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser");var g=this.persistence.properties(),m=this.sessionPersistence.properties();B(["$referrer","$referring_domain"],(y=>{y in g&&delete m[y]})),(a=K({},l,g,m,a)).$is_identified=this._isIdentified(),O(this.config.property_denylist)?B(this.config.property_denylist,(function(y){delete a[y]})):$.error(Zl+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var v=this.config.sanitize_properties;v&&($.error(Gu),a=v(a,e));var w=this.Cn();return a.$process_person_profile=w,w&&!s&&this.Tn("_calculate_event_properties"),a}Sn(e,r,n){var i;if(r===void 0&&(r=!0),n===void 0&&(n=!1),!this.persistence||!this.Cn()||this.Xi&&!n)return e;var s=this.persistence.get_initial_props(),o=(i=this.sessionPropsManager)==null?void 0:i.getSetOnceProps(),a=K({},s,o||{},e||{}),u=this.config.sanitize_properties;return u&&($.error(Gu),a=u(a,"$set_once")),r&&(this.Xi=!0),pt(a)?void 0:a}register(e,r){var n;(n=this.persistence)==null||n.register(e,r)}register_once(e,r,n){var i;(i=this.persistence)==null||i.register_once(e,r,n)}register_for_session(e){var r;(r=this.sessionPersistence)==null||r.register(e)}unregister(e){var r;(r=this.persistence)==null||r.unregister(e)}unregister_for_session(e){var r;(r=this.sessionPersistence)==null||r.unregister(e)}In(e,r){this.register({[e]:r})}getFeatureFlag(e,r){var n;return(n=this.featureFlags)==null?void 0:n.getFeatureFlag(e,r)}getFeatureFlagPayload(e){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlagPayload(e)}getFeatureFlagResult(e,r){var n;return(n=this.featureFlags)==null?void 0:n.getFeatureFlagResult(e,r)}getAllFeatureFlags(){var e,r;return(e=(r=this.featureFlags)==null?void 0:r.getAllFeatureFlags())!==null&&e!==void 0?e:[]}isFeatureEnabled(e,r){var n,i;return(n=(i=this.featureFlags)==null?void 0:i.isFeatureEnabled(e,r))!==null&&n!==void 0?n:r?.defaultValue}reloadFeatureFlags(){var e;(e=this.featureFlags)==null||e.reloadFeatureFlags()}updateFlags(e,r,n){var i;(i=this.featureFlags)==null||i.updateFlags(e,r,n)}updateEarlyAccessFeatureEnrollment(e,r,n){var i;(i=this.featureFlags)==null||i.updateEarlyAccessFeatureEnrollment(e,r,n)}getEarlyAccessFeatures(e,r,n){var i;return r===void 0&&(r=!1),(i=this.featureFlags)==null?void 0:i.getEarlyAccessFeatures(e,r,n)}on(e,r){return this.en.on(e,r)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:yr}),()=>{})}onSessionId(e){var r,n;return(r=(n=this.sessionManager)==null?void 0:n.onSessionId(e))!==null&&r!==void 0?r:()=>{}}getSurveys(e,r){r===void 0&&(r=!1),this.surveys?this.surveys.getSurveys(e,r):e([],{isLoaded:!1,error:yr})}getActiveMatchingSurveys(e,r){r===void 0&&(r=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,r):e([],{isLoaded:!1,error:yr})}renderSurvey(e,r){var n;(n=this.surveys)==null||n.renderSurvey(e,r)}displaySurvey(e,r){var n;r===void 0&&(r=xf),(n=this.surveys)==null||n.displaySurvey(e,r)}cancelPendingSurvey(e){var r;(r=this.surveys)==null||r.cancelPendingSurvey(e)}canRenderSurvey(e){var r,n;return(r=(n=this.surveys)==null?void 0:n.canRenderSurvey(e))!==null&&r!==void 0?r:{visible:!1,disabledReason:yr}}canRenderSurveyAsync(e,r){var n,i;return r===void 0&&(r=!1),(n=(i=this.surveys)==null?void 0:i.canRenderSurveyAsync(e,r))!==null&&n!==void 0?n:Promise.resolve({visible:!1,disabledReason:yr})}Mn(e){return!e||fs(e)?($.critical("Unique user id has not been set in posthog.identify"),!1):e===sn?($.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||($.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(e,r,n){if(!this.__loaded||!this.persistence)return $.uninitializedWarning("posthog.identify");if(de(e)&&(e=e.toString(),$.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Mn(e)&&this.Tn("posthog.identify")){var i=this.get_distinct_id();this.register({$user_id:e}),this.get_property(zn)||this.register_once({$had_persisted_distinct_id:!0,$device_id:i},""),e!==i&&e!==this.get_property(kr)&&(this.unregister(kr),this.register({distinct_id:e}));var s,o=(this.persistence.get_property(Le)||Zt)===Zt;e!==i&&o?(this.persistence.set_property(Le,Nt),this.setPersonPropertiesForFlags({$set:r||{},$set_once:n||{}},!1),this.capture(Gi,{distinct_id:e,$anon_distinct_id:i},{$set:r||{},$set_once:n||{}}),this.sn=Uu(e,r,n),(s=this.featureFlags)==null||s.setAnonymousDistinctId(i)):(r||n)&&this.setPersonProperties(r,n),e!==i&&(this.reloadFeatureFlags(),this.unregister(zr))}}setPersonProperties(e,r){if((e||r)&&this.Tn("posthog.setPersonProperties")){var n=Uu(this.get_distinct_id(),e,r);this.sn!==n?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:r||{}},!0),this.capture("$set",{$set:e||{},$set_once:r||{}}),this.sn=n):$.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(e){var r,n=(O(e)?e:[e]).filter((i=>H(i)&&i.length>0));n.length!==0&&this.Tn("posthog.unsetPersonProperties")&&((r=this.featureFlags)==null||r.unsetPersonPropertiesForFlags(n,!0),this.capture("$set",{$unset:n}),this.sn=null)}group(e,r,n){if(e&&r){var i=this.getGroups(),s=i[e]!==r;if(s&&this.resetGroupPropertiesForFlags(e),this.register({$groups:x({},i,{[e]:r})}),s||n){var o={$group_type:e,$group_key:r};n&&(o.$group_set=n),this.capture($u,o)}n&&this.setGroupPropertiesForFlags({[e]:n}),s&&!n&&this.reloadFeatureFlags()}else $.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,r){var n;r===void 0&&(r=!0),(n=this.featureFlags)==null||n.setPersonPropertiesForFlags(e,r)}resetPersonPropertiesForFlags(e){var r;e===void 0&&(e=!0),(r=this.featureFlags)==null||r.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,r){var n;r===void 0&&(r=!0),this.Tn("posthog.setGroupPropertiesForFlags")&&((n=this.featureFlags)==null||n.setGroupPropertiesForFlags(e,r))}resetGroupPropertiesForFlags(e){var r;(r=this.featureFlags)==null||r.resetGroupPropertiesForFlags(e)}reset(e){var r,n,i,s,o,a,u,c,l,d;if($.info("reset"),!this.__loaded)return $.uninitializedWarning("posthog.reset");var h,f=this.get_property(zn),p=this.get_property(Hi),g=this.get_property(It);if(this.consent.reset(),(r=this.persistence)==null||r.clear(),(n=this.sessionPersistence)==null||n.clear(),E(g)||(h=this.persistence)==null||h.register({[It]:g}),(i=this.surveys)==null||i.reset(),(s=this.wn)==null||s.stop(),(o=this.featureFlags)==null||o.reset(),(a=this.conversations)==null||a.reset(),(u=this.logs)==null||u.reset(),(c=this.metrics)==null||c.reset(),(l=this.persistence)==null||l.set_property(Le,Zt),(d=this.sessionManager)==null||d.resetSessionId(),this.sn=null,this.config.cookieless_mode===it)this.register_once({distinct_id:sn,$device_id:null},"");else{var m=this.config.get_device_id(nt());this.register_once({distinct_id:m,$device_id:e?m:f},""),e||E(p)||this.register({[Hi]:p})}this.register({$last_posthog_reset:new Date().toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}shutdown(e){var r=this;return ne((function*(){var n,i,s,o,a;r.__loaded?((n=r.logs)==null||n.flushLogs("sendBeacon"),(i=r.metrics)==null||i.flush("sendBeacon"),(s=r.dn)==null||s.unload(),(o=r.vn)==null||o.unload(),(a=r.featureFlags)==null||a.destroy()):$.uninitializedWarning("posthog.shutdown")}))()}setIdentity(e,r){var n;this.config.identity_distinct_id=e,this.config.identity_hash=r,this.alias(e),(n=this.conversations)==null||n.En()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,(e=this.conversations)==null||e.Rn()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,r;return(e=(r=this.sessionManager)==null?void 0:r.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var r=this.sessionManager.checkAndGetSessionAndWindowId(!0),n=r.sessionStartTimestamp,i=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+r.sessionId);if(e!=null&&e.withTimestamp&&n){var s,o=(s=e.timestampLookBack)!==null&&s!==void 0?s:10;if(!n)return i;i+="?t="+Math.max(Math.floor((new Date().getTime()-n)/1e3)-o,0)}return i}alias(e,r){return e===this.get_property(Nc)?($.critical("Attempting to create alias for existing People user - aborting."),-2):this.Tn("posthog.alias")?(E(r)&&(r=this.get_distinct_id()),e!==r?(this.In(kr,e),this.capture("$create_alias",{alias:e,distinct_id:r})):($.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var r=x({},this.config);if(Y(e)){var n,i,s,o,a,u,c,l,d,h,f;K(this.config,Vu(e));var p=this.hn();(n=this.persistence)==null||n.update_config(this.config,r,p),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Cr(x({},this.config,{persistence:"sessionStorage"}),p,!1);var g=this.an(this.config.debug);Ne(g)&&(this.config.debug=g),Ne(this.config.debug)&&(this.config.debug?(j.DEBUG=!0,V.N()&&V.q("ph_debug",!0),$.info("set_config",{config:e,oldConfig:r,newConfig:x({},this.config)})):(j.DEBUG=!1,V.N()&&V.P("ph_debug"))),(i=this.exceptionObserver)==null||i.onConfigChange(),(s=this.exceptions)==null||s.onConfigChange(),(o=this.sessionRecording)==null||o.startIfEnabledOrStop(),(a=this.tracingHeaders)==null||a.startIfEnabledOrStop(),(u=this.autocapture)==null||u.startIfEnabled(),(c=this.heatmaps)==null||c.startIfEnabled(),(l=this.exceptionObserver)==null||l.startIfEnabledOrStop(),(d=this.deadClicksAutocapture)==null||d.startIfEnabledOrStop(),(h=this.surveys)==null||h.loadIfEnabled(),this.Pn(),(f=this.externalIntegrations)==null||f.startIfEnabledOrStop()}}_overrideSDKInfo(e,r){j.LIB_NAME=e,j.LIB_VERSION=r}startSessionRecording(e){var r,n,i,s,o,a=e===!0,u={sampling:a||!(e==null||!e.sampling),linked_flag:a||!(e==null||!e.linked_flag),url_trigger:a||!(e==null||!e.url_trigger),event_trigger:a||!(e==null||!e.event_trigger)};Object.values(u).some(Boolean)&&((r=this.sessionManager)==null||r.checkAndGetSessionAndWindowId(),u.sampling&&((n=this.sessionRecording)==null||n.overrideSampling()),u.linked_flag&&((i=this.sessionRecording)==null||i.overrideLinkedFlag()),u.url_trigger&&((s=this.sessionRecording)==null||s.overrideTrigger("url")),u.event_trigger&&((o=this.sessionRecording)==null||o.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,r){if(this.exceptions){var n=new Error("PostHog syntheticException"),i=this.exceptions.buildProperties(e,{handled:!0,syntheticException:n});return this.exceptions.sendExceptionEvent(x({},i,r))}}addExceptionStep(e,r){var n;(n=this.exceptions)==null||n.addExceptionStep(e,r)}captureLog(e){var r;(r=this.logs)==null||r.captureLog(e)}get logger(){var e,r;return(e=(r=this.logs)==null?void 0:r.logger)!==null&&e!==void 0?e:t.On}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var r,n;return(r=(n=this.toolbar)==null?void 0:n.loadToolbar(e))!==null&&r!==void 0&&r}get_property(e){var r;return(r=this.persistence)==null?void 0:r.props[e]}getSessionProperty(e){var r;return(r=this.sessionPersistence)==null?void 0:r.props[e]}toString(){var e,r=(e=this.config.name)!==null&&e!==void 0?e:Bt;return r!==Bt&&(r=Bt+"."+r),r}_isIdentified(){var e,r;return((e=this.persistence)==null?void 0:e.get_property(Le))===Nt||((r=this.sessionPersistence)==null?void 0:r.get_property(Le))===Nt}Cn(){var e,r;return!(this.config.person_profiles==="never"||this.config.person_profiles===Ks&&!this._isIdentified()&&pt(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[kr])&&((r=this.persistence)==null||(r=r.props)==null||!r[An]))}xn(){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.Cn()||this.Tn("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Tn("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Tn(e){return this.config.person_profiles==="never"?($.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.In(An,!0),!0)}hn(){if(this.config.cookieless_mode==="always")return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==Rt)}Pn(){var e,r,n,i,s=this.hn();return((e=this.persistence)==null?void 0:e.yr)!==s&&((n=this.persistence)==null||n.set_disabled(s)),((r=this.sessionPersistence)==null?void 0:r.yr)!==s&&((i=this.sessionPersistence)==null||i.set_disabled(s)),s}opt_in_capturing(e){var r;if(this.config.cookieless_mode!==it){if(this.Yi()){var n,i,s,o,a;this.reset(!0),(n=this.sessionManager)==null||n.destroy(),(i=this.pageViewManager)==null||i.destroy(),this.sessionManager=new Vn(this),this.pageViewManager=new Zn(this),this.persistence&&(this.sessionPropsManager=new Gn(this,this.sessionManager,this.persistence));var u,c=(s=(o=this.config.__extensionClasses)==null?void 0:o.sessionRecording)!==null&&s!==void 0?s:(a=t.__defaultExtensionClasses)==null?void 0:a.sessionRecording;c&&(this.sessionRecording=this.Ji(this.sessionRecording,new c(this)),this.yn&&((u=this.sessionRecording)==null||u.onRemoteConfig==null||u.onRemoteConfig(this.yn)))}var l,d;this.consent.optInOut(!0),this.Pn(),this.bn(),(r=this.sessionRecording)==null||r.startIfEnabledOrStop(),this.config.cookieless_mode==Rt&&((l=this.surveys)==null||l.loadIfEnabled()),(E(e?.captureEventName)||e!=null&&e.captureEventName)&&this.capture((d=e?.captureEventName)!==null&&d!==void 0?d:"$opt_in",e?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._n()}else $.warn(Bu)}opt_out_capturing(){var e,r,n;this.config.cookieless_mode!==it?(this.config.cookieless_mode===Rt&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.Pn(),this.config.cookieless_mode===Rt&&(this.register({distinct_id:sn,$device_id:null}),(e=this.sessionRecording)==null||e.stopRecording(),this.sessionRecording=void 0,(r=this.sessionManager)==null||r.destroy(),(n=this.pageViewManager)==null||n.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this._n(),this.bn())):$.warn(Bu)}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===1?"granted":e===0?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===it||(this.config.cookieless_mode===Rt?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Pn()}_is_bot(){return _e?Cl(_e,this.config.custom_blocked_useragents):void 0}_n(){P&&(P.visibilityState==="visible"?this.tn||(this.tn=!0,this.capture(Ht,{title:P.title},{send_instantly:!0}),this.rn&&(P.removeEventListener(On,this.rn),this.rn=null)):this.rn||(this.rn=this._n.bind(this),re(P,On,this.rn)))}debug(e){e===!1?(_?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(_?.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}))}Ur(){var e=this.ln||{};return"advanced_disable_flags"in e?!!e.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?($.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(function(r,n,i,s,o){var a=n in r&&!F(r[n]),u=i in r&&!F(r[i]);return a?r[n]:!!u&&(o&&o.warn("Config field '"+i+"' is deprecated. Please use '"+n+"' instead. The old field will be removed in a future major version."),r[i])})(e,"advanced_disable_flags","advanced_disable_decide",0,$)}wt(e){var r;if(F(this.config.before_send))return e;var n=Object.keys((r=e.properties)!==null&&r!==void 0?r:{}).filter(np),i=O(this.config.before_send)?this.config.before_send:[this.config.before_send],s=e;for(var o of i){if(s=o(s),F(s)){var a="Event '"+e.event+"' was rejected in beforeSend function";return rp(e.event)?$.warn(a+". This can cause unexpected behavior."):$.info(a),null}s.properties&&!pt(s.properties)||$.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}for(var u of n)if(s.properties&&F(s.properties[u]))return $.warn("Event '"+e.event+"' had its '"+u+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return s}getPageViewId(){var e;return(e=this.pageViewManager.ir)==null?void 0:e.pageViewId}captureTraceFeedback(e,r){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:r})}captureTraceMetric(e,r,n){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:r,$ai_metric_value:String(n)})}an(e){var r=Ne(e)&&!e,n=V.N()&&V.A("ph_debug")==="true";return!r&&(!!n||e)}};Ot.__defaultExtensionClasses={},Ot.On=(()=>{var t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),(function(t,e){for(var r=0;e.length>r;r++)t.prototype[e[r]]=Op(t.prototype[e[r]])})(Ot,["identify"]);var Wn=class{constructor(e){this.disabled=e===!1;var r=Y(e)?e:{};this.thresholdPx=r.threshold_px||30,this.timeoutMs=r.timeout_ms||1e3,this.clickCount=r.click_count||3,this.clicks=[]}isRageClick(e,r,n){if(this.disabled)return!1;var i=this.clicks[this.clicks.length-1];if(i&&Math.abs(e-i.x)+Math.abs(r-i.y)<this.thresholdPx&&this.timeoutMs>n-i.timestamp){if(this.clicks.push({x:e,y:r,timestamp:n}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:r,timestamp:n}];return!1}},ns="$copy_autocapture",is=X("[AutoCapture]");function ss(t,e){return e.length>t?e.slice(0,t)+"...":e}function Sf(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do e=e.previousSibling;while(e&&!gt(e));return e}function Pf(t,e){var r,n,i=e.e,s=e.maskAllElementAttributes,o=e.maskAllText,a=e.elementAttributeIgnoreList,u=e.elementsChainAsString,c=e.disableCaptureUrlHashes;if(!gt(t))return{props:{}};for(var l=[t],d=new Set([t]),h=t;h.parentNode&&!$e(h,"body")&&rl>l.length;)if(tl(h.parentNode)){var f=h.parentNode.host;if(d.has(f))break;d.add(f),l.push(f),h=f}else{if(!gt(h.parentNode)||d.has(h.parentNode))break;d.add(h.parentNode),l.push(h.parentNode),h=h.parentNode}var p,g,m=[],v={},w=!1,y=!1;if(B(l,(b=>{var S=eo(b);if($e(b,"a")){var z=b.getAttribute("href");w=!!(S&&z&&Rr(z))&&(c?ft(z):z)}A(Fn(b),"ph-no-capture")&&(y=!0),m.push((function(I,Z,Q,G,N){N===void 0&&(N=!1);var q=I.tagName.toLowerCase(),J={tag_name:q};Mo.indexOf(q)>-1&&!Q&&(J.$el_text=q.toLowerCase()==="a"||q.toLowerCase()==="button"?ss(1024,Au(I)):ss(1024,Lr(I)));var we=Fn(I);we.length>0&&(J.classes=we.filter((function(ee){return ee!==""}))),B(I.attributes,(function(ee){var oe;if((!al(I)||["name","id","class","aria-label"].indexOf(ee.name)!==-1)&&(G==null||!G.includes(ee.name))&&!Z&&Rr(ee.value)&&(!H(oe=ee.name)||oe.substring(0,10)!=="_ngcontent"&&oe.substring(0,7)!=="_nghost")){var ae=ee.value;ee.name==="class"&&(ae=Oo(ae).join(" ")),J["attr__"+ee.name]=ss(1024,ee.name==="href"&&N?ft(ae):ae)}}));for(var Pe=1,ye=1,ke=I;ke=Sf(ke);)Pe++,ke.tagName===I.tagName&&ye++;return J.nth_child=Pe,J.nth_of_type=ye,J})(b,s,o,a,c));var L=(function(I){if(!eo(I))return{};var Z={};return B(I.attributes,(function(Q){if(Q.name&&Q.name.indexOf("data-ph-capture-attribute")===0){var G=Q.name.replace("data-ph-capture-attribute-",""),N=Q.value;G&&N&&Rr(N)&&(Z[G]=N)}})),Z})(b);K(v,L)})),y)return{props:{},explicitNoCapture:y};if(o||(m[0].$el_text=$e(t,"a")||$e(t,"button")?Au(t):Lr(t)),w){var k,T;m[0].attr__href=w;var M=(k=Nn(w))==null?void 0:k.host,R=_==null||(T=_.location)==null?void 0:T.host;M&&R&&M!==R&&(p=w)}return{props:K({$event_type:i.type,$ce_version:1},u?{}:{$elements:m},{$elements_chain:(g=m,(function(b){return b.map((S=>{var z,L,I="";if(S.tag_name&&(I+=S.tag_name),S.attr_class)for(var Z of(S.attr_class.sort(),S.attr_class))I+="."+Z.replace(/"/g,"");var Q=x({},S.text?{text:S.text}:{},{"nth-child":(z=S.nth_child)!==null&&z!==void 0?z:0,"nth-of-type":(L=S.nth_of_type)!==null&&L!==void 0?L:0},S.href?{href:S.href}:{},S.attr_id?{attr_id:S.attr_id}:{},S.attributes),G={};return vn(Q).sort(((N,q)=>N[0].localeCompare(q[0]))).forEach((N=>{var q=N[1];return G[Ou(N[0].toString())]=Ou(q.toString())})),(I+=":")+vn(G).map((N=>N[0]+'="'+N[1]+'"')).join("")})).join(";")})((function(b){return b.map((S=>{var z,L,I={text:(z=S.$el_text)==null?void 0:z.slice(0,400),tag_name:S.tag_name,href:(L=S.attr__href)==null?void 0:L.slice(0,2048),attr_class:Yp(S),attr_id:S.attr__id,nth_child:S.nth_child,nth_of_type:S.nth_of_type,attributes:{}};return vn(S).filter((Z=>Z[0].indexOf("attr__")===0)).forEach((Z=>I.attributes[Z[0]]=Z[1])),I}))})(g)))},(r=m[0])!=null&&r.$el_text?{$el_text:(n=m[0])==null?void 0:n.$el_text}:{},p&&i.type==="click"?{$external_click_url:p}:{},v)}}var br=X("[ExceptionAutocapture]"),qu=()=>{},Tf=X("[TracingHeaders]"),$t=X("[Web Vitals]"),Ku=9e5,Wu="disabled",Ju="lazy_loading",xr="awaiting_config",dn="missing_config";X("[SessionRecording]"),X("[SessionRecording]");var mo="[SessionRecording]",Xe=X(mo),zf=X("[Heatmaps]");function os(t){return Y(t)&&"clientX"in t&&"clientY"in t&&de(t.clientX)&&de(t.clientY)}var as=X("[Product Tours]"),us=t=>{var e;return!t.config.disable_product_tours&&!((e=t.persistence)==null||!e.get_property(Ro))},Rf=["$set_once","$set"],Be=X("[SiteApps]"),Yu="Error while initializing PostHog app with config id ";function jt(t,e,r){if(F(t))return!1;switch(r){case"exact":return t===e;case"contains":var n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(n,"i").test(t);case"regex":try{return new RegExp(e).test(t)}catch{return!1}default:return!1}}var yo=class{constructor(e){this.Fn=new Dr,this.Ln=(r,n)=>this.$n(r,n)&&this.An(r,n)&&this.Nn(r,n)&&this.Dn(r,n),this.$n=(r,n)=>n==null||!n.event||r?.event===n?.event,this._instance=e,this.qn=new Set,this.jn=new Set}init(){var e,r;E((e=this._instance)==null?void 0:e._addCaptureHook)||(r=this._instance)==null||r._addCaptureHook(((n,i)=>{this.on(n,i)}))}register(e){var r,n;if(!E((r=this._instance)==null?void 0:r._addCaptureHook)&&(e.forEach((o=>{var a,u;(a=this.jn)==null||a.add(o),(u=o.steps)==null||u.forEach((c=>{var l;(l=this.qn)==null||l.add(c?.event||"")}))})),(n=this._instance)!=null&&n.autocapture)){var i,s=new Set;e.forEach((o=>{var a;(a=o.steps)==null||a.forEach((u=>{u!=null&&u.selector&&s.add(u?.selector)}))})),(i=this._instance)==null||i.autocapture.setElementSelectors(s)}}on(e,r){var n;r!=null&&e.length!=0&&(this.qn.has(e)||this.qn.has(r.event))&&this.jn&&((n=this.jn)==null?void 0:n.size)>0&&this.jn.forEach((i=>{this.Hn(r,i)&&this.Fn.emit("actionCaptured",i.name)}))}Bn(e){this.onAction("actionCaptured",(r=>e(r)))}Hn(e,r){if(r?.steps==null)return!1;for(var n of r.steps)if(this.Ln(e,n))return!0;return!1}onAction(e,r){return this.Fn.on(e,r)}An(e,r){if(r!=null&&r.url){var n,i=e==null||(n=e.properties)==null?void 0:n.$current_url;if(!i||typeof i!="string"||!jt(i,r.url,r.url_matching||"contains"))return!1}return!0}Nn(e,r){return!!this.Un(e,r)&&!!this.zn(e,r)&&!!this.Vn(e,r)}Un(e,r){var n;if(r==null||!r.href)return!0;var i=this.Wn(e);if(i.length>0)return i.some((a=>jt(a.href,r.href,r.href_matching||"exact")));var s,o=(e==null||(n=e.properties)==null?void 0:n.$elements_chain)||"";return!!o&&jt((s=o.match(/(?::|")href="(.*?)"/))?s[1]:"",r.href,r.href_matching||"exact")}zn(e,r){var n;if(r==null||!r.text)return!0;var i=this.Wn(e);if(i.length>0)return i.some((c=>jt(c.text,r.text,r.text_matching||"exact")||jt(c.$el_text,r.text,r.text_matching||"exact")));var s,o,a,u=(e==null||(n=e.properties)==null?void 0:n.$elements_chain)||"";return!!u&&(s=(function(c){for(var l,d=[],h=/(?::|")text="(.*?)"/g;!F(l=h.exec(c));)d.includes(l[1])||d.push(l[1]);return d})(u),o=r.text,a=r.text_matching||"exact",s.some((c=>jt(c,o,a))))}Vn(e,r){var n,i;if(r==null||!r.selector)return!0;var s=e==null||(n=e.properties)==null?void 0:n.$element_selectors;if(s!=null&&s.includes(r.selector))return!0;var o=(e==null||(i=e.properties)==null?void 0:i.$elements_chain)||"";if(r.selector_regex&&o)try{return new RegExp(r.selector_regex).test(o)}catch{return!1}return!1}Wn(e){var r;return(e==null||(r=e.properties)==null?void 0:r.$elements)==null?[]:e?.properties.$elements}Dn(e,r){return r==null||!r.properties||r.properties.length===0||Ol(r.properties.reduce(((n,i)=>{var s=O(i.value)?i.value.map(String):i.value!=null?[String(i.value)]:[];return n[i.key]={values:s,operator:i.operator||"exact"},n}),{}),e?.properties)}},bo=class{constructor(e){var r;this.Zn=[],this._instance=e,this.Gn=new Map,this.Qn=new Map,this.Jn=new Map,(r=this._instance)==null||r.onSessionId==null||r.onSessionId((n=>this.Kn(n)))}Yn(e,r){return!!e&&Ol(e.propertyFilters,r?.properties)}Xn(e,r){var n=new Map;return e.forEach((i=>{var s;(s=i.conditions)==null||(s=s[r])==null||(s=s.values)==null||s.forEach((o=>{if(o!=null&&o.name){var a=n.get(o.name)||[];a.push(i.id),n.set(o.name,a)}}))})),n}es(e,r,n){var i=(n===fr.Activation?this.Gn:this.Qn).get(e),s=[];return this.ts((o=>{s=o.filter((a=>i?.includes(a.id)))})),s.filter((o=>{var a,u=(a=o.conditions)==null||(a=a[n])==null||(a=a.values)==null?void 0:a.find((c=>c.name===e));return this.Yn(u,r)}))}register(e){var r;E((r=this._instance)==null?void 0:r._addCaptureHook)||(this.rs(e),this.ns(e))}ns(e){var r=e.filter((n=>{var i,s;return((i=n.conditions)==null?void 0:i.actions)&&((s=n.conditions)==null||(s=s.actions)==null||(s=s.values)==null?void 0:s.length)>0}));r.length!==0&&(this.ss==null&&(this.ss=new yo(this._instance),this.ss.init(),this.ss.Bn((n=>{this.onAction(n)}))),r.forEach((n=>{var i,s,o,a,u;n.conditions&&(i=n.conditions)!=null&&i.actions&&(s=n.conditions)!=null&&(s=s.actions)!=null&&s.values&&((o=n.conditions)==null||(o=o.actions)==null||(o=o.values)==null?void 0:o.length)>0&&((a=this.ss)==null||a.register(n.conditions.actions.values),(u=n.conditions)==null||(u=u.actions)==null||(u=u.values)==null||u.forEach((c=>{if(c&&c.name){var l=this.Jn.get(c.name);l&&l.push(n.id),this.Jn.set(c.name,l||[n.id])}})))})))}rs(e){var r,n=e.filter((s=>{var o,a;return((o=s.conditions)==null?void 0:o.events)&&((a=s.conditions)==null||(a=a.events)==null||(a=a.values)==null?void 0:a.length)>0})),i=e.filter((s=>{var o,a;return((o=s.conditions)==null?void 0:o.cancelEvents)&&((a=s.conditions)==null||(a=a.cancelEvents)==null||(a=a.values)==null?void 0:a.length)>0}));n.length===0&&i.length===0||((r=this._instance)==null||r._addCaptureHook(((s,o)=>{this.onEvent(s,o)})),this.Gn=this.Xn(e,fr.Activation),this.Qn=this.Xn(e,fr.Cancellation))}onEvent(e,r){var n,i,s=this.os(),o=(r==null||(n=r.properties)==null?void 0:n.$survey_id)||(r==null||(i=r.properties)==null?void 0:i.$product_tour_id);if(o&&this.getActivatedIds().includes(o)){var a=this.ls(e,o);if(a==="consume")return s.info("event consumed activated item, removing it",{event:e,itemId:o}),void this.us([o]);if(a==="persist")return s.info("shown item promoted to persisted activation",{event:e,itemId:o}),void this.hs(o)}if(this.Qn.has(e)){var u=this.es(e,r,fr.Cancellation);u.length>0&&(s.info("cancel event matched, cancelling items",{event:e,itemsToCancel:u.map((l=>l.id))}),this.us(u.map((l=>l.id))),u.forEach((l=>this.ds(l.id))))}if(this.Gn.has(e)){s.info("event name matched",{event:e,eventPayload:r,items:this.Gn.get(e)});var c=this.es(e,r,fr.Activation);this.cs(c.map((l=>l.id)))}}onAction(e){this.Jn.has(e)&&this.cs(this.Jn.get(e)||[])}cs(e){e.length!==0&&(this.Zn=[...new Set([...this.Zn,...e])],this.os().info("updating activated items",{activatedItems:this.getActivatedIds()}))}hs(e){this.Zn=this.Zn.filter((n=>n!==e));var r=this.vs();r.includes(e)||(this.fs([...r,e]),this.ps())}us(e){var r=new Set(e);this.Zn=this.Zn.filter((s=>!r.has(s)));var n=this.gs(),i=n.filter((s=>!r.has(s)));i.length!==n.length&&(this.fs(i),i.length===0&&this.ys())}gs(){var e,r=this.bs();return((e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[r])||[]}vs(){var e,r,n=this.gs();if(n.length===0)return[];var i=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[this._s()],s=(r=this._instance)==null||r.get_session_id==null?void 0:r.get_session_id();return s&&i===s?n:[]}ps(){var e,r=(e=this._instance)==null||e.get_session_id==null?void 0:e.get_session_id();r&&this.ws(r)}ys(){this.xs()}Kn(e){var r,n=(r=this._instance)==null||(r=r.persistence)==null?void 0:r.props[this._s()];n&&n!==e&&(this.gs().length>0&&this.fs([]),this.ys())}getActivatedIds(){return[...new Set([...this.vs(),...this.Zn])].filter((e=>!this.ks(e)))}reset(){this.Zn=[],this.gs().length>0&&this.fs([]),this.ys()}getEventToItemsMap(){return this.Gn}Ss(){return this.ss}},xo=class extends bo{constructor(e){super(e)}bs(){return js}_s(){return _n}Cs(){return ot.SHOWN}ts(e){var r;(r=this._instance)==null||r.getSurveys(e)}ds(e){var r;(r=this._instance)==null||r.cancelPendingSurvey(e)}os(){return U}fs(e){var r;(r=this._instance)==null||(r=r.persistence)==null||r.register({[js]:e})}ws(e){var r;(r=this._instance)==null||(r=r.persistence)==null||r.register({[_n]:e})}xs(){var e;(e=this._instance)==null||(e=e.persistence)==null||e.unregister(_n)}ks(){return!1}ls(e,r){var n;this.ts((s=>{n=s.find((o=>o.id===r))}));var i=!n||(function(s){var o;return Ml(s)&&!((o=s.conditions)==null||(o=o.events)==null||!o.repeatedActivation)||s.schedule==="always"})(n);return i?e===ot.SHOWN?"consume":"ignore":e===ot.SHOWN?"persist":e===ot.DISMISSED||e===ot.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},hn="SDK is not enabled or survey functionality is not yet loaded",Xu="Disabled. Not loading surveys.",Cf=_!=null&&_.location?Dn(_.location.hash,"__posthog")||Dn(location.hash,"state"):null,Qu="_postHogToolbarParams",ec=X("[Toolbar]"),se=X("[FeatureFlags]"),St=X("[FeatureFlags]",{debugEnabled:!0}),cs=`" failed. Feature flags didn't load in time.`,tc=t=>{for(var e={},r=0;t.length>r;r++)e[t[r]]=!0;return e},rc=t=>{var e={};for(var r of vn(t||{})){var n=r[1];n&&(e[r[0]]=n)}return e},Qe=X("[Error tracking]"),nc="Refusing to render web experiment since the viewer is a likely bot",If={icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())===-1,regex:(t,e)=>qn(e,t),not_regex:(t,e)=>!qn(e,t),exact:(t,e)=>e===t,is_not:(t,e)=>e!==t},wo=class t{get Te(){return this._instance.config}constructor(e){var r=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(n){n===void 0&&(n=!1),r.getWebExperiments((i=>{t.Ts("retrieved web experiments from the server"),r.Is=new Map,i.forEach((s=>{if(s.feature_flag_key){var o;r.Is&&(t.Ts("setting flag key ",s.feature_flag_key," to web experiment ",s),(o=r.Is)==null||o.set(s.feature_flag_key,s));var a=r._instance.getFeatureFlag(s.feature_flag_key);H(a)&&s.variants[a]&&r.Ms(s.name,a,s.variants[a].transforms)}else if(s.variants)for(var u in s.variants){var c=s.variants[u];t.Es(c,r._instance)&&r.Ms(s.name,u,c.transforms)}}))}),n)},this._instance=e,this._instance.onFeatureFlags((n=>{this.onFeatureFlags(n)}))}initialize(){}onFeatureFlags(e){if(this._is_bot())t.Ts(nc);else if(!this.Te.disable_web_experiments){if(F(this.Is))return this.Is=new Map,this.loadIfEnabled(),void this.previewWebExperiment();t.Ts("applying feature flags",e),e.forEach((r=>{var n;if(this.Is&&(n=this.Is)!=null&&n.has(r)){var i,s=this._instance.getFeatureFlag(r),o=(i=this.Is)==null?void 0:i.get(r);s&&o!=null&&o.variants[s]&&this.Ms(o.name,s,o.variants[s].transforms)}}))}}previewWebExperiment(){var e=t.getWindowLocation();if(e!=null&&e.search){var r=Xt(e?.search,"__experiment_id"),n=Xt(e?.search,"__experiment_variant");r&&n&&(t.Ts("previewing web experiments "+r+" && "+n),this.getWebExperiments((i=>{this.Rs(parseInt(r),n,i)}),!1,!0))}}loadIfEnabled(){this.Te.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,r,n){if(this.Te.disable_web_experiments&&!n)return e([]);var i=this._instance.get_property("$web_experiments");if(i&&!r)return e(i);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Te.token),method:"GET",timestampMode:"query",callback:s=>e(s.statusCode===200&&s.json&&s.json.experiments||[])})}Rs(e,r,n){var i=n.filter((s=>s.id===e));i&&i.length>0&&(t.Ts("Previewing web experiment ["+i[0].name+"] with variant ["+r+"]"),this.Ms(i[0].name,r,i[0].variants[r].transforms))}static Es(e,r){return!F(e.conditions)&&t.Ps(e,r)&&t.Os(e)}static Ps(e,r){var n;if(F(e.conditions)||F((n=e.conditions)==null?void 0:n.url))return!0;var i=t.getWindowLocation();if(i){var s,o,a,u=Xc(r,i.href);return(s=e.conditions)==null||!s.url||If[(o=(a=e.conditions)==null?void 0:a.urlMatchType)!==null&&o!==void 0?o:"icontains"](e.conditions.url,u)}return!1}static getWindowLocation(){return _?.location}static Os(e){var r;if(F(e.conditions)||F((r=e.conditions)==null?void 0:r.utm))return!0;var n=gl();if(n.utm_source){var i,s,o,a,u,c,l,d,h=(i=e.conditions)==null||(i=i.utm)==null||!i.utm_campaign||((s=e.conditions)==null||(s=s.utm)==null?void 0:s.utm_campaign)==n.utm_campaign,f=(o=e.conditions)==null||(o=o.utm)==null||!o.utm_source||((a=e.conditions)==null||(a=a.utm)==null?void 0:a.utm_source)==n.utm_source,p=(u=e.conditions)==null||(u=u.utm)==null||!u.utm_medium||((c=e.conditions)==null||(c=c.utm)==null?void 0:c.utm_medium)==n.utm_medium,g=(l=e.conditions)==null||(l=l.utm)==null||!l.utm_term||((d=e.conditions)==null||(d=d.utm)==null?void 0:d.utm_term)==n.utm_term;return h&&p&&g&&f}return!1}static Ts(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;r>i;i++)n[i-1]=arguments[i];$.info("[WebExperiments] "+e,n)}Ms(e,r,n){this._is_bot()?t.Ts(nc):r!=="control"?n.forEach((i=>{if(i.selector){var s;t.Ts("applying transform of variant "+r+" for experiment "+e+" ",i);var o=(s=document)==null?void 0:s.querySelectorAll(i.selector);o?.forEach((a=>{var u=a;i.html&&(u.innerHTML=i.html),i.css&&u.setAttribute("style",i.css)}))}})):t.Ts("Control variants leave the page unmodified.")}_is_bot(){return _e&&this._instance?Cl(_e,this.Te.custom_blocked_useragents):void 0}},Ie=X("[Conversations]"),Pt="Conversations not available yet.",ic="console",Xn={featureFlags:class{constructor(t){this.Fs=!1,this.Ls=!1,this.$s=!1,this.As=!1,this.Ns=!1,this.Ds=!1,this.qs=!1,this.js=!1,this.Hs=0,this.Bs=()=>{var e=this.Us();this.Hs=0,e&&this.reloadFeatureFlags()},this._instance=t,this.featureFlagEventHandlers=[],_&&re(_,"online",this.Bs)}destroy(){_?.removeEventListener("online",this.Bs)}get Te(){return this._instance.config}get mi(){return this._instance.persistence}zs(t){return this._instance.get_property(t)}Vs(){var t,e;return(t=(e=this.mi)==null?void 0:e._r(this.Te.feature_flag_cache_ttl_ms))!==null&&t!==void 0&&t}Ws(){return!!this.Vs()&&(this.js||this.$s||(this.js=!0,se.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Zs(){var t,e=(t=this.Te.evaluation_contexts)!==null&&t!==void 0?t:this.Te.evaluation_environments;return!this.Te.evaluation_environments||this.Te.evaluation_contexts||this.qs||(se.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.qs=!0),e!=null&&e.length?e.filter((r=>{var n=r&&typeof r=="string"&&r.trim().length>0;return n||se.error("Invalid evaluation context found:",r,"Expected non-empty string"),n})):[]}Gs(){return this.Zs().length>0}Qs(){var t=this.Te.flag_keys;if(!E(t)){if(O(t))return t.filter((e=>{var r=e&&typeof e=="string"&&e.trim().length>0;return r||se.error("Invalid flag key found:",e,"Expected non-empty string"),r}));se.error("Invalid flag_keys found:",t,"Expected array of non-empty strings")}}initialize(){var t,e,r=this._instance.config,n=(t=(e=r.bootstrap)==null?void 0:e.featureFlags)!==null&&t!==void 0?t:{};if(Object.keys(n).length){var i,s,o=(i=(s=r.bootstrap)==null?void 0:s.featureFlagPayloads)!==null&&i!==void 0?i:{},a=Object.keys(n).filter((c=>!!n[c])).reduce(((c,l)=>(c[l]=n[l]||!1,c)),{}),u=Object.keys(o).filter((c=>a[c])).reduce(((c,l)=>(o[l]&&(c[l]=o[l]),c)),{});this.receivedFeatureFlags({featureFlags:a,featureFlagPayloads:u})}}updateFlags(t,e,r){var n,i,s=r!=null&&r.merge&&(n=this.zs(Ct))!==null&&n!==void 0?n:{},o=r!=null&&r.merge&&(i=this.zs(gn))!==null&&i!==void 0?i:{},a=x({},s,t),u=x({},o,e),c={};for(var l of Object.entries(a)){var d=l[0],h=l[1];c[d]={key:d,enabled:du(h),variant:hu(h),reason:void 0,metadata:E(u?.[d])?void 0:{id:0,version:void 0,description:void 0,payload:u[d]}}}this.receivedFeatureFlags({flags:c})}get hasLoadedFlags(){return this.Ls}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.zs(Zs),e=this.zs(tt),r=this.zs(Ut);if(!r&&!e)return t||{};var n=K({},t||{}),i=[...new Set([...Object.keys(r||{}),...Object.keys(e||{})])];for(var s of i){var o,a,u=n[s],c=e?.[s],l=E(c)?(o=u?.enabled)!==null&&o!==void 0&&o:!!c,d=E(c)?u.variant:typeof c=="string"?c:void 0,h=r?.[s],f=x({},u,{enabled:l,variant:l?d??u?.variant:void 0});l!==u?.enabled&&(f.original_enabled=u?.enabled),d!==u?.variant&&(f.original_variant=u?.variant),h&&(f.metadata=x({},u?.metadata,{payload:h,original_payload:u==null||(a=u.metadata)==null?void 0:a.payload})),n[s]=f}return this.Fs||(se.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:r,finalDetails:n}),this.Fs=!0),n}getAllFeatureFlags(){var t=this.getFlagVariants(),e=this.getFlagPayloads();return Object.keys(t).map((r=>{var n=t[r];return{key:r,enabled:du(n),variant:hu(n),payload:lu(e[r])}}))}getFlagVariants(){var t=this.zs(Ct),e=this.zs(tt);if(!e)return t||{};for(var r=K({},t),n=Object.keys(e),i=0;n.length>i;i++)r[n[i]]=e[n[i]];return this.Fs||(se.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:r}),this.Fs=!0),r}getFlagPayloads(){var t=this.zs(gn),e=this.zs(Ut);if(!e)return t||{};for(var r=K({},t||{}),n=Object.keys(e),i=0;n.length>i;i++)r[n[i]]=e[n[i]];return this.Fs||(se.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:r}),this.Fs=!0),r}reloadFeatureFlags(){this.As||this.Te.advanced_disable_feature_flags||this.Us()||this.Js||(this._instance.en.emit("featureFlagsReloading",!0),this.Js=setTimeout((()=>{this.Ks()}),5))}Ys(){clearTimeout(this.Js),this.Js=void 0}ensureFlagsLoaded(){this.Ls||this.$s||this.Js||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.As=t}Ks(t){var e;if(this.Ys(),!this._instance.Ur()&&!this.Us())if(this.$s)this.Ns=!0;else{var r=this.Te.token,n=this.zs(zn),i={token:r,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:x({},((e=this.mi)==null?void 0:e.get_initial_props())||{},this.zs(Tt)||{},{$lib:j.LIB_NAME,$lib_version:j.LIB_VERSION}),group_properties:this.zs(zt),timezone:xl()};me(n)||E(n)||(i.$device_id=n),(t!=null&&t.disableFlags||this.Te.advanced_disable_feature_flags)&&(i.disable_flags=!0),this.Gs()&&(i.evaluation_contexts=this.Zs());var s=this.Qs();E(s)||(i.flag_keys=s);var o=!!this.Te.advanced_only_evaluate_survey_feature_flags,a=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Te.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.$s=!0,this._instance._send_request({method:"POST",url:a,data:i,compression:this.Te.disable_compression?void 0:ge.Base64,timestampMode:"body",timeout:this.Te.feature_flag_request_timeout_ms,callback:u=>{var c,l,d,h=!0;if(this.Xs(u.statusCode),u.statusCode===200&&(this.Ns||(this.$anon_distinct_id=void 0),h=!1),this.$s=!1,!i.disable_flags||this.Ns){this.Ds=!h;var f=[];u.error?u.error instanceof Error?f.push(u.error.name==="AbortError"?"timeout":"connection_error"):f.push("unknown_error"):u.statusCode!==200&&f.push("api_error_"+u.statusCode),(c=u.json)!=null&&c.errorsWhileComputingFlags&&f.push("errors_while_computing_flags");var p,g=!((l=u.json)==null||(l=l.quotaLimited)==null||!l.includes("feature_flags"));g&&f.push("quota_limited"),(d=this.mi)==null||d.register({[Hs]:f}),g?se.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):(i.disable_flags||this.receivedFeatureFlags((p=u.json)!==null&&p!==void 0?p:{},h,{partialResponse:o}),this.Ns&&(this.Ns=!1,this.Ks()))}}})}}Us(){return pl(this.Hs,3)}Xs(t){this.Hs=fl(t,this.Hs,3,(()=>se.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes.")))}getFeatureFlag(t,e){var r;if(e===void 0&&(e={}),!e.fresh||this.Ds)if(this.Ls||this.getFlags()&&this.getFlags().length>0){if(!this.Ws()){var n=this.getFeatureFlagResult(t,e);return(r=n?.variant)!==null&&r!==void 0?r:n?.enabled}}else se.warn('getFeatureFlag for key "'+t+cs)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var e=this.getFeatureFlagResult(t,{send_event:!1});return e?.payload}getFeatureFlagResult(t,e){if(e===void 0&&(e={}),!e.fresh||this.Ds)if(this.Ls||this.getFlags()&&this.getFlags().length>0){if(!this.Ws()){var r=this.getFlagVariants(),n=t in r,i=r[t],s=this.getFlagPayloads()[t],o=String(i),a=this.zs(Ns)||void 0,u=this.zs(Fr)||void 0,c=this.zs(zr)||{};if(this.Te.advanced_feature_flags_dedup_per_session){var l,d=this._instance.get_session_id(),h=this.zs(Us);d&&d!==h&&(c={},(l=this.mi)==null||l.register({[zr]:c,[Us]:d}))}if((e.send_event||!("send_event"in e))&&(!(t in c)||!c[t].includes(o))){var f,p,g,m,v,w,y,k,T,M,R;O(c[t])?c[t].push(o):c[t]=[o],(f=this.mi)==null||f.register({[zr]:c});var b=this.getFeatureFlagDetails(t),S=[...(p=this.zs(Hs))!==null&&p!==void 0?p:[]];E(i)&&S.push("flag_missing");var z={$feature_flag:t,$feature_flag_response:i,$feature_flag_payload:s||null,$feature_flag_request_id:a,$feature_flag_evaluated_at:u,$feature_flag_bootstrapped_response:((g=this.Te.bootstrap)==null||(g=g.featureFlags)==null?void 0:g[t])||null,$feature_flag_bootstrapped_payload:((m=this.Te.bootstrap)==null||(m=m.featureFlagPayloads)==null?void 0:m[t])||null,$used_bootstrap_value:!this.Ds};E(b==null||(v=b.metadata)==null?void 0:v.has_experiment)||(z.$feature_flag_has_experiment=b.metadata.has_experiment),E(b==null||(w=b.metadata)==null?void 0:w.version)||(z.$feature_flag_version=b.metadata.version);var L,I=(y=b==null||(k=b.reason)==null?void 0:k.description)!==null&&y!==void 0?y:b==null||(T=b.reason)==null?void 0:T.code;I&&(z.$feature_flag_reason=I),b!=null&&(M=b.metadata)!=null&&M.id&&(z.$feature_flag_id=b.metadata.id),E(b?.original_variant)&&E(b?.original_enabled)||(z.$feature_flag_original_response=E(b.original_variant)?b.original_enabled:b.original_variant),b!=null&&(R=b.metadata)!=null&&R.original_payload&&(z.$feature_flag_original_payload=b==null||(L=b.metadata)==null?void 0:L.original_payload),S.length&&(z.$feature_flag_error=S.join(",")),this._instance.capture("$feature_flag_called",z)}if(n)return{key:t,enabled:!!i,variant:typeof i=="string"?i:void 0,payload:lu(s)}}}else se.warn('getFeatureFlagResult for key "'+t+cs)}getRemoteConfigPayload(t,e){var r=this.Te.token,n={distinct_id:this._instance.get_distinct_id(),token:r,person_properties:{$lib:j.LIB_NAME,$lib_version:j.LIB_VERSION}};this.Gs()&&(n.evaluation_contexts=this.Zs());var i=this.Qs();E(i)||(n.flag_keys=i),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:n,compression:this.Te.disable_compression?void 0:ge.Base64,timestampMode:"body",timeout:this.Te.feature_flag_request_timeout_ms,callback(s){var o,a=(o=s.json)==null?void 0:o.featureFlagPayloads;e(a?.[t]||void 0)}})}isFeatureEnabled(t,e){if(e===void 0&&(e={}),e.fresh&&!this.Ds)return e.defaultValue;if(!(this.Ls||this.getFlags()&&this.getFlags().length>0))return se.warn('isFeatureEnabled for key "'+t+cs),e.defaultValue;var r=this.getFeatureFlag(t,e);return E(r)?e.defaultValue:!!r}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((e=>e!==t))}receivedFeatureFlags(t,e,r){if(this.mi){this.Ls=!0;var n=this.getFlagVariants(),i=this.getFlagPayloads(),s=this.getFlagsWithDetails();(function(o,a,u,c,l,d){u===void 0&&(u={}),c===void 0&&(c={}),l===void 0&&(l={});var h=(b=>{var S=b.flags;return S?(b.featureFlags=Object.fromEntries(Object.keys(S).map((z=>{var L;return[z,(L=S[z].variant)!==null&&L!==void 0?L:S[z].enabled]}))),b.featureFlagPayloads=Object.fromEntries(Object.keys(S).filter((z=>S[z].enabled)).filter((z=>{var L;return(L=S[z].metadata)==null?void 0:L.payload})).map((z=>{var L;return[z,(L=S[z].metadata)==null?void 0:L.payload]})))):b.featureFlags&&se.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),b})(o),f=h.flags,p=h.featureFlags,g=h.featureFlagPayloads;if(p){var m=o.requestId,v=o.evaluatedAt;if(O(p)){se.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var w={};if(p)for(var y=0;p.length>y;y++)w[p[y]]=!0;a&&a.register({[fn]:p,[Ct]:w,[Rn]:!1})}else{var k=p,T=g,M=f;if(d!=null&&d.partialResponse)k=x({},u,k),T=x({},c,T),M=x({},l,M);else if(o.errorsWhileComputingFlags)if(f){var R=new Set(Object.keys(f).filter((b=>{var S;return!((S=f[b])!=null&&S.failed)})));k=x({},u,Object.fromEntries(Object.entries(k).filter((b=>R.has(b[0]))))),T=x({},c,Object.fromEntries(Object.entries(T||{}).filter((b=>R.has(b[0]))))),M=x({},l,Object.fromEntries(Object.entries(M||{}).filter((b=>R.has(b[0])))))}else k=x({},u,k),T=x({},c,T),M=x({},l,M);a&&a.register(x({[fn]:Object.keys(rc(k)),[Ct]:k||{},[gn]:T||{},[Zs]:M||{},[Rn]:o.minimalFlagCalledEvents===!0},m?{[Ns]:m}:{},v?{[Fr]:v}:{}))}}})(t,this.mi,n,i,s,r),e||(this.js=!1),this.eo(e)}}override(t,e){e===void 0&&(e=!1),se.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this.mi)return se.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(t===!1)return this.mi.unregister(tt),this.mi.unregister(Ut),this.eo(),St.info("All overrides cleared");if(O(t)){var e=tc(t);return this.mi.register({[tt]:e}),this.eo(),St.info("Flag overrides set",{flags:t})}if(t&&typeof t=="object"&&("flags"in t||"payloads"in t)){var r,n=t;if(this.Fs=!!((r=n.suppressWarning)!==null&&r!==void 0&&r),"flags"in n){if(n.flags===!1)this.mi.unregister(tt),St.info("Flag overrides cleared");else if(n.flags){if(O(n.flags)){var i=tc(n.flags);this.mi.register({[tt]:i})}else this.mi.register({[tt]:n.flags});St.info("Flag overrides set",{flags:n.flags})}}return"payloads"in n&&(n.payloads===!1?(this.mi.unregister(Ut),St.info("Payload overrides cleared")):n.payloads&&(this.mi.register({[Ut]:n.payloads}),St.info("Payload overrides set",{payloads:n.payloads}))),void this.eo()}if(t&&typeof t=="object")return this.mi.register({[tt]:t}),this.eo(),St.info("Flag overrides set",{flags:t});se.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.Ls){var e=this.ro(),r=e.flags,n=e.flagVariants;try{t(r,n)}catch(i){se.error("Error while running feature flags callback",i)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,r){var n,i=(this.zs($r)||[]).find((u=>u.flagKey===t)),s={["$feature_enrollment/"+t]:e},o={$feature_flag:t,$feature_enrollment:e,$set:s};i&&(o.$early_access_feature_name=i.name),r&&(o.$feature_enrollment_stage=r),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(s,!1);var a=x({},this.getFlagVariants(),{[t]:e});(n=this.mi)==null||n.register({[fn]:Object.keys(rc(a)),[Ct]:a}),this.eo()}getEarlyAccessFeatures(t,e,r){e===void 0&&(e=!1);var n=this.zs($r),i=r?"&"+r.map((s=>"stage="+s)).join("&"):"";if(n&&!e)return t(n);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Te.token+i),method:"GET",timestampMode:"query",callback:s=>{var o,a;if(s.json){var u=s.json.earlyAccessFeatures;return(o=this.mi)==null||o.unregister($r),(a=this.mi)==null||a.register({[$r]:u}),t(u)}}})}ro(){var t=this.getFlags(),e=this.getFlagVariants();return{flags:t.filter((r=>e[r])),flagVariants:Object.keys(e).filter((r=>e[r])).reduce(((r,n)=>(r[n]=e[n],r)),{})}}eo(t){var e=this.ro(),r=e.flags,n=e.flagVariants;this.featureFlagEventHandlers.forEach((i=>{try{i(r,n,{errorsLoading:t})}catch(s){se.error("Error while running feature flags callback",s)}}))}setPersonPropertiesForFlags(t,e){e===void 0&&(e=!0);var r=this.zs(Tt)||{},n=t?.$set||(t!=null&&t.$set_once?{}:t),i=t?.$set_once,s={};if(i)for(var o in i)({}).hasOwnProperty.call(i,o)&&(o in r||(s[o]=i[o]));this._instance.register({[Tt]:x({},r,s,n)}),e&&this._instance.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,e){e===void 0&&(e=!0);var r=x({},this.zs(Tt)||{});t.forEach((n=>{delete r[n]})),this._instance.register({[Tt]:r}),e&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(t){t===void 0&&(t=!0),this._instance.unregister(Tt),t&&this._instance.reloadFeatureFlags()}setGroupPropertiesForFlags(t,e){e===void 0&&(e=!0);var r=this.zs(zt)||{};Object.keys(r).length!==0&&Object.keys(r).forEach((n=>{r[n]=x({},r[n],t[n]),delete t[n]})),this._instance.register({[zt]:x({},r,t)}),e&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var e=this.zs(zt)||{};this._instance.register({[zt]:x({},e,{[t]:{}})})}else this._instance.unregister(zt)}reset(){this.Ls=!1,this.$s=!1,this.As=!1,this.Ns=!1,this.Ds=!1,this.$anon_distinct_id=void 0,this.Ys(),this.Fs=!1,this.Hs=0}}},Af={sessionRecording:class{get Te(){return this._instance.config}get mi(){return this._instance.persistence}get started(){var t;return!((t=this.io)==null||!t.isStarted)}get status(){var t,e;return this.no===xr||this.no===dn?this.no:(t=(e=this.io)==null?void 0:e.status)!==null&&t!==void 0?t:this.no}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.no=Wu,this.so=void 0,this._instance=t,!this._instance.sessionManager)throw Xe.error("started without valid sessionManager"),new Error(mo+" started without valid sessionManager. This is a bug.");if(this.Te.cookieless_mode===it)throw new Error(mo+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get oo(){var t,e=!((t=this._instance.get_property(It))==null||!t.enabled),r=!this.Te.disable_session_recording,n=this.Te.disable_session_recording||this._instance.consent.isOptedOut();return _&&e&&r&&!n}startIfEnabledOrStop(t){var e;if(!this.oo||(e=this.io)==null||!e.isStarted){var r=!E(Object.assign)&&!E(Array.from);this.oo&&r?(this.ao(t),Xe.info("starting")):(this.no=Wu,this.stopRecording())}}ao(t){var e,r,n;this.oo&&(this.no!==xr&&this.no!==dn&&(this.no=Ju),C!=null&&(e=C.__PosthogExtensions__)!=null&&(e=e.rrweb)!=null&&e.record&&(r=C.__PosthogExtensions__)!=null&&r.initSessionRecording?this.lo(t):(n=C.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,this.uo,(i=>{if(i)return Xe.error("could not load recorder",i);this.lo(t)})))}stopRecording(){var t,e;(t=this.so)==null||t.call(this),this.so=void 0,(e=this.io)==null||e.stop()}ho(){var t,e;(t=this.so)==null||t.call(this),this.so=void 0,(e=this.io)==null||e.discard()}do(){var t,e;(t=this.mi)==null||t.unregister(Co),(e=this.mi)==null||e.unregister(Dc)}co(t,e){if(F(t))return null;var r,n=de(t)?t:parseFloat(t);return typeof(r=n)!="number"||!Number.isFinite(r)||0>r||r>1?(Xe.warn(e+" must be between 0 and 1. Ignoring invalid value:",t),null):n}vo(t){if(this.mi){var e,r,n=this.mi,i=()=>{var s,o=t.sessionRecording===!1?void 0:t.sessionRecording,a=this.co((s=this.Te.session_recording)==null?void 0:s.sampleRate,"session_recording.sampleRate"),u=this.co(o?.sampleRate,"remote config sampleRate"),c=a??u;F(c)&&this.do();var l=o?.minimumDurationMilliseconds;n.register({[It]:x({cache_timestamp:Date.now(),enabled:!!o},o,{networkPayloadCapture:x({capturePerformance:t.capturePerformance},o?.networkPayloadCapture),canvasRecording:{enabled:o?.recordCanvas,fps:o?.canvasFps,quality:o?.canvasQuality},sampleRate:c,minimumDurationMilliseconds:E(l)?null:l,endpoint:o?.endpoint,triggerMatchType:o?.triggerMatchType,masking:o?.masking,urlTriggers:o?.urlTriggers,version:o?.version,triggerGroups:o?.triggerGroups})})};i(),(e=this.so)==null||e.call(this),this.so=(r=this._instance.sessionManager)==null?void 0:r.onSessionId(i)}}onRemoteConfig(t){var e=t.ok?t.config:void 0;return e&&"sessionRecording"in e?e.sessionRecording===!1?(this.vo(e),void this.ho()):(this.vo(e),void this.startIfEnabledOrStop()):(this.no===xr&&(this.no=dn,Xe.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e){var r;e===void 0&&(e="log"),(r=this.io)!=null&&r.log?this.io.log(t,e):Xe.warn("log called before recorder was ready")}get uo(){var t,e,r=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.get_property(It);return(r==null||(e=r.scriptConfig)==null?void 0:e.script)||"lazy-recorder"}fo(){var t,e,r=this._instance.get_property(It);if(!r)return!1;try{e=typeof r=="object"?r:JSON.parse(r)}catch(i){return Xe.warn("persisted remote config for session recording is invalid and will be ignored",i),!1}var n=(t=e.cache_timestamp)!==null&&t!==void 0?t:Date.now();return 36e5>=Date.now()-n}lo(t){var e,r;if((e=C.__PosthogExtensions__)==null||!e.initSessionRecording)return Xe.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Kc]:!0});if(this.io||(this.io=(r=C.__PosthogExtensions__)==null?void 0:r.initSessionRecording(this._instance),this.io._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.fo())return this.no===dn||this.no===xr?void 0:(this.no=xr,Xe.info("persisted remote config is stale, requesting fresh config before starting"),void new Un(this._instance).load());this.no=Ju,this.io.start(t)}onRRwebEmit(t){var e;(e=this.io)==null||e.onRRwebEmit==null||e.onRRwebEmit(t)}overrideLinkedFlag(){var t,e;this.io||(e=this.mi)==null||e.register({[Uc]:!0}),(t=this.io)==null||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.io||(e=this.mi)==null||e.register({[jc]:!0}),(t=this.io)==null||t.overrideSampling()}overrideTrigger(t){var e,r;this.io||(r=this.mi)==null||r.register({[t==="url"?Hc:Bc]:!0}),(e=this.io)==null||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return((t=this.io)==null?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var r;return!((r=this.io)==null||!r.tryAddCustomEvent(t,e))}}},Of={autocapture:class{constructor(t){this.po=!1,this.mo=null,this.yo=!1,this.bo=!1,this.instance=t,this.rageclicks=new Wn(t.config.rageclick),this._o=null}initialize(){this.startIfEnabled()}get Te(){var t,e,r=Y(this.instance.config.autocapture)?this.instance.config.autocapture:{};return r.url_allowlist=(t=r.url_allowlist)==null?void 0:t.map((n=>new RegExp(n))),r.url_ignorelist=(e=r.url_ignorelist)==null?void 0:e.map((n=>new RegExp(n))),r}wo(){if(this.isBrowserSupported()){if(_&&P){var t=r=>{r=r||_?.event;try{this.xo(r)}catch(n){is.error("Failed to capture event",n)}};if(re(P,"submit",t,{capture:!0}),re(P,"change",t,{capture:!0}),re(P,"click",t,{capture:!0}),this.Te.capture_copied_text){var e=r=>{r=r||_?.event;try{this.xo(r,ns)}catch(n){is.error("Failed to capture copy/cut event",n)}};re(P,"copy",e,{capture:!0}),re(P,"cut",e,{capture:!0})}}}else is.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.po&&(this.wo(),this.po=!0)}onRemoteConfig(t){if(this.yo=!0,t.ok){var e=t.config;e.elementsChainAsString&&(this.bo=e.elementsChainAsString);var r=e.autocapture_opt_out;Ne(r)&&(this.instance.persistence&&this.instance.persistence.register({[Cs]:r}),this.mo=r),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(t){this._o=t}getElementSelectors(t){var e,r=[];return(e=this._o)==null||e.forEach((n=>{var i=P?.querySelectorAll(n);i?.forEach((s=>{t===s&&r.push(n)}))})),r}get isEnabled(){var t,e,r=(t=this.instance.persistence)==null?void 0:t.props[Cs],n=this.mo,i=this.instance.Ur()&&!this.yo;if(me(n)&&!Ne(r)&&!i)return!1;var s=(e=this.mo)!==null&&e!==void 0?e:!!r;return!!this.instance.config.autocapture&&!s}xo(t,e){if(e===void 0&&(e="$autocapture"),this.isEnabled){var r,n=qi(t);el(n)&&(n=n.parentNode||null),e==="$autocapture"&&t.type==="click"&&t instanceof MouseEvent&&this.instance.config.rageclick&&(r=this.rageclicks)!=null&&r.isRageClick(t.clientX,t.clientY,t.timeStamp||new Date().getTime())&&Iu(n,this.instance.config.rageclick)&&this.xo(t,"$rageclick");var i=e===ns;if(n&&(function(d,h,f,p,g,m){var v;if(!_||Fo(d)||f!=null&&f.url_allowlist&&!zu(f.url_allowlist,m)||f!=null&&f.url_ignorelist&&zu(f.url_ignorelist,m))return!1;if(f!=null&&f.dom_event_allowlist){var w=f.dom_event_allowlist;if(w&&!w.some((b=>h.type===b)))return!1}var y=ol(d,p),k=y.parentIsUsefulElement,T=y.targetElementList;if(!(function(b,S){var z=S?.element_allowlist;if(E(z))return!0;var L,I=function(Q){if(z.some((G=>Q.tagName.toLowerCase()===G)))return{v:!0}};for(var Z of b)if(L=I(Z))return L.v;return!1})(T,f)||!Qs(T,f?.css_selector_allowlist)||Qs(T,(v=f?.css_selector_ignorelist)!==null&&v!==void 0?v:Bp))return!1;try{var M=_.getComputedStyle(d);if(M&&M.getPropertyValue("cursor")==="pointer"&&h.type==="click")return!0}catch{}var R=d.tagName.toLowerCase();switch(R){case"html":return!1;case"form":return(g||["submit"]).indexOf(h.type)>=0;case"input":case"select":case"textarea":return(g||["change","click"]).indexOf(h.type)>=0;default:return k?(g||["click"]).indexOf(h.type)>=0:(g||["click"]).indexOf(h.type)>=0&&(Mo.indexOf(R)>-1||d.getAttribute("contenteditable")==="true")}})(n,t,this.Te,i,i?["copy","cut"]:void 0,this.instance)){var s=Pf(n,{e:t,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Te.element_attribute_ignorelist,elementsChainAsString:this.bo,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes}),o=s.props;if(s.explicitNoCapture)return!1;var a=this.getElementSelectors(n);if(a&&a.length>0&&(o.$element_selectors=a),e===ns){var u,c=nl(_==null||(u=_.getSelection())==null?void 0:u.toString()),l=t.type||"clipboard";if(!c)return!1;o.$selected_content=c,o.$copy_type=l}return this.instance.capture(e,o),!0}}}isBrowserSupported(){return Ze(P?.querySelectorAll)}},historyAutocapture:class{constructor(t){var e;this._instance=t,this.ko=(_==null||(e=_.location)==null?void 0:e.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&($.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.So&&this.So(),this.So=void 0,$.info("History API monitoring stopped")}monitorHistoryChanges(){_&&_.history&&(this.Co("pushState"),this.Co("replaceState"),this.To())}Co(t){var e;if(_&&((e=_.history[t])==null||!e.__posthog_wrapped__)){var r=this;(function(n,i,s){try{if(!(i in n))return qu;var o={next:n[i]},a=s((function(){for(var u=arguments.length,c=new Array(u),l=0;u>l;l++)c[l]=arguments[l];return o.next.apply(this,c)}));return Ze(a)&&(a.prototype=a.prototype||{},Object.defineProperties(a,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:o}})),n[i]=a,()=>{if(n[i]!==a)for(var u=n[i];Ze(u)&&u.__posthog_layer__;){var c=u.__posthog_layer__;if(c.next===a)return void(c.next=o.next);u=c.next}else n[i]=o.next}}catch{return qu}})(_.history,t,(n=>function(i,s,o){n.call(this,i,s,o),r.Io(t)}))}}Io(t){try{var e,r=_==null||(e=_.location)==null?void 0:e.pathname;if(!r)return;r!==this.ko&&this.isEnabled&&this._instance.capture(Ht,{navigation_type:t}),this.ko=r}catch(n){$.error("Error capturing "+t+" pageview",n)}}To(){if(!this.So){var t=()=>{this.Io("popstate")};re(_,"popstate",t),this.So=()=>{_&&_.removeEventListener("popstate",t)}}}},heatmaps:class{get Te(){return this.instance.config}constructor(t){var e;this.Mo=!1,this.po=!1,this.Eo=null,this.instance=t,this.Mo=!((e=this.instance.persistence)==null||!e.props[Is]),this.rageclicks=new Wn(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return Y(this.Te.capture_heatmaps)&&this.Te.capture_heatmaps.flush_interval_milliseconds&&(t=this.Te.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return F(this.Te.capture_heatmaps)?F(this.Te.enable_heatmaps)?this.Mo:this.Te.enable_heatmaps:this.Te.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.po)return;zf.info("starting..."),this.Ro(),this.ke()}else{var t;clearInterval((t=this.Eo)!==null&&t!==void 0?t:void 0),this.Po(),this.getAndClearBuffer()}}onRemoteConfig(t){if(t.ok){var e=t.config;if("heatmaps"in e){var r=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Is]:r}),this.Mo=r,this.startIfEnabled()}}}getAndClearBuffer(){var t=this.R;return this.R=void 0,t}Oo(t){os(t.originalEvent)&&this.pe(t.originalEvent,"deadclick")}ke(){this.Eo&&clearInterval(this.Eo),this.Eo=P?.visibilityState==="visible"?setInterval(this.oi.bind(this),this.flushIntervalMilliseconds):null}Ro(){_&&P&&(this.Fo=this.oi.bind(this),re(_,Mn,this.Fo),this.Lo=t=>this.pe(t||_?.event),re(P,"click",this.Lo,{capture:!0}),this.$o=t=>this.Ao(t||_?.event),re(P,"mousemove",this.$o,{capture:!0}),this.No=new Ln(this.instance,Xp,this.Oo.bind(this)),this.No.startIfEnabledOrStop(),this.Do=this.ke.bind(this),re(P,On,this.Do),this.po=!0)}Po(){var t;_&&P&&(this.Fo&&_.removeEventListener(Mn,this.Fo),this.Lo&&P.removeEventListener("click",this.Lo,{capture:!0}),this.$o&&P.removeEventListener("mousemove",this.$o,{capture:!0}),this.Do&&P.removeEventListener(On,this.Do),clearTimeout(this.qo),(t=this.No)==null||t.stop(),this.po=!1)}jo(t,e){var r=this.instance.scrollManager.scrollY(),n=this.instance.scrollManager.scrollX(),i=this.instance.scrollManager.scrollElement(),s=(function(o,a,u){for(var c=o;c&>(c)&&!$e(c,"body");){if(c===u)return!1;var l=void 0;try{var d,h,f;l=(d=(h=(f=c.ownerDocument)==null?void 0:f.defaultView)!==null&&h!==void 0?h:_)==null?void 0:d.getComputedStyle(c).position}catch{return!1}if(A(a,l))return!0;c=il(c)}return!1})(qi(t),["fixed","sticky"],i);return{x:t.clientX+(s?0:n),y:t.clientY+(s?0:r),target_fixed:s,type:e}}pe(t,e){var r;if(e===void 0&&(e="click"),!Tu(t.target)&&os(t)){var n=this.jo(t,e);(r=this.rageclicks)!=null&&r.isRageClick(t.clientX,t.clientY,new Date().getTime())&&Iu(qi(t),this.instance.config.rageclick)&&this.Nt(x({},n,{type:"rageclick"})),this.Nt(n)}}Ao(t){!Tu(t.target)&&os(t)&&(clearTimeout(this.qo),this.qo=setTimeout((()=>{this.Nt(this.jo(t,"mousemove"))}),500))}Nt(t){if(_){var e=this.Te.disable_capture_url_hashes?ft(_.location.href):_.location.href,r=this.Te.custom_personal_data_properties,n=this.Te.mask_personal_data_properties?[...Qt,...r||[]]:[],i=Zr(e,n,Nr);this.R=this.R||{},this.R[i]||(this.R[i]=[]),this.R[i].push(t)}}oi(){this.R&&!pt(this.R)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Ln,webVitalsAutocapture:class{constructor(t){var e;this.Mo=!1,this.po=!1,this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Ho=()=>{clearTimeout(this.Bo),this.R.metrics.length!==0&&(this._instance.capture("$web_vitals",this.R.metrics.reduce(((r,n)=>x({},r,{["$web_vitals_"+n.name+"_event"]:x({},n),["$web_vitals_"+n.name+"_value"]:n.value})),{})),this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Uo=r=>{var n;this.R=this.R||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var i=this.zo();if(!E(i))if(F(r?.name)||F(r?.value))$t.error("Invalid metric received",r);else if(!this.Vo||this.Vo>r.value){this.R.url!==i&&(this.Ho(),this.Bo=setTimeout(this.Ho,this.flushToCaptureTimeoutMs)),E(this.R.url)&&(this.R.url=i),this.R.firstMetricTimestamp=E(this.R.firstMetricTimestamp)?Date.now():this.R.firstMetricTimestamp,r.attribution&&r.attribution.interactionTargetElement&&(r.attribution.interactionTargetElement=void 0);var s=(n=this._instance.sessionManager)==null?void 0:n.checkAndGetSessionAndWindowId(!0),o=x({},r,{$current_url:i,timestamp:Date.now()});E(s)||(o.$session_id=s.sessionId,o.$window_id=s.windowId),this.R.metrics.push(o),this.R.metrics.length===this.allowedMetrics.length&&this.Ho()}else $t.error("Ignoring metric with value >= "+this.Vo,r)},this.Wo=()=>{if(!this.po){var r,n,i,s,o=C.__PosthogExtensions__;if(!E(o)&&!E(o.postHogWebVitalsCallbacks)){var a=o.postHogWebVitalsCallbacks;r=a.onLCP,n=a.onCLS,i=a.onFCP,s=a.onINP}r&&n&&i&&s?(this.allowedMetrics.indexOf("LCP")>-1&&r(this.Uo.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&n(this.Uo.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this.Uo.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&s(this.Uo.bind(this)),this.po=!0):$t.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.Mo=!((e=this._instance.persistence)==null||!e.props[Fs]),this.startIfEnabled()}get Zo(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e,r=Y(this.Zo)?(t=this.Zo)==null?void 0:t.web_vitals_allowed_metrics:void 0;return F(r)?((e=this._instance.persistence)==null?void 0:e.props[Ls])||["CLS","FCP","INP","LCP"]:r}get flushToCaptureTimeoutMs(){return(Y(this.Zo)?this.Zo.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var t=Y(this.Zo)?this.Zo.web_vitals_attribution:void 0;return t!=null&&t}get Vo(){var t=Y(this.Zo)&&de(this.Zo.__web_vitals_max_value)?this.Zo.__web_vitals_max_value:Ku;return t>0&&6e4>=t?Ku:t}get isEnabled(){var t=ie?.protocol;if(t!=="http:"&&t!=="https:")return $t.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=Y(this.Zo)?this.Zo.web_vitals:Ne(this.Zo)?this.Zo:void 0;return Ne(e)?e:this.Mo}startIfEnabled(){this.isEnabled&&!this.po&&($t.info("enabled, starting..."),this.er(this.Wo))}onRemoteConfig(t){if(t.ok){var e=t.config;if("capturePerformance"in e){var r=Y(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=Y(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Fs]:r}),this._instance.persistence.register({[Ls]:n})),this.Mo=r,this.startIfEnabled()}}}er(t){var e,r;(e=C.__PosthogExtensions__)!=null&&e.postHogWebVitalsCallbacks?t():(r=C.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(n=>{n?$t.error("failed to load script",n):t()}))}zo(){var t=_?this._instance.config.disable_capture_url_hashes?ft(_.location.href):_.location.href:void 0;if(t){var e=this._instance.config.custom_personal_data_properties,r=this._instance.config.mask_personal_data_properties?[...Qt,...e||[]]:[];return Zr(t,r,Nr)}$t.error("Could not determine current URL")}}},Mf={exceptionObserver:class{constructor(t){var e;this.Wo=()=>{var r;if(_&&this.isEnabled&&(r=C.__PosthogExtensions__)!=null&&r.errorWrappingFunctions){var n=C.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=C.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=C.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Go&&this.Te.capture_unhandled_errors&&(this.Go=n(this.captureException.bind(this))),!this.Qo&&this.Te.capture_unhandled_rejections&&(this.Qo=i(this.captureException.bind(this))),!this.Jo&&this.Te.capture_console_errors&&(this.Jo=s(this.captureException.bind(this)))}catch(o){br.error("failed to start",o),this.Ko()}}},this._instance=t,this.Yo=!((e=this._instance.persistence)==null||!e.props[As]),this.Xo=new gs(x({},(function(r){var n,i,s,o;return r===void 0&&(r={}),{refillRate:(n=(i=r.exceptionRateLimiterRefillRate)!==null&&i!==void 0?i:r.__exceptionRateLimiterRefillRate)!==null&&n!==void 0?n:1,bucketSize:(s=(o=r.exceptionRateLimiterBucketSize)!==null&&o!==void 0?o:r.__exceptionRateLimiterBucketSize)!==null&&s!==void 0?s:10}})(this._instance.config.error_tracking),{refillInterval:1e4,Ge:br})),this.Te=this.ea(),this.startIfEnabledOrStop()}ea(){var t=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Y(t)?e=x({},e,t):(E(t)?this.Yo:t)&&(e=x({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Te.capture_console_errors||this.Te.capture_unhandled_errors||this.Te.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(br.info("enabled"),this.Ko(),this.er(this.Wo)):this.Ko()}er(t){var e,r;(e=C.__PosthogExtensions__)!=null&&e.errorWrappingFunctions?t():(r=C.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"exception-autocapture",(n=>{if(n)return br.error("failed to load script",n);t()}))}Ko(){var t,e,r;(t=this.Go)==null||t.call(this),this.Go=void 0,(e=this.Qo)==null||e.call(this),this.Qo=void 0,(r=this.Jo)==null||r.call(this),this.Jo=void 0}onRemoteConfig(t){if(t.ok){var e=t.config;"autocaptureExceptions"in e&&(this.Yo=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[As]:this.Yo}),this.Te=this.ea(),this.startIfEnabledOrStop())}}onConfigChange(){this.Te=this.ea()}captureException(t){var e,r,n,i=(e=t==null||(r=t.$exception_list)==null||(r=r[0])==null?void 0:r.type)!==null&&e!==void 0?e:"Exception";this.Xo.consumeRateLimit(i)?br.info("Skipping exception capture because of client rate limiting.",{exception:i}):(n=this._instance.exceptions)==null||n.sendExceptionEvent(t)}},exceptions:class{constructor(t){var e,r;this.ta=[],this.ra=new bs([new ws,new zs,new Es,new ks,new Ps,new Ss,new $s,new Ts],(function(n){for(var i=arguments.length,s=new Array(i>1?i-1:0),o=1;i>o;o++)s[o-1]=arguments[o];return function(a,u){u===void 0&&(u=0);for(var c=[],l=a.split(`
|
|
2
|
+
`),d=u;l.length>d;d++){var h=l[d];if(1024>=h.length){var f=Eu.test(h)?h.replace(Eu,"$1"):h;if(!f.match(/\S*Error: /)){for(var p of s){var g=p(f,n);if(g){c.push(g);break}}if(c.length>=50)break}}}return(function(m){if(!m.length)return[];var v=Array.from(m);return v.reverse(),v.slice(0,50).map((w=>{return x({},w,{filename:w.filename||(y=v,y[y.length-1]||{}).filename,function:w.function||Yt});var y}))})(c)}})("web:javascript",$p,Tp)),this._instance=t,this.ta=(e=(r=this._instance.persistence)==null?void 0:r.get_property(Os))!==null&&e!==void 0?e:[],this.ia=Tn(this.na()),this.sa=new Rs(this.ia)}onConfigChange(){this.ia=Tn(this.na()),this.sa.setConfig(this.ia)}onRemoteConfig(t){var e,r,n;if(t.ok){var i=t.config;if("errorTracking"in i){var s=(e=(r=i.errorTracking)==null?void 0:r.suppressionRules)!==null&&e!==void 0?e:[],o=(n=i.errorTracking)==null?void 0:n.captureExtensionExceptions;this.ta=s,this._instance.persistence&&this._instance.persistence.register({[Os]:this.ta,[Ms]:o})}}}get oa(){var t,e=!!this._instance.get_property(Ms),r=this._instance.config.error_tracking.captureExtensionExceptions;return(t=r??e)!==null&&t!==void 0&&t}buildProperties(t,e){return this.ra.buildFromUnknown(t,{syntheticException:e?.syntheticException,mechanism:{handled:e?.handled}})}addExceptionStep(t,e){if(this.ia.enabled)try{if(!H(t)||t.trim().length===0)return void Qe.warn("Ignoring exception step because message must be a non-empty string");var r=(function(s){if(!s)return{sanitizedProperties:{},droppedKeys:[]};var o=[];return{sanitizedProperties:Object.keys(s).reduce(((a,u)=>Cp.has(u)?(o.push(u),a):(a[u]=s[u],a)),{}),droppedKeys:o}})(this.aa(e)),n=r.sanitizedProperties,i=r.droppedKeys;i.length>0&&Qe.warn("Ignoring reserved exception step fields",{droppedKeys:i}),this.sa.add(x({[Sn]:t,[Pn]:new Date().toISOString()},n))}catch(s){Qe.error("Failed to add exception step. Ignoring breadcrumb.",s)}}sendExceptionEvent(t){try{var e=t.$exception_list;if(this.la(e)){if(this.ua(e))return this.ha("Exception dropped: matched a suppression rule"),void Qe.info("Skipping exception capture because a suppression rule matched");if(!this.oa&&this.da(e))return this.ha("Exception dropped: thrown by a browser extension"),void Qe.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ca(e))return this.ha("Exception dropped: thrown by the PostHog SDK"),void Qe.info("Skipping exception capture because it was thrown by the PostHog SDK")}var r=this.ia.enabled&&F(t.$exception_steps)?this.va(t):t;try{var n=this._instance.capture("$exception",r,{_noTruncate:!0,_batchKey:"exceptionEvent",kn:!0});return n&&this.sa.clear(),n}catch(i){return Qe.error("Failed to capture exception event. Dropping this exception.",i),void this.sa.clear()}}catch(i){return void Qe.error("Failed to process exception event. Ignoring this exception.",i)}}va(t){try{var e=this.sa.getAttachable();return e.length===0?t:x({},t,{$exception_steps:e})}catch(r){return Qe.error("Failed to read buffered exception steps. Capturing exception without steps.",r),t}}ha(t){this.ia.enabled&&this.sa.add({[Sn]:t,[Pn]:new Date().toISOString()})}aa(t){return Y(t)?x({},t):{}}na(){var t,e;return(t=(e=this._instance.config.error_tracking)==null?void 0:e.exception_steps)!==null&&t!==void 0?t:{}}ua(t){if(t.length===0)return!1;var e=t.reduce(((r,n)=>{var i=n.type,s=n.value;return H(i)&&i.length>0&&r.$exception_types.push(i),H(s)&&s.length>0&&r.$exception_values.push(s),r}),{$exception_types:[],$exception_values:[]});return this.ta.some((r=>{var n=r.values.map((i=>{var s,o=Al[i.operator],a=O(i.value)?i.value:[i.value],u=(s=e[i.key])!==null&&s!==void 0?s:[];return a.length>0&&o(a,u)}));return r.type==="OR"?n.some(Boolean):n.every(Boolean)}))}da(t){return t.flatMap((e=>{var r,n;return(r=(n=e.stacktrace)==null?void 0:n.frames)!==null&&r!==void 0?r:[]})).some((e=>e.filename&&e.filename.startsWith("chrome-extension://")))}ca(t){if(t.length>0){var e,r,n,i,s=(e=(r=t[0].stacktrace)==null?void 0:r.frames)!==null&&e!==void 0?e:[],o=s[s.length-1];return(n=o==null||(i=o.filename)==null?void 0:i.includes("posthog.com/static"))!==null&&n!==void 0&&n}return!1}la(t){return!F(t)&&O(t)}}},Ff=x({productTours:class{get mi(){return this._instance.persistence}constructor(t){this.fa=null,this.pa=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(t.ok){var e=t.config;if("productTours"in e){var r,n;if(this.mi&&this.mi.register({[Ro]:!!e.productTours}),!us(this._instance))return!this.fa&&F((r=this.mi)==null?void 0:r.props[Sr])||as.info("product tours disabled; stopping and clearing cached tours"),(n=this.fa)==null||n.stop(),this.fa=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.fa&&us(this._instance)&&this.er((()=>this.ga()))}er(t){var e,r;(e=C.__PosthogExtensions__)!=null&&e.generateProductTours?t():(r=C.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"product-tours",(n=>{n?as.error("Could not load product tours script",n):t()}))}ga(){var t;!this.fa&&(t=C.__PosthogExtensions__)!=null&&t.generateProductTours&&(this.fa=C.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e){if(e===void 0&&(e=!1),!O(this.pa)||e){var r=this.mi;if(r){var n=r.props[Sr];if(O(n)&&!e)return this.pa=n,void t(n,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",timestampMode:"query",callback:i=>{if(us(this._instance)){var s=i.statusCode;if(s!==200||!i.json){var o="Product Tours API could not be loaded, status: "+s;return as.error(o),void t([],{isLoaded:!1,error:o})}var a=O(i.json.product_tours)?i.json.product_tours:[];this.pa=a,r&&r.register({[Sr]:a}),t(a,{isLoaded:!0})}else t([],{isLoaded:!0})}})}else t(this.pa,{isLoaded:!0})}getActiveProductTours(t){F(this.fa)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.fa.getActiveProductTours(t)}showProductTour(t){var e;(e=this.fa)==null||e.showTourById(t)}previewTour(t){this.fa?this.fa.previewTour(t):this.er((()=>{var e;this.ga(),(e=this.fa)==null||e.previewTour(t)}))}dismissProductTour(){var t;(t=this.fa)==null||t.dismissTour("user_clicked_skip")}nextStep(){var t;(t=this.fa)==null||t.nextStep()}previousStep(){var t;(t=this.fa)==null||t.previousStep()}clearCache(){var t;this.pa=null,(t=this.mi)==null||t.unregister(Sr)}resetTour(t){var e;(e=this.fa)==null||e.resetTour(t)}resetAllTours(){var t;(t=this.fa)==null||t.resetAllTours()}cancelPendingTour(t){var e;(e=this.fa)==null||e.cancelPendingTour(t)}}},Xn),Lf={siteApps:class{constructor(t){this.ma=0,this._instance=t,this.ya=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}ba(t,e){if(e){var r=this.globalsForEvent(e);this.ya.push(r),this.ya.length>1e3&&(this.ya=this.ya.slice(10))}}get siteAppLoaders(){var t;return(t=C._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.ba.bind(this));this._a=()=>{t(),this.ya=[],this._a=void 0}}}globalsForEvent(t){var e,r,n,i,s,o,a;if(!t)throw new Error("Event payload is required");var u={},c=this._instance.get_property("$groups")||[],l=this._instance.get_property("$stored_group_properties")||{};for(var d of Object.entries(l)){var h=d[0];u[h]={id:c[h],type:h,properties:d[1]}}var f=t.$set_once,p=t.$set;return{event:x({},oc(t,Rf),{properties:x({},t.properties,p?{$set:x({},(e=(r=t.properties)==null?void 0:r.$set)!==null&&e!==void 0?e:{},p)}:{},f?{$set_once:x({},(n=(i=t.properties)==null?void 0:i.$set_once)!==null&&n!==void 0?n:{},f)}:{}),elements_chain:(s=(o=t.properties)==null?void 0:o.$elements_chain)!==null&&s!==void 0?s:"",distinct_id:(a=t.properties)==null?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:u}}wa(t){var e,r=(e=t.tagName)==null?void 0:e.toLowerCase();return r==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(t)||(Be.error("prepare_external_dependency_stylesheet returned null"),null):r==="script"&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(t)||(Be.error("prepare_external_dependency_script returned null"),null):t}xa(){var t,e,r,n,i,s,o,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var u=P?.defaultView,c=u==null||(t=u.Node)==null?void 0:t.prototype;if(!u||!c)return()=>{};if(this.ma++,this.ka)return this.Sa();var l=[],d=this,h=new WeakSet,f=(m,v,w)=>{if(m!=null&&m[v]){var y=m[v];m[v]=w(y),l.push((()=>{m[v]=y}))}},p=m=>{if(h.has(m))return m;var v=d.wa(m);return v&&h.add(v),v},g=m=>m.map((v=>typeof v=="string"?v:p(v))).filter((v=>!me(v)));return f(c,"appendChild",(m=>function(v){var w=p(v);return w?m.call(this,w):v})),f(c,"insertBefore",(m=>function(v,w){var y=p(v);return y?m.call(this,y,w):v})),f(c,"replaceChild",(m=>function(v,w){var y=p(v);return y?m.call(this,y,w):w})),[(e=u.Element)==null?void 0:e.prototype,(r=u.Document)==null?void 0:r.prototype,(n=u.DocumentFragment)==null?void 0:n.prototype].forEach((m=>{f(m,"append",(v=>function(){for(var w=arguments.length,y=new Array(w),k=0;w>k;k++)y[k]=arguments[k];return v.apply(this,g(y))})),f(m,"prepend",(v=>function(){for(var w=arguments.length,y=new Array(w),k=0;w>k;k++)y[k]=arguments[k];return v.apply(this,g(y))}))})),[(i=u.Element)==null?void 0:i.prototype,(s=u.CharacterData)==null?void 0:s.prototype,(o=u.DocumentType)==null?void 0:o.prototype].forEach((m=>{f(m,"before",(v=>function(){for(var w=arguments.length,y=new Array(w),k=0;w>k;k++)y[k]=arguments[k];return v.apply(this,g(y))})),f(m,"after",(v=>function(){for(var w=arguments.length,y=new Array(w),k=0;w>k;k++)y[k]=arguments[k];return v.apply(this,g(y))})),f(m,"replaceWith",(v=>function(){for(var w=arguments.length,y=new Array(w),k=0;w>k;k++)y[k]=arguments[k];var T=g(y);return y.length&&!T.length?void 0:v.apply(this,T)}))})),f((a=u.Element)==null?void 0:a.prototype,"insertAdjacentElement",(m=>function(v,w){var y=p(w);return y?m.call(this,v,y):null})),this.ka=()=>{l.forEach((m=>m())),this.ka=void 0},this.Sa()}Sa(){var t=!1;return()=>{var e;t||(t=!0,this.ma--,this.ma===0&&((e=this.ka)==null||e.call(this)))}}Ca(t,e){e===void 0&&(e=!0);var r=this.xa();try{var n=t(r);return e&&r(),n}catch(i){throw r(),i}}setupSiteApp(t){var e=this.apps[t.id],r=()=>{var o;!e.errored&&this.ya.length&&(Be.info("Processing "+this.ya.length+" events for site app with id "+t.id),this.ya.forEach((a=>this.Ca((()=>e.processEvent==null?void 0:e.processEvent(a))))),e.processedBuffer=!0),Object.values(this.apps).every((a=>a.processedBuffer||a.errored))&&((o=this._a)==null||o.call(this))},n=!1,i=o=>{e.errored=!o,e.loaded=!0,Be.info("Site app with id "+t.id+" "+(o?"loaded":"errored")),n&&r()};try{var s=this.Ca((o=>t.init({posthog:this._instance,callback(a){o(),i(a)}})),!1).processEvent;s&&(e.processEvent=s),n=!0}catch(o){Be.error(Yu+t.id,o),i(!1)}if(n&&e.loaded)try{r()}catch(o){Be.error("Error while processing buffered events PostHog app with config id "+t.id,o),e.errored=!0}}Ta(){var t=this.siteAppLoaders||[];for(var e of t)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(var r of t)this.setupSiteApp(r)}Ia(t){var e=this;if(Object.keys(this.apps).length!==0){var r=this.globalsForEvent(t),n=function(s){try{e.Ca((()=>s.processEvent==null?void 0:s.processEvent(r)))}catch(o){Be.error("Error while processing event "+t.event+" for site app "+s.id,o)}};for(var i of Object.values(this.apps))n(i)}}onRemoteConfig(t){var e,r,n,i=this;if((e=this.siteAppLoaders)!=null&&e.length)return this.isEnabled?(this.Ta(),void this._instance.on("eventCaptured",(u=>this.Ia(u)))):void Be.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((r=this._a)==null||r.call(this),t.ok){var s=t.config;if((n=s.siteApps)!=null&&n.length)if(this.isEnabled){var o=function(){var u,c=a.id,l=a.url;C["__$$ph_site_app_"+c]=i._instance,(u=C.__PosthogExtensions__)==null||u.loadSiteApp==null||u.loadSiteApp(i._instance,l,(d=>{if(d)return Be.error(Yu+c,d)}))};for(var a of s.siteApps)o()}else Be.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},Zf={tracingHeaders:class{constructor(t){this.Ma=void 0,this.Ea=void 0,this.Ra=void 0,this.Wo=()=>{var e,r,n=this.Pa();n?(E(this.Ma)&&(this.Ma=(e=C.__PosthogExtensions__)==null||(e=e.tracingHeadersPatchFns)==null?void 0:e._patchXHR(n,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),E(this.Ea)&&(this.Ea=(r=C.__PosthogExtensions__)==null||(r=r.tracingHeadersPatchFns)==null?void 0:r._patchFetch(n,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.Ko()},this._instance=t}initialize(){this.startIfEnabledOrStop()}er(t){var e,r;(e=C.__PosthogExtensions__)!=null&&e.tracingHeadersPatchFns?t():(r=C.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"tracing-headers",(n=>{if(n)return Tf.error("failed to load script",n);t()}))}Oa(){var t,e;return(t=(e=this._instance.config.tracing_headers)!==null&&e!==void 0?e:this._instance.config.addTracingHeaders)!==null&&t!==void 0?t:this._instance.config.__add_tracing_headers}Pa(){var t=this.Oa();return O(t)?(O(this.Ra)?this.Ra.splice(0,this.Ra.length,...t):this.Ra=[...t],t.length>0?this.Ra:void 0):(O(this.Ra)&&this.Ra.splice(0),this.Ra=t||void 0,this.Ra)}Ko(){var t,e;(t=this.Ma)==null||t.call(this),(e=this.Ea)==null||e.call(this),this.Ma=void 0,this.Ea=void 0}startIfEnabledOrStop(){this.Pa()?this.er(this.Wo):this.Ko()}}},Nf=x({surveys:class{get Te(){return this._instance.config}constructor(t){this.Fa=void 0,this._surveyManager=null,this.La=!1,this.$a=[],this.Aa=null,this.Na=null,this._instance=t,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this.Te.disable_surveys){if(!t.ok)return U.warn("Remote config unavailable. Not loading surveys.");var e=t.config.surveys;if(F(e))return U.warn("Flags not loaded yet. Not loading surveys.");var r=O(e);this.Fa=r?e.length>0:e,U.info("flags response received, isSurveysEnabled: "+this.Fa),this.loadIfEnabled()}}reset(){try{var t;(t=this._surveyEventReceiver)==null||t.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var e=[],r=0;r<localStorage.length;r++){var n=localStorage.key(r);(n!=null&&n.startsWith(Fl)||n!=null&&n.startsWith("inProgressSurvey_"))&&e.push(n)}e.forEach((i=>localStorage.removeItem(i)))}catch{}}loadIfEnabled(){if(!this._surveyManager)if(this.La)U.info("Already initializing surveys, skipping...");else if(this.Te.disable_surveys)U.info(Xu);else if(this.Te.cookieless_mode&&this._instance.consent.isOptedOut())U.info("Not loading surveys in cookieless mode without consent.");else{var t=C?.__PosthogExtensions__;if(t){if(!E(this.Fa)||this.Te.advanced_enable_surveys){var e=this.Fa||this.Te.advanced_enable_surveys;this.La=!0;try{var r=t.generateSurveys;if(r)return void this.Da(r,e);var n=t.loadExternalDependency;if(!n)return void this.qa(Io);n(this._instance,"surveys",(i=>{i||!t.generateSurveys?this.qa("Could not load surveys script",i):this.Da(t.generateSurveys,e)}))}catch(i){throw this.qa("Error initializing surveys",i),i}finally{this.La=!1}}}else U.error("PostHog Extensions not found.")}}Da(t,e){this._surveyManager=t(this._instance,e),this._surveyEventReceiver=new xo(this._instance),U.info("Surveys loaded successfully"),this.ja({isLoaded:!0})}qa(t,e){U.error(t,e),this.ja({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.$a.push(t),this._surveyManager&&this.ja({isLoaded:!0}),()=>{this.$a=this.$a.filter((e=>e!==t))}}getSurveys(t,e){if(e===void 0&&(e=!1),this.Te.disable_surveys)return U.info(Xu),t([]);var r,n=this._instance.get_property(Ds);if(n&&!e)return t(n,{isLoaded:!0}),void(this.Ha()&&this.getSurveys((()=>{}),!0));typeof Promise<"u"&&this.Aa?this.Aa.then((i=>t(i.surveys,i.context))):(typeof Promise<"u"&&(this.Aa=new Promise((i=>{r=i}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Te.token),method:"GET",timestampMode:"query",timeout:this.Te.surveys_request_timeout_ms,callback:i=>{var s;this.Aa=null;var o=i.statusCode;if(o!==200||!i.json){var a="Surveys API could not be loaded, status: "+o;U.error(a),this.Na=Date.now();var u={isLoaded:!1,error:a};return t([],u),void(r==null||r({surveys:[],context:u}))}this.Na=null;var c,l=i.json.surveys||[],d=l.filter((f=>(function(p){return!(!p.start_date||p.end_date)})(f)&&(Ml(f)||(function(p){var g;return!((g=p.conditions)==null||(g=g.actions)==null||(g=g.values)==null||!g.length)})(f))));d.length>0&&((c=this._surveyEventReceiver)==null||c.register(d)),(s=this._instance.persistence)==null||s.register({[Ds]:l,[Cn]:Date.now()});var h={isLoaded:!0};t(l,h),r?.({surveys:l,context:h})}}))}Ha(){return this.Ba()&&!this.Aa&&!this.Ua()}Ba(){var t=this._instance.get_property(Cn);return de(t)&&Date.now()-t>3e5}Ua(){return de(this.Na)&&3e5>Date.now()-this.Na}markSurveyAsSeen(t,e){var r,n={id:t,current_iteration:(r=e?.iteration)!==null&&r!==void 0?r:null};Ll(n);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}}ja(t){for(var e of this.$a)try{if(!t.isLoaded)return e([],t);this.getSurveys(e)}catch(r){U.error("Error in survey callback",r)}}getActiveMatchingSurveys(t,e){if(e===void 0&&(e=!1),!F(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);U.warn("init was not called")}za(t){var e=null;return this.getSurveys((r=>{var n;e=(n=r.find((i=>i.id===t)))!==null&&n!==void 0?n:null})),e}Va(t){if(F(this._surveyManager))return{eligible:!1,reason:hn};var e=typeof t=="string"?this.za(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}Wa(t){if(F(this._surveyManager))return{eligible:!1,reason:hn};var e=typeof t=="string"?this.za(t):t;return e?this._surveyManager.checkSurveyRenderability(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(F(this._surveyManager))return U.warn("init was not called"),{visible:!1,disabledReason:hn};var e=this.Wa(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return F(this._surveyManager)?(U.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:hn})):new Promise((r=>{this.getSurveys((n=>{var i,s=(i=n.find((a=>a.id===t)))!==null&&i!==void 0?i:null;if(s){var o=this.Wa(s);r({visible:o.eligible,disabledReason:o.reason})}else r({visible:!1,disabledReason:"Survey not found"})}),e)}))}renderSurvey(t,e,r){var n;if(F(this._surveyManager))U.warn("init was not called");else{var i=typeof t=="string"?this.za(t):t;if(i!=null&&i.id)if(bf.includes(i.type)){var s=P?.querySelector(e);if(s)return(n=i.appearance)!=null&&n.surveyPopupDelaySeconds?(U.info("Rendering survey "+i.id+" with delay of "+i.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var o,a;U.info("Rendering survey "+i.id+" with delay of "+((o=i.appearance)==null?void 0:o.surveyPopupDelaySeconds)+" seconds"),(a=this._surveyManager)==null||a.renderSurvey(i,s,r),U.info("Survey "+i.id+" rendered")}),1e3*i.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(i,s,r);U.warn("Survey element not found")}else U.warn("Surveys of type "+i.type+" cannot be rendered in the app");else U.warn("Survey not found")}}displaySurvey(t,e){var r;if(F(this._surveyManager))U.warn("init was not called");else{var n=this.za(t);if(n){var i=n;if((r=n.appearance)!=null&&r.surveyPopupDelaySeconds&&e.ignoreDelay&&(i=x({},n,{appearance:x({},n.appearance,{surveyPopupDelaySeconds:0})})),e.displayType!==ro.Popover&&e.initialResponses&&U.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),e.ignoreConditions===!1){var s=this.Va(n);if(!s.eligible)return void U.warn("Survey is not eligible to be displayed: ",s.reason)}e.displayType!==ro.Inline?this._surveyManager.handlePopoverSurvey(i,e):this.renderSurvey(i,e.selector,e.properties)}else U.warn("Survey not found")}}cancelPendingSurvey(t){F(this._surveyManager)?U.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;(t=this._surveyManager)==null||t.handlePageUnload==null||t.handlePageUnload()}}},Xn),Df={toolbar:class{constructor(t){this.instance=t}Za(t){C.ph_toolbar_state=t}Ga(){var t;return(t=C.ph_toolbar_state)!==null&&t!==void 0?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t,e,r){if(t===void 0&&(t=void 0),e===void 0&&(e=void 0),r===void 0&&(r=void 0),Wc(this.instance.config)||!_||!P)return!1;t=t??_.location,r=r??_.history;try{if(!e){try{_.localStorage.setItem("test","test"),_.localStorage.removeItem("test")}catch{return!1}e=_?.localStorage}var n,i=Cf||Dn(t.hash,"__posthog")||Dn(t.hash,"state"),s=i?Su((()=>JSON.parse(atob(decodeURIComponent(i)))))||Su((()=>JSON.parse(decodeURIComponent(i)))):null;return s&&s.action==="ph_authorize"?((n=s).source="url",n&&Object.keys(n).length>0&&(s.desiredHash?t.hash=s.desiredHash:r?r.replaceState(r.state,"",t.pathname+t.search):t.hash="")):((n=JSON.parse(e.getItem(Qu)||"{}")).source="localstorage",delete n.userIntent),!(!n.token||this.instance.config.token!==n.token||(this.loadToolbar(n),0))}catch{return!1}}Qa(t){var e=C.ph_load_toolbar||C.ph_load_editor;!F(e)&&Ze(e)?e(t,this.instance):ec.warn("No toolbar load function found")}loadToolbar(t){var e=!(P==null||!P.getElementById(Qc));if(!_||e)return!1;var r=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,n=x({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(_.localStorage.setItem(Qu,JSON.stringify(x({},n,{source:void 0}))),this.Ga()===2)this.Qa(n);else if(this.Ga()===0){var i;this.Za(1),(i=C.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this.instance,"toolbar",(s=>{if(s)return ec.error("[Toolbar] Failed to load",s),void this.Za(0);this.Za(2),this.Qa(n)})),re(_,"turbolinks:load",(()=>{this.Za(0),this.loadToolbar(n)}))}return!0}Ja(t){return this.loadToolbar(t)}maybeLoadEditor(t,e,r){return t===void 0&&(t=void 0),e===void 0&&(e=void 0),r===void 0&&(r=void 0),this.maybeLoadToolbar(t,e,r)}}},jf=x({experiments:wo},Xn),Uf={conversations:class{constructor(t){this.Ka=void 0,this._conversationsManager=null,this.Ya=!1,this.Xa=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations&&t.ok){var e=t.config.conversations;F(e)||(Ne(e)?this.Ka=e:(this.Ka=e.enabled,this.Xa=e),this.loadIfEnabled())}}reset(){var t;(t=this._conversationsManager)==null||t.reset(),this._conversationsManager=null,this.Ka=void 0,this.Xa=null}loadIfEnabled(){if(!(this._conversationsManager||this.Ya||this._instance.config.disable_conversations||Wc(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=C?.__PosthogExtensions__;if(t&&!E(this.Ka)&&this.Ka)if(this.Xa&&this.Xa.token){this.Ya=!0;try{var e=t.initConversations;if(e)return this.el(e),void(this.Ya=!1);var r=t.loadExternalDependency;if(!r)return void this.tl(Io);r(this._instance,"conversations",(n=>{n||!t.initConversations?this.tl("Could not load conversations script",n):this.el(t.initConversations),this.Ya=!1}))}catch(n){this.tl("Error initializing conversations",n),this.Ya=!1}}else Ie.error("Conversations enabled but missing token in remote config.")}}el(t){if(this.Xa)try{this._conversationsManager=t(this.Xa,this._instance),Ie.info("Conversations loaded successfully")}catch(e){this.tl("Error completing conversations initialization",e)}else Ie.error("Cannot complete initialization: remote config is null")}tl(t,e){Ie.error(t,e),this._conversationsManager=null,this.Ya=!1}show(){this._conversationsManager?this._conversationsManager.show():Ie.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Ka===!0&&!me(this._conversationsManager)}isVisible(){var t,e;return(t=(e=this._conversationsManager)==null?void 0:e.isVisible())!==null&&t!==void 0&&t}sendMessage(t,e,r){var n=this;return ne((function*(){return n._conversationsManager?n._conversationsManager.sendMessage(t,e,r):(Ie.warn(Pt),null)}))()}getMessages(t,e){var r=this;return ne((function*(){return r._conversationsManager?r._conversationsManager.getMessages(t,e):(Ie.warn(Pt),null)}))()}markAsRead(t){var e=this;return ne((function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(Ie.warn(Pt),null)}))()}getTickets(t){var e=this;return ne((function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(Ie.warn(Pt),null)}))()}requestRestoreLink(t){var e=this;return ne((function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(Ie.warn(Pt),null)}))()}restoreFromToken(t){var e=this;return ne((function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(Ie.warn(Pt),null)}))()}restoreFromUrlToken(){var t=this;return ne((function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(Ie.warn(Pt),null)}))()}getCurrentTicketId(){var t,e;return(t=(e=this._conversationsManager)==null?void 0:e.getCurrentTicketId())!==null&&t!==void 0?t:null}getWidgetSessionId(){var t,e;return(t=(e=this._conversationsManager)==null?void 0:e.getWidgetSessionId())!==null&&t!==void 0?t:null}En(){var t;(t=this._conversationsManager)==null||t.setIdentity()}Rn(){var t;(t=this._conversationsManager)==null||t.clearIdentity()}}},Hf={logs:class{constructor(t){var e;this.rl=!1,this.il=!1,this.Ge=X("[logs]"),this.Gr=[],this.nl=[],this.Hs=0,this.sl=()=>{var r,n;this.Hs=0,(r=this.ol)==null||r.onReconnect(),(n=this.al)==null||n.onReconnect()},this._instance=t,this._instance&&(e=this._instance.config.logs)!=null&&e.captureConsoleLogs&&(this.rl=!0),_&&re(_,"online",this.sl)}ll(t,e,r,n){var i,s=(function(o,a){var u,c,l,d,h,f,p,g=(u=o?.flushIntervalMs)!==null&&u!==void 0?u:3e3,m=(c=o?.maxBufferSize)!==null&&c!==void 0?c:100,v=a!=null&&a.consoleCapture?void 0:(l=o?.maxLogsPerInterval)!==null&&l!==void 0?l:1e3,w=E(v)?Math.max(m,2048):Math.max(m,v),y=o?.resourceAttributes;return{serviceName:(d=(h=y?.["service.name"])!==null&&h!==void 0?h:o?.serviceName)!==null&&d!==void 0?d:a?.serviceNameDefault,serviceVersion:(f=y?.["service.version"])!==null&&f!==void 0?f:o?.serviceVersion,environment:(p=y?.["deployment.environment"])!==null&&p!==void 0?p:o?.environment,resourceAttributes:y,beforeSend:o?.beforeSend,flushIntervalMs:g,maxBufferSize:m,maxQueueSize:w,maxBatchRecordsPerPost:100,rateCapWindowMs:g,maxLogsPerInterval:v,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}})((i=this._instance)==null||(i=i.config)==null?void 0:i.logs,r);return[new yp(this.ul(t,e),s,this.Ge,(()=>this.hl()),(o=>o()),void 0,n),s]}dl(){var t,e=(t=this._instance)==null||(t=t.config)==null?void 0:t.logs;if(!this.ol||this.cl!==e){var r;(r=this.ol)==null||r.reset(),this.cl=e;var n=this.ll((()=>this.Gr),(i=>{this.Gr=i}));this.ol=n[0],this.vl=n[1]}return this.ol}fl(){var t,e=(t=this._instance)==null||(t=t.config)==null?void 0:t.logs;if(!this.al||this.pl!==e){var r;(r=this.al)==null||r.reset(),this.pl=e;var n=this.ll((()=>this.nl),(i=>{this.nl=i}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},ic);this.al=n[0],this.gl=n[1]}return this.al}initialize(){this.loadIfEnabled()}onRemoteConfig(t){var e;if(t.ok){var r=(e=t.config.logs)==null?void 0:e.captureConsoleLogs;!F(r)&&r&&(this.rl=!0,this.loadIfEnabled())}}reset(){var t,e;this.Gr=[],(t=this.ol)==null||t.reset(),this.nl=[],(e=this.al)==null||e.reset(),this.Hs=0}captureLog(t){this.dl().captureLog(t)}le(t){this.fl().captureLog(t)}get logger(){return this.ml||(this.ml={trace:(t,e)=>this.captureLog({body:t,level:"trace",attributes:e}),debug:(t,e)=>this.captureLog({body:t,level:"debug",attributes:e}),info:(t,e)=>this.captureLog({body:t,level:"info",attributes:e}),warn:(t,e)=>this.captureLog({body:t,level:"warn",attributes:e}),error:(t,e)=>this.captureLog({body:t,level:"error",attributes:e}),fatal:(t,e)=>this.captureLog({body:t,level:"fatal",attributes:e})}),this.ml}flushLogs(t){t?this.yl(t):(this.ol&&this.ol.flush().catch((e=>this.Ge.error("PostHog logs flush failed:",e))),this.al&&this.al.flush().catch((e=>this.Ge.error("PostHog logs flush failed:",e))))}loadIfEnabled(){if(this.rl&&!this.il){var t=C?.__PosthogExtensions__;if(t){var e=t.loadExternalDependency;e?e(this._instance,"logs",(r=>{var n;r||(n=t.logs)==null||!n.initializeLogs?this.Ge.error("Could not load logs script",r):(t.logs.initializeLogs(this._instance),this.il=!0)})):this.Ge.error(Io)}else this.Ge.error("PostHog Extensions not found.")}}ul(t,e){var r=this._instance;return{get isDisabled(){return!1},get optedOut(){return!r.is_capturing()},getPersistedProperty:n=>n===rt.LogsQueue?t():void 0,setPersistedProperty(n,i){var s;n===rt.LogsQueue&&e((s=i)!==null&&s!==void 0?s:[])},Tt:n=>this.Tt(n),getLibraryId:()=>j.LIB_NAME,getLibraryVersion:()=>j.LIB_VERSION}}Tt(t){return new Promise((e=>{if(pl(this.Hs,3))e({kind:"fatal",error:new Error("logs endpoint is unreachable, dropping batch")});else{var r=!1,n=s=>{r||(r=!0,clearTimeout(i),e(s))},i=setTimeout((()=>n({kind:"retry-later",error:new Error("logs request timed out")})),9e4);this._instance._send_request({method:"POST",url:this.bl(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:s=>{var o=s.statusCode;if(this._l(o),o>=200&&300>o)n({kind:"ok"});else if(o===413)n({kind:"too-large"});else if(o!==0&&o!==429&&500>o)n({kind:"fatal",error:new Error("logs request failed with status "+o)});else{var a;n({kind:"retry-later",error:(a=s.error)!==null&&a!==void 0?a:new Error("logs request failed with status "+o)})}}})}}))}_l(t){(t!==0||this._instance.__loaded)&&(this.Hs=fl(t,this.Hs,3,(()=>this.Ge.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes."))))}yl(t){this.Gr.length>0&&this.wl(t,this.Gr,this.vl,j.LIB_NAME,(e=>{this.Gr=e})),this.nl.length>0&&this.wl(t,this.nl,this.gl,ic,(e=>{this.nl=e}))}wl(t,e,r,n,i){if(e.length!==0){var s=e.map((a=>a.record));i([]);var o=Mc(s,Oc(r,j.LIB_NAME,j.LIB_VERSION),n,j.LIB_VERSION);this._instance._send_request({method:"POST",url:this.bl(),data:o,compression:"best-available",batchKey:"logs",transport:t})}}bl(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}hl(){var t,e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var r=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),n=r.windowId,i=r.sessionStartTimestamp,s=r.lastActivityTimestamp;e.sessionId=r.sessionId,e.windowId=n,F(i)||(e.sessionStartTimestamp=i),F(s)||(e.lastActivityTimestamp=s)}if(C!=null&&(t=C.location)!=null&&t.href&&(e.currentUrl=this._instance.config.disable_capture_url_hashes?ft(C.location.href):C.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(e.activeFeatureFlags=o)}return e}}},Bf={metrics:class{constructor(t){this.Ge=X("[metrics]"),this._instance=t}initialize(){}dl(){var t,e,r=(t=this._instance)==null||(t=t.config)==null?void 0:t.metrics;return this.ol&&this.cl===r||((e=this.ol)==null||e.reset(),this.cl=r,this.ol=new bp(this.ul(),(function(n){var i,s,o,a,u,c=n?.resourceAttributes;return{serviceName:(i=c?.["service.name"])!==null&&i!==void 0?i:n?.serviceName,serviceVersion:(s=c?.["service.version"])!==null&&s!==void 0?s:n?.serviceVersion,environment:(o=c?.["deployment.environment"])!==null&&o!==void 0?o:n?.environment,resourceAttributes:c,beforeSend:n?.beforeSend,flushIntervalMs:(a=n?.flushIntervalMs)!==null&&a!==void 0?a:1e4,maxSeriesPerFlush:(u=n?.maxSeriesPerFlush)!==null&&u!==void 0?u:1e3}})(r),this.Ge)),this.ol}count(t,e,r){e===void 0&&(e=1),this.dl().count(t,e,r)}gauge(t,e,r){this.dl().gauge(t,e,r)}histogram(t,e,r){this.dl().histogram(t,e,r)}flush(t){if(!this.ol)return Promise.resolve();if(t){var e=this.ol.drainWindow();return e&&this.Bt(e,t),Promise.resolve()}return this.ol.flush().catch((r=>this.Ge.error("PostHog metrics flush failed:",r)))}reset(){var t;(t=this.ol)==null||t.reset()}ul(){var t=this._instance,e=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},Bt:r=>e.Bt(r),getLibraryId:()=>j.LIB_NAME,getLibraryVersion:()=>j.LIB_VERSION}}Bt(t,e){return new Promise((r=>{var n=!1,i=o=>{n||(n=!0,clearTimeout(s),r(o))},s=setTimeout((()=>i({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request(x({method:"POST",url:this.xl(),data:t,compression:"best-available",batchKey:"metrics"},e&&{transport:e},{fireCallbackOnDrop:!0,callback(o){var a=o.statusCode;if(a>=200&&300>a)i({kind:"ok"});else if(a===413)i({kind:"too-large"});else if(a!==0&&a!==429&&500>a)i({kind:"fatal",error:new Error("metrics request failed with status "+a)});else{var u;i({kind:"retry-later",error:(u=o.error)!==null&&u!==void 0?u:new Error("metrics request failed with status "+a)})}}}))}))}xl(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},Gf=x({},Xn,Af,Of,Mf,Ff,Lf,Nf,Zf,Df,jf,Uf,Hf,Bf);Ot.__defaultExtensionClasses=x({},Gf);var ue=(function(){j.SDK_DIST_CHANNEL="npm";var t=Ar[Bt]=new Ot;return(function(){function e(){e.done||(e.done=!0,Nl=!1,B(Ar,(function(r){r._dom_loaded()})))}P!=null&&P.addEventListener?P.readyState==="complete"?e():re(P,"DOMContentLoaded",e,{capture:!1}):_&&$.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),t})();var Dl="0.0.0.0",jl="$ip",Ul="$geoip_disable";function Hl(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Jf(t){return Hl(t)?{...t,properties:{...Hl(t.properties)?t.properties:{},[jl]:Dl,[Ul]:!0}}:t}function Bl(t){let e=t;return{link:r=>e?r:Jf(r),set:r=>{e=r}}}function Gl(t,e){if(typeof e!="boolean"){console.warn("[HeyCatch] setIpCollection() takes true or false - the call was ignored.");return}if(t===null){console.warn(`[HeyCatch] setIpCollection(${String(e)}) was called before init(), so it was NOT applied. Pass collectIp to init() instead, or call setIpCollection() after it.`);return}t.set(e)}var Vl="[redacted]",Yf=/(^|[#&?])(access_token|refresh_token|token_hash|token)=[^\s#&"'<>]+/gi,Xf=/(^|[^\w-])eyJ[\w-]+\.[\w-]+\.[\w-]+/g;function ql(t){return t.replaceAll(Yf,`$1$2=${Vl}`).replaceAll(Xf,`$1${Vl}`)}var Qf=new Set(["$anon_distinct_id","distinct_id"]),eg=["$set","$set_once"];function Do(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function jo(t){return typeof t=="string"?ql(t):Array.isArray(t)?tg(t):Do(t)?Kl(t,()=>!0):t}function tg(t){let e=t.map(r=>jo(r));return e.some((r,n)=>r!==t[n])?e:t}function Kl(t,e){let r=!1,n=[];for(let[i,s]of Object.entries(t)){let o=e(i)?jo(s):s;o!==s&&(r=!0),n.push([i,o])}return r?Object.fromEntries(n):t}function Wl(t){if(!Do(t))return t;try{let e=!1,r={...t},{properties:n}=t;if(Do(n)){let i=Kl(n,s=>!Qf.has(s));i!==n&&(e=!0,r.properties=i)}for(let i of eg){let s=t[i],o=jo(s);o!==s&&(e=!0,r[i]=o)}return e?r:t}catch{return t}}var[rg,ng,ig]=lr,sg="$posthog_cookieless",og=Symbol.for("heycatch.tracing-headers");function Xl(t,e){let r=globalThis,n=r[og]??={hostnames:new Set,source:e,refused:new Set,fetchPatched:!1,xhrPatched:!1};n.hostnames=new Set(t),n.source=e;let i=[];!n.fetchPatched&&typeof globalThis.fetch=="function"&&(n.fetchPatched=cg(n),n.fetchPatched||i.push("fetch")),!n.xhrPatched&&typeof globalThis.XMLHttpRequest=="function"&&typeof globalThis.XMLHttpRequest.prototype.open=="function"&&typeof globalThis.XMLHttpRequest.prototype.send=="function"&&typeof globalThis.XMLHttpRequest.prototype.setRequestHeader=="function"&&(n.xhrPatched=dg(n),n.xhrPatched||i.push("XMLHttpRequest")),i.length>0&&n.readOnlyWarned!==!0&&(n.readOnlyWarned=!0,console.warn(`[HeyCatch] ${i.join(" and ")} is read-only on this page, so the session headers are not sent on its requests and server events lose the session link. Analytics is unaffected.`))}function ag({allowSetter:t,key:e,target:r}){for(let n=r;n!==null;n=Object.getPrototypeOf(n)){let i=Object.getOwnPropertyDescriptor(n,e);if(i!==void 0)return"value"in i||"writable"in i?i.writable===!0&&(n===r||Object.isExtensible(r)):t&&i.set!==void 0}return Object.isExtensible(r)}function Ql(t,e){let r=Object.keys(e),n=r.length===1;if(!r.every(s=>ag({allowSetter:n,key:s,target:t})))return!1;let i=new Map;try{for(let s of r)if(i.set(s,Reflect.get(t,s)),!Reflect.set(t,s,e[s]))break;if(r.every(s=>Reflect.get(t,s)===e[s]))return!0}catch{}for(let[s,o]of i)try{Reflect.set(t,s,o)}catch{}return!1}function ed(t,e){let r;try{r=new URL(e,globalThis.location.href)}catch{return null}return!t.hostnames.has(r.hostname)||t.refused.has(r.host)?null:{url:r,sameOrigin:r.origin===globalThis.location.origin}}function Ho(t,e){let r=[],n=t.source.sessionAndWindowId();r.push([rg,n?.sessionId],[ng,n?.windowId]);let i=t.source.distinctId();r.push([ig,i===sg?void 0:i]);let s=!1;for(let[o,a]of r)a&&!e.has(o)&&(e.set(o,a),s=!0);return s}function td(t,e){t.refused.has(e.host)||(t.refused.add(e.host),console.warn(`[HeyCatch] a request to ${e.host} failed with the session headers on, so they are no longer sent there on this page and its server events lose the session link. If ${e.host} is your own backend, add TRACING_HEADERS (${lr.join(", ")}) to its CORS Access-Control-Allow-Headers; otherwise remove it from tracingHosts.`))}function Jl(t){return typeof Request<"u"&&(t instanceof Request||Object.prototype.toString.call(t)==="[object Request]")}function rd(t){return typeof t=="object"&&t!==null||typeof t=="function"}function ug(t,e){if(t===void 0)return{headers:e};if(typeof Proxy>"u"||typeof Reflect>"u"){let i=Object.create(t);return Object.defineProperty(i,"headers",{configurable:!0,enumerable:!0,value:e,writable:!0}),i}let r=t,n={headers:e};return new Proxy(n,{get:(i,s)=>Object.hasOwn(i,s)?Reflect.get(i,s):Reflect.get(r,s,r),has:(i,s)=>Object.hasOwn(i,s)||s in r,ownKeys:i=>[...new Set([...Reflect.ownKeys(i),...Reflect.ownKeys(r)])],getOwnPropertyDescriptor:(i,s)=>{let o=Reflect.getOwnPropertyDescriptor(i,s)??Reflect.getOwnPropertyDescriptor(r,s);return o?{...o,configurable:!0}:void 0},getPrototypeOf:()=>Object.getPrototypeOf(r)})}function cg(t){let e=globalThis.fetch;return Ql(globalThis,{fetch:function(...i){let s=i,o=null;try{let[c,l]=i,d=Jl(c)?c.url:c instanceof URL?c.href:c;if(o=ed(t,d),o!==null)if(Jl(c)){let h=new Request(c,l);Ho(t,h.headers)||(o=null),s=[h]}else if(l===void 0||rd(l)){let h=new Headers(l?.headers);Ho(t,h)?s=[c,ug(l,h)]:o=null}else o=null}catch{s=i,o=null}let a=Reflect.apply(e,this,s);if(o===null||o.sameOrigin||!lg(a))return a;let{url:u}=o;return a.then(void 0,c=>{throw c instanceof TypeError&&td(t,u),c})}})}function lg(t){return rd(t)&&typeof t.then=="function"}var Uo=new WeakMap,jr=new WeakMap,Qn=new WeakMap,Yl=new WeakSet;function dg(t){let e=globalThis.XMLHttpRequest.prototype,{open:r,send:n,setRequestHeader:i}=e;return Ql(e,{open:function(...c){let l=new Headers,d=null;try{let h=c[1];d=ed(t,String(h instanceof URL?h.href:h)),d!==null&&!Ho(t,l)&&(d=null)}catch{d=null}if(Reflect.apply(r,this,c),Qn.delete(this),d===null){jr.delete(this),Uo.set(this,null);return}jr.set(this,l);try{Yl.has(this)||(Yl.add(this),this.addEventListener("error",()=>{let h=Uo.get(this);h&&this.status===0&&td(t,h)})),Uo.set(this,d.sameOrigin?null:d.url)}catch{}},send:function(...c){let l=jr.get(this);if(l!==void 0){jr.delete(this);let d=Qn.get(this);for(let[h,f]of l)if(d?.has(h)!==!0)try{Reflect.apply(i,this,[h,f])}catch{}}Reflect.apply(n,this,c)},setRequestHeader:function(...c){Reflect.apply(i,this,c);try{if(jr.has(this)){let l=Qn.get(this)??new Set;l.add(c[0].toLowerCase()),Qn.set(this,l)}}catch{}}})}var hg=5e3,pg=60,fg=1e3,gg=60,_g=new Set(["$set"]),Bo="heycatch_volume_cap_reached",nd=3,vg=6e4;function ei({bucket:t,perMinute:e,now:r}){if(t===void 0)return e;let n=Math.max(0,r-t.at);return Math.min(e,t.tokens+n*e/vg)}function mg(t){return t===void 0||t.length===0?!1:ai(yg(t))}function yg(t){if(t.startsWith("[")){let r=t.indexOf("]");return r===-1?t:t.slice(0,r+1)}let e=t.indexOf(":");return e!==-1&&e===t.lastIndexOf(":")?t.slice(0,e):t}function id(t){let{$session_id:e,$host:r}=t.properties;return{sessionId:typeof e=="string"?e:"",host:typeof r=="string"?r:void 0}}var od=4;function sd(t){if(t!==void 0)return typeof t=="object"&&t!==null&&"tokens"in t&&typeof t.tokens=="number"&&Number.isFinite(t.tokens)&&t.tokens>=0&&"at"in t&&typeof t.at=="number"&&Number.isFinite(t.at)?{tokens:t.tokens,at:t.at}:!1}function bg(t){if(typeof t=="object"&&t!==null&&"sessionId"in t&&typeof t.sessionId=="string"&&"count"in t&&typeof t.count=="number"&&Number.isInteger(t.count)&&t.count>=0&&"markerAttempts"in t&&typeof t.markerAttempts=="number"&&Number.isInteger(t.markerAttempts)&&t.markerAttempts>=0){let e=sd("person"in t?t.person:void 0),r=sd("localhost"in t?t.localhost:void 0);if(e!==!1&&r!==!1)return{sessionId:t.sessionId,count:t.count,markerAttempts:t.markerAttempts,person:e,localhost:r}}return null}function xg(t){if(t===null)return[];try{let e=JSON.parse(t);if(Array.isArray(e))return e.flatMap(r=>{let n=bg(r);return n===null?[]:[n]}).slice(0,od)}catch{}return[]}function ad({store:t,warn:e,emitMarker:r,cap:n=hg,personUpdateBudget:i=pg,localhostFreeEvents:s=fg,localhostRatePerMinute:o=gg,now:a=Date.now}){let u=[],c=!1,l=!1,d=!1,h=!1;function f(){if(t===void 0||c)return u;try{return xg(t.read())}catch{return u}}function p(v){let w=f().filter(y=>y.sessionId!==v.sessionId);u=[v,...w].slice(0,od);try{t?.write(JSON.stringify(u))}catch{c=!0}}function g(v){let w=f().find(R=>R.sessionId===v),y=u.find(R=>R.sessionId===v),k=[w,y].filter(R=>R!==void 0),T=a();function M(R,b){let S;for(let{[R]:z}of k)z!==void 0&&ei({bucket:z,perMinute:b,now:T})<ei({bucket:S,perMinute:b,now:T})&&(S=z);return S}return{sessionId:v,count:Math.max(0,...k.map(R=>R.count)),markerAttempts:Math.max(0,...k.map(R=>R.markerAttempts)),person:M("person",i),localhost:M("localhost",o)}}function m(v,w){let y=w,k=a(),{sessionId:T,host:M}=id(v);y.person!==void 0&&y.person.at>k&&(y={...y,person:{...y.person,at:k}},p(y)),y.localhost!==void 0&&y.localhost.at>k&&(y={...y,localhost:{...y.localhost,at:k}},p(y));let R=_g.has(v.event),b=R?ei({bucket:y.person,perMinute:i,now:k}):0;if(R&&b<1)return d||(d=!0,e(`[HeyCatch] setPersonProperties is being called more than ${i} times a minute - call it when a property changes, not on every render. Dropping the extra updates for now; other events are unaffected.`)),null;let S=y.count>=s&&mg(M),z=S?ei({bucket:y.localhost,perMinute:o,now:k}):0;return S&&z<1?(h||(h=!0,e(`[HeyCatch] this local dev session (${M??"unknown host"}, session ${T||"unknown"}) sent ${s} events - throttling it to ${o} a minute so a dev loop cannot flood your analytics. Production traffic is unaffected.`)),null):(p({...y,count:y.count+1,...R?{person:{tokens:b-1,at:k}}:{},...S?{localhost:{tokens:z-1,at:k}}:{}}),v)}return v=>{if(v===null||v.event===Bo)return v;let{sessionId:w}=id(v),y=g(w);return y.count<n?m(v,y):(l||(l=!0,e(`[HeyCatch] this session sent ${n} events, the per-session cap - dropping the rest until a new session starts (session ${w||"unknown"}). A tracking call inside a render loop or an effect is the usual cause.`)),y.markerAttempts<nd&&(p({...y,markerAttempts:nd}),r({cap:n,sessionId:w})||p({...y,markerAttempts:y.markerAttempts+1})),null)}}var ud="heycatch_session_volume",wg={read:()=>globalThis.localStorage.getItem(ud),write:t=>{globalThis.localStorage.setItem(ud,t)}};function cd(t){return ad({store:t?void 0:wg,warn:e=>{console.warn(e)},emitMarker:({cap:e})=>ue.capture(Bo,{heycatch_session_event_cap:e})!==void 0})}var dd=!1;function De(){return dd}function kg(){dd=!0}function Eg(t){try{return new URL(t.includes("://")?t:`https://${t}`).hostname}catch{return t}}var $g=[{key:"autocapture",triggeredBy:!1,cost:"no automatic click/form-submit capture - the dashboard only sees events you call trackEvent for yourself (pageviews and rage-clicks are captured separately and are unaffected)"},{key:"maskAllText",triggeredBy:!0,cost:"autocaptured elements lose their text, which blanks the recap's friction labels"},{key:"maskAllElementAttributes",triggeredBy:!0,cost:"autocaptured elements lose their attributes, which blanks the recap's friction labels"}];function Sg(t){let e=$g.filter(n=>t[n.key]===n.triggeredBy);if(e.length===0)return;let r=e.map(n=>`${n.key} - ${n.cost}`).join("; ");console.info(`[HeyCatch] quality note: ${r}`)}var ld=new Set(["heycatch_agent","heycatch_custom_user_event","heycatch_framework","heycatch_framework_version","heycatch_project_key","heycatch_sdk_stage","heycatch_sdk_version","heycatch_site"]);function Pg(t){let e=t.filter(r=>ld.has(r));return e.length>0&&console.error(`[HeyCatch] propertyDenylist cannot exclude HeyCatch's own attribution keys (${e.join(", ")}) - ignoring those entries.`),t.filter(r=>!ld.has(r))}function Tg(t){return{heycatch_sdk_version:xt,heycatch_sdk_stage:bt,heycatch_project_key:t.projectKey,heycatch_framework:t.install.framework,heycatch_framework_version:t.install.frameworkVersion,heycatch_agent:t.install.agent,...t.site===void 0?{}:{heycatch_site:t.site}}}function zg(t,e,r,n){let i=s=>{if(s===null)return null;let o={...s.properties,token:Fi,...r};return"heycatch_site"in r||delete o.heycatch_site,{...s,properties:o}};return[...t===void 0?[]:Array.isArray(t)?t:[t],e,i,n,Wl]}var Go=null,hd=null;function pd(){Go?.()}function fd(t){if(De()||!He()||en())return;let e=nu({stage:bt,hostname:globalThis.location.hostname});if(e!==null){console.error(e);return}let r=iu.safeParse(t);if(!r.success){let l=r.error.issues[0]?.message??"init() requires a config object with { projectKey }.";console.error(`[HeyCatch] ${l}`);return}let n=Bl(r.data.collectIp!==!1);console.info(`[HeyCatch] SDK v${xt} (${bt}) initialized \u2192 ${Mi}`);let i=ru(r.data.projectKey);i!==null&&console.warn(i);let s={api_host:Mi,defaults:"2026-01-30",disable_compression:!0,disable_session_recording:!0,disable_surveys:!0,advanced_disable_flags:!0,mask_personal_data_properties:!0,opt_out_persistence_by_default:!0,rageclick:!0,rate_limiting:{events_per_second:5,events_burst_limit:50},...r.data.autocapture===void 0?{}:{autocapture:r.data.autocapture},...r.data.maskAllText===void 0?{}:{mask_all_text:r.data.maskAllText},...r.data.maskAllElementAttributes===void 0?{}:{mask_all_element_attributes:r.data.maskAllElementAttributes},...r.data.propertyDenylist===void 0?{}:{property_denylist:Pg(r.data.propertyDenylist)},...r.data.sanitizeProperties===void 0?{}:{sanitize_properties:r.data.sanitizeProperties},before_send:zg(r.data.beforeSend,cd(r.data.disablePersistence===!0||r.data.persistence==="memory"),Tg(r.data),n.link),...r.data.persistence===void 0?{}:{persistence:r.data.persistence},...r.data.disablePersistence===void 0?{}:{disable_persistence:r.data.disablePersistence},...r.data.cookieExpirationDays===void 0?{}:{cookie_expiration:r.data.cookieExpirationDays},...r.data.optOutCapturingByDefault===void 0?{}:{opt_out_capturing_by_default:r.data.optOutCapturingByDefault},...r.data.respectDnt===void 0?{}:{respect_dnt:r.data.respectDnt},...r.data.requestBatching===void 0?{}:{request_batching:r.data.requestBatching},...r.data.flushIntervalMs===void 0?{}:{request_queue_config:{flush_interval_ms:r.data.flushIntervalMs}}};Sg(r.data),ue.init(Fi,s);let o=[...new Set([...globalThis.location.hostname?[globalThis.location.hostname]:[],...r.data.tracingHosts.map(l=>Eg(l))])];if(o.length>0)try{Xl(o,{sessionAndWindowId:()=>ue.sessionManager?.checkAndGetSessionAndWindowId(!0),distinctId:()=>ue.get_distinct_id()})}catch(l){console.warn("[HeyCatch] could not install the session headers, so server events lose the session link. Analytics is unaffected.",l)}let{install:a,site:u}=r.data,c={heycatch_framework:a.framework,heycatch_framework_version:a.frameworkVersion,heycatch_agent:a.agent,...u===void 0?{}:{heycatch_site:u}};Go=()=>{ue.register({heycatch_sdk_version:xt,heycatch_sdk_stage:bt,heycatch_project_key:r.data.projectKey,...c}),u===void 0&&ue.unregister("heycatch_site")},Go(),r.data.optOutCapturingByDefault!==!0&&tn(),hd=n,kg()}function gd(t){Gl(De()?hd:null,t)}var _d={in:"[HeyCatch] optInCapturing() was called before init(), so the consent grant was NOT recorded - if init() runs with optOutCapturingByDefault: true, capturing stays off. Call init() first, then optInCapturing() once consent is granted.",out:"[HeyCatch] optOutCapturing() was called before init(), so the withdrawal was NOT recorded - capturing starts when init() runs. Call init() first, or pass optOutCapturingByDefault: true to start with capturing off."};function vd(){if(!De()){console.warn(_d.in);return}ue.opt_in_capturing(),tn()}function md(){if(!De()){console.warn(_d.out);return}ue.opt_out_capturing()}function yd(t,e,r){if(!(!De()||!He())){if(typeof t!="string"||t.length===0){console.error("[HeyCatch] setIdentity() requires a non-empty string user id. Pass a stable internal user id from your auth provider \u2014 not an email or session token.");return}ue.get_property("$user_state")==="identified"&&ue.get_distinct_id()!==t&&Vo(),ue.identify(t,e,r)}}function Vo(){!De()||!He()||(ue.reset(),pd())}function bd(t,e,r){if(!(!De()||!He())){if(typeof t!="string"||t.length===0){console.error('[HeyCatch] trackEvent() requires a non-empty event name, e.g. track("signup_completed").');return}if(t.startsWith("$")){console.error(`[HeyCatch] trackEvent() event names cannot start with "$" (got "${t}") - that prefix is reserved for built-in events.`);return}ue.capture(t,{...e,...Rg(r),heycatch_custom_user_event:!0})}}function xd(t,e){!De()||!He()||!t&&!e||ue.setPersonProperties(t,e)}function Rg(t){let e={};return t?.set&&(e.$set=t.set),t?.setOnce&&(e.$set_once=t.setOnce),e}var Cg={init:fd,optInCapturing:vd,optOutCapturing:md,resetIdentity:Vo,setIdentity:yd,setIpCollection:gd,setPersonProperties:xd,trackEvent:bd};en();0&&(module.exports={KNOWN_FRAMEWORKS,KNOWN_INSTALL_AGENTS,SDK_VERSION,STAGE,TRACING_HEADERS,UNKNOWN_INSTALL_VALUE,analytics});
|
|
3
3
|
//# sourceMappingURL=index.cjs.map
|