/*! @amzn/apswebapstaglibrary - web-client-bundle - v24.228.2235 - 2024-02-28 22:35:40 */ !function(){"use strict";var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};var e=function(){return e=Object.assign||function(t){for(var e,n=1,o=arguments.length;n=0;c--)(r=t[c])&&(a=(i<3?r(a):i>3?r(e,n,a):r(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a}function o(t,e,n,o){return new(n||(n=Promise))((function(r,i){function a(t){try{u(o.next(t))}catch(t){i(t)}}function c(t){try{u(o.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,c)}u((o=o.apply(t,e||[])).next())}))}function r(t,e){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(u){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(a=0)),a;)try{if(n=1,o&&(r=2&c[0]?o.return:c[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,c[1])).done)return r;switch(o=0,r&&(c=[2&c[0],r.value]),c[0]){case 0:case 1:r=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,o=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==c[0]&&2!==c[0])){a=0;continue}if(3===c[0]&&(!r||c[1]>r[0]&&c[1]=t.length&&(t=void 0),{value:t&&t[o++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function a(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,r,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(o=i.next()).done;)a.push(o.value)}catch(t){r={error:t}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return a}function c(t,e,n){if(n||2===arguments.length)for(var o,r=0,i=e.length;r=0&&t<=1?t:1};"number"==typeof(null==t?void 0:t.error)&&this._sampleRates.set("error",e(t.error)),"number"==typeof(null==t?void 0:t.feat)&&this._sampleRates.set("feat",e(t.feat))},t.prototype.clearAndUpdateEventProcessingInterval=function(t){var e=this;"number"!=typeof t||t<=0||t!==this._intervalDelayInMs&&(clearInterval(this._intervalId),this._intervalId=setInterval((function(){try{e.processEventRecords()}catch(t){}}),t),this._intervalDelayInMs=t)},t.prototype.processEventRecords=function(){for(var t=[],e=Array.from(this._recordQueues.keys()),n=function(n){var r=e[n],i=o._recordQueues.get(r),u=o._sampleRates.get(r);if(void 0===i||i.length<=0)return"continue";if(void 0===u||0===u)return i.length>=o._queueLimit&&(i.length=0,o.logEvent({eventCategory:r,eventName:"queue limit reached"})),"continue";var s=i.filter((function(t){return void 0!==t&&u>=Math.random()}));i.length=0,t.push.apply(t,c([],a(s),!1))},o=this,r=0;rthis.STACK_MAX_LENGTH){var e="[...]";return t.stack.substring(0,this.STACK_MAX_LENGTH-e.length)+e}return t.stack}catch(t){return"NO STACK: ERROR ON RETRIEVAL"}},t.prototype.getErrorName=function(t){var e="unknown";try{"string"==typeof t?e=t:void 0!==t.name&&(e=t.name)}catch(t){try{e="Client Error: ".concat(t.name.toString()," - ").concat(t.message)}catch(t){e="Client Error: Unable to provide more information"}}return e},t.prototype.getErrorMessage=function(t){var e="unknown";try{"string"==typeof t?e=t:void 0!==t.message&&(e=t.message)}catch(t){try{e="Client Error: ".concat(t.name.toString()," - ").concat(t.message)}catch(t){e="Client Error: Unable to provide more information"}}return e},t.prototype.getErrorContext=function(t){var e,n="unknown";try{"string"!=typeof t&&"context"in t&&(n=null!==(e=t.context)&&void 0!==e?e:"")}catch(t){try{n="Client Error: ".concat(t.name.toString()," - ").concat(t.message)}catch(t){n="Client Error: Unable to provide more information"}}return n},t}());!function(t){t.push="push",t.listenerSuccess="listenerSuccess",t.direct="direct"}(u||(u={})),function(t){t.internal="internal",t.apstag="apstag",t.webpage="webpage"}(s||(s={})),function(t){t.completed="completed",t.waiting="waiting",t.cancelled="cancelled"}(l||(l={})),function(t){t.started="started",t.error="error",t.unknown="unknown",t.deactivated="deactivated"}(d||(d={}));var h=e(e({},l),d),m=new Map([["_config/config/didLoad",function(t){var e=t.account;return t.customEvent,o(void 0,void 0,void 0,(function(){return r(this,(function(t){return e.write("config/loaded",!0),[2,l.completed]}))}))}],["_config/requestViewerCountry/define",function(t){var e=t.account,n=t.customEvent;return o(void 0,void 0,void 0,(function(){var t,o;return r(this,(function(r){if(void 0===(null===(o=n.detail)||void 0===o?void 0:o.code))throw new Error("Missing country code");if("string"!=typeof(t=n.detail.code)||0===t.trim().length)throw new Error('Invalid country code: "'.concat(t,'"'));return e.update(f,(function(){return t})),[2,l.completed]}))}))}]]),y=new Map([["apstag/configuration/fetch",function(t){var e=t.account;return t.customEvent,o(void 0,void 0,void 0,(function(){var t;return r(this,(function(n){switch(n.label){case 0:return(t=e.globalContext.document.createElement("script")).setAttribute("src","".concat("https://config.aps.amazon-adsystem.com/configs/").concat(e.id)),t.setAttribute("type","text/javascript"),t.setAttribute("async","async"),e.globalContext.document.head.appendChild(t),[4,new Promise((function(e,n){t.addEventListener("load",(function(){e()})),t.addEventListener("error",(function(t){n(t)}))}))];case 1:return n.sent(),[2,l.completed]}}))}))}]]),b="consent/GPPData",w="consent/isGPPListenerRegistered",_={key:"consent/isTCFAPIListenerRegistered",default:!1},E={key:"consent/TCData",default:void 0};function x(t,e){var n,o,r,i,a;return!0===(null===(o=null===(n=t.vendor)||void 0===n?void 0:n.consents)||void 0===o?void 0:o[793])&&(i=e,a=null===(r=t.purpose)||void 0===r?void 0:r.consents,(null!=i?i:[]).reduce((function(t,e){return t&&!0===(null==a?void 0:a[e])}),!0))}var S=function(t,e){var n={tcData:e,consents:[1]},o=function(t){try{return t()}catch(t){return"error"}};return{tcT:o((function(){return t.isAPStagAllowedToAccessInfoOnDevice()})),tcCC:o((function(){return function(t){var e,n=t.tcData,o=t.consents;if(!1===(null==n?void 0:n.gdprApplies))return!0;if("object"!=typeof n)return!1;if((null!==(e=n.tcfPolicyVersion)&&void 0!==e?e:0)<2)return!1;if(n.useNonStandardStacks)return!1;if(!n.isServiceSpecific)return!1;var r=!1;return o.forEach((function(t){var e,i,a;switch(null===(a=null===(i=null===(e=n.publisher)||void 0===e?void 0:e.restrictions)||void 0===i?void 0:i[t])||void 0===a?void 0:a[793]){case 0:case 2:r=!0;break;default:x(n,o)||(r=!0)}})),!r}(n)})),tcCF:o((function(){return 0===function(t){var e,n=t.tcData,o=t.consents;if(0===(null!=o?o:[]).length)return["No consents param passed"];var r=[];try{if("object"!=typeof n){var i="";try{i=JSON.stringify(n)}catch(t){}r.push("Invalid tcData: ".concat(i))}return(null!==(e=n.tcfPolicyVersion)&&void 0!==e?e:0)<2&&r.push("tcData version not supported: ".concat(n.tcfPolicyVersion)),n.useNonStandardStacks&&r.push("tcData's useNonStandardStacks should not be true"),n.isServiceSpecific||r.push("tcData needs to be service specific"),o.forEach((function(t){var e,i,a;switch(null===(a=null===(i=null===(e=n.publisher)||void 0===e?void 0:e.restrictions)||void 0===i?void 0:i[t])||void 0===a?void 0:a[793]){case 0:r.push("Invalid publisher restrictions 0, consent ".concat(t));break;case 2:r.push("Invalid publisher restrictions 2, consent ".concat(t));break;default:x(n,o)||r.push("Invalid publisher restrictions default, consent ".concat(t))}})),r}catch(t){if(r.length>0)return r;throw t}}(n).length}))}},C={consent_gppapi_attemptSync:"consent/gppapi/attemptSync",consent_gppapi_didChange:"consent/gppapi/didChange",consent_gppapi_syncData:"consent/gppapi/syncData",consent_tcfapi_attemptSync:"consent/tcfapi/attemptSync",consent_tcfapi_didChange:"consent/tcfapi/didChange"},P=new Map([[C.consent_gppapi_attemptSync,function(t){var e=t.account;return o(void 0,void 0,void 0,(function(){var t;return r(this,(function(n){switch(n.label){case 0:return void 0===e.globalContext.__gpp||!0===e.read(w)?[2,l.cancelled]:[4,e.record(C.consent_gppapi_syncData)];case 1:return n.sent(),t=e.globalContext.__gpp("addEventListener",(function(t){"error"!==(null==t?void 0:t.eventName)&&e.record(C.consent_gppapi_didChange,{eventListener:t})})),e.write(w,"listenerRegistered"===(null==t?void 0:t.eventName)&&!0===(null==t?void 0:t.data)),[2,l.completed]}}))}))}],[C.consent_gppapi_didChange,function(t){var e=t.account;return t.customEvent,o(void 0,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,e.record(C.consent_gppapi_syncData)];case 1:return t.sent(),[2,l.completed]}}))}))}],[C.consent_gppapi_syncData,function(t){var n=t.account;return o(void 0,void 0,void 0,(function(){var t,o,i,c,u,s,d;return r(this,(function(r){return u=a(function(t){var n,o;try{var r=t.globalContext.__gpp("getGPPData");n=e(e({},r),r.pingData)}catch(t){o="E:getGPPData: ".concat(t)}return[n,o]}(n),2),t=u[0],o=u[1],"object"!=typeof t&&(s=a(function(t){var e,n,o;try{var r=t.globalContext.__gpp("ping",(function(t,e){e&&"object"==typeof t&&(n=t)}));void 0===n&&(null!==(e=null==r?void 0:r.gppString)&&void 0!==e?e:"").length>0&&(n=r)}catch(t){o="E:ping: ".concat(t)}return[n,o]}(n),2),t=s[0],i=s[1]),c={gpp:{gppLength:"string"==typeof(null==t?void 0:t.gppString)?t.gppString.length:void 0,isGPPTilde:(null!==(d=null==t?void 0:t.gppString)&&void 0!==d?d:"").includes("~"),error10:o,error:i,gppVersion:null==t?void 0:t.gppVersion,cmpId:null==t?void 0:t.cmpId}},n.write(b,t),[2,{status:l.completed,analytics:c}]}))}))}],[C.consent_tcfapi_attemptSync,function(t){var e=t.account;return o(void 0,void 0,void 0,(function(){var t;return r(this,(function(n){return t=e.use(_),void 0===e.globalContext.__tcfapi||t?[2,l.cancelled]:(e.globalContext.__tcfapi("addEventListener",2,(function(t,n){e.record(C.consent_tcfapi_didChange,{tcData:t,success:n})})),[2,l.completed])}))}))}],[C.consent_tcfapi_didChange,function(t){var e=t.account,n=t.customEvent;return o(void 0,void 0,void 0,(function(){var t,o,i,a;return r(this,(function(r){return t=null===(i=n.detail)||void 0===i?void 0:i.success,e.update(_,(function(e){return e||!0===t})),o=null===(a=n.detail)||void 0===a?void 0:a.tcData,e.update(E,(function(e){return void 0!==o||!0===t?o:e})),"object"!=typeof o?[2,l.completed]:[2,{status:l.completed,analytics:S(e,o)}]}))}))}]]),I="debugSession/end",A="prepend/events",D="populator/ran",k={key:"consent/hasPurposeOneConsent",default:!1},N=function(){function t(t){var e=this;this.getItem=function(t){var n=e.globalContext.document.cookie.split("; ").reduce((function(e,n){var o=n.split("=");return o[0]===t?decodeURIComponent(o.slice(1).join("=")):e}),"");return n.length>0?n:null},this.removeItem=function(t,n){void 0===n&&(n="/"),e.setItem(t,"",0,n)},this.setItem=function(t,n,o,r){void 0===r&&(r="/");var i=new Date(o);if(!e.isValidDate(i))throw new Error("Invalid expiration date");e.globalContext.document.cookie="".concat(t,"=").concat(n,"; expires=").concat(i.toUTCString(),"; path=").concat(r,";")},this.globalContext=t}return t.prototype.isValidDate=function(t){return t instanceof Date&&!isNaN(t)},t}(),O=["scope/objectName",I,A];function L(t){return null===t||"object"!=typeof t?t:t instanceof Date?new Date(t.getTime()):t instanceof Array?t.reduce((function(t,e){return t.push(L(e)),t}),[]):t instanceof Set?Array.from(t.values()).reduce((function(t,e){return t.add(L(e)),t}),new Set):t instanceof Map?Array.from(t.entries()).reduce((function(t,e){return t.set(e[0],L(e[1])),t}),new Map):t instanceof Object?Object.keys(t).reduce((function(e,n){return e[n]=L(t[n]),e}),{}):t}var R=function(){function t(t,e){var n,o,r=null!==(n=null==e?void 0:e.rootName)&&void 0!==n?n:at.rootName;this.globalContext=null!==(o=null==e?void 0:e.globalContext)&&void 0!==o?o:at.globalContext;var i=this.globalContext[r].get(t);if(null==i)throw new Error('Missing "'.concat(t,'" account in userspace object'));this.id=t,this.store=i.store,this.queue=i.queue}return t.prototype.record=function(t,n){return o(this,void 0,void 0,(function(){var o=this;return r(this,(function(r){switch(r.label){case 0:return[4,new Promise((function(r,i){o.queue.push(new CustomEvent(t,{detail:e({resolve:r,reject:i,source:s.internal},n)}))}))];case 1:return[2,r.sent()]}}))}))},t.prototype.recordListener=function(t,n){return o(this,void 0,void 0,(function(){var o=this;return r(this,(function(r){switch(r.label){case 0:return[4,new Promise((function(r,i){o.queue.push(new CustomEvent(t.name,{detail:e({resolve:r,reject:i,source:s.internal},n)}))}))];case 1:return[2,r.sent()]}}))}))},t.prototype.read=function(t,e){var n,o,r,i,u=this.store.get(t);if(void 0!==u)return u;if(void 0!==(null==e?void 0:e.persist)&&e.persist){var s=this.readLocalStorage(t,{usePrefix:!0});if(void 0!==s)return s}var l=null===(o=null===(n=null==e?void 0:e.default)||void 0===n?void 0:n.generators)||void 0===o?void 0:o.get(t);return void 0!==l?l.apply(void 0,c([],a(null!==(i=null===(r=null==e?void 0:e.default)||void 0===r?void 0:r.args)&&void 0!==i?i:[]),!1)):void 0},t.prototype.write=function(t,e,n){this.store.set(t,e),void 0!==(null==n?void 0:n.persist)&&n.persist&&this.writeLocalStorage(t,e,{usePrefix:!0})},t.prototype.use=function(t,e){var n,o=this.store.get(t.key);if(void 0!==o)n=o;else if(void 0!==(null==e?void 0:e.persist)&&e.persist){var r=this.readLocalStorage(t.key,{usePrefix:!0});null!=r&&(n=r)}var i=null!=n?n:t.default;if("function"==typeof i)return i;try{return structuredClone(i)}catch(t){try{return L(i)}catch(t){return g.logCoreError({id:"Core.library.Account.use",account:null,error:t}),i}}},t.prototype.update=function(t,e,n){var o=e(this.use(t,n));if(this.store.set(t.key,o),void 0!==(null==n?void 0:n.persist)&&n.persist){if("string"!=typeof o)throw new Error("".concat(JSON.stringify(o)," must be a string to be writtable to browser storage"));this.writeLocalStorage(t.key,o,{usePrefix:!0})}},t.prototype.delete=function(t,e){this.store.delete(t),void 0!==(null==e?void 0:e.persist)&&e.persist&&this.deleteLocalStorage(t,{usePrefix:!0})},t.prototype.remove=function(t,e){this.store.delete(t.key),void 0!==(null==e?void 0:e.persist)&&e.persist&&this.deleteLocalStorage(t.key,{usePrefix:!0})},t.prototype.executeFuncWithConsent=function(t,e){if(!this.isAllowedToAccessInfoOnDevice())throw new Error("Invalid consent. API requires consent before execution.");return e.apply(t)},t.prototype.recordErrorEvent=function(t){g.logError(e(e({},t),{account:this}))},t.prototype.recordStatusChangeEvent=function(t){g.logFeature({id:t.id,account:this,feature:t.status,props:e({},t.props)})},t.prototype.recordGenericEvent=function(t){g.logFeature({id:t.id,account:this,feature:t.id,props:e({},t.props)})},t.prototype.isAllowedToAccessInfoOnDevice=function(){return this.updateUserConsent(),this.use(k)},t.prototype.isAPStagAllowedToAccessInfoOnDevice=function(){return!0===this.globalContext.apstag._atsaaiod()},t.prototype.updateUserConsent=function(){try{var t=this.isAPStagAllowedToAccessInfoOnDevice();this.update(k,(function(){return t}))}catch(t){}},t.prototype.getPersistedItemName=function(t){return"".concat("aps").concat(":").concat(this.id).concat(":").concat(t)},t.prototype.isBrowserStorageAllowed=function(t){var e=!1;try{e=this.isAllowedToAccessInfoOnDevice()}catch(t){}return e||O.includes(t)},t.prototype.readCookieStorage=function(t,e){var n;if(!this.isBrowserStorageAllowed(t))throw new Error("".concat(t," is not allowed to be read from cookie storage"));var o=null!==(n=null==e?void 0:e.usePrefix)&&void 0!==n&&n?this.getPersistedItemName(t):t;return new N(this.globalContext).getItem(o)},t.prototype.readLocalStorage=function(t,e){var n;if(!this.isBrowserStorageAllowed(t))throw new Error("".concat(t," is not allowed to be read from browser storage"));var o=null!==(n=null==e?void 0:e.usePrefix)&&void 0!==n&&n?this.getPersistedItemName(t):t;if(o in this.globalContext.localStorage)return this.globalContext.localStorage.getItem(o)},t.prototype.writeLocalStorage=function(t,e,n){var o;if(!this.isBrowserStorageAllowed(t))throw new Error("".concat(t," is not allowed to be written to browser storage"));if("string"!=typeof e)throw new Error("".concat(JSON.stringify(e)," must be a string to be writtable to browser storage"));var r=null!==(o=null==n?void 0:n.usePrefix)&&void 0!==o&&o?this.getPersistedItemName(t):t;this.globalContext.localStorage.setItem(r,e)},t.prototype.deleteLocalStorage=function(t,e){var n;if(!this.isBrowserStorageAllowed(t))throw new Error("".concat(t," is not allowed to be touched/deleted in browser storage"));var o=null!==(n=null==e?void 0:e.usePrefix)&&void 0!==n&&n?this.getPersistedItemName(t):t;this.globalContext.localStorage.removeItem(o)},t.create=function(t){var e=t.accountID,n=void 0===e?"default":e,o=t.globalContext,r=void 0===o?at.globalContext:o,i=t.rootName,a=void 0===i?at.rootName:i,c=t.prependEvents,u=void 0===c?[]:c,s=t.listeners,l=new ct(r,a);l.equip({prependEvents:u}),void 0!==s&&l.subscribe(s);var d={store:new Map,queue:[]};return r[a].set(n,d),new this(n)},t}(),M="_system",T=function(e){function n(t,n){return e.call(this,M,{globalContext:t,rootName:n})||this}return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}(n,e),n}(R);function U(t){var e=function(t,e){throw void 0!==t.context?t.context="".concat(e," > ").concat(t.context):t.context=e,t};return function(n,o,r){var i=r.value;return r.value=function(){for(var n=[],o=0;o0&&this.getAccounts().forEach((function(e){var n;(n=e.queue).unshift.apply(n,c([],a(t),!1))}))},t.prototype.equip=function(t){var e;try{this.createUserspaceRoot(),this.createSystemAccount(),this.observeRootSet(),this.observeAccountQueuesPush(),this.overwriteAccountStoresGet(),this.defineConvenienceFunctions(),this.prependEvents(null!==(e=null==t?void 0:t.prependEvents)&&void 0!==e?e:[])}catch(t){throw(new T).recordErrorEvent({id:"Core.library.Equiper.equip",error:t}),t}},t}();!function(t){t.info="info",t.warn="warn",t.error="error"}(j||(j={}));var W=function(){function t(){}return t.Instance=function(){return this._instance},t.SessionId=function(){return this._sessionId},t.prototype.info=function(){for(var t=[],e=0;e1e4)throw new Error("Too many dispatches. Aborting");n%100==0&&(new T).recordGenericEvent({id:"Core.library.Dispatcher.throwOnInfiniteLoop",props:{recentDispatchesCount:n}}),setTimeout((function(){t.resetStoreItemCount(e)}),100)},t.prototype.dispatch=function(t){var e,n,o,r,i,a=this,c=t.reason;try{this.throwOnInfiniteLoop(),Y()&&Q.info('# Dispatch from method "'.concat(c.method,'" on event "').concat(null!==(n=null===(e=c.events)||void 0===e?void 0:e[0].type)&&void 0!==n?n:"undefined",'" with source "').concat(null!==(i=null===(r=null===(o=c.events)||void 0===o?void 0:o[0].detail)||void 0===r?void 0:r.source)&&void 0!==i?i:"undefined",'"\n_________________________________________')),this.updateExternalEventCount(c.events),this.getAccounts().forEach((function(t){return a.dispatchAccount(t,c)})),this.archive()}catch(t){throw(new T).recordErrorEvent({id:"Core.library.Dispatcher.dispatch",error:t}),t}},t}(),nt=function(){function t(t,e){this.globalContext=t,this.rootName=e}return t.prototype.subscribe=function(t){try{var e=new T,n=null!=e.store.get(q)?e.store.get(q):new Map;e.store.set(q,new Map(c(c([],a(n),!1),a(t),!1)))}catch(t){throw(new T).recordErrorEvent({id:"Core.library.Subscriber.subscribe",error:t}),t}},t}(),ot=function(){function t(t,e){this.globalContext=t,this.rootName=e}return t.prototype.populate=function(){try{var t=new T,e=!1;try{e=JSON.parse(t.read(D))}catch(t){}if(e)return;t.write(D,JSON.stringify(!0)),this.populateFromPrependStore(),this.populateFromQueryParams()}catch(t){throw(new T).recordErrorEvent({id:"Core.library.Populator.populate",error:t}),t}},t.prototype.populateFromPrependStore=function(){var t=this;this.globalContext[this.rootName].forEach((function(e,n){var o,r,i=new R(n,{globalContext:t.globalContext,rootName:t.rootName}),u=null!==(r=i.read(A,{persist:!0}))&&void 0!==r?r:"[]";i.write(A,JSON.stringify([]));try{var s=JSON.parse(u);if(0===s.length)return;(o=i.queue).push.apply(o,c([],a(s.map(it)),!1))}catch(t){console.error("Error processing prepended events",t)}}))},t.prototype.populateFromQueryParams=function(){var t,e,n=null===(e=null===(t=this.globalContext)||void 0===t?void 0:t.location)||void 0===e?void 0:e.search,o=new URLSearchParams(n),r=this.globalContext[this.rootName],i=r.get(M);rt(o,"aps.trigger").forEach((function(t){i.queue.push(it(t))})),rt(o,"aps.triggerFor",!0).forEach((function(t){void 0!==t.accountId&&r.has(t.accountId)&&r.get(t.accountId).queue.push(it(t))}));var a=rt(o,"aps_event");r.forEach((function(t){a.forEach((function(e){t.queue.push(it(e))}))}))},t}(),rt=function(t,e,n){void 0===n&&(n=!1);var o=t.getAll(e),r=[];return o.forEach((function(t){var e,o=t.split(",");n&&(e=o.shift());var i=o.shift();if(void 0!==i&&i.length>0){var a=decodeURIComponent(o.join(",")),c=void 0;if(a.length>0)try{c=JSON.parse(a)}catch(t){console.error("Error processing query param event",i,c)}r.push({eventName:i.replace(/_/g,"/"),eventDetail:c,accountId:e})}})),r},it=function(t){var n;return new CustomEvent(t.eventName,{detail:e({},null!==(n=t.eventDetail)&&void 0!==n?n:{})})},at={globalContext:window,rootName:"_aps"},ct=function(){function t(t,e){void 0===t&&(t=at.globalContext),void 0===e&&(e=at.rootName),this.dispatcher=new et(t,e),this.equiper=new J(t,e,this.dispatcher),this.subscriber=new nt(t,e),this.populator=new ot(t,e),this.globalContext=t,this.rootName=e}return t.prototype.subscribe=function(t){this.subscriber.subscribe(t)},t.prototype.equip=function(t){this.equiper.equip({prependEvents:null==t?void 0:t.prependEvents})},t.prototype.dispatch=function(t){var e=t.reason;this.dispatcher.dispatch({reason:e})},t.prototype.populate=function(){this.populator.populate()},t.prototype.load=function(t){this.equip({prependEvents:t.prependEvents}),this.subscribe(t.listeners),this.dispatch({reason:{method:u.direct}}),this.populate()},n([U("HASH#Core.library.UserSpace.subscribe")],t.prototype,"subscribe",null),n([U("HASH#Core.library.UserSpace.equip")],t.prototype,"equip",null),n([U("HASH#Core.library.UserSpace.dispatch")],t.prototype,"dispatch",null),n([U("HASH#Core.library.UserSpace.populate")],t.prototype,"populate",null),n([U("HASH#Core.library.UserSpace.load")],t.prototype,"load",null),t}();!function(t){t.OpenRTB3_0="OpenRTB3_0"}(X||(X={})),function(t){t.Display="display",t.Video="video",t.MultiFormat="multi-format"}(Z||(Z={})),function(t){t.Googletag="googletag",t.AppNexus="appnexus",t.SAS="sas"}($||($={}));var ut=function(t){var n,o={id:t.slotID,spec:{placement:{tagid:null!==(n=t.slotName)&&void 0!==n?n:t.slotID}}};return void 0!==t.floor&&(o.flr=t.floor.value,o.flrcur=t.floor.currency),void 0!==t.slotParams&&(o.spec.placement.ext=t.slotParams),o.spec.placement=e(e({},o.spec.placement),st(t)),o},st=function(t){var e={};return t.mediaType===Z.MultiFormat?e=lt(t.multiFormatProperties,t.companions):t.mediaType===Z.Video?(e.video={},void 0!==t.sizes&&t.sizes.length>0&&(e.video={w:t.sizes[0][0],h:t.sizes[0][1]}),void 0!==t.companions&&t.companions.length>0&&(e.video.comp=t.companions.map((function(t){return{id:t}})))):t.mediaType===Z.Display&&(e.display={},void 0!==t.sizes&&t.sizes.length>0&&(e.display.displayfmt=t.sizes.map((function(t){return{w:t[0],h:t[1]}})))),e},lt=function(t,e){var n,o={};if(void 0!==t&&(void 0!==t.display&&(o.display={displayfmt:void 0!==t.display.sizes?t.display.sizes.map((function(t){return{w:t[0],h:t[1]}})):void 0}),void 0!==t.video)){var r=null===(n=t.video.sizes)||void 0===n?void 0:n[0];o.video={w:void 0!==r?r[0]:void 0,h:void 0!==r?r[1]:void 0},void 0!==e&&(o.video.comp=e.map((function(t){return{id:t}})))}return o},dt=function(t,e){var n={};return Object.keys(t).forEach((function(o){"object"==typeof t[o]&&null!==t[o]&&(o===e?Object.assign(n,t[o]):Object.assign(n,dt(t[o],e)))})),n},vt=function(t){var e=dt(t,"ext");return Object.entries(e).forEach((function(t){var n=a(t,2),o=n[0],r=n[1];"string"!=typeof r&&(e[o]=JSON.stringify(r))})),0!==Object.keys(e).length?e:void 0},pt=function(t){var n,o=ft(t),r={mediaType:o};return o===Z.MultiFormat?r=e(e({},r),gt(t)):o===Z.Display?r.sizes=ht(t.display):o===Z.Video&&(r.sizes=mt(t.video),void 0!==(null===(n=t.video)||void 0===n?void 0:n.comp)&&(r.companions=yt(t.video))),r},ft=function(t){return void 0!==t.video&&void 0!==t.display?Z.MultiFormat:void 0!==t.video?Z.Video:Z.Display},gt=function(t){var e={multiFormatProperties:{}};return void 0!==t.video&&(e.multiFormatProperties.video={sizes:mt(t.video)},void 0!==t.video.comp&&(e.companions=yt(t.video))),void 0!==t.display&&(e.multiFormatProperties.display={sizes:ht(t.display)}),e},ht=function(t){var e=[];return void 0!==t&&(void 0!==t.displayfmt&&t.displayfmt.length>0&&(e=c(c([],a(e),!1),a(t.displayfmt.map((function(t){return[t.w,t.h]}))),!1)),void 0!==t.h&&void 0!==t.w&&(e=c(c([],a(e),!1),[[t.w,t.h]],!1))),e},mt=function(t){var e=[];return void 0!==t&&void 0!==t.h&&void 0!==t.w&&(e=c(c([],a(e),!1),[[t.w,t.h]],!1)),e},yt=function(t){var e;return void 0!==(null==t?void 0:t.comp)&&t.comp.length>0&&(e=t.comp.map((function(t){return t.id}))),e},bt="ad/targeting",wt="ad/schain",_t="ad/context",Et="ad/googletagSlotAutoImport",xt=new Map([[bt,function(){var t=new Map;return t.get=function(){for(var t=[],e=0;e1}(e))?[2,l.completed]:function(t){var e=t.read(I,{persist:!0});return void 0!==e&&new Date>=new Date(Number(e))}(e)?(function(t){t.delete(I,{persist:!0}),function(t){var e;null===(e=t.globalContext.apstagDEBUG)||void 0===e||delete e.url}(t)}(e),[2,l.completed]):(function(t){t.record(St.debug_events_show),t.record(St.debug_store_show)}(e),[2,l.waiting])}))}))}],[St.debug_listeners_show,function(t){return t.account,o(void 0,void 0,void 0,(function(){var t,e,n;return r(this,(function(o){return t=new T,e=t.store.get(q),n=c([],a(e.entries()),!1),console.groupCollapsed("⌂ Listeners"),console.table(n),console.groupEnd(),[2,l.completed]}))}))}]]),Pt={key:"ad/slots",default:new Map},It={key:"ad/attachTargeting",default:void 0},At={key:"cxm/isConfigLoadInitiated",default:!1};function Dt(t){var n=t.account,i=t.selectedSlots,a=t.publisherParams,c=t.timeout,u=t._endpointDomain,s=t.initConfig;return o(this,void 0,void 0,(function(){var t;return r(this,(function(o){switch(o.label){case 0:return t=function(t){return t.map((function(t){return function(t){if(void 0!==t.version&&t.version!==X.OpenRTB3_0)throw new Error("Invalid OpenRTB version specified");var n=t.spec.placement,o=e({slotID:t.id,slotName:n.tagid},pt(n)),r=vt(t);if(void 0!==r&&(o.slotParams=r),void 0!==t.flr){if(void 0!==t.flrcur&&"USD"!==t.flrcur)throw new Error('item.flrcur: only "USD" is currently supported');o.floor={value:t.flr,currency:"USD"}}return o}(t)}))}(i),[4,kt({account:n,legacySlots:t,publisherParams:a,timeout:c,_endpointDomain:u,initConfig:s})];case 1:return[2,o.sent()]}}))}))}function kt(t){var e=t.account,n=t.legacySlots,i=t.publisherParams,a=t.timeout,c=t._endpointDomain,u=t.initConfig;return o(this,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,new Promise((function(t){if(void 0===e.globalContext.apstag)throw new Error("apstag undefined in global scope");e.globalContext.apstag.fetchBids({slots:n,params:i,timeout:null!=a?a:6e4,_endpointDomain:c},(function(e){t(e)}),{initConfig:u})}))];case 1:return[2,t.sent()]}}))}))}var Nt,Ot,Lt={site:{id:"id",name:"name",domain:"domain",cattax:1,cat:["1"],sectioncat:["first","second"],pagecat:["first","second"],page:"page",ref:"ref",search:"search",mobile:1,privacypolicy:1,publisher:{id:"id",name:"name",cattax:1,cat:["1"],domain:"domain",ext:{}},content:{id:"id",episode:1,title:"title",series:"series",season:"season",artist:"artist",genre:"genre",album:"album",isrc:"isrc",producer:{id:"id",name:"name",cattax:1,cat:["1"],domain:"domain",ext:{}},url:"url",cattax:1,cat:["1"],prodq:1,context:1,contentrating:"contentrating",userrating:"userrating",qagmediarating:1,keywords:"first, second",kwarray:["first","second"],livestream:1,sourcerelationship:1,len:1,language:"language",langb:"langb",embeddable:1,data:[{id:"id",name:"name",segment:[{id:"id",name:"name",value:"value",ext:{}}],ext:{}}],network:{id:"id",name:"name",domain:"domain",ext:{}},channel:{id:"id",name:"name",domain:"domain",ext:{}},ext:{}},keywords:"first, second",kwarray:["first","second"],ext:{}}},Rt=function(t,e){return Object.keys(t).reduce((function(n,o){var r=o;if(void 0!==(null==e?void 0:e[r])){var i=t[r];"object"==typeof i&&!Array.isArray(i)&&Object.keys(i).length>0?n[r]=Rt(i,e[r]):n[r]=e[r]}return n}),{})},Mt=function(t,e,n,o){var r,i,a,c=n.globalContext.document.createElement("iframe"),u=null===(r=e.get("amznsz"))||void 0===r?void 0:r.split("x"),s=e.get("amzniid"),l=t;if(!(void 0===s||void 0===l||void 0===u||u.length<2)){c.style.marginLeft="0",c.style.marginTop="0",c.style.height="".concat(u[1],"px"),c.style.width="100%",c.setAttribute("scrolling","no"),c.setAttribute("frameborder","0");var d=n.globalContext.document.createElement("div"),v=null!==(i=null==o?void 0:o.location)&&void 0!==i?i:"afterend",p=n.globalContext.document.getElementById(l);if(null!=p){p.insertAdjacentElement(v,d),d.appendChild(c);var f=null===(a=null==c?void 0:c.contentWindow)||void 0===a?void 0:a.document;void 0!==f&&(f.open(),f.write('