posthog-js 1.429.0 → 1.429.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/all-external-dependencies.js +1 -1
- package/dist/array.full.es5.js +1 -1
- package/dist/array.full.js +1 -1
- package/dist/array.full.no-external.js +1 -1
- package/dist/array.js +1 -1
- package/dist/array.no-external.js +1 -1
- package/dist/customizations.full.js +1 -1
- package/dist/customizations.js +1 -1
- package/dist/default-extensions.js +1 -1
- package/dist/extension-bundles.js +1 -1
- package/dist/lazy-recorder.js +1 -1
- package/dist/main.js +1 -1
- package/dist/module.full.js +1 -1
- package/dist/module.full.no-external.js +1 -1
- package/dist/module.js +1 -1
- package/dist/module.mjs +1 -1
- package/dist/module.no-external.js +1 -1
- package/dist/module.slim.js +1 -1
- package/dist/module.slim.no-external.js +1 -1
- package/dist/posthog-recorder.js +1 -1
- package/dist/rrweb.js +1 -1
- package/dist/rrweb.js.map +1 -1
- package/lib/package.json +1 -1
- package/package.json +4 -4
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function t(t,i,e,r,s,n,a){try{var o=t[n](a),l=o.value}catch(t){return void e(t)}o.done?i(l):Promise.resolve(l).then(r,s)}function i(i){return function(){var e=this,r=arguments;return new Promise(function(s,n){var a=i.apply(e,r);function o(i){t(a,s,n,o,l,"next",i)}function l(i){t(a,s,n,o,l,"throw",i)}o(void 0)})}}function e(){return e=Object.assign?Object.assign.bind():function(t){for(var i=1;arguments.length>i;i++){var e=arguments[i];for(var r in e)({}).hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},e.apply(null,arguments)}var r=function(t){return t.AnonymousId="anonymous_id",t.DistinctId="distinct_id",t.Props="props",t.EnablePersonProcessing="enable_person_processing",t.PersonMode="person_mode",t.FeatureFlagDetails="feature_flag_details",t.FeatureFlags="feature_flags",t.FeatureFlagPayloads="feature_flag_payloads",t.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",t.BootstrapFeatureFlags="bootstrap_feature_flags",t.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",t.OverrideFeatureFlags="override_feature_flags",t.Queue="queue",t.AiQueue="ai_queue",t.AiCaptureQueue="ai_capture_queue",t.LogsQueue="logs_queue",t.OptedOut="opted_out",t.SessionId="session_id",t.SessionStartTimestamp="session_start_timestamp",t.SessionLastTimestamp="session_timestamp",t.PersonProperties="person_properties",t.GroupProperties="group_properties",t.InstalledAppBuild="installed_app_build",t.InstalledAppVersion="installed_app_version",t.SessionReplay="session_replay",t.PushRegistered="push_registered",t.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",t.SurveyLastSeenDate="survey_last_seen_date",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t}({});function s(t,i){return-1!==t.indexOf(i)}var n=function(t){return t.trim()},a=Object.prototype,o=a.hasOwnProperty,l=a.toString,u=Array.isArray||function(t){return"[object Array]"===l.call(t)},h=t=>"function"==typeof t,v=t=>t===Object(t)&&!u(t),d=t=>{if(v(t)){for(var i in t)if(o.call(t,i))return!1;return!0}return!1},c=t=>void 0===t,f=t=>"[object String]"==l.call(t),p=t=>f(t)&&0===t.trim().length,g=t=>null===t,_=t=>c(t)||g(t),b=t=>"[object Number]"==l.call(t)&&t==t,m=t=>"[object Boolean]"===l.call(t);function y(t){return null===t||"object"!=typeof t}function w(t,i){return{}.toString.call(t)==="[object "+i+"]"}function S(t){switch({}.toString.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return x(t,Error)}}function k(t){return"u">typeof Event&&x(t,Event)}function x(t,i){try{return t instanceof i}catch(t){return!1}}var E=["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","pinterestbot","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"],F=function(t,i){if(void 0===i&&(i=[]),!t)return!1;var e=t.toLowerCase();return E.concat(i).some(t=>{var i=t.toLowerCase();return-1!==e.indexOf(i)})};function P(t,i,e,r,s){return i>e&&(r.warn("min cannot be greater than max."),i=e),b(t)?t>e?(r.warn(" cannot be greater than max: "+e+". Using max value instead."),e):i>t?(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),P(e,i,e,r))}class C{constructor(t){this.t={},this.i=t.i,this.o=P(t.bucketSize,0,100,t.l),this.u=P(t.refillRate,0,this.o,t.l),this.h=P(t.refillInterval,0,864e5,t.l)}p(t,i){var e=Math.floor((i-t.lastAccess)/this.h);e>0&&(t.tokens=Math.min(t.tokens+e*this.u,this.o),t.lastAccess=t.lastAccess+e*this.h)}consumeRateLimit(t){var i,e=Date.now(),r=String(t),s=this.t[r];return s?this.p(s,e):this.t[r]=s={tokens:this.o,lastAccess:e},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(i=this.i)||i.call(this,t)),0===s.tokens)}stop(){this.t={}}}var T,R,A,O="Mobile",M="Android",I="BlackBerry",j="Nintendo",L="PlayStation",D="Xbox",N="Windows",z=N+" Phone",B=new RegExp(I+"|PlayBook|BB10","i"),H={"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"},U=[[new RegExp(D+"; "+D+" (.*?)[);]","i"),t=>[D,t&&t[1]||""]],[new RegExp(j,"i"),[j,""]],[new RegExp(L,"i"),[L,""]],[B,[I,""]],[new RegExp(N,"i"),(t,i)=>{if(/Phone/.test(i)||/WPDesktop/.test(i))return[z,""];if(new RegExp(O).test(i)&&!/IEMobile\b/.test(i))return[N+" "+O,""];var e=/Windows NT ([0-9.]+)/i.exec(i);if(e&&e[1]){var r=H[e[1]]||"";return/arm/i.test(i)&&(r="RT"),[N,r]}return[N,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?["iOS",[t[3],t[4],t[5]||"0"].join(".")]:["iOS",""]],[/(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("("+M+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+M+")","i"),t=>t&&t[2]?[M,[t[2],t[3],t[4]||"0"].join(".")]:[M,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var i=["Mac OS X",""];return t&&t[1]&&(i[1]=[t[1],t[2],t[3]||"0"].join(".")),i}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],V="[Truncated]",q="[Unserializable]";function W(t){for(var i="",e=0;t.length>e;e++){var r=t.charCodeAt(e);if(55296>r||r>56319)i+=56320>r||r>57343?t[e]:"�";else{var s=t.charCodeAt(e+1);56320>s||s>57343?i+="�":(i+=t[e]+t[e+1],e++)}}return i}function K(t){return t?t.split("#")[0]:t}function J(t,i){var e=setTimeout(t,i);return(null==e?void 0:e.unref)&&(null==e||e.unref()),e}function G(t,i,e){return X.apply(this,arguments)}function X(){return(X=i(function*(t,i,e){var r;try{return yield Promise.race([t,new Promise((t,s)=>{r=J(()=>{try{null==e||e(),t()}catch(t){s(t)}},i)})])}finally{clearTimeout(r)}})).apply(this,arguments)}function Z(t){var i=globalThis._posthogChunkIds;if(i){var e=Object.keys(i);return A&&e.length===R?A:(R=e.length,A=e.reduce((e,r)=>{T||(T={});var s=T[r];if(s)e[s[0]]=s[1];else for(var n=t(r),a=n.length-1;a>=0;a--){var o=n[a],l=null==o?void 0:o.filename,u=i[r];if(l&&u){e[l]=u,T[r]=[l,u];break}}return e},{}))}}class Q{constructor(t,i,e){void 0===e&&(e=[]),this.coercers=t,this.stackParser=i,this.modifiers=e}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(i),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,e),$exception_level:"error"}}modifyFrames(t){var e=this;return i(function*(){for(var i of t)i.stacktrace&&i.stacktrace.frames&&u(i.stacktrace.frames)&&(i.stacktrace.frames=yield e.applyModifiers(i.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 r,s;return null!=t.cause&&(r=this.parseStacktrace(t.cause,i)),""!=t.stack&&null!=t.stack&&(s=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?i.skipFirstLines:0),i.chunkIdMap)),e({},t,{cause:r,stack:s})}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 e=this;return i(function*(){var i=t;for(var r of e.modifiers)i=yield r(i);return i})()}convertToExceptionList(t,i){var r,s,n,a={type:t.type,value:t.value,mechanism:{type:null!==(r=i.type)&&void 0!==r?r:"generic",handled:null===(s=i.handled)||void 0===s||s,synthetic:null!==(n=t.synthetic)&&void 0!==n&&n}};t.stack&&(a.stacktrace={type:"raw",frames:t.stack});var o=[a];return null!=t.cause&&o.push(...this.convertToExceptionList(t.cause,e({},i,{handled:!0}))),o}buildParsingContext(t){var i;return{chunkIdMap:Z(this.stackParser),skipFirstLines:null!==(i=t.skipFirstLines)&&void 0!==i?i:1}}buildCoercingContext(t,i,r){void 0===r&&(r=0);var s=(e,r)=>{if(4>=r){var s=this.buildCoercingContext(t,i,r);return this.applyCoercers(e,s)}};return e({},i,{syntheticException:0==r?i.syntheticException:void 0,mechanism:t,apply:t=>s(t,r),next:t=>s(t,r+1)})}}var Y="?";function tt(t,i,e,r,s){var n={platform:t,filename:i,function:"<anonymous>"===e?Y:e,in_app:!!i&&!i.startsWith("webkit-masked-url://")&&"<anonymous>"!==i};return c(r)||(n.lineno=r),c(s)||(n.colno=s),n}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]:Y,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,i)=>{var e=et.exec(t);if(e)return tt(i,e[1],Y,+e[2],+e[3]);var r=rt.exec(t);if(r){if(r[2]&&0===r[2].indexOf("eval")){var s=st.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}var n=it(r[1]||Y,r[2]);return tt(i,n[1],n[0],r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},at=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,ot=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,lt=(t,i)=>{var e=at.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){var r=ot.exec(e[3]);r&&(e[1]=e[1]||"eval",e[3]=r[1],e[4]=r[2],e[5]="")}var s=e[3],n=e[1]||Y,a=it(n,s);return tt(i,s=a[1],n=a[0],e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},ut=/\(error: (.*)\)/;function ht(t,i){return t.filename===i.filename&&t.function===i.function&&t.module===i.module&&t.lineno===i.lineno&&t.colno===i.colno}function vt(t){for(var i=1;10>=i;i++){var e=t.length-2*i;if(0>e)break;for(var r=!0,s=0;i>s;s++)if(!ht(t[e+s],t[e+i+s])){r=!1;break}if(r){for(var n=0;i>n;n++)t[e+n]=t[e+i+n];return t.length=e+i,{start:e,length:i}}}}function dt(t,i){var e=i.start+i.length,r=ft(t,i);r&&t.splice(e+r===t.length?e:i.start,r)}function ct(t,i){for(var e=i.start;e>0&&ht(t[e-1],t[e-1+i.length]);)e--;return i.start-e}function ft(t,i){for(var e=i.start+i.length,r=e;t.length>r&&ht(t[r],t[r-i.length]);)r++;return r-e}function pt(t,i){var e=i[0],r=t.length-(e?ct(t,e):0);for(var s of i)r-=ft(t,s);return r}function gt(t,i,e){for(var r=0;t.length>r;r++){var s=t[(i+r)%t.length],n=t[(e+r)%t.length];if(s!==n)return n>s}return!1}class _t{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,i){var e=f(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 w(t,"DOMException")}isDOMError(t){return w(t,"DOMError")}}class bt{match(t){return S(t)}coerce(t,i){var e,r=this.getStack(t),s=void 0===r;return{type:this.getType(t),value:this.getMessage(t,i),stack:null!=r?r:null==(e=i.syntheticException)?void 0:e.stack,cause:t.cause?i.next(t.cause):void 0,synthetic:s}}getType(t){return t.name||t.constructor.name}getMessage(t,i){var e=t.message;return String(e.error&&"string"==typeof e.error.message?e.error.message:e)}getStack(t){return t.stacktrace||t.stack||void 0}}class mt{match(t){return!!w(t,"ErrorEvent")&&(null!=t.error||this.m(t))}coerce(t,i){var r;if(null!=t.error)return i.apply(t.error);var s=i.apply(t.message);return e({},s,{stack:null!==(r=this.S(t))&&void 0!==r?r:s.stack,synthetic:!0})}m(t){return f(t.message)&&t.message.length>0}S(t){var i,e,r=t,s=null!==(i=r.lineno)&&void 0!==i?i:0,n=null!==(e=r.colno)&&void 0!==e?e:0;if(f(r.filename)&&0!==r.filename.length&&0!==s)return"Error\n at "+r.filename+":"+s+":"+n}}var yt=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class wt{match(t){return"string"==typeof t}coerce(t,i){var e,r=this.getInfos(t),s=r[0],n=r[1];return{type:null!=s?s:"Error",value:null!=n?n:t,stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}getInfos(t){var i="Error",e=t,r=t.match(yt);return r&&(i=r[1],e=r[2]),[i,e]}}var St=["fatal","error","warning","log","info","debug"];function kt(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(i>=s.length)return r===e.length?s:s.length>i?s.slice(0,i)+"...":s}return""}class xt{match(t){return"object"==typeof t&&null!==t}coerce(t,i){var e,r,s=this.getErrorPropertyFromObject(t);return s?i.apply(s):{type:this.getType(t),value:this.getValue(t),stack:null!==(e=this.getStack(t))&&void 0!==e?e:null==(r=i.syntheticException)?void 0:r.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){if(k(t))return t.constructor.name;var i="name"in t?t.name:void 0;return f(i)&&!p(i)?i:"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: "+kt(t)}isSeverityLevel(t){return f(t)&&!p(t)&&St.indexOf(t)>=0}getStack(t){try{return f(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:f(t.stack)&&t.stack.length>0?t.stack:void 0}catch(t){return}}getErrorPropertyFromObject(t){for(var i in t)if({}.hasOwnProperty.call(t,i)){var e=t[i];if(S(e))return e}}getObjectClassName(t){try{var i=Object.getPrototypeOf(t);return i?i.constructor.name:void 0}catch(t){return}}}class Et{match(t){return k(t)}coerce(t,i){var e,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+kt(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}class Ft{match(t){return y(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 Pt{match(t){return w(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!k(t))return!1;try{var i=t.detail;return null!=i&&"object"==typeof i&&"reason"in i}catch(t){return!1}}coerce(t,i){var e,r=this.getUnhandledRejectionReason(t);return y(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){try{if("reason"in t)return t.reason;if("detail"in t&&null!=t.detail&&"object"==typeof t.detail&&"reason"in t.detail)return t.detail.reason}catch(t){}return t}}var Ct="$message",Tt="$timestamp",Rt=new Set([Ct,Tt]),At={enabled:!0,max_bytes:32768};function Ot(t){var i;return t?{enabled:null!==(i=t.enabled)&&void 0!==i?i:At.enabled,max_bytes:It(t.max_bytes,At.max_bytes)}:e({},At)}class Mt{constructor(t){this.k=[],this.F=0,this.P=Ot(t)}setConfig(t){this.P=Ot(t),this.C()}add(t){var i=function(t){var i,e,r;try{r=[],i=null!==(e=JSON.stringify(t,function(t,i){if("bigint"==typeof i)return i.toString();if("function"!=typeof i&&"symbol"!=typeof i){if(i instanceof Error)return{name:i.name,message:i.message,stack:i.stack};if(i&&"object"==typeof i){for(;r.length>0&&r[r.length-1]!==this;)r.pop();if(r.includes(i))return"[Circular]";r.push(i)}return i}}))&&void 0!==e?e:"null"}catch(t){return}try{var s=JSON.parse(i);if(!v(s))return;var n=s,a=n[Ct],o=n[Tt];if(!f(a)||0===a.trim().length)return;if(!f(o)&&!b(o))return;return{step:n,json:i}}catch(t){return}}(t);if(i){var e=function(t){if("u">typeof TextEncoder)return(new TextEncoder).encode(t).length;for(var i=encodeURIComponent(t),e=0,r=0;i.length>r;r++)"%"===i[r]?(e+=1,r+=2):e+=1;return e}(i.json);e>this.P.max_bytes||(this.k.push({step:i.step,bytes:e}),this.F+=e,this.C())}}getAttachable(){return this.k.map(t=>t.step)}clear(){this.k=[],this.F=0}size(){return this.k.length}C(){for(;this.F>this.P.max_bytes&&this.k.length>0;){var t=this.k.shift();t&&(this.F-=t.bytes)}}}function It(t,i){if(!b(t)||1/0===t||-1/0===t)return i;var e=Math.floor(t);return 0>e?i:e}var $t=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(i){return t}};function jt(t){return"string"==typeof t||t}function Lt(t){return"string"==typeof t?t:void 0}var Dt=0x8000000000000000,Nt={}.propertyIsEnumerable;function zt(t,i){try{return Ut(t,i,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch(t){return[]}}function Bt(t,i,e,r){if(0>=e.remainingNodes)return{stringValue:V};if(e.remainingNodes--,m(t))return{boolValue:t};if("bigint"==typeof t)return function(t,i){var e=t.toString(),r=BigInt("9223372036854775808");return t>=r||-r>t?(null==i||i.debug("Attribute "+e+" is outside the int64 range; encoding it as a string"),{stringValue:e}):{intValue:e}}(t,i);if("number"==typeof t){if(!Number.isFinite(t))return{stringValue:String(t)};if(Number.isInteger(t)){if(Number.isSafeInteger(t))return{intValue:String(t)};if(typeof BigInt>"u")return{stringValue:String(t)};var s=BigInt(t).toString();return t>=Dt||-Dt>t?(null==i||i.debug("Attribute "+s+" is outside the int64 range; encoding it as a string"),{stringValue:s}):{intValue:s}}return{doubleValue:t}}if("string"==typeof t)return{stringValue:W(t)};if("function"==typeof t)return{stringValue:"[Function]"};if("symbol"==typeof t)return{stringValue:String(t)};if("object"==typeof t&&null!==t){if(e.ancestors.has(t))return{stringValue:"[Circular]"};if(r>=20)return{stringValue:V};if(t instanceof Date){var n=t.getTime(),a=Number.isFinite(n)?t.toISOString():String(t);return{stringValue:"string"==typeof a?W(a):String(a)}}e.ancestors.add(t);try{try{var o=t.toJSON;if("function"==typeof o)return Bt(o.call(t),i,e,r+1)}catch(t){}return u(t)?{arrayValue:{values:Ht(t,i,e,r+1)}}:{kvlistValue:{values:Ut(t,i,e,r+1)}}}finally{e.ancestors.delete(t)}}return{stringValue:W(String(t))}}function Ht(t,i,e,r){for(var s=[],n=Math.min(t.length,1e3),a=0;n>a&&e.remainingNodes>0;a++)try{var o=a in t?t[a]:void 0;if(_(o))continue;s.push(Bt(o,i,e,r))}catch(t){s.push({stringValue:q})}return t.length>a&&s.push({stringValue:V}),s}function Ut(t,i,e,r){var s=[];for(var n in t)if(Nt.call(t,n)){if(!n){null==i||i.debug("Dropping an attribute with an empty key");continue}if(s.length>=1e3||0>=e.remainingNodes){null==i||i.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{var a=t[n];if(g(a)||c(a))continue;s.push({key:W(n),value:Bt(a,i,e,r)})}catch(t){s.push({key:W(n),value:{stringValue:q}})}}return s}function Vt(t,i,r){return e({},t.resourceAttributes,{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment},t.serviceVersion&&{"service.version":t.serviceVersion},{"telemetry.sdk.name":i,"telemetry.sdk.version":r})}var qt={darwin:"macOS",win32:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",aix:"AIX","Mac OS X":"macOS"};var Wt={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},Kt=Wt.info;function Jt(t){try{return W(String(t))}catch(t){return q}}function Gt(t,i,r,s){var n,a=Wt[t.level||"info"]||Kt,o=a.text,l=a.number,u=(void 0===(n=b(s)?s:void 0)&&(n=Date.now()),String(n)+"000000"),h={};i.distinctId&&(h.posthogDistinctId=i.distinctId),i.sessionId&&(h.sessionId=i.sessionId),i.windowId&&(h["window.id"]=i.windowId),_(i.sessionStartTimestamp)||(h.sessionStartTimestamp=String(i.sessionStartTimestamp)),_(i.lastActivityTimestamp)||(h.lastActivityTimestamp=String(i.lastActivityTimestamp)),i.currentUrl&&(h["url.full"]=i.currentUrl),i.screenName&&(h["screen.name"]=i.screenName),i.appState&&(h["app.state"]=i.appState),i.activeFeatureFlags&&i.activeFeatureFlags.length>0&&(h.feature_flags=i.activeFeatureFlags);var v=e({},h),d=t.attributes;if(d){var f=[];try{f=Object.keys(d)}catch(t){f=[]}for(var p of f){var g=void 0;try{g=d[p]}catch(t){g=q}Object.defineProperty(v,p,{value:g,enumerable:!0,writable:!0,configurable:!0})}}var m={timeUnixNano:u,observedTimeUnixNano:u,severityNumber:l,severityText:o,body:{stringValue:Jt(t.body)},attributes:zt(v,r)};return t.trace_id&&(m.traceId=t.trace_id),t.span_id&&(m.spanId=t.span_id),c(t.trace_flags)||(m.flags=t.trace_flags),m}function Xt(t,i,e){return Vt(t,i,e)}function Zt(t,i,e,r){return{resourceLogs:[{resource:{attributes:zt(i)},scopeLogs:[{scope:{name:e,version:r},logRecords:t}]}]}}let Qt=class{constructor(t,i,e,r,s,n,a){var o;void 0===n&&(n=()=>Promise.resolve()),this._instance=t,this.P=i,this.l=e,this.T=r,this.R=s,this.A=n,this.O=a,this.M=null,this.I=0,this.$=0,this.j=0,this.L=0,this.D=0,this.N=!1,this.B=i.maxBufferSize,this.H=Math.max(null!==(o=i.maxQueueSize)&&void 0!==o?o:i.maxBufferSize,i.maxBufferSize),this.U=i.flushIntervalMs,this.V=i.maxBatchRecordsPerPost,this.q=i.rateCapWindowMs,this.W=i.maxLogsPerInterval}clearQueue(){this.$++,this._instance.setPersistedProperty(r.LogsQueue,[])}reset(){this.K(),this.L=0,this.D=0,this.N=!1,this.j=0,this.V=this.P.maxBatchRecordsPerPost}onReconnect(){this.j=0,this.J()}captureLog(t,i){var e;if(!this._instance.isDisabled&&!this._instance.optedOut&&null!=t&&t.body){var r=this.G(t);if(null!==r)if(r.body){if(this.X()){var s={record:Gt(r,null!==(e=null==i?void 0:i.context)&&void 0!==e?e:this.T(),this.l,null==i?void 0:i.occurredAtMs)};this.R(()=>this.Z(s))}}else this.l.info("Log was rejected in beforeSend function")}}G(t){var i=this.P.beforeSend;if(!i)return t;var e=u(i)?i:[i],r=t;for(var s of e)try{var n=s(r);if(!n)return this.l.info("Log was rejected in beforeSend function"),null;r=n}catch(t){return this.l.error("Error in beforeSend function for log:",t),null}return r}X(){if(void 0===this.W)return!0;var t=Date.now(),i=t-this.L;return this.q>i&&i>=0||(this.L=t,this.D=0,this.N=!1),this.W>this.D?(this.D++,!0):(this.N||(this.l.warn("captureLog dropping logs: exceeded "+this.W+" logs per "+this.q+"ms"),this.N=!0),!1)}flush(){var t=this;return i(function*(){if(!t._instance.isDisabled)return t.M||(t.M=t.Y().finally(()=>{t.M=null})),t.M})()}Y(){var t=this;return i(function*(){var i;t.K();var e=null!==(i=t._instance.getPersistedProperty(r.LogsQueue))&&void 0!==i?i:[];if(0!==e.length)for(var s=e.length,n=0;e.length>0&&s>n;){var a,o,l=t.$;t.I=0;var u=Math.min(e.length,t.V),h=e.slice(0,u),v=Zt(h.map(t=>t.record),t.tt(),null!==(a=t.O)&&void 0!==a?a:t._instance.getLibraryId(),t._instance.getLibraryVersion()),d=yield t._instance.it(v);if(t.$!==l)return;if("too-large"===d.kind&&h.length>1)t.V=Math.max(1,Math.floor(h.length/2)),t.l.warn("Received 413 when sending logs batch of size "+h.length+", reducing batch size to "+t.V);else{if("retry-later"===d.kind)throw d.error;if("too-large"===d.kind?t.l.warn("Dropping a single log record after 413 with batch size 1 — the record is larger than the server cap and cannot be split further."):"ok"===d.kind&&t.P.maxBatchRecordsPerPost>t.V&&(t.V=Math.min(t.P.maxBatchRecordsPerPost,t.V+1)),yield t.et(h.length),e=null!==(o=t._instance.getPersistedProperty(r.LogsQueue))&&void 0!==o?o:[],n+=h.length,"fatal"===d.kind)throw d.error}}})()}et(t){var e=this;return i(function*(){var i,s=Math.max(0,t-e.I),n=null!==(i=e._instance.getPersistedProperty(r.LogsQueue))&&void 0!==i?i:[];e._instance.setPersistedProperty(r.LogsQueue,n.slice(s)),yield e.A()})()}tt(){return Xt(this.P,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Z(t){var i;if(!this._instance.optedOut){var e=null!==(i=this._instance.getPersistedProperty(r.LogsQueue))&&void 0!==i?i:[];this.H>e.length||(e.shift(),this.I++,this.l.info("Logs queue is full, dropping oldest record.")),e.push(t),this._instance.setPersistedProperty(r.LogsQueue,e),this.B>e.length?this.rt():this.J()}}rt(t){void 0===t&&(t=this.U),this.st||(this.st=J(()=>{this.st=void 0,this.J()},t))}nt(){var t=Math.min(Math.max(0,this.j-1),6);return this.U*Math.pow(2,t)}ot(){var t=this._instance.getPersistedProperty(r.LogsQueue);return!!t&&t.length>0}shutdown(t){var e=this;return i(function*(){e.K();var i=e.flush().catch(()=>{});void 0!==t?yield G(i,t):yield i})()}flushWithTimeout(t){var e=this;return i(function*(){var i=e.flush();yield G(i,t,()=>{i.catch(()=>{})})})()}J(){this.flush().then(()=>{this.j=0},t=>{this.j++,this.l.error("PostHog logs flush failed:",t)}).finally(()=>{!this._instance.isDisabled&&this.ot()&&this.rt(this.nt())})}K(){this.st&&(clearTimeout(this.st),this.st=void 0)}};var Yt=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function ti(t){return String(t)+"000000"}function ii(t,i,e,r){var s="";return r&&(s=Object.keys(r).sort().map(t=>JSON.stringify(t)+":"+JSON.stringify(r[t])).join(",")),t+"\0"+i+"\0"+(null!=e?e:"")+"\0"+s}let ei=class{constructor(t,i,e){this._instance=t,this.P=i,this.l=e,this.ut=new Map,this.M=null,this.ht=!1,this.vt=new Map,this.dt=new Set,this.ct=0}count(t,i,e){void 0===i&&(i=1),this.ft({name:t,type:"count",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}gauge(t,i,e){this.ft({name:t,type:"gauge",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}histogram(t,i,e){this.ft({name:t,type:"histogram",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}flush(){var t=this,e=this.M,r=function(){var r=i(function*(){e&&(yield e.catch(()=>{})),yield t._t()});return function(){return r.apply(this,arguments)}}(),s=r().finally(()=>{this.M===s&&(this.M=null)});return this.M=s,s}drainWindow(){if(0===this.ut.size)return null;var t=this.ut;return this.ut=new Map,this.ht=!1,this.vt=new Map,this.dt=new Set,this.bt(t)}reset(){this.ct++,this.K(),this.ut=new Map,this.M=null,this.ht=!1,this.vt=new Map,this.dt=new Set}ft(t){if(!this._instance.isDisabled&&!this._instance.optedOut){var i=this.G(t);if(null!==i)if(i.name&&"string"==typeof i.name)if("number"==typeof i.value&&Number.isFinite(i.value))if("count"===i.type&&0>i.value)this.l.warn("Dropping count '"+i.name+"': counters are monotonic, value must be >= 0");else{var r,s;try{r=i.attributes?e({},i.attributes):void 0,s=ii(i.type,i.name,i.unit,r)}catch(t){return void this.l.warn("Dropping metric '"+i.name+"': attributes could not be serialized",t)}var n=this.ut.get(s);if(!n){if(!this.yt())return;n={name:i.name,type:i.type,unit:i.unit,attributes:r,windowStartMs:Date.now()},this.ut.set(s,n)}var a=this.vt.get(i.name);void 0===a?this.vt.set(i.name,i.type):a===i.type||this.dt.has(i.name)||(this.dt.add(i.name),this.l.warn("Metric name '"+i.name+"' is already used as a "+a+"; recording it as a "+i.type+" too will blend both series in charts. Use a distinct name.")),this.wt(n,i.value),this.rt()}else this.l.warn("Dropping metric '"+i.name+"': value must be a finite number");else this.l.warn("Dropping metric with empty name")}}yt(){return this.P.maxSeriesPerFlush>this.ut.size||(this.ht||(this.ht=!0,this.l.warn("Metric series cap reached ("+this.P.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}wt(t,i){var e;switch(t.type){case"count":t.total=(null!==(e=t.total)&&void 0!==e?e:0)+i;break;case"gauge":t.last=i;break;case"histogram":t.hist||(t.hist={count:0,sum:0,min:i,max:i,bucketCounts:new Array(Yt.length+1).fill(0)});var r=t.hist;r.count+=1,r.sum+=i,r.min=Math.min(r.min,i),r.max=Math.max(r.max,i),r.bucketCounts[function(t,i){for(var e=0;i.length>e;e++)if(i[e]>=t)return e;return i.length}(i,Yt)]+=1}}G(t){var i=this.P.beforeSend;if(!i)return t;var e=u(i)?i:[i],r=t;for(var s of e)try{var n=s(r);if(!n)return this.l.info("Metric was rejected in beforeSend function"),null;r=n}catch(t){return this.l.error("Error in beforeSend function for metric:",t),null}return r}rt(){this.st||(this.st=J(()=>{this.st=void 0,this.flush().catch(t=>{this.l.error("Metrics flush failed:",t)})},this.P.flushIntervalMs))}K(){this.st&&(clearTimeout(this.st),this.st=void 0)}_t(){var t=this;return i(function*(){if(0!==t.ut.size){var i=t.ut;t.ut=new Map,t.ht=!1,t.vt=new Map,t.dt=new Set;var e=t.ct,r=yield t._instance.St(t.bt(i));if(e===t.ct)switch(r.kind){case"ok":return;case"retry-later":return t.kt(i),void t.rt();case"too-large":return void t.l.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.l.error("Failed to send metrics batch:",r.error)}}})()}bt(t){return i=this.xt(t),e=function(t,i,e){return Vt(t,i,e)}(this.P,this._instance.getLibraryId(),this._instance.getLibraryVersion()),r=this._instance.getLibraryId(),s=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:zt(e)},scopeMetrics:[{scope:{name:r,version:s},metrics:i}]}]};var i,e,r,s}xt(t){var i=ti(Date.now()),r=new Map;for(var s of t.values()){var n,a=ii(s.type,s.name,s.unit,void 0),o=r.get(a);o||(o=e({name:s.name},s.unit&&{unit:s.unit}),"count"===s.type?o.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===s.type?o.gauge={dataPoints:[]}:o.histogram={aggregationTemporality:1,dataPoints:[]},r.set(a,o));var l=zt(null!==(n=s.attributes)&&void 0!==n?n:{},this.l),u=ti(s.windowStartMs);if("count"===s.type){var h,v={attributes:l,startTimeUnixNano:u,timeUnixNano:i,asDouble:null!==(h=s.total)&&void 0!==h?h:0};o.sum.dataPoints.push(v)}else if("gauge"===s.type){var d,c={attributes:l,timeUnixNano:i,asDouble:null!==(d=s.last)&&void 0!==d?d:0};o.gauge.dataPoints.push(c)}else s.hist&&o.histogram.dataPoints.push({attributes:l,startTimeUnixNano:u,timeUnixNano:i,count:s.hist.count,sum:s.hist.sum,min:s.hist.min,max:s.hist.max,bucketCounts:s.hist.bucketCounts,explicitBounds:Yt})}return Array.from(r.values())}kt(t){var i,e;for(var r of t){var s=r[0],n=r[1],a=this.ut.get(s);if(a)switch(a.windowStartMs=Math.min(a.windowStartMs,n.windowStartMs),a.type){case"count":a.total=(null!==(i=a.total)&&void 0!==i?i:0)+(null!==(e=n.total)&&void 0!==e?e:0);break;case"gauge":break;case"histogram":if(n.hist)if(a.hist){a.hist.count+=n.hist.count,a.hist.sum+=n.hist.sum,a.hist.min=Math.min(a.hist.min,n.hist.min),a.hist.max=Math.max(a.hist.max,n.hist.max);for(var o=0;a.hist.bucketCounts.length>o;o++)a.hist.bucketCounts[o]+=n.hist.bucketCounts[o]}else a.hist=n.hist}else this.yt()&&this.ut.set(s,n)}}};var ri={DEBUG:!1,LIB_VERSION:"0.8.2",LIB_NAME:"browser-common"},si="u">typeof window?window:void 0,ni="u">typeof globalThis?globalThis:si,ai=null==ni?void 0:ni.navigator,oi=null==ni?void 0:ni.document,li=null==ni?void 0:ni.location;function ui(){return!(!si||!1===si.navigator.onLine)}null!=ni&&ni.XMLHttpRequest&&new ni.XMLHttpRequest;var hi=function(t,i){var e=(void 0===i?{}:i).debugEnabled,r={Et(i){if(si&&(ri.DEBUG||si.POSTHOG_DEBUG||e)&&!c(si.console)&&si.console){for(var r=("__rrweb_original__"in si.console[i]?si.console[i].__rrweb_original__:si.console[i]),s=arguments.length,n=new Array(s>1?s-1:0),a=1;s>a;a++)n[a-1]=arguments[a];r(t,...n)}},debug(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.Et("debug",...i)},info(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.Et("log",...i)},warn(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.Et("warn",...i)},error(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.Et("error",...i)},critical(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];console.error(t,...e)},uninitializedWarning(t){r.error("You must initialize PostHog before calling "+t)},createLogger:(i,e)=>hi(t+" "+i,e)};return r},vi=hi("[PostHog.js]"),di=vi.createLogger;function ci(t,i){if(!_(t))if(u(t))t.forEach(i);else if(t instanceof FormData)t.forEach((t,e)=>i(t,e));else for(var e in t)o.call(t,e)&&i(t[e],e)}var fi=function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;i>r;r++)e[r-1]=arguments[r];for(var s of e)for(var n in s)void 0!==s[n]&&(t[n]=s[n]);return t};function pi(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 gi=function(t){try{return t()}catch(t){return}};function _i(t,i,e,r){var s=null!=r?r:{},n=s.capture,a=s.passive;null==t||t.addEventListener(i,e,{capture:void 0!==n&&n,passive:void 0===a||a})}function bi(t){return"ph_toolbar_internal"===t.name}function mi(t,i){var e,r=null==t||null==(e=t.config)?void 0:e.get_current_url;if(!h(r))return i;try{var s=r(i);return f(s)&&s?s:i}catch(t){return vi.error("Error in get_current_url, falling back to window.location.href",t),i}}var yi="__POSTHOG_TOOLBAR__";function wi(t){return t instanceof Element&&(t.id===yi||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function Si(t){return!!t&&1===t.nodeType}function ki(t,i){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===i.toLowerCase()}function xi(t){return!!t&&3===t.nodeType}function Ei(t){return!!t&&11===t.nodeType&&Si(t.host)}var Fi=1e3;function Pi(t){return t?n(t).split(/\s+/):[]}function Ci(t,i){var e=function(t){var i,e=null==si||null==(i=si.location)?void 0:i.href;return c(e)?void 0:mi(t,e)}(i);return!!(e&&t&&t.some(t=>e.match(t)))}function Ti(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 Pi(i)}function Ri(t){return _(t)?null:n(t).split(/(\s+)/).filter(t=>te(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Ai(t){var i="";return qi(t)&&!Wi(t)&&t.childNodes&&t.childNodes.length&&ci(t.childNodes,function(t){var e;xi(t)&&t.textContent&&(i+=null!==(e=Ri(t.textContent))&&void 0!==e?e:"")}),n(i)}function Oi(t){var i;return c(t.target)?t.srcElement||null:null!=(i=t.target)&&i.shadowRoot?t.composedPath()[0]||null:t.target||null}var Mi=["a","button","form","input","select","textarea","label"];function Ii(t,i){var e=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector;try{return!!e&&e.call(t,i)}catch(t){return!1}}function $i(t,i){if(c(i))return!0;var e,r=function(t){if(i.some(i=>Ii(t,i)))return{v:!0}};for(var s of t)if(e=r(s))return e.v;return!1}function ji(t){var i=t.parentNode;return!(!i||!Si(i))&&i}var Li=[".ph-no-autocapture","[data-ph-no-autocapture]"],Di=["next","previous","prev",">","<"],Ni=(t,i)=>/[a-z0-9]/i.test(i)?t.includes(i):t===i,zi=[".ph-no-rageclick",".ph-no-capture"],Bi=["","text","search","email","password","url","tel","number"];function Hi(t,i){if(!si||Ui(t))return!1;var e,r,n,a,o;if(m(i)?(e=!!i&&zi,r=void 0,n=!1):(e=null!==(a=null==i?void 0:i.css_selector_ignorelist)&&void 0!==a?a:zi,r=null==i?void 0:i.content_ignorelist,n=null!==(o=null==i?void 0:i.ignore_text_selection)&&void 0!==o&&o),!1===e)return!1;if(n&&function(t){return!(!t||!Si(t))&&(!!ki(t,"textarea")||(ki(t,"input")?s(Bi,(t.getAttribute("type")||"").toLowerCase()):function(t){if(t.isContentEditable)return!0;var i=null==t.getAttribute?void 0:t.getAttribute("contenteditable");return"true"===i||""===i}(t)))}(t))return!1;var l=Vi(t,!1).targetElementList;return!function(t,i){if(!1===t||c(t))return!1;var e;if(!0===t)e=Di;else{if(!u(t))return!1;if(t.length>10)return vi.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;e=t.map(t=>t.toLowerCase())}return i.some(t=>{var i=t.safeText,r=t.ariaLabel;return e.some(t=>Ni(i,t)||Ni(r,t))})}(r,l.map(t=>{var i;return{safeText:Ai(t).toLowerCase(),ariaLabel:(null==(i=t.getAttribute("aria-label"))?void 0:i.toLowerCase().trim())||""}}))&&!$i(l,e)}var Ui=t=>!t||ki(t,"html")||!Si(t),Vi=(t,i)=>{if(!si||Ui(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var e=!1,r=[t],s=t;s.parentNode&&!ki(s,"body");)if(Ei(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var n=ji(s);if(!n)break;if(i||Mi.indexOf(n.tagName.toLowerCase())>-1)e=!0;else try{var a=si.getComputedStyle(n);a&&"pointer"===a.getPropertyValue("cursor")&&(e=!0)}catch(t){}r.push(n),s=n}return{parentIsUsefulElement:e,targetElementList:r}};function qi(t){for(var i=new Set,e=0,r=t;r.parentNode&&!ki(r,"body");r=r.parentNode){if(e++>=Fi||i.has(r))return!1;i.add(r);var n=Ti(r);if(s(n,"ph-sensitive")||s(n,"ph-no-capture"))return!1}if(s(Ti(t),"ph-include"))return!0;var a=t.type||"";if(f(a))switch(a.toLowerCase()){case"hidden":case"password":return!1}var o=t.name||t.id||"";return!f(o)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(o.replace(/[^a-zA-Z0-9]/g,""))}function Wi(t){return!!(ki(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||ki(t,"select")||ki(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var Ki=new RegExp("^(?:(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}))$"),Ji=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Gi=[16,15,14,13],Xi=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Zi=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Qi=/[0-9A-Za-z_]/;function Yi(t){for(var i=0,e=!1,r=t.length-1;r>=0;r--){var s=t.charCodeAt(r)-48;e&&(s*=2)>9&&(s-=9),i+=s,e=!e}return i%10==0}function te(t,i){if(void 0===i&&(i=!0),_(t))return!1;if(f(t)){t=n(t);var e=i?Ki.test((t||"").replace(/[- ]/g,"")):function(t){var i;for(Ji.lastIndex=0;i=Ji.exec(t);){var e=i[2];if(e)for(var r=e.replace(/[- ]/g,""),s=0;r.length>s;s++)for(var n of Gi){var a=s+n;if(r.length>=a){var o=r.slice(s,a);if(Ki.test(o)&&Yi(o))return!0}}}return!1}(t);if(e)return!1;var r=i?Xi.test(t):function(t){var i;for(Zi.lastIndex=0;i=Zi.exec(t);){var e=i[1],r=i[3];if(!(e&&r&&Qi.test(e)&&Qi.test(r)))return!0}return!1}(t);if(r)return!1}return!0}function ie(t){var i=Ai(t);return te(i=(i+" "+ee(t)).trim())?i:""}function ee(t){var i="";return t&&t.childNodes&&t.childNodes.length&&ci(t.childNodes,function(t){var e;if(t&&"span"===(null==(e=t.tagName)?void 0:e.toLowerCase()))try{var r=Ai(t);i=(i+" "+r).trim(),t.childNodes&&t.childNodes.length&&(i=(i+" "+ee(t)).trim())}catch(t){vi.error("[AutoCapture]",t)}}),i}function re(t){return t.replace(/"|\\"/g,'\\"')}function se(t){var i=t.attr__class;if(i)return u(i)?i:Pi(i)}class ne{constructor(t){this.disabled=!1===t;var i=v(t)?t:{};this.thresholdPx=i.threshold_px||30,this.timeoutMs=i.timeout_ms||1e3,this.clickCount=i.click_count||3,this.clicks=[]}isRageClick(t,i,e){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(t-r.x)+Math.abs(i-r.y)<this.thresholdPx&&this.timeoutMs>e-r.timestamp){if(this.clicks.push({x:t,y:i,timestamp:e}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:i,timestamp:e}];return!1}}var ae="$autocapture_disabled_server_side",oe="$heatmaps_enabled_server_side",le="$exception_capture_enabled_server_side",ue="$error_tracking_suppression_rules",he="$error_tracking_capture_extension_exceptions",ve="$web_vitals_enabled_server_side",de="$dead_clicks_enabled_server_side",ce="$product_tours_enabled_server_side",fe="$logs_capture_enabled_server_side",pe="$web_vitals_allowed_metrics",ge="$session_recording_remote_config",_e="$replay_override_sampling",be="$replay_override_linked_flag",me="$enabled_feature_flags",ye="$active_feature_flags",we="$early_access_features",Se="$feature_flag_details",ke="$feature_flag_payloads",xe="$feature_flag_request_id",Ee="$minimal_flag_called_events",Fe="$override_feature_flags",Pe="$override_feature_flag_payloads",Ce="$stored_person_properties",Te="$stored_group_properties",Re="$surveys",Ae="$surveys_loaded_at",Oe="$surveys_activated",Me="$surveys_activated_session",Ie="$surveys_activated_timestamps",$e="ph_product_tours",je="$flag_call_reported",Le="$flag_call_reported_session_id",De="$feature_flag_errors",Ne="$feature_flag_evaluated_at",ze="$sdk_debug_recording_script_not_loaded",Be=3e5,He=Be,Ue="PostHog loadExternalDependency extension not found.",Ve="visibilitychange",qe="beforeunload",We=function(t,i){for(var e,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===i){e=n;break}}if(!u(e)||2>e.length)return"";var a=e[1];try{a=decodeURIComponent(a)}catch(t){vi.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},Ke=function(t,i,e){if(!t||!i||!i.length)return t;for(var r=t.split("#"),s=r[1],n=(r[0]||"").split("?"),a=n[1],o=n[0],l=(a||"").split("&"),h=[],v=0;l.length>v;v++){var d=l[v].split("=");u(d)&&(i.includes(d[0])?h.push(d[0]+"="+e):h.push(l[v]))}var c=o;return null!=a&&(c+="?"+h.join("&")),null!=s&&(c+="#"+s),c},Je=function(t,i){var e=t.match(new RegExp(i+"=([^&]*)"));return e?e[1]:null},Ge=(t,i)=>t>=i&&ui(),Xe=(t,i,e,r)=>{if(0===t){if(ui()){var s=i+1;return s===e&&r(),s}return i}return 0},Ze="$copy_autocapture",Qe=di("[AutoCapture]");function Ye(t,i){return i.length>t?i.slice(0,t)+"...":i}function tr(t){if(t.previousElementSibling)return t.previousElementSibling;var i=t;do{i=i.previousSibling}while(i&&!Si(i));return i}function ir(t,i){var r,n,a=i.e,o=i.maskAllElementAttributes,l=i.maskAllText,h=i.elementAttributeIgnoreList,v=i.elementsChainAsString,d=i.disableCaptureUrlHashes;if(!Si(t))return{props:{}};for(var p=[t],g=new Set([t]),_=t;_.parentNode&&!ki(_,"body")&&Fi>p.length;)if(Ei(_.parentNode)){var b=_.parentNode.host;if(g.has(b))break;g.add(b),p.push(b),_=b}else{if(!Si(_.parentNode))break;if(g.has(_.parentNode))break;g.add(_.parentNode),p.push(_.parentNode),_=_.parentNode}var m="click"===a.type&&"http://www.w3.org/2000/svg"===t.namespaceURI?p.findIndex(t=>ki(t,"button")||ki(t,"a")):-1;m>0&&(l=l||p.slice(0,m+1).some(t=>!qi(t)||Wi(t)));var y,w,S=[],k={},x=!1,E=!1;if(ci(p,t=>{var i=qi(t);if(ki(t,"a")){var e=t.getAttribute("href");x=!!(i&&e&&te(e))&&(d?K(e):e)}s(Ti(t),"ph-no-capture")&&(E=!0),S.push(function(t,i,e,r,s){void 0===s&&(s=!1);var n=t.tagName.toLowerCase(),a={tag_name:n};Mi.indexOf(n)>-1&&!e&&(a.$el_text="a"===n.toLowerCase()||"button"===n.toLowerCase()?Ye(1024,ie(t)):Ye(1024,Ai(t)));var o=Ti(t);o.length>0&&(a.classes=o.filter(function(t){return""!==t})),ci(t.attributes,function(e){var n;if((!Wi(t)||-1!==["name","id","class","aria-label"].indexOf(e.name))&&(null==r||!r.includes(e.name))&&!i&&te(e.value)&&(!f(n=e.name)||"_ngcontent"!==n.substring(0,10)&&"_nghost"!==n.substring(0,7))){var o=e.value;"class"===e.name&&(o=Pi(o).join(" ")),a["attr__"+e.name]=Ye(1024,"href"===e.name&&s?K(o):o)}});for(var l=1,u=1,h=t;h=tr(h);)l++,h.tagName===t.tagName&&u++;return a.nth_child=l,a.nth_of_type=u,a}(t,o,l,h,d));var r=function(t){if(!qi(t))return{};var i={};return ci(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&&te(r)&&(i[e]=r)}}),i}(t);ci(r,(t,i)=>{({}).hasOwnProperty.call(k,i)||(k[i]=t)})}),E)return{props:{},explicitNoCapture:E};if(m>0&&(t=p[m],S.splice(0,m)),l||(S[0].$el_text=ki(t,"a")||ki(t,"button")?ie(t):Ai(t)),x){var F,P;S[0].attr__href=x;var C=null==(F=(t=>{var i=null==oi?void 0:oi.createElement("a");return c(i)?null:(i.href=t,i)})(x))?void 0:F.host,T=null==si||null==(P=si.location)?void 0:P.host;C&&T&&C!==T&&(y=x)}return{props:fi({$event_type:a.type,$ce_version:1},v?{}:{$elements:S},{$elements_chain:(w=S,u(w)?function(t){return t.map(t=>{var i,r,s="";if(t.tag_name&&(s+=t.tag_name),t.attr_class)for(var n of(t.attr_class.sort(),t.attr_class))s+="."+n.replace(/"/g,"");var a=e({},t.text?{text:t.text}:{},{"nth-child":null!==(i=t.nth_child)&&void 0!==i?i:0,"nth-of-type":null!==(r=t.nth_of_type)&&void 0!==r?r:0},t.href?{href:t.href}:{},t.attr_id?{attr_id:t.attr_id}:{},t.attributes),o={};return pi(a).sort((t,i)=>{return(r=i[0])>(e=t[0])?-1:e>r?1:0;var e,r}).forEach(t=>{var i=t[1];return o[re(t[0].toString())]=re(i.toString())}),(s+=":")+pi(o).map(t=>t[0]+'="'+t[1]+'"').join("")}).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:se(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return pi(t).filter(t=>0===t[0].indexOf("attr__")).forEach(t=>r.attributes[t[0]]=t[1]),r})}(w)):"")},null!=(r=S[0])&&r.$el_text?{$el_text:null==(n=S[0])?void 0:n.$el_text}:{},y&&"click"===a.type?{$external_click_url:y}:{},k),target:t}}class er{Ft(){this.Pt=void 0,clearTimeout(this.Ct),this.Ct=void 0}Tt(t){var i;if(!qi(t))return!0;for(var e,r=null!==(i=this.Rt().css_selector_ignorelist)&&void 0!==i?i:Li,n=new Set,a=t,o=function(){if(n.size>=Fi||n.has(a))return{v:!0};n.add(a);var t=a,i=Ti(t);if(s(i,"ph-no-capture")||s(i,"ph-sensitive")||Wi(t)||r.some(i=>Ii(t,i)))return{v:!0};var e=a.parentNode;a=Ei(e)?e.host:e&&Si(e)?e:null};a;)if(e=o())return e.v;return!1}At(t){if(this.isEnabled&&"pointercancel"!==t.type)if("pointerdown"!==t.type){var i=this.Pt;i&&(t.pointerId!==i.id||Math.abs(t.clientX-i.x)>5||Math.abs(t.clientY-i.y)>5?this.Ft():"pointerup"===t.type&&(i.released=!0,this.Ct=setTimeout(()=>this.Ft(),0)))}else{this.Ft();var e,r=Oi(t);t.isPrimary&&0===t.button&&!t.ctrlKey&&r&&Si(r)&&(this.Pt={target:r,excluded:this.Tt(r),id:t.pointerId,x:t.clientX,y:t.clientY,released:!1,distinctId:null==(e=this.Ot)?void 0:e.distinctId})}else this.Ft()}Mt(t){var i,e=this.Pt;this.Ft();var r=Oi(t);if(null!=e&&e.released&&e.target.isConnected&&e.distinctId===(null==(i=this.Ot)?void 0:i.distinctId)&&t.pointerId===e.id&&(t.detail>0||"touch"===t.pointerType||"pen"===t.pointerType)&&0===t.button&&5>=Math.abs(t.clientX-e.x)&&5>=Math.abs(t.clientY-e.y)&&r&&(ki(r,"html")||ki(r,"body"))){var n;if(e.excluded)return null;var a=null!==(n=this.Rt().css_selector_ignorelist)&&void 0!==n?n:Li;return[r,null==oi?void 0:oi.documentElement,null==oi?void 0:oi.body].some(t=>{if(!t)return!1;var i=Ti(t);return s(i,"ph-no-capture")||s(i,"ph-sensitive")||!qi(t)||Wi(t)||a.some(i=>Ii(t,i))})?null:e.target}}constructor(t){this.name="autocapture",this.It=!1,this.$t=null,this.jt=!1,this.Lt=!1,this.P={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.Dt=!1,this.Nt=t,this.Nt.refresh(this.P),this.rageclicks=new ne(this.P.rageclick),this.zt=null}setup(t){this.Bt(),this.Ot=t;var i=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.Dt?i.dispose():(this.Ht=i,this.startIfEnabled())}dispose(){var t;this.Dt||(this.Dt=!0,this.Ot=void 0,null==(t=this.Ht)||t.dispose(),this.Ht=void 0,this.Ut())}Rt(){return this.Nt.refresh(this.P),this.P}Bt(){var t,i;return this.Rt(),this.P.url_allowlist=null==(t=this.P.url_allowlist)?void 0:t.map(t=>new RegExp(t)),this.P.url_ignorelist=null==(i=this.P.url_ignorelist)?void 0:i.map(t=>new RegExp(t)),this.P}Vt(){if(this.isBrowserSupported()){if(si&&oi){var t=this.qt=t=>{t=t||(null==si?void 0:si.event);try{if("blur"===t.type)return void this.Ft();if(0===t.type.indexOf("pointer"))return void this.At(t);var i="click"===t.type?this.Mt(t):void 0;if(g(i))return;this.Wt(t,"$autocapture",i)}catch(t){Qe.error("Failed to capture event",t)}};if(_i(si,"blur",t),_i(oi,"submit",t,{capture:!0}),_i(oi,"change",t,{capture:!0}),_i(oi,"click",t,{capture:!0}),ci(["pointerdown","pointermove","pointerup","pointercancel"],i=>{_i(oi,i,t,{capture:!0})}),this.Rt().capture_copied_text){var i=this.Kt=t=>{t=t||(null==si?void 0:si.event);try{this.Wt(t,Ze)}catch(t){Qe.error("Failed to capture clipboard event",t)}};_i(oi,"copy",i,{capture:!0}),_i(oi,"cut",i,{capture:!0}),_i(oi,"paste",i,{capture:!0})}}}else Qe.info("Disabling Automatic Event Collection because this browser is not supported")}Ut(){this.Ft(),this.qt&&(null==si||si.removeEventListener("blur",this.qt),ci(["pointerdown","pointermove","pointerup","pointercancel"],t=>{null==oi||oi.removeEventListener(t,this.qt,!0)}),null==oi||oi.removeEventListener("submit",this.qt,!0),null==oi||oi.removeEventListener("change",this.qt,!0),null==oi||oi.removeEventListener("click",this.qt,!0),this.qt=void 0),this.Kt&&(null==oi||oi.removeEventListener("copy",this.Kt,!0),null==oi||oi.removeEventListener("cut",this.Kt,!0),null==oi||oi.removeEventListener("paste",this.Kt,!0),this.Kt=void 0),this.It=!1}startIfEnabled(){this.isEnabled||this.Ft(),!this.Dt&&this.Ot&&this.isEnabled&&!this.It&&(this.Vt(),this.It=!0)}onRemoteConfig(t){if(!this.Dt)if(this.jt=!0,t.ok){var i=t.config;i.elementsChainAsString&&(this.Lt=i.elementsChainAsString);var e,r=i.autocapture_opt_out;m(r)&&(null==(e=this.Ot)||e.kv.set(ae,r),this.$t=r),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(t){this.zt=t}getElementSelectors(t,i){var e,r=[];return null==(e=this.zt)||e.forEach(e=>{var n=null==oi?void 0:oi.querySelectorAll(e);null==n||n.forEach(n=>{t!==n&&i!==n||s(r,e)||r.push(e)})}),r}get isEnabled(){var t,i;if(this.Dt)return!1;var e=null==(t=this.Ot)?void 0:t.kv.get(ae),r=this.$t,s=this.Rt();if(!s.remoteRequestsDisabled&&!this.jt)return!1;var n=s.remoteRequestsDisabled&&!this.jt;if(g(r)&&!m(e)&&!n)return!1;var a=null!==(i=this.$t)&&void 0!==i?i:!!e;return!!s.enabled&&!a}Wt(t,i,r){if(void 0===i&&(i="$autocapture"),this.isEnabled){var s=r||Oi(t);xi(s)&&(s=s.parentNode||null);var n,a=this.Bt();"$autocapture"===i&&"click"===t.type&&t instanceof MouseEvent&&a.rageclick&&null!=(n=this.rageclicks)&&n.isRageClick(t.clientX,t.clientY,t.timeStamp||(new Date).getTime())&&Hi(s,a.rageclick)&&this.Wt(t,"$rageclick",r);var o=i===Ze,l=o?e({},a,{dom_event_allowlist:void 0}):a;if(s&&function(t,i,e,r,s,n){var a;if(!si||Ui(t))return!1;if(null!=e&&e.url_allowlist&&!Ci(e.url_allowlist,n))return!1;if(null!=e&&e.url_ignorelist&&Ci(e.url_ignorelist,n))return!1;if(null!=e&&e.dom_event_allowlist){var o=e.dom_event_allowlist;if(o&&!o.some(t=>i.type===t))return!1}var l=Vi(t,r),u=l.parentIsUsefulElement,h=l.targetElementList;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}(h,e))return!1;if(!$i(h,null==e?void 0:e.css_selector_allowlist))return!1;if($i(h,null!==(a=null==e?void 0:e.css_selector_ignorelist)&&void 0!==a?a:Li))return!1;try{var v=si.getComputedStyle(t);if(v&&"pointer"===v.getPropertyValue("cursor")&&"click"===i.type)return!0}catch(t){}var d=t.tagName.toLowerCase();switch(d){case"html":return!1;case"form":return(s||["submit"]).indexOf(i.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(i.type)>=0;default:return u?(s||["click"]).indexOf(i.type)>=0:(s||["click"]).indexOf(i.type)>=0&&(Mi.indexOf(d)>-1||"true"===t.getAttribute("contenteditable"))}}(s,t,l,o,o?["copy","cut","paste"]:void 0,{config:{get_current_url:a.getCurrentUrl}})){var u,h=ir(s,{e:t,maskAllElementAttributes:a.maskAllElementAttributes,maskAllText:a.maskAllText,elementAttributeIgnoreList:a.element_attribute_ignorelist,elementsChainAsString:this.Lt,disableCaptureUrlHashes:a.disableCaptureUrlHashes}),v=h.props;if(h.explicitNoCapture)return!1;var d=this.getElementSelectors(s,h.target);if(d&&d.length>0&&(v.$element_selectors=d),i===Ze){var f=t.type||"clipboard";if("paste"!==f){var p,g,_=null==si||null==(p=si.getSelection())?void 0:p.toString(),b=Ri(_);if(!b)return!1;v.$selected_content=b,v.$clipboard_text_length=null!==(g=null==_?void 0:_.length)&&void 0!==g?g:0}v.$copy_type=f}return null==(u=this.Ot)||u.capture(i,v).catch(t=>Qe.error("Failed to capture event",t)),!0}}else this.Ft()}isBrowserSupported(){return h(null==oi?void 0:oi.querySelectorAll)}}class rr{constructor(t){this._instance=t}refresh(t){var i=this._instance.config,e=v(i.autocapture)?i.autocapture:void 0;t.enabled=!!i.autocapture,t.rageclick=i.rageclick,t.maskAllElementAttributes=i.mask_all_element_attributes,t.maskAllText=i.mask_all_text,t.disableCaptureUrlHashes=i.disable_capture_url_hashes,t.getCurrentUrl=i.get_current_url,t.remoteRequestsDisabled=this._instance._shouldDisableFlags(),t.url_allowlist=null==e?void 0:e.url_allowlist,t.url_ignorelist=null==e?void 0:e.url_ignorelist,t.dom_event_allowlist=null==e?void 0:e.dom_event_allowlist,t.element_allowlist=null==e?void 0:e.element_allowlist,t.css_selector_allowlist=null==e?void 0:e.css_selector_allowlist,t.css_selector_ignorelist=null==e?void 0:e.css_selector_ignorelist,t.element_attribute_ignorelist=null==e?void 0:e.element_attribute_ignorelist,t.capture_copied_text=null==e?void 0:e.capture_copied_text}}var sr="undefined"!=typeof globalThis?globalThis:si;sr&&"undefined"==typeof self&&(sr.self=sr),sr&&"undefined"==typeof File&&(sr.File=function(){});var nr=null!=si?si:{},ar=di("[Dead Clicks]"),or=()=>!0;class lr{get lazyLoadedDeadClicksAutocapture(){return this.Jt}constructor(t,i,e){this.instance=t,this.isEnabled=i,this.onCapture=e,this.startIfEnabledOrStop()}onRemoteConfig(t){if(t.ok){var i=t.config;"captureDeadClicks"in i&&(this.instance.persistence&&this.instance.persistence.register({[de]:i.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.Gt(()=>{this.Xt()}):this.stop()}Gt(t){var i,e;null!=(i=nr.__PosthogExtensions__)&&i.initDeadClicksAutocapture?t():null==(e=nr.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this.instance,"dead-clicks-autocapture",i=>{i?ar.error("failed to load script",i):t()})}Xt(){var t;if(oi){if(!this.Jt&&null!=(t=nr.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var i=v(this.instance.config.capture_dead_clicks)?e({},this.instance.config.capture_dead_clicks):{};i.__onCapture=this.onCapture,this.onCapture&&(i.capture_dead_swipes=!1),this.Jt=nr.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,i),this.Jt.start(oi),ar.info("starting...")}}else ar.error("`document` not found. Cannot start.")}stop(){this.Jt&&(this.Jt.stop(),this.Jt=void 0,ar.info("stopping..."))}}var ur=di("[ExceptionAutocapture]"),hr=()=>{},vr=t=>{var i;if(h(t))return null!==(i=t.__posthog_layer__)&&void 0!==i?i:t.__rrweb_layer__};function dr(t,i,e){try{if(!(i in t))return hr;var r={next:t[i]},s=e(function(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];return r.next.apply(this,i)});return h(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:r}})),t[i]=s,()=>{if(t[i]!==s)for(var e=t[i],n=vr(e);n;){if(n.next===s)return void(n.next=r.next);n=vr(e=n.next)}else t[i]=r.next}}catch(t){return hr}}var cr=di("[TracingHeaders]"),fr=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],pr=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...fr],gr="<masked>",_r=["li_fat_id"];function br(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}var mr=di("[Web Vitals]"),yr=9e5,wr=["CLS","FCP","INP","LCP"],Sr=["INP","LCP"],kr=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],xr=di("[RemoteConfig]");class Er{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=nr._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}Zt(t){var i,e;null!=(i=nr.__PosthogExtensions__)&&i.loadExternalDependency?null==(e=nr.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"remote-config",()=>t(this.remoteConfig)):t()}Qt(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t})}load(){try{if(this.remoteConfig)return xr.info("Using preloaded remote config",this.remoteConfig),void this.Yt(this.remoteConfig);if(this._instance._shouldDisableFlags())return void xr.warn("Remote config is disabled. Falling back to local config.");this.Zt(t=>{if(!t)return xr.info("No config found after loading remote JS config. Falling back to JSON."),void this.Qt(t=>{this.Yt(t.json,t)});this.Yt(t)})}catch(t){xr.error("Error loading remote config",t),this.Yt()}}Yt(t,i){!t&&i&&(0===i.statusCode?i.error||xr.warn("Failed to fetch remote config from PostHog."):xr.error("Failed to fetch remote config from PostHog."));try{this._instance.Yt(t?{ok:!0,config:t}:{ok:!1})}catch(t){xr.error("Error applying remote config",t)}if(!1!==(null==t?void 0:t.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var e;null==(e=this._instance.featureFlags)||e.ensureFlagsLoaded()}catch(t){xr.error("Error loading feature flags",t)}}}var Fr="disabled",Pr="lazy_loading",Cr="awaiting_config",Tr="missing_config",Rr="[SessionRecording]",Ar=di(Rr),Or=di("[Heatmaps]");function Mr(t){return v(t)&&"clientX"in t&&"clientY"in t&&b(t.clientX)&&b(t.clientY)}var Ir=di("[Product Tours]"),$r=t=>{var i;return!t.config.disable_product_tours&&!(null==(i=t.persistence)||!i.get_property(ce))},jr=["$set_once","$set"],Lr=di("[SiteApps]"),Dr="Error while initializing PostHog app with config id ",Nr=(t,i)=>null!=t&&t.then?t.then(i):i(t),zr="events",Br="cancelEvents",Hr="survey shown";function Ur(t){var i;return!(null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)||!i.length)}var Vr=(t,i)=>{if(!(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}},qr=t=>t.toLowerCase(),Wr={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=>Vr(i,t))),not_regex:(t,i)=>i.every(i=>t.every(t=>!Vr(i,t))),icontains:(t,i)=>i.map(qr).some(i=>t.map(qr).some(t=>i.includes(t))),not_icontains:(t,i)=>i.map(qr).every(i=>t.map(qr).every(t=>!i.includes(t))),gt:(t,i)=>i.some(i=>{var e=parseFloat(i);return!isNaN(e)&&t.some(t=>e>parseFloat(t))}),lt:(t,i)=>i.some(i=>{var e=parseFloat(i);return!isNaN(e)&&t.some(t=>e<parseFloat(t))})};function Kr(t,i){return!t||Object.entries(t).every(t=>{var e=t[1],r=null==i?void 0:i[t[0]];if(null==r)return!1;var s=Wr[e.operator];return!!s&&s(e.values,[String(r)])})}var Jr=di("[Surveys]"),Gr="seenSurvey_",Xr=["popover","widget","api"],Zr="SDK is not enabled or survey functionality is not yet loaded",Qr="Disabled. Not loading surveys.";class Yr{constructor(t,i){this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.ti=!1,this.ii=[],this.ei=null,this.ri=null,this.Dt=!1,this.si=new Set,this.onRemoteConfig=t=>{if(!this.Dt&&!this.P.disableSurveys){if(!t.ok)return Jr.warn("Remote config unavailable. Not loading surveys.");var i=t.config.surveys;if(_(i))return Jr.warn("Flags not loaded yet. Not loading surveys.");this.ni=m(i)?i:i.length>0,Jr.info("flags response received, isSurveysEnabled: "+this.ni),this.loadIfEnabled()}},this.Nt=t,this.ai=i}setup(t){if(!this.Dt)return this.oi=t,Nr(t.kv.initialize(),()=>{if(this.oi===t&&!this.Dt){this.oi=void 0,this.Ot=t;var i=t.onRemoteConfig(this.onRemoteConfig);this.Dt?i.dispose():(this.Ht=i,this.loadIfEnabled())}})}dispose(){var t,i,e;this.Dt||(this.Dt=!0,this.oi=void 0,this.Ot=void 0,null==(t=this.Ht)||t.dispose(),this.Ht=void 0,null==(i=this._surveyEventReceiver)||i.dispose(),this._surveyEventReceiver=null,null==(e=this._surveyManager)||null==e.dispose||e.dispose(),this._surveyManager=null,this.ii=[],this.ei=null,this.si.forEach(t=>clearTimeout(t)),this.si.clear())}get P(){return this.Nt.get()}initialize(){this.loadIfEnabled()}reset(){try{var t;null==(t=this._surveyEventReceiver)||t.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var i=[],e=0;e<localStorage.length;e++){var r=localStorage.key(e);(null!=r&&r.startsWith(Gr)||null!=r&&r.startsWith("inProgressSurvey_"))&&i.push(r)}i.forEach(t=>localStorage.removeItem(t))}catch(t){}}loadIfEnabled(){if(!this.Dt&&this.Ot){var t=this.P;if(!this._surveyManager)if(this.ti)Jr.info("Already initializing surveys, skipping...");else if(t.disableSurveys)Jr.info(Qr);else if(t.cookielessMode&&this.Nt.isOptedOut())Jr.info("Not loading surveys in cookieless mode without consent.");else{var i=this.Nt.getExtensions();if(i){if(!c(this.ni)||t.advancedEnableSurveys){var e=this.ni||t.advancedEnableSurveys;this.ti=!0;try{var r=i.generateSurveys;if(r)return this.li(r,e),void(this.ti=!1);var s=i.loadExternalDependency;if(!s)return this.ui(Ue),void(this.ti=!1);s(t=>{try{if(this.Dt)return;var i=this.Nt.getExtensions();t||null==i||!i.generateSurveys?this.ui("Could not load surveys script",t):this.li(i.generateSurveys,e)}finally{this.ti=!1}})}catch(t){throw this.ti=!1,this.ui("Error initializing surveys",t),t}}}else Jr.error("PostHog Extensions not found.")}}}li(t,i){this.Dt||(this._surveyManager=t(i),this._surveyEventReceiver=this.Nt.createEventReceiver(),Jr.info("Surveys loaded successfully"),this.hi({isLoaded:!0}))}ui(t,i){Jr.error(t,i),this.hi({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.ii.push(t),this._surveyManager&&this.hi({isLoaded:!0}),()=>{this.ii=this.ii.filter(i=>i!==t)}}getSurveys(t,i){var e;void 0===i&&(i=!1);var r=null!==(e=this.Ot)&&void 0!==e?e:this.ai;if(r&&!this.Dt){if(this.P.disableSurveys)return Jr.info(Qr),t([]);var s=r.kv.get(Re);if(s&&!i)return t(s,{isLoaded:!0}),void(this.di()&&this.getSurveys(()=>{},!0));if(this.ei)this.ei.then(i=>{this.Dt||t(i.surveys,i.context)}).catch(t=>Jr.error("Error in survey callback",t));else{var n=this.ci("/api/surveys/",{method:"GET",query:{token:r.projectToken},sentAt:"query",timeoutMs:this.P.requestTimeoutMs}).then(t=>{try{return this.fi(r,t)}catch(t){return Jr.error("Error processing surveys response",t),this.fi(r,{statusCode:0,error:t})}},t=>this.fi(r,{statusCode:0,error:t}));this.ei=n;var a=()=>{this.ei===n&&(this.ei=null)};n.then(i=>{a(),this.Dt||t(i.surveys,i.context)},a).catch(t=>Jr.error("Error in survey callback",t))}}}ci(t,i){var e=this.Ot;return e?e.sendRequest(t,i):new Promise(t=>t({statusCode:0,error:new Error(Zr)}))}fi(t,i){if(this.Dt)return{surveys:[],context:{isLoaded:!1,error:Zr}};var e=i.statusCode;if(200!==e||!i.json){var r="Surveys API could not be loaded, status: "+e;return 0!==e?Jr.error(r):i.error||Jr.warn(r),this.ri=Date.now(),{surveys:[],context:{isLoaded:!1,error:r}}}this.ri=null;var s,n=i.json.surveys||[],a=n.filter(t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(Ur(t)||function(t){var i;return!(null==(i=t.conditions)||null==(i=i.actions)||null==(i=i.values)||!i.length)}(t)));return a.length>0&&(null==(s=this._surveyEventReceiver)||s.register(a)),t.kv.set({[Re]:n,[Ae]:Date.now()}),{surveys:n,context:{isLoaded:!0}}}di(){return this.pi()&&!this.ei&&!this.gi()}pi(){var t,i,e=null==(t=null!==(i=this.Ot)&&void 0!==i?i:this.ai)?void 0:t.kv.get(Ae);return b(e)&&Date.now()-e>Be}gi(){return b(this.ri)&&Date.now()-this.ri<He}markSurveyAsSeen(t,i){var e;(t=>{try{var i=(t=>((t,i)=>""+Gr+function(t){return t.current_iteration&&t.current_iteration>0?t.id+"_"+t.current_iteration:t.id}(i))(0,t))(t);if(localStorage.getItem(i))return;localStorage.setItem(i,"true")}catch(t){Jr.error("Failed to persist survey seen state",t)}})({id:t,current_iteration:null!==(e=null==i?void 0:i.iteration)&&void 0!==e?e:null});try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}}hi(t){for(var i of this.ii)try{if(!t.isLoaded)return i([],t);this.getSurveys(i)}catch(t){Jr.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,i){if(void 0===i&&(i=!1),!_(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,i);Jr.warn("init was not called")}bi(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}mi(t){if(_(this._surveyManager))return{eligible:!1,reason:Zr};var i="string"==typeof t?this.bi(t):t;return i?this._surveyManager.checkSurveyEligibility(i):{eligible:!1,reason:"Survey not found"}}yi(t){if(!this.Nt.isCapturing())return{eligible:!1,reason:"PostHog is not capturing, so a survey response cannot be recorded"};if(_(this._surveyManager))return{eligible:!1,reason:Zr};var i="string"==typeof t?this.bi(t):t;return i?this._surveyManager.checkSurveyRenderability(i):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(_(this._surveyManager))return Jr.warn("init was not called"),{visible:!1,disabledReason:Zr};var i=this.yi(t);return{visible:i.eligible,disabledReason:i.reason}}canRenderSurveyAsync(t,i){return _(this._surveyManager)?(Jr.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Zr})):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.yi(s);e({visible:n.eligible,disabledReason:n.reason})}else e({visible:!1,disabledReason:"Survey not found"})},i)})}renderSurvey(t,i,e){var r;if(this.Nt.isCapturing())if(_(this._surveyManager))Jr.warn("init was not called");else{var s="string"==typeof t?this.bi(t):t;if(null!=s&&s.id)if(Xr.includes(s.type)){var n=null==oi?void 0:oi.querySelector(i);if(n)if(null!=(r=s.appearance)&&r.surveyPopupDelaySeconds){Jr.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds");var a=setTimeout(()=>{var t,i;this.si.delete(a),!this.Dt&&this.Nt.isCapturing()&&(Jr.info("Rendering survey "+s.id+" with delay of "+(null==(t=s.appearance)?void 0:t.surveyPopupDelaySeconds)+" seconds"),null==(i=this._surveyManager)||i.renderSurvey(s,n,e),Jr.info("Survey "+s.id+" rendered"))},1e3*s.appearance.surveyPopupDelaySeconds);this.si.add(a)}else this._surveyManager.renderSurvey(s,n,e);else Jr.warn("Survey element not found")}else Jr.warn("Surveys of type "+s.type+" cannot be rendered in the app");else Jr.warn("Survey not found")}}displaySurvey(t,i){var r;if(this.Nt.isCapturing())if(_(this._surveyManager))Jr.warn("init was not called");else{var s=this.bi(t);if(s){var n=s;if(null!=(r=s.appearance)&&r.surveyPopupDelaySeconds&&i.ignoreDelay&&(n=e({},s,{appearance:e({},s.appearance,{surveyPopupDelaySeconds:0})})),"popover"!==i.displayType&&i.initialResponses&&Jr.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===i.ignoreConditions){var a=this.mi(s);if(!a.eligible)return void Jr.warn("Survey is not eligible to be displayed: ",a.reason)}"inline"!==i.displayType?this._surveyManager.handlePopoverSurvey(n,i):this.renderSurvey(n,i.selector,i.properties)}else Jr.warn("Survey not found")}}cancelPendingSurvey(t){_(this._surveyManager)?Jr.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||null==t.handlePageUnload||t.handlePageUnload()}}ri.DEBUG=!1,ri.LIB_VERSION="1.429.0",ri.LIB_NAME="web";class ts{on(t,i){return this.wi[t]||(this.wi[t]=[]),this.wi[t].push(i),()=>{this.wi[t]=this.wi[t].filter(t=>t!==i)}}emit(t,i){for(var e of this.wi[t]||[])e(i);for(var r of this.wi["*"]||[])r(t,i)}constructor(){this.wi={}}}function is(t,i,e){if(_(t))return!1;switch(e){case"exact":return t===i;case"contains":var r=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(t);case"regex":try{return new RegExp(i).test(t)}catch(t){return!1}default:return!1}}class es{constructor(t){this.Si=new Set,this.ki=new Set,this.xi=new ts,this.Ei=(t,i)=>this.Fi(t,i)&&this.Pi(t,i)&&this.Ci(t,i)&&this.Ti(t,i),this.Fi=(t,i)=>null==i||!i.event||(null==t?void 0:t.event)===(null==i?void 0:i.event),this._instance=t}init(){var t,i;c(null==(t=this._instance)?void 0:t._addCaptureHook)||(this.Ri=null==(i=this._instance)?void 0:i._addCaptureHook((t,i)=>{this.on(t,i)}))}dispose(){var t;null==(t=this.Ri)||t.call(this),this.Ri=void 0,this.xi=new ts}register(t){var i,e;if(!c(null==(i=this._instance)?void 0:i._addCaptureHook)&&(t.forEach(t=>{var i;this.Si.add(t),null==(i=t.steps)||i.forEach(t=>{this.ki.add((null==t?void 0:t.event)||"")})}),null!=(e=this._instance)&&e.autocapture)){var r=new Set;this.Si.forEach(t=>{var i;null==(i=t.steps)||i.forEach(t=>{null!=t&&t.selector&&r.add(t.selector)})}),this._instance.autocapture.setElementSelectors(r)}}replace(t){this.Si.clear(),this.ki.clear(),this.register(t)}on(t,i){null!=i&&0!=t.length&&(this.ki.has(t)||this.ki.has(i.event))&&this.Si.forEach(t=>{this.Ai(i,t)&&this.xi.emit("actionCaptured",t.name)})}Oi(t){this.onAction("actionCaptured",i=>t(i))}Ai(t,i){if(null==(null==i?void 0:i.steps))return!1;for(var e of i.steps)if(this.Ei(t,e))return!0;return!1}onAction(t,i){return this.xi.on(t,i)}Pi(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(!is(r,i.url,i.url_matching||"contains"))return!1}return!0}Ci(t,i){return!!this.Mi(t,i)&&!!this.Ii(t,i)&&!!this.$i(t,i)}Mi(t,i){var e;if(null==i||!i.href)return!0;var r=this.ji(t);if(r.length>0)return r.some(t=>is(t.href,i.href,i.href_matching||"exact"));var s,n=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!n&&is((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",i.href,i.href_matching||"exact")}Ii(t,i){var e;if(null==i||!i.text)return!0;var r=this.ji(t);if(r.length>0)return r.some(t=>is(t.text,i.text,i.text_matching||"exact")||is(t.$el_text,i.text,i.text_matching||"exact"));var s,n,a,o=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!o&&(s=function(t){for(var i,e=[],r=/(?::|")text="(.*?)"/g;!_(i=r.exec(t));)e.includes(i[1])||e.push(i[1]);return e}(o),n=i.text,a=i.text_matching||"exact",s.some(t=>is(t,n,a)))}$i(t,i){var e,r;if(null==i||!i.selector)return!0;var s=null==t||null==(e=t.properties)?void 0:e.$element_selectors;if(null!=s&&s.includes(i.selector))return!0;var n=(null==t||null==(r=t.properties)?void 0:r.$elements_chain)||"";if(i.selector_regex&&n)try{return new RegExp(i.selector_regex).test(n)}catch(t){return!1}return!1}ji(t){var i;return null==(null==t||null==(i=t.properties)?void 0:i.$elements)?[]:null==t?void 0:t.properties.$elements}Ti(t,i){return null==i||!i.properties||0===i.properties.length||Kr(i.properties.reduce((t,i)=>{var e=u(i.value)?i.value.map(String):null!=i.value?[String(i.value)]:[];return t[i.key]={values:e,operator:i.operator||"exact"},t},{}),null==t?void 0:t.properties)}}class rs{constructor(t){var i;this.Li=[],this._instance=t,this.Di=new Map,this.Ni=new Map,this.zi=new Map,this.Bi=null==(i=this._instance)||null==i.onSessionId?void 0:i.onSessionId(t=>this.Hi(t))}Ui(t){return!1}Vi(){return null}qi(t){}Wi(){}Ki(t,i){return!!t&&Kr(t.propertyFilters,null==i?void 0:i.properties)}Ji(t,i){var e=new Map;return t.forEach(t=>{var r;null==(r=t.conditions)||null==(r=r[i])||null==(r=r.values)||r.forEach(i=>{if(null!=i&&i.name){var r=e.get(i.name)||[];r.push(t.id),e.set(i.name,r)}})}),e}Gi(t,i,e){var r=(e===zr?this.Di:this.Ni).get(t),s=[];return this.Xi(t=>{s=t.filter(t=>null==r?void 0:r.includes(t.id))}),s.filter(r=>{var s,n=null==(s=r.conditions)||null==(s=s[e])||null==(s=s.values)?void 0:s.find(i=>i.name===t);return this.Ki(n,i)})}register(t){this.Zi(t,!1)}replace(t){this.Zi(t,!0)}Zi(t,i){var e;c(null==(e=this._instance)?void 0:e._addCaptureHook)||(this.Qi(t,i),this.Yi(t,i))}Yi(t,i){var e=t.filter(t=>{var i;return null==(i=t.conditions)||null==(i=i.actions)||null==(i=i.values)?void 0:i.length});if(i&&this.zi.clear(),0!==e.length){this.te||(this.te=new es(this._instance),this.te.init(),this.te.Oi(t=>this.onAction(t)));var r=[];e.forEach(t=>{var i;null==(i=t.conditions)||null==(i=i.actions)||i.values.forEach(i=>{if(r.push(i),i.name){var e,s=null!==(e=this.zi.get(i.name))&&void 0!==e?e:[];s.includes(t.id)||s.push(t.id),this.zi.set(i.name,s)}})}),i?this.te.replace(r):this.te.register(r)}else{var s;i&&(null==(s=this.te)||s.replace([]))}}ie(t,i){i.forEach((i,e)=>{var r,s=null!==(r=t.get(e))&&void 0!==r?r:[];i.forEach(t=>{s.includes(t)||s.push(t)}),t.set(e,s)})}Qi(t,i){var e,r,s=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}),n=t.filter(t=>{var i,e;return(null==(i=t.conditions)?void 0:i.cancelEvents)&&(null==(e=t.conditions)||null==(e=e.cancelEvents)||null==(e=e.values)?void 0:e.length)>0}),a=this.Ji(t,zr),o=this.Ji(t,Br);i?(this.Di=a,this.Ni=o):(this.ie(this.Di,a),this.ie(this.Ni,o)),(0!==s.length||0!==n.length)&&(null!==(e=this.Ri)&&void 0!==e||(this.Ri=null==(r=this._instance)?void 0:r._addCaptureHook((t,i)=>{this.onEvent(t,i)})))}onEvent(t,i){var e,r,s=this.ee(),n=(null==i||null==(e=i.properties)?void 0:e.$survey_id)||(null==i||null==(r=i.properties)?void 0:r.$product_tour_id);if(n&&this.getActivatedIds().includes(n)){var a=this.re(t,n);if("consume"===a)return s.info("event consumed activated item, removing it",{event:t,itemId:n}),void this.se([n]);if("persist"===a)return s.info("shown item promoted to persisted activation",{event:t,itemId:n}),this.ne(n),void this.ae([n])}if(this.Ni.has(t)){var o=this.Gi(t,i,Br);o.length>0&&(s.info("cancel event matched, cancelling items",{event:t,itemsToCancel:o.map(t=>t.id)}),this.se(o.map(t=>t.id)),o.forEach(t=>this.oe(t.id)))}if(this.Di.has(t)){s.info("event name matched",{event:t,eventPayload:i,items:this.Di.get(t)});var l=this.Gi(t,i,zr);this.le(l.map(t=>t.id))}}onAction(t){this.zi.has(t)&&this.le(this.zi.get(t)||[])}le(t){var i;if(0!==t.length){var e=!(null==(i=this._instance)||null==i.get_session_id||!i.get_session_id()),r=[];for(var s of t)e&&this.Ui(s)?this.ne(s)&&this.ue(s):r.push(s);r.length>0&&(this.Li=[...new Set([...this.Li,...r])]),this.ee().info("updating activated items",{activatedItems:this.getActivatedIds()})}}ne(t){this.Li=this.Li.filter(i=>i!==t);var i=this.he();return!i.includes(t)&&(this.ve([...i,t]),this.de(),!0)}se(t){var i=new Set(t);this.Li=this.Li.filter(t=>!i.has(t));var e=this.ce(),r=e.filter(t=>!i.has(t));r.length!==e.length&&(this.ve(r),0===r.length&&this.fe()),this.ae(t)}pe(){var t,i=this.Vi();if(!i)return{};var e=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i];return e&&"object"==typeof e?e:{}}ue(t){if(this.Vi()){var i=this.pe();this.qi(e({},i,{[t]:Date.now()}))}}ae(t){if(this.Vi()){var i=this.pe(),e={},r=!1;for(var s of Object.entries(i)){var n=s[0],a=s[1];t.includes(n)?r=!0:e[n]=a}r&&(d(e)?this.Wi():this.qi(e))}}ge(){this.Vi()&&this.Wi()}getActivationTimestamp(t){if(this.he().includes(t)){var i=this.pe()[t];return b(i)?i:void 0}}ce(){var t,i=this._e();return(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i])||[]}he(){var t,i,e=this.ce();if(0===e.length)return[];var r=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[this.be()],s=null==(i=this._instance)||null==i.get_session_id?void 0:i.get_session_id();return s&&r===s?e:[]}de(){var t,i=null==(t=this._instance)||null==t.get_session_id?void 0:t.get_session_id();i&&this.me(i)}fe(){this.ye()}Hi(t){var i,e=null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[this.be()];if(e&&e!==t){var r=this.ce(),s=this.pe();r.length>0&&(this.ve([]),r.filter(t=>b(s[t])).forEach(t=>this.oe(t))),this.fe(),this.ge()}}getActivatedIds(){return[...new Set([...this.he(),...this.Li])].filter(t=>!this.we(t))}dispose(){var t,i,e;null==(t=this.Bi)||t.call(this),this.Bi=void 0,null==(i=this.Ri)||i.call(this),this.Ri=void 0,null==(e=this.te)||e.dispose(),this.te=void 0}reset(){this.Li=[],this.ce().length>0&&this.ve([]),this.fe(),this.ge()}getEventToItemsMap(){return this.Di}Se(){return this.te}}class ss extends rs{constructor(t){super(t)}_e(){return Oe}be(){return Me}Vi(){return Ie}qi(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[Ie]:t})}Wi(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(Ie)}Ui(t){var i,e;this.Xi(i=>{e=i.find(i=>i.id===t)});var r=null==(i=e)||null==(i=i.appearance)?void 0:i.surveyPopupDelaySeconds;return b(r)&&r>0}ke(){return Hr}Xi(t){var i;null==(i=this._instance)||i.getSurveys(t)}oe(t){var i;null==(i=this._instance)||i.cancelPendingSurvey(t)}ee(){return Jr}ve(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[Oe]:t})}me(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[Me]:t})}ye(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(Me)}we(){return!1}re(t,i){var e;this.Xi(t=>{e=t.find(t=>t.id===i)});var r=!e||function(t){var i;return Ur(t)&&!(null==(i=t.conditions)||null==(i=i.events)||!i.repeatedActivation)||"always"===t.schedule}(e);return r?t===Hr?"consume":"ignore":t===Hr?"persist":"survey dismissed"===t||"survey sent"===t?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}class ns{constructor(t){this._instance=t}initialize(){}get(t){if("string"==typeof t)return this._instance.get_property(t);var i={};for(var e of t){var r=this._instance.get_property(e);c(r)||(i[e]=r)}return i}set(t,i){this._instance.register("string"==typeof t?{[t]:i}:t)}remove(t){"string"!=typeof t?t.forEach(t=>this._instance.unregister(t)):this._instance.unregister(t)}}class as{constructor(t){this._instance=t}get(){var t=this._instance.config;return{disableSurveys:t.disable_surveys,cookielessMode:!!t.cookieless_mode,advancedEnableSurveys:t.advanced_enable_surveys,requestTimeoutMs:t.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}isCapturing(){return this._instance.is_capturing()}getExtensions(){var t=null==nr?void 0:nr.__PosthogExtensions__;if(t){var i=t.generateSurveys,e=t.loadExternalDependency;return{generateSurveys:i?t=>i(this._instance,t):void 0,loadExternalDependency:e?t=>e(this._instance,"surveys",t):void 0}}}createEventReceiver(){return new ss(this._instance)}}var os=null!=si&&si.location?Je(si.location.hash,"__posthog")||Je(location.hash,"state"):null,ls="_postHogToolbarParams",us=di("[Toolbar]"),hs=di("[FeatureFlags]");class vs{constructor(t,i){void 0===i&&(i=!1),this.xe=!1,this.update(t,i)}update(t,i){this.Ee=((t,i)=>{var e,r,s,n,a;return{bootstrap:{featureFlags:null==(e=t.bootstrap)?void 0:e.featureFlags,featureFlagPayloads:null==(r=t.bootstrap)?void 0:r.featureFlagPayloads},remoteRequestsDisabled:i,featureFlagsDisabled:!!t.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!t.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!t.advanced_feature_flags_dedup_per_session,cacheTtlMs:t.feature_flag_cache_ttl_ms,refreshIntervalMs:null!==(s=t.remote_config_refresh_interval_ms)&&void 0!==s?s:3e5,requestTimeoutMs:t.feature_flag_request_timeout_ms,compression:t.disable_compression?void 0:"best-available",evaluationContexts:null!==(n=null!==(a=t.evaluation_contexts)&&void 0!==a?a:t.evaluation_environments)&&void 0!==n?n:[],flagKeys:u(t.flag_keys)?t.flag_keys:void 0}})(t,i),!t.evaluation_environments||t.evaluation_contexts||this.xe||(hs.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.xe=!0),c(t.flag_keys)||u(t.flag_keys)||hs.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.Ee}}var ds=di("[FeatureFlags]"),cs=di("[FeatureFlags]",{debugEnabled:!0}),fs="\" failed. Feature flags didn't load in time.",ps="connection_error",gs=t=>{for(var i={},e=0;t.length>e;e++)i[t[e]]=!0;return i},_s=t=>{var i={};for(var e of pi(t||{})){var r=e[1];r&&(i[e[0]]=r)}return i},bs=t=>S(t)&&("RangeError"===t.name&&0===t.message.indexOf("Maximum call stack size exceeded")||"InternalError"===t.name&&"too much recursion"===t.message),ms=di("[Error tracking]"),ys="webkit-masked-url:",ws=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],Ss=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",ys],ks=["__firefox__","__gCrWeb"],xs="Refusing to render web experiment since the viewer is a likely bot",Es={icontains:(t,i)=>i.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,i)=>-1===i.toLowerCase().indexOf(t.toLowerCase()),regex:(t,i)=>Vr(i,t),not_regex:(t,i)=>!Vr(i,t),exact:(t,i)=>i===t,is_not:(t,i)=>i!==t};class Fs{get P(){return this._instance.config}constructor(t){var i=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),i.getWebExperiments(t=>{Fs.Fe("retrieved web experiments from the server"),i.Pe=new Map,t.forEach(t=>{if(t.feature_flag_key){var e;i.Pe&&(Fs.Fe("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(e=i.Pe)||e.set(t.feature_flag_key,t));var r=i._instance.getFeatureFlag(t.feature_flag_key);f(r)&&t.variants[r]&&i.Ce(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var n=t.variants[s];Fs.Te(n,i._instance)&&i.Ce(t.name,s,n.transforms)}})},t)},this._instance=t,this._instance.onFeatureFlags(t=>{this.onFeatureFlags(t)})}initialize(){}onFeatureFlags(t){if(this._is_bot())Fs.Fe(xs);else if(!this.P.disable_web_experiments){if(_(this.Pe))return this.Pe=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Fs.Fe("applying feature flags",t),t.forEach(t=>{var i;if(this.Pe&&null!=(i=this.Pe)&&i.has(t)){var e,r=this._instance.getFeatureFlag(t),s=null==(e=this.Pe)?void 0:e.get(t);r&&null!=s&&s.variants[r]&&this.Ce(s.name,r,s.variants[r].transforms)}})}}previewWebExperiment(){var t=Fs.getWindowLocation();if(null!=t&&t.search){var i=We(null==t?void 0:t.search,"__experiment_id"),e=We(null==t?void 0:t.search,"__experiment_variant");i&&e&&(Fs.Fe("previewing web experiments "+i+" && "+e),this.getWebExperiments(t=>{this.Re(parseInt(i),e,t)},!1,!0))}}loadIfEnabled(){this.P.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,i,e){if(this.P.disable_web_experiments&&!e)return t([]);var r=this._instance.get_property("$web_experiments");if(r&&!i)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.P.token),method:"GET",timestampMode:"query",callback:i=>t(200===i.statusCode&&i.json&&i.json.experiments||[])})}Re(t,i,e){var r=e.filter(i=>i.id===t);r&&r.length>0&&(Fs.Fe("Previewing web experiment ["+r[0].name+"] with variant ["+i+"]"),this.Ce(r[0].name,i,r[0].variants[i].transforms))}static Te(t,i){return!_(t.conditions)&&Fs.Ae(t,i)&&Fs.Oe(t)}static Ae(t,i){var e;if(_(t.conditions)||_(null==(e=t.conditions)?void 0:e.url))return!0;var r=Fs.getWindowLocation();if(r){var s,n,a,o=mi(i,r.href);return null==(s=t.conditions)||!s.url||Es[null!==(n=null==(a=t.conditions)?void 0:a.urlMatchType)&&void 0!==n?n:"icontains"](t.conditions.url,o)}return!1}static getWindowLocation(){return null==si?void 0:si.location}static Oe(t){var i;if(_(t.conditions)||_(null==(i=t.conditions)?void 0:i.utm))return!0;var e=function(){if(!oi)return{};var t,i,e,r=(t=Ke(oi.URL,[],gr),i=pr.concat([]),e={},ci(i,function(i){var r=We(t,i);e[i]=r||null}),e),s=function(){var t={};return ci(_r,function(i){var e=(t=>{if(oi){try{for(var i=t+"=",e=oi.cookie.split(";").filter(t=>t.length),r=0;e.length>r;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}})(i);t[i]=e||null}),t}();return fi(s,r)}();if(e.utm_source){var r,s,n,a,o,l,u,h,v=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,d=null==(n=t.conditions)||null==(n=n.utm)||!n.utm_source||(null==(a=t.conditions)||null==(a=a.utm)?void 0:a.utm_source)==e.utm_source,c=null==(o=t.conditions)||null==(o=o.utm)||!o.utm_medium||(null==(l=t.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==e.utm_medium,f=null==(u=t.conditions)||null==(u=u.utm)||!u.utm_term||(null==(h=t.conditions)||null==(h=h.utm)?void 0:h.utm_term)==e.utm_term;return v&&c&&f&&d}return!1}static Fe(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;i>r;r++)e[r-1]=arguments[r];vi.info("[WebExperiments] "+t,e)}Ce(t,i,e){this._is_bot()?Fs.Fe(xs):"control"!==i?e.forEach(e=>{if(e.selector){var r;Fs.Fe("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)})}}):Fs.Fe("Control variants leave the page unmodified.")}_is_bot(){return ai&&this._instance?function(t,i){if(!t)return!1;var e=t.userAgent;if(e&&F(e,i))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some(t=>F(null==t?void 0:t.brand,i)))return!0}catch(t){}return!!t.webdriver}(ai,this.P.custom_blocked_useragents):void 0}}var Ps=di("[Conversations]"),Cs="Conversations not available yet.";function Ts(){var t="",i="";try{var r=null==ai?void 0:ai.userAgent;if(r){var s=function(t){for(var i=0;U.length>i;i++){var e=U[i],r=e[1],s=e[0].exec(t),n=s&&(h(r)?r(s,t):r);if(n)return n}return["",""]}(r);t=s[0],i=s[1]}}catch(t){}return function(t,i){var r=function(t){if(t)return{}.hasOwnProperty.call(qt,t)?qt[t]:t}(t);return e({},r?{"os.name":r}:{},i?{"os.version":i}:{})}(t,i)}function Rs(t,i){var r,s,n,a,o,l,u,h=null!==(r=null==t?void 0:t.flushIntervalMs)&&void 0!==r?r:3e3,v=null!==(s=null==t?void 0:t.maxBufferSize)&&void 0!==s?s:100,d=null!=i&&i.consoleCapture?void 0:null!==(n=null==t?void 0:t.maxLogsPerInterval)&&void 0!==n?n:1e3,f=c(d)?Math.max(v,2048):Math.max(v,d),p=e({},Ts(),null==t?void 0:t.resourceAttributes);return{serviceName:null!==(a=null!==(o=null==p?void 0:p["service.name"])&&void 0!==o?o:null==t?void 0:t.serviceName)&&void 0!==a?a:null==i?void 0:i.serviceNameDefault,serviceVersion:null!==(l=null==p?void 0:p["service.version"])&&void 0!==l?l:null==t?void 0:t.serviceVersion,environment:null!==(u=null==p?void 0:p["deployment.environment"])&&void 0!==u?u:null==t?void 0:t.environment,resourceAttributes:p,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:h,maxBufferSize:v,maxQueueSize:f,maxBatchRecordsPerPost:100,rateCapWindowMs:h,maxLogsPerInterval:d,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}var As=["debug","log","warn","error","info"],Os="console",Ms="__posthogHandledLogsRequestError",Is=(t,i)=>{var e=t instanceof Error?t:new Error(i);return e[Ms]=!0,e},$s=t=>!!t&&"object"==typeof t&&!0===t[Ms],js={featureFlags:class{constructor(t){this.name="featureFlags",this.Me=!1,this.featureFlagEventHandlers=[],this.l=ds,this.Ie={},this.$e={},this.je=[],this.Le=!1,this.De=!1,this.Ne=0,this.ze=!1,this.Be=!1,this.He=!1,this.Ue=!1,this.Ve=0,this.qe=()=>{var t=this.We();this.Ve=0,t&&this.reloadFeatureFlags()},this.Ke=()=>{var t,i=this.Je;c(i)||this.P.remoteRequestsDisabled||!oi||"hidden"===oi.visibilityState||Date.now()-(null!==(t=this.Ge)&&void 0!==t?t:0)<i||(this.reloadFeatureFlags(),this.Xe())},this.Ze=()=>{"visible"===(null==oi?void 0:oi.visibilityState)&&this.Ke()},"get"in t?this.Nt=t:(this._instance=t,this.Qe=new vs(t.config,t._shouldDisableFlags()),this.Nt=this.Qe)}updateConfig(t,i){var e;null==(e=this.Qe)||e.update(t,i),this.Ot&&this.Ye()}setup(t){return this.oi=t,this.l=t.logger.createLogger("[FeatureFlags]"),Nr(t.kv.initialize(),()=>{this.oi===t&&(this.oi=void 0,this.Ot=t,this.tr(t))})}tr(t){var i;if(this.Ot===t)return si&&_i(si,"online",this.qe),this.Ye(),this.ir=t.registerDynamicEventProperties(()=>this.er()?this.Ie:this.$e),this.rr=null==(i=this._instance)||null==(i=i.persistence)?void 0:i.onCrossTabFeatureFlagChange(()=>{this.sr(),this.nr(),this.ar()}),this.nr(),this.initialize()}Ye(){var t=this.P.refreshIntervalMs,i=!this.P.remoteRequestsDisabled&&oi&&!c(t)&&t>0?t:void 0;i!==this.Je&&(this.lr(),c(i)||(this.Je=i,this.Xe(),null!=oi&&oi.addEventListener&&_i(oi,Ve,this.Ze)))}Xe(){c(this.Je)||(c(this.ur)||clearInterval(this.ur),this.Ge=Date.now(),this.ur=setInterval(this.Ke,this.Je))}lr(){c(this.ur)||(clearInterval(this.ur),this.ur=void 0,null==oi||null==oi.removeEventListener||oi.removeEventListener(Ve,this.Ze)),this.Je=void 0,this.Ge=void 0}destroy(){this.hr()}dispose(){this.hr()}hr(){var t,i;this.lr(),this.Ne++,this.Be=!1,this.oi=void 0,this.Ot&&(this.vr(),null==(t=this.ir)||t.dispose(),this.ir=void 0,null==(i=this.rr)||i.call(this),this.rr=void 0,this.je=[],null==si||si.removeEventListener("online",this.qe),this.Ot=void 0)}get P(){return this.Nt.get()}dr(t){var i;return this.cr&&t in this.cr?this.cr[t]:null==(i=this.Ot)?void 0:i.kv.get(t)}sr(){return!!this.cr&&(this.cr=void 0,!0)}pr(){var t;return!c(null==(t=this.Ot)?void 0:t.kv.get(me))&&this.sr()}gr(t){this._r(()=>{var i;return null==(i=this.Ot)?void 0:i.kv.set(t)})}br(t,i,e){var r;if(null!=(r=this._instance)&&r.persistence&&t[me]){var s=this.dr(me)||{},n=t[me]||{},a=i.flags||i.featureFlags,o=i.flags?Object.entries(i.flags).filter(t=>{var i=t[1];return!(null!=i&&i.failed)}).map(t=>t[0]):[],l=!!i.errorsWhileComputingFlags&&!!i.flags,h=l?o:e&&!u(a)?Object.keys(a||{}):Array.from(new Set([...Object.keys(s),...Object.keys(n)])),v=this.dr(ke)||{},d=t[ke]||{},f=l||e?h:Array.from(new Set([...Object.keys(v),...Object.keys(d)])),p=!l&&!e,g=!!p||h,_=!!p||f,b={[ye]:g,[me]:g,[ke]:_};for(var m of(t[Se]&&(b[Se]=g),[xe,Ne,Ee]))c(t[m])||(b[m]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(b)}}mr(t){this._r(()=>{var i;return null==(i=this.Ot)?void 0:i.kv.remove(t)})}_r(t){try{t()}catch(t){this.l.error("Failed to update feature flag persistence",t)}}nr(){var t={};for(var i of[ye,ke,xe,Fe]){var r=this.dr(i);c(r)||(t[i]=r)}this.Ie=t;var s=e({},t),n=this.dr(me);if(n)for(var a of Object.entries(n))s["$feature/"+a[0]]=a[1];this.$e=s}er(){var t=this.P.cacheTtlMs;if(!t||0>=t)return!1;var i=this.dr(Ne);return"number"!=typeof i||Date.now()-i>t}yr(){return!!this.er()&&(this.Ue||this.De||(this.Ue=!0,this.l.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}wr(){var t=this.P.evaluationContexts;return null!=t&&t.length?t.filter(t=>{var i=t&&"string"==typeof t&&t.trim().length>0;return i||this.l.error("Invalid evaluation context found:",t,"Expected non-empty string"),i}):[]}Sr(){var t=this.P.flagKeys;if(!c(t))return t.filter(t=>{var i=t&&"string"==typeof t&&t.trim().length>0;return i||this.l.error("Invalid flag key found:",t,"Expected non-empty string"),i})}initialize(){var t,i,e=this.P,r=null!==(t=null==(i=e.bootstrap)?void 0:i.featureFlags)&&void 0!==t?t:{};if(Object.keys(r).length){var s,n,a=null!==(s=null==(n=e.bootstrap)?void 0:n.featureFlagPayloads)&&void 0!==s?s:{},o=Object.keys(r).filter(t=>!c(r[t])).reduce((t,i)=>(t[i]=r[i],t),{}),l=Object.keys(a).filter(t=>o[t]).reduce((t,i)=>(t[i]=a[i],t),{});return this.kr({featureFlags:o,featureFlagPayloads:l},void 0,{persist:!1})}}updateFlags(t,i,r){var s,n,a=null!=r&&r.merge&&null!==(s=this.dr(me))&&void 0!==s?s:{},o=null!=r&&r.merge&&null!==(n=this.dr(ke))&&void 0!==n?n:{},l=e({},a,t),u=e({},o,i),h={};for(var v of Object.entries(l)){var d=v[0],f=v[1];h[d]={key:d,enabled:jt(f),variant:Lt(f),reason:void 0,metadata:c(null==u?void 0:u[d])?void 0:{id:0,version:void 0,description:void 0,payload:u[d]}}}this.kr({flags:h})}get hasLoadedFlags(){return this.Le}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.dr(Se),i=this.dr(Fe),r=this.dr(Pe);if(!r&&!i)return t||{};var s=fi({},t||{}),n=[...new Set([...Object.keys(r||{}),...Object.keys(i||{})])];for(var a of n){var o,l,u=s[a],h=null==i?void 0:i[a],v=c(h)?null!==(o=null==u?void 0:u.enabled)&&void 0!==o&&o:!!h,d=c(h)?null==u?void 0:u.variant:"string"==typeof h?h:void 0,f=null==r?void 0:r[a],p=e({},u,{enabled:v,variant:v?null!=d?d:null==u?void 0:u.variant:void 0});v!==(null==u?void 0:u.enabled)&&(p.original_enabled=null==u?void 0:u.enabled),d!==(null==u?void 0:u.variant)&&(p.original_variant=null==u?void 0:u.variant),f&&(p.metadata=e({},null==u?void 0:u.metadata,{payload:f,original_payload:null==u||null==(l=u.metadata)?void 0:l.payload})),s[a]=p}return this.Me||(this.l.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:r,finalDetails:s}),this.Me=!0),s}getAllFeatureFlags(){var t=this.getFlagVariants(),i=this.getFlagPayloads();return Object.keys(t).map(e=>{var r=t[e];return{key:e,enabled:jt(r),variant:Lt(r),payload:$t(i[e])}})}getFlagVariants(){var t=this.dr(me),i=this.dr(Fe);if(!i)return t||{};for(var e=fi({},t||{}),r=Object.keys(i),s=0;r.length>s;s++)e[r[s]]=i[r[s]];return this.Me||(this.l.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:i,finalFlags:e}),this.Me=!0),e}getFlagPayloads(){var t=this.dr(ke),i=this.dr(Pe);if(!i)return t||{};for(var e=fi({},t||{}),r=Object.keys(i),s=0;r.length>s;s++)e[r[s]]=i[r[s]];return this.Me||(this.l.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:i,finalPayloads:e}),this.Me=!0),e}reloadFeatureFlags(){this.ze||this.P.featureFlagsDisabled||this.We()||(this.De&&(this.Be=!0),this.Er||(this.je.slice().forEach(t=>{try{t()}catch(t){this.l.error("Error while running feature flags reloading callback",t)}}),this.Er=setTimeout(()=>{this.Fr()},5)))}vr(){clearTimeout(this.Er),this.Er=void 0}onReloading(t){return this.je.push(t),()=>{this.je=this.je.filter(i=>i!==t)}}ensureFlagsLoaded(){this.Le||this.De||this.Er||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.ze=t}resetFlagCallReported(){this.mr(je)}Fr(t){this.vr();var i=this.Ot;if(i&&!this.P.remoteRequestsDisabled&&!this.We())if(this.De)this.Be=!0;else{var r={token:i.projectToken,distinct_id:i.distinctId,groups:i.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:e({},i.initialPersonProperties,this.dr(Ce)||{},{$lib:i.library.name,$lib_version:i.library.version}),group_properties:this.dr(Te),timezone:br()};c(i.deviceId)||(r.$device_id=i.deviceId),(null!=t&&t.disableFlags||this.P.featureFlagsDisabled)&&(r.disable_flags=!0);var s=this.wr();s.length&&(r.evaluation_contexts=s);var n=this.Sr();c(n)||(r.flag_keys=n);var a=this.P.onlyEvaluateSurveyFeatureFlags,o="/flags/?v=2"+(a?"&only_evaluate_survey_feature_flags=true":""),l=this.Ne;this.De=!0;var u=()=>{this.Be&&(this.Be=!1,this.Fr())},h=t=>{this.De=!1,l===this.Ne?(this.gr({[De]:[ps]}),this.l.error("Feature flag request failed",t),this.pr()&&this.ar(!0),u()):u()};try{i.sendRequest(o,{target:"flags",method:"POST",body:r,compression:this.P.compression,sentAt:"body",timeoutMs:this.P.requestTimeoutMs}).then(t=>{var i,e,s=null!==(i=t.json)&&void 0!==i?i:{},n=200!==t.statusCode;if(this.De=!1,l===this.Ne){if(this.Pr(t.statusCode),n||this.Be||(this.$anon_distinct_id=void 0),!r.disable_flags||this.Be){this.He=!n;var o=[];t.error?o.push(t.error instanceof Error&&"AbortError"===t.error.name?"timeout":t.error instanceof Error?ps:"unknown_error"):200!==t.statusCode&&o.push("api_error_"+t.statusCode),s.errorsWhileComputingFlags&&o.push("errors_while_computing_flags");var h=!(null==(e=s.quotaLimited)||!e.includes("feature_flags"));h&&o.push("quota_limited"),this.gr({[De]:o}),h?this.l.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):r.disable_flags||this.kr(s,n,{partialResponse:a}),u()}}else u()}).catch(h)}catch(t){h(t)}}}We(){return Ge(this.Ve,3)}Pr(t){this.Ve=Xe(t,this.Ve,3,()=>this.l.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes."))}getFeatureFlag(t,i){var e;if(void 0===i&&(i={}),!i.fresh||this.He)if(this.Le||this.getFlags()&&this.getFlags().length>0){if(!this.yr()){var r=this.getFeatureFlagResult(t,i);return null!==(e=null==r?void 0:r.variant)&&void 0!==e?e:null==r?void 0:r.enabled}}else this.l.warn('getFeatureFlag for key "'+t+fs)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var i=this.getFeatureFlagResult(t,{send_event:!1});return null==i?void 0:i.payload}getFeatureFlagResult(t,i){if(void 0===i&&(i={}),!i.fresh||this.He)if(this.Le||this.getFlags()&&this.getFlags().length>0){if(!this.yr()){var r,s=this.getFlagVariants(),n=t in s,a=s[t],o=this.getFlagPayloads()[t],l=String(a),h=this.dr(xe)||void 0,v=this.dr(Ne)||void 0,d=this.dr(je)||{};if(this.P.deduplicateCallsPerSession){var f,p=null==(f=this.Ot)?void 0:f.session.sessionId,g=this.dr(Le);p&&p!==g&&(d={},r=p)}if(i.send_event||!("send_event"in i))if(t in d&&d[t].includes(l))r&&this.gr({[je]:d,[Le]:r});else{var _,b,m,y,w,S,k,x,E,F,P,C;u(d[t])?d[t].push(l):d[t]=[l],this.gr(e({[je]:d},r?{[Le]:r}:{}));var T=this.getFeatureFlagDetails(t),R=[...null!==(_=this.dr(De))&&void 0!==_?_:[]];c(a)&&R.push("flag_missing");var A={$feature_flag:t,$feature_flag_response:a,$feature_flag_payload:null!=o?o:null,$feature_flag_request_id:h,$feature_flag_evaluated_at:v,$feature_flag_bootstrapped_response:null!==(b=null==(m=this.P.bootstrap)||null==(m=m.featureFlags)?void 0:m[t])&&void 0!==b?b:null,$feature_flag_bootstrapped_payload:null!==(y=null==(w=this.P.bootstrap)||null==(w=w.featureFlagPayloads)?void 0:w[t])&&void 0!==y?y:null,$used_bootstrap_value:!this.He};c(null==T||null==(S=T.metadata)?void 0:S.has_experiment)||(A.$feature_flag_has_experiment=T.metadata.has_experiment),c(null==T||null==(k=T.metadata)?void 0:k.version)||(A.$feature_flag_version=T.metadata.version);var O,M=null!==(x=null==T||null==(E=T.reason)?void 0:E.description)&&void 0!==x?x:null==T||null==(F=T.reason)?void 0:F.code;M&&(A.$feature_flag_reason=M),null!=T&&null!=(P=T.metadata)&&P.id&&(A.$feature_flag_id=T.metadata.id),c(null==T?void 0:T.original_variant)&&c(null==T?void 0:T.original_enabled)||(A.$feature_flag_original_response=c(T.original_variant)?T.original_enabled:T.original_variant),null!=T&&null!=(C=T.metadata)&&C.original_payload&&(A.$feature_flag_original_payload=null==T||null==(O=T.metadata)?void 0:O.original_payload),R.length&&(A.$feature_flag_error=R.join(",")),this.Cr(A)}else r&&this.gr({[je]:d,[Le]:r});if(n)return{key:t,enabled:!!a,variant:"string"==typeof a?a:void 0,payload:$t(o)}}}else this.l.warn('getFeatureFlagResult for key "'+t+fs)}Cr(t){try{var i;null==(i=this.Ot)||i.capture("$feature_flag_called",t).catch(t=>{this.l.error("Failed to capture feature flag call",t)})}catch(t){this.l.error("Failed to capture feature flag call",t)}}getRemoteConfigPayload(t,i){this.Tr(t,i)}Tr(t,e){var r=this;return i(function*(){var i=r.Ot;if(i){var s={distinct_id:i.distinctId,token:i.projectToken,person_properties:{$lib:i.library.name,$lib_version:i.library.version}},n=r.wr();n.length&&(s.evaluation_contexts=n);var a,o=r.Sr();c(o)||(s.flag_keys=o);try{var l,u=null==(l=(yield i.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:s,compression:r.P.compression,sentAt:"body",timeoutMs:r.P.requestTimeoutMs})).json)?void 0:l.featureFlagPayloads;a=(null==u?void 0:u[t])||void 0}catch(t){return void r.l.error("Remote config feature flag request failed",t)}try{e(a)}catch(t){r.l.error("Remote config feature flag callback failed",t)}}})()}isFeatureEnabled(t,i){if(void 0===i&&(i={}),i.fresh&&!this.He)return i.defaultValue;if(!(this.Le||this.getFlags()&&this.getFlags().length>0))return this.l.warn('isFeatureEnabled for key "'+t+fs),i.defaultValue;var e=this.getFeatureFlag(t,i);return c(e)?i.defaultValue:!!e}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(i=>i!==t)}receivedFeatureFlags(t,i,e){this.kr(t,i,e)}kr(t,i,r){if(this.Ot){this.Le=!0;var s=function(t,i,r,s,n,a){void 0===i&&(i={}),void 0===r&&(r={}),void 0===s&&(s={}),void 0===a&&(a=ds);var o=((t,i)=>{var r=t.flags;return r?e({},t,{featureFlags:Object.fromEntries(Object.keys(r).map(t=>{var i;return[t,null!==(i=r[t].variant)&&void 0!==i?i:r[t].enabled]})),featureFlagPayloads:Object.fromEntries(Object.keys(r).filter(t=>r[t].enabled).filter(t=>{var i;return!c(null==(i=r[t].metadata)?void 0:i.payload)}).map(t=>{var i;return[t,null==(i=r[t].metadata)?void 0:i.payload]}))}):(t.featureFlags&&i.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t)})(t,a),l=o.flags,h=o.featureFlags,v=o.featureFlagPayloads;if(h){var d=t.requestId,f=t.evaluatedAt;if(u(h)){a.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var p={};if(h)for(var g=0;h.length>g;g++)p[h[g]]=!0;return{[ye]:h,[me]:p,[Ee]:!1}}var _=h,b=v,m=l;if(null!=n&&n.partialResponse){var y=Object.keys(_),w=b||{};_=e({},i,_),b=e({},r,w),y.forEach(t=>{var i;t in w||null==(i=b)||delete i[t]}),m=e({},s,m)}else if(t.errorsWhileComputingFlags)if(l){var S=new Set(Object.keys(l).filter(t=>{var i;return!(null!=(i=l[t])&&i.failed)}));_=e({},i,Object.fromEntries(Object.entries(_).filter(t=>S.has(t[0]))));var k=Object.fromEntries(Object.entries(b||{}).filter(t=>S.has(t[0])));b=e({},r,k),S.forEach(t=>{var i;t in k||null==(i=b)||delete i[t]}),m=e({},s,Object.fromEntries(Object.entries(m||{}).filter(t=>S.has(t[0]))))}else _=e({},i,_),b=e({},r,b),m=e({},s,m);return e({[ye]:Object.keys(_s(_)),[me]:_||{},[ke]:b||{},[Se]:m||{},[Ee]:!0===t.minimalFlagCalledEvents},d?{[xe]:d}:{},f?{[Ne]:f}:{})}}(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),r,this.l);if(s)if(!1===(null==r?void 0:r.persist)){var n=!c(this.Ot.kv.get(me));this.cr=s,n||this.gr(s)}else this.sr(),this.br(s,t,!(null==r||!r.partialResponse)),this.gr(s);else i&&this.pr();i||(this.Ue=!1),this.ar(i)}}override(t,i){void 0===i&&(i=!1),this.l.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:i})}overrideFeatureFlags(t){this.Rr(t)}Rr(t){if(this.Ot){if(!1===t)return this.mr([Fe,Pe]),this.ar(),void cs.info("All overrides cleared");if(u(t))return this.gr({[Fe]:gs(t)}),this.ar(),void cs.info("Flag overrides set",{flags:t});if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i,e=t;this.Me=Boolean(null!==(i=e.suppressWarning)&&void 0!==i&&i);var r={},s=e.flags,n=e.payloads;return s&&(r[Fe]=u(s)?gs(s):s),n&&(r[Pe]=n),Object.keys(r).length&&this.gr(r),!1===s&&!1===n?this.mr([Fe,Pe]):!1===s?this.mr(Fe):!1===n&&this.mr(Pe),this.ar(),!1===s?cs.info("Flag overrides cleared"):s&&cs.info("Flag overrides set",{flags:s}),void(!1===n?cs.info("Payload overrides cleared"):n&&cs.info("Payload overrides set",{payloads:n}))}if(t&&"object"==typeof t)return this.gr({[Fe]:t}),this.ar(),void cs.info("Flag overrides set",{flags:t});this.l.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}else this.l.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.Le){var i=this.Ar(),e=i.flags,r=i.flagVariants;try{t(e,r)}catch(t){this.l.error("Error while running feature flags callback",t)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,i,r){var s,n=(this.dr(we)||[]).find(i=>i.flagKey===t),a={["$feature_enrollment/"+t]:i},o={$feature_flag:t,$feature_enrollment:i,$set:a};n&&(o.$early_access_feature_name=n.name),r&&(o.$feature_enrollment_stage=r);var l=e({},this.getFlagVariants(),{[t]:i});null==(s=this._instance)||null==(s=s.persistence)||s.markCrossTabFeatureFlagChanges({[ye]:[t],[me]:[t],[Ce]:Object.keys(a)}),this.gr({[ye]:Object.keys(_s(l)),[me]:l,[Ce]:e({},this.dr(Ce)||{},a)}),this.ar();try{var u;null==(u=this.Ot)||u.capture("$feature_enrollment_update",o).catch(t=>{this.l.error("Failed to capture early access feature enrollment",t)})}catch(t){this.l.error("Failed to capture early access feature enrollment",t)}}getEarlyAccessFeatures(t,i,e){void 0===i&&(i=!1);var r=this.dr(we);!r||i?this.Or(t,e):t(r)}Or(t,e){var r=this;return i(function*(){var i=r.Ot;if(i){var s,n=e?"&"+e.map(t=>"stage="+t).join("&"):"";try{var a=yield i.sendRequest("/api/early_access_features/?token="+i.projectToken+n,{target:"api",method:"GET",sentAt:"query"});if(!a.json)return;s=a.json.earlyAccessFeatures,r.gr({[we]:s})}catch(t){return void r.l.error("Early access feature request failed",t)}try{t(s)}catch(t){r.l.error("Early access feature callback failed",t)}}})()}Ar(){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),{})}}ar(t){this.nr();var i=this.Ar(),e=i.flags,r=i.flagVariants;this.featureFlagEventHandlers.forEach(i=>{try{i(e,r,{errorsLoading:t})}catch(t){this.l.error("Error while running feature flags callback",t)}})}setPersonPropertiesForFlags(t,i){void 0===i&&(i=!0),this.Mr(t,i)}Mr(t,i){void 0===i&&(i=!0);var r=this.dr(Ce)||{},s=(null==t?void 0:t.$set)||(null!=t&&t.$set_once?{}:t),n=null==t?void 0:t.$set_once,a={};if(n)for(var o in n)({}).hasOwnProperty.call(n,o)&&(o in r||(a[o]=n[o]));this.gr({[Ce]:e({},r,a,s)}),i&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,i){void 0===i&&(i=!0);var r=e({},this.dr(Ce)||{});t.forEach(t=>{delete r[t]}),this.gr({[Ce]:r}),i&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t){void 0===t&&(t=!0),this.mr(Ce),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,i){void 0===i&&(i=!0);var r=this.dr(Te)||{},s=e({},r);for(var n of Object.keys(t))s[n]=e({},r[n],t[n]);this.gr({[Te]:s}),i&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var i=this.dr(Te)||{};this.gr({[Te]:e({},i,{[t]:{}})})}else this.mr(Te)}reset(){this.Ne++,this.Be=!1,this.Ie={},this.$e={},this.cr=void 0,this.Le=!1,this.ze=!1,this.He=!1,this.$anon_distinct_id=void 0,this.vr(),this.Me=!1,this.Ve=0}}},Ls={sessionRecording:class{get P(){return this._instance.config}get Ir(){return this._instance.persistence}get started(){var t;return!(null==(t=this.$r)||!t.isStarted)}get status(){var t,i;return this.jr===Cr||this.jr===Tr?this.jr:null!==(t=null==(i=this.$r)?void 0:i.status)&&void 0!==t?t:this.jr}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.jr=Fr,this.Lr=void 0,this.Dr=!1,this.Nr=(()=>{var t;if(null==oi||!oi.visibilityState||"visible"===oi.visibilityState)return!0;var i=null==si||null==(t=si.performance)||null==t.getEntriesByType?void 0:t.getEntriesByType("visibility-state");return!(null!=i&&i.length)||i.some(t=>"visible"===t.name)})(),this.Ze=()=>{var t;"visible"===(null==oi?void 0:oi.visibilityState)&&(this.Nr=!0,null==(t=this.$r)||null==t.setDocumentWasEverVisible||t.setDocumentWasEverVisible(!0))},this._instance=t,!this._instance.sessionManager)throw Ar.error("started without valid sessionManager"),new Error(Rr+" started without valid sessionManager. This is a bug.");if("always"===this.P.cookieless_mode)throw new Error(Rr+' cannot be used with cookieless_mode="always"');null!=oi&&oi.addEventListener&&_i(oi,"visibilitychange",this.Ze)}initialize(){this.startIfEnabledOrStop()}dispose(t){var i=(void 0===t?{}:t).discardBufferedEvents,e=void 0!==i&&i;this.Dr=!0,null==oi||null==oi.removeEventListener||oi.removeEventListener("visibilitychange",this.Ze),e?this.zr(!0):this.stopRecording()}get Br(){var t,i=!(null==(t=this._instance.get_property(ge))||!t.enabled),e=!this.P.disable_session_recording,r=this.P.disable_session_recording||this._instance.consent.isOptedOut();return si&&i&&e&&!r}startIfEnabledOrStop(t){var i;if(!(this.Dr||this.Br&&null!=(i=this.$r)&&i.isStarted)){var e=!c(Object.assign)&&!c(Array.from);this.Br&&e?(this.Hr(t),Ar.info("starting")):(this.jr=Fr,this.stopRecording())}}Hr(t){var i,e;if(this.Br)if(this.jr!==Cr&&this.jr!==Tr&&(this.jr=Pr),null!=nr&&null!=(i=nr.__PosthogExtensions__)&&null!=(i=i.rrweb)&&i.record&&null!=(e=nr.__PosthogExtensions__)&&e.initSessionRecording)this.Ur(t);else{var r,s=this._instance.sessionManager;null==(r=nr.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.Vr,i=>{if(!this.Dr&&this.Br&&this._instance.sessionManager===s)return i?(this._instance.register_for_session({[ze]:!0}),Ar.error("could not load recorder",i)):void this.Ur(t);this.jr=Fr})}}stopRecording(){var t,i;null==(t=this.Lr)||t.call(this),this.Lr=void 0,null==(i=this.$r)||i.stop()}zr(t){var i,e;void 0===t&&(t=!1),null==(i=this.Lr)||i.call(this),this.Lr=void 0,null==(e=this.$r)||e.discard({discardProducerEvents:t})}qr(){var t,i;null==(t=this.Ir)||t.unregister("$session_is_sampled"),null==(i=this.Ir)||i.unregister("$replay_sample_rate")}Wr(t,i){if(_(t))return null;var e,r=b(t)?t:parseFloat(t);return"number"!=typeof(e=r)||!Number.isFinite(e)||0>e||e>1?(Ar.warn(i+" must be between 0 and 1. Ignoring invalid value:",t),null):r}Kr(t){if(this.Ir){var i,r,s=this.Ir,n=()=>{var i,r=!1===t.sessionRecording?void 0:t.sessionRecording,n=this.Wr(null==(i=this.P.session_recording)?void 0:i.sampleRate,"session_recording.sampleRate"),a=this.Wr(null==r?void 0:r.sampleRate,"remote config sampleRate"),o=null!=n?n:a;_(o)&&this.qr();var l=null==r?void 0:r.minimumDurationMilliseconds;s.register({[ge]:e({cache_timestamp:Date.now(),enabled:!!r},r,{networkPayloadCapture:e({capturePerformance:t.capturePerformance},null==r?void 0:r.networkPayloadCapture),canvasRecording:{enabled:null==r?void 0:r.recordCanvas,fps:null==r?void 0:r.canvasFps,quality:null==r?void 0:r.canvasQuality},sampleRate:o,minimumDurationMilliseconds:c(l)?null:l,endpoint:null==r?void 0:r.endpoint,triggerMatchType:null==r?void 0:r.triggerMatchType,masking:null==r?void 0:r.masking,urlTriggers:null==r?void 0:r.urlTriggers,version:null==r?void 0:r.version,triggerGroups:null==r?void 0:r.triggerGroups})})};n(),null==(i=this.Lr)||i.call(this),this.Lr=null==(r=this._instance.sessionManager)?void 0:r.onSessionId(n)}}onRemoteConfig(t){var i=t.ok?t.config:void 0;return i&&"sessionRecording"in i?!1===i.sessionRecording?(this.Kr(i),void this.zr()):(this.Kr(i),void this.startIfEnabledOrStop()):(this.jr===Cr&&(this.jr=Tr,Ar.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,i){var e;void 0===i&&(i="log"),null!=(e=this.$r)&&e.log?this.$r.log(t,i):Ar.warn("log called before recorder was ready")}get Vr(){var t,i,e=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.get_property(ge);return(null==e||null==(i=e.scriptConfig)?void 0:i.script)||"lazy-recorder"}Jr(){var t,i=this._instance.get_property(ge);if(!i)return!1;try{t="object"==typeof i?i:JSON.parse(i)}catch(t){return Ar.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}return!_(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}Ur(t){var i,e,r;if(!this.Dr&&this.Br&&this._instance.sessionManager){if(null==(i=nr.__PosthogExtensions__)||!i.initSessionRecording)return Ar.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[ze]:!0});var s;if(this.$r||(this.$r=null==(s=nr.__PosthogExtensions__)?void 0:s.initSessionRecording(this._instance,this.Nr),this.$r._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Jr()){if(this.jr===Tr||this.jr===Cr)return;return this.jr=Cr,Ar.info("persisted remote config is stale, requesting fresh config before starting"),void new Er(this._instance).load()}this.jr=Pr,null==(e=(r=this.$r).setDocumentWasEverVisible)||e.call(r,this.Nr),this.$r.start(t)}else this.jr=Fr}onRRwebEmit(t){var i;null==(i=this.$r)||null==i.onRRwebEmit||i.onRRwebEmit(t)}overrideLinkedFlag(){var t,i;this.$r||null==(i=this.Ir)||i.register({[be]:!0}),null==(t=this.$r)||t.overrideLinkedFlag()}overrideSampling(){var t,i;this.$r||null==(i=this.Ir)||i.register({[_e]:!0}),null==(t=this.$r)||t.overrideSampling()}overrideTrigger(t){var i,e;this.$r||null==(e=this.Ir)||e.register({["url"===t?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null==(i=this.$r)||i.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.$r)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,i){var e;return!(null==(e=this.$r)||!e.tryAddCustomEvent(t,i))}flushBeforeIdentityReset(){var t;null==(t=this.$r)||null==t.flushBeforeIdentityReset||t.flushBeforeIdentityReset()}}},Ds={autocapture:class extends er{constructor(t){super(new rr(t)),this.instance=t}},historyAutocapture:class{constructor(t){this._instance=t,this.Gr=this.Xr()}initialize(){this.startIfEnabled()}get isEnabled(){var t=this.Zr();return!!(t.path||t.search||this.Qr(t))}startIfEnabled(){this.isEnabled&&(vi.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.Gr=this.Xr(),this.startIfEnabled()}stop(){this.Yr&&this.Yr(),this.Yr=void 0,this.ts&&this.ts(),this.ts=void 0,vi.info("History API monitoring stopped")}monitorHistoryChanges(){si&&si.history&&(this.es("pushState"),this.es("replaceState"),this.rs(),this.Qr()&&this.ss())}es(t){var i;if(si&&(null==(i=si.history[t])||!i.__posthog_wrapped__)){var e=this;dr(si.history,t,i=>function(r,s,n){i.call(this,r,s,n),e.ns(t)})}}Xr(){var t=null==si?void 0:si.location;if(null!=t&&t.pathname)return{pathname:t.pathname,search:t.search,hash:t.hash}}Zr(){var t=this._instance.config.capture_pageview;return"history_change"===t?{path:!0}:v(t)?t:{}}Qr(t){return void 0===t&&(t=this.Zr()),!!t.hash&&!this._instance.config.disable_capture_url_hashes}ls(t){var i=this.Zr(),e=this.Gr;return!(!e||!(i.path&&t.pathname!==e.pathname||i.search&&t.search!==e.search||this.Qr(i)&&t.hash!==e.hash))}ns(t){try{var i=this.Xr();if(!i)return;this.ls(i)&&this._instance.capture("$pageview",{navigation_type:t}),this.Gr=i}catch(i){vi.error("Error capturing "+t+" pageview",i)}}rs(){if(!this.Yr){var t=()=>{this.ns("popstate")};_i(si,"popstate",t),this.Yr=()=>{si&&si.removeEventListener("popstate",t)}}}ss(){if(!this.ts){var t=()=>{this.ns("hashchange")};_i(si,"hashchange",t),this.ts=()=>{si&&si.removeEventListener("hashchange",t)}}}},heatmaps:class{get P(){return this.instance.config}constructor(t){var i;this.us=!1,this.It=!1,this.hs=null,this.instance=t,this.us=!(null==(i=this.instance.persistence)||!i.props[oe]),this.rageclicks=new ne(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return v(this.P.capture_heatmaps)&&this.P.capture_heatmaps.flush_interval_milliseconds&&(t=this.P.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return _(this.P.capture_heatmaps)?_(this.P.enable_heatmaps)?this.us:this.P.enable_heatmaps:!1!==this.P.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.It)return;Or.info("starting..."),this.vs(),this.Ze()}else{var t;clearInterval(null!==(t=this.hs)&&void 0!==t?t:void 0),this.ds(),this.getAndClearBuffer()}}onRemoteConfig(t){if(t.ok){var i=t.config;if("heatmaps"in i){var e=!!i.heatmaps;this.instance.persistence&&this.instance.persistence.register({[oe]:e}),this.us=e,this.startIfEnabled()}}}getAndClearBuffer(){var t=this.cs;return this.cs=void 0,t}fs(t){Mr(t.originalEvent)&&this.ps(t.originalEvent,"deadclick")}Ze(){this.hs&&clearInterval(this.hs),this.hs="visible"===(null==oi?void 0:oi.visibilityState)?setInterval(this.gs.bind(this),this.flushIntervalMilliseconds):null}vs(){si&&oi&&(this._s=this.gs.bind(this),_i(si,qe,this._s),this.bs=t=>this.ps(t||(null==si?void 0:si.event)),_i(oi,"click",this.bs,{capture:!0}),this.ys=t=>this.ws(t||(null==si?void 0:si.event)),_i(oi,"mousemove",this.ys,{capture:!0}),this.Ss=new lr(this.instance,or,this.fs.bind(this)),this.Ss.startIfEnabledOrStop(),this.ks=this.Ze.bind(this),_i(oi,Ve,this.ks),this.It=!0)}ds(){var t;si&&oi&&(this._s&&si.removeEventListener(qe,this._s),this.bs&&oi.removeEventListener("click",this.bs,{capture:!0}),this.ys&&oi.removeEventListener("mousemove",this.ys,{capture:!0}),this.ks&&oi.removeEventListener(Ve,this.ks),clearTimeout(this.xs),null==(t=this.Ss)||t.stop(),this.It=!1)}Es(t,i){var e=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),a=function(t,i,e){for(var r=t;r&&Si(r)&&!ki(r,"body");){if(r===e)return!1;var n=void 0;try{var a,o,l;n=null==(a=null!==(o=null==(l=r.ownerDocument)?void 0:l.defaultView)&&void 0!==o?o:si)?void 0:a.getComputedStyle(r).position}catch(t){return!1}if(s(i,n))return!0;r=ji(r)}return!1}(Oi(t),["fixed","sticky"],n);return{x:t.clientX+(a?0:r),y:t.clientY+(a?0:e),target_fixed:a,type:i}}ps(t,i){var r;if(void 0===i&&(i="click"),!wi(t.target)&&Mr(t)){var s=this.Es(t,i);null!=(r=this.rageclicks)&&r.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&Hi(Oi(t),this.instance.config.rageclick)&&this.ft(e({},s,{type:"rageclick"})),this.ft(s)}}ws(t){!wi(t.target)&&Mr(t)&&(clearTimeout(this.xs),this.xs=setTimeout(()=>{this.ft(this.Es(t,"mousemove"))},500))}ft(t){if(si){var i=this.P.disable_capture_url_hashes?K(si.location.href):si.location.href,e=this.P.custom_personal_data_properties,r=this.P.mask_personal_data_properties?[...fr,...e||[]]:[],s=Ke(i,r,gr);this.cs=this.cs||{},this.cs[s]||(this.cs[s]=[]),this.cs[s].push(t)}}gs(){this.cs&&!d(this.cs)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:lr,webVitalsAutocapture:class{constructor(t){var i;this.us=!1,this.It=!1,this.cs={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Fs=()=>{clearTimeout(this.Ps),this.Ps=void 0,0!==this.cs.metrics.length&&(this._instance.capture("$web_vitals",e({$current_url:this.cs.url},this.cs.metrics.reduce((t,i)=>e({},t,{["$web_vitals_"+i.name+"_event"]:e({},i),["$web_vitals_"+i.name+"_value"]:i.value}),{}))),this.cs={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Cs=t=>{var i;if(this.cs=this.cs||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},_(null==t?void 0:t.name)||_(null==t?void 0:t.value))mr.error("Invalid metric received",t);else{var r="string"==typeof t.navigationURL?t.navigationURL:void 0,s=this.Ts(r);if(!c(s)){var n=b(t.navigationId)||"string"==typeof t.navigationId?"navigation:"+t.navigationId:"url:"+s;if(!this.Rs||this.Rs>t.value){this.cs.navigationKey!==n&&(this.Fs(),this.Ps=setTimeout(this.Fs,this.flushToCaptureTimeoutMs)),c(this.cs.navigationKey)&&(this.cs.navigationKey=n,this.cs.url=s),this.cs.firstMetricTimestamp=c(this.cs.firstMetricTimestamp)?Date.now():this.cs.firstMetricTimestamp;var a=null==(i=this._instance.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0),o=e({},t,r?{navigationURL:s}:{},{$current_url:s,timestamp:Date.now()});if(delete o.entries,v(t.attribution)&&this.attributionMetrics.indexOf(t.name)>-1){var l={};for(var u of kr){var h="url"===u&&"string"==typeof t.attribution[u]?this.Ts(t.attribution[u]):t.attribution[u];c(h)||(l[u]=h)}o.attribution=l}else delete o.attribution;c(a)||(o.$session_id=a.sessionId,o.$window_id=a.windowId),this.cs.metrics.push(o),this.cs.metrics.length===this.allowedMetrics.length&&this.Fs()}else mr.error("Ignoring metric with value >= "+this.Rs,t)}}},this.As=()=>{if(!this.It){var t,i,r,s,n=!1,a=nr.__PosthogExtensions__,o=null==a?void 0:a.postHogWebVitalsCallbacksByFlavor,l=(null==o?void 0:o[this.Os])||("web-vitals"===this.Os&&c(o)?null==a?void 0:a.postHogWebVitalsCallbacks:void 0);if(!c(l)){var u=l.withoutAttribution,h=this.attributionMetrics;n=!c(u),t=h.indexOf("LCP")>-1?l.onLCP:(null==u?void 0:u.onLCP)||l.onLCP,i=h.indexOf("CLS")>-1?l.onCLS:(null==u?void 0:u.onCLS)||l.onCLS,r=h.indexOf("FCP")>-1?l.onFCP:(null==u?void 0:u.onFCP)||l.onFCP,s=h.indexOf("INP")>-1?l.onINP:(null==u?void 0:u.onINP)||l.onINP}if(t&&i&&r&&s){var v={reportSoftNavs:this.useSoftNavs},d=n&&this.attributionMetrics.indexOf("INP")>-1?e({},v,{includeProcessedEventEntries:!1}):v;this.allowedMetrics.indexOf("LCP")>-1&&t(this.Cs.bind(this),v),this.allowedMetrics.indexOf("CLS")>-1&&i(this.Cs.bind(this),v),this.allowedMetrics.indexOf("FCP")>-1&&r(this.Cs.bind(this),v),this.allowedMetrics.indexOf("INP")>-1&&s(this.Cs.bind(this),d),this.It=!0}else mr.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.us=!(null==(i=this._instance.persistence)||!i.props[ve]),this.startIfEnabled()}get Ms(){return this._instance.config.capture_performance}get allowedMetrics(){var t,i,e=v(this.Ms)?null==(t=this.Ms)?void 0:t.web_vitals_allowed_metrics:void 0;return _(e)?(null==(i=this._instance.persistence)?void 0:i.props[pe])||wr:e}get flushToCaptureTimeoutMs(){return(v(this.Ms)?this.Ms.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){var t=v(this.Ms)?this.Ms.web_vitals_attribution:void 0;return m(t)?t?wr:[]:u(t)?t:Sr}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){var t=v(this.Ms)?this.Ms.__preview_web_vitals_soft_navs:void 0;return null!=t&&t}get Rs(){var t=v(this.Ms)&&b(this.Ms.__web_vitals_max_value)?this.Ms.__web_vitals_max_value:yr;return t>0&&6e4>=t?yr:t}get isEnabled(){var t=null==li?void 0:li.protocol;if("http:"!==t&&"https:"!==t)return mr.info("Web Vitals are disabled on non-http/https protocols"),!1;var i=v(this.Ms)?this.Ms.web_vitals:m(this.Ms)?this.Ms:void 0;return m(i)?i:this.us}startIfEnabled(){this.isEnabled&&!this.It&&(mr.info("enabled, starting..."),this.Gt(this.As))}onRemoteConfig(t){if(t.ok){var i=t.config;if("capturePerformance"in i){var e=v(i.capturePerformance)&&!!i.capturePerformance.web_vitals,r=v(i.capturePerformance)?i.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[ve]:e}),this._instance.persistence.register({[pe]:r})),this.us=e,this.startIfEnabled()}}}get Os(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}Gt(t){var i=nr.__PosthogExtensions__,e=this.Os,r=null==i?void 0:i.postHogWebVitalsCallbacksByFlavor;null!=r&&r[e]||"web-vitals"===e&&c(r)&&null!=i&&i.postHogWebVitalsCallbacks?t():null==i||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,i=>{i?mr.error("failed to load script",i):t()})}Ts(t){var i=t||(null==si?void 0:si.location.href);if(i){var e=this._instance.config.disable_capture_url_hashes?K(i):i,r=this._instance.config.custom_personal_data_properties,s=this._instance.config.mask_personal_data_properties?[...fr,...r||[]]:[];return Ke(e,s,gr)}mr.error("Could not determine current URL")}}},Ns={exceptionObserver:class{constructor(t){var i;this.As=()=>{var t;if(si&&this.isEnabled&&null!=(t=nr.__PosthogExtensions__)&&t.errorWrappingFunctions){var i=nr.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,e=nr.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=nr.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Is&&this.P.capture_unhandled_errors&&(this.Is=i(this.captureException.bind(this))),!this.$s&&this.P.capture_unhandled_rejections&&(this.$s=e(this.captureException.bind(this))),!this.js&&this.P.capture_console_errors&&(this.js=r(this.captureException.bind(this)))}catch(t){ur.error("failed to start",t),this.Ls()}}},this._instance=t,this.Ds=!(null==(i=this._instance.persistence)||!i.props[le]),this.Ns=new C(e({},function(t){var i,e,r,s;return void 0===t&&(t={}),{refillRate:null!==(i=null!==(e=t.exceptionRateLimiterRefillRate)&&void 0!==e?e:t.__exceptionRateLimiterRefillRate)&&void 0!==i?i:1,bucketSize:null!==(r=null!==(s=t.exceptionRateLimiterBucketSize)&&void 0!==s?s:t.__exceptionRateLimiterBucketSize)&&void 0!==r?r:10}}(this._instance.config.error_tracking),{refillInterval:1e4,l:ur})),this.P=this.zs(),this.startIfEnabledOrStop()}zs(){var t=this._instance.config.capture_exceptions,i={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return v(t)?i=e({},i,t):(c(t)?this.Ds:t)&&(i=e({},i,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),i}get isEnabled(){return this.P.capture_console_errors||this.P.capture_unhandled_errors||this.P.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(ur.info("enabled"),this.Ls(),this.Gt(this.As)):this.Ls()}Gt(t){var i,e;null!=(i=nr.__PosthogExtensions__)&&i.errorWrappingFunctions?t():null==(e=nr.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"exception-autocapture",i=>{if(i)return ur.error("failed to load script",i);t()})}Ls(){var t,i,e;null==(t=this.Is)||t.call(this),this.Is=void 0,null==(i=this.$s)||i.call(this),this.$s=void 0,null==(e=this.js)||e.call(this),this.js=void 0}onRemoteConfig(t){if(t.ok){var i=t.config;"autocaptureExceptions"in i&&(this.Ds=!!i.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[le]:this.Ds}),this.P=this.zs(),this.startIfEnabledOrStop())}}onConfigChange(){this.P=this.zs()}captureException(t){try{var i,e,r,s=null!==(i=null==t||null==(e=t.$exception_list)||null==(e=e[0])?void 0:e.type)&&void 0!==i?i:"Exception";if(this.Ns.consumeRateLimit(s))return void ur.info("Skipping exception capture because of client rate limiting.",{exception:s});null==(r=this._instance.exceptions)||r.sendExceptionEvent(t)}catch(t){}}},exceptions:class{constructor(t){var i,r;this.Bs=[],this.Hs=new Q([new _t,new Pt,new mt,new bt,new Et,new xt,new wt,new Ft],function(t){for(var i=arguments.length,r=new Array(i>1?i-1:0),s=1;i>s;s++)r[s-1]=arguments[s];return function(i,s){void 0===s&&(s=0);for(var n=[],a=i.split("\n"),o=Math.min(a.length,s+1e3),l=[],u=s;o>u;u++){var h=a[u];if(1024>=h.length){var v=ut.test(h)?h.replace(ut,"$1"):h;if(!v.match(/\S*Error: /)){for(var d of r){var c=d(v,t);if(c){n.push(c);var f=vt(n);if(f){for(var p=l.length-1;p>=0;p--){var g=l[p];if(f.start>=g.start+g.length)break;l.pop()}l.push(f)}break}}if(pt(n,l)>=50)break}}}var _=[...l].sort((t,i)=>i.start-t.start),b=_[_.length-1];if(b){var m=ct(n,b);for(var y of(n.splice(b.start-m,m),_))y.start-=m}for(var w of _)dt(n,w);return l.some(t=>0===t.start&&n.length===t.length)&&function(t){for(var i=t.map(t=>t.function+"|"+t.filename+"|"+t.lineno+"|"+t.colno+"|"+t.module),e=0,r=1;i.length>r;r++)gt(i,r,e)&&(e=r);t.push(...t.splice(0,e))}(n),function(t){if(!t.length)return[];var i=Array.from(t);return i.reverse(),i.slice(0,50).map(t=>{return e({},t,{filename:t.filename||(r=i,r[r.length-1]||{}).filename,function:t.function||Y});var r})}(n)}}("web:javascript",nt,lt)),this._instance=t,this.Bs=null!==(i=null==(r=this._instance.persistence)?void 0:r.get_property(ue))&&void 0!==i?i:[],this.Us=Ot(this.Vs()),this.qs=new Mt(this.Us)}onConfigChange(){this.Us=Ot(this.Vs()),this.qs.setConfig(this.Us)}onRemoteConfig(t){var i,e,r;if(t.ok){var s=t.config;if("errorTracking"in s){var n=null!==(i=null==(e=s.errorTracking)?void 0:e.suppressionRules)&&void 0!==i?i:[],a=null==(r=s.errorTracking)?void 0:r.captureExtensionExceptions;this.Bs=n,this._instance.persistence&&this._instance.persistence.register({[ue]:this.Bs,[he]:a})}}}get Ws(){var t,i=!!this._instance.get_property(he),e=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=e?e:i)&&void 0!==t&&t}buildProperties(t,i){return this.Hs.buildFromUnknown(t,{syntheticException:null==i?void 0:i.syntheticException,mechanism:{handled:null==i?void 0:i.handled}})}addExceptionStep(t,i){if(this.Us.enabled)try{if(!f(t)||0===t.trim().length)return void ms.warn("Ignoring exception step because message must be a non-empty string");var r=function(t){if(!t)return{sanitizedProperties:{},droppedKeys:[]};var i=[];return{sanitizedProperties:Object.keys(t).reduce((e,r)=>Rt.has(r)?(i.push(r),e):(e[r]=t[r],e),{}),droppedKeys:i}}(this.Ks(i)),s=r.sanitizedProperties,n=r.droppedKeys;n.length>0&&ms.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.qs.add(e({[Ct]:t,[Tt]:(new Date).toISOString()},s))}catch(t){ms.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{var i=t.$exception_list;if(this.Js(i)){if(this.Gs(i))return this.Xs("Exception dropped: matched a suppression rule"),void ms.info("Skipping exception capture because a suppression rule matched");if(!this.Ws&&this.Zs(i))return this.Xs("Exception dropped: thrown by a browser extension"),void ms.info("Skipping exception capture because it was thrown by an extension");if(!this.Ws&&this.Qs(i))return this.Xs("Exception dropped: thrown by an injected browser script"),void ms.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Ys(i))return this.Xs("Exception dropped: thrown by the PostHog SDK"),void ms.info("Skipping exception capture because it was thrown by the PostHog SDK")}var e=this.Us.enabled&&_(t.$exception_steps)?this.tn(t):t,r="string"==typeof(n=globalThis._posthogReleaseId)&&n.length>0?n:void 0;r&&(e.$release_id=r);try{var s=this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent",_originatedFromCaptureException:!0});return s&&this.qs.clear(),s}catch(t){return bs(t)||ms.error("Failed to capture exception event. Dropping this exception.",t),void this.qs.clear()}}catch(t){return void(bs(t)||ms.error("Failed to process exception event. Ignoring this exception.",t))}var n}tn(t){try{var i=this.qs.getAttachable();return 0===i.length?t:e({},t,{$exception_steps:i})}catch(i){return ms.error("Failed to read buffered exception steps. Capturing exception without steps.",i),t}}Xs(t){this.Us.enabled&&this.qs.add({[Ct]:t,[Tt]:(new Date).toISOString()})}Ks(t){return v(t)?e({},t):{}}Vs(){var t,i;return null!==(t=null==(i=this._instance.config.error_tracking)?void 0:i.exception_steps)&&void 0!==t?t:{}}Gs(t){if(0===t.length)return!1;try{var i=t.reduce((t,i)=>{var e=i.type,r=i.value;return f(e)&&e.length>0&&t.$exception_types.push(e),f(r)&&r.length>0&&t.$exception_values.push(r),t},{$exception_types:[],$exception_values:[]});return this.Bs.some(t=>{var e=t.values.map(t=>{var e=Wr[t.operator],r=i[t.key];if(!e||!r)return!1;var s=u(t.value)?t.value:[t.value];return s.length>0&&e(s,r)});return"OR"===t.type?e.some(Boolean):e.every(Boolean)})}catch(t){return ms.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}Zs(t){var i=t.flatMap(t=>{var i,e;return null!==(i=null==(e=t.stacktrace)?void 0:e.frames)&&void 0!==i?i:[]}),e=i.filter(t=>{var i=t.filename;return!!i&&Ss.some(t=>i.startsWith(t))});return 0!==e.length&&(!e.every(t=>{var i=t.filename;return!!i&&i.startsWith(ys)})||t.some(t=>{var i=t.value;return"NoResponse"===t.type||f(i)&&ws.some(t=>{var e=t.value;return t.exact?i===e:i.includes(e)})})&&!i.some(t=>{var i=t.filename;return t.in_app&&!(null!=i&&i.startsWith(ys))}))}Qs(t){return t.some(t=>{var i=t.value;return f(i)&&ks.some(t=>i.includes(t))})}Ys(t){if(t.length>0){var i,e,r,s,n=null!==(i=null==(e=t[0].stacktrace)?void 0:e.frames)&&void 0!==i?i:[],a=n[n.length-1];return null!==(r=null==a||null==(s=a.filename)?void 0:s.includes("posthog.com/static"))&&void 0!==r&&r}return!1}Js(t){return!_(t)&&u(t)}}},zs=e({productTours:class{get Ir(){return this._instance.persistence}constructor(t){this.en=null,this.rn=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(t.ok){var i=t.config;if("productTours"in i){var e,r;if(this.Ir&&this.Ir.register({[ce]:!!i.productTours}),!$r(this._instance))return!this.en&&_(null==(e=this.Ir)?void 0:e.props[$e])||Ir.info("product tours disabled; stopping and clearing cached tours"),null==(r=this.en)||r.stop(),this.en=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.en&&$r(this._instance)&&this.Gt(()=>this.sn())}Gt(t){var i,e;null!=(i=nr.__PosthogExtensions__)&&i.generateProductTours?t():null==(e=nr.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"product-tours",i=>{i?Ir.error("Could not load product tours script",i):t()})}sn(){var t;!this.en&&null!=(t=nr.__PosthogExtensions__)&&t.generateProductTours&&(this.en=nr.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,i){if(void 0===i&&(i=!1),!u(this.rn)||i){var e=this.Ir;if(e){var r=e.props[$e];if(u(r)&&!i)return this.rn=r,void t(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",timestampMode:"query",callback:i=>{if($r(this._instance)){var r=i.statusCode;if(200!==r||!i.json){var s="Product Tours API could not be loaded, status: "+r;return 0===r?i.error||Ir.warn(s):Ir.error(s),void t([],{isLoaded:!1,error:s})}var n=u(i.json.product_tours)?i.json.product_tours:[];this.rn=n,e&&e.register({[$e]:n}),t(n,{isLoaded:!0})}else t([],{isLoaded:!0})}})}else t(this.rn,{isLoaded:!0})}getActiveProductTours(t){_(this.en)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.en.getActiveProductTours(t)}showProductTour(t){var i;null==(i=this.en)||i.showTourById(t)}previewTour(t){this.en?this.en.previewTour(t):this.Gt(()=>{var i;this.sn(),null==(i=this.en)||i.previewTour(t)})}dismissProductTour(){var t;null==(t=this.en)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.en)||t.nextStep()}previousStep(){var t;null==(t=this.en)||t.previousStep()}clearCache(){var t;this.rn=null,null==(t=this.Ir)||t.unregister($e)}resetTour(t){var i;null==(i=this.en)||i.resetTour(t)}resetAllTours(){var t;null==(t=this.en)||t.resetAllTours()}cancelPendingTour(t){var i;null==(i=this.en)||i.cancelPendingTour(t)}}},js),Bs={siteApps:class{constructor(t){this.nn=0,this._instance=t,this.an=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}ln(t,i){if(i){var e=this.globalsForEvent(i);this.an.push(e),this.an.length>1e3&&(this.an=this.an.slice(10))}}get siteAppLoaders(){var t;return null==(t=nr._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.ln.bind(this));this.un=()=>{t(),this.an=[],this.un=void 0}}}globalsForEvent(t){var i,r,s,n,a,o,l;if(!t)throw new Error("Event payload is required");var u={},h=this._instance.get_property("$groups")||[],v=this._instance.get_property("$stored_group_properties")||{};for(var d of Object.entries(v)){var c=d[0];u[c]={id:h[c],type:c,properties:d[1]}}var f=t.$set_once,p=t.$set;return{event:e({},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}(t,jr),{properties:e({},t.properties,p?{$set:e({},null!==(i=null==(r=t.properties)?void 0:r.$set)&&void 0!==i?i:{},p)}:{},f?{$set_once:e({},null!==(s=null==(n=t.properties)?void 0:n.$set_once)&&void 0!==s?s:{},f)}:{}),elements_chain:null!==(a=null==(o=t.properties)?void 0:o.$elements_chain)&&void 0!==a?a:"",distinct_id:null==(l=t.properties)?void 0:l.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:u}}hn(t){var i,e=null==(i=t.tagName)?void 0:i.toLowerCase();return"style"===e&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(t)||(Lr.error("prepare_external_dependency_stylesheet returned null"),null):"script"===e&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(t)||(Lr.error("prepare_external_dependency_script returned null"),null):t}vn(){var t,i,e,r,s,n,a,o;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var l=null==oi?void 0:oi.defaultView,u=null==l||null==(t=l.Node)?void 0:t.prototype;if(!l||!u)return()=>{};if(this.nn++,this.dn)return this.cn();var h=[],v=this,d=new WeakSet,c=(t,i,e)=>{if(null!=t&&t[i]){var r=t[i];t[i]=e(r),h.push(()=>{t[i]=r})}},f=t=>{if(d.has(t))return t;var i=v.hn(t);return i&&d.add(i),i},p=t=>t.map(t=>"string"==typeof t?t:f(t)).filter(t=>!g(t));return c(u,"appendChild",t=>function(i){var e=f(i);return e?t.call(this,e):i}),c(u,"insertBefore",t=>function(i,e){var r=f(i);return r?t.call(this,r,e):i}),c(u,"replaceChild",t=>function(i,e){var r=f(i);return r?t.call(this,r,e):e}),[null==(i=l.Element)?void 0:i.prototype,null==(e=l.Document)?void 0:e.prototype,null==(r=l.DocumentFragment)?void 0:r.prototype].forEach(t=>{c(t,"append",t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,p(e))}),c(t,"prepend",t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,p(e))})}),[null==(s=l.Element)?void 0:s.prototype,null==(n=l.CharacterData)?void 0:n.prototype,null==(a=l.DocumentType)?void 0:a.prototype].forEach(t=>{c(t,"before",t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,p(e))}),c(t,"after",t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,p(e))}),c(t,"replaceWith",t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];var s=p(e);return e.length&&!s.length?void 0:t.apply(this,s)})}),c(null==(o=l.Element)?void 0:o.prototype,"insertAdjacentElement",t=>function(i,e){var r=f(e);return r?t.call(this,i,r):null}),this.dn=()=>{h.forEach(t=>t()),this.dn=void 0},this.cn()}cn(){var t=!1;return()=>{var i;t||(t=!0,this.nn--,0===this.nn&&(null==(i=this.dn)||i.call(this)))}}fn(t,i){void 0===i&&(i=!0);var e=this.vn();try{var r=t(e);return i&&e(),r}catch(t){throw e(),t}}setupSiteApp(t){var i=this.apps[t.id],e=()=>{var e;!i.errored&&this.an.length&&(Lr.info("Processing "+this.an.length+" events for site app with id "+t.id),this.an.forEach(t=>this.fn(()=>null==i.processEvent?void 0:i.processEvent(t))),i.processedBuffer=!0),Object.values(this.apps).every(t=>t.processedBuffer||t.errored)&&(null==(e=this.un)||e.call(this))},r=!1,s=s=>{i.errored=!s,i.loaded=!0,Lr.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&e()};try{var n=this.fn(i=>t.init({posthog:this._instance,callback(t){i(),s(t)}}),!1).processEvent;n&&(i.processEvent=n),r=!0}catch(i){Lr.error(Dr+t.id,i),s(!1)}if(r&&i.loaded)try{e()}catch(e){Lr.error("Error while processing buffered events PostHog app with config id "+t.id,e),i.errored=!0}}pn(){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)}gn(t){var i=this;if(0!==Object.keys(this.apps).length){var e=this.globalsForEvent(t),r=function(r){try{i.fn(()=>null==r.processEvent?void 0:r.processEvent(e))}catch(i){Lr.error("Error while processing event "+t.event+" for site app "+r.id,i)}};for(var s of Object.values(this.apps))r(s)}}onRemoteConfig(t){var i,e,r,s=this;if(null!=(i=this.siteAppLoaders)&&i.length)return this.isEnabled?(this.pn(),void this._instance.on("eventCaptured",t=>this.gn(t))):void Lr.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(e=this.un)||e.call(this),t.ok){var n=t.config;if(null!=(r=n.siteApps)&&r.length)if(this.isEnabled){var a=function(){var t,i=o.id,e=o.url;nr["__$$ph_site_app_"+i]=s._instance,null==(t=nr.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(s._instance,e,t=>{if(t)return Lr.error(Dr+i,t)})};for(var o of n.siteApps)a()}else Lr.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},Hs={tracingHeaders:class{constructor(t){this._n=void 0,this.bn=void 0,this.mn=void 0,this.As=()=>{var t,i,e=this.yn();e?(c(this._n)&&(this._n=null==(t=nr.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchXHR(e,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),c(this.bn)&&(this.bn=null==(i=nr.__PosthogExtensions__)||null==(i=i.tracingHeadersPatchFns)?void 0:i._patchFetch(e,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.Ls()},this._instance=t}initialize(){this.startIfEnabledOrStop()}Gt(t){var i,e;null!=(i=nr.__PosthogExtensions__)&&i.tracingHeadersPatchFns?t():null==(e=nr.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"tracing-headers",i=>{if(i)return cr.error("failed to load script",i);t()})}wn(){var t,i;return null!==(t=null!==(i=this._instance.config.tracing_headers)&&void 0!==i?i:this._instance.config.addTracingHeaders)&&void 0!==t?t:this._instance.config.__add_tracing_headers}yn(){var t=this.wn();return u(t)?(u(this.mn)?this.mn.splice(0,this.mn.length,...t):this.mn=[...t],t.length>0?this.mn:void 0):(u(this.mn)&&this.mn.splice(0),this.mn=t||void 0,this.mn)}Ls(){var t,i;null==(t=this._n)||t.call(this),null==(i=this.bn)||i.call(this),this._n=void 0,this.bn=void 0}startIfEnabledOrStop(){this.yn()?this.Gt(this.As):this.Ls()}}},Us=e({surveys:class extends Yr{constructor(t){var i;super(new as(t),(i=t,{get projectToken(){return i.config.token},kv:new ns(i)})),this._instance=t}ci(t,i){var r=i.query?function(t,i,r){var s;void 0===r&&(r=!0);var n=t.split("?"),a=n[0],o=n[1],l=e({},i),u=null!==(s=null==o?void 0:o.split("&").map(t=>{var i,e=t.split("="),s=e[0],n=r&&null!==(i=l[s])&&void 0!==i?i:e[1];return delete l[s],s+"="+n}))&&void 0!==s?s:[],h=function(t,i){var e,r;void 0===i&&(i="&");var s=[];return ci(t,function(t,i){c(t)||c(i)||"undefined"===i||(e=encodeURIComponent(t instanceof File?t.name:t.toString()),r=encodeURIComponent(i),s[s.length]=r+"="+e)}),s.join(i)}(l);return h&&u.push(h),u.length>0?a+"?"+u.join("&"):a}(t,i.query):t;return new Promise(t=>{var e;this._instance._send_request({method:i.method,url:this._instance.requestRouter.endpointFor(null!==(e=i.target)&&void 0!==e?e:"api",r),data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,timestampMode:i.sentAt,callback:t})})}}},js),Vs={toolbar:class{constructor(t){this.instance=t}Sn(t){nr.ph_toolbar_state=t}kn(){var t;return null!==(t=nr.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t,i,e){if(void 0===t&&(t=void 0),void 0===i&&(i=void 0),void 0===e&&(e=void 0),bi(this.instance.config))return!1;if(!si||!oi)return!1;t=null!=t?t:si.location,e=null!=e?e:si.history;try{if(!i){try{si.localStorage.setItem("test","test"),si.localStorage.removeItem("test")}catch(t){return!1}i=null==si?void 0:si.localStorage}var r,s=os||Je(t.hash,"__posthog")||Je(t.hash,"state"),n=s?gi(()=>JSON.parse(atob(decodeURIComponent(s))))||gi(()=>JSON.parse(decodeURIComponent(s))):null;return n&&"ph_authorize"===n.action?((r=n).source="url",r&&Object.keys(r).length>0&&(n.desiredHash?t.hash=n.desiredHash:e?e.replaceState(e.state,"",t.pathname+t.search):t.hash="")):((r=JSON.parse(i.getItem(ls)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}xn(t){var i=nr.ph_load_toolbar||nr.ph_load_editor;!_(i)&&h(i)?i(t,this.instance):us.warn("No toolbar load function found")}loadToolbar(t){var i=!(null==oi||!oi.getElementById(yi));if(!si||i)return!1;var r="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=e({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(si.localStorage.setItem(ls,JSON.stringify(e({},s,{source:void 0}))),2===this.kn())this.xn(s);else if(0===this.kn()){var n;this.Sn(1),null==(n=nr.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",t=>{if(t)return us.error("[Toolbar] Failed to load",t),void this.Sn(0);this.Sn(2),this.xn(s)}),_i(si,"turbolinks:load",()=>{this.Sn(0),this.loadToolbar(s)})}return!0}En(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)}}},qs=e({experiments:Fs},js),Ws={conversations:class{constructor(t){this.Fn=void 0,this._conversationsManager=null,this.Pn=!1,this.Cn=null,this.Tn=!1,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations&&(this.Rn=t.ok,t.ok)){var i=t.config.conversations;_(i)||(m(i)?this.Fn=i:(this.Fn=i.enabled,this.Cn=i),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.Fn=void 0,this.Cn=null,this.Rn=void 0,this.Tn=!1}loadIfEnabled(){if(!(this._conversationsManager||this.Pn||this._instance.config.disable_conversations||bi(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==nr?void 0:nr.__PosthogExtensions__;if(t&&!c(this.Fn)&&this.Fn)if(this.Cn&&this.Cn.token){this.Pn=!0;try{var i=t.initConversations;if(i)return this.An(i),void(this.Pn=!1);var e=t.loadExternalDependency;if(!e)return void this.On(Ue);e(this._instance,"conversations",i=>{i||!t.initConversations?this.On("Could not load conversations script",i):this.An(t.initConversations),this.Pn=!1})}catch(t){this.On("Error initializing conversations",t),this.Pn=!1}}else Ps.error("Conversations enabled but missing token in remote config.")}}An(t){if(this.Cn)try{this._conversationsManager=t(this.Cn,this._instance),this.Tn=!1,Ps.info("Conversations loaded successfully")}catch(t){this.On("Error completing conversations initialization",t)}else Ps.error("Cannot complete initialization: remote config is null")}On(t,i){Ps.error(t,i),this._conversationsManager=null,this.Pn=!1,this.Tn=!0}show(){this._conversationsManager?this._conversationsManager.show():Ps.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Fn&&!g(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":bi(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.Rn?"remote_config_failed":c(this.Fn)?this.Rn?"disabled_in_project":"remote_config_pending":this.Fn?_(this.Cn)||!this.Cn.token?"missing_token":null!=nr&&nr.__PosthogExtensions__?this.Pn?"initializing":this.Tn?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.isVisible())&&void 0!==t&&t}sendMessage(t,e,r){var s=this;return i(function*(){return s._conversationsManager?s._conversationsManager.sendMessage(t,e,r):(Ps.warn(Cs),null)})()}getMessages(t,e){var r=this;return i(function*(){return r._conversationsManager?r._conversationsManager.getMessages(t,e):(Ps.warn(Cs),null)})()}markAsRead(t){var e=this;return i(function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(Ps.warn(Cs),null)})()}getTickets(t){var e=this;return i(function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(Ps.warn(Cs),null)})()}requestRestoreLink(t){var e=this;return i(function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(Ps.warn(Cs),null)})()}restoreFromToken(t){var e=this;return i(function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(Ps.warn(Cs),null)})()}restoreFromUrlToken(){var t=this;return i(function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(Ps.warn(Cs),null)})()}getCurrentTicketId(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.getCurrentTicketId())&&void 0!==t?t:null}getWidgetSessionId(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.getWidgetSessionId())&&void 0!==t?t:null}_onIdentityChanged(){var t;null==(t=this._conversationsManager)||t.setIdentity()}_onIdentityCleared(){var t;null==(t=this._conversationsManager)||t.clearIdentity()}}},Ks={logs:class{constructor(t){var i,r=this;this.name="logs",this.Mn=!1,this.In=!1,this.$n=!1,this.l=di("[logs]"),this.jn=e({},this.l,{error(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];i.some($s)||r.l.error(...i)}}),this.Ln=[],this.Dn=[],this.Ve=0,this.Dt=!1,this.Nn=[],this.zn=[],this.Bn=!1,this.Hn=!1,this.Un=()=>{var t,i;this.Dt||(this.Ve=0,null==(t=this.Vn)||t.onReconnect(),null==(i=this.qn)||i.onReconnect())},this._instance=t,this._instance&&null!=(i=this._instance.config.logs)&&i.captureConsoleLogs&&(this.Mn=!0),si&&_i(si,"online",this.Un)}Wn(t,i,e,r){var s,n=Rs(null==(s=this._instance)||null==(s=s.config)?void 0:s.logs,e);return[new Qt(this.Kn(t,i),n,this.jn,()=>this.Jn(),t=>t(),void 0,r),n]}Gn(){var t,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.Vn||this.Xn!==i){var e;null==(e=this.Vn)||e.reset(),this.Xn=i;var r=this.Wn(()=>this.Ln,t=>{this.Ln=t});this.Vn=r[0],this.Zn=r[1]}return this.Vn}Qn(){var t,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.qn||this.Yn!==i){var e;null==(e=this.qn)||e.reset(),this.Yn=i;var r=this.Wn(()=>this.Dn,t=>{this.Dn=t},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Os);this.qn=r[0],this.ta=r[1]}return this.qn}setup(t){var i;if(!this.Dt){this.Ot=t,null!=(i=this._instance)&&null!=(i=i.config)&&null!=(i=i.logs)&&i.captureConsoleLogs&&(this.Mn=!0),(this.Mn||this.ia()&&this.ea())&&this.ra();var e=!1,r=t.onRemoteConfig(t=>{var i;e=t.ok&&!0===(null==(i=t.config.logs)?void 0:i.captureConsoleLogs),this.onRemoteConfig(t)});this.Dt?r.dispose():(this.Ht=r,e||this.loadIfEnabled())}}dispose(){var t,i,e,r;this.Dt||(this.Dt=!0,this.sa(),null==(t=this.Ht)||t.dispose(),this.Ht=void 0,this.Ot=void 0,this.$n=!1,null==si||si.removeEventListener("online",this.Un),null==(i=this.na)||i.call(this),this.na=void 0,null==(e=this.Vn)||e.reset(),null==(r=this.qn)||r.reset())}onRemoteConfig(t){var i,e;if(!this.Dt){var r=t.ok?null==(i=t.config.logs)?void 0:i.captureConsoleLogs:void 0;_(r)?this.aa():(null==(e=this._instance)||null==(e=e.persistence)||e.register({[fe]:!!r}),r?(this.Mn=!0,this.In||this.ra(),this.loadIfEnabled()):this.aa())}}reset(){var t,i,e,r;this.sa(),null==(t=this.Vn)||t.clearQueue(),this.Ln=[],null==(i=this.Vn)||i.reset(),null==(e=this.qn)||e.clearQueue(),this.Dn=[],null==(r=this.qn)||r.reset(),this.Ve=0}captureLog(t){this.Dt||this.Gn().captureLog(t)}captureConsoleLog(t){this.Dt||this.Qn().captureLog(t)}captureBufferedConsoleLog(t,i,e){this.Dt||this.Qn().captureLog(t,{context:i,occurredAtMs:e})}ea(){var t;return!(null==(t=this._instance)||null==(t=t.persistence)||null==(t=t.props)||!t[fe])}ia(){var t,i;return null==(t=this._instance)||null==t._shouldDisableFlags||!t._shouldDisableFlags()||!(null==(i=nr._POSTHOG_REMOTE_CONFIG)||null==(i=i[this._instance.config.token])||!i.config)}_onOptOut(){var t;this.sa(),null==(t=this.qn)||t.clearQueue(),this.Dn=[]}aa(){this.Mn||this.sa()}ra(){var t,i=this;if(!this.Bn&&null!=nr&&nr.console){var e=Rs(null==(t=this._instance)||null==(t=t.config)?void 0:t.logs).maxBufferSize,r=function(t){var r;try{r=(t=>{for(;null!=(i=t)&&i.__rrweb_original__;){var i;t=t.__rrweb_original__}return t})(nr.console[t])}catch(t){return 0}if(!r)return 0;i.zn.push(dr(nr.console,t,s=>{var n=function(){for(var r=arguments.length,n=new Array(r),a=0;r>a;a++)n[a]=arguments[a];try{i.oa(t,n,e)}catch(t){}return s.apply(nr.console,n)};return n.__rrweb_original__=r,n}))};for(var s of As)r(s);this.Bn=!0,this.la=setTimeout(()=>{this.sa()},3e4)}}oa(t,i,e){var r;if(this.Bn&&!this.Hn&&0!==i.length)if(null!=(r=this._instance)&&r.is_capturing()){if(e>this.Nn.length){this.Hn=!0;try{this.Nn.push({level:t,args:i,occurredAtMs:Date.now(),context:this.Jn()})}finally{this.Hn=!1}}}else this.sa()}sa(){if(this.Nn=[],this.Bn){for(var t of(this.Bn=!1,this.la&&(clearTimeout(this.la),this.la=void 0),this.zn))t();this.zn=[]}}ua(){var t=this.Nn;return this.sa(),t}get logger(){return this.ha||(this.ha={trace:(t,i)=>this.captureLog({body:t,level:"trace",attributes:i}),debug:(t,i)=>this.captureLog({body:t,level:"debug",attributes:i}),info:(t,i)=>this.captureLog({body:t,level:"info",attributes:i}),warn:(t,i)=>this.captureLog({body:t,level:"warn",attributes:i}),error:(t,i)=>this.captureLog({body:t,level:"error",attributes:i}),fatal:(t,i)=>this.captureLog({body:t,level:"fatal",attributes:i})}),this.ha}flushLogs(t){t?this.va(t):(this.Vn&&this.Vn.flush().catch(t=>this.da(t)),this.qn&&this.qn.flush().catch(t=>this.da(t)))}da(t){$s(t)||this.l.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(!this.Dt&&this.Mn&&!this.In&&!this.$n){var t=null==nr?void 0:nr.__PosthogExtensions__;if(!t)return this.l.error("PostHog Extensions not found."),void this.sa();var i=t.loadExternalDependency;if(!i)return this.l.error(Ue),void this.sa();this.$n=!0;try{i(this._instance,"logs",i=>{if(this.$n=!1,!this.Dt&&this.Mn){var e=t.logs;if(i||null==e||!e.initializeLogs)this.l.error("Could not load logs script",i),this.sa();else{var r,s,n=this.ua();this.na=e.initializeLogs(null!==(r=this.Ot)&&void 0!==r?r:this._instance),this.In=!0,n.length>0&&(null==e.replayConsoleBuffer||e.replayConsoleBuffer(null!==(s=this.Ot)&&void 0!==s?s:this._instance,n))}}})}catch(t){throw this.$n=!1,t}}}Kn(t,i){var e=this._instance;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},getPersistedProperty:i=>i===r.LogsQueue?t():void 0,setPersistedProperty(t,e){var s;t===r.LogsQueue&&i(null!==(s=e)&&void 0!==s?s:[])},it:t=>this.it(t),getLibraryId:()=>ri.LIB_NAME,getLibraryVersion:()=>ri.LIB_VERSION}}it(t){return new Promise(i=>{if(Ge(this.Ve,3))i({kind:"fatal",error:Is(void 0,"logs endpoint is unreachable, dropping batch")});else{var e=!1,r=t=>{e||(e=!0,clearTimeout(s),i(t))},s=setTimeout(()=>{this.l.warn("Logs request timed out before receiving a response"),r({kind:"retry-later",error:Is(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this.ca(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:t=>{var i=t.statusCode;if(this.fa(i),i>=200&&300>i)r({kind:"ok"});else if(413===i)r({kind:"too-large"});else if(0!==i&&408!==i&&429!==i&&500>i)r({kind:"fatal",error:new Error("logs request failed with status "+i)});else{var e;0===i?(t.error||this.l.warn("Logs request failed before receiving an HTTP response"),r({kind:"retry-later",error:Is(t.error,"logs request failed before receiving an HTTP response")})):r({kind:"retry-later",error:null!==(e=t.error)&&void 0!==e?e:new Error("logs request failed with status "+i)})}}})}})}fa(t){(0!==t||this._instance.__loaded)&&(this.Ve=Xe(t,this.Ve,3,()=>this.l.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes.")))}va(t){this.Ln.length>0&&this.pa(t,this.Ln,this.Zn,ri.LIB_NAME,t=>{this.Ln=t}),this.Dn.length>0&&this.pa(t,this.Dn,this.ta,Os,t=>{this.Dn=t})}pa(t,i,e,r,s){if(0!==i.length){var n=i.map(t=>t.record);s([]);var a=Zt(n,Xt(e,ri.LIB_NAME,ri.LIB_VERSION),r,ri.LIB_VERSION);this._instance._send_request({method:"POST",url:this.ca(),data:a,compression:"best-available",batchKey:"logs",transport:t})}}ca(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}Jn(){var t,i={};if(i.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var e=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),r=e.windowId,s=e.sessionStartTimestamp,n=e.lastActivityTimestamp;i.sessionId=e.sessionId,i.windowId=r,_(s)||(i.sessionStartTimestamp=s),_(n)||(i.lastActivityTimestamp=n)}if(null!=nr&&null!=(t=nr.location)&&t.href&&(i.currentUrl=this._instance.config.disable_capture_url_hashes?K(nr.location.href):nr.location.href),this._instance.featureFlags){var a=this._instance.featureFlags.getFlags();a&&a.length>0&&(i.activeFeatureFlags=a)}return i}}},Js={metrics:class{constructor(t){this.l=di("[metrics]"),this._instance=t}initialize(){}Gn(){var t,i,e=null==(t=this._instance)||null==(t=t.config)?void 0:t.metrics;return this.Vn&&this.Xn===e||(null==(i=this.Vn)||i.reset(),this.Xn=e,this.Vn=new ei(this.Kn(),function(t){var i,e,r,s,n,a=null==t?void 0:t.resourceAttributes;return{serviceName:null!==(i=null==a?void 0:a["service.name"])&&void 0!==i?i:null==t?void 0:t.serviceName,serviceVersion:null!==(e=null==a?void 0:a["service.version"])&&void 0!==e?e:null==t?void 0:t.serviceVersion,environment:null!==(r=null==a?void 0:a["deployment.environment"])&&void 0!==r?r:null==t?void 0:t.environment,resourceAttributes:a,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:null!==(s=null==t?void 0:t.flushIntervalMs)&&void 0!==s?s:1e4,maxSeriesPerFlush:null!==(n=null==t?void 0:t.maxSeriesPerFlush)&&void 0!==n?n:1e3}}(e),this.l)),this.Vn}count(t,i,e){void 0===i&&(i=1),this.Gn().count(t,i,e)}gauge(t,i,e){this.Gn().gauge(t,i,e)}histogram(t,i,e){this.Gn().histogram(t,i,e)}flush(t){if(!this.Vn)return Promise.resolve();if(t){var i=this.Vn.drainWindow();return i&&this.St(i,t),Promise.resolve()}return this.Vn.flush().catch(t=>this.l.error("PostHog metrics flush failed:",t))}reset(){var t;null==(t=this.Vn)||t.reset()}Kn(){var t=this._instance,i=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},St:t=>i.St(t),getLibraryId:()=>ri.LIB_NAME,getLibraryVersion:()=>ri.LIB_VERSION}}St(t,i){return new Promise(r=>{var s=!1,n=t=>{s||(s=!0,clearTimeout(a),r(t))},a=setTimeout(()=>n({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(e({method:"POST",url:this.ga(),data:t,compression:"best-available",batchKey:"metrics"},i&&{transport:i},{fireCallbackOnDrop:!0,callback(t){var i=t.statusCode;if(i>=200&&300>i)n({kind:"ok"});else if(413===i)n({kind:"too-large"});else if(0!==i&&408!==i&&429!==i&&500>i)n({kind:"fatal",error:new Error("metrics request failed with status "+i)});else{var e;n({kind:"retry-later",error:null!==(e=t.error)&&void 0!==e?e:new Error("metrics request failed with status "+i)})}}}))})}ga(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},Gs=e({},js,Ls,Ds,Ns,zs,Bs,Us,Hs,Vs,qs,Ws,Ks,Js),Xs=js,Zs=Ls,Qs=Ds,Ys=Ns,tn=zs,en=Bs,rn=Us,sn=Hs,nn=Vs,an=qs,on=Ws,ln=Ks,un=Js;export{Gs as AllExtensions,Qs as AnalyticsExtensions,on as ConversationsExtensions,Ys as ErrorTrackingExtensions,an as ExperimentsExtensions,Xs as FeatureFlagsExtensions,ln as LogsExtensions,un as MetricsExtensions,tn as ProductToursExtensions,Zs as SessionReplayExtensions,en as SiteAppsExtensions,rn as SurveysExtensions,nn as ToolbarExtensions,sn as TracingExtensions};
|
|
1
|
+
function t(t,i,e,r,s,n,a){try{var o=t[n](a),l=o.value}catch(t){return void e(t)}o.done?i(l):Promise.resolve(l).then(r,s)}function i(i){return function(){var e=this,r=arguments;return new Promise(function(s,n){var a=i.apply(e,r);function o(i){t(a,s,n,o,l,"next",i)}function l(i){t(a,s,n,o,l,"throw",i)}o(void 0)})}}function e(){return e=Object.assign?Object.assign.bind():function(t){for(var i=1;arguments.length>i;i++){var e=arguments[i];for(var r in e)({}).hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},e.apply(null,arguments)}var r=function(t){return t.AnonymousId="anonymous_id",t.DistinctId="distinct_id",t.Props="props",t.EnablePersonProcessing="enable_person_processing",t.PersonMode="person_mode",t.FeatureFlagDetails="feature_flag_details",t.FeatureFlags="feature_flags",t.FeatureFlagPayloads="feature_flag_payloads",t.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",t.BootstrapFeatureFlags="bootstrap_feature_flags",t.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",t.OverrideFeatureFlags="override_feature_flags",t.Queue="queue",t.AiQueue="ai_queue",t.AiCaptureQueue="ai_capture_queue",t.LogsQueue="logs_queue",t.OptedOut="opted_out",t.SessionId="session_id",t.SessionStartTimestamp="session_start_timestamp",t.SessionLastTimestamp="session_timestamp",t.PersonProperties="person_properties",t.GroupProperties="group_properties",t.InstalledAppBuild="installed_app_build",t.InstalledAppVersion="installed_app_version",t.SessionReplay="session_replay",t.PushRegistered="push_registered",t.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",t.SurveyLastSeenDate="survey_last_seen_date",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t}({});function s(t,i){return-1!==t.indexOf(i)}var n=function(t){return t.trim()},a=Object.prototype,o=a.hasOwnProperty,l=a.toString,u=Array.isArray||function(t){return"[object Array]"===l.call(t)},h=t=>"function"==typeof t,v=t=>t===Object(t)&&!u(t),d=t=>{if(v(t)){for(var i in t)if(o.call(t,i))return!1;return!0}return!1},c=t=>void 0===t,f=t=>"[object String]"==l.call(t),p=t=>f(t)&&0===t.trim().length,g=t=>null===t,_=t=>c(t)||g(t),b=t=>"[object Number]"==l.call(t)&&t==t,m=t=>"[object Boolean]"===l.call(t);function y(t){return null===t||"object"!=typeof t}function w(t,i){return{}.toString.call(t)==="[object "+i+"]"}function S(t){switch({}.toString.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return x(t,Error)}}function k(t){return"u">typeof Event&&x(t,Event)}function x(t,i){try{return t instanceof i}catch(t){return!1}}var E=["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","pinterestbot","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"],F=function(t,i){if(void 0===i&&(i=[]),!t)return!1;var e=t.toLowerCase();return E.concat(i).some(t=>{var i=t.toLowerCase();return-1!==e.indexOf(i)})};function P(t,i,e,r,s){return i>e&&(r.warn("min cannot be greater than max."),i=e),b(t)?t>e?(r.warn(" cannot be greater than max: "+e+". Using max value instead."),e):i>t?(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),P(e,i,e,r))}class C{constructor(t){this.t={},this.i=t.i,this.o=P(t.bucketSize,0,100,t.l),this.u=P(t.refillRate,0,this.o,t.l),this.h=P(t.refillInterval,0,864e5,t.l)}p(t,i){var e=Math.floor((i-t.lastAccess)/this.h);e>0&&(t.tokens=Math.min(t.tokens+e*this.u,this.o),t.lastAccess=t.lastAccess+e*this.h)}consumeRateLimit(t){var i,e=Date.now(),r=String(t),s=this.t[r];return s?this.p(s,e):this.t[r]=s={tokens:this.o,lastAccess:e},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(i=this.i)||i.call(this,t)),0===s.tokens)}stop(){this.t={}}}var T,R,A,O="Mobile",M="Android",I="BlackBerry",j="Nintendo",L="PlayStation",D="Xbox",N="Windows",z=N+" Phone",B=new RegExp(I+"|PlayBook|BB10","i"),H={"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"},U=[[new RegExp(D+"; "+D+" (.*?)[);]","i"),t=>[D,t&&t[1]||""]],[new RegExp(j,"i"),[j,""]],[new RegExp(L,"i"),[L,""]],[B,[I,""]],[new RegExp(N,"i"),(t,i)=>{if(/Phone/.test(i)||/WPDesktop/.test(i))return[z,""];if(new RegExp(O).test(i)&&!/IEMobile\b/.test(i))return[N+" "+O,""];var e=/Windows NT ([0-9.]+)/i.exec(i);if(e&&e[1]){var r=H[e[1]]||"";return/arm/i.test(i)&&(r="RT"),[N,r]}return[N,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?["iOS",[t[3],t[4],t[5]||"0"].join(".")]:["iOS",""]],[/(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("("+M+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+M+")","i"),t=>t&&t[2]?[M,[t[2],t[3],t[4]||"0"].join(".")]:[M,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var i=["Mac OS X",""];return t&&t[1]&&(i[1]=[t[1],t[2],t[3]||"0"].join(".")),i}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],V="[Truncated]",q="[Unserializable]";function W(t){for(var i="",e=0;t.length>e;e++){var r=t.charCodeAt(e);if(55296>r||r>56319)i+=56320>r||r>57343?t[e]:"�";else{var s=t.charCodeAt(e+1);56320>s||s>57343?i+="�":(i+=t[e]+t[e+1],e++)}}return i}function K(t){return t?t.split("#")[0]:t}function J(t,i){var e=setTimeout(t,i);return(null==e?void 0:e.unref)&&(null==e||e.unref()),e}function G(t,i,e){return X.apply(this,arguments)}function X(){return(X=i(function*(t,i,e){var r;try{return yield Promise.race([t,new Promise((t,s)=>{r=J(()=>{try{null==e||e(),t()}catch(t){s(t)}},i)})])}finally{clearTimeout(r)}})).apply(this,arguments)}function Z(t){var i=globalThis._posthogChunkIds;if(i){var e=Object.keys(i);return A&&e.length===R?A:(R=e.length,A=e.reduce((e,r)=>{T||(T={});var s=T[r];if(s)e[s[0]]=s[1];else for(var n=t(r),a=n.length-1;a>=0;a--){var o=n[a],l=null==o?void 0:o.filename,u=i[r];if(l&&u){e[l]=u,T[r]=[l,u];break}}return e},{}))}}class Q{constructor(t,i,e){void 0===e&&(e=[]),this.coercers=t,this.stackParser=i,this.modifiers=e}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(i),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,e),$exception_level:"error"}}modifyFrames(t){var e=this;return i(function*(){for(var i of t)i.stacktrace&&i.stacktrace.frames&&u(i.stacktrace.frames)&&(i.stacktrace.frames=yield e.applyModifiers(i.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 r,s;return null!=t.cause&&(r=this.parseStacktrace(t.cause,i)),""!=t.stack&&null!=t.stack&&(s=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?i.skipFirstLines:0),i.chunkIdMap)),e({},t,{cause:r,stack:s})}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 e=this;return i(function*(){var i=t;for(var r of e.modifiers)i=yield r(i);return i})()}convertToExceptionList(t,i){var r,s,n,a={type:t.type,value:t.value,mechanism:{type:null!==(r=i.type)&&void 0!==r?r:"generic",handled:null===(s=i.handled)||void 0===s||s,synthetic:null!==(n=t.synthetic)&&void 0!==n&&n}};t.stack&&(a.stacktrace={type:"raw",frames:t.stack});var o=[a];return null!=t.cause&&o.push(...this.convertToExceptionList(t.cause,e({},i,{handled:!0}))),o}buildParsingContext(t){var i;return{chunkIdMap:Z(this.stackParser),skipFirstLines:null!==(i=t.skipFirstLines)&&void 0!==i?i:1}}buildCoercingContext(t,i,r){void 0===r&&(r=0);var s=(e,r)=>{if(4>=r){var s=this.buildCoercingContext(t,i,r);return this.applyCoercers(e,s)}};return e({},i,{syntheticException:0==r?i.syntheticException:void 0,mechanism:t,apply:t=>s(t,r),next:t=>s(t,r+1)})}}var Y="?";function tt(t,i,e,r,s){var n={platform:t,filename:i,function:"<anonymous>"===e?Y:e,in_app:!!i&&!i.startsWith("webkit-masked-url://")&&"<anonymous>"!==i};return c(r)||(n.lineno=r),c(s)||(n.colno=s),n}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]:Y,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,i)=>{var e=et.exec(t);if(e)return tt(i,e[1],Y,+e[2],+e[3]);var r=rt.exec(t);if(r){if(r[2]&&0===r[2].indexOf("eval")){var s=st.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}var n=it(r[1]||Y,r[2]);return tt(i,n[1],n[0],r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},at=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,ot=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,lt=(t,i)=>{var e=at.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){var r=ot.exec(e[3]);r&&(e[1]=e[1]||"eval",e[3]=r[1],e[4]=r[2],e[5]="")}var s=e[3],n=e[1]||Y,a=it(n,s);return tt(i,s=a[1],n=a[0],e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},ut=/\(error: (.*)\)/;function ht(t,i){return t.filename===i.filename&&t.function===i.function&&t.module===i.module&&t.lineno===i.lineno&&t.colno===i.colno}function vt(t){for(var i=1;10>=i;i++){var e=t.length-2*i;if(0>e)break;for(var r=!0,s=0;i>s;s++)if(!ht(t[e+s],t[e+i+s])){r=!1;break}if(r){for(var n=0;i>n;n++)t[e+n]=t[e+i+n];return t.length=e+i,{start:e,length:i}}}}function dt(t,i){var e=i.start+i.length,r=ft(t,i);r&&t.splice(e+r===t.length?e:i.start,r)}function ct(t,i){for(var e=i.start;e>0&&ht(t[e-1],t[e-1+i.length]);)e--;return i.start-e}function ft(t,i){for(var e=i.start+i.length,r=e;t.length>r&&ht(t[r],t[r-i.length]);)r++;return r-e}function pt(t,i){var e=i[0],r=t.length-(e?ct(t,e):0);for(var s of i)r-=ft(t,s);return r}function gt(t,i,e){for(var r=0;t.length>r;r++){var s=t[(i+r)%t.length],n=t[(e+r)%t.length];if(s!==n)return n>s}return!1}class _t{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,i){var e=f(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 w(t,"DOMException")}isDOMError(t){return w(t,"DOMError")}}class bt{match(t){return S(t)}coerce(t,i){var e,r=this.getStack(t),s=void 0===r;return{type:this.getType(t),value:this.getMessage(t,i),stack:null!=r?r:null==(e=i.syntheticException)?void 0:e.stack,cause:t.cause?i.next(t.cause):void 0,synthetic:s}}getType(t){return t.name||t.constructor.name}getMessage(t,i){var e=t.message;return String(e.error&&"string"==typeof e.error.message?e.error.message:e)}getStack(t){return t.stacktrace||t.stack||void 0}}class mt{match(t){return!!w(t,"ErrorEvent")&&(null!=t.error||this.m(t))}coerce(t,i){var r;if(null!=t.error)return i.apply(t.error);var s=i.apply(t.message);return e({},s,{stack:null!==(r=this.S(t))&&void 0!==r?r:s.stack,synthetic:!0})}m(t){return f(t.message)&&t.message.length>0}S(t){var i,e,r=t,s=null!==(i=r.lineno)&&void 0!==i?i:0,n=null!==(e=r.colno)&&void 0!==e?e:0;if(f(r.filename)&&0!==r.filename.length&&0!==s)return"Error\n at "+r.filename+":"+s+":"+n}}var yt=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class wt{match(t){return"string"==typeof t}coerce(t,i){var e,r=this.getInfos(t),s=r[0],n=r[1];return{type:null!=s?s:"Error",value:null!=n?n:t,stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}getInfos(t){var i="Error",e=t,r=t.match(yt);return r&&(i=r[1],e=r[2]),[i,e]}}var St=["fatal","error","warning","log","info","debug"];function kt(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(i>=s.length)return r===e.length?s:s.length>i?s.slice(0,i)+"...":s}return""}class xt{match(t){return"object"==typeof t&&null!==t}coerce(t,i){var e,r,s=this.getErrorPropertyFromObject(t);return s?i.apply(s):{type:this.getType(t),value:this.getValue(t),stack:null!==(e=this.getStack(t))&&void 0!==e?e:null==(r=i.syntheticException)?void 0:r.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){if(k(t))return t.constructor.name;var i="name"in t?t.name:void 0;return f(i)&&!p(i)?i:"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: "+kt(t)}isSeverityLevel(t){return f(t)&&!p(t)&&St.indexOf(t)>=0}getStack(t){try{return f(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:f(t.stack)&&t.stack.length>0?t.stack:void 0}catch(t){return}}getErrorPropertyFromObject(t){for(var i in t)if({}.hasOwnProperty.call(t,i)){var e=t[i];if(S(e))return e}}getObjectClassName(t){try{var i=Object.getPrototypeOf(t);return i?i.constructor.name:void 0}catch(t){return}}}class Et{match(t){return k(t)}coerce(t,i){var e,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+kt(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}class Ft{match(t){return y(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 Pt{match(t){return w(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!k(t))return!1;try{var i=t.detail;return null!=i&&"object"==typeof i&&"reason"in i}catch(t){return!1}}coerce(t,i){var e,r=this.getUnhandledRejectionReason(t);return y(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){try{if("reason"in t)return t.reason;if("detail"in t&&null!=t.detail&&"object"==typeof t.detail&&"reason"in t.detail)return t.detail.reason}catch(t){}return t}}var Ct="$message",Tt="$timestamp",Rt=new Set([Ct,Tt]),At={enabled:!0,max_bytes:32768};function Ot(t){var i;return t?{enabled:null!==(i=t.enabled)&&void 0!==i?i:At.enabled,max_bytes:It(t.max_bytes,At.max_bytes)}:e({},At)}class Mt{constructor(t){this.k=[],this.F=0,this.P=Ot(t)}setConfig(t){this.P=Ot(t),this.C()}add(t){var i=function(t){var i,e,r;try{r=[],i=null!==(e=JSON.stringify(t,function(t,i){if("bigint"==typeof i)return i.toString();if("function"!=typeof i&&"symbol"!=typeof i){if(i instanceof Error)return{name:i.name,message:i.message,stack:i.stack};if(i&&"object"==typeof i){for(;r.length>0&&r[r.length-1]!==this;)r.pop();if(r.includes(i))return"[Circular]";r.push(i)}return i}}))&&void 0!==e?e:"null"}catch(t){return}try{var s=JSON.parse(i);if(!v(s))return;var n=s,a=n[Ct],o=n[Tt];if(!f(a)||0===a.trim().length)return;if(!f(o)&&!b(o))return;return{step:n,json:i}}catch(t){return}}(t);if(i){var e=function(t){if("u">typeof TextEncoder)return(new TextEncoder).encode(t).length;for(var i=encodeURIComponent(t),e=0,r=0;i.length>r;r++)"%"===i[r]?(e+=1,r+=2):e+=1;return e}(i.json);e>this.P.max_bytes||(this.k.push({step:i.step,bytes:e}),this.F+=e,this.C())}}getAttachable(){return this.k.map(t=>t.step)}clear(){this.k=[],this.F=0}size(){return this.k.length}C(){for(;this.F>this.P.max_bytes&&this.k.length>0;){var t=this.k.shift();t&&(this.F-=t.bytes)}}}function It(t,i){if(!b(t)||1/0===t||-1/0===t)return i;var e=Math.floor(t);return 0>e?i:e}var $t=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(i){return t}};function jt(t){return"string"==typeof t||t}function Lt(t){return"string"==typeof t?t:void 0}var Dt=0x8000000000000000,Nt={}.propertyIsEnumerable;function zt(t,i){try{return Ut(t,i,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch(t){return[]}}function Bt(t,i,e,r){if(0>=e.remainingNodes)return{stringValue:V};if(e.remainingNodes--,m(t))return{boolValue:t};if("bigint"==typeof t)return function(t,i){var e=t.toString(),r=BigInt("9223372036854775808");return t>=r||-r>t?(null==i||i.debug("Attribute "+e+" is outside the int64 range; encoding it as a string"),{stringValue:e}):{intValue:e}}(t,i);if("number"==typeof t){if(!Number.isFinite(t))return{stringValue:String(t)};if(Number.isInteger(t)){if(Number.isSafeInteger(t))return{intValue:String(t)};if(typeof BigInt>"u")return{stringValue:String(t)};var s=BigInt(t).toString();return t>=Dt||-Dt>t?(null==i||i.debug("Attribute "+s+" is outside the int64 range; encoding it as a string"),{stringValue:s}):{intValue:s}}return{doubleValue:t}}if("string"==typeof t)return{stringValue:W(t)};if("function"==typeof t)return{stringValue:"[Function]"};if("symbol"==typeof t)return{stringValue:String(t)};if("object"==typeof t&&null!==t){if(e.ancestors.has(t))return{stringValue:"[Circular]"};if(r>=20)return{stringValue:V};if(t instanceof Date){var n=t.getTime(),a=Number.isFinite(n)?t.toISOString():String(t);return{stringValue:"string"==typeof a?W(a):String(a)}}e.ancestors.add(t);try{try{var o=t.toJSON;if("function"==typeof o)return Bt(o.call(t),i,e,r+1)}catch(t){}return u(t)?{arrayValue:{values:Ht(t,i,e,r+1)}}:{kvlistValue:{values:Ut(t,i,e,r+1)}}}finally{e.ancestors.delete(t)}}return{stringValue:W(String(t))}}function Ht(t,i,e,r){for(var s=[],n=Math.min(t.length,1e3),a=0;n>a&&e.remainingNodes>0;a++)try{var o=a in t?t[a]:void 0;if(_(o))continue;s.push(Bt(o,i,e,r))}catch(t){s.push({stringValue:q})}return t.length>a&&s.push({stringValue:V}),s}function Ut(t,i,e,r){var s=[];for(var n in t)if(Nt.call(t,n)){if(!n){null==i||i.debug("Dropping an attribute with an empty key");continue}if(s.length>=1e3||0>=e.remainingNodes){null==i||i.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{var a=t[n];if(g(a)||c(a))continue;s.push({key:W(n),value:Bt(a,i,e,r)})}catch(t){s.push({key:W(n),value:{stringValue:q}})}}return s}function Vt(t,i,r){return e({},t.resourceAttributes,{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment},t.serviceVersion&&{"service.version":t.serviceVersion},{"telemetry.sdk.name":i,"telemetry.sdk.version":r})}var qt={darwin:"macOS",win32:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",aix:"AIX","Mac OS X":"macOS"};var Wt={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},Kt=Wt.info;function Jt(t){try{return W(String(t))}catch(t){return q}}function Gt(t,i,r,s){var n,a=Wt[t.level||"info"]||Kt,o=a.text,l=a.number,u=(void 0===(n=b(s)?s:void 0)&&(n=Date.now()),String(n)+"000000"),h={};i.distinctId&&(h.posthogDistinctId=i.distinctId),i.sessionId&&(h.sessionId=i.sessionId),i.windowId&&(h["window.id"]=i.windowId),_(i.sessionStartTimestamp)||(h.sessionStartTimestamp=String(i.sessionStartTimestamp)),_(i.lastActivityTimestamp)||(h.lastActivityTimestamp=String(i.lastActivityTimestamp)),i.currentUrl&&(h["url.full"]=i.currentUrl),i.screenName&&(h["screen.name"]=i.screenName),i.appState&&(h["app.state"]=i.appState),i.activeFeatureFlags&&i.activeFeatureFlags.length>0&&(h.feature_flags=i.activeFeatureFlags);var v=e({},h),d=t.attributes;if(d){var f=[];try{f=Object.keys(d)}catch(t){f=[]}for(var p of f){var g=void 0;try{g=d[p]}catch(t){g=q}Object.defineProperty(v,p,{value:g,enumerable:!0,writable:!0,configurable:!0})}}var m={timeUnixNano:u,observedTimeUnixNano:u,severityNumber:l,severityText:o,body:{stringValue:Jt(t.body)},attributes:zt(v,r)};return t.trace_id&&(m.traceId=t.trace_id),t.span_id&&(m.spanId=t.span_id),c(t.trace_flags)||(m.flags=t.trace_flags),m}function Xt(t,i,e){return Vt(t,i,e)}function Zt(t,i,e,r){return{resourceLogs:[{resource:{attributes:zt(i)},scopeLogs:[{scope:{name:e,version:r},logRecords:t}]}]}}let Qt=class{constructor(t,i,e,r,s,n,a){var o;void 0===n&&(n=()=>Promise.resolve()),this._instance=t,this.P=i,this.l=e,this.T=r,this.R=s,this.A=n,this.O=a,this.M=null,this.I=0,this.$=0,this.j=0,this.L=0,this.D=0,this.N=!1,this.B=i.maxBufferSize,this.H=Math.max(null!==(o=i.maxQueueSize)&&void 0!==o?o:i.maxBufferSize,i.maxBufferSize),this.U=i.flushIntervalMs,this.V=i.maxBatchRecordsPerPost,this.q=i.rateCapWindowMs,this.W=i.maxLogsPerInterval}clearQueue(){this.$++,this._instance.setPersistedProperty(r.LogsQueue,[])}reset(){this.K(),this.L=0,this.D=0,this.N=!1,this.j=0,this.V=this.P.maxBatchRecordsPerPost}onReconnect(){this.j=0,this.J()}captureLog(t,i){var e;if(!this._instance.isDisabled&&!this._instance.optedOut&&null!=t&&t.body){var r=this.G(t);if(null!==r)if(r.body){if(this.X()){var s={record:Gt(r,null!==(e=null==i?void 0:i.context)&&void 0!==e?e:this.T(),this.l,null==i?void 0:i.occurredAtMs)};this.R(()=>this.Z(s))}}else this.l.info("Log was rejected in beforeSend function")}}G(t){var i=this.P.beforeSend;if(!i)return t;var e=u(i)?i:[i],r=t;for(var s of e)try{var n=s(r);if(!n)return this.l.info("Log was rejected in beforeSend function"),null;r=n}catch(t){return this.l.error("Error in beforeSend function for log:",t),null}return r}X(){if(void 0===this.W)return!0;var t=Date.now(),i=t-this.L;return this.q>i&&i>=0||(this.L=t,this.D=0,this.N=!1),this.W>this.D?(this.D++,!0):(this.N||(this.l.warn("captureLog dropping logs: exceeded "+this.W+" logs per "+this.q+"ms"),this.N=!0),!1)}flush(){var t=this;return i(function*(){if(!t._instance.isDisabled)return t.M||(t.M=t.Y().finally(()=>{t.M=null})),t.M})()}Y(){var t=this;return i(function*(){var i;t.K();var e=null!==(i=t._instance.getPersistedProperty(r.LogsQueue))&&void 0!==i?i:[];if(0!==e.length)for(var s=e.length,n=0;e.length>0&&s>n;){var a,o,l=t.$;t.I=0;var u=Math.min(e.length,t.V),h=e.slice(0,u),v=Zt(h.map(t=>t.record),t.tt(),null!==(a=t.O)&&void 0!==a?a:t._instance.getLibraryId(),t._instance.getLibraryVersion()),d=yield t._instance.it(v);if(t.$!==l)return;if("too-large"===d.kind&&h.length>1)t.V=Math.max(1,Math.floor(h.length/2)),t.l.warn("Received 413 when sending logs batch of size "+h.length+", reducing batch size to "+t.V);else{if("retry-later"===d.kind)throw d.error;if("too-large"===d.kind?t.l.warn("Dropping a single log record after 413 with batch size 1 — the record is larger than the server cap and cannot be split further."):"ok"===d.kind&&t.P.maxBatchRecordsPerPost>t.V&&(t.V=Math.min(t.P.maxBatchRecordsPerPost,t.V+1)),yield t.et(h.length),e=null!==(o=t._instance.getPersistedProperty(r.LogsQueue))&&void 0!==o?o:[],n+=h.length,"fatal"===d.kind)throw d.error}}})()}et(t){var e=this;return i(function*(){var i,s=Math.max(0,t-e.I),n=null!==(i=e._instance.getPersistedProperty(r.LogsQueue))&&void 0!==i?i:[];e._instance.setPersistedProperty(r.LogsQueue,n.slice(s)),yield e.A()})()}tt(){return Xt(this.P,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Z(t){var i;if(!this._instance.optedOut){var e=null!==(i=this._instance.getPersistedProperty(r.LogsQueue))&&void 0!==i?i:[];this.H>e.length||(e.shift(),this.I++,this.l.info("Logs queue is full, dropping oldest record.")),e.push(t),this._instance.setPersistedProperty(r.LogsQueue,e),this.B>e.length?this.rt():this.J()}}rt(t){void 0===t&&(t=this.U),this.st||(this.st=J(()=>{this.st=void 0,this.J()},t))}nt(){var t=Math.min(Math.max(0,this.j-1),6);return this.U*Math.pow(2,t)}ot(){var t=this._instance.getPersistedProperty(r.LogsQueue);return!!t&&t.length>0}shutdown(t){var e=this;return i(function*(){e.K();var i=e.flush().catch(()=>{});void 0!==t?yield G(i,t):yield i})()}flushWithTimeout(t){var e=this;return i(function*(){var i=e.flush();yield G(i,t,()=>{i.catch(()=>{})})})()}J(){this.flush().then(()=>{this.j=0},t=>{this.j++,this.l.error("PostHog logs flush failed:",t)}).finally(()=>{!this._instance.isDisabled&&this.ot()&&this.rt(this.nt())})}K(){this.st&&(clearTimeout(this.st),this.st=void 0)}};var Yt=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function ti(t){return String(t)+"000000"}function ii(t,i,e,r){var s="";return r&&(s=Object.keys(r).sort().map(t=>JSON.stringify(t)+":"+JSON.stringify(r[t])).join(",")),t+"\0"+i+"\0"+(null!=e?e:"")+"\0"+s}let ei=class{constructor(t,i,e){this._instance=t,this.P=i,this.l=e,this.ut=new Map,this.M=null,this.ht=!1,this.vt=new Map,this.dt=new Set,this.ct=0}count(t,i,e){void 0===i&&(i=1),this.ft({name:t,type:"count",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}gauge(t,i,e){this.ft({name:t,type:"gauge",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}histogram(t,i,e){this.ft({name:t,type:"histogram",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}flush(){var t=this,e=this.M,r=function(){var r=i(function*(){e&&(yield e.catch(()=>{})),yield t._t()});return function(){return r.apply(this,arguments)}}(),s=r().finally(()=>{this.M===s&&(this.M=null)});return this.M=s,s}drainWindow(){if(0===this.ut.size)return null;var t=this.ut;return this.ut=new Map,this.ht=!1,this.vt=new Map,this.dt=new Set,this.bt(t)}reset(){this.ct++,this.K(),this.ut=new Map,this.M=null,this.ht=!1,this.vt=new Map,this.dt=new Set}ft(t){if(!this._instance.isDisabled&&!this._instance.optedOut){var i=this.G(t);if(null!==i)if(i.name&&"string"==typeof i.name)if("number"==typeof i.value&&Number.isFinite(i.value))if("count"===i.type&&0>i.value)this.l.warn("Dropping count '"+i.name+"': counters are monotonic, value must be >= 0");else{var r,s;try{r=i.attributes?e({},i.attributes):void 0,s=ii(i.type,i.name,i.unit,r)}catch(t){return void this.l.warn("Dropping metric '"+i.name+"': attributes could not be serialized",t)}var n=this.ut.get(s);if(!n){if(!this.yt())return;n={name:i.name,type:i.type,unit:i.unit,attributes:r,windowStartMs:Date.now()},this.ut.set(s,n)}var a=this.vt.get(i.name);void 0===a?this.vt.set(i.name,i.type):a===i.type||this.dt.has(i.name)||(this.dt.add(i.name),this.l.warn("Metric name '"+i.name+"' is already used as a "+a+"; recording it as a "+i.type+" too will blend both series in charts. Use a distinct name.")),this.wt(n,i.value),this.rt()}else this.l.warn("Dropping metric '"+i.name+"': value must be a finite number");else this.l.warn("Dropping metric with empty name")}}yt(){return this.P.maxSeriesPerFlush>this.ut.size||(this.ht||(this.ht=!0,this.l.warn("Metric series cap reached ("+this.P.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}wt(t,i){var e;switch(t.type){case"count":t.total=(null!==(e=t.total)&&void 0!==e?e:0)+i;break;case"gauge":t.last=i;break;case"histogram":t.hist||(t.hist={count:0,sum:0,min:i,max:i,bucketCounts:new Array(Yt.length+1).fill(0)});var r=t.hist;r.count+=1,r.sum+=i,r.min=Math.min(r.min,i),r.max=Math.max(r.max,i),r.bucketCounts[function(t,i){for(var e=0;i.length>e;e++)if(i[e]>=t)return e;return i.length}(i,Yt)]+=1}}G(t){var i=this.P.beforeSend;if(!i)return t;var e=u(i)?i:[i],r=t;for(var s of e)try{var n=s(r);if(!n)return this.l.info("Metric was rejected in beforeSend function"),null;r=n}catch(t){return this.l.error("Error in beforeSend function for metric:",t),null}return r}rt(){this.st||(this.st=J(()=>{this.st=void 0,this.flush().catch(t=>{this.l.error("Metrics flush failed:",t)})},this.P.flushIntervalMs))}K(){this.st&&(clearTimeout(this.st),this.st=void 0)}_t(){var t=this;return i(function*(){if(0!==t.ut.size){var i=t.ut;t.ut=new Map,t.ht=!1,t.vt=new Map,t.dt=new Set;var e=t.ct,r=yield t._instance.St(t.bt(i));if(e===t.ct)switch(r.kind){case"ok":return;case"retry-later":return t.kt(i),void t.rt();case"too-large":return void t.l.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.l.error("Failed to send metrics batch:",r.error)}}})()}bt(t){return i=this.xt(t),e=function(t,i,e){return Vt(t,i,e)}(this.P,this._instance.getLibraryId(),this._instance.getLibraryVersion()),r=this._instance.getLibraryId(),s=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:zt(e)},scopeMetrics:[{scope:{name:r,version:s},metrics:i}]}]};var i,e,r,s}xt(t){var i=ti(Date.now()),r=new Map;for(var s of t.values()){var n,a=ii(s.type,s.name,s.unit,void 0),o=r.get(a);o||(o=e({name:s.name},s.unit&&{unit:s.unit}),"count"===s.type?o.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===s.type?o.gauge={dataPoints:[]}:o.histogram={aggregationTemporality:1,dataPoints:[]},r.set(a,o));var l=zt(null!==(n=s.attributes)&&void 0!==n?n:{},this.l),u=ti(s.windowStartMs);if("count"===s.type){var h,v={attributes:l,startTimeUnixNano:u,timeUnixNano:i,asDouble:null!==(h=s.total)&&void 0!==h?h:0};o.sum.dataPoints.push(v)}else if("gauge"===s.type){var d,c={attributes:l,timeUnixNano:i,asDouble:null!==(d=s.last)&&void 0!==d?d:0};o.gauge.dataPoints.push(c)}else s.hist&&o.histogram.dataPoints.push({attributes:l,startTimeUnixNano:u,timeUnixNano:i,count:s.hist.count,sum:s.hist.sum,min:s.hist.min,max:s.hist.max,bucketCounts:s.hist.bucketCounts,explicitBounds:Yt})}return Array.from(r.values())}kt(t){var i,e;for(var r of t){var s=r[0],n=r[1],a=this.ut.get(s);if(a)switch(a.windowStartMs=Math.min(a.windowStartMs,n.windowStartMs),a.type){case"count":a.total=(null!==(i=a.total)&&void 0!==i?i:0)+(null!==(e=n.total)&&void 0!==e?e:0);break;case"gauge":break;case"histogram":if(n.hist)if(a.hist){a.hist.count+=n.hist.count,a.hist.sum+=n.hist.sum,a.hist.min=Math.min(a.hist.min,n.hist.min),a.hist.max=Math.max(a.hist.max,n.hist.max);for(var o=0;a.hist.bucketCounts.length>o;o++)a.hist.bucketCounts[o]+=n.hist.bucketCounts[o]}else a.hist=n.hist}else this.yt()&&this.ut.set(s,n)}}};var ri={DEBUG:!1,LIB_VERSION:"0.8.2",LIB_NAME:"browser-common"},si="u">typeof window?window:void 0,ni="u">typeof globalThis?globalThis:si,ai=null==ni?void 0:ni.navigator,oi=null==ni?void 0:ni.document,li=null==ni?void 0:ni.location;function ui(){return!(!si||!1===si.navigator.onLine)}null!=ni&&ni.XMLHttpRequest&&new ni.XMLHttpRequest;var hi=function(t,i){var e=(void 0===i?{}:i).debugEnabled,r={Et(i){if(si&&(ri.DEBUG||si.POSTHOG_DEBUG||e)&&!c(si.console)&&si.console){for(var r=("__rrweb_original__"in si.console[i]?si.console[i].__rrweb_original__:si.console[i]),s=arguments.length,n=new Array(s>1?s-1:0),a=1;s>a;a++)n[a-1]=arguments[a];r(t,...n)}},debug(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.Et("debug",...i)},info(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.Et("log",...i)},warn(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.Et("warn",...i)},error(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.Et("error",...i)},critical(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];console.error(t,...e)},uninitializedWarning(t){r.error("You must initialize PostHog before calling "+t)},createLogger:(i,e)=>hi(t+" "+i,e)};return r},vi=hi("[PostHog.js]"),di=vi.createLogger;function ci(t,i){if(!_(t))if(u(t))t.forEach(i);else if(t instanceof FormData)t.forEach((t,e)=>i(t,e));else for(var e in t)o.call(t,e)&&i(t[e],e)}var fi=function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;i>r;r++)e[r-1]=arguments[r];for(var s of e)for(var n in s)void 0!==s[n]&&(t[n]=s[n]);return t};function pi(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 gi=function(t){try{return t()}catch(t){return}};function _i(t,i,e,r){var s=null!=r?r:{},n=s.capture,a=s.passive;null==t||t.addEventListener(i,e,{capture:void 0!==n&&n,passive:void 0===a||a})}function bi(t){return"ph_toolbar_internal"===t.name}function mi(t,i){var e,r=null==t||null==(e=t.config)?void 0:e.get_current_url;if(!h(r))return i;try{var s=r(i);return f(s)&&s?s:i}catch(t){return vi.error("Error in get_current_url, falling back to window.location.href",t),i}}var yi="__POSTHOG_TOOLBAR__";function wi(t){return t instanceof Element&&(t.id===yi||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function Si(t){return!!t&&1===t.nodeType}function ki(t,i){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===i.toLowerCase()}function xi(t){return!!t&&3===t.nodeType}function Ei(t){return!!t&&11===t.nodeType&&Si(t.host)}var Fi=1e3;function Pi(t){return t?n(t).split(/\s+/):[]}function Ci(t,i){var e=function(t){var i,e=null==si||null==(i=si.location)?void 0:i.href;return c(e)?void 0:mi(t,e)}(i);return!!(e&&t&&t.some(t=>e.match(t)))}function Ti(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 Pi(i)}function Ri(t){return _(t)?null:n(t).split(/(\s+)/).filter(t=>te(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Ai(t){var i="";return qi(t)&&!Wi(t)&&t.childNodes&&t.childNodes.length&&ci(t.childNodes,function(t){var e;xi(t)&&t.textContent&&(i+=null!==(e=Ri(t.textContent))&&void 0!==e?e:"")}),n(i)}function Oi(t){var i;return c(t.target)?t.srcElement||null:null!=(i=t.target)&&i.shadowRoot?t.composedPath()[0]||null:t.target||null}var Mi=["a","button","form","input","select","textarea","label"];function Ii(t,i){var e=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector;try{return!!e&&e.call(t,i)}catch(t){return!1}}function $i(t,i){if(c(i))return!0;var e,r=function(t){if(i.some(i=>Ii(t,i)))return{v:!0}};for(var s of t)if(e=r(s))return e.v;return!1}function ji(t){var i=t.parentNode;return!(!i||!Si(i))&&i}var Li=[".ph-no-autocapture","[data-ph-no-autocapture]"],Di=["next","previous","prev",">","<"],Ni=(t,i)=>/[a-z0-9]/i.test(i)?t.includes(i):t===i,zi=[".ph-no-rageclick",".ph-no-capture"],Bi=["","text","search","email","password","url","tel","number"];function Hi(t,i){if(!si||Ui(t))return!1;var e,r,n,a,o;if(m(i)?(e=!!i&&zi,r=void 0,n=!1):(e=null!==(a=null==i?void 0:i.css_selector_ignorelist)&&void 0!==a?a:zi,r=null==i?void 0:i.content_ignorelist,n=null!==(o=null==i?void 0:i.ignore_text_selection)&&void 0!==o&&o),!1===e)return!1;if(n&&function(t){return!(!t||!Si(t))&&(!!ki(t,"textarea")||(ki(t,"input")?s(Bi,(t.getAttribute("type")||"").toLowerCase()):function(t){if(t.isContentEditable)return!0;var i=null==t.getAttribute?void 0:t.getAttribute("contenteditable");return"true"===i||""===i}(t)))}(t))return!1;var l=Vi(t,!1).targetElementList;return!function(t,i){if(!1===t||c(t))return!1;var e;if(!0===t)e=Di;else{if(!u(t))return!1;if(t.length>10)return vi.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;e=t.map(t=>t.toLowerCase())}return i.some(t=>{var i=t.safeText,r=t.ariaLabel;return e.some(t=>Ni(i,t)||Ni(r,t))})}(r,l.map(t=>{var i;return{safeText:Ai(t).toLowerCase(),ariaLabel:(null==(i=t.getAttribute("aria-label"))?void 0:i.toLowerCase().trim())||""}}))&&!$i(l,e)}var Ui=t=>!t||ki(t,"html")||!Si(t),Vi=(t,i)=>{if(!si||Ui(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var e=!1,r=[t],s=t;s.parentNode&&!ki(s,"body");)if(Ei(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var n=ji(s);if(!n)break;if(i||Mi.indexOf(n.tagName.toLowerCase())>-1)e=!0;else try{var a=si.getComputedStyle(n);a&&"pointer"===a.getPropertyValue("cursor")&&(e=!0)}catch(t){}r.push(n),s=n}return{parentIsUsefulElement:e,targetElementList:r}};function qi(t){for(var i=new Set,e=0,r=t;r.parentNode&&!ki(r,"body");r=r.parentNode){if(e++>=Fi||i.has(r))return!1;i.add(r);var n=Ti(r);if(s(n,"ph-sensitive")||s(n,"ph-no-capture"))return!1}if(s(Ti(t),"ph-include"))return!0;var a=t.type||"";if(f(a))switch(a.toLowerCase()){case"hidden":case"password":return!1}var o=t.name||t.id||"";return!f(o)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(o.replace(/[^a-zA-Z0-9]/g,""))}function Wi(t){return!!(ki(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||ki(t,"select")||ki(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var Ki=new RegExp("^(?:(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}))$"),Ji=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Gi=[16,15,14,13],Xi=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Zi=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Qi=/[0-9A-Za-z_]/;function Yi(t){for(var i=0,e=!1,r=t.length-1;r>=0;r--){var s=t.charCodeAt(r)-48;e&&(s*=2)>9&&(s-=9),i+=s,e=!e}return i%10==0}function te(t,i){if(void 0===i&&(i=!0),_(t))return!1;if(f(t)){t=n(t);var e=i?Ki.test((t||"").replace(/[- ]/g,"")):function(t){var i;for(Ji.lastIndex=0;i=Ji.exec(t);){var e=i[2];if(e)for(var r=e.replace(/[- ]/g,""),s=0;r.length>s;s++)for(var n of Gi){var a=s+n;if(r.length>=a){var o=r.slice(s,a);if(Ki.test(o)&&Yi(o))return!0}}}return!1}(t);if(e)return!1;var r=i?Xi.test(t):function(t){var i;for(Zi.lastIndex=0;i=Zi.exec(t);){var e=i[1],r=i[3];if(!(e&&r&&Qi.test(e)&&Qi.test(r)))return!0}return!1}(t);if(r)return!1}return!0}function ie(t){var i=Ai(t);return te(i=(i+" "+ee(t)).trim())?i:""}function ee(t){var i="";return t&&t.childNodes&&t.childNodes.length&&ci(t.childNodes,function(t){var e;if(t&&"span"===(null==(e=t.tagName)?void 0:e.toLowerCase()))try{var r=Ai(t);i=(i+" "+r).trim(),t.childNodes&&t.childNodes.length&&(i=(i+" "+ee(t)).trim())}catch(t){vi.error("[AutoCapture]",t)}}),i}function re(t){return t.replace(/"|\\"/g,'\\"')}function se(t){var i=t.attr__class;if(i)return u(i)?i:Pi(i)}class ne{constructor(t){this.disabled=!1===t;var i=v(t)?t:{};this.thresholdPx=i.threshold_px||30,this.timeoutMs=i.timeout_ms||1e3,this.clickCount=i.click_count||3,this.clicks=[]}isRageClick(t,i,e){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(t-r.x)+Math.abs(i-r.y)<this.thresholdPx&&this.timeoutMs>e-r.timestamp){if(this.clicks.push({x:t,y:i,timestamp:e}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:i,timestamp:e}];return!1}}var ae="$autocapture_disabled_server_side",oe="$heatmaps_enabled_server_side",le="$exception_capture_enabled_server_side",ue="$error_tracking_suppression_rules",he="$error_tracking_capture_extension_exceptions",ve="$web_vitals_enabled_server_side",de="$dead_clicks_enabled_server_side",ce="$product_tours_enabled_server_side",fe="$logs_capture_enabled_server_side",pe="$web_vitals_allowed_metrics",ge="$session_recording_remote_config",_e="$replay_override_sampling",be="$replay_override_linked_flag",me="$enabled_feature_flags",ye="$active_feature_flags",we="$early_access_features",Se="$feature_flag_details",ke="$feature_flag_payloads",xe="$feature_flag_request_id",Ee="$minimal_flag_called_events",Fe="$override_feature_flags",Pe="$override_feature_flag_payloads",Ce="$stored_person_properties",Te="$stored_group_properties",Re="$surveys",Ae="$surveys_loaded_at",Oe="$surveys_activated",Me="$surveys_activated_session",Ie="$surveys_activated_timestamps",$e="ph_product_tours",je="$flag_call_reported",Le="$flag_call_reported_session_id",De="$feature_flag_errors",Ne="$feature_flag_evaluated_at",ze="$sdk_debug_recording_script_not_loaded",Be=3e5,He=Be,Ue="PostHog loadExternalDependency extension not found.",Ve="visibilitychange",qe="beforeunload",We=function(t,i){for(var e,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===i){e=n;break}}if(!u(e)||2>e.length)return"";var a=e[1];try{a=decodeURIComponent(a)}catch(t){vi.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},Ke=function(t,i,e){if(!t||!i||!i.length)return t;for(var r=t.split("#"),s=r[1],n=(r[0]||"").split("?"),a=n[1],o=n[0],l=(a||"").split("&"),h=[],v=0;l.length>v;v++){var d=l[v].split("=");u(d)&&(i.includes(d[0])?h.push(d[0]+"="+e):h.push(l[v]))}var c=o;return null!=a&&(c+="?"+h.join("&")),null!=s&&(c+="#"+s),c},Je=function(t,i){var e=t.match(new RegExp(i+"=([^&]*)"));return e?e[1]:null},Ge=(t,i)=>t>=i&&ui(),Xe=(t,i,e,r)=>{if(0===t){if(ui()){var s=i+1;return s===e&&r(),s}return i}return 0},Ze="$copy_autocapture",Qe=di("[AutoCapture]");function Ye(t,i){return i.length>t?i.slice(0,t)+"...":i}function tr(t){if(t.previousElementSibling)return t.previousElementSibling;var i=t;do{i=i.previousSibling}while(i&&!Si(i));return i}function ir(t,i){var r,n,a=i.e,o=i.maskAllElementAttributes,l=i.maskAllText,h=i.elementAttributeIgnoreList,v=i.elementsChainAsString,d=i.disableCaptureUrlHashes;if(!Si(t))return{props:{}};for(var p=[t],g=new Set([t]),_=t;_.parentNode&&!ki(_,"body")&&Fi>p.length;)if(Ei(_.parentNode)){var b=_.parentNode.host;if(g.has(b))break;g.add(b),p.push(b),_=b}else{if(!Si(_.parentNode))break;if(g.has(_.parentNode))break;g.add(_.parentNode),p.push(_.parentNode),_=_.parentNode}var m="click"===a.type&&"http://www.w3.org/2000/svg"===t.namespaceURI?p.findIndex(t=>ki(t,"button")||ki(t,"a")):-1;m>0&&(l=l||p.slice(0,m+1).some(t=>!qi(t)||Wi(t)));var y,w,S=[],k={},x=!1,E=!1;if(ci(p,t=>{var i=qi(t);if(ki(t,"a")){var e=t.getAttribute("href");x=!!(i&&e&&te(e))&&(d?K(e):e)}s(Ti(t),"ph-no-capture")&&(E=!0),S.push(function(t,i,e,r,s){void 0===s&&(s=!1);var n=t.tagName.toLowerCase(),a={tag_name:n};Mi.indexOf(n)>-1&&!e&&(a.$el_text="a"===n.toLowerCase()||"button"===n.toLowerCase()?Ye(1024,ie(t)):Ye(1024,Ai(t)));var o=Ti(t);o.length>0&&(a.classes=o.filter(function(t){return""!==t})),ci(t.attributes,function(e){var n;if((!Wi(t)||-1!==["name","id","class","aria-label"].indexOf(e.name))&&(null==r||!r.includes(e.name))&&!i&&te(e.value)&&(!f(n=e.name)||"_ngcontent"!==n.substring(0,10)&&"_nghost"!==n.substring(0,7))){var o=e.value;"class"===e.name&&(o=Pi(o).join(" ")),a["attr__"+e.name]=Ye(1024,"href"===e.name&&s?K(o):o)}});for(var l=1,u=1,h=t;h=tr(h);)l++,h.tagName===t.tagName&&u++;return a.nth_child=l,a.nth_of_type=u,a}(t,o,l,h,d));var r=function(t){if(!qi(t))return{};var i={};return ci(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&&te(r)&&(i[e]=r)}}),i}(t);ci(r,(t,i)=>{({}).hasOwnProperty.call(k,i)||(k[i]=t)})}),E)return{props:{},explicitNoCapture:E};if(m>0&&(t=p[m],S.splice(0,m)),l||(S[0].$el_text=ki(t,"a")||ki(t,"button")?ie(t):Ai(t)),x){var F,P;S[0].attr__href=x;var C=null==(F=(t=>{var i=null==oi?void 0:oi.createElement("a");return c(i)?null:(i.href=t,i)})(x))?void 0:F.host,T=null==si||null==(P=si.location)?void 0:P.host;C&&T&&C!==T&&(y=x)}return{props:fi({$event_type:a.type,$ce_version:1},v?{}:{$elements:S},{$elements_chain:(w=S,u(w)?function(t){return t.map(t=>{var i,r,s="";if(t.tag_name&&(s+=t.tag_name),t.attr_class)for(var n of(t.attr_class.sort(),t.attr_class))s+="."+n.replace(/"/g,"");var a=e({},t.text?{text:t.text}:{},{"nth-child":null!==(i=t.nth_child)&&void 0!==i?i:0,"nth-of-type":null!==(r=t.nth_of_type)&&void 0!==r?r:0},t.href?{href:t.href}:{},t.attr_id?{attr_id:t.attr_id}:{},t.attributes),o={};return pi(a).sort((t,i)=>{return(r=i[0])>(e=t[0])?-1:e>r?1:0;var e,r}).forEach(t=>{var i=t[1];return o[re(t[0].toString())]=re(i.toString())}),(s+=":")+pi(o).map(t=>t[0]+'="'+t[1]+'"').join("")}).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:se(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return pi(t).filter(t=>0===t[0].indexOf("attr__")).forEach(t=>r.attributes[t[0]]=t[1]),r})}(w)):"")},null!=(r=S[0])&&r.$el_text?{$el_text:null==(n=S[0])?void 0:n.$el_text}:{},y&&"click"===a.type?{$external_click_url:y}:{},k),target:t}}class er{Ft(){this.Pt=void 0,clearTimeout(this.Ct),this.Ct=void 0}Tt(t){var i;if(!qi(t))return!0;for(var e,r=null!==(i=this.Rt().css_selector_ignorelist)&&void 0!==i?i:Li,n=new Set,a=t,o=function(){if(n.size>=Fi||n.has(a))return{v:!0};n.add(a);var t=a,i=Ti(t);if(s(i,"ph-no-capture")||s(i,"ph-sensitive")||Wi(t)||r.some(i=>Ii(t,i)))return{v:!0};var e=a.parentNode;a=Ei(e)?e.host:e&&Si(e)?e:null};a;)if(e=o())return e.v;return!1}At(t){if(this.isEnabled&&"pointercancel"!==t.type)if("pointerdown"!==t.type){var i=this.Pt;i&&(t.pointerId!==i.id||Math.abs(t.clientX-i.x)>5||Math.abs(t.clientY-i.y)>5?this.Ft():"pointerup"===t.type&&(i.released=!0,this.Ct=setTimeout(()=>this.Ft(),0)))}else{this.Ft();var e,r=Oi(t);t.isPrimary&&0===t.button&&!t.ctrlKey&&r&&Si(r)&&(this.Pt={target:r,excluded:this.Tt(r),id:t.pointerId,x:t.clientX,y:t.clientY,released:!1,distinctId:null==(e=this.Ot)?void 0:e.distinctId})}else this.Ft()}Mt(t){var i,e=this.Pt;this.Ft();var r=Oi(t);if(null!=e&&e.released&&e.target.isConnected&&e.distinctId===(null==(i=this.Ot)?void 0:i.distinctId)&&t.pointerId===e.id&&(t.detail>0||"touch"===t.pointerType||"pen"===t.pointerType)&&0===t.button&&5>=Math.abs(t.clientX-e.x)&&5>=Math.abs(t.clientY-e.y)&&r&&(ki(r,"html")||ki(r,"body"))){var n;if(e.excluded)return null;var a=null!==(n=this.Rt().css_selector_ignorelist)&&void 0!==n?n:Li;return[r,null==oi?void 0:oi.documentElement,null==oi?void 0:oi.body].some(t=>{if(!t)return!1;var i=Ti(t);return s(i,"ph-no-capture")||s(i,"ph-sensitive")||!qi(t)||Wi(t)||a.some(i=>Ii(t,i))})?null:e.target}}constructor(t){this.name="autocapture",this.It=!1,this.$t=null,this.jt=!1,this.Lt=!1,this.P={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.Dt=!1,this.Nt=t,this.Nt.refresh(this.P),this.rageclicks=new ne(this.P.rageclick),this.zt=null}setup(t){this.Bt(),this.Ot=t;var i=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.Dt?i.dispose():(this.Ht=i,this.startIfEnabled())}dispose(){var t;this.Dt||(this.Dt=!0,this.Ot=void 0,null==(t=this.Ht)||t.dispose(),this.Ht=void 0,this.Ut())}Rt(){return this.Nt.refresh(this.P),this.P}Bt(){var t,i;return this.Rt(),this.P.url_allowlist=null==(t=this.P.url_allowlist)?void 0:t.map(t=>new RegExp(t)),this.P.url_ignorelist=null==(i=this.P.url_ignorelist)?void 0:i.map(t=>new RegExp(t)),this.P}Vt(){if(this.isBrowserSupported()){if(si&&oi){var t=this.qt=t=>{t=t||(null==si?void 0:si.event);try{if("blur"===t.type)return void this.Ft();if(0===t.type.indexOf("pointer"))return void this.At(t);var i="click"===t.type?this.Mt(t):void 0;if(g(i))return;this.Wt(t,"$autocapture",i)}catch(t){Qe.error("Failed to capture event",t)}};if(_i(si,"blur",t),_i(oi,"submit",t,{capture:!0}),_i(oi,"change",t,{capture:!0}),_i(oi,"click",t,{capture:!0}),ci(["pointerdown","pointermove","pointerup","pointercancel"],i=>{_i(oi,i,t,{capture:!0})}),this.Rt().capture_copied_text){var i=this.Kt=t=>{t=t||(null==si?void 0:si.event);try{this.Wt(t,Ze)}catch(t){Qe.error("Failed to capture clipboard event",t)}};_i(oi,"copy",i,{capture:!0}),_i(oi,"cut",i,{capture:!0}),_i(oi,"paste",i,{capture:!0})}}}else Qe.info("Disabling Automatic Event Collection because this browser is not supported")}Ut(){this.Ft(),this.qt&&(null==si||si.removeEventListener("blur",this.qt),ci(["pointerdown","pointermove","pointerup","pointercancel"],t=>{null==oi||oi.removeEventListener(t,this.qt,!0)}),null==oi||oi.removeEventListener("submit",this.qt,!0),null==oi||oi.removeEventListener("change",this.qt,!0),null==oi||oi.removeEventListener("click",this.qt,!0),this.qt=void 0),this.Kt&&(null==oi||oi.removeEventListener("copy",this.Kt,!0),null==oi||oi.removeEventListener("cut",this.Kt,!0),null==oi||oi.removeEventListener("paste",this.Kt,!0),this.Kt=void 0),this.It=!1}startIfEnabled(){this.isEnabled||this.Ft(),!this.Dt&&this.Ot&&this.isEnabled&&!this.It&&(this.Vt(),this.It=!0)}onRemoteConfig(t){if(!this.Dt)if(this.jt=!0,t.ok){var i=t.config;i.elementsChainAsString&&(this.Lt=i.elementsChainAsString);var e,r=i.autocapture_opt_out;m(r)&&(null==(e=this.Ot)||e.kv.set(ae,r),this.$t=r),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(t){this.zt=t}getElementSelectors(t,i){var e,r=[];return null==(e=this.zt)||e.forEach(e=>{var n=null==oi?void 0:oi.querySelectorAll(e);null==n||n.forEach(n=>{t!==n&&i!==n||s(r,e)||r.push(e)})}),r}get isEnabled(){var t,i;if(this.Dt)return!1;var e=null==(t=this.Ot)?void 0:t.kv.get(ae),r=this.$t,s=this.Rt();if(!s.remoteRequestsDisabled&&!this.jt)return!1;var n=s.remoteRequestsDisabled&&!this.jt;if(g(r)&&!m(e)&&!n)return!1;var a=null!==(i=this.$t)&&void 0!==i?i:!!e;return!!s.enabled&&!a}Wt(t,i,r){if(void 0===i&&(i="$autocapture"),this.isEnabled){var s=r||Oi(t);xi(s)&&(s=s.parentNode||null);var n,a=this.Bt();"$autocapture"===i&&"click"===t.type&&t instanceof MouseEvent&&a.rageclick&&null!=(n=this.rageclicks)&&n.isRageClick(t.clientX,t.clientY,t.timeStamp||(new Date).getTime())&&Hi(s,a.rageclick)&&this.Wt(t,"$rageclick",r);var o=i===Ze,l=o?e({},a,{dom_event_allowlist:void 0}):a;if(s&&function(t,i,e,r,s,n){var a;if(!si||Ui(t))return!1;if(null!=e&&e.url_allowlist&&!Ci(e.url_allowlist,n))return!1;if(null!=e&&e.url_ignorelist&&Ci(e.url_ignorelist,n))return!1;if(null!=e&&e.dom_event_allowlist){var o=e.dom_event_allowlist;if(o&&!o.some(t=>i.type===t))return!1}var l=Vi(t,r),u=l.parentIsUsefulElement,h=l.targetElementList;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}(h,e))return!1;if(!$i(h,null==e?void 0:e.css_selector_allowlist))return!1;if($i(h,null!==(a=null==e?void 0:e.css_selector_ignorelist)&&void 0!==a?a:Li))return!1;try{var v=si.getComputedStyle(t);if(v&&"pointer"===v.getPropertyValue("cursor")&&"click"===i.type)return!0}catch(t){}var d=t.tagName.toLowerCase();switch(d){case"html":return!1;case"form":return(s||["submit"]).indexOf(i.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(i.type)>=0;default:return u?(s||["click"]).indexOf(i.type)>=0:(s||["click"]).indexOf(i.type)>=0&&(Mi.indexOf(d)>-1||"true"===t.getAttribute("contenteditable"))}}(s,t,l,o,o?["copy","cut","paste"]:void 0,{config:{get_current_url:a.getCurrentUrl}})){var u,h=ir(s,{e:t,maskAllElementAttributes:a.maskAllElementAttributes,maskAllText:a.maskAllText,elementAttributeIgnoreList:a.element_attribute_ignorelist,elementsChainAsString:this.Lt,disableCaptureUrlHashes:a.disableCaptureUrlHashes}),v=h.props;if(h.explicitNoCapture)return!1;var d=this.getElementSelectors(s,h.target);if(d&&d.length>0&&(v.$element_selectors=d),i===Ze){var f=t.type||"clipboard";if("paste"!==f){var p,g,_=null==si||null==(p=si.getSelection())?void 0:p.toString(),b=Ri(_);if(!b)return!1;v.$selected_content=b,v.$clipboard_text_length=null!==(g=null==_?void 0:_.length)&&void 0!==g?g:0}v.$copy_type=f}return null==(u=this.Ot)||u.capture(i,v).catch(t=>Qe.error("Failed to capture event",t)),!0}}else this.Ft()}isBrowserSupported(){return h(null==oi?void 0:oi.querySelectorAll)}}class rr{constructor(t){this._instance=t}refresh(t){var i=this._instance.config,e=v(i.autocapture)?i.autocapture:void 0;t.enabled=!!i.autocapture,t.rageclick=i.rageclick,t.maskAllElementAttributes=i.mask_all_element_attributes,t.maskAllText=i.mask_all_text,t.disableCaptureUrlHashes=i.disable_capture_url_hashes,t.getCurrentUrl=i.get_current_url,t.remoteRequestsDisabled=this._instance._shouldDisableFlags(),t.url_allowlist=null==e?void 0:e.url_allowlist,t.url_ignorelist=null==e?void 0:e.url_ignorelist,t.dom_event_allowlist=null==e?void 0:e.dom_event_allowlist,t.element_allowlist=null==e?void 0:e.element_allowlist,t.css_selector_allowlist=null==e?void 0:e.css_selector_allowlist,t.css_selector_ignorelist=null==e?void 0:e.css_selector_ignorelist,t.element_attribute_ignorelist=null==e?void 0:e.element_attribute_ignorelist,t.capture_copied_text=null==e?void 0:e.capture_copied_text}}var sr="undefined"!=typeof globalThis?globalThis:si;sr&&"undefined"==typeof self&&(sr.self=sr),sr&&"undefined"==typeof File&&(sr.File=function(){});var nr=null!=si?si:{},ar=di("[Dead Clicks]"),or=()=>!0;class lr{get lazyLoadedDeadClicksAutocapture(){return this.Jt}constructor(t,i,e){this.instance=t,this.isEnabled=i,this.onCapture=e,this.startIfEnabledOrStop()}onRemoteConfig(t){if(t.ok){var i=t.config;"captureDeadClicks"in i&&(this.instance.persistence&&this.instance.persistence.register({[de]:i.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.Gt(()=>{this.Xt()}):this.stop()}Gt(t){var i,e;null!=(i=nr.__PosthogExtensions__)&&i.initDeadClicksAutocapture?t():null==(e=nr.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this.instance,"dead-clicks-autocapture",i=>{i?ar.error("failed to load script",i):t()})}Xt(){var t;if(oi){if(!this.Jt&&null!=(t=nr.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var i=v(this.instance.config.capture_dead_clicks)?e({},this.instance.config.capture_dead_clicks):{};i.__onCapture=this.onCapture,this.onCapture&&(i.capture_dead_swipes=!1),this.Jt=nr.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,i),this.Jt.start(oi),ar.info("starting...")}}else ar.error("`document` not found. Cannot start.")}stop(){this.Jt&&(this.Jt.stop(),this.Jt=void 0,ar.info("stopping..."))}}var ur=di("[ExceptionAutocapture]"),hr=()=>{},vr=t=>{var i;if(h(t))return null!==(i=t.__posthog_layer__)&&void 0!==i?i:t.__rrweb_layer__};function dr(t,i,e){try{if(!(i in t))return hr;var r={next:t[i]},s=e(function(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];return r.next.apply(this,i)});return h(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:r}})),t[i]=s,()=>{if(t[i]!==s)for(var e=t[i],n=vr(e);n;){if(n.next===s)return void(n.next=r.next);n=vr(e=n.next)}else t[i]=r.next}}catch(t){return hr}}var cr=di("[TracingHeaders]"),fr=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],pr=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...fr],gr="<masked>",_r=["li_fat_id"];function br(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}var mr=di("[Web Vitals]"),yr=9e5,wr=["CLS","FCP","INP","LCP"],Sr=["INP","LCP"],kr=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],xr=di("[RemoteConfig]");class Er{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=nr._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}Zt(t){var i,e;null!=(i=nr.__PosthogExtensions__)&&i.loadExternalDependency?null==(e=nr.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"remote-config",()=>t(this.remoteConfig)):t()}Qt(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t})}load(){try{if(this.remoteConfig)return xr.info("Using preloaded remote config",this.remoteConfig),void this.Yt(this.remoteConfig);if(this._instance._shouldDisableFlags())return void xr.warn("Remote config is disabled. Falling back to local config.");this.Zt(t=>{if(!t)return xr.info("No config found after loading remote JS config. Falling back to JSON."),void this.Qt(t=>{this.Yt(t.json,t)});this.Yt(t)})}catch(t){xr.error("Error loading remote config",t),this.Yt()}}Yt(t,i){!t&&i&&(0===i.statusCode?i.error||xr.warn("Failed to fetch remote config from PostHog."):xr.error("Failed to fetch remote config from PostHog."));try{this._instance.Yt(t?{ok:!0,config:t}:{ok:!1})}catch(t){xr.error("Error applying remote config",t)}if(!1!==(null==t?void 0:t.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var e;null==(e=this._instance.featureFlags)||e.ensureFlagsLoaded()}catch(t){xr.error("Error loading feature flags",t)}}}var Fr="disabled",Pr="lazy_loading",Cr="awaiting_config",Tr="missing_config",Rr="[SessionRecording]",Ar=di(Rr),Or=di("[Heatmaps]");function Mr(t){return v(t)&&"clientX"in t&&"clientY"in t&&b(t.clientX)&&b(t.clientY)}var Ir=di("[Product Tours]"),$r=t=>{var i;return!t.config.disable_product_tours&&!(null==(i=t.persistence)||!i.get_property(ce))},jr=["$set_once","$set"],Lr=di("[SiteApps]"),Dr="Error while initializing PostHog app with config id ",Nr=(t,i)=>null!=t&&t.then?t.then(i):i(t),zr="events",Br="cancelEvents",Hr="survey shown";function Ur(t){var i;return!(null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)||!i.length)}var Vr=(t,i)=>{if(!(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}},qr=t=>t.toLowerCase(),Wr={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=>Vr(i,t))),not_regex:(t,i)=>i.every(i=>t.every(t=>!Vr(i,t))),icontains:(t,i)=>i.map(qr).some(i=>t.map(qr).some(t=>i.includes(t))),not_icontains:(t,i)=>i.map(qr).every(i=>t.map(qr).every(t=>!i.includes(t))),gt:(t,i)=>i.some(i=>{var e=parseFloat(i);return!isNaN(e)&&t.some(t=>e>parseFloat(t))}),lt:(t,i)=>i.some(i=>{var e=parseFloat(i);return!isNaN(e)&&t.some(t=>e<parseFloat(t))})};function Kr(t,i){return!t||Object.entries(t).every(t=>{var e=t[1],r=null==i?void 0:i[t[0]];if(null==r)return!1;var s=Wr[e.operator];return!!s&&s(e.values,[String(r)])})}var Jr=di("[Surveys]"),Gr="seenSurvey_",Xr=["popover","widget","api"],Zr="SDK is not enabled or survey functionality is not yet loaded",Qr="Disabled. Not loading surveys.";class Yr{constructor(t,i){this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.ti=!1,this.ii=[],this.ei=null,this.ri=null,this.Dt=!1,this.si=new Set,this.onRemoteConfig=t=>{if(!this.Dt&&!this.P.disableSurveys){if(!t.ok)return Jr.warn("Remote config unavailable. Not loading surveys.");var i=t.config.surveys;if(_(i))return Jr.warn("Flags not loaded yet. Not loading surveys.");this.ni=m(i)?i:i.length>0,Jr.info("flags response received, isSurveysEnabled: "+this.ni),this.loadIfEnabled()}},this.Nt=t,this.ai=i}setup(t){if(!this.Dt)return this.oi=t,Nr(t.kv.initialize(),()=>{if(this.oi===t&&!this.Dt){this.oi=void 0,this.Ot=t;var i=t.onRemoteConfig(this.onRemoteConfig);this.Dt?i.dispose():(this.Ht=i,this.loadIfEnabled())}})}dispose(){var t,i,e;this.Dt||(this.Dt=!0,this.oi=void 0,this.Ot=void 0,null==(t=this.Ht)||t.dispose(),this.Ht=void 0,null==(i=this._surveyEventReceiver)||i.dispose(),this._surveyEventReceiver=null,null==(e=this._surveyManager)||null==e.dispose||e.dispose(),this._surveyManager=null,this.ii=[],this.ei=null,this.si.forEach(t=>clearTimeout(t)),this.si.clear())}get P(){return this.Nt.get()}initialize(){this.loadIfEnabled()}reset(){try{var t;null==(t=this._surveyEventReceiver)||t.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var i=[],e=0;e<localStorage.length;e++){var r=localStorage.key(e);(null!=r&&r.startsWith(Gr)||null!=r&&r.startsWith("inProgressSurvey_"))&&i.push(r)}i.forEach(t=>localStorage.removeItem(t))}catch(t){}}loadIfEnabled(){if(!this.Dt&&this.Ot){var t=this.P;if(!this._surveyManager)if(this.ti)Jr.info("Already initializing surveys, skipping...");else if(t.disableSurveys)Jr.info(Qr);else if(t.cookielessMode&&this.Nt.isOptedOut())Jr.info("Not loading surveys in cookieless mode without consent.");else{var i=this.Nt.getExtensions();if(i){if(!c(this.ni)||t.advancedEnableSurveys){var e=this.ni||t.advancedEnableSurveys;this.ti=!0;try{var r=i.generateSurveys;if(r)return this.li(r,e),void(this.ti=!1);var s=i.loadExternalDependency;if(!s)return this.ui(Ue),void(this.ti=!1);s(t=>{try{if(this.Dt)return;var i=this.Nt.getExtensions();t||null==i||!i.generateSurveys?this.ui("Could not load surveys script",t):this.li(i.generateSurveys,e)}finally{this.ti=!1}})}catch(t){throw this.ti=!1,this.ui("Error initializing surveys",t),t}}}else Jr.error("PostHog Extensions not found.")}}}li(t,i){this.Dt||(this._surveyManager=t(i),this._surveyEventReceiver=this.Nt.createEventReceiver(),Jr.info("Surveys loaded successfully"),this.hi({isLoaded:!0}))}ui(t,i){Jr.error(t,i),this.hi({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.ii.push(t),this._surveyManager&&this.hi({isLoaded:!0}),()=>{this.ii=this.ii.filter(i=>i!==t)}}getSurveys(t,i){var e;void 0===i&&(i=!1);var r=null!==(e=this.Ot)&&void 0!==e?e:this.ai;if(r&&!this.Dt){if(this.P.disableSurveys)return Jr.info(Qr),t([]);var s=r.kv.get(Re);if(s&&!i)return t(s,{isLoaded:!0}),void(this.di()&&this.getSurveys(()=>{},!0));if(this.ei)this.ei.then(i=>{this.Dt||t(i.surveys,i.context)}).catch(t=>Jr.error("Error in survey callback",t));else{var n=this.ci("/api/surveys/",{method:"GET",query:{token:r.projectToken},sentAt:"query",timeoutMs:this.P.requestTimeoutMs}).then(t=>{try{return this.fi(r,t)}catch(t){return Jr.error("Error processing surveys response",t),this.fi(r,{statusCode:0,error:t})}},t=>this.fi(r,{statusCode:0,error:t}));this.ei=n;var a=()=>{this.ei===n&&(this.ei=null)};n.then(i=>{a(),this.Dt||t(i.surveys,i.context)},a).catch(t=>Jr.error("Error in survey callback",t))}}}ci(t,i){var e=this.Ot;return e?e.sendRequest(t,i):new Promise(t=>t({statusCode:0,error:new Error(Zr)}))}fi(t,i){if(this.Dt)return{surveys:[],context:{isLoaded:!1,error:Zr}};var e=i.statusCode;if(200!==e||!i.json){var r="Surveys API could not be loaded, status: "+e;return 0!==e?Jr.error(r):i.error||Jr.warn(r),this.ri=Date.now(),{surveys:[],context:{isLoaded:!1,error:r}}}this.ri=null;var s,n=i.json.surveys||[],a=n.filter(t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(Ur(t)||function(t){var i;return!(null==(i=t.conditions)||null==(i=i.actions)||null==(i=i.values)||!i.length)}(t)));return a.length>0&&(null==(s=this._surveyEventReceiver)||s.register(a)),t.kv.set({[Re]:n,[Ae]:Date.now()}),{surveys:n,context:{isLoaded:!0}}}di(){return this.pi()&&!this.ei&&!this.gi()}pi(){var t,i,e=null==(t=null!==(i=this.Ot)&&void 0!==i?i:this.ai)?void 0:t.kv.get(Ae);return b(e)&&Date.now()-e>Be}gi(){return b(this.ri)&&Date.now()-this.ri<He}markSurveyAsSeen(t,i){var e;(t=>{try{var i=(t=>((t,i)=>""+Gr+function(t){return t.current_iteration&&t.current_iteration>0?t.id+"_"+t.current_iteration:t.id}(i))(0,t))(t);if(localStorage.getItem(i))return;localStorage.setItem(i,"true")}catch(t){Jr.error("Failed to persist survey seen state",t)}})({id:t,current_iteration:null!==(e=null==i?void 0:i.iteration)&&void 0!==e?e:null});try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}}hi(t){for(var i of this.ii)try{if(!t.isLoaded)return i([],t);this.getSurveys(i)}catch(t){Jr.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,i){if(void 0===i&&(i=!1),!_(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,i);Jr.warn("init was not called")}bi(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}mi(t){if(_(this._surveyManager))return{eligible:!1,reason:Zr};var i="string"==typeof t?this.bi(t):t;return i?this._surveyManager.checkSurveyEligibility(i):{eligible:!1,reason:"Survey not found"}}yi(t){if(!this.Nt.isCapturing())return{eligible:!1,reason:"PostHog is not capturing, so a survey response cannot be recorded"};if(_(this._surveyManager))return{eligible:!1,reason:Zr};var i="string"==typeof t?this.bi(t):t;return i?this._surveyManager.checkSurveyRenderability(i):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(_(this._surveyManager))return Jr.warn("init was not called"),{visible:!1,disabledReason:Zr};var i=this.yi(t);return{visible:i.eligible,disabledReason:i.reason}}canRenderSurveyAsync(t,i){return _(this._surveyManager)?(Jr.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Zr})):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.yi(s);e({visible:n.eligible,disabledReason:n.reason})}else e({visible:!1,disabledReason:"Survey not found"})},i)})}renderSurvey(t,i,e){var r;if(this.Nt.isCapturing())if(_(this._surveyManager))Jr.warn("init was not called");else{var s="string"==typeof t?this.bi(t):t;if(null!=s&&s.id)if(Xr.includes(s.type)){var n=null==oi?void 0:oi.querySelector(i);if(n)if(null!=(r=s.appearance)&&r.surveyPopupDelaySeconds){Jr.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds");var a=setTimeout(()=>{var t,i;this.si.delete(a),!this.Dt&&this.Nt.isCapturing()&&(Jr.info("Rendering survey "+s.id+" with delay of "+(null==(t=s.appearance)?void 0:t.surveyPopupDelaySeconds)+" seconds"),null==(i=this._surveyManager)||i.renderSurvey(s,n,e),Jr.info("Survey "+s.id+" rendered"))},1e3*s.appearance.surveyPopupDelaySeconds);this.si.add(a)}else this._surveyManager.renderSurvey(s,n,e);else Jr.warn("Survey element not found")}else Jr.warn("Surveys of type "+s.type+" cannot be rendered in the app");else Jr.warn("Survey not found")}}displaySurvey(t,i){var r;if(this.Nt.isCapturing())if(_(this._surveyManager))Jr.warn("init was not called");else{var s=this.bi(t);if(s){var n=s;if(null!=(r=s.appearance)&&r.surveyPopupDelaySeconds&&i.ignoreDelay&&(n=e({},s,{appearance:e({},s.appearance,{surveyPopupDelaySeconds:0})})),"popover"!==i.displayType&&i.initialResponses&&Jr.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===i.ignoreConditions){var a=this.mi(s);if(!a.eligible)return void Jr.warn("Survey is not eligible to be displayed: ",a.reason)}"inline"!==i.displayType?this._surveyManager.handlePopoverSurvey(n,i):this.renderSurvey(n,i.selector,i.properties)}else Jr.warn("Survey not found")}}cancelPendingSurvey(t){_(this._surveyManager)?Jr.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||null==t.handlePageUnload||t.handlePageUnload()}}ri.DEBUG=!1,ri.LIB_VERSION="1.429.1",ri.LIB_NAME="web";class ts{on(t,i){return this.wi[t]||(this.wi[t]=[]),this.wi[t].push(i),()=>{this.wi[t]=this.wi[t].filter(t=>t!==i)}}emit(t,i){for(var e of this.wi[t]||[])e(i);for(var r of this.wi["*"]||[])r(t,i)}constructor(){this.wi={}}}function is(t,i,e){if(_(t))return!1;switch(e){case"exact":return t===i;case"contains":var r=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(t);case"regex":try{return new RegExp(i).test(t)}catch(t){return!1}default:return!1}}class es{constructor(t){this.Si=new Set,this.ki=new Set,this.xi=new ts,this.Ei=(t,i)=>this.Fi(t,i)&&this.Pi(t,i)&&this.Ci(t,i)&&this.Ti(t,i),this.Fi=(t,i)=>null==i||!i.event||(null==t?void 0:t.event)===(null==i?void 0:i.event),this._instance=t}init(){var t,i;c(null==(t=this._instance)?void 0:t._addCaptureHook)||(this.Ri=null==(i=this._instance)?void 0:i._addCaptureHook((t,i)=>{this.on(t,i)}))}dispose(){var t;null==(t=this.Ri)||t.call(this),this.Ri=void 0,this.xi=new ts}register(t){var i,e;if(!c(null==(i=this._instance)?void 0:i._addCaptureHook)&&(t.forEach(t=>{var i;this.Si.add(t),null==(i=t.steps)||i.forEach(t=>{this.ki.add((null==t?void 0:t.event)||"")})}),null!=(e=this._instance)&&e.autocapture)){var r=new Set;this.Si.forEach(t=>{var i;null==(i=t.steps)||i.forEach(t=>{null!=t&&t.selector&&r.add(t.selector)})}),this._instance.autocapture.setElementSelectors(r)}}replace(t){this.Si.clear(),this.ki.clear(),this.register(t)}on(t,i){null!=i&&0!=t.length&&(this.ki.has(t)||this.ki.has(i.event))&&this.Si.forEach(t=>{this.Ai(i,t)&&this.xi.emit("actionCaptured",t.name)})}Oi(t){this.onAction("actionCaptured",i=>t(i))}Ai(t,i){if(null==(null==i?void 0:i.steps))return!1;for(var e of i.steps)if(this.Ei(t,e))return!0;return!1}onAction(t,i){return this.xi.on(t,i)}Pi(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(!is(r,i.url,i.url_matching||"contains"))return!1}return!0}Ci(t,i){return!!this.Mi(t,i)&&!!this.Ii(t,i)&&!!this.$i(t,i)}Mi(t,i){var e;if(null==i||!i.href)return!0;var r=this.ji(t);if(r.length>0)return r.some(t=>is(t.href,i.href,i.href_matching||"exact"));var s,n=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!n&&is((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",i.href,i.href_matching||"exact")}Ii(t,i){var e;if(null==i||!i.text)return!0;var r=this.ji(t);if(r.length>0)return r.some(t=>is(t.text,i.text,i.text_matching||"exact")||is(t.$el_text,i.text,i.text_matching||"exact"));var s,n,a,o=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!o&&(s=function(t){for(var i,e=[],r=/(?::|")text="(.*?)"/g;!_(i=r.exec(t));)e.includes(i[1])||e.push(i[1]);return e}(o),n=i.text,a=i.text_matching||"exact",s.some(t=>is(t,n,a)))}$i(t,i){var e,r;if(null==i||!i.selector)return!0;var s=null==t||null==(e=t.properties)?void 0:e.$element_selectors;if(null!=s&&s.includes(i.selector))return!0;var n=(null==t||null==(r=t.properties)?void 0:r.$elements_chain)||"";if(i.selector_regex&&n)try{return new RegExp(i.selector_regex).test(n)}catch(t){return!1}return!1}ji(t){var i;return null==(null==t||null==(i=t.properties)?void 0:i.$elements)?[]:null==t?void 0:t.properties.$elements}Ti(t,i){return null==i||!i.properties||0===i.properties.length||Kr(i.properties.reduce((t,i)=>{var e=u(i.value)?i.value.map(String):null!=i.value?[String(i.value)]:[];return t[i.key]={values:e,operator:i.operator||"exact"},t},{}),null==t?void 0:t.properties)}}class rs{constructor(t){var i;this.Li=[],this._instance=t,this.Di=new Map,this.Ni=new Map,this.zi=new Map,this.Bi=null==(i=this._instance)||null==i.onSessionId?void 0:i.onSessionId(t=>this.Hi(t))}Ui(t){return!1}Vi(){return null}qi(t){}Wi(){}Ki(t,i){return!!t&&Kr(t.propertyFilters,null==i?void 0:i.properties)}Ji(t,i){var e=new Map;return t.forEach(t=>{var r;null==(r=t.conditions)||null==(r=r[i])||null==(r=r.values)||r.forEach(i=>{if(null!=i&&i.name){var r=e.get(i.name)||[];r.push(t.id),e.set(i.name,r)}})}),e}Gi(t,i,e){var r=(e===zr?this.Di:this.Ni).get(t),s=[];return this.Xi(t=>{s=t.filter(t=>null==r?void 0:r.includes(t.id))}),s.filter(r=>{var s,n=null==(s=r.conditions)||null==(s=s[e])||null==(s=s.values)?void 0:s.find(i=>i.name===t);return this.Ki(n,i)})}register(t){this.Zi(t,!1)}replace(t){this.Zi(t,!0)}Zi(t,i){var e;c(null==(e=this._instance)?void 0:e._addCaptureHook)||(this.Qi(t,i),this.Yi(t,i))}Yi(t,i){var e=t.filter(t=>{var i;return null==(i=t.conditions)||null==(i=i.actions)||null==(i=i.values)?void 0:i.length});if(i&&this.zi.clear(),0!==e.length){this.te||(this.te=new es(this._instance),this.te.init(),this.te.Oi(t=>this.onAction(t)));var r=[];e.forEach(t=>{var i;null==(i=t.conditions)||null==(i=i.actions)||i.values.forEach(i=>{if(r.push(i),i.name){var e,s=null!==(e=this.zi.get(i.name))&&void 0!==e?e:[];s.includes(t.id)||s.push(t.id),this.zi.set(i.name,s)}})}),i?this.te.replace(r):this.te.register(r)}else{var s;i&&(null==(s=this.te)||s.replace([]))}}ie(t,i){i.forEach((i,e)=>{var r,s=null!==(r=t.get(e))&&void 0!==r?r:[];i.forEach(t=>{s.includes(t)||s.push(t)}),t.set(e,s)})}Qi(t,i){var e,r,s=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}),n=t.filter(t=>{var i,e;return(null==(i=t.conditions)?void 0:i.cancelEvents)&&(null==(e=t.conditions)||null==(e=e.cancelEvents)||null==(e=e.values)?void 0:e.length)>0}),a=this.Ji(t,zr),o=this.Ji(t,Br);i?(this.Di=a,this.Ni=o):(this.ie(this.Di,a),this.ie(this.Ni,o)),(0!==s.length||0!==n.length)&&(null!==(e=this.Ri)&&void 0!==e||(this.Ri=null==(r=this._instance)?void 0:r._addCaptureHook((t,i)=>{this.onEvent(t,i)})))}onEvent(t,i){var e,r,s=this.ee(),n=(null==i||null==(e=i.properties)?void 0:e.$survey_id)||(null==i||null==(r=i.properties)?void 0:r.$product_tour_id);if(n&&this.getActivatedIds().includes(n)){var a=this.re(t,n);if("consume"===a)return s.info("event consumed activated item, removing it",{event:t,itemId:n}),void this.se([n]);if("persist"===a)return s.info("shown item promoted to persisted activation",{event:t,itemId:n}),this.ne(n),void this.ae([n])}if(this.Ni.has(t)){var o=this.Gi(t,i,Br);o.length>0&&(s.info("cancel event matched, cancelling items",{event:t,itemsToCancel:o.map(t=>t.id)}),this.se(o.map(t=>t.id)),o.forEach(t=>this.oe(t.id)))}if(this.Di.has(t)){s.info("event name matched",{event:t,eventPayload:i,items:this.Di.get(t)});var l=this.Gi(t,i,zr);this.le(l.map(t=>t.id))}}onAction(t){this.zi.has(t)&&this.le(this.zi.get(t)||[])}le(t){var i;if(0!==t.length){var e=!(null==(i=this._instance)||null==i.get_session_id||!i.get_session_id()),r=[];for(var s of t)e&&this.Ui(s)?this.ne(s)&&this.ue(s):r.push(s);r.length>0&&(this.Li=[...new Set([...this.Li,...r])]),this.ee().info("updating activated items",{activatedItems:this.getActivatedIds()})}}ne(t){this.Li=this.Li.filter(i=>i!==t);var i=this.he();return!i.includes(t)&&(this.ve([...i,t]),this.de(),!0)}se(t){var i=new Set(t);this.Li=this.Li.filter(t=>!i.has(t));var e=this.ce(),r=e.filter(t=>!i.has(t));r.length!==e.length&&(this.ve(r),0===r.length&&this.fe()),this.ae(t)}pe(){var t,i=this.Vi();if(!i)return{};var e=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i];return e&&"object"==typeof e?e:{}}ue(t){if(this.Vi()){var i=this.pe();this.qi(e({},i,{[t]:Date.now()}))}}ae(t){if(this.Vi()){var i=this.pe(),e={},r=!1;for(var s of Object.entries(i)){var n=s[0],a=s[1];t.includes(n)?r=!0:e[n]=a}r&&(d(e)?this.Wi():this.qi(e))}}ge(){this.Vi()&&this.Wi()}getActivationTimestamp(t){if(this.he().includes(t)){var i=this.pe()[t];return b(i)?i:void 0}}ce(){var t,i=this._e();return(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i])||[]}he(){var t,i,e=this.ce();if(0===e.length)return[];var r=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[this.be()],s=null==(i=this._instance)||null==i.get_session_id?void 0:i.get_session_id();return s&&r===s?e:[]}de(){var t,i=null==(t=this._instance)||null==t.get_session_id?void 0:t.get_session_id();i&&this.me(i)}fe(){this.ye()}Hi(t){var i,e=null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[this.be()];if(e&&e!==t){var r=this.ce(),s=this.pe();r.length>0&&(this.ve([]),r.filter(t=>b(s[t])).forEach(t=>this.oe(t))),this.fe(),this.ge()}}getActivatedIds(){return[...new Set([...this.he(),...this.Li])].filter(t=>!this.we(t))}dispose(){var t,i,e;null==(t=this.Bi)||t.call(this),this.Bi=void 0,null==(i=this.Ri)||i.call(this),this.Ri=void 0,null==(e=this.te)||e.dispose(),this.te=void 0}reset(){this.Li=[],this.ce().length>0&&this.ve([]),this.fe(),this.ge()}getEventToItemsMap(){return this.Di}Se(){return this.te}}class ss extends rs{constructor(t){super(t)}_e(){return Oe}be(){return Me}Vi(){return Ie}qi(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[Ie]:t})}Wi(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(Ie)}Ui(t){var i,e;this.Xi(i=>{e=i.find(i=>i.id===t)});var r=null==(i=e)||null==(i=i.appearance)?void 0:i.surveyPopupDelaySeconds;return b(r)&&r>0}ke(){return Hr}Xi(t){var i;null==(i=this._instance)||i.getSurveys(t)}oe(t){var i;null==(i=this._instance)||i.cancelPendingSurvey(t)}ee(){return Jr}ve(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[Oe]:t})}me(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[Me]:t})}ye(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(Me)}we(){return!1}re(t,i){var e;this.Xi(t=>{e=t.find(t=>t.id===i)});var r=!e||function(t){var i;return Ur(t)&&!(null==(i=t.conditions)||null==(i=i.events)||!i.repeatedActivation)||"always"===t.schedule}(e);return r?t===Hr?"consume":"ignore":t===Hr?"persist":"survey dismissed"===t||"survey sent"===t?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}class ns{constructor(t){this._instance=t}initialize(){}get(t){if("string"==typeof t)return this._instance.get_property(t);var i={};for(var e of t){var r=this._instance.get_property(e);c(r)||(i[e]=r)}return i}set(t,i){this._instance.register("string"==typeof t?{[t]:i}:t)}remove(t){"string"!=typeof t?t.forEach(t=>this._instance.unregister(t)):this._instance.unregister(t)}}class as{constructor(t){this._instance=t}get(){var t=this._instance.config;return{disableSurveys:t.disable_surveys,cookielessMode:!!t.cookieless_mode,advancedEnableSurveys:t.advanced_enable_surveys,requestTimeoutMs:t.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}isCapturing(){return this._instance.is_capturing()}getExtensions(){var t=null==nr?void 0:nr.__PosthogExtensions__;if(t){var i=t.generateSurveys,e=t.loadExternalDependency;return{generateSurveys:i?t=>i(this._instance,t):void 0,loadExternalDependency:e?t=>e(this._instance,"surveys",t):void 0}}}createEventReceiver(){return new ss(this._instance)}}var os=null!=si&&si.location?Je(si.location.hash,"__posthog")||Je(location.hash,"state"):null,ls="_postHogToolbarParams",us=di("[Toolbar]"),hs=di("[FeatureFlags]");class vs{constructor(t,i){void 0===i&&(i=!1),this.xe=!1,this.update(t,i)}update(t,i){this.Ee=((t,i)=>{var e,r,s,n,a;return{bootstrap:{featureFlags:null==(e=t.bootstrap)?void 0:e.featureFlags,featureFlagPayloads:null==(r=t.bootstrap)?void 0:r.featureFlagPayloads},remoteRequestsDisabled:i,featureFlagsDisabled:!!t.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!t.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!t.advanced_feature_flags_dedup_per_session,cacheTtlMs:t.feature_flag_cache_ttl_ms,refreshIntervalMs:null!==(s=t.remote_config_refresh_interval_ms)&&void 0!==s?s:3e5,requestTimeoutMs:t.feature_flag_request_timeout_ms,compression:t.disable_compression?void 0:"best-available",evaluationContexts:null!==(n=null!==(a=t.evaluation_contexts)&&void 0!==a?a:t.evaluation_environments)&&void 0!==n?n:[],flagKeys:u(t.flag_keys)?t.flag_keys:void 0}})(t,i),!t.evaluation_environments||t.evaluation_contexts||this.xe||(hs.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.xe=!0),c(t.flag_keys)||u(t.flag_keys)||hs.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.Ee}}var ds=di("[FeatureFlags]"),cs=di("[FeatureFlags]",{debugEnabled:!0}),fs="\" failed. Feature flags didn't load in time.",ps="connection_error",gs=t=>{for(var i={},e=0;t.length>e;e++)i[t[e]]=!0;return i},_s=t=>{var i={};for(var e of pi(t||{})){var r=e[1];r&&(i[e[0]]=r)}return i},bs=t=>S(t)&&("RangeError"===t.name&&0===t.message.indexOf("Maximum call stack size exceeded")||"InternalError"===t.name&&"too much recursion"===t.message),ms=di("[Error tracking]"),ys="webkit-masked-url:",ws=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],Ss=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",ys],ks=["__firefox__","__gCrWeb"],xs="Refusing to render web experiment since the viewer is a likely bot",Es={icontains:(t,i)=>i.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,i)=>-1===i.toLowerCase().indexOf(t.toLowerCase()),regex:(t,i)=>Vr(i,t),not_regex:(t,i)=>!Vr(i,t),exact:(t,i)=>i===t,is_not:(t,i)=>i!==t};class Fs{get P(){return this._instance.config}constructor(t){var i=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),i.getWebExperiments(t=>{Fs.Fe("retrieved web experiments from the server"),i.Pe=new Map,t.forEach(t=>{if(t.feature_flag_key){var e;i.Pe&&(Fs.Fe("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(e=i.Pe)||e.set(t.feature_flag_key,t));var r=i._instance.getFeatureFlag(t.feature_flag_key);f(r)&&t.variants[r]&&i.Ce(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var n=t.variants[s];Fs.Te(n,i._instance)&&i.Ce(t.name,s,n.transforms)}})},t)},this._instance=t,this._instance.onFeatureFlags(t=>{this.onFeatureFlags(t)})}initialize(){}onFeatureFlags(t){if(this._is_bot())Fs.Fe(xs);else if(!this.P.disable_web_experiments){if(_(this.Pe))return this.Pe=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Fs.Fe("applying feature flags",t),t.forEach(t=>{var i;if(this.Pe&&null!=(i=this.Pe)&&i.has(t)){var e,r=this._instance.getFeatureFlag(t),s=null==(e=this.Pe)?void 0:e.get(t);r&&null!=s&&s.variants[r]&&this.Ce(s.name,r,s.variants[r].transforms)}})}}previewWebExperiment(){var t=Fs.getWindowLocation();if(null!=t&&t.search){var i=We(null==t?void 0:t.search,"__experiment_id"),e=We(null==t?void 0:t.search,"__experiment_variant");i&&e&&(Fs.Fe("previewing web experiments "+i+" && "+e),this.getWebExperiments(t=>{this.Re(parseInt(i),e,t)},!1,!0))}}loadIfEnabled(){this.P.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,i,e){if(this.P.disable_web_experiments&&!e)return t([]);var r=this._instance.get_property("$web_experiments");if(r&&!i)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.P.token),method:"GET",timestampMode:"query",callback:i=>t(200===i.statusCode&&i.json&&i.json.experiments||[])})}Re(t,i,e){var r=e.filter(i=>i.id===t);r&&r.length>0&&(Fs.Fe("Previewing web experiment ["+r[0].name+"] with variant ["+i+"]"),this.Ce(r[0].name,i,r[0].variants[i].transforms))}static Te(t,i){return!_(t.conditions)&&Fs.Ae(t,i)&&Fs.Oe(t)}static Ae(t,i){var e;if(_(t.conditions)||_(null==(e=t.conditions)?void 0:e.url))return!0;var r=Fs.getWindowLocation();if(r){var s,n,a,o=mi(i,r.href);return null==(s=t.conditions)||!s.url||Es[null!==(n=null==(a=t.conditions)?void 0:a.urlMatchType)&&void 0!==n?n:"icontains"](t.conditions.url,o)}return!1}static getWindowLocation(){return null==si?void 0:si.location}static Oe(t){var i;if(_(t.conditions)||_(null==(i=t.conditions)?void 0:i.utm))return!0;var e=function(){if(!oi)return{};var t,i,e,r=(t=Ke(oi.URL,[],gr),i=pr.concat([]),e={},ci(i,function(i){var r=We(t,i);e[i]=r||null}),e),s=function(){var t={};return ci(_r,function(i){var e=(t=>{if(oi){try{for(var i=t+"=",e=oi.cookie.split(";").filter(t=>t.length),r=0;e.length>r;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}})(i);t[i]=e||null}),t}();return fi(s,r)}();if(e.utm_source){var r,s,n,a,o,l,u,h,v=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,d=null==(n=t.conditions)||null==(n=n.utm)||!n.utm_source||(null==(a=t.conditions)||null==(a=a.utm)?void 0:a.utm_source)==e.utm_source,c=null==(o=t.conditions)||null==(o=o.utm)||!o.utm_medium||(null==(l=t.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==e.utm_medium,f=null==(u=t.conditions)||null==(u=u.utm)||!u.utm_term||(null==(h=t.conditions)||null==(h=h.utm)?void 0:h.utm_term)==e.utm_term;return v&&c&&f&&d}return!1}static Fe(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;i>r;r++)e[r-1]=arguments[r];vi.info("[WebExperiments] "+t,e)}Ce(t,i,e){this._is_bot()?Fs.Fe(xs):"control"!==i?e.forEach(e=>{if(e.selector){var r;Fs.Fe("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)})}}):Fs.Fe("Control variants leave the page unmodified.")}_is_bot(){return ai&&this._instance?function(t,i){if(!t)return!1;var e=t.userAgent;if(e&&F(e,i))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some(t=>F(null==t?void 0:t.brand,i)))return!0}catch(t){}return!!t.webdriver}(ai,this.P.custom_blocked_useragents):void 0}}var Ps=di("[Conversations]"),Cs="Conversations not available yet.";function Ts(){var t="",i="";try{var r=null==ai?void 0:ai.userAgent;if(r){var s=function(t){for(var i=0;U.length>i;i++){var e=U[i],r=e[1],s=e[0].exec(t),n=s&&(h(r)?r(s,t):r);if(n)return n}return["",""]}(r);t=s[0],i=s[1]}}catch(t){}return function(t,i){var r=function(t){if(t)return{}.hasOwnProperty.call(qt,t)?qt[t]:t}(t);return e({},r?{"os.name":r}:{},i?{"os.version":i}:{})}(t,i)}function Rs(t,i){var r,s,n,a,o,l,u,h=null!==(r=null==t?void 0:t.flushIntervalMs)&&void 0!==r?r:3e3,v=null!==(s=null==t?void 0:t.maxBufferSize)&&void 0!==s?s:100,d=null!=i&&i.consoleCapture?void 0:null!==(n=null==t?void 0:t.maxLogsPerInterval)&&void 0!==n?n:1e3,f=c(d)?Math.max(v,2048):Math.max(v,d),p=e({},Ts(),null==t?void 0:t.resourceAttributes);return{serviceName:null!==(a=null!==(o=null==p?void 0:p["service.name"])&&void 0!==o?o:null==t?void 0:t.serviceName)&&void 0!==a?a:null==i?void 0:i.serviceNameDefault,serviceVersion:null!==(l=null==p?void 0:p["service.version"])&&void 0!==l?l:null==t?void 0:t.serviceVersion,environment:null!==(u=null==p?void 0:p["deployment.environment"])&&void 0!==u?u:null==t?void 0:t.environment,resourceAttributes:p,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:h,maxBufferSize:v,maxQueueSize:f,maxBatchRecordsPerPost:100,rateCapWindowMs:h,maxLogsPerInterval:d,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}var As=["debug","log","warn","error","info"],Os="console",Ms="__posthogHandledLogsRequestError",Is=(t,i)=>{var e=t instanceof Error?t:new Error(i);return e[Ms]=!0,e},$s=t=>!!t&&"object"==typeof t&&!0===t[Ms],js={featureFlags:class{constructor(t){this.name="featureFlags",this.Me=!1,this.featureFlagEventHandlers=[],this.l=ds,this.Ie={},this.$e={},this.je=[],this.Le=!1,this.De=!1,this.Ne=0,this.ze=!1,this.Be=!1,this.He=!1,this.Ue=!1,this.Ve=0,this.qe=()=>{var t=this.We();this.Ve=0,t&&this.reloadFeatureFlags()},this.Ke=()=>{var t,i=this.Je;c(i)||this.P.remoteRequestsDisabled||!oi||"hidden"===oi.visibilityState||Date.now()-(null!==(t=this.Ge)&&void 0!==t?t:0)<i||(this.reloadFeatureFlags(),this.Xe())},this.Ze=()=>{"visible"===(null==oi?void 0:oi.visibilityState)&&this.Ke()},"get"in t?this.Nt=t:(this._instance=t,this.Qe=new vs(t.config,t._shouldDisableFlags()),this.Nt=this.Qe)}updateConfig(t,i){var e;null==(e=this.Qe)||e.update(t,i),this.Ot&&this.Ye()}setup(t){return this.oi=t,this.l=t.logger.createLogger("[FeatureFlags]"),Nr(t.kv.initialize(),()=>{this.oi===t&&(this.oi=void 0,this.Ot=t,this.tr(t))})}tr(t){var i;if(this.Ot===t)return si&&_i(si,"online",this.qe),this.Ye(),this.ir=t.registerDynamicEventProperties(()=>this.er()?this.Ie:this.$e),this.rr=null==(i=this._instance)||null==(i=i.persistence)?void 0:i.onCrossTabFeatureFlagChange(()=>{this.sr(),this.nr(),this.ar()}),this.nr(),this.initialize()}Ye(){var t=this.P.refreshIntervalMs,i=!this.P.remoteRequestsDisabled&&oi&&!c(t)&&t>0?t:void 0;i!==this.Je&&(this.lr(),c(i)||(this.Je=i,this.Xe(),null!=oi&&oi.addEventListener&&_i(oi,Ve,this.Ze)))}Xe(){c(this.Je)||(c(this.ur)||clearInterval(this.ur),this.Ge=Date.now(),this.ur=setInterval(this.Ke,this.Je))}lr(){c(this.ur)||(clearInterval(this.ur),this.ur=void 0,null==oi||null==oi.removeEventListener||oi.removeEventListener(Ve,this.Ze)),this.Je=void 0,this.Ge=void 0}destroy(){this.hr()}dispose(){this.hr()}hr(){var t,i;this.lr(),this.Ne++,this.Be=!1,this.oi=void 0,this.Ot&&(this.vr(),null==(t=this.ir)||t.dispose(),this.ir=void 0,null==(i=this.rr)||i.call(this),this.rr=void 0,this.je=[],null==si||si.removeEventListener("online",this.qe),this.Ot=void 0)}get P(){return this.Nt.get()}dr(t){var i;return this.cr&&t in this.cr?this.cr[t]:null==(i=this.Ot)?void 0:i.kv.get(t)}sr(){return!!this.cr&&(this.cr=void 0,!0)}pr(){var t;return!c(null==(t=this.Ot)?void 0:t.kv.get(me))&&this.sr()}gr(t){this._r(()=>{var i;return null==(i=this.Ot)?void 0:i.kv.set(t)})}br(t,i,e){var r;if(null!=(r=this._instance)&&r.persistence&&t[me]){var s=this.dr(me)||{},n=t[me]||{},a=i.flags||i.featureFlags,o=i.flags?Object.entries(i.flags).filter(t=>{var i=t[1];return!(null!=i&&i.failed)}).map(t=>t[0]):[],l=!!i.errorsWhileComputingFlags&&!!i.flags,h=l?o:e&&!u(a)?Object.keys(a||{}):Array.from(new Set([...Object.keys(s),...Object.keys(n)])),v=this.dr(ke)||{},d=t[ke]||{},f=l||e?h:Array.from(new Set([...Object.keys(v),...Object.keys(d)])),p=!l&&!e,g=!!p||h,_=!!p||f,b={[ye]:g,[me]:g,[ke]:_};for(var m of(t[Se]&&(b[Se]=g),[xe,Ne,Ee]))c(t[m])||(b[m]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(b)}}mr(t){this._r(()=>{var i;return null==(i=this.Ot)?void 0:i.kv.remove(t)})}_r(t){try{t()}catch(t){this.l.error("Failed to update feature flag persistence",t)}}nr(){var t={};for(var i of[ye,ke,xe,Fe]){var r=this.dr(i);c(r)||(t[i]=r)}this.Ie=t;var s=e({},t),n=this.dr(me);if(n)for(var a of Object.entries(n))s["$feature/"+a[0]]=a[1];this.$e=s}er(){var t=this.P.cacheTtlMs;if(!t||0>=t)return!1;var i=this.dr(Ne);return"number"!=typeof i||Date.now()-i>t}yr(){return!!this.er()&&(this.Ue||this.De||(this.Ue=!0,this.l.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}wr(){var t=this.P.evaluationContexts;return null!=t&&t.length?t.filter(t=>{var i=t&&"string"==typeof t&&t.trim().length>0;return i||this.l.error("Invalid evaluation context found:",t,"Expected non-empty string"),i}):[]}Sr(){var t=this.P.flagKeys;if(!c(t))return t.filter(t=>{var i=t&&"string"==typeof t&&t.trim().length>0;return i||this.l.error("Invalid flag key found:",t,"Expected non-empty string"),i})}initialize(){var t,i,e=this.P,r=null!==(t=null==(i=e.bootstrap)?void 0:i.featureFlags)&&void 0!==t?t:{};if(Object.keys(r).length){var s,n,a=null!==(s=null==(n=e.bootstrap)?void 0:n.featureFlagPayloads)&&void 0!==s?s:{},o=Object.keys(r).filter(t=>!c(r[t])).reduce((t,i)=>(t[i]=r[i],t),{}),l=Object.keys(a).filter(t=>o[t]).reduce((t,i)=>(t[i]=a[i],t),{});return this.kr({featureFlags:o,featureFlagPayloads:l},void 0,{persist:!1})}}updateFlags(t,i,r){var s,n,a=null!=r&&r.merge&&null!==(s=this.dr(me))&&void 0!==s?s:{},o=null!=r&&r.merge&&null!==(n=this.dr(ke))&&void 0!==n?n:{},l=e({},a,t),u=e({},o,i),h={};for(var v of Object.entries(l)){var d=v[0],f=v[1];h[d]={key:d,enabled:jt(f),variant:Lt(f),reason:void 0,metadata:c(null==u?void 0:u[d])?void 0:{id:0,version:void 0,description:void 0,payload:u[d]}}}this.kr({flags:h})}get hasLoadedFlags(){return this.Le}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.dr(Se),i=this.dr(Fe),r=this.dr(Pe);if(!r&&!i)return t||{};var s=fi({},t||{}),n=[...new Set([...Object.keys(r||{}),...Object.keys(i||{})])];for(var a of n){var o,l,u=s[a],h=null==i?void 0:i[a],v=c(h)?null!==(o=null==u?void 0:u.enabled)&&void 0!==o&&o:!!h,d=c(h)?null==u?void 0:u.variant:"string"==typeof h?h:void 0,f=null==r?void 0:r[a],p=e({},u,{enabled:v,variant:v?null!=d?d:null==u?void 0:u.variant:void 0});v!==(null==u?void 0:u.enabled)&&(p.original_enabled=null==u?void 0:u.enabled),d!==(null==u?void 0:u.variant)&&(p.original_variant=null==u?void 0:u.variant),f&&(p.metadata=e({},null==u?void 0:u.metadata,{payload:f,original_payload:null==u||null==(l=u.metadata)?void 0:l.payload})),s[a]=p}return this.Me||(this.l.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:r,finalDetails:s}),this.Me=!0),s}getAllFeatureFlags(){var t=this.getFlagVariants(),i=this.getFlagPayloads();return Object.keys(t).map(e=>{var r=t[e];return{key:e,enabled:jt(r),variant:Lt(r),payload:$t(i[e])}})}getFlagVariants(){var t=this.dr(me),i=this.dr(Fe);if(!i)return t||{};for(var e=fi({},t||{}),r=Object.keys(i),s=0;r.length>s;s++)e[r[s]]=i[r[s]];return this.Me||(this.l.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:i,finalFlags:e}),this.Me=!0),e}getFlagPayloads(){var t=this.dr(ke),i=this.dr(Pe);if(!i)return t||{};for(var e=fi({},t||{}),r=Object.keys(i),s=0;r.length>s;s++)e[r[s]]=i[r[s]];return this.Me||(this.l.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:i,finalPayloads:e}),this.Me=!0),e}reloadFeatureFlags(){this.ze||this.P.featureFlagsDisabled||this.We()||(this.De&&(this.Be=!0),this.Er||(this.je.slice().forEach(t=>{try{t()}catch(t){this.l.error("Error while running feature flags reloading callback",t)}}),this.Er=setTimeout(()=>{this.Fr()},5)))}vr(){clearTimeout(this.Er),this.Er=void 0}onReloading(t){return this.je.push(t),()=>{this.je=this.je.filter(i=>i!==t)}}ensureFlagsLoaded(){this.Le||this.De||this.Er||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.ze=t}resetFlagCallReported(){this.mr(je)}Fr(t){this.vr();var i=this.Ot;if(i&&!this.P.remoteRequestsDisabled&&!this.We())if(this.De)this.Be=!0;else{var r={token:i.projectToken,distinct_id:i.distinctId,groups:i.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:e({},i.initialPersonProperties,this.dr(Ce)||{},{$lib:i.library.name,$lib_version:i.library.version}),group_properties:this.dr(Te),timezone:br()};c(i.deviceId)||(r.$device_id=i.deviceId),(null!=t&&t.disableFlags||this.P.featureFlagsDisabled)&&(r.disable_flags=!0);var s=this.wr();s.length&&(r.evaluation_contexts=s);var n=this.Sr();c(n)||(r.flag_keys=n);var a=this.P.onlyEvaluateSurveyFeatureFlags,o="/flags/?v=2"+(a?"&only_evaluate_survey_feature_flags=true":""),l=this.Ne;this.De=!0;var u=()=>{this.Be&&(this.Be=!1,this.Fr())},h=t=>{this.De=!1,l===this.Ne?(this.gr({[De]:[ps]}),this.l.error("Feature flag request failed",t),this.pr()&&this.ar(!0),u()):u()};try{i.sendRequest(o,{target:"flags",method:"POST",body:r,compression:this.P.compression,sentAt:"body",timeoutMs:this.P.requestTimeoutMs}).then(t=>{var i,e,s=null!==(i=t.json)&&void 0!==i?i:{},n=200!==t.statusCode;if(this.De=!1,l===this.Ne){if(this.Pr(t.statusCode),n||this.Be||(this.$anon_distinct_id=void 0),!r.disable_flags||this.Be){this.He=!n;var o=[];t.error?o.push(t.error instanceof Error&&"AbortError"===t.error.name?"timeout":t.error instanceof Error?ps:"unknown_error"):200!==t.statusCode&&o.push("api_error_"+t.statusCode),s.errorsWhileComputingFlags&&o.push("errors_while_computing_flags");var h=!(null==(e=s.quotaLimited)||!e.includes("feature_flags"));h&&o.push("quota_limited"),this.gr({[De]:o}),h?this.l.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):r.disable_flags||this.kr(s,n,{partialResponse:a}),u()}}else u()}).catch(h)}catch(t){h(t)}}}We(){return Ge(this.Ve,3)}Pr(t){this.Ve=Xe(t,this.Ve,3,()=>this.l.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes."))}getFeatureFlag(t,i){var e;if(void 0===i&&(i={}),!i.fresh||this.He)if(this.Le||this.getFlags()&&this.getFlags().length>0){if(!this.yr()){var r=this.getFeatureFlagResult(t,i);return null!==(e=null==r?void 0:r.variant)&&void 0!==e?e:null==r?void 0:r.enabled}}else this.l.warn('getFeatureFlag for key "'+t+fs)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var i=this.getFeatureFlagResult(t,{send_event:!1});return null==i?void 0:i.payload}getFeatureFlagResult(t,i){if(void 0===i&&(i={}),!i.fresh||this.He)if(this.Le||this.getFlags()&&this.getFlags().length>0){if(!this.yr()){var r,s=this.getFlagVariants(),n=t in s,a=s[t],o=this.getFlagPayloads()[t],l=String(a),h=this.dr(xe)||void 0,v=this.dr(Ne)||void 0,d=this.dr(je)||{};if(this.P.deduplicateCallsPerSession){var f,p=null==(f=this.Ot)?void 0:f.session.sessionId,g=this.dr(Le);p&&p!==g&&(d={},r=p)}if(i.send_event||!("send_event"in i))if(t in d&&d[t].includes(l))r&&this.gr({[je]:d,[Le]:r});else{var _,b,m,y,w,S,k,x,E,F,P,C;u(d[t])?d[t].push(l):d[t]=[l],this.gr(e({[je]:d},r?{[Le]:r}:{}));var T=this.getFeatureFlagDetails(t),R=[...null!==(_=this.dr(De))&&void 0!==_?_:[]];c(a)&&R.push("flag_missing");var A={$feature_flag:t,$feature_flag_response:a,$feature_flag_payload:null!=o?o:null,$feature_flag_request_id:h,$feature_flag_evaluated_at:v,$feature_flag_bootstrapped_response:null!==(b=null==(m=this.P.bootstrap)||null==(m=m.featureFlags)?void 0:m[t])&&void 0!==b?b:null,$feature_flag_bootstrapped_payload:null!==(y=null==(w=this.P.bootstrap)||null==(w=w.featureFlagPayloads)?void 0:w[t])&&void 0!==y?y:null,$used_bootstrap_value:!this.He};c(null==T||null==(S=T.metadata)?void 0:S.has_experiment)||(A.$feature_flag_has_experiment=T.metadata.has_experiment),c(null==T||null==(k=T.metadata)?void 0:k.version)||(A.$feature_flag_version=T.metadata.version);var O,M=null!==(x=null==T||null==(E=T.reason)?void 0:E.description)&&void 0!==x?x:null==T||null==(F=T.reason)?void 0:F.code;M&&(A.$feature_flag_reason=M),null!=T&&null!=(P=T.metadata)&&P.id&&(A.$feature_flag_id=T.metadata.id),c(null==T?void 0:T.original_variant)&&c(null==T?void 0:T.original_enabled)||(A.$feature_flag_original_response=c(T.original_variant)?T.original_enabled:T.original_variant),null!=T&&null!=(C=T.metadata)&&C.original_payload&&(A.$feature_flag_original_payload=null==T||null==(O=T.metadata)?void 0:O.original_payload),R.length&&(A.$feature_flag_error=R.join(",")),this.Cr(A)}else r&&this.gr({[je]:d,[Le]:r});if(n)return{key:t,enabled:!!a,variant:"string"==typeof a?a:void 0,payload:$t(o)}}}else this.l.warn('getFeatureFlagResult for key "'+t+fs)}Cr(t){try{var i;null==(i=this.Ot)||i.capture("$feature_flag_called",t).catch(t=>{this.l.error("Failed to capture feature flag call",t)})}catch(t){this.l.error("Failed to capture feature flag call",t)}}getRemoteConfigPayload(t,i){this.Tr(t,i)}Tr(t,e){var r=this;return i(function*(){var i=r.Ot;if(i){var s={distinct_id:i.distinctId,token:i.projectToken,person_properties:{$lib:i.library.name,$lib_version:i.library.version}},n=r.wr();n.length&&(s.evaluation_contexts=n);var a,o=r.Sr();c(o)||(s.flag_keys=o);try{var l,u=null==(l=(yield i.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:s,compression:r.P.compression,sentAt:"body",timeoutMs:r.P.requestTimeoutMs})).json)?void 0:l.featureFlagPayloads;a=(null==u?void 0:u[t])||void 0}catch(t){return void r.l.error("Remote config feature flag request failed",t)}try{e(a)}catch(t){r.l.error("Remote config feature flag callback failed",t)}}})()}isFeatureEnabled(t,i){if(void 0===i&&(i={}),i.fresh&&!this.He)return i.defaultValue;if(!(this.Le||this.getFlags()&&this.getFlags().length>0))return this.l.warn('isFeatureEnabled for key "'+t+fs),i.defaultValue;var e=this.getFeatureFlag(t,i);return c(e)?i.defaultValue:!!e}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(i=>i!==t)}receivedFeatureFlags(t,i,e){this.kr(t,i,e)}kr(t,i,r){if(this.Ot){this.Le=!0;var s=function(t,i,r,s,n,a){void 0===i&&(i={}),void 0===r&&(r={}),void 0===s&&(s={}),void 0===a&&(a=ds);var o=((t,i)=>{var r=t.flags;return r?e({},t,{featureFlags:Object.fromEntries(Object.keys(r).map(t=>{var i;return[t,null!==(i=r[t].variant)&&void 0!==i?i:r[t].enabled]})),featureFlagPayloads:Object.fromEntries(Object.keys(r).filter(t=>r[t].enabled).filter(t=>{var i;return!c(null==(i=r[t].metadata)?void 0:i.payload)}).map(t=>{var i;return[t,null==(i=r[t].metadata)?void 0:i.payload]}))}):(t.featureFlags&&i.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t)})(t,a),l=o.flags,h=o.featureFlags,v=o.featureFlagPayloads;if(h){var d=t.requestId,f=t.evaluatedAt;if(u(h)){a.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var p={};if(h)for(var g=0;h.length>g;g++)p[h[g]]=!0;return{[ye]:h,[me]:p,[Ee]:!1}}var _=h,b=v,m=l;if(null!=n&&n.partialResponse){var y=Object.keys(_),w=b||{};_=e({},i,_),b=e({},r,w),y.forEach(t=>{var i;t in w||null==(i=b)||delete i[t]}),m=e({},s,m)}else if(t.errorsWhileComputingFlags)if(l){var S=new Set(Object.keys(l).filter(t=>{var i;return!(null!=(i=l[t])&&i.failed)}));_=e({},i,Object.fromEntries(Object.entries(_).filter(t=>S.has(t[0]))));var k=Object.fromEntries(Object.entries(b||{}).filter(t=>S.has(t[0])));b=e({},r,k),S.forEach(t=>{var i;t in k||null==(i=b)||delete i[t]}),m=e({},s,Object.fromEntries(Object.entries(m||{}).filter(t=>S.has(t[0]))))}else _=e({},i,_),b=e({},r,b),m=e({},s,m);return e({[ye]:Object.keys(_s(_)),[me]:_||{},[ke]:b||{},[Se]:m||{},[Ee]:!0===t.minimalFlagCalledEvents},d?{[xe]:d}:{},f?{[Ne]:f}:{})}}(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),r,this.l);if(s)if(!1===(null==r?void 0:r.persist)){var n=!c(this.Ot.kv.get(me));this.cr=s,n||this.gr(s)}else this.sr(),this.br(s,t,!(null==r||!r.partialResponse)),this.gr(s);else i&&this.pr();i||(this.Ue=!1),this.ar(i)}}override(t,i){void 0===i&&(i=!1),this.l.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:i})}overrideFeatureFlags(t){this.Rr(t)}Rr(t){if(this.Ot){if(!1===t)return this.mr([Fe,Pe]),this.ar(),void cs.info("All overrides cleared");if(u(t))return this.gr({[Fe]:gs(t)}),this.ar(),void cs.info("Flag overrides set",{flags:t});if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i,e=t;this.Me=Boolean(null!==(i=e.suppressWarning)&&void 0!==i&&i);var r={},s=e.flags,n=e.payloads;return s&&(r[Fe]=u(s)?gs(s):s),n&&(r[Pe]=n),Object.keys(r).length&&this.gr(r),!1===s&&!1===n?this.mr([Fe,Pe]):!1===s?this.mr(Fe):!1===n&&this.mr(Pe),this.ar(),!1===s?cs.info("Flag overrides cleared"):s&&cs.info("Flag overrides set",{flags:s}),void(!1===n?cs.info("Payload overrides cleared"):n&&cs.info("Payload overrides set",{payloads:n}))}if(t&&"object"==typeof t)return this.gr({[Fe]:t}),this.ar(),void cs.info("Flag overrides set",{flags:t});this.l.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}else this.l.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.Le){var i=this.Ar(),e=i.flags,r=i.flagVariants;try{t(e,r)}catch(t){this.l.error("Error while running feature flags callback",t)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,i,r){var s,n=(this.dr(we)||[]).find(i=>i.flagKey===t),a={["$feature_enrollment/"+t]:i},o={$feature_flag:t,$feature_enrollment:i,$set:a};n&&(o.$early_access_feature_name=n.name),r&&(o.$feature_enrollment_stage=r);var l=e({},this.getFlagVariants(),{[t]:i});null==(s=this._instance)||null==(s=s.persistence)||s.markCrossTabFeatureFlagChanges({[ye]:[t],[me]:[t],[Ce]:Object.keys(a)}),this.gr({[ye]:Object.keys(_s(l)),[me]:l,[Ce]:e({},this.dr(Ce)||{},a)}),this.ar();try{var u;null==(u=this.Ot)||u.capture("$feature_enrollment_update",o).catch(t=>{this.l.error("Failed to capture early access feature enrollment",t)})}catch(t){this.l.error("Failed to capture early access feature enrollment",t)}}getEarlyAccessFeatures(t,i,e){void 0===i&&(i=!1);var r=this.dr(we);!r||i?this.Or(t,e):t(r)}Or(t,e){var r=this;return i(function*(){var i=r.Ot;if(i){var s,n=e?"&"+e.map(t=>"stage="+t).join("&"):"";try{var a=yield i.sendRequest("/api/early_access_features/?token="+i.projectToken+n,{target:"api",method:"GET",sentAt:"query"});if(!a.json)return;s=a.json.earlyAccessFeatures,r.gr({[we]:s})}catch(t){return void r.l.error("Early access feature request failed",t)}try{t(s)}catch(t){r.l.error("Early access feature callback failed",t)}}})()}Ar(){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),{})}}ar(t){this.nr();var i=this.Ar(),e=i.flags,r=i.flagVariants;this.featureFlagEventHandlers.forEach(i=>{try{i(e,r,{errorsLoading:t})}catch(t){this.l.error("Error while running feature flags callback",t)}})}setPersonPropertiesForFlags(t,i){void 0===i&&(i=!0),this.Mr(t,i)}Mr(t,i){void 0===i&&(i=!0);var r=this.dr(Ce)||{},s=(null==t?void 0:t.$set)||(null!=t&&t.$set_once?{}:t),n=null==t?void 0:t.$set_once,a={};if(n)for(var o in n)({}).hasOwnProperty.call(n,o)&&(o in r||(a[o]=n[o]));this.gr({[Ce]:e({},r,a,s)}),i&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,i){void 0===i&&(i=!0);var r=e({},this.dr(Ce)||{});t.forEach(t=>{delete r[t]}),this.gr({[Ce]:r}),i&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t){void 0===t&&(t=!0),this.mr(Ce),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,i){void 0===i&&(i=!0);var r=this.dr(Te)||{},s=e({},r);for(var n of Object.keys(t))s[n]=e({},r[n],t[n]);this.gr({[Te]:s}),i&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var i=this.dr(Te)||{};this.gr({[Te]:e({},i,{[t]:{}})})}else this.mr(Te)}reset(){this.Ne++,this.Be=!1,this.Ie={},this.$e={},this.cr=void 0,this.Le=!1,this.ze=!1,this.He=!1,this.$anon_distinct_id=void 0,this.vr(),this.Me=!1,this.Ve=0}}},Ls={sessionRecording:class{get P(){return this._instance.config}get Ir(){return this._instance.persistence}get started(){var t;return!(null==(t=this.$r)||!t.isStarted)}get status(){var t,i;return this.jr===Cr||this.jr===Tr?this.jr:null!==(t=null==(i=this.$r)?void 0:i.status)&&void 0!==t?t:this.jr}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.jr=Fr,this.Lr=void 0,this.Dr=!1,this.Nr=(()=>{var t;if(null==oi||!oi.visibilityState||"visible"===oi.visibilityState)return!0;var i=null==si||null==(t=si.performance)||null==t.getEntriesByType?void 0:t.getEntriesByType("visibility-state");return!(null!=i&&i.length)||i.some(t=>"visible"===t.name)})(),this.Ze=()=>{var t;"visible"===(null==oi?void 0:oi.visibilityState)&&(this.Nr=!0,null==(t=this.$r)||null==t.setDocumentWasEverVisible||t.setDocumentWasEverVisible(!0))},this._instance=t,!this._instance.sessionManager)throw Ar.error("started without valid sessionManager"),new Error(Rr+" started without valid sessionManager. This is a bug.");if("always"===this.P.cookieless_mode)throw new Error(Rr+' cannot be used with cookieless_mode="always"');null!=oi&&oi.addEventListener&&_i(oi,"visibilitychange",this.Ze)}initialize(){this.startIfEnabledOrStop()}dispose(t){var i=(void 0===t?{}:t).discardBufferedEvents,e=void 0!==i&&i;this.Dr=!0,null==oi||null==oi.removeEventListener||oi.removeEventListener("visibilitychange",this.Ze),e?this.zr(!0):this.stopRecording()}get Br(){var t,i=!(null==(t=this._instance.get_property(ge))||!t.enabled),e=!this.P.disable_session_recording,r=this.P.disable_session_recording||this._instance.consent.isOptedOut();return si&&i&&e&&!r}startIfEnabledOrStop(t){var i;if(!(this.Dr||this.Br&&null!=(i=this.$r)&&i.isStarted)){var e=!c(Object.assign)&&!c(Array.from);this.Br&&e?(this.Hr(t),Ar.info("starting")):(this.jr=Fr,this.stopRecording())}}Hr(t){var i,e;if(this.Br)if(this.jr!==Cr&&this.jr!==Tr&&(this.jr=Pr),null!=nr&&null!=(i=nr.__PosthogExtensions__)&&null!=(i=i.rrweb)&&i.record&&null!=(e=nr.__PosthogExtensions__)&&e.initSessionRecording)this.Ur(t);else{var r,s=this._instance.sessionManager;null==(r=nr.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.Vr,i=>{if(!this.Dr&&this.Br&&this._instance.sessionManager===s)return i?(this._instance.register_for_session({[ze]:!0}),Ar.error("could not load recorder",i)):void this.Ur(t);this.jr=Fr})}}stopRecording(){var t,i;null==(t=this.Lr)||t.call(this),this.Lr=void 0,null==(i=this.$r)||i.stop()}zr(t){var i,e;void 0===t&&(t=!1),null==(i=this.Lr)||i.call(this),this.Lr=void 0,null==(e=this.$r)||e.discard({discardProducerEvents:t})}qr(){var t,i;null==(t=this.Ir)||t.unregister("$session_is_sampled"),null==(i=this.Ir)||i.unregister("$replay_sample_rate")}Wr(t,i){if(_(t))return null;var e,r=b(t)?t:parseFloat(t);return"number"!=typeof(e=r)||!Number.isFinite(e)||0>e||e>1?(Ar.warn(i+" must be between 0 and 1. Ignoring invalid value:",t),null):r}Kr(t){if(this.Ir){var i,r,s=this.Ir,n=()=>{var i,r=!1===t.sessionRecording?void 0:t.sessionRecording,n=this.Wr(null==(i=this.P.session_recording)?void 0:i.sampleRate,"session_recording.sampleRate"),a=this.Wr(null==r?void 0:r.sampleRate,"remote config sampleRate"),o=null!=n?n:a;_(o)&&this.qr();var l=null==r?void 0:r.minimumDurationMilliseconds;s.register({[ge]:e({cache_timestamp:Date.now(),enabled:!!r},r,{networkPayloadCapture:e({capturePerformance:t.capturePerformance},null==r?void 0:r.networkPayloadCapture),canvasRecording:{enabled:null==r?void 0:r.recordCanvas,fps:null==r?void 0:r.canvasFps,quality:null==r?void 0:r.canvasQuality},sampleRate:o,minimumDurationMilliseconds:c(l)?null:l,endpoint:null==r?void 0:r.endpoint,triggerMatchType:null==r?void 0:r.triggerMatchType,masking:null==r?void 0:r.masking,urlTriggers:null==r?void 0:r.urlTriggers,version:null==r?void 0:r.version,triggerGroups:null==r?void 0:r.triggerGroups})})};n(),null==(i=this.Lr)||i.call(this),this.Lr=null==(r=this._instance.sessionManager)?void 0:r.onSessionId(n)}}onRemoteConfig(t){var i=t.ok?t.config:void 0;return i&&"sessionRecording"in i?!1===i.sessionRecording?(this.Kr(i),void this.zr()):(this.Kr(i),void this.startIfEnabledOrStop()):(this.jr===Cr&&(this.jr=Tr,Ar.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,i){var e;void 0===i&&(i="log"),null!=(e=this.$r)&&e.log?this.$r.log(t,i):Ar.warn("log called before recorder was ready")}get Vr(){var t,i,e=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.get_property(ge);return(null==e||null==(i=e.scriptConfig)?void 0:i.script)||"lazy-recorder"}Jr(){var t,i=this._instance.get_property(ge);if(!i)return!1;try{t="object"==typeof i?i:JSON.parse(i)}catch(t){return Ar.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}return!_(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}Ur(t){var i,e,r;if(!this.Dr&&this.Br&&this._instance.sessionManager){if(null==(i=nr.__PosthogExtensions__)||!i.initSessionRecording)return Ar.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[ze]:!0});var s;if(this.$r||(this.$r=null==(s=nr.__PosthogExtensions__)?void 0:s.initSessionRecording(this._instance,this.Nr),this.$r._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Jr()){if(this.jr===Tr||this.jr===Cr)return;return this.jr=Cr,Ar.info("persisted remote config is stale, requesting fresh config before starting"),void new Er(this._instance).load()}this.jr=Pr,null==(e=(r=this.$r).setDocumentWasEverVisible)||e.call(r,this.Nr),this.$r.start(t)}else this.jr=Fr}onRRwebEmit(t){var i;null==(i=this.$r)||null==i.onRRwebEmit||i.onRRwebEmit(t)}overrideLinkedFlag(){var t,i;this.$r||null==(i=this.Ir)||i.register({[be]:!0}),null==(t=this.$r)||t.overrideLinkedFlag()}overrideSampling(){var t,i;this.$r||null==(i=this.Ir)||i.register({[_e]:!0}),null==(t=this.$r)||t.overrideSampling()}overrideTrigger(t){var i,e;this.$r||null==(e=this.Ir)||e.register({["url"===t?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null==(i=this.$r)||i.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.$r)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,i){var e;return!(null==(e=this.$r)||!e.tryAddCustomEvent(t,i))}flushBeforeIdentityReset(){var t;null==(t=this.$r)||null==t.flushBeforeIdentityReset||t.flushBeforeIdentityReset()}}},Ds={autocapture:class extends er{constructor(t){super(new rr(t)),this.instance=t}},historyAutocapture:class{constructor(t){this._instance=t,this.Gr=this.Xr()}initialize(){this.startIfEnabled()}get isEnabled(){var t=this.Zr();return!!(t.path||t.search||this.Qr(t))}startIfEnabled(){this.isEnabled&&(vi.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.Gr=this.Xr(),this.startIfEnabled()}stop(){this.Yr&&this.Yr(),this.Yr=void 0,this.ts&&this.ts(),this.ts=void 0,vi.info("History API monitoring stopped")}monitorHistoryChanges(){si&&si.history&&(this.es("pushState"),this.es("replaceState"),this.rs(),this.Qr()&&this.ss())}es(t){var i;if(si&&(null==(i=si.history[t])||!i.__posthog_wrapped__)){var e=this;dr(si.history,t,i=>function(r,s,n){i.call(this,r,s,n),e.ns(t)})}}Xr(){var t=null==si?void 0:si.location;if(null!=t&&t.pathname)return{pathname:t.pathname,search:t.search,hash:t.hash}}Zr(){var t=this._instance.config.capture_pageview;return"history_change"===t?{path:!0}:v(t)?t:{}}Qr(t){return void 0===t&&(t=this.Zr()),!!t.hash&&!this._instance.config.disable_capture_url_hashes}ls(t){var i=this.Zr(),e=this.Gr;return!(!e||!(i.path&&t.pathname!==e.pathname||i.search&&t.search!==e.search||this.Qr(i)&&t.hash!==e.hash))}ns(t){try{var i=this.Xr();if(!i)return;this.ls(i)&&this._instance.capture("$pageview",{navigation_type:t}),this.Gr=i}catch(i){vi.error("Error capturing "+t+" pageview",i)}}rs(){if(!this.Yr){var t=()=>{this.ns("popstate")};_i(si,"popstate",t),this.Yr=()=>{si&&si.removeEventListener("popstate",t)}}}ss(){if(!this.ts){var t=()=>{this.ns("hashchange")};_i(si,"hashchange",t),this.ts=()=>{si&&si.removeEventListener("hashchange",t)}}}},heatmaps:class{get P(){return this.instance.config}constructor(t){var i;this.us=!1,this.It=!1,this.hs=null,this.instance=t,this.us=!(null==(i=this.instance.persistence)||!i.props[oe]),this.rageclicks=new ne(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return v(this.P.capture_heatmaps)&&this.P.capture_heatmaps.flush_interval_milliseconds&&(t=this.P.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return _(this.P.capture_heatmaps)?_(this.P.enable_heatmaps)?this.us:this.P.enable_heatmaps:!1!==this.P.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.It)return;Or.info("starting..."),this.vs(),this.Ze()}else{var t;clearInterval(null!==(t=this.hs)&&void 0!==t?t:void 0),this.ds(),this.getAndClearBuffer()}}onRemoteConfig(t){if(t.ok){var i=t.config;if("heatmaps"in i){var e=!!i.heatmaps;this.instance.persistence&&this.instance.persistence.register({[oe]:e}),this.us=e,this.startIfEnabled()}}}getAndClearBuffer(){var t=this.cs;return this.cs=void 0,t}fs(t){Mr(t.originalEvent)&&this.ps(t.originalEvent,"deadclick")}Ze(){this.hs&&clearInterval(this.hs),this.hs="visible"===(null==oi?void 0:oi.visibilityState)?setInterval(this.gs.bind(this),this.flushIntervalMilliseconds):null}vs(){si&&oi&&(this._s=this.gs.bind(this),_i(si,qe,this._s),this.bs=t=>this.ps(t||(null==si?void 0:si.event)),_i(oi,"click",this.bs,{capture:!0}),this.ys=t=>this.ws(t||(null==si?void 0:si.event)),_i(oi,"mousemove",this.ys,{capture:!0}),this.Ss=new lr(this.instance,or,this.fs.bind(this)),this.Ss.startIfEnabledOrStop(),this.ks=this.Ze.bind(this),_i(oi,Ve,this.ks),this.It=!0)}ds(){var t;si&&oi&&(this._s&&si.removeEventListener(qe,this._s),this.bs&&oi.removeEventListener("click",this.bs,{capture:!0}),this.ys&&oi.removeEventListener("mousemove",this.ys,{capture:!0}),this.ks&&oi.removeEventListener(Ve,this.ks),clearTimeout(this.xs),null==(t=this.Ss)||t.stop(),this.It=!1)}Es(t,i){var e=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),a=function(t,i,e){for(var r=t;r&&Si(r)&&!ki(r,"body");){if(r===e)return!1;var n=void 0;try{var a,o,l;n=null==(a=null!==(o=null==(l=r.ownerDocument)?void 0:l.defaultView)&&void 0!==o?o:si)?void 0:a.getComputedStyle(r).position}catch(t){return!1}if(s(i,n))return!0;r=ji(r)}return!1}(Oi(t),["fixed","sticky"],n);return{x:t.clientX+(a?0:r),y:t.clientY+(a?0:e),target_fixed:a,type:i}}ps(t,i){var r;if(void 0===i&&(i="click"),!wi(t.target)&&Mr(t)){var s=this.Es(t,i);null!=(r=this.rageclicks)&&r.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&Hi(Oi(t),this.instance.config.rageclick)&&this.ft(e({},s,{type:"rageclick"})),this.ft(s)}}ws(t){!wi(t.target)&&Mr(t)&&(clearTimeout(this.xs),this.xs=setTimeout(()=>{this.ft(this.Es(t,"mousemove"))},500))}ft(t){if(si){var i=this.P.disable_capture_url_hashes?K(si.location.href):si.location.href,e=this.P.custom_personal_data_properties,r=this.P.mask_personal_data_properties?[...fr,...e||[]]:[],s=Ke(i,r,gr);this.cs=this.cs||{},this.cs[s]||(this.cs[s]=[]),this.cs[s].push(t)}}gs(){this.cs&&!d(this.cs)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:lr,webVitalsAutocapture:class{constructor(t){var i;this.us=!1,this.It=!1,this.cs={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Fs=()=>{clearTimeout(this.Ps),this.Ps=void 0,0!==this.cs.metrics.length&&(this._instance.capture("$web_vitals",e({$current_url:this.cs.url},this.cs.metrics.reduce((t,i)=>e({},t,{["$web_vitals_"+i.name+"_event"]:e({},i),["$web_vitals_"+i.name+"_value"]:i.value}),{}))),this.cs={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Cs=t=>{var i;if(this.cs=this.cs||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},_(null==t?void 0:t.name)||_(null==t?void 0:t.value))mr.error("Invalid metric received",t);else{var r="string"==typeof t.navigationURL?t.navigationURL:void 0,s=this.Ts(r);if(!c(s)){var n=b(t.navigationId)||"string"==typeof t.navigationId?"navigation:"+t.navigationId:"url:"+s;if(!this.Rs||this.Rs>t.value){this.cs.navigationKey!==n&&(this.Fs(),this.Ps=setTimeout(this.Fs,this.flushToCaptureTimeoutMs)),c(this.cs.navigationKey)&&(this.cs.navigationKey=n,this.cs.url=s),this.cs.firstMetricTimestamp=c(this.cs.firstMetricTimestamp)?Date.now():this.cs.firstMetricTimestamp;var a=null==(i=this._instance.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0),o=e({},t,r?{navigationURL:s}:{},{$current_url:s,timestamp:Date.now()});if(delete o.entries,v(t.attribution)&&this.attributionMetrics.indexOf(t.name)>-1){var l={};for(var u of kr){var h="url"===u&&"string"==typeof t.attribution[u]?this.Ts(t.attribution[u]):t.attribution[u];c(h)||(l[u]=h)}o.attribution=l}else delete o.attribution;c(a)||(o.$session_id=a.sessionId,o.$window_id=a.windowId),this.cs.metrics.push(o),this.cs.metrics.length===this.allowedMetrics.length&&this.Fs()}else mr.error("Ignoring metric with value >= "+this.Rs,t)}}},this.As=()=>{if(!this.It){var t,i,r,s,n=!1,a=nr.__PosthogExtensions__,o=null==a?void 0:a.postHogWebVitalsCallbacksByFlavor,l=(null==o?void 0:o[this.Os])||("web-vitals"===this.Os&&c(o)?null==a?void 0:a.postHogWebVitalsCallbacks:void 0);if(!c(l)){var u=l.withoutAttribution,h=this.attributionMetrics;n=!c(u),t=h.indexOf("LCP")>-1?l.onLCP:(null==u?void 0:u.onLCP)||l.onLCP,i=h.indexOf("CLS")>-1?l.onCLS:(null==u?void 0:u.onCLS)||l.onCLS,r=h.indexOf("FCP")>-1?l.onFCP:(null==u?void 0:u.onFCP)||l.onFCP,s=h.indexOf("INP")>-1?l.onINP:(null==u?void 0:u.onINP)||l.onINP}if(t&&i&&r&&s){var v={reportSoftNavs:this.useSoftNavs},d=n&&this.attributionMetrics.indexOf("INP")>-1?e({},v,{includeProcessedEventEntries:!1}):v;this.allowedMetrics.indexOf("LCP")>-1&&t(this.Cs.bind(this),v),this.allowedMetrics.indexOf("CLS")>-1&&i(this.Cs.bind(this),v),this.allowedMetrics.indexOf("FCP")>-1&&r(this.Cs.bind(this),v),this.allowedMetrics.indexOf("INP")>-1&&s(this.Cs.bind(this),d),this.It=!0}else mr.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.us=!(null==(i=this._instance.persistence)||!i.props[ve]),this.startIfEnabled()}get Ms(){return this._instance.config.capture_performance}get allowedMetrics(){var t,i,e=v(this.Ms)?null==(t=this.Ms)?void 0:t.web_vitals_allowed_metrics:void 0;return _(e)?(null==(i=this._instance.persistence)?void 0:i.props[pe])||wr:e}get flushToCaptureTimeoutMs(){return(v(this.Ms)?this.Ms.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){var t=v(this.Ms)?this.Ms.web_vitals_attribution:void 0;return m(t)?t?wr:[]:u(t)?t:Sr}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){var t=v(this.Ms)?this.Ms.__preview_web_vitals_soft_navs:void 0;return null!=t&&t}get Rs(){var t=v(this.Ms)&&b(this.Ms.__web_vitals_max_value)?this.Ms.__web_vitals_max_value:yr;return t>0&&6e4>=t?yr:t}get isEnabled(){var t=null==li?void 0:li.protocol;if("http:"!==t&&"https:"!==t)return mr.info("Web Vitals are disabled on non-http/https protocols"),!1;var i=v(this.Ms)?this.Ms.web_vitals:m(this.Ms)?this.Ms:void 0;return m(i)?i:this.us}startIfEnabled(){this.isEnabled&&!this.It&&(mr.info("enabled, starting..."),this.Gt(this.As))}onRemoteConfig(t){if(t.ok){var i=t.config;if("capturePerformance"in i){var e=v(i.capturePerformance)&&!!i.capturePerformance.web_vitals,r=v(i.capturePerformance)?i.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[ve]:e}),this._instance.persistence.register({[pe]:r})),this.us=e,this.startIfEnabled()}}}get Os(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}Gt(t){var i=nr.__PosthogExtensions__,e=this.Os,r=null==i?void 0:i.postHogWebVitalsCallbacksByFlavor;null!=r&&r[e]||"web-vitals"===e&&c(r)&&null!=i&&i.postHogWebVitalsCallbacks?t():null==i||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,i=>{i?mr.error("failed to load script",i):t()})}Ts(t){var i=t||(null==si?void 0:si.location.href);if(i){var e=this._instance.config.disable_capture_url_hashes?K(i):i,r=this._instance.config.custom_personal_data_properties,s=this._instance.config.mask_personal_data_properties?[...fr,...r||[]]:[];return Ke(e,s,gr)}mr.error("Could not determine current URL")}}},Ns={exceptionObserver:class{constructor(t){var i;this.As=()=>{var t;if(si&&this.isEnabled&&null!=(t=nr.__PosthogExtensions__)&&t.errorWrappingFunctions){var i=nr.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,e=nr.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=nr.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Is&&this.P.capture_unhandled_errors&&(this.Is=i(this.captureException.bind(this))),!this.$s&&this.P.capture_unhandled_rejections&&(this.$s=e(this.captureException.bind(this))),!this.js&&this.P.capture_console_errors&&(this.js=r(this.captureException.bind(this)))}catch(t){ur.error("failed to start",t),this.Ls()}}},this._instance=t,this.Ds=!(null==(i=this._instance.persistence)||!i.props[le]),this.Ns=new C(e({},function(t){var i,e,r,s;return void 0===t&&(t={}),{refillRate:null!==(i=null!==(e=t.exceptionRateLimiterRefillRate)&&void 0!==e?e:t.__exceptionRateLimiterRefillRate)&&void 0!==i?i:1,bucketSize:null!==(r=null!==(s=t.exceptionRateLimiterBucketSize)&&void 0!==s?s:t.__exceptionRateLimiterBucketSize)&&void 0!==r?r:10}}(this._instance.config.error_tracking),{refillInterval:1e4,l:ur})),this.P=this.zs(),this.startIfEnabledOrStop()}zs(){var t=this._instance.config.capture_exceptions,i={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return v(t)?i=e({},i,t):(c(t)?this.Ds:t)&&(i=e({},i,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),i}get isEnabled(){return this.P.capture_console_errors||this.P.capture_unhandled_errors||this.P.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(ur.info("enabled"),this.Ls(),this.Gt(this.As)):this.Ls()}Gt(t){var i,e;null!=(i=nr.__PosthogExtensions__)&&i.errorWrappingFunctions?t():null==(e=nr.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"exception-autocapture",i=>{if(i)return ur.error("failed to load script",i);t()})}Ls(){var t,i,e;null==(t=this.Is)||t.call(this),this.Is=void 0,null==(i=this.$s)||i.call(this),this.$s=void 0,null==(e=this.js)||e.call(this),this.js=void 0}onRemoteConfig(t){if(t.ok){var i=t.config;"autocaptureExceptions"in i&&(this.Ds=!!i.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[le]:this.Ds}),this.P=this.zs(),this.startIfEnabledOrStop())}}onConfigChange(){this.P=this.zs()}captureException(t){try{var i,e,r,s=null!==(i=null==t||null==(e=t.$exception_list)||null==(e=e[0])?void 0:e.type)&&void 0!==i?i:"Exception";if(this.Ns.consumeRateLimit(s))return void ur.info("Skipping exception capture because of client rate limiting.",{exception:s});null==(r=this._instance.exceptions)||r.sendExceptionEvent(t)}catch(t){}}},exceptions:class{constructor(t){var i,r;this.Bs=[],this.Hs=new Q([new _t,new Pt,new mt,new bt,new Et,new xt,new wt,new Ft],function(t){for(var i=arguments.length,r=new Array(i>1?i-1:0),s=1;i>s;s++)r[s-1]=arguments[s];return function(i,s){void 0===s&&(s=0);for(var n=[],a=i.split("\n"),o=Math.min(a.length,s+1e3),l=[],u=s;o>u;u++){var h=a[u];if(1024>=h.length){var v=ut.test(h)?h.replace(ut,"$1"):h;if(!v.match(/\S*Error: /)){for(var d of r){var c=d(v,t);if(c){n.push(c);var f=vt(n);if(f){for(var p=l.length-1;p>=0;p--){var g=l[p];if(f.start>=g.start+g.length)break;l.pop()}l.push(f)}break}}if(pt(n,l)>=50)break}}}var _=[...l].sort((t,i)=>i.start-t.start),b=_[_.length-1];if(b){var m=ct(n,b);for(var y of(n.splice(b.start-m,m),_))y.start-=m}for(var w of _)dt(n,w);return l.some(t=>0===t.start&&n.length===t.length)&&function(t){for(var i=t.map(t=>t.function+"|"+t.filename+"|"+t.lineno+"|"+t.colno+"|"+t.module),e=0,r=1;i.length>r;r++)gt(i,r,e)&&(e=r);t.push(...t.splice(0,e))}(n),function(t){if(!t.length)return[];var i=Array.from(t);return i.reverse(),i.slice(0,50).map(t=>{return e({},t,{filename:t.filename||(r=i,r[r.length-1]||{}).filename,function:t.function||Y});var r})}(n)}}("web:javascript",nt,lt)),this._instance=t,this.Bs=null!==(i=null==(r=this._instance.persistence)?void 0:r.get_property(ue))&&void 0!==i?i:[],this.Us=Ot(this.Vs()),this.qs=new Mt(this.Us)}onConfigChange(){this.Us=Ot(this.Vs()),this.qs.setConfig(this.Us)}onRemoteConfig(t){var i,e,r;if(t.ok){var s=t.config;if("errorTracking"in s){var n=null!==(i=null==(e=s.errorTracking)?void 0:e.suppressionRules)&&void 0!==i?i:[],a=null==(r=s.errorTracking)?void 0:r.captureExtensionExceptions;this.Bs=n,this._instance.persistence&&this._instance.persistence.register({[ue]:this.Bs,[he]:a})}}}get Ws(){var t,i=!!this._instance.get_property(he),e=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=e?e:i)&&void 0!==t&&t}buildProperties(t,i){return this.Hs.buildFromUnknown(t,{syntheticException:null==i?void 0:i.syntheticException,mechanism:{handled:null==i?void 0:i.handled}})}addExceptionStep(t,i){if(this.Us.enabled)try{if(!f(t)||0===t.trim().length)return void ms.warn("Ignoring exception step because message must be a non-empty string");var r=function(t){if(!t)return{sanitizedProperties:{},droppedKeys:[]};var i=[];return{sanitizedProperties:Object.keys(t).reduce((e,r)=>Rt.has(r)?(i.push(r),e):(e[r]=t[r],e),{}),droppedKeys:i}}(this.Ks(i)),s=r.sanitizedProperties,n=r.droppedKeys;n.length>0&&ms.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.qs.add(e({[Ct]:t,[Tt]:(new Date).toISOString()},s))}catch(t){ms.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{var i=t.$exception_list;if(this.Js(i)){if(this.Gs(i))return this.Xs("Exception dropped: matched a suppression rule"),void ms.info("Skipping exception capture because a suppression rule matched");if(!this.Ws&&this.Zs(i))return this.Xs("Exception dropped: thrown by a browser extension"),void ms.info("Skipping exception capture because it was thrown by an extension");if(!this.Ws&&this.Qs(i))return this.Xs("Exception dropped: thrown by an injected browser script"),void ms.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Ys(i))return this.Xs("Exception dropped: thrown by the PostHog SDK"),void ms.info("Skipping exception capture because it was thrown by the PostHog SDK")}var e=this.Us.enabled&&_(t.$exception_steps)?this.tn(t):t,r="string"==typeof(n=globalThis._posthogReleaseId)&&n.length>0?n:void 0;r&&(e.$release_id=r);try{var s=this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent",_originatedFromCaptureException:!0});return s&&this.qs.clear(),s}catch(t){return bs(t)||ms.error("Failed to capture exception event. Dropping this exception.",t),void this.qs.clear()}}catch(t){return void(bs(t)||ms.error("Failed to process exception event. Ignoring this exception.",t))}var n}tn(t){try{var i=this.qs.getAttachable();return 0===i.length?t:e({},t,{$exception_steps:i})}catch(i){return ms.error("Failed to read buffered exception steps. Capturing exception without steps.",i),t}}Xs(t){this.Us.enabled&&this.qs.add({[Ct]:t,[Tt]:(new Date).toISOString()})}Ks(t){return v(t)?e({},t):{}}Vs(){var t,i;return null!==(t=null==(i=this._instance.config.error_tracking)?void 0:i.exception_steps)&&void 0!==t?t:{}}Gs(t){if(0===t.length)return!1;try{var i=t.reduce((t,i)=>{var e=i.type,r=i.value;return f(e)&&e.length>0&&t.$exception_types.push(e),f(r)&&r.length>0&&t.$exception_values.push(r),t},{$exception_types:[],$exception_values:[]});return this.Bs.some(t=>{var e=t.values.map(t=>{var e=Wr[t.operator],r=i[t.key];if(!e||!r)return!1;var s=u(t.value)?t.value:[t.value];return s.length>0&&e(s,r)});return"OR"===t.type?e.some(Boolean):e.every(Boolean)})}catch(t){return ms.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}Zs(t){var i=t.flatMap(t=>{var i,e;return null!==(i=null==(e=t.stacktrace)?void 0:e.frames)&&void 0!==i?i:[]}),e=i.filter(t=>{var i=t.filename;return!!i&&Ss.some(t=>i.startsWith(t))});return 0!==e.length&&(!e.every(t=>{var i=t.filename;return!!i&&i.startsWith(ys)})||t.some(t=>{var i=t.value;return"NoResponse"===t.type||f(i)&&ws.some(t=>{var e=t.value;return t.exact?i===e:i.includes(e)})})&&!i.some(t=>{var i=t.filename;return t.in_app&&!(null!=i&&i.startsWith(ys))}))}Qs(t){return t.some(t=>{var i=t.value;return f(i)&&ks.some(t=>i.includes(t))})}Ys(t){if(t.length>0){var i,e,r,s,n=null!==(i=null==(e=t[0].stacktrace)?void 0:e.frames)&&void 0!==i?i:[],a=n[n.length-1];return null!==(r=null==a||null==(s=a.filename)?void 0:s.includes("posthog.com/static"))&&void 0!==r&&r}return!1}Js(t){return!_(t)&&u(t)}}},zs=e({productTours:class{get Ir(){return this._instance.persistence}constructor(t){this.en=null,this.rn=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(t.ok){var i=t.config;if("productTours"in i){var e,r;if(this.Ir&&this.Ir.register({[ce]:!!i.productTours}),!$r(this._instance))return!this.en&&_(null==(e=this.Ir)?void 0:e.props[$e])||Ir.info("product tours disabled; stopping and clearing cached tours"),null==(r=this.en)||r.stop(),this.en=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.en&&$r(this._instance)&&this.Gt(()=>this.sn())}Gt(t){var i,e;null!=(i=nr.__PosthogExtensions__)&&i.generateProductTours?t():null==(e=nr.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"product-tours",i=>{i?Ir.error("Could not load product tours script",i):t()})}sn(){var t;!this.en&&null!=(t=nr.__PosthogExtensions__)&&t.generateProductTours&&(this.en=nr.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,i){if(void 0===i&&(i=!1),!u(this.rn)||i){var e=this.Ir;if(e){var r=e.props[$e];if(u(r)&&!i)return this.rn=r,void t(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",timestampMode:"query",callback:i=>{if($r(this._instance)){var r=i.statusCode;if(200!==r||!i.json){var s="Product Tours API could not be loaded, status: "+r;return 0===r?i.error||Ir.warn(s):Ir.error(s),void t([],{isLoaded:!1,error:s})}var n=u(i.json.product_tours)?i.json.product_tours:[];this.rn=n,e&&e.register({[$e]:n}),t(n,{isLoaded:!0})}else t([],{isLoaded:!0})}})}else t(this.rn,{isLoaded:!0})}getActiveProductTours(t){_(this.en)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.en.getActiveProductTours(t)}showProductTour(t){var i;null==(i=this.en)||i.showTourById(t)}previewTour(t){this.en?this.en.previewTour(t):this.Gt(()=>{var i;this.sn(),null==(i=this.en)||i.previewTour(t)})}dismissProductTour(){var t;null==(t=this.en)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.en)||t.nextStep()}previousStep(){var t;null==(t=this.en)||t.previousStep()}clearCache(){var t;this.rn=null,null==(t=this.Ir)||t.unregister($e)}resetTour(t){var i;null==(i=this.en)||i.resetTour(t)}resetAllTours(){var t;null==(t=this.en)||t.resetAllTours()}cancelPendingTour(t){var i;null==(i=this.en)||i.cancelPendingTour(t)}}},js),Bs={siteApps:class{constructor(t){this.nn=0,this._instance=t,this.an=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}ln(t,i){if(i){var e=this.globalsForEvent(i);this.an.push(e),this.an.length>1e3&&(this.an=this.an.slice(10))}}get siteAppLoaders(){var t;return null==(t=nr._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.ln.bind(this));this.un=()=>{t(),this.an=[],this.un=void 0}}}globalsForEvent(t){var i,r,s,n,a,o,l;if(!t)throw new Error("Event payload is required");var u={},h=this._instance.get_property("$groups")||[],v=this._instance.get_property("$stored_group_properties")||{};for(var d of Object.entries(v)){var c=d[0];u[c]={id:h[c],type:c,properties:d[1]}}var f=t.$set_once,p=t.$set;return{event:e({},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}(t,jr),{properties:e({},t.properties,p?{$set:e({},null!==(i=null==(r=t.properties)?void 0:r.$set)&&void 0!==i?i:{},p)}:{},f?{$set_once:e({},null!==(s=null==(n=t.properties)?void 0:n.$set_once)&&void 0!==s?s:{},f)}:{}),elements_chain:null!==(a=null==(o=t.properties)?void 0:o.$elements_chain)&&void 0!==a?a:"",distinct_id:null==(l=t.properties)?void 0:l.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:u}}hn(t){var i,e=null==(i=t.tagName)?void 0:i.toLowerCase();return"style"===e&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(t)||(Lr.error("prepare_external_dependency_stylesheet returned null"),null):"script"===e&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(t)||(Lr.error("prepare_external_dependency_script returned null"),null):t}vn(){var t,i,e,r,s,n,a,o;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var l=null==oi?void 0:oi.defaultView,u=null==l||null==(t=l.Node)?void 0:t.prototype;if(!l||!u)return()=>{};if(this.nn++,this.dn)return this.cn();var h=[],v=this,d=new WeakSet,c=(t,i,e)=>{if(null!=t&&t[i]){var r=t[i];t[i]=e(r),h.push(()=>{t[i]=r})}},f=t=>{if(d.has(t))return t;var i=v.hn(t);return i&&d.add(i),i},p=t=>t.map(t=>"string"==typeof t?t:f(t)).filter(t=>!g(t));return c(u,"appendChild",t=>function(i){var e=f(i);return e?t.call(this,e):i}),c(u,"insertBefore",t=>function(i,e){var r=f(i);return r?t.call(this,r,e):i}),c(u,"replaceChild",t=>function(i,e){var r=f(i);return r?t.call(this,r,e):e}),[null==(i=l.Element)?void 0:i.prototype,null==(e=l.Document)?void 0:e.prototype,null==(r=l.DocumentFragment)?void 0:r.prototype].forEach(t=>{c(t,"append",t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,p(e))}),c(t,"prepend",t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,p(e))})}),[null==(s=l.Element)?void 0:s.prototype,null==(n=l.CharacterData)?void 0:n.prototype,null==(a=l.DocumentType)?void 0:a.prototype].forEach(t=>{c(t,"before",t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,p(e))}),c(t,"after",t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,p(e))}),c(t,"replaceWith",t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];var s=p(e);return e.length&&!s.length?void 0:t.apply(this,s)})}),c(null==(o=l.Element)?void 0:o.prototype,"insertAdjacentElement",t=>function(i,e){var r=f(e);return r?t.call(this,i,r):null}),this.dn=()=>{h.forEach(t=>t()),this.dn=void 0},this.cn()}cn(){var t=!1;return()=>{var i;t||(t=!0,this.nn--,0===this.nn&&(null==(i=this.dn)||i.call(this)))}}fn(t,i){void 0===i&&(i=!0);var e=this.vn();try{var r=t(e);return i&&e(),r}catch(t){throw e(),t}}setupSiteApp(t){var i=this.apps[t.id],e=()=>{var e;!i.errored&&this.an.length&&(Lr.info("Processing "+this.an.length+" events for site app with id "+t.id),this.an.forEach(t=>this.fn(()=>null==i.processEvent?void 0:i.processEvent(t))),i.processedBuffer=!0),Object.values(this.apps).every(t=>t.processedBuffer||t.errored)&&(null==(e=this.un)||e.call(this))},r=!1,s=s=>{i.errored=!s,i.loaded=!0,Lr.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&e()};try{var n=this.fn(i=>t.init({posthog:this._instance,callback(t){i(),s(t)}}),!1).processEvent;n&&(i.processEvent=n),r=!0}catch(i){Lr.error(Dr+t.id,i),s(!1)}if(r&&i.loaded)try{e()}catch(e){Lr.error("Error while processing buffered events PostHog app with config id "+t.id,e),i.errored=!0}}pn(){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)}gn(t){var i=this;if(0!==Object.keys(this.apps).length){var e=this.globalsForEvent(t),r=function(r){try{i.fn(()=>null==r.processEvent?void 0:r.processEvent(e))}catch(i){Lr.error("Error while processing event "+t.event+" for site app "+r.id,i)}};for(var s of Object.values(this.apps))r(s)}}onRemoteConfig(t){var i,e,r,s=this;if(null!=(i=this.siteAppLoaders)&&i.length)return this.isEnabled?(this.pn(),void this._instance.on("eventCaptured",t=>this.gn(t))):void Lr.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(e=this.un)||e.call(this),t.ok){var n=t.config;if(null!=(r=n.siteApps)&&r.length)if(this.isEnabled){var a=function(){var t,i=o.id,e=o.url;nr["__$$ph_site_app_"+i]=s._instance,null==(t=nr.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(s._instance,e,t=>{if(t)return Lr.error(Dr+i,t)})};for(var o of n.siteApps)a()}else Lr.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},Hs={tracingHeaders:class{constructor(t){this._n=void 0,this.bn=void 0,this.mn=void 0,this.As=()=>{var t,i,e=this.yn();e?(c(this._n)&&(this._n=null==(t=nr.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchXHR(e,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),c(this.bn)&&(this.bn=null==(i=nr.__PosthogExtensions__)||null==(i=i.tracingHeadersPatchFns)?void 0:i._patchFetch(e,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.Ls()},this._instance=t}initialize(){this.startIfEnabledOrStop()}Gt(t){var i,e;null!=(i=nr.__PosthogExtensions__)&&i.tracingHeadersPatchFns?t():null==(e=nr.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"tracing-headers",i=>{if(i)return cr.error("failed to load script",i);t()})}wn(){var t,i;return null!==(t=null!==(i=this._instance.config.tracing_headers)&&void 0!==i?i:this._instance.config.addTracingHeaders)&&void 0!==t?t:this._instance.config.__add_tracing_headers}yn(){var t=this.wn();return u(t)?(u(this.mn)?this.mn.splice(0,this.mn.length,...t):this.mn=[...t],t.length>0?this.mn:void 0):(u(this.mn)&&this.mn.splice(0),this.mn=t||void 0,this.mn)}Ls(){var t,i;null==(t=this._n)||t.call(this),null==(i=this.bn)||i.call(this),this._n=void 0,this.bn=void 0}startIfEnabledOrStop(){this.yn()?this.Gt(this.As):this.Ls()}}},Us=e({surveys:class extends Yr{constructor(t){var i;super(new as(t),(i=t,{get projectToken(){return i.config.token},kv:new ns(i)})),this._instance=t}ci(t,i){var r=i.query?function(t,i,r){var s;void 0===r&&(r=!0);var n=t.split("?"),a=n[0],o=n[1],l=e({},i),u=null!==(s=null==o?void 0:o.split("&").map(t=>{var i,e=t.split("="),s=e[0],n=r&&null!==(i=l[s])&&void 0!==i?i:e[1];return delete l[s],s+"="+n}))&&void 0!==s?s:[],h=function(t,i){var e,r;void 0===i&&(i="&");var s=[];return ci(t,function(t,i){c(t)||c(i)||"undefined"===i||(e=encodeURIComponent(t instanceof File?t.name:t.toString()),r=encodeURIComponent(i),s[s.length]=r+"="+e)}),s.join(i)}(l);return h&&u.push(h),u.length>0?a+"?"+u.join("&"):a}(t,i.query):t;return new Promise(t=>{var e;this._instance._send_request({method:i.method,url:this._instance.requestRouter.endpointFor(null!==(e=i.target)&&void 0!==e?e:"api",r),data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,timestampMode:i.sentAt,callback:t})})}}},js),Vs={toolbar:class{constructor(t){this.instance=t}Sn(t){nr.ph_toolbar_state=t}kn(){var t;return null!==(t=nr.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t,i,e){if(void 0===t&&(t=void 0),void 0===i&&(i=void 0),void 0===e&&(e=void 0),bi(this.instance.config))return!1;if(!si||!oi)return!1;t=null!=t?t:si.location,e=null!=e?e:si.history;try{if(!i){try{si.localStorage.setItem("test","test"),si.localStorage.removeItem("test")}catch(t){return!1}i=null==si?void 0:si.localStorage}var r,s=os||Je(t.hash,"__posthog")||Je(t.hash,"state"),n=s?gi(()=>JSON.parse(atob(decodeURIComponent(s))))||gi(()=>JSON.parse(decodeURIComponent(s))):null;return n&&"ph_authorize"===n.action?((r=n).source="url",r&&Object.keys(r).length>0&&(n.desiredHash?t.hash=n.desiredHash:e?e.replaceState(e.state,"",t.pathname+t.search):t.hash="")):((r=JSON.parse(i.getItem(ls)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}xn(t){var i=nr.ph_load_toolbar||nr.ph_load_editor;!_(i)&&h(i)?i(t,this.instance):us.warn("No toolbar load function found")}loadToolbar(t){var i=!(null==oi||!oi.getElementById(yi));if(!si||i)return!1;var r="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=e({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(si.localStorage.setItem(ls,JSON.stringify(e({},s,{source:void 0}))),2===this.kn())this.xn(s);else if(0===this.kn()){var n;this.Sn(1),null==(n=nr.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",t=>{if(t)return us.error("[Toolbar] Failed to load",t),void this.Sn(0);this.Sn(2),this.xn(s)}),_i(si,"turbolinks:load",()=>{this.Sn(0),this.loadToolbar(s)})}return!0}En(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)}}},qs=e({experiments:Fs},js),Ws={conversations:class{constructor(t){this.Fn=void 0,this._conversationsManager=null,this.Pn=!1,this.Cn=null,this.Tn=!1,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations&&(this.Rn=t.ok,t.ok)){var i=t.config.conversations;_(i)||(m(i)?this.Fn=i:(this.Fn=i.enabled,this.Cn=i),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.Fn=void 0,this.Cn=null,this.Rn=void 0,this.Tn=!1}loadIfEnabled(){if(!(this._conversationsManager||this.Pn||this._instance.config.disable_conversations||bi(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==nr?void 0:nr.__PosthogExtensions__;if(t&&!c(this.Fn)&&this.Fn)if(this.Cn&&this.Cn.token){this.Pn=!0;try{var i=t.initConversations;if(i)return this.An(i),void(this.Pn=!1);var e=t.loadExternalDependency;if(!e)return void this.On(Ue);e(this._instance,"conversations",i=>{i||!t.initConversations?this.On("Could not load conversations script",i):this.An(t.initConversations),this.Pn=!1})}catch(t){this.On("Error initializing conversations",t),this.Pn=!1}}else Ps.error("Conversations enabled but missing token in remote config.")}}An(t){if(this.Cn)try{this._conversationsManager=t(this.Cn,this._instance),this.Tn=!1,Ps.info("Conversations loaded successfully")}catch(t){this.On("Error completing conversations initialization",t)}else Ps.error("Cannot complete initialization: remote config is null")}On(t,i){Ps.error(t,i),this._conversationsManager=null,this.Pn=!1,this.Tn=!0}show(){this._conversationsManager?this._conversationsManager.show():Ps.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Fn&&!g(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":bi(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.Rn?"remote_config_failed":c(this.Fn)?this.Rn?"disabled_in_project":"remote_config_pending":this.Fn?_(this.Cn)||!this.Cn.token?"missing_token":null!=nr&&nr.__PosthogExtensions__?this.Pn?"initializing":this.Tn?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.isVisible())&&void 0!==t&&t}sendMessage(t,e,r){var s=this;return i(function*(){return s._conversationsManager?s._conversationsManager.sendMessage(t,e,r):(Ps.warn(Cs),null)})()}getMessages(t,e){var r=this;return i(function*(){return r._conversationsManager?r._conversationsManager.getMessages(t,e):(Ps.warn(Cs),null)})()}markAsRead(t){var e=this;return i(function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(Ps.warn(Cs),null)})()}getTickets(t){var e=this;return i(function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(Ps.warn(Cs),null)})()}requestRestoreLink(t){var e=this;return i(function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(Ps.warn(Cs),null)})()}restoreFromToken(t){var e=this;return i(function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(Ps.warn(Cs),null)})()}restoreFromUrlToken(){var t=this;return i(function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(Ps.warn(Cs),null)})()}getCurrentTicketId(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.getCurrentTicketId())&&void 0!==t?t:null}getWidgetSessionId(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.getWidgetSessionId())&&void 0!==t?t:null}_onIdentityChanged(){var t;null==(t=this._conversationsManager)||t.setIdentity()}_onIdentityCleared(){var t;null==(t=this._conversationsManager)||t.clearIdentity()}}},Ks={logs:class{constructor(t){var i,r=this;this.name="logs",this.Mn=!1,this.In=!1,this.$n=!1,this.l=di("[logs]"),this.jn=e({},this.l,{error(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];i.some($s)||r.l.error(...i)}}),this.Ln=[],this.Dn=[],this.Ve=0,this.Dt=!1,this.Nn=[],this.zn=[],this.Bn=!1,this.Hn=!1,this.Un=()=>{var t,i;this.Dt||(this.Ve=0,null==(t=this.Vn)||t.onReconnect(),null==(i=this.qn)||i.onReconnect())},this._instance=t,this._instance&&null!=(i=this._instance.config.logs)&&i.captureConsoleLogs&&(this.Mn=!0),si&&_i(si,"online",this.Un)}Wn(t,i,e,r){var s,n=Rs(null==(s=this._instance)||null==(s=s.config)?void 0:s.logs,e);return[new Qt(this.Kn(t,i),n,this.jn,()=>this.Jn(),t=>t(),void 0,r),n]}Gn(){var t,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.Vn||this.Xn!==i){var e;null==(e=this.Vn)||e.reset(),this.Xn=i;var r=this.Wn(()=>this.Ln,t=>{this.Ln=t});this.Vn=r[0],this.Zn=r[1]}return this.Vn}Qn(){var t,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.qn||this.Yn!==i){var e;null==(e=this.qn)||e.reset(),this.Yn=i;var r=this.Wn(()=>this.Dn,t=>{this.Dn=t},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Os);this.qn=r[0],this.ta=r[1]}return this.qn}setup(t){var i;if(!this.Dt){this.Ot=t,null!=(i=this._instance)&&null!=(i=i.config)&&null!=(i=i.logs)&&i.captureConsoleLogs&&(this.Mn=!0),(this.Mn||this.ia()&&this.ea())&&this.ra();var e=!1,r=t.onRemoteConfig(t=>{var i;e=t.ok&&!0===(null==(i=t.config.logs)?void 0:i.captureConsoleLogs),this.onRemoteConfig(t)});this.Dt?r.dispose():(this.Ht=r,e||this.loadIfEnabled())}}dispose(){var t,i,e,r;this.Dt||(this.Dt=!0,this.sa(),null==(t=this.Ht)||t.dispose(),this.Ht=void 0,this.Ot=void 0,this.$n=!1,null==si||si.removeEventListener("online",this.Un),null==(i=this.na)||i.call(this),this.na=void 0,null==(e=this.Vn)||e.reset(),null==(r=this.qn)||r.reset())}onRemoteConfig(t){var i,e;if(!this.Dt){var r=t.ok?null==(i=t.config.logs)?void 0:i.captureConsoleLogs:void 0;_(r)?this.aa():(null==(e=this._instance)||null==(e=e.persistence)||e.register({[fe]:!!r}),r?(this.Mn=!0,this.In||this.ra(),this.loadIfEnabled()):this.aa())}}reset(){var t,i,e,r;this.sa(),null==(t=this.Vn)||t.clearQueue(),this.Ln=[],null==(i=this.Vn)||i.reset(),null==(e=this.qn)||e.clearQueue(),this.Dn=[],null==(r=this.qn)||r.reset(),this.Ve=0}captureLog(t){this.Dt||this.Gn().captureLog(t)}captureConsoleLog(t){this.Dt||this.Qn().captureLog(t)}captureBufferedConsoleLog(t,i,e){this.Dt||this.Qn().captureLog(t,{context:i,occurredAtMs:e})}ea(){var t;return!(null==(t=this._instance)||null==(t=t.persistence)||null==(t=t.props)||!t[fe])}ia(){var t,i;return null==(t=this._instance)||null==t._shouldDisableFlags||!t._shouldDisableFlags()||!(null==(i=nr._POSTHOG_REMOTE_CONFIG)||null==(i=i[this._instance.config.token])||!i.config)}_onOptOut(){var t;this.sa(),null==(t=this.qn)||t.clearQueue(),this.Dn=[]}aa(){this.Mn||this.sa()}ra(){var t,i=this;if(!this.Bn&&null!=nr&&nr.console){var e=Rs(null==(t=this._instance)||null==(t=t.config)?void 0:t.logs).maxBufferSize,r=function(t){var r;try{r=(t=>{for(;null!=(i=t)&&i.__rrweb_original__;){var i;t=t.__rrweb_original__}return t})(nr.console[t])}catch(t){return 0}if(!r)return 0;i.zn.push(dr(nr.console,t,s=>{var n=function(){for(var r=arguments.length,n=new Array(r),a=0;r>a;a++)n[a]=arguments[a];try{i.oa(t,n,e)}catch(t){}return s.apply(nr.console,n)};return n.__rrweb_original__=r,n}))};for(var s of As)r(s);this.Bn=!0,this.la=setTimeout(()=>{this.sa()},3e4)}}oa(t,i,e){var r;if(this.Bn&&!this.Hn&&0!==i.length)if(null!=(r=this._instance)&&r.is_capturing()){if(e>this.Nn.length){this.Hn=!0;try{this.Nn.push({level:t,args:i,occurredAtMs:Date.now(),context:this.Jn()})}finally{this.Hn=!1}}}else this.sa()}sa(){if(this.Nn=[],this.Bn){for(var t of(this.Bn=!1,this.la&&(clearTimeout(this.la),this.la=void 0),this.zn))t();this.zn=[]}}ua(){var t=this.Nn;return this.sa(),t}get logger(){return this.ha||(this.ha={trace:(t,i)=>this.captureLog({body:t,level:"trace",attributes:i}),debug:(t,i)=>this.captureLog({body:t,level:"debug",attributes:i}),info:(t,i)=>this.captureLog({body:t,level:"info",attributes:i}),warn:(t,i)=>this.captureLog({body:t,level:"warn",attributes:i}),error:(t,i)=>this.captureLog({body:t,level:"error",attributes:i}),fatal:(t,i)=>this.captureLog({body:t,level:"fatal",attributes:i})}),this.ha}flushLogs(t){t?this.va(t):(this.Vn&&this.Vn.flush().catch(t=>this.da(t)),this.qn&&this.qn.flush().catch(t=>this.da(t)))}da(t){$s(t)||this.l.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(!this.Dt&&this.Mn&&!this.In&&!this.$n){var t=null==nr?void 0:nr.__PosthogExtensions__;if(!t)return this.l.error("PostHog Extensions not found."),void this.sa();var i=t.loadExternalDependency;if(!i)return this.l.error(Ue),void this.sa();this.$n=!0;try{i(this._instance,"logs",i=>{if(this.$n=!1,!this.Dt&&this.Mn){var e=t.logs;if(i||null==e||!e.initializeLogs)this.l.error("Could not load logs script",i),this.sa();else{var r,s,n=this.ua();this.na=e.initializeLogs(null!==(r=this.Ot)&&void 0!==r?r:this._instance),this.In=!0,n.length>0&&(null==e.replayConsoleBuffer||e.replayConsoleBuffer(null!==(s=this.Ot)&&void 0!==s?s:this._instance,n))}}})}catch(t){throw this.$n=!1,t}}}Kn(t,i){var e=this._instance;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},getPersistedProperty:i=>i===r.LogsQueue?t():void 0,setPersistedProperty(t,e){var s;t===r.LogsQueue&&i(null!==(s=e)&&void 0!==s?s:[])},it:t=>this.it(t),getLibraryId:()=>ri.LIB_NAME,getLibraryVersion:()=>ri.LIB_VERSION}}it(t){return new Promise(i=>{if(Ge(this.Ve,3))i({kind:"fatal",error:Is(void 0,"logs endpoint is unreachable, dropping batch")});else{var e=!1,r=t=>{e||(e=!0,clearTimeout(s),i(t))},s=setTimeout(()=>{this.l.warn("Logs request timed out before receiving a response"),r({kind:"retry-later",error:Is(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this.ca(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:t=>{var i=t.statusCode;if(this.fa(i),i>=200&&300>i)r({kind:"ok"});else if(413===i)r({kind:"too-large"});else if(0!==i&&408!==i&&429!==i&&500>i)r({kind:"fatal",error:new Error("logs request failed with status "+i)});else{var e;0===i?(t.error||this.l.warn("Logs request failed before receiving an HTTP response"),r({kind:"retry-later",error:Is(t.error,"logs request failed before receiving an HTTP response")})):r({kind:"retry-later",error:null!==(e=t.error)&&void 0!==e?e:new Error("logs request failed with status "+i)})}}})}})}fa(t){(0!==t||this._instance.__loaded)&&(this.Ve=Xe(t,this.Ve,3,()=>this.l.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes.")))}va(t){this.Ln.length>0&&this.pa(t,this.Ln,this.Zn,ri.LIB_NAME,t=>{this.Ln=t}),this.Dn.length>0&&this.pa(t,this.Dn,this.ta,Os,t=>{this.Dn=t})}pa(t,i,e,r,s){if(0!==i.length){var n=i.map(t=>t.record);s([]);var a=Zt(n,Xt(e,ri.LIB_NAME,ri.LIB_VERSION),r,ri.LIB_VERSION);this._instance._send_request({method:"POST",url:this.ca(),data:a,compression:"best-available",batchKey:"logs",transport:t})}}ca(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}Jn(){var t,i={};if(i.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var e=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),r=e.windowId,s=e.sessionStartTimestamp,n=e.lastActivityTimestamp;i.sessionId=e.sessionId,i.windowId=r,_(s)||(i.sessionStartTimestamp=s),_(n)||(i.lastActivityTimestamp=n)}if(null!=nr&&null!=(t=nr.location)&&t.href&&(i.currentUrl=this._instance.config.disable_capture_url_hashes?K(nr.location.href):nr.location.href),this._instance.featureFlags){var a=this._instance.featureFlags.getFlags();a&&a.length>0&&(i.activeFeatureFlags=a)}return i}}},Js={metrics:class{constructor(t){this.l=di("[metrics]"),this._instance=t}initialize(){}Gn(){var t,i,e=null==(t=this._instance)||null==(t=t.config)?void 0:t.metrics;return this.Vn&&this.Xn===e||(null==(i=this.Vn)||i.reset(),this.Xn=e,this.Vn=new ei(this.Kn(),function(t){var i,e,r,s,n,a=null==t?void 0:t.resourceAttributes;return{serviceName:null!==(i=null==a?void 0:a["service.name"])&&void 0!==i?i:null==t?void 0:t.serviceName,serviceVersion:null!==(e=null==a?void 0:a["service.version"])&&void 0!==e?e:null==t?void 0:t.serviceVersion,environment:null!==(r=null==a?void 0:a["deployment.environment"])&&void 0!==r?r:null==t?void 0:t.environment,resourceAttributes:a,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:null!==(s=null==t?void 0:t.flushIntervalMs)&&void 0!==s?s:1e4,maxSeriesPerFlush:null!==(n=null==t?void 0:t.maxSeriesPerFlush)&&void 0!==n?n:1e3}}(e),this.l)),this.Vn}count(t,i,e){void 0===i&&(i=1),this.Gn().count(t,i,e)}gauge(t,i,e){this.Gn().gauge(t,i,e)}histogram(t,i,e){this.Gn().histogram(t,i,e)}flush(t){if(!this.Vn)return Promise.resolve();if(t){var i=this.Vn.drainWindow();return i&&this.St(i,t),Promise.resolve()}return this.Vn.flush().catch(t=>this.l.error("PostHog metrics flush failed:",t))}reset(){var t;null==(t=this.Vn)||t.reset()}Kn(){var t=this._instance,i=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},St:t=>i.St(t),getLibraryId:()=>ri.LIB_NAME,getLibraryVersion:()=>ri.LIB_VERSION}}St(t,i){return new Promise(r=>{var s=!1,n=t=>{s||(s=!0,clearTimeout(a),r(t))},a=setTimeout(()=>n({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(e({method:"POST",url:this.ga(),data:t,compression:"best-available",batchKey:"metrics"},i&&{transport:i},{fireCallbackOnDrop:!0,callback(t){var i=t.statusCode;if(i>=200&&300>i)n({kind:"ok"});else if(413===i)n({kind:"too-large"});else if(0!==i&&408!==i&&429!==i&&500>i)n({kind:"fatal",error:new Error("metrics request failed with status "+i)});else{var e;n({kind:"retry-later",error:null!==(e=t.error)&&void 0!==e?e:new Error("metrics request failed with status "+i)})}}}))})}ga(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},Gs=e({},js,Ls,Ds,Ns,zs,Bs,Us,Hs,Vs,qs,Ws,Ks,Js),Xs=js,Zs=Ls,Qs=Ds,Ys=Ns,tn=zs,en=Bs,rn=Us,sn=Hs,nn=Vs,an=qs,on=Ws,ln=Ks,un=Js;export{Gs as AllExtensions,Qs as AnalyticsExtensions,on as ConversationsExtensions,Ys as ErrorTrackingExtensions,an as ExperimentsExtensions,Xs as FeatureFlagsExtensions,ln as LogsExtensions,un as MetricsExtensions,tn as ProductToursExtensions,Zs as SessionReplayExtensions,en as SiteAppsExtensions,rn as SurveysExtensions,nn as ToolbarExtensions,sn as TracingExtensions};
|
|
2
2
|
//# sourceMappingURL=extension-bundles.js.map
|