@deriv-com/analytics 1.42.1 → 1.43.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.
Files changed (57) hide show
  1. package/dist/browser/analytics.bundle.global.js +7 -6
  2. package/dist/browser/analytics.bundle.global.js.map +1 -1
  3. package/dist/browser/analytics.esm.mjs +1 -1
  4. package/dist/browser/analytics.esm.mjs.map +1 -1
  5. package/dist/chunk-2R54Y2IU.mjs +4 -0
  6. package/dist/chunk-2R54Y2IU.mjs.map +1 -0
  7. package/dist/chunk-34EEFBSP.mjs +5 -0
  8. package/dist/chunk-34EEFBSP.mjs.map +1 -0
  9. package/dist/chunk-MHY63WMT.mjs +9 -0
  10. package/dist/chunk-MHY63WMT.mjs.map +1 -0
  11. package/dist/chunk-TWWU2RKG.js +3 -0
  12. package/dist/chunk-TWWU2RKG.js.map +1 -0
  13. package/dist/chunk-XZPWAV3F.mjs +3 -0
  14. package/dist/chunk-XZPWAV3F.mjs.map +1 -0
  15. package/dist/{chunk-T4BXL6JM.js → chunk-ZAFMAIS7.js} +3 -3
  16. package/dist/chunk-ZAFMAIS7.js.map +1 -0
  17. package/dist/{growthbook-TBZXPHJZ.mjs → growthbook-SXLFY3KI.mjs} +2 -2
  18. package/dist/index.d.mts +5 -3
  19. package/dist/index.d.ts +5 -3
  20. package/dist/index.js +2 -2
  21. package/dist/index.js.map +1 -1
  22. package/dist/index.mjs +2 -2
  23. package/dist/index.mjs.map +1 -1
  24. package/dist/metafile-cjs.json +1 -1
  25. package/dist/metafile-esm.json +1 -1
  26. package/dist/metafile-iife.json +1 -1
  27. package/dist/{posthog-DmVmqDsn.d.ts → posthog-BlpiD6V1.d.mts} +4 -0
  28. package/dist/{posthog-DmVmqDsn.d.mts → posthog-BlpiD6V1.d.ts} +4 -0
  29. package/dist/posthog-LBWKPBQW.mjs +5 -0
  30. package/dist/posthog-LBWKPBQW.mjs.map +1 -0
  31. package/dist/providers/growthbook/index.js +2 -2
  32. package/dist/providers/growthbook/index.mjs +1 -1
  33. package/dist/providers/posthog/index.d.mts +1 -1
  34. package/dist/providers/posthog/index.d.ts +1 -1
  35. package/dist/providers/posthog/index.js +2 -2
  36. package/dist/providers/posthog/index.js.map +1 -1
  37. package/dist/providers/posthog/index.mjs +2 -2
  38. package/dist/providers/posthog/index.mjs.map +1 -1
  39. package/dist/providers/rudderstack/index.d.mts +4 -2
  40. package/dist/providers/rudderstack/index.d.ts +4 -2
  41. package/dist/providers/rudderstack/index.js +1 -1
  42. package/dist/providers/rudderstack/index.mjs +1 -1
  43. package/package.json +16 -15
  44. package/dist/chunk-4V72P52P.mjs +0 -3
  45. package/dist/chunk-4V72P52P.mjs.map +0 -1
  46. package/dist/chunk-6BHMKTVG.js +0 -3
  47. package/dist/chunk-6BHMKTVG.js.map +0 -1
  48. package/dist/chunk-F3U33XPR.mjs +0 -9
  49. package/dist/chunk-F3U33XPR.mjs.map +0 -1
  50. package/dist/chunk-MWNJTXSL.mjs +0 -5
  51. package/dist/chunk-MWNJTXSL.mjs.map +0 -1
  52. package/dist/chunk-T4BXL6JM.js.map +0 -1
  53. package/dist/chunk-TE3DYZVQ.mjs +0 -4
  54. package/dist/chunk-TE3DYZVQ.mjs.map +0 -1
  55. package/dist/posthog-QH4OCJ4V.mjs +0 -4
  56. package/dist/posthog-QH4OCJ4V.mjs.map +0 -1
  57. /package/dist/{growthbook-TBZXPHJZ.mjs.map → growthbook-SXLFY3KI.mjs.map} +0 -0
@@ -0,0 +1,5 @@
1
+ /* @deriv-com/analytics - Browser ESM Bundle (RudderStack + PostHog) - Built with tsup */
2
+ import{a as C}from"./chunk-MHY63WMT.mjs";function P(t){return t!=null&&typeof t=="object"&&t["@@functional/placeholder"]===!0}function Z(t){return function e(n){return arguments.length===0||P(n)?e:t.apply(this,arguments)}}function se(t){return function e(n,s){switch(arguments.length){case 0:return e;case 1:return P(n)?e:Z(function(i){return t(n,i)});default:return P(n)&&P(s)?e:P(n)?Z(function(i){return t(i,s)}):P(s)?Z(function(i){return t(n,i)}):t(n,s)}}}function Kt(t){return function e(n,s,i){switch(arguments.length){case 0:return e;case 1:return P(n)?e:se(function(r,a){return t(n,r,a)});case 2:return P(n)&&P(s)?e:P(n)?se(function(r,a){return t(r,s,a)}):P(s)?se(function(r,a){return t(n,r,a)}):Z(function(r){return t(n,s,r)});default:return P(n)&&P(s)&&P(i)?e:P(n)&&P(s)?se(function(r,a){return t(r,a,i)}):P(n)&&P(i)?se(function(r,a){return t(r,s,a)}):P(s)&&P(i)?se(function(r,a){return t(n,r,a)}):P(n)?Z(function(r){return t(r,s,i)}):P(s)?Z(function(r){return t(n,r,i)}):P(i)?Z(function(r){return t(n,s,r)}):t(n,s,i)}}}function Le(t,e){return Object.prototype.hasOwnProperty.call(e,t)}var Vs=Z(function(e){return e===null?"Null":e===void 0?"Undefined":Object.prototype.toString.call(e).slice(8,-1)});function sn(t){return Object.prototype.toString.call(t)==="[object Object]"}var js=Number.isInteger||function(e){return e<<0===e};function Hs(t,e){var n=t<0?e.length+t:t;return e[n]}function Ks(t){return new RegExp(t.source,t.flags?t.flags:(t.global?"g":"")+(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.sticky?"y":"")+(t.unicode?"u":"")+(t.dotAll?"s":""))}function Fn(t,e,n){if(n||(n=new zs),Ws(t))return t;var s=function(r){var a=n.get(t);if(a)return a;n.set(t,r);for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&(r[l]=Fn(t[l],!0,n));return r};switch(Vs(t)){case"Object":return s(Object.create(Object.getPrototypeOf(t)));case"Array":return s(Array(t.length));case"Date":return new Date(t.valueOf());case"RegExp":return Ks(t);case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"BigInt64Array":case"BigUint64Array":return t.slice();default:return t}}function Ws(t){var e=typeof t;return t==null||e!="object"&&e!="function"}var zs=(function(){function t(){this.map={},this.length=0}return t.prototype.set=function(e,n){var s=this.hash(e),i=this.map[s];i||(this.map[s]=i=[]),i.push([e,n]),this.length+=1},t.prototype.hash=function(e){var n=[];for(var s in e)n.push(Object.prototype.toString.call(e[s]));return n.join()},t.prototype.get=function(e){if(this.length<=180){for(var n in this.map)for(var a=this.map[n],s=0;s<a.length;s+=1){var i=a[s];if(i[0]===e)return i[1]}return}var r=this.hash(e),a=this.map[r];if(a)for(var s=0;s<a.length;s+=1){var i=a[s];if(i[0]===e)return i[1]}},t})(),m=Z(function(e){return e!=null&&typeof e.clone=="function"?e.clone():Fn(e)});function Qs(t,e){for(var n=e,s=0;s<t.length;s+=1){if(n==null)return;var i=t[s];js(i)?n=Hs(i,n):n=n[i]}return n}var Xs=Kt(function(e,n,s){var i={},r;n=n||{},s=s||{};for(r in n)Le(r,n)&&(i[r]=Le(r,s)?e(r,n[r],s[r]):n[r]);for(r in s)Le(r,s)&&!Le(r,i)&&(i[r]=s[r]);return i}),Ys=Kt(function t(e,n,s){return Xs(function(i,r,a){return sn(r)&&sn(a)?t(e,r,a):e(i,r,a)},n,s)}),qs=Kt(function(e,n,s){return Ys(function(i,r,a){return e(r,a)},n,s)}),Js=se(Qs),Vn=se(function(e,n){var s={};for(var i in n)e(n[i],i,n)&&(s[i]=n[i]);return s}),f=t=>typeof t=="function"&&!!(t.constructor&&t.call&&t.apply),O=t=>typeof t=="string",G=t=>t===null,U=t=>typeof t>"u",W=t=>G(t)||U(t),Zs=t=>typeof t=="bigint",A=t=>!U(t),pe=t=>!W(t),ei=t=>pe(t)&&t!=="",Wt=t=>{switch(Object.prototype.toString.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return t instanceof Error}},ti=t=>typeof t=="boolean",ht=(t,e)=>{let n=e.split(".");return Js(n,t)},ni=(t,e)=>!!ht(t,e),si=t=>typeof t=="object",ii=t=>!G(t)&&si(t)&&!Array.isArray(t),R=t=>!G(t)&&Object.prototype.toString.call(t)==="[object Object]",ri=(t,e)=>{if(!Array.isArray(t)||!Array.isArray(e))return m(e);let n=m(t);return e.forEach((s,i)=>{n[i]=Array.isArray(s)||ii(s)?k(n[i],s):s}),n},k=(t,e)=>qs(ri,t,e),te=t=>R(t)&&Object.keys(t).length>0,Te=t=>{let e=Vn(A,t);return Object.keys(e).forEach(n=>{let s=e[n];R(s)&&(e[n]=Te(s))}),e},Ne=t=>{let e=Vn(pe,t);return Object.keys(e).forEach(n=>{let s=e[n];R(s)&&(e[n]=Ne(s))}),e},Y=t=>{if(te(t))return Ne(t)},z=(t,e)=>typeof t=="boolean"?t:e,zt=t=>(Object.getOwnPropertyNames(t).forEach(function(e){t[e]&&typeof t[e]=="object"&&zt(t[e])}),Object.freeze(t)),oi=t=>t.replace(/^\s+|\s+$/gm,""),rn=t=>t.replace(/^\.+/,""),Ke=t=>{let e=t;if(!O(t)&&!W(t))try{e=JSON.stringify(t)}catch{e=null}return e},ai=t=>{let e=Array.from(t,n=>String.fromCodePoint(n)).join("");return globalThis.btoa(e)},li=t=>ai(new TextEncoder().encode(t)),We=(t,e,n,s,i)=>{let r={category:t,name:e,properties:n,options:s,callback:void 0};f(i)&&(r.callback=i),f(s)&&(r.category=t,r.name=e,r.properties=n,r.options=void 0,r.callback=s),f(n)&&(r.category=t,r.name=e,r.properties=void 0,r.options=void 0,r.callback=n),f(e)&&(r.category=t,r.name=void 0,r.properties=void 0,r.options=void 0,r.callback=e),f(t)&&(r.category=void 0,r.name=void 0,r.properties=void 0,r.options=void 0,r.callback=t),R(t)?(r.name=void 0,r.category=void 0,r.properties=t,f(e)?r.options=void 0:r.options=e):R(e)&&(r.name=void 0,r.properties=e,f(n)?r.options=void 0:r.options=n),O(t)&&!O(e)&&(r.category=void 0,r.name=t),A(r.category)||(r.category=void 0),A(r.name)||(r.name=void 0),r.properties=r.properties?m(r.properties):{},A(r.options)?r.options=m(r.options):r.options=void 0;let a=O(r.name)?r.name:r.properties.name,l=O(r.category)?r.category:r.properties.category;return r.properties=k(R(r.properties)?r.properties:{},{...a&&{name:a},...l&&{category:l}}),r},Qt=(t,e,n,s)=>{let i={name:t,properties:e,options:n,callback:void 0};return f(s)&&(i.callback=s),f(n)&&(i.properties=e,i.options=void 0,i.callback=n),f(e)&&(i.properties=void 0,i.options=void 0,i.callback=e),i.properties=pe(i.properties)?m(i.properties):{},A(i.options)?i.options=m(i.options):i.options=void 0,i},jn=(t,e,n,s)=>{let i={userId:t,traits:e,options:n,callback:void 0};return f(s)&&(i.callback=s),f(n)&&(i.userId=t,i.traits=e,i.options=void 0,i.callback=n),f(e)&&(i.userId=t,i.traits=void 0,i.options=void 0,i.callback=e),(R(t)||G(t))&&(i.userId=null,i.traits=t,f(e)?i.options=void 0:i.options=e),i.userId=Ke(i.userId),R(i.traits)?i.traits=m(i.traits):i.traits=void 0,A(i.options)?i.options=m(i.options):i.options=void 0,i},Hn=(t,e,n,s)=>{let i={to:t,from:e,options:n,callback:void 0};return f(s)&&(i.callback=s),f(n)&&(i.to=t,i.from=e,i.options=void 0,i.callback=n),f(e)?(i.to=t,i.from=void 0,i.options=void 0,i.callback=e):(R(e)||G(e))&&(i.to=t,i.from=void 0,i.options=e),A(i.to)&&(i.to=Ke(i.to)),A(i.from)?i.from=Ke(i.from):i.from=void 0,A(i.options)?i.options=m(i.options):i.options=void 0,i},Kn=(t,e,n,s)=>{let i={groupId:t,traits:e,options:n,callback:void 0};return f(s)&&(i.callback=s),f(n)&&(i.groupId=t,i.traits=e,i.options=void 0,i.callback=n),f(e)&&(i.groupId=t,i.traits=void 0,i.options=void 0,i.callback=e),(R(t)||G(t))&&(i.groupId=null,i.traits=t,f(e)?i.options=void 0:i.options=e),i.groupId=Ke(i.groupId),R(i.traits)?i.traits=m(i.traits):i.traits=void 0,A(i.options)?i.options=m(i.options):i.options=void 0,i},rt=(function(t){return t.UNLOADED="Page Unloaded",t})({}),Xt="API",pt="CapabilitiesManager",j="ConfigManager",vt="EventManager",Ie="PluginsManager",oe="UserSessionManager",Ae="ErrorHandler",de="PluginEngine",ci="StoreManager",ot=`Ready${Xt}`,ui=`Load${Xt}`,di="HttpClient",gi="RudderStackAnalytics",we="AnalyticsCore";function fi(t){return crypto.getRandomValues(new Uint8Array(t))}var on=4096,$e=[],ie=0,at;for(;ie<256;ie++)$e[ie]=(ie+256).toString(16).substring(1);function hi(){(!at||ie+16>on)&&(at=fi(on),ie=0);for(var t=0,e,n="";t<16;t++)e=at[ie+t],t==6?n+=$e[e&15|64]:t==8?n+=$e[e&63|128]:n+=$e[e],t&1&&t>1&&t<11&&(n+="-");return ie+=16,n}var ce=256,Be=[],Ue;for(;ce--;)Be[ce]=(ce+256).toString(16).substring(1);function pi(){var t=0,e,n="";if(!Ue||ce+16>256){for(Ue=Array(t=256);t--;)Ue[t]=256*Math.random()|0;t=ce=0}for(;t<16;t++)e=Ue[ce+t],t==6?n+=Be[e&15|64]:t==8?n+=Be[e&63|128]:n+=Be[e],t&1&&t>1&&t<11&&(n+="-");return ce++,n}var vi=()=>!W(globalThis.crypto)&&f(globalThis.crypto.getRandomValues),Ze=()=>vi()?hi():pi(),mi=()=>!!window.chrome?.runtime?.id,yi=()=>O(globalThis.navigator.userAgent)&&/Trident.*rv:11\./.test(globalThis.navigator.userAgent),Ei=(t,e=!1)=>{let n=!1,s=!1;function i(){n||(n=!0,t(s),setTimeout(()=>{n=!1},0))}(e||yi())&&globalThis.addEventListener("beforeunload",()=>{s=!1,i()}),globalThis.addEventListener("blur",()=>{s=!0,i()}),globalThis.addEventListener("focus",()=>{n=!1}),document.addEventListener("pagehide",()=>{s=document.visibilityState==="hidden",i()}),document.addEventListener("visibilitychange",()=>{s=!0,document.visibilityState==="hidden"?i():n=!1})},Wn=t=>t.toISOString(),Si=()=>Wn(new Date),v=":: ",Ii=t=>`A script with the id "${t}" is already loaded. Skipping the loading of this script to prevent conflicts`,an=(t,e,n)=>`Unable to load (${O(n)?n:n.type}) the script with the id "${t}" from URL "${e}"`,bi=(t,e,n)=>`A timeout of ${n} ms occurred while trying to load the script with id "${t}" from URL "${e}"`,Ti=(t,e)=>`${t}${v}A circular reference has been detected in the object and the property "${e}" has been dropped from the output.`,Ai="Failed to convert the value to a JSON string.",ln=(t,e)=>`${t}${v}A bad data (like circular reference, BigInt) has been detected in the object and the property "${e}" has been dropped from the output.`,Ri="Failed to encode the cookie data.",_i=(t,e)=>`${t}${v}The "${e}" storage type is `,Oi="JSONStringify",cn="JSON",Ci="[BigInt]",zn="[Circular Reference]",Ni=(t,e,n)=>{let s=[];return function(i,r){if(!e?.includes(i)&&!(t&&W(r))){if(typeof r!="object"||G(r))return r;for(;s.length>0&&s[s.length-1]!==this;)s.pop();return s.includes(r)?(n?.warn(Ti(Oi,i)),zn):(s.push(r),r)}}},K=(t,e,n,s)=>{try{return JSON.stringify(t,Ni(e,n,s))}catch(i){return s?.warn(Ai,i),null}},Pi=t=>{let e=[];return function(s,i){if(Zs(i))return t?.warn(ln(cn,s)),Ci;for(;e.length>0&&e[e.length-1]!==this;)e.pop();return e.includes(i)?(t?.warn(ln(cn,s)),zn):(e.push(i),i)}},Qn=(t,e)=>{let n=Array.isArray(t)?[]:{};for(let s in t)if(Object.hasOwnProperty.call(t,s)){let i=t[s],r=e.call(t,s,i);R(r)||Array.isArray(r)?n[s]=Qn(r,e):n[s]=r}return n},S=(t,e)=>{let n=Pi(e),s=n.call(t,"",t);return R(t)||Array.isArray(t)?Qn(t,n):s},Xn="[SDK DISPATCHED ERROR]",et=t=>{let{stack:e}=t;if(typeof e=="string"&&e)return e},Yt=(t,e)=>{if(!Wt(t))return new Error(`${e}: ${K(t)}`);try{let n=t.constructor,s=new n(`${e}: ${t.message}`),i=et(t);return i&&(s.stack=i),Object.getOwnPropertyNames(t).forEach(r=>{if(r!=="message"&&r!=="stack"&&r!=="name")try{s[r]=t[r]}catch{}}),s}catch{return new Error(`${e}: ${K(t)}`)}},_=t=>{if(Wt(t)){let e=et(t);e&&(t.stack=`${e}
3
+ ${Xn}`)}globalThis.dispatchEvent(new ErrorEvent("error",{error:t,bubbles:!0,cancelable:!0,composed:!0}))},un="RudderLabs JavaScript SDK",Pe="3.32.0",Di="com.rudderlabs.javascript",Yn="npm",ki="modern",dn="RudderJS-Initiated",Li="ad-block page request",wi="/ad-blocked",_e="preloadedEventsBuffer",Ui="Consent Management Interaction",Mi="ajs_trait_",$i="ajs_prop_",gn="ajs_aid",Bi="ajs_uid",fn="ajs_event",xi=10*1e3,Gi=31536e3*1e3,hn=720*60*1e3,mt=1800*1e3,pn=10*1e3,Fi=10*1e3,Vi=250,qn=(t="app")=>{globalThis.RudderStackGlobals||(globalThis.RudderStackGlobals={}),globalThis.RudderStackGlobals[t]||(globalThis.RudderStackGlobals[t]={})},De=(t,e,n="app")=>{qn(n),globalThis.RudderStackGlobals[n][t]=e},Jn=(t,e="app")=>(qn(e),globalThis.RudderStackGlobals[e][t]);function ji(t,e,n=Vi){let s;return(...i)=>{globalThis.clearTimeout(s),s=globalThis.setTimeout(()=>{t.apply(e,i)},n)}}var vn=(t,e)=>{let n={};return t.forEach((s,i)=>{if(i.startsWith(e)){let r=i.substring(e.length);n[r]=t.get(i)}}),n},Hi=(t=[])=>{let e={trait:Mi,properties:$i},n=new URLSearchParams(globalThis.location.search);n.get(fn)&&t.unshift(["track",n.get(fn),vn(n,e.properties)]);let s=n.get(Bi),i=vn(n,e.trait);if(s||te(i)){let r=[...s?[s]:[],i];t.unshift(["identify",...r])}n.get(gn)&&t.unshift(["setAnonymousId",n.get(gn)])},Ki=t=>{let e="load",n=[],s=0;for(;s<t.length;){if(t[s]&&t[s][0]===e){n=m(t[s]),t.splice(s,1);break}s+=1}return n},Wi=t=>{let e="consent",n=t.filter(i=>i[0]===e),s=t.filter(i=>i[0]!==e);t.splice(0,t.length,...n,...s)},zi=t=>{let e=Jn(_e)||[];Hi(e),e.length>0&&(t.enqueuePreloadBufferEvents(e),De(_e,[]))},Qi=(t,e)=>{let n=t.shift(),s;if(f(e[n])){switch(n){case"page":s=We(...t);break;case"track":s=Qt(...t);break;case"identify":s=jn(...t);break;case"alias":s=Hn(...t);break;case"group":s=Kn(...t);break;default:e[n](...t);break}s&&e[n](s)}},Xi=10*1e3,Yi="RS_JS_SDK",qi=(t,e,n=!0,s=null,i=null,r={})=>{let a=document.createElement("script");return a.type="text/javascript",a.onload=s,a.onerror=i,a.src=t,a.id=e,a.async=n,Object.keys(r).forEach(l=>{a.setAttribute(l,r[l])}),a.setAttribute("data-loader",Yi),a},Ji=t=>{let e=document.getElementsByTagName("head");if(e.length>0){e[0]?.insertBefore(t,e[0]?.firstChild);return}let n=document.getElementsByTagName("script");if(n.length>0&&n[0]?.parentNode){n[0]?.parentNode.insertBefore(t,n[0]);return}let s=document.createElement("head");s.appendChild(t);let i=document.getElementsByTagName("html")[0];i?.insertBefore(s,i.firstChild)},Zi=(t,e,n,s=!0,i)=>new Promise((r,a)=>{document.getElementById(e)&&a(new Error(Ii(e)));try{let u;Ji(qi(t,e,s,()=>{globalThis.clearTimeout(u),r(e)},y=>{globalThis.clearTimeout(u),a(new Error(an(e,t,y)))},i)),u=globalThis.setTimeout(()=>{a(new Error(bi(e,t,n)))},n)}catch(u){a(Yt(u,an(e,t,"unknown")))}}),ze=class{constructor(e,n=Xi){this.logger=e,this.timeout=n}loadJSFile(e){let{url:n,id:s,timeout:i,async:r,callback:a,extraAttributes:l}=e,u=!f(a);Zi(n,s,i||this.timeout,r,l).then(d=>{u||a(d)}).catch(d=>{u||a(s,d)})}},er=Symbol.for("preact-signals");function tt(){if(ee>1)ee--;else{var t,e=!1;for((function(){var i=Xe;for(Xe=void 0;i!==void 0;){var r=i.S;if(r.v===i.v)for(var a=r.t;a!==void 0;a=a.x)a.i===i.i&&(a.i=r.i);i=i.o}})();Ce!==void 0;){var n=Ce;for(Ce=void 0,Qe++;n!==void 0;){var s=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&es(n))try{n.c()}catch(i){e||(t=i,e=!0)}n=s}}if(Qe=0,ee--,e)throw t}}function w(t){if(ee>0)return t();yt=++tr,ee++;try{return t()}finally{tt()}}var Oe,N=void 0;function nt(t){var e=N,n=Oe;N=void 0,Oe=void 0;try{return t()}finally{N=e,Oe=n}}var Ce=void 0,ee=0,Qe=0,tr=0,yt=0,Xe=void 0,Ye=0;function Zn(t){if(N!==void 0){var e=t.n;if(e===void 0||e.t!==N)return e={i:0,S:t,p:N.s,n:void 0,t:N,e:void 0,x:void 0,r:e},N.s!==void 0&&(N.s.n=e),N.s=e,t.n=e,32&N.f&&t.S(e),e;if(e.i===-1)return e.i=0,e.n!==void 0&&(e.n.p=e.p,e.p!==void 0&&(e.p.n=e.n),e.p=N.s,e.n=void 0,N.s.n=e,N.s=e),e}}function M(t,e){this.v=t,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=e?.watched,this.Z=e?.unwatched,this.name=e?.name}M.prototype.brand=er;M.prototype.h=function(){return!0};M.prototype.S=function(t){var e=this,n=this.t;n!==t&&t.e===void 0&&(t.x=n,this.t=t,n!==void 0?n.e=t:nt(function(){var s;(s=e.W)==null||s.call(e)}))};M.prototype.U=function(t){var e=this;if(this.t!==void 0){var n=t.e,s=t.x;n!==void 0&&(n.x=s,t.e=void 0),s!==void 0&&(s.e=n,t.x=void 0),t===this.t&&(this.t=s,s===void 0&&nt(function(){var i;(i=e.Z)==null||i.call(e)}))}};M.prototype.subscribe=function(t){var e=this;return X(function(){var n=e.value;nt(function(){return t(n)})},{name:"sub"})};M.prototype.valueOf=function(){return this.value};M.prototype.toString=function(){return this.value+""};M.prototype.toJSON=function(){return this.value};M.prototype.peek=function(){var t=this;return nt(function(){return t.value})};Object.defineProperty(M.prototype,"value",{get:function(){var t=Zn(this);return t!==void 0&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){if(Qe>100)throw new Error("Cycle detected");(function(n){ee!==0&&Qe===0&&n.l!==yt&&(n.l=yt,Xe={S:n,v:n.v,i:n.i,o:Xe})})(this),this.v=t,this.i++,Ye++,ee++;try{for(var e=this.t;e!==void 0;e=e.x)e.t.N()}finally{tt()}}}});function c(t,e){return new M(t,e)}function es(t){for(var e=t.s;e!==void 0;e=e.n)if(e.S.i!==e.i||!e.S.h()||e.S.i!==e.i)return!0;return!1}function ts(t){for(var e=t.s;e!==void 0;e=e.n){var n=e.S.n;if(n!==void 0&&(e.r=n),e.S.n=e,e.i=-1,e.n===void 0){t.s=e;break}}}function ns(t){for(var e=t.s,n=void 0;e!==void 0;){var s=e.p;e.i===-1?(e.S.U(e),s!==void 0&&(s.n=e.n),e.n!==void 0&&(e.n.p=s)):n=e,e.S.n=e.r,e.r!==void 0&&(e.r=void 0),e=s}t.s=n}function ye(t,e){M.call(this,void 0,e),this.x=t,this.s=void 0,this.g=Ye-1,this.f=4}ye.prototype=new M;ye.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Ye))return!0;if(this.g=Ye,this.f|=1,this.i>0&&!es(this))return this.f&=-2,!0;var t=N;try{ts(this),N=this;var e=this.x();(16&this.f||this.v!==e||this.i===0)&&(this.v=e,this.f&=-17,this.i++)}catch(n){this.v=n,this.f|=16,this.i++}return N=t,ns(this),this.f&=-2,!0};ye.prototype.S=function(t){if(this.t===void 0){this.f|=36;for(var e=this.s;e!==void 0;e=e.n)e.S.S(e)}M.prototype.S.call(this,t)};ye.prototype.U=function(t){if(this.t!==void 0&&(M.prototype.U.call(this,t),this.t===void 0)){this.f&=-33;for(var e=this.s;e!==void 0;e=e.n)e.S.U(e)}};ye.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var t=this.t;t!==void 0;t=t.x)t.t.N()}};Object.defineProperty(ye.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var t=Zn(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}});function ss(t){var e=t.m;if(t.m=void 0,typeof e=="function"){ee++;var n=N;N=void 0;try{e()}catch(s){throw t.f&=-2,t.f|=8,qt(t),s}finally{N=n,tt()}}}function qt(t){for(var e=t.s;e!==void 0;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,ss(t)}function nr(t){if(N!==this)throw new Error("Out-of-order effect");ns(this),N=t,this.f&=-2,8&this.f&&qt(this),tt()}function Ee(t,e){this.x=t,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=e?.name,Oe&&Oe.push(this)}Ee.prototype.c=function(){var t=this.S();try{if(8&this.f||this.x===void 0)return;var e=this.x();typeof e=="function"&&(this.m=e)}finally{t()}};Ee.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,ss(this),ts(this),ee++;var t=N;return N=this,nr.bind(this,t)};Ee.prototype.N=function(){2&this.f||(this.f|=2,this.u=Ce,Ce=this)};Ee.prototype.d=function(){this.f|=8,1&this.f||qt(this)};Ee.prototype.dispose=function(){this.d()};function X(t,e){var n=new Ee(t,e);try{n.c()}catch(i){throw n.d(),i}var s=n.d.bind(n);return s[Symbol.dispose]=s,s}var Et=class{constructor(){this.items=[]}enqueue(e){this.items.push(e)}dequeue(){return this.items.length===0?null:this.items.shift()}isEmpty(){return this.items.length===0}size(){return this.items.length}clear(){this.items=[]}},Me={LOG:0,INFO:1,DEBUG:2,WARN:3,ERROR:4,NONE:5},mn="LOG",is="ERROR",sr="RS SDK",ir="font-weight: bold; background: black; color: white;",rr="font-weight: normal;",St=class{constructor(e=mn,n="",s=console){this.minLogLevel=Me[e],this.scope=n,this.logProvider=s}log(...e){this.outputLog("LOG",e)}info(...e){this.outputLog("INFO",e)}debug(...e){this.outputLog("DEBUG",e)}warn(...e){this.outputLog("WARN",e)}error(...e){this.outputLog("ERROR",e)}outputLog(e,n){this.minLogLevel<=Me[e]&&this.logProvider[e.toLowerCase()]?.(...this.formatLogData(n))}setScope(e){this.scope=e||this.scope}setMinLogLevel(e){this.minLogLevel=Me[e],U(this.minLogLevel)&&(this.minLogLevel=Me[mn])}formatLogData(e){if(Array.isArray(e)&&e.length>0){let n=`%c ${sr}`;this.scope&&(n=`${n} - ${this.scope}`);let s=O(e[0])?e[0].trim():"";n=`${n} %c ${s}`;let i=[n,ir,rr];return O(e[0])||i.push(e[0]),i.push(...e.slice(1)),i}return e}},ne=new St,q=(function(t){return t.HANDLEDEXCEPTION="handledException",t.UNHANDLEDEXCEPTION="unhandledException",t.UNHANDLEDREJECTION="unhandledPromiseRejection",t})({}),rs=["localStorage","memoryStorage","cookieStorage","sessionStorage","none"],It="cookieStorage",yn="Unable to process/parse source configuration response",or="The source is disabled. Please enable the source in the dashboard to send events.",ar="Failed to prepare data for the request.",lr="Failed to invoke plugin because the extension point name is missing.",cr="Failed to invoke plugin because the extension point name is invalid.",ur=t=>`${t}${v}The "getSourceConfig" load API option must be a function that returns valid source configuration data.`,dr=(t,e,n)=>`${t}${v}The base URL "${n}" for ${e} is not valid.`,gr=(t,e,n)=>`${t}${v}The consent manager "${e}" is not supported. Please choose one of the following supported consent managers: "${Object.keys(n)}".`,fr=(t,e)=>`${t}${v}Ignoring a non-error: ${e}.`,En="Failed to log breadcrumb",hr=t=>`${t}${v}Failed to handle the error.`,pr=t=>`${t}${v}Plugin name is missing.`,vr=(t,e)=>`${t}${v}Plugin "${e}" already exists.`,mr=(t,e)=>`${t}${v}Plugin "${e}" not found.`,yr=(t,e)=>`${t}${v}Plugin "${e}" not found in plugins but found in byName. This indicates a bug in the plugin engine. Please report this issue to the development team.`,Er=(t,e,n)=>`${t}${v}Plugin "${e}" could not be loaded because some of its dependencies "${n}" do not exist.`,Sr=(t,e,n)=>`${t}${v}Failed to invoke the "${e}" extension point of plugin "${n}".`,Sn="Failed to fetch the source config",Ir=(t,e)=>`${t}${v}The write key "${e}" is invalid. It must be a non-empty string. Please check that the write key is correct and try again.`,br=(t,e)=>`${t}${v}The data plane URL "${e}" is invalid. It must be a valid URL string. Please check that the data plane URL is correct and try again.`,os=t=>`${t}${v}The provided callback parameter is not a function.`,Tr=(t,e,n,s,i)=>`${t} with status ${e} (${n}) for URL: ${s}. Response: ${i.trim()}`,Ar=(t,e,n)=>`${t} due to timeout or no connection (${e?e.type:""}) at the client side for URL: ${n}`,Rr=(t,e)=>`${t} for URL: ${e}`,_r=t=>`Failed to save the value for "${t}" to storage`,Or=t=>`Failed to retrieve or parse data for "${t}" from storage`,Cr=t=>`The server responded with status ${t} while setting the cookies. As a fallback, the cookies will be set client side.`,Nr=t=>`The server failed to set the ${t} cookie. As a fallback, the cookies will be set client side.`,In="Failed to set/remove cookies via server. As a fallback, the cookies will be managed client side.",Pr=(t,e,n)=>`${t}${v}The storage type "${e}" is not supported. Please choose one of the following supported types: "${rs}". The default type "${n}" will be used instead.`,Dr=(t,e,n,s)=>`${t}${v}The storage encryption version "${e}" is not supported. Please choose one of the following supported versions: "${Object.keys(n)}". The default version "${s}" will be used instead.`,kr=(t,e,n)=>`${t}${v}The storage data migration has been disabled because the configured storage encryption version (${e}) is not the latest (${n}). To enable storage data migration, please update the storage encryption version to the latest version.`,Lr=(t,e,n)=>`${t}${v}The provided cookie domain (${e}) does not match the current webpage's domain (${n}). Hence, the cookies will be set client-side.`,wr=(t,e,n,s)=>`${t}${v}The "${e}" property defined under "${n}" is a reserved keyword. Please choose a different property name to avoid conflicts with reserved keywords (${s}).`,Ur=(t,e)=>`${t}${v}The top-level custom context property "${e}" is reserved and was ignored.`,Mr=t=>`${t}${v}Please make sure that the "context" property in the event API's "options" argument is a valid object literal with key-value pairs.`,xe=t=>`${t}${v}Invalid custom context. Use a plain object without prototype pollution keys.`,$r=t=>`${t}${v}The Beacon API is not supported by your browser. The events will be sent using XHR instead.`,Br=(t,e,n)=>`${t}${v}The session timeout value "${e}" is not a number. The default timeout of ${n} ms will be used instead.`,xr=(t,e,n)=>`${t}${v}The session cut off duration value "${e}" is not a number. The default cut off duration of ${n} ms will be used instead.`,Gr=(t,e,n)=>`${t}${v}The session cut off duration value "${e}" ms is less than the session timeout value "${n}" ms. The cut off functionality will be disabled.`,Fr=t=>`${t}${v}The session timeout value is 0, which disables the automatic session tracking feature. If you want to enable session tracking, please provide a positive integer value for the timeout.`,Vr=(t,e,n)=>`${t}${v}The session timeout value ${e} ms is less than the recommended minimum of ${n} ms. Please consider increasing the timeout value to ensure optimal performance and reliability.`,jr=(t,e,n)=>`${t}${v}The provided session ID (${e}) is either invalid, not a positive integer, or not at least "${n}" digits long. A new session ID will be auto-generated instead.`,Hr=t=>`${t}${v}The storage is either full or unavailable, so the data will not be persisted. Switching to in-memory storage.`,Kr=(t,e,n,s)=>`${t}${v}The storage type "${n}" is not available for entry "${e}". The SDK will initialize the entry with "${s}" storage type instead.`,Wr=t=>`${t}${v}The callback threw an exception`,zr=(t,e)=>`${t}${v}The provided source config URL "${e}" is invalid. Using the default source config URL instead.`,Qr=(t,e)=>`Failed to load the polyfill script with ID "${t}" from URL ${e}.`,Xr=(t,e,n)=>`${t}${v}The pre-consent storage strategy "${e}" is not supported. Please choose one of the following supported strategies: "none, session, anonymousId". The default strategy "${n}" will be used instead.`,Yr=(t,e,n)=>`${t}${v}The pre-consent events delivery type "${e}" is not supported. Please choose one of the following supported types: "immediate, buffer". The default type "${n}" will be used instead.`,qr=(t,e)=>`${t}${v}${e} plugin is deprecated. Please exclude it from the load API options.`,Jr=(t,e,n,s)=>{let i=n.length===1,r=i?` '${n[0]}' plugin was`:` ['${n.join("', '")}'] plugins were`,a=`${t}${v}${e}, but${r} not configured to load.`;return s?`${a} So, ${i?"the plugin":"those plugins"} will be loaded automatically.`:`${a} Ignore if this was intentional. Otherwise, consider adding ${i?"it":"them"} to the 'plugins' load API option.`},Zr=(t,e)=>`${t}${v}The provided polyfill URL "${e}" is invalid. The default polyfill URL will be used instead.`,eo=t=>`${t}${v}Page Unloaded event can only be tracked when the Beacon transport is active. Please enable "useBeacon" load API option.`,to=(t,e)=>`${t}${v}Ignoring unknown plugins: ${e.join(", ")}.`,no=(t,e)=>`${t}${v}Failed to load the following unavailable local plugins: ${e.join(", ")}. Some features of the SDK may not work as expected. Make sure you are using the correct SDK bundle variant.`,so=(t,e)=>`${t}${v}Cannot add custom integration for destination ID "${e}" after the SDK is loaded.`,as={All:!0},st="js-integrations",ls="plugins",io=new RegExp("^(https?:\\/\\/)(((([a-zA-Z\\d]([a-zA-Z\\d-]*[a-zA-Z\\d])*)\\.)+[a-zA-Z]{2,}|localhost|((25[0-5]|2[0-4][0-9]|[0-1]?[0-9]?[0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[0-1]?[0-9]?[0-9]?)))(\\:\\d+)?(\\/[-a-zA-Z\\d%_.~+]*)*(\\?[;&a-zA-Z\\d%_.~+=-]*)?(\\#[-a-zA-Z\\d_]*)?$"),ke="modern",it="https://cdn.rudderlabs.com",Jt="v3",cs=`${it}/${Jt}/${ke}/${st}`,us=`${it}/${Jt}/${ke}/${ls}`,ds="https://api.rudderstack.com",ae="v3",ro="xhr",bt={iubenda:"IubendaConsentManager",oneTrust:"OneTrustConsentManager",ketch:"KetchConsentManager",custom:"CustomConsentManager"},Ge={[ae]:"StorageEncryption",legacy:"StorageEncryptionLegacy"},oo={[ro]:"XhrQueue",beacon:"BeaconQueue"},ao="rsaRequest",lo="rsaMetrics",co="Custom Device Mode",uo={configUrl:ds,loadIntegration:!0,sessions:{autoTrack:!0,timeout:mt,cutOff:{enabled:!1}},sameSiteCookie:"Lax",polyfillIfRequired:!0,integrations:as,useBeacon:!1,beaconQueueOptions:{},destinationsQueueOptions:{},queueOptions:{},lockIntegrationsVersion:!0,lockPluginsVersion:!0,uaChTrackLevel:"none",plugins:[],useGlobalIntegrationsConfigInEvents:!1,bufferDataPlaneEventsUntilReady:!1,dataPlaneEventsBufferTimeout:Fi,storage:{encryption:{version:ae},migrate:!0,cookie:{}},sendAdblockPage:!1,sameDomainCookiesOnly:!1,secureCookie:!1,sendAdblockPageOptions:{},useServerSideCookies:!1},go=c(m(uo)),b=zt({userId:"",userTraits:{},anonymousId:"",groupId:"",groupTraits:{},initialReferrer:"",initialReferringDomain:"",sessionInfo:{},authToken:null}),lt=zt({entries:{userId:!0,userTraits:!0,groupId:!0,groupTraits:!0,sessionInfo:!0,authToken:!0,anonymousId:!1,initialReferrer:!1,initialReferringDomain:!1}}),fo=10,ho={userId:c(b.userId),userTraits:c(b.userTraits),anonymousId:c(b.anonymousId),groupId:c(b.groupId),groupTraits:c(b.groupTraits),initialReferrer:c(b.initialReferrer),initialReferringDomain:c(b.initialReferringDomain),sessionInfo:c(b.sessionInfo),authToken:c(b.authToken)},po={isOnline:c(!0),storage:{isLocalStorageAvailable:c(!1),isCookieStorageAvailable:c(!1),isSessionStorageAvailable:c(!1)},isBeaconAvailable:c(!1),isLegacyDOM:c(!1),isUaCHAvailable:c(!1),isCryptoAvailable:c(!1),isAdBlockerDetectionInProgress:c(!1),isAdBlocked:c(void 0),cspBlockedURLs:c([])},vo={isErrorReportingEnabled:c(!1),isMetricsReportingEnabled:c(!1),breadcrumbs:c([])},mo=c(void 0),yo={activeDataplaneUrl:c(void 0),integrationsCDNPath:c(cs),pluginsCDNPath:c(us),sourceConfigUrl:c(void 0),status:c(void 0),initialized:c(!1),logLevel:c(is),loaded:c(!1),readyCallbacks:c([]),writeKey:c(void 0),dataPlaneUrl:c(void 0),safeAnalyticsInstance:c(void 0)},Eo={enabled:c(!1),initialized:c(!1),data:c({}),activeConsentManagerPluginName:c(void 0),preConsent:c({enabled:!1}),postConsent:c({}),resolutionStrategy:c("and"),provider:c(void 0),metadata:c(void 0)},So={retries:c(0),dropped:c(0),sent:c(0),queued:c(0),triggered:c(0),metricsServiceUrl:c(void 0)},Io=()=>ki,bo={app:c({name:un,namespace:Di,version:Pe,installType:Yn}),traits:c(null),library:c({name:un,version:Pe,snippetVersion:globalThis.RudderSnippetVersion,variant:Io()}),userAgent:c(null),device:c(null),network:c(null),os:c({name:"",version:""}),locale:c(null),screen:c({density:0,width:0,height:0,innerWidth:0,innerHeight:0}),"ua-ch":c(void 0),timezone:c(void 0)},To=c({}),Ao={configuredDestinations:c([]),activeDestinations:c([]),loadOnlyIntegrations:c({}),failedDestinations:c([]),loadIntegration:c(!0),initializedDestinations:c([]),clientDestinationsReady:c(!1),integrationsConfig:c({})},Ro={toBeProcessedArray:c([]),readyCallbacksArray:c([])},_o={ready:c(!1),loadedPlugins:c([]),failedPlugins:c([]),pluginsToLoadFromConfig:c([]),activePlugins:c([]),totalPluginsToLoad:c(0)},Oo={encryptionPluginName:c(void 0),migrate:c(!1),type:c(void 0),cookie:c(void 0),entries:c({}),trulyAnonymousTracking:c(!1)},Co={isEnabledServerSideCookies:c(!1),dataServiceUrl:c(void 0)},No={eventsQueuePluginName:c(void 0),deliveryEnabled:c(!0)},Po={enabled:c(!1),pageLifecycle:{enabled:c(!1),pageViewId:c(void 0),pageLoadedTimestamp:c(void 0)}},Do={capabilities:po,consents:Eo,context:bo,customContext:To,eventBuffer:Ro,lifecycle:yo,loadOptions:go,metrics:So,nativeDestinations:Ao,plugins:_o,reporting:vo,session:ho,source:mo,storage:Oo,serverCookies:Co,dataPlaneEvents:No,autoTrack:Po},o={...m(Do)},gs=/^\s*at /,ko=/^(eval@)?(\[native code])?$/,Lo=/(.+?)(?::(\d+))?(?::(\d+))?$/;function fs(t){if(!t?.includes(":"))return[t||void 0,void 0,void 0];let e=t.startsWith("(")&&t.endsWith(")")?t.slice(1,-1):t,n=Lo.exec(e);return n?[n[1]||void 0,n[2]===void 0?void 0:Number(n[2]),n[3]===void 0?void 0:Number(n[3])]:[void 0,void 0,void 0]}function wo(t){if(!gs.test(t))return null;t.includes("(eval ")&&(t=t.replaceAll("eval code","eval").replaceAll(/(\(eval at [^()]*)|(,.*$)/g,""));let e=t.replace(/^\s+/,"").replaceAll("(eval code","(").replace(/^.*?\s+/,""),n=/ (\(.+\)$)/.exec(e),s=n?e.replace(n[0],""):e,[i,r,a]=fs(n?n[1]:e);return{functionName:n&&s||void 0,fileName:i==="eval"||i==="<anonymous>"?void 0:i,lineNumber:r,columnNumber:a}}function Uo(t){if(ko.test(t))return null;if(t.includes(" > eval")&&(t=t.replaceAll(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),!t.includes("@")&&!t.includes(":"))return{functionName:t,fileName:void 0,lineNumber:void 0,columnNumber:void 0};let e=t.lastIndexOf("@"),n=e>0?t.slice(0,e):void 0,[s,i,r]=fs(t.slice(e+1));return{functionName:n,fileName:s,lineNumber:i,columnNumber:r}}function Mo(t){if(!t.stack)throw new Error("Cannot parse given Error object");let e=t.stack.split(`
4
+ `);return e.some(n=>gs.test(n))?e.map(wo).filter(n=>n!==null):e.map(Uo).filter(n=>n!==null)}var hs="global code",$o=t=>A(t)&&/^global code$/i.test(t)?hs:t,Bo=t=>{let e={file:t.fileName,method:$o(t.functionName),lineNumber:t.lineNumber,columnNumber:t.columnNumber};return e.lineNumber&&e.lineNumber>-1&&!e.file&&!e.method&&(e.file=hs),e},bn=t=>O(t)?t:"";function Tn(t,e,n,s){return{errorClass:bn(t),message:`${n}${bn(e)}`,type:"browserjs",stacktrace:s.reduce((i,r)=>{let a=Bo(r);try{return JSON.stringify(a)==="{}"?i:i.concat(a)}catch{return i}},[])}}var ps=(t,e)=>{let n;return Wt(t)&&O(et(t))?n=t:(e.warn(fr(Ae,K(t))),n=void 0),n},xo=(t,e)=>{try{let n=Mo(t);return Tn(t.name,t.message,e,n)}catch{return Tn(t.name,t.message,e,[])}},An=(t,e)=>{try{return JSON.parse(t||"")}catch(n){let s=Yt(n,"Failed to parse response data");e(s)}},Fe="The request failed",Go=[/Failed to fetch dynamically imported module: .*/],Fo=[/Unable to load \(.*\) the script with the id .*/,/A timeout of \d+ ms occurred while trying to load the script with id .*/],Vo=[new RegExp(`${Fe}.*`),/A script with the id .* is already loaded\./],jo=[...Go,...Fo],Ho="integrations",Ko="sdk",Wo=Ko,zo={headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8"},method:"GET"},Rn=(t,e,n)=>{let s=k(zo,e||{});return n&&(s.headers=k(s.headers,{Authorization:n})),s.url=t,s},_n=(t,e=xi,n)=>new Promise((s,i)=>{let r;if(t.sendRawData===!0)r=t.data;else if(r=K(t.data,!1,[],n),G(r)){i({error:new Error(ar),undefined:void 0,options:t});return}let a=new XMLHttpRequest,l=d=>{i({error:new Error(Tr(Fe,a.status,a.statusText,t.url,a.responseText)),xhr:a,options:t})},u=d=>{i({error:new Error(Ar(Fe,d,t.url)),xhr:a,options:t,...d?.type==="timeout"?{timedOut:!0}:{}})};a.ontimeout=u,a.onerror=u,a.onload=()=>{a.status>=200&&a.status<400?s({response:a.responseText,xhr:a,options:t}):l()},a.open(t.method,t.url,!0),t.withCredentials===!0&&(a.withCredentials=!0),a.timeout=e,Object.keys(t.headers).forEach(d=>{t.headers[d]&&a.setRequestHeader(d,t.headers[d])});try{a.send(r)}catch(d){i({error:Yt(d,Rr(Fe,t.url)),xhr:a,options:t})}}),Tt=class{constructor(e){this.logger=e,this.onError=this.onError.bind(this)}init(e){this.errorHandler=e}async getData(e){let{url:n,options:s,timeout:i,isRawResponse:r}=e;try{let a=await _n(Rn(n,s,this.basicAuthHeader),i,this.logger);return{data:r?a.response:An(a.response,this.onError),details:a}}catch(a){return{data:void 0,details:a}}}getAsyncData(e){let{callback:n,url:s,options:i,timeout:r,isRawResponse:a}=e,l=!f(n);_n(Rn(s,i,this.basicAuthHeader),r,this.logger).then(u=>{l||n(a?u.response:An(u.response,this.onError),u)}).catch(u=>{l||n(void 0,u)})}onError(e,n){this.errorHandler?.onError({error:e,context:di,groupingHash:n})}setAuthHeader(e,n=!1){let s=n?e:li(`${e}:`);this.basicAuthHeader=`Basic ${s}`}resetAuthHeader(){this.basicAuthHeader=void 0}},vs=new Tt(ne),Qo="1",Xo=()=>["rsa"],Yo=["www.test-host.com","localhost","127.0.0.1","[::1]"],qo=["userId","userTraits","groupId","groupTraits","anonymousId","config","integration","eventBuffer","customContext","traits","authToken"],Jo="RudderStack JavaScript SDK",Zo="git+https://github.com/rudderlabs/rudder-sdk-js.git",ea="js",ms=t=>{o.capabilities.isAdBlockerDetectionInProgress.value=!0;try{let e=new URL(o.lifecycle.sourceConfigUrl.value),n=`${e.origin}${e.pathname}?view=ad`;t.getAsyncData({url:n,options:{method:"HEAD",headers:{"Content-Type":void 0}},isRawResponse:!0,callback:(s,i)=>{o.capabilities.isAdBlockerDetectionInProgress.value=!1,o.capabilities.isAdBlocked.value=i?.error!==void 0||i?.xhr?.responseURL!==n}})}catch(e){throw o.capabilities.isAdBlockerDetectionInProgress.value=!1,e}},ta=(t,e)=>{switch(e){case q.UNHANDLEDEXCEPTION:{let{error:n}=t;return n||t}case q.UNHANDLEDREJECTION:return t.reason;case q.HANDLEDEXCEPTION:default:return t}},na=t=>({type:"manual",name:t,timestamp:new Date,metaData:{}}),sa=(t=()=>window.location.hostname)=>{let e=t();return!e||e&&Yo.includes(e)?"development":"production"},ia=t=>{let e=K(t,!1,qo);return e!==null?JSON.parse(e):{}},ra=()=>globalThis.location.href.split("?")[0],oa=(t,e,n,s)=>({id:`${t.value?.id??n.writeKey.value}..${e.sessionInfo.value.id??"NA"}..${s.pageLifecycle.pageViewId.value??"NA"}`,name:t.value?.name??"NA"}),aa=(t,e)=>({locale:t.value??"NA",userAgent:e.value??"NA",time:new Date}),la=(t,e,n,s)=>{let{context:i,lifecycle:r,session:a,source:l,reporting:u,autoTrack:d}=n,{app:h,locale:y,userAgent:T,timezone:g,screen:p,library:I}=i;return{payloadVersion:"5",notifier:{name:Jo,version:h.value.version,url:Zo},events:[{exceptions:[m(t)],severity:e.severity,unhandled:e.unhandled,severityReason:e.severityReason,app:{version:h.value.version,releaseStage:sa(),type:h.value.installType},device:aa(y,T),request:{url:ra(),clientIp:"[NOT COLLECTED]"},breadcrumbs:m(u.breadcrumbs.value),context:t.message,groupingHash:s,metaData:{app:{snippetVersion:I.value.snippetVersion},device:{...p.value,timezone:g.value},...ia(n)},user:oa(l,a,r,d)}]}},ca=(t,e,n)=>{if(U(t.capabilities.isAdBlocked.value)){t.capabilities.isAdBlockerDetectionInProgress.value===!1&&ms(e);let s=X(()=>{A(t.capabilities.isAdBlocked.value)&&(n(t.capabilities.isAdBlocked.value===!1),s())})}else n(t.capabilities.isAdBlocked.value===!1)},ua=(t,e,n)=>{let s=t.message;return new Promise(i=>{if(jo.some(r=>r.test(s))){let r=/https?:\/\/[^\s"'(),;<>[\]{}]+/.exec(s)?.[0];O(r)?r.startsWith(it)?e.capabilities.cspBlockedURLs.value.includes(r)?i(!1):ca(e,n,i):i(!1):i(!0)}else i(!Vo.some(r=>r.test(s)))})},ys=t=>t?t.split("/").at(-2):void 0,Es=t=>{let e=t.stacktrace[0]?.file;if(!(!e||typeof e!="string"))return e},da=t=>{let e=Es(t);if(!e)return!1;let n=e.substring(e.lastIndexOf("/")+1);return ys(e)===st||Xo().some(i=>n.startsWith(i)&&n.endsWith(".js"))},ga=(t,e)=>{if(e)return e;let n=Es(t);return ys(n)===st?Ho:Wo},fa=(t,e,n)=>{let s={version:Qo,message_id:Ze(),source:{name:ea,sdk_version:e.context.app.value.version,write_key:e.lifecycle.writeKey.value,install_type:e.context.app.value.installType,category:n},errors:t};return K(s)},ha=(t,e,n)=>{let s;if(!A(t))s=e;else if(O(t))s=t;else{let i=ps(t,n);A(i)?s=i.message:s=e}return s},At=class{constructor(e,n){C(this,"initialized",!1);this.httpClient=e,this.logger=n}init(){this.initialized||(this.attachErrorListeners(),this.initialized=!0)}attachErrorListeners(){globalThis.addEventListener("error",e=>{this.onError({error:e,context:Ae,errorType:q.UNHANDLEDEXCEPTION})}),globalThis.addEventListener("unhandledrejection",e=>{this.onError({error:e,context:Ae,errorType:q.UNHANDLEDREJECTION})}),document.addEventListener("securitypolicyviolation",e=>{let n=O(e.blockedURI)?e.blockedURI:"";e.disposition==="enforce"&&n.startsWith(it)&&!o.capabilities.cspBlockedURLs.value.includes(n)&&(o.capabilities.cspBlockedURLs.value=[...o.capabilities.cspBlockedURLs.value,n])})}async onError(e){try{let{error:n,context:s,customMessage:i,groupingHash:r,category:a}=e,l=e.errorType??q.HANDLEDEXCEPTION,u=ta(n,l),d=ps(u,this.logger);if(U(d))return;let h=i?`${i} - `:"",y=`${s}${v}${h}`,T=xo(d,y),p=et(d).includes(Xn);if(!p&&!da(T)&&l!==q.HANDLEDEXCEPTION)return;if(o.reporting.isErrorReportingEnabled.value&&await ua(T,o,this.httpClient)){let E={severity:"error",unhandled:l!==q.HANDLEDEXCEPTION,severityReason:{type:l}},D=ha(r,T.message,this.logger),L=la(T,E,o,D),Se=ga(T,a);this.httpClient.getAsyncData({url:o.metrics.metricsServiceUrl.value,options:{method:"POST",data:fa(L,o,Se),sendRawData:!0},isRawResponse:!0})}(l===q.HANDLEDEXCEPTION||p)&&this.logger.error(T.message)}catch(n){this.logger.error(hr(Ae),n)}}leaveBreadcrumb(e){try{o.reporting.breadcrumbs.value=[...o.reporting.breadcrumbs.value,na(e)]}catch(n){this.onError({error:n,context:Ae,customMessage:En,groupingHash:En})}}},Ss=new At(vs,ne),Rt=class{constructor(e,n={}){C(this,"plugins",[]);C(this,"byName",{});C(this,"cache",{});C(this,"config",{throws:!0});this.config={throws:!0,...n},this.logger=e}register(e,n){if(!e.name){let i=pr(de);if(this.config.throws)throw new Error(i);this.logger.error(i,e);return}if(this.byName[e.name]){let i=vr(de,e.name);if(this.config.throws)throw new Error(i);this.logger.error(i);return}this.cache={},this.plugins=this.plugins.slice();let s=this.plugins.length;this.plugins.forEach((i,r)=>{i.deps?.includes(e.name)&&(s=Math.min(s,r))}),this.plugins.splice(s,0,e),this.byName[e.name]=e,f(e.initialize)&&e.initialize(n)}unregister(e){let n=this.byName[e];if(!n){let i=mr(de,e);if(this.config.throws)throw new Error(i);this.logger.error(i);return}let s=this.plugins.indexOf(n);if(s===-1){let i=yr(de,e);if(this.config.throws)throw new Error(i);this.logger.error(i);return}this.cache={},delete this.byName[e],this.plugins=this.plugins.slice(),this.plugins.splice(s,1)}getPlugin(e){return this.byName[e]}getPlugins(e){let n=e??".";return this.cache[n]||(this.cache[n]=this.plugins.filter(s=>{if(s.deps?.some(i=>!this.byName[i])){let i=s.deps.filter(r=>!this.byName[r]);return this.logger.error(Er(de,s.name,i)),!1}return n==="."?!0:ni(s,n)})),this.cache[n]}processRawPlugins(e){e(this.plugins),this.cache={}}invoke(e,n=!0,...s){let i=e;if(!i)throw new Error(lr);let r=i.startsWith("!"),a=this.config.throws??i.endsWith("!");if(i=i.replace(/(^!|!$)/g,""),!i)throw new Error(cr);let l=i.split(".");l.pop();let u=l.join(".");return(n?this.getPlugins(i):[this.getPlugins(i)[0]]).map(h=>{let y=ht(h,i);if(!f(y)||r)return y;try{return y.apply(ht(h,u),s)}catch(T){if(a)throw T;this.logger.error(Sr(de,i,h.name),T)}return null})}invokeSingle(e,...n){return this.invoke(e,!1,...n)[0]}invokeMultiple(e,...n){return this.invoke(e,!0,...n)}},pa=new Rt(ne,{throws:!0}),va=t=>t.config.connectionMode!=="cloud"||t.config.useNativeSDKToSend===!0||t.config.useNativeSDK===!0,ma=t=>t.config.connectionMode==="hybrid"||t.config.useNativeSDKToSend===!0,On=t=>t.filter(va),ya=(t,e)=>`${t.replaceAll(" ","-")}___${e}`,Is=["BeaconQueue","CustomConsentManager","DeviceModeDestinations","DeviceModeTransformation","ExternalAnonymousId","GoogleLinker","IubendaConsentManager","KetchConsentManager","NativeDestinationQueue","OneTrustConsentManager","StorageEncryption","StorageEncryptionLegacy","StorageMigrator","XhrQueue"],Ea=["Bugsnag","ErrorReporting"],Sa={rudderAnalyticsRemotePlugins:{url:()=>Promise.resolve(window.RudderStackGlobals&&window.RudderStackGlobals.app&&window.RudderStackGlobals.app.pluginsCDNPath?`${window.RudderStackGlobals.app.pluginsCDNPath}/rsa-plugins.js`:"https://cdn.rudderlabs.com/v3/modern/plugins//rsa-plugins.js"),format:"esm",from:"vite"}};function bs(t,e){let n=Object.assign(t,e);for(let s of Object.keys(n))typeof n[s]=="object"&&typeof e[s]=="object"&&(n[s]=bs(n[s],e[s]));return n}var Ia=t=>bs({},(globalThis.__federation_shared__||{}).default||{});async function ba(t){let e=Sa[t];if(e.inited)return e.lib;if(["esm","systemjs"].includes(e.format))return new Promise((n,s)=>{(typeof e.url=="function"?e.url:()=>Promise.resolve(e.url))().then(r=>{import(r).then(a=>{if(!e.inited){let l=Ia();a.init(l),e.lib=a,e.lib.init(l),e.inited=!0}n(e.lib)}).catch(s)})})}function $(t,e){if(!t?.default&&e){let n=Object.create(null);return n.default=t,n.__esModule=!0,n}return t}function B(t,e){return ba(t).then(n=>n.get(e).then(s=>s()))}var Ta=t=>{switch(t){case"BeaconQueue":return()=>B("rudderAnalyticsRemotePlugins","./BeaconQueue").then(e=>$(e,!0));case"CustomConsentManager":return()=>B("rudderAnalyticsRemotePlugins","./CustomConsentManager").then(e=>$(e,!0));case"DeviceModeDestinations":return()=>B("rudderAnalyticsRemotePlugins","./DeviceModeDestinations").then(e=>$(e,!0));case"DeviceModeTransformation":return()=>B("rudderAnalyticsRemotePlugins","./DeviceModeTransformation").then(e=>$(e,!0));case"ExternalAnonymousId":return()=>B("rudderAnalyticsRemotePlugins","./ExternalAnonymousId").then(e=>$(e,!0));case"GoogleLinker":return()=>B("rudderAnalyticsRemotePlugins","./GoogleLinker").then(e=>$(e,!0));case"KetchConsentManager":return()=>B("rudderAnalyticsRemotePlugins","./KetchConsentManager").then(e=>$(e,!0));case"IubendaConsentManager":return()=>B("rudderAnalyticsRemotePlugins","./IubendaConsentManager").then(e=>$(e,!0));case"NativeDestinationQueue":return()=>B("rudderAnalyticsRemotePlugins","./NativeDestinationQueue").then(e=>$(e,!0));case"OneTrustConsentManager":return()=>B("rudderAnalyticsRemotePlugins","./OneTrustConsentManager").then(e=>$(e,!0));case"StorageEncryption":return()=>B("rudderAnalyticsRemotePlugins","./StorageEncryption").then(e=>$(e,!0));case"StorageEncryptionLegacy":return()=>B("rudderAnalyticsRemotePlugins","./StorageEncryptionLegacy").then(e=>$(e,!0));case"StorageMigrator":return()=>B("rudderAnalyticsRemotePlugins","./StorageMigrator").then(e=>$(e,!0));case"XhrQueue":return()=>B("rudderAnalyticsRemotePlugins","./XhrQueue").then(e=>$(e,!0));default:return}},Aa=t=>{let e={};return t.forEach(n=>{if(Is.includes(n)){let s=Ta(n);s&&(e[n]=s)}}),e},Ts=()=>({}),Ra=()=>({}),_a=t=>Aa?.(t)||{},ct={...Ts(),...Ra()},Oa=t=>({..._a(t)}),_t=class{constructor(e,n,s){this.engine=e,this.errorHandler=n,this.logger=s,this.onError=this.onError.bind(this)}init(){o.lifecycle.status.value="pluginsLoading",De("pluginsCDNPath",o.lifecycle.pluginsCDNPath.value),this.setActivePlugins(),this.registerLocalPlugins(),this.registerRemotePlugins(),this.attachEffects()}attachEffects(){X(()=>{(o.plugins.activePlugins.value.length===0||o.plugins.loadedPlugins.value.length+o.plugins.failedPlugins.value.length===o.plugins.totalPluginsToLoad.value)&&w(()=>{o.plugins.ready.value=!0,o.lifecycle.status.value="pluginsReady"})})}getPluginsToLoadBasedOnConfig(){let e=o.plugins.pluginsToLoadFromConfig.value;if(!e)return[];e=e.filter(i=>Ea.includes(i)?(this.logger.warn(qr(Ie,i)),!1):!0);let n=[{configurationStatus:()=>A(o.dataPlaneEvents.eventsQueuePluginName.value),configurationStatusStr:"Data plane events delivery is enabled",activePluginName:o.dataPlaneEvents.eventsQueuePluginName.value,supportedPlugins:Object.values(oo),shouldAddMissingPlugins:!0},{configurationStatus:()=>On(o.nativeDestinations.configuredDestinations.value).length>0,configurationStatusStr:"Device mode destinations are connected to the source",supportedPlugins:["DeviceModeDestinations","NativeDestinationQueue"]},{configurationStatus:()=>On(o.nativeDestinations.configuredDestinations.value).some(i=>i.shouldApplyDeviceModeTransformation),configurationStatusStr:"Device mode transformations are enabled for at least one destination",supportedPlugins:["DeviceModeTransformation"]},{configurationStatus:()=>A(o.consents.activeConsentManagerPluginName.value),configurationStatusStr:"Consent management is enabled",activePluginName:o.consents.activeConsentManagerPluginName.value,supportedPlugins:Object.values(bt)},{configurationStatus:()=>A(o.storage.encryptionPluginName.value),configurationStatusStr:"Storage encryption is enabled",activePluginName:o.storage.encryptionPluginName.value,supportedPlugins:Object.values(Ge)},{configurationStatus:()=>o.storage.migrate.value,configurationStatusStr:"Storage migration is enabled",supportedPlugins:["StorageMigrator"]}],s=!1;return n.forEach(i=>{i.configurationStatus()?(e=e.filter(i.activePluginName?r=>!(r!==i.activePluginName&&i.supportedPlugins.includes(r)):r=>A(r)),this.addMissingPlugins(i,s,e)):e=e.filter(i.basePlugins!==void 0?r=>!(i.basePlugins.includes(r)||i.supportedPlugins.includes(r)):r=>!i.supportedPlugins.includes(r))}),[...Object.keys(Ts()),...e]}addMissingPlugins(e,n,s){let i=e.shouldAddMissingPlugins||n,r;e.activePluginName?r=[...e.basePlugins||[],e.activePluginName]:r=[...e.supportedPlugins];let a=r.filter(l=>!s.includes(l));a.length>0&&(i&&s.push(...a),this.logger.warn(Jr(Ie,e.configurationStatusStr,a,i)))}setActivePlugins(){let e=this.getPluginsToLoadBasedOnConfig(),n=[...Object.keys(ct),...Is],s=[],i=[];e.forEach(r=>{n.includes(r)?s.push(r):i.push(r)}),i.length>0&&this.logger.warn(to(Ie,i)),w(()=>{o.plugins.totalPluginsToLoad.value=e.length,o.plugins.activePlugins.value=s,o.plugins.failedPlugins.value=i})}registerLocalPlugins(){let e=[];Object.entries(ct).forEach(([n,s])=>{o.plugins.activePlugins.value.includes(n)&&(f(s)?this.register([s()]):e.push(n))}),e.length>0&&(o.plugins.failedPlugins.value=[...o.plugins.failedPlugins.value,...e],this.logger.error(no(Ie,e)))}registerRemotePlugins(){let e=Oa(o.plugins.activePlugins.value);Promise.all(Object.keys(e).map(async n=>{await e[n]().then(s=>this.register([s.default()])).catch(s=>{o.plugins.failedPlugins.value=[...o.plugins.failedPlugins.value,n],this.onError(s,`Failed to load plugin "${n}"`,s)})})).catch(n=>{this.onError(n)})}invokeMultiple(e,...n){try{return this.engine.invokeMultiple(e,...n)}catch(s){return this.onError(s,e),[]}}invokeSingle(e,...n){try{return this.engine.invokeSingle(e,...n)}catch(s){return this.onError(s,e),null}}register(e){e.forEach(n=>{try{this.engine.register(n,o)}catch(s){o.plugins.failedPlugins.value=[...o.plugins.failedPlugins.value,n.name],this.onError(s,`Failed to register plugin "${n.name}"`)}})}unregisterLocalPlugins(){Object.keys(ct).forEach(e=>{try{this.engine.unregister(e)}catch(n){this.onError(n,`Failed to unregister plugin "${e}"`)}})}onError(e,n,s){this.errorHandler.onError({error:e,context:Ie,customMessage:n,groupingHash:s})}},x="cookieStorage",F="localStorage",V="sessionStorage",Q="memoryStorage",ue="none",Ca="test_rudder_cookie",Na="test_rudder_ls",Pa="test_rudder_ss",Da="rl_user_id",ka="rl_trait",La="rl_anonymous_id",wa="rl_group_id",Ua="rl_group_trait",Ma="rl_page_init_referrer",$a="rl_page_init_referring_domain",Ba="rl_session",xa="rl_auth_token",ge={userId:Da,userTraits:ka,anonymousId:La,groupId:wa,groupTraits:Ua,initialReferrer:Ma,initialReferringDomain:$a,sessionInfo:Ba,authToken:xa},Ga="__tld__",As="clientDataInCookie",Rs="clientDataInLocalStorage",Fa="clientDataInMemory",_s="clientDataInSessionStorage",Os=["userId","userTraits","anonymousId","groupId","groupTraits","initialReferrer","initialReferringDomain","sessionInfo","authToken"],fe={[x]:As,[F]:Rs,[Q]:Fa,[V]:_s},Cn=(t,e)=>{try{return encodeURIComponent(t)}catch(n){e?.error(Ri,n);return}},Nn=t=>{try{return decodeURIComponent(t)}catch{return}},Va=t=>{let e={},n=t.split(/\s*;\s*/),s;return n[0]&&n.forEach(i=>{s=i.split("=");let r=s[0]?Nn(s[0]):void 0;r&&(e[r]=s[1]?Nn(s[1]):void 0)}),e},ja=(t,e,n,s)=>{let i={...n||{}},r=`${Cn(t,s)}=${Cn(e,s)}`;G(e)&&(i.maxage=-1),i.maxage&&(i.expires=new Date(+new Date+i.maxage)),i.path&&(r+=`; path=${i.path}`),i.domain&&(r+=`; domain=${i.domain}`),i.expires&&(r+=`; expires=${i.expires.toUTCString()}`),i.samesite&&(r+=`; samesite=${i.samesite}`),i.secure&&(r+="; secure"),globalThis.document.cookie=r},Ot=()=>{let t=globalThis.document.cookie;return Va(t)},Ha=t=>Ot()[t],J=function(t,e,n,s){switch(arguments.length){case 4:case 3:case 2:return ja(t,e,n,s);case 1:return t?Ha(t):Ot();default:return Ot()}},Ka=t=>{let e=document.createElement("a");return e.href=t,e.hostname},Wa=t=>{let n=(typeof globalThis.URL!="function"?Ka(t):new URL(t).hostname)?.split(".")??[],s=n[n.length-1],i=[];if(n.length===4&&s&&s===parseInt(s,10).toString())return i;if(n.length<=1)return n[0]&&n[0].indexOf("localhost")!==-1?["localhost"]:i;for(let r=n.length-2;r>=0;r-=1)i.push(n.slice(r).join("."));return i},za=t=>{let e=Wa(t);for(let n=0;n<e.length;n+=1){let s=e[n],i=Ga,r={domain:`${s.indexOf("localhost")!==-1?"":"."}${s}`};try{if(J(i,1,r),J(i))return J(i,null,r),s}catch{try{J(i,null,r)}catch{}}}return""},Qa=()=>{let t=`.${za(globalThis.location.href)}`;return{maxage:Gi,path:"/",domain:!t||t==="."?void 0:t,samesite:"Lax",enabled:!0}},Xa=()=>({enabled:!0}),Ya=()=>({enabled:!0}),qa=()=>({enabled:!0}),Ct=class{constructor(e){C(this,"isEnabled",!0);C(this,"length",0);C(this,"data",{});this.options=qa(),this.logger=e}configure(e){return this.options=k(this.options,e??{}),this.isEnabled=!!this.options.enabled,this.options}setItem(e,n){return this.data[e]=n,this.length=Object.keys(this.data).length,n}getItem(e){return e in this.data?this.data[e]:null}removeItem(e){return e in this.data&&delete this.data[e],this.length=Object.keys(this.data).length,null}clear(){this.data={},this.length=0}key(e){return this.keys()[e]??null}keys(){return Object.keys(this.data)}},qe=new Ct(ne);function Ja(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ve={exports:{}},Za=Ve.exports,Pn;function el(){return Pn||(Pn=1,(function(t,e){(function(n,s){t.exports=s()})(Za,function(){function n(g){return g=JSON.stringify(g),!!/^\{[\s\S]*\}$/.test(g)}function s(g){return g===void 0||typeof g=="function"?g+"":JSON.stringify(g)}function i(g){if(typeof g=="string")try{return JSON.parse(g)}catch{return g}}function r(g){return{}.toString.call(g)==="[object Function]"}function a(g){return Object.prototype.toString.call(g)==="[object Array]"}function l(g){var p="_Is_Incognit",I="yes";try{g||(g=window.localStorage),g.setItem(p,I),g.removeItem(p)}catch{var E={};E._data={},E.setItem=function(L,Se){return E._data[L]=String(Se)},E.getItem=function(L){return E._data.hasOwnProperty(L)?E._data[L]:void 0},E.removeItem=function(L){return delete E._data[L]},E.clear=function(){return E._data={}},g=E}finally{g.getItem(p)===I&&g.removeItem(p)}return g}var u=l();function d(){if(!(this instanceof d))return new d}d.prototype={set:function(p,I){if(p&&!n(p))u.setItem(p,s(I));else if(n(p))for(var E in p)this.set(E,p[E]);return this},get:function(p){if(p===void 0){var I={};return this.forEach(function(Gs,Fs){return I[Gs]=Fs}),I}if(p.charAt(0)==="?")return this.has(p.substr(1));var E=arguments;if(E.length>1){for(var D={},L=0,Se=E.length;L<Se;L++){var xs=i(u.getItem(E[L]));this.has(E[L])&&(D[E[L]]=xs)}return D}return i(u.getItem(p))},clear:function(){return u.clear(),this},remove:function(p){var I=this.get(p);return u.removeItem(p),I},has:function(p){return{}.hasOwnProperty.call(this.get(),p)},keys:function(){var p=[];return this.forEach(function(I){p.push(I)}),p},forEach:function(p){for(var I=0,E=u.length;I<E;I++){var D=u.key(I);p(D,this.get(D))}return this},search:function(p){for(var I=this.keys(),E={},D=0,L=I.length;D<L;D++)I[D].indexOf(p)>-1&&(E[I[D]]=this.get(I[D]));return E},len:function(){return u.length}};var h=null;function y(g,p){var I=arguments,E=null;if(h||(h=d()),I.length===0)return h.get();if(I.length===1){if(typeof g=="string")return h.get(g);if(n(g))return h.set(g)}if(I.length===2&&typeof g=="string"){if(!p)return h.remove(g);if(p&&typeof p=="string")return h.set(g,p);p&&r(p)&&(E=null,E=p(g,h.get(g)),y.set(g,E))}if(I.length===2&&a(g)&&r(p))for(var D=0,L=g.length;D<L;D++)E=p(g[D],h.get(g[D])),y.set(g[D],E);return y}for(var T in d.prototype)y[T]=d.prototype[T];return y})})(Ve)),Ve.exports}var tl=el(),re=Ja(tl),Cs=t=>{let e=["QuotaExceededError","NS_ERROR_DOM_QUOTA_REACHED"],n=[22,1014];return t instanceof DOMException?e.includes(t.name)||n.includes(t.code):!1},he=(t=F,e,n)=>{let s,i,r=_i(pt,t),a="unavailable",l=!0,u;try{switch(t){case Q:return!0;case x:s=e,i=Ca;break;case F:s=e??globalThis.localStorage,i=Na;break;case V:s=e??globalThis.sessionStorage,i=Pa;break;default:return!1}if(s&&(s.setItem(i,"true"),s.getItem(i)))return s.removeItem(i),!0;l=!1}catch(d){l=!1,u=d,Cs(d)&&(a="full")}return l||n?.warn(`${r}${a}.`,u),!1},Nt=class{constructor(e){C(this,"isSupportAvailable",!0);C(this,"isEnabled",!0);C(this,"length",0);this.options=Xa(),this.logger=e}configure(e){return this.options=k(this.options,e??{}),this.isSupportAvailable=he(F),this.isEnabled=!!(this.options.enabled&&this.isSupportAvailable),this.options}setItem(e,n){re.set(e,n),this.length=re.len()}getItem(e){let n=re.get(e);return U(n)?null:n}removeItem(e){re.remove(e),this.length=re.len()}clear(){re.clear(),this.length=0}key(e){return this.keys()[e]??null}keys(){return re.keys()}},Zt=new Nt(ne),Pt=class{constructor(e){C(this,"isSupportAvailable",!0);C(this,"isEnabled",!0);C(this,"length",0);this.options=Ya(),this.logger=e}configure(e){return this.options=k(this.options,e??{}),this.isSupportAvailable=he(V),this.isSupportAvailable&&(this.store=globalThis.sessionStorage),this.isEnabled=!!(this.options.enabled&&this.isSupportAvailable),this.options}setItem(e,n){this.store&&(this.store.setItem(e,n),this.length=this.store.length)}getItem(e){if(!this.store)return null;let n=this.store.getItem(e);return U(n)?null:n}removeItem(e){this.store&&(this.store.removeItem(e),this.length=this.store.length)}clear(){this.store?.clear(),this.length=0}key(e){return this.store?.key(e)??null}keys(){let e=[];if(!this.store)return e;for(let n=0;n<this.store.length;n+=1){let s=this.store.key(n);s!==null&&e.push(s)}return e}},en=new Pt(ne),Dt=class{constructor(e){C(this,"isSupportAvailable",!0);C(this,"isEnabled",!0);C(this,"length",0);this.logger=e}configure(e){return this.options||(this.options=Qa()),this.options=k(this.options,e??{}),this.options.sameDomainCookiesOnly&&delete this.options.domain,this.isSupportAvailable=he(x,this),this.isEnabled=!!(this.options.enabled&&this.isSupportAvailable),this.options}setItem(e,n){return J(e,n,this.options,this.logger),this.length=Object.keys(J()).length,!0}getItem(e){let n=J(e);return U(n)?null:n}removeItem(e){let n=this.setItem(e,null);return this.length=Object.keys(J()).length,n}clear(){}key(e){return this.keys()[e]??null}keys(){return Object.keys(J())}},tn=new Dt(ne),H=t=>{switch(t){case F:return Zt;case V:return en;case Q:return qe;case x:return tn;default:return qe}},nl=t=>{let e=tn.configure(t);o.storage.cookie.value={maxage:e.maxage,path:e.path,domain:e.domain,samesite:e.samesite,expires:e.expires,secure:e.secure}},sl=t=>{Zt.configure(t)},il=t=>{qe.configure(t)},rl=t=>{en.configure(t)},ol=(t={},e={},n={},s={})=>{nl(t),sl(e),il(n),rl(s)},kt=class{constructor(e,n,s){this.id=e.id,this.name=e.name,this.isEncrypted=e.isEncrypted??!1,this.validKeys=e.validKeys??{},this.engine=n,this.noKeyValidation=Object.keys(this.validKeys).length===0,this.noCompoundKey=e.noCompoundKey,this.originalEngine=this.engine,this.errorHandler=e.errorHandler,this.logger=e.logger,this.pluginsManager=s}createValidKey(e){let{name:n,id:s,validKeys:i,noKeyValidation:r,noCompoundKey:a}=this;if(r)return a?e:[n,s,e].join(".");let l;return Object.values(i).forEach(u=>{u===e&&(l=a?e:[n,s,e].join("."))}),l}swapQueueStoreToInMemoryEngine(){let{name:e,id:n,validKeys:s,noCompoundKey:i}=this,r=H(Q);Object.keys(s).forEach(a=>{let l=this.get(s[a]),u=i?a:[e,n,a].join(".");r.setItem(u,l),this.remove(a)}),this.engine=r}set(e,n){let s=this.createValidKey(e);if(s)try{this.engine.setItem(s,this.encrypt(K(n,!1,[],this.logger)))}catch(i){if(Cs(i))this.logger.warn(Hr(`Store ${this.id}`)),this.swapQueueStoreToInMemoryEngine(),this.set(e,n);else{let r=_r(e);this.onError(i,r,r)}}}get(e){let n=this.createValidKey(e),s;try{return!n||(s=this.decrypt(this.engine.getItem(n)),W(s)||s==="")?null:JSON.parse(s)}catch(i){let r=o.storage.encryptionPluginName.value;if(!r||!o.plugins.failedPlugins.value.includes(r)){let l=Or(e);this.onError(i,l,l)}return null}}remove(e){let n=this.createValidKey(e);n&&this.engine.removeItem(n)}getOriginalEngine(){return this.originalEngine}decrypt(e){return W(e)?null:this.crypto(e,"decrypt")}encrypt(e){return this.crypto(e,"encrypt")}crypto(e,n){if(!this.isEncrypted||!e||typeof e!="string"||oi(e)==="")return e;let i=`storage.${n}`,r=this.pluginsManager?this.pluginsManager.invokeSingle(i,e):e;return typeof r>"u"?e:r??""}onError(e,n,s){this.errorHandler.onError({error:e,context:`Store ${this.id}`,customMessage:n,groupingHash:s})}},al=(t,e)=>{let n;if(t.consents.preConsent.value.enabled)switch(t.consents.preConsent.value.storage?.strategy){case"none":n=ue;break;case"session":e!=="sessionInfo"&&(n=ue);break;case"anonymousId":e!=="anonymousId"&&(n=ue);break}return n},Lt=class{constructor(e,n,s){C(this,"stores",{});C(this,"isInitialized",!1);this.errorHandler=n,this.logger=s,this.pluginsManager=e}init(){if(this.isInitialized)return;let e=o.loadOptions.value,n={cookieStorageOptions:{samesite:e.sameSiteCookie,secure:e.secureCookie,domain:e.setCookieDomain,sameDomainCookiesOnly:e.sameDomainCookiesOnly},localStorageOptions:{},inMemoryStorageOptions:{},sessionStorageOptions:{}};ol(Te(k(n.cookieStorageOptions??{},o.storage.cookie?.value??{})),Te(n.localStorageOptions),Te(n.inMemoryStorageOptions),Te(n.sessionStorageOptions)),this.initClientDataStores(),this.isInitialized=!0}initClientDataStores(){this.initializeStorageState(),[Q,F,x,V].forEach(n=>{H(n)?.isEnabled&&this.setStore({id:fe[n],name:fe[n],isEncrypted:!0,noCompoundKey:!0,type:n,errorHandler:this.errorHandler,logger:this.logger})})}initializeStorageState(){let e=o.storage.type.value,n=o.loadOptions.value.storage?.entries,s=o.consents.postConsent.value.storage;(A(s?.type)||A(s?.entries))&&(e=s?.type,n=s?.entries);let i=!0,r={};Os.forEach(a=>{let l=a,u=a,d=n?.[l]?.type,y=al(o,a)??d??e??It,T=this.getResolvedStorageTypeForEntry(y,a);T!==ue&&(i=!1),r={...r,[a]:{type:T,key:ge[u]}}}),w(()=>{o.storage.type.value=e,o.storage.entries.value=r,o.storage.trulyAnonymousTracking.value=i})}getResolvedStorageTypeForEntry(e,n){let s=e;switch(e){case F:H(F)?.isEnabled||(s=Q);break;case V:H(V)?.isEnabled||(s=Q);break;case Q:case ue:break;case x:default:H(x)?.isEnabled?s=x:H(F)?.isEnabled?s=F:H(V)?.isEnabled?s=V:s=Q;break}return s!==e&&this.logger.warn(Kr(ci,n,e,s)),s}setStore(e){let n=H(e.type);return this.stores[e.id]=new kt(e,n,this.pluginsManager),this.stores[e.id]}getStore(e){return this.stores[e]}},ll=t=>R(t)&&R(t.source)&&!W(t.source.id)&&R(t.source.config)&&Array.isArray(t.source.destinations),cl=t=>typeof t=="string"&&rs.includes(t),Ns=t=>{let e=new URL(t),{host:n,protocol:s}=e,i=n.split("."),r;return i.length>2?r=`${i[i.length-2]}.${i[i.length-1]}`:r=n,{topDomain:r,protocol:s}},ul=t=>{let{topDomain:e,protocol:n}=Ns(t);return`${n}//${e}`},dl=(t,e)=>{let n=e?window.location.origin:ul(window.location.href),s=t.startsWith("/")?t.substring(1):t;return`${n}/${s}`},gl=t=>{let{topDomain:e}=Ns(window.location.href);return e===t},ve=t=>t?.endsWith("/")?ve(t.substring(0,t.length-1)):t,wt=t=>{try{return new URL(t).host}catch{return null}},Ps=t=>wt(t)??"",fl=t=>{let e={};try{let n=new URL(t),s="utm_";n.searchParams.forEach((i,r)=>{if(r.startsWith(s)){let a=r.substring(s.length);a==="campaign"&&(a="name"),e[a]=i}})}catch{}return e},hl=t=>{let e=t;try{let n=new URL(t);e=n.origin+n.pathname+n.search}catch{}return e},pl=t=>t.replace(/\/{2,}/g,"/"),me=t=>{if(!O(t))return!1;try{return f(globalThis.URL)&&new URL(t),io.test(t)}catch{return!1}},ut="none",dt="immediate",vl=t=>t?.statsCollection?.errors?.enabled===!0,ml=t=>t?.statsCollection?.metrics?.enabled===!0,yl=t=>{let e={sendPageEvent:!1,trackConsent:!1,discardPreConsentEvents:!1};if(R(t)){let n=m(t);e.storage=n.storage,te(n.integrations)&&(e.integrations=n.integrations),e.discardPreConsentEvents=n.discardPreConsentEvents===!0,e.sendPageEvent=n.sendPageEvent===!0,e.trackConsent=n.trackConsent===!0,te(n.consentManagement)&&(e.consentManagement=k(n.consentManagement,{enabled:o.consents.enabled.value}))}return e},Dn=t=>te(t)||Array.isArray(t),El=(t,e)=>{let{provider:n}=t,s=n?bt[n]:void 0;return n&&!s&&(e.error(gr(j,n,bt)),n=void 0),{provider:n,consentManagerPluginName:s}},Ds=(t,e)=>{let n,s=[],i=[],r=!1,a,l=t?.enabled===!0;te(t)&&l&&({provider:a,consentManagerPluginName:n}=El(t,e),Dn(t.allowedConsentIds)&&(s=t.allowedConsentIds,r=!0),Dn(t.deniedConsentIds)&&(i=t.deniedConsentIds,r=!0));let u={allowedConsentIds:s,deniedConsentIds:i};return l=l&&!!n,{provider:a,consentManagerPluginName:n,initialized:r,enabled:l,consentsData:u}},Sl=()=>{let t=document.querySelector("script[data-rsa-write-key]");if(t&&t.dataset.rsaWriteKey===o.lifecycle.writeKey.value)return t.src;let e=document.getElementsByTagName("script"),n=/(?:^|\/)rsa(\.min)?\.js$/;for(let s of e){let i=s.getAttribute("src");if(i&&n.test(i))return i}},Il=t=>{o.reporting.isErrorReportingEnabled.value=vl(t.source.config)&&!mi(),o.reporting.isMetricsReportingEnabled.value=ml(t.source.config)},bl=t=>{let{useServerSideCookies:e,dataServiceEndpoint:n,storage:s,setCookieDomain:i,sameDomainCookiesOnly:r}=o.loadOptions.value,a=s?.cookie,l=!1,u;if(e){l=e;let d=a.domain??i,h=A(d)&&!gl(rn(d))||r,y=dl(n??ao,h);if(me(y)){u=ve(y);let T=wt(window.location.href),g=wt(y);T!==g&&(a={...a,samesite:"None",secure:!0}),!r&&h&&g!==rn(d)&&(l=!1,t.warn(Lr(j,d,g)))}else l=!1}return{sscEnabled:l,cookieOptions:a,finalDataServiceUrl:u}},Tl=t=>{let{storage:e}=o.loadOptions.value,n=e?.type;A(n)&&!cl(n)&&(t.warn(Pr(j,n,It)),n=It);let s=e?.encryption?.version,i=s&&Ge[s];!U(s)&&U(i)?(t.warn(Dr(j,s,Ge,ae)),s=ae):U(s)&&(s=ae);let r=e?.migrate,a=r&&s===ae;r===!0&&a!==r&&t.warn(kr(j,s,ae));let{sscEnabled:l,finalDataServiceUrl:u,cookieOptions:d}=bl(t);w(()=>{o.storage.type.value=n,o.storage.cookie.value=d,o.serverCookies.isEnabledServerSideCookies.value=l,o.serverCookies.dataServiceUrl.value=u,o.storage.encryptionPluginName.value=Ge[s],o.storage.migrate.value=a})},Al=t=>{let{provider:e,consentManagerPluginName:n,initialized:s,enabled:i,consentsData:r}=Ds(o.loadOptions.value.consentManagement,t),a=o.loadOptions.value.preConsent,l=a?.storage?.strategy??ut,u=["none","session","anonymousId"];A(l)&&!u.includes(l)&&(l=ut,t.warn(Xr(j,a?.storage?.strategy,ut)));let d=a?.events?.delivery??dt,h=["immediate","buffer"];A(d)&&!h.includes(d)&&(d=dt,t.warn(Yr(j,a?.events?.delivery,dt))),w(()=>{o.consents.activeConsentManagerPluginName.value=n,o.consents.initialized.value=s,o.consents.enabled.value=i,o.consents.data.value=r,o.consents.provider.value=e,o.consents.preConsent.value={enabled:o.loadOptions.value.preConsent?.enabled===!0&&s===!1&&i===!0,storage:{strategy:l},events:{delivery:d}}})},Rl=t=>{let e=o.consents.resolutionStrategy.value,n;R(t.consentManagementMetadata)&&(o.consents.provider.value&&(e=t.consentManagementMetadata.providers.find(s=>s.provider===o.consents.provider.value)?.resolutionStrategy??o.consents.resolutionStrategy.value),n=t.consentManagementMetadata),o.consents.provider.value==="custom"&&(e=void 0),w(()=>{o.consents.metadata.value=m(n),o.consents.resolutionStrategy.value=e})},_l=t=>{if(o.dataPlaneEvents.deliveryEnabled.value){let e="XhrQueue",n=e;o.loadOptions.value.useBeacon&&(o.capabilities.isBeaconAvailable.value?n="BeaconQueue":(n=e,t.warn($r(j)))),w(()=>{o.dataPlaneEvents.eventsQueuePluginName.value=n})}},Ol=(t,e,n,s,i)=>{let r=new URLSearchParams({p:Yn,v:Pe,build:ke,writeKey:e,lockIntegrationsVersion:n.toString(),lockPluginsVersion:s.toString()}),a=ds,l=r,u="/sourceConfig/",d="";if(me(t)){let h=new URL(t);ve(h.pathname).endsWith("/sourceConfig")||(h.pathname=`${ve(h.pathname)}/sourceConfig/`),h.pathname=pl(h.pathname),r.forEach((y,T)=>{h.searchParams.get(T)===null&&h.searchParams.set(T,y)}),a=h.origin,u=h.pathname,l=h.searchParams,d=h.hash}else i.warn(zr(j,t));return`${a}${u}?${l}${d}`},Cl=t=>t.map(e=>({id:e.id,displayName:e.destinationDefinition.displayName,enabled:e.enabled,config:e.config,shouldApplyDeviceModeTransformation:e.shouldApplyDeviceModeTransformation??!1,propagateEventsUntransformedOnError:e.propagateEventsUntransformedOnError??!1,userFriendlyId:ya(e.destinationDefinition.displayName,e.id),isCustomIntegration:e.destinationDefinition.displayName===co})),ks=(t,e,n,s,i,r,a)=>{let l;if(r){if(!me(r))return a.error(dr(j,t,r)),null;l=ve(r)}else if(l=n,o.context.app.value.installType==="cdn"){let u=Sl();u&&(l=u.split("/").slice(0,-1).concat(e).join("/"))}return i&&(l=l.replace(new RegExp(`/${Jt}/${ke}/${e}$`),`/${s}/${ke}/${e}`)),l},Nl=(t,e,n,s)=>ks("integrations",st,cs,t,e,n,s),Pl=(t,e,n,s)=>ks("plugins",ls,us,t,e,n,s),Ut=class{constructor(e,n,s){this.errorHandler=n,this.logger=s,this.httpClient=e,this.onError=this.onError.bind(this),this.processConfig=this.processConfig.bind(this)}attachEffects(){X(()=>{this.logger.setMinLogLevel(o.lifecycle.logLevel.value)})}init(){let{logLevel:e,configUrl:n,lockIntegrationsVersion:s,lockPluginsVersion:i,destSDKBaseURL:r,pluginsSDKBaseURL:a,integrations:l}=o.loadOptions.value,u=Nl(Pe,s,r,this.logger);if(G(u))return;let d;d=Pl(Pe,i,a,this.logger),d!==null&&(this.attachEffects(),o.lifecycle.activeDataplaneUrl.value=ve(o.lifecycle.dataPlaneUrl.value),Tl(this.logger),Al(this.logger),_l(this.logger),w(()=>{o.lifecycle.integrationsCDNPath.value=u,o.lifecycle.pluginsCDNPath.value=d,e&&(o.lifecycle.logLevel.value=e),o.lifecycle.sourceConfigUrl.value=Ol(n,o.lifecycle.writeKey.value,s,i,this.logger),o.metrics.metricsServiceUrl.value=`${o.lifecycle.activeDataplaneUrl.value}/${lo}`,o.nativeDestinations.loadOnlyIntegrations.value=l}),this.getConfig())}onError(e,n,s){this.errorHandler.onError({error:e,context:j,customMessage:n,groupingHash:s})}processConfig(e,n){if(!A(e)){A(n)?this.onError(n.error,Sn):this.onError(new Error(Sn));return}let s;try{O(e)?s=JSON.parse(e):s=e}catch(r){this.onError(r,yn);return}if(!ll(s)){this.onError(new Error(yn));return}if(s.source.enabled===!1){this.logger.error(or);return}Il(s);let i=s.source.destinations.length>0?Cl(s.source.destinations):[];w(()=>{o.source.value={config:s.source.config,name:s.source.name,id:s.source.id,workspaceId:s.source.workspaceId},o.nativeDestinations.configuredDestinations.value=i,o.plugins.pluginsToLoadFromConfig.value=o.loadOptions.value.plugins??[],Rl(s),o.lifecycle.status.value="configured"})}getConfig(){let e=o.loadOptions.value.getSourceConfig;if(e){if(!f(e)){this.logger.error(ur(j));return}let n=e();n instanceof Promise?n.then(s=>this.processConfig(s)).catch(s=>{this.onError(s,"SourceConfig")}):this.processConfig(n)}else this.httpClient.getAsyncData({url:o.lifecycle.sourceConfigUrl.value,options:{headers:{"Content-Type":void 0}},callback:this.processConfig})}},Dl=()=>{let t=/([A-Z]+[+-]\d+)/.exec(new Date().toString());return t?.[1]?t[1]:"NA"},Ls=(t=()=>document)=>t()?.referrer||"$direct",kl=(t=()=>document)=>{let n=t().getElementsByTagName("link"),s="";for(let i=0;n[i];i+=1){let r=n[i];if(r.getAttribute("rel")==="canonical"&&!s){s=r.getAttribute("href")??"";break}}return s},Ll=(t=()=>globalThis.navigator)=>{let e=t();if(U(e))return null;let{userAgent:n}=e,{brave:s}=e;if(s&&Object.getPrototypeOf(s).isBrave){let i=n.match(/(chrome)\/([\w.]+)/i);i&&(n=`${n} Brave/${i[2]}`)}return n},wl=(t=()=>globalThis.navigator)=>{let e=t();return U(e)?null:e.language??e.browserLanguage},ws=(t=()=>globalThis.location,e=()=>document)=>{let n=t(),s=kl(e),i=n.pathname,{href:r}=n,a=r,{search:l}=n;if(s)try{let y=new URL(s);y.search===""?a=s+l:a=s,i=y.pathname}catch{}let u=hl(a),{title:d}=e(),h=Ls(e);return{path:i,referrer:h,referring_domain:Ps(h),search:l,title:d,url:u,tab_url:r}},Ul=(t,e="none")=>{e==="none"&&t(void 0),e==="default"&&t(navigator.userAgentData),e==="full"&&navigator.userAgentData?.getHighEntropyValues(["architecture","bitness","brands","mobile","model","platform","platformVersion","uaFullVersion","fullVersionList","wow64"]).then(n=>{t(n)}).catch(()=>{t()})},Ml=()=>{let t=globalThis.document.createElement("div");return t.setAttribute("data-a-b","c"),t.dataset?t.dataset.aB==="c":!1},Mt={URL:()=>!f(globalThis.URL)||!f(globalThis.URLSearchParams),Promise:()=>!f(globalThis.Promise),"Number.isNaN":()=>!f(globalThis.Number.isNaN),"Number.isInteger":()=>!f(globalThis.Number.isInteger),"Array.from":()=>!f(globalThis.Array.from),"Array.prototype.find":()=>!f(globalThis.Array.prototype.find),"Array.prototype.includes":()=>!f(globalThis.Array.prototype.includes),"String.prototype.endsWith":()=>!f(globalThis.String.prototype.endsWith),"String.prototype.startsWith":()=>!f(globalThis.String.prototype.startsWith),"String.prototype.includes":()=>!f(globalThis.String.prototype.includes),"String.prototype.replaceAll":()=>!f(globalThis.String.prototype.replaceAll),"String.fromCodePoint":()=>!f(globalThis.String.fromCodePoint),"Object.entries":()=>!f(globalThis.Object.entries),"Object.values":()=>!f(globalThis.Object.values),"Object.assign":()=>!f(globalThis.Object.assign),"Object.fromEntries":()=>!f(globalThis.Object.fromEntries),"Element.prototype.dataset":()=>!Ml(),TextEncoder:()=>!f(globalThis.TextEncoder)||!f(globalThis.TextDecoder),requestAnimationFrame:()=>!f(globalThis.requestAnimationFrame)||!f(globalThis.cancelAnimationFrame),CustomEvent:()=>!f(globalThis.CustomEvent),"navigator.sendBeacon":()=>!f(globalThis.navigator.sendBeacon),ArrayBuffer:()=>!f(globalThis.Uint8Array),Set:()=>!f(globalThis.Set),atob:()=>!f(globalThis.atob)},$l=()=>{let t=Object.keys(Mt),e=!1;for(let n=0;n<t.length;n++){let s=Mt[t[n]];if(f(s)&&s()){e=!0;break}}return e},Bl="https://polyfill-fastly.io/v3/polyfill.min.js",xl=`${Bl}?version=3.111.0&features=${Object.keys(Mt).join("%2C")}`,Gl=10*1e3,kn="rudderstackPolyfill",Fl=()=>!W(globalThis.crypto)&&f(globalThis.crypto.getRandomValues),Ln=()=>!W(globalThis.navigator.userAgentData),Vl=()=>!W(globalThis.navigator.sendBeacon)&&f(globalThis.navigator.sendBeacon),wn=()=>{let t={density:0,width:0,height:0,innerWidth:0,innerHeight:0};return t={width:globalThis.screen.width,height:globalThis.screen.height,density:globalThis.devicePixelRatio,innerWidth:globalThis.innerWidth,innerHeight:globalThis.innerHeight},t},$t=class{constructor(e,n,s){this.httpClient=e,this.errorHandler=n,this.logger=s,this.externalSrcLoader=new ze(this.logger),this.onError=this.onError.bind(this),this.onReady=this.onReady.bind(this)}init(){this.prepareBrowserCapabilities(),this.attachWindowListeners()}detectBrowserCapabilities(){w(()=>{o.capabilities.storage.isCookieStorageAvailable.value=he(x,H(x),this.logger),o.capabilities.storage.isLocalStorageAvailable.value=he(F,void 0,this.logger),o.capabilities.storage.isSessionStorageAvailable.value=he(V,void 0,this.logger),o.capabilities.isBeaconAvailable.value=Vl(),o.capabilities.isUaCHAvailable.value=Ln(),o.capabilities.isCryptoAvailable.value=Fl(),o.capabilities.isOnline.value=globalThis.navigator.onLine,o.context.userAgent.value=Ll(),o.context.locale.value=wl(),o.context.screen.value=wn(),o.context.timezone.value=Dl(),Ln()&&Ul(e=>{o.context["ua-ch"].value=e},o.loadOptions.value.uaChTrackLevel)}),X(()=>{o.loadOptions.value.sendAdblockPage===!0&&o.lifecycle.sourceConfigUrl.value!==void 0&&ms(this.httpClient)})}prepareBrowserCapabilities(){o.capabilities.isLegacyDOM.value=$l();let e=o.loadOptions.value.polyfillURL,n=xl;if(pe(e)&&(me(e)?n=e:this.logger.warn(Zr(pt,e))),o.loadOptions.value.polyfillIfRequired&&o.capabilities.isLegacyDOM.value&&me(n)){let i=n!==o.loadOptions.value.polyfillURL;if(i){let r=`RS_polyfillCallback_${o.lifecycle.writeKey.value}`,a=()=>{this.onReady(),delete globalThis[r]};globalThis[r]=a,n=`${n}&callback=${r}`}this.externalSrcLoader.loadJSFile({url:n,id:kn,async:!0,timeout:Gl,callback:r=>{r?i||this.onReady():this.onError(new Error(Qr(kn,n)))}})}else this.onReady()}attachWindowListeners(){globalThis.addEventListener("offline",()=>{o.capabilities.isOnline.value=!1}),globalThis.addEventListener("online",()=>{o.capabilities.isOnline.value=!0}),globalThis.addEventListener("resize",ji(()=>{o.context.screen.value=wn()},this))}onReady(){this.detectBrowserCapabilities(),o.lifecycle.status.value="browserCapabilitiesReady"}onError(e,n){this.errorHandler.onError({error:e,context:pt,groupingHash:n})}},jl="web",Hl=["integrations","anonymousId","originalTimestamp"],Kl=["library","consentManagement","userAgent","ua-ch","screen"],gt=["id","anonymous_id","user_id","sent_at","timestamp","received_at","original_timestamp","event","event_text","channel","context_ip","context_request_ip","context_passed_ip","group_id","previous_id"],je="CustomContext",Wl=new Set(["__proto__","constructor","prototype"]),zl=Function.prototype.toString.call(Object),Ql=t=>{if(!R(t))return!1;let e=Object.getPrototypeOf(t);if(e===null)return!0;let n=Object.prototype.hasOwnProperty.call(e,"constructor")?e.constructor:void 0;return typeof n=="function"&&n.prototype===e&&Function.prototype.toString.call(n)===zl},nn=(t,e=new Set)=>{if(!R(t)&&!Array.isArray(t))return!1;let n=t;return e.has(n)?!1:(e.add(n),Object.keys(n).some(s=>Wl.has(s)||nn(n[s],e)))},Us=(t,e)=>{let n={};return Object.keys(t).forEach(s=>{if(Kl.includes(s)){e.warn(Ur(je,s));return}Object.defineProperty(n,s,{configurable:!0,enumerable:!0,value:t[s]===t?n:t[s],writable:!0})}),n},Ms=(t,e)=>{try{if(!Ql(t)){e.warn(xe(je));return}let n=Us(t,e);if(nn(n)){e.warn(xe(je));return}let s=S(n,e);return m(s)}catch{e.warn(xe(je));return}},Bt=class{constructor(e,n){this.state=e,this.logger=n}set(e){let n=Ms(e,this.logger);if(!n)return;let s=k(m(this.state.value),n);this.state.value=Ne(s)}get(){return m(this.state.value)}clear(){this.state.value={}}},$s=t=>typeof t=="number"&&!Number.isNaN(t),Xl=(t,e)=>e.toString().length>=t,Je=t=>$s(t)&&t>=0&&Number.isInteger(t),Un=10,Bs=t=>{let{cutOff:e}=t,n=Date.now();return!!(e?.enabled&&e.expiresAt&&n>e.expiresAt)},Mn=t=>!t.expiresAt||Date.now()>t.expiresAt||Bs(t),Yl=()=>Date.now(),ql=(t,e)=>!t||!Je(t)||!Xl(Un,t)?(e.warn(jr(oe,t,Un)),!1):!0,Jl=t=>{if(t?.enabled)return t.expiresAt??(Je(t.duration)?Date.now()+t.duration:void 0)},Zl=t=>{let{timeout:e,cutOff:n}=t,s=Date.now();return{id:s,expiresAt:s+e,timeout:e,autoTrack:!0,...n&&{cutOff:n}}},ec=(t,e)=>({id:ql(t,e)?t:Yl(),sessionStart:void 0,manualTrack:!0}),Re=t=>t===x||t===F||t===V||t===Q,xt=()=>Ze(),tc=t=>{if(ti(t)){let{entries:e,...n}=lt;return{...n,entries:{...e,anonymousId:t}}}return R(t)&&R(t.entries)?k(lt,t):{...lt}},nc=t=>{let e=ws(),n={};return Object.keys(e).forEach(s=>{n[s]=t?.[s]||e[s]}),n.initial_referrer=t?.initial_referrer||o.session.initialReferrer.value,n.initial_referring_domain=t?.initial_referring_domain||o.session.initialReferringDomain.value,n},sc=(t,e)=>{let n=e?.page||{},s=t,i=ws();return Object.keys(i).forEach(r=>{U(s[r])&&(s[r]=n[r]||i[r])}),U(s.initial_referrer)&&(s.initial_referrer=n.initial_referrer||o.session.initialReferrer.value),U(s.initial_referring_domain)&&(s.initial_referring_domain=n.initial_referring_domain||o.session.initialReferringDomain.value),s},ft=(t,e,n)=>{R(t)&&Object.keys(t).forEach(s=>{(gt.includes(s)||gt.includes(s.toLowerCase()))&&n.warn(wr(vt,s,e,gt))})},ic=(t,e)=>{let{properties:n,traits:s,context:i}=t,{traits:r}=i;ft(n,"properties",e),ft(s,"traits",e),ft(r,"context.traits",e)},rc=(t,e)=>{e.anonymousId&&O(e.anonymousId)&&(t.anonymousId=e.anonymousId),te(e.integrations)&&(t.integrations=e.integrations),e.originalTimestamp&&O(e.originalTimestamp)&&(t.originalTimestamp=e.originalTimestamp)},oc=(t,e,n)=>{let s=t,i=r=>{let a=Us(r,n);if(nn(a)){n.warn(xe(vt));return}s=k(s,a)};return Object.keys(e).forEach(r=>{Hl.includes(r)||(r!=="context"?i({[r]:e[r]}):!U(e[r])&&R(e[r])?i(e[r]):n.warn(Mr(vt)))}),s},ac=(t,e,n)=>{R(e)&&(rc(t,e),t.context=oc(t.context,e,n))},lc=t=>{let e;return o.loadOptions.value.useGlobalIntegrationsConfigInEvents?e=o.consents.postConsent.value.integrations??o.nativeDestinations.loadOnlyIntegrations.value:t?e=t:e=as,m(e)},be=(t,e,n,s,i={})=>{let r={channel:jl,context:{traits:m(o.session.userTraits.value),sessionId:o.session.sessionInfo.value.id||void 0,sessionStart:o.session.sessionInfo.value.sessionStart||void 0,...o.consents.enabled.value&&{consentManagement:{deniedConsentIds:m(o.consents.data.value.deniedConsentIds),allowedConsentIds:m(o.consents.data.value.allowedConsentIds),provider:o.consents.provider.value,resolutionStrategy:o.consents.resolutionStrategy.value}},"ua-ch":o.context["ua-ch"].value,app:o.context.app.value,library:o.context.library.value,userAgent:o.context.userAgent.value,os:o.context.os.value,locale:o.context.locale.value,screen:o.context.screen.value,campaign:fl(globalThis.location.href),page:nc(n),timezone:o.context.timezone.value,...o.autoTrack.enabled.value&&{autoTrack:{...o.autoTrack.pageLifecycle.enabled.value&&{page:{pageViewId:o.autoTrack.pageLifecycle.pageViewId.value}}}}},originalTimestamp:Si(),messageId:Ze(),userId:t.userId||o.session.userId.value};Re(o.storage.entries.value.anonymousId?.type)?r.anonymousId=o.session.anonymousId.value:r.anonymousId=xt(),o.storage.trulyAnonymousTracking.value&&(r.context.trulyAnonymousTracking=!0),t.type==="identify"&&(r.context.traits=o.storage.entries.value.userTraits?.type!==ue?m(o.session.userTraits.value):t.context.traits),t.type==="group"&&((t.groupId||o.session.groupId.value)&&(r.groupId=t.groupId||o.session.groupId.value),(t.traits||o.session.groupTraits.value)&&(r.traits=o.storage.entries.value.groupTraits?.type!==ue?m(o.session.groupTraits.value):t.traits));let a=k(t,r),l=k(a,{context:i});return l.event===void 0&&(l.event=null),l.properties===void 0&&(l.properties=null),ac(l,e,s),ic(l,s),l.integrations=lc(l.integrations),l},Gt=class{constructor(e){this.logger=e}generatePageEvent(e,n,s,i,r={}){let a=s??{};return a=sc(a,i),be({properties:a,name:n,category:e,type:"page"},i,a,this.logger,r)}generateTrackEvent(e,n,s,i={}){return be({properties:n,event:e,type:"track"},s,void 0,this.logger,i)}generateIdentifyEvent(e,n,s,i={}){return be({userId:e,type:"identify",context:{traits:n}},s,void 0,this.logger,i)}generateAliasEvent(e,n,s,i={}){let a=be({previousId:n,type:"alias"},s,void 0,this.logger,i);return a.userId=e??a.userId,a}generateGroupEvent(e,n,s,i={}){let r={type:"group"};return e&&(r.groupId=e),n&&(r.traits=n),be(r,s,void 0,this.logger,i)}create(e,n={}){let s,{type:i,name:r,properties:a,options:l,category:u,userId:d,traits:h,to:y,from:T,groupId:g}=e;switch(i){case"page":s=this.generatePageEvent(u,r,a,l,n);break;case"track":s=this.generateTrackEvent(r,a,l,n);break;case"identify":s=this.generateIdentifyEvent(d,h,l,n);break;case"alias":s=this.generateAliasEvent(y,T,l,n);break;default:s=this.generateGroupEvent(g,h,l,n);break}return s}},Ft=class{constructor(e,n,s,i){this.eventRepository=e,this.userSessionManager=n,this.errorHandler=s,this.logger=i,this.eventFactory=new Gt(this.logger)}init(){this.eventRepository.init()}resume(){this.eventRepository.resume()}addEvent(e,n){this.userSessionManager.refreshSession();let s=this.eventFactory.create(e,n);this.eventRepository.enqueue(s,e.callback)}},Vt=class{constructor(e,n,s,i,r){this.storeManager=n,this.pluginsManager=e,this.logger=r,this.errorHandler=i,this.httpClient=s,this.onError=this.onError.bind(this),this.serverSideCookieDebounceFuncs={},this.serverSideCookiesRequestInProgress={}}init(){this.syncStorageDataToState(),this.registerEffects()}syncStorageDataToState(){this.migrateStorageIfNeeded(),this.migrateDataFromPreviousStorage(),this.setUserId(this.getUserId()),this.setUserTraits(this.getUserTraits()),this.setGroupId(this.getGroupId()),this.setGroupTraits(this.getGroupTraits());let{externalAnonymousIdCookieName:e,anonymousIdOptions:n}=o.loadOptions.value,s;pe(e)&&typeof e=="string"&&(s=this.getExternalAnonymousIdByCookieName(e)),this.setAnonymousId(s??this.getAnonymousId(n)),this.setAuthToken(this.getAuthToken()),this.setInitialReferrerInfo(),this.configureSessionTracking()}configureSessionTracking(){let e;if(this.isPersistenceEnabledForStorageEntry("sessionInfo")){let n=this.getConfiguredSessionTrackingInfo(),s=this.getSessionInfo()??b.sessionInfo;e={autoTrack:n.autoTrack&&s.manualTrack!==!0,timeout:n.timeout,manualTrack:s.manualTrack,expiresAt:s.expiresAt,id:s.id,sessionStart:s.sessionStart},!e.autoTrack&&e.manualTrack!==!0?e=b.sessionInfo:n.cutOff?.enabled===!0&&(e.cutOff={enabled:!0,duration:n.cutOff.duration,expiresAt:s.cutOff?.expiresAt})}else e=b.sessionInfo;o.session.sessionInfo.value=e,o.session.sessionInfo.value.autoTrack&&this.startOrRenewAutoTracking(o.session.sessionInfo.value)}setInitialReferrerInfo(){let e=this.getInitialReferrer(),n=this.getInitialReferringDomain();if(e&&n)this.setInitialReferrer(e),this.setInitialReferringDomain(n);else{let s=e||Ls();this.setInitialReferrer(s),this.setInitialReferringDomain(Ps(s))}}isPersistenceEnabledForStorageEntry(e){return Re(o.storage.entries.value[e]?.type)}migrateDataFromPreviousStorage(){let e=o.storage.entries.value,n=[x,F,V];Object.keys(e).forEach(s=>{let i=s,r=e[i]?.type,a=this.storeManager?.getStore(fe[r]);a&&n.forEach(l=>{let u=this.storeManager?.getStore(fe[l]);if(u&&l!==r){let d=u.get(ge[i]);ei(d)&&a.set(ge[i],d),u.remove(ge[i])}})})}migrateStorageIfNeeded(e,n){if(!o.storage.migrate.value)return;let s=e??[];s.length===0&&[As,Rs,_s].forEach(a=>{let l=this.storeManager?.getStore(a);l&&s.push(l)}),(n??Object.keys(ge)).forEach(r=>{let a=ge[r];s.forEach(l=>{let u=this.pluginsManager?.invokeSingle("storage.migrate",a,l.engine,this.errorHandler,this.logger);W(u)||l.set(a,u)})})}getConfiguredSessionTrackingInfo(){let e=o.loadOptions.value.sessions.autoTrack!==!1;if(!e)return{autoTrack:e};let n,s=o.loadOptions.value.sessions?.timeout;Je(s)?n=s:(this.logger.warn(Br(oe,s,mt)),n=mt),n===0&&(this.logger.warn(Fr(oe)),e=!1),n>0&&n<pn&&this.logger.warn(Vr(oe,n,pn));let i=this.getCutOffInfo(n);return{timeout:n,autoTrack:e,cutOff:i}}getCutOffInfo(e){let n=o.loadOptions.value.sessions.cutOff,s,i=!1;return n.enabled===!0&&(s=n.duration,i=!0,Je(s)?s<e&&(this.logger.warn(Gr(oe,s,e)),i=!1):(this.logger.warn(xr(oe,s,hn)),s=hn)),{enabled:i,duration:s}}onError(e,n,s){this.errorHandler.onError({error:e,context:oe,customMessage:n,groupingHash:s})}getEncryptedCookieData(e,n){let s=[];return e.forEach(i=>{let r=n?.encrypt(K(i.value,!1,[],this.logger));pe(r)&&s.push({name:i.name,value:r})}),s}makeRequestToSetCookie(e,n){this.httpClient?.getAsyncData({url:o.serverCookies.dataServiceUrl.value,options:{method:"POST",data:K({reqType:"setCookies",workspaceId:o.source.value?.workspaceId,data:{options:{maxAge:o.storage.cookie.value?.maxage,path:o.storage.cookie.value?.path,domain:o.storage.cookie.value?.domain,sameSite:o.storage.cookie.value?.samesite,secure:o.storage.cookie.value?.secure,expires:o.storage.cookie.value?.expires},cookies:e}}),sendRawData:!0,withCredentials:!0},isRawResponse:!0,callback:n})}setServerSideCookies(e,n,s){let i=Object.keys(e),r=()=>i.map(d=>({name:e[d].name,value:o.session[d].value})),a={};i.forEach(d=>{a[e[d].name]=s?.get(e[d].name)});let l=()=>{i.forEach(d=>{this.serverSideCookiesRequestInProgress[d]=!1})},u=()=>{r().forEach(d=>{n&&n(d.name,d.value)})};try{let d={};i.forEach(y=>{d[e[y].name]=o.session[y].value});let h=this.getEncryptedCookieData(r(),s);h.length>0?this.makeRequestToSetCookie(h,(y,T)=>{l(),T?.xhr?.status===200?r().forEach(g=>{let p=a[g.name],I=s?.get(g.name);K(d[g.name],!1,[])!==K(I,!1,[])&&(G(p)&&G(I)&&this.logger.error(Nr(g.name)),n&&n(g.name,g.value))}):(this.logger.error(Cr(T?.xhr?.status)),u())}):(u(),l())}catch(d){this.onError(d,In,In),u(),l()}}syncValueToStorage(e){let n=o.storage.entries.value,s=n[e]?.type;if(Re(s)){let i=this.storeManager.getStore(fe[s]),r=n[e]?.key,a=o.session[e].value;a&&(O(a)||te(a))?o.serverCookies.isEnabledServerSideCookies.value&&s===x?(this.serverSideCookiesRequestInProgress[e]=!0,this.serverSideCookieDebounceFuncs[e]&&globalThis.clearTimeout(this.serverSideCookieDebounceFuncs[e]),this.serverSideCookieDebounceFuncs[e]=globalThis.setTimeout(()=>{let l={[e]:{name:r}};this.setServerSideCookies(l,(u,d)=>{i?.set(u,d)},i)},fo)):i?.set(r,a):i?.remove(r)}}registerEffects(){Os.forEach(e=>{X(()=>{this.syncValueToStorage(e)})})}setAnonymousId(e,n){let s=e;(!O(e)||!s)&&(s=void 0),this.isPersistenceEnabledForStorageEntry("anonymousId")?(!s&&n&&(s=this.pluginsManager?.invokeSingle("userSession.anonymousIdGoogleLinker",n)),s=s||xt()):s=b.anonymousId,o.session.anonymousId.value=s}getAnonymousId(e){let n=o.storage.entries.value.anonymousId?.type;if(Re(n)){let s=o.session.anonymousId.value;(!s||s===b.anonymousId)&&(s=this.getEntryValue("anonymousId")),!s&&e&&(s=this.pluginsManager?.invokeSingle("storage.getAnonymousId",H,e)),o.session.anonymousId.value=s||xt()}return o.session.anonymousId.value}getEntryValue(e){let n=o.storage.entries.value,s=n[e]?.type;if(Re(s)){let i=this.storeManager?.getStore(fe[s]);this.migrateStorageIfNeeded([i],[e]);let r=n[e]?.key;return i?.get(r)??null}return null}getExternalAnonymousIdByCookieName(e){let n=H(x);return n?.isEnabled?n.getItem(e)??null:null}getUserSessionValue(e){return this.serverSideCookiesRequestInProgress[e]?o.session[e].value:this.getEntryValue(e)}getUserId(){return this.getUserSessionValue("userId")}getUserTraits(){return this.getUserSessionValue("userTraits")}getGroupId(){return this.getUserSessionValue("groupId")}getGroupTraits(){return this.getUserSessionValue("groupTraits")}getInitialReferrer(){return this.getUserSessionValue("initialReferrer")}getInitialReferringDomain(){return this.getUserSessionValue("initialReferringDomain")}getSessionInfo(){return this.getUserSessionValue("sessionInfo")}getAuthToken(){return this.getUserSessionValue("authToken")}getSessionId(){let e=this.getSessionInfo()??b.sessionInfo;return e.autoTrack&&!Mn(e)||e.manualTrack?e.id??null:null}refreshSession(){let e=this.getSessionInfo()??b.sessionInfo;(e.autoTrack||e.manualTrack)&&(e.autoTrack&&(this.startOrRenewAutoTracking(e),e=o.session.sessionInfo.value),e.sessionStart===void 0?e={...e,sessionStart:!0}:e.sessionStart&&(e={...e,sessionStart:!1})),o.session.sessionInfo.value=e,o.lifecycle.status.value!=="readyExecuted"&&this.syncValueToStorage("sessionInfo")}resetAndStartNewSession(){let e=o.session,{manualTrack:n,autoTrack:s,timeout:i,cutOff:r}=e.sessionInfo.value;if(s){let a={...b.sessionInfo,timeout:i};r&&(a.cutOff={enabled:r.enabled,duration:r.duration}),e.sessionInfo.value=a,this.startOrRenewAutoTracking(e.sessionInfo.value)}else n&&this.startManualTrackingInternal()}reset(e){let{session:n}=o,s=tc(e);w(()=>{Object.keys(b).forEach(i=>{let r=i;if(s.entries[r]===!0)switch(i){case"anonymousId":this.setAnonymousId();break;case"sessionInfo":this.resetAndStartNewSession();break;default:n[r].value=b[r];break}})})}setUserId(e){o.session.userId.value=this.isPersistenceEnabledForStorageEntry("userId")&&e?e:b.userId}setUserTraits(e){o.session.userTraits.value=this.isPersistenceEnabledForStorageEntry("userTraits")&&R(e)?k(o.session.userTraits.value??b.userTraits,e):b.userTraits}setGroupId(e){o.session.groupId.value=this.isPersistenceEnabledForStorageEntry("groupId")&&e?e:b.groupId}setGroupTraits(e){o.session.groupTraits.value=this.isPersistenceEnabledForStorageEntry("groupTraits")&&R(e)?k(o.session.groupTraits.value??b.groupTraits,e):b.groupTraits}setInitialReferrer(e){o.session.initialReferrer.value=this.isPersistenceEnabledForStorageEntry("initialReferrer")&&e?e:b.initialReferrer}setInitialReferringDomain(e){o.session.initialReferringDomain.value=this.isPersistenceEnabledForStorageEntry("initialReferringDomain")&&e?e:b.initialReferringDomain}startOrRenewAutoTracking(e){let n=e;if(Mn(e))n=Zl(e);else{let s=Date.now(),i=e.timeout;n.expiresAt=s+i}if(Bs(n)&&(n.cutOff.expiresAt=void 0),n.cutOff){let s=Jl(n.cutOff);n.cutOff.expiresAt=s}o.session.sessionInfo.value=n}start(e){o.session.sessionInfo.value=ec(e,this.logger)}startManualTrackingInternal(){this.start(Date.now())}end(){o.session.sessionInfo.value=b.sessionInfo}setAuthToken(e){o.session.authToken.value=this.isPersistenceEnabledForStorageEntry("authToken")&&e?e:b.authToken}},cc=["BeaconQueue","CustomConsentManager","DeviceModeDestinations","DeviceModeTransformation","ExternalAnonymousId","GoogleLinker","IubendaConsentManager","KetchConsentManager","NativeDestinationQueue","OneTrustConsentManager","StorageEncryption","StorageEncryptionLegacy","StorageMigrator","XhrQueue"],uc=cc,dc=(t,e)=>{let n=m(e);return O(n.setCookieDomain)||(n.setCookieDomain=void 0),["Strict","Lax","None"].includes(n.sameSiteCookie)||(n.sameSiteCookie=void 0),n.secureCookie=z(n.secureCookie,t.secureCookie),n.sameDomainCookiesOnly=z(n.sameDomainCookiesOnly,t.sameDomainCookiesOnly),["none","default","full"].includes(n.uaChTrackLevel)||(n.uaChTrackLevel=void 0),n.integrations=Y(n.integrations),Array.isArray(n.plugins)||(n.plugins=uc),n.useGlobalIntegrationsConfigInEvents=z(n.useGlobalIntegrationsConfigInEvents,t.useGlobalIntegrationsConfigInEvents),n.bufferDataPlaneEventsUntilReady=z(n.bufferDataPlaneEventsUntilReady,t.bufferDataPlaneEventsUntilReady),n.sendAdblockPage=z(n.sendAdblockPage,t.sendAdblockPage),n.useServerSideCookies=z(n.useServerSideCookies,t.useServerSideCookies),O(n.dataServiceEndpoint)||(n.dataServiceEndpoint=void 0),n.sendAdblockPageOptions=Y(n.sendAdblockPageOptions),n.loadIntegration=z(n.loadIntegration,t.loadIntegration),te(n.storage)?(n.storage.migrate=z(n.storage.migrate,t.storage?.migrate),n.storage.cookie=Y(n.storage.cookie),n.storage.encryption=Y(n.storage.encryption),n.storage=Ne(n.storage)):n.storage=void 0,n.destinationsQueueOptions=Y(n.destinationsQueueOptions),n.queueOptions=Y(n.queueOptions),n.lockIntegrationsVersion=z(n.lockIntegrationsVersion,t.lockIntegrationsVersion),n.lockPluginsVersion=z(n.lockPluginsVersion,t.lockPluginsVersion),$s(n.dataPlaneEventsBufferTimeout)||(n.dataPlaneEventsBufferTimeout=void 0),n.beaconQueueOptions=Y(n.beaconQueueOptions),n.preConsent=Y(n.preConsent),n.sourceConfigurationOverride=Y(n.sourceConfigurationOverride),k(t,Ne(n))},$n="dataplaneEventsQueue",Bn="destinationsEventsQueue",gc="transformEvent",fc=(t,e)=>Object.keys(t).filter(n=>t[n]!==!0||!e[n]).reduce((n,s)=>{let i=m(n);return i[s]=t[s],i},{}),hc=(t,e)=>{let n=m(t),s=e.nativeDestinations.integrationsConfig.value,i=fc(t.integrations,s);return n.integrations=k(s,i),n},pc=t=>t.consents.preConsent.value.enabled&&t.consents.preConsent.value.events?.delivery==="buffer",He=(t,e,n,s)=>{if(A(t))if(f(t))try{t(...e)}catch(i){s.error(Wr(n),i)}else s.error(os(n))},jt=class{constructor(e,n,s,i,r){this.pluginsManager=e,this.errorHandler=i,this.httpClient=s,this.logger=r,this.storeManager=n}init(){this.dataplaneEventsQueue=this.pluginsManager.invokeSingle(`${$n}.init`,o,this.httpClient,this.storeManager,this.errorHandler,this.logger),this.dmtEventsQueue=this.pluginsManager.invokeSingle(`${gc}.init`,o,this.pluginsManager,this.httpClient,this.storeManager,this.errorHandler,this.logger),this.destinationsEventsQueue=this.pluginsManager.invokeSingle(`${Bn}.init`,o,this.pluginsManager,this.storeManager,this.dmtEventsQueue,this.errorHandler,this.logger),X(()=>{o.nativeDestinations.clientDestinationsReady.value===!0&&(this.destinationsEventsQueue?.start(),this.dmtEventsQueue?.start())});let e=pc(o),n;X(()=>{let s=o.loadOptions.value.bufferDataPlaneEventsUntilReady===!0&&o.nativeDestinations.clientDestinationsReady.value===!1;(o.nativeDestinations.activeDestinations.value.some(r=>ma(r))===!1||s===!1)&&!e&&this.dataplaneEventsQueue?.scheduleTimeoutActive!==!0&&(globalThis.clearTimeout(n),this.dataplaneEventsQueue?.start())}),o.loadOptions.value.bufferDataPlaneEventsUntilReady===!0&&(n=globalThis.setTimeout(()=>{this.dataplaneEventsQueue?.scheduleTimeoutActive!==!0&&this.dataplaneEventsQueue?.start()},o.loadOptions.value.dataPlaneEventsBufferTimeout))}resume(){this.dataplaneEventsQueue?.scheduleTimeoutActive!==!0&&(o.consents.postConsent.value.discardPreConsentEvents&&(this.dataplaneEventsQueue?.clear(),this.destinationsEventsQueue?.clear()),this.dataplaneEventsQueue?.start())}enqueue(e,n){let s=hc(e,o);this.pluginsManager.invokeSingle(`${$n}.enqueue`,o,this.dataplaneEventsQueue,s,this.errorHandler,this.logger);let i=m(e);this.pluginsManager.invokeSingle(`${Bn}.enqueue`,o,this.destinationsEventsQueue,i,this.errorHandler,this.logger);let r=`${e.type.charAt(0).toUpperCase()}${e.type.slice(1)}${Xt}`;He(n,[s],r,this.logger)}},xn=t=>{let e=new CustomEvent(t,{detail:{analyticsInstance:globalThis.rudderanalytics},bubbles:!0,cancelable:!0,composed:!0});globalThis.document.dispatchEvent(e)},vc=t=>O(t)&&t.trim().length>0,mc=t=>me(t),Ht=class{constructor(){this.preloadBuffer=new Et,this.initialized=!1,this.errorHandler=Ss,this.logger=ne,this.customContextStore=new Bt(o.customContext,this.logger),this.externalSrcLoader=new ze(this.logger),this.httpClient=vs,this.httpClient.init(this.errorHandler),this.capabilitiesManager=new $t(this.httpClient,this.errorHandler,this.logger)}load(e,n,s={}){if(o.lifecycle.status.value)return;if(!vc(e)){this.logger.error(Ir(we,e));return}if(!mc(n)){this.logger.error(br(we,n));return}let{context:i,...r}=s,a=S(r);i!==void 0&&this.customContextStore.set(i),w(()=>{o.lifecycle.writeKey.value=m(e),o.lifecycle.dataPlaneUrl.value=m(n),o.loadOptions.value=dc(o.loadOptions.value,a),o.lifecycle.status.value="mounted"}),this.logger.setMinLogLevel(o.loadOptions.value.logLevel??is),De("state",o,e),this.startLifecycle()}setCustomContext(e){if(!o.lifecycle.loaded.value){o.eventBuffer.toBeProcessedArray.value=[...o.eventBuffer.toBeProcessedArray.value,["setCustomContext",e]];return}this.customContextStore.set(e)}getCustomContext(){return this.customContextStore.get()}clearCustomContext(){if(!o.lifecycle.loaded.value){o.eventBuffer.toBeProcessedArray.value=[...o.eventBuffer.toBeProcessedArray.value,["clearCustomContext"]];return}this.customContextStore.clear()}startLifecycle(){X(()=>{try{switch(o.lifecycle.status.value){case"mounted":this.onMounted();break;case"browserCapabilitiesReady":this.onBrowserCapabilitiesReady();break;case"configured":this.onConfigured();break;case"pluginsLoading":break;case"pluginsReady":this.onPluginsReady();break;case"initialized":this.onInitialized();break;case"loaded":this.onLoaded();break;case"destinationsLoading":break;case"destinationsReady":this.onDestinationsReady();break;case"ready":this.onReady();break;default:break}}catch(e){let n="Failed to load the SDK";this.errorHandler.onError({error:e,context:we,customMessage:n,groupingHash:n})}})}onBrowserCapabilitiesReady(){zi(this),this.prepareInternalServices(),this.loadConfig()}onLoaded(){this.processBufferedEvents(),o.consents.preConsent.value.enabled===!0?o.lifecycle.status.value="ready":this.loadDestinations()}onMounted(){this.capabilitiesManager.init()}enqueuePreloadBufferEvents(e){Array.isArray(e)&&e.forEach(n=>this.preloadBuffer.enqueue(m(n)))}processDataInPreloadBuffer(){for(;this.preloadBuffer.size()>0;){let e=this.preloadBuffer.dequeue();e&&Qi([...e],this)}}prepareInternalServices(){this.pluginsManager=new _t(pa,this.errorHandler,this.logger),this.storeManager=new Lt(this.pluginsManager,this.errorHandler,this.logger),this.configManager=new Ut(this.httpClient,this.errorHandler,this.logger),this.userSessionManager=new Vt(this.pluginsManager,this.storeManager,this.httpClient,this.errorHandler,this.logger),this.eventRepository=new jt(this.pluginsManager,this.storeManager,this.httpClient,this.errorHandler,this.logger),this.eventManager=new Ft(this.eventRepository,this.userSessionManager,this.errorHandler,this.logger)}loadConfig(){o.lifecycle.writeKey.value&&this.httpClient.setAuthHeader(o.lifecycle.writeKey.value),this.configManager?.init()}onPluginsReady(){this.storeManager?.init(),this.userSessionManager?.init(),o.consents.enabled.value&&!o.consents.initialized.value&&(this.pluginsManager?.invokeSingle("consentManager.init",o,this.logger),o.consents.preConsent.value.enabled===!1&&this.pluginsManager?.invokeSingle("consentManager.updateConsentsInfo",o,this.storeManager,this.logger)),this.eventManager?.init(),o.lifecycle.status.value="initialized"}onConfigured(){this.pluginsManager?.init()}onInitialized(){this.processDataInPreloadBuffer(),w(()=>{o.lifecycle.loaded.value=!0,o.lifecycle.status.value="loaded"}),this.initialized=!0;let e=o.loadOptions.value.onLoaded;He(e,[globalThis.rudderanalytics],ui,this.logger),xn("RSA_Initialised")}onReady(){o.lifecycle.status.value="readyExecuted",o.eventBuffer.readyCallbacksArray.value.forEach(e=>{He(e,[],ot,this.logger)}),xn("RSA_Ready")}processBufferedEvents(){let e=o.eventBuffer.toBeProcessedArray.value;for(;e.length>0;){let n=e.shift();o.eventBuffer.toBeProcessedArray.value=e,n&&this.processBufferedEvent(n),e=o.eventBuffer.toBeProcessedArray.value}}processBufferedEvent(e){switch(e[0]){case"setCustomContext":this.setCustomContext(e[1]);break;case"clearCustomContext":this.clearCustomContext();break;case"ready":this.ready(e[1],!0);break;case"page":this.page(e[1],!0,e[2]);break;case"track":this.track(e[1],!0,e[2]);break;case"identify":this.identify(e[1],!0,e[2]);break;case"alias":this.alias(e[1],!0,e[2]);break;case"group":this.group(e[1],!0,e[2]);break;case"reset":this.reset(e[1],!0);break;case"setAnonymousId":this.setAnonymousId(e[1],e[2],!0);break;case"startSession":this.startSession(e[1],!0);break;case"endSession":this.endSession(!0);break;case"consent":this.consent(e[1],!0);break;case"addCustomIntegration":this.addCustomIntegration(e[1],e[2],!0);break;default:return e}}getInvocationContext(e){return e===void 0?this.customContextStore.get():Ms(e,this.logger)??{}}loadDestinations(){if(o.lifecycle.status.value==="destinationsLoading"||o.nativeDestinations.clientDestinationsReady.value===!0)return;this.pluginsManager?.invokeSingle("nativeDestinations.setActiveDestinations",o,this.pluginsManager,this.errorHandler,this.logger);let e=o.nativeDestinations.activeDestinations.value.length;if(e===0){w(()=>{o.nativeDestinations.clientDestinationsReady.value=!0,o.lifecycle.status.value="destinationsReady"});return}o.lifecycle.status.value="destinationsLoading",this.pluginsManager?.invokeSingle("nativeDestinations.load",o,this.externalSrcLoader,this.errorHandler,this.logger),X(()=>{o.nativeDestinations.initializedDestinations.value.length+o.nativeDestinations.failedDestinations.value.length===e&&w(()=>{o.lifecycle.status.value="destinationsReady",o.nativeDestinations.clientDestinationsReady.value=!0})})}onDestinationsReady(){o.lifecycle.status.value!=="ready"&&w(()=>{o.lifecycle.status.value="ready"})}ready(e,n=!1){let s="ready";if(!o.lifecycle.loaded.value){o.eventBuffer.toBeProcessedArray.value=[...o.eventBuffer.toBeProcessedArray.value,[s,e]];return}if(this.errorHandler.leaveBreadcrumb(`New ${s} invocation`),!f(e)){this.logger.error(os(ot));return}o.lifecycle.status.value==="readyExecuted"?He(e,[],ot,this.logger):o.eventBuffer.readyCallbacksArray.value=[...o.eventBuffer.readyCallbacksArray.value,e]}page(e,n=!1,s){let i="page";if(!o.lifecycle.loaded.value){o.eventBuffer.toBeProcessedArray.value=[...o.eventBuffer.toBeProcessedArray.value,[i,e]];return}let r=this.getInvocationContext(s);this.errorHandler.leaveBreadcrumb(`New ${i} event`),o.metrics.triggered.value+=1,this.eventManager?.addEvent({type:"page",category:e.category,name:e.name,properties:e.properties,options:e.options,callback:e.callback},r),o.capabilities.isAdBlocked.value===!0&&e.category!==dn&&this.page(We(dn,Li,{path:wi},o.loadOptions.value.sendAdblockPageOptions),n,r)}track(e,n=!1,s){let i="track";if(!o.lifecycle.loaded.value){o.eventBuffer.toBeProcessedArray.value=[...o.eventBuffer.toBeProcessedArray.value,[i,e]];return}let r=this.getInvocationContext(s);this.errorHandler.leaveBreadcrumb(`New ${i} event - ${e.name}`),o.metrics.triggered.value+=1,this.eventManager?.addEvent({type:i,name:e.name||void 0,properties:e.properties,options:e.options,callback:e.callback},r)}identify(e,n=!1,s){let i="identify";if(!o.lifecycle.loaded.value){o.eventBuffer.toBeProcessedArray.value=[...o.eventBuffer.toBeProcessedArray.value,[i,e]];return}let r=this.getInvocationContext(s);this.errorHandler.leaveBreadcrumb(`New ${i} event`),o.metrics.triggered.value+=1,e.userId&&o.session.userId.value&&e.userId!==o.session.userId.value&&this.reset(),G(e.userId)||this.userSessionManager?.setUserId(e.userId),this.userSessionManager?.setUserTraits(e.traits),this.eventManager?.addEvent({type:i,userId:e.userId,traits:e.traits,options:e.options,callback:e.callback},r)}alias(e,n=!1,s){let i="alias";if(!o.lifecycle.loaded.value){o.eventBuffer.toBeProcessedArray.value=[...o.eventBuffer.toBeProcessedArray.value,[i,e]];return}let r=this.getInvocationContext(s);this.errorHandler.leaveBreadcrumb(`New ${i} event`),o.metrics.triggered.value+=1;let a=e.from??(this.getUserId()||this.userSessionManager?.getAnonymousId());this.eventManager?.addEvent({type:i,to:e.to,from:a,options:e.options,callback:e.callback},r)}group(e,n=!1,s){let i="group";if(!o.lifecycle.loaded.value){o.eventBuffer.toBeProcessedArray.value=[...o.eventBuffer.toBeProcessedArray.value,[i,e]];return}let r=this.getInvocationContext(s);this.errorHandler.leaveBreadcrumb(`New ${i} event`),o.metrics.triggered.value+=1,G(e.groupId)||this.userSessionManager?.setGroupId(e.groupId),this.userSessionManager?.setGroupTraits(e.traits),this.eventManager?.addEvent({type:i,groupId:e.groupId,traits:e.traits,options:e.options,callback:e.callback},r)}reset(e,n=!1){let s="reset";if(!o.lifecycle.loaded.value){o.eventBuffer.toBeProcessedArray.value=[...o.eventBuffer.toBeProcessedArray.value,[s,e]];return}this.errorHandler.leaveBreadcrumb(`New ${s} invocation`),this.userSessionManager?.reset(e)}getAnonymousId(e){return this.userSessionManager?.getAnonymousId(e)}setAnonymousId(e,n,s=!1){let i="setAnonymousId";if(!o.lifecycle.loaded.value){o.eventBuffer.toBeProcessedArray.value=[...o.eventBuffer.toBeProcessedArray.value,[i,e,n]];return}this.errorHandler.leaveBreadcrumb(`New ${i} invocation`),this.userSessionManager?.setAnonymousId(e,n)}getUserId(){return o.session.userId.value}getUserTraits(){return o.session.userTraits.value}getGroupId(){return o.session.groupId.value}getGroupTraits(){return o.session.groupTraits.value}startSession(e,n=!1){let s="startSession";if(!o.lifecycle.loaded.value){o.eventBuffer.toBeProcessedArray.value=[...o.eventBuffer.toBeProcessedArray.value,[s,e]];return}this.errorHandler.leaveBreadcrumb(`New ${s} invocation`),this.userSessionManager?.start(e)}endSession(e=!1){let n="endSession";if(!o.lifecycle.loaded.value){o.eventBuffer.toBeProcessedArray.value=[...o.eventBuffer.toBeProcessedArray.value,[n]];return}this.errorHandler.leaveBreadcrumb(`New ${n} invocation`),this.userSessionManager?.end()}getSessionId(){return this.userSessionManager?.getSessionId()??null}consent(e,n=!1){let s="consent";if(!o.lifecycle.loaded.value){o.eventBuffer.toBeProcessedArray.value=[...o.eventBuffer.toBeProcessedArray.value,[s,e]];return}this.errorHandler.leaveBreadcrumb("New consent invocation"),w(()=>{o.consents.preConsent.value={...o.consents.preConsent.value,enabled:!1},o.consents.postConsent.value=yl(e);let{initialized:i,consentsData:r}=Ds(o.consents.postConsent.value.consentManagement,this.logger);o.consents.initialized.value=i,o.consents.data.value=r}),o.consents.enabled.value&&!o.consents.initialized.value&&this.pluginsManager?.invokeSingle("consentManager.updateConsentsInfo",o,this.storeManager,this.logger),this.storeManager?.initializeStorageState(),this.userSessionManager?.syncStorageDataToState(),this.eventManager?.resume(),this.loadDestinations(),this.sendTrackingEvents(n)}sendTrackingEvents(e){if(o.consents.postConsent.value.trackConsent){let n=Qt(Ui);e?o.eventBuffer.toBeProcessedArray.value=[...o.eventBuffer.toBeProcessedArray.value,["track",n,this.customContextStore.get()]]:this.track(n)}if(o.consents.postConsent.value.sendPageEvent){let n=We();e?o.eventBuffer.toBeProcessedArray.value=[...o.eventBuffer.toBeProcessedArray.value,["page",n,this.customContextStore.get()]]:this.page(n)}}setAuthToken(e){this.userSessionManager?.setAuthToken(e)}addCustomIntegration(e,n,s=!1){let i="addCustomIntegration";if(s)this.errorHandler.leaveBreadcrumb(`New ${i} invocation`),this.pluginsManager?.invokeSingle("nativeDestinations.addCustomIntegration",e,n,o,this.logger);else{if(o.lifecycle.loaded.value){this.logger.error(so(we,e));return}o.eventBuffer.toBeProcessedArray.value=[...o.eventBuffer.toBeProcessedArray.value,[i,e,n]]}}},le=class le{constructor(){C(this,"analyticsInstances",{});C(this,"defaultAnalyticsKey","");C(this,"logger",ne);try{if(le.globalSingleton)return le.globalSingleton;le.initializeGlobalResources(),this.setDefaultInstanceKey=this.setDefaultInstanceKey.bind(this),this.getAnalyticsInstance=this.getAnalyticsInstance.bind(this),this.load=this.load.bind(this),this.ready=this.ready.bind(this),this.triggerBufferedLoadEvent=this.triggerBufferedLoadEvent.bind(this),this.page=this.page.bind(this),this.track=this.track.bind(this),this.identify=this.identify.bind(this),this.alias=this.alias.bind(this),this.group=this.group.bind(this),this.reset=this.reset.bind(this),this.getAnonymousId=this.getAnonymousId.bind(this),this.setAnonymousId=this.setAnonymousId.bind(this),this.getUserId=this.getUserId.bind(this),this.getUserTraits=this.getUserTraits.bind(this),this.getGroupId=this.getGroupId.bind(this),this.getGroupTraits=this.getGroupTraits.bind(this),this.setCustomContext=this.setCustomContext.bind(this),this.getCustomContext=this.getCustomContext.bind(this),this.clearCustomContext=this.clearCustomContext.bind(this),this.startSession=this.startSession.bind(this),this.endSession=this.endSession.bind(this),this.getSessionId=this.getSessionId.bind(this),this.setAuthToken=this.setAuthToken.bind(this),this.consent=this.consent.bind(this),this.addCustomIntegration=this.addCustomIntegration.bind(this),this.createSafeAnalyticsInstance(),le.globalSingleton=this,o.autoTrack.pageLifecycle.pageViewId.value=Ze(),o.autoTrack.pageLifecycle.pageLoadedTimestamp.value=Date.now(),this.triggerBufferedLoadEvent(),globalThis.rudderanalytics=this}catch(e){_(e)}}createSafeAnalyticsInstance(){o.lifecycle.safeAnalyticsInstance.value={page:this.page.bind(this),track:this.track.bind(this),identify:this.identify.bind(this),alias:this.alias.bind(this),group:this.group.bind(this),getAnonymousId:this.getAnonymousId.bind(this),getUserId:this.getUserId.bind(this),getUserTraits:this.getUserTraits.bind(this),getGroupId:this.getGroupId.bind(this),getGroupTraits:this.getGroupTraits.bind(this),getSessionId:this.getSessionId.bind(this)}}static initializeGlobalResources(){Ss.init(),tn.configure(),Zt.configure(),en.configure(),qe.configure()}setDefaultInstanceKey(e){O(e)&&e&&(this.defaultAnalyticsKey=e)}getAnalyticsInstance(e){try{let n=e;return(!O(n)||!n)&&(n=this.defaultAnalyticsKey),this.analyticsInstances[n]||(this.analyticsInstances[n]=new Ht),this.analyticsInstances[n]}catch(n){_(n);return}}load(e,n,s){try{if(this.analyticsInstances[e])return;this.setDefaultInstanceKey(e),this.trackPageLifecycleEvents(s);let i=Jn(_e);Wi(i),De(_e,m(i)),this.getAnalyticsInstance(e)?.load(e,n,s)}catch(i){_(i)}}trackPageLifecycleEvents(e){let{autoTrack:n,useBeacon:s}=e??{},{enabled:i=!1,options:r={},pageLifecycle:a}=n??{},{events:l=[rt.UNLOADED],enabled:u=i,options:d=r}=a??{};o.autoTrack.pageLifecycle.enabled.value=u,o.autoTrack.enabled.value=i||u,u&&this.setupPageUnloadTracking(l,s,d)}setupPageUnloadTracking(e,n,s){(e.length===0||e.includes(rt.UNLOADED))&&(n===!0?Ei(i=>{if(i===!1&&o.lifecycle.loaded.value){let r=Date.now(),a=r-o.autoTrack.pageLifecycle.pageLoadedTimestamp.value;this.track(rt.UNLOADED,{timeOnPage:a},{...s,originalTimestamp:Wn(new Date(r))})}},!0):this.logger.warn(eo(gi)))}triggerBufferedLoadEvent(){let e=Array.isArray(globalThis.rudderanalytics)?globalThis.rudderanalytics:[],n=Ki(e);De(_e,m([...e])),n.length>0&&(n.shift(),this.load.apply(null,n))}ready(e){try{this.getAnalyticsInstance()?.ready(S(e))}catch(n){_(n)}}page(e,n,s,i,r){try{this.getAnalyticsInstance()?.page(We(S(e),S(n),S(s),S(i),S(r)))}catch(a){_(a)}}track(e,n,s,i){try{this.getAnalyticsInstance()?.track(Qt(S(e),S(n),S(s),S(i)))}catch(r){_(r)}}identify(e,n,s,i){try{this.getAnalyticsInstance()?.identify(jn(S(e),S(n),S(s),S(i)))}catch(r){_(r)}}alias(e,n,s,i){try{this.getAnalyticsInstance()?.alias(Hn(S(e),S(n),S(s),S(i)))}catch(r){_(r)}}group(e,n,s,i){try{this.getAnalyticsInstance()?.group(Kn(S(e),S(n),S(s),S(i)))}catch(r){_(r)}}reset(e){try{this.getAnalyticsInstance()?.reset(S(e))}catch(n){_(n)}}getAnonymousId(e){try{return this.getAnalyticsInstance()?.getAnonymousId(S(e))}catch(n){_(n);return}}setAnonymousId(e,n){try{this.getAnalyticsInstance()?.setAnonymousId(S(e),S(n))}catch(s){_(s)}}getUserId(){try{return this.getAnalyticsInstance()?.getUserId()}catch(e){_(e);return}}getUserTraits(){try{return this.getAnalyticsInstance()?.getUserTraits()}catch(e){_(e);return}}getGroupId(){try{return this.getAnalyticsInstance()?.getGroupId()}catch(e){_(e);return}}getGroupTraits(){try{return this.getAnalyticsInstance()?.getGroupTraits()}catch(e){_(e);return}}setCustomContext(e){try{this.getAnalyticsInstance()?.setCustomContext(e)}catch(n){_(n)}}getCustomContext(){try{return this.getAnalyticsInstance()?.getCustomContext()??{}}catch(e){return _(e),{}}}clearCustomContext(){try{this.getAnalyticsInstance()?.clearCustomContext()}catch(e){_(e)}}startSession(e){try{this.getAnalyticsInstance()?.startSession(S(e))}catch(n){_(n)}}endSession(){try{this.getAnalyticsInstance()?.endSession()}catch(e){_(e)}}getSessionId(){try{return this.getAnalyticsInstance()?.getSessionId()}catch(e){_(e);return}}setAuthToken(e){try{this.getAnalyticsInstance()?.setAuthToken(S(e))}catch(n){_(n)}}consent(e){try{this.getAnalyticsInstance()?.consent(S(e))}catch(n){_(n)}}addCustomIntegration(e,n){try{this.getAnalyticsInstance()?.addCustomIntegration(S(e),S(n))}catch(s){_(s)}}};C(le,"globalSingleton",null);var Gn=le;export{Gn as a};
5
+ //# sourceMappingURL=chunk-34EEFBSP.mjs.map