/*! web-client-bundle - v26.311.1514 - 2026-03-11 15:14:49 */ !function(){"use strict";const t=new Uint8Array([253,180,226,228,182,131,164,73,141,178,202,137,200,81,43,173,208,100,102,229,162,194,214,9,148,199,135,170,57,197,223,156,41,136,4,3,200,178,57,54,79,131,168,59,80,48,151,24,111,215,97,188,3,100,184,187,143,96,25,143,91,187,182,121,46,176,255,38,139,12,82,107,216,149,245,153,113,26,77,70,155,37,20,159,213,227,12,54,198,7,102,254,180,157,233,103,108,224,122,161,135,132,159,98,96,106,221,159,175,135,183,248,38,14,184,242,221,2,80,97,177,19,197,160,11,21,138,69,255,196,221,32,195,72,86,174,244,249,80,29,178,45,66,60,200,185,21,20,199,123,246,231,156,7,54,180,77,62,150,53,83,187,200,212,170,186,144,32,46,11,80,201,43,221,218,164,34,213,246,242,147,234,255,192,150,138,97,172,147,163,89,140,237,223,17,113,30,126,111,177,26,215,207,83,32,235,55,207,126,56,8,175,106,135,75,110,166,84,163,208,160,23,244,196,164,19,60,121,99,157,157,28,12,112,139,45,233,57,244,21,52,224,61,0,106,211,66,129,41,115,126,16,126,238,94,11,64,4,144,78,151,133,6,52,172,139,29,179,175,245,248,178,99,170,136,67,233,242,239,132,178,113,20,148,18,186,78,19,232,179,247,69,83,95,58,66,11,92,116,248,117,163,208,250,10,185,184,169,170,128,41,57,53,230,182,253,161,8,167,164,63,35,7,201,231,154,123,94,212,233,72,222,20,134,100,139,232,78,249,164,120,250,87,133,48,142,192,60,210,245,244,231,72,216,234,34,92,73,225,47,111,93,66,44,248,73,44,147,47,132,242,231,45,247,99,64,74,246,255,93,92,234,3,44,218,102,9,119,164,212,133,251,239,62,155,55,70,112,228,48,237,237,104,100,129,1,220,241,60,8,56,56,194,142,24,109,66,193,44,246,111,13,127,127,91,180,118,221,225,218,152,204,50,234,220,14,227,223,164,216,88,211,38,8,226,160,115,83,5,185,161,136,77,233,43,195,103,18,15,6,110,87,216,163,143,58,43,93,68,173,126,70,108,59,22,208,70,164,61,34,43,98,71,160,212,49,209,227,47,83,188,219,171,169,50,49,6,213,153,95,205,190,189,18,9,51,158,184,182,119,235,146,63,214,66,131,195,54,38,138,77,140,129,209,65,120,109,149,44,139,172,132,230,143,36,214,241,54,233,205,161,183,231,126,126,163,43,234,84,6,132,71,220,75,226,72,231,128,148,61,65,144,214,194,252,153,193,24,171,76,213,63,125,115,153,139,88,12,28,161,21,250,101,99,209,146,0,22,230,190,166,203,158,152,247,229,31,105,4,59,211,106,217,130,86,21,196,145,174,253,14,224,171,245,237,6,171,201,92,31,139,135,162,23,17,47,53,11,149,131,85,181,109,78,206,165,223,238,74,236,225,108,200,244,26,95,89,135,192,238,206,65,87,230,226,124,98,201,18,104,83,25,44,204,75,246,83,5,182,167,174,179,171,177,210,66,17,170,205,82,166,91,27,150,165,218,52,30,172,113,135,25,96,41,81,241,175,162,208,158,70,176,47,162,155,189,80,85,171,239,22,48,185,70,128,61,104,199,31,131,177,190,251,46,30,206,60,13,128,53,107,170,50,158,228,132,209,121,33,167,226,23,32,111,16,59,117,145,200,69,75,194,81,63,16,13,113,114,62,98,90,72,151,158,133,131,9,252,216,134,102,173,218,14,19,218,202,186,68,116,34,214,228,204,133,214,233,119,43,196,61,206,153,206,196,33,15,32,206,120,170,160,204,176,205,209,221,186,93,139,159,110,39,85,209,239,91,204,55,207,118,255,124,223,100,22,51,206,197,98,94,248,227,17,125,43,14,246,100,23,93,33,38,137,218,110,31,182,249,22,225,153,56,114,206,190,199,133,69,166,149,157,69,137,179,47,142,181,48,170,127,41,248,22,226,241,168,85,244,228,242,69,72,209,66,71,108,94,226,109,171,118,26,131,19,22,176,13,140,109,58,37,82,14,139,0,154,199,34,245,203,105,56,183,107,8,166,145,213,78,24,77,246,237,86,180,130,39,213,117,25,176,58,90,58,246,157,84,76,172,117,204,148,123,168,79,181,26,35,203,217,196,123,224,224,75,55,250,102,106,10,127,201,141,155,223,205,199,148,178,135,46,216,22,23,189,112,19,75,56,149,184,58,49,221,181,25,121,73,219,61,149,175,186,206,191,200,199,154,237,180,163,82,255,99,84,50,115,244,116,35,205,68,187,58,117,246,52,236,127,220,186,110,28,69,236,185,120,210,69,86,103,22,177,56,227,250,117,71,116,16,9,39,72,102,196,248,136,165,175,152,77,246,178,57,26,193,174,229,209,164,234,100,111,35,219,220,84,115,159,212,225,12,98,23,204,4,112,10,22,223,105,95,173,135,76,153,71,250,125,22,132,186,149,121,131,44,73,19,190,160,24,40,136,10,11,233,33,140,161,227,149,34,220,94,132,168,155,187,115,15,199,16,56,223,107,43,213,250,240,124,86,71,51,113,222,203,11,165,53,22,223,209,69,2,236,115,81,51,12,99,146,22,53,205,68,114,75,89,199,217,164,99,58,46,144,118,188,102,80,127,38,16,5,81,133,3,20,234,175,115,193,125,137,219,238,22,153,103,49,191,14,131,224,70,221,101,112,104,72,65,188,36,227,79,196,133,173,98,20,1,69,114,174,40,15,30,171,179,18,222,241,225,119,153,2,253,26,142,60,91,147,240,218,141,249,8,164,192,14,255,211,150,216,253,62,35,3,229,112,199,125,141,105,148,45,153,22,98,202,202,62,19,164,189,41,248,51,186,198,138,131,218,17,244,72,182,253,23,160,229,146,72,13,100,247,165,248,193,55,199,120,210,152,222,2,58,196,160,103,129,7,140,232,41,154,177,13,160,124,10,115,23,160,198,35,181,203,77,248,192,62,51,220,54,113,135,190,235,51,47,64,159,150,57,135,17,128,160,190,70,76,88,47,8,57,0,219,150,1,50,27,107,153,20]);function e(t){const e=(new TextEncoder).encode(t);let n=2166136261;for(let t=0;t>>0}const n=(t,e)=>`${t}_${e}_salt`,s=(t,e=200)=>t.length<=e?t:`${t.substring(0,e)}...`;let o=!1;try{((t,e)=>{const n=new Set,o=[];try{const e=t.top?.location.hostname;e&&n.add(e)}catch(t){const e=t;o.push(s(e.message))}try{n.add(t.location.hostname)}catch(t){const e=t;o.push(s(e.message))}try{const e=t.location.href;n.add(new URL(e).hostname)}catch(t){const e=t;o.push(s(e.message))}try{const t=e.URL;n.add(new URL(t).hostname)}catch(t){const e=t;o.push(s(e.message))}if(0===n.size)throw new Error(`Unable to determine hostname: ${JSON.stringify(o)}`);return n})(window,document).forEach((s=>{o||(o=((t,s)=>{for(let o=0;o<14;o++){const a=e(n(t,o))%10837,r=a%8;if(!(s[Math.floor(a/8)]&1<{const e=this.globalContext.document.cookie.split("; ").reduce(((e,n)=>{const o=n.split("=");return o[0]===t?decodeURIComponent(o.slice(1).join("=")):e}),"");return e.length>0?e:null},this.removeItem=(t,e="/")=>{this.setItem(t,"",0,e)},this.setItem=(t,e,n,o="/")=>{const a=new Date(n);if(!this.isValidDate(a))throw new Error("Invalid expiration date");this.globalContext.document.cookie=`${t}=${e}; expires=${a.toUTCString()}; path=${o};`},this.globalContext=t}isValidDate(t){return t instanceof Date&&!isNaN(t)}}const u=["scope/objectName",t,e];function p(t){return null===t||"object"!=typeof t?t:t instanceof Date?new Date(t.getTime()):t instanceof Array?t.reduce(((t,e)=>(t.push(p(e)),t)),[]):t instanceof Set?Array.from(t.values()).reduce(((t,e)=>(t.add(p(e)),t)),new Set):t instanceof Map?Array.from(t.entries()).reduce(((t,e)=>(t.set(e[0],p(e[1])),t)),new Map):t instanceof Object?Object.keys(t).reduce(((e,n)=>(e[n]=p(t[n]),e)),{}):t}class m{constructor(t,e){const n=e.rootName;this.globalContext=e.globalContext;const o=this.globalContext[n].get(t);if(null==o)throw new Error(`Missing "${t}" account in userspace object`);this.id=t,this.store=o.store,this.queue=o.queue,this.store.has("listeners")||this.store.set("listeners",new Map)}async record(t,e){return await new Promise(((n,o)=>{this.queue.push(new CustomEvent(t,{detail:{resolve:n,reject:o,source:i.internal,...e}}))}))}async recordListener(t,e){return await new Promise(((n,o)=>{this.queue.push(new CustomEvent(t.name,{detail:{resolve:n,reject:o,source:i.internal,...e}}))}))}recordListenerNonBlocking(t,e){this.recordListener(t,e).catch((t=>{}))}read(t,e){const n=this.store.get(t);if(void 0!==n)return n;if(void 0!==e?.persist&&e.persist){const n=this.readLocalStorage(t,{usePrefix:!0,throwOnDisallowed:e.throwOnDisallowed});if(void 0!==n)return n}const o=e?.default?.generators?.get(t);return void 0!==o?o(...e?.default?.args??[]):void 0}write(t,e,n){this.store.set(t,e),void 0!==n?.persist&&n.persist&&this.writeLocalStorage(t,e,{usePrefix:!0,throwOnDisallowed:n.throwOnDisallowed})}use(t,e){let n;const o=this.store.get(t.key);if(void 0!==o)n=o;else if(void 0!==e?.persist&&e.persist){const o=this.readLocalStorage(t.key,{usePrefix:!0,throwOnDisallowed:e.throwOnDisallowed});null!=o&&(n=o)}const a=n??t.default;if("function"==typeof a||!1===e?.structuredClone)return a;try{return structuredClone(a)}catch(t){try{return p(a)}catch(t){return ht.logCoreError({id:"Core.library.Account.use",account:null,error:t}),a}}}update(t,e,n){let o=e(this.use(t,{...n,throwOnDisallowed:n?.throwOnDisallowed}));if(void 0!==t.postProcessor&&(o=t.postProcessor(o)),this.store.set(t.key,o),void 0!==n?.persist&&n.persist){if("string"!=typeof o)throw new Error(`${JSON.stringify(o)} must be a string to be writtable to browser storage`);this.writeLocalStorage(t.key,o,{usePrefix:!0,throwOnDisallowed:n.throwOnDisallowed})}}delete(t,e){this.store.delete(t),void 0!==e?.persist&&e.persist&&this.deleteLocalStorage(t,{usePrefix:!0,throwOnDisallowed:e.throwOnDisallowed})}remove(t,e){this.store.delete(t.key),void 0!==e?.persist&&e.persist&&this.deleteLocalStorage(t.key,{usePrefix:!0,throwOnDisallowed:e.throwOnDisallowed})}executeFuncWithConsent(t,e){if(!this.isAllowedToAccessInfoOnDevice())throw new Error("Invalid consent. API requires consent before execution.");return e.apply(t)}recordErrorEvent(t){ht.logError({...t,account:this})}recordStatusChangeEvent(t){ht.logFeature({id:t.id,account:this,feature:t.status,analyticsSampleRateAdjustFactor:t.analyticsSampleRateAdjustFactor,props:{...t.props}})}recordGenericEvent(t){ht.logFeature({id:t.id,account:this,feature:t.id,analyticsSampleRateAdjustFactor:t.analyticsSampleRateAdjustFactor,props:{...t.props}})}isAllowedToAccessInfoOnDevice(){return this.updateUserConsent(),this.use(d)}isAPStagAllowedToAccessInfoOnDevice(){return!0===this.globalContext.apstag._atsaaiod()}updateUserConsent(){try{const t=this.isAPStagAllowedToAccessInfoOnDevice();this.update(d,(()=>t))}catch(t){}}getPersistedItemName(t){return`aps:${this.id}:${t}`}isBrowserStorageAllowed(t){let e=!1;try{e=this.isAllowedToAccessInfoOnDevice()}catch{}return e||u.includes(t)}setCookieStorage(t,e,n,o){const a=o?.throwOnDisallowed??!0;if(!this.isBrowserStorageAllowed(t)){if(a)throw new Error(`${t} is not allowed to be set on cookie storage`);return}const i=o?.usePrefix?this.getPersistedItemName(t):t;return new l(this.globalContext).setItem(i,e,n,o?.path??"/")}readCookieStorage(t,e){const n=e?.throwOnDisallowed??!0;if(!this.isBrowserStorageAllowed(t)){if(n)throw new Error(`${t} is not allowed to be read from cookie storage`);return}const o=e?.usePrefix?this.getPersistedItemName(t):t;return new l(this.globalContext).getItem(o)}readLocalStorage(t,e){const n=e?.throwOnDisallowed??!0;if(!this.isBrowserStorageAllowed(t)){if(n)throw new Error(`${t} is not allowed to be read from browser storage`);return}const o=e?.usePrefix?this.getPersistedItemName(t):t;return this.globalContext.localStorage.getItem(o)??void 0}writeLocalStorage(t,e,n){const o=n?.throwOnDisallowed??!0;if(!this.isBrowserStorageAllowed(t)){if(o)throw new Error(`${t} is not allowed to be written to browser storage`);return}if("string"!=typeof e)throw new Error(`${JSON.stringify(e)} must be a string to be writtable to browser storage`);const a=n?.usePrefix?this.getPersistedItemName(t):t;this.globalContext.localStorage.setItem(a,e)}deleteLocalStorage(t,e){const n=e?.throwOnDisallowed??!0;if(!this.isBrowserStorageAllowed(t)){if(n)throw new Error(`${t} is not allowed to be touched/deleted in browser storage`);return}const o=e?.usePrefix?this.getPersistedItemName(t):t;this.globalContext.localStorage.removeItem(o)}readSessionStorage(t,e){const n=e?.throwOnDisallowed??!0;if(!this.isBrowserStorageAllowed(t)){if(n)throw new Error(`${t} is not allowed to be read from browser storage`);return}const o=e?.usePrefix?this.getPersistedItemName(t):t;if(o in this.globalContext.sessionStorage)return this.globalContext.sessionStorage.getItem(o)}writeSessionStorage(t,e,n){const o=n?.throwOnDisallowed??!0;if(!this.isBrowserStorageAllowed(t)){if(o)throw new Error(`${t} is not allowed to be written to browser storage`);return}if("string"!=typeof e)throw new Error(`${JSON.stringify(e)} must be a string to be writable to browser storage`);const a=n?.usePrefix?this.getPersistedItemName(t):t;this.globalContext.sessionStorage.setItem(a,e)}deleteSessionStorage(t,e){const n=e?.throwOnDisallowed??!0;if(!this.isBrowserStorageAllowed(t)){if(n)throw new Error(`${t} is not allowed to be touched/deleted in browser storage`);return}const o=e?.usePrefix?this.getPersistedItemName(t):t;this.globalContext.sessionStorage.removeItem(o)}}const f="_system";class h extends m{constructor(t,e){super(f,{globalContext:t,rootName:e})}}const v="listeners",y="_internal/history",g="_internal/pageLoadID",w="_internal/externalEventCount";class b{constructor(t,e,n){this.globalContext=t,this.rootName=e,this.dispatcher=n}getAccounts(){return this.globalContext[this.rootName]}createUserspaceRoot(){null==this.getAccounts()&&(this.globalContext[this.rootName]=new Map)}createSystemAccount(){!1===this.getAccounts().has(f)&&(this.getAccounts().set(f,{queue:[],store:new Map}),new h(this.globalContext,this.rootName).store.set(g,Math.random()))}observeRootSet(){const t=this;this.getAccounts().set=function(e,n){Map.prototype.set.apply(this,[e,n]),t.equip()}}observeAccountQueuesPush(){const t=this;this.getAccounts().forEach((e=>{e.queue.push=function(...e){Array.prototype.push.apply(this,e),t.dispatcher.t({reason:{method:a.push,events:e}})}}))}overwriteAccountStoresGet(){this.getAccounts().forEach((t=>{t.store.get=function(...t){return Map.prototype.get.apply(this,t)}}))}defineConvenienceFunctions(){const t=(t,e,n)=>{const o=this.getAccounts().get(t);void 0!==o&&o.queue.push(new CustomEvent(e,{detail:n??{}}))},e=this.globalContext[this.rootName];e.triggerFor=t,e.trigger=(e,n)=>{t(f,e,n)},void 0===e._private&&(e._private={}),e._private.CookieStorage=l}equip(){try{this.createUserspaceRoot(),this.createSystemAccount(),this.observeRootSet(),this.observeAccountQueuesPush(),this.overwriteAccountStoresGet(),this.defineConvenienceFunctions()}catch(t){throw new h(this.globalContext,this.rootName).recordErrorEvent({id:"Core.library.Equiper.equip",error:t}),t}}}var E;!function(t){t.info="info",t.warn="warn",t.error="error"}(E||(E={}));class S{static Instance(){return this.o}static SessionId(){return this.i}info(...t){const e=new Date(Date.now()),n=E.info;return console.log(this.getPrefix(e,n),...t),{timestamp:e,logLevel:n}}warn(...t){const e=new Date(Date.now()),n=E.warn;return console.warn(this.getPrefix(e,n),...t),{timestamp:e,logLevel:n}}error(...t){const e=new Date(Date.now()),n=E.error;return console.error(this.getPrefix(e,n),...t),{timestamp:e,logLevel:n}}getPrefix(t,e){return`${t.toISOString()} | ${S.SessionId()} | [${e.toUpperCase()}]`}}S.o=new S,S.i=`${Date.now()}`;const x=S.Instance(),_="26.311.1514",R=t=>{let e,n=window;do{try{const e=n?.location?.hostname;if(e&&t(e))return!0}catch(t){if(!(t instanceof DOMException&&"SecurityError"===t.name||t instanceof Error&&t.message.includes("cross-origin frame")))throw t;if(Math.random()<.001)throw t}if(n===window.top)break;e=n,n=n.parent}while(e!==n&&e!==window.top);return!1},A=t=>void 0===t||!Array.isArray(t)||R((e=>t.includes(e))),I=t=>void 0===t||!Array.isArray(t)||R((e=>t.some((t=>((t,e)=>{const n=(t=>t?t.toLowerCase().trim().replace(/^www\./,""):"")(t);return n===e})(e,t)))));function j(t){return!(t>=1||Number.isNaN(t))&&(t<=0||Math.random()>=t)}function k(){try{return!!new URLSearchParams(window.top?.location.search??window.location.search).has("apscoredebug")||(window._aps?.get("_system").store.get("_internal/coreDebugMode")??!1)}catch{return!1}}const $={key:"_internal/eventSources",default:new Map},C={key:"_internal/processedEventSources",default:new Set},O=[c.completed,c.error,c.cancelled,c.analytics];class P{constructor(t,e){this.globalContext=t,this.rootName=e}l(t){return t.store.get("_config/events/deactivations")??new Set}p(t,e){return!0===this.l(t).has(e.type)||((t,e)=>{try{const e=t.detail?.restrictions?.allow?.hostnames;if(void 0!==e&&!A(e))return!0;const n=t.detail?.restrictions?.block?.hostnames;if(void 0!==n&&A(n))return!0}catch(t){return e.recordErrorEvent({id:"hostnames",error:new Error(t)}),!1}return!1})(e,t)||((t,e)=>{try{const e=t.detail?.restrictions?.allow?.dtbHostnames;if(void 0!==e&&!I(e))return!0;const n=t.detail?.restrictions?.block?.dtbHostnames;if(void 0!==n&&I(n))return!0}catch(t){return e.recordErrorEvent({id:"dtbHostnames",error:new Error(t)}),!1}return!1})(e,t)||(t=>{const e=t?.detail?.restrictions?.allow?.libraryVersions,n=t?.detail?.restrictions?.block?.libraryVersions;return!(!Array.isArray(n)||!n.includes(_))||!(!Array.isArray(e)||e.includes(_))})(e)||((t,e)=>{const n=t?.detail?.restrictions?.allow?.accounts,o=t?.detail?.restrictions?.block?.accounts;return!(!Array.isArray(o)||!o.includes(e.id))||!(!Array.isArray(n)||n.includes(e.id))})(e,t)||((t,e)=>{const n=(t=>{if(!t)return null;const e=Number(t);return!Number.isNaN(e)&&Number.isInteger(e)&&e>=0?o.ManagedWeb:o.SelfServeWeb})(e.id);if(null===n)return!1;const a=t?.detail?.restrictions?.allow?.accountTypes,i=t?.detail?.restrictions?.block?.accountTypes;return!(!Array.isArray(i)||!i.includes(n))||!(!Array.isArray(a)||a.includes(n))})(e,t)||(t=>{const e=t?.detail?.restrictions?.allow?.rate??1;return!(!j(t?.detail?.restrictions?.block?.rate??1)&&!j(e))})(e)}m(){return new h(this.globalContext,this.rootName).store.get(v)??new Map}v(t){return t.store.get("listeners")??new Map}S(t,e){return this.m().get(e.type)||this.v(t).get(e.type)}_(t){const e=this.R(w);return(void 0===t.externalEventCount||t.externalEventCount{setTimeout((()=>n(new Error(`Event "${e.type}" timed out`))),e.detail.timeout)})))}j(t,e){const n=new h(this.globalContext,this.rootName),o=n.read(t)??0;n.write(t,o+e)}$(t){new h(this.globalContext,this.rootName).write(t,0)}R(t){return new h(this.globalContext,this.rootName).read(t)??0}C(t,e,n,o,i){if(!(e in c))throw new Error(`Listener returned invalid status: ${t.type} returned ${e}`);if(this.O(t,e,o,i),e!==c.waiting&&void 0!==t.detail?.resolve)try{t.detail.resolve(n)}catch(t){x.error(t)}this.t({reason:{method:a.listenerSuccess,events:[t]}})}P(t,e,n){void 0!==e&&"string"!=typeof e||(e=new Error(e)),this.O(t,c.error,n),this.D(t,e),e.context=t.type,n.recordErrorEvent({id:t.type,analyticsSampleRateAdjustFactor:t.detail?.analyticsSampleRateAdjustFactor,error:e})}T(t,e,n,o){const a=this.S(n,e);if(void 0===a)throw new Error(`No listener found for event: ${e.type}`);t.push(a({customEvent:e,account:n,systemAccount:o,detail:e.detail,context:n.globalContext}))}N(t,e,n){Promise.race(t).then((t=>{let o,a,i;void 0===t?o=s.completed:"string"==typeof t?o=t:"object"==typeof t&&(o=t.status,a=t.value,i=t.analytics,!0===e.detail?.surfaceAnalytics&&(void 0===a&&(a={}),a.analytics=i)),this.C(e,o,a,n,i)})).catch((t=>{this.P(e,t,n)}))}L(t,e,n){const o=[];this.T(o,t,e,n),this.I(o,t),this.N(o,t,e)}M(t,e){if(void 0!==t.status)return;const n=t.detail?.error;if(void 0!==n){t.status=c.error;const o=this.U(n),a={id:t.type,analyticsSampleRateAdjustFactor:t.detail?.analyticsSampleRateAdjustFactor,error:o,props:{...t.detail.analytics,eventDetailSource:t.detail.source}};"string"==typeof t.detail.libraryVersion&&(a.libraryVersion=t.detail.libraryVersion),e.recordErrorEvent(a)}}U(t){let e;if(t instanceof Error)e=t;else if("string"==typeof t)e=new Error(t);else if("object"==typeof t&&null!==t){let n="Error object";if("message"in t&&"string"==typeof t.message)n=t.message;else if("error"in t&&"string"==typeof t.error)n=t.error;else try{n=JSON.stringify(t),n.length>500&&(n=n.substring(0,497)+"...")}catch{n=`Complex error object of type ${t.constructor?.name||"unknown"}`}e=new Error(n),e.originalError=t}else e=new Error(`Error value: ${String(t)}`);return e}q(t,e){if(void 0!==t.status)return;const n=t.detail?.analytics;void 0!==n&&(t.status=c.analytics,e.recordStatusChangeEvent({id:t.type,status:t.status,analyticsSampleRateAdjustFactor:t.detail?.analyticsSampleRateAdjustFactor,props:{...n}}))}V(t,e){this.p(e,t)&&this.O(t,c.deactivated,e)}F(t,e){void 0===t.status&&void 0===this.S(e,t)&&this.O(t,c.unknown,e)}D(t,e){if(k()&&x.error(e),void 0!==t.detail?.reject)try{t.detail.reject(e)}catch(t){x.error(t)}}B(t,e){const n=new Error(`Invalid account ID: "${e.id}"`);this.P(t,n,e)}static J(t){return"string"==typeof t&&!["","undefined","true","false"].includes(t.trim())}H(t,e,n){P.J(e.id)?(this.M(t,e),this.q(t,e),this.F(t,e),this.V(t,e),this.A(t)&&(this.O(t,c.started,e),k()&&x.info(`## Execute event: ${t.type} with initial status ${t.status??"undefined"}`),this.L(t,e,n))):this.B(t,e)}G(t){const e=new h(this.globalContext,this.rootName).use($),n=t.use(C);e.forEach(((e,o)=>{if(n.has(o))return;const a=e.map((([t,e])=>new CustomEvent(t,{detail:e})));t.queue.unshift(...a),t.update(C,(t=>t.add(o)))}))}K(t,e,n){this.G(t),t.queue.forEach((n=>this.H(n,t,e)))}W(t,e){t.status=e,t.statusEvents=null!=t.statusEvents?t.statusEvents:[],t.statusEvents.push(new CustomEvent(e))}Y(t,e,n,o){const a=new CustomEvent("now").timeStamp,i=t.statusEvents?.find((t=>t.type===c.started)),s=null!=i?a-i.timeStamp:void 0;n.recordStatusChangeEvent({id:t.type,status:e,analyticsSampleRateAdjustFactor:t.detail?.analyticsSampleRateAdjustFactor,props:{...o,source:t.detail?.source,timers:{sinceCreated:a-t.timeStamp,sinceStarted:s}}})}O(t,e,n,o){t.status!==e&&(k()&&x.info(`### Update ${t.type} from ${t.status??"undefined"} to ${e}`),this.W(t,e),this.Y(t,e,n,o))}Z(){const t=new Map;return this.globalContext[this.rootName].forEach(((e,n)=>t.set(n,new m(n,{globalContext:this.globalContext,rootName:this.rootName})))),t}X(t){if(k())return;const e=t.store.get(y)??[];if(e.length>150){const n=e.slice(-100);t.store.set(y,n)}}tt(t){const e=t.store.get(y)??[];e.push(...t.queue.filter((t=>void 0!==t.status&&O.includes(t.status)))),t.store.set(y,e)}et(t){t.queue.splice(0,t.queue.length,...t.queue.filter((t=>void 0===t.status||!O.includes(t.status))))}nt(){this.Z().forEach((t=>{this.tt(t),this.X(t),this.et(t)}))}ot(t){return t?.filter((t=>t.detail?.source!==i.internal&&t.detail?.source!==i.apstag&&t.status!==c.waiting))}it(t){const e=this.ot(t);return e?.length??0}st(t){const e=this.it(t);this.j(w,e)}rt(){const t="_internal/recentDispatches";this.j(t,1);const e=this.R(t);if(e>1e4)throw new Error("Too many dispatches. Aborting");e%100==0&&new h(this.globalContext,this.rootName).recordGenericEvent({id:"C.l.D.thr",props:{recentDispatchesCount:e}}),setTimeout((()=>{this.$(t)}),100)}t({reason:t}){try{this.rt(),k()&&x.info(`# Dispatch from method "${t.method}" on event "${t.events?.[0].type??"undefined"}" with source "${t.events?.[0].detail?.source??"undefined"}"\n_________________________________________`),this.st(t.events);const e=new h(this.globalContext,this.rootName);this.Z().forEach((n=>this.K(n,e,t))),this.nt()}catch(t){throw new h(this.globalContext,this.rootName).recordErrorEvent({id:"C.l.D.dis",error:t}),t}}}class D{constructor(t,e){this.globalContext=t,this.rootName=e}subscribe(t){try{const e=new h(this.globalContext,this.rootName),n=null!=e.store.get(v)?e.store.get(v):new Map;e.store.set(v,new Map([...n,...t]))}catch(t){throw new h(this.globalContext,this.rootName).recordErrorEvent({id:"Core.library.Subscriber.subscribe",error:t}),t}}}class T{constructor(t,e){this.globalContext=t,this.rootName=e}populate(){try{const t=new h(this.globalContext,this.rootName);let e=!1;try{e=JSON.parse(t.read(n))}catch{}if(e)return;t.write(n,JSON.stringify(!0)),this.populateFromPrependStore(),this.populateFromQueryParams()}catch(t){new h(this.globalContext,this.rootName).recordErrorEvent({id:"Core.library.Populator.populate",error:t})}}populateFromPrependStore(){this.globalContext[this.rootName].forEach(((t,n)=>{const o=new m(n,{globalContext:this.globalContext,rootName:this.rootName}),a=o.read(e,{persist:!0})??"[]";o.write(e,JSON.stringify([]));try{const t=JSON.parse(a);if(0===t.length)return;o.queue.push(...t.map(L))}catch(t){console.error("Error processing prepended events",t)}}))}populateFromQueryParams(){const t=this.globalContext?.location?.search,e=new URLSearchParams(t),n=this.globalContext[this.rootName],o=n.get(f);N(e,"aps.trigger").forEach((t=>{o.queue.push(L(t))})),N(e,"aps.triggerFor",!0).forEach((t=>{void 0!==t.accountId&&n.has(t.accountId)&&n.get(t.accountId).queue.push(L(t))}));const a=N(e,"aps_event");n.forEach((t=>{a.forEach((e=>{t.queue.push(L(e))}))}))}}const N=(t,e,n=!1)=>{const o=t.getAll(e),a=[];return o.forEach((t=>{const e=t.split(",");let o;n&&(o=e.shift());const i=e.shift();if(void 0!==i&&i.length>0){const t=decodeURIComponent(e.join(","));let n;if(t.length>0)try{n=JSON.parse(t)}catch{console.error("Error processing query param event",i,n)}a.push({eventName:i.replace(/_/g,"/"),eventDetail:n,accountId:o})}})),a},L=t=>new CustomEvent(t.eventName,{detail:{...t.eventDetail??{}}}),M=window;class U{constructor(t,e,n){this.ID=t,this.rootName=n,this.globalContext=e,this.clear()}clear(){new h(this.globalContext,this.rootName).update($,(t=>(t.delete(this.ID),t)))}recordListener(t,e){new h(this.globalContext,this.rootName).update($,(n=>{const o=n.get(this.ID);return void 0!==o?o.push([t.name,e]):n.set(this.ID,[[t.name,e]]),n}))}}class q{constructor(t=M,e="_aps"){this.dispatcher=new P(t,e),this.equiper=new b(t,e,this.dispatcher),this.subscriber=new D(t,e),this.populator=new T(t,e),this.globalContext=t,this.rootName=e}createAccount(t){if(void 0===t)throw new Error("accountID must be provided");this.globalContext[this.rootName]=this.globalContext[this.rootName]??new Map;const e=this.globalContext[this.rootName],n={store:new Map,queue:[]};return!1===e.has(t)&&e.set(t,n),new m(t,{globalContext:this.globalContext,rootName:this.rootName})}subscribe(t){this.subscriber.subscribe(t)}equip(){this.equiper.equip()}dispatch({reason:t}){this.dispatcher.t({reason:t})}populate(){this.populator.populate()}load({listeners:t}){this.equip(),this.subscribe(t),this.dispatch({reason:{method:a.direct}}),this.populate()}registerEventSource(t){return this.equip(),new U(t,this.globalContext,this.rootName)}}var V;!function(t){t.postulate="postulate",t.genericError="error"}(V||(V={}));const F="26.311.1514";function B(t,e,n){const o=new URL("https://prod.tahoe-analytics.publishers.advertising.a2z.com/logevent/putRecord");let a=t;try{"web-client-scenarios.aps.amazon.dev"===n?.hostname?a=t+"-debug-only":window.Cypress&&(a=t+"-integration-test")}catch(t){}const i={...n,eventSource:"aps_web_client_library",eventCategory:a,eventName:e,libraryVersion:F};Object.entries(i).forEach((([t,e])=>{o.searchParams.append(t,e)})),fetch(o.toString(),{method:"GET",keepalive:!0,headers:{"x-api-key":"79db72eb0b5c7255afa54a253df24fb4a5ac916bf40b51c730df8850aa5665ca"}}).catch((()=>{}))}const z={ct:setInterval,lt:function(){return window[J]?.[H]},ut:function(t=window){try{return t.top?.location||{href:"unknown",hostname:"unknown"}}catch(t){return{href:"unknown",hostname:"unknown"}}},ft:B,ht:function(t,e){return{eventTime:G((()=>`${Date.now()}`)),accountID:G((()=>t?.accountID)),libraryVersion:F,url:G((()=>e().href)),hostname:G((()=>e().hostname)),message:G((()=>t?.message)),condition:G((()=>t?.condition))}},vt:function(t,e){try{(e??B)(V.genericError,"telemetry_core_failure",{errorName:t?.name??"unknown",errorMessage:t?.message??"unknown"})}catch{(e??B)(V.genericError,"telemetry_core_failure")}}},J="_aps_telemetry",H="alarms";function G(t){try{return t()??"undefined"}catch(t){return function(t){try{return t instanceof Error?`Access Error: ${t.name} - ${t.message}`:"Access Error: Unknown error type"}catch{return"Access Error: Unable to provide more information"}}(t)}}function K(t,e,n){const o=()=>!1;throw n||function(t,e,n){const o=window;void 0===o[J]&&(o[J]={}),void 0===o[J][H]&&(o[J][H]=[]);const a=o[J][H],i=e.toString();a.push({hash:t,context:{...n,condition:i}})}(t,o,e),new Error(e?.message??`Postulate violation: ${t}, ${o}`)}const W=new WeakMap;function Q({debugKey:t,obj:e,validators:n,root:o,separator:a}){o=o??"root",a=a??".";const i={nonModifiable:{set(t,e){throw new Error(`Cannot set property "${String(e)}": "${o}" is not marked as modifiable.`)},deleteProperty(t,e){throw new Error(`Cannot delete property "${String(e)}": "${o}" is not marked as modifiable.`)},defineProperty(t,e){throw new Error(`Cannot define property "${String(e)}": "${o}" is not marked as modifiable.`)},setPrototypeOf(t){throw new Error(`Cannot set prototype: "${o}" is not marked as modifiable.`)}},modifiable:{set(t,e,n,o){try{return Reflect.set(t,e,n,o)}catch(o){if("TypeError"===o.name)return t[e]=n,!0;throw o}}},validating:{get(e,i,s){if("raw"===i)return W.get(s)||e;if("symbol"==typeof i)return Reflect.get(e,i,s);if((t=>{if(["asymmetricMatch","nodeType"].includes(t))return!0})(i))return Reflect.get(e,i,s);let r;try{r=Reflect.get(e,i,s)}catch(t){if("TypeError"!==t.name)throw t;r=e[i]}return Q({obj:r,validators:n,root:`${o}${a}${String(i)}`,debugKey:t})},ownKeys:t=>Reflect.ownKeys(t).filter((t=>{const e=`${o}${a}${String(t)}`;return void 0!==n[e]}))},function:{apply:(e,a,i)=>{const s=W.has(a)?W.get(a):a;return Q({obj:e.apply(s,i),validators:n,root:`${o}()`,debugKey:t})},get:(t,e,n)=>"raw"===e?W.get(n)||t:Reflect.get(t,e,n)}},s=function(a){if(!1===a.verifiable)return e;if(e instanceof Set)return e.forEach((e=>{Q({obj:e,validators:n,root:`${o}.value`,debugKey:t})})),e;if(e instanceof Map)return e.forEach(((e,a)=>{Q({obj:a,validators:n,root:`${o}.key`,debugKey:t}),Q({obj:e,validators:n,root:`${o}.value`,debugKey:t})})),e;if(Array.isArray(e))return e.map((e=>Q({obj:e,validators:n,root:`${o}[]`,debugKey:t})));if("function"==typeof e){const t=new Proxy(e,i.function);return W.set(t,e),t}const s={...i.validating,...a?.modifiable?i.modifiable:i.nonModifiable};try{const t=new Proxy(e,s);return W.set(t,e),t}catch(t){if("TypeError"===t.name)return e;throw t}}(function(){const a=(t??"").length>0?`Location: ${t} - `:"",i=n[o??""];if(void 0===i){const t=".constructor"===(o??"").slice(-12)||".toString"===(o??"").slice(-9);K("ea3914",{message:`${a}Unauthorized usage for "${o}": No validator has been defined`},t)}if(null===i)return{verifiable:!1};let s;try{s=i(e,o)}catch(t){let n="Error, could not convert to string";try{n="string"==typeof e?'"'+e+'"':null!=e&&"function"==typeof e.toString?e.toString():Object.prototype.toString.call(e)}catch(t){}throw new Error(`${a}Validation failed for "${o}": ${t.message} - Received: ${n}`)}return s??{}}());return s}const Y=t=>{if("number"!=typeof t)throw new Error("must be a number")},Z=t=>{if("string"!=typeof t)throw new Error("must be a string")},X=t=>{if("boolean"!=typeof t)throw new Error("must be a boolean")},tt=t=>{if("object"!=typeof t||null===t||Array.isArray(t))throw new Error("must be a standard object")};function et(t){if(void 0!==t?.min&&(t.min<0||t.min>1))throw new Error("min option must be between 0 and 1");if(void 0!==t?.max&&(t.max<0||t.max>1))throw new Error("max option must be between 0 and 1");const e=t?.min??0,n=t?.max??1;if(e>n)throw new Error("min option cannot be greater than max option");return t=>{if("number"!=typeof t)throw new Error("must be a number");if(tn)throw new Error(`must be a percentage between ${e} and ${n} (where 1 = 100%)`)}}const nt=t=>e=>{let n=!1;for(const o of t)try{o(e),n=!0}catch(t){}if(!n)throw new Error("None of the validators passed")},ot=t=>{if(!Array.isArray(t))throw new Error("must be an array")};function at(t){return e=>{if(!1===t.includes(e))throw new Error(`must be one of the following values: ${JSON.stringify(t)}`)}}function it(t){return(e,n)=>({modifiable:!0,...t(e,n)})}function st(t){return(e,n)=>{if(t===ct)throw new Error("isAny cannot be used within isOptional");if(null!=e)return t(e,n)}}const rt=t=>{if("function"!=typeof t)throw new Error("must be a function")},ct=()=>{},dt=()=>({verifiable:!1}),lt=t=>{if(void 0!==t)throw new Error("must be undefined")};class ut{constructor(t){const{scope:e,object:n,action:o,validators:a,handler:i}=t,s=`${e}/${n}/${o}`;this.throwIfInvalid(e,n,o),this.name=`${e}/${n}/${o}`,this.handler=this.wrapHandler({handler:i,validators:a,debugKey:s})}wrapHandler({debugKey:t,handler:e,validators:n}){return async o=>{let a=o;return a={...a,detail:Q({obj:a.customEvent.detail,validators:this.getDetailValidators(n),root:"detail",debugKey:t}),context:Q({obj:a.account.globalContext,validators:this.getContextValidators(n),root:"context",debugKey:t})},await e(a)}}getDetailValidators(t){return t?.detail&&0!==Object.keys(t.detail).length?t.detail:{detail:ct}}getContextValidators(t){return t?.context&&0!==Object.keys(t.context).length?t.context:{context:ct}}throwIfInvalid(t,e,n){if(["consent/gppapi/attemptSync","consent/gppapi/didChange","consent/gppapi/syncData","consent/tcfapi/attemptSync","consent/tcfapi/didChange","log/analytics/setInterval","analytics/sampling/set"].includes(`${t}/${e}/${n}`))return;const o=/^[a-z0-9][a-zA-Z0-9]*$/;if(!o.test(t)||!o.test(e)||!o.test(n))throw new Error(`scope, object, and action must be alphanumeric and start with a lowercase. Received: ${t}, ${e}, ${n}`);if(/[A-Z]/.test(n)&&!/^(will|did)/i.test(n))throw new Error(`action must be a single verb (or a single verb prefixed by 'will' or 'did'). Received: ${n}`)}}function pt(t){if(new Set(t.map((t=>t.name))).size!==t.length)throw new Error("Duplicates found");return new Map(t.map((t=>[t.name,t.handler])))}class mt{constructor(){this.yt=300,this.gt="https://prod.tahoe-analytics.publishers.advertising.a2z.com/logevent/putRecords",this.wt="79db72eb0b5c7255afa54a253df24fb4a5ac916bf40b51c730df8850aa5665ca",this.bt=5e3,this.Et=[],this.clearAndUpdateEventProcessingInterval(5e3)}logEvent(t){try{const n=`${Date.now()}`,o=null==(e=t.eventSampleRate)||isNaN(e)||e<0?0:e>=0&&e<=1?e:1,a={Data:{eventSource:"aps_web_client_library",eventTime:n,eventCategory:t.eventCategory,eventName:t.eventName,eventSampleRate:o,eventProperties:{...t.eventProperties,eventSampleRate:`${o}`}},PartitionKey:n};this.Et.push(a)}catch(t){K("4daf34",{message:t.message})}var e;this.Et.length>this.bt&&this.safelyProcessRecordQueue()}clearAndUpdateEventProcessingInterval(t){"number"!=typeof t||t<=0||t!==this.St&&(clearInterval(this.xt),this.xt=setInterval((()=>this.safelyProcessRecordQueue()),t),this.St=t)}safelyProcessRecordQueue(){if(void 0===this.Et||this.Et.length<=0)return;const t=this.Et.filter((t=>void 0!==t&&t.Data.eventSampleRate>=Math.random()));this.Et.length=0,t.length<=0||this.batchSendRecords(t).catch((t=>{this.logEvent({eventCategory:"error",eventName:"tahoe/putRecords/didFail",eventSampleRate:1,eventProperties:{error:{message:t?.message}}})}))}batchSendRecords(t){const e=[];for(let n=0;nt.map((t=>({...t,Data:window.btoa(JSON.stringify(t.Data))}))))(t)})})}}const ft={key:"_config/requestViewer/countryCode",default:"unknown"},ht=new class{constructor(){this.STACK_MAX_LENGTH=500,this._t=.001,this.Rt=1e-4,this.At=new mt}fireReferencePixel(t){this.logCoreError({id:`REFERENCE-${t}`,error:new Error(`REFERENCE-${t}`),analyticsSampleRateAdjustFactor:{status:.01,error:.01},account:null})}logCoreError(t){this.logError({...t,isCore:!0})}logCoreFeature(t){this.logFeature({...t,isCore:!0})}logError(t){if(void 0===t)return;const e=this.getEventSampleRate({eventCategory:"error",rateFactor:{error:t.analyticsSampleRateAdjustFactor?.error,status:t.analyticsSampleRateAdjustFactor?.status}});this.At.logEvent({eventCategory:"error",eventName:t.id??"unknown",eventSampleRate:e,eventProperties:{...t.props,...this.getSharedEventProperties(t),error:{name:this.getErrorName(t.error),message:this.getErrorMessage(t.error),stack:this.getStackTraceMessage(t.error),context:this.getErrorContext(t.error)}}})}logFeature(t){if(void 0===t)return;const e=this.getEventSampleRate({eventCategory:"feat",rateFactor:{error:t.analyticsSampleRateAdjustFactor?.error,status:t.analyticsSampleRateAdjustFactor?.status}});this.At.logEvent({eventCategory:"feat",eventName:t.id??"unknown",eventSampleRate:e,eventProperties:{...t.props,...this.getSharedEventProperties(t),status:t.feature}})}setEventProcessingInterval(t){if("number"!=typeof t)throw new Error("Event processing interval must be a number.");this.At.clearAndUpdateEventProcessingInterval(t)}setEventSamplingRates(t){const e=t=>t<0?0:t>=0&&t<=1?t:1;"number"==typeof t?.error&&(this._t=e(t.error)),"number"==typeof t?.feature&&(this.Rt=e(t.feature))}getEventSampleRate(t){let e=0;return e="error"===t.eventCategory?this._t*(t.rateFactor?.error??1):this.Rt*(t.rateFactor?.status??1),Number.isNaN(e)||e<0?0:e>=0&&e<=1?e:1}getSharedEventProperties(t){return{isCore:t.isCore??!1,accountID:this.safelyGetAccountID(t.account),libraryVersion:t.libraryVersion??_,url:this.getLocationHref(),hostname:this.getLocationHostname(),viewerCountryCode:this.getViewerCountryCode(t.account)}}safelyGetAccountID(t){let e="unknown";try{void 0!==t?.id&&(e=t.id)}catch(t){try{e=`Client Error: ${t.name.toString()} - ${t.message}`}catch{e="Client Error: Unable to provide more information"}}return e}getLocationHref(){let t="";try{t=window.top?.location?.href??""}catch(e){try{t=`Client Error: ${e.name.toString()} - ${e.message}`}catch{t="Client Error: Unable to provide more information"}}return t}getLocationHostname(){let t="";try{t=window.top?.location?.hostname??""}catch(e){try{t=`Client Error: ${e.name.toString()} - ${e.message}`}catch{t="Client Error: Unable to provide more information"}}return t}getViewerCountryCode(t){let e="unknown";try{null!==t&&(e=t.use(ft))}catch(t){try{e=`Client Error: ${t.name.toString()} - ${t.message}`}catch{e="Client Error: Unable to provide more information"}}return e}getStackTraceMessage(t){try{if("string"==typeof t)return"NO STACK: ERROR PASSED AS STRING";if(void 0===t.stack)return"NO STACK: error.stack IS UNDEFINED";if(t.stack.length>this.STACK_MAX_LENGTH){const e="[...]";return t.stack.substring(0,this.STACK_MAX_LENGTH-e.length)+e}return t.stack}catch(t){return"NO STACK: ERROR ON RETRIEVAL"}}getErrorName(t){let e="unknown";try{"string"==typeof t?e=t:void 0!==t.name&&(e=t.name)}catch(t){try{e=`Client Error: ${t.name.toString()} - ${t.message}`}catch{e="Client Error: Unable to provide more information"}}return e}getErrorMessage(t){let e="unknown";try{"string"==typeof t?e=t:void 0!==t.message&&(e=t.message)}catch(t){try{e=`Client Error: ${t.name.toString()} - ${t.message}`}catch{e="Client Error: Unable to provide more information"}}return e}getErrorContext(t){let e="unknown";try{"string"!=typeof t&&"context"in t&&(e=t.context??"")}catch(t){try{e=`Client Error: ${t.name.toString()} - ${t.message}`}catch{e="Client Error: Unable to provide more information"}}return e}},vt=new Map([["_config/config/didLoad",async({account:t,customEvent:e})=>(t.write("config/loaded",!0),s.completed)],["_config/requestViewerCountry/define",async({account:t,customEvent:e})=>{if(void 0===e.detail?.code)throw new Error("Missing country code");const{code:n}=e.detail;if("string"!=typeof n||0===n.trim().length)throw new Error(`Invalid country code: "${n}"`);return t.update(ft,(()=>n)),s.completed}]]),yt="apstag/configuration/fetch",gt=new Map([[yt,async({account:t,customEvent:e})=>{const n=t.globalContext.document.createElement("script");return n.setAttribute("src",`https://config.aps.amazon-adsystem.com/configs/${t.id}`),n.setAttribute("type","text/javascript"),n.setAttribute("async","async"),t.globalContext.document.head.appendChild(n),await new Promise(((t,e)=>{n.addEventListener("load",(()=>{t()})),n.addEventListener("error",(t=>{e(t)}))})),s.completed}]]),wt="consent/GPPData",bt="consent/isGPPListenerRegistered";var Et=new ut({scope:"consent",object:"gppapi",action:"syncData",validators:{detail:{detail:tt,"detail.fromAddEvent":st(X),"detail.eventListener":st(tt),"detail.eventListener.pingData":st(tt),"detail.eventListener.pingData.gppString":st(Z),"detail.eventListener.pingData.gppVersion":st(nt([Z,Y])),"detail.eventListener.pingData.cmpId":st(nt([Z,Y])),"detail.eventListener.pingData.applicableSections":ot,"detail.eventListener.pingData.applicableSections[]":nt([Z,Y])}},handler:async({account:t,detail:e})=>{let n,o,a,i;(e?.eventListener?.pingData?.gppString??"").length>0?(n=e?.eventListener?.pingData,i="addEventListener"):([n,a]=(t=>{let e,n;try{const n=t.globalContext.__gpp("ping",((t,n)=>{n&&"object"==typeof t&&(e=t)}));void 0===e&&(n?.gppString??"").length>0&&(e=n)}catch(t){n=`E:ping: ${t}`}return[e,n]})(t),i="ping","object"!=typeof n&&([n,o]=(t=>{let e,n;try{const n=t.globalContext.__gpp("getGPPData");e={...n,...n.pingData}}catch(t){n=`E:getGPPData: ${t}`}return[e,n]})(t),i="getGPPData"));const r={gpp:{gppLength:"string"==typeof n?.gppString?n.gppString.length:void 0,isGPPTilde:(n?.gppString??"").includes("~"),error10:o,error:a,gppVersion:n?.gppVersion,cmpId:n?.cmpId,method:i,fromAddEvent:e?.fromAddEvent}};return t.write(wt,n),{status:s.completed,analytics:r}}}),St=new ut({scope:"consent",object:"gppapi",action:"didChange",validators:{detail:{detail:tt,"detail.fromAddEvent":st(X),"detail.eventListener":st(tt),"detail.eventListener.pingData":st(tt),"detail.eventListener.pingData.gppString":st(Z),"detail.eventListener.pingData.gppVersion":st(nt([Z,Y])),"detail.eventListener.pingData.cmpId":st(nt([Z,Y])),"detail.eventListener.pingData.applicableSections":ot,"detail.eventListener.pingData.applicableSections[]":nt([Z,Y])}},handler:async({account:t,detail:{eventListener:e,fromAddEvent:n}})=>(await t.recordListener(Et,{eventListener:e,fromAddEvent:n}),{status:s.completed})}),xt=new ut({scope:"consent",object:"gppapi",action:"attemptSync",handler:async({account:t})=>{if(void 0===t.globalContext.__gpp||!0===t.read(bt))return{status:s.cancelled};await t.recordListener(Et);const e=t.globalContext.__gpp("addEventListener",(e=>{"error"!==e?.eventName&&t.recordListenerNonBlocking(St,{eventListener:e,fromAddEvent:!0})}));return t.write(bt,"listenerRegistered"===e?.eventName&&!0===e?.data),{status:s.completed}}});const _t={key:"consent/isTCFAPIListenerRegistered",default:!1},Rt={key:"consent/TCData",default:void 0};function At(t,e){return"string"==typeof e?.tcString&&e?.tcString.length>0||!0===t?.globalContext?.apstag?.isGDPRRegion||!0===e?.gdprApplies}function It(t,e){return!0===t.vendor?.consents?.[793]&&(n=e,o=t.purpose?.consents,(n??[]).reduce(((t,e)=>t&&!0===o?.[e]),!0));var n,o}var jt=new ut({scope:"consent",object:"tcfapi",action:"didChange",validators:{detail:{detail:tt,"detail.success":st(X),"detail.tcData":st(dt)}},handler:async({account:t,detail:{success:e,tcData:n}})=>(t.update(_t,(t=>t||!0===e)),t.update(Rt,(t=>void 0!==n||!0===e?n:t)),"object"!=typeof n?{status:s.completed}:{status:s.completed,analytics:kt(t,n)})});const kt=(t,e)=>{const n={tcData:e,consents:[1]},o=t=>{try{return t()}catch{return"error"}};return{tcT:o((()=>t.isAPStagAllowedToAccessInfoOnDevice())),tcCC:o((()=>function({account:t,tcData:e,consents:n}){if(!At(t,e))return!0;if("object"!=typeof e)return!1;if((e.tcfPolicyVersion??0)<2)return!1;if(e.useNonStandardStacks)return!1;if(!e.isServiceSpecific)return!1;let o=!1;return n.forEach((t=>{const a=e.publisher?.restrictions?.[t]?.[793];switch(a){case 0:case 2:o=!0;break;default:It(e,n)||(o=!0)}})),!o}({...n,account:t}))),tcCF:o((()=>0===function({tcData:t,consents:e}){if(0===(e??[]).length)return["No consents param passed"];const n=[];try{if("object"!=typeof t){let e="";try{e=JSON.stringify(t)}catch{}n.push(`Invalid tcData: ${e}`)}return!1===t.gdprApplies?[]:((t.tcfPolicyVersion??0)<2&&n.push(`tcData version not supported: ${t.tcfPolicyVersion}`),t.useNonStandardStacks&&n.push("tcData's useNonStandardStacks should not be true"),t.isServiceSpecific||n.push("tcData needs to be service specific"),e.forEach((o=>{const a=t.publisher?.restrictions?.[o]?.[793];switch(a){case 0:n.push(`Invalid publisher restrictions 0, consent ${o}`);break;case 2:n.push(`Invalid publisher restrictions 2, consent ${o}`);break;default:It(t,e)||n.push(`Invalid publisher restrictions default, consent ${o}`)}})),n)}catch(t){if(n.length>0)return n;throw t}}(n).length)),PRA:o((()=>At(t,e)))}};var $t=new ut({scope:"consent",object:"tcfapi",action:"attemptSync",handler:async({account:t})=>{const e=t.use(_t);return void 0===t.globalContext.__tcfapi||e?{status:s.cancelled}:(t.globalContext.__tcfapi("addEventListener",2,((e,n)=>{t.recordListenerNonBlocking(jt,{tcData:e,success:n})})),{status:s.completed})}});const Ct=pt([xt,St,Et,$t,jt]),Ot="vnd_prx_segments",Pt="aps_targeting_comscore";var Dt=new ut({scope:"cxm",object:"comscore",action:"set",handler:async({account:t,customEvent:e})=>({status:Tt(t)})});const Tt=t=>{const e=t.readSessionStorage(Pt);if(t.deleteSessionStorage(Pt),null==e)return s.cancelled;try{const n=JSON.parse(e)[Ot];if(null==n)throw new Error;const{googletag:o}=t.globalContext;return o.pubads().getSlots().forEach((t=>{t.setTargeting(Ot,n)})),s.completed}catch(t){throw new Error(`Malformed targeting object at ${Pt}`)}},Nt="aps_targeting_ias";var Lt=new ut({scope:"cxm",object:"ias",action:"set",handler:async({account:t,customEvent:e})=>({status:Mt(t)})});const Mt=t=>{const e=(t=>{const{iasApsArtifact:e}=t.globalContext;if(e)return e;const n=t.readSessionStorage(Nt);return n?(t.deleteSessionStorage(Nt),JSON.parse(n)):void 0})(t);if(null==e)return s.cancelled;try{const{googletag:n}=t.globalContext;n.pubads().getSlots().forEach((t=>{const n=e.targeting.slots[t.getSlotElementId()];null!=n&&Object.keys(n).forEach((e=>{t.setTargeting(e,n[e])}))}));const{brandSafety:o,fr:a,custom:i}=e.targeting;return null!=o&&Object.keys(o).forEach((t=>{n.pubads().setTargeting(t,o[t])})),null!=i&&Object.keys(i).forEach((t=>{const e=i[t];n.cmd.push((()=>n.pubads().setTargeting(t,e)))})),null!=a&&n.pubads().setTargeting("fr",a),s.completed}catch(t){throw new Error(`Malformed targeting object at ${Nt}`)}},Ut="aps_targeting_illuma";var qt=new ut({scope:"cxm",object:"illuma",action:"set",handler:async({account:t,customEvent:e})=>({status:Vt(t)})});const Vt=t=>{const e=t.readSessionStorage(Ut);if(t.deleteSessionStorage(Ut),null==e)return s.cancelled;const n=JSON.parse(e).results;if(null==n)throw new Error(`Malformed targeting object at ${Ut}`);const{googletag:o}=t.globalContext;return Object.keys(n).forEach((t=>{const e=n[t];o.pubads().setTargeting(`illuma_${t}`,JSON.stringify(e))})),s.completed};var Ft=new ut({scope:"cxm",object:"contextual",action:"set",handler:async({account:t,customEvent:e})=>(await Promise.all([t.recordListener(Dt),t.recordListener(Lt),t.recordListener(qt)]),{status:s.completed})});const Bt=pt([Dt,Ft,Lt,qt]),zt={key:"customPlacement/hints",default:{}},Jt={key:"customPlacement/bidResponses",default:{}};class Ht{constructor(t,e,n){this.CLICK_PREFIX_MACRO="%%CLICK_URL_PREFIX%%",this.PROGRAM_CUSTOM_PLACEMENTS="customPlacements",this.getPageStyles=(t=["p","h1","h2"])=>t.map(this.getTagStyle).filter((t=>Object.keys(t).length>0)).reduce(((t,e)=>({...t,...e})),{}),this.getContainerStyles=t=>{try{if(!t)return{};const e=window.getComputedStyle(t),n="--aps-custom-container-",o=new Map;return o.set(`${n}width`,e.width),o.set(`${n}margin`,e.margin),o.set(`${n}padding`,e.padding),Object.fromEntries(o.entries())}catch(t){return{}}},this.slotProps=t,this.rawResponse=e,this.It=n}getTagStyle(t){const e=this.It.getElementsByTagName(t);if(e&&e[0]){const e=window.getComputedStyle(this.It.getElementsByTagName(t)[0]),n=new Map,o="--aps-custom-page-";return n.set(`${o}${t}-color`,e.color),n.set(`${o}${t}-fontFamily`,e.fontFamily),n.set(`${o}${t}-fontSize`,e.fontSize),n.set(`${o}${t}-fontWeight`,e.fontWeight),n.set(`${o}${t}-lineHeight`,e.lineHeight),Object.fromEntries(n)}return{}}getDynamicFrameBodyHeight(t,e,n){if(e){const n=e?.contentDocument||e?.contentWindow?.document,o=n?.body.scrollHeight;e.style.height=`${o}px`;try{const e={...this.getPageStyles(),...this.getContainerStyles(t)};Object.keys(e).forEach((t=>{n?.documentElement.style.setProperty(t,e[t])}))}catch(t){}}}render(t){return this.jt(t)}jt(t){if(!this.rawResponse||!this.slotProps)return!1;try{const e=this.rawResponse.size.split("x"),n=this.rawResponse.targeting?.amzniid||this.rawResponse.amzniid,o=this.rawResponse.targeting?.amznadm||this.rawResponse.amznadm;if(!n)return!1;let a=this.slotProps.kt;if(this.slotProps.location&&this.slotProps.id){const t=this.It.createElement("div");this.It.getElementById(this.slotProps.id)?.insertAdjacentElement(this.slotProps.location,t),a=t}if(!a)return!1;const i=this.It.createElement("iframe");return i.style.marginLeft="0",i.style.marginTop="0",i.style.height=`${e[1]}px`,i.style.width="100%",i.setAttribute("data-testid","amzn-asr-ad"),i.setAttribute("scrolling","no"),i.setAttribute("frameborder","0"),i.onload=()=>this.getDynamicFrameBodyHeight(a,i,o?"amznadm":"admi"),i.srcdoc=o||"",t&&t.clickPrefix&&(i.srcdoc=i.srcdoc.replace(this.CLICK_PREFIX_MACRO,t.clickPrefix)),a.appendChild(i),this.updateSlotAttribute("status","rendered"),!0}catch(t){throw new Error("CustomPlacements: Error while rendering")}}updateSlotAttribute(t,e){this.slotProps.kt?.setAttribute(`data-aps-custom-${t}`,e)}}const Gt={key:"customPlacement/timings",default:[]},Kt=(t,e,n=0,o=0)=>{try{const a={effectiveType:e?.effectiveType,rtt:e?.rtt,downlink:e?.downlink},i=function(t,e,n){try{return`${isNaN(e)||0===e?t.body.clientWidth:e}x${isNaN(n)||0===n?t.body.clientHeight:n}`}catch(t){}return"x"}(t,n,o);return{connection:a,screen:i}}catch(t){return{}}},Wt=(t,e,n)=>{t.update(Gt,(t=>(t.push({time:performance.now(),key:`${e}/${n}`}),t)))},Qt="customPlacements";var Yt=new ut({scope:"customPlacement",object:"hint",action:"process",validators:{},handler:async({account:t,detail:e,customEvent:n})=>{const o=e=>{Wt(t,Qt,`hint/process/${e}`);const n=t.use(zt),o=t.use(Jt);n[e].isRendered||(Object.values(o).forEach((o=>{if(o.isRendered)return;const a=t.globalContext.document.getElementById(e);if(null==a)return;const i=new Ht({id:e,kt:a},o,t.globalContext.document);Wt(t,Qt,`widget/render/${e}`),i.render(n[e].hintMetadata)&&(o.isRendered=!0,n[e].isRendered=!0)})),t.update(zt,(()=>n)),t.update(Jt,(()=>o)))},a=t.use(zt);return Object.keys(a).filter((t=>a[t].default)).forEach(o),Object.keys(a).filter((t=>!a[t].default)).forEach(o),{status:s.completed,analytics:{browserInfo:Kt(t.globalContext.document,t.globalContext.navigator?.connection,t.globalContext.innerWidth,t.globalContext.innerHeight)}}}}),Zt=new ut({scope:"customPlacement",object:"hint",action:"define",validators:{},handler:async({account:t,detail:e,customEvent:n})=>{if(void 0===n.detail?.id)throw new Error("Hint `id` must be defined");const{id:o,isDefault:a,hintMetadata:i}=n.detail;Wt(t,Qt,`hint/define/${o}`);const r=t.use(zt);return r[o]={default:"default"===a,isRendered:!1,hintMetadata:i??{}},t.update(zt,(()=>r)),t.recordListenerNonBlocking(Yt),{status:s.completed,analytics:{browserInfo:Kt(t.globalContext.document,t.globalContext.navigator?.connection,t.globalContext.innerWidth,t.globalContext.innerHeight)}}}});const Xt={key:"customPlacement/placementResponseDispatched",default:!1},te={key:"customPlacement/placementResponse",default:void 0},ee={key:"customPlacement/contextURL",default:void 0},ne={key:"customPlacement/placementEndpoint",default:"https://c.aps.amazon-adsystem.com/e/placements"},oe={key:"ad/context",default:void 0};var ae=new ut({scope:"customPlacement",object:"placement",action:"fetch",validators:{},handler:async({account:t,detail:e,customEvent:n})=>{Wt(t,Qt,"placementFetch/start");const o=await async function(t){const e={ortb2:ie(t)},n=t.use(ee),o=t.use(ne),a=function(t,e){try{const n=e??function(t){try{if(void 0!==t.globalContext.top?.location.href)return t.globalContext.top?.location.href}catch(t){}try{if(t.globalContext.top!==t.globalContext.self)return t.globalContext.document.referrer}catch(t){}}(t);if(void 0!==n)return encodeURIComponent(n)}catch(t){}return""}(t,n),i=encodeURIComponent(JSON.stringify(e)),s=await fetch(`${o}?account=${t.id}&u=${a}&sg=${i}`);return await s.json()}(t);return Wt(t,Qt,"placementFetch/end"),{status:s.completed,value:{placementResponse:o},analytics:{browserInfo:Kt(t.globalContext.document,t.globalContext.navigator?.connection,t.globalContext.innerWidth,t.globalContext.innerHeight)}}}});function ie(t){const e=t.use(oe);if(void 0!==e&&"user"in e){const{user:t,...n}=e;return n}return e}const se={key:"customPlacement/bidEndpoint",default:"c.aps.amazon-adsystem.com"},re={key:"customPlacement/bidIsKey",default:"86355855cc6ed9e335d0382c8563aa10"};var ce=new ut({scope:"customPlacement",object:"bids",action:"fetch",validators:{},handler:async({account:t,detail:e,customEvent:n})=>{const o=Kt(t.globalContext.document,t.globalContext.navigator?.connection,t.globalContext.innerWidth,t.globalContext.innerHeight);if(void 0===t.globalContext.apstag?.clientFetchBids)return{status:s.waiting,analytics:{browserInfo:o}};Wt(t,Qt,"fetchBids/start");const a=await async function(t){const e={slots:[{slotID:"93b7dd52-a8ce-11ed-afa1-0242ac120002:1",sizes:[[999,999]]}],timeout:6e4,_endpointDomain:t.use(se),params:{program:"apscustom",is:t.use(re)}},n={pubID:t.id,isSelfServePub:36===t.id.length,deals:!0},o=t.use(ee);return await new Promise((a=>{t.globalContext.apstag?.clientFetchBids(e,(t=>{a(t)}),{initConfig:n,contextURL:o})}))}(t);return Wt(t,Qt,"fetchBids/end"),{status:s.completed,value:{bidResponses:a},analytics:{browserInfo:o}}}}),de=new ut({scope:"customPlacement",object:"service",action:"enable",validators:{},handler:async({account:t,detail:e,customEvent:n})=>(Wt(t,Qt,"service/enable"),t.update(Xt,(()=>!1)),await Promise.all([t.recordListener(ae).then((({placementResponse:e})=>{le(t,!0,e),t.update(te,(()=>e))})),t.recordListener(ce).then((({bidResponses:e})=>{e.forEach((e=>{const n=e.targeting?.amzniid??e.amzniid;let o=!1;if(""!==n){const a=t.use(Jt);a[n]=e,t.update(Jt,(()=>a)),o=!0}le(t,!1,{aps:[{active:o,dispatchEventOnValidBid:!0}]})}))})).then((()=>{t.recordListenerNonBlocking(Yt)}))]),{status:s.completed,analytics:{browserInfo:Kt(t.globalContext.document,t.globalContext.navigator?.connection,t.globalContext.innerWidth,t.globalContext.innerHeight)}})});function le(t,e,n){if(t.use(Xt))return;const o=n?.aps?.find((t=>t.dispatchEventOnValidBid));e&&void 0!==o||(Wt(t,Qt,"placementResponseEvent/dispatch"),t.record("customPlacement/placement/didRespond",n).catch((t=>{})),t.update(Xt,(()=>!0)))}const ue=new Map([...pt([Zt,ce,Yt,de,ae])]),pe={key:"ortbVendors/vm",default:{}},me="anonymised";var fe=new ut({scope:"ortbVendors",object:"anonymised",action:"set",handler:async({account:t})=>{const e=function(t){const e=t.readLocalStorage("cohort_ids");if("string"==typeof e){const t=JSON.parse(e);let n="";for(let e=0;e({...t,[me]:e}))),{status:s.completed})}}),he=new ut({scope:"ortbVendors",object:"arcspan",action:"set",handler:async({account:t})=>{const e=function(t){const e=t.globalContext[ve],n=t.globalContext[ye];let o=[],a=[],i=[];if(void 0!==e){if(void 0!==e.page_iab_codes.text&&(o=o.concat(e.page_iab_codes.text)),void 0!==e.page_iab_codes.images&&(o=o.concat(e.page_iab_codes.images)),void 0!==e.page_keywords){const t="string"==typeof e.page_keywords?e.page_keywords.split(","):e.page_keywords;i=i.concat(t),void 0!==n?.compcohorts&&(i=i.concat(n.compcohorts))}void 0!==e.page_iab_newcodes.text&&(a=[...new Set([...a,...e.page_iab_newcodes.text])]),void 0!==e.page_iab_newcodes.images&&(a=[...new Set([...a,...e.page_iab_newcodes.images])]);const s={name:"arcspan",segment:[],ext:{segtax:6}};a.forEach((function(t){s.segment=s.segment.concat({id:t})}));const r={data:[]};return r.data=r.data.concat(s),{data:{default:{site:{name:"arcspan",cat:o,sectioncat:o,pagecat:o,keywords:i.toString(),content:r,domain:new URL(t.globalContext.location.href).hostname,page:t.globalContext.location.href,ref:t.globalContext.document.referrer}}}}}}(t);return void 0===e?{status:s.cancelled}:(t.update(pe,(t=>({...t,arcspan:e}))),{status:s.completed})}});const ve="arcobj1",ye="arcobj2",ge={key:"idVendors/ids",default:void 0},we={key:"idVendors/metadata",default:void 0};function be(t,e){const n=t(e);return null!=n?(e.update(ge,(t=>({...t,...n}))),{status:s.completed}):{status:s.cancelled}}class Ee{constructor(t){return this.parser=null,this.keys=null,this.account=null,this.read=t=>null,this.anyAttributesMissing=()=>[this.parser,this.keys,this.account,this.egressNodeKey,this.read].some((t=>null==t)),this.egressNodeKey=t,this}using(t){return this.parser=t,this}fromCookieKeys(t){return this.keys=t,this.read=t=>this.account?.readCookieStorage(t),this}fromLocalStorageKeys(t){return this.keys=t,this.read=t=>this.account?.readLocalStorage(t),this}fromCookieOrLocalStorageKeys(t){return this.keys=t,this.read=t=>this.account?.readCookieStorage(t)??this.account?.readLocalStorage(t),this}fromLocalStorageOrCookieKeys(t){return this.keys=t,this.read=t=>this.account?.readLocalStorage(t)??this.account?.readCookieStorage(t),this}forAccount(t){return this.account=t,this}getRunner(){if(this.anyAttributesMissing())throw new Error("Missing attribute(s) - unable to return a runner.");return()=>{if(this.anyAttributesMissing())throw new Error("Missing attribute(s) - runner execution failed.");for(const t of this.keys){const e=this.parser(this.read(t));if(null!=e)return{[this.egressNodeKey]:e}}return null}}}const Se=function(t){return"string"==typeof t?t:null},xe=function(t){return"string"==typeof t?atob(t):null};function _e(t){return function(e){return"string"==typeof e?t(JSON.parse(e)):null}}function Re(t){return function(e){if("string"!=typeof e)return null;let n=e,o=null;for(let e=0;++e<=5;)try{n=decodeURIComponent(n),o=_e(t)(n);break}catch(t){if(e>=5)throw t}return o}}const Ae="growthcode",Ie="temp",je=["gceb"];var ke=new ut({scope:"ortbVendors",object:"growthcode",action:"set",handler:async({account:t})=>{const e=new Ee(Ie).using(Se).fromLocalStorageKeys(je).forAccount(t).getRunner()();if(!e)return{status:s.cancelled};const n=JSON.parse(e[Ie]);if(!(n instanceof Array))return{status:s.cancelled};const o=n.filter((t=>$e(t)));if(0===o.length)return{status:s.cancelled};const a={data:{default:{user:{ext:{eids:o}}}}};return t.update(pe,(t=>({...t,[Ae]:a}))),{status:s.completed}}});const $e=t=>!!t&&!!t.source&&t.uids instanceof Array&&0!==t.uids.length&&t.uids.every((t=>void 0!==t?.id)),Ce="liveintent",Oe={nonId:{noExtraDefaults:!0,source:"liveintent.com",atype:3},bidswitch:{source:"bidswitch.net",atype:3},openx:{source:"openx.net",atype:3},magnite:{source:"rubiconproject.com",atype:3},medianet:{source:"media.net",atype:3},pubmatic:{source:"pubmatic.com",atype:3},index:{source:"liveintent.indexexchange.com",atype:3},uid2:{source:"uidapi.com",atype:3},sovrn:{source:"liveintent.sovrn.com",atype:3},thetradedesk:{source:"adserver.org",atype:1},vidazoo:{source:"liveintent.vidazoo.com",atype:3},triplelift:{source:"liveintent.triplelift.com",atype:3},sharethrough:{source:"sharethrough.com",atype:3},sonobi:{source:"liveintent.sonobi.com",atype:3},nexxen:{source:"liveintent.unrulymedia.com",atype:3},zetassp:{source:"zeta-ssp.liveintent.com",atype:3}};var Pe=new ut({scope:"ortbVendors",object:"liveintent",action:"set",handler:async({account:t})=>{const e=function(t){const e=t.readLocalStorage("__tamLIResolveResult");if(null!=e&&(void 0===t.globalContext.liModuleEnabled&&(t.globalContext.liModuleEnabled=Math.random()<.95,t.globalContext?.googletag?.cmd.push((()=>{t.globalContext.googletag.pubads().setTargeting("li-module-enabled",t.globalContext.liModuleEnabled?["on"]:["off"])}))),t.globalContext.liModuleEnabled)){let t;try{t=De(JSON.parse(e))}catch(n){t=De(JSON.parse(decodeURIComponent(e)))}if(void 0!==t)return{data:{default:t}}}}(t);return void 0===e?{status:s.cancelled}:(t.update(pe,(t=>({...t,[Ce]:e}))),{status:s.completed})}});function De(t){const e=[],n={user:{ext:{eids:e}}};return Object.entries(Oe).forEach((n=>{const o=n[0],a=n[1];if(void 0===t[o])return;const i={source:a.source,uids:[{id:t[o],atype:a.atype}]};!0!==a.noExtraDefaults&&(i.uids[0].ext={provider:"liveintent.com"}),e.push(i)})),n}const Te="optable",Ne="temp";var Le=new ut({scope:"ortbVendors",object:"optable",action:"set",handler:async({account:t})=>{const e=new Ee(Ne).using(Se).fromLocalStorageKeys(["OPTABLE_RESOLVED"]).forAccount(t).getRunner()();if(!e)return{status:s.cancelled};const n=function(t){return t&&t.ortb2?t.ortb2:t}(JSON.parse(e[Ne])),o={data:{default:n}};return t.update(pe,(t=>({...t,[Te]:o}))),{status:s.completed}}});const Me="permutive",Ue="permutive_temp",qe=["_pamzn_ids"];var Ve=new ut({scope:"ortbVendors",object:"permutive",action:"set",handler:async({account:t})=>{const e=new Ee(Ue).using(Se).fromLocalStorageKeys(qe).forAccount(t).getRunner()();if(!e)return{status:s.cancelled};const n=JSON.parse(e[Ue]);if(!Array.isArray(n))return{status:s.cancelled};const o=n.filter((t=>Fe(t)));if(0===o.length)return{status:s.cancelled};const a={data:{default:{user:{ext:{eids:o}}}}};return t.update(pe,(t=>({...t,[Me]:a}))),{status:s.completed}}});const Fe=t=>!!t&&!!t.source&&!!Array.isArray(t.uids)&&0!==t.uids.length&&t.uids.every((t=>void 0!==t?.id));var Be=new ut({scope:"ortbVendors",object:"all",action:"process",handler:async({account:t})=>(await Promise.all([t.recordListener(fe),t.recordListener(he),t.recordListener(ke),t.recordListener(Pe),t.recordListener(Le),t.recordListener(Ve)]),{status:s.completed})});const ze=pt([fe,he,ke,Pe,Le,Ve,Be]),Je="33across",He="33acrossId";var Ge=new ut({scope:"idVendors",object:"33across",action:"get",handler:async({account:t,customEvent:e})=>{const n=be(Ke,t),o=t.readLocalStorage(He);if(o&&o.length>1500){const t={idLength:100*Math.ceil(o.length/100)};return{...n,analytics:t}}return n}});const Ke=t=>{const e=t.readLocalStorage(He);return null!=e?{[Je]:decodeURIComponent(e)}:null},We=["amxId"];var Qe=new ut({scope:"idVendors",object:"amx",action:"get",handler:async({account:t,customEvent:e})=>be(new Ee("amx").using(Se).fromLocalStorageKeys(We).forAccount(t).getRunner(),t)});const Ye="audigent";var Ze=new ut({scope:"idVendors",object:"audigent",action:"get",handler:async({account:t,customEvent:e})=>be(Xe,t)});const Xe=t=>{const e=t.readLocalStorage("hadronId")??t.readLocalStorage("auHadronId");return null!=e?{[Ye]:e}:null},tn=["cto_bidid"];var en=new ut({scope:"idVendors",object:"criteo",action:"get",handler:async({account:t,customEvent:e})=>be(new Ee("criteo").using(Se).fromLocalStorageKeys(tn).forAccount(t).getRunner(),t)});const nn="firstid",on=["firstid"];var an=new ut({scope:"idVendors",object:"firstid",action:"get",handler:async({account:t,customEvent:e})=>be(new Ee(nn).using(Se).fromCookieKeys(on).forAccount(t).getRunner(),t)});const sn={key:"idVendors/enabled",default:void 0},rn={"context.apstag":tt,"context.apstag.bids":rt,"context.apstag.bids()":lt,"context.apstag._atsaaiod":nt([lt,rt]),"context.apstag.setDisplayBids":rt,"context.apstag.setDisplayBids()":null,"context._apstag":st(tt),"context._apstag.bids":st(rt),"context._apstag.bids()":st(lt),"context._apstag._atsaaiod":st(nt([lt,rt])),"context._apstag.setDisplayBids":st(rt),"context._apstag.setDisplayBids()":null};var cn=new ut({scope:"idVendors",object:"enabled",action:"set",handler:async({account:t,detail:e,context:n})=>dn(n)?(t.update(sn,(()=>JSON.stringify(e.bidParameterKeys)),{persist:!0}),{status:s.completed}):{status:s.waiting},validators:{detail:{detail:tt,"detail.bidParameterKeys":ot,"detail.bidParameterKeys[]":Z},context:{context:tt,...rn,"context.apstag":nt([lt,tt]),"context._apstag":st(nt([lt,tt]))}}});const dn=t=>void 0!==t.apstag?._atsaaiod,ln="fabrick";var un=new ut({scope:"idVendors",object:"fabrick",action:"get",handler:async({account:t,customEvent:e})=>be(pn,t)});const pn=t=>{let e=null;const n=t.readCookieStorage("pbjs_fabrickId");if(null!=n){const t=decodeURIComponent(n);e=JSON.parse(t).fabrickId}return null!=e?{[ln]:e}:null},mn=["FTrackId"],fn=t=>t?.DeviceID?.pop?t?.DeviceID?.pop()??null:null;var hn=new ut({scope:"idVendors",object:"fTrack",action:"get",handler:async({account:t,customEvent:e})=>be(new Ee("fTrack").using(Re(fn)).fromLocalStorageKeys(mn).forAccount(t).getRunner(),t)});const vn="id5",yn="id5id";var gn=new ut({scope:"idVendors",object:"id5",action:"get",handler:async({account:t,customEvent:e})=>be(wn,t)});const wn=t=>{const e=t.readLocalStorage(yn);return null!=e?{[vn]:JSON.parse(decodeURIComponent(e)).universal_uid}:null},bn=["IDP"];var En=new ut({scope:"idVendors",object:"idPlus",action:"get",handler:async({account:t,customEvent:e})=>be(new Ee("idPlus").using(xe).fromCookieOrLocalStorageKeys(bn).forAccount(t).getRunner(),t)});const Sn=["__im_uid","__im_ppid"];var xn=new ut({scope:"idVendors",object:"intimateMerger",action:"get",handler:async({account:t,customEvent:e})=>be(new Ee("intimateMerger").using(Se).fromLocalStorageKeys(Sn).forAccount(t).getRunner(),t)});const _n="liveRamp",Rn="_lr_env",An="idl_env",In="apstagLiveRampTimestamp";var jn;!function(t){t[t.oldTimestamp=0]="oldTimestamp",t[t.newTimestamp=1]="newTimestamp",t[t.noTimestamp=2]="noTimestamp"}(jn||(jn={}));var kn=new ut({scope:"idVendors",object:"liveramp",action:"get",handler:async({account:t,customEvent:e})=>{const n=Cn($n(t),t),o=be((()=>null!=n?{[_n]:n.id}:null),t);return o.status===s.completed?function(t,e){const o=null!=n?{[_n]:n.newGen}:null;return null!=o?(e.update(we,(t=>({...t,...o}))),{status:s.completed}):{status:s.cancelled}}(0,t):o}});const $n=t=>{const e=t.readLocalStorage(Rn);if(null!=e)return e;const n=t.readCookieStorage(Rn);if(null!=n)return n;const o=t.readLocalStorage(An);if(null!=o)return o;const a=t.readCookieStorage(An);return null!=a?a:null},Cn=(t,e)=>{if(null!=t&&""!==t)try{const n=JSON.parse(atob(decodeURIComponent(t))),o={id:n.envelope,newGen:jn.noTimestamp};if(null!=n.timestamp){const t=e.readLocalStorage(In);null==t||tbe(Nn,t)});const Nn=t=>{const e=t.readLocalStorage("lockr_identity_providers");if(e){const n={};return e.split(",").filter((t=>!Pn.has(t))).forEach((e=>{const o=Ln(t,e);null!==o&&(n[On[e]||e]=decodeURIComponent(o))})),n}return null},Ln=(t,e)=>{let n=t.readLocalStorage(e);if(!n)return null;if(Dn[e])try{n=JSON.parse(decodeURIComponent(n)),Dn[e].split(".").forEach((t=>{n=n?.[t]}))}catch(t){throw new Error(`Malformed json at ${e}: ${t}`)}return n||null},Mn="lotame";var Un=new ut({scope:"idVendors",object:"lotame",action:"get",handler:async({account:t,customEvent:e})=>be(qn,t)});const qn=t=>{const e=t.readLocalStorage("panoramaId");return null!=e?{[Mn]:e}:null},Vn=["pbjs-merkleId"],Fn=t=>t?.merkleId?.pop?t?.merkleId?.pop()?.id??null:null;var Bn=new ut({scope:"idVendors",object:"merkle",action:"get",handler:async({account:t,customEvent:e})=>be(new Ee("merkle").using(Re(Fn)).fromLocalStorageKeys(Vn).forAccount(t).getRunner(),t)});const zn="pair",Jn=["pairId"],Hn=["_lr_pairId"],Gn=t=>t?.envelope?.pop?t?.envelope?.pop()??null:null;var Kn=new ut({scope:"idVendors",object:"pair",action:"get",handler:async({account:t,customEvent:e})=>be((t=>new Ee(zn).using(xe).fromCookieOrLocalStorageKeys(Jn).forAccount(t).getRunner()()??new Ee(zn).using(function(t){return function(e){return"string"==typeof e?_e(t)(atob(decodeURIComponent(e))):null}}(Gn)).fromCookieOrLocalStorageKeys(Hn).forAccount(t).getRunner()()),t)});const Wn="pubcommon",Qn=["_pubcid","_sharedID"];var Yn=new ut({scope:"idVendors",object:"pubcommon",action:"get",handler:async({account:t,customEvent:e})=>be(new Ee(Wn).using(Se).fromLocalStorageOrCookieKeys(Qn).forAccount(t).getRunner(),t)});const Zn="publink",Xn=["_publink_srv","_publink","pbjs_publink"];var to=new ut({scope:"idVendors",object:"publink",action:"get",handler:async({account:t,customEvent:e})=>be(eo,t)});const eo=t=>{for(const e of Xn){const n=t.readCookieStorage(e);if(null!=n){let t;try{t=JSON.parse(n).publink}catch{t=n}if(null!=t)return{[Zn]:t}}}return null},no=["__qca"];var oo=new ut({scope:"idVendors",object:"quantcast",action:"get",handler:async({account:t,customEvent:e})=>be(new Ee("quantcast").using(Se).fromCookieKeys(no).forAccount(t).getRunner(),t)});const ao=["__uid2_advertising_token"],io=t=>t?.latestToken?.advertising_token??null;var so=new ut({scope:"idVendors",object:"uid",action:"get",handler:async({account:t,customEvent:e})=>be(new Ee("uid").using(_e(io)).fromLocalStorageKeys(ao).forAccount(t).getRunner(),t)});const ro=["pbjs_unifiedID","pbjs-unifiedid"],co=t=>t?.TDID??null;var lo=new ut({scope:"idVendors",object:"unifiedid",action:"get",handler:async({account:t,customEvent:e})=>be(new Ee("unifiedid").using(Re(co)).fromLocalStorageOrCookieKeys(ro).forAccount(t).getRunner(),t)});const uo="yahoo",po=["connectId"],mo=t=>t?.connectid??t?.connectId??null;var fo=new ut({scope:"idVendors",object:"yahoo",action:"get",handler:async({account:t})=>be(new Ee(uo).using(Re(mo)).fromLocalStorageKeys(po).forAccount(t).getRunner(),t)});const ho="liveRamp/envelope",vo={key:"liveRamp/envelope",default:void 0},yo={key:"liveRamp/envelopeHost",default:"https://api.rlcdn.com"};var go=new ut({scope:"liveRamp",object:"envelope",action:"fetch",handler:async({account:t})=>{if(void 0===t.globalContext.apstag?._atsaaiod)return{status:s.waiting};const e=t.use(yo),n=new URL(`${e}/api/identity/envelope`);n.searchParams.append("pid","13310");const o=t.use(Rt),a=t.read(wt);!0===o?.gdprApplies&&o.tcString&&(n.searchParams.append("gdpr","1"),n.searchParams.append("gdpr_consent",o.tcString)),a?.gppString&&a.applicableSections?.length>0&&(n.searchParams.append("gpp",a.gppString),n.searchParams.append("gpp_sid",a.applicableSections.join(",")));const i=await t.globalContext.fetch(n.toString(),{method:"GET",credentials:"include"}),r={statusCode:i.status,responseOk:i.ok};if(200!==i.status)return{status:s.cancelled,analytics:{...r,...204===i.status&&{reason:"No Content"}}};const c=await i.json();if(!c.envelope)return{status:s.cancelled,analytics:{...r,reason:"missing_envelope"}};const d=JSON.stringify({value:c.envelope,createdAt:Date.now()});return t.update(vo,(()=>c.envelope)),t.writeLocalStorage(ho,d,{usePrefix:!0}),{status:s.completed,analytics:r}}}),wo=new ut({scope:"liveRamp",object:"envelope",action:"sync",handler:async({account:t})=>{if(void 0===t.globalContext.apstag?._atsaaiod)return{status:s.waiting};const e=t.readLocalStorage(ho,{usePrefix:!0});if(e){const{createdAt:n,value:o}=JSON.parse(e);if(o&&bo(n,Date.now())<15)return t.update(vo,(()=>o)),{status:s.completed}}return await t.recordListener(go),{status:s.completed}}});const bo=(t,e)=>{const n=new Date(t),o=new Date(e);return(n.getTime()-o.getTime())/864e5};var Eo=new ut({scope:"idVendors",object:"rtisLiveRamp",action:"get",handler:async({account:t})=>(t.recordListenerNonBlocking(wo),{status:s.completed})});const So={"33across":Ge,amx:Qe,audigent:Ze,criteo:en,ddb_key_638:Tn,firstid:an,fabrick:un,fTrack:hn,id5:gn,idPlus:En,intimateMerger:xn,liveRamp:kn,lotame:Un,merkle:Bn,pair:Kn,pubcommon:Yn,publink:to,quantcast:oo,uid:so,unifiedid:lo,yahoo:fo,rtisLiveRamp:Eo},xo=Object.keys(So);var _o=new ut({scope:"idVendors",object:"ids",action:"get",handler:async({account:t})=>{let e=Object.values(So);const n=t.use(sn,{persist:!0,throwOnDisallowed:!1});if(n){const t=JSON.parse(n);if(o=t,!Array.isArray(o)||!o.every((t=>"string"==typeof t)))throw new Error("Received invalid 3P bid param key");const a=new Set(t);e=xo.filter((t=>a.has(t))).map((t=>So[t]))}var o;const a=n?e:e.filter((t=>t!==Eo));return await Promise.all(a.map((e=>t.recordListener(e)))),{status:s.completed,analytics:{enabledIdVendors:`${n}`}}}});const Ro={key:"idVendors/recordVendorsLoadedEndpoint",default:"https://prod.us-east-1.cxm-bcn.publisher-services.amazon.dev/v1/recordVendorsLoaded"};var Ao=new ut({scope:"idVendors",object:"vendorsLoaded",action:"record",validators:{detail:{detail:tt,"detail.accountId":Z,"detail.sourceId":Z,"detail.vendorId":st(Z),"detail.propertyId":st(Z),"detail.failure":st(Z),"detail.errorName":st(Z),"detail.errorMessage":st(Z)},context:{context:tt,"context.fetch":rt,"context.fetch()":null}},handler:async({detail:t,account:e,context:n})=>{const o=[{publisherId:t.accountId,sourceId:t.sourceId,clientName:"aps-listener",...t.failure&&{failure:t.failure,errorName:t.errorName,errorMessage:t.errorMessage},...!t.failure&&{vendorId:t.vendorId,propertyId:t.propertyId}}],a=e.use(Ro),i=await n.fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o),keepalive:!0});if(!i.ok)throw new Error(`HTTP ${i.status}`);return{status:s.completed,analytics:{vendorId:t.vendorId}}}}),Io=new ut({scope:"idVendors",object:"integration",action:"execute",validators:{detail:{detail:tt,"detail.script":rt,"detail.script()":ct,"detail.accountId":Z,"detail.sourceId":Z,"detail.vendorId":Z,"detail.propertyId":Z,"detail.countryCode":Z,"detail.vendorLoadedSampleRate":st(Y),"detail.restrictions":st(tt),"detail.restrictions.block":st(tt),"detail.restrictions.block.dtbHostnames":st(ot),"detail.restrictions.block.dtbHostnames[]":Z,"detail.allowedRegions":st(ot),"detail.allowedRegions[]":Z,"detail.blockedRegions":st(ot),"detail.blockedRegions[]":Z}},handler:async({detail:t,account:e})=>{let n,o,a;try{t.script()}catch(t){n="vendor-script-execution-error",o=t instanceof Error?t.name:"Error",a=t instanceof Error?t.message:String(t)}if(e.recordListenerNonBlocking(Ao,{accountId:t.accountId,sourceId:t.sourceId,vendorId:t.vendorId,propertyId:t.propertyId,...n&&{failure:n,errorName:o,errorMessage:a},restrictions:{allow:{rate:(t.vendorLoadedSampleRate??5)/100}}}),n)throw new Error(a);return{status:s.completed,analytics:{vendorId:t.vendorId}}}});const jo=pt([Ge,Qe,Ze,en,an,cn,un,hn,gn,En,_o,Io,xn,kn,Tn,Un,Bn,Kn,Yn,to,oo,so,lo,Ao,fo,Eo]),ko=pt([new ut({scope:"analytics",object:"sampling",action:"set",validators:{detail:{detail:ct,"detail.rates":ct,"detail.rates.error":ct,"detail.rates.status":ct}},handler:async({detail:t})=>void 0===t?.rates?{status:s.cancelled}:(void 0!==t?.rates?.error&&ht.setEventSamplingRates({error:t?.rates?.error}),void 0!==t?.rates?.status&&ht.setEventSamplingRates({feature:t?.rates?.status}),{status:s.completed})}),new ut({scope:"log",object:"analytics",action:"setInterval",validators:{detail:{detail:tt,"detail.interval":Y}},handler:async({detail:t})=>(ht.setEventProcessingInterval(t.interval),{status:s.completed})})]);var $o=new ut({scope:"debug",object:"version",action:"show",handler:async({account:t,customEvent:e})=>({status:s.completed,value:{LIBRARY_VERSION:_}})});const Co="debug/events/show",Oo="debug/prepend/add",Po="debug/prepend/remove",Do="debug/store/show",To="ad/debugSession/start",No=new Map([[Co,async({account:t})=>{const e=[...(null!=t.store.get(y)?t.store.get(y):[]).map((t=>({type:t.type,status:"created",detail:t.detail,timestamp:t.timeStamp}))),...t.queue.map((t=>({type:t.type,status:"created",detail:t.detail,timestamp:t.timeStamp}))),...(null!=t.store.get(y)?t.store.get(y):[]).map((t=>null!=t.statusEvents?t.statusEvents.map((e=>({type:t.type,status:e.type,detail:t.detail,timestamp:e.timeStamp}))):[])).flat(),...t.queue.map((t=>null!=t.statusEvents?t.statusEvents.map((e=>({type:t.type,status:e.type,detail:t.detail,timestamp:e.timeStamp}))):[])).flat()].filter((t=>!t.type.startsWith("debug/")));return e.sort(((t,e)=>t.timestamp-e.timestamp)),console.groupCollapsed(`⌂ Account ID: ${t.id}`),console.table(e),console.groupEnd(),s.completed}],[Oo,async({account:t,customEvent:n})=>{if(void 0===n.detail?.eventName)throw new Error("Missing event information");const o=t.read(e,{persist:!0})??"[]",a=JSON.parse(o),{eventName:i,eventDetail:r}=n.detail;return a.unshift({eventName:i,eventDetail:r}),t.write(e,JSON.stringify(a),{persist:!0}),s.completed}],["debug/prepend/clear",async({account:t})=>(t.delete(e,{persist:!0}),s.completed)],[Po,async({account:t,customEvent:n})=>{if(void 0===n.detail?.eventName)throw new Error("Missing event information");const o=t.read(e,{persist:!0})??"[]",a=JSON.parse(o),{eventName:i}=n.detail,r=a.filter((t=>t.eventName!==i));return t.write(e,JSON.stringify(r),{persist:!0}),s.completed}],[Do,async({account:t})=>{const e=[...t.store.entries()];return console.groupCollapsed(`⌂ Account ID: ${t.id}`),console.table(e),console.groupEnd(),s.completed}],[To,async({account:e,customEvent:n})=>function(t){return t.status!==s.waiting}(n)&&(function(e,n){void 0!==e.detail?.minutes&&function(e,n){const o=new Date;e.write(t,o.setMinutes(Number(o.getMinutes())+Number(n.detail?.minutes)).toString(),{persist:!0})}(n,e),function(t){t.globalContext.apstagDEBUG=t.globalContext.apstagDEBUG??{},t.globalContext.apstagDEBUG.url=function(t){const e=new URL(t?.top?.location?.href??t?.document?.referrer);return e.searchParams.set("amzn_debug_mode","1"),e.toString()}(t.globalContext)}(n)}(n,e),function(t){return t.queue.filter((t=>t.type===To)).length>1}(e))?s.completed:function(e){const n=e.read(t,{persist:!0});return void 0!==n&&new Date>=new Date(Number(n))}(e)?(function(e){e.delete(t,{persist:!0}),function(t){delete t.globalContext.apstagDEBUG?.url}(e)}(e),s.completed):(function(t){t.record(Co).catch((t=>{})),t.record(Do).catch((t=>{}))}(e),s.waiting)],["debug/listeners/show",async({systemAccount:t})=>{const e=[...t.store.get(v).entries()];return console.groupCollapsed("⌂ Listeners"),console.table(e),console.groupEnd(),s.completed}]]),Lo=new Map([...No,...pt([$o])]);var Mo;!function(t){t[t.unspecifiedUnknown=0]="unspecifiedUnknown",t[t.lowEntropy=1]="lowEntropy",t[t.highEntropy=2]="highEntropy"}(Mo||(Mo={}));const Uo=["brands","mobile","platform"],qo=["architecture","bitness","fullVersionList","model","platformVersion"];var Vo=new ut({scope:"deviceSignal",object:"sua",action:"set",validators:{context:{context:tt,...rn,"context.navigator":tt,"context.navigator.userAgentData":tt,"context.navigator.userAgentData.getHighEntropyValues":rt,"context.navigator.userAgentData.architecture":st(Z),"context.navigator.userAgentData.bitness":st(Z),"context.navigator.userAgentData.mobile":st(X),"context.navigator.userAgentData.model":st(Z),"context.navigator.userAgentData.platform":st(Z),"context.navigator.userAgentData.platformVersion":st(Z),"context.navigator.userAgentData.fullVersionList":st(ot),"context.navigator.userAgentData.fullVersionList[]":tt,"context.navigator.userAgentData.fullVersionList[].brand":Z,"context.navigator.userAgentData.fullVersionList[].version":Z,"context.navigator.userAgentData.brands":st(ot),"context.navigator.userAgentData.brands[]":tt,"context.navigator.userAgentData.brands[].brand":Z,"context.navigator.userAgentData.brands[].version":Z}},handler:async({account:t})=>{if(void 0===t.globalContext.apstag?.isGDPRRegion)return{status:s.waiting};const e="deviceSignal/sua",n=t.globalContext.navigator?.userAgentData,o=t.read(e,{persist:!0,throwOnDisallowed:!1});return"string"==typeof o?t.write(e,o):n instanceof Object&&function(t,e,n){t.write(e,JSON.stringify(Fo(n)))}(t,e,n),!1!==t.globalContext.apstag?.isGDPRRegion||"function"==typeof n?.getHighEntropyValues&&await async function(t,e,n){const o=await n.getHighEntropyValues([...Uo,...qo]);return t.write(e,JSON.stringify(Fo(o)),{persist:!0,throwOnDisallowed:!1}),s.completed}(t,e,n),{status:s.completed}}});function Fo(t){const e={};let n;return e.architecture=t.architecture,e.bitness=t.bitness,e.mobile=t.mobile?1:0,e.model=t.model,e.source=(o=t,qo.some((t=>o[t]))?Mo.highEntropy:Uo.some((t=>o[t]))?Mo.lowEntropy:Mo.unspecifiedUnknown),"string"==typeof t.platform&&(e.platform={brand:t.platform,version:t.platformVersion?.split(".")}),Array.isArray(t.fullVersionList)?n=t.fullVersionList:Array.isArray(t.brands)&&(n=t.brands),n instanceof Array&&(e.browsers=n.map((t=>({brand:t.brand,version:t.version?.split(".")})))),e;var o}const Bo=pt([Vo]),zo={key:"deviceSignal/cookieDeprecationLabel",default:void 0};var Jo=new ut({scope:"deviceSignal",object:"cookieDeprecationLabel",action:"set",handler:async({account:t,customEvent:e})=>{const{cookieDeprecationLabel:n}=t.globalContext.navigator;if(void 0===n?.getValue||"function"!=typeof n.getValue)return{status:s.cancelled};const o=await t.executeFuncWithConsent(n,n.getValue);return void 0===o||""===o?{status:s.cancelled}:(t.update(zo,(()=>o)),{status:s.completed,analytics:{gcdl:o}})}});const Ho=pt([Jo]),Go={key:"_monitoring/statusesByEventIdentifier",default:new Map};var Ko=async({account:t,customEvent:e})=>{const n=e.detail?.eventIdentifier;if(void 0===n)throw new Error("Missing eventIdentifier parameter");const o=t.use(Go),a=`${e.type}:${n}`,i=o.get(a);return void 0!==i?i:s.waiting},Wo=async({account:t,customEvent:e})=>{const n=e.detail?.eventIdentifier;if(void 0===n)throw new Error("Missing eventIdentifier parameter");const o=e.detail?.statusUpdate;if(void 0===o)throw new Error("Missing statusUpdate parameter");if(!(o in s))throw new Error(`Invalid statusUpdate parameter. Expected one of ${Object.values(s).join(", ")}`);const a=e.detail?.pairedEvents;if(void 0===a||a.length<1||a.some((t=>"string"!=typeof t)))throw new Error("Parameter pairedEvents must be a non-empty array of string");return a.forEach((e=>{const a=`${e}:${n}`;t.update(Go,(t=>t.set(a,o)))})),s.completed};const Qo=new Map([["_monitor/testing/only",Ko],["_update/testing/only",Wo],["_legacy/bidRequest/monitor",Ko],["_legacy/bidRequest/didComplete",Wo]]);var Yo=new ut({scope:"prebid",object:"analyticsEvent",action:"track",handler:async({account:t,customEvent:e})=>{if(void 0===e.detail?.eventType||void 0===e.detail?.eventArgs||void 0===e.detail?.config?.options?.accountID)return{status:s.cancelled};const n={eventType:e.detail.eventType,metadata:e.detail.metadata,config:e.detail.config},o=await t.globalContext.fetch("https://prod.us-east-1.cxm-bcn.publisher-services.amazon.dev/v1/events/prebid",Zo(e.detail));return o.ok?{status:s.completed,analytics:n}:{status:s.cancelled,analytics:{...n,message:`Request failed: ${o.status}`}}}});const Zo=t=>{const e={accountId:t.config.options.accountID,events:[{eventArgs:t.eventArgs,eventType:t.eventType}]};return{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}},Xo={key:"prebid/config",default:void 0};var ta;!function(t){t.NotStarted="NOT STARTED",t.Loading="LOADING",t.Complete="COMPLETE"}(ta||(ta={}));const ea={key:"prebid/configRequestState",default:ta.NotStarted};var na=new ut({scope:"prebid",object:"config",action:"fetch",handler:async({account:t,customEvent:e})=>{const n=t.use(ea);if(n===ta.Loading)return{status:s.waiting};const o={metadata:e?.detail?.metadata};if(n===ta.Complete){const e=t.use(Xo);if(void 0!==e)return{status:s.completed,value:JSON.parse(e),analytics:o}}try{t.update(ea,(()=>ta.Loading));const e=`https://c.amazon-adsystem.com/cdn/prod/config?src=${t.id}`,n=await t.globalContext.fetch(e);if(t.update(ea,(()=>ta.Complete)),!n.ok)return{status:s.cancelled,analytics:{...o,message:"Config request failed"}};const a=await n.json(),i=oa(t,a);return t.update(Xo,(()=>JSON.stringify(i)),{persist:!0}),{status:s.completed,value:i,analytics:o}}catch(t){return{status:s.cancelled,analytics:{...o,message:t.message}}}}});const oa=(t,e)=>({analyticsConfig:{options:{accountID:t.id,sampling:e.pbjs?.sampleRate},includeEvents:e.pbjs?.allowedEvents},idConfig:{params:{accountID:t.id,enabled:e.pbjs?.enabled,treatments:e.pbjs?.treatments}}}),aa={key:"prebid/eidsConfig",default:"{}"};var ia;!function(t){t.APSSignalIQ="_apsIdTreatment",t.Audigent="hadronId",t.FirstID="firstId",t.ID5="id5id",t.Liveramp="idl_env",t.Lotame="lotamePanoramaId",t.Pubcommon="pubcid",t.Publink="publinkId",t.ThirtyThree="33acrossId",t.Yahoo="connectId"}(ia||(ia={}));const sa=new Map([[Ye,ia.Audigent],[nn,ia.FirstID],["id5",ia.ID5],[_n,ia.Liveramp],[Mn,ia.Lotame],[Wn,ia.Pubcommon],[Zn,ia.Publink],[Je,ia.ThirtyThree],[uo,ia.Yahoo]]),ra={[ia.Audigent]:{source:"audigent.com",atype:1},[ia.FirstID]:{source:"first-id.fr",atype:1},[ia.ID5]:{source:"id5-sync.com",atype:1},[ia.Liveramp]:{source:"liveramp.com",atype:3},[ia.Lotame]:{source:"crwdcntrl.net",atype:1},[ia.Pubcommon]:{source:"pubcid.org",atype:1},[ia.Publink]:{source:"epsilon.com",atype:3},[ia.ThirtyThree]:{source:"33across.com",atype:1},[ia.Yahoo]:{source:"yahoo.com",atype:3}};var ca=new ut({scope:"prebid",object:"eidsConfig",action:"get",handler:async({account:t,customEvent:e})=>{if(void 0===t.globalContext.apstag?._atsaaiod)return{status:s.waiting};t.update(aa,(()=>JSON.stringify({...ra})),{persist:!0});const n={metadata:e?.detail?.metadata,config:e?.detail?.config};return{status:s.completed,analytics:n}}});const da=new Set(["CONTROL_HOLD_OUT","CLEAN",...sa.keys()]);const la={key:"prebid/ids",default:void 0};var ua=new ut({scope:"prebid",object:"ids",action:"get",handler:async({account:t,customEvent:e})=>{if(void 0===t.globalContext.apstag?._atsaaiod)return{status:s.waiting};t.recordListenerNonBlocking(_o);const n=t.use(ge);let o;void 0!==n&&(o=Object.fromEntries(Object.entries(n).map((([t,e])=>[sa.get(t),e]))));const a=await t.recordListener(na,{metadata:e?.detail?.metadata}),i={metadata:e?.detail?.metadata};return a.idConfig.params.enabled?(null!=a.idConfig.params.treatments&&(o=function(t,e){if(!function(t){const e=100===t.reduce(((t,{percent:e})=>t+e),0),n=t.reduce(((t,{treatment:e})=>t&&da.has(e)),!0);return e&&n}(e))return t;const n=function(t){const e=100*Math.random();let n=0;for(const o of t)if(n+=o.percent,e<=n)return o.treatment;throw new Error("Invalid treatment percentages")}(e);return function(t,e){const n={[ia.APSSignalIQ]:e},o=sa.get(e);switch(e){case"CONTROL_HOLD_OUT":return{...t,...n};case"CLEAN":return n;default:return void 0!==o&&void 0!==t?.[o]&&(n[o]=t[o]),n}}(t,n)}(o,a.idConfig.params.treatments)),t.update(la,(()=>o)),{status:s.completed,value:o,analytics:i}):{status:s.cancelled,analytics:i}}});const pa=pt([Yo,na,ca,ua]),ma=t=>t===fa.noConsent?"AMZN-NoCookieConsent":"AMZN-Token";var fa;!function(t){t[t.noConsent=0]="noConsent",t[t.token=1]="token"}(fa||(fa={}));const ha=t=>{t.setCookieStorage(ma(fa.token),"",0),t.setCookieStorage(ma(fa.noConsent),"",0)},va=({account:t,hashedRecords:e,ttl:n,isGDPRRegion:o,tcString:a,setToken:i})=>(ha(t),"boolean"!=typeof i&&(i=!0),ya({account:t,hashedRecords:e,ttl:n,isGDPRRegion:o,tcString:a}).then((({AIPToken:e,cookieExpiry:n})=>ga({AIPToken:e,cookieExpiry:n,account:t,setToken:i})))),ya=({account:t,hashedRecords:e,ttl:n,isGDPRRegion:o,tcString:a})=>fetch("https://tk.amazon-adsystem.com/envelope",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(wa({account:t,hashedRecords:e,ttl:n,isGDPRRegion:o,tcString:a}))}).then((t=>{if(!t.ok)throw new Error(`Token http status error: ${t.status}`);return t.json()})),ga=({AIPToken:t,cookieExpiry:e,account:n,setToken:o})=>{if("string"!=typeof t||"number"!=typeof e)throw new Error("Invalid AIPES response");if(""===t)throw n.setCookieStorage(ma(fa.noConsent),"1",e),new Error("Empty token");(o||"boolean"!=typeof o)&&n.setCookieStorage(ma(fa.token),t,e)},wa=({account:t,hashedRecords:e,ttl:n,isGDPRRegion:o,tcString:a})=>{const i={publisherId:t.id,hashedRecords:e};return void 0!==n&&(i.ttl=n),o?(i.gdpr=1,a&&(i.gdprConsent=a)):i.gdpr=0,i};var ba=new ut({scope:"ad",object:"record",action:"delete",handler:async({account:t})=>{if(!t.globalContext.apstag?._atsaaiod)return{status:s.waiting};if(!t.isAllowedToAccessInfoOnDevice())throw new Error("Not allowed to access storage on device");return ha(t),{status:s.completed}}});const Ea={detail:tt,"detail.setCookie":st(X),"detail.config":tt,"detail.config.optOut":st(X),"detail.config.ttl":st(Y),"detail.config.gdpr":st(tt),"detail.config.gdpr.cmpTimeout":st(Y),"detail.config.gdpr.enabled":st(dt),"detail.config.gdpr.consent":st(Z),"detail.config.gdpr.cmpGlobal":st(Z),"detail.config.gdpr.cmpGlobalv2":st(Z),"detail.config.hashedRecords":ot,"detail.config.hashedRecords[]":tt,"detail.config.hashedRecords[].type":Z,"detail.config.hashedRecords[].record":Z,"detail.config.hashedRecords[].encrypted":st(Y),"detail.config.hashedRecords[].toJSON":ct,"detail.config.hashedRecords[].$$typeof":ct,"detail.config.hashedRecords[].constructor":ct,"detail.config.hashedRecords[].tagName":ct,"detail.config.hashedRecords[].@@__IMMUTABLE_ITERABLE__@@":ct,"detail.config.hashedRecords[].@@__IMMUTABLE_RECORD__@@":ct};var Sa,xa,_a=new ut({scope:"ad",object:"record",action:"renew",validators:{detail:Ea,context:{context:tt}},handler:async({account:t,detail:e})=>{if(!t.globalContext.apstag?._atsaaiod)return{status:s.waiting};if(void 0===e?.config)throw new Error("Missing tokenConfig object");if(!t.isAllowedToAccessInfoOnDevice())throw new Error("Not allowed to access storage on device");if((t.readCookieStorage(ma(fa.token))??"").length>0)return{status:s.cancelled};const n=t.globalContext.apstag.isGDPRRegion,o=t.use(Rt);var a;return await(a={account:t,hashedRecords:e.config.hashedRecords,ttl:e.config.ttl,isGDPRRegion:n,tcString:o?.tcString},va(a)),{status:s.completed}}});!function(t){t.email="email"}(Sa||(Sa={})),function(t){t.Display="display",t.Video="video",t.MultiFormat="multi-format"}(xa||(xa={}));const Ra=/^[0-9a-fA-F]{64}$/,Aa=t=>Ra.test(t||""),Ia=t=>t.then((t=>Array.from(new Uint8Array(t)).map((t=>t.toString(16).padStart(2,"0"))).join(""))).then((t=>"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"!==t?t:"")),ja=(t,e)=>"string"==typeof t&&(e===Sa.email?/\S+@\S+\.\S+/.test(t)||Aa(t):t.trim().length>0),ka=(t,e,n)=>e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement?ja(e.value,n)?Ia(t.globalContext.crypto.subtle.digest("SHA-256",(new t.globalContext.TextEncoder).encode(e.value||""))):Promise.resolve(""):ja(e.innerText,n)?Ia(t.globalContext.crypto.subtle.digest("SHA-256",(new t.globalContext.TextEncoder).encode(e.innerText||""))):Promise.resolve(""),$a=(t,e,n)=>{const o=t.readLocalStorage(e);return o&&ja(o,n)?o:""},Ca=(t,e,n)=>{n=n??t.globalContext.location.href,e=e.replace(/[[\]]/g,"\\$&");const o=new RegExp("[?&#]"+e+"(=([^&#?]*)|&|#|$)").exec(n);return Array.isArray(o)&&"string"==typeof o[2]&&0!==decodeURIComponent(o[2].replace(/\+/g," ")).trim().length&&Aa(decodeURIComponent(o[2].replace(/\+/g," ")))?Promise.resolve(decodeURIComponent(o[2].replace(/\+/g," "))):new Promise((t=>t("")))};var Oa;!function(t){t.LOCAL_STORAGE="LOCAL",t.CSS_SELECTOR="CSS",t.URL="URL"}(Oa||(Oa={}));const Pa=(t,e={},n)=>{(t=>{const e={[Oa.LOCAL_STORAGE]:5,[Oa.URL]:4,[Oa.CSS_SELECTOR]:3},n={};t.forEach((t=>{n[t.method]=(n[t.method]||0)+1,t.priority=n[t.method]})),t.sort(((t,n)=>t.method===n.method?(t.priority||0)>(n.priority||0)?1:-1:e[t.method]>e[n.method]?-1:1))})(e.methods||[]);const o=[];let a;for(const i of e.methods||[]){const{method:e,target:s,type:r}=i;let c="";switch(e){case Oa.LOCAL_STORAGE:c=$a(t,s,r);break;case Oa.URL:o.push(Ca(t,s).then((t=>({type:r,value:t}))));break;case Oa.CSS_SELECTOR:a=i}if(c.length>0)return void n({value:c,type:r})}const i=()=>{if(!a||!0!==a.isGlobalSubmit&&("string"!=typeof a.eventTarget||"string"!=typeof a.event))return void n(!1);const{eventTarget:e,target:o,type:i,isGlobalSubmit:s}=a,r=s?"submit":a.event;if("string"!=typeof r||0===r.length)return void n(!1);const c=a=>(({account:t,e:e,eventTarget:n,event:o,isGlobalSubmit:a,target:i,type:s,onDone:r,listener:c})=>{if(!(a||"window"===n||e.target&&"function"==typeof e.target.matches&&"string"==typeof n&&e.target.matches(n)))return void r(!1);let d;a&&e instanceof Event&&e.target&&(d=e.target.querySelectorAll('input[type="email"]')),((t,e,n,o)=>{const a=o||t.globalContext.document.querySelectorAll(e);if(0===a.length)return new Promise((t=>t("")));if(1===a.length)return ka(t,a[0],n);const i=[];for(const e of a)i.push(ka(t,e,n));return Promise.all(i).then((t=>{let e=null;for(const n of t)if(""!==n){if(null!==e&&("string"!=typeof e||e!==n))return"";e=n}return e??""}))})(t,i,s,d).then((e=>{"function"==typeof c&&t.globalContext.removeEventListener(o,c),r(!(e.length<1)&&{value:e,type:s})}))})({account:t,e:a,event:r,eventTarget:e,isGlobalSubmit:s,target:o,type:i,onDone:n,listener:c});t.globalContext.addEventListener(r,c)};if(0!==o.length)return Promise.all(o).then((t=>{for(const e of t)if(e.value.length>0)return void n(e);i()}));i()},Da={called:!1};const Ta=pt([ba,_a,new ut({scope:"ad",object:"record",action:"rr",validators:{detail:{detail:tt,"detail.config":tt,"detail.config.$$typeof":ct,"detail.config.tagName":ct,"detail.config.@@__IMMUTABLE_ITERABLE__@@":ct,"detail.config.@@__IMMUTABLE_RECORD__@@":ct,"detail.config.accountID":st(Z),"detail.config.overrideLimit":st(X),"detail.config.methods":ot,"detail.config.methods[].tagName":ct,"detail.config.methods[]":it(tt),"detail.config.methods[].$$typeof":ct,"detail.config.methods[].@@__IMMUTABLE_ITERABLE__@@":ct,"detail.config.methods[].@@__IMMUTABLE_RECORD__@@":ct,"detail.config.methods[].type":at(Object.values(Sa)),"detail.config.methods[].method":at(Object.values(Oa)),"detail.config.methods[].target":st(Z),"detail.config.methods[].event":st(Z),"detail.config.methods[].eventTarget":st(Z),"detail.config.methods[].isGlobalSubmit":st(X),"detail.config.methods[].priority":st(Y)},context:{context:tt,"context.Promise":rt,"context.crypto":tt,"context.crypto.subtle":rt}},handler:async({account:t,detail:e})=>{if(!t.globalContext.apstag?._atsaaiod)return{status:s.waiting};if(!t.isAllowedToAccessInfoOnDevice())throw new Error("Not allowed to access storage on device");const n=await function(t,e){return new Promise(((n,o)=>{if(Da.called&&!e.overrideLimit)throw new Error("rr should only be called once per page load");Da.called=!0;let a=0;const i=()=>{const s=(()=>{const a=t.use(Rt);return(!t.globalContext.apstag?.isGDPRRegion||void 0!==a)&&(void 0===a||t.isAllowedToAccessInfoOnDevice()?(Pa(t,e,(e=>{if(!1===e)return n("no retrieval");va({account:t,hashedRecords:[{type:e.type,record:e.value}],source:"rr",tcString:a?.tcString}).then((()=>{n("token generated")})).catch(o)}))?.catch(o),!0):"canceled")})(),r=a>6400;if(s||r)return"canceled"===s&&o(new Error("tcf timeout")),void(r&&o(new Error("interval over")));setTimeout(i,a),a=0===a?200:2*a};i()}))}(t,e.config);return{status:s.completed,analytics:{rr:n}}}}),new ut({scope:"ad",object:"record",action:"update",validators:{detail:Ea,context:{context:tt}},handler:async({account:t,detail:e})=>{if(!t.globalContext.apstag?._atsaaiod)return{status:s.waiting};if(!t.isAllowedToAccessInfoOnDevice())throw new Error("Not allowed to access storage on device");const n=t.globalContext.apstag.isGDPRRegion,o=t.use(Rt);return e.config.optOut?ha(t):await va({account:t,hashedRecords:e.config.hashedRecords,ttl:e.config.ttl,isGDPRRegion:n,tcString:o?.tcString,setToken:e?.setCookie}),{status:s.completed}}})]),Na=new Map([["ad/ASRSlot/render",async({account:t,customEvent:e})=>{if(void 0===e.detail?.id||void 0===e.detail?.targeting)throw new Error("Missing event detail");return((t,e,n,o)=>{const a=n.globalContext.document.createElement("iframe"),i=e.get("amznsz")?.split("x"),s=e.get("amzniid"),r=t;if(void 0===s||void 0===r||void 0===i||i.length<2)return;a.style.marginLeft="0",a.style.marginTop="0",a.style.height=`${i[1]}px`,a.style.width="100%",a.setAttribute("scrolling","no"),a.setAttribute("frameborder","0");const c=n.globalContext.document.createElement("div"),d=o?.location??"afterend",l=n.globalContext.document.getElementById(r);if(null==l)return;l.insertAdjacentElement(d,c),c.appendChild(a);const u=a?.contentWindow?.document;void 0!==u&&(u.open(),u.write('