File: //opt/netdata/usr/local/share/netdata/web/v3/5476.2fd8c4579d0442dc0ecf.chunk.js
try{!function(){var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="34bc5de3-f5a5-4146-99c0-74036d943a23",e._sentryDebugIdIdentifier="sentry-dbid-34bc5de3-f5a5-4146-99c0-74036d943a23")}()}catch(e){}!function(){try{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{}).SENTRY_RELEASE={id:"71e6cd07d3b7cc35c33cc0937670fa3dc3e40c07"}}catch(e){}}(),(self.webpackChunkcloud_frontend=self.webpackChunkcloud_frontend||[]).push([[5476],{55476:(e,t,i)=>{i.d(t,{default:()=>pa});var r="undefined"!=typeof window?window:void 0,s="undefined"!=typeof globalThis?globalThis:r,n=Array.prototype,a=n.forEach,o=n.indexOf,l=null==s?void 0:s.navigator,c=null==s?void 0:s.document,u=null==s?void 0:s.location,h=null==s?void 0:s.fetch,d=null!=s&&s.XMLHttpRequest&&"withCredentials"in new s.XMLHttpRequest?s.XMLHttpRequest:void 0,p=null==s?void 0:s.AbortController,g=null==l?void 0:l.userAgent,v=null!=r?r:{},_={DEBUG:!1,LIB_VERSION:"1.278.0"};function f(e,t,i,r,s,n,a){try{var o=e[n](a),l=o.value}catch(e){return void i(e)}o.done?t(l):Promise.resolve(l).then(r,s)}function m(e){return function(){var t=this,i=arguments;return new Promise((function(r,s){var n=e.apply(t,i);function a(e){f(n,r,s,a,o,"next",e)}function o(e){f(n,r,s,a,o,"throw",e)}a(void 0)}))}}function y(){return y=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},y.apply(null,arguments)}function b(e,t){if(null==e)return{};var i={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;i[r]=e[r]}return i}var w=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"];function E(e,t){return-1!==e.indexOf(t)}var x=function(e){return e.trim()},k=function(e){return e.replace(/^\$/,"")},S=Array.isArray,P=Object.prototype,$=P.hasOwnProperty,I=P.toString,F=S||function(e){return"[object Array]"===I.call(e)},O=e=>"function"==typeof e,R=e=>e===Object(e)&&!F(e),C=e=>{if(R(e)){for(var t in e)if($.call(e,t))return!1;return!0}return!1},T=e=>void 0===e,A=e=>"[object String]"==I.call(e),M=e=>A(e)&&0===e.trim().length,D=e=>null===e,L=e=>T(e)||D(e),N=e=>"[object Number]"==I.call(e),j=e=>"[object Boolean]"===I.call(e),q=e=>E(w,e);function U(e){return null===e||"object"!=typeof e}function H(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"}function G(e){return!T(Event)&&function(e,t){try{return e instanceof t}catch(e){return!1}}(e,Event)}var B=[!0,"true",1,"1","yes"],W=e=>E(B,e),V=[!1,"false",0,"0","no"];function z(e,t,i,r,s){return t>i&&(r.warn("min cannot be greater than max."),t=i),N(e)?e>i?(r.warn(" cannot be greater than max: "+i+". Using max value instead."),i):e<t?(r.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(r.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+s),z(s||i,t,i,r))}class Y{constructor(e){this.t=e,this.i={},this.o=()=>{Object.keys(this.i).forEach((e=>{var t=this.h(e)+this.m;t>=this.S?delete this.i[e]:this.$(e,t)}))},this.h=e=>this.i[String(e)],this.$=(e,t)=>{this.i[String(e)]=t},this.consumeRateLimit=e=>{var t,i,r=null!==(t=this.h(e))&&void 0!==t?t:this.S;if(0===(r=Math.max(r-1,0)))return!0;this.$(e,r);var s=0===r;return s&&(null==(i=this.k)||i.call(this,e)),s},this.k=this.t.k,this.S=z(this.t.bucketSize,0,100,this.t.P),this.m=z(this.t.refillRate,0,this.S,this.t.P),this.T=z(this.t.refillInterval,0,864e5,this.t.P),this.I=setInterval((()=>{this.o()}),this.T)}stop(){this.I&&(clearInterval(this.I),this.I=void 0)}}var X,J,K,Q=e=>e instanceof Error;function Z(e){var t=globalThis._posthogChunkIds;if(t){var i=Object.keys(t);return K&&i.length===J||(J=i.length,K=i.reduce(((i,r)=>{X||(X={});var s=X[r];if(s)i[s[0]]=s[1];else for(var n=e(r),a=n.length-1;a>=0;a--){var o=n[a],l=null==o?void 0:o.filename,c=t[r];if(l&&c){i[l]=c,X[r]=[l,c];break}}return i}),{})),K}}var ee="?";function te(e,t,i,r){var s={platform:"web:javascript",filename:e,function:"<anonymous>"===t?ee:t,in_app:!0};return T(i)||(s.lineno=i),T(r)||(s.colno=r),s}var ie=(e,t)=>{var i=-1!==e.indexOf("safari-extension"),r=-1!==e.indexOf("safari-web-extension");return i||r?[-1!==e.indexOf("@")?e.split("@")[0]:ee,i?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},re=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,se=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,ne=/\((\S*)(?::(\d+))(?::(\d+))\)/,ae=e=>{var t=re.exec(e);if(t){var[,i,r,s]=t;return te(i,ee,+r,+s)}var n=se.exec(e);if(n){if(n[2]&&0===n[2].indexOf("eval")){var a=ne.exec(n[2]);a&&(n[2]=a[1],n[3]=a[2],n[4]=a[3])}var[o,l]=ie(n[1]||ee,n[2]);return te(l,o,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}},oe=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,le=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,ce=e=>{var t=oe.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var i=le.exec(t[3]);i&&(t[1]=t[1]||"eval",t[3]=i[1],t[4]=i[2],t[5]="")}var r=t[3],s=t[1]||ee;return[s,r]=ie(s,r),te(r,s,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},ue=/\(error: (.*)\)/;class he{constructor(e,t,i){void 0===e&&(e=[]),void 0===t&&(t=[]),void 0===i&&(i=[]),this.coercers=e,this.modifiers=i,this.stackParser=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return function(e,i){void 0===i&&(i=0);for(var r=[],s=e.split("\n"),n=i;n<s.length;n++){var a=s[n];if(!(a.length>1024)){var o=ue.test(a)?a.replace(ue,"$1"):a;if(!o.match(/\S*Error: /)){for(var l of t){var c=l(o);if(c){r.push(c);break}}if(r.length>=50)break}}}return function(e){if(!e.length)return[];var t=Array.from(e);return t.reverse(),t.slice(0,50).map((e=>{return y({},e,{filename:e.filename||(i=t,i[i.length-1]||{}).filename,function:e.function||ee});var i}))}(r)}}(...t)}buildFromUnknown(e,t){void 0===t&&(t={});var i=t&&t.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(i,t,0).apply(e),s=this.buildParsingContext(),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,i),$exception_level:"error"}}modifyFrames(e){var t=this;return m((function*(){for(var i of e)i.stacktrace&&i.stacktrace.frames&&F(i.stacktrace.frames)&&(i.stacktrace.frames=yield t.applyModifiers(i.stacktrace.frames));return e}))()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:null==(t=e.syntheticException)?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var i,r;return null!=e.cause&&(i=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack&&(r=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?1:0),t.chunkIdMap)),y({},e,{cause:i,stack:r})}applyChunkIds(e,t){return e.map((e=>(e.filename&&t&&(e.chunk_id=t[e.filename]),e)))}applyCoercers(e,t){for(var i of this.coercers)if(i.match(e))return i.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return m((function*(){var i=e;for(var r of t.modifiers)i=yield r(i);return i}))()}convertToExceptionList(e,t){var i,r,s,n={type:e.type,value:e.value,mechanism:{type:null!==(i=t.type)&&void 0!==i?i:"generic",handled:null===(r=t.handled)||void 0===r||r,synthetic:null!==(s=e.synthetic)&&void 0!==s&&s}};e.stack&&(n.stacktrace={type:"raw",frames:e.stack});var a=[n];return null!=e.cause&&a.push(...this.convertToExceptionList(e.cause,y({},t,{handled:!0}))),a}buildParsingContext(){return{chunkIdMap:Z(this.stackParser)}}buildCoercingContext(e,t,i){void 0===i&&(i=0);var r=(i,r)=>{if(r<=4){var s=this.buildCoercingContext(e,t,r);return this.applyCoercers(i,s)}};return y({},t,{syntheticException:0==i?t.syntheticException:void 0,mechanism:e,apply:e=>r(e,i),next:e=>r(e,i+1)})}}class de{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var i=A(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:i?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?t+": "+e.message:t}isDOMException(e){return H(e,"DOMException")}isDOMError(e){return H(e,"DOMError")}}class pe{match(e){return(e=>e instanceof Error)(e)}coerce(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var i=e.message;return i.error&&"string"==typeof i.error.message?String(i.error.message):String(i)}getStack(e){return e.stacktrace||e.stack||void 0}}class ge{constructor(){}match(e){return H(e,"ErrorEvent")&&null!=e.error}coerce(e,t){var i;return t.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}var ve=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class _e{match(e){return"string"==typeof e}coerce(e,t){var i,[r,s]=this.getInfos(e);return{type:null!=r?r:"Error",value:null!=s?s:e,stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}getInfos(e){var t="Error",i=e,r=e.match(ve);return r&&(t=r[1],i=r[2]),[t,i]}}var fe=["fatal","error","warning","log","info","debug"];function me(e,t){void 0===t&&(t=40);var i=Object.keys(e);if(i.sort(),!i.length)return"[object has no keys]";for(var r=i.length;r>0;r--){var s=i.slice(0,r).join(", ");if(!(s.length>t))return r===i.length||s.length<=t?s:s.slice(0,t)+"..."}return""}class ye{match(e){return"object"==typeof e&&null!==e}coerce(e,t){var i,r=this.getErrorPropertyFromObject(e);return r?t.apply(r):{type:this.getType(e),value:this.getValue(e),stack:null==(i=t.syntheticException)?void 0:i.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return G(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&"string"==typeof e.name){var t="'"+e.name+"' captured as exception";return"message"in e&&"string"==typeof e.message&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&"string"==typeof e.message)return e.message;var i=this.getObjectClassName(e);return(i&&"Object"!==i?"'"+i+"'":"Object")+" captured as exception with keys: "+me(e)}isSeverityLevel(e){return A(e)&&!M(e)&&fe.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var i=e[t];if(Q(i))return i}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}}class be{match(e){return G(e)}coerce(e,t){var i,r=e.constructor.name;return{type:r,value:r+" captured as exception with keys: "+me(e),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}class we{match(e){return U(e)}coerce(e,t){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}class Ee{match(e){return H(e,"PromiseRejectionEvent")}coerce(e,t){var i,r=this.getUnhandledRejectionReason(e);return U(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}:t.apply(r)}getUnhandledRejectionReason(e){if(U(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch(e){}return e}}var xe=e=>{var t={R:function(t){if(r&&(_.DEBUG||v.POSTHOG_DEBUG)&&!T(r.console)&&r.console){for(var i=("__rrweb_original__"in r.console[t]?r.console[t].__rrweb_original__:r.console[t]),s=arguments.length,n=new Array(s>1?s-1:0),a=1;a<s;a++)n[a-1]=arguments[a];i(e,...n)}},info:function(){for(var e=arguments.length,i=new Array(e),r=0;r<e;r++)i[r]=arguments[r];t.R("log",...i)},warn:function(){for(var e=arguments.length,i=new Array(e),r=0;r<e;r++)i[r]=arguments[r];t.R("warn",...i)},error:function(){for(var e=arguments.length,i=new Array(e),r=0;r<e;r++)i[r]=arguments[r];t.R("error",...i)},critical:function(){for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];console.error(e,...i)},uninitializedWarning:e=>{t.error("You must initialize PostHog before calling "+e)},createLogger:t=>xe(e+" "+t)};return t},ke=xe("[PostHog.js]"),Se=ke.createLogger,Pe=Se("[ExternalScriptsLoader]"),$e=(e,t,i)=>{if(e.config.disable_external_dependency_loading)return Pe.warn(t+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var r=null==c?void 0:c.querySelectorAll("script");if(r)for(var s,n=function(){if(r[a].src===t){var e=r[a];return e.__posthog_loading_callback_fired?{v:i()}:(e.addEventListener("load",(t=>{e.__posthog_loading_callback_fired=!0,i(void 0,t)})),e.onerror=e=>i(e),{v:void 0})}},a=0;a<r.length;a++)if(s=n())return s.v;var o=()=>{if(!c)return i("document not found");var r=c.createElement("script");if(r.type="text/javascript",r.crossOrigin="anonymous",r.src=t,r.onload=e=>{r.__posthog_loading_callback_fired=!0,i(void 0,e)},r.onerror=e=>i(e),e.config.prepare_external_dependency_script&&(r=e.config.prepare_external_dependency_script(r)),!r)return i("prepare_external_dependency_script returned null");var s,n=c.querySelectorAll("body > script");n.length>0?null==(s=n[0].parentNode)||s.insertBefore(r,n[0]):c.body.appendChild(r)};null!=c&&c.body?o():null==c||c.addEventListener("DOMContentLoaded",o)};v.__PosthogExtensions__=v.__PosthogExtensions__||{},v.__PosthogExtensions__.loadExternalDependency=(e,t,i)=>{var r="/static/"+t+".js?v="+e.version;if("remote-config"===t&&(r="/array/"+e.config.token+"/config.js"),"toolbar"===t){var s=3e5;r=r+"&t="+Math.floor(Date.now()/s)*s}var n=e.requestRouter.endpointFor("assets",r);$e(e,n,i)},v.__PosthogExtensions__.loadSiteApp=(e,t,i)=>{var r=e.requestRouter.endpointFor("api",t);$e(e,r,i)};var Ie={};function Fe(e,t,i){if(F(e))if(a&&e.forEach===a)e.forEach(t,i);else if("length"in e&&e.length===+e.length)for(var r=0,s=e.length;r<s;r++)if(r in e&&t.call(i,e[r],r)===Ie)return}function Oe(e,t,i){if(!L(e)){if(F(e))return Fe(e,t,i);if((e=>e instanceof FormData)(e)){for(var r of e.entries())if(t.call(i,r[1],r[0])===Ie)return}else for(var s in e)if($.call(e,s)&&t.call(i,e[s],s)===Ie)return}}var Re=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];return Fe(i,(function(t){for(var i in t)void 0!==t[i]&&(e[i]=t[i])})),e},Ce=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];return Fe(i,(function(t){Fe(t,(function(t){e.push(t)}))})),e};function Te(e){for(var t=Object.keys(e),i=t.length,r=new Array(i);i--;)r[i]=[t[i],e[t[i]]];return r}var Ae=function(e){try{return e()}catch(e){return}},Me=function(e){return function(){try{for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return e.apply(this,i)}catch(e){ke.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),ke.critical(e)}}},De=function(e){var t={};return Oe(e,(function(e,i){(A(e)&&e.length>0||N(e))&&(t[i]=e)})),t};var Le=["herokuapp.com","vercel.app","netlify.app"];function Ne(e){var t=null==e?void 0:e.hostname;if(!A(t))return!1;var i=t.split(".").slice(-2).join(".");for(var r of Le)if(i===r)return!1;return!0}function je(e,t){for(var i=0;i<e.length;i++)if(t(e[i]))return e[i]}function qe(e,t,i,r){var{capture:s=!1,passive:n=!0}=null!=r?r:{};null==e||e.addEventListener(t,i,{capture:s,passive:n})}var Ue="$people_distinct_id",He="__alias",Ge="__timers",Be="$autocapture_disabled_server_side",We="$heatmaps_enabled_server_side",Ve="$exception_capture_enabled_server_side",ze="$error_tracking_suppression_rules",Ye="$error_tracking_capture_extension_exceptions",Xe="$web_vitals_enabled_server_side",Je="$dead_clicks_enabled_server_side",Ke="$web_vitals_allowed_metrics",Qe="$session_recording_remote_config",Ze="$sesid",et="$session_is_sampled",tt="$enabled_feature_flags",it="$early_access_features",rt="$feature_flag_details",st="$stored_person_properties",nt="$stored_group_properties",at="$surveys",ot="$surveys_activated",lt="$flag_call_reported",ct="$user_state",ut="$client_session_props",ht="$capture_rate_limit",dt="$initial_campaign_params",pt="$initial_referrer_info",gt="$initial_person_info",vt="$epp",_t="__POSTHOG_TOOLBAR__",ft="$posthog_cookieless",mt=[Ue,He,"__cmpns",Ge,"$session_recording_enabled_server_side",We,Ze,tt,ze,ct,it,rt,nt,st,at,lt,ut,ht,dt,pt,vt,gt];function yt(e){return e instanceof Element&&(e.id===_t||!(null==e.closest||!e.closest(".toolbar-global-fade-container")))}function bt(e){return!!e&&1===e.nodeType}function wt(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function Et(e){return!!e&&3===e.nodeType}function xt(e){return!!e&&11===e.nodeType}function kt(e){return e?x(e).split(/\s+/):[]}function St(e){var t=null==r?void 0:r.location.href;return!!(t&&e&&e.some((e=>t.match(e))))}function Pt(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 kt(t)}function $t(e){return L(e)?null:x(e).split(/(\s+)/).filter((e=>Bt(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function It(e){var t="";return Dt(e)&&!Lt(e)&&e.childNodes&&e.childNodes.length&&Oe(e.childNodes,(function(e){var i;Et(e)&&e.textContent&&(t+=null!==(i=$t(e.textContent))&&void 0!==i?i:"")})),x(t)}function Ft(e){return T(e.target)?e.srcElement||null:null!=(t=e.target)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var Ot=["a","button","form","input","select","textarea","label"];function Rt(e,t){if(T(t))return!0;var i,r=function(e){if(t.some((t=>e.matches(t))))return{v:!0}};for(var s of e)if(i=r(s))return i.v;return!1}function Ct(e){var t=e.parentNode;return!(!t||!bt(t))&&t}var Tt=[".ph-no-rageclick",".ph-no-capture"],At=e=>!e||wt(e,"html")||!bt(e),Mt=(e,t)=>{if(!r||At(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,s=[e],n=e;n.parentNode&&!wt(n,"body");)if(xt(n.parentNode))s.push(n.parentNode.host),n=n.parentNode.host;else{var a=Ct(n);if(!a)break;if(t||Ot.indexOf(a.tagName.toLowerCase())>-1)i=!0;else{var o=r.getComputedStyle(a);o&&"pointer"===o.getPropertyValue("cursor")&&(i=!0)}s.push(a),n=a}return{parentIsUsefulElement:i,targetElementList:s}};function Dt(e){for(var t=e;t.parentNode&&!wt(t,"body");t=t.parentNode){var i=Pt(t);if(E(i,"ph-sensitive")||E(i,"ph-no-capture"))return!1}if(E(Pt(e),"ph-include"))return!0;var r=e.type||"";if(A(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=e.name||e.id||"";return!A(s)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,""))}function Lt(e){return!!(wt(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||wt(e,"select")||wt(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var Nt="(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})",jt=new RegExp("^(?:"+Nt+")$"),qt=new RegExp(Nt),Ut="\\d{3}-?\\d{2}-?\\d{4}",Ht=new RegExp("^("+Ut+")$"),Gt=new RegExp("("+Ut+")");function Bt(e,t){if(void 0===t&&(t=!0),L(e))return!1;if(A(e)){if(e=x(e),(t?jt:qt).test((e||"").replace(/[- ]/g,"")))return!1;if((t?Ht:Gt).test(e))return!1}return!0}function Wt(e){var t=It(e);return Bt(t=(t+" "+Vt(e)).trim())?t:""}function Vt(e){var t="";return e&&e.childNodes&&e.childNodes.length&&Oe(e.childNodes,(function(e){var i;if(e&&"span"===(null==(i=e.tagName)?void 0:i.toLowerCase()))try{var r=It(e);t=(t+" "+r).trim(),e.childNodes&&e.childNodes.length&&(t=(t+" "+Vt(e)).trim())}catch(e){ke.error("[AutoCapture]",e)}})),t}function zt(e){return function(e){var t=e.map((e=>{var t,i,r="";if(e.tag_name&&(r+=e.tag_name),e.attr_class)for(var s of(e.attr_class.sort(),e.attr_class))r+="."+s.replace(/"/g,"");var n=y({},e.text?{text:e.text}:{},{"nth-child":null!==(t=e.nth_child)&&void 0!==t?t:0,"nth-of-type":null!==(i=e.nth_of_type)&&void 0!==i?i:0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),a={};return Te(n).sort(((e,t)=>{var[i]=e,[r]=t;return i.localeCompare(r)})).forEach((e=>{var[t,i]=e;return a[Yt(t.toString())]=Yt(i.toString())})),(r+=":")+Te(a).map((e=>{var[t,i]=e;return t+'="'+i+'"'})).join("")}));return t.join(";")}(function(e){return e.map((e=>{var t,i,r={text:null==(t=e.$el_text)?void 0:t.slice(0,400),tag_name:e.tag_name,href:null==(i=e.attr__href)?void 0:i.slice(0,2048),attr_class:Xt(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return Te(e).filter((e=>{var[t]=e;return 0===t.indexOf("attr__")})).forEach((e=>{var[t,i]=e;return r.attributes[t]=i})),r}))}(e))}function Yt(e){return e.replace(/"|\\"/g,'\\"')}function Xt(e){var t=e.attr__class;return t?F(t)?t:kt(t):void 0}class Jt{constructor(){this.clicks=[]}isRageClick(e,t,i){var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(e-r.x)+Math.abs(t-r.y)<30&&i-r.timestamp<1e3){if(this.clicks.push({x:e,y:t,timestamp:i}),3===this.clicks.length)return!0}else this.clicks=[{x:e,y:t,timestamp:i}];return!1}}var Kt="$copy_autocapture",Qt=function(e){return e.GZipJS="gzip-js",e.Base64="base64",e}({}),Zt=e=>{var t=null==c?void 0:c.createElement("a");return T(t)?null:(t.href=e,t)},ei=function(e,t){for(var i,r=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;s<r.length;s++){var n=r[s].split("=");if(n[0]===t){i=n;break}}if(!F(i)||i.length<2)return"";var a=i[1];try{a=decodeURIComponent(a)}catch(e){ke.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},ti=function(e,t,i){if(!e||!t||!t.length)return e;for(var r=e.split("#"),s=r[0]||"",n=r[1],a=s.split("?"),o=a[1],l=a[0],c=(o||"").split("&"),u=[],h=0;h<c.length;h++){var d=c[h].split("=");F(d)&&(t.includes(d[0])?u.push(d[0]+"="+i):u.push(c[h]))}var p=l;return null!=o&&(p+="?"+u.join("&")),null!=n&&(p+="#"+n),p},ii=function(e,t){var i=e.match(new RegExp(t+"=([^&]*)"));return i?i[1]:null},ri=Se("[AutoCapture]");function si(e,t){return t.length>e?t.slice(0,e)+"...":t}function ni(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do{t=t.previousSibling}while(t&&!bt(t));return t}function ai(e,t){for(var i,s,{e:n,maskAllElementAttributes:a,maskAllText:o,elementAttributeIgnoreList:l,elementsChainAsString:c}=t,u=[e],h=e;h.parentNode&&!wt(h,"body");)xt(h.parentNode)?(u.push(h.parentNode.host),h=h.parentNode.host):(u.push(h.parentNode),h=h.parentNode);var d,p=[],g={},v=!1,_=!1;if(Oe(u,(e=>{var t=Dt(e);"a"===e.tagName.toLowerCase()&&(v=e.getAttribute("href"),v=t&&v&&Bt(v)&&v),E(Pt(e),"ph-no-capture")&&(_=!0),p.push(function(e,t,i,r){var s=e.tagName.toLowerCase(),n={tag_name:s};Ot.indexOf(s)>-1&&!i&&("a"===s.toLowerCase()||"button"===s.toLowerCase()?n.$el_text=si(1024,Wt(e)):n.$el_text=si(1024,It(e)));var a=Pt(e);a.length>0&&(n.classes=a.filter((function(e){return""!==e}))),Oe(e.attributes,(function(i){var s;if((!Lt(e)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==r||!r.includes(i.name))&&!t&&Bt(i.value)&&(s=i.name,!A(s)||"_ngcontent"!==s.substring(0,10)&&"_nghost"!==s.substring(0,7))){var a=i.value;"class"===i.name&&(a=kt(a).join(" ")),n["attr__"+i.name]=si(1024,a)}}));for(var o=1,l=1,c=e;c=ni(c);)o++,c.tagName===e.tagName&&l++;return n.nth_child=o,n.nth_of_type=l,n}(e,a,o,l));var i=function(e){if(!Dt(e))return{};var t={};return Oe(e.attributes,(function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){var i=e.name.replace("data-ph-capture-attribute-",""),r=e.value;i&&r&&Bt(r)&&(t[i]=r)}})),t}(e);Re(g,i)})),_)return{props:{},explicitNoCapture:_};if(o||("a"===e.tagName.toLowerCase()||"button"===e.tagName.toLowerCase()?p[0].$el_text=Wt(e):p[0].$el_text=It(e)),v){var f,m;p[0].attr__href=v;var y=null==(f=Zt(v))?void 0:f.host,b=null==r||null==(m=r.location)?void 0:m.host;y&&b&&y!==b&&(d=v)}return{props:Re({$event_type:n.type,$ce_version:1},c?{}:{$elements:p},{$elements_chain:zt(p)},null!=(i=p[0])&&i.$el_text?{$el_text:null==(s=p[0])?void 0:s.$el_text}:{},d&&"click"===n.type?{$external_click_url:d}:{},g)}}class oi{constructor(e){this.C=!1,this.O=null,this.rageclicks=new Jt,this.F=!1,this.instance=e,this.M=null}get A(){var e,t,i=R(this.instance.config.autocapture)?this.instance.config.autocapture:{};return i.url_allowlist=null==(e=i.url_allowlist)?void 0:e.map((e=>new RegExp(e))),i.url_ignorelist=null==(t=i.url_ignorelist)?void 0:t.map((e=>new RegExp(e))),i}j(){if(this.isBrowserSupported()){if(r&&c){var e=e=>{e=e||(null==r?void 0:r.event);try{this.D(e)}catch(r){ri.error("Failed to capture event",r)}};if(qe(c,"submit",e,{capture:!0}),qe(c,"change",e,{capture:!0}),qe(c,"click",e,{capture:!0}),this.A.capture_copied_text){var t=e=>{e=e||(null==r?void 0:r.event),this.D(e,Kt)};qe(c,"copy",t,{capture:!0}),qe(c,"cut",t,{capture:!0})}}}else ri.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.C&&(this.j(),this.C=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.F=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[Be]:!!e.autocapture_opt_out}),this.O=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.M=e}getElementSelectors(e){var t,i=[];return null==(t=this.M)||t.forEach((t=>{var r=null==c?void 0:c.querySelectorAll(t);null==r||r.forEach((r=>{e===r&&i.push(t)}))})),i}get isEnabled(){var e,t,i=null==(e=this.instance.persistence)?void 0:e.props[Be],r=this.O;if(D(r)&&!j(i)&&!this.instance.L())return!1;var s=null!==(t=this.O)&&void 0!==t?t:!!i;return!!this.instance.config.autocapture&&!s}D(e,t){if(void 0===t&&(t="$autocapture"),this.isEnabled){var i,s=Ft(e);Et(s)&&(s=s.parentNode||null),"$autocapture"===t&&"click"===e.type&&e instanceof MouseEvent&&this.instance.config.rageclick&&null!=(i=this.rageclicks)&&i.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&function(e,t){if(!r||At(e))return!1;var i,s;if(!1===(i=j(t)?!!t&&Tt:null!==(s=null==t?void 0:t.css_selector_ignorelist)&&void 0!==s?s:Tt))return!1;var{targetElementList:n}=Mt(e,!1);return!Rt(n,i)}(s,this.instance.config.rageclick)&&this.D(e,"$rageclick");var n=t===Kt;if(s&&function(e,t,i,s,n){var a,o,l,c;if(void 0===i&&(i=void 0),!r||At(e))return!1;if(null!=(a=i)&&a.url_allowlist&&!St(i.url_allowlist))return!1;if(null!=(o=i)&&o.url_ignorelist&&St(i.url_ignorelist))return!1;if(null!=(l=i)&&l.dom_event_allowlist){var u=i.dom_event_allowlist;if(u&&!u.some((e=>t.type===e)))return!1}var{parentIsUsefulElement:h,targetElementList:d}=Mt(e,s);if(!function(e,t){var i=null==t?void 0:t.element_allowlist;if(T(i))return!0;var r,s=function(e){if(i.some((t=>e.tagName.toLowerCase()===t)))return{v:!0}};for(var n of e)if(r=s(n))return r.v;return!1}(d,i))return!1;if(!Rt(d,null==(c=i)?void 0:c.css_selector_allowlist))return!1;var p=r.getComputedStyle(e);if(p&&"pointer"===p.getPropertyValue("cursor")&&"click"===t.type)return!0;var g=e.tagName.toLowerCase();switch(g){case"html":return!1;case"form":return(n||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(t.type)>=0;default:return h?(n||["click"]).indexOf(t.type)>=0:(n||["click"]).indexOf(t.type)>=0&&(Ot.indexOf(g)>-1||"true"===e.getAttribute("contenteditable"))}}(s,e,this.A,n,n?["copy","cut"]:void 0)){var{props:a,explicitNoCapture:o}=ai(s,{e:e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.A.element_attribute_ignorelist,elementsChainAsString:this.F});if(o)return!1;var l=this.getElementSelectors(s);if(l&&l.length>0&&(a.$element_selectors=l),t===Kt){var c,u=$t(null==r||null==(c=r.getSelection())?void 0:c.toString()),h=e.type||"clipboard";if(!u)return!1;a.$selected_content=u,a.$copy_type=h}return this.instance.capture(t,a),!0}}}isBrowserSupported(){return O(null==c?void 0:c.querySelectorAll)}}Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return N(e)&&isFinite(e)&&Math.floor(e)===e});var li="0123456789abcdef";class ci{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,i,r){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(r)||e<0||t<0||i<0||r<0||e>0xffffffffffff||t>4095||i>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=e/Math.pow(2,40),s[1]=e/Math.pow(2,32),s[2]=e/Math.pow(2,24),s[3]=e/Math.pow(2,16),s[4]=e/Math.pow(2,8),s[5]=e,s[6]=112|t>>>8,s[7]=t,s[8]=128|i>>>24,s[9]=i>>>16,s[10]=i>>>8,s[11]=i,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new ci(s)}toString(){for(var e="",t=0;t<this.bytes.length;t++)e=e+li.charAt(this.bytes[t]>>>4)+li.charAt(15&this.bytes[t]),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new ci(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(var t=0;t<16;t++){var i=this.bytes[t]-e.bytes[t];if(0!==i)return Math.sign(i)}return 0}}class ui{constructor(){this.N=0,this.U=0,this.H=new pi}generate(){var e=this.generateOrAbort();if(T(e)){this.N=0;var t=this.generateOrAbort();if(T(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this.N)this.N=e,this.B();else{if(!(e+1e4>this.N))return;this.U++,this.U>4398046511103&&(this.N++,this.B())}return ci.fromFieldsV7(this.N,Math.trunc(this.U/Math.pow(2,30)),this.U&Math.pow(2,30)-1,this.H.nextUint32())}B(){this.U=1024*this.H.nextUint32()+(1023&this.H.nextUint32())}}var hi,di=e=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;t<e.length;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};r&&!T(r.crypto)&&crypto.getRandomValues&&(di=e=>crypto.getRandomValues(e));class pi{constructor(){this.q=new Uint32Array(8),this.W=1/0}nextUint32(){return this.W>=this.q.length&&(di(this.q),this.W=0),this.q[this.W++]}}var gi=()=>vi().toString(),vi=()=>(hi||(hi=new ui)).generate(),_i="",fi=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var mi={G:()=>!!c,V:function(e){ke.error("cookieStore error: "+e)},J:function(e){if(c){try{for(var t=e+"=",i=c.cookie.split(";").filter((e=>e.length)),r=0;r<i.length;r++){for(var s=i[r];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(t))return decodeURIComponent(s.substring(t.length,s.length))}}catch(e){}return null}},K:function(e){var t;try{t=JSON.parse(mi.J(e))||{}}catch(e){}return t},Y:function(e,t,i,r,s){if(c)try{var n="",a="",o=function(e,t){if(t){var i=function(e,t){if(void 0===t&&(t=c),_i)return _i;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var i=e.split("."),r=Math.min(i.length,8),s="dmn_chk_"+gi();!_i&&r--;){var n=i.slice(r).join("."),a=s+"=1;domain=."+n+";path=/";t.cookie=a+";max-age=3",t.cookie.includes(s)&&(t.cookie=a+";max-age=0",_i=n)}return _i}(e);if(!i){var r=(e=>{var t=e.match(fi);return t?t[0]:""})(e);r!==i&&ke.info("Warning: cookie subdomain discovery mismatch",r,i),i=r}return i?"; domain=."+i:""}return""}(c.location.hostname,r);if(i){var l=new Date;l.setTime(l.getTime()+24*i*60*60*1e3),n="; expires="+l.toUTCString()}s&&(a="; secure");var u=e+"="+encodeURIComponent(JSON.stringify(t))+n+"; SameSite=Lax; path=/"+o+a;return u.length>3686.4&&ke.warn("cookieStore warning: large cookie, len="+u.length),c.cookie=u,u}catch(e){return}},X:function(e,t){if(null!=c&&c.cookie)try{mi.Y(e,"",-1,t)}catch(e){return}}},yi=null,bi={G:function(){if(!D(yi))return yi;var e=!0;if(T(r))e=!1;else try{var t="__mplssupport__";bi.Y(t,"xyz"),'"xyz"'!==bi.J(t)&&(e=!1),bi.X(t)}catch(r){e=!1}return e||ke.error("localStorage unsupported; falling back to cookie store"),yi=e,e},V:function(e){ke.error("localStorage error: "+e)},J:function(e){try{return null==r?void 0:r.localStorage.getItem(e)}catch(r){bi.V(r)}return null},K:function(e){try{return JSON.parse(bi.J(e))||{}}catch(e){}return null},Y:function(e,t){try{null==r||r.localStorage.setItem(e,JSON.stringify(t))}catch(r){bi.V(r)}},X:function(e){try{null==r||r.localStorage.removeItem(e)}catch(r){bi.V(r)}}},wi=["distinct_id",Ze,et,vt,gt],Ei=y({},bi,{K:function(e){try{var t={};try{t=mi.K(e)||{}}catch(e){}var i=Re(t,JSON.parse(bi.J(e)||"{}"));return bi.Y(e,i),i}catch(e){}return null},Y:function(e,t,i,r,s,n){try{bi.Y(e,t,void 0,void 0,n);var a={};wi.forEach((e=>{t[e]&&(a[e]=t[e])})),Object.keys(a).length&&mi.Y(e,a,i,r,s,n)}catch(e){bi.V(e)}},X:function(e,t){try{null==r||r.localStorage.removeItem(e),mi.X(e,t)}catch(r){bi.V(r)}}}),xi={},ki={G:function(){return!0},V:function(e){ke.error("memoryStorage error: "+e)},J:function(e){return xi[e]||null},K:function(e){return xi[e]||null},Y:function(e,t){xi[e]=t},X:function(e){delete xi[e]}},Si=null,Pi={G:function(){if(!D(Si))return Si;if(Si=!0,T(r))Si=!1;else try{var e="__support__";Pi.Y(e,"xyz"),'"xyz"'!==Pi.J(e)&&(Si=!1),Pi.X(e)}catch(r){Si=!1}return Si},V:function(e){ke.error("sessionStorage error: ",e)},J:function(e){try{return null==r?void 0:r.sessionStorage.getItem(e)}catch(r){Pi.V(r)}return null},K:function(e){try{return JSON.parse(Pi.J(e))||null}catch(e){}return null},Y:function(e,t){try{null==r||r.sessionStorage.setItem(e,JSON.stringify(t))}catch(r){Pi.V(r)}},X:function(e){try{null==r||r.sessionStorage.removeItem(e)}catch(r){Pi.V(r)}}},$i=function(e){return e[e.PENDING=-1]="PENDING",e[e.DENIED=0]="DENIED",e[e.GRANTED=1]="GRANTED",e}({});class Ii{constructor(e){this._instance=e}get A(){return this._instance.config}get consent(){return this.Z()?$i.DENIED:this.tt}isOptedOut(){return"always"===this.A.cookieless_mode||this.consent===$i.DENIED||this.consent===$i.PENDING&&(this.A.opt_out_capturing_by_default||"on_reject"===this.A.cookieless_mode)}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===$i.DENIED}optInOut(e){this.it.Y(this.et,e?1:0,this.A.cookie_expiration,this.A.cross_subdomain_cookie,this.A.secure_cookie)}reset(){this.it.X(this.et,this.A.cross_subdomain_cookie)}get et(){var{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:i}=this._instance.config;return i||(t?t+e:"__ph_opt_in_out_"+e)}get tt(){var e=this.it.J(this.et);return W(e)?$i.GRANTED:E(V,e)?$i.DENIED:$i.PENDING}get it(){if(!this.rt){var e=this.A.opt_out_capturing_persistence_type;this.rt="localStorage"===e?bi:mi;var t="localStorage"===e?mi:bi;t.J(this.et)&&(this.rt.J(this.et)||this.optInOut(W(t.J(this.et))),t.X(this.et,this.A.cross_subdomain_cookie))}return this.rt}Z(){return!!this.A.respect_dnt&&!!je([null==l?void 0:l.doNotTrack,null==l?void 0:l.msDoNotTrack,v.doNotTrack],(e=>W(e)))}}var Fi=Se("[Dead Clicks]"),Oi=()=>!0,Ri=e=>{var t,i=!(null==(t=e.instance.persistence)||!t.get_property(Je)),r=e.instance.config.capture_dead_clicks;return j(r)?r:i};class Ci{get lazyLoadedDeadClicksAutocapture(){return this.st}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabled()}onRemoteConfig(e){this.instance.persistence&&this.instance.persistence.register({[Je]:null==e?void 0:e.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.nt((()=>{this.ot()}))}nt(e){var t,i;null!=(t=v.__PosthogExtensions__)&&t.initDeadClicksAutocapture&&e(),null==(i=v.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(t=>{t?Fi.error("failed to load script",t):e()}))}ot(){var e;if(c){if(!this.st&&null!=(e=v.__PosthogExtensions__)&&e.initDeadClicksAutocapture){var t=R(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.st=v.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.st.start(c),Fi.info("starting...")}}else Fi.error("`document` not found. Cannot start.")}stop(){this.st&&(this.st.stop(),this.st=void 0,Fi.info("stopping..."))}}var Ti=Se("[ExceptionAutocapture]");class Ai{constructor(e){var t,i,s;this.lt=()=>{var e;if(r&&this.isEnabled&&null!=(e=v.__PosthogExtensions__)&&e.errorWrappingFunctions){var t=v.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=v.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=v.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.ut&&this.A.capture_unhandled_errors&&(this.ut=t(this.captureException.bind(this))),!this.ht&&this.A.capture_unhandled_rejections&&(this.ht=i(this.captureException.bind(this))),!this.dt&&this.A.capture_console_errors&&(this.dt=s(this.captureException.bind(this)))}catch(r){Ti.error("failed to start",r),this.vt()}}},this._instance=e,this.ct=!(null==(t=this._instance.persistence)||!t.props[Ve]),this.A=this.ft(),this.gt=new Y({refillRate:null!==(i=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)&&void 0!==i?i:1,bucketSize:null!==(s=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)&&void 0!==s?s:10,refillInterval:1e4,P:Ti}),this.startIfEnabled()}ft(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return R(e)?t=y({},t,e):(T(e)?this.ct:e)&&(t=y({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.A.capture_console_errors||this.A.capture_unhandled_errors||this.A.capture_unhandled_rejections}startIfEnabled(){this.isEnabled&&(Ti.info("enabled"),this.nt(this.lt))}nt(e){var t,i;null!=(t=v.__PosthogExtensions__)&&t.errorWrappingFunctions&&e(),null==(i=v.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",(t=>{if(t)return Ti.error("failed to load script",t);e()}))}vt(){var e,t,i;null==(e=this.ut)||e.call(this),this.ut=void 0,null==(t=this.ht)||t.call(this),this.ht=void 0,null==(i=this.dt)||i.call(this),this.dt=void 0}onRemoteConfig(e){var t=e.autocaptureExceptions;this.ct=!!t||!1,this.A=this.ft(),this._instance.persistence&&this._instance.persistence.register({[Ve]:this.ct}),this.startIfEnabled()}captureException(e){var t,i,r=null!==(t=null==e||null==(i=e.$exception_list)||null==(i=i[0])?void 0:i.type)&&void 0!==t?t:"Exception";this.gt.consumeRateLimit(r)?Ti.info("Skipping exception capture because of client rate limiting.",{exception:r}):this._instance.exceptions.sendExceptionEvent(e)}}function Mi(e,t,i){try{if(!(t in e))return()=>{};var r=e[t],s=i(r);return O(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=s,()=>{e[t]=r}}catch(e){return()=>{}}}class Di{constructor(e){var t;this._instance=e,this._t=(null==r||null==(t=r.location)?void 0:t.pathname)||""}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(ke.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.yt&&this.yt(),this.yt=void 0,ke.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(r&&r.history){var i=this;null!=(e=r.history.pushState)&&e.__posthog_wrapped__||Mi(r.history,"pushState",(e=>function(t,r,s){e.call(this,t,r,s),i.bt("pushState")})),null!=(t=r.history.replaceState)&&t.__posthog_wrapped__||Mi(r.history,"replaceState",(e=>function(t,r,s){e.call(this,t,r,s),i.bt("replaceState")})),this.wt()}}bt(e){try{var t,i=null==r||null==(t=r.location)?void 0:t.pathname;if(!i)return;i!==this._t&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:e}),this._t=i}catch(r){ke.error("Error capturing "+e+" pageview",r)}}wt(){if(!this.yt){var e=()=>{this.bt("popstate")};qe(r,"popstate",e),this.yt=()=>{r&&r.removeEventListener("popstate",e)}}}}var Li=Se("[SegmentIntegration]");var Ni="posthog-js";function ji(e,t){var{organization:i,projectId:r,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:a=!0}=void 0===t?{}:t;return t=>{var o,l,c,u,h;if("*"!==n&&!n.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var d=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());t.tags["PostHog Person URL"]=d,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var p=(null==(o=t.exception)?void 0:o.values)||[],g=p.map((e=>y({},e,{stacktrace:e.stacktrace?y({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map((e=>y({},e,{platform:"web:javascript"})))}):void 0}))),v={$exception_message:(null==(l=p[0])?void 0:l.value)||t.message,$exception_type:null==(c=p[0])?void 0:c.type,$exception_level:t.level,$exception_list:g,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(u=p[0])?void 0:u.value)||t.message,$sentry_exception_type:null==(h=p[0])?void 0:h.type,$sentry_tags:t.tags};return i&&r&&(v.$sentry_url=(s||"https://sentry.io/organizations/")+i+"/issues/?project="+r+"&query="+t.event_id),a&&e.exceptions.sendExceptionEvent(v),t}}class qi{constructor(e,t,i,r,s,n){this.name=Ni,this.setupOnce=function(a){a(ji(e,{organization:t,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}var Ui=null!=r&&r.location?ii(r.location.hash,"__posthog")||ii(location.hash,"state"):null,Hi="_postHogToolbarParams",Gi=Se("[Toolbar]"),Bi=function(e){return e[e.UNINITIALIZED=0]="UNINITIALIZED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED",e}(Bi||{});class Wi{constructor(e){this.instance=e}xt(e){v.ph_toolbar_state=e}St(){var e;return null!==(e=v.ph_toolbar_state)&&void 0!==e?e:Bi.UNINITIALIZED}maybeLoadToolbar(e,t,i){if(void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===i&&(i=void 0),!r||!c)return!1;e=null!=e?e:r.location,i=null!=i?i:r.history;try{if(!t){try{r.localStorage.setItem("test","test"),r.localStorage.removeItem("test")}catch(r){return!1}t=null==r?void 0:r.localStorage}var s,n=Ui||ii(e.hash,"__posthog")||ii(e.hash,"state"),a=n?Ae((()=>JSON.parse(atob(decodeURIComponent(n)))))||Ae((()=>JSON.parse(decodeURIComponent(n)))):null;return a&&"ph_authorize"===a.action?((s=a).source="url",s&&Object.keys(s).length>0&&(a.desiredHash?e.hash=a.desiredHash:i?i.replaceState(i.state,"",e.pathname+e.search):e.hash="")):((s=JSON.parse(t.getItem(Hi)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token)&&(this.loadToolbar(s),!0)}catch(r){return!1}}Et(e){var t=v.ph_load_toolbar||v.ph_load_editor;!L(t)&&O(t)?t(e,this.instance):Gi.warn("No toolbar load function found")}loadToolbar(e){var t=!(null==c||!c.getElementById(_t));if(!r||t)return!1;var i="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=y({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},i?{instrument:!1}:{});if(r.localStorage.setItem(Hi,JSON.stringify(y({},s,{source:void 0}))),this.St()===Bi.LOADED)this.Et(s);else if(this.St()===Bi.UNINITIALIZED){var n;this.xt(Bi.LOADING),null==(n=v.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",(e=>{if(e)return Gi.error("[Toolbar] Failed to load",e),void this.xt(Bi.UNINITIALIZED);this.xt(Bi.LOADED),this.Et(s)})),qe(r,"turbolinks:load",(()=>{this.xt(Bi.UNINITIALIZED),this.loadToolbar(s)}))}return!0}$t(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,i){return void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===i&&(i=void 0),this.maybeLoadToolbar(e,t,i)}}var Vi=Se("[TracingHeaders]");class zi{constructor(e){this.kt=void 0,this.Pt=void 0,this.lt=()=>{var e,t;T(this.kt)&&(null==(e=v.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)||e._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),T(this.Pt)&&(null==(t=v.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)||t._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=e}nt(e){var t,i;null!=(t=v.__PosthogExtensions__)&&t.tracingHeadersPatchFns&&e(),null==(i=v.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",(t=>{if(t)return Vi.error("failed to load script",t);e()}))}startIfEnabledOrStop(){var e,t;this._instance.config.__add_tracing_headers?this.nt(this.lt):(null==(e=this.kt)||e.call(this),null==(t=this.Pt)||t.call(this),this.kt=void 0,this.Pt=void 0)}}var Yi="Mobile",Xi="iOS",Ji="Android",Ki="Tablet",Qi=Ji+" "+Ki,Zi="iPad",er="Apple",tr=er+" Watch",ir="Safari",rr="BlackBerry",sr="Samsung",nr=sr+"Browser",ar=sr+" Internet",or="Chrome",lr=or+" OS",cr=or+" "+Xi,ur="Internet Explorer",hr=ur+" "+Yi,dr="Opera",pr=dr+" Mini",gr="Edge",vr="Microsoft "+gr,_r="Firefox",fr=_r+" "+Xi,mr="Nintendo",yr="PlayStation",br="Xbox",wr=Ji+" "+Yi,Er=Yi+" "+ir,xr="Windows",kr=xr+" Phone",Sr="Nokia",Pr="Ouya",$r="Generic",Ir=$r+" "+Yi.toLowerCase(),Fr=$r+" "+Ki.toLowerCase(),Or="Konqueror",Rr="(\\d+(\\.\\d+)?)",Cr=new RegExp("Version/"+Rr),Tr=new RegExp(br,"i"),Ar=new RegExp(yr+" \\w+","i"),Mr=new RegExp(mr+" \\w+","i"),Dr=new RegExp(rr+"|PlayBook|BB10","i"),Lr={"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"},Nr=function(e,t){return t=t||"",E(e," OPR/")&&E(e,"Mini")?pr:E(e," OPR/")?dr:Dr.test(e)?rr:E(e,"IE"+Yi)||E(e,"WPDesktop")?hr:E(e,nr)?ar:E(e,gr)||E(e,"Edg/")?vr:E(e,"FBIOS")?"Facebook "+Yi:E(e,"UCWEB")||E(e,"UCBrowser")?"UC Browser":E(e,"CriOS")?cr:E(e,"CrMo")||E(e,or)?or:E(e,Ji)&&E(e,ir)?wr:E(e,"FxiOS")?fr:E(e.toLowerCase(),Or.toLowerCase())?Or:((e,t)=>t&&E(t,er)||function(e){return E(e,ir)&&!E(e,or)&&!E(e,Ji)}(e))(e,t)?E(e,Yi)?Er:ir:E(e,_r)?_r:E(e,"MSIE")||E(e,"Trident/")?ur:E(e,"Gecko")?_r:""},jr={[hr]:[new RegExp("rv:"+Rr)],[vr]:[new RegExp(gr+"?\\/"+Rr)],[or]:[new RegExp("("+or+"|CrMo)\\/"+Rr)],[cr]:[new RegExp("CriOS\\/"+Rr)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Rr)],[ir]:[Cr],[Er]:[Cr],[dr]:[new RegExp("(Opera|OPR)\\/"+Rr)],[_r]:[new RegExp(_r+"\\/"+Rr)],[fr]:[new RegExp("FxiOS\\/"+Rr)],[Or]:[new RegExp("Konqueror[:/]?"+Rr,"i")],[rr]:[new RegExp(rr+" "+Rr),Cr],[wr]:[new RegExp("android\\s"+Rr,"i")],[ar]:[new RegExp(nr+"\\/"+Rr)],[ur]:[new RegExp("(rv:|MSIE )"+Rr)],Mozilla:[new RegExp("rv:"+Rr)]},qr=function(e,t){var i=Nr(e,t),r=jr[i];if(T(r))return null;for(var s=0;s<r.length;s++){var n=r[s],a=e.match(n);if(a)return parseFloat(a[a.length-2])}return null},Ur=[[new RegExp(br+"; "+br+" (.*?)[);]","i"),e=>[br,e&&e[1]||""]],[new RegExp(mr,"i"),[mr,""]],[new RegExp(yr,"i"),[yr,""]],[Dr,[rr,""]],[new RegExp(xr,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[kr,""];if(new RegExp(Yi).test(t)&&!/IEMobile\b/.test(t))return[xr+" "+Yi,""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var r=i[1],s=Lr[r]||"";return/arm/i.test(t)&&(s="RT"),[xr,s]}return[xr,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){var t=[e[3],e[4],e[5]||"0"];return[Xi,t.join(".")]}return[Xi,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=T(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+Ji+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Ji+")","i"),e=>{if(e&&e[2]){var t=[e[2],e[3],e[4]||"0"];return[Ji,t.join(".")]}return[Ji,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];if(e&&e[1]){var i=[e[1],e[2],e[3]||"0"];t[1]=i.join(".")}return t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[lr,""]],[/Linux|debian/i,["Linux",""]]],Hr=function(e){return Mr.test(e)?mr:Ar.test(e)?yr:Tr.test(e)?br:new RegExp(Pr,"i").test(e)?Pr:new RegExp("("+kr+"|WPDesktop)","i").test(e)?kr:/iPad/.test(e)?Zi:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?tr:Dr.test(e)?rr:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Sr,"i").test(e)?Sr:/(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(Yi).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)?Ji:Qi:Ji:new RegExp("(pda|"+Yi+")","i").test(e)?Ir:new RegExp(Ki,"i").test(e)&&!new RegExp(Ki+" pc","i").test(e)?Fr:""},Gr="https?://(.*)",Br=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Wr=Ce(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],Br),Vr="<masked>",zr=["li_fat_id"];function Yr(e,t,i){if(!c)return{};var r,s=t?Ce([],Br,i||[]):[],n=Xr(ti(c.URL,s,Vr),e),a=(r={},Oe(zr,(function(e){var t=mi.J(e);r[e]=t||null})),r);return Re(a,n)}function Xr(e,t){var i=Wr.concat(t||[]),r={};return Oe(i,(function(t){var i=ei(e,t);r[t]=i||null})),r}function Jr(e){var t=function(e){return e?0===e.search(Gr+"google.([^/?]*)")?"google":0===e.search(Gr+"bing.com")?"bing":0===e.search(Gr+"yahoo.com")?"yahoo":0===e.search(Gr+"duckduckgo.com")?"duckduckgo":null:null}(e),i="yahoo"!=t?"q":"p",r={};if(!D(t)){r.$search_engine=t;var s=c?ei(c.referrer,i):"";s.length&&(r.ph_keyword=s)}return r}function Kr(){return navigator.language||navigator.userLanguage}function Qr(){return(null==c?void 0:c.referrer)||"$direct"}function Zr(e,t){var i=e?Ce([],Br,t||[]):[],r=null==u?void 0:u.href.substring(0,1e3);return{r:Qr().substring(0,1e3),u:r?ti(r,i,Vr):void 0}}function es(e){var t,{r:i,u:r}=e,s={$referrer:i,$referring_domain:null==i?void 0:"$direct"==i?"$direct":null==(t=Zt(i))?void 0:t.host};if(r){s.$current_url=r;var n=Zt(r);s.$host=null==n?void 0:n.host,s.$pathname=null==n?void 0:n.pathname;var a=Xr(r);Re(s,a)}if(i){var o=Jr(i);Re(s,o)}return s}function ts(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(r){return}}function is(){try{return(new Date).getTimezoneOffset()}catch(r){return}}function rs(e,t){if(!g)return{};var i,s,n,a=e?Ce([],Br,t||[]):[],[o,l]=function(e){for(var t=0;t<Ur.length;t++){var[i,r]=Ur[t],s=i.exec(e),n=s&&(O(r)?r(s,e):r);if(n)return n}return["",""]}(g);return Re(De({$os:o,$os_version:l,$browser:Nr(g,navigator.vendor),$device:Hr(g),$device_type:(s=g,n=Hr(s),n===Zi||n===Qi||"Kobo"===n||"Kindle Fire"===n||n===Fr?Ki:n===mr||n===br||n===yr||n===Pr?"Console":n===tr?"Wearable":n?Yi:"Desktop"),$timezone:ts(),$timezone_offset:is()}),{$current_url:ti(null==u?void 0:u.href,a,Vr),$host:null==u?void 0:u.host,$pathname:null==u?void 0:u.pathname,$raw_user_agent:g.length>1e3?g.substring(0,997)+"...":g,$browser_version:qr(g,navigator.vendor),$browser_language:Kr(),$browser_language_prefix:(i=Kr(),"string"==typeof i?i.split("-")[0]:void 0),$screen_height:null==r?void 0:r.screen.height,$screen_width:null==r?void 0:r.screen.width,$viewport_height:null==r?void 0:r.innerHeight,$viewport_width:null==r?void 0:r.innerWidth,$lib:"web",$lib_version:_.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var ss=Se("[Web Vitals]"),ns=9e5;class as{constructor(e){var t;this.Tt=!1,this.C=!1,this.q={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.It=()=>{clearTimeout(this.Rt),0!==this.q.metrics.length&&(this._instance.capture("$web_vitals",this.q.metrics.reduce(((e,t)=>y({},e,{["$web_vitals_"+t.name+"_event"]:y({},t),["$web_vitals_"+t.name+"_value"]:t.value})),{})),this.q={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Ct=e=>{var t,i=null==(t=this._instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0);if(T(i))ss.error("Could not read session ID. Dropping metrics!");else{this.q=this.q||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var r=this.Ot();T(r)||(L(null==e?void 0:e.name)||L(null==e?void 0:e.value)?ss.error("Invalid metric received",e):this.Ft&&e.value>=this.Ft?ss.error("Ignoring metric with value >= "+this.Ft,e):(this.q.url!==r&&(this.It(),this.Rt=setTimeout(this.It,this.flushToCaptureTimeoutMs)),T(this.q.url)&&(this.q.url=r),this.q.firstMetricTimestamp=T(this.q.firstMetricTimestamp)?Date.now():this.q.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0),this.q.metrics.push(y({},e,{$current_url:r,$session_id:i.sessionId,$window_id:i.windowId,timestamp:Date.now()})),this.q.metrics.length===this.allowedMetrics.length&&this.It()))}},this.lt=()=>{var e,t,i,r,s=v.__PosthogExtensions__;T(s)||T(s.postHogWebVitalsCallbacks)||({onLCP:e,onCLS:t,onFCP:i,onINP:r}=s.postHogWebVitalsCallbacks),e&&t&&i&&r?(this.allowedMetrics.indexOf("LCP")>-1&&e(this.Ct.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&t(this.Ct.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this.Ct.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&r(this.Ct.bind(this)),this.C=!0):ss.error("web vitals callbacks not loaded - not starting")},this._instance=e,this.Tt=!(null==(t=this._instance.persistence)||!t.props[Xe]),this.startIfEnabled()}get allowedMetrics(){var e,t,i=R(this._instance.config.capture_performance)?null==(e=this._instance.config.capture_performance)?void 0:e.web_vitals_allowed_metrics:void 0;return T(i)?(null==(t=this._instance.persistence)?void 0:t.props[Ke])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(R(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get Ft(){var e=R(this._instance.config.capture_performance)&&N(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:ns;return 0<e&&e<=6e4?ns:e}get isEnabled(){var e=null==u?void 0:u.protocol;if("http:"!==e&&"https:"!==e)return ss.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=R(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:j(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return j(t)?t:this.Tt}startIfEnabled(){this.isEnabled&&!this.C&&(ss.info("enabled, starting..."),this.nt(this.lt))}onRemoteConfig(e){var t=R(e.capturePerformance)&&!!e.capturePerformance.web_vitals,i=R(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Xe]:t}),this._instance.persistence.register({[Ke]:i})),this.Tt=t,this.startIfEnabled()}nt(e){var t,i;null!=(t=v.__PosthogExtensions__)&&t.postHogWebVitalsCallbacks&&e(),null==(i=v.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"web-vitals",(t=>{t?ss.error("failed to load script",t):e()}))}Ot(){var e=r?r.location.href:void 0;if(e){var t=this._instance.config.mask_personal_data_properties,i=this._instance.config.custom_personal_data_properties,s=t?Ce([],Br,i||[]):[];return ti(e,s,Vr)}ss.error("Could not determine current URL")}}var os=Se("[Heatmaps]");function ls(e){return R(e)&&"clientX"in e&&"clientY"in e&&N(e.clientX)&&N(e.clientY)}class cs{constructor(e){var t;this.rageclicks=new Jt,this.Tt=!1,this.C=!1,this.Mt=null,this.instance=e,this.Tt=!(null==(t=this.instance.persistence)||!t.props[We])}get flushIntervalMilliseconds(){var e=5e3;return R(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(e=this.instance.config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return T(this.instance.config.capture_heatmaps)?T(this.instance.config.enable_heatmaps)?this.Tt:this.instance.config.enable_heatmaps:!1!==this.instance.config.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.C)return;os.info("starting..."),this.At(),this.Mt=setInterval(this.jt.bind(this),this.flushIntervalMilliseconds)}else{var e,t;clearInterval(null!==(e=this.Mt)&&void 0!==e?e:void 0),null==(t=this.Dt)||t.stop(),this.getAndClearBuffer()}}onRemoteConfig(e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[We]:t}),this.Tt=t,this.startIfEnabled()}getAndClearBuffer(){var e=this.q;return this.q=void 0,e}Lt(e){this.Nt(e.originalEvent,"deadclick")}At(){r&&c&&(qe(r,"beforeunload",this.jt.bind(this)),qe(c,"click",(e=>this.Nt(e||(null==r?void 0:r.event))),{capture:!0}),qe(c,"mousemove",(e=>this.Ut(e||(null==r?void 0:r.event))),{capture:!0}),this.Dt=new Ci(this.instance,Oi,this.Lt.bind(this)),this.Dt.startIfEnabled(),this.C=!0)}zt(e,t){var i=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),a=function(e,t,i){for(var s=e;s&&bt(s)&&!wt(s,"body");){if(s===i)return!1;if(E(t,null==r?void 0:r.getComputedStyle(s).position))return!0;s=Ct(s)}return!1}(Ft(e),["fixed","sticky"],n);return{x:e.clientX+(a?0:s),y:e.clientY+(a?0:i),target_fixed:a,type:t}}Nt(e,t){var i;if(void 0===t&&(t="click"),!yt(e.target)&&ls(e)){var r=this.zt(e,t);null!=(i=this.rageclicks)&&i.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&this.Ht(y({},r,{type:"rageclick"})),this.Ht(r)}}Ut(e){!yt(e.target)&&ls(e)&&(clearTimeout(this.Bt),this.Bt=setTimeout((()=>{this.Ht(this.zt(e,"mousemove"))}),500))}Ht(e){if(r){var t=r.location.href,i=this.instance.config.mask_personal_data_properties,s=this.instance.config.custom_personal_data_properties,n=i?Ce([],Br,s||[]):[],a=ti(t,n,Vr);this.q=this.q||{},this.q[a]||(this.q[a]=[]),this.q[a].push(e)}}jt(){this.q&&!C(this.q)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class us{constructor(e){this._instance=e}doPageView(e,t){var i,s=this.qt(e,t);return this.Wt={pathname:null!==(i=null==r?void 0:r.location.pathname)&&void 0!==i?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var t;return this.qt(e,null==(t=this.Wt)?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null==(e=this.Wt)?void 0:e.pageViewId}}qt(e,t){var i=this.Wt;if(!i)return{$pageview_id:t};var r={$pageview_id:t,$prev_pageview_id:i.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:n,lastScrollY:a,maxScrollY:o,maxContentHeight:l,lastContentY:c,maxContentY:u}=s;if(!(T(n)||T(a)||T(o)||T(l)||T(c)||T(u))){n=Math.ceil(n),a=Math.ceil(a),o=Math.ceil(o),l=Math.ceil(l),c=Math.ceil(c),u=Math.ceil(u);var h=n<=1?1:z(a/n,0,1,ke),d=n<=1?1:z(o/n,0,1,ke),p=l<=1?1:z(c/l,0,1,ke),g=l<=1?1:z(u/l,0,1,ke);r=Re(r,{$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:c,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:g})}}return i.pathname&&(r.$prev_pageview_pathname=i.pathname),i.timestamp&&(r.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),r}}var hs=Uint8Array,ds=Uint16Array,ps=Uint32Array,gs=new hs([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]),vs=new hs([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]),_s=new hs([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),fs=function(e,t){for(var i=new ds(31),r=0;r<31;++r)i[r]=t+=1<<e[r-1];var s=new ps(i[30]);for(r=1;r<30;++r)for(var n=i[r];n<i[r+1];++n)s[n]=n-i[r]<<5|r;return[i,s]},ms=fs(gs,2),ys=ms[0],bs=ms[1];ys[28]=258,bs[258]=28;for(var ws=fs(vs,0)[1],Es=new ds(32768),xs=0;xs<32768;++xs){var ks=(43690&xs)>>>1|(21845&xs)<<1;ks=(61680&(ks=(52428&ks)>>>2|(13107&ks)<<2))>>>4|(3855&ks)<<4,Es[xs]=((65280&ks)>>>8|(255&ks)<<8)>>>1}var Ss=function(e,t,i){for(var r=e.length,s=0,n=new ds(t);s<r;++s)++n[e[s]-1];var a,o=new ds(t);for(s=0;s<t;++s)o[s]=o[s-1]+n[s-1]<<1;if(i){a=new ds(1<<t);var l=15-t;for(s=0;s<r;++s)if(e[s])for(var c=s<<4|e[s],u=t-e[s],h=o[e[s]-1]++<<u,d=h|(1<<u)-1;h<=d;++h)a[Es[h]>>>l]=c}else for(a=new ds(r),s=0;s<r;++s)a[s]=Es[o[e[s]-1]++]>>>15-e[s];return a},Ps=new hs(288);for(xs=0;xs<144;++xs)Ps[xs]=8;for(xs=144;xs<256;++xs)Ps[xs]=9;for(xs=256;xs<280;++xs)Ps[xs]=7;for(xs=280;xs<288;++xs)Ps[xs]=8;var $s=new hs(32);for(xs=0;xs<32;++xs)$s[xs]=5;var Is=Ss(Ps,9,0),Fs=Ss($s,5,0),Os=function(e){return(e/8|0)+(7&e&&1)},Rs=function(e,t,i){(null==i||i>e.length)&&(i=e.length);var r=new(e instanceof ds?ds:e instanceof ps?ps:hs)(i-t);return r.set(e.subarray(t,i)),r},Cs=function(e,t,i){i<<=7&t;var r=t/8|0;e[r]|=i,e[r+1]|=i>>>8},Ts=function(e,t,i){i<<=7&t;var r=t/8|0;e[r]|=i,e[r+1]|=i>>>8,e[r+2]|=i>>>16},As=function(e,t){for(var i=[],r=0;r<e.length;++r)e[r]&&i.push({s:r,f:e[r]});var s=i.length,n=i.slice();if(!s)return[new hs(0),0];if(1==s){var a=new hs(i[0].s+1);return a[i[0].s]=1,[a,1]}i.sort((function(e,t){return e.f-t.f})),i.push({s:-1,f:25001});var o=i[0],l=i[1],c=0,u=1,h=2;for(i[0]={s:-1,f:o.f+l.f,l:o,r:l};u!=s-1;)o=i[i[c].f<i[h].f?c++:h++],l=i[c!=u&&i[c].f<i[h].f?c++:h++],i[u++]={s:-1,f:o.f+l.f,l:o,r:l};var d=n[0].s;for(r=1;r<s;++r)n[r].s>d&&(d=n[r].s);var p=new ds(d+1),g=Ms(i[u-1],p,0);if(g>t){r=0;var v=0,_=g-t,f=1<<_;for(n.sort((function(e,t){return p[t.s]-p[e.s]||e.f-t.f}));r<s;++r){var m=n[r].s;if(!(p[m]>t))break;v+=f-(1<<g-p[m]),p[m]=t}for(v>>>=_;v>0;){var y=n[r].s;p[y]<t?v-=1<<t-p[y]++-1:++r}for(;r>=0&&v;--r){var b=n[r].s;p[b]==t&&(--p[b],++v)}g=t}return[new hs(p),g]},Ms=function(e,t,i){return-1==e.s?Math.max(Ms(e.l,t,i+1),Ms(e.r,t,i+1)):t[e.s]=i},Ds=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new ds(++t),r=0,s=e[0],n=1,a=function(e){i[r++]=e},o=1;o<=t;++o)if(e[o]==s&&o!=t)++n;else{if(!s&&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(s),--n;n>6;n-=6)a(8304);n>2&&(a(n-3<<5|8208),n=0)}for(;n--;)a(s);n=1,s=e[o]}return[i.subarray(0,r),t]},Ls=function(e,t){for(var i=0,r=0;r<t.length;++r)i+=e[r]*t[r];return i},Ns=function(e,t,i){var r=i.length,s=Os(t+2);e[s]=255&r,e[s+1]=r>>>8,e[s+2]=255^e[s],e[s+3]=255^e[s+1];for(var n=0;n<r;++n)e[s+n+4]=i[n];return 8*(s+4+r)},js=function(e,t,i,r,s,n,a,o,l,c,u){Cs(t,u++,i),++s[256];for(var h=As(s,15),d=h[0],p=h[1],g=As(n,15),v=g[0],_=g[1],f=Ds(d),m=f[0],y=f[1],b=Ds(v),w=b[0],E=b[1],x=new ds(19),k=0;k<m.length;++k)x[31&m[k]]++;for(k=0;k<w.length;++k)x[31&w[k]]++;for(var S=As(x,7),P=S[0],$=S[1],I=19;I>4&&!P[_s[I-1]];--I);var F,O,R,C,T=c+5<<3,A=Ls(s,Ps)+Ls(n,$s)+a,M=Ls(s,d)+Ls(n,v)+a+14+3*I+Ls(x,P)+(2*x[16]+3*x[17]+7*x[18]);if(T<=A&&T<=M)return Ns(t,u,e.subarray(l,l+c));if(Cs(t,u,1+(M<A)),u+=2,M<A){F=Ss(d,p,0),O=d,R=Ss(v,_,0),C=v;var D=Ss(P,$,0);for(Cs(t,u,y-257),Cs(t,u+5,E-1),Cs(t,u+10,I-4),u+=14,k=0;k<I;++k)Cs(t,u+3*k,P[_s[k]]);u+=3*I;for(var L=[m,w],N=0;N<2;++N){var j=L[N];for(k=0;k<j.length;++k){var q=31&j[k];Cs(t,u,D[q]),u+=P[q],q>15&&(Cs(t,u,j[k]>>>5&127),u+=j[k]>>>12)}}}else F=Is,O=Ps,R=Fs,C=$s;for(k=0;k<o;++k)if(r[k]>255){q=r[k]>>>18&31,Ts(t,u,F[q+257]),u+=O[q+257],q>7&&(Cs(t,u,r[k]>>>23&31),u+=gs[q]);var U=31&r[k];Ts(t,u,R[U]),u+=C[U],U>3&&(Ts(t,u,r[k]>>>5&8191),u+=vs[U])}else Ts(t,u,F[r[k]]),u+=O[r[k]];return Ts(t,u,F[256]),u+O[256]},qs=new ps([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Us=function(){for(var e=new ps(256),t=0;t<256;++t){for(var i=t,r=9;--r;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e}(),Hs=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};function Gs(e,t){void 0===t&&(t={});var i=function(){var e=4294967295;return{p:function(t){for(var i=e,r=0;r<t.length;++r)i=Us[255&i^t[r]]^i>>>8;e=i},d:function(){return 4294967295^e}}}(),r=e.length;i.p(e);var s,n=function(e,t,i,r){return function(e,t,i,r,s,n){var a=e.length,o=new hs(r+a+5*(1+Math.floor(a/7e3))+s),l=o.subarray(r,o.length-s),c=0;if(!t||a<8)for(var u=0;u<=a;u+=65535){var h=u+65535;h<a?c=Ns(l,c,e.subarray(u,h)):(l[u]=n,c=Ns(l,c,e.subarray(u,a)))}else{for(var d=qs[t-1],p=d>>>13,g=8191&d,v=(1<<i)-1,_=new ds(32768),f=new ds(v+1),m=Math.ceil(i/3),y=2*m,b=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<y)&v},w=new ps(25e3),E=new ds(288),x=new ds(32),k=0,S=0,P=(u=0,0),$=0,I=0;u<a;++u){var F=b(u),O=32767&u,R=f[F];if(_[O]=R,f[F]=O,$<=u){var C=a-u;if((k>7e3||P>24576)&&C>423){c=js(e,l,0,w,E,x,S,P,I,u-I,c),P=k=S=0,I=u;for(var T=0;T<286;++T)E[T]=0;for(T=0;T<30;++T)x[T]=0}var A=2,M=0,D=g,L=O-R&32767;if(C>2&&F==b(u-L))for(var N=Math.min(p,C)-1,j=Math.min(32767,u),q=Math.min(258,C);L<=j&&--D&&O!=R;){if(e[u+A]==e[u+A-L]){for(var U=0;U<q&&e[u+U]==e[u+U-L];++U);if(U>A){if(A=U,M=L,U>N)break;var H=Math.min(L,U-2),G=0;for(T=0;T<H;++T){var B=u-L+T+32768&32767,W=B-_[B]+32768&32767;W>G&&(G=W,R=B)}}}L+=(O=R)-(R=_[O])+32768&32767}if(M){w[P++]=268435456|bs[A]<<18|ws[M];var V=31&bs[A],z=31&ws[M];S+=gs[V]+vs[z],++E[257+V],++x[z],$=u+A,++k}else w[P++]=e[u],++E[e[u]]}}c=js(e,l,n,w,E,x,S,P,I,u-I,c)}return Rs(o,0,r+Os(c)+s)}(e,null==t.level?6:t.level,null==t.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,i,r,!0)}(e,t,10+((s=t).filename&&s.filename.length+1||0),8),a=n.length;return function(e,t){var i=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&Hs(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var r=0;r<=i.length;++r)e[r+10]=i.charCodeAt(r)}}(n,t),Hs(n,a-8,i.d()),Hs(n,a-4,r),n}var Bs=!!d||!!h,Ws="text/plain",Vs=(e,t)=>{var[i,r]=e.split("?"),s=y({},t);null==r||r.split("&").forEach((e=>{var[t]=e.split("=");delete s[t]}));var n=function(e,t){var i,r;void 0===t&&(t="&");var s=[];return Oe(e,(function(e,t){T(e)||T(t)||"undefined"===t||(i=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),r=encodeURIComponent(t),s[s.length]=r+"="+i)})),s.join(t)}(s);return i+"?"+(n?(r?r+"&":"")+n:r)},zs=(e,t)=>JSON.stringify(e,((e,t)=>"bigint"==typeof t?t.toString():t),t),Ys=e=>{var{data:t,compression:i}=e;if(t){if(i===Qt.GZipJS){var r=Gs(function(e){var t=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var i=new hs(e.length+(e.length>>>1)),r=0,s=function(e){i[r++]=e},n=0;n<t;++n){if(r+5>i.length){var a=new hs(r+8+(t-n<<1));a.set(i),i=a}var o=e.charCodeAt(n);o<128?s(o):o<2048?(s(192|o>>>6),s(128|63&o)):o>55295&&o<57344?(s(240|(o=65536+(1047552&o)|1023&e.charCodeAt(++n))>>>18),s(128|o>>>12&63),s(128|o>>>6&63),s(128|63&o)):(s(224|o>>>12),s(128|o>>>6&63),s(128|63&o))}return Rs(i,0,r)}(zs(t)),{mtime:0}),s=new Blob([r],{type:Ws});return{contentType:Ws,body:s,estimatedSize:s.size}}if(i===Qt.Base64){var n=function(e){var t,i,r,s,n,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o=0,l=0,c="",u=[];if(!e)return e;e=function(e){var t,i,r,s,n="";for(t=i=0,r=(e=(e+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,s=0;s<r;s++){var a=e.charCodeAt(s),o=null;a<128?i++:o=a>127&&a<2048?String.fromCharCode(a>>6|192,63&a|128):String.fromCharCode(a>>12|224,a>>6&63|128,63&a|128),D(o)||(i>t&&(n+=e.substring(t,i)),n+=o,t=i=s+1)}return i>t&&(n+=e.substring(t,e.length)),n}(e);do{t=(n=e.charCodeAt(o++)<<16|e.charCodeAt(o++)<<8|e.charCodeAt(o++))>>18&63,i=n>>12&63,r=n>>6&63,s=63&n,u[l++]=a.charAt(t)+a.charAt(i)+a.charAt(r)+a.charAt(s)}while(o<e.length);switch(c=u.join(""),e.length%3){case 1:c=c.slice(0,-2)+"==";break;case 2:c=c.slice(0,-1)+"="}return c}(zs(t)),a=(e=>"data="+encodeURIComponent("string"==typeof e?e:zs(e)))(n);return{contentType:"application/x-www-form-urlencoded",body:a,estimatedSize:new Blob([a]).size}}var o=zs(t);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},Xs=[];h&&Xs.push({transport:"fetch",method:e=>{var t,i,{contentType:r,body:s,estimatedSize:n}=null!==(t=Ys(e))&&void 0!==t?t:{},a=new Headers;Oe(e.headers,(function(e,t){a.append(t,e)})),r&&a.append("Content-Type",r);var o=e.url,l=null;if(p){var c=new p;l={signal:c.signal,timeout:setTimeout((()=>c.abort()),e.timeout)}}h(o,y({method:(null==e?void 0:e.method)||"GET",headers:a,keepalive:"POST"===e.method&&(n||0)<52428.8,body:s,signal:null==(i=l)?void 0:i.signal},e.fetchOptions)).then((t=>t.text().then((i=>{var r={statusCode:t.status,text:i};if(200===t.status)try{r.json=JSON.parse(i)}catch(e){ke.error(e)}null==e.callback||e.callback(r)})))).catch((t=>{ke.error(t),null==e.callback||e.callback({statusCode:0,text:t})})).finally((()=>l?clearTimeout(l.timeout):null))}}),d&&Xs.push({transport:"XHR",method:e=>{var t,i=new d;i.open(e.method||"GET",e.url,!0);var{contentType:r,body:s}=null!==(t=Ys(e))&&void 0!==t?t:{};Oe(e.headers,(function(e,t){i.setRequestHeader(t,e)})),r&&i.setRequestHeader("Content-Type",r),e.timeout&&(i.timeout=e.timeout),e.disableXHRCredentials||(i.withCredentials=!0),i.onreadystatechange=()=>{if(4===i.readyState){var t={statusCode:i.status,text:i.responseText};if(200===i.status)try{t.json=JSON.parse(i.responseText)}catch(e){}null==e.callback||e.callback(t)}},i.send(s)}}),null!=l&&l.sendBeacon&&Xs.push({transport:"sendBeacon",method:e=>{var t=Vs(e.url,{beacon:"1"});try{var i,{contentType:r,body:s}=null!==(i=Ys(e))&&void 0!==i?i:{},n="string"==typeof s?new Blob([s],{type:r}):s;l.sendBeacon(t,n)}catch(e){}}});var Js=function(e,t){if(!function(e){try{new RegExp(e)}catch(e){return!1}return!0}(t))return!1;try{return new RegExp(t).test(e)}catch(e){return!1}};function Ks(e,t,i){return zs({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}var Qs={exact:(e,t)=>t.some((t=>e.some((e=>t===e)))),is_not:(e,t)=>t.every((t=>e.every((e=>t!==e)))),regex:(e,t)=>t.some((t=>e.some((e=>Js(t,e))))),not_regex:(e,t)=>t.every((t=>e.every((e=>!Js(t,e))))),icontains:(e,t)=>t.map(Zs).some((t=>e.map(Zs).some((e=>t.includes(e))))),not_icontains:(e,t)=>t.map(Zs).every((t=>e.map(Zs).every((e=>!t.includes(e)))))},Zs=e=>e.toLowerCase(),en=Se("[Error tracking]");class tn{constructor(e){var t,i;this.Gt=[],this.Vt=new he([new de,new Ee,new ge,new pe,new be,new ye,new _e,new we],[ae,ce]),this._instance=e,this.Gt=null!==(t=null==(i=this._instance.persistence)?void 0:i.get_property(ze))&&void 0!==t?t:[]}onRemoteConfig(e){var t,i,r,s=null!==(t=null==(i=e.errorTracking)?void 0:i.suppressionRules)&&void 0!==t?t:[],n=null==(r=e.errorTracking)?void 0:r.captureExtensionExceptions;this.Gt=s,this._instance.persistence&&this._instance.persistence.register({[ze]:this.Gt,[Ye]:n})}get Jt(){var e,t=!!this._instance.get_property(Ye),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(e=null!=i?i:t)&&void 0!==e&&e}buildProperties(e,t){return this.Vt.buildFromUnknown(e,{syntheticException:null==t?void 0:t.syntheticException,mechanism:{handled:null==t?void 0:t.handled}})}sendExceptionEvent(e){if(this.Kt(e))en.info("Skipping exception capture because a suppression rule matched");else{if(this.Jt||!this.Yt(e))return this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"});en.info("Skipping exception capture because it was thrown by an extension")}}Kt(e){var t=e.$exception_list;if(!t||!F(t)||0===t.length)return!1;var i=t.reduce(((e,t)=>{var{type:i,value:r}=t;return A(i)&&i.length>0&&e.$exception_types.push(i),A(r)&&r.length>0&&e.$exception_values.push(r),e}),{$exception_types:[],$exception_values:[]});return this.Gt.some((e=>{var t=e.values.map((e=>{var t,r=Qs[e.operator],s=F(e.value)?e.value:[e.value],n=null!==(t=i[e.key])&&void 0!==t?t:[];return s.length>0&&r(s,n)}));return"OR"===e.type?t.some(Boolean):t.every(Boolean)}))}Yt(e){var t=e.$exception_list;return!(!t||!F(t))&&t.flatMap((e=>{var t,i;return null!==(t=null==(i=e.stacktrace)?void 0:i.frames)&&void 0!==t?t:[]})).some((e=>e.filename&&e.filename.startsWith("chrome-extension://")))}}var rn=Se("[FeatureFlags]"),sn="$active_feature_flags",nn="$override_feature_flags",an="$feature_flag_payloads",on="$override_feature_flag_payloads",ln="$feature_flag_request_id",cn=e=>{var t={};for(var[i,r]of Te(e||{}))r&&(t[i]=r);return t},un=function(e){return e.FeatureFlags="feature_flags",e.Recordings="recordings",e}({});class hn{constructor(e){this.Xt=!1,this.Qt=!1,this.Zt=!1,this.ti=!1,this.ii=!1,this.ei=!1,this.ri=!1,this._instance=e,this.featureFlagEventHandlers=[]}si(){var e=this._instance.config.evaluation_environments;return null!=e&&e.length?e.filter((e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||rn.error("Invalid evaluation environment found:",e,"Expected non-empty string"),t})):[]}ni(){return this.si().length>0}flags(){if(this._instance.config.__preview_remote_config)this.ei=!0;else{var e=!this.oi&&(this._instance.config.advanced_disable_feature_flags||this._instance.config.advanced_disable_feature_flags_on_first_load);this.ai({disableFlags:e})}}get hasLoadedFlags(){return this.Qt}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._instance.get_property(rt),t=this._instance.get_property(nn),i=this._instance.get_property(on);if(!i&&!t)return e||{};var r=Re({},e||{}),s=[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])];for(var n of s){var a,o,l=r[n],c=null==t?void 0:t[n],u=T(c)?null!==(a=null==l?void 0:l.enabled)&&void 0!==a&&a:!!c,h=T(c)?l.variant:"string"==typeof c?c:void 0,d=null==i?void 0:i[n],p=y({},l,{enabled:u,variant:u?null!=h?h:null==l?void 0:l.variant:void 0});u!==(null==l?void 0:l.enabled)&&(p.original_enabled=null==l?void 0:l.enabled),h!==(null==l?void 0:l.variant)&&(p.original_variant=null==l?void 0:l.variant),d&&(p.metadata=y({},null==l?void 0:l.metadata,{payload:d,original_payload:null==l||null==(o=l.metadata)?void 0:o.payload})),r[n]=p}return this.Xt||(rn.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:r}),this.Xt=!0),r}getFlagVariants(){var e=this._instance.get_property(tt),t=this._instance.get_property(nn);if(!t)return e||{};for(var i=Re({},e),r=Object.keys(t),s=0;s<r.length;s++)i[r[s]]=t[r[s]];return this.Xt||(rn.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this.Xt=!0),i}getFlagPayloads(){var e=this._instance.get_property(an),t=this._instance.get_property(on);if(!t)return e||{};for(var i=Re({},e||{}),r=Object.keys(t),s=0;s<r.length;s++)i[r[s]]=t[r[s]];return this.Xt||(rn.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this.Xt=!0),i}reloadFeatureFlags(){this.ti||this._instance.config.advanced_disable_feature_flags||this.oi||(this.oi=setTimeout((()=>{this.ai()}),5))}li(){clearTimeout(this.oi),this.oi=void 0}ensureFlagsLoaded(){this.Qt||this.Zt||this.oi||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.ti=e}ai(e){var t;if(this.li(),!this._instance.L())if(this.Zt)this.ii=!0;else{var i={token:this._instance.config.token,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:y({},(null==(t=this._instance.persistence)?void 0:t.get_initial_props())||{},this._instance.get_property(st)||{}),group_properties:this._instance.get_property(nt)};(null!=e&&e.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(i.disable_flags=!0),this.ni()&&(i.evaluation_environments=this.si());var r=this._instance.config.__preview_remote_config,s=r?"/flags/?v=2":"/flags/?v=2&config=true",n=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",a=this._instance.requestRouter.endpointFor("api",s+n);r&&(i.timezone=ts()),this.Zt=!0,this._instance.ui({method:"POST",url:a,data:i,compression:this._instance.config.disable_compression?void 0:Qt.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:e=>{var t,r,s=!0;if(200===e.statusCode&&(this.ii||(this.$anon_distinct_id=void 0),s=!1),this.Zt=!1,this.ei||(this.ei=!0,this._instance.hi(null!==(r=e.json)&&void 0!==r?r:{})),!i.disable_flags||this.ii)if(this.ri=!s,e.json&&null!=(t=e.json.quotaLimited)&&t.includes(un.FeatureFlags))rn.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more.");else{var n;i.disable_flags||this.receivedFeatureFlags(null!==(n=e.json)&&void 0!==n?n:{},s),this.ii&&(this.ii=!1,this.ai())}}})}}getFeatureFlag(e,t){if(void 0===t&&(t={}),this.Qt||this.getFlags()&&this.getFlags().length>0){var i=this.getFlagVariants()[e],r=""+i,s=this._instance.get_property(ln)||void 0,n=this._instance.get_property(lt)||{};if((t.send_event||!("send_event"in t))&&(!(e in n)||!n[e].includes(r))){var a,o,l,c,u,h,d,p,g;F(n[e])?n[e].push(r):n[e]=[r],null==(a=this._instance.persistence)||a.register({[lt]:n});var v=this.getFeatureFlagDetails(e),_={$feature_flag:e,$feature_flag_response:i,$feature_flag_payload:this.getFeatureFlagPayload(e)||null,$feature_flag_request_id:s,$feature_flag_bootstrapped_response:(null==(o=this._instance.config.bootstrap)||null==(o=o.featureFlags)?void 0:o[e])||null,$feature_flag_bootstrapped_payload:(null==(l=this._instance.config.bootstrap)||null==(l=l.featureFlagPayloads)?void 0:l[e])||null,$used_bootstrap_value:!this.ri};T(null==v||null==(c=v.metadata)?void 0:c.version)||(_.$feature_flag_version=v.metadata.version);var f,m=null!==(u=null==v||null==(h=v.reason)?void 0:h.description)&&void 0!==u?u:null==v||null==(d=v.reason)?void 0:d.code;m&&(_.$feature_flag_reason=m),null!=v&&null!=(p=v.metadata)&&p.id&&(_.$feature_flag_id=v.metadata.id),T(null==v?void 0:v.original_variant)&&T(null==v?void 0:v.original_enabled)||(_.$feature_flag_original_response=T(v.original_variant)?v.original_enabled:v.original_variant),null!=v&&null!=(g=v.metadata)&&g.original_payload&&(_.$feature_flag_original_payload=null==v||null==(f=v.metadata)?void 0:f.original_payload),this._instance.capture("$feature_flag_called",_)}return i}rn.warn('getFeatureFlag for key "'+e+"\" failed. Feature flags didn't load in time.")}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){return this.getFlagPayloads()[e]}getRemoteConfigPayload(e,t){var i=this._instance.config.token,r={distinct_id:this._instance.get_distinct_id(),token:i};this.ni()&&(r.evaluation_environments=this.si()),this._instance.ui({method:"POST",url:this._instance.requestRouter.endpointFor("api","/flags/?v=2&config=true"),data:r,compression:this._instance.config.disable_compression?void 0:Qt.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:i=>{var r,s=null==(r=i.json)?void 0:r.featureFlagPayloads;t((null==s?void 0:s[e])||void 0)}})}isFeatureEnabled(e,t){if(void 0===t&&(t={}),this.Qt||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlag(e,t);return T(i)?void 0:!!i}rn.warn('isFeatureEnabled for key "'+e+"\" failed. Feature flags didn't load in time.")}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t){if(this._instance.persistence){this.Qt=!0;var i=this.getFlagVariants(),r=this.getFlagPayloads(),s=this.getFlagsWithDetails();!function(e,t,i,r,s){void 0===i&&(i={}),void 0===r&&(r={}),void 0===s&&(s={});var n=(e=>{var t=e.flags;return t?(e.featureFlags=Object.fromEntries(Object.keys(t).map((e=>{var i;return[e,null!==(i=t[e].variant)&&void 0!==i?i:t[e].enabled]}))),e.featureFlagPayloads=Object.fromEntries(Object.keys(t).filter((e=>t[e].enabled)).filter((e=>{var i;return null==(i=t[e].metadata)?void 0:i.payload})).map((e=>{var i;return[e,null==(i=t[e].metadata)?void 0:i.payload]})))):rn.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e})(e),a=n.flags,o=n.featureFlags,l=n.featureFlagPayloads;if(o){var c=e.requestId;if(F(o)){rn.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var u={};if(o)for(var h=0;h<o.length;h++)u[o[h]]=!0;t&&t.register({[sn]:o,[tt]:u})}else{var d=o,p=l,g=a;e.errorsWhileComputingFlags&&(d=y({},i,d),p=y({},r,p),g=y({},s,g)),t&&t.register(y({[sn]:Object.keys(cn(d)),[tt]:d||{},[an]:p||{},[rt]:g||{}},c?{[ln]:c}:{}))}}}(e,this._instance.persistence,i,r,s),this.di(t)}}override(e,t){void 0===t&&(t=!1),rn.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return rn.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===e)return this._instance.persistence.unregister(nn),this._instance.persistence.unregister(on),void this.di();if(e&&"object"==typeof e&&("flags"in e||"payloads"in e)){var t,i=e;if(this.Xt=Boolean(null!==(t=i.suppressWarning)&&void 0!==t&&t),"flags"in i)if(!1===i.flags)this._instance.persistence.unregister(nn);else if(i.flags)if(F(i.flags)){for(var r={},s=0;s<i.flags.length;s++)r[i.flags[s]]=!0;this._instance.persistence.register({[nn]:r})}else this._instance.persistence.register({[nn]:i.flags});return"payloads"in i&&(!1===i.payloads?this._instance.persistence.unregister(on):i.payloads&&this._instance.persistence.register({[on]:i.payloads})),void this.di()}this.di()}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.Qt){var{flags:t,flagVariants:i}=this.vi();e(t,i)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var r,s=(this._instance.get_property(it)||[]).find((t=>t.flagKey===e)),n={["$feature_enrollment/"+e]:t},a={$feature_flag:e,$feature_enrollment:t,$set:n};s&&(a.$early_access_feature_name=s.name),i&&(a.$feature_enrollment_stage=i),this._instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(n,!1);var o=y({},this.getFlagVariants(),{[e]:t});null==(r=this._instance.persistence)||r.register({[sn]:Object.keys(cn(o)),[tt]:o}),this.di()}getEarlyAccessFeatures(e,t,i){void 0===t&&(t=!1);var r=this._instance.get_property(it),s=i?"&"+i.map((e=>"stage="+e)).join("&"):"";if(r&&!t)return e(r);this._instance.ui({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+s),method:"GET",callback:t=>{var i,r;if(t.json){var s=t.json.earlyAccessFeatures;return null==(i=this._instance.persistence)||i.unregister(it),null==(r=this._instance.persistence)||r.register({[it]:s}),e(s)}}})}vi(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((e=>t[e])),flagVariants:Object.keys(t).filter((e=>t[e])).reduce(((e,i)=>(e[i]=t[i],e)),{})}}di(e){var{flags:t,flagVariants:i}=this.vi();this.featureFlagEventHandlers.forEach((r=>r(t,i,{errorsLoading:e})))}setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=this._instance.get_property(st)||{};this._instance.register({[st]:y({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(st)}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=this._instance.get_property(nt)||{};0!==Object.keys(i).length&&Object.keys(i).forEach((t=>{i[t]=y({},i[t],e[t]),delete e[t]})),this._instance.register({[nt]:y({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(nt)||{};this._instance.register({[nt]:y({},t,{[e]:{}})})}else this._instance.unregister(nt)}reset(){this.Qt=!1,this.Zt=!1,this.ti=!1,this.ii=!1,this.ei=!1,this.ri=!1,this.$anon_distinct_id=void 0,this.li(),this.Xt=!1}}var dn=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class pn{constructor(e,t){this.A=e,this.props={},this.ci=!1,this.fi=(e=>{var t="";return e.token&&(t=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),e.persistence_name?"ph_"+e.persistence_name:"ph_"+t+"_posthog"})(e),this.it=this.pi(e),this.load(),e.debug&&ke.info("Persistence loaded",e.persistence,y({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this.gi}pi(e){-1===dn.indexOf(e.persistence.toLowerCase())&&(ke.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=e.persistence.toLowerCase();return"localstorage"===t&&bi.G()?bi:"localstorage+cookie"===t&&Ei.G()?Ei:"sessionstorage"===t&&Pi.G()?Pi:"memory"===t?ki:"cookie"===t?mi:Ei.G()?Ei:mi}properties(){var e={};return Oe(this.props,(function(t,i){if(i===tt&&R(t))for(var r=Object.keys(t),s=0;s<r.length;s++)e["$feature/"+r[s]]=t[r[s]];else a=i,l=!1,(D(n=mt)?l:o&&n.indexOf===o?-1!=n.indexOf(a):(Oe(n,(function(e){if(l||(l=e===a))return Ie})),l))||(e[i]=t);var n,a,l})),e}load(){if(!this.gi){var e=this.it.K(this.fi);e&&(this.props=Re({},e))}}save(){this.gi||this.it.Y(this.fi,this.props,this.mi,this.yi,this.bi,this.A.debug)}remove(){this.it.X(this.fi,!1),this.it.X(this.fi,!0)}clear(){this.remove(),this.props={}}register_once(e,t,i){if(R(e)){T(t)&&(t="None"),this.mi=T(i)?this.wi:i;var r=!1;if(Oe(e,((e,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==t||(this.props[i]=e,r=!0)})),r)return this.save(),!0}return!1}register(e,t){if(R(e)){this.mi=T(t)?this.wi:t;var i=!1;if(Oe(e,((t,r)=>{e.hasOwnProperty(r)&&this.props[r]!==t&&(this.props[r]=t,i=!0)})),i)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.ci){var e=Yr(this.A.custom_campaign_params,this.A.mask_personal_data_properties,this.A.custom_personal_data_properties);C(De(e))||this.register(e),this.ci=!0}}update_search_keyword(){var e;this.register((e=null==c?void 0:c.referrer)?Jr(e):{})}update_referrer_info(){var e;this.register_once({$referrer:Qr(),$referring_domain:null!=c&&c.referrer&&(null==(e=Zt(c.referrer))?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[dt]||this.props[pt]||this.register_once({[gt]:Zr(this.A.mask_personal_data_properties,this.A.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};Oe([pt,dt],(t=>{var i=this.props[t];i&&Oe(i,(function(t,i){e["$initial_"+k(i)]=t}))}));var t,i,r=this.props[gt];if(r){var s=(t=es(r),i={},Oe(t,(function(e,t){i["$initial_"+k(t)]=e})),i);Re(e,s)}return e}safe_merge(e){return Oe(this.props,(function(t,i){i in e||(e[i]=t)})),e}update_config(e,t,i){if(this.wi=this.mi=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!i),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence){var r=this.pi(e),s=this.props;this.clear(),this.it=r,this.props=s,this.save()}}set_disabled(e){this.gi=e,this.gi?this.remove():this.save()}set_cross_subdomain(e){e!==this.yi&&(this.yi=e,this.remove(),this.save())}set_secure(e){e!==this.bi&&(this.bi=e,this.remove(),this.save())}set_event_timer(e,t){var i=this.props[Ge]||{};i[e]=t,this.props[Ge]=i,this.save()}remove_event_timer(e){var t=(this.props[Ge]||{})[e];return T(t)||(delete this.props[Ge][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}}(function(e){e.Button="button",e.Tab="tab",e.Selector="selector"})({}),function(e){e.TopLeft="top_left",e.TopRight="top_right",e.TopCenter="top_center",e.MiddleLeft="middle_left",e.MiddleRight="middle_right",e.MiddleCenter="middle_center",e.Left="left",e.Center="center",e.Right="right",e.NextToTrigger="next_to_trigger"}({});var gn=function(e){return e.Popover="popover",e.API="api",e.Widget="widget",e.ExternalSurvey="external_survey",e}({}),vn=(function(e){e.Open="open",e.MultipleChoice="multiple_choice",e.SingleChoice="single_choice",e.Rating="rating",e.Link="link"}({}),function(e){e.NextQuestion="next_question",e.End="end",e.ResponseBased="response_based",e.SpecificQuestion="specific_question"}({}),function(e){e.Once="once",e.Recurring="recurring",e.Always="always"}({}),function(e){return e.SHOWN="survey shown",e.DISMISSED="survey dismissed",e.SENT="survey sent",e}({})),_n=function(e){return e.SURVEY_ID="$survey_id",e.SURVEY_NAME="$survey_name",e.SURVEY_RESPONSE="$survey_response",e.SURVEY_ITERATION="$survey_iteration",e.SURVEY_ITERATION_START_DATE="$survey_iteration_start_date",e.SURVEY_PARTIALLY_COMPLETED="$survey_partially_completed",e.SURVEY_SUBMISSION_ID="$survey_submission_id",e.SURVEY_QUESTIONS="$survey_questions",e.SURVEY_COMPLETED="$survey_completed",e}({}),fn=function(e){return e.Popover="popover",e.Inline="inline",e}({});class mn{constructor(){this.xi={},this.xi={}}on(e,t){return this.xi[e]||(this.xi[e]=[]),this.xi[e].push(t),()=>{this.xi[e]=this.xi[e].filter((e=>e!==t))}}emit(e,t){for(var i of this.xi[e]||[])i(t);for(var r of this.xi["*"]||[])r(e,t)}}class yn{constructor(e){this.Si=new mn,this.Ei=(e,t)=>this.$i(e,t)&&this.ki(e,t)&&this.Pi(e,t),this.$i=(e,t)=>null==t||!t.event||(null==e?void 0:e.event)===(null==t?void 0:t.event),this._instance=e,this.Ti=new Set,this.Ii=new Set}init(){var e,t;T(null==(e=this._instance)?void 0:e.Ri)||(null==(t=this._instance)||t.Ri(((e,t)=>{this.on(e,t)})))}register(e){var t,i;if(!T(null==(t=this._instance)?void 0:t.Ri)&&(e.forEach((e=>{var t,i;null==(t=this.Ii)||t.add(e),null==(i=e.steps)||i.forEach((e=>{var t;null==(t=this.Ti)||t.add((null==e?void 0:e.event)||"")}))})),null!=(i=this._instance)&&i.autocapture)){var r,s=new Set;e.forEach((e=>{var t;null==(t=e.steps)||t.forEach((e=>{null!=e&&e.selector&&s.add(null==e?void 0:e.selector)}))})),null==(r=this._instance)||r.autocapture.setElementSelectors(s)}}on(e,t){var i;null!=t&&0!=e.length&&(this.Ti.has(e)||this.Ti.has(null==t?void 0:t.event))&&this.Ii&&(null==(i=this.Ii)?void 0:i.size)>0&&this.Ii.forEach((e=>{this.Ci(t,e)&&this.Si.emit("actionCaptured",e.name)}))}Oi(e){this.onAction("actionCaptured",(t=>e(t)))}Ci(e,t){if(null==(null==t?void 0:t.steps))return!1;for(var i of t.steps)if(this.Ei(e,i))return!0;return!1}onAction(e,t){return this.Si.on(e,t)}ki(e,t){if(null!=t&&t.url){var i,r=null==e||null==(i=e.properties)?void 0:i.$current_url;if(!r||"string"!=typeof r)return!1;if(!yn.Fi(r,null==t?void 0:t.url,(null==t?void 0:t.url_matching)||"contains"))return!1}return!0}static Fi(e,t,i){switch(i){case"regex":return!!r&&Js(e,t);case"exact":return t===e;case"contains":var s=yn.Mi(t).replace(/_/g,".").replace(/%/g,".*");return Js(e,s);default:return!1}}static Mi(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}Pi(e,t){if((null!=t&&t.href||null!=t&&t.tag_name||null!=t&&t.text)&&!this.Ai(e).some((e=>!(null!=t&&t.href&&!yn.Fi(e.href||"",null==t?void 0:t.href,(null==t?void 0:t.href_matching)||"exact"))&&(null==t||!t.tag_name||e.tag_name===(null==t?void 0:t.tag_name))&&!(null!=t&&t.text&&!yn.Fi(e.text||"",null==t?void 0:t.text,(null==t?void 0:t.text_matching)||"exact")&&!yn.Fi(e.$el_text||"",null==t?void 0:t.text,(null==t?void 0:t.text_matching)||"exact")))))return!1;if(null!=t&&t.selector){var i,r=null==e||null==(i=e.properties)?void 0:i.$element_selectors;if(!r)return!1;if(!r.includes(null==t?void 0:t.selector))return!1}return!0}Ai(e){return null==(null==e?void 0:e.properties.$elements)?[]:null==e?void 0:e.properties.$elements}}var bn=Se("[Surveys]"),wn="seenSurvey_",En=(e,t)=>{var i="$survey_"+t+"/"+e.id;return e.current_iteration&&e.current_iteration>0&&(i="$survey_"+t+"/"+e.id+"/"+e.current_iteration),i},xn=e=>{var t=""+wn+e.id;return e.current_iteration&&e.current_iteration>0&&(t=""+wn+e.id+"_"+e.current_iteration),t},kn=[gn.Popover,gn.Widget,gn.API],Sn={ignoreConditions:!1,ignoreDelay:!1,displayType:fn.Popover};class Pn{constructor(e){this._instance=e,this.ji=new Map,this.Di=new Map}register(e){var t;T(null==(t=this._instance)?void 0:t.Ri)||(this.Li(e),this.Ni(e))}Ni(e){var t=e.filter((e=>{var t,i;return(null==(t=e.conditions)?void 0:t.actions)&&(null==(i=e.conditions)||null==(i=i.actions)||null==(i=i.values)?void 0:i.length)>0}));0!==t.length&&(null==this.Ui&&(this.Ui=new yn(this._instance),this.Ui.init(),this.Ui.Oi((e=>{this.onAction(e)}))),t.forEach((e=>{var t,i,r,s,n;e.conditions&&null!=(t=e.conditions)&&t.actions&&null!=(i=e.conditions)&&null!=(i=i.actions)&&i.values&&(null==(r=e.conditions)||null==(r=r.actions)||null==(r=r.values)?void 0:r.length)>0&&(null==(s=this.Ui)||s.register(e.conditions.actions.values),null==(n=e.conditions)||null==(n=n.actions)||null==(n=n.values)||n.forEach((t=>{if(t&&t.name){var i=this.Di.get(t.name);i&&i.push(e.id),this.Di.set(t.name,i||[e.id])}})))})))}Li(e){var t;0!==e.filter((e=>{var t,i;return(null==(t=e.conditions)?void 0:t.events)&&(null==(i=e.conditions)||null==(i=i.events)||null==(i=i.values)?void 0:i.length)>0})).length&&(null==(t=this._instance)||t.Ri(((e,t)=>{this.onEvent(e,t)})),e.forEach((e=>{var t;null==(t=e.conditions)||null==(t=t.events)||null==(t=t.values)||t.forEach((t=>{if(t&&t.name){var i=this.ji.get(t.name);i&&i.push(e.id),this.ji.set(t.name,i||[e.id])}}))})))}onEvent(e,t){var i,r,s=(null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[ot])||[];if(vn.SHOWN===e&&t&&s.length>0){var n;bn.info("survey event matched, removing survey from activated surveys",{event:e,eventPayload:t,existingActivatedSurveys:s});var a=null==t||null==(n=t.properties)?void 0:n.$survey_id;if(a){var o=s.indexOf(a);o>=0&&(s.splice(o,1),this.zi(s))}}else if(this.ji.has(e)){bn.info("survey event name matched",{event:e,eventPayload:t,surveys:this.ji.get(e)});var l=[];null==(r=this._instance)||r.getSurveys((t=>{l=t.filter((t=>{var i;return null==(i=this.ji.get(e))?void 0:i.includes(t.id)}))}));var c=l.filter((i=>{var r,s=null==(r=i.conditions)||null==(r=r.events)||null==(r=r.values)?void 0:r.find((t=>t.name===e));return!!s&&(!s.propertyFilters||Object.entries(s.propertyFilters).every((e=>{var i,[r,s]=e,n=null==t||null==(i=t.properties)?void 0:i[r];if(T(n)||D(n))return!1;var a=[String(n)],o=Qs[s.operator];return o?o(s.values,a):(bn.warn("Unknown property comparison operator: "+s.operator),!1)})))}));this.zi(s.concat(c.map((e=>e.id))||[]))}}onAction(e){var t,i=(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[ot])||[];this.Di.has(e)&&this.zi(i.concat(this.Di.get(e)||[]))}zi(e){var t;bn.info("updating activated surveys",{activatedSurveys:e}),null==(t=this._instance)||null==(t=t.persistence)||t.register({[ot]:[...new Set(e)]})}getSurveys(){var e;return(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[ot])||[]}getEventToSurveys(){return this.ji}Hi(){return this.Ui}}class $n{constructor(e){this.Bi=void 0,this._surveyManager=null,this.qi=!1,this.Wi=!1,this.Gi=[],this._instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){if(!this._instance.config.disable_surveys){var t=e.surveys;if(L(t))return bn.warn("Flags not loaded yet. Not loading surveys.");var i=F(t);this.Bi=i?t.length>0:t,bn.info("flags response received, isSurveysEnabled: "+this.Bi),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var i=localStorage.key(t);(null!=i&&i.startsWith(wn)||null!=i&&i.startsWith("inProgressSurvey_"))&&e.push(i)}e.forEach((e=>localStorage.removeItem(e)))}loadIfEnabled(){if(!this._surveyManager)if(this.Wi)bn.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)bn.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())bn.info("Not loading surveys in cookieless mode without consent.");else{var e=null==v?void 0:v.__PosthogExtensions__;if(e){if(!T(this.Bi)||this._instance.config.advanced_enable_surveys){var t=this.Bi||this._instance.config.advanced_enable_surveys;this.Wi=!0;try{var i=e.generateSurveys;if(i)return void this.Vi(i,t);var r=e.loadExternalDependency;if(!r)return void this.Ji("PostHog loadExternalDependency extension not found.");r(this._instance,"surveys",(i=>{i||!e.generateSurveys?this.Ji("Could not load surveys script",i):this.Vi(e.generateSurveys,t)}))}catch(e){throw this.Ji("Error initializing surveys",e),e}finally{this.Wi=!1}}}else bn.error("PostHog Extensions not found.")}}Vi(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new Pn(this._instance),bn.info("Surveys loaded successfully"),this.Ki({isLoaded:!0})}Ji(e,t){bn.error(e,t),this.Ki({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Gi.push(e),this._surveyManager&&this.Ki({isLoaded:!0}),()=>{this.Gi=this.Gi.filter((t=>t!==e))}}getSurveys(e,t){if(void 0===t&&(t=!1),this._instance.config.disable_surveys)return bn.info("Disabled. Not loading surveys."),e([]);var i=this._instance.get_property(at);if(i&&!t)return e(i,{isLoaded:!0});if(this.qi)return e([],{isLoaded:!1,error:"Surveys are already being loaded"});try{this.qi=!0,this._instance.ui({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:t=>{var i;this.qi=!1;var r=t.statusCode;if(200!==r||!t.json){var s="Surveys API could not be loaded, status: "+r;return bn.error(s),e([],{isLoaded:!1,error:s})}var n,a=t.json.surveys||[],o=a.filter((e=>function(e){return!(!e.start_date||e.end_date)}(e)&&(function(e){var t;return!(null==(t=e.conditions)||null==(t=t.events)||null==(t=t.values)||!t.length)}(e)||function(e){var t;return!(null==(t=e.conditions)||null==(t=t.actions)||null==(t=t.values)||!t.length)}(e))));return o.length>0&&(null==(n=this._surveyEventReceiver)||n.register(o)),null==(i=this._instance.persistence)||i.register({[at]:a}),e(a,{isLoaded:!0})}})}catch(e){throw this.qi=!1,e}}Ki(e){for(var t of this.Gi)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(e){bn.error("Error in survey callback",e)}}getActiveMatchingSurveys(e,t){if(void 0===t&&(t=!1),!L(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);bn.warn("init was not called")}Yi(e){var t=null;return this.getSurveys((i=>{var r;t=null!==(r=i.find((t=>t.id===e)))&&void 0!==r?r:null})),t}Xi(e){if(L(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var t="string"==typeof e?this.Yi(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(L(this._surveyManager))return bn.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var t=this.Xi(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return L(this._surveyManager)?(bn.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise((i=>{this.getSurveys((t=>{var r,s=null!==(r=t.find((t=>t.id===e)))&&void 0!==r?r:null;if(s){var n=this.Xi(s);i({visible:n.eligible,disabledReason:n.reason})}else i({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t){var i;if(L(this._surveyManager))bn.warn("init was not called");else{var r="string"==typeof e?this.Yi(e):e;if(null!=r&&r.id)if(kn.includes(r.type)){var s=null==c?void 0:c.querySelector(t);if(s)return null!=(i=r.appearance)&&i.surveyPopupDelaySeconds?(bn.info("Rendering survey "+r.id+" with delay of "+r.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var e,t;bn.info("Rendering survey "+r.id+" with delay of "+(null==(e=r.appearance)?void 0:e.surveyPopupDelaySeconds)+" seconds"),null==(t=this._surveyManager)||t.renderSurvey(r,s),bn.info("Survey "+r.id+" rendered")}),1e3*r.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(r,s);bn.warn("Survey element not found")}else bn.warn("Surveys of type "+r.type+" cannot be rendered in the app");else bn.warn("Survey not found")}}displaySurvey(e,t){var i;if(L(this._surveyManager))bn.warn("init was not called");else{var r=this.Yi(e);if(r){var s=r;if(null!=(i=r.appearance)&&i.surveyPopupDelaySeconds&&t.ignoreDelay&&(s=y({},r,{appearance:y({},r.appearance,{surveyPopupDelaySeconds:0})})),!1===t.ignoreConditions){var n=this.canRenderSurvey(r);if(!n.visible)return void bn.warn("Survey is not eligible to be displayed: ",n.disabledReason)}t.displayType!==fn.Inline?this._surveyManager.handlePopoverSurvey(s):this.renderSurvey(s,t.selector)}else bn.warn("Survey not found")}}}var In=Se("[RateLimiter]");class Fn{constructor(e){var t,i;this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach((e=>{In.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4}))}catch(e){return void In.warn('could not rate limit - continuing. Error: "'+(null==e?void 0:e.message)+'"',{text:t})}},this.instance=e,this.captureEventsPerSecond=(null==(t=e.config.rate_limiting)?void 0:t.events_per_second)||10,this.captureEventsBurstLimit=Math.max((null==(i=e.config.rate_limiting)?void 0:i.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(e){var t,i,r;void 0===e&&(e=!1);var s=(new Date).getTime(),n=null!==(t=null==(i=this.instance.persistence)?void 0:i.get_property(ht))&&void 0!==t?t:{tokens:this.captureEventsBurstLimit,last:s};n.tokens+=(s-n.last)/1e3*this.captureEventsPerSecond,n.last=s,n.tokens>this.captureEventsBurstLimit&&(n.tokens=this.captureEventsBurstLimit);var a=n.tokens<1;return a||e||(n.tokens=Math.max(0,n.tokens-1)),!a||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+this.captureEventsPerSecond+" events per second and "+this.captureEventsBurstLimit+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=a,null==(r=this.instance.persistence)||r.set_property(ht,n),{isRateLimited:a,remainingTokens:n.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}var On=Se("[RemoteConfig]");class Rn{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=v._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}Qi(e){var t,i;null!=(t=v.__PosthogExtensions__)&&t.loadExternalDependency?null==(i=v.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):(On.error("PostHog Extensions not found. Cannot load remote config."),e())}Zi(e){this._instance.ui({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t=>{e(t.json)}})}load(){try{if(this.remoteConfig)return On.info("Using preloaded remote config",this.remoteConfig),void this.hi(this.remoteConfig);if(this._instance.L())return void On.warn("Remote config is disabled. Falling back to local config.");this.Qi((e=>{if(!e)return On.info("No config found after loading remote JS config. Falling back to JSON."),void this.Zi((e=>{this.hi(e)}));this.hi(e)}))}catch(r){On.error("Error loading remote config",r)}}hi(e){e?this._instance.config.__preview_remote_config?(this._instance.hi(e),!1!==e.hasFeatureFlags&&this._instance.featureFlags.ensureFlagsLoaded()):On.info("__preview_remote_config is disabled. Logging config instead",e):On.error("Failed to fetch remote config from PostHog.")}}var Cn=3e3;class Tn{constructor(e,t){this.te=!0,this.ie=[],this.ee=z((null==t?void 0:t.flush_interval_ms)||Cn,250,5e3,ke.createLogger("flush interval"),Cn),this.re=e}enqueue(e){this.ie.push(e),this.se||this.ne()}unload(){this.oe();var e=this.ie.length>0?this.ae():{},t=Object.values(e);[...t.filter((e=>0===e.url.indexOf("/e"))),...t.filter((e=>0!==e.url.indexOf("/e")))].map((e=>{this.re(y({},e,{transport:"sendBeacon"}))}))}enable(){this.te=!1,this.ne()}ne(){var e=this;this.te||(this.se=setTimeout((()=>{if(this.oe(),this.ie.length>0){var t=this.ae(),i=function(){var i=t[r],s=(new Date).getTime();i.data&&F(i.data)&&Oe(i.data,(e=>{e.offset=Math.abs(e.timestamp-s),delete e.timestamp})),e.re(i)};for(var r in t)i()}}),this.ee))}oe(){clearTimeout(this.se),this.se=void 0}ae(){var e={};return Oe(this.ie,(t=>{var i,r=t,s=(r?r.batchKey:null)||r.url;T(e[s])&&(e[s]=y({},r,{data:[]})),null==(i=e[s].data)||i.push(r.data)})),this.ie=[],e}}var An=["retriesPerformedSoFar"];class Mn{constructor(e){this.le=!1,this.ue=3e3,this.ie=[],this._instance=e,this.ie=[],this.he=!0,!T(r)&&"onLine"in r.navigator&&(this.he=r.navigator.onLine,qe(r,"online",(()=>{this.he=!0,this.jt()})),qe(r,"offline",(()=>{this.he=!1})))}get length(){return this.ie.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,i=b(e,An);N(t)&&t>0&&(i.url=Vs(i.url,{retry_count:t})),this._instance.ui(y({},i,{callback:e=>{200!==e.statusCode&&(e.statusCode<400||e.statusCode>=500)&&(null!=t?t:0)<10?this.de(y({retriesPerformedSoFar:t},i)):null==i.callback||i.callback(e)}}))}de(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var i=function(e){var t=3e3*Math.pow(2,e),i=t/2,r=Math.min(18e5,t),s=(Math.random()-.5)*(r-i);return Math.ceil(r+s)}(t),r=Date.now()+i;this.ie.push({retryAt:r,requestOptions:e});var s="Enqueued failed request for retry in "+i;navigator.onLine||(s+=" (Browser is offline)"),ke.warn(s),this.le||(this.le=!0,this.ve())}ve(){this.ce&&clearTimeout(this.ce),this.ce=setTimeout((()=>{this.he&&this.ie.length>0&&this.jt(),this.ve()}),this.ue)}jt(){var e=Date.now(),t=[],i=this.ie.filter((i=>i.retryAt<e||(t.push(i),!1)));if(this.ie=t,i.length>0)for(var{requestOptions:r}of i)this.retriableRequest(r)}unload(){for(var{requestOptions:e}of(this.ce&&(clearTimeout(this.ce),this.ce=void 0),this.ie))try{this._instance.ui(y({},e,{transport:"sendBeacon"}))}catch(e){ke.error(e)}this.ie=[]}}class Dn{constructor(e){this.fe=()=>{var e,t,i,r;this.pe||(this.pe={});var s=this.scrollElement(),n=this.scrollY(),a=s?Math.max(0,s.scrollHeight-s.clientHeight):0,o=n+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;this.pe.lastScrollY=Math.ceil(n),this.pe.maxScrollY=Math.max(n,null!==(e=this.pe.maxScrollY)&&void 0!==e?e:0),this.pe.maxScrollHeight=Math.max(a,null!==(t=this.pe.maxScrollHeight)&&void 0!==t?t:0),this.pe.lastContentY=o,this.pe.maxContentY=Math.max(o,null!==(i=this.pe.maxContentY)&&void 0!==i?i:0),this.pe.maxContentHeight=Math.max(l,null!==(r=this.pe.maxContentHeight)&&void 0!==r?r:0)},this._instance=e}getContext(){return this.pe}resetContext(){var e=this.pe;return setTimeout(this.fe,0),e}startMeasuringScrollPosition(){qe(r,"scroll",this.fe,{capture:!0}),qe(r,"scrollend",this.fe,{capture:!0}),qe(r,"resize",this.fe)}scrollElement(){if(!this._instance.config.scroll_root_selector)return null==r?void 0:r.document.documentElement;var e=F(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var t of e){var i=null==r?void 0:r.document.querySelector(t);if(i)return i}}scrollY(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return r&&(r.scrollY||r.pageYOffset||r.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return r&&(r.scrollX||r.pageXOffset||r.document.documentElement.scrollLeft)||0}}var Ln=e=>Zr(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties);class Nn{constructor(e,t,i,r){this.ge=e=>{var t=this._e();if(!t||t.sessionId!==e){var i={sessionId:e,props:this.me(this._instance)};this.ye.register({[ut]:i})}},this._instance=e,this.be=t,this.ye=i,this.me=r||Ln,this.be.onSessionId(this.ge)}_e(){return this.ye.props[ut]}getSetOnceProps(){var e,t=null==(e=this._e())?void 0:e.props;return t?"r"in t?es(t):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return Oe(De(this.getSetOnceProps()),((t,i)=>{"$current_url"===i&&(i="url"),e["$session_entry_"+k(i)]=t})),e}}var jn=Se("[SessionId]");class qn{on(e,t){return this.we.on(e,t)}constructor(e,t,i){var r;if(this.xe=[],this.Se=void 0,this.we=new mn,this.Ee=(e,t)=>Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if("always"===e.config.cookieless_mode)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.A=e.config,this.ye=e.persistence,this.$e=void 0,this.ke=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Pe=t||gi,this.Te=i||gi;var s=this.A.persistence_name||this.A.token,n=this.A.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*z(n,60,36e3,jn.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Ie(),this.Re="ph_"+s+"_window_id",this.Ce="ph_"+s+"_primary_window_exists",this.Oe()){var a=Pi.K(this.Re),o=Pi.K(this.Ce);a&&!o?this.$e=a:Pi.X(this.Re),Pi.Y(this.Ce,!0)}if(null!=(r=this.A.bootstrap)&&r.sessionID)try{var l=(()=>{var e=this.A.bootstrap.sessionID.replace(/-/g,"");if(32!==e.length)throw new Error("Not a valid UUID");if("7"!==e[12])throw new Error("Not a UUIDv7");return parseInt(e.substring(0,12),16)})();this.Fe(this.A.bootstrap.sessionID,(new Date).getTime(),l)}catch(e){jn.error("Invalid sessionID in bootstrap",e)}this.Me()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return T(this.xe)&&(this.xe=[]),this.xe.push(e),this.ke&&e(this.ke,this.$e),()=>{this.xe=this.xe.filter((t=>t!==e))}}Oe(){return"memory"!==this.A.persistence&&!this.ye.gi&&Pi.G()}Ae(e){e!==this.$e&&(this.$e=e,this.Oe()&&Pi.Y(this.Re,e))}je(){return this.$e?this.$e:this.Oe()?Pi.K(this.Re):null}Fe(e,t,i){e===this.ke&&t===this._sessionActivityTimestamp&&i===this._sessionStartTimestamp||(this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this.ke=e,this.ye.register({[Ze]:[t,e,i]}))}De(){if(this.ke&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this.ke,this._sessionStartTimestamp];var e=this.ye.props[Ze];return F(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Fe(null,null,null)}destroy(){clearTimeout(this.Le),this.Le=void 0,this.Se&&r&&(r.removeEventListener("beforeunload",this.Se,{capture:!1}),this.Se=void 0),this.xe=[]}Me(){this.Se=()=>{this.Oe()&&Pi.X(this.Ce)},qe(r,"beforeunload",this.Se,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=null),"always"===this.A.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=t||(new Date).getTime(),[r,s,n]=this.De(),a=this.je(),o=N(n)&&n>0&&Math.abs(i-n)>864e5,l=!1,c=!s,u=!e&&this.Ee(i,r);c||u||o?(s=this.Pe(),a=this.Te(),jn.info("new session ID generated",{sessionId:s,windowId:a,changeReason:{noSessionId:c,activityTimeout:u,sessionPastMaximumLength:o}}),n=i,l=!0):a||(a=this.Te(),l=!0);var h=0===r||!e||o?i:r,d=0===n?(new Date).getTime():n;return this.Ae(a),this.Fe(s,h,d),e||this.Ie(),l&&this.xe.forEach((e=>e(s,a,l?{noSessionId:c,activityTimeout:u,sessionPastMaximumLength:o}:void 0))),{sessionId:s,windowId:a,sessionStartTimestamp:d,changeReason:l?{noSessionId:c,activityTimeout:u,sessionPastMaximumLength:o}:void 0,lastActivityTimestamp:r}}Ie(){clearTimeout(this.Le),this.Le=setTimeout((()=>{var[e]=this.De();if(this.Ee((new Date).getTime(),e)){var t=this.ke;this.resetSessionId(),this.we.emit("forcedIdleReset",{idleSessionId:t})}}),1.1*this.sessionTimeoutMs)}}var Un=["$set_once","$set"],Hn=Se("[SiteApps]");class Gn{constructor(e){this._instance=e,this.Ne=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Ue(e,t){if(t){var i=this.globalsForEvent(t);this.Ne.push(i),this.Ne.length>1e3&&(this.Ne=this.Ne.slice(10))}}get siteAppLoaders(){var e;return null==(e=v._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.siteApps}init(){if(this.isEnabled){var e=this._instance.Ri(this.Ue.bind(this));this.ze=()=>{e(),this.Ne=[],this.ze=void 0}}}globalsForEvent(e){var t,i,r,s,n,a,o;if(!e)throw new Error("Event payload is required");var l={},c=this._instance.get_property("$groups")||[],u=this._instance.get_property("$stored_group_properties")||{};for(var[h,d]of Object.entries(u))l[h]={id:c[h],type:h,properties:d};var{$set_once:p,$set:g}=e;return{event:y({},b(e,Un),{properties:y({},e.properties,g?{$set:y({},null!==(t=null==(i=e.properties)?void 0:i.$set)&&void 0!==t?t:{},g)}:{},p?{$set_once:y({},null!==(r=null==(s=e.properties)?void 0:s.$set_once)&&void 0!==r?r:{},p)}:{}),elements_chain:null!==(n=null==(a=e.properties)?void 0:a.$elements_chain)&&void 0!==n?n:"",distinct_id:null==(o=e.properties)?void 0:o.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}setupSiteApp(e){var t=this.apps[e.id],i=()=>{var i;!t.errored&&this.Ne.length&&(Hn.info("Processing "+this.Ne.length+" events for site app with id "+e.id),this.Ne.forEach((e=>null==t.processEvent?void 0:t.processEvent(e))),t.processedBuffer=!0),Object.values(this.apps).every((e=>e.processedBuffer||e.errored))&&(null==(i=this.ze)||i.call(this))},r=!1,s=s=>{t.errored=!s,t.loaded=!0,Hn.info("Site app with id "+e.id+" "+(s?"loaded":"errored")),r&&i()};try{var{processEvent:n}=e.init({posthog:this._instance,callback:e=>{s(e)}});n&&(t.processEvent=n),r=!0}catch(t){Hn.error("Error while initializing PostHog app with config id "+e.id,t),s(!1)}if(r&&t.loaded)try{i()}catch(i){Hn.error("Error while processing buffered events PostHog app with config id "+e.id,i),t.errored=!0}}He(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var i of e)this.setupSiteApp(i)}Be(e){if(0!==Object.keys(this.apps).length){var t=this.globalsForEvent(e);for(var i of Object.values(this.apps))try{null==i.processEvent||i.processEvent(t)}catch(t){Hn.error("Error while processing event "+e.event+" for site app "+i.id,t)}}}onRemoteConfig(e){var t,i,r,s=this;if(null!=(t=this.siteAppLoaders)&&t.length)return this.isEnabled?(this.He(),void this._instance.on("eventCaptured",(e=>this.Be(e)))):void Hn.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this.ze)||i.call(this),null!=(r=e.siteApps)&&r.length)if(this.isEnabled){var n=function(e){var t;v["__$$ph_site_app_"+e]=s._instance,null==(t=v.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(s._instance,o,(t=>{if(t)return Hn.error("Error while initializing PostHog app with config id "+e,t)}))};for(var{id:a,url:o}of e.siteApps)n(a)}else Hn.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}var Bn=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],Wn=function(e,t){if(!e)return!1;var i=e.toLowerCase();return Bn.concat(t||[]).some((e=>{var t=e.toLowerCase();return-1!==i.indexOf(t)}))},Vn=function(e,t){if(!e)return!1;var i=e.userAgent;if(i&&Wn(i,t))return!0;try{var r=null==e?void 0:e.userAgentData;if(null!=r&&r.brands&&r.brands.some((e=>Wn(null==e?void 0:e.brand,t))))return!0}catch(e){}return!!e.webdriver},zn=function(e){return e.US="us",e.EU="eu",e.CUSTOM="custom",e}({}),Yn="i.posthog.com";class Xn{constructor(e){this.qe={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"https://us.i.posthog.com":e}get uiHost(){var e,t=null==(e=this.instance.config.ui_host)?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+Yn,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this.qe[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.qe[this.apiHost]=zn.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.qe[this.apiHost]=zn.EU:this.qe[this.apiHost]=zn.CUSTOM),this.qe[this.apiHost]}endpointFor(e,t){if(void 0===t&&(t=""),t&&(t="/"===t[0]?t:"/"+t),"ui"===e)return this.uiHost+t;if(this.region===zn.CUSTOM)return this.apiHost+t;var i=Yn+t;switch(e){case"assets":return"https://"+this.region+"-assets."+i;case"api":return"https://"+this.region+"."+i}}}var Jn={icontains:(e,t)=>!!r&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!r&&-1===t.href.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>!!r&&Js(t.href,e),not_regex:(e,t)=>!!r&&!Js(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};class Kn{constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(e){void 0===e&&(e=!1),t.getWebExperiments((e=>{Kn.We("retrieved web experiments from the server"),t.Ge=new Map,e.forEach((e=>{if(e.feature_flag_key){var i;t.Ge&&(Kn.We("setting flag key ",e.feature_flag_key," to web experiment ",e),null==(i=t.Ge)||i.set(e.feature_flag_key,e));var r=t._instance.getFeatureFlag(e.feature_flag_key);A(r)&&e.variants[r]&&t.Ve(e.name,r,e.variants[r].transforms)}else if(e.variants)for(var s in e.variants){var n=e.variants[s];Kn.Je(n)&&t.Ve(e.name,s,n.transforms)}}))}),e)},this._instance=e,this._instance.onFeatureFlags((e=>{this.onFeatureFlags(e)}))}onFeatureFlags(e){if(this._is_bot())Kn.We("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(L(this.Ge))return this.Ge=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Kn.We("applying feature flags",e),e.forEach((e=>{var t;if(this.Ge&&null!=(t=this.Ge)&&t.has(e)){var i,r=this._instance.getFeatureFlag(e),s=null==(i=this.Ge)?void 0:i.get(e);r&&null!=s&&s.variants[r]&&this.Ve(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var e=Kn.getWindowLocation();if(null!=e&&e.search){var t=ei(null==e?void 0:e.search,"__experiment_id"),i=ei(null==e?void 0:e.search,"__experiment_variant");t&&i&&(Kn.We("previewing web experiments "+t+" && "+i),this.getWebExperiments((e=>{this.Ke(parseInt(t),i,e)}),!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,i){if(this._instance.config.disable_web_experiments&&!i)return e([]);var r=this._instance.get_property("$web_experiments");if(r&&!t)return e(r);this._instance.ui({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:t=>{if(200!==t.statusCode||!t.json)return e([]);var i=t.json.experiments||[];return e(i)}})}Ke(e,t,i){var r=i.filter((t=>t.id===e));r&&r.length>0&&(Kn.We("Previewing web experiment ["+r[0].name+"] with variant ["+t+"]"),this.Ve(r[0].name,t,r[0].variants[t].transforms))}static Je(e){return!L(e.conditions)&&Kn.Ye(e)&&Kn.Xe(e)}static Ye(e){var t;if(L(e.conditions)||L(null==(t=e.conditions)?void 0:t.url))return!0;var i,r,s,n=Kn.getWindowLocation();return!!n&&(null==(i=e.conditions)||!i.url||Jn[null!==(r=null==(s=e.conditions)?void 0:s.urlMatchType)&&void 0!==r?r:"icontains"](e.conditions.url,n))}static getWindowLocation(){return null==r?void 0:r.location}static Xe(e){var t;if(L(e.conditions)||L(null==(t=e.conditions)?void 0:t.utm))return!0;var i=Yr();if(i.utm_source){var r,s,n,a,o,l,c,u,h=null==(r=e.conditions)||null==(r=r.utm)||!r.utm_campaign||(null==(s=e.conditions)||null==(s=s.utm)?void 0:s.utm_campaign)==i.utm_campaign,d=null==(n=e.conditions)||null==(n=n.utm)||!n.utm_source||(null==(a=e.conditions)||null==(a=a.utm)?void 0:a.utm_source)==i.utm_source,p=null==(o=e.conditions)||null==(o=o.utm)||!o.utm_medium||(null==(l=e.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==i.utm_medium,g=null==(c=e.conditions)||null==(c=c.utm)||!c.utm_term||(null==(u=e.conditions)||null==(u=u.utm)?void 0:u.utm_term)==i.utm_term;return h&&p&&g&&d}return!1}static We(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];ke.info("[WebExperiments] "+e,i)}Ve(e,t,i){this._is_bot()?Kn.We("Refusing to render web experiment since the viewer is a likely bot"):"control"!==t?i.forEach((i=>{if(i.selector){var r;Kn.We("applying transform of variant "+t+" for experiment "+e+" ",i);var s=null==(r=document)?void 0:r.querySelectorAll(i.selector);null==s||s.forEach((e=>{var t=e;i.html&&(t.innerHTML=i.html),i.css&&t.setAttribute("style",i.css)}))}})):Kn.We("Control variants leave the page unmodified.")}_is_bot(){return l&&this._instance?Vn(l,this._instance.config.custom_blocked_useragents):void 0}}var Qn=Se("[PostHog ExternalIntegrations]"),Zn={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class ea{constructor(e){this._instance=e}nt(e,t){var i;null==(i=v.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,(e=>{if(e)return Qn.error("failed to load script",e);t()}))}startIfEnabledOrStop(){var e=this,t=function(t){var i,s,n;!r||null!=(i=v.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[t]||e.nt(Zn[t],(()=>{var i;null==(i=v.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[t])||i.start(e._instance)})),!r&&null!=(s=v.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[t]&&(null==(n=v.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[t])||n.stop())};for(var[i,r]of Object.entries(null!==(s=this._instance.config.integrations)&&void 0!==s?s:{})){var s;t(i)}}}var ta="[SessionRecording]",ia=Se(ta);class ra{get started(){var e;return!(null==(e=this.Qe)||!e.isStarted)}get status(){return this.Qe?this.Qe.status:this.Ze&&!this.tr?"disabled":"lazy_loading"}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.Ze=!1,this.ir=void 0,this._instance=e,!this._instance.sessionManager)throw ia.error("started without valid sessionManager"),new Error(ta+" started without valid sessionManager. This is a bug.");if("always"===this._instance.config.cookieless_mode)throw new Error(ta+' cannot be used with cookieless_mode="always"')}get tr(){var e,t=!(null==(e=this._instance.get_property(Qe))||!e.enabled),i=!this._instance.config.disable_session_recording,s=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return r&&t&&i&&!s}startIfEnabledOrStop(e){var t;if(!this.tr||null==(t=this.Qe)||!t.isStarted){var i=!T(Object.assign)&&!T(Array.from);this.tr&&i?(this.er(e),ia.info("starting")):this.stopRecording()}}er(e){var t,i,r;this.tr&&(null!=v&&null!=(t=v.__PosthogExtensions__)&&null!=(t=t.rrweb)&&t.record&&null!=(i=v.__PosthogExtensions__)&&i.initSessionRecording?this.rr(e):null==(r=v.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.sr,(t=>{if(t)return ia.error("could not load recorder",t);this.rr(e)})))}stopRecording(){var e,t;null==(e=this.ir)||e.call(this),this.ir=void 0,null==(t=this.Qe)||t.stop()}nr(){var e;null==(e=this._instance.persistence)||e.unregister(et)}ar(e){if(this._instance.persistence){var t,i,r=this._instance.persistence,s=()=>{var t=!1===e.sessionRecording?void 0:e.sessionRecording,i=null==t?void 0:t.sampleRate,s=L(i)?null:parseFloat(i);L(s)&&this.nr();var n=null==t?void 0:t.minimumDurationMilliseconds;r.register({[Qe]:y({enabled:!!t},t,{networkPayloadCapture:y({capturePerformance:e.capturePerformance},null==t?void 0:t.networkPayloadCapture),canvasRecording:{enabled:null==t?void 0:t.recordCanvas,fps:null==t?void 0:t.canvasFps,quality:null==t?void 0:t.canvasQuality},sampleRate:s,minimumDurationMilliseconds:T(n)?null:n,endpoint:null==t?void 0:t.endpoint,triggerMatchType:null==t?void 0:t.triggerMatchType,masking:null==t?void 0:t.masking,urlTriggers:null==t?void 0:t.urlTriggers})})};s(),null==(t=this.ir)||t.call(this),this.ir=null==(i=this._instance.sessionManager)?void 0:i.onSessionId(s)}}onRemoteConfig(e){"sessionRecording"in e?!1!==e.sessionRecording?(this.ar(e),this.Ze=!0,this.startIfEnabledOrStop()):this.Ze=!0:ia.info("skipping remote config with no sessionRecording",e)}log(e,t){var i;void 0===t&&(t="log"),null!=(i=this.Qe)&&i.log?this.Qe.log(e,t):ia.warn("log called before recorder was ready")}get sr(){var e,t,i=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.get_property(Qe);return(null==i||null==(t=i.scriptConfig)?void 0:t.script)||"lazy-recorder"}rr(e){var t,i;if(null==(t=v.__PosthogExtensions__)||!t.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.Qe||(this.Qe=null==(i=v.__PosthogExtensions__)?void 0:i.initSessionRecording(this._instance),this.Qe._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),this.Qe.start(e)}onRRwebEmit(e){var t;null==(t=this.Qe)||null==t.onRRwebEmit||t.onRRwebEmit(e)}overrideLinkedFlag(){var e;null==(e=this.Qe)||e.overrideLinkedFlag()}overrideSampling(){var e;null==(e=this.Qe)||e.overrideSampling()}overrideTrigger(e){var t;null==(t=this.Qe)||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return(null==(e=this.Qe)?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var i;return!(null==(i=this.Qe)||!i.tryAddCustomEvent(e,t))}}var sa={},na=()=>{},aa="posthog",oa=!Bs&&-1===(null==g?void 0:g.indexOf("MSIE"))&&-1===(null==g?void 0:g.indexOf("Mozilla")),la=e=>{var t;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:Ne(null==c?void 0:c.location),persistence:"localStorage+cookie",persistence_name:"",loaded:na,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:"2025-05-24"!==e||"history_change",capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",debug:u&&A(null==u?void 0:u.search)&&-1!==u.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==r||null==(t=r.location)?void 0:t.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,session_recording:{},mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:e=>{var t="Bad HTTP status: "+e.statusCode+" "+e.text;ke.error(t)},get_device_id:e=>e,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:Cn},error_tracking:{},_onCapture:na,__preview_eager_load_replay:!1}},ca=e=>{var t={};T(e.process_person)||(t.person_profiles=e.process_person),T(e.xhr_headers)||(t.request_headers=e.xhr_headers),T(e.cookie_name)||(t.persistence_name=e.cookie_name),T(e.disable_cookie)||(t.disable_persistence=e.disable_cookie),T(e.store_google)||(t.save_campaign_params=e.store_google),T(e.verbose)||(t.debug=e.verbose);var i=Re({},t,e);return F(e.property_blacklist)&&(T(e.property_denylist)?i.property_denylist=e.property_blacklist:F(e.property_denylist)?i.property_denylist=[...e.property_blacklist,...e.property_denylist]:ke.error("Invalid value for property_denylist config: "+e.property_denylist)),i};class ua{constructor(){this.__forceAllowLocalhost=!1}get lr(){return this.__forceAllowLocalhost}set lr(e){ke.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class ha{get decideEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}get flagsEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}constructor(){this.webPerformance=new ua,this.ur=!1,this.version=_.LIB_VERSION,this.hr=new mn,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=la(),this.SentryIntegration=qi,this.sentryIntegration=e=>function(e,t){var i=ji(e,t);return{name:Ni,processEvent:e=>i(e)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.dr=!1,this.vr=null,this.cr=null,this.pr=null,this.featureFlags=new hn(this),this.toolbar=new Wi(this),this.scrollManager=new Dn(this),this.pageViewManager=new us(this),this.surveys=new $n(this),this.experiments=new Kn(this),this.exceptions=new tn(this),this.rateLimiter=new Fn(this),this.requestRouter=new Xn(this),this.consent=new Ii(this),this.externalIntegrations=new ea(this),this.people={set:(e,t,i)=>{var r=A(e)?{[e]:t}:e;this.setPersonProperties(r),null==i||i({})},set_once:(e,t,i)=>{var r=A(e)?{[e]:t}:e;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",(e=>ke.info('send "'+(null==e?void 0:e.event)+'"',e)))}init(e,t,i){if(i&&i!==aa){var r,s=null!==(r=sa[i])&&void 0!==r?r:new ha;return s._init(e,t,i),sa[i]=s,sa[aa][i]=s,s}return this._init(e,t,i)}_init(e,t,i){var s,n;if(void 0===t&&(t={}),T(e)||M(e))return ke.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},t.debug=this.gr(t.debug),this._r=t,this.mr=[],t.person_profiles&&(this.cr=t.person_profiles),this.set_config(Re({},la(t.defaults),ca(t),{name:i,token:e})),this.config.on_xhr_error&&ke.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:Qt.GZipJS;var a=this.yr();this.persistence=new pn(this.config,a),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new pn(y({},this.config,{persistence:"sessionStorage"}),a);var o=y({},this.persistence.props),l=y({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.br=new Tn((e=>this.wr(e)),this.config.request_queue_config),this.Sr=new Mn(this),this.__request_queue=[];var c="always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut();if(c||(this.sessionManager=new qn(this),this.sessionPropsManager=new Nn(this,this.sessionManager,this.persistence)),new zi(this).startIfEnabledOrStop(),this.siteApps=new Gn(this),null==(s=this.siteApps)||s.init(),c||(this.sessionRecording=new ra(this),this.sessionRecording.startIfEnabledOrStop()),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new oi(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new cs(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new as(this),this.exceptionObserver=new Ai(this),this.exceptionObserver.startIfEnabled(),this.deadClicksAutocapture=new Ci(this,Ri),this.deadClicksAutocapture.startIfEnabled(),this.historyAutocapture=new Di(this),this.historyAutocapture.startIfEnabled(),_.DEBUG=_.DEBUG||this.config.debug,_.DEBUG&&ke.info("Starting in debug mode",{this:this,config:t,thisC:y({},this.config),p:o,s:l}),void 0!==(null==(n=t.bootstrap)?void 0:n.distinctID)){var u,h,d=this.config.get_device_id(gi()),p=null!=(u=t.bootstrap)&&u.isIdentifiedID?d:t.bootstrap.distinctID;this.persistence.set_property(ct,null!=(h=t.bootstrap)&&h.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:t.bootstrap.distinctID,$device_id:p})}if(this.Er()){var g,v,f=Object.keys((null==(g=t.bootstrap)?void 0:g.featureFlags)||{}).filter((e=>{var i;return!(null==(i=t.bootstrap)||null==(i=i.featureFlags)||!i[e])})).reduce(((e,i)=>{var r;return e[i]=(null==(r=t.bootstrap)||null==(r=r.featureFlags)?void 0:r[i])||!1,e}),{}),m=Object.keys((null==(v=t.bootstrap)?void 0:v.featureFlagPayloads)||{}).filter((e=>f[e])).reduce(((e,i)=>{var r,s;return null!=(r=t.bootstrap)&&null!=(r=r.featureFlagPayloads)&&r[i]&&(e[i]=null==(s=t.bootstrap)||null==(s=s.featureFlagPayloads)?void 0:s[i]),e}),{});this.featureFlags.receivedFeatureFlags({featureFlags:f,featureFlagPayloads:m})}if(c)this.register_once({distinct_id:ft,$device_id:null},"");else if(!this.get_distinct_id()){var b=this.config.get_device_id(gi());this.register_once({distinct_id:b,$device_id:b},""),this.persistence.set_property(ct,"anonymous")}return qe(r,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),t.segment?function(e,t){var i=e.config.segment;if(!i)return t();!function(e,t){var i=e.config.segment;if(!i)return t();var r=i=>{var r=()=>i.anonymousId()||gi();e.config.get_device_id=r,i.id()&&(e.register({distinct_id:i.id(),$device_id:r()}),e.persistence.set_property(ct,"identified")),t()},s=i.user();"then"in s&&O(s.then)?s.then((e=>r(e))):r(s)}(e,(()=>{i.register((e=>{Promise&&Promise.resolve||Li.warn("This browser does not have Promise support, and can not use the segment integration");var t=(t,i)=>{if(!i)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(Li.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(Li.info("UserId set, identifying with PostHog"),e.identify(t.event.userId));var r=e.calculateEventProperties(i,t.event.properties);return t.event.properties=Object.assign({},r,t.event.properties),t};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>t(e,e.event.event),page:e=>t(e,"$pageview"),identify:e=>t(e,"$identify"),screen:e=>t(e,"$screen")}})(e)).then((()=>{t()}))}))}(this,(()=>this.$r())):this.$r(),O(this.config._onCapture)&&this.config._onCapture!==na&&(ke.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(e=>this.config._onCapture(e.event,e)))),this.config.ip&&ke.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}hi(e){var t,i,r,s,n,a,o,l;if(!c||!c.body)return ke.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.hi(e)}),500);this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=E(e.supportedCompression,Qt.GZipJS)?Qt.GZipJS:E(e.supportedCompression,Qt.Base64)?Qt.Base64:void 0),null!=(t=e.analytics)&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.cr?this.cr:"identified_only"}),null==(i=this.siteApps)||i.onRemoteConfig(e),null==(r=this.sessionRecording)||r.onRemoteConfig(e),null==(s=this.autocapture)||s.onRemoteConfig(e),null==(n=this.heatmaps)||n.onRemoteConfig(e),this.surveys.onRemoteConfig(e),null==(a=this.webVitalsAutocapture)||a.onRemoteConfig(e),null==(o=this.exceptionObserver)||o.onRemoteConfig(e),this.exceptions.onRemoteConfig(e),null==(l=this.deadClicksAutocapture)||l.onRemoteConfig(e)}$r(){try{this.config.loaded(this)}catch(r){ke.critical("`loaded` function failed",r)}this.kr(),this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||"always"===this.config.cookieless_mode)&&this.Pr()}),1),new Rn(this).load(),this.featureFlags.flags()}kr(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this.br)||e.enable())}_dom_loaded(){this.is_capturing()&&Fe(this.__request_queue,(e=>this.wr(e))),this.__request_queue=[],this.kr()}_handle_unload(){var e,t;this.config.request_batching?(this.Tr()&&this.capture("$pageleave"),null==(e=this.br)||e.unload(),null==(t=this.Sr)||t.unload()):this.Tr()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}ui(e){this.__loaded&&(oa?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=Vs(e.url,{ip:this.config.ip?1:0}),e.headers=y({},this.config.request_headers),e.compression="best-available"===e.compression?this.compression:e.compression,e.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(e=>{var t,i,r,s=y({},e);s.timeout=s.timeout||6e4,s.url=Vs(s.url,{_:(new Date).getTime().toString(),ver:_.LIB_VERSION,compression:s.compression});var n=null!==(t=s.transport)&&void 0!==t?t:"fetch",a=Xs.filter((e=>!s.disableTransport||!e.transport||!s.disableTransport.includes(e.transport))),o=null!==(i=null==(r=je(a,(e=>e.transport===n)))?void 0:r.method)&&void 0!==i?i:a[0].method;if(!o)throw new Error("No available transport method");o(s)})(y({},e,{callback:t=>{var i,r;this.rateLimiter.checkForLimiting(t),t.statusCode>=400&&(null==(i=(r=this.config).on_request_error)||i.call(r,t)),null==e.callback||e.callback(t)}}))))}wr(e){this.Sr?this.Sr.retriableRequest(e):this.ui(e)}_execute_array(e){var t,i=[],r=[],s=[];Fe(e,(e=>{e&&(t=e[0],F(t)?s.push(e):O(e)?e.call(this):F(e)&&"alias"===t?i.push(e):F(e)&&-1!==t.indexOf("capture")&&O(this[t])?s.push(e):r.push(e))}));var n=function(e,t){Fe(e,(function(e){if(F(e[0])){var i=t;Oe(e,(function(e){i=i[e[0]].apply(i,e.slice(1))}))}else this[e[0]].apply(this,e.slice(1))}),t)};n(i,this),n(r,this),n(s,this)}Er(){var e,t;return(null==(e=this.config.bootstrap)?void 0:e.featureFlags)&&Object.keys(null==(t=this.config.bootstrap)?void 0:t.featureFlags).length>0||!1}push(e){this._execute_array([e])}capture(e,t,i){var r;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.br){if(this.is_capturing())if(!T(e)&&A(e)){if(this.config.opt_out_useragent_filter||!this._is_bot()){var s=null!=i&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==s||!s.isRateLimited){null!=t&&t.$current_url&&!A(null==t?void 0:t.$current_url)&&(ke.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==t||delete t.$current_url),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var n=new Date,a=(null==i?void 0:i.timestamp)||n,o=gi(),l={uuid:o,event:e,properties:this.calculateEventProperties(e,t||{},a,o)};s&&(l.properties.$lib_rate_limit_remaining_tokens=s.remainingTokens),(null==i?void 0:i.$set)&&(l.$set=null==i?void 0:i.$set);var c,u=this.Ir(null==i?void 0:i.$set_once);if(u&&(l.$set_once=u),(l=function(e,t){return i=e,r=e=>A(e)&&!D(t)?e.slice(0,t):e,s=new Set,function e(t,i){return t!==Object(t)?r?r(t):t:s.has(t)?void 0:(s.add(t),F(t)?(n=[],Fe(t,(t=>{n.push(e(t))}))):(n={},Oe(t,((t,i)=>{s.has(t)||(n[i]=e(t,i))}))),n);var n}(i);var i,r,s}(l,null!=i&&i._noTruncate?null:this.config.properties_string_max_length)).timestamp=a,T(null==i?void 0:i.timestamp)||(l.properties.$event_time_override_provided=!0,l.properties.$event_time_override_system_time=n),e===vn.DISMISSED||e===vn.SENT){var h=null==t?void 0:t[_n.SURVEY_ID],d=null==t?void 0:t[_n.SURVEY_ITERATION];c={id:h,current_iteration:d},localStorage.getItem(xn(c))||localStorage.setItem(xn(c),"true"),l.$set=y({},l.$set,{[En({id:h,current_iteration:d},e===vn.SENT?"responded":"dismissed")]:!0})}var p=y({},l.properties.$set,l.$set);if(C(p)||this.setPersonPropertiesForFlags(p),!L(this.config.before_send)){var g=this.Rr(l);if(!g)return;l=g}this.hr.emit("eventCaptured",l);var v={method:"POST",url:null!==(r=null==i?void 0:i._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:l,compression:"best-available",batchKey:null==i?void 0:i._batchKey};return!this.config.request_batching||i&&(null==i||!i._batchKey)||null!=i&&i.send_instantly?this.wr(v):this.br.enqueue(v),l}ke.critical("This capture call is ignored due to client rate limiting.")}}else ke.error("No event name provided to posthog.capture")}else ke.uninitializedWarning("posthog.capture")}Ri(e){return this.on("eventCaptured",(t=>e(t.event,t)))}calculateEventProperties(e,t,i,r,s){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return t;var n=s?void 0:this.persistence.remove_event_timer(e),a=y({},t);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,("always"==this.config.cookieless_mode||"on_reject"==this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut())&&(a.$cookieless_mode=!0),"$snapshot"===e){var o=y({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=o.distinct_id,(!A(a.distinct_id)&&!N(a.distinct_id)||M(a.distinct_id))&&ke.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var l,u=rs(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:h,windowId:d}=this.sessionManager.checkAndGetSessionAndWindowId(s,i.getTime());a.$session_id=h,a.$window_id=d}this.sessionPropsManager&&Re(a,this.sessionPropsManager.getSessionProps());try{var p;this.sessionRecording&&Re(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=null==(p=this.Sr)?void 0:p.length}catch(e){a.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===zn.CUSTOM&&(a.$lib_custom_api_host=this.config.api_host),l="$pageview"!==e||s?"$pageleave"!==e||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,r),a=Re(a,l),"$pageview"===e&&c&&(a.title=c.title),!T(n)){var v=i.getTime()-n;a.$duration=parseFloat((v/1e3).toFixed(3))}g&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=Re({},u,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),F(this.config.property_denylist)?Oe(this.config.property_denylist,(function(e){delete a[e]})):ke.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var _=this.config.sanitize_properties;_&&(ke.error("sanitize_properties is deprecated. Use before_send instead"),a=_(a,e));var f=this.Cr();return a.$process_person_profile=f,f&&!s&&this.Or("_calculate_event_properties"),a}Ir(e){var t;if(!this.persistence||!this.Cr())return e;if(this.ur)return e;var i=this.persistence.get_initial_props(),r=null==(t=this.sessionPropsManager)?void 0:t.getSetOnceProps(),s=Re({},i,r||{},e||{}),n=this.config.sanitize_properties;return n&&(ke.error("sanitize_properties is deprecated. Use before_send instead"),s=n(s,"$set_once")),this.ur=!0,C(s)?void 0:s}register(e,t){var i;null==(i=this.persistence)||i.register(e,t)}register_once(e,t,i){var r;null==(r=this.persistence)||r.register_once(e,t,i)}register_for_session(e){var t;null==(t=this.sessionPersistence)||t.register(e)}unregister(e){var t;null==(t=this.persistence)||t.unregister(e)}unregister_for_session(e){var t;null==(t=this.sessionPersistence)||t.unregister(e)}Fr(e,t){this.register({[e]:t})}getFeatureFlag(e,t){return this.featureFlags.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t=this.featureFlags.getFeatureFlagPayload(e);try{return JSON.parse(t)}catch(e){return t}}isFeatureEnabled(e,t){return this.featureFlags.isFeatureEnabled(e,t)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateEarlyAccessFeatureEnrollment(e,t,i){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t,i){return void 0===t&&(t=!1),this.featureFlags.getEarlyAccessFeatures(e,t,i)}on(e,t){return this.hr.on(e,t)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSurveysLoaded(e){return this.surveys.onSurveysLoaded(e)}onSessionId(e){var t,i;return null!==(t=null==(i=this.sessionManager)?void 0:i.onSessionId(e))&&void 0!==t?t:()=>{}}getSurveys(e,t){void 0===t&&(t=!1),this.surveys.getSurveys(e,t)}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys.getActiveMatchingSurveys(e,t)}renderSurvey(e,t){this.surveys.renderSurvey(e,t)}displaySurvey(e,t){void 0===t&&(t=Sn),this.surveys.displaySurvey(e,t)}canRenderSurvey(e){return this.surveys.canRenderSurvey(e)}canRenderSurveyAsync(e,t){return void 0===t&&(t=!1),this.surveys.canRenderSurveyAsync(e,t)}identify(e,t,i){if(!this.__loaded||!this.persistence)return ke.uninitializedWarning("posthog.identify");if(N(e)&&(e=e.toString(),ke.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),e)if(["distinct_id","distinctid"].includes(e.toLowerCase()))ke.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if(e!==ft){if(this.Or("posthog.identify")){var r=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var s=r;this.register_once({$had_persisted_distinct_id:!0,$device_id:s},"")}e!==r&&e!==this.get_property(He)&&(this.unregister(He),this.register({distinct_id:e}));var n="anonymous"===(this.persistence.get_property(ct)||"anonymous");e!==r&&n?(this.persistence.set_property(ct,"identified"),this.setPersonPropertiesForFlags(y({},i||{},t||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:r},{$set:t||{},$set_once:i||{}}),this.pr=Ks(e,t,i),this.featureFlags.setAnonymousDistinctId(r)):(t||i)&&this.setPersonProperties(t,i),e!==r&&(this.reloadFeatureFlags(),this.unregister(lt))}}else ke.critical('The string "'+ft+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else ke.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,t){if((e||t)&&this.Or("posthog.setPersonProperties")){var i=Ks(this.get_distinct_id(),e,t);this.pr!==i?(this.setPersonPropertiesForFlags(y({},t||{},e||{})),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.pr=i):ke.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,i){if(e&&t){if(this.Or("posthog.group")){var r=this.getGroups();r[e]!==t&&this.resetGroupPropertiesForFlags(e),this.register({$groups:y({},r,{[e]:t})}),i&&(this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:i}),this.setGroupPropertiesForFlags({[e]:i})),r[e]===t||i||this.reloadFeatureFlags()}}else ke.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0),this.featureFlags.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0),this.Or("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,t)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var t,i,r,s;if(ke.info("reset"),!this.__loaded)return ke.uninitializedWarning("posthog.reset");var n=this.get_property("$device_id");if(this.consent.reset(),null==(t=this.persistence)||t.clear(),null==(i=this.sessionPersistence)||i.clear(),this.surveys.reset(),this.featureFlags.reset(),null==(r=this.persistence)||r.set_property(ct,"anonymous"),null==(s=this.sessionManager)||s.resetSessionId(),this.pr=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:ft,$device_id:null},"");else{var a=this.config.get_device_id(gi());this.register_once({distinct_id:a,$device_id:e?a:n},"")}this.register({$last_posthog_reset:(new Date).toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return null!==(e=null==(t=this.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==e?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(null!=e&&e.withTimestamp&&i){var s,n=null!==(s=e.timestampLookBack)&&void 0!==s?s:10;if(!i)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return r}alias(e,t){return e===this.get_property(Ue)?(ke.critical("Attempting to create alias for existing People user - aborting."),-2):this.Or("posthog.alias")?(T(t)&&(t=this.get_distinct_id()),e!==t?(this.Fr(He,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(ke.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=y({},this.config);if(R(e)){var i,r,s,n,a;Re(this.config,ca(e));var o=this.yr();null==(i=this.persistence)||i.update_config(this.config,t,o),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new pn(y({},this.config,{persistence:"sessionStorage"}),o);var l=this.gr(this.config.debug);j(l)&&(this.config.debug=l),j(this.config.debug)&&(this.config.debug?(_.DEBUG=!0,bi.G()&&bi.Y("ph_debug","true"),ke.info("set_config",{config:e,oldConfig:t,newConfig:y({},this.config)})):(_.DEBUG=!1,bi.G()&&bi.X("ph_debug"))),null==(r=this.sessionRecording)||r.startIfEnabledOrStop(),null==(s=this.autocapture)||s.startIfEnabled(),null==(n=this.heatmaps)||n.startIfEnabled(),this.surveys.loadIfEnabled(),this.Mr(),null==(a=this.externalIntegrations)||a.startIfEnabledOrStop()}}startSessionRecording(e){var t,i,r,s,n,a=!0===e,o={sampling:a||!(null==e||!e.sampling),linked_flag:a||!(null==e||!e.linked_flag),url_trigger:a||!(null==e||!e.url_trigger),event_trigger:a||!(null==e||!e.event_trigger)};Object.values(o).some(Boolean)&&(null==(t=this.sessionManager)||t.checkAndGetSessionAndWindowId(),o.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),o.linked_flag&&(null==(r=this.sessionRecording)||r.overrideLinkedFlag()),o.url_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("url")),o.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event")));this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!(null==(e=this.sessionRecording)||!e.started)}captureException(e,t){var i=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(e,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(y({},r,t))}loadToolbar(e){return this.toolbar.loadToolbar(e)}get_property(e){var t;return null==(t=this.persistence)?void 0:t.props[e]}getSessionProperty(e){var t;return null==(t=this.sessionPersistence)?void 0:t.props[e]}toString(){var e,t=null!==(e=this.config.name)&&void 0!==e?e:aa;return t!==aa&&(t=aa+"."+t),t}_isIdentified(){var e,t;return"identified"===(null==(e=this.persistence)?void 0:e.get_property(ct))||"identified"===(null==(t=this.sessionPersistence)?void 0:t.get_property(ct))}Cr(){var e,t;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&C(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[He])&&(null==(t=this.persistence)||null==(t=t.props)||!t[vt]))}Tr(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&(!0===this.config.capture_pageview||"history_change"===this.config.capture_pageview)}createPersonProfile(){this.Cr()||this.Or("posthog.createPersonProfile")&&this.setPersonProperties({},{})}Or(e){return"never"===this.config.person_profiles?(ke.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Fr(vt,!0),!0)}yr(){if("always"===this.config.cookieless_mode)return!0;var e=this.consent.isOptedOut(),t=this.config.opt_out_persistence_by_default||"on_reject"===this.config.cookieless_mode;return this.config.disable_persistence||e&&!!t}Mr(){var e,t,i,r,s=this.yr();return(null==(e=this.persistence)?void 0:e.gi)!==s&&(null==(i=this.persistence)||i.set_disabled(s)),(null==(t=this.sessionPersistence)?void 0:t.gi)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s)),s}opt_in_capturing(e){var t,i;"always"!==this.config.cookieless_mode?("on_reject"===this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut()&&(this.reset(!0),null==(t=this.sessionManager)||t.destroy(),this.sessionManager=new qn(this),this.persistence&&(this.sessionPropsManager=new Nn(this,this.sessionManager,this.persistence)),this.sessionRecording=new ra(this),this.sessionRecording.startIfEnabledOrStop()),this.consent.optInOut(!0),this.Mr(),this.kr(),"on_reject"==this.config.cookieless_mode&&this.surveys.loadIfEnabled(),(T(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!==(i=null==e?void 0:e.captureEventName)&&void 0!==i?i:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Pr()):ke.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}opt_out_capturing(){var e,t;"always"!==this.config.cookieless_mode?("on_reject"===this.config.cookieless_mode&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.Mr(),"on_reject"===this.config.cookieless_mode&&(this.register({distinct_id:ft,$device_id:null}),null==(e=this.sessionManager)||e.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,null==(t=this.sessionRecording)||t.stopRecording(),this.sessionRecording=void 0,this.Pr())):ke.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===$i.GRANTED?"granted":e===$i.DENIED?"denied":"pending"}is_capturing(){return"always"===this.config.cookieless_mode||("on_reject"===this.config.cookieless_mode?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Mr()}_is_bot(){return l?Vn(l,this.config.custom_blocked_useragents):void 0}Pr(){c&&("visible"===c.visibilityState?this.dr||(this.dr=!0,this.capture("$pageview",{title:c.title},{send_instantly:!0}),this.vr&&(c.removeEventListener("visibilitychange",this.vr),this.vr=null)):this.vr||(this.vr=this.Pr.bind(this),qe(c,"visibilitychange",this.vr)))}debug(e){!1===e?(null==r||r.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==r||r.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}L(){var e,t,i,r,s,n,a=this._r||{};return"advanced_disable_flags"in a?!!a.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(ke.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(i="advanced_disable_decide",r=ke,s=(t="advanced_disable_flags")in(e=a)&&!T(e[t]),n=i in e&&!T(e[i]),s?e[t]:!!n&&(r&&r.warn("Config field '"+i+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[i]))}Rr(e){if(L(this.config.before_send))return e;var t=F(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e;for(var r of t){if(i=r(i),L(i)){var s="Event '"+e.event+"' was rejected in beforeSend function";return q(e.event)?ke.warn(s+". This can cause unexpected behavior."):ke.info(s),null}i.properties&&!C(i.properties)||ke.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return i}getPageViewId(){var e;return null==(e=this.pageViewManager.Wt)?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}gr(e){var t=j(e)&&!e,i=bi.G()&&"true"===bi.J("ph_debug");return!t&&(!!i||e)}}!function(e,t){for(var i=0;i<t.length;i++)e.prototype[t[i]]=Me(e.prototype[t[i]])}(ha,["identify"]);var da,pa=(da=sa[aa]=new ha,function(){function e(){e.done||(e.done=!0,oa=!1,Oe(sa,(function(e){e._dom_loaded()})))}null!=c&&c.addEventListener?"complete"===c.readyState?e():qe(c,"DOMContentLoaded",e,{capture:!1}):r&&ke.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),da)}}]);