(function(){var g={}; var _ = _ || {}
var f=function(window){var OT="clpp.ima.AdsManagerFactory",PT=function(a,b,c){this.a=a;this.f=a.getAdPodInfo();this.j=b;this.h=c},QT=function(){},RT=function(a){this.a=a},ST=function(a){var b=a.he("ima");if(!b)throw Error("IMA plugin not created.");var c=b.td(),d=b.h;b=b.a;if(!c||!d||!b)throw Error("IMA plugin not initialized.");var e=a.getSurface().getMedia();if(!e)throw Error("Missing media element.");this.m=a;this.l=e;a=this.m.getConfiguration();a=_.L.kb(a.ima||{});this.I=_.L.ta({disableCustomPlayback:!1},a);this.L=
c;this.N=d;this.j=b;this.J=new _.Xu;this.g=new _.J("clpp.ima");this.h=this.a=null;this.f=new _.kk;this.K=!1;this.C=new _.gi;this.P=new QT;this.o=null;this.H=this.A=this.B=!1;this.G=this.w=null;c=this.C;d=google.ima.AdErrorEvent.Type.AD_ERROR;c.one(this.j,google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.Xm.bind(this));c.on(this.j,d,this.Wm.bind(this));c.on(this.m,_.he,this.cn.bind(this))},TT=function(a){var b=a.a,c=a.C,d=google.ima.AdEvent.Type;c.on(b,d.AD_BREAK_READY,a.Nm.bind(a));c.on(b,
d.LOADED,a.Ek.bind(a));c.on(b,d.CONTENT_PAUSE_REQUESTED,a.dn.bind(a));c.on(b,d.STARTED,a.Hk.bind(a));c.on(b,d.LOG,a.Rm.bind(a));c.on(b,d.AD_PROGRESS,a.Fk.bind(a));c.on(b,d.AD_BUFFERING,a.Om.bind(a));c.on(b,d.FIRST_QUARTILE,a.Ck.bind(a));c.on(b,d.MIDPOINT,a.Sm.bind(a));c.on(b,d.THIRD_QUARTILE,a.Ik.bind(a));c.on(b,d.PAUSED,a.Um.bind(a));c.on(b,d.RESUMED,a.Vm.bind(a));c.on(b,d.CLICK,a.Bk.bind(a));c.on(b,d.SKIPPED,a.Gk.bind(a));c.on(b,d.IMPRESSION,a.Dk.bind(a));c.on(b,d.COMPLETE,a.Pm.bind(a));c.on(b,
d.CONTENT_RESUME_REQUESTED,a.en.bind(a))},UT=function(a){a=a.I;var b=new google.ima.AdsRenderingSettings;b.restoreCustomPlaybackStateOnAdBreakComplete=!1;typeof a.bitrate===_.k&&(b.bitrate=a.bitrate);b.enablePreloading=typeof a.enablePreloading===_.Zc?a.enablePreloading:!0;typeof a.loadVideoTimeout===_.k&&(b.loadVideoTimeout=a.loadVideoTimeout);Array.isArray(a.mimeTypes)&&(b.mimeTypes=a.mimeTypes);typeof a.playAdsAfterTime===_.k&&(b.playAdsAfterTime=a.playAdsAfterTime);typeof a.useStyledLinearAds===
_.Zc&&(b.useStyledLinearAds=a.useStyledLinearAds);b.uiElements=Array.isArray(a.uiElements)?a.uiElements:[];return b},WT=function(a){a.o=null;VT(a,_.zc);a.m.getSurface().hide(a.L)},XT=function(a){return _.H(function(b){if(1==b.a)return _.x(b,a.m.detach(),2);var c=a.m;c.a&&c.a.stopForwardingEventsTo(c);_.y(b)})},YT=function(a){return _.H(function(b){return b["return"](new Promise(function(c){a.C.on(a.m,_.bg,function(){a.m.getState()===_.Gq&&c()})}))})},ZT=function(a){_.gr(a.l,{visibility:"visible"})},
VT=function(a,b,c){c=c&&c.getAd();var d=null;c&&(d={ad:new PT(c,a.B,a.A)});a.m.trigger(new _.K(b,d))},$T=function(a,b){var c=b?a.P.create(b.getErrorCode()):null;a.m.onError(new _.N(1,9,10003,{errorType:c},b))},aU=function(a){return!1===a.I.disableCustomPlayback&&a.a.isCustomPlaybackUsed()&&_.qk()||_.rk()},cU=function(a){var b,c;return _.H(function(d){if(1==d.a)return a.N.initialize(),b=!!a.m.getConfiguration().muted,_.x(d,a.J.canPlay(b),2);if(3!=d.a)return c=d.f,c||aU(a)?aU(a)?_.x(d,XT(a),3):d.D(3):
(VT(a,_.Xc),a.g.warn(_.oa),d["return"]());bU(a);_.y(d)})},dU=function(a,b){return _.H(function(c){if(1==c.a)return a.N.initialize(),_.x(c,b.play(),2);bU(a);_.y(c)})},bU=function(a){a.a.init(a.l.offsetWidth,a.l.offsetHeight,google.ima.ViewMode.NORMAL);a.a.start();a.K=!0},eU=function(){this.a=this.h=this.f=null},fU=function(){return!window.google||!google.ima||!google.ima.AdsLoader},gU=function(){},hU=function(){this.Ca=new _.J(OT)};_.r=PT.prototype;_.r.xb=function(){return"Google IMA SDK"};
_.r.yb=function(){return google.ima.VERSION};_.r.Cb=function(){return 0};_.r.getId=function(){return this.a.getAdId()};_.r.getCreativeId=function(){return this.a.getCreativeId()};_.r.bc=function(){return""};_.r.getApiFramework=function(){return this.a.getApiFramework()};_.r.getAdSystem=function(){return this.a.getAdSystem()};_.r.getAdvertiserName=function(){return this.a.getAdvertiserName()};_.r.getTitle=function(){return this.a.getTitle()};_.r.getDuration=function(){return this.a.getDuration()};
_.r.getPosition=function(){return 0};_.r.getSkipTimeOffset=function(){return this.a.getSkipTimeOffset()};_.r.fc=function(){return this.f?this.f.getIsBumper():!1};_.r.zb=function(){var a=null,b=this.a,c=Object.keys(b).find(function(d){return typeof b[d]===_.Re&&typeof b[d].clickThroughUrl===_.eg});c&&(a=b[c].clickThroughUrl);return a};_.r.getMediaUrl=function(){return this.a.getMediaUrl()};_.r.ob=function(){return this.a.getVastMediaWidth()};_.r.nb=function(){return this.a.getVastMediaHeight()};
_.r.Ua=function(){return this.a.getVastMediaBitrate()};_.r.Va=function(){return this.h?2:this.j?1:0};_.r.getPodIndex=function(){return this.f?this.f.getPodIndex():0};_.r.Ob=function(){return this.f?this.f.getTimeOffset():0};_.r.Bb=function(){return this.f?this.f.getAdPosition():1};_.r.pb=function(){return this.f?this.f.getTotalAds():1};_.r.getWrapperAdIds=function(){return this.a.getWrapperAdIds()};_.r.canSeek=function(){return!1};_.r.getWrapperAdSystems=function(){return this.a.getWrapperAdSystems()};
_.r.getWrapperCreativeIds=function(){return this.a.getWrapperCreativeIds()};_.r.ec=function(){return null};PT.prototype.getVideoElement=PT.prototype.ec;PT.prototype.getWrapperCreativeIds=PT.prototype.getWrapperCreativeIds;PT.prototype.getWrapperAdSystems=PT.prototype.getWrapperAdSystems;PT.prototype.canSeek=PT.prototype.canSeek;PT.prototype.getWrapperAdIds=PT.prototype.getWrapperAdIds;PT.prototype.getSequenceLength=PT.prototype.pb;PT.prototype.getPositionInSequence=PT.prototype.Bb;
PT.prototype.getPodTimeOffset=PT.prototype.Ob;PT.prototype.getPodIndex=PT.prototype.getPodIndex;PT.prototype.getPodType=PT.prototype.Va;PT.prototype.getMediaBitrate=PT.prototype.Ua;PT.prototype.getMediaHeight=PT.prototype.nb;PT.prototype.getMediaWidth=PT.prototype.ob;PT.prototype.getMediaUrl=PT.prototype.getMediaUrl;PT.prototype.getClickThroughUrl=PT.prototype.zb;PT.prototype.isBumper=PT.prototype.fc;PT.prototype.getSkipTimeOffset=PT.prototype.getSkipTimeOffset;PT.prototype.getPosition=PT.prototype.getPosition;
PT.prototype.getDuration=PT.prototype.getDuration;PT.prototype.getTitle=PT.prototype.getTitle;PT.prototype.getAdvertiserName=PT.prototype.getAdvertiserName;PT.prototype.getAdSystem=PT.prototype.getAdSystem;PT.prototype.getApiFramework=PT.prototype.getApiFramework;PT.prototype.getSourceId=PT.prototype.bc;PT.prototype.getCreativeId=PT.prototype.getCreativeId;PT.prototype.getId=PT.prototype.getId;PT.prototype.getTechnology=PT.prototype.Cb;PT.prototype.getAdManagerVersion=PT.prototype.yb;
PT.prototype.getAdManagerName=PT.prototype.xb;QT.prototype.create=function(a){var b=google.ima.AdError.ErrorCode;switch(a){case b.VAST_LOAD_TIMEOUT:case b.VAST_MEDIA_LOAD_TIMEOUT:case b.FAILED_TO_REQUEST_ADS:return 0;case b.VIDEO_PLAY_ERROR:return 1;default:return 2}};RT.prototype.getCuePoints=function(){return this.a};RT.prototype.Rb=function(){return 0<=this.a.indexOf(0)||0===this.a.length};RT.prototype.Qb=function(){return 0<=this.a.indexOf(-1)};RT.prototype.hasPostroll=RT.prototype.Qb;RT.prototype.hasPreroll=RT.prototype.Rb;RT.prototype.getCuePoints=RT.prototype.getCuePoints;_.r=ST.prototype;
_.r.Xm=function(a){var b=this;this.a=a.getAdsManager(this.l,UT(this));this.a.isCustomPlaybackUsed()&&!aU(this)?(this.g.warn("IMA plugin is disabled for this platform with single video element. Disposing."),this.m.onError(new _.N(1,9,10002)),this.Dc()):(this.h=new _.Vu(this.m.getSurface(),function(c,d,e){b.a.resize(c,d,e?google.ima.ViewMode.FULLSCREEN:google.ima.ViewMode.NORMAL)}),a=this.a.getCuePoints(),this.w=new RT(a),this.m.trigger(new _.K(_.Cc,{adsTimeline:this.w})),TT(this));this.f.resolve()};
_.r.Wm=function(a){$T(this,a.getError());this.f.resolve()};_.r.dn=function(a){var b=this;return _.H(function(c){if(1==c.a)return b.H=!0,aU(b)?(b.G=b.m.getPosition(),_.x(c,XT(b),3)):_.x(c,b.m.pause(),4);if(3!=c.a)return _.gr(b.l,{visibility:_.qe}),c.D(3);VT(b,_.hc,a);b.h.start();_.y(c)})};_.r.Nm=function(){var a=this;return _.H(function(b){a.a.start();_.y(b)})};_.r.Ek=function(a){a.getAd().isLinear()?VT(this,_.rc,a):(this.a.discardAdBreak(),this.B||(this.B=!0,this.m.play()))};
_.r.Hk=function(a){this.o=a.getAd().getDuration();VT(this,_.xc,a);this.m.getSurface().show(this.L)};_.r.Rm=function(a){a=a.getAdData();$T(this,a?a.adError:null);WT(this)};_.r.Fk=function(a){VT(this,_.uc,a)};_.r.Om=function(a){VT(this,_.jc,a)};_.r.Ck=function(a){VT(this,_.mc,a)};_.r.Sm=function(a){VT(this,_.sc,a)};_.r.Ik=function(a){VT(this,_.Ac,a)};_.r.Um=function(a){VT(this,_.tc,a)};_.r.Vm=function(a){VT(this,_.vc,a)};_.r.Bk=function(a){this.pause();VT(this,_.kc,a)};
_.r.Gk=function(a){VT(this,_.wc,a);WT(this)};_.r.Dk=function(a){VT(this,_.qc,a)};_.r.Pm=function(a){VT(this,_.lc,a);WT(this)};
_.r.en=function(){var a=this;return _.H(function(b){switch(b.a){case 1:a.B=!0;if(!aU(a)||null===a.G){if(!a.H)return b["return"](a.m.play());ZT(a);b.D(2);break}var c=a.m;c.a&&c.a.forwardEventsTo(c);return _.x(b,_.Ut(a.m),3);case 3:if(a.A||!a.G){b.D(2);break}return _.x(b,YT(a),5);case 5:return _.x(b,a.m.seek(a.G),2);case 2:a.H=!1;a.h&&a.h.stop();if(a.A){b.D(7);break}return _.x(b,a.m.play(),7);case 7:VT(a,_.ic),_.y(b)}})};_.r.cn=function(){this.A=!0;this.j.contentComplete()};
_.r.load=function(){var a=this,b,c,d,e,f;return _.H(function(g){if(1==g.a){b=a.m;c=a.I;try{if(typeof c.adTagUrl!==_.eg)throw new _.N(1,9,10001,{missingKeys:"adTagUrl"});}catch(h){return b.onError(h),a.f.resolve(),g["return"](a.f)}return c.adTagUrl?_.x(g,a.J.canPlay(!1),2):(a.f.resolve(),g["return"](a.f))}if(3!=g.a)return d=g.f,_.x(g,a.J.canPlay(!0),3);e=g.f;f=new google.ima.AdsRequest;f.adTagUrl=c.adTagUrl;f.setAdWillAutoPlay(d);f.setAdWillPlayMuted(e);a.j.getSettings().setAutoPlayAdBreaks(!1);a.j.requestAds(f);
return g["return"](a.f)})};_.r.start=function(a){var b=this;return _.H(function(c){return b.a&&b.w&&!b.K?b.w.Rb()?_.x(c,cU(b),0):_.x(c,dU(b,a),0):_.x(c,a.play(),0)})};_.r.kd=function(){};_.r.gd=function(){return!0};_.r.resume=function(){this.a&&this.a.resume()};_.r.pause=function(){this.a&&this.a.pause()};_.r.skip=function(){this.a&&this.a.skip()};_.r.getVolume=function(){return this.a?this.a.getVolume():1};_.r.setVolume=function(a){this.a&&this.a.setVolume(a)};
_.r.getPosition=function(){if(!this.a||null===this.o)return-1;var a=this.a.getRemainingTime();return 0>a?0:this.o-a};_.r.Dc=function(){this.a&&(this.a.destroy(),this.a=null);ZT(this);this.C.release();this.h&&(this.h.stop(),this.h=null);return Promise.resolve()};ST.prototype.getPosition=ST.prototype.getPosition;ST.prototype.setVolume=ST.prototype.setVolume;ST.prototype.getVolume=ST.prototype.getVolume;ST.prototype.skip=ST.prototype.skip;ST.prototype.pause=ST.prototype.pause;ST.prototype.resume=ST.prototype.resume;_.w(eU,_.bw);_.r=eU.prototype;_.r.onPlayerCreated=function(a){if(fU())return a.onError(new _.N(1,9,1E4));this.f=_.er(_.Qd,{"class":"clpp-ima clpp-hidden"});a.getSurface().addElementToContainer(this.f);this.h=new google.ima.AdDisplayContainer(this.f,a.getSurface().getMedia());this.a=new google.ima.AdsLoader(this.h);this.a.getSettings().setPlayerType(_.xa);this.a.getSettings().setPlayerVersion(_.ia);this.a.getSettings().setAutoPlayAdBreaks(!0)};
_.r.onPlayerWillDestroy=function(a){this.a&&(this.a.destroy(),this.a=null);this.h&&(this.h.destroy(),this.h=null);this.f&&(a.getSurface().removeElementFromContainer(this.f),this.f=null)};_.r.Nl=function(){return this.a};_.r.Ll=function(){return this.h};_.r.td=function(){return this.f};_.r.id=function(){return"ima"};_.I("clpp.ima.ImaPlugin",eU);eU.prototype.getAdContainer=eU.prototype.td;eU.prototype.getAdDisplayContainer=eU.prototype.Ll;eU.prototype.getAdsLoader=eU.prototype.Nl;eU.Id="ima";
eU.isSdkMissing=fU;gU.prototype.create=function(){return new eU};_.Yt(new gU);hU.prototype.name=function(){return OT};hU.prototype.a=function(a,b){return a.namespace()===_.sd?!1:fU()?(this.Ca.warn("IMA SDK is not loaded."),!1):!(!b||!b.ima)};hU.prototype.create=function(a){return new ST(a)};_.$q(new hU);};
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));}
})();