!function(){var e,t="googima",i="TYPE_API",r="TYPE_SCHEDULE",n="viewable",a="-1",o="jw-flag-ads-googleima",s="jw-flag-ads-vpaid",d="jw-flag-ads-vpaid-controls",l="playing",u="adBreakStart",c="adBreakEnd",p="adCompanions",g="adError",h="adItem",m="adStarted",f="viewable",v=4096,y=1e3,b="external",w="instream",A="article",P=(e={},e[[w]]=1,e[["banner"]]=2,e[[A]]=3,e[["feed"]]=4,e[["floating"]]=5,e[["interstitial"]]=5,e[["slider"]]=5,e),E=window.__cmp||function(e,t,i){for(var r=window;r;){try{if(r.frames.__cmpLocator)break}catch(e){}r=r===window.top?null:r.parent}if(r){var n=M(),a=function(e){var t=e?e.data:{};if("string"==typeof t)try{t=JSON.parse(t)}catch(e){t={}}t.__cmpReturn&&t.__cmpReturn.callId===n&&(removeEventListener("message",a),i(t.__cmpReturn.returnValue))};window.addEventListener("message",a,!1);var o={__cmpCall:{command:e,parameter:t,callId:n}};r.postMessage(JSON.stringify(o),"*")}else i({gdprApplies:!1,consentData:""})},C=new RegExp(/^[^/]*:\/\/\/?([^\/]*)/);var _=new RegExp(/^[^:\/?#]+:?\/\/[^\/?#]+/);var j=null,I=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3;return null===j&&(j=new Promise(function(e){E("getConsentData",null,e)})),Promise.race([j,new Promise(function(t){setTimeout(t,e,{gdprApplies:!0,consentData:""})})])},M=Date.now||function(){return(new Date).getTime()};function L(e){var t=e.advertising;if(t&&t.placement){var i=t.placement.toLowerCase();if(P[i])return P[i]}return P[t&&t.outstream?A:w]}function T(){var e,t=(e=document.referrer,null!==e.match(_)?document.referrer:"");if(window.top!==window.self){try{return{url:window.top.location.href,domain:window.top.document.domain,referrer:t}}catch(e){}return{url:t,domain:function(e){var t=e.match(C);return t&&t.length>1?t[1]:""}(t),referrer:""}}return{url:document.location.href,domain:document.domain,referrer:t}}function S(e,t,i){if(!e)return Promise.resolve(e);for(var r=t.getPlaylistItem()||{},n=t.getConfig(),a=T(),o=e.replace("__random-number__",Math.random()*Math.pow(10,18)).replace("__timestamp__",(new Date).getTime()).replace("__page-url__",encodeURIComponent(a.url)).replace("__referrer__",encodeURIComponent(a.referrer)).replace("__player-height__",t.getHeight()||n.height).replace("__player-width__",t.getWidth()||n.width).replace("__item-duration__",function(e,t){var i=Math.pow(10,t);return Math.round(e*i)/i}(t.getDuration(),3)).replace("__jwpseg__",Array.isArray(r.jwpseg)?r.jwpseg.join(","):"").replace("__domain__",encodeURIComponent(a.domain)).replace("__placement__",L(n)),s=(o=i.companiondiv&&i.companiondiv.id?o.replace("__companion-div__",i.companiondiv.id):o.replace("__companion-div__","")).match(new RegExp(/__item-[a-z 0-9 A-Z]*__/g)),d=0;s&&dp&&(c=c.substring(0,p)),o=o.replace(l,encodeURIComponent(c))}else o=o.replace(l,"")}if(r.title&&-1===o.indexOf("vid_t=")){var g=r.title.substring(0,100).replace(/[^\x00-\x7F]/g,"");o+=(h=o,(-1!==h.indexOf("?")?"&":"?")+"vid_t="+encodeURIComponent(g))}var h;return-1!==o.indexOf("__gdpr__")||-1!==o.indexOf("__gdpr_consent__")?I().then(function(e){var t=e.gdprApplies,i=e.consentData;return o.replace("__gdpr__",t?1:0).replace("__gdpr_consent__",i)}).catch(function(){return o}):Promise.resolve(o)}var k=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")};function R(e,t){if("start"===e||"0%"===e)return"pre";if("end"===e||"100%"===e)return"post";if("string"==typeof e&&("pre"===e||"post"===e||e.indexOf("%")>=0))return e;var i=t.seconds(e);return"number"==typeof i&&!isNaN(i)&&i}function O(e,t){var i=R(e,t);return i?"number"!=typeof i||isNaN(i)?i:function(e){var t=parseInt(e,10),i=Math.floor(t)%1e3,r=Math.floor(t/1e3)%60,n=Math.floor(t/6e4)%60,a=Math.floor(t/36e5)%24;return(a=a<10?"0"+a:a)+":"+(n=n<10?"0"+n:n)+":"+(r=r<10?"0"+r:r)+"."+(i=("000"+i).slice(-3))}(1e3*i):"pre"}function x(e,t,i){if(!i)return e;var r=e.indexOf("?")>=0?"&":"?",n=e.indexOf("cust_params="),a="cust_params=".length,o="",s="";if(t.foreach(i,function(e,t){o=""+o+s+e+"="+t,s="&"}),o=encodeURIComponent(o),n>=0){var d=e.substr(0,n+a),l=e.substr(n+a);return""+d+o+"%26"+l}return""+e+r+"cust_params="+o}var D=function(){function e(t,i,r){k(this,e),this.player=t,this.loader=i,this.options=r}return e.prototype.getAdsResponse=function(e){var t=this,i=document.implementation.createDocument("http://www.iab.net/videosuite/vmap","vmap:VMAP",null),r=i.documentElement;return r.setAttribute("version","1.0"),Object.keys(e).forEach(function(n){var a=e[n],o=void 0;if(a.adm){if(null===function(e,t,i){var r=i.parseXML(t);return r?e.appendChild(r.documentElement):null}(o=i.createElement("vmap:VASTAdData"),a.adm,t.player.utils))return void t.player.trigger(g,t._getParserErrorObject(a))}else(o=i.createElement("vmap:AdTagURI")).appendChild(i.createCDATASection(a.tag));var s=r.appendChild(i.createElement("vmap:AdBreak"));s.setAttribute("breakId",n),s.setAttribute("breakType",a.type);var d=a.offset.replace("pre","start").replace("post","end");s.setAttribute("timeOffset",d);var l=s.appendChild(i.createElement("vmap:AdSource"));l.setAttribute("allowMultipleAds","true"),l.setAttribute("followRedirects","true"),l.setAttribute("id",n+"-ad-1"),l.appendChild(o)}),r.outerHTML||(new XMLSerializer).serializeToString(r)},e.prototype.normalize=function(e){var t=this;"string"==typeof e&&(e={0:{tag:e}});var i=Object.keys(e),r=i.map(function(i){var r=e[i],n=r.ad||r;if(n.tag)return S(n.tag,t.player,t.options,n.custParams)});return Promise.all(r).then(function(r){var n=t.player.utils;return i.reduce(function(t,i,a){var o=e[i],s=o.ad||o,d=r[a];return t[i]={offset:O(s.offset||s.position||o.offset||"",n),adm:s.adm,tag:d?x(d,n,s.custParams):null,type:s.type||o.type||"linear,nonlinear"},t},{})})},e.prototype.getTagMap=function(e){var t=this.player,i=t.utils;return Object.keys(e).reduce(function(r,n){var a=e[n],o=R(a.offset,i);return t._.isString(o)&&(o=parseFloat(o.replace("pre","0").replace("post","-1"))),r[o]={offset:o,adm:a.adm,tag:a.tag},r},{})},e.prototype._getParserErrorObject=function(e){var i=this.player.utils,r=R(e.offset,i);return{client:t,tag:e.adm,adBreakId:this.loader.getAdBreakId(e.offset),adPlayId:i.genId(12),adposition:"pre"===r||"post"===r?r:"mid",message:"XML parsing error",code:100,adErrorCode:20100}},e}(),B={adPosition:"",autoplayadsmuted:!1,companiondiv:null,companionResourceType:"",debug:!1,enablePreloading:!1,loadVideoTimeout:15e3,locale:"",maxRedirects:-1,preloadAds:!1,requestTimeout:1e4,truncateMacros:!0,vastLoadTimeout:1e4,vpaidcontrols:!1,vpaidmode:"insecure"};function q(e){if("true"===e)return!0;if("false"===e)return!1;var t=parseFloat(e);return isNaN(t)?e:t}var U=function(){function e(t,i){k(this,e),this.config=t,this.utils=i,this.bidsResponse={};for(var r in B)if(B.hasOwnProperty(r)){var n=t[r],a=B[r],o=typeof a;if(void 0!==n){if("boolean"!==o&&"number"!==o||(n=q(n)),typeof n!==o)throw new Error("invalid parameter: "+r+" should be a "+o);this[r]=n}else this[r]=a}}return e.prototype.getSingleTagPrerollBlock=function(){var e=this.getConfigSchedule(),t=this.singleTagBidsResponse;if("string"==typeof e){if(!t)return e;if(t.adm)return[{adm:t.adm}];var i=t.custParams;return x(t.tag,this.utils,i)}return null},e.prototype.addBidsResponse=function(e,t){var i=void 0;i=e&&!e.error&&(e.adm||e.tag)?e:null,t?this.bidsResponse[t]=i:this.singleTagBidsResponse=i},e.prototype.resetBidsResponse=function(){this.bidsResponse={},this.singleTagBidsResponse=null},e.prototype.getSchedule=function(){var e=this,t=this.getConfigSchedule();if(!t)return t;var i=this.utils.extend({},t),r=this.getSingleTagPrerollBlock();return r||Object.keys(this.bidsResponse).reduce(function(t,i){var r=t[i],n=e.bidsResponse[i];return r&&n&&(t[i]=Object.assign({},r,{adm:n.adm,tag:n.tag,custParams:Object.assign({},r.custParams,n.custParams)})),t},i)},e.prototype.getConfigSchedule=function(){var e=this.config;return e.tag||this.adschedule||e.schedule||e.ad},e.prototype.getAdRules=function(){var e=this.config.rules||{},t=parseInt(e.frequency,10);return{startOn:e.startOn||1,frequency:isNaN(t)?1:t}},e.prototype.setLocalizationOptions=function(e){var t=e.admessage,i=e.cuetext,r=e.podmessage,n=e.loadingAd;this.admessage=t,this.cuetext=i,this.podmessage=r,this.loadingAd=n},e}(),N=function(){function e(t,i,r){k(this,e),r.addClass(t,"jw-plugin-googima");var n=document.createElement("div");n.id=i+"_ad",n.className="jw-ads-view",this.visible=!1,this.utils=r,this.div=t,this.adDiv=n,t.appendChild(n)}return e.prototype.resizeNonLinear=function(e){this.resize(!1,e)},e.prototype.resizeLinear=function(){this.resize(!0)},e.prototype.resize=function(e,t){var i=this.utils;i.toggleClass(this.div,"jw-ad-non-linear",!e),i.toggleClass(this.div,"jw-ad-linear",e),i.style(this.div,{height:t?t+"px":""})},e.prototype.getAdDiv=function(){return this.adDiv},e.prototype.adSetup=function(){this.visible=!0,this.utils.addClass(this.div,"jw-ad-instream"),this.resize(!0)},e.prototype.adTakeDown=function(){this.visible=!1,this.utils.removeClass(this.div,"jw-ad-instream"),this.resize(!0)},e}(),V=null;function z(e){if(V)return V;if(window.google&&google.ima&&google.ima.AdDisplayContainer)return V=Promise.resolve();var t=["//","imasdk.googleapis.com/js/sdkloader/ima3.js"];"file:"===document.location.protocol&&t.unshift("https:");var i=new(0,e.scriptloader)(t.join(""));return V=i.load()}var W={};var H,F,J,G=function(){function e(t,i,r){k(this,e),t.extend(this,i),this.vol=0,this.imaProxy=null,this.view=r}return e.prototype.setProxy=function(e){this.imaProxy=e,"boolean"==typeof this.muted&&this.mute(this.muted)},e.prototype.attachMedia=function(){},e.prototype.detachMedia=function(){},e.prototype.mute=function(e){this.muted=e,this.imaProxy&&(e?this.imaProxy.setVolume(0):this.vol&&this.imaProxy.setVolume(this.vol)),this.muteAllAdContainerVideo(e)},e.prototype.muteAllAdContainerVideo=function(e){for(var t=this.view.getAdDiv().getElementsByTagName("video"),i=0;i=(i||0)&&t<=(r||1/0)})[0];if(i){var r=i.min?Math.floor(100*i.min):0,n=Math.floor(100*t),a=i.increment>=.01?Math.floor(100*i.increment):1;return(r+Math.floor((n-r)/a)*a)/100}return parseFloat(t)}function Je(e,t,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},n=e.createElement(t);return n.appendChild(e.createCDATASection(i)),Object.keys(r).forEach(function(e){n.setAttribute(e,r[e])}),n}function Ge(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&&e.indexOf("%")>=0)return-1;var t=parseInt(e);return t>=0?t:-1}function Xe(e,t){return new t.scriptloader(e,!1,K).load().catch(function(){return Promise.reject({message:he})})}function Ke(e){return e.outerHTML||(new XMLSerializer).serializeToString(e)}var $e=function(e,t){return e.replace(/\$\{AUCTION_ID\}/g,t.id).replace(/\$\{AUCTION_BID_ID\}/g,t.bid||"").replace(/\$\{AUCTION_IMP_ID\}/g,t.imp).replace(/\$\{AUCTION_SEAT_ID\}/g,t.seat||"").replace(/\$\{AUCTION_AD_ID\}/g,t.ad||"").replace(/\$\{AUCTION_CURRENCY\}/g,t.cur)},Qe=function(e,t,i){var r=i?i.priceInCents:"",n=t.priceInCents?r/t.priceInCents:"",a=ke[i?"LOST_TO_HIGHER_BID":"BID_BELOW_AUCTION_FLOOR"];return e.replace(/\$\{AUCTION_PRICE\}/g,r/100).replace(/\$\{AUCTION_MBR\}/g,n).replace(/\$\{AUCTION_LOSS\}/g,t.winner?ke.BID_WON:a)},Ye={postAuctionHandler:function(e,t){if((!t||t.winner)&&e.result===Re){e.adm&&(e.adm=Qe(e.adm,e,t));var i=e.winner?e.custom.nurl:e.custom.lurl;if(i)if(e.winner&&!e.adm)e.tag=Qe(i,e,t);else{var r=new XMLHttpRequest;r.open("POST",Qe(i,e,t));var n=me[e.name];n&&n.preflight&&r.setRequestHeader("x-openrtb-version","2.5"),r.withCredentials=!0,r.send(null)}}return delete e.custom,e},requestBids:function(e,t,i,r){var n=me[e.name];if(!n||!e.id||!e.pubid)return Promise.resolve({result:xe});var a=t.floorPriceCurrency||$,o=void 0!==t.skipoffset,s=r.getURLParts(),d={id:t.adPlayId,imp:[{id:"1",displaymanager:"jwplayer",tagid:e.id,video:{mimes:function(e){var t=document.createElement("video");return e.filter(function(e){return t.canPlayType(e)})}(["video/mp4","video/ogg","video/webm","video/aac","application/vnd.apple.mpegurl"]).concat("application/javascript"),minduration:3,maxduration:300,protocols:[ye,be,we,Ce,Ae,Pe,Ee,_e],w:t.playerWidth,h:t.playerHeight,startdelay:Ge(t.offset),placement:t.placement,linearity:1,skip:o?1:0,skipmin:o?t.skipoffset+2:void 0,skipafter:t.skipoffset,playbackmethod:[function(e){var t=e.autoplay,i=e.mute,r=e.autoplayAdsMuted;if(t){var n=i||r;return"viewable"===t?n?Se:Te:n?Ie:je}return i?Le:Me}(t)],api:[fe,ve]},bidfloor:t.floorPriceCents/100,bidfloorcur:a.toUpperCase(),secure:"https:"===window.location.protocol?1:0}],site:{domain:s.domain,page:s.url,ref:s.referrer,publisher:{id:e.pubid}},device:{ua:window.navigator.userAgent,language:t.language.substring(0,2)},at:1};(!0===t.autoplay||"viewable"===t.autoplay&&t.viewable)&&(d.tmax=t.bidTimeout),t.jwpseg&&(d.imp[0].video.ext={jwpseg:t.jwpseg});return r.getGDPRConsentData().then(function(e){var t=e.gdprApplies,i=e.consentData;d.regs={ext:{gdpr:t?1:0}},t&&(d.user={ext:{consent:i}})}).then(function(){return new Promise(function(e){var t=new XMLHttpRequest;t.onreadystatechange=function(){4===this.readyState&&(e(this),t=null)},t.open("POST",n.endpoint),n.preflight&&(t.setRequestHeader("content-type","application/json"),t.setRequestHeader("x-openrtb-version","2.5")),t.withCredentials=!0,t.send(JSON.stringify(d)),i.then(function(){t&&(t.abort(),t=null)})})}).then(function(i){if(200===i.status){var n=JSON.parse(i.responseText),o=n.cur?n.cur:$;if(a.toUpperCase()!==o.toUpperCase())return{result:Oe,code:551};if(n.id===d.id&&n.seatbid&&n.seatbid.length){var s=void 0,l=n.seatbid.reduce(function(e,t){if(null===e&&t&&t.bid&&t.bid.length){var i=t.bid.filter(function(e){return e.impid===d.imp[0].id});if(i.length)return s=t.seat,i[0]}return e},null);if(l){if(l.adm){var u=r.parseXML(l.adm);if(null===u)return{result:xe,code:331};l.adm=Ke(u.documentElement)}else if(!l.nurl)return{result:xe,code:330};var c={id:d.id,bid:n.bidid,imp:l.impid,seat:s,ad:l.adid,cur:o},p={result:Re,priceInCents:100*l.price,priceCurrency:n.cur||a,adm:l.adm?$e(l.adm,c):null,custom:{exp:l.exp,nurl:l.nurl?$e(l.nurl,c):null,lurl:l.lurl?$e(l.lurl,c):null}};if(t.mediationLayerAdServer===ne||t.mediationLayerAdServer===se){var g,h=r.genId(12),m=e.name.toLowerCase();p.adm||(p.adm=(f=h,v=p.custom.nurl,'\n\n \n \n JWP\n \n \n \n\n")),p.cacheKey=h,p.custParams=(g={},g[["vpb_"+m+"_key"]]=h,g[["vpb_"+m+"_bid"]]=Fe(t.buckets,l.price).toFixed(2),g)}return p}}return{result:De,code:void 0!==n.nbr?n.nbr+400:Be[De]}}var f,v;return 204===i.status?{result:De}:400===i.status?{result:xe}:{result:Oe}})}};var Ze={requestBids:function(e,t,i,r){var n,a,o,s,d=e.id,l=r.getURLParts(),u=(n=d,a=t.playerWidth,o=t.playerHeight,s=l,["https://an.facebook.com/v2/placementbid.json?&placementids[]="+n,"&playerwidth="+a,"&playerheight="+o,"&adformats[]="+Z,"&SDK[]="+ee,"&pageurl="+encodeURIComponent(s.url),"$random="+Math.random()*Math.pow(10,18)].join(""));if(c=t.mediationLayerAdServer,p=t.floorPriceCents,g=t.floorPriceCurrency||$,!u||!(c===ne||p&&g===$))return Promise.resolve({result:xe});var c,p,g;return new Promise(function(e){var t=new XMLHttpRequest;t.onreadystatechange=function(){4===this.readyState&&(e(this),t=null)},t.open("GET",u),t.withCredentials=!0,t.send(null),i.then(function(){t&&(t.abort(),t=null)})}).then(function(e){if(200!==e.status)return{result:Oe,message:"Invalid response (status "+e.status+")"};var i=JSON.parse(e.responseText),r=i.errors,n=i.request_id;if(r&&r.length)return{result:xe,code:function(e){var t=We.filter(function(t){return e.indexOf(t.message)>=0})[0];return t?t.code:ze}(r[0]),requestId:n};var a=i.bids;if(!a||!a[d]||!a[d][0])return{result:De,requestId:n};var o=a[d][0],s=o.bid_price_cents,u=o.bid_id;if(t.mediationLayerAdServer===ne||t.mediationLayerAdServer===se)return{result:Re,tag:t.tag,custParams:{jwFANBidPrice:Fe(t.buckets,s/100).toFixed(2),jwFANBidID:u},requestId:n};var c={result:Re,priceInCents:s,priceCurrency:o.bid_price_currency,requestId:n};s>=t.floorPriceCents&&(c.tag=(p=d,g=u,h=t.playerWidth,m=t.playerHeight,f=l,["https://an.facebook.com/v1/instream/vast.xml?placementid="+p,"&playerwidth="+h,"&playerheight="+m,"&SDK[]="+ee,"&bidid="+g,"&pageurl="+encodeURIComponent(f.url)].join("")));var p,g,h,m,f;return c}).catch(function(e){return{result:Oe,message:"FAN header bidding failed: "+e}})}},et=null;function tt(e){return null===et&&(et=Promise.resolve(window.apstag).then(function(t){if(t&&t.init&&t.fetchBids)return t;return Xe(["file"===document.location.protocol?"https:":"",Y].join(""),e).then(function(){return window.apstag})}).catch(function(e){throw et=null,e})),et}var it={requestBids:function(e,t,i,r){return e.id&&e.slotID?tt(r).then(function(i){return i.init({id:e.pubId,adServer:e.adServer}),new Promise(function(r){i.fetchBids({slots:[{slotID:e.slotID}],timeout:t.bidTimeout},r)})}).then(function(i){return i&&i[0]&&i[0].slotID===e.slotID?{result:Re,tag:t.tag,custParams:{amznbid:i[0].amznbid,amzniid:i[0].amzniid}}:{result:De}}).catch(function(e){return{result:Oe,message:"Amazon header bidding failed: "+e}}):Promise.resolve({result:xe})}},rt=null,nt=null;function at(e,t){if(null===nt){var i=He(),r=rt||window.SpotX;if(r&&r.DirectAdOS)return nt=Promise.resolve({SpotX:r,loadingTime:0});var n=["file"===document.location.protocol?"https:":"",ie,e,".js"].join("");(nt="function"==typeof require?(a=n,new Promise(function(e,t){setTimeout(t,K),require([a],e,t)}).catch(function(){return Promise.reject({message:he})})).then(function(e){return{SpotX:rt=e,loadingTime:He()-i}}).catch(function(){return ot(n,i,t)}):ot(n,i,t)).catch(function(){nt=null})}var a;return nt}function ot(e,t,i){return Xe(e,i).then(function(){return{SpotX:window.SpotX,loadingTime:He()-t}})}var st=void 0;var dt={postAuctionHandler:function(e){return e.scriptLoadingTime=st,e},requestBids:function(e,t,i,r){if(!e.id)return Promise.resolve({result:xe,code:302});var n={placement:t.placement,hide_skin:!0,no_vpaid_ads:!1},a={channel_id:e.id,slot:t.playerContainer,content_width:t.playerWidth,content_height:t.playerHeight,player_vendor:"SpotXJW",player_vendor_id:t.playerId,ad_volume:t.adVolume,ad_mute:t.mute?1:0,autoplay:t.autoplay,blocked_autoplay_override_mode:t.autoplayAdsMuted,start_delay:Ge(t.offset)},o=Object.assign(n,e.optionalParams,a);return e.passFloorPrice&&t.floorPriceCents&&(o.price_floor=t.floorPriceCents/100),t.jwpseg&&(o.custom=o.custom||{},o.custom.jwpseg=t.jwpseg),at(e.id,r).then(function(e){var t=e.SpotX,i=e.loadingTime;st=i;var r=new t.DirectAdOS(o),n=He();return r.getAdServerKVPs().then(function(e){return{response:e,bidNetworkStartTime:n}})}).then(function(e){var i=e.response,r=e.bidNetworkStartTime,n=He()-r,a=i.spotx_ad_key,o={spotx_bid:Fe(t.buckets,i.spotx_bid).toFixed(2),spotx_ad_key:a},s=100*parseFloat(i.spotx_bid),d={result:Re,priceInCents:s,custParams:o,scriptLoadingTime:st,bidNetworkResponseTime:n};if(t.mediationLayerAdServer===ne)return d;var l=["file:"===document.location.protocol?"https:":"",re,a].join("");return Object.assign(d,{tag:l,tagKey:a})}).catch(function(e){var t=Ve.filter(function(t){return t.message===e.message})[0];return t?{result:t.result||xe,code:t.code,scriptLoadingTime:st}:{result:Oe,message:"SpotX header bidding failed: "+e,scriptLoadingTime:st}})}},lt=null;function ut(e,t){return null===lt&&(lt=Promise.resolve(window.indexapi).then(function(i){if(i)return i;return Xe(["file"===document.location.protocol?"https:":"",e||te].join(""),t).then(function(){return window.indexapi})}).catch(function(e){throw lt=null,e})),lt}var ct,pt={requestBids:function(e,t,i,r){if(!e.id&&!e.script)return Promise.resolve({result:xe});var n=Object.assign({videoCommonArgs:{protocols:[2,3,5,6],mimes:["video/mp4","video/webm","application/javascript"],apiList:[1,2]},siteID:e.id},e);return ut(e.script,r).then(function(e){return new Promise(function(i){e.deferQueue=e.deferQueue||[],e.deferQueue.push(function(){e.solicitIndexVideoAds(t.tag,function(e,t){i({updatedTag:e,indexTargeting:t})},n)})})}).then(function(e){var i=e.indexTargeting;return void 0!==i?{result:Re,tag:t.tag,custParams:i}:{result:De}}).catch(function(e){return{result:Oe,message:"Index Exchange header bidding failed: "+e}})}},gt=(ct={},ct[[le]]=it,ct[["FAN"]]=Ze,ct[[ue]]=pt,ct[[ce]]=Ye,ct[[pe]]=dt,ct),ht=function(e,t,i){var r=e.filter(function(e){return e.result===Re&&e.adm&&e.cacheKey});if(0===r.length)return Promise.resolve(e);return new Promise(function(e){var n=r.map(function(e){return{type:"xml",ttlseconds:(e.custom||{}).exp||86400,value:i.getTrackingPixelURLs?function(e,t){var i=t.parseXML(e.adm);if(null===i)return e.adm;for(var r=t.getTrackingPixelURLs(e.name,e.cacheKey),n=r.impression,a=r.error,o=i.querySelectorAll("InLine,Wrapper"),s=0;s0&&void 0!==arguments[0]?arguments[0]:{},i=t.settings,r=void 0===i?{}:i,n=t.bidders,a=void 0===n?[]:n,o=this,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},d=arguments[2];k(this,e),this.settings=function(e,t){var i=Object.assign({bidTimeout:X,buckets:[],offset:"",playerContainer:t.container,playerHeight:t.height||0,playerWidth:t.width||0,tag:"",placement:1},t,e);return ge[i.mediationLayerAdServer]||(i.mediationLayerAdServer=de),i.mediationLayerAdServer===oe&&(i.floorPriceCents=Q),i}(r,s),this.utils=d;var l=0===Ge(this.settings.offset),u=this.settings.mediationLayerAdServer===ae||this.settings.mediationLayerAdServer===se,c=ge[this.settings.mediationLayerAdServer];this.bidders=a.filter(function(e){return(!isNaN(parseFloat(o.settings.floorPriceCents))||!u)&&(-1!==c.indexOf(e.type||e.name)&&(l||e.type===ce||e.name===pe))}).map(function(e){return e.name===le&&e.id&&e.slotID?tt(d):e.name===ue&&(e.script||e.id)?ut(e.script,d):e.name===pe&&e.id&&at(e.id,d),Object.assign(e,e.custom_params)}),this._bidRequest=null,this._currentTimeout=null,this._onCancelTrigger=null,this.onCancel=new Promise(function(e){o._onCancelTrigger=e})}return e.prototype.start=function(){return this._bidRequest||(this._bidRequest=function(e){var t=e.bidders,i=e.settings,r=e.onCancel,n=e.utils,a=i.mediationLayerAdServer===ne||i.mediationLayerAdServer===se,o=i.mediationLayerAdServer===ae||i.mediationLayerAdServer===se||i.mediationLayerAdServer===oe,s=t.map(function(e){var t=He();return Promise.race([gt[e.type||e.name].requestBids(e,i,r,n),r]).then(function(i){return Object.assign({},e,i,{timeForBidResponse:He()-t|0},o&&{winner:!1})}).catch(function(i){return Object.assign({},e,{result:Oe,code:qe,message:i,timeForBidResponse:He()-t|0})})});return Promise.all(s).then(function(e){if(o){var t=e.reduce(function(e,t){return t.result===Re&&(t.priceInCents>e.priceInCents||t.priceInCents===e.priceInCents&&t.timeForBidResponse4&&void 0!==arguments[4]?arguments[4]:null;return{type:e,client:t,adBreakId:r,adPlayId:n,adposition:null!==a?a:vt(i),viewable:i.getViewable()}}function vt(e){return e.isBeforePlay()||0===e.getPosition()?"pre":e.isBeforeComplete()||e.getPosition()===e.getDuration()?"post":"mid"}var yt=function(){return null},bt=function(){function e(t,i,r,n,a,o,s){k(this,e),r.utils.extend(this,r.Events),this.item=t,this.options=i,this.player=r,this.env=r.getEnvironment(),this.utils=r.utils,this.instreamProvider=n,this.view=a,this.initAdsManagerPromise=null,this.blockingInstreamPlayer=null,this.currentAd=null,this.bids=[],this.timeoutAdStart=-1,this.progressIntervalId=-1,this.viewablePlayedTime=0,this.lastPosition=null,this.adViewableImpressionHandler=yt,this.fullscreenIcon=r.getContainer().querySelector(".jw-icon-fullscreen"),this.adsLoaderManager=o,this.playbackProxy={currentTime:0,duration:0},this.video=s,this.paused=!1,this.hasPreroll=!0,this.reason=null,this._qoe=new r.utils.Timer,this.debugConsoleLog=yt,i.debug&&(this.debugConsoleLog=function(){var e;(e=console).log.apply(e,arguments)})}return e.prototype.startBid=function(e,i,r){var n=this,a=this.player,o=a.getPlugin("jwpsrv"),s=this.utils.extend({},e.config.bids),d=i.offset,l=this.adsLoaderManager.getAdBreakId(d),u=this.adsLoaderManager.getAdPlayId(d),c=a.getConfig(),p=new mt(s,{adPlayId:u,tag:i.tag,offset:d,width:a.getWidth(),height:a.getHeight(),container:a.getContainer(),playerId:a.id,autoplay:c.autostart,autoplayAdsMuted:e.autoplayadsmuted,adVolume:a.getVolume(),mute:a.getMute(),outstream:!!c.advertising&&c.advertising.outstream,placement:L(c),language:e.locale||c.language,viewable:1===a.getViewable(),jwpseg:this.item.jwpseg},{genId:this.utils.genId,getGDPRConsentData:I,getTrackingPixelURLs:o?o.getTrackingPixelURLs:null,getURLParts:T,parseXML:this.utils.parseXML,scriptloader:this.utils.scriptloader});return this.bids.push(p),p.start(),Promise.resolve().then(function(){var i=Object.assign({client:t,offset:d,adBreakId:l,adPlayId:u},p.getEventObject());return n.trigger("adBidRequest",i),p.then(function(t){var a=t.result;if(n.trigger("adBidResponse",Object.assign(i,p.getEventObject())),n.destroyed())return null;n.adsLoaderManager.setBid(d,p),e.addBidsResponse(a,r)})})},e.prototype.init=function(e,t){var i=this,r=t.config.bids;if(r){var n=t.getSchedule();if("string"==typeof n)this.startBid(t,{tag:n,offset:"pre"});else{var a=parseInt(r.bidOnBreaks);a=a>0?a:1/0,Object.keys(n).slice(0,a).forEach(function(e){i.startBid(t,n[e],e)})}}var o=this.adsLoaderManager;return this.initAdsManagerPromise=z().then(function(){return i.destroyed()?null:(i.debugConsoleLog("[JW DEBUG] Open adsLoaderManager"),o.open(e,t,i.video))}).then(function(e){if(i.destroyed())return null;var r=o.getAdsManager(e,i.playbackProxy,i.options);i.instreamProvider.setProxy(r),o.bindEvents({LOADED:i.adLoaded.bind(i),AD_ERROR:i.adError.bind(i),CONTENT_PAUSE_REQUESTED:i.pauseRequested.bind(i),CONTENT_RESUME_REQUESTED:i.resumeRequested.bind(i),LOG:i.adLog.bind(i),STARTED:i.adStarted.bind(i),IMPRESSION:i.adImpression.bind(i),LINEAR_CHANGED:i.resize.bind(i),CLICK:i.adClick.bind(i),PAUSED:i.adPaused.bind(i),RESUMED:i.adResumed.bind(i),SKIPPED:i.adSkipped.bind(i),USER_CLOSE:i.adUserClose.bind(i),ALL_ADS_COMPLETED:i.allAdsCompleted.bind(i)});var n=r.getCuePoints(),a=-1!==n.indexOf(0);if(!t.preloadAds||!a){var s=i.player.getSafeRegion(!1),d=s.width,l=s.height,u=i.getViewMode();i.debugConsoleLog("[JW DEBUG] adsManager init with",d,l,u),o.init(d,l,u)}if(n.length){var c=n.filter(function(e){return e>0}).map(function(e){return{begin:e,text:i.options.cuetext}});i.player.addCues(c)}var p="string"==typeof o.schedule;return i.hasPreroll=p&&0===n.length||a,r}).catch(function(e){throw i.asyncError&&i.asyncError(e),e}),this.initAdsManagerPromise},e.prototype.getViewMode=function(){var e=google.ima.ViewMode;return this.player.getFullscreen()?e.FULLSCREEN:e.NORMAL},e.prototype.prepareToPlayAd=function(e){if(!this.destroyed())if(this.blockingInstreamPlayer){var t=e?"":this.options.loadingAd;this.blockingInstreamPlayer.setText(t)}else clearTimeout(this.timeoutAdStart),this.startBlocking(e),this.muteInstreamProvider()},e.prototype.requestAds=function(e,t){var i=this,r=this.bids.concat(z());Promise.all(r).then(function(){if(!i.destroyed())return null===i.adsLoaderManager.adsRequest?(i.debugConsoleLog("[JW DEBUG] Request ads to IMA SDK"),i.adsLoaderManager.requestAds(e,t,i.options)):void 0}).catch(function(e){i.asyncError&&i.asyncError(e)})},e.prototype.muteInstreamProvider=function(){var e=this.video.muted||this.player.getMute();this.debugConsoleLog("[JW DEBUG] Setting mute on instreamProvider",e),this.instreamProvider.mute(e)},e.prototype.exitFullscreenOnInlineIOS=function(){if(this.env.OS.iOS&&!(this.env.Browser.version.major<10)){var e=this.player.getContainer();e.requestFullscreen||e.webkitRequestFullscreen||(this.debugConsoleLog("[JW DEBUG] Exiting fullscreen mode on iOS 10 or 11"),this.player.setFullscreen(!1),this.utils.style(this.fullscreenIcon,{display:"none"}))}},e.prototype.startBlocking=function(e){var t=this;if(!this.blockingInstreamPlayer&&!this.destroyed()){this.debugConsoleLog("[JW DEBUG] JW Player startBlocking"),this.exitFullscreenOnInlineIOS(),this._qoe.tick("adLoading"),this.utils.addClass(this.player.getContainer(),o),this.blockingInstreamPlayer=this.player.createInstream().init();var i=e?"":this.options.loadingAd;this.blockingInstreamPlayer.setText(i),this.blockingInstreamPlayer.applyProviderListeners(this.instreamProvider),this.view.adSetup(),clearTimeout(this.timeoutAdStart),this.timeoutAdStart=setTimeout(function(){if(t.bids.forEach(function(e){return e.stop()}),t.debugConsoleLog("[JW DEBUG] Ad request timeout"),!t.destroyed()){t.asyncError=null;var e={message:"Ad Request timeout after "+t.options.requestTimeout+" milliseconds",getErrorCode:function(){return 60004}};t.handleAdError(e,{}),t.asyncDiscardAdBreak()}},this.options.requestTimeout)}},e.prototype.stopBlocking=function(){this.destroyed()||(this.debugConsoleLog("[JW DEBUG] JW Player stopBlocking"),this.player.off("viewable",null,this),clearTimeout(this.timeoutAdStart),this.utils.style(this.fullscreenIcon,{display:""}),this.utils.removeClass(this.player.getContainer(),[s,d,o]),this.blockingInstreamPlayer&&(this.instreamProvider.off(),this.blockingInstreamPlayer.destroy(),this.blockingInstreamPlayer=null))},e.prototype.pauseRequested=function(e){var t=this;this.prepareToPlayAd();var i=this.adsLoaderManager.adEventObject(e.getAd());this.player.trigger(u,ft(u,this.player,i.adBreakId,i.adPlayId,i.adposition)),this.player.trigger(h,ft(h,this.player,i.adBreakId,i.adPlayId,i.adposition)),this.blockingInstreamPlayer.on("destroyed",function(){var r=t.adsLoaderManager?t.adsLoaderManager.getLastAdPlayId(e.getAd()):i.adPlayId;t.player.trigger(c,ft(c,t.player,i.adBreakId,r,i.adposition))})},e.prototype.resumeRequested=function(){this.debugConsoleLog("[JW DEBUG] ResumeRequest from IMA SDK"),this.currentAd&&this.currentAd.isLinear()&&this.finishAd(),this.blockingInstreamPlayer&&this.view.adTakeDown(),this.stopBlocking()},e.prototype.finishAd=function(){this.currentAd&&(clearInterval(this.progressIntervalId),this.viewablePlayedTime=0,this.currentAd=null)},e.prototype.discardAdBreak=function(e){!e&&this.adsLoaderManager&&(e=this.adsLoaderManager.adsManager),!this.destroyed()&&e&&(0===e.getCuePoints().length?this.destroy():(e.discardAdBreak(),e.stop()))},e.prototype.asyncDiscardAdBreak=function(){var e=this;this.initAdsManagerPromise&&this.initAdsManagerPromise.then(function(t){return e.discardAdBreak(t)}).catch(yt)},e.prototype.pause=function(e){var t=e.reason;if(!this.destroyed()){var i=this.adsLoaderManager.adsManager;i&&(this.viewablePlayedTime=0,this.debugConsoleLog("[JW DEBUG] JW Player pause ad"),this.reason=t||b,i.pause())}},e.prototype.resume=function(e){var t=e.reason;if(!this.destroyed()){var i=this.adsLoaderManager.adsManager;i&&(this.debugConsoleLog("[JW DEBUG] JW Player resume ad"),this.reason=t||b,i.resume())}},e.prototype.beforePlay=function(e){var t=this;if(this.initAdsManagerPromise){this.reason=e&&e.playReason?e.playReason:b,this.bids.forEach(function(e){return e.timeout()}),this.player.off("beforePlay",null,this);var i=!!e;this.hasPreroll&&this.prepareToPlayAd(i),this.adsLoaderManager.initializeDisplay({restrict:!0}),this._qoe.tick("adBeforePlay"),this.initAdsManagerPromise.then(function(){if(!t.destroyed()){var e=t.adsLoaderManager;if(!e.initialized){var i=t.player.getSafeRegion(!1),r=i.width,n=i.height,a=t.getViewMode();t.debugConsoleLog("[JW DEBUG] adsManager init with",r,n,a),e.init(r,n,a)}t.debugConsoleLog("[JW DEBUG] Start adsManager"),e.start(),!t.hasPreroll&&t.blockingInstreamPlayer&&(t.debugConsoleLog("[JW DEBUG] Stop blocking since there is no preroll"),t.view.adTakeDown(),t.stopBlocking())}}).catch(yt)}},e.prototype.beforeComplete=function(){var e=this.adsLoaderManager.adsManager;e&&e.getCuePoints().indexOf(-1)>-1&&this.prepareToPlayAd(),this.adsLoaderManager.unbindEvents(["CONTENT_RESUME_REQUESTED"]),this.playbackProxy.currentTime=this.playbackProxy.duration,this.debugConsoleLog("[JW DEBUG] Call contentComplete on IMA SDK"),this.adsLoaderManager.contentComplete()},e.prototype.time=function(e){this.playbackProxy.currentTime=e.position,e.duration>=e.position?this.playbackProxy.duration=e.duration:this.playbackProxy.duration=1/0},e.prototype.resize=function(){var e=this.currentAd,t=this.adsLoaderManager.adsManager;if(t){var i=e&&!e.isLinear(),r=this.player.getSafeRegion(i);if(i){var n=e.getHeight();n=this.player.getFullscreen()?r.height/2:Math.max(100,n+10),this.debugConsoleLog("[JW DEBUG] Resize adsManager",r.width,n,this.getViewMode()),t.resize(r.width,n,this.getViewMode()),this.view.resizeNonLinear(n)}else this.debugConsoleLog("[JW DEBUG] Resize adsManager",r.width,r.height,this.getViewMode()),t.resize(r.width,r.height,this.getViewMode()),this.view.resizeLinear()}},e.prototype.setState=function(e,t){if(e.isLinear()){var i=this.adsLoaderManager.adEventObject(e);if(i.newstate=t,null!==this.reason){i[t===l?"playReason":"pauseReason"]=this.reason,this.reason=null}this.instreamProvider.trigger("state",i)}},e.prototype.progressInterval=function(e,t){var i=this;if(clearInterval(this.progressIntervalId),t){var r=e.getAdId(),n=-1,a=this.options.admessage||"",o=this.options.podmessage||"",s=new RegExp("__AD_POD_CURRENT__","g"),d=new RegExp("__AD_POD_LENGTH__","g");this.progressIntervalId=setInterval(function(){if(i.currentAd&&i.currentAd.getAdId()===r){var e=t.getRemainingTime();if(!(isNaN(e)||e<=0)&&n!==e){n=e;var l=i.currentAd.getDuration(),u=l-e,c=Math.round(l-u);if(i.blockingInstreamPlayer){var p=a.replace(/(\b)xx(s?\b)/g,"$1"+c+"$2"),g=i.currentAd.getAdPodInfo(),h=g.getTotalAds();if(h>1){var m=g.getAdPosition();p=o.replace(s,m).replace(d,h)+" "+p}i.blockingInstreamPlayer.setText(p),i.instreamProvider.trigger("time",{duration:l,position:u})}if(l>0){var f=i.adsLoaderManager.adEventObject(i.currentAd);f.position=u,f.duration=l,i.adViewableImpressionHandler(f),i.trigger("adTime",f)}}}else clearInterval(i.progressIntervalId)},250)}},e.prototype.adLoaded=function(e){var t=this.adsLoaderManager.adEventObject(e.getAd());this.trigger("adRequest",t)},e.prototype.adStarted=function(e){this.paused=!1;var t=this.currentAd=e.getAd(),i=this.adsLoaderManager.adEventObject(t);this.trigger(m,i)},e.prototype.adImpression=function(e){var t=this;this.view.adSetup();var i=e.getAd(),r=i.isLinear(),n=r&&(i.getContentType().indexOf("image")>=0||-1===i.getDuration()),a=this.isVpaidAd(i),o=r&&a&&this.options.vpaidcontrols;this.currentAd=i,this.blockingInstreamPlayer&&this.blockingInstreamPlayer.setSkipOffset(i.getSkipTimeOffset()),this.adsLoaderManager.bindEvents({COMPLETE:this.adComplete.bind(this)}),a&&this.env.OS.mobile&&this.options.autoplayadsmuted&&this.adsLoaderManager.bindEvents({VOLUME_CHANGED:function(){t.adsLoaderManager.unbindEvents(["VOLUME_CHANGED"]),t.player.setMute(0===t.adsLoaderManager.adsManager.getVolume())}}),n?this.startBlocking():r||this.stopBlocking(),this.utils.toggleClass(this.player.getContainer(),s,r&&(n||a)),this.utils.toggleClass(this.player.getContainer(),d,o),this.resize(),this.muteInstreamProvider(),clearTimeout(this.timeoutAdStart);var u=this.adsLoaderManager.adsManager;this.progressInterval(i,u);var c=this.adsLoaderManager.adEventObject(i),p=void 0===c.podcount||1===c.sequence;"pre"===c.adposition&&p&&(this._qoe.tick("adImpression"),c.timeLoading=this._qoe.between("adBeforePlay","adImpression")),r&&!p&&this.trigger(h,c),this.trigger("adImpression",c),this.setupViewableListener(),this.setState(i,l)},e.prototype.setupViewableListener=function(){this.player.off(f,this.viewableHandler,this),this.player.on(f,this.viewableHandler,this),this.viewableHandler({viewable:this.player.getViewable()})},e.prototype.adViewableHandler=function(e){var t=e.position;null===this.lastPosition&&(this.lastPosition=t);var i=t-this.lastPosition;if(this.lastPosition=t,i=Math.min(Math.max(0,i),4),this.viewablePlayedTime+=i,this.viewablePlayedTime>=2){this.player.off(f,this.viewableHandler,this),this.adViewableImpressionHandler=yt;var r=this.adsLoaderManager.adEventObject(this.currentAd);this.trigger("adViewableImpression",r)}},e.prototype.viewableHandler=function(e){e.viewable?(this.viewablePlayedTime=0,this.lastPosition=null,this.adViewableImpressionHandler=this.adViewableHandler):this.adViewableImpressionHandler=yt},e.prototype.adComplete=function(e){this.finishAd();var t=e.getAd(),i=this.adsLoaderManager.adEventObject(t);this.trigger("adComplete",i),this.adsLoaderManager.unbindEvents(["VOLUME_CHANGED"])},e.prototype.adClick=function(e){var t=this.adsLoaderManager.adsManager,i=e.getAd();this.reason="clickthrough",this.isVpaidAd(i)||(this.debugConsoleLog("[JW DEBUG] Ad paused due to ad click"),t.pause());var r=this.adsLoaderManager.adEventObject(i);this.trigger("adClick",r)},e.prototype.adPaused=function(e){if(!this.paused){this.paused=!0;var t=e.getAd();null===this.reason&&this.isVpaidAd(t)&&(this.reason="external"),this.setState(t,"paused")}},e.prototype.adResumed=function(e){if(this.paused){this.paused=!1;var t=e.getAd();null===this.reason&&this.isVpaidAd(t)&&(this.reason="external"),this.setState(t,l)}},e.prototype.adSkipped=function(e){this.debugConsoleLog("[JW DEBUG] AdSkipped"),this.adsLoaderManager.unbindEvents(["COMPLETE","VOLUME_CHANGED"]),this.finishAd();var t=this.adsLoaderManager.adEventObject(e.getAd());this.trigger("adSkipped",t)},e.prototype.adUserClose=function(e){this.debugConsoleLog("[JW DEBUG] AdUserClose"),this.currentAd&&this.currentAd.isLinear()&&-1===this.currentAd.getDuration()?this.adSkipped(e):(this.adsLoaderManager.unbindEvents(["COMPLETE","VOLUME_CHANGED"]),this.finishAd())},e.prototype.allAdsCompleted=function(){this.resumeRequested(),this.view.adTakeDown(),this.stopAdsManager()},e.prototype.stopAdsManager=function(){var e=this;this.initAdsManagerPromise.then(function(t){e.destroyed()||(e.debugConsoleLog("[JW DEBUG] Stop IMA SDK adsManager"),t.stop(),t.destroy(),e.initAdsManagerPromise=null,e.bids=[])}).catch(yt)},e.prototype.adLog=function(e){this.debugConsoleLog("[JW DEBUG]",e.type,e);var t=e.getAdData();if(t&&t.adError){var i=this.adsLoaderManager.adErrorEventObject(t.adError,e);402===i.code?this.handleAdError(t.adError,e):this.trigger(g,i)}},e.prototype.adError=function(e){var t=e.getError();this.handleAdError(t,e)},e.prototype.asyncError=function(e){var t=this;if(!this.destroyed())if(clearTimeout(this.timeoutAdStart),this.timeoutAdStart=setTimeout(function(){return t.destroy()},0),e&&e.getError){var i=e.getError();this.handleAdError(i,e,!0)}else e.target&&e.target.src?console.error("Failed to load "+e.target.src):console.error(e)},e.prototype.handleAdError=function(e,t,i){var r=this;this.options.debug&&console.error(e);var n=this.adsLoaderManager.adErrorEventObject(e,t);this.player&&0===this.player.getPosition()&&(this._qoe.tick("adError"),n.timeLoading=this._qoe.between("adBeforePlay","adError")),this.trigger(g,n),this.destroyed()||(900===e.getErrorCode()||i?(clearTimeout(this.timeoutAdStart),this.timeoutAdStart=setTimeout(function(){return r.destroy()},0)):(this.stopBlocking(),this.view.adTakeDown()))},e.prototype.isVpaidAd=function(e){var t=e.getContentType();return"application/javascript"===t||"application/x-shockwave-flash"===t},e.prototype.destroy=function(){if(this.debugConsoleLog("[JW DEBUG] JW Player destroy PlaylistItemManager"),this.off(),!this.destroyed()){this.player.off(null,null,this),this.bids.map(function(e){e.stop()}),this.bids=[],clearTimeout(this.timeoutAdStart),clearInterval(this.progressIntervalId),this.currentAd=null,this.options=null,this.video=null,this.initAdsManagerPromise=null;var e=this.adsLoaderManager;e&&(e.reset(),this.adsLoaderManager=null),this.blockingInstreamPlayer&&this.stopBlocking(),this.instreamProvider.off(),this.instreamProvider.setProxy(null),this.instreamProvider=null,this.view.adTakeDown(),this.view=null,this.player=null,this.item=null}},e.prototype.destroyed=function(){return!this.item},e}();function wt(e){try{return e.getAdPodInfo()}catch(e){return null}}function At(e,t){var i=R(e,t);return"pre"===i?0:"post"===i?-1:i}var Pt=function(){function e(t,i){k(this,e),this.adsLoader=null,this.adDisplayContainer=null,this.displayInitialized=!1,this.initialized=!1,this.started=!1,this.adsRequest=null,this.userRequestContext=null,this.adsManager=null,this.adsManagerEvents={},this.container=i,this.schedule=null,this.breakMap={},this.player=t}return e.prototype.getVpaidMode=function(e){var t=google.ima.ImaSdkSettings.VpaidMode;return"disabled"===e||"none"===e?t.DISABLED:"enabled"===e?t.ENABLED:t.INSECURE},e.prototype.initializeDisplay=function(e){this.adDisplayContainer&&!this.displayInitialized&&(this.adDisplayContainer.initialize(),e&&e.restrict&&(this.displayInitialized=!0))},e.prototype.contentComplete=function(){if(null!==this.adsRequest){var e=this.adsLoader;e&&e.contentComplete(),this.adsRequest=null}},e.prototype.reset=function(){this.userRequestContext=null;var e=this.adsManager;e&&(e.destroy(),this.adsManager=null),this.contentComplete(!0),this.schedule=null,this.breakMap={},this.adsManagerEvents={},this.initialized=this.started=!1},e.prototype.prepare=function(e){return null===this.adsLoader&&(this.adDisplayContainer=new google.ima.AdDisplayContainer(this.container,e),this.adsLoader=new google.ima.AdsLoader(this.adDisplayContainer)),this.adsLoader},e.prototype.open=function(e,t,i){var r=google.ima.settings;r.setDisableCustomPlaybackForIOS10Plus(!0);var n=t.locale||this.player.getConfig().language;r.setLocale(n),t.maxRedirects>=0&&r.setNumRedirects(t.maxRedirects);var a=this.prepare(i);return new Promise(function(e,t){a.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,t,!1),a.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,e,!1)})},e.prototype.requestAds=function(e,t,i){var r=this;if(null===this.adsRequest){var n=t.getSchedule();if(n){var a=this.player,o=this.adsRequest=new google.ima.AdsRequest,s=this.userRequestContext={requestType:e,vpaidMode:t.vpaidmode,playerVersion:a.version.split("+")[0],adPosition:t.adPosition};o.setAdWillAutoPlay(!1!==a.getConfig().autostart),o.setAdWillPlayMuted(a.getMute());var d=a.getSafeRegion(!1);o.linearAdSlotWidth=d.width,o.linearAdSlotHeight=d.height;var l=a.getSafeRegion(!0);o.nonLinearAdSlotWidth=l.width,o.nonLinearAdSlotHeight=l.height,o.forceNonLinearFullSlot=i.forceNonLinearFullSlot,o.vastLoadTimeout=i.vastLoadTimeout;var u=this.adsLoader.getSettings(),c=this.getVpaidMode(s.vpaidMode);u.setPlayerType("jwplayer"),u.setPlayerVersion(s.playerVersion),u.setVpaidMode(c);var p=new D(a,this,i);return p.normalize(n).then(function(e){var t=Object.keys(e);if(1===t.length){var i=e[t[0]];"pre"===i.offset&&i.tag&&(n=o.adTagUrl=s.adTagUrl=i.tag)}s.adTagUrl||(o.adsResponse=s.adsResponse=p.getAdsResponse(e)),r.schedule=n,r.breakMap=Object.assign(p.getTagMap(e),r.breakMap),r.adsLoader.requestAds(o,s)})}}},e.prototype.getAdsManager=function(e,t,i){var r=new google.ima.AdsRenderingSettings;return r.enablePreloading=i.enablePreloading||i.preloadAds,r.loadVideoTimeout=i.loadVideoTimeout,r.uiElements=null,r.useStyledNonLinearAds=!0,this.adsManager=e.getAdsManager(t,r),this.userRequestContext=e.getUserRequestContext(),this.adsManager},e.prototype.init=function(e,t,i){null!==this.adsManager&&!1===this.initialized&&(this.adsManager.init(e,t,i),this.initialized=!0)},e.prototype.start=function(){null!==this.adsManager&&!1===this.started&&(this.initializeDisplay({restrict:!0}),this.adsManager.start(),this.started=!0)},e.prototype.bindEvents=function(e){var t=this,i=google.ima.AdEvent.Type,r=google.ima.AdErrorEvent.Type;Object.keys(e).forEach(function(n){var a=i[n]||r[n],o=t.adsManagerEvents[a];o&&t.adsManager.removeEventListener(a,o),t.adsManager.addEventListener(a,e[n],!1),t.adsManagerEvents[a]=e[n]})},e.prototype.unbindEvents=function(e){var t=this,i=google.ima.AdEvent.Type,r=google.ima.AdErrorEvent.Type;e.forEach(function(e){var n=i[e]||r[e],a=t.adsManagerEvents[n];a&&(t.adsManager.removeEventListener(n,a),delete t.adsManagerEvents[n])})},e.prototype.getTag=function(e,t){if("string"==typeof this.schedule)return this.schedule;var i=wt(e);if(i){var r=this.breakMap[i.getTimeOffset()]||{};if(r.tag)return r.tag}var n=this.userRequestContext;return t&&t.getUserRequestContext&&(n=t.getUserRequestContext()||n),n?n.adTagUrl||n.adsResponse||"":(console.error("invalid request context",n),"")},e.prototype.getAdBreakId=function(e){var t=this.player.utils,i=At(e,t);return this.breakMap[i]=this.breakMap[i]||{},this.breakMap[i].adBreakId=this.breakMap[i].adBreakId||t.genId(12),this.breakMap[i].adBreakId},e.prototype.getAdPlayId=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=this.player.utils,r=At(e,i);return this.breakMap[r].adPlayId=this.breakMap[r].adPlayId||{1:i.genId(12)},this.breakMap[r].adPlayId[t]=this.breakMap[r].adPlayId[t]||i.genId(12),this.breakMap[r].adPlayId[t]},e.prototype.getLastAdPlayId=function(e){var t=wt(e);if(!t)return a;var i=t.getTimeOffset(),r=this.breakMap[i].adPlayId;return r[Object.keys(r).reduce(function(e,t){return Math.max(e,t)})]},e.prototype.getTimeoffsetFromPosition_=function(){var e=this.player.getPosition(),t=1/0,i=void 0;return Object.keys(this.breakMap).forEach(function(r){var n=e-r;n>=0&&n1&&(i.sequence=n,i.podcount=o),0===(r=t.getTimeOffset())?a="pre":-1===r&&(a="post"),i.adposition=a}else r=this.getTimeoffsetFromPosition_();return i.adposition=this.userRequestContext.adPosition||a,i.id=i.adBreakId=this.getAdBreakId(r),i.adPlayId=this.getAdPlayId(r,n),Object.assign(i,function(e,t){var i=t.bid,r={};if(i&&(Object.assign(r,i.getEventObject()),"dfp"===r.mediationLayerAdServer||"jwpdfp"===r.mediationLayerAdServer)){var n=e&&e.getAdSystem?e.getAdSystem():[],a=e&&e.getWrapperAdSystems?e.getWrapperAdSystems():[];("SpotXJW"===n||a.indexOf("SpotXJW")>=0)&&r.bidders.forEach(function(e){e.winner="SpotX"===e.name})}return r}(e,this.breakMap[r]))},e.prototype.setBid=function(e,t){var i=At(e,this.player.utils);this.breakMap[i]=this.breakMap[i]||{},this.breakMap[i].bid=t},e.prototype.adEventObject=function(e){var i={client:t,tag:this.getTag(e),ima:{ad:e,userRequestContext:this.userRequestContext}};return e?(i.adtitle=e.getTitle(),i.adsystem=e.getAdSystem(),i.creativetype=e.getContentType(),i.duration=e.getDuration(),i.linear=e.isLinear()?"linear":"nonlinear",i.viewable=this.player.getViewable(),Object.assign(i,this.adPodEventObject(e)),i):i},e.prototype.adErrorEventObject=function(e,i){var r=e.getMessage&&e.getMessage()||e.message,n=e.getVastErrorCode&&e.getVastErrorCode()||900,a=e.getErrorCode&&e.getErrorCode()||900;a<1e4&&(a+=2e4);var o=i.getAd&&i.getAd(),s=this.getTag(o,i),d=e.getInnerError?e.getInnerError():null,l=this.adPodEventObject(o);return Object.assign({client:t,message:"Ad Error: "+r,code:n,adErrorCode:a,tag:s,sourceError:d},l)},e}();!function(e){if(e&&"undefined"!=typeof window){var t=document.createElement("style");t.setAttribute("media","screen"),t.innerHTML=e,document.head.appendChild(t)}}(".jw-plugin-googima,.jw-plugin-googima.jw-ad-instream .jw-ads-view>:not(div),.jw-plugin-googima.jw-ad-instream .jw-ads-view>div:not(:empty){height:100%;width:100%}.jw-plugin-googima{overflow:hidden;display:block;visibility:hidden;pointer-events:none;opacity:0}.jw-plugin-googima.jw-ad-instream{visibility:visible;display:block;pointer-events:all;opacity:1}.jw-plugin-googima.jw-ad-linear{top:0;left:0;bottom:0}.jw-plugin-googima.jw-ad-non-linear{top:auto}.jw-plugin-googima .jw-ads-view{position:absolute;width:100%;height:100%}.jwplayer.jw-flag-ads-googleima.jw-flag-touch .jw-controlbar{font-size:1em}.jwplayer.jw-flag-ads-googleima.jw-flag-touch .jw-display-icon-display,.jwplayer.jw-flag-ads-googleima.jw-flag-touch .jw-display-icon-display .jw-icon-display{pointer-events:none}.jwplayer.jw-flag-ads-googleima .jw-controlbar{background:0 0!important;pointer-events:none}.jwplayer.jw-flag-ads-googleima .jw-controlbar .jw-icon{pointer-events:all}.jwplayer.jw-flag-ads-googleima .jw-controls-backdrop{display:none}.jwplayer.jw-flag-ads-googleima.jw-ie .jw-slider-volume,.jwplayer.jw-flag-ads-googleima.jw-ie .jw-svg-icon{background:rgba(0,0,0,.25);border-radius:3px}.jwplayer.jw-flag-ads-googleima.jw-ie .jw-slider-volume{margin:0 10px}@supports (filter:drop-shadow(0 0 3px #000)){.jwplayer.jw-flag-ads-googleima.jw-ie .jw-slider-volume,.jwplayer.jw-flag-ads-googleima.jw-ie .jw-svg-icon{background:0 0;border-radius:0}.jwplayer.jw-flag-ads-googleima.jw-ie .jw-slider-volume{margin:0}}.jwplayer.jw-flag-ads-googleima .jw-controlbar .jw-svg-icon{fill:#fff;filter:drop-shadow(0 0 3px #000)}.jwplayer.jw-flag-ads-googleima .jw-spacer,.jwplayer.jw-flag-ads-googleima .jw-text{order:1}.jwplayer.jw-flag-ads-googleima .jw-controlbar .jw-text{text-shadow:0 0 3px #000}.jwplayer.jw-flag-ads-googleima.jw-flag-small-player.jw-flag-ads.jw-state-playing.jw-flag-touch:not(.jw-flag-ads-vpaid) .jw-controls .jw-controlbar{pointer-events:none}.jwplayer.jw-flag-ads-googleima.jw-flag-small-player .jw-controlbar{flex-flow:column-reverse nowrap;height:100%;max-height:none}.jwplayer.jw-flag-ads-googleima.jw-flag-small-player .jw-button-container{align-items:flex-end;flex-wrap:wrap;margin-bottom:7px}.jwplayer.jw-flag-ads-googleima.jw-flag-small-player .jw-controlbar .jw-icon{height:30px}.jwplayer.jw-flag-ads-googleima.jw-flag-small-player .jw-text{align-self:flex-start;margin:16px 0 0 16px;order:-1;width:100%}");(window.jwplayerPluginJsonp||window.jwplayer().registerPlugin)(t,"8.1",function(e,o,s){var d=this,l=e.utils,u=e.getConfig(),c=new U(o||{},l),h=null,f=0;z(l).catch(l.noop);var v=e._,y=u.key,b=new N(s,e.id,l),w=new G(l,e.Events,b),A=new Pt(e,b.getAdDiv()),P=null;this.version="8.6.5",this.bidsVersion="0.2.15",e.utils.extend(this,e.Events);function E(e,t,i,r){try{return e.getCompanionAds(t,i,r)}catch(e){return[]}}function C(t){var i=new google.ima.CompanionAdSelectionSettings;i.sizeCriteria=google.ima.CompanionAdSelectionSettings.SizeCriteria.IGNORE;var r=c.companiondiv||{width:300,height:250},n=function(e){for(var t=[],i=0;i0}function _(){j(),A&&A.adDisplayContainer&&A.adDisplayContainer.destroy(),e.off(null,null,this),e.playAd=l.noop}function j(){P&&(P.destroy(),P=null)}function I(t){P&&P.discardAdBreak(),A.contentComplete(),j(),t&&t.adschedule?c.adschedule=t.adschedule:c.adschedule=null,e.setCues([])}function M(t,i,a){var o=t.item||{};I(o);var s=a.getSchedule();if(i===r&&!function(){var e=c.getAdRules(),t=0===e.frequency&&1===f,i=f>=e.startOn&&(f-e.startOn)%e.frequency==0;return t||i}()||!s||"string"!=typeof s&&!Object.keys(s).length)return c.adschedule=null,void z(l).then(function(){A.prepare(h)}).catch(l.noop);if(A.reset(),(P=new bt(o,c,e,w,b,A,h)).on("all",function(t,i){return e.trigger(t,i)}),P.init(i,a).then(function(t){e.trigger("adsManager",{adsManager:t,videoElement:h})}).catch(l.noop),P.on(m,function(e){C(e.ima.ad)}),a.preloadAds){var d=e.getConfig().autostart;!1===d||d===n&&0===e.getViewable()?P.requestAds(i,a):e.once("autostartNotAllowed",function(){P.requestAds(i,a)},P)}e.once("beforePlay",function(e){P.beforePlay(e),P.requestAds(i,a)},P).on("beforeComplete",function(){return P.beforeComplete()},P).on("time",function(e){return P.time(e)},P).on("resize",function(){return P.resize()},P).on("fullscreen",function(){return P.resize()},P)}e.pauseAd=function(e,t){P&&(e?P.pause(t||{}):P.resume(t||{}))},e.playAd=function(t){var r=l.extend({},o);delete r.ad,delete r.tag,delete r.schedule,delete r.adschedule,e._.isArray(t)?r.tag=t[0]:r.tag=t,r.adPosition=vt(e);var n=new U(r,l);n.setLocalizationOptions(u.localization.advertising);var a=P?P.blockingInstreamPlayer:null;a&&(a.noResume=!0),M({},i,n),P&&(P.beforePlay(null),P.requestAds(i,n))},e.skipAd=function(){A&&A.skipAd()},e.on("ready",function(){u.localization=e.getConfig().localization,c.setLocalizationOptions(u.localization.advertising),h||(h=e.createInstream().getMediaElement()),z().catch(function(e){e.message.match(/Failed to load/)&&T("Ad playback blocked by an ad blocker",2e4)}),L.catch(function(e){T("Ad Error: "+e.message,60002)});var t=document.body,i=function(){t.removeEventListener("mouseup",i),t.removeEventListener("touchend",i),A.initializeDisplay()};t.addEventListener("mouseup",i,!1),t.addEventListener("touchend",i,!1)},this).on("playlistItem",function(e){f++,c.resetBidsResponse(),M(e,r,c)},this).on("playlistComplete",function(){I()},this).on("cast",function(e){e.active&&I()},this).on("mute",function(e){var t=e.mute;w.mute(t)},this).on("destroyPlugin",function(){d.destroy()},this).on("remove",_,this);var L=function(e,t,i){var r=W[t];return r||(W[t]=new Promise(function(r,n){!function(i){var r=new e.key(t);if("unlimited"===r.edition())return i();var n=["//","entitlements.jwplayer.com","/",r.token(),".json"];"file:"===window.location.protocol&&n.unshift("https:"),e.ajax(n.join(""),function(e){i(e&&e.response)},function(){i()},{timeout:1e4,responseType:"json"})}(function(e){var t=e||{},a=void 0,o=void 0;!0===i.outstream?(a=!1!==t.canPlayOutstreamAds,o="Outstream Ad Limit Reached"):(a=!1!==t.canPlayAds,o="Ad Limit Reached"),!1!==a?r({message:"Can Play Ads"}):n({message:o})})}))}(l,y,o);L.catch(l.noop);var T=function(i,r){_(),e.trigger(g,{id:a,client:t,message:i,code:900,adErrorCode:r,tag:""})};this.destroy=j,this.adsDebugMode=function(){c.debug=!0,P&&(P.debugConsoleLog=function(){var e;(e=console).log.apply(e,arguments)})}})}();