PageSourceSearch

https://www.getirfinans.com/_next/static/chunks/479a7878-d86b20559306fd7b.js

js getirfinans.com collected 2026-10-05 23:27:50 UTC 104,564 bytes, 4 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2086],{72033:(e,t,r)=>{function i(e){return null!=e&&"object"==typeof e&&!0===e["@@functional/placeholder"]}function n(e){return function t(r){return 0==arguments.length||i(r)?t:e.apply(this,arguments)}}function s(e){return function t(r,s){switch(arguments.length){case 0:return t;case 1:return i(r)?t:n(function(t){return e(r,t)});default:return i(r)&&i(s)?t:i(r)?n(function(t){return e(t,s)}):i(s)?n(function(t){return e(r,t)}):e(r,s)}}}function a(e){return function t(r,a,o){switch(arguments.length){case 0:return t;case 1:return i(r)?t:s(function(t,i){return e(r,t,i)});case 2:return i(r)&&i(a)?t:i(r)?s(function(t,r){return e(t,a,r)}):i(a)?s(function(t,i){return e(r,t,i)}):n(function(t){return e(r,a,t)});default:return i(r)&&i(a)&&i(o)?t:i(r)&&i(a)?s(function(t,r){return e(t,r,o)}):i(r)&&i(o)?s(function(t,r){return e(t,a,r)}):i(a)&&i(o)?s(function(t,i){return e(r,t,i)}):i(r)?n(function(t){return e(t,a,o)}):i(a)?n(function(t){return e(r,t,o)}):i(o)?n(function(t){return e(r,a,t)}):e(r,a,o)}}}function o(e,t){return Object.prototype.hasOwnProperty.call(t,e)}r.d(t,{p:()=>it});var l,u,c,d=n(function(e){return null===e?"Null":void 0===e?"Undefined":Object.prototype.toString.call(e).slice(8,-1)});function g(e){return"[object Object]"===Object.prototype.toString.call(e)}let h=Number.isInteger||function(e){return(0|e)===e};var p=function(){function e(){this.map={},this.length=0}return e.prototype.set=function(e,t){var r=this.hash(e),i=this.map[r];i||(this.map[r]=i=[]),i.push([e,t]),this.length+=1},e.prototype.hash=function(e){var t=[];for(var r in e)t.push(Object.prototype.toString.call(e[r]));return t.join()},e.prototype.get=function(e){if(this.length<=180){for(var t in this.map)for(var r=this.map[t],i=0;i<r.length;i+=1){var n=r[i];if(n[0]===e)return n[1]}return}var s=this.hash(e),r=this.map[s];if(r)for(var i=0;i<r.length;i+=1){var n=r[i];if(n[0]===e)return n[1]}},e}(),v=n(function(e){return null!=e&&"function"==typeof e.clone?e.clone():function e(t,r,i){if(i||(i=new p),s=typeof(n=t),null==n||"object"!=s&&"function"!=s)return t;var n,s,a=function(r){var n=i.get(t);if(n)return n;for(var s in i.set(t,r),t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=e(t[s],!0,i));return r};switch(d(t)){case"Object":return a(Object.create(Object.getPrototypeOf(t)));case"Array":return a(Array(t.length));case"Date":return new Date(t.valueOf());case"RegExp":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":""));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}}(e)}),f=a(function(e,t,r){var i,n={};for(i in r=r||{},t=t||{})o(i,t)&&(n[i]=o(i,r)?e(i,t[i],r[i]):t[i]);for(i in r)o(i,r)&&!o(i,n)&&(n[i]=r[i]);return n}),y=a(function e(t,r,i){return f(function(r,i,n){return g(i)&&g(n)?e(t,i,n):t(r,i,n)},r,i)}),m=a(function(e,t,r){return y(function(t,r,i){return e(r,i)},t,r)}),b=s(function(e,t){for(var r=t,i=0;i<e.length;i+=1){if(null==r)return;var n=e[i];r=h(n)?function(e,t){var r=e<0?t.length+e:e;return"[object String]"===Object.prototype.toString.call(t)?t.charAt(r):t[r]}(n,r):r[n]}return r}),E=s(function(e,t){var r={};for(var i in t)e(t[i],i,t)&&(r[i]=t[i]);return r});let k=e=>"function"==typeof e&&!!(e.constructor&&e.call&&e.apply),I=e=>void 0!==e,S=e=>!(e=>null==e)(e),T=e=>{switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return e instanceof Error}},A=(e,t)=>b(t.split("."),e),w=e=>null!==e&&"[object Object]"===Object.prototype.toString.call(e),C=(e,t)=>{if(!Array.isArray(e)||!Array.isArray(t))return v(t);let r=v(e);return t.forEach((e,t)=>{r[t]=Array.isArray(e)||(e=>null!==e&&"object"==typeof e&&!Array.isArray(e))(e)?P(r[t],e):e}),r},P=(e,t)=>m(C,e,t),O=e=>w(e)&&Object.keys(e).length>0,D=e=>{let t=E(I,e);
1return Object.keys(t).forEach(e=>{let r=t[e];w(r)&&(t[e]=D(r))}),t},R=e=>{let t=E(S,e);return Object.keys(t).forEach(e=>{let r=t[e];w(r)&&(t[e]=R(r))}),t},$=e=>{if(O(e))return R(e)},N=(e,t)=>I(t)?I(e)?!0===e:t:!0===e,L=e=>e.replace(/^\.+/,""),M=e=>{let t=e;if("string"!=typeof e&&!(e=>null==e)(e))try{t=JSON.stringify(e)}catch(e){t=null}return t},x=(e,t,r,i,n)=>{let s={category:e,name:t,properties:r,options:i,callback:void 0};k(n)&&(s.callback=n),k(i)&&(s.category=e,s.name=t,s.properties=r,s.options=void 0,s.callback=i),k(r)&&(s.category=e,s.name=t,s.properties=void 0,s.options=void 0,s.callback=r),k(t)&&(s.category=e,s.name=void 0,s.properties=void 0,s.options=void 0,s.callback=t),k(e)&&(s.category=void 0,s.name=void 0,s.properties=void 0,s.options=void 0,s.callback=e),w(e)?(s.name=void 0,s.category=void 0,s.properties=e,k(t)?s.options=void 0:s.options=t):w(t)&&(s.name=void 0,s.properties=t,k(r)?s.options=void 0:s.options=r),"string"==typeof e&&"string"!=typeof t&&(s.category=void 0,s.name=e),I(s.category)||(s.category=void 0),I(s.name)||(s.name=void 0),s.properties=s.properties?v(s.properties):{},I(s.options)?s.options=v(s.options):s.options=void 0;let a="string"==typeof s.name?s.name:s.properties.name,o="string"==typeof s.category?s.category:s.properties.category;return s.properties=P(w(s.properties)?s.properties:{},{...a&&{name:a},...o&&{category:o}}),s},B=(e,t,r,i)=>{let n={name:e,properties:t,options:r,callback:void 0};return k(i)&&(n.callback=i),k(r)&&(n.properties=t,n.options=void 0,n.callback=r),k(t)&&(n.properties=void 0,n.options=void 0,n.callback=t),n.properties=S(n.properties)?v(n.properties):{},I(n.options)?n.options=v(n.options):n.options=void 0,n},U=(e,t,r,i)=>{let n={userId:e,traits:t,options:r,callback:void 0};return k(i)&&(n.callback=i),k(r)&&(n.userId=e,n.traits=t,n.options=void 0,n.callback=r),k(t)&&(n.userId=e,n.traits=void 0,n.options=void 0,n.callback=t),(w(e)||null===e)&&(n.userId=null,n.traits=e,k(t)?n.options=void 0:n.options=t),n.userId=M(n.userId),w(n.traits)?n.traits=v(n.traits):n.traits=void 0,I(n.options)?n.options=v(n.options):n.options=void 0,n},j=(e,t,r,i)=>{let n={to:e,from:t,options:r,callback:void 0};return(k(i)&&(n.callback=i),k(r)&&(n.to=e,n.from=t,n.options=void 0,n.callback=r),k(t))?(n.to=e,n.from=void 0,n.options=void 0,n.callback=t):(w(t)||null===t)&&(n.to=e,n.from=void 0,n.options=t),I(n.to)&&(n.to=M(n.to)),I(n.from)?n.from=M(n.from):n.from=void 0,I(n.options)?n.options=v(n.options):n.options=void 0,n},_=(e,t,r,i)=>{let n={groupId:e,traits:t,options:r,callback:void 0};return k(i)&&(n.callback=i),k(r)&&(n.groupId=e,n.traits=t,n.options=void 0,n.callback=r),k(t)&&(n.groupId=e,n.traits=void 0,n.options=void 0,n.callback=t),(w(e)||null===e)&&(n.groupId=null,n.traits=e,k(t)?n.options=void 0:n.options=t),n.groupId=M(n.groupId),w(n.traits)?n.traits=v(n.traits):n.traits=void 0,I(n.options)?n.options=v(n.options):n.options=void 0,n},H=function(e){return e.UNLOADED="Page Unloaded",e}({}),F="CapabilitiesManager",G="ConfigManager",Q="EventManager",V="PluginsManager",z="UserSessionManager",K="ErrorHandler",q="PluginEngine",J="ReadyAPI",W="AnalyticsCore";for(var X,Z=[],Y=0;Y<256;Y++)Z[Y]=(Y+256).toString(16).substring(1);for(var ee,et=256,er=[];et--;)er[et]=(et+256).toString(16).substring(1);let ei=()=>!(e=>null==e)(globalThis.crypto)&&k(globalThis.crypto.getRandomValues)?function(){(!X||Y+16>4096)&&(X=crypto.getRandomValues(new Uint8Array(4096)),Y=0);for(var e,t=0,r="";t<16;t++)e=X[Y+t],6==t?r+=Z[15&e|64]:8==t?r+=Z[63&e|128]:r+=Z[e],1&t&&t>1&&t<11&&(r+="-");return Y+=16,r}():function(){var e,t=0,r="";if(!ee||et+16>256){for(ee=Array(t=256);t--;)ee[t]=256*Math.random()|0;t=et=0}for(;t<16;t++)e=ee[et+t],6==t?r+=er[15&e|64]:8==t?r+=er[63&e|128]:r+=er[e],1&t&&t>1&&t<11&&(r+="-");return et++,r}(),en=e=>e.toISOString(),es=(e,t)=>`Failed to load the script with the id "${e}" from URL "${t}".`,ea="[Circular Reference]",eo=(e,t,r,i)=>{try{return JSON.stringify(e,((e,t,r)=>{let i=[];return function(n,s){if(!t?.includes(n)){let t;if(!(e&&null==(t=s))){if("object"!=typeof s||null===s)return s;for(;i.length>0&&i[i.length-1]!==this;)i.pop();if(i.includes(s))return r?.warn(`JSONStringify:: A circular reference has been detected in the object and the property "${n}" has been dropped from the output.`),ea;return i.push(s),s}}}})(t,r,i))}catch(e){return i?.warn("Failed to convert the value to a JSON string.",e),null}},el=(e,t)=>
1{let r=Array.isArray(e)?[]:{};for(let i in e)if(Object.hasOwnProperty.call(e,i)){let n=e[i],s=t.call(e,i,n);w(s)||Array.isArray(s)?r[i]=el(s,t):r[i]=s}return r},eu=(e,t)=>{let r=(e=>{let t=[];return function(e,r){if("bigint"==typeof r)return"[BigInt]";for(;t.length>0&&t[t.length-1]!==this;)t.pop();return t.includes(r)?ea:(t.push(r),r)}})(),i=r.call(e,"",e);return w(e)||Array.isArray(e)?el(e,r):i},ec="[SDK DISPATCHED ERROR]",ed=e=>{let{stack:t,stacktrace:r}=e,i=e["opera#sourceloc"],n=t??r??i;if(n&&"string"==typeof n)return n},eg=(e,t)=>{let r=e;return T(e)?r.message=`${t}: ${e.message}`:r=Error(`${t}: ${eo(e)}`),r},eh=e=>{if(T(e)){let t=ed(e);if(t){let{stack:r,stacktrace:i}=e,n=e["opera#sourceloc"];switch(t){case r:e.stack=`${r}
2${ec}`;break;case i:e.stacktrace=`${i}
3${ec}`;break;default:e["opera#sourceloc"]=`${n}
4${ec}`}}}globalThis.dispatchEvent(new ErrorEvent("error",{error:e,bubbles:!0,cancelable:!0,composed:!0}))},ep="RudderLabs JavaScript SDK",ev="3.17.0",ef="RudderJS-Initiated",ey="preloadedEventsBuffer",em="ajs_aid",eb="ajs_uid",eE="ajs_event",ek=1e4,eI=(e="app")=>{globalThis.RudderStackGlobals||(globalThis.RudderStackGlobals={}),globalThis.RudderStackGlobals[e]||(globalThis.RudderStackGlobals[e]={})},eS=(e,t,r="app")=>{eI(r),globalThis.RudderStackGlobals[r][e]=t},eT=(e,t="app")=>(eI(t),globalThis.RudderStackGlobals[t][e]),eA=(e,t)=>{let r={};return e.forEach((i,n)=>{n.startsWith(t)&&(r[n.substring(t.length)]=e.get(n))}),r},ew=(e,t)=>{let r,i=e.shift();if(k(t[i])){switch(i){case"page":r=x(...e);break;case"track":r=B(...e);break;case"identify":r=U(...e);break;case"alias":r=j(...e);break;case"group":r=_(...e);break;default:t[i](...e)}r&&t[i](r)}};class eC{constructor(e,t,r=1e4){this.errorHandler=e,this.logger=t,this.timeout=r,this.onError=this.onError.bind(this)}loadJSFile(e){let{url:t,id:r,timeout:i,async:n,callback:s,extraAttributes:a}=e,o=!k(s);((e,t,r,i=!0,n)=>new Promise((s,a)=>{document.getElementById(t)&&a(Error(`A script with the id "${t}" is already loaded. Skipping the loading of this script to prevent conflicts.`));try{let o;(e=>{let t=document.getElementsByTagName("head");if(t.length>0)return t[0]?.insertBefore(e,t[0]?.firstChild);let r=document.getElementsByTagName("script");if(r.length>0&&r[0]?.parentNode)return r[0]?.parentNode.insertBefore(e,r[0]);let i=document.createElement("head");i.appendChild(e);let n=document.getElementsByTagName("html")[0];n?.insertBefore(i,n.firstChild)})(((e,t,r=!0,i=null,n=null,s={})=>{let a=document.createElement("script");return a.type="text/javascript",a.onload=i,a.onerror=n,a.src=e,a.id=t,a.async=r,Object.keys(s).forEach(e=>{a.setAttribute(e,s[e])}),a.setAttribute("data-loader","RS_JS_SDK"),a})(e,t,i,()=>{globalThis.clearTimeout(o),s(t)},()=>{globalThis.clearTimeout(o),a(Error(es(t,e)))}
4,n)),o=globalThis.setTimeout(()=>{a(Error(`A timeout of ${r} ms occurred while trying to load the script with id "${t}" from URL "${e}".`))},r)}catch(r){a(eg(r,es(t,e)))}}))(t,r,i||this.timeout,n,a).then(e=>{o||s(e)}).catch(e=>{this.onError(e),o||s()})}onError(e){this.errorHandler.onError(e,"ExternalSrcLoader")}}var eP=Symbol.for("preact-signals");function eO(){if(eN>1)eN--;else{for(var e,t=!1;void 0!==e$;){var r=e$;for(e$=void 0,eL++;void 0!==r;){var i=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&ej(r))try{r.c()}catch(r){t||(e=r,t=!0)}r=i}}if(eL=0,eN--,t)throw e}}function eD(e){if(eN>0)return e();eN++;try{return e()}finally{eO()}}var eR=void 0,e$=void 0,eN=0,eL=0,eM=0;function ex(e){if(void 0!==eR){var t=e.n;if(void 0===t||t.t!==eR)return t={i:0,S:e,p:eR.s,n:void 0,t:eR,e:void 0,x:void 0,r:t},void 0!==eR.s&&(eR.s.n=t),eR.s=t,e.n=t,32&eR.f&&e.S(t),t;if(-1===t.i)return t.i=0,void 0!==t.n&&(t.n.p=t.p,void 0!==t.p&&(t.p.n=t.n),t.p=eR.s,t.n=void 0,eR.s.n=t,eR.s=t),t}}function eB(e){this.v=e,this.i=0,this.n=void 0,this.t=void 0}function eU(e){return new eB(e)}function ej(e){for(var t=e.s;void 0!==t;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function e_(e){for(var t=e.s;void 0!==t;t=t.n){var r=t.S.n;if(void 0!==r&&(t.r=r),t.S.n=t,t.i=-1,void 0===t.n){e.s=t;break}}}function eH(e){for(var t=e.s,r=void 0;void 0!==t;){var i=t.p;-1===t.i?(t.S.U(t),void 0!==i&&(i.n=t.n),void 0!==t.n&&(t.n.p=i)):r=t,t.S.n=t.r,void 0!==t.r&&(t.r=void 0),t=i}e.s=r}function eF(e){eB.call(this,void 0),this.x=e,this.s=void 0,this.g=eM-1,this.f=4}function eG(e){var t=e.u;if(e.u=void 0,"function"==typeof t){eN++;var r=eR;eR=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,eQ(e),t}finally{eR=r,eO()}}}function eQ(e){for(var t=e.s;void 0!==t;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,eG(e)}function eV(e){if(eR!==this)throw Error("Out-of-order effect");eH(this),eR=e,this.f&=-2,8&this.f&&eQ(this),eO()}function ez(e){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}function eK(e){var t=new ez(e);try{t.c()}catch(e){throw t.d(),e}return t.d.bind(t)}eB.prototype.brand=eP,eB.prototype.h=function(){return!0},eB.prototype.S=function(e){this.t!==e&&void 0===e.e&&(e.x=this.t,void 0!==this.t&&(this.t.e=e),this.t=e)},eB.prototype.U=function(e){if(void 0!==this.t){var t=e.e,r=e.x;void 0!==t&&(t.x=r,e.e=void 0),void 0!==r&&(r.e=t,e.x=void 0),e===this.t&&(this.t=r)}},eB.prototype.subscribe=function(e){var t=this;return eK(function(){var r=t.value,i=eR;eR=void 0;try{e(r)}finally{eR=i}})},eB.prototype.valueOf=function(){return this.value},eB.prototype.toString=function(){return this.value+""},eB.prototype.toJSON=function(){return this.value},eB.prototype.peek=function(){var e=eR;eR=void 0;try{return this.value}finally{eR=e}},Object.defineProperty(eB.prototype,"value",{get:function(){var e=ex(this);return void 0!==e&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(eL>100)throw Error("Cycle detected");this.v=e,this.i++,eM++,eN++;try{for(var t=this.t;void 0!==t;t=t.x)t.t.N()}finally{eO()}}}}),(eF.prototype=new eB).h=function(){if(this.f&=-3,1&this.f)return!1;if(32==(36&this.f)||(this.f&=-5,this.g===eM))return!0;if(this.g=eM,this.f|=1,this.i>0&&!ej(this))return this.f&=-2,!0;var e=eR;try{e_(this),eR=this;var t=this.x();(16&this.f||this.v!==t||0===this.i)&&(this.v=t,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return eR=e,eH(this),this.f&=-2,!0},eF.prototype.S=function(e){if(void 0===this.t){this.f|=36;for(var t=this.s;void 0!==t;t=t.n)t.S.S(t)}eB.prototype.S.call(this,e)},eF.prototype.U=function(e){if(void 0!==this.t&&(eB.prototype.U.call(this,e),void 0===this.t)){this.f&=-33;for(var t=this.s;void 0!==t;t=t.n)t.S.U(t)}},eF.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;void 0!==e;e=e.x)e.t.N()}},Object.defineProperty(eF.prototype,"value",{get:function(){if(1&this.f)throw Error("Cycle detected");var e=ex(this);if(this.h(),void 0!==e&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),ez.prototype.c=function(){var e=this.S();try{if(8&this.f||void 0===this.x)return;var t=this.x();"function"==typeof t&&(this.u=t)}finally{e()}},ez.prototype.S=function(){if(1&this.f)throw Error("Cycle detected");this.f|=1,this.f&=-9,eG(this),e_(this),eN++;var e=eR;return eR=this,eV.bind(this,e)},ez.prototype.N=function(){2&this.f||(this.f|=2,this.o=e$,e$=this)},ez.prototype.d=function(){this.f|=8,1&this.f||eQ(this)};class eq{constructor(){this.items=[]}enqueue(e){this.items.push(e)}dequeue(){return 0===this.items.length?null:this.items.shift()}isEmpty(){return 0===this.items.length}size(){return this.items.length}clear(){this.items=[]}}let eJ={LOG:0,INFO:1,DEBUG:2,WARN:3,ERROR:4,NONE:5},eW="ERROR";class eX{constructor(e="LOG",t="",r=console){this.minLogLevel=eJ[e],this.scope=t,this.logProvider=r}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,t){this.minLogLevel<=eJ[e]&&this.logProvider[e.toLowerCase()]?.(...this.formatLogData(t))}setScope(e){this.scope=e||this.scope}setMinLogLevel(e){this.minLogLevel=eJ[e],void 0===this.minLogLevel&&(this.minLogLevel=eJ.LOG)}formatLogData(e){if(Array.isArray(e)&&e.length>0){let t="%c RS SDK";this.scope&&(t=`${t} - ${this.scope}`);let r="string"==typeof e[0]?e[0].trim():"",i=[t=`${t} %c ${r}`,"font-weight: bold; background: black; color: white;","font-weight: normal;"];return"string"!=typeof e[0]&&i.push(e[0]),i.push(...e.slice(1)),i}return e}}let eZ=new eX,eY=function(e){return e.HANDLEDEXCEPTION="handledException",e.UNHANDLEDEXCEPTION="unhandledException",e.UNHANDLEDREJECTION="unhandledPromiseRejection",e}({}),e0=["localStorage","memoryStorage","cookieStorage","sessionStorage","none"],e1="cookieStorage",e2="Unable to process/parse source configuration response",e3="Failed to fetch the source config",e6=e=>`${e}:: The provided callback parameter is not a function.`,e8={All:!0},e5="js-integrations",e4="plugins",e9=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_]*)?$"),e7="modern",te="https://cdn.rudderlabs.com",tt=`${te}/v3/${e7}/${e5}`,tr=`${te}/v3/${e7}/${e4}`,ti="https://api.rudderstack.com",tn={iubenda:"IubendaConsentManager",oneTrust:"OneTrustConsentManager",ketch:"KetchConsentManager",custom:"CustomConsentManager"},ts={v3:"StorageEncryption",legacy:"StorageEncryptionLegacy"},ta={xhr:"XhrQueue",beacon:"BeaconQueue"},to=eU(v({configUrl:ti,loadIntegration:!0,sessions:{autoTrack:!0,timeout:18e5}
4,sameSiteCookie:"Lax",polyfillIfRequired:!0,integrations:e8,useBeacon:!1,beaconQueueOptions:{},destinationsQueueOptions:{},queueOptions:{},lockIntegrationsVersion:!0,lockPluginsVersion:!0,uaChTrackLevel:"none",plugins:[],useGlobalIntegrationsConfigInEvents:!1,bufferDataPlaneEventsUntilReady:!1,dataPlaneEventsBufferTimeout:1e4,storage:{encryption:{version:"v3"},migrate:!0,cookie:{}},sendAdblockPage:!1,sameDomainCookiesOnly:!1,secureCookie:!1,sendAdblockPageOptions:{},useServerSideCookies:!1})),tl={userId:"",userTraits:{},anonymousId:"",groupId:"",groupTraits:{},initialReferrer:"",initialReferringDomain:"",sessionInfo:{},authToken:null},tu={autoTrack:!0,timeout:18e5},tc={userId:eU(tl.userId),userTraits:eU(tl.userTraits),anonymousId:eU(tl.anonymousId),groupId:eU(tl.groupId),groupTraits:eU(tl.groupTraits),initialReferrer:eU(tl.initialReferrer),initialReferringDomain:eU(tl.initialReferringDomain),sessionInfo:eU(tl.sessionInfo),authToken:eU(tl.authToken)},td={isOnline:eU(!0),storage:{isLocalStorageAvailable:eU(!1),isCookieStorageAvailable:eU(!1),isSessionStorageAvailable:eU(!1)},isBeaconAvailable:eU(!1),isLegacyDOM:eU(!1),isUaCHAvailable:eU(!1),isCryptoAvailable:eU(!1),isIE11:eU(!1),isAdBlocked:eU(!1)},tg={isErrorReportingEnabled:eU(!1),isMetricsReportingEnabled:eU(!1),breadcrumbs:eU([])},th=eU(void 0),tp={activeDataplaneUrl:eU(void 0),integrationsCDNPath:eU(tt),pluginsCDNPath:eU(tr),sourceConfigUrl:eU(void 0),status:eU(void 0),initialized:eU(!1),logLevel:eU(eW),loaded:eU(!1),readyCallbacks:eU([]),writeKey:eU(void 0),dataPlaneUrl:eU(void 0)},tv={enabled:eU(!1),initialized:eU(!1),data:eU({}),activeConsentManagerPluginName:eU(void 0),preConsent:eU({enabled:!1}),postConsent:eU({}),resolutionStrategy:eU("and"),provider:eU(void 0),metadata:eU(void 0)},tf={retries:eU(0),dropped:eU(0),sent:eU(0),queued:eU(0),triggered:eU(0),metricsServiceUrl:eU(void 0)},ty={app:eU({name:ep,namespace:"com.rudderlabs.javascript",version:ev,installType:"npm"}),traits:eU(null),library:eU({name:ep,version:ev,snippetVersion:globalThis.RudderSnippetVersion}),userAgent:eU(null),device:eU(null),network:eU(null),os:eU({name:"",version:""}),locale:eU(null),screen:eU({density:0,width:0,height:0,innerWidth:0,innerHeight:0}),"ua-ch":eU(void 0),timezone:eU(void 0)},tm={configuredDestinations:eU([]),activeDestinations:eU([]),loadOnlyIntegrations:eU({}),failedDestinations:eU([]),loadIntegration:eU(!0),initializedDestinations:eU([]),clientDestinationsReady:eU(!1),integrationsConfig:eU({})},tb={toBeProcessedArray:eU([]),readyCallbacksArray:eU([])},tE={ready:eU(!1),loadedPlugins:eU([]),failedPlugins:eU([]),pluginsToLoadFromConfig:eU([]),activePlugins:eU([]),totalPluginsToLoad:eU(0)},tk={encryptionPluginName:eU(void 0),migrate:eU(!1),type:eU(void 0),cookie:eU(void 0),entries:eU({}),trulyAnonymousTracking:eU(!1)},tI={isEnabledServerSideCookies:eU(!1),dataServiceUrl:eU(void 0)},tS={eventsQueuePluginName:eU(void 0),deliveryEnabled:eU(!0)},tT={...v({capabilities:td,consents:tv,context:ty,eventBuffer:tb,lifecycle:tp,loadOptions:to,metrics:tf,nativeDestinations:tm,plugins:tE,reporting:tg,session:tc,source:th,storage:tk,serverCookies:tI,dataPlaneEvents:tS,autoTrack:{enabled:eU(!1),pageLifecycle:{enabled:eU(!1),pageViewId:eU(void 0),pageLoadedTimestamp:eU(void 0)}}})};function tA(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var tw={exports:{}},tC={exports:{}};tC.exports,tw.exports;let tP=tA(function(){var e,t,r,i;if(u)return tw.exports;return u=1,e=function(){return l?tC.exports:(l=1,tC.exports=function(){function e(e){return e.charAt(0).toUpperCase()+e.substring(1)}function t(e){return function(){return this[e]}}var r=["isConstructor","isEval","isNative","isToplevel"],i=["columnNumber","lineNumber"],n=["fileName","functionName","source"],s=r.concat(i,n,["args"],["evalOrigin"]);function a(t){if(t)for(var r=0;r<s.length;r++)void 0!==t[s[r]]&&this["set"+e(s[r])](t[s[r]])}a.prototype={getArgs:function(){return this.args},setArgs:function(e){if("[object Array]"!==Object.prototype.toString.call(e))throw TypeError("Args must be an Array");this.args=e},getEvalOrigin:function(){return this.evalOrigin},setEvalOrigin:function(e){if(e instanceof a)this.evalOrigin=e;else if(e instanceof Object)this.evalOrigin=new a(e);else throw TypeError("Eval Origin must be an Object or StackFrame")},toString:function(){var e=this.getFileName()||"",t=this.getLineNumber()||"",r=this.getColumnNumber()||"",i=this.getFunctionName()||"";return this.getIsEval()?e?"[eval] ("+e+":"+t+":"+r+")":"[eval]:"+t+":"+r:i?i+" ("+e+":"+t+":"+r+")":e+":"+t+":"+r}},a.fromString=function(e){var t=e.indexOf("("),r=e.lastIndexOf(")"),i=e.substring(0,t),n=e.substring(t+1,r).split(","),s=e.substring(r+1);if(0===s.indexOf("@"))var o=/@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(s,""),l=o[1],u=o[2],c=o[3];return new a({functionName:i,args:n||void 0,fileName:l,lineNumber:u||void 0,columnNumber:c||void 0})};for(var o=0;o<r.length;o++)a.prototype["get"+e(r[o])]=t(r[o]),a.prototype["set"+e(r[o])]=function(e){return function(t){this[e]=!!t}}(r[o]);for(var l=0;l<i.length;l++)a.prototype["get"+e(i[l])]=t(i[l]),a.prototype["set"+e(i[l])]=function(e){return function(t){if(!(!isNaN(parseFloat(t))&&isFinite(t)))throw TypeError(e+" must be a Number");this[e]=Number(t)}}(i[l]);for(var u=0;u<n.length;u++)a.prototype["get"+e(n[u])]=t(n[u]),a.prototype["set"+e(n[u])]=function(e){return function(t){this[e]=String(t)}}(n[u]);return a}
4(),tC.exports)}(),t=/(^|@)\S+:\d+/,r=/^\s*at .*(\S+:\d+|\(native\))/m,i=/^(eval@)?(\[native code])?$/,tw.exports={parse:function(e){if(void 0!==e.stacktrace||void 0!==e["opera#sourceloc"])return this.parseOpera(e);if(e.stack&&e.stack.match(r))return this.parseV8OrIE(e);if(e.stack)return this.parseFFOrSafari(e);throw Error("Cannot parse given Error object")},extractLocation:function(e){if(-1===e.indexOf(":"))return[e];var t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));return[t[1],t[2]||void 0,t[3]||void 0]},parseV8OrIE:function(t){return t.stack.split("\n").filter(function(e){return!!e.match(r)},this).map(function(t){t.indexOf("(eval ")>-1&&(t=t.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(,.*$)/g,""));var r=t.replace(/^\s+/,"").replace(/\(eval code/g,"(").replace(/^.*?\s+/,""),i=r.match(/ (\(.+\)$)/);r=i?r.replace(i[0],""):r;var n=this.extractLocation(i?i[1]:r);return new e({functionName:i&&r||void 0,fileName:["eval","<anonymous>"].indexOf(n[0])>-1?void 0:n[0],lineNumber:n[1],columnNumber:n[2],source:t})},this)},parseFFOrSafari:function(t){return t.stack.split("\n").filter(function(e){return!e.match(i)},this).map(function(t){if(t.indexOf(" > eval")>-1&&(t=t.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===t.indexOf("@")&&-1===t.indexOf(":"))return new e({functionName:t});
4var r=/((.*".+"[^@]*)?[^@]*)(?:@)/,i=t.match(r),n=i&&i[1]?i[1]:void 0,s=this.extractLocation(t.replace(r,""));return new e({functionName:n,fileName:s[0],lineNumber:s[1],columnNumber:s[2],source:t})},this)},parseOpera:function(e){return!e.stacktrace||e.message.indexOf("\n")>-1&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9:function(t){for(var r=/Line (\d+).*script (?:in )?(\S+)/i,i=t.message.split("\n"),n=[],s=2,a=i.length;s<a;s+=2){var o=r.exec(i[s]);o&&n.push(new e({fileName:o[2],lineNumber:o[1],source:i[s]}))}return n},parseOpera10:function(t){for(var r=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,i=t.stacktrace.split("\n"),n=[],s=0,a=i.length;s<a;s+=2){var o=r.exec(i[s]);o&&n.push(new e({functionName:o[3]||void 0,fileName:o[2],lineNumber:o[1],source:i[s]}))}return n},parseOpera11:function(r){return r.stack.split("\n").filter(function(e){return!!e.match(t)&&!e.match(/^Error created at/)},this).map(function(t){var r,i=t.split("@"),n=this.extractLocation(i.pop()),s=i.shift()||"",a=s.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;return s.match(/\(([^)]*)\)/)&&(r=s.replace(/^[^(]+\(([^)]*)\)$/,"$1")),new e({functionName:a,args:void 0===r||"[arguments not available]"===r?void 0:r.split(","),fileName:n[0],lineNumber:n[1],columnNumber:n[2],source:t})},this)}},tw.exports}()),tO="global code",tD=e=>"string"==typeof e?e:"";function tR(e,t,r,i){return{errorClass:tD(e),message:`${r}${tD(t)}`,type:"browserjs",stacktrace:i.reduce((e,t)=>{let r=(e=>{let t,r={file:e.fileName,method:I(t=e.functionName)&&/^global code$/i.test(t)?tO:t,lineNumber:e.lineNumber,columnNumber:e.columnNumber};return r.lineNumber&&r.lineNumber>-1&&!r.file&&!r.method&&(r.file=tO),r})(t);try{if("{}"===JSON.stringify(r))return e;return e.concat(r)}catch{return e}},[])}}let t$=(e,t)=>{try{return JSON.parse(e||"")}catch(e){t(eg(e,"Failed to parse response data"))}},tN="The request failed",tL=[/Failed to fetch dynamically imported module: .*/],tM=[/Failed to load the script with the id .*/,/A timeout of \d+ ms occurred while trying to load the script with id .*/],tx=[RegExp(`${tN}.*`),/A script with the id .* is already loaded\./],tB={headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8"},method:"GET"},tU=(e,t,r)=>{let i=P(tB,t||{});return r&&(i.headers=P(i.headers,{Authorization:r})),i.url=e,i},tj=(e,t=ek,r)=>new Promise((i,n)=>{let s;if(!0===e.sendRawData)s=e.data;else if(null===(s=eo(e.data,!1,[],r)))return void n({error:Error("Failed to prepare data for the request."),undefined,options:e});let a=new XMLHttpRequest,o=t=>{n({error:Error(((e,t,r)=>`${e} due to timeout or no connection (${t?t.type:""}) at the client side for URL: ${r}`)(tN,t,e.url)),xhr:a,options:e})};a.ontimeout=o,a.onerror=o,a.onload=()=>{a.status>=200&&a.status<400?i({response:a.responseText,xhr:a,options:e}):(t=>{let r,i,s,o;n({error:Error((r=a.status,i=a.statusText,s=e.url,o=a.responseText,`${tN} with status ${r} (${i}) for URL: ${s}. Response: ${o.trim()}`)),xhr:a,options:e})})()},a.open(e.method,e.url,!0),!0===e.withCredentials&&(a.withCredentials=!0),a.timeout=t,Object.keys(e.headers).forEach(t=>{e.headers[t]&&a.setRequestHeader(t,e.headers[t])});try{a.send(s)}catch(r){let t;n({error:eg(r,(t=e.url,`${tN} for URL: ${t}`)),xhr:a,options:e})}});class t_{constructor(e){this.logger=e,this.onError=this.onError.bind(this)}init(e){this.errorHandler=e}async getData(e){let{url:t,options:r,timeout:i,isRawResponse:n}=e;try{let e=await tj(tU(t,r,this.basicAuthHeader),i,this.logger);return{data:n?e.response:t$(e.response,this.onError),details:e}}catch(e){return{data:void 0,details:e}}}getAsyncData(e){let{callback:t,url:r,options:i,timeout:n,isRawResponse:s}=e,a=!k(t);tj(tU(r,i,this.basicAuthHeader),n,this.logger).then(e=>{a||t(s?e.response:t$(e.response,this.onError),e)}).catch(e=>{a||t(void 0,e)})}onError(e){this.errorHandler?.onError(e,"HttpClient")}setAuthHeader(e,t=!1){let r,i=t?e:(r=`${e}:`,globalThis.btoa(Array.from(new TextEncoder().encode(r),e=>String.fromCodePoint(e)).join("")));this.basicAuthHeader=`Basic ${i}`}resetAuthHeader(){this.basicAuthHeader=void 0}}let tH=new t_(eZ),tF=["www.test-host.com","localhost","127.0.0.1","[::1]"],tG=["userId","userTraits","groupId","groupTraits","anonymousId","config","instance","eventBuffer","traits","authToken"];class tQ{initialized=!1;constructor(e,t){this.httpClient=e,this.logger=t}init(){this.initialized||(this.attachErrorListeners(),this.initialized=!0)}attachErrorListeners(){globalThis.addEventListener("error",e=>{this.onError(e,K,void 0,eY.UNHANDLEDEXCEPTION)}),globalThis.addEventListener("unhandledrejection",e=>{this.onError(e,K,void 0,eY.UNHANDLEDREJECTION)})}onError(e,t="",r="",i=eY.HANDLEDEXCEPTION){try{let n=((e,t)=>{switch(t){case eY.UNHANDLEDEXCEPTION:{let{error:t}=e;return t||e}case eY.UNHANDLEDREJECTION:return e.reason;case eY.HANDLEDEXCEPTION:default:return e}})(e,i),s=((e,t)=>{let r;if(T(e)&&"string"==typeof ed(e))r=e;else{let i;t.warn((i=eo(e),`${K}:: Ignoring a non-error: ${i}.`)),r=void 0}return r})(n,this.logger);if(void 0===s)return;let a=r?`${r} - `:"",o=`${t}:: ${a}`,l=((e,t)=>{try{let r=tP.parse(e);return tR(e.name,e.message,t,r)}catch{return tR(e.name,e.message,t,[])}})(s,o),u=ed(s).includes(ec);if(!u&&!(e=>{let t=e.stacktrace[0]?.file;if(!t||"string"!=typeof t)return!1;let r=t.substring(t.lastIndexOf("/")+1),i=t.split("/");return i[i.length-2]===e5||["rsa"].some(e=>r.startsWith(e)&&r.endsWith(".js"))})(l)&&i!==eY.HANDLEDEXCEPTION)return;if(tT.reporting.isErrorReportingEnabled.value&&(e=>{let t=e.message;return tL.some(e=>e.test(t))||tM.some(e=>e.test(t))?t.includes(te):!tx.some(e=>e.test(t))})(l)){let e={severity:"error",unhandled:i!==eY.HANDLEDEXCEPTION,severityReason:{type:i}},t=((e,t,r)=>{let i,n,s,a,{context:o,lifecycle:l,session:u,source:c,reporting:d,autoTrack:g}=r,{app:h,locale:p,userAgent:f,timezone:y,screen:m,library:b}=o;return{payloadVersion:"5",notifier:{name:"RudderStack JavaScript SDK",version:h.value.version,url:"__REPOSITORY_URL__"},events:[{exceptions:[v(e)],severity:t.severity,unhandled:t.unhandled,severityReason:t.severityReason,app:{version:h.value.version,releaseStage:(()=>{let e=globalThis.location.hostname;return!e||e&&tF.includes(e)?"development":"production"})(),type:h.value.installType},device:{locale:p.value??"NA",userAgent:f.value??"NA",time:new Date},request:{url:globalThis.location.href.split("?")[0],clientIp:"[NOT COLLECTED]"}
4,breadcrumbs:v(d.breadcrumbs.value),context:e.message,metaData:{app:{snippetVersion:b.value.snippetVersion},device:{...m.value,timezone:y.value},...(e=>{let t=eo(e,!1,tG);return null!==t?JSON.parse(t):{}})(r)},user:(i=c,n=u,s=l,a=g,{id:`${i.value?.id??s.writeKey.value}..${n.sessionInfo.value.id??"NA"}..${a.pageLifecycle.pageViewId.value??"NA"}`,name:i.value?.name??"NA"})}]}})(l,e,tT);this.httpClient.getAsyncData({url:tT.metrics.metricsServiceUrl.value,options:{method:"POST",data:eo({version:"1",message_id:ei(),source:{name:"js",sdk_version:tT.context.app.value.version,write_key:tT.lifecycle.writeKey.value,install_type:tT.context.app.value.installType},errors:t}),sendRawData:!0},isRawResponse:!0})}(i===eY.HANDLEDEXCEPTION||u)&&this.logger.error(l.message)}catch(e){this.logger.error(`${K}:: Failed to handle the error.`,e)}}leaveBreadcrumb(e){try{tT.reporting.breadcrumbs.value=[...tT.reporting.breadcrumbs.value,{type:"manual",name:e,timestamp:new Date,metaData:{}}]}catch(e){this.onError(e,`${K}:: Failed to log breadcrumb.`)}}}let tV=new tQ(tH,eZ);class tz{plugins=[];byName={};cache={};config={throws:!0};constructor(e,t={}){this.config={throws:!0,...t},this.logger=e}register(e,t){if(!e.name){let t=`${q}:: Plugin name is missing.`;if(!this.config.throws)return void this.logger.error(t,e);throw Error(t)}if(this.byName[e.name]){let t,r=(t=e.name,`${q}:: Plugin "${t}" already exists.`);if(!this.config.throws)return void this.logger.error(r);throw Error(r)}this.cache={},this.plugins=this.plugins.slice();let r=this.plugins.length;this.plugins.forEach((t,i)=>{t.deps?.includes(e.name)&&(r=Math.min(r,i))}),this.plugins.splice(r,0,e),this.byName[e.name]=e,k(e.initialize)&&e.initialize(t)}unregister(e){let t=this.byName[e];if(!t){let t=`${q}:: Plugin "${e}" not found.`;if(!this.config.throws)return void this.logger.error(t);throw Error(t)}let r=this.plugins.indexOf(t);if(-1===r){let t=`${q}:: 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.`;if(!this.config.throws)return void this.logger.error(t);throw Error(t)}this.cache={},delete this.byName[e],this.plugins=this.plugins.slice(),this.plugins.splice(r,1)}getPlugin(e){return this.byName[e]}getPlugins(e){let t=e??".";return this.cache[t]||(this.cache[t]=this.plugins.filter(e=>{if(e.deps?.some(e=>!this.byName[e])){let t,r=e.deps.filter(e=>!this.byName[e]);return this.logger.error((t=e.name,`${q}:: Plugin "${t}" could not be loaded because some of its dependencies "${r}" do not exist.`)),!1}return"."===t||!!A(e,t)})),this.cache[t]}processRawPlugins(e){e(this.plugins),this.cache={}}invoke(e,t=!0,...r){let i=e;if(!i)throw Error("Failed to invoke plugin because the extension point name is missing.");let n=i.startsWith("!"),s=this.config.throws??i.endsWith("!");if(!(i=i.replace(/(^!|!$)/g,"")))throw Error("Failed to invoke plugin because the extension point name is invalid.");let a=i.split(".");a.pop();let o=a.join(".");return(t?this.getPlugins(i):[this.getPlugins(i)[0]]).map(e=>{let t=A(e,i);if(!k(t)||n)return t;try{return t.apply(A(e,o),r)}catch(n){let t,r;if(s)throw n;this.logger.error((t=i,r=e.name,`${q}:: Failed to invoke the "${t}" extension point of plugin "${r}".`),n)}return null})}invokeSingle(e,...t){return this.invoke(e,!1,...t)[0]}invokeMultiple(e,...t){return this.invoke(e,!0,...t)}}let tK=new tz(eZ,{throws:!0}),tq=e=>"cloud"!==e.config.connectionMode||!0===e.config.useNativeSDKToSend||!0===e.config.useNativeSDK,tJ=e=>e.filter(tq),tW=["BeaconQueue","CustomConsentManager","DeviceModeDestinations","DeviceModeTransformation","ExternalAnonymousId","GoogleLinker","IubendaConsentManager","KetchConsentManager","NativeDestinationQueue","OneTrustConsentManager","StorageEncryption","StorageEncryptionLegacy","StorageMigrator","XhrQueue"],tX=["Bugsnag","ErrorReporting"],tZ={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"}};async function tY(e){let t=tZ[e];return t.inited?t.lib:["esm","systemjs"].includes(t.format)?new Promise((e,r)=>{("function"==typeof t.url?t.url:()=>Promise.resolve(t.url))().then(i=>{import(i).then(r=>{if(!t.inited){let e=function e(t,r){let i=Object.assign(t,r);for(let t of Object.keys(i))"object"==typeof i[t]&&"object"==typeof r[t]&&(i[t]=e(i[t],r[t]));return i}({},(globalThis.__federation_shared__||{}).default||{});r.init(e),t.lib=r,t.lib.init(e),t.inited=!0}e(t.lib)}).catch(r)})}):void 0}function t0(e,t){if(!e?.default&&t){let t=Object.create(null);return t.default=e,t.__esModule=!0,t}return e}function t1(e,t){return tY(e).then(e=>e.get(t).then(e=>e()))}let t2=e=>{let t={};
4return e.forEach(e=>{if(tW.includes(e)){let r=(e=>{switch(e){case"BeaconQueue":return()=>t1("rudderAnalyticsRemotePlugins","./BeaconQueue").then(e=>t0(e,!0));case"CustomConsentManager":return()=>t1("rudderAnalyticsRemotePlugins","./CustomConsentManager").then(e=>t0(e,!0));case"DeviceModeDestinations":return()=>t1("rudderAnalyticsRemotePlugins","./DeviceModeDestinations").then(e=>t0(e,!0));case"DeviceModeTransformation":return()=>t1("rudderAnalyticsRemotePlugins","./DeviceModeTransformation").then(e=>t0(e,!0));case"ExternalAnonymousId":return()=>t1("rudderAnalyticsRemotePlugins","./ExternalAnonymousId").then(e=>t0(e,!0));case"GoogleLinker":return()=>t1("rudderAnalyticsRemotePlugins","./GoogleLinker").then(e=>t0(e,!0));case"KetchConsentManager":return()=>t1("rudderAnalyticsRemotePlugins","./KetchConsentManager").then(e=>t0(e,!0));case"IubendaConsentManager":return()=>t1("rudderAnalyticsRemotePlugins","./IubendaConsentManager").then(e=>t0(e,!0));case"NativeDestinationQueue":return()=>t1("rudderAnalyticsRemotePlugins","./NativeDestinationQueue").then(e=>t0(e,!0));case"OneTrustConsentManager":return()=>t1("rudderAnalyticsRemotePlugins","./OneTrustConsentManager").then(e=>t0(e,!0));case"StorageEncryption":return()=>t1("rudderAnalyticsRemotePlugins","./StorageEncryption").then(e=>t0(e,!0));case"StorageEncryptionLegacy":return()=>t1("rudderAnalyticsRemotePlugins","./StorageEncryptionLegacy").then(e=>t0(e,!0));case"StorageMigrator":return()=>t1("rudderAnalyticsRemotePlugins","./StorageMigrator").then(e=>t0(e,!0));case"XhrQueue":return()=>t1("rudderAnalyticsRemotePlugins","./XhrQueue").then(e=>t0(e,!0));default:return}})(e);r&&(t[e]=r)}}),t},t3=()=>({}),t6={...t3()};class t8{constructor(e,t,r){this.engine=e,this.errorHandler=t,this.logger=r,this.onError=this.onError.bind(this)}init(){tT.lifecycle.status.value="pluginsLoading",eS("pluginsCDNPath",tT.lifecycle.pluginsCDNPath.value),this.setActivePlugins(),this.registerLocalPlugins(),this.registerRemotePlugins(),this.attachEffects()}attachEffects(){eK(()=>{(0===tT.plugins.activePlugins.value.length||tT.plugins.loadedPlugins.value.length+tT.plugins.failedPlugins.value.length===tT.plugins.totalPluginsToLoad.value)&&eD(()=>{tT.plugins.ready.value=!0,tT.lifecycle.status.value="pluginsReady"})})}getPluginsToLoadBasedOnConfig(){let e=tT.plugins.pluginsToLoadFromConfig.value;return e?(e=e.filter(e=>{if(tX.includes(e))return this.logger.warn(`${V}:: ${e} plugin is deprecated. Please exclude it from the load API options.`),!1;return!0}),[{configurationStatus:()=>I(tT.dataPlaneEvents.eventsQueuePluginName.value),configurationStatusStr:"Data plane events delivery is enabled",activePluginName:tT.dataPlaneEvents.eventsQueuePluginName.value,supportedPlugins:Object.values(ta),shouldAddMissingPlugins:!0},{configurationStatus:()=>tJ(tT.nativeDestinations.configuredDestinations.value).length>0,configurationStatusStr:"Device mode destinations are connected to the source",supportedPlugins:["DeviceModeDestinations","NativeDestinationQueue"]},{configurationStatus:()=>tJ(tT.nativeDestinations.configuredDestinations.value).some(e=>e.shouldApplyDeviceModeTransformation),configurationStatusStr:"Device mode transformations are enabled for at least one destination",supportedPlugins:["DeviceModeTransformation"]},{configurationStatus:()=>I(tT.consents.activeConsentManagerPluginName.value),configurationStatusStr:"Consent management is enabled",activePluginName:tT.consents.activeConsentManagerPluginName.value,supportedPlugins:Object.values(tn)},{configurationStatus:()=>I(tT.storage.encryptionPluginName.value),configurationStatusStr:"Storage encryption is enabled",activePluginName:tT.storage.encryptionPluginName.value,supportedPlugins:Object.values(ts)},{configurationStatus:()=>tT.storage.migrate.value,configurationStatusStr:"Storage migration is enabled",supportedPlugins:["StorageMigrator"]}].forEach(t=>{t.configurationStatus()?(e=e.filter(t.activePluginName?e=>!(e!==t.activePluginName&&t.supportedPlugins.includes(e)):e=>I(e)),this.addMissingPlugins(t,!1,e)):e=e.filter(void 0!==t.basePlugins?e=>!(t.basePlugins.includes(e)||t.supportedPlugins.includes(e)):e=>!t.supportedPlugins.includes(e))}),[...Object.keys(t3()),...e]):[]}addMissingPlugins(e,t,r){let i=e.shouldAddMissingPlugins||t,n=(e.activePluginName?[...e.basePlugins||[],e.activePluginName]:[...e.supp
4ortedPlugins]).filter(e=>!r.includes(e));n.length>0&&(i&&r.push(...n),this.logger.warn(((e,t,r,i)=>{let n=1===r.length,s=n?` '${r[0]}' plugin was`:` ['${r.join("', '")}'] plugins were`,a=`${e}:: ${t}, but${s} not configured to load.`;return i?`${a} So, ${n?"the plugin":"those plugins"} will be loaded automatically.`:`${a} Ignore if this was intentional. Otherwise, consider adding ${n?"it":"them"} to the 'plugins' load API option.`})(V,e.configurationStatusStr,n,i)))}setActivePlugins(){let e=this.getPluginsToLoadBasedOnConfig(),t=[...Object.keys(t6),...tW],r=[],i=[];e.forEach(e=>{t.includes(e)?r.push(e):i.push(e)}),i.length>0&&this.logger.warn(`${V}:: Ignoring unknown plugins: ${i.join(", ")}.`),eD(()=>{tT.plugins.totalPluginsToLoad.value=e.length,tT.plugins.activePlugins.value=r,tT.plugins.failedPlugins.value=i})}registerLocalPlugins(){Object.values(t6).forEach(e=>{k(e)&&tT.plugins.activePlugins.value.includes(e().name)&&this.register([e()])})}registerRemotePlugins(){let e,t={...(e=tT.plugins.activePlugins.value,t2?.(e)||{})};Promise.all(Object.keys(t).map(async e=>{await t[e]().then(e=>this.register([e.default()])).catch(t=>{tT.plugins.failedPlugins.value=[...tT.plugins.failedPlugins.value,e],this.onError(t,e)})})).catch(e=>{this.onError(e)})}invokeMultiple(e,...t){try{return this.engine.invokeMultiple(e,...t)}catch(t){return this.onError(t,e),[]}}invokeSingle(e,...t){try{return this.engine.invokeSingle(e,...t)}catch(t){return this.onError(t,e),null}}register(e){e.forEach(e=>{try{this.engine.register(e,tT)}catch(t){tT.plugins.failedPlugins.value=[...tT.plugins.failedPlugins.value,e.name],this.onError(t)}})}unregisterLocalPlugins(){Object.values(t6).forEach(e=>{try{this.engine.unregister(e().name)}catch(e){this.onError(e)}})}onError(e,t){this.errorHandler.onError(e,V,t)}}let t5="cookieStorage",t4="localStorage",t9="sessionStorage",t7="memoryStorage",re="none",rt={userId:"rl_user_id",userTraits:"rl_trait",anonymousId:"rl_anonymous_id",groupId:"rl_group_id",groupTraits:"rl_group_trait",initialReferrer:"rl_page_init_referrer",initialReferringDomain:"rl_page_init_referring_domain",sessionInfo:"rl_session",authToken:"rl_auth_token"},rr="clientDataInCookie",ri="clientDataInLocalStorage",rn="clientDataInSessionStorage",rs=["userId","userTraits","anonymousId","groupId","groupTraits","initialReferrer","initialReferringDomain","sessionInfo","authToken"],ra={[t5]:rr,[t4]:ri,[t7]:"clientDataInMemory",[t9]:rn},ro=(e,t)=>{try{return encodeURIComponent(e)}catch(e){t?.error("Failed to encode the cookie data.",e);return}},rl=e=>{try{return decodeURIComponent(e)}catch(e){return}},ru=()=>(e=>{let t,r={},i=e.split(/\s*;\s*/);return i[0]&&i.forEach(e=>{let i=(t=e.split("="))[0]?rl(t[0]):void 0;i&&(r[i]=t[1]?rl(t[1]):void 0)}),r})(globalThis.document.cookie),rc=function(e,t,r,i){switch(arguments.length){case 4:case 3:case 2:let n={...r||{}},s=`${ro(e,i)}=${ro(t,i)}`;null===t&&(n.maxage=-1),n.maxage&&(n.expires=new Date(+new Date+n.maxage)),n.path&&(s+=`; path=${n.path}`),n.domain&&(s+=`; domain=${n.domain}`),n.expires&&(s+=`; expires=${n.expires.toUTCString()}`),n.samesite&&(s+=`; samesite=${n.samesite}`),n.secure&&(s+="; secure"),globalThis.document.cookie=s;return;case 1:if(e)return ru()[e];return ru();default:return ru()}};class rd{isEnabled=!0;length=0;data={};constructor(e){this.options={enabled:!0},this.logger=e}configure(e){return this.options=P(this.options,e??{}),this.isEnabled=!!this.options.enabled,this.options}setItem(e,t){return this.data[e]=t,this.length=Object.keys(this.data).length,t}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)}}let rg=new rd(eZ);var rh={exports:{}};rh.exports;let rp=tA(function(){return c?rh.exports:(c=1,rh.exports=function(){function e(e){return e=JSON.stringify(e),!!/^\{[\s\S]*\}$/.test(e)}function t(e){if("string"==typeof e)try{return JSON.parse(e)}catch(t){return e}}function r(e){return"[object Function]"===({}).toString.call(e)}var i=function(e){var t="_Is_Incognit";try{e||(e=window.localStorage),e.setItem(t,"yes"),e.removeItem(t)}catch(t){var r={};r._data={},r.setItem=function(e,t){return r._data[e]=String(t)},r.getItem=function(e){return r._data.hasOwnProperty(e)?r._data[e]:void 0},r.removeItem=function(e){return delete r._data[e]},r.clear=function(){return r._data={}},e=r}finally{"yes"===e.getItem(t)&&e.removeItem(t)}return e}();function n(){if(!(this instanceof n))return new n}n.prototype={set:function(t,r){if(t&&!e(t))i.setItem(t,void 0===r||"function"==typeof r?r+"":JSON.stringify(r));else if(e(t))for(var n in t)this.set(n,t[n]);return this},get:function(e){if(void 0===e){var r={};return this.forEach(function(e,t){return r[e]=t}),r}if("?"===e.charAt(0))return this.has(e.substr(1));var n=arguments;if(n.length>1){for(var s={},a=0,o=n.length;a<o;
4a++){var l=t(i.getItem(n[a]));this.has(n[a])&&(s[n[a]]=l)}return s}return t(i.getItem(e))},clear:function(){return i.clear(),this},remove:function(e){var t=this.get(e);return i.removeItem(e),t},has:function(e){return({}).hasOwnProperty.call(this.get(),e)},keys:function(){var e=[];return this.forEach(function(t){e.push(t)}),e},forEach:function(e){for(var t=0,r=i.length;t<r;t++){var n=i.key(t);e(n,this.get(n))}return this},search:function(e){for(var t=this.keys(),r={},i=0,n=t.length;i<n;i++)t[i].indexOf(e)>-1&&(r[t[i]]=this.get(t[i]));return r},len:function(){return i.length}};var s=null;function a(t,i){var o=arguments,l=null;if(s||(s=n()),0===o.length)return s.get();if(1===o.length){if("string"==typeof t)return s.get(t);if(e(t))return s.set(t)}if(2===o.length&&"string"==typeof t){if(!i)return s.remove(t);if(i&&"string"==typeof i)return s.set(t,i);i&&r(i)&&(l=null,l=i(t,s.get(t)),a.set(t,l))}if(2===o.length&&"[object Array]"===Object.prototype.toString.call(t)&&r(i))for(var u=0,c=t.length;u<c;u++)l=i(t[u],s.get(t[u])),a.set(t[u],l);return a}for(var o in n.prototype)a[o]=n.prototype[o];return a}(),rh.exports)}()),rv=()=>!(e=>null==e)(globalThis.navigator.userAgentData),rf={URL:()=>!k(globalThis.URL)||!k(globalThis.URLSearchParams),Promise:()=>!k(globalThis.Promise),"Number.isNaN":()=>!k(globalThis.Number.isNaN),"Number.isInteger":()=>!k(globalThis.Number.isInteger),"Array.from":()=>!k(globalThis.Array.from),"Array.prototype.find":()=>!k(globalThis.Array.prototype.find),"Array.prototype.includes":()=>!k(globalThis.Array.prototype.includes),"String.prototype.endsWith":()=>!k(globalThis.String.prototype.endsWith),"String.prototype.startsWith":()=>!k(globalThis.String.prototype.startsWith),"String.prototype.includes":()=>!k(globalThis.String.prototype.includes),"String.prototype.replaceAll":()=>!k(globalThis.String.prototype.replaceAll),"String.fromCodePoint":()=>!k(globalThis.String.fromCodePoint),"Object.entries":()=>!k(globalThis.Object.entries),"Object.values":()=>!k(globalThis.Object.values),"Object.assign":()=>!k(globalThis.Object.assign),"Object.fromEntries":()=>!k(globalThis.Object.fromEntries),"Element.prototype.dataset":()=>!(()=>{let e=globalThis.document.createElement("div");return e.setAttribute("data-a-b","c"),!!e.dataset&&"c"===e.dataset.aB})(),TextEncoder:()=>!k(globalThis.TextEncoder)||!k(globalThis.TextDecoder),requestAnimationFrame:()=>!k(globalThis.requestAnimationFrame)||!k(globalThis.cancelAnimationFrame),CustomEvent:()=>!k(globalThis.CustomEvent),"navigator.sendBeacon":()=>!k(globalThis.navigator.sendBeacon),ArrayBuffer:()=>!k(globalThis.Uint8Array),Set:()=>!k(globalThis.Set),atob:()=>!k(globalThis.atob)},ry=()=>({width:globalThis.screen.width,height:globalThis.screen.height,density:globalThis.devicePixelRatio,innerWidth:globalThis.innerWidth,innerHeight:globalThis.innerHeight}),rm=e=>{let t=["QuotaExceededError","NS_ERROR_DOM_QUOTA_REACHED"].includes(e.name)||[22,1014].includes(e.code);return e instanceof DOMException&&t},rb=(e=t4,t,r)=>{let i,n,s,a=`${F}:: The "${e}" storage type is `,o="unavailable",l=!0;try{switch(e){case t7:return!0;case t5:i=t,n="test_rudder_cookie";break;case t4:i=t??globalThis.localStorage,n="test_rudder_ls";break;case t9:i=t??globalThis.sessionStorage,n="test_rudder_ss";break;default:return!1}if(i&&(i.setItem(n,"true"),i.getItem(n)))return i.removeItem(n),!0;l=!1}catch(e){l=!1,s=e,rm(e)&&(o="full")}return l||r?.warn(`${a}${o}.`,s),!1};class rE{isSupportAvailable=!0;isEnabled=!0;length=0;constructor(e){this.options={enabled:!0},this.logger=e}configure(e){return this.options=P(this.options,e??{}),this.isSupportAvailable=rb(t4),this.isEnabled=!!(this.options.enabled&&this.isSupportAvailable),this.options}setItem(e,t){rp.set(e,t),this.length=rp.len()}getItem(e){let t=rp.get(e);return void 0===t?null:t}removeItem(e){rp.remove(e),this.length=rp.len()}clear(){rp.clear(),this.length=0}key(e){return this.keys()[e]??null}keys(){return rp.keys()}}let rk=new rE(eZ);class rI{isSupportAvailable=!0;isEnabled=!0;length=0;constructor(e){this.options={enabled:!0},this.logger=e}configure(e){return this.options=P(this.options,e??{}),this.isSupportAvailable=rb(t9),this.isSupportAvailable&&(this.store=globalThis.sessionStorage),this.isEnabled=!!(this.options.enabled&&this.isSupportAvailable),this.options}setItem(e,t){this.store&&(this.store.setItem(e,t),this.length=this.store.length)}getItem(e){if(!this.store)return null;let t=this.store.getItem(e);return void 0===t?null:t}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=[];
4if(!this.store)return e;for(let t=0;t<this.store.length;t+=1){let r=this.store.key(t);null!==r&&e.push(r)}return e}}let rS=new rI(eZ);class rT{isSupportAvailable=!0;isEnabled=!0;length=0;constructor(e){this.logger=e}configure(e){return this.options||(this.options=(()=>{let e=`.${(e=>{let t=(e=>{let t="function"!=typeof globalThis.URL?(e=>{let t=document.createElement("a");return t.href=e,t.hostname})(e):new URL(e).hostname,r=t?.split(".")??[],i=r[r.length-1],n=[];if(4===r.length&&i&&i===parseInt(i,10).toString())return n;if(r.length<=1)return r[0]&&-1!==r[0].indexOf("localhost")?["localhost"]:n;for(let e=r.length-2;e>=0;e-=1)n.push(r.slice(e).join("."));return n})(e);for(let e=0;e<t.length;e+=1){let r=t[e],i="__tld__",n={domain:`${-1!==r.indexOf("localhost")?"":"."}${r}`};if(rc(i,1,n),rc(i))return rc(i,null,n),r}return""})(globalThis.location.href)}`;return{maxage:31536e6,path:"/",domain:e&&"."!==e?e:void 0,samesite:"Lax",enabled:!0}})()),this.options=P(this.options,e??{}),this.options.sameDomainCookiesOnly&&delete this.options.domain,this.isSupportAvailable=rb(t5,this),this.isEnabled=!!(this.options.enabled&&this.isSupportAvailable),this.options}setItem(e,t){return rc(e,t,this.options,this.logger),this.length=Object.keys(rc()).length,!0}getItem(e){let t=rc(e);return void 0===t?null:t}removeItem(e){let t=this.setItem(e,null);return this.length=Object.keys(rc()).length,t}clear(){}key(e){return this.keys()[e]??null}keys(){return Object.keys(rc())}}let rA=new rT(eZ),rw=e=>{switch(e){case t4:return rk;case t9:return rS;case t7:return rg;case t5:return rA;default:return rg}};class rC{constructor(e,t,r){this.id=e.id,this.name=e.name,this.isEncrypted=e.isEncrypted??!1,this.validKeys=e.validKeys??{},this.engine=t,this.noKeyValidation=0===Object.keys(this.validKeys).length,this.noCompoundKey=e.noCompoundKey,this.originalEngine=this.engine,this.errorHandler=e.errorHandler,this.logger=e.logger,this.pluginsManager=r}createValidKey(e){let t,{name:r,id:i,validKeys:n,noKeyValidation:s,noCompoundKey:a}=this;return s?a?e:[r,i,e].join("."):(Object.values(n).forEach(n=>{n===e&&(t=a?e:[r,i,e].join("."))}),t)}swapQueueStoreToInMemoryEngine(){let{name:e,id:t,validKeys:r,noCompoundKey:i}=this,n=rw(t7);Object.keys(r).forEach(s=>{let a=this.get(r[s]),o=i?s:[e,t,s].join(".");n.setItem(o,a),this.remove(s)}),this.engine=n}set(e,t){let r=this.createValidKey(e);if(r)try{this.engine.setItem(r,this.encrypt(eo(t,!1,[],this.logger)))}catch(r){if(rm(r)){let r;this.logger.warn((r=`Store ${this.id}`,`${r}:: The storage is either full or unavailable, so the data will not be persisted. Switching to in-memory storage.`)),this.swapQueueStoreToInMemoryEngine(),this.set(e,t)}else this.onError(eg(r,`Failed to save the value for "${e}" to storage`))}}get(e){let t,r=this.createValidKey(e);try{if(!r)return null;if(t=this.decrypt(this.engine.getItem(r)),null==t)return null;return JSON.parse(t)}catch(t){return this.onError(Error(`Failed to retrieve or parse data for "${e}" from storage: ${t.message}`)),null}}remove(e){let t=this.createValidKey(e);t&&this.engine.removeItem(t)}getOriginalEngine(){return this.originalEngine}decrypt(e){return null==e?null:this.crypto(e,"decrypt")}encrypt(e){return this.crypto(e,"encrypt")}crypto(e,t){if(!this.isEncrypted||!e||"string"!=typeof e||""===e.replace(/^\s+|\s+$/gm,""))return e;let r=`storage.${t}`,i=this.pluginsManager?this.pluginsManager.invokeSingle(r,e):e;return void 0===i?e:i??""}onError(e){this.errorHandler.onError(e,`Store ${this.id}`)}}class rP{stores={};isInitialized=!1;constructor(e,t,r){this.errorHandler=t,this.logger=r,this.pluginsManager=e}init(){if(this.isInitialized)return;let e=tT.loadOptions.value,t={cookieStorageOptions:{samesite:e.sameSiteCookie,secure:e.secureCookie,domain:e.setCookieDomain,sameDomainCookiesOnly:e.sameDomainCookiesOnly},localStorageOptions:{},inMemoryStorageOptions:{},sessionStorageOptions:{}};((e={},t={},r={},i={})=>{(e=>{let t=rA.configure(e);tT.storage.cookie.value={maxage:t.maxage,path:t.path,domain:t.domain,samesite:t.samesite,expires:t.expires,secure:t.secure}})(e),rk.configure(t),rg.configure(r),rS.configure(i)})(D(P(t.cookieStorageOptions??{},tT.storage.cookie?.value??{})),D(t.localStorageOptions),D(t.inMemoryStorageOptions),D(t.sessionStorageOptions)),this.initClientDataStores(),this.isInitialized=!0}initClientDataStores(){this.initializeStorageState(),[t7,t4,t5,t9].forEach(e
4=>{rw(e)?.isEnabled&&this.setStore({id:ra[e],name:ra[e],isEncrypted:!0,noCompoundKey:!0,type:e,errorHandler:this.errorHandler,logger:this.logger})})}initializeStorageState(){let e=tT.storage.type.value,t=tT.loadOptions.value.storage?.entries,r=tT.consents.postConsent.value.storage;(I(r?.type)||I(r?.entries))&&(e=r?.type,t=r?.entries);let i=!0,n={};rs.forEach(r=>{let s=t?.[r]?.type,a=((e,t)=>{let r;if(e.consents.preConsent.value.enabled)switch(e.consents.preConsent.value.storage?.strategy){case"none":r=re;break;case"session":"sessionInfo"!==t&&(r=re);break;case"anonymousId":"anonymousId"!==t&&(r=re)}return r})(tT,r)??s??e??e1,o=this.getResolvedStorageTypeForEntry(a,r);o!==re&&(i=!1),n={...n,[r]:{type:o,key:rt[r]}}}),eD(()=>{tT.storage.type.value=e,tT.storage.entries.value=n,tT.storage.trulyAnonymousTracking.value=i})}getResolvedStorageTypeForEntry(e,t){let r,i=e;switch(e){case t4:rw(t4)?.isEnabled||(i=t7);break;case t9:rw(t9)?.isEnabled||(i=t7);break;case t7:case re:break;default:i=rw(t5)?.isEnabled?t5:rw(t4)?.isEnabled?t4:rw(t9)?.isEnabled?t9:t7}return i!==e&&this.logger.warn((r=i,`StoreManager:: The storage type "${e}" is not available for entry "${t}". The SDK will initialize the entry with "${r}" storage type instead.`)),i}setStore(e){let t=rw(e.type);return this.stores[e.id]=new rC(e,t,this.pluginsManager),this.stores[e.id]}getStore(e){return this.stores[e]}}let rO=e=>{let{host:t,protocol:r}=new URL(e),i=t.split(".");return{topDomain:i.length>2?`${i[i.length-2]}.${i[i.length-1]}`:t,protocol:r}},rD=e=>e?.endsWith("/")?rD(e.substring(0,e.length-1)):e,rR=e=>{try{return new URL(e).host}catch(e){return null}},r$=e=>rR(e)??"",rN=e=>{if("string"!=typeof e)return!1;try{return k(globalThis.URL)&&new URL(e),e9.test(e)}catch(e){return!1}},rL="none",rM="immediate",rx=e=>O(e)||Array.isArray(e),rB=(e,t)=>{let r,i,n=[],s=[],a=!1,o=e?.enabled===!0;O(e)&&o&&({provider:i,consentManagerPluginName:r}=((e,t)=>{let{provider:r}=e,i=r?tn[r]:void 0;if(r&&!i){let e;t.error((e=r,`${G}:: The consent manager "${e}" is not supported. Please choose one of the following supported consent managers: "${Object.keys(tn)}".`)),r=void 0}return{provider:r,consentManagerPluginName:i}})(e,t),rx(e.allowedConsentIds)&&(n=e.allowedConsentIds,a=!0),rx(e.deniedConsentIds)&&(s=e.deniedConsentIds,a=!0));let l={allowedConsentIds:n,deniedConsentIds:s};return o=o&&!!r,{provider:i,consentManagerPluginName:r,initialized:a,enabled:o,consentsData:l}},rU=(e,t,r,i,n,s,a)=>{let o;if(s){if(!rN(s))return a.error(`${G}:: The base URL "${s}" for ${e} is not valid.`),null;o=rD(s)}else if(o=r,"cdn"===tT.context.app.value.installType){let e=(()=>{let e=document.querySelector("script[data-rsa-write-key]");if(e&&e.dataset.rsaWriteKey===tT.lifecycle.writeKey.value)return e.src;let t=document.getElementsByTagName("script"),r=/(?:^|\/)rsa(\.min)?\.js$/;for(let e of t){let t=e.getAttribute("src");if(t&&r.test(t))return t}})();e&&(o=e.split("/").slice(0,-1).concat(t).join("/"))}return n&&(o=o.replace(RegExp(`/v3/${e7}/${t}$`),`/${i}/${e7}/${t}`)),o};class rj{constructor(e,t,r){this.errorHandler=t,this.logger=r,this.httpClient=e,this.onError=this.onError.bind(this),this.processConfig=this.processConfig.bind(this)}attachEffects(){eK(()=>{this.logger.setMinLogLevel(tT.lifecycle.logLevel.value)})}init(){let e,{logLevel:t,configUrl:r,lockIntegrationsVersion:i,lockPluginsVersion:n,destSDKBaseURL:s,pluginsSDKBaseURL:a,integrations:o}=tT.loadOptions.value,l=rU("integrations",e5,tt,ev,i,s,this.logger);null!==l&&null!==(e=rU("plugins",e4,tr,ev,n,a,this.logger))&&(this.attachEffects(),tT.lifecycle.activeDataplaneUrl.value=rD(tT.lifecycle.dataPlaneUrl.value),(e=>{let t,r,{storage:i}=tT.loadOptions.value,n=i?.type;if(I(n)&&!("string"==typeof(r=n)&&e0.includes(r))){let t;e.warn((t=n,`${G}:: The storage type "${t}" is not supported. Please choose one of the following supported types: "${e0}". The default type "${e1}" will be used instead.`)),n=e1}let s=i?.encryption?.version,a=s&&ts[s];if(void 0===s||void 0!==a)void 0===s&&(s="v3");else{let t;e.warn((t=s,`${G}:: The storage encryption version "${t}" is not supported. Please choose one of the following supported versions: "${Object.keys(ts)}". The default version "v3" will be used instead.`)),s="v3"}let o=i?.migrate,l=o&&"v3"===s;!0===o&&l!==o&&e.warn((t=s,`${G}:: The storage data migration has been disabled because the configured storage encryption version (${t}) is not the latest (v3). To enable storage data migration, please update the storage encryption version to the latest version.`));let{sscEnabled:u,finalDataServiceUrl:c,cookieOptions:d}=(e=>{let t,{useServerSideCookies:r,dataServiceEndpoint:i,storage:n,setCookieDomain:s,sameDomainCookiesOnly:a}=tT.loadOptions.value,o=n?.cookie,l=!1;if(r){l=r;let n=o.domain??s,u=I(n)&&!(e=>{let{topDomain:t}=rO(window.location.href);return t===e})(L(n))||a,c=((e,t)=>{let r=t?window.location.origin:(e=>{let{topDomain:t,protocol:r}=rO(e);return`${r}//${t}`})(window.location.href),i=e.startsWith("/")?e.substring(1):e;return`${r}/${i}`})(i??"rsaRequest",u);if(rN(c)){t=rD(c);let r=rR(window.location.href),i=rR(c);(r!==i&&(o={...o,samesite:"None",secure:!0}),!a&&u&&i!==L(n))&&(l=!1,e.warn(`${G}:: The provided cookie domain (${n}) does not match the current webpage's domain (${i}). Hence, the cookies will be set client-side.`))}else l=!1}
4return{sscEnabled:l,cookieOptions:o,finalDataServiceUrl:t}})(e);eD(()=>{tT.storage.type.value=n,tT.storage.cookie.value=d,tT.serverCookies.isEnabledServerSideCookies.value=u,tT.serverCookies.dataServiceUrl.value=c,tT.storage.encryptionPluginName.value=ts[s],tT.storage.migrate.value=l})})(this.logger),(e=>{let{provider:t,consentManagerPluginName:r,initialized:i,enabled:n,consentsData:s}=rB(tT.loadOptions.value.consentManagement,e),a=tT.loadOptions.value.preConsent,o=a?.storage?.strategy??rL;if(I(o)&&!["none","session","anonymousId"].includes(o)){let t;o=rL,e.warn((t=a?.storage?.strategy,`${G}:: The pre-consent storage strategy "${t}" is not supported. Please choose one of the following supported strategies: "none, session, anonymousId". The default strategy "${rL}" will be used instead.`))}let l=a?.events?.delivery??rM;if(I(l)&&!["immediate","buffer"].includes(l)){let t;l=rM,e.warn((t=a?.events?.delivery,`${G}:: The pre-consent events delivery type "${t}" is not supported. Please choose one of the following supported types: "immediate, buffer". The default type "${rM}" will be used instead.`))}eD(()=>{tT.consents.activeConsentManagerPluginName.value=r,tT.consents.initialized.value=i,tT.consents.enabled.value=n,tT.consents.data.value=s,tT.consents.provider.value=t,tT.consents.preConsent.value={enabled:tT.loadOptions.value.preConsent?.enabled===!0&&!1===i&&!0===n,storage:{strategy:o},events:{delivery:l}}})})(this.logger),(e=>{if(tT.dataPlaneEvents.deliveryEnabled.value){let t="XhrQueue",r=t;if(tT.loadOptions.value.useBeacon)if(tT.capabilities.isBeaconAvailable.value)r="BeaconQueue";else r=t,e.warn(`${G}:: The Beacon API is not supported by your browser. The events will be sent using XHR instead.`);eD(()=>{tT.dataPlaneEvents.eventsQueuePluginName.value=r})}})(this.logger),eD(()=>{tT.lifecycle.integrationsCDNPath.value=l,tT.lifecycle.pluginsCDNPath.value=e,t&&(tT.lifecycle.logLevel.value=t),tT.lifecycle.sourceConfigUrl.value=((e,t,r,i,n)=>{let s=new URLSearchParams({p:"npm",v:ev,build:e7,writeKey:t,lockIntegrationsVersion:r.toString(),lockPluginsVersion:i.toString()}),a=ti,o=s,l="/sourceConfig/",u="";if(rN(e)){let t=new URL(e);rD(t.pathname).endsWith("/sourceConfig")||(t.pathname=`${rD(t.pathname)}/sourceConfig/`),t.pathname=t.pathname.replace(/\/{2,}/g,"/"),s.forEach((e,r)=>{null===t.searchParams.get(r)&&t.searchParams.set(r,e)}),a=t.origin,l=t.pathname,o=t.searchParams,u=t.hash}else n.warn(`${G}:: The provided source config URL "${e}" is invalid. Using the default source config URL instead.`);return`${a}${l}?${o}${u}`})(r,tT.lifecycle.writeKey.value,i,n,this.logger),tT.metrics.metricsServiceUrl.value=`${tT.lifecycle.activeDataplaneUrl.value}/rsaMetrics`,tT.nativeDestinations.loadOnlyIntegrations.value=o}),this.getConfig())}onError(e,t){this.errorHandler.onError(e,G,t)}processConfig(e,t){var r;let i,n,s,a,o;if(!I(e))return void(I(t)?this.onError(t.error,e3):this.onError(Error(e3)));try{i="string"==typeof e?JSON.parse(e):e}catch(e){this.onError(e,e2);return}if(!(w(n=i)&&w(n.source)&&null!=(o=n.source.id)&&w(n.source.config)&&Array.isArray(n.source.destinations)))return void this.onError(Error(e2));if(!1===i.source.enabled)return void this.logger.error("The source is disabled. Please enable the source in the dashboard to send events.");r=i,tT.reporting.isErrorReportingEnabled.value=(s=r.source.config,s?.statsCollection?.errors?.enabled===!0&&!window.chrome?.runtime?.id),tT.reporting.isMetricsReportingEnabled.value=(a=r.source.config,a?.statsCollection?.metrics?.enabled===!0);let l=i.source.destinations.length>0?(e=>{let t=[];return e.forEach(e=>{e.enabled&&!e.deleted&&t.push({id:e.id,displayName:e.destinationDefinition.displayName,config:e.config,shouldApplyDeviceModeTransformation:e.shouldApplyDeviceModeTransformation||!1,propagateEventsUntransformedOnError:e.propagateEventsUntransformedOnError||!1,userFriendlyId:`${e.destinationDefinition.displayName.replaceAll(" ","-")}___${e.id}`})}),t})(i.source.destinations):[];eD(()=>{var e;let t,r;tT.source.value={config:i.source.config,name:i.source.name,id:i.source.id,workspaceId:i.source.w
4orkspaceId},tT.nativeDestinations.configuredDestinations.value=l,tT.plugins.pluginsToLoadFromConfig.value=tT.loadOptions.value.plugins??[],e=i,r=tT.consents.resolutionStrategy.value,w(e.consentManagementMetadata)&&(tT.consents.provider.value&&(r=e.consentManagementMetadata.providers.find(e=>e.provider===tT.consents.provider.value)?.resolutionStrategy??tT.consents.resolutionStrategy.value),t=e.consentManagementMetadata),"custom"===tT.consents.provider.value&&(r=void 0),eD(()=>{tT.consents.metadata.value=v(t),tT.consents.resolutionStrategy.value=r}),tT.lifecycle.status.value="configured"})}getConfig(){let e=tT.loadOptions.value.getSourceConfig;if(e){if(!k(e))return void this.logger.error(`${G}:: The "getSourceConfig" load API option must be a function that returns valid source configuration data.`);let t=e();t instanceof Promise?t.then(e=>this.processConfig(e)).catch(e=>{this.onError(e,"SourceConfig")}):this.processConfig(t)}else this.httpClient.getAsyncData({url:tT.lifecycle.sourceConfigUrl.value,options:{headers:{"Content-Type":void 0}},callback:this.processConfig})}}let r_=()=>document?.referrer||"$direct",rH=()=>{let e=(()=>{let e=document.getElementsByTagName("link"),t="";for(let r=0;e[r];r+=1){let i=e[r];if("canonical"===i.getAttribute("rel")&&!t){t=i.getAttribute("href")??"";break}}return t})(),t=globalThis.location.pathname,{href:r}=globalThis.location,i=r,{search:n}=globalThis.location;if(e)try{let r=new URL(e);i=""===r.search?e+n:e,t=r.pathname}catch(e){}let s=(e=>{let t=e;try{let r=new URL(e);t=r.origin+r.pathname+r.search}catch(e){}return t})(i),{title:a}=document,o=r_();return{path:t,referrer:o,referring_domain:r$(o),search:n,title:a,url:s,tab_url:r}},rF=`https://polyfill-fastly.io/v3/polyfill.min.js?version=3.111.0&features=${Object.keys(rf).join("%2C")}`,rG="rudderstackPolyfill";class rQ{constructor(e,t,r){this.httpClient=e,this.errorHandler=t,this.logger=r,this.externalSrcLoader=new eC(this.errorHandler,this.logger),this.onError=this.onError.bind(this),this.onReady=this.onReady.bind(this)}init(){this.prepareBrowserCapabilities(),this.attachWindowListeners()}detectBrowserCapabilities(){eD(()=>{let e,t;tT.capabilities.storage.isCookieStorageAvailable.value=rb(t5,rw(t5),this.logger),tT.capabilities.storage.isLocalStorageAvailable.value=rb(t4,void 0,this.logger),tT.capabilities.storage.isSessionStorageAvailable.value=rb(t9,void 0,this.logger),tT.capabilities.isBeaconAvailable.value=null!=(e=globalThis.navigator.sendBeacon)&&k(globalThis.navigator.sendBeacon),tT.capabilities.isUaCHAvailable.value=rv(),tT.capabilities.isCryptoAvailable.value=null!=(t=globalThis.crypto)&&k(globalThis.crypto.getRandomValues),tT.capabilities.isIE11.value=!!globalThis.navigator.userAgent.match(/Trident.*rv:11\./),tT.capabilities.isOnline.value=globalThis.navigator.onLine,tT.context.userAgent.value=(()=>{if(void 0===globalThis.navigator)return null;let{userAgent:e}=globalThis.navigator,{brave:t}=globalThis.navigator;if(t&&Object.getPrototypeOf(t).isBrave){let t=e.match(/(chrome)\/([\w.]+)/i);t&&(e=`${e} Brave/${t[2]}`)}return e})(),tT.context.locale.value=void 0===globalThis.navigator?null:globalThis.navigator.language??globalThis.navigator.browserLanguage,tT.context.screen.value=ry(),tT.context.timezone.value=(()=>{let e=/([A-Z]+[+-]\d+)/.exec(new Date().toString());return e?.[1]?e[1]:"NA"})(),rv()&&((e,t="none")=>{"none"===t&&e(void 0),"default"===t&&e(navigator.userAgentData),"full"===t&&navigator.userAgentData?.getHighEntropyValues(["architecture","bitness","brands","mobile","model","platform","platformVersion","uaFullVersion","fullVersionList","wow64"]).then(t=>{e(t)}).catch(()=>{e()})})(e=>{tT.context["ua-ch"].value=e},tT.loadOptions.value.uaChTrackLevel)}),eK(()=>{!0===tT.loadOptions.value.sendAdblockPage&&void 0!==tT.lifecycle.sourceConfigUrl.value&&(e=>{let t=new URL(tT.lifecycle.sourceConfigUrl.value),r=`${t.origin}${t.pathname}?view=ad`;e.getAsyncData({url:r,options:{method:"HEAD",headers:{"Content-Type":void 0}},isRawResponse:!0,callback:(e,t)=>{tT.capabilities.isAdBlocked.value=t?.error!==void 0||t?.xhr?.responseURL!==r}})})(this.httpClient)})}prepareBrowserCapabilities(){tT.capabilities.isLegacyDOM.value=(()=>{let e=Object.keys(rf),t=!1;for(let r=0;r<e.length;r++){let i=rf[e[r]];if(k(i)&&i()){t=!0;break}}return t})();let e=tT.loadOptions.value.polyfillURL,t=rF;if(S(e))if(rN(e))t=e;else this.logger.warn(`${F}:: The provided polyfill URL "${e}
4" is invalid. The default polyfill URL will be used instead.`);if(tT.loadOptions.value.polyfillIfRequired&&tT.capabilities.isLegacyDOM.value&&rN(t)){let e=t!==tT.loadOptions.value.polyfillURL;if(e){let e=`RS_polyfillCallback_${tT.lifecycle.writeKey.value}`,r=()=>{this.onReady(),delete globalThis[e]};globalThis[e]=r,t=`${t}&callback=${e}`}this.externalSrcLoader.loadJSFile({url:t,id:rG,async:!0,timeout:1e4,callback:r=>{if(r)e||this.onReady();else{let e;this.onError(Error((e=t,`Failed to load the polyfill script with ID "${rG}" from URL ${e}.`)))}}})}else this.onReady()}attachWindowListeners(){globalThis.addEventListener("offline",()=>{tT.capabilities.isOnline.value=!1}),globalThis.addEventListener("online",()=>{tT.capabilities.isOnline.value=!0}),globalThis.addEventListener("resize",function(e,t,r=250){let i;return(...n)=>{globalThis.clearTimeout(i),i=globalThis.setTimeout(()=>{e.apply(t,n)},r)}}(()=>{tT.context.screen.value=ry()},this))}onReady(){this.detectBrowserCapabilities(),tT.lifecycle.status.value="browserCapabilitiesReady"}onError(e){this.errorHandler.onError(e,F)}}let rV=["integrations","anonymousId","originalTimestamp"],rz=["library","consentManagement","userAgent","ua-ch","screen"],rK=["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"],rq=e=>"number"==typeof e&&!Number.isNaN(e),rJ=e=>rq(e)&&e>=0&&Number.isInteger(e),rW=e=>{let t=Date.now();return!!(!e||t>e)},rX=e=>e===t5||e===t4||e===t9||e===t7,rZ=()=>ei(),rY=(e,t,r)=>{w(e)&&Object.keys(e).forEach(e=>{(rK.includes(e)||rK.includes(e.toLowerCase()))&&r.warn(`${Q}:: The "${e}" property defined under "${t}" is a reserved keyword. Please choose a different property name to avoid conflicts with reserved keywords (${rK}).`)})},r0=(e,t,r,i)=>{let n={channel:"web",context:{traits:v(tT.session.userTraits.value),sessionId:tT.session.sessionInfo.value.id||void 0,sessionStart:tT.session.sessionInfo.value.sessionStart||void 0,...tT.consents.enabled.value&&{consentManagement:{deniedConsentIds:v(tT.consents.data.value.deniedConsentIds),allowedConsentIds:v(tT.consents.data.value.allowedConsentIds),provider:tT.consents.provider.value,resolutionStrategy:tT.consents.resolutionStrategy.value}},"ua-ch":tT.context["ua-ch"].value,app:tT.context.app.value,library:tT.context.library.value,userAgent:tT.context.userAgent.value,os:tT.context.os.value,locale:tT.context.locale.value,screen:tT.context.screen.value,campaign:(e=>{let t={};try{let r=new URL(e),i="utm_";r.searchParams.forEach((e,r)=>{if(r.startsWith(i)){let n=r.substring(i.length);"campaign"===n&&(n="name"),t[n]=e}})}catch(e){}return t})(globalThis.location.href),page:(e=>{let t=rH(),r={};return Object.keys(t).forEach(i=>{r[i]=e?.[i]||t[i]}),r.initial_referrer=e?.initial_referrer||tT.session.initialReferrer.value,r.initial_referring_domain=e?.initial_referring_domain||tT.session.initialReferringDomain.value,r})(r),timezone:tT.context.timezone.value,...tT.autoTrack.enabled.value&&{autoTrack:{...tT.autoTrack.pageLifecycle.enabled.value&&{page:{pageViewId:tT.autoTrack.pageLifecycle.pageViewId.value}}}}},originalTimestamp:en(new Date),messageId:ei(),userId:e.userId||tT.session.userId.value};rX(tT.storage.entries.value.anonymousId?.type)?n.anonymousId=tT.session.anonymousId.value:n.anonymousId=rZ(),tT.storage.trulyAnonymousTracking.value&&(n.context.trulyAnonymousTracking=!0),"identify"===e.type&&(n.context.traits=tT.storage.entries.value.userTraits?.type!==re?v(tT.session.userTraits.value):e.context.traits),"group"===e.type&&((e.groupId||tT.session.groupId.value)&&(n.groupId=e.groupId||tT.session.groupId.value),(e.traits||tT.session.groupTraits.value)&&(n.traits=tT.storage.entries.value.groupTraits?.type!==re?v(tT.session.groupTraits.value):e.traits));let s=P(e,n);return void 0===s.event&&(s.event=null),void 0===s.properties&&(s.properties=null),((e,t,r)=>{w(t)&&(((e,t)=>{t.anonymousId&&"string"==typeof t.anonymousId&&(e.anonymousId=t.anonymousId),O(t.integrations)&&(e.integrations=t.integrations),t.originalTimestamp&&"string"==typeof t.originalTimestamp&&(e.originalTimestamp=t.originalTimestamp)})(e,t),e.context=((e,t,r)=>{let i=e;
4return Object.keys(t).forEach(e=>{if(!rV.includes(e)&&!rz.includes(e))if("context"!==e)i=P(i,{[e]:t[e]});else if(void 0!==t[e]&&w(t[e])){let r={};Object.keys(t[e]).forEach(i=>{rz.includes(i)||(r[i]=t[e][i])}),i=P(i,{...r})}else r.warn(`${Q}:: Please make sure that the "context" property in the event API's "options" argument is a valid object literal with key-value pairs.`)}),i})(e.context,t,r))})(s,t,i),((e,t)=>{let{properties:r,traits:i,context:n}=e,{traits:s}=n;rY(r,"properties",t),rY(i,"traits",t),rY(s,"context.traits",t)})(s,i),s.integrations=(e=>v(tT.loadOptions.value.useGlobalIntegrationsConfigInEvents?tT.consents.postConsent.value.integrations??tT.nativeDestinations.loadOnlyIntegrations.value:e||e8))(s.integrations),s};class r1{constructor(e){this.logger=e}generatePageEvent(e,t,r,i){let n=r??{};return r0({properties:n=((e,t)=>{let r=t?.page||{},i=rH();return Object.keys(i).forEach(t=>{void 0===e[t]&&(e[t]=r[t]||i[t])}),void 0===e.initial_referrer&&(e.initial_referrer=r.initial_referrer||tT.session.initialReferrer.value),void 0===e.initial_referring_domain&&(e.initial_referring_domain=r.initial_referring_domain||tT.session.initialReferringDomain.value),e})(n,i),name:t,category:e,type:"page"},i,n,this.logger)}generateTrackEvent(e,t,r){return r0({properties:t,event:e,type:"track"},r,void 0,this.logger)}generateIdentifyEvent(e,t,r){return r0({userId:e,type:"identify",context:{traits:t}},r,void 0,this.logger)}generateAliasEvent(e,t,r){let i=r0({previousId:t,type:"alias"},r,void 0,this.logger);return i.userId=e??i.userId,i}generateGroupEvent(e,t,r){let i={type:"group"};return e&&(i.groupId=e),t&&(i.traits=t),r0(i,r,void 0,this.logger)}create(e){let t;switch(e.type){case"page":t=this.generatePageEvent(e.category,e.name,e.properties,e.options);break;case"track":t=this.generateTrackEvent(e.name,e.properties,e.options);break;case"identify":t=this.generateIdentifyEvent(e.userId,e.traits,e.options);break;case"alias":t=this.generateAliasEvent(e.to,e.from,e.options);break;default:t=this.generateGroupEvent(e.groupId,e.traits,e.options)}return t}}
4class r2{constructor(e,t,r,i){this.eventRepository=e,this.userSessionManager=t,this.errorHandler=r,this.logger=i,this.eventFactory=new r1(this.logger)}init(){this.eventRepository.init()}resume(){this.eventRepository.resume()}addEvent(e){this.userSessionManager.refreshSession();let t=this.eventFactory.create(e);this.eventRepository.enqueue(t,e.callback)}}class r3{constructor(e,t,r,i,n){this.storeManager=t,this.pluginsManager=e,this.logger=n,this.errorHandler=i,this.httpClient=r,this.onError=this.onError.bind(this),this.serverSideCookieDebounceFuncs={}}init(){this.syncStorageDataToState(),this.registerEffects()}syncStorageDataToState(){let e;this.migrateStorageIfNeeded(),this.migrateDataFromPreviousStorage(),this.setUserId(this.getUserId()),this.setUserTraits(this.getUserTraits()),this.setGroupId(this.getGroupId()),this.setGroupTraits(this.getGroupTraits());let{externalAnonymousIdCookieName:t,anonymousIdOptions:r}=tT.loadOptions.value;S(t)&&"string"==typeof t&&(e=this.getExternalAnonymousIdByCookieName(t)),this.setAnonymousId(e??this.getAnonymousId(r)),this.setAuthToken(this.getAuthToken()),this.setInitialReferrerInfo(),this.configureSessionTracking()}configureSessionTracking(){let e=this.getSessionInfo();if(this.isPersistenceEnabledForStorageEntry("sessionInfo")){let t=this.getConfiguredSessionTrackingInfo(),r=e??tu;(e={...r,...t,autoTrack:t.autoTrack&&!0!==r.manualTrack}).autoTrack||!0===e.manualTrack||(e=tl.sessionInfo)}else e=tl.sessionInfo;tT.session.sessionInfo.value=e,tT.session.sessionInfo.value.autoTrack&&this.startOrRenewAutoTracking(tT.session.sessionInfo.value)}setInitialReferrerInfo(){let e=this.getInitialReferrer(),t=this.getInitialReferringDomain();if(e&&t)this.setInitialReferrer(e),this.setInitialReferringDomain(t);else{let t=e||r_();this.setInitialReferrer(t),this.setInitialReferringDomain(r$(t))}}isPersistenceEnabledForStorageEntry(e){return rX(tT.storage.entries.value[e]?.type)}migrateDataFromPreviousStorage(){let e=tT.storage.entries.value,t=[t5,t4,t9];Object.keys(e).forEach(r=>{let i=e[r]?.type,n=this.storeManager?.getStore(ra[i]);n&&t.forEach(e=>{let t=this.storeManager?.getStore(ra[e]);if(t&&e!==i){let e=t.get(rt[r]);S(e)&&""!==e&&n.set(rt[r],e),t.remove(rt[r])}})})}migrateStorageIfNeeded(e){if(!tT.storage.migrate.value)return;let t=e??[];0===t.length&&[rr,ri,rn].forEach(e=>{let r=this.storeManager?.getStore(e);r&&t.push(r)}),Object.keys(rt).forEach(e=>{let r=rt[e];t.forEach(e=>{let t=this.pluginsManager?.invokeSingle("storage.migrate",r,e.engine,this.errorHandler,this.logger);null==t||e.set(r,t)})})}getConfiguredSessionTrackingInfo(){let e,t,r=tT.loadOptions.value.sessions?.autoTrack!==!1;if(!r)return{autoTrack:r};let i=tT.loadOptions.value.sessions?.timeout;if(rJ(i))t=i;else this.logger.warn(`${z}:: The session timeout value "${i}" is not a number. The default timeout of 1800000 ms will be used instead.`),t=18e5;0===t&&(this.logger.warn(`${z}:: 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.`),r=!1);return t>0&&t<1e4&&this.logger.warn((e=t,`${z}:: The session timeout value ${e} ms is less than the recommended minimum of 10000 ms. Please consider increasing the timeout value to ensure optimal performance and reliability.`)),{timeout:t,autoTrack:r}}onError(e,t){this.errorHandler.onError(e,z,t)}getEncryptedCookieData(e,t){let r=[];return e.forEach(e=>{let i=t?.encrypt(eo(e.value,!1,[],this.logger));S(i)&&r.push({name:e.name,value:i})}),r}makeRequestToSetCookie(e,t){this.httpClient?.getAsyncData({url:tT.serverCookies.dataServiceUrl.value,options:{method:"POST",data:eo({reqType:"setCookies",workspaceId:tT.source.value?.workspaceId,data:{options:{maxAge:tT.storage.cookie.value?.maxage,path:tT.storage.cookie.value?.path,domain:tT.storage.cookie.value?.domain,sameSite:tT.storage.cookie.value?.samesite,secure:tT.storage.cookie.value?.secure,expires:tT.storage.cookie.value?.expires},cookies:e}}),sendRawData:!0,withCredentials:!0},isRawResponse:!0,callback:t})}setServerSideCookies(e,t,r){try{let i=this.getEncryptedCookieData(e,r);i.length>0&&this.makeRequestToSetCookie(i,(i,n)=>
4{if(n?.xhr?.status===200)e.forEach(e=>{let i=r?.get(e.name),n=eo(e.value,!1,[]);if(eo(i,!1,[])!==n){let r;this.logger.error((r=e.name,`The server failed to set the ${r} cookie. As a fallback, the cookies will be set client side.`)),t&&t(e.name,e.value)}});else{let r;this.logger.error((r=n?.xhr?.status,`The server responded with status ${r} while setting the cookies. As a fallback, the cookies will be set client side.`)),e.forEach(e=>{t&&t(e.name,e.value)})}})}catch(r){this.onError(r,"Failed to set/remove cookies via server. As a fallback, the cookies will be managed client side."),e.forEach(e=>{t&&t(e.name,e.value)})}}syncValueToStorage(e,t){let r=tT.storage.entries.value,i=r[e]?.type;if(rX(i)){let n=this.storeManager?.getStore(ra[i]),s=r[e]?.key;t&&("string"==typeof t||O(t))?tT.serverCookies.isEnabledServerSideCookies.value&&i===t5?(this.serverSideCookieDebounceFuncs[e]&&globalThis.clearTimeout(this.serverSideCookieDebounceFuncs[e]),this.serverSideCookieDebounceFuncs[e]=globalThis.setTimeout(()=>{this.setServerSideCookies([{name:s,value:t}],(e,t)=>{n?.set(e,t)},n)},10)):n?.set(s,t):n?.remove(s)}}registerEffects(){rs.forEach(e=>{eK(()=>{this.syncValueToStorage(e,tT.session[e].value)})})}setAnonymousId(e,t){let r=e;"string"==typeof e&&r||(r=void 0),this.isPersistenceEnabledForStorageEntry("anonymousId")?(!r&&t&&(r=this.pluginsManager?.invokeSingle("userSession.anonymousIdGoogleLinker",t)),r=r||rZ()):r=tl.anonymousId,tT.session.anonymousId.value=r}getAnonymousId(e){if(rX(tT.storage.entries.value.anonymousId?.type)){let t=tT.session.anonymousId.value;t&&t!==tl.anonymousId||(t=this.getEntryValue("anonymousId")),!t&&e&&(t=this.pluginsManager?.invokeSingle("storage.getAnonymousId",rw,e)),tT.session.anonymousId.value=t||rZ()}return tT.session.anonymousId.value}getEntryValue(e){let t=tT.storage.entries.value,r=t[e]?.type;if(rX(r)){let i=this.storeManager?.getStore(ra[r]);this.migrateStorageIfNeeded([i]);let n=t[e]?.key;return i?.get(n)??null}return null}getExternalAnonymousIdByCookieName(e){let t=rw(t5);return t?.isEnabled?t.getItem(e)??null:null}getUserId(){return this.getEntryValue("userId")}getUserTraits(){return this.getEntryValue("userTraits")}getGroupId(){return this.getEntryValue("groupId")}getGroupTraits(){return this.getEntryValue("groupTraits")}getInitialReferrer(){return this.getEntryValue("initialReferrer")}getInitialReferringDomain(){return this.getEntryValue("initialReferringDomain")}getSessionInfo(){return this.getEntryValue("sessionInfo")}getAuthToken(){return this.getEntryValue("authToken")}getSessionId(){let e=this.getSessionInfo()??tl.sessionInfo;return e.autoTrack&&!rW(e.expiresAt)||e.manualTrack?e.id??null:null}refreshSession(){let e=this.getSessionInfo()??tl.sessionInfo;(e.autoTrack||e.manualTrack)&&(e.autoTrack&&(this.startOrRenewAutoTracking(e),e=tT.session.sessionInfo.value),void 0===e.sessionStart?e={...e,sessionStart:!0}:e.sessionStart&&(e={...e,sessionStart:!1})),tT.session.sessionInfo.value=e,"readyExecuted"!==tT.lifecycle.status.value&&this.syncValueToStorage("sessionInfo",e)}reset(e,t){let{session:r}=tT,{manualTrack:i,autoTrack:n}=r.sessionInfo.value;eD(()=>{r.userId.value=tl.userId,r.userTraits.value=tl.userTraits,r.groupId.value=tl.groupId,r.groupTraits.value=tl.groupTraits,r.authToken.value=tl.authToken,!0===e&&this.setAnonymousId(),!t&&(n?(r.sessionInfo.value=tl.sessionInfo,this.startOrRenewAutoTracking(r.sessionInfo.value)):i&&this.startManualTrackingInternal())})}setUserId(e){tT.session.userId.value=this.isPersistenceEnabledForStorageEntry("userId")&&e?e:tl.userId}setUserTraits(e){tT.session.userTraits.value=this.isPersistenceEnabledForStorageEntry("userTraits")&&w(e)?P(tT.session.userTraits.value??tl.userTraits,e):tl.userTraits}setGroupId(e){tT.session.groupId.value=this.isPersistenceEnabledForStorageEntry("groupId")&&e?e:tl.groupId}setGroupTraits(e){tT.session.groupTraits.value=this.isPersistenceEnabledForStorageEntry("groupTraits")&&w(e)?P(tT.session.groupTraits.value??tl.groupTraits,e):tl.groupTraits}setInitialReferrer(e){tT.session.initialReferrer.value=this.isPersistenceEnabledForStorageEntry("initialReferrer")&&e?e:tl.initialReferrer}setInitialReferringDomain(e){tT.session.initialReferringDomain.value=this.isPersistenceEnabledForStorageEntry("initialReferringDomain")&&e?e:tl.initialReferringDomain}startOrRenewAutoTracking(e){if(rW(e.expiresAt))tT.session.sessionInfo.value=(e=>{let t=Date.now(),r=e||18e5;return{id:t,expiresAt:t+r,timeout:r,sessionStart:void 0,autoTrack:!0}})(e.timeout);else{let t=Date.now(),r=e.timeout;tT.session.sessionInfo.value=P(e,{expiresAt:t+r})}}start(e){tT.session.sessionInfo.value={id:((e,t)=>{if(!e||!rJ(e)||!(e.toString().length>=10))return t.warn(`${z}:: The provided session ID (${e}) is either invalid, not a positive integer, or not at least "10" digits long. A new session ID will be auto-generated instead.`),!1;return!0})(e,this.logger)?e:Date.now(),sessionStart:void 0,manualTrack:!0}}startManualTrackingInternal(){this.start(Date.now())}end(){tT.session.sessionInfo.value=tl.sessionInfo}setAuthToken(e){tT.session.authToken.value=this.isPersistenceEnabledForStorageEntry("authToken")&&e?e:tl.authToken}}let r6=["BeaconQueue","CustomConsentManager","DeviceModeDestinations","DeviceModeTransformation","ExternalAnonymousId","GoogleLinker","IubendaConsentManager","KetchConsentManager","NativeDestinationQueue","OneTrustConsentManager","StorageEncryption","StorageEncryptionLegacy","StorageMigrator","XhrQueue"],r8="dataplaneEventsQueue",r5="destinationsEventsQueue",r4=(e,t,r,i)=>{if(I(e))if(k(e))try{e(...t)}catch(e){i.error(`${r}:: The callback threw an exception`,e)}else i.error(e6(r))};class r9{constructor(e,t,r,i,n){this.pluginsManager=e,this.errorHandler=i,this.httpClient=r,this.logger=n,this.storeManager=t}init(){let e;this.dataplaneEventsQueue=this.pluginsManager.invokeSingle(`${r8}.init`,tT,this.httpClient,this.storeManager,this.errorHandler,this.logger),this.dmtEventsQueue=this.pluginsManager.invokeSingle("transformEvent.init",tT,this.pluginsManager,this.httpClient,this.storeManager,this.errorHandler,this.logger),this.destinationsEventsQueue=this.pluginsManager.invokeSingle(`${r5}.init`,tT,this.pluginsManager,this.storeManager,this.dmtEventsQueue,this.errorHandler,this.logger),eK(()=>{!0===tT.nativeDestinations.clientDestinationsReady.value&&(this.destinationsEventsQueue?.start(),this.dmtEventsQueue?.start())});let t=tT.consents.preConsent.value.enabled&&tT.consents.preConsent.value.events?.delivery==="buffer";eK(()=>{let r=!0===tT.loadOptions.value.bufferDataPlaneEventsUntilReady&&!1===tT.nativeDestinations.clientDestinationsReady.value;!1!==tT.nativeDestinations.activeDestinations.value.some(e=>"hybrid"===e.config.connectionMode||!0===e.config.useNativeSDKToSend)&&!1!==r||t||this.dataplaneEventsQueue?.scheduleTimeoutActive===!0||(globalThis.clearTimeout(e),this.dataplaneEventsQueue?.start())}),!0===tT.loadOptions.value.bufferDataPlaneEventsUntilReady&&(e=globalThis.setTimeout(()=>{this.dataplaneEventsQueue?.scheduleTimeoutActive!==!0&&this.dataplaneEventsQueue?.start()},tT.loadOptions.value.dataPlaneEventsBufferTimeout))}resume(){this.dataplaneEventsQueue?.scheduleTimeoutActive!==!0&&(tT.consents.postConsent.value.discardPreConsentEvents&&(this.dataplaneEventsQueue?.clear(),this.destinationsEventsQueue?.clear()),this.dataplaneEventsQueue?.start())}enqueue(e,t){let r=((e,t)=>{let r,i,n=v(e),s=t.nativeDestinations.integrationsConfig.value,a=(r=e.integrations,i=s,Object.keys(r).filter(e=>!0!==r[e]||!i[e]).reduce((e,t)=>
4{let i=v(e);return i[t]=r[t],i},{}));return n.integrations=P(s,a),n})(e,tT);this.pluginsManager.invokeSingle(`${r8}.enqueue`,tT,this.dataplaneEventsQueue,r,this.errorHandler,this.logger);let i=v(e);this.pluginsManager.invokeSingle(`${r5}.enqueue`,tT,this.destinationsEventsQueue,i,this.errorHandler,this.logger),r4(t,[r],`${e.type.charAt(0).toUpperCase()}${e.type.slice(1)}API`,this.logger)}}let r7=e=>{let t=new CustomEvent(e,{detail:{analyticsInstance:globalThis.rudderanalytics},bubbles:!0,cancelable:!0,composed:!0});globalThis.document.dispatchEvent(t)};class ie{constructor(){this.preloadBuffer=new eq,this.initialized=!1,this.errorHandler=tV,this.logger=eZ,this.externalSrcLoader=new eC(this.errorHandler,this.logger),this.httpClient=tH,this.httpClient.init(this.errorHandler),this.capabilitiesManager=new rQ(this.httpClient,this.errorHandler,this.logger)}load(e,t,r={}){if(!tT.lifecycle.status.value){let i;if(!("string"==typeof(i=e)&&i.trim().length>0))return void this.logger.error(`${W}:: The write key "${e}" is invalid. It must be a non-empty string. Please check that the write key is correct and try again.`);if(!rN(t))return void this.logger.error(`${W}:: The data plane URL "${t}" is invalid. It must be a valid URL string. Please check that the data plane URL is correct and try again.`);eD(()=>{tT.lifecycle.writeKey.value=v(e),tT.lifecycle.dataPlaneUrl.value=v(t),tT.loadOptions.value=((e,t)=>{let r=v(t);return"string"!=typeof r.setCookieDomain&&(r.setCookieDomain=void 0),["Strict","Lax","None"].includes(r.sameSiteCookie)||(r.sameSiteCookie=void 0),r.secureCookie=N(r.secureCookie,e.secureCookie),r.sameDomainCookiesOnly=N(r.sameDomainCookiesOnly,e.sameDomainCookiesOnly),["none","default","full"].includes(r.uaChTrackLevel)||(r.uaChTrackLevel=void 0),r.integrations=$(r.integrations),Array.isArray(r.plugins)||(r.plugins=r6),r.useGlobalIntegrationsConfigInEvents=N(r.useGlobalIntegrationsConfigInEvents,e.useGlobalIntegrationsConfigInEvents),r.bufferDataPlaneEventsUntilReady=N(r.bufferDataPlaneEventsUntilReady,e.bufferDataPlaneEventsUntilReady),r.sendAdblockPage=N(r.sendAdblockPage,e.sendAdblockPage),r.useServerSideCookies=N(r.useServerSideCookies,e.useServerSideCookies),"string"!=typeof r.dataServiceEndpoint&&(r.dataServiceEndpoint=void 0),r.sendAdblockPageOptions=$(r.sendAdblockPageOptions),r.loadIntegration=N(r.loadIntegration,e.loadIntegration),O(r.storage)?(r.storage.migrate=N(r.storage.migrate,e.storage?.migrate),r.storage.cookie=$(r.storage.cookie),r.storage.encryption=$(r.storage.encryption),r.storage=R(r.storage)):r.storage=void 0,r.destinationsQueueOptions=$(r.destinationsQueueOptions),r.queueOptions=$(r.queueOptions),r.lockIntegrationsVersion=N(r.lockIntegrationsVersion,e.lockIntegrationsVersion),r.lockPluginsVersion=N(r.lockPluginsVersion,e.lockPluginsVersion),rq(r.dataPlaneEventsBufferTimeout)||(r.dataPlaneEventsBufferTimeout=void 0),r.beaconQueueOptions=$(r.beaconQueueOptions),r.preConsent=$(r.preConsent),P(e,R(r))})(tT.loadOptions.value,r),tT.lifecycle.status.value="mounted"}),this.logger.setMinLogLevel(tT.loadOptions.value.logLevel??eW),eS("state",tT,e),this.startLifecycle()}}startLifecycle(){eK(()=>{try{switch(tT.lifecycle.status.value){case"mounted":this.onMounted();break;case"browserCapabilitiesReady":this.onBrowserCapabilitiesReady();break;case"configured":this.onConfigured();break;case"pluginsLoading":case"destinationsLoading":break;case"pluginsReady":this.onPluginsReady();break;case"initialized":this.onInitialized();break;case"loaded":this.onLoaded();break;case"destinationsReady":this.onDestinationsReady();break;case"ready":this.onReady()}}catch(e){this.errorHandler.onError(eg(e,"Failed to load the SDK"),W)}})}onBrowserCapabilitiesReady(){let e=eT(ey)||[];((e=[])=>{let t="ajs_trait_",r="ajs_prop_",i=new URLSearchParams(globalThis.location.search);i.get(eE)&&e.unshift(["track",i.get(eE),eA(i,r)]),i.get(eb)&&e.unshift(["identify",i.get(eb),eA(i,t)]),i.get(em)&&e.unshift(["setAnonymousId",i.get(em)])})(e),e.length>0&&(this.enqueuePreloadBufferEvents(e),eS(ey,[])),this.prepareInternalServices(),this.loadConfig()}onLoaded(){this.processBufferedEvents(),!0===tT.consents.preConsent.value.enabled?tT.lifecycle.status.value="ready":this.loadDestinations()}onMounted(){this.capabilitiesManager.init()}
4enqueuePreloadBufferEvents(e){Array.isArray(e)&&e.forEach(e=>this.preloadBuffer.enqueue(v(e)))}processDataInPreloadBuffer(){for(;this.preloadBuffer.size()>0;){let e=this.preloadBuffer.dequeue();e&&ew([...e],this)}}prepareInternalServices(){this.pluginsManager=new t8(tK,this.errorHandler,this.logger),this.storeManager=new rP(this.pluginsManager,this.errorHandler,this.logger),this.configManager=new rj(this.httpClient,this.errorHandler,this.logger),this.userSessionManager=new r3(this.pluginsManager,this.storeManager,this.httpClient,this.errorHandler,this.logger),this.eventRepository=new r9(this.pluginsManager,this.storeManager,this.httpClient,this.errorHandler,this.logger),this.eventManager=new r2(this.eventRepository,this.userSessionManager,this.errorHandler,this.logger)}loadConfig(){tT.lifecycle.writeKey.value&&this.httpClient.setAuthHeader(tT.lifecycle.writeKey.value),this.configManager?.init()}onPluginsReady(){this.storeManager?.init(),this.userSessionManager?.init(),tT.consents.enabled.value&&!tT.consents.initialized.value&&(this.pluginsManager?.invokeSingle("consentManager.init",tT,this.logger),!1===tT.consents.preConsent.value.enabled&&this.pluginsManager?.invokeSingle("consentManager.updateConsentsInfo",tT,this.storeManager,this.logger)),this.eventManager?.init(),tT.lifecycle.status.value="initialized"}onConfigured(){this.pluginsManager?.init()}onInitialized(){this.processDataInPreloadBuffer(),r4(tT.loadOptions.value.onLoaded,[globalThis.rudderanalytics],"LoadAPI",this.logger),eD(()=>{tT.lifecycle.loaded.value=!0,tT.lifecycle.status.value="loaded"}),this.initialized=!0,r7("RSA_Initialised")}onReady(){tT.lifecycle.status.value="readyExecuted",tT.eventBuffer.readyCallbacksArray.value.forEach(e=>{r4(e,[],J,this.logger)}),r7("RSA_Ready")}processBufferedEvents(){let e=tT.eventBuffer.toBeProcessedArray.value;for(;e.length>0;){let t=e.shift();if(tT.eventBuffer.toBeProcessedArray.value=e,t){let e=t[0];k(this[e])&&this[e](...t.slice(1),!0)}e=tT.eventBuffer.toBeProcessedArray.value}}loadDestinations(){if("destinationsLoading"===tT.lifecycle.status.value||"destinationsReady"===tT.lifecycle.status.value)return;this.pluginsManager?.invokeSingle("nativeDestinations.setActiveDestinations",tT,this.pluginsManager,this.errorHandler,this.logger);let e=tT.nativeDestinations.activeDestinations.value.length;if(0===e){tT.lifecycle.status.value="destinationsReady";return}tT.lifecycle.status.value="destinationsLoading",this.pluginsManager?.invokeSingle("nativeDestinations.load",tT,this.externalSrcLoader,this.errorHandler,this.logger),eK(()=>{(0===e||tT.nativeDestinations.initializedDestinations.value.length+tT.nativeDestinations.failedDestinations.value.length===e)&&eD(()=>{tT.lifecycle.status.value="destinationsReady",tT.nativeDestinations.clientDestinationsReady.value=!0})})}onDestinationsReady(){"ready"!==tT.lifecycle.status.value&&(tT.lifecycle.status.value="ready")}ready(e,t=!1){let r="ready";if(!tT.lifecycle.loaded.value){tT.eventBuffer.toBeProcessedArray.value=[...tT.eventBuffer.toBeProcessedArray.value,[r,e]];return}if(this.errorHandler.leaveBreadcrumb(`New ${r} invocation`),!k(e))return void this.logger.error(e6(J));"readyExecuted"===tT.lifecycle.status.value?r4(e,[],J,this.logger):tT.eventBuffer.readyCallbacksArray.value=[...tT.eventBuffer.readyCallbacksArray.value,e]}page(e,t=!1){let r="page";if(!tT.lifecycle.loaded.value){tT.eventBuffer.toBeProcessedArray.value=[...tT.eventBuffer.toBeProcessedArray.value,[r,e]];return}this.errorHandler.leaveBreadcrumb(`New ${r} event`),tT.metrics.triggered.value+=1,this.eventManager?.addEvent({type:"page",category:e.category,name:e.name,properties:e.properties,options:e.options,callback:e.callback}),!0===tT.capabilities.isAdBlocked.value&&e.category!==ef&&this.page(x(ef,"ad-block page request",{path:"/ad-blocked"},tT.loadOptions.value.sendAdblockPageOptions))}track(e,t=!1){let r="track";if(!tT.lifecycle.loaded.value){tT.eventBuffer.toBeProcessedArray.value=[...tT.eventBuffer.toBeProcessedArray.value,[r,e]];return}this.errorHandler.leaveBreadcrumb(`New ${r} event - ${e.name}`),tT.metrics.triggered.value+=1,this.eventManager?.addEvent({type:r,name:e.name||void 0,properties:e.properties,options:e.options,callback:e.callback})}identify(e,t=!1){let r="identify";if(!tT.lifecycle.loaded.value){tT.eventBuffer.toBeProcessedArray.value=[...tT.eventBuffer.toBeProcessedArray.value,[r,e]];return}this.errorHandler.leaveBreadcrumb(`New ${r} event`),tT.metrics.triggered.value+=1,e.userId&&tT.session.userId.value&&e.userId!==tT.session.userId.value&&this.reset(),null!==e.userId&&this.userSessionManager?.setUserId(e.userId),this.userSessionManager?.setUserTraits(e.traits),this.eventManager?.addEvent({type:r,userId:e.userId,traits:e.traits,options:e.options,callback:e.callback})}alias(e,t=!1){let r="alias";if(!tT.lifecycle.loaded.value){tT.eventBuffer.toBeProcessedArray.value=[...tT.eventBuffer.toBeProcessedArray.value,[r,e]];return}this.errorHandler.leaveBreadcrumb(`New ${r} event`),tT.metrics.triggered.value+=1;let i=e.from??(this.getUserId()||this.userSessionManager?.getAnonymousId());this.eventManager?.addEvent({type:r,to:e.to,from:i,options:e.options,callback:e.callback})}group(e,t=!1){let r="group";if(!tT.lifecycle.loaded.value){tT.eventBuffer.toBeProcessedArray.value=[...tT.eventBuffer.toBeProcessedArray.value,[r,e]];return}this.errorHandler.leaveBreadcrumb(`New ${r} event`),tT.metrics.triggered.value+=1,null!==e.groupId&&this.userSessionManager?.setGroupId(e.groupId),this.userSessionManager?.setGroupTraits(e.traits),this.eventManager?.addEvent({type:r,groupId:e.groupId,traits:e.traits,options:e.options,callback:e.callback})}reset(e,t=!1){let r="reset";if(!tT.lifecycle.loaded.value){tT.eventBuffer.toBeProcessedArray.value=[...tT.eventBuffer.toBeProcessedArray.value,[r,e]];return}this.errorHandler.leaveBreadcrumb(`New ${r} invocation, resetAnonymousId: ${e}`),this.userSessionManager?.reset(e)}getAnonymousId(e){return this.userSessionManager?.getAnonymousId(e)}setAnonymousId(e,t,r=!1){let i="setAnonymousId";if(!tT.lifecycle.loaded.value){tT.eventBuffer.toBeProcessedArray.value=[...tT.eventBuffer.toBeProcessedArray.value,[i,e,t]];return}this.errorHandler.leaveBreadcrumb(`New ${i} invocation`),this.userSessionManager?.setAnonymousId(e,t)}getUserId(){return tT.session.userId.value}getUserTraits(){return tT.session.userTraits.value}getGroupId(){return tT.session.groupId.value}getGroupTraits(){return tT.session.groupTraits.value}startSession(e,t=!1){let r="startSession";if(!tT.lifecycle.loaded.value){tT.eventBuffer.toBeProcessedArray.value=[...tT.eventBuffer.toBeProcessedArray.value,[r,e]];return}this.errorHandler.leaveBreadcrumb(`New ${r} invocation`),this.userSessionManager?.start(e)}endSession(e=!1){let t="endSession";if(!tT.lifecycle.loaded.value){tT.eventBuffer.toBeProcessedArray.value=[...tT.eventBuffer.toBeProcessedArray.value,[t]];return}this.errorHandler.leaveBreadcrumb(`New ${t} invocation`),this.userSessionManager?.end()}getSessionId(){return this.userSessionManager?.getSessionId()??null}consent(e,t=!1){if(!tT.lifecycle.loaded.value){tT.eventBuffer.toBeProcessedArray.value=[...tT.eventBuffer.toBeProcessedArray.value,["consent",e]];return}this.errorHandler.leaveBreadcrumb("New consent invocation"),eD(()=>{tT.consents.preConsent.value={...tT.consents.preConsent.value,enabled:!1},tT.consents.postConsent.value=(e=>{let t={sendPageEvent:!1,trackConsent:!1,discardPreConsentEvents:!1};if(w(e)){let r=v(e);t.storage=r.storage,O(r.integrations)&&(t.integrations=r.integrations),t.discardPreConsentEvents=!0===r.discardPreConsentEvents,t.sendPageEvent=!0===r.sendPageEvent,t.trackConsent=!0===r.trackConsent,O(r.consentManagement)&&(t.consentManagement=P(r.consentManagement,{enabled:tT.consents.enabled.value}))}return t})(e);let{initialized:t,consentsData:r}=rB(tT.consents.postConsent.value.consentManagement,this.logger);tT.consents.initialized.value=t,tT.consents.data.value=r}),tT.consents.enabled.value&&!tT.consents.initialized.value&&this.pluginsManager?.invokeSingle("consentManager.updateConsentsInfo",tT,this.storeManager,this.logger),this.storeManager?.initializeStorageState(),this.userSessionManager?.syncStorageDataToState(),this.eventManager?.resume(),this.loadDestinations(),this.sendTrackingEvents(t)}sendTrackingEvents(e){if(tT.consents.postConsent.value.trackConsent){let t=B("Consent Management Interaction");e?tT.eventBuffer.toBeProcessedArray.value=[...tT.eventBuffer.toBeProcessedArray.value,["track",t]]:this.track(t)}if(tT.consents.postConsent.value.sendPageEvent){let t=x();e?tT.eventBuffer.toBeProcessedArray.value=[...tT.eventBuffer.toBeProcessedArray.value,["page",t]]:this.page(t)}}setAuthToken(e){this.userSessionManager?.setAuthToken(e)}}class it{static globalSingleton=null;analyticsInstances={};defaultAnalyticsKey="";logger=eZ;constructor(){try{if(it.globalSingleton)return it.globalSingleton;it.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.startSession=this.startSession.bind(this),this.endSession=this.endSession.bind(this),this.get
4SessionId=this.getSessionId.bind(this),this.setAuthToken=this.setAuthToken.bind(this),this.consent=this.consent.bind(this),it.globalSingleton=this,tT.autoTrack.pageLifecycle.pageViewId.value=ei(),tT.autoTrack.pageLifecycle.pageLoadedTimestamp.value=Date.now(),this.triggerBufferedLoadEvent(),globalThis.rudderanalytics=this}catch(e){eh(e)}}static initializeGlobalResources(){tV.init(),rA.configure(),rk.configure(),rS.configure(),rg.configure()}setDefaultInstanceKey(e){"string"==typeof e&&e&&(this.defaultAnalyticsKey=e)}getAnalyticsInstance(e){try{let t,r=e;return t=r,"string"==typeof t&&r||(r=this.defaultAnalyticsKey),this.analyticsInstances[r]||(this.analyticsInstances[r]=new ie),this.analyticsInstances[r]}catch(e){eh(e);return}}load(e,t,r){try{if(this.analyticsInstances[e])return;this.setDefaultInstanceKey(e),this.trackPageLifecycleEvents(r);let i=eT(ey),n="consent",s=i.filter(e=>e[0]===n),a=i.filter(e=>e[0]!==n);i.splice(0,i.length,...s,...a),eS(ey,v(i)),this.getAnalyticsInstance(e)?.load(e,t,eu(r))}catch(e){eh(e)}}trackPageLifecycleEvents(e){let{autoTrack:t,useBeacon:r}=e??{},{enabled:i=!1,options:n={},pageLifecycle:s}=t??{},{events:a=[H.UNLOADED],enabled:o=i,options:l=n}=s??{};tT.autoTrack.pageLifecycle.enabled.value=o,tT.autoTrack.enabled.value=i||o,o&&this.setupPageUnloadTracking(a,r,l)}setupPageUnloadTracking(e,t,r){(0===e.length||e.includes(H.UNLOADED))&&(!0===t?(e=>{let t=!1,r=!1;function i(){t||(t=!0,e(r),setTimeout(()=>{t=!1},0))}globalThis.addEventListener("beforeunload",()=>{r=!1,i()}),globalThis.addEventListener("blur",()=>{r=!0,i()}),globalThis.addEventListener("focus",()=>{t=!1}),document.addEventListener("pagehide",()=>{r="hidden"===document.visibilityState,i()}),document.addEventListener("visibilitychange",()=>{r=!0,"hidden"===document.visibilityState?i():t=!1})})(e=>{if(!1===e&&tT.lifecycle.loaded.value){let e=Date.now(),t=e-tT.autoTrack.pageLifecycle.pageLoadedTimestamp.value;this.track(H.UNLOADED,{timeOnPage:t},{...r,originalTimestamp:en(new Date(e))})}}):this.logger.warn('RudderStackAnalytics:: Page Unloaded event can only be tracked when the Beacon transport is active. Please enable "useBeacon" load API option.'))}triggerBufferedLoadEvent(){let e=Array.isArray(globalThis.rudderanalytics)?globalThis.rudderanalytics:[],t=(e=>{let t=[],r=0;for(;r<e.length;){if(e[r]&&"load"===e[r][0]){t=v(e[r]),e.splice(r,1);break}r+=1}return t})(e);eS(ey,v([...e])),t.length>0&&(t.shift(),this.load.apply(null,t))}ready(e){try{this.getAnalyticsInstance()?.ready(eu(e))}catch(e){eh(e)}}page(e,t,r,i,n){try{this.getAnalyticsInstance()?.page(x(eu(e),eu(t),eu(r),eu(i),eu(n)))}catch(e){eh(e)}}track(e,t,r,i){try{this.getAnalyticsInstance()?.track(B(eu(e),eu(t),eu(r),eu(i)))}catch(e){eh(e)}}identify(e,t,r,i){try{this.getAnalyticsInstance()?.identify(U(eu(e),eu(t),eu(r),eu(i)))}catch(e){eh(e)}}alias(e,t,r,i){try{this.getAnalyticsInstance()?.alias(j(eu(e),eu(t),eu(r),eu(i)))}catch(e){eh(e)}}group(e,t,r,i){try{this.getAnalyticsInstance()?.group(_(eu(e),eu(t),eu(r),eu(i)))}catch(e){eh(e)}}reset(e){try{this.getAnalyticsInstance()?.reset(eu(e))}catch(e){eh(e)}}getAnonymousId(e){try{return this.getAnalyticsInstance()?.getAnonymousId(eu(e))}catch(e){eh(e);return}}setAnonymousId(e,t){try{this.getAnalyticsInstance()?.setAnonymousId(eu(e),eu(t))}catch(e){eh(e)}}getUserId(){try{return this.getAnalyticsInstance()?.getUserId()}catch(e){eh(e);return}}getUserTraits(){try{return this.getAnalyticsInstance()?.getUserTraits()}catch(e){eh(e);return}}getGroupId(){try{return this.getAnalyticsInstance()?.getGroupId()}catch(e){eh(e);return}}getGroupTraits(){try{return this.getAnalyticsInstance()?.getGroupTraits()}catch(e){eh(e);return}}startSession(e){try{this.getAnalyticsInstance()?.startSession(eu(e))}catch(e){eh(e)}}endSession(){try{this.getAnalyticsInstance()?.endSession()}catch(e){eh(e)}}getSessionId(){try{return this.getAnalyticsInstance()?.getSessionId()}catch(e){eh(e);return}}setAuthToken(e){try{this.getAnalyticsInstance()?.setAuthToken(eu(e))}catch(e){eh(e)}}consent(e){try{this.getAnalyticsInstance()?.consent(eu(e))}catch(e){eh(e)}}}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.