@castlabs/prestoplay 6.33.0 → 6.34.0-beta.1

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 +16 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +19 -19
  5. package/cjs/cl.cast.js +129 -129
  6. package/cjs/cl.conviva.js +32 -32
  7. package/cjs/cl.core.js +633 -624
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +101 -101
  10. package/cjs/cl.externs.js +48 -72
  11. package/cjs/cl.freewheel.js +26 -26
  12. package/cjs/cl.hls.js +76 -76
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +30 -30
  15. package/cjs/cl.ima.js +26 -26
  16. package/cjs/cl.mediatailor.js +3 -3
  17. package/cjs/cl.mse.js +357 -353
  18. package/cjs/cl.muxdata.js +14 -14
  19. package/cjs/cl.onboard.js +4 -5
  20. package/cjs/cl.persistent.js +14 -14
  21. package/cjs/cl.playlist.js +6 -6
  22. package/cjs/cl.simid.js +16 -16
  23. package/cjs/cl.smooth.js +71 -71
  24. package/cjs/cl.thumbnails.js +26 -26
  25. package/cjs/cl.tizen.js +73 -73
  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 +36 -36
  33. package/cl.adobe.js +3 -3
  34. package/cl.airplay.js +3 -3
  35. package/cl.broadpeak.js +14 -14
  36. package/cl.cast.js +100 -100
  37. package/cl.conviva.js +27 -27
  38. package/cl.core.js +510 -502
  39. package/cl.crypto.js +9 -9
  40. package/cl.dash.js +90 -90
  41. package/cl.externs.js +51 -63
  42. package/cl.freewheel.js +20 -20
  43. package/cl.hls.js +82 -82
  44. package/cl.hlssmpte.js +5 -5
  45. package/cl.htmlcue.js +26 -26
  46. package/cl.ima.js +20 -20
  47. package/cl.mediatailor.js +2 -2
  48. package/cl.mse.js +308 -306
  49. package/cl.muxdata.js +13 -13
  50. package/cl.onboard.js +5 -5
  51. package/cl.persistent.js +10 -10
  52. package/cl.playlist.js +5 -5
  53. package/cl.simid.js +14 -14
  54. package/cl.smooth.js +61 -61
  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 +31 -31
  64. package/package.json +1 -1
  65. package/typings.d.ts +33 -46
package/cl.htmlcue.js CHANGED
@@ -1,26 +1,26 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var GS="Unsupported unit",HS="clpp-text-plain",IS="clpp-text-ttml",JS="clpp.htmlcue.HtmlTextDisplayer",KS="initial",LS=function(a,b){let c=0,d=a.length-1;for(;c<=d;){const e=c+d>>1,f=b(a[e]);if(0===f)return e;0<f?c=e+1:d=e-1}return-1},MS=function(a){return _.Yh(a,{fg:(b,c)=>b.Zc(c)})},NS=function(a,b){if(0===b.length)return a;let c=a;a=a.findIndex(d=>d.startTime>=b[0].startTime);0<=a&&(c=c.slice(0,a));return c.concat(b)},OS=function(a){if(!a.input)return null;var b=a.input.match(/^([^<]*)(<[^>]+>?)?/);
2
- b=b[1]?b[1]:b[2];a.input=a.input.substr(b.length);return b},QS=function(a){let b=null;for(;b=a.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)a=a.replace(b[0],c=>PS[c]);return a},SS=function(a,b){RS(a,b);Array.from(b.getElementsByTagName("*")).forEach(c=>{RS(a,c)})},RS=function(a,b){for(const c in a)null!=a[c]&&(b.style[c]=a[c])},TS=function(a,b){return 0===a?"0":a+b},US=function(a,b){return 1>Math.abs(a-b)||a<b},VS=function(a,b){return a<b&&1<Math.abs(a-b)},WS=function(a,b){return a>b&&1<Math.abs(a-b)},XS=
3
- function(a,b){return 1>Math.abs(a-b)||a>b},ZS=function(a){const b=a.getBoundingClientRect();var c=getComputedStyle(a,null);const d=parseFloat(c.getPropertyValue("border-left-width"))||0,e=parseFloat(c.getPropertyValue("border-right-width"))||0;var f=parseFloat(c.getPropertyValue("border-top-width"))||0;c=parseFloat(c.getPropertyValue("border-bottom-width"))||0;const g=(b.top||a.offsetTop)+f;f=(b.height||a.offsetHeight)-f-c;return new YS(b.left+d,b.right+e,g,(b.bottom||g+f)+c,f,(b.width||a.offsetWidth)-
4
- d-e)},$S=function(a){return new YS(a.left,a.f,a.top,a.a,a.height,a.width)},aT=function(a,b){return b.some(c=>VS(a.left,c.f)&&WS(a.f,c.left)&&VS(a.top,c.a)&&WS(a.a,c.top))},bT=function(a,b){return XS(a.top,b.top)&&US(a.a,b.a)&&XS(a.left,b.left)&&US(a.f,b.f)},cT=function(a,b,c){switch(c){case "+x":return VS(a.left,b.left);case "-x":return WS(a.f,b.f);case "+y":return VS(a.top,b.top);case "-y":return WS(a.a,b.a);default:throw Error("Unknown axis");}},dT=function(a){return a.f.writingMode===_.ku},eT=
5
- function(a){var b=a.a.childNodes[0],c=a.a.getBoundingClientRect();const d=b.getClientRects();b=c.height/d.length;c=c.width/d.length;return dT(a)?b:c},fT=function(a){switch(a.f.writingMode){case _.ku:return"horizontal-tb";case _.pg:return _.pg;case _.qg:return _.qg;default:throw Error("Unknown writing mode");}},gT=function(a){switch(a.f.positionAlign){case _.ie:return _.fe;case "auto":case _.Uc:return _.ju;case _.je:return _.xf}return a.f.textAlign},hT=function(a,b){if(typeof a.f.position===_.r&&typeof a.f.size===
6
- _.r)switch(b){case _.ie:return a.f.position;case "auto":case _.Uc:return a.f.position-a.f.size/2;case _.je:return a.f.position-a.f.size}return 0},iT=function(a){if(!a.f.positionAlign)switch(a.f.textAlign){case _.Lf:case _.fe:return _.ie;case _.ju:return _.Uc;case _.Rd:case _.xf:return _.je}return a.f.positionAlign},lT=function(a,b,c){return(jT(a)||kT(a))&&_.gh(c)?TS(c,_.qf):jT(a)&&_.z(c)?TS(0,_.qf):dT(a)&&_.gh(b)?TS(b,"%"):KS},mT=function(a,b,c){return dT(a)&&_.gh(c)?TS(c,_.qf):(jT(a)||kT(a))&&_.gh(b)?
7
- TS(b,"%"):KS},kT=function(a){return a.f.writingMode===_.qg},jT=function(a){return a.f.writingMode===_.pg},nT=function(a,b){if(a.j)switch(b.writingMode){case _.ku:return["-y"];case _.pg:return["+x"];case _.qg:return["-x"]}a=[];switch(b.writingMode){case _.ku:a=["+y","-y"];break;case _.pg:a=["+x","-x"];break;case _.qg:a=["-x","+x"]}0>b.line&&(a=a.reverse());return a},oT=function(a){for(a.h=[];0<a.f.childNodes.length;)a.f.removeChild(a.f.childNodes[0]);a.a=ZS(a.l.a)},pT=function(a,b,c){a=a.f;const d=
8
- a.viewportAnchorUnits;if(d===_.ru)return a.viewportAnchorY/100*c-a.regionAnchorY/100*b;if(0===d)return a.viewportAnchorY-a.regionAnchorY;throw Error(GS);},rT=function(a,b,c,d){const e=document.createElement(_.Rf),f=e.dataset;f.name=b;f.for=c;d&&(f.name=`${b} (sandbox)`,f.sandbox=!0);c=document.head;c.appendChild(e);qT(a,c,b);a.g.debug(`Created HTML style element #${b}.`);return e.sheet},sT=function(a,b){a=`.${a.j} .clpp-text-container`;const c=`${a} .clpp-text-cue`;return b=b.replace(/::cue\((#[^)]+)\)/g,
9
- `${a} $1`).replace(/::cue\(([^)]+)\)/g,`${c} $1`).replace(/::cue-region\(([^)]+)\)/g,`${a} $1 .clpp-text-cue`).replace(/::cue/g,c).replace(/::cue-region/g,`${a} .clpp-text-cue-region .clpp-text-cue`).replace(/::ttml/g,a)},tT=function(a,b){let c=!1;try{a.f.insertRule(b,0);const d=a.f.cssRules[0];d instanceof CSSStyleRule&&(c=d.selectorText.split(",").every(e=>0===e.trim().indexOf(`.${a.j} `)))}catch(d){}0<a.f.cssRules.length&&a.f.deleteRule(0);return c},uT=function(a){if(null!=a.a){for(;0<a.a.cssRules.length;)a.a.deleteRule(0);
10
- a.o=[]}},qT=function(a,b,c){const d=new MutationObserver(e=>{e.forEach(f=>{f.removedNodes.forEach(g=>{g.id===c&&a.g.error(`PRESTOplay HTML style element #${c} has `+"been unexpectedly removed! Some styles will not work!")})})});d.observe(b,{subtree:!1,childList:!0});a.l.push(()=>d.disconnect())},vT=function(a){a=_.$g(a.htmlcue||{});_.z(a.stretchSmpteImage)&&(a.stretchSmpteImage=!1);_.z(a.enableResizeObserver)&&(a.enableResizeObserver=!0);return a},BT=function(a,b){if((b||a.l)&&a.F){var c=a.m.getPosition();
11
- if(b||a.J!==c&&3===a.m.getState())if(a.J=c,c=wT(a,c),b||(b=a.o,b=!(null===b&&null===c||null!==b&&null!==c&&b.start===c.start&&b.end===c.end)),b&&(a.o=c,xT(a),c)){b={color:a.getFontColor()||void 0,backgroundColor:a.getBackgroundColor()||void 0,fontFamily:a.getFontFamily()||void 0,textShadow:_.yt(a)||void 0};c=a.f.slice(c.start,c.end+1);for(const k of c){c=a;var d=k,e=b,f=c.a.a,g=null;switch(d.payloadType){case _.Ag:g="clpp-text-vtt";break;case _.eg:g=IS;break;case _.iu:g=HS}g&&!f.classList.contains(g)&&
12
- _.yi(f,g);f=ZS(c.a.a);if(0===f.width||0===f.height)c.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.");else{RS({fontSize:yT(c,d.containerRows)},c.a.a);f=null;g=d.payloadType===_.Ag;var h=d.payloadType===_.eg;d.region&&(g||h||d.backgroundImage)&&(c.B.has(d.region.id)?f=c.B.get(d.region.id):(f=new zT(d.region,{}),c.B.set(d.region.id,f),c.a.appendChild(f)));d=new AT(d,c.L,e);f?f.appendChild(d):
13
- c.a.appendChild(d)}}}}},CT=function(a){xT(a);a.J=null;a.o=null;a.f=[]},DT=function(a,b){return a.startTime<=b&&a.endTime>b},wT=function(a,b){var c=LS(a.f,d=>DT(d,b)?0:b!==d.startTime?b-d.startTime:b-d.endTime);if(-1===c)return null;{let d=c;for(;0<=d-1&&DT(a.f[d-1],b);)d--;for(;c+1<a.f.length&&DT(a.f[c+1],b);)c++;return{start:d,end:c}}},xT=function(a){a.B.clear();if(a.a){const b=a.a.a;b.classList.remove("clpp-text-vtt");b.classList.remove(IS);b.classList.remove(HS);a=a.a;oT(a.h);a.l=[]}},yT=function(a,
14
- b){const c=ZS(a.a.a).height;if(null!==a.I)return a.getFontSize();if(null!==a.C)return a=a.getFontSizePercent(),`${Math.round(c*a)}px`;if(typeof b===_.r&&0<b)return`${Math.round(c/b)}px`;a=a.getFontSizePercent();return`${Math.round(c*a)}px`},HT=class{parse(a){a={input:a};const b=_.Ai(_.Bd),c=[];let d=b;for(var e;null!==(e=OS(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=
15
- e[1];var g=e[3];var h=ET[f];h?(h=_.Ai(h),(f=FT[f])&&g&&h.setAttribute(f,g.trim()),g=h):g=null;!g||GT[g.localName]&&GT[g.localName]!==d.localName||(e[2]&&(g.className=e[2].substr(1).replace(/\./g," ")),c.push(e[1]),d.appendChild(g),d=g)}}else d.appendChild(document.createTextNode(QS(e)));return b}},ET={c:"c",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"v",lang:"lang"},FT={v:"voice",lang:"lang"},GT={rt:"ruby"},PS={"\x26amp;":"\x26","\x26lt;":"\x3c","\x26gt;":"\x3e","\x26lrm;":"\u200e","\x26rlm;":"\u200f",
16
- "\x26nbsp;":"\u00a0"};var YS=class{constructor(a,b,c,d,e,f){this.left=a;this.f=b;this.top=c;this.a=d;this.height=e;this.width=f}};var IT=class{constructor(a,b,c){this.id=a;this.w=b;this.B=c;this.a=this.o();this.j=!1}init(){this.j=!0}A(){return!1}};var AT=class extends IT{constructor(a,b,c){super(a.id,"clpp-text-cue",{});this.l=b;this.f=a;this.h=!!this.f.backgroundImage;this.C=c}A(){return!this.h&&!(this.f.region&&this.f.region.displayAlign)}init(a){super.init(a);if(this.h)_.yi(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===_.eg){var c=_.Ai(_.Bd);c.innerHTML=b.payload;b=c}else b.payloadType===
17
- _.Ag?b=(new HT).parse(b.payload):(c=_.Ai(_.Bd),c.textContent=b.payload,b=c);_.yi(b,this.w);this.id&&(b.id=this.id);for(d of this.f.cssClassList)_.yi(b,d);RS({writingMode:fT(this)},b);var d=b;this.a.appendChild(d);_.yi(this.a,"clpp-text-wrapper");for(var e of this.f.cssClassList)_.yi(this.a,`clpp-text-wrapper__${e}`);_.z(this.f.line)&&(this.f.lineInterpretation=_.lu,this.f.line=dT(this)?-1:0);e=fT(this);RS({writingMode:e,webkitWritingMode:e,direction:KS,textAlign:gT(this)},this.a);if(!this.f.region||
18
- !this.f.region.displayAlign){e=hT(this,iT(this));RS({position:"absolute",left:lT(this,e,null),right:kT(this)&&_.z(null)?TS(0,_.qf):KS,top:mT(this,e,null),width:dT(this)?TS(this.f.size,"%"):KS,height:jT(this)||kT(this)?TS(this.f.size,"%"):KS},this.a);b=this.f;a=dT(this)?a.height:a.width;c=eT(this);if(b.lineInterpretation===_.lu){var f=c*Math.round(b.line);Math.abs(f)>a&&(f=c*(0>b.line?0:-1));0>f&&(f+=a)}else{f=c/a*100;let g=b.line;switch(b.lineAlign){case _.Uc:g-=f/2;break;case _.Rd:g-=f}f=Math.round(g/
19
- 100*a)}kT(this)&&(f=a-f-c);a=f;RS({left:lT(this,e,a),right:kT(this)&&_.z(a)?TS(0,_.qf):KS,top:mT(this,e,a)},this.a)}SS(this.C,d)}}o(){return _.Ai(_.Bd)}};var JT=class{constructor(a,b){this.l=a;this.f=a.a;this.j=void 0===b?!1:b;this.a=ZS(a.a);this.h=[]}append(a){const b=a.a;b.style.visibility=_.Zd;this.f.appendChild(b);a.j||a.init(this.a);if(a.A()){a:{var c=ZS(a.a);var d=nT(this,a.f),e=eT(a);const g=$S(c);let h=null,k=0;for(const l of d){for(;cT(c,this.a,l)||bT(c,this.a)&&aT(c,this.h);){d=c;var f=e;switch(l){case "+x":d.left+=f;d.f+=f;break;case "-x":d.left-=f;d.f-=f;break;case "+y":d.top+=f;d.a+=f;break;case "-y":d.top-=f,d.a-=f}}if(this.j||bT(c,this.a))break a;
20
- d=this.a;d=Math.max(0,Math.min(c.f,d.f)-Math.max(c.left,d.left))*Math.max(0,Math.min(c.a,d.a)-Math.max(c.top,d.top))/(c.height*c.width);d>k&&(h=$S(c),k=d);c=$S(g)}c=h||g}RS({top:TS(c.top-this.a.top,_.qf),bottom:TS(this.a.a-c.a,_.qf),left:TS(c.left-this.a.left,_.qf),right:TS(this.a.f-c.f,_.qf),height:TS(c.height,_.qf),width:TS(c.width,_.qf)},a.a)}b.style.visibility="visible";this.h.push(ZS(a.a))}};var KT=class extends IT{constructor(a,b,c){super(a,b,c);this.h=null;this.l=[]}init(){this.h=new JT(this);this.j=!0}o(){const a=_.Ai(_.Bd);_.yi(a,this.w);this.id&&(a.id=this.id);return a}appendChild(a){oT(this.h);this.l.unshift(a);for(const b of this.l)this.h.append(b)}};var zT=class extends KT{constructor(a,b){super(a.id,"clpp-text-cue-region",b);this.f=a}init(a){a:{var b=this.f;switch(b.widthUnits){case 0:b=b.width;break a;case _.ru:b=b.width/100*a.width;break a;default:throw Error(GS);}}var c=this.f;var d=c.viewportAnchorUnits;if(d===_.ru)c=c.viewportAnchorX/100*a.width-c.regionAnchorX/100*b;else if(0===d)c=c.viewportAnchorX-c.regionAnchorX;else throw Error(GS);d=a.height;const e=pT(this,d,a.height);RS(this.B,this.a);RS({left:TS(c,_.qf),top:TS(e,_.qf),width:TS(b,
21
- _.qf),height:TS(d,_.qf)},this.a);this.f.writingMode&&RS({display:"flex","flex-direction":this.f.writingMode},this.a);this.f.displayAlign&&RS({"justify-content":this.f.displayAlign},this.a);for(var f of this.f.cssClassList)_.yi(this.a,f);a:switch(f=this.f,f.heightUnits){case 0:f=f.height;break a;case _.ru:f=f.height/100*a.height;break a;case 2:f=f.height;c=new AT(new _.ou(0,1,"Lorem ipsum",_.iu),{},{});b=c.a;this.a.appendChild(b);c.init(ZS(this.a));c=b.getBoundingClientRect().height;this.a.removeChild(b);
22
- b=c;f*=b;break a;default:throw Error(GS);}a=pT(this,f,a.height);RS({top:TS(a,_.qf),height:TS(f,_.qf)},this.a);this.h=new JT(this,!0);this.j=!0}getId(){return this.f.id}};var LT=class{constructor(a,b){this.g=new _.T("clpp.htmlcue.StyleManager");this.l=[];this.j=a;this.h=b;this.o=[];this.a=rT(this,this.h,this.j);this.f=rT(this,this.h,this.j,!0);this.f.disabled=!0;this.g.debug(`Stylesheet ${this.h} has been created.`)}appendRule(a){if(null!=this.a&&!this.o.some(b=>b===a)){const b=sT(this,a);if(tT(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.o.push(a)}else this.g.warn(`Stylesheet ${this.h} ignoring the CSS rule `+
23
- `because it's not safe: ${b}`)}}destroy(){const a=this;return _.v(function*(){null!=a.a&&(a.l.forEach(b=>b()),a.l=[],uT(a),document.head.removeChild(a.a.ownerNode),document.head.removeChild(a.f.ownerNode),a.a=null,a.f=null,a.g.debug(`Stylesheet ${a.h} has been destroyed.`))})}};var MT=class extends _.Ev{constructor(a){super(a);this.g=new _.T(JS);this.m=a;this.L=vT(a.getConfiguration());this.l=!1;this.f=[];this.F=a.getSurface().getContainer();this.j=new LT(a.getSurface().getUniqueCssClass(),"CLPP Subtitle Styles");this.a=new KT(null,"clpp-text-container",{});this.A=new _.Av(a.getSurface(),this.S.bind(this));this.J=null;this.F?(this.F.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.");
24
- this.G=new _.Hi(()=>{BT(this)});this.B=new Map;this.o=null}append(a,b){if(null!=this.j&&0!==a.length){for(const c of b)this.j.appendRule(c);a.sort((c,d)=>c.startTime!==d.startTime?c.startTime-d.startTime:c.endTime-d.endTime);this.f=NS(this.f,MS(a));this.o=null;BT(this,!1)}}h(){null==this.j||BT(this,!0)}destroy(){const a=this;return _.v(function*(){null!=a.j&&(CT(a),a.G.stop(),yield a.j.destroy(),a.j=null,a.F.removeChild(a.a.a),a.a=null,a.A.stop(),a.A=null,a.l=!1)})}remove(a,b){if(null==this.j)return!1;
25
- this.f=this.f.filter(c=>c.startTime<a||c.endTime>=b);this.o=null;BT(this,!0);return!0}isTextVisible(){return this.l}setTextVisibility(a){null!=this.j&&this.l!==a&&((this.l=a)?(this.G.Hb(.25),this.L.enableResizeObserver&&this.A.start(),BT(this,!0)):(this.G.stop(),this.A.stop(),CT(this)))}S(){BT(this,!0)}};_.w(JS,MT);MT.prototype.setTextVisibility=MT.prototype.setTextVisibility;MT.prototype.isTextVisible=MT.prototype.isTextVisible;MT.prototype.remove=MT.prototype.remove;MT.prototype.destroy=MT.prototype.destroy;
26
- MT.prototype.append=MT.prototype.append;var NT=class{a(a){return!!a.enableHtmlCue&&!_.Wi()}create(a){return new MT(a)}};_.w("clpp.htmlcue.HtmlCueComponent",class extends _.uv{install(){_.es(_.ae,new NT)}uninstall(){_.cs.has(_.ae)&&(_.cs.delete(_.ae),_.ds.info("Removed factory: 'html'"))}id(){return _.Sf}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var FS="Unsupported unit",GS="clpp-text-plain",HS="clpp-text-ttml",IS="clpp.htmlcue.HtmlTextDisplayer",JS="initial",KS=function(a){return _.oj(a,{dg:(b,c)=>b.Xc(c)})},LS=function(a,b){if(0===b.length)return a;let c=a;a=a.findIndex(d=>d.startTime>=b[0].startTime);0<=a&&(c=c.slice(0,a));return c.concat(b)},MS=function(a,b){let c=0,d=a.length-1;for(;c<=d;){const e=c+d>>1,f=b(a[e]);if(0===f)return e;0<f?c=e+1:d=e-1}return-1},NS=function(a){if(!a.input)return null;var b=a.input.match(/^([^<]*)(<[^>]+>?)?/);
2
+ b=b[1]?b[1]:b[2];a.input=a.input.substr(b.length);return b},PS=function(a){let b=null;for(;b=a.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)a=a.replace(b[0],c=>OS[c]);return a},RS=function(a,b){QS(a,b);Array.from(b.getElementsByTagName("*")).forEach(c=>{QS(a,c)})},QS=function(a,b){for(const c in a)null!=a[c]&&(b.style[c]=a[c])},SS=function(a,b){return 0===a?"0":a+b},TS=function(a,b){return 1>Math.abs(a-b)||a<b},US=function(a,b){return a<b&&1<Math.abs(a-b)},VS=function(a,b){return a>b&&1<Math.abs(a-b)},WS=
3
+ function(a,b){return 1>Math.abs(a-b)||a>b},YS=function(a){const b=a.getBoundingClientRect();var c=getComputedStyle(a,null);const d=parseFloat(c.getPropertyValue("border-left-width"))||0,e=parseFloat(c.getPropertyValue("border-right-width"))||0;var f=parseFloat(c.getPropertyValue("border-top-width"))||0;c=parseFloat(c.getPropertyValue("border-bottom-width"))||0;const g=(b.top||a.offsetTop)+f;f=(b.height||a.offsetHeight)-f-c;return new XS(b.left+d,b.right+e,g,(b.bottom||g+f)+c,f,(b.width||a.offsetWidth)-
4
+ d-e)},ZS=function(a){return new XS(a.left,a.f,a.top,a.a,a.height,a.width)},$S=function(a,b){return b.some(c=>US(a.left,c.f)&&VS(a.f,c.left)&&US(a.top,c.a)&&VS(a.a,c.top))},aT=function(a,b){return WS(a.top,b.top)&&TS(a.a,b.a)&&WS(a.left,b.left)&&TS(a.f,b.f)},bT=function(a,b,c){switch(c){case "+x":return US(a.left,b.left);case "-x":return VS(a.f,b.f);case "+y":return US(a.top,b.top);case "-y":return VS(a.a,b.a);default:throw Error("Unknown axis");}},cT=function(a){return a.f.writingMode===_.Lt},dT=
5
+ function(a){var b=a.a.childNodes[0],c=a.a.getBoundingClientRect();const d=b.getClientRects();b=c.height/d.length;c=c.width/d.length;return cT(a)?b:c},eT=function(a){switch(a.f.writingMode){case _.Lt:return"horizontal-tb";case _.ng:return _.ng;case _.og:return _.og;default:throw Error("Unknown writing mode");}},fT=function(a){switch(a.f.positionAlign){case _.ge:return _.de;case "auto":case _.Wc:return _.Kt;case _.he:return _.wf}return a.f.textAlign},gT=function(a,b){if(typeof a.f.position===_.r&&typeof a.f.size===
6
+ _.r)switch(b){case _.ge:return a.f.position;case "auto":case _.Wc:return a.f.position-a.f.size/2;case _.he:return a.f.position-a.f.size}return 0},hT=function(a){if(!a.f.positionAlign)switch(a.f.textAlign){case _.Jf:case _.de:return _.ge;case _.Kt:return _.Wc;case _.Qd:case _.wf:return _.he}return a.f.positionAlign},kT=function(a,b,c){return(iT(a)||jT(a))&&_.eh(c)?SS(c,_.pf):iT(a)&&_.z(c)?SS(0,_.pf):cT(a)&&_.eh(b)?SS(b,"%"):JS},lT=function(a,b,c){return cT(a)&&_.eh(c)?SS(c,_.pf):(iT(a)||jT(a))&&_.eh(b)?
7
+ SS(b,"%"):JS},jT=function(a){return a.f.writingMode===_.og},iT=function(a){return a.f.writingMode===_.ng},mT=function(a,b){if(a.j)switch(b.writingMode){case _.Lt:return["-y"];case _.ng:return["+x"];case _.og:return["-x"]}a=[];switch(b.writingMode){case _.Lt:a=["+y","-y"];break;case _.ng:a=["+x","-x"];break;case _.og:a=["-x","+x"]}0>b.line&&(a=a.reverse());return a},nT=function(a){for(a.h=[];0<a.f.childNodes.length;)a.f.removeChild(a.f.childNodes[0]);a.a=YS(a.l.a)},oT=function(a,b,c){a=a.f;const d=
8
+ a.viewportAnchorUnits;if(d===_.St)return a.viewportAnchorY/100*c-a.regionAnchorY/100*b;if(0===d)return a.viewportAnchorY-a.regionAnchorY;throw Error(FS);},qT=function(a,b,c,d){const e=document.createElement(_.Pf),f=e.dataset;f.name=b;f.for=c;d&&(f.name=`${b} (sandbox)`,f.sandbox=!0);c=document.head;c.appendChild(e);pT(a,c,b);a.g.debug(`Created HTML style element #${b}.`);return e.sheet},rT=function(a,b){a=`.${a.j} .clpp-text-container`;const c=`${a} .clpp-text-cue`;return b=b.replace(/::cue\((#[^)]+)\)/g,
9
+ `${a} $1`).replace(/::cue\(([^)]+)\)/g,`${c} $1`).replace(/::cue-region\(([^)]+)\)/g,`${a} $1 .clpp-text-cue`).replace(/::cue/g,c).replace(/::cue-region/g,`${a} .clpp-text-cue-region .clpp-text-cue`).replace(/::ttml/g,a)},sT=function(a,b){let c=!1;try{a.f.insertRule(b,0);const d=a.f.cssRules[0];d instanceof CSSStyleRule&&(c=d.selectorText.split(",").every(e=>0===e.trim().indexOf(`.${a.j} `)))}catch(d){}0<a.f.cssRules.length&&a.f.deleteRule(0);return c},tT=function(a){if(null!=a.a){for(;0<a.a.cssRules.length;)a.a.deleteRule(0);
10
+ a.o=[]}},pT=function(a,b,c){const d=new MutationObserver(e=>{e.forEach(f=>{f.removedNodes.forEach(g=>{g.id===c&&a.g.error(`PRESTOplay HTML style element #${c} has `+"been unexpectedly removed! Some styles will not work!")})})});d.observe(b,{subtree:!1,childList:!0});a.l.push(()=>d.disconnect())},uT=function(a){a=_.Yg(a.htmlcue||{});_.z(a.stretchSmpteImage)&&(a.stretchSmpteImage=!1);_.z(a.enableResizeObserver)&&(a.enableResizeObserver=!0);return a},AT=function(a,b){if((b||a.l)&&a.F){var c=a.m.getPosition(),
11
+ d;!(d=b)&&(d=a.J!==c)&&(d=a.m instanceof _.R?3===a.m.getState():8===a.m.getState());if(d&&(a.J=c,c=vT(a,c),b||(b=a.o,b=!(null===b&&null===c||null!==b&&null!==c&&b.start===c.start&&b.end===c.end)),b&&(a.o=c,wT(a),c))){b={color:a.getFontColor()||void 0,backgroundColor:a.getBackgroundColor()||void 0,fontFamily:a.getFontFamily()||void 0,textShadow:_.st(a)||void 0};c=a.f.slice(c.start,c.end+1);for(const k of c){c=a;d=k;var e=b,f=c.a.a,g=null;switch(d.payloadType){case _.yg:g="clpp-text-vtt";break;case _.cg:g=
12
+ HS;break;case _.Jt:g=GS}g&&!f.classList.contains(g)&&_.xp(f,g);f=YS(c.a.a);if(0===f.width||0===f.height)c.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.");else{QS({fontSize:xT(c,d.containerRows)},c.a.a);f=null;g=d.payloadType===_.yg;var h=d.payloadType===_.cg;d.region&&(g||h||d.backgroundImage)&&(c.B.has(d.region.id)?f=c.B.get(d.region.id):(f=new yT(d.region,{}),c.B.set(d.region.id,
13
+ f),c.a.appendChild(f)));d=new zT(d,c.L,e);f?f.appendChild(d):c.a.appendChild(d)}}}}},BT=function(a){wT(a);a.J=null;a.o=null;a.f=[]},CT=function(a,b){return a.startTime<=b&&a.endTime>b},vT=function(a,b){var c=MS(a.f,d=>CT(d,b)?0:b!==d.startTime?b-d.startTime:b-d.endTime);if(-1===c)return null;{let d=c;for(;0<=d-1&&CT(a.f[d-1],b);)d--;for(;c+1<a.f.length&&CT(a.f[c+1],b);)c++;return{start:d,end:c}}},wT=function(a){a.B.clear();if(a.a){const b=a.a.a;b.classList.remove("clpp-text-vtt");b.classList.remove(HS);
14
+ b.classList.remove(GS);a=a.a;nT(a.h);a.l=[]}},xT=function(a,b){const c=YS(a.a.a).height;if(null!==a.I)return a.getFontSize();if(null!==a.C)return a=a.getFontSizePercent(),`${Math.round(c*a)}px`;if(typeof b===_.r&&0<b)return`${Math.round(c/b)}px`;a=a.getFontSizePercent();return`${Math.round(c*a)}px`},GT=class{parse(a){a={input:a};const b=_.zp(_.Ad),c=[];let d=b;for(var e;null!==(e=NS(a));)if("\x3c"===e[0])if("/"===e[1])c.length&&c[c.length-1]===e.substr(2).replace("\x3e","")&&(c.pop(),d=d.parentNode);
15
+ else{if(e=e.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/)){var f=e[1];var g=e[3];var h=DT[f];h?(h=_.zp(h),(f=ET[f])&&g&&h.setAttribute(f,g.trim()),g=h):g=null;!g||FT[g.localName]&&FT[g.localName]!==d.localName||(e[2]&&(g.className=e[2].substr(1).replace(/\./g," ")),c.push(e[1]),d.appendChild(g),d=g)}}else d.appendChild(document.createTextNode(PS(e)));return b}},DT={c:"c",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"v",lang:"lang"},ET={v:"voice",lang:"lang"},FT={rt:"ruby"},OS={"\x26amp;":"\x26",
16
+ "\x26lt;":"\x3c","\x26gt;":"\x3e","\x26lrm;":"\u200e","\x26rlm;":"\u200f","\x26nbsp;":"\u00a0"};var XS=class{constructor(a,b,c,d,e,f){this.left=a;this.f=b;this.top=c;this.a=d;this.height=e;this.width=f}};var HT=class{constructor(a,b,c){this.id=a;this.w=b;this.B=c;this.a=this.o();this.j=!1}init(){this.j=!0}A(){return!1}};var zT=class extends HT{constructor(a,b,c){super(a.id,"clpp-text-cue",{});this.l=b;this.f=a;this.h=!!this.f.backgroundImage;this.C=c}A(){return!this.h&&!(this.f.region&&this.f.region.displayAlign)}init(a){super.init(a);if(this.h)_.xp(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===_.cg){var c=_.zp(_.Ad);c.innerHTML=b.payload;b=c}else b.payloadType===
17
+ _.yg?b=(new GT).parse(b.payload):(c=_.zp(_.Ad),c.textContent=b.payload,b=c);_.xp(b,this.w);this.id&&(b.id=this.id);for(d of this.f.cssClassList)_.xp(b,d);QS({writingMode:eT(this)},b);var d=b;this.a.appendChild(d);_.xp(this.a,"clpp-text-wrapper");for(var e of this.f.cssClassList)_.xp(this.a,`clpp-text-wrapper__${e}`);_.z(this.f.line)&&(this.f.lineInterpretation=_.Mt,this.f.line=cT(this)?-1:0);e=eT(this);QS({writingMode:e,webkitWritingMode:e,direction:JS,textAlign:fT(this)},this.a);if(!this.f.region||
18
+ !this.f.region.displayAlign){e=gT(this,hT(this));QS({position:"absolute",left:kT(this,e,null),right:jT(this)&&_.z(null)?SS(0,_.pf):JS,top:lT(this,e,null),width:cT(this)?SS(this.f.size,"%"):JS,height:iT(this)||jT(this)?SS(this.f.size,"%"):JS},this.a);b=this.f;a=cT(this)?a.height:a.width;c=dT(this);if(b.lineInterpretation===_.Mt){var f=c*Math.round(b.line);Math.abs(f)>a&&(f=c*(0>b.line?0:-1));0>f&&(f+=a)}else{f=c/a*100;let g=b.line;switch(b.lineAlign){case _.Wc:g-=f/2;break;case _.Qd:g-=f}f=Math.round(g/
19
+ 100*a)}jT(this)&&(f=a-f-c);a=f;QS({left:kT(this,e,a),right:jT(this)&&_.z(a)?SS(0,_.pf):JS,top:lT(this,e,a)},this.a)}RS(this.C,d)}}o(){return _.zp(_.Ad)}};var IT=class{constructor(a,b){this.l=a;this.f=a.a;this.j=void 0===b?!1:b;this.a=YS(a.a);this.h=[]}append(a){const b=a.a;b.style.visibility=_.Yd;this.f.appendChild(b);a.j||a.init(this.a);if(a.A()){a:{var c=YS(a.a);var d=mT(this,a.f),e=dT(a);const g=ZS(c);let h=null,k=0;for(const l of d){for(;bT(c,this.a,l)||aT(c,this.a)&&$S(c,this.h);){d=c;var f=e;switch(l){case "+x":d.left+=f;d.f+=f;break;case "-x":d.left-=f;d.f-=f;break;case "+y":d.top+=f;d.a+=f;break;case "-y":d.top-=f,d.a-=f}}if(this.j||aT(c,this.a))break a;
20
+ d=this.a;d=Math.max(0,Math.min(c.f,d.f)-Math.max(c.left,d.left))*Math.max(0,Math.min(c.a,d.a)-Math.max(c.top,d.top))/(c.height*c.width);d>k&&(h=ZS(c),k=d);c=ZS(g)}c=h||g}QS({top:SS(c.top-this.a.top,_.pf),bottom:SS(this.a.a-c.a,_.pf),left:SS(c.left-this.a.left,_.pf),right:SS(this.a.f-c.f,_.pf),height:SS(c.height,_.pf),width:SS(c.width,_.pf)},a.a)}b.style.visibility="visible";this.h.push(YS(a.a))}};var JT=class extends HT{constructor(a,b,c){super(a,b,c);this.h=null;this.l=[]}init(){this.h=new IT(this);this.j=!0}o(){const a=_.zp(_.Ad);_.xp(a,this.w);this.id&&(a.id=this.id);return a}appendChild(a){nT(this.h);this.l.unshift(a);for(const b of this.l)this.h.append(b)}};var yT=class extends JT{constructor(a,b){super(a.id,"clpp-text-cue-region",b);this.f=a}init(a){a:{var b=this.f;switch(b.widthUnits){case 0:b=b.width;break a;case _.St:b=b.width/100*a.width;break a;default:throw Error(FS);}}var c=this.f;var d=c.viewportAnchorUnits;if(d===_.St)c=c.viewportAnchorX/100*a.width-c.regionAnchorX/100*b;else if(0===d)c=c.viewportAnchorX-c.regionAnchorX;else throw Error(FS);d=a.height;const e=oT(this,d,a.height);QS(this.B,this.a);QS({left:SS(c,_.pf),top:SS(e,_.pf),width:SS(b,
21
+ _.pf),height:SS(d,_.pf)},this.a);this.f.writingMode&&QS({display:"flex","flex-direction":this.f.writingMode},this.a);this.f.displayAlign&&QS({"justify-content":this.f.displayAlign},this.a);for(var f of this.f.cssClassList)_.xp(this.a,f);a:switch(f=this.f,f.heightUnits){case 0:f=f.height;break a;case _.St:f=f.height/100*a.height;break a;case 2:f=f.height;c=new zT(new _.Pt(0,1,"Lorem ipsum",_.Jt),{},{});b=c.a;this.a.appendChild(b);c.init(YS(this.a));c=b.getBoundingClientRect().height;this.a.removeChild(b);
22
+ b=c;f*=b;break a;default:throw Error(FS);}a=oT(this,f,a.height);QS({top:SS(a,_.pf),height:SS(f,_.pf)},this.a);this.h=new IT(this,!0);this.j=!0}getId(){return this.f.id}};var KT=class{constructor(a,b){this.g=new _.S("clpp.htmlcue.StyleManager");this.l=[];this.j=a;this.h=b;this.o=[];this.a=qT(this,this.h,this.j);this.f=qT(this,this.h,this.j,!0);this.f.disabled=!0;this.g.debug(`Stylesheet ${this.h} has been created.`)}appendRule(a){if(null!=this.a&&!this.o.some(b=>b===a)){const b=rT(this,a);if(sT(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.o.push(a)}else this.g.warn(`Stylesheet ${this.h} ignoring the CSS rule `+
23
+ `because it's not safe: ${b}`)}}destroy(){const a=this;return _.v(function*(){null!=a.a&&(a.l.forEach(b=>b()),a.l=[],tT(a),document.head.removeChild(a.a.ownerNode),document.head.removeChild(a.f.ownerNode),a.a=null,a.f=null,a.g.debug(`Stylesheet ${a.h} has been destroyed.`))})}};var LT=class extends _.zv{constructor(a){super(a);this.g=new _.S(IS);this.m=a;this.L=uT(a.getConfiguration());this.l=!1;this.f=[];this.F=a.getSurface().getContainer();this.j=new KT(a.getSurface().getUniqueCssClass(),"CLPP Subtitle Styles");this.a=new JT(null,"clpp-text-container",{});this.A=new _.vv(a.getSurface(),this.S.bind(this));this.J=null;this.F?(this.F.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.");
24
+ this.G=new _.Jh(()=>{AT(this)});this.B=new Map;this.o=null}append(a,b){if(null!=this.j&&0!==a.length){for(const c of b)this.j.appendRule(c);a.sort((c,d)=>c.startTime!==d.startTime?c.startTime-d.startTime:c.endTime-d.endTime);this.f=LS(this.f,KS(a));this.o=null;AT(this,!1)}}h(){null==this.j||AT(this,!0)}destroy(){const a=this;return _.v(function*(){null!=a.j&&(BT(a),a.G.stop(),yield a.j.destroy(),a.j=null,a.F.removeChild(a.a.a),a.a=null,a.A.stop(),a.A=null,a.l=!1)})}remove(a,b){if(null==this.j)return!1;
25
+ this.f=this.f.filter(c=>c.startTime<a||c.endTime>=b);this.o=null;AT(this,!0);return!0}isTextVisible(){return this.l}setTextVisibility(a){null!=this.j&&this.l!==a&&((this.l=a)?(this.G.Gb(.25),this.L.enableResizeObserver&&this.A.start(),AT(this,!0)):(this.G.stop(),this.A.stop(),BT(this)))}S(){AT(this,!0)}};_.w(IS,LT);LT.prototype.setTextVisibility=LT.prototype.setTextVisibility;LT.prototype.isTextVisible=LT.prototype.isTextVisible;LT.prototype.remove=LT.prototype.remove;LT.prototype.destroy=LT.prototype.destroy;
26
+ LT.prototype.append=LT.prototype.append;var MT=class{a(a){return!!a.enableHtmlCue&&!_.$h()}create(a){return new LT(a)}};_.w("clpp.htmlcue.HtmlCueComponent",class extends _.mv{install(){_.Xo(_.Zd,new MT)}uninstall(){_.Vo.has(_.Zd)&&(_.Vo.delete(_.Zd),_.Wo.info("Removed factory: 'html'"))}id(){return _.Qf}});};f.call(g, window);
package/cl.ima.js CHANGED
@@ -1,20 +1,20 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var nS="clpp.ima.AdsManagerFactory",oS=function(){return!window.google||!google.ima||!google.ima.AdsLoader},pS=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===_.Kc?a.enablePreloading:!0;typeof a.loadVideoTimeout===_.r&&(b.loadVideoTimeout=a.loadVideoTimeout);Array.isArray(a.mimeTypes)&&(b.mimeTypes=a.mimeTypes);typeof a.playAdsAfterTime===
2
- _.r&&(b.playAdsAfterTime=a.playAdsAfterTime);typeof a.useStyledLinearAds===_.Kc&&(b.useStyledLinearAds=a.useStyledLinearAds);b.uiElements=Array.isArray(a.uiElements)?a.uiElements:[];return b},qS=function(a){const b=_.Li()||_.Oi()||_.Wi();return!1===a.H.disableCustomPlayback&&b},rS=function(a){const b=a.a,c=a.S,d=google.ima.AdEvent.Type;c.on(b,d.AD_BREAK_READY,a.yc.bind(a));c.on(b,d.LOADED,a.lb.bind(a));c.on(b,d.CONTENT_PAUSE_REQUESTED,a.md.bind(a));c.on(b,d.STARTED,a.Ib.bind(a));c.on(b,d.LOG,a.Dc.bind(a));
3
- c.on(b,d.AD_PROGRESS,a.Jb.bind(a));c.on(b,d.AD_BUFFERING,a.Ac.bind(a));c.on(b,d.FIRST_QUARTILE,a.ab.bind(a));c.on(b,d.MIDPOINT,a.Fc.bind(a));c.on(b,d.THIRD_QUARTILE,a.Ub.bind(a));c.on(b,d.PAUSED,a.Ic.bind(a));c.on(b,d.RESUMED,a.Jc.bind(a));c.on(b,d.CLICK,a.Aa.bind(a));c.on(b,d.SKIPPED,a.Kb.bind(a));c.on(b,d.IMPRESSION,a.bb.bind(a));c.on(b,d.COMPLETE,a.Bc.bind(a));c.on(b,d.CONTENT_RESUME_REQUESTED,a.od.bind(a))},sS=function(a,b){const c=b?a.xc.create(b.getErrorCode()):null;a.m.onError(new _.I(1,9,
4
- 10003,{errorType:c},b))},tS=function(a){return qS(a)&&a.a.isCustomPlaybackUsed()},uS=function(a,b,c){c=c&&c.getAd();let d=null;c&&(d={ad:new W(c,a.J,a.I)});a.m.trigger(new _.H(b,d))},wS=function(a){_.v(function*(){a.M=a.m.getPosition();yield vS(a,[3,4,5]);yield a.m.pause();yield a.m.detach();a.a.start()})},vS=function(a,b){return _.v(function*(){return new Promise((c,d)=>{const e=setTimeout(()=>{clearInterval(f);d(Error("Timeout waiting for player state"))},1E4),f=setInterval(()=>{const g=a.m.getState();
5
- g===_.qo?(clearInterval(f),clearTimeout(e),d(Error("Player entered error state"))):b.includes(g)&&(clearInterval(f),clearTimeout(e),c())},200)})})},xS=function(a){a.U=!1;a.G=null;uS(a,_.jc);a.m.getSurface().hide(a.da)},yS=function(a){_.zi(a.F,{visibility:"visible"})},AS=function(a){_.v(function*(){a.ia.initialize();const b=!!a.m.getConfiguration().muted;(yield a.Z.canPlay(b))||tS(a)?zS(a):(uS(a,_.Ic),a.g.warn(_.ka))})},zS=function(a){a.a.init(a.F.offsetWidth,a.F.offsetHeight,google.ima.ViewMode.NORMAL);
6
- tS(a)?a.H.isVast&&wS(a):a.a.start();a.ca=!0},W=class{constructor(a,b,c){this.a=a;this.f=a.getAdPodInfo();this.j=b;this.h=c}cb(){return"Google IMA SDK"}eb(){return google.ima.VERSION}gb(){return 0}getId(){return this.a.getAdId()}getCreativeId(){return this.a.getCreativeId()}zb(){return""}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()}getPosition(){return 0}getSkipTimeOffset(){return this.a.getSkipTimeOffset()}Bb(){return this.f?
7
- this.f.getIsBumper():!1}Pa(){let a=null;const b=this.a,c=Object.keys(b).find(d=>typeof b[d]===_.De&&typeof b[d].clickThroughUrl===_.Pf);c&&(a=b[c].clickThroughUrl);return a}getMediaUrl(){return this.a.getMediaUrl()}Ta(){return this.a.getVastMediaWidth()}Sa(){return this.a.getVastMediaHeight()}Ba(){return this.a.getVastMediaBitrate()}Ca(){return this.h?2:this.j?1:0}getPodIndex(){return this.f?this.f.getPodIndex():0}pb(){return this.f?this.f.getTimeOffset():0}fb(){return this.f?this.f.getAdPosition():
8
- 1}Ua(){return this.f?this.f.getTotalAds():1}getWrapperAdIds(){return this.a.getWrapperAdIds()}canSeek(){return!1}getWrapperAdSystems(){return this.a.getWrapperAdSystems()}getWrapperCreativeIds(){return this.a.getWrapperCreativeIds()}Ab(){return null}};W.prototype.getVideoElement=W.prototype.Ab;W.prototype.getWrapperCreativeIds=W.prototype.getWrapperCreativeIds;W.prototype.getWrapperAdSystems=W.prototype.getWrapperAdSystems;W.prototype.canSeek=W.prototype.canSeek;W.prototype.getWrapperAdIds=W.prototype.getWrapperAdIds;
9
- W.prototype.getSequenceLength=W.prototype.Ua;W.prototype.getPositionInSequence=W.prototype.fb;W.prototype.getPodTimeOffset=W.prototype.pb;W.prototype.getPodIndex=W.prototype.getPodIndex;W.prototype.getPodType=W.prototype.Ca;W.prototype.getMediaBitrate=W.prototype.Ba;W.prototype.getMediaHeight=W.prototype.Sa;W.prototype.getMediaWidth=W.prototype.Ta;W.prototype.getMediaUrl=W.prototype.getMediaUrl;W.prototype.getClickThroughUrl=W.prototype.Pa;W.prototype.isBumper=W.prototype.Bb;
10
- W.prototype.getSkipTimeOffset=W.prototype.getSkipTimeOffset;W.prototype.getPosition=W.prototype.getPosition;W.prototype.getDuration=W.prototype.getDuration;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.getSourceId=W.prototype.zb;W.prototype.getCreativeId=W.prototype.getCreativeId;W.prototype.getId=W.prototype.getId;
11
- W.prototype.getTechnology=W.prototype.gb;W.prototype.getAdManagerVersion=W.prototype.eb;W.prototype.getAdManagerName=W.prototype.cb;var BS=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 CS=class{constructor(a){this.a=a}getCuePoints(){return this.a}Rb(){return 0<=this.a.indexOf(0)||0===this.a.length}Qb(){return 0<=this.a.indexOf(-1)}};CS.prototype.hasPostroll=CS.prototype.Qb;CS.prototype.hasPreroll=CS.prototype.Rb;CS.prototype.getCuePoints=CS.prototype.getCuePoints;var DS=class extends _.Mv{constructor(){super();this.a=this.h=this.f=null}onPlayerCreated(a){if(oS())return a.onError(new _.I(1,9,1E4));this.f=_.xi(_.Bd,{"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(_.ra);this.a.getSettings().setPlayerVersion(_.ea);this.a.getSettings().setAutoPlayAdBreaks(!0)}onPlayerWillDestroy(a){this.a&&
12
- (this.a.destroy(),this.a=null);this.h&&(this.h.destroy(),this.h=null);this.f&&(a.getSurface().removeElementFromContainer(this.f),this.f=null)}Vh(){return this.a}Th(){return this.h}$c(){return this.f}id(){return"ima"}};_.w("clpp.ima.ImaPlugin",DS);DS.prototype.getAdContainer=DS.prototype.$c;DS.prototype.getAdDisplayContainer=DS.prototype.Th;DS.prototype.getAdsLoader=DS.prototype.Vh;DS.Id="ima";DS.isSdkMissing=oS;var ES=class{create(){return new DS}};var FS=class{constructor(a){var b=a.Gd("ima");if(!b)throw Error("IMA plugin not created.");var c=b.$c(),d=b.h;b=b.a;if(!c||!d||!b)throw Error("IMA plugin not initialized.");const e=a.getSurface().getMedia();if(!e)throw Error("Missing media element.");this.m=a;this.F=e;a=this.m.getConfiguration();a=_.$g(a.ima||{});this.H=a=_.Zg({disableCustomPlayback:!1},a);this.da=c;this.ia=d;this.B=b;this.Z=new _.Cv;this.g=new _.T("clpp.ima");this.a=null;this.W=!1;this.l=null;this.f=new _.Cl;this.ca=!1;this.S=new _.It;
13
- this.xc=new BS;this.G=null;this.C=this.U=!1;this.L=1;this.P=this.I=this.J=!1;this.M=this.R=null;this.K=!0;c=this.S;d=google.ima.AdErrorEvent.Type.AD_ERROR;c.one(this.B,google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.hd.bind(this));c.on(this.B,d,this.Lc.bind(this));c.on(this.m,_.Sd,this.jd.bind(this))}hd(a){this.a=a.getAdsManager(this.F,pS(this));this.a.isCustomPlaybackUsed()&&!qS(this)?(this.g.warn("IMA plugin is disabled for this platform with single video element. Disposing."),this.m.onError(new _.I(1,
14
- 9,10002)),this.o()):(this.setMuted(this.C),this.h(this.L),this.l=new _.Av(this.m.getSurface(),(b,c,d)=>{this.a.resize(b,c,d?google.ima.ViewMode.FULLSCREEN:google.ima.ViewMode.NORMAL)}),a=this.a.getCuePoints(),this.R=new CS(a),this.m.trigger(new _.H(_.mc,{adsTimeline:this.R})),rS(this));this.f.resolve()}Lc(a){sS(this,a.getError());this.f.resolve()}md(a){this.P=!0;tS(this)||(this.m.pause(),_.zi(this.F,{visibility:_.Zd}));uS(this,_.Qb,a);this.l.start()}yc(){tS(this)?wS(this):this.a.start()}lb(a){a.getAd().isLinear()?
15
- uS(this,_.$b,a):(this.a.discardAdBreak(),this.J||(this.J=!0,this.m.play()))}Ib(a){this.U=!0;this.K=!1;this.G=a.getAd().getDuration();uS(this,_.hc,a);this.m.getSurface().show(this.da)}Dc(a){a=a.getAdData();sS(this,a?a.adError:null);xS(this)}Jb(a){uS(this,_.cc,a)}Ac(a){uS(this,_.Sb,a)}ab(a){uS(this,_.Vb,a)}Fc(a){uS(this,_.ac,a)}Ub(a){uS(this,_.kc,a)}Ic(a){this.K=!0;uS(this,_.bc,a)}Jc(a){this.K=!1;uS(this,_.dc,a)}Aa(a){this.pause();uS(this,_.Tb,a)}Kb(a){uS(this,_.ec,a);xS(this)}bb(a){uS(this,_.Zb,a)}Bc(a){uS(this,
16
- _.Ub,a);xS(this)}od(){const a=this;return _.v(function*(){a.J=!0;if(tS(a)&&null!==a.M){const c=a.m.getVolume(),d=a.m.isMuted();var b=a.m;b.a&&b.a.forwardEventsTo(b);b=a.m;b.f=_.Zg(b.f,{volume:c,muted:d});yield _.eo(a.m);!a.I&&a.M&&(yield vS(a,[2,3,4,5]),yield a.m.play(),yield a.m.pause(),yield vS(a,[4,5]),yield a.m.setPosition(a.M))}else{if(!a.P)return a.m.play();yS(a)}a.P=!1;a.l&&a.l.stop();a.I||(yield a.m.play());uS(a,_.Rb)})}jd(){this.I=!0;this.B.contentComplete()}load(){const a=this;return _.v(function*(){var b=
17
- a.m;const c=a.H;try{if(typeof c.adTagUrl!==_.Pf)throw new _.I(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.Z.canPlay(!1);const d=yield a.Z.canPlay(!0),e=new google.ima.AdsRequest;e.adTagUrl=c.adTagUrl;e.setAdWillAutoPlay(b);e.setAdWillPlayMuted(d);a.B.getSettings().setAutoPlayAdBreaks(!1);a.B.requestAds(e);return a.f})}j(){if(this.W||!this.a||this.W)return!0;if(!this.ca){if(this.R.Rb())return AS(this),!1;this.ia.initialize();
18
- zS(this);return!0}return this.qb()&&this.a?(this.a.resume(),!1):!0}A(){}w(){return!0}ib(){this.a&&this.a.pause()}isPaused(){return this.K}skip(){this.a&&this.a.skip()}getAdVolume(){return this.a?this.C?this.L:this.a.getVolume():1}h(a){this.L=a;this.a&&(this.C||this.a.setVolume(a))}setVolume(a){this.h(a)}getVolume(){return this.getAdVolume()}pause(){this.ib()}resume(){this.j()}setMuted(a){this.C=a;this.a&&(a?this.a.setVolume(0):this.a.setVolume(this.L))}isMuted(){return this.C}qb(){return this.U}getPosition(){if(!this.a||
19
- null===this.G)return-1;const a=this.a.getRemainingTime();return 0>a?0:this.G-a}o(){this.a&&(this.a.destroy(),this.a=null);this.W=!0;yS(this);this.S.release();this.l&&(this.l.stop(),this.l=null);return Promise.resolve()}};FS.prototype.getPosition=FS.prototype.getPosition;FS.prototype.resume=FS.prototype.resume;FS.prototype.pause=FS.prototype.pause;FS.prototype.getVolume=FS.prototype.getVolume;FS.prototype.setVolume=FS.prototype.setVolume;FS.prototype.getAdVolume=FS.prototype.getAdVolume;
20
- FS.prototype.skip=FS.prototype.skip;FS.prototype.pauseAd=FS.prototype.ib;_.Bh(new class{constructor(){this.Wa=new _.T(nS)}name(){return nS}a(a,b){return a.namespace()===_.ed?!1:oS()?(this.Wa.warn("IMA SDK is not loaded."),!1):!(!b||!b.ima)}create(a){return new FS(a)}});_.Kn(new ES);};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var mS="clpp.ima.AdsManagerFactory",nS=function(){return!window.google||!google.ima||!google.ima.AdsLoader},oS=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===_.Mc?a.enablePreloading:!0;typeof a.loadVideoTimeout===_.r&&(b.loadVideoTimeout=a.loadVideoTimeout);Array.isArray(a.mimeTypes)&&(b.mimeTypes=a.mimeTypes);typeof a.playAdsAfterTime===
2
+ _.r&&(b.playAdsAfterTime=a.playAdsAfterTime);typeof a.useStyledLinearAds===_.Mc&&(b.useStyledLinearAds=a.useStyledLinearAds);b.uiElements=Array.isArray(a.uiElements)?a.uiElements:[];return b},pS=function(a){const b=_.Ph()||_.Sh()||_.$h();return!1===a.H.disableCustomPlayback&&b},qS=function(a){const b=a.a,c=a.S,d=google.ima.AdEvent.Type;c.on(b,d.AD_BREAK_READY,a.wc.bind(a));c.on(b,d.LOADED,a.lb.bind(a));c.on(b,d.CONTENT_PAUSE_REQUESTED,a.kd.bind(a));c.on(b,d.STARTED,a.Hb.bind(a));c.on(b,d.LOG,a.Bc.bind(a));
3
+ c.on(b,d.AD_PROGRESS,a.Ib.bind(a));c.on(b,d.AD_BUFFERING,a.yc.bind(a));c.on(b,d.FIRST_QUARTILE,a.bb.bind(a));c.on(b,d.MIDPOINT,a.Dc.bind(a));c.on(b,d.THIRD_QUARTILE,a.Ub.bind(a));c.on(b,d.PAUSED,a.Gc.bind(a));c.on(b,d.RESUMED,a.Hc.bind(a));c.on(b,d.CLICK,a.Aa.bind(a));c.on(b,d.SKIPPED,a.Jb.bind(a));c.on(b,d.IMPRESSION,a.cb.bind(a));c.on(b,d.COMPLETE,a.zc.bind(a));c.on(b,d.CONTENT_RESUME_REQUESTED,a.md.bind(a))},rS=function(a,b){const c=b?a.vc.create(b.getErrorCode()):null;a.m.onError(new _.J(1,9,
4
+ 10003,{errorType:c},b))},sS=function(a){return pS(a)&&a.a.isCustomPlaybackUsed()},tS=function(a,b,c){c=c&&c.getAd();let d=null;c&&(d={ad:new W(c,a.J,a.I)});a.m.trigger(new _.H(b,d))},vS=function(a){_.v(function*(){a.M=a.m.getPosition();yield uS(a,[8,10,11]);yield a.m.pause();yield a.m.detach();a.a.start()})},uS=function(a,b){return _.v(function*(){return new Promise((c,d)=>{const e=setTimeout(()=>{clearInterval(f);d(Error("Timeout waiting for player state"))},1E4),f=setInterval(()=>{const g=a.m.getPlayerState();
5
+ 3===g?(clearInterval(f),clearTimeout(e),d(Error("Player entered error state"))):b.includes(g)&&(clearInterval(f),clearTimeout(e),c())},200)})})},wS=function(a){a.U=!1;a.G=null;tS(a,_.lc);a.m.getSurface().hide(a.da)},xS=function(a){_.yp(a.F,{visibility:"visible"})},zS=function(a){_.v(function*(){a.ja.initialize();const b=!!a.m.getConfiguration().muted;(yield a.Z.canPlay(b))||sS(a)?yS(a):(tS(a,_.Kc),a.g.warn(_.la))})},yS=function(a){a.a.init(a.F.offsetWidth,a.F.offsetHeight,google.ima.ViewMode.NORMAL);
6
+ sS(a)?a.H.isVast&&vS(a):a.a.start();a.ca=!0},W=class{constructor(a,b,c){this.a=a;this.f=a.getAdPodInfo();this.j=b;this.h=c}eb(){return"Google IMA SDK"}fb(){return google.ima.VERSION}hb(){return 0}getId(){return this.a.getAdId()}getCreativeId(){return this.a.getCreativeId()}yb(){return""}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()}getPosition(){return 0}getSkipTimeOffset(){return this.a.getSkipTimeOffset()}Ab(){return this.f?
7
+ this.f.getIsBumper():!1}Qa(){let a=null;const b=this.a,c=Object.keys(b).find(d=>typeof b[d]===_.Be&&typeof b[d].clickThroughUrl===_.Nf);c&&(a=b[c].clickThroughUrl);return a}getMediaUrl(){return this.a.getMediaUrl()}Ua(){return this.a.getVastMediaWidth()}Ta(){return this.a.getVastMediaHeight()}Ba(){return this.a.getVastMediaBitrate()}Ca(){return this.h?_.Mj:this.j?_.Pj:0}getPodIndex(){return this.f?this.f.getPodIndex():0}ob(){return this.f?this.f.getTimeOffset():0}gb(){return this.f?this.f.getAdPosition():
8
+ 1}Va(){return this.f?this.f.getTotalAds():1}getWrapperAdIds(){return this.a.getWrapperAdIds()}canSeek(){return!1}getWrapperAdSystems(){return this.a.getWrapperAdSystems()}getWrapperCreativeIds(){return this.a.getWrapperCreativeIds()}zb(){return null}};W.prototype.getVideoElement=W.prototype.zb;W.prototype.getWrapperCreativeIds=W.prototype.getWrapperCreativeIds;W.prototype.getWrapperAdSystems=W.prototype.getWrapperAdSystems;W.prototype.canSeek=W.prototype.canSeek;W.prototype.getWrapperAdIds=W.prototype.getWrapperAdIds;
9
+ W.prototype.getSequenceLength=W.prototype.Va;W.prototype.getPositionInSequence=W.prototype.gb;W.prototype.getPodTimeOffset=W.prototype.ob;W.prototype.getPodIndex=W.prototype.getPodIndex;W.prototype.getPodType=W.prototype.Ca;W.prototype.getMediaBitrate=W.prototype.Ba;W.prototype.getMediaHeight=W.prototype.Ta;W.prototype.getMediaWidth=W.prototype.Ua;W.prototype.getMediaUrl=W.prototype.getMediaUrl;W.prototype.getClickThroughUrl=W.prototype.Qa;W.prototype.isBumper=W.prototype.Ab;
10
+ W.prototype.getSkipTimeOffset=W.prototype.getSkipTimeOffset;W.prototype.getPosition=W.prototype.getPosition;W.prototype.getDuration=W.prototype.getDuration;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.getSourceId=W.prototype.yb;W.prototype.getCreativeId=W.prototype.getCreativeId;W.prototype.getId=W.prototype.getId;
11
+ W.prototype.getTechnology=W.prototype.hb;W.prototype.getAdManagerVersion=W.prototype.fb;W.prototype.getAdManagerName=W.prototype.eb;var AS=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 BS=class{constructor(a){this.a=a}getCuePoints(){return this.a}Qb(){return 0<=this.a.indexOf(0)||0===this.a.length}Pb(){return 0<=this.a.indexOf(-1)}};BS.prototype.hasPostroll=BS.prototype.Pb;BS.prototype.hasPreroll=BS.prototype.Qb;BS.prototype.getCuePoints=BS.prototype.getCuePoints;var CS=class extends _.Hv{constructor(){super();this.a=this.h=this.f=null}onPlayerCreated(a){if(nS())return a.onError(new _.J(1,9,1E4));this.f=_.wp(_.Ad,{"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(_.sa);this.a.getSettings().setPlayerVersion(_.ea);this.a.getSettings().setAutoPlayAdBreaks(!0)}onPlayerWillDestroy(a){this.a&&
12
+ (this.a.destroy(),this.a=null);this.h&&(this.h.destroy(),this.h=null);this.f&&(a.getSurface().removeElementFromContainer(this.f),this.f=null)}Th(){return this.a}Rh(){return this.h}Yc(){return this.f}id(){return"ima"}};_.w("clpp.ima.ImaPlugin",CS);CS.prototype.getAdContainer=CS.prototype.Yc;CS.prototype.getAdDisplayContainer=CS.prototype.Rh;CS.prototype.getAdsLoader=CS.prototype.Th;CS.Id="ima";CS.isSdkMissing=nS;var DS=class{create(){return new CS}};var ES=class{constructor(a){var b=a.Ed("ima");if(!b)throw Error("IMA plugin not created.");var c=b.Yc(),d=b.h;b=b.a;if(!c||!d||!b)throw Error("IMA plugin not initialized.");const e=a.getSurface().getMedia();if(!e)throw Error("Missing media element.");this.m=a;this.F=e;a=this.m.getConfiguration();a=_.Yg(a.ima||{});this.H=a=_.Xg({disableCustomPlayback:!1},a);this.da=c;this.ja=d;this.B=b;this.Z=new _.xv;this.g=new _.S("clpp.ima");this.a=null;this.W=!1;this.l=null;this.f=new _.uk;this.ca=!1;this.S=new _.Et;
13
+ this.vc=new AS;this.G=null;this.C=this.U=!1;this.L=1;this.P=this.I=this.J=!1;this.M=this.R=null;this.K=!0;c=this.S;d=google.ima.AdErrorEvent.Type.AD_ERROR;c.one(this.B,google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.fd.bind(this));c.on(this.B,d,this.Jc.bind(this));c.on(this.m,_.Rd,this.gd.bind(this))}fd(a){this.a=a.getAdsManager(this.F,oS(this));this.a.isCustomPlaybackUsed()&&!pS(this)?(this.g.warn("IMA plugin is disabled for this platform with single video element. Disposing."),this.m.onError(new _.J(1,
14
+ 9,10002)),this.o()):(this.setMuted(this.C),this.h(this.L),this.l=new _.vv(this.m.getSurface(),(b,c,d)=>{this.a.resize(b,c,d?google.ima.ViewMode.FULLSCREEN:google.ima.ViewMode.NORMAL)}),a=this.a.getCuePoints(),this.R=new BS(a),this.m.trigger(new _.H(_.oc,{adsTimeline:this.R})),qS(this));this.f.resolve()}Jc(a){rS(this,a.getError());this.f.resolve()}kd(a){this.P=!0;sS(this)||(this.m.pause(),_.yp(this.F,{visibility:_.Yd}));tS(this,_.Sb,a);this.l.start()}wc(){sS(this)?vS(this):this.a.start()}lb(a){a.getAd().isLinear()?
15
+ tS(this,_.bc,a):(this.a.discardAdBreak(),this.J||(this.J=!0,this.m.play()))}Hb(a){this.U=!0;this.K=!1;this.G=a.getAd().getDuration();tS(this,_.kc,a);this.m.getSurface().show(this.da)}Bc(a){a=a.getAdData();rS(this,a?a.adError:null);wS(this)}Ib(a){tS(this,_.ec,a)}yc(a){tS(this,_.Ub,a)}bb(a){tS(this,_.Xb,a)}Dc(a){tS(this,_.cc,a)}Ub(a){tS(this,_.mc,a)}Gc(a){this.K=!0;tS(this,_.dc,a)}Hc(a){this.K=!1;tS(this,_.fc,a)}Aa(a){this.pause();tS(this,_.Vb,a)}Jb(a){tS(this,_.ic,a);wS(this)}cb(a){tS(this,_.ac,a)}zc(a){tS(this,
16
+ _.Wb,a);wS(this)}md(){const a=this;return _.v(function*(){a.J=!0;if(sS(a)&&null!==a.M){const c=a.m.getVolume(),d=a.m.isMuted();var b=a.m;b.a&&b.a.forwardEventsTo(b);b=a.m;b.f=_.Xg(b.f,{volume:c,muted:d});yield _.ds(a.m);!a.I&&a.M&&(yield uS(a,[6,8,10,11]),yield a.m.play(),yield a.m.pause(),yield uS(a,[10,11]),yield a.m.setPosition(a.M))}else{if(!a.P)return a.m.play();xS(a)}a.P=!1;a.l&&a.l.stop();a.I||(yield a.m.play());tS(a,_.Tb)})}gd(){this.I=!0;this.B.contentComplete()}load(){const a=this;return _.v(function*(){var b=
17
+ a.m;const c=a.H;try{if(typeof c.adTagUrl!==_.Nf)throw new _.J(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.Z.canPlay(!1);const d=yield a.Z.canPlay(!0),e=new google.ima.AdsRequest;e.adTagUrl=c.adTagUrl;e.setAdWillAutoPlay(b);e.setAdWillPlayMuted(d);a.B.getSettings().setAutoPlayAdBreaks(!1);a.B.requestAds(e);return a.f})}j(){if(this.W||!this.a||this.W)return!0;if(!this.ca){if(this.R.Qb())return zS(this),!1;this.ja.initialize();
18
+ yS(this);return!0}return this.pb()&&this.a?(this.a.resume(),!1):!0}A(){}w(){return!0}Ia(){this.a&&this.a.pause()}isPaused(){return this.K}skip(){this.a&&this.a.skip()}getAdVolume(){return this.a?this.C?this.L:this.a.getVolume():1}h(a){this.L=a;this.a&&(this.C||this.a.setVolume(a))}setVolume(a){this.h(a)}getVolume(){return this.getAdVolume()}pause(){this.Ia()}resume(){this.j()}setMuted(a){this.C=a;this.a&&(a?this.a.setVolume(0):this.a.setVolume(this.L))}isMuted(){return this.C}pb(){return this.U}getPosition(){if(!this.a||
19
+ null===this.G)return-1;const a=this.a.getRemainingTime();return 0>a?0:this.G-a}o(){this.a&&(this.a.destroy(),this.a=null);this.W=!0;xS(this);this.S.release();this.l&&(this.l.stop(),this.l=null);return Promise.resolve()}};ES.prototype.getPosition=ES.prototype.getPosition;ES.prototype.resume=ES.prototype.resume;ES.prototype.pause=ES.prototype.pause;ES.prototype.getVolume=ES.prototype.getVolume;ES.prototype.setVolume=ES.prototype.setVolume;ES.prototype.getAdVolume=ES.prototype.getAdVolume;
20
+ ES.prototype.skip=ES.prototype.skip;ES.prototype.pauseAd=ES.prototype.Ia;_.up(new class{constructor(){this.Xa=new _.S(mS)}name(){return mS}a(a,b){return a.namespace()===_.gd?!1:nS()?(this.Xa.warn("IMA SDK is not loaded."),!1):!(!b||!b.ima)}create(a){return new ES(a)}});_.Lr(new DS);};f.call(g, window);
package/cl.mediatailor.js CHANGED
@@ -1,2 +1,2 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var lS=function(a,b,c){return _.v(function*(){var d=yield(yield fetch(b,{method:_.ab,body:JSON.stringify(c.sessionConfig)})).json();const e=d.trackingUrl;d={Og:_.Km(d.manifestUrl,b),Pj:e?_.Km(e,b):null};a.g.info(`Media Tailor session initialized.
2
- - manifest URI: ${d.Og}`);return d})},mS=class extends _.Mv{constructor(){super();this.g=new _.T("clpp.mediatailor.MediaTailorPlugin")}onContentWillLoad(a,b){const c=this;return _.v(function*(){const d=a.getConfiguration().mediatailor;if(d.enabled){c.g.info("MediaTailor plugin is enabled");try{const e=yield lS(c,b.url,d);a.trigger(new _.H("mt-session-started"));b.url=e.Og}catch(e){throw c.g.error("Failed to start session",e),new _.I(_.D,9,7003,"Media Tailor session failed to initialize.");}}})}id(){return"mediatailor"}};_.Kn(new class{create(){return new mS}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var kS=function(a,b,c){return _.v(function*(){var d=yield(yield fetch(b,{method:_.bb,body:JSON.stringify(c.sessionConfig)})).json();const e=d.trackingUrl;d={Mg:_.Cj(d.manifestUrl,b),Pj:e?_.Cj(e,b):null};a.g.info(`Media Tailor session initialized.
2
+ - manifest URI: ${d.Mg}`);return d})},lS=class extends _.Hv{constructor(){super();this.g=new _.S("clpp.mediatailor.MediaTailorPlugin")}onContentWillLoad(a,b){const c=this;return _.v(function*(){const d=a.getConfiguration().mediatailor;if(d.enabled){c.g.info("MediaTailor plugin is enabled");try{const e=yield kS(c,b.url,d);a.trigger(new _.H("mt-session-started"));b.url=e.Mg}catch(e){throw c.g.error("Failed to start session",e),new _.J(_.C,9,7003,"Media Tailor session failed to initialize.");}}})}id(){return"mediatailor"}};_.Lr(new class{create(){return new lS}});};f.call(g, window);