PageSourceSearch

https://app.spaitial.ai/assets/posthog-CTdkyuxI-ff0596822183.js

js spaitial.ai collected 2026-09-24 19:10:05 UTC 174,344 bytes, 4 lines download raw bytes

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

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.