@castlabs/prestoplay 6.23.0 → 6.24.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 (65) 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 +7 -7
  5. package/cjs/cl.cast.js +116 -116
  6. package/cjs/cl.conviva.js +32 -32
  7. package/cjs/cl.core.js +606 -592
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +87 -81
  10. package/cjs/cl.externs.js +94 -30
  11. package/cjs/cl.freewheel.js +25 -24
  12. package/cjs/cl.hls.js +73 -70
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +30 -30
  15. package/cjs/cl.ima.js +23 -23
  16. package/cjs/cl.mse.js +347 -333
  17. package/cjs/cl.muxdata.js +15 -15
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +15 -14
  20. package/cjs/cl.playlist.js +6 -6
  21. package/cjs/cl.sessions.js +16 -16
  22. package/cjs/cl.simid.js +15 -15
  23. package/cjs/cl.smooth.js +72 -72
  24. package/cjs/cl.thumbnails.js +26 -26
  25. package/cjs/cl.tizen.js +72 -72
  26. package/cjs/cl.ttml.js +29 -29
  27. package/cjs/cl.verimatrix.js +5 -5
  28. package/cjs/cl.vimond.js +12 -12
  29. package/cjs/cl.vr.js +19 -19
  30. package/cjs/cl.vtt.js +14 -14
  31. package/cjs/cl.yospace.js +4 -4
  32. package/cjs/cl.youbora.js +37 -37
  33. package/cl.adobe.js +3 -3
  34. package/cl.airplay.js +3 -3
  35. package/cl.broadpeak.js +5 -5
  36. package/cl.cast.js +88 -88
  37. package/cl.conviva.js +27 -27
  38. package/cl.core.js +492 -479
  39. package/cl.crypto.js +9 -9
  40. package/cl.dash.js +81 -76
  41. package/cl.externs.js +94 -30
  42. package/cl.freewheel.js +19 -19
  43. package/cl.hls.js +75 -74
  44. package/cl.hlssmpte.js +5 -5
  45. package/cl.htmlcue.js +26 -26
  46. package/cl.ima.js +17 -17
  47. package/cl.mse.js +309 -298
  48. package/cl.muxdata.js +13 -13
  49. package/cl.onboard.js +4 -4
  50. package/cl.persistent.js +10 -10
  51. package/cl.playlist.js +5 -5
  52. package/cl.sessions.js +10 -10
  53. package/cl.simid.js +13 -13
  54. package/cl.smooth.js +59 -59
  55. package/cl.thumbnails.js +19 -19
  56. package/cl.tizen.js +57 -57
  57. package/cl.ttml.js +22 -22
  58. package/cl.verimatrix.js +4 -4
  59. package/cl.vimond.js +8 -8
  60. package/cl.vr.js +14 -14
  61. package/cl.vtt.js +12 -12
  62. package/cl.yospace.js +3 -3
  63. package/cl.youbora.js +28 -28
  64. package/package.json +1 -1
  65. package/typings.d.ts +44 -10
@@ -1,10 +1,10 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var bV=function(a){this.startTime=a.startTime;this.endTime=a.endTime;this.a=this.f=null;a=a.value;if(!_.N.R(a)){a:{var b=a.info;if(_.N.da(b)&&(b=b.toLowerCase().match(/lang:(\w+)/))&&b[1]){b=b[1].toLowerCase();break a}b=null}this.f=b;a=a.data;this.a=_.N.da(a)?a:null}},dV=function(a,b,c){this.m=a;this.l=b;this.j=c;this.a=new _.Wh;this.h=(a=_.uv(_.Wc))?new a(this.m.getConfiguration()):null;this.g=new _.K("clpp.hlssmpte.ImageCueHandler");this.f=null;cV(this)},cV=function(a){a.a.one(a.m,_.Ie,function(){return eV(a)})},
3
- eV=function(a){var b=a.m.getSurface().getMedia();if(b)if(a.h){a.a.on(b.textTracks,_.Kc,function(d){return fV(a,d)});var c=Array.from(b.textTracks);c.filter(function(d){return d.kind===_.Qe}).forEach(function(d){fV(a,{track:d})});!gV(c)&&a.l&&(a.g.warn("The metadata track is not present. Changing an audio track in order to enforce the creation of the metadata track."),hV(a,b))}else a.g.warn("The clpp.ttml.TextParser class is not available. Please register the ttml component first.");else a.g.warn("A video element is not available. Skipping.")},
4
- gV=function(a){return a.some(function(b){return b.kind===_.Qe})},hV=function(a,b){var c=a.m.getTrackManager(),d=c.oa(),e=c.getAudioTracks().find(function(g){return g!==d});if(e){var f=function(){return c.Fa(d)};a.a.on(b.textTracks,_.Kc,function(g){g.track.kind===_.Qe&&(a.a.off(b.textTracks,_.Kc,f),f())});c.Fa(e)}else a.g.warn("Can't enforce the creation of the metadata track if single audio track. Skipping.")},fV=function(a,b){var c=b.track;c.kind===_.Qe&&(a.g.info("The metadata track has been added."),
5
- c.mode=_.we,a.a.on(c,_.Td,function(d){return iV(a,d)}))},iV=function(a,b){var c=jV(a);c&&Array.from(b.target.activeCues||[]).forEach(function(d){if(d!==a.f&&Number.isFinite(d.startTime)&&Number.isFinite(d.endTime)&&"org.id3"===d.type&&d.value&&"TXXX"===d.value.key){var e=new bV(d);if(e.f===c&&null!==e.a){a.f=d;d=a.h.parseMedia(_.T.$a(e.a),{periodStart:a.j,segmentStart:e.startTime,segmentEnd:e.endTime});var f=a.m.getTextDisplayer();f.remove(0,e.startTime);f.append(d.cues,d.styles)}}})},jV=function(a){return(a=
6
- a.m.getTrackManager().ya())&&a.language&&a.language.toLowerCase()},kV=function(){this.a=null;this.f=!1},lV=function(){};dV.prototype.destroy=function(){this.a.release();this.f=null;return Promise.resolve()};_.x(kV,_.Gv);kV.prototype.onPlayerCreated=function(){};kV.prototype.onContentWillLoad=function(a){if(this.f=_.Fl()){var b=a.getConfiguration();b=_.N.cb(b.hlssmpte||{});_.N.gi(b.patchMetadataTrack)||(b.patchMetadataTrack=!1);_.N.ua(b.timestampOffset)||(b.timestampOffset=0);this.a=new dV(a,b.patchMetadataTrack,b.timestampOffset)}};kV.prototype.onPlayerWillDestroy=function(){var a=this;return _.I(function(b){if(1==b.a)return a.a?_.y(b,a.a.destroy(),3):b.F(0);a.a=null;_.B(b)})};kV.prototype.id=function(){return"hlssmpte"};
7
- _.J("clpp.hlssmpte.HlsSmptePlugin",kV);kV.Id="hlssmpte";lV.prototype.create=function(){return new kV};_.gt(new lV);};
2
+ var f=function(window){var YV=function(a){this.startTime=a.startTime;this.endTime=a.endTime;this.a=this.f=null;a=a.value;if(!_.N.R(a)){a:{var b=a.info;if(_.N.ga(b)&&(b=b.toLowerCase().match(/lang:(\w+)/))&&b[1]){b=b[1].toLowerCase();break a}b=null}this.f=b;a=a.data;this.a=_.N.ga(a)?a:null}},$V=function(a,b,c){this.m=a;this.l=b;this.j=c;this.a=new _.vi;this.h=(a=_.Ev(_.$c))?new a(this.m.getConfiguration()):null;this.g=new _.K("clpp.hlssmpte.ImageCueHandler");this.f=null;ZV(this)},ZV=function(a){a.a.one(a.m,_.Se,function(){return aW(a)})},
3
+ aW=function(a){var b=a.m.getSurface().getMedia();if(b)if(a.h){a.a.on(b.textTracks,_.Pc,function(d){return bW(a,d)});var c=Array.from(b.textTracks);c.filter(function(d){return d.kind===_.Ze}).forEach(function(d){bW(a,{track:d})});!cW(c)&&a.l&&(a.g.warn("The metadata track is not present. Changing an audio track in order to enforce the creation of the metadata track."),dW(a,b))}else a.g.warn("The clpp.ttml.TextParser class is not available. Please register the ttml component first.");else a.g.warn("A video element is not available. Skipping.")},
4
+ cW=function(a){return a.some(function(b){return b.kind===_.Ze})},dW=function(a,b){var c=a.m.getTrackManager(),d=c.ra(),e=c.getAudioTracks().find(function(g){return g!==d});if(e){var f=function(){return c.Ka(d)};a.a.on(b.textTracks,_.Pc,function(g){g.track.kind===_.Ze&&(a.a.off(b.textTracks,_.Pc,f),f())});c.Ka(e)}else a.g.warn("Can't enforce the creation of the metadata track if single audio track. Skipping.")},bW=function(a,b){var c=b.track;c.kind===_.Ze&&(a.g.info("The metadata track has been added."),
5
+ c.mode=_.Fe,a.a.on(c,_.be,function(d){return eW(a,d)}))},eW=function(a,b){var c=fW(a);c&&Array.from(b.target.activeCues||[]).forEach(function(d){if(d!==a.f&&Number.isFinite(d.startTime)&&Number.isFinite(d.endTime)&&"org.id3"===d.type&&d.value&&"TXXX"===d.value.key){var e=new YV(d);if(e.f===c&&null!==e.a){a.f=d;d=a.h.parseMedia(_.T.ib(e.a),{periodStart:a.j,segmentStart:e.startTime,segmentEnd:e.endTime});var f=a.m.getTextDisplayer();f.remove(0,e.startTime);f.append(d.cues,d.styles)}}})},fW=function(a){return(a=
6
+ a.m.getTrackManager().Ba())&&a.language&&a.language.toLowerCase()},gW=function(){this.a=null;this.f=!1},hW=function(){};$V.prototype.destroy=function(){this.a.release();this.f=null;return Promise.resolve()};_.x(gW,_.ew);gW.prototype.onPlayerCreated=function(){};gW.prototype.onContentWillLoad=function(a){if(this.f=_.Sl()){var b=a.getConfiguration();b=_.N.nb(b.hlssmpte||{});_.N.Di(b.patchMetadataTrack)||(b.patchMetadataTrack=!1);_.N.xa(b.timestampOffset)||(b.timestampOffset=0);this.a=new $V(a,b.patchMetadataTrack,b.timestampOffset)}};gW.prototype.onPlayerWillDestroy=function(){var a=this;return _.I(function(b){if(1==b.a)return a.a?_.y(b,a.a.destroy(),3):b.F(0);a.a=null;_.B(b)})};gW.prototype.id=function(){return"hlssmpte"};
7
+ _.J("clpp.hlssmpte.HlsSmptePlugin",gW);gW.Id="hlssmpte";hW.prototype.create=function(){return new gW};_.bu(new hW);};
8
8
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
9
9
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
10
10
  else{_=this.clpp._;(f.call(g,this));}
package/cjs/cl.htmlcue.js CHANGED
@@ -1,34 +1,34 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var TT="CLPP Subtitle Styles",UT="Unsupported unit",VT="clpp-text-plain",WT="clpp-text-ttml",XT="clpp.htmlcue.HtmlTextDisplayer",YT="initial",ZT=function(a){return _.Di(a,{zh:function(b,c){return b.na(c)}})},$T=function(a,b){if(0===b.length)return a;var c=a,d=a.findIndex(function(e){return e.startTime>=b[0].startTime});0<=d&&(c=c.slice(0,d));return c.concat(b)},aU=function(a,b){for(var c=0,d=a.length-1;c<=d;){var e=c+d>>1,f=b(a[e]);if(0===f)return e;0<f?c=e+1:d=e-1}return-1},bU=function(){},cU=function(a){if(!a.input)return null;
3
- var b=a.input.match(/^([^<]*)(<[^>]+>?)?/);b=b[1]?b[1]:b[2];a.input=a.input.substr(b.length);return b},eU=function(a){for(var b=null;b=a.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)a=a.replace(b[0],function(c){return dU[c]});return a},gU=function(a,b){fU(a,b);Array.from(b.getElementsByTagName("*")).forEach(function(c){fU(a,c)})},fU=function(a,b){for(var c in a)null!=a[c]&&(b.style[c]=a[c])},hU=function(a,b){return 0===a?"0":a+b},iU=function(a,b){return 1>Math.abs(a-b)||a<b},jU=function(a,b){return a<b&&
4
- 1<Math.abs(a-b)},kU=function(a,b){return a>b&&1<Math.abs(a-b)},lU=function(a,b){return 1>Math.abs(a-b)||a>b},mU=function(a,b,c,d,e,f){this.left=a;this.f=b;this.top=c;this.a=d;this.height=e;this.width=f},nU=function(a){return new mU(a.left,a.f,a.top,a.a,a.height,a.width)},oU=function(a){var b=a.getBoundingClientRect(),c=getComputedStyle(a,null),d=parseFloat(c.getPropertyValue("border-left-width"))||0,e=parseFloat(c.getPropertyValue("border-right-width"))||0,f=parseFloat(c.getPropertyValue("border-top-width"))||
5
- 0;c=parseFloat(c.getPropertyValue("border-bottom-width"))||0;var g=(b.top||a.offsetTop)+f;f=(b.height||a.offsetHeight)-f-c;return new mU(b.left+d,b.right+e,g,(b.bottom||g+f)+c,f,(b.width||a.offsetWidth)-d-e)},pU=function(a,b){return b.some(function(c){return jU(a.left,c.f)&&kU(a.f,c.left)&&jU(a.top,c.a)&&kU(a.a,c.top)})},qU=function(a,b){return lU(a.top,b.top)&&iU(a.a,b.a)&&lU(a.left,b.left)&&iU(a.f,b.f)},rU=function(a,b,c){switch(c){case "+x":return jU(a.left,b.left);case "-x":return kU(a.f,b.f);
6
- case "+y":return jU(a.top,b.top);case "-y":return kU(a.a,b.a);default:throw Error("Unknown axis");}},sU=function(a,b,c){this.id=a;this.w=b;this.B=c;this.a=this.o();this.j=!1},tU=function(a,b,c){sU.call(this,a.id,"clpp-text-cue",{});this.l=b;this.f=a;this.h=!!this.f.backgroundImage;this.C=c},vU=function(a){var b=a.a.childNodes[0],c=a.a.getBoundingClientRect(),d=b.getClientRects();b=c.height/d.length;c=c.width/d.length;return uU(a)?b:c},yU=function(a,b,c){return uU(a)&&_.N.ua(c)?hU(c,_.Lf):(wU(a)||
7
- xU(a))&&_.N.ua(b)?hU(b,"%"):YT},wU=function(a){return a.f.writingMode===_.Eg},xU=function(a){return a.f.writingMode===_.Hg},uU=function(a){return a.f.writingMode===_.Hi},zU=function(a,b,c){return(wU(a)||xU(a))&&_.N.ua(c)?hU(c,_.Lf):wU(a)&&_.N.R(c)?hU(0,_.Lf):uU(a)&&_.N.ua(b)?hU(b,"%"):YT},AU=function(a,b){if(typeof a.f.position===_.k&&typeof a.f.size===_.k)switch(b){case _.Ee:return a.f.position;case "auto":case _.rd:return a.f.position-a.f.size/2;case _.Fe:return a.f.position-a.f.size}return 0},
8
- BU=function(a){switch(a.f.positionAlign){case _.Ee:return _.Be;case "auto":case _.rd:return _.Gi;case _.Fe:return _.Sf}return a.f.textAlign},CU=function(a){if(!a.f.positionAlign)switch(a.f.textAlign){case _.Be:case _.Be:return _.Ee;case _.Gi:return _.rd;case _.Sf:case _.Sf:return _.Fe}return a.f.positionAlign},DU=function(a){switch(a.f.writingMode){case _.Hi:return"horizontal-tb";case _.Eg:return _.Eg;case _.Hg:return _.Hg;default:throw Error("Unknown writing mode");}},EU=function(a,b){this.l=a;this.f=
9
- a.a;this.j=void 0===b?!1:b;this.a=oU(a.a);this.h=[]},FU=function(a,b){if(a.j)switch(b.writingMode){case _.Hi:return["-y"];case _.Eg:return["+x"];case _.Hg:return["-x"]}var c=[];switch(b.writingMode){case _.Hi:c=["+y","-y"];break;case _.Eg:c=["+x","-x"];break;case _.Hg:c=["-x","+x"]}0>b.line&&(c=c.reverse());return c},GU=function(a){for(a.h=[];0<a.f.childNodes.length;)a.f.removeChild(a.f.childNodes[0]);a.a=oU(a.l.a)},HU=function(a,b,c){sU.call(this,a,b,c);this.h=null;this.l=[]},IU=function(a,b){HU.call(this,
10
- a.id,"clpp-text-cue-region",b);this.f=a},JU=function(a,b,c){a=a.f;var d=a.viewportAnchorUnits;if(d===_.Mi)return a.viewportAnchorY/100*c-a.regionAnchorY/100*b;if(0===d)return a.viewportAnchorY-a.regionAnchorY;throw Error(UT);},LU=function(a){this.g=new _.K("clpp.htmlcue.StyleManager");this.j=[];this.h=a;this.l=[];this.a=KU(this,this.h);this.f=KU(this,this.h,!0);this.f.disabled=!0;this.g.debug("Stylesheet CLPP Subtitle Styles has been created.")},MU=function(a,b){var c=!1;try{a.f.insertRule(b,0);var d=
11
- a.f.cssRules[0];d instanceof CSSStyleRule&&(c=d.selectorText.split(",").every(function(e){return 0===e.trim().indexOf("."+a.h+" ")}))}catch(e){}0<a.f.cssRules.length&&a.f.deleteRule(0);return c},NU=function(a,b){var c="."+a.h+" .clpp-text-container",d=c+" .clpp-text-cue";return b=b.replace(/::cue\((#[^)]+)\)/g,c+" $1").replace(/::cue\(([^)]+)\)/g,d+" $1").replace(/::cue-region\(([^)]+)\)/g,c+" $1 .clpp-text-cue").replace(/::cue/g,d).replace(/::cue-region/g,c+" .clpp-text-cue-region .clpp-text-cue").replace(/::ttml/g,
12
- c)},KU=function(a,b,c){var d=document.createElement(_.kg),e=d.dataset;e.name=TT;e["for"]=b;c&&(e.name="CLPP Subtitle Styles (sandbox)",e.sandbox=!0);b=document.head;b.appendChild(d);OU(a,b);a.g.debug("Created HTML style element #CLPP Subtitle Styles.");return d.sheet},OU=function(a,b){var c=new MutationObserver(function(d){d.forEach(function(e){e.removedNodes.forEach(function(f){f.id===TT&&a.g.error("PRESTOplay HTML style element #CLPP Subtitle Styles has been unexpectedly removed! Some styles will not work!")})})});
13
- c.observe(b,{subtree:!1,childList:!0});a.j.push(function(){return c.disconnect()})},RU=function(a){_.wv.call(this,a);var b=this;this.g=new _.K(XT);this.m=a;this.L=PU(a.getConfiguration());this.j=!1;this.f=[];this.C=a.getSurface().getContainer();this.h=new LU(a.getSurface().getUniqueCssClass());this.a=new HU(null,"clpp-text-container",{});this.w=new _.Au(a.getSurface(),this.lk.bind(this));this.J=null;this.C?(this.C.appendChild(this.a.a),this.a.init(null)):this.g.warn("No container element! Subtitles will not appear. Please check your player surface configuration or switch to NativeTextDisplayer.");
14
- this.G=new _.xl(function(){QU(b)});this.A=new Map;this.l=null},PU=function(a){a=_.N.cb(a.htmlcue||{});_.N.R(a.stretchSmpteImage)&&(a.stretchSmpteImage=!1);_.N.R(a.enableResizeObserver)&&(a.enableResizeObserver=!0);return a},SU=function(a,b){return a.startTime<=b&&a.endTime>b},QU=function(a,b){if((b||a.j)&&a.C){var c=a.m.getPosition();if(b||a.J!==c&&a.m.getState()===_.iq){a.J=c;var d=TU(a,c);(c=b)||(c=a.l,c=!(null===c&&null===d||null!==c&&null!==d&&c.start===d.start&&c.end===d.end));if(c&&(a.l=d,UU(a),
15
- d)){c={color:a.getFontColor()||void 0,backgroundColor:a.getBackgroundColor()||void 0,fontFamily:a.getFontFamily()||void 0,textShadow:_.Bv(a)||void 0};d=a.f.slice(d.start,d.end+1);d=_.w(d);for(var e=d.next();!e.done;e=d.next()){var f=a;e=e.value;var g=f.a.a,h=null;switch(e.payloadType){case _.Og:h="clpp-text-vtt";break;case _.sg:h=WT;break;case _.Fi:h=VT}h&&!g.classList.contains(h)&&_.Jq(g,h);g=oU(f.a.a);if(0===g.width||0===g.height)f.g.warn("The height or width of the `.clpp-text-container` element is zero. Captions will not be displayed. Please check if the `clpp.styles.css` file has been included.");
16
- else{fU({fontSize:VU(f,e.containerRows)},f.a.a);g=null;h=e.payloadType===_.Og;var l=e.payloadType===_.sg;e.region&&(h||l||e.backgroundImage)&&(f.A.has(e.region.id)?g=f.A.get(e.region.id):(g=new IU(e.region,{}),f.A.set(e.region.id,g),f.a.appendChild(g)));e=new tU(e,f.L,c);g?g.appendChild(e):f.a.appendChild(e)}}}}}},TU=function(a,b){var c=aU(a.f,function(e){return SU(e,b)?0:b!==e.startTime?b-e.startTime:b-e.endTime});if(-1===c)return null;for(var d=c;0<=d-1&&SU(a.f[d-1],b);)d--;for(;c+1<a.f.length&&
17
- SU(a.f[c+1],b);)c++;return{start:d,end:c}},WU=function(a){UU(a);a.J=null;a.l=null;a.f=[]},UU=function(a){a.A.clear();if(a.a){var b=a.a.a;b.classList.remove("clpp-text-vtt");b.classList.remove(WT);b.classList.remove(VT);a=a.a;GU(a.h);a.l=[]}},VU=function(a,b){var c=oU(a.a.a).height;if(null!==a.I)return a.getFontSize();if(null!==a.B){var d=a.getFontSizePercent();return Math.round(c*d)+_.Lf}if(typeof b===_.k&&0<b)return Math.round(c/b)+_.Lf;d=a.getFontSizePercent();return Math.round(c*d)+_.Lf},XU=function(){},
18
- YU=function(){};
19
- bU.prototype.parse=function(a){a={input:a};for(var b=_.Lq(_.Xd),c=[],d=b,e;null!==(e=cU(a));)if("\x3c"===e[0])if("/"===e[1])c.length&&c[c.length-1]===e.substr(2).replace("\x3e","")&&(c.pop(),d=d.parentNode);else{if(e=e.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/)){var f=e[1];var g=e[3];var h=ZU[f];h?(h=_.Lq(h),(f=$U[f])&&g&&h.setAttribute(f,g.trim()),g=h):g=null;!g||aV[g.localName]&&aV[g.localName]!==d.localName||(e[2]&&(g.className=e[2].substr(1).replace(/\./g," ")),c.push(e[1]),d.appendChild(g),
20
- d=g)}}else d.appendChild(document.createTextNode(eU(e)));return b};var ZU={c:"c",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"v",lang:"lang"},$U={v:"voice",lang:"lang"},aV={rt:"ruby"},dU={"\x26amp;":"\x26","\x26lt;":"\x3c","\x26gt;":"\x3e","\x26lrm;":"\u200e","\x26rlm;":"\u200f","\x26nbsp;":"\u00a0"};sU.prototype.init=function(){this.j=!0};sU.prototype.A=function(){return!1};_.x(tU,sU);tU.prototype.A=function(){return!this.h&&!(this.f.region&&this.f.region.displayAlign)};
21
- tU.prototype.init=function(a){sU.prototype.init.call(this,a);if(this.h)_.Jq(this.a,"clpp-text-cue-image"),this.a.style.backgroundImage='url("'+this.f.backgroundImage+'")',this.l.stretchSmpteImage&&(this.a.style.backgroundSize="contain");else if(a){var b=this.f;if(b.payloadType===_.sg){var c=_.Lq(_.Xd);c.innerHTML=b.payload;b=c}else b.payloadType===_.Og?b=(new bU).parse(b.payload):(c=_.Lq(_.Xd),c.textContent=b.payload,b=c);_.Jq(b,this.w);this.id&&(b.id=this.id);c=_.w(this.f.cssClassList);for(var d=
22
- c.next();!d.done;d=c.next())_.Jq(b,d.value);fU({writingMode:DU(this)},b);this.a.appendChild(b);_.Jq(this.a,"clpp-text-wrapper");c=_.w(this.f.cssClassList);for(d=c.next();!d.done;d=c.next())_.Jq(this.a,"clpp-text-wrapper__"+d.value);_.N.R(this.f.line)&&(this.f.lineInterpretation=_.Ii,this.f.line=uU(this)?-1:0);c=DU(this);fU({writingMode:c,webkitWritingMode:c,direction:YT,textAlign:BU(this)},this.a);if(!this.f.region||!this.f.region.displayAlign){c=AU(this,CU(this));d=zU(this,c,null);var e=yU(this,
23
- c,null),f=xU(this)&&_.N.R(null)?hU(0,_.Lf):YT;fU({position:"absolute",left:d,right:f,top:e,width:uU(this)?hU(this.f.size,"%"):YT,height:wU(this)||xU(this)?hU(this.f.size,"%"):YT},this.a);d=this.f;a=uU(this)?a.height:a.width;e=vU(this);if(d.lineInterpretation===_.Ii)f=e*Math.round(d.line),Math.abs(f)>a&&(f=e*(0>d.line?0:-1)),0>f&&(f+=a);else{f=e/a*100;var g=d.line;switch(d.lineAlign){case _.rd:g-=f/2;break;case _.oe:g-=f}f=Math.round(g/100*a)}xU(this)&&(f=a-f-e);a=f;d=zU(this,c,a);e=xU(this)&&_.N.R(a)?
24
- hU(0,_.Lf):YT;fU({left:d,right:e,top:yU(this,c,a)},this.a)}gU(this.C,b)}};tU.prototype.o=function(){return _.Lq(_.Xd)};EU.prototype.append=function(a){var b=a.a;b.style.visibility=_.we;this.f.appendChild(b);a.j||a.init(this.a);if(a.A()){a:{var c=oU(a.a);var d=FU(this,a.f),e=vU(a),f=nU(c),g=null,h=0;d=_.w(d);for(var l=d.next();!l.done;l=d.next()){for(l=l.value;rU(c,this.a,l)||qU(c,this.a)&&pU(c,this.h);){var m=c,n=e;switch(l){case "+x":m.left+=n;m.f+=n;break;case "-x":m.left-=n;m.f-=n;break;case "+y":m.top+=n;m.a+=n;break;case "-y":m.top-=n,m.a-=n}}if(this.j||qU(c,this.a))break a;l=this.a;l=Math.max(0,Math.min(c.f,
25
- l.f)-Math.max(c.left,l.left))*Math.max(0,Math.min(c.a,l.a)-Math.max(c.top,l.top))/(c.height*c.width);l>h&&(g=nU(c),h=l);c=nU(f)}c=g||f}fU({top:hU(c.top-this.a.top,_.Lf),bottom:hU(this.a.a-c.a,_.Lf),left:hU(c.left-this.a.left,_.Lf),right:hU(this.a.f-c.f,_.Lf),height:hU(c.height,_.Lf),width:hU(c.width,_.Lf)},a.a)}b.style.visibility="visible";this.h.push(oU(a.a))};_.x(HU,sU);HU.prototype.init=function(){this.h=new EU(this);this.j=!0};HU.prototype.o=function(){var a=_.Lq(_.Xd);_.Jq(a,this.w);this.id&&(a.id=this.id);return a};HU.prototype.appendChild=function(a){GU(this.h);this.l.unshift(a);a=_.w(this.l);for(var b=a.next();!b.done;b=a.next())this.h.append(b.value)};_.x(IU,HU);
26
- IU.prototype.init=function(a){a:{var b=this.f;switch(b.widthUnits){case 0:b=b.width;break a;case _.Mi:b=b.width/100*a.width;break a;default:throw Error(UT);}}var c=this.f;var d=c.viewportAnchorUnits;if(d===_.Mi)c=c.viewportAnchorX/100*a.width-c.regionAnchorX/100*b;else if(0===d)c=c.viewportAnchorX-c.regionAnchorX;else throw Error(UT);d=a.height;var e=JU(this,d,a.height);fU(this.B,this.a);fU({left:hU(c,_.Lf),top:hU(e,_.Lf),width:hU(b,_.Lf),height:hU(d,_.Lf)},this.a);this.f.writingMode&&fU({display:"flex",
27
- "flex-direction":this.f.writingMode},this.a);this.f.displayAlign&&fU({"justify-content":this.f.displayAlign},this.a);b=_.w(this.f.cssClassList);for(c=b.next();!c.done;c=b.next())_.Jq(this.a,c.value);a:switch(b=this.f,b.heightUnits){case 0:b=b.height;break a;case _.Mi:b=b.height/100*a.height;break a;case 2:b=b.height;d=new tU(new _.Li(0,1,"Lorem ipsum",_.Fi),{},{});c=d.a;this.a.appendChild(c);d.init(oU(this.a));d=c.getBoundingClientRect().height;this.a.removeChild(c);b*=d;break a;default:throw Error(UT);
28
- }a=JU(this,b,a.height);fU({top:hU(a,_.Lf),height:hU(b,_.Lf)},this.a);this.h=new EU(this,!0);this.j=!0};IU.prototype.getId=function(){return this.f.id};LU.prototype.appendRule=function(a){if(null!=this.a&&!this.l.some(function(c){return c===a})){var b=NU(this,a);if(MU(this,b)){try{this.a.insertRule(b,this.a.cssRules.length),this.g.debug("Added CSS rule "+b)}catch(c){this.g.error("An error occurred when adding a CSS rule: "+b)}this.l.push(a)}else this.g.warn("Stylesheet CLPP Subtitle Styles ignoring the CSS rule because it's not safe: "+b)}};
29
- LU.prototype.destroy=function(){var a=this;return _.I(function(b){if(null==a.a)return b["return"]();a.j.forEach(function(c){return c()});a.j=[];if(null!=a.a){for(;0<a.a.cssRules.length;)a.a.deleteRule(0);a.l=[]}document.head.removeChild(a.a.ownerNode);document.head.removeChild(a.f.ownerNode);a.a=null;a.f=null;a.g.debug("Stylesheet CLPP Subtitle Styles has been destroyed.");_.B(b)})};_.x(RU,_.wv);_.u=RU.prototype;_.u.append=function(a,b){if(null!=this.h&&0!==a.length){for(var c=_.w(b),d=c.next();!d.done;d=c.next())this.h.appendRule(d.value);a.sort(function(e,f){return e.startTime!==f.startTime?e.startTime-f.startTime:e.endTime-f.endTime});this.f=$T(this.f,ZT(a));this.l=null;QU(this,!1)}};_.u.Nb=function(){null==this.h||QU(this,!0)};
30
- _.u.destroy=function(){var a=this;return _.I(function(b){if(1==b.a){if(null==a.h)return b["return"]();WU(a);a.G.stop();return _.y(b,a.h.destroy(),2)}a.h=null;a.C.removeChild(a.a.a);a.a=null;a.w.stop();a.w=null;a.j=!1;_.B(b)})};_.u.remove=function(a,b){if(null==this.h)return!1;this.f=this.f.filter(function(c){return c.startTime<a||c.endTime>=b});this.l=null;QU(this,!0);return!0};_.u.isTextVisible=function(){return this.j};
31
- _.u.setTextVisibility=function(a){null!=this.h&&this.j!==a&&((this.j=a)?(this.G.Ab(.25),this.L.enableResizeObserver&&this.w.start(),QU(this,!0)):(this.G.stop(),this.w.stop(),WU(this)))};_.u.lk=function(){QU(this,!0)};_.J(XT,RU);RU.prototype.setTextVisibility=RU.prototype.setTextVisibility;RU.prototype.isTextVisible=RU.prototype.isTextVisible;RU.prototype.remove=RU.prototype.remove;RU.prototype.destroy=RU.prototype.destroy;RU.prototype.append=RU.prototype.append;XU.prototype.a=function(a){return!!a.enableHtmlCue&&!_.Hl()};XU.prototype.create=function(a){return new RU(a)};_.x(YU,_.Kt);YU.prototype.f=function(){_.Ip(_.xe,new XU)};YU.prototype.a=function(){_.Gp.has(_.xe)&&(_.Gp["delete"](_.xe),_.Hp.info("Removed factory: 'html'"))};YU.prototype.id=function(){return _.mg};_.J("clpp.htmlcue.HtmlCueComponent",YU);};
2
+ var f=function(window){var PU="CLPP Subtitle Styles",QU="Unsupported unit",RU="clpp-text-plain",SU="clpp-text-ttml",TU="clpp.htmlcue.HtmlTextDisplayer",UU="initial",VU=function(a){return _.Yi(a,{Sh:function(b,c){return b.qa(c)}})},WU=function(a,b){if(0===b.length)return a;var c=a,d=a.findIndex(function(e){return e.startTime>=b[0].startTime});0<=d&&(c=c.slice(0,d));return c.concat(b)},XU=function(a,b){for(var c=0,d=a.length-1;c<=d;){var e=c+d>>1,f=b(a[e]);if(0===f)return e;0<f?c=e+1:d=e-1}return-1},YU=function(){},ZU=function(a){if(!a.input)return null;
3
+ var b=a.input.match(/^([^<]*)(<[^>]+>?)?/);b=b[1]?b[1]:b[2];a.input=a.input.substr(b.length);return b},aV=function(a){for(var b=null;b=a.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)a=a.replace(b[0],function(c){return $U[c]});return a},cV=function(a,b){bV(a,b);Array.from(b.getElementsByTagName("*")).forEach(function(c){bV(a,c)})},bV=function(a,b){for(var c in a)null!=a[c]&&(b.style[c]=a[c])},dV=function(a,b){return 0===a?"0":a+b},eV=function(a,b){return 1>Math.abs(a-b)||a<b},fV=function(a,b){return a<b&&
4
+ 1<Math.abs(a-b)},gV=function(a,b){return a>b&&1<Math.abs(a-b)},hV=function(a,b){return 1>Math.abs(a-b)||a>b},iV=function(a,b,c,d,e,f){this.left=a;this.f=b;this.top=c;this.a=d;this.height=e;this.width=f},jV=function(a){return new iV(a.left,a.f,a.top,a.a,a.height,a.width)},kV=function(a){var b=a.getBoundingClientRect(),c=getComputedStyle(a,null),d=parseFloat(c.getPropertyValue("border-left-width"))||0,e=parseFloat(c.getPropertyValue("border-right-width"))||0,f=parseFloat(c.getPropertyValue("border-top-width"))||
5
+ 0;c=parseFloat(c.getPropertyValue("border-bottom-width"))||0;var g=(b.top||a.offsetTop)+f;f=(b.height||a.offsetHeight)-f-c;return new iV(b.left+d,b.right+e,g,(b.bottom||g+f)+c,f,(b.width||a.offsetWidth)-d-e)},lV=function(a,b){return b.some(function(c){return fV(a.left,c.f)&&gV(a.f,c.left)&&fV(a.top,c.a)&&gV(a.a,c.top)})},mV=function(a,b){return hV(a.top,b.top)&&eV(a.a,b.a)&&hV(a.left,b.left)&&eV(a.f,b.f)},nV=function(a,b,c){switch(c){case "+x":return fV(a.left,b.left);case "-x":return gV(a.f,b.f);
6
+ case "+y":return fV(a.top,b.top);case "-y":return gV(a.a,b.a);default:throw Error("Unknown axis");}},oV=function(a,b,c){this.id=a;this.w=b;this.B=c;this.a=this.o();this.j=!1},pV=function(a,b,c){oV.call(this,a.id,"clpp-text-cue",{});this.l=b;this.f=a;this.h=!!this.f.backgroundImage;this.C=c},rV=function(a){var b=a.a.childNodes[0],c=a.a.getBoundingClientRect(),d=b.getClientRects();b=c.height/d.length;c=c.width/d.length;return qV(a)?b:c},uV=function(a,b,c){return qV(a)&&_.N.xa(c)?dV(c,_.Wf):(sV(a)||
7
+ tV(a))&&_.N.xa(b)?dV(b,"%"):UU},sV=function(a){return a.f.writingMode===_.Vg},tV=function(a){return a.f.writingMode===_.Wg},qV=function(a){return a.f.writingMode===_.bj},vV=function(a,b,c){return(sV(a)||tV(a))&&_.N.xa(c)?dV(c,_.Wf):sV(a)&&_.N.R(c)?dV(0,_.Wf):qV(a)&&_.N.xa(b)?dV(b,"%"):UU},wV=function(a,b){if(typeof a.f.position===_.k&&typeof a.f.size===_.k)switch(b){case _.Oe:return a.f.position;case "auto":case _.wd:return a.f.position-a.f.size/2;case _.Pe:return a.f.position-a.f.size}return 0},
8
+ xV=function(a){switch(a.f.positionAlign){case _.Oe:return _.Ke;case "auto":case _.wd:return _.aj;case _.Pe:return _.cg}return a.f.textAlign},yV=function(a){if(!a.f.positionAlign)switch(a.f.textAlign){case _.Ke:case _.Ke:return _.Oe;case _.aj:return _.wd;case _.cg:case _.cg:return _.Pe}return a.f.positionAlign},zV=function(a){switch(a.f.writingMode){case _.bj:return"horizontal-tb";case _.Vg:return _.Vg;case _.Wg:return _.Wg;default:throw Error("Unknown writing mode");}},AV=function(a,b){this.l=a;this.f=
9
+ a.a;this.j=void 0===b?!1:b;this.a=kV(a.a);this.h=[]},BV=function(a,b){if(a.j)switch(b.writingMode){case _.bj:return["-y"];case _.Vg:return["+x"];case _.Wg:return["-x"]}var c=[];switch(b.writingMode){case _.bj:c=["+y","-y"];break;case _.Vg:c=["+x","-x"];break;case _.Wg:c=["-x","+x"]}0>b.line&&(c=c.reverse());return c},CV=function(a){for(a.h=[];0<a.f.childNodes.length;)a.f.removeChild(a.f.childNodes[0]);a.a=kV(a.l.a)},DV=function(a,b,c){oV.call(this,a,b,c);this.h=null;this.l=[]},EV=function(a,b){DV.call(this,
10
+ a.id,"clpp-text-cue-region",b);this.f=a},FV=function(a,b,c){a=a.f;var d=a.viewportAnchorUnits;if(d===_.gj)return a.viewportAnchorY/100*c-a.regionAnchorY/100*b;if(0===d)return a.viewportAnchorY-a.regionAnchorY;throw Error(QU);},HV=function(a){this.g=new _.K("clpp.htmlcue.StyleManager");this.j=[];this.h=a;this.l=[];this.a=GV(this,this.h);this.f=GV(this,this.h,!0);this.f.disabled=!0;this.g.debug("Stylesheet CLPP Subtitle Styles has been created.")},IV=function(a,b){var c=!1;try{a.f.insertRule(b,0);var d=
11
+ a.f.cssRules[0];d instanceof CSSStyleRule&&(c=d.selectorText.split(",").every(function(e){return 0===e.trim().indexOf("."+a.h+" ")}))}catch(e){}0<a.f.cssRules.length&&a.f.deleteRule(0);return c},JV=function(a,b){var c="."+a.h+" .clpp-text-container",d=c+" .clpp-text-cue";return b=b.replace(/::cue\((#[^)]+)\)/g,c+" $1").replace(/::cue\(([^)]+)\)/g,d+" $1").replace(/::cue-region\(([^)]+)\)/g,c+" $1 .clpp-text-cue").replace(/::cue/g,d).replace(/::cue-region/g,c+" .clpp-text-cue-region .clpp-text-cue").replace(/::ttml/g,
12
+ c)},GV=function(a,b,c){var d=document.createElement(_.vg),e=d.dataset;e.name=PU;e["for"]=b;c&&(e.name="CLPP Subtitle Styles (sandbox)",e.sandbox=!0);b=document.head;b.appendChild(d);KV(a,b);a.g.debug("Created HTML style element #CLPP Subtitle Styles.");return d.sheet},KV=function(a,b){var c=new MutationObserver(function(d){d.forEach(function(e){e.removedNodes.forEach(function(f){f.id===PU&&a.g.error("PRESTOplay HTML style element #CLPP Subtitle Styles has been unexpectedly removed! Some styles will not work!")})})});
13
+ c.observe(b,{subtree:!1,childList:!0});a.j.push(function(){return c.disconnect()})},NV=function(a){_.Gv.call(this,a);var b=this;this.g=new _.K(TU);this.m=a;this.L=LV(a.getConfiguration());this.j=!1;this.f=[];this.C=a.getSurface().getContainer();this.h=new HV(a.getSurface().getUniqueCssClass());this.a=new DV(null,"clpp-text-container",{});this.w=new _.Yu(a.getSurface(),this.Nk.bind(this));this.J=null;this.C?(this.C.appendChild(this.a.a),this.a.init(null)):this.g.warn("No container element! Subtitles will not appear. Please check your player surface configuration or switch to NativeTextDisplayer.");
14
+ this.G=new _.li(function(){MV(b)});this.A=new Map;this.l=null},LV=function(a){a=_.N.nb(a.htmlcue||{});_.N.R(a.stretchSmpteImage)&&(a.stretchSmpteImage=!1);_.N.R(a.enableResizeObserver)&&(a.enableResizeObserver=!0);return a},OV=function(a,b){return a.startTime<=b&&a.endTime>b},MV=function(a,b){if((b||a.j)&&a.C){var c=a.m.getPosition();if(b||a.J!==c&&a.m.getState()===_.Uq){a.J=c;var d=PV(a,c);(c=b)||(c=a.l,c=!(null===c&&null===d||null!==c&&null!==d&&c.start===d.start&&c.end===d.end));if(c&&(a.l=d,QV(a),
15
+ d)){c={color:a.getFontColor()||void 0,backgroundColor:a.getBackgroundColor()||void 0,fontFamily:a.getFontFamily()||void 0,textShadow:_.$v(a)||void 0};d=a.f.slice(d.start,d.end+1);d=_.w(d);for(var e=d.next();!e.done;e=d.next()){var f=a;e=e.value;var g=f.a.a,h=null;switch(e.payloadType){case _.ch:h="clpp-text-vtt";break;case _.Jg:h=SU;break;case _.$i:h=RU}h&&!g.classList.contains(h)&&_.tr(g,h);g=kV(f.a.a);if(0===g.width||0===g.height)f.g.warn("The height or width of the `.clpp-text-container` element is zero. Captions will not be displayed. Please check if the `clpp.styles.css` file has been included.");
16
+ else{bV({fontSize:RV(f,e.containerRows)},f.a.a);g=null;h=e.payloadType===_.ch;var l=e.payloadType===_.Jg;e.region&&(h||l||e.backgroundImage)&&(f.A.has(e.region.id)?g=f.A.get(e.region.id):(g=new EV(e.region,{}),f.A.set(e.region.id,g),f.a.appendChild(g)));e=new pV(e,f.L,c);g?g.appendChild(e):f.a.appendChild(e)}}}}}},PV=function(a,b){var c=XU(a.f,function(e){return OV(e,b)?0:b!==e.startTime?b-e.startTime:b-e.endTime});if(-1===c)return null;for(var d=c;0<=d-1&&OV(a.f[d-1],b);)d--;for(;c+1<a.f.length&&
17
+ OV(a.f[c+1],b);)c++;return{start:d,end:c}},SV=function(a){QV(a);a.J=null;a.l=null;a.f=[]},QV=function(a){a.A.clear();if(a.a){var b=a.a.a;b.classList.remove("clpp-text-vtt");b.classList.remove(SU);b.classList.remove(RU);a=a.a;CV(a.h);a.l=[]}},RV=function(a,b){var c=kV(a.a.a).height;if(null!==a.I)return a.getFontSize();if(null!==a.B){var d=a.getFontSizePercent();return Math.round(c*d)+_.Wf}if(typeof b===_.k&&0<b)return Math.round(c/b)+_.Wf;d=a.getFontSizePercent();return Math.round(c*d)+_.Wf},TV=function(){},
18
+ UV=function(){};
19
+ YU.prototype.parse=function(a){a={input:a};for(var b=_.vr(_.fe),c=[],d=b,e;null!==(e=ZU(a));)if("\x3c"===e[0])if("/"===e[1])c.length&&c[c.length-1]===e.substr(2).replace("\x3e","")&&(c.pop(),d=d.parentNode);else{if(e=e.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/)){var f=e[1];var g=e[3];var h=VV[f];h?(h=_.vr(h),(f=WV[f])&&g&&h.setAttribute(f,g.trim()),g=h):g=null;!g||XV[g.localName]&&XV[g.localName]!==d.localName||(e[2]&&(g.className=e[2].substr(1).replace(/\./g," ")),c.push(e[1]),d.appendChild(g),
20
+ d=g)}}else d.appendChild(document.createTextNode(aV(e)));return b};var VV={c:"c",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"v",lang:"lang"},WV={v:"voice",lang:"lang"},XV={rt:"ruby"},$U={"\x26amp;":"\x26","\x26lt;":"\x3c","\x26gt;":"\x3e","\x26lrm;":"\u200e","\x26rlm;":"\u200f","\x26nbsp;":"\u00a0"};oV.prototype.init=function(){this.j=!0};oV.prototype.A=function(){return!1};_.x(pV,oV);pV.prototype.A=function(){return!this.h&&!(this.f.region&&this.f.region.displayAlign)};
21
+ pV.prototype.init=function(a){oV.prototype.init.call(this,a);if(this.h)_.tr(this.a,"clpp-text-cue-image"),this.a.style.backgroundImage='url("'+this.f.backgroundImage+'")',this.l.stretchSmpteImage&&(this.a.style.backgroundSize="contain");else if(a){var b=this.f;if(b.payloadType===_.Jg){var c=_.vr(_.fe);c.innerHTML=b.payload;b=c}else b.payloadType===_.ch?b=(new YU).parse(b.payload):(c=_.vr(_.fe),c.textContent=b.payload,b=c);_.tr(b,this.w);this.id&&(b.id=this.id);c=_.w(this.f.cssClassList);for(var d=
22
+ c.next();!d.done;d=c.next())_.tr(b,d.value);bV({writingMode:zV(this)},b);this.a.appendChild(b);_.tr(this.a,"clpp-text-wrapper");c=_.w(this.f.cssClassList);for(d=c.next();!d.done;d=c.next())_.tr(this.a,"clpp-text-wrapper__"+d.value);_.N.R(this.f.line)&&(this.f.lineInterpretation=_.cj,this.f.line=qV(this)?-1:0);c=zV(this);bV({writingMode:c,webkitWritingMode:c,direction:UU,textAlign:xV(this)},this.a);if(!this.f.region||!this.f.region.displayAlign){c=wV(this,yV(this));d=vV(this,c,null);var e=uV(this,
23
+ c,null),f=tV(this)&&_.N.R(null)?dV(0,_.Wf):UU;bV({position:"absolute",left:d,right:f,top:e,width:qV(this)?dV(this.f.size,"%"):UU,height:sV(this)||tV(this)?dV(this.f.size,"%"):UU},this.a);d=this.f;a=qV(this)?a.height:a.width;e=rV(this);if(d.lineInterpretation===_.cj)f=e*Math.round(d.line),Math.abs(f)>a&&(f=e*(0>d.line?0:-1)),0>f&&(f+=a);else{f=e/a*100;var g=d.line;switch(d.lineAlign){case _.wd:g-=f/2;break;case _.xe:g-=f}f=Math.round(g/100*a)}tV(this)&&(f=a-f-e);a=f;d=vV(this,c,a);e=tV(this)&&_.N.R(a)?
24
+ dV(0,_.Wf):UU;bV({left:d,right:e,top:uV(this,c,a)},this.a)}cV(this.C,b)}};pV.prototype.o=function(){return _.vr(_.fe)};AV.prototype.append=function(a){var b=a.a;b.style.visibility=_.Fe;this.f.appendChild(b);a.j||a.init(this.a);if(a.A()){a:{var c=kV(a.a);var d=BV(this,a.f),e=rV(a),f=jV(c),g=null,h=0;d=_.w(d);for(var l=d.next();!l.done;l=d.next()){for(l=l.value;nV(c,this.a,l)||mV(c,this.a)&&lV(c,this.h);){var m=c,n=e;switch(l){case "+x":m.left+=n;m.f+=n;break;case "-x":m.left-=n;m.f-=n;break;case "+y":m.top+=n;m.a+=n;break;case "-y":m.top-=n,m.a-=n}}if(this.j||mV(c,this.a))break a;l=this.a;l=Math.max(0,Math.min(c.f,
25
+ l.f)-Math.max(c.left,l.left))*Math.max(0,Math.min(c.a,l.a)-Math.max(c.top,l.top))/(c.height*c.width);l>h&&(g=jV(c),h=l);c=jV(f)}c=g||f}bV({top:dV(c.top-this.a.top,_.Wf),bottom:dV(this.a.a-c.a,_.Wf),left:dV(c.left-this.a.left,_.Wf),right:dV(this.a.f-c.f,_.Wf),height:dV(c.height,_.Wf),width:dV(c.width,_.Wf)},a.a)}b.style.visibility="visible";this.h.push(kV(a.a))};_.x(DV,oV);DV.prototype.init=function(){this.h=new AV(this);this.j=!0};DV.prototype.o=function(){var a=_.vr(_.fe);_.tr(a,this.w);this.id&&(a.id=this.id);return a};DV.prototype.appendChild=function(a){CV(this.h);this.l.unshift(a);a=_.w(this.l);for(var b=a.next();!b.done;b=a.next())this.h.append(b.value)};_.x(EV,DV);
26
+ EV.prototype.init=function(a){a:{var b=this.f;switch(b.widthUnits){case 0:b=b.width;break a;case _.gj:b=b.width/100*a.width;break a;default:throw Error(QU);}}var c=this.f;var d=c.viewportAnchorUnits;if(d===_.gj)c=c.viewportAnchorX/100*a.width-c.regionAnchorX/100*b;else if(0===d)c=c.viewportAnchorX-c.regionAnchorX;else throw Error(QU);d=a.height;var e=FV(this,d,a.height);bV(this.B,this.a);bV({left:dV(c,_.Wf),top:dV(e,_.Wf),width:dV(b,_.Wf),height:dV(d,_.Wf)},this.a);this.f.writingMode&&bV({display:"flex",
27
+ "flex-direction":this.f.writingMode},this.a);this.f.displayAlign&&bV({"justify-content":this.f.displayAlign},this.a);b=_.w(this.f.cssClassList);for(c=b.next();!c.done;c=b.next())_.tr(this.a,c.value);a:switch(b=this.f,b.heightUnits){case 0:b=b.height;break a;case _.gj:b=b.height/100*a.height;break a;case 2:b=b.height;d=new pV(new _.fj(0,1,"Lorem ipsum",_.$i),{},{});c=d.a;this.a.appendChild(c);d.init(kV(this.a));d=c.getBoundingClientRect().height;this.a.removeChild(c);b*=d;break a;default:throw Error(QU);
28
+ }a=FV(this,b,a.height);bV({top:dV(a,_.Wf),height:dV(b,_.Wf)},this.a);this.h=new AV(this,!0);this.j=!0};EV.prototype.getId=function(){return this.f.id};HV.prototype.appendRule=function(a){if(null!=this.a&&!this.l.some(function(c){return c===a})){var b=JV(this,a);if(IV(this,b)){try{this.a.insertRule(b,this.a.cssRules.length),this.g.debug("Added CSS rule "+b)}catch(c){this.g.error("An error occurred when adding a CSS rule: "+b)}this.l.push(a)}else this.g.warn("Stylesheet CLPP Subtitle Styles ignoring the CSS rule because it's not safe: "+b)}};
29
+ HV.prototype.destroy=function(){var a=this;return _.I(function(b){if(null==a.a)return b["return"]();a.j.forEach(function(c){return c()});a.j=[];if(null!=a.a){for(;0<a.a.cssRules.length;)a.a.deleteRule(0);a.l=[]}document.head.removeChild(a.a.ownerNode);document.head.removeChild(a.f.ownerNode);a.a=null;a.f=null;a.g.debug("Stylesheet CLPP Subtitle Styles has been destroyed.");_.B(b)})};_.x(NV,_.Gv);_.t=NV.prototype;_.t.append=function(a,b){if(null!=this.h&&0!==a.length){for(var c=_.w(b),d=c.next();!d.done;d=c.next())this.h.appendRule(d.value);a.sort(function(e,f){return e.startTime!==f.startTime?e.startTime-f.startTime:e.endTime-f.endTime});this.f=WU(this.f,VU(a));this.l=null;MV(this,!1)}};_.t.Xb=function(){null==this.h||MV(this,!0)};
30
+ _.t.destroy=function(){var a=this;return _.I(function(b){if(1==b.a){if(null==a.h)return b["return"]();SV(a);a.G.stop();return _.y(b,a.h.destroy(),2)}a.h=null;a.C.removeChild(a.a.a);a.a=null;a.w.stop();a.w=null;a.j=!1;_.B(b)})};_.t.remove=function(a,b){if(null==this.h)return!1;this.f=this.f.filter(function(c){return c.startTime<a||c.endTime>=b});this.l=null;MV(this,!0);return!0};_.t.isTextVisible=function(){return this.j};
31
+ _.t.setTextVisibility=function(a){null!=this.h&&this.j!==a&&((this.j=a)?(this.G.Kb(.25),this.L.enableResizeObserver&&this.w.start(),MV(this,!0)):(this.G.stop(),this.w.stop(),SV(this)))};_.t.Nk=function(){MV(this,!0)};_.J(TU,NV);NV.prototype.setTextVisibility=NV.prototype.setTextVisibility;NV.prototype.isTextVisible=NV.prototype.isTextVisible;NV.prototype.remove=NV.prototype.remove;NV.prototype.destroy=NV.prototype.destroy;NV.prototype.append=NV.prototype.append;TV.prototype.a=function(a){return!!a.enableHtmlCue&&!_.Ul()};TV.prototype.create=function(a){return new NV(a)};_.x(UV,_.Fu);UV.prototype.f=function(){_.wq(_.Ge,new TV)};UV.prototype.a=function(){_.uq.has(_.Ge)&&(_.uq["delete"](_.Ge),_.vq.info("Removed factory: 'html'"))};UV.prototype.id=function(){return _.xg};_.J("clpp.htmlcue.HtmlCueComponent",UV);};
32
32
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
33
33
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
34
34
  else{_=this.clpp._;(f.call(g,this));}
package/cjs/cl.ima.js CHANGED
@@ -1,27 +1,27 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var AT="clpp.ima.AdsManagerFactory",BT=function(a,b,c){this.a=a;this.f=a.getAdPodInfo();this.j=b;this.h=c},CT=function(){},DT=function(a){this.a=a},ET=function(a){var b=a.Wd("ima");if(!b)throw Error("IMA plugin not created.");var c=b.cd(),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=_.N.cb(a.ima||{});this.G=_.N.qa({disableCustomPlayback:!1},a);this.L=
3
- c;this.M=d;this.j=b;this.J=new _.Cu;this.g=new _.K("clpp.ima");this.h=this.a=null;this.f=new _.mk;this.K=!1;this.H=new _.Wh;this.P=new CT;this.o=null;this.C=this.A=this.B=!1;this.I=this.w=null;c=this.H;d=google.ima.AdErrorEvent.Type.AD_ERROR;c.one(this.j,google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.zm.bind(this));c.on(this.j,d,this.ym.bind(this));c.on(this.m,_.pe,this.Fm.bind(this))},FT=function(a){var b=a.a,c=a.H,d=google.ima.AdEvent.Type;c.on(b,d.AD_BREAK_READY,a.pm.bind(a));c.on(b,
4
- d.LOADED,a.qk.bind(a));c.on(b,d.CONTENT_PAUSE_REQUESTED,a.Gm.bind(a));c.on(b,d.STARTED,a.tk.bind(a));c.on(b,d.LOG,a.tm.bind(a));c.on(b,d.AD_PROGRESS,a.rk.bind(a));c.on(b,d.AD_BUFFERING,a.qm.bind(a));c.on(b,d.FIRST_QUARTILE,a.nk.bind(a));c.on(b,d.MIDPOINT,a.um.bind(a));c.on(b,d.THIRD_QUARTILE,a.uk.bind(a));c.on(b,d.PAUSED,a.wm.bind(a));c.on(b,d.RESUMED,a.xm.bind(a));c.on(b,d.CLICK,a.mk.bind(a));c.on(b,d.SKIPPED,a.sk.bind(a));c.on(b,d.IMPRESSION,a.pk.bind(a));c.on(b,d.COMPLETE,a.rm.bind(a));c.on(b,
5
- d.CONTENT_RESUME_REQUESTED,a.Hm.bind(a))},GT=function(a){a=a.G;var b=new google.ima.AdsRenderingSettings;b.restoreCustomPlaybackStateOnAdBreakComplete=!1;typeof a.bitrate===_.k&&(b.bitrate=a.bitrate);b.enablePreloading=typeof a.enablePreloading===_.hd?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===
6
- _.hd&&(b.useStyledLinearAds=a.useStyledLinearAds);b.uiElements=Array.isArray(a.uiElements)?a.uiElements:[];return b},IT=function(a){a.o=null;HT(a,_.Ic);a.m.getSurface().hide(a.L)},JT=function(a){_.Kq(a.l,{visibility:"visible"})},HT=function(a,b,c){c=c&&c.getAd();var d=null;c&&(d={ad:new BT(c,a.B,a.A)});a.m.trigger(new _.L(b,d))},KT=function(a,b){var c=b?a.P.create(b.getErrorCode()):null;a.m.onError(new _.O(1,9,10003,{errorType:c},b))},LT=function(a){return!1===a.G.disableCustomPlayback&&a.a.isCustomPlaybackUsed()&&
7
- _.vk()},NT=function(a){var b,c;return _.I(function(d){if(1==d.a)return a.M.initialize(),b=!!a.m.getConfiguration().muted,_.y(d,a.J.canPlay(b),2);c=d.f;if(!c&&!LT(a))return HT(a,_.fd),a.g.warn(_.la),d["return"]();MT(a);_.B(d)})},OT=function(a,b){return _.I(function(c){if(1==c.a)return a.M.initialize(),_.y(c,b.play(),2);MT(a);_.B(c)})},MT=function(a){a.a.init(a.l.offsetWidth,a.l.offsetHeight,google.ima.ViewMode.NORMAL);a.a.start();a.K=!0},PT=function(){this.a=this.h=this.f=null},QT=function(){return!window.google||
8
- !google.ima||!google.ima.AdsLoader},RT=function(){},ST=function(){this.jd=new _.K(AT)};_.u=BT.prototype;_.u.ob=function(){return"Google IMA SDK"};_.u.pb=function(){return google.ima.VERSION};_.u.sb=function(){return 0};_.u.getId=function(){return this.a.getAdId()};_.u.getCreativeId=function(){return this.a.getCreativeId()};_.u.Sb=function(){return""};_.u.getApiFramework=function(){return this.a.getApiFramework()};_.u.getAdSystem=function(){return this.a.getAdSystem()};_.u.getAdvertiserName=function(){return this.a.getAdvertiserName()};
9
- _.u.getTitle=function(){return this.a.getTitle()};_.u.getDuration=function(){return this.a.getDuration()};_.u.getPosition=function(){return 0};_.u.getSkipTimeOffset=function(){return this.a.getSkipTimeOffset()};_.u.Wb=function(){return this.f?this.f.getIsBumper():!1};_.u.qb=function(){var a=null,b=this.a,c=Object.keys(b).find(function(d){return typeof b[d]===_.Xe&&typeof b[d].clickThroughUrl===_.ig});c&&(a=b[c].clickThroughUrl);return a};_.u.getMediaUrl=function(){return this.a.getMediaUrl()};
10
- _.u.fb=function(){return this.a.getVastMediaWidth()};_.u.eb=function(){return this.a.getVastMediaHeight()};_.u.Qa=function(){return this.a.getVastMediaBitrate()};_.u.Ra=function(){return this.h?2:this.j?1:0};_.u.getPodIndex=function(){return this.f?this.f.getPodIndex():0};_.u.Fb=function(){return this.f?this.f.getTimeOffset():0};_.u.Gb=function(){return this.f?this.f.getAdPosition():1};_.u.gb=function(){return this.f?this.f.getTotalAds():1};_.u.getWrapperAdIds=function(){return this.a.getWrapperAdIds()};
11
- _.u.getWrapperAdSystems=function(){return this.a.getWrapperAdSystems()};_.u.getWrapperCreativeIds=function(){return this.a.getWrapperCreativeIds()};_.u.Vb=function(){return null};BT.prototype.getVideoElement=BT.prototype.Vb;BT.prototype.getWrapperCreativeIds=BT.prototype.getWrapperCreativeIds;BT.prototype.getWrapperAdSystems=BT.prototype.getWrapperAdSystems;BT.prototype.getWrapperAdIds=BT.prototype.getWrapperAdIds;BT.prototype.getSequenceLength=BT.prototype.gb;BT.prototype.getPositionInSequence=BT.prototype.Gb;
12
- BT.prototype.getPodTimeOffset=BT.prototype.Fb;BT.prototype.getPodIndex=BT.prototype.getPodIndex;BT.prototype.getPodType=BT.prototype.Ra;BT.prototype.getMediaBitrate=BT.prototype.Qa;BT.prototype.getMediaHeight=BT.prototype.eb;BT.prototype.getMediaWidth=BT.prototype.fb;BT.prototype.getMediaUrl=BT.prototype.getMediaUrl;BT.prototype.getClickThroughUrl=BT.prototype.qb;BT.prototype.isBumper=BT.prototype.Wb;BT.prototype.getSkipTimeOffset=BT.prototype.getSkipTimeOffset;BT.prototype.getPosition=BT.prototype.getPosition;
13
- BT.prototype.getDuration=BT.prototype.getDuration;BT.prototype.getTitle=BT.prototype.getTitle;BT.prototype.getAdvertiserName=BT.prototype.getAdvertiserName;BT.prototype.getAdSystem=BT.prototype.getAdSystem;BT.prototype.getApiFramework=BT.prototype.getApiFramework;BT.prototype.getSourceId=BT.prototype.Sb;BT.prototype.getCreativeId=BT.prototype.getCreativeId;BT.prototype.getId=BT.prototype.getId;BT.prototype.getTechnology=BT.prototype.sb;BT.prototype.getAdManagerVersion=BT.prototype.pb;
14
- BT.prototype.getAdManagerName=BT.prototype.ob;CT.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}};DT.prototype.getCuePoints=function(){return this.a};DT.prototype.Ib=function(){return 0<=this.a.indexOf(0)||0===this.a.length};DT.prototype.Hb=function(){return 0<=this.a.indexOf(-1)};DT.prototype.hasPostroll=DT.prototype.Hb;DT.prototype.hasPreroll=DT.prototype.Ib;DT.prototype.getCuePoints=DT.prototype.getCuePoints;_.u=ET.prototype;
15
- _.u.zm=function(a){var b=this;this.a=a.getAdsManager(this.l,GT(this));this.a.isCustomPlaybackUsed()&&!LT(this)?(this.g.warn("IMA plugin is disabled for this platform with single video element. Disposing."),this.m.onError(new _.O(1,9,10002)),this.sc()):(this.h=new _.Au(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 DT(a),this.m.trigger(new _.L(_.Lc,{adsTimeline:this.w})),FT(this));this.f.resolve()};
16
- _.u.ym=function(a){KT(this,a.getError());this.f.resolve()};_.u.Gm=function(a){var b=this;return _.I(function(c){switch(c.a){case 1:return b.C=!0,LT(b)?(b.I=b.m.getPosition(),_.y(c,b.m.detach(),5)):_.y(c,b.m.pause(),4);case 4:_.Kq(b.l,{visibility:_.we});c.F(3);break;case 5:var d=b.m;d.a&&d.a.stopForwardingEventsTo(d);case 3:HT(b,_.rc,a),b.h.start(),_.B(c)}})};_.u.pm=function(){var a=this;return _.I(function(b){a.a.start();_.B(b)})};
17
- _.u.qk=function(a){a.getAd().isLinear()?HT(this,_.Bc,a):(this.a.discardAdBreak(),this.B||(this.B=!0,this.m.play()))};_.u.tk=function(a){this.o=a.getAd().getDuration();HT(this,_.Hc,a);this.m.getSurface().show(this.L)};_.u.tm=function(a){a=a.getAdData();KT(this,a?a.adError:null);IT(this)};_.u.rk=function(a){HT(this,_.Ec,a)};_.u.qm=function(a){HT(this,_.tc,a)};_.u.nk=function(a){HT(this,_.wc,a)};_.u.um=function(a){HT(this,_.Cc,a)};_.u.uk=function(a){HT(this,_.Jc,a)};_.u.wm=function(a){HT(this,_.Dc,a)};
18
- _.u.xm=function(a){HT(this,_.Fc,a)};_.u.mk=function(a){this.pause();HT(this,_.uc,a)};_.u.sk=function(a){HT(this,_.Gc,a);IT(this)};_.u.pk=function(a){HT(this,_.Ac,a)};_.u.rm=function(a){HT(this,_.vc,a);IT(this)};
19
- _.u.Hm=function(){var a=this;return _.I(function(b){switch(b.a){case 1:a.B=!0;if(!LT(a)||null===a.I){if(!a.C)return b["return"](a.m.play());JT(a);b.F(2);break}var c=a.m;c.a&&c.a.forwardEventsTo(c);return _.y(b,_.ct(a.m),3);case 3:if(a.A){b.F(2);break}return _.y(b,a.m.seek(a.I),2);case 2:a.C=!1;a.h&&a.h.stop();if(a.A){b.F(6);break}return _.y(b,a.m.play(),6);case 6:HT(a,_.sc),_.B(b)}})};_.u.Fm=function(){this.A=!0;this.j.contentComplete()};
20
- _.u.load=function(){var a=this,b,c,d,e,f;return _.I(function(g){if(1==g.a){b=a.m;c=a.G;try{if(typeof c.adTagUrl!==_.ig)throw new _.O(1,9,10001,{missingKeys:"adTagUrl"});}catch(h){return b.onError(h),a.f.resolve(),g["return"](a.f)}return c.adTagUrl?_.y(g,a.J.canPlay(!1),2):(a.f.resolve(),g["return"](a.f))}if(3!=g.a)return d=g.f,_.y(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);
21
- return g["return"](a.f)})};_.u.start=function(a){var b=this;return _.I(function(c){return b.a&&b.w&&!b.K?b.w.Ib()?_.y(c,NT(b),0):_.y(c,OT(b,a),0):_.y(c,a.play(),0)})};_.u.Vc=function(){};_.u.Sc=function(){return!0};_.u.resume=function(){this.a&&this.a.resume()};_.u.pause=function(){this.a&&this.a.pause()};_.u.skip=function(){this.a&&this.a.skip()};_.u.getVolume=function(){return this.a?this.a.getVolume():1};_.u.setVolume=function(a){this.a&&this.a.setVolume(a)};
22
- _.u.getPosition=function(){if(!this.a||null===this.o)return-1;var a=this.a.getRemainingTime();return 0>a?0:this.o-a};_.u.sc=function(){this.a&&(this.a.destroy(),this.a=null);JT(this);this.H.release();this.h&&(this.h.stop(),this.h=null);return Promise.resolve()};ET.prototype.getPosition=ET.prototype.getPosition;ET.prototype.setVolume=ET.prototype.setVolume;ET.prototype.getVolume=ET.prototype.getVolume;ET.prototype.skip=ET.prototype.skip;ET.prototype.pause=ET.prototype.pause;ET.prototype.resume=ET.prototype.resume;_.x(PT,_.Gv);_.u=PT.prototype;_.u.onPlayerCreated=function(a){if(QT())return a.onError(new _.O(1,9,1E4));this.f=_.Iq(_.Xd,{"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(_.ta);this.a.getSettings().setPlayerVersion(_.ha);this.a.getSettings().setAutoPlayAdBreaks(!0)};
23
- _.u.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)};_.u.xl=function(){return this.a};_.u.vl=function(){return this.h};_.u.cd=function(){return this.f};_.u.id=function(){return"ima"};_.J("clpp.ima.ImaPlugin",PT);PT.prototype.getAdContainer=PT.prototype.cd;PT.prototype.getAdDisplayContainer=PT.prototype.vl;PT.prototype.getAdsLoader=PT.prototype.xl;PT.Id="ima";
24
- PT.isSdkMissing=QT;RT.prototype.create=function(){return new PT};_.gt(new RT);ST.prototype.name=function(){return AT};ST.prototype.a=function(a,b){return a.namespace()===_.zd?!1:QT()?(this.jd.warn("IMA SDK is not loaded."),!1):!(!b||!b.ima)};ST.prototype.create=function(a){return new ET(a)};_.Cq(new ST);};
2
+ var f=function(window){var wU="clpp.ima.AdsManagerFactory",xU=function(a,b,c){this.a=a;this.f=a.getAdPodInfo();this.j=b;this.h=c},yU=function(){},zU=function(a){this.a=a},AU=function(a){var b=a.ge("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=_.N.nb(a.ima||{});this.G=_.N.ua({disableCustomPlayback:!1},a);this.L=
3
+ c;this.M=d;this.j=b;this.J=new _.$u;this.g=new _.K("clpp.ima");this.h=this.a=null;this.f=new _.Gk;this.K=!1;this.H=new _.vi;this.P=new yU;this.o=null;this.C=this.A=this.B=!1;this.I=this.w=null;c=this.H;d=google.ima.AdErrorEvent.Type.AD_ERROR;c.one(this.j,google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.cn.bind(this));c.on(this.j,d,this.bn.bind(this));c.on(this.m,_.ye,this.jn.bind(this))},BU=function(a){var b=a.a,c=a.H,d=google.ima.AdEvent.Type;c.on(b,d.AD_BREAK_READY,a.Tm.bind(a));c.on(b,
4
+ d.LOADED,a.Rk.bind(a));c.on(b,d.CONTENT_PAUSE_REQUESTED,a.kn.bind(a));c.on(b,d.STARTED,a.Uk.bind(a));c.on(b,d.LOG,a.Xm.bind(a));c.on(b,d.AD_PROGRESS,a.Sk.bind(a));c.on(b,d.AD_BUFFERING,a.Um.bind(a));c.on(b,d.FIRST_QUARTILE,a.Pk.bind(a));c.on(b,d.MIDPOINT,a.Ym.bind(a));c.on(b,d.THIRD_QUARTILE,a.Vk.bind(a));c.on(b,d.PAUSED,a.$m.bind(a));c.on(b,d.RESUMED,a.an.bind(a));c.on(b,d.CLICK,a.Ok.bind(a));c.on(b,d.SKIPPED,a.Tk.bind(a));c.on(b,d.IMPRESSION,a.Qk.bind(a));c.on(b,d.COMPLETE,a.Vm.bind(a));c.on(b,
5
+ d.CONTENT_RESUME_REQUESTED,a.ln.bind(a))},CU=function(a){a=a.G;var b=new google.ima.AdsRenderingSettings;b.restoreCustomPlaybackStateOnAdBreakComplete=!1;typeof a.bitrate===_.k&&(b.bitrate=a.bitrate);b.enablePreloading=typeof a.enablePreloading===_.md?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===
6
+ _.md&&(b.useStyledLinearAds=a.useStyledLinearAds);b.uiElements=Array.isArray(a.uiElements)?a.uiElements:[];return b},EU=function(a){a.o=null;DU(a,_.Nc);a.m.getSurface().hide(a.L)},FU=function(a){_.ur(a.l,{visibility:"visible"})},DU=function(a,b,c){c=c&&c.getAd();var d=null;c&&(d={ad:new xU(c,a.B,a.A)});a.m.trigger(new _.L(b,d))},GU=function(a,b){var c=b?a.P.create(b.getErrorCode()):null;a.m.onError(new _.O(1,9,10003,{errorType:c},b))},HU=function(a){return!1===a.G.disableCustomPlayback&&a.a.isCustomPlaybackUsed()&&
7
+ _.Mk()},JU=function(a){var b,c;return _.I(function(d){if(1==d.a)return a.M.initialize(),b=!!a.m.getConfiguration().muted,_.y(d,a.J.canPlay(b),2);c=d.f;if(!c&&!HU(a))return DU(a,_.kd),a.g.warn(_.oa),d["return"]();IU(a);_.B(d)})},KU=function(a,b){return _.I(function(c){if(1==c.a)return a.M.initialize(),_.y(c,b.play(),2);IU(a);_.B(c)})},IU=function(a){a.a.init(a.l.offsetWidth,a.l.offsetHeight,google.ima.ViewMode.NORMAL);a.a.start();a.K=!0},LU=function(){this.a=this.h=this.f=null},MU=function(){return!window.google||
8
+ !google.ima||!google.ima.AdsLoader},NU=function(){},OU=function(){this.Ca=new _.K(wU)};_.t=xU.prototype;_.t.yb=function(){return"Google IMA SDK"};_.t.zb=function(){return google.ima.VERSION};_.t.Db=function(){return 0};_.t.getId=function(){return this.a.getAdId()};_.t.getCreativeId=function(){return this.a.getCreativeId()};_.t.cc=function(){return""};_.t.getApiFramework=function(){return this.a.getApiFramework()};_.t.getAdSystem=function(){return this.a.getAdSystem()};_.t.getAdvertiserName=function(){return this.a.getAdvertiserName()};
9
+ _.t.getTitle=function(){return this.a.getTitle()};_.t.getDuration=function(){return this.a.getDuration()};_.t.getPosition=function(){return 0};_.t.getSkipTimeOffset=function(){return this.a.getSkipTimeOffset()};_.t.gc=function(){return this.f?this.f.getIsBumper():!1};_.t.Ab=function(){var a=null,b=this.a,c=Object.keys(b).find(function(d){return typeof b[d]===_.ff&&typeof b[d].clickThroughUrl===_.tg});c&&(a=b[c].clickThroughUrl);return a};_.t.getMediaUrl=function(){return this.a.getMediaUrl()};
10
+ _.t.qb=function(){return this.a.getVastMediaWidth()};_.t.pb=function(){return this.a.getVastMediaHeight()};_.t.Xa=function(){return this.a.getVastMediaBitrate()};_.t.Ya=function(){return this.h?2:this.j?1:0};_.t.getPodIndex=function(){return this.f?this.f.getPodIndex():0};_.t.Pb=function(){return this.f?this.f.getTimeOffset():0};_.t.Cb=function(){return this.f?this.f.getAdPosition():1};_.t.rb=function(){return this.f?this.f.getTotalAds():1};_.t.getWrapperAdIds=function(){return this.a.getWrapperAdIds()};
11
+ _.t.canSeek=function(){return!1};_.t.getWrapperAdSystems=function(){return this.a.getWrapperAdSystems()};_.t.getWrapperCreativeIds=function(){return this.a.getWrapperCreativeIds()};_.t.fc=function(){return null};xU.prototype.getVideoElement=xU.prototype.fc;xU.prototype.getWrapperCreativeIds=xU.prototype.getWrapperCreativeIds;xU.prototype.getWrapperAdSystems=xU.prototype.getWrapperAdSystems;xU.prototype.canSeek=xU.prototype.canSeek;xU.prototype.getWrapperAdIds=xU.prototype.getWrapperAdIds;
12
+ xU.prototype.getSequenceLength=xU.prototype.rb;xU.prototype.getPositionInSequence=xU.prototype.Cb;xU.prototype.getPodTimeOffset=xU.prototype.Pb;xU.prototype.getPodIndex=xU.prototype.getPodIndex;xU.prototype.getPodType=xU.prototype.Ya;xU.prototype.getMediaBitrate=xU.prototype.Xa;xU.prototype.getMediaHeight=xU.prototype.pb;xU.prototype.getMediaWidth=xU.prototype.qb;xU.prototype.getMediaUrl=xU.prototype.getMediaUrl;xU.prototype.getClickThroughUrl=xU.prototype.Ab;xU.prototype.isBumper=xU.prototype.gc;
13
+ xU.prototype.getSkipTimeOffset=xU.prototype.getSkipTimeOffset;xU.prototype.getPosition=xU.prototype.getPosition;xU.prototype.getDuration=xU.prototype.getDuration;xU.prototype.getTitle=xU.prototype.getTitle;xU.prototype.getAdvertiserName=xU.prototype.getAdvertiserName;xU.prototype.getAdSystem=xU.prototype.getAdSystem;xU.prototype.getApiFramework=xU.prototype.getApiFramework;xU.prototype.getSourceId=xU.prototype.cc;xU.prototype.getCreativeId=xU.prototype.getCreativeId;xU.prototype.getId=xU.prototype.getId;
14
+ xU.prototype.getTechnology=xU.prototype.Db;xU.prototype.getAdManagerVersion=xU.prototype.zb;xU.prototype.getAdManagerName=xU.prototype.yb;yU.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}};zU.prototype.getCuePoints=function(){return this.a};zU.prototype.Sb=function(){return 0<=this.a.indexOf(0)||0===this.a.length};zU.prototype.Rb=function(){return 0<=this.a.indexOf(-1)};zU.prototype.hasPostroll=zU.prototype.Rb;zU.prototype.hasPreroll=zU.prototype.Sb;zU.prototype.getCuePoints=zU.prototype.getCuePoints;_.t=AU.prototype;
15
+ _.t.cn=function(a){var b=this;this.a=a.getAdsManager(this.l,CU(this));this.a.isCustomPlaybackUsed()&&!HU(this)?(this.g.warn("IMA plugin is disabled for this platform with single video element. Disposing."),this.m.onError(new _.O(1,9,10002)),this.Dc()):(this.h=new _.Yu(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 zU(a),this.m.trigger(new _.L(_.Qc,{adsTimeline:this.w})),BU(this));this.f.resolve()};
16
+ _.t.bn=function(a){GU(this,a.getError());this.f.resolve()};_.t.kn=function(a){var b=this;return _.I(function(c){switch(c.a){case 1:return b.C=!0,HU(b)?(b.I=b.m.getPosition(),_.y(c,b.m.detach(),5)):_.y(c,b.m.pause(),4);case 4:_.ur(b.l,{visibility:_.Fe});c.F(3);break;case 5:var d=b.m;d.a&&d.a.stopForwardingEventsTo(d);case 3:DU(b,_.wc,a),b.h.start(),_.B(c)}})};_.t.Tm=function(){var a=this;return _.I(function(b){a.a.start();_.B(b)})};
17
+ _.t.Rk=function(a){a.getAd().isLinear()?DU(this,_.Gc,a):(this.a.discardAdBreak(),this.B||(this.B=!0,this.m.play()))};_.t.Uk=function(a){this.o=a.getAd().getDuration();DU(this,_.Mc,a);this.m.getSurface().show(this.L)};_.t.Xm=function(a){a=a.getAdData();GU(this,a?a.adError:null);EU(this)};_.t.Sk=function(a){DU(this,_.Jc,a)};_.t.Um=function(a){DU(this,_.yc,a)};_.t.Pk=function(a){DU(this,_.Bc,a)};_.t.Ym=function(a){DU(this,_.Hc,a)};_.t.Vk=function(a){DU(this,_.Oc,a)};_.t.$m=function(a){DU(this,_.Ic,a)};
18
+ _.t.an=function(a){DU(this,_.Kc,a)};_.t.Ok=function(a){this.pause();DU(this,_.zc,a)};_.t.Tk=function(a){DU(this,_.Lc,a);EU(this)};_.t.Qk=function(a){DU(this,_.Fc,a)};_.t.Vm=function(a){DU(this,_.Ac,a);EU(this)};
19
+ _.t.ln=function(){var a=this;return _.I(function(b){switch(b.a){case 1:a.B=!0;if(!HU(a)||null===a.I){if(!a.C)return b["return"](a.m.play());FU(a);b.F(2);break}var c=a.m;c.a&&c.a.forwardEventsTo(c);return _.y(b,_.Yt(a.m),3);case 3:if(a.A){b.F(2);break}return _.y(b,a.m.seek(a.I),2);case 2:a.C=!1;a.h&&a.h.stop();if(a.A){b.F(6);break}return _.y(b,a.m.play(),6);case 6:DU(a,_.xc),_.B(b)}})};_.t.jn=function(){this.A=!0;this.j.contentComplete()};
20
+ _.t.load=function(){var a=this,b,c,d,e,f;return _.I(function(g){if(1==g.a){b=a.m;c=a.G;try{if(typeof c.adTagUrl!==_.tg)throw new _.O(1,9,10001,{missingKeys:"adTagUrl"});}catch(h){return b.onError(h),a.f.resolve(),g["return"](a.f)}return c.adTagUrl?_.y(g,a.J.canPlay(!1),2):(a.f.resolve(),g["return"](a.f))}if(3!=g.a)return d=g.f,_.y(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);
21
+ return g["return"](a.f)})};_.t.start=function(a){var b=this;return _.I(function(c){return b.a&&b.w&&!b.K?b.w.Sb()?_.y(c,JU(b),0):_.y(c,KU(b,a),0):_.y(c,a.play(),0)})};_.t.kd=function(){};_.t.gd=function(){return!0};_.t.resume=function(){this.a&&this.a.resume()};_.t.pause=function(){this.a&&this.a.pause()};_.t.skip=function(){this.a&&this.a.skip()};_.t.getVolume=function(){return this.a?this.a.getVolume():1};_.t.setVolume=function(a){this.a&&this.a.setVolume(a)};
22
+ _.t.getPosition=function(){if(!this.a||null===this.o)return-1;var a=this.a.getRemainingTime();return 0>a?0:this.o-a};_.t.Dc=function(){this.a&&(this.a.destroy(),this.a=null);FU(this);this.H.release();this.h&&(this.h.stop(),this.h=null);return Promise.resolve()};AU.prototype.getPosition=AU.prototype.getPosition;AU.prototype.setVolume=AU.prototype.setVolume;AU.prototype.getVolume=AU.prototype.getVolume;AU.prototype.skip=AU.prototype.skip;AU.prototype.pause=AU.prototype.pause;AU.prototype.resume=AU.prototype.resume;_.x(LU,_.ew);_.t=LU.prototype;_.t.onPlayerCreated=function(a){if(MU())return a.onError(new _.O(1,9,1E4));this.f=_.sr(_.fe,{"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(_.wa);this.a.getSettings().setPlayerVersion(_.ia);this.a.getSettings().setAutoPlayAdBreaks(!0)};
23
+ _.t.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)};_.t.Zl=function(){return this.a};_.t.Xl=function(){return this.h};_.t.td=function(){return this.f};_.t.id=function(){return"ima"};_.J("clpp.ima.ImaPlugin",LU);LU.prototype.getAdContainer=LU.prototype.td;LU.prototype.getAdDisplayContainer=LU.prototype.Xl;LU.prototype.getAdsLoader=LU.prototype.Zl;LU.Id="ima";
24
+ LU.isSdkMissing=MU;NU.prototype.create=function(){return new LU};_.bu(new NU);OU.prototype.name=function(){return wU};OU.prototype.a=function(a,b){return a.namespace()===_.Fd?!1:MU()?(this.Ca.warn("IMA SDK is not loaded."),!1):!(!b||!b.ima)};OU.prototype.create=function(a){return new AU(a)};_.mr(new OU);};
25
25
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
26
26
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
27
27
  else{_=this.clpp._;(f.call(g,this));}