posthog-js 1.273.0 → 1.273.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/array.full.es5.js +1 -1
- package/dist/array.full.es5.js.map +1 -1
- package/dist/array.full.js +1 -1
- package/dist/array.full.js.map +1 -1
- package/dist/array.full.no-external.js +1 -1
- package/dist/array.full.no-external.js.map +1 -1
- package/dist/array.js +1 -1
- package/dist/array.js.map +1 -1
- package/dist/array.no-external.js +1 -1
- package/dist/array.no-external.js.map +1 -1
- package/dist/customizations.full.js +1 -1
- package/dist/lazy-recorder.js +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/module.full.js +1 -1
- package/dist/module.full.js.map +1 -1
- package/dist/module.full.no-external.js +1 -1
- package/dist/module.full.no-external.js.map +1 -1
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/dist/module.no-external.js +1 -1
- package/dist/module.no-external.js.map +1 -1
- package/dist/posthog-recorder.js +1 -1
- package/lib/package.json +1 -1
- package/lib/src/extensions/replay/sessionrecording-wrapper.js +4 -2
- package/lib/src/extensions/replay/sessionrecording-wrapper.js.map +1 -1
- package/package.json +1 -1
package/dist/array.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(){"use strict";var t="undefined"!=typeof window?window:void 0,i="undefined"!=typeof globalThis?globalThis:t,e=Array.prototype,r=e.forEach,s=e.indexOf,n=null==i?void 0:i.navigator,o=null==i?void 0:i.document,a=null==i?void 0:i.location,l=null==i?void 0:i.fetch,h=null!=i&&i.XMLHttpRequest&&"withCredentials"in new i.XMLHttpRequest?i.XMLHttpRequest:void 0,u=null==i?void 0:i.AbortController,d=null==n?void 0:n.userAgent,v=null!=t?t:{},c={DEBUG:!1,LIB_VERSION:"1.273.0"};function f(t,i,e,r,s,n,o){try{var a=t[n](o),l=a.value}catch(t){return void e(t)}a.done?i(l):Promise.resolve(l).then(r,s)}function p(t){return function(){var i=this,e=arguments;return new Promise((function(r,s){var n=t.apply(i,e);function o(t){f(n,r,s,o,a,"next",t)}function a(t){f(n,r,s,o,a,"throw",t)}o(void 0)}))}}function g(){return g=Object.assign?Object.assign.bind():function(t){for(var i=1;i<arguments.length;i++){var e=arguments[i];for(var r in e)({}).hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},g.apply(null,arguments)}function _(t,i){if(null==t)return{};var e={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==i.indexOf(r))continue;e[r]=t[r]}return e}var m=["$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 y(t,i){return-1!==t.indexOf(i)}var b=function(t){return t.trim()},w=function(t){return t.replace(/^\$/,"")};var S=Array.isArray,k=Object.prototype,x=k.hasOwnProperty,E=k.toString,R=S||function(t){return"[object Array]"===E.call(t)},I=t=>"function"==typeof t,P=t=>t===Object(t)&&!R(t),T=t=>{if(P(t)){for(var i in t)if(x.call(t,i))return!1;return!0}return!1},C=t=>void 0===t,M=t=>"[object String]"==E.call(t),O=t=>M(t)&&0===t.trim().length,F=t=>null===t,A=t=>C(t)||F(t),D=t=>"[object Number]"==E.call(t),j=t=>"[object Boolean]"===E.call(t),L=t=>t instanceof FormData,N=t=>y(m,t);function U(t){return null===t||"object"!=typeof t}function z(t,i){return Object.prototype.toString.call(t)==="[object "+i+"]"}function B(t){return!C(Event)&&function(t,i){try{return t instanceof i}catch(t){return!1}}(t,Event)}var q=[!0,"true",1,"1","yes"],H=t=>y(q,t),W=[!1,"false",0,"0","no"];function G(t,i,e,r,s){return i>e&&(r.warn("min cannot be greater than max."),i=e),D(t)?t>e?(r.warn(" cannot be greater than max: "+e+". Using max value instead."),e):t<i?(r.warn(" cannot be less than min: "+i+". Using min value instead."),i):t:(r.warn(" must be a number. using max or fallback. max: "+e+", fallback: "+s),G(s||e,i,e,r))}class V{constructor(t){this.t=t,this.i={},this.o=()=>{Object.keys(this.i).forEach((t=>{var i=this.h(t)+this.m;i>=this.S?delete this.i[t]:this.k(t,i)}))},this.h=t=>this.i[String(t)],this.k=(t,i)=>{this.i[String(t)]=i},this.consumeRateLimit=t=>{var i,e,r=null!==(i=this.h(t))&&void 0!==i?i:this.S;if(0===(r=Math.max(r-1,0)))return!0;this.k(t,r);var s=0===r;return s&&(null==(e=this.$)||e.call(this,t)),s},this.$=this.t.$,this.S=G(this.t.bucketSize,0,100,this.t.R),this.m=G(this.t.refillRate,0,this.S,this.t.R),this.I=G(this.t.refillInterval,0,864e5,this.t.R),this.P=setInterval((()=>{this.o()}),this.I)}stop(){this.P&&(clearInterval(this.P),this.P=void 0)}}var J,K,Y,X=t=>t instanceof Error;function Q(t){var i=globalThis._posthogChunkIds;if(i){var e=Object.keys(i);return Y&&e.length===K||(K=e.length,Y=e.reduce(((e,r)=>{J||(J={});var s=J[r];if(s)e[s[0]]=s[1];else for(var n=t(r),o=n.length-1;o>=0;o--){var a=n[o],l=null==a?void 0:a.filename,h=i[r];if(l&&h){e[l]=h,J[r]=[l,h];break}}return e}),{})),Y}}var Z="?";function tt(t,i,e,r){var s={platform:"web:javascript",filename:t,function:"<anonymous>"===i?Z:i,in_app:!0};return C(e)||(s.lineno=e),C(r)||(s.colno=r),s}var it=(t,i)=>{var e=-1!==t.indexOf("safari-extension"),r=-1!==t.indexOf("safari-web-extension");return e||r?[-1!==t.indexOf("@")?t.split("@")[0]:Z,e?"safari-extension:"+i:"safari-web-extension:"+i]:[t,i]},et=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,rt=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,st=/\((\S*)(?::(\d+))(?::(\d+))\)/,nt=t=>{var i=et.exec(t);if(i){var[,e,r,s]=i;return tt(e,Z,+r,+s)}var n=rt.exec(t);if(n){if(n[2]&&0===n[2].indexOf("eval")){var o=st.exec(n[2]);o&&(n[2]=o[1],n[3]=o[2],n[4]=o[3])}var[a,l]=it(n[1]||Z,n[2]);return tt(l,a,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}},ot=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,at=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,lt=t=>{var i=ot.exec(t);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var e=at.exec(i[3]);e&&(i[1]=i[1]||"eval",i[3]=e[1],i[4]=e[2],i[5]="")}var r=i[3],s=i[1]||Z;return[s,r]=it(s,r),tt(r,s,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},ht=/\(error: (.*)\)/,ut=50;function dt(){for(var t=arguments.length,i=new Array(t),e=0;e<t;e++)i[e]=arguments[e];return function(t,e){void 0===e&&(e=0);for(var r=[],s=t.split("\n"),n=e;n<s.length;n++){var o=s[n];if(!(o.length>1024)){var a=ht.test(o)?o.replace(ht,"$1"):o;if(!a.match(/\S*Error: /)){for(var l of i){var h=l(a);if(h){r.push(h);break}}if(r.length>=ut)break}}}return function(t){if(!t.length)return[];var i=Array.from(t);return i.reverse(),i.slice(0,ut).map((t=>{return g({},t,{filename:t.filename||(e=i,e[e.length-1]||{}).filename,function:t.function||Z});var e}))}(r)}}class vt{constructor(t,i,e){void 0===t&&(t=[]),void 0===i&&(i=[]),void 0===e&&(e=[]),this.coercers=t,this.modifiers=e,this.stackParser=dt(...i)}buildFromUnknown(t,i){void 0===i&&(i={});var e=i&&i.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(e,i,0).apply(t),s=this.buildParsingContext(),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,e),$exception_level:"error"}}modifyFrames(t){var i=this;return p((function*(){for(var e of t)e.stacktrace&&e.stacktrace.frames&&R(e.stacktrace.frames)&&(e.stacktrace.frames=yield i.applyModifiers(e.stacktrace.frames));return t}))()}coerceFallback(t){var i;return{type:"Error",value:"Unknown error",stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}parseStacktrace(t,i){var e,r;return null!=t.cause&&(e=this.parseStacktrace(t.cause,i)),""!=t.stack&&null!=t.stack&&(r=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?1:0),i.chunkIdMap)),g({},t,{cause:e,stack:r})}applyChunkIds(t,i){return t.map((t=>(t.filename&&i&&(t.chunk_id=i[t.filename]),t)))}applyCoercers(t,i){for(var e of this.coercers)if(e.match(t))return e.coerce(t,i);return this.coerceFallback(i)}applyModifiers(t){var i=this;return p((function*(){var e=t;for(var r of i.modifiers)e=yield r(e);return e}))()}convertToExceptionList(t,i){var e,r,s,n={type:t.type,value:t.value,mechanism:{type:null!==(e=i.type)&&void 0!==e?e:"generic",handled:null===(r=i.handled)||void 0===r||r,synthetic:null!==(s=t.synthetic)&&void 0!==s&&s}};t.stack&&(n.stacktrace={type:"raw",frames:t.stack});var o=[n];return null!=t.cause&&o.push(...this.convertToExceptionList(t.cause,g({},i,{handled:!0}))),o}buildParsingContext(){return{chunkIdMap:Q(this.stackParser)}}buildCoercingContext(t,i,e){void 0===e&&(e=0);var r=(e,r)=>{if(r<=4){var s=this.buildCoercingContext(t,i,r);return this.applyCoercers(e,s)}};return g({},i,{syntheticException:0==e?i.syntheticException:void 0,mechanism:t,apply:t=>r(t,e),next:t=>r(t,e+1)})}}class ct{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,i){var e=M(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:e?t.stack:void 0,cause:t.cause?i.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var i=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?i+": "+t.message:i}isDOMException(t){return z(t,"DOMException")}isDOMError(t){return z(t,"DOMError")}}class ft{match(t){return(t=>t instanceof Error)(t)}coerce(t,i){return{type:this.getType(t),value:this.getMessage(t,i),stack:this.getStack(t),cause:t.cause?i.next(t.cause):void 0,synthetic:!1}}getType(t){return t.name||t.constructor.name}getMessage(t,i){var e=t.message;return e.error&&"string"==typeof e.error.message?String(e.error.message):String(e)}getStack(t){return t.stacktrace||t.stack||void 0}}class pt{constructor(){}match(t){return z(t,"ErrorEvent")&&null!=t.error}coerce(t,i){var e,r=i.apply(t.error);return r||{type:"ErrorEvent",value:t.message,stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}var gt=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class _t{match(t){return"string"==typeof t}coerce(t,i){var e,[r,s]=this.getInfos(t);return{type:null!=r?r:"Error",value:null!=s?s:t,stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}getInfos(t){var i="Error",e=t,r=t.match(gt);return r&&(i=r[1],e=r[2]),[i,e]}}var mt=["fatal","error","warning","log","info","debug"];function yt(t,i){void 0===i&&(i=40);var e=Object.keys(t);if(e.sort(),!e.length)return"[object has no keys]";for(var r=e.length;r>0;r--){var s=e.slice(0,r).join(", ");if(!(s.length>i))return r===e.length||s.length<=i?s:s.slice(0,i)+"..."}return""}class bt{match(t){return"object"==typeof t&&null!==t}coerce(t,i){var e,r=this.getErrorPropertyFromObject(t);return r?i.apply(r):{type:this.getType(t),value:this.getValue(t),stack:null==(e=i.syntheticException)?void 0:e.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return B(t)?t.constructor.name:"Error"}getValue(t){if("name"in t&&"string"==typeof t.name){var i="'"+t.name+"' captured as exception";return"message"in t&&"string"==typeof t.message&&(i+=" with message: '"+t.message+"'"),i}if("message"in t&&"string"==typeof t.message)return t.message;var e=this.getObjectClassName(t);return(e&&"Object"!==e?"'"+e+"'":"Object")+" captured as exception with keys: "+yt(t)}isSeverityLevel(t){return M(t)&&!O(t)&&mt.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var e=t[i];if(X(e))return e}}getObjectClassName(t){try{var i=Object.getPrototypeOf(t);return i?i.constructor.name:void 0}catch(t){return}}}class wt{match(t){return B(t)}coerce(t,i){var e,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+yt(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}class St{match(t){return U(t)}coerce(t,i){var e;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}class kt{match(t){return z(t,"PromiseRejectionEvent")}coerce(t,i){var e,r=this.getUnhandledRejectionReason(t);return U(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}:i.apply(r)}getUnhandledRejectionReason(t){if(U(t))return t;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch(t){}return t}}var $t=i=>{var e={T:function(e){if(t&&(c.DEBUG||v.POSTHOG_DEBUG)&&!C(t.console)&&t.console){for(var r=("__rrweb_original__"in t.console[e]?t.console[e].__rrweb_original__:t.console[e]),s=arguments.length,n=new Array(s>1?s-1:0),o=1;o<s;o++)n[o-1]=arguments[o];r(i,...n)}},info:function(){for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];e.T("log",...i)},warn:function(){for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];e.T("warn",...i)},error:function(){for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];e.T("error",...i)},critical:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];console.error(i,...e)},uninitializedWarning:t=>{e.error("You must initialize PostHog before calling "+t)},createLogger:t=>$t(i+" "+t)};return e},xt=$t("[PostHog.js]"),Et=xt.createLogger,Rt=Et("[ExternalScriptsLoader]"),It=(t,i,e)=>{if(t.config.disable_external_dependency_loading)return Rt.warn(i+" was requested but loading of external scripts is disabled."),e("Loading of external scripts is disabled");var r=null==o?void 0:o.querySelectorAll("script");if(r)for(var s,n=function(){if(r[a].src===i){var t=r[a];return t.__posthog_loading_callback_fired?{v:e()}:(t.addEventListener("load",(i=>{t.__posthog_loading_callback_fired=!0,e(void 0,i)})),t.onerror=t=>e(t),{v:void 0})}},a=0;a<r.length;a++)if(s=n())return s.v;var l=()=>{if(!o)return e("document not found");var r=o.createElement("script");if(r.type="text/javascript",r.crossOrigin="anonymous",r.src=i,r.onload=t=>{r.__posthog_loading_callback_fired=!0,e(void 0,t)},r.onerror=t=>e(t),t.config.prepare_external_dependency_script&&(r=t.config.prepare_external_dependency_script(r)),!r)return e("prepare_external_dependency_script returned null");var s,n=o.querySelectorAll("body > script");n.length>0?null==(s=n[0].parentNode)||s.insertBefore(r,n[0]):o.body.appendChild(r)};null!=o&&o.body?l():null==o||o.addEventListener("DOMContentLoaded",l)};v.__PosthogExtensions__=v.__PosthogExtensions__||{},v.__PosthogExtensions__.loadExternalDependency=(t,i,e)=>{var r="/static/"+i+".js?v="+t.version;if("remote-config"===i&&(r="/array/"+t.config.token+"/config.js"),"toolbar"===i){var s=3e5;r=r+"&t="+Math.floor(Date.now()/s)*s}var n=t.requestRouter.endpointFor("assets",r);It(t,n,e)},v.__PosthogExtensions__.loadSiteApp=(t,i,e)=>{var r=t.requestRouter.endpointFor("api",i);It(t,r,e)};var Pt={};function Tt(t,i,e){if(R(t))if(r&&t.forEach===r)t.forEach(i,e);else if("length"in t&&t.length===+t.length)for(var s=0,n=t.length;s<n;s++)if(s in t&&i.call(e,t[s],s)===Pt)return}function Ct(t,i,e){if(!A(t)){if(R(t))return Tt(t,i,e);if(L(t)){for(var r of t.entries())if(i.call(e,r[1],r[0])===Pt)return}else for(var s in t)if(x.call(t,s)&&i.call(e,t[s],s)===Pt)return}}var Mt=function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;r<i;r++)e[r-1]=arguments[r];return Tt(e,(function(i){for(var e in i)void 0!==i[e]&&(t[e]=i[e])})),t},Ot=function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;r<i;r++)e[r-1]=arguments[r];return Tt(e,(function(i){Tt(i,(function(i){t.push(i)}))})),t};function Ft(t){for(var i=Object.keys(t),e=i.length,r=new Array(e);e--;)r[e]=[i[e],t[i[e]]];return r}var At=function(t){try{return t()}catch(t){return}},Dt=function(t){return function(){try{for(var i=arguments.length,e=new Array(i),r=0;r<i;r++)e[r]=arguments[r];return t.apply(this,e)}catch(t){xt.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),xt.critical(t)}}},jt=function(t){var i={};return Ct(t,(function(t,e){(M(t)&&t.length>0||D(t))&&(i[e]=t)})),i};function Lt(t,i){return e=t,r=t=>M(t)&&!F(i)?t.slice(0,i):t,s=new Set,function t(i,e){return i!==Object(i)?r?r(i,e):i:s.has(i)?void 0:(s.add(i),R(i)?(n=[],Tt(i,(i=>{n.push(t(i))}))):(n={},Ct(i,((i,e)=>{s.has(i)||(n[e]=t(i,e))}))),n);var n}(e);var e,r,s}var Nt=["herokuapp.com","vercel.app","netlify.app"];function Ut(t){var i=null==t?void 0:t.hostname;if(!M(i))return!1;var e=i.split(".").slice(-2).join(".");for(var r of Nt)if(e===r)return!1;return!0}function zt(t,i){for(var e=0;e<t.length;e++)if(i(t[e]))return t[e]}function Bt(t,i,e,r){var{capture:s=!1,passive:n=!0}=null!=r?r:{};null==t||t.addEventListener(i,e,{capture:s,passive:n})}var qt="$people_distinct_id",Ht="__alias",Wt="__timers",Gt="$autocapture_disabled_server_side",Vt="$heatmaps_enabled_server_side",Jt="$exception_capture_enabled_server_side",Kt="$error_tracking_suppression_rules",Yt="$error_tracking_capture_extension_exceptions",Xt="$web_vitals_enabled_server_side",Qt="$dead_clicks_enabled_server_side",Zt="$web_vitals_allowed_metrics",ti="$session_recording_remote_config",ii="$session_recording_enabled_server_side",ei="$console_log_recording_enabled_server_side",ri="$session_recording_network_payload_capture",si="$session_recording_masking",ni="$session_recording_canvas_recording",oi="$replay_sample_rate",ai="$replay_minimum_duration",li="$replay_script_config",hi="$sesid",ui="$session_is_sampled",di="$session_recording_url_trigger_activated_session",vi="$session_recording_event_trigger_activated_session",ci="$enabled_feature_flags",fi="$early_access_features",pi="$feature_flag_details",gi="$stored_person_properties",_i="$stored_group_properties",mi="$surveys",yi="$surveys_activated",bi="$flag_call_reported",wi="$user_state",Si="$client_session_props",ki="$capture_rate_limit",$i="$initial_campaign_params",xi="$initial_referrer_info",Ei="$initial_person_info",Ri="$epp",Ii="__POSTHOG_TOOLBAR__",Pi="$posthog_cookieless",Ti=[qt,Ht,"__cmpns",Wt,ii,Vt,hi,ci,Kt,wi,fi,pi,_i,gi,mi,bi,Si,ki,$i,xi,Ri,Ei];function Ci(t){return t instanceof Element&&(t.id===Ii||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function Mi(t){return!!t&&1===t.nodeType}function Oi(t,i){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===i.toLowerCase()}function Fi(t){return!!t&&3===t.nodeType}function Ai(t){return!!t&&11===t.nodeType}function Di(t){return t?b(t).split(/\s+/):[]}function ji(i){var e=null==t?void 0:t.location.href;return!!(e&&i&&i.some((t=>e.match(t))))}function Li(t){var i="";switch(typeof t.className){case"string":i=t.className;break;case"object":i=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:i=""}return Di(i)}function Ni(t){return A(t)?null:b(t).split(/(\s+)/).filter((t=>re(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Ui(t){var i="";return Ki(t)&&!Yi(t)&&t.childNodes&&t.childNodes.length&&Ct(t.childNodes,(function(t){var e;Fi(t)&&t.textContent&&(i+=null!==(e=Ni(t.textContent))&&void 0!==e?e:"")})),b(i)}function zi(t){return C(t.target)?t.srcElement||null:null!=(i=t.target)&&i.shadowRoot?t.composedPath()[0]||null:t.target||null;var i}var Bi=["a","button","form","input","select","textarea","label"];function qi(t,i){if(C(i))return!0;var e,r=function(t){if(i.some((i=>t.matches(i))))return{v:!0}};for(var s of t)if(e=r(s))return e.v;return!1}function Hi(t){var i=t.parentNode;return!(!i||!Mi(i))&&i}var Wi=[".ph-no-rageclick",".ph-no-capture"];var Gi=t=>!t||Oi(t,"html")||!Mi(t),Vi=(i,e)=>{if(!t||Gi(i))return{parentIsUsefulElement:!1,targetElementList:[]};for(var r=!1,s=[i],n=i;n.parentNode&&!Oi(n,"body");)if(Ai(n.parentNode))s.push(n.parentNode.host),n=n.parentNode.host;else{var o=Hi(n);if(!o)break;if(e||Bi.indexOf(o.tagName.toLowerCase())>-1)r=!0;else{var a=t.getComputedStyle(o);a&&"pointer"===a.getPropertyValue("cursor")&&(r=!0)}s.push(o),n=o}return{parentIsUsefulElement:r,targetElementList:s}};function Ji(i,e,r,s,n){var o,a,l,h;if(void 0===r&&(r=void 0),!t||Gi(i))return!1;if(null!=(o=r)&&o.url_allowlist&&!ji(r.url_allowlist))return!1;if(null!=(a=r)&&a.url_ignorelist&&ji(r.url_ignorelist))return!1;if(null!=(l=r)&&l.dom_event_allowlist){var u=r.dom_event_allowlist;if(u&&!u.some((t=>e.type===t)))return!1}var{parentIsUsefulElement:d,targetElementList:v}=Vi(i,s);if(!function(t,i){var e=null==i?void 0:i.element_allowlist;if(C(e))return!0;var r,s=function(t){if(e.some((i=>t.tagName.toLowerCase()===i)))return{v:!0}};for(var n of t)if(r=s(n))return r.v;return!1}(v,r))return!1;if(!qi(v,null==(h=r)?void 0:h.css_selector_allowlist))return!1;var c=t.getComputedStyle(i);if(c&&"pointer"===c.getPropertyValue("cursor")&&"click"===e.type)return!0;var f=i.tagName.toLowerCase();switch(f){case"html":return!1;case"form":return(n||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(e.type)>=0;default:return d?(n||["click"]).indexOf(e.type)>=0:(n||["click"]).indexOf(e.type)>=0&&(Bi.indexOf(f)>-1||"true"===i.getAttribute("contenteditable"))}}function Ki(t){for(var i=t;i.parentNode&&!Oi(i,"body");i=i.parentNode){var e=Li(i);if(y(e,"ph-sensitive")||y(e,"ph-no-capture"))return!1}if(y(Li(t),"ph-include"))return!0;var r=t.type||"";if(M(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=t.name||t.id||"";if(M(s)){if(/^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,"")))return!1}return!0}function Yi(t){return!!(Oi(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||Oi(t,"select")||Oi(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var Xi="(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})",Qi=new RegExp("^(?:"+Xi+")$"),Zi=new RegExp(Xi),te="\\d{3}-?\\d{2}-?\\d{4}",ie=new RegExp("^("+te+")$"),ee=new RegExp("("+te+")");function re(t,i){if(void 0===i&&(i=!0),A(t))return!1;if(M(t)){if(t=b(t),(i?Qi:Zi).test((t||"").replace(/[- ]/g,"")))return!1;if((i?ie:ee).test(t))return!1}return!0}function se(t){var i=Ui(t);return re(i=(i+" "+ne(t)).trim())?i:""}function ne(t){var i="";return t&&t.childNodes&&t.childNodes.length&&Ct(t.childNodes,(function(t){var e;if(t&&"span"===(null==(e=t.tagName)?void 0:e.toLowerCase()))try{var r=Ui(t);i=(i+" "+r).trim(),t.childNodes&&t.childNodes.length&&(i=(i+" "+ne(t)).trim())}catch(t){xt.error("[AutoCapture]",t)}})),i}function oe(t){return function(t){var i=t.map((t=>{var i,e,r="";if(t.tag_name&&(r+=t.tag_name),t.attr_class)for(var s of(t.attr_class.sort(),t.attr_class))r+="."+s.replace(/"/g,"");var n=g({},t.text?{text:t.text}:{},{"nth-child":null!==(i=t.nth_child)&&void 0!==i?i:0,"nth-of-type":null!==(e=t.nth_of_type)&&void 0!==e?e:0},t.href?{href:t.href}:{},t.attr_id?{attr_id:t.attr_id}:{},t.attributes),o={};return Ft(n).sort(((t,i)=>{var[e]=t,[r]=i;return e.localeCompare(r)})).forEach((t=>{var[i,e]=t;return o[ae(i.toString())]=ae(e.toString())})),r+=":",r+=Ft(o).map((t=>{var[i,e]=t;return i+'="'+e+'"'})).join("")}));return i.join(";")}(function(t){return t.map((t=>{var i,e,r={text:null==(i=t.$el_text)?void 0:i.slice(0,400),tag_name:t.tag_name,href:null==(e=t.attr__href)?void 0:e.slice(0,2048),attr_class:le(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Ft(t).filter((t=>{var[i]=t;return 0===i.indexOf("attr__")})).forEach((t=>{var[i,e]=t;return r.attributes[i]=e})),r}))}(t))}function ae(t){return t.replace(/"|\\"/g,'\\"')}function le(t){var i=t.attr__class;return i?R(i)?i:Di(i):void 0}class he{constructor(){this.clicks=[]}isRageClick(t,i,e){var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(t-r.x)+Math.abs(i-r.y)<30&&e-r.timestamp<1e3){if(this.clicks.push({x:t,y:i,timestamp:e}),3===this.clicks.length)return!0}else this.clicks=[{x:t,y:i,timestamp:e}];return!1}}var ue="$copy_autocapture",de=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),ve=["localhost","127.0.0.1"],ce=t=>{var i=null==o?void 0:o.createElement("a");return C(i)?null:(i.href=t,i)},fe=function(t,i){var e,r;void 0===i&&(i="&");var s=[];return Ct(t,(function(t,i){C(t)||C(i)||"undefined"===i||(e=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),r=encodeURIComponent(i),s[s.length]=r+"="+e)})),s.join(i)},pe=function(t,i){for(var e,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;s<r.length;s++){var n=r[s].split("=");if(n[0]===i){e=n;break}}if(!R(e)||e.length<2)return"";var o=e[1];try{o=decodeURIComponent(o)}catch(t){xt.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},ge=function(t,i,e){if(!t||!i||!i.length)return t;for(var r=t.split("#"),s=r[0]||"",n=r[1],o=s.split("?"),a=o[1],l=o[0],h=(a||"").split("&"),u=[],d=0;d<h.length;d++){var v=h[d].split("=");R(v)&&(i.includes(v[0])?u.push(v[0]+"="+e):u.push(h[d]))}var c=l;return null!=a&&(c+="?"+u.join("&")),null!=n&&(c+="#"+n),c},_e=function(t,i){var e=t.match(new RegExp(i+"=([^&]*)"));return e?e[1]:null},me=Et("[AutoCapture]");function ye(t,i){return i.length>t?i.slice(0,t)+"...":i}function be(t){if(t.previousElementSibling)return t.previousElementSibling;var i=t;do{i=i.previousSibling}while(i&&!Mi(i));return i}function we(t,i,e,r){var s=t.tagName.toLowerCase(),n={tag_name:s};Bi.indexOf(s)>-1&&!e&&("a"===s.toLowerCase()||"button"===s.toLowerCase()?n.$el_text=ye(1024,se(t)):n.$el_text=ye(1024,Ui(t)));var o=Li(t);o.length>0&&(n.classes=o.filter((function(t){return""!==t}))),Ct(t.attributes,(function(e){var s;if((!Yi(t)||-1!==["name","id","class","aria-label"].indexOf(e.name))&&((null==r||!r.includes(e.name))&&!i&&re(e.value)&&(s=e.name,!M(s)||"_ngcontent"!==s.substring(0,10)&&"_nghost"!==s.substring(0,7)))){var o=e.value;"class"===e.name&&(o=Di(o).join(" ")),n["attr__"+e.name]=ye(1024,o)}}));for(var a=1,l=1,h=t;h=be(h);)a++,h.tagName===t.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}function Se(i,e){for(var r,s,{e:n,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:h}=e,u=[i],d=i;d.parentNode&&!Oi(d,"body");)Ai(d.parentNode)?(u.push(d.parentNode.host),d=d.parentNode.host):(u.push(d.parentNode),d=d.parentNode);var v,c=[],f={},p=!1,g=!1;if(Ct(u,(t=>{var i=Ki(t);"a"===t.tagName.toLowerCase()&&(p=t.getAttribute("href"),p=i&&p&&re(p)&&p),y(Li(t),"ph-no-capture")&&(g=!0),c.push(we(t,o,a,l));var e=function(t){if(!Ki(t))return{};var i={};return Ct(t.attributes,(function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){var e=t.name.replace("data-ph-capture-attribute-",""),r=t.value;e&&r&&re(r)&&(i[e]=r)}})),i}(t);Mt(f,e)})),g)return{props:{},explicitNoCapture:g};if(a||("a"===i.tagName.toLowerCase()||"button"===i.tagName.toLowerCase()?c[0].$el_text=se(i):c[0].$el_text=Ui(i)),p){var _,m;c[0].attr__href=p;var b=null==(_=ce(p))?void 0:_.host,w=null==t||null==(m=t.location)?void 0:m.host;b&&w&&b!==w&&(v=p)}return{props:Mt({$event_type:n.type,$ce_version:1},h?{}:{$elements:c},{$elements_chain:oe(c)},null!=(r=c[0])&&r.$el_text?{$el_text:null==(s=c[0])?void 0:s.$el_text}:{},v&&"click"===n.type?{$external_click_url:v}:{},f)}}class ke{constructor(t){this.C=!1,this.M=null,this.rageclicks=new he,this.O=!1,this.instance=t,this.F=null}get A(){var t,i,e=P(this.instance.config.autocapture)?this.instance.config.autocapture:{};return e.url_allowlist=null==(t=e.url_allowlist)?void 0:t.map((t=>new RegExp(t))),e.url_ignorelist=null==(i=e.url_ignorelist)?void 0:i.map((t=>new RegExp(t))),e}D(){if(this.isBrowserSupported()){if(t&&o){var i=i=>{i=i||(null==t?void 0:t.event);try{this.j(i)}catch(t){me.error("Failed to capture event",t)}};if(Bt(o,"submit",i,{capture:!0}),Bt(o,"change",i,{capture:!0}),Bt(o,"click",i,{capture:!0}),this.A.capture_copied_text){var e=i=>{i=i||(null==t?void 0:t.event),this.j(i,ue)};Bt(o,"copy",e,{capture:!0}),Bt(o,"cut",e,{capture:!0})}}}else me.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.C&&(this.D(),this.C=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this.O=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[Gt]:!!t.autocapture_opt_out}),this.M=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this.F=t}getElementSelectors(t){var i,e=[];return null==(i=this.F)||i.forEach((i=>{var r=null==o?void 0:o.querySelectorAll(i);null==r||r.forEach((r=>{t===r&&e.push(i)}))})),e}get isEnabled(){var t,i,e=null==(t=this.instance.persistence)?void 0:t.props[Gt],r=this.M;if(F(r)&&!j(e)&&!this.instance.L())return!1;var s=null!==(i=this.M)&&void 0!==i?i:!!e;return!!this.instance.config.autocapture&&!s}j(i,e){if(void 0===e&&(e="$autocapture"),this.isEnabled){var r,s=zi(i);if(Fi(s)&&(s=s.parentNode||null),"$autocapture"===e&&"click"===i.type&&i instanceof MouseEvent)this.instance.config.rageclick&&null!=(r=this.rageclicks)&&r.isRageClick(i.clientX,i.clientY,(new Date).getTime())&&function(i,e){if(!t||Gi(i))return!1;var r,s;if(!1===(r=j(e)?!!e&&Wi:null!==(s=null==e?void 0:e.css_selector_ignorelist)&&void 0!==s?s:Wi))return!1;var{targetElementList:n}=Vi(i,!1);return!qi(n,r)}(s,this.instance.config.rageclick)&&this.j(i,"$rageclick");var n=e===ue;if(s&&Ji(s,i,this.A,n,n?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=Se(s,{e:i,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.A.element_attribute_ignorelist,elementsChainAsString:this.O});if(a)return!1;var l=this.getElementSelectors(s);if(l&&l.length>0&&(o.$element_selectors=l),e===ue){var h,u=Ni(null==t||null==(h=t.getSelection())?void 0:h.toString()),d=i.type||"clipboard";if(!u)return!1;o.$selected_content=u,o.$copy_type=d}return this.instance.capture(e,o),!0}}}isBrowserSupported(){return I(null==o?void 0:o.querySelectorAll)}}Math.trunc||(Math.trunc=function(t){return t<0?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return D(t)&&isFinite(t)&&Math.floor(t)===t});var $e="0123456789abcdef";class xe{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,i,e,r){if(!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(e)||!Number.isInteger(r)||t<0||i<0||e<0||r<0||t>0xffffffffffff||i>4095||e>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=t/Math.pow(2,40),s[1]=t/Math.pow(2,32),s[2]=t/Math.pow(2,24),s[3]=t/Math.pow(2,16),s[4]=t/Math.pow(2,8),s[5]=t,s[6]=112|i>>>8,s[7]=i,s[8]=128|e>>>24,s[9]=e>>>16,s[10]=e>>>8,s[11]=e,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new xe(s)}toString(){for(var t="",i=0;i<this.bytes.length;i++)t=t+$e.charAt(this.bytes[i]>>>4)+$e.charAt(15&this.bytes[i]),3!==i&&5!==i&&7!==i&&9!==i||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new xe(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(var i=0;i<16;i++){var e=this.bytes[i]-t.bytes[i];if(0!==e)return Math.sign(e)}return 0}}class Ee{constructor(){this.N=0,this.U=0,this.B=new Pe}generate(){var t=this.generateOrAbort();if(C(t)){this.N=0;var i=this.generateOrAbort();if(C(i))throw new Error("Could not generate UUID after timestamp reset");return i}return t}generateOrAbort(){var t=Date.now();if(t>this.N)this.N=t,this.q();else{if(!(t+1e4>this.N))return;this.U++,this.U>4398046511103&&(this.N++,this.q())}return xe.fromFieldsV7(this.N,Math.trunc(this.U/Math.pow(2,30)),this.U&Math.pow(2,30)-1,this.B.nextUint32())}q(){this.U=1024*this.B.nextUint32()+(1023&this.B.nextUint32())}}var Re,Ie=t=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var i=0;i<t.length;i++)t[i]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};t&&!C(t.crypto)&&crypto.getRandomValues&&(Ie=t=>crypto.getRandomValues(t));class Pe{constructor(){this.H=new Uint32Array(8),this.W=1/0}nextUint32(){return this.W>=this.H.length&&(Ie(this.H),this.W=0),this.H[this.W++]}}var Te=()=>Ce().toString(),Ce=()=>(Re||(Re=new Ee)).generate(),Me="";var Oe=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function Fe(t,i){if(i){var e=function(t,i){if(void 0===i&&(i=o),Me)return Me;if(!i)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var e=t.split("."),r=Math.min(e.length,8),s="dmn_chk_"+Te();!Me&&r--;){var n=e.slice(r).join("."),a=s+"=1;domain=."+n+";path=/";i.cookie=a+";max-age=3",i.cookie.includes(s)&&(i.cookie=a+";max-age=0",Me=n)}return Me}(t);if(!e){var r=(t=>{var i=t.match(Oe);return i?i[0]:""})(t);r!==e&&xt.info("Warning: cookie subdomain discovery mismatch",r,e),e=r}return e?"; domain=."+e:""}return""}var Ae={G:()=>!!o,V:function(t){xt.error("cookieStore error: "+t)},J:function(t){if(o){try{for(var i=t+"=",e=o.cookie.split(";").filter((t=>t.length)),r=0;r<e.length;r++){for(var s=e[r];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(i))return decodeURIComponent(s.substring(i.length,s.length))}}catch(t){}return null}},K:function(t){var i;try{i=JSON.parse(Ae.J(t))||{}}catch(t){}return i},Y:function(t,i,e,r,s){if(o)try{var n="",a="",l=Fe(o.location.hostname,r);if(e){var h=new Date;h.setTime(h.getTime()+24*e*60*60*1e3),n="; expires="+h.toUTCString()}s&&(a="; secure");var u=t+"="+encodeURIComponent(JSON.stringify(i))+n+"; SameSite=Lax; path=/"+l+a;return u.length>3686.4&&xt.warn("cookieStore warning: large cookie, len="+u.length),o.cookie=u,u}catch(t){return}},X:function(t,i){if(null!=o&&o.cookie)try{Ae.Y(t,"",-1,i)}catch(t){return}}},De=null,je={G:function(){if(!F(De))return De;var i=!0;if(C(t))i=!1;else try{var e="__mplssupport__";je.Y(e,"xyz"),'"xyz"'!==je.J(e)&&(i=!1),je.X(e)}catch(t){i=!1}return i||xt.error("localStorage unsupported; falling back to cookie store"),De=i,i},V:function(t){xt.error("localStorage error: "+t)},J:function(i){try{return null==t?void 0:t.localStorage.getItem(i)}catch(t){je.V(t)}return null},K:function(t){try{return JSON.parse(je.J(t))||{}}catch(t){}return null},Y:function(i,e){try{null==t||t.localStorage.setItem(i,JSON.stringify(e))}catch(t){je.V(t)}},X:function(i){try{null==t||t.localStorage.removeItem(i)}catch(t){je.V(t)}}},Le=["distinct_id",hi,ui,Ri,Ei],Ne=g({},je,{K:function(t){try{var i={};try{i=Ae.K(t)||{}}catch(t){}var e=Mt(i,JSON.parse(je.J(t)||"{}"));return je.Y(t,e),e}catch(t){}return null},Y:function(t,i,e,r,s,n){try{je.Y(t,i,void 0,void 0,n);var o={};Le.forEach((t=>{i[t]&&(o[t]=i[t])})),Object.keys(o).length&&Ae.Y(t,o,e,r,s,n)}catch(t){je.V(t)}},X:function(i,e){try{null==t||t.localStorage.removeItem(i),Ae.X(i,e)}catch(t){je.V(t)}}}),Ue={},ze={G:function(){return!0},V:function(t){xt.error("memoryStorage error: "+t)},J:function(t){return Ue[t]||null},K:function(t){return Ue[t]||null},Y:function(t,i){Ue[t]=i},X:function(t){delete Ue[t]}},Be=null,qe={G:function(){if(!F(Be))return Be;if(Be=!0,C(t))Be=!1;else try{var i="__support__";qe.Y(i,"xyz"),'"xyz"'!==qe.J(i)&&(Be=!1),qe.X(i)}catch(t){Be=!1}return Be},V:function(t){xt.error("sessionStorage error: ",t)},J:function(i){try{return null==t?void 0:t.sessionStorage.getItem(i)}catch(t){qe.V(t)}return null},K:function(t){try{return JSON.parse(qe.J(t))||null}catch(t){}return null},Y:function(i,e){try{null==t||t.sessionStorage.setItem(i,JSON.stringify(e))}catch(t){qe.V(t)}},X:function(i){try{null==t||t.sessionStorage.removeItem(i)}catch(t){qe.V(t)}}},He=function(t){return t[t.PENDING=-1]="PENDING",t[t.DENIED=0]="DENIED",t[t.GRANTED=1]="GRANTED",t}({});class We{constructor(t){this._instance=t}get A(){return this._instance.config}get consent(){return this.Z()?He.DENIED:this.tt}isOptedOut(){return"always"===this.A.cookieless_mode||(this.consent===He.DENIED||this.consent===He.PENDING&&(this.A.opt_out_capturing_by_default||"on_reject"===this.A.cookieless_mode))}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===He.DENIED}optInOut(t){this.it.Y(this.et,t?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:t,opt_out_capturing_cookie_prefix:i,consent_persistence_name:e}=this._instance.config;return e||(i?i+t:"__ph_opt_in_out_"+t)}get tt(){var t=this.it.J(this.et);return H(t)?He.GRANTED:y(W,t)?He.DENIED:He.PENDING}get it(){if(!this.rt){var t=this.A.opt_out_capturing_persistence_type;this.rt="localStorage"===t?je:Ae;var i="localStorage"===t?Ae:je;i.J(this.et)&&(this.rt.J(this.et)||this.optInOut(H(i.J(this.et))),i.X(this.et,this.A.cross_subdomain_cookie))}return this.rt}Z(){return!!this.A.respect_dnt&&!!zt([null==n?void 0:n.doNotTrack,null==n?void 0:n.msDoNotTrack,v.doNotTrack],(t=>H(t)))}}var Ge=Et("[Dead Clicks]"),Ve=()=>!0,Je=t=>{var i,e=!(null==(i=t.instance.persistence)||!i.get_property(Qt)),r=t.instance.config.capture_dead_clicks;return j(r)?r:e};class Ke{get lazyLoadedDeadClicksAutocapture(){return this.st}constructor(t,i,e){this.instance=t,this.isEnabled=i,this.onCapture=e,this.startIfEnabled()}onRemoteConfig(t){this.instance.persistence&&this.instance.persistence.register({[Qt]:null==t?void 0:t.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.nt((()=>{this.ot()}))}nt(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.initDeadClicksAutocapture&&t(),null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this.instance,"dead-clicks-autocapture",(i=>{i?Ge.error("failed to load script",i):t()}))}ot(){var t;if(o){if(!this.st&&null!=(t=v.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var i=P(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};i.__onCapture=this.onCapture,this.st=v.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,i),this.st.start(o),Ge.info("starting...")}}else Ge.error("`document` not found. Cannot start.")}stop(){this.st&&(this.st.stop(),this.st=void 0,Ge.info("stopping..."))}}var Ye=Et("[ExceptionAutocapture]");class Xe{constructor(i){var e,r,s;this.lt=()=>{var i;if(t&&this.isEnabled&&null!=(i=v.__PosthogExtensions__)&&i.errorWrappingFunctions){var e=v.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,r=v.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=v.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.ht&&this.A.capture_unhandled_errors&&(this.ht=e(this.captureException.bind(this))),!this.ut&&this.A.capture_unhandled_rejections&&(this.ut=r(this.captureException.bind(this))),!this.dt&&this.A.capture_console_errors&&(this.dt=s(this.captureException.bind(this)))}catch(t){Ye.error("failed to start",t),this.vt()}}},this._instance=i,this.ct=!(null==(e=this._instance.persistence)||!e.props[Jt]),this.A=this.ft(),this.gt=new V({refillRate:null!==(r=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)&&void 0!==r?r:1,bucketSize:null!==(s=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)&&void 0!==s?s:10,refillInterval:1e4,R:Ye}),this.startIfEnabled()}ft(){var t=this._instance.config.capture_exceptions,i={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return P(t)?i=g({},i,t):(C(t)?this.ct:t)&&(i=g({},i,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),i}get isEnabled(){return this.A.capture_console_errors||this.A.capture_unhandled_errors||this.A.capture_unhandled_rejections}startIfEnabled(){this.isEnabled&&(Ye.info("enabled"),this.nt(this.lt))}nt(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.errorWrappingFunctions&&t(),null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"exception-autocapture",(i=>{if(i)return Ye.error("failed to load script",i);t()}))}vt(){var t,i,e;null==(t=this.ht)||t.call(this),this.ht=void 0,null==(i=this.ut)||i.call(this),this.ut=void 0,null==(e=this.dt)||e.call(this),this.dt=void 0}onRemoteConfig(t){var i=t.autocaptureExceptions;this.ct=!!i||!1,this.A=this.ft(),this._instance.persistence&&this._instance.persistence.register({[Jt]:this.ct}),this.startIfEnabled()}captureException(t){var i,e,r=null!==(i=null==t||null==(e=t.$exception_list)||null==(e=e[0])?void 0:e.type)&&void 0!==i?i:"Exception";this.gt.consumeRateLimit(r)?Ye.info("Skipping exception capture because of client rate limiting.",{exception:r}):this._instance.exceptions.sendExceptionEvent(t)}}function Qe(t,i,e){try{if(!(i in t))return()=>{};var r=t[i],s=e(r);return I(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),t[i]=s,()=>{t[i]=r}}catch(t){return()=>{}}}class Ze{constructor(i){var e;this._instance=i,this._t=(null==t||null==(e=t.location)?void 0:e.pathname)||""}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(xt.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.yt&&this.yt(),this.yt=void 0,xt.info("History API monitoring stopped")}monitorHistoryChanges(){var i,e;if(t&&t.history){var r=this;null!=(i=t.history.pushState)&&i.__posthog_wrapped__||Qe(t.history,"pushState",(t=>function(i,e,s){t.call(this,i,e,s),r.bt("pushState")})),null!=(e=t.history.replaceState)&&e.__posthog_wrapped__||Qe(t.history,"replaceState",(t=>function(i,e,s){t.call(this,i,e,s),r.bt("replaceState")})),this.wt()}}bt(i){try{var e,r=null==t||null==(e=t.location)?void 0:e.pathname;if(!r)return;r!==this._t&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:i}),this._t=r}catch(t){xt.error("Error capturing "+i+" pageview",t)}}wt(){if(!this.yt){var i=()=>{this.bt("popstate")};Bt(t,"popstate",i),this.yt=()=>{t&&t.removeEventListener("popstate",i)}}}}function tr(t){var i,e;return(null==(i=JSON.stringify(t,(e=[],function(t,i){if(P(i)){for(;e.length>0&&e[e.length-1]!==this;)e.pop();return e.includes(i)?"[Circular]":(e.push(i),i)}return i})))?void 0:i.length)||0}function ir(t,i){if(void 0===i&&(i=6606028.8),t.size>=i&&t.data.length>1){var e=Math.floor(t.data.length/2),r=t.data.slice(0,e),s=t.data.slice(e);return[ir({size:tr(r),data:r,sessionId:t.sessionId,windowId:t.windowId}),ir({size:tr(s),data:s,sessionId:t.sessionId,windowId:t.windowId})].flatMap((t=>t))}return[t]}var er=(t=>(t[t.DomContentLoaded=0]="DomContentLoaded",t[t.Load=1]="Load",t[t.FullSnapshot=2]="FullSnapshot",t[t.IncrementalSnapshot=3]="IncrementalSnapshot",t[t.Meta=4]="Meta",t[t.Custom=5]="Custom",t[t.Plugin=6]="Plugin",t))(er||{}),rr=(t=>(t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.Input=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Log=11]="Log",t[t.Drag=12]="Drag",t[t.StyleDeclaration=13]="StyleDeclaration",t[t.Selection=14]="Selection",t[t.AdoptedStyleSheet=15]="AdoptedStyleSheet",t[t.CustomElement=16]="CustomElement",t))(rr||{}),sr="[SessionRecording]",nr="redacted",or={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:t=>t,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:1e6,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io",".clarity.ms","analytics.google.com","bam.nr-data.net"]},ar=["authorization","x-forwarded-for","authorization","cookie","set-cookie","x-api-key","x-real-ip","remote-addr","forwarded","proxy-authorization","x-csrf-token","x-csrftoken","x-xsrf-token"],lr=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],hr=["/s/","/e/","/i/"];function ur(t,i,e,r){if(A(t))return t;var s=(null==i?void 0:i["content-length"])||function(t){return new Blob([t]).size}(t);return M(s)&&(s=parseInt(s)),s>e?sr+" "+r+" body too large to record ("+s+" bytes)":t}function dr(t,i){if(A(t))return t;var e=t;return re(e,!1)||(e=sr+" "+i+" body "+nr),Ct(lr,(t=>{var r,s;null!=(r=e)&&r.length&&-1!==(null==(s=e)?void 0:s.indexOf(t))&&(e=sr+" "+i+" body "+nr+" as might contain: "+t)})),e}var vr=(t,i)=>{var e,r,s,n={payloadSizeLimitBytes:or.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...or.performanceEntryTypeToObserve],payloadHostDenyList:[...i.payloadHostDenyList||[],...or.payloadHostDenyList]},o=!1!==t.session_recording.recordHeaders&&i.recordHeaders,a=!1!==t.session_recording.recordBody&&i.recordBody,l=!1!==t.capture_performance&&i.recordPerformance,h=(e=n,s=Math.min(1e6,null!==(r=e.payloadSizeLimitBytes)&&void 0!==r?r:1e6),t=>(null!=t&&t.requestBody&&(t.requestBody=ur(t.requestBody,t.requestHeaders,s,"Request")),null!=t&&t.responseBody&&(t.responseBody=ur(t.responseBody,t.responseHeaders,s,"Response")),t)),u=i=>{return h(((t,i)=>{var e,r=ce(t.name),s=0===i.indexOf("http")?null==(e=ce(i))?void 0:e.pathname:i;"/"===s&&(s="");var n=null==r?void 0:r.pathname.replace(s||"","");if(!(r&&n&&hr.some((t=>0===n.indexOf(t)))))return t})((r=(e=i).requestHeaders,A(r)||Ct(Object.keys(null!=r?r:{}),(t=>{ar.includes(t.toLowerCase())&&(r[t]=nr)})),e),t.api_host));var e,r},d=I(t.session_recording.maskNetworkRequestFn);return d&&I(t.session_recording.maskCapturedNetworkRequestFn)&&xt.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),d&&(t.session_recording.maskCapturedNetworkRequestFn=i=>{var e=t.session_recording.maskNetworkRequestFn({url:i.name});return g({},i,{name:null==e?void 0:e.url})}),n.maskRequestFn=I(t.session_recording.maskCapturedNetworkRequestFn)?i=>{var e,r=u(i);return r&&null!==(e=null==t.session_recording.maskCapturedNetworkRequestFn?void 0:t.session_recording.maskCapturedNetworkRequestFn(r))&&void 0!==e?e:void 0}:t=>function(t){if(!C(t))return t.requestBody=dr(t.requestBody,"Request"),t.responseBody=dr(t.responseBody,"Response"),t}(u(t)),g({},or,n,{recordHeaders:o,recordBody:a,recordPerformance:l,recordInitialRequests:l})};class cr{constructor(t,i){var e,r;void 0===i&&(i={}),this.St={},this.kt=t=>{if(!this.St[t]){var i,e;this.St[t]=!0;var r=this.$t(t);null==(i=(e=this.t).onBlockedNode)||i.call(e,t,r)}},this.xt=t=>{var i=this.$t(t);if("svg"!==(null==i?void 0:i.nodeName)&&i instanceof Element){var e=i.closest("svg");if(e)return[this._rrweb.mirror.getId(e),e]}return[t,i]},this.$t=t=>this._rrweb.mirror.getNode(t),this.Et=t=>{var i,e,r,s,n,o,a,l;return(null!==(i=null==(e=t.removes)?void 0:e.length)&&void 0!==i?i:0)+(null!==(r=null==(s=t.attributes)?void 0:s.length)&&void 0!==r?r:0)+(null!==(n=null==(o=t.texts)?void 0:o.length)&&void 0!==n?n:0)+(null!==(a=null==(l=t.adds)?void 0:l.length)&&void 0!==a?a:0)},this.throttleMutations=t=>{if(3!==t.type||0!==t.data.source)return t;var i=t.data,e=this.Et(i);i.attributes&&(i.attributes=i.attributes.filter((t=>{var[i]=this.xt(t.id);return!this.gt.consumeRateLimit(i)&&t})));var r=this.Et(i);return 0!==r||e===r?t:void 0},this._rrweb=t,this.t=i,this.gt=new V({bucketSize:null!==(e=this.t.bucketSize)&&void 0!==e?e:100,refillRate:null!==(r=this.t.refillRate)&&void 0!==r?r:10,refillInterval:1e3,$:this.kt,R:xt})}}var fr=Uint8Array,pr=Uint16Array,gr=Uint32Array,_r=new fr([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]),mr=new fr([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]),yr=new fr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),br=function(t,i){for(var e=new pr(31),r=0;r<31;++r)e[r]=i+=1<<t[r-1];var s=new gr(e[30]);for(r=1;r<30;++r)for(var n=e[r];n<e[r+1];++n)s[n]=n-e[r]<<5|r;return[e,s]},wr=br(_r,2),Sr=wr[0],kr=wr[1];Sr[28]=258,kr[258]=28;for(var $r=br(mr,0)[1],xr=new pr(32768),Er=0;Er<32768;++Er){var Rr=(43690&Er)>>>1|(21845&Er)<<1;Rr=(61680&(Rr=(52428&Rr)>>>2|(13107&Rr)<<2))>>>4|(3855&Rr)<<4,xr[Er]=((65280&Rr)>>>8|(255&Rr)<<8)>>>1}var Ir=function(t,i,e){for(var r=t.length,s=0,n=new pr(i);s<r;++s)++n[t[s]-1];var o,a=new pr(i);for(s=0;s<i;++s)a[s]=a[s-1]+n[s-1]<<1;if(e){o=new pr(1<<i);var l=15-i;for(s=0;s<r;++s)if(t[s])for(var h=s<<4|t[s],u=i-t[s],d=a[t[s]-1]++<<u,v=d|(1<<u)-1;d<=v;++d)o[xr[d]>>>l]=h}else for(o=new pr(r),s=0;s<r;++s)o[s]=xr[a[t[s]-1]++]>>>15-t[s];return o},Pr=new fr(288);for(Er=0;Er<144;++Er)Pr[Er]=8;for(Er=144;Er<256;++Er)Pr[Er]=9;for(Er=256;Er<280;++Er)Pr[Er]=7;for(Er=280;Er<288;++Er)Pr[Er]=8;var Tr=new fr(32);for(Er=0;Er<32;++Er)Tr[Er]=5;var Cr=Ir(Pr,9,0),Mr=Ir(Tr,5,0),Or=function(t){return(t/8>>0)+(7&t&&1)},Fr=function(t,i,e){(null==e||e>t.length)&&(e=t.length);var r=new(t instanceof pr?pr:t instanceof gr?gr:fr)(e-i);return r.set(t.subarray(i,e)),r},Ar=function(t,i,e){e<<=7&i;var r=i/8>>0;t[r]|=e,t[r+1]|=e>>>8},Dr=function(t,i,e){e<<=7&i;var r=i/8>>0;t[r]|=e,t[r+1]|=e>>>8,t[r+2]|=e>>>16},jr=function(t,i){for(var e=[],r=0;r<t.length;++r)t[r]&&e.push({s:r,f:t[r]});var s=e.length,n=e.slice();if(!s)return[new fr(0),0];if(1==s){var o=new fr(e[0].s+1);return o[e[0].s]=1,[o,1]}e.sort((function(t,i){return t.f-i.f})),e.push({s:-1,f:25001});var a=e[0],l=e[1],h=0,u=1,d=2;for(e[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=s-1;)a=e[e[h].f<e[d].f?h++:d++],l=e[h!=u&&e[h].f<e[d].f?h++:d++],e[u++]={s:-1,f:a.f+l.f,l:a,r:l};var v=n[0].s;for(r=1;r<s;++r)n[r].s>v&&(v=n[r].s);var c=new pr(v+1),f=Lr(e[u-1],c,0);if(f>i){r=0;var p=0,g=f-i,_=1<<g;for(n.sort((function(t,i){return c[i.s]-c[t.s]||t.f-i.f}));r<s;++r){var m=n[r].s;if(!(c[m]>i))break;p+=_-(1<<f-c[m]),c[m]=i}for(p>>>=g;p>0;){var y=n[r].s;c[y]<i?p-=1<<i-c[y]++-1:++r}for(;r>=0&&p;--r){var b=n[r].s;c[b]==i&&(--c[b],++p)}f=i}return[new fr(c),f]},Lr=function(t,i,e){return-1==t.s?Math.max(Lr(t.l,i,e+1),Lr(t.r,i,e+1)):i[t.s]=e},Nr=function(t){for(var i=t.length;i&&!t[--i];);for(var e=new pr(++i),r=0,s=t[0],n=1,o=function(t){e[r++]=t},a=1;a<=i;++a)if(t[a]==s&&a!=i)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=t[a]}return[e.subarray(0,r),i]},Ur=function(t,i){for(var e=0,r=0;r<i.length;++r)e+=t[r]*i[r];return e},zr=function(t,i,e){var r=e.length,s=Or(i+2);t[s]=255&r,t[s+1]=r>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var n=0;n<r;++n)t[s+n+4]=e[n];return 8*(s+4+r)},Br=function(t,i,e,r,s,n,o,a,l,h,u){Ar(i,u++,e),++s[256];for(var d=jr(s,15),v=d[0],c=d[1],f=jr(n,15),p=f[0],g=f[1],_=Nr(v),m=_[0],y=_[1],b=Nr(p),w=b[0],S=b[1],k=new pr(19),x=0;x<m.length;++x)k[31&m[x]]++;for(x=0;x<w.length;++x)k[31&w[x]]++;for(var E=jr(k,7),R=E[0],I=E[1],P=19;P>4&&!R[yr[P-1]];--P);var T,C,M,O,F=h+5<<3,A=Ur(s,Pr)+Ur(n,Tr)+o,D=Ur(s,v)+Ur(n,p)+o+14+3*P+Ur(k,R)+(2*k[16]+3*k[17]+7*k[18]);if(F<=A&&F<=D)return zr(i,u,t.subarray(l,l+h));if(Ar(i,u,1+(D<A)),u+=2,D<A){T=Ir(v,c,0),C=v,M=Ir(p,g,0),O=p;var j=Ir(R,I,0);Ar(i,u,y-257),Ar(i,u+5,S-1),Ar(i,u+10,P-4),u+=14;for(x=0;x<P;++x)Ar(i,u+3*x,R[yr[x]]);u+=3*P;for(var L=[m,w],N=0;N<2;++N){var U=L[N];for(x=0;x<U.length;++x){var z=31&U[x];Ar(i,u,j[z]),u+=R[z],z>15&&(Ar(i,u,U[x]>>>5&127),u+=U[x]>>>12)}}}else T=Cr,C=Pr,M=Mr,O=Tr;for(x=0;x<a;++x)if(r[x]>255){z=r[x]>>>18&31;Dr(i,u,T[z+257]),u+=C[z+257],z>7&&(Ar(i,u,r[x]>>>23&31),u+=_r[z]);var B=31&r[x];Dr(i,u,M[B]),u+=O[B],B>3&&(Dr(i,u,r[x]>>>5&8191),u+=mr[B])}else Dr(i,u,T[r[x]]),u+=C[r[x]];return Dr(i,u,T[256]),u+C[256]},qr=new gr([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Hr=function(){for(var t=new gr(256),i=0;i<256;++i){for(var e=i,r=9;--r;)e=(1&e&&3988292384)^e>>>1;t[i]=e}return t}(),Wr=function(){var t=4294967295;return{p:function(i){for(var e=t,r=0;r<i.length;++r)e=Hr[255&e^i[r]]^e>>>8;t=e},d:function(){return 4294967295^t}}},Gr=function(t,i,e,r,s){return function(t,i,e,r,s,n){var o=t.length,a=new fr(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),h=0;if(!i||o<8)for(var u=0;u<=o;u+=65535){var d=u+65535;d<o?h=zr(l,h,t.subarray(u,d)):(l[u]=n,h=zr(l,h,t.subarray(u,o)))}else{for(var v=qr[i-1],c=v>>>13,f=8191&v,p=(1<<e)-1,g=new pr(32768),_=new pr(p+1),m=Math.ceil(e/3),y=2*m,b=function(i){return(t[i]^t[i+1]<<m^t[i+2]<<y)&p},w=new gr(25e3),S=new pr(288),k=new pr(32),x=0,E=0,R=(u=0,0),I=0,P=0;u<o;++u){var T=b(u),C=32767&u,M=_[T];if(g[C]=M,_[T]=C,I<=u){var O=o-u;if((x>7e3||R>24576)&&O>423){h=Br(t,l,0,w,S,k,E,R,P,u-P,h),R=x=E=0,P=u;for(var F=0;F<286;++F)S[F]=0;for(F=0;F<30;++F)k[F]=0}var A=2,D=0,j=f,L=C-M&32767;if(O>2&&T==b(u-L))for(var N=Math.min(c,O)-1,U=Math.min(32767,u),z=Math.min(258,O);L<=U&&--j&&C!=M;){if(t[u+A]==t[u+A-L]){for(var B=0;B<z&&t[u+B]==t[u+B-L];++B);if(B>A){if(A=B,D=L,B>N)break;var q=Math.min(L,B-2),H=0;for(F=0;F<q;++F){var W=u-L+F+32768&32767,G=W-g[W]+32768&32767;G>H&&(H=G,M=W)}}}L+=(C=M)-(M=g[C])+32768&32767}if(D){w[R++]=268435456|kr[A]<<18|$r[D];var V=31&kr[A],J=31&$r[D];E+=_r[V]+mr[J],++S[257+V],++k[J],I=u+A,++x}else w[R++]=t[u],++S[t[u]]}}h=Br(t,l,n,w,S,k,E,R,P,u-P,h)}return Fr(a,0,r+Or(h)+s)}(t,null==i.level?6:i.level,null==i.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+i.mem,e,r,!0)},Vr=function(t,i,e){for(;e;++i)t[i]=e,e>>>=8},Jr=function(t,i){var e=i.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=i.level<2?4:9==i.level?2:0,t[9]=3,0!=i.mtime&&Vr(t,4,Math.floor(new Date(i.mtime||Date.now())/1e3)),e){t[3]=8;for(var r=0;r<=e.length;++r)t[r+10]=e.charCodeAt(r)}},Kr=function(t){return 10+(t.filename&&t.filename.length+1||0)};function Yr(t,i){void 0===i&&(i={});var e=Wr(),r=t.length;e.p(t);var s=Gr(t,i,Kr(i),8),n=s.length;return Jr(s,i),Vr(s,n-8,e.d()),Vr(s,n-4,r),s}function Xr(t,i){var e=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new fr(t.length+(t.length>>>1)),s=0,n=function(t){r[s++]=t},o=0;o<e;++o){if(s+5>r.length){var a=new fr(s+8+(e-o<<1));a.set(r),r=a}var l=t.charCodeAt(o);l<128||i?n(l):l<2048?(n(192|l>>>6),n(128|63&l)):l>55295&&l<57344?(n(240|(l=65536+(1047552&l)|1023&t.charCodeAt(++o))>>>18),n(128|l>>>12&63),n(128|l>>>6&63),n(128|63&l)):(n(224|l>>>12),n(128|l>>>6&63),n(128|63&l))}return Fr(r,0,s)}function Qr(t,i){return function(t){for(var i=0,e=0;e<t.length;e++)i=(i<<5)-i+t.charCodeAt(e),i|=0;return Math.abs(i)}(t)%100<G(100*i,0,100,xt)}var Zr="disabled",ts="sampled",is="active",es="buffering",rs="paused",ss="trigger",ns=ss+"_activated",os=ss+"_pending",as=ss+"_"+Zr;function ls(t,i){return i.some((i=>"regex"===i.matching&&new RegExp(i.url).test(t)))}class hs{constructor(t){this.Rt=t}triggerStatus(t){var i=this.Rt.map((i=>i.triggerStatus(t)));return i.includes(ns)?ns:i.includes(os)?os:as}stop(){this.Rt.forEach((t=>t.stop()))}}class us{constructor(t){this.Rt=t}triggerStatus(t){var i=new Set;for(var e of this.Rt)i.add(e.triggerStatus(t));switch(i.delete(as),i.size){case 0:return as;case 1:return Array.from(i)[0];default:return os}}stop(){this.Rt.forEach((t=>t.stop()))}}class ds{triggerStatus(){return os}stop(){}}var vs=t=>"sessionRecording"in t;class cs{constructor(t){this.It=[],this.Pt=[],this.urlBlocked=!1,this._instance=t}onConfig(t){var i,e;this.It=(vs(t)?P(t.sessionRecording)?null==(i=t.sessionRecording)?void 0:i.urlTriggers:[]:null==t?void 0:t.urlTriggers)||[],this.Pt=(vs(t)?P(t.sessionRecording)?null==(e=t.sessionRecording)?void 0:e.urlBlocklist:[]:null==t?void 0:t.urlBlocklist)||[]}onRemoteConfig(t){this.onConfig(t)}Tt(t){var i;return 0===this.It.length?as:(null==(i=this._instance)?void 0:i.get_property(di))===t?ns:os}triggerStatus(t){var i=this.Tt(t),e=i===ns?ns:i===os?os:as;return this._instance.register_for_session({$sdk_debug_replay_url_trigger_status:e}),e}checkUrlTriggerConditions(i,e,r){if(void 0!==t&&t.location.href){var s=t.location.href,n=this.urlBlocked,o=ls(s,this.Pt);n&&o||(o&&!n?i():!o&&n&&e(),ls(s,this.It)&&r("url"))}}stop(){}}class fs{constructor(t){this.linkedFlag=null,this.linkedFlagSeen=!1,this.Ct=()=>{},this._instance=t}triggerStatus(){var t=os;return A(this.linkedFlag)&&(t=as),this.linkedFlagSeen&&(t=ns),this._instance.register_for_session({$sdk_debug_replay_linked_flag_trigger_status:t}),t}onConfig(t,i){var e;if(this.linkedFlag=(vs(t)?P(t.sessionRecording)?null==(e=t.sessionRecording)?void 0:e.linkedFlag:null:null==t?void 0:t.linkedFlag)||null,!A(this.linkedFlag)&&!this.linkedFlagSeen){var r=M(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,s=M(this.linkedFlag)?null:this.linkedFlag.variant;this.Ct=this._instance.onFeatureFlags(((t,e)=>{var n=!1;if(P(e)&&r in e){var o=e[r];n=j(o)?!0===o:s?o===s:!!o}this.linkedFlagSeen=n,n&&i(r,s)}))}}onRemoteConfig(t,i){this.onConfig(t,i)}stop(){this.Ct()}}class ps{constructor(t){this.Mt=[],this._instance=t}onConfig(t){var i;this.Mt=(vs(t)?P(t.sessionRecording)?null==(i=t.sessionRecording)?void 0:i.eventTriggers:[]:null==t?void 0:t.eventTriggers)||[]}onRemoteConfig(t){this.onConfig(t)}Ot(t){var i;return 0===this.Mt.length?as:(null==(i=this._instance)?void 0:i.get_property(vi))===t?ns:os}triggerStatus(t){var i=this.Ot(t),e=i===ns?ns:i===os?os:as;return this._instance.register_for_session({$sdk_debug_replay_event_trigger_status:e}),e}stop(){}}function gs(t){return t.isRecordingEnabled?es:Zr}function _s(t){if(!t.receivedFlags)return es;if(!t.isRecordingEnabled)return Zr;if(t.urlTriggerMatching.urlBlocked)return rs;var i=!0===t.isSampled,e=new hs([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId);return i?ts:e===ns?is:e===os?es:!1===t.isSampled?Zr:is}function ms(t){if(!t.receivedFlags)return es;if(!t.isRecordingEnabled)return Zr;if(t.urlTriggerMatching.urlBlocked)return rs;var i=new us([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId),e=i!==as,r=j(t.isSampled);return e&&i===os?es:e&&i===as||r&&!t.isSampled?Zr:!0===t.isSampled?ts:is}var ys="[SessionRecording]",bs=Et(ys);function ws(){var t;return null==v||null==(t=v.__PosthogExtensions__)||null==(t=t.rrweb)?void 0:t.record}var Ss=3e5,ks=[rr.MouseMove,rr.MouseInteraction,rr.Scroll,rr.ViewportResize,rr.Input,rr.TouchMove,rr.MediaInteraction,rr.Drag],$s=t=>({rrwebMethod:t,enqueuedAt:Date.now(),attempt:1});function xs(t){return function(t,i){for(var e="",r=0;r<t.length;){var s=t[r++];e+=String.fromCharCode(s)}return e}(Yr(Xr(JSON.stringify(t))))}function Es(t){return t.type===er.Custom&&"sessionIdle"===t.data.tag}class Rs{get sessionId(){return this.Ft}get At(){return this._instance.config.session_recording.session_idle_threshold_ms||3e5}get started(){return this.Dt}get jt(){if(!this._instance.sessionManager)throw new Error(ys+" must be started with a valid sessionManager.");return this._instance.sessionManager}get Lt(){var t,i;return this.Nt.triggerStatus(this.sessionId)===os?6e4:null!==(t=null==(i=this._instance.config.session_recording)?void 0:i.full_snapshot_interval_millis)&&void 0!==t?t:Ss}get Ut(){var t=this._instance.get_property(ui);return j(t)?t:null}get zt(){var t,i,e=null==(t=this.H)?void 0:t.data[(null==(i=this.H)?void 0:i.data.length)-1],{sessionStartTimestamp:r}=this.jt.checkAndGetSessionAndWindowId(!0);return e?e.timestamp-r:null}get Bt(){var i=!!this._instance.get_property(ii),e=!this._instance.config.disable_session_recording;return t&&i&&e}get qt(){var t=!!this._instance.get_property(ei),i=this._instance.config.enable_recording_console_log;return null!=i?i:t}get Ht(){var t,i,e,r,s,n,o=this._instance.config.session_recording.captureCanvas,a=this._instance.get_property(ni),l=null!==(t=null!==(i=null==o?void 0:o.recordCanvas)&&void 0!==i?i:null==a?void 0:a.enabled)&&void 0!==t&&t,h=null!==(e=null!==(r=null==o?void 0:o.canvasFps)&&void 0!==r?r:null==a?void 0:a.fps)&&void 0!==e?e:4,u=null!==(s=null!==(n=null==o?void 0:o.canvasQuality)&&void 0!==n?n:null==a?void 0:a.quality)&&void 0!==s?s:.4;if("string"==typeof u){var d=parseFloat(u);u=isNaN(d)?.4:d}return{enabled:l,fps:G(h,0,12,bs.createLogger("canvas recording fps"),4),quality:G(u,0,1,bs.createLogger("canvas recording quality"),.4)}}get Wt(){var t,i,e=this._instance.get_property(ri),r={recordHeaders:null==(t=this._instance.config.session_recording)?void 0:t.recordHeaders,recordBody:null==(i=this._instance.config.session_recording)?void 0:i.recordBody},s=(null==r?void 0:r.recordHeaders)||(null==e?void 0:e.recordHeaders),n=(null==r?void 0:r.recordBody)||(null==e?void 0:e.recordBody),o=P(this._instance.config.capture_performance)?this._instance.config.capture_performance.network_timing:this._instance.config.capture_performance,a=!!(j(o)?o:null==e?void 0:e.capturePerformance);return s||n||a?{recordHeaders:s,recordBody:n,recordPerformance:a}:void 0}get Gt(){var t,i,e,r,s,n,o=this._instance.get_property(si),a={maskAllInputs:null==(t=this._instance.config.session_recording)?void 0:t.maskAllInputs,maskTextSelector:null==(i=this._instance.config.session_recording)?void 0:i.maskTextSelector,blockSelector:null==(e=this._instance.config.session_recording)?void 0:e.blockSelector},l=null!==(r=null==a?void 0:a.maskAllInputs)&&void 0!==r?r:null==o?void 0:o.maskAllInputs,h=null!==(s=null==a?void 0:a.maskTextSelector)&&void 0!==s?s:null==o?void 0:o.maskTextSelector,u=null!==(n=null==a?void 0:a.blockSelector)&&void 0!==n?n:null==o?void 0:o.blockSelector;return C(l)&&C(h)&&C(u)?void 0:{maskAllInputs:null==l||l,maskTextSelector:h,blockSelector:u}}get Vt(){var t=this._instance.get_property(oi);return D(t)?t:null}get Jt(){var t=this._instance.get_property(ai);return D(t)?t:null}get status(){return this.Kt?this.Yt({receivedFlags:this.Kt,isRecordingEnabled:this.Bt,isSampled:this.Ut,urlTriggerMatching:this.Xt,eventTriggerMatching:this.Qt,linkedFlagMatching:this.Zt,sessionId:this.sessionId}):es}constructor(t){if(this.Yt=gs,this.Kt=!1,this.ti=[],this.ii="unknown",this.ei=Date.now(),this.Nt=new ds,this.ri=void 0,this.si=void 0,this.ni=void 0,this.oi=void 0,this.ai=void 0,this._forceAllowLocalhostNetworkCapture=!1,this.li=()=>{this.hi()},this.ui=()=>{this.tryAddCustomEvent("browser offline",{})},this.di=()=>{this.tryAddCustomEvent("browser online",{})},this.vi=()=>{if(null!=o&&o.visibilityState){var t="window "+o.visibilityState;this.tryAddCustomEvent(t,{})}},this._instance=t,this.Dt=!1,this.ci="/s/",this.fi=void 0,this.Kt=!1,!this._instance.sessionManager)throw bs.error("started without valid sessionManager"),new Error(ys+" started without valid sessionManager. This is a bug.");if("always"===this._instance.config.cookieless_mode)throw new Error(ys+' cannot be used with cookieless_mode="always"');this.Zt=new fs(this._instance),this.Xt=new cs(this._instance),this.Qt=new ps(this._instance);var{sessionId:i,windowId:e}=this.jt.checkAndGetSessionAndWindowId();this.Ft=i,this.pi=e,this.H=this.gi(),this.At>=this.jt.sessionTimeoutMs&&bs.warn("session_idle_threshold_ms ("+this.At+") is greater than the session timeout ("+this.jt.sessionTimeoutMs+"). Session will never be detected as idle")}startIfEnabledOrStop(i){this.Bt?(this.mi(i),Bt(t,"beforeunload",this.li),Bt(t,"offline",this.ui),Bt(t,"online",this.di),Bt(t,"visibilitychange",this.vi),this.yi(),this.bi(),A(this.ri)&&(this.ri=this._instance.on("eventCaptured",(t=>{try{if("$pageview"===t.event){var i=null!=t&&t.properties.$current_url?this.wi(null==t?void 0:t.properties.$current_url):"";if(!i)return;this.tryAddCustomEvent("$pageview",{href:i})}}catch(t){bs.error("Could not add $pageview to rrweb session",t)}}))),this.si||(this.si=this.jt.onSessionId(((t,i,e)=>{var r,s;e&&(this.tryAddCustomEvent("$session_id_change",{sessionId:t,windowId:i,changeReason:e}),null==(r=this._instance)||null==(r=r.persistence)||r.unregister(vi),null==(s=this._instance)||null==(s=s.persistence)||s.unregister(di))})))):this.stopRecording()}stopRecording(){var i,e,r,s;this.Dt&&this.fi&&(this.fi(),this.fi=void 0,this.Dt=!1,null==t||t.removeEventListener("beforeunload",this.li),null==t||t.removeEventListener("offline",this.ui),null==t||t.removeEventListener("online",this.di),null==t||t.removeEventListener("visibilitychange",this.vi),this.gi(),clearInterval(this.Si),null==(i=this.ri)||i.call(this),this.ri=void 0,null==(e=this.ai)||e.call(this),this.ai=void 0,null==(r=this.si)||r.call(this),this.si=void 0,null==(s=this.oi)||s.call(this),this.oi=void 0,this.Qt.stop(),this.Xt.stop(),this.Zt.stop(),bs.info("stopped"))}ki(){var t;null==(t=this._instance.persistence)||t.unregister(ui)}$i(t){var i,e=this.Ft!==t,r=this.Vt;if(D(r)){var s=this.Ut,n=e||!j(s),o=n?Qr(t,r):s;n&&(o?this.xi(ts):bs.warn("Sample rate ("+r+") has determined that this sessionId ("+t+") will not be sent to the server."),this.tryAddCustomEvent("samplingDecisionMade",{sampleRate:r,isSampled:o})),null==(i=this._instance.persistence)||i.register({[ui]:o})}else this.ki()}onRemoteConfig(t){if(this.tryAddCustomEvent("$remote_config_received",t),this.Kt=!0,this.Ei(t),t.sessionRecording){var i,e,r,s;if(null!=(i=t.sessionRecording)&&i.endpoint)this.ci=null==(s=t.sessionRecording)?void 0:s.endpoint;this.yi(),"any"===(null==(e=t.sessionRecording)?void 0:e.triggerMatchType)?(this.Yt=_s,this.Nt=new hs([this.Qt,this.Xt])):(this.Yt=ms,this.Nt=new us([this.Qt,this.Xt])),this._instance.register_for_session({$sdk_debug_replay_remote_trigger_matching_config:null==(r=t.sessionRecording)?void 0:r.triggerMatchType}),this.Xt.onConfig(t),this.Qt.onConfig(t),this.Zt.onConfig(t,((t,i)=>{this.xi("linked_flag_matched",{flag:t,variant:i})}))}this.startIfEnabledOrStop()}yi(){D(this.Vt)&&A(this.oi)&&(this.oi=this.jt.onSessionId((t=>{this.$i(t)})))}Ei(t){if(this._instance.persistence){var i,e=this._instance.persistence,r=()=>{var i=!1===t.sessionRecording?void 0:t.sessionRecording,r=null==i?void 0:i.sampleRate,s=A(r)?null:parseFloat(r);A(s)&&this.ki();var n=null==i?void 0:i.minimumDurationMilliseconds;e.register({[ii]:!!t.sessionRecording,[ei]:null==i?void 0:i.consoleLogRecordingEnabled,[ri]:g({capturePerformance:t.capturePerformance},null==i?void 0:i.networkPayloadCapture),[si]:null==i?void 0:i.masking,[ni]:{enabled:null==i?void 0:i.recordCanvas,fps:null==i?void 0:i.canvasFps,quality:null==i?void 0:i.canvasQuality},[oi]:s,[ai]:C(n)?null:n,[li]:null==i?void 0:i.scriptConfig})};r(),null==(i=this.ni)||i.call(this),this.ni=this.jt.onSessionId(r)}}log(t,i){var e;void 0===i&&(i="log"),null==(e=this._instance.sessionRecording)||e.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:i,trace:[],payload:[JSON.stringify(t)]}},timestamp:Date.now()})}mi(t){if(!C(Object.assign)&&!C(Array.from)&&!(this.Dt||this._instance.config.disable_session_recording||this._instance.consent.isOptedOut())){var i;if(this.Dt=!0,this.jt.checkAndGetSessionAndWindowId(),ws())this.Ri();else null==(i=v.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this.Ii,(t=>{if(t)return bs.error("could not load recorder",t);this.Ri()}));bs.info("starting"),this.status===is&&this.xi(t||"recording_initialized")}}get Ii(){var t;return(null==(t=this._instance)||null==(t=t.persistence)||null==(t=t.get_property(li))?void 0:t.script)||"recorder"}Pi(t){var i;return 3===t.type&&-1!==ks.indexOf(null==(i=t.data)?void 0:i.source)}Ti(t){var i=this.Pi(t);i||this.ii||t.timestamp-this.ei>this.At&&(this.ii=!0,clearInterval(this.Si),this.tryAddCustomEvent("sessionIdle",{eventTimestamp:t.timestamp,lastActivityTimestamp:this.ei,threshold:this.At,bufferLength:this.H.data.length,bufferSize:this.H.size}),this.hi());var e=!1;if(i&&(this.ei=t.timestamp,this.ii)){var r="unknown"===this.ii;this.ii=!1,r||(this.tryAddCustomEvent("sessionNoLongerIdle",{reason:"user activity",type:t.type}),e=!0)}if(!this.ii){var{windowId:s,sessionId:n}=this.jt.checkAndGetSessionAndWindowId(!i,t.timestamp),o=this.Ft!==n,a=this.pi!==s;this.pi=s,this.Ft=n,o||a?(this.stopRecording(),this.startIfEnabledOrStop("session_id_changed")):e&&this.Ci()}}Mi(t){try{return t.rrwebMethod(),!0}catch(i){return this.ti.length<10?this.ti.push({enqueuedAt:t.enqueuedAt||Date.now(),attempt:t.attempt++,rrwebMethod:t.rrwebMethod}):bs.warn("could not emit queued rrweb event.",i,t),!1}}tryAddCustomEvent(t,i){return this.Mi($s((()=>ws().addCustomEvent(t,i))))}Oi(){return this.Mi($s((()=>ws().takeFullSnapshot())))}Ri(){var t,i,e,r,s={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,recordCrossOriginIframes:!1},n=this._instance.config.session_recording;for(var[o,a]of Object.entries(n||{}))o in s&&("maskInputOptions"===o?s.maskInputOptions=g({password:!0},a):s[o]=a);(this.Ht&&this.Ht.enabled&&(s.recordCanvas=!0,s.sampling={canvas:this.Ht.fps},s.dataURLOptions={type:"image/webp",quality:this.Ht.quality}),this.Gt)&&(s.maskAllInputs=null===(i=this.Gt.maskAllInputs)||void 0===i||i,s.maskTextSelector=null!==(e=this.Gt.maskTextSelector)&&void 0!==e?e:void 0,s.blockSelector=null!==(r=this.Gt.blockSelector)&&void 0!==r?r:void 0);var l=ws();if(l){this.Fi=null!==(t=this.Fi)&&void 0!==t?t:new cr(l,{refillRate:this._instance.config.session_recording.__mutationThrottlerRefillRate,bucketSize:this._instance.config.session_recording.__mutationThrottlerBucketSize,onBlockedNode:(t,i)=>{var e="Too many mutations on node '"+t+"'. Rate limiting. This could be due to SVG animations or something similar";bs.info(e,{node:i}),this.log(ys+" "+e,"warn")}});var h=this.Ai();this.fi=l(g({emit:t=>{this.onRRwebEmit(t)},plugins:h},s)),this.ei=Date.now(),this.ii=j(this.ii)?this.ii:"unknown",this.tryAddCustomEvent("$session_options",{sessionRecordingOptions:s,activePlugins:h.map((t=>null==t?void 0:t.name))}),this.tryAddCustomEvent("$posthog_config",{config:this._instance.config})}else bs.error("onScriptLoaded was called but rrwebRecord is not available. This indicates something has gone wrong.")}Ci(){if(this.Si&&clearInterval(this.Si),!0!==this.ii){var t=this.Lt;t&&(this.Si=setInterval((()=>{this.Oi()}),t))}}Ai(){var t,i,e=[],r=null==(t=v.__PosthogExtensions__)||null==(t=t.rrwebPlugins)?void 0:t.getRecordConsolePlugin;r&&this.qt&&e.push(r());var s=null==(i=v.__PosthogExtensions__)||null==(i=i.rrwebPlugins)?void 0:i.getRecordNetworkPlugin;this.Wt&&I(s)&&(!ve.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?e.push(s(vr(this._instance.config,this.Wt))):bs.info("NetworkCapture not started because we are on localhost."));return e}onRRwebEmit(t){var i;if(this.Di(),t&&P(t)){if(t.type===er.Meta){var e=this.wi(t.data.href);if(this.ji=e,!e)return;t.data.href=e}else this.Li();if(this.Xt.checkUrlTriggerConditions((()=>this.Ni()),(()=>this.Ui()),(t=>this.zi(t))),!this.Xt.urlBlocked||(r=t).type===er.Custom&&"recording paused"===r.data.tag){var r;t.type===er.FullSnapshot&&this.Ci(),t.type===er.FullSnapshot&&this.Kt&&this.Nt.triggerStatus(this.sessionId)===os&&this.Bi();var s=this.Fi?this.Fi.throttleMutations(t):t;if(s){var n=function(t){var i=t;if(i&&P(i)&&6===i.type&&P(i.data)&&"rrweb/console@1"===i.data.plugin){i.data.payload.payload.length>10&&(i.data.payload.payload=i.data.payload.payload.slice(0,10),i.data.payload.payload.push("...[truncated]"));for(var e=[],r=0;r<i.data.payload.payload.length;r++)i.data.payload.payload[r]&&i.data.payload.payload[r].length>2e3?e.push(i.data.payload.payload[r].slice(0,2e3)+"...[truncated]"):e.push(i.data.payload.payload[r]);return i.data.payload.payload=e,t}return t}(s);if(this.Ti(n),!0!==this.ii||Es(n)){if(Es(n)){var o=n.data.payload;if(o){var a=o.lastActivityTimestamp,l=o.threshold;n.timestamp=a+l}}var h=null===(i=this._instance.config.session_recording.compress_events)||void 0===i||i?function(t){try{if(t.type===er.FullSnapshot)return g({},t,{data:xs(t.data),cv:"2024-10"});if(t.type===er.IncrementalSnapshot&&t.data.source===rr.Mutation)return g({},t,{cv:"2024-10",data:g({},t.data,{texts:xs(t.data.texts),attributes:xs(t.data.attributes),removes:xs(t.data.removes),adds:xs(t.data.adds)})});if(t.type===er.IncrementalSnapshot&&t.data.source===rr.StyleSheetRule)return g({},t,{cv:"2024-10",data:g({},t.data,{adds:t.data.adds?xs(t.data.adds):void 0,removes:t.data.removes?xs(t.data.removes):void 0})})}catch(t){bs.error("could not compress event - will use uncompressed event",t)}return t}(n):n,u={$snapshot_bytes:tr(h),$snapshot_data:h,$session_id:this.Ft,$window_id:this.pi};this.status!==Zr?this.qi(u):this.gi()}}}}}Li(){if(!this._instance.config.capture_pageview&&t){var i=this.wi(t.location.href);this.ji!==i&&(this.tryAddCustomEvent("$url_changed",{href:i}),this.ji=i)}}Di(){if(this.ti.length){var t=[...this.ti];this.ti=[],t.forEach((t=>{Date.now()-t.enqueuedAt<=2e3&&this.Mi(t)}))}}wi(t){var i=this._instance.config.session_recording;if(i.maskNetworkRequestFn){var e,r={url:t};return null==(e=r=i.maskNetworkRequestFn(r))?void 0:e.url}return t}Bi(){if(!this.H||0===this.H.data.length)return this.gi();for(var t=-1,i=this.H.data.length-1;i>=0;i--)if(this.H.data[i].type===er.Meta){t=i;break}return t>=0?(this.H.data=this.H.data.slice(t),this.H.size=this.H.data.reduce(((t,i)=>t+tr(i)),0),this.H):this.gi()}gi(){return this.H={size:0,data:[],sessionId:this.Ft,windowId:this.pi},this.H}hi(){this.Hi&&(clearTimeout(this.Hi),this.Hi=void 0);var t=this.Jt,i=this.zt,e=D(i)&&i>=0,r=D(t)&&e&&i<t;if(this.status===es||this.status===rs||this.status===Zr||r)return this.Hi=setTimeout((()=>{this.hi()}),2e3),this.H;this.H.data.length>0&&ir(this.H).forEach((t=>{this.Wi({$snapshot_bytes:t.size,$snapshot_data:t.data,$session_id:t.sessionId,$window_id:t.windowId,$lib:"web",$lib_version:c.LIB_VERSION})}));return this.gi()}qi(t){var i,e=2+((null==(i=this.H)?void 0:i.data.length)||0);!this.ii&&(this.H.size+t.$snapshot_bytes+e>943718.4||this.H.sessionId!==this.Ft)&&(this.H=this.hi()),this.H.size+=t.$snapshot_bytes,this.H.data.push(t.$snapshot_data),this.Hi||this.ii||(this.Hi=setTimeout((()=>{this.hi()}),2e3))}Wi(t){this._instance.capture("$snapshot",t,{_url:this._instance.requestRouter.endpointFor("api",this.ci),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}zi(t){var i;this.Nt.triggerStatus(this.sessionId)===os&&(null==(i=this._instance)||null==(i=i.persistence)||i.register({["url"===t?di:vi]:this.Ft}),this.hi(),this.xi(t+"_trigger_matched"))}Ni(){this.Xt.urlBlocked||(this.Xt.urlBlocked=!0,clearInterval(this.Si),bs.info("recording paused due to URL blocker"),this.tryAddCustomEvent("recording paused",{reason:"url blocker"}))}Ui(){this.Xt.urlBlocked&&(this.Xt.urlBlocked=!1,this.Oi(),this.Ci(),this.tryAddCustomEvent("recording resumed",{reason:"left blocked url"}),bs.info("recording resumed"))}bi(){0!==this.Qt.Mt.length&&A(this.ai)&&(this.ai=this._instance.on("eventCaptured",(t=>{try{this.Qt.Mt.includes(t.event)&&this.zi("event")}catch(t){bs.error("Could not activate event trigger",t)}})))}overrideLinkedFlag(){this.Zt.linkedFlagSeen=!0,this.Oi(),this.xi("linked_flag_overridden")}overrideSampling(){var t;null==(t=this._instance.persistence)||t.register({[ui]:!0}),this.Oi(),this.xi("sampling_overridden")}overrideTrigger(t){this.zi(t)}xi(t,i){this._instance.register_for_session({$session_recording_start_reason:t}),bs.info(t.replace("_"," "),i),y(["recording_initialized","session_id_changed"],t)||this.tryAddCustomEvent(t,i)}get sdkDebugProperties(){var{sessionStartTimestamp:t}=this.jt.checkAndGetSessionAndWindowId(!0);return{$recording_status:this.status,$sdk_debug_replay_internal_buffer_length:this.H.data.length,$sdk_debug_replay_internal_buffer_size:this.H.size,$sdk_debug_current_session_duration:this.zt,$sdk_debug_session_start:t}}}var Is=Et("[SegmentIntegration]");function Ps(t,i){var e=t.config.segment;if(!e)return i();!function(t,i){var e=t.config.segment;if(!e)return i();var r=e=>{var r=()=>e.anonymousId()||Te();t.config.get_device_id=r,e.id()&&(t.register({distinct_id:e.id(),$device_id:r()}),t.persistence.set_property(wi,"identified")),i()},s=e.user();"then"in s&&I(s.then)?s.then((t=>r(t))):r(s)}(t,(()=>{e.register((t=>{Promise&&Promise.resolve||Is.warn("This browser does not have Promise support, and can not use the segment integration");var i=(i,e)=>{if(!e)return i;i.event.userId||i.event.anonymousId===t.get_distinct_id()||(Is.info("No userId set, resetting PostHog"),t.reset()),i.event.userId&&i.event.userId!==t.get_distinct_id()&&(Is.info("UserId set, identifying with PostHog"),t.identify(i.event.userId));var r=t.calculateEventProperties(e,i.event.properties);return i.event.properties=Object.assign({},r,i.event.properties),i};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:t=>i(t,t.event.event),page:t=>i(t,"$pageview"),identify:t=>i(t,"$identify"),screen:t=>i(t,"$screen")}})(t)).then((()=>{i()}))}))}var Ts="posthog-js";function Cs(t,i){var{organization:e,projectId:r,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:o=!0}=void 0===i?{}:i;return i=>{var a,l,h,u,d;if(!("*"===n||n.includes(i.level))||!t.__loaded)return i;i.tags||(i.tags={});var v=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());i.tags["PostHog Person URL"]=v,t.sessionRecordingStarted()&&(i.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var c=(null==(a=i.exception)?void 0:a.values)||[],f=c.map((t=>g({},t,{stacktrace:t.stacktrace?g({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map((t=>g({},t,{platform:"web:javascript"})))}):void 0}))),p={$exception_message:(null==(l=c[0])?void 0:l.value)||i.message,$exception_type:null==(h=c[0])?void 0:h.type,$exception_personURL:v,$exception_level:i.level,$exception_list:f,$sentry_event_id:i.event_id,$sentry_exception:i.exception,$sentry_exception_message:(null==(u=c[0])?void 0:u.value)||i.message,$sentry_exception_type:null==(d=c[0])?void 0:d.type,$sentry_tags:i.tags};return e&&r&&(p.$sentry_url=(s||"https://sentry.io/organizations/")+e+"/issues/?project="+r+"&query="+i.event_id),o&&t.exceptions.sendExceptionEvent(p),i}}class Ms{constructor(t,i,e,r,s,n){this.name=Ts,this.setupOnce=function(o){o(Cs(t,{organization:i,projectId:e,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}var Os=null!=t&&t.location?_e(t.location.hash,"__posthog")||_e(location.hash,"state"):null,Fs="_postHogToolbarParams",As=Et("[Toolbar]"),Ds=function(t){return t[t.UNINITIALIZED=0]="UNINITIALIZED",t[t.LOADING=1]="LOADING",t[t.LOADED=2]="LOADED",t}(Ds||{});class js{constructor(t){this.instance=t}Gi(t){v.ph_toolbar_state=t}Vi(){var t;return null!==(t=v.ph_toolbar_state)&&void 0!==t?t:Ds.UNINITIALIZED}maybeLoadToolbar(i,e,r){if(void 0===i&&(i=void 0),void 0===e&&(e=void 0),void 0===r&&(r=void 0),!t||!o)return!1;i=null!=i?i:t.location,r=null!=r?r:t.history;try{if(!e){try{t.localStorage.setItem("test","test"),t.localStorage.removeItem("test")}catch(t){return!1}e=null==t?void 0:t.localStorage}var s,n=Os||_e(i.hash,"__posthog")||_e(i.hash,"state"),a=n?At((()=>JSON.parse(atob(decodeURIComponent(n)))))||At((()=>JSON.parse(decodeURIComponent(n)))):null;return a&&"ph_authorize"===a.action?((s=a).source="url",s&&Object.keys(s).length>0&&(a.desiredHash?i.hash=a.desiredHash:r?r.replaceState(r.state,"",i.pathname+i.search):i.hash="")):((s=JSON.parse(e.getItem(Fs)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token)&&(this.loadToolbar(s),!0)}catch(t){return!1}}Ji(t){var i=v.ph_load_toolbar||v.ph_load_editor;!A(i)&&I(i)?i(t,this.instance):As.warn("No toolbar load function found")}loadToolbar(i){var e=!(null==o||!o.getElementById(Ii));if(!t||e)return!1;var r="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=g({token:this.instance.config.token},i,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(t.localStorage.setItem(Fs,JSON.stringify(g({},s,{source:void 0}))),this.Vi()===Ds.LOADED)this.Ji(s);else if(this.Vi()===Ds.UNINITIALIZED){var n;this.Gi(Ds.LOADING),null==(n=v.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",(t=>{if(t)return As.error("[Toolbar] Failed to load",t),void this.Gi(Ds.UNINITIALIZED);this.Gi(Ds.LOADED),this.Ji(s)})),Bt(t,"turbolinks:load",(()=>{this.Gi(Ds.UNINITIALIZED),this.loadToolbar(s)}))}return!0}Ki(t){return this.loadToolbar(t)}maybeLoadEditor(t,i,e){return void 0===t&&(t=void 0),void 0===i&&(i=void 0),void 0===e&&(e=void 0),this.maybeLoadToolbar(t,i,e)}}var Ls=Et("[TracingHeaders]");class Ns{constructor(t){this.Yi=void 0,this.Xi=void 0,this.lt=()=>{var t,i;C(this.Yi)&&(null==(t=v.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)||t._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager));C(this.Xi)&&(null==(i=v.__PosthogExtensions__)||null==(i=i.tracingHeadersPatchFns)||i._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=t}nt(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.tracingHeadersPatchFns&&t(),null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"tracing-headers",(i=>{if(i)return Ls.error("failed to load script",i);t()}))}startIfEnabledOrStop(){var t,i;this._instance.config.__add_tracing_headers?this.nt(this.lt):(null==(t=this.Yi)||t.call(this),null==(i=this.Xi)||i.call(this),this.Yi=void 0,this.Xi=void 0)}}var Us=Et("[Web Vitals]"),zs=9e5;class Bs{constructor(t){var i;this.Qi=!1,this.C=!1,this.H={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Zi=()=>{clearTimeout(this.te),0!==this.H.metrics.length&&(this._instance.capture("$web_vitals",this.H.metrics.reduce(((t,i)=>g({},t,{["$web_vitals_"+i.name+"_event"]:g({},i),["$web_vitals_"+i.name+"_value"]:i.value})),{})),this.H={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.ie=t=>{var i,e=null==(i=this._instance.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0);if(C(e))Us.error("Could not read session ID. Dropping metrics!");else{this.H=this.H||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var r=this.ee();if(!C(r))if(A(null==t?void 0:t.name)||A(null==t?void 0:t.value))Us.error("Invalid metric received",t);else if(this.re&&t.value>=this.re)Us.error("Ignoring metric with value >= "+this.re,t);else this.H.url!==r&&(this.Zi(),this.te=setTimeout(this.Zi,this.flushToCaptureTimeoutMs)),C(this.H.url)&&(this.H.url=r),this.H.firstMetricTimestamp=C(this.H.firstMetricTimestamp)?Date.now():this.H.firstMetricTimestamp,t.attribution&&t.attribution.interactionTargetElement&&(t.attribution.interactionTargetElement=void 0),this.H.metrics.push(g({},t,{$current_url:r,$session_id:e.sessionId,$window_id:e.windowId,timestamp:Date.now()})),this.H.metrics.length===this.allowedMetrics.length&&this.Zi()}},this.lt=()=>{var t,i,e,r,s=v.__PosthogExtensions__;C(s)||C(s.postHogWebVitalsCallbacks)||({onLCP:t,onCLS:i,onFCP:e,onINP:r}=s.postHogWebVitalsCallbacks),t&&i&&e&&r?(this.allowedMetrics.indexOf("LCP")>-1&&t(this.ie.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&i(this.ie.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&e(this.ie.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&r(this.ie.bind(this)),this.C=!0):Us.error("web vitals callbacks not loaded - not starting")},this._instance=t,this.Qi=!(null==(i=this._instance.persistence)||!i.props[Xt]),this.startIfEnabled()}get allowedMetrics(){var t,i,e=P(this._instance.config.capture_performance)?null==(t=this._instance.config.capture_performance)?void 0:t.web_vitals_allowed_metrics:void 0;return C(e)?(null==(i=this._instance.persistence)?void 0:i.props[Zt])||["CLS","FCP","INP","LCP"]:e}get flushToCaptureTimeoutMs(){return(P(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get re(){var t=P(this._instance.config.capture_performance)&&D(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:zs;return 0<t&&t<=6e4?zs:t}get isEnabled(){var t=null==a?void 0:a.protocol;if("http:"!==t&&"https:"!==t)return Us.info("Web Vitals are disabled on non-http/https protocols"),!1;var i=P(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(i)?i:this.Qi}startIfEnabled(){this.isEnabled&&!this.C&&(Us.info("enabled, starting..."),this.nt(this.lt))}onRemoteConfig(t){var i=P(t.capturePerformance)&&!!t.capturePerformance.web_vitals,e=P(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Xt]:i}),this._instance.persistence.register({[Zt]:e})),this.Qi=i,this.startIfEnabled()}nt(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.postHogWebVitalsCallbacks&&t(),null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"web-vitals",(i=>{i?Us.error("failed to load script",i):t()}))}ee(){var i=t?t.location.href:void 0;return i||Us.error("Could not determine current URL"),i}}var qs=Et("[Heatmaps]");function Hs(t){return P(t)&&"clientX"in t&&"clientY"in t&&D(t.clientX)&&D(t.clientY)}class Ws{constructor(t){var i;this.rageclicks=new he,this.Qi=!1,this.C=!1,this.se=null,this.instance=t,this.Qi=!(null==(i=this.instance.persistence)||!i.props[Vt])}get flushIntervalMilliseconds(){var t=5e3;return P(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(t=this.instance.config.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return C(this.instance.config.capture_heatmaps)?C(this.instance.config.enable_heatmaps)?this.Qi:this.instance.config.enable_heatmaps:!1!==this.instance.config.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.C)return;qs.info("starting..."),this.ne(),this.se=setInterval(this.oe.bind(this),this.flushIntervalMilliseconds)}else{var t,i;clearInterval(null!==(t=this.se)&&void 0!==t?t:void 0),null==(i=this.ae)||i.stop(),this.getAndClearBuffer()}}onRemoteConfig(t){var i=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Vt]:i}),this.Qi=i,this.startIfEnabled()}getAndClearBuffer(){var t=this.H;return this.H=void 0,t}le(t){this.he(t.originalEvent,"deadclick")}ne(){t&&o&&(Bt(t,"beforeunload",this.oe.bind(this)),Bt(o,"click",(i=>this.he(i||(null==t?void 0:t.event))),{capture:!0}),Bt(o,"mousemove",(i=>this.ue(i||(null==t?void 0:t.event))),{capture:!0}),this.ae=new Ke(this.instance,Ve,this.le.bind(this)),this.ae.startIfEnabled(),this.C=!0)}de(i,e){var r=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),o=function(i,e,r){for(var s=i;s&&Mi(s)&&!Oi(s,"body");){if(s===r)return!1;if(y(e,null==t?void 0:t.getComputedStyle(s).position))return!0;s=Hi(s)}return!1}(zi(i),["fixed","sticky"],n);return{x:i.clientX+(o?0:s),y:i.clientY+(o?0:r),target_fixed:o,type:e}}he(t,i){var e;if(void 0===i&&(i="click"),!Ci(t.target)&&Hs(t)){var r=this.de(t,i);null!=(e=this.rageclicks)&&e.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&this.ve(g({},r,{type:"rageclick"})),this.ve(r)}}ue(t){!Ci(t.target)&&Hs(t)&&(clearTimeout(this.ce),this.ce=setTimeout((()=>{this.ve(this.de(t,"mousemove"))}),500))}ve(i){if(t){var e=t.location.href;this.H=this.H||{},this.H[e]||(this.H[e]=[]),this.H[e].push(i)}}oe(){this.H&&!T(this.H)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class Gs{constructor(t){this._instance=t}doPageView(i,e){var r,s=this.fe(i,e);return this.pe={pathname:null!==(r=null==t?void 0:t.location.pathname)&&void 0!==r?r:"",pageViewId:e,timestamp:i},this._instance.scrollManager.resetContext(),s}doPageLeave(t){var i;return this.fe(t,null==(i=this.pe)?void 0:i.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.pe)?void 0:t.pageViewId}}fe(t,i){var e=this.pe;if(!e)return{$pageview_id:i};var r={$pageview_id:i,$prev_pageview_id:e.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:h,maxContentY:u}=s;if(!(C(n)||C(o)||C(a)||C(l)||C(h)||C(u))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),h=Math.ceil(h),u=Math.ceil(u);var d=n<=1?1:G(o/n,0,1,xt),v=n<=1?1:G(a/n,0,1,xt),c=l<=1?1:G(h/l,0,1,xt),f=l<=1?1:G(u/l,0,1,xt);r=Mt(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:v,$prev_pageview_last_content:h,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:f})}}return e.pathname&&(r.$prev_pageview_pathname=e.pathname),e.timestamp&&(r.$prev_pageview_duration=(t.getTime()-e.timestamp.getTime())/1e3),r}}var Vs=function(t){var i,e,r,s,n="";for(i=e=0,r=(t=(t+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,s=0;s<r;s++){var o=t.charCodeAt(s),a=null;o<128?e++:a=o>127&&o<2048?String.fromCharCode(o>>6|192,63&o|128):String.fromCharCode(o>>12|224,o>>6&63|128,63&o|128),F(a)||(e>i&&(n+=t.substring(i,e)),n+=a,i=e=s+1)}return e>i&&(n+=t.substring(i,t.length)),n},Js=!!h||!!l,Ks="text/plain",Ys=(t,i)=>{var[e,r]=t.split("?"),s=g({},i);null==r||r.split("&").forEach((t=>{var[i]=t.split("=");delete s[i]}));var n=fe(s);return e+"?"+(n=n?(r?r+"&":"")+n:r)},Xs=(t,i)=>JSON.stringify(t,((t,i)=>"bigint"==typeof i?i.toString():i),i),Qs=t=>{var{data:i,compression:e}=t;if(i){if(e===de.GZipJS){var r=Yr(Xr(Xs(i)),{mtime:0}),s=new Blob([r],{type:Ks});return{contentType:Ks,body:s,estimatedSize:s.size}}if(e===de.Base64){var n=function(t){var i,e,r,s,n,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=0,l=0,h="",u=[];if(!t)return t;t=Vs(t);do{i=(n=t.charCodeAt(a++)<<16|t.charCodeAt(a++)<<8|t.charCodeAt(a++))>>18&63,e=n>>12&63,r=n>>6&63,s=63&n,u[l++]=o.charAt(i)+o.charAt(e)+o.charAt(r)+o.charAt(s)}while(a<t.length);switch(h=u.join(""),t.length%3){case 1:h=h.slice(0,-2)+"==";break;case 2:h=h.slice(0,-1)+"="}return h}(Xs(i)),o=(t=>"data="+encodeURIComponent("string"==typeof t?t:Xs(t)))(n);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var a=Xs(i);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},Zs=[];l&&Zs.push({transport:"fetch",method:t=>{var i,e,{contentType:r,body:s,estimatedSize:n}=null!==(i=Qs(t))&&void 0!==i?i:{},o=new Headers;Ct(t.headers,(function(t,i){o.append(i,t)})),r&&o.append("Content-Type",r);var a=t.url,h=null;if(u){var d=new u;h={signal:d.signal,timeout:setTimeout((()=>d.abort()),t.timeout)}}l(a,g({method:(null==t?void 0:t.method)||"GET",headers:o,keepalive:"POST"===t.method&&(n||0)<52428.8,body:s,signal:null==(e=h)?void 0:e.signal},t.fetchOptions)).then((i=>i.text().then((e=>{var r={statusCode:i.status,text:e};if(200===i.status)try{r.json=JSON.parse(e)}catch(t){xt.error(t)}null==t.callback||t.callback(r)})))).catch((i=>{xt.error(i),null==t.callback||t.callback({statusCode:0,text:i})})).finally((()=>h?clearTimeout(h.timeout):null))}}),h&&Zs.push({transport:"XHR",method:t=>{var i,e=new h;e.open(t.method||"GET",t.url,!0);var{contentType:r,body:s}=null!==(i=Qs(t))&&void 0!==i?i:{};Ct(t.headers,(function(t,i){e.setRequestHeader(i,t)})),r&&e.setRequestHeader("Content-Type",r),t.timeout&&(e.timeout=t.timeout),t.disableXHRCredentials||(e.withCredentials=!0),e.onreadystatechange=()=>{if(4===e.readyState){var i={statusCode:e.status,text:e.responseText};if(200===e.status)try{i.json=JSON.parse(e.responseText)}catch(t){}null==t.callback||t.callback(i)}},e.send(s)}}),null!=n&&n.sendBeacon&&Zs.push({transport:"sendBeacon",method:t=>{var i=Ys(t.url,{beacon:"1"});try{var e,{contentType:r,body:s}=null!==(e=Qs(t))&&void 0!==e?e:{},o="string"==typeof s?new Blob([s],{type:r}):s;n.sendBeacon(i,o)}catch(t){}}});var tn=function(t,i){if(!function(t){try{new RegExp(t)}catch(t){return!1}return!0}(i))return!1;try{return new RegExp(i).test(t)}catch(t){return!1}};function en(t,i,e){return Xs({distinct_id:t,userPropertiesToSet:i,userPropertiesToSetOnce:e})}var rn={exact:(t,i)=>i.some((i=>t.some((t=>i===t)))),is_not:(t,i)=>i.every((i=>t.every((t=>i!==t)))),regex:(t,i)=>i.some((i=>t.some((t=>tn(i,t))))),not_regex:(t,i)=>i.every((i=>t.every((t=>!tn(i,t))))),icontains:(t,i)=>i.map(sn).some((i=>t.map(sn).some((t=>i.includes(t))))),not_icontains:(t,i)=>i.map(sn).every((i=>t.map(sn).every((t=>!i.includes(t)))))},sn=t=>t.toLowerCase(),nn=Et("[Error tracking]");class on{constructor(t){var i,e;this.ge=[],this._e=new vt([new ct,new kt,new pt,new ft,new wt,new bt,new _t,new St],[nt,lt]),this._instance=t,this.ge=null!==(i=null==(e=this._instance.persistence)?void 0:e.get_property(Kt))&&void 0!==i?i:[]}onRemoteConfig(t){var i,e,r,s=null!==(i=null==(e=t.errorTracking)?void 0:e.suppressionRules)&&void 0!==i?i:[],n=null==(r=t.errorTracking)?void 0:r.captureExtensionExceptions;this.ge=s,this._instance.persistence&&this._instance.persistence.register({[Kt]:this.ge,[Yt]:n})}get me(){var t,i=!!this._instance.get_property(Yt),e=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=e?e:i)&&void 0!==t&&t}buildProperties(t,i){return this._e.buildFromUnknown(t,{syntheticException:null==i?void 0:i.syntheticException,mechanism:{handled:null==i?void 0:i.handled}})}sendExceptionEvent(t){if(this.ye(t))nn.info("Skipping exception capture because a suppression rule matched");else{if(this.me||!this.be(t))return this._instance.capture("$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent"});nn.info("Skipping exception capture because it was thrown by an extension")}}ye(t){var i=t.$exception_list;if(!i||!R(i)||0===i.length)return!1;var e=i.reduce(((t,i)=>{var{type:e,value:r}=i;return M(e)&&e.length>0&&t.$exception_types.push(e),M(r)&&r.length>0&&t.$exception_values.push(r),t}),{$exception_types:[],$exception_values:[]});return this.ge.some((t=>{var i=t.values.map((t=>{var i,r=rn[t.operator],s=R(t.value)?t.value:[t.value],n=null!==(i=e[t.key])&&void 0!==i?i:[];return s.length>0&&r(s,n)}));return"OR"===t.type?i.some(Boolean):i.every(Boolean)}))}be(t){var i=t.$exception_list;return!(!i||!R(i))&&i.flatMap((t=>{var i,e;return null!==(i=null==(e=t.stacktrace)?void 0:e.frames)&&void 0!==i?i:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}}var an="Mobile",ln="iOS",hn="Android",un="Tablet",dn=hn+" "+un,vn="iPad",cn="Apple",fn=cn+" Watch",pn="Safari",gn="BlackBerry",_n="Samsung",mn=_n+"Browser",yn=_n+" Internet",bn="Chrome",wn=bn+" OS",Sn=bn+" "+ln,kn="Internet Explorer",$n=kn+" "+an,xn="Opera",En=xn+" Mini",Rn="Edge",In="Microsoft "+Rn,Pn="Firefox",Tn=Pn+" "+ln,Cn="Nintendo",Mn="PlayStation",On="Xbox",Fn=hn+" "+an,An=an+" "+pn,Dn="Windows",jn=Dn+" Phone",Ln="Nokia",Nn="Ouya",Un="Generic",zn=Un+" "+an.toLowerCase(),Bn=Un+" "+un.toLowerCase(),qn="Konqueror",Hn="(\\d+(\\.\\d+)?)",Wn=new RegExp("Version/"+Hn),Gn=new RegExp(On,"i"),Vn=new RegExp(Mn+" \\w+","i"),Jn=new RegExp(Cn+" \\w+","i"),Kn=new RegExp(gn+"|PlayBook|BB10","i"),Yn={"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"};var Xn=(t,i)=>i&&y(i,cn)||function(t){return y(t,pn)&&!y(t,bn)&&!y(t,hn)}(t),Qn=function(t,i){return i=i||"",y(t," OPR/")&&y(t,"Mini")?En:y(t," OPR/")?xn:Kn.test(t)?gn:y(t,"IE"+an)||y(t,"WPDesktop")?$n:y(t,mn)?yn:y(t,Rn)||y(t,"Edg/")?In:y(t,"FBIOS")?"Facebook "+an:y(t,"UCWEB")||y(t,"UCBrowser")?"UC Browser":y(t,"CriOS")?Sn:y(t,"CrMo")||y(t,bn)?bn:y(t,hn)&&y(t,pn)?Fn:y(t,"FxiOS")?Tn:y(t.toLowerCase(),qn.toLowerCase())?qn:Xn(t,i)?y(t,an)?An:pn:y(t,Pn)?Pn:y(t,"MSIE")||y(t,"Trident/")?kn:y(t,"Gecko")?Pn:""},Zn={[$n]:[new RegExp("rv:"+Hn)],[In]:[new RegExp(Rn+"?\\/"+Hn)],[bn]:[new RegExp("("+bn+"|CrMo)\\/"+Hn)],[Sn]:[new RegExp("CriOS\\/"+Hn)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Hn)],[pn]:[Wn],[An]:[Wn],[xn]:[new RegExp("(Opera|OPR)\\/"+Hn)],[Pn]:[new RegExp(Pn+"\\/"+Hn)],[Tn]:[new RegExp("FxiOS\\/"+Hn)],[qn]:[new RegExp("Konqueror[:/]?"+Hn,"i")],[gn]:[new RegExp(gn+" "+Hn),Wn],[Fn]:[new RegExp("android\\s"+Hn,"i")],[yn]:[new RegExp(mn+"\\/"+Hn)],[kn]:[new RegExp("(rv:|MSIE )"+Hn)],Mozilla:[new RegExp("rv:"+Hn)]},to=function(t,i){var e=Qn(t,i),r=Zn[e];if(C(r))return null;for(var s=0;s<r.length;s++){var n=r[s],o=t.match(n);if(o)return parseFloat(o[o.length-2])}return null},io=[[new RegExp(On+"; "+On+" (.*?)[);]","i"),t=>[On,t&&t[1]||""]],[new RegExp(Cn,"i"),[Cn,""]],[new RegExp(Mn,"i"),[Mn,""]],[Kn,[gn,""]],[new RegExp(Dn,"i"),(t,i)=>{if(/Phone/.test(i)||/WPDesktop/.test(i))return[jn,""];if(new RegExp(an).test(i)&&!/IEMobile\b/.test(i))return[Dn+" "+an,""];var e=/Windows NT ([0-9.]+)/i.exec(i);if(e&&e[1]){var r=e[1],s=Yn[r]||"";return/arm/i.test(i)&&(s="RT"),[Dn,s]}return[Dn,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>{if(t&&t[3]){var i=[t[3],t[4],t[5]||"0"];return[ln,i.join(".")]}return[ln,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var i="";return t&&t.length>=3&&(i=C(t[2])?t[3]:t[2]),["watchOS",i]}],[new RegExp("("+hn+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+hn+")","i"),t=>{if(t&&t[2]){var i=[t[2],t[3],t[4]||"0"];return[hn,i.join(".")]}return[hn,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var i=["Mac OS X",""];if(t&&t[1]){var e=[t[1],t[2],t[3]||"0"];i[1]=e.join(".")}return i}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[wn,""]],[/Linux|debian/i,["Linux",""]]],eo=function(t){return Jn.test(t)?Cn:Vn.test(t)?Mn:Gn.test(t)?On:new RegExp(Nn,"i").test(t)?Nn:new RegExp("("+jn+"|WPDesktop)","i").test(t)?jn:/iPad/.test(t)?vn:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?fn:Kn.test(t)?gn:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Ln,"i").test(t)?Ln:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?!new RegExp(an).test(t)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)?/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?hn:dn:hn:new RegExp("(pda|"+an+")","i").test(t)?zn:new RegExp(un,"i").test(t)&&!new RegExp(un+" pc","i").test(t)?Bn:""},ro="https?://(.*)",so=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],no=Ot(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],so),oo="<masked>",ao=["li_fat_id"];function lo(t,i,e){if(!o)return{};var r,s=i?Ot([],so,e||[]):[],n=ho(ge(o.URL,s,oo),t),a=(r={},Ct(ao,(function(t){var i=Ae.J(t);r[t]=i||null})),r);return Mt(a,n)}function ho(t,i){var e=no.concat(i||[]),r={};return Ct(e,(function(i){var e=pe(t,i);r[i]=e||null})),r}function uo(t){var i=function(t){return t?0===t.search(ro+"google.([^/?]*)")?"google":0===t.search(ro+"bing.com")?"bing":0===t.search(ro+"yahoo.com")?"yahoo":0===t.search(ro+"duckduckgo.com")?"duckduckgo":null:null}(t),e="yahoo"!=i?"q":"p",r={};if(!F(i)){r.$search_engine=i;var s=o?pe(o.referrer,e):"";s.length&&(r.ph_keyword=s)}return r}function vo(){return navigator.language||navigator.userLanguage}function co(){return(null==o?void 0:o.referrer)||"$direct"}function fo(t,i){var e=t?Ot([],so,i||[]):[],r=null==a?void 0:a.href.substring(0,1e3);return{r:co().substring(0,1e3),u:r?ge(r,e,oo):void 0}}function po(t){var i,{r:e,u:r}=t,s={$referrer:e,$referring_domain:null==e?void 0:"$direct"==e?"$direct":null==(i=ce(e))?void 0:i.host};if(r){s.$current_url=r;var n=ce(r);s.$host=null==n?void 0:n.host,s.$pathname=null==n?void 0:n.pathname;var o=ho(r);Mt(s,o)}if(e){var a=uo(e);Mt(s,a)}return s}function go(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function _o(){try{return(new Date).getTimezoneOffset()}catch(t){return}}function mo(i,e){if(!d)return{};var r,s,n,o=i?Ot([],so,e||[]):[],[l,h]=function(t){for(var i=0;i<io.length;i++){var[e,r]=io[i],s=e.exec(t),n=s&&(I(r)?r(s,t):r);if(n)return n}return["",""]}(d);return Mt(jt({$os:l,$os_version:h,$browser:Qn(d,navigator.vendor),$device:eo(d),$device_type:(s=d,n=eo(s),n===vn||n===dn||"Kobo"===n||"Kindle Fire"===n||n===Bn?un:n===Cn||n===On||n===Mn||n===Nn?"Console":n===fn?"Wearable":n?an:"Desktop"),$timezone:go(),$timezone_offset:_o()}),{$current_url:ge(null==a?void 0:a.href,o,oo),$host:null==a?void 0:a.host,$pathname:null==a?void 0:a.pathname,$raw_user_agent:d.length>1e3?d.substring(0,997)+"...":d,$browser_version:to(d,navigator.vendor),$browser_language:vo(),$browser_language_prefix:(r=vo(),"string"==typeof r?r.split("-")[0]:void 0),$screen_height:null==t?void 0:t.screen.height,$screen_width:null==t?void 0:t.screen.width,$viewport_height:null==t?void 0:t.innerHeight,$viewport_width:null==t?void 0:t.innerWidth,$lib:"web",$lib_version:c.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var yo=Et("[FeatureFlags]"),bo="$active_feature_flags",wo="$override_feature_flags",So="$feature_flag_payloads",ko="$override_feature_flag_payloads",$o="$feature_flag_request_id",xo=t=>{var i={};for(var[e,r]of Ft(t||{}))r&&(i[e]=r);return i},Eo=t=>{var i=t.flags;return i?(t.featureFlags=Object.fromEntries(Object.keys(i).map((t=>{var e;return[t,null!==(e=i[t].variant)&&void 0!==e?e:i[t].enabled]}))),t.featureFlagPayloads=Object.fromEntries(Object.keys(i).filter((t=>i[t].enabled)).filter((t=>{var e;return null==(e=i[t].metadata)?void 0:e.payload})).map((t=>{var e;return[t,null==(e=i[t].metadata)?void 0:e.payload]})))):yo.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t},Ro=function(t){return t.FeatureFlags="feature_flags",t.Recordings="recordings",t}({});class Io{constructor(t){this.we=!1,this.Se=!1,this.ke=!1,this.$e=!1,this.xe=!1,this.Ee=!1,this.Re=!1,this._instance=t,this.featureFlagEventHandlers=[]}Ie(){var t=this._instance.config.evaluation_environments;return null!=t&&t.length?t.filter((t=>{var i=t&&"string"==typeof t&&t.trim().length>0;return i||yo.error("Invalid evaluation environment found:",t,"Expected non-empty string"),i})):[]}Pe(){return this.Ie().length>0}flags(){if(this._instance.config.__preview_remote_config)this.Ee=!0;else{var t=!this.Te&&(this._instance.config.advanced_disable_feature_flags||this._instance.config.advanced_disable_feature_flags_on_first_load);this.Ce({disableFlags:t})}}get hasLoadedFlags(){return this.Se}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this._instance.get_property(pi),i=this._instance.get_property(wo),e=this._instance.get_property(ko);if(!e&&!i)return t||{};var r=Mt({},t||{}),s=[...new Set([...Object.keys(e||{}),...Object.keys(i||{})])];for(var n of s){var o,a,l=r[n],h=null==i?void 0:i[n],u=C(h)?null!==(o=null==l?void 0:l.enabled)&&void 0!==o&&o:!!h,d=C(h)?l.variant:"string"==typeof h?h:void 0,v=null==e?void 0:e[n],c=g({},l,{enabled:u,variant:u?null!=d?d:null==l?void 0:l.variant:void 0});if(u!==(null==l?void 0:l.enabled)&&(c.original_enabled=null==l?void 0:l.enabled),d!==(null==l?void 0:l.variant)&&(c.original_variant=null==l?void 0:l.variant),v)c.metadata=g({},null==l?void 0:l.metadata,{payload:v,original_payload:null==l||null==(a=l.metadata)?void 0:a.payload});r[n]=c}return this.we||(yo.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:e,finalDetails:r}),this.we=!0),r}getFlagVariants(){var t=this._instance.get_property(ci),i=this._instance.get_property(wo);if(!i)return t||{};for(var e=Mt({},t),r=Object.keys(i),s=0;s<r.length;s++)e[r[s]]=i[r[s]];return this.we||(yo.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:i,finalFlags:e}),this.we=!0),e}getFlagPayloads(){var t=this._instance.get_property(So),i=this._instance.get_property(ko);if(!i)return t||{};for(var e=Mt({},t||{}),r=Object.keys(i),s=0;s<r.length;s++)e[r[s]]=i[r[s]];return this.we||(yo.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:i,finalPayloads:e}),this.we=!0),e}reloadFeatureFlags(){this.$e||this._instance.config.advanced_disable_feature_flags||this.Te||(this.Te=setTimeout((()=>{this.Ce()}),5))}Me(){clearTimeout(this.Te),this.Te=void 0}ensureFlagsLoaded(){this.Se||this.ke||this.Te||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.$e=t}Ce(t){var i;if(this.Me(),!this._instance.L())if(this.ke)this.xe=!0;else{var e={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:g({},(null==(i=this._instance.persistence)?void 0:i.get_initial_props())||{},this._instance.get_property(gi)||{}),group_properties:this._instance.get_property(_i)};(null!=t&&t.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(e.disable_flags=!0),this.Pe()&&(e.evaluation_environments=this.Ie());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":"",o=this._instance.requestRouter.endpointFor("api",s+n);r&&(e.timezone=go()),this.ke=!0,this._instance.Oe({method:"POST",url:o,data:e,compression:this._instance.config.disable_compression?void 0:de.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:t=>{var i,r,s=!0;(200===t.statusCode&&(this.xe||(this.$anon_distinct_id=void 0),s=!1),this.ke=!1,this.Ee)||(this.Ee=!0,this._instance.Fe(null!==(r=t.json)&&void 0!==r?r:{}));if(!e.disable_flags||this.xe)if(this.Re=!s,t.json&&null!=(i=t.json.quotaLimited)&&i.includes(Ro.FeatureFlags))yo.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;if(!e.disable_flags)this.receivedFeatureFlags(null!==(n=t.json)&&void 0!==n?n:{},s);this.xe&&(this.xe=!1,this.Ce())}}})}}getFeatureFlag(t,i){if(void 0===i&&(i={}),this.Se||this.getFlags()&&this.getFlags().length>0){var e=this.getFlagVariants()[t],r=""+e,s=this._instance.get_property($o)||void 0,n=this._instance.get_property(bi)||{};if((i.send_event||!("send_event"in i))&&(!(t in n)||!n[t].includes(r))){var o,a,l,h,u,d,v,c,f;R(n[t])?n[t].push(r):n[t]=[r],null==(o=this._instance.persistence)||o.register({[bi]:n});var p=this.getFeatureFlagDetails(t),g={$feature_flag:t,$feature_flag_response:e,$feature_flag_payload:this.getFeatureFlagPayload(t)||null,$feature_flag_request_id:s,$feature_flag_bootstrapped_response:(null==(a=this._instance.config.bootstrap)||null==(a=a.featureFlags)?void 0:a[t])||null,$feature_flag_bootstrapped_payload:(null==(l=this._instance.config.bootstrap)||null==(l=l.featureFlagPayloads)?void 0:l[t])||null,$used_bootstrap_value:!this.Re};C(null==p||null==(h=p.metadata)?void 0:h.version)||(g.$feature_flag_version=p.metadata.version);var _,m=null!==(u=null==p||null==(d=p.reason)?void 0:d.description)&&void 0!==u?u:null==p||null==(v=p.reason)?void 0:v.code;if(m&&(g.$feature_flag_reason=m),null!=p&&null!=(c=p.metadata)&&c.id&&(g.$feature_flag_id=p.metadata.id),C(null==p?void 0:p.original_variant)&&C(null==p?void 0:p.original_enabled)||(g.$feature_flag_original_response=C(p.original_variant)?p.original_enabled:p.original_variant),null!=p&&null!=(f=p.metadata)&&f.original_payload)g.$feature_flag_original_payload=null==p||null==(_=p.metadata)?void 0:_.original_payload;this._instance.capture("$feature_flag_called",g)}return e}yo.warn('getFeatureFlag for key "'+t+"\" failed. Feature flags didn't load in time.")}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){return this.getFlagPayloads()[t]}getRemoteConfigPayload(t,i){var e=this._instance.config.token,r={distinct_id:this._instance.get_distinct_id(),token:e};this.Pe()&&(r.evaluation_environments=this.Ie()),this._instance.Oe({method:"POST",url:this._instance.requestRouter.endpointFor("api","/flags/?v=2&config=true"),data:r,compression:this._instance.config.disable_compression?void 0:de.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:e=>{var r,s=null==(r=e.json)?void 0:r.featureFlagPayloads;i((null==s?void 0:s[t])||void 0)}})}isFeatureEnabled(t,i){if(void 0===i&&(i={}),this.Se||this.getFlags()&&this.getFlags().length>0){var e=this.getFeatureFlag(t,i);return C(e)?void 0:!!e}yo.warn('isFeatureEnabled for key "'+t+"\" failed. Feature flags didn't load in time.")}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((i=>i!==t))}receivedFeatureFlags(t,i){if(this._instance.persistence){this.Se=!0;var e=this.getFlagVariants(),r=this.getFlagPayloads(),s=this.getFlagsWithDetails();!function(t,i,e,r,s){void 0===e&&(e={}),void 0===r&&(r={}),void 0===s&&(s={});var n=Eo(t),o=n.flags,a=n.featureFlags,l=n.featureFlagPayloads;if(a){var h=t.requestId;if(R(a)){yo.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var u={};if(a)for(var d=0;d<a.length;d++)u[a[d]]=!0;i&&i.register({[bo]:a,[ci]:u})}else{var v=a,c=l,f=o;t.errorsWhileComputingFlags&&(v=g({},e,v),c=g({},r,c),f=g({},s,f)),i&&i.register(g({[bo]:Object.keys(xo(v)),[ci]:v||{},[So]:c||{},[pi]:f||{}},h?{[$o]:h}:{}))}}}(t,this._instance.persistence,e,r,s),this.Ae(i)}}override(t,i){void 0===i&&(i=!1),yo.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:i})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this._instance.persistence)return yo.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===t)return this._instance.persistence.unregister(wo),this._instance.persistence.unregister(ko),void this.Ae();if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i,e=t;if(this.we=Boolean(null!==(i=e.suppressWarning)&&void 0!==i&&i),"flags"in e)if(!1===e.flags)this._instance.persistence.unregister(wo);else if(e.flags)if(R(e.flags)){for(var r={},s=0;s<e.flags.length;s++)r[e.flags[s]]=!0;this._instance.persistence.register({[wo]:r})}else this._instance.persistence.register({[wo]:e.flags});return"payloads"in e&&(!1===e.payloads?this._instance.persistence.unregister(ko):e.payloads&&this._instance.persistence.register({[ko]:e.payloads})),void this.Ae()}this.Ae()}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.Se){var{flags:i,flagVariants:e}=this.De();t(i,e)}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,i,e){var r,s=(this._instance.get_property(fi)||[]).find((i=>i.flagKey===t)),n={["$feature_enrollment/"+t]:i},o={$feature_flag:t,$feature_enrollment:i,$set:n};s&&(o.$early_access_feature_name=s.name),e&&(o.$feature_enrollment_stage=e),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(n,!1);var a=g({},this.getFlagVariants(),{[t]:i});null==(r=this._instance.persistence)||r.register({[bo]:Object.keys(xo(a)),[ci]:a}),this.Ae()}getEarlyAccessFeatures(t,i,e){void 0===i&&(i=!1);var r=this._instance.get_property(fi),s=e?"&"+e.map((t=>"stage="+t)).join("&"):"";if(r&&!i)return t(r);this._instance.Oe({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+s),method:"GET",callback:i=>{var e,r;if(i.json){var s=i.json.earlyAccessFeatures;return null==(e=this._instance.persistence)||e.unregister(fi),null==(r=this._instance.persistence)||r.register({[fi]:s}),t(s)}}})}De(){var t=this.getFlags(),i=this.getFlagVariants();return{flags:t.filter((t=>i[t])),flagVariants:Object.keys(i).filter((t=>i[t])).reduce(((t,e)=>(t[e]=i[e],t)),{})}}Ae(t){var{flags:i,flagVariants:e}=this.De();this.featureFlagEventHandlers.forEach((r=>r(i,e,{errorsLoading:t})))}setPersonPropertiesForFlags(t,i){void 0===i&&(i=!0);var e=this._instance.get_property(gi)||{};this._instance.register({[gi]:g({},e,t)}),i&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(gi)}setGroupPropertiesForFlags(t,i){void 0===i&&(i=!0);var e=this._instance.get_property(_i)||{};0!==Object.keys(e).length&&Object.keys(e).forEach((i=>{e[i]=g({},e[i],t[i]),delete t[i]})),this._instance.register({[_i]:g({},e,t)}),i&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var i=this._instance.get_property(_i)||{};this._instance.register({[_i]:g({},i,{[t]:{}})})}else this._instance.unregister(_i)}reset(){this.Se=!1,this.ke=!1,this.$e=!1,this.xe=!1,this.Ee=!1,this.Re=!1,this.$anon_distinct_id=void 0,this.Me(),this.we=!1}}var Po=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class To{constructor(t,i){this.A=t,this.props={},this.je=!1,this.Le=(t=>{var i="";return t.token&&(i=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+i+"_posthog"})(t),this.it=this.Ne(t),this.load(),t.debug&&xt.info("Persistence loaded",t.persistence,g({},this.props)),this.update_config(t,t,i),this.save()}isDisabled(){return!!this.Ue}Ne(t){-1===Po.indexOf(t.persistence.toLowerCase())&&(xt.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var i=t.persistence.toLowerCase();return"localstorage"===i&&je.G()?je:"localstorage+cookie"===i&&Ne.G()?Ne:"sessionstorage"===i&&qe.G()?qe:"memory"===i?ze:"cookie"===i?Ae:Ne.G()?Ne:Ae}properties(){var t={};return Ct(this.props,(function(i,e){if(e===ci&&P(i))for(var r=Object.keys(i),n=0;n<r.length;n++)t["$feature/"+r[n]]=i[r[n]];else a=e,l=!1,(F(o=Ti)?l:s&&o.indexOf===s?-1!=o.indexOf(a):(Ct(o,(function(t){if(l||(l=t===a))return Pt})),l))||(t[e]=i);var o,a,l})),t}load(){if(!this.Ue){var t=this.it.K(this.Le);t&&(this.props=Mt({},t))}}save(){this.Ue||this.it.Y(this.Le,this.props,this.ze,this.Be,this.qe,this.A.debug)}remove(){this.it.X(this.Le,!1),this.it.X(this.Le,!0)}clear(){this.remove(),this.props={}}register_once(t,i,e){if(P(t)){C(i)&&(i="None"),this.ze=C(e)?this.He:e;var r=!1;if(Ct(t,((t,e)=>{this.props.hasOwnProperty(e)&&this.props[e]!==i||(this.props[e]=t,r=!0)})),r)return this.save(),!0}return!1}register(t,i){if(P(t)){this.ze=C(i)?this.He:i;var e=!1;if(Ct(t,((i,r)=>{t.hasOwnProperty(r)&&this.props[r]!==i&&(this.props[r]=i,e=!0)})),e)return this.save(),!0}return!1}unregister(t){t in this.props&&(delete this.props[t],this.save())}update_campaign_params(){if(!this.je){var t=lo(this.A.custom_campaign_params,this.A.mask_personal_data_properties,this.A.custom_personal_data_properties);T(jt(t))||this.register(t),this.je=!0}}update_search_keyword(){var t;this.register((t=null==o?void 0:o.referrer)?uo(t):{})}update_referrer_info(){var t;this.register_once({$referrer:co(),$referring_domain:null!=o&&o.referrer&&(null==(t=ce(o.referrer))?void 0:t.host)||"$direct"},void 0)}set_initial_person_info(){this.props[$i]||this.props[xi]||this.register_once({[Ei]:fo(this.A.mask_personal_data_properties,this.A.custom_personal_data_properties)},void 0)}get_initial_props(){var t={};Ct([xi,$i],(i=>{var e=this.props[i];e&&Ct(e,(function(i,e){t["$initial_"+w(e)]=i}))}));var i,e,r=this.props[Ei];if(r){var s=(i=po(r),e={},Ct(i,(function(t,i){e["$initial_"+w(i)]=t})),e);Mt(t,s)}return t}safe_merge(t){return Ct(this.props,(function(i,e){e in t||(t[e]=i)})),t}update_config(t,i,e){if(this.He=this.ze=t.cookie_expiration,this.set_disabled(t.disable_persistence||!!e),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),t.persistence!==i.persistence){var r=this.Ne(t),s=this.props;this.clear(),this.it=r,this.props=s,this.save()}}set_disabled(t){this.Ue=t,this.Ue?this.remove():this.save()}set_cross_subdomain(t){t!==this.Be&&(this.Be=t,this.remove(),this.save())}set_secure(t){t!==this.qe&&(this.qe=t,this.remove(),this.save())}set_event_timer(t,i){var e=this.props[Wt]||{};e[t]=i,this.props[Wt]=e,this.save()}remove_event_timer(t){var i=(this.props[Wt]||{})[t];return C(i)||(delete this.props[Wt][t],this.save()),i}get_property(t){return this.props[t]}set_property(t,i){this.props[t]=i,this.save()}}var Co=function(t){return t.Popover="popover",t.API="api",t.Widget="widget",t.ExternalSurvey="external_survey",t}({}),Mo=function(t){return t.SHOWN="survey shown",t.DISMISSED="survey dismissed",t.SENT="survey sent",t}({}),Oo=function(t){return t.SURVEY_ID="$survey_id",t.SURVEY_NAME="$survey_name",t.SURVEY_RESPONSE="$survey_response",t.SURVEY_ITERATION="$survey_iteration",t.SURVEY_ITERATION_START_DATE="$survey_iteration_start_date",t.SURVEY_PARTIALLY_COMPLETED="$survey_partially_completed",t.SURVEY_SUBMISSION_ID="$survey_submission_id",t.SURVEY_QUESTIONS="$survey_questions",t.SURVEY_COMPLETED="$survey_completed",t}({}),Fo=function(t){return t.Popover="popover",t.Inline="inline",t}({});class Ao{constructor(){this.We={},this.We={}}on(t,i){return this.We[t]||(this.We[t]=[]),this.We[t].push(i),()=>{this.We[t]=this.We[t].filter((t=>t!==i))}}emit(t,i){for(var e of this.We[t]||[])e(i);for(var r of this.We["*"]||[])r(t,i)}}class Do{constructor(t){this.Ge=new Ao,this.Ve=(t,i)=>this.Je(t,i)&&this.Ke(t,i)&&this.Ye(t,i),this.Je=(t,i)=>null==i||!i.event||(null==t?void 0:t.event)===(null==i?void 0:i.event),this._instance=t,this.Xe=new Set,this.Qe=new Set}init(){var t;if(!C(null==(t=this._instance)?void 0:t.Ze)){var i;null==(i=this._instance)||i.Ze(((t,i)=>{this.on(t,i)}))}}register(t){var i,e;if(!C(null==(i=this._instance)?void 0:i.Ze)&&(t.forEach((t=>{var i,e;null==(i=this.Qe)||i.add(t),null==(e=t.steps)||e.forEach((t=>{var i;null==(i=this.Xe)||i.add((null==t?void 0:t.event)||"")}))})),null!=(e=this._instance)&&e.autocapture)){var r,s=new Set;t.forEach((t=>{var i;null==(i=t.steps)||i.forEach((t=>{null!=t&&t.selector&&s.add(null==t?void 0:t.selector)}))})),null==(r=this._instance)||r.autocapture.setElementSelectors(s)}}on(t,i){var e;null!=i&&0!=t.length&&(this.Xe.has(t)||this.Xe.has(null==i?void 0:i.event))&&this.Qe&&(null==(e=this.Qe)?void 0:e.size)>0&&this.Qe.forEach((t=>{this.tr(i,t)&&this.Ge.emit("actionCaptured",t.name)}))}ir(t){this.onAction("actionCaptured",(i=>t(i)))}tr(t,i){if(null==(null==i?void 0:i.steps))return!1;for(var e of i.steps)if(this.Ve(t,e))return!0;return!1}onAction(t,i){return this.Ge.on(t,i)}Ke(t,i){if(null!=i&&i.url){var e,r=null==t||null==(e=t.properties)?void 0:e.$current_url;if(!r||"string"!=typeof r)return!1;if(!Do.er(r,null==i?void 0:i.url,(null==i?void 0:i.url_matching)||"contains"))return!1}return!0}static er(i,e,r){switch(r){case"regex":return!!t&&tn(i,e);case"exact":return e===i;case"contains":var s=Do.rr(e).replace(/_/g,".").replace(/%/g,".*");return tn(i,s);default:return!1}}static rr(t){return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}Ye(t,i){if((null!=i&&i.href||null!=i&&i.tag_name||null!=i&&i.text)&&!this.sr(t).some((t=>!(null!=i&&i.href&&!Do.er(t.href||"",null==i?void 0:i.href,(null==i?void 0:i.href_matching)||"exact"))&&((null==i||!i.tag_name||t.tag_name===(null==i?void 0:i.tag_name))&&!(null!=i&&i.text&&!Do.er(t.text||"",null==i?void 0:i.text,(null==i?void 0:i.text_matching)||"exact")&&!Do.er(t.$el_text||"",null==i?void 0:i.text,(null==i?void 0:i.text_matching)||"exact"))))))return!1;if(null!=i&&i.selector){var e,r=null==t||null==(e=t.properties)?void 0:e.$element_selectors;if(!r)return!1;if(!r.includes(null==i?void 0:i.selector))return!1}return!0}sr(t){return null==(null==t?void 0:t.properties.$elements)?[]:null==t?void 0:t.properties.$elements}}var jo=Et("[Surveys]");var Lo="seenSurvey_",No=(t,i)=>{var e="$survey_"+i+"/"+t.id;return t.current_iteration&&t.current_iteration>0&&(e="$survey_"+i+"/"+t.id+"/"+t.current_iteration),e},Uo=t=>{var i=""+Lo+t.id;return t.current_iteration&&t.current_iteration>0&&(i=""+Lo+t.id+"_"+t.current_iteration),i},zo=[Co.Popover,Co.Widget,Co.API],Bo={ignoreConditions:!1,ignoreDelay:!1,displayType:Fo.Popover};class qo{constructor(t){this._instance=t,this.nr=new Map,this.ar=new Map}register(t){var i;C(null==(i=this._instance)?void 0:i.Ze)||(this.lr(t),this.hr(t))}hr(t){var i=t.filter((t=>{var i,e;return(null==(i=t.conditions)?void 0:i.actions)&&(null==(e=t.conditions)||null==(e=e.actions)||null==(e=e.values)?void 0:e.length)>0}));if(0!==i.length){if(null==this.ur){this.ur=new Do(this._instance),this.ur.init();this.ur.ir((t=>{this.onAction(t)}))}i.forEach((t=>{var i,e,r,s,n;t.conditions&&null!=(i=t.conditions)&&i.actions&&null!=(e=t.conditions)&&null!=(e=e.actions)&&e.values&&(null==(r=t.conditions)||null==(r=r.actions)||null==(r=r.values)?void 0:r.length)>0&&(null==(s=this.ur)||s.register(t.conditions.actions.values),null==(n=t.conditions)||null==(n=n.actions)||null==(n=n.values)||n.forEach((i=>{if(i&&i.name){var e=this.ar.get(i.name);e&&e.push(t.id),this.ar.set(i.name,e||[t.id])}})))}))}}lr(t){var i;if(0!==t.filter((t=>{var i,e;return(null==(i=t.conditions)?void 0:i.events)&&(null==(e=t.conditions)||null==(e=e.events)||null==(e=e.values)?void 0:e.length)>0})).length){null==(i=this._instance)||i.Ze(((t,i)=>{this.onEvent(t,i)})),t.forEach((t=>{var i;null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)||i.forEach((i=>{if(i&&i.name){var e=this.nr.get(i.name);e&&e.push(t.id),this.nr.set(i.name,e||[t.id])}}))}))}}onEvent(t,i){var e,r,s=(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[yi])||[];if(Mo.SHOWN===t&&i&&s.length>0){var n;jo.info("survey event matched, removing survey from activated surveys",{event:t,eventPayload:i,existingActivatedSurveys:s});var o=null==i||null==(n=i.properties)?void 0:n.$survey_id;if(o){var a=s.indexOf(o);a>=0&&(s.splice(a,1),this.dr(s))}}else if(this.nr.has(t)){jo.info("survey event name matched",{event:t,eventPayload:i,surveys:this.nr.get(t)});var l=[];null==(r=this._instance)||r.getSurveys((i=>{l=i.filter((i=>{var e;return null==(e=this.nr.get(t))?void 0:e.includes(i.id)}))}));var h=l.filter((e=>{var r,s=null==(r=e.conditions)||null==(r=r.events)||null==(r=r.values)?void 0:r.find((i=>i.name===t));return!!s&&(!s.propertyFilters||Object.entries(s.propertyFilters).every((t=>{var e,[r,s]=t,n=null==i||null==(e=i.properties)?void 0:e[r];if(C(n)||F(n))return!1;var o=[String(n)],a=rn[s.operator];return a?a(s.values,o):(jo.warn("Unknown property comparison operator: "+s.operator),!1)})))}));this.dr(s.concat(h.map((t=>t.id))||[]))}}onAction(t){var i,e=(null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[yi])||[];this.ar.has(t)&&this.dr(e.concat(this.ar.get(t)||[]))}dr(t){var i;jo.info("updating activated surveys",{activatedSurveys:t}),null==(i=this._instance)||null==(i=i.persistence)||i.register({[yi]:[...new Set(t)]})}getSurveys(){var t,i=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[yi];return i||[]}getEventToSurveys(){return this.nr}vr(){return this.ur}}class Ho{constructor(t){this.cr=void 0,this._surveyManager=null,this.pr=!1,this.gr=!1,this._r=[],this._instance=t,this._surveyEventReceiver=null}onRemoteConfig(t){if(!this._instance.config.disable_surveys){var i=t.surveys;if(A(i))return jo.warn("Flags not loaded yet. Not loading surveys.");var e=R(i);this.cr=e?i.length>0:i,jo.info("flags response received, isSurveysEnabled: "+this.cr),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var t=[],i=0;i<localStorage.length;i++){var e=localStorage.key(i);(null!=e&&e.startsWith(Lo)||null!=e&&e.startsWith("inProgressSurvey_"))&&t.push(e)}t.forEach((t=>localStorage.removeItem(t)))}loadIfEnabled(){if(!this._surveyManager)if(this.gr)jo.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)jo.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())jo.info("Not loading surveys in cookieless mode without consent.");else{var t=null==v?void 0:v.__PosthogExtensions__;if(t){if(!C(this.cr)||this._instance.config.advanced_enable_surveys){var i=this.cr||this._instance.config.advanced_enable_surveys;this.gr=!0;try{var e=t.generateSurveys;if(e)return void this.mr(e,i);var r=t.loadExternalDependency;if(!r)return void this.yr("PostHog loadExternalDependency extension not found.");r(this._instance,"surveys",(e=>{e||!t.generateSurveys?this.yr("Could not load surveys script",e):this.mr(t.generateSurveys,i)}))}catch(t){throw this.yr("Error initializing surveys",t),t}finally{this.gr=!1}}}else jo.error("PostHog Extensions not found.")}}mr(t,i){this._surveyManager=t(this._instance,i),this._surveyEventReceiver=new qo(this._instance),jo.info("Surveys loaded successfully"),this.br({isLoaded:!0})}yr(t,i){jo.error(t,i),this.br({isLoaded:!1,error:t})}onSurveysLoaded(t){return this._r.push(t),this._surveyManager&&this.br({isLoaded:!0}),()=>{this._r=this._r.filter((i=>i!==t))}}getSurveys(t,i){if(void 0===i&&(i=!1),this._instance.config.disable_surveys)return jo.info("Disabled. Not loading surveys."),t([]);var e=this._instance.get_property(mi);if(e&&!i)return t(e,{isLoaded:!0});if(this.pr)return t([],{isLoaded:!1,error:"Surveys are already being loaded"});try{this.pr=!0,this._instance.Oe({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:i=>{var e;this.pr=!1;var r=i.statusCode;if(200!==r||!i.json){var s="Surveys API could not be loaded, status: "+r;return jo.error(s),t([],{isLoaded:!1,error:s})}var n,o=i.json.surveys||[],a=o.filter((t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(function(t){var i;return!(null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)||!i.length)}(t)||function(t){var i;return!(null==(i=t.conditions)||null==(i=i.actions)||null==(i=i.values)||!i.length)}(t))));a.length>0&&(null==(n=this._surveyEventReceiver)||n.register(a));return null==(e=this._instance.persistence)||e.register({[mi]:o}),t(o,{isLoaded:!0})}})}catch(t){throw this.pr=!1,t}}br(t){for(var i of this._r)try{if(!t.isLoaded)return i([],t);this.getSurveys(i)}catch(t){jo.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,i){if(void 0===i&&(i=!1),!A(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,i);jo.warn("init was not called")}wr(t){var i=null;return this.getSurveys((e=>{var r;i=null!==(r=e.find((i=>i.id===t)))&&void 0!==r?r:null})),i}Sr(t){if(A(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var i="string"==typeof t?this.wr(t):t;return i?this._surveyManager.checkSurveyEligibility(i):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(A(this._surveyManager))return jo.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var i=this.Sr(t);return{visible:i.eligible,disabledReason:i.reason}}canRenderSurveyAsync(t,i){return A(this._surveyManager)?(jo.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise((e=>{this.getSurveys((i=>{var r,s=null!==(r=i.find((i=>i.id===t)))&&void 0!==r?r:null;if(s){var n=this.Sr(s);e({visible:n.eligible,disabledReason:n.reason})}else e({visible:!1,disabledReason:"Survey not found"})}),i)}))}renderSurvey(t,i){var e;if(A(this._surveyManager))jo.warn("init was not called");else{var r="string"==typeof t?this.wr(t):t;if(null!=r&&r.id)if(zo.includes(r.type)){var s=null==o?void 0:o.querySelector(i);if(s)return null!=(e=r.appearance)&&e.surveyPopupDelaySeconds?(jo.info("Rendering survey "+r.id+" with delay of "+r.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var t,i;jo.info("Rendering survey "+r.id+" with delay of "+(null==(t=r.appearance)?void 0:t.surveyPopupDelaySeconds)+" seconds"),null==(i=this._surveyManager)||i.renderSurvey(r,s),jo.info("Survey "+r.id+" rendered")}),1e3*r.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(r,s);jo.warn("Survey element not found")}else jo.warn("Surveys of type "+r.type+" cannot be rendered in the app");else jo.warn("Survey not found")}}displaySurvey(t,i){var e;if(A(this._surveyManager))jo.warn("init was not called");else{var r=this.wr(t);if(r){var s=r;if(null!=(e=r.appearance)&&e.surveyPopupDelaySeconds&&i.ignoreDelay&&(s=g({},r,{appearance:g({},r.appearance,{surveyPopupDelaySeconds:0})})),!1===i.ignoreConditions){var n=this.canRenderSurvey(r);if(!n.visible)return void jo.warn("Survey is not eligible to be displayed: ",n.disabledReason)}i.displayType!==Fo.Inline?this._surveyManager.handlePopoverSurvey(s):this.renderSurvey(s,i.selector)}else jo.warn("Survey not found")}}}var Wo=Et("[RateLimiter]");class Go{constructor(t){var i,e;this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var i=t.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach((t=>{Wo.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void Wo.warn('could not rate limit - continuing. Error: "'+(null==t?void 0:t.message)+'"',{text:i})}},this.instance=t,this.captureEventsPerSecond=(null==(i=t.config.rate_limiting)?void 0:i.events_per_second)||10,this.captureEventsBurstLimit=Math.max((null==(e=t.config.rate_limiting)?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(t){var i,e,r;void 0===t&&(t=!1);var s=(new Date).getTime(),n=null!==(i=null==(e=this.instance.persistence)?void 0:e.get_property(ki))&&void 0!==i?i:{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 o=n.tokens<1;return o||t||(n.tokens=Math.max(0,n.tokens-1)),!o||this.lastEventRateLimited||t||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=o,null==(r=this.instance.persistence)||r.set_property(ki,n),{isRateLimited:o,remainingTokens:n.tokens}}isServerRateLimited(t){var i=this.serverLimits[t||"events"]||!1;return!1!==i&&(new Date).getTime()<i}}var Vo=Et("[RemoteConfig]");class Jo{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=v._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}kr(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.loadExternalDependency?null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):(Vo.error("PostHog Extensions not found. Cannot load remote config."),t())}$r(t){this._instance.Oe({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:i=>{t(i.json)}})}load(){try{if(this.remoteConfig)return Vo.info("Using preloaded remote config",this.remoteConfig),void this.Fe(this.remoteConfig);if(this._instance.L())return void Vo.warn("Remote config is disabled. Falling back to local config.");this.kr((t=>{if(!t)return Vo.info("No config found after loading remote JS config. Falling back to JSON."),void this.$r((t=>{this.Fe(t)}));this.Fe(t)}))}catch(t){Vo.error("Error loading remote config",t)}}Fe(t){t?this._instance.config.__preview_remote_config?(this._instance.Fe(t),!1!==t.hasFeatureFlags&&this._instance.featureFlags.ensureFlagsLoaded()):Vo.info("__preview_remote_config is disabled. Logging config instead",t):Vo.error("Failed to fetch remote config from PostHog.")}}var Ko=3e3;class Yo{constructor(t,i){this.Er=!0,this.Rr=[],this.Ir=G((null==i?void 0:i.flush_interval_ms)||Ko,250,5e3,xt.createLogger("flush interval"),Ko),this.Pr=t}enqueue(t){this.Rr.push(t),this.Tr||this.Cr()}unload(){this.Mr();var t=this.Rr.length>0?this.Or():{},i=Object.values(t);[...i.filter((t=>0===t.url.indexOf("/e"))),...i.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.Pr(g({},t,{transport:"sendBeacon"}))}))}enable(){this.Er=!1,this.Cr()}Cr(){var t=this;this.Er||(this.Tr=setTimeout((()=>{if(this.Mr(),this.Rr.length>0){var i=this.Or(),e=function(){var e=i[r],s=(new Date).getTime();e.data&&R(e.data)&&Ct(e.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.Pr(e)};for(var r in i)e()}}),this.Ir))}Mr(){clearTimeout(this.Tr),this.Tr=void 0}Or(){var t={};return Ct(this.Rr,(i=>{var e,r=i,s=(r?r.batchKey:null)||r.url;C(t[s])&&(t[s]=g({},r,{data:[]})),null==(e=t[s].data)||e.push(r.data)})),this.Rr=[],t}}var Xo=["retriesPerformedSoFar"];class Qo{constructor(i){this.Fr=!1,this.Ar=3e3,this.Rr=[],this._instance=i,this.Rr=[],this.Dr=!0,!C(t)&&"onLine"in t.navigator&&(this.Dr=t.navigator.onLine,Bt(t,"online",(()=>{this.Dr=!0,this.oe()})),Bt(t,"offline",(()=>{this.Dr=!1})))}get length(){return this.Rr.length}retriableRequest(t){var{retriesPerformedSoFar:i}=t,e=_(t,Xo);D(i)&&i>0&&(e.url=Ys(e.url,{retry_count:i})),this._instance.Oe(g({},e,{callback:t=>{200!==t.statusCode&&(t.statusCode<400||t.statusCode>=500)&&(null!=i?i:0)<10?this.jr(g({retriesPerformedSoFar:i},e)):null==e.callback||e.callback(t)}}))}jr(t){var i=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=i+1;var e=function(t){var i=3e3*Math.pow(2,t),e=i/2,r=Math.min(18e5,i),s=(Math.random()-.5)*(r-e);return Math.ceil(r+s)}(i),r=Date.now()+e;this.Rr.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+e;navigator.onLine||(s+=" (Browser is offline)"),xt.warn(s),this.Fr||(this.Fr=!0,this.Lr())}Lr(){this.Nr&&clearTimeout(this.Nr),this.Nr=setTimeout((()=>{this.Dr&&this.Rr.length>0&&this.oe(),this.Lr()}),this.Ar)}oe(){var t=Date.now(),i=[],e=this.Rr.filter((e=>e.retryAt<t||(i.push(e),!1)));if(this.Rr=i,e.length>0)for(var{requestOptions:r}of e)this.retriableRequest(r)}unload(){for(var{requestOptions:t}of(this.Nr&&(clearTimeout(this.Nr),this.Nr=void 0),this.Rr))try{this._instance.Oe(g({},t,{transport:"sendBeacon"}))}catch(t){xt.error(t)}this.Rr=[]}}class Zo{constructor(t){this.Ur=()=>{var t,i,e,r;this.zr||(this.zr={});var s=this.scrollElement(),n=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=n+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;this.zr.lastScrollY=Math.ceil(n),this.zr.maxScrollY=Math.max(n,null!==(t=this.zr.maxScrollY)&&void 0!==t?t:0),this.zr.maxScrollHeight=Math.max(o,null!==(i=this.zr.maxScrollHeight)&&void 0!==i?i:0),this.zr.lastContentY=a,this.zr.maxContentY=Math.max(a,null!==(e=this.zr.maxContentY)&&void 0!==e?e:0),this.zr.maxContentHeight=Math.max(l,null!==(r=this.zr.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}getContext(){return this.zr}resetContext(){var t=this.zr;return setTimeout(this.Ur,0),t}startMeasuringScrollPosition(){Bt(t,"scroll",this.Ur,{capture:!0}),Bt(t,"scrollend",this.Ur,{capture:!0}),Bt(t,"resize",this.Ur)}scrollElement(){if(!this._instance.config.scroll_root_selector)return null==t?void 0:t.document.documentElement;var i=R(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var e of i){var r=null==t?void 0:t.document.querySelector(e);if(r)return r}}scrollY(){if(this._instance.config.scroll_root_selector){var i=this.scrollElement();return i&&i.scrollTop||0}return t&&(t.scrollY||t.pageYOffset||t.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var i=this.scrollElement();return i&&i.scrollLeft||0}return t&&(t.scrollX||t.pageXOffset||t.document.documentElement.scrollLeft)||0}}var ta=t=>fo(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties);class ia{constructor(t,i,e,r){this.Br=t=>{var i=this.qr();if(!i||i.sessionId!==t){var e={sessionId:t,props:this.Hr(this._instance)};this.Wr.register({[Si]:e})}},this._instance=t,this.Gr=i,this.Wr=e,this.Hr=r||ta,this.Gr.onSessionId(this.Br)}qr(){return this.Wr.props[Si]}getSetOnceProps(){var t,i=null==(t=this.qr())?void 0:t.props;return i?"r"in i?po(i):{$referring_domain:i.referringDomain,$pathname:i.initialPathName,utm_source:i.utm_source,utm_campaign:i.utm_campaign,utm_medium:i.utm_medium,utm_content:i.utm_content,utm_term:i.utm_term}:{}}getSessionProps(){var t={};return Ct(jt(this.getSetOnceProps()),((i,e)=>{"$current_url"===e&&(e="url"),t["$session_entry_"+w(e)]=i})),t}}var ea=Et("[SessionId]");class ra{on(t,i){return this.Vr.on(t,i)}constructor(t,i,e){var r;if(this.Jr=[],this.Vr=new Ao,this.Kr=(t,i)=>Math.abs(t-i)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if("always"===t.config.cookieless_mode)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.A=t.config,this.Wr=t.persistence,this.pi=void 0,this.Ft=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Yr=i||Te,this.Xr=e||Te;var s=this.A.persistence_name||this.A.token,n=this.A.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*G(n,60,36e3,ea.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Qr(),this.Zr="ph_"+s+"_window_id",this.ts="ph_"+s+"_primary_window_exists",this.es()){var o=qe.K(this.Zr),a=qe.K(this.ts);o&&!a?this.pi=o:qe.X(this.Zr),qe.Y(this.ts,!0)}if(null!=(r=this.A.bootstrap)&&r.sessionID)try{var l=(t=>{var i=t.replace(/-/g,"");if(32!==i.length)throw new Error("Not a valid UUID");if("7"!==i[12])throw new Error("Not a UUIDv7");return parseInt(i.substring(0,12),16)})(this.A.bootstrap.sessionID);this.rs(this.A.bootstrap.sessionID,(new Date).getTime(),l)}catch(t){ea.error("Invalid sessionID in bootstrap",t)}this.ss()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return C(this.Jr)&&(this.Jr=[]),this.Jr.push(t),this.Ft&&t(this.Ft,this.pi),()=>{this.Jr=this.Jr.filter((i=>i!==t))}}es(){return"memory"!==this.A.persistence&&!this.Wr.Ue&&qe.G()}ns(t){t!==this.pi&&(this.pi=t,this.es()&&qe.Y(this.Zr,t))}os(){return this.pi?this.pi:this.es()?qe.K(this.Zr):null}rs(t,i,e){t===this.Ft&&i===this._sessionActivityTimestamp&&e===this._sessionStartTimestamp||(this._sessionStartTimestamp=e,this._sessionActivityTimestamp=i,this.Ft=t,this.Wr.register({[hi]:[i,t,e]}))}ls(){if(this.Ft&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this.Ft,this._sessionStartTimestamp];var t=this.Wr.props[hi];return R(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.rs(null,null,null)}ss(){Bt(t,"beforeunload",(()=>{this.es()&&qe.X(this.ts)}),{capture:!1})}checkAndGetSessionAndWindowId(t,i){if(void 0===t&&(t=!1),void 0===i&&(i=null),"always"===this.A.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var e=i||(new Date).getTime(),[r,s,n]=this.ls(),o=this.os(),a=D(n)&&n>0&&Math.abs(e-n)>864e5,l=!1,h=!s,u=!t&&this.Kr(e,r);h||u||a?(s=this.Yr(),o=this.Xr(),ea.info("new session ID generated",{sessionId:s,windowId:o,changeReason:{noSessionId:h,activityTimeout:u,sessionPastMaximumLength:a}}),n=e,l=!0):o||(o=this.Xr(),l=!0);var d=0===r||!t||a?e:r,v=0===n?(new Date).getTime():n;return this.ns(o),this.rs(s,d,v),t||this.Qr(),l&&this.Jr.forEach((t=>t(s,o,l?{noSessionId:h,activityTimeout:u,sessionPastMaximumLength:a}:void 0))),{sessionId:s,windowId:o,sessionStartTimestamp:v,changeReason:l?{noSessionId:h,activityTimeout:u,sessionPastMaximumLength:a}:void 0,lastActivityTimestamp:r}}Qr(){clearTimeout(this.hs),this.hs=setTimeout((()=>{var[t]=this.ls();if(this.Kr((new Date).getTime(),t)){var i=this.Ft;this.resetSessionId(),this.Vr.emit("forcedIdleReset",{idleSessionId:i})}}),1.1*this.sessionTimeoutMs)}}var sa=["$set_once","$set"],na=Et("[SiteApps]");class oa{constructor(t){this._instance=t,this.us=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}ds(t,i){if(i){var e=this.globalsForEvent(i);this.us.push(e),this.us.length>1e3&&(this.us=this.us.slice(10))}}get siteAppLoaders(){var t;return null==(t=v._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}init(){if(this.isEnabled){var t=this._instance.Ze(this.ds.bind(this));this.vs=()=>{t(),this.us=[],this.vs=void 0}}}globalsForEvent(t){var i,e,r,s,n,o,a;if(!t)throw new Error("Event payload is required");var l={},h=this._instance.get_property("$groups")||[],u=this._instance.get_property("$stored_group_properties")||{};for(var[d,v]of Object.entries(u))l[d]={id:h[d],type:d,properties:v};var{$set_once:c,$set:f}=t;return{event:g({},_(t,sa),{properties:g({},t.properties,f?{$set:g({},null!==(i=null==(e=t.properties)?void 0:e.$set)&&void 0!==i?i:{},f)}:{},c?{$set_once:g({},null!==(r=null==(s=t.properties)?void 0:s.$set_once)&&void 0!==r?r:{},c)}:{}),elements_chain:null!==(n=null==(o=t.properties)?void 0:o.$elements_chain)&&void 0!==n?n:"",distinct_id:null==(a=t.properties)?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}setupSiteApp(t){var i=this.apps[t.id],e=()=>{var e;(!i.errored&&this.us.length&&(na.info("Processing "+this.us.length+" events for site app with id "+t.id),this.us.forEach((t=>null==i.processEvent?void 0:i.processEvent(t))),i.processedBuffer=!0),Object.values(this.apps).every((t=>t.processedBuffer||t.errored)))&&(null==(e=this.vs)||e.call(this))},r=!1,s=s=>{i.errored=!s,i.loaded=!0,na.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&e()};try{var{processEvent:n}=t.init({posthog:this._instance,callback:t=>{s(t)}});n&&(i.processEvent=n),r=!0}catch(i){na.error("Error while initializing PostHog app with config id "+t.id,i),s(!1)}if(r&&i.loaded)try{e()}catch(e){na.error("Error while processing buffered events PostHog app with config id "+t.id,e),i.errored=!0}}cs(){var t=this.siteAppLoaders||[];for(var i of t)this.apps[i.id]={id:i.id,loaded:!1,errored:!1,processedBuffer:!1};for(var e of t)this.setupSiteApp(e)}fs(t){if(0!==Object.keys(this.apps).length){var i=this.globalsForEvent(t);for(var e of Object.values(this.apps))try{null==e.processEvent||e.processEvent(i)}catch(i){na.error("Error while processing event "+t.event+" for site app "+e.id,i)}}}onRemoteConfig(t){var i,e,r,s=this;if(null!=(i=this.siteAppLoaders)&&i.length)return this.isEnabled?(this.cs(),void this._instance.on("eventCaptured",(t=>this.fs(t)))):void na.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(e=this.vs)||e.call(this),null!=(r=t.siteApps)&&r.length)if(this.isEnabled){var n=function(t){var i;v["__$$ph_site_app_"+t]=s._instance,null==(i=v.__PosthogExtensions__)||null==i.loadSiteApp||i.loadSiteApp(s._instance,a,(i=>{if(i)return na.error("Error while initializing PostHog app with config id "+t,i)}))};for(var{id:o,url:a}of t.siteApps)n(o)}else na.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}var aa=["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"],la=function(t,i){if(!t)return!1;var e=t.toLowerCase();return aa.concat(i||[]).some((t=>{var i=t.toLowerCase();return-1!==e.indexOf(i)}))},ha=function(t,i){if(!t)return!1;var e=t.userAgent;if(e&&la(e,i))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>la(null==t?void 0:t.brand,i))))return!0}catch(t){}return!!t.webdriver},ua=function(t){return t.US="us",t.EU="eu",t.CUSTOM="custom",t}({}),da="i.posthog.com";class va{constructor(t){this.ps={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get uiHost(){var t,i=null==(t=this.instance.config.ui_host)?void 0:t.replace(/\/$/,"");return i||(i=this.apiHost.replace("."+da,".posthog.com")),"https://app.posthog.com"===i?"https://us.posthog.com":i}get region(){return this.ps[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.ps[this.apiHost]=ua.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.ps[this.apiHost]=ua.EU:this.ps[this.apiHost]=ua.CUSTOM),this.ps[this.apiHost]}endpointFor(t,i){if(void 0===i&&(i=""),i&&(i="/"===i[0]?i:"/"+i),"ui"===t)return this.uiHost+i;if(this.region===ua.CUSTOM)return this.apiHost+i;var e=da+i;switch(t){case"assets":return"https://"+this.region+"-assets."+e;case"api":return"https://"+this.region+"."+e}}}var ca={icontains:(i,e)=>!!t&&e.href.toLowerCase().indexOf(i.toLowerCase())>-1,not_icontains:(i,e)=>!!t&&-1===e.href.toLowerCase().indexOf(i.toLowerCase()),regex:(i,e)=>!!t&&tn(e.href,i),not_regex:(i,e)=>!!t&&!tn(e.href,i),exact:(t,i)=>i.href===t,is_not:(t,i)=>i.href!==t};class fa{constructor(t){var i=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),i.getWebExperiments((t=>{fa.gs("retrieved web experiments from the server"),i._s=new Map,t.forEach((t=>{if(t.feature_flag_key){var e;if(i._s)fa.gs("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(e=i._s)||e.set(t.feature_flag_key,t);var r=i._instance.getFeatureFlag(t.feature_flag_key);M(r)&&t.variants[r]&&i.ys(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var n=t.variants[s];fa.bs(n)&&i.ys(t.name,s,n.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((t=>{this.onFeatureFlags(t)}))}onFeatureFlags(t){if(this._is_bot())fa.gs("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(A(this._s))return this._s=new Map,this.loadIfEnabled(),void this.previewWebExperiment();fa.gs("applying feature flags",t),t.forEach((t=>{var i;if(this._s&&null!=(i=this._s)&&i.has(t)){var e,r=this._instance.getFeatureFlag(t),s=null==(e=this._s)?void 0:e.get(t);r&&null!=s&&s.variants[r]&&this.ys(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var t=fa.getWindowLocation();if(null!=t&&t.search){var i=pe(null==t?void 0:t.search,"__experiment_id"),e=pe(null==t?void 0:t.search,"__experiment_variant");i&&e&&(fa.gs("previewing web experiments "+i+" && "+e),this.getWebExperiments((t=>{this.ws(parseInt(i),e,t)}),!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,i,e){if(this._instance.config.disable_web_experiments&&!e)return t([]);var r=this._instance.get_property("$web_experiments");if(r&&!i)return t(r);this._instance.Oe({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:i=>{if(200!==i.statusCode||!i.json)return t([]);var e=i.json.experiments||[];return t(e)}})}ws(t,i,e){var r=e.filter((i=>i.id===t));r&&r.length>0&&(fa.gs("Previewing web experiment ["+r[0].name+"] with variant ["+i+"]"),this.ys(r[0].name,i,r[0].variants[i].transforms))}static bs(t){return!A(t.conditions)&&(fa.Ss(t)&&fa.ks(t))}static Ss(t){var i;if(A(t.conditions)||A(null==(i=t.conditions)?void 0:i.url))return!0;var e,r,s,n=fa.getWindowLocation();return!!n&&(null==(e=t.conditions)||!e.url||ca[null!==(r=null==(s=t.conditions)?void 0:s.urlMatchType)&&void 0!==r?r:"icontains"](t.conditions.url,n))}static getWindowLocation(){return null==t?void 0:t.location}static ks(t){var i;if(A(t.conditions)||A(null==(i=t.conditions)?void 0:i.utm))return!0;var e=lo();if(e.utm_source){var r,s,n,o,a,l,h,u,d=null==(r=t.conditions)||null==(r=r.utm)||!r.utm_campaign||(null==(s=t.conditions)||null==(s=s.utm)?void 0:s.utm_campaign)==e.utm_campaign,v=null==(n=t.conditions)||null==(n=n.utm)||!n.utm_source||(null==(o=t.conditions)||null==(o=o.utm)?void 0:o.utm_source)==e.utm_source,c=null==(a=t.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=t.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==e.utm_medium,f=null==(h=t.conditions)||null==(h=h.utm)||!h.utm_term||(null==(u=t.conditions)||null==(u=u.utm)?void 0:u.utm_term)==e.utm_term;return d&&c&&f&&v}return!1}static gs(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;r<i;r++)e[r-1]=arguments[r];xt.info("[WebExperiments] "+t,e)}ys(t,i,e){this._is_bot()?fa.gs("Refusing to render web experiment since the viewer is a likely bot"):"control"!==i?e.forEach((e=>{if(e.selector){var r;fa.gs("applying transform of variant "+i+" for experiment "+t+" ",e);var s=null==(r=document)?void 0:r.querySelectorAll(e.selector);null==s||s.forEach((t=>{var i=t;e.html&&(i.innerHTML=e.html),e.css&&i.setAttribute("style",e.css)}))}})):fa.gs("Control variants leave the page unmodified.")}_is_bot(){return n&&this._instance?ha(n,this._instance.config.custom_blocked_useragents):void 0}}var pa=Et("[PostHog ExternalIntegrations]"),ga={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class _a{constructor(t){this._instance=t}nt(t,i){var e;null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,t,(t=>{if(t)return pa.error("failed to load script",t);i()}))}startIfEnabledOrStop(){var t=this,i=function(i){var e,s,n;(!r||null!=(e=v.__PosthogExtensions__)&&null!=(e=e.integrations)&&e[i]||t.nt(ga[i],(()=>{var e;null==(e=v.__PosthogExtensions__)||null==(e=e.integrations)||null==(e=e[i])||e.start(t._instance)})),!r&&null!=(s=v.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[i])&&(null==(n=v.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[i])||n.stop())};for(var[e,r]of Object.entries(null!==(s=this._instance.config.integrations)&&void 0!==s?s:{})){var s;i(e)}}}var ma="[SessionRecording]",ya=Et(ma);class ba{get started(){var t;return!(null==(t=this.$s)||!t.isStarted)}get status(){var t;return this.Kt&&!this.Bt?Zr:(null==(t=this.$s)?void 0:t.status)||"lazy_loading"}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.Kt=!1,this.ni=void 0,this._instance=t,!this._instance.sessionManager)throw ya.error("started without valid sessionManager"),new Error(ma+" started without valid sessionManager. This is a bug.");if("always"===this._instance.config.cookieless_mode)throw new Error(ma+' cannot be used with cookieless_mode="always"')}get Bt(){var i,e=!(null==(i=this._instance.get_property(ti))||!i.enabled),r=!this._instance.config.disable_session_recording,s=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return t&&e&&r&&!s}startIfEnabledOrStop(t){var i;if(!this.Bt||null==(i=this.$s)||!i.isStarted){var e=!C(Object.assign)&&!C(Array.from);this.Bt&&e?(this.xs(t),ya.info("starting")):this.stopRecording()}}xs(t){var i,e,r;this.Bt&&(null!=v&&null!=(i=v.__PosthogExtensions__)&&null!=(i=i.rrweb)&&i.record&&null!=(e=v.__PosthogExtensions__)&&e.initSessionRecording?this.Ri(t):null==(r=v.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.Ii,(i=>{if(i)return ya.error("could not load recorder",i);this.Ri(t)})))}stopRecording(){var t;null==(t=this.$s)||t.stop()}ki(){var t;null==(t=this._instance.persistence)||t.unregister(ui)}Ei(t){if(this._instance.persistence){var i,e,r=this._instance.persistence,s=()=>{var i=!1===t.sessionRecording?void 0:t.sessionRecording,e=null==i?void 0:i.sampleRate,s=A(e)?null:parseFloat(e);A(s)&&this.ki();var n=null==i?void 0:i.minimumDurationMilliseconds;r.register({[ti]:g({enabled:!!i},i,{networkPayloadCapture:g({capturePerformance:t.capturePerformance},null==i?void 0:i.networkPayloadCapture),canvasRecording:{enabled:null==i?void 0:i.recordCanvas,fps:null==i?void 0:i.canvasFps,quality:null==i?void 0:i.canvasQuality},sampleRate:s,minimumDurationMilliseconds:C(n)?null:n,endpoint:null==i?void 0:i.endpoint,triggerMatchType:null==i?void 0:i.triggerMatchType,masking:null==i?void 0:i.masking,urlTriggers:null==i?void 0:i.urlTriggers})})};s(),null==(i=this.ni)||i.call(this),this.ni=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(s)}}onRemoteConfig(t){"sessionRecording"in t?!1!==t.sessionRecording?(this.Ei(t),this.Kt=!0,this.startIfEnabledOrStop()):this.Kt=!0:ya.info("skipping remote config with no sessionRecording",t)}log(t,i){var e;void 0===i&&(i="log"),null!=(e=this.$s)&&e.log?this.$s.log(t,i):ya.warn("log called before recorder was ready")}get Ii(){var t,i,e=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.get_property(ti);return(null==e||null==(i=e.scriptConfig)?void 0:i.script)||"lazy-recorder"}Ri(t){var i,e;if(null==(i=v.__PosthogExtensions__)||!i.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.$s||(this.$s=null==(e=v.__PosthogExtensions__)?void 0:e.initSessionRecording(this._instance),this.$s._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture);this.$s.start(t)}onRRwebEmit(t){var i;null==(i=this.$s)||null==i.onRRwebEmit||i.onRRwebEmit(t)}overrideLinkedFlag(){var t;null==(t=this.$s)||t.overrideLinkedFlag()}overrideSampling(){var t;null==(t=this.$s)||t.overrideSampling()}overrideTrigger(t){var i;null==(i=this.$s)||i.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.$s)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,i){var e;return!(null==(e=this.$s)||!e.tryAddCustomEvent(t,i))}}var wa={},Sa=()=>{},ka="posthog",$a=!Js&&-1===(null==d?void 0:d.indexOf("MSIE"))&&-1===(null==d?void 0:d.indexOf("Mozilla")),xa=i=>{var e;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:Ut(null==o?void 0:o.location),persistence:"localStorage+cookie",persistence_name:"",loaded:Sa,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:"2025-05-24"!==i||"history_change",capture_pageleave:"if_capture_pageview",defaults:null!=i?i:"unset",debug:a&&M(null==a?void 0:a.search)&&-1!==a.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==t||null==(e=t.location)?void 0:e.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:t=>{var i="Bad HTTP status: "+t.statusCode+" "+t.text;xt.error(i)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:Ko},error_tracking:{},_onCapture:Sa,__preview_eager_load_replay:!1}},Ea=t=>{var i={};C(t.process_person)||(i.person_profiles=t.process_person),C(t.xhr_headers)||(i.request_headers=t.xhr_headers),C(t.cookie_name)||(i.persistence_name=t.cookie_name),C(t.disable_cookie)||(i.disable_persistence=t.disable_cookie),C(t.store_google)||(i.save_campaign_params=t.store_google),C(t.verbose)||(i.debug=t.verbose);var e=Mt({},i,t);return R(t.property_blacklist)&&(C(t.property_denylist)?e.property_denylist=t.property_blacklist:R(t.property_denylist)?e.property_denylist=[...t.property_blacklist,...t.property_denylist]:xt.error("Invalid value for property_denylist config: "+t.property_denylist)),e};class Ra{constructor(){this.__forceAllowLocalhost=!1}get Es(){return this.__forceAllowLocalhost}set Es(t){xt.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class Ia{get decideEndpointWasHit(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.hasLoadedFlags)&&void 0!==t&&t}constructor(){this.webPerformance=new Ra,this.Rs=!1,this.version=c.LIB_VERSION,this.Is=new Ao,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=xa(),this.SentryIntegration=Ms,this.sentryIntegration=t=>function(t,i){var e=Cs(t,i);return{name:Ts,processEvent:t=>e(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Ps=!1,this.Ts=null,this.Cs=null,this.Ms=null,this.featureFlags=new Io(this),this.toolbar=new js(this),this.scrollManager=new Zo(this),this.pageViewManager=new Gs(this),this.surveys=new Ho(this),this.experiments=new fa(this),this.exceptions=new on(this),this.rateLimiter=new Go(this),this.requestRouter=new va(this),this.consent=new We(this),this.externalIntegrations=new _a(this),this.people={set:(t,i,e)=>{var r=M(t)?{[t]:i}:t;this.setPersonProperties(r),null==e||e({})},set_once:(t,i,e)=>{var r=M(t)?{[t]:i}:t;this.setPersonProperties(void 0,r),null==e||e({})}},this.on("eventCaptured",(t=>xt.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,i,e){if(e&&e!==ka){var r,s=null!==(r=wa[e])&&void 0!==r?r:new Ia;return s._init(t,i,e),wa[e]=s,wa[ka][e]=s,s}return this._init(t,i,e)}_init(i,e,r){var s,n;if(void 0===e&&(e={}),C(i)||O(i))return xt.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 xt.warn("You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},this.Os=e,this.Fs=[],e.person_profiles&&(this.Cs=e.person_profiles),this.set_config(Mt({},xa(e.defaults),Ea(e),{name:r,token:i})),this.config.on_xhr_error&&xt.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=e.disable_compression?void 0:de.GZipJS;var o=this.As();this.persistence=new To(this.config,o),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new To(g({},this.config,{persistence:"sessionStorage"}),o);var a=g({},this.persistence.props),l=g({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Ds=new Yo((t=>this.js(t)),this.config.request_queue_config),this.Ls=new Qo(this),this.__request_queue=[];var h="always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut();if(h||(this.sessionManager=new ra(this),this.sessionPropsManager=new ia(this,this.sessionManager,this.persistence)),new Ns(this).startIfEnabledOrStop(),this.siteApps=new oa(this),null==(s=this.siteApps)||s.init(),h||(this.config.__preview_eager_load_replay?this.sessionRecording=new Rs(this):this.sessionRecording=new ba(this),this.sessionRecording.startIfEnabledOrStop()),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new ke(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new Ws(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new Bs(this),this.exceptionObserver=new Xe(this),this.exceptionObserver.startIfEnabled(),this.deadClicksAutocapture=new Ke(this,Je),this.deadClicksAutocapture.startIfEnabled(),this.historyAutocapture=new Ze(this),this.historyAutocapture.startIfEnabled(),c.DEBUG=c.DEBUG||this.config.debug,c.DEBUG&&xt.info("Starting in debug mode",{this:this,config:e,thisC:g({},this.config),p:a,s:l}),void 0!==(null==(n=e.bootstrap)?void 0:n.distinctID)){var u,d,v=this.config.get_device_id(Te()),f=null!=(u=e.bootstrap)&&u.isIdentifiedID?v:e.bootstrap.distinctID;this.persistence.set_property(wi,null!=(d=e.bootstrap)&&d.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:e.bootstrap.distinctID,$device_id:f})}if(this.Ns()){var p,_,m=Object.keys((null==(p=e.bootstrap)?void 0:p.featureFlags)||{}).filter((t=>{var i;return!(null==(i=e.bootstrap)||null==(i=i.featureFlags)||!i[t])})).reduce(((t,i)=>{var r;return t[i]=(null==(r=e.bootstrap)||null==(r=r.featureFlags)?void 0:r[i])||!1,t}),{}),y=Object.keys((null==(_=e.bootstrap)?void 0:_.featureFlagPayloads)||{}).filter((t=>m[t])).reduce(((t,i)=>{var r,s;null!=(r=e.bootstrap)&&null!=(r=r.featureFlagPayloads)&&r[i]&&(t[i]=null==(s=e.bootstrap)||null==(s=s.featureFlagPayloads)?void 0:s[i]);return t}),{});this.featureFlags.receivedFeatureFlags({featureFlags:m,featureFlagPayloads:y})}if(h)this.register_once({distinct_id:Pi,$device_id:null},"");else if(!this.get_distinct_id()){var b=this.config.get_device_id(Te());this.register_once({distinct_id:b,$device_id:b},""),this.persistence.set_property(wi,"anonymous")}return Bt(t,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),e.segment?Ps(this,(()=>this.Us())):this.Us(),I(this.config._onCapture)&&this.config._onCapture!==Sa&&(xt.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&xt.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}Fe(t){var i,e,r,s,n,a,l,h;if(!o||!o.body)return xt.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Fe(t)}),500);this.compression=void 0,t.supportedCompression&&!this.config.disable_compression&&(this.compression=y(t.supportedCompression,de.GZipJS)?de.GZipJS:y(t.supportedCompression,de.Base64)?de.Base64:void 0),null!=(i=t.analytics)&&i.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint),this.set_config({person_profiles:this.Cs?this.Cs:"identified_only"}),null==(e=this.siteApps)||e.onRemoteConfig(t),null==(r=this.sessionRecording)||r.onRemoteConfig(t),null==(s=this.autocapture)||s.onRemoteConfig(t),null==(n=this.heatmaps)||n.onRemoteConfig(t),this.surveys.onRemoteConfig(t),null==(a=this.webVitalsAutocapture)||a.onRemoteConfig(t),null==(l=this.exceptionObserver)||l.onRemoteConfig(t),this.exceptions.onRemoteConfig(t),null==(h=this.deadClicksAutocapture)||h.onRemoteConfig(t)}Us(){try{this.config.loaded(this)}catch(t){xt.critical("`loaded` function failed",t)}this.zs(),this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||"always"===this.config.cookieless_mode)&&this.Bs()}),1),new Jo(this).load(),this.featureFlags.flags()}zs(){var t;this.is_capturing()&&(this.config.request_batching&&(null==(t=this.Ds)||t.enable()))}_dom_loaded(){this.is_capturing()&&Tt(this.__request_queue,(t=>this.js(t))),this.__request_queue=[],this.zs()}_handle_unload(){var t,i;this.config.request_batching?(this.qs()&&this.capture("$pageleave"),null==(t=this.Ds)||t.unload(),null==(i=this.Ls)||i.unload()):this.qs()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}Oe(t){this.__loaded&&($a?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)||(t.transport=t.transport||this.config.api_transport,t.url=Ys(t.url,{ip:this.config.ip?1:0}),t.headers=g({},this.config.request_headers),t.compression="best-available"===t.compression?this.compression:t.compression,t.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(t=>{var i,e,r,s=g({},t);s.timeout=s.timeout||6e4,s.url=Ys(s.url,{_:(new Date).getTime().toString(),ver:c.LIB_VERSION,compression:s.compression});var n=null!==(i=s.transport)&&void 0!==i?i:"fetch",o=Zs.filter((t=>!s.disableTransport||!t.transport||!s.disableTransport.includes(t.transport))),a=null!==(e=null==(r=zt(o,(t=>t.transport===n)))?void 0:r.method)&&void 0!==e?e:o[0].method;if(!a)throw new Error("No available transport method");a(s)})(g({},t,{callback:i=>{var e,r;(this.rateLimiter.checkForLimiting(i),i.statusCode>=400)&&(null==(e=(r=this.config).on_request_error)||e.call(r,i));null==t.callback||t.callback(i)}}))))}js(t){this.Ls?this.Ls.retriableRequest(t):this.Oe(t)}_execute_array(t){var i,e=[],r=[],s=[];Tt(t,(t=>{t&&(i=t[0],R(i)?s.push(t):I(t)?t.call(this):R(t)&&"alias"===i?e.push(t):R(t)&&-1!==i.indexOf("capture")&&I(this[i])?s.push(t):r.push(t))}));var n=function(t,i){Tt(t,(function(t){if(R(t[0])){var e=i;Ct(t,(function(t){e=e[t[0]].apply(e,t.slice(1))}))}else this[t[0]].apply(this,t.slice(1))}),i)};n(e,this),n(r,this),n(s,this)}Ns(){var t,i;return(null==(t=this.config.bootstrap)?void 0:t.featureFlags)&&Object.keys(null==(i=this.config.bootstrap)?void 0:i.featureFlags).length>0||!1}push(t){this._execute_array([t])}capture(t,i,e){var r;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Ds){if(this.is_capturing())if(!C(t)&&M(t)){if(this.config.opt_out_useragent_filter||!this._is_bot()){var s=null!=e&&e.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==s||!s.isRateLimited){null!=i&&i.$current_url&&!M(null==i?void 0:i.$current_url)&&(xt.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==i||delete i.$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,o=(null==e?void 0:e.timestamp)||n,a=Te(),l={uuid:a,event:t,properties:this.calculateEventProperties(t,i||{},o,a)};s&&(l.properties.$lib_rate_limit_remaining_tokens=s.remainingTokens),(null==e?void 0:e.$set)&&(l.$set=null==e?void 0:e.$set);var h,u=this.Hs(null==e?void 0:e.$set_once);if(u&&(l.$set_once=u),(l=Lt(l,null!=e&&e._noTruncate?null:this.config.properties_string_max_length)).timestamp=o,C(null==e?void 0:e.timestamp)||(l.properties.$event_time_override_provided=!0,l.properties.$event_time_override_system_time=n),t===Mo.DISMISSED||t===Mo.SENT){var d=null==i?void 0:i[Oo.SURVEY_ID],v=null==i?void 0:i[Oo.SURVEY_ITERATION];h={id:d,current_iteration:v},localStorage.getItem(Uo(h))||localStorage.setItem(Uo(h),"true"),l.$set=g({},l.$set,{[No({id:d,current_iteration:v},t===Mo.SENT?"responded":"dismissed")]:!0})}var c=g({},l.properties.$set,l.$set);if(T(c)||this.setPersonPropertiesForFlags(c),!A(this.config.before_send)){var f=this.Ws(l);if(!f)return;l=f}this.Is.emit("eventCaptured",l);var p={method:"POST",url:null!==(r=null==e?void 0:e._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:l,compression:"best-available",batchKey:null==e?void 0:e._batchKey};return!this.config.request_batching||e&&(null==e||!e._batchKey)||null!=e&&e.send_instantly?this.js(p):this.Ds.enqueue(p),l}xt.critical("This capture call is ignored due to client rate limiting.")}}else xt.error("No event name provided to posthog.capture")}else xt.uninitializedWarning("posthog.capture")}Ze(t){return this.on("eventCaptured",(i=>t(i.event,i)))}calculateEventProperties(t,i,e,r,s){if(e=e||new Date,!this.persistence||!this.sessionPersistence)return i;var n=s?void 0:this.persistence.remove_event_timer(t),a=g({},i);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"===t){var l=g({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=l.distinct_id,(!M(a.distinct_id)&&!D(a.distinct_id)||O(a.distinct_id))&&xt.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var h,u=mo(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:v,windowId:c}=this.sessionManager.checkAndGetSessionAndWindowId(s,e.getTime());a.$session_id=v,a.$window_id=c}this.sessionPropsManager&&Mt(a,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&Mt(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=null==(f=this.Ls)?void 0:f.length}catch(t){a.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===ua.CUSTOM&&(a.$lib_custom_api_host=this.config.api_host),h="$pageview"!==t||s?"$pageleave"!==t||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(e):this.pageViewManager.doPageView(e,r),a=Mt(a,h),"$pageview"===t&&o&&(a.title=o.title),!C(n)){var p=e.getTime()-n;a.$duration=parseFloat((p/1e3).toFixed(3))}d&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=Mt({},u,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),R(this.config.property_denylist)?Ct(this.config.property_denylist,(function(t){delete a[t]})):xt.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var _=this.config.sanitize_properties;_&&(xt.error("sanitize_properties is deprecated. Use before_send instead"),a=_(a,t));var m=this.Gs();return a.$process_person_profile=m,m&&!s&&this.Vs("_calculate_event_properties"),a}Hs(t){var i;if(!this.persistence||!this.Gs())return t;if(this.Rs)return t;var e=this.persistence.get_initial_props(),r=null==(i=this.sessionPropsManager)?void 0:i.getSetOnceProps(),s=Mt({},e,r||{},t||{}),n=this.config.sanitize_properties;return n&&(xt.error("sanitize_properties is deprecated. Use before_send instead"),s=n(s,"$set_once")),this.Rs=!0,T(s)?void 0:s}register(t,i){var e;null==(e=this.persistence)||e.register(t,i)}register_once(t,i,e){var r;null==(r=this.persistence)||r.register_once(t,i,e)}register_for_session(t){var i;null==(i=this.sessionPersistence)||i.register(t)}unregister(t){var i;null==(i=this.persistence)||i.unregister(t)}unregister_for_session(t){var i;null==(i=this.sessionPersistence)||i.unregister(t)}Js(t,i){this.register({[t]:i})}getFeatureFlag(t,i){return this.featureFlags.getFeatureFlag(t,i)}getFeatureFlagPayload(t){var i=this.featureFlags.getFeatureFlagPayload(t);try{return JSON.parse(i)}catch(t){return i}}isFeatureEnabled(t,i){return this.featureFlags.isFeatureEnabled(t,i)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateEarlyAccessFeatureEnrollment(t,i,e){this.featureFlags.updateEarlyAccessFeatureEnrollment(t,i,e)}getEarlyAccessFeatures(t,i,e){return void 0===i&&(i=!1),this.featureFlags.getEarlyAccessFeatures(t,i,e)}on(t,i){return this.Is.on(t,i)}onFeatureFlags(t){return this.featureFlags.onFeatureFlags(t)}onSurveysLoaded(t){return this.surveys.onSurveysLoaded(t)}onSessionId(t){var i,e;return null!==(i=null==(e=this.sessionManager)?void 0:e.onSessionId(t))&&void 0!==i?i:()=>{}}getSurveys(t,i){void 0===i&&(i=!1),this.surveys.getSurveys(t,i)}getActiveMatchingSurveys(t,i){void 0===i&&(i=!1),this.surveys.getActiveMatchingSurveys(t,i)}renderSurvey(t,i){this.surveys.renderSurvey(t,i)}displaySurvey(t,i){void 0===i&&(i=Bo),this.surveys.displaySurvey(t,i)}canRenderSurvey(t){return this.surveys.canRenderSurvey(t)}canRenderSurveyAsync(t,i){return void 0===i&&(i=!1),this.surveys.canRenderSurveyAsync(t,i)}identify(t,i,e){if(!this.__loaded||!this.persistence)return xt.uninitializedWarning("posthog.identify");if(D(t)&&(t=t.toString(),xt.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),t)if(["distinct_id","distinctid"].includes(t.toLowerCase()))xt.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if(t!==Pi){if(this.Vs("posthog.identify")){var r=this.get_distinct_id();if(this.register({$user_id:t}),!this.get_property("$device_id")){var s=r;this.register_once({$had_persisted_distinct_id:!0,$device_id:s},"")}t!==r&&t!==this.get_property(Ht)&&(this.unregister(Ht),this.register({distinct_id:t}));var n="anonymous"===(this.persistence.get_property(wi)||"anonymous");t!==r&&n?(this.persistence.set_property(wi,"identified"),this.setPersonPropertiesForFlags(g({},e||{},i||{}),!1),this.capture("$identify",{distinct_id:t,$anon_distinct_id:r},{$set:i||{},$set_once:e||{}}),this.Ms=en(t,i,e),this.featureFlags.setAnonymousDistinctId(r)):(i||e)&&this.setPersonProperties(i,e),t!==r&&(this.reloadFeatureFlags(),this.unregister(bi))}}else xt.critical('The string "'+Pi+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else xt.error("Unique user id has not been set in posthog.identify")}setPersonProperties(t,i){if((t||i)&&this.Vs("posthog.setPersonProperties")){var e=en(this.get_distinct_id(),t,i);this.Ms!==e?(this.setPersonPropertiesForFlags(g({},i||{},t||{})),this.capture("$set",{$set:t||{},$set_once:i||{}}),this.Ms=e):xt.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(t,i,e){if(t&&i){if(this.Vs("posthog.group")){var r=this.getGroups();r[t]!==i&&this.resetGroupPropertiesForFlags(t),this.register({$groups:g({},r,{[t]:i})}),e&&(this.capture("$groupidentify",{$group_type:t,$group_key:i,$group_set:e}),this.setGroupPropertiesForFlags({[t]:e})),r[t]===i||e||this.reloadFeatureFlags()}}else xt.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,i){void 0===i&&(i=!0),this.featureFlags.setPersonPropertiesForFlags(t,i)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(t,i){void 0===i&&(i=!0),this.Vs("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(t,i)}resetGroupPropertiesForFlags(t){this.featureFlags.resetGroupPropertiesForFlags(t)}reset(t){var i,e,r,s;if(xt.info("reset"),!this.__loaded)return xt.uninitializedWarning("posthog.reset");var n=this.get_property("$device_id");if(this.consent.reset(),null==(i=this.persistence)||i.clear(),null==(e=this.sessionPersistence)||e.clear(),this.surveys.reset(),this.featureFlags.reset(),null==(r=this.persistence)||r.set_property(wi,"anonymous"),null==(s=this.sessionManager)||s.resetSessionId(),this.Ms=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:Pi,$device_id:null},"");else{var o=this.config.get_device_id(Te());this.register_once({distinct_id:o,$device_id:t?o: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 t,i;return null!==(t=null==(i=this.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var{sessionId:i,sessionStartTimestamp:e}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+i);if(null!=t&&t.withTimestamp&&e){var s,n=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!e)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-e)/1e3)-n,0)}return r}alias(t,i){return t===this.get_property(qt)?(xt.critical("Attempting to create alias for existing People user - aborting."),-2):this.Vs("posthog.alias")?(C(i)&&(i=this.get_distinct_id()),t!==i?(this.Js(Ht,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(xt.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var i=g({},this.config);if(P(t)){var e,r,s,n,o;Mt(this.config,Ea(t));var a=this.As();null==(e=this.persistence)||e.update_config(this.config,i,a),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new To(g({},this.config,{persistence:"sessionStorage"}),a),je.G()&&"true"===je.J("ph_debug")&&(this.config.debug=!0),this.config.debug&&(c.DEBUG=!0,xt.info("set_config",{config:t,oldConfig:i,newConfig:g({},this.config)})),null==(r=this.sessionRecording)||r.startIfEnabledOrStop(),null==(s=this.autocapture)||s.startIfEnabled(),null==(n=this.heatmaps)||n.startIfEnabled(),this.surveys.loadIfEnabled(),this.Ks(),null==(o=this.externalIntegrations)||o.startIfEnabledOrStop()}}startSessionRecording(t){var i=!0===t,e={sampling:i||!(null==t||!t.sampling),linked_flag:i||!(null==t||!t.linked_flag),url_trigger:i||!(null==t||!t.url_trigger),event_trigger:i||!(null==t||!t.event_trigger)};if(Object.values(e).some(Boolean)){var r,s,n,o,a;if(null==(r=this.sessionManager)||r.checkAndGetSessionAndWindowId(),e.sampling)null==(s=this.sessionRecording)||s.overrideSampling();if(e.linked_flag)null==(n=this.sessionRecording)||n.overrideLinkedFlag();if(e.url_trigger)null==(o=this.sessionRecording)||o.overrideTrigger("url");if(e.event_trigger)null==(a=this.sessionRecording)||a.overrideTrigger("event")}this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!(null==(t=this.sessionRecording)||!t.started)}captureException(t,i){var e=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(t,{handled:!0,syntheticException:e});return this.exceptions.sendExceptionEvent(g({},r,i))}loadToolbar(t){return this.toolbar.loadToolbar(t)}get_property(t){var i;return null==(i=this.persistence)?void 0:i.props[t]}getSessionProperty(t){var i;return null==(i=this.sessionPersistence)?void 0:i.props[t]}toString(){var t,i=null!==(t=this.config.name)&&void 0!==t?t:ka;return i!==ka&&(i=ka+"."+i),i}_isIdentified(){var t,i;return"identified"===(null==(t=this.persistence)?void 0:t.get_property(wi))||"identified"===(null==(i=this.sessionPersistence)?void 0:i.get_property(wi))}Gs(){var t,i;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&T(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[Ht])&&(null==(i=this.persistence)||null==(i=i.props)||!i[Ri]))}qs(){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.Gs()||this.Vs("posthog.createPersonProfile")&&this.setPersonProperties({},{})}Vs(t){return"never"===this.config.person_profiles?(xt.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Js(Ri,!0),!0)}As(){if("always"===this.config.cookieless_mode)return!0;var t=this.consent.isOptedOut(),i=this.config.opt_out_persistence_by_default||"on_reject"===this.config.cookieless_mode;return this.config.disable_persistence||t&&!!i}Ks(){var t,i,e,r,s=this.As();(null==(t=this.persistence)?void 0:t.Ue)!==s&&(null==(e=this.persistence)||e.set_disabled(s));(null==(i=this.sessionPersistence)?void 0:i.Ue)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s));return s}opt_in_capturing(t){if("always"!==this.config.cookieless_mode){var i;if("on_reject"===this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut()&&(this.reset(!0),this.sessionManager=new ra(this),this.persistence&&(this.sessionPropsManager=new ia(this,this.sessionManager,this.persistence)),this.sessionRecording=new Rs(this),this.sessionRecording.startIfEnabledOrStop()),this.consent.optInOut(!0),this.Ks(),this.zs(),"on_reject"==this.config.cookieless_mode&&this.surveys.loadIfEnabled(),C(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)this.capture(null!==(i=null==t?void 0:t.captureEventName)&&void 0!==i?i:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0});this.config.capture_pageview&&this.Bs()}else xt.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}opt_out_capturing(){var t;"always"!==this.config.cookieless_mode?("on_reject"===this.config.cookieless_mode&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.Ks(),"on_reject"===this.config.cookieless_mode&&(this.register({distinct_id:Pi,$device_id:null}),this.sessionManager=void 0,this.sessionPropsManager=void 0,null==(t=this.sessionRecording)||t.stopRecording(),this.sessionRecording=void 0,this.Bs())):xt.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 t=this.consent.consent;return t===He.GRANTED?"granted":t===He.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.Ks()}_is_bot(){return n?ha(n,this.config.custom_blocked_useragents):void 0}Bs(){o&&("visible"===o.visibilityState?this.Ps||(this.Ps=!0,this.capture("$pageview",{title:o.title},{send_instantly:!0}),this.Ts&&(o.removeEventListener("visibilitychange",this.Ts),this.Ts=null)):this.Ts||(this.Ts=this.Bs.bind(this),Bt(o,"visibilitychange",this.Ts)))}debug(i){!1===i?(null==t||t.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(null==t||t.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),localStorage&&localStorage.setItem("ph_debug","true"),this.set_config({debug:!0}))}L(){var t,i,e,r,s,n,o,a=this.Os||{};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?(xt.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):(e="advanced_disable_decide",r=!1,s=xt,n=(i="advanced_disable_flags")in(t=a)&&!C(t[i]),o=e in t&&!C(t[e]),n?t[i]:o?(s&&s.warn("Config field '"+e+"' is deprecated. Please use '"+i+"' instead. The old field will be removed in a future major version."),t[e]):r)}Ws(t){if(A(this.config.before_send))return t;var i=R(this.config.before_send)?this.config.before_send:[this.config.before_send],e=t;for(var r of i){if(e=r(e),A(e)){var s="Event '"+t.event+"' was rejected in beforeSend function";return N(t.event)?xt.warn(s+". This can cause unexpected behavior."):xt.info(s),null}e.properties&&!T(e.properties)||xt.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}return e}getPageViewId(){var t;return null==(t=this.pageViewManager.pe)?void 0:t.pageViewId}captureTraceFeedback(t,i){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:i})}captureTraceMetric(t,i,e){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:i,$ai_metric_value:String(e)})}}!function(t,i){for(var e=0;e<i.length;e++)t.prototype[i[e]]=Dt(t.prototype[i[e]])}(Ia,["identify"]);var Pa,Ta;Pa=wa[ka]=new Ia,(Ta=v.posthog)&&Ct(Ta._i,(function(t){if(t&&R(t)){var i=Pa.init(t[0],t[1],t[2]),e=Ta[t[2]]||Ta;i&&(i._execute_array.call(i.people,e.people),i._execute_array(e))}})),v.posthog=Pa,function(){function i(){i.done||(i.done=!0,$a=!1,Ct(wa,(function(t){t._dom_loaded()})))}null!=o&&o.addEventListener?"complete"===o.readyState?i():Bt(o,"DOMContentLoaded",i,{capture:!1}):t&&xt.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}()}();
|
|
1
|
+
!function(){"use strict";var t="undefined"!=typeof window?window:void 0,i="undefined"!=typeof globalThis?globalThis:t,e=Array.prototype,r=e.forEach,s=e.indexOf,n=null==i?void 0:i.navigator,o=null==i?void 0:i.document,a=null==i?void 0:i.location,l=null==i?void 0:i.fetch,h=null!=i&&i.XMLHttpRequest&&"withCredentials"in new i.XMLHttpRequest?i.XMLHttpRequest:void 0,u=null==i?void 0:i.AbortController,d=null==n?void 0:n.userAgent,v=null!=t?t:{},c={DEBUG:!1,LIB_VERSION:"1.273.1"};function f(t,i,e,r,s,n,o){try{var a=t[n](o),l=a.value}catch(t){return void e(t)}a.done?i(l):Promise.resolve(l).then(r,s)}function p(t){return function(){var i=this,e=arguments;return new Promise((function(r,s){var n=t.apply(i,e);function o(t){f(n,r,s,o,a,"next",t)}function a(t){f(n,r,s,o,a,"throw",t)}o(void 0)}))}}function g(){return g=Object.assign?Object.assign.bind():function(t){for(var i=1;i<arguments.length;i++){var e=arguments[i];for(var r in e)({}).hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},g.apply(null,arguments)}function _(t,i){if(null==t)return{};var e={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==i.indexOf(r))continue;e[r]=t[r]}return e}var m=["$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 y(t,i){return-1!==t.indexOf(i)}var b=function(t){return t.trim()},w=function(t){return t.replace(/^\$/,"")};var S=Array.isArray,k=Object.prototype,x=k.hasOwnProperty,E=k.toString,R=S||function(t){return"[object Array]"===E.call(t)},I=t=>"function"==typeof t,P=t=>t===Object(t)&&!R(t),T=t=>{if(P(t)){for(var i in t)if(x.call(t,i))return!1;return!0}return!1},C=t=>void 0===t,M=t=>"[object String]"==E.call(t),O=t=>M(t)&&0===t.trim().length,F=t=>null===t,A=t=>C(t)||F(t),D=t=>"[object Number]"==E.call(t),j=t=>"[object Boolean]"===E.call(t),L=t=>t instanceof FormData,N=t=>y(m,t);function U(t){return null===t||"object"!=typeof t}function z(t,i){return Object.prototype.toString.call(t)==="[object "+i+"]"}function B(t){return!C(Event)&&function(t,i){try{return t instanceof i}catch(t){return!1}}(t,Event)}var q=[!0,"true",1,"1","yes"],H=t=>y(q,t),W=[!1,"false",0,"0","no"];function G(t,i,e,r,s){return i>e&&(r.warn("min cannot be greater than max."),i=e),D(t)?t>e?(r.warn(" cannot be greater than max: "+e+". Using max value instead."),e):t<i?(r.warn(" cannot be less than min: "+i+". Using min value instead."),i):t:(r.warn(" must be a number. using max or fallback. max: "+e+", fallback: "+s),G(s||e,i,e,r))}class V{constructor(t){this.t=t,this.i={},this.o=()=>{Object.keys(this.i).forEach((t=>{var i=this.h(t)+this.m;i>=this.S?delete this.i[t]:this.k(t,i)}))},this.h=t=>this.i[String(t)],this.k=(t,i)=>{this.i[String(t)]=i},this.consumeRateLimit=t=>{var i,e,r=null!==(i=this.h(t))&&void 0!==i?i:this.S;if(0===(r=Math.max(r-1,0)))return!0;this.k(t,r);var s=0===r;return s&&(null==(e=this.$)||e.call(this,t)),s},this.$=this.t.$,this.S=G(this.t.bucketSize,0,100,this.t.R),this.m=G(this.t.refillRate,0,this.S,this.t.R),this.I=G(this.t.refillInterval,0,864e5,this.t.R),this.P=setInterval((()=>{this.o()}),this.I)}stop(){this.P&&(clearInterval(this.P),this.P=void 0)}}var J,K,Y,X=t=>t instanceof Error;function Q(t){var i=globalThis._posthogChunkIds;if(i){var e=Object.keys(i);return Y&&e.length===K||(K=e.length,Y=e.reduce(((e,r)=>{J||(J={});var s=J[r];if(s)e[s[0]]=s[1];else for(var n=t(r),o=n.length-1;o>=0;o--){var a=n[o],l=null==a?void 0:a.filename,h=i[r];if(l&&h){e[l]=h,J[r]=[l,h];break}}return e}),{})),Y}}var Z="?";function tt(t,i,e,r){var s={platform:"web:javascript",filename:t,function:"<anonymous>"===i?Z:i,in_app:!0};return C(e)||(s.lineno=e),C(r)||(s.colno=r),s}var it=(t,i)=>{var e=-1!==t.indexOf("safari-extension"),r=-1!==t.indexOf("safari-web-extension");return e||r?[-1!==t.indexOf("@")?t.split("@")[0]:Z,e?"safari-extension:"+i:"safari-web-extension:"+i]:[t,i]},et=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,rt=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,st=/\((\S*)(?::(\d+))(?::(\d+))\)/,nt=t=>{var i=et.exec(t);if(i){var[,e,r,s]=i;return tt(e,Z,+r,+s)}var n=rt.exec(t);if(n){if(n[2]&&0===n[2].indexOf("eval")){var o=st.exec(n[2]);o&&(n[2]=o[1],n[3]=o[2],n[4]=o[3])}var[a,l]=it(n[1]||Z,n[2]);return tt(l,a,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}},ot=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,at=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,lt=t=>{var i=ot.exec(t);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var e=at.exec(i[3]);e&&(i[1]=i[1]||"eval",i[3]=e[1],i[4]=e[2],i[5]="")}var r=i[3],s=i[1]||Z;return[s,r]=it(s,r),tt(r,s,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},ht=/\(error: (.*)\)/,ut=50;function dt(){for(var t=arguments.length,i=new Array(t),e=0;e<t;e++)i[e]=arguments[e];return function(t,e){void 0===e&&(e=0);for(var r=[],s=t.split("\n"),n=e;n<s.length;n++){var o=s[n];if(!(o.length>1024)){var a=ht.test(o)?o.replace(ht,"$1"):o;if(!a.match(/\S*Error: /)){for(var l of i){var h=l(a);if(h){r.push(h);break}}if(r.length>=ut)break}}}return function(t){if(!t.length)return[];var i=Array.from(t);return i.reverse(),i.slice(0,ut).map((t=>{return g({},t,{filename:t.filename||(e=i,e[e.length-1]||{}).filename,function:t.function||Z});var e}))}(r)}}class vt{constructor(t,i,e){void 0===t&&(t=[]),void 0===i&&(i=[]),void 0===e&&(e=[]),this.coercers=t,this.modifiers=e,this.stackParser=dt(...i)}buildFromUnknown(t,i){void 0===i&&(i={});var e=i&&i.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(e,i,0).apply(t),s=this.buildParsingContext(),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,e),$exception_level:"error"}}modifyFrames(t){var i=this;return p((function*(){for(var e of t)e.stacktrace&&e.stacktrace.frames&&R(e.stacktrace.frames)&&(e.stacktrace.frames=yield i.applyModifiers(e.stacktrace.frames));return t}))()}coerceFallback(t){var i;return{type:"Error",value:"Unknown error",stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}parseStacktrace(t,i){var e,r;return null!=t.cause&&(e=this.parseStacktrace(t.cause,i)),""!=t.stack&&null!=t.stack&&(r=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?1:0),i.chunkIdMap)),g({},t,{cause:e,stack:r})}applyChunkIds(t,i){return t.map((t=>(t.filename&&i&&(t.chunk_id=i[t.filename]),t)))}applyCoercers(t,i){for(var e of this.coercers)if(e.match(t))return e.coerce(t,i);return this.coerceFallback(i)}applyModifiers(t){var i=this;return p((function*(){var e=t;for(var r of i.modifiers)e=yield r(e);return e}))()}convertToExceptionList(t,i){var e,r,s,n={type:t.type,value:t.value,mechanism:{type:null!==(e=i.type)&&void 0!==e?e:"generic",handled:null===(r=i.handled)||void 0===r||r,synthetic:null!==(s=t.synthetic)&&void 0!==s&&s}};t.stack&&(n.stacktrace={type:"raw",frames:t.stack});var o=[n];return null!=t.cause&&o.push(...this.convertToExceptionList(t.cause,g({},i,{handled:!0}))),o}buildParsingContext(){return{chunkIdMap:Q(this.stackParser)}}buildCoercingContext(t,i,e){void 0===e&&(e=0);var r=(e,r)=>{if(r<=4){var s=this.buildCoercingContext(t,i,r);return this.applyCoercers(e,s)}};return g({},i,{syntheticException:0==e?i.syntheticException:void 0,mechanism:t,apply:t=>r(t,e),next:t=>r(t,e+1)})}}class ct{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,i){var e=M(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:e?t.stack:void 0,cause:t.cause?i.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var i=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?i+": "+t.message:i}isDOMException(t){return z(t,"DOMException")}isDOMError(t){return z(t,"DOMError")}}class ft{match(t){return(t=>t instanceof Error)(t)}coerce(t,i){return{type:this.getType(t),value:this.getMessage(t,i),stack:this.getStack(t),cause:t.cause?i.next(t.cause):void 0,synthetic:!1}}getType(t){return t.name||t.constructor.name}getMessage(t,i){var e=t.message;return e.error&&"string"==typeof e.error.message?String(e.error.message):String(e)}getStack(t){return t.stacktrace||t.stack||void 0}}class pt{constructor(){}match(t){return z(t,"ErrorEvent")&&null!=t.error}coerce(t,i){var e,r=i.apply(t.error);return r||{type:"ErrorEvent",value:t.message,stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}var gt=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class _t{match(t){return"string"==typeof t}coerce(t,i){var e,[r,s]=this.getInfos(t);return{type:null!=r?r:"Error",value:null!=s?s:t,stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}getInfos(t){var i="Error",e=t,r=t.match(gt);return r&&(i=r[1],e=r[2]),[i,e]}}var mt=["fatal","error","warning","log","info","debug"];function yt(t,i){void 0===i&&(i=40);var e=Object.keys(t);if(e.sort(),!e.length)return"[object has no keys]";for(var r=e.length;r>0;r--){var s=e.slice(0,r).join(", ");if(!(s.length>i))return r===e.length||s.length<=i?s:s.slice(0,i)+"..."}return""}class bt{match(t){return"object"==typeof t&&null!==t}coerce(t,i){var e,r=this.getErrorPropertyFromObject(t);return r?i.apply(r):{type:this.getType(t),value:this.getValue(t),stack:null==(e=i.syntheticException)?void 0:e.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return B(t)?t.constructor.name:"Error"}getValue(t){if("name"in t&&"string"==typeof t.name){var i="'"+t.name+"' captured as exception";return"message"in t&&"string"==typeof t.message&&(i+=" with message: '"+t.message+"'"),i}if("message"in t&&"string"==typeof t.message)return t.message;var e=this.getObjectClassName(t);return(e&&"Object"!==e?"'"+e+"'":"Object")+" captured as exception with keys: "+yt(t)}isSeverityLevel(t){return M(t)&&!O(t)&&mt.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var e=t[i];if(X(e))return e}}getObjectClassName(t){try{var i=Object.getPrototypeOf(t);return i?i.constructor.name:void 0}catch(t){return}}}class wt{match(t){return B(t)}coerce(t,i){var e,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+yt(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}class St{match(t){return U(t)}coerce(t,i){var e;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}class kt{match(t){return z(t,"PromiseRejectionEvent")}coerce(t,i){var e,r=this.getUnhandledRejectionReason(t);return U(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}:i.apply(r)}getUnhandledRejectionReason(t){if(U(t))return t;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch(t){}return t}}var $t=i=>{var e={T:function(e){if(t&&(c.DEBUG||v.POSTHOG_DEBUG)&&!C(t.console)&&t.console){for(var r=("__rrweb_original__"in t.console[e]?t.console[e].__rrweb_original__:t.console[e]),s=arguments.length,n=new Array(s>1?s-1:0),o=1;o<s;o++)n[o-1]=arguments[o];r(i,...n)}},info:function(){for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];e.T("log",...i)},warn:function(){for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];e.T("warn",...i)},error:function(){for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];e.T("error",...i)},critical:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];console.error(i,...e)},uninitializedWarning:t=>{e.error("You must initialize PostHog before calling "+t)},createLogger:t=>$t(i+" "+t)};return e},xt=$t("[PostHog.js]"),Et=xt.createLogger,Rt=Et("[ExternalScriptsLoader]"),It=(t,i,e)=>{if(t.config.disable_external_dependency_loading)return Rt.warn(i+" was requested but loading of external scripts is disabled."),e("Loading of external scripts is disabled");var r=null==o?void 0:o.querySelectorAll("script");if(r)for(var s,n=function(){if(r[a].src===i){var t=r[a];return t.__posthog_loading_callback_fired?{v:e()}:(t.addEventListener("load",(i=>{t.__posthog_loading_callback_fired=!0,e(void 0,i)})),t.onerror=t=>e(t),{v:void 0})}},a=0;a<r.length;a++)if(s=n())return s.v;var l=()=>{if(!o)return e("document not found");var r=o.createElement("script");if(r.type="text/javascript",r.crossOrigin="anonymous",r.src=i,r.onload=t=>{r.__posthog_loading_callback_fired=!0,e(void 0,t)},r.onerror=t=>e(t),t.config.prepare_external_dependency_script&&(r=t.config.prepare_external_dependency_script(r)),!r)return e("prepare_external_dependency_script returned null");var s,n=o.querySelectorAll("body > script");n.length>0?null==(s=n[0].parentNode)||s.insertBefore(r,n[0]):o.body.appendChild(r)};null!=o&&o.body?l():null==o||o.addEventListener("DOMContentLoaded",l)};v.__PosthogExtensions__=v.__PosthogExtensions__||{},v.__PosthogExtensions__.loadExternalDependency=(t,i,e)=>{var r="/static/"+i+".js?v="+t.version;if("remote-config"===i&&(r="/array/"+t.config.token+"/config.js"),"toolbar"===i){var s=3e5;r=r+"&t="+Math.floor(Date.now()/s)*s}var n=t.requestRouter.endpointFor("assets",r);It(t,n,e)},v.__PosthogExtensions__.loadSiteApp=(t,i,e)=>{var r=t.requestRouter.endpointFor("api",i);It(t,r,e)};var Pt={};function Tt(t,i,e){if(R(t))if(r&&t.forEach===r)t.forEach(i,e);else if("length"in t&&t.length===+t.length)for(var s=0,n=t.length;s<n;s++)if(s in t&&i.call(e,t[s],s)===Pt)return}function Ct(t,i,e){if(!A(t)){if(R(t))return Tt(t,i,e);if(L(t)){for(var r of t.entries())if(i.call(e,r[1],r[0])===Pt)return}else for(var s in t)if(x.call(t,s)&&i.call(e,t[s],s)===Pt)return}}var Mt=function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;r<i;r++)e[r-1]=arguments[r];return Tt(e,(function(i){for(var e in i)void 0!==i[e]&&(t[e]=i[e])})),t},Ot=function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;r<i;r++)e[r-1]=arguments[r];return Tt(e,(function(i){Tt(i,(function(i){t.push(i)}))})),t};function Ft(t){for(var i=Object.keys(t),e=i.length,r=new Array(e);e--;)r[e]=[i[e],t[i[e]]];return r}var At=function(t){try{return t()}catch(t){return}},Dt=function(t){return function(){try{for(var i=arguments.length,e=new Array(i),r=0;r<i;r++)e[r]=arguments[r];return t.apply(this,e)}catch(t){xt.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),xt.critical(t)}}},jt=function(t){var i={};return Ct(t,(function(t,e){(M(t)&&t.length>0||D(t))&&(i[e]=t)})),i};function Lt(t,i){return e=t,r=t=>M(t)&&!F(i)?t.slice(0,i):t,s=new Set,function t(i,e){return i!==Object(i)?r?r(i,e):i:s.has(i)?void 0:(s.add(i),R(i)?(n=[],Tt(i,(i=>{n.push(t(i))}))):(n={},Ct(i,((i,e)=>{s.has(i)||(n[e]=t(i,e))}))),n);var n}(e);var e,r,s}var Nt=["herokuapp.com","vercel.app","netlify.app"];function Ut(t){var i=null==t?void 0:t.hostname;if(!M(i))return!1;var e=i.split(".").slice(-2).join(".");for(var r of Nt)if(e===r)return!1;return!0}function zt(t,i){for(var e=0;e<t.length;e++)if(i(t[e]))return t[e]}function Bt(t,i,e,r){var{capture:s=!1,passive:n=!0}=null!=r?r:{};null==t||t.addEventListener(i,e,{capture:s,passive:n})}var qt="$people_distinct_id",Ht="__alias",Wt="__timers",Gt="$autocapture_disabled_server_side",Vt="$heatmaps_enabled_server_side",Jt="$exception_capture_enabled_server_side",Kt="$error_tracking_suppression_rules",Yt="$error_tracking_capture_extension_exceptions",Xt="$web_vitals_enabled_server_side",Qt="$dead_clicks_enabled_server_side",Zt="$web_vitals_allowed_metrics",ti="$session_recording_remote_config",ii="$session_recording_enabled_server_side",ei="$console_log_recording_enabled_server_side",ri="$session_recording_network_payload_capture",si="$session_recording_masking",ni="$session_recording_canvas_recording",oi="$replay_sample_rate",ai="$replay_minimum_duration",li="$replay_script_config",hi="$sesid",ui="$session_is_sampled",di="$session_recording_url_trigger_activated_session",vi="$session_recording_event_trigger_activated_session",ci="$enabled_feature_flags",fi="$early_access_features",pi="$feature_flag_details",gi="$stored_person_properties",_i="$stored_group_properties",mi="$surveys",yi="$surveys_activated",bi="$flag_call_reported",wi="$user_state",Si="$client_session_props",ki="$capture_rate_limit",$i="$initial_campaign_params",xi="$initial_referrer_info",Ei="$initial_person_info",Ri="$epp",Ii="__POSTHOG_TOOLBAR__",Pi="$posthog_cookieless",Ti=[qt,Ht,"__cmpns",Wt,ii,Vt,hi,ci,Kt,wi,fi,pi,_i,gi,mi,bi,Si,ki,$i,xi,Ri,Ei];function Ci(t){return t instanceof Element&&(t.id===Ii||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function Mi(t){return!!t&&1===t.nodeType}function Oi(t,i){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===i.toLowerCase()}function Fi(t){return!!t&&3===t.nodeType}function Ai(t){return!!t&&11===t.nodeType}function Di(t){return t?b(t).split(/\s+/):[]}function ji(i){var e=null==t?void 0:t.location.href;return!!(e&&i&&i.some((t=>e.match(t))))}function Li(t){var i="";switch(typeof t.className){case"string":i=t.className;break;case"object":i=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:i=""}return Di(i)}function Ni(t){return A(t)?null:b(t).split(/(\s+)/).filter((t=>re(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Ui(t){var i="";return Ki(t)&&!Yi(t)&&t.childNodes&&t.childNodes.length&&Ct(t.childNodes,(function(t){var e;Fi(t)&&t.textContent&&(i+=null!==(e=Ni(t.textContent))&&void 0!==e?e:"")})),b(i)}function zi(t){return C(t.target)?t.srcElement||null:null!=(i=t.target)&&i.shadowRoot?t.composedPath()[0]||null:t.target||null;var i}var Bi=["a","button","form","input","select","textarea","label"];function qi(t,i){if(C(i))return!0;var e,r=function(t){if(i.some((i=>t.matches(i))))return{v:!0}};for(var s of t)if(e=r(s))return e.v;return!1}function Hi(t){var i=t.parentNode;return!(!i||!Mi(i))&&i}var Wi=[".ph-no-rageclick",".ph-no-capture"];var Gi=t=>!t||Oi(t,"html")||!Mi(t),Vi=(i,e)=>{if(!t||Gi(i))return{parentIsUsefulElement:!1,targetElementList:[]};for(var r=!1,s=[i],n=i;n.parentNode&&!Oi(n,"body");)if(Ai(n.parentNode))s.push(n.parentNode.host),n=n.parentNode.host;else{var o=Hi(n);if(!o)break;if(e||Bi.indexOf(o.tagName.toLowerCase())>-1)r=!0;else{var a=t.getComputedStyle(o);a&&"pointer"===a.getPropertyValue("cursor")&&(r=!0)}s.push(o),n=o}return{parentIsUsefulElement:r,targetElementList:s}};function Ji(i,e,r,s,n){var o,a,l,h;if(void 0===r&&(r=void 0),!t||Gi(i))return!1;if(null!=(o=r)&&o.url_allowlist&&!ji(r.url_allowlist))return!1;if(null!=(a=r)&&a.url_ignorelist&&ji(r.url_ignorelist))return!1;if(null!=(l=r)&&l.dom_event_allowlist){var u=r.dom_event_allowlist;if(u&&!u.some((t=>e.type===t)))return!1}var{parentIsUsefulElement:d,targetElementList:v}=Vi(i,s);if(!function(t,i){var e=null==i?void 0:i.element_allowlist;if(C(e))return!0;var r,s=function(t){if(e.some((i=>t.tagName.toLowerCase()===i)))return{v:!0}};for(var n of t)if(r=s(n))return r.v;return!1}(v,r))return!1;if(!qi(v,null==(h=r)?void 0:h.css_selector_allowlist))return!1;var c=t.getComputedStyle(i);if(c&&"pointer"===c.getPropertyValue("cursor")&&"click"===e.type)return!0;var f=i.tagName.toLowerCase();switch(f){case"html":return!1;case"form":return(n||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(e.type)>=0;default:return d?(n||["click"]).indexOf(e.type)>=0:(n||["click"]).indexOf(e.type)>=0&&(Bi.indexOf(f)>-1||"true"===i.getAttribute("contenteditable"))}}function Ki(t){for(var i=t;i.parentNode&&!Oi(i,"body");i=i.parentNode){var e=Li(i);if(y(e,"ph-sensitive")||y(e,"ph-no-capture"))return!1}if(y(Li(t),"ph-include"))return!0;var r=t.type||"";if(M(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=t.name||t.id||"";if(M(s)){if(/^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,"")))return!1}return!0}function Yi(t){return!!(Oi(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||Oi(t,"select")||Oi(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var Xi="(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})",Qi=new RegExp("^(?:"+Xi+")$"),Zi=new RegExp(Xi),te="\\d{3}-?\\d{2}-?\\d{4}",ie=new RegExp("^("+te+")$"),ee=new RegExp("("+te+")");function re(t,i){if(void 0===i&&(i=!0),A(t))return!1;if(M(t)){if(t=b(t),(i?Qi:Zi).test((t||"").replace(/[- ]/g,"")))return!1;if((i?ie:ee).test(t))return!1}return!0}function se(t){var i=Ui(t);return re(i=(i+" "+ne(t)).trim())?i:""}function ne(t){var i="";return t&&t.childNodes&&t.childNodes.length&&Ct(t.childNodes,(function(t){var e;if(t&&"span"===(null==(e=t.tagName)?void 0:e.toLowerCase()))try{var r=Ui(t);i=(i+" "+r).trim(),t.childNodes&&t.childNodes.length&&(i=(i+" "+ne(t)).trim())}catch(t){xt.error("[AutoCapture]",t)}})),i}function oe(t){return function(t){var i=t.map((t=>{var i,e,r="";if(t.tag_name&&(r+=t.tag_name),t.attr_class)for(var s of(t.attr_class.sort(),t.attr_class))r+="."+s.replace(/"/g,"");var n=g({},t.text?{text:t.text}:{},{"nth-child":null!==(i=t.nth_child)&&void 0!==i?i:0,"nth-of-type":null!==(e=t.nth_of_type)&&void 0!==e?e:0},t.href?{href:t.href}:{},t.attr_id?{attr_id:t.attr_id}:{},t.attributes),o={};return Ft(n).sort(((t,i)=>{var[e]=t,[r]=i;return e.localeCompare(r)})).forEach((t=>{var[i,e]=t;return o[ae(i.toString())]=ae(e.toString())})),r+=":",r+=Ft(o).map((t=>{var[i,e]=t;return i+'="'+e+'"'})).join("")}));return i.join(";")}(function(t){return t.map((t=>{var i,e,r={text:null==(i=t.$el_text)?void 0:i.slice(0,400),tag_name:t.tag_name,href:null==(e=t.attr__href)?void 0:e.slice(0,2048),attr_class:le(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Ft(t).filter((t=>{var[i]=t;return 0===i.indexOf("attr__")})).forEach((t=>{var[i,e]=t;return r.attributes[i]=e})),r}))}(t))}function ae(t){return t.replace(/"|\\"/g,'\\"')}function le(t){var i=t.attr__class;return i?R(i)?i:Di(i):void 0}class he{constructor(){this.clicks=[]}isRageClick(t,i,e){var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(t-r.x)+Math.abs(i-r.y)<30&&e-r.timestamp<1e3){if(this.clicks.push({x:t,y:i,timestamp:e}),3===this.clicks.length)return!0}else this.clicks=[{x:t,y:i,timestamp:e}];return!1}}var ue="$copy_autocapture",de=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),ve=["localhost","127.0.0.1"],ce=t=>{var i=null==o?void 0:o.createElement("a");return C(i)?null:(i.href=t,i)},fe=function(t,i){var e,r;void 0===i&&(i="&");var s=[];return Ct(t,(function(t,i){C(t)||C(i)||"undefined"===i||(e=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),r=encodeURIComponent(i),s[s.length]=r+"="+e)})),s.join(i)},pe=function(t,i){for(var e,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;s<r.length;s++){var n=r[s].split("=");if(n[0]===i){e=n;break}}if(!R(e)||e.length<2)return"";var o=e[1];try{o=decodeURIComponent(o)}catch(t){xt.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},ge=function(t,i,e){if(!t||!i||!i.length)return t;for(var r=t.split("#"),s=r[0]||"",n=r[1],o=s.split("?"),a=o[1],l=o[0],h=(a||"").split("&"),u=[],d=0;d<h.length;d++){var v=h[d].split("=");R(v)&&(i.includes(v[0])?u.push(v[0]+"="+e):u.push(h[d]))}var c=l;return null!=a&&(c+="?"+u.join("&")),null!=n&&(c+="#"+n),c},_e=function(t,i){var e=t.match(new RegExp(i+"=([^&]*)"));return e?e[1]:null},me=Et("[AutoCapture]");function ye(t,i){return i.length>t?i.slice(0,t)+"...":i}function be(t){if(t.previousElementSibling)return t.previousElementSibling;var i=t;do{i=i.previousSibling}while(i&&!Mi(i));return i}function we(t,i,e,r){var s=t.tagName.toLowerCase(),n={tag_name:s};Bi.indexOf(s)>-1&&!e&&("a"===s.toLowerCase()||"button"===s.toLowerCase()?n.$el_text=ye(1024,se(t)):n.$el_text=ye(1024,Ui(t)));var o=Li(t);o.length>0&&(n.classes=o.filter((function(t){return""!==t}))),Ct(t.attributes,(function(e){var s;if((!Yi(t)||-1!==["name","id","class","aria-label"].indexOf(e.name))&&((null==r||!r.includes(e.name))&&!i&&re(e.value)&&(s=e.name,!M(s)||"_ngcontent"!==s.substring(0,10)&&"_nghost"!==s.substring(0,7)))){var o=e.value;"class"===e.name&&(o=Di(o).join(" ")),n["attr__"+e.name]=ye(1024,o)}}));for(var a=1,l=1,h=t;h=be(h);)a++,h.tagName===t.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}function Se(i,e){for(var r,s,{e:n,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:h}=e,u=[i],d=i;d.parentNode&&!Oi(d,"body");)Ai(d.parentNode)?(u.push(d.parentNode.host),d=d.parentNode.host):(u.push(d.parentNode),d=d.parentNode);var v,c=[],f={},p=!1,g=!1;if(Ct(u,(t=>{var i=Ki(t);"a"===t.tagName.toLowerCase()&&(p=t.getAttribute("href"),p=i&&p&&re(p)&&p),y(Li(t),"ph-no-capture")&&(g=!0),c.push(we(t,o,a,l));var e=function(t){if(!Ki(t))return{};var i={};return Ct(t.attributes,(function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){var e=t.name.replace("data-ph-capture-attribute-",""),r=t.value;e&&r&&re(r)&&(i[e]=r)}})),i}(t);Mt(f,e)})),g)return{props:{},explicitNoCapture:g};if(a||("a"===i.tagName.toLowerCase()||"button"===i.tagName.toLowerCase()?c[0].$el_text=se(i):c[0].$el_text=Ui(i)),p){var _,m;c[0].attr__href=p;var b=null==(_=ce(p))?void 0:_.host,w=null==t||null==(m=t.location)?void 0:m.host;b&&w&&b!==w&&(v=p)}return{props:Mt({$event_type:n.type,$ce_version:1},h?{}:{$elements:c},{$elements_chain:oe(c)},null!=(r=c[0])&&r.$el_text?{$el_text:null==(s=c[0])?void 0:s.$el_text}:{},v&&"click"===n.type?{$external_click_url:v}:{},f)}}class ke{constructor(t){this.C=!1,this.M=null,this.rageclicks=new he,this.O=!1,this.instance=t,this.F=null}get A(){var t,i,e=P(this.instance.config.autocapture)?this.instance.config.autocapture:{};return e.url_allowlist=null==(t=e.url_allowlist)?void 0:t.map((t=>new RegExp(t))),e.url_ignorelist=null==(i=e.url_ignorelist)?void 0:i.map((t=>new RegExp(t))),e}D(){if(this.isBrowserSupported()){if(t&&o){var i=i=>{i=i||(null==t?void 0:t.event);try{this.j(i)}catch(t){me.error("Failed to capture event",t)}};if(Bt(o,"submit",i,{capture:!0}),Bt(o,"change",i,{capture:!0}),Bt(o,"click",i,{capture:!0}),this.A.capture_copied_text){var e=i=>{i=i||(null==t?void 0:t.event),this.j(i,ue)};Bt(o,"copy",e,{capture:!0}),Bt(o,"cut",e,{capture:!0})}}}else me.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.C&&(this.D(),this.C=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this.O=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[Gt]:!!t.autocapture_opt_out}),this.M=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this.F=t}getElementSelectors(t){var i,e=[];return null==(i=this.F)||i.forEach((i=>{var r=null==o?void 0:o.querySelectorAll(i);null==r||r.forEach((r=>{t===r&&e.push(i)}))})),e}get isEnabled(){var t,i,e=null==(t=this.instance.persistence)?void 0:t.props[Gt],r=this.M;if(F(r)&&!j(e)&&!this.instance.L())return!1;var s=null!==(i=this.M)&&void 0!==i?i:!!e;return!!this.instance.config.autocapture&&!s}j(i,e){if(void 0===e&&(e="$autocapture"),this.isEnabled){var r,s=zi(i);if(Fi(s)&&(s=s.parentNode||null),"$autocapture"===e&&"click"===i.type&&i instanceof MouseEvent)this.instance.config.rageclick&&null!=(r=this.rageclicks)&&r.isRageClick(i.clientX,i.clientY,(new Date).getTime())&&function(i,e){if(!t||Gi(i))return!1;var r,s;if(!1===(r=j(e)?!!e&&Wi:null!==(s=null==e?void 0:e.css_selector_ignorelist)&&void 0!==s?s:Wi))return!1;var{targetElementList:n}=Vi(i,!1);return!qi(n,r)}(s,this.instance.config.rageclick)&&this.j(i,"$rageclick");var n=e===ue;if(s&&Ji(s,i,this.A,n,n?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=Se(s,{e:i,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.A.element_attribute_ignorelist,elementsChainAsString:this.O});if(a)return!1;var l=this.getElementSelectors(s);if(l&&l.length>0&&(o.$element_selectors=l),e===ue){var h,u=Ni(null==t||null==(h=t.getSelection())?void 0:h.toString()),d=i.type||"clipboard";if(!u)return!1;o.$selected_content=u,o.$copy_type=d}return this.instance.capture(e,o),!0}}}isBrowserSupported(){return I(null==o?void 0:o.querySelectorAll)}}Math.trunc||(Math.trunc=function(t){return t<0?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return D(t)&&isFinite(t)&&Math.floor(t)===t});var $e="0123456789abcdef";class xe{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,i,e,r){if(!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(e)||!Number.isInteger(r)||t<0||i<0||e<0||r<0||t>0xffffffffffff||i>4095||e>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=t/Math.pow(2,40),s[1]=t/Math.pow(2,32),s[2]=t/Math.pow(2,24),s[3]=t/Math.pow(2,16),s[4]=t/Math.pow(2,8),s[5]=t,s[6]=112|i>>>8,s[7]=i,s[8]=128|e>>>24,s[9]=e>>>16,s[10]=e>>>8,s[11]=e,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new xe(s)}toString(){for(var t="",i=0;i<this.bytes.length;i++)t=t+$e.charAt(this.bytes[i]>>>4)+$e.charAt(15&this.bytes[i]),3!==i&&5!==i&&7!==i&&9!==i||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new xe(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(var i=0;i<16;i++){var e=this.bytes[i]-t.bytes[i];if(0!==e)return Math.sign(e)}return 0}}class Ee{constructor(){this.N=0,this.U=0,this.B=new Pe}generate(){var t=this.generateOrAbort();if(C(t)){this.N=0;var i=this.generateOrAbort();if(C(i))throw new Error("Could not generate UUID after timestamp reset");return i}return t}generateOrAbort(){var t=Date.now();if(t>this.N)this.N=t,this.q();else{if(!(t+1e4>this.N))return;this.U++,this.U>4398046511103&&(this.N++,this.q())}return xe.fromFieldsV7(this.N,Math.trunc(this.U/Math.pow(2,30)),this.U&Math.pow(2,30)-1,this.B.nextUint32())}q(){this.U=1024*this.B.nextUint32()+(1023&this.B.nextUint32())}}var Re,Ie=t=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var i=0;i<t.length;i++)t[i]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};t&&!C(t.crypto)&&crypto.getRandomValues&&(Ie=t=>crypto.getRandomValues(t));class Pe{constructor(){this.H=new Uint32Array(8),this.W=1/0}nextUint32(){return this.W>=this.H.length&&(Ie(this.H),this.W=0),this.H[this.W++]}}var Te=()=>Ce().toString(),Ce=()=>(Re||(Re=new Ee)).generate(),Me="";var Oe=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function Fe(t,i){if(i){var e=function(t,i){if(void 0===i&&(i=o),Me)return Me;if(!i)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var e=t.split("."),r=Math.min(e.length,8),s="dmn_chk_"+Te();!Me&&r--;){var n=e.slice(r).join("."),a=s+"=1;domain=."+n+";path=/";i.cookie=a+";max-age=3",i.cookie.includes(s)&&(i.cookie=a+";max-age=0",Me=n)}return Me}(t);if(!e){var r=(t=>{var i=t.match(Oe);return i?i[0]:""})(t);r!==e&&xt.info("Warning: cookie subdomain discovery mismatch",r,e),e=r}return e?"; domain=."+e:""}return""}var Ae={G:()=>!!o,V:function(t){xt.error("cookieStore error: "+t)},J:function(t){if(o){try{for(var i=t+"=",e=o.cookie.split(";").filter((t=>t.length)),r=0;r<e.length;r++){for(var s=e[r];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(i))return decodeURIComponent(s.substring(i.length,s.length))}}catch(t){}return null}},K:function(t){var i;try{i=JSON.parse(Ae.J(t))||{}}catch(t){}return i},Y:function(t,i,e,r,s){if(o)try{var n="",a="",l=Fe(o.location.hostname,r);if(e){var h=new Date;h.setTime(h.getTime()+24*e*60*60*1e3),n="; expires="+h.toUTCString()}s&&(a="; secure");var u=t+"="+encodeURIComponent(JSON.stringify(i))+n+"; SameSite=Lax; path=/"+l+a;return u.length>3686.4&&xt.warn("cookieStore warning: large cookie, len="+u.length),o.cookie=u,u}catch(t){return}},X:function(t,i){if(null!=o&&o.cookie)try{Ae.Y(t,"",-1,i)}catch(t){return}}},De=null,je={G:function(){if(!F(De))return De;var i=!0;if(C(t))i=!1;else try{var e="__mplssupport__";je.Y(e,"xyz"),'"xyz"'!==je.J(e)&&(i=!1),je.X(e)}catch(t){i=!1}return i||xt.error("localStorage unsupported; falling back to cookie store"),De=i,i},V:function(t){xt.error("localStorage error: "+t)},J:function(i){try{return null==t?void 0:t.localStorage.getItem(i)}catch(t){je.V(t)}return null},K:function(t){try{return JSON.parse(je.J(t))||{}}catch(t){}return null},Y:function(i,e){try{null==t||t.localStorage.setItem(i,JSON.stringify(e))}catch(t){je.V(t)}},X:function(i){try{null==t||t.localStorage.removeItem(i)}catch(t){je.V(t)}}},Le=["distinct_id",hi,ui,Ri,Ei],Ne=g({},je,{K:function(t){try{var i={};try{i=Ae.K(t)||{}}catch(t){}var e=Mt(i,JSON.parse(je.J(t)||"{}"));return je.Y(t,e),e}catch(t){}return null},Y:function(t,i,e,r,s,n){try{je.Y(t,i,void 0,void 0,n);var o={};Le.forEach((t=>{i[t]&&(o[t]=i[t])})),Object.keys(o).length&&Ae.Y(t,o,e,r,s,n)}catch(t){je.V(t)}},X:function(i,e){try{null==t||t.localStorage.removeItem(i),Ae.X(i,e)}catch(t){je.V(t)}}}),Ue={},ze={G:function(){return!0},V:function(t){xt.error("memoryStorage error: "+t)},J:function(t){return Ue[t]||null},K:function(t){return Ue[t]||null},Y:function(t,i){Ue[t]=i},X:function(t){delete Ue[t]}},Be=null,qe={G:function(){if(!F(Be))return Be;if(Be=!0,C(t))Be=!1;else try{var i="__support__";qe.Y(i,"xyz"),'"xyz"'!==qe.J(i)&&(Be=!1),qe.X(i)}catch(t){Be=!1}return Be},V:function(t){xt.error("sessionStorage error: ",t)},J:function(i){try{return null==t?void 0:t.sessionStorage.getItem(i)}catch(t){qe.V(t)}return null},K:function(t){try{return JSON.parse(qe.J(t))||null}catch(t){}return null},Y:function(i,e){try{null==t||t.sessionStorage.setItem(i,JSON.stringify(e))}catch(t){qe.V(t)}},X:function(i){try{null==t||t.sessionStorage.removeItem(i)}catch(t){qe.V(t)}}},He=function(t){return t[t.PENDING=-1]="PENDING",t[t.DENIED=0]="DENIED",t[t.GRANTED=1]="GRANTED",t}({});class We{constructor(t){this._instance=t}get A(){return this._instance.config}get consent(){return this.Z()?He.DENIED:this.tt}isOptedOut(){return"always"===this.A.cookieless_mode||(this.consent===He.DENIED||this.consent===He.PENDING&&(this.A.opt_out_capturing_by_default||"on_reject"===this.A.cookieless_mode))}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===He.DENIED}optInOut(t){this.it.Y(this.et,t?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:t,opt_out_capturing_cookie_prefix:i,consent_persistence_name:e}=this._instance.config;return e||(i?i+t:"__ph_opt_in_out_"+t)}get tt(){var t=this.it.J(this.et);return H(t)?He.GRANTED:y(W,t)?He.DENIED:He.PENDING}get it(){if(!this.rt){var t=this.A.opt_out_capturing_persistence_type;this.rt="localStorage"===t?je:Ae;var i="localStorage"===t?Ae:je;i.J(this.et)&&(this.rt.J(this.et)||this.optInOut(H(i.J(this.et))),i.X(this.et,this.A.cross_subdomain_cookie))}return this.rt}Z(){return!!this.A.respect_dnt&&!!zt([null==n?void 0:n.doNotTrack,null==n?void 0:n.msDoNotTrack,v.doNotTrack],(t=>H(t)))}}var Ge=Et("[Dead Clicks]"),Ve=()=>!0,Je=t=>{var i,e=!(null==(i=t.instance.persistence)||!i.get_property(Qt)),r=t.instance.config.capture_dead_clicks;return j(r)?r:e};class Ke{get lazyLoadedDeadClicksAutocapture(){return this.st}constructor(t,i,e){this.instance=t,this.isEnabled=i,this.onCapture=e,this.startIfEnabled()}onRemoteConfig(t){this.instance.persistence&&this.instance.persistence.register({[Qt]:null==t?void 0:t.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.nt((()=>{this.ot()}))}nt(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.initDeadClicksAutocapture&&t(),null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this.instance,"dead-clicks-autocapture",(i=>{i?Ge.error("failed to load script",i):t()}))}ot(){var t;if(o){if(!this.st&&null!=(t=v.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var i=P(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};i.__onCapture=this.onCapture,this.st=v.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,i),this.st.start(o),Ge.info("starting...")}}else Ge.error("`document` not found. Cannot start.")}stop(){this.st&&(this.st.stop(),this.st=void 0,Ge.info("stopping..."))}}var Ye=Et("[ExceptionAutocapture]");class Xe{constructor(i){var e,r,s;this.lt=()=>{var i;if(t&&this.isEnabled&&null!=(i=v.__PosthogExtensions__)&&i.errorWrappingFunctions){var e=v.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,r=v.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=v.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.ht&&this.A.capture_unhandled_errors&&(this.ht=e(this.captureException.bind(this))),!this.ut&&this.A.capture_unhandled_rejections&&(this.ut=r(this.captureException.bind(this))),!this.dt&&this.A.capture_console_errors&&(this.dt=s(this.captureException.bind(this)))}catch(t){Ye.error("failed to start",t),this.vt()}}},this._instance=i,this.ct=!(null==(e=this._instance.persistence)||!e.props[Jt]),this.A=this.ft(),this.gt=new V({refillRate:null!==(r=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)&&void 0!==r?r:1,bucketSize:null!==(s=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)&&void 0!==s?s:10,refillInterval:1e4,R:Ye}),this.startIfEnabled()}ft(){var t=this._instance.config.capture_exceptions,i={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return P(t)?i=g({},i,t):(C(t)?this.ct:t)&&(i=g({},i,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),i}get isEnabled(){return this.A.capture_console_errors||this.A.capture_unhandled_errors||this.A.capture_unhandled_rejections}startIfEnabled(){this.isEnabled&&(Ye.info("enabled"),this.nt(this.lt))}nt(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.errorWrappingFunctions&&t(),null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"exception-autocapture",(i=>{if(i)return Ye.error("failed to load script",i);t()}))}vt(){var t,i,e;null==(t=this.ht)||t.call(this),this.ht=void 0,null==(i=this.ut)||i.call(this),this.ut=void 0,null==(e=this.dt)||e.call(this),this.dt=void 0}onRemoteConfig(t){var i=t.autocaptureExceptions;this.ct=!!i||!1,this.A=this.ft(),this._instance.persistence&&this._instance.persistence.register({[Jt]:this.ct}),this.startIfEnabled()}captureException(t){var i,e,r=null!==(i=null==t||null==(e=t.$exception_list)||null==(e=e[0])?void 0:e.type)&&void 0!==i?i:"Exception";this.gt.consumeRateLimit(r)?Ye.info("Skipping exception capture because of client rate limiting.",{exception:r}):this._instance.exceptions.sendExceptionEvent(t)}}function Qe(t,i,e){try{if(!(i in t))return()=>{};var r=t[i],s=e(r);return I(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),t[i]=s,()=>{t[i]=r}}catch(t){return()=>{}}}class Ze{constructor(i){var e;this._instance=i,this._t=(null==t||null==(e=t.location)?void 0:e.pathname)||""}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(xt.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.yt&&this.yt(),this.yt=void 0,xt.info("History API monitoring stopped")}monitorHistoryChanges(){var i,e;if(t&&t.history){var r=this;null!=(i=t.history.pushState)&&i.__posthog_wrapped__||Qe(t.history,"pushState",(t=>function(i,e,s){t.call(this,i,e,s),r.bt("pushState")})),null!=(e=t.history.replaceState)&&e.__posthog_wrapped__||Qe(t.history,"replaceState",(t=>function(i,e,s){t.call(this,i,e,s),r.bt("replaceState")})),this.wt()}}bt(i){try{var e,r=null==t||null==(e=t.location)?void 0:e.pathname;if(!r)return;r!==this._t&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:i}),this._t=r}catch(t){xt.error("Error capturing "+i+" pageview",t)}}wt(){if(!this.yt){var i=()=>{this.bt("popstate")};Bt(t,"popstate",i),this.yt=()=>{t&&t.removeEventListener("popstate",i)}}}}function tr(t){var i,e;return(null==(i=JSON.stringify(t,(e=[],function(t,i){if(P(i)){for(;e.length>0&&e[e.length-1]!==this;)e.pop();return e.includes(i)?"[Circular]":(e.push(i),i)}return i})))?void 0:i.length)||0}function ir(t,i){if(void 0===i&&(i=6606028.8),t.size>=i&&t.data.length>1){var e=Math.floor(t.data.length/2),r=t.data.slice(0,e),s=t.data.slice(e);return[ir({size:tr(r),data:r,sessionId:t.sessionId,windowId:t.windowId}),ir({size:tr(s),data:s,sessionId:t.sessionId,windowId:t.windowId})].flatMap((t=>t))}return[t]}var er=(t=>(t[t.DomContentLoaded=0]="DomContentLoaded",t[t.Load=1]="Load",t[t.FullSnapshot=2]="FullSnapshot",t[t.IncrementalSnapshot=3]="IncrementalSnapshot",t[t.Meta=4]="Meta",t[t.Custom=5]="Custom",t[t.Plugin=6]="Plugin",t))(er||{}),rr=(t=>(t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.Input=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Log=11]="Log",t[t.Drag=12]="Drag",t[t.StyleDeclaration=13]="StyleDeclaration",t[t.Selection=14]="Selection",t[t.AdoptedStyleSheet=15]="AdoptedStyleSheet",t[t.CustomElement=16]="CustomElement",t))(rr||{}),sr="[SessionRecording]",nr="redacted",or={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:t=>t,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:1e6,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io",".clarity.ms","analytics.google.com","bam.nr-data.net"]},ar=["authorization","x-forwarded-for","authorization","cookie","set-cookie","x-api-key","x-real-ip","remote-addr","forwarded","proxy-authorization","x-csrf-token","x-csrftoken","x-xsrf-token"],lr=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],hr=["/s/","/e/","/i/"];function ur(t,i,e,r){if(A(t))return t;var s=(null==i?void 0:i["content-length"])||function(t){return new Blob([t]).size}(t);return M(s)&&(s=parseInt(s)),s>e?sr+" "+r+" body too large to record ("+s+" bytes)":t}function dr(t,i){if(A(t))return t;var e=t;return re(e,!1)||(e=sr+" "+i+" body "+nr),Ct(lr,(t=>{var r,s;null!=(r=e)&&r.length&&-1!==(null==(s=e)?void 0:s.indexOf(t))&&(e=sr+" "+i+" body "+nr+" as might contain: "+t)})),e}var vr=(t,i)=>{var e,r,s,n={payloadSizeLimitBytes:or.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...or.performanceEntryTypeToObserve],payloadHostDenyList:[...i.payloadHostDenyList||[],...or.payloadHostDenyList]},o=!1!==t.session_recording.recordHeaders&&i.recordHeaders,a=!1!==t.session_recording.recordBody&&i.recordBody,l=!1!==t.capture_performance&&i.recordPerformance,h=(e=n,s=Math.min(1e6,null!==(r=e.payloadSizeLimitBytes)&&void 0!==r?r:1e6),t=>(null!=t&&t.requestBody&&(t.requestBody=ur(t.requestBody,t.requestHeaders,s,"Request")),null!=t&&t.responseBody&&(t.responseBody=ur(t.responseBody,t.responseHeaders,s,"Response")),t)),u=i=>{return h(((t,i)=>{var e,r=ce(t.name),s=0===i.indexOf("http")?null==(e=ce(i))?void 0:e.pathname:i;"/"===s&&(s="");var n=null==r?void 0:r.pathname.replace(s||"","");if(!(r&&n&&hr.some((t=>0===n.indexOf(t)))))return t})((r=(e=i).requestHeaders,A(r)||Ct(Object.keys(null!=r?r:{}),(t=>{ar.includes(t.toLowerCase())&&(r[t]=nr)})),e),t.api_host));var e,r},d=I(t.session_recording.maskNetworkRequestFn);return d&&I(t.session_recording.maskCapturedNetworkRequestFn)&&xt.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),d&&(t.session_recording.maskCapturedNetworkRequestFn=i=>{var e=t.session_recording.maskNetworkRequestFn({url:i.name});return g({},i,{name:null==e?void 0:e.url})}),n.maskRequestFn=I(t.session_recording.maskCapturedNetworkRequestFn)?i=>{var e,r=u(i);return r&&null!==(e=null==t.session_recording.maskCapturedNetworkRequestFn?void 0:t.session_recording.maskCapturedNetworkRequestFn(r))&&void 0!==e?e:void 0}:t=>function(t){if(!C(t))return t.requestBody=dr(t.requestBody,"Request"),t.responseBody=dr(t.responseBody,"Response"),t}(u(t)),g({},or,n,{recordHeaders:o,recordBody:a,recordPerformance:l,recordInitialRequests:l})};class cr{constructor(t,i){var e,r;void 0===i&&(i={}),this.St={},this.kt=t=>{if(!this.St[t]){var i,e;this.St[t]=!0;var r=this.$t(t);null==(i=(e=this.t).onBlockedNode)||i.call(e,t,r)}},this.xt=t=>{var i=this.$t(t);if("svg"!==(null==i?void 0:i.nodeName)&&i instanceof Element){var e=i.closest("svg");if(e)return[this._rrweb.mirror.getId(e),e]}return[t,i]},this.$t=t=>this._rrweb.mirror.getNode(t),this.Et=t=>{var i,e,r,s,n,o,a,l;return(null!==(i=null==(e=t.removes)?void 0:e.length)&&void 0!==i?i:0)+(null!==(r=null==(s=t.attributes)?void 0:s.length)&&void 0!==r?r:0)+(null!==(n=null==(o=t.texts)?void 0:o.length)&&void 0!==n?n:0)+(null!==(a=null==(l=t.adds)?void 0:l.length)&&void 0!==a?a:0)},this.throttleMutations=t=>{if(3!==t.type||0!==t.data.source)return t;var i=t.data,e=this.Et(i);i.attributes&&(i.attributes=i.attributes.filter((t=>{var[i]=this.xt(t.id);return!this.gt.consumeRateLimit(i)&&t})));var r=this.Et(i);return 0!==r||e===r?t:void 0},this._rrweb=t,this.t=i,this.gt=new V({bucketSize:null!==(e=this.t.bucketSize)&&void 0!==e?e:100,refillRate:null!==(r=this.t.refillRate)&&void 0!==r?r:10,refillInterval:1e3,$:this.kt,R:xt})}}var fr=Uint8Array,pr=Uint16Array,gr=Uint32Array,_r=new fr([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]),mr=new fr([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]),yr=new fr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),br=function(t,i){for(var e=new pr(31),r=0;r<31;++r)e[r]=i+=1<<t[r-1];var s=new gr(e[30]);for(r=1;r<30;++r)for(var n=e[r];n<e[r+1];++n)s[n]=n-e[r]<<5|r;return[e,s]},wr=br(_r,2),Sr=wr[0],kr=wr[1];Sr[28]=258,kr[258]=28;for(var $r=br(mr,0)[1],xr=new pr(32768),Er=0;Er<32768;++Er){var Rr=(43690&Er)>>>1|(21845&Er)<<1;Rr=(61680&(Rr=(52428&Rr)>>>2|(13107&Rr)<<2))>>>4|(3855&Rr)<<4,xr[Er]=((65280&Rr)>>>8|(255&Rr)<<8)>>>1}var Ir=function(t,i,e){for(var r=t.length,s=0,n=new pr(i);s<r;++s)++n[t[s]-1];var o,a=new pr(i);for(s=0;s<i;++s)a[s]=a[s-1]+n[s-1]<<1;if(e){o=new pr(1<<i);var l=15-i;for(s=0;s<r;++s)if(t[s])for(var h=s<<4|t[s],u=i-t[s],d=a[t[s]-1]++<<u,v=d|(1<<u)-1;d<=v;++d)o[xr[d]>>>l]=h}else for(o=new pr(r),s=0;s<r;++s)o[s]=xr[a[t[s]-1]++]>>>15-t[s];return o},Pr=new fr(288);for(Er=0;Er<144;++Er)Pr[Er]=8;for(Er=144;Er<256;++Er)Pr[Er]=9;for(Er=256;Er<280;++Er)Pr[Er]=7;for(Er=280;Er<288;++Er)Pr[Er]=8;var Tr=new fr(32);for(Er=0;Er<32;++Er)Tr[Er]=5;var Cr=Ir(Pr,9,0),Mr=Ir(Tr,5,0),Or=function(t){return(t/8>>0)+(7&t&&1)},Fr=function(t,i,e){(null==e||e>t.length)&&(e=t.length);var r=new(t instanceof pr?pr:t instanceof gr?gr:fr)(e-i);return r.set(t.subarray(i,e)),r},Ar=function(t,i,e){e<<=7&i;var r=i/8>>0;t[r]|=e,t[r+1]|=e>>>8},Dr=function(t,i,e){e<<=7&i;var r=i/8>>0;t[r]|=e,t[r+1]|=e>>>8,t[r+2]|=e>>>16},jr=function(t,i){for(var e=[],r=0;r<t.length;++r)t[r]&&e.push({s:r,f:t[r]});var s=e.length,n=e.slice();if(!s)return[new fr(0),0];if(1==s){var o=new fr(e[0].s+1);return o[e[0].s]=1,[o,1]}e.sort((function(t,i){return t.f-i.f})),e.push({s:-1,f:25001});var a=e[0],l=e[1],h=0,u=1,d=2;for(e[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=s-1;)a=e[e[h].f<e[d].f?h++:d++],l=e[h!=u&&e[h].f<e[d].f?h++:d++],e[u++]={s:-1,f:a.f+l.f,l:a,r:l};var v=n[0].s;for(r=1;r<s;++r)n[r].s>v&&(v=n[r].s);var c=new pr(v+1),f=Lr(e[u-1],c,0);if(f>i){r=0;var p=0,g=f-i,_=1<<g;for(n.sort((function(t,i){return c[i.s]-c[t.s]||t.f-i.f}));r<s;++r){var m=n[r].s;if(!(c[m]>i))break;p+=_-(1<<f-c[m]),c[m]=i}for(p>>>=g;p>0;){var y=n[r].s;c[y]<i?p-=1<<i-c[y]++-1:++r}for(;r>=0&&p;--r){var b=n[r].s;c[b]==i&&(--c[b],++p)}f=i}return[new fr(c),f]},Lr=function(t,i,e){return-1==t.s?Math.max(Lr(t.l,i,e+1),Lr(t.r,i,e+1)):i[t.s]=e},Nr=function(t){for(var i=t.length;i&&!t[--i];);for(var e=new pr(++i),r=0,s=t[0],n=1,o=function(t){e[r++]=t},a=1;a<=i;++a)if(t[a]==s&&a!=i)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=t[a]}return[e.subarray(0,r),i]},Ur=function(t,i){for(var e=0,r=0;r<i.length;++r)e+=t[r]*i[r];return e},zr=function(t,i,e){var r=e.length,s=Or(i+2);t[s]=255&r,t[s+1]=r>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var n=0;n<r;++n)t[s+n+4]=e[n];return 8*(s+4+r)},Br=function(t,i,e,r,s,n,o,a,l,h,u){Ar(i,u++,e),++s[256];for(var d=jr(s,15),v=d[0],c=d[1],f=jr(n,15),p=f[0],g=f[1],_=Nr(v),m=_[0],y=_[1],b=Nr(p),w=b[0],S=b[1],k=new pr(19),x=0;x<m.length;++x)k[31&m[x]]++;for(x=0;x<w.length;++x)k[31&w[x]]++;for(var E=jr(k,7),R=E[0],I=E[1],P=19;P>4&&!R[yr[P-1]];--P);var T,C,M,O,F=h+5<<3,A=Ur(s,Pr)+Ur(n,Tr)+o,D=Ur(s,v)+Ur(n,p)+o+14+3*P+Ur(k,R)+(2*k[16]+3*k[17]+7*k[18]);if(F<=A&&F<=D)return zr(i,u,t.subarray(l,l+h));if(Ar(i,u,1+(D<A)),u+=2,D<A){T=Ir(v,c,0),C=v,M=Ir(p,g,0),O=p;var j=Ir(R,I,0);Ar(i,u,y-257),Ar(i,u+5,S-1),Ar(i,u+10,P-4),u+=14;for(x=0;x<P;++x)Ar(i,u+3*x,R[yr[x]]);u+=3*P;for(var L=[m,w],N=0;N<2;++N){var U=L[N];for(x=0;x<U.length;++x){var z=31&U[x];Ar(i,u,j[z]),u+=R[z],z>15&&(Ar(i,u,U[x]>>>5&127),u+=U[x]>>>12)}}}else T=Cr,C=Pr,M=Mr,O=Tr;for(x=0;x<a;++x)if(r[x]>255){z=r[x]>>>18&31;Dr(i,u,T[z+257]),u+=C[z+257],z>7&&(Ar(i,u,r[x]>>>23&31),u+=_r[z]);var B=31&r[x];Dr(i,u,M[B]),u+=O[B],B>3&&(Dr(i,u,r[x]>>>5&8191),u+=mr[B])}else Dr(i,u,T[r[x]]),u+=C[r[x]];return Dr(i,u,T[256]),u+C[256]},qr=new gr([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Hr=function(){for(var t=new gr(256),i=0;i<256;++i){for(var e=i,r=9;--r;)e=(1&e&&3988292384)^e>>>1;t[i]=e}return t}(),Wr=function(){var t=4294967295;return{p:function(i){for(var e=t,r=0;r<i.length;++r)e=Hr[255&e^i[r]]^e>>>8;t=e},d:function(){return 4294967295^t}}},Gr=function(t,i,e,r,s){return function(t,i,e,r,s,n){var o=t.length,a=new fr(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),h=0;if(!i||o<8)for(var u=0;u<=o;u+=65535){var d=u+65535;d<o?h=zr(l,h,t.subarray(u,d)):(l[u]=n,h=zr(l,h,t.subarray(u,o)))}else{for(var v=qr[i-1],c=v>>>13,f=8191&v,p=(1<<e)-1,g=new pr(32768),_=new pr(p+1),m=Math.ceil(e/3),y=2*m,b=function(i){return(t[i]^t[i+1]<<m^t[i+2]<<y)&p},w=new gr(25e3),S=new pr(288),k=new pr(32),x=0,E=0,R=(u=0,0),I=0,P=0;u<o;++u){var T=b(u),C=32767&u,M=_[T];if(g[C]=M,_[T]=C,I<=u){var O=o-u;if((x>7e3||R>24576)&&O>423){h=Br(t,l,0,w,S,k,E,R,P,u-P,h),R=x=E=0,P=u;for(var F=0;F<286;++F)S[F]=0;for(F=0;F<30;++F)k[F]=0}var A=2,D=0,j=f,L=C-M&32767;if(O>2&&T==b(u-L))for(var N=Math.min(c,O)-1,U=Math.min(32767,u),z=Math.min(258,O);L<=U&&--j&&C!=M;){if(t[u+A]==t[u+A-L]){for(var B=0;B<z&&t[u+B]==t[u+B-L];++B);if(B>A){if(A=B,D=L,B>N)break;var q=Math.min(L,B-2),H=0;for(F=0;F<q;++F){var W=u-L+F+32768&32767,G=W-g[W]+32768&32767;G>H&&(H=G,M=W)}}}L+=(C=M)-(M=g[C])+32768&32767}if(D){w[R++]=268435456|kr[A]<<18|$r[D];var V=31&kr[A],J=31&$r[D];E+=_r[V]+mr[J],++S[257+V],++k[J],I=u+A,++x}else w[R++]=t[u],++S[t[u]]}}h=Br(t,l,n,w,S,k,E,R,P,u-P,h)}return Fr(a,0,r+Or(h)+s)}(t,null==i.level?6:i.level,null==i.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+i.mem,e,r,!0)},Vr=function(t,i,e){for(;e;++i)t[i]=e,e>>>=8},Jr=function(t,i){var e=i.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=i.level<2?4:9==i.level?2:0,t[9]=3,0!=i.mtime&&Vr(t,4,Math.floor(new Date(i.mtime||Date.now())/1e3)),e){t[3]=8;for(var r=0;r<=e.length;++r)t[r+10]=e.charCodeAt(r)}},Kr=function(t){return 10+(t.filename&&t.filename.length+1||0)};function Yr(t,i){void 0===i&&(i={});var e=Wr(),r=t.length;e.p(t);var s=Gr(t,i,Kr(i),8),n=s.length;return Jr(s,i),Vr(s,n-8,e.d()),Vr(s,n-4,r),s}function Xr(t,i){var e=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new fr(t.length+(t.length>>>1)),s=0,n=function(t){r[s++]=t},o=0;o<e;++o){if(s+5>r.length){var a=new fr(s+8+(e-o<<1));a.set(r),r=a}var l=t.charCodeAt(o);l<128||i?n(l):l<2048?(n(192|l>>>6),n(128|63&l)):l>55295&&l<57344?(n(240|(l=65536+(1047552&l)|1023&t.charCodeAt(++o))>>>18),n(128|l>>>12&63),n(128|l>>>6&63),n(128|63&l)):(n(224|l>>>12),n(128|l>>>6&63),n(128|63&l))}return Fr(r,0,s)}function Qr(t,i){return function(t){for(var i=0,e=0;e<t.length;e++)i=(i<<5)-i+t.charCodeAt(e),i|=0;return Math.abs(i)}(t)%100<G(100*i,0,100,xt)}var Zr="disabled",ts="sampled",is="active",es="buffering",rs="paused",ss="trigger",ns=ss+"_activated",os=ss+"_pending",as=ss+"_"+Zr;function ls(t,i){return i.some((i=>"regex"===i.matching&&new RegExp(i.url).test(t)))}class hs{constructor(t){this.Rt=t}triggerStatus(t){var i=this.Rt.map((i=>i.triggerStatus(t)));return i.includes(ns)?ns:i.includes(os)?os:as}stop(){this.Rt.forEach((t=>t.stop()))}}class us{constructor(t){this.Rt=t}triggerStatus(t){var i=new Set;for(var e of this.Rt)i.add(e.triggerStatus(t));switch(i.delete(as),i.size){case 0:return as;case 1:return Array.from(i)[0];default:return os}}stop(){this.Rt.forEach((t=>t.stop()))}}class ds{triggerStatus(){return os}stop(){}}var vs=t=>"sessionRecording"in t;class cs{constructor(t){this.It=[],this.Pt=[],this.urlBlocked=!1,this._instance=t}onConfig(t){var i,e;this.It=(vs(t)?P(t.sessionRecording)?null==(i=t.sessionRecording)?void 0:i.urlTriggers:[]:null==t?void 0:t.urlTriggers)||[],this.Pt=(vs(t)?P(t.sessionRecording)?null==(e=t.sessionRecording)?void 0:e.urlBlocklist:[]:null==t?void 0:t.urlBlocklist)||[]}onRemoteConfig(t){this.onConfig(t)}Tt(t){var i;return 0===this.It.length?as:(null==(i=this._instance)?void 0:i.get_property(di))===t?ns:os}triggerStatus(t){var i=this.Tt(t),e=i===ns?ns:i===os?os:as;return this._instance.register_for_session({$sdk_debug_replay_url_trigger_status:e}),e}checkUrlTriggerConditions(i,e,r){if(void 0!==t&&t.location.href){var s=t.location.href,n=this.urlBlocked,o=ls(s,this.Pt);n&&o||(o&&!n?i():!o&&n&&e(),ls(s,this.It)&&r("url"))}}stop(){}}class fs{constructor(t){this.linkedFlag=null,this.linkedFlagSeen=!1,this.Ct=()=>{},this._instance=t}triggerStatus(){var t=os;return A(this.linkedFlag)&&(t=as),this.linkedFlagSeen&&(t=ns),this._instance.register_for_session({$sdk_debug_replay_linked_flag_trigger_status:t}),t}onConfig(t,i){var e;if(this.linkedFlag=(vs(t)?P(t.sessionRecording)?null==(e=t.sessionRecording)?void 0:e.linkedFlag:null:null==t?void 0:t.linkedFlag)||null,!A(this.linkedFlag)&&!this.linkedFlagSeen){var r=M(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,s=M(this.linkedFlag)?null:this.linkedFlag.variant;this.Ct=this._instance.onFeatureFlags(((t,e)=>{var n=!1;if(P(e)&&r in e){var o=e[r];n=j(o)?!0===o:s?o===s:!!o}this.linkedFlagSeen=n,n&&i(r,s)}))}}onRemoteConfig(t,i){this.onConfig(t,i)}stop(){this.Ct()}}class ps{constructor(t){this.Mt=[],this._instance=t}onConfig(t){var i;this.Mt=(vs(t)?P(t.sessionRecording)?null==(i=t.sessionRecording)?void 0:i.eventTriggers:[]:null==t?void 0:t.eventTriggers)||[]}onRemoteConfig(t){this.onConfig(t)}Ot(t){var i;return 0===this.Mt.length?as:(null==(i=this._instance)?void 0:i.get_property(vi))===t?ns:os}triggerStatus(t){var i=this.Ot(t),e=i===ns?ns:i===os?os:as;return this._instance.register_for_session({$sdk_debug_replay_event_trigger_status:e}),e}stop(){}}function gs(t){return t.isRecordingEnabled?es:Zr}function _s(t){if(!t.receivedFlags)return es;if(!t.isRecordingEnabled)return Zr;if(t.urlTriggerMatching.urlBlocked)return rs;var i=!0===t.isSampled,e=new hs([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId);return i?ts:e===ns?is:e===os?es:!1===t.isSampled?Zr:is}function ms(t){if(!t.receivedFlags)return es;if(!t.isRecordingEnabled)return Zr;if(t.urlTriggerMatching.urlBlocked)return rs;var i=new us([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId),e=i!==as,r=j(t.isSampled);return e&&i===os?es:e&&i===as||r&&!t.isSampled?Zr:!0===t.isSampled?ts:is}var ys="[SessionRecording]",bs=Et(ys);function ws(){var t;return null==v||null==(t=v.__PosthogExtensions__)||null==(t=t.rrweb)?void 0:t.record}var Ss=3e5,ks=[rr.MouseMove,rr.MouseInteraction,rr.Scroll,rr.ViewportResize,rr.Input,rr.TouchMove,rr.MediaInteraction,rr.Drag],$s=t=>({rrwebMethod:t,enqueuedAt:Date.now(),attempt:1});function xs(t){return function(t,i){for(var e="",r=0;r<t.length;){var s=t[r++];e+=String.fromCharCode(s)}return e}(Yr(Xr(JSON.stringify(t))))}function Es(t){return t.type===er.Custom&&"sessionIdle"===t.data.tag}class Rs{get sessionId(){return this.Ft}get At(){return this._instance.config.session_recording.session_idle_threshold_ms||3e5}get started(){return this.Dt}get jt(){if(!this._instance.sessionManager)throw new Error(ys+" must be started with a valid sessionManager.");return this._instance.sessionManager}get Lt(){var t,i;return this.Nt.triggerStatus(this.sessionId)===os?6e4:null!==(t=null==(i=this._instance.config.session_recording)?void 0:i.full_snapshot_interval_millis)&&void 0!==t?t:Ss}get Ut(){var t=this._instance.get_property(ui);return j(t)?t:null}get zt(){var t,i,e=null==(t=this.H)?void 0:t.data[(null==(i=this.H)?void 0:i.data.length)-1],{sessionStartTimestamp:r}=this.jt.checkAndGetSessionAndWindowId(!0);return e?e.timestamp-r:null}get Bt(){var i=!!this._instance.get_property(ii),e=!this._instance.config.disable_session_recording;return t&&i&&e}get qt(){var t=!!this._instance.get_property(ei),i=this._instance.config.enable_recording_console_log;return null!=i?i:t}get Ht(){var t,i,e,r,s,n,o=this._instance.config.session_recording.captureCanvas,a=this._instance.get_property(ni),l=null!==(t=null!==(i=null==o?void 0:o.recordCanvas)&&void 0!==i?i:null==a?void 0:a.enabled)&&void 0!==t&&t,h=null!==(e=null!==(r=null==o?void 0:o.canvasFps)&&void 0!==r?r:null==a?void 0:a.fps)&&void 0!==e?e:4,u=null!==(s=null!==(n=null==o?void 0:o.canvasQuality)&&void 0!==n?n:null==a?void 0:a.quality)&&void 0!==s?s:.4;if("string"==typeof u){var d=parseFloat(u);u=isNaN(d)?.4:d}return{enabled:l,fps:G(h,0,12,bs.createLogger("canvas recording fps"),4),quality:G(u,0,1,bs.createLogger("canvas recording quality"),.4)}}get Wt(){var t,i,e=this._instance.get_property(ri),r={recordHeaders:null==(t=this._instance.config.session_recording)?void 0:t.recordHeaders,recordBody:null==(i=this._instance.config.session_recording)?void 0:i.recordBody},s=(null==r?void 0:r.recordHeaders)||(null==e?void 0:e.recordHeaders),n=(null==r?void 0:r.recordBody)||(null==e?void 0:e.recordBody),o=P(this._instance.config.capture_performance)?this._instance.config.capture_performance.network_timing:this._instance.config.capture_performance,a=!!(j(o)?o:null==e?void 0:e.capturePerformance);return s||n||a?{recordHeaders:s,recordBody:n,recordPerformance:a}:void 0}get Gt(){var t,i,e,r,s,n,o=this._instance.get_property(si),a={maskAllInputs:null==(t=this._instance.config.session_recording)?void 0:t.maskAllInputs,maskTextSelector:null==(i=this._instance.config.session_recording)?void 0:i.maskTextSelector,blockSelector:null==(e=this._instance.config.session_recording)?void 0:e.blockSelector},l=null!==(r=null==a?void 0:a.maskAllInputs)&&void 0!==r?r:null==o?void 0:o.maskAllInputs,h=null!==(s=null==a?void 0:a.maskTextSelector)&&void 0!==s?s:null==o?void 0:o.maskTextSelector,u=null!==(n=null==a?void 0:a.blockSelector)&&void 0!==n?n:null==o?void 0:o.blockSelector;return C(l)&&C(h)&&C(u)?void 0:{maskAllInputs:null==l||l,maskTextSelector:h,blockSelector:u}}get Vt(){var t=this._instance.get_property(oi);return D(t)?t:null}get Jt(){var t=this._instance.get_property(ai);return D(t)?t:null}get status(){return this.Kt?this.Yt({receivedFlags:this.Kt,isRecordingEnabled:this.Bt,isSampled:this.Ut,urlTriggerMatching:this.Xt,eventTriggerMatching:this.Qt,linkedFlagMatching:this.Zt,sessionId:this.sessionId}):es}constructor(t){if(this.Yt=gs,this.Kt=!1,this.ti=[],this.ii="unknown",this.ei=Date.now(),this.Nt=new ds,this.ri=void 0,this.si=void 0,this.ni=void 0,this.oi=void 0,this.ai=void 0,this._forceAllowLocalhostNetworkCapture=!1,this.li=()=>{this.hi()},this.ui=()=>{this.tryAddCustomEvent("browser offline",{})},this.di=()=>{this.tryAddCustomEvent("browser online",{})},this.vi=()=>{if(null!=o&&o.visibilityState){var t="window "+o.visibilityState;this.tryAddCustomEvent(t,{})}},this._instance=t,this.Dt=!1,this.ci="/s/",this.fi=void 0,this.Kt=!1,!this._instance.sessionManager)throw bs.error("started without valid sessionManager"),new Error(ys+" started without valid sessionManager. This is a bug.");if("always"===this._instance.config.cookieless_mode)throw new Error(ys+' cannot be used with cookieless_mode="always"');this.Zt=new fs(this._instance),this.Xt=new cs(this._instance),this.Qt=new ps(this._instance);var{sessionId:i,windowId:e}=this.jt.checkAndGetSessionAndWindowId();this.Ft=i,this.pi=e,this.H=this.gi(),this.At>=this.jt.sessionTimeoutMs&&bs.warn("session_idle_threshold_ms ("+this.At+") is greater than the session timeout ("+this.jt.sessionTimeoutMs+"). Session will never be detected as idle")}startIfEnabledOrStop(i){this.Bt?(this.mi(i),Bt(t,"beforeunload",this.li),Bt(t,"offline",this.ui),Bt(t,"online",this.di),Bt(t,"visibilitychange",this.vi),this.yi(),this.bi(),A(this.ri)&&(this.ri=this._instance.on("eventCaptured",(t=>{try{if("$pageview"===t.event){var i=null!=t&&t.properties.$current_url?this.wi(null==t?void 0:t.properties.$current_url):"";if(!i)return;this.tryAddCustomEvent("$pageview",{href:i})}}catch(t){bs.error("Could not add $pageview to rrweb session",t)}}))),this.si||(this.si=this.jt.onSessionId(((t,i,e)=>{var r,s;e&&(this.tryAddCustomEvent("$session_id_change",{sessionId:t,windowId:i,changeReason:e}),null==(r=this._instance)||null==(r=r.persistence)||r.unregister(vi),null==(s=this._instance)||null==(s=s.persistence)||s.unregister(di))})))):this.stopRecording()}stopRecording(){var i,e,r,s;this.Dt&&this.fi&&(this.fi(),this.fi=void 0,this.Dt=!1,null==t||t.removeEventListener("beforeunload",this.li),null==t||t.removeEventListener("offline",this.ui),null==t||t.removeEventListener("online",this.di),null==t||t.removeEventListener("visibilitychange",this.vi),this.gi(),clearInterval(this.Si),null==(i=this.ri)||i.call(this),this.ri=void 0,null==(e=this.ai)||e.call(this),this.ai=void 0,null==(r=this.si)||r.call(this),this.si=void 0,null==(s=this.oi)||s.call(this),this.oi=void 0,this.Qt.stop(),this.Xt.stop(),this.Zt.stop(),bs.info("stopped"))}ki(){var t;null==(t=this._instance.persistence)||t.unregister(ui)}$i(t){var i,e=this.Ft!==t,r=this.Vt;if(D(r)){var s=this.Ut,n=e||!j(s),o=n?Qr(t,r):s;n&&(o?this.xi(ts):bs.warn("Sample rate ("+r+") has determined that this sessionId ("+t+") will not be sent to the server."),this.tryAddCustomEvent("samplingDecisionMade",{sampleRate:r,isSampled:o})),null==(i=this._instance.persistence)||i.register({[ui]:o})}else this.ki()}onRemoteConfig(t){if(this.tryAddCustomEvent("$remote_config_received",t),this.Kt=!0,this.Ei(t),t.sessionRecording){var i,e,r,s;if(null!=(i=t.sessionRecording)&&i.endpoint)this.ci=null==(s=t.sessionRecording)?void 0:s.endpoint;this.yi(),"any"===(null==(e=t.sessionRecording)?void 0:e.triggerMatchType)?(this.Yt=_s,this.Nt=new hs([this.Qt,this.Xt])):(this.Yt=ms,this.Nt=new us([this.Qt,this.Xt])),this._instance.register_for_session({$sdk_debug_replay_remote_trigger_matching_config:null==(r=t.sessionRecording)?void 0:r.triggerMatchType}),this.Xt.onConfig(t),this.Qt.onConfig(t),this.Zt.onConfig(t,((t,i)=>{this.xi("linked_flag_matched",{flag:t,variant:i})}))}this.startIfEnabledOrStop()}yi(){D(this.Vt)&&A(this.oi)&&(this.oi=this.jt.onSessionId((t=>{this.$i(t)})))}Ei(t){if(this._instance.persistence){var i,e=this._instance.persistence,r=()=>{var i=!1===t.sessionRecording?void 0:t.sessionRecording,r=null==i?void 0:i.sampleRate,s=A(r)?null:parseFloat(r);A(s)&&this.ki();var n=null==i?void 0:i.minimumDurationMilliseconds;e.register({[ii]:!!t.sessionRecording,[ei]:null==i?void 0:i.consoleLogRecordingEnabled,[ri]:g({capturePerformance:t.capturePerformance},null==i?void 0:i.networkPayloadCapture),[si]:null==i?void 0:i.masking,[ni]:{enabled:null==i?void 0:i.recordCanvas,fps:null==i?void 0:i.canvasFps,quality:null==i?void 0:i.canvasQuality},[oi]:s,[ai]:C(n)?null:n,[li]:null==i?void 0:i.scriptConfig})};r(),null==(i=this.ni)||i.call(this),this.ni=this.jt.onSessionId(r)}}log(t,i){var e;void 0===i&&(i="log"),null==(e=this._instance.sessionRecording)||e.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:i,trace:[],payload:[JSON.stringify(t)]}},timestamp:Date.now()})}mi(t){if(!C(Object.assign)&&!C(Array.from)&&!(this.Dt||this._instance.config.disable_session_recording||this._instance.consent.isOptedOut())){var i;if(this.Dt=!0,this.jt.checkAndGetSessionAndWindowId(),ws())this.Ri();else null==(i=v.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this.Ii,(t=>{if(t)return bs.error("could not load recorder",t);this.Ri()}));bs.info("starting"),this.status===is&&this.xi(t||"recording_initialized")}}get Ii(){var t;return(null==(t=this._instance)||null==(t=t.persistence)||null==(t=t.get_property(li))?void 0:t.script)||"recorder"}Pi(t){var i;return 3===t.type&&-1!==ks.indexOf(null==(i=t.data)?void 0:i.source)}Ti(t){var i=this.Pi(t);i||this.ii||t.timestamp-this.ei>this.At&&(this.ii=!0,clearInterval(this.Si),this.tryAddCustomEvent("sessionIdle",{eventTimestamp:t.timestamp,lastActivityTimestamp:this.ei,threshold:this.At,bufferLength:this.H.data.length,bufferSize:this.H.size}),this.hi());var e=!1;if(i&&(this.ei=t.timestamp,this.ii)){var r="unknown"===this.ii;this.ii=!1,r||(this.tryAddCustomEvent("sessionNoLongerIdle",{reason:"user activity",type:t.type}),e=!0)}if(!this.ii){var{windowId:s,sessionId:n}=this.jt.checkAndGetSessionAndWindowId(!i,t.timestamp),o=this.Ft!==n,a=this.pi!==s;this.pi=s,this.Ft=n,o||a?(this.stopRecording(),this.startIfEnabledOrStop("session_id_changed")):e&&this.Ci()}}Mi(t){try{return t.rrwebMethod(),!0}catch(i){return this.ti.length<10?this.ti.push({enqueuedAt:t.enqueuedAt||Date.now(),attempt:t.attempt++,rrwebMethod:t.rrwebMethod}):bs.warn("could not emit queued rrweb event.",i,t),!1}}tryAddCustomEvent(t,i){return this.Mi($s((()=>ws().addCustomEvent(t,i))))}Oi(){return this.Mi($s((()=>ws().takeFullSnapshot())))}Ri(){var t,i,e,r,s={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,recordCrossOriginIframes:!1},n=this._instance.config.session_recording;for(var[o,a]of Object.entries(n||{}))o in s&&("maskInputOptions"===o?s.maskInputOptions=g({password:!0},a):s[o]=a);(this.Ht&&this.Ht.enabled&&(s.recordCanvas=!0,s.sampling={canvas:this.Ht.fps},s.dataURLOptions={type:"image/webp",quality:this.Ht.quality}),this.Gt)&&(s.maskAllInputs=null===(i=this.Gt.maskAllInputs)||void 0===i||i,s.maskTextSelector=null!==(e=this.Gt.maskTextSelector)&&void 0!==e?e:void 0,s.blockSelector=null!==(r=this.Gt.blockSelector)&&void 0!==r?r:void 0);var l=ws();if(l){this.Fi=null!==(t=this.Fi)&&void 0!==t?t:new cr(l,{refillRate:this._instance.config.session_recording.__mutationThrottlerRefillRate,bucketSize:this._instance.config.session_recording.__mutationThrottlerBucketSize,onBlockedNode:(t,i)=>{var e="Too many mutations on node '"+t+"'. Rate limiting. This could be due to SVG animations or something similar";bs.info(e,{node:i}),this.log(ys+" "+e,"warn")}});var h=this.Ai();this.fi=l(g({emit:t=>{this.onRRwebEmit(t)},plugins:h},s)),this.ei=Date.now(),this.ii=j(this.ii)?this.ii:"unknown",this.tryAddCustomEvent("$session_options",{sessionRecordingOptions:s,activePlugins:h.map((t=>null==t?void 0:t.name))}),this.tryAddCustomEvent("$posthog_config",{config:this._instance.config})}else bs.error("onScriptLoaded was called but rrwebRecord is not available. This indicates something has gone wrong.")}Ci(){if(this.Si&&clearInterval(this.Si),!0!==this.ii){var t=this.Lt;t&&(this.Si=setInterval((()=>{this.Oi()}),t))}}Ai(){var t,i,e=[],r=null==(t=v.__PosthogExtensions__)||null==(t=t.rrwebPlugins)?void 0:t.getRecordConsolePlugin;r&&this.qt&&e.push(r());var s=null==(i=v.__PosthogExtensions__)||null==(i=i.rrwebPlugins)?void 0:i.getRecordNetworkPlugin;this.Wt&&I(s)&&(!ve.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?e.push(s(vr(this._instance.config,this.Wt))):bs.info("NetworkCapture not started because we are on localhost."));return e}onRRwebEmit(t){var i;if(this.Di(),t&&P(t)){if(t.type===er.Meta){var e=this.wi(t.data.href);if(this.ji=e,!e)return;t.data.href=e}else this.Li();if(this.Xt.checkUrlTriggerConditions((()=>this.Ni()),(()=>this.Ui()),(t=>this.zi(t))),!this.Xt.urlBlocked||(r=t).type===er.Custom&&"recording paused"===r.data.tag){var r;t.type===er.FullSnapshot&&this.Ci(),t.type===er.FullSnapshot&&this.Kt&&this.Nt.triggerStatus(this.sessionId)===os&&this.Bi();var s=this.Fi?this.Fi.throttleMutations(t):t;if(s){var n=function(t){var i=t;if(i&&P(i)&&6===i.type&&P(i.data)&&"rrweb/console@1"===i.data.plugin){i.data.payload.payload.length>10&&(i.data.payload.payload=i.data.payload.payload.slice(0,10),i.data.payload.payload.push("...[truncated]"));for(var e=[],r=0;r<i.data.payload.payload.length;r++)i.data.payload.payload[r]&&i.data.payload.payload[r].length>2e3?e.push(i.data.payload.payload[r].slice(0,2e3)+"...[truncated]"):e.push(i.data.payload.payload[r]);return i.data.payload.payload=e,t}return t}(s);if(this.Ti(n),!0!==this.ii||Es(n)){if(Es(n)){var o=n.data.payload;if(o){var a=o.lastActivityTimestamp,l=o.threshold;n.timestamp=a+l}}var h=null===(i=this._instance.config.session_recording.compress_events)||void 0===i||i?function(t){try{if(t.type===er.FullSnapshot)return g({},t,{data:xs(t.data),cv:"2024-10"});if(t.type===er.IncrementalSnapshot&&t.data.source===rr.Mutation)return g({},t,{cv:"2024-10",data:g({},t.data,{texts:xs(t.data.texts),attributes:xs(t.data.attributes),removes:xs(t.data.removes),adds:xs(t.data.adds)})});if(t.type===er.IncrementalSnapshot&&t.data.source===rr.StyleSheetRule)return g({},t,{cv:"2024-10",data:g({},t.data,{adds:t.data.adds?xs(t.data.adds):void 0,removes:t.data.removes?xs(t.data.removes):void 0})})}catch(t){bs.error("could not compress event - will use uncompressed event",t)}return t}(n):n,u={$snapshot_bytes:tr(h),$snapshot_data:h,$session_id:this.Ft,$window_id:this.pi};this.status!==Zr?this.qi(u):this.gi()}}}}}Li(){if(!this._instance.config.capture_pageview&&t){var i=this.wi(t.location.href);this.ji!==i&&(this.tryAddCustomEvent("$url_changed",{href:i}),this.ji=i)}}Di(){if(this.ti.length){var t=[...this.ti];this.ti=[],t.forEach((t=>{Date.now()-t.enqueuedAt<=2e3&&this.Mi(t)}))}}wi(t){var i=this._instance.config.session_recording;if(i.maskNetworkRequestFn){var e,r={url:t};return null==(e=r=i.maskNetworkRequestFn(r))?void 0:e.url}return t}Bi(){if(!this.H||0===this.H.data.length)return this.gi();for(var t=-1,i=this.H.data.length-1;i>=0;i--)if(this.H.data[i].type===er.Meta){t=i;break}return t>=0?(this.H.data=this.H.data.slice(t),this.H.size=this.H.data.reduce(((t,i)=>t+tr(i)),0),this.H):this.gi()}gi(){return this.H={size:0,data:[],sessionId:this.Ft,windowId:this.pi},this.H}hi(){this.Hi&&(clearTimeout(this.Hi),this.Hi=void 0);var t=this.Jt,i=this.zt,e=D(i)&&i>=0,r=D(t)&&e&&i<t;if(this.status===es||this.status===rs||this.status===Zr||r)return this.Hi=setTimeout((()=>{this.hi()}),2e3),this.H;this.H.data.length>0&&ir(this.H).forEach((t=>{this.Wi({$snapshot_bytes:t.size,$snapshot_data:t.data,$session_id:t.sessionId,$window_id:t.windowId,$lib:"web",$lib_version:c.LIB_VERSION})}));return this.gi()}qi(t){var i,e=2+((null==(i=this.H)?void 0:i.data.length)||0);!this.ii&&(this.H.size+t.$snapshot_bytes+e>943718.4||this.H.sessionId!==this.Ft)&&(this.H=this.hi()),this.H.size+=t.$snapshot_bytes,this.H.data.push(t.$snapshot_data),this.Hi||this.ii||(this.Hi=setTimeout((()=>{this.hi()}),2e3))}Wi(t){this._instance.capture("$snapshot",t,{_url:this._instance.requestRouter.endpointFor("api",this.ci),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}zi(t){var i;this.Nt.triggerStatus(this.sessionId)===os&&(null==(i=this._instance)||null==(i=i.persistence)||i.register({["url"===t?di:vi]:this.Ft}),this.hi(),this.xi(t+"_trigger_matched"))}Ni(){this.Xt.urlBlocked||(this.Xt.urlBlocked=!0,clearInterval(this.Si),bs.info("recording paused due to URL blocker"),this.tryAddCustomEvent("recording paused",{reason:"url blocker"}))}Ui(){this.Xt.urlBlocked&&(this.Xt.urlBlocked=!1,this.Oi(),this.Ci(),this.tryAddCustomEvent("recording resumed",{reason:"left blocked url"}),bs.info("recording resumed"))}bi(){0!==this.Qt.Mt.length&&A(this.ai)&&(this.ai=this._instance.on("eventCaptured",(t=>{try{this.Qt.Mt.includes(t.event)&&this.zi("event")}catch(t){bs.error("Could not activate event trigger",t)}})))}overrideLinkedFlag(){this.Zt.linkedFlagSeen=!0,this.Oi(),this.xi("linked_flag_overridden")}overrideSampling(){var t;null==(t=this._instance.persistence)||t.register({[ui]:!0}),this.Oi(),this.xi("sampling_overridden")}overrideTrigger(t){this.zi(t)}xi(t,i){this._instance.register_for_session({$session_recording_start_reason:t}),bs.info(t.replace("_"," "),i),y(["recording_initialized","session_id_changed"],t)||this.tryAddCustomEvent(t,i)}get sdkDebugProperties(){var{sessionStartTimestamp:t}=this.jt.checkAndGetSessionAndWindowId(!0);return{$recording_status:this.status,$sdk_debug_replay_internal_buffer_length:this.H.data.length,$sdk_debug_replay_internal_buffer_size:this.H.size,$sdk_debug_current_session_duration:this.zt,$sdk_debug_session_start:t}}}var Is=Et("[SegmentIntegration]");function Ps(t,i){var e=t.config.segment;if(!e)return i();!function(t,i){var e=t.config.segment;if(!e)return i();var r=e=>{var r=()=>e.anonymousId()||Te();t.config.get_device_id=r,e.id()&&(t.register({distinct_id:e.id(),$device_id:r()}),t.persistence.set_property(wi,"identified")),i()},s=e.user();"then"in s&&I(s.then)?s.then((t=>r(t))):r(s)}(t,(()=>{e.register((t=>{Promise&&Promise.resolve||Is.warn("This browser does not have Promise support, and can not use the segment integration");var i=(i,e)=>{if(!e)return i;i.event.userId||i.event.anonymousId===t.get_distinct_id()||(Is.info("No userId set, resetting PostHog"),t.reset()),i.event.userId&&i.event.userId!==t.get_distinct_id()&&(Is.info("UserId set, identifying with PostHog"),t.identify(i.event.userId));var r=t.calculateEventProperties(e,i.event.properties);return i.event.properties=Object.assign({},r,i.event.properties),i};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:t=>i(t,t.event.event),page:t=>i(t,"$pageview"),identify:t=>i(t,"$identify"),screen:t=>i(t,"$screen")}})(t)).then((()=>{i()}))}))}var Ts="posthog-js";function Cs(t,i){var{organization:e,projectId:r,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:o=!0}=void 0===i?{}:i;return i=>{var a,l,h,u,d;if(!("*"===n||n.includes(i.level))||!t.__loaded)return i;i.tags||(i.tags={});var v=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());i.tags["PostHog Person URL"]=v,t.sessionRecordingStarted()&&(i.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var c=(null==(a=i.exception)?void 0:a.values)||[],f=c.map((t=>g({},t,{stacktrace:t.stacktrace?g({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map((t=>g({},t,{platform:"web:javascript"})))}):void 0}))),p={$exception_message:(null==(l=c[0])?void 0:l.value)||i.message,$exception_type:null==(h=c[0])?void 0:h.type,$exception_personURL:v,$exception_level:i.level,$exception_list:f,$sentry_event_id:i.event_id,$sentry_exception:i.exception,$sentry_exception_message:(null==(u=c[0])?void 0:u.value)||i.message,$sentry_exception_type:null==(d=c[0])?void 0:d.type,$sentry_tags:i.tags};return e&&r&&(p.$sentry_url=(s||"https://sentry.io/organizations/")+e+"/issues/?project="+r+"&query="+i.event_id),o&&t.exceptions.sendExceptionEvent(p),i}}class Ms{constructor(t,i,e,r,s,n){this.name=Ts,this.setupOnce=function(o){o(Cs(t,{organization:i,projectId:e,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}var Os=null!=t&&t.location?_e(t.location.hash,"__posthog")||_e(location.hash,"state"):null,Fs="_postHogToolbarParams",As=Et("[Toolbar]"),Ds=function(t){return t[t.UNINITIALIZED=0]="UNINITIALIZED",t[t.LOADING=1]="LOADING",t[t.LOADED=2]="LOADED",t}(Ds||{});class js{constructor(t){this.instance=t}Gi(t){v.ph_toolbar_state=t}Vi(){var t;return null!==(t=v.ph_toolbar_state)&&void 0!==t?t:Ds.UNINITIALIZED}maybeLoadToolbar(i,e,r){if(void 0===i&&(i=void 0),void 0===e&&(e=void 0),void 0===r&&(r=void 0),!t||!o)return!1;i=null!=i?i:t.location,r=null!=r?r:t.history;try{if(!e){try{t.localStorage.setItem("test","test"),t.localStorage.removeItem("test")}catch(t){return!1}e=null==t?void 0:t.localStorage}var s,n=Os||_e(i.hash,"__posthog")||_e(i.hash,"state"),a=n?At((()=>JSON.parse(atob(decodeURIComponent(n)))))||At((()=>JSON.parse(decodeURIComponent(n)))):null;return a&&"ph_authorize"===a.action?((s=a).source="url",s&&Object.keys(s).length>0&&(a.desiredHash?i.hash=a.desiredHash:r?r.replaceState(r.state,"",i.pathname+i.search):i.hash="")):((s=JSON.parse(e.getItem(Fs)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token)&&(this.loadToolbar(s),!0)}catch(t){return!1}}Ji(t){var i=v.ph_load_toolbar||v.ph_load_editor;!A(i)&&I(i)?i(t,this.instance):As.warn("No toolbar load function found")}loadToolbar(i){var e=!(null==o||!o.getElementById(Ii));if(!t||e)return!1;var r="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=g({token:this.instance.config.token},i,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(t.localStorage.setItem(Fs,JSON.stringify(g({},s,{source:void 0}))),this.Vi()===Ds.LOADED)this.Ji(s);else if(this.Vi()===Ds.UNINITIALIZED){var n;this.Gi(Ds.LOADING),null==(n=v.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",(t=>{if(t)return As.error("[Toolbar] Failed to load",t),void this.Gi(Ds.UNINITIALIZED);this.Gi(Ds.LOADED),this.Ji(s)})),Bt(t,"turbolinks:load",(()=>{this.Gi(Ds.UNINITIALIZED),this.loadToolbar(s)}))}return!0}Ki(t){return this.loadToolbar(t)}maybeLoadEditor(t,i,e){return void 0===t&&(t=void 0),void 0===i&&(i=void 0),void 0===e&&(e=void 0),this.maybeLoadToolbar(t,i,e)}}var Ls=Et("[TracingHeaders]");class Ns{constructor(t){this.Yi=void 0,this.Xi=void 0,this.lt=()=>{var t,i;C(this.Yi)&&(null==(t=v.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)||t._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager));C(this.Xi)&&(null==(i=v.__PosthogExtensions__)||null==(i=i.tracingHeadersPatchFns)||i._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=t}nt(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.tracingHeadersPatchFns&&t(),null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"tracing-headers",(i=>{if(i)return Ls.error("failed to load script",i);t()}))}startIfEnabledOrStop(){var t,i;this._instance.config.__add_tracing_headers?this.nt(this.lt):(null==(t=this.Yi)||t.call(this),null==(i=this.Xi)||i.call(this),this.Yi=void 0,this.Xi=void 0)}}var Us=Et("[Web Vitals]"),zs=9e5;class Bs{constructor(t){var i;this.Qi=!1,this.C=!1,this.H={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Zi=()=>{clearTimeout(this.te),0!==this.H.metrics.length&&(this._instance.capture("$web_vitals",this.H.metrics.reduce(((t,i)=>g({},t,{["$web_vitals_"+i.name+"_event"]:g({},i),["$web_vitals_"+i.name+"_value"]:i.value})),{})),this.H={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.ie=t=>{var i,e=null==(i=this._instance.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0);if(C(e))Us.error("Could not read session ID. Dropping metrics!");else{this.H=this.H||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var r=this.ee();if(!C(r))if(A(null==t?void 0:t.name)||A(null==t?void 0:t.value))Us.error("Invalid metric received",t);else if(this.re&&t.value>=this.re)Us.error("Ignoring metric with value >= "+this.re,t);else this.H.url!==r&&(this.Zi(),this.te=setTimeout(this.Zi,this.flushToCaptureTimeoutMs)),C(this.H.url)&&(this.H.url=r),this.H.firstMetricTimestamp=C(this.H.firstMetricTimestamp)?Date.now():this.H.firstMetricTimestamp,t.attribution&&t.attribution.interactionTargetElement&&(t.attribution.interactionTargetElement=void 0),this.H.metrics.push(g({},t,{$current_url:r,$session_id:e.sessionId,$window_id:e.windowId,timestamp:Date.now()})),this.H.metrics.length===this.allowedMetrics.length&&this.Zi()}},this.lt=()=>{var t,i,e,r,s=v.__PosthogExtensions__;C(s)||C(s.postHogWebVitalsCallbacks)||({onLCP:t,onCLS:i,onFCP:e,onINP:r}=s.postHogWebVitalsCallbacks),t&&i&&e&&r?(this.allowedMetrics.indexOf("LCP")>-1&&t(this.ie.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&i(this.ie.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&e(this.ie.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&r(this.ie.bind(this)),this.C=!0):Us.error("web vitals callbacks not loaded - not starting")},this._instance=t,this.Qi=!(null==(i=this._instance.persistence)||!i.props[Xt]),this.startIfEnabled()}get allowedMetrics(){var t,i,e=P(this._instance.config.capture_performance)?null==(t=this._instance.config.capture_performance)?void 0:t.web_vitals_allowed_metrics:void 0;return C(e)?(null==(i=this._instance.persistence)?void 0:i.props[Zt])||["CLS","FCP","INP","LCP"]:e}get flushToCaptureTimeoutMs(){return(P(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get re(){var t=P(this._instance.config.capture_performance)&&D(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:zs;return 0<t&&t<=6e4?zs:t}get isEnabled(){var t=null==a?void 0:a.protocol;if("http:"!==t&&"https:"!==t)return Us.info("Web Vitals are disabled on non-http/https protocols"),!1;var i=P(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(i)?i:this.Qi}startIfEnabled(){this.isEnabled&&!this.C&&(Us.info("enabled, starting..."),this.nt(this.lt))}onRemoteConfig(t){var i=P(t.capturePerformance)&&!!t.capturePerformance.web_vitals,e=P(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Xt]:i}),this._instance.persistence.register({[Zt]:e})),this.Qi=i,this.startIfEnabled()}nt(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.postHogWebVitalsCallbacks&&t(),null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"web-vitals",(i=>{i?Us.error("failed to load script",i):t()}))}ee(){var i=t?t.location.href:void 0;return i||Us.error("Could not determine current URL"),i}}var qs=Et("[Heatmaps]");function Hs(t){return P(t)&&"clientX"in t&&"clientY"in t&&D(t.clientX)&&D(t.clientY)}class Ws{constructor(t){var i;this.rageclicks=new he,this.Qi=!1,this.C=!1,this.se=null,this.instance=t,this.Qi=!(null==(i=this.instance.persistence)||!i.props[Vt])}get flushIntervalMilliseconds(){var t=5e3;return P(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(t=this.instance.config.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return C(this.instance.config.capture_heatmaps)?C(this.instance.config.enable_heatmaps)?this.Qi:this.instance.config.enable_heatmaps:!1!==this.instance.config.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.C)return;qs.info("starting..."),this.ne(),this.se=setInterval(this.oe.bind(this),this.flushIntervalMilliseconds)}else{var t,i;clearInterval(null!==(t=this.se)&&void 0!==t?t:void 0),null==(i=this.ae)||i.stop(),this.getAndClearBuffer()}}onRemoteConfig(t){var i=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Vt]:i}),this.Qi=i,this.startIfEnabled()}getAndClearBuffer(){var t=this.H;return this.H=void 0,t}le(t){this.he(t.originalEvent,"deadclick")}ne(){t&&o&&(Bt(t,"beforeunload",this.oe.bind(this)),Bt(o,"click",(i=>this.he(i||(null==t?void 0:t.event))),{capture:!0}),Bt(o,"mousemove",(i=>this.ue(i||(null==t?void 0:t.event))),{capture:!0}),this.ae=new Ke(this.instance,Ve,this.le.bind(this)),this.ae.startIfEnabled(),this.C=!0)}de(i,e){var r=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),o=function(i,e,r){for(var s=i;s&&Mi(s)&&!Oi(s,"body");){if(s===r)return!1;if(y(e,null==t?void 0:t.getComputedStyle(s).position))return!0;s=Hi(s)}return!1}(zi(i),["fixed","sticky"],n);return{x:i.clientX+(o?0:s),y:i.clientY+(o?0:r),target_fixed:o,type:e}}he(t,i){var e;if(void 0===i&&(i="click"),!Ci(t.target)&&Hs(t)){var r=this.de(t,i);null!=(e=this.rageclicks)&&e.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&this.ve(g({},r,{type:"rageclick"})),this.ve(r)}}ue(t){!Ci(t.target)&&Hs(t)&&(clearTimeout(this.ce),this.ce=setTimeout((()=>{this.ve(this.de(t,"mousemove"))}),500))}ve(i){if(t){var e=t.location.href;this.H=this.H||{},this.H[e]||(this.H[e]=[]),this.H[e].push(i)}}oe(){this.H&&!T(this.H)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class Gs{constructor(t){this._instance=t}doPageView(i,e){var r,s=this.fe(i,e);return this.pe={pathname:null!==(r=null==t?void 0:t.location.pathname)&&void 0!==r?r:"",pageViewId:e,timestamp:i},this._instance.scrollManager.resetContext(),s}doPageLeave(t){var i;return this.fe(t,null==(i=this.pe)?void 0:i.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.pe)?void 0:t.pageViewId}}fe(t,i){var e=this.pe;if(!e)return{$pageview_id:i};var r={$pageview_id:i,$prev_pageview_id:e.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:h,maxContentY:u}=s;if(!(C(n)||C(o)||C(a)||C(l)||C(h)||C(u))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),h=Math.ceil(h),u=Math.ceil(u);var d=n<=1?1:G(o/n,0,1,xt),v=n<=1?1:G(a/n,0,1,xt),c=l<=1?1:G(h/l,0,1,xt),f=l<=1?1:G(u/l,0,1,xt);r=Mt(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:v,$prev_pageview_last_content:h,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:f})}}return e.pathname&&(r.$prev_pageview_pathname=e.pathname),e.timestamp&&(r.$prev_pageview_duration=(t.getTime()-e.timestamp.getTime())/1e3),r}}var Vs=function(t){var i,e,r,s,n="";for(i=e=0,r=(t=(t+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,s=0;s<r;s++){var o=t.charCodeAt(s),a=null;o<128?e++:a=o>127&&o<2048?String.fromCharCode(o>>6|192,63&o|128):String.fromCharCode(o>>12|224,o>>6&63|128,63&o|128),F(a)||(e>i&&(n+=t.substring(i,e)),n+=a,i=e=s+1)}return e>i&&(n+=t.substring(i,t.length)),n},Js=!!h||!!l,Ks="text/plain",Ys=(t,i)=>{var[e,r]=t.split("?"),s=g({},i);null==r||r.split("&").forEach((t=>{var[i]=t.split("=");delete s[i]}));var n=fe(s);return e+"?"+(n=n?(r?r+"&":"")+n:r)},Xs=(t,i)=>JSON.stringify(t,((t,i)=>"bigint"==typeof i?i.toString():i),i),Qs=t=>{var{data:i,compression:e}=t;if(i){if(e===de.GZipJS){var r=Yr(Xr(Xs(i)),{mtime:0}),s=new Blob([r],{type:Ks});return{contentType:Ks,body:s,estimatedSize:s.size}}if(e===de.Base64){var n=function(t){var i,e,r,s,n,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=0,l=0,h="",u=[];if(!t)return t;t=Vs(t);do{i=(n=t.charCodeAt(a++)<<16|t.charCodeAt(a++)<<8|t.charCodeAt(a++))>>18&63,e=n>>12&63,r=n>>6&63,s=63&n,u[l++]=o.charAt(i)+o.charAt(e)+o.charAt(r)+o.charAt(s)}while(a<t.length);switch(h=u.join(""),t.length%3){case 1:h=h.slice(0,-2)+"==";break;case 2:h=h.slice(0,-1)+"="}return h}(Xs(i)),o=(t=>"data="+encodeURIComponent("string"==typeof t?t:Xs(t)))(n);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var a=Xs(i);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},Zs=[];l&&Zs.push({transport:"fetch",method:t=>{var i,e,{contentType:r,body:s,estimatedSize:n}=null!==(i=Qs(t))&&void 0!==i?i:{},o=new Headers;Ct(t.headers,(function(t,i){o.append(i,t)})),r&&o.append("Content-Type",r);var a=t.url,h=null;if(u){var d=new u;h={signal:d.signal,timeout:setTimeout((()=>d.abort()),t.timeout)}}l(a,g({method:(null==t?void 0:t.method)||"GET",headers:o,keepalive:"POST"===t.method&&(n||0)<52428.8,body:s,signal:null==(e=h)?void 0:e.signal},t.fetchOptions)).then((i=>i.text().then((e=>{var r={statusCode:i.status,text:e};if(200===i.status)try{r.json=JSON.parse(e)}catch(t){xt.error(t)}null==t.callback||t.callback(r)})))).catch((i=>{xt.error(i),null==t.callback||t.callback({statusCode:0,text:i})})).finally((()=>h?clearTimeout(h.timeout):null))}}),h&&Zs.push({transport:"XHR",method:t=>{var i,e=new h;e.open(t.method||"GET",t.url,!0);var{contentType:r,body:s}=null!==(i=Qs(t))&&void 0!==i?i:{};Ct(t.headers,(function(t,i){e.setRequestHeader(i,t)})),r&&e.setRequestHeader("Content-Type",r),t.timeout&&(e.timeout=t.timeout),t.disableXHRCredentials||(e.withCredentials=!0),e.onreadystatechange=()=>{if(4===e.readyState){var i={statusCode:e.status,text:e.responseText};if(200===e.status)try{i.json=JSON.parse(e.responseText)}catch(t){}null==t.callback||t.callback(i)}},e.send(s)}}),null!=n&&n.sendBeacon&&Zs.push({transport:"sendBeacon",method:t=>{var i=Ys(t.url,{beacon:"1"});try{var e,{contentType:r,body:s}=null!==(e=Qs(t))&&void 0!==e?e:{},o="string"==typeof s?new Blob([s],{type:r}):s;n.sendBeacon(i,o)}catch(t){}}});var tn=function(t,i){if(!function(t){try{new RegExp(t)}catch(t){return!1}return!0}(i))return!1;try{return new RegExp(i).test(t)}catch(t){return!1}};function en(t,i,e){return Xs({distinct_id:t,userPropertiesToSet:i,userPropertiesToSetOnce:e})}var rn={exact:(t,i)=>i.some((i=>t.some((t=>i===t)))),is_not:(t,i)=>i.every((i=>t.every((t=>i!==t)))),regex:(t,i)=>i.some((i=>t.some((t=>tn(i,t))))),not_regex:(t,i)=>i.every((i=>t.every((t=>!tn(i,t))))),icontains:(t,i)=>i.map(sn).some((i=>t.map(sn).some((t=>i.includes(t))))),not_icontains:(t,i)=>i.map(sn).every((i=>t.map(sn).every((t=>!i.includes(t)))))},sn=t=>t.toLowerCase(),nn=Et("[Error tracking]");class on{constructor(t){var i,e;this.ge=[],this._e=new vt([new ct,new kt,new pt,new ft,new wt,new bt,new _t,new St],[nt,lt]),this._instance=t,this.ge=null!==(i=null==(e=this._instance.persistence)?void 0:e.get_property(Kt))&&void 0!==i?i:[]}onRemoteConfig(t){var i,e,r,s=null!==(i=null==(e=t.errorTracking)?void 0:e.suppressionRules)&&void 0!==i?i:[],n=null==(r=t.errorTracking)?void 0:r.captureExtensionExceptions;this.ge=s,this._instance.persistence&&this._instance.persistence.register({[Kt]:this.ge,[Yt]:n})}get me(){var t,i=!!this._instance.get_property(Yt),e=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=e?e:i)&&void 0!==t&&t}buildProperties(t,i){return this._e.buildFromUnknown(t,{syntheticException:null==i?void 0:i.syntheticException,mechanism:{handled:null==i?void 0:i.handled}})}sendExceptionEvent(t){if(this.ye(t))nn.info("Skipping exception capture because a suppression rule matched");else{if(this.me||!this.be(t))return this._instance.capture("$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent"});nn.info("Skipping exception capture because it was thrown by an extension")}}ye(t){var i=t.$exception_list;if(!i||!R(i)||0===i.length)return!1;var e=i.reduce(((t,i)=>{var{type:e,value:r}=i;return M(e)&&e.length>0&&t.$exception_types.push(e),M(r)&&r.length>0&&t.$exception_values.push(r),t}),{$exception_types:[],$exception_values:[]});return this.ge.some((t=>{var i=t.values.map((t=>{var i,r=rn[t.operator],s=R(t.value)?t.value:[t.value],n=null!==(i=e[t.key])&&void 0!==i?i:[];return s.length>0&&r(s,n)}));return"OR"===t.type?i.some(Boolean):i.every(Boolean)}))}be(t){var i=t.$exception_list;return!(!i||!R(i))&&i.flatMap((t=>{var i,e;return null!==(i=null==(e=t.stacktrace)?void 0:e.frames)&&void 0!==i?i:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}}var an="Mobile",ln="iOS",hn="Android",un="Tablet",dn=hn+" "+un,vn="iPad",cn="Apple",fn=cn+" Watch",pn="Safari",gn="BlackBerry",_n="Samsung",mn=_n+"Browser",yn=_n+" Internet",bn="Chrome",wn=bn+" OS",Sn=bn+" "+ln,kn="Internet Explorer",$n=kn+" "+an,xn="Opera",En=xn+" Mini",Rn="Edge",In="Microsoft "+Rn,Pn="Firefox",Tn=Pn+" "+ln,Cn="Nintendo",Mn="PlayStation",On="Xbox",Fn=hn+" "+an,An=an+" "+pn,Dn="Windows",jn=Dn+" Phone",Ln="Nokia",Nn="Ouya",Un="Generic",zn=Un+" "+an.toLowerCase(),Bn=Un+" "+un.toLowerCase(),qn="Konqueror",Hn="(\\d+(\\.\\d+)?)",Wn=new RegExp("Version/"+Hn),Gn=new RegExp(On,"i"),Vn=new RegExp(Mn+" \\w+","i"),Jn=new RegExp(Cn+" \\w+","i"),Kn=new RegExp(gn+"|PlayBook|BB10","i"),Yn={"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"};var Xn=(t,i)=>i&&y(i,cn)||function(t){return y(t,pn)&&!y(t,bn)&&!y(t,hn)}(t),Qn=function(t,i){return i=i||"",y(t," OPR/")&&y(t,"Mini")?En:y(t," OPR/")?xn:Kn.test(t)?gn:y(t,"IE"+an)||y(t,"WPDesktop")?$n:y(t,mn)?yn:y(t,Rn)||y(t,"Edg/")?In:y(t,"FBIOS")?"Facebook "+an:y(t,"UCWEB")||y(t,"UCBrowser")?"UC Browser":y(t,"CriOS")?Sn:y(t,"CrMo")||y(t,bn)?bn:y(t,hn)&&y(t,pn)?Fn:y(t,"FxiOS")?Tn:y(t.toLowerCase(),qn.toLowerCase())?qn:Xn(t,i)?y(t,an)?An:pn:y(t,Pn)?Pn:y(t,"MSIE")||y(t,"Trident/")?kn:y(t,"Gecko")?Pn:""},Zn={[$n]:[new RegExp("rv:"+Hn)],[In]:[new RegExp(Rn+"?\\/"+Hn)],[bn]:[new RegExp("("+bn+"|CrMo)\\/"+Hn)],[Sn]:[new RegExp("CriOS\\/"+Hn)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Hn)],[pn]:[Wn],[An]:[Wn],[xn]:[new RegExp("(Opera|OPR)\\/"+Hn)],[Pn]:[new RegExp(Pn+"\\/"+Hn)],[Tn]:[new RegExp("FxiOS\\/"+Hn)],[qn]:[new RegExp("Konqueror[:/]?"+Hn,"i")],[gn]:[new RegExp(gn+" "+Hn),Wn],[Fn]:[new RegExp("android\\s"+Hn,"i")],[yn]:[new RegExp(mn+"\\/"+Hn)],[kn]:[new RegExp("(rv:|MSIE )"+Hn)],Mozilla:[new RegExp("rv:"+Hn)]},to=function(t,i){var e=Qn(t,i),r=Zn[e];if(C(r))return null;for(var s=0;s<r.length;s++){var n=r[s],o=t.match(n);if(o)return parseFloat(o[o.length-2])}return null},io=[[new RegExp(On+"; "+On+" (.*?)[);]","i"),t=>[On,t&&t[1]||""]],[new RegExp(Cn,"i"),[Cn,""]],[new RegExp(Mn,"i"),[Mn,""]],[Kn,[gn,""]],[new RegExp(Dn,"i"),(t,i)=>{if(/Phone/.test(i)||/WPDesktop/.test(i))return[jn,""];if(new RegExp(an).test(i)&&!/IEMobile\b/.test(i))return[Dn+" "+an,""];var e=/Windows NT ([0-9.]+)/i.exec(i);if(e&&e[1]){var r=e[1],s=Yn[r]||"";return/arm/i.test(i)&&(s="RT"),[Dn,s]}return[Dn,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>{if(t&&t[3]){var i=[t[3],t[4],t[5]||"0"];return[ln,i.join(".")]}return[ln,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var i="";return t&&t.length>=3&&(i=C(t[2])?t[3]:t[2]),["watchOS",i]}],[new RegExp("("+hn+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+hn+")","i"),t=>{if(t&&t[2]){var i=[t[2],t[3],t[4]||"0"];return[hn,i.join(".")]}return[hn,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var i=["Mac OS X",""];if(t&&t[1]){var e=[t[1],t[2],t[3]||"0"];i[1]=e.join(".")}return i}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[wn,""]],[/Linux|debian/i,["Linux",""]]],eo=function(t){return Jn.test(t)?Cn:Vn.test(t)?Mn:Gn.test(t)?On:new RegExp(Nn,"i").test(t)?Nn:new RegExp("("+jn+"|WPDesktop)","i").test(t)?jn:/iPad/.test(t)?vn:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?fn:Kn.test(t)?gn:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Ln,"i").test(t)?Ln:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?!new RegExp(an).test(t)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)?/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?hn:dn:hn:new RegExp("(pda|"+an+")","i").test(t)?zn:new RegExp(un,"i").test(t)&&!new RegExp(un+" pc","i").test(t)?Bn:""},ro="https?://(.*)",so=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],no=Ot(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],so),oo="<masked>",ao=["li_fat_id"];function lo(t,i,e){if(!o)return{};var r,s=i?Ot([],so,e||[]):[],n=ho(ge(o.URL,s,oo),t),a=(r={},Ct(ao,(function(t){var i=Ae.J(t);r[t]=i||null})),r);return Mt(a,n)}function ho(t,i){var e=no.concat(i||[]),r={};return Ct(e,(function(i){var e=pe(t,i);r[i]=e||null})),r}function uo(t){var i=function(t){return t?0===t.search(ro+"google.([^/?]*)")?"google":0===t.search(ro+"bing.com")?"bing":0===t.search(ro+"yahoo.com")?"yahoo":0===t.search(ro+"duckduckgo.com")?"duckduckgo":null:null}(t),e="yahoo"!=i?"q":"p",r={};if(!F(i)){r.$search_engine=i;var s=o?pe(o.referrer,e):"";s.length&&(r.ph_keyword=s)}return r}function vo(){return navigator.language||navigator.userLanguage}function co(){return(null==o?void 0:o.referrer)||"$direct"}function fo(t,i){var e=t?Ot([],so,i||[]):[],r=null==a?void 0:a.href.substring(0,1e3);return{r:co().substring(0,1e3),u:r?ge(r,e,oo):void 0}}function po(t){var i,{r:e,u:r}=t,s={$referrer:e,$referring_domain:null==e?void 0:"$direct"==e?"$direct":null==(i=ce(e))?void 0:i.host};if(r){s.$current_url=r;var n=ce(r);s.$host=null==n?void 0:n.host,s.$pathname=null==n?void 0:n.pathname;var o=ho(r);Mt(s,o)}if(e){var a=uo(e);Mt(s,a)}return s}function go(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function _o(){try{return(new Date).getTimezoneOffset()}catch(t){return}}function mo(i,e){if(!d)return{};var r,s,n,o=i?Ot([],so,e||[]):[],[l,h]=function(t){for(var i=0;i<io.length;i++){var[e,r]=io[i],s=e.exec(t),n=s&&(I(r)?r(s,t):r);if(n)return n}return["",""]}(d);return Mt(jt({$os:l,$os_version:h,$browser:Qn(d,navigator.vendor),$device:eo(d),$device_type:(s=d,n=eo(s),n===vn||n===dn||"Kobo"===n||"Kindle Fire"===n||n===Bn?un:n===Cn||n===On||n===Mn||n===Nn?"Console":n===fn?"Wearable":n?an:"Desktop"),$timezone:go(),$timezone_offset:_o()}),{$current_url:ge(null==a?void 0:a.href,o,oo),$host:null==a?void 0:a.host,$pathname:null==a?void 0:a.pathname,$raw_user_agent:d.length>1e3?d.substring(0,997)+"...":d,$browser_version:to(d,navigator.vendor),$browser_language:vo(),$browser_language_prefix:(r=vo(),"string"==typeof r?r.split("-")[0]:void 0),$screen_height:null==t?void 0:t.screen.height,$screen_width:null==t?void 0:t.screen.width,$viewport_height:null==t?void 0:t.innerHeight,$viewport_width:null==t?void 0:t.innerWidth,$lib:"web",$lib_version:c.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var yo=Et("[FeatureFlags]"),bo="$active_feature_flags",wo="$override_feature_flags",So="$feature_flag_payloads",ko="$override_feature_flag_payloads",$o="$feature_flag_request_id",xo=t=>{var i={};for(var[e,r]of Ft(t||{}))r&&(i[e]=r);return i},Eo=t=>{var i=t.flags;return i?(t.featureFlags=Object.fromEntries(Object.keys(i).map((t=>{var e;return[t,null!==(e=i[t].variant)&&void 0!==e?e:i[t].enabled]}))),t.featureFlagPayloads=Object.fromEntries(Object.keys(i).filter((t=>i[t].enabled)).filter((t=>{var e;return null==(e=i[t].metadata)?void 0:e.payload})).map((t=>{var e;return[t,null==(e=i[t].metadata)?void 0:e.payload]})))):yo.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t},Ro=function(t){return t.FeatureFlags="feature_flags",t.Recordings="recordings",t}({});class Io{constructor(t){this.we=!1,this.Se=!1,this.ke=!1,this.$e=!1,this.xe=!1,this.Ee=!1,this.Re=!1,this._instance=t,this.featureFlagEventHandlers=[]}Ie(){var t=this._instance.config.evaluation_environments;return null!=t&&t.length?t.filter((t=>{var i=t&&"string"==typeof t&&t.trim().length>0;return i||yo.error("Invalid evaluation environment found:",t,"Expected non-empty string"),i})):[]}Pe(){return this.Ie().length>0}flags(){if(this._instance.config.__preview_remote_config)this.Ee=!0;else{var t=!this.Te&&(this._instance.config.advanced_disable_feature_flags||this._instance.config.advanced_disable_feature_flags_on_first_load);this.Ce({disableFlags:t})}}get hasLoadedFlags(){return this.Se}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this._instance.get_property(pi),i=this._instance.get_property(wo),e=this._instance.get_property(ko);if(!e&&!i)return t||{};var r=Mt({},t||{}),s=[...new Set([...Object.keys(e||{}),...Object.keys(i||{})])];for(var n of s){var o,a,l=r[n],h=null==i?void 0:i[n],u=C(h)?null!==(o=null==l?void 0:l.enabled)&&void 0!==o&&o:!!h,d=C(h)?l.variant:"string"==typeof h?h:void 0,v=null==e?void 0:e[n],c=g({},l,{enabled:u,variant:u?null!=d?d:null==l?void 0:l.variant:void 0});if(u!==(null==l?void 0:l.enabled)&&(c.original_enabled=null==l?void 0:l.enabled),d!==(null==l?void 0:l.variant)&&(c.original_variant=null==l?void 0:l.variant),v)c.metadata=g({},null==l?void 0:l.metadata,{payload:v,original_payload:null==l||null==(a=l.metadata)?void 0:a.payload});r[n]=c}return this.we||(yo.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:e,finalDetails:r}),this.we=!0),r}getFlagVariants(){var t=this._instance.get_property(ci),i=this._instance.get_property(wo);if(!i)return t||{};for(var e=Mt({},t),r=Object.keys(i),s=0;s<r.length;s++)e[r[s]]=i[r[s]];return this.we||(yo.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:i,finalFlags:e}),this.we=!0),e}getFlagPayloads(){var t=this._instance.get_property(So),i=this._instance.get_property(ko);if(!i)return t||{};for(var e=Mt({},t||{}),r=Object.keys(i),s=0;s<r.length;s++)e[r[s]]=i[r[s]];return this.we||(yo.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:i,finalPayloads:e}),this.we=!0),e}reloadFeatureFlags(){this.$e||this._instance.config.advanced_disable_feature_flags||this.Te||(this.Te=setTimeout((()=>{this.Ce()}),5))}Me(){clearTimeout(this.Te),this.Te=void 0}ensureFlagsLoaded(){this.Se||this.ke||this.Te||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.$e=t}Ce(t){var i;if(this.Me(),!this._instance.L())if(this.ke)this.xe=!0;else{var e={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:g({},(null==(i=this._instance.persistence)?void 0:i.get_initial_props())||{},this._instance.get_property(gi)||{}),group_properties:this._instance.get_property(_i)};(null!=t&&t.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(e.disable_flags=!0),this.Pe()&&(e.evaluation_environments=this.Ie());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":"",o=this._instance.requestRouter.endpointFor("api",s+n);r&&(e.timezone=go()),this.ke=!0,this._instance.Oe({method:"POST",url:o,data:e,compression:this._instance.config.disable_compression?void 0:de.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:t=>{var i,r,s=!0;(200===t.statusCode&&(this.xe||(this.$anon_distinct_id=void 0),s=!1),this.ke=!1,this.Ee)||(this.Ee=!0,this._instance.Fe(null!==(r=t.json)&&void 0!==r?r:{}));if(!e.disable_flags||this.xe)if(this.Re=!s,t.json&&null!=(i=t.json.quotaLimited)&&i.includes(Ro.FeatureFlags))yo.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;if(!e.disable_flags)this.receivedFeatureFlags(null!==(n=t.json)&&void 0!==n?n:{},s);this.xe&&(this.xe=!1,this.Ce())}}})}}getFeatureFlag(t,i){if(void 0===i&&(i={}),this.Se||this.getFlags()&&this.getFlags().length>0){var e=this.getFlagVariants()[t],r=""+e,s=this._instance.get_property($o)||void 0,n=this._instance.get_property(bi)||{};if((i.send_event||!("send_event"in i))&&(!(t in n)||!n[t].includes(r))){var o,a,l,h,u,d,v,c,f;R(n[t])?n[t].push(r):n[t]=[r],null==(o=this._instance.persistence)||o.register({[bi]:n});var p=this.getFeatureFlagDetails(t),g={$feature_flag:t,$feature_flag_response:e,$feature_flag_payload:this.getFeatureFlagPayload(t)||null,$feature_flag_request_id:s,$feature_flag_bootstrapped_response:(null==(a=this._instance.config.bootstrap)||null==(a=a.featureFlags)?void 0:a[t])||null,$feature_flag_bootstrapped_payload:(null==(l=this._instance.config.bootstrap)||null==(l=l.featureFlagPayloads)?void 0:l[t])||null,$used_bootstrap_value:!this.Re};C(null==p||null==(h=p.metadata)?void 0:h.version)||(g.$feature_flag_version=p.metadata.version);var _,m=null!==(u=null==p||null==(d=p.reason)?void 0:d.description)&&void 0!==u?u:null==p||null==(v=p.reason)?void 0:v.code;if(m&&(g.$feature_flag_reason=m),null!=p&&null!=(c=p.metadata)&&c.id&&(g.$feature_flag_id=p.metadata.id),C(null==p?void 0:p.original_variant)&&C(null==p?void 0:p.original_enabled)||(g.$feature_flag_original_response=C(p.original_variant)?p.original_enabled:p.original_variant),null!=p&&null!=(f=p.metadata)&&f.original_payload)g.$feature_flag_original_payload=null==p||null==(_=p.metadata)?void 0:_.original_payload;this._instance.capture("$feature_flag_called",g)}return e}yo.warn('getFeatureFlag for key "'+t+"\" failed. Feature flags didn't load in time.")}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){return this.getFlagPayloads()[t]}getRemoteConfigPayload(t,i){var e=this._instance.config.token,r={distinct_id:this._instance.get_distinct_id(),token:e};this.Pe()&&(r.evaluation_environments=this.Ie()),this._instance.Oe({method:"POST",url:this._instance.requestRouter.endpointFor("api","/flags/?v=2&config=true"),data:r,compression:this._instance.config.disable_compression?void 0:de.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:e=>{var r,s=null==(r=e.json)?void 0:r.featureFlagPayloads;i((null==s?void 0:s[t])||void 0)}})}isFeatureEnabled(t,i){if(void 0===i&&(i={}),this.Se||this.getFlags()&&this.getFlags().length>0){var e=this.getFeatureFlag(t,i);return C(e)?void 0:!!e}yo.warn('isFeatureEnabled for key "'+t+"\" failed. Feature flags didn't load in time.")}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((i=>i!==t))}receivedFeatureFlags(t,i){if(this._instance.persistence){this.Se=!0;var e=this.getFlagVariants(),r=this.getFlagPayloads(),s=this.getFlagsWithDetails();!function(t,i,e,r,s){void 0===e&&(e={}),void 0===r&&(r={}),void 0===s&&(s={});var n=Eo(t),o=n.flags,a=n.featureFlags,l=n.featureFlagPayloads;if(a){var h=t.requestId;if(R(a)){yo.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var u={};if(a)for(var d=0;d<a.length;d++)u[a[d]]=!0;i&&i.register({[bo]:a,[ci]:u})}else{var v=a,c=l,f=o;t.errorsWhileComputingFlags&&(v=g({},e,v),c=g({},r,c),f=g({},s,f)),i&&i.register(g({[bo]:Object.keys(xo(v)),[ci]:v||{},[So]:c||{},[pi]:f||{}},h?{[$o]:h}:{}))}}}(t,this._instance.persistence,e,r,s),this.Ae(i)}}override(t,i){void 0===i&&(i=!1),yo.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:i})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this._instance.persistence)return yo.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===t)return this._instance.persistence.unregister(wo),this._instance.persistence.unregister(ko),void this.Ae();if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i,e=t;if(this.we=Boolean(null!==(i=e.suppressWarning)&&void 0!==i&&i),"flags"in e)if(!1===e.flags)this._instance.persistence.unregister(wo);else if(e.flags)if(R(e.flags)){for(var r={},s=0;s<e.flags.length;s++)r[e.flags[s]]=!0;this._instance.persistence.register({[wo]:r})}else this._instance.persistence.register({[wo]:e.flags});return"payloads"in e&&(!1===e.payloads?this._instance.persistence.unregister(ko):e.payloads&&this._instance.persistence.register({[ko]:e.payloads})),void this.Ae()}this.Ae()}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.Se){var{flags:i,flagVariants:e}=this.De();t(i,e)}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,i,e){var r,s=(this._instance.get_property(fi)||[]).find((i=>i.flagKey===t)),n={["$feature_enrollment/"+t]:i},o={$feature_flag:t,$feature_enrollment:i,$set:n};s&&(o.$early_access_feature_name=s.name),e&&(o.$feature_enrollment_stage=e),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(n,!1);var a=g({},this.getFlagVariants(),{[t]:i});null==(r=this._instance.persistence)||r.register({[bo]:Object.keys(xo(a)),[ci]:a}),this.Ae()}getEarlyAccessFeatures(t,i,e){void 0===i&&(i=!1);var r=this._instance.get_property(fi),s=e?"&"+e.map((t=>"stage="+t)).join("&"):"";if(r&&!i)return t(r);this._instance.Oe({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+s),method:"GET",callback:i=>{var e,r;if(i.json){var s=i.json.earlyAccessFeatures;return null==(e=this._instance.persistence)||e.unregister(fi),null==(r=this._instance.persistence)||r.register({[fi]:s}),t(s)}}})}De(){var t=this.getFlags(),i=this.getFlagVariants();return{flags:t.filter((t=>i[t])),flagVariants:Object.keys(i).filter((t=>i[t])).reduce(((t,e)=>(t[e]=i[e],t)),{})}}Ae(t){var{flags:i,flagVariants:e}=this.De();this.featureFlagEventHandlers.forEach((r=>r(i,e,{errorsLoading:t})))}setPersonPropertiesForFlags(t,i){void 0===i&&(i=!0);var e=this._instance.get_property(gi)||{};this._instance.register({[gi]:g({},e,t)}),i&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(gi)}setGroupPropertiesForFlags(t,i){void 0===i&&(i=!0);var e=this._instance.get_property(_i)||{};0!==Object.keys(e).length&&Object.keys(e).forEach((i=>{e[i]=g({},e[i],t[i]),delete t[i]})),this._instance.register({[_i]:g({},e,t)}),i&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var i=this._instance.get_property(_i)||{};this._instance.register({[_i]:g({},i,{[t]:{}})})}else this._instance.unregister(_i)}reset(){this.Se=!1,this.ke=!1,this.$e=!1,this.xe=!1,this.Ee=!1,this.Re=!1,this.$anon_distinct_id=void 0,this.Me(),this.we=!1}}var Po=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class To{constructor(t,i){this.A=t,this.props={},this.je=!1,this.Le=(t=>{var i="";return t.token&&(i=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+i+"_posthog"})(t),this.it=this.Ne(t),this.load(),t.debug&&xt.info("Persistence loaded",t.persistence,g({},this.props)),this.update_config(t,t,i),this.save()}isDisabled(){return!!this.Ue}Ne(t){-1===Po.indexOf(t.persistence.toLowerCase())&&(xt.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var i=t.persistence.toLowerCase();return"localstorage"===i&&je.G()?je:"localstorage+cookie"===i&&Ne.G()?Ne:"sessionstorage"===i&&qe.G()?qe:"memory"===i?ze:"cookie"===i?Ae:Ne.G()?Ne:Ae}properties(){var t={};return Ct(this.props,(function(i,e){if(e===ci&&P(i))for(var r=Object.keys(i),n=0;n<r.length;n++)t["$feature/"+r[n]]=i[r[n]];else a=e,l=!1,(F(o=Ti)?l:s&&o.indexOf===s?-1!=o.indexOf(a):(Ct(o,(function(t){if(l||(l=t===a))return Pt})),l))||(t[e]=i);var o,a,l})),t}load(){if(!this.Ue){var t=this.it.K(this.Le);t&&(this.props=Mt({},t))}}save(){this.Ue||this.it.Y(this.Le,this.props,this.ze,this.Be,this.qe,this.A.debug)}remove(){this.it.X(this.Le,!1),this.it.X(this.Le,!0)}clear(){this.remove(),this.props={}}register_once(t,i,e){if(P(t)){C(i)&&(i="None"),this.ze=C(e)?this.He:e;var r=!1;if(Ct(t,((t,e)=>{this.props.hasOwnProperty(e)&&this.props[e]!==i||(this.props[e]=t,r=!0)})),r)return this.save(),!0}return!1}register(t,i){if(P(t)){this.ze=C(i)?this.He:i;var e=!1;if(Ct(t,((i,r)=>{t.hasOwnProperty(r)&&this.props[r]!==i&&(this.props[r]=i,e=!0)})),e)return this.save(),!0}return!1}unregister(t){t in this.props&&(delete this.props[t],this.save())}update_campaign_params(){if(!this.je){var t=lo(this.A.custom_campaign_params,this.A.mask_personal_data_properties,this.A.custom_personal_data_properties);T(jt(t))||this.register(t),this.je=!0}}update_search_keyword(){var t;this.register((t=null==o?void 0:o.referrer)?uo(t):{})}update_referrer_info(){var t;this.register_once({$referrer:co(),$referring_domain:null!=o&&o.referrer&&(null==(t=ce(o.referrer))?void 0:t.host)||"$direct"},void 0)}set_initial_person_info(){this.props[$i]||this.props[xi]||this.register_once({[Ei]:fo(this.A.mask_personal_data_properties,this.A.custom_personal_data_properties)},void 0)}get_initial_props(){var t={};Ct([xi,$i],(i=>{var e=this.props[i];e&&Ct(e,(function(i,e){t["$initial_"+w(e)]=i}))}));var i,e,r=this.props[Ei];if(r){var s=(i=po(r),e={},Ct(i,(function(t,i){e["$initial_"+w(i)]=t})),e);Mt(t,s)}return t}safe_merge(t){return Ct(this.props,(function(i,e){e in t||(t[e]=i)})),t}update_config(t,i,e){if(this.He=this.ze=t.cookie_expiration,this.set_disabled(t.disable_persistence||!!e),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),t.persistence!==i.persistence){var r=this.Ne(t),s=this.props;this.clear(),this.it=r,this.props=s,this.save()}}set_disabled(t){this.Ue=t,this.Ue?this.remove():this.save()}set_cross_subdomain(t){t!==this.Be&&(this.Be=t,this.remove(),this.save())}set_secure(t){t!==this.qe&&(this.qe=t,this.remove(),this.save())}set_event_timer(t,i){var e=this.props[Wt]||{};e[t]=i,this.props[Wt]=e,this.save()}remove_event_timer(t){var i=(this.props[Wt]||{})[t];return C(i)||(delete this.props[Wt][t],this.save()),i}get_property(t){return this.props[t]}set_property(t,i){this.props[t]=i,this.save()}}var Co=function(t){return t.Popover="popover",t.API="api",t.Widget="widget",t.ExternalSurvey="external_survey",t}({}),Mo=function(t){return t.SHOWN="survey shown",t.DISMISSED="survey dismissed",t.SENT="survey sent",t}({}),Oo=function(t){return t.SURVEY_ID="$survey_id",t.SURVEY_NAME="$survey_name",t.SURVEY_RESPONSE="$survey_response",t.SURVEY_ITERATION="$survey_iteration",t.SURVEY_ITERATION_START_DATE="$survey_iteration_start_date",t.SURVEY_PARTIALLY_COMPLETED="$survey_partially_completed",t.SURVEY_SUBMISSION_ID="$survey_submission_id",t.SURVEY_QUESTIONS="$survey_questions",t.SURVEY_COMPLETED="$survey_completed",t}({}),Fo=function(t){return t.Popover="popover",t.Inline="inline",t}({});class Ao{constructor(){this.We={},this.We={}}on(t,i){return this.We[t]||(this.We[t]=[]),this.We[t].push(i),()=>{this.We[t]=this.We[t].filter((t=>t!==i))}}emit(t,i){for(var e of this.We[t]||[])e(i);for(var r of this.We["*"]||[])r(t,i)}}class Do{constructor(t){this.Ge=new Ao,this.Ve=(t,i)=>this.Je(t,i)&&this.Ke(t,i)&&this.Ye(t,i),this.Je=(t,i)=>null==i||!i.event||(null==t?void 0:t.event)===(null==i?void 0:i.event),this._instance=t,this.Xe=new Set,this.Qe=new Set}init(){var t;if(!C(null==(t=this._instance)?void 0:t.Ze)){var i;null==(i=this._instance)||i.Ze(((t,i)=>{this.on(t,i)}))}}register(t){var i,e;if(!C(null==(i=this._instance)?void 0:i.Ze)&&(t.forEach((t=>{var i,e;null==(i=this.Qe)||i.add(t),null==(e=t.steps)||e.forEach((t=>{var i;null==(i=this.Xe)||i.add((null==t?void 0:t.event)||"")}))})),null!=(e=this._instance)&&e.autocapture)){var r,s=new Set;t.forEach((t=>{var i;null==(i=t.steps)||i.forEach((t=>{null!=t&&t.selector&&s.add(null==t?void 0:t.selector)}))})),null==(r=this._instance)||r.autocapture.setElementSelectors(s)}}on(t,i){var e;null!=i&&0!=t.length&&(this.Xe.has(t)||this.Xe.has(null==i?void 0:i.event))&&this.Qe&&(null==(e=this.Qe)?void 0:e.size)>0&&this.Qe.forEach((t=>{this.tr(i,t)&&this.Ge.emit("actionCaptured",t.name)}))}ir(t){this.onAction("actionCaptured",(i=>t(i)))}tr(t,i){if(null==(null==i?void 0:i.steps))return!1;for(var e of i.steps)if(this.Ve(t,e))return!0;return!1}onAction(t,i){return this.Ge.on(t,i)}Ke(t,i){if(null!=i&&i.url){var e,r=null==t||null==(e=t.properties)?void 0:e.$current_url;if(!r||"string"!=typeof r)return!1;if(!Do.er(r,null==i?void 0:i.url,(null==i?void 0:i.url_matching)||"contains"))return!1}return!0}static er(i,e,r){switch(r){case"regex":return!!t&&tn(i,e);case"exact":return e===i;case"contains":var s=Do.rr(e).replace(/_/g,".").replace(/%/g,".*");return tn(i,s);default:return!1}}static rr(t){return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}Ye(t,i){if((null!=i&&i.href||null!=i&&i.tag_name||null!=i&&i.text)&&!this.sr(t).some((t=>!(null!=i&&i.href&&!Do.er(t.href||"",null==i?void 0:i.href,(null==i?void 0:i.href_matching)||"exact"))&&((null==i||!i.tag_name||t.tag_name===(null==i?void 0:i.tag_name))&&!(null!=i&&i.text&&!Do.er(t.text||"",null==i?void 0:i.text,(null==i?void 0:i.text_matching)||"exact")&&!Do.er(t.$el_text||"",null==i?void 0:i.text,(null==i?void 0:i.text_matching)||"exact"))))))return!1;if(null!=i&&i.selector){var e,r=null==t||null==(e=t.properties)?void 0:e.$element_selectors;if(!r)return!1;if(!r.includes(null==i?void 0:i.selector))return!1}return!0}sr(t){return null==(null==t?void 0:t.properties.$elements)?[]:null==t?void 0:t.properties.$elements}}var jo=Et("[Surveys]");var Lo="seenSurvey_",No=(t,i)=>{var e="$survey_"+i+"/"+t.id;return t.current_iteration&&t.current_iteration>0&&(e="$survey_"+i+"/"+t.id+"/"+t.current_iteration),e},Uo=t=>{var i=""+Lo+t.id;return t.current_iteration&&t.current_iteration>0&&(i=""+Lo+t.id+"_"+t.current_iteration),i},zo=[Co.Popover,Co.Widget,Co.API],Bo={ignoreConditions:!1,ignoreDelay:!1,displayType:Fo.Popover};class qo{constructor(t){this._instance=t,this.nr=new Map,this.ar=new Map}register(t){var i;C(null==(i=this._instance)?void 0:i.Ze)||(this.lr(t),this.hr(t))}hr(t){var i=t.filter((t=>{var i,e;return(null==(i=t.conditions)?void 0:i.actions)&&(null==(e=t.conditions)||null==(e=e.actions)||null==(e=e.values)?void 0:e.length)>0}));if(0!==i.length){if(null==this.ur){this.ur=new Do(this._instance),this.ur.init();this.ur.ir((t=>{this.onAction(t)}))}i.forEach((t=>{var i,e,r,s,n;t.conditions&&null!=(i=t.conditions)&&i.actions&&null!=(e=t.conditions)&&null!=(e=e.actions)&&e.values&&(null==(r=t.conditions)||null==(r=r.actions)||null==(r=r.values)?void 0:r.length)>0&&(null==(s=this.ur)||s.register(t.conditions.actions.values),null==(n=t.conditions)||null==(n=n.actions)||null==(n=n.values)||n.forEach((i=>{if(i&&i.name){var e=this.ar.get(i.name);e&&e.push(t.id),this.ar.set(i.name,e||[t.id])}})))}))}}lr(t){var i;if(0!==t.filter((t=>{var i,e;return(null==(i=t.conditions)?void 0:i.events)&&(null==(e=t.conditions)||null==(e=e.events)||null==(e=e.values)?void 0:e.length)>0})).length){null==(i=this._instance)||i.Ze(((t,i)=>{this.onEvent(t,i)})),t.forEach((t=>{var i;null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)||i.forEach((i=>{if(i&&i.name){var e=this.nr.get(i.name);e&&e.push(t.id),this.nr.set(i.name,e||[t.id])}}))}))}}onEvent(t,i){var e,r,s=(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[yi])||[];if(Mo.SHOWN===t&&i&&s.length>0){var n;jo.info("survey event matched, removing survey from activated surveys",{event:t,eventPayload:i,existingActivatedSurveys:s});var o=null==i||null==(n=i.properties)?void 0:n.$survey_id;if(o){var a=s.indexOf(o);a>=0&&(s.splice(a,1),this.dr(s))}}else if(this.nr.has(t)){jo.info("survey event name matched",{event:t,eventPayload:i,surveys:this.nr.get(t)});var l=[];null==(r=this._instance)||r.getSurveys((i=>{l=i.filter((i=>{var e;return null==(e=this.nr.get(t))?void 0:e.includes(i.id)}))}));var h=l.filter((e=>{var r,s=null==(r=e.conditions)||null==(r=r.events)||null==(r=r.values)?void 0:r.find((i=>i.name===t));return!!s&&(!s.propertyFilters||Object.entries(s.propertyFilters).every((t=>{var e,[r,s]=t,n=null==i||null==(e=i.properties)?void 0:e[r];if(C(n)||F(n))return!1;var o=[String(n)],a=rn[s.operator];return a?a(s.values,o):(jo.warn("Unknown property comparison operator: "+s.operator),!1)})))}));this.dr(s.concat(h.map((t=>t.id))||[]))}}onAction(t){var i,e=(null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[yi])||[];this.ar.has(t)&&this.dr(e.concat(this.ar.get(t)||[]))}dr(t){var i;jo.info("updating activated surveys",{activatedSurveys:t}),null==(i=this._instance)||null==(i=i.persistence)||i.register({[yi]:[...new Set(t)]})}getSurveys(){var t,i=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[yi];return i||[]}getEventToSurveys(){return this.nr}vr(){return this.ur}}class Ho{constructor(t){this.cr=void 0,this._surveyManager=null,this.pr=!1,this.gr=!1,this._r=[],this._instance=t,this._surveyEventReceiver=null}onRemoteConfig(t){if(!this._instance.config.disable_surveys){var i=t.surveys;if(A(i))return jo.warn("Flags not loaded yet. Not loading surveys.");var e=R(i);this.cr=e?i.length>0:i,jo.info("flags response received, isSurveysEnabled: "+this.cr),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var t=[],i=0;i<localStorage.length;i++){var e=localStorage.key(i);(null!=e&&e.startsWith(Lo)||null!=e&&e.startsWith("inProgressSurvey_"))&&t.push(e)}t.forEach((t=>localStorage.removeItem(t)))}loadIfEnabled(){if(!this._surveyManager)if(this.gr)jo.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)jo.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())jo.info("Not loading surveys in cookieless mode without consent.");else{var t=null==v?void 0:v.__PosthogExtensions__;if(t){if(!C(this.cr)||this._instance.config.advanced_enable_surveys){var i=this.cr||this._instance.config.advanced_enable_surveys;this.gr=!0;try{var e=t.generateSurveys;if(e)return void this.mr(e,i);var r=t.loadExternalDependency;if(!r)return void this.yr("PostHog loadExternalDependency extension not found.");r(this._instance,"surveys",(e=>{e||!t.generateSurveys?this.yr("Could not load surveys script",e):this.mr(t.generateSurveys,i)}))}catch(t){throw this.yr("Error initializing surveys",t),t}finally{this.gr=!1}}}else jo.error("PostHog Extensions not found.")}}mr(t,i){this._surveyManager=t(this._instance,i),this._surveyEventReceiver=new qo(this._instance),jo.info("Surveys loaded successfully"),this.br({isLoaded:!0})}yr(t,i){jo.error(t,i),this.br({isLoaded:!1,error:t})}onSurveysLoaded(t){return this._r.push(t),this._surveyManager&&this.br({isLoaded:!0}),()=>{this._r=this._r.filter((i=>i!==t))}}getSurveys(t,i){if(void 0===i&&(i=!1),this._instance.config.disable_surveys)return jo.info("Disabled. Not loading surveys."),t([]);var e=this._instance.get_property(mi);if(e&&!i)return t(e,{isLoaded:!0});if(this.pr)return t([],{isLoaded:!1,error:"Surveys are already being loaded"});try{this.pr=!0,this._instance.Oe({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:i=>{var e;this.pr=!1;var r=i.statusCode;if(200!==r||!i.json){var s="Surveys API could not be loaded, status: "+r;return jo.error(s),t([],{isLoaded:!1,error:s})}var n,o=i.json.surveys||[],a=o.filter((t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(function(t){var i;return!(null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)||!i.length)}(t)||function(t){var i;return!(null==(i=t.conditions)||null==(i=i.actions)||null==(i=i.values)||!i.length)}(t))));a.length>0&&(null==(n=this._surveyEventReceiver)||n.register(a));return null==(e=this._instance.persistence)||e.register({[mi]:o}),t(o,{isLoaded:!0})}})}catch(t){throw this.pr=!1,t}}br(t){for(var i of this._r)try{if(!t.isLoaded)return i([],t);this.getSurveys(i)}catch(t){jo.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,i){if(void 0===i&&(i=!1),!A(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,i);jo.warn("init was not called")}wr(t){var i=null;return this.getSurveys((e=>{var r;i=null!==(r=e.find((i=>i.id===t)))&&void 0!==r?r:null})),i}Sr(t){if(A(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var i="string"==typeof t?this.wr(t):t;return i?this._surveyManager.checkSurveyEligibility(i):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(A(this._surveyManager))return jo.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var i=this.Sr(t);return{visible:i.eligible,disabledReason:i.reason}}canRenderSurveyAsync(t,i){return A(this._surveyManager)?(jo.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise((e=>{this.getSurveys((i=>{var r,s=null!==(r=i.find((i=>i.id===t)))&&void 0!==r?r:null;if(s){var n=this.Sr(s);e({visible:n.eligible,disabledReason:n.reason})}else e({visible:!1,disabledReason:"Survey not found"})}),i)}))}renderSurvey(t,i){var e;if(A(this._surveyManager))jo.warn("init was not called");else{var r="string"==typeof t?this.wr(t):t;if(null!=r&&r.id)if(zo.includes(r.type)){var s=null==o?void 0:o.querySelector(i);if(s)return null!=(e=r.appearance)&&e.surveyPopupDelaySeconds?(jo.info("Rendering survey "+r.id+" with delay of "+r.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var t,i;jo.info("Rendering survey "+r.id+" with delay of "+(null==(t=r.appearance)?void 0:t.surveyPopupDelaySeconds)+" seconds"),null==(i=this._surveyManager)||i.renderSurvey(r,s),jo.info("Survey "+r.id+" rendered")}),1e3*r.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(r,s);jo.warn("Survey element not found")}else jo.warn("Surveys of type "+r.type+" cannot be rendered in the app");else jo.warn("Survey not found")}}displaySurvey(t,i){var e;if(A(this._surveyManager))jo.warn("init was not called");else{var r=this.wr(t);if(r){var s=r;if(null!=(e=r.appearance)&&e.surveyPopupDelaySeconds&&i.ignoreDelay&&(s=g({},r,{appearance:g({},r.appearance,{surveyPopupDelaySeconds:0})})),!1===i.ignoreConditions){var n=this.canRenderSurvey(r);if(!n.visible)return void jo.warn("Survey is not eligible to be displayed: ",n.disabledReason)}i.displayType!==Fo.Inline?this._surveyManager.handlePopoverSurvey(s):this.renderSurvey(s,i.selector)}else jo.warn("Survey not found")}}}var Wo=Et("[RateLimiter]");class Go{constructor(t){var i,e;this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var i=t.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach((t=>{Wo.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void Wo.warn('could not rate limit - continuing. Error: "'+(null==t?void 0:t.message)+'"',{text:i})}},this.instance=t,this.captureEventsPerSecond=(null==(i=t.config.rate_limiting)?void 0:i.events_per_second)||10,this.captureEventsBurstLimit=Math.max((null==(e=t.config.rate_limiting)?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(t){var i,e,r;void 0===t&&(t=!1);var s=(new Date).getTime(),n=null!==(i=null==(e=this.instance.persistence)?void 0:e.get_property(ki))&&void 0!==i?i:{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 o=n.tokens<1;return o||t||(n.tokens=Math.max(0,n.tokens-1)),!o||this.lastEventRateLimited||t||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=o,null==(r=this.instance.persistence)||r.set_property(ki,n),{isRateLimited:o,remainingTokens:n.tokens}}isServerRateLimited(t){var i=this.serverLimits[t||"events"]||!1;return!1!==i&&(new Date).getTime()<i}}var Vo=Et("[RemoteConfig]");class Jo{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=v._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}kr(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.loadExternalDependency?null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):(Vo.error("PostHog Extensions not found. Cannot load remote config."),t())}$r(t){this._instance.Oe({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:i=>{t(i.json)}})}load(){try{if(this.remoteConfig)return Vo.info("Using preloaded remote config",this.remoteConfig),void this.Fe(this.remoteConfig);if(this._instance.L())return void Vo.warn("Remote config is disabled. Falling back to local config.");this.kr((t=>{if(!t)return Vo.info("No config found after loading remote JS config. Falling back to JSON."),void this.$r((t=>{this.Fe(t)}));this.Fe(t)}))}catch(t){Vo.error("Error loading remote config",t)}}Fe(t){t?this._instance.config.__preview_remote_config?(this._instance.Fe(t),!1!==t.hasFeatureFlags&&this._instance.featureFlags.ensureFlagsLoaded()):Vo.info("__preview_remote_config is disabled. Logging config instead",t):Vo.error("Failed to fetch remote config from PostHog.")}}var Ko=3e3;class Yo{constructor(t,i){this.Er=!0,this.Rr=[],this.Ir=G((null==i?void 0:i.flush_interval_ms)||Ko,250,5e3,xt.createLogger("flush interval"),Ko),this.Pr=t}enqueue(t){this.Rr.push(t),this.Tr||this.Cr()}unload(){this.Mr();var t=this.Rr.length>0?this.Or():{},i=Object.values(t);[...i.filter((t=>0===t.url.indexOf("/e"))),...i.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.Pr(g({},t,{transport:"sendBeacon"}))}))}enable(){this.Er=!1,this.Cr()}Cr(){var t=this;this.Er||(this.Tr=setTimeout((()=>{if(this.Mr(),this.Rr.length>0){var i=this.Or(),e=function(){var e=i[r],s=(new Date).getTime();e.data&&R(e.data)&&Ct(e.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.Pr(e)};for(var r in i)e()}}),this.Ir))}Mr(){clearTimeout(this.Tr),this.Tr=void 0}Or(){var t={};return Ct(this.Rr,(i=>{var e,r=i,s=(r?r.batchKey:null)||r.url;C(t[s])&&(t[s]=g({},r,{data:[]})),null==(e=t[s].data)||e.push(r.data)})),this.Rr=[],t}}var Xo=["retriesPerformedSoFar"];class Qo{constructor(i){this.Fr=!1,this.Ar=3e3,this.Rr=[],this._instance=i,this.Rr=[],this.Dr=!0,!C(t)&&"onLine"in t.navigator&&(this.Dr=t.navigator.onLine,Bt(t,"online",(()=>{this.Dr=!0,this.oe()})),Bt(t,"offline",(()=>{this.Dr=!1})))}get length(){return this.Rr.length}retriableRequest(t){var{retriesPerformedSoFar:i}=t,e=_(t,Xo);D(i)&&i>0&&(e.url=Ys(e.url,{retry_count:i})),this._instance.Oe(g({},e,{callback:t=>{200!==t.statusCode&&(t.statusCode<400||t.statusCode>=500)&&(null!=i?i:0)<10?this.jr(g({retriesPerformedSoFar:i},e)):null==e.callback||e.callback(t)}}))}jr(t){var i=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=i+1;var e=function(t){var i=3e3*Math.pow(2,t),e=i/2,r=Math.min(18e5,i),s=(Math.random()-.5)*(r-e);return Math.ceil(r+s)}(i),r=Date.now()+e;this.Rr.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+e;navigator.onLine||(s+=" (Browser is offline)"),xt.warn(s),this.Fr||(this.Fr=!0,this.Lr())}Lr(){this.Nr&&clearTimeout(this.Nr),this.Nr=setTimeout((()=>{this.Dr&&this.Rr.length>0&&this.oe(),this.Lr()}),this.Ar)}oe(){var t=Date.now(),i=[],e=this.Rr.filter((e=>e.retryAt<t||(i.push(e),!1)));if(this.Rr=i,e.length>0)for(var{requestOptions:r}of e)this.retriableRequest(r)}unload(){for(var{requestOptions:t}of(this.Nr&&(clearTimeout(this.Nr),this.Nr=void 0),this.Rr))try{this._instance.Oe(g({},t,{transport:"sendBeacon"}))}catch(t){xt.error(t)}this.Rr=[]}}class Zo{constructor(t){this.Ur=()=>{var t,i,e,r;this.zr||(this.zr={});var s=this.scrollElement(),n=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=n+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;this.zr.lastScrollY=Math.ceil(n),this.zr.maxScrollY=Math.max(n,null!==(t=this.zr.maxScrollY)&&void 0!==t?t:0),this.zr.maxScrollHeight=Math.max(o,null!==(i=this.zr.maxScrollHeight)&&void 0!==i?i:0),this.zr.lastContentY=a,this.zr.maxContentY=Math.max(a,null!==(e=this.zr.maxContentY)&&void 0!==e?e:0),this.zr.maxContentHeight=Math.max(l,null!==(r=this.zr.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}getContext(){return this.zr}resetContext(){var t=this.zr;return setTimeout(this.Ur,0),t}startMeasuringScrollPosition(){Bt(t,"scroll",this.Ur,{capture:!0}),Bt(t,"scrollend",this.Ur,{capture:!0}),Bt(t,"resize",this.Ur)}scrollElement(){if(!this._instance.config.scroll_root_selector)return null==t?void 0:t.document.documentElement;var i=R(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var e of i){var r=null==t?void 0:t.document.querySelector(e);if(r)return r}}scrollY(){if(this._instance.config.scroll_root_selector){var i=this.scrollElement();return i&&i.scrollTop||0}return t&&(t.scrollY||t.pageYOffset||t.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var i=this.scrollElement();return i&&i.scrollLeft||0}return t&&(t.scrollX||t.pageXOffset||t.document.documentElement.scrollLeft)||0}}var ta=t=>fo(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties);class ia{constructor(t,i,e,r){this.Br=t=>{var i=this.qr();if(!i||i.sessionId!==t){var e={sessionId:t,props:this.Hr(this._instance)};this.Wr.register({[Si]:e})}},this._instance=t,this.Gr=i,this.Wr=e,this.Hr=r||ta,this.Gr.onSessionId(this.Br)}qr(){return this.Wr.props[Si]}getSetOnceProps(){var t,i=null==(t=this.qr())?void 0:t.props;return i?"r"in i?po(i):{$referring_domain:i.referringDomain,$pathname:i.initialPathName,utm_source:i.utm_source,utm_campaign:i.utm_campaign,utm_medium:i.utm_medium,utm_content:i.utm_content,utm_term:i.utm_term}:{}}getSessionProps(){var t={};return Ct(jt(this.getSetOnceProps()),((i,e)=>{"$current_url"===e&&(e="url"),t["$session_entry_"+w(e)]=i})),t}}var ea=Et("[SessionId]");class ra{on(t,i){return this.Vr.on(t,i)}constructor(t,i,e){var r;if(this.Jr=[],this.Vr=new Ao,this.Kr=(t,i)=>Math.abs(t-i)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if("always"===t.config.cookieless_mode)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.A=t.config,this.Wr=t.persistence,this.pi=void 0,this.Ft=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Yr=i||Te,this.Xr=e||Te;var s=this.A.persistence_name||this.A.token,n=this.A.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*G(n,60,36e3,ea.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Qr(),this.Zr="ph_"+s+"_window_id",this.ts="ph_"+s+"_primary_window_exists",this.es()){var o=qe.K(this.Zr),a=qe.K(this.ts);o&&!a?this.pi=o:qe.X(this.Zr),qe.Y(this.ts,!0)}if(null!=(r=this.A.bootstrap)&&r.sessionID)try{var l=(t=>{var i=t.replace(/-/g,"");if(32!==i.length)throw new Error("Not a valid UUID");if("7"!==i[12])throw new Error("Not a UUIDv7");return parseInt(i.substring(0,12),16)})(this.A.bootstrap.sessionID);this.rs(this.A.bootstrap.sessionID,(new Date).getTime(),l)}catch(t){ea.error("Invalid sessionID in bootstrap",t)}this.ss()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return C(this.Jr)&&(this.Jr=[]),this.Jr.push(t),this.Ft&&t(this.Ft,this.pi),()=>{this.Jr=this.Jr.filter((i=>i!==t))}}es(){return"memory"!==this.A.persistence&&!this.Wr.Ue&&qe.G()}ns(t){t!==this.pi&&(this.pi=t,this.es()&&qe.Y(this.Zr,t))}os(){return this.pi?this.pi:this.es()?qe.K(this.Zr):null}rs(t,i,e){t===this.Ft&&i===this._sessionActivityTimestamp&&e===this._sessionStartTimestamp||(this._sessionStartTimestamp=e,this._sessionActivityTimestamp=i,this.Ft=t,this.Wr.register({[hi]:[i,t,e]}))}ls(){if(this.Ft&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this.Ft,this._sessionStartTimestamp];var t=this.Wr.props[hi];return R(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.rs(null,null,null)}ss(){Bt(t,"beforeunload",(()=>{this.es()&&qe.X(this.ts)}),{capture:!1})}checkAndGetSessionAndWindowId(t,i){if(void 0===t&&(t=!1),void 0===i&&(i=null),"always"===this.A.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var e=i||(new Date).getTime(),[r,s,n]=this.ls(),o=this.os(),a=D(n)&&n>0&&Math.abs(e-n)>864e5,l=!1,h=!s,u=!t&&this.Kr(e,r);h||u||a?(s=this.Yr(),o=this.Xr(),ea.info("new session ID generated",{sessionId:s,windowId:o,changeReason:{noSessionId:h,activityTimeout:u,sessionPastMaximumLength:a}}),n=e,l=!0):o||(o=this.Xr(),l=!0);var d=0===r||!t||a?e:r,v=0===n?(new Date).getTime():n;return this.ns(o),this.rs(s,d,v),t||this.Qr(),l&&this.Jr.forEach((t=>t(s,o,l?{noSessionId:h,activityTimeout:u,sessionPastMaximumLength:a}:void 0))),{sessionId:s,windowId:o,sessionStartTimestamp:v,changeReason:l?{noSessionId:h,activityTimeout:u,sessionPastMaximumLength:a}:void 0,lastActivityTimestamp:r}}Qr(){clearTimeout(this.hs),this.hs=setTimeout((()=>{var[t]=this.ls();if(this.Kr((new Date).getTime(),t)){var i=this.Ft;this.resetSessionId(),this.Vr.emit("forcedIdleReset",{idleSessionId:i})}}),1.1*this.sessionTimeoutMs)}}var sa=["$set_once","$set"],na=Et("[SiteApps]");class oa{constructor(t){this._instance=t,this.us=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}ds(t,i){if(i){var e=this.globalsForEvent(i);this.us.push(e),this.us.length>1e3&&(this.us=this.us.slice(10))}}get siteAppLoaders(){var t;return null==(t=v._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}init(){if(this.isEnabled){var t=this._instance.Ze(this.ds.bind(this));this.vs=()=>{t(),this.us=[],this.vs=void 0}}}globalsForEvent(t){var i,e,r,s,n,o,a;if(!t)throw new Error("Event payload is required");var l={},h=this._instance.get_property("$groups")||[],u=this._instance.get_property("$stored_group_properties")||{};for(var[d,v]of Object.entries(u))l[d]={id:h[d],type:d,properties:v};var{$set_once:c,$set:f}=t;return{event:g({},_(t,sa),{properties:g({},t.properties,f?{$set:g({},null!==(i=null==(e=t.properties)?void 0:e.$set)&&void 0!==i?i:{},f)}:{},c?{$set_once:g({},null!==(r=null==(s=t.properties)?void 0:s.$set_once)&&void 0!==r?r:{},c)}:{}),elements_chain:null!==(n=null==(o=t.properties)?void 0:o.$elements_chain)&&void 0!==n?n:"",distinct_id:null==(a=t.properties)?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}setupSiteApp(t){var i=this.apps[t.id],e=()=>{var e;(!i.errored&&this.us.length&&(na.info("Processing "+this.us.length+" events for site app with id "+t.id),this.us.forEach((t=>null==i.processEvent?void 0:i.processEvent(t))),i.processedBuffer=!0),Object.values(this.apps).every((t=>t.processedBuffer||t.errored)))&&(null==(e=this.vs)||e.call(this))},r=!1,s=s=>{i.errored=!s,i.loaded=!0,na.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&e()};try{var{processEvent:n}=t.init({posthog:this._instance,callback:t=>{s(t)}});n&&(i.processEvent=n),r=!0}catch(i){na.error("Error while initializing PostHog app with config id "+t.id,i),s(!1)}if(r&&i.loaded)try{e()}catch(e){na.error("Error while processing buffered events PostHog app with config id "+t.id,e),i.errored=!0}}cs(){var t=this.siteAppLoaders||[];for(var i of t)this.apps[i.id]={id:i.id,loaded:!1,errored:!1,processedBuffer:!1};for(var e of t)this.setupSiteApp(e)}fs(t){if(0!==Object.keys(this.apps).length){var i=this.globalsForEvent(t);for(var e of Object.values(this.apps))try{null==e.processEvent||e.processEvent(i)}catch(i){na.error("Error while processing event "+t.event+" for site app "+e.id,i)}}}onRemoteConfig(t){var i,e,r,s=this;if(null!=(i=this.siteAppLoaders)&&i.length)return this.isEnabled?(this.cs(),void this._instance.on("eventCaptured",(t=>this.fs(t)))):void na.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(e=this.vs)||e.call(this),null!=(r=t.siteApps)&&r.length)if(this.isEnabled){var n=function(t){var i;v["__$$ph_site_app_"+t]=s._instance,null==(i=v.__PosthogExtensions__)||null==i.loadSiteApp||i.loadSiteApp(s._instance,a,(i=>{if(i)return na.error("Error while initializing PostHog app with config id "+t,i)}))};for(var{id:o,url:a}of t.siteApps)n(o)}else na.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}var aa=["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"],la=function(t,i){if(!t)return!1;var e=t.toLowerCase();return aa.concat(i||[]).some((t=>{var i=t.toLowerCase();return-1!==e.indexOf(i)}))},ha=function(t,i){if(!t)return!1;var e=t.userAgent;if(e&&la(e,i))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>la(null==t?void 0:t.brand,i))))return!0}catch(t){}return!!t.webdriver},ua=function(t){return t.US="us",t.EU="eu",t.CUSTOM="custom",t}({}),da="i.posthog.com";class va{constructor(t){this.ps={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get uiHost(){var t,i=null==(t=this.instance.config.ui_host)?void 0:t.replace(/\/$/,"");return i||(i=this.apiHost.replace("."+da,".posthog.com")),"https://app.posthog.com"===i?"https://us.posthog.com":i}get region(){return this.ps[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.ps[this.apiHost]=ua.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.ps[this.apiHost]=ua.EU:this.ps[this.apiHost]=ua.CUSTOM),this.ps[this.apiHost]}endpointFor(t,i){if(void 0===i&&(i=""),i&&(i="/"===i[0]?i:"/"+i),"ui"===t)return this.uiHost+i;if(this.region===ua.CUSTOM)return this.apiHost+i;var e=da+i;switch(t){case"assets":return"https://"+this.region+"-assets."+e;case"api":return"https://"+this.region+"."+e}}}var ca={icontains:(i,e)=>!!t&&e.href.toLowerCase().indexOf(i.toLowerCase())>-1,not_icontains:(i,e)=>!!t&&-1===e.href.toLowerCase().indexOf(i.toLowerCase()),regex:(i,e)=>!!t&&tn(e.href,i),not_regex:(i,e)=>!!t&&!tn(e.href,i),exact:(t,i)=>i.href===t,is_not:(t,i)=>i.href!==t};class fa{constructor(t){var i=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),i.getWebExperiments((t=>{fa.gs("retrieved web experiments from the server"),i._s=new Map,t.forEach((t=>{if(t.feature_flag_key){var e;if(i._s)fa.gs("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(e=i._s)||e.set(t.feature_flag_key,t);var r=i._instance.getFeatureFlag(t.feature_flag_key);M(r)&&t.variants[r]&&i.ys(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var n=t.variants[s];fa.bs(n)&&i.ys(t.name,s,n.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((t=>{this.onFeatureFlags(t)}))}onFeatureFlags(t){if(this._is_bot())fa.gs("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(A(this._s))return this._s=new Map,this.loadIfEnabled(),void this.previewWebExperiment();fa.gs("applying feature flags",t),t.forEach((t=>{var i;if(this._s&&null!=(i=this._s)&&i.has(t)){var e,r=this._instance.getFeatureFlag(t),s=null==(e=this._s)?void 0:e.get(t);r&&null!=s&&s.variants[r]&&this.ys(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var t=fa.getWindowLocation();if(null!=t&&t.search){var i=pe(null==t?void 0:t.search,"__experiment_id"),e=pe(null==t?void 0:t.search,"__experiment_variant");i&&e&&(fa.gs("previewing web experiments "+i+" && "+e),this.getWebExperiments((t=>{this.ws(parseInt(i),e,t)}),!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,i,e){if(this._instance.config.disable_web_experiments&&!e)return t([]);var r=this._instance.get_property("$web_experiments");if(r&&!i)return t(r);this._instance.Oe({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:i=>{if(200!==i.statusCode||!i.json)return t([]);var e=i.json.experiments||[];return t(e)}})}ws(t,i,e){var r=e.filter((i=>i.id===t));r&&r.length>0&&(fa.gs("Previewing web experiment ["+r[0].name+"] with variant ["+i+"]"),this.ys(r[0].name,i,r[0].variants[i].transforms))}static bs(t){return!A(t.conditions)&&(fa.Ss(t)&&fa.ks(t))}static Ss(t){var i;if(A(t.conditions)||A(null==(i=t.conditions)?void 0:i.url))return!0;var e,r,s,n=fa.getWindowLocation();return!!n&&(null==(e=t.conditions)||!e.url||ca[null!==(r=null==(s=t.conditions)?void 0:s.urlMatchType)&&void 0!==r?r:"icontains"](t.conditions.url,n))}static getWindowLocation(){return null==t?void 0:t.location}static ks(t){var i;if(A(t.conditions)||A(null==(i=t.conditions)?void 0:i.utm))return!0;var e=lo();if(e.utm_source){var r,s,n,o,a,l,h,u,d=null==(r=t.conditions)||null==(r=r.utm)||!r.utm_campaign||(null==(s=t.conditions)||null==(s=s.utm)?void 0:s.utm_campaign)==e.utm_campaign,v=null==(n=t.conditions)||null==(n=n.utm)||!n.utm_source||(null==(o=t.conditions)||null==(o=o.utm)?void 0:o.utm_source)==e.utm_source,c=null==(a=t.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=t.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==e.utm_medium,f=null==(h=t.conditions)||null==(h=h.utm)||!h.utm_term||(null==(u=t.conditions)||null==(u=u.utm)?void 0:u.utm_term)==e.utm_term;return d&&c&&f&&v}return!1}static gs(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;r<i;r++)e[r-1]=arguments[r];xt.info("[WebExperiments] "+t,e)}ys(t,i,e){this._is_bot()?fa.gs("Refusing to render web experiment since the viewer is a likely bot"):"control"!==i?e.forEach((e=>{if(e.selector){var r;fa.gs("applying transform of variant "+i+" for experiment "+t+" ",e);var s=null==(r=document)?void 0:r.querySelectorAll(e.selector);null==s||s.forEach((t=>{var i=t;e.html&&(i.innerHTML=e.html),e.css&&i.setAttribute("style",e.css)}))}})):fa.gs("Control variants leave the page unmodified.")}_is_bot(){return n&&this._instance?ha(n,this._instance.config.custom_blocked_useragents):void 0}}var pa=Et("[PostHog ExternalIntegrations]"),ga={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class _a{constructor(t){this._instance=t}nt(t,i){var e;null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,t,(t=>{if(t)return pa.error("failed to load script",t);i()}))}startIfEnabledOrStop(){var t=this,i=function(i){var e,s,n;(!r||null!=(e=v.__PosthogExtensions__)&&null!=(e=e.integrations)&&e[i]||t.nt(ga[i],(()=>{var e;null==(e=v.__PosthogExtensions__)||null==(e=e.integrations)||null==(e=e[i])||e.start(t._instance)})),!r&&null!=(s=v.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[i])&&(null==(n=v.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[i])||n.stop())};for(var[e,r]of Object.entries(null!==(s=this._instance.config.integrations)&&void 0!==s?s:{})){var s;i(e)}}}var ma="[SessionRecording]",ya=Et(ma);class ba{get started(){var t;return!(null==(t=this.$s)||!t.isStarted)}get status(){return this.$s?this.$s.status:this.Kt&&!this.Bt?Zr:"lazy_loading"}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.Kt=!1,this.ni=void 0,this._instance=t,!this._instance.sessionManager)throw ya.error("started without valid sessionManager"),new Error(ma+" started without valid sessionManager. This is a bug.");if("always"===this._instance.config.cookieless_mode)throw new Error(ma+' cannot be used with cookieless_mode="always"')}get Bt(){var i,e=!(null==(i=this._instance.get_property(ti))||!i.enabled),r=!this._instance.config.disable_session_recording,s=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return t&&e&&r&&!s}startIfEnabledOrStop(t){var i;if(!this.Bt||null==(i=this.$s)||!i.isStarted){var e=!C(Object.assign)&&!C(Array.from);this.Bt&&e?(this.xs(t),ya.info("starting")):this.stopRecording()}}xs(t){var i,e,r;this.Bt&&(null!=v&&null!=(i=v.__PosthogExtensions__)&&null!=(i=i.rrweb)&&i.record&&null!=(e=v.__PosthogExtensions__)&&e.initSessionRecording?this.Ri(t):null==(r=v.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.Ii,(i=>{if(i)return ya.error("could not load recorder",i);this.Ri(t)})))}stopRecording(){var t;null==(t=this.$s)||t.stop()}ki(){var t;null==(t=this._instance.persistence)||t.unregister(ui)}Ei(t){if(this._instance.persistence){var i,e,r=this._instance.persistence,s=()=>{var i=!1===t.sessionRecording?void 0:t.sessionRecording,e=null==i?void 0:i.sampleRate,s=A(e)?null:parseFloat(e);A(s)&&this.ki();var n=null==i?void 0:i.minimumDurationMilliseconds;r.register({[ti]:g({enabled:!!i},i,{networkPayloadCapture:g({capturePerformance:t.capturePerformance},null==i?void 0:i.networkPayloadCapture),canvasRecording:{enabled:null==i?void 0:i.recordCanvas,fps:null==i?void 0:i.canvasFps,quality:null==i?void 0:i.canvasQuality},sampleRate:s,minimumDurationMilliseconds:C(n)?null:n,endpoint:null==i?void 0:i.endpoint,triggerMatchType:null==i?void 0:i.triggerMatchType,masking:null==i?void 0:i.masking,urlTriggers:null==i?void 0:i.urlTriggers})})};s(),null==(i=this.ni)||i.call(this),this.ni=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(s)}}onRemoteConfig(t){"sessionRecording"in t?!1!==t.sessionRecording?(this.Ei(t),this.Kt=!0,this.startIfEnabledOrStop()):this.Kt=!0:ya.info("skipping remote config with no sessionRecording",t)}log(t,i){var e;void 0===i&&(i="log"),null!=(e=this.$s)&&e.log?this.$s.log(t,i):ya.warn("log called before recorder was ready")}get Ii(){var t,i,e=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.get_property(ti);return(null==e||null==(i=e.scriptConfig)?void 0:i.script)||"lazy-recorder"}Ri(t){var i,e;if(null==(i=v.__PosthogExtensions__)||!i.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.$s||(this.$s=null==(e=v.__PosthogExtensions__)?void 0:e.initSessionRecording(this._instance),this.$s._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture);this.$s.start(t)}onRRwebEmit(t){var i;null==(i=this.$s)||null==i.onRRwebEmit||i.onRRwebEmit(t)}overrideLinkedFlag(){var t;null==(t=this.$s)||t.overrideLinkedFlag()}overrideSampling(){var t;null==(t=this.$s)||t.overrideSampling()}overrideTrigger(t){var i;null==(i=this.$s)||i.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.$s)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,i){var e;return!(null==(e=this.$s)||!e.tryAddCustomEvent(t,i))}}var wa={},Sa=()=>{},ka="posthog",$a=!Js&&-1===(null==d?void 0:d.indexOf("MSIE"))&&-1===(null==d?void 0:d.indexOf("Mozilla")),xa=i=>{var e;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:Ut(null==o?void 0:o.location),persistence:"localStorage+cookie",persistence_name:"",loaded:Sa,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:"2025-05-24"!==i||"history_change",capture_pageleave:"if_capture_pageview",defaults:null!=i?i:"unset",debug:a&&M(null==a?void 0:a.search)&&-1!==a.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==t||null==(e=t.location)?void 0:e.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:t=>{var i="Bad HTTP status: "+t.statusCode+" "+t.text;xt.error(i)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:Ko},error_tracking:{},_onCapture:Sa,__preview_eager_load_replay:!1}},Ea=t=>{var i={};C(t.process_person)||(i.person_profiles=t.process_person),C(t.xhr_headers)||(i.request_headers=t.xhr_headers),C(t.cookie_name)||(i.persistence_name=t.cookie_name),C(t.disable_cookie)||(i.disable_persistence=t.disable_cookie),C(t.store_google)||(i.save_campaign_params=t.store_google),C(t.verbose)||(i.debug=t.verbose);var e=Mt({},i,t);return R(t.property_blacklist)&&(C(t.property_denylist)?e.property_denylist=t.property_blacklist:R(t.property_denylist)?e.property_denylist=[...t.property_blacklist,...t.property_denylist]:xt.error("Invalid value for property_denylist config: "+t.property_denylist)),e};class Ra{constructor(){this.__forceAllowLocalhost=!1}get Es(){return this.__forceAllowLocalhost}set Es(t){xt.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class Ia{get decideEndpointWasHit(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.hasLoadedFlags)&&void 0!==t&&t}constructor(){this.webPerformance=new Ra,this.Rs=!1,this.version=c.LIB_VERSION,this.Is=new Ao,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=xa(),this.SentryIntegration=Ms,this.sentryIntegration=t=>function(t,i){var e=Cs(t,i);return{name:Ts,processEvent:t=>e(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Ps=!1,this.Ts=null,this.Cs=null,this.Ms=null,this.featureFlags=new Io(this),this.toolbar=new js(this),this.scrollManager=new Zo(this),this.pageViewManager=new Gs(this),this.surveys=new Ho(this),this.experiments=new fa(this),this.exceptions=new on(this),this.rateLimiter=new Go(this),this.requestRouter=new va(this),this.consent=new We(this),this.externalIntegrations=new _a(this),this.people={set:(t,i,e)=>{var r=M(t)?{[t]:i}:t;this.setPersonProperties(r),null==e||e({})},set_once:(t,i,e)=>{var r=M(t)?{[t]:i}:t;this.setPersonProperties(void 0,r),null==e||e({})}},this.on("eventCaptured",(t=>xt.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,i,e){if(e&&e!==ka){var r,s=null!==(r=wa[e])&&void 0!==r?r:new Ia;return s._init(t,i,e),wa[e]=s,wa[ka][e]=s,s}return this._init(t,i,e)}_init(i,e,r){var s,n;if(void 0===e&&(e={}),C(i)||O(i))return xt.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 xt.warn("You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},this.Os=e,this.Fs=[],e.person_profiles&&(this.Cs=e.person_profiles),this.set_config(Mt({},xa(e.defaults),Ea(e),{name:r,token:i})),this.config.on_xhr_error&&xt.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=e.disable_compression?void 0:de.GZipJS;var o=this.As();this.persistence=new To(this.config,o),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new To(g({},this.config,{persistence:"sessionStorage"}),o);var a=g({},this.persistence.props),l=g({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Ds=new Yo((t=>this.js(t)),this.config.request_queue_config),this.Ls=new Qo(this),this.__request_queue=[];var h="always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut();if(h||(this.sessionManager=new ra(this),this.sessionPropsManager=new ia(this,this.sessionManager,this.persistence)),new Ns(this).startIfEnabledOrStop(),this.siteApps=new oa(this),null==(s=this.siteApps)||s.init(),h||(this.config.__preview_eager_load_replay?this.sessionRecording=new Rs(this):this.sessionRecording=new ba(this),this.sessionRecording.startIfEnabledOrStop()),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new ke(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new Ws(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new Bs(this),this.exceptionObserver=new Xe(this),this.exceptionObserver.startIfEnabled(),this.deadClicksAutocapture=new Ke(this,Je),this.deadClicksAutocapture.startIfEnabled(),this.historyAutocapture=new Ze(this),this.historyAutocapture.startIfEnabled(),c.DEBUG=c.DEBUG||this.config.debug,c.DEBUG&&xt.info("Starting in debug mode",{this:this,config:e,thisC:g({},this.config),p:a,s:l}),void 0!==(null==(n=e.bootstrap)?void 0:n.distinctID)){var u,d,v=this.config.get_device_id(Te()),f=null!=(u=e.bootstrap)&&u.isIdentifiedID?v:e.bootstrap.distinctID;this.persistence.set_property(wi,null!=(d=e.bootstrap)&&d.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:e.bootstrap.distinctID,$device_id:f})}if(this.Ns()){var p,_,m=Object.keys((null==(p=e.bootstrap)?void 0:p.featureFlags)||{}).filter((t=>{var i;return!(null==(i=e.bootstrap)||null==(i=i.featureFlags)||!i[t])})).reduce(((t,i)=>{var r;return t[i]=(null==(r=e.bootstrap)||null==(r=r.featureFlags)?void 0:r[i])||!1,t}),{}),y=Object.keys((null==(_=e.bootstrap)?void 0:_.featureFlagPayloads)||{}).filter((t=>m[t])).reduce(((t,i)=>{var r,s;null!=(r=e.bootstrap)&&null!=(r=r.featureFlagPayloads)&&r[i]&&(t[i]=null==(s=e.bootstrap)||null==(s=s.featureFlagPayloads)?void 0:s[i]);return t}),{});this.featureFlags.receivedFeatureFlags({featureFlags:m,featureFlagPayloads:y})}if(h)this.register_once({distinct_id:Pi,$device_id:null},"");else if(!this.get_distinct_id()){var b=this.config.get_device_id(Te());this.register_once({distinct_id:b,$device_id:b},""),this.persistence.set_property(wi,"anonymous")}return Bt(t,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),e.segment?Ps(this,(()=>this.Us())):this.Us(),I(this.config._onCapture)&&this.config._onCapture!==Sa&&(xt.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&xt.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}Fe(t){var i,e,r,s,n,a,l,h;if(!o||!o.body)return xt.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Fe(t)}),500);this.compression=void 0,t.supportedCompression&&!this.config.disable_compression&&(this.compression=y(t.supportedCompression,de.GZipJS)?de.GZipJS:y(t.supportedCompression,de.Base64)?de.Base64:void 0),null!=(i=t.analytics)&&i.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint),this.set_config({person_profiles:this.Cs?this.Cs:"identified_only"}),null==(e=this.siteApps)||e.onRemoteConfig(t),null==(r=this.sessionRecording)||r.onRemoteConfig(t),null==(s=this.autocapture)||s.onRemoteConfig(t),null==(n=this.heatmaps)||n.onRemoteConfig(t),this.surveys.onRemoteConfig(t),null==(a=this.webVitalsAutocapture)||a.onRemoteConfig(t),null==(l=this.exceptionObserver)||l.onRemoteConfig(t),this.exceptions.onRemoteConfig(t),null==(h=this.deadClicksAutocapture)||h.onRemoteConfig(t)}Us(){try{this.config.loaded(this)}catch(t){xt.critical("`loaded` function failed",t)}this.zs(),this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||"always"===this.config.cookieless_mode)&&this.Bs()}),1),new Jo(this).load(),this.featureFlags.flags()}zs(){var t;this.is_capturing()&&(this.config.request_batching&&(null==(t=this.Ds)||t.enable()))}_dom_loaded(){this.is_capturing()&&Tt(this.__request_queue,(t=>this.js(t))),this.__request_queue=[],this.zs()}_handle_unload(){var t,i;this.config.request_batching?(this.qs()&&this.capture("$pageleave"),null==(t=this.Ds)||t.unload(),null==(i=this.Ls)||i.unload()):this.qs()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}Oe(t){this.__loaded&&($a?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)||(t.transport=t.transport||this.config.api_transport,t.url=Ys(t.url,{ip:this.config.ip?1:0}),t.headers=g({},this.config.request_headers),t.compression="best-available"===t.compression?this.compression:t.compression,t.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(t=>{var i,e,r,s=g({},t);s.timeout=s.timeout||6e4,s.url=Ys(s.url,{_:(new Date).getTime().toString(),ver:c.LIB_VERSION,compression:s.compression});var n=null!==(i=s.transport)&&void 0!==i?i:"fetch",o=Zs.filter((t=>!s.disableTransport||!t.transport||!s.disableTransport.includes(t.transport))),a=null!==(e=null==(r=zt(o,(t=>t.transport===n)))?void 0:r.method)&&void 0!==e?e:o[0].method;if(!a)throw new Error("No available transport method");a(s)})(g({},t,{callback:i=>{var e,r;(this.rateLimiter.checkForLimiting(i),i.statusCode>=400)&&(null==(e=(r=this.config).on_request_error)||e.call(r,i));null==t.callback||t.callback(i)}}))))}js(t){this.Ls?this.Ls.retriableRequest(t):this.Oe(t)}_execute_array(t){var i,e=[],r=[],s=[];Tt(t,(t=>{t&&(i=t[0],R(i)?s.push(t):I(t)?t.call(this):R(t)&&"alias"===i?e.push(t):R(t)&&-1!==i.indexOf("capture")&&I(this[i])?s.push(t):r.push(t))}));var n=function(t,i){Tt(t,(function(t){if(R(t[0])){var e=i;Ct(t,(function(t){e=e[t[0]].apply(e,t.slice(1))}))}else this[t[0]].apply(this,t.slice(1))}),i)};n(e,this),n(r,this),n(s,this)}Ns(){var t,i;return(null==(t=this.config.bootstrap)?void 0:t.featureFlags)&&Object.keys(null==(i=this.config.bootstrap)?void 0:i.featureFlags).length>0||!1}push(t){this._execute_array([t])}capture(t,i,e){var r;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Ds){if(this.is_capturing())if(!C(t)&&M(t)){if(this.config.opt_out_useragent_filter||!this._is_bot()){var s=null!=e&&e.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==s||!s.isRateLimited){null!=i&&i.$current_url&&!M(null==i?void 0:i.$current_url)&&(xt.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==i||delete i.$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,o=(null==e?void 0:e.timestamp)||n,a=Te(),l={uuid:a,event:t,properties:this.calculateEventProperties(t,i||{},o,a)};s&&(l.properties.$lib_rate_limit_remaining_tokens=s.remainingTokens),(null==e?void 0:e.$set)&&(l.$set=null==e?void 0:e.$set);var h,u=this.Hs(null==e?void 0:e.$set_once);if(u&&(l.$set_once=u),(l=Lt(l,null!=e&&e._noTruncate?null:this.config.properties_string_max_length)).timestamp=o,C(null==e?void 0:e.timestamp)||(l.properties.$event_time_override_provided=!0,l.properties.$event_time_override_system_time=n),t===Mo.DISMISSED||t===Mo.SENT){var d=null==i?void 0:i[Oo.SURVEY_ID],v=null==i?void 0:i[Oo.SURVEY_ITERATION];h={id:d,current_iteration:v},localStorage.getItem(Uo(h))||localStorage.setItem(Uo(h),"true"),l.$set=g({},l.$set,{[No({id:d,current_iteration:v},t===Mo.SENT?"responded":"dismissed")]:!0})}var c=g({},l.properties.$set,l.$set);if(T(c)||this.setPersonPropertiesForFlags(c),!A(this.config.before_send)){var f=this.Ws(l);if(!f)return;l=f}this.Is.emit("eventCaptured",l);var p={method:"POST",url:null!==(r=null==e?void 0:e._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:l,compression:"best-available",batchKey:null==e?void 0:e._batchKey};return!this.config.request_batching||e&&(null==e||!e._batchKey)||null!=e&&e.send_instantly?this.js(p):this.Ds.enqueue(p),l}xt.critical("This capture call is ignored due to client rate limiting.")}}else xt.error("No event name provided to posthog.capture")}else xt.uninitializedWarning("posthog.capture")}Ze(t){return this.on("eventCaptured",(i=>t(i.event,i)))}calculateEventProperties(t,i,e,r,s){if(e=e||new Date,!this.persistence||!this.sessionPersistence)return i;var n=s?void 0:this.persistence.remove_event_timer(t),a=g({},i);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"===t){var l=g({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=l.distinct_id,(!M(a.distinct_id)&&!D(a.distinct_id)||O(a.distinct_id))&&xt.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var h,u=mo(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:v,windowId:c}=this.sessionManager.checkAndGetSessionAndWindowId(s,e.getTime());a.$session_id=v,a.$window_id=c}this.sessionPropsManager&&Mt(a,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&Mt(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=null==(f=this.Ls)?void 0:f.length}catch(t){a.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===ua.CUSTOM&&(a.$lib_custom_api_host=this.config.api_host),h="$pageview"!==t||s?"$pageleave"!==t||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(e):this.pageViewManager.doPageView(e,r),a=Mt(a,h),"$pageview"===t&&o&&(a.title=o.title),!C(n)){var p=e.getTime()-n;a.$duration=parseFloat((p/1e3).toFixed(3))}d&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=Mt({},u,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),R(this.config.property_denylist)?Ct(this.config.property_denylist,(function(t){delete a[t]})):xt.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var _=this.config.sanitize_properties;_&&(xt.error("sanitize_properties is deprecated. Use before_send instead"),a=_(a,t));var m=this.Gs();return a.$process_person_profile=m,m&&!s&&this.Vs("_calculate_event_properties"),a}Hs(t){var i;if(!this.persistence||!this.Gs())return t;if(this.Rs)return t;var e=this.persistence.get_initial_props(),r=null==(i=this.sessionPropsManager)?void 0:i.getSetOnceProps(),s=Mt({},e,r||{},t||{}),n=this.config.sanitize_properties;return n&&(xt.error("sanitize_properties is deprecated. Use before_send instead"),s=n(s,"$set_once")),this.Rs=!0,T(s)?void 0:s}register(t,i){var e;null==(e=this.persistence)||e.register(t,i)}register_once(t,i,e){var r;null==(r=this.persistence)||r.register_once(t,i,e)}register_for_session(t){var i;null==(i=this.sessionPersistence)||i.register(t)}unregister(t){var i;null==(i=this.persistence)||i.unregister(t)}unregister_for_session(t){var i;null==(i=this.sessionPersistence)||i.unregister(t)}Js(t,i){this.register({[t]:i})}getFeatureFlag(t,i){return this.featureFlags.getFeatureFlag(t,i)}getFeatureFlagPayload(t){var i=this.featureFlags.getFeatureFlagPayload(t);try{return JSON.parse(i)}catch(t){return i}}isFeatureEnabled(t,i){return this.featureFlags.isFeatureEnabled(t,i)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateEarlyAccessFeatureEnrollment(t,i,e){this.featureFlags.updateEarlyAccessFeatureEnrollment(t,i,e)}getEarlyAccessFeatures(t,i,e){return void 0===i&&(i=!1),this.featureFlags.getEarlyAccessFeatures(t,i,e)}on(t,i){return this.Is.on(t,i)}onFeatureFlags(t){return this.featureFlags.onFeatureFlags(t)}onSurveysLoaded(t){return this.surveys.onSurveysLoaded(t)}onSessionId(t){var i,e;return null!==(i=null==(e=this.sessionManager)?void 0:e.onSessionId(t))&&void 0!==i?i:()=>{}}getSurveys(t,i){void 0===i&&(i=!1),this.surveys.getSurveys(t,i)}getActiveMatchingSurveys(t,i){void 0===i&&(i=!1),this.surveys.getActiveMatchingSurveys(t,i)}renderSurvey(t,i){this.surveys.renderSurvey(t,i)}displaySurvey(t,i){void 0===i&&(i=Bo),this.surveys.displaySurvey(t,i)}canRenderSurvey(t){return this.surveys.canRenderSurvey(t)}canRenderSurveyAsync(t,i){return void 0===i&&(i=!1),this.surveys.canRenderSurveyAsync(t,i)}identify(t,i,e){if(!this.__loaded||!this.persistence)return xt.uninitializedWarning("posthog.identify");if(D(t)&&(t=t.toString(),xt.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),t)if(["distinct_id","distinctid"].includes(t.toLowerCase()))xt.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if(t!==Pi){if(this.Vs("posthog.identify")){var r=this.get_distinct_id();if(this.register({$user_id:t}),!this.get_property("$device_id")){var s=r;this.register_once({$had_persisted_distinct_id:!0,$device_id:s},"")}t!==r&&t!==this.get_property(Ht)&&(this.unregister(Ht),this.register({distinct_id:t}));var n="anonymous"===(this.persistence.get_property(wi)||"anonymous");t!==r&&n?(this.persistence.set_property(wi,"identified"),this.setPersonPropertiesForFlags(g({},e||{},i||{}),!1),this.capture("$identify",{distinct_id:t,$anon_distinct_id:r},{$set:i||{},$set_once:e||{}}),this.Ms=en(t,i,e),this.featureFlags.setAnonymousDistinctId(r)):(i||e)&&this.setPersonProperties(i,e),t!==r&&(this.reloadFeatureFlags(),this.unregister(bi))}}else xt.critical('The string "'+Pi+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else xt.error("Unique user id has not been set in posthog.identify")}setPersonProperties(t,i){if((t||i)&&this.Vs("posthog.setPersonProperties")){var e=en(this.get_distinct_id(),t,i);this.Ms!==e?(this.setPersonPropertiesForFlags(g({},i||{},t||{})),this.capture("$set",{$set:t||{},$set_once:i||{}}),this.Ms=e):xt.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(t,i,e){if(t&&i){if(this.Vs("posthog.group")){var r=this.getGroups();r[t]!==i&&this.resetGroupPropertiesForFlags(t),this.register({$groups:g({},r,{[t]:i})}),e&&(this.capture("$groupidentify",{$group_type:t,$group_key:i,$group_set:e}),this.setGroupPropertiesForFlags({[t]:e})),r[t]===i||e||this.reloadFeatureFlags()}}else xt.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,i){void 0===i&&(i=!0),this.featureFlags.setPersonPropertiesForFlags(t,i)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(t,i){void 0===i&&(i=!0),this.Vs("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(t,i)}resetGroupPropertiesForFlags(t){this.featureFlags.resetGroupPropertiesForFlags(t)}reset(t){var i,e,r,s;if(xt.info("reset"),!this.__loaded)return xt.uninitializedWarning("posthog.reset");var n=this.get_property("$device_id");if(this.consent.reset(),null==(i=this.persistence)||i.clear(),null==(e=this.sessionPersistence)||e.clear(),this.surveys.reset(),this.featureFlags.reset(),null==(r=this.persistence)||r.set_property(wi,"anonymous"),null==(s=this.sessionManager)||s.resetSessionId(),this.Ms=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:Pi,$device_id:null},"");else{var o=this.config.get_device_id(Te());this.register_once({distinct_id:o,$device_id:t?o: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 t,i;return null!==(t=null==(i=this.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var{sessionId:i,sessionStartTimestamp:e}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+i);if(null!=t&&t.withTimestamp&&e){var s,n=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!e)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-e)/1e3)-n,0)}return r}alias(t,i){return t===this.get_property(qt)?(xt.critical("Attempting to create alias for existing People user - aborting."),-2):this.Vs("posthog.alias")?(C(i)&&(i=this.get_distinct_id()),t!==i?(this.Js(Ht,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(xt.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var i=g({},this.config);if(P(t)){var e,r,s,n,o;Mt(this.config,Ea(t));var a=this.As();null==(e=this.persistence)||e.update_config(this.config,i,a),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new To(g({},this.config,{persistence:"sessionStorage"}),a),je.G()&&"true"===je.J("ph_debug")&&(this.config.debug=!0),this.config.debug&&(c.DEBUG=!0,xt.info("set_config",{config:t,oldConfig:i,newConfig:g({},this.config)})),null==(r=this.sessionRecording)||r.startIfEnabledOrStop(),null==(s=this.autocapture)||s.startIfEnabled(),null==(n=this.heatmaps)||n.startIfEnabled(),this.surveys.loadIfEnabled(),this.Ks(),null==(o=this.externalIntegrations)||o.startIfEnabledOrStop()}}startSessionRecording(t){var i=!0===t,e={sampling:i||!(null==t||!t.sampling),linked_flag:i||!(null==t||!t.linked_flag),url_trigger:i||!(null==t||!t.url_trigger),event_trigger:i||!(null==t||!t.event_trigger)};if(Object.values(e).some(Boolean)){var r,s,n,o,a;if(null==(r=this.sessionManager)||r.checkAndGetSessionAndWindowId(),e.sampling)null==(s=this.sessionRecording)||s.overrideSampling();if(e.linked_flag)null==(n=this.sessionRecording)||n.overrideLinkedFlag();if(e.url_trigger)null==(o=this.sessionRecording)||o.overrideTrigger("url");if(e.event_trigger)null==(a=this.sessionRecording)||a.overrideTrigger("event")}this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!(null==(t=this.sessionRecording)||!t.started)}captureException(t,i){var e=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(t,{handled:!0,syntheticException:e});return this.exceptions.sendExceptionEvent(g({},r,i))}loadToolbar(t){return this.toolbar.loadToolbar(t)}get_property(t){var i;return null==(i=this.persistence)?void 0:i.props[t]}getSessionProperty(t){var i;return null==(i=this.sessionPersistence)?void 0:i.props[t]}toString(){var t,i=null!==(t=this.config.name)&&void 0!==t?t:ka;return i!==ka&&(i=ka+"."+i),i}_isIdentified(){var t,i;return"identified"===(null==(t=this.persistence)?void 0:t.get_property(wi))||"identified"===(null==(i=this.sessionPersistence)?void 0:i.get_property(wi))}Gs(){var t,i;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&T(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[Ht])&&(null==(i=this.persistence)||null==(i=i.props)||!i[Ri]))}qs(){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.Gs()||this.Vs("posthog.createPersonProfile")&&this.setPersonProperties({},{})}Vs(t){return"never"===this.config.person_profiles?(xt.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Js(Ri,!0),!0)}As(){if("always"===this.config.cookieless_mode)return!0;var t=this.consent.isOptedOut(),i=this.config.opt_out_persistence_by_default||"on_reject"===this.config.cookieless_mode;return this.config.disable_persistence||t&&!!i}Ks(){var t,i,e,r,s=this.As();(null==(t=this.persistence)?void 0:t.Ue)!==s&&(null==(e=this.persistence)||e.set_disabled(s));(null==(i=this.sessionPersistence)?void 0:i.Ue)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s));return s}opt_in_capturing(t){if("always"!==this.config.cookieless_mode){var i;if("on_reject"===this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut()&&(this.reset(!0),this.sessionManager=new ra(this),this.persistence&&(this.sessionPropsManager=new ia(this,this.sessionManager,this.persistence)),this.sessionRecording=new Rs(this),this.sessionRecording.startIfEnabledOrStop()),this.consent.optInOut(!0),this.Ks(),this.zs(),"on_reject"==this.config.cookieless_mode&&this.surveys.loadIfEnabled(),C(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)this.capture(null!==(i=null==t?void 0:t.captureEventName)&&void 0!==i?i:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0});this.config.capture_pageview&&this.Bs()}else xt.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}opt_out_capturing(){var t;"always"!==this.config.cookieless_mode?("on_reject"===this.config.cookieless_mode&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.Ks(),"on_reject"===this.config.cookieless_mode&&(this.register({distinct_id:Pi,$device_id:null}),this.sessionManager=void 0,this.sessionPropsManager=void 0,null==(t=this.sessionRecording)||t.stopRecording(),this.sessionRecording=void 0,this.Bs())):xt.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 t=this.consent.consent;return t===He.GRANTED?"granted":t===He.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.Ks()}_is_bot(){return n?ha(n,this.config.custom_blocked_useragents):void 0}Bs(){o&&("visible"===o.visibilityState?this.Ps||(this.Ps=!0,this.capture("$pageview",{title:o.title},{send_instantly:!0}),this.Ts&&(o.removeEventListener("visibilitychange",this.Ts),this.Ts=null)):this.Ts||(this.Ts=this.Bs.bind(this),Bt(o,"visibilitychange",this.Ts)))}debug(i){!1===i?(null==t||t.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(null==t||t.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),localStorage&&localStorage.setItem("ph_debug","true"),this.set_config({debug:!0}))}L(){var t,i,e,r,s,n,o,a=this.Os||{};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?(xt.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):(e="advanced_disable_decide",r=!1,s=xt,n=(i="advanced_disable_flags")in(t=a)&&!C(t[i]),o=e in t&&!C(t[e]),n?t[i]:o?(s&&s.warn("Config field '"+e+"' is deprecated. Please use '"+i+"' instead. The old field will be removed in a future major version."),t[e]):r)}Ws(t){if(A(this.config.before_send))return t;var i=R(this.config.before_send)?this.config.before_send:[this.config.before_send],e=t;for(var r of i){if(e=r(e),A(e)){var s="Event '"+t.event+"' was rejected in beforeSend function";return N(t.event)?xt.warn(s+". This can cause unexpected behavior."):xt.info(s),null}e.properties&&!T(e.properties)||xt.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}return e}getPageViewId(){var t;return null==(t=this.pageViewManager.pe)?void 0:t.pageViewId}captureTraceFeedback(t,i){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:i})}captureTraceMetric(t,i,e){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:i,$ai_metric_value:String(e)})}}!function(t,i){for(var e=0;e<i.length;e++)t.prototype[i[e]]=Dt(t.prototype[i[e]])}(Ia,["identify"]);var Pa,Ta;Pa=wa[ka]=new Ia,(Ta=v.posthog)&&Ct(Ta._i,(function(t){if(t&&R(t)){var i=Pa.init(t[0],t[1],t[2]),e=Ta[t[2]]||Ta;i&&(i._execute_array.call(i.people,e.people),i._execute_array(e))}})),v.posthog=Pa,function(){function i(){i.done||(i.done=!0,$a=!1,Ct(wa,(function(t){t._dom_loaded()})))}null!=o&&o.addEventListener?"complete"===o.readyState?i():Bt(o,"DOMContentLoaded",i,{capture:!1}):t&&xt.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}()}();
|
|
2
2
|
//# sourceMappingURL=array.js.map
|