1System.register([],function(f){"use strict";return{execute:function(){const m=()=>typeof window>"u";var E="3.4.3";function ee(){let e=window?.tracking?.visit();if(e)return e;const t=document.cookie.split(";").find(n=>n.trim().startsWith("visit"));return t&&(e=t.split("=")[1].trim()),e}function te(){const e=async r=>await fetch(ne(window.location.hostname),{method:"POST",body:r,headers:{"Content-Type":"application/json"}}),t={},n=Math.random().toString(36).substring(2,15);return{log:async(...r)=>{try{const i=r.reduce((o,s)=>{const c=typeof s=="string"?s:s.message;if(t[c])return o;t[c]=!0;let a={};return typeof s=="string"?a.message=s:a={...s},o.push(a),o},new Array);if(i.length===0)return;await e(JSON.stringify([{common:{attributes:{host:window.location.href,agent:window.navigator.userAgent,serviceName:"ab-reader",visit:ee(),version:E,logtype:"browser",logsId:n}},logs:i}]))}catch(i){console.error("ab-reader failed sending logs",JSON.stringify(i))}}}}function ne(e){let t="https://nrlogger-prod.cf-exp.vpsvc.com?partition=exp";return(e==="localhost"||e.startsWith("staging"))&&(t="https://nrlogger-dev.cf-exp.vpsvc.com?partition=exp"),t}const v=()=>window?.abReader||{getVariation:()=>null,getAllExperiments:()=>[],checkFeature:()=>null,isAvailable:()=>!1,getTestUserId:()=>null,fireImpression:()=>!1,fireFeatureImpression:()=>!1},re=te();let R=()=>{};const ie=e=>{R=e},h="ab-script-loaded",V=(e,t,n=!1)=>
1{if(m())return!1;const r=t?` with experiment key [${t}]`:"";return window.abReaderInitialized?!0:(n||k({message:`Library not initialized before using method ${e}${r}.`}),!1)},w=(e,t,n)=>{try{return e()}catch(r){k({message:`ab-reader library failed when calling ${t}.`,error:JSON.stringify(r)})}return n},rt=f("isAvailable",()=>V("isAvailable")?T():!1),T=()=>w(()=>window.abReader?.isAvailable()??!1,"isAvailable",!1),oe=e=>I("checkFeature",e)?w(()=>v().checkFeature(e),"checkFeature",null):null,se=f("getVariation",e=>I("getVariation",e)?w(()=>v().getVariation(e),"getVariation",null):null),it=f("getAllExperiments",()=>I("getAllExperiments")?w(v().getAllExperiments,"getAllExperiments",[]):[]),ae=f("fireImpression",(e,t,n)=>$(()=>v().fireImpression(e,t,n||null,E),"fireImpression")),ce=f("fireFeatureImpression",(e,t,n)=>$(()=>v().fireFeatureImpression(e,t,n?"true":"false",E),"fireFeatureImpression")),$=(e,t)=>{m()&&k({message:`${t} called serverside. `,error:"Tracking is not available."});const n=()=>w(e,t,!1),r=async()=>{n(),window.removeEventListener(h,r)};return I(t,void 0,!0)?n():(window.abReaderInitialized||R(),window.addEventListener(h,r),!1)},ot=f("getTestUserId",()=>I("getTestUserId")?w(v().getTestUserId,"getTestUserId",null):null),st=f("waitTillAvailable",e=>new Promise(t=>{le(n=>t(!!n),e)})),le=f("whenAvailable",(e,t)=>{if(m()){e(!1);return}if(T()){e(!0);return}let n;const r=new Promise(x=>{n=x}),i=()=>{window.removeEventListener(h,i),T()?n(!0):a()},o=()=>{window.addEventListener(h,i)},s="variationsResolved",c=()=>{window.removeEventListener(s,c),n(!0)},a=()=>{window.addEventListener(s,c)},u=[r];t&&u.push(new Promise(x=>{setTimeout(x,t)})),window.abReader?a():o(),Promise.race(u).then(()=>{e(T())})}),at=f("activate",e=>{const t=se(e);return t&&ae(e,t),t}),ct=f("isFeatureEnabled",e=>{const t=oe(e);return t!==null&&(ce(t.featureName,t.ruleId,t.enabled==="true"),t.enabled==="true")}),I=(e,t,n=!1)=>
1{if(!V(e,t,n))return!1;const r=t?` with experiment key [${t}]`:"";return window.abReader===void 0?(n||k({message:`ab-reader library not ready before using method ${e}${r}.`}),!1):!0},p={logs:[]};function k(e){const t=async()=>{p.logs.length!==0&&(re.log(...p.logs),p.logs=[],p.timeoutId=void 0)};p.logs.push(e),p.timeoutId&&clearTimeout(p.timeoutId),p.timeoutId=window.setTimeout(()=>{t()},1e3)}function S(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ue(e){if(Array.isArray(e))return e}function de(e){if(Array.isArray(e))return S(e)}function fe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function me(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Te(r.key),r)}}function pe(e,t,n){return t&&me(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function ge(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=A(e))||t){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(a){throw a},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. 2In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o,s=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var a=n.next();return s=a.done,a},e:function(a){c=!0,o=a},f:function(){try{s||n.return==null||n.return()}finally{if(c)throw o}}}}function ve(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function we(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,o,s,c=[],a=!0,u=!1;try{if(o=(n=n.call(e)).next,t!==0)for(;!(a=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);a=!0);}catch(x){u=!0,i=x}finally{try{if(!a&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(u)throw i}}return c}}function he(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 3In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ie(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 4In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ye(e,t){return ue(e)||we(e,t)||A(e,t)||he()}function be(e){return de(e)||ve(e)||A(e)||Ie()}function xe(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Te(e){var t=xe(e,"string");return typeof t=="symbol"?t:t+""}function A(e,t){if(e){if(typeof e=="string")return S(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?S(e,t):void 0}}var ke=function(t){var n=document.cookie?document.cookie.split("; "):[],r=ge(n),i;try{for(r.s();!(i=r.n()).done;){var o=i.value,s=o.split("=");if(s[0]===t)return s.slice(1).join("=")}}catch(c){r.e(c)}finally{r.f()}return null},Ee=function(t,n,r){var i=["".concat(t,"=").concat(n)].concat(be(Object.entries(r||{}).map(function(o){var s=ye(o,2),c=s[0],a=s[1];return"".concat(c,"=").concat(a)})));document.cookie=i.join("; ")};const l=[];for(let e=0;e<256;++e)l.push((e+256).toString(16).slice(1));function Se(e,t=0){return(l[e[t+0]]+l[e[t+1]]+l[e[t+2]]+l[e[t+3]]+"-"+l[e[t+4]]+l[e[t+5]]+"-"+l[e[t+6]]+l[e[t+7]]+"-"+l[e[t+8]]+l[e[t+9]]+"-"+l[e[t+10]]+l[e[t+11]]+l[e[t+12]]+l[e[t+13]]+l[e[t+14]]+l[e[t+15]]).toLowerCase()}let _;const Ae=new Uint8Array(16);function _e(){if(!_){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");_=crypto.getRandomValues.bind(crypto)}return _(Ae)}var N={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Ue(e,t,n){if(N.randomUUID&&!e)return N.randomUUID();e=e||{};const r=e.random??e.rng?.()??_e();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=r[6]&15|64,r[8]=r[8]&63|128,Se(r)}var j="testUserId",Ce=function(){function e(){fe(this,e)}return pe(e,[{key:"ensureUserTestId",value:function(){var n=this.getUserIdFromCookie(j);return n||(n=this.setNewUserIdCookie()),n}},{key:"getUserIdFromCookie",value:function(n){var r=ke(n);if(r)return r}},{key:"setNewUserIdCookie",value:function(){var n={"max-age":15552e3,path:"/"},r=Ue();return Ee(j,r,n),r}}]),e}(),Oe=new Ce,y=function(){return Oe.ensureUserTestId()},b={},P;function Le(){if(P)return b;
4P=1,Object.defineProperty(b,"__esModule",{value:!0}),b.isBot=void 0;var e=/bot|crawl|spider|AutoIt|requests|microsoft office|CFNetwork|Scrapy|k6\.io|vp-digital-image-processor|feed|facebookexternal|github\.com/i,t=function(n){return n?e.test(n):!1};return b.isBot=t,b}var Fe=Le();const D="expCtx",Re="expFlagCtx",z="expIsQA",B="exp-ab-impression-v2",Ve="expCtxInit",H=12e4,$e=6e5,M=21e3,g={experiments:new Map([]),features:new Map([])},J=()=>{if(m())return!1;const e=window.location.search?.includes("exp_param_ignore");return e&&console.debug("(exp_param_ignore) Bypass experimentation"),e},Ne=()=>window.location.hostname?.endsWith("proshopnext.com")||window.location.hostname?.endsWith("ourproshop.com"),je=()=>{if(m()||!["localhost","127.0.0.1"].includes(window.location.hostname))return;const e=window.location.search,t="exp_e_",n="exp_f_";(e?.includes(t)||e?.includes(n))&&new URLSearchParams(e).forEach((o,s)=>{s.startsWith(t)&&g.experiments.set(s.replace(t,""),o),s.startsWith(n)&&g.features.set(s.replace(n,""),o)})},W=(()=>{if(m())return null;const e="overrideInitTimeout";if(window.location.search?.includes(e)){console.debug(`(${e}) Override init timeout`);const n=new URLSearchParams(window.location.search);return parseInt(n.get(e)||"")}return null})()||60*60*1e3,U=e=>localStorage.getItem(e)||"";function C(e){const t=document.cookie.split(";");for(const n of t){const[r,i]=n.trim().split("=");if(r===e)return i}return null}const d=(e,t)=>{console.warn(`AB reader failed in ${e}`,t)},q=()=>{try{if(J()||!L())return[];const e=U(D);if(e){const t=X(e,"|",We);return g.experiments.forEach((n,r)=>{let i=!1;t.forEach(o=>{o.experimentKey===r&&(i=!0,o.variationKey=n)}),i||t.push({experimentKey:r,variationKey:n})}),t}}catch(e){d("getAllExperiments",e)}return[]},Pe=e=>{try{const t=g.experiments.get(e);if(t)return t;const r=q().find(i=>i.experimentKey===e);return r?r.variationKey:null}catch(t){return d("getVariation",t),null}},De=()=>{try{if(J()||!L())return[];const e=U(Re);if(e)return X(e,"|",qe)}catch(e){d("getAllFeatures",e)}return[]},ze=e=>{try{const t=g.features.get(e);return t?{enabled:t,featureName:e,ruleId:"override"}:De().find(i=>i.featureName===e)??null}catch(t){return d("getVariation",t),null}},O=()=>{try{return F()||g.experiments.size>0||g.features.size>0?!0:!!U(D)}catch(e){return d("isAvailable",e),!1}},Be=e=>{e(O())},He=()=>y();function Me(e,t,n,r){if(!e||!t)return d("fireImpression",`Invalid input parameters for the fireImpression ${JSON.stringify({experimentKey:e,variationKey:t})}`),!1;let i={experimentName:e,variationName:t,impressionEventVersion:3,abReaderVersion:r||"3"};n&&(n.pageName&&n.pageSection&&n.pageStage?i={...i,pageName:n.pageName,pageSection:n.pageSection,pageStage:n.pageStage}:d("fireImpression","Page parameters format is wrong"));try{if(Y(e,t))return!1;const o=C(z)==="1";return Z("Experiment Viewed",i),G(e,t,o?M:H),!0}catch(o){return d("fireImpression",o),!1}}function Je(e,t,n,r){if(!e||!t||!n)return d("fireImpression",`Invalid input parameters for the fireFeatureImpression ${JSON.stringify({featureName:e,ruleId:t,enabled:n})}`),!1;try{if(Y(e,n)||t==="disabled")return!1;const i={flagName:e,passes:n==="true",ruleId:t,abReaderVersion:r||"3"},o=C(z)==="1";return Z("Experiment Flag Viewed",i),G(e,n,o?M:$e),!0}catch(i){return d("fireFeatureImpression",i),!1}}const X=(e,t,n)=>{const r=[],i=new Set,o=e.split("~");return o!==null&&o.length===2&&o[1].split(t).forEach(a=>{const u=n(a);u?.key&&(i.has(u.key)?console.debug(`Exp: context has more than one instance of key ${u.key}`,e):(i.add(u.key),r.push(u.entry)))}),r},We=e=>{const t=e.split(":");return t.length!=2?(console.debug("Exp context is malformed: ",e),null):{key:t[0].trim(),entry:{experimentKey:t[0].trim(),variationKey:t[1].trim()}}},qe=e=>{const t=e.split("^");return t.length!=3?(console.debug("Features context is malformed: ",e),null):{key:t[0].trim(),entry:{featureName:t[0].trim(),ruleId:t[1].trim(),ruleName:t[1].trim(),enabled:t[2].trim()}}},Xe=()=>{try{const e=document.getElementById("ubik-user-context");if(!e?.innerText)return;const t=JSON.parse(e.innerText);return t?.tenant??t?.Tenant}catch{return}},Qe=["localhost","127.0.0.1"],Ke="vistaprint",Ye="vp-experimentation-tenant",Ge=/(^|\/)experimentation(\/|$)/,Ze=()=>{if(Ge.test(window.location.pathname))return C(Ye)??void 0},et=async()=>{const e=Xe();if(e)return e;const t=Ze();if(t)return t;const n=window.location.hostname;if(Qe.includes(n))return Ke;try{const r=window.location.pathname,i=await fetch(`https://api.experience.cimpress.io/tenants/v1/resolve?domain=${encodeURIComponent(n)}&path=${encodeURIComponent(r)}`);return i.ok?(await i.json())?.tenant:void 0}catch{return}},Q=async()=>{try{const e=y(),t=Date.now(),n=await et(),r=n?`&tenant=${n}`:"";(await(await fetch(`https://context-init-prod.cf-exp.vpsvc.com/?requestUrl=${encodeURIComponent(window.location.origin)}&testUserId=${e}&expIsClientSide=1${r}
4`)).json()).forEach(s=>{if(s.destination==="client"&&s.name==="Set-Cookie"&&(document.cookie=s.value),s.destination==="client"&&s.name==="Add-Script"){const c=/localStorage\.setItem\(\s*"(?<key>\w+)"\s*,\s*"(?<value>[^\s]+)"\s*\)/g;let a=null,u=5;do a=c.exec(s.value)?.groups,a?.key&&localStorage.setItem(a.key,a.value);while(a!=null&&--u>0)}}),window.dispatchEvent(new Event("variationsResolved")),localStorage.setItem("expCtxInit",JSON.stringify({testUserId:e,timestamp:t}))}catch{console.warn("Experiment conext initialization failed")}};function K(){const e={testUserId:y(),experimentsV2:{}};try{const t=JSON.parse(localStorage.getItem(B)||"{}");if(t&&t.testUserId===y()){const n=new Date().getTime();return t.experimentsV2=Object.entries(t.experimentsV2||{}).reduce((r,[i,o])=>(o._ttl>n&&(r[i]=o),r),{}),t}}catch(t){d("fireImpression",t)}return e}function Y(e,t){return K().experimentsV2[e]?.variation===t}function G(e,t,n=H){const r=K();r.experimentsV2[e]={variation:t,_ttl:new Date().getTime()+n},localStorage.setItem(B,JSON.stringify(r))}function Z(e,t){if(window?.tracking?.track)n();else{const r=new Date().getTime();window.addEventListener("trackingReady",function(){n(new Date().getTime()-r)})}function n(r){if(!window?.tracking?.track){console.debug("ab-reader: tracking still not available");return}t.trackingDelay=r??0,window.tracking.track(e,t)}}function L(){try{if(F())return!0;const e=localStorage.getItem(Ve);if(!e)return console.debug("ab-reader: unknown context init details"),!0;const t=JSON.parse(e);return y()!==t.testUserId?(console.debug("ab-reader: mismatched user id"),!1):Date.now()-t.timestamp>W?(console.debug("ab-reader: stale context"),!1):!0}catch(e){return d("isValidContext",e),!1}}const F=()=>m()?!1:Fe.isBot(window.navigator?.userAgent);(function(){!m()&&!Ne()&&(je(),setTimeout(()=>{window.abReaderInitialized=!0,F()||setInterval(()=>{Q()},W),(!O()||!L())&&Q()},200))})();var tt=Object.freeze({__proto__:null,checkFeature:ze,fireFeatureImpression:Je,fireImpression:Me,getAllExperiments:q,getTestUserId:He,getVariation:Pe,isAvailable:O,whenAvailable:Be});const nt=f("initialize",()=>{m()||window.abReaderInitialized||(window.abReader=tt,window.dispatchEvent(new CustomEvent(h)),window.abReaderInitialized=!0)});ie(nt)}}}); 5//# sourceMappingURL=ab-reader-t4lDYyQd.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.