UNPKG

@deriv-com/analytics

Version:

Comprehensive analytics package for Deriv applications. Provides unified event tracking, A/B testing, and user analytics through RudderStack, PostHog and GrowthBook integrations with built-in caching and offline support.

2 lines 196 kB
/* @deriv-com/analytics - Browser ESM Bundle (RudderStack + PostHog) - Built with tsup */ import{d as Ar,e as Lr,f as Dr,g as Nr,h as qr}from"./chunk-F3U33XPR.mjs";var p=typeof window<"u"?window:void 0,Z=typeof globalThis<"u"?globalThis:p;typeof self>"u"&&(Z.self=Z),typeof File>"u"&&(Z.File=function(){});var de=Z?.navigator,b=Z?.document,ee=Z?.location,ns=Z?.fetch,os=Z!=null&&Z.XMLHttpRequest&&"withCredentials"in new Z.XMLHttpRequest?Z.XMLHttpRequest:void 0,Ur=Z?.AbortController,Zo=Z?.CompressionStream,ue=de?.userAgent,R=p??{},jr="1.372.9",ae={DEBUG:!1,LIB_VERSION:jr,LIB_NAME:"web",JS_SDK_VERSION:jr};function Hr(i,e,t,s,r,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(s,r)}function _e(i){return function(){var e=this,t=arguments;return new Promise((function(s,r){var n=i.apply(e,t);function o(l){Hr(n,s,r,o,a,"next",l)}function a(l){Hr(n,s,r,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 s in t)({}).hasOwnProperty.call(t,s)&&(i[s]=t[s])}return i},m.apply(null,arguments)}function Ln(i,e){if(i==null)return{};var t={};for(var s in i)if({}.hasOwnProperty.call(i,s)){if(e.indexOf(s)!==-1)continue;t[s]=i[s]}return t}function as(){return as=_e((function*(i,e,t){e===void 0&&(e=!0);try{var s=new CompressionStream("gzip"),r=s.writable.getWriter(),n=r.write(new TextEncoder().encode(i)).then((()=>r.close())).catch((function(){var l=_e((function*(c){try{yield r.abort(c)}catch{}throw c}));return function(c){return l.apply(this,arguments)}})()),o=new Response(s.readable).blob(),[a]=yield Promise.all([o,n]);return a}catch(l){if(t!=null&&t.rethrow)throw l;return e&&console.error("Failed to gzip compress data",l),null}})),as.apply(this,arguments)}var Qo=["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"],zr=function(i,e){if(e===void 0&&(e=[]),!i)return!1;var t=i.toLowerCase();return Qo.concat(e).some((s=>{var r=s.toLowerCase();return t.indexOf(r)!==-1}))},ea=["$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"];function D(i,e){return i.indexOf(e)!==-1}var Oi=function(i){return i.trim()},ls=function(i){return i.replace(/^\$/,"")},Dn=Object.prototype,Nn=Dn.hasOwnProperty,Ci=Dn.toString,q=Array.isArray||function(i){return Ci.call(i)==="[object Array]"},Oe=i=>typeof i=="function",Y=i=>i===Object(i)&&!q(i),lt=i=>{if(Y(i)){for(var e in i)if(Nn.call(i,e))return!1;return!0}return!1},E=i=>i===void 0,B=i=>Ci.call(i)=="[object String]",ti=i=>B(i)&&i.trim().length===0,Ae=i=>i===null,N=i=>E(i)||Ae(i),me=i=>Ci.call(i)=="[object Number]"&&i==i,rt=i=>me(i)&&i>0,Pe=i=>Ci.call(i)==="[object Boolean]",ta=i=>i instanceof FormData,ia=i=>D(ea,i);function qn(i){return i===null||typeof i!="object"}function oi(i,e){return{}.toString.call(i)==="[object "+e+"]"}function mr(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"],Ni=i=>D(sa,i),ra=[!1,"false",0,"0","no"];function Fe(i,e,t,s,r){return e>t&&(s.warn("min cannot be greater than max."),e=t),me(i)?i>t?(s.warn(" cannot be greater than max: "+t+". Using max value instead."),t):e>i?(s.warn(" cannot be less than min: "+e+". Using min value instead."),e):i:(s.warn(" must be a number. using max or fallback. max: "+t+", fallback: "+r),Fe(r||t,e,t,s))}var us=class{constructor(e){this.$t={},this.zt=e.zt,this.Zt=Fe(e.bucketSize,0,100,e.Gt),this.Qt=Fe(e.refillRate,0,this.Zt,e.Gt),this.Jt=Fe(e.refillInterval,0,864e5,e.Gt)}Kt(e,t){var s=Math.floor((t-e.lastAccess)/this.Jt);s>0&&(e.tokens=Math.min(e.tokens+s*this.Qt,this.Zt),e.lastAccess=e.lastAccess+s*this.Jt)}consumeRateLimit(e){var t,s=Date.now(),r=String(e),n=this.$t[r];return n?this.Kt(n,s):this.$t[r]=n={tokens:this.Zt,lastAccess:s},n.tokens===0||(n.tokens--,n.tokens===0&&((t=this.zt)==null||t.call(this,e)),n.tokens===0)}stop(){this.$t={}}},Gt,Vr,qi,pe="Mobile",ai="iOS",Me="Android",pt="Tablet",Un=Me+" "+pt,jn="iPad",Hn="Apple",zn=Hn+" Watch",Ct="Safari",gt="BlackBerry",Vn="Samsung",Bn=Vn+"Browser",Wn=Vn+" Internet",Xe="Chrome",na=Xe+" OS",Gn=Xe+" "+ai,yr="Internet Explorer",Yn=yr+" "+pe,br="Opera",oa=br+" Mini",wr="Edge",Xn="Microsoft "+wr,ht="Firefox",Kn=ht+" "+ai,qt="Nintendo",Ut="PlayStation",dt="Xbox",Jn=Me+" "+pe,Zn=pe+" "+Ct,Pt="Windows",cs=Pt+" Phone",Br="Nokia",hs="Ouya",Qn="Generic",aa=Qn+" "+pe.toLowerCase(),eo=Qn+" "+pt.toLowerCase(),ds="Konqueror",oe="(\\d+(\\.\\d+)?)",Ui=new RegExp("Version/"+oe),la=new RegExp(dt,"i"),ua=new RegExp(Ut+" \\w+","i"),ca=new RegExp(qt+" \\w+","i"),Er=new RegExp(gt+"|PlayBook|BB10","i"),ha={"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"},to=function(i,e){return e=e||"",D(i," OPR/")&&D(i,"Mini")?oa:D(i," OPR/")?br:Er.test(i)?gt:D(i,"IE"+pe)||D(i,"WPDesktop")?Yn:D(i,Bn)?Wn:D(i,wr)||D(i,"Edg/")?Xn:D(i,"FBIOS")?"Facebook "+pe:D(i,"UCWEB")||D(i,"UCBrowser")?"UC Browser":D(i,"CriOS")?Gn:D(i,"CrMo")||D(i,Xe)?Xe:D(i,Me)&&D(i,Ct)?Jn:D(i,"FxiOS")?Kn:D(i.toLowerCase(),ds.toLowerCase())?ds:((t,s)=>s&&D(s,Hn)||(function(r){return D(r,Ct)&&!D(r,Xe)&&!D(r,Me)})(t))(i,e)?D(i,pe)?Zn:Ct:D(i,ht)?ht:D(i,"MSIE")||D(i,"Trident/")?yr:D(i,"Gecko")?ht:""},da={[Yn]:[new RegExp("rv:"+oe)],[Xn]:[new RegExp(wr+"?\\/"+oe)],[Xe]:[new RegExp("("+Xe+"|CrMo)\\/"+oe)],[Gn]:[new RegExp("CriOS\\/"+oe)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+oe)],[Ct]:[Ui],[Zn]:[Ui],[br]:[new RegExp("(Opera|OPR)\\/"+oe)],[ht]:[new RegExp(ht+"\\/"+oe)],[Kn]:[new RegExp("FxiOS\\/"+oe)],[ds]:[new RegExp("Konqueror[:/]?"+oe,"i")],[gt]:[new RegExp(gt+" "+oe),Ui],[Jn]:[new RegExp("android\\s"+oe,"i")],[Wn]:[new RegExp(Bn+"\\/"+oe)],[yr]:[new RegExp("(rv:|MSIE )"+oe)],Mozilla:[new RegExp("rv:"+oe)]},pa=function(i,e){var t=to(i,e),s=da[t];if(E(s))return null;for(var r=0;s.length>r;r++){var n=i.match(s[r]);if(n)return parseFloat(n[n.length-2])}return null},Wr=[[new RegExp(dt+"; "+dt+" (.*?)[);]","i"),i=>[dt,i&&i[1]||""]],[new RegExp(qt,"i"),[qt,""]],[new RegExp(Ut,"i"),[Ut,""]],[Er,[gt,""]],[new RegExp(Pt,"i"),(i,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[cs,""];if(new RegExp(pe).test(e)&&!/IEMobile\b/.test(e))return[Pt+" "+pe,""];var t=/Windows NT ([0-9.]+)/i.exec(e);if(t&&t[1]){var s=ha[t[1]]||"";return/arm/i.test(e)&&(s="RT"),[Pt,s]}return[Pt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,i=>i&&i[3]?[ai,[i[3],i[4],i[5]||"0"].join(".")]:[ai,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,i=>{var e="";return i&&i.length>=3&&(e=E(i[2])?i[3]:i[2]),["watchOS",e]}],[new RegExp("("+Me+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Me+")","i"),i=>i&&i[2]?[Me,[i[2],i[3],i[4]||"0"].join(".")]:[Me,""]],[/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/,[na,""]],[/Linux|debian/i,["Linux",""]]],Gr=function(i){return ca.test(i)?qt:ua.test(i)?Ut:la.test(i)?dt:new RegExp(hs,"i").test(i)?hs:new RegExp("("+cs+"|WPDesktop)","i").test(i)?cs:/iPad/.test(i)?jn:/iPod/.test(i)?"iPod Touch":/iPhone/.test(i)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(i)?zn:Er.test(i)?gt:/(kobo)\s(ereader|touch)/i.test(i)?"Kobo":new RegExp(Br,"i").test(i)?Br:/(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(pe).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)?Me:Un:new RegExp("(pda|"+pe+")","i").test(i)?aa:new RegExp(pt,"i").test(i)&&!new RegExp(pt+" pc","i").test(i)?eo:""},ga=i=>i instanceof Error,io={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}},va=io.info;function so(i){if(Pe(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(q(i))return{arrayValue:{values:i.map((e=>so(e)))}};try{return{stringValue:JSON.stringify(i)}}catch{return{stringValue:String(i)}}}function Yr(i){var e=[];for(var t in i){var s=i[t];Ae(s)||E(s)||e.push({key:t,value:so(s)})}return e}function _a(i){var e=globalThis._posthogChunkIds;if(e){var t=Object.keys(e);return qi&&t.length===Vr||(Vr=t.length,qi=t.reduce(((s,r)=>{Gt||(Gt={});var n=Gt[r];if(n)s[n[0]]=n[1];else for(var o=i(r),a=o.length-1;a>=0;a--){var l=o[a],c=l?.filename,u=e[r];if(c&&u){s[c]=u,Gt[r]=[c,u];break}}return s}),{})),qi}}var ps=class{constructor(e,t,s){s===void 0&&(s=[]),this.coercers=e,this.stackParser=t,this.modifiers=s}buildFromUnknown(e,t){t===void 0&&(t={});var s=t&&t.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(s,t,0).apply(e),n=this.buildParsingContext(t),o=this.parseStacktrace(r,n);return{$exception_list:this.convertToExceptionList(o,s),$exception_level:"error"}}modifyFrames(e){var t=this;return _e((function*(){for(var s of e)s.stacktrace&&s.stacktrace.frames&&q(s.stacktrace.frames)&&(s.stacktrace.frames=yield t.applyModifiers(s.stacktrace.frames));return e}))()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:(t=e.syntheticException)==null?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var s,r;return e.cause!=null&&(s=this.parseStacktrace(e.cause,t)),e.stack!=""&&e.stack!=null&&(r=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),m({},e,{cause:s,stack:r})}applyChunkIds(e,t){return e.map((s=>(s.filename&&t&&(s.chunk_id=t[s.filename]),s)))}applyCoercers(e,t){for(var s of this.coercers)if(s.match(e))return s.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return _e((function*(){var s=e;for(var r of t.modifiers)s=yield r(s);return s}))()}convertToExceptionList(e,t){var s,r,n,o={type:e.type,value:e.value,mechanism:{type:(s=t.type)!==null&&s!==void 0?s:"generic",handled:(r=t.handled)===null||r===void 0||r,synthetic:(n=e.synthetic)!==null&&n!==void 0&&n}};e.stack&&(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:_a(this.stackParser),skipFirstLines:(t=e.skipFirstLines)!==null&&t!==void 0?t:1}}buildCoercingContext(e,t,s){s===void 0&&(s=0);var r=(n,o)=>{if(4>=o){var a=this.buildCoercingContext(e,t,o);return this.applyCoercers(n,a)}};return m({},t,{syntheticException:s==0?t.syntheticException:void 0,mechanism:e,apply:n=>r(n,s),next:n=>r(n,s+1)})}},vt="?";function gs(i,e,t,s,r){var n={platform:i,filename:e,function:t==="<anonymous>"?vt:t,in_app:!0};return E(s)||(n.lineno=s),E(r)||(n.colno=r),n}var ro=(i,e)=>{var t=i.indexOf("safari-extension")!==-1,s=i.indexOf("safari-web-extension")!==-1;return t||s?[i.indexOf("@")!==-1?i.split("@")[0]:vt,t?"safari-extension:"+e:"safari-web-extension:"+e]:[i,e]},fa=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,ma=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,ya=/\((\S*)(?::(\d+))(?::(\d+))\)/,ba=(i,e)=>{var t=fa.exec(i);if(t){var[,s,r,n]=t;return gs(e,s,vt,+r,+n)}var o=ma.exec(i);if(o){if(o[2]&&o[2].indexOf("eval")===0){var a=ya.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,c]=ro(o[1]||vt,o[2]);return gs(e,c,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},wa=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Ea=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,xa=(i,e)=>{var t=wa.exec(i);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var s=Ea.exec(t[3]);s&&(t[1]=t[1]||"eval",t[3]=s[1],t[4]=s[2],t[5]="")}var r=t[3],n=t[1]||vt;return[n,r]=ro(n,r),gs(e,r,n,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},Xr=/\(error: (.*)\)/,vs=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var s=B(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:s?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?t+": "+e.message:t}isDOMException(e){return oi(e,"DOMException")}isDOMError(e){return oi(e,"DOMError")}},_s=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 s=e.message;return String(s.error&&typeof s.error.message=="string"?s.error.message:s)}getStack(e){return e.stacktrace||e.stack||void 0}},fs=class{constructor(){}match(e){return oi(e,"ErrorEvent")&&e.error!=null}coerce(e,t){var s;return t.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:(s=t.syntheticException)==null?void 0:s.stack,synthetic:!0}}},ka=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,ms=class{match(e){return typeof e=="string"}coerce(e,t){var s,[r,n]=this.getInfos(e);return{type:r??"Error",value:n??e,stack:(s=t.syntheticException)==null?void 0:s.stack,synthetic:!0}}getInfos(e){var t="Error",s=e,r=e.match(ka);return r&&(t=r[1],s=r[2]),[t,s]}},Sa=["fatal","error","warning","log","info","debug"];function no(i,e){e===void 0&&(e=40);var t=Object.keys(i);if(t.sort(),!t.length)return"[object has no keys]";for(var s=t.length;s>0;s--){var r=t.slice(0,s).join(", ");if(e>=r.length)return s===t.length?r:r.length>e?r.slice(0,e)+"...":r}return""}var ys=class{match(e){return typeof e=="object"&&e!==null}coerce(e,t){var s,r=this.getErrorPropertyFromObject(e);return r?t.apply(r):{type:this.getType(e),value:this.getValue(e),stack:(s=t.syntheticException)==null?void 0:s.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return mr(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){var t="'"+e.name+"' captured as exception";return"message"in e&&typeof e.message=="string"&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&typeof e.message=="string")return e.message;var s=this.getObjectClassName(e);return(s&&s!=="Object"?"'"+s+"'":"Object")+" captured as exception with keys: "+no(e)}isSeverityLevel(e){return B(e)&&!ti(e)&&Sa.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if({}.hasOwnProperty.call(e,t)){var s=e[t];if(ga(s))return s}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},bs=class{match(e){return mr(e)}coerce(e,t){var s,r=e.constructor.name;return{type:r,value:r+" captured as exception with keys: "+no(e),stack:(s=t.syntheticException)==null?void 0:s.stack,synthetic:!0}}},ws=class{match(e){return qn(e)}coerce(e,t){var s;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(s=t.syntheticException)==null?void 0:s.stack,synthetic:!0}}},Es=class{match(e){return oi(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!mr(e))return!1;try{var t=e.detail;return t!=null&&typeof t=="object"&&"reason"in t}catch{return!1}}coerce(e,t){var s,r=this.getUnhandledRejectionReason(e);return qn(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:(s=t.syntheticException)==null?void 0:s.stack,synthetic:!0}:t.apply(r)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&e.detail!=null&&typeof e.detail=="object"&&"reason"in e.detail)return e.detail.reason}catch{}return e}},li="$message",ui="$timestamp",Pa=new Set([li,ui]),ji={enabled:!0,max_bytes:32768};function ci(i){var e;return i?{enabled:(e=i.enabled)!==null&&e!==void 0?e:ji.enabled,max_bytes:Fa(i.max_bytes,ji.max_bytes)}:m({},ji)}var xs=class{constructor(e){this.Yt=[],this.Xt=0,this.qt=ci(e)}setConfig(e){this.qt=ci(e),this.er()}add(e){var t=(function(r){var n=(function(u){var h=new WeakSet;try{return JSON.stringify(u,((d,g)=>{if(typeof g=="bigint")return g.toString();if(typeof g!="function"&&typeof g!="symbol"){if(g instanceof Date)return g.toISOString();if(g instanceof Error)return{name:g.name,message:g.message,stack:g.stack};if(g&&typeof g=="object"){if(h.has(g))return"[Circular]";h.add(g)}return g}}))}catch{return}})(r);if(n)try{var o=JSON.parse(n);if(!Y(o))return;var a=o,l=a[li],c=a[ui];return!B(l)||l.trim().length===0||!B(c)&&!me(c)?void 0:{step:a,json:n}}catch{return}})(e);if(t){var s=(function(r){if(typeof TextEncoder<"u")return new TextEncoder().encode(r).length;for(var n=encodeURIComponent(r),o=0,a=0;n.length>a;a++)n[a]==="%"?(o+=1,a+=2):o+=1;return o})(t.json);s>this.qt.max_bytes||(this.Yt.push({step:t.step,bytes:s}),this.Xt+=s,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 Fa(i,e){if(!me(i)||i===1/0||i===-1/0)return e;var t=Math.floor(i);return 0>t?e:t}var oo=function(i,e){var{debugEnabled:t}=e===void 0?{}:e,s={k(r){if(p&&(ae.DEBUG||R.POSTHOG_DEBUG||t)&&!E(p.console)&&p.console){for(var n=("__rrweb_original__"in p.console[r])?p.console[r].__rrweb_original__:p.console[r],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 r=arguments.length,n=new Array(r),o=0;r>o;o++)n[o]=arguments[o];s.k("debug",...n)},info(){for(var r=arguments.length,n=new Array(r),o=0;r>o;o++)n[o]=arguments[o];s.k("log",...n)},warn(){for(var r=arguments.length,n=new Array(r),o=0;r>o;o++)n[o]=arguments[o];s.k("warn",...n)},error(){for(var r=arguments.length,n=new Array(r),o=0;r>o;o++)n[o]=arguments[o];s.k("error",...n)},critical(){for(var r=arguments.length,n=new Array(r),o=0;r>o;o++)n[o]=arguments[o];console.error(i,...n)},uninitializedWarning(r){s.error("You must initialize PostHog before calling "+r)},createLogger:(r,n)=>oo(i+" "+r,n)};return s},w=oo("[PostHog.js]"),z=w.createLogger,Ra=z("[ExternalScriptsLoader]"),Hi=(i,e,t)=>{if(i.config.disable_external_dependency_loading)return Ra.warn(e+" was requested but loading of external scripts is disabled."),t("Loading of external scripts is disabled");var s=b?.querySelectorAll("script");if(s){for(var r,n=function(){if(s[o].src===e){var l=s[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;s.length>o;o++)if(r=n())return r.v}var a=()=>{if(!b)return t("document not found");var l=b.createElement("script");if(l.type="text/javascript",l.crossOrigin="anonymous",l.src=e,l.onload=h=>{l.__posthog_loading_callback_fired=!0,t(void 0,h)},l.onerror=h=>t(h),i.config.prepare_external_dependency_script&&(l=i.config.prepare_external_dependency_script(l)),!l)return t("prepare_external_dependency_script returned null");if(i.config.external_scripts_inject_target==="head")b.head.appendChild(l);else{var c,u=b.querySelectorAll("body > script");u.length>0?(c=u[0].parentNode)==null||c.insertBefore(l,u[0]):b.body.appendChild(l)}};b!=null&&b.body?a():b?.addEventListener("DOMContentLoaded",a)};R.__PosthogExtensions__=R.__PosthogExtensions__||{},R.__PosthogExtensions__.loadExternalDependency=(i,e,t)=>{if(e!=="remote-config"){var s;if(i.config.__preview_external_dependency_versioned_paths)s=i.requestRouter.endpointFor("assets","/static/"+i.version+"/"+e+".js");else{var r="/static/"+e+".js?v="+i.version;if(e==="toolbar"){var n=3e5;r=r+"&t="+Math.floor(Date.now()/n)*n}s=i.requestRouter.endpointFor("assets",r)}Hi(i,s,t)}else{var o=i.requestRouter.endpointFor("assets","/array/"+i.config.token+"/config.js");Hi(i,o,t)}},R.__PosthogExtensions__.loadSiteApp=(i,e,t)=>{var s=i.requestRouter.endpointFor("api",e);Hi(i,s,t)};var ao="$people_distinct_id",hi="$device_id",Ft="__alias",Rt="__timers",ks="$autocapture_disabled_server_side",Ss="$heatmaps_enabled_server_side",Ps="$exception_capture_enabled_server_side",Fs="$error_tracking_suppression_rules",Rs="$error_tracking_capture_extension_exceptions",$s="$web_vitals_enabled_server_side",xr="$dead_clicks_enabled_server_side",Ts="$product_tours_enabled_server_side",Is="$web_vitals_allowed_metrics",$t="$session_recording_remote_config",lo="$replay_override_sampling",uo="$replay_override_linked_flag",co="$replay_override_url_trigger",ho="$replay_override_event_trigger",di="$sesid",kr="$session_is_sampled",ut="$enabled_feature_flags",ii="$active_feature_flags",Tt="$early_access_features",Os="$feature_flag_details",Cs="$feature_flag_payloads",Ms="$feature_flag_request_id",Ie="$override_feature_flags",nt="$override_feature_flag_payloads",It="$stored_person_properties",Ge="$stored_group_properties",As="$surveys",Ls="$surveys_activated",si="ph_product_tours",Mt="$flag_call_reported",Ds="$flag_call_reported_session_id",Ns="$feature_flag_errors",pi="$feature_flag_evaluated_at",Ee="$user_state",qs="$client_session_props",Us="$capture_rate_limit",js="$initial_campaign_params",Hs="$initial_referrer_info",gi="$initial_person_info",vi="$epp",po="__POSTHOG_TOOLBAR__",Yt="$posthog_cookieless",go="$sdk_debug_extensions_init_method",vo="$sdk_debug_extensions_init_time_ms",_o="$sdk_debug_recording_script_not_loaded",Sr="PostHog loadExternalDependency extension not found.",Ye="on_reject",Ce="always",et="anonymous",tt="identified",zs="identified_only",_i="visibilitychange",fi="beforeunload",ot="$pageview",zi="$pageleave",Vi="$identify",Kr="$groupidentify";function Xt(i,e){q(i)&&i.forEach(e)}function H(i,e){if(!N(i))if(q(i))i.forEach(e);else if(ta(i))i.forEach(((s,r)=>e(s,r)));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),s=1;e>s;s++)t[s-1]=arguments[s];for(var r of t)for(var n in r)r[n]!==void 0&&(i[n]=r[n]);return i};function ri(i){for(var e=Object.keys(i),t=e.length,s=new Array(t);t--;)s[t]=[e[t],i[e[t]]];return s}var Jr=function(i){try{return i()}catch{return}},$a=function(i){return function(){try{for(var e=arguments.length,t=new Array(e),s=0;e>s;s++)t[s]=arguments[s];return i.apply(this,t)}catch(r){w.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),w.critical(r)}}},Pr=function(i){var e={};return H(i,(function(t,s){(B(t)&&t.length>0||me(t))&&(e[s]=t)})),e},Ta=["herokuapp.com","vercel.app","netlify.app"];function Ia(i){var e=i?.hostname;if(!B(e))return!1;var t=e.split(".").slice(-2).join(".");for(var s of Ta)if(t===s)return!1;return!0}function K(i,e,t,s){var{capture:r=!1,passive:n=!0}=s??{};i?.addEventListener(e,t,{capture:r,passive:n})}function fo(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 me(i)&&isFinite(i)&&Math.floor(i)===i});var Vs=class i{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,s,r){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(s)||!Number.isInteger(r)||0>e||0>t||0>s||0>r||e>0xffffffffffff||t>4095||s>1073741823||r>4294967295)throw new RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=e/Math.pow(2,40),n[1]=e/Math.pow(2,32),n[2]=e/Math.pow(2,24),n[3]=e/Math.pow(2,16),n[4]=e/Math.pow(2,8),n[5]=e,n[6]=112|t>>>8,n[7]=t,n[8]=128|s>>>24,n[9]=s>>>16,n[10]=s>>>8,n[11]=s,n[12]=r>>>24,n[13]=r>>>16,n[14]=r>>>8,n[15]=r,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 s=this.bytes[t]-e.bytes[t];if(s!==0)return Math.sign(s)}return 0}},Bs=class{constructor(){this.S=0,this.C=0,this.I=new Ws}generate(){var e=this.generateOrAbort();if(E(e)){this.S=0;var t=this.generateOrAbort();if(E(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this.S)this.S=e,this.T();else{if(this.S>=e+1e4)return;this.C++,this.C>4398046511103&&(this.S++,this.T())}return Vs.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())}},Zr,mo=i=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;i.length>e;e++)i[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return i};p&&!E(p.crypto)&&crypto.getRandomValues&&(mo=i=>crypto.getRandomValues(i));var Ws=class{constructor(){this.M=new Uint32Array(8),this.O=1/0}nextUint32(){return this.M.length>this.O||(mo(this.M),this.O=0),this.M[this.O++]}},je=()=>Oa().toString(),Oa=()=>(Zr||(Zr=new Bs)).generate(),mt="",Ca=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,Se={R:()=>!!b,D(i){w.error("cookieStore error: "+i)},A(i){if(b){try{for(var e=i+"=",t=b.cookie.split(";").filter((n=>n.length)),s=0;t.length>s;s++){for(var r=t[s];r.charAt(0)==" ";)r=r.substring(1,r.length);if(r.indexOf(e)===0)return decodeURIComponent(r.substring(e.length,r.length))}}catch{}return null}},F(i){var e;try{e=JSON.parse(Se.A(i))||{}}catch{}return e},N(i,e,t,s,r){if(b)try{var n="",o="",a=(function(u,h){if(h){var d=(function(v,_){if(_===void 0&&(_=b),mt)return mt;if(!_||["localhost","127.0.0.1"].includes(v))return"";for(var $=v.split("."),S=Math.min($.length,8),O="dmn_chk_"+je();!mt&&S--;){var F=$.slice(S).join("."),T=O+"=1;domain=."+F+";path=/";_.cookie=T+";max-age=3",_.cookie.includes(O)&&(_.cookie=T+";max-age=0",mt=F)}return mt})(u);if(!d){var g=(v=>{var _=v.match(Ca);return _?_[0]:""})(u);g!==d&&w.info("Warning: cookie subdomain discovery mismatch",g,d),d=g}return d?"; domain=."+d:""}return""})(b.location.hostname,s);if(t){var l=new Date;l.setTime(l.getTime()+864e5*t),n="; expires="+l.toUTCString()}r&&(o="; secure");var c=i+"="+encodeURIComponent(JSON.stringify(e))+n+"; SameSite=Lax; path=/"+a+o;return c.length>3686.4&&w.warn("cookieStore warning: large cookie, len="+c.length),b.cookie=c,c}catch{return}},q(i,e){if(b!=null&&b.cookie)try{Se.N(i,"",-1,e)}catch{return}}},Bi=null,V={R(){if(!Ae(Bi))return Bi;var i=!0;if(E(p))i=!1;else try{var e="__mplssupport__";V.N(e,"xyz"),V.A(e)!=='"xyz"'&&(i=!1),V.q(e)}catch{i=!1}return i||w.error("localStorage unsupported; falling back to cookie store"),Bi=i,i},D(i){w.error("localStorage error: "+i)},A(i){try{return p?.localStorage.getItem(i)}catch(e){V.D(e)}return null},F(i){try{return JSON.parse(V.A(i))||{}}catch{}return null},N(i,e){try{p?.localStorage.setItem(i,JSON.stringify(e))}catch(t){V.D(t)}},q(i){try{p?.localStorage.removeItem(i)}catch(e){V.D(e)}}},Ma=[hi,"distinct_id",di,kr,vi,gi,Ee],Kt={},Aa={R:()=>!0,D(i){w.error("memoryStorage error: "+i)},A:i=>Kt[i]||null,F:i=>Kt[i]||null,N(i,e){Kt[i]=e},q(i){delete Kt[i]}},ze=null,te={R(){if(!Ae(ze))return ze;if(ze=!0,E(p))ze=!1;else try{var i="__support__";te.N(i,"xyz"),te.A(i)!=='"xyz"'&&(ze=!1),te.q(i)}catch{ze=!1}return ze},D(i){w.error("sessionStorage error: ",i)},A(i){try{return p?.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{p?.sessionStorage.setItem(i,JSON.stringify(e))}catch(t){te.D(t)}},q(i){try{p?.sessionStorage.removeItem(i)}catch(e){te.D(e)}}},Gs=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===Ce||this.isRejected()||this.consent===-1&&this.qt.cookieless_mode===Ye}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:s}=this._instance.config;return s||(t?t+e:"__ph_opt_in_out_"+e)}get ir(){var e=this.nr.A(this.sr);return Ni(e)?1:D(ra,e)?0:-1}get nr(){var e=this.qt.opt_out_capturing_persistence_type,t=e==="localStorage"?V:Se;if(!this.ar||this.ar!==t){this.ar=t;var s=e==="localStorage"?Se:V;s.A(this.sr)&&(this.ar.A(this.sr)||this.optInOut(Ni(s.A(this.sr))),s.q(this.sr,this.qt.cross_subdomain_cookie))}return this.ar}rr(){return!!this.qt.respect_dnt&&[de?.doNotTrack,de?.msDoNotTrack,R.doNotTrack].some((e=>Ni(e)))}},Jt=z("[Dead Clicks]"),La=()=>!0,Da=i=>{var e,t=!((e=i.instance.persistence)==null||!e.get_property(xr)),s=i.instance.config.capture_dead_clicks;return Pe(s)?s:!!Y(s)||t},mi=class{get lazyLoadedDeadClicksAutocapture(){return this.ur}constructor(e,t,s){this.instance=e,this.isEnabled=t,this.onCapture=s,this.startIfEnabledOrStop()}onRemoteConfig(e){"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[xr]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.lr((()=>{this.hr()})):this.stop()}lr(e){var t,s;(t=R.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture&&e(),(s=R.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this.instance,"dead-clicks-autocapture",(r=>{r?Jt.error("failed to load script",r):e()}))}hr(){var e;if(b){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(b),Jt.info("starting...")}}else Jt.error("`document` not found. Cannot start.")}stop(){this.ur&&(this.ur.stop(),this.ur=void 0,Jt.info("stopping..."))}},Wi=z("[SegmentIntegration]"),yo="posthog-js";function bo(i,e){var{organization:t,projectId:s,prefix:r,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 g=i.requestRouter.endpointFor("ui","/project/"+i.config.token+"/person/"+i.get_distinct_id());a.tags["PostHog Person URL"]=g,i.sessionRecordingStarted()&&(a.tags["PostHog Recording URL"]=i.get_session_replay_url({withTimestamp:!0}));var v,_=((l=a.exception)==null?void 0:l.values)||[],$=_.map((O=>m({},O,{stacktrace:O.stacktrace?m({},O.stacktrace,{type:"raw",frames:(O.stacktrace.frames||[]).map((F=>m({},F,{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&&s&&(S.$sentry_url=(r||"https://sentry.io/organizations/")+t+"/issues/?project="+s+"&query="+a.event_id),o&&((v=i.exceptions)==null||v.sendExceptionEvent(S)),a}}var Ys=class{constructor(e,t,s,r,n,o){this.name=yo,this.setupOnce=function(a){a(bo(e,{organization:t,projectId:s,prefix:r,severityAllowList:n,sendExceptionsToPostHog:o==null||o}))}}},yi=class{constructor(e){this.cr=(t,s,r)=>{r&&(r.noSessionId||r.activityTimeout||r.sessionPastMaximumLength)&&(w.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:r}),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 s,r=this.gr(e,t);return this.dr={pathname:(s=p?.location.pathname)!==null&&s!==void 0?s:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),r}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 s=this.dr;if(!s)return{$pageview_id:t};var r={$pageview_id:t,$prev_pageview_id:s.pageViewId},n=this._instance.scrollManager.getContext();if(n&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:o,lastScrollY:a,maxScrollY:l,maxContentHeight:c,lastContentY:u,maxContentY:h}=n;if(!(E(o)||E(a)||E(l)||E(c)||E(u)||E(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?Fe(a/o,0,1,w):1,g=o>1?Fe(l/o,0,1,w):1,v=c>1?Fe(u/c,0,1,w):1,_=c>1?Fe(h/c,0,1,w):1;r=W(r,{$prev_pageview_last_scroll:a,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:l,$prev_pageview_max_scroll_percentage:g,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:v,$prev_pageview_max_content:h,$prev_pageview_max_content_percentage:_})}}return s.pathname&&(r.$prev_pageview_pathname=s.pathname),s.timestamp&&(r.$prev_pageview_duration=(e.getTime()-s.timestamp.getTime())/1e3),r}},Na={[ao]:{exposure:"hidden"},[Ft]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[Rt]:{exposure:"hidden"},[ks]:{exposure:"event"},[Ss]:{exposure:"hidden"},[Ps]:{exposure:"event"},[Fs]:{exposure:"hidden"},[Rs]:{exposure:"event"},[$s]:{exposure:"event"},[xr]:{exposure:"event"},[Ts]:{exposure:"hidden"},[Is]:{exposure:"event"},[$t]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[di]:{exposure:"hidden"},[kr]:{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"},[ut]:{exposure:"derived",shouldSkipFromEventProperties:(i,e)=>e(),transformToEventProperties(i){if(!Y(i))return{};for(var e={},t=Object.keys(i),s=0;t.length>s;s++)e["$feature/"+t[s]]=i[t[s]];return e}},[ii]:{exposure:"event"},[Tt]:{exposure:"hidden"},[Os]:{exposure:"hidden"},[Cs]:{exposure:"event"},[Ms]:{exposure:"event"},[Ie]:{exposure:"event"},[nt]:{exposure:"hidden"},[It]:{exposure:"hidden"},[Ge]:{exposure:"hidden"},[As]:{exposure:"hidden"},[Ls]:{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"},[Mt]:{exposure:"hidden"},[Ds]:{exposure:"hidden"},[Ns]:{exposure:"hidden"},[pi]:{exposure:"hidden"},[Ee]:{exposure:"hidden"},[qs]:{exposure:"hidden"},[Us]:{exposure:"hidden"},[js]:{exposure:"hidden"},[Hs]:{exposure:"hidden"},[gi]:{exposure:"hidden"},[vi]:{exposure:"hidden"},[lo]:{exposure:"event"},[uo]:{exposure:"event"},[co]:{exposure:"event"},[ho]:{exposure:"event"},[go]:{exposure:"event"},[vo]:{exposure:"event"},[_o]:{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"}},qa=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],bi=i=>{var e=b?.createElement("a");return E(e)?null:(e.href=i,e)},wi=function(i,e){for(var t,s=((i.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;s.length>r;r++){var n=s[r].split("=");if(n[0]===e){t=n;break}}if(!q(t)||2>t.length)return"";var o=t[1];try{o=decodeURIComponent(o)}catch{w.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 s=i.split("#"),r=s[1],n=(s[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),c=[],u=0;l.length>u;u++){var h=l[u].split("=");q(h)&&(e.includes(h[0])?c.push(h[0]+"="+t):c.push(l[u]))}var d=a;return o!=null&&(d+="?"+c.join("&")),r!=null&&(d+="#"+r),d},Ei=function(i,e){var t=i.match(new RegExp(e+"=([^&]*)"));return t?t[1]:null},Zt="https?://(.*)",_t=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Ua=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",..._t],Ht="<masked>",ja=["li_fat_id"];function wo(i,e,t){if(!b)return{};var s,r=e?[..._t,...t||[]]:[],n=Eo(jt(b.URL,r,Ht),i),o=(s={},H(ja,(function(a){var l=Se.A(a);s[a]=l||null})),s);return W(o,n)}function Eo(i,e){var t=Ua.concat(e||[]),s={};return H(t,(function(r){var n=wi(i,r);s[r]=n||null})),s}function xo(i){var e=(function(n){return n?n.search(Zt+"google.([^/?]*)")===0?"google":n.search(Zt+"bing.com")===0?"bing":n.search(Zt+"yahoo.com")===0?"yahoo":n.search(Zt+"duckduckgo.com")===0?"duckduckgo":null:null})(i),t=e!="yahoo"?"q":"p",s={};if(!Ae(e)){s.$search_engine=e;var r=b?wi(b.referrer,t):"";r.length&&(s.ph_keyword=r)}return s}function Qr(){return navigator.language||navigator.userLanguage}var xi="$direct";function ko(){return b?.referrer||xi}function So(i,e){var t=i?[..._t,...e||[]]:[],s=ee?.href.substring(0,1e3);return{r:ko().substring(0,1e3),u:s?jt(s,t,Ht):void 0}}function Po(i){var e,{r:t,u:s}=i,r={$referrer:t,$referring_domain:t==null?void 0:t==xi?xi:(e=bi(t))==null?void 0:e.host};if(s){r.$current_url=s;var n=bi(s);r.$host=n?.host,r.$pathname=n?.pathname;var o=Eo(s);W(r,o)}if(t){var a=xo(t);W(r,a)}return r}function Fo(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function Ha(){try{return new Date().getTimezoneOffset()}catch{return}}var za=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],At=class{constructor(e,t){this.qt=e,this.props={},this.mr=!1,this.yr=(s=>{var r="";return s.token&&(r=s.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),s.persistence_name?"ph_"+s.persistence_name:"ph_"+r+"_posthog"})(e),this.nr=this.br(e),this.load(),e.debug&&w.info("Persistence loaded",e.persistence,m({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this._r}br(e){za.indexOf(e.persistence.toLowerCase())===-1&&(w.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=(function(r){r===void 0&&(r=[]);var n=[...Ma,...r];return m({},V,{F(o){try{var a={};try{a=Se.F(o)||{}}catch{}var l=W(a,JSON.parse(V.A(o)||"{}"));return V.N(o,l),l}catch{}return null},N(o,a,l,c,u,h){try{V.N(o,a,void 0,void 0,h);var d={};n.forEach((g=>{a[g]&&(d[g]=a[g])})),Object.keys(d).length&&Se.N(o,d,l,c,u,h)}catch(g){V.D(g)}},q(o,a){try{p?.localStorage.removeItem(o),Se.q(o,a)}catch(l){V.D(l)}}})})(e.cookie_persisted_properties||[]),s=e.persistence.toLowerCase();return s==="localstorage"&&V.R()?V:s==="localstorage+cookie"&&t.R()?t:s==="sessionstorage"&&te.R()?te:s==="memory"?Aa:s==="cookie"?Se:t.R()?t:Se}wr(e){var t=e??this.qt.feature_flag_cache_ttl_ms;if(!t||0>=t)return!1;var s=this.props[pi];return!s||typeof s!="number"||Date.now()-s>t}properties(){var e={};return H(this.props,((t,s)=>{var r=(n=>{var o=Na[n];if(o)return o;for(var[a,l]of qa)if(n.indexOf(a)===0)return l})(s);if(r?.exposure==="derived"){if(r.shouldSkipFromEventProperties!=null&&r.shouldSkipFromEventProperties(t,s===ut?()=>this.wr():()=>!1))return;r.transformToEventProperties&&W(e,r.transformToEventProperties(t))}else r&&r.exposure!=="event"||(e[s]=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,s){if(Y(e)){E(t)&&(t="None"),this.Sr=E(s)?this.Ir:s;var r=!1;if(H(e,((n,o)=>{this.props.hasOwnProperty(o)&&this.props[o]!==t||(this.Tr(o,n),r=!0)})),r)return this.save(),!0}return!1}register(e,t){if(Y(e)){this.Sr=E(t)?this.Ir:t;var s=!1;if(H(e,((r,n)=>{e.hasOwnProperty(n)&&this.props[n]!==r&&(this.Tr(n,r),s=!0)})),s)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=wo(this.qt.custom_campaign_params,this.qt.mask_personal_data_properties,this.qt.custom_personal_data_properties);lt(Pr(e))||this.register(e),this.mr=!0}}update_search_keyword(){var e;this.register((e=b?.referrer)?xo(e):{})}update_referrer_info(){var e;this.register_once({$referrer:ko(),$referring_domain:b!=null&&b.referrer&&((e=bi(b.referrer))==null?void 0:e.host)||xi},void 0)}set_initial_person_info(){this.props[js]||this.props[Hs]||this.register_once({[gi]:So(this.qt.mask_personal_data_properties,this.qt.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};H([Hs,js],(o=>{var a=this.props[o];a&&H(a,(function(l,c){e["$initial_"+ls(c)]=l}))}));var t,s,r=this.props[gi];if(r){var n=(t=Po(r),s={},H(t,(function(o,a){s["$initial_"+ls(a)]=o})),s);W(e,n)}return e}safe_merge(e){return H(this.props,(function(t,s){s in e||(e[s]=t)})),e}update_config(e,t,s){if(this.Ir=this.Sr=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!s),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence||!((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 r=this.br(e),n=this.props;this.clear(),this.nr=r,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 s=this.props[Rt]||{};s[e]=t,this.Tr(Rt,s),this.save()}remove_event_timer(e){var t=this.props[Rt]||{},s=t[e];return E(s)||(delete t[e],this.Tr(Rt,t),this.save()),s}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"};var Gi={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"};var Ot={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Yi={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"},Xs={Popover:"popover",Inline:"inline"};var 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"},en={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"},tn=z("[RateLimiter]"),Ks=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var s=t.text;if(s&&s.length)try{(JSON.parse(s).quota_limited||[]).forEach((r=>{tn.info((r||"events")+" is quota limited."),this.serverLimits[r]=new Date().getTime()+6e4}))}catch(r){return void tn.warn('could not rate limit - continuing. Error: "'+r?.message+'"',{text:s})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)==null?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)==null?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var t,s,r;e===void 0&&(e=!1);var{captureEventsBurstLimit:n,captureEventsPerSecond:o}=this,a=new Date().getTime(),l=(t=(s=this.instance.persistence)==null?void 0:s.get_property(Us))!==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,(r=this.instance.persistence)==null||r.set_property(Us,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]"),ki=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,s;(t=R.__PosthogExtensions__)!=null&&t.loadExternalDependency?(s=R.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.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()||b?.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())}};var ke={GZipJS:"gzip-js",Base64:"base64"},fe=Uint8Array,le=Uint16Array,ft=Uint32Array,Fr=new fe([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Rr=new fe([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7