]*>)<\/script>","g"),n=new RegExp("]*>)","g");let r;const s=[],i=[];for(;r=e.exec(t);)s.push(K(r[1],r[2]));for(;r=n.exec(t);)i.push(_(r[1],r[2]));return t=(t=t.replace(e,"")).replace(n,""),{scriptPromises:s,cssPromises:i,SCENEHTMLSTRING:t}}(e);Promise.all([...n,...r]).then(e=>{const n=e.filter(t=>"SCRIPT"===t.nodeName),r=e.filter(t=>"STYLE"===t.nodeName),i=function(t){const e=new RegExp(/ id=["']?((?:.(?!["']?\s+(?:\S+)=|[>"']))+.)["']?/gi);let n;const r=[];for(;n=e.exec(t);)r.push(n[1]);const s=new RegExp(/class=["']?((?:.(?!["']?\s+(?:\S+)=|[>"']))+.)["']?/gi);let i=[];for(;n=s.exec(t);)i=[...i,...n[1].split(" ")];return new Set([...r,...i])}(s);for(const t of i){const e=z(),i=new RegExp(`((?:[^\\/]|^)\\b)${t}\\b`,"ig"),o=new RegExp(`((?:class|id)=["'][^"']*?)${t}(.*?["'])`,"ig");if(s=s.replace(o,`$1${e}$2`),t.includes("adacadoSVG")){let n=new RegExp(`fill(="|:)url\\(\\#${t}\\)`,"g"),r={};r[`fill="url(#${t})`]=`fill="url(#${e})`,r[`fill:url(#${t})`]=`fill:url(#${e})`,s=s.replace(n,t=>r[t])}for(const t of n)t.text=t.text.replace(i,"$1"+e);for(const t of r)t.innerText=t.innerText.replace(i,"$1"+e)}const o=document.createElement("div");o.classList.add("transitionable"),u[t]&&o.setAttribute("id",u[t].templateUID),r.forEach(e=>{e.classList.contains("adacadoAnimation")?g[t]=e:o.appendChild(e)}),o.innerHTML+=s,n.forEach(t=>{o.appendChild(t)}),b[t]=o})}function T(t){if(l&&l.length){t.querySelectorAll("[data-adacadonavigationwidget]").forEach(t=>{switch(t.getAttribute("data-adacadonavigationwidget")){case"prev":t.addEventListener("click",()=>{c.publish(r.NAVIGATION_PREVIOUS_CLICKED)});break;case"next":t.addEventListener("click",()=>{c.publish(r.NAVIGATION_NEXT_CLICKED)})}});t.querySelectorAll("[data-adacadodotnavigationbutton]").forEach(t=>{t.addEventListener("click",e=>{const n=parseInt(t.getAttribute("data-adacadodotnavigationbutton"));c.publish(r.NAVIGATION_DOT_CLICKED,n)})})}}c.subscribe(r.SCENECHANGE,(function(t,I){const{ISTRANSITIONFORWARD:y,productIndex:E,ISSCENECHANGESWIPE:v,currentTransitionIn:A}=I;if(!v){if(n=e,i=s,e=d.appendChild(b[t].cloneNode(!0)),o=t,"none"===A?(o==t&&g[t]&&!e.querySelector(".adacadoAnimation")&&e.appendChild(g[t]),B._initVideos(e)):e.addEventListener("transitionend",()=>{o==t&&g[t]&&!e.querySelector(".adacadoAnimation")&&e.appendChild(g[t]),B._initVideos(e)}),p[t].dispatchConfigs&&p[t].dispatchConfigs.length&&p[t].dispatchConfigs.forEach(e=>{let n=l[t].match(/href="([^"]*)"/)[0].split('"')[1],s=e.iframeUrl.split("/"),i=s[s.length-1],o=`[data-adadispatchcheckout="dispatchCheckoutProduct${e.inventoryId}"]`,d=document.querySelector(o);if(e.iframeUrl){const t=document.createElement("iframe");t.setAttribute("src",e.iframeUrl),t.setAttribute("id","dispatchCheckoutIframe"+e.inventoryId),t.setAttribute("data-product-checkout-id",i),t.setAttribute("data-product-url",n),t.setAttribute("class","dispatchCheckoutIframe"),t.setAttribute("style","position:fixed;pointer-events:none;z-index:9999;height:0;width:0;"),t.setAttribute("allow","payment; clipboard-read; clipboard-write"),d.parentElement.appendChild(t),d.style.cursor="pointer",d.addEventListener("click",()=>{a=e,c.publish(r.CHECKOUTCLICK,e),document.querySelector("#dispatchCheckoutIframe"+e.inventoryId).style.width=h+"px",document.querySelector("#dispatchCheckoutIframe"+e.inventoryId).style.height=f+"px",document.querySelector("#dispatchCheckoutIframe"+e.inventoryId).style.pointerEvents="auto"})}else{const t=document.querySelector("a").href;document.querySelectorAll(o).forEach(e=>{e.style.cursor="pointer",e.addEventListener("click",e=>{c.publish(r.CLICK,e),window.open(t,"_blank")})})}}),m){const t=document.createElement("img");t.src=300===h&&250===f?G:H,t.style.position="absolute",t.style.bottom=0,t.style.right=0,t.style.zIndex=9999,t.style.cursor="pointer",t.addEventListener("click",t=>{c.publish(r.FREEMIUMCLICK,t),window.open(F,"_blank")}),e.appendChild(t)}T(e),u[t]&&(u[t].isPreviousNavigatorClicked=!y,u[t].jumpToSpecificProductIndex=E,s=U(c,u[t]),s.initializeWidgetTransitioning()),c.publish(r.SCENERENDERED,e)}})),c.subscribe(r.ENDTRANSITIONS,(function(){n&&n.parentNode.removeChild(n)})),c.subscribe(r.DESTROYCAROUSEL,(function(){c=null,l=null,d=null,e=null,n=null,s=null,i=null})),c.subscribe(r.INITIATESWIPE,(function(t){c.publish(r.ISDRAGGING,!1);const n=t,s=n-1<0?l.length-1:n-1,i=n+1>=l.length?0:n+1;let o=e,a=d.insertBefore(b[s].cloneNode(!0),o),u=d.appendChild(b[i].cloneNode(!0));c.publish(r.SWIPESCENESAPPENDED,{currentScene:o,previousScene:a,nextScene:u})})),c.subscribe(r.SWIPETRANSITIONEND,(function(t){I&&(e=t,T(t),I=!1)})),c.subscribe(r.ISDRAGGING,t=>I=t),window.addEventListener("message",t=>{t.data.name&&"payment_authorized"==t.data.name.toLowerCase()&&c.publish(r.CHECKOUTITEMPURCHASED,a)},!1)}const V=t=>fetch(t).then(t=>t.text()).then(t=>t);function z(){const t=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return`a${t()}${t()}${t()}`}async function K(t,e){const n=new RegExp('src="([^"]*)"'),r=document.createElement("script");if(t){let e;(e=t.match(n))&&(r.textContent=await V(e[1]))}return e&&(r.textContent=e),r}async function _(t,e){const n=new RegExp('src="([^"]*)"'),r=new RegExp('class="([^"]*)"'),s=document.createElement("style");if(s.type="text/css",t){let e;if(e=t.match(n)){const t=await V(e[1]);s.styleSheet?s.styleSheet.cssText=t:s.appendChild(document.createTextNode(t))}(e=t.match(r))&&s.classList.add(e[1])}return e&&(e=e.replace(/(\r\n|\n|\r)/gm,""),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))),s}var Y=n(15),X=n.n(Y);function q(t){let e,n,s,i,o,{MEDIATOR:a,CANVAS:c}=t,l=null,d=!1,u=window.innerWidth,p=window.innerHeight,h=!1,f=null,m=null,I=!1,b=!1;function g(t){return t.changedTouches?t.changedTouches[0]:t}function y(t){if(h){let e="x"==l?g(t).clientX-f:g(t).clientY-m,n="x"==l?u:p;i=Math.sign(e),o=+(i*e/n).toFixed(2),0!=i&&o>.2&&o<1?(a.publish(r.CHANGECURRENTPOSITION,-i),c.style.setProperty("--i",1-i),o=1-o,b=!0):0!=i&&o>=1?(a.publish(r.CHANGECURRENTPOSITION,-i),c.style.setProperty("--i",1-i),b=!0,T(),o=1-o):T(),c.style.setProperty("--tx","0px"),c.style.setProperty("--ty","0px"),c.style.setProperty("--f",o),c.classList.toggle("smooth",!(h=!1)),c.addEventListener("transitionend",T),f=null,m=null,l=null,d=!1,h=!1}}function T(){I||(b?i<0?(E(e),E(n),n=s):(E(s),E(n),n=e):(E(e),E(s)),I=!0,"y"==l?(n.style.height="",c.style.height=window.innerHeight+"px"):(n.style.height="",n.style.width="",c.style.width=window.innerWidth+"px",c.style.height=window.innerHeight+"px"),n.style.pointerEvents="",n.style.userSelect="",n.style.webkitUserSelect="",l=null,b=!1,c.parentNode.style.display="",c.classList.remove("smooth"),c.classList.remove("swipeX"),c.classList.remove("swipeY"),n.classList.add("transitionable"),c.style.setProperty("--i",1),c.style.setProperty("--f",1),c.removeEventListener("transitionend",T),a.publish(r.SWIPETRANSITIONEND,n))}function E(t){t&&t.parentNode.removeChild(t)}a.subscribe(r.DESTROYCAROUSEL,(function(){a=null,c=null,n=null,e=null,s=null,exitingCradl=null,i=null,o=null,l=null,d=null,u=null,p=null,h=null,f=null,m=null})),a.subscribe(r.TOUCHSTART,(function(t){f=g(t).clientX,m=g(t).clientY})),a.subscribe(r.TOUCHMOVE,(function(t){t.preventDefault(),d&&(h&&null===l?(l=Math.abs(g(t).clientX-f){t.style.width="",t.style.height="calc(100% / 3)"}))):h&&l&&function(t){if(!l||!h)return;"x"==l?c.style.setProperty("--tx",Math.round(g(t).clientX-f)+"px"):c.style.setProperty("--ty",Math.round(g(t).clientY-m)+"px")}(t))})),a.subscribe(r.TOUCHEND,y),a.subscribe(r.TOUCHCANCEL,y),a.subscribe(r.SWIPESCENESAPPENDED,(function(t){({currentScene:n,previousScene:e,nextScene:s}=t),c.parentNode.style.display="block",c.classList.add("swipeX"),c.style.width="300%",new Array(e,n,s).forEach(t=>{t.style.width="calc(100% / 3)",t.classList.remove("transitionable")}),d=!0,I=!1,c.classList.toggle("smooth",!(h=!0))}))}function J(t){function e(t){const e=document.createElement("div");return e.setAttribute("id",t),e}console.log("version","2.8");const n=e("container");n.style.width=t.width+"px",n.style.height=t.height+"px",document.querySelector("body").appendChild(n);const s=e("canvas");s.style.width=t.width+"px",s.style.height=t.height+"px",n.appendChild(s);const i=function(){const t={};return{channels:t,publish:function(e){if(!t[e])return;const n=Array.prototype.slice.call(arguments,1),r=t[e].length;for(let s=0;s=o?0:e,e=e<0?o-1:e);const p={ISTRANSITIONFORWARD:s,productIndex:u,currentTransitionIn:a[e].transitionIn};i.publish(r.SCENECHANGE,e,p)}function l(){i&&(i.publish(r.LOGMESSAGE,"Finish Transitioning"),i.publish(r.ENDTRANSITIONS))}i.subscribe(r.SCENERENDERED,(async function(t){i.publish(r.LOGMESSAGE,"Doing Transitions");let o=.5;if(void 0!==s){let{transitionOut:t,transitionOutDuration:e}=a[n];o=e||o,"none"===t&&(o=e=0),s.classList.add(""+t),s.style.zIndex=1,s.style.transitionDuration=`${e}s, ${e}s`}let{transitionIn:c,transitionInDuration:d=.5}=a[e];"none"===c&&(d=0),t.classList.add(c+"--start"),window.requestAnimationFrame(()=>{t.style.zIndex=10,t.style.transitionDuration=`${d}s, ${d}s`,window.requestAnimationFrame(()=>{t.classList.add(c+"--end"),setTimeout(l,1e3*o),s=t})})})),i.subscribe(r.JUMPTOPOSITION,(function(t={}){const{templateIndex:e,productIndex:n}=t;c({ISUSERTRIGGERED:!0,JUMPTOPOSITION:e,productIndex:n})})),i.subscribe(r.TRANSITIONING_MOVE_TO_NEXT_TEMPLATE,(function(){c({ISTRANSITIONFORWARD:!0})})),i.subscribe(r.TRANSITIONING_MOVE_TO_PREVIOUS_TEMPLATE,(function(){c({ISTRANSITIONFORWARD:!1})})),i.subscribe(r.INITIALIZETEMPLATE,()=>c({ISFIRSTTRANSITION:!0})),i.subscribe(r.TOUCHSTART,()=>{i.publish(r.INITIATESWIPE,e)}),i.subscribe(r.CHANGECURRENTPOSITION,(function(t){e+=t,e=e>=o?0:e,e=e<0?o-1:e,i.publish(r.SCENECHANGE,e,{ISSCENECHANGESWIPE:!0})})),i.subscribe(r.DESTROYCAROUSEL,(function(){i=null,o=null,a=null,e=null,n=null,s=null}))}({MEDIATOR:i,TEMPLATES:t.sceneDefinitions,NUMBEROFSCENES:t.scenes.length}),q({MEDIATOR:i,CANVAS:s}),w({MEDIATOR:i,SCENEDEFINITIONS:t.sceneDefinitions,CRADLTRANSITIONS:t.cradlTransitions,INITIALBLANKDELAY:t.initialBlankDelay}),M({MEDIATOR:i,STORYBOARD_CONTAINER:n,NUMBEROFSCENES:t.scenes.length,WIDTH:t.width,HEIGHT:t.height,NAVIGATION_SETTINGS:t.navigation,STORYBOARDID:t.storyboardId}),function(t){const e=Date.now(),{MEDIATOR:n,REQUESTID:s,ADREQUESTPARAMS:i,TEMPLATEIDS:o,INVENTORYIDS:a,STORYBOARDID:c,MARKETINGUSECASEID:l,CAMPAIGNID:d,MEDIACHANNELID:u,ADVERTISERID:p,THEMEID:h,VISITORID:f,ADWIDTH:m,ADHEIGHT:I}=t,{thirdPartyImpressionTrackingUrl:b,thirdPartyClickTrackingUrl:g}=i;let y=!1,T="strtrk.adacado.com";function E(t){document.createElement("img").setAttribute("src",t)}document.URL.includes("staging")?T="staging-"+T:document.URL.includes("localhost")&&(T="localhost");let v=0,A=!1;function S(t,i={}){let b,y;t===L||t===P?y="productIds="+i.productId:(b=i.target?i.target:i,y=b.dataset&&b.dataset["inventory-id"]?"inventoryIds="+b.dataset["inventory-id"]:"inventoryIds="+a[v].join(","));const S=(new Date).getTimezoneOffset(),C=l&&""!=l?"&marketingUseCaseId="+l:"",w=(new X.a.UAParser).getResult(),O=w.browser.name?"&bn="+w.browser.name:"",N=w.browser.version?"&bv="+w.browser.version.split(".")[0]:"",R=w.device?"&dt="+w.device:"&dt=desktop/laptop",x=w.os?"&os="+w.os:"",M=i.x?"&x="+i.x:"",U=i.y?"&y="+i.y:"",k=i.screenX?"&sx="+i.screenX:"",B=i.screenY?"&sy="+i.screenY:"",F="&aw="+m,G="&ah="+I,H=Date.now(),j="&eapt="+Math.round((H-e)/100),V=t===D?"&imc="+A:"",z="&pos="+v,K="&numpos="+o.length,_=i.target?"&domTarget="+i.target.tagName.toLowerCase():"";let Y=`https://${T}/web/v2/mediachannelevents/${s}/${f}/${p}/${d}/${u}/${h}/${c}/${o[v]}/${S}/${t}?${y}${M}${U}${_}${C}${k}${B}\n ${V}${z}${K}${O}${N}${R}\n ${x}${F}${G}${j}`;n.publish(r.LOGINFO,"DISPATCH TRACKING: "+Y),E(Y),g&&t===D&&(n.publish(r.LOGINFO,"DISPATCH SNIPPET-DEFINED SIGNAL: "+g),E(g))}b&&E(b),n.subscribe(r.SCENECHANGE,(function(t){v=t,S(O)})),n.subscribe(r.DISPATCHTRACKING,S),n.subscribe(r.CLICK,(function(t){y||(S(D,t),y=!1)})),n.subscribe(r.CHECKOUTCLICK,(function(t){y||(S(L,t),y=!1)})),n.subscribe(r.FREEMIUMCLICK,(function(t){y||(S(R,t),y=!1)})),n.subscribe(r.FREEMIUMVIEW,(function(){S(N)})),n.subscribe(r.CHECKOUTITEMPURCHASED,(function(t){S(P,t)})),n.subscribe(r.MOUSEENTER,(function(){A=!0})),n.subscribe(r.ISDRAGGING,t=>{y=t})}({MEDIATOR:i,REQUESTID:t.userData.requestId,ADREQUESTPARAMS:t.userData.adRequestParameters,VISITORID:t.userData.visitorId,TEMPLATEIDS:t.tracking.templates,INVENTORYIDS:t.tracking.inventory,STORYBOARDID:t.storyboardId,MARKETINGUSECASEID:t.marketingUseCaseId,CAMPAIGNID:t.campaignId,MEDIACHANNELID:t.mediaChannelId,ADVERTISERID:t.advertiserId,THEMEID:t.themeId,ADWIDTH:t.width,ADHEIGHT:t.height}),function(t){const{MEDIATOR:e,ADVERTISERID:n,CAMPAIGNID:s,INVENTORYIDS:i}=t;let o=0;const a={getItem:t=>t&&decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*"+encodeURIComponent(t).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*([^;]*).*$)|^.*$"),"$1"))||null,setItem(t,e,n,r,s,i){if(!t||/^(?:expires|max\-age|path|domain|secure)$/i.test(t))return!1;let o="";if(n)switch(n.constructor){case Number:o=n===1/0?"; expires=Fri, 31 Dec 9999 23:59:59 GMT":"; max-age="+n;break;case String:o="; expires="+n;break;case Date:o="; expires="+n.toUTCString()}return document.cookie=encodeURIComponent(t)+"="+encodeURIComponent(e)+o+(s?"; domain="+s:"")+(r?"; path="+r:"")+(i?"; secure":""),!0},removeItem(t,e,n){return!!this.hasItem(t)&&(document.cookie=encodeURIComponent(t)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT"+(n?"; domain="+n:"")+(e?"; path="+e:""),!0)},hasItem:t=>!!t&&new RegExp("(?:^|;\\s*)"+encodeURIComponent(t).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(document.cookie),keys(){const t=document.cookie.replace(/((?:^|\s*;)[^\=]+)(?=;|$)|^\s*|\s*(?:\=[^;]*)?(?:\1|$)/g,"").split(/\s*(?:\=[^;]*)?;\s*/);for(let e=t.length,n=0;n`${t}&inventoryId=${e}`,""),d="click_"+n,u="campaignId="+s+"&position="+o+l+"&time="+(new Date).toUTCString();a.setItem(d,u,1/0,"/",".adacado.com",!1),e.publish(r.LOGINFO,`SET COOKIE: ${d} = ${u}`)})),e.subscribe(r.SCENECHANGE,(function(t){o=t}))}({MEDIATOR:i,ADVERTISERID:t.advertiserId,CAMPAIGNID:t.campaignId,INVENTORYIDS:t.tracking.inventory}),i.publish(r.LOGMESSAGE,"Begin Initialization"),i.publish(r.LOGMESSAGE,t),window.addEventListener("click",e=>{t.isDebuggingOn&&i.publish(r.LOGWARN,"User has clicked on something"),e.target.hasAttribute("data-adacadonavigationwidget")||e.target.hasAttribute("data-adadispatchcheckout")||"SPAN"===e.target.tagName&&e.target.parentNode.hasAttribute("data-adadispatchcheckout")||i.publish(r.CLICK,e)}),n.addEventListener("mouseenter",()=>i.publish(r.MOUSEENTER)),n.addEventListener("mouseleave",()=>i.publish(r.MOUSELEAVE)),n.addEventListener("touchstart",t=>{t.touches.length>1?t.preventDefault():i.publish(r.TOUCHSTART,t)}),n.addEventListener("touchmove",t=>i.publish(r.TOUCHMOVE,t)),n.addEventListener("touchend",t=>i.publish(r.TOUCHEND,t)),n.addEventListener("touchcancel",t=>i.publish(r.TOUCHCANCEL,t)),i.publish(r.INITIALIZECAROUSEL),t.shouldDisplayWatermark&&$(t)&&i.publish(r.FREEMIUMVIEW)}n(39),n(41),window.adacado={};let W=document.location.href.split("?")[1];if(W){const t={};W.split("&").map(e=>{const[n,r]=e.split("=");t[n]=r}),W=t}const{bale:Z}=W;if(Z){Q({data:JSON.parse(atob(Z))})}else{window.addEventListener("DOMContentLoaded",(function(){window.parent.postMessage("loaded","*")}),!1),window.addEventListener("message",(function(t){if(!["https://checkout.dispatch.co","https://checkout-sdk.dispatch.co"].includes(t.origin))return void Q(t);const e=t.data.name;if(e)switch(e.toLowerCase()){case"checkout_dismissed":return void document.querySelectorAll(".dispatchCheckoutIframe").forEach(t=>{t.style.width=0,t.style.height=0,t.style.pointerEvents="none"});case"sales_disabled":return n=t.data.data.distributionId,void document.querySelectorAll(".dispatchCheckoutIframe").forEach(t=>{if(t.getAttribute("data-product-checkout-id")===n){const e=t.getAttribute("id").split("dispatchCheckoutIframe")[1],n=t.getAttribute("data-product-url");let r=`[data-adadispatchcheckout="dispatchCheckoutProduct${e}"]`,s=document.querySelector(r),i=s.cloneNode(!0);s.parentNode.replaceChild(i,s),i.addEventListener("click",t=>{t.preventDefault(),window.open(n,"_blank")})}})}var n}),!1)}async function Q(t){if("loaded"===t.data||"webpackOk"==t.data.type)return;let e;e=t.data.url?await async function(t){const e=await async function(t){const e={credentials:t.includes("localhost")?"omit":"include"};return t=`${t.startsWith("//")?"":"//"}${t}`,fetch("https:"+t,e).then(t=>t.json()).catch(t=>{console.error("Ad Request Error",t)})}(t),{Status:n}=e;switch(n){case 400:return{errorState:"invalidInput"};case 401:return{errorState:"advertiserIsOff"};case 403:return{errorState:"ccInfoNotSet"};case 404:return{errorState:"noData"};case 405:return{errorState:"cantReadCache"};case 407:return{errorState:"freemiumInactive"}}const{advertiserId:r,vertical:s,campaignId:i,mediaChannelId:o,themeId:a,storyboardId:c,marketingUseCaseId:l,cachebuster:d,userData:u,scenes:p,shouldDisplayWatermark:h}=e;if(!p||!p.length)return{errorState:"scenesIsEmpty"};let f="content.adacado.com";document.URL.includes("staging")?f="staging-"+f:document.URL.includes("localhost")&&(f="localhost:8080");const m=new Set,I=new Set;for(const t of p)m.add(t.templateId),t.inventoryIds.forEach(t=>{I.add(t)});const b={},g=[...m].map(t=>{const e=`https://${f}/template/v1/${t}?${d}`;return b[e]=t,e}),y={},T=g.map(t=>fetch(t).then(t=>t.json()).then(e=>{const n=b[t];y[n]=e.Entity,y[n].templateJson&&(y[n].templateJson=JSON.parse(y[n].templateJson))}).catch(t=>{}));if(t.includes("/web/v3/rendertemplate"))return Promise.all([...T]).then(()=>{const t=y[Object.keys(y)[0]].templateJson;return{cachebuster:d,advertiserId:0,campaignId:0,mediaChannelId:0,themeId:0,storyboardId:0,marketingUseCaseId:"",storyboardData:{width:t.width,height:t.height},userData:u,sceneDefinitions:p,templateMap:y}}).catch(t=>{console.error(t)});const E={},v=[...I].map(t=>{const e=`https://${f}/inventory/v1/${s.toLowerCase()}/${r}/${t}`;return E[e]=t,e});let A,S;const C=fetch(`https://${f}/advertiser/v1/advertiser/${r}?${d}`).then(t=>t.json()).then(t=>{A=t,S=t.url,S&&!S.startsWith("http")&&(S="https://"+S)}).catch(t=>{});let w;const O=fetch(`https://${f}/theme/v1/${a}?${d}`).then(t=>t.json()).then(t=>{w=t.Entity}).catch(t=>{});let N;const D=fetch(`https://${f}/storyboard/v1/${c}?${d}`).then(t=>t.json()).then(t=>{N=JSON.parse(t.Entity.storyboardJson)}).catch(t=>{}),L={},R=v.map(t=>fetch(t).then(t=>t.json()).then(e=>{const n=E[t];L[n]=e}).catch(t=>{}));return Promise.all([C,O,D,...T,...R]).then(()=>({cachebuster:d,advertiserData:A,advertiserId:r,advertiserURL:S,campaignId:i,mediaChannelId:o,themeId:a,storyboardId:c,marketingUseCaseId:l,userData:u,themeData:w,storyboardData:N,sceneDefinitions:p,templateMap:y,inventoryDataMap:L,shouldDisplayWatermark:h})).catch(t=>{console.error(t)})}(t.data.url):t.data;const{errorState:n}=e;if(n)return void function(t){let e="Please check your campaign settings";switch(t){case"advertiserIsOff":e="Advertiser is off. Please turn on the advertiser and allow up to 5 mins to see the ads.";break;case"scenesIsEmpty":case"noData":e="More products are needed to preview this ad, please input more sample products.";break;case"ccInfoNotSet":e="Payment method not present or could not be loaded. Please check payment method and retry.";break;case"freemiumInactive":e="Ad tags for this Freemium Ads advertiser have not yet been activated.";break;case"invalidInput":e="Ad Request Parameter is invalid";break;case"cantReadCache":e="No valid media channel found: Check you ad serving settings and retry."}const n=document.createElement("h1");n.innerText=e;document.getElementsByTagName("body")[0].appendChild(n)}(n);if(t.data.p)for(const n of Object.keys(t.data.p))e.userData.adRequestParameters[n]||(e.userData.adRequestParameters[n]=t.data.p[n]);const r=await async function(t){const{advertiserData:e,advertiserId:n,advertiserURL:r,campaignId:s,mediaChannelId:i,themeId:o,storyboardId:a,userData:c,themeData:l,marketingUseCaseId:d,storyboardData:u,sceneDefinitions:I,templateMap:T,inventoryDataMap:E,cachebuster:v,shouldDisplayWatermark:A}=t,S={},C={};if(l){"string"==typeof l.themeJson&&(l.themeJson=JSON.parse(l.themeJson));let t=JSON.stringify(l.themeJson);if(t&&(t=t.split("/abstractThemePath").join(p.getThemeAssetPath(h(o))),l.themeJson=JSON.parse(t),l.themeJson.staticData&&l.themeJson.staticData.length))for(const t of l.themeJson.staticData)S[t.name]=t.value,C[t.name]=t.cacheBustValue}if(u&&u.storyboardJson){let t=JSON.stringify(u.storyboardJson);if(t=t.split("/abstractStoryboardPath").join(p.getStoryboardAssetPath(h(a))),u.storyboardJson=JSON.parse(t),u.storyboardJson.staticData)for(const t in Object.keys(u.storyboardJson.staticData))S[t]=u.storyboardJson.staticData[t]}const w=[],O={};let N=0,D="wsa.adacado.com";(document.URL.includes("staging")||document.URL.includes("localhost"))&&(D="staging-"+D);for(const t of I){let i=T[t.templateId].templateHtml;t.dispatchConfigs=await f(i,t,{servicesDomain:D,inventoryDataMap:E,advertiserURL:r}),i=b(h(t.templateId),i),i=g(h(t.templateId),i),i=m(i);const o=T[t.templateId].templateJson,a=Object.assign({},S);if(o&&o.staticData)for(const t in Object.keys(o.staticData))a[t]=o.staticData[t];const l={inventoryDataMap:E,userData:c,advertiserURL:r,scene:t,staticDataForThisScene:a,staticDataCacheBustValues:C,cachebuster:v,advertiserId:n,advertiserData:e};if(o.productPlaceholdersListString&&o.productPlaceholdersListString.length){const e=y(b(h(t.templateId),T[t.templateId].templateJson.productPlaceholdersListString),l,n,s),r=`adacado-cradlID${Date.now()}-${N}`;O[N]={productsList:JSON.parse(e),widgetTransitionSettings:T[t.templateId].templateJson.widgetTransitionSettings,perProductStageTime:T[t.templateId].templateJson.perProductStageTime,dynamicDataCount:T[t.templateId].templateJson.dynamicDataCount,templateUID:r}}N++,i=y(i,l,n,s),w.push(i),await L(100)}function L(t){return new Promise(e=>setTimeout(e,t))}return u.isDebuggingOn=document.URL.includes("localhost")||document.URL.includes("staging"),u.sceneDefinitions=I,u.scenes=w,u.userData=c,u.storyboardId=a,u.campaignId=s,u.mediaChannelId=i,u.advertiserId=n,u.marketingUseCaseId=d,u.themeId=o,u.tracking={templates:I.map(t=>t.templateId),inventory:I.map(t=>t.inventoryIds)},u.cradlTransitions=O,u.shouldDisplayWatermark=A,u}(e);r&&function t(e){try{J(e)}catch(n){console.error(n),setTimeout(()=>{t(e)},1e3)}}(r)}function $(t){return 300===t.width&&250===t.height||728===t.width&&90===t.height}}]);