@walkeros/web-destination-posthog 4.0.0-next-1777463920154 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";var Destination=(()=>{var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,s=Object.prototype.hasOwnProperty,r={};((t,i)=>{for(var s in i)e(t,s,{get:i[s],enumerable:!0})})(r,{DestinationPostHog:()=>xa,default:()=>Pa,destinationPostHog:()=>Sa});var n=Object.defineProperty;((e,t)=>{for(var i in t)n(e,i,{get:t[i],enumerable:!0})})({},{Level:()=>a});var o,a=((o=a||{})[o.ERROR=0]="ERROR",o[o.WARN=1]="WARN",o[o.INFO=2]="INFO",o[o.DEBUG=3]="DEBUG",o);function l(e){return Array.isArray(e)}function u(e){return void 0!==e}function c(e){return"object"==typeof e&&null!==e&&!l(e)&&"[object Object]"===Object.prototype.toString.call(e)}function h(e){return"string"==typeof e}function d(e,t="",i){const s=t.split(".");let r=e;for(let e=0;e<s.length;e++){const t=s[e];if("*"===t&&l(r)){const t=s.slice(e+1).join("."),n=[];for(const e of r){const s=d(e,t,i);n.push(s)}return n}if(r=r instanceof Object?r[t]:void 0,void 0===r)break}return u(r)?r:i}function p(e){return function(e){return"boolean"==typeof e}(e)||h(e)||function(e){return"number"==typeof e&&!Number.isNaN(e)}(e)||!u(e)||l(e)&&e.every(p)||c(e)&&Object.values(e).every(p)}function v(e){return p(e)?e:void 0}function g(e,t,i){return async function(...s){try{return await e(...s)}catch(e){if(!t)return;return await t(e)}finally{await(null==i?void 0:i())}}}async function _(e,t={},i={}){var s;if(!u(e))return;const r=c(e)&&e.consent||i.consent||(null==(s=i.collector)?void 0:s.consent),n=l(t)?t:[t];for(const t of n){const s=await g(f)(e,t,{...i,consent:r});if(u(s))return s}}async function f(e,t,i={}){const{collector:s,consent:r}=i;return(l(t)?t:[t]).reduce(async(t,n)=>{const o=await t;if(o)return o;const a=h(n)?{key:n}:n;if(!Object.keys(a).length)return;const{condition:c,consent:p,fn:m,key:y,loop:b,map:w,set:x,validate:E,value:k}=a;if(c&&!await g(c)(e,n,s))return;if(p&&!function(e,t={},i={}){const s={...t,...i},r={};let n=!e||0===Object.keys(e).length;return Object.keys(s).forEach(t=>{s[t]&&(r[t]=!0,e&&e[t]&&(n=!0))}),!!n&&r}(p,r))return k;let S=u(k)?k:e;if(m&&(S=await g(m)(e,n,i)),y&&(S=d(e,y,k)),b){const[t,s]=b,r="this"===t?[e]:await _(e,t,i);l(r)&&(S=(await Promise.all(r.map(e=>_(e,s,i)))).filter(u))}else w?S=await Object.entries(w).reduce(async(t,[s,r])=>{const n=await t,o=await _(e,r,i);return u(o)&&(n[s]=o),n},Promise.resolve({})):x&&(S=await Promise.all(x.map(t=>f(e,t,i))));E&&!await g(E)(S)&&(S=void 0);const P=v(S);return u(P)?P:v(k)},Promise.resolve(void 0))}var m="undefined"!=typeof window?window:void 0,y="undefined"!=typeof globalThis?globalThis:m;"undefined"==typeof self&&(y.self=y),"undefined"==typeof File&&(y.File=function(){});var b=null==y?void 0:y.navigator,w=null==y?void 0:y.document,x=null==y?void 0:y.location,E=null==y?void 0:y.fetch,k=null!=y&&y.XMLHttpRequest&&"withCredentials"in new y.XMLHttpRequest?y.XMLHttpRequest:void 0,S=null==y?void 0:y.AbortController,P=null==y?void 0:y.CompressionStream,R=null==b?void 0:b.userAgent,F=null!=m?m:{},$="1.367.0",O={DEBUG:!1,LIB_VERSION:$,LIB_NAME:"web",JS_SDK_VERSION:$};function C(e,t,i,s,r,n,o){try{var a=e[n](o),l=a.value}catch(e){return void i(e)}a.done?t(l):Promise.resolve(l).then(s,r)}function T(e){return function(){var t=this,i=arguments;return new Promise(function(s,r){var n=e.apply(t,i);function o(e){C(n,s,r,o,a,"next",e)}function a(e){C(n,s,r,o,a,"throw",e)}o(void 0)})}}function I(){return I=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var i=arguments[t];for(var s in i)({}).hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e},I.apply(null,arguments)}function M(e,t){if(null==e)return{};var i={};for(var s in e)if({}.hasOwnProperty.call(e,s)){if(-1!==t.indexOf(s))continue;i[s]=e[s]}return i}function A(){return(A=T(function*(e,t){void 0===t&&(t=!0);try{var i=new Blob([e],{type:"text/plain"}).stream().pipeThrough(new CompressionStream("gzip"));return yield new Response(i).blob()}catch(e){return t&&console.error("Failed to gzip compress data",e),null}})).apply(this,arguments)}var L=["$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"],D=["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"],j=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var i=e.toLowerCase();return D.concat(t).some(e=>{var t=e.toLowerCase();return-1!==i.indexOf(t)})};function N(e,t){return-1!==e.indexOf(t)}var q=function(e){return e.trim()},W=function(e){return e.replace(/^\$/,"")},H=Object.prototype,U=H.hasOwnProperty,z=H.toString,B=Array.isArray||function(e){return"[object Array]"===z.call(e)},G=e=>"function"==typeof e,V=e=>e===Object(e)&&!B(e),K=e=>{if(V(e)){for(var t in e)if(U.call(e,t))return!1;return!0}return!1},Y=e=>void 0===e,X=e=>"[object String]"==z.call(e),J=e=>X(e)&&0===e.trim().length,Z=e=>null===e,Q=e=>Y(e)||Z(e),ee=e=>"[object Number]"==z.call(e)&&e==e,te=e=>ee(e)&&e>0,ie=e=>"[object Boolean]"===z.call(e),se=e=>N(L,e);function re(e){return null===e||"object"!=typeof e}function ne(e,t){return{}.toString.call(e)==="[object "+t+"]"}function oe(e){return"undefined"!=typeof Event&&function(e,t){try{return e instanceof t}catch(e){return!1}}(e,Event)}var ae=[!0,"true",1,"1","yes"],le=e=>N(ae,e),ue=[!1,"false",0,"0","no"];function ce(e,t,i,s,r){return t>i&&(s.warn("min cannot be greater than max."),t=i),ee(e)?e>i?(s.warn(" cannot be greater than max: "+i+". Using max value instead."),i):t>e?(s.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(s.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+r),ce(r||i,t,i,s))}var he,de,pe,ve=class{constructor(e){this.Pt={},this.Dt=e.Dt,this.jt=ce(e.bucketSize,0,100,e.qt),this.$t=ce(e.refillRate,0,this.jt,e.qt),this.Ht=ce(e.refillInterval,0,864e5,e.qt)}Vt(e,t){var i=Math.floor((t-e.lastAccess)/this.Ht);i>0&&(e.tokens=Math.min(e.tokens+i*this.$t,this.jt),e.lastAccess=e.lastAccess+i*this.Ht)}consumeRateLimit(e){var t,i=Date.now(),s=String(e),r=this.Pt[s];return r?this.Vt(r,i):this.Pt[s]=r={tokens:this.jt,lastAccess:i},0===r.tokens||(r.tokens--,0===r.tokens&&(null==(t=this.Dt)||t.call(this,e)),0===r.tokens)}stop(){this.Pt={}}},ge="Mobile",_e="iOS",fe="Android",me="Tablet",ye=fe+" "+me,be="iPad",we="Apple",xe=we+" Watch",Ee="Safari",ke="BlackBerry",Se="Samsung",Pe=Se+"Browser",Re=Se+" Internet",Fe="Chrome",$e=Fe+" OS",Oe=Fe+" "+_e,Ce="Internet Explorer",Te=Ce+" "+ge,Ie="Opera",Me=Ie+" Mini",Ae="Edge",Le="Microsoft "+Ae,De="Firefox",je=De+" "+_e,Ne="Nintendo",qe="PlayStation",We="Xbox",He=fe+" "+ge,Ue=ge+" "+Ee,ze="Windows",Be=ze+" Phone",Ge="Nokia",Ve="Ouya",Ke="Generic",Ye=Ke+" "+ge.toLowerCase(),Xe=Ke+" "+me.toLowerCase(),Je="Konqueror",Ze="(\\d+(\\.\\d+)?)",Qe=new RegExp("Version/"+Ze),et=new RegExp(We,"i"),tt=new RegExp(qe+" \\w+","i"),it=new RegExp(Ne+" \\w+","i"),st=new RegExp(ke+"|PlayBook|BB10","i"),rt={"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"},nt=function(e,t){return t=t||"",N(e," OPR/")&&N(e,"Mini")?Me:N(e," OPR/")?Ie:st.test(e)?ke:N(e,"IE"+ge)||N(e,"WPDesktop")?Te:N(e,Pe)?Re:N(e,Ae)||N(e,"Edg/")?Le:N(e,"FBIOS")?"Facebook "+ge:N(e,"UCWEB")||N(e,"UCBrowser")?"UC Browser":N(e,"CriOS")?Oe:N(e,"CrMo")||N(e,Fe)?Fe:N(e,fe)&&N(e,Ee)?He:N(e,"FxiOS")?je:N(e.toLowerCase(),Je.toLowerCase())?Je:(i=e,(s=t)&&N(s,we)||N(r=i,Ee)&&!N(r,Fe)&&!N(r,fe)?N(e,ge)?Ue:Ee:N(e,De)?De:N(e,"MSIE")||N(e,"Trident/")?Ce:N(e,"Gecko")?De:"");var i,s,r},ot={[Te]:[new RegExp("rv:"+Ze)],[Le]:[new RegExp(Ae+"?\\/"+Ze)],[Fe]:[new RegExp("("+Fe+"|CrMo)\\/"+Ze)],[Oe]:[new RegExp("CriOS\\/"+Ze)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Ze)],[Ee]:[Qe],[Ue]:[Qe],[Ie]:[new RegExp("(Opera|OPR)\\/"+Ze)],[De]:[new RegExp(De+"\\/"+Ze)],[je]:[new RegExp("FxiOS\\/"+Ze)],[Je]:[new RegExp("Konqueror[:/]?"+Ze,"i")],[ke]:[new RegExp(ke+" "+Ze),Qe],[He]:[new RegExp("android\\s"+Ze,"i")],[Re]:[new RegExp(Pe+"\\/"+Ze)],[Ce]:[new RegExp("(rv:|MSIE )"+Ze)],Mozilla:[new RegExp("rv:"+Ze)]},at=function(e,t){var i=nt(e,t),s=ot[i];if(Y(s))return null;for(var r=0;s.length>r;r++){var n=e.match(s[r]);if(n)return parseFloat(n[n.length-2])}return null},lt=[[new RegExp(We+"; "+We+" (.*?)[);]","i"),e=>[We,e&&e[1]||""]],[new RegExp(Ne,"i"),[Ne,""]],[new RegExp(qe,"i"),[qe,""]],[st,[ke,""]],[new RegExp(ze,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Be,""];if(new RegExp(ge).test(t)&&!/IEMobile\b/.test(t))return[ze+" "+ge,""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var s=rt[i[1]]||"";return/arm/i.test(t)&&(s="RT"),[ze,s]}return[ze,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[_e,[e[3],e[4],e[5]||"0"].join(".")]:[_e,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=Y(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+fe+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+fe+")","i"),e=>e&&e[2]?[fe,[e[2],e[3],e[4]||"0"].join(".")]:[fe,""]],[/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/,[$e,""]],[/Linux|debian/i,["Linux",""]]],ut=function(e){return it.test(e)?Ne:tt.test(e)?qe:et.test(e)?We:new RegExp(Ve,"i").test(e)?Ve:new RegExp("("+Be+"|WPDesktop)","i").test(e)?Be:/iPad/.test(e)?be:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?xe:st.test(e)?ke:/(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(ge).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)?fe:ye:new RegExp("(pda|"+ge+")","i").test(e)?Ye:new RegExp(me,"i").test(e)&&!new RegExp(me+" pc","i").test(e)?Xe:""},ct=e=>e instanceof Error;function ht(e){var t=globalThis._posthogChunkIds;if(t){var i=Object.keys(t);return pe&&i.length===de||(de=i.length,pe=i.reduce((i,s)=>{he||(he={});var r=he[s];if(r)i[r[0]]=r[1];else for(var n=e(s),o=n.length-1;o>=0;o--){var a=n[o],l=null==a?void 0:a.filename,u=t[s];if(l&&u){i[l]=u,he[s]=[l,u];break}}return i},{})),pe}}var dt=class{constructor(e,t,i){void 0===i&&(i=[]),this.coercers=e,this.stackParser=t,this.modifiers=i}buildFromUnknown(e,t){void 0===t&&(t={});var i=t&&t.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(i,t,0).apply(e),r=this.buildParsingContext(t),n=this.parseStacktrace(s,r);return{$exception_list:this.convertToExceptionList(n,i),$exception_level:"error"}}modifyFrames(e){var t=this;return T(function*(){for(var i of e)i.stacktrace&&i.stacktrace.frames&&B(i.stacktrace.frames)&&(i.stacktrace.frames=yield t.applyModifiers(i.stacktrace.frames));return e})()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:null==(t=e.syntheticException)?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var i,s;return null!=e.cause&&(i=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack&&(s=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),I({},e,{cause:i,stack:s})}applyChunkIds(e,t){return e.map(e=>(e.filename&&t&&(e.chunk_id=t[e.filename]),e))}applyCoercers(e,t){for(var i of this.coercers)if(i.match(e))return i.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return T(function*(){var i=e;for(var s of t.modifiers)i=yield s(i);return i})()}convertToExceptionList(e,t){var i,s,r,n={type:e.type,value:e.value,mechanism:{type:null!==(i=t.type)&&void 0!==i?i:"generic",handled:null===(s=t.handled)||void 0===s||s,synthetic:null!==(r=e.synthetic)&&void 0!==r&&r}};e.stack&&(n.stacktrace={type:"raw",frames:e.stack});var o=[n];return null!=e.cause&&o.push(...this.convertToExceptionList(e.cause,I({},t,{handled:!0}))),o}buildParsingContext(e){var t;return{chunkIdMap:ht(this.stackParser),skipFirstLines:null!==(t=e.skipFirstLines)&&void 0!==t?t:1}}buildCoercingContext(e,t,i){void 0===i&&(i=0);var s=(i,s)=>{if(4>=s){var r=this.buildCoercingContext(e,t,s);return this.applyCoercers(i,r)}};return I({},t,{syntheticException:0==i?t.syntheticException:void 0,mechanism:e,apply:e=>s(e,i),next:e=>s(e,i+1)})}},pt="?";function vt(e,t,i,s,r){var n={platform:e,filename:t,function:"<anonymous>"===i?pt:i,in_app:!0};return Y(s)||(n.lineno=s),Y(r)||(n.colno=r),n}var gt=(e,t)=>{var i=-1!==e.indexOf("safari-extension"),s=-1!==e.indexOf("safari-web-extension");return i||s?[-1!==e.indexOf("@")?e.split("@")[0]:pt,i?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},_t=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,ft=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,mt=/\((\S*)(?::(\d+))(?::(\d+))\)/,yt=(e,t)=>{var i=_t.exec(e);if(i){var[,s,r,n]=i;return vt(t,s,pt,+r,+n)}var o=ft.exec(e);if(o){if(o[2]&&0===o[2].indexOf("eval")){var a=mt.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,u]=gt(o[1]||pt,o[2]);return vt(t,u,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},bt=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,wt=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,xt=(e,t)=>{var i=bt.exec(e);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var s=wt.exec(i[3]);s&&(i[1]=i[1]||"eval",i[3]=s[1],i[4]=s[2],i[5]="")}var r=i[3],n=i[1]||pt;return[n,r]=gt(n,r),vt(t,r,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},Et=/\(error: (.*)\)/,kt=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var i=X(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:i?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?t+": "+e.message:t}isDOMException(e){return ne(e,"DOMException")}isDOMError(e){return ne(e,"DOMError")}},St=class{match(e){return e instanceof Error}coerce(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var i=e.message;return String(i.error&&"string"==typeof i.error.message?i.error.message:i)}getStack(e){return e.stacktrace||e.stack||void 0}},Pt=class{constructor(){}match(e){return ne(e,"ErrorEvent")&&null!=e.error}coerce(e,t){var i;return t.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}},Rt=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Ft=class{match(e){return"string"==typeof e}coerce(e,t){var i,[s,r]=this.getInfos(e);return{type:null!=s?s:"Error",value:null!=r?r:e,stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}getInfos(e){var t="Error",i=e,s=e.match(Rt);return s&&(t=s[1],i=s[2]),[t,i]}},$t=["fatal","error","warning","log","info","debug"];function Ot(e,t){void 0===t&&(t=40);var i=Object.keys(e);if(i.sort(),!i.length)return"[object has no keys]";for(var s=i.length;s>0;s--){var r=i.slice(0,s).join(", ");if(t>=r.length)return s===i.length?r:r.length>t?r.slice(0,t)+"...":r}return""}var Ct=class{match(e){return"object"==typeof e&&null!==e}coerce(e,t){var i,s=this.getErrorPropertyFromObject(e);return s?t.apply(s):{type:this.getType(e),value:this.getValue(e),stack:null==(i=t.syntheticException)?void 0:i.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return oe(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&"string"==typeof e.name){var t="'"+e.name+"' captured as exception";return"message"in e&&"string"==typeof e.message&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&"string"==typeof e.message)return e.message;var i=this.getObjectClassName(e);return(i&&"Object"!==i?"'"+i+"'":"Object")+" captured as exception with keys: "+Ot(e)}isSeverityLevel(e){return X(e)&&!J(e)&&$t.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if({}.hasOwnProperty.call(e,t)){var i=e[t];if(ct(i))return i}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}},Tt=class{match(e){return oe(e)}coerce(e,t){var i,s=e.constructor.name;return{type:s,value:s+" captured as exception with keys: "+Ot(e),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}},It=class{match(e){return re(e)}coerce(e,t){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}},Mt=class{match(e){return ne(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!oe(e))return!1;try{var t=e.detail;return null!=t&&"object"==typeof t&&"reason"in t}catch(e){return!1}}coerce(e,t){var i,s=this.getUnhandledRejectionReason(e);return re(s)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(s),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}:t.apply(s)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&null!=e.detail&&"object"==typeof e.detail&&"reason"in e.detail)return e.detail.reason}catch(e){}return e}},At=function(e,t){var{debugEnabled:i}=void 0===t?{}:t,s={C(t){if(m&&(O.DEBUG||F.POSTHOG_DEBUG||i)&&!Y(m.console)&&m.console){for(var s=("__rrweb_original__"in m.console[t]?m.console[t].__rrweb_original__:m.console[t]),r=arguments.length,n=new Array(r>1?r-1:0),o=1;r>o;o++)n[o-1]=arguments[o];s(e,...n)}},info(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s.C("log",...t)},warn(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s.C("warn",...t)},error(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s.C("error",...t)},critical(){for(var t=arguments.length,i=new Array(t),s=0;t>s;s++)i[s]=arguments[s];console.error(e,...i)},uninitializedWarning(e){s.error("You must initialize PostHog before calling "+e)},createLogger:(t,i)=>At(e+" "+t,i)};return s},Lt=At("[PostHog.js]"),Dt=Lt.createLogger,jt=Dt("[ExternalScriptsLoader]"),Nt=(e,t,i)=>{if(e.config.disable_external_dependency_loading)return jt.warn(t+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var s=null==w?void 0:w.querySelectorAll("script");if(s)for(var r,n=function(){if(s[o].src===t){var e=s[o];return e.__posthog_loading_callback_fired?{v:i()}:(e.addEventListener("load",t=>{e.__posthog_loading_callback_fired=!0,i(void 0,t)}),e.onerror=e=>i(e),{v:void 0})}},o=0;s.length>o;o++)if(r=n())return r.v;var a=()=>{if(!w)return i("document not found");var s=w.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=t,s.onload=e=>{s.__posthog_loading_callback_fired=!0,i(void 0,e)},s.onerror=e=>i(e),e.config.prepare_external_dependency_script&&(s=e.config.prepare_external_dependency_script(s)),!s)return i("prepare_external_dependency_script returned null");if("head"===e.config.external_scripts_inject_target)w.head.appendChild(s);else{var r,n=w.querySelectorAll("body > script");n.length>0?null==(r=n[0].parentNode)||r.insertBefore(s,n[0]):w.body.appendChild(s)}};null!=w&&w.body?a():null==w||w.addEventListener("DOMContentLoaded",a)};F.__PosthogExtensions__=F.__PosthogExtensions__||{},F.__PosthogExtensions__.loadExternalDependency=(e,t,i)=>{if("remote-config"!==t)if(e._resolvedSdkVersion){var s=e.requestRouter.endpointFor("assets","/static/"+e._resolvedSdkVersion+"/"+t+".js");Nt(e,s,i)}else{var r="/static/"+t+".js?v="+e.version;if("toolbar"===t){var n=3e5;r=r+"&t="+Math.floor(Date.now()/n)*n}var o=e.requestRouter.endpointFor("assets",r);Nt(e,o,i)}else{var a=e.requestRouter.endpointFor("assets","/array/"+e.config.token+"/config.js");Nt(e,a,i)}},F.__PosthogExtensions__.loadSiteApp=(e,t,i)=>{var s=e.requestRouter.endpointFor("api",t);Nt(e,s,i)};var qt="$people_distinct_id",Wt="$device_id",Ht="__alias",Ut="__timers",zt="$autocapture_disabled_server_side",Bt="$heatmaps_enabled_server_side",Gt="$exception_capture_enabled_server_side",Vt="$error_tracking_suppression_rules",Kt="$error_tracking_capture_extension_exceptions",Yt="$web_vitals_enabled_server_side",Xt="$dead_clicks_enabled_server_side",Jt="$product_tours_enabled_server_side",Zt="$web_vitals_allowed_metrics",Qt="$session_recording_remote_config",ei="$sesid",ti="$session_is_sampled",ii="$enabled_feature_flags",si="$early_access_features",ri="$feature_flag_details",ni="$stored_person_properties",oi="$stored_group_properties",ai="$surveys",li="$flag_call_reported",ui="$flag_call_reported_session_id",ci="$feature_flag_errors",hi="$feature_flag_evaluated_at",di="$user_state",pi="$client_session_props",vi="$capture_rate_limit",gi="$initial_campaign_params",_i="$initial_referrer_info",fi="$initial_person_info",mi="$epp",yi="__POSTHOG_TOOLBAR__",bi="$posthog_cookieless",wi=[qt,Ht,"__cmpns",Ut,"$session_recording_enabled_server_side",Bt,ei,ii,Vt,di,si,ri,oi,ni,ai,li,ui,ci,hi,pi,vi,gi,_i,mi,fi],xi="PostHog loadExternalDependency extension not found.",Ei="on_reject",ki="always",Si="anonymous",Pi="identified",Ri="identified_only",Fi="visibilitychange",$i="beforeunload",Oi="$pageview",Ci="$pageleave",Ti="$identify",Ii="$groupidentify";function Mi(e,t){B(e)&&e.forEach(t)}function Ai(e,t){if(!Q(e))if(B(e))e.forEach(t);else if((e=>e instanceof FormData)(e))e.forEach((e,i)=>t(e,i));else for(var i in e)U.call(e,i)&&t(e[i],i)}var Li=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;t>s;s++)i[s-1]=arguments[s];for(var r of i)for(var n in r)void 0!==r[n]&&(e[n]=r[n]);return e};function Di(e){for(var t=Object.keys(e),i=t.length,s=new Array(i);i--;)s[i]=[t[i],e[t[i]]];return s}var ji=function(e){try{return e()}catch(e){return}},Ni=function(e){return function(){try{for(var t=arguments.length,i=new Array(t),s=0;t>s;s++)i[s]=arguments[s];return e.apply(this,i)}catch(e){Lt.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Lt.critical(e)}}},qi=function(e){var t={};return Ai(e,function(e,i){(X(e)&&e.length>0||ee(e))&&(t[i]=e)}),t},Wi=["herokuapp.com","vercel.app","netlify.app"];function Hi(e){var t=null==e?void 0:e.hostname;if(!X(t))return!1;var i=t.split(".").slice(-2).join(".");for(var s of Wi)if(i===s)return!1;return!0}function Ui(e,t,i,s){var{capture:r=!1,passive:n=!0}=null!=s?s:{};null==e||e.addEventListener(t,i,{capture:r,passive:n})}function zi(e){return"ph_toolbar_internal"===e.name}Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return ee(e)&&isFinite(e)&&Math.floor(e)===e});var Bi,Gi=class e{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,i,s,r){if(!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||!Number.isInteger(r)||0>t||0>i||0>s||0>r||t>0xffffffffffff||i>4095||s>1073741823||r>4294967295)throw new RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=t/Math.pow(2,40),n[1]=t/Math.pow(2,32),n[2]=t/Math.pow(2,24),n[3]=t/Math.pow(2,16),n[4]=t/Math.pow(2,8),n[5]=t,n[6]=112|i>>>8,n[7]=i,n[8]=128|s>>>24,n[9]=s>>>16,n[10]=s>>>8,n[11]=s,n[12]=r>>>24,n[13]=r>>>16,n[14]=r>>>8,n[15]=r,new e(n)}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),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new e(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(var t=0;16>t;t++){var i=this.bytes[t]-e.bytes[t];if(0!==i)return Math.sign(i)}return 0}},Vi=class{constructor(){this.I=0,this.S=0,this.k=new Yi}generate(){var e=this.generateOrAbort();if(Y(e)){this.I=0;var t=this.generateOrAbort();if(Y(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this.I)this.I=e,this.A();else{if(this.I>=e+1e4)return;this.S++,this.S>4398046511103&&(this.I++,this.A())}return Gi.fromFieldsV7(this.I,Math.trunc(this.S/Math.pow(2,30)),this.S&Math.pow(2,30)-1,this.k.nextUint32())}A(){this.S=1024*this.k.nextUint32()+(1023&this.k.nextUint32())}},Ki=e=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new 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};m&&!Y(m.crypto)&&crypto.getRandomValues&&(Ki=e=>crypto.getRandomValues(e));var Yi=class{constructor(){this.T=new Uint32Array(8),this.N=1/0}nextUint32(){return this.T.length>this.N||(Ki(this.T),this.N=0),this.T[this.N++]}},Xi=()=>Ji().toString(),Ji=()=>(Bi||(Bi=new Vi)).generate(),Zi="",Qi=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,es={Yt:()=>!!w,Ut(e){Lt.error("cookieStore error: "+e)},Wt(e){if(w){try{for(var t=e+"=",i=w.cookie.split(";").filter(e=>e.length),s=0;i.length>s;s++){for(var r=i[s];" "==r.charAt(0);)r=r.substring(1,r.length);if(0===r.indexOf(t))return decodeURIComponent(r.substring(t.length,r.length))}}catch(e){}return null}},Gt(e){var t;try{t=JSON.parse(es.Wt(e))||{}}catch(e){}return t},Xt(e,t,i,s,r){if(w)try{var n="",o="",a=function(e,t){if(t){var i=function(e,t){if(void 0===t&&(t=w),Zi)return Zi;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var i=e.split("."),s=Math.min(i.length,8),r="dmn_chk_"+Xi();!Zi&&s--;){var n=i.slice(s).join("."),o=r+"=1;domain=."+n+";path=/";t.cookie=o+";max-age=3",t.cookie.includes(r)&&(t.cookie=o+";max-age=0",Zi=n)}return Zi}(e);if(!i){var s=(r=e.match(Qi))?r[0]:"";s!==i&&Lt.info("Warning: cookie subdomain discovery mismatch",s,i),i=s}return i?"; domain=."+i:""}var r;return""}(w.location.hostname,s);if(i){var l=new Date;l.setTime(l.getTime()+864e5*i),n="; expires="+l.toUTCString()}r&&(o="; secure");var u=e+"="+encodeURIComponent(JSON.stringify(t))+n+"; SameSite=Lax; path=/"+a+o;return u.length>3686.4&&Lt.warn("cookieStore warning: large cookie, len="+u.length),w.cookie=u,u}catch(e){return}},Jt(e,t){if(null!=w&&w.cookie)try{es.Xt(e,"",-1,t)}catch(e){return}}},ts=null,is={Yt(){if(!Z(ts))return ts;var e=!0;if(Y(m))e=!1;else try{var t="__mplssupport__";is.Xt(t,"xyz"),'"xyz"'!==is.Wt(t)&&(e=!1),is.Jt(t)}catch(t){e=!1}return e||Lt.error("localStorage unsupported; falling back to cookie store"),ts=e,e},Ut(e){Lt.error("localStorage error: "+e)},Wt(e){try{return null==m?void 0:m.localStorage.getItem(e)}catch(e){is.Ut(e)}return null},Gt(e){try{return JSON.parse(is.Wt(e))||{}}catch(e){}return null},Xt(e,t){try{null==m||m.localStorage.setItem(e,JSON.stringify(t))}catch(e){is.Ut(e)}},Jt(e){try{null==m||m.localStorage.removeItem(e)}catch(e){is.Ut(e)}}},ss=[Wt,"distinct_id",ei,ti,mi,fi,di],rs={},ns={Yt:()=>!0,Ut(e){Lt.error("memoryStorage error: "+e)},Wt:e=>rs[e]||null,Gt:e=>rs[e]||null,Xt(e,t){rs[e]=t},Jt(e){delete rs[e]}},os=null,as={Yt(){if(!Z(os))return os;if(os=!0,Y(m))os=!1;else try{var e="__support__";as.Xt(e,"xyz"),'"xyz"'!==as.Wt(e)&&(os=!1),as.Jt(e)}catch(e){os=!1}return os},Ut(e){Lt.error("sessionStorage error: ",e)},Wt(e){try{return null==m?void 0:m.sessionStorage.getItem(e)}catch(e){as.Ut(e)}return null},Gt(e){try{return JSON.parse(as.Wt(e))||null}catch(e){}return null},Xt(e,t){try{null==m||m.sessionStorage.setItem(e,JSON.stringify(t))}catch(e){as.Ut(e)}},Jt(e){try{null==m||m.sessionStorage.removeItem(e)}catch(e){as.Ut(e)}}},ls=class{constructor(e){this._instance=e}get Rt(){return this._instance.config}get consent(){return this.Kt()?0:this.Qt}isOptedOut(){return this.Rt.cookieless_mode===ki||0===this.consent||-1===this.consent&&(this.Rt.opt_out_capturing_by_default||this.Rt.cookieless_mode===Ei)}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}optInOut(e){this.tr.Xt(this.er,e?1:0,this.Rt.cookie_expiration,this.Rt.cross_subdomain_cookie,this.Rt.secure_cookie)}reset(){this.tr.Jt(this.er,this.Rt.cross_subdomain_cookie)}get er(){var{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:i}=this._instance.config;return i||(t?t+e:"__ph_opt_in_out_"+e)}get Qt(){var e=this.tr.Wt(this.er);return le(e)?1:N(ue,e)?0:-1}get tr(){var e=this.Rt.opt_out_capturing_persistence_type,t="localStorage"===e?is:es;if(!this.rr||this.rr!==t){this.rr=t;var i="localStorage"===e?es:is;i.Wt(this.er)&&(this.rr.Wt(this.er)||this.optInOut(le(i.Wt(this.er))),i.Jt(this.er,this.Rt.cross_subdomain_cookie))}return this.rr}Kt(){return!!this.Rt.respect_dnt&&[null==b?void 0:b.doNotTrack,null==b?void 0:b.msDoNotTrack,F.doNotTrack].some(e=>le(e))}},us=Dt("[Dead Clicks]"),cs=()=>!0,hs=e=>{var t,i=!(null==(t=e.instance.persistence)||!t.get_property(Xt)),s=e.instance.config.capture_dead_clicks;return ie(s)?s:!!V(s)||i},ds=class{get lazyLoadedDeadClicksAutocapture(){return this.ir}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(e){"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[Xt]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.nr(()=>{this.sr()}):this.stop()}nr(e){var t,i;null!=(t=F.__PosthogExtensions__)&&t.initDeadClicksAutocapture&&e(),null==(i=F.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",t=>{t?us.error("failed to load script",t):e()})}sr(){var e;if(w){if(!this.ir&&null!=(e=F.__PosthogExtensions__)&&e.initDeadClicksAutocapture){var t=V(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.ir=F.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.ir.start(w),us.info("starting...")}}else us.error("`document` not found. Cannot start.")}stop(){this.ir&&(this.ir.stop(),this.ir=void 0,us.info("stopping..."))}},ps=Dt("[SegmentIntegration]"),vs="posthog-js";function gs(e,t){var{organization:i,projectId:s,prefix:r,severityAllowList:n=["error"],sendExceptionsToPostHog:o=!0}=void 0===t?{}:t;return t=>{var a,l,u,c,h;if("*"!==n&&!n.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var d=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());t.tags["PostHog Person URL"]=d,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var p,v=(null==(a=t.exception)?void 0:a.values)||[],g=v.map(e=>I({},e,{stacktrace:e.stacktrace?I({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map(e=>I({},e,{platform:"web:javascript"}))}):void 0})),_={$exception_message:(null==(l=v[0])?void 0:l.value)||t.message,$exception_type:null==(u=v[0])?void 0:u.type,$exception_level:t.level,$exception_list:g,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(c=v[0])?void 0:c.value)||t.message,$sentry_exception_type:null==(h=v[0])?void 0:h.type,$sentry_tags:t.tags};return i&&s&&(_.$sentry_url=(r||"https://sentry.io/organizations/")+i+"/issues/?project="+s+"&query="+t.event_id),o&&(null==(p=e.exceptions)||p.sendExceptionEvent(_)),t}}var _s=class{constructor(e,t,i,s,r,n){this.name=vs,this.setupOnce=function(o){o(gs(e,{organization:t,projectId:i,prefix:s,severityAllowList:r,sendExceptionsToPostHog:null==n||n}))}}},fs=class{constructor(e){this.ar=(e,t,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength)&&(Lt.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:i}),this.lr=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.ur()}ur(){var e;this.hr=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(this.ar)}destroy(){var e;null==(e=this.hr)||e.call(this),this.hr=void 0}doPageView(e,t){var i,s=this.cr(e,t);return this.lr={pathname:null!==(i=null==m?void 0:m.location.pathname)&&void 0!==i?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var t;return this.cr(e,null==(t=this.lr)?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null==(e=this.lr)?void 0:e.pageViewId}}cr(e,t){var i=this.lr;if(!i)return{$pageview_id:t};var s={$pageview_id:t,$prev_pageview_id:i.pageViewId},r=this._instance.scrollManager.getContext();if(r&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:u,maxContentY:c}=r;if(!(Y(n)||Y(o)||Y(a)||Y(l)||Y(u)||Y(c))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),c=Math.ceil(c);var h=n>1?ce(o/n,0,1,Lt):1,d=n>1?ce(a/n,0,1,Lt):1,p=l>1?ce(u/l,0,1,Lt):1,v=l>1?ce(c/l,0,1,Lt):1;s=Li(s,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:h,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:d,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:c,$prev_pageview_max_content_percentage:v})}}return i.pathname&&(s.$prev_pageview_pathname=i.pathname),i.timestamp&&(s.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),s}},ms=e=>{var t=null==w?void 0:w.createElement("a");return Y(t)?null:(t.href=e,t)},ys=function(e,t){for(var i,s=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;s.length>r;r++){var n=s[r].split("=");if(n[0]===t){i=n;break}}if(!B(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(e){Lt.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},bs=function(e,t,i){if(!e||!t||!t.length)return e;for(var s=e.split("#"),r=s[1],n=(s[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),u=[],c=0;l.length>c;c++){var h=l[c].split("=");B(h)&&(t.includes(h[0])?u.push(h[0]+"="+i):u.push(l[c]))}var d=a;return null!=o&&(d+="?"+u.join("&")),null!=r&&(d+="#"+r),d},ws=function(e,t){var i=e.match(new RegExp(t+"=([^&]*)"));return i?i[1]:null},xs="https?://(.*)",Es=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],ks=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Es],Ss="<masked>",Ps=["li_fat_id"];function Rs(e,t,i){if(!w)return{};var s,r=t?[...Es,...i||[]]:[],n=Fs(bs(w.URL,r,Ss),e),o=(s={},Ai(Ps,function(e){var t=es.Wt(e);s[e]=t||null}),s);return Li(o,n)}function Fs(e,t){var i=ks.concat(t||[]),s={};return Ai(i,function(t){var i=ys(e,t);s[t]=i||null}),s}function $s(e){var t,i=(t=e)?0===t.search(xs+"google.([^/?]*)")?"google":0===t.search(xs+"bing.com")?"bing":0===t.search(xs+"yahoo.com")?"yahoo":0===t.search(xs+"duckduckgo.com")?"duckduckgo":null:null,s="yahoo"!=i?"q":"p",r={};if(!Z(i)){r.$search_engine=i;var n=w?ys(w.referrer,s):"";n.length&&(r.ph_keyword=n)}return r}function Os(){return navigator.language||navigator.userLanguage}var Cs="$direct";function Ts(){return(null==w?void 0:w.referrer)||Cs}function Is(e,t){var i=e?[...Es,...t||[]]:[],s=null==x?void 0:x.href.substring(0,1e3);return{r:Ts().substring(0,1e3),u:s?bs(s,i,Ss):void 0}}function Ms(e){var t,{r:i,u:s}=e,r={$referrer:i,$referring_domain:null==i?void 0:i==Cs?Cs:null==(t=ms(i))?void 0:t.host};if(s){r.$current_url=s;var n=ms(s);r.$host=null==n?void 0:n.host,r.$pathname=null==n?void 0:n.pathname;var o=Fs(s);Li(r,o)}if(i){var a=$s(i);Li(r,a)}return r}function As(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function Ls(){try{return(new Date).getTimezoneOffset()}catch(e){return}}var Ds,js,Ns,qs,Ws=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Hs=class{constructor(e,t){var i,s;this.Rt=e,this.props={},this.dr=!1,this.vr=(s="",(i=e).token&&(s=i.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),i.persistence_name?"ph_"+i.persistence_name:"ph_"+s+"_posthog"),this.tr=this.pr(e),this.load(),e.debug&&Lt.info("Persistence loaded",e.persistence,I({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this.gr}pr(e){-1===Ws.indexOf(e.persistence.toLowerCase())&&(Lt.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=function(e){void 0===e&&(e=[]);var t=[...ss,...e];return I({},is,{Gt(e){try{var t={};try{t=es.Gt(e)||{}}catch(e){}var i=Li(t,JSON.parse(is.Wt(e)||"{}"));return is.Xt(e,i),i}catch(e){}return null},Xt(e,i,s,r,n,o){try{is.Xt(e,i,void 0,void 0,o);var a={};t.forEach(e=>{i[e]&&(a[e]=i[e])}),Object.keys(a).length&&es.Xt(e,a,s,r,n,o)}catch(e){is.Ut(e)}},Jt(e,t){try{null==m||m.localStorage.removeItem(e),es.Jt(e,t)}catch(e){is.Ut(e)}}})}(e.cookie_persisted_properties||[]),i=e.persistence.toLowerCase();return"localstorage"===i&&is.Yt()?is:"localstorage+cookie"===i&&t.Yt()?t:"sessionstorage"===i&&as.Yt()?as:"memory"===i?ns:"cookie"===i?es:t.Yt()?t:es}mr(e){var t=null!=e?e:this.Rt.feature_flag_cache_ttl_ms;if(!t||0>=t)return!1;var i=this.props[hi];return!i||"number"!=typeof i||Date.now()-i>t}properties(){var e={};return Ai(this.props,(t,i)=>{if(i===ii&&V(t)){if(!this.mr())for(var s=Object.keys(t),r=0;s.length>r;r++)e["$feature/"+s[r]]=t[s[r]]}else-1===wi.indexOf(i)&&(e[i]=t)}),e}load(){if(!this.gr){var e=this.tr.Gt(this.vr);e&&(this.props=Li({},e))}}save(){this.gr||this.tr.Xt(this.vr,this.props,this.yr,this.br,this.wr,this.Rt.debug)}remove(){this.tr.Jt(this.vr,!1),this.tr.Jt(this.vr,!0)}clear(){this.remove(),this.props={}}register_once(e,t,i){if(V(e)){Y(t)&&(t="None"),this.yr=Y(i)?this._r:i;var s=!1;if(Ai(e,(e,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==t||(this.props[i]=e,s=!0)}),s)return this.save(),!0}return!1}register(e,t){if(V(e)){this.yr=Y(t)?this._r:t;var i=!1;if(Ai(e,(t,s)=>{e.hasOwnProperty(s)&&this.props[s]!==t&&(this.props[s]=t,i=!0)}),i)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.dr){var e=Rs(this.Rt.custom_campaign_params,this.Rt.mask_personal_data_properties,this.Rt.custom_personal_data_properties);K(qi(e))||this.register(e),this.dr=!0}}update_search_keyword(){var e;this.register((e=null==w?void 0:w.referrer)?$s(e):{})}update_referrer_info(){var e;this.register_once({$referrer:Ts(),$referring_domain:null!=w&&w.referrer&&(null==(e=ms(w.referrer))?void 0:e.host)||Cs},void 0)}set_initial_person_info(){this.props[gi]||this.props[_i]||this.register_once({[fi]:Is(this.Rt.mask_personal_data_properties,this.Rt.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};Ai([_i,gi],t=>{var i=this.props[t];i&&Ai(i,function(t,i){e["$initial_"+W(i)]=t})});var t,i,s=this.props[fi];if(s){var r=(t=Ms(s),i={},Ai(t,function(e,t){i["$initial_"+W(t)]=e}),i);Li(e,r)}return e}safe_merge(e){return Ai(this.props,function(t,i){i in e||(e[i]=t)}),e}update_config(e,t,i){if(this._r=this.yr=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!i),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence||!((e,t)=>{if(e.length!==t.length)return!1;var i=[...e].sort(),s=[...t].sort();return i.every((e,t)=>e===s[t])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[])){var s=this.pr(e),r=this.props;this.clear(),this.tr=s,this.props=r,this.save()}}set_disabled(e){this.gr=e,this.gr?this.remove():this.save()}set_cross_subdomain(e){e!==this.br&&(this.br=e,this.remove(),this.save())}set_secure(e){e!==this.wr&&(this.wr=e,this.remove(),this.save())}set_event_timer(e,t){var i=this.props[Ut]||{};i[e]=t,this.props[Ut]=i,this.save()}remove_event_timer(e){var t=(this.props[Ut]||{})[e];return Y(t)||(delete this.props[Ut][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}},Us="events",zs="cancelEvents",Bs="popover",Gs="api",Vs="widget",Ks="survey shown",Ys="survey dismissed",Xs="survey sent",Js="$survey_id",Zs="$survey_iteration",Qs="$survey_last_seen_date",er="popover",tr="inline",ir="product tour shown",sr="$product_tour_last_seen_date",rr="$product_tour_type",nr=Dt("[RateLimiter]"),or=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=>{nr.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4})}catch(e){return void nr.warn('could not rate limit - continuing. Error: "'+(null==e?void 0:e.message)+'"',{text:t})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return(null==(e=this.instance.config.rate_limiting)?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max((null==(e=this.instance.config.rate_limiting)?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var t,i,s;void 0===e&&(e=!1);var{captureEventsBurstLimit:r,captureEventsPerSecond:n}=this,o=(new Date).getTime(),a=null!==(t=null==(i=this.instance.persistence)?void 0:i.get_property(vi))&&void 0!==t?t:{tokens:r,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>r&&(a.tokens=r);var l=1>a.tokens;return l||e||(a.tokens=Math.max(0,a.tokens-1)),!l||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+n+" events per second and "+r+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,null==(s=this.instance.persistence)||s.set_property(vi,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}},ar=Dt("[RemoteConfig]"),lr=class{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=F._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}Ir(e){var t,i;null!=(t=F.__PosthogExtensions__)&&t.loadExternalDependency?null==(i=F.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",()=>e(this.remoteConfig)):e()}Cr(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 ar.info("Using preloaded remote config",this.remoteConfig),this.Sr(this.remoteConfig),void this.kr();if(this._instance.Tr())return void ar.warn("Remote config is disabled. Falling back to local config.");this.Ir(e=>{if(!e)return ar.info("No config found after loading remote JS config. Falling back to JSON."),void this.Cr(e=>{this.Sr(e),this.kr()});this.Sr(e),this.kr()})}catch(e){ar.error("Error loading remote config",e)}}stop(){this.Ar&&(clearInterval(this.Ar),this.Ar=void 0)}refresh(){this._instance.Tr()||"hidden"===(null==w?void 0:w.visibilityState)||this._instance.reloadFeatureFlags()}kr(){var e;if(!this.Ar){var t=null!==(e=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==e?e:3e5;0!==t&&(this.Ar=setInterval(()=>{this.refresh()},t))}}Sr(e){var t;e||ar.error("Failed to fetch remote config from PostHog."),this._instance.Sr(null!=e?e:{}),!1!==(null==e?void 0:e.hasFeatureFlags)&&(this._instance.config.advanced_disable_feature_flags_on_first_load||null==(t=this._instance.featureFlags)||t.ensureFlagsLoaded())}},ur="gzip-js",cr="base64",hr=Uint8Array,dr=Uint16Array,pr=Uint32Array,vr=new hr([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 hr([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]),_r=new hr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),fr=function(e,t){for(var i=new dr(31),s=0;31>s;++s)i[s]=t+=1<<e[s-1];var r=new pr(i[30]);for(s=1;30>s;++s)for(var n=i[s];i[s+1]>n;++n)r[n]=n-i[s]<<5|s;return[i,r]},mr=fr(vr,2),yr=mr[1];for(mr[0][28]=258,yr[258]=28,js=fr(gr,0)[1],Ns=new dr(32768),qs=0;32768>qs;++qs)Ds=(43690&qs)>>>1|(21845&qs)<<1,Ns[qs]=((65280&(Ds=(61680&(Ds=(52428&Ds)>>>2|(13107&Ds)<<2))>>>4|(3855&Ds)<<4))>>>8|(255&Ds)<<8)>>>1;var br=function(e,t,i){for(var s=e.length,r=0,n=new dr(t);s>r;++r)++n[e[r]-1];var o,a=new dr(t);for(r=0;t>r;++r)a[r]=a[r-1]+n[r-1]<<1;if(i){o=new dr(1<<t);var l=15-t;for(r=0;s>r;++r)if(e[r])for(var u=r<<4|e[r],c=t-e[r],h=a[e[r]-1]++<<c,d=h|(1<<c)-1;d>=h;++h)o[Ns[h]>>>l]=u}else for(o=new dr(s),r=0;s>r;++r)o[r]=Ns[a[e[r]-1]++]>>>15-e[r];return o},wr=new hr(288);for(qs=0;144>qs;++qs)wr[qs]=8;for(qs=144;256>qs;++qs)wr[qs]=9;for(qs=256;280>qs;++qs)wr[qs]=7;for(qs=280;288>qs;++qs)wr[qs]=8;var xr=new hr(32);for(qs=0;32>qs;++qs)xr[qs]=5;var Er=br(wr,9,0),kr=br(xr,5,0),Sr=function(e){return(e/8|0)+(7&e&&1)},Pr=function(e,t,i){(null==i||i>e.length)&&(i=e.length);var s=new(e instanceof dr?dr:e instanceof pr?pr:hr)(i-t);return s.set(e.subarray(t,i)),s},Rr=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8},Fr=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8,e[s+2]|=i>>>16},$r=function(e,t){for(var i=[],s=0;e.length>s;++s)e[s]&&i.push({s:s,f:e[s]});var r=i.length,n=i.slice();if(!r)return[new hr(0),0];if(1==r){var o=new hr(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort(function(e,t){return e.f-t.f}),i.push({s:-1,f:25001});var a=i[0],l=i[1],u=0,c=1,h=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=r-1;)a=i[i[h].f>i[u].f?u++:h++],l=i[u!=c&&i[h].f>i[u].f?u++:h++],i[c++]={s:-1,f:a.f+l.f,l:a,r:l};var d=n[0].s;for(s=1;r>s;++s)n[s].s>d&&(d=n[s].s);var p=new dr(d+1),v=Or(i[c-1],p,0);if(v>t){s=0;var g=0,_=v-t,f=1<<_;for(n.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});r>s;++s){var m=n[s].s;if(t>=p[m])break;g+=f-(1<<v-p[m]),p[m]=t}for(g>>>=_;g>0;){var y=n[s].s;t>p[y]?g-=1<<t-p[y]++-1:++s}for(;s>=0&&g;--s){var b=n[s].s;p[b]==t&&(--p[b],++g)}v=t}return[new hr(p),v]},Or=function(e,t,i){return-1==e.s?Math.max(Or(e.l,t,i+1),Or(e.r,t,i+1)):t[e.s]=i},Cr=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new dr(++t),s=0,r=e[0],n=1,o=function(e){i[s++]=e},a=1;t>=a;++a)if(e[a]==r&&a!=t)++n;else{if(!r&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(r),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(r);n=1,r=e[a]}return[i.subarray(0,s),t]},Tr=function(e,t){for(var i=0,s=0;t.length>s;++s)i+=e[s]*t[s];return i},Ir=function(e,t,i){var s=i.length,r=Sr(t+2);e[r]=255&s,e[r+1]=s>>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var n=0;s>n;++n)e[r+n+4]=i[n];return 8*(r+4+s)},Mr=function(e,t,i,s,r,n,o,a,l,u,c){Rr(t,c++,i),++r[256];for(var h=$r(r,15),d=h[0],p=h[1],v=$r(n,15),g=v[0],_=v[1],f=Cr(d),m=f[0],y=f[1],b=Cr(g),w=b[0],x=b[1],E=new dr(19),k=0;m.length>k;++k)E[31&m[k]]++;for(k=0;w.length>k;++k)E[31&w[k]]++;for(var S=$r(E,7),P=S[0],R=S[1],F=19;F>4&&!P[_r[F-1]];--F);var $,O,C,T,I=u+5<<3,M=Tr(r,wr)+Tr(n,xr)+o,A=Tr(r,d)+Tr(n,g)+o+14+3*F+Tr(E,P)+(2*E[16]+3*E[17]+7*E[18]);if(M>=I&&A>=I)return Ir(t,c,e.subarray(l,l+u));if(Rr(t,c,1+(M>A)),c+=2,M>A){$=br(d,p,0),O=d,C=br(g,_,0),T=g;var L=br(P,R,0);for(Rr(t,c,y-257),Rr(t,c+5,x-1),Rr(t,c+10,F-4),c+=14,k=0;F>k;++k)Rr(t,c+3*k,P[_r[k]]);c+=3*F;for(var D=[m,w],j=0;2>j;++j){var N=D[j];for(k=0;N.length>k;++k)Rr(t,c,L[q=31&N[k]]),c+=P[q],q>15&&(Rr(t,c,N[k]>>>5&127),c+=N[k]>>>12)}}else $=Er,O=wr,C=kr,T=xr;for(k=0;a>k;++k)if(s[k]>255){var q;Fr(t,c,$[257+(q=s[k]>>>18&31)]),c+=O[q+257],q>7&&(Rr(t,c,s[k]>>>23&31),c+=vr[q]);var W=31&s[k];Fr(t,c,C[W]),c+=T[W],W>3&&(Fr(t,c,s[k]>>>5&8191),c+=gr[W])}else Fr(t,c,$[s[k]]),c+=O[s[k]];return Fr(t,c,$[256]),c+O[256]},Ar=new pr([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Lr=function(){for(var e=new pr(256),t=0;256>t;++t){for(var i=t,s=9;--s;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e}(),Dr=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};var jr,Nr=!!k||!!E,qr="text/plain",Wr=function(e,t,i){var s;void 0===i&&(i=!0);var[r,n]=e.split("?"),o=I({},t),a=null!==(s=null==n?void 0:n.split("&").map(e=>{var t,[s,r]=e.split("="),n=i&&null!==(t=o[s])&&void 0!==t?t:r;return delete o[s],s+"="+n}))&&void 0!==s?s:[],l=function(e,t){var i,s;void 0===t&&(t="&");var r=[];return Ai(e,function(e,t){Y(e)||Y(t)||"undefined"===t||(i=encodeURIComponent(e instanceof File?e.name:e.toString()),s=encodeURIComponent(t),r[r.length]=s+"="+i)}),r.join(t)}(o);return l&&a.push(l),r+"?"+a.join("&")},Hr=(e,t)=>JSON.stringify(e,(e,t)=>"bigint"==typeof t?t.toString():t,t),Ur=e=>{if(e.zt)return e.zt;var t,{data:i,compression:s}=e;if(i){if(s===ur){var r=function(e,t){void 0===t&&(t={});var i=function(){var e=4294967295;return{p(t){for(var i=e,s=0;t.length>s;++s)i=Lr[255&i^t[s]]^i>>>8;e=i},d:()=>4294967295^e}}(),s=e.length;i.p(e);var r,n,o,a,l=(a=10+((r=t).filename&&r.filename.length+1||0),function(e,t,i,s){var r=e.length,n=new hr(s+r+5*(1+Math.floor(r/7e3))+8),o=n.subarray(s,n.length-8),a=0;if(!t||8>r)for(var l=0;r>=l;l+=65535){var u=l+65535;r>u?a=Ir(o,a,e.subarray(l,u)):(o[l]=!0,a=Ir(o,a,e.subarray(l,r)))}else{for(var c=Ar[t-1],h=c>>>13,d=8191&c,p=(1<<i)-1,v=new dr(32768),g=new dr(p+1),_=Math.ceil(i/3),f=2*_,m=function(t){return(e[t]^e[t+1]<<_^e[t+2]<<f)&p},y=new pr(25e3),b=new dr(288),w=new dr(32),x=0,E=0,k=(l=0,0),S=0,P=0;r>l;++l){var R=m(l),F=32767&l,$=g[R];if(v[F]=$,g[R]=F,l>=S){var O=r-l;if((x>7e3||k>24576)&&O>423){a=Mr(e,o,0,y,b,w,E,k,P,l-P,a),k=x=E=0,P=l;for(var C=0;286>C;++C)b[C]=0;for(C=0;30>C;++C)w[C]=0}var T=2,I=0,M=d,A=F-$&32767;if(O>2&&R==m(l-A))for(var L=Math.min(h,O)-1,D=Math.min(32767,l),j=Math.min(258,O);D>=A&&--M&&F!=$;){if(e[l+T]==e[l+T-A]){for(var N=0;j>N&&e[l+N]==e[l+N-A];++N);if(N>T){if(T=N,I=A,N>L)break;var q=Math.min(A,N-2),W=0;for(C=0;q>C;++C){var H=l-A+C+32768&32767,U=H-v[H]+32768&32767;U>W&&(W=U,$=H)}}}A+=(F=$)-($=v[F])+32768&32767}if(I){y[k++]=268435456|yr[T]<<18|js[I];var z=31&yr[T],B=31&js[I];E+=vr[z]+gr[B],++b[257+z],++w[B],S=l+T,++x}else y[k++]=e[l],++b[e[l]]}}a=Mr(e,o,!0,y,b,w,E,k,P,l-P,a)}return Pr(n,0,s+Sr(a)+8)}(n=e,null==(o=t).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+o.mem,a)),u=l.length;return function(e,t){var i=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=2>t.level?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&Dr(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var s=0;i.length>=s;++s)e[s+10]=i.charCodeAt(s)}}(l,t),Dr(l,u-8,i.d()),Dr(l,u-4,s),l}(function(e){var t=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var i=new hr(e.length+(e.length>>>1)),s=0,r=function(e){i[s++]=e},n=0;t>n;++n){if(s+5>i.length){var o=new hr(s+8+(t-n<<1));o.set(i),i=o}var a=e.charCodeAt(n);128>a?r(a):2048>a?(r(192|a>>>6),r(128|63&a)):a>55295&&57344>a?(r(240|(a=65536+(1047552&a)|1023&e.charCodeAt(++n))>>>18),r(128|a>>>12&63),r(128|a>>>6&63),r(128|63&a)):(r(224|a>>>12),r(128|a>>>6&63),r(128|63&a))}return Pr(i,0,s)}(Hr(i)),{mtime:0});return{contentType:qr,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(s===cr){var n=(e=>"data="+encodeURIComponent("string"==typeof e?e:Hr(e)))((t=Hr(i))?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16)))):t);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=Hr(i);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},zr=(jr=T(function*(e){var t=Hr(e.data),i=yield function(e,t){return A.apply(this,arguments)}(t,O.DEBUG);if(!i)return e;var s=yield i.arrayBuffer();return I({},e,{zt:{contentType:qr,body:s,estimatedSize:s.byteLength}})}),function(e){return jr.apply(this,arguments)}),Br=[];E&&Br.push({transport:"fetch",method(e){var t,i,{contentType:s,body:r,estimatedSize:n}=null!==(t=Ur(e))&&void 0!==t?t:{},o=new Headers;Ai(e.headers,function(e,t){o.append(t,e)}),s&&o.append("Content-Type",s);var a=e.url,l=null;if(S){var u=new S;l={signal:u.signal,timeout:setTimeout(()=>u.abort(),e.timeout)}}E(a,I({method:(null==e?void 0:e.method)||"GET",headers:o,keepalive:"POST"===e.method&&52428.8>(n||0),body:r,signal:null==(i=l)?void 0:i.signal},e.fetchOptions)).then(t=>t.text().then(i=>{var s={statusCode:t.status,text:i};if(200===t.status)try{s.json=JSON.parse(i)}catch(e){Lt.error(e)}null==e.callback||e.callback(s)})).catch(t=>{Lt.error(t),null==e.callback||e.callback({statusCode:0,error:t})}).finally(()=>l?clearTimeout(l.timeout):null)}}),k&&Br.push({transport:"XHR",method(e){var t,i=new k;i.open(e.method||"GET",e.url,!0);var{contentType:s,body:r}=null!==(t=Ur(e))&&void 0!==t?t:{};Ai(e.headers,function(e,t){i.setRequestHeader(t,e)}),s&&i.setRequestHeader("Content-Type",s),e.timeout&&(i.timeout=e.timeout),e.disableXHRCredentials||(i.withCredentials=!0),i.onreadystatechange=()=>{if(4===i.readyState){var t={statusCode:i.status,text:i.responseText};if(200===i.status)try{t.json=JSON.parse(i.responseText)}catch(e){}null==e.callback||e.callback(t)}},i.send(r)}}),null!=b&&b.sendBeacon&&Br.push({transport:"sendBeacon",method(e){var t=Wr(e.url,{beacon:"1"});try{var i,{contentType:s,body:r}=null!==(i=Ur(e))&&void 0!==i?i:{};if(!r)return;var n=r instanceof Blob?r:new Blob([r],{type:s});b.sendBeacon(t,n)}catch(e){}}});var Gr=3e3,Vr=class{constructor(e,t){this.Er=!0,this.Rr=[],this.Nr=ce((null==t?void 0:t.flush_interval_ms)||Gr,250,5e3,Lt.createLogger("flush interval"),Gr),this.Mr=e}enqueue(e){this.Rr.push(e),this.Fr||this.Or()}unload(){this.Pr();var e=this.Rr.length>0?this.Lr():{},t=Object.values(e);[...t.filter(e=>0===e.url.indexOf("/e")),...t.filter(e=>0!==e.url.indexOf("/e"))].map(e=>{this.Mr(I({},e,{transport:"sendBeacon"}))})}enable(){this.Er=!1,this.Or()}Or(){var e=this;this.Er||(this.Fr=setTimeout(()=>{if(this.Pr(),this.Rr.length>0){var t=this.Lr(),i=function(){var i=t[s],r=(new Date).getTime();i.data&&B(i.data)&&Ai(i.data,e=>{e.offset=Math.abs(e.timestamp-r),delete e.timestamp}),e.Mr(i)};for(var s in t)i()}},this.Nr))}Pr(){clearTimeout(this.Fr),this.Fr=void 0}Lr(){var e={};return Ai(this.Rr,t=>{var i,s=t,r=(s?s.batchKey:null)||s.url;Y(e[r])&&(e[r]=I({},s,{data:[]})),null==(i=e[r].data)||i.push(s.data)}),this.Rr=[],e}},Kr=["retriesPerformedSoFar"],Yr=class{constructor(e){this.Dr=!1,this.Br=3e3,this.Rr=[],this._instance=e,this.Rr=[],this.jr=!0,!Y(m)&&"onLine"in m.navigator&&(this.jr=m.navigator.onLine,this.qr=()=>{this.jr=!0,this.Zr()},this.$r=()=>{this.jr=!1},Ui(m,"online",this.qr),Ui(m,"offline",this.$r))}get length(){return this.Rr.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,i=M(e,Kr);te(t)&&(i.url=Wr(i.url,{retry_count:t})),this._instance._send_request(I({},i,{callback:e=>{200===e.statusCode||e.statusCode>=400&&500>e.statusCode||(null!=t?t:0)>=10?null==i.callback||i.callback(e):this.Hr(I({retriesPerformedSoFar:t},i))}}))}Hr(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var i,s,r,n,o,a=(i=t,s=3e3*Math.pow(2,i),r=s/2,n=Math.min(18e5,s),o=Math.random()-.5,Math.ceil(n+o*(n-r))),l=Date.now()+a;this.Rr.push({retryAt:l,requestOptions:e});var u="Enqueued failed request for retry in "+a;navigator.onLine||(u+=" (Browser is offline)"),Lt.warn(u),this.Dr||(this.Dr=!0,this.Vr())}Vr(){if(this.zr&&clearTimeout(this.zr),0===this.Rr.length)return this.Dr=!1,void(this.zr=void 0);this.zr=setTimeout(()=>{this.jr&&this.Rr.length>0&&this.Zr(),this.Vr()},this.Br)}Zr(){var e=Date.now(),t=[],i=this.Rr.filter(i=>e>i.retryAt||(t.push(i),!1));if(this.Rr=t,i.length>0)for(var{requestOptions:s}of i)this.retriableRequest(s)}unload(){for(var{requestOptions:e}of(this.zr&&(clearTimeout(this.zr),this.zr=void 0),this.Dr=!1,Y(m)||(this.qr&&(m.removeEventListener("online",this.qr),this.qr=void 0),this.$r&&(m.removeEventListener("offline",this.$r),this.$r=void 0)),this.Rr))try{this._instance._send_request(I({},e,{transport:"sendBeacon"}))}catch(e){Lt.error(e)}this.Rr=[]}},Xr=class{constructor(e){this.Yr=()=>{var e,t,i,s;this.Ur||(this.Ur={});var r=this.scrollElement(),n=this.scrollY(),o=r?Math.max(0,r.scrollHeight-r.clientHeight):0,a=n+((null==r?void 0:r.clientHeight)||0),l=(null==r?void 0:r.scrollHeight)||0;this.Ur.lastScrollY=Math.ceil(n),this.Ur.maxScrollY=Math.max(n,null!==(e=this.Ur.maxScrollY)&&void 0!==e?e:0),this.Ur.maxScrollHeight=Math.max(o,null!==(t=this.Ur.maxScrollHeight)&&void 0!==t?t:0),this.Ur.lastContentY=a,this.Ur.maxContentY=Math.max(a,null!==(i=this.Ur.maxContentY)&&void 0!==i?i:0),this.Ur.maxContentHeight=Math.max(l,null!==(s=this.Ur.maxContentHeight)&&void 0!==s?s:0)},this._instance=e}get Wr(){return this._instance.config.scroll_root_selector}getContext(){return this.Ur}resetContext(){var e=this.Ur;return setTimeout(this.Yr,0),e}startMeasuringScrollPosition(){Ui(m,"scroll",this.Yr,{capture:!0}),Ui(m,"scrollend",this.Yr,{capture:!0}),Ui(m,"resize",this.Yr)}scrollElement(){if(!this.Wr)return null==m?void 0:m.document.documentElement;var e=B(this.Wr)?this.Wr:[this.Wr];for(var t of e){var i=null==m?void 0:m.document.querySelector(t);if(i)return i}}scrollY(){if(this.Wr){var e=this.scrollElement();return e&&e.scrollTop||0}return m&&(m.scrollY||m.pageYOffset||m.document.documentElement.scrollTop)||0}scrollX(){if(this.Wr){var e=this.scrollElement();return e&&e.scrollLeft||0}return m&&(m.scrollX||m.pageXOffset||m.document.documentElement.scrollLeft)||0}},Jr=e=>Is(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties),Zr=class{constructor(e,t,i,s){this.Gr=e=>{var t=this.Xr();if(!t||t.sessionId!==e){var i={sessionId:e,props:this.Jr(this._instance)};this.Kr.register({[pi]:i})}},this._instance=e,this.Qr=t,this.Kr=i,this.Jr=s||Jr,this.Qr.onSessionId(this.Gr)}Xr(){return this.Kr.props[pi]}getSetOnceProps(){var e,t=null==(e=this.Xr())?void 0:e.props;return t?"r"in t?Ms(t):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return Ai(qi(this.getSetOnceProps()),(t,i)=>{"$current_url"===i&&(i="url"),e["$session_entry_"+W(i)]=t}),e}},Qr=class{constructor(){this.ti={}}on(e,t){return this.ti[e]||(this.ti[e]=[]),this.ti[e].push(t),()=>{this.ti[e]=this.ti[e].filter(e=>e!==t)}}emit(e,t){for(var i of this.ti[e]||[])i(t);for(var s of this.ti["*"]||[])s(e,t)}},en=Dt("[SessionId]"),tn=class{on(e,t){return this.ei.on(e,t)}constructor(e,t,i){var s;if(this.ri=[],this.ii=void 0,this.ei=new Qr,this.ni=(e,t)=>!(!te(e)||!te(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===ki)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Rt=e.config,this.Kr=e.persistence,this.si=void 0,this.oi=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.ai=t||Xi,this.li=i||Xi;var r=this.Rt.persistence_name||this.Rt.token;if(this._sessionTimeoutMs=1e3*ce(this.Rt.session_idle_timeout_seconds||1800,60,36e3,en.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.ui(),this.hi="ph_"+r+"_window_id",this.ci="ph_"+r+"_primary_window_exists",this.di()){var n=as.Gt(this.hi),o=as.Gt(this.ci);n&&!o?this.si=n:as.Jt(this.hi),as.Xt(this.ci,!0)}if(null!=(s=this.Rt.bootstrap)&&s.sessionID)try{var a=(()=>{var e=this.Rt.bootstrap.sessionID.replace(/-/g,"");if(32!==e.length)throw new Error("Not a valid UUID");if("7"!==e[12])throw new Error("Not a UUIDv7");return parseInt(e.substring(0,12),16)})();this.vi(this.Rt.bootstrap.sessionID,(new Date).getTime(),a)}catch(e){en.error("Invalid sessionID in bootstrap",e)}this.fi()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return Y(this.ri)&&(this.ri=[]),this.ri.push(e),this.oi&&e(this.oi,this.si),()=>{this.ri=this.ri.filter(t=>t!==e)}}di(){return"memory"!==this.Rt.persistence&&!this.Kr.gr&&as.Yt()}pi(e){e!==this.si&&(this.si=e,this.di()&&as.Xt(this.hi,e))}gi(){return this.si?this.si:this.di()?as.Gt(this.hi):null}vi(e,t,i){e===this.oi&&t===this._sessionActivityTimestamp&&i===this._sessionStartTimestamp||(this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this.oi=e,this.Kr.register({[ei]:[t,e,i]}))}mi(){var e=this.Kr.props[ei];return B(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.vi(null,null,null)}destroy(){clearTimeout(this.yi),this.yi=void 0,this.ii&&m&&(m.removeEventListener($i,this.ii,{capture:!1}),this.ii=void 0),this.ri=[]}fi(){this.ii=()=>{this.di()&&as.Jt(this.ci)},Ui(m,$i,this.ii,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=null),this.Rt.cookieless_mode===ki)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=t||(new Date).getTime(),[s,r,n]=this.mi(),o=this.gi(),a=te(n)&&Math.abs(i-n)>864e5,l=!1,u=!r,c=!u&&!e&&this.ni(i,s);u||c||a?(r=this.ai(),o=this.li(),en.info("new session ID generated",{sessionId:r,windowId:o,changeReason:{noSessionId:u,activityTimeout:c,sessionPastMaximumLength:a}}),n=i,l=!0):o||(o=this.li(),l=!0);var h=te(s)&&e&&!a?s:i,d=te(n)?n:(new Date).getTime();return this.pi(o),this.vi(r,h,d),e||this.ui(),l&&this.ri.forEach(e=>e(r,o,l?{noSessionId:u,activityTimeout:c,sessionPastMaximumLength:a}:void 0)),{sessionId:r,windowId:o,sessionStartTimestamp:d,changeReason:l?{noSessionId:u,activityTimeout:c,sessionPastMaximumLength:a}:void 0,lastActivityTimestamp:s}}ui(){clearTimeout(this.yi),this.yi=setTimeout(()=>{var[e]=this.mi();if(this.ni((new Date).getTime(),e)){var t=this.oi;this.resetSessionId(),this.ei.emit("forcedIdleReset",{idleSessionId:t})}},1.1*this.sessionTimeoutMs)}},sn=function(e,t){if(!e)return!1;var i=e.userAgent;if(i&&j(i,t))return!0;try{var s=null==e?void 0:e.userAgentData;if(null!=s&&s.brands&&s.brands.some(e=>j(null==e?void 0:e.brand,t)))return!0}catch(e){}return!!e.webdriver},rn=function(e,t){if(!function(e){try{new RegExp(e)}catch(e){return!1}return!0}(t))return!1;try{return new RegExp(t).test(e)}catch(e){return!1}};function nn(e,t,i){return Hr({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}var on={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=>rn(t,e))),not_regex:(e,t)=>t.every(t=>e.every(e=>!rn(t,e))),icontains:(e,t)=>t.map(an).some(t=>e.map(an).some(e=>t.includes(e))),not_icontains:(e,t)=>t.map(an).every(t=>e.map(an).every(e=>!t.includes(e))),gt:(e,t)=>t.some(t=>{var i=parseFloat(t);return!isNaN(i)&&e.some(e=>i>parseFloat(e))}),lt:(e,t)=>t.some(t=>{var i=parseFloat(t);return!isNaN(i)&&e.some(e=>i<parseFloat(e))})},an=e=>e.toLowerCase();function ln(e,t){return!e||Object.entries(e).every(e=>{var[i,s]=e,r=null==t?void 0:t[i];if(Y(r)||Z(r))return!1;var n=[String(r)],o=on[s.operator];return!!o&&o(s.values,n)})}var un="custom",cn="i.posthog.com",hn=class{constructor(e){this.bi={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,t=null==(e=this.instance.config.ui_host)?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+cn,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this.bi[this.apiHost]||(this.bi[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":un),this.bi[this.apiHost]}endpointFor(e,t){if(void 0===t&&(t=""),t&&(t="/"===t[0]?t:"/"+t),"ui"===e)return this.uiHost+t;if("flags"===e)return this.flagsApiHost+t;if(this.region===un)return this.apiHost+t;var i=cn+t;switch(e){case"assets":return"https://"+this.region+"-assets."+i;case"api":return"https://"+this.region+"."+i}}},dn=Dt("[Surveys]"),pn="seenSurvey_",vn=(e,t)=>{var i="$survey_"+t+"/"+e.id;return e.current_iteration&&e.current_iteration>0&&(i="$survey_"+t+"/"+e.id+"/"+e.current_iteration),i},gn=e=>((e,t)=>{var i=""+pn+t.id;return t.current_iteration&&t.current_iteration>0&&(i=""+pn+t.id+"_"+t.current_iteration),i})(0,e),_n=[Bs,Vs,Gs],fn={ignoreConditions:!1,ignoreDelay:!1,displayType:er},mn=Dt("[PostHog ExternalIntegrations]"),yn={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},bn=class{constructor(e){this._instance=e}nr(e,t){var i;null==(i=F.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,e=>{if(e)return mn.error("failed to load script",e);t()})}startIfEnabledOrStop(){var e=this,t=function(t){var i,r,n;!s||null!=(i=F.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[t]||e.nr(yn[t],()=>{var i;null==(i=F.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[t])||i.start(e._instance)}),!s&&null!=(r=F.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[t]&&(null==(n=F.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[t])||n.stop())};for(var[i,s]of Object.entries(null!==(r=this._instance.config.integrations)&&void 0!==r?r:{})){var r;t(i)}}},wn={},xn=0,En=()=>{},kn='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Sn="Surveys module not available",Pn="sanitize_properties is deprecated. Use before_send instead",Rn="Invalid value for property_denylist config: ",Fn=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/,$n="posthog",On=!Nr&&-1===(null==R?void 0:R.indexOf("MSIE"))&&-1===(null==R?void 0:R.indexOf("Mozilla")),Cn=e=>{var t;return I({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Hi(null==w?void 0:w.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:En,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,debug:x&&X(null==x?void 0:x.search)&&-1!==x.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==m||null==(t=m.location)?void 0:t.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,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){Lt.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:Ri,before_send:void 0,request_queue_config:{flush_interval_ms:Gr},error_tracking:{},_onCapture:En,__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))},Tn=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["store_google","save_campaign_params"],["verbose","debug"]],In=e=>{var t={};for(var[i,s]of Tn)Y(e[i])||(t[s]=e[i]);var r=Li({},t,e);return B(e.property_blacklist)&&(Y(e.property_denylist)?r.property_denylist=e.property_blacklist:B(e.property_denylist)?r.property_denylist=[...e.property_blacklist,...e.property_denylist]:Lt.error(Rn+e.property_denylist)),r},Mn=class{constructor(){this.__forceAllowLocalhost=!1}get wi(){return this.__forceAllowLocalhost}set wi(e){Lt.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},An=class e{Ii(e,t){if(e){var i=this.Ci.indexOf(e);-1!==i&&this.Ci.splice(i,1)}return this.Ci.push(t),null==t.initialize||t.initialize(),t}get decideEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}get flagsEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}constructor(){var t;this.webPerformance=new Mn,this.Si=!1,this.version=O.LIB_VERSION,this.ki=new Qr,this.Ci=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Cn(),this.SentryIntegration=_s,this.sentryIntegration=e=>function(e,t){var i=gs(e,t);return{name:vs,processEvent:e=>i(e)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.xi=!1,this.Ti=null,this.Ai=null,this.Ei=null,this.scrollManager=new Xr(this),this.pageViewManager=new fs(this),this.rateLimiter=new or(this),this.requestRouter=new hn(this),this.consent=new ls(this),this.externalIntegrations=new bn(this);var i=null!==(t=e.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(e,t,i)=>{var s=X(e)?{[e]:t}:e;this.setPersonProperties(s),null==i||i({})},set_once:(e,t,i)=>{var s=X(e)?{[e]:t}:e;this.setPersonProperties(void 0,s),null==i||i({})}},this.on("eventCaptured",e=>Lt.info('send "'+(null==e?void 0:e.event)+'"',e))}init(t,i,s){if(s&&s!==$n){var r,n=null!==(r=wn[s])&&void 0!==r?r:new e;return n._init(t,i,s),wn[s]=n,wn[$n][s]=n,n}return this._init(t,i,s)}_init(e,t,i){var s,r,n,o;if(void 0===t&&(t={}),Y(e)||J(e))return Lt.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.Ri(t.debug),this.Ni=t,this.Mi=[],t.person_profiles?this.Ai=t.person_profiles:t.process_person&&(this.Ai=t.process_person),this.set_config(Li({},Cn(t.defaults),In(t),{name:i,token:e})),this.config.on_xhr_error&&Lt.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:ur;var a=this.Fi();this.persistence=new Hs(this.config,a),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Hs(I({},this.config,{persistence:"sessionStorage"}),a);var l=I({},this.persistence.props),u=I({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Oi=new Vr(e=>this.Pi(e),this.config.request_queue_config),this.Li=new Yr(this),this.__request_queue=[];var c=this.config.cookieless_mode===ki||this.config.cookieless_mode===Ei&&this.consent.isExplicitlyOptedOut();c||(this.sessionManager=new tn(this),this.sessionPropsManager=new Zr(this,this.sessionManager,this.persistence));var h=null==(s=F._POSTHOG_REMOTE_CONFIG)||null==(s=s[this.config.token])?void 0:s.config,d=null==h||null==(r=h.sdkVersion)?void 0:r.resolved;if(d&&(Fn.test(d)?this._resolvedSdkVersion=d:Lt.warn("Ignoring invalid preloaded sdkVersion.resolved from remote config: "+d)),this.config.__preview_deferred_init_extensions?(Lt.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.Di(c)},0)):(Lt.info("Initializing extensions synchronously"),this.Di(c)),O.DEBUG=O.DEBUG||this.config.debug,O.DEBUG&&Lt.info("Starting in debug mode",{this:this,config:t,thisC:I({},this.config),p:l,s:u}),!this.config.identity_distinct_id||null!=(n=t.bootstrap)&&n.distinctID||(t.bootstrap=I({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(o=t.bootstrap)?void 0:o.distinctID)){var p=t.bootstrap.distinctID,v=this.get_distinct_id(),g=this.persistence.get_property(di);if(t.bootstrap.isIdentifiedID&&null!=v&&v!==p&&g===Si)this.identify(p);else if(t.bootstrap.isIdentifiedID&&null!=v&&v!==p&&g===Pi)Lt.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 _=this.config.get_device_id(Xi()),f=t.bootstrap.isIdentifiedID?_:p;this.persistence.set_property(di,t.bootstrap.isIdentifiedID?Pi:Si),this.register({distinct_id:p,$device_id:f})}}if(c)this.register_once({distinct_id:bi,$device_id:null},"");else if(!this.get_distinct_id()){var y=this.config.get_device_id(Xi());this.register_once({distinct_id:y,$device_id:y},""),this.persistence.set_property(di,Si)}return Ui(m,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),t.segment?function(e,t){var i=e.config.segment;if(!i)return t();!function(e,t){var i=e.config.segment;if(!i)return t();var s=i=>{var s=()=>i.anonymousId()||Xi();e.config.get_device_id=s,i.id()&&(e.register({distinct_id:i.id(),$device_id:s()}),e.persistence.set_property(di,Pi)),t()},r=i.user();"then"in r&&G(r.then)?r.then(s):s(r)}(e,()=>{i.register((e=>{Promise&&Promise.resolve||ps.warn("This browser does not have Promise support, and can not use the segment integration");var t=(t,i)=>{if(!i)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(ps.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(ps.info("UserId set, identifying with PostHog"),e.identify(t.event.userId));var s=e.calculateEventProperties(i,t.event.properties);return t.event.properties=Object.assign({},s,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,Oi),identify:e=>t(e,Ti),screen:e=>t(e,"$screen")}})(e)).then(()=>{t()})})}(this,()=>this.Bi()):this.Bi(),G(this.config._onCapture)&&this.config._onCapture!==En&&(Lt.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",e=>this.config._onCapture(e.event,e))),this.config.ip&&Lt.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}Di(t){var i,s,r,n,o,a,l,u=performance.now(),c=I({},e.__defaultExtensionClasses,this.config.__extensionClasses),h=[];c.featureFlags&&this.Ci.push(this.featureFlags=null!==(i=this.featureFlags)&&void 0!==i?i:new c.featureFlags(this)),c.exceptions&&this.Ci.push(this.exceptions=null!==(s=this.exceptions)&&void 0!==s?s:new c.exceptions(this)),c.historyAutocapture&&this.Ci.push(this.historyAutocapture=new c.historyAutocapture(this)),c.tracingHeaders&&this.Ci.push(new c.tracingHeaders(this)),c.siteApps&&this.Ci.push(this.siteApps=new c.siteApps(this)),c.sessionRecording&&!t&&this.Ci.push(this.sessionRecording=new c.sessionRecording(this)),this.config.disable_scroll_properties||h.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),c.autocapture&&this.Ci.push(this.autocapture=new c.autocapture(this)),c.surveys&&this.Ci.push(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new c.surveys(this)),c.logs&&this.Ci.push(this.logs=null!==(n=this.logs)&&void 0!==n?n:new c.logs(this)),c.conversations&&this.Ci.push(this.conversations=null!==(o=this.conversations)&&void 0!==o?o:new c.conversations(this)),c.productTours&&this.Ci.push(this.productTours=new c.productTours(this)),c.heatmaps&&this.Ci.push(this.heatmaps=new c.heatmaps(this)),c.webVitalsAutocapture&&this.Ci.push(this.webVitalsAutocapture=new c.webVitalsAutocapture(this)),c.exceptionObserver&&this.Ci.push(this.exceptionObserver=new c.exceptionObserver(this)),c.deadClicksAutocapture&&this.Ci.push(this.deadClicksAutocapture=new c.deadClicksAutocapture(this,hs)),c.toolbar&&this.Ci.push(this.toolbar=null!==(a=this.toolbar)&&void 0!==a?a:new c.toolbar(this)),c.experiments&&this.Ci.push(this.experiments=null!==(l=this.experiments)&&void 0!==l?l:new c.experiments(this)),this.Ci.forEach(e=>{e.initialize&&h.push(()=>{null==e.initialize||e.initialize()})}),h.push(()=>{if(this.ji){var e=this.ji;this.ji=void 0,this.Sr(e)}}),this.qi(h,u)}qi(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout(()=>{this.qi(e,t)},0);var i=e.shift();if(i)try{i()}catch(e){Lt.error("Error initializing extension:",e)}}var s=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:s}),this.config.__preview_deferred_init_extensions&&Lt.info("PostHog extensions initialized ("+s+"ms)")}Sr(e){var t;if(!w||!w.body)return Lt.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Sr(e)},500);this.config.__preview_deferred_init_extensions&&(this.ji=e),this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=N(e.supportedCompression,ur)?ur:N(e.supportedCompression,cr)?cr:void 0),null!=(t=e.analytics)&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.Ai?this.Ai:Ri}),this.Ci.forEach(t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e))}Bi(){try{this.config.loaded(this)}catch(e){Lt.critical("`loaded` function failed",e)}if(this.Zi(),this.config.internal_or_test_user_hostname&&null!=x&&x.hostname){var e=x.hostname,t=this.config.internal_or_test_user_hostname;("string"==typeof t?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.config.cookieless_mode===ki)&&this.$i()},1),this.Hi=new lr(this),this.Hi.load()}Zi(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this.Oi)||e.enable())}_dom_loaded(){this.is_capturing()&&Mi(this.__request_queue,e=>this.Pi(e)),this.__request_queue=[],this.Zi()}_handle_unload(){var e,t,i;null==(e=this.surveys)||e.handlePageUnload(),this.config.request_batching?(this.Vi()&&this.capture(Ci),null==(t=this.Oi)||t.unload(),null==(i=this.Li)||i.unload()):this.Vi()&&this.capture(Ci,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(On?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=Wr(e.url,{ip:this.config.ip?1:0}),e.headers=I({},this.config.request_headers,e.headers),e.compression="best-available"===e.compression?this.compression:e.compression,e.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(e=>{var t,i,s,r=I({},e);r.timeout=r.timeout||6e4,r.url=Wr(r.url,{_:(new Date).getTime().toString(),ver:O.JS_SDK_VERSION,compression:r.compression});var n=null!==(t=r.transport)&&void 0!==t?t:"fetch",o=Br.filter(e=>!r.disableTransport||!e.transport||!r.disableTransport.includes(e.transport)),a=null!==(i=null==(s=function(e){for(var t=0;e.length>t;t++)if(e[t].transport===n)return e[t]}(o))?void 0:s.method)&&void 0!==i?i:o[0].method;if(!a)throw new Error("No available transport method");"sendBeacon"!==n&&r.data&&r.compression===ur&&P?zr(r).then(e=>{a(e)}).catch(()=>{a(r)}):a(r)})(I({},e,{callback:t=>{var i,s;this.rateLimiter.checkForLimiting(t),400>t.statusCode||null==(i=(s=this.config).on_request_error)||i.call(s,t),null==e.callback||e.callback(t)}}))))}Pi(e){this.Li?this.Li.retriableRequest(e):this._send_request(e)}_execute_array(e){xn++;try{var t,i=[],s=[],r=[];Mi(e,e=>{e&&(B(t=e[0])?r.push(e):G(e)?e.call(this):B(e)&&"alias"===t?i.push(e):B(e)&&-1!==t.indexOf("capture")&&G(this[t])?r.push(e):s.push(e))});var n=function(e,t){Mi(e,function(e){if(B(e[0])){var i=t;Ai(e,function(e){i=i[e[0]].apply(i,e.slice(1))})}else t[e[0]].apply(t,e.slice(1))})};n(i,this),n(s,this),n(r,this)}finally{xn--}}push(t){if(xn>0&&B(t)&&X(t[0])){var i=e.prototype[t[0]];G(i)&&i.apply(this,t.slice(1))}else this._execute_array([t])}capture(e,t,i){var s,r,n,o,a;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Oi){if(this.is_capturing())if(!Y(e)&&X(e)){var l=!this.config.opt_out_useragent_filter&&this._is_bot();if(!l||this.config.__preview_capture_bot_pageviews){var u=null!=i&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==u||!u.isRateLimited){null!=t&&t.$current_url&&!X(null==t?void 0:t.$current_url)&&(Lt.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==t||delete t.$current_url),"$exception"!==e||null!=i&&i.zi||Lt.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 c=new Date,h=(null==i?void 0:i.timestamp)||c,d=Xi(),p={uuid:d,event:e,properties:this.calculateEventProperties(e,t||{},h,d)};e===Oi&&this.config.__preview_capture_bot_pageviews&&l&&(p.event="$bot_pageview",p.properties.$browser_type="bot"),u&&(p.properties.$lib_rate_limit_remaining_tokens=u.remainingTokens),(null==i?void 0:i.$set)&&(p.$set=null==i?void 0:i.$set);var v,g=this.Yi(null==i?void 0:i.$set_once,e!==Ii,e===Ti);if(g&&(p.$set_once=g),null!=i&&i._noTruncate||(r=this.config.properties_string_max_length,n=p,o=e=>X(e)?e.slice(0,r):e,a=new Set,p=function e(t,i){return t!==Object(t)?o?o(t):t:a.has(t)?void 0:(a.add(t),B(t)?(s=[],Mi(t,t=>{s.push(e(t))})):(s={},Ai(t,(t,i)=>{a.has(t)||(s[i]=e(t,i))})),s);var s}(n)),p.timestamp=h,Y(null==i?void 0:i.timestamp)||(p.properties.$event_time_override_provided=!0,p.properties.$event_time_override_system_time=c),e===Ys||e===Xs){var _=null==t?void 0:t[Js],f=null==t?void 0:t[Zs];v={id:_,current_iteration:f},localStorage.getItem(gn(v))||localStorage.setItem(gn(v),"true"),p.$set=I({},p.$set,{[vn({id:_,current_iteration:f},e===Xs?"responded":"dismissed")]:!0})}else e===Ks&&(p.$set=I({},p.$set,{[Qs]:(new Date).toISOString()}));if(e===ir){var m=null==t?void 0:t[rr];m&&(p.$set=I({},p.$set,{[sr+"/"+m]:(new Date).toISOString()}))}var y=I({},p.properties.$set,p.$set);if(K(y)||this.setPersonPropertiesForFlags(y),!Q(this.config.before_send)){var b=this.Ui(p);if(!b)return;p=b}this.ki.emit("eventCaptured",p);var w={method:"POST",url:null!==(s=null==i?void 0:i._url)&&void 0!==s?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:p,compression:"best-available",batchKey:null==i?void 0:i._batchKey};return!this.config.request_batching||i&&(null==i||!i._batchKey)||null!=i&&i.send_instantly?this.Pi(w):this.Oi.enqueue(w),p}Lt.critical("This capture call is ignored due to client rate limiting.")}}else Lt.error("No event name provided to posthog.capture")}else Lt.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",t=>e(t.event,t))}calculateEventProperties(e,t,i,s,r){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return t;var n=r?void 0:this.persistence.remove_event_timer(e),o=I({},t);if(o.token=this.config.token,o.$config_defaults=this.config.defaults,(this.config.cookieless_mode==ki||this.config.cookieless_mode==Ei&&this.consent.isExplicitlyOptedOut())&&(o.$cookieless_mode=!0),"$snapshot"===e){var a=I({},this.persistence.properties(),this.sessionPersistence.properties());return o.distinct_id=a.distinct_id,(!X(o.distinct_id)&&!ee(o.distinct_id)||J(o.distinct_id))&&Lt.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),o}var l,u=function(e,t){var i,s,r,n;if(!R)return{};var o,a,l,u,c,h,d,p,v=e?[...Es,...t||[]]:[],[g,_]=function(e){for(var t=0;lt.length>t;t++){var[i,s]=lt[t],r=i.exec(e),n=r&&(G(s)?s(r,e):s);if(n)return n}return["",""]}(R);return Li(qi({$os:g,$os_version:_,$browser:nt(R,navigator.vendor),$device:ut(R),$device_type:(a=R,l={userAgentDataPlatform:null==(i=navigator)||null==(i=i.userAgentData)?void 0:i.platform,maxTouchPoints:null==(s=navigator)?void 0:s.maxTouchPoints,screenWidth:null==m||null==(r=m.screen)?void 0:r.width,screenHeight:null==m||null==(n=m.screen)?void 0:n.height,devicePixelRatio:null==m?void 0:m.devicePixelRatio},p=ut(a),p===be||p===ye||"Kobo"===p||"Kindle Fire"===p||p===Xe?me:p===Ne||p===We||p===qe||p===Ve?"Console":p===xe?"Wearable":p?ge:"Android"===(null==l?void 0:l.userAgentDataPlatform)&&(null!==(u=null==l?void 0:l.maxTouchPoints)&&void 0!==u?u:0)>0?600>Math.min(null!==(c=null==l?void 0:l.screenWidth)&&void 0!==c?c:0,null!==(h=null==l?void 0:l.screenHeight)&&void 0!==h?h:0)/(null!==(d=null==l?void 0:l.devicePixelRatio)&&void 0!==d?d:1)?ge:me:"Desktop"),$timezone:As(),$timezone_offset:Ls()}),{$current_url:bs(null==x?void 0:x.href,v,Ss),$host:null==x?void 0:x.host,$pathname:null==x?void 0:x.pathname,$raw_user_agent:R.length>1e3?R.substring(0,997)+"...":R,$browser_version:at(R,navigator.vendor),$browser_language:Os(),$browser_language_prefix:(o=Os(),"string"==typeof o?o.split("-")[0]:void 0),$screen_height:null==m?void 0:m.screen.height,$screen_width:null==m?void 0:m.screen.width,$viewport_height:null==m?void 0:m.innerHeight,$viewport_width:null==m?void 0:m.innerWidth,$lib:O.LIB_NAME,$lib_version:O.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:c,windowId:h}=this.sessionManager.checkAndGetSessionAndWindowId(r,i.getTime());o.$session_id=c,o.$window_id=h}this.sessionPropsManager&&Li(o,this.sessionPropsManager.getSessionProps());try{var d;this.sessionRecording&&Li(o,this.sessionRecording.sdkDebugProperties),o.$sdk_debug_retry_queue_size=null==(d=this.Li)?void 0:d.length}catch(e){o.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===un&&(o.$lib_custom_api_host=this.config.api_host),l=e!==Oi||r?e!==Ci||r?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,s),o=Li(o,l),e===Oi&&w&&(o.title=w.title),!Y(n)){var p=i.getTime()-n;o.$duration=parseFloat((p/1e3).toFixed(3))}R&&this.config.opt_out_useragent_filter&&(o.$browser_type=this._is_bot()?"bot":"browser"),(o=Li({},u,this.persistence.properties(),this.sessionPersistence.properties(),o)).$is_identified=this._isIdentified(),B(this.config.property_denylist)?Ai(this.config.property_denylist,function(e){delete o[e]}):Lt.error(Rn+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var v=this.config.sanitize_properties;v&&(Lt.error(Pn),o=v(o,e));var g=this.Wi();return o.$process_person_profile=g,g&&!r&&this.Gi("_calculate_event_properties"),o}Yi(e,t,i){var s;if(void 0===t&&(t=!0),void 0===i&&(i=!1),!this.persistence||!this.Wi())return e;if(this.Si&&!i)return e;var r=this.persistence.get_initial_props(),n=null==(s=this.sessionPropsManager)?void 0:s.getSetOnceProps(),o=Li({},r,n||{},e||{}),a=this.config.sanitize_properties;return a&&(Lt.error(Pn),o=a(o,"$set_once")),t&&(this.Si=!0),K(o)?void 0:o}register(e,t){var i;null==(i=this.persistence)||i.register(e,t)}register_once(e,t,i){var s;null==(s=this.persistence)||s.register_once(e,t,i)}register_for_session(e){var t;null==(t=this.sessionPersistence)||t.register(e)}unregister(e){var t;null==(t=this.persistence)||t.unregister(e)}unregister_for_session(e){var t;null==(t=this.sessionPersistence)||t.unregister(e)}Xi(e,t){this.register({[e]:t})}getFeatureFlag(e,t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return null==(t=this.featureFlags)?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagResult(e,t)}isFeatureEnabled(e,t){var i;return null==(i=this.featureFlags)?void 0:i.isFeatureEnabled(e,t)}reloadFeatureFlags(){var e;null==(e=this.featureFlags)||e.reloadFeatureFlags()}updateFlags(e,t,i){var s;null==(s=this.featureFlags)||s.updateFlags(e,t,i)}updateEarlyAccessFeatureEnrollment(e,t,i){var s;null==(s=this.featureFlags)||s.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t,i){var s;return void 0===t&&(t=!1),null==(s=this.featureFlags)?void 0:s.getEarlyAccessFeatures(e,t,i)}on(e,t){return this.ki.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:Sn}),()=>{})}onSessionId(e){var t,i;return null!==(t=null==(i=this.sessionManager)?void 0:i.onSessionId(e))&&void 0!==t?t:()=>{}}getSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:Sn})}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:Sn})}renderSurvey(e,t){var i;null==(i=this.surveys)||i.renderSurvey(e,t)}displaySurvey(e,t){var i;void 0===t&&(t=fn),null==(i=this.surveys)||i.displaySurvey(e,t)}cancelPendingSurvey(e){var t;null==(t=this.surveys)||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,i;return null!==(t=null==(i=this.surveys)?void 0:i.canRenderSurvey(e))&&void 0!==t?t:{visible:!1,disabledReason:Sn}}canRenderSurveyAsync(e,t){var i,s;return void 0===t&&(t=!1),null!==(i=null==(s=this.surveys)?void 0:s.canRenderSurveyAsync(e,t))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:Sn})}Ji(e){return!e||J(e)?(Lt.critical("Unique user id has not been set in posthog.identify"),!1):e===bi?(Lt.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())||(Lt.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(e,t,i){if(!this.__loaded||!this.persistence)return Lt.uninitializedWarning("posthog.identify");if(ee(e)&&(e=e.toString(),Lt.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Ji(e)&&this.Gi("posthog.identify")){var s=this.get_distinct_id();this.register({$user_id:e}),this.get_property(Wt)||this.register_once({$had_persisted_distinct_id:!0,$device_id:s},""),e!==s&&e!==this.get_property(Ht)&&(this.unregister(Ht),this.register({distinct_id:e}));var r,n=(this.persistence.get_property(di)||Si)===Si;e!==s&&n?(this.persistence.set_property(di,Pi),this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!1),this.capture(Ti,{distinct_id:e,$anon_distinct_id:s},{$set:t||{},$set_once:i||{}}),this.Ei=nn(e,t,i),null==(r=this.featureFlags)||r.setAnonymousDistinctId(s)):(t||i)&&this.setPersonProperties(t,i),e!==s&&(this.reloadFeatureFlags(),this.unregister(li))}}setPersonProperties(e,t){if((e||t)&&this.Gi("posthog.setPersonProperties")){var i=nn(this.get_distinct_id(),e,t);this.Ei!==i?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Ei=i):Lt.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,i){if(e&&t){var s=this.getGroups(),r=s[e]!==t;if(r&&this.resetGroupPropertiesForFlags(e),this.register({$groups:I({},s,{[e]:t})}),r||i){var n={$group_type:e,$group_key:t};i&&(n.$group_set=i),this.capture(Ii,n)}i&&this.setGroupPropertiesForFlags({[e]:i}),r&&!i&&this.reloadFeatureFlags()}else Lt.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){var i;void 0===t&&(t=!0),null==(i=this.featureFlags)||i.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){var e;null==(e=this.featureFlags)||e.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,t){var i;void 0===t&&(t=!0),this.Gi("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;null==(t=this.featureFlags)||t.resetGroupPropertiesForFlags(e)}reset(e){var t,i,s,r,n,o,a,l;if(Lt.info("reset"),!this.__loaded)return Lt.uninitializedWarning("posthog.reset");var u=this.get_property(Wt);if(this.consent.reset(),null==(t=this.persistence)||t.clear(),null==(i=this.sessionPersistence)||i.clear(),null==(s=this.surveys)||s.reset(),null==(r=this.Hi)||r.stop(),null==(n=this.featureFlags)||n.reset(),null==(o=this.conversations)||o.reset(),null==(a=this.persistence)||a.set_property(di,Si),null==(l=this.sessionManager)||l.resetSessionId(),this.Ei=null,this.config.cookieless_mode===ki)this.register_once({distinct_id:bi,$device_id:null},"");else{var c=this.config.get_device_id(Xi());this.register_once({distinct_id:c,$device_id:e?c:u},"")}this.register({$last_posthog_reset:(new Date).toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}setIdentity(e,t){var i;this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),null==(i=this.conversations)||i.Ki()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(e=this.conversations)||e.Qi()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return null!==(e=null==(t=this.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==e?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),s=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(null!=e&&e.withTimestamp&&i){var r,n=null!==(r=e.timestampLookBack)&&void 0!==r?r:10;if(!i)return s;s+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return s}alias(e,t){return e===this.get_property(qt)?(Lt.critical("Attempting to create alias for existing People user - aborting."),-2):this.Gi("posthog.alias")?(Y(t)&&(t=this.get_distinct_id()),e!==t?(this.Xi(Ht,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(Lt.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=I({},this.config);if(V(e)){var i,s,r,n,o,a,l,u,c;Li(this.config,In(e));var h=this.Fi();null==(i=this.persistence)||i.update_config(this.config,t,h),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Hs(I({},this.config,{persistence:"sessionStorage"}),h);var d=this.Ri(this.config.debug);ie(d)&&(this.config.debug=d),ie(this.config.debug)&&(this.config.debug?(O.DEBUG=!0,is.Yt()&&is.Xt("ph_debug",!0),Lt.info("set_config",{config:e,oldConfig:t,newConfig:I({},this.config)})):(O.DEBUG=!1,is.Yt()&&is.Jt("ph_debug"))),null==(s=this.exceptionObserver)||s.onConfigChange(),null==(r=this.sessionRecording)||r.startIfEnabledOrStop(),null==(n=this.autocapture)||n.startIfEnabled(),null==(o=this.heatmaps)||o.startIfEnabled(),null==(a=this.exceptionObserver)||a.startIfEnabledOrStop(),null==(l=this.deadClicksAutocapture)||l.startIfEnabledOrStop(),null==(u=this.surveys)||u.loadIfEnabled(),this.tn(),null==(c=this.externalIntegrations)||c.startIfEnabledOrStop()}}_overrideSDKInfo(e,t){O.LIB_NAME=e,O.LIB_VERSION=t}startSessionRecording(e){var t,i,s,r,n,o=!0===e,a={sampling:o||!(null==e||!e.sampling),linked_flag:o||!(null==e||!e.linked_flag),url_trigger:o||!(null==e||!e.url_trigger),event_trigger:o||!(null==e||!e.event_trigger)};Object.values(a).some(Boolean)&&(null==(t=this.sessionManager)||t.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(s=this.sessionRecording)||s.overrideLinkedFlag()),a.url_trigger&&(null==(r=this.sessionRecording)||r.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!(null==(e=this.sessionRecording)||!e.started)}captureException(e,t){if(this.exceptions){var i=new Error("PostHog syntheticException"),s=this.exceptions.buildProperties(e,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(I({},s,t))}}startExceptionAutocapture(e){this.set_config({capture_exceptions:null==e||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,i;return null!==(t=null==(i=this.toolbar)?void 0:i.loadToolbar(e))&&void 0!==t&&t}get_property(e){var t;return null==(t=this.persistence)?void 0:t.props[e]}getSessionProperty(e){var t;return null==(t=this.sessionPersistence)?void 0:t.props[e]}toString(){var e,t=null!==(e=this.config.name)&&void 0!==e?e:$n;return t!==$n&&(t=$n+"."+t),t}_isIdentified(){var e,t;return(null==(e=this.persistence)?void 0:e.get_property(di))===Pi||(null==(t=this.sessionPersistence)?void 0:t.get_property(di))===Pi}Wi(){var e,t;return!("never"===this.config.person_profiles||this.config.person_profiles===Ri&&!this._isIdentified()&&K(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[Ht])&&(null==(t=this.persistence)||null==(t=t.props)||!t[mi]))}Vi(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&(!0===this.config.capture_pageview||"history_change"===this.config.capture_pageview)}createPersonProfile(){this.Wi()||this.Gi("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Gi("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Gi(e){return"never"===this.config.person_profiles?(Lt.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Xi(mi,!0),!0)}Fi(){if("always"===this.config.cookieless_mode)return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==Ei)}tn(){var e,t,i,s,r=this.Fi();return(null==(e=this.persistence)?void 0:e.gr)!==r&&(null==(i=this.persistence)||i.set_disabled(r)),(null==(t=this.sessionPersistence)?void 0:t.gr)!==r&&(null==(s=this.sessionPersistence)||s.set_disabled(r)),r}opt_in_capturing(t){var i;if(this.config.cookieless_mode!==ki){if(this.config.cookieless_mode===Ei&&this.consent.isExplicitlyOptedOut()){var s,r,n,o,a;this.reset(!0),null==(s=this.sessionManager)||s.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new tn(this),this.pageViewManager=new fs(this),this.persistence&&(this.sessionPropsManager=new Zr(this,this.sessionManager,this.persistence));var l=null!==(n=null==(o=this.config.__extensionClasses)?void 0:o.sessionRecording)&&void 0!==n?n:null==(a=e.__defaultExtensionClasses)?void 0:a.sessionRecording;l&&(this.sessionRecording=this.Ii(this.sessionRecording,new l(this)))}var u,c;this.consent.optInOut(!0),this.tn(),this.Zi(),null==(i=this.sessionRecording)||i.startIfEnabledOrStop(),this.config.cookieless_mode==Ei&&(null==(u=this.surveys)||u.loadIfEnabled()),(Y(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)&&this.capture(null!==(c=null==t?void 0:t.captureEventName)&&void 0!==c?c:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.$i()}else Lt.warn(kn)}opt_out_capturing(){var e,t,i;this.config.cookieless_mode!==ki?(this.config.cookieless_mode===Ei&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.tn(),this.config.cookieless_mode===Ei&&(this.register({distinct_id:bi,$device_id:null}),null==(e=this.sessionManager)||e.destroy(),null==(t=this.pageViewManager)||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,null==(i=this.sessionRecording)||i.stopRecording(),this.sessionRecording=void 0,this.$i())):Lt.warn(kn)}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 1===e?"granted":0===e?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===ki||(this.config.cookieless_mode===Ei?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.tn()}_is_bot(){return b?sn(b,this.config.custom_blocked_useragents):void 0}$i(){w&&("visible"===w.visibilityState?this.xi||(this.xi=!0,this.capture(Oi,{title:w.title},{send_instantly:!0}),this.Ti&&(w.removeEventListener(Fi,this.Ti),this.Ti=null)):this.Ti||(this.Ti=this.$i.bind(this),Ui(w,Fi,this.Ti)))}debug(e){!1===e?(null==m||m.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==m||m.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}))}Tr(){var e,t,i,s,r,n,o=this.Ni||{};return"advanced_disable_flags"in o?!!o.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(Lt.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(i="advanced_disable_decide",s=Lt,r=(t="advanced_disable_flags")in(e=o)&&!Q(e[t]),n=i in e&&!Q(e[i]),r?e[t]:!!n&&(s&&s.warn("Config field '"+i+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[i]))}Ui(e){if(Q(this.config.before_send))return e;var t=B(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e;for(var s of t){if(i=s(i),Q(i)){var r="Event '"+e.event+"' was rejected in beforeSend function";return se(e.event)?Lt.warn(r+". This can cause unexpected behavior."):Lt.info(r),null}i.properties&&!K(i.properties)||Lt.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return i}getPageViewId(){var e;return null==(e=this.pageViewManager.lr)?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}Ri(e){var t=ie(e)&&!e,i=is.Yt()&&"true"===is.Wt("ph_debug");return!t&&(!!i||e)}};function Ln(e){return e instanceof Element&&(e.id===yi||!(null==e.closest||!e.closest(".toolbar-global-fade-container")))}function Dn(e){return!!e&&1===e.nodeType}function jn(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function Nn(e){return!!e&&3===e.nodeType}function qn(e){return!!e&&11===e.nodeType}function Wn(e){return e?q(e).split(/\s+/):[]}function Hn(e){var t=null==m?void 0:m.location.href;return!!(t&&e&&e.some(e=>t.match(e)))}function Un(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 Wn(t)}function zn(e){return Q(e)?null:q(e).split(/(\s+)/).filter(e=>lo(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Bn(e){var t="";return eo(e)&&!to(e)&&e.childNodes&&e.childNodes.length&&Ai(e.childNodes,function(e){var i;Nn(e)&&e.textContent&&(t+=null!==(i=zn(e.textContent))&&void 0!==i?i:"")}),q(t)}function Gn(e){return Y(e.target)?e.srcElement||null:null!=(t=e.target)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}An.__defaultExtensionClasses={},function(e,t){for(var i=0;t.length>i;i++)e.prototype[t[i]]=Ni(e.prototype[t[i]])}(An,["identify"]);var Vn=["a","button","form","input","select","textarea","label"];function Kn(e,t){if(Y(t))return!0;var i,s=function(e){if(t.some(t=>e.matches(t)))return{v:!0}};for(var r of e)if(i=s(r))return i.v;return!1}function Yn(e){var t=e.parentNode;return!(!t||!Dn(t))&&t}var Xn=["next","previous","prev",">","<"],Jn=[".ph-no-rageclick",".ph-no-capture"],Zn=e=>!e||jn(e,"html")||!Dn(e),Qn=(e,t)=>{if(!m||Zn(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,s=[e],r=e;r.parentNode&&!jn(r,"body");)if(qn(r.parentNode))s.push(r.parentNode.host),r=r.parentNode.host;else{var n=Yn(r);if(!n)break;if(t||Vn.indexOf(n.tagName.toLowerCase())>-1)i=!0;else{var o=m.getComputedStyle(n);o&&"pointer"===o.getPropertyValue("cursor")&&(i=!0)}s.push(n),r=n}return{parentIsUsefulElement:i,targetElementList:s}};function eo(e){for(var t=e;t.parentNode&&!jn(t,"body");t=t.parentNode){var i=Un(t);if(N(i,"ph-sensitive")||N(i,"ph-no-capture"))return!1}if(N(Un(e),"ph-include"))return!0;var s=e.type||"";if(X(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}var r=e.name||e.id||"";return!X(r)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(r.replace(/[^a-zA-Z0-9]/g,""))}function to(e){return!!(jn(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||jn(e,"select")||jn(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var io="(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})",so=new RegExp("^(?:"+io+")$"),ro=new RegExp(io),no="\\d{3}-?\\d{2}-?\\d{4}",oo=new RegExp("^("+no+")$"),ao=new RegExp("("+no+")");function lo(e,t){if(void 0===t&&(t=!0),Q(e))return!1;if(X(e)){if(e=q(e),(t?so:ro).test((e||"").replace(/[- ]/g,"")))return!1;if((t?oo:ao).test(e))return!1}return!0}function uo(e){var t=Bn(e);return lo(t=(t+" "+co(e)).trim())?t:""}function co(e){var t="";return e&&e.childNodes&&e.childNodes.length&&Ai(e.childNodes,function(e){var i;if(e&&"span"===(null==(i=e.tagName)?void 0:i.toLowerCase()))try{var s=Bn(e);t=(t+" "+s).trim(),e.childNodes&&e.childNodes.length&&(t=(t+" "+co(e)).trim())}catch(e){Lt.error("[AutoCapture]",e)}}),t}function ho(e){return e.replace(/"|\\"/g,'\\"')}function po(e){var t=e.attr__class;return t?B(t)?t:Wn(t):void 0}var vo=class{constructor(e){this.disabled=!1===e;var t=V(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,i){if(this.disabled)return!1;var s=this.clicks[this.clicks.length-1];if(s&&Math.abs(e-s.x)+Math.abs(t-s.y)<this.thresholdPx&&this.timeoutMs>i-s.timestamp){if(this.clicks.push({x:e,y:t,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:i}];return!1}},go="$copy_autocapture",_o=Dt("[AutoCapture]");function fo(e,t){return t.length>e?t.slice(0,e)+"...":t}function mo(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do{t=t.previousSibling}while(t&&!Dn(t));return t}var yo=Dt("[ExceptionAutocapture]");function bo(e,t,i){try{if(!(t in e))return()=>{};var s=e[t],r=i(s);return G(r)&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=r,()=>{e[t]=s}}catch(e){return()=>{}}}var wo=Dt("[TracingHeaders]"),xo=Dt("[Web Vitals]"),Eo=9e5,ko="disabled",So="lazy_loading",Po="awaiting_config",Ro="missing_config";Dt("[SessionRecording]");var Fo="[SessionRecording]",$o=Dt(Fo),Oo=Dt("[Heatmaps]");function Co(e){return V(e)&&"clientX"in e&&"clientY"in e&&ee(e.clientX)&&ee(e.clientY)}var To=Dt("[Product Tours]"),Io="ph_product_tours",Mo=["$set_once","$set"],Ao=Dt("[SiteApps]"),Lo="Error while initializing PostHog app with config id ";function Do(e,t,i){if(Q(e))return!1;switch(i){case"exact":return e===t;case"contains":var s=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(s,"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch(e){return!1}default:return!1}}var jo,No=class{constructor(e){this.en=new Qr,this.rn=(e,t)=>this.nn(e,t)&&this.sn(e,t)&&this.an(e,t)&&this.ln(e,t),this.nn=(e,t)=>null==t||!t.event||(null==e?void 0:e.event)===(null==t?void 0:t.event),this._instance=e,this.un=new Set,this.hn=new Set}init(){var e,t;Y(null==(e=this._instance)?void 0:e._addCaptureHook)||null==(t=this._instance)||t._addCaptureHook((e,t)=>{this.on(e,t)})}register(e){var t,i;if(!Y(null==(t=this._instance)?void 0:t._addCaptureHook)&&(e.forEach(e=>{var t,i;null==(t=this.hn)||t.add(e),null==(i=e.steps)||i.forEach(e=>{var t;null==(t=this.un)||t.add((null==e?void 0:e.event)||"")})}),null!=(i=this._instance)&&i.autocapture)){var s,r=new Set;e.forEach(e=>{var t;null==(t=e.steps)||t.forEach(e=>{null!=e&&e.selector&&r.add(null==e?void 0:e.selector)})}),null==(s=this._instance)||s.autocapture.setElementSelectors(r)}}on(e,t){var i;null!=t&&0!=e.length&&(this.un.has(e)||this.un.has(null==t?void 0:t.event))&&this.hn&&(null==(i=this.hn)?void 0:i.size)>0&&this.hn.forEach(e=>{this.cn(t,e)&&this.en.emit("actionCaptured",e.name)})}dn(e){this.onAction("actionCaptured",t=>e(t))}cn(e,t){if(null==(null==t?void 0:t.steps))return!1;for(var i of t.steps)if(this.rn(e,i))return!0;return!1}onAction(e,t){return this.en.on(e,t)}sn(e,t){if(null!=t&&t.url){var i,s=null==e||null==(i=e.properties)?void 0:i.$current_url;if(!s||"string"!=typeof s)return!1;if(!Do(s,t.url,t.url_matching||"contains"))return!1}return!0}an(e,t){return!!this.vn(e,t)&&!!this.fn(e,t)&&!!this.pn(e,t)}vn(e,t){var i;if(null==t||!t.href)return!0;var s=this.gn(e);if(s.length>0)return s.some(e=>Do(e.href,t.href,t.href_matching||"exact"));var r,n=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";return!!n&&Do((r=n.match(/(?::|")href="(.*?)"/))?r[1]:"",t.href,t.href_matching||"exact")}fn(e,t){var i;if(null==t||!t.text)return!0;var s=this.gn(e);if(s.length>0)return s.some(e=>Do(e.text,t.text,t.text_matching||"exact")||Do(e.$el_text,t.text,t.text_matching||"exact"));var r,n,o,a=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";return!!a&&(r=function(e){for(var t,i=[],s=/(?::|")text="(.*?)"/g;!Q(t=s.exec(e));)i.includes(t[1])||i.push(t[1]);return i}(a),n=t.text,o=t.text_matching||"exact",r.some(e=>Do(e,n,o)))}pn(e,t){var i,s;if(null==t||!t.selector)return!0;var r=null==e||null==(i=e.properties)?void 0:i.$element_selectors;if(null!=r&&r.includes(t.selector))return!0;var n=(null==e||null==(s=e.properties)?void 0:s.$elements_chain)||"";if(t.selector_regex&&n)try{return new RegExp(t.selector_regex).test(n)}catch(e){return!1}return!1}gn(e){var t;return null==(null==e||null==(t=e.properties)?void 0:t.$elements)?[]:null==e?void 0:e.properties.$elements}ln(e,t){return null==t||!t.properties||0===t.properties.length||ln(t.properties.reduce((e,t)=>{var i=B(t.value)?t.value.map(String):null!=t.value?[String(t.value)]:[];return e[t.key]={values:i,operator:t.operator||"exact"},e},{}),null==e?void 0:e.properties)}},qo=class{constructor(e){this._instance=e,this.mn=new Map,this.yn=new Map,this.bn=new Map}wn(e,t){return!!e&&ln(e.propertyFilters,null==t?void 0:t.properties)}_n(e,t){var i=new Map;return e.forEach(e=>{var s;null==(s=e.conditions)||null==(s=s[t])||null==(s=s.values)||s.forEach(t=>{if(null!=t&&t.name){var s=i.get(t.name)||[];s.push(e.id),i.set(t.name,s)}})}),i}In(e,t,i){var s=(i===Us?this.mn:this.yn).get(e),r=[];return this.Cn(e=>{r=e.filter(e=>null==s?void 0:s.includes(e.id))}),r.filter(s=>{var r,n=null==(r=s.conditions)||null==(r=r[i])||null==(r=r.values)?void 0:r.find(t=>t.name===e);return this.wn(n,t)})}register(e){var t;Y(null==(t=this._instance)?void 0:t._addCaptureHook)||(this.Sn(e),this.kn(e))}kn(e){var t=e.filter(e=>{var t,i;return(null==(t=e.conditions)?void 0:t.actions)&&(null==(i=e.conditions)||null==(i=i.actions)||null==(i=i.values)?void 0:i.length)>0});0!==t.length&&(null==this.xn&&(this.xn=new No(this._instance),this.xn.init(),this.xn.dn(e=>{this.onAction(e)})),t.forEach(e=>{var t,i,s,r,n;e.conditions&&null!=(t=e.conditions)&&t.actions&&null!=(i=e.conditions)&&null!=(i=i.actions)&&i.values&&(null==(s=e.conditions)||null==(s=s.actions)||null==(s=s.values)?void 0:s.length)>0&&(null==(r=this.xn)||r.register(e.conditions.actions.values),null==(n=e.conditions)||null==(n=n.actions)||null==(n=n.values)||n.forEach(t=>{if(t&&t.name){var i=this.bn.get(t.name);i&&i.push(e.id),this.bn.set(t.name,i||[e.id])}}))}))}Sn(e){var t,i=e.filter(e=>{var t,i;return(null==(t=e.conditions)?void 0:t.events)&&(null==(i=e.conditions)||null==(i=i.events)||null==(i=i.values)?void 0:i.length)>0}),s=e.filter(e=>{var t,i;return(null==(t=e.conditions)?void 0:t.cancelEvents)&&(null==(i=e.conditions)||null==(i=i.cancelEvents)||null==(i=i.values)?void 0:i.length)>0});0===i.length&&0===s.length||(null==(t=this._instance)||t._addCaptureHook((e,t)=>{this.onEvent(e,t)}),this.mn=this._n(e,Us),this.yn=this._n(e,zs))}onEvent(e,t){var i,s=this.re(),r=this.Tn(),n=this.An(),o=(null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[r])||[];if(n===e&&t&&o.length>0){var a,l;s.info("event matched, removing item from activated items",{event:e,eventPayload:t,existingActivatedItems:o});var u=(null==t||null==(a=t.properties)?void 0:a.$survey_id)||(null==t||null==(l=t.properties)?void 0:l.$product_tour_id);if(u){var c=o.indexOf(u);0>c||(o.splice(c,1),this.En(o))}}else{if(this.yn.has(e)){var h=this.In(e,t,zs);h.length>0&&(s.info("cancel event matched, cancelling items",{event:e,itemsToCancel:h.map(e=>e.id)}),h.forEach(e=>{var t=o.indexOf(e.id);0>t||o.splice(t,1),this.Rn(e.id)}),this.En(o))}if(this.mn.has(e)){s.info("event name matched",{event:e,eventPayload:t,items:this.mn.get(e)});var d=this.In(e,t,Us);this.En(o.concat(d.map(e=>e.id)||[]))}}}onAction(e){var t,i=this.Tn(),s=(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i])||[];this.bn.has(e)&&this.En(s.concat(this.bn.get(e)||[]))}En(e){var t,i=this.re(),s=this.Tn(),r=[...new Set(e)].filter(e=>!this.Nn(e));i.info("updating activated items",{activatedItems:r}),null==(t=this._instance)||null==(t=t.persistence)||t.register({[s]:r})}getActivatedIds(){var e,t=this.Tn();return(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[t])||[]}getEventToItemsMap(){return this.mn}Mn(){return this.xn}},Wo=class extends qo{constructor(e){super(e)}Tn(){return"$surveys_activated"}An(){return Ks}Cn(e){var t;null==(t=this._instance)||t.getSurveys(e)}Rn(e){var t;null==(t=this._instance)||t.cancelPendingSurvey(e)}re(){return dn}Nn(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},Ho="SDK is not enabled or survey functionality is not yet loaded",Uo="Disabled. Not loading surveys.",zo=null!=m&&m.location?ws(m.location.hash,"__posthog")||ws(location.hash,"state"):null,Bo="_postHogToolbarParams",Go=Dt("[Toolbar]"),Vo=Dt("[FeatureFlags]"),Ko=Dt("[FeatureFlags]",{debugEnabled:!0}),Yo="\" failed. Feature flags didn't load in time.",Xo="$active_feature_flags",Jo="$override_feature_flags",Zo="$feature_flag_payloads",Qo="$override_feature_flag_payloads",ea="$feature_flag_request_id",ta=e=>{for(var t={},i=0;e.length>i;i++)t[e[i]]=!0;return t},ia=e=>{var t={};for(var[i,s]of Di(e||{}))s&&(t[i]=s);return t},sa=Dt("[Error tracking]"),ra="Refusing to render web experiment since the viewer is a likely bot",na={icontains:(e,t)=>!!m&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!m&&-1===t.href.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>!!m&&rn(t.href,e),not_regex:(e,t)=>!!m&&!rn(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e},oa=Dt("[Conversations]"),aa="Conversations not available yet.",la={featureFlags:class{constructor(e){this.qn=!1,this.Zn=!1,this.$n=!1,this.Hn=!1,this.Vn=!1,this.zn=!1,this.Yn=!1,this.Un=!1,this._instance=e,this.featureFlagEventHandlers=[]}get Rt(){return this._instance.config}get Kr(){return this._instance.persistence}Wn(e){return this._instance.get_property(e)}Gn(){var e,t;return null!==(e=null==(t=this.Kr)?void 0:t.mr(this.Rt.feature_flag_cache_ttl_ms))&&void 0!==e&&e}Xn(){return!!this.Gn()&&(this.Un||this.$n||(this.Un=!0,Vo.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Jn(){var e,t=null!==(e=this.Rt.evaluation_contexts)&&void 0!==e?e:this.Rt.evaluation_environments;return!this.Rt.evaluation_environments||this.Rt.evaluation_contexts||this.Yn||(Vo.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Yn=!0),null!=t&&t.length?t.filter(e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||Vo.error("Invalid evaluation context found:",e,"Expected non-empty string"),t}):[]}Kn(){return this.Jn().length>0}initialize(){var e,t,{config:i}=this._instance,s=null!==(e=null==(t=i.bootstrap)?void 0:t.featureFlags)&&void 0!==e?e:{};if(Object.keys(s).length){var r,n,o=null!==(r=null==(n=i.bootstrap)?void 0:n.featureFlagPayloads)&&void 0!==r?r:{},a=Object.keys(s).filter(e=>!!s[e]).reduce((e,t)=>(e[t]=s[t]||!1,e),{}),l=Object.keys(o).filter(e=>a[e]).reduce((e,t)=>(o[t]&&(e[t]=o[t]),e),{});this.receivedFeatureFlags({featureFlags:a,featureFlagPayloads:l})}}updateFlags(e,t,i){var s=null!=i&&i.merge?this.getFlagVariants():{},r=null!=i&&i.merge?this.getFlagPayloads():{},n=I({},s,e),o=I({},r,t),a={};for(var[l,u]of Object.entries(n)){var c="string"==typeof u;a[l]={key:l,enabled:!!c||Boolean(u),variant:c?u:void 0,reason:void 0,metadata:Y(null==o?void 0:o[l])?void 0:{id:0,version:void 0,description:void 0,payload:o[l]}}}this.receivedFeatureFlags({flags:a})}get hasLoadedFlags(){return this.Zn}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this.Wn(ri),t=this.Wn(Jo),i=this.Wn(Qo);if(!i&&!t)return e||{};var s=Li({},e||{}),r=[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])];for(var n of r){var o,a,l=s[n],u=null==t?void 0:t[n],c=Y(u)?null!==(o=null==l?void 0:l.enabled)&&void 0!==o&&o:!!u,h=Y(u)?l.variant:"string"==typeof u?u:void 0,d=null==i?void 0:i[n],p=I({},l,{enabled:c,variant:c?null!=h?h:null==l?void 0:l.variant:void 0});c!==(null==l?void 0:l.enabled)&&(p.original_enabled=null==l?void 0:l.enabled),h!==(null==l?void 0:l.variant)&&(p.original_variant=null==l?void 0:l.variant),d&&(p.metadata=I({},null==l?void 0:l.metadata,{payload:d,original_payload:null==l||null==(a=l.metadata)?void 0:a.payload})),s[n]=p}return this.qn||(Vo.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:s}),this.qn=!0),s}getFlagVariants(){var e=this.Wn(ii),t=this.Wn(Jo);if(!t)return e||{};for(var i=Li({},e),s=Object.keys(t),r=0;s.length>r;r++)i[s[r]]=t[s[r]];return this.qn||(Vo.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this.qn=!0),i}getFlagPayloads(){var e=this.Wn(Zo),t=this.Wn(Qo);if(!t)return e||{};for(var i=Li({},e||{}),s=Object.keys(t),r=0;s.length>r;r++)i[s[r]]=t[s[r]];return this.qn||(Vo.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this.qn=!0),i}reloadFeatureFlags(){this.Hn||this.Rt.advanced_disable_feature_flags||this.Qn||(this._instance.ki.emit("featureFlagsReloading",!0),this.Qn=setTimeout(()=>{this.ts()},5))}es(){clearTimeout(this.Qn),this.Qn=void 0}ensureFlagsLoaded(){this.Zn||this.$n||this.Qn||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.Hn=e}ts(e){var t;if(this.es(),!this._instance.Tr())if(this.$n)this.Vn=!0;else{var i=this.Rt.token,s=this.Wn(Wt),r={token:i,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:I({},(null==(t=this.Kr)?void 0:t.get_initial_props())||{},this.Wn(ni)||{}),group_properties:this.Wn(oi),timezone:As()};Z(s)||Y(s)||(r.$device_id=s),(null!=e&&e.disableFlags||this.Rt.advanced_disable_feature_flags)&&(r.disable_flags=!0),this.Kn()&&(r.evaluation_contexts=this.Jn());var n=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Rt.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.$n=!0,this._instance._send_request({method:"POST",url:n,data:r,compression:this.Rt.disable_compression?void 0:cr,timeout:this.Rt.feature_flag_request_timeout_ms,callback:e=>{var t,i,s,n=!0;if(200===e.statusCode&&(this.Vn||(this.$anon_distinct_id=void 0),n=!1),this.$n=!1,!r.disable_flags||this.Vn){this.zn=!n;var o=[];e.error?e.error instanceof Error?o.push("AbortError"===e.error.name?"timeout":"connection_error"):o.push("unknown_error"):200!==e.statusCode&&o.push("api_error_"+e.statusCode),null!=(t=e.json)&&t.errorsWhileComputingFlags&&o.push("errors_while_computing_flags");var a,l=!(null==(i=e.json)||null==(i=i.quotaLimited)||!i.includes("feature_flags"));l&&o.push("quota_limited"),null==(s=this.Kr)||s.register({[ci]:o}),l?Vo.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(null!==(a=e.json)&&void 0!==a?a:{},n),this.Vn&&(this.Vn=!1,this.ts()))}}})}}getFeatureFlag(e,t){var i;if(void 0===t&&(t={}),!t.fresh||this.zn)if(this.Zn||this.getFlags()&&this.getFlags().length>0){if(!this.Xn()){var s=this.getFeatureFlagResult(e,t);return null!==(i=null==s?void 0:s.variant)&&void 0!==i?i:null==s?void 0:s.enabled}}else Vo.warn('getFeatureFlag for key "'+e+Yo)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return null==t?void 0:t.payload}getFeatureFlagResult(e,t){if(void 0===t&&(t={}),!t.fresh||this.zn)if(this.Zn||this.getFlags()&&this.getFlags().length>0){if(!this.Xn()){var i=this.getFlagVariants(),s=e in i,r=i[e],n=this.getFlagPayloads()[e],o=String(r),a=this.Wn(ea)||void 0,l=this.Wn(hi)||void 0,u=this.Wn(li)||{};if(this.Rt.advanced_feature_flags_dedup_per_session){var c,h=this._instance.get_session_id(),d=this.Wn(ui);h&&h!==d&&(u={},null==(c=this.Kr)||c.register({[li]:u,[ui]:h}))}if((t.send_event||!("send_event"in t))&&(!(e in u)||!u[e].includes(o))){var p,v,g,_,f,m,y,b,w,x;B(u[e])?u[e].push(o):u[e]=[o],null==(p=this.Kr)||p.register({[li]:u});var E=this.getFeatureFlagDetails(e),k=[...null!==(v=this.Wn(ci))&&void 0!==v?v:[]];Y(r)&&k.push("flag_missing");var S={$feature_flag:e,$feature_flag_response:r,$feature_flag_payload:n||null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:(null==(g=this.Rt.bootstrap)||null==(g=g.featureFlags)?void 0:g[e])||null,$feature_flag_bootstrapped_payload:(null==(_=this.Rt.bootstrap)||null==(_=_.featureFlagPayloads)?void 0:_[e])||null,$used_bootstrap_value:!this.zn};Y(null==E||null==(f=E.metadata)?void 0:f.version)||(S.$feature_flag_version=E.metadata.version);var P,R=null!==(m=null==E||null==(y=E.reason)?void 0:y.description)&&void 0!==m?m:null==E||null==(b=E.reason)?void 0:b.code;R&&(S.$feature_flag_reason=R),null!=E&&null!=(w=E.metadata)&&w.id&&(S.$feature_flag_id=E.metadata.id),Y(null==E?void 0:E.original_variant)&&Y(null==E?void 0:E.original_enabled)||(S.$feature_flag_original_response=Y(E.original_variant)?E.original_enabled:E.original_variant),null!=E&&null!=(x=E.metadata)&&x.original_payload&&(S.$feature_flag_original_payload=null==E||null==(P=E.metadata)?void 0:P.original_payload),k.length&&(S.$feature_flag_error=k.join(",")),this._instance.capture("$feature_flag_called",S)}if(s){var F=n;if(!Y(n))try{F=JSON.parse(n)}catch(e){}return{key:e,enabled:!!r,variant:"string"==typeof r?r:void 0,payload:F}}}}else Vo.warn('getFeatureFlagResult for key "'+e+Yo)}getRemoteConfigPayload(e,t){var i=this.Rt.token,s={distinct_id:this._instance.get_distinct_id(),token:i};this.Kn()&&(s.evaluation_contexts=this.Jn()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:s,compression:this.Rt.disable_compression?void 0:cr,timeout:this.Rt.feature_flag_request_timeout_ms,callback(i){var s,r=null==(s=i.json)?void 0:s.featureFlagPayloads;t((null==r?void 0:r[e])||void 0)}})}isFeatureEnabled(e,t){if(void 0===t&&(t={}),!t.fresh||this.zn){if(this.Zn||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlag(e,t);return Y(i)?void 0:!!i}Vo.warn('isFeatureEnabled for key "'+e+Yo)}}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t){if(this.Kr){this.Zn=!0;var i=this.getFlagVariants(),s=this.getFlagPayloads(),r=this.getFlagsWithDetails();!function(e,t,i,s,r){void 0===i&&(i={}),void 0===s&&(s={}),void 0===r&&(r={});var n,o,a=((o=(n=e).flags)?(n.featureFlags=Object.fromEntries(Object.keys(o).map(e=>{var t;return[e,null!==(t=o[e].variant)&&void 0!==t?t:o[e].enabled]})),n.featureFlagPayloads=Object.fromEntries(Object.keys(o).filter(e=>o[e].enabled).filter(e=>{var t;return null==(t=o[e].metadata)?void 0:t.payload}).map(e=>{var t;return[e,null==(t=o[e].metadata)?void 0:t.payload]}))):Vo.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),n),l=a.flags,u=a.featureFlags,c=a.featureFlagPayloads;if(u){var h=e.requestId,d=e.evaluatedAt;if(B(u)){Vo.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var p={};if(u)for(var v=0;u.length>v;v++)p[u[v]]=!0;t&&t.register({[Xo]:u,[ii]:p})}else{var g=u,_=c,f=l;if(e.errorsWhileComputingFlags)if(l){var m=new Set(Object.keys(l).filter(e=>{var t;return!(null!=(t=l[e])&&t.failed)}));g=I({},i,Object.fromEntries(Object.entries(g).filter(e=>{var[t]=e;return m.has(t)}))),_=I({},s,Object.fromEntries(Object.entries(_||{}).filter(e=>{var[t]=e;return m.has(t)}))),f=I({},r,Object.fromEntries(Object.entries(f||{}).filter(e=>{var[t]=e;return m.has(t)})))}else g=I({},i,g),_=I({},s,_),f=I({},r,f);t&&t.register(I({[Xo]:Object.keys(ia(g)),[ii]:g||{},[Zo]:_||{},[ri]:f||{}},h?{[ea]:h}:{},d?{[hi]:d}:{}))}}}(e,this.Kr,i,s,r),t||(this.Un=!1),this.rs(t)}}override(e,t){void 0===t&&(t=!1),Vo.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this.Kr)return Vo.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===e)return this.Kr.unregister(Jo),this.Kr.unregister(Qo),this.rs(),Ko.info("All overrides cleared");if(B(e)){var t=ta(e);return this.Kr.register({[Jo]:t}),this.rs(),Ko.info("Flag overrides set",{flags:e})}if(e&&"object"==typeof e&&("flags"in e||"payloads"in e)){var i,s=e;if(this.qn=Boolean(null!==(i=s.suppressWarning)&&void 0!==i&&i),"flags"in s)if(!1===s.flags)this.Kr.unregister(Jo),Ko.info("Flag overrides cleared");else if(s.flags){if(B(s.flags)){var r=ta(s.flags);this.Kr.register({[Jo]:r})}else this.Kr.register({[Jo]:s.flags});Ko.info("Flag overrides set",{flags:s.flags})}return"payloads"in s&&(!1===s.payloads?(this.Kr.unregister(Qo),Ko.info("Payload overrides cleared")):s.payloads&&(this.Kr.register({[Qo]:s.payloads}),Ko.info("Payload overrides set",{payloads:s.payloads}))),void this.rs()}if(e&&"object"==typeof e)return this.Kr.register({[Jo]:e}),this.rs(),Ko.info("Flag overrides set",{flags:e});Vo.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.Zn){var{flags:t,flagVariants:i}=this.ns();e(t,i)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var s,r=(this.Wn(si)||[]).find(t=>t.flagKey===e),n={["$feature_enrollment/"+e]:t},o={$feature_flag:e,$feature_enrollment:t,$set:n};r&&(o.$early_access_feature_name=r.name),i&&(o.$feature_enrollment_stage=i),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(n,!1);var a=I({},this.getFlagVariants(),{[e]:t});null==(s=this.Kr)||s.register({[Xo]:Object.keys(ia(a)),[ii]:a}),this.rs()}getEarlyAccessFeatures(e,t,i){void 0===t&&(t=!1);var s=this.Wn(si),r=i?"&"+i.map(e=>"stage="+e).join("&"):"";if(s&&!t)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Rt.token+r),method:"GET",callback:t=>{var i,s;if(t.json){var r=t.json.earlyAccessFeatures;return null==(i=this.Kr)||i.unregister(si),null==(s=this.Kr)||s.register({[si]:r}),e(r)}}})}ns(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(e=>t[e]),flagVariants:Object.keys(t).filter(e=>t[e]).reduce((e,i)=>(e[i]=t[i],e),{})}}rs(e){var{flags:t,flagVariants:i}=this.ns();this.featureFlagEventHandlers.forEach(s=>s(t,i,{errorsLoading:e}))}setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=this.Wn(ni)||{},s=(null==e?void 0:e.$set)||(null!=e&&e.$set_once?{}:e),r=null==e?void 0:e.$set_once,n={};if(r)for(var o in r)({}).hasOwnProperty.call(r,o)&&(o in i||(n[o]=r[o]));this._instance.register({[ni]:I({},i,n,s)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(ni)}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=this.Wn(oi)||{};0!==Object.keys(i).length&&Object.keys(i).forEach(t=>{i[t]=I({},i[t],e[t]),delete e[t]}),this._instance.register({[oi]:I({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.Wn(oi)||{};this._instance.register({[oi]:I({},t,{[e]:{}})})}else this._instance.unregister(oi)}reset(){this.Zn=!1,this.$n=!1,this.Hn=!1,this.Vn=!1,this.zn=!1,this.$anon_distinct_id=void 0,this.es(),this.qn=!1}}},ua={sessionRecording:class{get Rt(){return this._instance.config}get Kr(){return this._instance.persistence}get started(){var e;return!(null==(e=this.ss)||!e.isStarted)}get status(){var e,t;return this.os===Po||this.os===Ro?this.os:null!==(e=null==(t=this.ss)?void 0:t.status)&&void 0!==e?e:this.os}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.os=ko,this.ls=void 0,this._instance=e,!this._instance.sessionManager)throw $o.error("started without valid sessionManager"),new Error(Fo+" started without valid sessionManager. This is a bug.");if(this.Rt.cookieless_mode===ki)throw new Error(Fo+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get us(){var e,t=!(null==(e=this._instance.get_property(Qt))||!e.enabled),i=!this.Rt.disable_session_recording,s=this.Rt.disable_session_recording||this._instance.consent.isOptedOut();return m&&t&&i&&!s}startIfEnabledOrStop(e){var t;if(!this.us||null==(t=this.ss)||!t.isStarted){var i=!Y(Object.assign)&&!Y(Array.from);this.us&&i?(this.hs(e),$o.info("starting")):(this.os=ko,this.stopRecording())}}hs(e){var t,i,s;this.us&&(this.os!==Po&&this.os!==Ro&&(this.os=So),null!=F&&null!=(t=F.__PosthogExtensions__)&&null!=(t=t.rrweb)&&t.record&&null!=(i=F.__PosthogExtensions__)&&i.initSessionRecording?this.cs(e):null==(s=F.__PosthogExtensions__)||null==s.loadExternalDependency||s.loadExternalDependency(this._instance,this.ds,t=>{if(t)return $o.error("could not load recorder",t);this.cs(e)}))}stopRecording(){var e,t;null==(e=this.ls)||e.call(this),this.ls=void 0,null==(t=this.ss)||t.stop()}vs(){var e,t;null==(e=this.ls)||e.call(this),this.ls=void 0,null==(t=this.ss)||t.discard()}fs(){var e;null==(e=this.Kr)||e.unregister(ti)}ps(e,t){if(Q(e))return null;var i,s=ee(e)?e:parseFloat(e);return"number"!=typeof(i=s)||!Number.isFinite(i)||0>i||i>1?($o.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):s}gs(e){if(this.Kr){var t,i,s=this.Kr,r=()=>{var t,i=!1===e.sessionRecording?void 0:e.sessionRecording,r=this.ps(null==(t=this.Rt.session_recording)?void 0:t.sampleRate,"session_recording.sampleRate"),n=this.ps(null==i?void 0:i.sampleRate,"remote config sampleRate"),o=null!=r?r:n;Q(o)&&this.fs();var a=null==i?void 0:i.minimumDurationMilliseconds;s.register({[Qt]:I({cache_timestamp:Date.now(),enabled:!!i},i,{networkPayloadCapture:I({capturePerformance:e.capturePerformance},null==i?void 0:i.networkPayloadCapture),canvasRecording:{enabled:null==i?void 0:i.recordCanvas,fps:null==i?void 0:i.canvasFps,quality:null==i?void 0:i.canvasQuality},sampleRate:o,minimumDurationMilliseconds:Y(a)?null:a,endpoint:null==i?void 0:i.endpoint,triggerMatchType:null==i?void 0:i.triggerMatchType,masking:null==i?void 0:i.masking,urlTriggers:null==i?void 0:i.urlTriggers})})};r(),null==(t=this.ls)||t.call(this),this.ls=null==(i=this._instance.sessionManager)?void 0:i.onSessionId(r)}}onRemoteConfig(e){return"sessionRecording"in e?!1===e.sessionRecording?(this.gs(e),void this.vs()):(this.gs(e),void this.startIfEnabledOrStop()):(this.os===Po&&(this.os=Ro,$o.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t){var i;void 0===t&&(t="log"),null!=(i=this.ss)&&i.log?this.ss.log(e,t):$o.warn("log called before recorder was ready")}get ds(){var e,t,i=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.get_property(Qt);return(null==i||null==(t=i.scriptConfig)?void 0:t.script)||"lazy-recorder"}ys(){var e,t=this._instance.get_property(Qt);if(!t)return!1;var i=null!==(e=("object"==typeof t?t:JSON.parse(t)).cache_timestamp)&&void 0!==e?e:Date.now();return 36e5>=Date.now()-i}cs(e){var t,i;if(null==(t=F.__PosthogExtensions__)||!t.initSessionRecording)return $o.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.ss||(this.ss=null==(i=F.__PosthogExtensions__)?void 0:i.initSessionRecording(this._instance),this.ss._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.ys()){if(this.os===Ro||this.os===Po)return;return this.os=Po,$o.info("persisted remote config is stale, requesting fresh config before starting"),void new lr(this._instance).load()}this.os=So,this.ss.start(e)}onRRwebEmit(e){var t;null==(t=this.ss)||null==t.onRRwebEmit||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.ss||null==(t=this.Kr)||t.register({$replay_override_linked_flag:!0}),null==(e=this.ss)||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.ss||null==(t=this.Kr)||t.register({$replay_override_sampling:!0}),null==(e=this.ss)||e.overrideSampling()}overrideTrigger(e){var t,i;this.ss||null==(i=this.Kr)||i.register({["url"===e?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null==(t=this.ss)||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return(null==(e=this.ss)?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var i;return!(null==(i=this.ss)||!i.tryAddCustomEvent(e,t))}}},ca={autocapture:class{constructor(e){this.bs=!1,this.ws=null,this._s=!1,this.instance=e,this.rageclicks=new vo(e.config.rageclick),this.Is=null}initialize(){this.startIfEnabled()}get Rt(){var e,t,i=V(this.instance.config.autocapture)?this.instance.config.autocapture:{};return i.url_allowlist=null==(e=i.url_allowlist)?void 0:e.map(e=>new RegExp(e)),i.url_ignorelist=null==(t=i.url_ignorelist)?void 0:t.map(e=>new RegExp(e)),i}Cs(){if(this.isBrowserSupported()){if(m&&w){var e=e=>{e=e||(null==m?void 0:m.event);try{this.Ss(e)}catch(e){_o.error("Failed to capture event",e)}};if(Ui(w,"submit",e,{capture:!0}),Ui(w,"change",e,{capture:!0}),Ui(w,"click",e,{capture:!0}),this.Rt.capture_copied_text){var t=e=>{this.Ss(e=e||(null==m?void 0:m.event),go)};Ui(w,"copy",t,{capture:!0}),Ui(w,"cut",t,{capture:!0})}}}else _o.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.bs&&(this.Cs(),this.bs=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this._s=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[zt]:!!e.autocapture_opt_out}),this.ws=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.Is=e}getElementSelectors(e){var t,i=[];return null==(t=this.Is)||t.forEach(t=>{var s=null==w?void 0:w.querySelectorAll(t);null==s||s.forEach(s=>{e===s&&i.push(t)})}),i}get isEnabled(){var e,t,i=null==(e=this.instance.persistence)?void 0:e.props[zt];if(Z(this.ws)&&!ie(i)&&!this.instance.Tr())return!1;var s=null!==(t=this.ws)&&void 0!==t?t:!!i;return!!this.instance.config.autocapture&&!s}Ss(e,t){if(void 0===t&&(t="$autocapture"),this.isEnabled){var i,s=Gn(e);Nn(s)&&(s=s.parentNode||null),"$autocapture"===t&&"click"===e.type&&e instanceof MouseEvent&&this.instance.config.rageclick&&null!=(i=this.rageclicks)&&i.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime())&&function(e,t){if(!m||Zn(e))return!1;var i,s,r;if(ie(t)?(i=!!t&&Jn,s=void 0):(i=null!==(r=null==t?void 0:t.css_selector_ignorelist)&&void 0!==r?r:Jn,s=null==t?void 0:t.content_ignorelist),!1===i)return!1;var{targetElementList:n}=Qn(e,!1);return!function(e,t){if(!1===e||Y(e))return!1;var i;if(!0===e)i=Xn;else{if(!B(e))return!1;if(e.length>10)return Lt.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;i=e.map(e=>e.toLowerCase())}return t.some(e=>{var{safeText:t,ariaLabel:s}=e;return i.some(e=>t.includes(e)||s.includes(e))})}(s,n.map(e=>{var t;return{safeText:Bn(e).toLowerCase(),ariaLabel:(null==(t=e.getAttribute("aria-label"))?void 0:t.toLowerCase().trim())||""}}))&&!Kn(n,i)}(s,this.instance.config.rageclick)&&this.Ss(e,"$rageclick");var r=t===go;if(s&&function(e,t,i,s,r){var n,o,a,l;if(void 0===i&&(i=void 0),!m||Zn(e))return!1;if(null!=(n=i)&&n.url_allowlist&&!Hn(i.url_allowlist))return!1;if(null!=(o=i)&&o.url_ignorelist&&Hn(i.url_ignorelist))return!1;if(null!=(a=i)&&a.dom_event_allowlist){var u=i.dom_event_allowlist;if(u&&!u.some(e=>t.type===e))return!1}var{parentIsUsefulElement:c,targetElementList:h}=Qn(e,s);if(!function(e,t){var i=null==t?void 0:t.element_allowlist;if(Y(i))return!0;var s,r=function(e){if(i.some(t=>e.tagName.toLowerCase()===t))return{v:!0}};for(var n of e)if(s=r(n))return s.v;return!1}(h,i))return!1;if(!Kn(h,null==(l=i)?void 0:l.css_selector_allowlist))return!1;var d=m.getComputedStyle(e);if(d&&"pointer"===d.getPropertyValue("cursor")&&"click"===t.type)return!0;var p=e.tagName.toLowerCase();switch(p){case"html":return!1;case"form":return(r||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(r||["change","click"]).indexOf(t.type)>=0;default:return c?(r||["click"]).indexOf(t.type)>=0:(r||["click"]).indexOf(t.type)>=0&&(Vn.indexOf(p)>-1||"true"===e.getAttribute("contenteditable"))}}(s,e,this.Rt,r,r?["copy","cut"]:void 0)){var{props:n,explicitNoCapture:o}=function(e,t){for(var i,s,{e:r,maskAllElementAttributes:n,maskAllText:o,elementAttributeIgnoreList:a,elementsChainAsString:l}=t,u=[e],c=e;c.parentNode&&!jn(c,"body");)qn(c.parentNode)?(u.push(c.parentNode.host),c=c.parentNode.host):(u.push(c.parentNode),c=c.parentNode);var h,d,p=[],v={},g=!1,_=!1;if(Ai(u,e=>{var t=eo(e);"a"===e.tagName.toLowerCase()&&(g=e.getAttribute("href"),g=t&&g&&lo(g)&&g),N(Un(e),"ph-no-capture")&&(_=!0),p.push(function(e,t,i,s){var r=e.tagName.toLowerCase(),n={tag_name:r};Vn.indexOf(r)>-1&&!i&&(n.$el_text="a"===r.toLowerCase()||"button"===r.toLowerCase()?fo(1024,uo(e)):fo(1024,Bn(e)));var o=Un(e);o.length>0&&(n.classes=o.filter(function(e){return""!==e})),Ai(e.attributes,function(i){var r;if((!to(e)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==s||!s.includes(i.name))&&!t&&lo(i.value)&&(!X(r=i.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))){var o=i.value;"class"===i.name&&(o=Wn(o).join(" ")),n["attr__"+i.name]=fo(1024,o)}});for(var a=1,l=1,u=e;u=mo(u);)a++,u.tagName===e.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}(e,n,o,a));var i=function(e){if(!eo(e))return{};var t={};return Ai(e.attributes,function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){var i=e.name.replace("data-ph-capture-attribute-",""),s=e.value;i&&s&&lo(s)&&(t[i]=s)}}),t}(e);Li(v,i)}),_)return{props:{},explicitNoCapture:_};if(o||(p[0].$el_text="a"===e.tagName.toLowerCase()||"button"===e.tagName.toLowerCase()?uo(e):Bn(e)),g){var f,y;p[0].attr__href=g;var b=null==(f=ms(g))?void 0:f.host,w=null==m||null==(y=m.location)?void 0:y.host;b&&w&&b!==w&&(h=g)}return{props:Li({$event_type:r.type,$ce_version:1},l?{}:{$elements:p},{$elements_chain:(d=p,function(e){return e.map(e=>{var t,i,s="";if(e.tag_name&&(s+=e.tag_name),e.attr_class)for(var r of(e.attr_class.sort(),e.attr_class))s+="."+r.replace(/"/g,"");var n=I({},e.text?{text:e.text}:{},{"nth-child":null!==(t=e.nth_child)&&void 0!==t?t:0,"nth-of-type":null!==(i=e.nth_of_type)&&void 0!==i?i:0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),o={};return Di(n).sort((e,t)=>{var[i]=e,[s]=t;return i.localeCompare(s)}).forEach(e=>{var[t,i]=e;return o[ho(t.toString())]=ho(i.toString())}),(s+=":")+Di(o).map(e=>{var[t,i]=e;return t+'="'+i+'"'}).join("")}).join(";")}(function(e){return e.map(e=>{var t,i,s={text:null==(t=e.$el_text)?void 0:t.slice(0,400),tag_name:e.tag_name,href:null==(i=e.attr__href)?void 0:i.slice(0,2048),attr_class:po(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return Di(e).filter(e=>{var[t]=e;return 0===t.indexOf("attr__")}).forEach(e=>{var[t,i]=e;return s.attributes[t]=i}),s})}(d)))},null!=(i=p[0])&&i.$el_text?{$el_text:null==(s=p[0])?void 0:s.$el_text}:{},h&&"click"===r.type?{$external_click_url:h}:{},v)}}(s,{e:e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Rt.element_attribute_ignorelist,elementsChainAsString:this._s});if(o)return!1;var a=this.getElementSelectors(s);if(a&&a.length>0&&(n.$element_selectors=a),t===go){var l,u=zn(null==m||null==(l=m.getSelection())?void 0:l.toString()),c=e.type||"clipboard";if(!u)return!1;n.$selected_content=u,n.$copy_type=c}return this.instance.capture(t,n),!0}}}isBrowserSupported(){return G(null==w?void 0:w.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this.ks=(null==m||null==(t=m.location)?void 0:t.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(Lt.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.xs&&this.xs(),this.xs=void 0,Lt.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(m&&m.history){var i=this;null!=(e=m.history.pushState)&&e.__posthog_wrapped__||bo(m.history,"pushState",e=>function(t,s,r){e.call(this,t,s,r),i.Ts("pushState")}),null!=(t=m.history.replaceState)&&t.__posthog_wrapped__||bo(m.history,"replaceState",e=>function(t,s,r){e.call(this,t,s,r),i.Ts("replaceState")}),this.As()}}Ts(e){try{var t,i=null==m||null==(t=m.location)?void 0:t.pathname;if(!i)return;i!==this.ks&&this.isEnabled&&this._instance.capture(Oi,{navigation_type:e}),this.ks=i}catch(t){Lt.error("Error capturing "+e+" pageview",t)}}As(){if(!this.xs){var e=()=>{this.Ts("popstate")};Ui(m,"popstate",e),this.xs=()=>{m&&m.removeEventListener("popstate",e)}}}},heatmaps:class{get Rt(){return this.instance.config}constructor(e){var t;this.Es=!1,this.bs=!1,this.Rs=null,this.instance=e,this.Es=!(null==(t=this.instance.persistence)||!t.props[Bt]),this.rageclicks=new vo(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return V(this.Rt.capture_heatmaps)&&this.Rt.capture_heatmaps.flush_interval_milliseconds&&(e=this.Rt.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return Q(this.Rt.capture_heatmaps)?Q(this.Rt.enable_heatmaps)?this.Es:this.Rt.enable_heatmaps:!1!==this.Rt.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.bs)return;Oo.info("starting..."),this.Ns(),this.Tt()}else{var e;clearInterval(null!==(e=this.Rs)&&void 0!==e?e:void 0),this.Ms(),this.getAndClearBuffer()}}onRemoteConfig(e){if("heatmaps"in e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Bt]:t}),this.Es=t,this.startIfEnabled()}}getAndClearBuffer(){var e=this.T;return this.T=void 0,e}Fs(e){this.wt(e.originalEvent,"deadclick")}Tt(){this.Rs&&clearInterval(this.Rs),this.Rs="visible"===(null==w?void 0:w.visibilityState)?setInterval(this.Zr.bind(this),this.flushIntervalMilliseconds):null}Ns(){m&&w&&(this.Os=this.Zr.bind(this),Ui(m,$i,this.Os),this.Ps=e=>this.wt(e||(null==m?void 0:m.event)),Ui(w,"click",this.Ps,{capture:!0}),this.Ls=e=>this.Ds(e||(null==m?void 0:m.event)),Ui(w,"mousemove",this.Ls,{capture:!0}),this.Bs=new ds(this.instance,cs,this.Fs.bind(this)),this.Bs.startIfEnabledOrStop(),this.js=this.Tt.bind(this),Ui(w,Fi,this.js),this.bs=!0)}Ms(){var e;m&&w&&(this.Os&&m.removeEventListener($i,this.Os),this.Ps&&w.removeEventListener("click",this.Ps,{capture:!0}),this.Ls&&w.removeEventListener("mousemove",this.Ls,{capture:!0}),this.js&&w.removeEventListener(Fi,this.js),clearTimeout(this.qs),null==(e=this.Bs)||e.stop(),this.bs=!1)}Zs(e,t){var i=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),n=function(e,t,i){for(var s=e;s&&Dn(s)&&!jn(s,"body");){if(s===i)return!1;if(N(t,null==m?void 0:m.getComputedStyle(s).position))return!0;s=Yn(s)}return!1}(Gn(e),["fixed","sticky"],r);return{x:e.clientX+(n?0:s),y:e.clientY+(n?0:i),target_fixed:n,type:t}}wt(e,t){var i;if(void 0===t&&(t="click"),!Ln(e.target)&&Co(e)){var s=this.Zs(e,t);null!=(i=this.rageclicks)&&i.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&this.$s(I({},s,{type:"rageclick"})),this.$s(s)}}Ds(e){!Ln(e.target)&&Co(e)&&(clearTimeout(this.qs),this.qs=setTimeout(()=>{this.$s(this.Zs(e,"mousemove"))},500))}$s(e){if(m){var t=m.location.href,i=this.Rt.custom_personal_data_properties,s=this.Rt.mask_personal_data_properties?[...Es,...i||[]]:[],r=bs(t,s,Ss);this.T=this.T||{},this.T[r]||(this.T[r]=[]),this.T[r].push(e)}}Zr(){this.T&&!K(this.T)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:ds,webVitalsAutocapture:class{constructor(e){var t;this.Es=!1,this.bs=!1,this.T={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Hs=()=>{clearTimeout(this.Vs),0!==this.T.metrics.length&&(this._instance.capture("$web_vitals",this.T.metrics.reduce((e,t)=>I({},e,{["$web_vitals_"+t.name+"_event"]:I({},t),["$web_vitals_"+t.name+"_value"]:t.value}),{})),this.T={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.nt=e=>{var t,i=null==(t=this._instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0);if(Y(i))xo.error("Could not read session ID. Dropping metrics!");else{this.T=this.T||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var s=this.zs();Y(s)||(Q(null==e?void 0:e.name)||Q(null==e?void 0:e.value)?xo.error("Invalid metric received",e):!this.Ys||this.Ys>e.value?(this.T.url!==s&&(this.Hs(),this.Vs=setTimeout(this.Hs,this.flushToCaptureTimeoutMs)),Y(this.T.url)&&(this.T.url=s),this.T.firstMetricTimestamp=Y(this.T.firstMetricTimestamp)?Date.now():this.T.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0),this.T.metrics.push(I({},e,{$current_url:s,$session_id:i.sessionId,$window_id:i.windowId,timestamp:Date.now()})),this.T.metrics.length===this.allowedMetrics.length&&this.Hs()):xo.error("Ignoring metric with value >= "+this.Ys,e))}},this.Us=()=>{if(!this.bs){var e,t,i,s,r=F.__PosthogExtensions__;Y(r)||Y(r.postHogWebVitalsCallbacks)||({onLCP:e,onCLS:t,onFCP:i,onINP:s}=r.postHogWebVitalsCallbacks),e&&t&&i&&s?(this.allowedMetrics.indexOf("LCP")>-1&&e(this.nt.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&t(this.nt.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this.nt.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&s(this.nt.bind(this)),this.bs=!0):xo.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.Es=!(null==(t=this._instance.persistence)||!t.props[Yt]),this.startIfEnabled()}get Ws(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,i=V(this.Ws)?null==(e=this.Ws)?void 0:e.web_vitals_allowed_metrics:void 0;return Q(i)?(null==(t=this._instance.persistence)?void 0:t.props[Zt])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(V(this.Ws)?this.Ws.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=V(this.Ws)?this.Ws.web_vitals_attribution:void 0;return null!=e&&e}get Ys(){var e=V(this.Ws)&&ee(this.Ws.__web_vitals_max_value)?this.Ws.__web_vitals_max_value:Eo;return e>0&&6e4>=e?Eo:e}get isEnabled(){var e=null==x?void 0:x.protocol;if("http:"!==e&&"https:"!==e)return xo.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=V(this.Ws)?this.Ws.web_vitals:ie(this.Ws)?this.Ws:void 0;return ie(t)?t:this.Es}startIfEnabled(){this.isEnabled&&!this.bs&&(xo.info("enabled, starting..."),this.nr(this.Us))}onRemoteConfig(e){if("capturePerformance"in e){var t=V(e.capturePerformance)&&!!e.capturePerformance.web_vitals,i=V(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Yt]:t}),this._instance.persistence.register({[Zt]:i})),this.Es=t,this.startIfEnabled()}}nr(e){var t,i;null!=(t=F.__PosthogExtensions__)&&t.postHogWebVitalsCallbacks?e():null==(i=F.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",t=>{t?xo.error("failed to load script",t):e()})}zs(){var e=m?m.location.href:void 0;if(e){var t=this._instance.config.custom_personal_data_properties,i=this._instance.config.mask_personal_data_properties?[...Es,...t||[]]:[];return bs(e,i,Ss)}xo.error("Could not determine current URL")}}},ha={exceptionObserver:class{constructor(e){var t,i,s;this.Us=()=>{var e;if(m&&this.isEnabled&&null!=(e=F.__PosthogExtensions__)&&e.errorWrappingFunctions){var t=F.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=F.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=F.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Gs&&this.Rt.capture_unhandled_errors&&(this.Gs=t(this.captureException.bind(this))),!this.Xs&&this.Rt.capture_unhandled_rejections&&(this.Xs=i(this.captureException.bind(this))),!this.Js&&this.Rt.capture_console_errors&&(this.Js=s(this.captureException.bind(this)))}catch(e){yo.error("failed to start",e),this.Ks()}}},this._instance=e,this.Qs=!(null==(t=this._instance.persistence)||!t.props[Gt]),this.eo=new ve({refillRate:null!==(i=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)&&void 0!==i?i:1,bucketSize:null!==(s=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)&&void 0!==s?s:10,refillInterval:1e4,qt:yo}),this.Rt=this.ro(),this.startIfEnabledOrStop()}ro(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return V(e)?t=I({},t,e):(Y(e)?this.Qs:e)&&(t=I({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.Rt.capture_console_errors||this.Rt.capture_unhandled_errors||this.Rt.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(yo.info("enabled"),this.Ks(),this.nr(this.Us)):this.Ks()}nr(e){var t,i;null!=(t=F.__PosthogExtensions__)&&t.errorWrappingFunctions&&e(),null==(i=F.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",t=>{if(t)return yo.error("failed to load script",t);e()})}Ks(){var e,t,i;null==(e=this.Gs)||e.call(this),this.Gs=void 0,null==(t=this.Xs)||t.call(this),this.Xs=void 0,null==(i=this.Js)||i.call(this),this.Js=void 0}onRemoteConfig(e){"autocaptureExceptions"in e&&(this.Qs=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Gt]:this.Qs}),this.Rt=this.ro(),this.startIfEnabledOrStop())}onConfigChange(){this.Rt=this.ro()}captureException(e){var t,i,s,r=null!==(t=null==e||null==(i=e.$exception_list)||null==(i=i[0])?void 0:i.type)&&void 0!==t?t:"Exception";this.eo.consumeRateLimit(r)?yo.info("Skipping exception capture because of client rate limiting.",{exception:r}):null==(s=this._instance.exceptions)||s.sendExceptionEvent(e)}},exceptions:class{constructor(e){var t,i;this.io=[],this.no=new dt([new kt,new Mt,new Pt,new St,new Tt,new Ct,new Ft,new It],function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;t>s;s++)i[s-1]=arguments[s];return function(t,s){void 0===s&&(s=0);for(var r=[],n=t.split("\n"),o=s;n.length>o;o++){var a=n[o];if(1024>=a.length){var l=Et.test(a)?a.replace(Et,"$1"):a;if(!l.match(/\S*Error: /)){for(var u of i){var c=u(l,e);if(c){r.push(c);break}}if(r.length>=50)break}}}return function(e){if(!e.length)return[];var t=Array.from(e);return t.reverse(),t.slice(0,50).map(e=>{return I({},e,{filename:e.filename||(i=t,i[i.length-1]||{}).filename,function:e.function||pt});var i})}(r)}}("web:javascript",yt,xt)),this._instance=e,this.io=null!==(t=null==(i=this._instance.persistence)?void 0:i.get_property(Vt))&&void 0!==t?t:[]}onRemoteConfig(e){var t,i,s;if("errorTracking"in e){var r=null!==(t=null==(i=e.errorTracking)?void 0:i.suppressionRules)&&void 0!==t?t:[],n=null==(s=e.errorTracking)?void 0:s.captureExtensionExceptions;this.io=r,this._instance.persistence&&this._instance.persistence.register({[Vt]:this.io,[Kt]:n})}}get so(){var e,t=!!this._instance.get_property(Kt),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(e=null!=i?i:t)&&void 0!==e&&e}buildProperties(e,t){return this.no.buildFromUnknown(e,{syntheticException:null==t?void 0:t.syntheticException,mechanism:{handled:null==t?void 0:t.handled}})}sendExceptionEvent(e){var t=e.$exception_list;if(this.oo(t)){if(this.ao(t))return void sa.info("Skipping exception capture because a suppression rule matched");if(!this.so&&this.lo(t))return void sa.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.uo(t))return void sa.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent",zi:!0})}ao(e){if(0===e.length)return!1;var t=e.reduce((e,t)=>{var{type:i,value:s}=t;return X(i)&&i.length>0&&e.$exception_types.push(i),X(s)&&s.length>0&&e.$exception_values.push(s),e},{$exception_types:[],$exception_values:[]});return this.io.some(e=>{var i=e.values.map(e=>{var i,s=on[e.operator],r=B(e.value)?e.value:[e.value],n=null!==(i=t[e.key])&&void 0!==i?i:[];return r.length>0&&s(r,n)});return"OR"===e.type?i.some(Boolean):i.every(Boolean)})}lo(e){return e.flatMap(e=>{var t,i;return null!==(t=null==(i=e.stacktrace)?void 0:i.frames)&&void 0!==t?t:[]}).some(e=>e.filename&&e.filename.startsWith("chrome-extension://"))}uo(e){if(e.length>0){var t,i,s,r,n=null!==(t=null==(i=e[0].stacktrace)?void 0:i.frames)&&void 0!==t?t:[],o=n[n.length-1];return null!==(s=null==o||null==(r=o.filename)?void 0:r.includes("posthog.com/static"))&&void 0!==s&&s}return!1}oo(e){return!Q(e)&&B(e)}}},da=I({productTours:class{get Kr(){return this._instance.persistence}constructor(e){this.ho=null,this.co=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){"productTours"in e&&(this.Kr&&this.Kr.register({[Jt]:!!e.productTours}),this.loadIfEnabled())}loadIfEnabled(){var e,t;this.ho||(e=this._instance).config.disable_product_tours||null==(t=e.persistence)||!t.get_property(Jt)||this.nr(()=>this.do())}nr(e){var t,i;null!=(t=F.__PosthogExtensions__)&&t.generateProductTours?e():null==(i=F.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"product-tours",t=>{t?To.error("Could not load product tours script",t):e()})}do(){var e;!this.ho&&null!=(e=F.__PosthogExtensions__)&&e.generateProductTours&&(this.ho=F.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(void 0===t&&(t=!1),!B(this.co)||t){var i=this.Kr;if(i){var s=i.props[Io];if(B(s)&&!t)return this.co=s,void e(s,{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 s=t.statusCode;if(200!==s||!t.json){var r="Product Tours API could not be loaded, status: "+s;return To.error(r),void e([],{isLoaded:!1,error:r})}var n=B(t.json.product_tours)?t.json.product_tours:[];this.co=n,i&&i.register({[Io]:n}),e(n,{isLoaded:!0})}})}else e(this.co,{isLoaded:!0})}getActiveProductTours(e){Q(this.ho)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.ho.getActiveProductTours(e)}showProductTour(e){var t;null==(t=this.ho)||t.showTourById(e)}previewTour(e){this.ho?this.ho.previewTour(e):this.nr(()=>{var t;this.do(),null==(t=this.ho)||t.previewTour(e)})}dismissProductTour(){var e;null==(e=this.ho)||e.dismissTour("user_clicked_skip")}nextStep(){var e;null==(e=this.ho)||e.nextStep()}previousStep(){var e;null==(e=this.ho)||e.previousStep()}clearCache(){var e;this.co=null,null==(e=this.Kr)||e.unregister(Io)}resetTour(e){var t;null==(t=this.ho)||t.resetTour(e)}resetAllTours(){var e;null==(e=this.ho)||e.resetAllTours()}cancelPendingTour(e){var t;null==(t=this.ho)||t.cancelPendingTour(e)}}},la),pa={siteApps:class{constructor(e){this._instance=e,this.vo=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}fo(e,t){if(t){var i=this.globalsForEvent(t);this.vo.push(i),this.vo.length>1e3&&(this.vo=this.vo.slice(10))}}get siteAppLoaders(){var e;return null==(e=F._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.siteApps}initialize(){if(this.isEnabled){var e=this._instance._addCaptureHook(this.fo.bind(this));this.po=()=>{e(),this.vo=[],this.po=void 0}}}globalsForEvent(e){var t,i,s,r,n,o,a;if(!e)throw new Error("Event payload is required");var l={},u=this._instance.get_property("$groups")||[],c=this._instance.get_property("$stored_group_properties")||{};for(var[h,d]of Object.entries(c))l[h]={id:u[h],type:h,properties:d};var{$set_once:p,$set:v}=e;return{event:I({},M(e,Mo),{properties:I({},e.properties,v?{$set:I({},null!==(t=null==(i=e.properties)?void 0:i.$set)&&void 0!==t?t:{},v)}:{},p?{$set_once:I({},null!==(s=null==(r=e.properties)?void 0:r.$set_once)&&void 0!==s?s:{},p)}:{}),elements_chain:null!==(n=null==(o=e.properties)?void 0:o.$elements_chain)&&void 0!==n?n:"",distinct_id:null==(a=e.properties)?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}setupSiteApp(e){var t=this.apps[e.id],i=()=>{var i;!t.errored&&this.vo.length&&(Ao.info("Processing "+this.vo.length+" events for site app with id "+e.id),this.vo.forEach(e=>null==t.processEvent?void 0:t.processEvent(e)),t.processedBuffer=!0),Object.values(this.apps).every(e=>e.processedBuffer||e.errored)&&(null==(i=this.po)||i.call(this))},s=!1,r=r=>{t.errored=!r,t.loaded=!0,Ao.info("Site app with id "+e.id+" "+(r?"loaded":"errored")),s&&i()};try{var{processEvent:n}=e.init({posthog:this._instance,callback(e){r(e)}});n&&(t.processEvent=n),s=!0}catch(t){Ao.error(Lo+e.id,t),r(!1)}if(s&&t.loaded)try{i()}catch(i){Ao.error("Error while processing buffered events PostHog app with config id "+e.id,i),t.errored=!0}}mo(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var i of e)this.setupSiteApp(i)}yo(e){if(0!==Object.keys(this.apps).length){var t=this.globalsForEvent(e);for(var i of Object.values(this.apps))try{null==i.processEvent||i.processEvent(t)}catch(t){Ao.error("Error while processing event "+e.event+" for site app "+i.id,t)}}}onRemoteConfig(e){var t,i,s,r=this;if(null!=(t=this.siteAppLoaders)&&t.length)return this.isEnabled?(this.mo(),void this._instance.on("eventCaptured",e=>this.yo(e))):void Ao.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this.po)||i.call(this),null!=(s=e.siteApps)&&s.length)if(this.isEnabled){var n=function(e){var t;F["__$$ph_site_app_"+e]=r._instance,null==(t=F.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(r._instance,a,t=>{if(t)return Ao.error(Lo+e,t)})};for(var{id:o,url:a}of e.siteApps)n(o)}else Ao.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},va={tracingHeaders:class{constructor(e){this.bo=void 0,this.wo=void 0,this.Us=()=>{var e,t;Y(this.bo)&&(null==(e=F.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)||e._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),Y(this.wo)&&(null==(t=F.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)||t._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=e}initialize(){this.startIfEnabledOrStop()}nr(e){var t,i;null!=(t=F.__PosthogExtensions__)&&t.tracingHeadersPatchFns&&e(),null==(i=F.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",t=>{if(t)return wo.error("failed to load script",t);e()})}startIfEnabledOrStop(){var e,t;this._instance.config.__add_tracing_headers?this.nr(this.Us):(null==(e=this.bo)||e.call(this),null==(t=this.wo)||t.call(this),this.bo=void 0,this.wo=void 0)}}},ga=I({surveys:class{get Rt(){return this._instance.config}constructor(e){this._o=void 0,this._surveyManager=null,this.Io=!1,this.Co=[],this.So=null,this._instance=e,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this.Rt.disable_surveys){var t=e.surveys;if(Q(t))return dn.warn("Flags not loaded yet. Not loading surveys.");var i=B(t);this._o=i?t.length>0:t,dn.info("flags response received, isSurveysEnabled: "+this._o),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var i=localStorage.key(t);(null!=i&&i.startsWith(pn)||null!=i&&i.startsWith("inProgressSurvey_"))&&e.push(i)}e.forEach(e=>localStorage.removeItem(e))}loadIfEnabled(){if(!this._surveyManager)if(this.Io)dn.info("Already initializing surveys, skipping...");else if(this.Rt.disable_surveys)dn.info(Uo);else if(this.Rt.cookieless_mode&&this._instance.consent.isOptedOut())dn.info("Not loading surveys in cookieless mode without consent.");else{var e=null==F?void 0:F.__PosthogExtensions__;if(e){if(!Y(this._o)||this.Rt.advanced_enable_surveys){var t=this._o||this.Rt.advanced_enable_surveys;this.Io=!0;try{var i=e.generateSurveys;if(i)return void this.ko(i,t);var s=e.loadExternalDependency;if(!s)return void this.xo(xi);s(this._instance,"surveys",i=>{i||!e.generateSurveys?this.xo("Could not load surveys script",i):this.ko(e.generateSurveys,t)})}catch(e){throw this.xo("Error initializing surveys",e),e}finally{this.Io=!1}}}else dn.error("PostHog Extensions not found.")}}ko(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new Wo(this._instance),dn.info("Surveys loaded successfully"),this.To({isLoaded:!0})}xo(e,t){dn.error(e,t),this.To({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Co.push(e),this._surveyManager&&this.To({isLoaded:!0}),()=>{this.Co=this.Co.filter(t=>t!==e)}}getSurveys(e,t){if(void 0===t&&(t=!1),this.Rt.disable_surveys)return dn.info(Uo),e([]);var i,s=this._instance.get_property(ai);if(s&&!t)return e(s,{isLoaded:!0});"undefined"!=typeof Promise&&this.So?this.So.then(t=>{var{surveys:i,context:s}=t;return e(i,s)}):("undefined"!=typeof Promise&&(this.So=new Promise(e=>{i=e})),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Rt.token),method:"GET",timeout:this.Rt.surveys_request_timeout_ms,callback:t=>{var s;this.So=null;var r=t.statusCode;if(200!==r||!t.json){var n="Surveys API could not be loaded, status: "+r;dn.error(n);var o={isLoaded:!1,error:n};return e([],o),void(null==i||i({surveys:[],context:o}))}var a,l=t.json.surveys||[],u=l.filter(e=>{return!(!(t=e).start_date||t.end_date)&&(function(e){var t;return!(null==(t=e.conditions)||null==(t=t.events)||null==(t=t.values)||!t.length)}(e)||function(e){var t;return!(null==(t=e.conditions)||null==(t=t.actions)||null==(t=t.values)||!t.length)}(e));var t});u.length>0&&(null==(a=this._surveyEventReceiver)||a.register(u)),null==(s=this._instance.persistence)||s.register({[ai]:l});var c={isLoaded:!0};e(l,c),null==i||i({surveys:l,context:c})}}))}To(e){for(var t of this.Co)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(e){dn.error("Error in survey callback",e)}}getActiveMatchingSurveys(e,t){if(void 0===t&&(t=!1),!Q(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);dn.warn("init was not called")}Ao(e){var t=null;return this.getSurveys(i=>{var s;t=null!==(s=i.find(t=>t.id===e))&&void 0!==s?s:null}),t}Eo(e){if(Q(this._surveyManager))return{eligible:!1,reason:Ho};var t="string"==typeof e?this.Ao(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(Q(this._surveyManager))return dn.warn("init was not called"),{visible:!1,disabledReason:Ho};var t=this.Eo(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return Q(this._surveyManager)?(dn.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Ho})):new Promise(i=>{this.getSurveys(t=>{var s,r=null!==(s=t.find(t=>t.id===e))&&void 0!==s?s:null;if(r){var n=this.Eo(r);i({visible:n.eligible,disabledReason:n.reason})}else i({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t,i){var s;if(Q(this._surveyManager))dn.warn("init was not called");else{var r="string"==typeof e?this.Ao(e):e;if(null!=r&&r.id)if(_n.includes(r.type)){var n=null==w?void 0:w.querySelector(t);if(n)return null!=(s=r.appearance)&&s.surveyPopupDelaySeconds?(dn.info("Rendering survey "+r.id+" with delay of "+r.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout(()=>{var e,t;dn.info("Rendering survey "+r.id+" with delay of "+(null==(e=r.appearance)?void 0:e.surveyPopupDelaySeconds)+" seconds"),null==(t=this._surveyManager)||t.renderSurvey(r,n,i),dn.info("Survey "+r.id+" rendered")},1e3*r.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(r,n,i);dn.warn("Survey element not found")}else dn.warn("Surveys of type "+r.type+" cannot be rendered in the app");else dn.warn("Survey not found")}}displaySurvey(e,t){var i;if(Q(this._surveyManager))dn.warn("init was not called");else{var s=this.Ao(e);if(s){var r=s;if(null!=(i=s.appearance)&&i.surveyPopupDelaySeconds&&t.ignoreDelay&&(r=I({},s,{appearance:I({},s.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==er&&t.initialResponses&&dn.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===t.ignoreConditions){var n=this.canRenderSurvey(s);if(!n.visible)return void dn.warn("Survey is not eligible to be displayed: ",n.disabledReason)}t.displayType!==tr?this._surveyManager.handlePopoverSurvey(r,t):this.renderSurvey(r,t.selector,t.properties)}else dn.warn("Survey not found")}}cancelPendingSurvey(e){Q(this._surveyManager)?dn.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;null==(e=this._surveyManager)||e.handlePageUnload()}}},la),_a={toolbar:class{constructor(e){this.instance=e}Ro(e){F.ph_toolbar_state=e}No(){var e;return null!==(e=F.ph_toolbar_state)&&void 0!==e?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,t,i){if(void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===i&&(i=void 0),zi(this.instance.config))return!1;if(!m||!w)return!1;e=null!=e?e:m.location,i=null!=i?i:m.history;try{if(!t){try{m.localStorage.setItem("test","test"),m.localStorage.removeItem("test")}catch(e){return!1}t=null==m?void 0:m.localStorage}var s,r=zo||ws(e.hash,"__posthog")||ws(e.hash,"state"),n=r?ji(()=>JSON.parse(atob(decodeURIComponent(r))))||ji(()=>JSON.parse(decodeURIComponent(r))):null;return n&&"ph_authorize"===n.action?((s=n).source="url",s&&Object.keys(s).length>0&&(n.desiredHash?e.hash=n.desiredHash:i?i.replaceState(i.state,"",e.pathname+e.search):e.hash="")):((s=JSON.parse(t.getItem(Bo)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token||(this.loadToolbar(s),0))}catch(e){return!1}}Mo(e){var t=F.ph_load_toolbar||F.ph_load_editor;!Q(t)&&G(t)?t(e,this.instance):Go.warn("No toolbar load function found")}loadToolbar(e){var t=!(null==w||!w.getElementById(yi));if(!m||t)return!1;var i="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=I({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},i?{instrument:!1}:{});if(m.localStorage.setItem(Bo,JSON.stringify(I({},s,{source:void 0}))),2===this.No())this.Mo(s);else if(0===this.No()){var r;this.Ro(1),null==(r=F.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this.instance,"toolbar",e=>{if(e)return Go.error("[Toolbar] Failed to load",e),void this.Ro(0);this.Ro(2),this.Mo(s)}),Ui(m,"turbolinks:load",()=>{this.Ro(0),this.loadToolbar(s)})}return!0}Fo(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,i){return void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===i&&(i=void 0),this.maybeLoadToolbar(e,t,i)}}},fa=I({experiments:class e{get Rt(){return this._instance.config}constructor(t){var i=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),i.getWebExperiments(t=>{e.Fn("retrieved web experiments from the server"),i.On=new Map,t.forEach(t=>{if(t.feature_flag_key){var s;i.On&&(e.Fn("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(s=i.On)||s.set(t.feature_flag_key,t));var r=i._instance.getFeatureFlag(t.feature_flag_key);X(r)&&t.variants[r]&&i.Pn(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var n in t.variants){var o=t.variants[n];e.Ln(o)&&i.Pn(t.name,n,o.transforms)}})},t)},this._instance=t,this._instance.onFeatureFlags(e=>{this.onFeatureFlags(e)})}initialize(){}onFeatureFlags(t){if(this._is_bot())e.Fn(ra);else if(!this.Rt.disable_web_experiments){if(Q(this.On))return this.On=new Map,this.loadIfEnabled(),void this.previewWebExperiment();e.Fn("applying feature flags",t),t.forEach(e=>{var t;if(this.On&&null!=(t=this.On)&&t.has(e)){var i,s=this._instance.getFeatureFlag(e),r=null==(i=this.On)?void 0:i.get(e);s&&null!=r&&r.variants[s]&&this.Pn(r.name,s,r.variants[s].transforms)}})}}previewWebExperiment(){var t=e.getWindowLocation();if(null!=t&&t.search){var i=ys(null==t?void 0:t.search,"__experiment_id"),s=ys(null==t?void 0:t.search,"__experiment_variant");i&&s&&(e.Fn("previewing web experiments "+i+" && "+s),this.getWebExperiments(e=>{this.Dn(parseInt(i),s,e)},!1,!0))}}loadIfEnabled(){this.Rt.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,i){if(this.Rt.disable_web_experiments&&!i)return e([]);var s=this._instance.get_property("$web_experiments");if(s&&!t)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Rt.token),method:"GET",callback:t=>e(200===t.statusCode&&t.json&&t.json.experiments||[])})}Dn(t,i,s){var r=s.filter(e=>e.id===t);r&&r.length>0&&(e.Fn("Previewing web experiment ["+r[0].name+"] with variant ["+i+"]"),this.Pn(r[0].name,i,r[0].variants[i].transforms))}static Ln(t){return!Q(t.conditions)&&e.Bn(t)&&e.jn(t)}static Bn(t){var i;if(Q(t.conditions)||Q(null==(i=t.conditions)?void 0:i.url))return!0;var s,r,n,o=e.getWindowLocation();return!!o&&(null==(s=t.conditions)||!s.url||na[null!==(r=null==(n=t.conditions)?void 0:n.urlMatchType)&&void 0!==r?r:"icontains"](t.conditions.url,o))}static getWindowLocation(){return null==m?void 0:m.location}static jn(e){var t;if(Q(e.conditions)||Q(null==(t=e.conditions)?void 0:t.utm))return!0;var i=Rs();if(i.utm_source){var s,r,n,o,a,l,u,c,h=null==(s=e.conditions)||null==(s=s.utm)||!s.utm_campaign||(null==(r=e.conditions)||null==(r=r.utm)?void 0:r.utm_campaign)==i.utm_campaign,d=null==(n=e.conditions)||null==(n=n.utm)||!n.utm_source||(null==(o=e.conditions)||null==(o=o.utm)?void 0:o.utm_source)==i.utm_source,p=null==(a=e.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=e.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==i.utm_medium,v=null==(u=e.conditions)||null==(u=u.utm)||!u.utm_term||(null==(c=e.conditions)||null==(c=c.utm)?void 0:c.utm_term)==i.utm_term;return h&&p&&v&&d}return!1}static Fn(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;t>s;s++)i[s-1]=arguments[s];Lt.info("[WebExperiments] "+e,i)}Pn(t,i,s){this._is_bot()?e.Fn(ra):"control"!==i?s.forEach(s=>{if(s.selector){var r;e.Fn("applying transform of variant "+i+" for experiment "+t+" ",s);var n=null==(r=document)?void 0:r.querySelectorAll(s.selector);null==n||n.forEach(e=>{var t=e;s.html&&(t.innerHTML=s.html),s.css&&t.setAttribute("style",s.css)})}}):e.Fn("Control variants leave the page unmodified.")}_is_bot(){return b&&this._instance?sn(b,this.Rt.custom_blocked_useragents):void 0}}},la),ma={conversations:class{constructor(e){this.Oo=void 0,this._conversationsManager=null,this.Po=!1,this.Lo=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations){var t=e.conversations;Q(t)||(ie(t)?this.Oo=t:(this.Oo=t.enabled,this.Lo=t),this.loadIfEnabled())}}reset(){var e;null==(e=this._conversationsManager)||e.reset(),this._conversationsManager=null,this.Oo=void 0,this.Lo=null}loadIfEnabled(){if(!(this._conversationsManager||this.Po||this._instance.config.disable_conversations||zi(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=null==F?void 0:F.__PosthogExtensions__;if(e&&!Y(this.Oo)&&this.Oo)if(this.Lo&&this.Lo.token){this.Po=!0;try{var t=e.initConversations;if(t)return this.Do(t),void(this.Po=!1);var i=e.loadExternalDependency;if(!i)return void this.Bo(xi);i(this._instance,"conversations",t=>{t||!e.initConversations?this.Bo("Could not load conversations script",t):this.Do(e.initConversations),this.Po=!1})}catch(e){this.Bo("Error initializing conversations",e),this.Po=!1}}else oa.error("Conversations enabled but missing token in remote config.")}}Do(e){if(this.Lo)try{this._conversationsManager=e(this.Lo,this._instance),oa.info("Conversations loaded successfully")}catch(e){this.Bo("Error completing conversations initialization",e)}else oa.error("Cannot complete initialization: remote config is null")}Bo(e,t){oa.error(e,t),this._conversationsManager=null,this.Po=!1}show(){this._conversationsManager?this._conversationsManager.show():oa.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Oo&&!Z(this._conversationsManager)}isVisible(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.isVisible())&&void 0!==e&&e}sendMessage(e,t,i){var s=this;return T(function*(){return s._conversationsManager?s._conversationsManager.sendMessage(e,t,i):(oa.warn(aa),null)})()}getMessages(e,t){var i=this;return T(function*(){return i._conversationsManager?i._conversationsManager.getMessages(e,t):(oa.warn(aa),null)})()}markAsRead(e){var t=this;return T(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(oa.warn(aa),null)})()}getTickets(e){var t=this;return T(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(oa.warn(aa),null)})()}requestRestoreLink(e){var t=this;return T(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(oa.warn(aa),null)})()}restoreFromToken(e){var t=this;return T(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(oa.warn(aa),null)})()}restoreFromUrlToken(){var e=this;return T(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(oa.warn(aa),null)})()}getCurrentTicketId(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.getCurrentTicketId())&&void 0!==e?e:null}getWidgetSessionId(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.getWidgetSessionId())&&void 0!==e?e:null}Ki(){var e;null==(e=this._conversationsManager)||e.setIdentity()}Qi(){var e;null==(e=this._conversationsManager)||e.clearIdentity()}}},ya={logs:class{constructor(e){var t;this.jo=!1,this.qo=!1,this._instance=e,this._instance&&null!=(t=this._instance.config.logs)&&t.captureConsoleLogs&&(this.jo=!0)}initialize(){this.loadIfEnabled()}onRemoteConfig(e){var t,i=null==(t=e.logs)?void 0:t.captureConsoleLogs;!Q(i)&&i&&(this.jo=!0,this.loadIfEnabled())}reset(){}loadIfEnabled(){if(this.jo&&!this.qo){var e=Dt("[logs]"),t=null==F?void 0:F.__PosthogExtensions__;if(t){var i=t.loadExternalDependency;i?i(this._instance,"logs",i=>{var s;i||null==(s=t.logs)||!s.initializeLogs?e.error("Could not load logs script",i):(t.logs.initializeLogs(this._instance),this.qo=!0)}):e.error(xi)}else e.error("PostHog Extensions not found.")}}}},ba=I({},la,ua,ca,ha,da,pa,ga,va,_a,fa,ma,ya);An.__defaultExtensionClasses=I({},ba);var wa=(jo=wn[$n]=new An,function(){function e(){e.done||(e.done=!0,On=!1,Ai(wn,function(e){e._dom_loaded()}))}null!=w&&w.addEventListener?"complete"===w.readyState?e():Ui(w,"DOMContentLoaded",e,{capture:!1}):m&&Lt.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),jo),xa={};function Ea(e){var t;return null!=(t=null==e?void 0:e.posthog)?t:wa}var ka,Sa={type:"posthog",config:{},async init({config:e,env:t}){const i=e.settings;if(!(null==i?void 0:i.apiKey))return!1;const s=Ea(t),{apiKey:r,identify:n,group:o,_state:a,...l}=i,u={autocapture:!1,capture_pageview:!1,capture_pageleave:!1,...l};let c=!1;s.init(r,{...u,loaded:()=>{c=!0}}),c||await Promise.resolve();return{...e,settings:{...i,_state:{lastIdentity:{},lastGroup:{}}}}},async push(e,{config:t,rule:i,env:s,data:r,collector:n}){var o,a;const l=Ea(s),u=t.settings||{},d=(null==i?void 0:i.settings)||{},p=u._state||{};if(void 0!==d.reset){("boolean"==typeof d.reset?d.reset:await _(e,d.reset,{collector:n}))&&(l.reset(),p.lastIdentity={},p.lastGroup={})}const v=null!=(o=d.identify)?o:u.identify;if(void 0!==v){const t=await _(e,v,{collector:n});c(t)&&(p.lastIdentity=function(e,t,i={}){const s={...i},r=t.distinctId,n=c(t.$set)?t.$set:void 0,o=c(t.$set_once)?t.$set_once:void 0;return h(r)&&""!==r?(r!==i.distinctId||n||o)&&(e.identify(r,n,o),s.distinctId=r):(n||o)&&e.setPersonProperties(n,o),s}(l,t,p.lastIdentity))}const g=null!=(a=d.group)?a:u.group;if(void 0!==g){const t=await _(e,g,{collector:n});c(t)&&(p.lastGroup=function(e,t,i={}){const s={...i},r=t.type,n=t.key,o=c(t.properties)?t.properties:void 0;return h(r)&&h(n)&&(r!==i.type||n!==i.key||o)&&(e.group(r,n,o),s.type=r,s.key=n),s}(l,t,p.lastGroup))}if(!0!==(null==i?void 0:i.silent)){const t=h(null==i?void 0:i.name)?i.name:e.name,s=c(r)?r:{};l.capture(t,s)}u._state=p},on(e,t){var i;if("consent"!==e||!(null==t?void 0:t.data))return;const s=Ea(t.env),r=t.data,n=null==(i=t.config)?void 0:i.consent;if(!n||0===Object.keys(n).length)return;Object.keys(n).every(e=>!0===r[e])?s.opt_in_capturing():s.opt_out_capturing()}},Pa=Sa;return ka=r,((r,n,o,a)=>{if(n&&"object"==typeof n||"function"==typeof n)for(let l of i(n))s.call(r,l)||l===o||e(r,l,{get:()=>n[l],enumerable:!(a=t(n,l))||a.enumerable});return r})(e({},"__esModule",{value:!0}),ka)})();
1
+ "use strict";var Destination=(()=>{var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,s=Object.prototype.hasOwnProperty,r={};((t,i)=>{for(var s in i)e(t,s,{get:i[s],enumerable:!0})})(r,{DestinationPostHog:()=>xa,default:()=>Pa,destinationPostHog:()=>Sa});var n=Object.defineProperty;((e,t)=>{for(var i in t)n(e,i,{get:t[i],enumerable:!0})})({},{Level:()=>a});var o,a=((o=a||{})[o.ERROR=0]="ERROR",o[o.WARN=1]="WARN",o[o.INFO=2]="INFO",o[o.DEBUG=3]="DEBUG",o);function l(e){return Array.isArray(e)}function u(e){return void 0!==e}function c(e){return"object"==typeof e&&null!==e&&!l(e)&&"[object Object]"===Object.prototype.toString.call(e)}function h(e){return"string"==typeof e}function d(e,t="",i){const s=t.split(".");let r=e;for(let e=0;e<s.length;e++){const t=s[e];if("*"===t&&l(r)){const t=s.slice(e+1).join("."),n=[];for(const e of r){const s=d(e,t,i);n.push(s)}return n}if(r=r instanceof Object?r[t]:void 0,void 0===r)break}return u(r)?r:i}function p(e){return function(e){return"boolean"==typeof e}(e)||h(e)||function(e){return"number"==typeof e&&!Number.isNaN(e)}(e)||!u(e)||l(e)&&e.every(p)||c(e)&&Object.values(e).every(p)}function v(e){return p(e)?e:void 0}function g(e,t,i){return async function(...s){try{return await e(...s)}catch(e){if(!t)return;return await t(e)}finally{await(null==i?void 0:i())}}}async function _(e,t={},i={}){var s,r;if(!u(e))return;const n=c(e)&&e.consent||i.consent||(null==(s=i.collector)?void 0:s.consent),o=null!=(r=i.event)?r:c(e)?e:{};if(!i.collector)throw new Error("getMappingValue: context.collector is required");const a={event:o,mapping:t,collector:i.collector,logger:i.collector.logger,consent:n},h=l(t)?t:[t];for(const t of h){const i=await g(f)(e,t,{...a,mapping:t});if(u(i))return i}}async function f(e,t,i){return(l(t)?t:[t]).reduce(async(t,s)=>{const r=await t;if(r)return r;const n=h(s)?{key:s}:s;if(!Object.keys(n).length)return;const{condition:o,consent:a,fn:c,key:p,loop:m,map:y,set:b,validate:w,value:x}=n,E={...i,mapping:s};if(o&&!await g(o)(e,E))return;if(a&&!function(e,t={},i={}){const s={...t,...i},r={};let n=!e||0===Object.keys(e).length;return Object.keys(s).forEach(t=>{s[t]&&(r[t]=!0,e&&e[t]&&(n=!0))}),!!n&&r}(a,E.consent))return x;let k=u(x)?x:e;if(c&&(k=await g(c)(e,E)),p&&(k=d(e,p,x)),m){const[t,i]=m,s="this"===t?[e]:await _(e,t,E);l(s)&&(k=(await Promise.all(s.map(e=>_(e,i,E)))).filter(u))}else y?k=await Object.entries(y).reduce(async(t,[i,s])=>{const r=await t,n=await _(e,s,E);return u(n)&&(r[i]=n),r},Promise.resolve({})):b&&(k=await Promise.all(b.map(t=>f(e,t,E))));w&&!await g(w)(k,E)&&(k=void 0);const S=v(k);return u(S)?S:v(x)},Promise.resolve(void 0))}var m="undefined"!=typeof window?window:void 0,y="undefined"!=typeof globalThis?globalThis:m;"undefined"==typeof self&&(y.self=y),"undefined"==typeof File&&(y.File=function(){});var b=null==y?void 0:y.navigator,w=null==y?void 0:y.document,x=null==y?void 0:y.location,E=null==y?void 0:y.fetch,k=null!=y&&y.XMLHttpRequest&&"withCredentials"in new y.XMLHttpRequest?y.XMLHttpRequest:void 0,S=null==y?void 0:y.AbortController,P=null==y?void 0:y.CompressionStream,R=null==b?void 0:b.userAgent,F=null!=m?m:{},$="1.367.0",O={DEBUG:!1,LIB_VERSION:$,LIB_NAME:"web",JS_SDK_VERSION:$};function C(e,t,i,s,r,n,o){try{var a=e[n](o),l=a.value}catch(e){return void i(e)}a.done?t(l):Promise.resolve(l).then(s,r)}function T(e){return function(){var t=this,i=arguments;return new Promise(function(s,r){var n=e.apply(t,i);function o(e){C(n,s,r,o,a,"next",e)}function a(e){C(n,s,r,o,a,"throw",e)}o(void 0)})}}function I(){return I=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var i=arguments[t];for(var s in i)({}).hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e},I.apply(null,arguments)}function M(e,t){if(null==e)return{};var i={};for(var s in e)if({}.hasOwnProperty.call(e,s)){if(-1!==t.indexOf(s))continue;i[s]=e[s]}return i}function A(){return(A=T(function*(e,t){void 0===t&&(t=!0);try{var i=new Blob([e],{type:"text/plain"}).stream().pipeThrough(new CompressionStream("gzip"));return yield new Response(i).blob()}catch(e){return t&&console.error("Failed to gzip compress data",e),null}})).apply(this,arguments)}var L=["$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"],D=["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"],j=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var i=e.toLowerCase();return D.concat(t).some(e=>{var t=e.toLowerCase();return-1!==i.indexOf(t)})};function N(e,t){return-1!==e.indexOf(t)}var q=function(e){return e.trim()},W=function(e){return e.replace(/^\$/,"")},H=Object.prototype,U=H.hasOwnProperty,z=H.toString,B=Array.isArray||function(e){return"[object Array]"===z.call(e)},G=e=>"function"==typeof e,V=e=>e===Object(e)&&!B(e),K=e=>{if(V(e)){for(var t in e)if(U.call(e,t))return!1;return!0}return!1},Y=e=>void 0===e,X=e=>"[object String]"==z.call(e),J=e=>X(e)&&0===e.trim().length,Z=e=>null===e,Q=e=>Y(e)||Z(e),ee=e=>"[object Number]"==z.call(e)&&e==e,te=e=>ee(e)&&e>0,ie=e=>"[object Boolean]"===z.call(e),se=e=>N(L,e);function re(e){return null===e||"object"!=typeof e}function ne(e,t){return{}.toString.call(e)==="[object "+t+"]"}function oe(e){return"undefined"!=typeof Event&&function(e,t){try{return e instanceof t}catch(e){return!1}}(e,Event)}var ae=[!0,"true",1,"1","yes"],le=e=>N(ae,e),ue=[!1,"false",0,"0","no"];function ce(e,t,i,s,r){return t>i&&(s.warn("min cannot be greater than max."),t=i),ee(e)?e>i?(s.warn(" cannot be greater than max: "+i+". Using max value instead."),i):t>e?(s.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(s.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+r),ce(r||i,t,i,s))}var he,de,pe,ve=class{constructor(e){this.Pt={},this.Dt=e.Dt,this.jt=ce(e.bucketSize,0,100,e.qt),this.$t=ce(e.refillRate,0,this.jt,e.qt),this.Ht=ce(e.refillInterval,0,864e5,e.qt)}Vt(e,t){var i=Math.floor((t-e.lastAccess)/this.Ht);i>0&&(e.tokens=Math.min(e.tokens+i*this.$t,this.jt),e.lastAccess=e.lastAccess+i*this.Ht)}consumeRateLimit(e){var t,i=Date.now(),s=String(e),r=this.Pt[s];return r?this.Vt(r,i):this.Pt[s]=r={tokens:this.jt,lastAccess:i},0===r.tokens||(r.tokens--,0===r.tokens&&(null==(t=this.Dt)||t.call(this,e)),0===r.tokens)}stop(){this.Pt={}}},ge="Mobile",_e="iOS",fe="Android",me="Tablet",ye=fe+" "+me,be="iPad",we="Apple",xe=we+" Watch",Ee="Safari",ke="BlackBerry",Se="Samsung",Pe=Se+"Browser",Re=Se+" Internet",Fe="Chrome",$e=Fe+" OS",Oe=Fe+" "+_e,Ce="Internet Explorer",Te=Ce+" "+ge,Ie="Opera",Me=Ie+" Mini",Ae="Edge",Le="Microsoft "+Ae,De="Firefox",je=De+" "+_e,Ne="Nintendo",qe="PlayStation",We="Xbox",He=fe+" "+ge,Ue=ge+" "+Ee,ze="Windows",Be=ze+" Phone",Ge="Nokia",Ve="Ouya",Ke="Generic",Ye=Ke+" "+ge.toLowerCase(),Xe=Ke+" "+me.toLowerCase(),Je="Konqueror",Ze="(\\d+(\\.\\d+)?)",Qe=new RegExp("Version/"+Ze),et=new RegExp(We,"i"),tt=new RegExp(qe+" \\w+","i"),it=new RegExp(Ne+" \\w+","i"),st=new RegExp(ke+"|PlayBook|BB10","i"),rt={"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"},nt=function(e,t){return t=t||"",N(e," OPR/")&&N(e,"Mini")?Me:N(e," OPR/")?Ie:st.test(e)?ke:N(e,"IE"+ge)||N(e,"WPDesktop")?Te:N(e,Pe)?Re:N(e,Ae)||N(e,"Edg/")?Le:N(e,"FBIOS")?"Facebook "+ge:N(e,"UCWEB")||N(e,"UCBrowser")?"UC Browser":N(e,"CriOS")?Oe:N(e,"CrMo")||N(e,Fe)?Fe:N(e,fe)&&N(e,Ee)?He:N(e,"FxiOS")?je:N(e.toLowerCase(),Je.toLowerCase())?Je:(i=e,(s=t)&&N(s,we)||N(r=i,Ee)&&!N(r,Fe)&&!N(r,fe)?N(e,ge)?Ue:Ee:N(e,De)?De:N(e,"MSIE")||N(e,"Trident/")?Ce:N(e,"Gecko")?De:"");var i,s,r},ot={[Te]:[new RegExp("rv:"+Ze)],[Le]:[new RegExp(Ae+"?\\/"+Ze)],[Fe]:[new RegExp("("+Fe+"|CrMo)\\/"+Ze)],[Oe]:[new RegExp("CriOS\\/"+Ze)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Ze)],[Ee]:[Qe],[Ue]:[Qe],[Ie]:[new RegExp("(Opera|OPR)\\/"+Ze)],[De]:[new RegExp(De+"\\/"+Ze)],[je]:[new RegExp("FxiOS\\/"+Ze)],[Je]:[new RegExp("Konqueror[:/]?"+Ze,"i")],[ke]:[new RegExp(ke+" "+Ze),Qe],[He]:[new RegExp("android\\s"+Ze,"i")],[Re]:[new RegExp(Pe+"\\/"+Ze)],[Ce]:[new RegExp("(rv:|MSIE )"+Ze)],Mozilla:[new RegExp("rv:"+Ze)]},at=function(e,t){var i=nt(e,t),s=ot[i];if(Y(s))return null;for(var r=0;s.length>r;r++){var n=e.match(s[r]);if(n)return parseFloat(n[n.length-2])}return null},lt=[[new RegExp(We+"; "+We+" (.*?)[);]","i"),e=>[We,e&&e[1]||""]],[new RegExp(Ne,"i"),[Ne,""]],[new RegExp(qe,"i"),[qe,""]],[st,[ke,""]],[new RegExp(ze,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Be,""];if(new RegExp(ge).test(t)&&!/IEMobile\b/.test(t))return[ze+" "+ge,""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var s=rt[i[1]]||"";return/arm/i.test(t)&&(s="RT"),[ze,s]}return[ze,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[_e,[e[3],e[4],e[5]||"0"].join(".")]:[_e,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=Y(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+fe+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+fe+")","i"),e=>e&&e[2]?[fe,[e[2],e[3],e[4]||"0"].join(".")]:[fe,""]],[/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/,[$e,""]],[/Linux|debian/i,["Linux",""]]],ut=function(e){return it.test(e)?Ne:tt.test(e)?qe:et.test(e)?We:new RegExp(Ve,"i").test(e)?Ve:new RegExp("("+Be+"|WPDesktop)","i").test(e)?Be:/iPad/.test(e)?be:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?xe:st.test(e)?ke:/(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(ge).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)?fe:ye:new RegExp("(pda|"+ge+")","i").test(e)?Ye:new RegExp(me,"i").test(e)&&!new RegExp(me+" pc","i").test(e)?Xe:""},ct=e=>e instanceof Error;function ht(e){var t=globalThis._posthogChunkIds;if(t){var i=Object.keys(t);return pe&&i.length===de||(de=i.length,pe=i.reduce((i,s)=>{he||(he={});var r=he[s];if(r)i[r[0]]=r[1];else for(var n=e(s),o=n.length-1;o>=0;o--){var a=n[o],l=null==a?void 0:a.filename,u=t[s];if(l&&u){i[l]=u,he[s]=[l,u];break}}return i},{})),pe}}var dt=class{constructor(e,t,i){void 0===i&&(i=[]),this.coercers=e,this.stackParser=t,this.modifiers=i}buildFromUnknown(e,t){void 0===t&&(t={});var i=t&&t.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(i,t,0).apply(e),r=this.buildParsingContext(t),n=this.parseStacktrace(s,r);return{$exception_list:this.convertToExceptionList(n,i),$exception_level:"error"}}modifyFrames(e){var t=this;return T(function*(){for(var i of e)i.stacktrace&&i.stacktrace.frames&&B(i.stacktrace.frames)&&(i.stacktrace.frames=yield t.applyModifiers(i.stacktrace.frames));return e})()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:null==(t=e.syntheticException)?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var i,s;return null!=e.cause&&(i=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack&&(s=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),I({},e,{cause:i,stack:s})}applyChunkIds(e,t){return e.map(e=>(e.filename&&t&&(e.chunk_id=t[e.filename]),e))}applyCoercers(e,t){for(var i of this.coercers)if(i.match(e))return i.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return T(function*(){var i=e;for(var s of t.modifiers)i=yield s(i);return i})()}convertToExceptionList(e,t){var i,s,r,n={type:e.type,value:e.value,mechanism:{type:null!==(i=t.type)&&void 0!==i?i:"generic",handled:null===(s=t.handled)||void 0===s||s,synthetic:null!==(r=e.synthetic)&&void 0!==r&&r}};e.stack&&(n.stacktrace={type:"raw",frames:e.stack});var o=[n];return null!=e.cause&&o.push(...this.convertToExceptionList(e.cause,I({},t,{handled:!0}))),o}buildParsingContext(e){var t;return{chunkIdMap:ht(this.stackParser),skipFirstLines:null!==(t=e.skipFirstLines)&&void 0!==t?t:1}}buildCoercingContext(e,t,i){void 0===i&&(i=0);var s=(i,s)=>{if(4>=s){var r=this.buildCoercingContext(e,t,s);return this.applyCoercers(i,r)}};return I({},t,{syntheticException:0==i?t.syntheticException:void 0,mechanism:e,apply:e=>s(e,i),next:e=>s(e,i+1)})}},pt="?";function vt(e,t,i,s,r){var n={platform:e,filename:t,function:"<anonymous>"===i?pt:i,in_app:!0};return Y(s)||(n.lineno=s),Y(r)||(n.colno=r),n}var gt=(e,t)=>{var i=-1!==e.indexOf("safari-extension"),s=-1!==e.indexOf("safari-web-extension");return i||s?[-1!==e.indexOf("@")?e.split("@")[0]:pt,i?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},_t=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,ft=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,mt=/\((\S*)(?::(\d+))(?::(\d+))\)/,yt=(e,t)=>{var i=_t.exec(e);if(i){var[,s,r,n]=i;return vt(t,s,pt,+r,+n)}var o=ft.exec(e);if(o){if(o[2]&&0===o[2].indexOf("eval")){var a=mt.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,u]=gt(o[1]||pt,o[2]);return vt(t,u,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},bt=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,wt=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,xt=(e,t)=>{var i=bt.exec(e);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var s=wt.exec(i[3]);s&&(i[1]=i[1]||"eval",i[3]=s[1],i[4]=s[2],i[5]="")}var r=i[3],n=i[1]||pt;return[n,r]=gt(n,r),vt(t,r,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},Et=/\(error: (.*)\)/,kt=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var i=X(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:i?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?t+": "+e.message:t}isDOMException(e){return ne(e,"DOMException")}isDOMError(e){return ne(e,"DOMError")}},St=class{match(e){return e instanceof Error}coerce(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var i=e.message;return String(i.error&&"string"==typeof i.error.message?i.error.message:i)}getStack(e){return e.stacktrace||e.stack||void 0}},Pt=class{constructor(){}match(e){return ne(e,"ErrorEvent")&&null!=e.error}coerce(e,t){var i;return t.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}},Rt=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Ft=class{match(e){return"string"==typeof e}coerce(e,t){var i,[s,r]=this.getInfos(e);return{type:null!=s?s:"Error",value:null!=r?r:e,stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}getInfos(e){var t="Error",i=e,s=e.match(Rt);return s&&(t=s[1],i=s[2]),[t,i]}},$t=["fatal","error","warning","log","info","debug"];function Ot(e,t){void 0===t&&(t=40);var i=Object.keys(e);if(i.sort(),!i.length)return"[object has no keys]";for(var s=i.length;s>0;s--){var r=i.slice(0,s).join(", ");if(t>=r.length)return s===i.length?r:r.length>t?r.slice(0,t)+"...":r}return""}var Ct=class{match(e){return"object"==typeof e&&null!==e}coerce(e,t){var i,s=this.getErrorPropertyFromObject(e);return s?t.apply(s):{type:this.getType(e),value:this.getValue(e),stack:null==(i=t.syntheticException)?void 0:i.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return oe(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&"string"==typeof e.name){var t="'"+e.name+"' captured as exception";return"message"in e&&"string"==typeof e.message&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&"string"==typeof e.message)return e.message;var i=this.getObjectClassName(e);return(i&&"Object"!==i?"'"+i+"'":"Object")+" captured as exception with keys: "+Ot(e)}isSeverityLevel(e){return X(e)&&!J(e)&&$t.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if({}.hasOwnProperty.call(e,t)){var i=e[t];if(ct(i))return i}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}},Tt=class{match(e){return oe(e)}coerce(e,t){var i,s=e.constructor.name;return{type:s,value:s+" captured as exception with keys: "+Ot(e),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}},It=class{match(e){return re(e)}coerce(e,t){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}},Mt=class{match(e){return ne(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!oe(e))return!1;try{var t=e.detail;return null!=t&&"object"==typeof t&&"reason"in t}catch(e){return!1}}coerce(e,t){var i,s=this.getUnhandledRejectionReason(e);return re(s)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(s),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}:t.apply(s)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&null!=e.detail&&"object"==typeof e.detail&&"reason"in e.detail)return e.detail.reason}catch(e){}return e}},At=function(e,t){var{debugEnabled:i}=void 0===t?{}:t,s={C(t){if(m&&(O.DEBUG||F.POSTHOG_DEBUG||i)&&!Y(m.console)&&m.console){for(var s=("__rrweb_original__"in m.console[t]?m.console[t].__rrweb_original__:m.console[t]),r=arguments.length,n=new Array(r>1?r-1:0),o=1;r>o;o++)n[o-1]=arguments[o];s(e,...n)}},info(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s.C("log",...t)},warn(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s.C("warn",...t)},error(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s.C("error",...t)},critical(){for(var t=arguments.length,i=new Array(t),s=0;t>s;s++)i[s]=arguments[s];console.error(e,...i)},uninitializedWarning(e){s.error("You must initialize PostHog before calling "+e)},createLogger:(t,i)=>At(e+" "+t,i)};return s},Lt=At("[PostHog.js]"),Dt=Lt.createLogger,jt=Dt("[ExternalScriptsLoader]"),Nt=(e,t,i)=>{if(e.config.disable_external_dependency_loading)return jt.warn(t+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var s=null==w?void 0:w.querySelectorAll("script");if(s)for(var r,n=function(){if(s[o].src===t){var e=s[o];return e.__posthog_loading_callback_fired?{v:i()}:(e.addEventListener("load",t=>{e.__posthog_loading_callback_fired=!0,i(void 0,t)}),e.onerror=e=>i(e),{v:void 0})}},o=0;s.length>o;o++)if(r=n())return r.v;var a=()=>{if(!w)return i("document not found");var s=w.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=t,s.onload=e=>{s.__posthog_loading_callback_fired=!0,i(void 0,e)},s.onerror=e=>i(e),e.config.prepare_external_dependency_script&&(s=e.config.prepare_external_dependency_script(s)),!s)return i("prepare_external_dependency_script returned null");if("head"===e.config.external_scripts_inject_target)w.head.appendChild(s);else{var r,n=w.querySelectorAll("body > script");n.length>0?null==(r=n[0].parentNode)||r.insertBefore(s,n[0]):w.body.appendChild(s)}};null!=w&&w.body?a():null==w||w.addEventListener("DOMContentLoaded",a)};F.__PosthogExtensions__=F.__PosthogExtensions__||{},F.__PosthogExtensions__.loadExternalDependency=(e,t,i)=>{if("remote-config"!==t)if(e._resolvedSdkVersion){var s=e.requestRouter.endpointFor("assets","/static/"+e._resolvedSdkVersion+"/"+t+".js");Nt(e,s,i)}else{var r="/static/"+t+".js?v="+e.version;if("toolbar"===t){var n=3e5;r=r+"&t="+Math.floor(Date.now()/n)*n}var o=e.requestRouter.endpointFor("assets",r);Nt(e,o,i)}else{var a=e.requestRouter.endpointFor("assets","/array/"+e.config.token+"/config.js");Nt(e,a,i)}},F.__PosthogExtensions__.loadSiteApp=(e,t,i)=>{var s=e.requestRouter.endpointFor("api",t);Nt(e,s,i)};var qt="$people_distinct_id",Wt="$device_id",Ht="__alias",Ut="__timers",zt="$autocapture_disabled_server_side",Bt="$heatmaps_enabled_server_side",Gt="$exception_capture_enabled_server_side",Vt="$error_tracking_suppression_rules",Kt="$error_tracking_capture_extension_exceptions",Yt="$web_vitals_enabled_server_side",Xt="$dead_clicks_enabled_server_side",Jt="$product_tours_enabled_server_side",Zt="$web_vitals_allowed_metrics",Qt="$session_recording_remote_config",ei="$sesid",ti="$session_is_sampled",ii="$enabled_feature_flags",si="$early_access_features",ri="$feature_flag_details",ni="$stored_person_properties",oi="$stored_group_properties",ai="$surveys",li="$flag_call_reported",ui="$flag_call_reported_session_id",ci="$feature_flag_errors",hi="$feature_flag_evaluated_at",di="$user_state",pi="$client_session_props",vi="$capture_rate_limit",gi="$initial_campaign_params",_i="$initial_referrer_info",fi="$initial_person_info",mi="$epp",yi="__POSTHOG_TOOLBAR__",bi="$posthog_cookieless",wi=[qt,Ht,"__cmpns",Ut,"$session_recording_enabled_server_side",Bt,ei,ii,Vt,di,si,ri,oi,ni,ai,li,ui,ci,hi,pi,vi,gi,_i,mi,fi],xi="PostHog loadExternalDependency extension not found.",Ei="on_reject",ki="always",Si="anonymous",Pi="identified",Ri="identified_only",Fi="visibilitychange",$i="beforeunload",Oi="$pageview",Ci="$pageleave",Ti="$identify",Ii="$groupidentify";function Mi(e,t){B(e)&&e.forEach(t)}function Ai(e,t){if(!Q(e))if(B(e))e.forEach(t);else if((e=>e instanceof FormData)(e))e.forEach((e,i)=>t(e,i));else for(var i in e)U.call(e,i)&&t(e[i],i)}var Li=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;t>s;s++)i[s-1]=arguments[s];for(var r of i)for(var n in r)void 0!==r[n]&&(e[n]=r[n]);return e};function Di(e){for(var t=Object.keys(e),i=t.length,s=new Array(i);i--;)s[i]=[t[i],e[t[i]]];return s}var ji=function(e){try{return e()}catch(e){return}},Ni=function(e){return function(){try{for(var t=arguments.length,i=new Array(t),s=0;t>s;s++)i[s]=arguments[s];return e.apply(this,i)}catch(e){Lt.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Lt.critical(e)}}},qi=function(e){var t={};return Ai(e,function(e,i){(X(e)&&e.length>0||ee(e))&&(t[i]=e)}),t},Wi=["herokuapp.com","vercel.app","netlify.app"];function Hi(e){var t=null==e?void 0:e.hostname;if(!X(t))return!1;var i=t.split(".").slice(-2).join(".");for(var s of Wi)if(i===s)return!1;return!0}function Ui(e,t,i,s){var{capture:r=!1,passive:n=!0}=null!=s?s:{};null==e||e.addEventListener(t,i,{capture:r,passive:n})}function zi(e){return"ph_toolbar_internal"===e.name}Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return ee(e)&&isFinite(e)&&Math.floor(e)===e});var Bi,Gi=class e{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,i,s,r){if(!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||!Number.isInteger(r)||0>t||0>i||0>s||0>r||t>0xffffffffffff||i>4095||s>1073741823||r>4294967295)throw new RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=t/Math.pow(2,40),n[1]=t/Math.pow(2,32),n[2]=t/Math.pow(2,24),n[3]=t/Math.pow(2,16),n[4]=t/Math.pow(2,8),n[5]=t,n[6]=112|i>>>8,n[7]=i,n[8]=128|s>>>24,n[9]=s>>>16,n[10]=s>>>8,n[11]=s,n[12]=r>>>24,n[13]=r>>>16,n[14]=r>>>8,n[15]=r,new e(n)}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),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new e(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(var t=0;16>t;t++){var i=this.bytes[t]-e.bytes[t];if(0!==i)return Math.sign(i)}return 0}},Vi=class{constructor(){this.I=0,this.S=0,this.k=new Yi}generate(){var e=this.generateOrAbort();if(Y(e)){this.I=0;var t=this.generateOrAbort();if(Y(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this.I)this.I=e,this.A();else{if(this.I>=e+1e4)return;this.S++,this.S>4398046511103&&(this.I++,this.A())}return Gi.fromFieldsV7(this.I,Math.trunc(this.S/Math.pow(2,30)),this.S&Math.pow(2,30)-1,this.k.nextUint32())}A(){this.S=1024*this.k.nextUint32()+(1023&this.k.nextUint32())}},Ki=e=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new 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};m&&!Y(m.crypto)&&crypto.getRandomValues&&(Ki=e=>crypto.getRandomValues(e));var Yi=class{constructor(){this.T=new Uint32Array(8),this.N=1/0}nextUint32(){return this.T.length>this.N||(Ki(this.T),this.N=0),this.T[this.N++]}},Xi=()=>Ji().toString(),Ji=()=>(Bi||(Bi=new Vi)).generate(),Zi="",Qi=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,es={Yt:()=>!!w,Ut(e){Lt.error("cookieStore error: "+e)},Wt(e){if(w){try{for(var t=e+"=",i=w.cookie.split(";").filter(e=>e.length),s=0;i.length>s;s++){for(var r=i[s];" "==r.charAt(0);)r=r.substring(1,r.length);if(0===r.indexOf(t))return decodeURIComponent(r.substring(t.length,r.length))}}catch(e){}return null}},Gt(e){var t;try{t=JSON.parse(es.Wt(e))||{}}catch(e){}return t},Xt(e,t,i,s,r){if(w)try{var n="",o="",a=function(e,t){if(t){var i=function(e,t){if(void 0===t&&(t=w),Zi)return Zi;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var i=e.split("."),s=Math.min(i.length,8),r="dmn_chk_"+Xi();!Zi&&s--;){var n=i.slice(s).join("."),o=r+"=1;domain=."+n+";path=/";t.cookie=o+";max-age=3",t.cookie.includes(r)&&(t.cookie=o+";max-age=0",Zi=n)}return Zi}(e);if(!i){var s=(r=e.match(Qi))?r[0]:"";s!==i&&Lt.info("Warning: cookie subdomain discovery mismatch",s,i),i=s}return i?"; domain=."+i:""}var r;return""}(w.location.hostname,s);if(i){var l=new Date;l.setTime(l.getTime()+864e5*i),n="; expires="+l.toUTCString()}r&&(o="; secure");var u=e+"="+encodeURIComponent(JSON.stringify(t))+n+"; SameSite=Lax; path=/"+a+o;return u.length>3686.4&&Lt.warn("cookieStore warning: large cookie, len="+u.length),w.cookie=u,u}catch(e){return}},Jt(e,t){if(null!=w&&w.cookie)try{es.Xt(e,"",-1,t)}catch(e){return}}},ts=null,is={Yt(){if(!Z(ts))return ts;var e=!0;if(Y(m))e=!1;else try{var t="__mplssupport__";is.Xt(t,"xyz"),'"xyz"'!==is.Wt(t)&&(e=!1),is.Jt(t)}catch(t){e=!1}return e||Lt.error("localStorage unsupported; falling back to cookie store"),ts=e,e},Ut(e){Lt.error("localStorage error: "+e)},Wt(e){try{return null==m?void 0:m.localStorage.getItem(e)}catch(e){is.Ut(e)}return null},Gt(e){try{return JSON.parse(is.Wt(e))||{}}catch(e){}return null},Xt(e,t){try{null==m||m.localStorage.setItem(e,JSON.stringify(t))}catch(e){is.Ut(e)}},Jt(e){try{null==m||m.localStorage.removeItem(e)}catch(e){is.Ut(e)}}},ss=[Wt,"distinct_id",ei,ti,mi,fi,di],rs={},ns={Yt:()=>!0,Ut(e){Lt.error("memoryStorage error: "+e)},Wt:e=>rs[e]||null,Gt:e=>rs[e]||null,Xt(e,t){rs[e]=t},Jt(e){delete rs[e]}},os=null,as={Yt(){if(!Z(os))return os;if(os=!0,Y(m))os=!1;else try{var e="__support__";as.Xt(e,"xyz"),'"xyz"'!==as.Wt(e)&&(os=!1),as.Jt(e)}catch(e){os=!1}return os},Ut(e){Lt.error("sessionStorage error: ",e)},Wt(e){try{return null==m?void 0:m.sessionStorage.getItem(e)}catch(e){as.Ut(e)}return null},Gt(e){try{return JSON.parse(as.Wt(e))||null}catch(e){}return null},Xt(e,t){try{null==m||m.sessionStorage.setItem(e,JSON.stringify(t))}catch(e){as.Ut(e)}},Jt(e){try{null==m||m.sessionStorage.removeItem(e)}catch(e){as.Ut(e)}}},ls=class{constructor(e){this._instance=e}get Rt(){return this._instance.config}get consent(){return this.Kt()?0:this.Qt}isOptedOut(){return this.Rt.cookieless_mode===ki||0===this.consent||-1===this.consent&&(this.Rt.opt_out_capturing_by_default||this.Rt.cookieless_mode===Ei)}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}optInOut(e){this.tr.Xt(this.er,e?1:0,this.Rt.cookie_expiration,this.Rt.cross_subdomain_cookie,this.Rt.secure_cookie)}reset(){this.tr.Jt(this.er,this.Rt.cross_subdomain_cookie)}get er(){var{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:i}=this._instance.config;return i||(t?t+e:"__ph_opt_in_out_"+e)}get Qt(){var e=this.tr.Wt(this.er);return le(e)?1:N(ue,e)?0:-1}get tr(){var e=this.Rt.opt_out_capturing_persistence_type,t="localStorage"===e?is:es;if(!this.rr||this.rr!==t){this.rr=t;var i="localStorage"===e?es:is;i.Wt(this.er)&&(this.rr.Wt(this.er)||this.optInOut(le(i.Wt(this.er))),i.Jt(this.er,this.Rt.cross_subdomain_cookie))}return this.rr}Kt(){return!!this.Rt.respect_dnt&&[null==b?void 0:b.doNotTrack,null==b?void 0:b.msDoNotTrack,F.doNotTrack].some(e=>le(e))}},us=Dt("[Dead Clicks]"),cs=()=>!0,hs=e=>{var t,i=!(null==(t=e.instance.persistence)||!t.get_property(Xt)),s=e.instance.config.capture_dead_clicks;return ie(s)?s:!!V(s)||i},ds=class{get lazyLoadedDeadClicksAutocapture(){return this.ir}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(e){"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[Xt]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.nr(()=>{this.sr()}):this.stop()}nr(e){var t,i;null!=(t=F.__PosthogExtensions__)&&t.initDeadClicksAutocapture&&e(),null==(i=F.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",t=>{t?us.error("failed to load script",t):e()})}sr(){var e;if(w){if(!this.ir&&null!=(e=F.__PosthogExtensions__)&&e.initDeadClicksAutocapture){var t=V(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.ir=F.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.ir.start(w),us.info("starting...")}}else us.error("`document` not found. Cannot start.")}stop(){this.ir&&(this.ir.stop(),this.ir=void 0,us.info("stopping..."))}},ps=Dt("[SegmentIntegration]"),vs="posthog-js";function gs(e,t){var{organization:i,projectId:s,prefix:r,severityAllowList:n=["error"],sendExceptionsToPostHog:o=!0}=void 0===t?{}:t;return t=>{var a,l,u,c,h;if("*"!==n&&!n.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var d=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());t.tags["PostHog Person URL"]=d,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var p,v=(null==(a=t.exception)?void 0:a.values)||[],g=v.map(e=>I({},e,{stacktrace:e.stacktrace?I({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map(e=>I({},e,{platform:"web:javascript"}))}):void 0})),_={$exception_message:(null==(l=v[0])?void 0:l.value)||t.message,$exception_type:null==(u=v[0])?void 0:u.type,$exception_level:t.level,$exception_list:g,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(c=v[0])?void 0:c.value)||t.message,$sentry_exception_type:null==(h=v[0])?void 0:h.type,$sentry_tags:t.tags};return i&&s&&(_.$sentry_url=(r||"https://sentry.io/organizations/")+i+"/issues/?project="+s+"&query="+t.event_id),o&&(null==(p=e.exceptions)||p.sendExceptionEvent(_)),t}}var _s=class{constructor(e,t,i,s,r,n){this.name=vs,this.setupOnce=function(o){o(gs(e,{organization:t,projectId:i,prefix:s,severityAllowList:r,sendExceptionsToPostHog:null==n||n}))}}},fs=class{constructor(e){this.ar=(e,t,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength)&&(Lt.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:i}),this.lr=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.ur()}ur(){var e;this.hr=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(this.ar)}destroy(){var e;null==(e=this.hr)||e.call(this),this.hr=void 0}doPageView(e,t){var i,s=this.cr(e,t);return this.lr={pathname:null!==(i=null==m?void 0:m.location.pathname)&&void 0!==i?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var t;return this.cr(e,null==(t=this.lr)?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null==(e=this.lr)?void 0:e.pageViewId}}cr(e,t){var i=this.lr;if(!i)return{$pageview_id:t};var s={$pageview_id:t,$prev_pageview_id:i.pageViewId},r=this._instance.scrollManager.getContext();if(r&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:u,maxContentY:c}=r;if(!(Y(n)||Y(o)||Y(a)||Y(l)||Y(u)||Y(c))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),c=Math.ceil(c);var h=n>1?ce(o/n,0,1,Lt):1,d=n>1?ce(a/n,0,1,Lt):1,p=l>1?ce(u/l,0,1,Lt):1,v=l>1?ce(c/l,0,1,Lt):1;s=Li(s,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:h,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:d,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:c,$prev_pageview_max_content_percentage:v})}}return i.pathname&&(s.$prev_pageview_pathname=i.pathname),i.timestamp&&(s.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),s}},ms=e=>{var t=null==w?void 0:w.createElement("a");return Y(t)?null:(t.href=e,t)},ys=function(e,t){for(var i,s=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;s.length>r;r++){var n=s[r].split("=");if(n[0]===t){i=n;break}}if(!B(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(e){Lt.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},bs=function(e,t,i){if(!e||!t||!t.length)return e;for(var s=e.split("#"),r=s[1],n=(s[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),u=[],c=0;l.length>c;c++){var h=l[c].split("=");B(h)&&(t.includes(h[0])?u.push(h[0]+"="+i):u.push(l[c]))}var d=a;return null!=o&&(d+="?"+u.join("&")),null!=r&&(d+="#"+r),d},ws=function(e,t){var i=e.match(new RegExp(t+"=([^&]*)"));return i?i[1]:null},xs="https?://(.*)",Es=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],ks=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Es],Ss="<masked>",Ps=["li_fat_id"];function Rs(e,t,i){if(!w)return{};var s,r=t?[...Es,...i||[]]:[],n=Fs(bs(w.URL,r,Ss),e),o=(s={},Ai(Ps,function(e){var t=es.Wt(e);s[e]=t||null}),s);return Li(o,n)}function Fs(e,t){var i=ks.concat(t||[]),s={};return Ai(i,function(t){var i=ys(e,t);s[t]=i||null}),s}function $s(e){var t,i=(t=e)?0===t.search(xs+"google.([^/?]*)")?"google":0===t.search(xs+"bing.com")?"bing":0===t.search(xs+"yahoo.com")?"yahoo":0===t.search(xs+"duckduckgo.com")?"duckduckgo":null:null,s="yahoo"!=i?"q":"p",r={};if(!Z(i)){r.$search_engine=i;var n=w?ys(w.referrer,s):"";n.length&&(r.ph_keyword=n)}return r}function Os(){return navigator.language||navigator.userLanguage}var Cs="$direct";function Ts(){return(null==w?void 0:w.referrer)||Cs}function Is(e,t){var i=e?[...Es,...t||[]]:[],s=null==x?void 0:x.href.substring(0,1e3);return{r:Ts().substring(0,1e3),u:s?bs(s,i,Ss):void 0}}function Ms(e){var t,{r:i,u:s}=e,r={$referrer:i,$referring_domain:null==i?void 0:i==Cs?Cs:null==(t=ms(i))?void 0:t.host};if(s){r.$current_url=s;var n=ms(s);r.$host=null==n?void 0:n.host,r.$pathname=null==n?void 0:n.pathname;var o=Fs(s);Li(r,o)}if(i){var a=$s(i);Li(r,a)}return r}function As(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function Ls(){try{return(new Date).getTimezoneOffset()}catch(e){return}}var Ds,js,Ns,qs,Ws=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Hs=class{constructor(e,t){var i,s;this.Rt=e,this.props={},this.dr=!1,this.vr=(s="",(i=e).token&&(s=i.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),i.persistence_name?"ph_"+i.persistence_name:"ph_"+s+"_posthog"),this.tr=this.pr(e),this.load(),e.debug&&Lt.info("Persistence loaded",e.persistence,I({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this.gr}pr(e){-1===Ws.indexOf(e.persistence.toLowerCase())&&(Lt.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=function(e){void 0===e&&(e=[]);var t=[...ss,...e];return I({},is,{Gt(e){try{var t={};try{t=es.Gt(e)||{}}catch(e){}var i=Li(t,JSON.parse(is.Wt(e)||"{}"));return is.Xt(e,i),i}catch(e){}return null},Xt(e,i,s,r,n,o){try{is.Xt(e,i,void 0,void 0,o);var a={};t.forEach(e=>{i[e]&&(a[e]=i[e])}),Object.keys(a).length&&es.Xt(e,a,s,r,n,o)}catch(e){is.Ut(e)}},Jt(e,t){try{null==m||m.localStorage.removeItem(e),es.Jt(e,t)}catch(e){is.Ut(e)}}})}(e.cookie_persisted_properties||[]),i=e.persistence.toLowerCase();return"localstorage"===i&&is.Yt()?is:"localstorage+cookie"===i&&t.Yt()?t:"sessionstorage"===i&&as.Yt()?as:"memory"===i?ns:"cookie"===i?es:t.Yt()?t:es}mr(e){var t=null!=e?e:this.Rt.feature_flag_cache_ttl_ms;if(!t||0>=t)return!1;var i=this.props[hi];return!i||"number"!=typeof i||Date.now()-i>t}properties(){var e={};return Ai(this.props,(t,i)=>{if(i===ii&&V(t)){if(!this.mr())for(var s=Object.keys(t),r=0;s.length>r;r++)e["$feature/"+s[r]]=t[s[r]]}else-1===wi.indexOf(i)&&(e[i]=t)}),e}load(){if(!this.gr){var e=this.tr.Gt(this.vr);e&&(this.props=Li({},e))}}save(){this.gr||this.tr.Xt(this.vr,this.props,this.yr,this.br,this.wr,this.Rt.debug)}remove(){this.tr.Jt(this.vr,!1),this.tr.Jt(this.vr,!0)}clear(){this.remove(),this.props={}}register_once(e,t,i){if(V(e)){Y(t)&&(t="None"),this.yr=Y(i)?this._r:i;var s=!1;if(Ai(e,(e,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==t||(this.props[i]=e,s=!0)}),s)return this.save(),!0}return!1}register(e,t){if(V(e)){this.yr=Y(t)?this._r:t;var i=!1;if(Ai(e,(t,s)=>{e.hasOwnProperty(s)&&this.props[s]!==t&&(this.props[s]=t,i=!0)}),i)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.dr){var e=Rs(this.Rt.custom_campaign_params,this.Rt.mask_personal_data_properties,this.Rt.custom_personal_data_properties);K(qi(e))||this.register(e),this.dr=!0}}update_search_keyword(){var e;this.register((e=null==w?void 0:w.referrer)?$s(e):{})}update_referrer_info(){var e;this.register_once({$referrer:Ts(),$referring_domain:null!=w&&w.referrer&&(null==(e=ms(w.referrer))?void 0:e.host)||Cs},void 0)}set_initial_person_info(){this.props[gi]||this.props[_i]||this.register_once({[fi]:Is(this.Rt.mask_personal_data_properties,this.Rt.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};Ai([_i,gi],t=>{var i=this.props[t];i&&Ai(i,function(t,i){e["$initial_"+W(i)]=t})});var t,i,s=this.props[fi];if(s){var r=(t=Ms(s),i={},Ai(t,function(e,t){i["$initial_"+W(t)]=e}),i);Li(e,r)}return e}safe_merge(e){return Ai(this.props,function(t,i){i in e||(e[i]=t)}),e}update_config(e,t,i){if(this._r=this.yr=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!i),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence||!((e,t)=>{if(e.length!==t.length)return!1;var i=[...e].sort(),s=[...t].sort();return i.every((e,t)=>e===s[t])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[])){var s=this.pr(e),r=this.props;this.clear(),this.tr=s,this.props=r,this.save()}}set_disabled(e){this.gr=e,this.gr?this.remove():this.save()}set_cross_subdomain(e){e!==this.br&&(this.br=e,this.remove(),this.save())}set_secure(e){e!==this.wr&&(this.wr=e,this.remove(),this.save())}set_event_timer(e,t){var i=this.props[Ut]||{};i[e]=t,this.props[Ut]=i,this.save()}remove_event_timer(e){var t=(this.props[Ut]||{})[e];return Y(t)||(delete this.props[Ut][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}},Us="events",zs="cancelEvents",Bs="popover",Gs="api",Vs="widget",Ks="survey shown",Ys="survey dismissed",Xs="survey sent",Js="$survey_id",Zs="$survey_iteration",Qs="$survey_last_seen_date",er="popover",tr="inline",ir="product tour shown",sr="$product_tour_last_seen_date",rr="$product_tour_type",nr=Dt("[RateLimiter]"),or=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=>{nr.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4})}catch(e){return void nr.warn('could not rate limit - continuing. Error: "'+(null==e?void 0:e.message)+'"',{text:t})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return(null==(e=this.instance.config.rate_limiting)?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max((null==(e=this.instance.config.rate_limiting)?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var t,i,s;void 0===e&&(e=!1);var{captureEventsBurstLimit:r,captureEventsPerSecond:n}=this,o=(new Date).getTime(),a=null!==(t=null==(i=this.instance.persistence)?void 0:i.get_property(vi))&&void 0!==t?t:{tokens:r,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>r&&(a.tokens=r);var l=1>a.tokens;return l||e||(a.tokens=Math.max(0,a.tokens-1)),!l||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+n+" events per second and "+r+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,null==(s=this.instance.persistence)||s.set_property(vi,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}},ar=Dt("[RemoteConfig]"),lr=class{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=F._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}Ir(e){var t,i;null!=(t=F.__PosthogExtensions__)&&t.loadExternalDependency?null==(i=F.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",()=>e(this.remoteConfig)):e()}Cr(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 ar.info("Using preloaded remote config",this.remoteConfig),this.Sr(this.remoteConfig),void this.kr();if(this._instance.Tr())return void ar.warn("Remote config is disabled. Falling back to local config.");this.Ir(e=>{if(!e)return ar.info("No config found after loading remote JS config. Falling back to JSON."),void this.Cr(e=>{this.Sr(e),this.kr()});this.Sr(e),this.kr()})}catch(e){ar.error("Error loading remote config",e)}}stop(){this.Ar&&(clearInterval(this.Ar),this.Ar=void 0)}refresh(){this._instance.Tr()||"hidden"===(null==w?void 0:w.visibilityState)||this._instance.reloadFeatureFlags()}kr(){var e;if(!this.Ar){var t=null!==(e=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==e?e:3e5;0!==t&&(this.Ar=setInterval(()=>{this.refresh()},t))}}Sr(e){var t;e||ar.error("Failed to fetch remote config from PostHog."),this._instance.Sr(null!=e?e:{}),!1!==(null==e?void 0:e.hasFeatureFlags)&&(this._instance.config.advanced_disable_feature_flags_on_first_load||null==(t=this._instance.featureFlags)||t.ensureFlagsLoaded())}},ur="gzip-js",cr="base64",hr=Uint8Array,dr=Uint16Array,pr=Uint32Array,vr=new hr([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 hr([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]),_r=new hr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),fr=function(e,t){for(var i=new dr(31),s=0;31>s;++s)i[s]=t+=1<<e[s-1];var r=new pr(i[30]);for(s=1;30>s;++s)for(var n=i[s];i[s+1]>n;++n)r[n]=n-i[s]<<5|s;return[i,r]},mr=fr(vr,2),yr=mr[1];for(mr[0][28]=258,yr[258]=28,js=fr(gr,0)[1],Ns=new dr(32768),qs=0;32768>qs;++qs)Ds=(43690&qs)>>>1|(21845&qs)<<1,Ns[qs]=((65280&(Ds=(61680&(Ds=(52428&Ds)>>>2|(13107&Ds)<<2))>>>4|(3855&Ds)<<4))>>>8|(255&Ds)<<8)>>>1;var br=function(e,t,i){for(var s=e.length,r=0,n=new dr(t);s>r;++r)++n[e[r]-1];var o,a=new dr(t);for(r=0;t>r;++r)a[r]=a[r-1]+n[r-1]<<1;if(i){o=new dr(1<<t);var l=15-t;for(r=0;s>r;++r)if(e[r])for(var u=r<<4|e[r],c=t-e[r],h=a[e[r]-1]++<<c,d=h|(1<<c)-1;d>=h;++h)o[Ns[h]>>>l]=u}else for(o=new dr(s),r=0;s>r;++r)o[r]=Ns[a[e[r]-1]++]>>>15-e[r];return o},wr=new hr(288);for(qs=0;144>qs;++qs)wr[qs]=8;for(qs=144;256>qs;++qs)wr[qs]=9;for(qs=256;280>qs;++qs)wr[qs]=7;for(qs=280;288>qs;++qs)wr[qs]=8;var xr=new hr(32);for(qs=0;32>qs;++qs)xr[qs]=5;var Er=br(wr,9,0),kr=br(xr,5,0),Sr=function(e){return(e/8|0)+(7&e&&1)},Pr=function(e,t,i){(null==i||i>e.length)&&(i=e.length);var s=new(e instanceof dr?dr:e instanceof pr?pr:hr)(i-t);return s.set(e.subarray(t,i)),s},Rr=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8},Fr=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8,e[s+2]|=i>>>16},$r=function(e,t){for(var i=[],s=0;e.length>s;++s)e[s]&&i.push({s:s,f:e[s]});var r=i.length,n=i.slice();if(!r)return[new hr(0),0];if(1==r){var o=new hr(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort(function(e,t){return e.f-t.f}),i.push({s:-1,f:25001});var a=i[0],l=i[1],u=0,c=1,h=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=r-1;)a=i[i[h].f>i[u].f?u++:h++],l=i[u!=c&&i[h].f>i[u].f?u++:h++],i[c++]={s:-1,f:a.f+l.f,l:a,r:l};var d=n[0].s;for(s=1;r>s;++s)n[s].s>d&&(d=n[s].s);var p=new dr(d+1),v=Or(i[c-1],p,0);if(v>t){s=0;var g=0,_=v-t,f=1<<_;for(n.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});r>s;++s){var m=n[s].s;if(t>=p[m])break;g+=f-(1<<v-p[m]),p[m]=t}for(g>>>=_;g>0;){var y=n[s].s;t>p[y]?g-=1<<t-p[y]++-1:++s}for(;s>=0&&g;--s){var b=n[s].s;p[b]==t&&(--p[b],++g)}v=t}return[new hr(p),v]},Or=function(e,t,i){return-1==e.s?Math.max(Or(e.l,t,i+1),Or(e.r,t,i+1)):t[e.s]=i},Cr=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new dr(++t),s=0,r=e[0],n=1,o=function(e){i[s++]=e},a=1;t>=a;++a)if(e[a]==r&&a!=t)++n;else{if(!r&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(r),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(r);n=1,r=e[a]}return[i.subarray(0,s),t]},Tr=function(e,t){for(var i=0,s=0;t.length>s;++s)i+=e[s]*t[s];return i},Ir=function(e,t,i){var s=i.length,r=Sr(t+2);e[r]=255&s,e[r+1]=s>>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var n=0;s>n;++n)e[r+n+4]=i[n];return 8*(r+4+s)},Mr=function(e,t,i,s,r,n,o,a,l,u,c){Rr(t,c++,i),++r[256];for(var h=$r(r,15),d=h[0],p=h[1],v=$r(n,15),g=v[0],_=v[1],f=Cr(d),m=f[0],y=f[1],b=Cr(g),w=b[0],x=b[1],E=new dr(19),k=0;m.length>k;++k)E[31&m[k]]++;for(k=0;w.length>k;++k)E[31&w[k]]++;for(var S=$r(E,7),P=S[0],R=S[1],F=19;F>4&&!P[_r[F-1]];--F);var $,O,C,T,I=u+5<<3,M=Tr(r,wr)+Tr(n,xr)+o,A=Tr(r,d)+Tr(n,g)+o+14+3*F+Tr(E,P)+(2*E[16]+3*E[17]+7*E[18]);if(M>=I&&A>=I)return Ir(t,c,e.subarray(l,l+u));if(Rr(t,c,1+(M>A)),c+=2,M>A){$=br(d,p,0),O=d,C=br(g,_,0),T=g;var L=br(P,R,0);for(Rr(t,c,y-257),Rr(t,c+5,x-1),Rr(t,c+10,F-4),c+=14,k=0;F>k;++k)Rr(t,c+3*k,P[_r[k]]);c+=3*F;for(var D=[m,w],j=0;2>j;++j){var N=D[j];for(k=0;N.length>k;++k)Rr(t,c,L[q=31&N[k]]),c+=P[q],q>15&&(Rr(t,c,N[k]>>>5&127),c+=N[k]>>>12)}}else $=Er,O=wr,C=kr,T=xr;for(k=0;a>k;++k)if(s[k]>255){var q;Fr(t,c,$[257+(q=s[k]>>>18&31)]),c+=O[q+257],q>7&&(Rr(t,c,s[k]>>>23&31),c+=vr[q]);var W=31&s[k];Fr(t,c,C[W]),c+=T[W],W>3&&(Fr(t,c,s[k]>>>5&8191),c+=gr[W])}else Fr(t,c,$[s[k]]),c+=O[s[k]];return Fr(t,c,$[256]),c+O[256]},Ar=new pr([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Lr=function(){for(var e=new pr(256),t=0;256>t;++t){for(var i=t,s=9;--s;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e}(),Dr=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};var jr,Nr=!!k||!!E,qr="text/plain",Wr=function(e,t,i){var s;void 0===i&&(i=!0);var[r,n]=e.split("?"),o=I({},t),a=null!==(s=null==n?void 0:n.split("&").map(e=>{var t,[s,r]=e.split("="),n=i&&null!==(t=o[s])&&void 0!==t?t:r;return delete o[s],s+"="+n}))&&void 0!==s?s:[],l=function(e,t){var i,s;void 0===t&&(t="&");var r=[];return Ai(e,function(e,t){Y(e)||Y(t)||"undefined"===t||(i=encodeURIComponent(e instanceof File?e.name:e.toString()),s=encodeURIComponent(t),r[r.length]=s+"="+i)}),r.join(t)}(o);return l&&a.push(l),r+"?"+a.join("&")},Hr=(e,t)=>JSON.stringify(e,(e,t)=>"bigint"==typeof t?t.toString():t,t),Ur=e=>{if(e.zt)return e.zt;var t,{data:i,compression:s}=e;if(i){if(s===ur){var r=function(e,t){void 0===t&&(t={});var i=function(){var e=4294967295;return{p(t){for(var i=e,s=0;t.length>s;++s)i=Lr[255&i^t[s]]^i>>>8;e=i},d:()=>4294967295^e}}(),s=e.length;i.p(e);var r,n,o,a,l=(a=10+((r=t).filename&&r.filename.length+1||0),function(e,t,i,s){var r=e.length,n=new hr(s+r+5*(1+Math.floor(r/7e3))+8),o=n.subarray(s,n.length-8),a=0;if(!t||8>r)for(var l=0;r>=l;l+=65535){var u=l+65535;r>u?a=Ir(o,a,e.subarray(l,u)):(o[l]=!0,a=Ir(o,a,e.subarray(l,r)))}else{for(var c=Ar[t-1],h=c>>>13,d=8191&c,p=(1<<i)-1,v=new dr(32768),g=new dr(p+1),_=Math.ceil(i/3),f=2*_,m=function(t){return(e[t]^e[t+1]<<_^e[t+2]<<f)&p},y=new pr(25e3),b=new dr(288),w=new dr(32),x=0,E=0,k=(l=0,0),S=0,P=0;r>l;++l){var R=m(l),F=32767&l,$=g[R];if(v[F]=$,g[R]=F,l>=S){var O=r-l;if((x>7e3||k>24576)&&O>423){a=Mr(e,o,0,y,b,w,E,k,P,l-P,a),k=x=E=0,P=l;for(var C=0;286>C;++C)b[C]=0;for(C=0;30>C;++C)w[C]=0}var T=2,I=0,M=d,A=F-$&32767;if(O>2&&R==m(l-A))for(var L=Math.min(h,O)-1,D=Math.min(32767,l),j=Math.min(258,O);D>=A&&--M&&F!=$;){if(e[l+T]==e[l+T-A]){for(var N=0;j>N&&e[l+N]==e[l+N-A];++N);if(N>T){if(T=N,I=A,N>L)break;var q=Math.min(A,N-2),W=0;for(C=0;q>C;++C){var H=l-A+C+32768&32767,U=H-v[H]+32768&32767;U>W&&(W=U,$=H)}}}A+=(F=$)-($=v[F])+32768&32767}if(I){y[k++]=268435456|yr[T]<<18|js[I];var z=31&yr[T],B=31&js[I];E+=vr[z]+gr[B],++b[257+z],++w[B],S=l+T,++x}else y[k++]=e[l],++b[e[l]]}}a=Mr(e,o,!0,y,b,w,E,k,P,l-P,a)}return Pr(n,0,s+Sr(a)+8)}(n=e,null==(o=t).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+o.mem,a)),u=l.length;return function(e,t){var i=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=2>t.level?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&Dr(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var s=0;i.length>=s;++s)e[s+10]=i.charCodeAt(s)}}(l,t),Dr(l,u-8,i.d()),Dr(l,u-4,s),l}(function(e){var t=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var i=new hr(e.length+(e.length>>>1)),s=0,r=function(e){i[s++]=e},n=0;t>n;++n){if(s+5>i.length){var o=new hr(s+8+(t-n<<1));o.set(i),i=o}var a=e.charCodeAt(n);128>a?r(a):2048>a?(r(192|a>>>6),r(128|63&a)):a>55295&&57344>a?(r(240|(a=65536+(1047552&a)|1023&e.charCodeAt(++n))>>>18),r(128|a>>>12&63),r(128|a>>>6&63),r(128|63&a)):(r(224|a>>>12),r(128|a>>>6&63),r(128|63&a))}return Pr(i,0,s)}(Hr(i)),{mtime:0});return{contentType:qr,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(s===cr){var n=(e=>"data="+encodeURIComponent("string"==typeof e?e:Hr(e)))((t=Hr(i))?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16)))):t);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=Hr(i);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},zr=(jr=T(function*(e){var t=Hr(e.data),i=yield function(e,t){return A.apply(this,arguments)}(t,O.DEBUG);if(!i)return e;var s=yield i.arrayBuffer();return I({},e,{zt:{contentType:qr,body:s,estimatedSize:s.byteLength}})}),function(e){return jr.apply(this,arguments)}),Br=[];E&&Br.push({transport:"fetch",method(e){var t,i,{contentType:s,body:r,estimatedSize:n}=null!==(t=Ur(e))&&void 0!==t?t:{},o=new Headers;Ai(e.headers,function(e,t){o.append(t,e)}),s&&o.append("Content-Type",s);var a=e.url,l=null;if(S){var u=new S;l={signal:u.signal,timeout:setTimeout(()=>u.abort(),e.timeout)}}E(a,I({method:(null==e?void 0:e.method)||"GET",headers:o,keepalive:"POST"===e.method&&52428.8>(n||0),body:r,signal:null==(i=l)?void 0:i.signal},e.fetchOptions)).then(t=>t.text().then(i=>{var s={statusCode:t.status,text:i};if(200===t.status)try{s.json=JSON.parse(i)}catch(e){Lt.error(e)}null==e.callback||e.callback(s)})).catch(t=>{Lt.error(t),null==e.callback||e.callback({statusCode:0,error:t})}).finally(()=>l?clearTimeout(l.timeout):null)}}),k&&Br.push({transport:"XHR",method(e){var t,i=new k;i.open(e.method||"GET",e.url,!0);var{contentType:s,body:r}=null!==(t=Ur(e))&&void 0!==t?t:{};Ai(e.headers,function(e,t){i.setRequestHeader(t,e)}),s&&i.setRequestHeader("Content-Type",s),e.timeout&&(i.timeout=e.timeout),e.disableXHRCredentials||(i.withCredentials=!0),i.onreadystatechange=()=>{if(4===i.readyState){var t={statusCode:i.status,text:i.responseText};if(200===i.status)try{t.json=JSON.parse(i.responseText)}catch(e){}null==e.callback||e.callback(t)}},i.send(r)}}),null!=b&&b.sendBeacon&&Br.push({transport:"sendBeacon",method(e){var t=Wr(e.url,{beacon:"1"});try{var i,{contentType:s,body:r}=null!==(i=Ur(e))&&void 0!==i?i:{};if(!r)return;var n=r instanceof Blob?r:new Blob([r],{type:s});b.sendBeacon(t,n)}catch(e){}}});var Gr=3e3,Vr=class{constructor(e,t){this.Er=!0,this.Rr=[],this.Nr=ce((null==t?void 0:t.flush_interval_ms)||Gr,250,5e3,Lt.createLogger("flush interval"),Gr),this.Mr=e}enqueue(e){this.Rr.push(e),this.Fr||this.Or()}unload(){this.Pr();var e=this.Rr.length>0?this.Lr():{},t=Object.values(e);[...t.filter(e=>0===e.url.indexOf("/e")),...t.filter(e=>0!==e.url.indexOf("/e"))].map(e=>{this.Mr(I({},e,{transport:"sendBeacon"}))})}enable(){this.Er=!1,this.Or()}Or(){var e=this;this.Er||(this.Fr=setTimeout(()=>{if(this.Pr(),this.Rr.length>0){var t=this.Lr(),i=function(){var i=t[s],r=(new Date).getTime();i.data&&B(i.data)&&Ai(i.data,e=>{e.offset=Math.abs(e.timestamp-r),delete e.timestamp}),e.Mr(i)};for(var s in t)i()}},this.Nr))}Pr(){clearTimeout(this.Fr),this.Fr=void 0}Lr(){var e={};return Ai(this.Rr,t=>{var i,s=t,r=(s?s.batchKey:null)||s.url;Y(e[r])&&(e[r]=I({},s,{data:[]})),null==(i=e[r].data)||i.push(s.data)}),this.Rr=[],e}},Kr=["retriesPerformedSoFar"],Yr=class{constructor(e){this.Dr=!1,this.Br=3e3,this.Rr=[],this._instance=e,this.Rr=[],this.jr=!0,!Y(m)&&"onLine"in m.navigator&&(this.jr=m.navigator.onLine,this.qr=()=>{this.jr=!0,this.Zr()},this.$r=()=>{this.jr=!1},Ui(m,"online",this.qr),Ui(m,"offline",this.$r))}get length(){return this.Rr.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,i=M(e,Kr);te(t)&&(i.url=Wr(i.url,{retry_count:t})),this._instance._send_request(I({},i,{callback:e=>{200===e.statusCode||e.statusCode>=400&&500>e.statusCode||(null!=t?t:0)>=10?null==i.callback||i.callback(e):this.Hr(I({retriesPerformedSoFar:t},i))}}))}Hr(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var i,s,r,n,o,a=(i=t,s=3e3*Math.pow(2,i),r=s/2,n=Math.min(18e5,s),o=Math.random()-.5,Math.ceil(n+o*(n-r))),l=Date.now()+a;this.Rr.push({retryAt:l,requestOptions:e});var u="Enqueued failed request for retry in "+a;navigator.onLine||(u+=" (Browser is offline)"),Lt.warn(u),this.Dr||(this.Dr=!0,this.Vr())}Vr(){if(this.zr&&clearTimeout(this.zr),0===this.Rr.length)return this.Dr=!1,void(this.zr=void 0);this.zr=setTimeout(()=>{this.jr&&this.Rr.length>0&&this.Zr(),this.Vr()},this.Br)}Zr(){var e=Date.now(),t=[],i=this.Rr.filter(i=>e>i.retryAt||(t.push(i),!1));if(this.Rr=t,i.length>0)for(var{requestOptions:s}of i)this.retriableRequest(s)}unload(){for(var{requestOptions:e}of(this.zr&&(clearTimeout(this.zr),this.zr=void 0),this.Dr=!1,Y(m)||(this.qr&&(m.removeEventListener("online",this.qr),this.qr=void 0),this.$r&&(m.removeEventListener("offline",this.$r),this.$r=void 0)),this.Rr))try{this._instance._send_request(I({},e,{transport:"sendBeacon"}))}catch(e){Lt.error(e)}this.Rr=[]}},Xr=class{constructor(e){this.Yr=()=>{var e,t,i,s;this.Ur||(this.Ur={});var r=this.scrollElement(),n=this.scrollY(),o=r?Math.max(0,r.scrollHeight-r.clientHeight):0,a=n+((null==r?void 0:r.clientHeight)||0),l=(null==r?void 0:r.scrollHeight)||0;this.Ur.lastScrollY=Math.ceil(n),this.Ur.maxScrollY=Math.max(n,null!==(e=this.Ur.maxScrollY)&&void 0!==e?e:0),this.Ur.maxScrollHeight=Math.max(o,null!==(t=this.Ur.maxScrollHeight)&&void 0!==t?t:0),this.Ur.lastContentY=a,this.Ur.maxContentY=Math.max(a,null!==(i=this.Ur.maxContentY)&&void 0!==i?i:0),this.Ur.maxContentHeight=Math.max(l,null!==(s=this.Ur.maxContentHeight)&&void 0!==s?s:0)},this._instance=e}get Wr(){return this._instance.config.scroll_root_selector}getContext(){return this.Ur}resetContext(){var e=this.Ur;return setTimeout(this.Yr,0),e}startMeasuringScrollPosition(){Ui(m,"scroll",this.Yr,{capture:!0}),Ui(m,"scrollend",this.Yr,{capture:!0}),Ui(m,"resize",this.Yr)}scrollElement(){if(!this.Wr)return null==m?void 0:m.document.documentElement;var e=B(this.Wr)?this.Wr:[this.Wr];for(var t of e){var i=null==m?void 0:m.document.querySelector(t);if(i)return i}}scrollY(){if(this.Wr){var e=this.scrollElement();return e&&e.scrollTop||0}return m&&(m.scrollY||m.pageYOffset||m.document.documentElement.scrollTop)||0}scrollX(){if(this.Wr){var e=this.scrollElement();return e&&e.scrollLeft||0}return m&&(m.scrollX||m.pageXOffset||m.document.documentElement.scrollLeft)||0}},Jr=e=>Is(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties),Zr=class{constructor(e,t,i,s){this.Gr=e=>{var t=this.Xr();if(!t||t.sessionId!==e){var i={sessionId:e,props:this.Jr(this._instance)};this.Kr.register({[pi]:i})}},this._instance=e,this.Qr=t,this.Kr=i,this.Jr=s||Jr,this.Qr.onSessionId(this.Gr)}Xr(){return this.Kr.props[pi]}getSetOnceProps(){var e,t=null==(e=this.Xr())?void 0:e.props;return t?"r"in t?Ms(t):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return Ai(qi(this.getSetOnceProps()),(t,i)=>{"$current_url"===i&&(i="url"),e["$session_entry_"+W(i)]=t}),e}},Qr=class{constructor(){this.ti={}}on(e,t){return this.ti[e]||(this.ti[e]=[]),this.ti[e].push(t),()=>{this.ti[e]=this.ti[e].filter(e=>e!==t)}}emit(e,t){for(var i of this.ti[e]||[])i(t);for(var s of this.ti["*"]||[])s(e,t)}},en=Dt("[SessionId]"),tn=class{on(e,t){return this.ei.on(e,t)}constructor(e,t,i){var s;if(this.ri=[],this.ii=void 0,this.ei=new Qr,this.ni=(e,t)=>!(!te(e)||!te(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===ki)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Rt=e.config,this.Kr=e.persistence,this.si=void 0,this.oi=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.ai=t||Xi,this.li=i||Xi;var r=this.Rt.persistence_name||this.Rt.token;if(this._sessionTimeoutMs=1e3*ce(this.Rt.session_idle_timeout_seconds||1800,60,36e3,en.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.ui(),this.hi="ph_"+r+"_window_id",this.ci="ph_"+r+"_primary_window_exists",this.di()){var n=as.Gt(this.hi),o=as.Gt(this.ci);n&&!o?this.si=n:as.Jt(this.hi),as.Xt(this.ci,!0)}if(null!=(s=this.Rt.bootstrap)&&s.sessionID)try{var a=(()=>{var e=this.Rt.bootstrap.sessionID.replace(/-/g,"");if(32!==e.length)throw new Error("Not a valid UUID");if("7"!==e[12])throw new Error("Not a UUIDv7");return parseInt(e.substring(0,12),16)})();this.vi(this.Rt.bootstrap.sessionID,(new Date).getTime(),a)}catch(e){en.error("Invalid sessionID in bootstrap",e)}this.fi()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return Y(this.ri)&&(this.ri=[]),this.ri.push(e),this.oi&&e(this.oi,this.si),()=>{this.ri=this.ri.filter(t=>t!==e)}}di(){return"memory"!==this.Rt.persistence&&!this.Kr.gr&&as.Yt()}pi(e){e!==this.si&&(this.si=e,this.di()&&as.Xt(this.hi,e))}gi(){return this.si?this.si:this.di()?as.Gt(this.hi):null}vi(e,t,i){e===this.oi&&t===this._sessionActivityTimestamp&&i===this._sessionStartTimestamp||(this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this.oi=e,this.Kr.register({[ei]:[t,e,i]}))}mi(){var e=this.Kr.props[ei];return B(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.vi(null,null,null)}destroy(){clearTimeout(this.yi),this.yi=void 0,this.ii&&m&&(m.removeEventListener($i,this.ii,{capture:!1}),this.ii=void 0),this.ri=[]}fi(){this.ii=()=>{this.di()&&as.Jt(this.ci)},Ui(m,$i,this.ii,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=null),this.Rt.cookieless_mode===ki)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=t||(new Date).getTime(),[s,r,n]=this.mi(),o=this.gi(),a=te(n)&&Math.abs(i-n)>864e5,l=!1,u=!r,c=!u&&!e&&this.ni(i,s);u||c||a?(r=this.ai(),o=this.li(),en.info("new session ID generated",{sessionId:r,windowId:o,changeReason:{noSessionId:u,activityTimeout:c,sessionPastMaximumLength:a}}),n=i,l=!0):o||(o=this.li(),l=!0);var h=te(s)&&e&&!a?s:i,d=te(n)?n:(new Date).getTime();return this.pi(o),this.vi(r,h,d),e||this.ui(),l&&this.ri.forEach(e=>e(r,o,l?{noSessionId:u,activityTimeout:c,sessionPastMaximumLength:a}:void 0)),{sessionId:r,windowId:o,sessionStartTimestamp:d,changeReason:l?{noSessionId:u,activityTimeout:c,sessionPastMaximumLength:a}:void 0,lastActivityTimestamp:s}}ui(){clearTimeout(this.yi),this.yi=setTimeout(()=>{var[e]=this.mi();if(this.ni((new Date).getTime(),e)){var t=this.oi;this.resetSessionId(),this.ei.emit("forcedIdleReset",{idleSessionId:t})}},1.1*this.sessionTimeoutMs)}},sn=function(e,t){if(!e)return!1;var i=e.userAgent;if(i&&j(i,t))return!0;try{var s=null==e?void 0:e.userAgentData;if(null!=s&&s.brands&&s.brands.some(e=>j(null==e?void 0:e.brand,t)))return!0}catch(e){}return!!e.webdriver},rn=function(e,t){if(!function(e){try{new RegExp(e)}catch(e){return!1}return!0}(t))return!1;try{return new RegExp(t).test(e)}catch(e){return!1}};function nn(e,t,i){return Hr({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}var on={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=>rn(t,e))),not_regex:(e,t)=>t.every(t=>e.every(e=>!rn(t,e))),icontains:(e,t)=>t.map(an).some(t=>e.map(an).some(e=>t.includes(e))),not_icontains:(e,t)=>t.map(an).every(t=>e.map(an).every(e=>!t.includes(e))),gt:(e,t)=>t.some(t=>{var i=parseFloat(t);return!isNaN(i)&&e.some(e=>i>parseFloat(e))}),lt:(e,t)=>t.some(t=>{var i=parseFloat(t);return!isNaN(i)&&e.some(e=>i<parseFloat(e))})},an=e=>e.toLowerCase();function ln(e,t){return!e||Object.entries(e).every(e=>{var[i,s]=e,r=null==t?void 0:t[i];if(Y(r)||Z(r))return!1;var n=[String(r)],o=on[s.operator];return!!o&&o(s.values,n)})}var un="custom",cn="i.posthog.com",hn=class{constructor(e){this.bi={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,t=null==(e=this.instance.config.ui_host)?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+cn,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this.bi[this.apiHost]||(this.bi[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":un),this.bi[this.apiHost]}endpointFor(e,t){if(void 0===t&&(t=""),t&&(t="/"===t[0]?t:"/"+t),"ui"===e)return this.uiHost+t;if("flags"===e)return this.flagsApiHost+t;if(this.region===un)return this.apiHost+t;var i=cn+t;switch(e){case"assets":return"https://"+this.region+"-assets."+i;case"api":return"https://"+this.region+"."+i}}},dn=Dt("[Surveys]"),pn="seenSurvey_",vn=(e,t)=>{var i="$survey_"+t+"/"+e.id;return e.current_iteration&&e.current_iteration>0&&(i="$survey_"+t+"/"+e.id+"/"+e.current_iteration),i},gn=e=>((e,t)=>{var i=""+pn+t.id;return t.current_iteration&&t.current_iteration>0&&(i=""+pn+t.id+"_"+t.current_iteration),i})(0,e),_n=[Bs,Vs,Gs],fn={ignoreConditions:!1,ignoreDelay:!1,displayType:er},mn=Dt("[PostHog ExternalIntegrations]"),yn={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},bn=class{constructor(e){this._instance=e}nr(e,t){var i;null==(i=F.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,e=>{if(e)return mn.error("failed to load script",e);t()})}startIfEnabledOrStop(){var e=this,t=function(t){var i,r,n;!s||null!=(i=F.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[t]||e.nr(yn[t],()=>{var i;null==(i=F.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[t])||i.start(e._instance)}),!s&&null!=(r=F.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[t]&&(null==(n=F.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[t])||n.stop())};for(var[i,s]of Object.entries(null!==(r=this._instance.config.integrations)&&void 0!==r?r:{})){var r;t(i)}}},wn={},xn=0,En=()=>{},kn='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Sn="Surveys module not available",Pn="sanitize_properties is deprecated. Use before_send instead",Rn="Invalid value for property_denylist config: ",Fn=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/,$n="posthog",On=!Nr&&-1===(null==R?void 0:R.indexOf("MSIE"))&&-1===(null==R?void 0:R.indexOf("Mozilla")),Cn=e=>{var t;return I({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Hi(null==w?void 0:w.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:En,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,debug:x&&X(null==x?void 0:x.search)&&-1!==x.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==m||null==(t=m.location)?void 0:t.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,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){Lt.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:Ri,before_send:void 0,request_queue_config:{flush_interval_ms:Gr},error_tracking:{},_onCapture:En,__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))},Tn=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["store_google","save_campaign_params"],["verbose","debug"]],In=e=>{var t={};for(var[i,s]of Tn)Y(e[i])||(t[s]=e[i]);var r=Li({},t,e);return B(e.property_blacklist)&&(Y(e.property_denylist)?r.property_denylist=e.property_blacklist:B(e.property_denylist)?r.property_denylist=[...e.property_blacklist,...e.property_denylist]:Lt.error(Rn+e.property_denylist)),r},Mn=class{constructor(){this.__forceAllowLocalhost=!1}get wi(){return this.__forceAllowLocalhost}set wi(e){Lt.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},An=class e{Ii(e,t){if(e){var i=this.Ci.indexOf(e);-1!==i&&this.Ci.splice(i,1)}return this.Ci.push(t),null==t.initialize||t.initialize(),t}get decideEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}get flagsEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}constructor(){var t;this.webPerformance=new Mn,this.Si=!1,this.version=O.LIB_VERSION,this.ki=new Qr,this.Ci=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Cn(),this.SentryIntegration=_s,this.sentryIntegration=e=>function(e,t){var i=gs(e,t);return{name:vs,processEvent:e=>i(e)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.xi=!1,this.Ti=null,this.Ai=null,this.Ei=null,this.scrollManager=new Xr(this),this.pageViewManager=new fs(this),this.rateLimiter=new or(this),this.requestRouter=new hn(this),this.consent=new ls(this),this.externalIntegrations=new bn(this);var i=null!==(t=e.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(e,t,i)=>{var s=X(e)?{[e]:t}:e;this.setPersonProperties(s),null==i||i({})},set_once:(e,t,i)=>{var s=X(e)?{[e]:t}:e;this.setPersonProperties(void 0,s),null==i||i({})}},this.on("eventCaptured",e=>Lt.info('send "'+(null==e?void 0:e.event)+'"',e))}init(t,i,s){if(s&&s!==$n){var r,n=null!==(r=wn[s])&&void 0!==r?r:new e;return n._init(t,i,s),wn[s]=n,wn[$n][s]=n,n}return this._init(t,i,s)}_init(e,t,i){var s,r,n,o;if(void 0===t&&(t={}),Y(e)||J(e))return Lt.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.Ri(t.debug),this.Ni=t,this.Mi=[],t.person_profiles?this.Ai=t.person_profiles:t.process_person&&(this.Ai=t.process_person),this.set_config(Li({},Cn(t.defaults),In(t),{name:i,token:e})),this.config.on_xhr_error&&Lt.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:ur;var a=this.Fi();this.persistence=new Hs(this.config,a),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Hs(I({},this.config,{persistence:"sessionStorage"}),a);var l=I({},this.persistence.props),u=I({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Oi=new Vr(e=>this.Pi(e),this.config.request_queue_config),this.Li=new Yr(this),this.__request_queue=[];var c=this.config.cookieless_mode===ki||this.config.cookieless_mode===Ei&&this.consent.isExplicitlyOptedOut();c||(this.sessionManager=new tn(this),this.sessionPropsManager=new Zr(this,this.sessionManager,this.persistence));var h=null==(s=F._POSTHOG_REMOTE_CONFIG)||null==(s=s[this.config.token])?void 0:s.config,d=null==h||null==(r=h.sdkVersion)?void 0:r.resolved;if(d&&(Fn.test(d)?this._resolvedSdkVersion=d:Lt.warn("Ignoring invalid preloaded sdkVersion.resolved from remote config: "+d)),this.config.__preview_deferred_init_extensions?(Lt.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.Di(c)},0)):(Lt.info("Initializing extensions synchronously"),this.Di(c)),O.DEBUG=O.DEBUG||this.config.debug,O.DEBUG&&Lt.info("Starting in debug mode",{this:this,config:t,thisC:I({},this.config),p:l,s:u}),!this.config.identity_distinct_id||null!=(n=t.bootstrap)&&n.distinctID||(t.bootstrap=I({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(o=t.bootstrap)?void 0:o.distinctID)){var p=t.bootstrap.distinctID,v=this.get_distinct_id(),g=this.persistence.get_property(di);if(t.bootstrap.isIdentifiedID&&null!=v&&v!==p&&g===Si)this.identify(p);else if(t.bootstrap.isIdentifiedID&&null!=v&&v!==p&&g===Pi)Lt.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 _=this.config.get_device_id(Xi()),f=t.bootstrap.isIdentifiedID?_:p;this.persistence.set_property(di,t.bootstrap.isIdentifiedID?Pi:Si),this.register({distinct_id:p,$device_id:f})}}if(c)this.register_once({distinct_id:bi,$device_id:null},"");else if(!this.get_distinct_id()){var y=this.config.get_device_id(Xi());this.register_once({distinct_id:y,$device_id:y},""),this.persistence.set_property(di,Si)}return Ui(m,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),t.segment?function(e,t){var i=e.config.segment;if(!i)return t();!function(e,t){var i=e.config.segment;if(!i)return t();var s=i=>{var s=()=>i.anonymousId()||Xi();e.config.get_device_id=s,i.id()&&(e.register({distinct_id:i.id(),$device_id:s()}),e.persistence.set_property(di,Pi)),t()},r=i.user();"then"in r&&G(r.then)?r.then(s):s(r)}(e,()=>{i.register((e=>{Promise&&Promise.resolve||ps.warn("This browser does not have Promise support, and can not use the segment integration");var t=(t,i)=>{if(!i)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(ps.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(ps.info("UserId set, identifying with PostHog"),e.identify(t.event.userId));var s=e.calculateEventProperties(i,t.event.properties);return t.event.properties=Object.assign({},s,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,Oi),identify:e=>t(e,Ti),screen:e=>t(e,"$screen")}})(e)).then(()=>{t()})})}(this,()=>this.Bi()):this.Bi(),G(this.config._onCapture)&&this.config._onCapture!==En&&(Lt.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",e=>this.config._onCapture(e.event,e))),this.config.ip&&Lt.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}Di(t){var i,s,r,n,o,a,l,u=performance.now(),c=I({},e.__defaultExtensionClasses,this.config.__extensionClasses),h=[];c.featureFlags&&this.Ci.push(this.featureFlags=null!==(i=this.featureFlags)&&void 0!==i?i:new c.featureFlags(this)),c.exceptions&&this.Ci.push(this.exceptions=null!==(s=this.exceptions)&&void 0!==s?s:new c.exceptions(this)),c.historyAutocapture&&this.Ci.push(this.historyAutocapture=new c.historyAutocapture(this)),c.tracingHeaders&&this.Ci.push(new c.tracingHeaders(this)),c.siteApps&&this.Ci.push(this.siteApps=new c.siteApps(this)),c.sessionRecording&&!t&&this.Ci.push(this.sessionRecording=new c.sessionRecording(this)),this.config.disable_scroll_properties||h.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),c.autocapture&&this.Ci.push(this.autocapture=new c.autocapture(this)),c.surveys&&this.Ci.push(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new c.surveys(this)),c.logs&&this.Ci.push(this.logs=null!==(n=this.logs)&&void 0!==n?n:new c.logs(this)),c.conversations&&this.Ci.push(this.conversations=null!==(o=this.conversations)&&void 0!==o?o:new c.conversations(this)),c.productTours&&this.Ci.push(this.productTours=new c.productTours(this)),c.heatmaps&&this.Ci.push(this.heatmaps=new c.heatmaps(this)),c.webVitalsAutocapture&&this.Ci.push(this.webVitalsAutocapture=new c.webVitalsAutocapture(this)),c.exceptionObserver&&this.Ci.push(this.exceptionObserver=new c.exceptionObserver(this)),c.deadClicksAutocapture&&this.Ci.push(this.deadClicksAutocapture=new c.deadClicksAutocapture(this,hs)),c.toolbar&&this.Ci.push(this.toolbar=null!==(a=this.toolbar)&&void 0!==a?a:new c.toolbar(this)),c.experiments&&this.Ci.push(this.experiments=null!==(l=this.experiments)&&void 0!==l?l:new c.experiments(this)),this.Ci.forEach(e=>{e.initialize&&h.push(()=>{null==e.initialize||e.initialize()})}),h.push(()=>{if(this.ji){var e=this.ji;this.ji=void 0,this.Sr(e)}}),this.qi(h,u)}qi(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout(()=>{this.qi(e,t)},0);var i=e.shift();if(i)try{i()}catch(e){Lt.error("Error initializing extension:",e)}}var s=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:s}),this.config.__preview_deferred_init_extensions&&Lt.info("PostHog extensions initialized ("+s+"ms)")}Sr(e){var t;if(!w||!w.body)return Lt.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Sr(e)},500);this.config.__preview_deferred_init_extensions&&(this.ji=e),this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=N(e.supportedCompression,ur)?ur:N(e.supportedCompression,cr)?cr:void 0),null!=(t=e.analytics)&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.Ai?this.Ai:Ri}),this.Ci.forEach(t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e))}Bi(){try{this.config.loaded(this)}catch(e){Lt.critical("`loaded` function failed",e)}if(this.Zi(),this.config.internal_or_test_user_hostname&&null!=x&&x.hostname){var e=x.hostname,t=this.config.internal_or_test_user_hostname;("string"==typeof t?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.config.cookieless_mode===ki)&&this.$i()},1),this.Hi=new lr(this),this.Hi.load()}Zi(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this.Oi)||e.enable())}_dom_loaded(){this.is_capturing()&&Mi(this.__request_queue,e=>this.Pi(e)),this.__request_queue=[],this.Zi()}_handle_unload(){var e,t,i;null==(e=this.surveys)||e.handlePageUnload(),this.config.request_batching?(this.Vi()&&this.capture(Ci),null==(t=this.Oi)||t.unload(),null==(i=this.Li)||i.unload()):this.Vi()&&this.capture(Ci,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(On?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=Wr(e.url,{ip:this.config.ip?1:0}),e.headers=I({},this.config.request_headers,e.headers),e.compression="best-available"===e.compression?this.compression:e.compression,e.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(e=>{var t,i,s,r=I({},e);r.timeout=r.timeout||6e4,r.url=Wr(r.url,{_:(new Date).getTime().toString(),ver:O.JS_SDK_VERSION,compression:r.compression});var n=null!==(t=r.transport)&&void 0!==t?t:"fetch",o=Br.filter(e=>!r.disableTransport||!e.transport||!r.disableTransport.includes(e.transport)),a=null!==(i=null==(s=function(e){for(var t=0;e.length>t;t++)if(e[t].transport===n)return e[t]}(o))?void 0:s.method)&&void 0!==i?i:o[0].method;if(!a)throw new Error("No available transport method");"sendBeacon"!==n&&r.data&&r.compression===ur&&P?zr(r).then(e=>{a(e)}).catch(()=>{a(r)}):a(r)})(I({},e,{callback:t=>{var i,s;this.rateLimiter.checkForLimiting(t),400>t.statusCode||null==(i=(s=this.config).on_request_error)||i.call(s,t),null==e.callback||e.callback(t)}}))))}Pi(e){this.Li?this.Li.retriableRequest(e):this._send_request(e)}_execute_array(e){xn++;try{var t,i=[],s=[],r=[];Mi(e,e=>{e&&(B(t=e[0])?r.push(e):G(e)?e.call(this):B(e)&&"alias"===t?i.push(e):B(e)&&-1!==t.indexOf("capture")&&G(this[t])?r.push(e):s.push(e))});var n=function(e,t){Mi(e,function(e){if(B(e[0])){var i=t;Ai(e,function(e){i=i[e[0]].apply(i,e.slice(1))})}else t[e[0]].apply(t,e.slice(1))})};n(i,this),n(s,this),n(r,this)}finally{xn--}}push(t){if(xn>0&&B(t)&&X(t[0])){var i=e.prototype[t[0]];G(i)&&i.apply(this,t.slice(1))}else this._execute_array([t])}capture(e,t,i){var s,r,n,o,a;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Oi){if(this.is_capturing())if(!Y(e)&&X(e)){var l=!this.config.opt_out_useragent_filter&&this._is_bot();if(!l||this.config.__preview_capture_bot_pageviews){var u=null!=i&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==u||!u.isRateLimited){null!=t&&t.$current_url&&!X(null==t?void 0:t.$current_url)&&(Lt.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==t||delete t.$current_url),"$exception"!==e||null!=i&&i.zi||Lt.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 c=new Date,h=(null==i?void 0:i.timestamp)||c,d=Xi(),p={uuid:d,event:e,properties:this.calculateEventProperties(e,t||{},h,d)};e===Oi&&this.config.__preview_capture_bot_pageviews&&l&&(p.event="$bot_pageview",p.properties.$browser_type="bot"),u&&(p.properties.$lib_rate_limit_remaining_tokens=u.remainingTokens),(null==i?void 0:i.$set)&&(p.$set=null==i?void 0:i.$set);var v,g=this.Yi(null==i?void 0:i.$set_once,e!==Ii,e===Ti);if(g&&(p.$set_once=g),null!=i&&i._noTruncate||(r=this.config.properties_string_max_length,n=p,o=e=>X(e)?e.slice(0,r):e,a=new Set,p=function e(t,i){return t!==Object(t)?o?o(t):t:a.has(t)?void 0:(a.add(t),B(t)?(s=[],Mi(t,t=>{s.push(e(t))})):(s={},Ai(t,(t,i)=>{a.has(t)||(s[i]=e(t,i))})),s);var s}(n)),p.timestamp=h,Y(null==i?void 0:i.timestamp)||(p.properties.$event_time_override_provided=!0,p.properties.$event_time_override_system_time=c),e===Ys||e===Xs){var _=null==t?void 0:t[Js],f=null==t?void 0:t[Zs];v={id:_,current_iteration:f},localStorage.getItem(gn(v))||localStorage.setItem(gn(v),"true"),p.$set=I({},p.$set,{[vn({id:_,current_iteration:f},e===Xs?"responded":"dismissed")]:!0})}else e===Ks&&(p.$set=I({},p.$set,{[Qs]:(new Date).toISOString()}));if(e===ir){var m=null==t?void 0:t[rr];m&&(p.$set=I({},p.$set,{[sr+"/"+m]:(new Date).toISOString()}))}var y=I({},p.properties.$set,p.$set);if(K(y)||this.setPersonPropertiesForFlags(y),!Q(this.config.before_send)){var b=this.Ui(p);if(!b)return;p=b}this.ki.emit("eventCaptured",p);var w={method:"POST",url:null!==(s=null==i?void 0:i._url)&&void 0!==s?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:p,compression:"best-available",batchKey:null==i?void 0:i._batchKey};return!this.config.request_batching||i&&(null==i||!i._batchKey)||null!=i&&i.send_instantly?this.Pi(w):this.Oi.enqueue(w),p}Lt.critical("This capture call is ignored due to client rate limiting.")}}else Lt.error("No event name provided to posthog.capture")}else Lt.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",t=>e(t.event,t))}calculateEventProperties(e,t,i,s,r){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return t;var n=r?void 0:this.persistence.remove_event_timer(e),o=I({},t);if(o.token=this.config.token,o.$config_defaults=this.config.defaults,(this.config.cookieless_mode==ki||this.config.cookieless_mode==Ei&&this.consent.isExplicitlyOptedOut())&&(o.$cookieless_mode=!0),"$snapshot"===e){var a=I({},this.persistence.properties(),this.sessionPersistence.properties());return o.distinct_id=a.distinct_id,(!X(o.distinct_id)&&!ee(o.distinct_id)||J(o.distinct_id))&&Lt.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),o}var l,u=function(e,t){var i,s,r,n;if(!R)return{};var o,a,l,u,c,h,d,p,v=e?[...Es,...t||[]]:[],[g,_]=function(e){for(var t=0;lt.length>t;t++){var[i,s]=lt[t],r=i.exec(e),n=r&&(G(s)?s(r,e):s);if(n)return n}return["",""]}(R);return Li(qi({$os:g,$os_version:_,$browser:nt(R,navigator.vendor),$device:ut(R),$device_type:(a=R,l={userAgentDataPlatform:null==(i=navigator)||null==(i=i.userAgentData)?void 0:i.platform,maxTouchPoints:null==(s=navigator)?void 0:s.maxTouchPoints,screenWidth:null==m||null==(r=m.screen)?void 0:r.width,screenHeight:null==m||null==(n=m.screen)?void 0:n.height,devicePixelRatio:null==m?void 0:m.devicePixelRatio},p=ut(a),p===be||p===ye||"Kobo"===p||"Kindle Fire"===p||p===Xe?me:p===Ne||p===We||p===qe||p===Ve?"Console":p===xe?"Wearable":p?ge:"Android"===(null==l?void 0:l.userAgentDataPlatform)&&(null!==(u=null==l?void 0:l.maxTouchPoints)&&void 0!==u?u:0)>0?600>Math.min(null!==(c=null==l?void 0:l.screenWidth)&&void 0!==c?c:0,null!==(h=null==l?void 0:l.screenHeight)&&void 0!==h?h:0)/(null!==(d=null==l?void 0:l.devicePixelRatio)&&void 0!==d?d:1)?ge:me:"Desktop"),$timezone:As(),$timezone_offset:Ls()}),{$current_url:bs(null==x?void 0:x.href,v,Ss),$host:null==x?void 0:x.host,$pathname:null==x?void 0:x.pathname,$raw_user_agent:R.length>1e3?R.substring(0,997)+"...":R,$browser_version:at(R,navigator.vendor),$browser_language:Os(),$browser_language_prefix:(o=Os(),"string"==typeof o?o.split("-")[0]:void 0),$screen_height:null==m?void 0:m.screen.height,$screen_width:null==m?void 0:m.screen.width,$viewport_height:null==m?void 0:m.innerHeight,$viewport_width:null==m?void 0:m.innerWidth,$lib:O.LIB_NAME,$lib_version:O.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:c,windowId:h}=this.sessionManager.checkAndGetSessionAndWindowId(r,i.getTime());o.$session_id=c,o.$window_id=h}this.sessionPropsManager&&Li(o,this.sessionPropsManager.getSessionProps());try{var d;this.sessionRecording&&Li(o,this.sessionRecording.sdkDebugProperties),o.$sdk_debug_retry_queue_size=null==(d=this.Li)?void 0:d.length}catch(e){o.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===un&&(o.$lib_custom_api_host=this.config.api_host),l=e!==Oi||r?e!==Ci||r?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,s),o=Li(o,l),e===Oi&&w&&(o.title=w.title),!Y(n)){var p=i.getTime()-n;o.$duration=parseFloat((p/1e3).toFixed(3))}R&&this.config.opt_out_useragent_filter&&(o.$browser_type=this._is_bot()?"bot":"browser"),(o=Li({},u,this.persistence.properties(),this.sessionPersistence.properties(),o)).$is_identified=this._isIdentified(),B(this.config.property_denylist)?Ai(this.config.property_denylist,function(e){delete o[e]}):Lt.error(Rn+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var v=this.config.sanitize_properties;v&&(Lt.error(Pn),o=v(o,e));var g=this.Wi();return o.$process_person_profile=g,g&&!r&&this.Gi("_calculate_event_properties"),o}Yi(e,t,i){var s;if(void 0===t&&(t=!0),void 0===i&&(i=!1),!this.persistence||!this.Wi())return e;if(this.Si&&!i)return e;var r=this.persistence.get_initial_props(),n=null==(s=this.sessionPropsManager)?void 0:s.getSetOnceProps(),o=Li({},r,n||{},e||{}),a=this.config.sanitize_properties;return a&&(Lt.error(Pn),o=a(o,"$set_once")),t&&(this.Si=!0),K(o)?void 0:o}register(e,t){var i;null==(i=this.persistence)||i.register(e,t)}register_once(e,t,i){var s;null==(s=this.persistence)||s.register_once(e,t,i)}register_for_session(e){var t;null==(t=this.sessionPersistence)||t.register(e)}unregister(e){var t;null==(t=this.persistence)||t.unregister(e)}unregister_for_session(e){var t;null==(t=this.sessionPersistence)||t.unregister(e)}Xi(e,t){this.register({[e]:t})}getFeatureFlag(e,t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return null==(t=this.featureFlags)?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagResult(e,t)}isFeatureEnabled(e,t){var i;return null==(i=this.featureFlags)?void 0:i.isFeatureEnabled(e,t)}reloadFeatureFlags(){var e;null==(e=this.featureFlags)||e.reloadFeatureFlags()}updateFlags(e,t,i){var s;null==(s=this.featureFlags)||s.updateFlags(e,t,i)}updateEarlyAccessFeatureEnrollment(e,t,i){var s;null==(s=this.featureFlags)||s.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t,i){var s;return void 0===t&&(t=!1),null==(s=this.featureFlags)?void 0:s.getEarlyAccessFeatures(e,t,i)}on(e,t){return this.ki.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:Sn}),()=>{})}onSessionId(e){var t,i;return null!==(t=null==(i=this.sessionManager)?void 0:i.onSessionId(e))&&void 0!==t?t:()=>{}}getSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:Sn})}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:Sn})}renderSurvey(e,t){var i;null==(i=this.surveys)||i.renderSurvey(e,t)}displaySurvey(e,t){var i;void 0===t&&(t=fn),null==(i=this.surveys)||i.displaySurvey(e,t)}cancelPendingSurvey(e){var t;null==(t=this.surveys)||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,i;return null!==(t=null==(i=this.surveys)?void 0:i.canRenderSurvey(e))&&void 0!==t?t:{visible:!1,disabledReason:Sn}}canRenderSurveyAsync(e,t){var i,s;return void 0===t&&(t=!1),null!==(i=null==(s=this.surveys)?void 0:s.canRenderSurveyAsync(e,t))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:Sn})}Ji(e){return!e||J(e)?(Lt.critical("Unique user id has not been set in posthog.identify"),!1):e===bi?(Lt.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())||(Lt.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(e,t,i){if(!this.__loaded||!this.persistence)return Lt.uninitializedWarning("posthog.identify");if(ee(e)&&(e=e.toString(),Lt.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Ji(e)&&this.Gi("posthog.identify")){var s=this.get_distinct_id();this.register({$user_id:e}),this.get_property(Wt)||this.register_once({$had_persisted_distinct_id:!0,$device_id:s},""),e!==s&&e!==this.get_property(Ht)&&(this.unregister(Ht),this.register({distinct_id:e}));var r,n=(this.persistence.get_property(di)||Si)===Si;e!==s&&n?(this.persistence.set_property(di,Pi),this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!1),this.capture(Ti,{distinct_id:e,$anon_distinct_id:s},{$set:t||{},$set_once:i||{}}),this.Ei=nn(e,t,i),null==(r=this.featureFlags)||r.setAnonymousDistinctId(s)):(t||i)&&this.setPersonProperties(t,i),e!==s&&(this.reloadFeatureFlags(),this.unregister(li))}}setPersonProperties(e,t){if((e||t)&&this.Gi("posthog.setPersonProperties")){var i=nn(this.get_distinct_id(),e,t);this.Ei!==i?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Ei=i):Lt.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,i){if(e&&t){var s=this.getGroups(),r=s[e]!==t;if(r&&this.resetGroupPropertiesForFlags(e),this.register({$groups:I({},s,{[e]:t})}),r||i){var n={$group_type:e,$group_key:t};i&&(n.$group_set=i),this.capture(Ii,n)}i&&this.setGroupPropertiesForFlags({[e]:i}),r&&!i&&this.reloadFeatureFlags()}else Lt.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){var i;void 0===t&&(t=!0),null==(i=this.featureFlags)||i.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){var e;null==(e=this.featureFlags)||e.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,t){var i;void 0===t&&(t=!0),this.Gi("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;null==(t=this.featureFlags)||t.resetGroupPropertiesForFlags(e)}reset(e){var t,i,s,r,n,o,a,l;if(Lt.info("reset"),!this.__loaded)return Lt.uninitializedWarning("posthog.reset");var u=this.get_property(Wt);if(this.consent.reset(),null==(t=this.persistence)||t.clear(),null==(i=this.sessionPersistence)||i.clear(),null==(s=this.surveys)||s.reset(),null==(r=this.Hi)||r.stop(),null==(n=this.featureFlags)||n.reset(),null==(o=this.conversations)||o.reset(),null==(a=this.persistence)||a.set_property(di,Si),null==(l=this.sessionManager)||l.resetSessionId(),this.Ei=null,this.config.cookieless_mode===ki)this.register_once({distinct_id:bi,$device_id:null},"");else{var c=this.config.get_device_id(Xi());this.register_once({distinct_id:c,$device_id:e?c:u},"")}this.register({$last_posthog_reset:(new Date).toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}setIdentity(e,t){var i;this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),null==(i=this.conversations)||i.Ki()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(e=this.conversations)||e.Qi()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return null!==(e=null==(t=this.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==e?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),s=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(null!=e&&e.withTimestamp&&i){var r,n=null!==(r=e.timestampLookBack)&&void 0!==r?r:10;if(!i)return s;s+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return s}alias(e,t){return e===this.get_property(qt)?(Lt.critical("Attempting to create alias for existing People user - aborting."),-2):this.Gi("posthog.alias")?(Y(t)&&(t=this.get_distinct_id()),e!==t?(this.Xi(Ht,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(Lt.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=I({},this.config);if(V(e)){var i,s,r,n,o,a,l,u,c;Li(this.config,In(e));var h=this.Fi();null==(i=this.persistence)||i.update_config(this.config,t,h),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Hs(I({},this.config,{persistence:"sessionStorage"}),h);var d=this.Ri(this.config.debug);ie(d)&&(this.config.debug=d),ie(this.config.debug)&&(this.config.debug?(O.DEBUG=!0,is.Yt()&&is.Xt("ph_debug",!0),Lt.info("set_config",{config:e,oldConfig:t,newConfig:I({},this.config)})):(O.DEBUG=!1,is.Yt()&&is.Jt("ph_debug"))),null==(s=this.exceptionObserver)||s.onConfigChange(),null==(r=this.sessionRecording)||r.startIfEnabledOrStop(),null==(n=this.autocapture)||n.startIfEnabled(),null==(o=this.heatmaps)||o.startIfEnabled(),null==(a=this.exceptionObserver)||a.startIfEnabledOrStop(),null==(l=this.deadClicksAutocapture)||l.startIfEnabledOrStop(),null==(u=this.surveys)||u.loadIfEnabled(),this.tn(),null==(c=this.externalIntegrations)||c.startIfEnabledOrStop()}}_overrideSDKInfo(e,t){O.LIB_NAME=e,O.LIB_VERSION=t}startSessionRecording(e){var t,i,s,r,n,o=!0===e,a={sampling:o||!(null==e||!e.sampling),linked_flag:o||!(null==e||!e.linked_flag),url_trigger:o||!(null==e||!e.url_trigger),event_trigger:o||!(null==e||!e.event_trigger)};Object.values(a).some(Boolean)&&(null==(t=this.sessionManager)||t.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(s=this.sessionRecording)||s.overrideLinkedFlag()),a.url_trigger&&(null==(r=this.sessionRecording)||r.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!(null==(e=this.sessionRecording)||!e.started)}captureException(e,t){if(this.exceptions){var i=new Error("PostHog syntheticException"),s=this.exceptions.buildProperties(e,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(I({},s,t))}}startExceptionAutocapture(e){this.set_config({capture_exceptions:null==e||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,i;return null!==(t=null==(i=this.toolbar)?void 0:i.loadToolbar(e))&&void 0!==t&&t}get_property(e){var t;return null==(t=this.persistence)?void 0:t.props[e]}getSessionProperty(e){var t;return null==(t=this.sessionPersistence)?void 0:t.props[e]}toString(){var e,t=null!==(e=this.config.name)&&void 0!==e?e:$n;return t!==$n&&(t=$n+"."+t),t}_isIdentified(){var e,t;return(null==(e=this.persistence)?void 0:e.get_property(di))===Pi||(null==(t=this.sessionPersistence)?void 0:t.get_property(di))===Pi}Wi(){var e,t;return!("never"===this.config.person_profiles||this.config.person_profiles===Ri&&!this._isIdentified()&&K(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[Ht])&&(null==(t=this.persistence)||null==(t=t.props)||!t[mi]))}Vi(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&(!0===this.config.capture_pageview||"history_change"===this.config.capture_pageview)}createPersonProfile(){this.Wi()||this.Gi("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Gi("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Gi(e){return"never"===this.config.person_profiles?(Lt.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Xi(mi,!0),!0)}Fi(){if("always"===this.config.cookieless_mode)return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==Ei)}tn(){var e,t,i,s,r=this.Fi();return(null==(e=this.persistence)?void 0:e.gr)!==r&&(null==(i=this.persistence)||i.set_disabled(r)),(null==(t=this.sessionPersistence)?void 0:t.gr)!==r&&(null==(s=this.sessionPersistence)||s.set_disabled(r)),r}opt_in_capturing(t){var i;if(this.config.cookieless_mode!==ki){if(this.config.cookieless_mode===Ei&&this.consent.isExplicitlyOptedOut()){var s,r,n,o,a;this.reset(!0),null==(s=this.sessionManager)||s.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new tn(this),this.pageViewManager=new fs(this),this.persistence&&(this.sessionPropsManager=new Zr(this,this.sessionManager,this.persistence));var l=null!==(n=null==(o=this.config.__extensionClasses)?void 0:o.sessionRecording)&&void 0!==n?n:null==(a=e.__defaultExtensionClasses)?void 0:a.sessionRecording;l&&(this.sessionRecording=this.Ii(this.sessionRecording,new l(this)))}var u,c;this.consent.optInOut(!0),this.tn(),this.Zi(),null==(i=this.sessionRecording)||i.startIfEnabledOrStop(),this.config.cookieless_mode==Ei&&(null==(u=this.surveys)||u.loadIfEnabled()),(Y(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)&&this.capture(null!==(c=null==t?void 0:t.captureEventName)&&void 0!==c?c:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.$i()}else Lt.warn(kn)}opt_out_capturing(){var e,t,i;this.config.cookieless_mode!==ki?(this.config.cookieless_mode===Ei&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.tn(),this.config.cookieless_mode===Ei&&(this.register({distinct_id:bi,$device_id:null}),null==(e=this.sessionManager)||e.destroy(),null==(t=this.pageViewManager)||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,null==(i=this.sessionRecording)||i.stopRecording(),this.sessionRecording=void 0,this.$i())):Lt.warn(kn)}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 1===e?"granted":0===e?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===ki||(this.config.cookieless_mode===Ei?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.tn()}_is_bot(){return b?sn(b,this.config.custom_blocked_useragents):void 0}$i(){w&&("visible"===w.visibilityState?this.xi||(this.xi=!0,this.capture(Oi,{title:w.title},{send_instantly:!0}),this.Ti&&(w.removeEventListener(Fi,this.Ti),this.Ti=null)):this.Ti||(this.Ti=this.$i.bind(this),Ui(w,Fi,this.Ti)))}debug(e){!1===e?(null==m||m.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==m||m.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}))}Tr(){var e,t,i,s,r,n,o=this.Ni||{};return"advanced_disable_flags"in o?!!o.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(Lt.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(i="advanced_disable_decide",s=Lt,r=(t="advanced_disable_flags")in(e=o)&&!Q(e[t]),n=i in e&&!Q(e[i]),r?e[t]:!!n&&(s&&s.warn("Config field '"+i+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[i]))}Ui(e){if(Q(this.config.before_send))return e;var t=B(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e;for(var s of t){if(i=s(i),Q(i)){var r="Event '"+e.event+"' was rejected in beforeSend function";return se(e.event)?Lt.warn(r+". This can cause unexpected behavior."):Lt.info(r),null}i.properties&&!K(i.properties)||Lt.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return i}getPageViewId(){var e;return null==(e=this.pageViewManager.lr)?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}Ri(e){var t=ie(e)&&!e,i=is.Yt()&&"true"===is.Wt("ph_debug");return!t&&(!!i||e)}};function Ln(e){return e instanceof Element&&(e.id===yi||!(null==e.closest||!e.closest(".toolbar-global-fade-container")))}function Dn(e){return!!e&&1===e.nodeType}function jn(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function Nn(e){return!!e&&3===e.nodeType}function qn(e){return!!e&&11===e.nodeType}function Wn(e){return e?q(e).split(/\s+/):[]}function Hn(e){var t=null==m?void 0:m.location.href;return!!(t&&e&&e.some(e=>t.match(e)))}function Un(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 Wn(t)}function zn(e){return Q(e)?null:q(e).split(/(\s+)/).filter(e=>lo(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Bn(e){var t="";return eo(e)&&!to(e)&&e.childNodes&&e.childNodes.length&&Ai(e.childNodes,function(e){var i;Nn(e)&&e.textContent&&(t+=null!==(i=zn(e.textContent))&&void 0!==i?i:"")}),q(t)}function Gn(e){return Y(e.target)?e.srcElement||null:null!=(t=e.target)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}An.__defaultExtensionClasses={},function(e,t){for(var i=0;t.length>i;i++)e.prototype[t[i]]=Ni(e.prototype[t[i]])}(An,["identify"]);var Vn=["a","button","form","input","select","textarea","label"];function Kn(e,t){if(Y(t))return!0;var i,s=function(e){if(t.some(t=>e.matches(t)))return{v:!0}};for(var r of e)if(i=s(r))return i.v;return!1}function Yn(e){var t=e.parentNode;return!(!t||!Dn(t))&&t}var Xn=["next","previous","prev",">","<"],Jn=[".ph-no-rageclick",".ph-no-capture"],Zn=e=>!e||jn(e,"html")||!Dn(e),Qn=(e,t)=>{if(!m||Zn(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,s=[e],r=e;r.parentNode&&!jn(r,"body");)if(qn(r.parentNode))s.push(r.parentNode.host),r=r.parentNode.host;else{var n=Yn(r);if(!n)break;if(t||Vn.indexOf(n.tagName.toLowerCase())>-1)i=!0;else{var o=m.getComputedStyle(n);o&&"pointer"===o.getPropertyValue("cursor")&&(i=!0)}s.push(n),r=n}return{parentIsUsefulElement:i,targetElementList:s}};function eo(e){for(var t=e;t.parentNode&&!jn(t,"body");t=t.parentNode){var i=Un(t);if(N(i,"ph-sensitive")||N(i,"ph-no-capture"))return!1}if(N(Un(e),"ph-include"))return!0;var s=e.type||"";if(X(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}var r=e.name||e.id||"";return!X(r)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(r.replace(/[^a-zA-Z0-9]/g,""))}function to(e){return!!(jn(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||jn(e,"select")||jn(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var io="(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})",so=new RegExp("^(?:"+io+")$"),ro=new RegExp(io),no="\\d{3}-?\\d{2}-?\\d{4}",oo=new RegExp("^("+no+")$"),ao=new RegExp("("+no+")");function lo(e,t){if(void 0===t&&(t=!0),Q(e))return!1;if(X(e)){if(e=q(e),(t?so:ro).test((e||"").replace(/[- ]/g,"")))return!1;if((t?oo:ao).test(e))return!1}return!0}function uo(e){var t=Bn(e);return lo(t=(t+" "+co(e)).trim())?t:""}function co(e){var t="";return e&&e.childNodes&&e.childNodes.length&&Ai(e.childNodes,function(e){var i;if(e&&"span"===(null==(i=e.tagName)?void 0:i.toLowerCase()))try{var s=Bn(e);t=(t+" "+s).trim(),e.childNodes&&e.childNodes.length&&(t=(t+" "+co(e)).trim())}catch(e){Lt.error("[AutoCapture]",e)}}),t}function ho(e){return e.replace(/"|\\"/g,'\\"')}function po(e){var t=e.attr__class;return t?B(t)?t:Wn(t):void 0}var vo=class{constructor(e){this.disabled=!1===e;var t=V(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,i){if(this.disabled)return!1;var s=this.clicks[this.clicks.length-1];if(s&&Math.abs(e-s.x)+Math.abs(t-s.y)<this.thresholdPx&&this.timeoutMs>i-s.timestamp){if(this.clicks.push({x:e,y:t,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:i}];return!1}},go="$copy_autocapture",_o=Dt("[AutoCapture]");function fo(e,t){return t.length>e?t.slice(0,e)+"...":t}function mo(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do{t=t.previousSibling}while(t&&!Dn(t));return t}var yo=Dt("[ExceptionAutocapture]");function bo(e,t,i){try{if(!(t in e))return()=>{};var s=e[t],r=i(s);return G(r)&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=r,()=>{e[t]=s}}catch(e){return()=>{}}}var wo=Dt("[TracingHeaders]"),xo=Dt("[Web Vitals]"),Eo=9e5,ko="disabled",So="lazy_loading",Po="awaiting_config",Ro="missing_config";Dt("[SessionRecording]");var Fo="[SessionRecording]",$o=Dt(Fo),Oo=Dt("[Heatmaps]");function Co(e){return V(e)&&"clientX"in e&&"clientY"in e&&ee(e.clientX)&&ee(e.clientY)}var To=Dt("[Product Tours]"),Io="ph_product_tours",Mo=["$set_once","$set"],Ao=Dt("[SiteApps]"),Lo="Error while initializing PostHog app with config id ";function Do(e,t,i){if(Q(e))return!1;switch(i){case"exact":return e===t;case"contains":var s=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(s,"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch(e){return!1}default:return!1}}var jo,No=class{constructor(e){this.en=new Qr,this.rn=(e,t)=>this.nn(e,t)&&this.sn(e,t)&&this.an(e,t)&&this.ln(e,t),this.nn=(e,t)=>null==t||!t.event||(null==e?void 0:e.event)===(null==t?void 0:t.event),this._instance=e,this.un=new Set,this.hn=new Set}init(){var e,t;Y(null==(e=this._instance)?void 0:e._addCaptureHook)||null==(t=this._instance)||t._addCaptureHook((e,t)=>{this.on(e,t)})}register(e){var t,i;if(!Y(null==(t=this._instance)?void 0:t._addCaptureHook)&&(e.forEach(e=>{var t,i;null==(t=this.hn)||t.add(e),null==(i=e.steps)||i.forEach(e=>{var t;null==(t=this.un)||t.add((null==e?void 0:e.event)||"")})}),null!=(i=this._instance)&&i.autocapture)){var s,r=new Set;e.forEach(e=>{var t;null==(t=e.steps)||t.forEach(e=>{null!=e&&e.selector&&r.add(null==e?void 0:e.selector)})}),null==(s=this._instance)||s.autocapture.setElementSelectors(r)}}on(e,t){var i;null!=t&&0!=e.length&&(this.un.has(e)||this.un.has(null==t?void 0:t.event))&&this.hn&&(null==(i=this.hn)?void 0:i.size)>0&&this.hn.forEach(e=>{this.cn(t,e)&&this.en.emit("actionCaptured",e.name)})}dn(e){this.onAction("actionCaptured",t=>e(t))}cn(e,t){if(null==(null==t?void 0:t.steps))return!1;for(var i of t.steps)if(this.rn(e,i))return!0;return!1}onAction(e,t){return this.en.on(e,t)}sn(e,t){if(null!=t&&t.url){var i,s=null==e||null==(i=e.properties)?void 0:i.$current_url;if(!s||"string"!=typeof s)return!1;if(!Do(s,t.url,t.url_matching||"contains"))return!1}return!0}an(e,t){return!!this.vn(e,t)&&!!this.fn(e,t)&&!!this.pn(e,t)}vn(e,t){var i;if(null==t||!t.href)return!0;var s=this.gn(e);if(s.length>0)return s.some(e=>Do(e.href,t.href,t.href_matching||"exact"));var r,n=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";return!!n&&Do((r=n.match(/(?::|")href="(.*?)"/))?r[1]:"",t.href,t.href_matching||"exact")}fn(e,t){var i;if(null==t||!t.text)return!0;var s=this.gn(e);if(s.length>0)return s.some(e=>Do(e.text,t.text,t.text_matching||"exact")||Do(e.$el_text,t.text,t.text_matching||"exact"));var r,n,o,a=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";return!!a&&(r=function(e){for(var t,i=[],s=/(?::|")text="(.*?)"/g;!Q(t=s.exec(e));)i.includes(t[1])||i.push(t[1]);return i}(a),n=t.text,o=t.text_matching||"exact",r.some(e=>Do(e,n,o)))}pn(e,t){var i,s;if(null==t||!t.selector)return!0;var r=null==e||null==(i=e.properties)?void 0:i.$element_selectors;if(null!=r&&r.includes(t.selector))return!0;var n=(null==e||null==(s=e.properties)?void 0:s.$elements_chain)||"";if(t.selector_regex&&n)try{return new RegExp(t.selector_regex).test(n)}catch(e){return!1}return!1}gn(e){var t;return null==(null==e||null==(t=e.properties)?void 0:t.$elements)?[]:null==e?void 0:e.properties.$elements}ln(e,t){return null==t||!t.properties||0===t.properties.length||ln(t.properties.reduce((e,t)=>{var i=B(t.value)?t.value.map(String):null!=t.value?[String(t.value)]:[];return e[t.key]={values:i,operator:t.operator||"exact"},e},{}),null==e?void 0:e.properties)}},qo=class{constructor(e){this._instance=e,this.mn=new Map,this.yn=new Map,this.bn=new Map}wn(e,t){return!!e&&ln(e.propertyFilters,null==t?void 0:t.properties)}_n(e,t){var i=new Map;return e.forEach(e=>{var s;null==(s=e.conditions)||null==(s=s[t])||null==(s=s.values)||s.forEach(t=>{if(null!=t&&t.name){var s=i.get(t.name)||[];s.push(e.id),i.set(t.name,s)}})}),i}In(e,t,i){var s=(i===Us?this.mn:this.yn).get(e),r=[];return this.Cn(e=>{r=e.filter(e=>null==s?void 0:s.includes(e.id))}),r.filter(s=>{var r,n=null==(r=s.conditions)||null==(r=r[i])||null==(r=r.values)?void 0:r.find(t=>t.name===e);return this.wn(n,t)})}register(e){var t;Y(null==(t=this._instance)?void 0:t._addCaptureHook)||(this.Sn(e),this.kn(e))}kn(e){var t=e.filter(e=>{var t,i;return(null==(t=e.conditions)?void 0:t.actions)&&(null==(i=e.conditions)||null==(i=i.actions)||null==(i=i.values)?void 0:i.length)>0});0!==t.length&&(null==this.xn&&(this.xn=new No(this._instance),this.xn.init(),this.xn.dn(e=>{this.onAction(e)})),t.forEach(e=>{var t,i,s,r,n;e.conditions&&null!=(t=e.conditions)&&t.actions&&null!=(i=e.conditions)&&null!=(i=i.actions)&&i.values&&(null==(s=e.conditions)||null==(s=s.actions)||null==(s=s.values)?void 0:s.length)>0&&(null==(r=this.xn)||r.register(e.conditions.actions.values),null==(n=e.conditions)||null==(n=n.actions)||null==(n=n.values)||n.forEach(t=>{if(t&&t.name){var i=this.bn.get(t.name);i&&i.push(e.id),this.bn.set(t.name,i||[e.id])}}))}))}Sn(e){var t,i=e.filter(e=>{var t,i;return(null==(t=e.conditions)?void 0:t.events)&&(null==(i=e.conditions)||null==(i=i.events)||null==(i=i.values)?void 0:i.length)>0}),s=e.filter(e=>{var t,i;return(null==(t=e.conditions)?void 0:t.cancelEvents)&&(null==(i=e.conditions)||null==(i=i.cancelEvents)||null==(i=i.values)?void 0:i.length)>0});0===i.length&&0===s.length||(null==(t=this._instance)||t._addCaptureHook((e,t)=>{this.onEvent(e,t)}),this.mn=this._n(e,Us),this.yn=this._n(e,zs))}onEvent(e,t){var i,s=this.re(),r=this.Tn(),n=this.An(),o=(null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[r])||[];if(n===e&&t&&o.length>0){var a,l;s.info("event matched, removing item from activated items",{event:e,eventPayload:t,existingActivatedItems:o});var u=(null==t||null==(a=t.properties)?void 0:a.$survey_id)||(null==t||null==(l=t.properties)?void 0:l.$product_tour_id);if(u){var c=o.indexOf(u);0>c||(o.splice(c,1),this.En(o))}}else{if(this.yn.has(e)){var h=this.In(e,t,zs);h.length>0&&(s.info("cancel event matched, cancelling items",{event:e,itemsToCancel:h.map(e=>e.id)}),h.forEach(e=>{var t=o.indexOf(e.id);0>t||o.splice(t,1),this.Rn(e.id)}),this.En(o))}if(this.mn.has(e)){s.info("event name matched",{event:e,eventPayload:t,items:this.mn.get(e)});var d=this.In(e,t,Us);this.En(o.concat(d.map(e=>e.id)||[]))}}}onAction(e){var t,i=this.Tn(),s=(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i])||[];this.bn.has(e)&&this.En(s.concat(this.bn.get(e)||[]))}En(e){var t,i=this.re(),s=this.Tn(),r=[...new Set(e)].filter(e=>!this.Nn(e));i.info("updating activated items",{activatedItems:r}),null==(t=this._instance)||null==(t=t.persistence)||t.register({[s]:r})}getActivatedIds(){var e,t=this.Tn();return(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[t])||[]}getEventToItemsMap(){return this.mn}Mn(){return this.xn}},Wo=class extends qo{constructor(e){super(e)}Tn(){return"$surveys_activated"}An(){return Ks}Cn(e){var t;null==(t=this._instance)||t.getSurveys(e)}Rn(e){var t;null==(t=this._instance)||t.cancelPendingSurvey(e)}re(){return dn}Nn(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},Ho="SDK is not enabled or survey functionality is not yet loaded",Uo="Disabled. Not loading surveys.",zo=null!=m&&m.location?ws(m.location.hash,"__posthog")||ws(location.hash,"state"):null,Bo="_postHogToolbarParams",Go=Dt("[Toolbar]"),Vo=Dt("[FeatureFlags]"),Ko=Dt("[FeatureFlags]",{debugEnabled:!0}),Yo="\" failed. Feature flags didn't load in time.",Xo="$active_feature_flags",Jo="$override_feature_flags",Zo="$feature_flag_payloads",Qo="$override_feature_flag_payloads",ea="$feature_flag_request_id",ta=e=>{for(var t={},i=0;e.length>i;i++)t[e[i]]=!0;return t},ia=e=>{var t={};for(var[i,s]of Di(e||{}))s&&(t[i]=s);return t},sa=Dt("[Error tracking]"),ra="Refusing to render web experiment since the viewer is a likely bot",na={icontains:(e,t)=>!!m&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!m&&-1===t.href.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>!!m&&rn(t.href,e),not_regex:(e,t)=>!!m&&!rn(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e},oa=Dt("[Conversations]"),aa="Conversations not available yet.",la={featureFlags:class{constructor(e){this.qn=!1,this.Zn=!1,this.$n=!1,this.Hn=!1,this.Vn=!1,this.zn=!1,this.Yn=!1,this.Un=!1,this._instance=e,this.featureFlagEventHandlers=[]}get Rt(){return this._instance.config}get Kr(){return this._instance.persistence}Wn(e){return this._instance.get_property(e)}Gn(){var e,t;return null!==(e=null==(t=this.Kr)?void 0:t.mr(this.Rt.feature_flag_cache_ttl_ms))&&void 0!==e&&e}Xn(){return!!this.Gn()&&(this.Un||this.$n||(this.Un=!0,Vo.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Jn(){var e,t=null!==(e=this.Rt.evaluation_contexts)&&void 0!==e?e:this.Rt.evaluation_environments;return!this.Rt.evaluation_environments||this.Rt.evaluation_contexts||this.Yn||(Vo.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Yn=!0),null!=t&&t.length?t.filter(e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||Vo.error("Invalid evaluation context found:",e,"Expected non-empty string"),t}):[]}Kn(){return this.Jn().length>0}initialize(){var e,t,{config:i}=this._instance,s=null!==(e=null==(t=i.bootstrap)?void 0:t.featureFlags)&&void 0!==e?e:{};if(Object.keys(s).length){var r,n,o=null!==(r=null==(n=i.bootstrap)?void 0:n.featureFlagPayloads)&&void 0!==r?r:{},a=Object.keys(s).filter(e=>!!s[e]).reduce((e,t)=>(e[t]=s[t]||!1,e),{}),l=Object.keys(o).filter(e=>a[e]).reduce((e,t)=>(o[t]&&(e[t]=o[t]),e),{});this.receivedFeatureFlags({featureFlags:a,featureFlagPayloads:l})}}updateFlags(e,t,i){var s=null!=i&&i.merge?this.getFlagVariants():{},r=null!=i&&i.merge?this.getFlagPayloads():{},n=I({},s,e),o=I({},r,t),a={};for(var[l,u]of Object.entries(n)){var c="string"==typeof u;a[l]={key:l,enabled:!!c||Boolean(u),variant:c?u:void 0,reason:void 0,metadata:Y(null==o?void 0:o[l])?void 0:{id:0,version:void 0,description:void 0,payload:o[l]}}}this.receivedFeatureFlags({flags:a})}get hasLoadedFlags(){return this.Zn}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this.Wn(ri),t=this.Wn(Jo),i=this.Wn(Qo);if(!i&&!t)return e||{};var s=Li({},e||{}),r=[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])];for(var n of r){var o,a,l=s[n],u=null==t?void 0:t[n],c=Y(u)?null!==(o=null==l?void 0:l.enabled)&&void 0!==o&&o:!!u,h=Y(u)?l.variant:"string"==typeof u?u:void 0,d=null==i?void 0:i[n],p=I({},l,{enabled:c,variant:c?null!=h?h:null==l?void 0:l.variant:void 0});c!==(null==l?void 0:l.enabled)&&(p.original_enabled=null==l?void 0:l.enabled),h!==(null==l?void 0:l.variant)&&(p.original_variant=null==l?void 0:l.variant),d&&(p.metadata=I({},null==l?void 0:l.metadata,{payload:d,original_payload:null==l||null==(a=l.metadata)?void 0:a.payload})),s[n]=p}return this.qn||(Vo.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:s}),this.qn=!0),s}getFlagVariants(){var e=this.Wn(ii),t=this.Wn(Jo);if(!t)return e||{};for(var i=Li({},e),s=Object.keys(t),r=0;s.length>r;r++)i[s[r]]=t[s[r]];return this.qn||(Vo.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this.qn=!0),i}getFlagPayloads(){var e=this.Wn(Zo),t=this.Wn(Qo);if(!t)return e||{};for(var i=Li({},e||{}),s=Object.keys(t),r=0;s.length>r;r++)i[s[r]]=t[s[r]];return this.qn||(Vo.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this.qn=!0),i}reloadFeatureFlags(){this.Hn||this.Rt.advanced_disable_feature_flags||this.Qn||(this._instance.ki.emit("featureFlagsReloading",!0),this.Qn=setTimeout(()=>{this.ts()},5))}es(){clearTimeout(this.Qn),this.Qn=void 0}ensureFlagsLoaded(){this.Zn||this.$n||this.Qn||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.Hn=e}ts(e){var t;if(this.es(),!this._instance.Tr())if(this.$n)this.Vn=!0;else{var i=this.Rt.token,s=this.Wn(Wt),r={token:i,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:I({},(null==(t=this.Kr)?void 0:t.get_initial_props())||{},this.Wn(ni)||{}),group_properties:this.Wn(oi),timezone:As()};Z(s)||Y(s)||(r.$device_id=s),(null!=e&&e.disableFlags||this.Rt.advanced_disable_feature_flags)&&(r.disable_flags=!0),this.Kn()&&(r.evaluation_contexts=this.Jn());var n=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Rt.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.$n=!0,this._instance._send_request({method:"POST",url:n,data:r,compression:this.Rt.disable_compression?void 0:cr,timeout:this.Rt.feature_flag_request_timeout_ms,callback:e=>{var t,i,s,n=!0;if(200===e.statusCode&&(this.Vn||(this.$anon_distinct_id=void 0),n=!1),this.$n=!1,!r.disable_flags||this.Vn){this.zn=!n;var o=[];e.error?e.error instanceof Error?o.push("AbortError"===e.error.name?"timeout":"connection_error"):o.push("unknown_error"):200!==e.statusCode&&o.push("api_error_"+e.statusCode),null!=(t=e.json)&&t.errorsWhileComputingFlags&&o.push("errors_while_computing_flags");var a,l=!(null==(i=e.json)||null==(i=i.quotaLimited)||!i.includes("feature_flags"));l&&o.push("quota_limited"),null==(s=this.Kr)||s.register({[ci]:o}),l?Vo.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(null!==(a=e.json)&&void 0!==a?a:{},n),this.Vn&&(this.Vn=!1,this.ts()))}}})}}getFeatureFlag(e,t){var i;if(void 0===t&&(t={}),!t.fresh||this.zn)if(this.Zn||this.getFlags()&&this.getFlags().length>0){if(!this.Xn()){var s=this.getFeatureFlagResult(e,t);return null!==(i=null==s?void 0:s.variant)&&void 0!==i?i:null==s?void 0:s.enabled}}else Vo.warn('getFeatureFlag for key "'+e+Yo)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return null==t?void 0:t.payload}getFeatureFlagResult(e,t){if(void 0===t&&(t={}),!t.fresh||this.zn)if(this.Zn||this.getFlags()&&this.getFlags().length>0){if(!this.Xn()){var i=this.getFlagVariants(),s=e in i,r=i[e],n=this.getFlagPayloads()[e],o=String(r),a=this.Wn(ea)||void 0,l=this.Wn(hi)||void 0,u=this.Wn(li)||{};if(this.Rt.advanced_feature_flags_dedup_per_session){var c,h=this._instance.get_session_id(),d=this.Wn(ui);h&&h!==d&&(u={},null==(c=this.Kr)||c.register({[li]:u,[ui]:h}))}if((t.send_event||!("send_event"in t))&&(!(e in u)||!u[e].includes(o))){var p,v,g,_,f,m,y,b,w,x;B(u[e])?u[e].push(o):u[e]=[o],null==(p=this.Kr)||p.register({[li]:u});var E=this.getFeatureFlagDetails(e),k=[...null!==(v=this.Wn(ci))&&void 0!==v?v:[]];Y(r)&&k.push("flag_missing");var S={$feature_flag:e,$feature_flag_response:r,$feature_flag_payload:n||null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:(null==(g=this.Rt.bootstrap)||null==(g=g.featureFlags)?void 0:g[e])||null,$feature_flag_bootstrapped_payload:(null==(_=this.Rt.bootstrap)||null==(_=_.featureFlagPayloads)?void 0:_[e])||null,$used_bootstrap_value:!this.zn};Y(null==E||null==(f=E.metadata)?void 0:f.version)||(S.$feature_flag_version=E.metadata.version);var P,R=null!==(m=null==E||null==(y=E.reason)?void 0:y.description)&&void 0!==m?m:null==E||null==(b=E.reason)?void 0:b.code;R&&(S.$feature_flag_reason=R),null!=E&&null!=(w=E.metadata)&&w.id&&(S.$feature_flag_id=E.metadata.id),Y(null==E?void 0:E.original_variant)&&Y(null==E?void 0:E.original_enabled)||(S.$feature_flag_original_response=Y(E.original_variant)?E.original_enabled:E.original_variant),null!=E&&null!=(x=E.metadata)&&x.original_payload&&(S.$feature_flag_original_payload=null==E||null==(P=E.metadata)?void 0:P.original_payload),k.length&&(S.$feature_flag_error=k.join(",")),this._instance.capture("$feature_flag_called",S)}if(s){var F=n;if(!Y(n))try{F=JSON.parse(n)}catch(e){}return{key:e,enabled:!!r,variant:"string"==typeof r?r:void 0,payload:F}}}}else Vo.warn('getFeatureFlagResult for key "'+e+Yo)}getRemoteConfigPayload(e,t){var i=this.Rt.token,s={distinct_id:this._instance.get_distinct_id(),token:i};this.Kn()&&(s.evaluation_contexts=this.Jn()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:s,compression:this.Rt.disable_compression?void 0:cr,timeout:this.Rt.feature_flag_request_timeout_ms,callback(i){var s,r=null==(s=i.json)?void 0:s.featureFlagPayloads;t((null==r?void 0:r[e])||void 0)}})}isFeatureEnabled(e,t){if(void 0===t&&(t={}),!t.fresh||this.zn){if(this.Zn||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlag(e,t);return Y(i)?void 0:!!i}Vo.warn('isFeatureEnabled for key "'+e+Yo)}}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t){if(this.Kr){this.Zn=!0;var i=this.getFlagVariants(),s=this.getFlagPayloads(),r=this.getFlagsWithDetails();!function(e,t,i,s,r){void 0===i&&(i={}),void 0===s&&(s={}),void 0===r&&(r={});var n,o,a=((o=(n=e).flags)?(n.featureFlags=Object.fromEntries(Object.keys(o).map(e=>{var t;return[e,null!==(t=o[e].variant)&&void 0!==t?t:o[e].enabled]})),n.featureFlagPayloads=Object.fromEntries(Object.keys(o).filter(e=>o[e].enabled).filter(e=>{var t;return null==(t=o[e].metadata)?void 0:t.payload}).map(e=>{var t;return[e,null==(t=o[e].metadata)?void 0:t.payload]}))):Vo.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),n),l=a.flags,u=a.featureFlags,c=a.featureFlagPayloads;if(u){var h=e.requestId,d=e.evaluatedAt;if(B(u)){Vo.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var p={};if(u)for(var v=0;u.length>v;v++)p[u[v]]=!0;t&&t.register({[Xo]:u,[ii]:p})}else{var g=u,_=c,f=l;if(e.errorsWhileComputingFlags)if(l){var m=new Set(Object.keys(l).filter(e=>{var t;return!(null!=(t=l[e])&&t.failed)}));g=I({},i,Object.fromEntries(Object.entries(g).filter(e=>{var[t]=e;return m.has(t)}))),_=I({},s,Object.fromEntries(Object.entries(_||{}).filter(e=>{var[t]=e;return m.has(t)}))),f=I({},r,Object.fromEntries(Object.entries(f||{}).filter(e=>{var[t]=e;return m.has(t)})))}else g=I({},i,g),_=I({},s,_),f=I({},r,f);t&&t.register(I({[Xo]:Object.keys(ia(g)),[ii]:g||{},[Zo]:_||{},[ri]:f||{}},h?{[ea]:h}:{},d?{[hi]:d}:{}))}}}(e,this.Kr,i,s,r),t||(this.Un=!1),this.rs(t)}}override(e,t){void 0===t&&(t=!1),Vo.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this.Kr)return Vo.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===e)return this.Kr.unregister(Jo),this.Kr.unregister(Qo),this.rs(),Ko.info("All overrides cleared");if(B(e)){var t=ta(e);return this.Kr.register({[Jo]:t}),this.rs(),Ko.info("Flag overrides set",{flags:e})}if(e&&"object"==typeof e&&("flags"in e||"payloads"in e)){var i,s=e;if(this.qn=Boolean(null!==(i=s.suppressWarning)&&void 0!==i&&i),"flags"in s)if(!1===s.flags)this.Kr.unregister(Jo),Ko.info("Flag overrides cleared");else if(s.flags){if(B(s.flags)){var r=ta(s.flags);this.Kr.register({[Jo]:r})}else this.Kr.register({[Jo]:s.flags});Ko.info("Flag overrides set",{flags:s.flags})}return"payloads"in s&&(!1===s.payloads?(this.Kr.unregister(Qo),Ko.info("Payload overrides cleared")):s.payloads&&(this.Kr.register({[Qo]:s.payloads}),Ko.info("Payload overrides set",{payloads:s.payloads}))),void this.rs()}if(e&&"object"==typeof e)return this.Kr.register({[Jo]:e}),this.rs(),Ko.info("Flag overrides set",{flags:e});Vo.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.Zn){var{flags:t,flagVariants:i}=this.ns();e(t,i)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var s,r=(this.Wn(si)||[]).find(t=>t.flagKey===e),n={["$feature_enrollment/"+e]:t},o={$feature_flag:e,$feature_enrollment:t,$set:n};r&&(o.$early_access_feature_name=r.name),i&&(o.$feature_enrollment_stage=i),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(n,!1);var a=I({},this.getFlagVariants(),{[e]:t});null==(s=this.Kr)||s.register({[Xo]:Object.keys(ia(a)),[ii]:a}),this.rs()}getEarlyAccessFeatures(e,t,i){void 0===t&&(t=!1);var s=this.Wn(si),r=i?"&"+i.map(e=>"stage="+e).join("&"):"";if(s&&!t)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Rt.token+r),method:"GET",callback:t=>{var i,s;if(t.json){var r=t.json.earlyAccessFeatures;return null==(i=this.Kr)||i.unregister(si),null==(s=this.Kr)||s.register({[si]:r}),e(r)}}})}ns(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(e=>t[e]),flagVariants:Object.keys(t).filter(e=>t[e]).reduce((e,i)=>(e[i]=t[i],e),{})}}rs(e){var{flags:t,flagVariants:i}=this.ns();this.featureFlagEventHandlers.forEach(s=>s(t,i,{errorsLoading:e}))}setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=this.Wn(ni)||{},s=(null==e?void 0:e.$set)||(null!=e&&e.$set_once?{}:e),r=null==e?void 0:e.$set_once,n={};if(r)for(var o in r)({}).hasOwnProperty.call(r,o)&&(o in i||(n[o]=r[o]));this._instance.register({[ni]:I({},i,n,s)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(ni)}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=this.Wn(oi)||{};0!==Object.keys(i).length&&Object.keys(i).forEach(t=>{i[t]=I({},i[t],e[t]),delete e[t]}),this._instance.register({[oi]:I({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.Wn(oi)||{};this._instance.register({[oi]:I({},t,{[e]:{}})})}else this._instance.unregister(oi)}reset(){this.Zn=!1,this.$n=!1,this.Hn=!1,this.Vn=!1,this.zn=!1,this.$anon_distinct_id=void 0,this.es(),this.qn=!1}}},ua={sessionRecording:class{get Rt(){return this._instance.config}get Kr(){return this._instance.persistence}get started(){var e;return!(null==(e=this.ss)||!e.isStarted)}get status(){var e,t;return this.os===Po||this.os===Ro?this.os:null!==(e=null==(t=this.ss)?void 0:t.status)&&void 0!==e?e:this.os}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.os=ko,this.ls=void 0,this._instance=e,!this._instance.sessionManager)throw $o.error("started without valid sessionManager"),new Error(Fo+" started without valid sessionManager. This is a bug.");if(this.Rt.cookieless_mode===ki)throw new Error(Fo+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get us(){var e,t=!(null==(e=this._instance.get_property(Qt))||!e.enabled),i=!this.Rt.disable_session_recording,s=this.Rt.disable_session_recording||this._instance.consent.isOptedOut();return m&&t&&i&&!s}startIfEnabledOrStop(e){var t;if(!this.us||null==(t=this.ss)||!t.isStarted){var i=!Y(Object.assign)&&!Y(Array.from);this.us&&i?(this.hs(e),$o.info("starting")):(this.os=ko,this.stopRecording())}}hs(e){var t,i,s;this.us&&(this.os!==Po&&this.os!==Ro&&(this.os=So),null!=F&&null!=(t=F.__PosthogExtensions__)&&null!=(t=t.rrweb)&&t.record&&null!=(i=F.__PosthogExtensions__)&&i.initSessionRecording?this.cs(e):null==(s=F.__PosthogExtensions__)||null==s.loadExternalDependency||s.loadExternalDependency(this._instance,this.ds,t=>{if(t)return $o.error("could not load recorder",t);this.cs(e)}))}stopRecording(){var e,t;null==(e=this.ls)||e.call(this),this.ls=void 0,null==(t=this.ss)||t.stop()}vs(){var e,t;null==(e=this.ls)||e.call(this),this.ls=void 0,null==(t=this.ss)||t.discard()}fs(){var e;null==(e=this.Kr)||e.unregister(ti)}ps(e,t){if(Q(e))return null;var i,s=ee(e)?e:parseFloat(e);return"number"!=typeof(i=s)||!Number.isFinite(i)||0>i||i>1?($o.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):s}gs(e){if(this.Kr){var t,i,s=this.Kr,r=()=>{var t,i=!1===e.sessionRecording?void 0:e.sessionRecording,r=this.ps(null==(t=this.Rt.session_recording)?void 0:t.sampleRate,"session_recording.sampleRate"),n=this.ps(null==i?void 0:i.sampleRate,"remote config sampleRate"),o=null!=r?r:n;Q(o)&&this.fs();var a=null==i?void 0:i.minimumDurationMilliseconds;s.register({[Qt]:I({cache_timestamp:Date.now(),enabled:!!i},i,{networkPayloadCapture:I({capturePerformance:e.capturePerformance},null==i?void 0:i.networkPayloadCapture),canvasRecording:{enabled:null==i?void 0:i.recordCanvas,fps:null==i?void 0:i.canvasFps,quality:null==i?void 0:i.canvasQuality},sampleRate:o,minimumDurationMilliseconds:Y(a)?null:a,endpoint:null==i?void 0:i.endpoint,triggerMatchType:null==i?void 0:i.triggerMatchType,masking:null==i?void 0:i.masking,urlTriggers:null==i?void 0:i.urlTriggers})})};r(),null==(t=this.ls)||t.call(this),this.ls=null==(i=this._instance.sessionManager)?void 0:i.onSessionId(r)}}onRemoteConfig(e){return"sessionRecording"in e?!1===e.sessionRecording?(this.gs(e),void this.vs()):(this.gs(e),void this.startIfEnabledOrStop()):(this.os===Po&&(this.os=Ro,$o.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t){var i;void 0===t&&(t="log"),null!=(i=this.ss)&&i.log?this.ss.log(e,t):$o.warn("log called before recorder was ready")}get ds(){var e,t,i=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.get_property(Qt);return(null==i||null==(t=i.scriptConfig)?void 0:t.script)||"lazy-recorder"}ys(){var e,t=this._instance.get_property(Qt);if(!t)return!1;var i=null!==(e=("object"==typeof t?t:JSON.parse(t)).cache_timestamp)&&void 0!==e?e:Date.now();return 36e5>=Date.now()-i}cs(e){var t,i;if(null==(t=F.__PosthogExtensions__)||!t.initSessionRecording)return $o.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.ss||(this.ss=null==(i=F.__PosthogExtensions__)?void 0:i.initSessionRecording(this._instance),this.ss._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.ys()){if(this.os===Ro||this.os===Po)return;return this.os=Po,$o.info("persisted remote config is stale, requesting fresh config before starting"),void new lr(this._instance).load()}this.os=So,this.ss.start(e)}onRRwebEmit(e){var t;null==(t=this.ss)||null==t.onRRwebEmit||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.ss||null==(t=this.Kr)||t.register({$replay_override_linked_flag:!0}),null==(e=this.ss)||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.ss||null==(t=this.Kr)||t.register({$replay_override_sampling:!0}),null==(e=this.ss)||e.overrideSampling()}overrideTrigger(e){var t,i;this.ss||null==(i=this.Kr)||i.register({["url"===e?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null==(t=this.ss)||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return(null==(e=this.ss)?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var i;return!(null==(i=this.ss)||!i.tryAddCustomEvent(e,t))}}},ca={autocapture:class{constructor(e){this.bs=!1,this.ws=null,this._s=!1,this.instance=e,this.rageclicks=new vo(e.config.rageclick),this.Is=null}initialize(){this.startIfEnabled()}get Rt(){var e,t,i=V(this.instance.config.autocapture)?this.instance.config.autocapture:{};return i.url_allowlist=null==(e=i.url_allowlist)?void 0:e.map(e=>new RegExp(e)),i.url_ignorelist=null==(t=i.url_ignorelist)?void 0:t.map(e=>new RegExp(e)),i}Cs(){if(this.isBrowserSupported()){if(m&&w){var e=e=>{e=e||(null==m?void 0:m.event);try{this.Ss(e)}catch(e){_o.error("Failed to capture event",e)}};if(Ui(w,"submit",e,{capture:!0}),Ui(w,"change",e,{capture:!0}),Ui(w,"click",e,{capture:!0}),this.Rt.capture_copied_text){var t=e=>{this.Ss(e=e||(null==m?void 0:m.event),go)};Ui(w,"copy",t,{capture:!0}),Ui(w,"cut",t,{capture:!0})}}}else _o.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.bs&&(this.Cs(),this.bs=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this._s=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[zt]:!!e.autocapture_opt_out}),this.ws=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.Is=e}getElementSelectors(e){var t,i=[];return null==(t=this.Is)||t.forEach(t=>{var s=null==w?void 0:w.querySelectorAll(t);null==s||s.forEach(s=>{e===s&&i.push(t)})}),i}get isEnabled(){var e,t,i=null==(e=this.instance.persistence)?void 0:e.props[zt];if(Z(this.ws)&&!ie(i)&&!this.instance.Tr())return!1;var s=null!==(t=this.ws)&&void 0!==t?t:!!i;return!!this.instance.config.autocapture&&!s}Ss(e,t){if(void 0===t&&(t="$autocapture"),this.isEnabled){var i,s=Gn(e);Nn(s)&&(s=s.parentNode||null),"$autocapture"===t&&"click"===e.type&&e instanceof MouseEvent&&this.instance.config.rageclick&&null!=(i=this.rageclicks)&&i.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime())&&function(e,t){if(!m||Zn(e))return!1;var i,s,r;if(ie(t)?(i=!!t&&Jn,s=void 0):(i=null!==(r=null==t?void 0:t.css_selector_ignorelist)&&void 0!==r?r:Jn,s=null==t?void 0:t.content_ignorelist),!1===i)return!1;var{targetElementList:n}=Qn(e,!1);return!function(e,t){if(!1===e||Y(e))return!1;var i;if(!0===e)i=Xn;else{if(!B(e))return!1;if(e.length>10)return Lt.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;i=e.map(e=>e.toLowerCase())}return t.some(e=>{var{safeText:t,ariaLabel:s}=e;return i.some(e=>t.includes(e)||s.includes(e))})}(s,n.map(e=>{var t;return{safeText:Bn(e).toLowerCase(),ariaLabel:(null==(t=e.getAttribute("aria-label"))?void 0:t.toLowerCase().trim())||""}}))&&!Kn(n,i)}(s,this.instance.config.rageclick)&&this.Ss(e,"$rageclick");var r=t===go;if(s&&function(e,t,i,s,r){var n,o,a,l;if(void 0===i&&(i=void 0),!m||Zn(e))return!1;if(null!=(n=i)&&n.url_allowlist&&!Hn(i.url_allowlist))return!1;if(null!=(o=i)&&o.url_ignorelist&&Hn(i.url_ignorelist))return!1;if(null!=(a=i)&&a.dom_event_allowlist){var u=i.dom_event_allowlist;if(u&&!u.some(e=>t.type===e))return!1}var{parentIsUsefulElement:c,targetElementList:h}=Qn(e,s);if(!function(e,t){var i=null==t?void 0:t.element_allowlist;if(Y(i))return!0;var s,r=function(e){if(i.some(t=>e.tagName.toLowerCase()===t))return{v:!0}};for(var n of e)if(s=r(n))return s.v;return!1}(h,i))return!1;if(!Kn(h,null==(l=i)?void 0:l.css_selector_allowlist))return!1;var d=m.getComputedStyle(e);if(d&&"pointer"===d.getPropertyValue("cursor")&&"click"===t.type)return!0;var p=e.tagName.toLowerCase();switch(p){case"html":return!1;case"form":return(r||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(r||["change","click"]).indexOf(t.type)>=0;default:return c?(r||["click"]).indexOf(t.type)>=0:(r||["click"]).indexOf(t.type)>=0&&(Vn.indexOf(p)>-1||"true"===e.getAttribute("contenteditable"))}}(s,e,this.Rt,r,r?["copy","cut"]:void 0)){var{props:n,explicitNoCapture:o}=function(e,t){for(var i,s,{e:r,maskAllElementAttributes:n,maskAllText:o,elementAttributeIgnoreList:a,elementsChainAsString:l}=t,u=[e],c=e;c.parentNode&&!jn(c,"body");)qn(c.parentNode)?(u.push(c.parentNode.host),c=c.parentNode.host):(u.push(c.parentNode),c=c.parentNode);var h,d,p=[],v={},g=!1,_=!1;if(Ai(u,e=>{var t=eo(e);"a"===e.tagName.toLowerCase()&&(g=e.getAttribute("href"),g=t&&g&&lo(g)&&g),N(Un(e),"ph-no-capture")&&(_=!0),p.push(function(e,t,i,s){var r=e.tagName.toLowerCase(),n={tag_name:r};Vn.indexOf(r)>-1&&!i&&(n.$el_text="a"===r.toLowerCase()||"button"===r.toLowerCase()?fo(1024,uo(e)):fo(1024,Bn(e)));var o=Un(e);o.length>0&&(n.classes=o.filter(function(e){return""!==e})),Ai(e.attributes,function(i){var r;if((!to(e)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==s||!s.includes(i.name))&&!t&&lo(i.value)&&(!X(r=i.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))){var o=i.value;"class"===i.name&&(o=Wn(o).join(" ")),n["attr__"+i.name]=fo(1024,o)}});for(var a=1,l=1,u=e;u=mo(u);)a++,u.tagName===e.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}(e,n,o,a));var i=function(e){if(!eo(e))return{};var t={};return Ai(e.attributes,function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){var i=e.name.replace("data-ph-capture-attribute-",""),s=e.value;i&&s&&lo(s)&&(t[i]=s)}}),t}(e);Li(v,i)}),_)return{props:{},explicitNoCapture:_};if(o||(p[0].$el_text="a"===e.tagName.toLowerCase()||"button"===e.tagName.toLowerCase()?uo(e):Bn(e)),g){var f,y;p[0].attr__href=g;var b=null==(f=ms(g))?void 0:f.host,w=null==m||null==(y=m.location)?void 0:y.host;b&&w&&b!==w&&(h=g)}return{props:Li({$event_type:r.type,$ce_version:1},l?{}:{$elements:p},{$elements_chain:(d=p,function(e){return e.map(e=>{var t,i,s="";if(e.tag_name&&(s+=e.tag_name),e.attr_class)for(var r of(e.attr_class.sort(),e.attr_class))s+="."+r.replace(/"/g,"");var n=I({},e.text?{text:e.text}:{},{"nth-child":null!==(t=e.nth_child)&&void 0!==t?t:0,"nth-of-type":null!==(i=e.nth_of_type)&&void 0!==i?i:0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),o={};return Di(n).sort((e,t)=>{var[i]=e,[s]=t;return i.localeCompare(s)}).forEach(e=>{var[t,i]=e;return o[ho(t.toString())]=ho(i.toString())}),(s+=":")+Di(o).map(e=>{var[t,i]=e;return t+'="'+i+'"'}).join("")}).join(";")}(function(e){return e.map(e=>{var t,i,s={text:null==(t=e.$el_text)?void 0:t.slice(0,400),tag_name:e.tag_name,href:null==(i=e.attr__href)?void 0:i.slice(0,2048),attr_class:po(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return Di(e).filter(e=>{var[t]=e;return 0===t.indexOf("attr__")}).forEach(e=>{var[t,i]=e;return s.attributes[t]=i}),s})}(d)))},null!=(i=p[0])&&i.$el_text?{$el_text:null==(s=p[0])?void 0:s.$el_text}:{},h&&"click"===r.type?{$external_click_url:h}:{},v)}}(s,{e:e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Rt.element_attribute_ignorelist,elementsChainAsString:this._s});if(o)return!1;var a=this.getElementSelectors(s);if(a&&a.length>0&&(n.$element_selectors=a),t===go){var l,u=zn(null==m||null==(l=m.getSelection())?void 0:l.toString()),c=e.type||"clipboard";if(!u)return!1;n.$selected_content=u,n.$copy_type=c}return this.instance.capture(t,n),!0}}}isBrowserSupported(){return G(null==w?void 0:w.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this.ks=(null==m||null==(t=m.location)?void 0:t.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(Lt.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.xs&&this.xs(),this.xs=void 0,Lt.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(m&&m.history){var i=this;null!=(e=m.history.pushState)&&e.__posthog_wrapped__||bo(m.history,"pushState",e=>function(t,s,r){e.call(this,t,s,r),i.Ts("pushState")}),null!=(t=m.history.replaceState)&&t.__posthog_wrapped__||bo(m.history,"replaceState",e=>function(t,s,r){e.call(this,t,s,r),i.Ts("replaceState")}),this.As()}}Ts(e){try{var t,i=null==m||null==(t=m.location)?void 0:t.pathname;if(!i)return;i!==this.ks&&this.isEnabled&&this._instance.capture(Oi,{navigation_type:e}),this.ks=i}catch(t){Lt.error("Error capturing "+e+" pageview",t)}}As(){if(!this.xs){var e=()=>{this.Ts("popstate")};Ui(m,"popstate",e),this.xs=()=>{m&&m.removeEventListener("popstate",e)}}}},heatmaps:class{get Rt(){return this.instance.config}constructor(e){var t;this.Es=!1,this.bs=!1,this.Rs=null,this.instance=e,this.Es=!(null==(t=this.instance.persistence)||!t.props[Bt]),this.rageclicks=new vo(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return V(this.Rt.capture_heatmaps)&&this.Rt.capture_heatmaps.flush_interval_milliseconds&&(e=this.Rt.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return Q(this.Rt.capture_heatmaps)?Q(this.Rt.enable_heatmaps)?this.Es:this.Rt.enable_heatmaps:!1!==this.Rt.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.bs)return;Oo.info("starting..."),this.Ns(),this.Tt()}else{var e;clearInterval(null!==(e=this.Rs)&&void 0!==e?e:void 0),this.Ms(),this.getAndClearBuffer()}}onRemoteConfig(e){if("heatmaps"in e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Bt]:t}),this.Es=t,this.startIfEnabled()}}getAndClearBuffer(){var e=this.T;return this.T=void 0,e}Fs(e){this.wt(e.originalEvent,"deadclick")}Tt(){this.Rs&&clearInterval(this.Rs),this.Rs="visible"===(null==w?void 0:w.visibilityState)?setInterval(this.Zr.bind(this),this.flushIntervalMilliseconds):null}Ns(){m&&w&&(this.Os=this.Zr.bind(this),Ui(m,$i,this.Os),this.Ps=e=>this.wt(e||(null==m?void 0:m.event)),Ui(w,"click",this.Ps,{capture:!0}),this.Ls=e=>this.Ds(e||(null==m?void 0:m.event)),Ui(w,"mousemove",this.Ls,{capture:!0}),this.Bs=new ds(this.instance,cs,this.Fs.bind(this)),this.Bs.startIfEnabledOrStop(),this.js=this.Tt.bind(this),Ui(w,Fi,this.js),this.bs=!0)}Ms(){var e;m&&w&&(this.Os&&m.removeEventListener($i,this.Os),this.Ps&&w.removeEventListener("click",this.Ps,{capture:!0}),this.Ls&&w.removeEventListener("mousemove",this.Ls,{capture:!0}),this.js&&w.removeEventListener(Fi,this.js),clearTimeout(this.qs),null==(e=this.Bs)||e.stop(),this.bs=!1)}Zs(e,t){var i=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),n=function(e,t,i){for(var s=e;s&&Dn(s)&&!jn(s,"body");){if(s===i)return!1;if(N(t,null==m?void 0:m.getComputedStyle(s).position))return!0;s=Yn(s)}return!1}(Gn(e),["fixed","sticky"],r);return{x:e.clientX+(n?0:s),y:e.clientY+(n?0:i),target_fixed:n,type:t}}wt(e,t){var i;if(void 0===t&&(t="click"),!Ln(e.target)&&Co(e)){var s=this.Zs(e,t);null!=(i=this.rageclicks)&&i.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&this.$s(I({},s,{type:"rageclick"})),this.$s(s)}}Ds(e){!Ln(e.target)&&Co(e)&&(clearTimeout(this.qs),this.qs=setTimeout(()=>{this.$s(this.Zs(e,"mousemove"))},500))}$s(e){if(m){var t=m.location.href,i=this.Rt.custom_personal_data_properties,s=this.Rt.mask_personal_data_properties?[...Es,...i||[]]:[],r=bs(t,s,Ss);this.T=this.T||{},this.T[r]||(this.T[r]=[]),this.T[r].push(e)}}Zr(){this.T&&!K(this.T)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:ds,webVitalsAutocapture:class{constructor(e){var t;this.Es=!1,this.bs=!1,this.T={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Hs=()=>{clearTimeout(this.Vs),0!==this.T.metrics.length&&(this._instance.capture("$web_vitals",this.T.metrics.reduce((e,t)=>I({},e,{["$web_vitals_"+t.name+"_event"]:I({},t),["$web_vitals_"+t.name+"_value"]:t.value}),{})),this.T={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.nt=e=>{var t,i=null==(t=this._instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0);if(Y(i))xo.error("Could not read session ID. Dropping metrics!");else{this.T=this.T||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var s=this.zs();Y(s)||(Q(null==e?void 0:e.name)||Q(null==e?void 0:e.value)?xo.error("Invalid metric received",e):!this.Ys||this.Ys>e.value?(this.T.url!==s&&(this.Hs(),this.Vs=setTimeout(this.Hs,this.flushToCaptureTimeoutMs)),Y(this.T.url)&&(this.T.url=s),this.T.firstMetricTimestamp=Y(this.T.firstMetricTimestamp)?Date.now():this.T.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0),this.T.metrics.push(I({},e,{$current_url:s,$session_id:i.sessionId,$window_id:i.windowId,timestamp:Date.now()})),this.T.metrics.length===this.allowedMetrics.length&&this.Hs()):xo.error("Ignoring metric with value >= "+this.Ys,e))}},this.Us=()=>{if(!this.bs){var e,t,i,s,r=F.__PosthogExtensions__;Y(r)||Y(r.postHogWebVitalsCallbacks)||({onLCP:e,onCLS:t,onFCP:i,onINP:s}=r.postHogWebVitalsCallbacks),e&&t&&i&&s?(this.allowedMetrics.indexOf("LCP")>-1&&e(this.nt.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&t(this.nt.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this.nt.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&s(this.nt.bind(this)),this.bs=!0):xo.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.Es=!(null==(t=this._instance.persistence)||!t.props[Yt]),this.startIfEnabled()}get Ws(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,i=V(this.Ws)?null==(e=this.Ws)?void 0:e.web_vitals_allowed_metrics:void 0;return Q(i)?(null==(t=this._instance.persistence)?void 0:t.props[Zt])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(V(this.Ws)?this.Ws.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=V(this.Ws)?this.Ws.web_vitals_attribution:void 0;return null!=e&&e}get Ys(){var e=V(this.Ws)&&ee(this.Ws.__web_vitals_max_value)?this.Ws.__web_vitals_max_value:Eo;return e>0&&6e4>=e?Eo:e}get isEnabled(){var e=null==x?void 0:x.protocol;if("http:"!==e&&"https:"!==e)return xo.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=V(this.Ws)?this.Ws.web_vitals:ie(this.Ws)?this.Ws:void 0;return ie(t)?t:this.Es}startIfEnabled(){this.isEnabled&&!this.bs&&(xo.info("enabled, starting..."),this.nr(this.Us))}onRemoteConfig(e){if("capturePerformance"in e){var t=V(e.capturePerformance)&&!!e.capturePerformance.web_vitals,i=V(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Yt]:t}),this._instance.persistence.register({[Zt]:i})),this.Es=t,this.startIfEnabled()}}nr(e){var t,i;null!=(t=F.__PosthogExtensions__)&&t.postHogWebVitalsCallbacks?e():null==(i=F.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",t=>{t?xo.error("failed to load script",t):e()})}zs(){var e=m?m.location.href:void 0;if(e){var t=this._instance.config.custom_personal_data_properties,i=this._instance.config.mask_personal_data_properties?[...Es,...t||[]]:[];return bs(e,i,Ss)}xo.error("Could not determine current URL")}}},ha={exceptionObserver:class{constructor(e){var t,i,s;this.Us=()=>{var e;if(m&&this.isEnabled&&null!=(e=F.__PosthogExtensions__)&&e.errorWrappingFunctions){var t=F.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=F.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=F.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Gs&&this.Rt.capture_unhandled_errors&&(this.Gs=t(this.captureException.bind(this))),!this.Xs&&this.Rt.capture_unhandled_rejections&&(this.Xs=i(this.captureException.bind(this))),!this.Js&&this.Rt.capture_console_errors&&(this.Js=s(this.captureException.bind(this)))}catch(e){yo.error("failed to start",e),this.Ks()}}},this._instance=e,this.Qs=!(null==(t=this._instance.persistence)||!t.props[Gt]),this.eo=new ve({refillRate:null!==(i=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)&&void 0!==i?i:1,bucketSize:null!==(s=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)&&void 0!==s?s:10,refillInterval:1e4,qt:yo}),this.Rt=this.ro(),this.startIfEnabledOrStop()}ro(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return V(e)?t=I({},t,e):(Y(e)?this.Qs:e)&&(t=I({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.Rt.capture_console_errors||this.Rt.capture_unhandled_errors||this.Rt.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(yo.info("enabled"),this.Ks(),this.nr(this.Us)):this.Ks()}nr(e){var t,i;null!=(t=F.__PosthogExtensions__)&&t.errorWrappingFunctions&&e(),null==(i=F.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",t=>{if(t)return yo.error("failed to load script",t);e()})}Ks(){var e,t,i;null==(e=this.Gs)||e.call(this),this.Gs=void 0,null==(t=this.Xs)||t.call(this),this.Xs=void 0,null==(i=this.Js)||i.call(this),this.Js=void 0}onRemoteConfig(e){"autocaptureExceptions"in e&&(this.Qs=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Gt]:this.Qs}),this.Rt=this.ro(),this.startIfEnabledOrStop())}onConfigChange(){this.Rt=this.ro()}captureException(e){var t,i,s,r=null!==(t=null==e||null==(i=e.$exception_list)||null==(i=i[0])?void 0:i.type)&&void 0!==t?t:"Exception";this.eo.consumeRateLimit(r)?yo.info("Skipping exception capture because of client rate limiting.",{exception:r}):null==(s=this._instance.exceptions)||s.sendExceptionEvent(e)}},exceptions:class{constructor(e){var t,i;this.io=[],this.no=new dt([new kt,new Mt,new Pt,new St,new Tt,new Ct,new Ft,new It],function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;t>s;s++)i[s-1]=arguments[s];return function(t,s){void 0===s&&(s=0);for(var r=[],n=t.split("\n"),o=s;n.length>o;o++){var a=n[o];if(1024>=a.length){var l=Et.test(a)?a.replace(Et,"$1"):a;if(!l.match(/\S*Error: /)){for(var u of i){var c=u(l,e);if(c){r.push(c);break}}if(r.length>=50)break}}}return function(e){if(!e.length)return[];var t=Array.from(e);return t.reverse(),t.slice(0,50).map(e=>{return I({},e,{filename:e.filename||(i=t,i[i.length-1]||{}).filename,function:e.function||pt});var i})}(r)}}("web:javascript",yt,xt)),this._instance=e,this.io=null!==(t=null==(i=this._instance.persistence)?void 0:i.get_property(Vt))&&void 0!==t?t:[]}onRemoteConfig(e){var t,i,s;if("errorTracking"in e){var r=null!==(t=null==(i=e.errorTracking)?void 0:i.suppressionRules)&&void 0!==t?t:[],n=null==(s=e.errorTracking)?void 0:s.captureExtensionExceptions;this.io=r,this._instance.persistence&&this._instance.persistence.register({[Vt]:this.io,[Kt]:n})}}get so(){var e,t=!!this._instance.get_property(Kt),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(e=null!=i?i:t)&&void 0!==e&&e}buildProperties(e,t){return this.no.buildFromUnknown(e,{syntheticException:null==t?void 0:t.syntheticException,mechanism:{handled:null==t?void 0:t.handled}})}sendExceptionEvent(e){var t=e.$exception_list;if(this.oo(t)){if(this.ao(t))return void sa.info("Skipping exception capture because a suppression rule matched");if(!this.so&&this.lo(t))return void sa.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.uo(t))return void sa.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent",zi:!0})}ao(e){if(0===e.length)return!1;var t=e.reduce((e,t)=>{var{type:i,value:s}=t;return X(i)&&i.length>0&&e.$exception_types.push(i),X(s)&&s.length>0&&e.$exception_values.push(s),e},{$exception_types:[],$exception_values:[]});return this.io.some(e=>{var i=e.values.map(e=>{var i,s=on[e.operator],r=B(e.value)?e.value:[e.value],n=null!==(i=t[e.key])&&void 0!==i?i:[];return r.length>0&&s(r,n)});return"OR"===e.type?i.some(Boolean):i.every(Boolean)})}lo(e){return e.flatMap(e=>{var t,i;return null!==(t=null==(i=e.stacktrace)?void 0:i.frames)&&void 0!==t?t:[]}).some(e=>e.filename&&e.filename.startsWith("chrome-extension://"))}uo(e){if(e.length>0){var t,i,s,r,n=null!==(t=null==(i=e[0].stacktrace)?void 0:i.frames)&&void 0!==t?t:[],o=n[n.length-1];return null!==(s=null==o||null==(r=o.filename)?void 0:r.includes("posthog.com/static"))&&void 0!==s&&s}return!1}oo(e){return!Q(e)&&B(e)}}},da=I({productTours:class{get Kr(){return this._instance.persistence}constructor(e){this.ho=null,this.co=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){"productTours"in e&&(this.Kr&&this.Kr.register({[Jt]:!!e.productTours}),this.loadIfEnabled())}loadIfEnabled(){var e,t;this.ho||(e=this._instance).config.disable_product_tours||null==(t=e.persistence)||!t.get_property(Jt)||this.nr(()=>this.do())}nr(e){var t,i;null!=(t=F.__PosthogExtensions__)&&t.generateProductTours?e():null==(i=F.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"product-tours",t=>{t?To.error("Could not load product tours script",t):e()})}do(){var e;!this.ho&&null!=(e=F.__PosthogExtensions__)&&e.generateProductTours&&(this.ho=F.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(void 0===t&&(t=!1),!B(this.co)||t){var i=this.Kr;if(i){var s=i.props[Io];if(B(s)&&!t)return this.co=s,void e(s,{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 s=t.statusCode;if(200!==s||!t.json){var r="Product Tours API could not be loaded, status: "+s;return To.error(r),void e([],{isLoaded:!1,error:r})}var n=B(t.json.product_tours)?t.json.product_tours:[];this.co=n,i&&i.register({[Io]:n}),e(n,{isLoaded:!0})}})}else e(this.co,{isLoaded:!0})}getActiveProductTours(e){Q(this.ho)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.ho.getActiveProductTours(e)}showProductTour(e){var t;null==(t=this.ho)||t.showTourById(e)}previewTour(e){this.ho?this.ho.previewTour(e):this.nr(()=>{var t;this.do(),null==(t=this.ho)||t.previewTour(e)})}dismissProductTour(){var e;null==(e=this.ho)||e.dismissTour("user_clicked_skip")}nextStep(){var e;null==(e=this.ho)||e.nextStep()}previousStep(){var e;null==(e=this.ho)||e.previousStep()}clearCache(){var e;this.co=null,null==(e=this.Kr)||e.unregister(Io)}resetTour(e){var t;null==(t=this.ho)||t.resetTour(e)}resetAllTours(){var e;null==(e=this.ho)||e.resetAllTours()}cancelPendingTour(e){var t;null==(t=this.ho)||t.cancelPendingTour(e)}}},la),pa={siteApps:class{constructor(e){this._instance=e,this.vo=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}fo(e,t){if(t){var i=this.globalsForEvent(t);this.vo.push(i),this.vo.length>1e3&&(this.vo=this.vo.slice(10))}}get siteAppLoaders(){var e;return null==(e=F._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.siteApps}initialize(){if(this.isEnabled){var e=this._instance._addCaptureHook(this.fo.bind(this));this.po=()=>{e(),this.vo=[],this.po=void 0}}}globalsForEvent(e){var t,i,s,r,n,o,a;if(!e)throw new Error("Event payload is required");var l={},u=this._instance.get_property("$groups")||[],c=this._instance.get_property("$stored_group_properties")||{};for(var[h,d]of Object.entries(c))l[h]={id:u[h],type:h,properties:d};var{$set_once:p,$set:v}=e;return{event:I({},M(e,Mo),{properties:I({},e.properties,v?{$set:I({},null!==(t=null==(i=e.properties)?void 0:i.$set)&&void 0!==t?t:{},v)}:{},p?{$set_once:I({},null!==(s=null==(r=e.properties)?void 0:r.$set_once)&&void 0!==s?s:{},p)}:{}),elements_chain:null!==(n=null==(o=e.properties)?void 0:o.$elements_chain)&&void 0!==n?n:"",distinct_id:null==(a=e.properties)?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}setupSiteApp(e){var t=this.apps[e.id],i=()=>{var i;!t.errored&&this.vo.length&&(Ao.info("Processing "+this.vo.length+" events for site app with id "+e.id),this.vo.forEach(e=>null==t.processEvent?void 0:t.processEvent(e)),t.processedBuffer=!0),Object.values(this.apps).every(e=>e.processedBuffer||e.errored)&&(null==(i=this.po)||i.call(this))},s=!1,r=r=>{t.errored=!r,t.loaded=!0,Ao.info("Site app with id "+e.id+" "+(r?"loaded":"errored")),s&&i()};try{var{processEvent:n}=e.init({posthog:this._instance,callback(e){r(e)}});n&&(t.processEvent=n),s=!0}catch(t){Ao.error(Lo+e.id,t),r(!1)}if(s&&t.loaded)try{i()}catch(i){Ao.error("Error while processing buffered events PostHog app with config id "+e.id,i),t.errored=!0}}mo(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var i of e)this.setupSiteApp(i)}yo(e){if(0!==Object.keys(this.apps).length){var t=this.globalsForEvent(e);for(var i of Object.values(this.apps))try{null==i.processEvent||i.processEvent(t)}catch(t){Ao.error("Error while processing event "+e.event+" for site app "+i.id,t)}}}onRemoteConfig(e){var t,i,s,r=this;if(null!=(t=this.siteAppLoaders)&&t.length)return this.isEnabled?(this.mo(),void this._instance.on("eventCaptured",e=>this.yo(e))):void Ao.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this.po)||i.call(this),null!=(s=e.siteApps)&&s.length)if(this.isEnabled){var n=function(e){var t;F["__$$ph_site_app_"+e]=r._instance,null==(t=F.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(r._instance,a,t=>{if(t)return Ao.error(Lo+e,t)})};for(var{id:o,url:a}of e.siteApps)n(o)}else Ao.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},va={tracingHeaders:class{constructor(e){this.bo=void 0,this.wo=void 0,this.Us=()=>{var e,t;Y(this.bo)&&(null==(e=F.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)||e._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),Y(this.wo)&&(null==(t=F.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)||t._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=e}initialize(){this.startIfEnabledOrStop()}nr(e){var t,i;null!=(t=F.__PosthogExtensions__)&&t.tracingHeadersPatchFns&&e(),null==(i=F.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",t=>{if(t)return wo.error("failed to load script",t);e()})}startIfEnabledOrStop(){var e,t;this._instance.config.__add_tracing_headers?this.nr(this.Us):(null==(e=this.bo)||e.call(this),null==(t=this.wo)||t.call(this),this.bo=void 0,this.wo=void 0)}}},ga=I({surveys:class{get Rt(){return this._instance.config}constructor(e){this._o=void 0,this._surveyManager=null,this.Io=!1,this.Co=[],this.So=null,this._instance=e,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this.Rt.disable_surveys){var t=e.surveys;if(Q(t))return dn.warn("Flags not loaded yet. Not loading surveys.");var i=B(t);this._o=i?t.length>0:t,dn.info("flags response received, isSurveysEnabled: "+this._o),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var i=localStorage.key(t);(null!=i&&i.startsWith(pn)||null!=i&&i.startsWith("inProgressSurvey_"))&&e.push(i)}e.forEach(e=>localStorage.removeItem(e))}loadIfEnabled(){if(!this._surveyManager)if(this.Io)dn.info("Already initializing surveys, skipping...");else if(this.Rt.disable_surveys)dn.info(Uo);else if(this.Rt.cookieless_mode&&this._instance.consent.isOptedOut())dn.info("Not loading surveys in cookieless mode without consent.");else{var e=null==F?void 0:F.__PosthogExtensions__;if(e){if(!Y(this._o)||this.Rt.advanced_enable_surveys){var t=this._o||this.Rt.advanced_enable_surveys;this.Io=!0;try{var i=e.generateSurveys;if(i)return void this.ko(i,t);var s=e.loadExternalDependency;if(!s)return void this.xo(xi);s(this._instance,"surveys",i=>{i||!e.generateSurveys?this.xo("Could not load surveys script",i):this.ko(e.generateSurveys,t)})}catch(e){throw this.xo("Error initializing surveys",e),e}finally{this.Io=!1}}}else dn.error("PostHog Extensions not found.")}}ko(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new Wo(this._instance),dn.info("Surveys loaded successfully"),this.To({isLoaded:!0})}xo(e,t){dn.error(e,t),this.To({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Co.push(e),this._surveyManager&&this.To({isLoaded:!0}),()=>{this.Co=this.Co.filter(t=>t!==e)}}getSurveys(e,t){if(void 0===t&&(t=!1),this.Rt.disable_surveys)return dn.info(Uo),e([]);var i,s=this._instance.get_property(ai);if(s&&!t)return e(s,{isLoaded:!0});"undefined"!=typeof Promise&&this.So?this.So.then(t=>{var{surveys:i,context:s}=t;return e(i,s)}):("undefined"!=typeof Promise&&(this.So=new Promise(e=>{i=e})),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Rt.token),method:"GET",timeout:this.Rt.surveys_request_timeout_ms,callback:t=>{var s;this.So=null;var r=t.statusCode;if(200!==r||!t.json){var n="Surveys API could not be loaded, status: "+r;dn.error(n);var o={isLoaded:!1,error:n};return e([],o),void(null==i||i({surveys:[],context:o}))}var a,l=t.json.surveys||[],u=l.filter(e=>{return!(!(t=e).start_date||t.end_date)&&(function(e){var t;return!(null==(t=e.conditions)||null==(t=t.events)||null==(t=t.values)||!t.length)}(e)||function(e){var t;return!(null==(t=e.conditions)||null==(t=t.actions)||null==(t=t.values)||!t.length)}(e));var t});u.length>0&&(null==(a=this._surveyEventReceiver)||a.register(u)),null==(s=this._instance.persistence)||s.register({[ai]:l});var c={isLoaded:!0};e(l,c),null==i||i({surveys:l,context:c})}}))}To(e){for(var t of this.Co)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(e){dn.error("Error in survey callback",e)}}getActiveMatchingSurveys(e,t){if(void 0===t&&(t=!1),!Q(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);dn.warn("init was not called")}Ao(e){var t=null;return this.getSurveys(i=>{var s;t=null!==(s=i.find(t=>t.id===e))&&void 0!==s?s:null}),t}Eo(e){if(Q(this._surveyManager))return{eligible:!1,reason:Ho};var t="string"==typeof e?this.Ao(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(Q(this._surveyManager))return dn.warn("init was not called"),{visible:!1,disabledReason:Ho};var t=this.Eo(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return Q(this._surveyManager)?(dn.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Ho})):new Promise(i=>{this.getSurveys(t=>{var s,r=null!==(s=t.find(t=>t.id===e))&&void 0!==s?s:null;if(r){var n=this.Eo(r);i({visible:n.eligible,disabledReason:n.reason})}else i({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t,i){var s;if(Q(this._surveyManager))dn.warn("init was not called");else{var r="string"==typeof e?this.Ao(e):e;if(null!=r&&r.id)if(_n.includes(r.type)){var n=null==w?void 0:w.querySelector(t);if(n)return null!=(s=r.appearance)&&s.surveyPopupDelaySeconds?(dn.info("Rendering survey "+r.id+" with delay of "+r.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout(()=>{var e,t;dn.info("Rendering survey "+r.id+" with delay of "+(null==(e=r.appearance)?void 0:e.surveyPopupDelaySeconds)+" seconds"),null==(t=this._surveyManager)||t.renderSurvey(r,n,i),dn.info("Survey "+r.id+" rendered")},1e3*r.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(r,n,i);dn.warn("Survey element not found")}else dn.warn("Surveys of type "+r.type+" cannot be rendered in the app");else dn.warn("Survey not found")}}displaySurvey(e,t){var i;if(Q(this._surveyManager))dn.warn("init was not called");else{var s=this.Ao(e);if(s){var r=s;if(null!=(i=s.appearance)&&i.surveyPopupDelaySeconds&&t.ignoreDelay&&(r=I({},s,{appearance:I({},s.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==er&&t.initialResponses&&dn.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===t.ignoreConditions){var n=this.canRenderSurvey(s);if(!n.visible)return void dn.warn("Survey is not eligible to be displayed: ",n.disabledReason)}t.displayType!==tr?this._surveyManager.handlePopoverSurvey(r,t):this.renderSurvey(r,t.selector,t.properties)}else dn.warn("Survey not found")}}cancelPendingSurvey(e){Q(this._surveyManager)?dn.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;null==(e=this._surveyManager)||e.handlePageUnload()}}},la),_a={toolbar:class{constructor(e){this.instance=e}Ro(e){F.ph_toolbar_state=e}No(){var e;return null!==(e=F.ph_toolbar_state)&&void 0!==e?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,t,i){if(void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===i&&(i=void 0),zi(this.instance.config))return!1;if(!m||!w)return!1;e=null!=e?e:m.location,i=null!=i?i:m.history;try{if(!t){try{m.localStorage.setItem("test","test"),m.localStorage.removeItem("test")}catch(e){return!1}t=null==m?void 0:m.localStorage}var s,r=zo||ws(e.hash,"__posthog")||ws(e.hash,"state"),n=r?ji(()=>JSON.parse(atob(decodeURIComponent(r))))||ji(()=>JSON.parse(decodeURIComponent(r))):null;return n&&"ph_authorize"===n.action?((s=n).source="url",s&&Object.keys(s).length>0&&(n.desiredHash?e.hash=n.desiredHash:i?i.replaceState(i.state,"",e.pathname+e.search):e.hash="")):((s=JSON.parse(t.getItem(Bo)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token||(this.loadToolbar(s),0))}catch(e){return!1}}Mo(e){var t=F.ph_load_toolbar||F.ph_load_editor;!Q(t)&&G(t)?t(e,this.instance):Go.warn("No toolbar load function found")}loadToolbar(e){var t=!(null==w||!w.getElementById(yi));if(!m||t)return!1;var i="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=I({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},i?{instrument:!1}:{});if(m.localStorage.setItem(Bo,JSON.stringify(I({},s,{source:void 0}))),2===this.No())this.Mo(s);else if(0===this.No()){var r;this.Ro(1),null==(r=F.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this.instance,"toolbar",e=>{if(e)return Go.error("[Toolbar] Failed to load",e),void this.Ro(0);this.Ro(2),this.Mo(s)}),Ui(m,"turbolinks:load",()=>{this.Ro(0),this.loadToolbar(s)})}return!0}Fo(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,i){return void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===i&&(i=void 0),this.maybeLoadToolbar(e,t,i)}}},fa=I({experiments:class e{get Rt(){return this._instance.config}constructor(t){var i=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),i.getWebExperiments(t=>{e.Fn("retrieved web experiments from the server"),i.On=new Map,t.forEach(t=>{if(t.feature_flag_key){var s;i.On&&(e.Fn("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(s=i.On)||s.set(t.feature_flag_key,t));var r=i._instance.getFeatureFlag(t.feature_flag_key);X(r)&&t.variants[r]&&i.Pn(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var n in t.variants){var o=t.variants[n];e.Ln(o)&&i.Pn(t.name,n,o.transforms)}})},t)},this._instance=t,this._instance.onFeatureFlags(e=>{this.onFeatureFlags(e)})}initialize(){}onFeatureFlags(t){if(this._is_bot())e.Fn(ra);else if(!this.Rt.disable_web_experiments){if(Q(this.On))return this.On=new Map,this.loadIfEnabled(),void this.previewWebExperiment();e.Fn("applying feature flags",t),t.forEach(e=>{var t;if(this.On&&null!=(t=this.On)&&t.has(e)){var i,s=this._instance.getFeatureFlag(e),r=null==(i=this.On)?void 0:i.get(e);s&&null!=r&&r.variants[s]&&this.Pn(r.name,s,r.variants[s].transforms)}})}}previewWebExperiment(){var t=e.getWindowLocation();if(null!=t&&t.search){var i=ys(null==t?void 0:t.search,"__experiment_id"),s=ys(null==t?void 0:t.search,"__experiment_variant");i&&s&&(e.Fn("previewing web experiments "+i+" && "+s),this.getWebExperiments(e=>{this.Dn(parseInt(i),s,e)},!1,!0))}}loadIfEnabled(){this.Rt.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,i){if(this.Rt.disable_web_experiments&&!i)return e([]);var s=this._instance.get_property("$web_experiments");if(s&&!t)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Rt.token),method:"GET",callback:t=>e(200===t.statusCode&&t.json&&t.json.experiments||[])})}Dn(t,i,s){var r=s.filter(e=>e.id===t);r&&r.length>0&&(e.Fn("Previewing web experiment ["+r[0].name+"] with variant ["+i+"]"),this.Pn(r[0].name,i,r[0].variants[i].transforms))}static Ln(t){return!Q(t.conditions)&&e.Bn(t)&&e.jn(t)}static Bn(t){var i;if(Q(t.conditions)||Q(null==(i=t.conditions)?void 0:i.url))return!0;var s,r,n,o=e.getWindowLocation();return!!o&&(null==(s=t.conditions)||!s.url||na[null!==(r=null==(n=t.conditions)?void 0:n.urlMatchType)&&void 0!==r?r:"icontains"](t.conditions.url,o))}static getWindowLocation(){return null==m?void 0:m.location}static jn(e){var t;if(Q(e.conditions)||Q(null==(t=e.conditions)?void 0:t.utm))return!0;var i=Rs();if(i.utm_source){var s,r,n,o,a,l,u,c,h=null==(s=e.conditions)||null==(s=s.utm)||!s.utm_campaign||(null==(r=e.conditions)||null==(r=r.utm)?void 0:r.utm_campaign)==i.utm_campaign,d=null==(n=e.conditions)||null==(n=n.utm)||!n.utm_source||(null==(o=e.conditions)||null==(o=o.utm)?void 0:o.utm_source)==i.utm_source,p=null==(a=e.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=e.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==i.utm_medium,v=null==(u=e.conditions)||null==(u=u.utm)||!u.utm_term||(null==(c=e.conditions)||null==(c=c.utm)?void 0:c.utm_term)==i.utm_term;return h&&p&&v&&d}return!1}static Fn(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;t>s;s++)i[s-1]=arguments[s];Lt.info("[WebExperiments] "+e,i)}Pn(t,i,s){this._is_bot()?e.Fn(ra):"control"!==i?s.forEach(s=>{if(s.selector){var r;e.Fn("applying transform of variant "+i+" for experiment "+t+" ",s);var n=null==(r=document)?void 0:r.querySelectorAll(s.selector);null==n||n.forEach(e=>{var t=e;s.html&&(t.innerHTML=s.html),s.css&&t.setAttribute("style",s.css)})}}):e.Fn("Control variants leave the page unmodified.")}_is_bot(){return b&&this._instance?sn(b,this.Rt.custom_blocked_useragents):void 0}}},la),ma={conversations:class{constructor(e){this.Oo=void 0,this._conversationsManager=null,this.Po=!1,this.Lo=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations){var t=e.conversations;Q(t)||(ie(t)?this.Oo=t:(this.Oo=t.enabled,this.Lo=t),this.loadIfEnabled())}}reset(){var e;null==(e=this._conversationsManager)||e.reset(),this._conversationsManager=null,this.Oo=void 0,this.Lo=null}loadIfEnabled(){if(!(this._conversationsManager||this.Po||this._instance.config.disable_conversations||zi(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=null==F?void 0:F.__PosthogExtensions__;if(e&&!Y(this.Oo)&&this.Oo)if(this.Lo&&this.Lo.token){this.Po=!0;try{var t=e.initConversations;if(t)return this.Do(t),void(this.Po=!1);var i=e.loadExternalDependency;if(!i)return void this.Bo(xi);i(this._instance,"conversations",t=>{t||!e.initConversations?this.Bo("Could not load conversations script",t):this.Do(e.initConversations),this.Po=!1})}catch(e){this.Bo("Error initializing conversations",e),this.Po=!1}}else oa.error("Conversations enabled but missing token in remote config.")}}Do(e){if(this.Lo)try{this._conversationsManager=e(this.Lo,this._instance),oa.info("Conversations loaded successfully")}catch(e){this.Bo("Error completing conversations initialization",e)}else oa.error("Cannot complete initialization: remote config is null")}Bo(e,t){oa.error(e,t),this._conversationsManager=null,this.Po=!1}show(){this._conversationsManager?this._conversationsManager.show():oa.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Oo&&!Z(this._conversationsManager)}isVisible(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.isVisible())&&void 0!==e&&e}sendMessage(e,t,i){var s=this;return T(function*(){return s._conversationsManager?s._conversationsManager.sendMessage(e,t,i):(oa.warn(aa),null)})()}getMessages(e,t){var i=this;return T(function*(){return i._conversationsManager?i._conversationsManager.getMessages(e,t):(oa.warn(aa),null)})()}markAsRead(e){var t=this;return T(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(oa.warn(aa),null)})()}getTickets(e){var t=this;return T(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(oa.warn(aa),null)})()}requestRestoreLink(e){var t=this;return T(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(oa.warn(aa),null)})()}restoreFromToken(e){var t=this;return T(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(oa.warn(aa),null)})()}restoreFromUrlToken(){var e=this;return T(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(oa.warn(aa),null)})()}getCurrentTicketId(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.getCurrentTicketId())&&void 0!==e?e:null}getWidgetSessionId(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.getWidgetSessionId())&&void 0!==e?e:null}Ki(){var e;null==(e=this._conversationsManager)||e.setIdentity()}Qi(){var e;null==(e=this._conversationsManager)||e.clearIdentity()}}},ya={logs:class{constructor(e){var t;this.jo=!1,this.qo=!1,this._instance=e,this._instance&&null!=(t=this._instance.config.logs)&&t.captureConsoleLogs&&(this.jo=!0)}initialize(){this.loadIfEnabled()}onRemoteConfig(e){var t,i=null==(t=e.logs)?void 0:t.captureConsoleLogs;!Q(i)&&i&&(this.jo=!0,this.loadIfEnabled())}reset(){}loadIfEnabled(){if(this.jo&&!this.qo){var e=Dt("[logs]"),t=null==F?void 0:F.__PosthogExtensions__;if(t){var i=t.loadExternalDependency;i?i(this._instance,"logs",i=>{var s;i||null==(s=t.logs)||!s.initializeLogs?e.error("Could not load logs script",i):(t.logs.initializeLogs(this._instance),this.qo=!0)}):e.error(xi)}else e.error("PostHog Extensions not found.")}}}},ba=I({},la,ua,ca,ha,da,pa,ga,va,_a,fa,ma,ya);An.__defaultExtensionClasses=I({},ba);var wa=(jo=wn[$n]=new An,function(){function e(){e.done||(e.done=!0,On=!1,Ai(wn,function(e){e._dom_loaded()}))}null!=w&&w.addEventListener?"complete"===w.readyState?e():Ui(w,"DOMContentLoaded",e,{capture:!1}):m&&Lt.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),jo),xa={};function Ea(e){var t;return null!=(t=null==e?void 0:e.posthog)?t:wa}var ka,Sa={type:"posthog",config:{},async init({config:e,env:t}){const i=e.settings;if(!(null==i?void 0:i.apiKey))return!1;const s=Ea(t),{apiKey:r,identify:n,group:o,_state:a,...l}=i,u={autocapture:!1,capture_pageview:!1,capture_pageleave:!1,...l};let c=!1;s.init(r,{...u,loaded:()=>{c=!0}}),c||await Promise.resolve();return{...e,settings:{...i,_state:{lastIdentity:{},lastGroup:{}}}}},async push(e,{config:t,rule:i,env:s,data:r,collector:n}){var o,a;const l=Ea(s),u=t.settings||{},d=(null==i?void 0:i.settings)||{},p=u._state||{};if(void 0!==d.reset){("boolean"==typeof d.reset?d.reset:await _(e,d.reset,{collector:n}))&&(l.reset(),p.lastIdentity={},p.lastGroup={})}const v=null!=(o=d.identify)?o:u.identify;if(void 0!==v){const t=await _(e,v,{collector:n});c(t)&&(p.lastIdentity=function(e,t,i={}){const s={...i},r=t.distinctId,n=c(t.$set)?t.$set:void 0,o=c(t.$set_once)?t.$set_once:void 0;return h(r)&&""!==r?(r!==i.distinctId||n||o)&&(e.identify(r,n,o),s.distinctId=r):(n||o)&&e.setPersonProperties(n,o),s}(l,t,p.lastIdentity))}const g=null!=(a=d.group)?a:u.group;if(void 0!==g){const t=await _(e,g,{collector:n});c(t)&&(p.lastGroup=function(e,t,i={}){const s={...i},r=t.type,n=t.key,o=c(t.properties)?t.properties:void 0;return h(r)&&h(n)&&(r!==i.type||n!==i.key||o)&&(e.group(r,n,o),s.type=r,s.key=n),s}(l,t,p.lastGroup))}if(!0!==(null==i?void 0:i.silent)){const t=h(null==i?void 0:i.name)?i.name:e.name,s=c(r)?r:{};l.capture(t,s)}u._state=p},on(e,t){var i;if("consent"!==e||!(null==t?void 0:t.data))return;const s=Ea(t.env),r=t.data,n=null==(i=t.config)?void 0:i.consent;if(!n||0===Object.keys(n).length)return;Object.keys(n).every(e=>!0===r[e])?s.opt_in_capturing():s.opt_out_capturing()}},Pa=Sa;return ka=r,((r,n,o,a)=>{if(n&&"object"==typeof n||"function"==typeof n)for(let l of i(n))s.call(r,l)||l===o||e(r,l,{get:()=>n[l],enumerable:!(a=t(n,l))||a.enumerable});return r})(e({},"__esModule",{value:!0}),ka)})();