posthog-js
Version:
Posthog-js allows you to automatically capture usage and send events to PostHog.
2 lines • 186 kB
JavaScript
var t=["$set_once","$set"];function i(){return i=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},i.apply(null,arguments)}function e(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 r(t){return function(){var i=this,r=arguments;return new Promise(function(s,n){var a=t.apply(i,r);function o(t){e(a,s,n,o,l,"next",t)}function l(t){e(a,s,n,o,l,"throw",t)}o(void 0)})}}var s=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.SurveysInProgress="surveys_in_progress",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t}({});function n(t,i){return-1!==t.indexOf(i)}var a=function(t){return t.trim()},o=Object.prototype,l=o.hasOwnProperty,u=o.toString,h=Array.isArray||function(t){return"[object Array]"===u.call(t)},v=t=>"function"==typeof t,d=t=>t===Object(t)&&!h(t),c=t=>{if(d(t)){for(var i in t)if(l.call(t,i))return!1;return!0}return!1},f=t=>void 0===t,p=t=>"[object String]"==u.call(t),g=t=>p(t)&&0===t.trim().length,_=t=>null===t,b=t=>f(t)||_(t),m=t=>"[object Number]"==u.call(t)&&t==t,y=t=>"[object Boolean]"===u.call(t);function w(t){return null===t||"object"!=typeof t}function S(t,i){return{}.toString.call(t)==="[object "+i+"]"}function k(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 E(t,Error)}}function x(t){return"u">typeof Event&&E(t,Event)}function E(t,i){try{return t instanceof i}catch(t){return!1}}var P=["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=new Map,A=function(t,i){if(void 0===i&&(i=[]),!t)return!1;var e=function(t,i){for(var e="",r=0;i.length>r;r++){var s=i[r];e+=s.length+":"+s}return t.length+":"+t+"|"+i.length+":"+e}(t,i),r=F.get(e);if(void 0!==r)return r;var s=t.toLowerCase(),n=P.concat(i).some(t=>-1!==s.indexOf(t.toLowerCase()));return 256>F.size||F.clear(),F.set(e,n),n};function T(t,i,e,r,s){return i>e&&(r.warn("min cannot be greater than max."),i=e),m(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),T(null!=s?s:e,i,e,r))}var C=class{constructor(t){this.C={},this.I=t.I,this.R=T(t.bucketSize,0,100,t.$),this.A=T(t.refillRate,0,this.R,t.$),this.O=T(t.refillInterval,0,864e5,t.$)}F(t,i){var e=Math.floor((i-t.lastAccess)/this.O);e>0&&(t.tokens=Math.min(t.tokens+e*this.A,this.R),t.lastAccess=t.lastAccess+e*this.O)}consumeRateLimit(t){var i,e=Date.now(),r=String(t),s=this.C[r];return s?this.F(s,e):this.C[r]=s={tokens:this.R,lastAccess:e},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(i=this.I)||i.call(this,t)),0===s.tokens)}stop(){this.C={}}},R="Mobile",O="Android",M="Nintendo",I="PlayStation",j="Xbox",L="Windows";R.toLowerCase(),"Tablet".toLowerCase(),new RegExp(j,"i");var D=new RegExp("BlackBerry|PlayBook|BB10","i"),N={"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"},z=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),t=>[j,t&&t[1]||""]],[new RegExp(M,"i"),[M,""]],[new RegExp(I,"i"),[I,""]],[D,["BlackBerry",""]],[new RegExp(L,"i"),(t,i)=>{if(/Phone/.test(i)||/WPDesktop/.test(i))return["Windows Phone",""];if(new RegExp(R).test(i)&&!/IEMobile\b/.test(i))return["Windows Mobile",""];var e=/Windows NT ([0-9.]+)/i.exec(i);if(e&&e[1]){var r=N[e[1]]||"";return/arm/i.test(i)&&(r="RT"),[L,r]}return[L,""]}],[/((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=f(t[2])?t[3]:t[2]),["watchOS",i]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),t=>t&&t[2]?[O,[t[2],t[3],t[4]||"0"].join(".")]:[O,""]],[/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",""]]],H="[Truncated]",U="[Unserializable]";function B(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 q(t,i){if(!i)return t;var e=[];try{e=Object.keys(i)}catch(t){e=[]}for(var r of e){var s=void 0;try{s=i[r]}catch(t){s=U}Object.defineProperty(t,r,{value:s,enumerable:!0,writable:!0,configurable:!0})}return t}Date,Date;var V,W,K,G,J=3e5,X=class{record(t){if("too-large"!==t.kind)if("retry-later"===t.kind){if(t.retryAfterMs){var i=this.isOpen(),e=Date.now(),r=Math.min(t.retryAfterMs,J);if(!i)return this.ts=e,void(this.es=e+r);this.es=Math.max(this.es,Math.min(e+r,this.ts+J))}}else this.reset()}remainingMs(){var t=Date.now();if(this.ts-5e3>t)return this.reset(),0;var i=Math.min(J,Math.max(0,this.es-t));return 0===i&&this.reset(),i}isOpen(){return this.remainingMs()>0}reset(){this.es=0,this.ts=0}constructor(){this.es=0,this.ts=0}};function Z(t){return t?t.split("#")[0]:t}function Q(t){try{return t()}catch(t){return}}function Y(t,i){var e=setTimeout(t,i);return null!=e&&e.unref&&(null==e||e.unref()),e}function tt(t,i,e){return it.apply(this,arguments)}function it(){return(it=r(function*(t,i,e){var r;try{return yield Promise.race([t,new Promise((t,s)=>{r=Y(()=>{try{null==e||e(),t()}catch(t){s(t)}},i)})])}finally{clearTimeout(r)}})).apply(this,arguments)}function et(t){var e=globalThis._posthogChunkIds,r=globalThis._debugIds;if(e||r){var s=e?Object.keys(e):[],n=r?Object.keys(r):[];if(G&&rt(e,s,W)&&rt(r,n,K))return G;W=e?i({},e):void 0,K=r?i({},r):void 0,G={},null!=V||(V={});var a=(i,e)=>{for(var r of i){var s,n=e[r];if(n){var a=null==(s=V)?void 0:s[r];if(a)G[a]=n;else for(var o=t(r),l=o.length-1;l>=0;l--){var u,h=null==(u=o[l])?void 0:u.filename;if(h){G[h]=n,V[r]=h;break}}}}};return r&&a(n,r),e&&a(s,e),G}}function rt(t,i,e){return t&&e?i.length===Object.keys(e).length&&i.every(i=>t[i]===e[i]):t===e}var st=class{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 i=this;return r(function*(){for(var e of t)e.stacktrace&&e.stacktrace.frames&&h(e.stacktrace.frames)&&(e.stacktrace.frames=yield i.applyModifiers(e.stacktrace.frames));return t})()}coerceFallback(t){var i;return{type:"Error",value:"Unknown error",stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}parseStacktrace(t,e){var r,s,n;if(null!=t.cause&&(s=this.parseStacktrace(t.cause,e)),""!=t.stack&&null!=t.stack)try{n=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?e.skipFirstLines:0),e.chunkIdMap)}catch(t){}return i({},t,{cause:s,stack:n,errors:null==(r=t.errors)?void 0:r.map(t=>this.parseStacktrace(t,e))})}applyChunkIds(t,i){return t.map(t=>(t.filename&&i&&(t.chunk_id=i[t.filename]),t))}applyCoercers(t,i){for(var e of this.coercers)if(e.match(t))return e.coerce(t,i);return this.coerceFallback(i)}applyModifiers(t){var i=this;return r(function*(){var e=t;for(var r of i.modifiers)e=yield r(e);return e})()}convertToExceptionList(t,e){var r=[],s=(t,n,a)=>{var o=r.length,l=void 0===n?i({type:"string"==typeof e.type&&e.type.length>0?e.type:"generic"},"boolean"==typeof e.handled?{handled:e.handled}:void 0===e.handled?{handled:!0}:{},{synthetic:"boolean"==typeof e.synthetic?e.synthetic:t.synthetic,exception_id:o}):{type:"chained",source:a,synthetic:t.synthetic,exception_id:o,parent_id:n},u={type:t.type,value:t.value,mechanism:l};for(var h of(t.stack&&(u.stacktrace={type:"raw",frames:t.stack}),r.push(u),t.cause&&s(t.cause,o,"cause"),null!==(v=t.errors)&&void 0!==v?v:[])){var v;s(h,o,"member")}};return s(t),r}buildParsingContext(t){var i;return{chunkIdMap:et(this.stackParser),skipFirstLines:null!==(i=t.skipFirstLines)&&void 0!==i?i:1}}getAggregateErrors(t){try{if(k(t))for(var i=Object.getPrototypeOf(t),e=0;i&&100>e;e++){var r,s=null==(r=Object.getOwnPropertyDescriptor(i,"constructor"))?void 0:r.value;if("function"==typeof s&&"AggregateError"===s.name){var n=t.errors;return h(n)?n:void 0}i=Object.getPrototypeOf(i)}}catch(t){}}buildCoercingContext(t,e,r){var s=this;void 0===r&&(r=0);var n=0,a=0,o=!1,l=new Set,u=[],h={},v=function(t,e,r){void 0===r&&(r=0);var v=d(e,r),c=v.apply;if(v.apply=i=>{u.push(t);try{return c(i)}finally{u.pop()}},r>4||r>0&&-1!==u.indexOf(t))return s.coerceFallback(v);var f="object"==typeof t&&null!==t||"function"==typeof t;if(!(0===r&&n>=50||f&&l.has(t))){f&&l.add(t),0===r&&n++;var p,g,_=s.getAggregateErrors(t);o||(o=!!_);try{if(!(p=s.applyCoercers(t,v)))throw h}catch(t){if(t===h)return void(0===r&&n--);if(!o)throw t;p=s.coerceFallback(v)}if(!_||n>=50)return p;try{g=_.length}catch(t){return p}if(!Number.isInteger(g)||0>g||g>4294967295)return p;for(var b=[],m=0;50>n&&1e3>a&&g>m;m++){a++;var y=void 0;try{y=v.next(_[m])}catch(t){n++,y=s.coerceFallback(d(e+1))}y&&b.push(y)}return i({},p,{errors:b})}},d=function(r,s){return void 0===s&&(s=0),i({},e,{syntheticException:0==r?e.syntheticException:void 0,mechanism:0==r?t:{},apply(t){var i=v(t,r,s+1);if(!i)throw h;return i},next:t=>v(t,r+1)})},c=d(r);return i({},c,{apply:t=>{var i;return null!==(i=v(t,r))&&void 0!==i?i:this.coerceFallback(c)}})}},nt=/^([a-z][a-z0-9.+-]+):/i,at=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function ot(t){if(!t||"<anonymous>"===t)return!1;var i=nt.exec(t);return!i||at.includes(i[1].toLowerCase())}function lt(t,i,e,r,s){var n={platform:t,filename:i,function:"<anonymous>"===e?"?":e,in_app:ot(i)};return f(r)||(n.lineno=r),f(s)||(n.colno=s),n}var ut=(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]:"?",e?"safari-extension:"+i:"safari-web-extension:"+i]:[t,i]},ht=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,vt=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,dt=/\((\S*)(?::(\d+))(?::(\d+))\)/,ct=(t,i)=>{var e=ht.exec(t);if(e)return lt(i,e[1],"?",+e[2],+e[3]);var r=vt.exec(t);if(r){if(r[2]&&0===r[2].indexOf("eval")){var s=dt.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}var n=ut(r[1]||"?",r[2]);return lt(i,n[1],n[0],r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},ft=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,pt=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,gt=(t,i)=>{var e=ft.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){var r=pt.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]||"?",a=ut(n,s);return lt(i,s=a[1],n=a[0],e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},_t=/\(error: (.*)\)/;function bt(t,i){return t.filename===i.filename&&t.function===i.function&&t.module===i.module&&t.lineno===i.lineno&&t.colno===i.colno}function mt(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(!bt(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 yt(t,i){var e=i.start+i.length,r=St(t,i);r&&t.splice(e+r===t.length?e:i.start,r)}function wt(t,i){for(var e=i.start;e>0&&bt(t[e-1],t[e-1+i.length]);)e--;return i.start-e}function St(t,i){for(var e=i.start+i.length,r=e;t.length>r&&bt(t[r],t[r-i.length]);)r++;return r-e}function kt(t,i){var e=i[0],r=t.length-(e?wt(t,e):0);for(var s of i)r-=St(t,s);return r}function xt(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}var Et=class{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,i){var e=p(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 S(t,"DOMException")}isDOMError(t){return S(t,"DOMError")}},Pt=class{match(t){return k(t)}coerce(t,i){var e,r=this.getStack(t),s=void 0===r?null==(e=i.syntheticException)?void 0:e.stack:void 0,n=!!s;return{type:this.getType(t),value:this.getMessage(t,i),stack:null!=r?r:s,cause:t.cause?i.next(t.cause):void 0,synthetic:n}}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){try{var i=t.stacktrace;if("string"==typeof i&&i.length>0)return i;var e=t.stack;return"string"==typeof e&&e.length>0?e:void 0}catch(t){return}}},Ft=class{match(t){return!!S(t,"ErrorEvent")&&(null!=t.error||this.hr(t))}coerce(t,e){var r;if(null!=t.error)return e.apply(t.error);var s=e.apply(t.message);return i({},s,{stack:null!==(r=this.vr(t))&&void 0!==r?r:s.stack,synthetic:!0})}hr(t){return p(t.message)&&t.message.length>0}vr(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(p(r.filename)&&0!==r.filename.length&&0!==s)return"Error\n at "+r.filename+":"+s+":"+n}},At=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Tt=class{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(At);return r&&(i=r[1],e=r[2]),[i,e]}},Ct=["fatal","error","warning","log","info","debug"];function $t(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""}var Rt=class{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(x(t))return t.constructor.name;var i="name"in t?t.name:void 0;return p(i)&&!g(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: "+$t(t)}isSeverityLevel(t){return p(t)&&!g(t)&&Ct.indexOf(t)>=0}getStack(t){try{return p(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:p(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(k(e))return e}}getObjectClassName(t){try{var i=Object.getPrototypeOf(t);return i?i.constructor.name:void 0}catch(t){return}}},Ot=class{match(t){return x(t)}coerce(t,i){var e,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+$t(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}},Mt=class{match(t){return w(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}}},It=class{match(t){return S(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!x(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 w(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}},jt="$message",Lt="$timestamp",Dt=new Set([jt,Lt]),Nt={enabled:!0,max_bytes:32768};function zt(t){var e;return t?{enabled:null!==(e=t.enabled)&&void 0!==e?e:Nt.enabled,max_bytes:Ut(t.max_bytes,Nt.max_bytes)}:i({},Nt)}var Ht=class{constructor(t){this.ns=[],this.ss=0,this.Ar=zt(t)}setConfig(t){this.Ar=zt(t),this.rs()}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(!d(s))return;var n=s,a=n[jt],o=n[Lt];if(!p(a)||0===a.trim().length)return;if(!p(o)&&!m(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.Ar.max_bytes||(this.ns.push({step:i.step,bytes:e}),this.ss+=e,this.rs())}}getAttachable(){return this.ns.map(t=>t.step)}clear(){this.ns=[],this.ss=0}size(){return this.ns.length}rs(){for(;this.ss>this.Ar.max_bytes&&this.ns.length>0;){var t=this.ns.shift();t&&(this.ss-=t.bytes)}}};function Ut(t,i){if(!m(t)||1/0===t||-1/0===t)return i;var e=Math.floor(t);return 0>e?i:e}var Bt=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(i){return t}};function qt(t){return"string"==typeof t||t}function Vt(t){return"string"==typeof t?t:void 0}var Wt="[redacted]",Kt=/^[A-Za-z0-9+/\n\r]+=*$/,Gt=/^[A-Za-z0-9_-]+={0,2}$/,Jt=/[-_]/,Xt=/^data:[^,\s]*;base64,/i,Zt=/^[A-Za-z0-9+/_-]+={0,2}$/,Qt=/\bph[a-z]_[A-Za-z0-9_-]{20,}\b/g,Yt=/^(authorization|cookie|set-cookie|x-api-key|api[-_]?key|api[-_]?token|access[-_]?token|refresh[-_]?token|token|password|secret|client[-_]?secret|private[-_]?key)$/i,ti=/[a-z][a-z0-9+.-]{0,63}:[^\s<>"]+/gi,ii=/[\s<>"]/,ei=new RegExp(ti.source,"i"),ri=/[a-z][a-z0-9+.-]{0,63}:\/\//i,si=new RegExp("^"+ri.source,"i"),ni=new RegExp(ri.source,"gi"),ai=/(^|[-_./;])(auth|token|secret|password|passwd|pwd|credential|signature|sig|key|hmac|sas|bearer|jwt|session|sessionid)([-_./;]|$)/i,oi=/^(code|AWSAccessKeyId|GoogleAccessId|Policy)$/i,li=/[\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]/g,ui=/[A-Za-z0-9._%+-]{1,64}@[A-Za-z0-9.-]{1,255}\.[A-Za-z]{2,24}/g,hi=/\b(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\b/g,vi=/(^|[^\w:])((?:(?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4}|(?:[0-9A-Fa-f]{1,4}:){1,7}:|(?:[0-9A-Fa-f]{1,4}:){1,6}:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4}){0,5}|::(?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4}){0,6})))(?=$|[^\w:])/g,di=/\b\d{3}[ .-]\d{2}[ .-]\d{4}\b/g,ci=/\b\d(?:[ ./-]?\d){12,}\b/g,fi=/\d+/g,pi=/(^|[^\w+])((?:\+?1[ ./-]?)?(?:\(\d{3}\)[ ./-]?|\d{3}[ ./-])\d{3}[ ./-]\d{4})(?![\w])/g,gi=/(^|[^\w])(\+\d{1,3}(?:[ ./()-]{0,2}\d){7,13})(?![\w])/g;function _i(t){return function(t){return Yt.test(t)}(t)||ai.test(t)||oi.test(t)}function bi(t){return t.split("&",129).length>128}function mi(t,i,e){return _i(t)||i.includes(";")&&function(t){return t.split(";").some(t=>_i(t.split("=",1)[0]))}(i)?Wt:ei.test(i)?e?Ei(i,{allowNestedUrls:!1,stripPunctuation:!0}):Wt:i}function yi(t,i){var e=new URLSearchParams,r=!1,s=!1;for(var n of new URLSearchParams(t)){var a=n[0],o=n[1],l=Pi(a),u=Pi(o);r||(r=l!==a||u!==o);var h=mi(l,u,i);r||(r=h!==u),s=_i(l)||h!==u,e.append(l,h)}return{changed:r,lastFieldSensitive:s,serialized:e.toString()}}function wi(t,i){if(!t.includes("="))return{value:Si(t,i),lastFieldSensitive:!1};var e=yi(t,i);return{value:e.changed?e.serialized:t,lastFieldSensitive:e.lastFieldSensitive}}function Si(t,i){return i?Ei(t,{allowNestedUrls:!1,stripPunctuation:!0}):ei.test(t)?Wt:t}function ki(t,i,e){return"#"===t?!i.fragment&&(i.fragment=!0):"?"===t&&(i.fragment?"="!==e&&!i.fragmentQuery&&(i.fragmentQuery=!0):!i.query&&(i.query=!0))}function xi(t,i){var e;if(t.length>8192&&si.test(t))return Wt;var r,s=i.stripPunctuation?function(t){for(var i=t.length;i>0&&".,;:!?)]}'".includes(t[i-1]);)i--;return{address:t.slice(0,i),suffix:t.slice(i)}}(t):{address:t,suffix:""},n=s.address,a=s.suffix;try{r=new URL(n)}catch(t){return Wt+a}var o=r.search.slice(1),l=""!==r.hash,u=function(t){var i=t.slice(1),e=i.indexOf("?");return 0>e?{head:i,tail:null}:{head:i.slice(0,e),tail:i.slice(e+1)}}(r.hash);if(bi(o)||bi(u.head)||bi(null!==(e=u.tail)&&void 0!==e?e:""))return Wt+a;var h=!1;(r.username||r.password)&&(r.username=Wt,r.password="",h=!0);var v=yi(o,i.allowNestedUrls);v.changed&&(r.search=v.serialized,h=!0);var d,c=wi(u.head,i.allowNestedUrls),f=null===u.tail?null:(d=u.tail,c.lastFieldSensitive?{value:""===d?"":Wt,lastFieldSensitive:!0}:wi(d,i.allowNestedUrls)),p=null===f?c.value:c.value+"?"+f.value;p!==r.hash.slice(1)&&(r.hash=p,h=!0);var g=l?null!=f?f:c:v;return(h?Pi(r.toString()):n)+(g.lastFieldSensitive?"":a)}function Ei(t,e){return t.replace(ti,r=>function(t,e){var r=function(t){if(!t.includes("://"))return[];for(var i=[...t.matchAll(ni)].map(t=>t.index),e=[],r={query:!1,fragment:!1,fragmentQuery:!1},s=0,n=!1,a="",o=0;t.length>o&&i.length>s;o++){i[s]===o&&(o>0&&"="!==a&&e.push(o),s++);var l=t[o];ki(l,r,a)?(a=l,n=!0):n&&"=&".includes(l)&&(a=l)}return e}(t);if(0===r.length)return xi(t,e);var s="",n=0;for(var a of r)s+=xi(t.slice(n,a),i({},e,{stripPunctuation:!1})),n=a;return s+xi(t.slice(n),e)}(r,i({},e,{stripPunctuation:e.stripPunctuation&&r.length!==t.length})))}function Pi(t){return t.replace(Qt,Wt)}function Fi(t,i){return function(t){return t.length>=10240&&(Kt.test(t)||function(t){var i,e=Xt.exec(t);if(!e)return!1;try{i=decodeURIComponent(t.slice(e[0].length))}catch(t){return!1}return Zt.test(i.replace(/[\r\n]/g,""))}(t)||Jt.test(t)&&Gt.test(t))}(t)?"[binary data redacted - not supported by PostHog MCP analytics]":function(t,i,e){var r=4*e.maxStringLength;if(t.length>r){var s=i(t.slice(0,function(t,i){for(var e=i;e>0&&!ii.test(t[e-1]);)e--;return e}(t,r)));if(s.length>=2*e.maxStringLength)return s+e.truncationSuffix}return i(t)}(t,t=>function(t){return Ei(t,{allowNestedUrls:!0,stripPunctuation:!0})}(function(t){var i=t.replace(li," ");return(i=(i=(i=(i=(i=(i=i.replace(ui,Wt)).replace(hi,Wt)).replace(vi,"$1"+Wt)).replace(ci,Ti)).replace(di,Wt)).replace(pi,"$1"+Wt)).replace(gi,"$1"+Wt)}(Pi(t))),i)}function Ai(t){for(var i=0,e=!1,r=t.length-1;r>=0;r--){var s=t.charCodeAt(r)-48;if(0>s||s>9)return!1;e&&(s*=2)>9&&(s-=9),i+=s,e=!e}return i%10==0}function Ti(t){for(var i=[],e=fi.exec(t);null!==e;e=fi.exec(t))i.push({digits:e[0],start:e.index,end:e.index+e[0].length});for(var r="",s=0,n=0;i.length>n;){for(var a="",o=-1,l=n;i.length>l&&19>=(a+=i[l].digits).length;l++)a.length>=13&&Ai(a)&&(o=l);0>o?n++:(r+=t.slice(s,i[n].start)+Wt,s=i[o].end,n=o+1)}return r+t.slice(s)}var Ci={}.propertyIsEnumerable;function $i(t,i){try{return Mi(t,i,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch(t){return[]}}function Ri(t,i,e,r){if(0>=e.remainingNodes)return{stringValue:H};if(e.remainingNodes--,y(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>=0x8000000000000000||-0x8000000000000000>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:B(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:H};if(t instanceof Date){var n=t.getTime(),a=Number.isFinite(n)?t.toISOString():String(t);return{stringValue:"string"==typeof a?B(a):String(a)}}e.ancestors.add(t);try{try{var o=t.toJSON;if("function"==typeof o)return Ri(o.call(t),i,e,r+1)}catch(t){}return h(t)?{arrayValue:{values:Oi(t,i,e,r+1)}}:{kvlistValue:{values:Mi(t,i,e,r+1)}}}finally{e.ancestors.delete(t)}}return{stringValue:B(String(t))}}function Oi(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(b(o))continue;s.push(Ri(o,i,e,r))}catch(t){s.push({stringValue:U})}return t.length>a&&s.push({stringValue:H}),s}function Mi(t,i,e,r){var s=[];for(var n in t)if(Ci.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(_(a)||f(a))continue;s.push({key:B(n),value:Ri(a,i,e,r)})}catch(t){s.push({key:B(n),value:{stringValue:U}})}}return s}function Ii(t,e,r){return i({},q({},t.resourceAttributes),{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment},t.serviceVersion&&{"service.version":t.serviceVersion},{"telemetry.sdk.name":e,"telemetry.sdk.version":r})}var ji=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function Li(t,i){var e=q({},t),r={};for(var s of ji)({}).hasOwnProperty.call(e,s)&&(r[s]=e[s],delete e[s]);return[...$i(e,i),...$i(r,i)]}var Di={darwin:"macOS",win32:"Windows",cygwin:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",netbsd:"NetBSD",sunos:"SunOS",aix:"AIX",haiku:"Haiku","Mac OS X":"macOS"};var Ni={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}},zi=Ni.info;function Hi(t){try{return B(String(t))}catch(t){return U}}function Ui(t,e,r,s){var n,a=Ni[t.level||"info"]||zi,o=a.text,l=a.number,u=(void 0===(n=m(s)?s:void 0)&&(n=Date.now()),String(n)+"000000"),h={};e.distinctId&&(h.posthogDistinctId=e.distinctId),e.sessionId&&(h.sessionId=e.sessionId),e.windowId&&(h["window.id"]=e.windowId),b(e.sessionStartTimestamp)||(h.sessionStartTimestamp=String(e.sessionStartTimestamp)),b(e.lastActivityTimestamp)||(h.lastActivityTimestamp=String(e.lastActivityTimestamp)),e.currentUrl&&(h["url.full"]=e.currentUrl),e.screenName&&(h["screen.name"]=e.screenName),e.appState&&(h["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(h.feature_flags=e.activeFeatureFlags);var v=i({},h),d=t.attributes;if(d){var c=[];try{c=Object.keys(d)}catch(t){c=[]}for(var p of c){var g=void 0;try{g=d[p]}catch(t){g=U}Object.defineProperty(v,p,{value:g,enumerable:!0,writable:!0,configurable:!0})}}var _={timeUnixNano:u,observedTimeUnixNano:u,severityNumber:l,severityText:o,body:{stringValue:Hi(t.body)},attributes:$i(v,r)};return t.trace_id&&(_.traceId=t.trace_id),t.span_id&&(_.spanId=t.span_id),f(t.trace_flags)||(_.flags=t.trace_flags),_}function Bi(t,i,e){return Ii(t,i,e)}function qi(t,i,e,r){return{resourceLogs:[{resource:{attributes:Li(i)},scopeLogs:[{scope:{name:e,version:r},logRecords:t}]}]}}var Vi=class{constructor(t){this.ls=t,this.us=0}get pending(){return!!this.cs}arm(t){this.clear(),this.us=Date.now()+t,this.cs=Y(()=>{this.cs=void 0,this.ls()},t)}armNoEarlierThan(t){this.cs&&Date.now()+t<=this.us||this.arm(t)}clear(){this.cs&&(clearTimeout(this.cs),this.cs=void 0)}};function Wi(){return.75+.5*Math.random()}function Ki(t,i,e,r){var s=t*Math.pow(2,Math.min(Math.max(0,i-1),6));return Math.round((void 0===r?s:Math.min(s,Math.max(r,t)))*e)}var Gi=class{constructor(t,i,e,r,s,n,a){var o;void 0===n&&(n=()=>Promise.resolve()),this._instance=t,this.Ar=i,this.$=e,this.hs=r,this.ds=s,this.vs=n,this.fs=a,this.ps=new Vi(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new X,this.ks=0,this.Ss=1,this.xs=0,this.$s=0,this.Cs=!1,this.Ts=i.maxBufferSize,this.Is=Math.max(null!==(o=i.maxQueueSize)&&void 0!==o?o:i.maxBufferSize,i.maxBufferSize),this.Ms=i.flushIntervalMs,this.Es=i.maxBatchRecordsPerPost,this.Ps=i.rateCapWindowMs,this.Rs=i.maxLogsPerInterval}clearQueue(){this._s++,this._instance.setPersistedProperty(s.LogsQueue,[])}reset(){this.ps.clear(),this.xs=0,this.$s=0,this.Cs=!1,this.ks=0,this.Ss=1,this.ws.reset(),this.Es=this.Ar.maxBatchRecordsPerPost}onReconnect(){this.ks=0,this.Ss=1,this.ws.isOpen()?this.As()&&this.Fs():this.gs()}captureLog(t,i){var e;if(!this._instance.isDisabled&&!this._instance.optedOut&&null!=t&&t.body){var r=this.Os(t);if(null!==r)if(r.body){if(this.Ds()){var s={record:Ui(r,null!==(e=null==i?void 0:i.context)&&void 0!==e?e:this.hs(),this.$,null==i?void 0:i.occurredAtMs)};this.ds(()=>this.Ls(s))}}else this.$.info("Log was rejected in beforeSend function")}}Os(t){var i=this.Ar.beforeSend;if(!i)return t;var e=h(i)?i:[i],r=t;for(var s of e)try{var n=s(r);if(!n)return this.$.info("Log was rejected in beforeSend function"),null;r=n}catch(t){return this.$.error("Error in beforeSend function for log:",t),null}return r}Ds(){if(void 0===this.Rs)return!0;var t=Date.now(),i=t-this.xs;return this.Ps>i&&i>=0||(this.xs=t,this.$s=0,this.Cs=!1),this.Rs>this.$s?(this.$s++,!0):(this.Cs||(this.$.warn("captureLog dropping logs: exceeded "+this.Rs+" logs per "+this.Ps+"ms"),this.Cs=!0),!1)}flush(){var t=this;return r(function*(){if(!t._instance.isDisabled)return t.ys||(t.ys=t.Ns().finally(()=>{t.ys=null})),t.ys})()}Ns(){var t=this;return r(function*(){var i;t.ps.clear();var e=null!==(i=t._instance.getPersistedProperty(s.LogsQueue))&&void 0!==i?i:[];if(0!==e.length)for(var r=e.length,n=0;e.length>0&&r>n;){var a,o,l=t._s;t.bs=0;var u=Math.min(e.length,t.Es),h=e.slice(0,u),v=qi(h.map(t=>t.record),t.qs(),null!==(a=t.fs)&&void 0!==a?a:t._instance.getLibraryId(),t._instance.getLibraryVersion()),d=yield t._instance.js(v);if(t._s!==l)return;if("too-large"===d.kind&&h.length>1)t.Es=Math.max(1,Math.floor(h.length/2)),t.$.warn("Logs batch of size "+h.length+" was too large for the ingestion endpoint, reducing batch size to "+t.Es);else{if(t.ws.record(d),t.ps.pending&&t.ps.arm(Math.max(t.Ms,t.ws.remainingMs())),"retry-later"===d.kind)throw d.error;if("too-large"===d.kind?t.$.warn("Dropping a single log record with batch size 1 — the record is larger than the server cap and cannot be split further."):"ok"===d.kind&&t.Ar.maxBatchRecordsPerPost>t.Es&&(t.Es=Math.min(t.Ar.maxBatchRecordsPerPost,t.Es+1)),yield t.Bs(h.length),e=null!==(o=t._instance.getPersistedProperty(s.LogsQueue))&&void 0!==o?o:[],n+=h.length,"fatal"===d.kind)throw d.error}}})()}Bs(t){var i=this;return r(function*(){var e,r=Math.max(0,t-i.bs),n=null!==(e=i._instance.getPersistedProperty(s.LogsQueue))&&void 0!==e?e:[];i._instance.setPersistedProperty(s.LogsQueue,n.slice(r)),yield i.vs()})()}qs(){return Bi(this.Ar,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(t){var i;if(!this._instance.optedOut){var e=null!==(i=this._instance.getPersistedProperty(s.LogsQueue))&&void 0!==i?i:[];this.Is>e.length||(e.shift(),this.bs++,this.$.info("Logs queue is full, dropping oldest record.")),e.push(t),this._instance.setPersistedProperty(s.LogsQueue,e),this.Ts>e.length||this.ws.isOpen()?this.Fs():this.gs()}}Fs(){this.ps.pending||this.ps.arm(Math.max(this.Ms,this.ws.remainingMs()))}zs(){return Math.max(Ki(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){var t=this._instance.getPersistedProperty(s.LogsQueue);return!!t&&t.length>0}shutdown(t){var i=this;return r(function*(){i.ps.clear();var e=i.flush().catch(()=>{});void 0!==t?yield tt(e,t):yield e})()}flushWithTimeout(t){var i=this;return r(function*(){var e=i.flush();yield tt(e,t,()=>{e.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},t=>{this.ks++,this.Ss=Wi(),this.$.error("PostHog logs flush failed:",t)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.zs())})}},Ji=/^[0-9a-f]+$/;function Xi(t,i,e){return"string"==typeof t&&t.length===i&&t!==e&&Ji.test(t)}var Zi=/^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})(-.*)?$/;var Qi="00",Yi=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function te(t){return String(t)+"000000"}function ie(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}var ee=class{constructor(t,i,e){this._instance=t,this.Ar=i,this.$=e,this.Hs=new Map,this.ps=new Vi(()=>this.flush().catch(t=>{this.$.error("Metrics flush failed:",t)})),this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.ws=new X,this.ks=0,this.Ss=1,this.Gs=0}count(t,i,e){void 0===i&&(i=1),this.Qs({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.Qs({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.Qs({name:t,type:"histogram",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}flush(){var t=this,i=this.ys,e=function(){var e=r(function*(){i&&(yield i.catch(()=>{})),yield t.Zs()});return function(){return e.apply(this,arguments)}}()().finally(()=>{this.ys===e&&(this.ys=null)});return this.ys=e,e}drainWindow(){if(0===this.Hs.size)return null;var t=this.Hs;return this.Hs=new Map,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.Js(t)}reset(){this.Gs++,this.ws.reset(),this.ks=0,this.Ss=1,this.ps.clear(),this.Hs=new Map,this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set}Qs(t){if(!this._instance.isDisabled&&!this._instance.optedOut){var e=this.Os(t);if(null!==e)if(e.name&&"string"==typeof e.name)if("number"==typeof e.value&&Number.isFinite(e.value))if("count"===e.type&&0>e.value)this.$.warn("Dropping count '"+e.name+"': counters are monotonic, value must be >= 0");else{var r,s;try{r=e.attributes?i({},e.attributes):void 0,s=ie(e.type,e.name,e.unit,r)}catch(t){return void this.$.warn("Dropping metric '"+e.name+"': attributes could not be serialized",t)}var n=this.Hs.get(s);if(!n){if(!this.Ks())return;n={name:e.name,type:e.type,unit:e.unit,attributes:r,windowStartMs:Date.now()},this.Hs.set(s,n)}var a=this.Ws.get(e.name);void 0===a?this.Ws.set(e.name,e.type):a===e.type||this.Vs.has(e.name)||(this.Vs.add(e.name),this.$.warn("Metric name '"+e.name+"' is already used as a "+a+"; recording it as a "+e.type+" too will blend both series in charts. Use a distinct name.")),this.Xs(n,e.value);var o=this.Ys();o&&(n.exemplar=i({},o,{value:e.value,timeMs:Date.now()})),this.Fs()}else this.$.warn("Dropping metric '"+e.name+"': value must be a finite number");else this.$.warn("Dropping metric with empty name")}}Ys(){try{var t,i,e=(r=null==(t=(i=this._instance).getActiveSpan)||null==(t=t.call(i))?void 0:t.traceparent(),n=function(t){if("string"==typeof t){var i=Zi.exec(t.trim());if(i){var e=i[1],r=i[2],s=i[3],n=i[4];if("ff"!==e&&("00"!==e||!i[5])&&function(t){return Xi(t,32,"00000000000000000000000000000000")}(r)&&function(t){return Xi(t,16,"0000000000000000")}(s))return{version:e,traceId:r,spanId:s,flags:n}}}}(r),n&&{traceId:n.traceId,spanId:n.spanId,flags:(s=n.flags,1&parseInt(s,16)?"01":Qi)});if(e&&"01"===e.flags)return{traceId:e.traceId,spanId:e.spanId}}catch(t){}var r,s,n}Ks(){return this.Ar.maxSeriesPerFlush>this.Hs.size||(this.Us||(this.Us=!0,this.$.warn("Metric series cap reached ("+this.Ar.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}Xs(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(Yi.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,Yi)]+=1}}Os(t){var i=this.Ar.beforeSend;if(!i)return t;var e=h(i)?i:[i],r=t;for(var s of e)try{var n=s(r);if(!n)return this.$.info("Metric was rejected in beforeSend function"),null;r=n}catch(t){return this.$.error("Error in beforeSend function for metric:",t),null}return r}Fs(){this.ps.pending||this.ps.arm(this.zs())}zs(){return Math.max(Ki(this.Ar.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Zs(){var t=this;return r(function*(){if(t.ps.clear(),0!==t.Hs.size){var i=t.Hs;t.Hs=new Map,t.Us=!1,t.Ws=new Map,t.Vs=new Set;var e=t.Gs,r=yield t._instance.po(t.Js(i));if(e===t.Gs)switch(t.ws.record(r),"retry-later"===r.kind?(t.ks++,t.Ss=Wi()):(t.ks=0,t.Ss=1),t.ps.pending&&t.ps.arm(t.zs()),r.kind){case"ok":return;case"retry-later":return t.mo(i),void t.ps.armNoEarlierThan(t.zs());case"too-large":return void t.$.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.$.error("Failed to send metrics batch:",r.error)}}})()}Js(t){return i=this.yo(t),e=function(t,i,e){return Ii(t,i,e)}(this.Ar,this._instance.getLibraryId(),this._instance.getLibraryVersion()),r=this._instance.getLibraryId(),s=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:Li(e)},scopeMetrics:[{scope:{name:r,version:s},metrics:i}]}]};var i,e,r,s}yo(t){var e=te(Date.now()),r=new Map;for(var s of t.values()){var n,a=ie(s.type,s.name,s.unit,void 0),o=r.get(a);o||(o=i({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=$i(null!==(n=s.attributes)&&void 0!==n?n:{},this.$),u=te(s.windowStartMs),h=re(s.exemplar);if("count"===s.type){var v,d=i({attributes:l,startTimeUnixNano:u,timeUnixNano:e,asDouble:null!==(v=s.total)&&void 0!==v?v:0},h);o.sum.dataPoints.push(d)}else if("gauge"===s.type){var c,f=i({attributes:l,timeUnixNano:e,asDouble:null!==(c=s.last)&&void 0!==c?c:0},h);o.gauge.dataPoints.push(f)}else if(s.hist){var p=i({attributes:l,startTimeUnixNano:u,timeUnixNano:e,count:s.hist.count,sum:s.hist.sum,min:s.hist.min,max:s.hist.max,bucketCounts:s.hist.bucketCounts,explicitBounds:Yi},h);o.histogram.dataPoints.push(p)}}return Array.from(r.values())}mo(t){var i,e;for(var r of t){var s,n=r[0],a=r[1],o=this.Hs.get(n);if(o)switch(o.windowStartMs=Math.min(o.windowStartMs,a.windowStartMs),o.exemplar=null!==(s=o.exemplar)&&void 0!==s?s:a.exemplar,o.type){case"count":o.total=(null!==(i=o.total)&&void 0!==i?i:0)+(null!==(e=a.total)&&void 0!==e?e:0);break;case"gauge":break;case"histogram":if(a.hist)if(o.hist){o.hist.count+=a.hist.count,o.hist.sum+=a.hist.sum,o.hist.min=Math.min(o.hist.min,a.hist.min),o.hist.max=Math.max(o.hist.max,a.hist.max);for(var l=0;o.hist.bucketCounts.length>l;l++)o.hist.bucketCounts[l]+=a.hist.bucketCounts[l]}else o.hist=a.hist}else this.Ks()&&this.Hs.set(n,a)}}};function re(t){return t?{exemplars:[{filteredAttributes:[],timeUnixNano:te(t.timeMs),asDouble:t.value,traceId:t.traceId,spanId:t.spanId}]}:{}}var se="0.9.11",ne={DEBUG:!1,LIB_VERSION:se,LIB_NAME:"browser-common",JS_SDK_VERSION:se},ae=function(t,i){var e=(void 0===i?{}:i).debugEnabled,r={N(i){var r;try{r=typeof window>"u"?void 0:window}catch(t){return}for(var s=arguments.length,n=new Array(s>1?s-1:0),a=1;s>a;a++)n[a-1]=arguments[a];r&&(ne.DEBUG||r.POSTHOG_DEBUG||e)&&!f(r.console)&&r.console&&("__rrweb_original__"in r.console[i]?r.console[i].__rrweb_original__:r.console[i])(t,...n)},debug(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.N("debug",...i)},info(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.N("log",...i)},warn(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.N("warn",...i)},error(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.N("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)=>ae(t+" "+i,e)};return r},oe=ae("[PostHog.js]"),le=oe.createLogger;function ue(t,i){h(t)&&t.forEach(i)}function he(t,i){if(!b(t))if(h(t))t.forEach(i);else if(t instanceof FormData)t.forEach((t,e)=>i(t,e));else for(var e in t)l.call(t,e)&&i(t[e],e)}var ve=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 de(t){for(var i=Object.keys(t),e=i.length,r=new Array(e);e--;)r[e]=[i[e],t[i[e]]];return r}function ce(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 fe(t){return"ph_toolbar_internal"===t.name}function pe(t,i){var e,r=null==t||null==(e=t.config)?void 0:e.get_current_url;if(!v(r))return i;try{var s=r(i);return p(s)&&s?s:i}catch(t){return oe.error("Error in get_current_url, falling back to window.location.href",t),i}}var ge="$early_access_features",_e="$active_feature_flags",be="$feature_flag_details",me="$feature_flag_errors",ye="$feature_flag_evaluated_at",we="$feature_flag_request_id",Se="$minimal_flag_called_events",ke="$enabled_feature_flags",xe="$stored_group_properties",Ee="$stored_person_properties",Pe="$flag_call_reported",Fe="$flag_call_reported_session_id",Ae="$feature_flag_payloads",Te="$override_feature_flags",Ce="$override_feature_flag_payloads",$e="visibilitychange",Re="$autocapture_disabled_server_side";function Oe(t){return t instanceof Element&&("__POSTHOG_TOOLBAR__"===t.id||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function Me(t){return!!t&&1===t.nodeType}function Ie(t,i){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===i.toLowerCase()}function je(t){return!!t&&3===t.nodeType}function Le(t){return!!t&&11===t.nodeType&&Me(t.host)}function De(t){return t?a(t).split(/\s+/):[]}function Ne(t,i){var e=function(t){var i,e=null==(i=typeof window>"u"?void 0:window)||null==(i=i.location)?void 0:i.href;return f(e)?void 0:pe(t,e)}(i);return!!(e&&t&&t.some(t=>e.match(t)))}function ze(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 De(i)}function He(t){return b(t)?null:a(t).split(/(\s+)/).filter(t=>_r(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Ue(t){var i="";return lr(t)&&!ur(t)&&t.childNodes&&t.childNodes.length&&he(t.childNodes,function(t){var e;je(t)&&t.textContent&&(i+=null!==(e=He(t.textContent))&&void 0!==e?e:"")}),a(i)}function Be(t){var i;return f(t.target)?t.srcElement||null:null!=(i=t.target)&&i.shadowRoot?t.composedPath()[0]||null:t.target||null}var qe=["a","button","form","input","select","textarea","label"];function Ve(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 We(t,i){if(f(i))return!0;var e,r=function(t){if(i.some(i=>Ve(t,i)))return{v:!0}};for(var s of t)if(e=r(s))return e.v;return!1}function Ke(t){var i=t.parentNode;return!(!i||!Me(i))&&i}var Ge=[".ph-no-autocapture","[data-ph-no-autocapture]"],Je=["next","previous","prev",">","<","→","←","›","‹","»","«","▶","◀","❯","❮"],Xe=[...Je,"+","-","−","–"],Ze=Xe.length+10,Qe=["button","a","input","select","textarea","label"],Ye=["button","link","tab","menuitem","option"],tr=(t,i)=>/[a-z0-9]/i.test(i)?n(Xe,i)?new RegExp("\\b"+i+"\\b").test(t):t.includes(i):t===i,ir=t=>n(Qe,t.tagName.toLowerCase())||n(Ye,(t.getAttribute("role")||"").toLowerCase());function er(t){var i="",e="",r=t=>{Me(t)&&lr(t)&&!ur(t)&&(i+=" "+Ue(t),e=e||t.getAttribute("aria-label")||"",he(t.childNodes,r))};r(t);var s=(_r(i=a(i.replace(/\s+/g," ")))?i:"").toLowerCase();return{safeText:s,ariaLabel:a(t.getAttribute("aria-label")||(s?"":e)).toLowerCase()}}var rr=[".ph-no-rageclick",".ph-no-capture"],sr=["","text","search","email","password","url","tel","number"];function nr(t,i){if(!(typeof window>"u"?void 0:window)||ar(t))return!1;var e,r,s,a,o;if(y(i)?(e=!!i&&rr,r=void 0,s=!1):(e=null!==(a=null==i?void 0:i.css_selector_ignorelist)&&void 0!==a?a:rr,r=null==i?void 0:i.content_ignorelist,s=null!==(o=null==i?void 0:i.ignore_text_selection)&&void 0!==o&&o),!1===e)return!1;if(s&&function(t){return!(!t||!Me(t))&&(!!Ie(t,"textarea")||(Ie(t,"input")?n(sr,(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=or(t,!1).targetElementList;return!(r&&function(t,i){var e,r=i.safeText,s=i.ariaLabel;if(!0===t)e=Je;else{if(!h(t))return!1;if(t.length>Ze)return oe.error("[PostHog] content_ignorelist array cannot exceed "+Ze+" items. Use css_selector_ignorelist for more complex matching."),!1;e=t.map(t=>t.toLowerCase())}return e.some(t=>tr(r,t)||tr(s,t))}(r,function(t,i){for(var e of i)if(ir(e))return er(e);for(var r of i){try{var s;if("pointer"!==(null==(s=window)?void 0:s.getComputedStyle(r).getPropertyValue("cursor")))break}catch(t){break}var n=er(r);if(n.safeText||n.ariaLabel)return n}return er(t)}(t,l))||We(l,e))}var ar=t=>!t||Ie(t,"html")||!Me(t),or=(t,i)=>{var e=typeof window>"u"?void 0:window;if(!e||ar(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var r=!1,s=[t],n=t;n.parentNode&&!Ie(n,"body");)if(Le(n.parentNode))s.push(n.parentNode.host),n=n.parentNode.host;else{var a=Ke(n);if(!a)break;if(i||qe.indexOf(a.tagName.toLowerCase())>-1)r=!0;else try{var o=e.getComputedStyle(a);o&&"pointer"===o.getPropertyValue("cursor")&&(r=!0)}catch(t){}s.push(a),n=a}return{parentIsUsefulElement:r,targetElementList:s}};function lr(t){for(var i=new Set,e=0,r=t;r.parentNode&&!Ie(r,"body");r=r.parentNode){if(e++>=1e3||i.has(r))return!1;i.add(r);var s=ze(r);if(n(s,"ph-sensitive")||n(s,"ph-no-capture"))return!1}if(n(ze(t),"ph-include"))return!0;var a=t.type||"";if(p(a))switch(a.toLowerCase()){case"hidden":case"password":return!1}var o=t.name||t.id||"";return!p(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 ur(t){return!!(Ie(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||Ie(t,"select")||Ie(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var hr=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}))$"),vr=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,dr=[16,15,14,13],cr=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),fr=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),pr=/[0-9A-Za-z_]/;function gr(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 _r(t,i){if(void 0===i&&(i=!0),b(t))return!1;if(p(t)){if(t=a(t),i?hr.test((t||"").replace(/[- ]/g,"")):function(t){var i;for(vr.lastIndex=0;i=vr.exec(t);){var e=i[2];if(e)for(var r=e.replace(/[- ]/g,""),s=0;r.length>s;s++)for(var n of dr){var a=s+n;if(r.length>=a){var o=r.slice(s,a);if(hr.test(o)&&gr(o))return!0}}}return!1}(t))return!1;if(i?cr.test(t):function(t){var i;for(fr.lastIndex=0;i=fr.exec(t);){var e=i[1],r=i[3];if(!(e&&r&&pr.test(e)&&pr.test(r)))return!0}return!1}(t))return!1}return!0}function br(t){var i=Ue(t);return _r(i=(i+" "+mr(t)).trim())?i:""}function mr(t){var i="";return t&&t.childNodes&&t.childNodes.length&&he(t.childNodes,function(t){var e;if(t&&"span"===(null==(e=t.tagName)?void 0:e.toLowerCase()))try{var r=Ue(t);i=(i+" "+r).trim(),t.childNodes&&t.childNodes.length&&(i=(i+" "+mr(t)).trim())}catch(t){oe.error("[AutoCapture]",t)}}),i}function yr(t){return t.replace(/"|\\"/g,'\\"')}function wr(t){var i=t.attr__class;if(i)return h(i)?i:De(i)}var Sr=class{constructor(t){this.disabled=!1===t;var i=d(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}},kr=t=>{var i,e=null==(i=typeof document>"u"?void 0:document)?void 0:i.createElement("a");return f(e)?null:(e.href=t,e)},xr=()=>typeof window>"u"?void 0:window,Er=()=>typeof document>"u"?void 0:document,Pr="$copy_autocapture",Fr=le("[AutoCapture]");function Ar(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&&!Me(i));return i}function Cr(t,e){var r,s,a=e.e,o=e.maskAllElementAttributes,l=e.maskAllText,u=e.elementAttributeIgnoreList,v=e.elementsChainAsString,d=e.disableCaptureUrlHashes;if(!Me(t))return{props:{}};for(var c=[t],f=new Set([t]),g=t;g.parentNode&&!Ie(g,"body")&&1e3>c.length;)if(Le(g.parentNode)){var _=g.parentNode.host;if(f.has(_))break;f.add(_),c.push(_),g=_}else{if(!Me(g.parentNode))break;if(f.has(g.parentNode))break;f.add(g.parentNode),c.push(g.parentNode),g=g.parentNode}var b="click"===a.type&&"http://www.w3.org/2000/svg"===t.namespaceURI?c.findIndex(t=>Ie(t,"button")||Ie(t,"a")):-1;b>0&&(l=l||c.slice(0,b+1).some(t=>!lr(t)||ur(t)));var m,y,w,S=[],k={},x=!1,E=!1;if(he(c,t=>{var i=lr(t);if(Ie(t,"a")&&!o&&(null==u||!u.includes("href"))){var e=t.getAttribute("href");x=!!(i&&e&&_r(e))&&(d?Z(e):e)}n(ze(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};qe.indexOf(n)>-1&&!e&&(a.$el_text="a"===n.toLowerCase()||"button"===n.toLowerCase()?Ar(1024,br(t)):Ar(1024,Ue(t)));var o=ze(t);i||null!=r&&r.includes("class")||0>=o.length||(a.classes=o.filter(function(t){return""!==t})),he(t.attributes,function(e){var n;if((!ur(t)||-1!==["name","id","class","aria-label"].indexOf(e.name))&&(null==r||!r.includes(e.name))&&!i&&_r(e.value)&&(!p(n=e.name)||"_ngcontent"!==n.substring(0,10)&&"_nghost"!==n.substring(0,7))){var o=e.value;"class"===e.name&&(o=De(o).join(" ")),a["attr__"+e.name]=Ar(1024,"href"===e.name&&s?Z(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,u,d)),he(function(t){if(!lr(t))return{};var i={};return he(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&&_r(r)&&(i[e]=r)}}),i}(t),(t,i)=>{({}).hasOwnProperty.call(k,i)||(k[i]=t)})}),E)return{props:{},explicitNoCapture:E};if(b>0&&(t=c[b],S.splice(0,b)),l||(S[0].$el_text=Ie(t,"a")||Ie(t,"button")?br(t):Ue(t)),x){var P,F;S[0].attr__href=x;var A=null==(P=kr(x))?void 0:P.host,T=null==(F=xr())||null==(F=F.location)?void 0:F.host;A&&T&&A!==T&&(m=x)}return{props:ve((y=a.type,{$event_type:y,$ce_version:1}),v?{}:{$elements:S},{$elements_chain:(w=S,h(w)?function(t){return t.map(t=>{var e,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=i({},t.text?{text:t.text}:{},{"nth-child":null!==(e=t.nth_child)&&void 0!==e?e: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 de(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[yr(t[0].toString())]=yr(i.toString())}),(s+=":")+de(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:wr(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return de(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==(s=S[0])?void 0:s.$el_text}:{},m&&"click"===a.type?{$external_click_url:m}:{},k),target:t}}var $r=class{el(){this.il=void 0,clearTimeout(this.nl),this.nl=void 0}sl(t){var i;if(!lr(t))return!0;for(var e,r=null!==(i=this.rl().css_selector_ignorelist)&&void 0!==i?i:Ge,s=new Set,a=t,o=function(){if(s.size>=1e3||s.has(a))return{v:!0};s.add(a);var t=a,i=ze(t);if(n(i,"ph-no-capture")||n(i,"ph-sensitive")||ur(t)||r.some(i=>Ve(t,i)))return{v:!0};var e=a.parentNode;a=Le(e)?e.host:e&&Me(e)?e:null};a;)if(e=o())return e.v;return!1}ol(t){if(this.isEnabled&&"pointercancel"!==t.type)if("pointerdown"!==t.type){var i=this.il;i&&(t.pointerId!==i.id||Math.abs(t.clientX-i.x)>5||Math.abs(t.clientY-i.y)>5?this.el():"pointerup"===t.type&&(i.released=!0,this.nl=setTimeout(()=>this.el(),0)))}else{var e;this.el();var r=Be(t);t.isPrimary&&0===t.button&&!t.ctrlKey&&r&&Me(r)&&(this.il={target:r,excluded:this.sl(r),id:t.pointerId,x:t.clientX,y:t.clientY,released:!1,distinctId:null==(e=this.xa)?void 0:e.distinctId})}else this.el()}al(t){var i,e=this.il;this.el();var r=Be(t);if(null!=e&&e.released&&e.target.isConnected&&e.distinctId===(null==(i=this.xa)?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&&(Ie(r,"html")||Ie(r,"body"))){var s,a,o;if(e.excluded)return null;var l=null!==(s=this.rl().css_selector_ignorelist)&&void 0!==s?s:Ge;return[r,null==(a=Er())?void 0:a.documentElement,null==(o=Er())?void 0:o.body].some(t=>{if(!t)return!1;var i=ze(t);return n(i,"ph-no-capture")||n(i,"ph-sensitive")||!lr(t)||ur(t)||l.some(i=>Ve(t,i))})?null:e.target}}constructor(t){this.Ta=t,this.name="autocapture",this.ll=!1,this.ul=null,this.cl=!1,this.hl=new Map,this.dl=!1,this.Ar={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.Ci=!1,this.Ta.refresh(this.Ar),this.rageclicks=new Sr(this.Ar.rageclick),this.vl=null}setup(t){this.fl(),this.xa=t;var i=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.Ci?i.dispose():(this.qa=i,this.startIfEnabled())}dispose(){var t;this.Ci||(this.Ci=!0,this.xa=void 0,null==(t=this.qa)||t.dispose(),this.qa=void 0,this.hl.clear(),this.vl=null,this.pl())}rl(){return this.Ta.refresh(this.Ar),this.Ar}fl(){var t,i;return this.rl(),this.Ar.url_allowlist=null==(t=this.Ar.url_allowlist)?void 0:t.map(t=>new RegExp(t)),this.Ar.url_ignorelist=null==(i=this.Ar.url_ignorelist)?void 0:i.map(t=>new RegExp(t)),this.Ar}gl(){var t=xr(),i=Er();if(this.isBrowserSupported()){if(t&&i){this.ml=t,this.yl=i;var e=this.bl=i=>{i=i||(null==t?void 0:t.event);try{if("blur"===i.type)return void this.el();if(0===i.type.indexOf("pointer"))return void this.ol(i);var e="click"===i.type?this.al(i):void 0;if(_(e))return;this._l(i,"$autocapture",e)}catch(t){Fr.error("Failed to capture event",t)}};if(ce(t,"blur",e),ce(i,"submit",e,{capture:!0}),ce(i,"change",e,{capture:!0}),ce(i,"click",e,{capture:!0}),he(["pointerdown","pointermove","pointerup","pointercancel"],t=>{ce(i,t,e,{capture:!0})}),this.rl().capture_copied_text){var r=this.wl=i=>{i=i||(null==t?void 0:t.event);try{this._l(i,Pr)}catch(t){Fr.error("Failed to capture clipboard event",t)}};ce(i,"copy",r,{capture:!0}),ce(i,"cut",r,{capture:!0}),ce(i,"paste",r,{capture:!0})}}}else Fr.info("Disabling Automatic Event Collection because this browser is not supported")}pl(){var t=this.ml,i=this.yl;this.el(),this.bl&&(null==t||t.removeEventListener("blur",this.bl),he(["pointerdown","pointermove","pointerup","pointercancel"],t=>{null==i||i.removeEventListener(t,this.bl,!0)}),null==i||i.removeEventListener("submit",this.bl,!0),null==i||i.removeEventListener("change",this.bl,!0),null==i||i.removeEventListener("click",this.bl,!0),this.bl=void 0),this.wl&&(null==i||i.removeEventListener("copy",this.wl,!0),null==i||i.removeEventListener("cut",this.wl,!0),null==i||i.removeEventListener("paste",this.wl,!0),this.wl=void 0),this.ml=void 0,this.yl=void 0,this.ll=!1}startIfEnabled(){this.isEnabled||this.el(),!this.Ci&&this.xa&&this.isEnabled&&!this.ll&&(this.gl(),this.ll=!0)}onRemoteConfig(t){if(!this.Ci)if(this.cl=!0,t.ok){var i=t.config;i.elementsChainAsString&&(this.dl=i.elementsChainAsString);var e,r=i.autocapture_opt_out;y(r)&&(null==(e=this.xa)||e.kv.set(Re,r),this.ul=r),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(t,i){if(void 0===i&&(i=this),!this.Ci){t.size?this.hl.set(i,new Set(t)):this.hl.delete(i);var e=new Set;this.hl.forEach(t=>{t.forEach(t=>e.add(t))}),this.vl=e}}getElementSelectors(t,i){var e,r=[];return null==(e=this.vl)||e.forEach(e=>{var s;null==(s=Er())||null==(s=s.querySelectorAll(e))||s.forEach(s=>{t!==s&&i!==s||n(r,e)||r.push(e)})}),r}get isEnabled(){var t,i;if(this.Ci)return!1;var e=null==(t=this.xa)?void 0:t.kv.get(Re),r=this.ul,s=this.rl();if(!s.remoteRequestsDisabled&&!this.cl)return!1;var n=s.remoteRequestsDisabled&&!this.cl;if(_(r)&&!y(e)&&!n)return!1;var a=null!==(i=this.ul)&&void 0!==i?i:!!e;return!!s.enabled&&!a}_l(t,e,r){if(void 0===e&&(e="$autocapture"),this.isEnabled){var s=r||Be(t);je(s)&&(s=s.parentNode||null);var n,a=this.fl();"$autocapture"===e&&"click"===t.type&&t instanceof MouseEvent&&a.rageclick&&null!=(n=this.rageclicks)&&n.isRageClick(t.clientX,t.clientY,t.timeStamp||(new Date).getTime())&&nr(s,a.rageclick)&&this._l(t,"$rageclick",r);var o=e===Pr,l=o?i({},a,{dom_event_allowlist:void 0}):a;if(s&&function(t,i,e,r,s,n){var a,o=typeof window>"u"?void 0:window;if(!o||ar(t))return!1;if(null!=e&&e.url_allowlist&&!Ne(e.url_allowlist,n))return!1;if(null!=e&&e.url_ignorelist&&Ne(e.url_ignorelist,n))return!1;if(null!=e&&e.dom_event_allowlist){var l=e.dom_event_allowlist;if(l&&!l.some(t=>i.type===t))return!1}var u=or(t,r),h=u.parentIsUsefulElement,v=u.targetElementList;if(!function(t,i){var e=null==i?void 0:i.element_allowlist;if(f(e))return!0;var r,s=function(t){if(e.some(i=>t.tagName.toLowerCase()===i))return{v:!0}};for(var n of t)if(r=s(n))return r.v;return!1}(v,e))return!1;if(!We(v,null==e?void 0:e.css_selector_allowlist))return!1;if(We(v,null!==(a=null==e?void 0:e.css_selector_ignorelist)&&void 0!==a?a:Ge))return!1;try{var d=o.getComputedStyle(t);if(d&&"pointer"===d.getPropertyValue("cursor")&&"click"===i.type)return!0}catch(t){}var c=t.tagName.toLowerCase();switch(c){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 h?(s||["click"]).indexOf(i.type)>=0:(s||["click"]).indexOf(i.type)>=0&&(qe.indexOf(c)>-1||"true"===t.getAttribute("contenteditable"))}}(s,t,l,o,o?["copy","cut","paste"]:void 0,{config:{get_current_url:a.getCurrentUrl}})){var u,h=Cr(s,{e:t,maskAllElementAttributes:a.maskAllElementAttributes,maskAllText:a.maskAllText,elementAttributeIgnoreList:a.element_attribute_ignorelist,elementsChainAsString:this.dl,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),e===Pr){var c=t.type||"clipboard";if("paste"!==c){var p,g,_=null==(p=xr())||null==(p=p.getSelection())?void 0:p.toString(),b=He(_);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=c}return null==(u=this.xa)||u.capture(e,v),!0}}else this.el()}isBrowserSupported(){var t;return v(null==(t=Er())?void 0:t.querySelectorAll)}},Rr=class{constructor(t){this._instance=t}refresh(t){var i=this._instance.config,e=d(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}},Or="$surveys",Mr="$surveys_loaded_at",Ir="PostHog loadExternalDependency extension not found.",jr="$surveys_activated",Lr="$surveys_activated_session",Dr="$surveys_activated_timestamps",Nr="$heatmaps_enabled_server_side",zr="$exception_capture_enabled_server_side",Hr="$error_tracking_suppression_rules",Ur="$error_tracking_capture_extension_exceptions",Br="$web_vitals_enabled_server_side",qr="$dead_clicks_enabled_server_side",Vr="$product_tours_enabled_server_side",Wr="$web_vitals_allowed_metrics",Kr="$session_recording_remote_config",Gr="$replay_override_sampling",Jr="$replay_override_linked_flag",Xr="ph_product_tours",Zr="$sdk_debug_recording_script_not_loaded",Qr="$sdk_debug_replay_stale_config",Yr="beforeunload",ts="u">typeof window?window:void 0,is="u">typeof globalThis?globalThis:ts,es=null==is?void 0:is.navigator,rs=null==is?void 0:is.document,ss=null==is?void 0:is.location;null!=is&&is.XMLHttpRequest&&new is.XMLHttpRequest;var ns="undefined"!=typeof globalThis?globalThis:ts;ns&&"undefined"==typeof self&&(ns.self=ns),ns&&"undefined"==typeof File&&(ns.File=function(){});var as=null!=ts?ts:{},os=le("[Dead Clicks]"),ls=()=>!0,us=class{get lazyLoadedDeadClicksAutocapture(){return this.Il}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({[qr]:i.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.Ml(()=>{this.El()}):this.stop()}Ml(t){var i,e;null!=(i=as.__PosthogExtensions__)&&i.initDeadClicksAutocapture?t():null==(e=as.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this.instance,"dead-clicks-autocapture",i=>{i?os.error("failed to load script",i):t()})}El(){var t;if(rs){if(!this.Il&&null!=(t=as.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var e=d(this.instance.config.capture_dead_clicks)?i({},this.instance.config.capture_dead_clicks):{};e.__onCapture=this.onCapture,this.onCapture&&(e.capture_dead_swipes=!1),this.Il=as.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,e),this.Il.start(rs),os.info("starting...")}}else os.error("`document` not found. Cannot start.")}stop(){this.Il&&(this.Il.stop(),this.Il=void 0,os.info("stopping..."))}},hs=le("[ExceptionAutocapture]"),vs=()=>{try{return"u">typeof window&&!1!==window.navigator.onLine}catch(t){return!1}},ds=(t,i)=>t>=i&&vs(),cs=(t,i,e,r)=>{if(0===t){if(vs()){var s=i+1;return s===e&&r(),s}return i}return 0},fs=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(!h(e)||2>e.length)return"";var a=e[1].replace(/\+/g," ");try{a=decodeURIComponent(a)}catch(t){oe.error("Skipping decoding for malformed query param: "+a)}return a},ps=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("&"),u=[],v=0;l.length>v;v++){var d=l[v].split("=");h(d)&&(i.includes(d[0])?u.push(d[0]+"="+e):u.push(l[v]))}var c=o;return null!=a&&(c+="?"+u.join("&")),null!=s&&(c+="#"+s),c},gs=function(t,i){var e=t.match(new RegExp(i+"=([^&]*)"));return e?e[1]:null},_s=()=>{},bs=t=>{var i;if(v(t))return null!==(i=t.__posthog_layer__)&&void 0!==i?i:t.__rrweb_layer__};function ms(t,i,e){try{if(!(i in t))return _s;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 v(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=bs(e);n;){if(n.next===s)return void(n.next=r.next);n=bs(e=n.next)}else t[i]=r.next}}catch(t){return _s}}var ys=le("[TracingHeaders]");function ws(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}var Ss=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","oppref","bfcid","irclid","_kx"],ks=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Ss],xs="<masked>",Es=["li_fat_id"];var Ps=le("[Web Vitals]"),Fs=9e5,As=["CLS","FCP","INP","LCP"],Ts=["INP","LCP"],Cs=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],$s=le("[RemoteConfig]"),Rs=class{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=as._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}Wu(t){var i,e;null!=(i=as.__PosthogExtensions__)&&i.loadExternalDependency?null==(e=as.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"remote-config",()=>t(this.remoteConfig)):t()}Vu(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 $s.info("Using preloaded remote config",this.remoteConfig),void this.Gu(this.remoteConfig);if(this._instance._shouldDisableFlags())return void $s.warn("Remote config is disabled. Falling back to local config.");this.Wu(t=>{if(!t)return $s.info("No config found after loading remote JS config. Falling back to JSON."),void this.Vu(t=>{this.Gu(t.json,t)});this.Gu(t)})}catch(t){$s.error("Error loading remote config",t),this.Gu()}}Gu(t,i){!t&&i&&(0===i.statusCode?i.error||$s.warn("Failed to fetch remote config from PostHog."):$s.error("Failed to fetch remote config from PostHog."));try{this._instance.Gu(t?{ok:!0,config:t}:{ok:!1})}catch(t){$s.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){$s.error("Error loading feature flags",t)}}},Os="disabled",Ms="lazy_loading",Is=le("[SessionRecording]"),js=[Zr,Qr,"$sdk_debug_replay_event_trigger_status","$sdk_debug_replay_linked_flag_trigger_status","$sdk_debug_replay_matched_recording_trigger_groups","$sdk_debug_replay_pending_trigger_conditions","$sdk_debug_replay_remote_trigger_matching_config","$sdk_debug_replay_trigger_groups_count","$sdk_debug_replay_url_trigger_status"],Ls=le("[Heatmaps]");function Ds(t){return d(t)&&"clientX"in t&&"clientY"in t&&m(t.clientX)&&m(t.clientY)}var Ns=le("[Product Tours]"),zs=t=>{var i;return!t.config.disable_product_tours&&!(null==(i=t.persistence)||!i.get_property(Vr))},Hs=le("[SiteApps]"),Us="Error while initializing PostHog app with config id ",Bs="events",qs="cancelEvents",Vs="survey shown",Ws="survey dismissed",Ks="survey sent";function Gs(t){var i;return!(null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)||!i.length)}var Js=(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}},Xs=t=>t.toLowerCase(),Zs={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=>Js(i,t))),not_regex:(t,i)=>i.every(i=>t.every(t=>!Js(i,t))),icontains:(t,i)=>i.map(Xs).some(i=>t.map(Xs).some(t=>i.includes(t))),not_icontains:(t,i)=>i.map(Xs).every(i=>t.map(Xs).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 Qs(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=Zs[e.operator];return!!s&&s(e.values.map(String),[String(r)])})}var Ys=le("[Surveys]"),tn=["popover","widget","api"],en=class{on(t,i){return this.bo[t]||(this.bo[t]=[]),this.bo[t].push(i),()=>{this.bo[t]=this.bo[t].filter(t=>t!==i)}}emit(t,i){for(var e of this.bo[t]||[])e(i);for(var r of this.bo["*"]||[])r(t,i)}constructor(){this.bo={}}};function rn(t,i,e){if(b(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}}var sn=class{constructor(t){this.Ai=t,this._o=new Set,this.wo=new Set,this.ko=new en,this.So=(t,i)=>this.xo(t,i)&&this.$o(t,i)&&this.Co(t,i)&&this.To(t,i),this.xo=(t,i)=>null==i||!i.event||(null==t?void 0:t.event)===(null==i?void 0:i.event)}init(){var t,i;f(null==(t=this.Ai)?void 0:t.subscribeCapture)||(this.Io=null==(i=this.Ai)?void 0:i.subscribeCapture((t,i)=>{this.on(t,i)}))}dispose(){var t,i;null==(t=this.Io)||t.call(this),this.Io=void 0,null==(i=this.Ai)||null==i.setElementSelectors||i.setElementSelectors(new Set,this),this.ko=new en}register(t){var i,e;if(!f(null==(i=this.Ai)?void 0:i.subscribeCapture)&&(t.forEach(t=>{var i;this._o.add(t),null==(i=t.steps)||i.forEach(t=>{this.wo.add((null==t?void 0:t.event)||"")})}),null!=(e=this.Ai)&&e.setElementSelectors)){var r=new Set;this._o.forEach(t=>{var i;null==(i=t.steps)||i.forEach(t=>{null!=t&&t.selector&&r.add(t.selector)})}),this.Ai.setElementSelectors(r,this)}}replace(t){this._o.clear(),this.wo.clear(),this.register(t)}on(t,i){null!=i&&0!=t.length&&(this.wo.has(t)||this.wo.has(i.event))&&this._o.forEach(t=>{this.Mo(i,t)&&this.ko.emit("actionCaptured",t.name)})}Eo(t){this.onAction("actionCaptured",i=>t(i))}Mo(t,i){if(null==(null==i?void 0:i.steps))return!1;for(var e of i.steps)if(this.So(t,e))return!0;return!1}onAction(t,i){return this.ko.on(t,i)}$o(t,i){if(null!=i&&i.url){var e,r=null==t||null==(e=t.properties)?void 0:e.$current_url;if(null==t||!t.properties||!("$current_url"in t.properties))try{var s;r=null==(s=this.Ai)||null==s.getActionUrl?void 0:s.getActionUrl()}catch(t){return!1}if(!r||"string"!=typeof r)return!1;if(!rn(r,i.url,i.url_matching||"contains"))return!1}return!0}Co(t,i){return!!this.Po(t,i)&&!!this.Ro(t,i)&&!!this.Ao(t,i)}Po(t,i){var e;if(null==i||!i.href)return!0;var r=this.Fo(t);if(r.length>0)return r.some(t=>rn(t.href,i.href,i.href_matching||"exact"));var s,n=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!n&&rn((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",i.href,i.href_matching||"exact")}Ro(t,i){var e;if(null==i||!i.text)return!0;var r=this.Fo(t);if(r.length>0)return r.some(t=>rn(t.text,i.text,i.text_matching||"exact")||rn(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;!b(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=>rn(t,n,a)))}Ao(t,i){var e,r;if(null==i||!i.selector)return!0;if(null!=t&&null!=(e=t.properties)&&null!=(e=e.$element_selectors)&&e.includes(i.selector))return!0;var s=(null==t||null==(r=t.properties)?void 0:r.$elements_chain)||"";if(i.selector_regex&&s)try{return new RegExp(i.selector_regex).test(s)}catch(t){}return!1}Fo(t){var i;return null==(null==t||null==(i=t.properties)?void 0:i.$elements)?[]:null==t?void 0:t.properties.$elements}To(t,i){return null==i||!i.properties||0===i.properties.length||Qs(i.properties.reduce((t,i)=>{var e=h(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)}},nn=class{constructor(t,i){this.Oo=i,this.Do=[],this.Ai=t,this.Lo=new Map,this.No=new Map,this.qo=new Map}jo(){var t,i;this.Bo=null==(t=(i=this.Ai).subscribeSession)?void 0:t.call(i,t=>this.zo(t))}Ho(t){return!1}Uo(){return null}Wo(t){}Vo(){}Go(t,i){return!!t&&Qs(t.propertyFilters,null==i?void 0:i.properties)}Qo(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}Zo(t,i,e){var r=(e===Bs?this.Lo:this.No).get(t),s=[];return this.Jo(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.Go(n,i)})}register(t){this.Ko(t,!1)}replace(t){this.Ko(t,!0)}Ko(t,i){f(this.Ai.subscribeCapture)||(this.Xo(t,i),this.Yo(t,i))}Yo(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.qo.clear(),0!==e.length){this.ta||(this.ta=new sn(this.Ai),this.ta.init(),this.ta.Eo(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.qo.get(i.name))&&void 0!==e?e:[];s.includes(t.id)||s.push(t.id),this.qo.set(i.name,s)}})}),i?this.ta.replace(r):this.ta.register(r)}else{var s;i&&(null==(s=this.ta)||s.replace([]))}}ea(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)})}Xo(t,i){var e,r,s,n=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}),a=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}),o=this.Qo(t,Bs),l=this.Qo(t,qs);i?(this.Lo=o,this.No=l):(this.ea(this.Lo,o),this.ea(this.No,l)),(0!==n.length||0!==a.length||t.some(t=>{var i;return null==(i=t.conditions)||null==(i=i.actions)||null==(i=i.values)?void 0:i.length}))&&(null!==(e=this.Io)&&void 0!==e||(this.Io=null==(r=(s=this.Ai).subscribeCapture)?void 0:r.call(s,(t,i)=>{this.onEvent(t,i)})))}onEvent(t,i){var e,r,s=this.ia(),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.na(t,n,i);if("consume"===a)return s.info("event consumed activated item, removing it",{event:t,itemId:n}),void this.sa([n]);if("persist"===a)return s.info("shown item promoted to persisted activation",{event:t,itemId:n}),this.ra(n),void this.oa([n])}if(this.No.has(t)){var o=this.Zo(t,i,qs);o.length>0&&(s.info("cancel event matched, cancelling items",{event:t,itemsToCancel:o.map(t=>t.id)}),this.sa(o.map(t=>t.id)),o.forEach(t=>this.aa(t.id)))}if(this.Lo.has(t)){s.info("event name matched",{event:t,eventPayload:i,items:this.Lo.get(t)});var l=this.Zo(t,i,Bs);this.la(l.map(t=>t.id))}}onAction(t){this.qo.has(t)&&this.la(this.qo.get(t)||[])}la(t){if(0!==t.length){var i=!!this.Ai.getSessionId(),e=[];for(var r of t)i&&this.Ho(r)?this.ra(r)&&this.ua(r):e.push(r);e.length>0&&(this.Do=[...new Set([...this.Do,...e])]),this.ia().info("updating activated items",{activatedItems:this.getActivatedIds()}),this.ca()}}ra(t){this.Do=this.Do.filter(i=>i!==t);var i=this.ha();return!i.includes(t)&&(this.da([...i,t]),this.va(),!0)}sa(t){var i=new Set(t);this.Do=this.Do.filter(t=>!i.has(t));var e=this.fa(),r=e.filter(t=>!i.has(t));r.length!==e.length&&(this.da(r),0===r.length&&this.pa()),this.oa(t),this.ca()}ca(){try{var t;null==(t=this.Oo)||t.call(this)}catch(t){this.ia().error("Error while handling activated items change",t)}}ga(){var t=this.Uo();if(!t)return{};var i=this.Ai.getProperty(t);return i&&"object"==typeof i?i:{}}ua(t){if(this.Uo()){var e=this.ga();this.Wo(i({},e,{[t]:Date.now()}))}}oa(t){if(this.Uo()){var i=this.ga(),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&&(c(e)?this.Vo():this.Wo(e))}}ma(){this.Uo()&&this.Vo()}getActivationTimestamp(t){if(this.ha().includes(t)){var i=this.ga()[t];return m(i)?i:void 0}}fa(){var t=this.ya();return this.Ai.getProperty(t)||[]}ha(){var t=this.fa();if(0===t.length)return[];var i=this.Ai.getProperty(this.ba()),e=this.Ai.getSessionId();return e&&i===e?t:[]}va(){var t=this.Ai.getSessionId();t&&this._a(t)}pa(){this.wa()}zo(t){var i=this.Ai.getProperty(this.ba());if(i&&i!==t){var e=this.fa(),r=this.ga();e.length>0&&(this.da([]),e.filter(t=>m(r[t])).forEach(t=>this.aa(t))),this.pa(),this.ma(),e.length>0&&this.ca()}}getActivatedIds(){return[...new Set([...this.ha(),...this.Do])].filter(t=>!this.ka(t))}dispose(){var t,i,e;null==(t=this.Bo)||t.call(this),this.Bo=void 0,null==(i=this.Io)||i.call(this),this.Io=void 0,null==(e=this.ta)||e.dispose(),this.ta=void 0}reset(){this.Do=[],this.fa().length>0&&this.da([]),this.pa(),this.ma(),this.ca()}getEventToItemsMap(){return this.Lo}Sa(){return this.ta}},an=class extends nn{constructor(t,i,e,r){var s;super({subscribeCapture(i){var e=t.onEvent(t=>i(t.event,t));return()=>e.dispose()},subscribeSession(i){var e=t.onSession(i);return()=>e.dispose()},getSessionId(){var i;return null==(i=t.session)?void 0:i.sessionId},getProperty:i=>t.kv.get(i),getActionUrl:null==e?void 0:e.getActionUrl,setElementSelectors:null!==(s=null==e?void 0:e.setElementSelectors)&&void 0!==s?s:(i,e)=>{var r;return null==(r=t.getExtension("autocapture"))?void 0:r.setElementSelectors(i,e)}},r),this.xa=t,this.$a=i,this.jo()}ya(){return jr}ba(){return Lr}Uo(){return Dr}Wo(t){this.xa.kv.set({[Dr]:t})}Vo(){this.xa.kv.remove(Dr)}Ho(t){var i,e;this.Jo(i=>{e=i.find(i=>i.id===t)});var r=null==(i=e)||null==(i=i.appearance)?void 0:i.surveyPopupDelaySeconds;return m(r)&&r>0}Ca(){return Vs}Jo(t){this.$a.getSurveys(t)}aa(t){this.$a.cancelPendingSurvey(t)}ia(){return Ys}da(t){this.xa.kv.set({[jr]:t})}_a(t){this.xa.kv.set({[Lr]:t})}wa(){this.xa.kv.remove(Lr)}ka(){return!1}na(t,i,e){var r,s;return t===Ks&&!1===(null==e||null==(r=e.properties)?void 0:r.$survey_completed)?"ignore":(this.Jo(t=>{s=t.find(t=>t.id===i)}),!s||function(t){var i;return Gs(t)&&!(null==(i=t.conditions)||null==(i=i.events)||!i.repeatedActivation)||"always"===t.schedule}(s)?t===Vs?"consume":"ignore":t===Vs?"persist":t===Ws||t===Ks?"consume":"ignore")}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},on=(t,i)=>null!=t&&t.then?t.then(i):i(t),ln="SDK is not enabled or survey functionality is not yet loaded",un="Disabled. Not loading surveys.",hn=class{constructor(t){this.Ta=t,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Ia=!1,this.Ma=!1,this.Ea=[],this.Pa=[],this.Ra=null,this.Aa=null,this.Ci=!1,this.Fa=new Set,this.onRemoteConfig=t=>{if(!this.Ci&&!this.Ar.disableSurveys){if(!t.ok)return this.Ma=!0,this.Oa({isLoaded:!1,error:"Remote config unavailable. Not loading surveys."}),Ys.warn("Remote config unavailable. Not loading surveys.");var i=t.config.surveys;if(b(i))return Ys.warn("Flags not loaded yet. Not loading surveys.");this.Da=y(i)?i:i.length>0,Ys.info("flags response received, isSurveysEnabled: "+this.Da),this.loadIfEnabled()}},this.Oa=t=>{this.Pa.slice().forEach(i=>this.La(i,t))}}setup(t){if(!this.Ci)return this.Na=t,on(t.kv.initialize(),()=>{if(this.Na===t&&!this.Ci){this.Na=void 0,this.xa=t;var i=t.onRemoteConfig(this.onRemoteConfig);this.Ci?i.dispose():(this.qa=i,this.loadIfEnabled())}})}dispose(){var t,i,e,r;this.Ci||(this.Ci=!0,this.Na=void 0,this.xa=void 0,null==(t=this.qa)||t.dispose(),this.qa=void 0,null==(i=this._surveyEventReceiver)||i.dispose(),this._surveyEventReceiver=null,null==(e=this._surveyManager)||null==e.dispose||e.dispose(),this._surveyManager=null,this.Ea=[],this.Pa.forEach(t=>{t.active=!1}),this.Pa=[],null==(r=this.ja)||r.call(this),this.ja=void 0,this.Ra=null,this.Fa.forEach(t=>clearTimeout(t)),this.Fa.clear())}get Ar(){return this.Ta.get()}getRenderContext(){if(this.xa){var t=this;return{client:this.xa,get config(){return t.Ar},surveys:t}}}initialize(){this.loadIfEnabled()}reset(){var t;null==(t=this._surveyManager)||null==t.clearInMemoryInProgressSurveyState||t.clearInMemoryInProgressSurveyState();try{var i;null==(i=this._surveyEventReceiver)||i.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var e=[],r=0;r<localStorage.length;r++){var s=localStorage.key(r);(null!=s&&s.startsWith("seenSurvey_")||null!=s&&s.startsWith("inProgressSurvey_"))&&e.push(s)}e.forEach(t=>localStorage.removeItem(t))}catch(t){}this.Oa()}loadIfEnabled(){if(!this.Ci&&this.xa){var t=this.Ar;if(!this._surveyManager)if(this.Ia)Ys.info("Already initializing surveys, skipping...");else if(t.disableSurveys)Ys.info(un);else if(t.cookielessMode&&this.xa.isOptedOut)Ys.info("Not loading surveys in cookieless mode without consent.");else{var i=this.Ta.getExtensions();if(i){if(!f(this.Da)||t.advancedEnableSurveys){var e=this.Da||t.advancedEnableSurveys;this.Ia=!0,this.Ma=!1;try{var r=i.generateSurveys;if(r)return this.za(r,e),void(this.Ia=!1);var s=i.loadExternalDependency;if(!s)return this.Ba(Ir),void(this.Ia=!1);s(t=>{try{if(this.Ci)return;var i=this.Ta.getExtensions();t||null==i||!i.generateSurveys?this.Ba("Could not load surveys script",t):this.za(i.generateSurveys,e)}finally{this.Ia=!1}})}catch(t){throw this.Ia=!1,this.Ba("Error initializing surveys",t),t}}}else this.Ba("PostHog Extensions not found.")}}}za(t,i){var e;if(!this.Ci){this._surveyManager=t(i),this._surveyEventReceiver=this.Ha(this.xa,this.Oa);var r=null==(e=this.xa)?void 0:e.kv.get(Or);r&&this.Ua(r),Ys.info("Surveys loaded successfully"),this.Wa(),this.Oa(),this.Va({isLoaded:!0})}}Ha(t,i){return new an(t,this,void 0,i)}Ba(t,i){this.Ma=!0,Ys.error(t,i),this.Oa({isLoaded:!1,error:t}),this.Va({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.Ea.push(t),this._surveyManager&&this.Va({isLoaded:!0}),()=>{this.Ea=this.Ea.filter(i=>i!==t)}}getSurveys(t,i){if(void 0===i&&(i=!1),!this.Ci){var e=this.xa;if(!e)return t([],{isLoaded:!1,error:ln});if(this.Ar.disableSurveys)return Ys.info(un),t([]);var r=e.kv.get(Or);if(r&&!i)return t(r,{isLoaded:!0}),void(this.Ga()&&this.getSurveys(()=>{},!0));if(this.Ra)this.Ra.then(i=>{this.Ci||t(i.surveys,i.context)}).catch(t=>Ys.error("Error in survey callback",t));else{var s=e.sendRequest("/api/surveys/",{method:"GET",query:{token:e.projectToken},sentAt:"query",timeoutMs:this.Ar.requestTimeoutMs}).then(t=>{try{return this.Qa(e,t)}catch(t){return Ys.error("Error processing surveys response",t),this.Qa(e,{statusCode:0,error:t})}},t=>this.Qa(e,{statusCode:0,error:t}));this.Ra=s;var n=()=>{this.Ra===s&&(this.Ra=null)};s.then(i=>{n(),this.Ci||(this.Oa(i.context),t(i.surveys,i.context))},n).catch(t=>Ys.error("Error in survey callback",t))}}}Qa(t,i){if(this.Ci)return{surveys:[],context:{isLoaded:!1,error:ln}};var e=i.statusCode;if(200!==e||!i.json){var r="Surveys API could not be loaded, status: "+e;return 0!==e?Ys.error(r):i.error||Ys.warn(r),this.Aa=Date.now(),{surveys:[],context:{isLoaded:!1,error:r}}}this.Aa=null;var s=i.json.surveys||[];return t.kv.set({[Or]:s,[Mr]:Date.now()}),this.Ua(s),{surveys:s,context:{isLoaded:!0}}}Ua(t){var i=t.filter(t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(Gs(t)||function(t){var i;return!(null==(i=t.conditions)||null==(i=i.actions)||null==(i=i.values)||!i.length)}(t)));this.Za(i)}Za(t){var i;null==(i=this._surveyEventReceiver)||i.replace(t)}Ga(){return this.Ja()&&!this.Ra&&!this.Ka()}Ja(){var t,i=null==(t=this.xa)?void 0:t.kv.get(Mr);return m(i)&&Date.now()-i>3e5}Ka(){return m(this.Aa)&&3e5>Date.now()-this.Aa}markSurveyAsSeen(t,i){var e;(t=>{try{var i=(t=>((t,i)=>"seenSurvey_"+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){Ys.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){}this.Oa()}Va(t){for(var i of this.Ea){if(this.Ci)return;try{t.isLoaded?this.getSurveys(i):i([],t)}catch(t){Ys.error("Error in survey callback",t)}}}getActiveMatchingSurveys(t,i){if(void 0===i&&(i=!1),!b(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,i);Ys.warn("init was not called")}onActiveMatchingSurveysChanged(t){var i;if(this.Ci)return()=>{};var e={callback:t,active:!0,revision:0};this.Pa.push(e),this.Wa();var r=null==(i=this.xa)?void 0:i.kv.get(Or);return this.Ar.disableSurveys||!this._surveyManager&&this.Ma&&!this.Ia||!r&&!b(this.Aa)&&!this.Ra?this.La(e,{isLoaded:!1}):this._surveyManager&&this.La(e),()=>{var t;e.active=!1,this.Pa=this.Pa.filter(t=>t!==e),0===this.Pa.length&&(null==(t=this.ja)||t.call(this),this.ja=void 0)}}Wa(){var t,i,e;this._surveyManager&&this.Pa.length>0&&(null!==(t=this.ja)&&void 0!==t||(this.ja=null==(i=(e=this.Ta).onMatchingConditionsChanged)?void 0:i.call(e,this.Oa)))}La(t,i){if(!this.Ci&&t.active){var e=++t.revision,r=r=>{if(!this.Ci&&t.active&&e===t.revision)try{var s=null!=i?i:{isLoaded:!0},n=JSON.stringify([r,s]);if(n===t.lastResult)return;t.lastResult=n,t.callback(r,s)}catch(t){Ys.error("Error in active matching surveys callback",t)}};try{i&&!i.isLoaded?r([]):this.getActiveMatchingSurveys(r)}catch(t){Ys.error("Error in active matching surveys callback",t)}}}Xa(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}Ya(t){if(b(this._surveyManager))return{eligible:!1,reason:ln};var i="string"==typeof t?this.Xa(t):t;return i?this._surveyManager.checkSurveyEligibility(i):{eligible:!1,reason:"Survey not found"}}tl(t){var i;if(null==(i=this.xa)||!i.canCapture)return{eligible:!1,reason:"PostHog is not capturing, so a survey response cannot be recorded"};if(b(this._surveyManager))return{eligible:!1,reason:ln};var e="string"==typeof t?this.Xa(t):t;return e?this._surveyManager.checkSurveyRenderability(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(b(this._surveyManager))return Ys.warn("init was not called"),{visible:!1,disabledReason:ln};var i=this.tl(t);return{visible:i.eligible,disabledReason:i.reason}}canRenderSurveyAsync(t,i){return b(this._surveyManager)?(Ys.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:ln})):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.tl(s);e({visible:n.eligible,disabledReason:n.reason})}else e({visible:!1,disabledReason:"Survey not found"})},i)})}renderSurvey(t,i,e){var r,s,n;if(null!=(r=this.xa)&&r.canCapture)if(b(this._surveyManager))Ys.warn("init was not called");else{var a="string"==typeof t?this.Xa(t):t;if(null!=a&&a.id)if(tn.includes(a.type)){var o=null==(s=typeof document>"u"?void 0:document)?void 0:s.querySelector(i);if(o)if(null!=(n=a.appearance)&&n.surveyPopupDelaySeconds){Ys.info("Rendering survey "+a.id+" with delay of "+a.appearance.surveyPopupDelaySeconds+" seconds");var l=setTimeout(()=>{var t,i,r;this.Fa.delete(l),!this.Ci&&null!=(t=this.xa)&&t.canCapture&&(Ys.info("Rendering survey "+a.id+" with delay of "+(null==(i=a.appearance)?void 0:i.surveyPopupDelaySeconds)+" seconds"),null==(r=this._surveyManager)||r.renderSurvey(a,o,e),Ys.info("Survey "+a.id+" rendered"))},1e3*a.appearance.surveyPopupDelaySeconds);this.Fa.add(l)}else this._surveyManager.renderSurvey(a,o,e);else Ys.warn("Survey element not found")}else Ys.warn("Surveys of type "+a.type+" cannot be rendered in the app");else Ys.warn("Survey not found")}}displaySurvey(t,e){var r,s;if(null!=(r=this.xa)&&r.canCapture)if(b(this._surveyManager))Ys.warn("init was not called");else{var n=this.Xa(t);if(n){var a=n;if(null!=(s=n.appearance)&&s.surveyPopupDelaySeconds&&e.ignoreDelay&&(a=i({},n,{appearance:i({},n.appearance,{surveyPopupDelaySeconds:0})})),"popover"!==e.displayType&&e.initialResponses&&Ys.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===e.ignoreConditions){var o=this.Ya(n);if(!o.eligible)return void Ys.warn("Survey is not eligible to be displayed: ",o.reason)}"inline"!==e.displayType?this._surveyManager.handlePopoverSurvey(a,e):this.renderSurvey(a,e.selector,e.properties)}else Ys.warn("Survey not found")}}cancelPendingSurvey(t){b(this._surveyManager)?Ys.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||null==t.handlePageUnload||t.handlePageUnload()}};ne.DEBUG=!1,ne.LIB_VERSION="1.438.23",ne.LIB_NAME="web";var vn=ne,dn=new WeakMap,cn=class{constructor(t){this._instance=t}get(){var t,i,e,r,s=null==(t=this._instance)?void 0:t.config;return{disableSurveys:!(null==s||!s.disable_surveys),cookielessMode:!(null==s||!s.cookieless_mode),advancedEnableSurveys:!(null==s||!s.advanced_enable_surveys),requestTimeoutMs:null!==(i=null==s?void 0:s.surveys_request_timeout_ms)&&void 0!==i?i:1e4,prefillFromUrl:!(null==s||null==(e=s.surveys)||!e.prefillFromUrl),automaticDisplay:!(null!=s&&s.disable_surveys_automatic_display),featureFlagEvaluation:!(null!=s&&s.advanced_disable_feature_flags),overrideLanguage:null==s?void 0:s.override_display_language,prepareStylesheet:null==s?void 0:s.prepare_external_dependency_stylesheet,get_current_url:null==s?void 0:s.get_current_url,uiHost:null==(r=this._instance)||null==(r=r.requestRouter)?void 0:r.endpointFor("ui","")}}getExtensions(){var t=null==as?void 0:as.__PosthogExtensions__;if(t&&this._instance){var i=this._instance,e=t.generateSurveys,r=t.loadExternalDependency;return{generateSurveys:e?t=>e(i,t):void 0,loadExternalDependency:r?t=>r(i,"surveys",t):void 0}}}onMatchingConditionsChanged(t){var i,e,r=null==(i=this._instance)?void 0:i._addCaptureHook(i=>{"$pageview"!==i&&i!==Vs&&i!==Ws&&i!==Ks||t()}),s=()=>t();ce(ts,"PHSurveyShown",s);var n=!1,a=null==(e=this._instance)?void 0:e.onFeatureFlags(()=>{n&&t()});return n=!0,()=>{n=!1,null==r||r(),null==a||a(),null==ts||ts.removeEventListener("PHSurveyShown",s)}}},fn=null!=ts&&ts.location?gs(ts.location.hash,"__posthog")||gs(location.hash,"state"):null,pn="_postHogToolbarParams",gn=le("[Toolbar]"),_n=le("[FeatureFlags]"),bn=le("[FeatureFlags]",{debugEnabled:!0}),mn="\" failed. Feature flags didn't load in time.",yn=[502,504],wn=["click","keydown","wheel","touchstart","pointerdown"],Sn="connection_error",kn=t=>{for(var i={},e=0;t.length>e;e++)i[t[e]]=!0;return i},xn=t=>{var i={};for(var e of de(t||{})){var r=e[1];r&&(i[e[0]]=r)}return i},En=class{constructor(t){this.name="featureFlags",this.md=!1,this.featureFlagEventHandlers=[],this.$=_n,this.yd={},this.bd={},this._d=[],this.wd=new Set,this.kd=new Set,this.Sd=!1,this.xd=!1,this.$d=0,this.Cd=!1,this.Td=!1,this.Id=!1,this.Md=!1,this.Ed=!1,this.Pd=0,this.Rd=!1,this.rn=()=>{var t=this.Ad();this.Pd=0,t&&this.reloadFeatureFlags()},this.Fd=()=>{var t,i,e=this.Od,r=null!==(t=this.Dd)&&void 0!==t?t:e;f(e)||f(r)||this.Ar.remoteRequestsDisabled||!this.Ld||"hidden"===this.Ld.visibilityState||Date.now()-(null!==(i=this.Nd)&&void 0!==i?i:0)<r||(this.Dd=this.Rd||!this.Ar.idleRefreshBackoff?e:Math.min(2*r,36e5),this.Rd=!1,this.reloadFeatureFlags(),this.qd())},this.jd=()=>{this.Rd&&this.Dd===this.Od||this.Bd()},this.sn=()=>{var t;"visible"===(null==(t=this.Ld)?void 0:t.visibilityState)&&this.Bd()},this.Ta=t}get zd(){}Hd(){this.xa&&this.Ud()}setup(t){try{this.Wd=typeof window>"u"?void 0:window,this.Ld=typeof document>"u"?void 0:document}catch(t){this.Wd=void 0,this.Ld=void 0}return this.Na=t,this.$=t.logger.createLogger("[FeatureFlags]"),on(t.kv.initialize(),()=>{this.Na===t&&(this.Na=void 0,this.xa=t,this.Vd(t))})}Vd(t){var i;if(this.xa===t)return this.Wd&&ce(this.Wd,"online",this.rn),this.Ud(),this.Gd=t.registerDynamicEventProperties(()=>this.Qd()?this.yd:this.bd),this.Zd=null==(i=this.zd)?void 0:i.onCrossTabFeatureFlagChange(()=>{this.Jd(),this.Kd(),this.Xd()}),this.Kd(),this.initialize()}Bd(){this.Rd=!0,this.Dd=this.Od,this.Fd()}Ud(){var t,i=this.Ar.refreshIntervalMs,e=!this.Ar.remoteRequestsDisabled&&this.Ld&&!f(i)&&i>0?i:void 0;this.Ar.idleRefreshBackoff||(this.Dd=e),e!==this.Od&&(this.Yd(),f(e)||(this.Od=e,this.Dd=e,this.qd(),null!=(t=this.Ld)&&t.addEventListener&&(ce(this.Ld,$e,this.sn),ue(wn,t=>{ce(this.Ld,t,this.jd,{capture:!0})}))))}qd(){f(this.Od)||(f(this.tv)||clearInterval(this.tv),this.Nd=Date.now(),this.tv=setInterval(this.Fd,this.Od))}Yd(){var t;f(this.tv)||(clearInterval(this.tv),this.tv=void 0,null==(t=this.Ld)||null==t.removeEventListener||t.removeEventListener($e,this.sn),ue(wn,t=>{var i;null==(i=this.Ld)||null==i.removeEventListener||i.removeEventListener(t,this.jd,{capture:!0})})),this.Od=void 0,this.Dd=void 0,this.Rd=!1,this.Nd=void 0}destroy(){this.ev()}dispose(){this.ev()}ev(){var t,i,e;this.Yd(),this.$d++,this.Td=!1,this.Na=void 0,this.iv(this.wd,"cancelled"),this.iv(this.kd,"cancelled"),this.xa&&(this.nv(),null==(t=this.Gd)||t.dispose(),this.Gd=void 0,null==(i=this.Zd)||i.call(this),this.Zd=void 0,this._d=[],null==(e=this.Wd)||e.removeEventListener("online",this.rn),this.xa=void 0)}get Ar(){return this.Ta.get()}sv(t){var i;return this.rv&&t in this.rv?this.rv[t]:null==(i=this.xa)?void 0:i.kv.get(t)}Jd(){return!!this.rv&&(this.rv=void 0,!0)}ov(){var t;return!f(null==(t=this.xa)?void 0:t.kv.get("$enabled_feature_flags"))&&this.Jd()}At(t){this.av(()=>{var i;return null==(i=this.xa)?void 0:i.kv.set(t)})}lv(t,i,e){if(this.zd&&t.$enabled_feature_flags){var r=this.sv("$enabled_feature_flags")||{},s=t.$enabled_feature_flags||{},n=i.flags||i.featureFlags,a=i.flags?Object.entries(i.flags).filter(t=>{var i=t[1];return!(null!=i&&i.failed)}).map(t=>t[0]):[],o=!!i.errorsWhileComputingFlags&&!!i.flags,l=o?a:e&&!h(n)?Object.keys(n||{}):Array.from(new Set([...Object.keys(r),...Object.keys(s)])),u=this.sv("$feature_flag_payloads")||{},v=t.$feature_flag_payloads||{},d=o||e?l:Array.from(new Set([...Object.keys(u),...Object.keys(v)])),c=!o&&!e,p=!!c||l,g=!!c||d,_={[_e]:p,[ke]:p,[Ae]:g};for(var b of(t.$feature_flag_details&&(_[be]=p),[we,ye,Se]))f(t[b])||(_[b]=!0);this.zd.markCrossTabFeatureFlagChanges(_)}}Pt(t){this.av(()=>{var i;return null==(i=this.xa)?void 0:i.kv.remove(t)})}av(t){try{t()}catch(t){this.$.error("Failed to update feature flag persistence",t)}}Kd(){var t={};for(var e of[_e,Ae,we,Te]){var r=this.sv(e);f(r)||(t[e]=r)}this.yd=t;var s=i({},t),n=this.sv(ke);if(n)for(var a of Object.entries(n))s["$feature/"+a[0]]=a[1];this.bd=s}Qd(){var t=this.Ar.cacheTtlMs;if(!t||0>=t)return!1;var i=this.sv(ye);return"number"!=typeof i||Date.now()-i>t}uv(){return!!this.Qd()&&(this.Ed||this.xd||(this.Ed=!0,this.$.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}hv(){var t=this.Ar.evaluationContexts;return null!=t&&t.length?t.filter(t=>{var i=t&&"string"==typeof t&&t.trim().length>0;return i||this.$.error("Invalid evaluation context found:",t,"Expected non-empty string"),i}):[]}dv(){var t=this.Ar.flagKeys;if(!f(t))return t.filter(t=>{var i=t&&"string"==typeof t&&t.trim().length>0;return i||this.$.error("Invalid flag key found:",t,"Expected non-empty string"),i})}initialize(){var t,i,e=this.Ar,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=>!f(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.vv({featureFlags:o,featureFlagPayloads:l},void 0,{persist:!1})}}updateFlags(t,e,r){var s,n,a=null!=r&&r.merge&&null!==(s=this.sv("$enabled_feature_flags"))&&void 0!==s?s:{},o=null!=r&&r.merge&&null!==(n=this.sv("$feature_flag_payloads"))&&void 0!==n?n:{},l=i({},a,t),u=i({},o,e),h={};for(var v of Object.entries(l)){var d=v[0],c=v[1];h[d]={key:d,enabled:qt(c),variant:Vt(c),reason:void 0,metadata:f(null==u?void 0:u[d])?void 0:{id:0,version:void 0,description:void 0,payload:u[d]}}}this.vv({flags:h})}get hasLoadedFlags(){return this.Sd}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.sv(be),e=this.sv(Te),r=this.sv(Ce);if(!r&&!e)return t||{};var s=ve({},t||{});for(var n of[...new Set([...Object.keys(r||{}),...Object.keys(e||{})])]){var a,o,l=s[n],u=null==e?void 0:e[n],h=f(u)?null!==(a=null==l?void 0:l.enabled)&&void 0!==a&&a:!!u,v=f(u)?null==l?void 0:l.variant:"string"==typeof u?u:void 0,d=null==r?void 0:r[n],c=i({},l,{enabled:h,variant:h?null!=v?v:null==l?void 0:l.variant:void 0});h!==(null==l?void 0:l.enabled)&&(c.original_enabled=null==l?void 0:l.enabled),v!==(null==l?void 0:l.variant)&&(c.original_variant=null==l?void 0:l.variant),d&&(c.metadata=i({},null==l?void 0:l.metadata,{payload:d,original_payload:null==l||null==(o=l.metadata)?void 0:o.payload})),s[n]=c}return this.md||(this.$.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:r,finalDetails:s}),this.md=!0),s}getAllFeatureFlags(){var t=this.getFlagVariants(),i=this.getFlagPayloads();return Object.keys(t).map(e=>{var r=t[e];return{key:e,enabled:qt(r),variant:Vt(r),payload:Bt(i[e])}})}getFlagVariants(){var t=this.sv(ke),i=this.sv(Te);if(!i)return t||{};for(var e=ve({},t||{}),r=Object.keys(i),s=0;r.length>s;s++)e[r[s]]=i[r[s]];return this.md||(this.$.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:i,finalFlags:e}),this.md=!0),e}getFlagPayloads(){var t=this.sv(Ae),i=this.sv(Ce);if(!i)return t||{};for(var e=ve({},t||{}),r=Object.keys(i),s=0;r.length>s;s++)e[r[s]]=i[r[s]];return this.md||(this.$.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:i,finalPayloads:e}),this.md=!0),e}reloadFeatureFlags(){this.Cd||this.Ar.featureFlagsDisabled||this.Ad()||(this.Id&&this.$.warn("reloadFeatureFlags() was called inside an onFeatureFlags callback. This callback also runs when flags change in other tabs, so this can cause a request loop."),this.xd&&(this.Td=!0),this.fv||(this._d.slice().forEach(t=>{try{t()}catch(t){this.$.error("Error while running feature flags reloading callback",t)}}),this.fv=setTimeout(()=>{this.pv()},5)))}reloadFeatureFlagsAsync(){return!this.xa||this.Cd||this.Ar.featureFlagsDisabled||this.Ar.remoteRequestsDisabled||this.Ad()?Promise.resolve({status:"skipped"}):new Promise(t=>{this.wd.add(t),this.reloadFeatureFlags()})}iv(t,i){t.forEach(t=>t({status:i})),t.clear()}nv(){clearTimeout(this.fv),this.fv=void 0}onReloading(t){return this._d.push(t),()=>{this._d=this._d.filter(i=>i!==t)}}ensureFlagsLoaded(){this.Sd||this.xd||this.fv||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.Cd=t}resetFlagCallReported(){this.Pt(Pe)}pv(t){var e;this.nv();var r=this.xa;if(!r||this.Ar.remoteRequestsDisabled||this.Ad())this.iv(this.wd,"skipped");else if(this.xd)this.Td=!0;else{var s={token:r.projectToken,distinct_id:r.distinctId,groups:r.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:i({},r.initialPersonProperties,this.sv("$stored_person_properties")||{},{$lib:r.library.name,$lib_version:r.library.version}),group_properties:this.sv(xe),timezone:ws()};f(r.deviceId)||(s.$device_id=r.deviceId),(null!=t&&t.disableFlags||this.Ar.featureFlagsDisabled)&&(s.disable_flags=!0);var n=this.hv();n.length&&(s.evaluation_contexts=n);var a=this.dv();f(a)||(s.flag_keys=a);var o=this.Ar.onlyEvaluateSurveyFeatureFlags,l="/flags/?v=2"+(o?"&only_evaluate_survey_feature_flags=true":""),u=this.$d,h=this.wd;this.wd=new Set,this.kd=h,this.xd=!0;var v=()=>{this.Td&&(this.Td=!1,this.pv())},d=t=>{var i,e,r=null!==(i=t.json)&&void 0!==i?i:{},n=200!==t.statusCode;if(this.xd=!1,u===this.$d)if(this.gv(t.statusCode),n||this.Td||(this.$anon_distinct_id=void 0),!s.disable_flags||this.Td){this.Md=!n;var a=[];t.error?a.push(t.error instanceof Error&&"AbortError"===t.error.name?"timeout":t.error instanceof Error?Sn:"unknown_error"):200!==t.statusCode&&a.push("api_error_"+t.statusCode),r.errorsWhileComputingFlags&&a.push("errors_while_computing_flags");var l=!(null==(e=r.quotaLimited)||!e.includes("feature_flags"));l&&a.push("quota_limited"),this.At({[me]:a}),l?this.$.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."):s.disable_flags||this.vv(r,n,{partialResponse:o}),this.iv(h,s.disable_flags?"skipped":a.length||!r.flags&&!r.featureFlags?"error":"loaded"),v()}else this.iv(h,"skipped");else v()},c=t=>{this.xd=!1,u===this.$d?(this.At({[me]:[Sn]}),this.$.error("Feature flag request failed",t),this.ov()&&this.Xd(!0),this.iv(h,"error"),v()):v()},p=null!==(e=this.Ar.requestMaxRetries)&&void 0!==e?e:1,g=()=>p>0&&u===this.$d,_=()=>{if(u!==this.$d||!this.xa||this.Ar.remoteRequestsDisabled)return this.xd=!1,this.iv(h,"skipped"),void v();try{r.sendRequest(l,{target:"flags",method:"POST",body:s,compression:this.Ar.compression,sentAt:"body",timeoutMs:this.Ar.requestTimeoutMs}).then(t=>{if((t=>yn.includes(t.statusCode)||(t=>0===t.statusCode&&t.error instanceof Error&&"AbortError"===t.error.name)(t))(t)&&g())return p--,void setTimeout(_,500);d(t)}).catch(c)}catch(t){c(t)}};_()}}Ad(){return ds(this.Pd,3)}gv(t){this.Pd=cs(t,this.Pd,3,()=>this.$.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.Md)if(this.Sd||this.getFlags()&&this.getFlags().length>0){if(!this.uv()){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.$.warn('getFeatureFlag for key "'+t+mn)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var i;return null==(i=this.getFeatureFlagResult(t,{send_event:!1}))?void 0:i.payload}getFeatureFlagResult(t,e){if(void 0===e&&(e={}),!e.fresh||this.Md)if(this.Sd||this.getFlags()&&this.getFlags().length>0){if(!this.uv()){var r,s=this.getFlagVariants(),n=t in s,a=s[t],o=this.getFlagPayloads()[t],l=String(a),u=this.sv("$feature_flag_request_id")||void 0,v=this.sv("$feature_flag_evaluated_at")||void 0,d=this.sv("$flag_call_reported")||{};if(this.Ar.deduplicateCallsPerSession){var c,p=null==(c=this.xa)||null==(c=c.session)?void 0:c.sessionId,g=this.sv(Fe);p&&p!==g&&(d={},r=p)}if(!e.send_event&&"send_event"in e)r&&this.At({[Pe]:d,[Fe]:r});else{var _,b,m=null==(_=this.xa)?void 0:_.canCapture;if(!m&&Object.keys(d).length>0&&(d={},this.At({[Pe]:d})),!m||null!=(b=d[t])&&b.includes(l))r&&this.At({[Pe]:d,[Fe]:r});else{var y,w,S,k,x,E,P,F,A,T,C,R,O;h(d[t])?d[t].push(l):d[t]=[l],this.At(i({[Pe]:d},r?{[Fe]:r}:{}));var M=this.getFeatureFlagDetails(t),I=[...null!==(y=this.sv("$feature_flag_errors"))&&void 0!==y?y:[]];f(a)&&I.push("flag_missing");var j={$feature_flag:t,$feature_flag_response:a,$feature_flag_payload:null!=o?o:null,$feature_flag_request_id:u,$feature_flag_evaluated_at:v,$feature_flag_bootstrapped_response:null!==(w=null==(S=this.Ar.bootstrap)||null==(S=S.featureFlags)?void 0:S[t])&&void 0!==w?w:null,$feature_flag_bootstrapped_payload:null!==(k=null==(x=this.Ar.bootstrap)||null==(x=x.featureFlagPayloads)?void 0:x[t])&&void 0!==k?k:null,$used_bootstrap_value:!this.Md};f(null==M||null==(E=M.metadata)?void 0:E.has_experiment)||(j.$feature_flag_has_experiment=M.metadata.has_experiment),f(null==M||null==(P=M.metadata)?void 0:P.version)||(j.$feature_flag_version=M.metadata.version);var L=null!==(F=null==M||null==(A=M.reason)?void 0:A.description)&&void 0!==F?F:null==M||null==(T=M.reason)?void 0:T.code;L&&(j.$feature_flag_reason=L),null!=M&&null!=(C=M.metadata)&&C.id&&(j.$feature_flag_id=M.metadata.id),f(null==M?void 0:M.original_variant)&&f(null==M?void 0:M.original_enabled)||(j.$feature_flag_original_response=f(M.original_variant)?M.original_enabled:M.original_variant),null!=M&&null!=(R=M.metadata)&&R.original_payload&&(j.$feature_flag_original_payload=null==M||null==(O=M.metadata)?void 0:O.original_payload),I.length&&(j.$feature_flag_error=I.join(",")),this.mv(j)}}if(n)return{key:t,enabled:!!a,variant:"string"==typeof a?a:void 0,payload:Bt(o)}}}else this.$.warn('getFeatureFlagResult for key "'+t+mn)}mv(t){try{var i;null==(i=this.xa)||i.capture("$feature_flag_called",t)}catch(t){this.$.error("Failed to capture feature flag call",t)}}getRemoteConfigPayload(t,i){this.yv(t,i)}yv(t,i){var e=this;return r(function*(){var r=e.xa;if(r){var s={distinct_id:r.distinctId,token:r.projectToken,person_properties:{$lib:r.library.name,$lib_version:r.library.version}},n=e.hv();n.length&&(s.evaluation_contexts=n);var a,o=e.dv();f(o)||(s.flag_keys=o);try{var l;a=(null==(l=(yield r.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:s,compression:e.Ar.compression,sentAt:"body",timeoutMs:e.Ar.requestTimeoutMs})).json)||null==(l=l.featureFlagPayloads)?void 0:l[t])||void 0}catch(t){return void e.$.error("Remote config feature flag request failed",t)}try{i(a)}catch(t){e.$.error("Remote config feature flag callback failed",t)}}})()}isFeatureEnabled(t,i){if(void 0===i&&(i={}),i.fresh&&!this.Md)return i.defaultValue;if(!(this.Sd||this.getFlags()&&this.getFlags().length>0))return this.$.warn('isFeatureEnabled for key "'+t+mn),i.defaultValue;var e=this.getFeatureFlag(t,i);return f(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.vv(t,i,e)}vv(t,e,r){if(this.xa){this.Sd=!0;var s=function(t,e,r,s,n,a){void 0===e&&(e={}),void 0===r&&(r={}),void 0===s&&(s={}),void 0===a&&(a=_n);var o=((t,e)=>{var r=t.flags;return r?i({},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!f(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&&e.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,u=o.featureFlags,v=o.featureFlagPayloads;if(u){var d=t.requestId,c=t.evaluatedAt;if(h(u)){a.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var p={};if(u)for(var g=0;u.length>g;g++)p[u[g]]=!0;return{[_e]:u,[ke]:p,[Se]:!1}}var _=u,b=v,m=l;if(null!=n&&n.partialResponse){var y=Object.keys(_),w=b||{};_=i({},e,_),b=i({},r,w),y.forEach(t=>{var i;t in w||null==(i=b)||delete i[t]}),m=i({},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)}));_=i({},e,Object.fromEntries(Object.entries(_).filter(t=>S.has(t[0]))));var k=Object.fromEntries(Object.entries(b||{}).filter(t=>S.has(t[0])));b=i({},r,k),S.forEach(t=>{var i;t in k||null==(i=b)||delete i[t]}),m=i({},s,Object.fromEntries(Object.entries(m||{}).filter(t=>S.has(t[0]))))}else _=i({},e,_),b=i({},r,b),m=i({},s,m);return i({[_e]:Object.keys(xn(_)),[ke]:_||{},[Ae]:b||{},[be]:m||{},[Se]:!0===t.minimalFlagCalledEvents},d?{[we]:d}:{},c?{[ye]:c}:{})}}(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),r,this.$);if(s)if(!1===(null==r?void 0:r.persist)){var n=!f(this.xa.kv.get(ke));this.rv=s,n||this.At(s)}else this.Jd(),this.lv(s,t,!(null==r||!r.partialResponse)),this.At(s);else e&&this.ov();e||(this.Ed=!1),this.Xd(e)}}override(t,i){void 0===i&&(i=!1),this.$.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:i})}overrideFeatureFlags(t){this.bv(t)}bv(t){if(this.xa){if(!1===t)return this.Pt([Te,Ce]),this.Xd(),void bn.info("All overrides cleared");if(h(t))return this.At({[Te]:kn(t)}),this.Xd(),void bn.info("Flag overrides set",{flags:t});if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i,e=t;this.md=Boolean(null!==(i=e.suppressWarning)&&void 0!==i&&i);var r={},s=e.flags,n=e.payloads;return s&&(r[Te]=h(s)?kn(s):s),n&&(r[Ce]=n),Object.keys(r).length&&this.At(r),!1===s&&!1===n?this.Pt([Te,Ce]):!1===s?this.Pt(Te):!1===n&&this.Pt(Ce),this.Xd(),!1===s?bn.info("Flag overrides cleared"):s&&bn.info("Flag overrides set",{flags:s}),void(!1===n?bn.info("Payload overrides cleared"):n&&bn.info("Payload overrides set",{payloads:n}))}if(t&&"object"==typeof t)return this.At({[Te]:t}),this.Xd(),void bn.info("Flag overrides set",{flags:t});this.$.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}else this.$.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.Sd){var i=this._v(),e=i.flags,r=i.flagVariants;try{t(e,r)}catch(t){this.$.error("Error while running feature flags callback",t)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,r){var s,n=(this.sv("$early_access_features")||[]).find(i=>i.flagKey===t),a={["$feature_enrollment/"+t]:e},o={$feature_flag:t,$feature_enrollment:e,$set:a};n&&(o.$early_access_feature_name=n.name),r&&(o.$feature_enrollment_stage=r);var l=i({},this.getFlagVariants(),{[t]:e});null==(s=this.zd)||s.markCrossTabFeatureFlagChanges({[_e]:[t],[ke]:[t],[Ee]:Object.keys(a)}),this.At({[_e]:Object.keys(xn(l)),[ke]:l,[Ee]:i({},this.sv("$stored_person_properties")||{},a)}),this.Xd();try{var u;null==(u=this.xa)||u.capture("$feature_enrollment_update",o)}catch(t){this.$.error("Failed to capture early access feature enrollment",t)}}getEarlyAccessFeatures(t,i,e){void 0===i&&(i=!1);var r=this.sv(ge);!r||i?this.wv(t,e):t(r)}wv(t,i){var e=this;return r(function*(){var r=e.xa;if(r){var s,n=i?"&"+i.map(t=>"stage="+t).join("&"):"";try{var a=yield r.sendRequest("/api/early_access_features/?token="+r.projectToken+n,{target:"api",method:"GET",sentAt:"query"});if(!a.json)return;s=a.json.earlyAccessFeatures,e.At({[ge]:s})}catch(t){return void e.$.error("Early access feature request failed",t)}try{t(s)}catch(t){e.$.error("Early access feature callback failed",t)}}})()}_v(){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),{})}}Xd(t){this.Kd();var i=this._v(),e=i.flags,r=i.flagVariants,s=this.Id;this.Id=!0,this.featureFlagEventHandlers.forEach(i=>{try{i(e,r,{errorsLoading:t})}catch(t){this.$.error("Error while running feature flags callback",t)}}),this.Id=s}setPersonPropertiesForFlags(t,i){void 0===i&&(i=!0),this.Sv(t,i)}Sv(t,e){void 0===e&&(e=!0);var r=this.sv("$stored_person_properties")||{},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.At({[Ee]:i({},r,a,s)}),e&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,e){void 0===e&&(e=!0);var r=i({},this.sv("$stored_person_properties")||{});t.forEach(t=>{delete r[t]}),this.At({[Ee]:r}),e&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t){void 0===t&&(t=!0),this.Pt(Ee),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,e){void 0===e&&(e=!0);var r=this.sv("$stored_group_properties")||{},s=i({},r);for(var n of Object.keys(t))s[n]=i({},r[n],t[n]);this.At({[xe]:s}),e&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var e=this.sv("$stored_group_properties")||{};this.At({[xe]:i({},e,{[t]:{}})})}else this.Pt(xe)}reset(){this.$d++,this.iv(this.wd,"cancelled"),this.iv(this.kd,"cancelled"),this.Td=!1,this.yd={},this.bd={},this.rv=void 0,this.Sd=!1,this.Cd=!1,this.Md=!1,this.$anon_distinct_id=void 0,this.nv(),this.md=!1,this.Pd=0}},Pn=le("[FeatureFlags]"),Fn=class{constructor(t,i){void 0===i&&(i=!1),this.xv=!1,this.update(t,i)}update(t,i){this.$v=((t,i)=>{var e,r,s,n,a,o,l,u;return{bootstrap:{featureFlags:null!==(e=null==(r=t.bootstrap)?void 0:r.featureFlags)&&void 0!==e?e:void 0,featureFlagPayloads:null!==(s=null==(n=t.bootstrap)?void 0:n.featureFlagPayloads)&&void 0!==s?s:void 0},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!==(a=t.remote_config_refresh_interval_ms)&&void 0!==a?a:3e5,idleRefreshBackoff:f(t.remote_config_refresh_interval_ms),requestTimeoutMs:t.feature_flag_request_timeout_ms,requestMaxRetries:Math.max(0,null!==(o=t.feature_flag_request_max_retries)&&void 0!==o?o:1),compression:t.disable_compression?void 0:"best-available",evaluationContexts:null!==(l=null!==(u=t.evaluation_contexts)&&void 0!==u?u:t.evaluation_environments)&&void 0!==l?l:[],flagKeys:h(t.flag_keys)?t.flag_keys:void 0}})(t,i),!t.evaluation_environments||t.evaluation_contexts||this.xv||(Pn.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.xv=!0),f(t.flag_keys)||h(t.flag_keys)||Pn.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.$v}},An=t=>k(t)&&("RangeError"===t.name&&0===t.message.indexOf("Maximum call stack size exceeded")||"InternalError"===t.name&&"too much recursion"===t.message),Tn=le("[Error tracking]"),Cn="webkit-masked-url:",$n=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],Rn=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",Cn],On=["__firefox__","__gCrWeb"],Mn="Refusing to render web experiment since the viewer is a likely bot",In={icontains:(t,i)=>i.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,i)=>-1===i.toLowerCase().indexOf(t.toLowerCase()),regex:(t,i)=>Js(i,t),not_regex:(t,i)=>!Js(i,t),exact:(t,i)=>i===t,is_not:(t,i)=>i!==t},jn=le("[Conversations]"),Ln="Conversations not available yet.";function Dn(){var t="",e="";try{var r,s=null==(r="u">typeof globalThis?globalThis:"u">typeof window?window:void 0)||null==(r=r.navigator)?void 0:r.userAgent;if(s){var n=function(t){for(var i=0;z.length>i;i++){var e=z[i],r=e[1],s=e[0].exec(t),n=s&&(v(r)?r(s,t):r);if(n)return n}return["",""]}(s);t=n[0],e=n[1]}}catch(t){}return function(t,e){var r=function(t){if(t)return{}.hasOwnProperty.call(Di,t)?Di[t]:t}(t);return i({},r?{"os.name":r}:{},e?{"os.version":e}:{})}(t,e)}function Nn(t,e){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!=e&&e.consoleCapture?void 0:null!==(n=null==t?void 0:t.maxLogsPerInterval)&&void 0!==n?n:1e3,c=f(d)?Math.max(v,2048):Math.max(v,d),p=i({},Dn(),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==e?void 0:e.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:c,maxBatchRecordsPerPost:100,rateCapWindowMs:h,maxLogsPerInterval:d,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}var zn=["debug","log","warn","error","info"],Hn="console",Un="__posthogHandledLogsRequestError",Bn=(t,i)=>{var e=t instanceof Error?t:new Error(i);return e[Un]=!0,e},qn=t=>!!t&&"object"==typeof t&&!0===t[Un],Vn=class{get Cv(){var t=this;return i({},this.$,{error(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];e.some(qn)||t.$.error(...e)}})}constructor(t,i){var e;this.Ta=t,this.Tv=i,this.name="logs",this.Iv=!1,this.Mv=!1,this.Ev=!1,this.$=le("[logs]"),this.Ju=[],this.Pv=[],this.Pd=0,this.Rv=!1,this.Ci=!1,this.Av=[],this.Fv=[],this.Ov=!1,this.Dv=!1,this.Lv=!1,this.Nv=()=>{var t,i;this.Ci||(this.Pd=0,null==(t=this.qv)||t.onReconnect(),null==(i=this.jv)||i.onReconnect())},this.Iv=!(null==(e=t.get())||!e.captureConsoleLogs)}get Bv(){return!0}zv(){}Hv(){if(!this.Lv){try{this.Wd=typeof window>"u"?void 0:window}catch(t){this.Wd=void 0}this.Wd&&(ce(this.Wd,"online",this.Nv),this.Lv=!0)}}Uv(t,i,e,r){this.Hv();var s=Nn(this.Ta.get(),e);return[new Gi(this.Wv(t,i),s,this.Cv,()=>this.Tv(),t=>t(),void 0,r),s]}Vv(){var t=this.Ta.get();if(!this.qv||this.Gv!==t){var i;null==(i=this.qv)||i.reset(),this.Gv=t;var e=this.Uv(()=>this.Ju,t=>{this.Ju=t});this.qv=e[0],this.Qv=e[1]}return this.qv}Zv(){var t=this.Ta.get();if(!this.jv||this.Jv!==t){var i;null==(i=this.jv)||i.reset(),this.Jv=t;var e=this.Uv(()=>this.Pv,t=>{this.Pv=t},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Hn);this.jv=e[0],this.Kv=e[1]}return this.jv}setup(t){if(!this.Ci&&!this.Rv)return this.Rv=!0,this.xa=t,this.$=t.logger.createLogger("[logs]"),on(t.kv.initialize(),()=>{this.Ci||this.Vd(t)})}Vd(t){var i;this.Hv(),null!=(i=this.Ta.get())&&i.captureConsoleLogs&&(this.Iv=!0),(this.Iv||this.Ta.remoteConfigWillArrive&&t.kv.get(this.Ta.captureHintKey))&&this.Xv();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.Ci?r.dispose():(this.qa=r,e||this.loadIfEnabled())}dispose(){var t,i,e,r,s,n,a;this.Ci||(this.Ci=!0,this.Yv(),null==(t=this.qa)||t.dispose(),this.qa=void 0,this.xa=void 0,this.Ev=!1,null==(i=this.Wd)||i.removeEventListener("online",this.Nv),null==(e=this.tf)||e.call(this),this.tf=void 0,null==(r=this.qv)||r.clearQueue(),null==(s=this.jv)||s.clearQueue(),null==(n=this.qv)||n.reset(),null==(a=this.jv)||a.reset())}onRemoteConfig(t){var i,e;if(!this.Ci){var r=t.ok?null==(i=t.config.logs)?void 0:i.captureConsoleLogs:void 0;b(r)?this.ef():(null==(e=this.xa)||e.kv.set(this.Ta.captureHintKey,!!r),r?(this.Iv=!0,this.Mv||this.Xv(),this.loadIfEnabled()):this.ef())}}reset(){var t,i,e,r;this.Yv(),null==(t=this.qv)||t.clearQueue(),this.Ju=[],null==(i=this.qv)||i.reset(),null==(e=this.jv)||e.clearQueue(),this.Pv=[],null==(r=this.jv)||r.reset(),this.Pd=0}captureLog(t){!this.Ci&&this.xa&&this.Vv().captureLog(t)}captureConsoleLog(t){!this.Ci&&this.xa&&this.Zv().captureLog(t)}captureBufferedConsoleLog(t,i,e){!this.Ci&&this.xa&&this.Zv().captureLog(t,{context:i,occurredAtMs:e})}_onOptOut(){var t;this.Yv(),null==(t=this.jv)||t.clearQueue(),this.Pv=[]}ef(){this.Iv||this.Yv()}Xv(){var t,i=this;if(!this.Ov&&null!=(t=this.Wd)&&t.console){var e=Nn(this.Ta.get()).maxBufferSize,r=!0;this.Fv.push(()=>{r=!1});var s=function(t){var s;try{s=(t=>{for(;null!=(i=t)&&i.__rrweb_original__;){var i;t=t.__rrweb_original__}return t})(i.Wd.console[t])}catch(t){return 1}s&&i.Fv.push(ms(i.Wd.console,t,n=>{var a=function(){for(var s=arguments.length,a=new Array(s),o=0;s>o;o++)a[o]=arguments[o];try{r&&i.if(t,a,e)}catch(t){}return n.apply(i.Wd.console,a)};return a.__rrweb_original__=s,a}))};for(var n of zn)if(s(n))continue;this.Ov=!0,this.nf=setTimeout(()=>{this.Yv()},3e4)}}if(t,i,e){var r;if(this.Ov&&!this.Dv&&0!==i.length)if(null!=(r=this.xa)&&r.canCapture){if(e>this.Av.length){this.Dv=!0;try{this.Av.push({level:t,args:i,occurredAtMs:Date.now(),context:this.Tv()})}finally{this.Dv=!1}}}else this.Yv()}Yv(){if(this.Av=[],this.Ov){for(var t of(this.Ov=!1,this.nf&&(clearTimeout(this.nf),this.nf=void 0),this.Fv))t();this.Fv=[]}}sf(){var t=this.Av;return this.Yv(),t}get logger(){return this.rf||(this.rf={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.rf}flushLogs(t){this.xa&&(t?this.af(t):(this.qv&&this.qv.flush().catch(t=>this.lf(t)),this.jv&&this.jv.flush().catch(t=>this.lf(t))))}flush(){var t=this;return r(function*(){var i,e,r=null==(i=t.qv)?void 0:i.flush().catch(i=>t.lf(i)),s=null==(e=t.jv)?void 0:e.flush().catch(i=>t.lf(i));yield r,yield s})()}lf(t){qn(t)||this.$.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(!this.Ci&&this.Iv&&!this.Mv&&!this.Ev){var t=this.zv();if(t){this.Ev=!0;try{t((t,i)=>{if(this.Ev=!1,!this.Ci&&this.Iv)if(t||!i)this.$.error("Could not load logs script",t),this.Yv();else{var e=this.sf();this.tf=i.initialize(this.xa),this.Mv=!0,e.length>0&&i.replay(this.xa,e)}})}catch(t){throw this.Ev=!1,t}}else this.Yv()}}Wv(t,i){var e=this.xa;return{get isDisabled(){return!1},get optedOut(){return!e.canCapture},getPersistedProperty:i=>i===s.LogsQueue?t():void 0,setPersistedProperty(t,e){t===s.LogsQueue&&i(null!=e?e:[])},js:t=>this.js(t),getLibraryId:()=>e.library.name,getLibraryVersion:()=>e.library.version}}js(t){return new Promise(i=>{if(ds(this.Pd,3))i({kind:"fatal",error:Bn(void 0,"logs endpoint is unreachable, dropping batch")});else{var e=!1,r=t=>{e||(e=!0,clearTimeout(s),i(t))},s=setTimeout(()=>{this.$.warn("Logs request timed out before receiving a response"),r({kind:"retry-later",error:Bn(void 0,"logs request timed out")})},9e4),n=this.Bv;this.xa.sendRequest("/i/v1/logs",{method:"POST",query:{token:this.xa.projectToken},body:t,compression:"best-available",timeoutMs:6e4}).then(t=>{var i,e=t.statusCode;this.uf(e,n),e>=200&&300>e?r({kind:"ok"}):413===e?r({kind:"too-large"}):0!==e&&408!==e&&429!==e&&500>e?r({kind:"fatal",error:new Error("logs request failed with status "+e)}):0===e?(t.error||this.$.warn("Logs request failed before receiving an HTTP response"),r({kind:"retry-later",error:Bn(t.error,"logs request failed before receiving an HTTP response")})):r({kind:"retry-later",error:null!==(i=t.error)&&void 0!==i?i:new Error("logs request failed with status "+e)})},t=>{r({kind:"retry-later",error:t})})}})}uf(t,i){(0!==t||i)&&(this.Pd=cs(t,this.Pd,3,()=>this.$.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.")))}af(t){this.Ju.length>0&&this.cf(t,this.Ju,this.Qv,this.xa.library.name,t=>{this.Ju=t}),this.Pv.length>0&&this.cf(t,this.Pv,this.Kv,Hn,t=>{this.Pv=t})}cf(t,i,e,r,s){if(0!==i.length){var n=i.map(t=>t.record);s([]);var a=qi(n,Bi(e,this.xa.library.name,this.xa.library.version),r,this.xa.library.version);this.xa.sendRequest("/i/v1/logs",{method:"POST",query:{token:this.xa.projectToken},body:a,compression:"best-available",transport:t,timeoutMs:6e4}).catch(t=>this.lf(t))}}},Wn=le("[NetworkMetrics]"),Kn=()=>{var t;return null!=ts&&null!=(t=ts.performance)&&t.now?ts.performance.now():Date.now()},Gn={"http:":80,"https:":443},Jn=new Set(["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"]),Xn=(t,i)=>{var e,r=String(i);return{method:String(t).toUpperCase(),url:(null==(e=kr(r))?void 0:e.href)||r}},Zn=function(t,e,r,s,n,a,o){void 0===o&&(o=!1);try{var l,u=n();if(!u)return;var h=r||void 0,d=Kn()-s,c=kr(e.url);if(c&&"http:"!==c.protocol&&"https:"!==c.protocol)return;var f={url:(null==c?void 0:c.href)||e.url,method:e.method},g=v(u.name)?u.name(f):p(u.name)?u.name:"http.client.request.duration";if(!g)return;var _=o&&!h?void 0:((t,i)=>t?400>t?void 0:String(t):(null==i?void 0:i.name)||"_OTHER")(h,a),b=i({},i({"http.request.method":y=Jn.has(m=f.method)?m:"_OTHER"},"_OTHER"===y&&m!==y?{"http.request.method_original":m}:{}),c?(t=>{return{"server.address":t.hostname.startsWith("[")&&t.hostname.endsWith("]")?t.hostname.slice(1,-1):t.hostname,"server.port":Number(t.port)||Gn[t.protocol],"url.scheme":t.protocol.slice(0,-1),"url.template":(i=t.pathname,i.split("/").map(t=>(t=>/^\d+$/.test(t)||t.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(t))(t)?":id":t).join("/"))};var i})(c):{},h?{"http.response.status_code":h}:{},_?{"error.type":_}:{},null==u.attributes?void 0:u.attributes(f,{status:h,durationMs:d}));null==(l=t.metrics)||l.histogram(g,d,{unit:"ms",attributes:b})}catch(t){Wn.error("Failed to record network metric",t)}var m,y},Qn=()=>{},Yn=(t,i)=>v(null==ts?void 0:ts.fetch)?ms(ts,"fetch",e=>function(){for(var r=Kn(),s=arguments.length,n=new Array(s),a=0;s>a;a++)n[a]=arguments[a];var o=e.apply(this,n);if(!i())return o;try{var l,u,h,v=n[0],d=n[1],c=Xn(null!==(l=null!==(u=null==d?void 0:d.method)&&void 0!==u?u:null==v?void 0:v.method)&&void 0!==l?l:"GET",null!==(h=null==v?void 0:v.url)&&void 0!==h?h:v);return o.then(e=>(Zn(t,c,null==e?void 0:e.status,r,i,void 0,!0),e),e=>{throw Zn(t,c,void 0,r,i,e),e})}catch(t){return Wn.error("Failed to observe fetch",t),o}}):Qn,ta=(t,i)=>{var e,r=null==ts||null==(e=ts.XMLHttpRequest)?void 0:e.prototype;if(!r)return Qn;var s=new WeakMap,n=ms(r,"open",t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];try{dn.has(this)||s.set(this,Xn(e[0],e[1]))}catch(t){Wn.error("Failed to observe XHR open",t)}return t.apply(this,e)}),a=ms(r,"send",e=>function(){var r;try{var n=s.get(this);if(n&&i()){var a=Kn();ce(this,"loadend",r=()=>{this.removeEventListener("loadend",r),Zn(t,n,this.status,a,i)})}}catch(t){Wn.error("Failed to observe XHR send",t)}try{for(var o=arguments.length,l=new Array(o),u=0;o>u;u++)l[u]=arguments[u];return e.apply(this,l)}catch(t){throw r&&this.removeEventListener("loadend",r),t}});return()=>{n(),a()}},ia=new WeakMap,ea=new Set(["$comment","$defs","$id","$schema","additionalProperties","default","definitions","deprecated","description","examples","minProperties","properties","readOnly","required","title","type","writeOnly"]),ra={maxStringLength:2048,truncationSuffix:"..."},sa={maxStringLength:2048,truncationSuffix:"..."};function na(t){if(t)return!0===t?{intent:!0,model:!0}:{intent:!1!==t.intent,model:!1!==t.model}}function aa(t,i){return{}.hasOwnProperty.call(t,i)}function oa(t,i){var e=Object.create(t);return i&&Object.defineProperty(e,"inputSchema",{configurable:!0,enumerable:!0,writable:!0,value:i}),e}function la(t,i,e){if(void 0===e&&(e=!1),p(t)){var r=t.trim();if(r)return(e?Fi(r,ra):r).slice(0,i)}}function ua(t){try{return d(t)&&!0===t.isError}catch(t){return!1}}function ha(t){return Fi(t||"Unknown error",sa).slice(0,2048)}function va(t,i){try{return ha(i?function(t){try{if(!d(t)||!h(t.content))return;return t.content.filter(t=>d(t)&&"text"===t.type&&p(t.text)).map(t=>t.text).join(" ").trim()||void 0}catch(t){return}}(t):d(t)&&p(t.message)?t.message:p(t)?t:String(t))}catch(t){return"Unknown error"}}function da(t,e,r){return e.errorResult?[{type:"Error",value:r,mechanism:{type:"generic",handled:!0,synthetic:!0,exception_id:0}}]:t.buildProperties(e.error,{handled:!0}).$exception_list.map(t=>i({},t,{value:ha(t.value)}))}function ca(t,i){if(i)return"Error";try{if(!d(t))return"Error";var e=p(t.name)?t.name.trim():"",r=t.constructor;return e&&"Error"!==e||!v(r)||"Error"===r.name||(e=r.name),(e||"Error").slice(0,256)}catch(t){return"Error"}}function fa(t,i){return{message:va(t,i),type:ca(t,i)}}var pa={featureFlags:class extends En{constructor(t){var i=new Fn(t.config,t._shouldDisableFlags());super(i),this.name="featureFlags",this._instance=t,this.hf=i}get zd(){return this._instance.persistence}updateConfig(t,i){this.hf.update(t,i),this.Hd()}}},ga={sessionRecording:class{get Ar(){return this._instance.config}get _c(){return this._instance.persistence}get started(){var t;return!(null==(t=this.df)||!t.isStarted)}get status(){var t,i;return"awaiting_config"===this.vf||"missing_config"===this.vf?this.vf:null!==(t=null==(i=this.df)?void 0:i.status)&&void 0!==t?t:this.vf}constructor(t){if(this._instance=t,this._forceAllowLocalhostNetworkCapture=!1,this.vf=Os,this.ff=void 0,this.pf=!1,this.Je=(()=>{var t;if(null==rs||!rs.visibilityState||"visible"===rs.visibilityState)return!0;var i=null==ts||null==(t=ts.performance)||null==t.getEntriesByType?void 0:t.getEntriesByType("visibility-state");return!(null!=i&&i.length)||i.some(t=>"visible"===t.name)})(),this.sn=()=>{var t;"visible"===(null==rs?void 0:rs.visibilityState)&&(this.Je=!0,null==(t=this.df)||null==t.setDocumentWasEverVisible||t.setDocumentWasEverVisible(!0))},!this._instance.sessionManager)throw Is.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if("always"===this.Ar.cookieless_mode)throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');null!=rs&&rs.addEventListener&&ce(rs,"visibilitychange",this.sn)}initialize(){this.startIfEnabledOrStop()}dispose(t){var i=(void 0===t?{}:t).discardBufferedEvents,e=void 0!==i&&i;this.pf=!0,null==rs||null==rs.removeEventListener||rs.removeEventListener("visibilitychange",this.sn),e?this.gf(!0):this.stopRecording()}get mf(){var t,i=!(null==(t=this._instance.get_property(Kr))||!t.enabled),e=!this.Ar.disable_session_recording,r=this.Ar.disable_session_recording||this._instance.consent.isOptedOut();return ts&&i&&e&&!r}startIfEnabledOrStop(t){var i;if(!(this.pf||this.mf&&null!=(i=this.df)&&i.isStarted)){var e=!f(Object.assign)&&!f(Array.from);this.mf&&e?(this.yf(t),Is.info("starting")):(this.vf=Os,this.stopRecording())}}yf(t){var i,e;if(this.mf)if("awaiting_config"!==this.vf&&"missing_config"!==this.vf&&(this.vf=Ms),null!=as&&null!=(i=as.__PosthogExtensions__)&&null!=(i=i.rrweb)&&i.record&&null!=(e=as.__PosthogExtensions__)&&e.initSessionRecording)this.bf(t);else{var r,s=this._instance.sessionManager;null==(r=as.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this._f,i=>{if(!this.pf&&this.mf&&this._instance.sessionManager===s)return i?(this._instance.register_for_session({[Zr]:!0}),Is.error("could not load recorder",i)):void this.bf(t);this.vf=Os})}}stopRecording(){var t,i;null==(t=this.ff)||t.call(this),this.ff=void 0,null==(i=this.df)||i.stop()}gf(t){var i,e;void 0===t&&(t=!1),null==(i=this.ff)||i.call(this),this.ff=void 0,null==(e=this.df)||e.discard({discardProducerEvents:t})}wf(){var t,i;null==(t=this._c)||t.unregister("$session_is_sampled"),null==(i=this._c)||i.unregister("$replay_sample_rate")}kf(t,i){if(b(t))return null;var e,r=m(t)?t:parseFloat(t);return"number"!=typeof(e=r)||!Number.isFinite(e)||0>e||e>1?(Is.warn(i+" must be between 0 and 1. Ignoring invalid value:",t),null):r}Sf(t){if(this._c){var e,r,s=this._c,n=()=>{var e,r=!1===t.sessionRecording?void 0:t.sessionRecording,n=this.kf(null==(e=this.Ar.session_recording)?void 0:e.sampleRate,"session_recording.sampleRate"),a=this.kf(null==r?void 0:r.sampleRate,"remote config sampleRate"),o=null!=n?n:a;b(o)&&this.wf();var l=null==r?void 0:r.minimumDurationMilliseconds;s.register({[Kr]:i({cache_timestamp:Date.now(),enabled:!!r},r,{networkPayloadCapture:i({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:f(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==(e=this.ff)||e.call(this),this.ff=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.Sf(i),void this.gf()):(this.Sf(i),void this.startIfEnabledOrStop()):("awaiting_config"===this.vf&&(this.vf="missing_config",this._instance.register_for_session({[Qr]:!0}),Is.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.df)&&e.log?this.df.log(t,i):Is.warn("log called before recorder was ready")}get _f(){var t;return(null==(t=this._instance)||null==(t=t.persistence)||null==(t=t.get_property("$session_recording_remote_config"))||null==(t=t.scriptConfig)?void 0:t.script)||"lazy-recorder"}xf(){var t,i=this._instance.get_property(Kr);if(!i)return!1;try{t="object"==typeof i?i:JSON.parse(i)}catch(t){return Is.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}return!b(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}bf(t){var i,e,r;if(!this.pf&&this.mf&&this._instance.sessionManager){if(null==(i=as.__PosthogExtensions__)||!i.initSessionRecording)return Is.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Zr]:!0});var s;if(this.df||(this.df=null==(s=as.__PosthogExtensions__)?void 0:s.initSessionRecording(this._instance,this.Je),this.df._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.xf()){if("missing_config"===this.vf||"awaiting_config"===this.vf)return;return this.vf="awaiting_config",Is.info("persisted remote config is stale, requesting fresh config before starting"),void new Rs(this._instance).load()}this.vf=Ms,null==(e=(r=this.df).setDocumentWasEverVisible)||e.call(r,this.Je),this.df.start(t)}else this.vf=Os}onRRwebEmit(t){var i;null==(i=this.df)||null==i.onRRwebEmit||i.onRRwebEmit(t)}overrideLinkedFlag(){var t,i;this.df||null==(t=this._c)||t.register({[Jr]:!0}),null==(i=this.df)||i.overrideLinkedFlag()}overrideSampling(){var t,i;this.df||null==(t=this._c)||t.register({[Gr]:!0}),null==(i=this.df)||i.overrideSampling()}overrideTrigger(t){var i,e;this.df||null==(i=this._c)||i.register({["url"===t?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null==(e=this.df)||e.overrideTrigger(t)}get sdkDebugProperties(){var t,e={};for(var r of js){var s,n=null==(s=this._instance.sessionPersistence)?void 0:s.get_property(r);f(n)||(e[r]=n)}return i({},e,(null==(t=this.df)?void 0:t.sdkDebugProperties)||{$recording_status:this.status})}tryAddCustomEvent(t,i){var e;return!(null==(e=this.df)||!e.tryAddCustomEvent(t,i))}flushBeforeIdentityReset(){var t;null==(t=this.df)||null==t.flushBeforeIdentityReset||t.flushBeforeIdentityReset()}}},_a={autocapture:class extends $r{constructor(t){super(new Rr(t)),this.instance=t}},historyAutocapture:class{constructor(t){this.$f=!1,this._instance=t,this.Cf=this.Tf()}initialize(){this.startIfEnabled()}get isEnabled(){var t=this.If();return!!(t.path||t.search||this.Mf(t))}startIfEnabled(){this.isEnabled&&(oe.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.Cf=this.Tf(),this.startIfEnabled()}stop(){this.Ef&&this.Ef(),this.Ef=void 0,this.Pf&&this.Pf(),this.Pf=void 0,oe.info("History API monitoring stopped")}monitorHistoryChanges(){ts&&ts.history&&(this.Rf("pushState"),this.Rf("replaceState"),this.Af(),this.Mf()&&this.Ff())}Rf(t){var i;if(ts&&(null==(i=ts.history[t])||!i.__posthog_wrapped__)){var e=this;ms(ts.history,t,i=>function(r,s,n){var a;e.Of(n)&&e.Df(),i.call(this,r,s,n),e.Lf(t,!e.$f&&"popstate"!==(null==ts||null==(a=ts.event)?void 0:a.type))})}}Tf(){var t=null==ts?void 0:ts.location;if(null!=t&&t.pathname)return{pathname:t.pathname,search:t.search,hash:t.hash}}If(){var t=this._instance.config.capture_pageview;return"history_change"===t?{path:!0}:d(t)?t:{}}Mf(t){return void 0===t&&(t=this.If()),!!t.hash&&!this._instance.config.disable_capture_url_hashes}Nf(t){var i=this.If(),e=this.Cf;return!(!e||!(i.path&&t.pathname!==e.pathname||i.search&&t.search!==e.search||this.Mf(i)&&t.hash!==e.hash))}Lf(t,i){void 0===i&&(i=!1);try{i||this.Df();var e=this.Tf();if(!e)return;if(this.Nf(e)){var r=()=>this._instance.capture("$pageview",{navigation_type:t});i?(this.qf=r,Promise.resolve().then(()=>this.Df())):r()}this.Cf=e}catch(i){oe.error("Error capturing "+t+" pageview",i)}}Of(t){var i,e;return!(b(t)||!ts)&&(null==(i=kr(String(t)))?void 0:i.href)!==(null==(e=ts.location)?void 0:e.href)}Df(){var t=this.qf;if(t){this.qf=void 0,this.$f=!0;try{t()}catch(t){oe.error("Error capturing deferred pageview",t)}finally{this.$f=!1}this.Cf=this.Tf()}}Af(){if(!this.Ef){var t=()=>{this.Lf("popstate")};ce(ts,"popstate",t),this.Ef=()=>{ts&&ts.removeEventListener("popstate",t)}}}Ff(){if(!this.Pf){var t=()=>{this.Lf("hashchange")};ce(ts,"hashchange",t),this.Pf=()=>{ts&&ts.removeEventListener("hashchange",t)}}}},heatmaps:class{get Ar(){return this.instance.config}constructor(t){var i;this.jf=!1,this.ll=!1,this.Bf=null,this.instance=t,this.jf=!(null==(i=this.instance.persistence)||!i.props[Nr]),this.rageclicks=new Sr(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return d(this.Ar.capture_heatmaps)&&this.Ar.capture_heatmaps.flush_interval_milliseconds&&(t=this.Ar.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return b(this.Ar.capture_heatmaps)?b(this.Ar.enable_heatmaps)?this.jf:this.Ar.enable_heatmaps:!1!==this.Ar.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.ll)return;Ls.info("starting..."),this.zf(),this.sn()}else{var t;clearInterval(null!==(t=this.Bf)&&void 0!==t?t:void 0),this.Hf(),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({[Nr]:e}),this.jf=e,this.startIfEnabled()}}}getAndClearBuffer(){var t=this.Rt;return this.Rt=void 0,t}Uf(t){Ds(t.originalEvent)&&this.$r(t.originalEvent,"deadclick")}sn(){this.Bf&&clearInterval(this.Bf),this.Bf="visible"===(null==rs?void 0:rs.visibilityState)?setInterval(this.rc.bind(this),this.flushIntervalMilliseconds):null}zf(){ts&&rs&&(this.Wf=this.rc.bind(this),ce(ts,Yr,this.Wf),this.Vf=t=>this.$r(t||(null==ts?void 0:ts.event)),ce(rs,"click",this.Vf,{capture:!0}),this.Gf=t=>this.Qf(t||(null==ts?void 0:ts.event)),ce(rs,"mousemove",this.Gf,{capture:!0}),this.Zf=new us(this.instance,ls,this.Uf.bind(this)),this.Zf.startIfEnabledOrStop(),this.Jf=this.sn.bind(this),ce(rs,$e,this.Jf),this.ll=!0)}Hf(){var t;ts&&rs&&(this.Wf&&ts.removeEventListener(Yr,this.Wf),this.Vf&&rs.removeEventListener("click",this.Vf,{capture:!0}),this.Gf&&rs.removeEventListener("mousemove",this.Gf,{capture:!0}),this.Jf&&rs.removeEventListener($e,this.Jf),clearTimeout(this.Kf),null==(t=this.Zf)||t.stop(),this.ll=!1)}Xf(t,i){var e=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),a=function(t,i,e){for(var r=t;r&&Me(r)&&!Ie(r,"body");){if(r===e)return!1;var s=void 0;try{var a,o,l;s=null==(a=null!==(o=null==(l=r.ownerDocument)?void 0:l.defaultView)&&void 0!==o?o:ts)?void 0:a.getComputedStyle(r).position}catch(t){return!1}if(n(i,s))return!0;r=Ke(r)}return!1}(Be(t),["fixed","sticky"],s);return{x:t.clientX+(a?0:r),y:t.clientY+(a?0:e),target_fixed:a,type:i}}$r(t,e){var r;if(void 0===e&&(e="click"),!Oe(t.target)&&Ds(t)){var s=this.Xf(t,e);null!=(r=this.rageclicks)&&r.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&nr(Be(t),this.instance.config.rageclick)&&this.Qs(i({},s,{type:"rageclick"})),this.Qs(s)}}Qf(t){!Oe(t.target)&&Ds(t)&&(clearTimeout(this.Kf),this.Kf=setTimeout(()=>{this.Qs(this.Xf(t,"mousemove"))},500))}Qs(t){if(ts){var i=this.Ar.disable_capture_url_hashes?Z(ts.location.href):ts.location.href,e=this.Ar.custom_personal_data_properties,r=ps(i,this.Ar.mask_personal_data_properties?[...Ss,...e||[]]:[],xs);this.Rt=this.Rt||{},this.Rt[r]||(this.Rt[r]=[]),this.Rt[r].push(t)}}rc(){this.Rt&&!c(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:us,webVitalsAutocapture:class{constructor(t){var e,r=this;this._instance=t,this.jf=!1,this.ll=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Yf=function(t){void 0===t&&(t=!1),clearTimeout(r.tp),r.tp=void 0,0!==r.Rt.metrics.length&&(r._instance.capture("$web_vitals",i({$current_url:r.Rt.url},r.Rt.metrics.reduce((t,e)=>i({},t,{["$web_vitals_"+e.name+"_event"]:i({},e),["$web_vitals_"+e.name+"_value"]:e.value}),{})),t?{transport:"sendBeacon",send_instantly:!0}:void 0),r.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.ep=t=>{var e;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},b(null==t?void 0:t.name)||b(null==t?void 0:t.value))Ps.error("Invalid metric received",t);else{var r="string"==typeof t.navigationURL?t.navigationURL:void 0,s=this.np(r);if(!f(s)){var n=m(t.navigationId)||"string"==typeof t.navigationId?"navigation:"+t.navigationId:"url:"+s;if(!this.sp||this.sp>t.value){this.Rt.navigationKey!==n&&(this.Yf(),this.tp=setTimeout(this.Yf,this.flushToCaptureTimeoutMs)),f(this.Rt.navigationKey)&&(this.Rt.navigationKey=n,this.Rt.url=s),this.Rt.firstMetricTimestamp=f(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;var a=null==(e=this._instance.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0),o=i({},t,r?{navigationURL:s}:{},{$current_url:s,timestamp:Date.now()});if(delete o.entries,d(t.attribution)&&this.attributionMetrics.indexOf(t.name)>-1){var l={};for(var u of Cs){var h="url"===u&&"string"==typeof t.attribution[u]?this.np(t.attribution[u]):t.attribution[u];f(h)||(l[u]=h)}o.attribution=l}else delete o.attribution;f(a)||(o.$session_id=a.sessionId,o.$window_id=a.windowId),this.Rt.metrics.push(o),this.Rt.metrics.length===this.allowedMetrics.length&&this.Yf()}else Ps.error("Ignoring metric with value >= "+this.sp,t)}}},this.rp=()=>{if(!this.ll){var t,e,r,s,n=!1,a=as.__PosthogExtensions__,o=null==a?void 0:a.postHogWebVitalsCallbacksByFlavor,l=(null==o?void 0:o[this.op])||("web-vitals"===this.op&&f(o)?null==a?void 0:a.postHogWebVitalsCallbacks:void 0);if(!f(l)){var u=l.withoutAttribution,h=this.attributionMetrics;n=!f(u),t=h.indexOf("LCP")>-1?l.onLCP:(null==u?void 0:u.onLCP)||l.onLCP,e=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&&e&&r&&s){var v={reportSoftNavs:this.useSoftNavs},d=n&&this.attributionMetrics.indexOf("INP")>-1?i({},v,{includeProcessedEventEntries:!1}):v;this.allowedMetrics.indexOf("LCP")>-1&&t(this.ep.bind(this),v),this.allowedMetrics.indexOf("CLS")>-1&&e(this.ep.bind(this),v),this.allowedMetrics.indexOf("FCP")>-1&&r(this.ep.bind(this),v),this.allowedMetrics.indexOf("INP")>-1&&s(this.ep.bind(this),d);var c=null==ts?void 0:ts.document;ce(c,$e,()=>{"hidden"===(null==c?void 0:c.visibilityState)&&this.Yf(!0)}),ce(ts,"pagehide",()=>this.Yf(!0)),this.ll=!0}else Ps.error("web vitals callbacks not loaded - not starting")}},this.jf=!(null==(e=this._instance.persistence)||!e.props[Br]),this.startIfEnabled()}get ap(){return this._instance.config.capture_performance}get allowedMetrics(){var t,i,e=d(this.ap)?null==(t=this.ap)?void 0:t.web_vitals_allowed_metrics:void 0;return b(e)?(null==(i=this._instance.persistence)?void 0:i.props.$web_vitals_allowed_metrics)||As:e}get flushToCaptureTimeoutMs(){return(d(this.ap)?this.ap.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){var t=d(this.ap)?this.ap.web_vitals_attribution:void 0;return y(t)?t?As:[]:h(t)?t:Ts}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){var t;return null!==(t=d(this.ap)?this.ap.__preview_web_vitals_soft_navs:void 0)&&void 0!==t&&t}get sp(){var t=d(this.ap)&&m(this.ap.__web_vitals_max_value)?this.ap.__web_vitals_max_value:Fs;return t>0&&6e4>=t?Fs:t}get isEnabled(){var t=null==ss?void 0:ss.protocol;if("http:"!==t&&"https:"!==t)return Ps.info("Web Vitals are disabled on non-http/https protocols"),!1;var i=d(this.ap)?this.ap.web_vitals:y(this.ap)?this.ap:void 0;return y(i)?i:this.jf}startIfEnabled(){this.isEnabled&&!this.ll&&(Ps.info("enabled, starting..."),this.Ml(this.rp))}onRemoteConfig(t){if(t.ok){var i=t.config;if("capturePerformance"in i){var e=d(i.capturePerformance)&&!!i.capturePerformance.web_vitals,r=d(i.capturePerformance)?i.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Br]:e}),this._instance.persistence.register({[Wr]:r})),this.jf=e,this.startIfEnabled()}}}get op(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}Ml(t){var i=as.__PosthogExtensions__,e=this.op,r=null==i?void 0:i.postHogWebVitalsCallbacksByFlavor;null!=r&&r[e]||"web-vitals"===e&&f(r)&&null!=i&&i.postHogWebVitalsCallbacks?t():null==i||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,i=>{i?Ps.error("failed to load script",i):t()})}np(t){var i=t||(null==ts?void 0:ts.location.href);if(i){var e=this._instance.config.disable_capture_url_hashes?Z(i):i,r=this._instance.config.custom_personal_data_properties;return ps(e,this._instance.config.mask_personal_data_properties?[...Ss,...r||[]]:[],xs)}Ps.error("Could not determine current URL")}}},ba={exceptionObserver:class{constructor(t){var e;this.rp=()=>{var t;if(ts&&this.isEnabled&&null!=(t=as.__PosthogExtensions__)&&t.errorWrappingFunctions){var i=as.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,e=as.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=as.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.lp&&this.Ar.capture_unhandled_errors&&(this.lp=i(this.captureException.bind(this))),!this.up&&this.Ar.capture_unhandled_rejections&&(this.up=e(this.captureException.bind(this))),!this.cp&&this.Ar.capture_console_errors&&(this.cp=r(this.captureException.bind(this)))}catch(t){hs.error("failed to start",t),this.hp()}}},this._instance=t,this.dp=!(null==(e=this._instance.persistence)||!e.props[zr]),this.wt=new C(i({},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,$:hs})),this.Ar=this.vp(),this.startIfEnabledOrStop()}vp(){var t=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return d(t)?e=i({},e,t):(f(t)?this.dp:t)&&(e=i({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Ar.capture_console_errors||this.Ar.capture_unhandled_errors||this.Ar.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(hs.info("enabled"),this.hp(),this.Ml(this.rp)):this.hp()}Ml(t){var i,e;null!=(i=as.__PosthogExtensions__)&&i.errorWrappingFunctions?t():null==(e=as.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"exception-autocapture",i=>{if(i)return hs.error("failed to load script",i);t()})}hp(){var t,i,e;null==(t=this.lp)||t.call(this),this.lp=void 0,null==(i=this.up)||i.call(this),this.up=void 0,null==(e=this.cp)||e.call(this),this.cp=void 0}onRemoteConfig(t){if(t.ok){var i=t.config;"autocaptureExceptions"in i&&(this.dp=!!i.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[zr]:this.dp}),this.Ar=this.vp(),this.startIfEnabledOrStop())}}onConfigChange(){this.Ar=this.vp()}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.wt.consumeRateLimit(s))return void hs.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 e,r;this.fp=[],this.pp=new st([new Et,new It,new Ft,new Pt,new Ot,new Rt,new Tt,new Mt],function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),s=1;e>s;s++)r[s-1]=arguments[s];return function(e,s){void 0===s&&(s=0);for(var n=[],a=e.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=_t.test(h)?h.replace(_t,"$1"):h;if(!v.match(/\S*Error: /)){for(var d of r){var c=d(v,t);if(c){n.push(c);var f=mt(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(kt(n,l)>=50)break}}}var _=[...l].sort((t,i)=>i.start-t.start),b=_[_.length-1];if(b){var m=wt(n,b);for(var y of(n.splice(b.start-m,m),_))y.start-=m}for(var w of _)yt(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++)xt(i,r,e)&&(e=r);t.push(...t.splice(0,e))}(n),function(t){if(!t.length)return[];var e=Array.from(t);return e.reverse(),e.slice(0,50).map(t=>{return i({},t,{filename:t.filename||(r=e,r[r.length-1]||{}).filename,function:t.function||"?"});var r})}(n)}}("web:javascript",ct,gt)),this._instance=t,this.fp=null!==(e=null==(r=this._instance.persistence)?void 0:r.get_property("$error_tracking_suppression_rules"))&&void 0!==e?e:[],this.gp=zt(this.mp()),this.yp=new Ht(this.gp)}onConfigChange(){this.gp=zt(this.mp()),this.yp.setConfig(this.gp)}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.fp=n,this._instance.persistence&&this._instance.persistence.register({[Hr]:this.fp,[Ur]:a})}}}get bp(){var t,i,e=!!this._instance.get_property(Ur);return null!==(t=null!==(i=this._instance.config.error_tracking.captureExtensionExceptions)&&void 0!==i?i:e)&&void 0!==t&&t}buildProperties(t,i){return this.pp.buildFromUnknown(t,{syntheticException:null==i?void 0:i.syntheticException,mechanism:{handled:null==i?void 0:i.handled}})}addExceptionStep(t,e){if(this.gp.enabled)try{if(!p(t)||0===t.trim().length)return void Tn.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)=>Dt.has(r)?(i.push(r),e):(e[r]=t[r],e),{}),droppedKeys:i}}(this._p(e)),s=r.sanitizedProperties,n=r.droppedKeys;n.length>0&&Tn.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.yp.add(i({[jt]:t,[Lt]:(new Date).toISOString()},s))}catch(t){Tn.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{var i=t.$exception_list;if(this.wp(i)){if(this.kp(i))return this.Sp("Exception dropped: matched a suppression rule"),void Tn.info("Skipping exception capture because a suppression rule matched");if(!this.bp&&this.xp(i))return this.Sp("Exception dropped: thrown by a browser extension"),void Tn.info("Skipping exception capture because it was thrown by an extension");if(!this.bp&&this.$p(i))return this.Sp("Exception dropped: thrown by an injected browser script"),void Tn.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Cp(i))return this.Sp("Exception dropped: thrown by the PostHog SDK"),void Tn.info("Skipping exception capture because it was thrown by the PostHog SDK")}var e=this.gp.enabled&&b(t.$exception_steps)?this.Tp(t):t,r=function(){if("u">typeof process){var t,i=null==(t=process.env.POSTHOG_RELEASE_ID)?void 0:t.trim();if(i)return i}var e=globalThis._posthogReleaseId;return"string"==typeof e&&e.length>0?e:void 0}();r&&(e.$release_id=r);try{var s=this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent",_originatedFromCaptureException:!0});return s&&this.yp.clear(),s}catch(t){return An(t)||Tn.error("Failed to capture exception event. Dropping this exception.",t),void this.yp.clear()}}catch(t){return void(An(t)||Tn.error("Failed to process exception event. Ignoring this exception.",t))}}Tp(t){try{var e=this.yp.getAttachable();return 0===e.length?t:i({},t,{$exception_steps:e})}catch(i){return Tn.error("Failed to read buffered exception steps. Capturing exception without steps.",i),t}}Sp(t){this.gp.enabled&&this.yp.add({[jt]:t,[Lt]:(new Date).toISOString()})}_p(t){return d(t)?i({},t):{}}mp(){var t,i;return null!==(t=null==(i=this._instance.config.error_tracking)?void 0:i.exception_steps)&&void 0!==t?t:{}}kp(t){if(0===t.length)return!1;try{var i=t.reduce((t,i)=>{var e=i.type,r=i.value;return p(e)&&e.length>0&&t.$exception_types.push(e),p(r)&&r.length>0&&t.$exception_values.push(r),t},{$exception_types:[],$exception_values:[]});return this.fp.some(t=>{var e=t.values.map(t=>{var e=Zs[t.operator],r=i[t.key];if(!e||!r)return!1;var s=h(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 Tn.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}xp(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&&Rn.some(t=>i.startsWith(t))});return 0!==e.length&&(!e.every(t=>{var i=t.filename;return!!i&&i.startsWith(Cn)})||t.some(t=>{var i=t.value;return"NoResponse"===t.type||p(i)&&$n.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(Cn))}))}$p(t){return t.some(t=>{var i=t.value;return p(i)&&On.some(t=>i.includes(t))})}Cp(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:[];return null!==(r=null==(s=n[n.length-1])||null==(s=s.filename)?void 0:s.includes("posthog.com/static"))&&void 0!==r&&r}return!1}wp(t){return!b(t)&&h(t)}}},ma=i({productTours:class{get _c(){return this._instance.persistence}constructor(t){this.Ip=null,this.Mp=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._c&&this._c.register({[Vr]:!!i.productTours}),!zs(this._instance))return!this.Ip&&b(null==(e=this._c)?void 0:e.props.ph_product_tours)||Ns.info("product tours disabled; stopping and clearing cached tours"),null==(r=this.Ip)||r.stop(),this.Ip=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.Ip&&zs(this._instance)&&this.Ml(()=>this.Ep())}Ml(t){var i,e;null!=(i=as.__PosthogExtensions__)&&i.generateProductTours?t():null==(e=as.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"product-tours",i=>{i?Ns.error("Could not load product tours script",i):t()})}Ep(){var t;!this.Ip&&null!=(t=as.__PosthogExtensions__)&&t.generateProductTours&&(this.Ip=as.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,i){if(void 0===i&&(i=!1),!h(this.Mp)||i){var e=this._c;if(e){var r=e.props[Xr];if(h(r)&&!i)return this.Mp=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(zs(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||Ns.warn(s):Ns.error(s),void t([],{isLoaded:!1,error:s})}var n=h(i.json.product_tours)?i.json.product_tours:[];this.Mp=n,e&&e.register({[Xr]:n}),t(n,{isLoaded:!0})}else t([],{isLoaded:!0})}})}else t(this.Mp,{isLoaded:!0})}getActiveProductTours(t){b(this.Ip)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.Ip.getActiveProductTours(t)}showProductTour(t){var i;null==(i=this.Ip)||i.showTourById(t)}previewTour(t){this.Ip?this.Ip.previewTour(t):this.Ml(()=>{var i;this.Ep(),null==(i=this.Ip)||i.previewTour(t)})}dismissProductTour(){var t;null==(t=this.Ip)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.Ip)||t.nextStep()}previousStep(){var t;null==(t=this.Ip)||t.previousStep()}clearCache(){var t;this.Mp=null,null==(t=this._c)||t.unregister(Xr)}resetTour(t){var i;null==(i=this.Ip)||i.resetTour(t)}resetAllTours(){var t;null==(t=this.Ip)||t.resetAllTours()}cancelPendingTour(t){var i;null==(i=this.Ip)||i.cancelPendingTour(t)}}},pa),ya={siteApps:class{constructor(t){this._instance=t,this.Pp=0,this.Rp=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Ap(t,i){if(i){var e=this.globalsForEvent(i);this.Rp.push(e),this.Rp.length>1e3&&(this.Rp=this.Rp.slice(10))}}get siteAppLoaders(){var t;return null==(t=as._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.Ap.bind(this));this.Fp=()=>{t(),this.Rp=[],this.Fp=void 0}}}globalsForEvent(e){var r,s,n,a,o,l,u;if(!e)throw new Error("Event payload is required");var h={},v=this._instance.get_property("$groups")||[],d=this._instance.get_property("$stored_group_properties")||{};for(var c of Object.entries(d)){var f=c[0];h[f]={id:v[f],type:f,properties:c[1]}}var p=e.$set_once,g=e.$set;return{event:i({},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}(e,t),{properties:i({},e.properties,g?{$set:i({},null!==(r=null==(s=e.properties)?void 0:s.$set)&&void 0!==r?r:{},g)}:{},p?{$set_once:i({},null!==(n=null==(a=e.properties)?void 0:a.$set_once)&&void 0!==n?n:{},p)}:{}),elements_chain:null!==(o=null==(l=e.properties)?void 0:l.$elements_chain)&&void 0!==o?o:"",distinct_id:null==(u=e.properties)?void 0:u.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:h}}Op(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)||(Hs.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)||(Hs.error("prepare_external_dependency_script returned null"),null):t}Dp(){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==rs?void 0:rs.defaultView,u=null==l||null==(t=l.Node)?void 0:t.prototype;if(!l||!u)return()=>{};if(this.Pp++,this.Lp)return this.Np();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.Op(t);return i&&d.add(i),i},p=t=>t.map(t=>"string"==typeof t?t:f(t)).filter(t=>!_(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.Lp=()=>{h.forEach(t=>t()),this.Lp=void 0},this.Np()}Np(){var t=!1;return()=>{var i;t||(t=!0,this.Pp--,0===this.Pp&&(null==(i=this.Lp)||i.call(this)))}}qp(t,i){void 0===i&&(i=!0);var e=this.Dp();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.Rp.length&&(Hs.info("Processing "+this.Rp.length+" events for site app with id "+t.id),this.Rp.forEach(t=>this.qp(()=>null==i.processEvent?void 0:i.processEvent(t))),i.processedBuffer=!0),Object.values(this.apps).every(t=>t.processedBuffer||t.errored)&&(null==(e=this.Fp)||e.call(this))},r=!1,s=s=>{i.errored=!s,i.loaded=!0,Hs.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&e()};try{var n=this.qp(i=>t.init({posthog:this._instance,callback(t){i(),s(t)}}),!1).processEvent;n&&(i.processEvent=n),r=!0}catch(i){Hs.error(Us+t.id,i),s(!1)}if(r&&i.loaded)try{e()}catch(e){Hs.error("Error while processing buffered events PostHog app with config id "+t.id,e),i.errored=!0}}jp(){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)}Bp(t){var i=this;if(0!==Object.keys(this.apps).length){var e=this.globalsForEvent(t),r=function(r){try{i.qp(()=>null==r.processEvent?void 0:r.processEvent(e))}catch(i){Hs.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.jp(),void this._instance.on("eventCaptured",t=>this.Bp(t))):void Hs.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(e=this.Fp)||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;as["__$$ph_site_app_"+i]=s._instance,null==(t=as.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(s._instance,e,t=>{if(t)return Hs.error(Us+i,t)})};for(var o of n.siteApps)a()}else Hs.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},wa={tracingHeaders:class{constructor(t){this._instance=t,this.zp=void 0,this.Hp=void 0,this.Up=void 0,this.rp=()=>{var t,i,e=this.Wp();e?(f(this.zp)&&(this.zp=null==(t=as.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchXHR(e,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),f(this.Hp)&&(this.Hp=null==(i=as.__PosthogExtensions__)||null==(i=i.tracingHeadersPatchFns)?void 0:i._patchFetch(e,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.hp()}}initialize(){this.startIfEnabledOrStop()}Ml(t){var i,e;null!=(i=as.__PosthogExtensions__)&&i.tracingHeadersPatchFns?t():null==(e=as.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"tracing-headers",i=>{if(i)return ys.error("failed to load script",i);t()})}Vp(){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}Wp(){var t=this.Vp();return h(t)?(h(this.Up)?this.Up.splice(0,this.Up.length,...t):this.Up=[...t],t.length>0?this.Up:void 0):(h(this.Up)&&this.Up.splice(0),this.Up=t||void 0,this.Up)}hp(){var t,i;null==(t=this.zp)||t.call(this),null==(i=this.Hp)||i.call(this),this.zp=void 0,this.Hp=void 0}startIfEnabledOrStop(){this.Wp()?this.Ml(this.rp):this.hp()}}},Sa=i({surveys:class extends hn{constructor(t){super(new cn(t))}}},pa),ka={toolbar:class{constructor(t){this.instance=t}Gp(t){as.ph_toolbar_state=t}Qp(){var t;return null!==(t=as.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),fe(this.instance.config))return!1;if(!ts||!rs)return!1;t=null!=t?t:ts.location,e=null!=e?e:ts.history;try{if(!i){try{ts.localStorage.setItem("test","test"),ts.localStorage.removeItem("test")}catch(t){return!1}i=null==ts?void 0:ts.localStorage}var r,s=fn||gs(t.hash,"__posthog")||gs(t.hash,"state"),n=s?Q(()=>JSON.parse(atob(decodeURIComponent(s))))||Q(()=>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(pn)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}Zp(t){var i=as.ph_load_toolbar||as.ph_load_editor;!b(i)&&v(i)?i(t,this.instance):gn.warn("No toolbar load function found")}loadToolbar(t){var e=!(null==rs||!rs.getElementById("__POSTHOG_TOOLBAR__"));if(!ts||e)return!1;var r="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=i({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(ts.localStorage.setItem(pn,JSON.stringify(i({},s,{source:void 0}))),2===this.Qp())this.Zp(s);else if(0===this.Qp()){var n;this.Gp(1),null==(n=as.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",t=>{if(t)return gn.error("[Toolbar] Failed to load",t),void this.Gp(0);this.Gp(2),this.Zp(s)}),ce(ts,"turbolinks:load",()=>{this.Gp(0),this.loadToolbar(s)})}return!0}Jp(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)}}},xa=i({experiments:class t{get Ar(){return this._instance.config}constructor(i){var e=this;this._instance=i,this.getWebExperimentsAndEvaluateDisplayLogic=function(i){void 0===i&&(i=!1),e.getWebExperiments(i=>{t.Kp("retrieved web experiments from the server"),e.Xp=new Map,i.forEach(i=>{if(i.feature_flag_key){var r;e.Xp&&(t.Kp("setting flag key ",i.feature_flag_key," to web experiment ",i),null==(r=e.Xp)||r.set(i.feature_flag_key,i));var s=e._instance.getFeatureFlag(i.feature_flag_key);p(s)&&i.variants[s]&&e.Yp(i.name,s,i.variants[s].transforms)}else if(i.variants)for(var n in i.variants){var a=i.variants[n];t.tg(a,e._instance)&&e.Yp(i.name,n,a.transforms)}})},i)},this._instance.onFeatureFlags(t=>{this.onFeatureFlags(t)})}initialize(){}onFeatureFlags(i){if(this._is_bot())t.Kp(Mn);else if(!this.Ar.disable_web_experiments){if(b(this.Xp))return this.Xp=new Map,this.loadIfEnabled(),void this.previewWebExperiment();t.Kp("applying feature flags",i),i.forEach(t=>{var i;if(this.Xp&&null!=(i=this.Xp)&&i.has(t)){var e,r=this._instance.getFeatureFlag(t),s=null==(e=this.Xp)?void 0:e.get(t);r&&null!=s&&s.variants[r]&&this.Yp(s.name,r,s.variants[r].transforms)}})}}previewWebExperiment(){var i=t.getWindowLocation();if(null!=i&&i.search){var e=fs(null==i?void 0:i.search,"__experiment_id"),r=fs(null==i?void 0:i.search,"__experiment_variant");e&&r&&(t.Kp("previewing web experiments "+e+" && "+r),this.getWebExperiments(t=>{this.eg(parseInt(e),r,t)},!1,!0))}}loadIfEnabled(){this.Ar.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,i,e){if(this.Ar.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.Ar.token),method:"GET",timestampMode:"query",callback:i=>t(200===i.statusCode&&i.json&&i.json.experiments||[])})}eg(i,e,r){var s=r.filter(t=>t.id===i);s&&s.length>0&&(t.Kp("Previewing web experiment ["+s[0].name+"] with variant ["+e+"]"),this.Yp(s[0].name,e,s[0].variants[e].transforms))}static tg(i,e){return!b(i.conditions)&&t.ig(i,e)&&t.ng(i)}static ig(i,e){var r;if(b(i.conditions)||b(null==(r=i.conditions)?void 0:r.url))return!0;var s=t.getWindowLocation();if(s){var n,a,o,l=pe(e,s.href);return null==(n=i.conditions)||!n.url||In[null!==(a=null==(o=i.conditions)?void 0:o.urlMatchType)&&void 0!==a?a:"icontains"](i.conditions.url,l)}return!1}static getWindowLocation(){return null==ts?void 0:ts.location}static ng(t){var i;if(b(t.conditions)||b(null==(i=t.conditions)?void 0:i.utm))return!0;var e=function(t,i,e){if(!rs)return{};var r,s,n,a=i?[...Ss,...e||[]]:[],o=(r=ps(rs.URL,a,xs),s=ks.concat(t||[]),n={},he(s,function(t){var i=fs(r,t);n[t]=i||null}),n);return ve(function(){var t={};return he(Es,function(i){var e=(t=>{if(rs){try{for(var i=t+"=",e=rs.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}(),o)}();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 Kp(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;i>r;r++)e[r-1]=arguments[r];oe.info("[WebExperiments] "+t,e)}Yp(i,e,r){this._is_bot()?t.Kp(Mn):"control"!==e?r.forEach(r=>{var s;r.selector&&(t.Kp("applying transform of variant "+e+" for experiment "+i+" ",r),null==(s=document)||null==(s=s.querySelectorAll(r.selector))||s.forEach(t=>{var i=t;r.html&&(i.innerHTML=r.html),r.css&&i.setAttribute("style",r.css)}))}):t.Kp("Control variants leave the page unmodified.")}_is_bot(){return es&&this._instance?function(t,i){if(!t)return!1;var e=t.userAgent;if(e&&A(e,i))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some(t=>A(null==t?void 0:t.brand,i)))return!0}catch(t){}return!!t.webdriver}(es,this.Ar.custom_blocked_useragents):void 0}}},pa),Ea={conversations:class{constructor(t){this._instance=t,this.sg=void 0,this._conversationsManager=null,this.rg=!1,this.ne=null,this.og=!1,this.ag=0}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations&&(this.lg=t.ok,t.ok)){var i=t.config.conversations;b(i)||(y(i)?this.sg=i:(this.sg=i.enabled,this.ne=i),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.ag++,this.sg=void 0,this.ne=null,this.lg=void 0,this.og=!1}loadIfEnabled(){if(!(this._conversationsManager||this.rg||this._instance.config.disable_conversations||fe(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==as?void 0:as.__PosthogExtensions__;if(t&&!f(this.sg)&&this.sg)if(this.ne&&this.ne.token){this.rg=!0;try{var i=t.initConversations;if(i)return this.ug(i),void(this.rg=!1);var e=t.loadExternalDependency;if(!e)return void this.cg(Ir);var r=this.ag;e(this._instance,"conversations",i=>{if(r!==this.ag)return this.rg=!1,void this.loadIfEnabled();i||!t.initConversations?this.cg("Could not load conversations script",i):this.ug(t.initConversations),this.rg=!1})}catch(t){this.cg("Error initializing conversations",t),this.rg=!1}}else jn.error("Conversations enabled but missing token in remote config.")}}ug(t){if(this.ne)try{this._conversationsManager=t(this.ne,this._instance),this.og=!1,jn.info("Conversations loaded successfully")}catch(t){this.cg("Error completing conversations initialization",t)}else jn.error("Cannot complete initialization: remote config is null")}cg(t,i){jn.error(t,i),this._conversationsManager=null,this.rg=!1,this.og=!0}show(){this._conversationsManager?this._conversationsManager.show():jn.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.sg&&!_(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":fe(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.lg?"remote_config_failed":f(this.sg)?this.lg?"disabled_in_project":"remote_config_pending":this.sg?b(this.ne)||!this.ne.token?"missing_token":null!=as&&as.__PosthogExtensions__?this.rg?"initializing":this.og?"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,i,e){var s=this;return r(function*(){return s._conversationsManager?s._conversationsManager.sendMessage(t,i,e):(jn.warn(Ln),null)})()}getMessages(t,i){var e=this;return r(function*(){return e._conversationsManager?e._conversationsManager.getMessages(t,i):(jn.warn(Ln),null)})()}markAsRead(t){var i=this;return r(function*(){return i._conversationsManager?i._conversationsManager.markAsRead(t):(jn.warn(Ln),null)})()}getTickets(t){var i=this;return r(function*(){return i._conversationsManager?i._conversationsManager.getTickets(t):(jn.warn(Ln),null)})()}requestRestoreLink(t){var i=this;return r(function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(t):(jn.warn(Ln),null)})()}restoreFromToken(t){var i=this;return r(function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(t):(jn.warn(Ln),null)})()}restoreFromUrlToken(){var t=this;return r(function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(jn.warn(Ln),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()}}},Pa={logs:class extends Vn{constructor(t){super({get(){var i;return null==t||null==(i=t.config)?void 0:i.logs},captureHintKey:"$logs_capture_enabled_server_side",get remoteConfigWillArrive(){var i;return!(null!=t._shouldDisableFlags&&t._shouldDisableFlags()&&(null==(i=as._POSTHOG_REMOTE_CONFIG)||null==(i=i[t.config.token])||!i.config))}},()=>function(t){var i,e={};if(e.distinctId=t.get_distinct_id(),t.sessionManager){var r=t.sessionManager.checkAndGetSessionAndWindowId(!0),s=r.windowId,n=r.sessionStartTimestamp,a=r.lastActivityTimestamp;e.sessionId=r.sessionId,e.windowId=s,b(n)||(e.sessionStartTimestamp=n),b(a)||(e.lastActivityTimestamp=a)}if(null!=as&&null!=(i=as.location)&&i.href&&(e.currentUrl=t.config.disable_capture_url_hashes?Z(as.location.href):as.location.href),t.featureFlags){var o=t.featureFlags.getFlags();o&&o.length>0&&(e.activeFeatureFlags=o)}return e}(t)),this._instance=t,this.name="logs",this.Hv()}get Bv(){return this._instance.__loaded}zv(){var t=le("[logs]"),i=null==as?void 0:as.__PosthogExtensions__;if(i){var e=i.loadExternalDependency;if(e)return t=>{e(this._instance,"logs",e=>{var r=i.logs;t(e,null!=r&&r.initializeLogs?{initialize:t=>r.initializeLogs(t),replay:(t,i)=>null==r.replayConsoleBuffer?void 0:r.replayConsoleBuffer(t,i)}:void 0)})};t.error(Ir)}else t.error("PostHog Extensions not found.")}}},Fa={metrics:class{constructor(t){this._instance=t,this.$=le("[metrics]"),this.Ci=!1}initialize(){this.onConfigChange()}onConfigChange(){var t;if(!this.Ci){var i=!(null==(t=this._instance.config.metrics)||!t.network);i&&!this.hg?this.hg=(t=>{var i=!0,e=()=>i?(t=>{var i,e=null==(i=t.config.metrics)?void 0:i.network;return!0===e?{}:e||void 0})(t):void 0,r=Yn(t,e),s=ta(t,e);return()=>{i=!1,r(),s()}})(this._instance):!i&&this.hg&&(this.hg(),this.hg=void 0)}}Vv(){var t,i,e=null==(t=this._instance)||null==(t=t.config)?void 0:t.metrics;return this.qv&&this.Gv===e||(null==(i=this.qv)||i.reset(),this.Gv=e,this.qv=new ee(this.Wv(),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.$)),this.qv}count(t,i,e){void 0===i&&(i=1),this.Vv().count(t,i,e)}gauge(t,i,e){this.Vv().gauge(t,i,e)}histogram(t,i,e){this.Vv().histogram(t,i,e)}flush(t){if(!this.qv)return Promise.resolve();if(t){var i=this.qv.drainWindow();return i&&this.po(i,t),Promise.resolve()}return this.qv.flush().catch(t=>this.$.error("PostHog metrics flush failed:",t))}reset(){var t;null==(t=this.qv)||t.reset()}dispose(){var t,i;this.Ci=!0,null==(t=this.hg)||t.call(this),this.hg=void 0,null==(i=this.qv)||i.reset()}Wv(){var t=this._instance,i=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},po:t=>i.po(t),getLibraryId:()=>vn.LIB_NAME,getLibraryVersion:()=>vn.LIB_VERSION}}po(t,e){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(i({method:"POST",url:this.dg(),data:t,compression:"best-available",batchKey:"metrics"},e&&{transport:e},{fireCallbackOnDrop:!0,callback(t){var i,e=t.statusCode;n(e>=200&&300>e?{kind:"ok"}:413===e?{kind:"too-large"}:0!==e&&408!==e&&429!==e&&500>e?{kind:"fatal",error:new Error("metrics request failed with status "+e)}:{kind:"retry-later",error:null!==(i=t.error)&&void 0!==i?i:new Error("metrics request failed with status "+e)})}}))})}dg(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},Aa={webMCP:class{constructor(t){this._instance=t,this.vg=!1}initialize(){this.startIfEnabled()}startIfEnabled(){if(this._instance.config.capture_webmcp&&!this.vg){var t=null==rs?void 0:rs.modelContext;if(t&&v(t.registerTool)){var i=ia.get(t);if(i)return i.instances.add(this._instance),void(this.vg=!0);var e={instances:new Set([this._instance])},r=t.registerTool,s=this;ms(t,"registerTool",t=>{var i=t;return function(t){for(var r=t,n=arguments.length,a=new Array(n>1?n-1:0),o=1;n>o;o++)a[o-1]=arguments[o];try{r=s.fg(t,e)}catch(e){return i.call(this,t,...a)}return i.call(this,r,...a)}}),t.registerTool!==r&&(ia.set(t,e),this.vg=!0)}}}fg(t,e){if(!t||!v(t.execute))return t;var r=t.execute,s=this,n=function(t,e){var r={intent:!1,model:!1},s=t.inputSchema;if(!function(t){return!!f(t)||d(t)&&Object.keys(t).every(t=>ea.has(t)||t.startsWith("x-"))&&!0!==t.additionalProperties&&!d(t.additionalProperties)&&(!t.type||"object"===t.type)&&(!t.properties||d(t.properties))&&(!t.required||h(t.required))}(s))return{tool:oa(t),injected:r};var n=(null==s?void 0:s.properties)||{},a=t=>aa(n,t)||h(null==s?void 0:s.required)&&s.required.includes(t);if(r.intent=e.intent&&!a("context"),r.model=e.model&&!a("llm_model"),!r.intent&&!r.model)return{tool:oa(t),injected:r};var o=i({},n),l=h(null==s?void 0:s.required)?[...s.required]:[];return r.intent&&(o.context={type:"string",description:'Explain why this tool is called and how it supports the user\'s goal. Describe the abstract purpose only. Do not include personal or identifying information. Generalize specific entities as roles such as "a customer".'},l.includes("context")||l.push("context")),r.model&&(o.llm_model={type:"string",description:'The exact model identifier you are running as, taken from your system prompt or environment. Pass "unknown" if you do not know it. Never guess.'},l.includes("llm_model")||l.push("llm_model")),{tool:oa(t,i({},s,{type:(null==s?void 0:s.type)||"object",properties:o,required:l})),injected:r}}(t,function(t){var i={intent:!1,model:!1};for(var e of t.instances){var r=na(e.config.capture_webmcp);i.intent||(i.intent=!0===(null==r?void 0:r.intent)),i.model||(i.model=!0===(null==r?void 0:r.model))}return i}(e)),a=n.tool,o=n.injected;return Object.defineProperty(a,"execute",{configurable:!0,enumerable:!0,writable:!0,value(){for(var n=new Date,l=arguments.length,u=new Array(l),h=0;l>h;h++)u[h]=arguments[h];var v,c,f=function(t,e){if(!d(t))return{};try{var r=e.intent?la(t.context,2048,!0):void 0,s=e.model?la(t.llm_model,256):void 0;return i({},r&&"{}"!==r?{intent:r}:{},s&&"unknown"!==s.toLowerCase()?{model:s}:{})}catch(t){return{}}}(u[0],o),p=function(t,e){var r=t[0];if(!d(r))return t;try{var s=e.intent&&aa(r,"context"),n=e.model&&aa(r,"llm_model");if(!s&&!n)return t;var a=i({},r);return s&&delete a.context,n&&delete a.llm_model,[a,...t.slice(1)]}catch(i){return t}}(u,o);try{v=r.apply(this===a?t:this,p)}catch(t){throw s.pg(e,a,n,{error:t,errorResult:!1},f),t}if((c=v)&&"function"==typeof c.then)return Promise.resolve(v).then(t=>{var i=ua(t)?{error:t,errorResult:!0}:void 0;return s.pg(e,a,n,i,f),t},t=>{throw s.pg(e,a,n,{error:t,errorResult:!1},f),t});var g=ua(v)?{error:v,errorResult:!0}:void 0;return s.pg(e,a,n,g,f),v}}),a}pg(t,e,r,s,n){var a,o=Date.now()-r.getTime();for(var l of t.instances){var u,h=na(l.config.capture_webmcp);if(h){s&&!a&&(a=fa(s.error,s.errorResult));try{l.capture("$mcp_tool_call",i({$mcp_source:"posthog_mcp_analytics",$mcp_interface:"webmcp",$mcp_tool_name:e.name,$mcp_resource_name:e.name,$mcp_tool_description:e.description,$mcp_server_name:null==ss?void 0:ss.hostname,$mcp_duration_ms:o,$mcp_is_error:!!s},a?{$mcp_error_type:a.type,$mcp_error_message:a.message}:{},h.intent&&n.intent?{$mcp_intent:n.intent,$mcp_intent_source:"context_parameter"}:{},h.model&&n.model?{$mcp_llm_model:n.model,$mcp_llm_model_source:"self_reported"}:{}),{timestamp:r})}catch(t){continue}if(s&&a&&l.exceptions&&null!=(u=l.exceptionObserver)&&u.isEnabled)try{var v={$exception_list:da(l.exceptions,s,a.message),$exception_level:"error",$exception_source:"mcp.tool_call",$mcp_interface:"webmcp",$mcp_tool_name:e.name,$mcp_resource_name:e.name,$mcp_tool_description:e.description,$mcp_server_name:null==ss?void 0:ss.hostname};l.exceptionObserver.captureException(v)}catch(t){}}}}}},Ta=i({},pa,ga,_a,ba,ma,ya,Sa,wa,ka,xa,Ea,Pa,Fa,Aa),Ca=pa,$a=ga,Ra=_a,Oa=ba,Ma=ma,Ia=ya,ja=Sa,La=wa,Da=ka,Na=xa,za=Ea,Ha=Pa,Ua=Fa,Ba=Aa;export{Ta as AllExtensions,Ra as AnalyticsExtensions,za as ConversationsExtensions,Oa as ErrorTrackingExtensions,Na as ExperimentsExtensions,Ca as FeatureFlagsExtensions,Ha as LogsExtensions,Ua as MetricsExtensions,Ma as ProductToursExtensions,$a as SessionReplayExtensions,Ia as SiteAppsExtensions,ja as SurveysExtensions,Da as ToolbarExtensions,La as TracingExtensions,Ba as WebMCPExtensions};
//# sourceMappingURL=extension-bundles.js.map