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