@castlabs/prestoplay 6.7.0 → 6.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +6 -6
  5. package/cjs/cl.cast.js +110 -110
  6. package/cjs/cl.conviva.js +33 -33
  7. package/cjs/cl.core.js +416 -417
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +72 -72
  10. package/cjs/cl.externs.js +26 -26
  11. package/cjs/cl.freewheel.js +23 -23
  12. package/cjs/cl.hls.js +67 -67
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +31 -31
  15. package/cjs/cl.ima.js +23 -23
  16. package/cjs/cl.mse.js +270 -259
  17. package/cjs/cl.muxdata.js +15 -11
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +13 -13
  20. package/cjs/cl.playlist.js +6 -6
  21. package/cjs/cl.smooth.js +70 -70
  22. package/cjs/cl.thumbnails.js +24 -24
  23. package/cjs/cl.tizen.js +69 -69
  24. package/cjs/cl.ttml.js +27 -27
  25. package/cjs/cl.verimatrix.js +5 -5
  26. package/cjs/cl.vimond.js +13 -13
  27. package/cjs/cl.vr.js +19 -19
  28. package/cjs/cl.vtt.js +14 -14
  29. package/cjs/cl.youbora.js +18 -18
  30. package/cl.adobe.js +3 -3
  31. package/cl.airplay.js +3 -3
  32. package/cl.broadpeak.js +5 -5
  33. package/cl.cast.js +86 -86
  34. package/cl.conviva.js +27 -27
  35. package/cl.core.js +355 -360
  36. package/cl.crypto.js +8 -8
  37. package/cl.dash.js +66 -66
  38. package/cl.externs.js +26 -26
  39. package/cl.freewheel.js +19 -19
  40. package/cl.hls.js +58 -57
  41. package/cl.hlssmpte.js +5 -5
  42. package/cl.htmlcue.js +25 -25
  43. package/cl.ima.js +17 -17
  44. package/cl.mse.js +237 -227
  45. package/cl.muxdata.js +12 -9
  46. package/cl.onboard.js +4 -4
  47. package/cl.persistent.js +9 -9
  48. package/cl.playlist.js +5 -5
  49. package/cl.smooth.js +58 -58
  50. package/cl.thumbnails.js +17 -17
  51. package/cl.tizen.js +57 -57
  52. package/cl.ttml.js +22 -22
  53. package/cl.verimatrix.js +4 -4
  54. package/cl.vimond.js +8 -8
  55. package/cl.vr.js +15 -15
  56. package/cl.vtt.js +12 -12
  57. package/cl.youbora.js +14 -14
  58. package/package.json +1 -1
  59. package/typings.d.ts +47 -20
package/cl.ima.js CHANGED
@@ -1,17 +1,17 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var jI="clpp.ima.AdsManagerFactory",kI=function(a){a=a.G;const b=new google.ima.AdsRenderingSettings;b.restoreCustomPlaybackStateOnAdBreakComplete=!1;typeof a.bitrate===_.r&&(b.bitrate=a.bitrate);b.enablePreloading=typeof a.enablePreloading===_.ic?a.enablePreloading:!0;typeof a.loadVideoTimeout===_.r&&(b.loadVideoTimeout=a.loadVideoTimeout);Array.isArray(a.mimeTypes)&&(b.mimeTypes=a.mimeTypes);typeof a.playAdsAfterTime===_.r&&(b.playAdsAfterTime=a.playAdsAfterTime);typeof a.useStyledLinearAds===
2
- _.ic&&(b.useStyledLinearAds=a.useStyledLinearAds);b.uiElements=Array.isArray(a.uiElements)?a.uiElements:[];return b},lI=function(a){return a.a.isCustomPlaybackUsed()&&!1===a.G.disableCustomPlayback&&(_.ci()||_.fi())},mI=function(a){const b=a.a,c=a.o,d=google.ima.AdEvent.Type;c.on(b,d.AD_BREAK_READY,a.Ka.bind(a));c.on(b,d.LOADED,a.W.bind(a));c.on(b,d.CONTENT_PAUSE_REQUESTED,a.oc.bind(a));c.on(b,d.STARTED,a.aa.bind(a));c.on(b,d.LOG,a.Ya.bind(a));c.on(b,d.AD_PROGRESS,a.Pb.bind(a));c.on(b,d.AD_BUFFERING,
3
- a.Wa.bind(a));c.on(b,d.FIRST_QUARTILE,a.S.bind(a));c.on(b,d.MIDPOINT,a.Za.bind(a));c.on(b,d.THIRD_QUARTILE,a.da.bind(a));c.on(b,d.PAUSED,a.Cb.bind(a));c.on(b,d.RESUMED,a.Qb.bind(a));c.on(b,d.CLICK,a.R.bind(a));c.on(b,d.SKIPPED,a.X.bind(a));c.on(b,d.IMPRESSION,a.U.bind(a));c.on(b,d.COMPLETE,a.Xa.bind(a));c.on(b,d.CONTENT_RESUME_REQUESTED,a.pc.bind(a));c.on(b,d.ALL_ADS_COMPLETED,a.nc.bind(a))},nI=function(a,b){const c=b?a.ma.create(b.getErrorCode()):null;a.l.onError(new _.H(1,9,10003,{errorType:c},
4
- b))},oI=function(a,b,c){c=c&&c.getAd();let d=null;c&&(d={ad:new V(c,a.B,a.M)});a.l.trigger(new _.F(b,d))},pI=function(a){a.A=null;oI(a,_.Lb);a.m&&a.l.getSurface().hide(a.m)},qI=function(a){_.nm(a.w,{visibility:"visible"})},sI=function(a){return _.y(function*(){a.K.initialize();const b=!!a.l.getConfiguration().muted;(yield a.I.canPlay(b))||lI(a)?rI(a):(oI(a,_.gc),a.O.warn(_.ia))})},tI=function(a,b){return _.y(function*(){a.K.initialize();yield b.play();rI(a)})},rI=function(a){a.a.init(a.w.offsetWidth,
5
- a.w.offsetHeight,google.ima.ViewMode.NORMAL);a.F=!0},uI=function(){return!window.google||!google.ima||!google.ima.AdsLoader},V=class{constructor(a,b,c){this.a=a;this.f=a.getAdPodInfo();this.h=b;this.g=c}nb(){return"Google IMA SDK"}ob(){return google.ima.VERSION}tb(){return 0}getId(){return this.a.getAdId()}getCreativeId(){return this.a.getCreativeId()}getApiFramework(){return this.a.getApiFramework()}getAdSystem(){return this.a.getAdSystem()}getAdvertiserName(){return this.a.getAdvertiserName()}getTitle(){return this.a.getTitle()}getDuration(){return this.a.getDuration()}getSkipTimeOffset(){return this.a.getSkipTimeOffset()}Zb(){return this.f?
6
- this.f.getIsBumper():!1}Gb(){let a=null;const b=this.a,c=Object.keys(b).find(d=>typeof b[d]===_.Bd&&typeof b[d].clickThroughUrl===_.ne);c&&(a=b[c].clickThroughUrl);return a}getMediaUrl(){return this.a.getMediaUrl()}qb(){return this.a.getVastMediaWidth()}pb(){return this.a.getVastMediaHeight()}eb(){return this.a.getVastMediaBitrate()}Qa(){return this.g?2:this.h?1:0}getPodIndex(){return this.f?this.f.getPodIndex():0}Hb(){return this.f?this.f.getTimeOffset():0}Ib(){return this.f?this.f.getAdPosition():
7
- 1}sb(){return this.f?this.f.getTotalAds():1}getWrapperAdIds(){return this.a.getWrapperAdIds()}getWrapperAdSystems(){return this.a.getWrapperAdSystems()}getWrapperCreativeIds(){return this.a.getWrapperCreativeIds()}};V.prototype.getWrapperCreativeIds=V.prototype.getWrapperCreativeIds;V.prototype.getWrapperAdSystems=V.prototype.getWrapperAdSystems;V.prototype.getWrapperAdIds=V.prototype.getWrapperAdIds;V.prototype.getSequenceLength=V.prototype.sb;V.prototype.getPositionInSequence=V.prototype.Ib;
8
- V.prototype.getPodTimeOffset=V.prototype.Hb;V.prototype.getPodIndex=V.prototype.getPodIndex;V.prototype.getPodType=V.prototype.Qa;V.prototype.getMediaBitrate=V.prototype.eb;V.prototype.getMediaHeight=V.prototype.pb;V.prototype.getMediaWidth=V.prototype.qb;V.prototype.getMediaUrl=V.prototype.getMediaUrl;V.prototype.getClickThroughUrl=V.prototype.Gb;V.prototype.isBumper=V.prototype.Zb;V.prototype.getSkipTimeOffset=V.prototype.getSkipTimeOffset;V.prototype.getDuration=V.prototype.getDuration;
9
- V.prototype.getTitle=V.prototype.getTitle;V.prototype.getAdvertiserName=V.prototype.getAdvertiserName;V.prototype.getAdSystem=V.prototype.getAdSystem;V.prototype.getApiFramework=V.prototype.getApiFramework;V.prototype.getCreativeId=V.prototype.getCreativeId;V.prototype.getId=V.prototype.getId;V.prototype.getTechnology=V.prototype.tb;V.prototype.getAdManagerVersion=V.prototype.ob;V.prototype.getAdManagerName=V.prototype.nb;var vI=class{create(a){const 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}}};var wI=class{constructor(a){this.a=a}getCuePoints(){return this.a}Jb(){return 0<=this.a.indexOf(0)||0===this.a.length}fb(){return 0<=this.a.indexOf(-1)}};wI.prototype.hasPostroll=wI.prototype.fb;wI.prototype.hasPreroll=wI.prototype.Jb;wI.prototype.getCuePoints=wI.prototype.getCuePoints;var xI=class{constructor(a){this.l=a;this.w=a.getSurface().getMedia();a=this.l.getConfiguration();this.G=a=_.lf(a.ima||{});this.m=this.l.Vb("ima").qc();this.K=this.l.Vb("ima").g;this.j=this.l.Vb("ima").a;this.I=new _.eq;this.O=new _.O("clpp.ima");this.g=this.a=null;this.f=new _.Xk;this.F=!1;this.o=new _.uo;this.ma=new vI;this.A=null;this.J=this.C=this.M=this.B=!1;this.H=this.h=null;{a=this.o;const b=google.ima.AdErrorEvent.Type.AD_ERROR;a.one(this.j,google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,
10
- this.jc.bind(this));a.on(this.j,b,this.Rb.bind(this));a.on(this.l,_.ke,this.ga.bind(this))}}ga(a){if(a=a.detail)switch(a.currentState){case _.Hl:this.M=!0,this.j.contentComplete()}}jc(a){this.a=a.getAdsManager(this.w,kI(this));this.a.isCustomPlaybackUsed()&&!lI(this)?(this.O.warn("IMA plugin is disabled for platforms with single video element. Disposing."),this.l.onError(new _.H(1,9,10002)),this.dispose()):(this.g=new _.cq(this.l.getSurface(),(b,c,d)=>{this.a.resize(b,c,d?google.ima.ViewMode.FULLSCREEN:
11
- google.ima.ViewMode.NORMAL)}),a=this.a.getCuePoints(),this.h=new wI(a),this.l.trigger(new _.F(_.Ob,{adsTimeline:this.h})),mI(this));this.f.resolve()}Rb(a){nI(this,a.getError());this.f.resolve()}oc(a){const b=this;return _.y(function*(){b.C=!0;lI(b)||(yield b.l.pause(),_.nm(b.w,{visibility:_.dd}));oI(b,_.xb,a);b.g.start()})}Ka(){const a=this;return _.y(function*(){lI(a)&&(a.H=a.l.getPosition(),yield a.l.detach());a.a.start()})}W(a){a.getAd().isLinear()?oI(this,_.Eb,a):(this.a.discardAdBreak(),this.B||
12
- (this.B=!0,this.l.play()))}aa(a){this.A=a.getAd().getDuration();oI(this,_.Kb,a);this.l.getSurface().show(this.m)}Ya(a){a=a.getAdData();nI(this,a?a.adError:null);pI(this)}Pb(a){oI(this,_.Hb,a)}Wa(a){oI(this,_.zb,a)}S(a){oI(this,_.Cb,a)}Za(a){oI(this,_.Fb,a)}da(a){oI(this,_.Mb,a)}Cb(a){oI(this,_.Gb,a)}Qb(a){oI(this,_.Ib,a)}R(a){this.pause();oI(this,_.Ab,a)}X(a){oI(this,_.Jb,a);pI(this)}U(a){oI(this,_.Db,a)}Xa(a){oI(this,_.Bb,a);pI(this)}pc(){const a=this;return _.y(function*(){a.B=!0;if(lI(a)&&null!==
13
- a.H)yield _.fn(a.l),yield a.l.seek(a.H);else{if(!a.C)return a.l.play();qI(a)}a.C=!1;a.g&&a.g.stop();a.l.isEnded()||(yield a.l.play());oI(a,_.yb)})}nc(){this.J=!0}load(){const a=this;return _.y(function*(){var b=a.l;const c=a.G;try{if(typeof c.adTagUrl!==_.ne)throw new _.H(1,9,10001,{missingKeys:"adTagUrl"});}catch(f){return b.onError(f),a.f.resolve(),a.f}if(!c.adTagUrl)return a.f.resolve(),a.f;b=yield a.I.canPlay(!1);const d=yield a.I.canPlay(!0),e=new google.ima.AdsRequest;e.adTagUrl=c.adTagUrl;
14
- e.setAdWillAutoPlay(b);e.setAdWillPlayMuted(d);a.j.getSettings().setAutoPlayAdBreaks(!1);a.j.requestAds(e);return a.f})}start(a){const b=this;return _.y(function*(){b.a&&b.h&&!b.F?b.h.Jb()?yield sI(b):yield tI(b,a):yield a.play()})}resume(){this.a&&this.a.resume()}pause(){this.a&&this.a.pause()}skip(){this.a&&this.a.skip()}getVolume(){return this.a?this.a.getVolume():1}setVolume(a){this.a&&this.a.setVolume(a)}getPosition(){if(!this.a||null===this.A)return-1;const a=this.a.getRemainingTime();return 0>
15
- a?0:this.A-a}dispose(){return(new Promise(a=>{this.F&&this.h&&this.h.fb()&&!this.J?(this.o.one(this.a,google.ima.AdEvent.Type.ALL_ADS_COMPLETED,()=>{a();this.m&&this.l.getSurface().hide(this.m)}),_.Of(this.o,this.a,[google.ima.AdEvent.Type.LOADED,google.ima.AdEvent.Type.STARTED],()=>{this.a&&this.a.discardAdBreak()})):a();this.a.discardAdBreak();this.j.contentComplete()})).then(()=>{qI(this);this.o.release();this.g&&(this.g.stop(),this.g=null);this.a&&(this.a.destroy(),this.a=null)})}};
16
- xI.prototype.getPosition=xI.prototype.getPosition;xI.prototype.setVolume=xI.prototype.setVolume;xI.prototype.getVolume=xI.prototype.getVolume;xI.prototype.skip=xI.prototype.skip;xI.prototype.pause=xI.prototype.pause;xI.prototype.resume=xI.prototype.resume;var yI=class extends _.kq{constructor(){super();this.a=this.g=this.f=null}onPlayerCreated(a){if(uI())return a.onError(new _.H(1,9,1E4));this.f=_.lm(_.Qc,{"class":"clpp-ima clpp-hidden"});a.getSurface().addElementToContainer(this.f);this.g=new google.ima.AdDisplayContainer(this.f,a.getSurface().getMedia());this.a=new google.ima.AdsLoader(this.g);this.a.getSettings().setPlayerType(_.oa);this.a.getSettings().setPlayerVersion(_.da);this.a.getSettings().setAutoPlayAdBreaks(!0)}onPlayerWillDestroy(a){this.a&&
17
- (this.a.destroy(),this.a=null);this.g&&(this.g.destroy(),this.g=null);this.f&&(a.getSurface().removeElementFromContainer(this.f),this.f=null)}Bf(){return this.a}zf(){return this.g}qc(){return this.f}id(){return"ima"}};_.z("clpp.ima.ImaPlugin",yI);yI.prototype.getAdContainer=yI.prototype.qc;yI.prototype.getAdDisplayContainer=yI.prototype.zf;yI.prototype.getAdsLoader=yI.prototype.Bf;yI.Id="ima";yI.isSdkMissing=uI;_.Sm(new class{create(){return new yI}});var zI=class{constructor(){this.a=new _.O(jI)}name(){return jI}ba(a,b){return a.namespace()===_.Ac?!1:uI()?(this.a.warn("IMA SDK is not loaded."),!1):!(!b||!b.ima)}create(a){return new xI(a)}};zI.prototype.create=zI.prototype.create;zI.prototype.isSupported=zI.prototype.ba;zI.prototype.name=zI.prototype.name;_.im(new zI);};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var xI="clpp.ima.AdsManagerFactory",yI=function(a){a=a.H;const b=new google.ima.AdsRenderingSettings;b.restoreCustomPlaybackStateOnAdBreakComplete=!1;typeof a.bitrate===_.r&&(b.bitrate=a.bitrate);b.enablePreloading=typeof a.enablePreloading===_.hc?a.enablePreloading:!0;typeof a.loadVideoTimeout===_.r&&(b.loadVideoTimeout=a.loadVideoTimeout);Array.isArray(a.mimeTypes)&&(b.mimeTypes=a.mimeTypes);typeof a.playAdsAfterTime===_.r&&(b.playAdsAfterTime=a.playAdsAfterTime);typeof a.useStyledLinearAds===
2
+ _.hc&&(b.useStyledLinearAds=a.useStyledLinearAds);b.uiElements=Array.isArray(a.uiElements)?a.uiElements:[];return b},zI=function(a){return!1===a.H.disableCustomPlayback&&a.a.isCustomPlaybackUsed()&&_.bi()},AI=function(a){const b=a.a,c=a.o,d=google.ima.AdEvent.Type;c.on(b,d.AD_BREAK_READY,a.ma.bind(a));c.on(b,d.LOADED,a.W.bind(a));c.on(b,d.CONTENT_PAUSE_REQUESTED,a.oc.bind(a));c.on(b,d.STARTED,a.aa.bind(a));c.on(b,d.LOG,a.Xa.bind(a));c.on(b,d.AD_PROGRESS,a.Bb.bind(a));c.on(b,d.AD_BUFFERING,a.Ka.bind(a));
3
+ c.on(b,d.FIRST_QUARTILE,a.S.bind(a));c.on(b,d.MIDPOINT,a.Ya.bind(a));c.on(b,d.THIRD_QUARTILE,a.ba.bind(a));c.on(b,d.PAUSED,a.Za.bind(a));c.on(b,d.RESUMED,a.Ob.bind(a));c.on(b,d.CLICK,a.R.bind(a));c.on(b,d.SKIPPED,a.Y.bind(a));c.on(b,d.IMPRESSION,a.U.bind(a));c.on(b,d.COMPLETE,a.Wa.bind(a));c.on(b,d.CONTENT_RESUME_REQUESTED,a.pc.bind(a));c.on(b,d.ALL_ADS_COMPLETED,a.jc.bind(a))},BI=function(a,b){const c=b?a.ga.create(b.getErrorCode()):null;a.l.onError(new _.H(1,9,10003,{errorType:c},b))},CI=function(a,
4
+ b,c){c=c&&c.getAd();let d=null;c&&(d={ad:new W(c,a.C,a.B)});a.l.trigger(new _.F(b,d))},DI=function(a){a.A=null;CI(a,_.Kb);a.m&&a.l.getSurface().hide(a.m)},EI=function(a){_.cm(a.w,{visibility:"visible"})},GI=function(a){return _.y(function*(){a.L.initialize();const b=!!a.l.getConfiguration().muted;(yield a.J.canPlay(b))||zI(a)?FI(a):(CI(a,_.fc),a.N.warn(_.ia))})},HI=function(a,b){return _.y(function*(){a.L.initialize();yield b.play();FI(a)})},FI=function(a){a.a.init(a.w.offsetWidth,a.w.offsetHeight,
5
+ google.ima.ViewMode.NORMAL);a.G=!0},II=function(){return!window.google||!google.ima||!google.ima.AdsLoader},W=class{constructor(a,b,c){this.a=a;this.f=a.getAdPodInfo();this.h=b;this.g=c}nb(){return"Google IMA SDK"}ob(){return google.ima.VERSION}tb(){return 0}getId(){return this.a.getAdId()}getCreativeId(){return this.a.getCreativeId()}getApiFramework(){return this.a.getApiFramework()}getAdSystem(){return this.a.getAdSystem()}getAdvertiserName(){return this.a.getAdvertiserName()}getTitle(){return this.a.getTitle()}getDuration(){return this.a.getDuration()}getSkipTimeOffset(){return this.a.getSkipTimeOffset()}Yb(){return this.f?
6
+ this.f.getIsBumper():!1}Fb(){let a=null;const b=this.a,c=Object.keys(b).find(d=>typeof b[d]===_.Bd&&typeof b[d].clickThroughUrl===_.me);c&&(a=b[c].clickThroughUrl);return a}getMediaUrl(){return this.a.getMediaUrl()}qb(){return this.a.getVastMediaWidth()}pb(){return this.a.getVastMediaHeight()}eb(){return this.a.getVastMediaBitrate()}Qa(){return this.g?2:this.h?1:0}getPodIndex(){return this.f?this.f.getPodIndex():0}Gb(){return this.f?this.f.getTimeOffset():0}Hb(){return this.f?this.f.getAdPosition():
7
+ 1}sb(){return this.f?this.f.getTotalAds():1}getWrapperAdIds(){return this.a.getWrapperAdIds()}getWrapperAdSystems(){return this.a.getWrapperAdSystems()}getWrapperCreativeIds(){return this.a.getWrapperCreativeIds()}};W.prototype.getWrapperCreativeIds=W.prototype.getWrapperCreativeIds;W.prototype.getWrapperAdSystems=W.prototype.getWrapperAdSystems;W.prototype.getWrapperAdIds=W.prototype.getWrapperAdIds;W.prototype.getSequenceLength=W.prototype.sb;W.prototype.getPositionInSequence=W.prototype.Hb;
8
+ W.prototype.getPodTimeOffset=W.prototype.Gb;W.prototype.getPodIndex=W.prototype.getPodIndex;W.prototype.getPodType=W.prototype.Qa;W.prototype.getMediaBitrate=W.prototype.eb;W.prototype.getMediaHeight=W.prototype.pb;W.prototype.getMediaWidth=W.prototype.qb;W.prototype.getMediaUrl=W.prototype.getMediaUrl;W.prototype.getClickThroughUrl=W.prototype.Fb;W.prototype.isBumper=W.prototype.Yb;W.prototype.getSkipTimeOffset=W.prototype.getSkipTimeOffset;W.prototype.getDuration=W.prototype.getDuration;
9
+ W.prototype.getTitle=W.prototype.getTitle;W.prototype.getAdvertiserName=W.prototype.getAdvertiserName;W.prototype.getAdSystem=W.prototype.getAdSystem;W.prototype.getApiFramework=W.prototype.getApiFramework;W.prototype.getCreativeId=W.prototype.getCreativeId;W.prototype.getId=W.prototype.getId;W.prototype.getTechnology=W.prototype.tb;W.prototype.getAdManagerVersion=W.prototype.ob;W.prototype.getAdManagerName=W.prototype.nb;var JI=class{create(a){const 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}}};var KI=class{constructor(a){this.a=a}getCuePoints(){return this.a}Ib(){return 0<=this.a.indexOf(0)||0===this.a.length}fb(){return 0<=this.a.indexOf(-1)}};KI.prototype.hasPostroll=KI.prototype.fb;KI.prototype.hasPreroll=KI.prototype.Ib;KI.prototype.getCuePoints=KI.prototype.getCuePoints;var LI=class{constructor(a){this.l=a;this.w=a.getSurface().getMedia();a=this.l.getConfiguration();a=_.kf(a.ima||{});this.H=a=_.jf({disableCustomPlayback:!1},a);this.m=this.l.Ub("ima").qc();this.L=this.l.Ub("ima").g;this.j=this.l.Ub("ima").a;this.J=new _.Vp;this.N=new _.P("clpp.ima");this.g=this.a=null;this.f=new _.Mk;this.G=!1;this.o=new _.jo;this.ga=new JI;this.A=null;this.K=this.F=this.B=this.C=!1;this.I=this.h=null;{a=this.o;const b=google.ima.AdErrorEvent.Type.AD_ERROR;a.one(this.j,google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,
10
+ this.Qb.bind(this));a.on(this.j,b,this.Pb.bind(this));a.on(this.l,_.Zc,this.nc.bind(this))}}Qb(a){this.a=a.getAdsManager(this.w,yI(this));this.a.isCustomPlaybackUsed()&&!zI(this)?(this.N.warn("IMA plugin is disabled for this platform with single video element. Disposing."),this.l.onError(new _.H(1,9,10002)),this.dispose()):(this.g=new _.Tp(this.l.getSurface(),(b,c,d)=>{this.a.resize(b,c,d?google.ima.ViewMode.FULLSCREEN:google.ima.ViewMode.NORMAL)}),a=this.a.getCuePoints(),this.h=new KI(a),this.l.trigger(new _.F(_.Nb,
11
+ {adsTimeline:this.h})),AI(this));this.f.resolve()}Pb(a){BI(this,a.getError());this.f.resolve()}oc(a){const b=this;return _.y(function*(){b.F=!0;zI(b)||(yield b.l.pause(),_.cm(b.w,{visibility:_.dd}));CI(b,_.wb,a);b.g.start()})}ma(){const a=this;return _.y(function*(){if(zI(a)){a.I=a.l.getPosition();yield a.l.detach();var b=a.l;b.a&&b.a.removeDelegate(b)}a.a.start()})}W(a){a.getAd().isLinear()?CI(this,_.Db,a):(this.a.discardAdBreak(),this.C||(this.C=!0,this.l.play()))}aa(a){this.A=a.getAd().getDuration();
12
+ CI(this,_.Jb,a);this.l.getSurface().show(this.m)}Xa(a){a=a.getAdData();BI(this,a?a.adError:null);DI(this)}Bb(a){CI(this,_.Gb,a)}Ka(a){CI(this,_.yb,a)}S(a){CI(this,_.Bb,a)}Ya(a){CI(this,_.Eb,a)}ba(a){CI(this,_.Lb,a)}Za(a){CI(this,_.Fb,a)}Ob(a){CI(this,_.Hb,a)}R(a){this.pause();CI(this,_.zb,a)}Y(a){CI(this,_.Ib,a);DI(this)}U(a){CI(this,_.Cb,a)}Wa(a){CI(this,_.Ab,a);DI(this)}pc(){const a=this;return _.y(function*(){a.C=!0;if(zI(a)&&null!==a.I){var b=a.l;b.a&&b.a.addDelegate(b);yield _.Vm(a.l);a.B||(yield a.l.seek(a.I))}else{if(!a.F)return a.l.play();
13
+ EI(a)}a.F=!1;a.g&&a.g.stop();a.B||(yield a.l.play());CI(a,_.xb)})}jc(){this.K=!0}nc(){this.B=!0;this.j.contentComplete()}load(){const a=this;return _.y(function*(){var b=a.l;const c=a.H;try{if(typeof c.adTagUrl!==_.me)throw new _.H(1,9,10001,{missingKeys:"adTagUrl"});}catch(f){return b.onError(f),a.f.resolve(),a.f}if(!c.adTagUrl)return a.f.resolve(),a.f;b=yield a.J.canPlay(!1);const d=yield a.J.canPlay(!0),e=new google.ima.AdsRequest;e.adTagUrl=c.adTagUrl;e.setAdWillAutoPlay(b);e.setAdWillPlayMuted(d);
14
+ a.j.getSettings().setAutoPlayAdBreaks(!1);a.j.requestAds(e);return a.f})}start(a){const b=this;return _.y(function*(){b.a&&b.h&&!b.G?b.h.Ib()?yield GI(b):yield HI(b,a):yield a.play()})}resume(){this.a&&this.a.resume()}pause(){this.a&&this.a.pause()}skip(){this.a&&this.a.skip()}getVolume(){return this.a?this.a.getVolume():1}setVolume(a){this.a&&this.a.setVolume(a)}getPosition(){if(!this.a||null===this.A)return-1;const a=this.a.getRemainingTime();return 0>a?0:this.A-a}dispose(){return(new Promise(a=>
15
+ {this.G&&this.h&&this.h.fb()&&!this.K?(this.o.one(this.a,google.ima.AdEvent.Type.ALL_ADS_COMPLETED,()=>{a();this.m&&this.l.getSurface().hide(this.m)}),_.Nf(this.o,this.a,[google.ima.AdEvent.Type.LOADED,google.ima.AdEvent.Type.STARTED],()=>{this.a&&this.a.discardAdBreak()})):a();this.a.discardAdBreak();this.j.contentComplete()})).then(()=>{EI(this);this.o.release();this.g&&(this.g.stop(),this.g=null);this.a&&(this.a.destroy(),this.a=null)})}};LI.prototype.getPosition=LI.prototype.getPosition;
16
+ LI.prototype.setVolume=LI.prototype.setVolume;LI.prototype.getVolume=LI.prototype.getVolume;LI.prototype.skip=LI.prototype.skip;LI.prototype.pause=LI.prototype.pause;LI.prototype.resume=LI.prototype.resume;var MI=class extends _.aq{constructor(){super();this.a=this.g=this.f=null}onPlayerCreated(a){if(II())return a.onError(new _.H(1,9,1E4));this.f=_.am(_.Qc,{"class":"clpp-ima clpp-hidden"});a.getSurface().addElementToContainer(this.f);this.g=new google.ima.AdDisplayContainer(this.f,a.getSurface().getMedia());this.a=new google.ima.AdsLoader(this.g);this.a.getSettings().setPlayerType(_.ma);this.a.getSettings().setPlayerVersion(_.da);this.a.getSettings().setAutoPlayAdBreaks(!0)}onPlayerWillDestroy(a){this.a&&
17
+ (this.a.destroy(),this.a=null);this.g&&(this.g.destroy(),this.g=null);this.f&&(a.getSurface().removeElementFromContainer(this.f),this.f=null)}Cf(){return this.a}Af(){return this.g}qc(){return this.f}id(){return"ima"}};_.A("clpp.ima.ImaPlugin",MI);MI.prototype.getAdContainer=MI.prototype.qc;MI.prototype.getAdDisplayContainer=MI.prototype.Af;MI.prototype.getAdsLoader=MI.prototype.Cf;MI.Id="ima";MI.isSdkMissing=II;_.Hm(new class{create(){return new MI}});var NI=class{constructor(){this.a=new _.P(xI)}name(){return xI}da(a,b){return a.namespace()===_.zc?!1:II()?(this.a.warn("IMA SDK is not loaded."),!1):!(!b||!b.ima)}create(a){return new LI(a)}};NI.prototype.create=NI.prototype.create;NI.prototype.isSupported=NI.prototype.da;NI.prototype.name=NI.prototype.name;_.Yl(new NI);};f.call(g, window);