!function(){var Y="vast",Z="-1",t="time",d="[ERRORCODE]",E="vmap",ee=5e3,te=15e3,ie="jwp",re="jwpspotx",ne="autostartNotAllowed",se="viewable",ae=5,l="paused",oe="playing",de="adPodError",r="viewable",le="adBidRequest",ue="adBidResponse",he="adBreakEnd",n="adBreakIgnored",pe="adBreakStart",s="adClick",ce="adComplete",me="adError",fe="adImpression",ve="adLoaded",u="adMeta",o="adPause",h="adPlay",ye="adRequest",ge="adSchedule",Ae="adSkipped",e="adStarted",p="clickthrough",Pe="external",i=Pe,a="click",c="play",m="error",f="complete",v=[fe,me,de],y=[e,ce,fe,s,Ae,me,h,o,u],g=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},A=function(){function r(e,t){for(var i=0;i"),n.contentWindow.myCallback=r,s.close(),n}(e.utils,this.vpaidURL,this.playerContainer,this.callback.bind(this))}return a.prototype.sendEvent=function(e,t){(t=t||{}).tag||(t.tag=this.adTag),this.trigger(e,t)},a.prototype.sendTimeEvent=function(e,t,i){var r=t.getAdDuration(),n=t.getAdRemainingTime(),s=ke({duration:r},i);this.sendEvent(e,s),0this.lastQuartile&&this.lastQuartile<3;)this.lastQuartile++,1===this.lastQuartile?this.trackPings("firstQuartile"):2===this.lastQuartile?this.trackPings("midpoint"):3===this.lastQuartile&&this.trackPings("thirdQuartile");this.trackProgress(e,t)}},o.prototype.trackProgress=function(e,t){for(var i=this.progressEvents.length;i--;){var r=this.progressEvents[i];if(!r.tracked){var n=r.offset;r.percentage&&(n=t*n/100),n<=e&&(r.tracked=!0,this.trackPings(r.key))}}},o.prototype.error=function(){var e=0a[d.file].width)&&(d=e),t.width>=o.width&&(!l||t.widththis.adPodIndex&&(this.vpaidPlayer&&(this.vpaidPlayer.destroy(),this.vpaidPlayer=null),this.adPodIndex++,this.scheduledAd._adPodIndex=this.adPodIndex,this.playAd())},a.prototype.playVpaid=function(e){var t=this;clearTimeout(this.creativeTimeout),this.creativeTimeout=setTimeout(function(){t.creativeAdError("VPAID tag communication timeout",900,50004)},this.scheduledAd.creativeTimeout);var i=S(this.vastAd=e),r=this.optionalParams.conditionaladoptout&&e.conditionalAd;if(this.vastAd.selectedMedia=i,this.mediaType=i.type,"flash"===I(i))return this.creativeAdError("Flash creatives are not supported",403,10403),!1;var n={adParams:this.vastAd.adParams,vpaidControls:this.optionalParams.vpaidcontrols,adOptOut:r};return this.vpaidPlayer=new P(this.player,this.blockingInstreamPlayer,i.file,this.scheduledAd._currentTag,n),this.blockingInstreamPlayer&&this.blockingInstreamPlayer.applyProviderListeners(this.vpaidPlayer),this.vpaidPlayer.on("play",this.playHandler,this),this.vpaidPlayer.on("pause",this.pauseHandler,this),this.vpaidPlayer.on("quartile",this.quartileHandler,this),this.vpaidPlayer.on("remainingTimeChange",this.remainingTimeHandler,this),this.vpaidPlayer.on("click",this.clickVpaidHandler,this),this.vpaidPlayer.on("error",this.playbackErrorHandler,this),this.vpaidPlayer.on("impression",this.impressionHandler,this),this.vpaidPlayer.on("expandedChange",this.vpaidExpandedHandler,this),this.vpaidPlayer.on("close",this.adCloseHandler,this),this.vpaidPlayer.on("skipped",this.vpaidAdSkipped,this),this.vpaidPlayer.on("stopped",this.endOfVpaidAdHandler,this),this.vpaidPlayer.on("complete",this.adCompleteHandler,this),this.vpaidPlayer.on("started",this.adStartedHandler,this),this.setupSkipButton(e),!0},a.prototype.setupSkipButton=function(e){var t="skipoffset"in e?be.utils.seconds(e.skipoffset):-1,i=0<=this.optionalParams.skipoffset?this.optionalParams.skipoffset:t;0<=i&&this.blockingInstreamPlayer&&(this.blockingInstreamPlayer.off(Ae,this.skipVpaidAd,this),this.blockingInstreamPlayer.setupSkipButton(i,this.optionalParams,be.utils.noop),this.blockingInstreamPlayer.on(Ae,this.skipVpaidAd,this))},a.prototype.playInstream=function(e,t){var i=this,r=this.player.getEnvironment().OS;return r.android&&2===r.version.major&&3===r.version.minor?(this.adError("Android 2.3 not supported",900,60007),!1):(clearTimeout(this.creativeTimeout),this.creativeTimeout=setTimeout(function(){i.creativeAdError("VAST tag communication timeout",900,60004)},this.scheduledAd.creativeTimeout),this.blockingInstreamPlayer?this.instreamPlayer=this.blockingInstreamPlayer:this.instreamPlayer=this.player.createInstream().init(),this.instreamPlayer.on("play",this.playHandler,this),this.instreamPlayer.on("pause",this.pauseHandler,this),this.instreamPlayer.on("time",this.timeHandler,this),this.instreamPlayer.on("playlistItem",this.playlistItemHandler,this),this.instreamPlayer.on("complete",this.adCompleteHandler,this),this.instreamPlayer.on("playlistComplete",this.endOfAdBreakHandler,this),this.instreamPlayer.on("mute",this.muteHandler,this),this.instreamPlayer.on("instreamClick",this.clickInstreamHandler,this),this.instreamPlayer.on("adSkipped",this.adSkipped,this),this.instreamPlayer.on("error",this.playbackErrorHandler,this),this.instreamPlayer.on("mediaError",this.playbackErrorHandler,this),this.instreamPlayer.on("destroyed",function(){i.instreamPlayer=null},this),this.instreamPlayer.loadItem(e,t),this.clearBlocking(),!0)},a.prototype.playerFullscreenHandler=function(e){var t=this.getVastAd(this.adPodIndex).tracker;e.fullscreen&&t.started&&t.fullscreen()},a.prototype.playerResizeHandler=function(e){this.vpaidPlayer&&this.vpaidPlayer.resize(e.width,e.height)},a.prototype.playerVolumeHandler=function(e){this.vpaidPlayer&&this.vpaidPlayer.setVolume(e.volume)},a.prototype.playlistItemHandler=function(e){this.instreamPlayer&&(this.scheduledAd._adPodIndex=this.adPodIndex=e.index+this.initialIndex)},a.prototype.impressionHandler=function(e){var t=this.getVastAd(this.adPodIndex),i=t.tracker;i.impression();var r={};r.adposition=this.scheduledAd._position||"",r.adtitle=t.adTitle||"",r.creativeId=t.creativeId||"",w(t,r),r.vastversion=t.vastversion,r.clickThroughUrl=t.clickthrough,r.duration=t.duration||0,r.mediafile={file:t.selectedMedia.file},r.linear=e.linear||i.linear,this.addConditionalAdData(r),_(t,r),T(t,r),this.triggerEvent(fe,r),this.setupViewableListener()},a.prototype.setupViewableListener=function(){this.player.off(r,this.viewableHandler,this),this.player.on(r,this.viewableHandler,this),this.viewableHandler({viewable:this.player.getViewable()})},a.prototype.viewableHandler=function(e){e.viewable?(this.viewablePlayedTime=0,this.lastPosition=null,this.adViewableImpressionHandler=this.adViewableHandler):this.adViewableImpressionHandler=this.player.utils.noop},a.prototype.playHandler=function(e){clearTimeout(this.creativeTimeout);var t,i,r=this.getVastAd(this.adPodIndex),n=r.tracker,s=void 0;if(n.started)e.oldstate===l&&(n.resume(),this.dispatchPlay(e));else{this.vpaidPlayer&&(n.linear=e.linear),this.instreamPlayer&&this.impressionHandler({linear:n.linear});var a=ke({linear:n.linear},this.getInstreamOptions(r));a.adMessage=this.optionalParams.dynamicMessage||"",a.clickThroughUrl=r.clickthrough,a.sequence&&(a.podMessage=this.optionalParams.podMessage||""),r.adTitle&&(a.adtitle=r.adTitle),r.companions&&(a.companions=r.companions),T(r,a),this.triggerEvent(u,a),r.companions&&((s={}).companions=(i=r.companions,be._.map(i,function(e){var t="iframe"===e.type||"html"===e.type?e.type:"static",i=void 0;return e.trackers&&e.trackers.creativeView&&e.trackers.creativeView.length&&(i=e.trackers.creativeView),{width:e.width,height:e.height,type:t,resource:e.source,creativeview:i,click:e.clickthrough}})),s.universalAdIdRegistry=r.companionUniversalAdIdRegistry,s.universalAdIdValue=r.companionUniversalAdIdValue,this.triggerEvent("adCompanions",s));var o=this.companion,d=void 0;9this.adPodIndex)return this.vpaidPlayer&&(this.vpaidPlayer.destroy(),this.vpaidPlayer=null),this.adPodIndex++,void this.playAd();this.endOfAdBreakHandler()},a.prototype.endOfAdBreakHandler=function(){this.removePlayerListeners(),this.trigger(ce)},a.prototype.muteHandler=function(e){var t=this.getVastAd(this.adPodIndex).tracker;t&&(e.mute?t.mute():t.unmute(),this.vpaidPlayer&&this.vpaidPlayer.setVolume(e.mute?0:this.player.getVolume()))},a.prototype.clickStaticHandler=function(){var e=this.getVastAd(this.adPodIndex);this.player.pause({reason:p}),this.clickThrough(e)},a.prototype.clickVpaidHandler=function(e){var t=this.getVastAd(this.adPodIndex),i=!0;e&&void 0!==e.url&&(!1===e.playerHandles&&(i=!1),t.clickthrough=e.url),this.clickThrough(t,i)},a.prototype.clickInstreamHandler=function(){this.instreamPlayer.getState()!==l&&this.clickThrough(this.getVastAd(this.adPodIndex))},a.prototype.clickThrough=function(e){var t=!(1this.playedMidRolls.length){this.sort(i);for(var r=0;this.midRolls[r];){var n=N(this.midRolls[r]._offSet,i);if(e<=n&&-1===this.playedMidRolls.indexOf(r)){var s=Se()+1e3*(n-e);return n<=t&&this.adRules.timeBetweenAdsAllowsAdPlayback(null,s)?r:null}r+=1}}var a=Se()+1e3*(i-e);return this.postRoll&&i<=t&&this.adRules.timeBetweenAdsAllowsAdPlayback(null,a)?-1:null},t.prototype.getNextMidrollIndex=function(e,t,i){if(this.adRules.timeBetweenAds||this.adRules.startOnSeek)return this.getLastMidRollIndexBetweenTime(e,t,i);if(this.midRolls.length>this.playedMidRolls.length){var r=this.getClosestIndex(t,i);if(0<=r&&this.playedMidRolls.indexOf(r)<0)return this.playedMidRolls.push(r),r}return null},t.prototype.getMidRolls=function(){var t=this;return this.midRolls.map(function(e){return F(e,t.requestTimeout,t.creativeTimeout)})},t.prototype.reset=function(){null!==this._vmapXHR&&(D(this._vmapXHR),this._vmapXHR=null),this.playedMidRolls=[],this.duration=0},t.prototype.addMidRoll=function(e){this.midRolls.push(e),this.duration=0},t.prototype.setPostRoll=function(e){this.postRoll=e},t.prototype.sort=function(i,e){(!i||i<1)&&(i=1),(this.duration!==i||e)&&(this.duration=i,this.midRolls.sort(function(e,t){return N(e._offSet,i)-N(t._offSet,i)}),function(e,t){for(var i=0;i=N(this.midRolls[i]._offSet,t))return i;return-1},t}();function F(e,t,i){var r=void 0;if(be.utils.foreach(e,function(e,t){(r=r||{})[e]="_adQueue"===e?t.slice():t}),r)return r.requestTimeout=t,r.creativeTimeout=i,r._errors=[],r._waterfallIndex=0,r}function N(e,t){return"%"===e.toString().slice(-1)?t*parseFloat(e.slice(0,-1))/100:parseFloat(e)}var Re=function(){function e(){g(this,e)}return e.prototype.getSchedule=function(e,t){var i=new Ce(t);if(i.requestTimeout=X(e.requestTimeout,ee),i.creativeTimeout=X(e.creativeTimeout,te),e.tag)i.setPreRoll({_offSet:"pre",_adQueue:U(e.tag),_waterfallIndex:0});else if("string"==typeof e.vastxml)i.setPreRoll({_offSet:"pre",_adXML:e.vastxml});else{if("string"==typeof e.schedule)return i.setVMAP(e.schedule),i;if("string"==typeof e.adschedule)return i.setVMAP(e.adschedule),i;!function(d,l){var u=l.schedule||l.adschedule;if(!u)return;Object.keys(u).forEach(function(e){var t=u[e];t.ad&&(ke(t,t.ad),delete t.ad);var i=function(e){if("start"===e||"0%"===e||!e&&0!==e)return"pre";if("end"===e||"100%"===e)return"post";if("pre"===e||"post"===e||-1=f.floorPriceCents&&(m.tag=(u=v,h=l,p=f.playerWidth,c=f.playerHeight,["https://an.facebook.com/v1/instream/vast.xml?placementid="+u,"&playerwidth="+p,"&playerheight="+c,"&SDK[]="+Be,"&bidid="+h,"&pageurl="+dt].join(""))),m}).catch(function(e){return{result:Ke,code:it,message:"FAN header bidding failed: "+e}})},getCustomResponse:function(){return{}}};var ut=null;function ht(){return null===ut&&(ut=Promise.resolve(window.apstag).then(function(e){return e&&e.init&&e.fetchBids?e:ot(["file"===document.location.protocol?"https:":"",Ve].join(""),K).then(function(){return window.apstag})}).catch(function(e){throw ut=null,e})),ut}var pt=null,ct=null;function mt(e){if(null===ct){var t=at(),i=pt||window.SpotX;if(i&&i.DirectAdOS)return ct=Promise.resolve({SpotX:i,loadingTime:0});var r=["file"===document.location.protocol?"https:":"",He,e,".js"].join("");(ct="function"==typeof require?(n=r,s=K,new Promise(function(e,t){setTimeout(t,s),require([n],e,t)}).catch(function(){return Promise.reject({message:Je})})).then(function(e){return{SpotX:pt=e,loadingTime:at()-t}}).catch(function(){return ft(r,t)}):ft(r,t)).catch(function(){ct=null})}var n,s;return ct}function ft(e,t){return ot(e,K).then(function(){return{SpotX:window.SpotX,loadingTime:at()-t}})}var vt=void 0,yt={requestBids:function(e,l){if(!e.id)return Promise.resolve({result:Ge,code:302});var t={channel_id:e.id,slot:l.playerContainer,content_width:l.playerWidth,content_height:l.playerHeight,player_vendor:"SpotXJW",player_vendor_id:l.playerId,ad_volume:l.adVolume,ad_mute:l.mute?1:0,autoplay:l.autoplay,blocked_autoplay_override_mode:l.autoplayAdsMuted,start_delay:function(e){if("start"===e||"0%"===e||!e||"pre"===e||"00:00:00"===e)return 0;if("end"===e||"100%"===e||"post"===e)return-2;if("string"==typeof e&&0<=e.indexOf("%"))return-1;var t=parseInt(e);return 0r.priceInCents||e.priceInCents===r&&e.timeForBidResponse',It.className="jw-vast-nonlinear-open-button",Et.className="jw-vast-nonlinear-close-button";var St={cursor:"pointer",position:"absolute",margin:"auto",left:0,right:0,bottom:0,display:"block"},Ct="opacity 0.2s",Rt={"-webkit-transition":Ct,transition:Ct};function xt(e,t){be.utils.style(e,{opacity:t||1})}function Mt(e){be.utils.style(e,{opacity:0})}function Vt(){xt(Et)}function Ot(){xt(Et,.75)}function Bt(){xt(It)}function Lt(){xt(It,.5)}var Ht=function(){function s(e,t,i,r,n){g(this,s),this.player=e,this.environment=e.getEnvironment(),this.div=r,this.staticURL=t,this.clickURL=i,this.loadTimer=-1,this.animationTimer=-1,this.banner=null,ke(this,e.Events),this.banner=document.createElement("img"),this.banner.className="jw-banner",this.banner.id=this.player.id+"_vast_static",Mt([Et,It]),this.remove(It),this.div.appendChild(this.banner),this.div.appendChild(Et),this.loadTimer=setTimeout(this.imageLoadError.bind(this),n),this.banner.onerror=this.imageLoadError.bind(this),this.banner.onload=this.onLoaded.bind(this),this.banner.src=this.staticURL}return s.prototype.onLoaded=function(){clearTimeout(this.loadTimer),0!==this.banner.naturalWidth?(this.removeBannerEventListeners(),be.utils.style(Et,{top:-this.banner.height-8,bottom:this.banner.height-8,left:this.banner.width},!0),be.utils.style(It,{top:-16},!0),xt([this.div,this.banner]),xt(Et,.75),new be.utils.UI(this.banner).on("click tap",this.sendClick.bind(this)),this.environment.OS.mobile&&(this.div.onmouseover=Vt,this.div.onmouseout=Ot),Et.onclick=Et.ontouchstart=this.collapse.bind(this),It.onclick=It.ontouchstart=this.expand.bind(this),this.trigger(c)):this.imageLoadError()},s.prototype.imageLoadError=function(){clearTimeout(this.loadTimer),this.trigger(m),this.removeBanner()},s.prototype.sendClick=function(){this.trigger(a)},s.prototype.collapse=function(e){var t=this;-1===this.animationTimer&&(e.preventDefault(),this.div.onmouseover=this.div.onmouseout=null,Mt([this.banner,Et,It]),this.div.appendChild(It),this.animationTimer=setTimeout(function(){t.remove(t.banner),t.remove(Et),xt(It,.5),t.div.onmouseover=Bt,t.div.onmouseout=Lt,t.animationTimer=-1},250))},s.prototype.expand=function(e){var t=this;-1===this.animationTimer&&(e.preventDefault(),this.div.onmouseover=this.div.onmouseout=null,this.div.appendChild(this.banner),this.div.appendChild(Et),this.animationTimer=setTimeout(function(){xt([t.banner,Et]),t.div.onmouseover=Vt,t.div.onmouseout=Ot,t.animationTimer=-1},50),Mt(It))},s.prototype.remove=function(e){this.div.contains(e)&&this.div.removeChild(e)},s.prototype.removeBannerEventListeners=function(){this.banner.onload=this.banner.onerror=null},s.prototype.removeBanner=function(){this.removeBannerEventListeners(),this.remove(this.banner)},s.prototype.removeListeners=function(){clearTimeout(this.loadTimer),clearTimeout(this.animationTimer),this.div.onmouseover=this.div.onmouseout=Et.onclick=It.onclick=null,this.off(),this.removeBannerEventListeners()},s.prototype.stop=function(){Mt([this.div,this.banner,Et,It]),setTimeout(this.removeBanner.bind(this),400),this.remove(Et),this.remove(It)},s}(),qt=function(){function i(e,t){g(this,i),this.player=e,this.div=t,this.startTime=0,this.minDur=0,this.environment=e.getEnvironment(),ke(this,e.Events),this.type="static",e.on("time",this.dispatchTime,this)}return i.prototype.playAd=function(e,t,i,r,n){this.minDur=be.utils.seconds(i),this.adTag=r,this.static&&(this.static.removeListeners(),this.static.stop()),this.div.style.opacity=0,this.div.style.visibility="visible";var s=this.environment.Browser.firefox?{}:Rt;be.utils.style(this.div,be.utils.extend({top:"",position:"absolute",width:"100%"},s)),be.utils.style([Et,It],ke({width:"18px",height:"18px",opacity:.75},St,s)),be.utils.style(Et,{transform:"rotate(45deg)"}),this.static=new Ht(this.player,e,t,this.div,n),this.static.on(c,this.startAd,this),this.static.on(a,this.clickHandler,this),this.static.on(m,this.errorHandler,this)},i.prototype.dispatchTime=function(e){this.trigger(t,e)},i.prototype.startAd=function(){this.startTime=this.player.getPosition(),0this.minDur&&(this.off(t,this.timeAd,this),this.stop())},i.prototype.clickHandler=function(){this.sendEvent(a)},i.prototype.errorHandler=function(){this.sendEvent(m)},i.prototype.sendEvent=function(e,t){(t=t||{}).tag=t.tag||this.adTag,this.trigger(e,t)},i.prototype.removeEvents=function(){this.off()},i.prototype.getState=function(){return oe},i.prototype.stop=function(){this.startTime&&this.static&&(this.startTime=0,this.minDur=0,this.off(t,this.startTimingAd,this),this.off(t,this.timeAd,this),this.static.removeListeners(),this.static.stop(),this.sendEvent(f))},i.prototype.pause=function(){},i}(),jt=function(){function i(e,t){g(this,i),this.player=e,this.options=t,this.ignoreStartOnSeek=!1,this.reset(),t.timeBetweenAds&&e.on({adBreakStart:this.handleAdBreakStart,adSkipped:this.handleAdSkipped,adComplete:this.handleAdComplete,adBreakEnd:this.handleAdBreakEnd,destroyPlugin:this.destroy},this)}return i.prototype.clearStartOnSeek=function(){this.ignoreStartOnSeek=!0},i.prototype.sendAdBreakIgnored=function(e,t){var i,r;e&&this.player.trigger(n,(r=t,{id:(i=e)._breakId,tag:i._adQueue&&0=t.startOn&&(e-t.startOn)%t.frequency==0;return i||r},i.prototype.handleAdBreakStart=function(){this.adSkipped=!1,this.adComplete=!1},i.prototype.handleAdComplete=function(){this.adComplete=!0},i.prototype.handleAdSkipped=function(){this.adSkipped=!0},i.prototype.handleAdBreakEnd=function(){!this.adSkipped&&this.adComplete&&(this.recentCompletedAdTime=Se())},i.prototype.timeBetweenAdsAllowsAdPlayback=function(e){var t=1e.duration){var o=d.getPlaylistItem(d.getPlaylistIndex()+1);E=!o,(o||S)&&((I=q(o||S,w+1)).loadPreRoll({adBlock:T,preload:!0}).catch(u.noop),S=null)}}}},beforeComplete:function(){if(!g){var e=v.schedule.getPostRoll();if(e){"nonlinear"!==e._type&&(H(),L(e));var t=v;t.loadPostRoll({adBlock:T}).then(function(e){return t.isDestroyed()?null:D(e)}).catch(function(e){return t.isDestroyed()?null:z(e)})}}},playlistItem:function(e){w+=1,j();var t=d.getPlaylistItem(e.index);if(I&&t!==I.item&&!1===E&&(I.off(null,null,p),I.destroy(),I=null),v=I||q(t,w),I=null,v.schedule.isVMAP()?v.vmapPromise.then(function(){v.isDestroyed()||K(v.schedule)}).catch(u.noop):K(v.schedule),l.preloadAds&&1===w){var i=r.autostart;!1===i||i===se&&0===d.getViewable()?v.loadPreRoll({adBlock:T,preload:!0}).catch(u.noop):d.once(ne,function(){v.loadPreRoll({adBlock:T,preload:!0}).catch(u.noop)})}},playlistComplete:j,complete:function(){U(),f=!1},destroyPlugin:j},this),d.pauseAd=function(e,t){if(e="boolean"!=typeof e||e,y.length){var i=y[y.length-1];e?i.pause(t||{}):i.play(t||{})}},d.playAd=function(e){U();var t=void 0,i=0===m.requestTimeout?1/0:m.requestTimeout,r=0===m.creativeTimeout?1/0:m.creativeTimeout;t=Array.isArray(e)?e.slice(0):[e];var n,s={_id:_e(12),_adQueue:t,_waterfallIndex:0,_offset:0,_position:(n=d,n.isBeforePlay()||0===n.getPosition()&&"idle"===n.getState()?"pre":n.isBeforeComplete()||n.getPosition()===n.getDuration()?"post":"mid"),requestTimeout:i||ee,creativeTimeout:r||te};v?B(s):d.once("playlistItem",function(){return B(s)})};var G=Ft.call(this,u,e);G.catch(u.noop),this.destroy=j})}();