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