@uniformdev/context 12.2.1-alpha.142 → 12.2.1-alpha.177
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/api.d.ts +20 -2
- package/dist/api/api.js +2 -2
- package/dist/api/api.mjs +1 -1
- package/dist/chunk-GU2YFM6V.mjs +1 -0
- package/dist/chunk-JKQJOIRC.mjs +2 -0
- package/dist/chunk-KZPEO35A.mjs +1 -0
- package/dist/cli/cli.js +55 -21
- package/dist/cli/cli.mjs +54 -20
- package/dist/index.d.ts +34 -553
- package/dist/index.esm.js +3 -3
- package/dist/index.js +3 -3
- package/dist/index.mjs +3 -3
- package/dist/types-1ad8439c.d.ts +987 -0
- package/package.json +4 -4
- package/dist/chunk-TRWANXVF.mjs +0 -1
- package/dist/chunk-WLJXJJSU.mjs +0 -2
- package/dist/v2-manifest.swagger-d0899723.d.ts +0 -285
package/dist/index.esm.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
import{b as y,c as s,d as u,e as m,f as h}from"./chunk-TRWANXVF.mjs";function nt(i,t){let e={...i};for(let r in t){let o=at(i,r,t,new Set([r]));o!==0&&(e[r]=o)}return e}function at(i,t,e,r){var n;let o=0;for(let a of e[t].inputs){let c=(n=i[a.dim])!=null?n:0;if(!c&&e[a.dim]){if(r.has(a.dim))continue;let f=new Set(r);f.add(a.dim),c=at(i,a.dim,e,f)}if(c!==0)if(a.sign==="c"){o=0;break}else a.sign==="-"?o-=c:o+=c}return o}var A,k,X=class{constructor(t,e,r){u(this,A,void 0);u(this,k,void 0);y(this,"signal");m(this,k,t),this.signal=e,m(this,A,r)}computeSignals(t,e){if(t.scores[s(this,k)]>=this.signal.cap&&this.signal.dur!=="t")return;let o=s(this,A).evaluate(t,this.signal.crit,e,this.signal,s(this,k)),n=this.signal.dur==="s"||this.signal.dur==="t"?"modscoreS":"modscore";if(o)e.push({type:n,data:{dimension:s(this,k),delta:this.signal.str}});else if(this.signal.dur==="t"){let a=t.visitor.sessionScores[s(this,k)];a&&e.push({type:n,data:{dimension:s(this,k),delta:-a}})}}};A=new WeakMap,k=new WeakMap;var ct="_",C,$,R=class{constructor({manifest:t,evaluator:e=new N({})}){u(this,C,void 0);u(this,$,void 0);var r,o,n;m(this,C,(r=t.project)!=null?r:{}),m(this,$,Object.entries((n=(o=s(this,C).pz)==null?void 0:o.sig)!=null?n:[]).map(([a,c])=>new X(a,c,e)))}rollForControlGroup(){var t,e;return Math.random()<((e=(t=s(this,C).pz)==null?void 0:t.control)!=null?e:0)}getTest(t){var e;return(e=s(this,C).test)==null?void 0:e[t]}computeSignals(t){let e=[];return s(this,$).forEach(r=>{r.computeSignals(t,e)}),e}computeAggregateDimensions(t){var e,r;return nt(t,(r=(e=s(this,C).pz)==null?void 0:e.agg)!=null?r:{})}getDimensionByKey(t){var r,o,n,a;let e=t.indexOf(ct);return e<=0?(o=(r=s(this,C).pz)==null?void 0:r.sig)==null?void 0:o[t]:(a=(n=s(this,C).pz)==null?void 0:n.enr)==null?void 0:a[t.substring(0,e)]}static getEnrichmentVectorKey(t,e){return`${t}${ct}${e}`}};C=new WeakMap,$=new WeakMap;var ut=(i,t)=>{var o;if(t.type!=="CK")return!1;let e=(o=i.state.cookies)==null?void 0:o[t.cookieName];return x(e,t.match)};function dt(i,t){var r;if(typeof i=="undefined"||i===null)return!1;let e=Number(i);if(isNaN(e))return!1;switch((r=t==null?void 0:t.op)!=null?r:"="){case"=":return e===t.rhs;case"!=":return e!==t.rhs;case">":return e>t.rhs;case"<":return e<t.rhs;default:return console.warn(`Unknown match type ${t.op} is false.`),!1}}var Z=R.getEnrichmentVectorKey("$pvc","v"),lt=(i,t,e)=>{var a,c;if(t.type!=="PVC")return!1;let r=!i.previousState||((a=i.state.url)==null?void 0:a.toString())!==((c=i.previousState.url)==null?void 0:c.toString()),n=(i.visitor.sessionScores[Z]||0)+1;if(dt(n,t.match)){let d=e.some(f=>f.type==="modscoreS"&&f.data.dimension===Z);return r&&!d&&e.push({type:"modscoreS",data:{dimension:Z,delta:1}}),!0}return!1};var pt=(i,t)=>{var r;if(t.type!=="QS")return!1;let e=(r=i.state.url)==null?void 0:r.searchParams.get(t.queryName);return x(e,t.match)};var mt=(i,t,e,r,o)=>{if(t.type!=="QK")return!1;if(typeof window=="undefined"&&r.dur==="t"&&i.scores[o]>0)return!0;let n=i.visitor.quirks[t.key];return x(n,t.match)};var ft=(i,t)=>{var e,r;return t.type!=="EVT"?!1:(r=(e=i.state.events)==null?void 0:e.some(o=>x(o.event,t.event)))!=null?r:!1};var gt=(i,t)=>{var e;return t.type!=="PV"?!1:x((e=i.state.url)==null?void 0:e.pathname,t.path)};var G,N=class{constructor(t){u(this,G,void 0);m(this,G,t)}evaluate(t,e,r,o,n){let a=!(e.op==="&"||!e.op);for(let c of e.clauses){let d;if(c.type==="G")d=this.evaluate(t,c,r,o,n);else{let f=s(this,G)[c.type];if(!f)throw new Error(`${c.type} signal criteria not registered`);d=f(t,c,r,o,n)}if(d===a)return a}return!a}};G=new WeakMap;function x(i,t){var a,c,d,f;let e=(a=t==null?void 0:t.op)!=null?a:"=";if(t.op==="*")return i!==null&&typeof i!="undefined";if(t.op==="!*")return i===null||typeof i=="undefined";if(!("rhs"in t))throw new Error(`Match expression is required for match type ${e}`);let r=(c=t.cs)!=null?c:!1,o=r?i!=null?i:"":ht(i),n=r?t.rhs:ht(t.rhs);switch(e){case"=":return o===n;case"!=":return o!==n;case"~":return(d=o.includes(n))!=null?d:!1;case"!~":return!((f=o.includes(n))!=null?f:!0);case"//":return new RegExp(t.rhs,r?"":"i").test(i!=null?i:"");case"!//":return!new RegExp(t.rhs,r?"":"i").test(i!=null?i:"");default:throw new Error(`Unknown match type ${e}.`)}}function ht(i){var t;return(t=i==null?void 0:i.toUpperCase())!=null?t:""}var K=()=>({quirks:{},scores:{},sessionScores:{},tests:{},consent:!1,controlGroup:!1});import Ot from"mitt";import{dequal as Ut}from"dequal/lite";var It="__UNIFORM_DATA__",T,q,j=class{constructor({initialData:t}){u(this,T,void 0);u(this,q,Ot());y(this,"events",{on:s(this,q).on,off:s(this,q).off});t&&m(this,T,t)}get data(){return s(this,T)}updateData(t,e){return m(this,T,e),this.handleUpdateData(t,e)}async delete(t){m(this,T,void 0),await this.handleDelete(t)}signalAsyncDataUpdate(t){Ut(this.data,t)||(m(this,T,t),s(this,q).emit("dataUpdatedAsync",t))}getClientTransitionState(){if(typeof document=="undefined")return;let t=document.getElementById(It);return(t==null?void 0:t.textContent)?JSON.parse(t.textContent):void 0}};T=new WeakMap,q=new WeakMap;import{ntob as Rt,bton as qt}from"number-to-base64";var St=typeof window=="undefined",O,U,Lt=class extends j{constructor({cookieAdapter:t,cookieName:e="ufvd"}){super({initialData:St?zt(t.get(e)):void 0});u(this,O,void 0);u(this,U,void 0);m(this,O,e),m(this,U,t)}handleDelete(){return s(this,U).remove(s(this,O)),Promise.resolve()}async handleUpdateData(t,e){St||(e.consent?s(this,U).set(s(this,O),At(e)):s(this,U).remove(s(this,O)))}};O=new WeakMap,U=new WeakMap;var yt="~",vt="!",Dt="-";function zt(i){if(!i)return;let t=i.split(yt);if(t.length>3)return;let[e,r,o]=t;return{consent:!0,sessionScores:Vt(tt(r)),scores:Vt(tt(o)),tests:tt(e)}}function tt(i){return i.split(vt).map(e=>e.split(Dt)).reduce((e,r)=>(r.length!==2||(e[r[0]]=r[1]),e),{})}function Vt(i){return Object.entries(i).reduce((t,[e,r])=>(t[e]=qt(r),t),{})}function At(i){return[et(i.tests),et(Ct(i.sessionScores)),et(Ct(i.scores))].join(yt)}function Ct(i){return Object.entries(i).reduce((t,[e,r])=>(t[e]=Rt(r),t),{})}function et(i){return Object.entries(i).map(t=>t.join(Dt)).join(vt)}var J,Nt,$t=class extends j{constructor({cookieAdapter:t,visitorIdCookieName:e="ufvi",...r}){super(r);u(this,J);r.initialData||h(this,J,Nt).call(this).catch(o=>{console.error(o)})}handleDelete(t){throw new Error("Method not implemented.")}async handleUpdateData(t){let e=await new Promise(r=>{setTimeout(()=>{r(void 0)},2e3)});e&&this.signalAsyncDataUpdate(e)}};J=new WeakSet,Nt=async function(){let t=await new Promise(e=>{setTimeout(()=>{e(void 0)},2e3)});t&&this.signalAsyncDataUpdate(t)};function Ae(i){let{gracePeriod:t=864e5,decayRate:e=1/30,decayCap:r=.95}=i!=null?i:{};return function({now:n,lastUpd:a,scores:c,sessionScores:d}){if(typeof a!="number")return!1;let M=n-a-t;if(M<=0)return!1;let Q=M/864e5,W=1-Math.min(r,Q*e);return W<=0?!1:(xt(c,W),xt(d,W),!0)}}function xt(i,t){for(let e in i)i[e]*=t}import _t from"mitt";import{dequal as it}from"dequal/lite";var rt=class{constructor(){y(this,"inMemoryFallback",{});y(this,"hasLocalStorageObject",typeof localStorage!="undefined")}get(t){let e=this.inMemoryFallback[t];if(!this.hasLocalStorageObject||e)return e;try{let r=localStorage.getItem(t);return r?JSON.parse(r):void 0}catch(r){return e}}set(t,e,r){if(this.inMemoryFallback[t]=e,!(!this.hasLocalStorageObject||!r))try{localStorage.setItem(t,JSON.stringify(e))}catch(o){console.warn(o)}}delete(t,e){e||delete this.inMemoryFallback[t];try{localStorage.removeItem(t)}catch(r){}}};import Gt from"rfdc";var jt=Gt();function kt(i,t,e){let r=t?jt(t):K();return i.forEach(o=>{var n,a;switch(o.type){case"consent":r.consent=o.data;break;case"setquirk":r.quirks[o.data.key]=o.data.value;break;case"settest":r.tests[o.data.test]=o.data.variant;break;case"modscore":if(e)break;let c=(n=r.scores[o.data.dimension])!=null?n:0;r.scores[o.data.dimension]=c+o.data.delta;break;case"modscoreS":if(e)break;let d=(a=r.sessionScores[o.data.dimension])!=null?a:0;r.sessionScores[o.data.dimension]=d+o.data.delta;break;case"identify":break;default:throw new Error("Unknown command")}}),r}var B="ufvisitor",v,I,z,S,D,w,b,L,Y,Ft,H,Qt,_,bt,F,Et,ot=class{constructor(t){u(this,D);u(this,b);u(this,Y);u(this,H);u(this,_);u(this,F);u(this,v,_t());u(this,I,new rt);u(this,z,void 0);u(this,S,void 0);y(this,"events",{on:s(this,v).on,off:s(this,v).off});if(m(this,S,t),s(this,D,w)||h(this,b,L).call(this,h(this,F,Et).call(this),!0),t.transitionStore){let e=t.transitionStore.getClientTransitionState();e&&e.quirks&&this.updateData(Object.entries(e.quirks).map(([o,n])=>({type:"setquirk",data:{key:o,value:n}}))),t.transitionStore.events.on("dataUpdatedAsync",o=>{h(this,b,L).call(this,{...s(this,D,w).visitorData,...o})});let r=t.transitionStore.data;r&&h(this,b,L).call(this,{...s(this,D,w).visitorData,...r},!0)}}get data(){let t=s(this,D,w);if(h(this,H,Qt).call(this,t)){let{sessionScores:e,...r}=t.visitorData;return h(this,b,L).call(this,{...r,sessionScores:{}}),s(this,v).emit("log",["info",120]),s(this,D,w).visitorData}return t.visitorData}async updateData(t){var r,o;if(t.length===0)return;s(this,v).emit("log",["debug",101,t]);let e=kt(t,this.data,(r=s(this,D,w))==null?void 0:r.visitorData.controlGroup);t.some(n=>n.type==="consent"&&!n.data)&&s(this,I).delete(B,!0),h(this,b,L).call(this,e),await((o=s(this,S).transitionStore)==null?void 0:o.updateData(t,s(this,D,w).visitorData))}async delete(t){var e;s(this,I).delete(B,!1),await((e=s(this,S).transitionStore)==null?void 0:e.delete(t)),s(this,v).emit("log",["info",103,t]),h(this,b,L).call(this,h(this,F,Et).call(this))}};v=new WeakMap,I=new WeakMap,z=new WeakMap,S=new WeakMap,D=new WeakSet,w=function(){return s(this,I).get(B)},b=new WeakSet,L=function(t,e=!1){var f,M;let r=s(this,D,w),o=Date.now();h(this,_,bt).call(this,t.scores),h(this,_,bt).call(this,t.sessionScores),(M=(f=s(this,S)).decay)==null||M.call(f,{now:o,lastUpd:r==null?void 0:r.updated,scores:t.scores,sessionScores:t.sessionScores});let n=!it(r==null?void 0:r.visitorData.scores,t.scores),a=!it(r==null?void 0:r.visitorData.sessionScores,t.sessionScores),c=!it(r==null?void 0:r.visitorData.quirks,t.quirks),d={updated:o,visitorData:t};h(this,Y,Ft).call(this),s(this,I).set(B,d,!!t.consent),s(this,v).emit("log",["debug",102,t]),e||((n||a)&&s(this,v).emit("scoresUpdated",t),c&&s(this,v).emit("quirksUpdated",t))},Y=new WeakSet,Ft=function(){typeof window=="undefined"||!s(this,S).visitLifespan||(s(this,z)&&window.clearTimeout(s(this,z)),m(this,z,window.setTimeout(()=>{this.data},s(this,S).visitLifespan+50)))},H=new WeakSet,Qt=function(t){let e=s(this,S).visitLifespan;return e?t.updated+e<Date.now():!1},_=new WeakSet,bt=function(t){if(!!s(this,S).manifest)for(let e in t){let r=t[e],o=s(this,S).manifest.getDimensionByKey(e);!o||r>o.cap&&(s(this,v).emit("log",["debug",110,{dim:e,score:r,cap:o.cap}]),t[e]=o.cap)}},F=new WeakSet,Et=function(){var t,e,r;return{...K(),consent:(t=s(this,S).defaultConsent)!=null?t:!1,controlGroup:(r=(e=s(this,S).manifest)==null?void 0:e.rollForControlGroup())!=null?r:!1}};import Jt from"mitt";function Tt({context:i,variations:t,take:e=1}){var c;let r=(c=i.storage.data.controlGroup)!=null?c:!1,o=[],n=!1,a=i.scores;for(let d of t){if(o.length===e)break;if(!d.pz){o.push(d);continue}!r&&wt(d.pz,a)&&(n=!0,o.push(d))}return{personalized:n,variations:o}}function wt(i,t){return(i==null?void 0:i.crit)?!i.op||i.op==="&"?i.crit.every(e=>Pt(e,t)):i.crit.some(e=>Pt(e,t)):!0}function Pt(i,t){var a;let{op:e,l:r}=i,o=(a=t[r])!=null?a:0;if(e==="+")return Math.max(...Object.values(t))===o&&o>0;if(e==="-")return Math.min(...Object.values(t))===o&&o>0;let n=i.rDim?t[i.rDim]:i.r;if(n===void 0)return!1;if(e===">")return o>n;if(e===">=")return o>=n;if(e==="<")return o<n;if(e==="<=")return o<=n;if(e==="=")return o===n;if(e==="!=")return o!==n;throw new Error(`Unknown op: ${e}`)}var Kt=i=>{let{values:t,total:e,missingDistribution:r}=i.reduce((o,n)=>(n.testDistribution?o.total+=n.testDistribution:++o.missingDistribution,o.values.push(n.testDistribution),o),{values:[],total:0,missingDistribution:0});if(e>100)throw new Error(`Total distribution ${e} is over the maximum 100.`);if(e<100){let n=(100-e)/r;t.forEach((a,c)=>{typeof a=="undefined"&&(t[c]=n)})}return t},st=({name:i,context:t,variations:e})=>{var n;let r,o=t.getTestVariantId(i);if(o===null)return{result:void 0};if(o&&(r=e.find(a=>a.id===o),r||t.log("warn",401,{test:i,variant:o})),!r){let a=Kt(e),c=Math.floor(Math.random()*100),d=0;r=e.find((f,M)=>{let Q=a[M];if(c>d&&c<=d+Q)return f;d+=Q}),r&&t.setTestVariantId(i,(n=r.id)!=null?n:"Unknown")}return{result:r}};var E,P,V,g,Bt=class{constructor(t){u(this,E,void 0);u(this,P,{});u(this,V,void 0);u(this,g,Jt());y(this,"events",{on:s(this,g).on,off:s(this,g).off});y(this,"storage");let{manifest:e,...r}=t;m(this,V,{}),m(this,E,new R({manifest:e,evaluator:new N({CK:ut,QS:pt,QK:mt,PVC:lt,EVT:ft,PV:gt})})),this.storage=new ot({manifest:s(this,E),...r}),this.storage.events.on("log",(...n)=>s(this,g).emit("log",...n));let o=n=>{var c;let a={...n.scores};for(let d in n.sessionScores)a[d]=((c=a[d])!=null?c:0)+n.sessionScores[d];a=s(this,E).computeAggregateDimensions(a),m(this,P,a),s(this,g).emit("scoresUpdated",a),s(this,g).emit("log",["info",3,a])};this.storage.events.on("scoresUpdated",o),o(this.storage.data),this.storage.events.on("quirksUpdated",n=>{let a=s(this,E).computeSignals({scores:s(this,P),state:s(this,V),previousState:s(this,V),visitor:this.storage.data});this.storage.updateData(a),s(this,g).emit("quirksUpdated",n.quirks),s(this,g).emit("log",["info",4,n.quirks])}),s(this,g).emit("log",["debug",1,{options:t,scores:s(this,P)}])}get scores(){return s(this,P)}async update(t){let e=[];s(this,g).emit("log",["info",2,t]),t.quirks&&(e.push(...Object.entries(t.quirks).map(([o,n])=>({type:"setquirk",data:{key:o,value:n}}))),t.quirks=void 0),t.enrichments&&(e.push(...t.enrichments.map(o=>({type:"modscore",data:{dimension:R.getEnrichmentVectorKey(o.cat,o.key),delta:o.str}}))),t.enrichments=void 0);let r=s(this,V);m(this,V,{...s(this,V),...t}),e.push(...s(this,E).computeSignals({state:s(this,V),previousState:r,visitor:this.storage.data,scores:s(this,P)})),await this.storage.updateData(e)}getTestVariantId(t){var r;let e=s(this,E).getTest(t);return e?(r=e.wv)!=null?r:this.storage.data.tests[t]:(s(this,g).emit("log",["warn",401,t]),null)}setTestVariantId(t,e){this.storage.updateData([{type:"settest",data:{test:t,variant:e}}])}log(...t){s(this,g).emit("log",t)}test(t){var r;let e=st({...t,context:this});return s(this,g).emit("testResult",{name:t.name,variantId:(r=e.result)==null?void 0:r.id,control:this.storage.data.controlGroup}),e}personalize(t){let e=Tt({...t,context:this});return t.name?s(this,g).emit("personalizationResult",{name:t.name,variantIds:e.variations.map(r=>{var o;return(o=r.id)!=null?o:"Unknown"}),control:this.storage.data.controlGroup}):this.log("warn",301),e}async forget(t){m(this,V,{}),await this.storage.delete(t)}};E=new WeakMap,P=new WeakMap,V=new WeakMap,g=new WeakMap;var Dr=([i,t,...e])=>{console[i](`\u{1F94B} [${i}] Uniform event ID ${t}
|
2
|
-
`,...
|
3
|
-
`,...
|
1
|
+
import{a as J}from"./chunk-GU2YFM6V.mjs";import{d as v,e as n,f as m,g,h as y,i as u}from"./chunk-KZPEO35A.mjs";u();u();u();function ht(r,t){let e={...r};for(let o in t){let i=St(r,o,t,new Set([o]));i!==0&&(e[o]=i)}return e}function St(r,t,e,o){var s;let i=0;for(let a of e[t].inputs){let c=(s=r[a.dim])!=null?s:0;if(!c&&e[a.dim]){if(o.has(a.dim))continue;let l=new Set(o);l.add(a.dim),c=St(r,a.dim,e,l)}if(c!==0)if(a.sign==="c"){i=0;break}else a.sign==="-"?i-=c:i+=c}return i}u();var $,k,rt=class{constructor(t,e,o){m(this,$,void 0);m(this,k,void 0);v(this,"signal");g(this,k,t),this.signal=e,g(this,$,o)}computeSignals(t,e){if(t.scores[n(this,k)]>=this.signal.cap&&this.signal.dur!=="t")return;let i=n(this,$).evaluate(t,this.signal.crit,e,this.signal,n(this,k)),s=this.signal.dur==="s"||this.signal.dur==="t"?"modscoreS":"modscore";if(i)e.push({type:s,data:{dimension:n(this,k),delta:this.signal.str}});else if(this.signal.dur==="t"){let a=t.visitor.sessionScores[n(this,k)];a&&e.push({type:s,data:{dimension:n(this,k),delta:-a}})}}};$=new WeakMap,k=new WeakMap;var b,G,ot=class{constructor({manifest:t,evaluator:e=new N({})}){v(this,"data");m(this,b,void 0);m(this,G,void 0);var o,i,s;g(this,b,(o=t.project)!=null?o:{}),this.data=t,g(this,G,Object.entries((s=(i=n(this,b).pz)==null?void 0:i.sig)!=null?s:[]).map(([a,c])=>new rt(a,c,e)))}rollForControlGroup(){var t,e;return Math.random()<((e=(t=n(this,b).pz)==null?void 0:t.control)!=null?e:0)}getTest(t){var e;return(e=n(this,b).test)==null?void 0:e[t]}computeSignals(t){let e=[];return n(this,G).forEach(o=>{o.computeSignals(t,e)}),e}computeAggregateDimensions(t){var e,o;return ht(t,(o=(e=n(this,b).pz)==null?void 0:e.agg)!=null?o:{})}getDimensionByKey(t){var o,i,s,a;let e=t.indexOf(J);return e<=0?(i=(o=n(this,b).pz)==null?void 0:o.sig)==null?void 0:i[t]:(a=(s=n(this,b).pz)==null?void 0:s.enr)==null?void 0:a[t.substring(0,e)]}};b=new WeakMap,G=new WeakMap;u();var vt=(r,t)=>{var i;if(t.type!=="CK")return!1;let e=(i=r.state.cookies)==null?void 0:i[t.cookieName];return E(e,t.match)};u();u();function yt(r,t){var o;if(typeof r=="undefined"||r===null)return!1;let e=Number(r);if(isNaN(e))return!1;switch((o=t==null?void 0:t.op)!=null?o:"="){case"=":return e===t.rhs;case"!=":return e!==t.rhs;case">":return e>t.rhs;case"<":return e<t.rhs;default:return console.warn(`Unknown match type ${t.op} is false.`),!1}}u();function B(r,t){return`${r}${J}${t}`}var it=B("$pvc","v"),Dt=(r,t,e)=>{var a,c;if(t.type!=="PVC")return!1;let o=!r.previousState||((a=r.state.url)==null?void 0:a.toString())!==((c=r.previousState.url)==null?void 0:c.toString()),s=(r.visitor.sessionScores[it]||0)+1;if(yt(s,t.match)){let d=e.some(l=>l.type==="modscoreS"&&l.data.dimension===it);return o&&!d&&e.push({type:"modscoreS",data:{dimension:it,delta:1}}),!0}return!1};u();var Ct=(r,t)=>{var o;if(t.type!=="QS")return!1;let e=(o=r.state.url)==null?void 0:o.searchParams.get(t.queryName);return E(e,t.match)};u();var Vt=(r,t,e,o,i)=>{if(t.type!=="QK")return!1;if(typeof window=="undefined"&&o.dur==="t"&&r.scores[i]>0)return!0;let s=r.visitor.quirks[t.key];return E(s,t.match)};u();var xt=(r,t)=>{var e,o;return t.type!=="EVT"?!1:(o=(e=r.state.events)==null?void 0:e.some(i=>E(i.event,t.event)))!=null?o:!1};u();var bt=(r,t)=>{var e;return t.type!=="PV"?!1:E((e=r.state.url)==null?void 0:e.pathname,t.path)};u();var _,N=class{constructor(t){m(this,_,void 0);g(this,_,t)}evaluate(t,e,o,i,s){let a=!(e.op==="&"||!e.op);for(let c of e.clauses){let d;if(c.type==="G")d=this.evaluate(t,c,o,i,s);else{let l=n(this,_)[c.type];if(!l)throw new Error(`${c.type} signal criteria not registered`);d=l(t,c,o,i,s)}if(d===a)return a}return!a}};_=new WeakMap;u();function E(r,t){var a,c,d,l;let e=(a=t==null?void 0:t.op)!=null?a:"=";if(t.op==="*")return r!==null&&typeof r!="undefined";if(t.op==="!*")return r===null||typeof r=="undefined";if(!("rhs"in t))throw new Error(`Match expression is required for match type ${e}`);let o=(c=t.cs)!=null?c:!1,i=o?r!=null?r:"":Et(r),s=o?t.rhs:Et(t.rhs);switch(e){case"=":return i===s;case"!=":return i!==s;case"~":return(d=i.includes(s))!=null?d:!1;case"!~":return!((l=i.includes(s))!=null?l:!0);case"//":return new RegExp(t.rhs,o?"":"i").test(r!=null?r:"");case"!//":return!new RegExp(t.rhs,o?"":"i").test(r!=null?r:"");default:throw new Error(`Unknown match type ${e}.`)}}function Et(r){var t;return(t=r==null?void 0:r.toUpperCase())!=null?t:""}u();var H=()=>({quirks:{},scores:{},sessionScores:{},tests:{},consent:!1,controlGroup:!1});u();u();import jt from"mitt";import{dequal as Ft}from"dequal/lite";var Qt="__UNIFORM_DATA__",P,I,j=class{constructor({initialData:t}){m(this,P,void 0);m(this,I,jt());v(this,"events",{on:n(this,I).on,off:n(this,I).off});t&&g(this,P,t)}get data(){return n(this,P)}updateData(t,e){return g(this,P,e),this.handleUpdateData(t,e)}async delete(t){g(this,P,void 0),await this.handleDelete(t)}signalAsyncDataUpdate(t){Ft(this.data,t)||(g(this,P,t),n(this,I).emit("dataUpdatedAsync",t))}getClientTransitionState(){if(typeof document=="undefined")return;let t=document.getElementById(Qt);return(t==null?void 0:t.textContent)?JSON.parse(t.textContent):void 0}};P=new WeakMap,I=new WeakMap;u();var nt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Tt=nt.split(""),kt=new Array(123);for(let r=0;r<nt.length;r++)kt[nt.charCodeAt(r)]=r;var st=r=>{if(r<0)return`-${st(-r)}`;let t=r>>>0,e=r/4294967296>>>0,o="";for(;e>0;)o=Tt[63&t]+o,t>>>=6,t|=(63&e)<<26,e>>>=6;let i="";do i=Tt[63&t]+i,t>>>=6;while(t>0);return i+o},wt=r=>{let t=0,e=r.charAt(0)==="-"?1:0;for(let o=e;o<r.length;o++)t=t*64+kt[r.charCodeAt(o)];return e?-t:t};var Pt=typeof window=="undefined",R,L,Kt=class extends j{constructor({cookieAdapter:t,cookieName:e="ufvd"}){super({initialData:Pt?Jt(t.get(e)):void 0});m(this,R,void 0);m(this,L,void 0);g(this,R,e),g(this,L,t)}handleDelete(){return n(this,L).remove(n(this,R)),Promise.resolve()}async handleUpdateData(t,e){Pt||(e.consent?n(this,L).set(n(this,R),Bt(e)):n(this,L).remove(n(this,R)))}};R=new WeakMap,L=new WeakMap;var Mt="~",Ot="!",Rt="-";function Jt(r){if(!r)return;let t=r.split(Mt);if(t.length>3)return;let[e,o,i]=t;return{consent:!0,sessionScores:Lt(at(o)),scores:Lt(at(i)),tests:at(e)}}function at(r){return r.split(Ot).map(e=>e.split(Rt)).reduce((e,o)=>(o.length!==2||(e[o[0]]=o[1]),e),{})}function Lt(r){return Object.entries(r).reduce((t,[e,o])=>(t[e]=wt(o),t),{})}function Bt(r){return[ut(r.tests),ut(At(r.sessionScores)),ut(At(r.scores))].join(Mt)}function At(r){return Object.entries(r).reduce((t,[e,o])=>(t[e]=st(o),t),{})}function ut(r){return Object.entries(r).map(t=>t.join(Rt)).join(Ot)}u();var Y,Yt,Ht=class extends j{constructor({cookieAdapter:t,visitorIdCookieName:e="ufvi",...o}){super(o);m(this,Y);o.initialData||y(this,Y,Yt).call(this).catch(i=>{console.error(i)})}handleDelete(t){throw new Error("Method not implemented.")}async handleUpdateData(t){let e=await new Promise(o=>{setTimeout(()=>{o(void 0)},2e3)});e&&this.signalAsyncDataUpdate(e)}};Y=new WeakSet,Yt=async function(){let t=await new Promise(e=>{setTimeout(()=>{e(void 0)},2e3)});t&&this.signalAsyncDataUpdate(t)};u();function er(r){let{gracePeriod:t=864e5,decayRate:e=1/30,decayCap:o=.95}=r!=null?r:{};return function({now:s,lastUpd:a,scores:c,sessionScores:d}){if(typeof a!="number")return!1;let x=s-a-t;if(x<=0)return!1;let D=x/864e5,U=1-Math.min(o,D*e);return U<=0?!1:(Ut(c,U),Ut(d,U),!0)}}function Ut(r,t){for(let e in r)r[e]*=t}u();import Zt from"mitt";import{dequal as X}from"dequal/lite";u();var ct=class{constructor(){v(this,"inMemoryFallback",{});v(this,"hasLocalStorageObject",typeof localStorage!="undefined")}get(t){let e=this.inMemoryFallback[t];if(!this.hasLocalStorageObject||e)return e;try{let o=localStorage.getItem(t);return o?JSON.parse(o):void 0}catch(o){return e}}set(t,e,o){if(this.inMemoryFallback[t]=e,!(!this.hasLocalStorageObject||!o))try{localStorage.setItem(t,JSON.stringify(e))}catch(i){console.warn(i)}}delete(t,e){e||delete this.inMemoryFallback[t];try{localStorage.removeItem(t)}catch(o){}}};u();import Xt from"rfdc";var Wt=Xt();function It(r,t,e){let o=t?Wt(t):H();return r.forEach(i=>{var s,a;switch(i.type){case"consent":o.consent=i.data;break;case"setquirk":o.quirks[i.data.key]=i.data.value;break;case"settest":o.tests[i.data.test]=i.data.variant;break;case"modscore":if(e)break;let c=(s=o.scores[i.data.dimension])!=null?s:0;o.scores[i.data.dimension]=c+i.data.delta;break;case"modscoreS":if(e)break;let d=(a=o.sessionScores[i.data.dimension])!=null?a:0;o.sessionScores[i.data.dimension]=d+i.data.delta;break;case"identify":break;case"setcontrol":o.controlGroup=i.data;break;default:throw new Error("Unknown command")}}),o}var W="ufvisitor",T,A,q,h,C,M,w,z,Z,te,tt,ee,F,zt,Q,qt,dt=class{constructor(t){m(this,C);m(this,w);m(this,Z);m(this,tt);m(this,F);m(this,Q);m(this,T,Zt());m(this,A,new ct);m(this,q,void 0);m(this,h,void 0);v(this,"events",{on:n(this,T).on,off:n(this,T).off});if(g(this,h,t),n(this,C,M)||y(this,w,z).call(this,y(this,Q,qt).call(this),!0),t.transitionStore){let e=t.transitionStore.getClientTransitionState();if(e){let i=[];e.quirks&&i.push(...Object.entries(e.quirks).map(([s,a])=>({type:"setquirk",data:{key:s,value:a}}))),e.tests&&i.push(...Object.entries(e.tests).map(([s,a])=>({type:"settest",data:{test:s,variant:a}}))),this.updateData(i),e.ssv&&t.onServerTransitionScoresReceived&&t.onServerTransitionScoresReceived(e.ssv)}t.transitionStore.events.on("dataUpdatedAsync",i=>{y(this,w,z).call(this,{...n(this,C,M).visitorData,...i})});let o=t.transitionStore.data;o&&y(this,w,z).call(this,{...n(this,C,M).visitorData,...o},!0)}}get data(){var e,o;let t=n(this,C,M);if(y(this,tt,ee).call(this,t)){let{sessionScores:i,...s}=t.visitorData;return y(this,w,z).call(this,{...s,sessionScores:{}}),(o=(e=n(this,h)).onLogMessage)==null||o.call(e,["info",120]),n(this,C,M).visitorData}return t.visitorData}get decayEnabled(){return!!n(this,h).decay}async updateData(t){var o,i,s,a;if(t.length===0)return;(i=(o=n(this,h)).onLogMessage)==null||i.call(o,["debug",101,t]);let e=It(t,this.data,(s=n(this,C,M))==null?void 0:s.visitorData.controlGroup);t.some(c=>c.type==="consent"&&!c.data)&&n(this,A).delete(W,!0),y(this,w,z).call(this,e),await((a=n(this,h).transitionStore)==null?void 0:a.updateData(t,n(this,C,M).visitorData))}async delete(t){var e,o,i;n(this,A).delete(W,!1),await((e=n(this,h).transitionStore)==null?void 0:e.delete(t)),y(this,w,z).call(this,y(this,Q,qt).call(this)),(i=(o=n(this,h)).onLogMessage)==null||i.call(o,["info",103,t])}};T=new WeakMap,A=new WeakMap,q=new WeakMap,h=new WeakMap,C=new WeakSet,M=function(){return n(this,A).get(W)},w=new WeakSet,z=function(t,e=!1){var x,D,U,ft,mt,gt;let o=n(this,C,M),i=Date.now();t.controlGroup?(t.scores={},t.sessionScores={}):(y(this,F,zt).call(this,t.scores),y(this,F,zt).call(this,t.sessionScores),(D=(x=n(this,h)).decay)==null||D.call(x,{now:i,lastUpd:o==null?void 0:o.updated,scores:t.scores,sessionScores:t.sessionScores}));let s=!X(o==null?void 0:o.visitorData.scores,t.scores),a=!X(o==null?void 0:o.visitorData.sessionScores,t.sessionScores),c=!X(o==null?void 0:o.visitorData.quirks,t.quirks),d=!X(o==null?void 0:o.visitorData.tests,t.tests),l={updated:i,visitorData:t};y(this,Z,te).call(this),n(this,A).set(W,l,!!t.consent),(ft=(U=n(this,h)).onLogMessage)==null||ft.call(U,["debug",102,t]),e||((s||a)&&n(this,T).emit("scoresUpdated",t),c&&n(this,T).emit("quirksUpdated",t),d&&n(this,T).emit("testsUpdated",t),((mt=o==null?void 0:o.visitorData)==null?void 0:mt.consent)!==t.consent&&n(this,T).emit("consentUpdated",t),((gt=o==null?void 0:o.visitorData)==null?void 0:gt.controlGroup)!==t.controlGroup&&n(this,T).emit("controlGroupUpdated",t))},Z=new WeakSet,te=function(){typeof window=="undefined"||!n(this,h).visitLifespan||(n(this,q)&&window.clearTimeout(n(this,q)),g(this,q,window.setTimeout(()=>{this.data},n(this,h).visitLifespan+50)))},tt=new WeakSet,ee=function(t){let e=n(this,h).visitLifespan;return e?t.updated+e<Date.now():!1},F=new WeakSet,zt=function(t){var e,o;if(!!n(this,h).manifest)for(let i in t){let s=t[i],a=n(this,h).manifest.getDimensionByKey(i);!a||s>a.cap&&((o=(e=n(this,h)).onLogMessage)==null||o.call(e,["debug",110,{dim:i,score:s,cap:a.cap}]),t[i]=a.cap)}},Q=new WeakSet,qt=function(){var t,e,o;return{...H(),consent:(t=n(this,h).defaultConsent)!=null?t:!1,controlGroup:(o=(e=n(this,h).manifest)==null?void 0:e.rollForControlGroup())!=null?o:!1}};u();import oe from"mitt";u();u();function $t({context:r,variations:t,take:e=1}){var c,d;let o=(c=r.storage.data.controlGroup)!=null?c:!1,i=[],s=!1,a=r.scores;for(let l of t){if(i.length===e)break;if(!((d=l.pz)==null?void 0:d.crit.length)){i.push(l);continue}!o&&Gt(l.pz,a)&&(s=!0,i.push(l))}return{personalized:s,variations:i}}u();function Gt(r,t){return(r==null?void 0:r.crit)?!r.op||r.op==="&"?r.crit.every(e=>Nt(e,t)):r.crit.some(e=>Nt(e,t)):!0}function Nt(r,t){var a;let{op:e,l:o}=r,i=(a=t[o])!=null?a:0;if(e==="+")return Math.max(...Object.values(t))===i&&i>0;if(e==="-")return Math.min(...Object.values(t))===i&&i>0;let s=r.rDim?t[r.rDim]:r.r;if(s===void 0)return!1;if(e===">")return i>s;if(e===">=")return i>=s;if(e==="<")return i<s;if(e==="<=")return i<=s;if(e==="=")return i===s;if(e==="!=")return i!==s;throw new Error(`Unknown op: ${e}`)}u();var re=r=>{let{values:t,total:e,missingDistribution:o}=r.reduce((i,s)=>(s.testDistribution?i.total+=s.testDistribution:++i.missingDistribution,i.values.push(s.testDistribution),i),{values:[],total:0,missingDistribution:0});if(e>100)throw new Error(`Total distribution ${e} is over the maximum 100.`);if(e<100){let s=(100-e)/o;t.forEach((a,c)=>{typeof a=="undefined"&&(t[c]=s)})}return t},lt=({name:r,context:t,variations:e})=>{var s;let o,i=t.getTestVariantId(r);if(i===null)return{result:void 0,variantAssigned:!1};if(i&&(o=e.find(a=>a.id===i),o||t.log("warn",401,{test:r,variant:i})),!o){let a=re(e),c=Math.floor(Math.random()*100),d=0;o=e.find((l,x)=>{let D=a[x];if(c>d&&c<=d+D)return l;d+=D}),o&&t.setTestVariantId(r,(s=o.id)!=null?s:"Unknown")}return{result:o,variantAssigned:!i}};import{dequal as ie}from"dequal/lite";var O,V,K,S,ne=class{constructor(t){v(this,"manifest");m(this,O,{});m(this,V,void 0);m(this,K,{});m(this,S,oe());v(this,"events",{on:n(this,S).on,off:n(this,S).off});v(this,"storage");var a,c;let{manifest:e,...o}=t;g(this,V,{}),(a=t.plugins)==null||a.forEach(d=>{!d.logDrain||n(this,S).on("log",d.logDrain)}),this.manifest=new ot({manifest:e,evaluator:new N({CK:vt,QS:Ct,QK:Vt,PVC:Dt,EVT:xt,PV:bt})});let i=!1;this.storage=new dt({...o,manifest:this.manifest,onServerTransitionScoresReceived:d=>{g(this,O,d),i=!0,n(this,S).emit("log",["debug",130,d])},onLogMessage:d=>n(this,S).emit("log",d)});let s=d=>{var x;let l={...d.scores};for(let D in d.sessionScores)l[D]=((x=l[D])!=null?x:0)+d.sessionScores[D];l=this.manifest.computeAggregateDimensions(l),g(this,O,l),n(this,S).emit("scoresUpdated",l),n(this,S).emit("log",["info",3,l])};this.storage.events.on("scoresUpdated",s),i||s(this.storage.data),this.storage.events.on("quirksUpdated",d=>{let l=this.manifest.computeSignals({scores:n(this,O),state:n(this,V),previousState:n(this,V),visitor:this.storage.data});this.storage.updateData(l),n(this,S).emit("quirksUpdated",d.quirks),n(this,S).emit("log",["info",4,d.quirks])}),n(this,S).emit("log",["debug",1]),(c=t.plugins)==null||c.forEach(d=>{!d.init||d.init(this)})}get scores(){return n(this,O)}async update(t){var i;let e=[];n(this,S).emit("log",["info",2,{...t,url:(i=t.url)==null?void 0:i.toString()}]),t.quirks&&(e.push(...Object.entries(t.quirks).map(([s,a])=>({type:"setquirk",data:{key:s,value:a}}))),t.quirks=void 0),t.enrichments&&(e.push(...t.enrichments.map(s=>({type:"modscore",data:{dimension:B(s.cat,s.key),delta:s.str}}))),t.enrichments=void 0);let o=n(this,V);g(this,V,{...n(this,V),...t}),e.push(...this.manifest.computeSignals({state:n(this,V),previousState:o,visitor:this.storage.data,scores:n(this,O)})),await this.storage.updateData(e)}getTestVariantId(t){var o;let e=this.manifest.getTest(t);return e?(o=e.wv)!=null?o:this.storage.data.tests[t]:(n(this,S).emit("log",["warn",401,t]),null)}setTestVariantId(t,e){this.storage.updateData([{type:"settest",data:{test:t,variant:e}}])}log(...t){n(this,S).emit("log",t)}test(t){var o,i;let e=lt({...t,context:this});return n(this,S).emit("testResult",{name:t.name,variantId:(i=(o=e.result)==null?void 0:o.id)!=null?i:void 0,variantAssigned:e.variantAssigned}),e}personalize(t){let e=$t({...t,context:this}),o=n(this,K)[t.name],i={name:t.name,variantIds:e.variations.map(s=>{var a;return(a=s.id)!=null?a:"Unknown"}),control:this.storage.data.controlGroup,changed:!0};return o&&ie(i.variantIds,o)&&(i.changed=!1),n(this,S).emit("personalizationResult",i),n(this,K)[t.name]=i.variantIds,e}async forget(t){g(this,V,{}),await this.storage.delete(t)}};O=new WeakMap,V=new WeakMap,K=new WeakMap,S=new WeakMap;u();u();function et(r,t){if(r==="none")return!1;switch(t){case"debug":return r==="debug";case"info":return r==="info"||r==="debug";case"warn":return r==="warn"||r==="info"||r==="debug";case"error":return r==="debug"||"info";default:return!1}}function se(r){return([t,e,...o])=>{!et(r,t)||console[t](`\u{1F94B} [${t}] Uniform event ID ${e}
|
2
|
+
`,...o.map(i=>JSON.stringify(i,null,2)))}}function Gr(r){return{logDrain:se(r)}}u();u();var _t={1:()=>["tracker","constructed"],2:r=>["tracker","received data update",r],3:r=>["tracker","new score vector",r],4:r=>["tracker","updated quirks",r],101:r=>["storage","received update commands",r],102:r=>["storage","data was updated",r],103:r=>["storage",`data was deleted ${r?"from all devices":"from this device"}`],110:({dim:r,cap:t,score:e})=>["storage",`${r} score ${e} exceeded cap ${t}. Rounded down.`],120:()=>["storage","visitor data expired and was cleared"],130:r=>["storage","server to client transition score data was loaded; it will persist until the next update event occurs",r],401:r=>["testing",`${r} was unknown; it will not be run.`],402:({test:r,variant:t})=>["testing",`${r} no longer has visitor's variant ${t}; it will be removed.`],700:()=>["gtag","gtag is not defined, skipping analytics event emission. Ensure you have added the gtag script to your page."],701:()=>["gtag","enabled gtag event signal redirection"]};function ae(r){return([t,e,...o])=>{if(!et(r,t))return;let i=_t[e],s=`\u{1F94B} [${new Date().toLocaleTimeString()}][${t}]`;i||console[t](`${s} unknown message ID ${e} - ensure all Uniform packages are the same version`,...o);let[a,c,...d]=i(...o);console[t](`${s}[${a}] ${c} (Event ID: ${e})
|
3
|
+
`,...d.map(l=>JSON.stringify(l,null,2)))}}function Qr(r){return{logDrain:ae(r)}}u();var ue=(c=>(c.ListStart="nesi-list-start",c.ListEnd="nesi-list-end",c.ListItem="nesi-list-item-html",c.ListItemSettings="nesi-list-item-settings",c.TestStart="nesi-test-start",c.TestEnd="nesi-test-end",c.Unknown="unknown",c))(ue||{}),Jr="nesitag";u();var pt=typeof top!="undefined";function Hr(){return{logDrain:r=>{!pt||top==null||top.postMessage({type:"uniform:context:log",message:r},window.location.origin)},init:r=>{let t=[],e=[];pt&&(window.__UNIFORM_DEVTOOLS_CONTEXT_INSTANCE__=r,top==null||top.addEventListener("message",async a=>{if(!a.data)return;let c=a.data;await ce(c,r)}),top==null||top.postMessage({type:"uniform:context:hello",uiVersion:2},window.location.origin));let o=()=>{!pt||top==null||top.postMessage({type:"uniform:context:data",data:{scores:r.scores,data:r.storage.data,manifest:r.manifest.data,personalizations:t,tests:e}},window.location.origin)},i=a=>{!a.changed||(t.push(a),o())},s=a=>{!a.variantAssigned||(e.push(a),o())};return r.events.on("personalizationResult",i),r.events.on("testResult",s),r.storage.events.on("*",o),()=>{r.storage.events.off("*",o),r.events.off("personalizationResult",i),r.events.off("testResult",s)}}}}async function ce(r,t){r.type==="uniform-in:context:update"&&r.newData&&await t.update(r.newData),r.type==="uniform-in:context:commands"&&r.commands&&Array.isArray(r.commands)&&await t.storage.updateData(r.commands),r.type==="uniform-in:context:forget"&&await t.forget(!1)}export{ne as Context,Kt as CookieTransitionDataStore,Jr as EdgeNodeTagName,Ht as EdgeTransitionDataStore,N as GroupCriteriaEvaluator,ot as ManifestInstance,Qt as SERVER_STATE_ID,ue as ScriptType,j as TransitionDataStore,dt as VisitorDataStore,ht as computeAggregateDimensions,vt as cookieEvaluator,se as createConsoleLogDrain,ae as createDebugConsoleLogDrain,er as createLinearDecay,H as emptyVisitorData,Gr as enableConsoleLogDrain,Hr as enableContextDevTools,Qr as enableDebugConsoleLogDrain,Gt as evaluateVariantMatch,xt as eventEvaluator,B as getEnrichmentVectorKey,E as isStringMatch,it as pageViewCountDimension,Dt as pageViewCountEvaluator,bt as pageVisitedEvaluator,$t as personalizeVariations,Ct as queryStringEvaluator,Vt as quirkEvaluator,lt as testVariations};
|
package/dist/index.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
var Kt=Object.create;var $=Object.defineProperty;var Jt=Object.getOwnPropertyDescriptor;var Bt=Object.getOwnPropertyNames;var Yt=Object.getPrototypeOf,Ht=Object.prototype.hasOwnProperty;var Wt=(r,t,e)=>t in r?$(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var yt=r=>$(r,"__esModule",{value:!0});var Xt=(r,t)=>{for(var e in t)$(r,e,{get:t[e],enumerable:!0})},vt=(r,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Bt(t))!Ht.call(r,o)&&(e||o!=="default")&&$(r,o,{get:()=>t[o],enumerable:!(i=Jt(t,o))||i.enumerable});return r},J=(r,t)=>vt(yt($(r!=null?Kt(Yt(r)):{},"default",!t&&r&&r.__esModule?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r),Zt=(r=>(t,e)=>r&&r.get(t)||(e=vt(yt({}),t,1),r&&r.set(t,e),e))(typeof WeakMap!="undefined"?new WeakMap:0);var S=(r,t,e)=>(Wt(r,typeof t!="symbol"?t+"":t,e),e),ot=(r,t,e)=>{if(!t.has(r))throw TypeError("Cannot "+e)};var s=(r,t,e)=>(ot(r,t,"read from private field"),e?e.call(r):t.get(r)),u=(r,t,e)=>{if(t.has(r))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(r):t.set(r,e)},p=(r,t,e,i)=>(ot(r,t,"write to private field"),i?i.call(r,e):t.set(r,e),e);var g=(r,t,e)=>(ot(r,t,"access private method"),e);var le={};Xt(le,{Context:()=>_t,CookieTransitionDataStore:()=>wt,EdgeNodeTagName:()=>de,EdgeTransitionDataStore:()=>Rt,GroupCriteriaEvaluator:()=>R,ManifestInstance:()=>M,SERVER_STATE_ID:()=>Et,ScriptType:()=>Qt,TransitionDataStore:()=>q,VisitorDataStore:()=>Z,computeAggregateDimensions:()=>st,consoleLogDrain:()=>ce,cookieEvaluator:()=>at,createLinearDecay:()=>ie,debugConsoleLogDrain:()=>ue,emptyVisitorData:()=>_,evaluateVariantMatch:()=>St,eventEvaluator:()=>lt,isStringMatch:()=>v,pageViewCountDimension:()=>B,pageViewCountEvaluator:()=>ct,pageVisitedEvaluator:()=>pt,personalizeVariations:()=>ht,queryStringEvaluator:()=>ut,quirkEvaluator:()=>dt,testVariations:()=>rt});function st(r,t){let e={...r};for(let i in t){let o=Dt(r,i,t,new Set([i]));o!==0&&(e[i]=o)}return e}function Dt(r,t,e,i){var n;let o=0;for(let a of e[t].inputs){let c=(n=r[a.dim])!=null?n:0;if(!c&&e[a.dim]){if(i.has(a.dim))continue;let m=new Set(i);m.add(a.dim),c=Dt(r,a.dim,e,m)}if(c!==0)if(a.sign==="c"){o=0;break}else a.sign==="-"?o-=c:o+=c}return o}var N,x,nt=class{constructor(t,e,i){u(this,N,void 0);u(this,x,void 0);S(this,"signal");p(this,x,t),this.signal=e,p(this,N,i)}computeSignals(t,e){if(t.scores[s(this,x)]>=this.signal.cap&&this.signal.dur!=="t")return;let o=s(this,N).evaluate(t,this.signal.crit,e,this.signal,s(this,x)),n=this.signal.dur==="s"||this.signal.dur==="t"?"modscoreS":"modscore";if(o)e.push({type:n,data:{dimension:s(this,x),delta:this.signal.str}});else if(this.signal.dur==="t"){let a=t.visitor.sessionScores[s(this,x)];a&&e.push({type:n,data:{dimension:s(this,x),delta:-a}})}}};N=new WeakMap,x=new WeakMap;var Vt="_",C,G,M=class{constructor({manifest:t,evaluator:e=new R({})}){u(this,C,void 0);u(this,G,void 0);var i,o,n;p(this,C,(i=t.project)!=null?i:{}),p(this,G,Object.entries((n=(o=s(this,C).pz)==null?void 0:o.sig)!=null?n:[]).map(([a,c])=>new nt(a,c,e)))}rollForControlGroup(){var t,e;return Math.random()<((e=(t=s(this,C).pz)==null?void 0:t.control)!=null?e:0)}getTest(t){var e;return(e=s(this,C).test)==null?void 0:e[t]}computeSignals(t){let e=[];return s(this,G).forEach(i=>{i.computeSignals(t,e)}),e}computeAggregateDimensions(t){var e,i;return st(t,(i=(e=s(this,C).pz)==null?void 0:e.agg)!=null?i:{})}getDimensionByKey(t){var i,o,n,a;let e=t.indexOf(Vt);return e<=0?(o=(i=s(this,C).pz)==null?void 0:i.sig)==null?void 0:o[t]:(a=(n=s(this,C).pz)==null?void 0:n.enr)==null?void 0:a[t.substring(0,e)]}static getEnrichmentVectorKey(t,e){return`${t}${Vt}${e}`}};C=new WeakMap,G=new WeakMap;var at=(r,t)=>{var o;if(t.type!=="CK")return!1;let e=(o=r.state.cookies)==null?void 0:o[t.cookieName];return v(e,t.match)};function Ct(r,t){var i;if(typeof r=="undefined"||r===null)return!1;let e=Number(r);if(isNaN(e))return!1;switch((i=t==null?void 0:t.op)!=null?i:"="){case"=":return e===t.rhs;case"!=":return e!==t.rhs;case">":return e>t.rhs;case"<":return e<t.rhs;default:return console.warn(`Unknown match type ${t.op} is false.`),!1}}var B=M.getEnrichmentVectorKey("$pvc","v"),ct=(r,t,e)=>{var a,c;if(t.type!=="PVC")return!1;let i=!r.previousState||((a=r.state.url)==null?void 0:a.toString())!==((c=r.previousState.url)==null?void 0:c.toString()),n=(r.visitor.sessionScores[B]||0)+1;if(Ct(n,t.match)){let d=e.some(m=>m.type==="modscoreS"&&m.data.dimension===B);return i&&!d&&e.push({type:"modscoreS",data:{dimension:B,delta:1}}),!0}return!1};var ut=(r,t)=>{var i;if(t.type!=="QS")return!1;let e=(i=r.state.url)==null?void 0:i.searchParams.get(t.queryName);return v(e,t.match)};var dt=(r,t,e,i,o)=>{if(t.type!=="QK")return!1;if(typeof window=="undefined"&&i.dur==="t"&&r.scores[o]>0)return!0;let n=r.visitor.quirks[t.key];return v(n,t.match)};var lt=(r,t)=>{var e,i;return t.type!=="EVT"?!1:(i=(e=r.state.events)==null?void 0:e.some(o=>v(o.event,t.event)))!=null?i:!1};var pt=(r,t)=>{var e;return t.type!=="PV"?!1:v((e=r.state.url)==null?void 0:e.pathname,t.path)};var j,R=class{constructor(t){u(this,j,void 0);p(this,j,t)}evaluate(t,e,i,o,n){let a=!(e.op==="&"||!e.op);for(let c of e.clauses){let d;if(c.type==="G")d=this.evaluate(t,c,i,o,n);else{let m=s(this,j)[c.type];if(!m)throw new Error(`${c.type} signal criteria not registered`);d=m(t,c,i,o,n)}if(d===a)return a}return!a}};j=new WeakMap;function v(r,t){var a,c,d,m;let e=(a=t==null?void 0:t.op)!=null?a:"=";if(t.op==="*")return r!==null&&typeof r!="undefined";if(t.op==="!*")return r===null||typeof r=="undefined";if(!("rhs"in t))throw new Error(`Match expression is required for match type ${e}`);let i=(c=t.cs)!=null?c:!1,o=i?r!=null?r:"":xt(r),n=i?t.rhs:xt(t.rhs);switch(e){case"=":return o===n;case"!=":return o!==n;case"~":return(d=o.includes(n))!=null?d:!1;case"!~":return!((m=o.includes(n))!=null?m:!0);case"//":return new RegExp(t.rhs,i?"":"i").test(r!=null?r:"");case"!//":return!new RegExp(t.rhs,i?"":"i").test(r!=null?r:"");default:throw new Error(`Unknown match type ${e}.`)}}function xt(r){var t;return(t=r==null?void 0:r.toUpperCase())!=null?t:""}var _=()=>({quirks:{},scores:{},sessionScores:{},tests:{},consent:!1,controlGroup:!1});var kt=J(require("mitt")),bt=require("dequal/lite"),Et="__UNIFORM_DATA__",E,L,q=class{constructor({initialData:t}){u(this,E,void 0);u(this,L,(0,kt.default)());S(this,"events",{on:s(this,L).on,off:s(this,L).off});t&&p(this,E,t)}get data(){return s(this,E)}updateData(t,e){return p(this,E,e),this.handleUpdateData(t,e)}async delete(t){p(this,E,void 0),await this.handleDelete(t)}signalAsyncDataUpdate(t){(0,bt.dequal)(this.data,t)||(p(this,E,t),s(this,L).emit("dataUpdatedAsync",t))}getClientTransitionState(){if(typeof document=="undefined")return;let t=document.getElementById(Et);return(t==null?void 0:t.textContent)?JSON.parse(t.textContent):void 0}};E=new WeakMap,L=new WeakMap;var Y=require("number-to-base64"),Tt=typeof window=="undefined",O,U,wt=class extends q{constructor({cookieAdapter:t,cookieName:e="ufvd"}){super({initialData:Tt?te(t.get(e)):void 0});u(this,O,void 0);u(this,U,void 0);p(this,O,e),p(this,U,t)}handleDelete(){return s(this,U).remove(s(this,O)),Promise.resolve()}async handleUpdateData(t,e){Tt||(e.consent?s(this,U).set(s(this,O),ee(e)):s(this,U).remove(s(this,O)))}};O=new WeakMap,U=new WeakMap;var Pt="~",Mt="!",Ot="-";function te(r){if(!r)return;let t=r.split(Pt);if(t.length>3)return;let[e,i,o]=t;return{consent:!0,sessionScores:Ut(mt(i)),scores:Ut(mt(o)),tests:mt(e)}}function mt(r){return r.split(Mt).map(e=>e.split(Ot)).reduce((e,i)=>(i.length!==2||(e[i[0]]=i[1]),e),{})}function Ut(r){return Object.entries(r).reduce((t,[e,i])=>(t[e]=(0,Y.bton)(i),t),{})}function ee(r){return[ft(r.tests),ft(It(r.sessionScores)),ft(It(r.scores))].join(Pt)}function It(r){return Object.entries(r).reduce((t,[e,i])=>(t[e]=(0,Y.ntob)(i),t),{})}function ft(r){return Object.entries(r).map(t=>t.join(Ot)).join(Mt)}var H,re,Rt=class extends q{constructor({cookieAdapter:t,visitorIdCookieName:e="ufvi",...i}){super(i);u(this,H);i.initialData||g(this,H,re).call(this).catch(o=>{console.error(o)})}handleDelete(t){throw new Error("Method not implemented.")}async handleUpdateData(t){let e=await new Promise(i=>{setTimeout(()=>{i(void 0)},2e3)});e&&this.signalAsyncDataUpdate(e)}};H=new WeakSet,re=async function(){let t=await new Promise(e=>{setTimeout(()=>{e(void 0)},2e3)});t&&this.signalAsyncDataUpdate(t)};function ie(r){let{gracePeriod:t=864e5,decayRate:e=1/30,decayCap:i=.95}=r!=null?r:{};return function({now:n,lastUpd:a,scores:c,sessionScores:d}){if(typeof a!="number")return!1;let P=n-a-t;if(P<=0)return!1;let K=P/864e5,it=1-Math.min(i,K*e);return it<=0?!1:(qt(c,it),qt(d,it),!0)}}function qt(r,t){for(let e in r)r[e]*=t}var At=J(require("mitt")),W=require("dequal/lite");var gt=class{constructor(){S(this,"inMemoryFallback",{});S(this,"hasLocalStorageObject",typeof localStorage!="undefined")}get(t){let e=this.inMemoryFallback[t];if(!this.hasLocalStorageObject||e)return e;try{let i=localStorage.getItem(t);return i?JSON.parse(i):void 0}catch(i){return e}}set(t,e,i){if(this.inMemoryFallback[t]=e,!(!this.hasLocalStorageObject||!i))try{localStorage.setItem(t,JSON.stringify(e))}catch(o){console.warn(o)}}delete(t,e){e||delete this.inMemoryFallback[t];try{localStorage.removeItem(t)}catch(i){}}};var Lt=J(require("rfdc"));var oe=(0,Lt.default)();function zt(r,t,e){let i=t?oe(t):_();return r.forEach(o=>{var n,a;switch(o.type){case"consent":i.consent=o.data;break;case"setquirk":i.quirks[o.data.key]=o.data.value;break;case"settest":i.tests[o.data.test]=o.data.variant;break;case"modscore":if(e)break;let c=(n=i.scores[o.data.dimension])!=null?n:0;i.scores[o.data.dimension]=c+o.data.delta;break;case"modscoreS":if(e)break;let d=(a=i.sessionScores[o.data.dimension])!=null?a:0;i.sessionScores[o.data.dimension]=d+o.data.delta;break;case"identify":break;default:throw new Error("Unknown command")}}),i}var X="ufvisitor",y,I,A,h,D,T,k,z,tt,se,et,ne,F,$t,Q,Nt,Z=class{constructor(t){u(this,D);u(this,k);u(this,tt);u(this,et);u(this,F);u(this,Q);u(this,y,(0,At.default)());u(this,I,new gt);u(this,A,void 0);u(this,h,void 0);S(this,"events",{on:s(this,y).on,off:s(this,y).off});if(p(this,h,t),s(this,D,T)||g(this,k,z).call(this,g(this,Q,Nt).call(this),!0),t.transitionStore){let e=t.transitionStore.getClientTransitionState();e&&e.quirks&&this.updateData(Object.entries(e.quirks).map(([o,n])=>({type:"setquirk",data:{key:o,value:n}}))),t.transitionStore.events.on("dataUpdatedAsync",o=>{g(this,k,z).call(this,{...s(this,D,T).visitorData,...o})});let i=t.transitionStore.data;i&&g(this,k,z).call(this,{...s(this,D,T).visitorData,...i},!0)}}get data(){let t=s(this,D,T);if(g(this,et,ne).call(this,t)){let{sessionScores:e,...i}=t.visitorData;return g(this,k,z).call(this,{...i,sessionScores:{}}),s(this,y).emit("log",["info",120]),s(this,D,T).visitorData}return t.visitorData}async updateData(t){var i,o;if(t.length===0)return;s(this,y).emit("log",["debug",101,t]);let e=zt(t,this.data,(i=s(this,D,T))==null?void 0:i.visitorData.controlGroup);t.some(n=>n.type==="consent"&&!n.data)&&s(this,I).delete(X,!0),g(this,k,z).call(this,e),await((o=s(this,h).transitionStore)==null?void 0:o.updateData(t,s(this,D,T).visitorData))}async delete(t){var e;s(this,I).delete(X,!1),await((e=s(this,h).transitionStore)==null?void 0:e.delete(t)),s(this,y).emit("log",["info",103,t]),g(this,k,z).call(this,g(this,Q,Nt).call(this))}};y=new WeakMap,I=new WeakMap,A=new WeakMap,h=new WeakMap,D=new WeakSet,T=function(){return s(this,I).get(X)},k=new WeakSet,z=function(t,e=!1){var m,P;let i=s(this,D,T),o=Date.now();g(this,F,$t).call(this,t.scores),g(this,F,$t).call(this,t.sessionScores),(P=(m=s(this,h)).decay)==null||P.call(m,{now:o,lastUpd:i==null?void 0:i.updated,scores:t.scores,sessionScores:t.sessionScores});let n=!(0,W.dequal)(i==null?void 0:i.visitorData.scores,t.scores),a=!(0,W.dequal)(i==null?void 0:i.visitorData.sessionScores,t.sessionScores),c=!(0,W.dequal)(i==null?void 0:i.visitorData.quirks,t.quirks),d={updated:o,visitorData:t};g(this,tt,se).call(this),s(this,I).set(X,d,!!t.consent),s(this,y).emit("log",["debug",102,t]),e||((n||a)&&s(this,y).emit("scoresUpdated",t),c&&s(this,y).emit("quirksUpdated",t))},tt=new WeakSet,se=function(){typeof window=="undefined"||!s(this,h).visitLifespan||(s(this,A)&&window.clearTimeout(s(this,A)),p(this,A,window.setTimeout(()=>{this.data},s(this,h).visitLifespan+50)))},et=new WeakSet,ne=function(t){let e=s(this,h).visitLifespan;return e?t.updated+e<Date.now():!1},F=new WeakSet,$t=function(t){if(!!s(this,h).manifest)for(let e in t){let i=t[e],o=s(this,h).manifest.getDimensionByKey(e);!o||i>o.cap&&(s(this,y).emit("log",["debug",110,{dim:e,score:i,cap:o.cap}]),t[e]=o.cap)}},Q=new WeakSet,Nt=function(){var t,e,i;return{..._(),consent:(t=s(this,h).defaultConsent)!=null?t:!1,controlGroup:(i=(e=s(this,h).manifest)==null?void 0:e.rollForControlGroup())!=null?i:!1}};var jt=J(require("mitt"));function ht({context:r,variations:t,take:e=1}){var c;let i=(c=r.storage.data.controlGroup)!=null?c:!1,o=[],n=!1,a=r.scores;for(let d of t){if(o.length===e)break;if(!d.pz){o.push(d);continue}!i&&St(d.pz,a)&&(n=!0,o.push(d))}return{personalized:n,variations:o}}function St(r,t){return(r==null?void 0:r.crit)?!r.op||r.op==="&"?r.crit.every(e=>Gt(e,t)):r.crit.some(e=>Gt(e,t)):!0}function Gt(r,t){var a;let{op:e,l:i}=r,o=(a=t[i])!=null?a:0;if(e==="+")return Math.max(...Object.values(t))===o&&o>0;if(e==="-")return Math.min(...Object.values(t))===o&&o>0;let n=r.rDim?t[r.rDim]:r.r;if(n===void 0)return!1;if(e===">")return o>n;if(e===">=")return o>=n;if(e==="<")return o<n;if(e==="<=")return o<=n;if(e==="=")return o===n;if(e==="!=")return o!==n;throw new Error(`Unknown op: ${e}`)}var ae=r=>{let{values:t,total:e,missingDistribution:i}=r.reduce((o,n)=>(n.testDistribution?o.total+=n.testDistribution:++o.missingDistribution,o.values.push(n.testDistribution),o),{values:[],total:0,missingDistribution:0});if(e>100)throw new Error(`Total distribution ${e} is over the maximum 100.`);if(e<100){let n=(100-e)/i;t.forEach((a,c)=>{typeof a=="undefined"&&(t[c]=n)})}return t},rt=({name:r,context:t,variations:e})=>{var n;let i,o=t.getTestVariantId(r);if(o===null)return{result:void 0};if(o&&(i=e.find(a=>a.id===o),i||t.log("warn",401,{test:r,variant:o})),!i){let a=ae(e),c=Math.floor(Math.random()*100),d=0;i=e.find((m,P)=>{let K=a[P];if(c>d&&c<=d+K)return m;d+=K}),i&&t.setTestVariantId(r,(n=i.id)!=null?n:"Unknown")}return{result:i}};var b,w,V,f,_t=class{constructor(t){u(this,b,void 0);u(this,w,{});u(this,V,void 0);u(this,f,(0,jt.default)());S(this,"events",{on:s(this,f).on,off:s(this,f).off});S(this,"storage");let{manifest:e,...i}=t;p(this,V,{}),p(this,b,new M({manifest:e,evaluator:new R({CK:at,QS:ut,QK:dt,PVC:ct,EVT:lt,PV:pt})})),this.storage=new Z({manifest:s(this,b),...i}),this.storage.events.on("log",(...n)=>s(this,f).emit("log",...n));let o=n=>{var c;let a={...n.scores};for(let d in n.sessionScores)a[d]=((c=a[d])!=null?c:0)+n.sessionScores[d];a=s(this,b).computeAggregateDimensions(a),p(this,w,a),s(this,f).emit("scoresUpdated",a),s(this,f).emit("log",["info",3,a])};this.storage.events.on("scoresUpdated",o),o(this.storage.data),this.storage.events.on("quirksUpdated",n=>{let a=s(this,b).computeSignals({scores:s(this,w),state:s(this,V),previousState:s(this,V),visitor:this.storage.data});this.storage.updateData(a),s(this,f).emit("quirksUpdated",n.quirks),s(this,f).emit("log",["info",4,n.quirks])}),s(this,f).emit("log",["debug",1,{options:t,scores:s(this,w)}])}get scores(){return s(this,w)}async update(t){let e=[];s(this,f).emit("log",["info",2,t]),t.quirks&&(e.push(...Object.entries(t.quirks).map(([o,n])=>({type:"setquirk",data:{key:o,value:n}}))),t.quirks=void 0),t.enrichments&&(e.push(...t.enrichments.map(o=>({type:"modscore",data:{dimension:M.getEnrichmentVectorKey(o.cat,o.key),delta:o.str}}))),t.enrichments=void 0);let i=s(this,V);p(this,V,{...s(this,V),...t}),e.push(...s(this,b).computeSignals({state:s(this,V),previousState:i,visitor:this.storage.data,scores:s(this,w)})),await this.storage.updateData(e)}getTestVariantId(t){var i;let e=s(this,b).getTest(t);return e?(i=e.wv)!=null?i:this.storage.data.tests[t]:(s(this,f).emit("log",["warn",401,t]),null)}setTestVariantId(t,e){this.storage.updateData([{type:"settest",data:{test:t,variant:e}}])}log(...t){s(this,f).emit("log",t)}test(t){var i;let e=rt({...t,context:this});return s(this,f).emit("testResult",{name:t.name,variantId:(i=e.result)==null?void 0:i.id,control:this.storage.data.controlGroup}),e}personalize(t){let e=ht({...t,context:this});return t.name?s(this,f).emit("personalizationResult",{name:t.name,variantIds:e.variations.map(i=>{var o;return(o=i.id)!=null?o:"Unknown"}),control:this.storage.data.controlGroup}):this.log("warn",301),e}async forget(t){p(this,V,{}),await this.storage.delete(t)}};b=new WeakMap,w=new WeakMap,V=new WeakMap,f=new WeakMap;var ce=([r,t,...e])=>{console[r](`\u{1F94B} [${r}] Uniform event ID ${t}
|
2
|
-
`,...
|
3
|
-
`,...c.map(
|
1
|
+
var ne=Object.create;var N=Object.defineProperty;var se=Object.getOwnPropertyDescriptor;var ae=Object.getOwnPropertyNames;var ue=Object.getPrototypeOf,ce=Object.prototype.hasOwnProperty;var de=(e,t,r)=>t in e?N(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Tt=e=>N(e,"__esModule",{value:!0});var le=(e,t)=>{for(var r in t)N(e,r,{get:t[r],enumerable:!0})},kt=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ae(t))!ce.call(e,i)&&(r||i!=="default")&&N(e,i,{get:()=>t[i],enumerable:!(o=se(t,i))||o.enumerable});return e},H=(e,t)=>kt(Tt(N(e!=null?ne(ue(e)):{},"default",!t&&e&&e.__esModule?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),pe=(e=>(t,r)=>e&&e.get(t)||(r=kt(Tt({}),t,1),e&&e.set(t,r),r))(typeof WeakMap!="undefined"?new WeakMap:0);var h=(e,t,r)=>(de(e,typeof t!="symbol"?t+"":t,r),r),st=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var n=(e,t,r)=>(st(e,t,"read from private field"),r?r.call(e):t.get(e)),p=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},f=(e,t,r,o)=>(st(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);var S=(e,t,r)=>(st(e,t,"access private method"),r);var Te={};le(Te,{Context:()=>te,CookieTransitionDataStore:()=>qt,EdgeNodeTagName:()=>xe,EdgeTransitionDataStore:()=>Ft,GroupCriteriaEvaluator:()=>A,ManifestInstance:()=>X,SERVER_STATE_ID:()=>Lt,ScriptType:()=>ie,TransitionDataStore:()=>U,VisitorDataStore:()=>et,computeAggregateDimensions:()=>at,cookieEvaluator:()=>ct,createConsoleLogDrain:()=>ee,createDebugConsoleLogDrain:()=>oe,createLinearDecay:()=>he,emptyVisitorData:()=>F,enableConsoleLogDrain:()=>Ce,enableContextDevTools:()=>be,enableDebugConsoleLogDrain:()=>Ve,evaluateVariantMatch:()=>Ct,eventEvaluator:()=>ft,getEnrichmentVectorKey:()=>_,isStringMatch:()=>y,pageViewCountDimension:()=>W,pageViewCountEvaluator:()=>dt,pageVisitedEvaluator:()=>mt,personalizeVariations:()=>Dt,queryStringEvaluator:()=>lt,quirkEvaluator:()=>pt,testVariations:()=>it});function at(e,t){let r={...e};for(let o in t){let i=wt(e,o,t,new Set([o]));i!==0&&(r[o]=i)}return r}function wt(e,t,r,o){var s;let i=0;for(let a of r[t].inputs){let u=(s=e[a.dim])!=null?s:0;if(!u&&r[a.dim]){if(o.has(a.dim))continue;let l=new Set(o);l.add(a.dim),u=wt(e,a.dim,r,l)}if(u!==0)if(a.sign==="c"){i=0;break}else a.sign==="-"?i-=u:i+=u}return i}var Y="_";var $,E,ut=class{constructor(t,r,o){p(this,$,void 0);p(this,E,void 0);h(this,"signal");f(this,E,t),this.signal=r,f(this,$,o)}computeSignals(t,r){if(t.scores[n(this,E)]>=this.signal.cap&&this.signal.dur!=="t")return;let i=n(this,$).evaluate(t,this.signal.crit,r,this.signal,n(this,E)),s=this.signal.dur==="s"||this.signal.dur==="t"?"modscoreS":"modscore";if(i)r.push({type:s,data:{dimension:n(this,E),delta:this.signal.str}});else if(this.signal.dur==="t"){let a=t.visitor.sessionScores[n(this,E)];a&&r.push({type:s,data:{dimension:n(this,E),delta:-a}})}}};$=new WeakMap,E=new WeakMap;var x,G,X=class{constructor({manifest:t,evaluator:r=new A({})}){h(this,"data");p(this,x,void 0);p(this,G,void 0);var o,i,s;f(this,x,(o=t.project)!=null?o:{}),this.data=t,f(this,G,Object.entries((s=(i=n(this,x).pz)==null?void 0:i.sig)!=null?s:[]).map(([a,u])=>new ut(a,u,r)))}rollForControlGroup(){var t,r;return Math.random()<((r=(t=n(this,x).pz)==null?void 0:t.control)!=null?r:0)}getTest(t){var r;return(r=n(this,x).test)==null?void 0:r[t]}computeSignals(t){let r=[];return n(this,G).forEach(o=>{o.computeSignals(t,r)}),r}computeAggregateDimensions(t){var r,o;return at(t,(o=(r=n(this,x).pz)==null?void 0:r.agg)!=null?o:{})}getDimensionByKey(t){var o,i,s,a;let r=t.indexOf(Y);return r<=0?(i=(o=n(this,x).pz)==null?void 0:o.sig)==null?void 0:i[t]:(a=(s=n(this,x).pz)==null?void 0:s.enr)==null?void 0:a[t.substring(0,r)]}};x=new WeakMap,G=new WeakMap;var ct=(e,t)=>{var i;if(t.type!=="CK")return!1;let r=(i=e.state.cookies)==null?void 0:i[t.cookieName];return y(r,t.match)};function Pt(e,t){var o;if(typeof e=="undefined"||e===null)return!1;let r=Number(e);if(isNaN(r))return!1;switch((o=t==null?void 0:t.op)!=null?o:"="){case"=":return r===t.rhs;case"!=":return r!==t.rhs;case">":return r>t.rhs;case"<":return r<t.rhs;default:return console.warn(`Unknown match type ${t.op} is false.`),!1}}function _(e,t){return`${e}${Y}${t}`}var W=_("$pvc","v"),dt=(e,t,r)=>{var a,u;if(t.type!=="PVC")return!1;let o=!e.previousState||((a=e.state.url)==null?void 0:a.toString())!==((u=e.previousState.url)==null?void 0:u.toString()),s=(e.visitor.sessionScores[W]||0)+1;if(Pt(s,t.match)){let c=r.some(l=>l.type==="modscoreS"&&l.data.dimension===W);return o&&!c&&r.push({type:"modscoreS",data:{dimension:W,delta:1}}),!0}return!1};var lt=(e,t)=>{var o;if(t.type!=="QS")return!1;let r=(o=e.state.url)==null?void 0:o.searchParams.get(t.queryName);return y(r,t.match)};var pt=(e,t,r,o,i)=>{if(t.type!=="QK")return!1;if(typeof window=="undefined"&&o.dur==="t"&&e.scores[i]>0)return!0;let s=e.visitor.quirks[t.key];return y(s,t.match)};var ft=(e,t)=>{var r,o;return t.type!=="EVT"?!1:(o=(r=e.state.events)==null?void 0:r.some(i=>y(i.event,t.event)))!=null?o:!1};var mt=(e,t)=>{var r;return t.type!=="PV"?!1:y((r=e.state.url)==null?void 0:r.pathname,t.path)};var j,A=class{constructor(t){p(this,j,void 0);f(this,j,t)}evaluate(t,r,o,i,s){let a=!(r.op==="&"||!r.op);for(let u of r.clauses){let c;if(u.type==="G")c=this.evaluate(t,u,o,i,s);else{let l=n(this,j)[u.type];if(!l)throw new Error(`${u.type} signal criteria not registered`);c=l(t,u,o,i,s)}if(c===a)return a}return!a}};j=new WeakMap;function y(e,t){var a,u,c,l;let r=(a=t==null?void 0:t.op)!=null?a:"=";if(t.op==="*")return e!==null&&typeof e!="undefined";if(t.op==="!*")return e===null||typeof e=="undefined";if(!("rhs"in t))throw new Error(`Match expression is required for match type ${r}`);let o=(u=t.cs)!=null?u:!1,i=o?e!=null?e:"":Ot(e),s=o?t.rhs:Ot(t.rhs);switch(r){case"=":return i===s;case"!=":return i!==s;case"~":return(c=i.includes(s))!=null?c:!1;case"!~":return!((l=i.includes(s))!=null?l:!0);case"//":return new RegExp(t.rhs,o?"":"i").test(e!=null?e:"");case"!//":return!new RegExp(t.rhs,o?"":"i").test(e!=null?e:"");default:throw new Error(`Unknown match type ${r}.`)}}function Ot(e){var t;return(t=e==null?void 0:e.toUpperCase())!=null?t:""}var F=()=>({quirks:{},scores:{},sessionScores:{},tests:{},consent:!1,controlGroup:!1});var Mt=H(require("mitt")),Rt=require("dequal/lite"),Lt="__UNIFORM_DATA__",k,I,U=class{constructor({initialData:t}){p(this,k,void 0);p(this,I,(0,Mt.default)());h(this,"events",{on:n(this,I).on,off:n(this,I).off});t&&f(this,k,t)}get data(){return n(this,k)}updateData(t,r){return f(this,k,r),this.handleUpdateData(t,r)}async delete(t){f(this,k,void 0),await this.handleDelete(t)}signalAsyncDataUpdate(t){(0,Rt.dequal)(this.data,t)||(f(this,k,t),n(this,I).emit("dataUpdatedAsync",t))}getClientTransitionState(){if(typeof document=="undefined")return;let t=document.getElementById(Lt);return(t==null?void 0:t.textContent)?JSON.parse(t.textContent):void 0}};k=new WeakMap,I=new WeakMap;var gt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",At=gt.split(""),Ut=new Array(123);for(let e=0;e<gt.length;e++)Ut[gt.charCodeAt(e)]=e;var ht=e=>{if(e<0)return`-${ht(-e)}`;let t=e>>>0,r=e/4294967296>>>0,o="";for(;r>0;)o=At[63&t]+o,t>>>=6,t|=(63&r)<<26,r>>>=6;let i="";do i=At[63&t]+i,t>>>=6;while(t>0);return i+o},It=e=>{let t=0,r=e.charAt(0)==="-"?1:0;for(let o=r;o<e.length;o++)t=t*64+Ut[e.charCodeAt(o)];return r?-t:t};var zt=typeof window=="undefined",O,M,qt=class extends U{constructor({cookieAdapter:t,cookieName:r="ufvd"}){super({initialData:zt?fe(t.get(r)):void 0});p(this,O,void 0);p(this,M,void 0);f(this,O,r),f(this,M,t)}handleDelete(){return n(this,M).remove(n(this,O)),Promise.resolve()}async handleUpdateData(t,r){zt||(r.consent?n(this,M).set(n(this,O),me(r)):n(this,M).remove(n(this,O)))}};O=new WeakMap,M=new WeakMap;var Nt="~",$t="!",Gt="-";function fe(e){if(!e)return;let t=e.split(Nt);if(t.length>3)return;let[r,o,i]=t;return{consent:!0,sessionScores:_t(St(o)),scores:_t(St(i)),tests:St(r)}}function St(e){return e.split($t).map(r=>r.split(Gt)).reduce((r,o)=>(o.length!==2||(r[o[0]]=o[1]),r),{})}function _t(e){return Object.entries(e).reduce((t,[r,o])=>(t[r]=It(o),t),{})}function me(e){return[vt(e.tests),vt(jt(e.sessionScores)),vt(jt(e.scores))].join(Nt)}function jt(e){return Object.entries(e).reduce((t,[r,o])=>(t[r]=ht(o),t),{})}function vt(e){return Object.entries(e).map(t=>t.join(Gt)).join($t)}var Z,ge,Ft=class extends U{constructor({cookieAdapter:t,visitorIdCookieName:r="ufvi",...o}){super(o);p(this,Z);o.initialData||S(this,Z,ge).call(this).catch(i=>{console.error(i)})}handleDelete(t){throw new Error("Method not implemented.")}async handleUpdateData(t){let r=await new Promise(o=>{setTimeout(()=>{o(void 0)},2e3)});r&&this.signalAsyncDataUpdate(r)}};Z=new WeakSet,ge=async function(){let t=await new Promise(r=>{setTimeout(()=>{r(void 0)},2e3)});t&&this.signalAsyncDataUpdate(t)};function he(e){let{gracePeriod:t=864e5,decayRate:r=1/30,decayCap:o=.95}=e!=null?e:{};return function({now:s,lastUpd:a,scores:u,sessionScores:c}){if(typeof a!="number")return!1;let V=s-a-t;if(V<=0)return!1;let v=V/864e5,L=1-Math.min(o,v*r);return L<=0?!1:(Qt(u,L),Qt(c,L),!0)}}function Qt(e,t){for(let r in e)e[r]*=t}var Bt=H(require("mitt")),Q=require("dequal/lite");var yt=class{constructor(){h(this,"inMemoryFallback",{});h(this,"hasLocalStorageObject",typeof localStorage!="undefined")}get(t){let r=this.inMemoryFallback[t];if(!this.hasLocalStorageObject||r)return r;try{let o=localStorage.getItem(t);return o?JSON.parse(o):void 0}catch(o){return r}}set(t,r,o){if(this.inMemoryFallback[t]=r,!(!this.hasLocalStorageObject||!o))try{localStorage.setItem(t,JSON.stringify(r))}catch(i){console.warn(i)}}delete(t,r){r||delete this.inMemoryFallback[t];try{localStorage.removeItem(t)}catch(o){}}};var Kt=H(require("rfdc"));var Se=(0,Kt.default)();function Jt(e,t,r){let o=t?Se(t):F();return e.forEach(i=>{var s,a;switch(i.type){case"consent":o.consent=i.data;break;case"setquirk":o.quirks[i.data.key]=i.data.value;break;case"settest":o.tests[i.data.test]=i.data.variant;break;case"modscore":if(r)break;let u=(s=o.scores[i.data.dimension])!=null?s:0;o.scores[i.data.dimension]=u+i.data.delta;break;case"modscoreS":if(r)break;let c=(a=o.sessionScores[i.data.dimension])!=null?a:0;o.sessionScores[i.data.dimension]=c+i.data.delta;break;case"identify":break;case"setcontrol":o.controlGroup=i.data;break;default:throw new Error("Unknown command")}}),o}var tt="ufvisitor",b,R,q,m,D,w,T,z,rt,ve,ot,ye,K,Ht,J,Yt,et=class{constructor(t){p(this,D);p(this,T);p(this,rt);p(this,ot);p(this,K);p(this,J);p(this,b,(0,Bt.default)());p(this,R,new yt);p(this,q,void 0);p(this,m,void 0);h(this,"events",{on:n(this,b).on,off:n(this,b).off});if(f(this,m,t),n(this,D,w)||S(this,T,z).call(this,S(this,J,Yt).call(this),!0),t.transitionStore){let r=t.transitionStore.getClientTransitionState();if(r){let i=[];r.quirks&&i.push(...Object.entries(r.quirks).map(([s,a])=>({type:"setquirk",data:{key:s,value:a}}))),r.tests&&i.push(...Object.entries(r.tests).map(([s,a])=>({type:"settest",data:{test:s,variant:a}}))),this.updateData(i),r.ssv&&t.onServerTransitionScoresReceived&&t.onServerTransitionScoresReceived(r.ssv)}t.transitionStore.events.on("dataUpdatedAsync",i=>{S(this,T,z).call(this,{...n(this,D,w).visitorData,...i})});let o=t.transitionStore.data;o&&S(this,T,z).call(this,{...n(this,D,w).visitorData,...o},!0)}}get data(){var r,o;let t=n(this,D,w);if(S(this,ot,ye).call(this,t)){let{sessionScores:i,...s}=t.visitorData;return S(this,T,z).call(this,{...s,sessionScores:{}}),(o=(r=n(this,m)).onLogMessage)==null||o.call(r,["info",120]),n(this,D,w).visitorData}return t.visitorData}get decayEnabled(){return!!n(this,m).decay}async updateData(t){var o,i,s,a;if(t.length===0)return;(i=(o=n(this,m)).onLogMessage)==null||i.call(o,["debug",101,t]);let r=Jt(t,this.data,(s=n(this,D,w))==null?void 0:s.visitorData.controlGroup);t.some(u=>u.type==="consent"&&!u.data)&&n(this,R).delete(tt,!0),S(this,T,z).call(this,r),await((a=n(this,m).transitionStore)==null?void 0:a.updateData(t,n(this,D,w).visitorData))}async delete(t){var r,o,i;n(this,R).delete(tt,!1),await((r=n(this,m).transitionStore)==null?void 0:r.delete(t)),S(this,T,z).call(this,S(this,J,Yt).call(this)),(i=(o=n(this,m)).onLogMessage)==null||i.call(o,["info",103,t])}};b=new WeakMap,R=new WeakMap,q=new WeakMap,m=new WeakMap,D=new WeakSet,w=function(){return n(this,R).get(tt)},T=new WeakSet,z=function(t,r=!1){var V,v,L,xt,bt,Et;let o=n(this,D,w),i=Date.now();t.controlGroup?(t.scores={},t.sessionScores={}):(S(this,K,Ht).call(this,t.scores),S(this,K,Ht).call(this,t.sessionScores),(v=(V=n(this,m)).decay)==null||v.call(V,{now:i,lastUpd:o==null?void 0:o.updated,scores:t.scores,sessionScores:t.sessionScores}));let s=!(0,Q.dequal)(o==null?void 0:o.visitorData.scores,t.scores),a=!(0,Q.dequal)(o==null?void 0:o.visitorData.sessionScores,t.sessionScores),u=!(0,Q.dequal)(o==null?void 0:o.visitorData.quirks,t.quirks),c=!(0,Q.dequal)(o==null?void 0:o.visitorData.tests,t.tests),l={updated:i,visitorData:t};S(this,rt,ve).call(this),n(this,R).set(tt,l,!!t.consent),(xt=(L=n(this,m)).onLogMessage)==null||xt.call(L,["debug",102,t]),r||((s||a)&&n(this,b).emit("scoresUpdated",t),u&&n(this,b).emit("quirksUpdated",t),c&&n(this,b).emit("testsUpdated",t),((bt=o==null?void 0:o.visitorData)==null?void 0:bt.consent)!==t.consent&&n(this,b).emit("consentUpdated",t),((Et=o==null?void 0:o.visitorData)==null?void 0:Et.controlGroup)!==t.controlGroup&&n(this,b).emit("controlGroupUpdated",t))},rt=new WeakSet,ve=function(){typeof window=="undefined"||!n(this,m).visitLifespan||(n(this,q)&&window.clearTimeout(n(this,q)),f(this,q,window.setTimeout(()=>{this.data},n(this,m).visitLifespan+50)))},ot=new WeakSet,ye=function(t){let r=n(this,m).visitLifespan;return r?t.updated+r<Date.now():!1},K=new WeakSet,Ht=function(t){var r,o;if(!!n(this,m).manifest)for(let i in t){let s=t[i],a=n(this,m).manifest.getDimensionByKey(i);!a||s>a.cap&&((o=(r=n(this,m)).onLogMessage)==null||o.call(r,["debug",110,{dim:i,score:s,cap:a.cap}]),t[i]=a.cap)}},J=new WeakSet,Yt=function(){var t,r,o;return{...F(),consent:(t=n(this,m).defaultConsent)!=null?t:!1,controlGroup:(o=(r=n(this,m).manifest)==null?void 0:r.rollForControlGroup())!=null?o:!1}};var Wt=H(require("mitt"));function Dt({context:e,variations:t,take:r=1}){var u,c;let o=(u=e.storage.data.controlGroup)!=null?u:!1,i=[],s=!1,a=e.scores;for(let l of t){if(i.length===r)break;if(!((c=l.pz)==null?void 0:c.crit.length)){i.push(l);continue}!o&&Ct(l.pz,a)&&(s=!0,i.push(l))}return{personalized:s,variations:i}}function Ct(e,t){return(e==null?void 0:e.crit)?!e.op||e.op==="&"?e.crit.every(r=>Xt(r,t)):e.crit.some(r=>Xt(r,t)):!0}function Xt(e,t){var a;let{op:r,l:o}=e,i=(a=t[o])!=null?a:0;if(r==="+")return Math.max(...Object.values(t))===i&&i>0;if(r==="-")return Math.min(...Object.values(t))===i&&i>0;let s=e.rDim?t[e.rDim]:e.r;if(s===void 0)return!1;if(r===">")return i>s;if(r===">=")return i>=s;if(r==="<")return i<s;if(r==="<=")return i<=s;if(r==="=")return i===s;if(r==="!=")return i!==s;throw new Error(`Unknown op: ${r}`)}var De=e=>{let{values:t,total:r,missingDistribution:o}=e.reduce((i,s)=>(s.testDistribution?i.total+=s.testDistribution:++i.missingDistribution,i.values.push(s.testDistribution),i),{values:[],total:0,missingDistribution:0});if(r>100)throw new Error(`Total distribution ${r} is over the maximum 100.`);if(r<100){let s=(100-r)/o;t.forEach((a,u)=>{typeof a=="undefined"&&(t[u]=s)})}return t},it=({name:e,context:t,variations:r})=>{var s;let o,i=t.getTestVariantId(e);if(i===null)return{result:void 0,variantAssigned:!1};if(i&&(o=r.find(a=>a.id===i),o||t.log("warn",401,{test:e,variant:i})),!o){let a=De(r),u=Math.floor(Math.random()*100),c=0;o=r.find((l,V)=>{let v=a[V];if(u>c&&u<=c+v)return l;c+=v}),o&&t.setTestVariantId(e,(s=o.id)!=null?s:"Unknown")}return{result:o,variantAssigned:!i}};var Zt=require("dequal/lite"),P,C,B,g,te=class{constructor(t){h(this,"manifest");p(this,P,{});p(this,C,void 0);p(this,B,{});p(this,g,(0,Wt.default)());h(this,"events",{on:n(this,g).on,off:n(this,g).off});h(this,"storage");var a,u;let{manifest:r,...o}=t;f(this,C,{}),(a=t.plugins)==null||a.forEach(c=>{!c.logDrain||n(this,g).on("log",c.logDrain)}),this.manifest=new X({manifest:r,evaluator:new A({CK:ct,QS:lt,QK:pt,PVC:dt,EVT:ft,PV:mt})});let i=!1;this.storage=new et({...o,manifest:this.manifest,onServerTransitionScoresReceived:c=>{f(this,P,c),i=!0,n(this,g).emit("log",["debug",130,c])},onLogMessage:c=>n(this,g).emit("log",c)});let s=c=>{var V;let l={...c.scores};for(let v in c.sessionScores)l[v]=((V=l[v])!=null?V:0)+c.sessionScores[v];l=this.manifest.computeAggregateDimensions(l),f(this,P,l),n(this,g).emit("scoresUpdated",l),n(this,g).emit("log",["info",3,l])};this.storage.events.on("scoresUpdated",s),i||s(this.storage.data),this.storage.events.on("quirksUpdated",c=>{let l=this.manifest.computeSignals({scores:n(this,P),state:n(this,C),previousState:n(this,C),visitor:this.storage.data});this.storage.updateData(l),n(this,g).emit("quirksUpdated",c.quirks),n(this,g).emit("log",["info",4,c.quirks])}),n(this,g).emit("log",["debug",1]),(u=t.plugins)==null||u.forEach(c=>{!c.init||c.init(this)})}get scores(){return n(this,P)}async update(t){var i;let r=[];n(this,g).emit("log",["info",2,{...t,url:(i=t.url)==null?void 0:i.toString()}]),t.quirks&&(r.push(...Object.entries(t.quirks).map(([s,a])=>({type:"setquirk",data:{key:s,value:a}}))),t.quirks=void 0),t.enrichments&&(r.push(...t.enrichments.map(s=>({type:"modscore",data:{dimension:_(s.cat,s.key),delta:s.str}}))),t.enrichments=void 0);let o=n(this,C);f(this,C,{...n(this,C),...t}),r.push(...this.manifest.computeSignals({state:n(this,C),previousState:o,visitor:this.storage.data,scores:n(this,P)})),await this.storage.updateData(r)}getTestVariantId(t){var o;let r=this.manifest.getTest(t);return r?(o=r.wv)!=null?o:this.storage.data.tests[t]:(n(this,g).emit("log",["warn",401,t]),null)}setTestVariantId(t,r){this.storage.updateData([{type:"settest",data:{test:t,variant:r}}])}log(...t){n(this,g).emit("log",t)}test(t){var o,i;let r=it({...t,context:this});return n(this,g).emit("testResult",{name:t.name,variantId:(i=(o=r.result)==null?void 0:o.id)!=null?i:void 0,variantAssigned:r.variantAssigned}),r}personalize(t){let r=Dt({...t,context:this}),o=n(this,B)[t.name],i={name:t.name,variantIds:r.variations.map(s=>{var a;return(a=s.id)!=null?a:"Unknown"}),control:this.storage.data.controlGroup,changed:!0};return o&&(0,Zt.dequal)(i.variantIds,o)&&(i.changed=!1),n(this,g).emit("personalizationResult",i),n(this,B)[t.name]=i.variantIds,r}async forget(t){f(this,C,{}),await this.storage.delete(t)}};P=new WeakMap,C=new WeakMap,B=new WeakMap,g=new WeakMap;function nt(e,t){if(e==="none")return!1;switch(t){case"debug":return e==="debug";case"info":return e==="info"||e==="debug";case"warn":return e==="warn"||e==="info"||e==="debug";case"error":return e==="debug"||"info";default:return!1}}function ee(e){return([t,r,...o])=>{!nt(e,t)||console[t](`\u{1F94B} [${t}] Uniform event ID ${r}
|
2
|
+
`,...o.map(i=>JSON.stringify(i,null,2)))}}function Ce(e){return{logDrain:ee(e)}}var re={1:()=>["tracker","constructed"],2:e=>["tracker","received data update",e],3:e=>["tracker","new score vector",e],4:e=>["tracker","updated quirks",e],101:e=>["storage","received update commands",e],102:e=>["storage","data was updated",e],103:e=>["storage",`data was deleted ${e?"from all devices":"from this device"}`],110:({dim:e,cap:t,score:r})=>["storage",`${e} score ${r} exceeded cap ${t}. Rounded down.`],120:()=>["storage","visitor data expired and was cleared"],130:e=>["storage","server to client transition score data was loaded; it will persist until the next update event occurs",e],401:e=>["testing",`${e} was unknown; it will not be run.`],402:({test:e,variant:t})=>["testing",`${e} no longer has visitor's variant ${t}; it will be removed.`],700:()=>["gtag","gtag is not defined, skipping analytics event emission. Ensure you have added the gtag script to your page."],701:()=>["gtag","enabled gtag event signal redirection"]};function oe(e){return([t,r,...o])=>{if(!nt(e,t))return;let i=re[r],s=`\u{1F94B} [${new Date().toLocaleTimeString()}][${t}]`;i||console[t](`${s} unknown message ID ${r} - ensure all Uniform packages are the same version`,...o);let[a,u,...c]=i(...o);console[t](`${s}[${a}] ${u} (Event ID: ${r})
|
3
|
+
`,...c.map(l=>JSON.stringify(l,null,2)))}}function Ve(e){return{logDrain:oe(e)}}var ie=(u=>(u.ListStart="nesi-list-start",u.ListEnd="nesi-list-end",u.ListItem="nesi-list-item-html",u.ListItemSettings="nesi-list-item-settings",u.TestStart="nesi-test-start",u.TestEnd="nesi-test-end",u.Unknown="unknown",u))(ie||{}),xe="nesitag";var Vt=typeof top!="undefined";function be(){return{logDrain:e=>{!Vt||top==null||top.postMessage({type:"uniform:context:log",message:e},window.location.origin)},init:e=>{let t=[],r=[];Vt&&(window.__UNIFORM_DEVTOOLS_CONTEXT_INSTANCE__=e,top==null||top.addEventListener("message",async a=>{if(!a.data)return;let u=a.data;await Ee(u,e)}),top==null||top.postMessage({type:"uniform:context:hello",uiVersion:2},window.location.origin));let o=()=>{!Vt||top==null||top.postMessage({type:"uniform:context:data",data:{scores:e.scores,data:e.storage.data,manifest:e.manifest.data,personalizations:t,tests:r}},window.location.origin)},i=a=>{!a.changed||(t.push(a),o())},s=a=>{!a.variantAssigned||(r.push(a),o())};return e.events.on("personalizationResult",i),e.events.on("testResult",s),e.storage.events.on("*",o),()=>{e.storage.events.off("*",o),e.events.off("personalizationResult",i),e.events.off("testResult",s)}}}}async function Ee(e,t){e.type==="uniform-in:context:update"&&e.newData&&await t.update(e.newData),e.type==="uniform-in:context:commands"&&e.commands&&Array.isArray(e.commands)&&await t.storage.updateData(e.commands),e.type==="uniform-in:context:forget"&&await t.forget(!1)}module.exports=pe(Te);0&&(module.exports={Context,CookieTransitionDataStore,EdgeNodeTagName,EdgeTransitionDataStore,GroupCriteriaEvaluator,ManifestInstance,SERVER_STATE_ID,ScriptType,TransitionDataStore,VisitorDataStore,computeAggregateDimensions,cookieEvaluator,createConsoleLogDrain,createDebugConsoleLogDrain,createLinearDecay,emptyVisitorData,enableConsoleLogDrain,enableContextDevTools,enableDebugConsoleLogDrain,evaluateVariantMatch,eventEvaluator,getEnrichmentVectorKey,isStringMatch,pageViewCountDimension,pageViewCountEvaluator,pageVisitedEvaluator,personalizeVariations,queryStringEvaluator,quirkEvaluator,testVariations});
|
package/dist/index.mjs
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
import{b as y,c as s,d as u,e as m,f as h}from"./chunk-TRWANXVF.mjs";function nt(i,t){let e={...i};for(let r in t){let o=at(i,r,t,new Set([r]));o!==0&&(e[r]=o)}return e}function at(i,t,e,r){var n;let o=0;for(let a of e[t].inputs){let c=(n=i[a.dim])!=null?n:0;if(!c&&e[a.dim]){if(r.has(a.dim))continue;let f=new Set(r);f.add(a.dim),c=at(i,a.dim,e,f)}if(c!==0)if(a.sign==="c"){o=0;break}else a.sign==="-"?o-=c:o+=c}return o}var A,k,X=class{constructor(t,e,r){u(this,A,void 0);u(this,k,void 0);y(this,"signal");m(this,k,t),this.signal=e,m(this,A,r)}computeSignals(t,e){if(t.scores[s(this,k)]>=this.signal.cap&&this.signal.dur!=="t")return;let o=s(this,A).evaluate(t,this.signal.crit,e,this.signal,s(this,k)),n=this.signal.dur==="s"||this.signal.dur==="t"?"modscoreS":"modscore";if(o)e.push({type:n,data:{dimension:s(this,k),delta:this.signal.str}});else if(this.signal.dur==="t"){let a=t.visitor.sessionScores[s(this,k)];a&&e.push({type:n,data:{dimension:s(this,k),delta:-a}})}}};A=new WeakMap,k=new WeakMap;var ct="_",C,$,R=class{constructor({manifest:t,evaluator:e=new N({})}){u(this,C,void 0);u(this,$,void 0);var r,o,n;m(this,C,(r=t.project)!=null?r:{}),m(this,$,Object.entries((n=(o=s(this,C).pz)==null?void 0:o.sig)!=null?n:[]).map(([a,c])=>new X(a,c,e)))}rollForControlGroup(){var t,e;return Math.random()<((e=(t=s(this,C).pz)==null?void 0:t.control)!=null?e:0)}getTest(t){var e;return(e=s(this,C).test)==null?void 0:e[t]}computeSignals(t){let e=[];return s(this,$).forEach(r=>{r.computeSignals(t,e)}),e}computeAggregateDimensions(t){var e,r;return nt(t,(r=(e=s(this,C).pz)==null?void 0:e.agg)!=null?r:{})}getDimensionByKey(t){var r,o,n,a;let e=t.indexOf(ct);return e<=0?(o=(r=s(this,C).pz)==null?void 0:r.sig)==null?void 0:o[t]:(a=(n=s(this,C).pz)==null?void 0:n.enr)==null?void 0:a[t.substring(0,e)]}static getEnrichmentVectorKey(t,e){return`${t}${ct}${e}`}};C=new WeakMap,$=new WeakMap;var ut=(i,t)=>{var o;if(t.type!=="CK")return!1;let e=(o=i.state.cookies)==null?void 0:o[t.cookieName];return x(e,t.match)};function dt(i,t){var r;if(typeof i=="undefined"||i===null)return!1;let e=Number(i);if(isNaN(e))return!1;switch((r=t==null?void 0:t.op)!=null?r:"="){case"=":return e===t.rhs;case"!=":return e!==t.rhs;case">":return e>t.rhs;case"<":return e<t.rhs;default:return console.warn(`Unknown match type ${t.op} is false.`),!1}}var Z=R.getEnrichmentVectorKey("$pvc","v"),lt=(i,t,e)=>{var a,c;if(t.type!=="PVC")return!1;let r=!i.previousState||((a=i.state.url)==null?void 0:a.toString())!==((c=i.previousState.url)==null?void 0:c.toString()),n=(i.visitor.sessionScores[Z]||0)+1;if(dt(n,t.match)){let d=e.some(f=>f.type==="modscoreS"&&f.data.dimension===Z);return r&&!d&&e.push({type:"modscoreS",data:{dimension:Z,delta:1}}),!0}return!1};var pt=(i,t)=>{var r;if(t.type!=="QS")return!1;let e=(r=i.state.url)==null?void 0:r.searchParams.get(t.queryName);return x(e,t.match)};var mt=(i,t,e,r,o)=>{if(t.type!=="QK")return!1;if(typeof window=="undefined"&&r.dur==="t"&&i.scores[o]>0)return!0;let n=i.visitor.quirks[t.key];return x(n,t.match)};var ft=(i,t)=>{var e,r;return t.type!=="EVT"?!1:(r=(e=i.state.events)==null?void 0:e.some(o=>x(o.event,t.event)))!=null?r:!1};var gt=(i,t)=>{var e;return t.type!=="PV"?!1:x((e=i.state.url)==null?void 0:e.pathname,t.path)};var G,N=class{constructor(t){u(this,G,void 0);m(this,G,t)}evaluate(t,e,r,o,n){let a=!(e.op==="&"||!e.op);for(let c of e.clauses){let d;if(c.type==="G")d=this.evaluate(t,c,r,o,n);else{let f=s(this,G)[c.type];if(!f)throw new Error(`${c.type} signal criteria not registered`);d=f(t,c,r,o,n)}if(d===a)return a}return!a}};G=new WeakMap;function x(i,t){var a,c,d,f;let e=(a=t==null?void 0:t.op)!=null?a:"=";if(t.op==="*")return i!==null&&typeof i!="undefined";if(t.op==="!*")return i===null||typeof i=="undefined";if(!("rhs"in t))throw new Error(`Match expression is required for match type ${e}`);let r=(c=t.cs)!=null?c:!1,o=r?i!=null?i:"":ht(i),n=r?t.rhs:ht(t.rhs);switch(e){case"=":return o===n;case"!=":return o!==n;case"~":return(d=o.includes(n))!=null?d:!1;case"!~":return!((f=o.includes(n))!=null?f:!0);case"//":return new RegExp(t.rhs,r?"":"i").test(i!=null?i:"");case"!//":return!new RegExp(t.rhs,r?"":"i").test(i!=null?i:"");default:throw new Error(`Unknown match type ${e}.`)}}function ht(i){var t;return(t=i==null?void 0:i.toUpperCase())!=null?t:""}var K=()=>({quirks:{},scores:{},sessionScores:{},tests:{},consent:!1,controlGroup:!1});import Ot from"mitt";import{dequal as Ut}from"dequal/lite";var It="__UNIFORM_DATA__",T,q,j=class{constructor({initialData:t}){u(this,T,void 0);u(this,q,Ot());y(this,"events",{on:s(this,q).on,off:s(this,q).off});t&&m(this,T,t)}get data(){return s(this,T)}updateData(t,e){return m(this,T,e),this.handleUpdateData(t,e)}async delete(t){m(this,T,void 0),await this.handleDelete(t)}signalAsyncDataUpdate(t){Ut(this.data,t)||(m(this,T,t),s(this,q).emit("dataUpdatedAsync",t))}getClientTransitionState(){if(typeof document=="undefined")return;let t=document.getElementById(It);return(t==null?void 0:t.textContent)?JSON.parse(t.textContent):void 0}};T=new WeakMap,q=new WeakMap;import{ntob as Rt,bton as qt}from"number-to-base64";var St=typeof window=="undefined",O,U,Lt=class extends j{constructor({cookieAdapter:t,cookieName:e="ufvd"}){super({initialData:St?zt(t.get(e)):void 0});u(this,O,void 0);u(this,U,void 0);m(this,O,e),m(this,U,t)}handleDelete(){return s(this,U).remove(s(this,O)),Promise.resolve()}async handleUpdateData(t,e){St||(e.consent?s(this,U).set(s(this,O),At(e)):s(this,U).remove(s(this,O)))}};O=new WeakMap,U=new WeakMap;var yt="~",vt="!",Dt="-";function zt(i){if(!i)return;let t=i.split(yt);if(t.length>3)return;let[e,r,o]=t;return{consent:!0,sessionScores:Vt(tt(r)),scores:Vt(tt(o)),tests:tt(e)}}function tt(i){return i.split(vt).map(e=>e.split(Dt)).reduce((e,r)=>(r.length!==2||(e[r[0]]=r[1]),e),{})}function Vt(i){return Object.entries(i).reduce((t,[e,r])=>(t[e]=qt(r),t),{})}function At(i){return[et(i.tests),et(Ct(i.sessionScores)),et(Ct(i.scores))].join(yt)}function Ct(i){return Object.entries(i).reduce((t,[e,r])=>(t[e]=Rt(r),t),{})}function et(i){return Object.entries(i).map(t=>t.join(Dt)).join(vt)}var J,Nt,$t=class extends j{constructor({cookieAdapter:t,visitorIdCookieName:e="ufvi",...r}){super(r);u(this,J);r.initialData||h(this,J,Nt).call(this).catch(o=>{console.error(o)})}handleDelete(t){throw new Error("Method not implemented.")}async handleUpdateData(t){let e=await new Promise(r=>{setTimeout(()=>{r(void 0)},2e3)});e&&this.signalAsyncDataUpdate(e)}};J=new WeakSet,Nt=async function(){let t=await new Promise(e=>{setTimeout(()=>{e(void 0)},2e3)});t&&this.signalAsyncDataUpdate(t)};function Ae(i){let{gracePeriod:t=864e5,decayRate:e=1/30,decayCap:r=.95}=i!=null?i:{};return function({now:n,lastUpd:a,scores:c,sessionScores:d}){if(typeof a!="number")return!1;let M=n-a-t;if(M<=0)return!1;let Q=M/864e5,W=1-Math.min(r,Q*e);return W<=0?!1:(xt(c,W),xt(d,W),!0)}}function xt(i,t){for(let e in i)i[e]*=t}import _t from"mitt";import{dequal as it}from"dequal/lite";var rt=class{constructor(){y(this,"inMemoryFallback",{});y(this,"hasLocalStorageObject",typeof localStorage!="undefined")}get(t){let e=this.inMemoryFallback[t];if(!this.hasLocalStorageObject||e)return e;try{let r=localStorage.getItem(t);return r?JSON.parse(r):void 0}catch(r){return e}}set(t,e,r){if(this.inMemoryFallback[t]=e,!(!this.hasLocalStorageObject||!r))try{localStorage.setItem(t,JSON.stringify(e))}catch(o){console.warn(o)}}delete(t,e){e||delete this.inMemoryFallback[t];try{localStorage.removeItem(t)}catch(r){}}};import Gt from"rfdc";var jt=Gt();function kt(i,t,e){let r=t?jt(t):K();return i.forEach(o=>{var n,a;switch(o.type){case"consent":r.consent=o.data;break;case"setquirk":r.quirks[o.data.key]=o.data.value;break;case"settest":r.tests[o.data.test]=o.data.variant;break;case"modscore":if(e)break;let c=(n=r.scores[o.data.dimension])!=null?n:0;r.scores[o.data.dimension]=c+o.data.delta;break;case"modscoreS":if(e)break;let d=(a=r.sessionScores[o.data.dimension])!=null?a:0;r.sessionScores[o.data.dimension]=d+o.data.delta;break;case"identify":break;default:throw new Error("Unknown command")}}),r}var B="ufvisitor",v,I,z,S,D,w,b,L,Y,Ft,H,Qt,_,bt,F,Et,ot=class{constructor(t){u(this,D);u(this,b);u(this,Y);u(this,H);u(this,_);u(this,F);u(this,v,_t());u(this,I,new rt);u(this,z,void 0);u(this,S,void 0);y(this,"events",{on:s(this,v).on,off:s(this,v).off});if(m(this,S,t),s(this,D,w)||h(this,b,L).call(this,h(this,F,Et).call(this),!0),t.transitionStore){let e=t.transitionStore.getClientTransitionState();e&&e.quirks&&this.updateData(Object.entries(e.quirks).map(([o,n])=>({type:"setquirk",data:{key:o,value:n}}))),t.transitionStore.events.on("dataUpdatedAsync",o=>{h(this,b,L).call(this,{...s(this,D,w).visitorData,...o})});let r=t.transitionStore.data;r&&h(this,b,L).call(this,{...s(this,D,w).visitorData,...r},!0)}}get data(){let t=s(this,D,w);if(h(this,H,Qt).call(this,t)){let{sessionScores:e,...r}=t.visitorData;return h(this,b,L).call(this,{...r,sessionScores:{}}),s(this,v).emit("log",["info",120]),s(this,D,w).visitorData}return t.visitorData}async updateData(t){var r,o;if(t.length===0)return;s(this,v).emit("log",["debug",101,t]);let e=kt(t,this.data,(r=s(this,D,w))==null?void 0:r.visitorData.controlGroup);t.some(n=>n.type==="consent"&&!n.data)&&s(this,I).delete(B,!0),h(this,b,L).call(this,e),await((o=s(this,S).transitionStore)==null?void 0:o.updateData(t,s(this,D,w).visitorData))}async delete(t){var e;s(this,I).delete(B,!1),await((e=s(this,S).transitionStore)==null?void 0:e.delete(t)),s(this,v).emit("log",["info",103,t]),h(this,b,L).call(this,h(this,F,Et).call(this))}};v=new WeakMap,I=new WeakMap,z=new WeakMap,S=new WeakMap,D=new WeakSet,w=function(){return s(this,I).get(B)},b=new WeakSet,L=function(t,e=!1){var f,M;let r=s(this,D,w),o=Date.now();h(this,_,bt).call(this,t.scores),h(this,_,bt).call(this,t.sessionScores),(M=(f=s(this,S)).decay)==null||M.call(f,{now:o,lastUpd:r==null?void 0:r.updated,scores:t.scores,sessionScores:t.sessionScores});let n=!it(r==null?void 0:r.visitorData.scores,t.scores),a=!it(r==null?void 0:r.visitorData.sessionScores,t.sessionScores),c=!it(r==null?void 0:r.visitorData.quirks,t.quirks),d={updated:o,visitorData:t};h(this,Y,Ft).call(this),s(this,I).set(B,d,!!t.consent),s(this,v).emit("log",["debug",102,t]),e||((n||a)&&s(this,v).emit("scoresUpdated",t),c&&s(this,v).emit("quirksUpdated",t))},Y=new WeakSet,Ft=function(){typeof window=="undefined"||!s(this,S).visitLifespan||(s(this,z)&&window.clearTimeout(s(this,z)),m(this,z,window.setTimeout(()=>{this.data},s(this,S).visitLifespan+50)))},H=new WeakSet,Qt=function(t){let e=s(this,S).visitLifespan;return e?t.updated+e<Date.now():!1},_=new WeakSet,bt=function(t){if(!!s(this,S).manifest)for(let e in t){let r=t[e],o=s(this,S).manifest.getDimensionByKey(e);!o||r>o.cap&&(s(this,v).emit("log",["debug",110,{dim:e,score:r,cap:o.cap}]),t[e]=o.cap)}},F=new WeakSet,Et=function(){var t,e,r;return{...K(),consent:(t=s(this,S).defaultConsent)!=null?t:!1,controlGroup:(r=(e=s(this,S).manifest)==null?void 0:e.rollForControlGroup())!=null?r:!1}};import Jt from"mitt";function Tt({context:i,variations:t,take:e=1}){var c;let r=(c=i.storage.data.controlGroup)!=null?c:!1,o=[],n=!1,a=i.scores;for(let d of t){if(o.length===e)break;if(!d.pz){o.push(d);continue}!r&&wt(d.pz,a)&&(n=!0,o.push(d))}return{personalized:n,variations:o}}function wt(i,t){return(i==null?void 0:i.crit)?!i.op||i.op==="&"?i.crit.every(e=>Pt(e,t)):i.crit.some(e=>Pt(e,t)):!0}function Pt(i,t){var a;let{op:e,l:r}=i,o=(a=t[r])!=null?a:0;if(e==="+")return Math.max(...Object.values(t))===o&&o>0;if(e==="-")return Math.min(...Object.values(t))===o&&o>0;let n=i.rDim?t[i.rDim]:i.r;if(n===void 0)return!1;if(e===">")return o>n;if(e===">=")return o>=n;if(e==="<")return o<n;if(e==="<=")return o<=n;if(e==="=")return o===n;if(e==="!=")return o!==n;throw new Error(`Unknown op: ${e}`)}var Kt=i=>{let{values:t,total:e,missingDistribution:r}=i.reduce((o,n)=>(n.testDistribution?o.total+=n.testDistribution:++o.missingDistribution,o.values.push(n.testDistribution),o),{values:[],total:0,missingDistribution:0});if(e>100)throw new Error(`Total distribution ${e} is over the maximum 100.`);if(e<100){let n=(100-e)/r;t.forEach((a,c)=>{typeof a=="undefined"&&(t[c]=n)})}return t},st=({name:i,context:t,variations:e})=>{var n;let r,o=t.getTestVariantId(i);if(o===null)return{result:void 0};if(o&&(r=e.find(a=>a.id===o),r||t.log("warn",401,{test:i,variant:o})),!r){let a=Kt(e),c=Math.floor(Math.random()*100),d=0;r=e.find((f,M)=>{let Q=a[M];if(c>d&&c<=d+Q)return f;d+=Q}),r&&t.setTestVariantId(i,(n=r.id)!=null?n:"Unknown")}return{result:r}};var E,P,V,g,Bt=class{constructor(t){u(this,E,void 0);u(this,P,{});u(this,V,void 0);u(this,g,Jt());y(this,"events",{on:s(this,g).on,off:s(this,g).off});y(this,"storage");let{manifest:e,...r}=t;m(this,V,{}),m(this,E,new R({manifest:e,evaluator:new N({CK:ut,QS:pt,QK:mt,PVC:lt,EVT:ft,PV:gt})})),this.storage=new ot({manifest:s(this,E),...r}),this.storage.events.on("log",(...n)=>s(this,g).emit("log",...n));let o=n=>{var c;let a={...n.scores};for(let d in n.sessionScores)a[d]=((c=a[d])!=null?c:0)+n.sessionScores[d];a=s(this,E).computeAggregateDimensions(a),m(this,P,a),s(this,g).emit("scoresUpdated",a),s(this,g).emit("log",["info",3,a])};this.storage.events.on("scoresUpdated",o),o(this.storage.data),this.storage.events.on("quirksUpdated",n=>{let a=s(this,E).computeSignals({scores:s(this,P),state:s(this,V),previousState:s(this,V),visitor:this.storage.data});this.storage.updateData(a),s(this,g).emit("quirksUpdated",n.quirks),s(this,g).emit("log",["info",4,n.quirks])}),s(this,g).emit("log",["debug",1,{options:t,scores:s(this,P)}])}get scores(){return s(this,P)}async update(t){let e=[];s(this,g).emit("log",["info",2,t]),t.quirks&&(e.push(...Object.entries(t.quirks).map(([o,n])=>({type:"setquirk",data:{key:o,value:n}}))),t.quirks=void 0),t.enrichments&&(e.push(...t.enrichments.map(o=>({type:"modscore",data:{dimension:R.getEnrichmentVectorKey(o.cat,o.key),delta:o.str}}))),t.enrichments=void 0);let r=s(this,V);m(this,V,{...s(this,V),...t}),e.push(...s(this,E).computeSignals({state:s(this,V),previousState:r,visitor:this.storage.data,scores:s(this,P)})),await this.storage.updateData(e)}getTestVariantId(t){var r;let e=s(this,E).getTest(t);return e?(r=e.wv)!=null?r:this.storage.data.tests[t]:(s(this,g).emit("log",["warn",401,t]),null)}setTestVariantId(t,e){this.storage.updateData([{type:"settest",data:{test:t,variant:e}}])}log(...t){s(this,g).emit("log",t)}test(t){var r;let e=st({...t,context:this});return s(this,g).emit("testResult",{name:t.name,variantId:(r=e.result)==null?void 0:r.id,control:this.storage.data.controlGroup}),e}personalize(t){let e=Tt({...t,context:this});return t.name?s(this,g).emit("personalizationResult",{name:t.name,variantIds:e.variations.map(r=>{var o;return(o=r.id)!=null?o:"Unknown"}),control:this.storage.data.controlGroup}):this.log("warn",301),e}async forget(t){m(this,V,{}),await this.storage.delete(t)}};E=new WeakMap,P=new WeakMap,V=new WeakMap,g=new WeakMap;var Dr=([i,t,...e])=>{console[i](`\u{1F94B} [${i}] Uniform event ID ${t}
|
2
|
-
`,...
|
3
|
-
`,...
|
1
|
+
import{a as J}from"./chunk-GU2YFM6V.mjs";import{d as v,e as n,f as m,g,h as y,i as u}from"./chunk-KZPEO35A.mjs";u();u();u();function ht(r,t){let e={...r};for(let o in t){let i=St(r,o,t,new Set([o]));i!==0&&(e[o]=i)}return e}function St(r,t,e,o){var s;let i=0;for(let a of e[t].inputs){let c=(s=r[a.dim])!=null?s:0;if(!c&&e[a.dim]){if(o.has(a.dim))continue;let l=new Set(o);l.add(a.dim),c=St(r,a.dim,e,l)}if(c!==0)if(a.sign==="c"){i=0;break}else a.sign==="-"?i-=c:i+=c}return i}u();var $,k,rt=class{constructor(t,e,o){m(this,$,void 0);m(this,k,void 0);v(this,"signal");g(this,k,t),this.signal=e,g(this,$,o)}computeSignals(t,e){if(t.scores[n(this,k)]>=this.signal.cap&&this.signal.dur!=="t")return;let i=n(this,$).evaluate(t,this.signal.crit,e,this.signal,n(this,k)),s=this.signal.dur==="s"||this.signal.dur==="t"?"modscoreS":"modscore";if(i)e.push({type:s,data:{dimension:n(this,k),delta:this.signal.str}});else if(this.signal.dur==="t"){let a=t.visitor.sessionScores[n(this,k)];a&&e.push({type:s,data:{dimension:n(this,k),delta:-a}})}}};$=new WeakMap,k=new WeakMap;var b,G,ot=class{constructor({manifest:t,evaluator:e=new N({})}){v(this,"data");m(this,b,void 0);m(this,G,void 0);var o,i,s;g(this,b,(o=t.project)!=null?o:{}),this.data=t,g(this,G,Object.entries((s=(i=n(this,b).pz)==null?void 0:i.sig)!=null?s:[]).map(([a,c])=>new rt(a,c,e)))}rollForControlGroup(){var t,e;return Math.random()<((e=(t=n(this,b).pz)==null?void 0:t.control)!=null?e:0)}getTest(t){var e;return(e=n(this,b).test)==null?void 0:e[t]}computeSignals(t){let e=[];return n(this,G).forEach(o=>{o.computeSignals(t,e)}),e}computeAggregateDimensions(t){var e,o;return ht(t,(o=(e=n(this,b).pz)==null?void 0:e.agg)!=null?o:{})}getDimensionByKey(t){var o,i,s,a;let e=t.indexOf(J);return e<=0?(i=(o=n(this,b).pz)==null?void 0:o.sig)==null?void 0:i[t]:(a=(s=n(this,b).pz)==null?void 0:s.enr)==null?void 0:a[t.substring(0,e)]}};b=new WeakMap,G=new WeakMap;u();var vt=(r,t)=>{var i;if(t.type!=="CK")return!1;let e=(i=r.state.cookies)==null?void 0:i[t.cookieName];return E(e,t.match)};u();u();function yt(r,t){var o;if(typeof r=="undefined"||r===null)return!1;let e=Number(r);if(isNaN(e))return!1;switch((o=t==null?void 0:t.op)!=null?o:"="){case"=":return e===t.rhs;case"!=":return e!==t.rhs;case">":return e>t.rhs;case"<":return e<t.rhs;default:return console.warn(`Unknown match type ${t.op} is false.`),!1}}u();function B(r,t){return`${r}${J}${t}`}var it=B("$pvc","v"),Dt=(r,t,e)=>{var a,c;if(t.type!=="PVC")return!1;let o=!r.previousState||((a=r.state.url)==null?void 0:a.toString())!==((c=r.previousState.url)==null?void 0:c.toString()),s=(r.visitor.sessionScores[it]||0)+1;if(yt(s,t.match)){let d=e.some(l=>l.type==="modscoreS"&&l.data.dimension===it);return o&&!d&&e.push({type:"modscoreS",data:{dimension:it,delta:1}}),!0}return!1};u();var Ct=(r,t)=>{var o;if(t.type!=="QS")return!1;let e=(o=r.state.url)==null?void 0:o.searchParams.get(t.queryName);return E(e,t.match)};u();var Vt=(r,t,e,o,i)=>{if(t.type!=="QK")return!1;if(typeof window=="undefined"&&o.dur==="t"&&r.scores[i]>0)return!0;let s=r.visitor.quirks[t.key];return E(s,t.match)};u();var xt=(r,t)=>{var e,o;return t.type!=="EVT"?!1:(o=(e=r.state.events)==null?void 0:e.some(i=>E(i.event,t.event)))!=null?o:!1};u();var bt=(r,t)=>{var e;return t.type!=="PV"?!1:E((e=r.state.url)==null?void 0:e.pathname,t.path)};u();var _,N=class{constructor(t){m(this,_,void 0);g(this,_,t)}evaluate(t,e,o,i,s){let a=!(e.op==="&"||!e.op);for(let c of e.clauses){let d;if(c.type==="G")d=this.evaluate(t,c,o,i,s);else{let l=n(this,_)[c.type];if(!l)throw new Error(`${c.type} signal criteria not registered`);d=l(t,c,o,i,s)}if(d===a)return a}return!a}};_=new WeakMap;u();function E(r,t){var a,c,d,l;let e=(a=t==null?void 0:t.op)!=null?a:"=";if(t.op==="*")return r!==null&&typeof r!="undefined";if(t.op==="!*")return r===null||typeof r=="undefined";if(!("rhs"in t))throw new Error(`Match expression is required for match type ${e}`);let o=(c=t.cs)!=null?c:!1,i=o?r!=null?r:"":Et(r),s=o?t.rhs:Et(t.rhs);switch(e){case"=":return i===s;case"!=":return i!==s;case"~":return(d=i.includes(s))!=null?d:!1;case"!~":return!((l=i.includes(s))!=null?l:!0);case"//":return new RegExp(t.rhs,o?"":"i").test(r!=null?r:"");case"!//":return!new RegExp(t.rhs,o?"":"i").test(r!=null?r:"");default:throw new Error(`Unknown match type ${e}.`)}}function Et(r){var t;return(t=r==null?void 0:r.toUpperCase())!=null?t:""}u();var H=()=>({quirks:{},scores:{},sessionScores:{},tests:{},consent:!1,controlGroup:!1});u();u();import jt from"mitt";import{dequal as Ft}from"dequal/lite";var Qt="__UNIFORM_DATA__",P,I,j=class{constructor({initialData:t}){m(this,P,void 0);m(this,I,jt());v(this,"events",{on:n(this,I).on,off:n(this,I).off});t&&g(this,P,t)}get data(){return n(this,P)}updateData(t,e){return g(this,P,e),this.handleUpdateData(t,e)}async delete(t){g(this,P,void 0),await this.handleDelete(t)}signalAsyncDataUpdate(t){Ft(this.data,t)||(g(this,P,t),n(this,I).emit("dataUpdatedAsync",t))}getClientTransitionState(){if(typeof document=="undefined")return;let t=document.getElementById(Qt);return(t==null?void 0:t.textContent)?JSON.parse(t.textContent):void 0}};P=new WeakMap,I=new WeakMap;u();var nt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Tt=nt.split(""),kt=new Array(123);for(let r=0;r<nt.length;r++)kt[nt.charCodeAt(r)]=r;var st=r=>{if(r<0)return`-${st(-r)}`;let t=r>>>0,e=r/4294967296>>>0,o="";for(;e>0;)o=Tt[63&t]+o,t>>>=6,t|=(63&e)<<26,e>>>=6;let i="";do i=Tt[63&t]+i,t>>>=6;while(t>0);return i+o},wt=r=>{let t=0,e=r.charAt(0)==="-"?1:0;for(let o=e;o<r.length;o++)t=t*64+kt[r.charCodeAt(o)];return e?-t:t};var Pt=typeof window=="undefined",R,L,Kt=class extends j{constructor({cookieAdapter:t,cookieName:e="ufvd"}){super({initialData:Pt?Jt(t.get(e)):void 0});m(this,R,void 0);m(this,L,void 0);g(this,R,e),g(this,L,t)}handleDelete(){return n(this,L).remove(n(this,R)),Promise.resolve()}async handleUpdateData(t,e){Pt||(e.consent?n(this,L).set(n(this,R),Bt(e)):n(this,L).remove(n(this,R)))}};R=new WeakMap,L=new WeakMap;var Mt="~",Ot="!",Rt="-";function Jt(r){if(!r)return;let t=r.split(Mt);if(t.length>3)return;let[e,o,i]=t;return{consent:!0,sessionScores:Lt(at(o)),scores:Lt(at(i)),tests:at(e)}}function at(r){return r.split(Ot).map(e=>e.split(Rt)).reduce((e,o)=>(o.length!==2||(e[o[0]]=o[1]),e),{})}function Lt(r){return Object.entries(r).reduce((t,[e,o])=>(t[e]=wt(o),t),{})}function Bt(r){return[ut(r.tests),ut(At(r.sessionScores)),ut(At(r.scores))].join(Mt)}function At(r){return Object.entries(r).reduce((t,[e,o])=>(t[e]=st(o),t),{})}function ut(r){return Object.entries(r).map(t=>t.join(Rt)).join(Ot)}u();var Y,Yt,Ht=class extends j{constructor({cookieAdapter:t,visitorIdCookieName:e="ufvi",...o}){super(o);m(this,Y);o.initialData||y(this,Y,Yt).call(this).catch(i=>{console.error(i)})}handleDelete(t){throw new Error("Method not implemented.")}async handleUpdateData(t){let e=await new Promise(o=>{setTimeout(()=>{o(void 0)},2e3)});e&&this.signalAsyncDataUpdate(e)}};Y=new WeakSet,Yt=async function(){let t=await new Promise(e=>{setTimeout(()=>{e(void 0)},2e3)});t&&this.signalAsyncDataUpdate(t)};u();function er(r){let{gracePeriod:t=864e5,decayRate:e=1/30,decayCap:o=.95}=r!=null?r:{};return function({now:s,lastUpd:a,scores:c,sessionScores:d}){if(typeof a!="number")return!1;let x=s-a-t;if(x<=0)return!1;let D=x/864e5,U=1-Math.min(o,D*e);return U<=0?!1:(Ut(c,U),Ut(d,U),!0)}}function Ut(r,t){for(let e in r)r[e]*=t}u();import Zt from"mitt";import{dequal as X}from"dequal/lite";u();var ct=class{constructor(){v(this,"inMemoryFallback",{});v(this,"hasLocalStorageObject",typeof localStorage!="undefined")}get(t){let e=this.inMemoryFallback[t];if(!this.hasLocalStorageObject||e)return e;try{let o=localStorage.getItem(t);return o?JSON.parse(o):void 0}catch(o){return e}}set(t,e,o){if(this.inMemoryFallback[t]=e,!(!this.hasLocalStorageObject||!o))try{localStorage.setItem(t,JSON.stringify(e))}catch(i){console.warn(i)}}delete(t,e){e||delete this.inMemoryFallback[t];try{localStorage.removeItem(t)}catch(o){}}};u();import Xt from"rfdc";var Wt=Xt();function It(r,t,e){let o=t?Wt(t):H();return r.forEach(i=>{var s,a;switch(i.type){case"consent":o.consent=i.data;break;case"setquirk":o.quirks[i.data.key]=i.data.value;break;case"settest":o.tests[i.data.test]=i.data.variant;break;case"modscore":if(e)break;let c=(s=o.scores[i.data.dimension])!=null?s:0;o.scores[i.data.dimension]=c+i.data.delta;break;case"modscoreS":if(e)break;let d=(a=o.sessionScores[i.data.dimension])!=null?a:0;o.sessionScores[i.data.dimension]=d+i.data.delta;break;case"identify":break;case"setcontrol":o.controlGroup=i.data;break;default:throw new Error("Unknown command")}}),o}var W="ufvisitor",T,A,q,h,C,M,w,z,Z,te,tt,ee,F,zt,Q,qt,dt=class{constructor(t){m(this,C);m(this,w);m(this,Z);m(this,tt);m(this,F);m(this,Q);m(this,T,Zt());m(this,A,new ct);m(this,q,void 0);m(this,h,void 0);v(this,"events",{on:n(this,T).on,off:n(this,T).off});if(g(this,h,t),n(this,C,M)||y(this,w,z).call(this,y(this,Q,qt).call(this),!0),t.transitionStore){let e=t.transitionStore.getClientTransitionState();if(e){let i=[];e.quirks&&i.push(...Object.entries(e.quirks).map(([s,a])=>({type:"setquirk",data:{key:s,value:a}}))),e.tests&&i.push(...Object.entries(e.tests).map(([s,a])=>({type:"settest",data:{test:s,variant:a}}))),this.updateData(i),e.ssv&&t.onServerTransitionScoresReceived&&t.onServerTransitionScoresReceived(e.ssv)}t.transitionStore.events.on("dataUpdatedAsync",i=>{y(this,w,z).call(this,{...n(this,C,M).visitorData,...i})});let o=t.transitionStore.data;o&&y(this,w,z).call(this,{...n(this,C,M).visitorData,...o},!0)}}get data(){var e,o;let t=n(this,C,M);if(y(this,tt,ee).call(this,t)){let{sessionScores:i,...s}=t.visitorData;return y(this,w,z).call(this,{...s,sessionScores:{}}),(o=(e=n(this,h)).onLogMessage)==null||o.call(e,["info",120]),n(this,C,M).visitorData}return t.visitorData}get decayEnabled(){return!!n(this,h).decay}async updateData(t){var o,i,s,a;if(t.length===0)return;(i=(o=n(this,h)).onLogMessage)==null||i.call(o,["debug",101,t]);let e=It(t,this.data,(s=n(this,C,M))==null?void 0:s.visitorData.controlGroup);t.some(c=>c.type==="consent"&&!c.data)&&n(this,A).delete(W,!0),y(this,w,z).call(this,e),await((a=n(this,h).transitionStore)==null?void 0:a.updateData(t,n(this,C,M).visitorData))}async delete(t){var e,o,i;n(this,A).delete(W,!1),await((e=n(this,h).transitionStore)==null?void 0:e.delete(t)),y(this,w,z).call(this,y(this,Q,qt).call(this)),(i=(o=n(this,h)).onLogMessage)==null||i.call(o,["info",103,t])}};T=new WeakMap,A=new WeakMap,q=new WeakMap,h=new WeakMap,C=new WeakSet,M=function(){return n(this,A).get(W)},w=new WeakSet,z=function(t,e=!1){var x,D,U,ft,mt,gt;let o=n(this,C,M),i=Date.now();t.controlGroup?(t.scores={},t.sessionScores={}):(y(this,F,zt).call(this,t.scores),y(this,F,zt).call(this,t.sessionScores),(D=(x=n(this,h)).decay)==null||D.call(x,{now:i,lastUpd:o==null?void 0:o.updated,scores:t.scores,sessionScores:t.sessionScores}));let s=!X(o==null?void 0:o.visitorData.scores,t.scores),a=!X(o==null?void 0:o.visitorData.sessionScores,t.sessionScores),c=!X(o==null?void 0:o.visitorData.quirks,t.quirks),d=!X(o==null?void 0:o.visitorData.tests,t.tests),l={updated:i,visitorData:t};y(this,Z,te).call(this),n(this,A).set(W,l,!!t.consent),(ft=(U=n(this,h)).onLogMessage)==null||ft.call(U,["debug",102,t]),e||((s||a)&&n(this,T).emit("scoresUpdated",t),c&&n(this,T).emit("quirksUpdated",t),d&&n(this,T).emit("testsUpdated",t),((mt=o==null?void 0:o.visitorData)==null?void 0:mt.consent)!==t.consent&&n(this,T).emit("consentUpdated",t),((gt=o==null?void 0:o.visitorData)==null?void 0:gt.controlGroup)!==t.controlGroup&&n(this,T).emit("controlGroupUpdated",t))},Z=new WeakSet,te=function(){typeof window=="undefined"||!n(this,h).visitLifespan||(n(this,q)&&window.clearTimeout(n(this,q)),g(this,q,window.setTimeout(()=>{this.data},n(this,h).visitLifespan+50)))},tt=new WeakSet,ee=function(t){let e=n(this,h).visitLifespan;return e?t.updated+e<Date.now():!1},F=new WeakSet,zt=function(t){var e,o;if(!!n(this,h).manifest)for(let i in t){let s=t[i],a=n(this,h).manifest.getDimensionByKey(i);!a||s>a.cap&&((o=(e=n(this,h)).onLogMessage)==null||o.call(e,["debug",110,{dim:i,score:s,cap:a.cap}]),t[i]=a.cap)}},Q=new WeakSet,qt=function(){var t,e,o;return{...H(),consent:(t=n(this,h).defaultConsent)!=null?t:!1,controlGroup:(o=(e=n(this,h).manifest)==null?void 0:e.rollForControlGroup())!=null?o:!1}};u();import oe from"mitt";u();u();function $t({context:r,variations:t,take:e=1}){var c,d;let o=(c=r.storage.data.controlGroup)!=null?c:!1,i=[],s=!1,a=r.scores;for(let l of t){if(i.length===e)break;if(!((d=l.pz)==null?void 0:d.crit.length)){i.push(l);continue}!o&&Gt(l.pz,a)&&(s=!0,i.push(l))}return{personalized:s,variations:i}}u();function Gt(r,t){return(r==null?void 0:r.crit)?!r.op||r.op==="&"?r.crit.every(e=>Nt(e,t)):r.crit.some(e=>Nt(e,t)):!0}function Nt(r,t){var a;let{op:e,l:o}=r,i=(a=t[o])!=null?a:0;if(e==="+")return Math.max(...Object.values(t))===i&&i>0;if(e==="-")return Math.min(...Object.values(t))===i&&i>0;let s=r.rDim?t[r.rDim]:r.r;if(s===void 0)return!1;if(e===">")return i>s;if(e===">=")return i>=s;if(e==="<")return i<s;if(e==="<=")return i<=s;if(e==="=")return i===s;if(e==="!=")return i!==s;throw new Error(`Unknown op: ${e}`)}u();var re=r=>{let{values:t,total:e,missingDistribution:o}=r.reduce((i,s)=>(s.testDistribution?i.total+=s.testDistribution:++i.missingDistribution,i.values.push(s.testDistribution),i),{values:[],total:0,missingDistribution:0});if(e>100)throw new Error(`Total distribution ${e} is over the maximum 100.`);if(e<100){let s=(100-e)/o;t.forEach((a,c)=>{typeof a=="undefined"&&(t[c]=s)})}return t},lt=({name:r,context:t,variations:e})=>{var s;let o,i=t.getTestVariantId(r);if(i===null)return{result:void 0,variantAssigned:!1};if(i&&(o=e.find(a=>a.id===i),o||t.log("warn",401,{test:r,variant:i})),!o){let a=re(e),c=Math.floor(Math.random()*100),d=0;o=e.find((l,x)=>{let D=a[x];if(c>d&&c<=d+D)return l;d+=D}),o&&t.setTestVariantId(r,(s=o.id)!=null?s:"Unknown")}return{result:o,variantAssigned:!i}};import{dequal as ie}from"dequal/lite";var O,V,K,S,ne=class{constructor(t){v(this,"manifest");m(this,O,{});m(this,V,void 0);m(this,K,{});m(this,S,oe());v(this,"events",{on:n(this,S).on,off:n(this,S).off});v(this,"storage");var a,c;let{manifest:e,...o}=t;g(this,V,{}),(a=t.plugins)==null||a.forEach(d=>{!d.logDrain||n(this,S).on("log",d.logDrain)}),this.manifest=new ot({manifest:e,evaluator:new N({CK:vt,QS:Ct,QK:Vt,PVC:Dt,EVT:xt,PV:bt})});let i=!1;this.storage=new dt({...o,manifest:this.manifest,onServerTransitionScoresReceived:d=>{g(this,O,d),i=!0,n(this,S).emit("log",["debug",130,d])},onLogMessage:d=>n(this,S).emit("log",d)});let s=d=>{var x;let l={...d.scores};for(let D in d.sessionScores)l[D]=((x=l[D])!=null?x:0)+d.sessionScores[D];l=this.manifest.computeAggregateDimensions(l),g(this,O,l),n(this,S).emit("scoresUpdated",l),n(this,S).emit("log",["info",3,l])};this.storage.events.on("scoresUpdated",s),i||s(this.storage.data),this.storage.events.on("quirksUpdated",d=>{let l=this.manifest.computeSignals({scores:n(this,O),state:n(this,V),previousState:n(this,V),visitor:this.storage.data});this.storage.updateData(l),n(this,S).emit("quirksUpdated",d.quirks),n(this,S).emit("log",["info",4,d.quirks])}),n(this,S).emit("log",["debug",1]),(c=t.plugins)==null||c.forEach(d=>{!d.init||d.init(this)})}get scores(){return n(this,O)}async update(t){var i;let e=[];n(this,S).emit("log",["info",2,{...t,url:(i=t.url)==null?void 0:i.toString()}]),t.quirks&&(e.push(...Object.entries(t.quirks).map(([s,a])=>({type:"setquirk",data:{key:s,value:a}}))),t.quirks=void 0),t.enrichments&&(e.push(...t.enrichments.map(s=>({type:"modscore",data:{dimension:B(s.cat,s.key),delta:s.str}}))),t.enrichments=void 0);let o=n(this,V);g(this,V,{...n(this,V),...t}),e.push(...this.manifest.computeSignals({state:n(this,V),previousState:o,visitor:this.storage.data,scores:n(this,O)})),await this.storage.updateData(e)}getTestVariantId(t){var o;let e=this.manifest.getTest(t);return e?(o=e.wv)!=null?o:this.storage.data.tests[t]:(n(this,S).emit("log",["warn",401,t]),null)}setTestVariantId(t,e){this.storage.updateData([{type:"settest",data:{test:t,variant:e}}])}log(...t){n(this,S).emit("log",t)}test(t){var o,i;let e=lt({...t,context:this});return n(this,S).emit("testResult",{name:t.name,variantId:(i=(o=e.result)==null?void 0:o.id)!=null?i:void 0,variantAssigned:e.variantAssigned}),e}personalize(t){let e=$t({...t,context:this}),o=n(this,K)[t.name],i={name:t.name,variantIds:e.variations.map(s=>{var a;return(a=s.id)!=null?a:"Unknown"}),control:this.storage.data.controlGroup,changed:!0};return o&&ie(i.variantIds,o)&&(i.changed=!1),n(this,S).emit("personalizationResult",i),n(this,K)[t.name]=i.variantIds,e}async forget(t){g(this,V,{}),await this.storage.delete(t)}};O=new WeakMap,V=new WeakMap,K=new WeakMap,S=new WeakMap;u();u();function et(r,t){if(r==="none")return!1;switch(t){case"debug":return r==="debug";case"info":return r==="info"||r==="debug";case"warn":return r==="warn"||r==="info"||r==="debug";case"error":return r==="debug"||"info";default:return!1}}function se(r){return([t,e,...o])=>{!et(r,t)||console[t](`\u{1F94B} [${t}] Uniform event ID ${e}
|
2
|
+
`,...o.map(i=>JSON.stringify(i,null,2)))}}function Gr(r){return{logDrain:se(r)}}u();u();var _t={1:()=>["tracker","constructed"],2:r=>["tracker","received data update",r],3:r=>["tracker","new score vector",r],4:r=>["tracker","updated quirks",r],101:r=>["storage","received update commands",r],102:r=>["storage","data was updated",r],103:r=>["storage",`data was deleted ${r?"from all devices":"from this device"}`],110:({dim:r,cap:t,score:e})=>["storage",`${r} score ${e} exceeded cap ${t}. Rounded down.`],120:()=>["storage","visitor data expired and was cleared"],130:r=>["storage","server to client transition score data was loaded; it will persist until the next update event occurs",r],401:r=>["testing",`${r} was unknown; it will not be run.`],402:({test:r,variant:t})=>["testing",`${r} no longer has visitor's variant ${t}; it will be removed.`],700:()=>["gtag","gtag is not defined, skipping analytics event emission. Ensure you have added the gtag script to your page."],701:()=>["gtag","enabled gtag event signal redirection"]};function ae(r){return([t,e,...o])=>{if(!et(r,t))return;let i=_t[e],s=`\u{1F94B} [${new Date().toLocaleTimeString()}][${t}]`;i||console[t](`${s} unknown message ID ${e} - ensure all Uniform packages are the same version`,...o);let[a,c,...d]=i(...o);console[t](`${s}[${a}] ${c} (Event ID: ${e})
|
3
|
+
`,...d.map(l=>JSON.stringify(l,null,2)))}}function Qr(r){return{logDrain:ae(r)}}u();var ue=(c=>(c.ListStart="nesi-list-start",c.ListEnd="nesi-list-end",c.ListItem="nesi-list-item-html",c.ListItemSettings="nesi-list-item-settings",c.TestStart="nesi-test-start",c.TestEnd="nesi-test-end",c.Unknown="unknown",c))(ue||{}),Jr="nesitag";u();var pt=typeof top!="undefined";function Hr(){return{logDrain:r=>{!pt||top==null||top.postMessage({type:"uniform:context:log",message:r},window.location.origin)},init:r=>{let t=[],e=[];pt&&(window.__UNIFORM_DEVTOOLS_CONTEXT_INSTANCE__=r,top==null||top.addEventListener("message",async a=>{if(!a.data)return;let c=a.data;await ce(c,r)}),top==null||top.postMessage({type:"uniform:context:hello",uiVersion:2},window.location.origin));let o=()=>{!pt||top==null||top.postMessage({type:"uniform:context:data",data:{scores:r.scores,data:r.storage.data,manifest:r.manifest.data,personalizations:t,tests:e}},window.location.origin)},i=a=>{!a.changed||(t.push(a),o())},s=a=>{!a.variantAssigned||(e.push(a),o())};return r.events.on("personalizationResult",i),r.events.on("testResult",s),r.storage.events.on("*",o),()=>{r.storage.events.off("*",o),r.events.off("personalizationResult",i),r.events.off("testResult",s)}}}}async function ce(r,t){r.type==="uniform-in:context:update"&&r.newData&&await t.update(r.newData),r.type==="uniform-in:context:commands"&&r.commands&&Array.isArray(r.commands)&&await t.storage.updateData(r.commands),r.type==="uniform-in:context:forget"&&await t.forget(!1)}export{ne as Context,Kt as CookieTransitionDataStore,Jr as EdgeNodeTagName,Ht as EdgeTransitionDataStore,N as GroupCriteriaEvaluator,ot as ManifestInstance,Qt as SERVER_STATE_ID,ue as ScriptType,j as TransitionDataStore,dt as VisitorDataStore,ht as computeAggregateDimensions,vt as cookieEvaluator,se as createConsoleLogDrain,ae as createDebugConsoleLogDrain,er as createLinearDecay,H as emptyVisitorData,Gr as enableConsoleLogDrain,Hr as enableContextDevTools,Qr as enableDebugConsoleLogDrain,Gt as evaluateVariantMatch,xt as eventEvaluator,B as getEnrichmentVectorKey,E as isStringMatch,it as pageViewCountDimension,Dt as pageViewCountEvaluator,bt as pageVisitedEvaluator,$t as personalizeVariations,Ct as queryStringEvaluator,Vt as quirkEvaluator,lt as testVariations};
|