1(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const n of r)if(n.type==="childList")for(const a of n.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&i(a)}).observe(document,{childList:!0,subtree:!0});function s(r){const n={};return r.integrity&&(n.integrity=r.integrity),r.referrerPolicy&&(n.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?n.credentials="include":r.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function i(r){if(r.ep)return;r.ep=!0;const n=s(r);fetch(r.href,n)}})();var sl="project",il="[a-z0-9]",rl="heycatch",nn;function _e(e,t,s){function i(o,l){if(o._zod||Object.defineProperty(o,"_zod",{value:{def:l,constr:a,traits:new Set},enumerable:!1}),o._zod.traits.has(e))return;o._zod.traits.add(e),t(o,l);let u=a.prototype,c=Object.keys(u);for(let h=0;h<c.length;h++){let d=c[h];d in o||(o[d]=u[d].bind(o))}}let r=(s==null?void 0:s.Parent)??Object;class n extends r{}Object.defineProperty(n,"name",{value:e});function a(o){var l;let u=s!=null&&s.Parent?new n:this;i(u,o),(l=u._zod).deferred??(l.deferred=[]);for(let c of u._zod.deferred)c();return u}return Object.defineProperty(a,"init",{value:i}),Object.defineProperty(a,Symbol.hasInstance,{value:o=>{var l,u;return s!=null&&s.Parent&&o instanceof s.Parent?!0:(u=(l=o==null?void 0:o._zod)==null?void 0:l.traits)==null?void 0:u.has(e)}}),Object.defineProperty(a,"name",{value:e}),a}var Xt=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};(nn=globalThis).__zod_globalConfig??(nn.__zod_globalConfig={});var nl=globalThis.__zod_globalConfig;function oi(e){return nl}function al(e,t){return typeof t=="bigint"?t.toString():t}function ol(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}var an=Symbol("evaluating");function li(e,t,s){let i;Object.defineProperty(e,t,{get(){if(i!==an)return i===void 0&&(i=an,i=s()),i},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}var da="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ji(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ll(e){if(Ji(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let s=t.prototype;return!(Ji(s)===!1||Object.prototype.hasOwnProperty.call(s,"isPrototypeOf")===!1)}function ul(e){return ll(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function cl(e,t,s){let i=new e._zod.constr(t??e._zod.def);return(!t||s!=null&&s.parent)&&(i._zod.parent=e),i}function ui(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function hl(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function ms(e,t=0){var s;if(e.aborted===!0)return!0;for(let i=t;i<e.issues.length;i++)if(((s=e.issues[i])==null?void 0:s.continue)!==!0)return!0;return!1}function dl(e,t=0){var s;if(e.aborted===!0)return!0;for(let i=t;i<e.issues.length;i++)if(((s=e.issues[i])==null?void 0:s.continue)===!1)return!0;return!1}function pa(e,t){return t.map(s=>{var i;return(i=s).path??(i.path=[]),s.path.unshift(e),s})}function ys(e){return typeof e=="string"?e:e==null?void 0:e.message}function ci(e,t,s){var l,u,c,h,d,p;let i=e.message?e.message:ys((c=(u=(l=e.inst)==null?void 0:l._zod.def)==null?void 0:u.error)==null?void 0:c.call(u,e))??ys((h=t==null?void 0:t.error)==null?void 0:h.call(t,e))??ys((d=s.customError)==null?void 0:d.call(s,e))??ys((p=s.localeError)==null?void 0:p.call(s,e))??"Invalid input",{inst:r,continue:n,input:a,...o}=e;return o.path??(o.path=[]),o.message=i,t!=null&&t.reportInput&&(o.input=a),o}var fa=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,al,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},pl=_e("$ZodError",fa),hi=_e("$ZodError",fa,{Parent:Error}),fl=e=>(t,s,i,r)=>{let n=i?{...i,async:!1}:{async:!1},a=t._zod.run({value:s,issues:[]},n);if(a instanceof Promise)throw new Xt;if(a.issues.length){let o=new((r==null?void 0:r.Err)??e)(a.issues.map(l
vendor: 4,790 bytes, line 1
1=>ci(l,n,oi())));throw da(o,r==null?void 0:r.callee),o}return a.value},vl=fl(hi),gl=e=>async(t,s,i,r)=>{let n=i?{...i,async:!0}:{async:!0},a=t._zod.run({value:s,issues:[]},n);if(a instanceof Promise&&(a=await a),a.issues.length){let o=new((r==null?void 0:r.Err)??e)(a.issues.map(l=>ci(l,n,oi())));throw da(o,r==null?void 0:r.callee),o}return a.value},_l=gl(hi),ml=e=>(t,s,i)=>{let r=i?{...i,async:!1}:{async:!1},n=t._zod.run({value:s,issues:[]},r);if(n instanceof Promise)throw new Xt;return n.issues.length?{success:!1,error:new(e??pl)(n.issues.map(a=>ci(a,r,oi())))}:{success:!0,data:n.value}},va=ml(hi),yl=e=>async(t,s,i)=>{let r=i?{...i,async:!0}:{async:!0},n=t._zod.run({value:s,issues:[]},r);return n instanceof Promise&&(n=await n),n.issues.length?{success:!1,error:new e(n.issues.map(a=>ci(a,r,oi())))}:{success:!0,data:n.value}},ga=yl(hi),bl=e=>{let t=e?`[\\s\\S]{${(e==null?void 0:e.minimum)??0},${(e==null?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},wl=_e("$ZodCheck",(e,t)=>{var s;e._zod??(e._zod={}),e._zod.def=t,(s=e._zod).onattach??(s.onattach=[])}),xl=_e("$ZodCheckStringFormat",(e,t)=>{var s,i;wl.init(e,t),e._zod.onattach.push(r=>{let n=r._zod.bag;n.format=t.format,t.pattern&&(n.patterns??(n.patterns=new Set),n.patterns.add(t.pattern))}),t.pattern?(s=e._zod).check??(s.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(i=e._zod).check??(i.check=()=>{})}),El=_e("$ZodCheckRegex",(e,t)=>{xl.init(e,t),e._zod.check=s=>{t.pattern.lastIndex=0,!t.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:"regex",input:s.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),kl={major:4,minor:4,patch:3},ps=_e("$ZodType",(e,t)=>{var r;var s;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=kl;let i=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&i.unshift(e);for(let n of i)for(let a of n._zod.onattach)a(e);if(i.length===0)(s=e._zod).deferred??(s.deferred=[]),(r=e._zod.deferred)==null||r.push(()=>{e._zod.run=e._zod.parse});else{let n=(o,l,u)=>{let c=ms(o),h;for(let d of l){if(d._zod.def.when){if(dl(o)||!d._zod.def.when(o))continue}else if(c)continue;let p=o.issues.length,f=d._zod.check(o);if(f instanceof Promise&&(u==null?void 0:u.async)===!1)throw new Xt;if(h||f instanceof Promise)h=(h??Promise.resolve()).then(async()=>{await f,o.issues.length!==p&&(c||(c=ms(o,p)))});else{if(o.issues.length===p)continue;c||(c=ms(o,p))}}return h?h.then(()=>o):o},a=(o,l,u)=>{if(ms(o))return o.aborted=!0,o;let c=n(l,i,u);if(c instanceof Promise){if(u.async===!1)throw new Xt;return c.then(h=>e._zod.parse(h,u))}return e._zod.parse(c,u)};e._zod.run=(o,l)=>{if(l.skipChecks)return e._zod.parse(o,l);if(l.direction==="backward"){let c=e._zod.parse({value:o.value,issues:[]},{...l,skipChecks:!0});return c instanceof Promise?c.then(h=>a(h,o,l)):a(c,o,l)}let u=e._zod.parse(o,l);if(u instanceof Promise){if(l.async===!1)throw new Xt;return u.then(c=>n(c,i,l))}return n(u,i,l)}}li(e,"~standard",()=>({validate:n=>{var a;try{let o=va(e,n);return o.success?{value:o.data}:{issues:(a=o.error)==null?void 0:a.issues}}catch{return ga(e,n).then(o=>{var l;return o.success?{value:o.data}:{issues:(l=o.error)==null?void 0:l.issues}})}},vendor:"zod",version:1}))}),Sl=_e("$ZodString",(e,t)=>{var s;ps.init(e,t),e._zod.pattern=[...((s=e==null?void 0:e._zod.bag)==null?void 0:s.patterns)??[]].pop()??bl(e._zod.bag),e._zod.parse=(i,r)=>{if(t.coerce)try{i.value=String(i.value)}catch{}return typeof i.value=="string"||i.issues.push({expected:"string",code:"invalid_type",input:i.value,inst:e}),i}});function on(e,t,s){e.issues.length&&t.issues.push(...pa(s,e.issues)),t.value[s]=e.value}var Pl=_e("$ZodArray",(e,t)=>{ps.init(e,t),e._zod.parse=(s,i)=>{let r=s.value;if(!Array.isArray(r))return s.issues.push({expected:"array",code:"invalid_type",input:r,inst:e}),s;s.value=Array(r.length);let n=[];for(let a=0;a<r.length;a++){let o=r[a],l=t.element._zod.run({value:o,issues:[]},i);l instanceof Promise?n.push(l.then(u=>on(u,s,a))):on(l,s,a)}return n.length?Promise.all(n).then(()=>s):s}});function Ds(e,t,s,i,r,n){let a=s in i;if(e.issues.length){if(r&&n&&!a)return;t.issues.push(...pa(s,e.issues))}if(!a&&!r){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[s]});return}e.value===void 0?a&&(t.value[s]=void 0):t.value[s]=e.value}function Tl(e){var i,r,n,a;let t=Object.keys(e.shape);for(let o of t)if(!((a=(n=(r=(i=e.shape)==null?void 0:i[o])==null?void 0:r._zod)==null?void 0:n.traits)!=null&&a.has("$ZodType")))throw new Error(`Invalid element at key "${o}": expected a Zod schema`);let s=hl(e.shape);
1return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(s)}}function Fl(e,t,s,i,r,n){let a=[],o=r.keySet,l=r.catchall._zod,u=l.def.type,c=l.optin==="optional",h=l.optout==="optional";for(let d in t){if(d==="__proto__"||o.has(d))continue;if(u==="never"){a.push(d);continue}let p=l.run({value:t[d],issues:[]},i);p instanceof Promise?e.push(p.then(f=>Ds(f,s,d,t,c,h))):Ds(p,s,d,t,c,h)}return a.length&&s.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:n}),e.length?Promise.all(e).then(()=>s):s}var $l=_e("$ZodObject",(e,t)=>{var a;if(ps.init(e,t),!((a=Object.getOwnPropertyDescriptor(t,"shape"))!=null&&a.get)){let o=t.shape;Object.defineProperty(t,"shape",{get:()=>{let l={...o};return Object.defineProperty(t,"shape",{value:l}),l}})}let s=ol(()=>Tl(t));li(e._zod,"propValues",()=>{let o=t.shape,l={};for(let u in o){let c=o[u]._zod;if(c.values){l[u]??(l[u]=new Set);for(let h of c.values)l[u].add(h)}}return l});let i=Ji,r=t.catchall,n;e._zod.parse=(o,l)=>{n??(n=s.value);let u=o.value;if(!i(u))return o.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),o;o.value={};let c=[],h=n.shape;for(let d of n.keys){let p=h[d],f=p._zod.optin==="optional",g=p._zod.optout==="optional",_=p._zod.run({value:u[d],issues:[]},l);_ instanceof Promise?c.push(_.then(m=>Ds(m,o,d,u,f,g))):Ds(_,o,d,u,f,g)}return r?Fl(c,u,o,l,s.value,e):c.length?Promise.all(c).then(()=>o):o}}),Il=_e("$ZodDefault",(e,t)=>{ps.init(e,t),e._zod.optin="optional",li(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(s,i)=>{if(i.direction==="backward")return t.innerType._zod.run(s,i);if(s.value===void 0)return s.value=t.defaultValue,s;let r=t.innerType._zod.run(s,i);return r instanceof Promise?r.then(n=>ln(n,t)):ln(r,t)}});function ln(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}function Ml(e,t){return new e({type:"string",...ui(t)})}function Ol(e,t){return new El({check:"string_format",format:"regex",...ui(t),pattern:e})}var di=_e("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");ps.init(e,t),e.def=t,e.type=t.type,e.parse=(s,i)=>vl(e,s,i,{callee:e.parse}),e.safeParse=(s,i)=>va(e,s,i),e.parseAsync=async(s,i)=>_l(e,s,i,{callee:e.parseAsync}),e.safeParseAsync=async(s,i)=>ga(e,s,i),e.check=(...s)=>e.clone({...t,checks:[...t.checks??[],...s.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]},{parent:!0}),e.with=e.check,e.clone=(s,i)=>cl(e,s,i),e.brand=()=>e,e.register=((s,i)=>(s.add(e,i),e)),e.apply=s=>s(e)}),Rl=_e("ZodMiniString",(e,t)=>{Sl.init(e,t),di.init(e,t)});function Ct(e){return Ml(Rl,e)}var Cl=_e("ZodMiniArray",(e,t)=>{Pl.init(e,t),di.init(e,t)});function Al(e,t){return new Cl({type:"array",element:e,...ui(t)})}var Ll=_e("ZodMiniObject",(e,t)=>{$l.init(e,t),di.init(e,t),li(e,"shape",()=>t.shape)});function un(e,t){let s={type:"object",shape:e??{},...ui(t)};return new Ll(s)}var Dl=_e("ZodMiniDefault",(e,t)=>{Il.init(e,t),di.init(e,t)});function At(e,t){return new Dl({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():ul(t)}})}var mi="https://in.heycatch.ai",yi="prod",bi="0.7.0",Nl="phc_oiDt6uXiBiEA2aT43SMzMAFE9D4gMVkRP3BtvYRsmHqe";function Mt(){return typeof globalThis.window<"u"}var pt="unknown",jl=un({projectKey:Ct({error:'config.projectKey is missing or malformed â expected a string starting with "hck_pk_". Copy it from your project page in the HeyCatch dashboard.'}).check(Ol(/^hck_pk_/,{error:'config.projectKey is missing or malformed â expected a string starting with "hck_pk_". Copy it from your project page in the HeyCatch dashboard.'})),tracingHosts:At(Al(Ct()),[]),install:At(un({framework:At(Ct(),pt),frameworkVersion:At(Ct(),pt),agent:At(Ct(),pt)}),{framework:pt,frameworkVersion:pt,agent:pt})}),zl=new RegExp(String.raw`^\/(${il})\/?$`),Hl=1e3;function ql(e){return new URLSearchParams({utm_source:rl,utm_campaign:e}).toString()}var Gl=["utm_source","utm_medium","utm_campaign"];function _a(){if(!Mt())return!1;let e=zl.exec(globalThis.location.pathname);if(!e)return!1;let t=e[1];return t===void 0?!1:(globalThis.location.replace(`/?${ql(t)}`),!0)}function Bl(){new URLSearchParams(globalThis.location.search).get("utm_campaign")!==null&&setTimeout(()=>{let e=new URLSearchParams(globalThis.location.search);if(e.get("utm_campaign")===null)return;for(let s of Gl)e.delete(s);let t=e.toString();globalThis.history.replaceState(globalThis.history.state,"",globalThis.location.pathname+(t===""?"":`?${t}`)+globalThis.location.hash)},Hl)}var v=typeof window<"u"?window:void 0,ne=typeof globalThis<"u"?globalThis:v,ue=ne==null?void 0:ne.navigator,x=ne==null?void 0:ne.document,q=ne==null?void 0:ne.location,Dr=ne==null?void 0:ne.fetch,Zi=ne!=null&&ne.XMLHttpRequest&&"withCredentials"in new ne.XMLHttpRequest?ne.XMLHttpRequest:void 0,cn=ne==null?void 0:ne.AbortController,Ul=ne==null?void 0:ne.CompressionStream,de=ue==null?void 0:ue.userAgent;function ma(){return!(!v||v.navigator.onLine===!1)}var Lt=typeof globalThis<"u"?globalThis:v;Lt&&typeof self>"u"&&(Lt.self=Lt),Lt&&typeof File>"u"&&(Lt.File=function(){});var $=v??{},z={DEBUG:!1,LIB_VERSION:"0.2.4",LIB_NAME:"browser-common"};function hn(e,t,s,i,r,n,a){try{var o=e[n](a),l=o.value}catch(u){return void s(u)}
1o.done?t(l):Promise.resolve(l).then(i,r)}function re(e){return function(){var t=this,s=arguments;return new Promise((function(i,r){var n=e.apply(t,s);function a(l){hn(n,i,r,a,o,"next",l)}function o(l){hn(n,i,r,a,o,"throw",l)}a(void 0)}))}}function y(){return y=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var s=arguments[t];for(var i in s)({}).hasOwnProperty.call(s,i)&&(e[i]=s[i])}return e},y.apply(null,arguments)}function ya(e,t){if(e==null)return{};var s={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(t.indexOf(i)!==-1)continue;s[i]=e[i]}return s}var dn=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}};function pn(e){return typeof e=="string"||e}function fn(e){return typeof e=="string"?e:void 0}var Dt,Vl=["$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"],He=(function(e){return e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.EnablePersonProcessing="enable_person_processing",e.PersonMode="person_mode",e.FeatureFlagDetails="feature_flag_details",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",e.BootstrapFeatureFlags="bootstrap_feature_flags",e.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.AiQueue="ai_queue",e.LogsQueue="logs_queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionStartTimestamp="session_start_timestamp",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay",e.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",e.SurveyLastSeenDate="survey_last_seen_date",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config",e.FlagsEndpointWasHit="flags_endpoint_was_hit",e.DeviceId="device_id",e})({}),vn=(function(e){return e.GZipJS="gzip-js",e.Base64="base64",e})({}),Wl=["$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"],Kl=["token"],ba="NativeGzipValidationError",Yi=e=>e.length>=2&&e[0]===31&&e[1]===139,gn=(e,t)=>e===vn.GZipJS||t===vn.GZipJS||t==="gzip",_n=e=>!(!e||typeof e!="object")&&("name"in e?String(e.name):"")==="NotReadableError",bs=e=>{var t=new Error("Native gzip produced invalid output: "+e);throw t.name=ba,t},Jl=(function(){var e=re((function*(t,s){18>t.size&&bs("too-short");var i=new Uint8Array(yield t.slice(0,10).arrayBuffer());Yi(i)&&i[2]===8||bs("invalid-header");var r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(a=>{for(var o=(()=>{if(Dt)return Dt;Dt=[];for(var c=0;256>c;c++){for(var h=c,d=0;8>d;d++)h=1&h?3988292384^h>>>1:h>>>1;Dt[c]=h>>>0}return Dt})(),l=4294967295,u=0;a.length>u;u++)l=o[255&(l^a[u])]^l>>>8;return(4294967295^l)>>>0})(s)&&bs("invalid-crc");var n=s.length>>>0;r.getUint32(4,!0)!==n&&bs("invalid-size")}));return function(t,s){return e.apply(this,arguments)}})();function Xi(){return Xi=re((function*(e,t,s){t===void 0&&(t=!0);try{var i=new TextEncoder().encode(e),r=new globalThis.CompressionStream("gzip"),n=r.writable.getWriter(),a=n.write(i).then((()=>n.close())).catch((function(){var u=re((function*(c){try{yield n.abort(c)}catch{}throw c}));return function(c){return u.apply(this,arguments)}})()),o=new Response(r.readable).blob(),l=(yield Promise.all([o,a]))[0];return yield Jl(l,i),l}catch(u){if(s!=null&&s.rethrow)throw u;return t&&console.error("Failed to gzip compress data",u),null}})),Xi.apply(this,arguments)}var Zl=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hub
1spot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","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"],mn=function(e,t){if(t===void 0&&(t=[]),!e)return!1;var s=e.toLowerCase();return Zl.concat(t).some((i=>{var r=i.toLowerCase();return s.indexOf(r)!==-1}))};function O(e,t){return e.indexOf(t)!==-1}var pi=function(e){return e.trim()},Qi=function(e){return e.replace(/^\$/,"")};function wa(e){var t,s=[];return(t=JSON.stringify(e,(function(i,r){if(typeof r=="bigint")return r.toString();if(typeof r!="function"&&typeof r!="symbol"){if(r instanceof Error)return{name:r.name,message:r.message,stack:r.stack};if(r&&typeof r=="object"){for(;s.length>0&&s[s.length-1]!==this;)s.pop();if(s.includes(r))return"[Circular]";s.push(r)}return r}})))!==null&&t!==void 0?t:"null"}var xa=Object.prototype,Ea=xa.hasOwnProperty,fi=xa.toString,R=Array.isArray||function(e){return fi.call(e)==="[object Array]"},Oe=e=>typeof e=="function",Z=e=>e===Object(e)&&!R(e),Je=e=>{if(Z(e)){for(var t in e)if(Ea.call(e,t))return!1;return!0}return!1},w=e=>e===void 0,G=e=>fi.call(e)=="[object String]",er=e=>G(e)&&e.trim().length===0,ge=e=>e===null,C=e=>w(e)||ge(e),he=e=>fi.call(e)=="[object Number]"&&e==e,je=e=>he(e)&&e>0,Re=e=>fi.call(e)==="[object Boolean]",Yl=e=>e instanceof FormData,Xl=e=>O(Wl,e),Ql=e=>O(Kl,e);function ka(e){return e===null||typeof e!="object"}function Ns(e,t){return{}.toString.call(e)==="[object "+t+"]"}function Nr(e){return typeof Event<"u"&&(function(t,s){try{return t instanceof s}catch{return!1}})(e,Event)}var eu=[!0,"true",1,"1","yes"],wi=e=>O(eu,e),tu=[!1,"false",0,"0","no"];function Ae(e,t,s,i,r){return t>s&&(i.warn("min cannot be greater than max."),t=s),he(e)?e>s?(i.warn(" cannot be greater than max: "+s+". Using max value instead."),s):t>e?(i.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(i.warn(" must be a number. using max or fallback. max: "+s+", fallback: "+r),Ae(r||s,t,s,i))}var su=class{constructor(e){this.$e={},this.ze=e.ze,this.Ze=Ae(e.bucketSize,0,100,e.Ge),this.Qe=Ae(e.refillRate,0,this.Ze,e.Ge),this.Je=Ae(e.refillInterval,0,864e5,e.Ge)}Ke(e,t){var s=Math.floor((t-e.lastAccess)/this.Je);s>0&&(e.tokens=Math.min(e.tokens+s*this.Qe,this.Ze),e.lastAccess=e.lastAccess+s*this.Je)}consumeRateLimit(e){var t,s=Date.now(),i=String(e),r=this.$e[i];return r?this.Ke(r,s):this.$e[i]=r={tokens:this.Ze,lastAccess:s},r.tokens===0||(r.tokens--,r.tokens===0&&((t=this.ze)==null||t.call(this,e)),r.tokens===0)}stop(){this.$e={}}},ke="Mobile",js="iOS",Ve="Android",St="Tablet",Sa=Ve+" "+St,Pa="iPad",Ta="Apple",Fa=Ta+" Watch",Qt="Safari",Pt="BlackBerry",$a="Samsung",Ia=$a+"Browser",Ma=$a+" Internet",ct="Chrome",iu=ct+" OS",Oa=ct+" "+js,jr="Internet Explorer",Ra=jr+" "+ke,zr="Opera",ru=zr+" Mini",Hr="Edge",Ca="Microsoft "+Hr,Et="Firefox",Aa=Et+" "+js,os="Nintendo",ls="PlayStation",kt="Xbox",La=Ve+" "+ke,Da=ke+" "+Qt,Wt="Windows",tr=Wt+" Phone",yn="Nokia",sr="Ouya",Na="Generic",nu=Na+" "+ke.toLowerCase(),ja=Na+" "+St.toLowerCase(),ir="Konqueror",za="Oculus Browser",zs="Vivaldi",Ha="Yandex",Hs="Whale",rr="DuckDuckGo",qa="Pale Moon",qs="Waterfox",es="Brave",Ga="Google Search App",te="(\\d+(\\.\\d+)?)",xi=new RegExp("Version/"+te),au=new RegExp(kt,"i"),ou=new RegExp(ls+" \\w+","i"),lu=new RegExp(os+" \\w+","i"),qr=new RegExp(Pt+"|PlayBook|BB10","i"),uu={"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"},Ba=function(e,t,s,i){t=t||"";var r=(function(n){return n!=null&&n.brave?es:null})(s);
1return r||(i!=null&&i.detectGoogleSearchApp&&O(e,"GSA/")?Ga:O(e," OPR/")&&O(e,"Mini")?ru:O(e," OPR/")?zr:qr.test(e)?Pt:O(e,"IE"+ke)||O(e,"WPDesktop")?Ra:O(e,"OculusBrowser")?za:O(e,Ia)?Ma:O(e,Hr)||O(e,"Edg/")?Ca:O(e,zs+"/")?zs:O(e,"YaBrowser/")?Ha:O(e,Hs+"/")?Hs:O(e,rr+"/")||O(e,"Ddg/")?rr:O(e,"FBIOS")?"Facebook "+ke:O(e,"UCWEB")||O(e,"UCBrowser")?"UC Browser":O(e,"CriOS")?Oa:O(e,"CrMo")||O(e,ct)?ct:O(e,Ve)&&O(e,Qt)?La:O(e,"FxiOS")?Aa:O(e.toLowerCase(),ir.toLowerCase())?ir:O(e,es+"/")?es:((n,a)=>a&&O(a,Ta)||(function(o){return O(o,Qt)&&!O(o,ct)&&!O(o,Ve)})(n))(e,t)?O(e,ke)?Da:Qt:O(e,"PaleMoon/")?qa:O(e,qs+"/")?qs:O(e,Et)?Et:O(e,"MSIE")||O(e,"Trident/")?jr:O(e,"Gecko")?Et:"")},cu={[Ra]:[new RegExp("rv:"+te)],[Ca]:[new RegExp(Hr+"?\\/"+te)],[ct]:[new RegExp("("+ct+"|CrMo)\\/"+te)],[Oa]:[new RegExp("CriOS\\/"+te)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+te)],[Qt]:[xi],[Da]:[xi],[zr]:[new RegExp("(Opera|OPR)\\/"+te)],[Et]:[new RegExp(Et+"\\/"+te)],[Aa]:[new RegExp("FxiOS\\/"+te)],[ir]:[new RegExp("Konqueror[:/]?"+te,"i")],[Pt]:[new RegExp(Pt+" "+te),xi],[La]:[new RegExp("android\\s"+te,"i")],[Ma]:[new RegExp(Ia+"\\/"+te)],[za]:[new RegExp("OculusBrowser\\/"+te)],[zs]:[new RegExp(zs+"\\/"+te)],[Ha]:[new RegExp("YaBrowser\\/"+te)],[Hs]:[new RegExp(Hs+"\\/"+te)],[es]:[new RegExp(es+"\\/"+te)],[rr]:[new RegExp("(DuckDuckGo|Ddg)\\/"+te)],[qa]:[new RegExp("PaleMoon\\/"+te)],[qs]:[new RegExp(qs+"\\/"+te)],[Ga]:[new RegExp("GSA\\/"+te)],[jr]:[new RegExp("(rv:|MSIE )"+te)],Mozilla:[new RegExp("rv:"+te)]},hu=function(e,t,s,i){var r=Ba(e,t,s,i),n=cu[r];if(w(n))return null;for(var a=0;n.length>a;a++){var o=e.match(n[a]);if(o)return parseFloat(o[o.length-2])}return null},bn=[[new RegExp(kt+"; "+kt+" (.*?)[);]","i"),e=>[kt,e&&e[1]||""]],[new RegExp(os,"i"),[os,""]],[new RegExp(ls,"i"),[ls,""]],[qr,[Pt,""]],[new RegExp(Wt,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[tr,""];if(new RegExp(ke).test(t)&&!/IEMobile\b/.test(t))return[Wt+" "+ke,""];var s=/Windows NT ([0-9.]+)/i.exec(t);if(s&&s[1]){var i=uu[s[1]]||"";return/arm/i.test(t)&&(i="RT"),[Wt,i]}return[Wt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[js,[e[3],e[4],e[5]||"0"].join(".")]:[js,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=w(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+Ve+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Ve+")","i"),e=>e&&e[2]?[Ve,[e[2],e[3],e[4]||"0"].join(".")]:[Ve,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[iu,""]],[/Linux|debian/i,["Linux",""]]],wn=function(e){return lu.test(e)?os:ou.test(e)?ls:au.test(e)?kt:new RegExp(sr,"i").test(e)?sr:new RegExp("("+tr+"|WPDesktop)","i").test(e)?tr:/iPad/.test(e)?Pa:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?Fa:qr.test(e)?Pt:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(yn,"i").test(e)?yn:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(ke).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?Ve:Sa:new RegExp("(pda|"+ke+")","i").test(e)?nu:new RegExp(St,"i").test(e)&&!new RegExp(St+" pc","i").test(e)?ja:""},du=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function xn(e,t){return typeof(s=e)=="string"&&du.test(s)?e:t();var s}function Ze(e){return e&&e.split("#")[0]}function Is(e,t){var s=setTimeout(e,t);return s!=null&&s.unref&&(s==null||s.unref()),s}var pu=e=>e instanceof Error,Ua={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}},fu=Ua.info;function Va(e){if(Re(e))return{boolValue:e};if(typeof e=="number")return Number.isFinite(e)?Number.isInteger(e)?{intValue:e}:{doubleValue:e}:{stringValue:String(e)};if(typeof e=="string")return{stringValue:e};if(R(e))return{arrayValue:{values:e.map((t=>Va(t)))}};try{return{stringValue:JSON.stringify(e)}}catch{return{stringValue:String(e)}}}function Gs(e){var t=[];for(var s in e){var i=e[s];ge(i)||w(i)||t.push({key:s,value:Va(i)})}return t}function vu(e,t){var s=Ua[e.level||"info"]||fu,i=s.text,r=s.number,n=String(Date.now())+"000000",a={};t.distinctId&&(a.posthogDistinctId=t.distinctId),t.sessionId&&(a.sessionId=t.sessionId),t.windowId&&(a["window.id"]=t.windowId),C(t.sessionStartTimestamp)||(a.sessionStartTimestamp=String(t.sessionStartTimestamp)),C(t.lastActivityTimestamp)||(a.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(a["url.full"]=t.currentUrl),t.screenName&&(a["screen.name"]=t.screenName),t.appState&&(a["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(a.feature_flags=t.activeFeatureFlags);var o=y({},a,e.attributes||{}),l={timeUnixNano:n,observedTimeUnixNano:n,severityNumber:r,severityText:i,body:{stringValue:e.body},attributes:Gs(o)};return e.trace_id&&(l.traceId=e.trace_id),e.span_id&&(l.spanId=e.span_id),w(e.trace_flags)||(l.flags=e.trace_flags),l}function Wa(e,t,s){return y({},e.resourceAttributes,{"service.name":e.serviceName||"unknown_service"},e.environment&&{"deployment.environment":e.environment},e.serviceVersion&&{"service.version":e.serviceVersion},{"telemetry.sdk.name":t,"telemetry.sdk.version":s})}function Ka(e,t,s,i){return{resourceLogs:[{resource:{attributes:Gs(t)},scopeLogs:[{scope:{name:s,version:i},logRecords:e}]}]}}var gu=class{constructor(e,t,s,i,r,n,a){var o;n===void 0&&(n=()=>Promise.resolve()),this._instance=e,this.Te=t,this.Ge=s,this.Ye=i,this.Xe=r,this.et=n,this.tt
1=a,this.rt=null,this.it=0,this.nt=0,this.st=0,this.ot=0,this.ut=!1,this.ht=t.maxBufferSize,this.dt=Math.max((o=t.maxQueueSize)!==null&&o!==void 0?o:t.maxBufferSize,t.maxBufferSize),this.ct=t.flushIntervalMs,this.vt=t.maxBatchRecordsPerPost,this.ft=t.rateCapWindowMs,this.yt=t.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(e){if(!this._instance.isDisabled&&!this._instance.optedOut&&e!=null&&e.body){var t=this.wt(e);if(t!==null)if(t.body){if(this.xt()){var s={record:vu(t,this.Ye())};this.Xe((()=>this.kt(s)))}}else this.Ge.info("Log was rejected in beforeSend function")}}wt(e){var t=this.Te.beforeSend;if(!t)return e;var s=R(t)?t:[t],i=e;for(var r of s)try{var n=r(i);if(!n)return this.Ge.info("Log was rejected in beforeSend function"),null;i=n}catch(a){return this.Ge.error("Error in beforeSend function for log:",a),null}return i}xt(){if(this.yt===void 0)return!0;var e=Date.now(),t=e-this.st;return this.ft>t&&t>=0||(this.st=e,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 e=this;return re((function*(){if(!e._instance.isDisabled)return e.rt||(e.rt=e.St().finally((()=>{e.rt=null}))),e.rt}))()}St(){var e=this;return re((function*(){var t;e.bt();var s=(t=e._instance.getPersistedProperty(He.LogsQueue))!==null&&t!==void 0?t:[];if(s.length!==0)for(var i=s.length,r=0;s.length>0&&i>r;){var n,a;e.it=0;var o=Math.min(s.length,e.vt),l=s.slice(0,o),u=Ka(l.map((h=>h.record)),e.Ct(),(n=e.tt)!==null&&n!==void 0?n:e._instance.getLibraryId(),e._instance.getLibraryVersion()),c=yield e._instance.Tt(u);if(c.kind==="too-large"&&l.length>1)e.vt=Math.max(1,Math.floor(l.length/2)),e.Ge.warn("Received 413 when sending logs batch of size "+l.length+", reducing batch size to "+e.vt);else if(c.kind==="retry-later"||(c.kind==="too-large"?e.Ge.warn("Dropping a single log record after 413 with batch size 1 â the record is larger than the server cap and cannot be split further."):c.kind==="ok"&&e.Te.maxBatchRecordsPerPost>e.vt&&(e.vt=Math.min(e.Te.maxBatchRecordsPerPost,e.vt+1)),yield e.It(l.length),s=(a=e._instance.getPersistedProperty(He.LogsQueue))!==null&&a!==void 0?a:[],r+=l.length,c.kind==="fatal"))throw c.error}}))()}It(e){var t=this;return re((function*(){var s,i=Math.max(0,e-t.it),r=(s=t._instance.getPersistedProperty(He.LogsQueue))!==null&&s!==void 0?s:[];t._instance.setPersistedProperty(He.LogsQueue,r.slice(i)),yield t.et()}))()}Ct(){return Wa(this.Te,this._instance.getLibraryId(),this._instance.getLibraryVersion())}kt(e){var t;if(!this._instance.optedOut){var s=(t=this._instance.getPersistedProperty(He.LogsQueue))!==null&&t!==void 0?t:[];this.dt>s.length||(s.shift(),this.it++,this.Ge.info("Logs queue is full, dropping oldest record.")),s.push(e),this._instance.setPersistedProperty(He.LogsQueue,s),this.ht>s.length?this.Mt():this._t()}}Mt(e){e===void 0&&(e=this.ct),this.Et||(this.Et=Is((()=>{this.Et=void 0,this._t()}),e))}Rt(){var e=Math.min(Math.max(0,this.nt-1),6);return this.ct*Math.pow(2,e)}Pt(){var e=this._instance.getPersistedProperty(He.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return re((function*(){t.bt();var s=t.flush().catch((()=>{}));e!==void 0?yield Promise.race([s,new Promise((i=>Is(i,e)))]):yield s}))()}flushWithTimeout(e){var t=this;return re((function*(){var s=!1,i=t.flush(),r=new Promise((n=>Is((()=>{s=!0,n()}),e)));try{yield Promise.race([i,r])}finally{s&&i.catch((()=>{}))}}))()}_t(){this.flush().then((()=>{this.nt=0}),(e=>{this.nt++,this.Ge.error("PostHog logs flush failed:",e)})).finally((()=>{!this._instance.isDisabled&&this.Pt()&&this.Mt(this.Rt())}))}bt(){this.Et&&(clearTimeout(this.Et),this.Et=void 0)}},Ei=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function En(e){return String(e)+"000000"}function kn(e,t,s,i){var r="";return i&&(r=Object.keys(i).sort().map((n=>JSON.stringify(n)+":"+JSON.stringify(i[n]))).join(",")),e+"\0"+t+"\0"+(s??"")+"\0"+r}var _u=class{constructor(e,t,s){this._instance=e,this.Te=t,this.Ge=s,this.Ot=new Map,this.rt=null,this.Ft=!1,this.Lt=ne
1w Map,this.$t=new Set,this.At=0}count(e,t,s){t===void 0&&(t=1),this.Nt({name:e,type:"count",value:t,unit:s==null?void 0:s.unit,attributes:s==null?void 0:s.attributes})}gauge(e,t,s){this.Nt({name:e,type:"gauge",value:t,unit:s==null?void 0:s.unit,attributes:s==null?void 0:s.attributes})}histogram(e,t,s){this.Nt({name:e,type:"histogram",value:t,unit:s==null?void 0:s.unit,attributes:s==null?void 0:s.attributes})}flush(){var e=this,t=this.rt,s=(function(){var r=re((function*(){t&&(yield t.catch((()=>{}))),yield e.Dt()}));return function(){return r.apply(this,arguments)}})(),i=s().finally((()=>{this.rt===i&&(this.rt=null)}));return this.rt=i,i}drainWindow(){if(this.Ot.size===0)return null;var e=this.Ot;return this.Ot=new Map,this.Ft=!1,this.Lt=new Map,this.$t=new Set,this.qt(e)}reset(){this.At++,this.bt(),this.Ot=new Map,this.rt=null,this.Ft=!1,this.Lt=new Map,this.$t=new Set}Nt(e){if(!this._instance.isDisabled&&!this._instance.optedOut){var t=this.wt(e);if(t!==null)if(t.name&&typeof t.name=="string")if(typeof t.value=="number"&&Number.isFinite(t.value))if(t.type==="count"&&0>t.value)this.Ge.warn("Dropping count '"+t.name+"': counters are monotonic, value must be >= 0");else{var s,i;try{s=t.attributes?y({},t.attributes):void 0,i=kn(t.type,t.name,t.unit,s)}catch(a){return void this.Ge.warn("Dropping metric '"+t.name+"': attributes could not be serialized",a)}var r=this.Ot.get(i);if(!r){if(!this.jt())return;r={name:t.name,type:t.type,unit:t.unit,attributes:s,windowStartMs:Date.now()},this.Ot.set(i,r)}var n=this.Lt.get(t.name);n===void 0?this.Lt.set(t.name,t.type):n===t.type||this.$t.has(t.name)||(this.$t.add(t.name),this.Ge.warn("Metric name '"+t.name+"' is already used as a "+n+"; recording it as a "+t.type+" too will blend both series in charts. Use a distinct name.")),this.Ht(r,t.value),this.Mt()}else this.Ge.warn("Dropping metric '"+t.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(e,t){var s;switch(e.type){case"count":e.total=((s=e.total)!==null&&s!==void 0?s:0)+t;break;case"gauge":e.last=t;break;case"histogram":e.hist||(e.hist={count:0,sum:0,min:t,max:t,bucketCounts:new Array(Ei.length+1).fill(0)});var i=e.hist;i.count+=1,i.sum+=t,i.min=Math.min(i.min,t),i.max=Math.max(i.max,t),i.bucketCounts[(function(r,n){for(var a=0;n.length>a;a++)if(n[a]>=r)return a;return n.length})(t,Ei)]+=1}}wt(e){var t=this.Te.beforeSend;if(!t)return e;var s=R(t)?t:[t],i=e;for(var r of s)try{var n=r(i);if(!n)return this.Ge.info("Metric was rejected in beforeSend function"),null;i=n}catch(a){return this.Ge.error("Error in beforeSend function for metric:",a),null}return i}Mt(){this.Et||(this.Et=Is((()=>{this.Et=void 0,this.flush().catch((e=>{this.Ge.error("Metrics flush failed:",e)}))}),this.Te.flushIntervalMs))}bt(){this.Et&&(clearTimeout(this.Et),this.Et=void 0)}Dt(){var e=this;return re((function*(){if(e.Ot.size!==0){var t=e.Ot;e.Ot=new Map,e.Ft=!1,e.Lt=new Map,e.$t=new Set;var s=e.At,i=yield e._instance.Bt(e.qt(t));if(s===e.At)switch(i.kind){case"ok":return;case"retry-later":return e.Ut(t),void e.Mt();case"too-large":return void e.Ge.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e.Ge.error("Failed to send metrics batch:",i.error)}}}))()}qt(e){return t=this.zt(e),s=(function(n,a,o){return y({},n.resourceAttributes,{"service.name":n.serviceName||"unknown_service"},n.environment&&{"deployment.environment":n.environment},n.serviceVersion&&{"service.version":n.serviceVersion},{"telemetry.sdk.name":a,"telemetry.sdk.version":o})})(this.Te,this._instance.getLibraryId(),this._instance.getLibraryVersion()),i=this._instance.getLibraryId(),r=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:Gs(s)},scopeMetrics:[{scope:{name:i,version:r},metrics:t}]}]};var t,s,i,r}zt(e){var t=En(Date.now()),s=new Map;for(var i of e.values()){var r,n=kn(i.type,i.name,i.unit,void 0),a=s.get(n);a||(a=y({name:i.name},i.unit&&{unit:i.unit}),i.type==="count"?a.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:i.type==="gauge"?a.gauge={dataPoints:[]}:a.histogram={aggregationTemporality:1,dataPoints:[]},s.set(n,a));var o=Gs((r=i.attributes)!==null&&r!==void 0?r:{}),l=En(i.windowStartMs);if(i.type==="count"){var u,c={attributes:o,startTimeUnixNano:l,timeUnixNano:t,asDouble:(u=i.total)!==null&&u!==void 0?u:0};a.sum.dataPoints.push(c)}else if(i.type==="gauge"){var h,d={attributes:o,timeUnixNano:t,asDouble:(h=i.last)!==null&&h!==void 0?h:0};a.gauge.dataPoints.push(d)}else i.hist&&a.histogram.dataPoints.push({attributes:o,startTimeUnixNano:l,timeUnixNano:t,count:i.hist.count,sum:i.hist.sum,min:i.hist.min,max:i.hist.max,bucketCounts:i.hist.bucketCounts,explicitBounds:Ei})}return Array.from(s.values())}Ut(e){var t,s;for(var i of e){var r=i[0],n=i[1],a=this.Ot.get(r);if(a)switch(a.windowStartMs=Math.min(a.windowStartMs,n.windowStartMs),a.type){case"count":a.total=((t=a.total)!==null&&t!==void 0?t:0)+((s=n.total)!==null&&s!==void 0?s:0);break;case"gauge":break;case"histogram":if(n.hist)if(a.hist){a.hist.count+=n.hist.count,a.hist.sum+=n.hist.sum,a.hist.min=Math.min(a.hist.min,n.hist.min),a.hist.max=Math.max(a.hist.max,n.hist.max);for(var o=0;a.hist.bucketCounts.length>o;o++)a.hist.bucketCounts[o]+=n.hist.bucketCounts[o]}else a.hist=n.hist}else this.jt()&&this.Ot.set(r,n)}}},ws,Sn,ki;function mu(e){var t=globalThis._posthogChunkIds;if(t){var s=Object.keys(t);return ki&&s.length===Sn||(Sn=s.length,ki=s.reduce(((i,r)=>{ws||(ws={});var n=ws[r];if(n)i[n[0]]=n[1];else for(var a=e(r),o=a.length-1;o>=0;o--){var l=a[o],u=l==null?void 0:l.filename,c=t[r];
1if(u&&c){i[u]=c,ws[r]=[u,c];break}}return i}),{})),ki}}var yu=class{constructor(e,t,s){s===void 0&&(s=[]),this.coercers=e,this.stackParser=t,this.modifiers=s}buildFromUnknown(e,t){t===void 0&&(t={});var s=t&&t.mechanism||{handled:!0,type:"generic"},i=this.buildCoercingContext(s,t,0).apply(e),r=this.buildParsingContext(t),n=this.parseStacktrace(i,r);return{$exception_list:this.convertToExceptionList(n,s),$exception_level:"error"}}modifyFrames(e){var t=this;return re((function*(){for(var s of e)s.stacktrace&&s.stacktrace.frames&&R(s.stacktrace.frames)&&(s.stacktrace.frames=yield t.applyModifiers(s.stacktrace.frames));return e}))()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:(t=e.syntheticException)==null?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var s,i;return e.cause!=null&&(s=this.parseStacktrace(e.cause,t)),e.stack!=""&&e.stack!=null&&(i=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),y({},e,{cause:s,stack:i})}applyChunkIds(e,t){return e.map((s=>(s.filename&&t&&(s.chunk_id=t[s.filename]),s)))}applyCoercers(e,t){for(var s of this.coercers)if(s.match(e))return s.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return re((function*(){var s=e;for(var i of t.modifiers)s=yield i(s);return s}))()}convertToExceptionList(e,t){var s,i,r,n={type:e.type,value:e.value,mechanism:{type:(s=t.type)!==null&&s!==void 0?s:"generic",handled:(i=t.handled)===null||i===void 0||i,synthetic:(r=e.synthetic)!==null&&r!==void 0&&r}};e.stack&&(n.stacktrace={type:"raw",frames:e.stack});var a=[n];return e.cause!=null&&a.push(...this.convertToExceptionList(e.cause,y({},t,{handled:!0}))),a}buildParsingContext(e){var t;return{chunkIdMap:mu(this.stackParser),skipFirstLines:(t=e.skipFirstLines)!==null&&t!==void 0?t:1}}buildCoercingContext(e,t,s){s===void 0&&(s=0);var i=(r,n)=>{if(4>=n){var a=this.buildCoercingContext(e,t,n);return this.applyCoercers(r,a)}};return y({},t,{syntheticException:s==0?t.syntheticException:void 0,mechanism:e,apply:r=>i(r,s),next:r=>i(r,s+1)})}},Tt="?";function nr(e,t,s,i,r){var n={platform:e,filename:t,function:s==="<anonymous>"?Tt:s,in_app:!0};return w(i)||(n.lineno=i),w(r)||(n.colno=r),n}var Ja=(e,t)=>{var s=e.indexOf("safari-extension")!==-1,i=e.indexOf("safari-web-extension")!==-1;return s||i?[e.indexOf("@")!==-1?e.split("@")[0]:Tt,s?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},bu=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,wu=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,xu=/\((\S*)(?::(\d+))(?::(\d+))\)/,Eu=(e,t)=>{var s=bu.exec(e);if(s)return nr(t,s[1],Tt,+s[2],+s[3]);var i=wu.exec(e);if(i){if(i[2]&&i[2].indexOf("eval")===0){var r=xu.exec(i[2]);r&&(i[2]=r[1],i[3]=r[2],i[4]=r[3])}var n=Ja(i[1]||Tt,i[2]);return nr(t,n[1],n[0],i[3]?+i[3]:void 0,i[4]?+i[4]:void 0)}},ku=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Su=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Pu=(e,t)=>{var s=ku.exec(e);if(s){if(s[3]&&s[3].indexOf(" > eval")>-1){var i=Su.exec(s[3]);i&&(s[1]=s[1]||"eval",s[3]=i[1],s[4]=i[2],s[5]="")}var r=s[3],n=s[1]||Tt,a=Ja(n,r);return nr(t,r=a[1],n=a[0],s[4]?+s[4]:void 0,s[5]?+s[5]:void 0)}},Pn=/\(error: (.*)\)/,Tu=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var s=G(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:s?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?t+": "+e.message:t}isDOMException(e){return Ns(e,"DOMException")}isDOMError(e){return Ns(e,"DOMError")}},Fu=class{match(e){return(t=>t instanceof Error)(e)}coerce(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var s=e.message;return String(s.error&&typeof s.error.message=="string"?s.error.message:s)}getStack(e){return e.stacktrace||e.stack||void 0}},$u=class{constructor(){}match(e){return Ns(e,"ErrorEvent")&&e.error!=null}coerce(e,t){var s;return t.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:(s=t.syntheticException)==null?void 0:s.stack,synthetic:!0}}},Iu=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Mu=class{match(e){return typeof e=="string"}coerce(e,t){var s,i=this.getInfos(e),r=i[0],n=i[1];return{type:r??"Error",value:n??e,stack:(s=t.syntheticException)==null?void 0:s.stack,synthetic:!0}}getInfos(e){var t="Error",s=e,i=e.match(Iu);return i&&(t=i[1],s=i[2]),[t,s]}},Ou=["fatal","error","warning","log","info","debug"];
1function Za(e,t){t===void 0&&(t=40);var s=Object.keys(e);if(s.sort(),!s.length)return"[object has no keys]";for(var i=s.length;i>0;i--){var r=s.slice(0,i).join(", ");if(t>=r.length)return i===s.length?r:r.length>t?r.slice(0,t)+"...":r}return""}var Ru=class{match(e){return typeof e=="object"&&e!==null}coerce(e,t){var s,i=this.getErrorPropertyFromObject(e);return i?t.apply(i):{type:this.getType(e),value:this.getValue(e),stack:(s=t.syntheticException)==null?void 0:s.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return Nr(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){var t="'"+e.name+"' captured as exception";return"message"in e&&typeof e.message=="string"&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&typeof e.message=="string")return e.message;var s=this.getObjectClassName(e);return(s&&s!=="Object"?"'"+s+"'":"Object")+" captured as exception with keys: "+Za(e)}isSeverityLevel(e){return G(e)&&!er(e)&&Ou.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if({}.hasOwnProperty.call(e,t)){var s=e[t];if(pu(s))return s}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},Cu=class{match(e){return Nr(e)}coerce(e,t){var s,i=e.constructor.name;return{type:i,value:i+" captured as exception with keys: "+Za(e),stack:(s=t.syntheticException)==null?void 0:s.stack,synthetic:!0}}},Au=class{match(e){return ka(e)}coerce(e,t){var s;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(s=t.syntheticException)==null?void 0:s.stack,synthetic:!0}}},Lu=class{match(e){return Ns(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!Nr(e))return!1;try{var t=e.detail;return t!=null&&typeof t=="object"&&"reason"in t}catch{return!1}}coerce(e,t){var s,i=this.getUnhandledRejectionReason(e);return ka(i)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(i),stack:(s=t.syntheticException)==null?void 0:s.stack,synthetic:!0}:t.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}},Bs="$message",Us="$timestamp",Du=new Set([Bs,Us]),Si={enabled:!0,max_bytes:32768};function Vs(e){var t;return e?{enabled:(t=e.enabled)!==null&&t!==void 0?t:Si.enabled,max_bytes:ju(e.max_bytes,Si.max_bytes)}:y({},Si)}var Nu=class{constructor(e){this.Vt=[],this.Wt=0,this.Te=Vs(e)}setConfig(e){this.Te=Vs(e),this.Zt()}add(e){var t=(function(i){var r;try{r=wa(i)}catch{return}try{var n=JSON.parse(r);if(!Z(n))return;var a=n,o=a[Bs],l=a[Us];return!G(o)||o.trim().length===0||!G(l)&&!he(l)?void 0:{step:a,json:r}}catch{return}})(e);if(t){var s=(function(i){if(typeof TextEncoder<"u")return new TextEncoder().encode(i).length;for(var r=encodeURIComponent(i),n=0,a=0;r.length>a;a++)r[a]==="%"?(n+=1,a+=2):n+=1;return n})(t.json);s>this.Te.max_bytes||(this.Vt.push({step:t.step,bytes:s}),this.Wt+=s,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 ju(e,t){if(!he(e)||e===1/0||e===-1/0)return t;var s=Math.floor(e);return 0>s?t:s}var Ya=function(e,t){var s=(t===void 0?{}:t).debugEnabled,i={k(r){if(v&&(z.DEBUG||v.POSTHOG_DEBUG||s)&&!w(v.console)&&v.console){for(var n=("__rrweb_original__"in v.console[r])?v.console[r].__rrweb_original__:v.console[r],a=arguments.length,o=new Array(a>1?a-1:0),l=1;a>l;l++)o[l-1]=arguments[l];n(e,...o)}},debug(){for(var r=arguments.length,n=new Array(r),a=0;r>a;a++)n[a]=arguments[a];i.k("debug",...n)},info(){for(var r=arguments.length,n=new Array(r),a=0;r>a;a++)n[a]=arguments[a];i.k("log",...n)},warn(){for(var r=arguments.length,n=new Array(r),a=0;r>a;a++)n[a]=arguments[a];i.k("warn",...n)},error(){for(var r=arguments.length,n=new Array(r),a=0;r>a;a++)n[a]=arguments[a];i.k("error",...n)},critical(){for(var r=arguments.length,n=new Array(r),a=0;r>a;a++)n[a]=arguments[a];console.error(e,...n)},uninitializedWarning(r){i.error("You must initialize PostHog before calling "+r)},createLogger:(r,n)=>Ya(e+" "+r,n)};return i},k=Ya("[PostHog.js]"),Y=k.createLogger,zu=Y("[ExternalScriptsLoader]"),Pi=(e,t,s)=>{if(e.config.disable_external_dependency_loading)return zu.warn(t+" was requested but loading of external scripts is disabled."),s("Loading of external scripts is disabled");var i=x==null?void 0:x.querySelectorAll("script");
1if(i){for(var r,n=function(){if(i[a].src===t){var l=i[a];return l.__posthog_loading_callback_fired?{v:s()}:(l.addEventListener("load",(u=>{l.__posthog_loading_callback_fired=!0,s(void 0,u)})),l.onerror=u=>s(u),{v:void 0})}},a=0;i.length>a;a++)if(r=n())return r.v}var o=()=>{if(!x)return s("document not found");var l=x.createElement("script");if(l.type="text/javascript",l.crossOrigin="anonymous",l.src=t,l.onload=h=>{l.__posthog_loading_callback_fired=!0,s(void 0,h)},l.onerror=h=>s(h),e.config.prepare_external_dependency_script&&(l=e.config.prepare_external_dependency_script(l)),!l)return s("prepare_external_dependency_script returned null");if(e.config.external_scripts_inject_target==="head")x.head.appendChild(l);else{var u,c=x.querySelectorAll("body > script");c.length>0?(u=c[0].parentNode)==null||u.insertBefore(l,c[0]):x.body.appendChild(l)}};x!=null&&x.body?o():x==null||x.addEventListener("DOMContentLoaded",o)};$.__PosthogExtensions__=$.__PosthogExtensions__||{},$.__PosthogExtensions__.loadExternalDependency=(e,t,s)=>{if(t!=="remote-config"){var i;if(e.config.strict_script_versioning)i=e.requestRouter.endpointFor("assets","/static/"+e.version+"/"+t+".js");else{var r="/static/"+t+".js?v="+e.version;if(t==="toolbar"){var n=3e5;r=r+"&t="+Math.floor(Date.now()/n)*n}i=e.requestRouter.endpointFor("assets",r)}Pi(e,i,s)}else{var a=e.requestRouter.endpointFor("assets","/array/"+e.config.token+"/config.js");Pi(e,a,s)}},$.__PosthogExtensions__.loadSiteApp=(e,t,s)=>{var i=e.requestRouter.endpointFor("api",t);Pi(e,i,s)};z.DEBUG=!1,z.LIB_VERSION="1.407.6",z.LIB_NAME="web";var Xa="$people_distinct_id",Ws="$device_id",Ti="$device_model",Kt="__alias",Jt="__timers",ar="$autocapture_disabled_server_side",or="$heatmaps_enabled_server_side",lr="$exception_capture_enabled_server_side",ur="$error_tracking_suppression_rules",cr="$error_tracking_capture_extension_exceptions",hr="$web_vitals_enabled_server_side",Gr="$dead_clicks_enabled_server_side",Br="$product_tours_enabled_server_side",dr="$web_vitals_allowed_metrics",ut="$session_recording_remote_config",Qa="$replay_sample_rate",eo="$replay_override_sampling",to="$replay_override_linked_flag",so="$replay_override_url_trigger",io="$replay_override_event_trigger",wt="$sesid",Ur="$session_is_sampled",lt="$enabled_feature_flags",Ms="$active_feature_flags",Zt="$early_access_features",pr="$feature_flag_details",Os="$feature_flag_payloads",fr="$feature_flag_request_id",Ks="$minimal_flag_called_events",ze="$override_feature_flags",mt="$override_feature_flag_payloads",rt="$stored_person_properties",nt="$stored_group_properties",vr="$surveys",Js="$surveys_loaded_at",gr="$surveys_activated",Rs="$surveys_activated_session",Yt="ph_product_tours",ts="$flag_call_reported",_r="$flag_call_reported_session_id",mr="$feature_flag_errors",us="$feature_flag_evaluated_at",Me="$user_state",yr="$client_session_props",br="$capture_rate_limit",wr="$initial_campaign_params",xr="$initial_referrer_info",Zs="$initial_person_info",Ys="$epp",xs="$posthog_cookieless",ro="$cookieless_mode",no="$sdk_debug_extensions_init_method",ao="$sdk_debug_extensions_init_time_ms",oo="$sdk_debug_recording_script_not_loaded",Vr="PostHog loadExternalDependency extension not found.",at="on_reject",Ge="always",ft="anonymous",vt="identified",Er="identified_only",Xs="visibilitychange",Qs="beforeunload",yt="$pageview",Fi="$pageleave",$i="$identify",Tn="$groupidentify";function Es(e,t){R(e)&&e.forEach(t)}function B(e,t){if(!C(e))if(R(e))e.forEach(t);else if(Yl(e))e.forEach(((i,r)=>t(i,r)));else for(var s in e)Ea.call(e,s)&&t(e[s],s)}var K=function(e){for(var t=arguments.length,s=new Array(t>1?t-1:0),i=1;t>i;i++)s[i-1]=arguments[i];for(var r of s)for(var n in r)r[n]!==void 0&&(e[n]=r[n]);return e};function Cs(e){for(var t=Object.keys(e),s=t.length,i=new Array(s);s--;)i[s]=[t[s],e[t[s]]];return i}var Fn=function(e){try{return e()}catch{return}},Hu=function(e){return function(){try{for(var t=arguments.length,s=new Array(t),i=0;t>i;i++)s[i]=arguments[i];return e.apply(this,s)}catch(r){k.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),k.critical(r)}}},Wr=function(e){var t={};return B(e,(function(s,i){(G(s)&&s.length>0||he(s))&&(t[i]=s)})),t},qu=["herokuapp.com","vercel.app","netlify.app"];function Gu(e){var t=e==null?void 0:e.hostname;if(!G(t))return!1;var s=t.split(".").slice(-2).join(".");for(var i of qu)if(s===i)return!1;return!0}function se(e,t,s,i){var r=i??{},n=r.capture,a=r.passive;e==null||e.addEventListener(t,s,{capture:n!==void 0&&n,passive:a===void 0||a})}
1function lo(e){return e.name==="ph_toolbar_internal"}var uo=e=>{if(x){try{for(var t=e+"=",s=x.cookie.split(";").filter((n=>n.length)),i=0;s.length>i;i++){for(var r=s[i];r.charAt(0)==" ";)r=r.substring(1,r.length);if(r.indexOf(t)===0)return decodeURIComponent(r.substring(t.length,r.length))}}catch{}return null}};Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return he(e)&&isFinite(e)&&Math.floor(e)===e});var Bu=class kr{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,s,i,r){if(!Number.isInteger(t)||!Number.isInteger(s)||!Number.isInteger(i)||!Number.isInteger(r)||0>t||0>s||0>i||0>r||t>0xffffffffffff||s>4095||i>1073741823||r>4294967295)throw new RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=t/Math.pow(2,40),n[1]=t/Math.pow(2,32),n[2]=t/Math.pow(2,24),n[3]=t/Math.pow(2,16),n[4]=t/256,n[5]=t,n[6]=112|s>>>8,n[7]=s,n[8]=128|i>>>24,n[9]=i>>>16,n[10]=i>>>8,n[11]=i,n[12]=r>>>24,n[13]=r>>>16,n[14]=r>>>8,n[15]=r,new kr(n)}toString(){for(var t="",s=0;this.bytes.length>s;s++)t=t+(this.bytes[s]>>>4).toString(16)+(15&this.bytes[s]).toString(16),s!==3&&s!==5&&s!==7&&s!==9||(t+="-");if(t.length!==36)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new kr(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(var s=0;16>s;s++){var i=this.bytes[s]-t.bytes[s];if(i!==0)return Math.sign(i)}return 0}},Uu=class{generate(){var e=this.generateOrAbort();if(!w(e))return e;this.S=0;var t=this.generateOrAbort();if(w(t))throw new Error("Could not generate UUID after timestamp reset");return t}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 Bu.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 Vu}},$n,co=e=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};v&&!w(v.crypto)&&crypto.getRandomValues&&(co=e=>crypto.getRandomValues(e));var Vu=class{nextUint32(){return this.R.length>this.O||(co(this.R),this.O=0),this.R[this.O++]}constructor(){this.R=new Uint32Array(8),this.O=1/0}},qe=()=>Wu().toString(),Wu=()=>($n||($n=new Uu)).generate(),Nt="",Ku=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,Be={N:()=>!!x,D(e){k.error("cookieStore error: "+e)},A:uo,F(e){var t;try{t=JSON.parse(Be.A(e))||{}}catch{}return t},q(e,t,s,i,r){if(!x)return!1;try{var n="",a="",o=(function(c,h){if(h){var d=(function(f,g){if(g===void 0&&(g=x),Nt)return Nt;if(!g||["localhost","127.0.0.1"].includes(f))return"";for(var _=f.split("."),m=Math.min(_.length,8),P="dmn_chk_"+qe();!Nt&&m--;){var E=_.slice(m).join("."),S=P+"=1;domain=."+E+";path=/";g.cookie=S+";max-age=3",g.cookie.includes(P)&&(g.cookie=S+";max-age=0",Nt=E)}return Nt})(c);if(!d){var p=(f=>{var g=f.match(Ku);return g?g[0]:""})(c);p!==d&&k.info("Warning: cookie subdomain discovery mismatch",p,d),d=p}return d?"; domain=."+d:""}return""})(x.location.hostname,i);if(s){var l=new Date;l.setTime(l.getTime()+864e5*s),n="; expires="+l.toUTCString()}r&&(a="; secure");var u=e+"="+encodeURIComponent(JSON.stringify(t))+n+"; SameSite=Lax; path=/"+o+a;return u.length>3686.4&&k.warn("cookieStore warning: large cookie, len="+u.length),x.cookie=u,!0}catch{return!1}},P(e,t){if(x!=null&&x.cookie)try{Be.q(e,"",-1,t)}catch{return}}},Ii=null,V={N(){if(!ge(Ii))return Ii;var e=!0;if(w(v))e=!1;else try{var t="__mplssupport__";V.q(t,"xyz"),V.A(t)!=='"xyz"'&&(e=!1),V.P(t)}catch{e=!1}return e||k.error("localStorage unsupported; falling back to cookie store"),Ii=e,e},D(e){k.error("localStorage error: "+e)},A(e){try{return v==null?void 0:v.localStorage.getItem(e)}catch(t){V.D(t)}return null},F(e){try{return JSON.parse(V.A(e))||{}}catch{}return null},q(e,t){try{return v==null||v.localStorage.setItem(e,JSON.stringify(t)),!0}catch(s){V.D(s)}return!1},P(e){try{v==null||v.localStorage.removeItem(e)}catch(t){V.D(t)}}},Ju=[Ws,"distinct_id",wt,Ur,Ys,Zs,Me],ks={},Zu={N:()=>!0,D(e){k.error("memoryStorage error: "+e)},A:e=>ks[e]||null,F:e=>ks[e]||null,q:(e,t)=>
1(ks[e]=t,!0),P(e){delete ks[e]}},Xe=null,ce={N(){if(!ge(Xe))return Xe;if(Xe=!0,w(v))Xe=!1;else try{var e="__support__";ce.q(e,"xyz"),ce.A(e)!=='"xyz"'&&(Xe=!1),ce.P(e)}catch{Xe=!1}return Xe},D(e){k.error("sessionStorage error: ",e)},A(e){try{return v==null?void 0:v.sessionStorage.getItem(e)}catch(t){ce.D(t)}return null},F(e){try{return JSON.parse(ce.A(e))||null}catch{}return null},q(e,t){try{return v==null||v.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(s){ce.D(s)}return!1},P(e){try{v==null||v.sessionStorage.removeItem(e)}catch(t){ce.D(t)}}},Yu=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===Ge||this.isRejected()||this.consent===-1&&this.Te.cookieless_mode===at}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,t=e.token,s=e.opt_out_capturing_cookie_prefix;return e.consent_persistence_name||(s?s+t:"__ph_opt_in_out_"+t)}get Qt(){var e=this.Jt.A(this.Kt);return wi(e)?1:O(tu,e)?0:-1}get Jt(){var e=this.Te.opt_out_capturing_persistence_type,t=e==="localStorage"?V:Be;if(!this.Yt||this.Yt!==t){this.Yt=t;var s=e==="localStorage"?Be:V;s.A(this.Kt)&&(this.Yt.A(this.Kt)||this.optInOut(wi(s.A(this.Kt))),s.P(this.Kt,this.Te.cross_subdomain_cookie))}return this.Yt}Gt(){return!!this.Te.respect_dnt&&[ue==null?void 0:ue.doNotTrack,ue==null?void 0:ue.msDoNotTrack,$.doNotTrack].some((e=>wi(e)))}};function ho(e,t){var s,i=e==null||(s=e.config)==null?void 0:s.get_current_url;if(!Oe(i))return t;try{var r=i(t);return G(r)&&r?r:t}catch(n){return k.error("Error in get_current_url, falling back to window.location.href",n),t}}var po="__POSTHOG_TOOLBAR__",Xu=1,Qu=3,ec=11;function In(e){return e instanceof Element&&(e.id===po||!(e.closest==null||!e.closest(".toolbar-global-fade-container")))}function Ye(e){return!!e&&e.nodeType===Xu}function Ee(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function fo(e){return!!e&&e.nodeType===Qu}function vo(e){return!!e&&e.nodeType===ec&&Ye(e.host)}var go=1e3;function Kr(e){return e?pi(e).split(/\s+/):[]}function Mn(e,t){var s=(function(i){var r,n=v==null||(r=v.location)==null?void 0:r.href;return w(n)?void 0:ho(i,n)})(t);return!!(s&&e&&e.some((i=>s.match(i))))}function ei(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return Kr(t)}function _o(e){return C(e)?null:pi(e).split(/(\s+)/).filter((t=>ss(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function cs(e){var t="";return Pr(e)&&!wo(e)&&e.childNodes&&e.childNodes.length&&B(e.childNodes,(function(s){var i;fo(s)&&s.textContent&&(t+=(i=_o(s.textContent))!==null&&i!==void 0?i:"")})),pi(t)}function Mi(e){var t;return w(e.target)?e.srcElement||null:(t=e.target)!=null&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}var Jr=["a","button","form","input","select","textarea","label"];function Sr(e,t){if(w(t))return!0;var s,i=function(n){if(t.some((a=>(function(o,l){var u=o.matches||o.matchesSelector||o.msMatchesSelector||o.mozMatchesSelector||o.webkitMatchesSelector||o.oMatchesSelector;try{return!!u&&u.call(o,l)}catch{return!1}})(n,a))))return{v:!0}};for(var r of e)if(s=i(r))return s.v;return!1}function mo(e){var t=e.parentNode;return!(!t||!Ye(t))&&t}var tc=[".ph-no-autocapture","[data-ph-no-autocapture]"],yo=["next","previous","prev",">","<"],sc=[...yo,"+","-","â","â"],On=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,Rn=[".ph-no-rageclick",".ph-no-capture"],ic=["","text","search","email","password","url","tel","number"];function Cn(e,t){if(!v||Zr(e))return!1;var s,i,r,n,a;if(Re(t)?(s=!!t&&Rn,i=void 0,r=!1):(s=(n=t==null?void 0:t.css_selector_ignorelist)!==null&&n!==void 0?n:Rn,i=t==null?void 0:t.content_ignorelist,r=(a=t==null?void 0:t.ignore_text_selection)!==null&&a!==void 0&&a),s===!1||r&&(function(l){return!(!l||!Ye(l))&&(!!Ee(l,"textarea")||(Ee(l,"input")?O(ic,(l.getAttribute("type")||"").toLowerCase()):(function(u){if(u.isContentEditable)return!0;var c=u.getAttribute==null?void 0:u.getAttribute("contenteditable");return c==="true"||c===""})(l)))})(e))return!1;var o=bo(e,!1).targetElementList;return!(function(l,u){if(l===!1||w(l))return!1;var c;if(l===!0)c=yo;else{if(!R(l))return!1;if(l.length>10)return k.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;c=l.map((h=>h.toLowerCase()))}return u.some((h=>{var d=h.safeText,p=h.ariaLabel;return c.some((f=>On(d,f)||On(p,f)))}))})(i,o.map((l=>{var u;return{safeText:cs(l).toLowerCase(),ariaLabel:((u=l.getAttribute("aria-label"))==null?void 0:u.toLowerCase().trim())||""}})))&&!Sr(o,s)}var Zr=e=>!e||Ee(e,"html")||!Ye(e),bo=(e,t)=>{if(!v||Zr(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var s=!1,i=[e],r=e;r.parentNode&&!Ee(r,"body");)if(vo(r.parentNode))i.push(r.parentNode.host),r=r.parentNode.host;else{var n=mo(r);if(!n)break;if(t||Jr.indexOf(n.tagName.toLowerCase())>-1)s=!0;else try{var a=v.getComputedStyle(n);a&&a.getPropertyValue("cursor")==="pointer"&&(s=!0)}catch{}i.push(n),r=n}return{parentIsUsefulElement:s,targetElementList:i}};function Pr(e){for(var t=new Set,s=0,i=e;i.parentNode&&!Ee(i,"body");i=i.parentNode){if(s++>=go||t.has(i))return!1;t.add(i);var r=ei(i);if(O(r,"ph-sensitive")||O(r,"ph-no-capture"))return!1}if(O(ei(e),"ph-include"))return!0;var n=e.type||"";if(G(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}
1var a=e.name||e.id||"";return!G(a)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(a.replace(/[^a-zA-Z0-9]/g,""))}function wo(e){return!!(Ee(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||Ee(e,"select")||Ee(e,"textarea")||e.getAttribute("contenteditable")==="true")}var xo="(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})",rc=new RegExp("^(?:"+xo+")$"),nc=new RegExp(xo),Eo="\\d{3}-?\\d{2}-?\\d{4}",ac=new RegExp("^("+Eo+")$"),oc=new RegExp("("+Eo+")");function ss(e,t){return t===void 0&&(t=!0),!(C(e)||G(e)&&(e=pi(e),(t?rc:nc).test((e||"").replace(/[- ]/g,""))||(t?ac:oc).test(e)))}function An(e){var t=cs(e);return ss(t=(t+" "+ko(e)).trim())?t:""}function ko(e){var t="";return e&&e.childNodes&&e.childNodes.length&&B(e.childNodes,(function(s){var i;if(s&&((i=s.tagName)==null?void 0:i.toLowerCase())==="span")try{var r=cs(s);t=(t+" "+r).trim(),s.childNodes&&s.childNodes.length&&(t=(t+" "+ko(s)).trim())}catch(n){k.error("[AutoCapture]",n)}})),t}function Ln(e){return e.replace(/"|\\"/g,'\\"')}function lc(e){var t=e.attr__class;if(t)return R(t)?t:Kr(t)}var Ss=Y("[Dead Clicks]"),uc=()=>!0,cc=e=>{var t,s=!((t=e.instance.persistence)==null||!t.get_property(Gr)),i=e.instance.config.capture_dead_clicks;return Re(i)?i:!!Z(i)||s},Dn=class{get lazyLoadedDeadClicksAutocapture(){return this.Xt}constructor(e,t,s){this.instance=e,this.isEnabled=t,this.onCapture=s,this.startIfEnabledOrStop()}onRemoteConfig(e){if(e.ok){var t=e.config;"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[Gr]:t.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.er((()=>{this.tr()})):this.stop()}er(e){var t,s;(t=$.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture?e():(s=$.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this.instance,"dead-clicks-autocapture",(i=>{i?Ss.error("failed to load script",i):e()}))}tr(){var e;
1if(x){if(!this.Xt&&(e=$.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var t=Z(this.instance.config.capture_dead_clicks)?y({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this.Xt=$.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.Xt.start(x),Ss.info("starting...")}}else Ss.error("`document` not found. Cannot start.")}stop(){this.Xt&&(this.Xt.stop(),this.Xt=void 0,Ss.info("stopping..."))}},Oi=Y("[SegmentIntegration]"),So="posthog-js";function Po(e,t){var s=t===void 0?{}:t,i=s.organization,r=s.projectId,n=s.prefix,a=s.severityAllowList,o=a===void 0?["error"]:a,l=s.sendExceptionsToPostHog,u=l===void 0||l;return c=>{var h,d,p,f,g;if(o!=="*"&&!o.includes(c.level)||!e.__loaded)return c;c.tags||(c.tags={});var _=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());c.tags["PostHog Person URL"]=_,e.sessionRecordingStarted()&&(c.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var m,P=((h=c.exception)==null?void 0:h.values)||[],E=P.map((F=>y({},F,{stacktrace:F.stacktrace?y({},F.stacktrace,{type:"raw",frames:(F.stacktrace.frames||[]).map((N=>y({},N,{platform:"web:javascript"})))}):void 0}))),S={$exception_message:((d=P[0])==null?void 0:d.value)||c.message,$exception_type:(p=P[0])==null?void 0:p.type,$exception_level:c.level,$exception_list:E,$sentry_event_id:c.event_id,$sentry_exception:c.exception,$sentry_exception_message:((f=P[0])==null?void 0:f.value)||c.message,$sentry_exception_type:(g=P[0])==null?void 0:g.type,$sentry_tags:c.tags};return i&&r&&(S.$sentry_url=(n||"https://sentry.io/organizations/")+i+"/issues/?project="+r+"&query="+c.event_id),u&&((m=e.exceptions)==null||m.sendExceptionEvent(S)),c}}var hc=class{constructor(e,t,s,i,r,n){this.name=So,this.setupOnce=function(a){a(Po(e,{organization:t,projectId:s,prefix:i,severityAllowList:r,sendExceptionsToPostHog:n==null||n}))}}},Nn=class{constructor(e){this.rr=(t,s,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(k.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,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,t){var s,i=this.ar(e,t);return this.ir={pathname:(s=v==null?void 0:v.location.pathname)!==null&&s!==void 0?s:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),i}doPageLeave(e){var t;return this.ar(e,(t=this.ir)==null?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.ir)==null?void 0:e.pageViewId}}ar(e,t){var s=this.ir;if(!s)return{$pageview_id:t};var i={$pageview_id:t,$prev_pageview_id:s.pageViewId},r=this._instance.scrollManager.getContext();if(r&&!this._instance.config.disable_scroll_properties){var n=r.maxScrollHeight,a=r.lastScrollY,o=r.maxScrollY,l=r.maxContentHeight,u=r.lastContentY,c=r.maxContentY;if(!(w(n)||w(a)||w(o)||w(l)||w(u)||w(c))){n=Math.ceil(n),a=Math.ceil(a),o=Math.ceil(o),l=Math.ceil(l),u=Math.ceil(u),c=Math.ceil(c);var h=n>1?Ae(a/n,0,1,k):1,d=n>1?Ae(o/n,0,1,k):1,p=l>1?Ae(u/l,0,1,k):1,f=l>1?Ae(c/l,0,1,k):1;i=K(i,{$prev_pageview_last_scroll:a,$prev_pageview_last_scroll_percentage:h,$prev_pageview_max_scroll:o,$prev_pageview_max_scroll_percentage:d,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:c,$prev_pageview_max_content_percentage:f})}}return s.pathname&&(i.$prev_pageview_pathname=s.pathname),s.timestamp&&(i.$prev_pageview_duration=(e.getTime()-s.timestamp.getTime())/1e3),i}},Ri=["flags","surveys"],dc={[Xa]:{exposure:"hidden"},[Kt]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[Jt]:{exposure:"hidden"},[ar]:{exposure:"event"},[or]:{exposure:"hidden"},[lr]:{exposure:"event"},[ur]:{exposure:"hidden"},[cr]:{exposure:"event"},[hr]:{exposure:"event"},[Gr]:{exposure:"event"},[Br]:{exposure:"hidden"},[dr]:{exposure:"event"},[ut]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[wt]:{exposure:"hidden"},[Ur]:{exposure:"event"}
1,[Qa]:{exposure:"event",shouldSkipFromEventProperties:e=>ge(e)},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},$sess_rec_flush_size:{exposure:"hidden"},[lt]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(e,t)=>t(),transformToEventProperties(e){if(!Z(e))return{};for(var t={},s=Object.keys(e),i=0;s.length>i;i++)t["$feature/"+s[i]]=e[s[i]];return t}},[Ms]:{exposure:"event",storageGroup:"flags"},[Zt]:{exposure:"hidden"},[pr]:{exposure:"hidden",storageGroup:"flags"},[Os]:{exposure:"event",storageGroup:"flags"},[fr]:{exposure:"event",storageGroup:"flags",volatile:!0},[Ks]:{exposure:"hidden",storageGroup:"flags"},[ze]:{exposure:"event"},[mt]:{exposure:"hidden"},[rt]:{exposure:"hidden"},[nt]:{exposure:"hidden"},[vr]:{exposure:"hidden",storageGroup:"surveys"},[Js]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[gr]:{exposure:"event"},[Rs]:{exposure:"hidden"},[Yt]:{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"},[ts]:{exposure:"hidden"},[_r]:{exposure:"hidden"},[mr]:{exposure:"hidden"},[us]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Me]:{exposure:"hidden"},[yr]:{exposure:"hidden"},[br]:{exposure:"hidden"},[wr]:{exposure:"hidden"},[xr]:{exposure:"hidden"},[Zs]:{exposure:"hidden"},[Ys]:{exposure:"hidden"},[eo]:{exposure:"event"},[to]:{exposure:"event"},[so]:{exposure:"event"},[io]:{exposure:"event"},[no]:{exposure:"event"},[ao]:{exposure:"event"},[oo]:{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"}},pc=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Qe=e=>{var t=dc[e];if(t)return t;for(var s of pc){var i=s[1];if(e.indexOf(s[0])===0)return i}},xt=(e,t)=>
1{try{return JSON.stringify(e,((s,i)=>typeof i=="bigint"?i.toString():i),t)}catch{return wa(e)}},ti=e=>{var t=x==null?void 0:x.createElement("a");return w(t)?null:(t.href=e,t)},Ft=function(e,t){for(var s,i=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;i.length>r;r++){var n=i[r].split("=");if(n[0]===t){s=n;break}}if(!R(s)||2>s.length)return"";var a=s[1];try{a=decodeURIComponent(a)}catch{k.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},hs=function(e,t,s){if(!e||!t||!t.length)return e;for(var i=e.split("#"),r=i[1],n=(i[0]||"").split("?"),a=n[1],o=n[0],l=(a||"").split("&"),u=[],c=0;l.length>c;c++){var h=l[c].split("=");R(h)&&(t.includes(h[0])?u.push(h[0]+"="+s):u.push(l[c]))}var d=o;return a!=null&&(d+="?"+u.join("&")),r!=null&&(d+="#"+r),d},si=function(e,t){var s=e.match(new RegExp(t+"=([^&]*)"));return s?s[1]:null},To=(e,t)=>e>=t&&ma(),Fo=(e,t,s,i)=>{if(e===0){if(ma()){var r=t+1;return r===s&&i(),r}return t}return 0},Ps="https?://(.*)",$t=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],fc=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...$t],ds="<masked>",vc=["li_fat_id"];function $o(e,t,s){if(!x)return{};var i,r=t?[...$t,...s||[]]:[],n=Io(hs(x.URL,r,ds),e),a=(i={},B(vc,(function(o){var l=uo(o);i[o]=l||null})),i);return K(a,n)}function Io(e,t){var s=fc.concat(t||[]),i={};return B(s,(function(r){var n=Ft(e,r);i[r]=n||null})),i}function Mo(e){var t=(function(n){return n?n.search(Ps+"google.([^/?]*)")===0?"google":n.search(Ps+"bing.com")===0?"bing":n.search(Ps+"yahoo.com")===0?"yahoo":n.search(Ps+"duckduckgo.com")===0?"duckduckgo":null:null})(e),s=t!="yahoo"?"q":"p",i={};if(!ge(t)){i.$search_engine=t;var r=x?Ft(x.referrer,s):"";r.length&&(i.ph_keyword=r)}return i}function jn(){return navigator.language||navigator.userLanguage}var ii="$direct";function Oo(){return(x==null?void 0:x.referrer)||ii}function Ro(e,t,s){s===void 0&&(s=!1);var i=e?[...$t,...t||[]]:[],r=s?Ze(q==null?void 0:q.href):q==null?void 0:q.href,n=r==null?void 0:r.substring(0,1e3);return{r:Oo().substring(0,1e3),u:n?hs(n,i,ds):void 0}}function Co(e,t){var s;t===void 0&&(t=!1);var i=e.r,r=e.u,n=t?Ze(r):r,a={$referrer:i,$referring_domain:i==null?void 0:i==ii?ii:(s=ti(i))==null?void 0:s.host};
1if(n){a.$current_url=n;var o=ti(n);a.$host=o==null?void 0:o.host,a.$pathname=o==null?void 0:o.pathname;var l=Io(n);K(a,l)}if(i){var u=Mo(i);K(a,u)}return a}function Ao(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function gc(){try{return new Date().getTimezoneOffset()}catch{return}}var _c={flags:us,surveys:Js},mc=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],gt="main",Ci=class{constructor(e,t,s){if(s===void 0&&(s=!0),this.lr={},this.ur=!1,this.hr=!1,this.Te=e,this.dr=s,this.props={},this.cr=!1,this.vr=(r=>{var n="";return r.token&&(n=r.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),r.persistence_name?"ph_"+r.persistence_name:"ph_"+n+"_posthog"})(e),this.Jt=this.pr(e),this.hr=this.gr(e),this.load(),e.debug&&k.info("Persistence loaded",e.persistence,y({},this.props)),this.update_config(e,e,t),this.save(),v){var i=()=>this.flush();se(v,"beforeunload",i,{capture:!1}),se(v,"pagehide",i,{capture:!1})}}mr(){var e,t=(e=this.Te)==null?void 0:e.persistence_save_debounce_ms;return he(t)&&t>0?t:0}isDisabled(){return!!this.yr}
1pr(e){mc.indexOf(e.persistence.toLowerCase())===-1&&(k.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t,s=(function(n,a){n===void 0&&(n=[]),a===void 0&&(a=!1);var o=[...Ju,...n];return y({},V,{F(l){try{var u={};try{u=Be.F(l)||{}}catch{}var c,h=JSON.parse(V.A(l)||"{}");if(a){var d={};for(var p in u){var f=u[p];ge(f)||f===""||(d[p]=f)}c=K(h,d)}else c=K(u,h);return V.q(l,c),c}catch{}return null},q(l,u,c,h,d,p){var f=V.q(l,u,void 0,void 0,p);try{var g={};o.forEach((_=>{u[_]&&(g[_]=u[_])})),Object.keys(g).length&&Be.q(l,g,c,h,d,p)}catch(_){V.D(_)}return f},P(l,u){try{v==null||v.localStorage.removeItem(l),Be.P(l,u)}catch(c){V.D(c)}}})})(e.cookie_persisted_properties||[],e.__preview_cookie_wins_on_conflict||!1),i=!1,r=e.persistence.toLowerCase();return r==="localstorage"&&V.N()?(t=V,i=!0):r==="localstorage+cookie"&&s.N()?(t=s,i=!0):r==="sessionstorage"&&ce.N()?t=ce:r==="memory"?t=Zu:r==="cookie"?t=Be:s.N()?(t=s,i=!0):t=Be,this.ur=i,t}br(e){return this.vr+"__"+e}gr(e){return this.ur&&!!e.split_storage}_r(e){var t=e??this.Te.feature_flag_cache_ttl_ms;if(!t||0>=t)return!1;var s=this.props[us];return!s||typeof s!="number"||Date.now()-s>t}properties(){var e={};return B(this.props,((t,s)=>{var i=Qe(s);if((i==null?void 0:i.exposure)==="derived"){if(i.shouldSkipFromEventProperties!=null&&i.shouldSkipFromEventProperties(t,s===lt?()=>this._r():()=>!1))return;i.transformToEventProperties&&K(e,i.transformToEventProperties(t))}else if(!i||i.exposure==="event"){if(i!=null&&i.shouldSkipFromEventProperties!=null&&i.shouldSkipFromEventProperties(t,(()=>!1)))return;e[s]=t}})),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 Ri){var t=V.F(this.br(e));if(t&&!Je(t)){var s=this.kr(e);s.persisted=!0,this.Sr(e)||(s.fingerprint=this.Cr(t,e)),this.Tr(e,t)||K(this.props,t)}}}Sr(e){return Object.keys(this.props).some((t=>{var s;return((s=Qe(t))==null?void 0:s.storageGroup)===e}))}Tr(e,t){var s=_c[e];if(!s)return!1;var i=t[s],r=this.props[s];return he(i)&&he(r)&&r>i}refreshKey(e){var t;if(!this.yr){var s=this.hr?(t=Qe(e))==null?void 0:t.storageGroup:void 0,i=s?V.F(this.br(s)):this.Jt.F(this.vr);if(i&&e in i)this.Ir(e,i[e]);else{if(s){var r=this.Jt.F(this.vr);if(r&&e in r)return void this.Ir(e,r[e])}this.Mr(e)}}}save(){if(!this.yr){var e=this.mr();e>0?w(this.Er)&&(this.Er=setTimeout((()=>{this.Er=void 0,this.Rr()}),e)):this.Rr()}}flush(){w(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,gt))}Pr(){var e=this.Fr(),t=e.main,s=e.groups;for(var i of(this.Or(this.Jt,this.vr,t,gt),Ri)){var r,n=s[i];(!Je(n)||(r=this.lr[i])!=null&&r.persisted)&&this.Or(V,this.br(i),n,i)}}Fr(){var e={},t={flags:{},surveys:{}};return B(this.props,((s,i)=>{var r,n=(r=Qe(i))==null?void 0:r.storageGroup;n?t[n][i]=s:e[i]=s})),{main:e,groups:t}}Cr(e,t){if(t===gt)return JSON.stringify(e)+"|"+this.Lr+"|"+this.$r+"|"+this.Ar;var s={};return B(e,((i,r)=>{var n;s[r]=(n=Qe(r))!=null&&n.volatile?"__volatile__":i})),JSON.stringify(s)}Or(e,t,s,i){var r=this.kr(i);if(i===gt||r.dirty||w(r.fingerprint)){var n;try{if((n=this.Cr(s,i))===r.fingerprint)return void(r.dirty=!1)}catch{n=void 0}e.q(t,s,this.Lr,this.$r,this.Ar,this.Te.debug)?(r.dirty=!1,i!==gt&&(r.persisted=!0),w(n)||(r.fingerprint=n)):this.Te.debug&&k.warn('failed to persist storage entry "'+t+'"; will retry on next save')}}remove(e){var t=(e===void 0?{}:e).keepGroupEntries,s=t!==void 0&&t;if(w(this.Er)||(clearTimeout(this.Er),this.Er=void 0),this.Jt.P(this.vr,!1),this.Jt.P(this.vr,!0),!s&&this.dr)for(var i of Ri)V.P(this.br(i));s?delete this.lr[gt]:this.lr={}}clear(){this.remove(),this.props={}}register_once(e,t,s){if(Z(e)){w(t)&&(t="None"),this.Lr=w(s)?this.Nr:s;var i=!1;if(B(e,((r,n)=>{this.props.hasOwnProperty(n)&&this.props[n]!==t||(this.Ir(n,r),i=!0)})),i)return this.save(),!0}return!1}register(e,t){if(Z(e)){this.Lr=w(t)?this.Nr:t;var s=!1;if(B(e,((i,r)=>{e.hasOwnProperty(r)&&this.props[r]!==i&&(this.Ir(r,i),s=!0)})),s)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=$o(this.Te.custom_campaign_params,this.Te.mask_personal_data_properties,this.Te.custom_personal_data_properties);Je(Wr(e))||this.register(e),this.cr=!0}}update_search_keyword(){var e;this.register((e=x==null?void 0:x.referrer)?Mo(e):{})}update_referrer_info(){var e;this.register_once({$referrer:Oo(),$referring_domain:x!=null&&x.referrer&&((e=ti(x.referrer))==null?void 0:e.host)||ii},void 0)}set_initial_person_info(){this.props[wr]||this.props[xr]||this.register_once({[Zs]:Ro(this.Te.mask_personal_data_properties,this.Te.custom_personal_data_properties,this.Te.disable_capture_url_hashes
1)},void 0)}get_initial_props(){var e={};B([xr,wr],(i=>{var r=this.props[i];r&&B(r,(function(n,a){e["$initial_"+Qi(a)]=n}))}));var t=this.props[Zs];if(t){var s=(function(i,r){r===void 0&&(r=!1);var n=Co(i,r),a={};return B(n,(function(o,l){a["$initial_"+Qi(l)]=o})),a})(t,this.Te.disable_capture_url_hashes);K(e,s)}return e}safe_merge(e){return B(this.props,(function(t,s){s in e||(e[s]=t)})),e}update_config(e,t,s){this.Nr=this.Lr=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!s),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie);var i=e.persistence!==t.persistence||!((o,l)=>{if(o.length!==l.length)return!1;var u=[...o].sort(),c=[...l].sort();return u.every(((h,d)=>h===c[d]))})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),r=i?this.pr(e):this.Jt,n=this.gr(e);if(i||n!==this.hr){var a=this.props;this.clear(),this.Jt=r,this.hr=n,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,t){var s=this.props[Jt]||{};s[e]=t,this.Ir(Jt,s),this.save()}remove_event_timer(e){var t=this.props[Jt]||{},s=t[e];return w(s)||(delete t[e],this.Ir(Jt,t),this.save()),s}get_property(e){return this.props[e]}set_property(e,t){this.Ir(e,t),this.save()}Ir(e,t){var s;this.props[e]=t,(s=Qe(e))!=null&&s.volatile||this.Dr(e)}Mr(e){delete this.props[e],this.Dr(e)}Dr(e){var t,s=(t=Qe(e))==null?void 0:t.storageGroup;s&&(this.kr(s).dirty=!0)}kr(e){return this.lr[e]||(this.lr[e]={})}},ve={GZipJS:"gzip-js",Base64:"base64"},jt={Activation:"events",Cancellation:"cancelEvents"},Ai={Popover:"popover",API:"api",Widget:"widget"},Ue={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},Li={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},Tr={Popover:"popover",Inline:"inline"},yc={SHOWN:"product tour shown"},zn={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},Hn=Y("[RateLimiter]"),bc=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var s=t.text;if(s&&s.length)try{(JSON.parse(s).quota_limited||[]).forEach((i=>{Hn.info((i||"events")+" is quota limited."),this.serverLimits[i]=new Date().getTime()+6e4}))}catch(i){return void Hn.warn('could not rate limit - continuing. Error: "'+(i==null?void 0:i.message)+'"',{text:s})}},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 t,s,i;e===void 0&&(e=!1);var r=this.captureEventsBurstLimit,n=this.captureEventsPerSecond,a=new Date().getTime(),o=(t=(s=this.instance.persistence)==null?void 0:s.get_property(br))!==null&&t!==void 0?t:{tokens:r,last:a};o.tokens+=(a-o.last)/1e3*n,o.last=a,o.tokens>r&&(o.tokens=r);var l=1>o.tokens;return l||e||(o.tokens=Math.max(0,o.tokens-1)),!l||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+n+" events per second and "+r+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,(i=this.instance.persistence)==null||i.set_property(br,o),{isRateLimited:l,remainingTokens:o.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}},zt=Y("[RemoteConfig]"),Lo=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=$._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}qr(e){var t,s;(t=$.__PosthogExtensions__)!=null&&t.loadExternalDependency?(s=$.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.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(t){e(t.json)}})}load(){try{if(this.remoteConfig)return zt.info("Using preloaded remote config",this.remoteConfig),this.Hr(this.remoteConfig),void this.Br();if(this._instance.Ur())return void zt.warn("Remote config is disabled. Falling back to local config.");this.qr((e=>{if(!e)return zt.info("No config found after loading remote JS config. Falling back to JSON."),void this.jr((t=>{this.Hr(t),this.Br()}));this.Hr(e),this.Br()}))}catch(e){zt.error("Error loading remote config",e)}}stop(){this.zr&&(clearInterval(this.zr),this.zr=void 0)}refresh(){!this._instance.Ur()&&x&&x.visibilityState!=="hidden"&&this._instance.reloadFeatureFlags()}Br(){var e;if(!this.zr){var t=(e=this._instance.config.remote_config_refresh_interval_ms)!==null&&e!==void 0?e:3e5;t!==0&&(this.zr=setInterval((()=>{this.refresh()}),t))}}Hr(e){var t;e||zt.error("Failed to fetch remote config from PostHog."),this._instance.Hr(e?{ok:!0,config:e}:{ok:!1}),(e==null?void 0:e.hasFeatureFlags)!==!1&&(this._instance.config.advanced_disable_feature_flags_on_first_load||(t=this._instance.featureFlags)==null||t.ensureFlagsLoaded())}},Fe=Uint8Array,be=Uint16Array,It=Uint32Array,Yr=new Fe([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]),Xr=new Fe([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]),qn=new Fe([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Do=function(e,t){for(var s=new be(31),i=0;31>i;++i)s[i]=t+=1<<e[i-1];var r=new It(s[30]);for(i=1;30>i;++i)for(var n=s[i];s[i+1]>n;++n)r[n]=n-s[i]<<5|i;return[s,r]},No=Do(Yr,2),Fr=No[1];No[0][28]=258,Fr[258]=28;
1for($r=Do(Xr,0)[1],Ir=new be(32768),J=0;32768>J;++J)et=(43690&J)>>>1|(21845&J)<<1,Ir[J]=((65280&(et=(61680&(et=(52428&et)>>>2|(13107&et)<<2))>>>4|(3855&et)<<4))>>>8|(255&et)<<8)>>>1;var et,$r,Ir,J,is=function(e,t,s){for(var i=e.length,r=0,n=new be(t);i>r;++r)++n[e[r]-1];var a,o=new be(t);for(r=0;t>r;++r)o[r]=o[r-1]+n[r-1]<<1;for(a=new be(i),r=0;i>r;++r)a[r]=Ir[o[e[r]-1]++]>>>15-e[r];return a},dt=new Fe(288);for(J=0;144>J;++J)dt[J]=8;for(J=144;256>J;++J)dt[J]=9;for(J=256;280>J;++J)dt[J]=7;for(J=280;288>J;++J)dt[J]=8;var ri=new Fe(32);for(J=0;32>J;++J)ri[J]=5;var wc=is(dt,9),xc=is(ri,5),jo=function(e){return(e/8>>0)+(7&e&&1)},zo=function(e,t,s){(s==null||s>e.length)&&(s=e.length);var i=new(e instanceof be?be:e instanceof It?It:Fe)(s-t);return i.set(e.subarray(t,s)),i},Le=function(e,t,s){var i=t/8>>0;e[i]|=s<<=7&t,e[i+1]|=s>>>8},Ht=function(e,t,s){var i=t/8>>0;e[i]|=s<<=7&t,e[i+1]|=s>>>8,e[i+2]|=s>>>16},Di=function(e,t){for(var s=[],i=0;e.length>i;++i)e[i]&&s.push({s:i,f:e[i]});var r=s.length,n=s.slice();if(!r)return[new Fe(0),0];if(r==1){var a=new Fe(s[0].s+1);return a[s[0].s]=1,[a,1]}s.sort((function(F,N){return F.f-N.f})),s.push({s:-1,f:25001});var o=s[0],l=s[1],u=0,c=1,h=2;for(s[0]={s:-1,f:o.f+l.f,l:o,r:l};c!=r-1;)o=s[s[h].f>s[u].f?u++:h++],l=s[u!=c&&s[h].f>s[u].f?u++:h++],s[c++]={s:-1,f:o.f+l.f,l:o,r:l};var d=n[0].s;for(i=1;r>i;++i)n[i].s>d&&(d=n[i].s);var p=new be(d+1),f=Mr(s[c-1],p,0);if(f>t){i=0;var g=0,_=f-t,m=1<<_;for(n.sort((function(F,N){return p[N.s]-p[F.s]||F.f-N.f}));r>i;++i){var P=n[i].s;if(t>=p[P])break;g+=m-(1<<f-p[P]),p[P]=t}for(g>>>=_;g>0;){var E=n[i].s;t>p[E]?g-=1<<t-p[E]++-1:++i}for(;i>=0&&g;--i){var S=n[i].s;p[S]==t&&(--p[S],++g)}f=t}return[new Fe(p),f]},Mr=function(e,t,s){return e.s==-1?Math.max(Mr(e.l,t,s+1),Mr(e.r,t,s+1)):t[e.s]=s},Gn=function(e){for(var t=e.length;t&&!e[--t];);for(var s=new be(++t),i=0,r=e[0],n=1,a=function(l){s[i++]=l},o=1;t>=o;++o)if(e[o]==r&&o!=t)++n;else{if(!r&&n>2){for(;n>138;n-=138)a(32754);n>2&&(a(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(a(r),--n;n>6;n-=6)a(8304);n>2&&(a(n-3<<5|8208),n=0)}for(;n--;)a(r);n=1,r=e[o]}return[s.subarray(0,i),t]},qt=function(e,t){for(var s=0,i=0;t.length>i;++i)s+=e[i]*t[i];return s},Or=function(e,t,s){var i=s.length,r=jo(t+2);e[r]=255&i,e[r+1]=i>>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var n=0;i>n;++n)e[r+n+4]=s[n];return 8*(r+4+i)},Bn=function(e,t,s,i,r,n,a,o,l,u,c){Le(t,c++,s),++r[256];for(var h=Di(r,15),d=h[0],p=h[1],f=Di(n,15),g=f[0],_=f[1],m=Gn(d),P=m[0],E=m[1],S=Gn(g),F=S[0],N=S[1],L=new be(19),b=0;P.length>b;++b)L[31&P[b]]++;for(b=0;F.length>b;++b)L[31&F[b]]++;for(var T=Di(L,7),I=T[0],A=T[1],M=19;M>4&&!I[qn[M-1]];--M);var D,X,U,j,W=u+5<<3,Q=qt(r,dt)+qt(n,ri)+a,we=qt(r,d)+qt(n,g)+a+14+3*M+qt(L,I)+(2*L[16]+3*L[17]+7*L[18]);if(Q>=W&&we>=W)return Or(t,c,e.subarray(l,l+u));if(Le(t,c,1+(Q>we)),c+=2,Q>we){D=is(d,p),X=d,U=is(g,_),j=g;var Se=is(I,A);for(Le(t,c,E-257),Le(t,c+5,N-1),Le(t,c+10,M-4),c+=14,b=0;M>b;++b)Le(t,c+3*b,I[qn[b]]);c+=3*M;for(var me=[P,F],xe=0;2>xe;++xe){var ee=me[xe];for(b=0;ee.length>b;++b)Le(t,c,Se[oe=31&ee[b]]),c+=I[oe],oe>15&&(Le(t,c,ee[b]>>>5&127),c+=ee[b]>>>12)}}else D=wc,X=dt,U=xc,j=ri;for(b=0;o>b;++b)if(i[b]>255){var oe;Ht(t,c,D[257+(oe=i[b]>>>18&31)]),c+=X[oe+257],oe>7&&(Le(t,c,i[b]>>>23&31),c+=Yr[oe]);var le=31&i[b];Ht(t,c,U[le]),c+=j[le],le>3&&(Ht(t,c,i[b]>>>5&8191),c+=Xr[le])}else Ht(t,c,D[i[b]]),c+=X[i[b]];return Ht(t,c,D[256]),c+X[256]},Ec=new It([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),kc=(function(){for(var e=new It(256),t=0;256>t;++t){for(var s=t,i=9;--i;)s=(1&s&&3988292384)^s>>>1;e[t]=s}return e})(),Ni=function(e,t,s){for(;s;++t)e[t]=s,s>>>=8};function Sc(e,t){t===void 0&&(t={});var s=(function(){var h=4294967295;return{p(d){for(var p=h,f=0;d.length>f;++f)p=kc[255&p^d[f]]^p>>>8;h=p},d(){return 4294967295^h}}})(),i=e.length;s.p(e);var r,n,a,o,l,u=(o=10+((r=t).filename&&r.filename.length+1||0),l=8,(function(h,d,p,f,g,_){var m=h.length,P=new Fe(f+m+5*(1+Math.floor(m/7e3))+g),E=P.subarray(f,P.length-g),S=0;if(!d||8>m)for(var F=0;m>=F;F+=65535){var N=F+65535;m>N?S=Or(E,S,h.subarray(F,N)):(E[F]=!0,S=Or(E,S,h.subarray(F,m)))}else{for(var L=Ec[d-1],b=L>>>13,T=8191&L,I=(1<<p)-1,A=new be(32768),M=new be(I+1),D=Math.ceil(p/3),X=2*D,U=function(_i){return(
1h[_i]^h[_i+1]<<D^h[_i+2]<<X)&I},j=new It(25e3),W=new be(288),Q=new be(32),we=0,Se=0,me=(F=0,0),xe=0,ee=0;m>F;++F){var oe=U(F),le=32767&F,ie=M[oe];if(A[le]=ie,M[oe]=le,F>=xe){var We=m-F;if((we>7e3||me>24576)&&We>423){S=Bn(h,E,0,j,W,Q,Se,me,ee,F-ee,S),me=we=Se=0,ee=F;for(var pe=0;286>pe;++pe)W[pe]=0;for(pe=0;30>pe;++pe)Q[pe]=0}var $e=2,Ke=0,ye=T,Ie=le-ie&32767;if(We>2&&oe==U(F-Ie))for(var vs=Math.min(b,We)-1,Ot=Math.min(32767,F),gs=Math.min(258,We);Ot>=Ie&&--ye&&le!=ie;){if(h[F+$e]==h[F+$e-Ie]){for(var Pe=0;gs>Pe&&h[F+Pe]==h[F+Pe-Ie];++Pe);if(Pe>$e){if($e=Pe,Ke=Ie,Pe>vs)break;var _s=Math.min(Ie,Pe-2),Rt=0;for(pe=0;_s>pe;++pe){var gi=F-Ie+pe+32768&32767,tn=gi-A[gi]+32768&32767;tn>Rt&&(Rt=tn,ie=gi)}}}Ie+=(le=ie)-(ie=A[le])+32768&32767}if(Ke){j[me++]=268435456|Fr[$e]<<18|$r[Ke];var sn=31&Fr[$e],rn=31&$r[Ke];Se+=Yr[sn]+Xr[rn],++W[257+sn],++Q[rn],xe=F+$e,++we}else j[me++]=h[F],++W[h[F]]}}S=Bn(h,E,!0,j,W,Q,Se,me,ee,F-ee,S)}return zo(P,0,f+jo(S)+g)})(n=e,(a=t).level==null?6:a.level,a.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+a.mem,o,l)),c=u.length;return(function(h,d){var p=d.filename;if(h[0]=31,h[1]=139,h[2]=8,h[8]=2>d.level?4:d.level==9?2:0,h[9]=3,d.mtime!=0&&Ni(h,4,Math.floor(new Date(d.mtime||Date.now())/1e3)),p){h[3]=8;for(var f=0;p.length>=f;++f)h[f+10]=p.charCodeAt(f)}})(u,t),Ni(u,c-8,s.d()),Ni(u,c-4,i),u}var Pc=!!Zi||!!Dr,Ho="text/plain",As=!1,qo=(e,t)=>{var s=e.split("#"),i=s[1],r=s[0].split("?"),n=r[0],a=r[1];if(!a)return e;var o=a.split("&").filter((l=>l.split("=")[0]!==t)).join("&");return n+(o?"?"+o:"")+(i?"#"+i:"")},Qr=function(e,t,s){var i;s===void 0&&(s=!0);var r=e.split("?"),n=r[0],a=r[1],o=y({},t),l=(i=a==null?void 0:a.split("&").map((c=>{var h,d=c.split("="),p=d[0],f=s&&(h=o[p])!==null&&h!==void 0?h:d[1];return delete o[p],p+"="+f})))!==null&&i!==void 0?i:[],u=(function(c,h){var d,p;h===void 0&&(h="&");var f=[];return B(c,(function(g,_){w(g)||w(_)||_==="undefined"||(d=encodeURIComponent((m=>m instanceof File)(g)?g.name:g.toString()),p=encodeURIComponent(_),f[f.length]=p+"="+d)})),f.join(h)})(o);return u&&l.push(u),l.length>0?n+"?"+l.join("&"):n},ji=e=>{if(e.Vr)return e.Vr;var t=e.data,s=e.compression;if(t){if(s===ve.GZipJS){var i=Sc((function(o,l){var u=o.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(o);for(var c=new Fe(o.length+(o.length>>>1)),h=0,d=function(_){c[h++]=_},p=0;u>p;++p){if(h+5>c.length){var f=new Fe(h+8+(u-p<<1));f.set(c),c=f}var g=o.charCodeAt(p);128>g?d(g):2048>g?(d(192|g>>>6),d(128|63&g)):g>55295&&57344>g?(d(240|(g=65536+(1047552&g)|1023&o.charCodeAt(++p))>>>18),d(128|g>>>12&63),d(128|g>>>6&63),d(128|63&g)):(d(224|g>>>12),d(128|g>>>6&63),d(128|63&g))}return zo(c,0,h)})(xt(t)),{mtime:0});return{contentType:Ho,body:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength),estimatedSize:i.byteLength}}if(s===ve.Base64){var r=(function(o){return o&&btoa(encodeURIComponent(o).replace(/%([0-9A-F]{2})/g,((l,u)=>String.fromCharCode(parseInt(u,16)))))})(xt(t)),n=(o=>"data="+encodeURIComponent(typeof o=="string"?o:xt(o)))(r);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var a=xt(t);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},Go=e=>{var t,s,i=()=>e.transport==="sendBeacon"?{url:Qr(e.url,{compression:ve.Base64}),encodedBody:ji(y({},e,{compression:ve.Base64,Vr:void 0}))}:{url:qo(e.url,"compression"),encodedBody:ji(y({},e,{compression:void 0,Vr:void 0}))};try{t=ji(e)}catch(r){if(gn(e.compression,Ft(e.url,"compression")))return k.error("Failed to gzip request body, sending uncompressed payload",r),i();throw r}return t&&gn(e.compression,Ft(e.url,"compression"))&&!((s=t.body)instanceof ArrayBuffer?Yi(new Uint8Array(s)):ArrayBuffer.isView(s)&&Yi(new Uint8Array(s.buffer,s.byteOffset,s.byteLength)))?(As=!0,i()):{url:e.url,encodedBody:t}},Bo=e=>{try{return Go(e)}catch(t){return k.error(t),void(e.callback==null||e.callback({statusCode:0,error:t}))}},Tc=(function(){var e=re((function*(t){var s=xt(t.data),i=yield(function(n,a,o){return Xi.apply(this,arguments)})(s,z.DEBUG,{rethrow:!0});if(!i)return t;var r=yield i.arrayBuffer();return y({},t,{Vr:{contentType:Ho,body:r,estimatedSize:r.byteLength}})}));return function(t){return e.apply(this,arguments)}})(),Fc=/Failed to fetch|NetworkError|Load failed/i,Uo=e=>{var t=Bo(e);if(t){var s=t.url,i=t.encodedBody,r=i??{},n=r.contentType,a=r.body,o=r.estimatedSize,l=new Headers;B(e.headers,(function(f,g){l.append(g,f)})),n&&l.append("Content-Type",n);var u=null,c=!1;if(cn){var h=new cn;u={signal:h.signal,timeout:setTimeout((()=>{var f,g;c=!0,h.abort((f=e.timeout,(g=new Error("PostHog request timed out"+(f?" after "+f+"ms":""))).name="AbortError",g))}),e.timeout)}}var d=f=>{c&&(f==null?void 0:f.name)==="AbortError"||(g=>(g==null?void 0:g.name)==="TypeError"&&Fc.test((g==null?void 0:g.message)||""))(f)?k.warn(f):k.error(f),e.callback==null||e.callback({statusCode:0,error:f})};try{var p;Dr(s,y({method:(e==null?void 0:e.method)||"GET",headers:l,keepalive:e.method==="POST"&&!e.Wr&&52428.8>(o||0),body:a,signal:(p=u)==null?void 0:p.signal},e.fetchOptions)).then((f=>f.text().then((g=>
1{var _={statusCode:f.status,text:g};if(f.status===200)try{_.json=JSON.parse(g)}catch(m){k.error(m)}e.callback==null||e.callback(_)})))).catch(d).finally((()=>u?clearTimeout(u.timeout):null))}catch(f){u&&clearTimeout(u.timeout),d(f)}}},Rr=e=>{try{var t,s=Go(e),i=s.url,r=s.encodedBody,n=r??{},a=n.body,o=n.estimatedSize;if(!a)return;var l=a instanceof Blob?a:new Blob([a],{type:n.contentType});if(ue.sendBeacon(i,l))return;var u=R(e.data)?e.data:(t=e.data)==null?void 0:t.batch;if(R(u)&&u.length>1&&(o??0)>16384){var c=Math.ceil(u.length/2),h=d=>R(e.data)?d:y({},e.data,{batch:d});return Rr(y({},e,{data:h(u.slice(0,c))})),void Rr(y({},e,{data:h(u.slice(c))}))}k.warn("Beacon of ~"+(o??0)+" bytes was rejected by the browser, falling back to fetch"),Uo(y({},e,{Wr:!0}))}catch(d){k.warn("Beacon send failed",d)}},Un=(e,t,s,i)=>{var r=i==="query"?t==="POST"?"sent_at":"_":void 0;return Qr(s===ve.GZipJS?qo(e,"compression"):e,y({},r?{[r]:Date.now().toString()}:{},s===ve.GZipJS?{}:{compression:s}))},Ls=[];Dr&&Ls.push({transport:"fetch",method:Uo}),Zi&&Ls.push({transport:"XHR",method(e){var t=Bo(e);if(t){var s=new Zi,i=t.encodedBody;s.open(e.method||"GET",t.url,!0);var r=i??{},n=r.contentType,a=r.body;B(e.headers,(function(o,l){s.setRequestHeader(l,o)})),n&&s.setRequestHeader("Content-Type",n),e.timeout&&(s.timeout=e.timeout),s.onreadystatechange=()=>{if(s.readyState===4){var o={statusCode:s.status,text:s.responseText};if(s.status===200)try{o.json=JSON.parse(s.responseText)}catch{}e.callback==null||e.callback(o)}},s.send(a)}}}),ue!=null&&ue.sendBeacon&&Ls.push({transport:"sendBeacon",method:Rr});var Cr=3e3,$c=class{constructor(e,t){this.Zr=!0,this.Gr=[],this.Qr=Ae((t==null?void 0:t.flush_interval_ms)||Cr,250,5e3,k.createLogger("flush interval"),Cr),this.Jr=e}enqueue(e){this.Gr.push(e),this.Kr||this.Yr()}unload(){this.Xr();var e=this.Gr.length>0?this.ei():{},t=Object.values(e);[...t.filter((s=>s.url.indexOf("/e")===0)),...t.filter((s=>s.url.indexOf("/e")!==0))].map((s=>{this.ti(y({},s,{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 t=this.ei(),s=function(){var r=t[i],n=new Date().getTime();r.data&&R(r.data)&&B(r.data,(a=>{a.offset=Math.abs(a.timestamp-n),delete a.timestamp})),e.ti(r)};for(var i in t)s()}}),this.Qr))}ti(e){try{this.Jr(e)}catch(t){k.error(t)}}Xr(){clearTimeout(this.Kr),this.Kr=void 0}ei(){var e={};return B(this.Gr,(t=>{var s,i=t,r=(i?i.batchKey:null)||i.url;w(e[r])&&(e[r]=y({},i,{data:[]})),(s=e[r].data)==null||s.push(i.data)})),this.Gr=[],e}},Ic=["retriesPerformedSoFar"],Mc=class{constructor(e){this.ri=!1,this.ii=3e3,this.Gr=[],this._instance=e,this.Gr=[],this.ni=!0,!w(v)&&"onLine"in v.navigator&&(this.ni=v.navigator.onLine,this.si=()=>{this.ni=!0,this.oi()},this.ai=()=>{this.ni=!1},se(v,"online",this.si),se(v,"offline",this.ai))}get length(){return this.Gr.length}retriableRequest(e){var t=e.retriesPerformedSoFar,s=ya(e,Ic);je(t)&&(s.url=Qr(s.url,{retry_count:t})),this._instance._send_request(y({},s,{callback:i=>{if(i.statusCode!==200&&(400>i.statusCode||i.statusCode>=500)){if((i.statusCode===0?3:10)>(t??0))return void this.kt(y({retriesPerformedSoFar:t},s));i.statusCode===0&&k.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(t??0)+" retries.")}s.callback==null||s.callback(i)}}))}kt(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var s=(function(n){var a=3e3*Math.pow(2,n),o=a/2,l=Math.min(18e5,a),u=Math.random()-.5;return Math.ceil(l+u*(l-o))})(t),i=Date.now()+s;this.Gr.push({retryAt:i,requestOptions:e});var r="Enqueued failed request for retry in "+s;navigator.onLine||(r+=" (Browser is offline)"),k.warn(r),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(),t=[],s=this.Gr.filter((r=>e>r.retryAt||(t.push(r),!1)));if(this.Gr=t,s.length>0)for(var i of s)this.retriableRequest(i.requestOptions)}unload(){for(var e of(this.ui&&(clearTimeout(this.ui),this.ui=void 0),this.ri=!1,w(v)||(this.si&&(v.removeEventListener("online",this.si),this.si=void 0),this.ai&&(v.removeEventListener("offline",this.ai),this.ai=void 0)),this.Gr)){var t=e.requestOptions;try{this._instance._send_request(y({},t,{transport:"sendBeacon"}))}catch(s){k.error(s)}}this.Gr=[]}},Oc=class{constructor(e){this.hi=()=>{var t,s,i,r;this.di||(this.di={});var n=this.scrollElement(),a=this.scrollY(),o=n?Math.max(0,n.scrollHeight-n.clientHeight):0,l=a+((n==null?void 0:n.clientHeight)||0),u=(n==null?void 0:n.scrollHeight)||0;this.di.lastScrollY=Math.ceil(a),this.di.maxScrollY=Math.max(a,(t=this.di.maxScrollY)!==null&&t!==void 0?t:0),this.di.maxScrollHeight=Math.max(o,(s=this.di.maxScrollHeight)!==null&&s!==void 0?s:0),this.di.lastContentY=l,this.di.maxContentY=Math.max(l,(i=this.di.maxContentY)!==null&&i!==void 0?i:0),this.di.maxContentHeight=Math.max(u,(r=this.di.maxContentHeight)!==null&&r!==void 0?r: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(){se(v,"scroll",this.hi,{capture:!0}),se(v,"scrollend",this.hi,{capture:!0}),se(v,"resize",this.hi)}scrollElement(){if(!this.ci)return v==null?void 0:v.document.documentElement;var e=R(this.ci)?this.ci:[this.ci];for(var t of e){var s=v==null?void 0:v.document.querySelector(t);if(s)return s}}vi(e){var t=e==="y"?"scrollTop":"scrollLeft";if(this.ci){var s=this.scrollElement();return s&&s[t]||0}return v?e==="y"?v.scrollY||v.pageYOffset||v.document.documentElement.scrollTop||0:v.scrollX||v.pageXOffset||v.document.documentElement.scrollLeft||0:0}scrollY(){return this.vi("y")}scrollX(){return this.vi("x")}},Rc=e=>Ro(e==null?void 0:e.config.mask_personal_data_properties,e==null?void 0:e.config.custom_personal_data_properties,e==null?void 0:e.config.disable_capture_url_hashes
1),Vn=class{constructor(e,t,s,i){this.fi=r=>{var n=this.pi();if(!n||n.sessionId!==r){var a={sessionId:r,props:this.gi(this._instance)};this.mi.register({[yr]:a})}},this._instance=e,this.yi=t,this.mi=s,this.gi=i||Rc,this.yi.onSessionId(this.fi)}pi(){return this.mi.props[yr]}getSetOnceProps(){var e,t=(e=this.pi())==null?void 0:e.props;return t?"r"in t?Co(t,this._instance.config.disable_capture_url_hashes):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return B(Wr(this.getSetOnceProps()),((t,s)=>{s==="$current_url"&&(s="url"),e["$session_entry_"+Qi(s)]=t})),e}},en=class{on(e,t){return this.bi[e]||(this.bi[e]=[]),this.bi[e].push(t),()=>{this.bi[e]=this.bi[e].filter((s=>s!==t))}}emit(e,t){for(var s of this.bi[e]||[])s(t);for(var i of this.bi["*"]||[])i(e,t)}constructor(){this.bi={}}},Gt=Y("[SessionId]"),Wn=class{on(e,t){return this.wi.on(e,t)}constructor(e,t,s){var i;if(this.xi=null,this.ki=[],this.Si=void 0,this.Ci=!1,this.wi=new en,this.Ti=(l,u)=>!(!je(l)||!je(u))&&Math.abs(l-u)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===Ge)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=t||qe,this.Ri=s||qe;var r=this.Te.persistence_name||this.Te.token;if(this._sessionTimeoutMs=1e3*Ae(this.Te.session_idle_timeout_seconds||1800,60,36e3,Gt.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Pi(),this.Oi="ph_"+r+"_window_id",this.Fi="ph_"+r+"_primary_window_exists",this.Li()){var n=ce.F(this.Oi),a=ce.F(this.Fi);n&&!a?this.Ii=n:ce.P(this.Oi),ce.q(this.Fi,!0)}if((i=this.Te.bootstrap)!=null&&i.sessionID)try{var o=(l=>{var u=this.Te.bootstrap.sessionID.replace(/-/g,"");if(u.length!==32)throw new Error("Not a valid UUID");if(u[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(u.substring(0,12),16)})();this.$i(this.Te.bootstrap.sessionID,new Date().getTime(),o)}catch(l){Gt.error("Invalid sessionID in bootstrap",l)}this.Ai()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return w(this.ki)&&(this.ki=[]),this.ki.push(e),this.Mi&&e(this.Mi,this.Ii),()=>{this.ki=this.ki.filter((t=>t!==e))}}Li(){return this.Te.persistence!=="memory"&&!this.mi.yr&&ce.N()}Ni(e){e!==this.Ii&&(this.Ii=e,this.Li()&&ce.q(this.Oi,e))}Di(){return this.Ii?this.Ii:this.Li()?ce.F(this.Oi):null}qi(e){var t=this.xi;return!ge(t)&&!ge(e)&&5e3>Math.abs(e-t)}$i(e,t,s){var i=t!==this._sessionActivityTimestamp,r=!(e!==this.Mi||s!==this._sessionStartTimestamp);this._sessionStartTimestamp=s,this._sessionActivityTimestamp=t,this.Mi=e,r&&!i||r&&this.qi(t)||(this.xi=t,this.mi.register({[wt]:[t,e,s]}))}ji(){var e,t=(e=this.Te)==null?void 0:e.persistence_save_debounce_ms;return je(t)&&t>0}Hi(){this.ji()?this.mi.refreshKey(wt):(this.mi.flush(),this.mi.load())}Bi(){var e;if(!ge(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.xi){this.Hi();var t=this.Ui();t[1]===this.Mi&&t[2]===this._sessionStartTimestamp&&(this.xi=this._sessionActivityTimestamp,this.mi.register({[wt]:[this._sessionActivityTimestamp,(e=this.Mi)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.mi.flush())}}zi(){var e=this.Ui()[0],t=je(e)?e:0,s=je(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,s)}Vi(e){return this.Hi(),this.Ti(e,this.zi())}Ui(){var e=this.mi.props[wt];return R(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&&v&&(v.removeEventListener(Qs,this.Si,{capture:!1}),this.Si=void 0),this.ki=[]}Ai(){this.Si=()=>{this.Bi(),this.Li()&&ce.P(this.Fi)},se(v,Qs,this.Si,{capture:!1})}
1checkAndGetSessionAndWindowId(e,t){if(e===void 0&&(e=!1),t===void 0&&(t=null),this.Te.cookieless_mode===Ge)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var s=t||new Date().getTime(),i=this.Ui(),r=i[1],n=i[2],a=this.zi(),o=this.Di(),l=je(n)&&Math.abs(s-n)>864e5,u=!1,c=!1,h=!r,d=r,p=!h&&!e&&this.Ti(s,a);if(p){(p=this.Vi(s))||Gt.info("cross-tab refresh kept the session alive",{sessionId:r});var f=this.Ui();r=f[1],n=f[2]}h||p||l?(r=this.Ei(),o=this.Ri(),Gt.info("new session ID generated",{sessionId:r,windowId:o,changeReason:{noSessionId:h,activityTimeout:p,sessionPastMaximumLength:l}}),n=s,u=!0):(o||(o=this.Ri(),u=!0),(c=r!==d)&&(Gt.info("adopted cross-tab session id",{sessionId:r,windowId:o}),u=!0));var g=je(a)&&e&&!l?a:s,_=je(n)?n:new Date().getTime();this.Ni(o),this.$i(r,g,_),e||this.Pi();var m={noSessionId:h,activityTimeout:p,sessionPastMaximumLength:l,crossTabAdoption:c};return u&&this.ki.forEach((P=>P(r,o,m))),{sessionId:r,windowId:o,sessionStartTimestamp:_,changeReason:u?m: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))}},Vo=function(e,t){if(!e)return!1;var s=e.userAgent;if(s&&mn(s,t))return!0;try{var i=e==null?void 0:e.userAgentData;if(i!=null&&i.brands&&i.brands.some((r=>mn(r==null?void 0:r.brand,t))))return!0}catch{}return!!e.webdriver};function Wo(){return(Wo=re((function*(){var e=ue==null?void 0:ue.userAgentData;if(e!=null&&e.getHighEntropyValues)try{var t=yield e.getHighEntropyValues(["model"]),s=t==null?void 0:t.model;return G(s)&&s.length>0?s:void 0}catch(i){return void k.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",i)}}))).apply(this,arguments)}var ni=function(e,t){if(!(function(s){try{new RegExp(s)}catch{return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}};function Kn(e,t,s){return xt({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:s})}var Ko={exact:(e,t)=>t.some((s=>e.some((i=>s===i)))),is_not:(e,t)=>t.every((s=>e.every((i=>s!==i)))),regex:(e,t)=>t.some((s=>e.some((i=>ni(s,i))))),not_regex:(e,t)=>t.every((s=>e.every((i=>!ni(s,i))))),icontains:(e,t)=>t.map(Ts).some((s=>e.map(Ts).some((i=>s.includes(i))))),not_icontains:(e,t)=>t.map(Ts).every((s=>e.map(Ts).every((i=>!s.includes(i))))),gt:(e,t)=>t.some((s=>{var i=parseFloat(s);return!isNaN(i)&&e.some((r=>i>parseFloat(r)))})),lt:(e,t)=>t.some((s=>{var i=parseFloat(s);return!isNaN(i)&&e.some((r=>i<parseFloat(r)))}))},Ts=e=>e.toLowerCase();function Jo(e,t){return!e||Object.entries(e).every((s=>{var i=s[1],r=t==null?void 0:t[s[0]];if(w(r)||ge(r))return!1;var n=[String(r)],a=Ko[i.operator];return!!a&&a(i.values,n)}))}var Ar="custom",Jn="i.posthog.com",Cc=/^\/static\//,Ac=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,t=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+Jn,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}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":Ar),this.Zi[this.apiHost]}Gi(e){if(Cc.test(e)){var t=this.instance.config.asset_host;if(typeof t=="string")return t.trim().replace(/\/$/,"")||void 0}}endpointFor(e,t){if(t===void 0&&(t=""),t&&(t=t[0]==="/"?t:"/"+t),e==="ui")return this.uiHost+t;if(e==="flags")return this.flagsApiHost+t;if(e==="assets"){var s=this.Gi(t);if(s)return""+s+t}if(this.region===Ar)return this.apiHost+t;var i=Jn+t;switch(e){case"assets":return"https://"+this.region+"-assets."+i;case"api":return"https://"+this.region+"."+i}}};function Zo(e){var t;return!((t=e.conditions)==null||(t=t.events)==null||(t=t.values)==null||!t.length)}var H=Y("[Surveys]"),Yo="seenSurvey_",Xo=e=>{try{var t=(s=>((i,r)=>""+Yo+(function(n){return n.current_iteration&&n.current_iteration>0?n.id+"_"+n.current_iteration:n.id})(r))(0,s))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(s){H.error("Failed to persist survey seen state",s)}},Lc=[Ai.Popover,Ai.Widget,Ai.API],Dc={ignoreConditions:!1,ignoreDelay:!1,displayType:Tr.Popover}
1,Nc=Y("[PostHog ExternalIntegrations]"),jc={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},zc=class{constructor(e){this._instance=e}er(e,t){var s;(s=$.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,e,(i=>{if(i)return Nc.error("failed to load script",i);t()}))}startIfEnabledOrStop(){var e=this,t=function(){var r,n,a,o=s[0],l=s[1];!l||(r=$.__PosthogExtensions__)!=null&&(r=r.integrations)!=null&&r[o]||e.er(jc[o],(()=>{var u;(u=$.__PosthogExtensions__)==null||(u=u.integrations)==null||(u=u[o])==null||u.start(e._instance)})),!l&&(n=$.__PosthogExtensions__)!=null&&(n=n.integrations)!=null&&n[o]&&((a=$.__PosthogExtensions__)==null||(a=a.integrations)==null||(a=a[o])==null||a.stop())};for(var s of Object.entries((i=this._instance.config.integrations)!==null&&i!==void 0?i:{})){var i;t()}}},rs={},zi=0,ai=()=>{},Zn='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Bt="Surveys module not available",Yn="sanitize_properties is deprecated. Use before_send instead",Qo="Invalid value for property_denylist config: ",Hc=["token","distinct_id",ro],bt="posthog",el=!Pc&&(de==null?void 0:de.indexOf("MSIE"))===-1&&(de==null?void 0:de.indexOf("Mozilla"))===-1,Hi=e=>{var t;return y({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Gu(x==null?void 0:x.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:ai,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:e??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:q&&G(q==null?void 0:q.search)&&q.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:(v==null||(t=v.location)==null?void 0:t.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_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(s){k.error("Bad HTTP status: "+s.statusCode+" "+s.text)},get_device_id:s=>s,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:Er,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:Cr},error_tracking:{},_onCapture:ai},(s=>({rageclick:s&&s>="2026-05-30"?{content_ignorelist:sc,ignore_text_selection:!0}
1:!s||"2025-11-30">s||{content_ignorelist:!0},capture_pageview:!s||"2025-05-24">s||"history_change",session_recording:s&&s>="2026-06-25"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6},streamNetworkBody:!0}:s&&s>="2026-05-30"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6}}:s&&s>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:s&&s>="2026-01-30"?"head":"body",internal_or_test_user_hostname:s&&s>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:s&&s>="2026-05-30"?250:0,split_storage:!(!s||"2026-05-30">s),detect_google_search_app:!(!s||"2026-05-30">s),disable_capture_url_hashes:!(!s||"2026-06-25">s)}))(e))},qc=[["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"]],Xn=e=>{var t={};for(var s of qc){var i=s[0],r=s[1];w(e[i])||(t[r]=e[i])}var n=K({},t,e),a=e.__preview_external_dependency_versioned_paths;return w(a)||(w(e.strict_script_versioning)&&(n.strict_script_versioning=!!a),G(a)&&w(e.asset_host)&&(n.asset_host=a)),R(e.property_blacklist)&&(w(e.property_denylist)?n.property_denylist=e.property_blacklist:R(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:k.error(Qo+e.property_denylist)),n},Gc=class{constructor(){this.__forceAllowLocalhost=!1}get Qi(){return this.__forceAllowLocalhost}set Qi(e){k.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},ns=class ot{Ji(t,s){if(t){var i=this.Ki.indexOf(t);i!==-1&&this.Ki.splice(i,1)}return this.Ki.push(s),s.initialize==null||s.initialize(),s}Yi(){return this.config.cookieless_mode===Ge||this.config.cookieless_mode===at&&this.consent.isRejected()}get decideEndpointWasHit(){var t,s;return(t=(s=this.featureFlags)==null?void 0:s.hasLoadedFlags)!==null&&t!==void 0&&t}get flagsEndpointWasHit(){var t,s;return(t=(s=this.featureFlags)==null?void 0:s.hasLoadedFlags)!==null&&t!==void 0&&t}constructor(){var t;this.webPerformance=new Gc,this.Xi=!1,this.version=z.LIB_VERSION,this.en=new en,this.Ki=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Hi(),this.SentryIntegration=hc,this.sentryIntegration=i=>(function(r,n){var a=Po(r,n);return{name:So,processEvent:o=>a(o)}})(this,i),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.tn=!1,this.rn=null,this.nn=null,this.sn=null,this.scrollManager=new Oc(this),this.pageViewManager=new Nn(this),this.rateLimiter=new bc(this),this.requestRouter=new Ac(this),this.consent=new Yu(this),this.externalIntegrations=new zc(this);var s=(t=ot.__defaultExtensionClasses)!==null&&t!==void 0?t:{};this.featureFlags=s.featureFlags&&new s.featureFlags(this),this.toolbar=s.toolbar&&new s.toolbar(this),this.surveys=s.surveys&&new s.surveys(this),this.conversations=s.conversations&&new s.conversations(this),this.logs=s.logs&&new s.logs(this),this.metrics=s.metrics&&new s.metrics(this),this.experiments=s.experiments&&new s.experiments(this),this.exceptions=s.exceptions&&new s.exceptions(this),this.people={set:(i,r,n)=>{var a=G(i)?{[i]:r}:i;this.setPersonProperties(a),n==null||n({})},set_once:(i,r,n)=>{var a=G(i)?{[i]:r}:i;this.setPersonProperties(void 0,a),n==null||n({})}},this.on("eventCaptured",(i=>k.info('send "'+(i==null?void 0:i.event)+'"',i)))}init(t,s,i){if(i&&i!==bt){var r,n=(r=rs[i])!==null&&r!==void 0?r:new ot;return n._init(t,s,i),rs[i]=n,rs[bt][i]=n,n}return this._init(t,s,i)}_init(t,s,i){var r,n;s===void 0&&(s={});var a=G(t)?t.trim():"";if(!a)return k.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;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=Hi(s.defaults),s.debug=this.an(s.debug),this.ln=s,this.un=[],s.person_profiles?this.nn=s.person_profiles:s.process_person&&(this.nn=s.process_person);var o=Hi(s.defaults),l=Xn(s),u=K({},o,l,{name:i,token:a});Z(o.rageclick)&&Z(l.rageclick)&&(u.rageclick=K({},o.rageclick,l.rageclick)),Z(o.session_recording)&&Z(l.session_recording)&&(u.session_recording=K({},o.session_recording,l.session_recording)),this.set_config(u),this.config.on_xhr_error&&k.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=s.disable_compression?void 0:ve.GZipJS;var c=this.hn();this.persistence=new Ci(this.config,c),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Ci(y({},this.config,{persistence:"sessionStorage"}),c,!1);var h=y({},this.persistence.props),d=y({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.dn=new $c((S=>this.cn(S)),this.config.request_queue_config),this.vn=new Mc(this),this.__request_queue=[];var p=this.Yi();if(p||(this.sessionManager=new Wn(this),this.sessionPropsManager=new Vn(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(k.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.fn(p)}),0)):(k.info("Initializing extensions synchronously"),this.fn(p)),z.DEBUG=z.DEBUG||this.config.debug,z.DEBUG&&k.info("Starting in debug mode",{this:this,config:s,thisC:y({},this.config),p:h,s:d}),!this.config.identity_distinct_id||(r=s.bootstrap)!=null&&r.distinctID||(s.bootstrap=y({},s.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),((n=s.bootstrap)==null?void 0:n.distinctID)!==void 0){var f=s.bootstrap.distinctID,g=this.get_distinct_id(),_=this.persistence.get_property(Me);if(s.bootstrap.isIdentifiedID&&g!=null&&g!==f&&_===ft)this.identify(f);else if(s.bootstrap.isIdentifiedID&&g!=null&&g!==f&&_===vt)k.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var m=this.config.get_device_id(qe()),P=s.bootstrap.isIdentifiedID?m:f;this.persistence.set_property(Me,s.bootstrap.isIdentifiedID?vt:ft),this.register({distinct_id:f,$device_id:P})}}if(p)this.register_once({distinct_id:xs,$device_id:null},"");else if(!this.get_distinct_id()){var E=this.config.get_device_id(qe());this.register_once({distinct_id:E,$device_id:E},""),this.persistence.set_property(Me,ft)}return se(v,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),s.segment?(function(S,F){var N=S.config.segment;if(!N)return F();(function(L,b){var T=L.config.segment;if(!T)return b();var I=M=>{var D=()=>M.anonymousId()||qe();L.config.get_device_id=D,M.id()&&(L.register({distinct_id:M.id(),$device_id:D()}),L.persistence.set_property(Me,vt)),b()},A=T.user();"then"in A&&Oe(A.then)?A.then(I):I(A)})(S,(()=>{N.register((L=>{typeof Promise<"u"&&Promise.resolve||Oi.warn("This browser does not have Promise support, and can not use the segment integration");var b=(T,I)=>{if(!I)return T;T.event.userId||T.event.anonymousId===L.get_distinct_id()||(Oi.info("No userId set, resetting PostHog"),L.reset()),T.event.userId&&T.event.userId!==L.get_distinct_id()&&(Oi.info("UserId set, identifying with PostHog"),L.identify(T.event.userId)
1);var A=L.calculateEventProperties(I,T.event.properties);return T.event.properties=Object.assign({},A,T.event.properties),T};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:T=>b(T,T.event.event),page:T=>b(T,yt),identify:T=>b(T,$i),screen:T=>b(T,"$screen")}})(S)).then((()=>{F()}))}))})(this,(()=>this.pn())):this.pn(),Oe(this.config._onCapture)&&this.config._onCapture!==ai&&(k.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(S=>this.config._onCapture(S.event,S)))),this.config.ip&&k.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this.config.disableDeviceModel||(function(){return Wo.apply(this,arguments)})().then((S=>{S&&this.register({[Ti]:S})})).catch(ai),this}fn(t){var s,i,r,n,a,o,l,u,c=performance.now(),h=y({},ot.__defaultExtensionClasses,this.config.__extensionClasses),d=[];h.featureFlags&&this.Ki.push(this.featureFlags=(s=this.featureFlags)!==null&&s!==void 0?s:new h.featureFlags(this)),h.exceptions&&this.Ki.push(this.exceptions=(i=this.exceptions)!==null&&i!==void 0?i:new h.exceptions(this)),h.historyAutocapture&&this.Ki.push(this.historyAutocapture=new h.historyAutocapture(this)),h.tracingHeaders&&this.Ki.push(this.tracingHeaders=new h.tracingHeaders(this)),h.siteApps&&this.Ki.push(this.siteApps=new h.siteApps(this)),h.sessionRecording&&!t&&this.Ki.push(this.sessionRecording=new h.sessionRecording(this)),this.config.disable_scroll_properties||d.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),h.autocapture&&this.Ki.push(this.autocapture=new h.autocapture(this)),h.surveys&&this.Ki.push(this.surveys=(r=this.surveys)!==null&&r!==void 0?r:new h.surveys(this)),h.logs&&this.Ki.push(this.logs=(n=this.logs)!==null&&n!==void 0?n:new h.logs(this)),h.metrics&&this.Ki.push(this.metrics=(a=this.metrics)!==null&&a!==void 0?a:new h.metrics(this)),h.conversations&&this.Ki.push(this.conversations=(o=this.conversations)!==null&&o!==void 0?o:new h.conversations(this)),h.productTours&&this.Ki.push(this.productTours=new h.productTours(this)),h.heatmaps&&this.Ki.push(this.heatmaps=new h.heatmaps(this)),h.webVitalsAutocapture&&this.Ki.push(this.webVitalsAutocapture=new h.webVitalsAutocapture(this)),h.exceptionObserver&&this.Ki.push(this.exceptionObserver=new h.exceptionObserver(this)),h.deadClicksAutocapture&&this.Ki.push(this.deadClicksAutocapture=new h.deadClicksAutocapture(this,cc)),h.toolbar&&this.Ki.push(this.toolbar=(l=this.toolbar)!==null&&l!==void 0?l:new h.toolbar(this)),h.experiments&&this.Ki.push(this.experiments=(u=this.experiments)!==null&&u!==void 0?u:new h.experiments(this)),this.Ki.forEach((p=>{p.initialize&&d.push((()=>{p.initialize==null||p.initialize()}))})),d.push((()=>{if(this.gn){var p=this.gn;this.gn=void 0,this.Hr(p)}})),this.mn(d,c)}mn(t,s){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-s>=30&&t.length>0)return void setTimeout((()=>{this.mn(t,s)}),0);var i=t.shift();if(i)try{i()}catch(n){k.error("Error initializing extension:",n)}}var r=Math.round(performance.now()-s);this.register_for_session({[no]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[ao]:r}),this.config.__preview_deferred_init_extensions&&k.info("PostHog extensions initialized ("+r+"ms)")}Hr(t){if(!x||!x.body)return k.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Hr(t)}),500);if(this.config.__preview_deferred_init_extensions&&(this.gn=t),this.yn=t,this.compression=void 0,t.ok){var s,i=t.config;i.supportedCompression&&!this.config.disable_compression&&(this.compression=O(i.supportedCompression,ve.GZipJS)?ve.GZipJS:O(i.supportedCompression,ve.Base64)?ve.Base64:void 0),(s=i.analytics)!=null&&s.endpoint&&(this.analyticsDefaultEndpoint=i.analytics.endpoint)}this.set_config({person_profiles:this.nn?this.nn:Er}),this.Ki.forEach((r=>r.onRemoteConfig==null?void 0:r.onRemoteConfig(t)))}pn(){try{this.config.loaded(this)}catch(i){k.critical("`loaded` function failed",i)}if(this.bn(),this.config.internal_or_test_user_hostname&&q!=null&&q.hostname){var t=q.hostname,s=this.config.internal_or_test_user_hostname;(typeof s=="string"?t===s:s.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.Yi())&&this._n()}),1),this.wn=new Lo(this),this.wn.load()}bn(){var t;this.is_capturing()&&this.config.request_batching&&((t=this.dn)==null||t.enable())}_dom_loaded(){this.is_capturing()&&Es(this.__request_queue,(t=>this.cn(t))),this.__request_queue=[],this.bn()}_handle_unload(){var t,s,i,r,n;(t=this.surveys)==null||t.handlePageUnload==null||t.handlePageUnload(),(s=this.metrics)==null||s.flush("sendBeacon"),this.config.request_batching?(this.xn()&&this.capture(Fi),(i=this.logs)==null||i.flushLogs("sendBeacon"),(r=this.dn)==null||r.unload(),(n=this.vn)==null||n.unload()):this.xn()&&this.capture(Fi,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded?el?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&(t.callback==null||t.callback({statusCode:429})):(t.transport=t.transport||this.config.api_transport,t.headers=y({},this.config.request_headers,t.headers),t.compression=t.compression==="best-available"?this.compression:t.compression,(w(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,
1(s=>{var i,r,n,a=y({},s);a.timeout=a.timeout||6e4;var o,l,u,c,h,d=(i=a.transport)!==null&&i!==void 0?i:"fetch";d==="sendBeacon"&&w(a.compression)&&a.data&&(a.compression=ve.Base64),a.method==="POST"&&a.data&&(a.timestampMode==="capture-body"?a.data={api_key:(l=(h=(c=R(o=a.data)?o:[o])[0])==null||(u=h.properties)==null?void 0:u.token)!==null&&l!==void 0?l:h==null?void 0:h.token,batch:c,sent_at:new Date().toISOString()}:a.timestampMode==="body"&&(a.data=(function(g,_){return _===void 0&&(_=new Date().toISOString()),R(g)?g.map((m=>y({},m,{sent_at:_}))):y({},g,{sent_at:_})})(a.data))),a.url=Un(a.url,a.method,a.compression,a.timestampMode);var p=Ls.filter((g=>!a.disableTransport||!g.transport||!a.disableTransport.includes(g.transport))),f=(r=(n=(function(g,_){for(var m=0;g.length>m;m++)if(g[m].transport===d)return g[m]})(p))==null?void 0:n.method)!==null&&r!==void 0?r:p[0].method;if(!f)throw new Error("No available transport method");d!=="sendBeacon"&&a.data&&a.compression===ve.GZipJS&&Ul&&typeof Promise<"u"&&!As?Tc(a).then((g=>{f(g)})).catch((g=>{if(_n(g))return As=!0,void f(y({},a,{compression:void 0,url:Un(s.url,s.method,void 0,s.timestampMode)}));(_=>{if(!_||typeof _!="object")return!1;var m="name"in _?String(_.name):"";return _n(_)||m===ba})(g)&&(As=!0),f(a)})):f(a)})(y({},t,{callback:s=>{var i,r;this.rateLimiter.checkForLimiting(s),400>s.statusCode||(i=(r=this.config).on_request_error)==null||i.call(r,s),t.callback==null||t.callback(s)}}))):t.fireCallbackOnDrop&&(t.callback==null||t.callback({statusCode:0}))}
1cn(t){this.vn?this.vn.retriableRequest(t):this._send_request(t)}_execute_array(t){zi++;try{var s,i=[],r=[],n=[];Es(t,(o=>{if(o)if(R(s=o[0]))n.push(o);else if(Oe(o))try{o.call(this)}catch(l){k.error("Error executing queued PostHog call",o,l)}else R(o)&&s==="alias"?i.push(o):R(o)&&s.indexOf("capture")!==-1&&Oe(this[s])?n.push(o):r.push(o)}));var a=function(o,l){Es(o,(function(u){try{if(R(u[0])){var c=l;B(u,(function(h){c=c[h[0]].apply(c,h.slice(1))}))}else l[u[0]].apply(l,u.slice(1))}catch(h){k.error("Error executing queued PostHog call",u,h)}}))};a(i,this),a(r,this),a(n,this)}finally{zi--}}push(t){if(zi>0&&R(t)&&G(t[0])){var s=ot.prototype[t[0]];Oe(s)&&s.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,s,i){var r,n,a,o,l;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.dn){if(this.is_capturing())if(!w(t)&&G(t)){var u=!this.config.opt_out_useragent_filter&&this._is_bot();if(!u||this.config.__preview_capture_bot_pageviews){var c=i!=null&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(c==null||!c.isRateLimited){s!=null&&s.$current_url&&!G(s==null?void 0:s.$current_url)&&(k.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),s==null||delete s.$current_url),t!=="$exception"||i!=null&&i.kn||k.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&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 h=new Date,d=(i==null?void 0:i.timestamp)||h,p=xn(i==null?void 0:i.uuid,qe),f={uuid:p,event:t,properties:this.calculateEventProperties(t,s||{},d,p)};t===yt&&this.config.__preview_capture_bot_pageviews&&u&&(f.event="$bot_pageview",f.properties.$browser_type="bot"),c&&(f.properties.$lib_rate_limit_remaining_tokens=c.remainingTokens);var g=t==="$feature_flag_called"&&f.properties.$feature_flag_has_experiment===!1&&this.get_property(Ks)===!0;i!=null&&i.$set&&!g&&(f.$set=i==null?void 0:i.$set);var _=i==null?void 0:i.$unset;_&&(f.$unset=_);var m,P,E,S=g?void 0:this.Sn(i==null?void 0:i.$set_once,t!==Tn,t===$i);if(S&&(f.$set_once=S),i!=null&&i._noTruncate||(n=this.config.properties_string_max_length,a=f,o=M=>G(M)?M.slice(0,n):M,l=new Set,f=(function M(D,X){if(D!==Object(D))return o?o(D):D;if(!l.has(D)){var U;if(l.add(D),R(D))U=[],Es(D,(W=>{U.push(M(W))}));else{var j={};B(D,((W,Q)=>{l.has(W)||(j[Q]=M(W))})),U=j}return U}})(a)),f.timestamp=d,w(i==null?void 0:i.timestamp)||(f.properties.$event_time_override_provided=!0,f.properties.$event_time_override_system_time=h),g&&(f.properties=(function(M,D){D===void 0&&(D=[]);var X={},U=j=>{M[j]!==void 0&&(X[j]=M[j])};return Vl.forEach(U),D.forEach(U),X})(f.properties,Hc)),t===Ue.DISMISSED||t===Ue.SENT){var F=s==null?void 0:s[Li.SURVEY_ID],N=s==null?void 0:s[Li.SURVEY_ITERATION];Xo({id:F,current_iteration:N}),f.$set=y({},f.$set,{[(m={id:F,current_iteration:N},P=t===Ue.SENT?"responded":"dismissed",E="$survey_"+P+"/"+m.id,m.current_iteration&&m.current_iteration>0&&(E="$survey_"+P+"/"+m.id+"/"+m.current_iteration),E)]:!0})}else t===Ue.SHOWN&&(f.$set=y({},f.$set,{[Li.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(t===yc.SHOWN){var L=s==null?void 0:s[zn.TOUR_TYPE];L&&(f.$set=y({},f.$set,{[zn.TOUR_LAST_SEEN_DATE+"/"+L]:new Date().toISOString()}))}var b=y({},f.properties.$set,f.$set);if(Je(b)||this.setPersonPropertiesForFlags(b),!C(this.config.before_send)){var T=this.wt(f);if(!T)return;(f=T).uuid=xn(f.uuid,qe)}this.en.emit("eventCaptured",f);var I=(r=i==null?void 0:i._url)!==null&&r!==void 0?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),A={method:"POST",url:I,data:f,compression:"best-available",timestampMode:(i==null?void 0:i._batchKey)==="recordings"||/\/s\/(?:\?|$)/.test(I
1)?"body":"capture-body",batchKey:i==null?void 0:i._batchKey,transport:i==null?void 0:i.transport};return!this.config.request_batching||i&&(i==null||!i._batchKey)||i!=null&&i.send_instantly?this.cn(A):this.dn.enqueue(A),f}k.critical("This capture call is ignored due to client rate limiting.")}}else k.error("No event name provided to posthog.capture")}else k.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(s=>t(s.event,s)))}calculateEventProperties(t,s,i,r,n){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return s;var a=n?void 0:this.persistence.remove_event_timer(t),o=y({},s);if(o.token=this.config.token,o.$config_defaults=this.config.defaults,this.Yi()&&(o[ro]=!0),t==="$snapshot"){var l=y({},this.persistence.properties(),this.sessionPersistence.properties());return o.distinct_id=l.distinct_id,(!G(o.distinct_id)&&!he(o.distinct_id)||er(o.distinct_id))&&k.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),o}var u,c=(function(E,S,F,N){var L,b,T,I;if(N===void 0&&(N=!1),!de)return{};var A,M=E?[...$t,...S||[]]:[],D=(function(vs){for(var Ot=0;bn.length>Ot;Ot++){var gs=bn[Ot],Pe=gs[1],_s=gs[0].exec(vs),Rt=_s&&(Oe(Pe)?Pe(_s,vs):Pe);if(Rt)return Rt}return["",""]})(de),X=D[0],U=D[1],j=(A=typeof navigator<"u"?navigator:void 0)!=null&&A.brave?{brave:!0}:{},W={};w(F)||(W.detectGoogleSearchApp=F);var Q={},we=(L=navigator)==null||(L=L.userAgentData)==null?void 0:L.platform,Se=(b=navigator)==null?void 0:b.maxTouchPoints,me=v==null||(T=v.screen)==null?void 0:T.width,xe=v==null||(I=v.screen)==null?void 0:I.height,ee=v==null?void 0:v.devicePixelRatio;w(we)||(Q.userAgentDataPlatform=we),w(Se)||(Q.maxTouchPoints=Se),w(me)||(Q.screenWidth=me),w(xe)||(Q.screenHeight=xe),w(ee)||(Q.devicePixelRatio=ee);var oe,le,ie,We,pe,$e,Ke,ye,Ie=K(Wr({$os:X,$os_version:U,$browser:Ba(de,navigator.vendor,j,W),$device:wn(de),$device_type:(le=de,ie=Q,ye=wn(le),ye===Pa||ye===Sa||ye==="Kobo"||ye==="Kindle Fire"||ye===ja?St:ye===os||ye===kt||ye===ls||ye===sr?"Console":ye===Fa?"Wearable":ye?ke:(ie==null?void 0:ie.userAgentDataPlatform)==="Android"&&((We=ie==null?void 0:ie.maxTouchPoints)!==null&&We!==void 0?We:0)>0?600>Math.min((pe=ie==null?void 0:ie.screenWidth)!==null&&pe!==void 0?pe:0,($e=ie==null?void 0:ie.screenHeight)!==null&&$e!==void 0?$e:0)/((Ke=ie==null?void 0:ie.devicePixelRatio)!==null&&Ke!==void 0?Ke:1)?ke:St:"Desktop"),$timezone:Ao(),$timezone_offset:gc()}),{$current_url:hs(N?Ze(q==null?void 0:q.href):q==null?void 0:q.href,M,ds),$host:q==null?void 0:q.host,$pathname:q==null?void 0:q.pathname,$raw_user_agent:de.length>1e3?de.substring(0,997)+"...":de,$browser_version:hu(de,navigator.vendor,j,W),$browser_language:jn(),$browser_language_prefix:(oe=jn(),typeof oe=="string"?oe.split("-")[0]:void 0),$screen_height:v==null?void 0:v.screen.height,$screen_width:v==null?void 0:v.screen.width,$viewport_height:v==null?void 0:v.innerHeight,$viewport_width:v==null?void 0:v.innerWidth,$lib:z.LIB_NAME,$lib_version:z.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return z.SDK_DIST_CHANNEL&&(Ie.$sdk_dist_channel=z.SDK_DIST_CHANNEL),Ie})(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 h=this.sessionManager.checkAndGetSessionAndWindowId(n,i.getTime()),d=h.windowId;o.$session_id=h.sessionId,o.$window_id=d}this.sessionPropsManager&&K(o,this.sessionPropsManager.getSessionProps());try{var p;this.sessionRecording&&K(o,this.sessionRecording.sdkDebugProperties),o.$sdk_debug_retry_queue_size=(p=this.vn)==null?void 0:p.length}catch(E){o.$sdk_debug_error_capturing_properties=String(E)}if(this.requestRouter.region===Ar&&(o.$lib_custom_api_host=this.config.api_host),u=t!==yt||n?t!==Fi||n?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,r),o=K(o,u),t===yt&&x&&(o.title=x.title),!w(a)){var f=i.getTime()-a;o.$duration=parseFloat((f/1e3).toFixed(3))}de&&this.config.opt_out_useragent_filter&&(o.$browser_type=this._is_bot()?"bot":"browser");var g=this.persistence.properties(),_=this.sessionPersistence.properties();B(["$referrer","$referring_domain"],(E=>{E in g&&delete _[E]})),(o=K({},c,g,_,o)).$is_identified=this._isIdentified(),R(this.config.property_denylist)?B(this.config.property_denylist,(function(E){delete o[E]})):k.error(Qo+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var m=this.config.sanitize_properties;m&&(k.error(Yn),o=m(o,t));var P=this.Cn();return o.$process_person_profile=P,P&&!n&&this.Tn("_calculate_event_properties"),o}Sn(t,s,i){var r;if(s===void 0&&(s=!0),i===void 0&&(i=!1),!this.persistence||!this.Cn()||this.Xi&&!i)return t;var n=this.persistence.get_initial_props(),a=(r=this.sessionPropsManager)==null?void 0:r.getSetOnceProps(),o=K({},n,a||{},t||{}),l=this.config.sanitize_properties;return l&&(k.error(Yn),o=l(o,"$set_once")),s&&(this.Xi=!0),Je(o)?void 0:o}register(t,s){var i;(i=this.persistence)==null||i.register(t,s)}register_once(t,s,i){var r;(r=this.persistence)==null||r.register_once(t,s,i)}register_for_session(t){var s;(s=this.sessionPersistence)==null||s.register(t)}unregister(t){var s;(s=this.persistence)==null||s.unregister(t)}unregister_for_session(t){var s;(s=this.sessionPersistence)==null||s.unregister(t)}In(t,s){this.register({[t]:s})}getFeatureFlag(t,s){var i;return(i=this.featureFlags)==null?void 0:i.getFeatureFlag(t,s)}getFeatureFlagPayload(t){var s;return(s=this.featureFlags)==null?void 0:s.getFeatureFlagPayload(t)}getFeatureFlagResult(t,s){var i;return(i=this.featureFlags)==null?void 0:i.getFeatureFlagResult(t,s)}getAllFeatureFlags(){var t,s;return(t=(s=this.featureFlags)==null?void 0:s.getAllFeatureFlags())!==null&&t!==void 0?t:[]}isFeatureEnabled(t,s){var i,r;return(i=(r=this.featureFlags)==null?void 0:r.isFeatureEnabled(t,s))!==null&&i!==void 0?i:s==null?void 0:s.defaultValue}reloadFeatureFlags(){var t;(t=this.featureFlags)==null||t.reloadFeatureFlags()}updateFlags(t,s,i){var r;(r=this.featureFlags)==null||r.updateFlags(t,s,i)}updateEarlyAccessFeatureEnrollment(t,s,i){var r;(r=this.featureFlags)==null||r.updateEarlyAccessFeatureEnrollment(t,s,i)}getEarlyAccessFeatures(t,s,i){var r;return s===void 0&&(s=!1),(r=this.featureFlags)==null?void 0:r.getEarlyAccessFeatures(t,s,i)}on(t,s){return this.en.on(t,s)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:Bt}),()=>{})}onSessionId(t){var s,i;return(s=(i=this.sessionManager)==null?void 0:i.onSessionId(t))!==null&&s!==void 0?s:()=>{}}getSurveys(t,s){s===void 0&&(s=!1),this.surveys?this.surveys.getSurveys(t,s):t([],{isLoaded:!1,error:Bt})}getActiveMatchingSurveys(t,s){s===void 0&&(s=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,s):t([],{isLoaded:!1,error:Bt})}renderSurvey(t,s){var i;(i=this.surveys)==null||i.renderSurvey(t,s)}displaySurvey(t,s){var i;s===void 0&&(s=Dc),(i=this.surveys)==null||i.displaySurvey(t,s)}cancelPendingSurvey(t){var s;(s=this.surveys)==null||s.cancelPendingSurvey(t)}canRenderSurvey(t){var s,i;return(s=(i=this.surveys)==null?void 0:i.canRenderSurvey(t))!==null&&s!==void 0?s:{visible:!1,disabledReason:Bt}}canRenderSurveyAsync(t,s){var i,r;return s===void 0&&(s=!1),(i=(r=this.surveys)==null?void 0:r.canRenderSurveyAsync(t,s))!==null&&i!==void 0?i:Promise.resolve({visible:!1,disabledReason:Bt})}Mn(t){return!t||er(t)?(k.critical("Unique user id has not been set in posthog.identify"),!1):t===xs?(k.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(k.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and n
1ot a hardcoded string.'),!1)}identify(t,s,i){if(!this.__loaded||!this.persistence)return k.uninitializedWarning("posthog.identify");if(he(t)&&(t=t.toString(),k.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Mn(t)&&this.Tn("posthog.identify")){var r=this.get_distinct_id();this.register({$user_id:t}),this.get_property(Ws)||this.register_once({$had_persisted_distinct_id:!0,$device_id:r},""),t!==r&&t!==this.get_property(Kt)&&(this.unregister(Kt),this.register({distinct_id:t}));var n,a=(this.persistence.get_property(Me)||ft)===ft;t!==r&&a?(this.persistence.set_property(Me,vt),this.setPersonPropertiesForFlags({$set:s||{},$set_once:i||{}},!1),this.capture($i,{distinct_id:t,$anon_distinct_id:r},{$set:s||{},$set_once:i||{}}),this.sn=Kn(t,s,i),(n=this.featureFlags)==null||n.setAnonymousDistinctId(r)):(s||i)&&this.setPersonProperties(s,i),t!==r&&(this.reloadFeatureFlags(),this.unregister(ts))}}setPersonProperties(t,s){if((t||s)&&this.Tn("posthog.setPersonProperties")){var i=Kn(this.get_distinct_id(),t,s);this.sn!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:s||{}},!0),this.capture("$set",{$set:t||{},$set_once:s||{}}),this.sn=i):k.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var s,i=(R(t)?t:[t]).filter((r=>G(r)&&r.length>0));i.length!==0&&this.Tn("posthog.unsetPersonProperties")&&((s=this.featureFlags)==null||s.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.sn=null)}group(t,s,i){if(t&&s){var r=this.getGroups(),n=r[t]!==s;if(n&&this.resetGroupPropertiesForFlags(t),this.register({$groups:y({},r,{[t]:s})}),n||i){var a={$group_type:t,$group_key:s};i&&(a.$group_set=i),this.capture(Tn,a)}i&&this.setGroupPropertiesForFlags({[t]:i}),n&&!i&&this.reloadFeatureFlags()}else k.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,s){var i;s===void 0&&(s=!0),(i=this.featureFlags)==null||i.setPersonPropertiesForFlags(t,s)}resetPersonPropertiesForFlags(t){var s;t===void 0&&(t=!0),(s=this.featureFlags)==null||s.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,s){var i;s===void 0&&(s=!0),this.Tn("posthog.setGroupPropertiesForFlags")&&((i=this.featureFlags)==null||i.setGroupPropertiesForFlags(t,s))}resetGroupPropertiesForFlags(t){var s;(s=this.featureFlags)==null||s.resetGroupPropertiesForFlags(t)}reset(t){var s,i,r,n,a,o,l,u,c,h;if(k.info("reset"),!this.__loaded)return k.uninitializedWarning("posthog.reset");var d,p=this.get_property(Ws),f=this.get_property(Ti),g=this.get_property(ut);if(this.consent.reset(),(s=this.persistence)==null||s.clear(),(i=this.sessionPersistence)==null||i.clear(),w(g)||(d=this.persistence)==null||d.register({[ut]:g}),(r=this.surveys)==null||r.reset(),(n=this.wn)==null||n.stop(),(a=this.featureFlags)==null||a.reset(),(o=this.conversations)==null||o.reset(),(l=this.logs)==null||l.reset(),(u=this.metrics)==null||u.reset(),(c=this.persistence)==null||c.set_property(Me,ft),(h=this.sessionManager)==null||h.resetSessionId(),this.sn=null,this.config.cookieless_mode===Ge)this.register_once({distinct_id:xs,$device_id:null},"");else{var _=this.config.get_device_id(qe());this.register_once({distinct_id:_,$device_id:t?_:p},""),t||w(f)||this.register({[Ti]:f})}this.register({$last_posthog_reset:new Date().toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}shutdown(t){var s=this;return re((function*(){var i,r,n,a,o;s.__loaded?((i=s.logs)==null||i.flushLogs("sendBeacon"),(r=s.metrics)==null||r.flush("sendBeacon"),(n=s.dn)==null||n.unload(),(a=s.vn)==null||a.unload(),(o=s.featureFlags)==null||o.destroy()):k.uninitializedWarning("posthog.shutdown")}))()}setIdentity(t,s){var i;this.config.identity_distinct_id=t,this.config.identity_hash=s,this.alias(t),(i=this.conversations)==null||i.En()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,(t=this.conversations)==null||t.Rn()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,s;return(t=(s=this.sessionManager)==null?void 0:s.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&t!==void 0?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var s=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=s.sessionStartTimestamp,r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+s.sessionId);if(t!=null&&t.withTimestamp&&i){var n,a=(n=t.timestampLookBack)!==null&&n!==void 0?n:10;if(!i)return r;
1r+="?t="+Math.max(Math.floor((new Date().getTime()-i)/1e3)-a,0)}return r}alias(t,s){return t===this.get_property(Xa)?(k.critical("Attempting to create alias for existing People user - aborting."),-2):this.Tn("posthog.alias")?(w(s)&&(s=this.get_distinct_id()),t!==s?(this.In(Kt,t),this.capture("$create_alias",{alias:t,distinct_id:s})):(k.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var s=y({},this.config);if(Z(t)){var i,r,n,a,o,l,u,c,h,d,p;K(this.config,Xn(t));var f=this.hn();(i=this.persistence)==null||i.update_config(this.config,s,f),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Ci(y({},this.config,{persistence:"sessionStorage"}),f,!1);var g=this.an(this.config.debug);Re(g)&&(this.config.debug=g),Re(this.config.debug)&&(this.config.debug?(z.DEBUG=!0,V.N()&&V.q("ph_debug",!0),k.info("set_config",{config:t,oldConfig:s,newConfig:y({},this.config)})):(z.DEBUG=!1,V.N()&&V.P("ph_debug"))),(r=this.exceptionObserver)==null||r.onConfigChange(),(n=this.exceptions)==null||n.onConfigChange(),(a=this.sessionRecording)==null||a.startIfEnabledOrStop(),(o=this.tracingHeaders)==null||o.startIfEnabledOrStop(),(l=this.autocapture)==null||l.startIfEnabled(),(u=this.heatmaps)==null||u.startIfEnabled(),(c=this.exceptionObserver)==null||c.startIfEnabledOrStop(),(h=this.deadClicksAutocapture)==null||h.startIfEnabledOrStop(),(d=this.surveys)==null||d.loadIfEnabled(),this.Pn(),(p=this.externalIntegrations)==null||p.startIfEnabledOrStop()}}_overrideSDKInfo(t,s){z.LIB_NAME=t,z.LIB_VERSION=s}startSessionRecording(t){var s,i,r,n,a,o=t===!0,l={sampling:o||!(t==null||!t.sampling),linked_flag:o||!(t==null||!t.linked_flag),url_trigger:o||!(t==null||!t.url_trigger),event_trigger:o||!(t==null||!t.event_trigger)};Object.values(l).some(Boolean)&&((s=this.sessionManager)==null||s.checkAndGetSessionAndWindowId(),l.sampling&&((i=this.sessionRecording)==null||i.overrideSampling()),l.linked_flag&&((r=this.sessionRecording)==null||r.overrideLinkedFlag()),l.url_trigger&&((n=this.sessionRecording)==null||n.overrideTrigger("url")),l.event_trigger&&((a=this.sessionRecording)==null||a.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!((t=this.sessionRecording)==null||!t.started)}captureException(t,s){if(this.exceptions){var i=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(t,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(y({},r,s))}}addExceptionStep(t,s){var i;(i=this.exceptions)==null||i.addExceptionStep(t,s)}captureLog(t){var s;(s=this.logs)==null||s.captureLog(t)}get logger(){var t,s;return(t=(s=this.logs)==null?void 0:s.logger)!==null&&t!==void 0?t:ot.On}startExceptionAutocapture(t){this.set_config({capture_exceptions:t==null||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var s,i;return(s=(i=this.toolbar)==null?void 0:i.loadToolbar(t))!==null&&s!==void 0&&s}get_property(t){var s;return(s=this.persistence)==null?void 0:s.props[t]}getSessionProperty(t){var s;return(s=this.sessionPersistence)==null?void 0:s.props[t]}toString(){var t,s=(t=this.config.name)!==null&&t!==void 0?t:bt;return s!==bt&&(s=bt+"."+s),s}_isIdentified(){var t,s;return((t=this.persistence)==null?void 0:t.get_property(Me))===vt||((s=this.sessionPersistence)==null?void 0:s.get_property(Me))===vt}Cn(){var t,s;return!(this.config.person_profiles==="never"||this.config.person_profiles===Er&&!this._isIdentified()&&Je(this.getGroups())&&((t=this.persistence)==null||(t=t.props)==null||!t[Kt])&&((s=this.persistence)==null||(s=s.props)==null||!s[Ys]))}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(t){return this.config.person_profiles==="never"?(k.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.In(Ys,!0),!0)}hn(){if(this.config.cookieless_mode==="always")return!0;var t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==at)}Pn(){var t,s,i,r,n=this.hn();return((t=this.persistence)==null?void 0:t.yr)!==n&&((i=this.persistence)==null||i.set_disabled(n)),((s=this.sessionPersistence)==null?void 0:s.yr)!==n&&((r=this.sessionPersistence)==null||r.set_disabled(n)),n}opt_in_capturing(t){var s;if(this.config.cookieless_mode!==Ge){if(this.Yi()){var i,r,n,a,o;this.reset(!0),(i=this.sessionManager)==null||i.destroy(),(r=this.pageViewM
1anager)==null||r.destroy(),this.sessionManager=new Wn(this),this.pageViewManager=new Nn(this),this.persistence&&(this.sessionPropsManager=new Vn(this,this.sessionManager,this.persistence));var l,u=(n=(a=this.config.__extensionClasses)==null?void 0:a.sessionRecording)!==null&&n!==void 0?n:(o=ot.__defaultExtensionClasses)==null?void 0:o.sessionRecording;u&&(this.sessionRecording=this.Ji(this.sessionRecording,new u(this)),this.yn&&((l=this.sessionRecording)==null||l.onRemoteConfig==null||l.onRemoteConfig(this.yn)))}var c,h;this.consent.optInOut(!0),this.Pn(),this.bn(),(s=this.sessionRecording)==null||s.startIfEnabledOrStop(),this.config.cookieless_mode==at&&((c=this.surveys)==null||c.loadIfEnabled()),(w(t==null?void 0:t.captureEventName)||t!=null&&t.captureEventName)&&this.capture((h=t==null?void 0:t.captureEventName)!==null&&h!==void 0?h:"$opt_in",t==null?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._n()}else k.warn(Zn)}opt_out_capturing(){var t,s,i;this.config.cookieless_mode!==Ge?(this.config.cookieless_mode===at&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.Pn(),this.config.cookieless_mode===at&&(this.register({distinct_id:xs,$device_id:null}),(t=this.sessionRecording)==null||t.stopRecording(),this.sessionRecording=void 0,(s=this.sessionManager)==null||s.destroy(),(i=this.pageViewManager)==null||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this._n(),this.bn())):k.warn(Zn)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return t===1?"granted":t===0?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===Ge||(this.config.cookieless_mode===at?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Pn()}_is_bot(){return ue?Vo(ue,this.config.custom_blocked_useragents):void 0}_n(){x&&(x.visibilityState==="visible"?this.tn||(this.tn=!0,this.capture(yt,{title:x.title},{send_instantly:!0}),this.rn&&(x.removeEventListener(Xs,this.rn),this.rn=null)):this.rn||(this.rn=this._n.bind(this),se(x,Xs,this.rn)))}debug(t){t===!1?(v==null||v.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(v==null||v.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 t=this.ln||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(k.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(function(s,i,r,n,a){var o=i in s&&!C(s[i]),l=r in s&&!C(s[r]);return o?s[i]:!!l&&(a&&a.warn("Config field '"+r+"' is deprecated. Please use '"+i+"' instead. The old field will be removed in a future major version."),s[r])})(t,"advanced_disable_flags","advanced_disable_decide",0,k)}wt(t){var s;if(C(this.config.before_send))return t;var i=Object.keys((s=t.properties)!==null&&s!==void 0?s:{}).filter(Ql),r=R(this.config.before_send)?this.config.before_send:[this.config.before_send],n=t;for(var a of r){if(n=a(n),C(n)){var o="Event '"+t.event+"' was rejected in beforeSend function";return Xl(t.event)?k.warn(o+". This can cause unexpected behavior."):k.info(o),null}n.properties&&!Je(n.properties)||k.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}for(var l of i)if(n.properties&&C(n.properties[l]))return k.warn("Event '"+t.event+"' had its '"+l+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return n}getPageViewId(){var t;return(t=this.pageViewManager.ir)==null?void 0:t.pageViewId}captureTraceFeedback(t,s){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:s})}captureTraceMetric(t,s,i){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:s,$ai_metric_value:String(i)})}an(t){var s=Re(t)&&!t,i=V.N()&&V.A("ph_debug")==="true";return!s&&(!!i||t)}};ns.__defaultExtensionClasses={},ns.On=(()=>{var e=()=>{};return{trace:e,debug:e,info:e,warn:e,error:e,fatal:e}})(),(function(e,t){for(var s=0;t.length>s;s++)e.prototype[t[s]]=Hu(e.prototype[t[s]])})(ns,["identify"]);var Qn=class{constructor(e){this.disabled=e===!1;var t=Z(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,s){if(this.disabled)return!1;var i=this.clicks[this.clicks.length-1];if(i&&Math.abs(e-i.x)+Math.abs(t-i.y)<this.thresholdPx&&this.timeoutMs>s-i.timestamp){if(this.clicks.push({x:e,y:t,timestamp:s}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:s}];return!1}},qi="$copy_autocapture",Gi=Y("[AutoCapture]");function Bi(e,t){return t.length>e?t.slice(0,e)+"...":t}function Bc(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!Ye(t));return t}function Uc(e,t){var s,i,r=t.e,n=t.maskAllElementAttributes,a=t.maskAllText,o=t.elementAttributeIgnoreList,l=t.elementsC
1hainAsString,u=t.disableCaptureUrlHashes;if(!Ye(e))return{props:{}};for(var c=[e],h=new Set([e]),d=e;d.parentNode&&!Ee(d,"body")&&go>c.length;)if(vo(d.parentNode)){var p=d.parentNode.host;if(h.has(p))break;h.add(p),c.push(p),d=p}else{if(!Ye(d.parentNode)||h.has(d.parentNode))break;h.add(d.parentNode),c.push(d.parentNode),d=d.parentNode}var f,g,_=[],m={},P=!1,E=!1;if(B(c,(b=>{var T=Pr(b);if(Ee(b,"a")){var I=b.getAttribute("href");P=!!(T&&I&&ss(I))&&(u?Ze(I):I)}O(ei(b),"ph-no-capture")&&(E=!0),_.push((function(M,D,X,U,j){j===void 0&&(j=!1);var W=M.tagName.toLowerCase(),Q={tag_name:W};Jr.indexOf(W)>-1&&!X&&(Q.$el_text=W.toLowerCase()==="a"||W.toLowerCase()==="button"?Bi(1024,An(M)):Bi(1024,cs(M)));var we=ei(M);we.length>0&&(Q.classes=we.filter((function(ee){return ee!==""}))),B(M.attributes,(function(ee){var oe;if((!wo(M)||["name","id","class","aria-label"].indexOf(ee.name)!==-1)&&(U==null||!U.includes(ee.name))&&!D&&ss(ee.value)&&(!G(oe=ee.name)||oe.substring(0,10)!=="_ngcontent"&&oe.substring(0,7)!=="_nghost")){var le=ee.value;ee.name==="class"&&(le=Kr(le).join(" ")),Q["attr__"+ee.name]=Bi(1024,ee.name==="href"&&j?Ze(le):le)}}));for(var Se=1,me=1,xe=M;xe=Bc(xe);)Se++,xe.tagName===M.tagName&&me++;return Q.nth_child=Se,Q.nth_of_type=me,Q})(b,n,a,o,u));var A=(function(M){if(!Pr(M))return{};var D={};return B(M.attributes,(function(X){if(X.name&&X.name.indexOf("data-ph-capture-attribute")===0){var U=X.name.replace("data-ph-capture-attribute-",""),j=X.value;U&&j&&ss(j)&&(D[U]=j)}})),D})(b);K(m,A)})),E)return{props:{},explicitNoCapture:E};if(a||(_[0].$el_text=Ee(e,"a")||Ee(e,"button")?An(e):cs(e)),P){var S,F;_[0].attr__href=P;var N=(S=ti(P))==null?void 0:S.host,L=v==null||(F=v.location)==null?void 0:F.host;N&&L&&N!==L&&(f=P)}return{props:K({$event_type:r.type,$ce_version:1},l?{}:{$elements:_},{$elements_chain:(g=_,(function(b){return b.map((T=>{var I,A,M="";if(T.tag_name&&(M+=T.tag_name),T.attr_class)for(var D of(T.attr_class.sort(),T.attr_class))M+="."+D.replace(/"/g,"");var X=y({},T.text?{text:T.text}:{},{"nth-child":(I=T.nth_child)!==null&&I!==void 0?I:0,"nth-of-type":(A=T.nth_of_type)!==null&&A!==void 0?A:0},T.href?{href:T.href}:{},T.attr_id?{attr_id:T.attr_id}:{},T.attributes),U={};return Cs(X).sort(((j,W)=>j[0].localeCompare(W[0]))).forEach((j=>{var W=j[1];return U[Ln(j[0].toString())]=Ln(W.toString())})),(M+=":")+Cs(U).map((j=>j[0]+'="'+j[1]+'"')).join("")})).join(";")})((function(b){return b.map((T=>{var I,A,M={text:(I=T.$el_text)==null?void 0:I.slice(0,400),tag_name:T.tag_name,href:(A=T.attr__href)==null?void 0:A.slice(0,2048),attr_class:lc(T),attr_id:T.attr__id,nth_child:T.nth_child,nth_of_type:T.nth_of_type,attributes:{}};return Cs(T).filter((D=>D[0].indexOf("attr__")===0)).forEach((D=>M.attributes[D[0]]=D[1])),M}))})(g)))},(s=_[0])!=null&&s.$el_text?{$el_text:(i=_[0])==null?void 0:i.$el_text}:{},f&&r.type==="click"?{$external_click_url:f}:{},m)}}var Ut=Y("[ExceptionAutocapture]"),ea=()=>{},Vc=Y("[TracingHeaders]"),tt=Y("[Web Vitals]"),ta=9e5,sa="disabled",ia="lazy_loading",Vt="awaiting_config",Fs="missing_config";Y("[SessionRecording]"),Y("[SessionRecording]");var Lr="[SessionRecording]",De=Y(Lr),Wc=Y("[Heatmaps]");function Ui(e){return Z(e)&&"clientX"in e&&"clientY"in e&&he(e.clientX)&&he(e.clientY)}var Vi=Y("[Product Tours]"),Wi=e=>{var t;return!e.config.disable_product_tours&&!((t=e.persistence)==null||!t.get_property(Br))},Kc=["$set_once","$set"],Ce=Y("[SiteApps]"),ra="Error while initializing PostHog app with config id ";function _t(e,t,s){if(C(e))return!1;switch(s){case"exact":return e===t;case"contains":var i=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(i,"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch{return!1}default:return!1}}var Jc=class{constructor(e){this.Fn=new en,this.Ln=(t,s)=>this.$n(t,s)&&this.An(t,s)&&this.Nn(t,s)&&this.Dn(t,s),this.$n=(t,s)=>s==null||!s.event||(t==null?void 0:t.event)===(s==null?void 0:s.event),this._instance=e,this.qn=new Set,this.jn=new Set}init(){var e,t;w((e=this._instance)==null?void 0:e._addCaptureHook)||(t=this._instance)==null||t._addCaptureHook(((s,i)=>{this.on(s,i)}))}register(e){var t,s;if(!w((t=this._instance)==null?void 0:t._addCaptureHook)&&(e.forEach((n=>{var a,o;(a=this.jn)==null||a.add(n),(o=n.steps)==null||o.forEach((l=>{var u;(u=this.qn)==null||u.add((l==null?void 0:l.event)||"")}))})),(s=this._instance)!=null&&s.autocapture)){var i,r=new Set;e.forEach((n=>{var a;(a=n.steps)==null||a.forEach((o=>{o!=null&&o.selector&&r.add(o==null?void 0:o.selector)}))}
1)),(i=this._instance)==null||i.autocapture.setElementSelectors(r)}}on(e,t){var s;t!=null&&e.length!=0&&(this.qn.has(e)||this.qn.has(t.event))&&this.jn&&((s=this.jn)==null?void 0:s.size)>0&&this.jn.forEach((i=>{this.Hn(t,i)&&this.Fn.emit("actionCaptured",i.name)}))}Bn(e){this.onAction("actionCaptured",(t=>e(t)))}Hn(e,t){if((t==null?void 0:t.steps)==null)return!1;for(var s of t.steps)if(this.Ln(e,s))return!0;return!1}onAction(e,t){return this.Fn.on(e,t)}An(e,t){if(t!=null&&t.url){var s,i=e==null||(s=e.properties)==null?void 0:s.$current_url;if(!i||typeof i!="string"||!_t(i,t.url,t.url_matching||"contains"))return!1}return!0}Nn(e,t){return!!this.Un(e,t)&&!!this.zn(e,t)&&!!this.Vn(e,t)}Un(e,t){var s;if(t==null||!t.href)return!0;var i=this.Wn(e);if(i.length>0)return i.some((a=>_t(a.href,t.href,t.href_matching||"exact")));var r,n=(e==null||(s=e.properties)==null?void 0:s.$elements_chain)||"";return!!n&&_t((r=n.match(/(?::|")href="(.*?)"/))?r[1]:"",t.href,t.href_matching||"exact")}zn(e,t){var s;if(t==null||!t.text)return!0;var i=this.Wn(e);if(i.length>0)return i.some((l=>_t(l.text,t.text,t.text_matching||"exact")||_t(l.$el_text,t.text,t.text_matching||"exact")));var r,n,a,o=(e==null||(s=e.properties)==null?void 0:s.$elements_chain)||"";return!!o&&(r=(function(l){for(var u,c=[],h=/(?::|")text="(.*?)"/g;!C(u=h.exec(l));)c.includes(u[1])||c.push(u[1]);return c})(o),n=t.text,a=t.text_matching||"exact",r.some((l=>_t(l,n,a))))}Vn(e,t){var s,i;if(t==null||!t.selector)return!0;var r=e==null||(s=e.properties)==null?void 0:s.$element_selectors;if(r!=null&&r.includes(t.selector))return!0;var n=(e==null||(i=e.properties)==null?void 0:i.$elements_chain)||"";if(t.selector_regex&&n)try{return new RegExp(t.selector_regex).test(n)}catch{return!1}return!1}Wn(e){var t;return(e==null||(t=e.properties)==null?void 0:t.$elements)==null?[]:e==null?void 0:e.properties.$elements}Dn(e,t){return t==null||!t.properties||t.properties.length===0||Jo(t.properties.reduce(((s,i)=>{var r=R(i.value)?i.value.map(String):i.value!=null?[String(i.value)]:[];return s[i.key]={values:r,operator:i.operator||"exact"},s}),{}),e==null?void 0:e.properties)}},Zc=class{constructor(e){var t;this.Zn=[],this._instance=e,this.Gn=new Map,this.Qn=new Map,this.Jn=new Map,(t=this._instance)==null||t.onSessionId==null||t.onSessionId((s=>this.Kn(s)))}Yn(e,t){return!!e&&Jo(e.propertyFilters,t==null?void 0:t.properties)}Xn(e,t){var s=new Map;return e.forEach((i=>{var r;(r=i.conditions)==null||(r=r[t])==null||(r=r.values)==null||r.forEach((n=>{if(n!=null&&n.name){var a=s.get(n.name)||[];a.push(i.id),s.set(n.name,a)}}))})),s}es(e,t,s){var i=(s===jt.Activation?this.Gn:this.Qn).get(e),r=[];return this.ts((n=>{r=n.filter((a=>i==null?void 0:i.includes(a.id)))})),r.filter((n=>{var a,o=(a=n.conditions)==null||(a=a[s])==null||(a=a.values)==null?void 0:a.find((l=>l.name===e));return this.Yn(o,t)}))}register(e){var t;w((t=this._instance)==null?void 0:t._addCaptureHook)||(this.rs(e),this.ns(e))}ns(e){var t=e.filter((s=>{var i,r;return((i=s.conditions)==null?void 0:i.actions)&&((r=s.conditions)==null||(r=r.actions)==null||(r=r.values)==null?void 0:r.length)>0}));t.length!==0&&(this.ss==null&&(this.ss=new Jc(this._instance),this.ss.init(),this.ss.Bn((s=>{this.onAction(s)}))),t.forEach((s=>{var i,r,n,a,o;s.conditions&&(i=s.conditions)!=null&&i.actions&&(r=s.conditions)!=null&&(r=r.actions)!=null&&r.values&&((n=s.conditions)==null||(n=n.actions)==null||(n=n.values)==null?void 0:n.length)>0&&((a=this.ss)==null||a.register(s.conditions.actions.values),(o=s.conditions)==null||(o=o.actions)==null||(o=o.values)==null||o.forEach((l=>{if(l&&l.name){var u=this.Jn.get(l.name);u&&u.push(s.id),this.Jn.set(l.name,u||[s.id])}})))})))}rs(e){var t,s=e.filter((r=>{var n,a;return((n=r.conditions)==null?void 0:n.events)&&((a=r.conditions)==null||(a=a.events)==null||(a=a.values)==null?void 0:a.length)>0})),i=e.filter((r=>{var n,a;return((n=r.conditions)==null?void 0:n.cancelEvents)&&((a=r.conditions)==null||(a=a.cancelEvents)==null||(a=a.values)==null?void 0:a.length)>0}));s.length===0&&i.length===0||((t=this._instance)==null||t._addCaptureHook(((r,n)=>{this.onEvent(r,n)})),this.Gn=this.Xn(e,jt.Activation),this.Qn=this.Xn(e,jt.Cancellation))}onEvent(e,t){var s,i,r=this.os(),n=(t==null||(s=t.properties)==null?void 0:s.$survey_id)||(t==null||(i=t.properties)==null?void 0:i.$product_tour_id);
1if(n&&this.getActivatedIds().includes(n)){var a=this.ls(e,n);if(a==="consume")return r.info("event consumed activated item, removing it",{event:e,itemId:n}),void this.us([n]);if(a==="persist")return r.info("shown item promoted to persisted activation",{event:e,itemId:n}),void this.hs(n)}if(this.Qn.has(e)){var o=this.es(e,t,jt.Cancellation);o.length>0&&(r.info("cancel event matched, cancelling items",{event:e,itemsToCancel:o.map((u=>u.id))}),this.us(o.map((u=>u.id))),o.forEach((u=>this.ds(u.id))))}if(this.Gn.has(e)){r.info("event name matched",{event:e,eventPayload:t,items:this.Gn.get(e)});var l=this.es(e,t,jt.Activation);this.cs(l.map((u=>u.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((s=>s!==e));var t=this.vs();t.includes(e)||(this.fs([...t,e]),this.ps())}us(e){var t=new Set(e);this.Zn=this.Zn.filter((r=>!t.has(r)));var s=this.gs(),i=s.filter((r=>!t.has(r)));i.length!==s.length&&(this.fs(i),i.length===0&&this.ys())}gs(){var e,t=this.bs();return((e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[t])||[]}vs(){var e,t,s=this.gs();if(s.length===0)return[];var i=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[this._s()],r=(t=this._instance)==null||t.get_session_id==null?void 0:t.get_session_id();return r&&i===r?s:[]}ps(){var e,t=(e=this._instance)==null||e.get_session_id==null?void 0:e.get_session_id();t&&this.ws(t)}ys(){this.xs()}Kn(e){var t,s=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[this._s()];s&&s!==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}},Yc=class extends Zc{constructor(e){super(e)}bs(){return gr}_s(){return Rs}Cs(){return Ue.SHOWN}ts(e){var t;(t=this._instance)==null||t.getSurveys(e)}ds(e){var t;(t=this._instance)==null||t.cancelPendingSurvey(e)}os(){return H}fs(e){var t;(t=this._instance)==null||(t=t.persistence)==null||t.register({[gr]:e})}ws(e){var t;(t=this._instance)==null||(t=t.persistence)==null||t.register({[Rs]:e})}xs(){var e;(e=this._instance)==null||(e=e.persistence)==null||e.unregister(Rs)}ks(){return!1}ls(e,t){var s;this.ts((r=>{s=r.find((n=>n.id===t))}));var i=!s||(function(r){var n;return Zo(r)&&!((n=r.conditions)==null||(n=n.events)==null||!n.repeatedActivation)||r.schedule==="always"})(s);return i?e===Ue.SHOWN?"consume":"ignore":e===Ue.SHOWN?"persist":e===Ue.DISMISSED||e===Ue.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},$s="SDK is not enabled or survey functionality is not yet loaded",na="Disabled. Not loading surveys.",Xc=v!=null&&v.location?si(v.location.hash,"__posthog")||si(location.hash,"state"):null,aa="_postHogToolbarParams",oa=Y("[Toolbar]"),ae=Y("[FeatureFlags]"),st=Y("[FeatureFlags]",{debugEnabled:!0}),Ki=`" failed. Feature flags didn't load in time.`,la=e=>{for(var t={},s=0;e.length>s;s++)t[e[s]]=!0;return t},ua=e=>{var t={};for(var s of Cs(e||{})){var i=s[1];i&&(t[s[0]]=i)}return t},Ne=Y("[Error tracking]"),ca="Refusing to render web experiment since the viewer is a likely bot",Qc={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>ni(t,e),not_regex:(e,t)=>!ni(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e},eh=class fe{get Te(){return this._instance.config}constructor(t){var s=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(i){i===void 0&&(i=!1),s.getWebExperiments((r=>{fe.Ts("retrieved web experiments from the server"),s.Is=new Map,r.forEach((n=>{if(n.feature_flag_key){var a;s.Is&&(fe.Ts("setting flag key ",n.feature_flag_key," to web experiment ",n),(a=s.Is)==null||a.set(n.feature_flag_key,n));var o=s._instance.getFeatureFlag(n.feature_flag_key);G(o)&&n.variants[o]&&s.Ms(n.name,o,n.variants[o].transforms)}else if(n.variants)for(var l in n.variants){var u=n.variants[l];fe.Es(u,s._instance)&&s.Ms(n.name,l,u.transforms)}}))}),i)},this._instance=t,this._instance.onFeatureFlags((i=>{this.onFeatureFlags(i)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())fe.Ts(ca);else if(!this.Te.disable_web_experiments){if(C(this.Is))return this.Is=new Map,this.loadIfEnabled(),void this.previewWebExperiment();fe.Ts("applying feature flags",t),t.forEach((s=>{var i;if(this.Is&&(i=this.Is)!=null&&i.has(s)){var r,n=this._instance.getFeatureFlag(s),a=(r=this.Is)==null?void 0:r.get(s);n&&a!=null&&a.variants[n]&&this.Ms(a.name,n,a.variants[n].transforms)}}))}}previewWebExperiment(){var t=fe.getWindowLocation();if(t!=null&&t.search){var s=Ft(t==null?void 0:t.search,"__experiment_id"),i=Ft(t==null?void 0:t.search,"__experiment_variant");s&&i&&(fe.Ts("previewing web experiments "+s+" && "+i),this.getWebExperiments((r=>{this.Rs(parseInt(s),i,r)}),!1,!0))}}loadIfEnabled(){this.Te.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,s,i){if(this.Te.disable_web_experiments&&!i)return t([]);var r=this._instance.get_property("$web_experiments");if(r&&!s)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Te.token),method:"GET",timestampMode:"query",callback:n=>t(n.statusCode===200&&n.json&&n.json.experiments||[])})}Rs(t,s,i){var r=i.filter((n=>n.id===t));r&&r.length>0&&(fe.Ts("Previewing web experiment ["+r[0].name+"] with variant ["+s+"]"),this.Ms(r[0].name,s,r[0].variants[s].transforms))}static Es(t,s){return!C(t.conditions)&&fe.Ps(t,s)&&fe.Os(t)}static Ps(t,s){var i;if(C(t.conditions)||C((i=t.conditions)==null?void 0:i.url))return!0;var r=fe.getWindowLocation();if(r){var n,a,o,l=ho(s,r.href);return(n=t.conditions)==null||!n.url||Qc[(a=(o=t.conditions)==null?void 0:o.urlMatchType)!==null&&a!==void 0?a:"icontains"](t.conditions.url,l)}return!1}
1static getWindowLocation(){return v==null?void 0:v.location}static Os(t){var s;if(C(t.conditions)||C((s=t.conditions)==null?void 0:s.utm))return!0;var i=$o();if(i.utm_source){var r,n,a,o,l,u,c,h,d=(r=t.conditions)==null||(r=r.utm)==null||!r.utm_campaign||((n=t.conditions)==null||(n=n.utm)==null?void 0:n.utm_campaign)==i.utm_campaign,p=(a=t.conditions)==null||(a=a.utm)==null||!a.utm_source||((o=t.conditions)==null||(o=o.utm)==null?void 0:o.utm_source)==i.utm_source,f=(l=t.conditions)==null||(l=l.utm)==null||!l.utm_medium||((u=t.conditions)==null||(u=u.utm)==null?void 0:u.utm_medium)==i.utm_medium,g=(c=t.conditions)==null||(c=c.utm)==null||!c.utm_term||((h=t.conditions)==null||(h=h.utm)==null?void 0:h.utm_term)==i.utm_term;return d&&f&&g&&p}return!1}static Ts(t){for(var s=arguments.length,i=new Array(s>1?s-1:0),r=1;s>r;r++)i[r-1]=arguments[r];k.info("[WebExperiments] "+t,i)}Ms(t,s,i){this._is_bot()?fe.Ts(ca):s!=="control"?i.forEach((r=>{if(r.selector){var n;fe.Ts("applying transform of variant "+s+" for experiment "+t+" ",r);var a=(n=document)==null?void 0:n.querySelectorAll(r.selector);a==null||a.forEach((o=>{var l=o;r.html&&(l.innerHTML=r.html),r.css&&l.setAttribute("style",r.css)}))}})):fe.Ts("Control variants leave the page unmodified.")}_is_bot(){return ue&&this._instance?Vo(ue,this.Te.custom_blocked_useragents):void 0}},Te=Y("[Conversations]"),it="Conversations not available yet.",ha="console",vi={featureFlags:class{constructor(e){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 t=this.Us();this.Hs=0,t&&this.reloadFeatureFlags()},this._instance=e,this.featureFlagEventHandlers=[],v&&se(v,"online",this.Bs)}destroy(){v==null||v.removeEventListener("online",this.Bs)}get Te(){return this._instance.config}get mi(){return this._instance.persistence}zs(e){return this._instance.get_property(e)}Vs(){var e,t;return(e=(t=this.mi)==null?void 0:t._r(this.Te.feature_flag_cache_ttl_ms))!==null&&e!==void 0&&e}Ws(){return!!this.Vs()&&(this.js||this.$s||(this.js=!0,ae.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Zs(){var e,t=(e=this.Te.evaluation_contexts)!==null&&e!==void 0?e:this.Te.evaluation_environments;return!this.Te.evaluation_environments||this.Te.evaluation_contexts||this.qs||(ae.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.qs=!0),t!=null&&t.length?t.filter((s=>{var i=s&&typeof s=="string"&&s.trim().length>0;return i||ae.error("Invalid evaluation context found:",s,"Expected non-empty string"),i})):[]}Gs(){return this.Zs().length>0}Qs(){var e=this.Te.flag_keys;if(!w(e)){if(R(e))return e.filter((t=>{var s=t&&typeof t=="string"&&t.trim().length>0;return s||ae.error("Invalid flag key found:",t,"Expected non-empty string"),s}));ae.error("Invalid flag_keys found:",e,"Expected array of non-empty strings")}}initialize(){var e,t,s=this._instance.config,i=(e=(t=s.bootstrap)==null?void 0:t.featureFlags)!==null&&e!==void 0?e:{};if(Object.keys(i).length){var r,n,a=(r=(n=s.bootstrap)==null?void 0:n.featureFlagPayloads)!==null&&r!==void 0?r:{},o=Object.keys(i).filter((u=>!!i[u])).reduce(((u,c)=>(u[c]=i[c]||!1,u)),{}),l=Object.keys(a).filter((u=>o[u])).reduce(((u,c)=>(a[c]&&(u[c]=a[c]),u)),{});this.receivedFeatureFlags({featureFlags:o,featureFlagPayloads:l})}}updateFlags(e,t,s){var i,r,n=s!=null&&s.merge&&(i=this.zs(lt))!==null&&i!==void 0?i:{},a=s!=null&&s.merge&&(r=this.zs(Os))!==null&&r!==void 0?r:{},o=y({},n,e),l=y({},a,t),u={};for(var c of Object.entries(o)){var h=c[0],d=c[1];u[h]={key:h,enabled:pn(d),variant:fn(d),reason:void 0,metadata:w(l==null?void 0:l[h])?void 0:{id:0,version:void 0,description:void 0,payload:l[h]}}}this.receivedFeatureFlags({flags:u})}get hasLoadedFlags(){return this.Ls}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this.zs(pr),t=this.zs(ze),s=this.zs(mt);if(!s&&!t)return e||{};var i=K({},e||{}),r=[...new Set([...Object.keys(s||{}),...Object.keys(t||{})])];for(var n of r){var a,o,l=i[n],u=t==null?void 0:t[n],c=w(u)?(a=l==null?void 0:l.enabled)!==null&&a!==void 0&&a:!!u,h=w(u)?l.variant:typeof u=="string"?u:void 0,d=s==null?void 0:s[n],p=y({},l,{enabled:c,variant:c?h??(l==null?void 0:l.variant):void 0});c!==(l==null?void 0:l.enabled)&&(p.original_enabled=l==null?void 0:l.enabled),h!==(l==null?void 0:l.variant)&&(p.original_variant=l==null?void 0:l.variant),d&&(p.metadata=y({},l==null?void 0:l.metadata,{payload:d,original_payload:l==null||(o=l.metadata)==null?void 0:o.payload})),i[n]=p}return this.Fs||(ae.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:s,finalDetails:i}
1),this.Fs=!0),i}getAllFeatureFlags(){var e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map((s=>{var i=e[s];return{key:s,enabled:pn(i),variant:fn(i),payload:dn(t[s])}}))}getFlagVariants(){var e=this.zs(lt),t=this.zs(ze);if(!t)return e||{};for(var s=K({},e),i=Object.keys(t),r=0;i.length>r;r++)s[i[r]]=t[i[r]];return this.Fs||(ae.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:s}),this.Fs=!0),s}getFlagPayloads(){var e=this.zs(Os),t=this.zs(mt);if(!t)return e||{};for(var s=K({},e||{}),i=Object.keys(t),r=0;i.length>r;r++)s[i[r]]=t[i[r]];return this.Fs||(ae.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:s}),this.Fs=!0),s}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(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.As=e}Ks(e){var t;if(this.Ys(),!this._instance.Ur()&&!this.Us())if(this.$s)this.Ns=!0;else{var s=this.Te.token,i=this.zs(Ws),r={token:s,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:y({},((t=this.mi)==null?void 0:t.get_initial_props())||{},this.zs(rt)||{},{$lib:z.LIB_NAME,$lib_version:z.LIB_VERSION}),group_properties:this.zs(nt),timezone:Ao()};ge(i)||w(i)||(r.$device_id=i),(e!=null&&e.disableFlags||this.Te.advanced_disable_feature_flags)&&(r.disable_flags=!0),this.Gs()&&(r.evaluation_contexts=this.Zs());var n=this.Qs();w(n)||(r.flag_keys=n);var a=!!this.Te.advanced_only_evaluate_survey_feature_flags,o=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:o,data:r,compression:this.Te.disable_compression?void 0:ve.Base64,timestampMode:"body",timeout:this.Te.feature_flag_request_timeout_ms,callback:l=>{var u,c,h,d=!0;if(this.Xs(l.statusCode),l.statusCode===200&&(this.Ns||(this.$anon_distinct_id=void 0),d=!1),this.$s=!1,!r.disable_flags||this.Ns){this.Ds=!d;var p=[];l.error?l.error instanceof Error?p.push(l.error.name==="AbortError"?"timeout":"connection_error"):p.push("unknown_error"):l.statusCode!==200&&p.push("api_error_"+l.statusCode),(u=l.json)!=null&&u.errorsWhileComputingFlags&&p.push("errors_while_computing_flags");var f,g=!((c=l.json)==null||(c=c.quotaLimited)==null||!c.includes("feature_flags"));g&&p.push("quota_limited"),(h=this.mi)==null||h.register({[mr]:p}),g?ae.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."):(r.disable_flags||this.receivedFeatureFlags((f=l.json)!==null&&f!==void 0?f:{},d,{partialResponse:a}),this.Ns&&(this.Ns=!1,this.Ks()))}}})}}Us(){return To(this.Hs,3)}Xs(e){this.Hs=Fo(e,this.Hs,3,(()=>ae.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes.")))}getFeatureFlag(e,t){var s;if(t===void 0&&(t={}),!t.fresh||this.Ds)if(this.Ls||this.getFlags()&&this.getFlags().length>0){if(!this.Ws()){var i=this.getFeatureFlagResult(e,t);return(s=i==null?void 0:i.variant)!==null&&s!==void 0?s:i==null?void 0:i.enabled}}else ae.warn('getFeatureFlag for key "'+e+Ki)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return t==null?void 0:t.payload}getFeatureFlagResult(e,t){if(t===void 0&&(t={}),!t.fresh||this.Ds)if(this.Ls||this.getFlags()&&this.getFlags().length>0){if(!this.Ws()){var s=this.getFlagVariants(),i=e in s,r=s[e],n=this.getFlagPayloads()[e],a=String(r),o=this.zs(fr)||void 0,l=this.zs(us)||void 0,u=this.zs(ts)||{};if(this.Te.advanced_feature_flags_dedup_per_session){var c,h=this._instance.get_session_id(),d=this.zs(_r);h&&h!==d&&(u={},(c=this.mi)==null||c.register({[ts]:u,[_r]:h}))}if((t.send_event||!("send_event"in t))&&(!(e in u)||!u[e].includes(a))){var p,f,g,_,m,P,E,S,F,N,L;R(u[e])?u[e].push(a):u[e]=[a],(p=this.mi)==null||p.register({[ts]:u});var b=this.getFeatureFlagDetails(e),T=[...(f=this.zs(mr))!==null&&f!==void 0?f:[]];w(r)&&T.push("flag_missing");var I={$feature_flag:e,$feature_flag_response:r,$feature_flag_payload:n||null,$feature_flag_request_id:o,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:((g=this.Te.bootstrap)==null||(g=g.featureFlags)==null?void 0:g[e])||null,$feature_flag_bootstrapped_payload:((_=this.Te.bootstrap)==null||(_=_.featureFlagPayloads)==null?void 0:_[e])||null,$used_bootstrap_value:!this.Ds};w(b==null||(m=b.metadata)==null?void 0:m.has_experiment)||(I.$feature_flag_has_experiment=b.metadata.has_experiment),w(b==null||(P=b.metadata)==null?void 0:P.version)||(I.$feature_flag_version=b.metadata.version);var A,M=(E=b==null||(S=b.reason)==null?void 0:S.description)!==null&&E!==void 0?E:b==null||(F=b.reason)==null?void 0:F.code;M&&(I.$feature_flag_reason=M),b!=null&&(N=b.metadata)!=null&&N.id&&(I.$feature_flag_id=b.metadata.id),w(b==null?void 0:b.original_variant)&&w(b==null?void 0:b.original_enabled)||(I.$feature_flag_original_response=w(b.original_variant)?b.original_enabled:b.original_variant),b!=null&&(L=b.metadata)!=null&&L.original_payload&&(I.$feature_flag_original_payload=b==null||(A=b.metadata)==null?void 0:A.original_payload),T.length&&(I.$feature_flag_error=T.join(",")),this._instance.capture("$feature_flag_called",I)}if(i)return{key:e,enabled:!!r,variant:typeof r=="string"?r:void 0,payload:dn(n)}}}
1else ae.warn('getFeatureFlagResult for key "'+e+Ki)}getRemoteConfigPayload(e,t){var s=this.Te.token,i={distinct_id:this._instance.get_distinct_id(),token:s,person_properties:{$lib:z.LIB_NAME,$lib_version:z.LIB_VERSION}};this.Gs()&&(i.evaluation_contexts=this.Zs());var r=this.Qs();w(r)||(i.flag_keys=r),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:i,compression:this.Te.disable_compression?void 0:ve.Base64,timestampMode:"body",timeout:this.Te.feature_flag_request_timeout_ms,callback(n){var a,o=(a=n.json)==null?void 0:a.featureFlagPayloads;t((o==null?void 0:o[e])||void 0)}})}isFeatureEnabled(e,t){if(t===void 0&&(t={}),t.fresh&&!this.Ds)return t.defaultValue;if(!(this.Ls||this.getFlags()&&this.getFlags().length>0))return ae.warn('isFeatureEnabled for key "'+e+Ki),t.defaultValue;var s=this.getFeatureFlag(e,t);return w(s)?t.defaultValue:!!s}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t,s){if(this.mi){this.Ls=!0;var i=this.getFlagVariants(),r=this.getFlagPayloads(),n=this.getFlagsWithDetails();(function(a,o,l,u,c,h){l===void 0&&(l={}),u===void 0&&(u={}),c===void 0&&(c={});var d=(b=>{var T=b.flags;return T?(b.featureFlags=Object.fromEntries(Object.keys(T).map((I=>{var A;return[I,(A=T[I].variant)!==null&&A!==void 0?A:T[I].enabled]}))),b.featureFlagPayloads=Object.fromEntries(Object.keys(T).filter((I=>T[I].enabled)).filter((I=>{var A;return(A=T[I].metadata)==null?void 0:A.payload})).map((I=>{var A;return[I,(A=T[I].metadata)==null?void 0:A.payload]})))):b.featureFlags&&ae.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),b})(a),p=d.flags,f=d.featureFlags,g=d.featureFlagPayloads;if(f){var _=a.requestId,m=a.evaluatedAt;if(R(f)){ae.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var P={};if(f)for(var E=0;f.length>E;E++)P[f[E]]=!0;o&&o.register({[Ms]:f,[lt]:P,[Ks]:!1})}else{var S=f,F=g,N=p;if(h!=null&&h.partialResponse)S=y({},l,S),F=y({},u,F),N=y({},c,N);else if(a.errorsWhileComputingFlags)if(p){var L=new Set(Object.keys(p).filter((b=>{var T;return!((T=p[b])!=null&&T.failed)})));S=y({},l,Object.fromEntries(Object.entries(S).filter((b=>L.has(b[0]))))),F=y({},u,Object.fromEntries(Object.entries(F||{}).filter((b=>L.has(b[0]))))),N=y({},c,Object.fromEntries(Object.entries(N||{}).filter((b=>L.has(b[0])))))}else S=y({},l,S),F=y({},u,F),N=y({},c,N);o&&o.register(y({[Ms]:Object.keys(ua(S)),[lt]:S||{},[Os]:F||{},[pr]:N||{},[Ks]:a.minimalFlagCalledEvents===!0},_?{[fr]:_}:{},m?{[us]:m}:{}))}}})(e,this.mi,i,r,n,s),t||(this.js=!1),this.eo(t)}}override(e,t){t===void 0&&(t=!1),ae.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this.mi)return ae.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this.mi.unregister(ze),this.mi.unregister(mt),this.eo(),st.info("All overrides cleared");if(R(e)){var t=la(e);return this.mi.register({[ze]:t}),this.eo(),st.info("Flag overrides set",{flags:e})}if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var s,i=e;if(this.Fs=!!((s=i.suppressWarning)!==null&&s!==void 0&&s),"flags"in i){if(i.flags===!1)this.mi.unregister(ze),st.info("Flag overrides cleared");else if(i.flags){if(R(i.flags)){var r=la(i.flags);this.mi.register({[ze]:r})}else this.mi.register({[ze]:i.flags});st.info("Flag overrides set",{flags:i.flags})}}return"payloads"in i&&(i.payloads===!1?(this.mi.unregister(mt),st.info("Payload overrides cleared")):i.payloads&&(this.mi.register({[mt]:i.payloads}),st.info("Payload overrides set",{payloads:i.payloads}))),void this.eo()}if(e&&typeof e=="object")return this.mi.register({[ze]:e}),this.eo(),st.info("Flag overrides set",{flags:e});ae.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.Ls){var t=this.ro(),s=t.flags,i=t.flagVariants;try{e(s,i)}catch(r){ae.error("Error while running feature flags callback",r)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,s){var i,r=(this.zs(Zt)||[]).find((l=>l.flagKey===e)),n={["$feature_enrollment/"+e]:t},a={$feature_flag:e,$feature_enrollment:t,$set:n};r&&(a.$early_access_feature_name=r.name),s&&(a.$feature_enrollment_stage=s),this._instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(n,!1);var o=y({},this.getFlagVariants(),{[e]:t});(i=this.mi)==null||i.register({[Ms]:Object.keys(ua(o)),[lt]:o}),this.eo()}getEarlyAccessFeatures(e,t,s){t===void 0&&(t=!1);var i=this.zs(Zt),r=s?"&"+s.map((n=>"stage="+n)).join("&"):"";if(i&&!t)return e(i);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Te.token+r),method:"GET",timestampMode:"query",callback:n=>{var a,o;if(n.json){var l=n.json.earlyAccessFeatures;return(a=this.mi)==null||a.unregister(Zt),(o=this.mi)==null||o.register({[Zt]:l}),e(l)}}})}ro(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((s=>t[s])),flagVariants:Object.keys(t).filter((s=>t[s])).reduce(((s,i)=>(s[i]=t[i],s)),{})}}eo(e){var t=this.ro(),s=t.flags,i=t.flagVariants;
1this.featureFlagEventHandlers.forEach((r=>{try{r(s,i,{errorsLoading:e})}catch(n){ae.error("Error while running feature flags callback",n)}}))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var s=this.zs(rt)||{},i=(e==null?void 0:e.$set)||(e!=null&&e.$set_once?{}:e),r=e==null?void 0:e.$set_once,n={};if(r)for(var a in r)({}).hasOwnProperty.call(r,a)&&(a in s||(n[a]=r[a]));this._instance.register({[rt]:y({},s,n,i)}),t&&this._instance.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var s=y({},this.zs(rt)||{});e.forEach((i=>{delete s[i]})),this._instance.register({[rt]:s}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(e){e===void 0&&(e=!0),this._instance.unregister(rt),e&&this._instance.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var s=this.zs(nt)||{};Object.keys(s).length!==0&&Object.keys(s).forEach((i=>{s[i]=y({},s[i],e[i]),delete e[i]})),this._instance.register({[nt]:y({},s,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.zs(nt)||{};this._instance.register({[nt]:y({},t,{[e]:{}})})}else this._instance.unregister(nt)}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}}},th={sessionRecording:class{get Te(){return this._instance.config}get mi(){return this._instance.persistence}get started(){var e;return!((e=this.io)==null||!e.isStarted)}get status(){var e,t;return this.no===Vt||this.no===Fs?this.no:(e=(t=this.io)==null?void 0:t.status)!==null&&e!==void 0?e:this.no}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.no=sa,this.so=void 0,this._instance=e,!this._instance.sessionManager)throw De.error("started without valid sessionManager"),new Error(Lr+" started without valid sessionManager. This is a bug.");if(this.Te.cookieless_mode===Ge)throw new Error(Lr+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get oo(){var e,t=!((e=this._instance.get_property(ut))==null||!e.enabled),s=!this.Te.disable_session_recording,i=this.Te.disable_session_recording||this._instance.consent.isOptedOut();return v&&t&&s&&!i}startIfEnabledOrStop(e){var t;if(!this.oo||(t=this.io)==null||!t.isStarted){var s=!w(Object.assign)&&!w(Array.from);this.oo&&s?(this.ao(e),De.info("starting")):(this.no=sa,this.stopRecording())}}ao(e){var t,s,i;this.oo&&(this.no!==Vt&&this.no!==Fs&&(this.no=ia),$!=null&&(t=$.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(s=$.__PosthogExtensions__)!=null&&s.initSessionRecording?this.lo(e):(i=$.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,this.uo,(r=>{if(r)return De.error("could not load recorder",r);this.lo(e)})))}stopRecording(){var e,t;(e=this.so)==null||e.call(this),this.so=void 0,(t=this.io)==null||t.stop()}ho(){var e,t;(e=this.so)==null||e.call(this),this.so=void 0,(t=this.io)==null||t.discard()}do(){var e,t;(e=this.mi)==null||e.unregister(Ur),(t=this.mi)==null||t.unregister(Qa)}co(e,t){if(C(e))return null;var s,i=he(e)?e:parseFloat(e);return typeof(s=i)!="number"||!Number.isFinite(s)||0>s||s>1?(De.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):i}vo(e){if(this.mi){var t,s,i=this.mi,r=()=>{var n,a=e.sessionRecording===!1?void 0:e.sessionRecording,o=this.co((n=this.Te.session_recording)==null?void 0:n.sampleRate,"session_recording.sampleRate"),l=this.co(a==null?void 0:a.sampleRate,"remote config sampleRate"),u=o??l;C(u)&&this.do();var c=a==null?void 0:a.minimumDurationMilliseconds;i.register({[ut]:y({cache_timestamp:Date.now(),enabled:!!a},a,{networkPayloadCapture:y({capturePerformance:e.capturePerformance},a==null?void 0:a.networkPayloadCapture),canvasRecording:{enabled:a==null?void 0:a.recordCanvas,fps:a==null?void 0:a.canvasFps,quality:a==null?void 0:a.canvasQuality},sampleRate:u,minimumDurationMilliseconds:w(c)?null:c,endpoint:a==null?void 0:a.endpoint,triggerMatchType:a==null?void 0:a.triggerMatchType,masking:a==null?void 0:a.masking,urlTriggers:a==null?void 0:a.urlTriggers,version:a==null?void 0:a.version,triggerGroups:a==null?void 0:a.triggerGroups})})};r(),(t=this.so)==null||t.call(this),this.so=(s=this._instance.sessionManager)==null?void 0:s.onSessionId(r)}}onRemoteConfig(e){var t=e.ok?e.config:void 0;return t&&"sessionRecording"in t?t.sessionRecording===!1?(this.vo(t),void this.ho()):(this.vo(t),void this.startIfEnabledOrStop()):(this.no===Vt&&(this.no=Fs,De.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t){var s;
1t===void 0&&(t="log"),(s=this.io)!=null&&s.log?this.io.log(e,t):De.warn("log called before recorder was ready")}get uo(){var e,t,s=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(ut);return(s==null||(t=s.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}fo(){var e,t,s=this._instance.get_property(ut);if(!s)return!1;try{t=typeof s=="object"?s:JSON.parse(s)}catch(r){return De.warn("persisted remote config for session recording is invalid and will be ignored",r),!1}var i=(e=t.cache_timestamp)!==null&&e!==void 0?e:Date.now();return 36e5>=Date.now()-i}lo(e){var t,s;if((t=$.__PosthogExtensions__)==null||!t.initSessionRecording)return De.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[oo]:!0});if(this.io||(this.io=(s=$.__PosthogExtensions__)==null?void 0:s.initSessionRecording(this._instance),this.io._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.fo())return this.no===Fs||this.no===Vt?void 0:(this.no=Vt,De.info("persisted remote config is stale, requesting fresh config before starting"),void new Lo(this._instance).load());this.no=ia,this.io.start(e)}onRRwebEmit(e){var t;(t=this.io)==null||t.onRRwebEmit==null||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.io||(t=this.mi)==null||t.register({[to]:!0}),(e=this.io)==null||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.io||(t=this.mi)==null||t.register({[eo]:!0}),(e=this.io)==null||e.overrideSampling()}overrideTrigger(e){var t,s;this.io||(s=this.mi)==null||s.register({[e==="url"?so:io]:!0}),(t=this.io)==null||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.io)==null?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var s;return!((s=this.io)==null||!s.tryAddCustomEvent(e,t))}}},sh={autocapture:class{constructor(e){this.po=!1,this.mo=null,this.yo=!1,this.bo=!1,this.instance=e,this.rageclicks=new Qn(e.config.rageclick),this._o=null}initialize(){this.startIfEnabled()}get Te(){var e,t,s=Z(this.instance.config.autocapture)?this.instance.config.autocapture:{};return s.url_allowlist=(e=s.url_allowlist)==null?void 0:e.map((i=>new RegExp(i))),s.url_ignorelist=(t=s.url_ignorelist)==null?void 0:t.map((i=>new RegExp(i))),s}wo(){if(this.isBrowserSupported()){if(v&&x){var e=s=>{s=s||(v==null?void 0:v.event);try{this.xo(s)}catch(i){Gi.error("Failed to capture event",i)}};if(se(x,"submit",e,{capture:!0}),se(x,"change",e,{capture:!0}),se(x,"click",e,{capture:!0}),this.Te.capture_copied_text){var t=s=>{s=s||(v==null?void 0:v.event);try{this.xo(s,qi)}catch(i){Gi.error("Failed to capture copy/cut event",i)}};se(x,"copy",t,{capture:!0}),se(x,"cut",t,{capture:!0})}}}else Gi.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.po&&(this.wo(),this.po=!0)}onRemoteConfig(e){if(this.yo=!0,e.ok){var t=e.config;t.elementsChainAsString&&(this.bo=t.elementsChainAsString);var s=t.autocapture_opt_out;Re(s)&&(this.instance.persistence&&this.instance.persistence.register({[ar]:s}),this.mo=s),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(e){this._o=e}getElementSelectors(e){var t,s=[];return(t=this._o)==null||t.forEach((i=>{var r=x==null?void 0:x.querySelectorAll(i);r==null||r.forEach((n=>{e===n&&s.push(i)}))})),s}get isEnabled(){var e,t,s=(e=this.instance.persistence)==null?void 0:e.props[ar],i=this.mo,r=this.instance.Ur()&&!this.yo;if(ge(i)&&!Re(s)&&!r)return!1;var n=(t=this.mo)!==null&&t!==void 0?t:!!s;return!!this.instance.config.autocapture&&!n}xo(e,t){if(t===void 0&&(t="$autocapture"),this.isEnabled){var s,i=Mi(e);fo(i)&&(i=i.parentNode||null),t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&this.instance.config.rageclick&&(s=this.rageclicks)!=null&&s.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime())&&Cn(i,this.instance.config.rageclick)&&this.xo(e,"$rageclick");var r=t===qi;if(i&&(function(h,d,p,f,g,_){var m;if(!v||Zr(h)||p!=null&&p.url_allowlist&&!Mn(p.url_allowlist,_)||p!=null&&p.url_ignorelist&&Mn(p.url_ignorelist,_))return!1;if(p!=null&&p.dom_event_allowlist){var P=p.dom_event_allowlist;if(P&&!P.some((b=>d.type===b)))return!1}var E=bo(h,f),S=E.parentIsUsefulElement,F=E.targetElementList;if(!(function(b,T){var I=T==null?void 0:T.element_allowlist;if(w(I))return!0;var A,M=function(X){if(I.some((U=>
1X.tagName.toLowerCase()===U)))return{v:!0}};for(var D of b)if(A=M(D))return A.v;return!1})(F,p)||!Sr(F,p==null?void 0:p.css_selector_allowlist)||Sr(F,(m=p==null?void 0:p.css_selector_ignorelist)!==null&&m!==void 0?m:tc))return!1;try{var N=v.getComputedStyle(h);if(N&&N.getPropertyValue("cursor")==="pointer"&&d.type==="click")return!0}catch{}var L=h.tagName.toLowerCase();switch(L){case"html":return!1;case"form":return(g||["submit"]).indexOf(d.type)>=0;case"input":case"select":case"textarea":return(g||["change","click"]).indexOf(d.type)>=0;default:return S?(g||["click"]).indexOf(d.type)>=0:(g||["click"]).indexOf(d.type)>=0&&(Jr.indexOf(L)>-1||h.getAttribute("contenteditable")==="true")}})(i,e,this.Te,r,r?["copy","cut"]:void 0,this.instance)){var n=Uc(i,{e,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}),a=n.props;if(n.explicitNoCapture)return!1;var o=this.getElementSelectors(i);if(o&&o.length>0&&(a.$element_selectors=o),t===qi){var l,u=_o(v==null||(l=v.getSelection())==null?void 0:l.toString()),c=e.type||"clipboard";if(!u)return!1;a.$selected_content=u,a.$copy_type=c}return this.instance.capture(t,a),!0}}}isBrowserSupported(){return Oe(x==null?void 0:x.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this.ko=(v==null||(t=v.location)==null?void 0:t.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(k.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.So&&this.So(),this.So=void 0,k.info("History API monitoring stopped")}monitorHistoryChanges(){v&&v.history&&(this.Co("pushState"),this.Co("replaceState"),this.To())}Co(e){var t;if(v&&((t=v.history[e])==null||!t.__posthog_wrapped__)){var s=this;(function(i,r,n){try{if(!(r in i))return ea;var a={next:i[r]},o=n((function(){for(var l=arguments.length,u=new Array(l),c=0;l>c;c++)u[c]=arguments[c];return a.next.apply(this,u)}));return Oe(o)&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:a}})),i[r]=o,()=>{if(i[r]!==o)for(var l=i[r];Oe(l)&&l.__posthog_layer__;){var u=l.__posthog_layer__;if(u.next===o)return void(u.next=a.next);l=u.next}else i[r]=a.next}}catch{return ea}})(v.history,e,(i=>function(r,n,a){i.call(this,r,n,a),s.Io(e)}))}}Io(e){try{var t,s=v==null||(t=v.location)==null?void 0:t.pathname;if(!s)return;s!==this.ko&&this.isEnabled&&this._instance.capture(yt,{navigation_type:e}),this.ko=s}catch(i){k.error("Error capturing "+e+" pageview",i)}}To(){if(!this.So){var e=()=>{this.Io("popstate")};se(v,"popstate",e),this.So=()=>{v&&v.removeEventListener("popstate",e)}}}},heatmaps:class{get Te(){return this.instance.config}constructor(e){var t;this.Mo=!1,this.po=!1,this.Eo=null,this.instance=e,this.Mo=!((t=this.instance.persistence)==null||!t.props[or]),this.rageclicks=new Qn(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return Z(this.Te.capture_heatmaps)&&this.Te.capture_heatmaps.flush_interval_milliseconds&&(e=this.Te.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return C(this.Te.capture_heatmaps)?C(this.Te.enable_heatmaps)?this.Mo:this.Te.enable_heatmaps:this.Te.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.po)return;Wc.info("starting..."),this.Ro(),this.ke()}else{var e;clearInterval((e=this.Eo)!==null&&e!==void 0?e:void 0),this.Po(),this.getAndClearBuffer()}}onRemoteConfig(e){if(e.ok){var t=e.config;if("heatmaps"in t){var s=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[or]:s}),this.Mo=s,this.startIfEnabled()}}}getAndClearBuffer(){var e=this.R;return this.R=void 0,e}Oo(e){Ui(e.originalEvent)&&this.pe(e.originalEvent,"deadclick")}ke(){this.Eo&&clearInterval(this.Eo),this.Eo=(x==null?void 0:x.visibilityState)==="visible"?setInterval(this.oi.bind(this),this.flushIntervalMilliseconds):null}Ro(){v&&x&&(this.Fo=this.oi.bind(this),se(v,Qs,this.Fo),this.Lo=e=>this.pe(e||(v==null?void 0:v.event)),se(x,"click",this.Lo,{capture:!0}),this.$o=e=>this.Ao(e||(v==null?void 0:v.event)),se(x,"mousemove",this.$o,{capture:!0}),this.No=new Dn(this.instance,uc,this.Oo.bind(this)),this.No.startIfEnabledOrStop(),this.Do=this.ke.bind(this),se(x,Xs,this.Do),this.po=!0)}Po(){var e;v&&x&&(this.Fo&&v.removeEventListener(Qs,this.Fo),this.Lo&&x.removeEventListener("click",this.Lo,{capture:!0}),this.$o&&x.removeEventListener("mousemove",this.$o,{capture:!0}),this.Do&&x.removeEventListener(Xs,this.Do),clearTimeout(this.qo),(e=this.No)==null||e.stop(),this.po=!1)}jo(e,t){var s=this.instance.scrollManager.scrollY(),i=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),n=(function(a,o,l){for(var u=a;u&&Ye(u)&&!Ee(u,"body");){if(u===l)return!1;var c=void 0;try{var h,d,p;c=(h=(d=(p=u.ownerDocument)==null?void 0:p.defaultView)!==null&&d!==void 0?d:v)==null?void 0:h.getComputedStyle(u).position}catch{return!1}if(O(o,c))return!0;u=mo(u)}return!1})(Mi(e),["fixed","sticky"],r);return{x:e.clientX+(n?0:i),y:e.clientY+(n?0:s),target_fixed:n,type:t}}pe(e,t){var s;if(t===void 0&&(t="click"),!In(e.target)&&Ui(e)){var i=this.jo(e,t);(s=this.rageclicks)!=null&&s.isRageClick(e.clientX,e.clientY,new Date().getTime())&&Cn(Mi(e),this.instance.config.rageclick)&&this.Nt(y({},i,{type:"rageclick"})),this.Nt(i)}}Ao(e){!In(e.target)&&Ui(e)&&(clearTimeout(this.qo),this.qo=setTimeout((()=>{this.Nt(this.jo(e,"mousemove"))}),500))}Nt(e){if(v){var t=this.Te.disable_capture_url_hashes?Ze(v.location.href):v.location.href,s=this.Te.custom_personal_data_properties,i=this.Te.mask_personal_data_properties?[...$t,...s||[]]:[],r=hs(t,i,ds);this.R=this.R||{},this.R[r]||(this.R[r]=[]),this.R[r].push(e)}}oi(){this.R&&!Je(this.R)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Dn,webVitalsAutocapture:class{constructor(e){var t;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(((s,i)=>y({},s,{["$web_vitals_"+i.name+"_event"]:y({},i),["$web_vitals_"+i.name+"_value"]:i.value})),{})),this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Uo=s=>{var i;this.R=this.R||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var r=this.zo();if(!w(r))if(C(s==null?void 0:s.name)||C(s==null?void 0:s.value))tt.error("Invalid metric received",s);else if(!this.Vo||this.Vo>s.value){this.R.url!==r&&(this.Ho(),this.Bo=setTimeout(this.Ho,this.flushToCaptureTimeoutMs)),w(this.R.url)&&(this.R.url=r),this.R.firstMetricTimestamp=w(this.R.firstMetricTimestamp)?Date.now():this.R.firstMetricTimestamp,s.attribution&&s.attribution.interactionTargetElement&&(s.attribution.interactionTargetElement=void 0);var n=(i=this._instance.sessionManager)==null?void 0:i.checkAndGetSessionAndWindowId(!0),a=y({},s,{$current_url:r,timestamp:Date.now()});w(n)||(a.$session_id=n.sessionId,a.$window_id=n.windowId),this.R.metrics.push(a),this.R.metrics.length===this.allowedMetrics.length&&this.Ho()}else tt.error("Ignoring metric with value >= "+this.Vo,s)},this.Wo=()=>
1{if(!this.po){var s,i,r,n,a=$.__PosthogExtensions__;if(!w(a)&&!w(a.postHogWebVitalsCallbacks)){var o=a.postHogWebVitalsCallbacks;s=o.onLCP,i=o.onCLS,r=o.onFCP,n=o.onINP}s&&i&&r&&n?(this.allowedMetrics.indexOf("LCP")>-1&&s(this.Uo.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&i(this.Uo.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&r(this.Uo.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&n(this.Uo.bind(this)),this.po=!0):tt.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.Mo=!((t=this._instance.persistence)==null||!t.props[hr]),this.startIfEnabled()}get Zo(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,s=Z(this.Zo)?(e=this.Zo)==null?void 0:e.web_vitals_allowed_metrics:void 0;return C(s)?((t=this._instance.persistence)==null?void 0:t.props[dr])||["CLS","FCP","INP","LCP"]:s}get flushToCaptureTimeoutMs(){return(Z(this.Zo)?this.Zo.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=Z(this.Zo)?this.Zo.web_vitals_attribution:void 0;return e!=null&&e}get Vo(){var e=Z(this.Zo)&&he(this.Zo.__web_vitals_max_value)?this.Zo.__web_vitals_max_value:ta;return e>0&&6e4>=e?ta:e}get isEnabled(){var e=q==null?void 0:q.protocol;if(e!=="http:"&&e!=="https:")return tt.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=Z(this.Zo)?this.Zo.web_vitals:Re(this.Zo)?this.Zo:void 0;return Re(t)?t:this.Mo}startIfEnabled(){this.isEnabled&&!this.po&&(tt.info("enabled, starting..."),this.er(this.Wo))}onRemoteConfig(e){if(e.ok){var t=e.config;if("capturePerformance"in t){var s=Z(t.capturePerformance)&&!!t.capturePerformance.web_vitals,i=Z(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[hr]:s}),this._instance.persistence.register({[dr]:i})),this.Mo=s,this.startIfEnabled()}}}er(e){var t,s;(t=$.__PosthogExtensions__)!=null&&t.postHogWebVitalsCallbacks?e():(s=$.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(i=>{i?tt.error("failed to load script",i):e()}))}zo(){var e=v?this._instance.config.disable_capture_url_hashes?Ze(v.location.href):v.location.href:void 0;if(e){var t=this._instance.config.custom_personal_data_properties,s=this._instance.config.mask_personal_data_properties?[...$t,...t||[]]:[];return hs(e,s,ds)}tt.error("Could not determine current URL")}}},ih={exceptionObserver:class{constructor(e){var t;this.Wo=()=>{var s;if(v&&this.isEnabled&&(s=$.__PosthogExtensions__)!=null&&s.errorWrappingFunctions){var i=$.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,r=$.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,n=$.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Go&&this.Te.capture_unhandled_errors&&(this.Go=i(this.captureException.bind(this))),!this.Qo&&this.Te.capture_unhandled_rejections&&(this.Qo=r(this.captureException.bind(this))),!this.Jo&&this.Te.capture_console_errors&&(this.Jo=n(this.captureException.bind(this)))}catch(a){Ut.error("failed to start",a),this.Ko()}}},this._instance=e,this.Yo=!((t=this._instance.persistence)==null||!t.props[lr]),this.Xo=new su(y({},(function(s){var i,r,n,a;return s===void 0&&(s={}),{refillRate:(i=(r=s.exceptionRateLimiterRefillRate)!==null&&r!==void 0?r:s.__exceptionRateLimiterRefillRate)!==null&&i!==void 0?i:1,bucketSize:(n=(a=s.exceptionRateLimiterBucketSize)!==null&&a!==void 0?a:s.__exceptionRateLimiterBucketSize)!==null&&n!==void 0?n:10}})(this._instance.config.error_tracking),{refillInterval:1e4,Ge:Ut})),this.Te=this.ea(),this.startIfEnabledOrStop()}ea(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Z(e)?t=y({},t,e):(w(e)?this.Yo:e)&&(t=y({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.Te.capture_console_errors||this.Te.capture_unhandled_errors||this.Te.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Ut.info("enabled"),this.Ko(),this.er(this.Wo)):this.Ko()}er(e){var t,s;(t=$.__PosthogExtensions__)!=null&&t.errorWrappingFunctions?e():(s=$.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,"exception-autocapture",(i=>{if(i)return Ut.error("failed to load script",i);e()}))}Ko(){var e,t,s;(e=this.Go)==null||e.call(this),this.Go=void 0,(t=this.Qo)==null||t.call(this),this.Qo=void 0,(s=this.Jo)==null||s.call(this),this.Jo=void 0}onRemoteConfig(e){if(e.ok){var t=e.config;"autocaptureExceptions"in t&&(this.Yo=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[lr]:this.Yo}),this.Te=this.ea(),this.startIfEnabledOrStop())}}onConfigChange(){this.Te=this.ea()}captureException(e){var t,s,i,r=(t=e==null||(s=e.$exception_list)==null||(s=s[0])==null?void 0:s.type)!==null&&t!==void 0?t:"Exception";this.Xo.consumeRateLimit(r)?Ut.info("Skipping exception capture because of client rate limiting.",{exception:r}):(i=this._instance.exceptions)==null||i.sendExceptionEvent(e)}},exceptions:class{constructor(e){var t,s;this.ta=[],this.ra=new yu([new Tu,new Lu,new $u,new Fu,new Cu,new Ru,new Mu,new Au],(function(i){for(var r=arguments.length,n=new Array(r>1?r-1:0),a=1;r>a;a++)n[a-1]=arguments[a];return function(o,l){l===void 0&&(l=0);for(var u=[],c=o.split(` 2`),h=l;c.length>h;h++){var d=c[h];if(1024>=d.length){var p=Pn.test(d)?d.replace(Pn,"$1"):d;if(!p.match(/\S*Error: /)){for(var f of n){var g=f(p,i);if(g){u.push(g);break}}if(u.length>=50)break}}}return(function(_){if(!_.length)return[];var m=Array.from(_);return m.reverse(),m.slice(0,50).map((P=>{return y({},P,{filename:P.filename||(E=m,E[E.length-1]||{}).filename,function:P.function||Tt});var E}))})(u)}})("web:javascript",Eu,Pu)),this._instance=e,this.ta=(t=(s=this._instance.persistence)==null?void 0:s.get_property(ur))!==null&&t!==void 0?t:[],this.ia=Vs(this.na()),this.sa=new Nu(this.ia)}onConfigChange(){this.ia=Vs(this.na()),this.sa.setConfig(this.ia)}onRemoteConfig(e){var t,s,i;if(e.ok){var r=e.config;if("errorTracking"in r){var n=(t=(s=r.errorTracking)==null?void 0:s.suppressionRules)!==null&&t!==void 0?t:[],a=(i=r.errorTracking)==null?void 0:i.captureExtensionExceptions;this.ta=n,this._instance.persistence&&this._instance.persistence.register({[ur]:this.ta,[cr]:a})}}}get oa(){var e,t=!!this._instance.get_property(cr),s=this._instance.config.error_tracking.captureExtensionExceptions;return(e=s??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.ra.buildFromUnknown(e,{syntheticException:t==null?void 0:t.syntheticException,mechanism:{handled:t==null?void 0:t.handled}})}addExceptionStep(e,t){if(this.ia.enabled)try{if(!G(e)||e.trim().length===0)return void Ne.warn("Ignoring exception step because message must be a non-empty string");var s=(function(n){if(!n)return{sanitizedProperties:{},droppedKeys:[]};var a=[];return{sanitizedProperties:Object.keys(n).reduce(((o,l)=>Du.has(l)?(a.push(l),o):(o[l]=n[l],o)),{}),droppedKeys:a}})(this.aa(t)),i=s.sanitizedProperties,r=s.droppedKeys;r.length>0&&Ne.warn("Ignoring reserved exception step fields",{droppedKeys:r}),this.sa.add(y({[Bs]:e,[Us]:new Date().toISOString()},i))}catch(n){Ne.error("Failed to add exception step. Ignoring breadcrumb.",n)}}sendExceptionEvent(e){try{var t=e.$exception_list;if(this.la(t)){if(this.ua(t))return this.ha("Exception dropped: matched a suppression rule"),void Ne.info("Skipping exception capture because a suppression rule matched");if(!this.oa&&this.da(t))return this.ha("Exception dropped: thrown by a browser extension"),void Ne.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ca(t))return this.ha("Exception dropped: thrown by the PostHog SDK"),void Ne.info("Skipping exception capture because it was thrown by the PostHog SDK")}var s=this.ia.enabled&&C(e.$exception_steps)?this.va(e):e;try{var i=this._instance.capture("$exception",s,{_noTruncate:!0,_batchKey:"exceptionEvent",kn:!0});return i&&this.sa.clear(),i}catch(r){return Ne.error("Failed to capture exception event. Dropping this exception.",r),void this.sa.clear()}}catch(r){return void Ne.error("Failed to process exception event. Ignoring this exception.",r)}}va(e){try{var t=this.sa.getAttachable();return t.length===0?e:y({},e,{$exception_steps:t})}catch(s){return Ne.error("Failed to read buffered exception steps. Capturing exception without steps.",s),e}}ha(e){this.ia.enabled&&this.sa.add({[Bs]:e,[Us]:new Date().toISOString()})}aa(e){return Z(e)?y({},e):{}}na(){var e,t;return(e=(t=this._instance.config.error_tracking)==null?void 0:t.exception_steps)!==null&&e!==void 0?e:{}}ua(e){if(e.length===0)return!1;var t=e.reduce(((s,i)=>{var r=i.type,n=i.value;return G(r)&&r.length>0&&s.$exception_types.push(r),G(n)&&n.length>0&&s.$exception_values.push(n),s}),{$exception_types:[],$exception_values:[]});return this.ta.some((s=>{var i=s.values.map((r=>{var n,a=Ko[r.operator],o=R(r.value)?r.value:[r.value],l=(n=t[r.key])!==null&&n!==void 0?n:[];return o.length>0&&a(o,l)}));return s.type==="OR"?i.some(Boolean):i.every(Boolean)}))}da(e){return e.flatMap((t=>{var s,i;return(s=(i=t.stacktrace)==null?void 0:i.frames)!==null&&s!==void 0?s:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}ca(e){if(e.length>0){var t,s,i,r,n=(t=(s=e[0].stacktrace)==null?void 0:s.frames)!==null&&t!==void 0?t:[],a=n[n.length-1];return(i=a==null||(r=a.filename)==null?void 0:r.includes("posthog.com/static"))!==null&&i!==void 0&&i}return!1}la(e){return!C(e)&&R(e)}}},rh=y({productTours:class{get mi(){return this._instance.persistence}constructor(e){this.fa=null,this.pa=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(e.ok){var t=e.config;if("productTours"in t){var s,i;if(this.mi&&this.mi.register({[Br]:!!t.productTours}),!Wi(this._instance))return!this.fa&&C((s=this.mi)==null?void 0:s.props[Yt])||Vi.info("product tours disabled; stopping and clearing cached tours"),(i=this.fa)==null||i.stop(),this.fa=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.fa&&Wi(this._instance)&&this.er((()=>this.ga()))}er(e){var t,s;(t=$.__PosthogExtensions__)!=null&&t.generateProductTours?e():(s=$.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,"product-tours",(i=>{i?Vi.error("Could not load product tours script",i):e()}))}ga(){var e;!this.fa&&(e=$.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.fa=$.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(t===void 0&&(t=!1),!R(this.pa)||t){var s=this.mi;if(s){var i=s.props[Yt];if(R(i)&&!t)return this.pa=i,void e(i,{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:r=>{if(Wi(this._instance)){var n=r.statusCode;if(n!==200||!r.json){var a="Product Tours API could not be loaded, status: "+n;return Vi.error(a),void e([],{isLoaded:!1,error:a})}var o=R(r.json.product_tours)?r.json.product_tours:[];this.pa=o,s&&s.register({[Yt]:o}),e(o,{isLoaded:!0})}else e([],{isLoaded:!0})}})}else e(this.pa,{isLoaded:!0})}getActiveProductTours(e){C(this.fa)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.fa.getActiveProductTours(e)}showProductTour(e){var t;(t=this.fa)==null||t.showTourById(e)}previewTour(e){this.fa?this.fa.previewTour(e):this.er((()=>{var t;this.ga(),(t=this.fa)==null||t.previewTour(e)}))}dismissProductTour(){var e;(e=this.fa)==null||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.fa)==null||e.nextStep()}previousStep(){var e;(e=this.fa)==null||e.previousStep()}clearCache(){var e;this.pa=null,(e=this.mi)==null||e.unregister(Yt)}resetTour(e){var t;(t=this.fa)==null||t.resetTour(e)}resetAllTours(){var e;(e=this.fa)==null||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.fa)==null||t.cancelPendingTour(e)}}},vi),nh={siteApps:class{constructor(e){this.ma=0,this._instance=e,this.ya=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}ba(e,t){if(t){var s=this.globalsForEvent(t);this.ya.push(s),this.ya.length>1e3&&(this.ya=this.ya.slice(10))}}get siteAppLoaders(){var e;return(e=$._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}initialize(){if(this.isEnabled){var e=this._instance._addCaptureHook(this.ba.bind(this));this._a=()=>{e(),this.ya=[],this._a=void 0}}}globalsForEvent(e){var t,s,i,r,n,a,o;if(!e)throw new Error("Event payload is required");var l={},u=this._instance.get_property("$groups")||[],c=this._instance.get_property("$stored_group_properties")||{};for(var h of Object.entries(c)){var d=h[0];l[d]={id:u[d],type:d,properties:h[1]}}var p=e.$set_once,f=e.$set;return{event:y({},ya(e,Kc),{properties:y({},e.properties,f?{$set:y({},(t=(s=e.properties)==null?void 0:s.$set)!==null&&t!==void 0?t:{},f)}:{},p?{$set_once:y({},(i=(r=e.properties)==null?void 0:r.$set_once)!==null&&i!==void 0?i:{},p)}:{}),elements_chain:(n=(a=e.properties)==null?void 0:a.$elements_chain)!==null&&n!==void 0?n:"",distinct_id:(o=e.properties)==null?void 0:o.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}wa(e){var t,s=(t=e.tagName)==null?void 0:t.toLowerCase();return s==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||(Ce.error("prepare_external_dependency_stylesheet returned null"),null):s==="script"&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(e)||(Ce.error("prepare_external_dependency_script returned null"),null):e}xa(){var e,t,s,i,r,n,a,o;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var l=x==null?void 0:x.defaultView,u=l==null||(e=l.Node)==null?void 0:e.prototype;if(!l||!u)return()=>{};if(this.ma++,this.ka)return this.Sa();var c=[],h=this,d=new WeakSet,p=(_,m,P)=>{if(_!=null&&_[m]){var E=_[m];_[m]=P(E),c.push((()=>{_[m]=E}))}},f=_=>{if(d.has(_))return _;var m=h.wa(_);return m&&d.add(m),m},g=_=>_.map((m=>typeof m=="string"?m:f(m))).filter((m=>!ge(m)));return p(u,"appendChild",(_=>function(m){var P=f(m);return P?_.call(this,P):m})),p(u,"insertBefore",(_=>function(m,P){var E=f(m);return E?_.call(this,E,P):m})),p(u,"replaceChild",(_=>function(m,P){var E=f(m);return E?_.call(this,E,P):P})),[(t=l.Element)==null?void 0:t.prototype,(s=l.Document)==null?void 0:s.prototype,(i=l.DocumentFragment)==null?void 0:i.prototype].forEach((_=>{p(_,"append",(m=>function(){for(var P=arguments.length,E=new Array(P),S=0;P>S;S++)E[S]=arguments[S];return m.apply(this,g(E))})),p(_,"prepend",(m=>function(){for(var P=arguments.length,E=new Array(P),S=0;P>S;S++)E[S]=arguments[S];return m.apply(this,g(E))}))})),[(r=l.Element)==null?void 0:r.prototype,(n=l.CharacterData)==null?void 0:n.prototype,(a=l.DocumentType)==null?void 0:a.prototype].forEach((_=>{p(_,"before",(m=>function(){for(var P=arguments.length,E=new Array(P),S=0;P>S;S++)E[S]=arguments[S];return m.apply(this,g(E))})),p(_,"after",(m=>function(){for(var P=arguments.length,E=new Array(P),S=0;P>S;S++)E[S]=arguments[S];return m.apply(this,g(E))})),p(_,"replaceWith",(m=>function(){for(var P=arguments.length,E=new Array(P),S=0;P>S;S++)E[S]=arguments[S];var F=g(E);return E.length&&!F.length?void 0:m.apply(this,F)}))})),p((o=l.Element)==null?void 0:o.prototype,"insertAdjacentElement",(_=>function(m,P){var E=f(P);return E?_.call(this,m,E):null})),this.ka=()=>
2{c.forEach((_=>_())),this.ka=void 0},this.Sa()}Sa(){var e=!1;return()=>{var t;e||(e=!0,this.ma--,this.ma===0&&((t=this.ka)==null||t.call(this)))}}Ca(e,t){t===void 0&&(t=!0);var s=this.xa();try{var i=e(s);return t&&s(),i}catch(r){throw s(),r}}setupSiteApp(e){var t=this.apps[e.id],s=()=>{var a;!t.errored&&this.ya.length&&(Ce.info("Processing "+this.ya.length+" events for site app with id "+e.id),this.ya.forEach((o=>this.Ca((()=>t.processEvent==null?void 0:t.processEvent(o))))),t.processedBuffer=!0),Object.values(this.apps).every((o=>o.processedBuffer||o.errored))&&((a=this._a)==null||a.call(this))},i=!1,r=a=>{t.errored=!a,t.loaded=!0,Ce.info("Site app with id "+e.id+" "+(a?"loaded":"errored")),i&&s()};try{var n=this.Ca((a=>e.init({posthog:this._instance,callback(o){a(),r(o)}})),!1).processEvent;n&&(t.processEvent=n),i=!0}catch(a){Ce.error(ra+e.id,a),r(!1)}if(i&&t.loaded)try{s()}catch(a){Ce.error("Error while processing buffered events PostHog app with config id "+e.id,a),t.errored=!0}}Ta(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var s of e)this.setupSiteApp(s)}Ia(e){var t=this;if(Object.keys(this.apps).length!==0){var s=this.globalsForEvent(e),i=function(n){try{t.Ca((()=>n.processEvent==null?void 0:n.processEvent(s)))}catch(a){Ce.error("Error while processing event "+e.event+" for site app "+n.id,a)}};for(var r of Object.values(this.apps))i(r)}}onRemoteConfig(e){var t,s,i,r=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.Ta(),void this._instance.on("eventCaptured",(l=>this.Ia(l)))):void Ce.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((s=this._a)==null||s.call(this),e.ok){var n=e.config;if((i=n.siteApps)!=null&&i.length)if(this.isEnabled){var a=function(){var l,u=o.id,c=o.url;$["__$$ph_site_app_"+u]=r._instance,(l=$.__PosthogExtensions__)==null||l.loadSiteApp==null||l.loadSiteApp(r._instance,c,(h=>{if(h)return Ce.error(ra+u,h)}))};for(var o of n.siteApps)a()}else Ce.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},ah={tracingHeaders:class{constructor(e){this.Ma=void 0,this.Ea=void 0,this.Ra=void 0,this.Wo=()=>{var t,s,i=this.Pa();i?(w(this.Ma)&&(this.Ma=(t=$.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null?void 0:t._patchXHR(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),w(this.Ea)&&(this.Ea=(s=$.__PosthogExtensions__)==null||(s=s.tracingHeadersPatchFns)==null?void 0:s._patchFetch(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.Ko()},this._instance=e}initialize(){this.startIfEnabledOrStop()}er(e){var t,s;(t=$.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns?e():(s=$.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,"tracing-headers",(i=>{if(i)return Vc.error("failed to load script",i);e()}))}Oa(){var e,t;return(e=(t=this._instance.config.tracing_headers)!==null&&t!==void 0?t:this._instance.config.addTracingHeaders)!==null&&e!==void 0?e:this._instance.config.__add_tracing_headers}Pa(){var e=this.Oa();return R(e)?(R(this.Ra)?this.Ra.splice(0,this.Ra.length,...e):this.Ra=[...e],e.length>0?this.Ra:void 0):(R(this.Ra)&&this.Ra.splice(0),this.Ra=e||void 0,this.Ra)}Ko(){var e,t;(e=this.Ma)==null||e.call(this),(t=this.Ea)==null||t.call(this),this.Ma=void 0,this.Ea=void 0}startIfEnabledOrStop(){this.Pa()?this.er(this.Wo):this.Ko()}}},oh=y({surveys:class{get Te(){return this._instance.config}constructor(e){this.Fa=void 0,this._surveyManager=null,this.La=!1,this.$a=[],this.Aa=null,this.Na=null,this._instance=e,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this.Te.disable_surveys){if(!e.ok)return H.warn("Remote config unavailable. Not loading surveys.");var t=e.config.surveys;if(C(t))return H.warn("Flags not loaded yet. Not loading surveys.");var s=R(t);this.Fa=s?t.length>0:t,H.info("flags response received, isSurveysEnabled: "+this.Fa),this.loadIfEnabled()}}reset(){try{var e;(e=this._surveyEventReceiver)==null||e.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var t=[],s=0;s<localStorage.length;s++){var i=localStorage.key(s);(i!=null&&i.startsWith(Yo)||i!=null&&i.startsWith("inProgressSurvey_"))&&t.push(i)}t.forEach((r=>localStorage.removeItem(r)))}catch{}}loadIfEnabled(){if(!this._surveyManager)if(this.La)H.info("Already initializing surveys, skipping...");else if(this.Te.disable_surveys)H.info(na);else if(this.Te.cookieless_mode&&this._instance.consent.isOptedOut())H.info("Not loading surveys in cookieless mode without consent.");else{var e=$==null?void 0:$.__PosthogExtensions__;if(e){if(!w(this.Fa)||this.Te.advanced_enable_surveys){var t=this.Fa||this.Te.advanced_enable_surveys;this.La=!0;try{var s=e.generateSurveys;if(s)return void this.Da(s,t);var i=e.loadExternalDependency;if(!i)return void this.qa(Vr);i(this._instance,"surveys",(r=>{r||!e.generateSurveys?this.qa("Could not load surveys script",r):this.Da(e.generateSurveys,t)}))}catch(r){throw this.qa("Error initializing surveys",r),r}finally{this.La=!1}}}else H.error("PostHog Extensions not found.")}}Da(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new Yc(this._instance),H.info("Surveys loaded successfully"),this.ja({isLoaded:!0})}qa(e,t){H.error(e,t),this.ja({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.$a.push(e),this._surveyManager&&this.ja({isLoaded:!0}),()=>{this.$a=this.$a.filter((t=>t!==e))}}getSurveys(e,t){if(t===void 0&&(t=!1),this.Te.disable_surveys)return H.info(na),e([]);var s,i=this._instance.get_property(vr);if(i&&!t)return e(i,{isLoaded:!0}
2),void(this.Ha()&&this.getSurveys((()=>{}),!0));typeof Promise<"u"&&this.Aa?this.Aa.then((r=>e(r.surveys,r.context))):(typeof Promise<"u"&&(this.Aa=new Promise((r=>{s=r}))),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:r=>{var n;this.Aa=null;var a=r.statusCode;if(a!==200||!r.json){var o="Surveys API could not be loaded, status: "+a;H.error(o),this.Na=Date.now();var l={isLoaded:!1,error:o};return e([],l),void(s==null||s({surveys:[],context:l}))}this.Na=null;var u,c=r.json.surveys||[],h=c.filter((p=>(function(f){return!(!f.start_date||f.end_date)})(p)&&(Zo(p)||(function(f){var g;return!((g=f.conditions)==null||(g=g.actions)==null||(g=g.values)==null||!g.length)})(p))));h.length>0&&((u=this._surveyEventReceiver)==null||u.register(h)),(n=this._instance.persistence)==null||n.register({[vr]:c,[Js]:Date.now()});var d={isLoaded:!0};e(c,d),s==null||s({surveys:c,context:d})}}))}Ha(){return this.Ba()&&!this.Aa&&!this.Ua()}Ba(){var e=this._instance.get_property(Js);return he(e)&&Date.now()-e>3e5}Ua(){return he(this.Na)&&3e5>Date.now()-this.Na}markSurveyAsSeen(e,t){var s,i={id:e,current_iteration:(s=t==null?void 0:t.iteration)!==null&&s!==void 0?s:null};Xo(i);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}}ja(e){for(var t of this.$a)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(s){H.error("Error in survey callback",s)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!C(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);H.warn("init was not called")}za(e){var t=null;return this.getSurveys((s=>{var i;t=(i=s.find((r=>r.id===e)))!==null&&i!==void 0?i:null})),t}Va(e){if(C(this._surveyManager))return{eligible:!1,reason:$s};var t=typeof e=="string"?this.za(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}Wa(e){if(C(this._surveyManager))return{eligible:!1,reason:$s};var t=typeof e=="string"?this.za(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(C(this._surveyManager))return H.warn("init was not called"),{visible:!1,disabledReason:$s};var t=this.Wa(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return C(this._surveyManager)?(H.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:$s})):new Promise((s=>{this.getSurveys((i=>{var r,n=(r=i.find((o=>o.id===e)))!==null&&r!==void 0?r:null;if(n){var a=this.Wa(n);s({visible:a.eligible,disabledReason:a.reason})}else s({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t,s){var i;if(C(this._surveyManager))H.warn("init was not called");else{var r=typeof e=="string"?this.za(e):e;if(r!=null&&r.id)if(Lc.includes(r.type)){var n=x==null?void 0:x.querySelector(t);if(n)return(i=r.appearance)!=null&&i.surveyPopupDelaySeconds?(H.info("Rendering survey "+r.id+" with delay of "+r.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var a,o;H.info("Rendering survey "+r.id+" with delay of "+((a=r.appearance)==null?void 0:a.surveyPopupDelaySeconds)+" seconds"),(o=this._surveyManager)==null||o.renderSurvey(r,n,s),H.info("Survey "+r.id+" rendered")}),1e3*r.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(r,n,s);H.warn("Survey element not found")}else H.warn("Surveys of type "+r.type+" cannot be rendered in the app");else H.warn("Survey not found")}}displaySurvey(e,t){var s;if(C(this._surveyManager))H.warn("init was not called");else{var i=this.za(e);if(i){var r=i;if((s=i.appearance)!=null&&s.surveyPopupDelaySeconds&&t.ignoreDelay&&(r=y({},i,{appearance:y({},i.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==Tr.Popover&&t.initialResponses&&H.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){var n=this.Va(i);if(!n.eligible)return void H.warn("Survey is not eligible to be displayed: ",n.reason)}t.displayType!==Tr.Inline?this._surveyManager.handlePopoverSurvey(r,t):this.renderSurvey(r,t.selector,t.properties)}else H.warn("Survey not found")}}cancelPendingSurvey(e){C(this._surveyManager)?H.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload==null||e.handlePageUnload()}}},vi),lh={toolbar:class{constructor(e){this.instance=e}Za(e){$.ph_toolbar_state=e}Ga(){var e;return(e=$.ph_toolbar_state)!==null&&e!==void 0?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,t,s){if(e===void 0&&(e=void 0),t===void 0&&(t=void 0),s===void 0&&(s=void 0),lo(this.instance.config)||!v||!x)return!1;e=e??v.location,s=s??v.history;try{if(!t){try{v.localStorage.setItem("test","test"),v.localStorage.removeItem("test")}catch{return!1}t=v==null?void 0:v.localStorage}var i,r=Xc||si(e.hash,"__posthog")||si(e.hash,"state"),n=r?Fn((()=>JSON.parse(atob(decodeURIComponent(r)))))||Fn((()=>JSON.parse(decodeURIComponent(r)))):null;return n&&n.action==="ph_authorize"?((i=n).source="url",i&&Object.keys(i).length>0&&(n.desiredHash?e.hash=n.desiredHash:s?s.replaceState(s.state,"",e.pathname+e.search):e.hash="")):((i=JSON.parse(t.getItem(aa)||"{}")).source="localstorage",delete i.userIntent),!(!i.token||this.instance.config.token!==i.token||(this.loadToolbar(i),0))}catch{return!1}}Qa(e){var t=$.ph_load_toolbar||$.ph_load_editor;!C(t)&&Oe(t)?t(e,this.instance):oa.warn("No toolbar load function found")}loadToolbar(e){var t=!(x==null||!x.getElementById(po));if(!v||t)return!1;var s=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,i=y({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},s?{instrument:!1}:{});if(v.localStorage.setItem(aa,JSON.stringify(y({},i,{source:void 0}))),this.Ga()===2)this.Qa(i);else if(this.Ga()===0){var r;this.Za(1),(r=$.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this.instance,"toolbar",(n=>{if(n)return oa.error("[Toolbar] Failed to load",n),void this.Za(0);this.Za(2),this.Qa(i)})),se(v,"turbolinks:load",(()=>{this.Za(0),this.loadToolbar(i)}))}return!0}Ja(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,s){return e===void 0&&(e=void 0),t===void 0&&(t=void 0),s===void 0&&(s=void 0),this.maybeLoadToolbar(e,t,s)}}},uh=y({experiments:eh},vi),ch={conversations:class{constructor(e){this.Ka=void 0,this._conversationsManager=null,this.Ya=!1,this.Xa=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations&&e.ok){var t=e.config.conversations;C(t)||(Re(t)?this.Ka=t:(this.Ka=t.enabled,this.Xa=t),this.loadIfEnabled())}}reset(){var e;(e=this._conversationsManager)==null||e.reset(),this._conversationsManager=null,this.Ka=void 0,this.Xa=null}loadIfEnabled(){if(!(this._conversationsManager||this.Ya||this._instance.config.disable_conversations||lo(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=$==null?void 0:$.__PosthogExtensions__;if(e&&!w(this.Ka)&&this.Ka)if(this.Xa&&this.Xa.token){this.Ya=!0;try{var t=e.initConversations;if(t)return this.el(t),void(this.Ya=!1);var s=e.loadExternalDependency;if(!s)return void this.tl(Vr);s(this._instance,"conversations",(i=>{i||!e.initConversations?this.tl("Could not load conversations script",i):this.el(e.initConversations),this.Ya=!1}))}catch(i){this.tl("Error initializing conversations",i),this.Ya=!1}}else Te.error("Conversations enabled but missing token in remote config.")}}
2el(e){if(this.Xa)try{this._conversationsManager=e(this.Xa,this._instance),Te.info("Conversations loaded successfully")}catch(t){this.tl("Error completing conversations initialization",t)}else Te.error("Cannot complete initialization: remote config is null")}tl(e,t){Te.error(e,t),this._conversationsManager=null,this.Ya=!1}show(){this._conversationsManager?this._conversationsManager.show():Te.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Ka===!0&&!ge(this._conversationsManager)}isVisible(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.isVisible())!==null&&e!==void 0&&e}sendMessage(e,t,s){var i=this;return re((function*(){return i._conversationsManager?i._conversationsManager.sendMessage(e,t,s):(Te.warn(it),null)}))()}getMessages(e,t){var s=this;return re((function*(){return s._conversationsManager?s._conversationsManager.getMessages(e,t):(Te.warn(it),null)}))()}markAsRead(e){var t=this;return re((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(Te.warn(it),null)}))()}getTickets(e){var t=this;return re((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(Te.warn(it),null)}))()}requestRestoreLink(e){var t=this;return re((function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(Te.warn(it),null)}))()}restoreFromToken(e){var t=this;return re((function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(Te.warn(it),null)}))()}restoreFromUrlToken(){var e=this;return re((function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(Te.warn(it),null)}))()}getCurrentTicketId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getCurrentTicketId())!==null&&e!==void 0?e:null}getWidgetSessionId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getWidgetSessionId())!==null&&e!==void 0?e:null}En(){var e;(e=this._conversationsManager)==null||e.setIdentity()}Rn(){var e;(e=this._conversationsManager)==null||e.clearIdentity()}}},hh={logs:class{constructor(e){var t;this.rl=!1,this.il=!1,this.Ge=Y("[logs]"),this.Gr=[],this.nl=[],this.Hs=0,this.sl=()=>{var s,i;this.Hs=0,(s=this.ol)==null||s.onReconnect(),(i=this.al)==null||i.onReconnect()},this._instance=e,this._instance&&(t=this._instance.config.logs)!=null&&t.captureConsoleLogs&&(this.rl=!0),v&&se(v,"online",this.sl)}ll(e,t,s,i){var r,n=(function(a,o){var l,u,c,h,d,p,f,g=(l=a==null?void 0:a.flushIntervalMs)!==null&&l!==void 0?l:3e3,_=(u=a==null?void 0:a.maxBufferSize)!==null&&u!==void 0?u:100,m=o!=null&&o.consoleCapture?void 0:(c=a==null?void 0:a.maxLogsPerInterval)!==null&&c!==void 0?c:1e3,P=w(m)?Math.max(_,2048):Math.max(_,m),E=a==null?void 0:a.resourceAttributes;return{serviceName:(h=(d=E==null?void 0:E["service.name"])!==null&&d!==void 0?d:a==null?void 0:a.serviceName)!==null&&h!==void 0?h:o==null?void 0:o.serviceNameDefault,serviceVersion:(p=E==null?void 0:E["service.version"])!==null&&p!==void 0?p:a==null?void 0:a.serviceVersion,environment:(f=E==null?void 0:E["deployment.environment"])!==null&&f!==void 0?f:a==null?void 0:a.environment,resourceAttributes:E,beforeSend:a==null?void 0:a.beforeSend,flushIntervalMs:g,maxBufferSize:_,maxQueueSize:P,maxBatchRecordsPerPost:100,rateCapWindowMs:g,maxLogsPerInterval:m,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}})((r=this._instance)==null||(r=r.config)==null?void 0:r.logs,s);return[new gu(this.ul(e,t),n,this.Ge,(()=>this.hl()),(a=>a()),void 0,i),n]}dl(){var e,t=(e=this._instance)==null||(e=e.config)==null?void 0:e.logs;if(!this.ol||this.cl!==t){var s;(s=this.ol)==null||s.reset(),this.cl=t;var i=this.ll((()=>this.Gr),(r=>{this.Gr=r}));this.ol=i[0],this.vl=i[1]}return this.ol}fl(){var e,t=(e=this._instance)==null||(e=e.config)==null?void 0:e.logs;if(!this.al||this.pl!==t){var s;(s=this.al)==null||s.reset(),this.pl=t;var i=this.ll((()=>this.nl),(r=>{this.nl=r}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},ha);this.al=i[0],this.gl=i[1]}return this.al}initialize(){this.loadIfEnabled()}onRemoteConfig(e){var t;if(e.ok){var s=(t=e.config.logs)==null?void 0:t.captureConsoleLogs;!C(s)&&s&&(this.rl=!0,this.loadIfEnabled())}}reset(){var e,t;this.Gr=[],(e=this.ol)==null||e.reset(),this.nl=[],(t=this.al)==null||t.reset(),this.Hs=0}captureLog(e){this.dl().captureLog(e)}le(e){this.fl().captureLog(e)}get logger(){return this.ml||(this.ml={trace:(e,t)=>this.captureLog({body:e,level:"trace",attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:"debug",attributes:t}),info:(e,t)=>this.captureLog({body:e,level:"info",attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:"warn",attributes:t}),error:(e,t)=>
2this.captureLog({body:e,level:"error",attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:"fatal",attributes:t})}),this.ml}flushLogs(e){e?this.yl(e):(this.ol&&this.ol.flush().catch((t=>this.Ge.error("PostHog logs flush failed:",t))),this.al&&this.al.flush().catch((t=>this.Ge.error("PostHog logs flush failed:",t))))}loadIfEnabled(){if(this.rl&&!this.il){var e=$==null?void 0:$.__PosthogExtensions__;if(e){var t=e.loadExternalDependency;t?t(this._instance,"logs",(s=>{var i;s||(i=e.logs)==null||!i.initializeLogs?this.Ge.error("Could not load logs script",s):(e.logs.initializeLogs(this._instance),this.il=!0)})):this.Ge.error(Vr)}else this.Ge.error("PostHog Extensions not found.")}}ul(e,t){var s=this._instance;return{get isDisabled(){return!1},get optedOut(){return!s.is_capturing()},getPersistedProperty:i=>i===He.LogsQueue?e():void 0,setPersistedProperty(i,r){var n;i===He.LogsQueue&&t((n=r)!==null&&n!==void 0?n:[])},Tt:i=>this.Tt(i),getLibraryId:()=>z.LIB_NAME,getLibraryVersion:()=>z.LIB_VERSION}}Tt(e){return new Promise((t=>{if(To(this.Hs,3))t({kind:"fatal",error:new Error("logs endpoint is unreachable, dropping batch")});else{var s=!1,i=n=>{s||(s=!0,clearTimeout(r),t(n))},r=setTimeout((()=>i({kind:"retry-later",error:new Error("logs request timed out")})),9e4);this._instance._send_request({method:"POST",url:this.bl(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:n=>{var a=n.statusCode;if(this._l(a),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("logs request failed with status "+a)});else{var o;i({kind:"retry-later",error:(o=n.error)!==null&&o!==void 0?o:new Error("logs request failed with status "+a)})}}})}}))}_l(e){(e!==0||this._instance.__loaded)&&(this.Hs=Fo(e,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(e){this.Gr.length>0&&this.wl(e,this.Gr,this.vl,z.LIB_NAME,(t=>{this.Gr=t})),this.nl.length>0&&this.wl(e,this.nl,this.gl,ha,(t=>{this.nl=t}))}wl(e,t,s,i,r){if(t.length!==0){var n=t.map((o=>o.record));r([]);var a=Ka(n,Wa(s,z.LIB_NAME,z.LIB_VERSION),i,z.LIB_VERSION);this._instance._send_request({method:"POST",url:this.bl(),data:a,compression:"best-available",batchKey:"logs",transport:e})}}bl(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}hl(){var e,t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var s=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),i=s.windowId,r=s.sessionStartTimestamp,n=s.lastActivityTimestamp;t.sessionId=s.sessionId,t.windowId=i,C(r)||(t.sessionStartTimestamp=r),C(n)||(t.lastActivityTimestamp=n)}if($!=null&&(e=$.location)!=null&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?Ze($.location.href):$.location.href),this._instance.featureFlags){var a=this._instance.featureFlags.getFlags();a&&a.length>0&&(t.activeFeatureFlags=a)}return t}}},dh={metrics:class{constructor(e){this.Ge=Y("[metrics]"),this._instance=e}initialize(){}dl(){var e,t,s=(e=this._instance)==null||(e=e.config)==null?void 0:e.metrics;return this.ol&&this.cl===s||((t=this.ol)==null||t.reset(),this.cl=s,this.ol=new _u(this.ul(),(function(i){var r,n,a,o,l,u=i==null?void 0:i.resourceAttributes;return{serviceName:(r=u==null?void 0:u["service.name"])!==null&&r!==void 0?r:i==null?void 0:i.serviceName,serviceVersion:(n=u==null?void 0:u["service.version"])!==null&&n!==void 0?n:i==null?void 0:i.serviceVersion,environment:(a=u==null?void 0:u["deployment.environment"])!==null&&a!==void 0?a:i==null?void 0:i.environment,resourceAttributes:u,beforeSend:i==null?void 0:i.beforeSend,flushIntervalMs:(o=i==null?void 0:i.flushIntervalMs)!==null&&o!==void 0?o:1e4,maxSeriesPerFlush:(l=i==null?void 0:i.maxSeriesPerFlush)!==null&&l!==void 0?l:1e3}})(s),this.Ge)),this.ol}count(e,t,s){t===void 0&&(t=1),this.dl().count(e,t,s)}
2gauge(e,t,s){this.dl().gauge(e,t,s)}histogram(e,t,s){this.dl().histogram(e,t,s)}flush(e){if(!this.ol)return Promise.resolve();if(e){var t=this.ol.drainWindow();return t&&this.Bt(t,e),Promise.resolve()}return this.ol.flush().catch((s=>this.Ge.error("PostHog metrics flush failed:",s)))}reset(){var e;(e=this.ol)==null||e.reset()}ul(){var e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},Bt:s=>t.Bt(s),getLibraryId:()=>z.LIB_NAME,getLibraryVersion:()=>z.LIB_VERSION}}Bt(e,t){return new Promise((s=>{var i=!1,r=a=>{i||(i=!0,clearTimeout(n),s(a))},n=setTimeout((()=>r({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request(y({method:"POST",url:this.xl(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t},{fireCallbackOnDrop:!0,callback(a){var o=a.statusCode;if(o>=200&&300>o)r({kind:"ok"});else if(o===413)r({kind:"too-large"});else if(o!==0&&o!==429&&500>o)r({kind:"fatal",error:new Error("metrics request failed with status "+o)});else{var l;r({kind:"retry-later",error:(l=a.error)!==null&&l!==void 0?l:new Error("metrics request failed with status "+o)})}}}))}))}xl(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},ph=y({},vi,th,sh,ih,rh,nh,oh,ah,lh,uh,ch,hh,dh);ns.__defaultExtensionClasses=y({},ph);var ht=(function(){z.SDK_DIST_CHANNEL="npm";var e=rs[bt]=new ns;return(function(){function t(){t.done||(t.done=!0,el=!1,B(rs,(function(s){s._dom_loaded()})))}x!=null&&x.addEventListener?x.readyState==="complete"?t():se(x,"DOMContentLoaded",t,{capture:!1}):v&&k.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),e})(),tl=!1;function fs(){return tl}function fh(){tl=!0}function vh(e){try{return new URL(e.includes("://")?e:`https://${e}`).host}catch{return e}}var as=null;function gh(){as==null||as()}function _h(e){var n;if(fs()||!Mt()||_a())return;let t=jl.safeParse(e);if(!t.success){let a=((n=t.error.issues[0])==null?void 0:n.message)??"init() requires a config object with { projectKey }.";console.error(`[HeyCatch] ${a}`);return}console.info(`[HeyCatch] SDK v${bi} (${yi}) initialized â ${mi}`);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,rageclick:!0,...(()=>{let a=[...globalThis.location.host?[globalThis.location.host]:[],...t.data.tracingHosts.map(o=>vh(o))];return a.length>
20?{tracing_headers:[...new Set(a)]}:{}})()};ht.init(Nl,s);let{install:i}=t.data,r={heycatch_framework:i.framework,heycatch_framework_version:i.frameworkVersion,heycatch_agent:i.agent};as=()=>{ht.register({heycatch_sdk_version:bi,heycatch_sdk_stage:yi,heycatch_project_key:t.data.projectKey,...r}),ht.group(sl,t.data.projectKey,{key:t.data.projectKey,sdk_version:bi,sdk_stage:yi,framework:i.framework,framework_version:i.frameworkVersion,agent:i.agent,origin:globalThis.location.origin,api_host:mi})},as(),Bl(),fh()}function mh(e,t,s){if(!(!fs()||!Mt())){if(typeof e!="string"||e.length===0){console.error("[HeyCatch] setIdentity() requires a non-empty string user id. Pass a stable internal user id from your auth provider â not an email or session token.");return}ht.identify(e,t,s)}}function yh(){!fs()||!Mt()||(ht.reset(),gh())}function bh(e,t,s){if(!(!fs()||!Mt())){if(typeof e!="string"||e.length===0){console.error('[HeyCatch] trackEvent() requires a non-empty event name, e.g. track("signup_completed").');return}if(e.startsWith("$")){console.error(`[HeyCatch] trackEvent() event names cannot start with "$" (got "${e}") - that prefix is reserved for built-in events.`);return}ht.capture(e,{...t,...xh(s),heycatch_custom_user_event:!0})}}function wh(e,t){!fs()||!Mt()||!e&&!t||ht.setPersonProperties(e,t)}function xh(e){let t={};return e!=null&&e.set&&(t.$set=e.set),e!=null&&e.setOnce&&(t.$set_once=e.setOnce),t}var Eh={init:_h,resetIdentity:yh,setIdentity:mh,setPersonProperties:wh,trackEvent:bh};_a();Eh.init({projectKey:"hck_pk_1rTo-2VQ5CyFIKSa9kOfMD6o3mBTwLCW",install:{framework:"vite-react",frameworkVersion:"6",agent:"claude-code"}});export{Eh as E};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.