PageSourceSearch

https://www.thenational.academy/_next/static/chunks/80ec7963-7db35…?dpl=dpl_FpvzYYJKwgnQiozN4Ww5oQ9mAKNL

js thenational.academy collected 2026-09-24 09:25:54 UTC 180,517 bytes, 2 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[350],{201:(e,t,i)=>{i.d(t,{Ay:()=>nH});var s="undefined"!=typeof window?window:void 0,r="undefined"!=typeof globalThis?globalThis:s;"undefined"==typeof self&&(r.self=r),"undefined"==typeof File&&(r.File=function(){});var n=null==r?void 0:r.navigator,o=null==r?void 0:r.document,a=null==r?void 0:r.location,l=null==r?void 0:r.fetch,u=null!=r&&r.XMLHttpRequest&&"withCredentials"in new r.XMLHttpRequest?r.XMLHttpRequest:void 0,c=null==r?void 0:r.AbortController,h=null==r?void 0:r.CompressionStream,d=null==n?void 0:n.userAgent,p=null!=s?s:{},g="1.369.0",v={DEBUG:!1,LIB_VERSION:g,LIB_NAME:"web",JS_SDK_VERSION:g};function _(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 f(e){return function(){var t=this,i=arguments;return new Promise(function(s,r){var n=e.apply(t,i);function o(e){_(n,s,r,o,a,"next",e)}function a(e){_(n,s,r,o,a,"throw",e)}o(void 0)})}}function m(){return(m=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}).apply(null,arguments)}function y(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 b(){return(b=f(function*(e,t,i){void 0===t&&(t=!0);try{var s=new Blob([e],{type:"text/plain"}).stream().pipeThrough(new CompressionStream("gzip"));return yield new Response(s).blob()}catch(e){if(null!=i&&i.rethrow)throw e;return t&&console.error("Failed to gzip compress data",e),null}})).apply(this,arguments)}var w=["$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"],x=["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"],E=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var i=e.toLowerCase();return x.concat(t).some(e=>{var t=e.toLowerCase();return -1!==i.indexOf(t)})};function k(e,t){return -1!==e.indexOf(t)}var S=function(e){return e.trim()},P=function(e){return e.replace(/^\$/,"")},R=Object.prototype,F=R.hasOwnProperty,I=R.toString,$=Array.isArray||function(e){return"[object Array]"===I.call(e)},T=e=>"function"==typeof e,C=e=>e===Object(e)&&!$(e),O=e=>{if(C(e)){for(var t in e)if(F.call(e,t))return!1;return!0}return!1},M=e=>void 0===e,A=e=>"[object String]"==I.call(e),L=e=>A(e)&&0===e.trim().length,D=e=>null===e,N=e=>M(e)||D(e),j=e=>"[object Number]"==I.call(e)&&e==e,q=e=>j(e)&&e>0,H=e=>"[object Boolean]"===I.call(e),U=e=>k(w,e);function W(e){return null===e||"object"!=typeof e}function z(e,t){return({}).toString.call(e)==="[object "+t+"]"}function V(e){return"undefined"!=typeof Event&&function(e,t){try{return e instanceof t}catch(e){return!1}}(e,Event)}var G=[!0,"true",1,"1","yes"],B=e=>k(G,e),X=[!1,"false",0,"0","no"];function Y(e,t,i,s,r){return t>i&&(s.warn("min cannot be greater than max."),t=i),j(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),Y(r||i,t,i,s))}class J{constructor(e){this.Pt={},this.Dt=e.Dt,this.jt=Y(e.bucketSize,0,100,e.qt),this.$t=Y(e.refillRate,0,this.jt,e.qt),this.Vt=Y(e.refillInterval,0,864e5,e.qt)}Ht(e,t){var i=Math.floor((t-e.lastAccess)/this.Vt);i>0&&(e.tokens=Math.min(e.tokens+i*this.$t,this.jt),e.lastAccess=e.lastAccess+i*this.Vt)}consumeRateLimit(e){var t,i=Date.now(),s=String(e),r=this.Pt[s];return r?this.Ht(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={}}}var K,Z,Q,ee="Mobile",et="Android",ei="Tablet",es=et+" "+ei,er="iPad",en="Apple",eo=en+" Watch",ea="Safari",el="BlackBerry",eu="Samsung",ec=eu+"Browser",eh=eu+" Internet",ed="Chrome",ep=ed+" OS",eg=ed+" iOS",ev="Internet Explorer",e_=ev+" "+ee,ef="Opera",em=ef+" Mini",ey="Edge",eb="Microsoft "+ey,ew="Firefox",ex=ew+" iOS",eE="Nintendo",ek="PlayStation",eS="Xbox",eP=et+" "+ee,eR=ee+" "+ea,eF="Windows",eI=eF+" Phone",e$="Nokia",eT="Ouya",eC="Generic",eO=eC+" "+ee.toLowerCase(),eM=eC+" "+ei.toLowerCase(),eA="Konqueror",eL="(\\d+(\\.\\d+)?)",eD=RegExp("Version/"+eL),eN=RegExp(eS,"i"),ej=RegExp(ek+" \\w+","i"),eq=RegExp(eE+" \\w+","i"),eH=RegExp(el+"|PlayBook|BB10","i"),eU={"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"},eW=function(e,t){var i;return t=t||"",k(e," OPR/")&&k(e,"Mini")?em:k(e," OPR/")?ef:eH.test(e)?el:k(e,"IE"+ee)||k(e,"WPDesktop")?e_:k(e,ec)?eh:k(e,ey)||k(e,"Edg/")?eb:k(e,"FBIOS")?"Facebook "+ee:k(e,"UCWEB")||k(e,"UCBrowser")?"UC Browser":k(e,"CriOS")?eg:k(e,"CrMo")||k(e,ed)?ed:k(e,et)&&k(e,ea)?eP:k(e,"FxiOS")?ex:k(e.toLowerCase(),eA.toLowerCase())?eA:(i=t)&&k(i,en)||k(e,ea)&&!k(e,ed)&&!k(e,et)?k(e,ee)?eR:ea:k(e,ew)?ew:k(e,"MSIE")||k(e,"Trident/")?ev:k(e,"Gecko")?ew:""},ez={[e_]:[RegExp("rv:"+eL)],[eb]:[RegExp(ey+"?\\/"+eL)],[ed]:[RegExp("("+ed+"|
1CrMo)\\/"+eL)],[eg]:[RegExp("CriOS\\/"+eL)],"UC Browser":[RegExp("(UCBrowser|UCWEB)\\/"+eL)],[ea]:[eD],[eR]:[eD],[ef]:[RegExp("(Opera|OPR)\\/"+eL)],[ew]:[RegExp(ew+"\\/"+eL)],[ex]:[RegExp("FxiOS\\/"+eL)],[eA]:[RegExp("Konqueror[:/]?"+eL,"i")],[el]:[RegExp(el+" "+eL),eD],[eP]:[RegExp("android\\s"+eL,"i")],[eh]:[RegExp(ec+"\\/"+eL)],[ev]:[RegExp("(rv:|MSIE )"+eL)],Mozilla:[RegExp("rv:"+eL)]},eV=function(e,t){var i=ez[eW(e,t)];if(M(i))return null;for(var s=0;i.length>s;s++){var r=e.match(i[s]);if(r)return parseFloat(r[r.length-2])}return null},eG=[[RegExp(eS+"; "+eS+" (.*?)[);]","i"),e=>[eS,e&&e[1]||""]],[RegExp(eE,"i"),[eE,""]],[RegExp(ek,"i"),[ek,""]],[eH,[el,""]],[RegExp(eF,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[eI,""];if(new RegExp(ee).test(t)&&!/IEMobile\b/.test(t))return[eF+" "+ee,""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var s=eU[i[1]]||"";return/arm/i.test(t)&&(s="RT"),[eF,s]}return[eF,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?["iOS",[e[3],e[4],e[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=M(e[2])?e[3]:e[2]),["watchOS",t]}],[RegExp("("+et+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+et+")","i"),e=>e&&e[2]?[et,[e[2],e[3],e[4]||"0"].join(".")]:[et,""]],[/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/,[ep,""]],[/Linux|debian/i,["Linux",""]]],eB=function(e){return eq.test(e)?eE:ej.test(e)?ek:eN.test(e)?eS:RegExp(eT,"i").test(e)?eT:RegExp("("+eI+"|WPDesktop)","i").test(e)?eI:/iPad/.test(e)?er:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?eo:eH.test(e)?el:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":RegExp(e$,"i").test(e)?e$:/(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(ee).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)?et:es:RegExp("(pda|"+ee+")","i").test(e)?eO:RegExp(ei,"i").test(e)&&!RegExp(ei+" pc","i").test(e)?eM:""},eX=e=>e instanceof Error;class eY{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 f(function*(){for(var i of e)i.stacktrace&&i.stacktrace.frames&&$(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)),m({},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 f(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)?i:"generic",handled:null==(s=t.handled)||s,synthetic:null!=(r=e.synthetic)&&r}};e.stack&&(n.stacktrace={type:"raw",frames:e.stack});var o=[n];return null!=e.cause&&o.push(...this.convertToExceptionList(e.cause,m({},t,{handled:!0}))),o}buildParsingContext(e){var t;return{chunkIdMap:function(e){var t=globalThis._posthogChunkIds;if(t){var i=Object.keys(t);return Q&&i.length===Z||(Z=i.length,Q=i.reduce((i,s)=>{K||(K={});var r=K[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,K[s]=[l,u];break}}return i},{})),Q}}(this.stackParser),skipFirstLines:null!=(t=e.skipFirstLines)?t:1}}buildCoercingContext(e,t,i){void 0===i&&(i=0);var s=(i,s)=>{if(4>
1=s){var r=this.buildCoercingContext(e,t,s);return this.applyCoercers(i,r)}};return m({},t,{syntheticException:0==i?t.syntheticException:void 0,mechanism:e,apply:e=>s(e,i),next:e=>s(e,i+1)})}}function eJ(e,t,i,s,r){var n={platform:e,filename:t,function:"<anonymous>"===i?"?":i,in_app:!0};return M(s)||(n.lineno=s),M(r)||(n.colno=r),n}var eK=(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]:"?",i?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},eZ=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,eQ=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,e0=/\((\S*)(?::(\d+))(?::(\d+))\)/,e1=(e,t)=>{var i=eZ.exec(e);if(i){var[,s,r,n]=i;return eJ(t,s,"?",+r,+n)}var o=eQ.exec(e);if(o){if(o[2]&&0===o[2].indexOf("eval")){var a=e0.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,u]=eK(o[1]||"?",o[2]);return eJ(t,u,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},e2=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,e3=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,e5=(e,t)=>{var i=e2.exec(e);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var s=e3.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]||"?";return[n,r]=eK(n,r),eJ(t,r,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},e6=/\(error: (.*)\)/;class e8{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var i=A(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 z(e,"DOMException")}isDOMError(e){return z(e,"DOMError")}}class e4{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}}class e7{constructor(){}match(e){return z(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}}}var e9=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class te{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(e9);return s&&(t=s[1],i=s[2]),[t,i]}}var tt=["fatal","error","warning","log","info","debug"];function ti(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""}class ts{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 V(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: "+ti(e)}isSeverityLevel(e){return A(e)&&!L(e)&&tt.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if(({}).hasOwnProperty.call(e,t)){var i=e[t];if(eX(i))return i}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}}class tr{match(e){return V(e)}coerce(e,t){var i,s=e.constructor.name;return{type:s,value:s+" captured as exception with keys: "+ti(e),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}class tn{match(e){return W(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}}}class to{match(e){return z(e,"PromiseRejectionEvent")||this.isCu
1stomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!V(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 W(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}}var ta=function(e,t){var{debugEnabled:i}=void 0===t?{}:t,r={C(t){if(s&&(v.DEBUG||p.POSTHOG_DEBUG||i)&&!M(s.console)&&s.console){for(var r=("__rrweb_original__"in s.console[t])?s.console[t].__rrweb_original__:s.console[t],n=arguments.length,o=Array(n>1?n-1:0),a=1;n>a;a++)o[a-1]=arguments[a];r(e,...o)}},info(){for(var e=arguments.length,t=Array(e),i=0;e>i;i++)t[i]=arguments[i];r.C("log",...t)},warn(){for(var e=arguments.length,t=Array(e),i=0;e>i;i++)t[i]=arguments[i];r.C("warn",...t)},error(){for(var e=arguments.length,t=Array(e),i=0;e>i;i++)t[i]=arguments[i];r.C("error",...t)},critical(){for(var t=arguments.length,i=Array(t),s=0;t>s;s++)i[s]=arguments[s];console.error(e,...i)},uninitializedWarning(e){r.error("You must initialize PostHog before calling "+e)},createLogger:(t,i)=>ta(e+" "+t,i)};return r},tl=ta("[PostHog.js]"),tu=tl.createLogger,tc=tu("[ExternalScriptsLoader]"),th=(e,t,i)=>{if(e.config.disable_external_dependency_loading)return tc.warn(t+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var s=null==o?void 0:o.querySelectorAll("script");if(s){for(var r,n=0;s.length>n;n++)if(r=function(){if(s[n].src===t){var e=s[n];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})}}())return r.v}var a=()=>{if(!o)return i("document not found");var s=o.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)o.head.appendChild(s);else{var r,n=o.querySelectorAll("body > script");n.length>0?null==(r=n[0].parentNode)||r.insertBefore(s,n[0]):o.body.appendChild(s)}};null!=o&&o.body?a():null==o||o.addEventListener("DOMContentLoaded",a)};p.__PosthogExtensions__=p.__PosthogExtensions__||{},p.__PosthogExtensions__.loadExternalDependency=(e,t,i)=>{if("remote-config"!==t)if(e._resolvedSdkVersion){var s=e.requestRouter.endpointFor("assets","/static/"+e._resolvedSdkVersion+"/"+t+".js");th(e,s,i)}else{var r="/static/"+t+".js?v="+e.version;"toolbar"===t&&(r=r+"&t="+3e5*Math.floor(Date.now()/3e5));var n=e.requestRouter.endpointFor("assets",r);th(e,n,i)}else{var o=e.requestRouter.endpointFor("assets","/array/"+e.config.token+"/config.js");th(e,o,i)}},p.__PosthogExtensions__.loadSiteApp=(e,t,i)=>{var s=e.requestRouter.endpointFor("api",t);th(e,s,i)};var td="$people_distinct_id",tp="$device_id",tg="__alias",tv="__timers",t_="$autocapture_disabled_server_side",tf="$heatmaps_enabled_server_side",tm="$exception_capture_enabled_server_side",ty="$error_tracking_suppression_rules",tb="$error_tracking_capture_extension_exceptions",tw="$web_vitals_enabled_server_side",tx="$dead_clicks_enabled_server_side",tE="$product_tours_enabled_server_side",tk="$web_vitals_allowed_metrics",tS="$session_recording_remote_config",tP="$sesid",tR="$session_is_sampled",tF="$enabled_feature_flags",tI="$early_access_features",t$="$feature_flag_details",tT="$stored_person_properties",tC="$stored_group_properties",tO="$surveys",tM="$flag_call_reported",tA="$flag_call_reported_session_id",tL="$feature_flag_errors",tD="$feature_flag_evaluated_at",tN="$user_state",tj="$client_session_props",tq="$capture_rate_limit",tH="$initial_campaign_params",tU="$initial_referrer_info",tW="$initial_person_info",tz="$epp",tV="__POSTHOG_TOOLBAR__",tG="$posthog_cookieless",tB=[td,tg,"__cmpns",tv,"$session_recording_enabled_server_side",tf,tP,tF,ty,tN,tI,t$,tC,tT,tO,tM,tA,tL,tD,tj,tq,tH,tU,tz,tW],tX="PostHog loadExternalDependency extension not found.",tY="on_reject",tJ="always",tK="anonymous",tZ="identified",tQ="identified_only",t0="visibilitychange",t1="beforeunload",t2="$pageview",t3="$pageleave",t5="$identify",t6="$groupidentify";function t8(e,t){$(e)&&e.forEach(t)}function t4(e,t){if(!N(e))if($(e))e.forEach(t);else if(e instanceof FormData)e.forEach((e,i)=>t(e,i));else for(var i in e)F.call(e,i)&&t(e[i],i)}var t7=function(e){for(var t=arguments.length,i=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 t9(e){for(var t=Object.keys(e),i=t.length,s=Array(i);i--;)s[i]=[t[i],e[t[i]]];return s}var ie=function(e){try{return e()}catch(e){return}},it=function(e){return function(){try{for(var t=arguments.length,i=Array(t),s=0;t>s;s++)i[s]=arguments[s];return e.apply(this,i)}catch(e){tl.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),tl.critical(e)}}},ii=function(e){var t={};return t4(e,function(e,i){(A(e)&&e.length>0||j(e))&&(t[i]=e)}),t},is=["herokuapp.com","vercel.app","netlify.app"];function ir(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 io(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 j(e)&&isFinite(e)&&Math.floor(e)===e});class ia{constructor(e){if(this.bytes=e,16!==e.length)throw TypeError("not 128-bit length")}static fromFieldsV7(e,t,i,s){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||0>e||0>t||0>i||0>s||e>0xffffffffffff||t>4095||i>0x3fffffff||s>0xffffffff)throw RangeError("invalid field value");
1var r=new Uint8Array(16);return r[0]=e/0x10000000000,r[1]=e/0x100000000,r[2]=e/0x1000000,r[3]=e/65536,r[4]=e/256,r[5]=e,r[6]=112|t>>>8,r[7]=t,r[8]=128|i>>>24,r[9]=i>>>16,r[10]=i>>>8,r[11]=i,r[12]=s>>>24,r[13]=s>>>16,r[14]=s>>>8,r[15]=s,new ia(r)}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 Error("Invalid UUIDv7 was generated");return e}clone(){return new ia(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}}class il{constructor(){this.I=0,this.S=0,this.k=new ih}generate(){var e=this.generateOrAbort();if(M(e)){this.I=0;var t=this.generateOrAbort();if(M(t))throw 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>0x3ffffffffff&&(this.I++,this.A())}return ia.fromFieldsV7(this.I,Math.trunc(this.S/0x40000000),0x3fffffff&this.S,this.k.nextUint32())}A(){this.S=1024*this.k.nextUint32()+(1023&this.k.nextUint32())}}var iu,ic=e=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw Error("no cryptographically strong RNG available");for(var t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};s&&!M(s.crypto)&&crypto.getRandomValues&&(ic=e=>crypto.getRandomValues(e));class ih{constructor(){this.T=new Uint32Array(8),this.N=1/0}nextUint32(){return this.T.length>this.N||(ic(this.T),this.N=0),this.T[this.N++]}}var id=()=>ip().toString(),ip=()=>(iu||(iu=new il)).generate(),ig="",iv=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,i_={Ut:()=>!!o,Yt(e){tl.error("cookieStore error: "+e)},Gt(e){if(o){try{for(var t=e+"=",i=o.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}},Wt(e){var t;try{t=JSON.parse(i_.Gt(e))||{}}catch(e){}return t},Xt(e,t,i,s,r){if(o)try{var n="",a="",l=function(e,t){if(t){var i=function(e,t){if(void 0===t&&(t=o),ig)return ig;if(!t||["localhost","127.0.0.1"].includes(e))return"";for(var i=e.split("."),s=Math.min(i.length,8),r="dmn_chk_"+id();!ig&&s--;){var n=i.slice(s).join("."),a=r+"=1;domain=."+n+";path=/";t.cookie=a+";max-age=3",t.cookie.includes(r)&&(t.cookie=a+";max-age=0",ig=n)}return ig}(e);if(!i){var s,r=(s=e.match(iv))?s[0]:"";r!==i&&tl.info("Warning: cookie subdomain discovery mismatch",r,i),i=r}return i?"; domain=."+i:""}return""}(o.location.hostname,s);if(i){var u=new Date;u.setTime(u.getTime()+864e5*i),n="; expires="+u.toUTCString()}r&&(a="; secure");var c=e+"="+encodeURIComponent(JSON.stringify(t))+n+"; SameSite=Lax; path=/"+l+a;return c.length>3686.4&&tl.warn("cookieStore warning: large cookie, len="+c.length),o.cookie=c,c}catch(e){return}},Jt(e,t){if(null!=o&&o.cookie)try{i_.Xt(e,"",-1,t)}catch(e){return}}},im=null,iy={Ut(){if(!D(im))return im;var e=!0;if(M(s))e=!1;else try{var t="__mplssupport__";iy.Xt(t,"xyz"),'"xyz"'!==iy.Gt(t)&&(e=!1),iy.Jt(t)}catch(t){e=!1}return e||tl.error("localStorage unsupported; falling back to cookie store"),im=e,e},Yt(e){tl.error("localStorage error: "+e)},Gt(e){try{return null==s?void 0:s.localStorage.getItem(e)}catch(e){iy.Yt(e)}return null},Wt(e){try{return JSON.parse(iy.Gt(e))||{}}catch(e){}return null},Xt(e,t){try{null==s||s.localStorage.setItem(e,JSON.stringify(t))}catch(e){iy.Yt(e)}},Jt(e){try{null==s||s.localStorage.removeItem(e)}catch(e){iy.Yt(e)}}},ib=[tp,"distinct_id",tP,tR,tz,tW,tN],iw={},ix={Ut:()=>!0,Yt(e){tl.error("memoryStorage error: "+e)},Gt:e=>iw[e]||null,Wt:e=>iw[e]||null,Xt(e,t){iw[e]=t},Jt(e){delete iw[e]}},iE=null,ik={Ut(){if(!D(iE))return iE;if(iE=!0,M(s))iE=!1;else try{var e="__support__";ik.Xt(e,"xyz"),'"xyz"'!==ik.Gt(e)&&(iE=!1),ik.Jt(e)}catch(e){iE=!1}return iE},Yt(e){tl.error("sessionStorage error: ",e)},Gt(e){try{return null==s?void 0:s.sessionStorage.getItem(e)}catch(e){ik.Yt(e)}return null},Wt(e){try{return JSON.parse(ik.Gt(e))||null}catch(e){}return null},Xt(e,t){try{null==s||s.sessionStorage.setItem(e,JSON.stringify(t))}catch(e){ik.Yt(e)}},Jt(e){try{null==s||s.sessionStorage.removeItem(e)}catch(e){ik.Yt(e)}}};class iS{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===tJ||0===this.consent||-1===this.consent&&(this.Rt.opt_out_capturing_by_default||this.Rt.cookieless_mode===tY)}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}optInOut(e){this.ti.Xt(this.ei,+!!e,this.Rt.cookie_expiration,this.Rt.cross_subdomain_cookie,this.Rt.secure_cookie)}reset(){this.ti.Jt(this.ei,this.Rt.cross_subdomain_cookie)}get ei(){var{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:i}=this._instance.config;
1return i||(t?t+e:"__ph_opt_in_out_"+e)}get Qt(){var e=this.ti.Gt(this.ei);return B(e)?1:k(X,e)?0:-1}get ti(){var e=this.Rt.opt_out_capturing_persistence_type,t="localStorage"===e?iy:i_;if(!this.ii||this.ii!==t){this.ii=t;var i="localStorage"===e?i_:iy;i.Gt(this.ei)&&(this.ii.Gt(this.ei)||this.optInOut(B(i.Gt(this.ei))),i.Jt(this.ei,this.Rt.cross_subdomain_cookie))}return this.ii}Kt(){return!!this.Rt.respect_dnt&&[null==n?void 0:n.doNotTrack,null==n?void 0:n.msDoNotTrack,p.doNotTrack].some(e=>B(e))}}var iP=tu("[Dead Clicks]"),iR=()=>!0,iF=e=>{var t,i=!(null==(t=e.instance.persistence)||!t.get_property(tx)),s=e.instance.config.capture_dead_clicks;return H(s)?s:!!C(s)||i};class iI{get lazyLoadedDeadClicksAutocapture(){return this.ri}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({[tx]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.ni(()=>{this.si()}):this.stop()}ni(e){var t,i;null!=(t=p.__PosthogExtensions__)&&t.initDeadClicksAutocapture&&e(),null==(i=p.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",t=>{t?iP.error("failed to load script",t):e()})}si(){var e;if(o){if(!this.ri&&null!=(e=p.__PosthogExtensions__)&&e.initDeadClicksAutocapture){var t=C(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.ri=p.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.ri.start(o),iP.info("starting...")}}else iP.error("`document` not found. Cannot start.")}stop(){this.ri&&(this.ri.stop(),this.ri=void 0,iP.info("stopping..."))}}var i$=tu("[SegmentIntegration]"),iT="posthog-js";function iC(e,t){var{organization:i,projectId:s,prefix:r,severityAllowList:n=["error"],sendExceptionsToPostHog:o=!0}=void 0===t?{}:t;return t=>{if("*"!==n&&!n.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var a=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());t.tags["PostHog Person URL"]=a,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var l,u,c,h,d,p,g=(null==(l=t.exception)?void 0:l.values)||[],v=g.map(e=>m({},e,{stacktrace:e.stacktrace?m({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map(e=>m({},e,{platform:"web:javascript"}))}):void 0})),_={$exception_message:(null==(u=g[0])?void 0:u.value)||t.message,$exception_type:null==(c=g[0])?void 0:c.type,$exception_level:t.level,$exception_list:v,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(h=g[0])?void 0:h.value)||t.message,$sentry_exception_type:null==(d=g[0])?void 0:d.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}}class iO{constructor(e,t,i,s,r,n){this.name=iT,this.setupOnce=function(o){o(iC(e,{organization:t,projectId:i,prefix:s,severityAllowList:r,sendExceptionsToPostHog:null==n||n}))}}}class iM{constructor(e){this.oi=(e,t,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength)&&(tl.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:i}),this.ai=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.li()}li(){var e;this.ui=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(this.oi)}destroy(){var e;null==(e=this.ui)||e.call(this),this.ui=void 0}doPageView(e,t){var i,r=this.hi(e,t);return this.ai={pathname:null!=(i=null==s?void 0:s.location.pathname)?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),r}doPageLeave(e){var t;return this.hi(e,null==(t=this.ai)?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null==(e=this.ai)?void 0:e.pageViewId}}hi(e,t){var i=this.ai;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(!(M(n)||M(o)||M(a)||M(l)||M(u)||M(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?Y(o/n,0,1,tl):1,d=n>1?Y(a/n,0,1,tl):1,p=l>1?Y(u/l,0,1,tl):1,g=l>1?Y(c/l,0,1,tl):1;s=t7(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:g})}}return i.pathname&&(s.$prev_pageview_pathname=i.pathname),i.timestamp&&(s.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),s}}var iA=e=>{var t=null==o?void 0:o.createElement("a");return M(t)?null:(t.href=e,t)},iL=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(!$(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(e){tl.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},iD=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("=");$(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},iN=function(e,t){var i=e.match(RegExp(t+"=([^&]*)"));return i?i[1]:null},ij="https?://(.*)",iq=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],iH=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...iq],iU="<masked>",iW=["li_fat_id"];function iz(e,t,i){if(!o)return{};var s,r=t?[...iq,...i||[]]:[],n=iV(iD(o.URL,r,iU),e);return t7((s={},t4(iW,function(e){var t=i_.Gt(e);s[e]=t||null}),s),n)}function iV(e,t){var i=iH.concat(t||[]),s={};return t4(i,function(t){var i=iL(e,t);s[t]=i||null}),s}function iG(e){var t=e?0===e.search(ij+"google.([^/?]*)")?"google":0===e.search(ij+"bing.com")?"bing":0===e.search(ij+"yahoo.com")?"yahoo":0===e.search(ij+"duckduckgo.com")?"duckduckgo":null:null,i={};if(!D(t)){i.$search_engine=t;var s=o?iL(o.referrer,"yahoo"!=t?"q":"p"):"";s.length&&(i.ph_keyword=s)}return i}function iB(){return navigator.language||navigator.userLanguage}var iX="$direct";function iY(){return(null==o?void 0:o.referrer)||iX}function iJ(e,t){var i=e?[...iq,...t||[]]:[],s=null==a?void 0:a.href.substring(0,1e3);return{r:iY().substring(0,1e3),u:s?iD(s,i,iU):void 0}}function iK(e){var t,{r:i,u:s}=e,r={$referrer:i,$referring_domain:null==i?void 0:i==iX?iX:null==(t=iA(i))?void 0:t.host};
1if(s){r.$current_url=s;var n=iA(s);r.$host=null==n?void 0:n.host,r.$pathname=null==n?void 0:n.pathname,t7(r,iV(s))}return i&&t7(r,iG(i)),r}function iZ(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}var iQ=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class i0{constructor(e,t){this.Rt=e,this.props={},this.ci=!1,this.di=(e=>{var t="";return e.token&&(t=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),e.persistence_name?"ph_"+e.persistence_name:"ph_"+t+"_posthog"})(e),this.ti=this.vi(e),this.load(),e.debug&&tl.info("Persistence loaded",e.persistence,m({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this.fi}vi(e){-1===iQ.indexOf(e.persistence.toLowerCase())&&(tl.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t,i,r=(void 0===(t=e.cookie_persisted_properties||[])&&(t=[]),i=[...ib,...t],m({},iy,{Wt(e){try{var t={};try{t=i_.Wt(e)||{}}catch(e){}var i=t7(t,JSON.parse(iy.Gt(e)||"{}"));return iy.Xt(e,i),i}catch(e){}return null},Xt(e,t,s,r,n,o){try{iy.Xt(e,t,void 0,void 0,o);var a={};i.forEach(e=>{t[e]&&(a[e]=t[e])}),Object.keys(a).length&&i_.Xt(e,a,s,r,n,o)}catch(e){iy.Yt(e)}},Jt(e,t){try{null==s||s.localStorage.removeItem(e),i_.Jt(e,t)}catch(e){iy.Yt(e)}}})),n=e.persistence.toLowerCase();return"localstorage"===n&&iy.Ut()?iy:"localstorage+cookie"===n&&r.Ut()?r:"sessionstorage"===n&&ik.Ut()?ik:"memory"===n?ix:"cookie"===n?i_:r.Ut()?r:i_}pi(e){var t=null!=e?e:this.Rt.feature_flag_cache_ttl_ms;if(!t||0>=t)return!1;var i=this.props[tD];return!i||"number"!=typeof i||Date.now()-i>t}properties(){var e={};return t4(this.props,(t,i)=>{if(i===tF&&C(t)){if(!this.pi())for(var s=Object.keys(t),r=0;s.length>r;r++)e["$feature/"+s[r]]=t[s[r]]}else -1===tB.indexOf(i)&&(e[i]=t)}),e}load(){if(!this.fi){var e=this.ti.Wt(this.di);e&&(this.props=t7({},e))}}save(){this.fi||this.ti.Xt(this.di,this.props,this.gi,this.mi,this.yi,this.Rt.debug)}remove(){this.ti.Jt(this.di,!1),this.ti.Jt(this.di,!0)}clear(){this.remove(),this.props={}}register_once(e,t,i){if(C(e)){M(t)&&(t="None"),this.gi=M(i)?this.bi:i;var s=!1;if(t4(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(C(e)){this.gi=M(t)?this.bi:t;var i=!1;if(t4(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.ci){var e=iz(this.Rt.custom_campaign_params,this.Rt.mask_personal_data_properties,this.Rt.custom_personal_data_properties);O(ii(e))||this.register(e),this.ci=!0}}update_search_keyword(){var e;this.register((e=null==o?void 0:o.referrer)?iG(e):{})}update_referrer_info(){var e;this.register_once({$referrer:iY(),$referring_domain:null!=o&&o.referrer&&(null==(e=iA(o.referrer))?void 0:e.host)||iX},void 0)}set_initial_person_info(){this.props[tH]||this.props[tU]||this.register_once({[tW]:iJ(this.Rt.mask_personal_data_properties,this.Rt.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};t4([tU,tH],t=>{var i=this.props[t];i&&t4(i,function(t,i){e["$initial_"+P(i)]=t})});var t,i,s=this.props[tW];return s&&t7(e,(t=iK(s),i={},t4(t,function(e,t){i["$initial_"+P(t)]=e}),i)),e}safe_merge(e){return t4(this.props,function(t,i){i in e||(e[i]=t)}),e}update_config(e,t,i){if(this.bi=this.gi=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.vi(e),r=this.props;this.clear(),this.ti=s,this.props=r,this.save()}}set_disabled(e){this.fi=e,this.fi?this.remove():this.save()}set_cross_subdomain(e){e!==this.mi&&(this.mi=e,this.remove(),this.save())}set_secure(e){e!==this.yi&&(this.yi=e,this.remove(),this.save())}set_event_timer(e,t){var i=this.props[tv]||{};i[e]=t,this.props[tv]=i,this.save()}remove_event_timer(e){var t=(this.props[tv]||{})[e];return M(t)||(delete this.props[tv][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}}var i1={Activation:"events",Cancellation:"cancelEvents"},i2={Popover:"popover",API:"api",Widget:"widget"},i3={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},i5={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},i6={Popover:"popover",Inline:"inline"},i8={SHOWN:"product tour shown"},i4={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},i7=tu("[RateLimiter]");class i9{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{var t=e.text;
vendor: 6,939 bytes, line 1
1if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach(e=>{i7.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4})}catch(e){return void i7.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){void 0===e&&(e=!1);var t,i,s,{captureEventsBurstLimit:r,captureEventsPerSecond:n}=this,o=(new Date).getTime(),a=null!=(t=null==(i=this.instance.persistence)?void 0:i.get_property(tq))?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(tq,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}var se=tu("[RemoteConfig]");class st{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=p._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}wi(e){var t,i;null!=(t=p.__PosthogExtensions__)&&t.loadExternalDependency?null==(i=p.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",()=>e(this.remoteConfig)):e()}Ii(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 se.info("Using preloaded remote config",this.remoteConfig),this.Ci(this.remoteConfig),void this.Si();if(this._instance.ki())return void se.warn("Remote config is disabled. Falling back to local config.");this.wi(e=>{if(!e)return se.info("No config found after loading remote JS config. Falling back to JSON."),void this.Ii(e=>{this.Ci(e),this.Si()});this.Ci(e),this.Si()})}catch(e){se.error("Error loading remote config",e)}}stop(){this.xi&&(clearInterval(this.xi),this.xi=void 0)}refresh(){this._instance.ki()||"hidden"===(null==o?void 0:o.visibilityState)||this._instance.reloadFeatureFlags()}Si(){var e;if(!this.xi){var t=null!=(e=this._instance.config.remote_config_refresh_interval_ms)?e:3e5;0!==t&&(this.xi=setInterval(()=>{this.refresh()},t))}}Ci(e){var t;e||se.error("Failed to fetch remote config from PostHog."),this._instance.Ci(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())}}var si={GZipJS:"gzip-js",Base64:"base64"},ss=Uint8Array,sr=Uint16Array,sn=Uint32Array,so=new ss([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]),sa=new ss([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]),sl=new ss([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),su=function(e,t){for(var i=new sr(31),s=0;31>s;++s)i[s]=t+=1<<e[s-1];var r=new sn(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]},sc=su(so,2),sh=sc[1];sc[0][28]=258,sh[258]=28;for(var sd=su(sa,0)[1],sp=new sr(32768),sg=0;32768>sg;++sg){var sv=(43690&sg)>>>1|(21845&sg)<<1;sp[sg]=((65280&(sv=(61680&(sv=(52428&sv)>>>2|(13107&sv)<<2))>>>4|(3855&sv)<<4))>>>8|(255&sv)<<8)>>>1}var s_=function(e,t,i){for(var s=e.length,r=0,n=new sr(t);s>r;++r)++n[e[r]-1];var o,a=new sr(t);for(r=0;t>r;++r)a[r]=a[r-1]+n[r-1]<<1;if(i){o=new sr(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[sp[h]>>>l]=u}else for(o=new sr(s),r=0;s>r;++r)o[r]=sp[a[e[r]-1]++]>>>15-e[r];return o},sf=new ss(288);for(sg=0;144>sg;++sg)sf[sg]=8;for(sg=144;256>sg;++sg)sf[sg]=9;for(sg=256;280>sg;++sg)sf[sg]=7;for(sg=280;288>sg;++sg)sf[sg]=8;var sm=new ss(32);for(sg=0;32>sg;++sg)sm[sg]=5;var sy=s_(sf,9,0),sb=s_(sm,5,0),sw=function(e){return(e/8|0)+(7&e&&1)},sx=function(e,t,i){(null==i||i>e.length)&&(i=e.length);var s=new(e instanceof sr?sr:e instanceof sn?sn:ss)(i-t);return s.set(e.subarray(t,i)),s},sE=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8},sk=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8,e[s+2]|=i>>>16},sS=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 ss(0),0];if(1==r){var o=new ss(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 sr(d+1),g=sP(i[c-1],p,0);if(g>t){s=0;var v=0,_=g-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;v+=f-(1<<g-p[m]),p[m]=t}for(v>>>=_;v>0;){var y=n[s].s;t>p[y]?v-=1<<t-p[y]++-1:++s}for(;s>=0&&v;--s){var b=n[s].s;p[b]==t&&(--p[b],++v)}g=t}return[new ss(p),g]},sP=function(e,t,i){return -1==e.s?Math.max(sP(e.l,t,i+1),sP(e.r,t,i+1)):t[e.s]=i},sR=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new sr(++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]},sF=function(e,t){for(var i=0,s=0;t.length>s;++s)i+=e[s]*t[s];return i},sI=function(e,t,i){var s=i.length,r=sw(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)},s$=function(e,t,i,s,r,n,o,a,l,u,c){sE(t,c++,i),++r[256];for(var h=sS(r,15),d=h[0],p=h[1],g=sS(n,15),v=g[0],_=g[1],f=sR(d),m=f[0],y=f[1],b=sR(v),w=b[0],x=b[1],E=new sr(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=sS(E,7),P=S[0],R=S[1],F=19;F>4&&!P[sl[F-1]];--F);var I,$,T,C,O=u+5<<3,M=sF(r,sf)+sF(n,sm)+o,A=sF(r,d)+sF(n,v)+o+14+3*F+sF(E,P)+(2*E[16]+3*E[17]+7*E[18]);if(M>=O&&A>=O)return sI(t,c,e.subarray(l,l+u));if(sE(t,c,1+(M>A)),c+=2,M>A){I=s_(d,p,0),$=d,T=s_(v,_,0),C=v;var L=s_(P,R,0);for(sE(t,c,y-257),sE(t,c+5,x-1),sE(t,c+10,F-4),c+=14,k=0;F>k;++k)sE(t,c+3*k,P[sl[k]]);c+=3*F;for(var D=[m,w],N=0;2>N;++N){var j=D[N];for(k=0;j.length>k;++k)sE(t,c,L[q=31&j[k]]),c+=P[q],q>
115&&(sE(t,c,j[k]>>>5&127),c+=j[k]>>>12)}}else I=sy,$=sf,T=sb,C=sm;for(k=0;a>k;++k)if(s[k]>255){sk(t,c,I[257+(q=s[k]>>>18&31)]),c+=$[q+257],q>7&&(sE(t,c,s[k]>>>23&31),c+=so[q]);var q,H=31&s[k];sk(t,c,T[H]),c+=C[H],H>3&&(sk(t,c,s[k]>>>5&8191),c+=sa[H])}else sk(t,c,I[s[k]]),c+=$[s[k]];return sk(t,c,I[256]),c+$[256]},sT=new sn([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),sC=function(){for(var e=new sn(256),t=0;256>t;++t){for(var i=t,s=9;--s;)i=(1&i&&0xedb88320)^i>>>1;e[t]=i}return e}(),sO=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8},sM=!!u||!!l,sA="text/plain",sL=!1,sD=function(e,t,i){void 0===i&&(i=!0);var s,r,n,o,a,[l,u]=e.split("?"),c=m({},t),h=null!=(a=null==u?void 0:u.split("&").map(e=>{var t,[s,r]=e.split("="),n=i&&null!=(t=c[s])?t:r;return delete c[s],s+"="+n}))?a:[],d=(void 0===s&&(s="&"),o=[],t4(c,function(e,t){M(e)||M(t)||"undefined"===t||(r=encodeURIComponent(e instanceof File?e.name:e.toString()),n=encodeURIComponent(t),o[o.length]=n+"="+r)}),o.join(s));return d&&h.push(d),l+"?"+h.join("&")},sN=(e,t)=>JSON.stringify(e,(e,t)=>"bigint"==typeof t?t.toString():t,t),sj=e=>{if(e.zt)return e.zt;var{data:t,compression:i}=e;if(t){if(i===si.GZipJS){var s=function(e,t){void 0===t&&(t={});var i=(r=0xffffffff,{p(e){for(var t=r,i=0;e.length>i;++i)t=sC[255&t^e[i]]^t>>>8;r=t},d:()=>0xffffffff^r}),s=e.length;i.p(e);var r,n,o,a,l=(a=10+((n=t).filename&&n.filename.length+1||0),function(e,t,i,s,r,n){var o=e.length,a=new ss(s+o+5*(1+Math.floor(o/7e3))+8),l=a.subarray(s,a.length-8),u=0;if(!t||8>o)for(var c=0;o>=c;c+=65535){var h=c+65535;o>h?u=sI(l,u,e.subarray(c,h)):(l[c]=!0,u=sI(l,u,e.subarray(c,o)))}else{for(var d=sT[t-1],p=d>>>13,g=8191&d,v=(1<<i)-1,_=new sr(32768),f=new sr(v+1),m=Math.ceil(i/3),y=2*m,b=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<y)&v},w=new sn(25e3),x=new sr(288),E=new sr(32),k=0,S=0,P=(c=0,0),R=0,F=0;o>c;++c){var I=b(c),$=32767&c,T=f[I];if(_[$]=T,f[I]=$,c>=R){var C=o-c;if((k>7e3||P>24576)&&C>423){u=s$(e,l,0,w,x,E,S,P,F,c-F,u),P=k=S=0,F=c;for(var O=0;286>O;++O)x[O]=0;for(O=0;30>O;++O)E[O]=0}var M=2,A=0,L=g,D=$-T&32767;if(C>2&&I==b(c-D))for(var N=Math.min(p,C)-1,j=Math.min(32767,c),q=Math.min(258,C);j>=D&&--L&&$!=T;){if(e[c+M]==e[c+M-D]){for(var H=0;q>H&&e[c+H]==e[c+H-D];++H);if(H>M){if(M=H,A=D,H>N)break;var U=Math.min(D,H-2),W=0;for(O=0;U>O;++O){var z=c-D+O+32768&32767,V=z-_[z]+32768&32767;V>W&&(W=V,T=z)}}}D+=($=T)-(T=_[$])+32768&32767}if(A){w[P++]=0x10000000|sh[M]<<18|sd[A];var G=31&sh[M],B=31&sd[A];S+=so[G]+sa[B],++x[257+G],++E[B],R=c+M,++k}else w[P++]=e[c],++x[e[c]]}}u=s$(e,l,!0,w,x,E,S,P,F,c-F,u)}return sx(a,0,s+sw(u)+r)}(e,null==(o=t).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+o.mem,a,8)),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:2*(9==t.level),e[9]=3,0!=t.mtime&&sO(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),sO(l,u-8,i.d()),sO(l,u-4,s),l}(function(e,t){var i=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var s=new ss(e.length+(e.length>>>1)),r=0,n=function(e){s[r++]=e},o=0;i>o;++o){if(r+5>s.length){var a=new ss(r+8+(i-o<<1));a.set(s),s=a}var l=e.charCodeAt(o);128>l?n(l):(2048>l?n(192|l>>>6):(l>55295&&57344>l?(n(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++o))>>>18),n(128|l>>>12&63)):n(224|l>>>12),n(128|l>>>6&63)),n(128|63&l))}return sx(s,0,r)}(sN(t)),{mtime:0});return{contentType:sA,body:s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength),estimatedSize:s.byteLength}}if(i===si.Base64){var r=(e=>"data="+encodeURIComponent("string"==typeof e?e:sN(e)))(function(e){return e?btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16)))):e}(sN(t)));return{contentType:"application/x-www-form-urlencoded",body:r,estimatedSize:new Blob([r]).size}}var n=sN(t);return{contentType:"application/json",body:n,estimatedSize:new Blob([n]).size}}},sq=function(){var e=f(function*(e){var t=sN(e.data),i=yield function(e,t,i){return b.apply(this,arguments)}(t,v.DEBUG,{rethrow:!0});if(!i)return e;var s=yield i.arrayBuffer();return m({}
1,e,{zt:{contentType:sA,body:s,estimatedSize:s.byteLength}})});return function(t){return e.apply(this,arguments)}}(),sH=(e,t)=>sD(e,{_:(new Date).getTime().toString(),ver:v.JS_SDK_VERSION,compression:t}),sU=[];l&&sU.push({transport:"fetch",method(e){var t,i,{contentType:s,body:r,estimatedSize:n}=null!=(t=sj(e))?t:{},o=new Headers;t4(e.headers,function(e,t){o.append(t,e)}),s&&o.append("Content-Type",s);var a=e.url,u=null;if(c){var h=new c;u={signal:h.signal,timeout:setTimeout(()=>h.abort(),e.timeout)}}l(a,m({method:(null==e?void 0:e.method)||"GET",headers:o,keepalive:"POST"===e.method&&52428.8>(n||0),body:r,signal:null==(i=u)?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){tl.error(e)}null==e.callback||e.callback(s)})).catch(t=>{tl.error(t),null==e.callback||e.callback({statusCode:0,error:t})}).finally(()=>u?clearTimeout(u.timeout):null)}}),u&&sU.push({transport:"XHR",method(e){var t,i=new u;i.open(e.method||"GET",e.url,!0);var{contentType:s,body:r}=null!=(t=sj(e))?t:{};t4(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!=n&&n.sendBeacon&&sU.push({transport:"sendBeacon",method(e){var t=sD(e.url,{beacon:"1"});try{var i,{contentType:s,body:r}=null!=(i=sj(e))?i:{};if(!r)return;var o=r instanceof Blob?r:new Blob([r],{type:s});n.sendBeacon(t,o)}catch(e){}}});class sW{constructor(e,t){this.Ti=!0,this.Ai=[],this.Ei=Y((null==t?void 0:t.flush_interval_ms)||3e3,250,5e3,tl.createLogger("flush interval"),3e3),this.Ri=e}enqueue(e){this.Ai.push(e),this.Ni||this.Mi()}unload(){this.Fi();var e=Object.values(this.Ai.length>0?this.Oi():{});[...e.filter(e=>0===e.url.indexOf("/e")),...e.filter(e=>0!==e.url.indexOf("/e"))].map(e=>{this.Ri(m({},e,{transport:"sendBeacon"}))})}enable(){this.Ti=!1,this.Mi()}Mi(){var e=this;this.Ti||(this.Ni=setTimeout(()=>{if(this.Fi(),this.Ai.length>0){var t=this.Oi();for(var i in t)!function(){var s=t[i],r=(new Date).getTime();s.data&&$(s.data)&&t4(s.data,e=>{e.offset=Math.abs(e.timestamp-r),delete e.timestamp}),e.Ri(s)}()}},this.Ei))}Fi(){clearTimeout(this.Ni),this.Ni=void 0}Oi(){var e={};return t4(this.Ai,t=>{var i,s=(t?t.batchKey:null)||t.url;M(e[s])&&(e[s]=m({},t,{data:[]})),null==(i=e[s].data)||i.push(t.data)}),this.Ai=[],e}}var sz=["retriesPerformedSoFar"];class sV{constructor(e){this.Pi=!1,this.Li=3e3,this.Ai=[],this._instance=e,this.Ai=[],this.Di=!0,!M(s)&&"onLine"in s.navigator&&(this.Di=s.navigator.onLine,this.Bi=()=>{this.Di=!0,this.ji()},this.qi=()=>{this.Di=!1},ir(s,"online",this.Bi),ir(s,"offline",this.qi))}get length(){return this.Ai.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,i=y(e,sz);q(t)&&(i.url=sD(i.url,{retry_count:t})),this._instance._send_request(m({},i,{callback:e=>{200===e.statusCode||e.statusCode>=400&&500>e.statusCode||(null!=t?t:0)>=10?null==i.callback||i.callback(e):this.Zi(m({retriesPerformedSoFar:t},i))}}))}Zi(e){var t,i,s=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=s+1;var r=Math.ceil((i=Math.min(18e5,t=3e3*Math.pow(2,s)))+(Math.random()-.5)*(i-t/2)),n=Date.now()+r;this.Ai.push({retryAt:n,requestOptions:e});var o="Enqueued failed request for retry in "+r;navigator.onLine||(o+=" (Browser is offline)"),tl.warn(o),this.Pi||(this.Pi=!0,this.$i())}$i(){if(this.Vi&&clearTimeout(this.Vi),0===this.Ai.length)return this.Pi=!1,void(this.Vi=void 0);this.Vi=setTimeout(()=>{this.Di&&this.Ai.length>0&&this.ji(),this.$i()},this.Li)}ji(){var e=Date.now(),t=[],i=this.Ai.filter(i=>e>i.retryAt||(t.push(i),!1));if(this.Ai=t,i.length>0)for(var{requestOptions:s}of i)this.retriableRequest(s)}unload(){for(var{requestOptions:e}of(this.Vi&&(clearTimeout(this.Vi),this.Vi=void 0),this.Pi=!1,M(s)||(this.Bi&&(s.removeEventListener("online",this.Bi),this.Bi=void 0),this.qi&&(s.removeEventListener("offline",this.qi),this.qi=void 0)),this.Ai))try{this._instance._send_request(m({},e,{transport:"sendBeacon"}))}catch(e){tl.error(e)}this.Ai=[]}}class sG{constructor(e){this.Hi=()=>{this.zi||(this.zi={});var e,t,i,s,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.zi.lastScrollY=Math.ceil(n),this.zi.maxScrollY=Math.max(n,null!=(e=this.zi.maxScrollY)?e:0),this.zi.maxScrollHeight=Math.max(o,null!=(t=this.zi.maxScrollHeight)?t:0),this.zi.lastContentY=a,this.zi.maxContentY=Math.max(a,null!=(i=this.zi.maxContentY)?i:0),this.zi.maxContentHeight=Math.max(l,null!=(s=this.zi.maxContentHeight)?s:0)},this._instance=e}get Ui(){return this._instance.config.scroll_root_selector}getContext(){return this.zi}resetContext(){var e=this.zi;return setTimeout(this.Hi,0),e}startMeasuringScrollPosition(){ir(s,"scroll",this.Hi,{capture:!0}),ir(s,"scrollend",this.Hi,{capture:!0}),ir(s,"resize",this.Hi)}scrollElement(){if(!this.Ui)return null==s?void 0:s.document.documentElement;for(var e of $(this.Ui)?this.Ui:[this.Ui]){var t=null==s?void 0:s.document.querySelector(e);
1if(t)return t}}scrollY(){if(this.Ui){var e=this.scrollElement();return e&&e.scrollTop||0}return s&&(s.scrollY||s.pageYOffset||s.document.documentElement.scrollTop)||0}scrollX(){if(this.Ui){var e=this.scrollElement();return e&&e.scrollLeft||0}return s&&(s.scrollX||s.pageXOffset||s.document.documentElement.scrollLeft)||0}}var sB=e=>iJ(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties);class sX{constructor(e,t,i,s){this.Yi=e=>{var t=this.Gi();if(!t||t.sessionId!==e){var i={sessionId:e,props:this.Wi(this._instance)};this.Xi.register({[tj]:i})}},this._instance=e,this.Ji=t,this.Xi=i,this.Wi=s||sB,this.Ji.onSessionId(this.Yi)}Gi(){return this.Xi.props[tj]}getSetOnceProps(){var e,t=null==(e=this.Gi())?void 0:e.props;return t?"r"in t?iK(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 t4(ii(this.getSetOnceProps()),(t,i)=>{"$current_url"===i&&(i="url"),e["$session_entry_"+P(i)]=t}),e}}class sY{constructor(){this.Ki={}}on(e,t){return this.Ki[e]||(this.Ki[e]=[]),this.Ki[e].push(t),()=>{this.Ki[e]=this.Ki[e].filter(e=>e!==t)}}emit(e,t){for(var i of this.Ki[e]||[])i(t);for(var s of this.Ki["*"]||[])s(e,t)}}var sJ=tu("[SessionId]");class sK{on(e,t){return this.Qi.on(e,t)}constructor(e,t,i){if(this.tr=[],this.er=void 0,this.Qi=new sY,this.ir=(e,t)=>!(!q(e)||!q(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===tJ)throw Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Rt=e.config,this.Xi=e.persistence,this.rr=void 0,this.nr=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.sr=t||id,this.ar=i||id;var s,r=this.Rt.persistence_name||this.Rt.token;if(this._sessionTimeoutMs=1e3*Y(this.Rt.session_idle_timeout_seconds||1800,60,36e3,sJ.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.lr(),this.ur="ph_"+r+"_window_id",this.hr="ph_"+r+"_primary_window_exists",this.cr()){var n=ik.Wt(this.ur),o=ik.Wt(this.hr);n&&!o?this.rr=n:ik.Jt(this.ur),ik.Xt(this.hr,!0)}if(null!=(s=this.Rt.bootstrap)&&s.sessionID)try{var a=(e=>{var t=this.Rt.bootstrap.sessionID.replace(/-/g,"");if(32!==t.length)throw Error("Not a valid UUID");if("7"!==t[12])throw Error("Not a UUIDv7");return parseInt(t.substring(0,12),16)})();this.dr(this.Rt.bootstrap.sessionID,(new Date).getTime(),a)}catch(e){sJ.error("Invalid sessionID in bootstrap",e)}this.vr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return M(this.tr)&&(this.tr=[]),this.tr.push(e),this.nr&&e(this.nr,this.rr),()=>{this.tr=this.tr.filter(t=>t!==e)}}cr(){return"memory"!==this.Rt.persistence&&!this.Xi.fi&&ik.Ut()}pr(e){e!==this.rr&&(this.rr=e,this.cr()&&ik.Xt(this.ur,e))}gr(){return this.rr?this.rr:this.cr()?ik.Wt(this.ur):null}dr(e,t,i){e===this.nr&&t===this._sessionActivityTimestamp&&i===this._sessionStartTimestamp||(this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this.nr=e,this.Xi.register({[tP]:[t,e,i]}))}mr(){var e=this.Xi.props[tP];return $(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.dr(null,null,null)}destroy(){clearTimeout(this.yr),this.yr=void 0,this.er&&s&&(s.removeEventListener(t1,this.er,{capture:!1}),this.er=void 0),this.tr=[]}vr(){this.er=()=>{this.cr()&&ik.Jt(this.hr)},ir(s,t1,this.er,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=null),this.Rt.cookieless_mode===tJ)throw Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=t||(new Date).getTime(),[s,r,n]=this.mr(),o=this.gr(),a=q(n)&&Math.abs(i-n)>864e5,l=!1,u=!r,c=!u&&!e&&this.ir(i,s);u||c||a?(r=this.sr(),o=this.ar(),sJ.info("new session ID generated",{sessionId:r,windowId:o,changeReason:{noSessionId:u,activityTimeout:c,sessionPastMaximumLength:a}}),n=i,l=!0):o||(o=this.ar(),l=!0);var h=q(s)&&e&&!a?s:i,d=q(n)?n:(new Date).getTime();return this.pr(o),this.dr(r,h,d),e||this.lr(),l&&this.tr.forEach(e
1=>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}}lr(){clearTimeout(this.yr),this.yr=setTimeout(()=>{var[e]=this.mr();if(this.ir((new Date).getTime(),e)){var t=this.nr;this.resetSessionId(),this.Qi.emit("forcedIdleReset",{idleSessionId:t})}},1.1*this.sessionTimeoutMs)}}var sZ=function(e,t){if(!e)return!1;var i=e.userAgent;if(i&&E(i,t))return!0;try{var s=null==e?void 0:e.userAgentData;if(null!=s&&s.brands&&s.brands.some(e=>E(null==e?void 0:e.brand,t)))return!0}catch(e){}return!!e.webdriver},sQ=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 s0(e,t,i){return sN({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}var s1={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=>sQ(t,e))),not_regex:(e,t)=>t.every(t=>e.every(e=>!sQ(t,e))),icontains:(e,t)=>t.map(s2).some(t=>e.map(s2).some(e=>t.includes(e))),not_icontains:(e,t)=>t.map(s2).every(t=>e.map(s2).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))})},s2=e=>e.toLowerCase();function s3(e,t){return!e||Object.entries(e).every(e=>{var[i,s]=e,r=null==t?void 0:t[i];if(M(r)||D(r))return!1;var n=[String(r)],o=s1[s.operator];return!!o&&o(s.values,n)})}var s5="custom",s6="i.posthog.com";class s8{constructor(e){this.br={},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("."+s6,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this.br[this.apiHost]||(this.br[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":s5),this.br[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===s5)return this.apiHost+t;var i=s6+t;switch(e){case"assets":return"https://"+this.region+"-assets."+i;case"api":return"https://"+this.region+"."+i}}}var s4=tu("[Surveys]"),s7="seenSurvey_",s9=e=>((e,t)=>{var i=""+s7+t.id;return t.current_iteration&&t.current_iteration>0&&(i=""+s7+t.id+"_"+t.current_iteration),i})(0,e),re=[i2.Popover,i2.Widget,i2.API],rt={ignoreConditions:!1,ignoreDelay:!1,displayType:i6.Popover},ri=tu("[PostHog ExternalIntegrations]"),rs={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class rr{constructor(e){this._instance=e}ni(e,t){var i;null==(i=p.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,e=>{if(e)return ri.error("failed to load script",e);t()})}startIfEnabledOrStop(){var e,t=this,i=function(e){var i,s,n;!r||null!=(i=p.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[e]||t.ni(rs[e],()=>{var i;null==(i=p.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[e])||i.start(t._instance)}),!r&&null!=(s=p.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[e]&&(null==(n=p.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[e])||n.stop())};for(var[s,r]of Object.entries(null!=(e=this._instance.config.integrations)?e:{}))i(s)}}var rn,ro={},ra=0,rl=()=>{},ru='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',rc="Surveys module not available",rh="sanitize_properties is deprecated. Use before_send instead",rd="Invalid value for property_denylist config: ",rp=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/,rg="posthog",rv=!sM&&-1===(null==d?void 0:d.indexOf("MSIE"))&&-1===(null==d?void 0:d.indexOf("Mozilla")),r_=e=>{var t;return m({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:function(e){var t=null==e?void 0:e.hostname;if(!A(t))return!1;var i=t.split(".").slice(-2).join(".");for(var s of is)if(i===s)return!1;return!0}(null==o?void 0:o.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:rl,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:a&&A(null==a?void 0:a.search)&&-1!==a.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==s||null==(t=s.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){tl.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:tQ,before_send:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:rl,__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))},rf=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["store_google","save_campaign_params"],["verbose","debug"]],rm=e=>{var t={};for(var[i,s]of rf)M(e[i])||(t[s]=e[i]);var r=t7({},t,e);return $(e.property_blacklist)&&(M(e.property_denylist)?r.property_denylist=e.property_blacklist:$(e.property_denylist)?r.property_denylist=[...e.property_blacklist,...e.property_denylist]:tl.error(rd+e.property_denylist)),r};class ry{constructor(){this.__forceAllowLocalhost=!1}get wr(){return this.__forceAllowLocalhost}set wr(e){tl.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class rb{_r(e,t){if(e){var i=this.Ir.indexOf(e);-1!==i&&this.Ir.splice(i,1)}return this.Ir.push(t),null==t.initialize||t.initialize(),t}get decideEndpointWasHit(){var e,t;return null!=(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&e}get flagsEndpointWasHit(){var e,t;return null!=(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&e}constructor(){this.webPerformance=new ry,this.Cr=!1,this.version=v.LIB_VERSION,this.Sr=new sY,this.Ir=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=r_(),this.SentryIntegration=iO,this.sentryIntegration=e=>(function(e,t){var i=iC(e,t);return{name:iT,processEvent:e=>i(e)}})(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.kr=!1,this.Tr=null,this.Ar=null,this.Er=null,this.scrollManager=new sG(this),this.pageViewM
1anager=new iM(this),this.rateLimiter=new i9(this),this.requestRouter=new s8(this),this.consent=new iS(this),this.externalIntegrations=new rr(this);var e,t=null!=(e=rb.__defaultExtensionClasses)?e:{};this.featureFlags=t.featureFlags&&new t.featureFlags(this),this.toolbar=t.toolbar&&new t.toolbar(this),this.surveys=t.surveys&&new t.surveys(this),this.conversations=t.conversations&&new t.conversations(this),this.logs=t.logs&&new t.logs(this),this.experiments=t.experiments&&new t.experiments(this),this.exceptions=t.exceptions&&new t.exceptions(this),this.people={set:(e,t,i)=>{var s=A(e)?{[e]:t}:e;this.setPersonProperties(s),null==i||i({})},set_once:(e,t,i)=>{var s=A(e)?{[e]:t}:e;this.setPersonProperties(void 0,s),null==i||i({})}},this.on("eventCaptured",e=>tl.info('send "'+(null==e?void 0:e.event)+'"',e))}init(e,t,i){if(i&&i!==rg){var s,r=null!=(s=ro[i])?s:new rb;return r._init(e,t,i),ro[i]=r,ro[rg][i]=r,r}return this._init(e,t,i)}_init(e,t,i){if(void 0===t&&(t={}),M(e)||L(e))return tl.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.Rr(t.debug),this.Nr=t,this.Mr=[],t.person_profiles?this.Ar=t.person_profiles:t.process_person&&(this.Ar=t.process_person),this.set_config(t7({},r_(t.defaults),rm(t),{name:i,token:e})),this.config.on_xhr_error&&tl.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:si.GZipJS;var r,n,o,a,l=this.Fr();this.persistence=new i0(this.config,l),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new i0(m({},this.config,{persistence:"sessionStorage"}),l);var u=m({},this.persistence.props),c=m({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Or=new sW(e=>this.Pr(e),this.config.request_queue_config),this.Lr=new sV(this),this.__request_queue=[];var h=this.config.cookieless_mode===tJ||this.config.cookieless_mode===tY&&this.consent.isExplicitlyOptedOut();h||(this.sessionManager=new sK(this),this.sessionPropsManager=new sX(this,this.sessionManager,this.persistence));var d=null==(r=p._POSTHOG_REMOTE_CONFIG)||null==(r=r[this.config.token])?void 0:r.config,g=null==d||null==(n=d.sdkVersion)?void 0:n.resolved;if(g&&(rp.test(g)?this._resolvedSdkVersion=g:tl.warn("Ignoring invalid preloaded sdkVersion.resolved from remote config: "+g)),this.config.__preview_deferred_init_extensions?(tl.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.Dr(h)},0)):(tl.info("Initializing extensions synchronously"),this.Dr(h)),v.DEBUG=v.DEBUG||this.config.debug,v.DEBUG&&tl.info("Starting in debug mode",{this:this,config:t,thisC:m({},this.config),p:u,s:c}),!this.config.identity_distinct_id||null!=(o=t.bootstrap)&&o.distinctID||(t.bootstrap=m({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(a=t.bootstrap)?void 0:a.distinctID)){var _=t.bootstrap.distinctID,f=this.get_distinct_id(),y=this.persistence.get_property(tN);if(t.bootstrap.isIdentifiedID&&null!=f&&f!==_&&y===tK)this.identify(_);else if(t.bootstrap.isIdentifiedID&&null!=f&&f!==_&&y===tZ)tl.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 b=this.config.get_device_id(id()),w=t.bootstrap.isIdentifiedID?b:_;this.persistence.set_property(tN,t.bootstrap.isIdentifiedID?tZ:tK),this.register({distinct_id:_,$device_id:w})}}if(h)this.register_once({distinct_id:tG,$device_id:null},"");else if(!this.get_distinct_id()){var x=this.config.get_device_id(id());this.register_once({distinct_id:x,$device_id:x},""),this.persistence.set_property(tN,tK)}return ir(s,"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()||id();e.config.get_device_id=s,i.id()&&(e.register({distinct_id:i.id(),$device_id:s()}),e.persistence.set_property(tN,tZ)),t()},r=i.user();"then"in r&&T(r.then)?r.then(s):s(r)}(e,()=>{var s;i.register((Promise&&Promise.resolve||i$.warn("This browser does not have Promise support, and can not use the segment integration"),s=(t,i)=>{if(!i)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(i$.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(i$.info("UserId set, identifying with PostHog"),e.identify(t.event.userId)
1);var s=e.calculateEventProperties(i,t.event.properties);return t.event.properties=Object.assign({},s,t.event.properties),t},{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>s(e,e.event.event),page:e=>s(e,t2),identify:e=>s(e,t5),screen:e=>s(e,"$screen")})).then(()=>{t()})})}(this,()=>this.Br()):this.Br(),T(this.config._onCapture)&&this.config._onCapture!==rl&&(tl.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",e=>this.config._onCapture(e.event,e))),this.config.ip&&tl.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}Dr(e){var t,i,s,r,n,o,a,l=performance.now(),u=m({},rb.__defaultExtensionClasses,this.config.__extensionClasses),c=[];u.featureFlags&&this.Ir.push(this.featureFlags=null!=(t=this.featureFlags)?t:new u.featureFlags(this)),u.exceptions&&this.Ir.push(this.exceptions=null!=(i=this.exceptions)?i:new u.exceptions(this)),u.historyAutocapture&&this.Ir.push(this.historyAutocapture=new u.historyAutocapture(this)),u.tracingHeaders&&this.Ir.push(new u.tracingHeaders(this)),u.siteApps&&this.Ir.push(this.siteApps=new u.siteApps(this)),u.sessionRecording&&!e&&this.Ir.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||c.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),u.autocapture&&this.Ir.push(this.autocapture=new u.autocapture(this)),u.surveys&&this.Ir.push(this.surveys=null!=(s=this.surveys)?s:new u.surveys(this)),u.logs&&this.Ir.push(this.logs=null!=(r=this.logs)?r:new u.logs(this)),u.conversations&&this.Ir.push(this.conversations=null!=(n=this.conversations)?n:new u.conversations(this)),u.productTours&&this.Ir.push(this.productTours=new u.productTours(this)),u.heatmaps&&this.Ir.push(this.heatmaps=new u.heatmaps(this)),u.webVitalsAutocapture&&this.Ir.push(this.webVitalsAutocapture=new u.webVitalsAutocapture(this)),u.exceptionObserver&&this.Ir.push(this.exceptionObserver=new u.exceptionObserver(this)),u.deadClicksAutocapture&&this.Ir.push(this.deadClicksAutocapture=new u.deadClicksAutocapture(this,iF)),u.toolbar&&this.Ir.push(this.toolbar=null!=(o=this.toolbar)?o:new u.toolbar(this)),u.experiments&&this.Ir.push(this.experiments=null!=(a=this.experiments)?a:new u.experiments(this)),this.Ir.forEach(e=>{e.initialize&&c.push(()=>{null==e.initialize||e.initialize()})}),c.push(()=>{if(this.jr){var e=this.jr;this.jr=void 0,this.Ci(e)}}),this.qr(c,l)}qr(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout(()=>{this.qr(e,t)},0);var i=e.shift();if(i)try{i()}catch(e){tl.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&&tl.info("PostHog extensions initialized ("+s+"ms)")}Ci(e){var t;if(!o||!o.body)return tl.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Ci(e)},500);this.config.__preview_deferred_init_extensions&&(this.jr=e),this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=k(e.supportedCompression,si.GZipJS)?si.GZipJS:k(e.supportedCompression,si.Base64)?si.Base64:void 0),null!=(t=e.analytics)&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.Ar?this.Ar:tQ}),this.Ir.forEach(t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e))}Br(){try{this.config.loaded(this)}catch(e){tl.critical("`loaded` function failed",e)}if(this.Zr(),this.config.internal_or_test_user_hostname&&null!=a&&a.hostname){var e=a.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===tJ)&&this.$r()},1),this.Vr=new st(this),this.Vr.load()}Zr(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this.Or)||e.enable())}_dom_loaded(){this.is_capturing()&&t8(this.__request_queue,e=>this.Pr(e)),this.__request_queue=[],this.Zr()}_handle_unload(){var e,t,i,s;null==(e=this.surveys)||e.handlePageUnload(),this.config.request_batching?(this.Hr()&&this.capture(t3),null==(t=this.logs)||t.flushLogs("sendBeacon"),null==(i=this.Or)||i.unload(),null==(s=this.Lr)||s.unload()):this.Hr()&&this.capture(t3,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(rv?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=sD(e.url,{ip:+!!this.config.ip}),e.headers=m({},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,
1(e=>{var t,i,s,r=m({},e);r.timeout=r.timeout||6e4,r.url=sH(r.url,r.compression);var n=null!=(t=r.transport)?t:"fetch",o=sU.filter(e=>!r.disableTransport||!e.transport||!r.disableTransport.includes(e.transport)),a=null!=(i=null==(s=function(e,t){for(var i=0;e.length>i;i++)if(e[i].transport===n)return e[i]}(o))?void 0:s.method)?i:o[0].method;if(!a)throw Error("No available transport method");"sendBeacon"!==n&&r.data&&r.compression===si.GZipJS&&h&&!sL?sq(r).then(e=>{a(e)}).catch(t=>{if(!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""))return sL=!0,void a(m({},r,{compression:void 0,url:sH(e.url,void 0)}));a(r)}):a(r)})(m({},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)}}))))}Pr(e){this.Lr?this.Lr.retriableRequest(e):this._send_request(e)}_execute_array(e){ra++;try{var t,i=[],s=[],r=[];t8(e,e=>{e&&($(t=e[0])?r.push(e):T(e)?e.call(this):$(e)&&"alias"===t?i.push(e):$(e)&&-1!==t.indexOf("capture")&&T(this[t])?r.push(e):s.push(e))});var n=function(e,t){t8(e,function(e){if($(e[0])){var i=t;t4(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{ra--}}push(e){if(ra>0&&$(e)&&A(e[0])){var t=rb.prototype[e[0]];T(t)&&t.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,t,i){var s,r,n,o,a;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Or){if(this.is_capturing())if(!M(e)&&A(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&&!A(null==t?void 0:t.$current_url)&&(tl.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.zr||tl.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=id(),p={uuid:d,event:e,properties:this.calculateEventProperties(e,t||{},h,d)};e===t2&&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 g,v=this.Ur(null==i?void 0:i.$set_once,e!==t6,e===t5);if(v&&(p.$set_once=v),null!=i&&i._noTruncate||(r=this.config.properties_string_max_length,n=p,o=e=>A(e)?e.slice(0,r):e,a=new Set,p=function e(t,i){var s;return t!==Object(t)?o?o(t):t:a.has(t)?void 0:(a.add(t),$(t)?(s=[],t8(t,t=>{s.push(e(t))})):(s={},t4(t,(t,i)=>{a.has(t)||(s[i]=e(t,i))})),s)}(n)),p.timestamp=h,M(null==i?void 0:i.timestamp)||(p.properties.$event_time_override_provided=!0,p.properties.$event_time_override_system_time=c),e===i3.DISMISSED||e===i3.SENT){var _,f,y,b=null==t?void 0:t[i5.SURVEY_ID],w=null==t?void 0:t[i5.SURVEY_ITERATION];g={id:b,current_iteration:w},localStorage.getItem(s9(g))||localStorage.setItem(s9(g),"true"),p.$set=m({},p.$set,{[(_={id:b,current_iteration:w},y="$survey_"+(f=e===i3.SENT?"responded":"dismissed")+"/"+_.id,_.current_iteration&&_.current_iteration>0&&(y="$survey_"+f+"/"+_.id+"/"+_.current_iteration),y)]:!0})}else e===i3.SHOWN&&(p.$set=m({},p.$set,{[i5.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(e===i8.SHOWN){var x=null==t?void 0:t[i4.TOUR_TYPE];x&&(p.$set=m({},p.$set,{[i4.TOUR_LAST_SEEN_DATE+"/"+x]:(new Date).toISOString()}))}var E=m({},p.properties.$set,p.$set);if(O(E)||this.setPersonPropertiesForFlags(E),!N(this.config.before_send)){var k=this.Yr(p);if(!k)return;p=k}this.Sr.emit("eventCaptured",p);var S={method:"POST",url:null!=(s=null==i?void 0:i._url)?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.Pr(S):this.Or.enqueue(S),p}tl.critical("This capture call is ignored due to client rate limiting.")}}else tl.error("No event name provided to posthog.capture")}else tl.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",t=>e(t.event,t))}calculateEventProperties(e,t,i,r,n){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return t;var l,u=n?void 0:this.persistence.remove_event_timer(e),c=m({},t);if(c.token=this.config.token,c.$config_defaults=this.config.defaults,(this.config.cookieless_mode==tJ||this.config.cookieless_mode==tY&&this.consent.isExplicitlyOptedOut())&&(c.$cookieless_mode=!0),"$snapshot"===e){var h=m({},this.persistence.properties(),this.sessionPersistence.properties());return c.distinct_id=h.distinct_id,(!A(c.distinct_id)&&!j(c.distinct_id)||L(c.distinct_id))&&tl.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),c}var p,g=function(e,t){if(!d)return{};var i,r,n,o,l,u,c,h,p,g,_,f=e?[...iq,...t||[]]:[],[m,y]=function(e){for(var t=0;eG.length>t;t++){var[i,s]=eG[t],r=i.exec(e),n=r&&(T(s)?s(r,e):s);if(n)return n}return["",""]}(d);return t7(ii({$os:m,$os_version:y,$browser:eW(d,navigator.vendor),$device:eB(d),$device_type:(u={userAgentDataPlatform:null==(i=navigator)||null==(i=i.userAgentData)?void 0:i.platform,maxTouchPoints:null==(r=navigator)?void 0:r.maxTouchPoints,screenWidth:null==s||null==(n=s.screen)?void 0:n.width,screenHeight:null==s||null==(o=s.screen)?void 0:o.height,devicePixelRatio:null==s?void 0:s.devicePixelRatio},(_=eB(d))===er||_===es||"Kobo"===_||"Kindle Fire"===_||_===eM?ei:_===eE||_===eS||_===ek||_===eT?"Console":_===eo?"Wearable":_?ee:"Android"===(null==u?void 0:u.userAgentDataPlatform)&&(null!=(c=null==u?void 0:u.maxTouchPoints)?c:0)>0?600>Math.min(null!=(h=null==u?void 0:u.screenWidth)?h:0,null!=(p=null==u?void 0:u.screenHeight)?p:0)/(null!=(g=null==u?void 0:u.devicePixelRatio)?g:1)?ee:ei:"Desktop"),$timezone:iZ(),$timezone_offset:function(){try{return(new Date).getTimezoneOffset()}catch(e){return}}()}),{$current_url:iD(null==a?void 0:a.href,f,iU),$host:null==a?void 0:a.host,$pathname:null==a?void 0:a.pathname,$raw_user_agent:d.length>1e3?d.substring(0,997)+"...":d,$browser_version:eV(d,navigator.vendor),$browser_language:iB(),$browser_language_prefix:"string"==typeof(l=iB())?l.split("-")[0]:void 0,$screen_height:null==s?void 0:s.screen.height,$screen_width:null==s?void 0:s.screen.width,$viewport_height:null==s?void 0:s.innerHeight,$viewport_width:null==s?void 0:s.innerWidth,$lib:v.LIB_NAME,$lib_version:v.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:_,windowId:f}=this.sessionManager.checkAndGetSessionAndWindowId(n,i.getTime());c.$session_id=_,c.$window_id=f}this.sessionPropsManager&&t7(c,this.sessionPropsManager.getSessionProps());try{this.sessionRecording&&t7(c,this.sessionRecording.sdkDebugProperties),c.$sdk_debug_retry_queue_size=null==(l=this.Lr)?void 0:l.length}catch(e){c.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===s5&&(c.$lib_custom_api_host=this.config.api_host),p=e!==t2||n?e!==t3||n?this.pageViewM
1anager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,r),c=t7(c,p),e===t2&&o&&(c.title=o.title),!M(u)){var y=i.getTime()-u;c.$duration=parseFloat((y/1e3).toFixed(3))}d&&this.config.opt_out_useragent_filter&&(c.$browser_type=this._is_bot()?"bot":"browser"),(c=t7({},g,this.persistence.properties(),this.sessionPersistence.properties(),c)).$is_identified=this._isIdentified(),$(this.config.property_denylist)?t4(this.config.property_denylist,function(e){delete c[e]}):tl.error(rd+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var b=this.config.sanitize_properties;b&&(tl.error(rh),c=b(c,e));var w=this.Gr();return c.$process_person_profile=w,w&&!n&&this.Wr("_calculate_event_properties"),c}Ur(e,t,i){if(void 0===t&&(t=!0),void 0===i&&(i=!1),!this.persistence||!this.Gr()||this.Cr&&!i)return e;var s,r=t7({},this.persistence.get_initial_props(),(null==(s=this.sessionPropsManager)?void 0:s.getSetOnceProps())||{},e||{}),n=this.config.sanitize_properties;return n&&(tl.error(rh),r=n(r,"$set_once")),t&&(this.Cr=!0),O(r)?void 0:r}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)}Xr(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.Sr.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:rc}),()=>{})}onSessionId(e){var t,i;return null!=(t=null==(i=this.sessionManager)?void 0:i.onSessionId(e))?t:()=>{}}getSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:rc})}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:rc})}renderSurvey(e,t){var i;null==(i=this.surveys)||i.renderSurvey(e,t)}displaySurvey(e,t){var i;void 0===t&&(t=rt),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))?t:{visible:!1,disabledReason:rc}}canRenderSurveyAsync(e,t){var i,s;return void 0===t&&(t=!1),null!=(i=null==(s=this.surveys)?void 0:s.canRenderSurveyAsync(e,t))?i:Promise.resolve({visible:!1,disabledReason:rc})}Jr(e){return!e||L(e)?(tl.critical("Unique user id has not been set in posthog.identify"),!1):e===tG?(tl.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())||(tl.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 tl.uninitializedWarning("posthog.identify");if(j(e)&&(e=e.toString(),tl.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Jr(e)&&this.Wr("posthog.identify")){var s=this.get_distinct_id();this.register({$user_id:e}),this.get_property(tp)||this.register_once({$had_persisted_distinct_id:!0,$device_id:s},""),e!==s&&e!==this.get_property(tg)&&(this.unregister(tg),this.register({distinct_id:e}));var r,n=(this.persistence.get_property(tN)||tK)===tK;e!==s&&n?(this.persistence.set_property(tN,tZ),this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!1),this.capture(t5,{distinct_id:e,$anon_distinct_id:s},{$set:t||{},$set_once:i||{}}),this.Er=s0(e,t,i),null==(r=this.featureFlags)||r.setAnonymousDistinctId(s)):(t||i)&&this.setPersonProperties(t,i),e!==s&&(this.reloadFeatureFlags(),this.unregister(tM))}}setPersonProperties(e,t){if((e||t)&&this.Wr("posthog.setPersonProperties")){var i=s0(this.get_distinct_id(),e,t);this.Er!==i?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Er=i):tl.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:m({},s,{[e]:t})}),r||i){var n={$group_type:e,$group_key:t};
1i&&(n.$group_set=i),this.capture(t6,n)}i&&this.setGroupPropertiesForFlags({[e]:i}),r&&!i&&this.reloadFeatureFlags()}else tl.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.Wr("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;null==(t=this.featureFlags)||t.resetGroupPropertiesForFlags(e)}reset(e){if(tl.info("reset"),!this.__loaded)return tl.uninitializedWarning("posthog.reset");var t,i,s,r,n,o,a,l,u=this.get_property(tp);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.Vr)||r.stop(),null==(n=this.featureFlags)||n.reset(),null==(o=this.conversations)||o.reset(),null==(a=this.persistence)||a.set_property(tN,tK),null==(l=this.sessionManager)||l.resetSessionId(),this.Er=null,this.config.cookieless_mode===tJ)this.register_once({distinct_id:tG,$device_id:null},"");else{var c=this.config.get_device_id(id());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.Kr()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(e=this.conversations)||e.Qr()}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)?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)?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(td)?(tl.critical("Attempting to create alias for existing People user - aborting."),-2):this.Wr("posthog.alias")?(M(t)&&(t=this.get_distinct_id()),e!==t?(this.Xr(tg,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(tl.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=m({},this.config);if(C(e)){t7(this.config,rm(e));var i,s,r,n,o,a,l,u,c,h=this.Fr();null==(i=this.persistence)||i.update_config(this.config,t,h),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new i0(m({},this.config,{persistence:"sessionStorage"}),h);var d=this.Rr(this.config.debug);H(d)&&(this.config.debug=d),H(this.config.debug)&&(this.config.debug?(v.DEBUG=!0,iy.Ut()&&iy.Xt("ph_debug",!0),tl.info("set_config",{config:e,oldConfig:t,newConfig:m({},this.config)})):(v.DEBUG=!1,iy.Ut()&&iy.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){v.LIB_NAME=e,v.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=Error("PostHog syntheticException"),s=this.exceptions.buildProperties(e,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(m({},s,t))}}captureLog(e){var t;null==(t=this.logs)||t.captureLog(e)}get logger(){var e,t;return null!=(e=null==(t=this.logs)?void 0:t.logger)?e:rb.en}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))&&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)?e:rg;return t!==rg&&(t=rg+"."+t),t}_isIdentified(){var e,t;return(null==(e=this.persistence)?void 0:e.get_property(tN))===tZ||(null==(t=this.sessionPersistence)?void 0:t.get_property(tN))===tZ}Gr(){var e,t;return!("never"===this.config.person_profiles||this.config.person_profiles===tQ&&!this._isIdentified()&&O(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[tg])&&(null==(t=this.persistence)||null==(t=t.props)||!t[tz]))}Hr(){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.Gr()||this.Wr("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Wr("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Wr(e){return"never"===this.config.person_profiles?(tl.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Xr(tz,!0),!0)}Fr(){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!==tY)}tn(){var e,t,i,s,r=this.Fr();return(null==(e=this.persistence)?void 0:e.fi)!==r&&(null==(i=this.persistence)||i.set_disabled(r)),(null==(t=this.sessionPersistence)?void 0:t.fi)!==r&&(null==(s=this.sessionPersistence)||s.set_disabled(r)),r}opt_in_capturing(e){var t;if(this.config.cookieless_mode!==tJ){if(this.config.cookieless_mode===tY&&this.consent.isExplicitlyOptedOut()){this.reset(!0),null==(r=this.sessionManager)||r.destroy(),null==(n=this.pageViewM
1anager)||n.destroy(),this.sessionManager=new sK(this),this.pageViewManager=new iM(this),this.persistence&&(this.sessionPropsManager=new sX(this,this.sessionManager,this.persistence));var i,s,r,n,o,a,l,u=null!=(o=null==(a=this.config.__extensionClasses)?void 0:a.sessionRecording)?o:null==(l=rb.__defaultExtensionClasses)?void 0:l.sessionRecording;u&&(this.sessionRecording=this._r(this.sessionRecording,new u(this)))}this.consent.optInOut(!0),this.tn(),this.Zr(),null==(t=this.sessionRecording)||t.startIfEnabledOrStop(),this.config.cookieless_mode==tY&&(null==(i=this.surveys)||i.loadIfEnabled()),(M(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!=(s=null==e?void 0:e.captureEventName)?s:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.$r()}else tl.warn(ru)}opt_out_capturing(){var e,t,i;this.config.cookieless_mode!==tJ?(this.config.cookieless_mode===tY&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.tn(),this.config.cookieless_mode===tY&&(this.register({distinct_id:tG,$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.$r())):tl.warn(ru)}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===tJ||(this.config.cookieless_mode===tY?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.tn()}_is_bot(){return n?sZ(n,this.config.custom_blocked_useragents):void 0}$r(){o&&("visible"===o.visibilityState?this.kr||(this.kr=!0,this.capture(t2,{title:o.title},{send_instantly:!0}),this.Tr&&(o.removeEventListener(t0,this.Tr),this.Tr=null)):this.Tr||(this.Tr=this.$r.bind(this),ir(o,t0,this.Tr)))}debug(e){!1===e?(null==s||s.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==s||s.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}))}ki(){var e,t,i,s,r=this.Nr||{};return"advanced_disable_flags"in r?!!r.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(tl.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):(t="advanced_disable_decide",i=(e="advanced_disable_flags")in r&&!N(r[e]),s=t in r&&!N(r[t]),i?r[e]:!!s&&(tl&&tl.warn("Config field '"+t+"' is deprecated. Please use '"+e+"' instead. The old field will be removed in a future major version."),r[t]))}Yr(e){if(N(this.config.before_send))return e;var t=$(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e;for(var s of t){if(N(i=s(i))){var r="Event '"+e.event+"' was rejected in beforeSend function";return U(e.event)?tl.warn(r+". This can cause unexpected behavior."):tl.info(r),null}i.properties&&!O(i.properties)||tl.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.ai)?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)})}Rr(e){var t=H(e)&&!e,i=iy.Ut()&&"true"===iy.Gt("ph_debug");return!t&&(!!i||e)}}function rw(e){return e instanceof Element&&(e.id===tV||!(null==e.closest||!e.closest(".toolbar-global-fade-container")))}function rx(e){return!!e&&1===e.nodeType}function rE(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}
1function rk(e){return!!e&&3===e.nodeType}function rS(e){return!!e&&11===e.nodeType}function rP(e){return e?S(e).split(/\s+/):[]}function rR(e){var t=null==s?void 0:s.location.href;return!!(t&&e&&e.some(e=>t.match(e)))}function rF(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 rP(t)}function rI(e){return N(e)?null:S(e).split(/(\s+)/).filter(e=>rB(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function r$(e){var t="";return rj(e)&&!rq(e)&&e.childNodes&&e.childNodes.length&&t4(e.childNodes,function(e){var i;rk(e)&&e.textContent&&(t+=null!=(i=rI(e.textContent))?i:"")}),S(t)}function rT(e){var t;return M(e.target)?e.srcElement||null:null!=(t=e.target)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}rb.__defaultExtensionClasses={},rb.en={trace:rn=()=>{},debug:rn,info:rn,warn:rn,error:rn,fatal:rn},function(e,t){for(var i=0;t.length>i;i++)e.prototype[t[i]]=it(e.prototype[t[i]])}(rb,["identify"]);var rC=["a","button","form","input","select","textarea","label"];function rO(e,t){if(M(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 rM(e){var t=e.parentNode;return!(!t||!rx(t))&&t}var rA=["next","previous","prev",">","<"],rL=[".ph-no-rageclick",".ph-no-capture"],rD=e=>!e||rE(e,"html")||!rx(e),rN=(e,t)=>{if(!s||rD(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,r=[e],n=e;n.parentNode&&!rE(n,"body");)if(rS(n.parentNode))r.push(n.parentNode.host),n=n.parentNode.host;else{var o=rM(n);if(!o)break;if(t||rC.indexOf(o.tagName.toLowerCase())>-1)i=!0;else{var a=s.getComputedStyle(o);a&&"pointer"===a.getPropertyValue("cursor")&&(i=!0)}r.push(o),n=o}return{parentIsUsefulElement:i,targetElementList:r}};function rj(e){for(var t=e;t.parentNode&&!rE(t,"body");t=t.parentNode){var i=rF(t);if(k(i,"ph-sensitive")||k(i,"ph-no-capture"))return!1}if(k(rF(e),"ph-include"))return!0;var s=e.type||"";if(A(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}var r=e.name||e.id||"";return!A(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 rq(e){return!!(rE(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||rE(e,"select")||rE(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var rH="(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})",rU=RegExp("^(?:"+rH+")$"),rW=new RegExp(rH),rz="\\d{3}-?\\d{2}-?\\d{4}",rV=RegExp("^("+rz+")$"),rG=RegExp("("+rz+")");function rB(e,t){return void 0===t&&(t=!0),!(N(e)||A(e)&&(e=S(e),(t?rU:rW).test((e||"").replace(/[- ]/g,""))||(t?rV:rG).test(e)))&&!0}function rX(e){var t=r$(e);return rB(t=(t+" "+function e(t){var i="";return t&&t.childNodes&&t.childNodes.length&&t4(t.childNodes,function(t){var s;if(t&&"span"===(null==(s=t.tagName)?void 0:s.toLowerCase()))try{var r=r$(t);i=(i+" "+r).trim(),t.childNodes&&t.childNodes.length&&(i=(i+" "+e(t)).trim())}catch(e){tl.error("[AutoCapture]",e)}}),i}(e)).trim())?t:""}function rY(e){return e.replace(/"|\\"/g,'\\"')}class rJ{constructor(e){this.disabled=!1===e;var t=C(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}}var rK="$copy_autocapture",rZ=tu("[AutoCapture]");function rQ(e,t){return t.length>e?t.slice(0,e)+"...":t}var r0=tu("[ExceptionAutocapture]");function r1(e,t,i){try{if(!(t in e))return()=>{};var s=e[t],r=i(s);return T(r)&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=r,()=>{e[t]=s}}catch(e){return()=>{}}}var r2=tu("[TracingHeaders]"),r3=tu("[Web Vitals]"),r5="disabled",r6="lazy_loading",r8="awaiting_config",r4="missing_config";tu("[SessionRecording]"),tu("[SessionRecording]");var r7="[SessionRecording]",r9=tu(r7),ne=tu("[Heatmaps]");function nt(e){return C(e)&&"clientX"in e&&"clientY"in e&&j(e.clientX)&&j(e.clientY)}
1var ni=tu("[Product Tours]"),ns="ph_product_tours",nr=["$set_once","$set"],nn=tu("[SiteApps]"),no="Error while initializing PostHog app with config id ";function na(e,t,i){if(N(e))return!1;switch(i){case"exact":return e===t;case"contains":return RegExp(t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*"),"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch(e){return!1}default:return!1}}class nl{constructor(e){this.rn=new sY,this.nn=(e,t)=>this.sn(e,t)&&this.an(e,t)&&this.ln(e,t)&&this.un(e,t),this.sn=(e,t)=>null==t||!t.event||(null==e?void 0:e.event)===(null==t?void 0:t.event),this._instance=e,this.hn=new Set,this.cn=new Set}init(){var e,t;M(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(!M(null==(t=this._instance)?void 0:t._addCaptureHook)&&(e.forEach(e=>{var t,i;null==(t=this.cn)||t.add(e),null==(i=e.steps)||i.forEach(e=>{var t;null==(t=this.hn)||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.hn.has(e)||this.hn.has(null==t?void 0:t.event))&&this.cn&&(null==(i=this.cn)?void 0:i.size)>0&&this.cn.forEach(e=>{this.dn(t,e)&&this.rn.emit("actionCaptured",e.name)})}vn(e){this.onAction("actionCaptured",t=>e(t))}dn(e,t){if(null==(null==t?void 0:t.steps))return!1;for(var i of t.steps)if(this.nn(e,i))return!0;return!1}onAction(e,t){return this.rn.on(e,t)}an(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||!na(s,t.url,t.url_matching||"contains"))return!1}return!0}ln(e,t){return!!this.fn(e,t)&&!!this.pn(e,t)&&!!this.gn(e,t)}fn(e,t){if(null==t||!t.href)return!0;var i=this.mn(e);if(i.length>0)return i.some(e=>na(e.href,t.href,t.href_matching||"exact"));var s,r,n=(null==e||null==(s=e.properties)?void 0:s.$elements_chain)||"";return!!n&&na((r=n.match(/(?::|")href="(.*?)"/))?r[1]:"",t.href,t.href_matching||"exact")}pn(e,t){if(null==t||!t.text)return!0;var i=this.mn(e);if(i.length>0)return i.some(e=>na(e.text,t.text,t.text_matching||"exact")||na(e.$el_text,t.text,t.text_matching||"exact"));var s,r,n,o,a=(null==e||null==(s=e.properties)?void 0:s.$elements_chain)||"";return!!a&&(r=function(e){for(var t,i=[],s=/(?::|")text="(.*?)"/g;!N(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=>na(e,n,o)))}gn(e,t){if(null==t||!t.selector)return!0;var i,s,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}mn(e){var t;return null==(null==e||null==(t=e.properties)?void 0:t.$elements)?[]:null==e?void 0:e.properties.$elements}un(e,t){return null==t||!t.properties||0===t.properties.length||s3(t.properties.reduce((e,t)=>{var i=$(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)}}class nu{constructor(e){this._instance=e,this.yn=new Map,this.bn=new Map,this.wn=new Map}_n(e,t){return!!e&&s3(e.propertyFilters,null==t?void 0:t.properties)}In(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}Cn(e,t,i){var s=(i===i1.Activation?this.yn:this.bn).get(e),r=[];return this.Sn(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._n(n,t)})}register(e){var t;M(null==(t=this._instance)?void 0:t._addCaptureHook)||(this.kn(e),this.xn(e))}xn(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.Tn&&(this.Tn=new nl(this._instance),this.Tn.init(),this.Tn.vn(e=>{this.onAction(e)}
1)),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.Tn)||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.wn.get(t.name);i&&i.push(e.id),this.wn.set(t.name,i||[e.id])}}))}))}kn(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.yn=this.In(e,i1.Activation),this.bn=this.In(e,i1.Cancellation))}onEvent(e,t){var i,s=this.re(),r=this.An(),n=this.En(),o=(null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[r])||[];if(n===e&&t&&o.length>0){s.info("event matched, removing item from activated items",{event:e,eventPayload:t,existingActivatedItems:o});var a,l,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.Rn(o))}}else{if(this.bn.has(e)){var h=this.Cn(e,t,i1.Cancellation);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.Nn(e.id)}),this.Rn(o))}if(this.yn.has(e)){s.info("event name matched",{event:e,eventPayload:t,items:this.yn.get(e)});var d=this.Cn(e,t,i1.Activation);this.Rn(o.concat(d.map(e=>e.id)||[]))}}}onAction(e){var t,i=this.An(),s=(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i])||[];this.wn.has(e)&&this.Rn(s.concat(this.wn.get(e)||[]))}Rn(e){var t,i=this.re(),s=this.An(),r=[...new Set(e)].filter(e=>!this.Mn(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.An();return(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[t])||[]}getEventToItemsMap(){return this.yn}Fn(){return this.Tn}}class nc extends nu{constructor(e){super(e)}An(){return"$surveys_activated"}En(){return i3.SHOWN}Sn(e){var t;null==(t=this._instance)||t.getSurveys(e)}Nn(e){var t;null==(t=this._instance)||t.cancelPendingSurvey(e)}re(){return s4}Mn(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var nh="SDK is not enabled or survey functionality is not yet loaded",nd="Disabled. Not loading surveys.",np=null!=s&&s.location?iN(s.location.hash,"__posthog")||iN(location.hash,"state"):null,ng="_postHogToolbarParams",nv=tu("[Toolbar]"),n_=tu("[FeatureFlags]"),nf=tu("[FeatureFlags]",{debugEnabled:!0}),nm="\" failed. Feature flags didn't load in time.",ny="$active_feature_flags",nb="$override_feature_flags",nw="$feature_flag_payloads",nx="$override_feature_flag_payloads",nE="$feature_flag_request_id",nk=e=>{for(var t={},i=0;e.length>i;i++)t[e[i]]=!0;return t},nS=e=>{var t={};for(var[i,s]of t9(e||{}))s&&(t[i]=s);return t},nP=tu("[Error tracking]"),nR="Refusing to render web experiment since the viewer is a likely bot",nF={icontains:(e,t)=>!!s&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!s&&-1===t.href.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>!!s&&sQ(t.href,e),not_regex:(e,t)=>!!s&&!sQ(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};class nI{get Rt(){return this._instance.config}constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(e){void 0===e&&(e=!1),t.getWebExperiments(e=>{nI.On("retrieved web experiments from the server"),t.Pn=new Map,e.forEach(e=>{if(e.feature_flag_key){t.Pn&&(nI.On("setting flag key ",e.feature_flag_key," to web experiment ",e),null==(i=t.Pn)||i.set(e.feature_flag_key,e));
1var i,s=t._instance.getFeatureFlag(e.feature_flag_key);A(s)&&e.variants[s]&&t.Ln(e.name,s,e.variants[s].transforms)}else if(e.variants)for(var r in e.variants){var n=e.variants[r];nI.Dn(n)&&t.Ln(e.name,r,n.transforms)}})},e)},this._instance=e,this._instance.onFeatureFlags(e=>{this.onFeatureFlags(e)})}initialize(){}onFeatureFlags(e){if(this._is_bot())nI.On(nR);else if(!this.Rt.disable_web_experiments){if(N(this.Pn))return this.Pn=new Map,this.loadIfEnabled(),void this.previewWebExperiment();nI.On("applying feature flags",e),e.forEach(e=>{var t;if(this.Pn&&null!=(t=this.Pn)&&t.has(e)){var i,s=this._instance.getFeatureFlag(e),r=null==(i=this.Pn)?void 0:i.get(e);s&&null!=r&&r.variants[s]&&this.Ln(r.name,s,r.variants[s].transforms)}})}}previewWebExperiment(){var e=nI.getWindowLocation();if(null!=e&&e.search){var t=iL(null==e?void 0:e.search,"__experiment_id"),i=iL(null==e?void 0:e.search,"__experiment_variant");t&&i&&(nI.On("previewing web experiments "+t+" && "+i),this.getWebExperiments(e=>{this.Bn(parseInt(t),i,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||[])})}Bn(e,t,i){var s=i.filter(t=>t.id===e);s&&s.length>0&&(nI.On("Previewing web experiment ["+s[0].name+"] with variant ["+t+"]"),this.Ln(s[0].name,t,s[0].variants[t].transforms))}static Dn(e){return!N(e.conditions)&&nI.jn(e)&&nI.qn(e)}static jn(e){if(N(e.conditions)||N(null==(t=e.conditions)?void 0:t.url))return!0;var t,i,s,r,n=nI.getWindowLocation();return!!n&&(null==(i=e.conditions)||!i.url||nF[null!=(s=null==(r=e.conditions)?void 0:r.urlMatchType)?s:"icontains"](e.conditions.url,n))}
1static getWindowLocation(){return null==s?void 0:s.location}static qn(e){if(N(e.conditions)||N(null==(i=e.conditions)?void 0:i.utm))return!0;var t=iz();if(t.utm_source){var i,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)==t.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)==t.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)==t.utm_medium,g=null==(u=e.conditions)||null==(u=u.utm)||!u.utm_term||(null==(c=e.conditions)||null==(c=c.utm)?void 0:c.utm_term)==t.utm_term;return h&&p&&g&&d}return!1}static On(e){for(var t=arguments.length,i=Array(t>1?t-1:0),s=1;t>s;s++)i[s-1]=arguments[s];tl.info("[WebExperiments] "+e,i)}Ln(e,t,i){this._is_bot()?nI.On(nR):"control"!==t?i.forEach(i=>{if(i.selector){nI.On("applying transform of variant "+t+" for experiment "+e+" ",i);var s,r=null==(s=document)?void 0:s.querySelectorAll(i.selector);null==r||r.forEach(e=>{i.html&&(e.innerHTML=i.html),i.css&&e.setAttribute("style",i.css)})}}):nI.On("Control variants leave the page unmodified.")}_is_bot(){return n&&this._instance?sZ(n,this.Rt.custom_blocked_useragents):void 0}}var n$=tu("[Conversations]"),nT="Conversations not available yet.",nC={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},nO=nC.info;function nM(e){var t=[];for(var i in e){var s=e[i];D(s)||M(s)||t.push({key:i,value:function e(t){if(H(t))return{boolValue:t};if(j(t))return Number.isInteger(t)?{intValue:t}:{doubleValue:t};if("string"==typeof t)return{stringValue:t};if($(t))return{arrayValue:{values:t.map(t=>e(t))}};try{return{stringValue:JSON.stringify(t)}}catch(e){return{stringValue:String(t)}}}(s)})}return t}var nA={featureFlags:class{constructor(e){this.Zn=!1,this.$n=!1,this.Vn=!1,this.Hn=!1,this.zn=!1,this.Un=!1,this.Yn=!1,this.Gn=!1,this._instance=e,this.featureFlagEventHandlers=[]}get Rt(){return this._instance.config}get Xi(){return this._instance.persistence}Wn(e){return this._instance.get_property(e)}Xn(){var e,t;return null!=(e=null==(t=this.Xi)?void 0:t.pi(this.Rt.feature_flag_cache_ttl_ms))&&e}Jn(){return!!this.Xn()&&(this.Gn||this.Vn||(this.Gn=!0,n_.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Kn(){var e,t=null!=(e=this.Rt.evaluation_contexts)?e:this.Rt.evaluation_environments;return!this.Rt.evaluation_environments||this.Rt.evaluation_contexts||this.Yn||(n_.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||n_.error("Invalid evaluation context found:",e,"Expected non-empty string"),t}):[]}Qn(){return this.Kn().length>0}initialize(){var e,t,{config:i}=this._instance,s=null!=(e=null==(t=i.bootstrap)?void 0:t.featureFlags)?e:{};if(Object.keys(s).length){var r,n,o=null!=(r=null==(n=i.bootstrap)?void 0:n.featureFlagPayloads)?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=m({},s,e),o=m({},r,t),a={};for(var[l,u]of Object.entries(n)){var c="string"==typeof u;a[l]={key:l,enabled:!!c||!!u,variant:c?u:void 0,reason:void 0,metadata:M(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.$n}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this.Wn(t$),t=this.Wn(nb),i=this.Wn(nx);if(!i&&!t)return e||{};var s=t7({},e||{});for(var r of[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])]){var n,o,a=s[r],l=null==t?void 0:t[r],u=M(l)?null!=(n=null==a?void 0:a.enabled)&&n:!!l,c=M(l)?a.variant:"string"==typeof l?l:void 0,h=null==i?void 0:i[r],d=m({},a,{enabled:u,variant:u?null!=c?c:null==a?void 0:a.variant:void 0});u!==(null==a?void 0:a.enabled)&&(d.original_enabled=null==a?void 0:a.enabled),c!==(null==a?void 0:a.variant)&&(
1d.original_variant=null==a?void 0:a.variant),h&&(d.metadata=m({},null==a?void 0:a.metadata,{payload:h,original_payload:null==a||null==(o=a.metadata)?void 0:o.payload})),s[r]=d}return this.Zn||(n_.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:s}),this.Zn=!0),s}getFlagVariants(){var e=this.Wn(tF),t=this.Wn(nb);if(!t)return e||{};for(var i=t7({},e),s=Object.keys(t),r=0;s.length>r;r++)i[s[r]]=t[s[r]];return this.Zn||(n_.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this.Zn=!0),i}getFlagPayloads(){var e=this.Wn(nw),t=this.Wn(nx);if(!t)return e||{};for(var i=t7({},e||{}),s=Object.keys(t),r=0;s.length>r;r++)i[s[r]]=t[s[r]];return this.Zn||(n_.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this.Zn=!0),i}reloadFeatureFlags(){this.Hn||this.Rt.advanced_disable_feature_flags||this.ts||(this._instance.Sr.emit("featureFlagsReloading",!0),this.ts=setTimeout(()=>{this.es()},5))}rs(){clearTimeout(this.ts),this.ts=void 0}ensureFlagsLoaded(){this.$n||this.Vn||this.ts||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.Hn=e}es(e){var t;if(this.rs(),!this._instance.ki())if(this.Vn)this.zn=!0;else{var i=this.Rt.token,s=this.Wn(tp),r={token:i,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:m({},(null==(t=this.Xi)?void 0:t.get_initial_props())||{},this.Wn(tT)||{}),group_properties:this.Wn(tC),timezone:iZ()};D(s)||M(s)||(r.$device_id=s),(null!=e&&e.disableFlags||this.Rt.advanced_disable_feature_flags)&&(r.disable_flags=!0),this.Qn()&&(r.evaluation_contexts=this.Kn());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.Vn=!0,this._instance._send_request({method:"POST",url:n,data:r,compression:this.Rt.disable_compression?void 0:si.Base64,timeout:this.Rt.feature_flag_request_timeout_ms,callback:e=>{var t,i,s,n=!0;if(200===e.statusCode&&(this.zn||(this.$anon_distinct_id=void 0),n=!1),this.Vn=!1,!r.disable_flags||this.zn){this.Un=!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.Xi)||s.register({[tL]:o}),l)?n_.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)?a:{},n,{partialResponse:!!this.Rt.advanced_only_evaluate_survey_feature_flags}
1),this.zn&&(this.zn=!1,this.es()))}}})}}getFeatureFlag(e,t){var i;if(void 0===t&&(t={}),!t.fresh||this.Un)if(this.$n||this.getFlags()&&this.getFlags().length>0){if(!this.Jn()){var s=this.getFeatureFlagResult(e,t);return null!=(i=null==s?void 0:s.variant)?i:null==s?void 0:s.enabled}}else n_.warn('getFeatureFlag for key "'+e+nm)}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.Un)if(this.$n||this.getFlags()&&this.getFlags().length>0){if(!this.Jn()){var i=this.getFlagVariants(),s=e in i,r=i[e],n=this.getFlagPayloads()[e],o=String(r),a=this.Wn(nE)||void 0,l=this.Wn(tD)||void 0,u=this.Wn(tM)||{};if(this.Rt.advanced_feature_flags_dedup_per_session){var c,h=this._instance.get_session_id(),d=this.Wn(tA);h&&h!==d&&(u={},null==(c=this.Xi)||c.register({[tM]:u,[tA]:h}))}if((t.send_event||!("send_event"in t))&&(!(e in u)||!u[e].includes(o))){$(u[e])?u[e].push(o):u[e]=[o],null==(_=this.Xi)||_.register({[tM]:u});var p=this.getFeatureFlagDetails(e),g=[...null!=(f=this.Wn(tL))?f:[]];M(r)&&g.push("flag_missing");var v={$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==(m=this.Rt.bootstrap)||null==(m
1=m.featureFlags)?void 0:m[e])||null,$feature_flag_bootstrapped_payload:(null==(y=this.Rt.bootstrap)||null==(y=y.featureFlagPayloads)?void 0:y[e])||null,$used_bootstrap_value:!this.Un};M(null==p||null==(b=p.metadata)?void 0:b.version)||(v.$feature_flag_version=p.metadata.version);var _,f,m,y,b,w,x,E,k,S,P,R=null!=(w=null==p||null==(x=p.reason)?void 0:x.description)?w:null==p||null==(E=p.reason)?void 0:E.code;R&&(v.$feature_flag_reason=R),null!=p&&null!=(k=p.metadata)&&k.id&&(v.$feature_flag_id=p.metadata.id),M(null==p?void 0:p.original_variant)&&M(null==p?void 0:p.original_enabled)||(v.$feature_flag_original_response=M(p.original_variant)?p.original_enabled:p.original_variant),null!=p&&null!=(S=p.metadata)&&S.original_payload&&(v.$feature_flag_original_payload=null==p||null==(P=p.metadata)?void 0:P.original_payload),g.length&&(v.$feature_flag_error=g.join(",")),this._instance.capture("$feature_flag_called",v)}if(s){var F=n;if(!M(n))try{F=JSON.parse(n)}catch(e){}return{key:e,enabled:!!r,variant:"string"==typeof r?r:void 0,payload:F}}}}else n_.warn('getFeatureFlagResult for key "'+e+nm)}getRemoteConfigPayload(e,t){var i=this.Rt.token,s={distinct_id:this._instance.get_distinct_id(),token:i};this.Qn()&&(s.evaluation_contexts=this.Kn()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:s,compression:this.Rt.disable_compression?void 0:si.Base64,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.Un){if(this.$n||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlag(e,t);return M(i)?void 0:!!i}n_.warn('isFeatureEnabled for key "'+e+nm)}}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t,i){if(this.Xi){this.$n=!0;var s=this.getFlagVariants(),r=this.getFlagPayloads(),n=this.getFlagsWithDetails();!function(e,t,i,s,r,n){void 0===i&&(i={}),void 0===s&&(s={}),void 0===r&&(r={});var o,a=((o=e.flags)?(e.featureFlags=Object.fromEntries(Object.keys(o).map(e=>{var t;return[e,null!=(t=o[e].variant)?t:o[e].enabled]})),e.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]}))):n_.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e),l=a.flags,u=a.featureFlags,c=a.featureFlagPayloads;if(u){var h=e.requestId,d=e.evaluatedAt;if($(u)){n_.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var p={};if(u)for(var g=0;u.length>g;g++)p[u[g]]=!0;t&&t.register({[ny]:u,[tF]:p})}else{var v=u,_=c,f=l;if(null!=n&&n.partialResponse)v=m({},i,v),_=m({},s,_),f=m({},r,f);else if(e.errorsWhileComputingFlags)if(l){var y=new Set(Object.keys(l).filter(e=>{var t;return!(null!=(t=l[e])&&t.failed)}));v=m({},i,Object.fromEntries(Object.entries(v).filter(e=>{var[t]=e;return y.has(t)}))),_=m({},s,Object.fromEntries(Object.entries(_||{}).filter(e=>{var[t]=e;return y.has(t)}))),f=m({},r,Object.fromEntries(Object.entries(f||{}).filter(e=>{var[t]=e;return y.has(t)})))}else v=m({},i,v),_=m({},s,_),f=m({},r,f);t&&t.register(m({[ny]:Object.keys(nS(v)),[tF]:v||{},[nw]:_||{},[t$]:f||{}},h?{[nE]:h}:{},d?{[tD]:d}:{}))}}}(e,this.Xi,s,r,n,i),t||(this.Gn=!1),this.ns(t)}}override(e,t){void 0===t&&(t=!1),n_.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this.Xi)return n_.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===e)return this.Xi.unregister(nb),this.Xi.unregister(nx),this.ns(),nf.info("All overrides cleared");if($(e)){var t,i=nk(e);return this.Xi.register({[nb]:i}),this.ns(),nf.info("Flag overrides set",{flags:e})}if(e&&"object"==typeof e&&("flags"in e||"payloads"in e)){if(this.Zn=!!(null!=(t=e.suppressWarning)&&t),"flags"in e){if(!1===e.flags)this.Xi.unregister(nb),nf.info("Flag overrides cleared");else if(e.flags){if($(e.flags)){var s=nk(e.flags);this.Xi.register({[nb]:s})}else this.Xi.register({[nb]:e.flags});nf.info("Flag overrides set",{flags:e.flags})}}return"payloads"in e&&(!1===e.payloads?(this.Xi.unregister(nx),nf.info("Payload overrides cleared")):e.payloads&&(this.Xi.register({[nx]:e.payloads}),nf.info("Payload overrides set",{payloads:e.payloads}))),void this.ns()}if(e&&"object"==typeof e)return this.Xi.register({[nb]:e}),this.ns(),nf.info("Flag overrides set",{flags:e});n_.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.$n){var{flags:t,flagVariants:i}=this.ss();e(t,i)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var s,r=(this.Wn(tI)||[]).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=m({},this.getFlagVariants(),{[e]:t});null==(s=this.Xi)||s.register({[ny]:Object.keys(nS(a)),[tF]:a}),this.ns()}getEarlyAccessFeatures(e,t,i){void 0===t&&(t=!1);var s=this.Wn(tI),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.Xi)||i.unregister(tI),null==(s=this.Xi)||s.register({[tI]:r}),e(r)}}})}ss(){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),{})}}ns(e){var{flags:t,flagVariants:i}=this.ss();
1this.featureFlagEventHandlers.forEach(s=>s(t,i,{errorsLoading:e}))}setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=this.Wn(tT)||{},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({[tT]:m({},i,n,s)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(tT)}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=this.Wn(tC)||{};0!==Object.keys(i).length&&Object.keys(i).forEach(t=>{i[t]=m({},i[t],e[t]),delete e[t]}),this._instance.register({[tC]:m({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.Wn(tC)||{};this._instance.register({[tC]:m({},t,{[e]:{}})})}else this._instance.unregister(tC)}reset(){this.$n=!1,this.Vn=!1,this.Hn=!1,this.zn=!1,this.Un=!1,this.$anon_distinct_id=void 0,this.rs(),this.Zn=!1}}},nL=m({productTours:class{get Xi(){return this._instance.persistence}constructor(e){this.co=null,this.do=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){"productTours"in e&&(this.Xi&&this.Xi.register({[tE]:!!e.productTours}),this.loadIfEnabled())}loadIfEnabled(){var e,t;this.co||(e=this._instance).config.disable_product_tours||null==(t=e.persistence)||!t.get_property(tE)||this.ni(()=>this.vo())}ni(e){var t,i;null!=(t=p.__PosthogExtensions__)&&t.generateProductTours?e():null==(i=p.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"product-tours",t=>{t?ni.error("Could not load product tours script",t):e()})}vo(){var e;!this.co&&null!=(e=p.__PosthogExtensions__)&&e.generateProductTours&&(this.co=p.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(void 0===t&&(t=!1),!$(this.do)||t){var i=this.Xi;if(i){var s=i.props[ns];if($(s)&&!t)return this.do=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 ni.error(r),void e([],{isLoaded:!1,error:r})}var n=$(t.json.product_tours)?t.json.product_tours:[];this.do=n,i&&i.register({[ns]:n}),e(n,{isLoaded:!0})}})}else e(this.do,{isLoaded:!0})}getActiveProductTours(e){N(this.co)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.co.getActiveProductTours(e)}showProductTour(e){var t;null==(t=this.co)||t.showTourById(e)}previewTour(e){this.co?this.co.previewTour(e):this.ni(()=>{var t;this.vo(),null==(t=this.co)||t.previewTour(e)})}dismissProductTour(){var e;null==(e=this.co)||e.dismissTour("user_clicked_skip")}nextStep(){var e;null==(e=this.co)||e.nextStep()}previousStep(){var e;null==(e=this.co)||e.previousStep()}clearCache(){var e;this.do=null,null==(e=this.Xi)||e.unregister(ns)}resetTour(e){var t;null==(t=this.co)||t.resetTour(e)}resetAllTours(){var e;null==(e=this.co)||e.resetAllTours()}cancelPendingTour(e){var t;null==(t=this.co)||t.cancelPendingTour(e)}}},nA),nD=m({surveys:class{get Rt(){return this._instance.config}constructor(e){this.Io=void 0,this._surveyManager=null,this.Co=!1,this.So=[],this.ko=null,this._instance=e,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this.Rt.disable_surveys){var t=e.surveys;
1if(N(t))return s4.warn("Flags not loaded yet. Not loading surveys.");var i=$(t);this.Io=i?t.length>0:t,s4.info("flags response received, isSurveysEnabled: "+this.Io),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var i=localStorage.key(t);(null!=i&&i.startsWith(s7)||null!=i&&i.startsWith("inProgressSurvey_"))&&e.push(i)}e.forEach(e=>localStorage.removeItem(e))}loadIfEnabled(){if(!this._surveyManager)if(this.Co)s4.info("Already initializing surveys, skipping...");else if(this.Rt.disable_surveys)s4.info(nd);else if(this.Rt.cookieless_mode&&this._instance.consent.isOptedOut())s4.info("Not loading surveys in cookieless mode without consent.");else{var e=null==p?void 0:p.__PosthogExtensions__;if(e){if(!M(this.Io)||this.Rt.advanced_enable_surveys){var t=this.Io||this.Rt.advanced_enable_surveys;this.Co=!0;try{var i=e.generateSurveys;if(i)return void this.xo(i,t);var s=e.loadExternalDependency;if(!s)return void this.To(tX);s(this._instance,"surveys",i=>{i||!e.generateSurveys?this.To("Could not load surveys script",i):this.xo(e.generateSurveys,t)})}catch(e){throw this.To("Error initializing surveys",e),e}finally{this.Co=!1}}}else s4.error("PostHog Extensions not found.")}}xo(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new nc(this._instance),s4.info("Surveys loaded successfully"),this.Ao({isLoaded:!0})}To(e,t){s4.error(e,t),this.Ao({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.So.push(e),this._surveyManager&&this.Ao({isLoaded:!0}),()=>{this.So=this.So.filter(t=>t!==e)}}getSurveys(e,t){if(void 0===t&&(t=!1),this.Rt.disable_surveys)return s4.info(nd),e([]);var i,s=this._instance.get_property(tO);if(s&&!t)return e(s,{isLoaded:!0});"undefined"!=typeof Promise&&this.ko?this.ko.then(t=>{var{surveys:i,context:s}=t;return e(i,s)}):("undefined"!=typeof Promise&&(this.ko=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=>{this.ko=null;var s=t.statusCode;if(200!==s||!t.json){var r="Surveys API could not be loaded, status: "+s;s4.error(r);var n={isLoaded:!1,error:r};return e([],n),void(null==i||i({surveys:[],context:n}))}var o,a,l=t.json.surveys||[],u=l.filter(e=>{var t,i;return!(!e.start_date||e.end_date)&&(!(null==(t=e.conditions)||null==(t=t.events)||null==(t=t.values)||!t.length)||!(null==(i=e.conditions)||null==(i=i.actions)||null==(i=i.values)||!i.length))});u.length>0&&(null==(a=this._surveyEventReceiver)||a.register(u)),null==(o=this._instance.persistence)||o.register({[tO]:l});var c={isLoaded:!0};e(l,c),null==i||i({surveys:l,context:c})}}))}Ao(e){for(var t of this.So)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(e){s4.error("Error in survey callback",e)}}getActiveMatchingSurveys(e,t){if(void 0===t&&(t=!1),!N(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);s4.warn("init was not called")}Eo(e){var t=null;return this.getSurveys(i=>{var s;t=null!=(s=i.find(t=>t.id===e))?s:null}),t}Ro(e){if(N(this._surveyManager))return{eligible:!1,reason:nh};var t="string"==typeof e?this.Eo(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}
1canRenderSurvey(e){if(N(this._surveyManager))return s4.warn("init was not called"),{visible:!1,disabledReason:nh};var t=this.Ro(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return N(this._surveyManager)?(s4.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:nh})):new Promise(i=>{this.getSurveys(t=>{var s,r=null!=(s=t.find(t=>t.id===e))?s:null;if(r){var n=this.Ro(r);i({visible:n.eligible,disabledReason:n.reason})}else i({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t,i){var s;if(N(this._surveyManager))s4.warn("init was not called");else{var r="string"==typeof e?this.Eo(e):e;if(null!=r&&r.id)if(re.includes(r.type)){var n=null==o?void 0:o.querySelector(t);if(n)return null!=(s=r.appearance)&&s.surveyPopupDelaySeconds?(s4.info("Rendering survey "+r.id+" with delay of "+r.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout(()=>{var e,t;s4.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),s4.info("Survey "+r.id+" rendered")},1e3*r.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(r,n,i);s4.warn("Survey element not found")}else s4.warn("Surveys of type "+r.type+" cannot be rendered in the app");else s4.warn("Survey not found")}}displaySurvey(e,t){var i;if(N(this._surveyManager))s4.warn("init was not called");else{var s=this.Eo(e);if(s){var r=s;if(null!=(i=s.appearance)&&i.surveyPopupDelaySeconds&&t.ignoreDelay&&(r=m({},s,{appearance:m({},s.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==i6.Popover&&t.initialResponses&&s4.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 s4.warn("Survey is not eligible to be displayed: ",n.disabledReason)}t.displayType!==i6.Inline?this._surveyManager.handlePopoverSurvey(r,t):this.renderSurvey(r,t.selector,t.properties)}else s4.warn("Survey not found")}}cancelPendingSurvey(e){N(this._surveyManager)?s4.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;null==(e=this._surveyManager)||e.handlePageUnload()}}},nA),nN=m({experiments:nI},nA),nj=m({},nA,{sessionRecording:class{get Rt(){return this._instance.config}get Xi(){return this._instance.persistence}get started(){var e;return!(null==(e=this.os)||!e.isStarted)}get status(){var e,t;return this.ls===r8||this.ls===r4?this.ls:null!=(e=null==(t=this.os)?void 0:t.status)?e:this.ls}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.ls=r5,this.us=void 0,this._instance=e,!this._instance.sessionManager)throw r9.error("started without valid sessionManager"),Error(r7+" started without valid sessionManager. This is a bug.");if(this.Rt.cookieless_mode===tJ)throw Error(r7+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get hs(){var e,t=!(null==(e=this._instance.get_property(tS))||!e.enabled),i=!this.Rt.disable_session_recording,r=this.Rt.disable_session_recording||this._instance.consent.isOptedOut();return s&&t&&i&&!r}startIfEnabledOrStop(e){var t;if(!this.hs||null==(t=this.os)||!t.isStarted){var i=!M(Object.assign)&&!M(Array.from);this.hs&&i?(this.cs(e),r9.info("starting")):(this.ls=r5,this.stopRecording())}}cs(e){var t,i,s;this.hs&&(this.ls!==r8&&this.ls!==r4&&(this.ls=r6),null!=p&&null!=(t=p.__PosthogExtensions__)&&null!=(t=t.rrweb)&&t.record&&null!=(i=p.__PosthogExtensions__)&&i.initSessionRecording?this.ds(e):null==(s=p.__PosthogExtensions__)||null==s.loadExternalDependency||s.loadExternalDependency(this._instance,this.vs,t=>{if(t)return r9.error("could not load recorder",t);this.ds(e)}))}stopRecording(){var e,t;null==(e=this.us)||e.call(this),this.us=void 0,null==(t=this.os)||t.stop()}fs(){var e,t;null==(e=this.us)||e.call(this),this.us=void 0,null==(t=this.os)||t.discard()}ps(){var e;null==(e=this.Xi)||e.unregister(tR)}gs(e,t){if(N(e))return null;var i=j(e)?e:parseFloat(e);return"number"!=typeof i||!Number.isFinite(i)||0>i||i>1?(r9.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):i}ys(e){if(this.Xi){var t,i,s=this.Xi,r=()=>{var t,i=!1===e.sessionRecording?void 0:e.sessionRecording,r=this.gs(null==(t=this.Rt.session_recording)?void 0:t.sampleRate,"session_recording.sampleRate"),n=this.gs(null==i?void 0:i.sampleRate,"remote config sampleRate"),o=null!=r?r:n;N(o)&&this.ps();var a=null==i?void 0:i.minimumDurationMilliseconds;s.register({[tS]:m({cache_timestamp:Date.now(),enabled:!!i},i,{networkPayloadCapture:m({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:M(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,version:null==i?void 0:i.version,triggerGroups:null==i?void 0:i.triggerGroups})})};r(),null==(t=this.us)||t.call(this),this.us=null==(i=this._instance.sessionManager)?void 0:i.onSessionId(r)}}onRemoteConfig(e){return"sessionRecording"in e?!1===e.sessionRecording?(this.ys(e),void this.fs()):(this.ys(e),void this.startIfEnabledOrStop()):(this.ls===r8&&(this.ls=r4,r9.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.os)&&i.log?this.os.log(e,t):r9.warn("log called before recorder was ready")}get vs(){var e,t,i=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.get_property(tS);return(null==i||null==(t=i.scriptConfig)?void 0:t.script)||"lazy-recorder"}bs(){var e,t=this._instance.get_property(tS);if(!t)return!1;var i=null!=(e=("object"==typeof t?t:JSON.parse(t)).cache_timestamp)?e:Date.now();return 36e5>=Date.now()-i}ds(e){var t,i;if(null==(t=p.__PosthogExtensions__)||!t.initSessionRecording)return r9.
1warn("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.os||(this.os=null==(i=p.__PosthogExtensions__)?void 0:i.initSessionRecording(this._instance),this.os._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.bs()){if(this.ls===r4||this.ls===r8)return;return this.ls=r8,r9.info("persisted remote config is stale, requesting fresh config before starting"),void new st(this._instance).load()}this.ls=r6,this.os.start(e)}onRRwebEmit(e){var t;null==(t=this.os)||null==t.onRRwebEmit||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.os||null==(t=this.Xi)||t.register({$replay_override_linked_flag:!0}),null==(e=this.os)||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.os||null==(t=this.Xi)||t.register({$replay_override_sampling:!0}),null==(e=this.os)||e.overrideSampling()}overrideTrigger(e){var t,i;this.os||null==(i=this.Xi)||i.register({["url"===e?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null==(t=this.os)||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return(null==(e=this.os)?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var i;return!(null==(i=this.os)||!i.tryAddCustomEvent(e,t))}}},{autocapture:class{constructor(e){this.ws=!1,this._s=null,this.Is=!1,this.instance=e,this.rageclicks=new rJ(e.config.rageclick),this.Cs=null}initialize(){this.startIfEnabled()}get Rt(){var e,t,i=C(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}Ss(){if(this.isBrowserSupported()){if(s&&o){var e=e=>{e=e||(null==s?void 0:s.event);try{this.ks(e)}catch(e){rZ.error("Failed to capture event",e)}};if(ir(o,"submit",e,{capture:!0}),ir(o,"change",e,{capture:!0}),ir(o,"click",e,{capture:!0}),this.Rt.capture_copied_text){var t=e=>{this.ks(e=e||(null==s?void 0:s.event),rK)};ir(o,"copy",t,{capture:!0}),ir(o,"cut",t,{capture:!0})}}}else rZ.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.ws&&(this.Ss(),this.ws=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.Is=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[t_]:!!e.autocapture_opt_out}),this._s=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.Cs=e}getElementSelectors(e){var t,i=[];return null==(t=this.Cs)||t.forEach(t=>{var s=null==o?void 0:o.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[t_];if(D(this._s)&&!H(i)&&!this.instance.ki())return!1;var s=null!=(t=this._s)?t:!!i;return!!this.instance.config.autocapture&&!s}ks(e,t){if(void 0===t&&(t="$autocapture"),this.isEnabled){var i,r=rT(e);rk(r)&&(r=r.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(!s||rD(e)||(H(t)?(i=!!t&&rL,r=void 0):(i=null!=(n=null==t?void 0:t.css_selector_ignorelist)?n:rL,r=null==t?void 0:t.content_ignorelist),!1===i))return!1;var i,r,n,{targetElementList:o}=rN(e,!1);return!function(e,t){var i;if(!1===e||M(e))return!1;if(!0===e)i=rA;else{if(!$(e))return!1;if(e.length>10)return tl.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))})}(r,o.map(e=>{var t;return{safeText:r$(e).toLowerCase(),ariaLabel:(null==(t=e.getAttribute("aria-label"))?void 0:t.toLowerCase().trim())||""}}))&&!rO(o,i)}(r,this.instance.config.rageclick)&&this.ks(e,"$rageclick");var n=t===rK;if(r&&function(e,t,i,r,n){if(void 0===i&&(i=void 0),!s||rD(e)||null!=(o=i)&&o.url_allowlist&&!rR(i.url_allowlist)||null!=(a=i)&&a.url_ignorelist&&rR(i.url_ignorelist))return!1;if(null!=(l=i)&&l.dom_event_allowlist){var o,a,l,u,c=i.dom_event_allowlist;if(c&&!c.some(e=>t.type===e))return!1}var{parentIsUsefulElement:h,targetElementList:d}=rN(e,r);if(!function(e,t){var i=null==t?void 0:t.element_allowlist;if(M(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}(d,i)||!rO(d,null==(u=i)?void 0:u.css_selector_allowlist))return!1;var p=s.getComputedStyle(e);
1if(p&&"pointer"===p.getPropertyValue("cursor")&&"click"===t.type)return!0;var g=e.tagName.toLowerCase();switch(g){case"html":return!1;case"form":return(n||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(t.type)>=0;default:return h?(n||["click"]).indexOf(t.type)>=0:(n||["click"]).indexOf(t.type)>=0&&(rC.indexOf(g)>-1||"true"===e.getAttribute("contenteditable"))}}(r,e,this.Rt,n,n?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=function(e,t){for(var i,r,{e:n,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:u}=t,c=[e],h=e;h.parentNode&&!rE(h,"body");)rS(h.parentNode)?(c.push(h.parentNode.host),h=h.parentNode.host):(c.push(h.parentNode),h=h.parentNode);var d,p=[],g={},v=!1,_=!1;if(t4(c,e=>{var t=rj(e);"a"===e.tagName.toLowerCase()&&(v=e.getAttribute("href"),v=t&&v&&rB(v)&&v),k(rF(e),"ph-no-capture")&&(_=!0),p.push(function(e,t,i,s){var r=e.tagName.toLowerCase(),n={tag_name:r};rC.indexOf(r)>-1&&!i&&(n.$el_text="a"===r.toLowerCase()||"button"===r.toLowerCase()?rQ(1024,rX(e)):rQ(1024,r$(e)));var o=rF(e);o.length>0&&(n.classes=o.filter(function(e){return""!==e})),t4(e.attributes,function(i){var r;if((!rq(e)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==s||!s.includes(i.name))&&!t&&rB(i.value)&&(!A(r=i.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))){var o=i.value;"class"===i.name&&(o=rP(o).join(" ")),n["attr__"+i.name]=rQ(1024,o)}});for(var a=1,l=1,u=e;u=function(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!rx(t));return t}(u);)a++,u.tagName===e.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}(e,o,a,l)),t7(g,function(e){if(!rj(e))return{};var t={};return t4(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&&rB(s)&&(t[i]=s)}}),t}(e))}),_)return{props:{},explicitNoCapture:_};if(a||(p[0].$el_text="a"===e.tagName.toLowerCase()||"button"===e.tagName.toLowerCase()?rX(e):r$(e)),v){p[0].attr__href=v;var f,y,b=null==(f=iA(v))?void 0:f.host,w=null==s||null==(y=s.location)?void 0:y.host;b&&w&&b!==w&&(d=v)}return{props:t7({$event_type:n.type,$ce_version:1},u?{}:{$elements:p},{$elements_chain:p.map(e=>{var t,i,s,r={text:null==(i=e.$el_text)?void 0:i.slice(0,400),tag_name:e.tag_name,href:null==(s=e.attr__href)?void 0:s.slice(0,2048),attr_class:(t=e.attr__class)?$(t)?t:rP(t):void 0,attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return t9(e).filter(e=>{var[t]=e;return 0===t.indexOf("attr__")}).forEach(e=>{var[t,i]=e;return r.attributes[t]=i}),r}).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=m({},e.text?{text:e.text}:{},{"nth-child":null!=(t=e.nth_child)?t:0,"nth-of-type":null!=(i=e.nth_of_type)?i:0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),o={};return t9(n).sort((e,t)=>{var[i]=e,[s]=t;return i.localeCompare(s)}).forEach(e=>{var[t,i]=e;return o[rY(t.toString())]=rY(i.toString())}),(s+=":")+t9(o).map(e=>{var[t,i]=e;return t+'="'+i+'"'}).join("")}).join(";")},null!=(i=p[0])&&i.$el_text?{$el_text:null==(r=p[0])?void 0:r.$el_text}:{},d&&"click"===n.type?{$external_click_url:d}:{},g)}}(r,{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.Is});if(a)return!1;var l=this.getElementSelectors(r);if(l&&l.length>0&&(o.$element_selectors=l),t===rK){var u,c=rI(null==s||null==(u=s.getSelection())?void 0:u.toString()),h=e.type||"clipboard";if(!c)return!1;o.$selected_content=c,o.$copy_type=h}return this.instance.capture(t,o),!0}}}isBrowserSupported(){return T(null==o?void 0:o.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this.xs=(null==s||null==(t=s.location)?void 0:t.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(tl.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.Ts&&this.Ts(),this.Ts=void 0,tl.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(s&&s.history){var i=this;null!=(e=s.history.pushState)&&e.__posthog_wrapped__||r1(s.history,"pushState",e=>function(t,s,r){e.call(this,t,s,r),i.As("pushState")}),null!=(t=s.history.replaceState)&&t.__posthog_wrapped__||r1(s.history,"replaceState",e=>function(t,s,r){e.call(this,t,s,r),i.As("replaceState")}),this.Es()}}As(e){try{var t,i=null==s||null==(t=s.location)?void 0:t.pathname;if(!i)return;i!==this.xs&&this.isEnabled&&this._instance.capture(t2,{navigation_type:e}),this.xs=i}catch(t){tl.error("Error capturing "+e+" pageview",t)}}Es(){if(!this.Ts){var e=()=>{this.As("popstate")};ir(s,"popstate",e),this.Ts=()=>{s&&s.removeEventListener("popstate",e)}}}},heatmaps:class{get Rt(){return this.instance.config}constructor(e){var t;this.Rs=!1,this.ws=!1,this.Ns=null,this.instance=e,this.Rs=!(null==(t=this.instance.persistence)||!t.props[tf]),this.rageclicks=new rJ(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return C(this.Rt.capture_heatmaps)&&this.Rt.capture_heatmaps.flush_interval_milliseconds&&(e=this.Rt.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return N(this.Rt.capture_heatmaps)?N(this.Rt.enable_heatmaps)?this.Rs:this.Rt.enable_heatmaps:!1!==this.Rt.capture_heatmaps}startIfEnabled(){if(this.isEnabled)this.ws||(ne.info("starting..."),this.Ms(),this.Tt());else{var e;clearInterval(null!=(e=this.Ns)?e:void 0),this.Fs(),this.getAndClearBuffer()}}onRemoteConfig(e){if("heatmaps"in e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[tf]:t}),this.Rs=t,this.startIfEnabled()}}getAndClearBuffer(){var e=this.T;return this.T=void 0,e}Os(e){this.wt(e.originalEvent,"deadclick")}Tt(){this.Ns&&clearInterval(this.Ns),this.Ns="visible"===(null==o?void 0:o.visibilityState)?setInterval(this.ji.bind(this),this.flushIntervalMilliseconds):null}Ms(){s&&o&&(this.Ps=this.ji.bind(this),ir(s,t1,this.Ps),this.Ls=e=>this.wt(e||(null==s?void 0:s.event)),ir(o,"click",this.Ls,{capture:!0}),this.Ds=e=>this.Bs(e||(null==s?void 0:s.event)),ir(o,"mousemove",this.Ds,{capture:!0}),this.js=new iI(this.instance,iR,this.Os.bind(this)),this.js.startIfEnabledOrStop(),this.qs=this.Tt.bind(this),ir(o,t0,this.qs),this.ws=!0)}Fs(){var e;s&&o&&(this.Ps&&s.removeEventListener(t1,this.Ps),this.Ls&&o.removeEventListener("click",this.Ls,{capture:!0}),this.Ds&&o.removeEventListener("mousemove",this.Ds,{capture:!0}),this.qs&&o.removeEventListener(t0,this.qs),clearTimeout(this.Zs),null==(e=this.js)||e.stop(),this.ws=!1)}$s(e,t){var i=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),o=function(e,t,i){for(var r=e;r&&rx(r)&&!rE(r,"body")&&r!==i;){if(k(t,null==s?void 0:s.getComputedStyle(r).position))return!0;r=rM(r)}return!1}(rT(e),["fixed","sticky"],n);return{x:e.clientX+(o?0:r),y:e.clientY+(o?0:i),target_fixed:o,type:t}}wt(e,t){var i;if(void 0===t&&(t="click"),!rw(e.target)&&nt(e)){var s=this.$s(e,t);null!=(i=this.rageclicks)&&i.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&this.Vs(m({}
1,s,{type:"rageclick"})),this.Vs(s)}}Bs(e){!rw(e.target)&&nt(e)&&(clearTimeout(this.Zs),this.Zs=setTimeout(()=>{this.Vs(this.$s(e,"mousemove"))},500))}Vs(e){if(s){var t=s.location.href,i=this.Rt.custom_personal_data_properties,r=iD(t,this.Rt.mask_personal_data_properties?[...iq,...i||[]]:[],iU);this.T=this.T||{},this.T[r]||(this.T[r]=[]),this.T[r].push(e)}}ji(){this.T&&!O(this.T)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:iI,webVitalsAutocapture:class{constructor(e){var t;this.Rs=!1,this.ws=!1,this.T={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Hs=()=>{clearTimeout(this.zs),0!==this.T.metrics.length&&(this._instance.capture("$web_vitals",this.T.metrics.reduce((e,t)=>m({},e,{["$web_vitals_"+t.name+"_event"]:m({},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(M(i))r3.error("Could not read session ID. Dropping metrics!");else{this.T=this.T||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var s=this.Us();M(s)||(N(null==e?void 0:e.name)||N(null==e?void 0:e.value)?r3.error("Invalid metric received",e):!this.Ys||this.Ys>e.value?(this.T.url!==s&&(this.Hs(),this.zs=setTimeout(this.Hs,this.flushToCaptureTimeoutMs)),M(this.T.url)&&(this.T.url=s),this.T.firstMetricTimestamp=M(this.T.firstMetricTimestamp)?Date.now():this.T.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0),this.T.metrics.push(m({},e,{$current_url:s,$session_id:i.sessionId,$window_id:i.windowId,timestamp:Date.now()})),this.T.metrics.length===this.allowedMetrics.length&&this.Hs()):r3.error("Ignoring metric with value >= "+this.Ys,e))}},this.Gs=()=>{if(!this.ws){var e,t,i,s,r=p.__PosthogExtensions__;M(r)||M(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.ws=!0):r3.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.Rs=!(null==(t=this._instance.persistence)||!t.props[tw]),this.startIfEnabled()}get Ws(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,i=C(this.Ws)?null==(e=this.Ws)?void 0:e.web_vitals_allowed_metrics:void 0;return N(i)?(null==(t=this._instance.persistence)?void 0:t.props[tk])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(C(this.Ws)?this.Ws.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=C(this.Ws)?this.Ws.web_vitals_attribution:void 0;return null!=e&&e}get Ys(){var e=C(this.Ws)&&j(this.Ws.__web_vitals_max_value)?this.Ws.__web_vitals_max_value:9e5;return e>0&&6e4>=e?9e5:e}get isEnabled(){var e=null==a?void 0:a.protocol;if("http:"!==e&&"https:"!==e)return r3.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=C(this.Ws)?this.Ws.web_vitals:H(this.Ws)?this.Ws:void 0;return H(t)?t:this.Rs}startIfEnabled(){this.isEnabled&&!this.ws&&(r3.info("enabled, starting..."),this.ni(this.Gs))}onRemoteConfig(e){if("capturePerformance"in e){var t=C(e.capturePerformance)&&!!e.capturePerformance.web_vitals,i=C(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[tw]:t}),this._instance.persistence.register({[tk]:i})),this.Rs=t,this.startIfEnabled()}}ni(e){var t,i;null!=(t=p.__PosthogExtensions__)&&t.postHogWebVitalsCallbacks?e():null==(i=p.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",t=>{t?r3.error("failed to load script",t):e()})}Us(){var e=s?s.location.href:void 0;if(e){var t=this._instance.config.custom_personal_data_properties;return iD(e,this._instance.config.mask_personal_data_properties?[...iq,...t||[]]:[],iU)}r3.error("Could not determine current URL")}}},{exceptionObserver:class{constructor(e){var t,i,r;this.Gs=()=>{var e;if(s&&this.isEnabled&&null!=(e=p.__PosthogExtensions__)&&e.errorWrappingFunctions){var t=p.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=p.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=p.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Xs&&this.Rt.capture_unhandled_errors&&(this.Xs=t(this.captureException.bind(this))),!this.Js&&this.Rt.capture_unhandled_rejections&&(this.Js=i(this.captureException.bind(this))),!this.Ks&&this.Rt.capture_console_errors&&(this.Ks=r(this.captureException.bind(this)))}catch(e){r0.error("failed to start",e),this.Qs()}}},this._instance=e,this.eo=!(null==(t=this._instance.persistence)||!t.props[tm]),this.io=new J({refillRate:null!=(i=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)?i:1,bucketSize:null!=(r=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)?r:10,refillInterval:1e4,qt:r0}),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 C(e)?t=m({},t,e):(M(e)?this.eo:e)&&(t=m({},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?(r0.info("enabled"),this.Qs(),this.ni(this.Gs)):this.Qs()}ni(e){var t,i;
1null!=(t=p.__PosthogExtensions__)&&t.errorWrappingFunctions&&e(),null==(i=p.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",t=>{if(t)return r0.error("failed to load script",t);e()})}Qs(){var e,t,i;null==(e=this.Xs)||e.call(this),this.Xs=void 0,null==(t=this.Js)||t.call(this),this.Js=void 0,null==(i=this.Ks)||i.call(this),this.Ks=void 0}onRemoteConfig(e){"autocaptureExceptions"in e&&(this.eo=!!e.autocaptureExceptions,this._instance.persistence&&this._instance.persistence.register({[tm]:this.eo}),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)?t:"Exception";this.io.consumeRateLimit(r)?r0.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.no=[],this.so=new eY([new e8,new to,new e7,new e4,new tr,new ts,new te,new tn],function(e){for(var t=arguments.length,i=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=e6.test(a)?a.replace(e6,"$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}}}if(!r.length)return[];var h=Array.from(r);return h.reverse(),h.slice(0,50).map(e=>m({},e,{filename:e.filename||(h[h.length-1]||{}).filename,function:e.function||"?"}))}}("web:javascript",e1,e5)),this._instance=e,this.no=null!=(t=null==(i=this._instance.persistence)?void 0:i.get_property(ty))?t:[]}onRemoteConfig(e){var t,i,s;if("errorTracking"in e){var r=null!=(t=null==(i=e.errorTracking)?void 0:i.suppressionRules)?t:[],n=null==(s=e.errorTracking)?void 0:s.captureExtensionExceptions;this.no=r,this._instance.persistence&&this._instance.persistence.register({[ty]:this.no,[tb]:n})}}get oo(){var e,t=!!this._instance.get_property(tb),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!=(e=null!=i?i:t)&&e}buildProperties(e,t){return this.so.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.ao(t)){if(this.lo(t))return void nP.info("Skipping exception capture because a suppression rule matched");if(!this.oo&&this.uo(t))return void nP.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ho(t))return void nP.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent",zr:!0})}lo(e){if(0===e.length)return!1;var t=e.reduce((e,t)=>{var{type:i,value:s}=t;return A(i)&&i.length>0&&e.$exception_types.push(i),A(s)&&s.length>0&&e.$exception_values.push(s),e},{$exception_types:[],$exception_values:[]});return this.no.some(e=>{var i=e.values.map(e=>{var i,s=s1[e.operator],r=$(e.value)?e.value:[e.value],n=null!=(i=t[e.key])?i:[];return r.length>0&&s(r,n)});return"OR"===e.type?i.some(Boolean):i.every(Boolean)})}uo(e){return e.flatMap(e=>{var t,i;return null!=(t=null==(i=e.stacktrace)?void 0:i.frames)?t:[]}).some(e=>e.filename&&e.filename.startsWith("chrome-extension://"))}ho(e){if(e.length>0){var t,i,s,r,n=null!=(t=null==(i=e[0].stacktrace)?void 0:i.frames)?t:[],o=n[n.length-1];return null!=(s=null==o||null==(r=o.filename)?void 0:r.includes("posthog.com/static"))&&s}return!1}ao(e){return!N(e)&&$(e)}}},nL,{siteApps:class{constructor(e){this._instance=e,this.fo=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}po(e,t){if(t){var i=this.globalsForEvent(t);this.fo.push(i),this.fo.length>1e3&&(this.fo=this.fo.slice(10))}}get siteAppLoaders(){var e;return null==(e=p._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.siteApps}initialize(){if(this.isEnabled){var e=this._instance._addCaptureHook(this.po.bind(this));this.mo=()=>{e(),this.fo=[],this.mo=void 0}}}globalsForEvent(e){if(!e)throw Error("Event payload is required");var t,i,s,r,n,o,a,l={},u=this._instance.get_property("$groups")||[];for(var[c,h]of Object.entries(this._instance.get_property("$stored_group_properties")||{}))l[c]={id:u[c],type:c,properties:h};var{$set_once:d,$set:p}=e;return{event:m({},y(e,nr),{properties:m({},e.properties,p?{$set:m({},null!=(t=null==(i=e.properties)?void 0:i.$set)?t:{},p)}:{},d?{$set_once:m({},null!=(s=null==(r=e.properties)?void 0:r.$set_once)?s:{},d)}:{}),elements_chain:null!=(n=null==(o=e.properties)?void 0:o.$elements_chain)?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.fo.length&&(nn.info("Processing "+this.fo.length+" events for site app with id "+e.id),this.fo.forEach(e
1=>null==t.processEvent?void 0:t.processEvent(e)),t.processedBuffer=!0),Object.values(this.apps).every(e=>e.processedBuffer||e.errored)&&(null==(i=this.mo)||i.call(this))},s=!1,r=r=>{t.errored=!r,t.loaded=!0,nn.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){nn.error(no+e.id,t),r(!1)}if(s&&t.loaded)try{i()}catch(i){nn.error("Error while processing buffered events PostHog app with config id "+e.id,i),t.errored=!0}}yo(){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)}bo(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){nn.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.yo(),void this._instance.on("eventCaptured",e=>this.bo(e))):void nn.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this.mo)||i.call(this),null!=(s=e.siteApps)&&s.length)if(this.isEnabled){var n=function(e){var t;p["__$$ph_site_app_"+e]=r._instance,null==(t=p.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(r._instance,a,t=>{if(t)return nn.error(no+e,t)})};for(var{id:o,url:a}of e.siteApps)n(o)}else nn.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},nD,{tracingHeaders:class{constructor(e){this.wo=void 0,this._o=void 0,this.Gs=()=>{var e,t;M(this.wo)&&(null==(e=p.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)||e._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),M(this._o)&&(null==(t=p.__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()}ni(e){var t,i;null!=(t=p.__PosthogExtensions__)&&t.tracingHeadersPatchFns&&e(),null==(i=p.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",t=>{if(t)return r2.error("failed to load script",t);e()})}startIfEnabledOrStop(){var e,t;this._instance.config.__add_tracing_headers?this.ni(this.Gs):(null==(e=this.wo)||e.call(this),null==(t=this._o)||t.call(this),this.wo=void 0,this._o=void 0)}}},{toolbar:class{constructor(e){this.instance=e}No(e){p.ph_toolbar_state=e}Mo(){var e;return null!=(e=p.ph_toolbar_state)?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),io(this.instance.config)||!s||!o)return!1;e=null!=e?e:s.location,i=null!=i?i:s.history;try{if(!t){try{s.localStorage.setItem("test","test"),s.localStorage.removeItem("test")}catch(e){return!1}t=null==s?void 0:s.localStorage}var r,n=np||iN(e.hash,"__posthog")||iN(e.hash,"state"),a=n?ie(()=>JSON.parse(atob(decodeURIComponent(n))))||ie(()=>JSON.parse(decodeURIComponent(n))):null;return a&&"ph_authorize"===a.action?((r=a).source="url",r&&Object.keys(r).length>0&&(a.desiredHash?e.hash=a.desiredHash:i?i.replaceState(i.state,"",e.pathname+e.search):e.hash="")):((r=JSON.parse(t.getItem(ng)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(e){return!1}}Fo(e){var t=p.ph_load_toolbar||p.ph_load_editor;!N(t)&&T(t)?t(e,this.instance):nv.warn("No toolbar load function found")}loadToolbar(e){var t,i=!(null==o||!o.getElementById(tV));if(!s||i)return!1;var r="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,n=m({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});return(s.localStorage.setItem(ng,JSON.stringify(m({},n,{source:void 0}))),2===this.Mo())?this.Fo(n):0===this.Mo()&&(this.No(1),null==(t=p.__PosthogExtensions__)||null==t.loadExternalDependency||t.loadExternalDependency(this.instance,"toolbar",e=>{if(e)return nv.error("[Toolbar] Failed to load",e),void this.No(0);this.No(2),this.Fo(n)}),ir(s,"turbolinks:load",()=>{this.No(0),this.loadToolbar(n)})),!0}Oo(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)}}},nN,{conversations:class{constructor(e){this.Po=void 0,this._conversationsManager=null,this.Lo=!1,this.Do=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations){var t=e.conversations;N(t)||(H(t)?this.Po=t:(this.Po=t.enabled,this.Do=t),this.loadIfEnabled())}}reset(){var e;null==(e=this._conversationsManager)||e.reset(),this._conversationsManager=null,this.Po=void 0,this.Do=null}loadIfEnabled(){if(!(this._conversationsManager||this.Lo||this._instance.config.disable_conversations||io(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=null==p?void 0:p.__PosthogExtensions__;if(e&&!M(this.Po)&&this.Po)if(this.Do&&this.Do.token){this.Lo=!0;try{var t=e.initConversations;if(t)return this.Bo(t),void(this.Lo=!1);var i=e.loadExternalDependency;if(!i)return void this.jo(tX);i(this._instance,"conversations",t=>{t||!e.initConversations?this.jo("Could not load conversations script",t):this.Bo(e.initConversations),this.Lo=!1})}catch(e){this.jo("Error initializing conversations",e),this.Lo=!1}}else n$.error("Conversations enabled but missing token in remote config.")}}Bo(e){if(this.Do)try{this._conversationsManager=e(this.Do,this._instance),n$.info("Conversations loaded successfully")}catch(e){this.jo("Error completing conversations initialization",e)}else n$.error("Cannot complete initialization: remote config is null")}jo(e,t){n$.error(e,t),this._conversationsManager=null,this.Lo=!1}show(){this._conversationsManager?this._conversationsManager.show():n$.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Po&&!D(this._conversationsManager)}isVisible(){var e,t;return null!=(e=null==(t=this._conversationsManager)?void 0:t.isVisible())&&e}sendMessage(e,t,i){var s=this;return f(function*(){return s._conversationsManager?s._conversationsManager.sendMessage(e,t,i):(n$.warn(nT),null)})()}getMessages(e,t){var i=this;return f(function*(){return i._conversationsManager?i._conversationsManager.getMessages(e,t):(n$.warn(nT),null)})()}markAsRead(e){var t=this;return f(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(n$.warn(nT),null)})()}getTickets(e){var t=this;return f(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(n$.warn(nT),null)})()}requestRestoreLink(e){var t=this;return f(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(n$.warn(nT),null)})()}restoreFromToken(e){var t=this;return f(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(n$.warn(nT),null)})()}restoreFromUrlToken(){var e=this;return f(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(n$.warn(nT),null)})()}getCurrentTicketId(){var e,t;return null!=(e=null==(t=this._conversationsManager)?void 0:t.getCurrentTicketId())?e:null}getWidgetSessionId(){var e,t;return null!=(e=null==(t=this._conversationsManager)?void 0:t.getWidgetSessionId())?e:null}Kr(){var e;null==(e=this._conversationsManager)||e.setIdentity()}Qr(){var e;null==(e=this._conversationsManager)||e.clearIdentity()}}},{logs:class{constructor(e){var t;this.qo=!1,this.Zo=!1,this.qt=tu("[logs]"),this.$o=[],this.Vo=0,this.Ho=0,this.zo=!1,this._instance=e,this._instance&&null!=(t=this._instance.config.logs)&&t.captureConsoleLogs&&(this.qo=!0)}initialize(){this.loadIfEnabled()}onRemoteConfig(e){var t,i=null==(t=e.logs)?void 0:t.captureConsoleLogs;!N(i)&&i&&(this.qo=!0,this.loadIfEnabled())}reset(){this.$o=[],this.Ni&&(clearTimeout(this.Ni),this.Ni=void 0),this.Vo=0,this.Ho=0,this.zo=!1}loadIfEnabled(){if(this.qo&&!this.Zo){var e=null==p?void 0:p.__PosthogExtensions__;if(e){var t=e.loadExternalDependency;t?t(this._instance,"logs",t=>{var i;t||null==(i=e.logs)||!i.initializeLogs?this.qt.error("Could not load logs script",t):(e.logs.initializeLogs(this._instance),this.Zo=!0)}):this.qt.error(tX)}else this.qt.error("PostHog Extensions not found.")}}captureLog(e){var t,i,s,r,n,o;if(this._instance.is_capturing())if(e&&e.body){var a=null!=(t=null==(i=this._instance.config.logs)?void 0:i.flushIntervalMs)?t:3e3,l=null!=(s=null==(r=this._instance.config.logs)?void 0:r.maxLogsPerInterval)?s:1e3,u=Date.now();if(a>u-this.Ho||(this.Ho=u,this.Vo=0,this.zo=!1),l>this.Vo){this.Vo++;var c=function(e,t){var{text:i,number:s}=nC[e.level||"info"]||nO,r=String(Date.now())+"000000",n={};t.distinctId&&(n.posthogDistinctId=t.distinctId),t.sessionId&&(n.sessionId=t.sessionId),t.currentUrl&&(n["url.full"]=t.currentUrl),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(n.feature_flags=t.activeFeatureFlags);var o=m({},n,e.attributes||{}),a={timeUnixNano:r,observedTimeUnixNano:r,severityNumber:s,severityText:i,body:{stringValue:e.body},attributes:nM(o)};return e.trace_id&&(a.traceId=e.trace_id),e.span_id&&(a.spanId=e.span_id),M(e.trace_flags)||(a.flags=e.trace_flags),a}(e,this.Uo());this.$o.push({record:c}),(null!=(n=null==(o=this._instance.config.logs)?void 0:o.maxBufferSize)?n:100)>this.$o.length?this.Yo():this.flushLogs()}else this.zo||(this.qt.warn("captureLog dropping logs: exceeded "+l+" logs per "+a+"ms"),this.zo=!0)}else this.qt.warn("captureLog requires a body")}get logger(){return this.Go||(this.Go={trace:(e,t)=>this.captureLog({body:e,level:"trace",attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:"debug",attributes:t}),info:(e,t)=>this.captureLog({body:e,level:"info",attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:"warn",attributes:t}),error:(e,t)=>
1this.captureLog({body:e,level:"error",attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:"fatal",attributes:t})}),this.Go}flushLogs(e){if(this.Ni&&(clearTimeout(this.Ni),this.Ni=void 0),0!==this.$o.length){var t,i=this.$o;this.$o=[];var s=this._instance.config.logs,r=m({"service.name":(null==s?void 0:s.serviceName)||"unknown_service"},(null==s?void 0:s.environment)&&{"deployment.environment":s.environment},(null==s?void 0:s.serviceVersion)&&{"service.version":s.serviceVersion},null==s?void 0:s.resourceAttributes),n=(t=i.map(e=>e.record),{resourceLogs:[{resource:{attributes:nM(r)},scopeLogs:[{scope:{name:v.LIB_NAME},logRecords:t}]}]}),o=this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token);this._instance.Pr({method:"POST",url:o,data:n,compression:"best-available",batchKey:"logs",transport:e})}}Yo(){var e,t;this.Ni||(this.Ni=setTimeout(()=>{this.Ni=void 0,this.flushLogs()},null!=(e=null==(t=this._instance.config.logs)?void 0:t.flushIntervalMs)?e:3e3))}Uo(){var e,t={lib:v.LIB_NAME};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var{sessionId:i}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);t.sessionId=i}if(null!=p&&null!=(e=p.location)&&e.href&&(t.currentUrl=p.location.href),this._instance.featureFlags){var s=this._instance.featureFlags.getFlags();s&&s.length>0&&(t.activeFeatureFlags=s)}return t}}});rb.__defaultExtensionClasses=m({},nj);var nq,nH=(nq=ro[rg]=new rb,function(){function e(){e.done||(e.done=!0,rv=!1,t4(ro,function(e){e._dom_loaded()}))}null!=o&&o.addEventListener?"complete"===o.readyState?e():ir(o,"DOMContentLoaded",e,{capture:!1}):s&&tl.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),nq)}}]);
2//# sourceMappingURL=80ec7963-7db35de988d8575d.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.