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