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