(function(){var g={}; var _ = _ || {}
var f=function(window){var CV="clpp-freewheel",DV="clpp.freewheel.AdsManagerFactory",EV="freewheel",FV=function(){this.f=this.a=null},GV=function(){},HV=function(a){switch(a){case 0:return tv.freewheel.SDK.ADUNIT_PREROLL;case 1:return tv.freewheel.SDK.ADUNIT_MIDROLL;case 2:return tv.freewheel.SDK.ADUNIT_POSTROLL;default:return""}},IV=function(a,b,c){this.h=a;this.f=b;this.a=c},JV=function(a){this.a=a},KV=function(a){this.g=new _.J("clpp.freewheel.AdsManager");this.m=a;this.h=new _.gi;this.w=new tv.freewheel.SDK.AdManager;
this.f=this.a=null;this.B=[];this.o=[];this.A=[];this.l=new _.kk;this.j=null},LV=function(a){var b=[];typeof a.networkId!==_.k&&b.push("networkId");typeof a.serverUrl!==_.eg&&b.push("serverUrl");typeof a.profileId!==_.eg&&b.push("profileId");typeof a.videoAssetId!==_.eg&&typeof a.videoAssetId!==_.k&&b.push("videoAssetId");if(b.length)throw new _.N(1,9,12001,{missingKeys:b.join(", ")});},MV=function(){var a,b,c,d;return _.H(function(e){if(1==e.a)return a=new _.Xu,b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_NONE,
_.x(e,a.canPlay(!1),2);if(3!=e.a)return c=e.f,_.x(e,a.canPlay(!0),3);d=e.f;c?b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_ATTENDED:d&&(b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_UNATTENDED);return e["return"](b)})},PV=function(a){return _.H(function(b){if(a.B.length)return NV(a),a.f=a.B.shift(),a.f.play(),b.D(0);OV(a);return _.x(b,a.m.a.play(),0)})},QV=function(a){a.A.length?(NV(a),a.f=a.A.shift(),a.f.play()):OV(a)},NV=function(a){var b=a.m.he(EV).td();b&&(a.m.getSurface().show(b),a.m.getSurface().hideMediaElement(),
a.a.registerVideoDisplayBase(CV),a.m.isMuted()?a.setVolume(0):a.setVolume(a.m.getVolume()||1))},OV=function(a){var b=a.m.he(EV).td();b&&a.m.getSurface().hide(b);a.m.getSurface().showMediaElement()},RV=function(a,b,c){var d=null;a.a&&c&&(c.adInstance||c.slot)&&(c=(d=c.adInstance||null)?d.getSlot():c.slot,d={ad:new IV(a.a,c,d)});a.m.trigger(new _.K(b,d))},SV=function(){this.Ca=new _.J(DV)};_.w(FV,_.bw);_.r=FV.prototype;
_.r.onPlayerCreated=function(a){if(window.tv&&tv.freewheel&&tv.freewheel.SDK)this.a=_.er(_.Qd,{id:CV}),this.f=_.er(_.Jg,{"class":_.md}),this.a.appendChild(this.f),a.getSurface().addElementToContainer(this.a,!0),a.getSurface().hide(this.a);else a.onError(new _.N(1,9,12E3))};_.r.onPlayerWillDestroy=function(a){this.a&&(a.getSurface().removeElementFromContainer(this.a),this.f=this.a=null)};_.r.id=function(){return EV};_.r.td=function(){return this.a};_.r.Ml=function(){return this.f};
_.I("clpp.freewheel.FreeWheelPlugin",FV);FV.prototype.getAdVideo=FV.prototype.Ml;FV.prototype.getAdContainer=FV.prototype.td;FV.Id=EV;FV.AD_CONTAINER_ID=CV;GV.prototype.create=function(){return new FV};_.Yt(new GV);_.r=IV.prototype;_.r.xb=function(){return"FreeWheel AdManager SDK"};_.r.yb=function(){return tv.freewheel.SDK.version};_.r.Cb=function(){return 0};_.r.getId=function(){return this.a?this.a.getAdId():""};_.r.getCreativeId=function(){var a=(this.a||{})._creativeId;return typeof a===_.eg?a:""};_.r.bc=function(){return""};_.r.getApiFramework=function(){return this.a?this.a.getActiveCreativeRendition().getCreativeApi():""};_.r.getAdSystem=function(){return""};_.r.getAdvertiserName=function(){return""};
_.r.getTitle=function(){return""};_.r.getDuration=function(){return this.a?this.a.getActiveCreativeRendition().getDuration():0};_.r.getPosition=function(){return 0};_.r.getSkipTimeOffset=function(){return 0};_.r.fc=function(){return!1};_.r.zb=function(){return this.a&&this.a.getEventCallbackUrls(tv.freewheel.SDK.EVENT_AD_CLICK,tv.freewheel.SDK.EVENT_TYPE_CLICK)[0]||""};_.r.getMediaUrl=function(){return this.a?this.a.getActiveCreativeRendition().getPrimaryCreativeRenditionAsset().getUrl():""};
_.r.ob=function(){return this.a?this.a.getActiveCreativeRendition().getWidth():0};_.r.nb=function(){return this.a?this.a.getActiveCreativeRendition().getHeight():0};_.r.Ua=function(){return 0};_.r.Va=function(){switch(this.f.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:return 0;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:return 2;default:return 1}};
_.r.getPodIndex=function(){switch(this.Va()){case 0:return 0;case 2:return-1}return this.h.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL).indexOf(this.f)+1};_.r.Ob=function(){switch(this.Va()){case 0:return 0;case 2:return-1;default:return this.f.getTimePosition()}};_.r.Bb=function(){return this.a?this.f.getAdInstances().indexOf(this.a)+1:1};_.r.pb=function(){return this.f.getAdCount()};_.r.getWrapperAdIds=function(){return[]};_.r.canSeek=function(){return!1};
_.r.getWrapperAdSystems=function(){return[]};_.r.getWrapperCreativeIds=function(){return[]};_.r.ec=function(){return null};IV.prototype.getVideoElement=IV.prototype.ec;IV.prototype.getWrapperCreativeIds=IV.prototype.getWrapperCreativeIds;IV.prototype.getWrapperAdSystems=IV.prototype.getWrapperAdSystems;IV.prototype.canSeek=IV.prototype.canSeek;IV.prototype.getWrapperAdIds=IV.prototype.getWrapperAdIds;IV.prototype.getSequenceLength=IV.prototype.pb;IV.prototype.getPositionInSequence=IV.prototype.Bb;
IV.prototype.getPodTimeOffset=IV.prototype.Ob;IV.prototype.getPodIndex=IV.prototype.getPodIndex;IV.prototype.getPodType=IV.prototype.Va;IV.prototype.getMediaBitrate=IV.prototype.Ua;IV.prototype.getMediaHeight=IV.prototype.nb;IV.prototype.getMediaWidth=IV.prototype.ob;IV.prototype.getMediaUrl=IV.prototype.getMediaUrl;IV.prototype.getClickThroughUrl=IV.prototype.zb;IV.prototype.isBumper=IV.prototype.fc;IV.prototype.getSkipTimeOffset=IV.prototype.getSkipTimeOffset;IV.prototype.getPosition=IV.prototype.getPosition;
IV.prototype.getDuration=IV.prototype.getDuration;IV.prototype.getTitle=IV.prototype.getTitle;IV.prototype.getAdvertiserName=IV.prototype.getAdvertiserName;IV.prototype.getAdSystem=IV.prototype.getAdSystem;IV.prototype.getApiFramework=IV.prototype.getApiFramework;IV.prototype.getSourceId=IV.prototype.bc;IV.prototype.getCreativeId=IV.prototype.getCreativeId;IV.prototype.getId=IV.prototype.getId;IV.prototype.getTechnology=IV.prototype.Cb;IV.prototype.getAdManagerVersion=IV.prototype.yb;
IV.prototype.getAdManagerName=IV.prototype.xb;JV.prototype.getCuePoints=function(){return this.a.getTemporalSlots().map(function(a){switch(a.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:return 0;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:return-1;default:return a.getTimePosition()}})};JV.prototype.Rb=function(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL).length};JV.prototype.Qb=function(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL).length};
JV.prototype.hasPostroll=JV.prototype.Qb;JV.prototype.hasPreroll=JV.prototype.Rb;JV.prototype.getCuePoints=JV.prototype.getCuePoints;_.r=KV.prototype;
_.r.load=function(){var a=this,b,c,d,e,f,g,h,l;return _.H(function(m){if(1==m.a){b=a.m.getConfiguration().freewheel||{};try{LV(b)}catch(n){return a.m.onError(n),a.l.resolve(),m["return"](a.l)}a.w.setNetwork(b.networkId);a.w.setServer(b.serverUrl);a.a=a.w.newContext();a.a.setProfile(b.profileId);typeof b.siteSectionId!==_.eg&&typeof b.siteSectionId!==_.k||a.a.setSiteSection(b.siteSectionId);return _.x(m,MV(),2)}c=m.f;a.a.setVideoAsset(b.videoAssetId,a.m.getDuration(),void 0,void 0,c);if(Array.isArray(b.pods))for(d=
_.u(b.pods),e=d.next();!e.done;e=d.next())f=e.value,a.a.addTemporalSlot(f.id,HV(f.type),f.position,f.slotProfile,f.cuepointSequence,f.maxDuration,f.minDuration,f.acceptContentType);b.keyValues&&typeof b.keyValues===_.Re&&Object.keys(b.keyValues).forEach(function(n){return a.a.addKeyValue(n,b.keyValues[n])});a.a.setParameter(tv.freewheel.SDK.PARAMETER_EXTENSION_CONTENT_VIDEO_ENABLED,!1,tv.freewheel.SDK.PARAMETER_LEVEL_GLOBAL);if(Array.isArray(b.parameters))for(g=_.u(b.parameters),h=g.next();!h.done;h=
g.next())l=h.value,a.a.setParameter(l.name,l.value,l.level);a.h.on(a.a,tv.freewheel.SDK.EVENT_REQUEST_COMPLETE,a.wn.bind(a));a.h.on(a.a,tv.freewheel.SDK.EVENT_SLOT_STARTED,a.Bn.bind(a));a.h.on(a.a,tv.freewheel.SDK.EVENT_SLOT_ENDED,a.An.bind(a));a.h.on(a.a,tv.freewheel.SDK.EVENT_AD,a.Qm.bind(a));a.h.on(a.m,_.rg,a.zk.bind(a));a.h.on(a.m,_.bg,a.yk.bind(a));a.a.submitRequest();return m["return"](a.l)})};_.r.start=function(){var a=this;return _.H(function(b){return _.x(b,PV(a),0)})};_.r.kd=function(){};
_.r.resume=function(){this.f&&this.f.resume()};_.r.pause=function(){this.f&&this.f.pause()};_.r.skip=function(){this.f&&this.f.skipCurrentAd()};_.r.getVolume=function(){return this.a?this.a.getAdVolume():1};_.r.setVolume=function(a){this.a&&this.a.setAdVolume(a)};_.r.getPosition=function(){return this.f?this.f.getPlayheadTime():-1};_.r.gd=function(){return!0};_.r.Dc=function(){var a=this;return _.H(function(b){a.h.release();a.j&&(a.j.stop(),a.j=null);OV(a);a.a&&(a.a.dispose(),a.a=null);_.y(b)})};
_.r.wn=function(a){var b=this;if(a.success)this.B=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL),this.o=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL),this.A=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL),this.m.trigger(new _.K(_.Cc,{adsTimeline:new JV(this.a)})),this.j=new _.Vu(this.m.getSurface(),function(c,d){return b.a.resize(c,d)},this.m.he(EV).f);else this.m.onError(new _.N(1,9,10003,{errorType:0},
void 0));this.l.resolve()};_.r.Bn=function(a){RV(this,_.hc,a);this.j.start()};_.r.An=function(a){this.f=null;a=a.slot;RV(this,_.ic);this.j.stop();if(a)switch(a.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:PV(this);break;case tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL:OV(this);this.m.play();break;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:QV(this)}};
_.r.Qm=function(a){var b=a.subType;this.g.debug("ad event",b);switch(b){case tv.freewheel.SDK.EVENT_AD_IMPRESSION:RV(this,_.xc,a);RV(this,_.qc,a);break;case tv.freewheel.SDK.EVENT_AD_IMPRESSION_END:RV(this,_.zc,a);break;case tv.freewheel.SDK.EVENT_AD_FIRST_QUARTILE:RV(this,_.mc,a);break;case tv.freewheel.SDK.EVENT_AD_MIDPOINT:RV(this,_.sc,a);break;case tv.freewheel.SDK.EVENT_AD_THIRD_QUARTILE:RV(this,_.Ac,a);break;case tv.freewheel.SDK.EVENT_AD_COMPLETE:RV(this,_.lc,a);break;case tv.freewheel.SDK.EVENT_AD_CLICK:RV(this,
_.kc,a);break;case tv.freewheel.SDK.EVENT_AD_PAUSE:RV(this,_.tc,a);break;case tv.freewheel.SDK.EVENT_AD_RESUME:RV(this,_.vc,a);break;case tv.freewheel.SDK.EVENT_AD_SKIPPED:RV(this,_.wc,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_START:RV(this,_.jc,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_END:RV(this,_.uc,a);break;case tv.freewheel.SDK.EVENT_ERROR:this.m.onError(new _.N(1,9,10003,{errorType:1},{fwCode:a[tv.freewheel.SDK.INFO_KEY_ERROR_CODE],fwInfo:a[tv.freewheel.SDK.INFO_KEY_ERROR_INFO],
fwModule:a[tv.freewheel.SDK.INFO_KEY_ERROR_MODULE]}))}};_.r.zk=function(){var a=this;if(!this.f){var b=this.m.getPosition();if(this.f=this.o.find(function(d){return.5>Math.abs(b-d.getTimePosition())})||null){var c=this.o.findIndex(function(d){return d===a.f});this.o.splice(c,1);this.m.pause();NV(this);this.f.play()}}};
_.r.yk=function(a){if((a=a.detail)&&this.a)switch(a.currentState){case _.Hq:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PLAYING);break;case _.Gq:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PAUSED);break;case _.Aq:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_COMPLETED);QV(this);break;case _.tq:case _.Eq:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_STOPPED)}};KV.prototype.getPosition=KV.prototype.getPosition;KV.prototype.setVolume=KV.prototype.setVolume;
KV.prototype.getVolume=KV.prototype.getVolume;KV.prototype.skip=KV.prototype.skip;KV.prototype.pause=KV.prototype.pause;KV.prototype.resume=KV.prototype.resume;SV.prototype.name=function(){return DV};SV.prototype.a=function(a,b){return a.namespace()!==_.sd&&b&&b.freewheel?window.tv&&tv.freewheel&&tv.freewheel.SDK?!0:(this.Ca.warn("FreeWheel SDK is not loaded."),!1):!1};SV.prototype.create=function(a){return new KV(a)};_.$q(new SV);};
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
else{_=this.clpp._;(f.call(g,this));}
})();