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