":">",'"':""","'":"'","/":"/"};return e.replace(/[&<>"'/]/gi,(function(e){return t[e]}))}var Jt=function(){function e(e,t){this._adAdapter=e,this._viewabilityDetector=t,this._isDesktopOrTablet=(0,Y.nI)()||(0,Y.Em)(),this.configureStyle(),this.setWrapperContent(),t.onViewabilityChange(this.onViewabilityChange.bind(this))}return Object.defineProperty(e.prototype,"element",{get:function(){return this._ctaWrapper},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_ctaConfig",{get:function(){return this._adAdapter.ctaConfig},enumerable:!1,configurable:!0}),e.prototype.configureStyle=function(){var e,t,n,r,i,o,a,u,s,c,l,p,d,f,h="";(null===(e=this._ctaConfig)||void 0===e?void 0:e.top)&&(h+="top:".concat(this._ctaConfig.top,"px;bottom:auto;")),(null===(t=this._ctaConfig)||void 0===t?void 0:t.right)&&(h+="right:".concat(this._ctaConfig.right,"px;left:auto;")),(null===(n=this._ctaConfig)||void 0===n?void 0:n.bottom)&&(h+="bottom:".concat(this._ctaConfig.bottom,"px;top:auto;")),(null===(r=this._ctaConfig)||void 0===r?void 0:r.left)&&(h+="left:".concat(this._ctaConfig.left,"px;right:auto;")),(null===(i=this._ctaConfig)||void 0===i?void 0:i.padding)&&(h+="padding:".concat(this._ctaConfig.padding,";")),(null===(o=this._ctaConfig)||void 0===o?void 0:o.bgColor)&&(h+="background-color:".concat(this._ctaConfig.bgColor,";")),(null===(a=this._ctaConfig)||void 0===a?void 0:a.borderRadius)&&(h+="border-radius:".concat(this._ctaConfig.borderRadius,";")),(null===(u=this._ctaConfig)||void 0===u?void 0:u.textColor)&&(h+="color:".concat(this._ctaConfig.textColor,";"));var v="";(null===(c=null===(s=this._ctaConfig)||void 0===s?void 0:s.button)||void 0===c?void 0:c.bgColor)&&(v+="background-color:".concat(this._ctaConfig.button.bgColor,";")),(null===(p=null===(l=this._ctaConfig)||void 0===l?void 0:l.button)||void 0===p?void 0:p.textColor)&&(v+="color:".concat(this._ctaConfig.button.textColor,";"));var _="",y="";(null===(f=null===(d=this._ctaConfig)||void 0===d?void 0:d.advertiser)||void 0===f?void 0:f.textColor)&&(_+="color:".concat(this._ctaConfig.advertiser.textColor,";"),y+="background-color:".concat(this._ctaConfig.advertiser.textColor,";")),this._styles={wrapper:h,button:v,advertiser:_,dot:y}},e.prototype.setWrapperContent=function(){var e,t=this._styles;this._ctaWrapper=i("div",[{key:"class",value:"cta-wrapper align-".concat((null===(e=this._ctaConfig)||void 0===e?void 0:e.right)?"right":"left"," cta-").concat(this._isDesktopOrTablet?"desktop":"mobile")},{key:"style",value:t.wrapper}]);var n=Zt(this._adAdapter.headline),r=n;r.length>50&&(r=r.slice(0,50)+"...");var o=Zt(this._adAdapter.source),a=Zt(this._adAdapter.callToAction);this._ctaWrapper.innerHTML=this._getCtaMarkup(o,r,a,n)},e.prototype._getCtaMarkup=function(e,t,n,r){var i=this._styles,o='\n \n '.concat(e?"Ad: ".concat(e,""):"","\n
").concat(t,'
\n \n \n "),a='\n \n
').concat(t,'
\n \n \n ");return this._isDesktopOrTablet?a:o},e.prototype.onViewabilityChange=function(e){e>=50?this._ctaWrapper.classList.add("show"):this._ctaWrapper.classList.remove("show")},e}(),$t=function(){function e(e,t){var n,r;this._icon=e,this._demoMode=t,this._isShow=!1,this._position={left:void 0,right:void 0,top:void 0,bottom:void 0};var i=(0,N.Os)(null!==(n=this._icon.duration)&&void 0!==n?n:"0")/1e3;this._offsetInSec=(0,N.Os)(null!==(r=this._icon.offset)&&void 0!==r?r:"0")/1e3,this._offsetHideSec=this._offsetInSec+i,this._setPosition()}return e.prototype.updateTimer=function(e){!1===this._isShow&&e>this._offsetInSec&ðis._offsetHideSec&&(this._isShow=!1,this.remove())},e.prototype.show=function(){var e=this;yt(this._icon.iconViewTracking).forEach((function(t){return pt(t.content,e._demoMode)})),this._draw()},e.prototype.remove=function(){this._img&&document.body.removeChild(this._img),this._img=void 0},e.prototype._draw=function(){var e,t=this;this._img=new Image(this.width,this.height),this._img.src=(null===(e=this._icon.staticResource)||void 0===e?void 0:e.content)||"",this._img.title=this.program,this._img.className="icon-btn",void 0!==this.position.left&&(this._img.style.left=this.position.left+"px"),void 0!==this.position.right&&(this._img.style.right=this.position.right+"px"),void 0!==this.position.top&&(this._img.style.top=this.position.top+"px"),void 0!==this.position.bottom&&(this._img.style.bottom=this.position.bottom+"px");var n=this._icon.iconClicks;if(n){var r=yt(n.iconClickTracking);this._img.addEventListener("click",(function(){r.forEach((function(e){return pt(e.content,t._demoMode)})),(0,ie.tG)(n.iconClickThrough.content),t.remove()}))}document.body.appendChild(this._img)},Object.defineProperty(e.prototype,"program",{get:function(){return this._icon.program},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"position",{get:function(){return this._position},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this._icon.width},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._icon.height},enumerable:!1,configurable:!0}),e.prototype._setPosition=function(){switch(this._icon.xPosition){case"left":this._position.left=0;break;case"right":this._position.right=0;break;default:"number"==typeof this._icon.xPosition&&(this._position.left=this._icon.xPosition)}switch(this._icon.yPosition){case"top":this._position.top=0;break;case"bottom":this._position.bottom=0;break;default:"number"==typeof this._icon.yPosition&&(this._position.top=this._icon.yPosition)}},e}(),en=function(){function e(){}return e.prototype.init=function(e,t,n){var r=e.icons;if(r&&0!==r.length){var i=t.containerWidth/2;r=this._cleanDuplication(r);var o=(r=this._cleanEmptyResource(r)).map((function(e){return new $t(e,n)}));this._sortPosition(o,i),this._icons=o}},e.prototype.updateTimer=function(e){var t;null===(t=this._icons)||void 0===t||t.forEach((function(t){return t.updateTimer(e)}))},e.prototype._cleanDuplication=function(e){return e.reverse().filter((function(e,t,n){return t===n.findIndex((function(t){return t.program===e.program}))}))},e.prototype._cleanEmptyResource=function(e){return e.filter((function(e){var t;return!!(null===(t=e.staticResource)||void 0===t?void 0:t.content)}))},e.prototype._sortPosition=function(e,t){var n=e.filter((function(e){return void 0!==e.position.left&&void 0!==e.position.top})),r=e.filter((function(e){return void 0!==e.position.left&&void 0!==e.position.bottom})),i=e.filter((function(e){return void 0!==e.position.right&&void 0!==e.position.top})),o=e.filter((function(e){return void 0!==e.position.right&&void 0!==e.position.bottom}));n.sort((function(e,t){return e.position.left-t.position.left})),r.sort((function(e,t){return e.position.left-t.position.left})),i.sort((function(e,t){return e.position.right-t.position.right})),o.sort((function(e,t){return e.position.right-t.position.right})),this._sorting(n,"left","top",t),this._sorting(i,"right","top",t),this._sorting(o,"right","bottom",t),this._sorting(r,"left","bottom",t)},e.prototype._sorting=function(e,t,n,r){for(var i=1;ir&&(a[t]=0,a[n]=this._getMaxY(e,i,n)+a[n])}},e.prototype._getMaxY=function(e,t,n){for(var r=0,i=0;ie[i].height?r:e[i].height+e[i].position[n];return r},e}(),tn=function(){function e(e,t){this._renderer=e,this._iconsRender=t}return e.prototype.onProgress=function(){this._iconsRender.updateTimer(this._renderer.currentTime)},e}(),nn=function(){function e(e){this._renderer=e}return e.prototype.onComplete=function(){this._renderer.unload()},e}(),rn=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{s(r.next(e))}catch(e){o(e)}}function u(e){try{s(r.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,u)}s((r=r.apply(e,t||[])).next())}))},on=function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0){var r=ln.create(n,"martini-network-requests",i._name,i._targetName),a=ln.stringify(r);o.postMessage(a,i._targetUrl)}}),1e3)}},e.prototype.dispatch=function(e,t,n){return fn(this,void 0,void 0,(function(){var r,i,o,a;return hn(this,(function(u){switch(u.label){case 0:return[4,this._initFuture.getPromise()];case 1:return u.sent(),r=ln.create(t,e,this._name,this._targetName,n),i=ln.stringify(r),(o=(0,ie.Ww)(this._targetElement))&&(this._isSameOrigin?(a=o["martini-message-handler-".concat(this._targetName)])?a({data:i}):console.error("Could not locate martini message handler on target:",o):o.postMessage(i,this._targetUrl)),[2,r]}}))}))},e.prototype.setListener=function(e,t){var n;this._listeners[e]=null!==(n=this._listeners[e])&&void 0!==n?n:[],this._listeners[e]=t},e.prototype.dispatchAndPromisify=function(e,t){return fn(this,void 0,void 0,(function(){var n;return hn(this,(function(r){switch(r.label){case 0:return[4,this.dispatch(e,t)];case 1:return n=r.sent(),[4,this._promiseManager.create(n,e)];case 2:return[2,r.sent()]}}))}))},e.prototype.addAsyncReply=function(e,t){var n=this,r=function(r){return fn(n,void 0,void 0,(function(){var n;return hn(this,(function(i){switch(i.label){case 0:return[4,t(r)];case 1:return n=i.sent(),this.dispatch(e,n,r.id),[2,n]}}))}))};return this.setListener(e,r),r},e.prototype.destroy=function(){for(var e in this._listeners)delete this._listeners[e];delete this._targetUrl,delete this._targetElement,this._isSameOrigin?delete window["martini-message-handler-".concat(this._name)]:window.removeEventListener("message",this._handleMessageReceived),this._demoMode&&this._performanceInterval&&clearInterval(this._performanceInterval)},e.prototype._listen=function(){window.addEventListener("message",this._handleMessageReceived)},e.prototype._handleMessageReceived=function(e){var t=ln.resolve(e.data,this._name);if(t){t.receivedAt=Date.now();var n=this._listeners[t.type];n&&n(t)}},e}(),yn=function(){function e(e,t,n){this._playerGuid=e,this._runnerIndex=t,this._adViewSent=!1,this._startedSent=!1,this._messenger=new _n(n),(0,ie.Jf)(this.sendUnhandledException.bind(this),"executor")}return Object.defineProperty(e.prototype,"_name",{get:function(){return"executor-".concat(this._playerGuid,"-").concat(this._runnerIndex)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_targetName",{get:function(){return"plugin-".concat(this._name)},enumerable:!1,configurable:!0}),e.prototype.init=function(e,t){this._messenger.init(e,t,this._name,this._targetName)},e.prototype.destroy=function(){var e=this;setTimeout((function(){return e._messenger.destroy()}),0)},e.prototype.sendUnhandledException=function(e){this._messenger.dispatch("UNHANDLED_EXCEPTION",e)},e.prototype.onPlaying=function(e){this._messenger.setListener("PLAY",e)},e.prototype.sendPlaying=function(e,t){this._messenger.dispatch("PLAY",e,t)},e.prototype.sendSetSize=function(e,t,n){var r={item1:e,item2:t,item3:n};this._messenger.dispatch("SET_SIZE",r)},e.prototype.sendPausedEvent=function(e){this._messenger.dispatch("PAUSE_SUCCESS",e)},e.prototype.sendPlayComplete=function(e,t,n){var r={item1:e,item2:t,item3:n};this._messenger.dispatch("PLAY_COMPLETE",r)},e.prototype.onPause=function(e){this._messenger.setListener("PAUSE_REQUEST",e)},e.prototype.sendCcLoadedEvent=function(e){this._messenger.dispatch("CLOSED_CAPTIONS_LOADED",e)},e.prototype.onCurrentTimeRequest=function(e){this._messenger.addAsyncReply("CURRENT_TIME",e)},e.prototype.onStop=function(e){this._messenger.setListener("stop",e)},e.prototype.onMute=function(e){this._messenger.setListener("mute",e)},e.prototype.onResume=function(e){this._messenger.setListener("resume",e)},e.prototype.sendStateChanged=function(e){this._messenger.dispatch("AD_STATE",e)},e.prototype.onSetVolume=function(e){this._messenger.setListener("SET_VOLUME",e)},e.prototype.onSetCcLanguage=function(e){this._messenger.setListener("SET_CLOSED_CAPTIONS_LANGUAGE",e)},e.prototype.onSetCcStyle=function(e){this._messenger.setListener("SET_CLOSED_CAPTIONS_STYLE",e)},e.prototype.onShowCaptions=function(e){this._messenger.setListener("SHOW_CAPTIONS",e)},e.prototype.onSetFullscreen=function(e){this._messenger.setListener("SET_FULLSCREEN",e)},e.prototype.sendMediaLoaded=function(e){this._messenger.dispatch("MEDIA_LOADED",e)},e.prototype.sendAdClick=function(e){this._messenger.dispatch("CLICK",e)},e.prototype.sendResume=function(e,t,n){this._messenger.dispatch("resume",{item1:e,item2:t,item3:n})},e.prototype.sendQuartileProgress=function(e,t){this._messenger.dispatch("QUARTILE",{item1:e,item2:t})},e.prototype.sendViewSuccess=function(e){this._adViewSent||(this._messenger.dispatch("VIEW_SUCCESS",e),this._adViewSent=!0)},e.prototype.sendStarted=function(e,t,n){this._startedSent||(this._messenger.dispatch("STARTED",{item1:e,item2:t,item3:n}),this._startedSent=!0)},e.prototype.sendHeavyAdIntervention=function(e){this._messenger.dispatch("AD_INTERVENTION",e)},e.prototype.sendPlaybackStopped=function(e,t){this._messenger.dispatch("stop",e,t)},e}();try{var gn=JSON.parse(window.name),bn=!!gn[e.AD_BLOCKER_DETECTED],mn=gn[e.PLAYBACK_TIMEOUT],En=!!gn[e.DEMO_MODE];new un(new yn(gn[e.PLAYER_GUID],""+gn[e.RUNNER_INDEX],En),mn,bn,En)}catch(e){console.error("There is no window.name in the executor iframe")}}(),__webpack_exports__}()}));
//# sourceMappingURL=executor.html.js.map