/*! web-client-bundle - v25.828.1817 - 2025-08-28 18:17:00 */ !function(){"use strict";const t=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function e(t){const e=(new TextEncoder).encode(t);let n=2166136261;for(let t=0;t>>0}const n=(t,e=200)=>t.length<=e?t:`${t.substring(0,e)}...`;let o=!1;try{((t,e)=>{const o=new Set,s=[];try{const e=t.top?.location.hostname;e&&o.add(e)}catch(t){const e=t;s.push(n(e.message))}try{o.add(t.location.hostname)}catch(t){const e=t;s.push(n(e.message))}try{const e=t.location.href;o.add(new URL(e).hostname)}catch(t){const e=t;s.push(n(e.message))}try{const t=e.URL;o.add(new URL(t).hostname)}catch(t){const e=t;s.push(n(e.message))}if(0===o.size)throw new Error(`Unable to determine hostname: ${JSON.stringify(s)}`);return o})(window,document).forEach((n=>{o||(o=((t,n)=>{for(let o=0;o<5;o++){const s=e(t+o.toString())%8e3,r=s%8;if(!(n[Math.floor(s/8)]&1<t<0?0:t>=0&&t<=1?t:1;"number"==typeof t?.error&&this.p.set("error",e(t.error)),"number"==typeof t?.feat&&this.p.set("feat",e(t.feat))}clearAndUpdateEventProcessingInterval(t){"number"!=typeof t||t<=0||t!==this.v&&(clearInterval(this.S),this.S=setInterval((()=>{try{this.processEventRecords()}catch(t){}}),t),this.v=t)}processEventRecords(){const t=[],e=Array.from(this.m.keys());for(let n=0;n=this.l&&(o.length=0,this.logEvent({eventCategory:i,eventName:"queue limit reached"}));continue}const s=o.filter((t=>void 0!==t&&a>=Math.random()));o.length=0,t.push(...s)}if(0!==t.length)for(let e=0;e{}))}encodeRecords(t){return t.forEach((t=>{t.Data=window.btoa(JSON.stringify(t.Data))})),t}async sendRecords(t){await fetch(`${this.i}?encoded=${a()?"false":"true"}`,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":this.o},body:JSON.stringify({Records:a()?t:this.encodeRecords(t)})})}}const r={key:"_config/requestViewer/countryCode",default:"unknown"},c=new class{constructor(){this.STACK_MAX_LENGTH=500,this._=new s}fireReferencePixel(t){Math.random()<.01&&this.logCoreError({id:`REFERENCE-${t}`,error:new Error(`REFERENCE-${t}`),account:null})}logCoreError(t){this.logError({...t,isCore:!0})}logCoreFeature(t){this.logFeature({...t,isCore:!0})}logError(t){void 0!==t&&this._.logEvent({eventCategory:"error",eventName:t.id??"unknown",eventSource:t.eventSource,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){void 0!==t&&this._.logEvent({eventCategory:"feat",eventName:t.id??"unknown",eventProperties:{...t.props,...this.getSharedEventProperties(t),status:t.feature}})}setEventProcessingInterval(t){if("number"!=typeof t)throw new Error("Event processing interval must be a number.");this._.clearAndUpdateEventProcessingInterval(t)}setEventSamplingRates(t){"number"==typeof t?.error&&this._.setSampleRates({error:t.error}),"number"==typeof t?.feature&&this._.setSampleRates({feat:t.feature})}getSharedEventProperties(e){return{isCore:e.isCore??!1,accountID:this.safelyGetAccountID(e.account),libraryVersion:e.libraryVersion??t,url:this.getLocationHref(),hostname:this.getLocationHostname(),viewerCountryCode:this.getViewerCountryCode(e.account)}}safelyGetAccountID(t){let e="unknown";try{void 0!==t?.id&&(e=t.id)}catch(t){try{e=`Client Error: ${t.name.toString()} - ${t.message}`}catch{e="Client Error: Unable to provide more information"}}return e}getLocationHref(){let t="";try{t=window.top?.location?.href??""}catch(e){try{t=`Client Error: ${e.name.toString()} - ${e.message}`}catch{t="Client Error: Unable to provide more information"}}return t}getLocationHostname(){let t="";try{t=window.top?.location?.hostname??""}catch(e){try{t=`Client Error: ${e.name.toString()} - ${e.message}`}catch{t="Client Error: Unable to provide more information"}}return t}getViewerCountryCode(t){let e="unknown";try{null!==t&&(e=t.use(r))}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}};var d;!function(t){t.postulate="postulate",t.genericError="error"}(d||(d={}));const l="25.828.1817";function u(t,e,n){const i=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 a={...n,eventSource:"aps_web_client_library",eventCategory:o,eventName:e,libraryVersion:l};Object.entries(a).forEach((([t,e])=>{i.searchParams.append(t,e)})),fetch(i.toString(),{method:"GET",keepalive:!0,headers:{"x-api-key":"79db72eb0b5c7255afa54a253df24fb4a5ac916bf40b51c730df8850aa5665ca"}}).catch((()=>{}))}const p={A:setInterval,R:function(){return window[m]?.[f]},I:function(t=window){try{return t.top?.location||{href:"unknown",hostname:"unknown"}}catch(t){return{href:"unknown",hostname:"unknown"}}},$:u,D:function(t,e){return{eventTime:h((()=>`${Date.now()}`)),accountID:h((()=>t?.accountID)),libraryVersion:l,url:h((()=>e().href)),hostname:h((()=>e().hostname)),message:h((()=>t?.message)),condition:h((()=>t?.condition))}},j:function(t,e){try{(e??u)(d.genericError,"telemetry_core_failure",{errorName:t?.name??"unknown",errorMessage:t?.message??"unknown"})}catch{(e??u)(d.genericError,"telemetry_core_failure")}}},m="_aps_telemetry",f="alarms";function h(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)}}var v,g,y,w;!function(t){t.push="push",t.listenerSuccess="listenerSuccess",t.direct="direct"}(v||(v={})),function(t){t.internal="internal",t.apstag="apstag",t.webpage="webpage",t.dtbm="dtbm"}(g||(g={})),function(t){t.completed="completed",t.waiting="waiting",t.cancelled="cancelled"}(y||(y={})),function(t){t.started="started",t.error="error",t.unknown="unknown",t.deactivated="deactivated",t.analytics="analytics"}(w||(w={}));const b={...y,...w},E=new Map([["_config/config/didLoad",async({account:t,customEvent:e})=>(t.write("config/loaded",!0),y.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(r,(()=>n)),y.completed}]]),S="apstag/configuration/fetch",x=new Map([[S,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)}))})),y.completed}]]);const _=new WeakMap;function A(t,e,n="root",i="."){const o={nonModifiable:{set(t,e){throw new Error(`Cannot set property "${String(e)}": "${n}" is not marked as modifiable.`)},deleteProperty(t,e){throw new Error(`Cannot delete property "${String(e)}": "${n}" is not marked as modifiable.`)},defineProperty(t,e){throw new Error(`Cannot define property "${String(e)}": "${n}" is not marked as modifiable.`)},setPrototypeOf(t){throw new Error(`Cannot set prototype: "${n}" is not marked as modifiable.`)}},modifiable:{set(t,e,n,i){try{return Reflect.set(t,e,n,i)}catch(i){if("TypeError"===i.name)return t[e]=n,!0;throw i}}},validating:{get(t,o,a){if("raw"===o)return _.get(a)||t;if("symbol"==typeof o)return Reflect.get(t,o,a);if((t=>{if(["asymmetricMatch","nodeType"].includes(t))return!0})(o))return Reflect.get(t,o,a);let s;try{s=Reflect.get(t,o,a)}catch(e){if("TypeError"!==e.name)throw e;s=t[o]}return A(s,e,`${n}${i}${String(o)}`)},ownKeys:t=>Reflect.ownKeys(t).filter((t=>{const o=`${n}${i}${String(t)}`;return void 0!==e[o]}))},function:{apply:(t,i,o)=>{const a=_.has(i)?_.get(i):i;return A(t.apply(a,o),e,`${n}()`)},get:(t,e,n)=>"raw"===e?_.get(n)||t:Reflect.get(t,e,n)}},a=function(i){if(!1===i.verifiable)return t;if(t instanceof Set)return t.forEach((t=>{A(t,e,`${n}.value`)})),t;if(t instanceof Map)return t.forEach(((t,i)=>{A(i,e,`${n}.key`),A(t,e,`${n}.value`)})),t;if(Array.isArray(t))return t.map((t=>A(t,e,`${n}[]`)));if("function"==typeof t){const e=new Proxy(t,o.function);return _.set(e,t),e}const a={...o.validating,...i?.modifiable?o.modifiable:o.nonModifiable};try{const e=new Proxy(t,a);return _.set(e,t),e}catch(e){if("TypeError"===e.name)return t;throw e}}(function(){const i=e[n];if(void 0===i){const t=".constructor"===(n??"").slice(-12)||".toString"===(n??"").slice(-9);!function(t,e,n){const i=()=>!1;throw n||function(t,e,n){const i=window;void 0===i[m]&&(i[m]={}),void 0===i[m][f]&&(i[m][f]=[]);const o=i[m][f],a=e.toString();o.push({hash:t,context:{...n,condition:a}})}(t,i,e),new Error(e?.message??`Postulate violation: ${t}, ${i}`)}("ea3914",{message:`Unauthorized usage for "${n}": No validator has been defined`},t)}if(null===i)return{verifiable:!1};let o;try{o=i(t,n)}catch(e){let i="Error, could not convert to string";try{i="string"==typeof t?'"'+t+'"':null!=t&&"function"==typeof t.toString?t.toString():Object.prototype.toString.call(t)}catch(t){}throw new Error(`Validation failed for "${n}": ${e.message} - Received: ${i}`)}return o??{}}());return a}const R=t=>{if("number"!=typeof t)throw new Error("must be a number")},I=t=>{if("string"!=typeof t)throw new Error("must be a string")},$=t=>{if("boolean"!=typeof t)throw new Error("must be a boolean")},k=t=>{if("object"!=typeof t||null===t||Array.isArray(t))throw new Error("must be a standard object")},D=t=>e=>{let n=!1;for(const i of t)try{i(e),n=!0}catch(t){}if(!n)throw new Error("None of the validators passed")},j=t=>{if(!Array.isArray(t))throw new Error("must be an array")};function C(t){return e=>{if(!1===t.includes(e))throw new Error(`must be one of the following values: ${JSON.stringify(t)}`)}}function O(t){return(e,n)=>({modifiable:!0,...t(e,n)})}function P(t){return(e,n)=>{if(t===N)throw new Error("isAny cannot be used within isOptional");if(null!=e)return t(e,n)}}const L=t=>{if("function"!=typeof t)throw new Error("must be a function")},N=()=>{},T=()=>({verifiable:!1}),M=t=>{if(void 0!==t)throw new Error("must be undefined")};class U{constructor(t){const{scope:e,object:n,action:i,validators:o,handler:a}=t;this.throwIfInvalid(e,n,i),this.name=`${e}/${n}/${i}`,this.handler=this.wrapHandler(a,o)}wrapHandler(t,e){return async n=>{let i=n;return i={...i,detail:A(i.customEvent.detail,e?.detail??{detail:N},"detail"),context:A(i.account.globalContext,e?.context??{context:N},"context")},await t(i)}}throwIfInvalid(t,e,n){if(["consent/gppapi/attemptSync","consent/gppapi/didChange","consent/gppapi/syncData","consent/tcfapi/attemptSync","consent/tcfapi/didChange","log/analytics/setInterval","analytics/sampling/set"].includes(`${t}/${e}/${n}`))return;const i=/^[a-z0-9][a-zA-Z0-9]*$/;if(!i.test(t)||!i.test(e)||!i.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 q(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])))}const F="consent/isGPPListenerRegistered",z="debugSession/end",V="prepend/events",J="populator/ran",B={key:"consent/hasPurposeOneConsent",default:!1};class G{constructor(t){this.getItem=t=>{const e=this.globalContext.document.cookie.split("; ").reduce(((e,n)=>{const i=n.split("=");return i[0]===t?decodeURIComponent(i.slice(1).join("=")):e}),"");return e.length>0?e:null},this.removeItem=(t,e="/")=>{this.setItem(t,"",0,e)},this.setItem=(t,e,n,i="/")=>{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=${i};`},this.globalContext=t}isValidDate(t){return t instanceof Date&&!isNaN(t)}}const H=["scope/objectName",z,V];function K(t){return null===t||"object"!=typeof t?t:t instanceof Date?new Date(t.getTime()):t instanceof Array?t.reduce(((t,e)=>(t.push(K(e)),t)),[]):t instanceof Set?Array.from(t.values()).reduce(((t,e)=>(t.add(K(e)),t)),new Set):t instanceof Map?Array.from(t.entries()).reduce(((t,e)=>(t.set(e[0],K(e[1])),t)),new Map):t instanceof Object?Object.keys(t).reduce(((e,n)=>(e[n]=K(t[n]),e)),{}):t}class W{constructor(t,e){const n=e.rootName;this.globalContext=e.globalContext;const i=this.globalContext[n].get(t);if(null==i)throw new Error(`Missing "${t}" account in userspace object`);this.id=t,this.store=i.store,this.queue=i.queue,this.store.has("listeners")||this.store.set("listeners",new Map)}async record(t,e){return await new Promise(((n,i)=>{this.queue.push(new CustomEvent(t,{detail:{resolve:n,reject:i,source:g.internal,...e}}))}))}async recordListener(t,e){return await new Promise(((n,i)=>{this.queue.push(new CustomEvent(t.name,{detail:{resolve:n,reject:i,source:g.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 i=e?.default?.generators?.get(t);return void 0!==i?i(...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 i=this.store.get(t.key);if(void 0!==i)n=i;else if(void 0!==e?.persist&&e.persist){const i=this.readLocalStorage(t.key,{usePrefix:!0,throwOnDisallowed:e.throwOnDisallowed});null!=i&&(n=i)}const o=n??t.default;if("function"==typeof o||!1===e?.structuredClone)return o;try{return structuredClone(o)}catch(t){try{return K(o)}catch(t){return c.logCoreError({id:"Core.library.Account.use",account:null,error:t}),o}}}update(t,e,n){let i=e(this.use(t,{...n,throwOnDisallowed:n?.throwOnDisallowed}));if(void 0!==t.postProcessor&&(i=t.postProcessor(i)),this.store.set(t.key,i),void 0!==n?.persist&&n.persist){if("string"!=typeof i)throw new Error(`${JSON.stringify(i)} must be a string to be writtable to browser storage`);this.writeLocalStorage(t.key,i,{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){c.logError({...t,account:this})}recordStatusChangeEvent(t){c.logFeature({id:t.id,account:this,feature:t.status,props:{...t.props}})}recordGenericEvent(t){c.logFeature({id:t.id,account:this,feature:t.id,props:{...t.props}})}isAllowedToAccessInfoOnDevice(){return this.updateUserConsent(),this.use(B)}isAPStagAllowedToAccessInfoOnDevice(){return!0===this.globalContext.apstag._atsaaiod()}updateUserConsent(){try{const t=this.isAPStagAllowedToAccessInfoOnDevice();this.update(B,(()=>t))}catch(t){}}getPersistedItemName(t){return`aps:${this.id}:${t}`}isBrowserStorageAllowed(t){let e=!1;try{e=this.isAllowedToAccessInfoOnDevice()}catch{}return e||H.includes(t)}setCookieStorage(t,e,n,i){const o=i?.throwOnDisallowed??!0;if(!this.isBrowserStorageAllowed(t)){if(o)throw new Error(`${t} is not allowed to be set on cookie storage`);return}const a=i?.usePrefix?this.getPersistedItemName(t):t;return new G(this.globalContext).setItem(a,e,n,i?.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 i=e?.usePrefix?this.getPersistedItemName(t):t;return new G(this.globalContext).getItem(i)}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 i=e?.usePrefix?this.getPersistedItemName(t):t;return this.globalContext.localStorage.getItem(i)??void 0}writeLocalStorage(t,e,n){const i=n?.throwOnDisallowed??!0;if(!this.isBrowserStorageAllowed(t)){if(i)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 i=e?.usePrefix?this.getPersistedItemName(t):t;this.globalContext.localStorage.removeItem(i)}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 i=e?.usePrefix?this.getPersistedItemName(t):t;if(i in this.globalContext.sessionStorage)return this.globalContext.sessionStorage.getItem(i)}writeSessionStorage(t,e,n){const i=n?.throwOnDisallowed??!0;if(!this.isBrowserStorageAllowed(t)){if(i)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 i=e?.usePrefix?this.getPersistedItemName(t):t;this.globalContext.sessionStorage.removeItem(i)}}const Q="_system";class Y extends W{constructor(t,e){super(Q,{globalContext:t,rootName:e})}}class Z{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(Q)&&(this.getAccounts().set(Q,{queue:[],store:new Map}),new Y(this.globalContext,this.rootName).store.set(i,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.C({reason:{method:v.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 i=this.getAccounts().get(t);void 0!==i&&i.queue.push(new CustomEvent(e,{detail:n??{}}))},e=this.globalContext[this.rootName];e.triggerFor=t,e.trigger=(e,n)=>{t(Q,e,n)},void 0===e._private&&(e._private={}),e._private.CookieStorage=G}equip(){try{this.createUserspaceRoot(),this.createSystemAccount(),this.observeRootSet(),this.observeAccountQueuesPush(),this.overwriteAccountStoresGet(),this.defineConvenienceFunctions()}catch(t){throw new Y(this.globalContext,this.rootName).recordErrorEvent({id:"Core.library.Equiper.equip",error:t}),t}}}var X;!function(t){t.info="info",t.warn="warn",t.error="error"}(X||(X={}));class tt{static Instance(){return this.O}static SessionId(){return this.P}info(...t){const e=new Date(Date.now()),n=X.info;return console.log(this.getPrefix(e,n),...t),{timestamp:e,logLevel:n}}warn(...t){const e=new Date(Date.now()),n=X.warn;return console.warn(this.getPrefix(e,n),...t),{timestamp:e,logLevel:n}}error(...t){const e=new Date(Date.now()),n=X.error;return console.error(this.getPrefix(e,n),...t),{timestamp:e,logLevel:n}}getPrefix(t,e){return`${t.toISOString()} | ${tt.SessionId()} | [${e.toUpperCase()}]`}}tt.O=new tt,tt.P=`${Date.now()}`;const et=tt.Instance(),nt=t=>{if(void 0===t||!Array.isArray(t))return!0;let e,n=window;do{if(t.includes(n?.location?.hostname))return!0;if(n===window.top)break;e=n,n=n.parent}while(e!==n&&e!==window.top);return!1};function it(t){return!(t>=1||Number.isNaN(t))&&(t<=0||Math.random()>=t)}const ot={key:"_internal/eventSources",default:new Map},at={key:"_internal/processedEventSources",default:new Set},st=[b.completed,b.error,b.cancelled,b.analytics];class rt{constructor(t,e){this.globalContext=t,this.rootName=e}L(t){return t.store.get("_config/events/deactivations")??new Set}N(e,n){return!0===this.L(e).has(n.type)||((t,e)=>{try{const e=t.detail?.restrictions?.allow?.hostnames;if(void 0!==e&&!nt(e))return!0;const n=t.detail?.restrictions?.block?.hostnames;if(void 0!==n&&nt(n))return!0}catch(t){return e.recordErrorEvent({id:"hostnames",error:new Error(t)}),!1}return!1})(n,e)||(e=>{const n=e?.detail?.restrictions?.allow?.libraryVersions,i=e?.detail?.restrictions?.block?.libraryVersions;return!(!Array.isArray(i)||!i.includes(t))||!(!Array.isArray(n)||n.includes(t))})(n)||((t,e)=>{const n=t?.detail?.restrictions?.allow?.accounts,i=t?.detail?.restrictions?.block?.accounts;return!(!Array.isArray(i)||!i.includes(e.id))||!(!Array.isArray(n)||n.includes(e.id))})(n,e)||(t=>{const e=t?.detail?.restrictions?.allow?.rate??1;return!(!it(t?.detail?.restrictions?.block?.rate??1)&&!it(e))})(n)}T(){return new Y(this.globalContext,this.rootName).store.get(e)??new Map}M(t){return t.store.get("listeners")??new Map}U(t,e){return this.T().get(e.type)||this.M(t).get(e.type)}q(t){const e=this.F(o);return(void 0===t.externalEventCount||t.externalEventCount{setTimeout((()=>n(new Error(`Event "${e.type}" timed out`))),e.detail.timeout)})))}B(t,e){const n=new Y(this.globalContext,this.rootName),i=n.read(t)??0;n.write(t,i+e)}G(t){new Y(this.globalContext,this.rootName).write(t,0)}F(t){return new Y(this.globalContext,this.rootName).read(t)??0}H(t,e,n,i,o){if(!(e in b))throw new Error(`Listener returned invalid status: ${t.type} returned ${e}`);if(this.K(t,e,i,o),e!==b.waiting&&void 0!==t.detail?.resolve)try{t.detail.resolve(n)}catch(t){et.error(t)}this.C({reason:{method:v.listenerSuccess,events:[t]}})}W(t,e,n){void 0!==e&&"string"!=typeof e||(e=new Error(e)),this.K(t,b.error,n),this.Y(t,e),e.context=t.type,n.recordErrorEvent({id:t.type,error:e})}Z(t,e,n,i){const o=this.U(n,e);if(void 0===o)throw new Error(`No listener found for event: ${e.type}`);t.push(o({customEvent:e,account:n,systemAccount:i,detail:e.detail,context:n.globalContext}))}X(t,e,n){Promise.race(t).then((t=>{let i,o,a;void 0===t?i=y.completed:"string"==typeof t?i=t:"object"==typeof t&&(i=t.status,o=t.value,a=t.analytics,!0===e.detail?.surfaceAnalytics&&(void 0===o&&(o={}),o.analytics=a)),this.H(e,i,o,n,a)})).catch((t=>{this.W(e,t,n)}))}tt(t,e,n){const i=[];this.Z(i,t,e,n),this.J(i,t),this.X(i,t,e)}et(t,e){if(void 0!==t.status)return;const n=t.detail?.error;if(void 0!==n){t.status=b.error;const i=this.nt(n),o={id:t.type,error:i};"string"==typeof t.detail.source&&(o.eventSource=t.detail.source),"string"==typeof t.detail.libraryVersion&&(o.libraryVersion=t.detail.libraryVersion),null!=t.detail.analytics&&(o.props=t.detail.analytics),e.recordErrorEvent(o)}}nt(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}it(t,e){if(void 0!==t.status)return;const n=t.detail?.analytics;void 0!==n&&(t.status=b.analytics,e.recordStatusChangeEvent({id:t.type,status:t.status,props:{...n}}))}ot(t,e){this.N(e,t)&&this.K(t,b.deactivated,e)}st(t,e){void 0===t.status&&void 0===this.U(e,t)&&this.K(t,b.unknown,e)}Y(t,e){if(a()&&et.error(e),void 0!==t.detail?.reject)try{t.detail.reject(e)}catch(t){et.error(t)}}rt(t,e){const n=new Error(`Invalid account ID: "${e.id}"`);this.W(t,n,e)}static ct(t){return"string"==typeof t&&!["","undefined","true","false"].includes(t.trim())}lt(t,e,n){rt.ct(e.id)?(this.et(t,e),this.it(t,e),this.st(t,e),this.ot(t,e),this.V(t)&&(this.K(t,b.started,e),a()&&et.info(`## Execute event: ${t.type} with initial status ${t.status??"undefined"}`),this.tt(t,e,n))):this.rt(t,e)}ut(t){const e=new Y(this.globalContext,this.rootName).use(ot),n=t.use(at);e.forEach(((e,i)=>{if(n.has(i))return;const o=e.map((([t,e])=>new CustomEvent(t,{detail:e})));t.queue.unshift(...o),t.update(at,(t=>t.add(i)))}))}ft(t,e,n){this.ut(t),t.queue.forEach((n=>this.lt(n,t,e)))}ht(t,e){t.status=e,t.statusEvents=null!=t.statusEvents?t.statusEvents:[],t.statusEvents.push(new CustomEvent(e))}vt(t,e,n,i){const o=new CustomEvent("now").timeStamp,a=t.statusEvents?.find((t=>t.type===b.started)),s=null!=a?o-a.timeStamp:void 0;n.recordStatusChangeEvent({id:t.type,status:e,props:{...i,source:t.detail?.source,timers:{sinceCreated:o-t.timeStamp,sinceStarted:s}}})}K(t,e,n,i){t.status!==e&&(a()&&et.info(`### Update ${t.type} from ${t.status??"undefined"} to ${e}`),this.ht(t,e),this.vt(t,e,n,i))}gt(){const t=new Map;return this.globalContext[this.rootName].forEach(((e,n)=>t.set(n,new W(n,{globalContext:this.globalContext,rootName:this.rootName})))),t}yt(t){if(a())return;const e=t.store.get(n)??[];if(e.length>150){const i=e.slice(-100);t.store.set(n,i)}}wt(t){const e=t.store.get(n)??[];e.push(...t.queue.filter((t=>void 0!==t.status&&st.includes(t.status)))),t.store.set(n,e)}bt(t){t.queue.splice(0,t.queue.length,...t.queue.filter((t=>void 0===t.status||!st.includes(t.status))))}Et(){this.gt().forEach((t=>{this.wt(t),this.yt(t),this.bt(t)}))}St(t){return t?.filter((t=>t.detail?.source!==g.internal&&t.detail?.source!==g.apstag&&t.status!==b.waiting))}xt(t){const e=this.St(t);return e?.length??0}_t(t){const e=this.xt(t);this.B(o,e)}At(){const t="_internal/recentDispatches";this.B(t,1);const e=this.F(t);if(e>1e4)throw new Error("Too many dispatches. Aborting");e%100==0&&new Y(this.globalContext,this.rootName).recordGenericEvent({id:"C.l.D.thr",props:{recentDispatchesCount:e}}),setTimeout((()=>{this.G(t)}),100)}C({reason:t}){try{this.At(),a()&&et.info(`# Dispatch from method "${t.method}" on event "${t.events?.[0].type??"undefined"}" with source "${t.events?.[0].detail?.source??"undefined"}"\n_________________________________________`),this._t(t.events);const e=new Y(this.globalContext,this.rootName);this.gt().forEach((n=>this.ft(n,e,t))),this.Et()}catch(t){throw new Y(this.globalContext,this.rootName).recordErrorEvent({id:"C.l.D.dis",error:t}),t}}}class ct{constructor(t,e){this.globalContext=t,this.rootName=e}subscribe(t){try{const n=new Y(this.globalContext,this.rootName),i=null!=n.store.get(e)?n.store.get(e):new Map;n.store.set(e,new Map([...i,...t]))}catch(t){throw new Y(this.globalContext,this.rootName).recordErrorEvent({id:"Core.library.Subscriber.subscribe",error:t}),t}}}class dt{constructor(t,e){this.globalContext=t,this.rootName=e}populate(){try{const t=new Y(this.globalContext,this.rootName);let e=!1;try{e=JSON.parse(t.read(J))}catch{}if(e)return;t.write(J,JSON.stringify(!0)),this.populateFromPrependStore(),this.populateFromQueryParams()}catch(t){new Y(this.globalContext,this.rootName).recordErrorEvent({id:"Core.library.Populator.populate",error:t})}}populateFromPrependStore(){this.globalContext[this.rootName].forEach(((t,e)=>{const n=new W(e,{globalContext:this.globalContext,rootName:this.rootName}),i=n.read(V,{persist:!0})??"[]";n.write(V,JSON.stringify([]));try{const t=JSON.parse(i);if(0===t.length)return;n.queue.push(...t.map(ut))}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],i=n.get(Q);lt(e,"aps.trigger").forEach((t=>{i.queue.push(ut(t))})),lt(e,"aps.triggerFor",!0).forEach((t=>{void 0!==t.accountId&&n.has(t.accountId)&&n.get(t.accountId).queue.push(ut(t))}));const o=lt(e,"aps_event");n.forEach((t=>{o.forEach((e=>{t.queue.push(ut(e))}))}))}}const lt=(t,e,n=!1)=>{const i=t.getAll(e),o=[];return i.forEach((t=>{const e=t.split(",");let i;n&&(i=e.shift());const a=e.shift();if(void 0!==a&&a.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",a,n)}o.push({eventName:a.replace(/_/g,"/"),eventDetail:n,accountId:i})}})),o},ut=t=>new CustomEvent(t.eventName,{detail:{...t.eventDetail??{}}}),pt=window;class mt{constructor(t,e,n){this.ID=t,this.rootName=n,this.globalContext=e,this.clear()}clear(){new Y(this.globalContext,this.rootName).update(ot,(t=>(t.delete(this.ID),t)))}recordListener(t,e){new Y(this.globalContext,this.rootName).update(ot,(n=>{const i=n.get(this.ID);return void 0!==i?i.push([t.name,e]):n.set(this.ID,[[t.name,e]]),n}))}}class ft{constructor(t=pt,e="_aps"){this.dispatcher=new rt(t,e),this.equiper=new Z(t,e,this.dispatcher),this.subscriber=new ct(t,e),this.populator=new dt(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 W(t,{globalContext:this.globalContext,rootName:this.rootName})}subscribe(t){this.subscriber.subscribe(t)}equip(){this.equiper.equip()}dispatch({reason:t}){this.dispatcher.C({reason:t})}populate(){this.populator.populate()}load({listeners:t}){this.equip(),this.subscribe(t),this.dispatch({reason:{method:v.direct}}),this.populate()}registerEventSource(t){return this.equip(),new mt(t,this.globalContext,this.rootName)}}var ht=new U({scope:"consent",object:"gppapi",action:"syncData",validators:{detail:{detail:k,"detail.fromAddEvent":P($),"detail.eventListener":P(k),"detail.eventListener.pingData":P(k),"detail.eventListener.pingData.gppString":P(I),"detail.eventListener.pingData.gppVersion":P(D([I,R])),"detail.eventListener.pingData.cmpId":P(D([I,R])),"detail.eventListener.pingData.applicableSections":j,"detail.eventListener.pingData.applicableSections[]":D([I,R])}},handler:async({account:t,detail:e})=>{let n,i,o,a;(e?.eventListener?.pingData?.gppString??"").length>0?(n=e?.eventListener?.pingData,a="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),a="ping","object"!=typeof n&&([n,i]=(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),a="getGPPData"));const s={gpp:{gppLength:"string"==typeof n?.gppString?n.gppString.length:void 0,isGPPTilde:(n?.gppString??"").includes("~"),error10:i,error:o,gppVersion:n?.gppVersion,cmpId:n?.cmpId,method:a,fromAddEvent:e?.fromAddEvent}};return t.write("consent/GPPData",n),{status:y.completed,analytics:s}}}),vt=new U({scope:"consent",object:"gppapi",action:"didChange",validators:{detail:{detail:k,"detail.fromAddEvent":P($),"detail.eventListener":P(k),"detail.eventListener.pingData":P(k),"detail.eventListener.pingData.gppString":P(I),"detail.eventListener.pingData.gppVersion":P(D([I,R])),"detail.eventListener.pingData.cmpId":P(D([I,R])),"detail.eventListener.pingData.applicableSections":j,"detail.eventListener.pingData.applicableSections[]":D([I,R])}},handler:async({account:t,detail:{eventListener:e,fromAddEvent:n}})=>(await t.recordListener(ht,{eventListener:e,fromAddEvent:n}),{status:y.completed})}),gt=new U({scope:"consent",object:"gppapi",action:"attemptSync",handler:async({account:t})=>{if(void 0===t.globalContext.__gpp||!0===t.read(F))return{status:y.cancelled};await t.recordListener(ht);const e=t.globalContext.__gpp("addEventListener",(e=>{"error"!==e?.eventName&&t.recordListenerNonBlocking(vt,{eventListener:e,fromAddEvent:!0})}));return t.write(F,"listenerRegistered"===e?.eventName&&!0===e?.data),{status:y.completed}}});const yt={key:"consent/isTCFAPIListenerRegistered",default:!1},wt={key:"consent/TCData",default:void 0};function bt(t,e){return"string"==typeof e?.tcString&&e?.tcString.length>0||!0===t?.globalContext?.apstag?.isGDPRRegion||!0===e?.gdprApplies}function Et(t,e){return!0===t.vendor?.consents?.[793]&&(n=e,i=t.purpose?.consents,(n??[]).reduce(((t,e)=>t&&!0===i?.[e]),!0));var n,i}var St=new U({scope:"consent",object:"tcfapi",action:"didChange",validators:{detail:{detail:k,"detail.success":P($),"detail.tcData":P(D([I,k])),"detail.tcData.tcString":P(I),"detail.tcData.tcfPolicyVersion":P(R),"detail.tcData.cmpId":P(R),"detail.tcData.cmpVersion":P(R),"detail.tcData.useNonStandardStacks":P($),"detail.tcData.gdprApplies":P($),"detail.tcData.eventStatus":P(I),"detail.tcData.cmpStatus":P(I),"detail.tcData.listenerId":P(R),"detail.tcData.isServiceSpecific":P($),"detail.tcData.useNonStandardTexts":P($),"detail.tcData.publisherCC":P(I),"detail.tcData.purposeOneTreatment":P($),"detail.tcData.purpose":P(k),"detail.tcData.purpose.consents":P(T),"detail.tcData.purpose.legitimateInterests":P(T),"detail.tcData.vendor":P(k),"detail.tcData.vendor.consents":P(T),"detail.tcData.vendor.legitimateInterests":P(T),"detail.tcData.specialFeatureOptins":P(T),"detail.tcData.publisher":P(k),"detail.tcData.publisher.consents":P(T),"detail.tcData.publisher.legitimateInterests":P(T),"detail.tcData.publisher.customPurpose":P(k),"detail.tcData.publisher.customPurpose.consents":P(T),"detail.tcData.publisher.customPurpose.legitimateInterests":P(T),"detail.tcData.publisher.restrictions":P(T)}},handler:async({account:t,detail:{success:e,tcData:n}})=>(t.update(yt,(t=>t||!0===e)),t.update(wt,(t=>void 0!==n||!0===e?n:t)),"object"!=typeof n?{status:y.completed}:{status:y.completed,analytics:xt(t,n)})});const xt=(t,e)=>{const n={tcData:e,consents:[1]},i=t=>{try{return t()}catch{return"error"}};return{tcT:i((()=>t.isAPStagAllowedToAccessInfoOnDevice())),tcCC:i((()=>function({account:t,tcData:e,consents:n}){if(!bt(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 i=!1;return n.forEach((t=>{const o=e.publisher?.restrictions?.[t]?.[793];switch(o){case 0:case 2:i=!0;break;default:Et(e,n)||(i=!0)}})),!i}({...n,account:t}))),tcCF:i((()=>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((i=>{const o=t.publisher?.restrictions?.[i]?.[793];switch(o){case 0:n.push(`Invalid publisher restrictions 0, consent ${i}`);break;case 2:n.push(`Invalid publisher restrictions 2, consent ${i}`);break;default:Et(t,e)||n.push(`Invalid publisher restrictions default, consent ${i}`)}})),n)}catch(t){if(n.length>0)return n;throw t}}(n).length)),PRA:i((()=>bt(t,e)))}};var _t=new U({scope:"consent",object:"tcfapi",action:"attemptSync",handler:async({account:t})=>{const e=t.use(yt);return void 0===t.globalContext.__tcfapi||e?{status:y.cancelled}:(t.globalContext.__tcfapi("addEventListener",2,((e,n)=>{t.recordListenerNonBlocking(St,{tcData:e,success:n})})),{status:y.completed})}});const At=q([gt,vt,ht,_t,St]),Rt="vnd_prx_segments",It="aps_targeting_comscore";var $t=new U({scope:"cxm",object:"comscore",action:"set",handler:async({account:t,customEvent:e})=>({status:kt(t)})});const kt=t=>{const e=t.readSessionStorage(It);if(t.deleteSessionStorage(It),null==e)return y.cancelled;try{const n=JSON.parse(e)[Rt];if(null==n)throw new Error;const{googletag:i}=t.globalContext;return i.pubads().getSlots().forEach((t=>{t.setTargeting(Rt,n)})),y.completed}catch(t){throw new Error(`Malformed targeting object at ${It}`)}},Dt="aps_targeting_ias";var jt=new U({scope:"cxm",object:"ias",action:"set",handler:async({account:t,customEvent:e})=>({status:Ct(t)})});const Ct=t=>{const e=(t=>{const{iasApsArtifact:e}=t.globalContext;if(e)return e;const n=t.readSessionStorage(Dt);return n?(t.deleteSessionStorage(Dt),JSON.parse(n)):void 0})(t);if(null==e)return y.cancelled;try{const{googletag:n}=t.globalContext;n.pubads().getSlots().forEach((t=>{const n=e.targeting.slots[t.getSlotElementId()];null!=n&&Object.keys(n).forEach((e=>{t.setTargeting(e,n[e])}))}));const{brandSafety:i,fr:o,custom:a}=e.targeting;return null!=i&&Object.keys(i).forEach((t=>{n.pubads().setTargeting(t,i[t])})),null!=a&&Object.keys(a).forEach((t=>{const e=a[t];n.cmd.push((()=>n.pubads().setTargeting(t,e)))})),null!=o&&n.pubads().setTargeting("fr",o),y.completed}catch(t){throw new Error(`Malformed targeting object at ${Dt}`)}},Ot="aps_targeting_illuma";var Pt=new U({scope:"cxm",object:"illuma",action:"set",handler:async({account:t,customEvent:e})=>({status:Lt(t)})});const Lt=t=>{const e=t.readSessionStorage(Ot);if(t.deleteSessionStorage(Ot),null==e)return y.cancelled;const n=JSON.parse(e).results;if(null==n)throw new Error(`Malformed targeting object at ${Ot}`);const{googletag:i}=t.globalContext;return Object.keys(n).forEach((t=>{const e=n[t];i.pubads().setTargeting(`illuma_${t}`,JSON.stringify(e))})),y.completed};var Nt=new U({scope:"cxm",object:"contextual",action:"set",handler:async({account:t,customEvent:e})=>(await Promise.all([t.recordListener($t),t.recordListener(jt),t.recordListener(Pt)]),{status:y.completed})});const Tt=q([$t,Nt,jt,Pt]),Mt={key:"customPlacement/hints",default:{}},Ut={key:"customPlacement/bidResponses",default:{}};class qt{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-",i=new Map;return i.set(`${n}width`,e.width),i.set(`${n}margin`,e.margin),i.set(`${n}padding`,e.padding),Object.fromEntries(i.entries())}catch(t){return{}}},this.slotProps=t,this.rawResponse=e,this.Rt=n}getTagStyle(t){const e=this.Rt.getElementsByTagName(t);if(e&&e[0]){const e=window.getComputedStyle(this.Rt.getElementsByTagName(t)[0]),n=new Map,i="--aps-custom-page-";return n.set(`${i}${t}-color`,e.color),n.set(`${i}${t}-fontFamily`,e.fontFamily),n.set(`${i}${t}-fontSize`,e.fontSize),n.set(`${i}${t}-fontWeight`,e.fontWeight),n.set(`${i}${t}-lineHeight`,e.lineHeight),Object.fromEntries(n)}return{}}getDynamicFrameBodyHeight(t,e,n){if(e){const n=e?.contentDocument||e?.contentWindow?.document,i=n?.body.scrollHeight;e.style.height=`${i}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.It(t)}It(t){if(!this.rawResponse||!this.slotProps)return!1;try{const e=this.rawResponse.size.split("x"),n=this.rawResponse.targeting?.amzniid||this.rawResponse.amzniid,i=this.rawResponse.targeting?.amznadm||this.rawResponse.amznadm;if(!n)return!1;let o=this.slotProps.$t;if(this.slotProps.location&&this.slotProps.id){const t=this.Rt.createElement("div");this.Rt.getElementById(this.slotProps.id)?.insertAdjacentElement(this.slotProps.location,t),o=t}if(!o)return!1;const a=this.Rt.createElement("iframe");return a.style.marginLeft="0",a.style.marginTop="0",a.style.height=`${e[1]}px`,a.style.width="100%",a.setAttribute("data-testid","amzn-asr-ad"),a.setAttribute("scrolling","no"),a.setAttribute("frameborder","0"),a.onload=()=>this.getDynamicFrameBodyHeight(o,a,i?"amznadm":"admi"),a.srcdoc=i||"",t&&t.clickPrefix&&(a.srcdoc=a.srcdoc.replace(this.CLICK_PREFIX_MACRO,t.clickPrefix)),o.appendChild(a),this.updateSlotAttribute("status","rendered"),!0}catch(t){throw new Error("CustomPlacements: Error while rendering")}}updateSlotAttribute(t,e){this.slotProps.$t?.setAttribute(`data-aps-custom-${t}`,e)}}const Ft={key:"customPlacement/timings",default:[]},zt=(t,e,n=0,i=0)=>{try{const o={effectiveType:e?.effectiveType,rtt:e?.rtt,downlink:e?.downlink},a=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,i);return{connection:o,screen:a}}catch(t){return{}}},Vt=(t,e,n)=>{t.update(Ft,(t=>(t.push({time:performance.now(),key:`${e}/${n}`}),t)))},Jt="customPlacements";var Bt=new U({scope:"customPlacement",object:"hint",action:"process",validators:{},handler:async({account:t,detail:e,customEvent:n})=>{const i=e=>{Vt(t,Jt,`hint/process/${e}`);const n=t.use(Mt),i=t.use(Ut);n[e].isRendered||(Object.values(i).forEach((i=>{if(i.isRendered)return;const o=t.globalContext.document.getElementById(e);if(null==o)return;const a=new qt({id:e,$t:o},i,t.globalContext.document);Vt(t,Jt,`widget/render/${e}`),a.render(n[e].hintMetadata)&&(i.isRendered=!0,n[e].isRendered=!0)})),t.update(Mt,(()=>n)),t.update(Ut,(()=>i)))},o=t.use(Mt);return Object.keys(o).filter((t=>o[t].default)).forEach(i),Object.keys(o).filter((t=>!o[t].default)).forEach(i),{status:y.completed,analytics:{browserInfo:zt(t.globalContext.document,t.globalContext.navigator?.connection,t.globalContext.innerWidth,t.globalContext.innerHeight)}}}}),Gt=new U({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:i,isDefault:o,hintMetadata:a}=n.detail;Vt(t,Jt,`hint/define/${i}`);const s=t.use(Mt);return s[i]={default:"default"===o,isRendered:!1,hintMetadata:a??{}},t.update(Mt,(()=>s)),t.recordListenerNonBlocking(Bt),{status:y.completed,analytics:{browserInfo:zt(t.globalContext.document,t.globalContext.navigator?.connection,t.globalContext.innerWidth,t.globalContext.innerHeight)}}}});const Ht={key:"customPlacement/placementResponseDispatched",default:!1},Kt={key:"customPlacement/placementResponse",default:void 0},Wt={key:"customPlacement/contextURL",default:void 0},Qt={key:"customPlacement/placementEndpoint",default:"https://c.aps.amazon-adsystem.com/e/placements"},Yt={key:"ad/context",default:void 0};var Zt=new U({scope:"customPlacement",object:"placement",action:"fetch",validators:{},handler:async({account:t,detail:e,customEvent:n})=>{Vt(t,Jt,"placementFetch/start");const i=await async function(t){const e={ortb2:Xt(t)},n=t.use(Wt),i=t.use(Qt),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),a=encodeURIComponent(JSON.stringify(e)),s=await fetch(`${i}?account=${t.id}&u=${o}&sg=${a}`);return await s.json()}(t);return Vt(t,Jt,"placementFetch/end"),{status:y.completed,value:{placementResponse:i},analytics:{browserInfo:zt(t.globalContext.document,t.globalContext.navigator?.connection,t.globalContext.innerWidth,t.globalContext.innerHeight)}}}});function Xt(t){const e=t.use(Yt);if(void 0!==e&&"user"in e){const{user:t,...n}=e;return n}return e}const te={key:"customPlacement/bidEndpoint",default:"c.aps.amazon-adsystem.com"},ee={key:"customPlacement/bidIsKey",default:"86355855cc6ed9e335d0382c8563aa10"};var ne=new U({scope:"customPlacement",object:"bids",action:"fetch",validators:{},handler:async({account:t,detail:e,customEvent:n})=>{const i=zt(t.globalContext.document,t.globalContext.navigator?.connection,t.globalContext.innerWidth,t.globalContext.innerHeight);if(void 0===t.globalContext.apstag?.clientFetchBids)return{status:y.waiting,analytics:{browserInfo:i}};Vt(t,Jt,"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(te),params:{program:"apscustom",is:t.use(ee)}},n={pubID:t.id,isSelfServePub:36===t.id.length,deals:!0},i=t.use(Wt);return await new Promise((o=>{t.globalContext.apstag?.clientFetchBids(e,(t=>{o(t)}),{initConfig:n,contextURL:i})}))}(t);return Vt(t,Jt,"fetchBids/end"),{status:y.completed,value:{bidResponses:o},analytics:{browserInfo:i}}}}),ie=new U({scope:"customPlacement",object:"service",action:"enable",validators:{},handler:async({account:t,detail:e,customEvent:n})=>(Vt(t,Jt,"service/enable"),t.update(Ht,(()=>!1)),await Promise.all([t.recordListener(Zt).then((({placementResponse:e})=>{oe(t,!0,e),t.update(Kt,(()=>e))})),t.recordListener(ne).then((({bidResponses:e})=>{e.forEach((e=>{const n=e.targeting?.amzniid??e.amzniid;let i=!1;if(""!==n){const o=t.use(Ut);o[n]=e,t.update(Ut,(()=>o)),i=!0}oe(t,!1,{aps:[{active:i,dispatchEventOnValidBid:!0}]})}))})).then((()=>{t.recordListenerNonBlocking(Bt)}))]),{status:y.completed,analytics:{browserInfo:zt(t.globalContext.document,t.globalContext.navigator?.connection,t.globalContext.innerWidth,t.globalContext.innerHeight)}})});function oe(t,e,n){if(t.use(Ht))return;const i=n?.aps?.find((t=>t.dispatchEventOnValidBid));e&&void 0!==i||(Vt(t,Jt,"placementResponseEvent/dispatch"),t.record("customPlacement/placement/didRespond",n).catch((t=>{})),t.update(Ht,(()=>!0)))}const ae=new Map([...q([Gt,ne,Bt,ie,Zt])]);class se extends Error{constructor(t){super(t.message),this.message=`Could not read vendor data because: "${t.message}"`}}const re={key:"cxm/vendors",default:{}},ce="liveintent",de={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}};function le(t){const e=[],n={user:{ext:{eids:e}}};return Object.entries(de).forEach((n=>{const i=n[0],o=n[1];if(void 0===t[i])return;const a={source:o.source,uids:[{id:t[i],atype:o.atype}]};!0!==o.noExtraDefaults&&(a.uids[0].ext={provider:"liveintent.com"}),e.push(a)})),n}const ue="anonymised",pe="cxm/liveintent/set",me="cxm/arcspan/set",fe="cxm/anomymised/set",he=new Map([["cxm/vendors/set",async({account:t})=>(await Promise.all([t.record(pe),t.record(me),t.record(fe)]),y.completed)],[pe,async({account:t,customEvent:e})=>{let n;try{n=function(t){let e;try{e=t.readLocalStorage("__tamLIResolveResult")}catch(t){if(t instanceof Error)throw new se(t)}if(null!=e&&(void 0===t.globalContext.liModuleEnabled&&(t.globalContext.liModuleEnabled=Math.random()<.95,t.globalContext?.googletag?.cmd.push((()=>{t.globalContext.googletag.pubads().setTargeting("li-module-enabled",t.globalContext.liModuleEnabled?["on"]:["off"])}))),t.globalContext.liModuleEnabled)){let t;try{t=le(JSON.parse(e))}catch(n){t=le(JSON.parse(decodeURIComponent(e)))}if(void 0!==t)return{data:{default:t}}}}(t)}catch(t){if(t instanceof se)return{status:y.cancelled,analytics:{statusReason:t.message}};throw t}return void 0===n?y.cancelled:(t.update(re,(t=>({...t,[ce]:n}))),y.completed)}],[me,async({account:t})=>{const e=function(t){const e=t.globalContext.arcobj1,n=t.globalContext.arcobj2;let i=[],o=[],a=[];if(void 0!==e){if(void 0!==e.page_iab_codes.text&&(i=i.concat(e.page_iab_codes.text)),void 0!==e.page_iab_codes.images&&(i=i.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;a=a.concat(t),void 0!==n?.compcohorts&&(a=a.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:i,sectioncat:i,pagecat:i,keywords:a.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?y.cancelled:(t.update(re,(t=>({...t,arcspan:e}))),y.completed)}],[fe,async({account:t,customEvent:e})=>{let n;try{n=function(t){let e;try{e=t.readLocalStorage("cohort_ids")}catch(t){if(t instanceof Error)throw new se(t)}if("string"==typeof e){const t=JSON.parse(e);let n="";for(let e=0;e({...t,[ue]:n}))),y.completed)}]]),ve={key:"idVendors/ids",default:void 0},ge={key:"idVendors/metadata",default:void 0};function ye(t,e){const n=t(e);return null!=n?(e.update(ve,(t=>({...t,...n}))),{status:y.completed}):{status:y.cancelled}}class we{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 be=function(t){return"string"==typeof t?t:null},Ee=function(t){return"string"==typeof t?atob(t):null};function Se(t){return function(e){return"string"==typeof e?t(JSON.parse(e)):null}}const xe="33across";var _e=new U({scope:"idVendors",object:"33across",action:"get",handler:async({account:t,customEvent:e})=>ye(Ae,t)});const Ae=t=>{const e=t.readLocalStorage("33acrossId");if(e&&e.length>1500)throw new Error(`Id length of ${100*Math.ceil(e.length/100)} (normalized) exceeds 1500 character limit`);return null!=e?{[xe]:decodeURIComponent(e)}:null},Re="audigent";var Ie=new U({scope:"idVendors",object:"audigent",action:"get",handler:async({account:t,customEvent:e})=>ye($e,t)});const $e=t=>{const e=t.readLocalStorage("hadronId")??t.readLocalStorage("auHadronId");return null!=e?{[Re]:e}:null},ke=["cto_bidid"];var De=new U({scope:"idVendors",object:"criteo",action:"get",handler:async({account:t,customEvent:e})=>ye(new we("criteo").using(be).fromLocalStorageKeys(ke).forAccount(t).getRunner(),t)});const je="id5",Ce="id5id";var Oe=new U({scope:"idVendors",object:"id5",action:"get",handler:async({account:t,customEvent:e})=>ye(Pe,t)});const Pe=t=>{const e=t.readLocalStorage(Ce);return null!=e?{[je]:JSON.parse(decodeURIComponent(e)).universal_uid}:null},Le={key:"idVendors/enabled",default:void 0},Ne=["__uid2_advertising_token"],Te=t=>t?.latestToken?.advertising_token??null;var Me=new U({scope:"idVendors",object:"uid",action:"get",handler:async({account:t,customEvent:e})=>ye(new we("uid").using(Se(Te)).fromLocalStorageKeys(Ne).forAccount(t).getRunner(),t)});const Ue="pair",qe=["pairId"],Fe=["_lr_pairId"],ze=t=>t?.envelope?.pop?t?.envelope?.pop()??null:null;var Ve=new U({scope:"idVendors",object:"pair",action:"get",handler:async({account:t,customEvent:e})=>ye((t=>new we(Ue).using(Ee).fromCookieOrLocalStorageKeys(qe).forAccount(t).getRunner()()??new we(Ue).using(function(t){return function(e){return"string"==typeof e?Se(t)(atob(decodeURIComponent(e))):null}}(ze)).fromCookieOrLocalStorageKeys(Fe).forAccount(t).getRunner()()),t)});const Je="yahoo",Be="connectId";var Ge=new U({scope:"idVendors",object:"yahoo",action:"get",handler:async({account:t,customEvent:e})=>ye(He,t)});const He=t=>{let e=t.readLocalStorage(Be);return null!=e&&(e=JSON.parse(e)[Be]),null!=e?{[Je]:e}:null},Ke="lotame";var We=new U({scope:"idVendors",object:"lotame",action:"get",handler:async({account:t,customEvent:e})=>ye(Qe,t)});const Qe=t=>{const e=t.readLocalStorage("panoramaId");return null!=e?{[Ke]:e}:null},Ye="publink",Ze=["_publink_srv","_publink","pbjs_publink"];var Xe=new U({scope:"idVendors",object:"publink",action:"get",handler:async({account:t,customEvent:e})=>ye(tn,t)});const tn=t=>{for(const e of Ze){const n=t.readCookieStorage(e);if(null!=n){let t;try{t=JSON.parse(n).publink}catch{t=n}if(null!=t)return{[Ye]:t}}}return null},en="liveRamp",nn="_lr_env",on="idl_env",an="apstagLiveRampTimestamp";var sn;!function(t){t[t.oldTimestamp=0]="oldTimestamp",t[t.newTimestamp=1]="newTimestamp",t[t.noTimestamp=2]="noTimestamp"}(sn||(sn={}));var rn=new U({scope:"idVendors",object:"liveramp",action:"get",handler:async({account:t,customEvent:e})=>{const n=dn(cn(t),t),i=ye((()=>null!=n?{[en]:n.id}:null),t);return i.status===y.completed?function(t,e){const i=null!=n?{[en]:n.newGen}:null;return null!=i?(e.update(ge,(t=>({...t,...i}))),{status:y.completed}):{status:y.cancelled}}(0,t):i}});const cn=t=>{const e=t.readLocalStorage(nn);if(null!=e)return e;const n=t.readCookieStorage(nn);if(null!=n)return n;const i=t.readLocalStorage(on);if(null!=i)return i;const o=t.readCookieStorage(on);return null!=o?o:null},dn=(t,e)=>{if(null!=t&&""!==t)try{const n=JSON.parse(atob(decodeURIComponent(t))),i={id:n.envelope,newGen:sn.noTimestamp};if(null!=n.timestamp){const t=e.readLocalStorage(an);null==t||tye(new we(ln).using(be).fromLocalStorageOrCookieKeys(un).forAccount(t).getRunner(),t)});const mn=["pbjs_unifiedID","pbjs-unifiedid"],fn=t=>t?.TDID??null;var hn=new U({scope:"idVendors",object:"unifiedid",action:"get",handler:async({account:t,customEvent:e})=>ye(new we("unifiedid").using(function(t){return function(e){return"string"==typeof e?Se(t)(decodeURIComponent(e)):null}}(fn)).fromLocalStorageOrCookieKeys(mn).forAccount(t).getRunner(),t)});const vn={},gn=new Set([Ce,on,nn]),yn={};var wn=new U({scope:"idVendors",object:"lockr",action:"get",handler:async({account:t,customEvent:e})=>ye(bn,t)});const bn=t=>{const e=t.readLocalStorage("lockr_identity_providers");if(e){const n={};return e.split(",").filter((t=>!gn.has(t))).forEach((e=>{const i=En(t,e);null!==i&&(n[vn[e]||e]=decodeURIComponent(i))})),n}return null},En=(t,e)=>{let n=t.readLocalStorage(e);if(!n)return null;if(yn[e])try{n=JSON.parse(decodeURIComponent(n)),yn[e].split(".").forEach((t=>{n=n?.[t]}))}catch(t){throw new Error(`Malformed json at ${e}: ${t}`)}return n||null},Sn={"33across":_e,audigent:Ie,criteo:De,ddb_key_638:wn,id5:Oe,liveRamp:rn,lotame:We,pair:Ve,pubcommon:pn,publink:Xe,uid:Me,unifiedid:hn,yahoo:Ge},xn=Object.keys(Sn);var _n=new U({scope:"idVendors",object:"ids",action:"get",handler:async({account:t})=>{let e=Object.values(Sn);const n=t.use(Le,{persist:!0,throwOnDisallowed:!1});if(n){const t=JSON.parse(n);if(i=t,!Array.isArray(i)||!i.every((t=>"string"==typeof t)))throw new Error("Received invalid 3P bid param key");const o=new Set(t);e=xn.filter((t=>o.has(t))).map((t=>Sn[t]))}var i;return await Promise.all(e.map((e=>t.recordListener(e)))),{status:y.completed,analytics:{enabledIdVendors:`${n}`}}}}),An=new U({scope:"idVendors",object:"enabled",action:"set",handler:async({account:t,detail:e,context:n})=>Rn(n)?(t.update(Le,(()=>JSON.stringify(e.bidParameterKeys)),{persist:!0}),{status:y.completed}):{status:y.waiting},validators:{detail:{detail:k,"detail.bidParameterKeys":j,"detail.bidParameterKeys[]":I},context:{context:k,"context.apstag":D([M,k]),"context.apstag._atsaaiod":D([M,L])}}});const Rn=t=>void 0!==t.apstag?._atsaaiod,In=q([_e,Ie,De,Oe,_n,rn,wn,We,Ve,pn,Xe,Me,hn,Ge,An]);var $n=new U({scope:"analytics",object:"sampling",action:"set",validators:{detail:{detail:N,"detail.rates":N,"detail.rates.error":N,"detail.rates.status":N}},handler:async({detail:t})=>void 0===t?.rates?{status:y.cancelled}:(void 0!==t?.rates?.error&&c.setEventSamplingRates({error:t?.rates?.error}),void 0!==t?.rates?.status&&c.setEventSamplingRates({feature:t?.rates?.status}),{status:y.completed})});const kn=q([$n,new U({scope:"log",object:"analytics",action:"setInterval",validators:{detail:{detail:k,"detail.interval":R}},handler:async({detail:t})=>(c.setEventProcessingInterval(t.interval),{status:y.completed})})]);var Dn=new U({scope:"debug",object:"version",action:"show",handler:async({account:e,customEvent:n})=>({status:y.completed,value:{LIBRARY_VERSION:t}})});const jn="debug/events/show",Cn="debug/prepend/add",On="debug/prepend/remove",Pn="debug/store/show",Ln="ad/debugSession/start",Nn=new Map([[jn,async({account:t})=>{const e=[...(null!=t.store.get(n)?t.store.get(n):[]).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(n)?t.store.get(n):[]).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(),y.completed}],[Cn,async({account:t,customEvent:e})=>{if(void 0===e.detail?.eventName)throw new Error("Missing event information");const n=t.read(V,{persist:!0})??"[]",i=JSON.parse(n),{eventName:o,eventDetail:a}=e.detail;return i.unshift({eventName:o,eventDetail:a}),t.write(V,JSON.stringify(i),{persist:!0}),y.completed}],["debug/prepend/clear",async({account:t})=>(t.delete(V,{persist:!0}),y.completed)],[On,async({account:t,customEvent:e})=>{if(void 0===e.detail?.eventName)throw new Error("Missing event information");const n=t.read(V,{persist:!0})??"[]",i=JSON.parse(n),{eventName:o}=e.detail,a=i.filter((t=>t.eventName!==o));return t.write(V,JSON.stringify(a),{persist:!0}),y.completed}],[Pn,async({account:t})=>{const e=[...t.store.entries()];return console.groupCollapsed(`⌂ Account ID: ${t.id}`),console.table(e),console.groupEnd(),y.completed}],[Ln,async({account:t,customEvent:e})=>function(t){return t.status!==y.waiting}(e)&&(function(t,e){void 0!==t.detail?.minutes&&function(t,e){const n=new Date;t.write(z,n.setMinutes(Number(n.getMinutes())+Number(e.detail?.minutes)).toString(),{persist:!0})}(e,t),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)}(e)}(e,t),function(t){return t.queue.filter((t=>t.type===Ln)).length>1}(t))?y.completed:function(t){const e=t.read(z,{persist:!0});return void 0!==e&&new Date>=new Date(Number(e))}(t)?(function(t){t.delete(z,{persist:!0}),function(t){delete t.globalContext.apstagDEBUG?.url}(t)}(t),y.completed):(function(t){t.record(jn).catch((t=>{})),t.record(Pn).catch((t=>{}))}(t),y.waiting)],["debug/listeners/show",async({systemAccount:t})=>{const n=[...t.store.get(e).entries()];return console.groupCollapsed("⌂ Listeners"),console.table(n),console.groupEnd(),y.completed}]]),Tn=new Map([...Nn,...q([Dn])]);var Mn;!function(t){t[t.unspecifiedUnknown=0]="unspecifiedUnknown",t[t.lowEntropy=1]="lowEntropy",t[t.highEntropy=2]="highEntropy"}(Mn||(Mn={}));const Un=["brands","mobile","platform"],qn=["architecture","bitness","fullVersionList","model","platformVersion"];var Fn=new U({scope:"deviceSignal",object:"sua",action:"set",validators:{context:{context:k,"context.apstag":k,"context.navigator":k,"context.navigator.userAgentData":k,"context.navigator.userAgentData.getHighEntropyValues":L,"context.navigator.userAgentData.architecture":P(I),"context.navigator.userAgentData.bitness":P(I),"context.navigator.userAgentData.mobile":P($),"context.navigator.userAgentData.model":P(I),"context.navigator.userAgentData.platform":P(I),"context.navigator.userAgentData.platformVersion":P(I),"context.navigator.userAgentData.fullVersionList":P(j),"context.navigator.userAgentData.fullVersionList[]":k,"context.navigator.userAgentData.fullVersionList[].brand":I,"context.navigator.userAgentData.fullVersionList[].version":I,"context.navigator.userAgentData.brands":P(j),"context.navigator.userAgentData.brands[]":k,"context.navigator.userAgentData.brands[].brand":I,"context.navigator.userAgentData.brands[].version":I}},handler:async({account:t})=>{if(void 0===t.globalContext.apstag?.isGDPRRegion)return{status:y.waiting};const e="deviceSignal/sua",n=t.globalContext.navigator?.userAgentData,i=t.read(e,{persist:!0,throwOnDisallowed:!1});return"string"==typeof i?t.write(e,i):n instanceof Object&&function(t,e,n){t.write(e,JSON.stringify(zn(n)))}(t,e,n),!1!==t.globalContext.apstag?.isGDPRRegion||"function"==typeof n?.getHighEntropyValues&&await async function(t,e,n){const i=await n.getHighEntropyValues([...Un,...qn]);return t.write(e,JSON.stringify(zn(i)),{persist:!0,throwOnDisallowed:!1}),y.completed}(t,e,n),{status:y.completed}}});function zn(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=(i=t,qn.some((t=>i[t]))?Mn.highEntropy:Un.some((t=>i[t]))?Mn.lowEntropy:Mn.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 i}const Vn=q([Fn]),Jn={key:"deviceSignal/cookieDeprecationLabel",default:void 0};var Bn=new U({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:y.cancelled};const i=await t.executeFuncWithConsent(n,n.getValue);return void 0===i||""===i?{status:y.cancelled}:(t.update(Jn,(()=>i)),{status:y.completed,analytics:{gcdl:i}})}});const Gn=q([Bn]),Hn={key:"_monitoring/statusesByEventIdentifier",default:new Map};var Kn=async({account:t,customEvent:e})=>{const n=e.detail?.eventIdentifier;if(void 0===n)throw new Error("Missing eventIdentifier parameter");const i=t.use(Hn),o=`${e.type}:${n}`,a=i.get(o);return void 0!==a?a:y.waiting},Wn=async({account:t,customEvent:e})=>{const n=e.detail?.eventIdentifier;if(void 0===n)throw new Error("Missing eventIdentifier parameter");const i=e.detail?.statusUpdate;if(void 0===i)throw new Error("Missing statusUpdate parameter");if(!(i in y))throw new Error(`Invalid statusUpdate parameter. Expected one of ${Object.values(y).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(Hn,(t=>t.set(o,i)))})),y.completed};const Qn=new Map([["_monitor/testing/only",Kn],["_update/testing/only",Wn],["_legacy/bidRequest/monitor",Kn],["_legacy/bidRequest/didComplete",Wn]]);var Yn=new U({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:y.cancelled};const n={eventType:e.detail.eventType,metadata:e.detail.metadata,config:e.detail.config},i=await t.globalContext.fetch("https://prod.us-east-1.cxm-bcn.publisher-services.amazon.dev/v1/events/prebid",Zn(e.detail));return i.ok?{status:y.completed,analytics:n}:{status:y.cancelled,analytics:{...n,message:`Request failed: ${i.status}`}}}});const Zn=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)}},Xn={key:"prebid/config",default:void 0};var ti;!function(t){t.NotStarted="NOT STARTED",t.Loading="LOADING",t.Complete="COMPLETE"}(ti||(ti={}));const ei={key:"prebid/configRequestState",default:ti.NotStarted};var ni=new U({scope:"prebid",object:"config",action:"fetch",handler:async({account:t,customEvent:e})=>{const n=t.use(ei);if(n===ti.Loading)return{status:y.waiting};const i={metadata:e?.detail?.metadata};if(n===ti.Complete){const e=t.use(Xn);if(void 0!==e)return{status:y.completed,value:JSON.parse(e),analytics:i}}try{t.update(ei,(()=>ti.Loading));const e=`https://c.amazon-adsystem.com/cdn/prod/config?src=${t.id}`,n=await t.globalContext.fetch(e);if(t.update(ei,(()=>ti.Complete)),!n.ok)return{status:y.cancelled,analytics:{...i,message:"Config request failed"}};const o=await n.json(),a=ii(t,o);return t.update(Xn,(()=>JSON.stringify(a)),{persist:!0}),{status:y.completed,value:a,analytics:i}}catch(t){return{status:y.cancelled,analytics:{...i,message:t.message}}}}});const ii=(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}}}),oi={key:"prebid/eidsConfig",default:"{}"};var ai;!function(t){t.APSSignalIQ="_apsIdTreatment",t.Audigent="hadronId",t.ID5="id5id",t.Liveramp="idl_env",t.Lotame="lotamePanoramaId",t.Pubcommon="pubcid",t.Publink="publinkId",t.ThirtyThree="33acrossId",t.Yahoo="connectId"}(ai||(ai={}));const si=new Map([[Re,ai.Audigent],["id5",ai.ID5],[en,ai.Liveramp],[Ke,ai.Lotame],[ln,ai.Pubcommon],[Ye,ai.Publink],[xe,ai.ThirtyThree],[Je,ai.Yahoo]]),ri={[ai.Audigent]:{source:"audigent.com",atype:1},[ai.ID5]:{source:"id5-sync.com",atype:1},[ai.Liveramp]:{source:"liveramp.com",atype:3},[ai.Lotame]:{source:"crwdcntrl.net",atype:1},[ai.Pubcommon]:{source:"pubcid.org",atype:1},[ai.Publink]:{source:"epsilon.com",atype:3},[ai.ThirtyThree]:{source:"33across.com",atype:1},[ai.Yahoo]:{source:"yahoo.com",atype:3}};var ci=new U({scope:"prebid",object:"eidsConfig",action:"get",handler:async({account:t,customEvent:e})=>{if(void 0===t.globalContext.apstag?._atsaaiod)return{status:y.waiting};t.update(oi,(()=>JSON.stringify({...ri})),{persist:!0});const n={metadata:e?.detail?.metadata,config:e?.detail?.config};return{status:y.completed,analytics:n}}});const di=new Set(["CONTROL_HOLD_OUT","CLEAN",...si.keys()]);const li={key:"prebid/ids",default:void 0};var ui=new U({scope:"prebid",object:"ids",action:"get",handler:async({account:t,customEvent:e})=>{if(void 0===t.globalContext.apstag?._atsaaiod)return{status:y.waiting};t.recordListenerNonBlocking(_n);const n=t.use(ve);let i;void 0!==n&&(i=Object.fromEntries(Object.entries(n).map((([t,e])=>[si.get(t),e]))));const o=await t.recordListener(ni,{metadata:e?.detail?.metadata}),a={metadata:e?.detail?.metadata};return o.idConfig.params.enabled?(null!=o.idConfig.params.treatments&&(i=function(t,e){if(!function(t){const e=100===t.reduce(((t,{percent:e})=>t+e),0),n=t.reduce(((t,{treatment:e})=>t&&di.has(e)),!0);return e&&n}(e))return t;const n=function(t){const e=100*Math.random();let n=0;for(const i of t)if(n+=i.percent,e<=n)return i.treatment;throw new Error("Invalid treatment percentages")}(e);return function(t,e){const n={[ai.APSSignalIQ]:e},i=si.get(e);switch(e){case"CONTROL_HOLD_OUT":return{...t,...n};case"CLEAN":return n;default:return void 0!==i&&void 0!==t?.[i]&&(n[i]=t[i]),n}}(t,n)}(i,o.idConfig.params.treatments)),t.update(li,(()=>i)),{status:y.completed,value:i,analytics:a}):{status:y.cancelled,analytics:a}}});const pi=q([Yn,ni,ci,ui]),mi=t=>t===fi.noConsent?"AMZN-NoCookieConsent":"AMZN-Token";var fi;!function(t){t[t.noConsent=0]="noConsent",t[t.token=1]="token"}(fi||(fi={}));const hi=t=>{t.setCookieStorage(mi(fi.token),"",0),t.setCookieStorage(mi(fi.noConsent),"",0)},vi=({account:t,hashedRecords:e,ttl:n,isGDPRRegion:i,tcString:o,setToken:a})=>(hi(t),"boolean"!=typeof a&&(a=!0),gi({account:t,hashedRecords:e,ttl:n,isGDPRRegion:i,tcString:o}).then((({AIPToken:e,cookieExpiry:n})=>yi({AIPToken:e,cookieExpiry:n,account:t,setToken:a})))),gi=({account:t,hashedRecords:e,ttl:n,isGDPRRegion:i,tcString:o})=>fetch("https://tk.amazon-adsystem.com/envelope",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(wi({account:t,hashedRecords:e,ttl:n,isGDPRRegion:i,tcString:o}))}).then((t=>{if(!t.ok)throw new Error(`Token http status error: ${t.status}`);return t.json()})),yi=({AIPToken:t,cookieExpiry:e,account:n,setToken:i})=>{if("string"!=typeof t||"number"!=typeof e)throw new Error("Invalid AIPES response");if(""===t)throw n.setCookieStorage(mi(fi.noConsent),"1",e),new Error("Empty token");(i||"boolean"!=typeof i)&&n.setCookieStorage(mi(fi.token),t,e)},wi=({account:t,hashedRecords:e,ttl:n,isGDPRRegion:i,tcString:o})=>{const a={publisherId:t.id,hashedRecords:e};return void 0!==n&&(a.ttl=n),i?(a.gdpr=1,o&&(a.gdprConsent=o)):a.gdpr=0,a};var bi=new U({scope:"ad",object:"record",action:"delete",handler:async({account:t})=>{if(!t.globalContext.apstag?._atsaaiod)return{status:y.waiting};if(!t.isAllowedToAccessInfoOnDevice())throw new Error("Not allowed to access storage on device");return hi(t),{status:y.completed}}});const Ei={detail:k,"detail.setCookie":P($),"detail.config":k,"detail.config.optOut":P($),"detail.config.ttl":P(R),"detail.config.gdpr":P(k),"detail.config.gdpr.cmpTimeout":P(R),"detail.config.gdpr.enabled":P(T),"detail.config.gdpr.consent":P(I),"detail.config.gdpr.cmpGlobal":P(I),"detail.config.gdpr.cmpGlobalv2":P(I),"detail.config.hashedRecords":j,"detail.config.hashedRecords[]":k,"detail.config.hashedRecords[].type":I,"detail.config.hashedRecords[].record":I,"detail.config.hashedRecords[].encrypted":P(R),"detail.config.hashedRecords[].toJSON":N,"detail.config.hashedRecords[].$$typeof":N,"detail.config.hashedRecords[].constructor":N,"detail.config.hashedRecords[].tagName":N,"detail.config.hashedRecords[].@@__IMMUTABLE_ITERABLE__@@":N,"detail.config.hashedRecords[].@@__IMMUTABLE_RECORD__@@":N};var Si,xi,_i=new U({scope:"ad",object:"record",action:"renew",validators:{detail:Ei,context:{context:k}},handler:async({account:t,detail:e})=>{if(!t.globalContext.apstag?._atsaaiod)return{status:y.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(mi(fi.token))??"").length>0)return{status:y.cancelled};const n=t.globalContext.apstag.isGDPRRegion,i=t.use(wt);var o;return await(o={account:t,hashedRecords:e.config.hashedRecords,ttl:e.config.ttl,isGDPRRegion:n,tcString:i?.tcString},vi(o)),{status:y.completed}}});!function(t){t.email="email"}(Si||(Si={})),function(t){t.Display="display",t.Video="video",t.MultiFormat="multi-format"}(xi||(xi={}));const Ai=/^[0-9a-fA-F]{64}$/,Ri=t=>Ai.test(t||""),Ii=t=>t.then((t=>Array.from(new Uint8Array(t)).map((t=>t.toString(16).padStart(2,"0"))).join(""))).then((t=>"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"!==t?t:"")),$i=(t,e)=>"string"==typeof t&&(e===Si.email?/\S+@\S+\.\S+/.test(t)||Ri(t):t.trim().length>0),ki=(t,e,n)=>e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement?$i(e.value,n)?Ii(t.globalContext.crypto.subtle.digest("SHA-256",(new t.globalContext.TextEncoder).encode(e.value||""))):Promise.resolve(""):$i(e.innerText,n)?Ii(t.globalContext.crypto.subtle.digest("SHA-256",(new t.globalContext.TextEncoder).encode(e.innerText||""))):Promise.resolve(""),Di=(t,e,n)=>{const i=t.readLocalStorage(e);return i&&$i(i,n)?i:""},ji=(t,e,n)=>{n=n??t.globalContext.location.href,e=e.replace(/[[\]]/g,"\\$&");const i=new RegExp("[?&#]"+e+"(=([^&#?]*)|&|#|$)").exec(n);return Array.isArray(i)&&"string"==typeof i[2]&&0!==decodeURIComponent(i[2].replace(/\+/g," ")).trim().length&&Ri(decodeURIComponent(i[2].replace(/\+/g," ")))?Promise.resolve(decodeURIComponent(i[2].replace(/\+/g," "))):new Promise((t=>t("")))};var Ci;!function(t){t.LOCAL_STORAGE="LOCAL",t.CSS_SELECTOR="CSS",t.URL="URL"}(Ci||(Ci={}));const Oi=(t,e={},n)=>{(t=>{const e={[Ci.LOCAL_STORAGE]:5,[Ci.URL]:4,[Ci.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 i=[];let o;for(const a of e.methods||[]){const{method:e,target:s,type:r}=a;let c="";switch(e){case Ci.LOCAL_STORAGE:c=Di(t,s,r);break;case Ci.URL:i.push(ji(t,s).then((t=>({type:r,value:t}))));break;case Ci.CSS_SELECTOR:o=a}if(c.length>0)return void n({value:c,type:r})}const a=()=>{if(!o||!0!==o.isGlobalSubmit&&("string"!=typeof o.eventTarget||"string"!=typeof o.event))return void n(!1);const{eventTarget:e,target:i,type:a,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:i,isGlobalSubmit:o,target:a,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,i)=>{const o=i||t.globalContext.document.querySelectorAll(e);if(0===o.length)return new Promise((t=>t("")));if(1===o.length)return ki(t,o[0],n);const a=[];for(const e of o)a.push(ki(t,e,n));return Promise.all(a).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,a,s,d).then((e=>{"function"==typeof c&&t.globalContext.removeEventListener(i,c),r(!(e.length<1)&&{value:e,type:s})}))})({account:t,e:o,event:r,eventTarget:e,isGlobalSubmit:s,target:i,type:a,onDone:n,listener:c});t.globalContext.addEventListener(r,c)};if(0!==i.length)return Promise.all(i).then((t=>{for(const e of t)if(e.value.length>0)return void n(e);a()}));a()},Pi={called:!1};const Li=q([bi,_i,new U({scope:"ad",object:"record",action:"rr",validators:{detail:{detail:k,"detail.config":k,"detail.config.$$typeof":N,"detail.config.tagName":N,"detail.config.@@__IMMUTABLE_ITERABLE__@@":N,"detail.config.@@__IMMUTABLE_RECORD__@@":N,"detail.config.accountID":P(I),"detail.config.overrideLimit":P($),"detail.config.methods":j,"detail.config.methods[].tagName":N,"detail.config.methods[]":O(k),"detail.config.methods[].$$typeof":N,"detail.config.methods[].@@__IMMUTABLE_ITERABLE__@@":N,"detail.config.methods[].@@__IMMUTABLE_RECORD__@@":N,"detail.config.methods[].type":C(Object.values(Si)),"detail.config.methods[].method":C(Object.values(Ci)),"detail.config.methods[].target":P(I),"detail.config.methods[].event":P(I),"detail.config.methods[].eventTarget":P(I),"detail.config.methods[].isGlobalSubmit":P($),"detail.config.methods[].priority":P(R)},context:{context:k,"context.Promise":L,"context.crypto":k,"context.crypto.subtle":L}},handler:async({account:t,detail:e})=>{if(!t.globalContext.apstag?._atsaaiod)return{status:y.waiting};if(!t.isAllowedToAccessInfoOnDevice())throw new Error("Not allowed to access storage on device");const n=await function(t,e){return new Promise(((n,i)=>{if(Pi.called&&!e.overrideLimit)throw new Error("rr should only be called once per page load");Pi.called=!0;let o=0;const a=()=>{const s=(()=>{const o=t.use(wt);return(!t.globalContext.apstag?.isGDPRRegion||void 0!==o)&&(void 0===o||t.isAllowedToAccessInfoOnDevice()?(Oi(t,e,(e=>{if(!1===e)return n("no retrieval");vi({account:t,hashedRecords:[{type:e.type,record:e.value}],source:"rr",tcString:o?.tcString}).then((()=>{n("token generated")})).catch(i)}))?.catch(i),!0):"canceled")})(),r=o>6400;if(s||r)return"canceled"===s&&i(new Error("tcf timeout")),void(r&&i(new Error("interval over")));setTimeout(a,o),o=0===o?200:2*o};a()}))}(t,e.config);return{status:y.completed,analytics:{rr:n}}}}),new U({scope:"ad",object:"record",action:"update",validators:{detail:Ei,context:{context:k}},handler:async({account:t,detail:e})=>{if(!t.globalContext.apstag?._atsaaiod)return{status:y.waiting};if(!t.isAllowedToAccessInfoOnDevice())throw new Error("Not allowed to access storage on device");const n=t.globalContext.apstag.isGDPRRegion,i=t.use(wt);return e.config.optOut?hi(t):await vi({account:t,hashedRecords:e.config.hashedRecords,ttl:e.config.ttl,isGDPRRegion:n,tcString:i?.tcString,setToken:e?.setCookie}),{status:y.completed}}})]),Ni=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,i)=>{const o=n.globalContext.document.createElement("iframe"),a=e.get("amznsz")?.split("x"),s=e.get("amzniid"),r=t;if(void 0===s||void 0===r||void 0===a||a.length<2)return;o.style.marginLeft="0",o.style.marginTop="0",o.style.height=`${a[1]}px`,o.style.width="100%",o.setAttribute("scrolling","no"),o.setAttribute("frameborder","0");const c=n.globalContext.document.createElement("div"),d=i?.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('