@castlabs/prestoplay 6.28.0 → 6.30.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 (66) hide show
  1. package/CHANGELOG.md +37 -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 +128 -116
  6. package/cjs/cl.conviva.js +32 -32
  7. package/cjs/cl.core.js +619 -614
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +92 -89
  10. package/cjs/cl.externs.js +154 -60
  11. package/cjs/cl.freewheel.js +25 -25
  12. package/cjs/cl.hls.js +77 -77
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +30 -30
  15. package/cjs/cl.ima.js +25 -23
  16. package/cjs/cl.mediatailor.js +3 -3
  17. package/cjs/cl.mse.js +350 -349
  18. package/cjs/cl.muxdata.js +14 -14
  19. package/cjs/cl.onboard.js +4 -4
  20. package/cjs/cl.persistent.js +15 -15
  21. package/cjs/cl.playlist.js +6 -6
  22. package/cjs/cl.simid.js +16 -16
  23. package/cjs/cl.smooth.js +57 -58
  24. package/cjs/cl.thumbnails.js +26 -26
  25. package/cjs/cl.tizen.js +60 -60
  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 +38 -38
  33. package/cjs/polyfill.min.js +2 -2
  34. package/cl.adobe.js +3 -3
  35. package/cl.airplay.js +3 -3
  36. package/cl.broadpeak.js +6 -6
  37. package/cl.cast.js +101 -92
  38. package/cl.conviva.js +27 -27
  39. package/cl.core.js +500 -496
  40. package/cl.crypto.js +9 -9
  41. package/cl.dash.js +84 -83
  42. package/cl.externs.js +150 -60
  43. package/cl.freewheel.js +19 -19
  44. package/cl.hls.js +82 -80
  45. package/cl.hlssmpte.js +5 -5
  46. package/cl.htmlcue.js +26 -26
  47. package/cl.ima.js +19 -17
  48. package/cl.mediatailor.js +2 -2
  49. package/cl.mse.js +304 -305
  50. package/cl.muxdata.js +13 -13
  51. package/cl.onboard.js +4 -4
  52. package/cl.persistent.js +11 -11
  53. package/cl.playlist.js +5 -5
  54. package/cl.simid.js +14 -14
  55. package/cl.smooth.js +60 -60
  56. package/cl.thumbnails.js +19 -19
  57. package/cl.tizen.js +56 -56
  58. package/cl.ttml.js +22 -22
  59. package/cl.verimatrix.js +4 -4
  60. package/cl.vimond.js +8 -8
  61. package/cl.vr.js +14 -14
  62. package/cl.vtt.js +12 -12
  63. package/cl.yospace.js +3 -3
  64. package/cl.youbora.js +31 -31
  65. package/package.json +1 -1
  66. package/typings.d.ts +198 -88
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 _.bi(a,{Pf:(b,c)=>b.Ic(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===_.fu},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 _.fu:return"horizontal-tb";case _.vg:return _.vg;case _.wg:return _.wg;default:throw Error("Unknown writing mode");}},gT=function(a){switch(a.f.positionAlign){case _.le:return _.ie;case "auto":case _.Vc:return _.eu;case _.me:return _.Af}return a.f.textAlign},hT=function(a,b){if(typeof a.f.position===_.r&&typeof a.f.size===
6
- _.r)switch(b){case _.le:return a.f.position;case "auto":case _.Vc:return a.f.position-a.f.size/2;case _.me:return a.f.position-a.f.size}return 0},iT=function(a){if(!a.f.positionAlign)switch(a.f.textAlign){case _.Of:case _.ie:return _.le;case _.eu:return _.Vc;case _.Ud:case _.Af:return _.me}return a.f.positionAlign},lT=function(a,b,c){return(jT(a)||kT(a))&&_.jh(c)?TS(c,_.tf):jT(a)&&_.z(c)?TS(0,_.tf):dT(a)&&_.jh(b)?TS(b,"%"):KS},mT=function(a,b,c){return dT(a)&&_.jh(c)?TS(c,_.tf):(jT(a)||kT(a))&&_.jh(b)?
7
- TS(b,"%"):KS},kT=function(a){return a.f.writingMode===_.wg},jT=function(a){return a.f.writingMode===_.vg},nT=function(a,b){if(a.j)switch(b.writingMode){case _.fu:return["-y"];case _.vg:return["+x"];case _.wg:return["-x"]}a=[];switch(b.writingMode){case _.fu:a=["+y","-y"];break;case _.vg:a=["+x","-x"];break;case _.wg: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===_.mu)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(_.Uf),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=_.ch(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:_.ut(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 _.Dg:g="clpp-text-vtt";break;case _.hg:g=IS;break;case _.du:g=HS}g&&!f.classList.contains(g)&&
12
- _.Di(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===_.Dg;var h=d.payloadType===_.hg;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=_.Fi(_.Dd),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=_.Fi(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)_.Di(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===_.hg){var c=_.Fi(_.Dd);c.innerHTML=b.payload;b=c}else b.payloadType===
17
- _.Dg?b=(new HT).parse(b.payload):(c=_.Fi(_.Dd),c.textContent=b.payload,b=c);_.Di(b,this.w);this.id&&(b.id=this.id);for(d of this.f.cssClassList)_.Di(b,d);RS({writingMode:fT(this)},b);var d=b;this.a.appendChild(d);_.Di(this.a,"clpp-text-wrapper");for(var e of this.f.cssClassList)_.Di(this.a,`clpp-text-wrapper__${e}`);_.z(this.f.line)&&(this.f.lineInterpretation=_.gu,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,_.tf):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===_.gu){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 _.Vc:g-=f/2;break;case _.Ud: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,_.tf):KS,top:mT(this,e,a)},this.a)}SS(this.C,d)}}o(){return _.Fi(_.Dd)}};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=_.be;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,_.tf),bottom:TS(this.a.a-c.a,_.tf),left:TS(c.left-this.a.left,_.tf),right:TS(this.a.f-c.f,_.tf),height:TS(c.height,_.tf),width:TS(c.width,_.tf)},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=_.Fi(_.Dd);_.Di(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 _.mu:b=b.width/100*a.width;break a;default:throw Error(GS);}}var c=this.f;var d=c.viewportAnchorUnits;if(d===_.mu)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,_.tf),top:TS(e,_.tf),width:TS(b,
21
- _.tf),height:TS(d,_.tf)},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)_.Di(this.a,f);a:switch(f=this.f,f.heightUnits){case 0:f=f.height;break a;case _.mu:f=f.height/100*a.height;break a;case 2:f=f.height;c=new AT(new _.ju(0,1,"Lorem ipsum",_.du),{},{});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,_.tf),height:TS(f,_.tf)},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 _.S("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 _.w(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 _.Av{constructor(a){super(a);this.g=new _.S(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 _.wv(a.getSurface(),this.T.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 _.Mi(()=>{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 _.w(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.zb(.25),this.L.enableResizeObserver&&this.A.start(),BT(this,!0)):(this.G.stop(),this.A.stop(),CT(this)))}T(){BT(this,!0)}};_.x(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&&!_.bj()}create(a){return new MT(a)}};_.x("clpp.htmlcue.HtmlCueComponent",class extends _.rv{install(){_.bs(_.de,new NT)}uninstall(){_.$r.has(_.de)&&(_.$r.delete(_.de),_.as.info("Removed factory: 'html'"))}id(){return _.Vf}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var AS="Unsupported unit",BS="clpp-text-plain",CS="clpp-text-ttml",DS="clpp.htmlcue.HtmlTextDisplayer",ES="initial",FS=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},GS=function(a){return _.ci(a,{$f:(b,c)=>b.Oc(c)})},HS=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)},IS=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},KS=function(a){let b=null;for(;b=a.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)a=a.replace(b[0],c=>JS[c]);return a},MS=function(a,b){LS(a,b);Array.from(b.getElementsByTagName("*")).forEach(c=>{LS(a,c)})},LS=function(a,b){for(const c in a)null!=a[c]&&(b.style[c]=a[c])},NS=function(a,b){return 0===a?"0":a+b},OS=function(a,b){return 1>Math.abs(a-b)||a<b},PS=function(a,b){return a<b&&1<Math.abs(a-b)},QS=function(a,b){return a>b&&1<Math.abs(a-b)},RS=
3
+ function(a,b){return 1>Math.abs(a-b)||a>b},TS=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 SS(b.left+d,b.right+e,g,(b.bottom||g+f)+c,f,(b.width||a.offsetWidth)-
4
+ d-e)},US=function(a){return new SS(a.left,a.f,a.top,a.a,a.height,a.width)},VS=function(a,b){return b.some(c=>PS(a.left,c.f)&&QS(a.f,c.left)&&PS(a.top,c.a)&&QS(a.a,c.top))},WS=function(a,b){return RS(a.top,b.top)&&OS(a.a,b.a)&&RS(a.left,b.left)&&OS(a.f,b.f)},XS=function(a,b,c){switch(c){case "+x":return PS(a.left,b.left);case "-x":return QS(a.f,b.f);case "+y":return PS(a.top,b.top);case "-y":return QS(a.a,b.a);default:throw Error("Unknown axis");}},YS=function(a){return a.f.writingMode===_.ku},ZS=
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 YS(a)?b:c},$S=function(a){switch(a.f.writingMode){case _.ku:return"horizontal-tb";case _.wg:return _.wg;case _.xg:return _.xg;default:throw Error("Unknown writing mode");}},aT=function(a){switch(a.f.positionAlign){case _.me:return _.je;case "auto":case _.Xc:return _.ju;case _.ne:return _.Bf}return a.f.textAlign},bT=function(a,b){if(typeof a.f.position===_.r&&typeof a.f.size===
6
+ _.r)switch(b){case _.me:return a.f.position;case "auto":case _.Xc:return a.f.position-a.f.size/2;case _.ne:return a.f.position-a.f.size}return 0},cT=function(a){if(!a.f.positionAlign)switch(a.f.textAlign){case _.Pf:case _.je:return _.me;case _.ju:return _.Xc;case _.Vd:case _.Bf:return _.ne}return a.f.positionAlign},fT=function(a,b,c){return(dT(a)||eT(a))&&_.kh(c)?NS(c,_.uf):dT(a)&&_.z(c)?NS(0,_.uf):YS(a)&&_.kh(b)?NS(b,"%"):ES},gT=function(a,b,c){return YS(a)&&_.kh(c)?NS(c,_.uf):(dT(a)||eT(a))&&_.kh(b)?
7
+ NS(b,"%"):ES},eT=function(a){return a.f.writingMode===_.xg},dT=function(a){return a.f.writingMode===_.wg},hT=function(a,b){if(a.j)switch(b.writingMode){case _.ku:return["-y"];case _.wg:return["+x"];case _.xg:return["-x"]}a=[];switch(b.writingMode){case _.ku:a=["+y","-y"];break;case _.wg:a=["+x","-x"];break;case _.xg:a=["-x","+x"]}0>b.line&&(a=a.reverse());return a},iT=function(a){for(a.h=[];0<a.f.childNodes.length;)a.f.removeChild(a.f.childNodes[0]);a.a=TS(a.l.a)},jT=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(AS);},lT=function(a,b,c,d){const e=document.createElement(_.Vf),f=e.dataset;f.name=b;f.for=c;d&&(f.name=`${b} (sandbox)`,f.sandbox=!0);c=document.head;c.appendChild(e);kT(a,c,b);a.g.debug(`Created HTML style element #${b}.`);return e.sheet},mT=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)},nT=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},oT=function(a){if(null!=a.a){for(;0<a.a.cssRules.length;)a.a.deleteRule(0);
10
+ a.o=[]}},kT=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())},pT=function(a){a=_.dh(a.htmlcue||{});_.z(a.stretchSmpteImage)&&(a.stretchSmpteImage=!1);_.z(a.enableResizeObserver)&&(a.enableResizeObserver=!0);return a},vT=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=qT(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,rT(a),c)){b={color:a.getFontColor()||void 0,backgroundColor:a.getBackgroundColor()||void 0,fontFamily:a.getFontFamily()||void 0,textShadow:_.At(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 _.Eg:g="clpp-text-vtt";break;case _.ig:g=CS;break;case _.iu:g=BS}g&&!f.classList.contains(g)&&
12
+ _.Ci(f,g);f=TS(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{LS({fontSize:sT(c,d.containerRows)},c.a.a);f=null;g=d.payloadType===_.Eg;var h=d.payloadType===_.ig;d.region&&(g||h||d.backgroundImage)&&(c.B.has(d.region.id)?f=c.B.get(d.region.id):(f=new tT(d.region,{}),c.B.set(d.region.id,f),c.a.appendChild(f)));d=new uT(d,c.L,e);f?f.appendChild(d):
13
+ c.a.appendChild(d)}}}}},wT=function(a){rT(a);a.J=null;a.o=null;a.f=[]},xT=function(a,b){return a.startTime<=b&&a.endTime>b},qT=function(a,b){var c=FS(a.f,d=>xT(d,b)?0:b!==d.startTime?b-d.startTime:b-d.endTime);if(-1===c)return null;{let d=c;for(;0<=d-1&&xT(a.f[d-1],b);)d--;for(;c+1<a.f.length&&xT(a.f[c+1],b);)c++;return{start:d,end:c}}},rT=function(a){a.B.clear();if(a.a){const b=a.a.a;b.classList.remove("clpp-text-vtt");b.classList.remove(CS);b.classList.remove(BS);a=a.a;iT(a.h);a.l=[]}},sT=function(a,
14
+ b){const c=TS(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`},BT=class{parse(a){a={input:a};const b=_.Ei(_.Fd),c=[];let d=b;for(var e;null!==(e=IS(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=yT[f];h?(h=_.Ei(h),(f=zT[f])&&g&&h.setAttribute(f,g.trim()),g=h):g=null;!g||AT[g.localName]&&AT[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(KS(e)));return b}},yT={c:"c",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"v",lang:"lang"},zT={v:"voice",lang:"lang"},AT={rt:"ruby"},JS={"\x26amp;":"\x26","\x26lt;":"\x3c","\x26gt;":"\x3e","\x26lrm;":"\u200e","\x26rlm;":"\u200f",
16
+ "\x26nbsp;":"\u00a0"};var SS=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 CT=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 uT=class extends CT{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)_.Ci(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===_.ig){var c=_.Ei(_.Fd);c.innerHTML=b.payload;b=c}else b.payloadType===
17
+ _.Eg?b=(new BT).parse(b.payload):(c=_.Ei(_.Fd),c.textContent=b.payload,b=c);_.Ci(b,this.w);this.id&&(b.id=this.id);for(d of this.f.cssClassList)_.Ci(b,d);LS({writingMode:$S(this)},b);var d=b;this.a.appendChild(d);_.Ci(this.a,"clpp-text-wrapper");for(var e of this.f.cssClassList)_.Ci(this.a,`clpp-text-wrapper__${e}`);_.z(this.f.line)&&(this.f.lineInterpretation=_.lu,this.f.line=YS(this)?-1:0);e=$S(this);LS({writingMode:e,webkitWritingMode:e,direction:ES,textAlign:aT(this)},this.a);if(!this.f.region||
18
+ !this.f.region.displayAlign){e=bT(this,cT(this));LS({position:"absolute",left:fT(this,e,null),right:eT(this)&&_.z(null)?NS(0,_.uf):ES,top:gT(this,e,null),width:YS(this)?NS(this.f.size,"%"):ES,height:dT(this)||eT(this)?NS(this.f.size,"%"):ES},this.a);b=this.f;a=YS(this)?a.height:a.width;c=ZS(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 _.Xc:g-=f/2;break;case _.Vd:g-=f}f=Math.round(g/
19
+ 100*a)}eT(this)&&(f=a-f-c);a=f;LS({left:fT(this,e,a),right:eT(this)&&_.z(a)?NS(0,_.uf):ES,top:gT(this,e,a)},this.a)}MS(this.C,d)}}o(){return _.Ei(_.Fd)}};var DT=class{constructor(a,b){this.l=a;this.f=a.a;this.j=void 0===b?!1:b;this.a=TS(a.a);this.h=[]}append(a){const b=a.a;b.style.visibility=_.ce;this.f.appendChild(b);a.j||a.init(this.a);if(a.A()){a:{var c=TS(a.a);var d=hT(this,a.f),e=ZS(a);const g=US(c);let h=null,k=0;for(const l of d){for(;XS(c,this.a,l)||WS(c,this.a)&&VS(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||WS(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=US(c),k=d);c=US(g)}c=h||g}LS({top:NS(c.top-this.a.top,_.uf),bottom:NS(this.a.a-c.a,_.uf),left:NS(c.left-this.a.left,_.uf),right:NS(this.a.f-c.f,_.uf),height:NS(c.height,_.uf),width:NS(c.width,_.uf)},a.a)}b.style.visibility="visible";this.h.push(TS(a.a))}};var ET=class extends CT{constructor(a,b,c){super(a,b,c);this.h=null;this.l=[]}init(){this.h=new DT(this);this.j=!0}o(){const a=_.Ei(_.Fd);_.Ci(a,this.w);this.id&&(a.id=this.id);return a}appendChild(a){iT(this.h);this.l.unshift(a);for(const b of this.l)this.h.append(b)}};var tT=class extends ET{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(AS);}}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(AS);d=a.height;const e=jT(this,d,a.height);LS(this.B,this.a);LS({left:NS(c,_.uf),top:NS(e,_.uf),width:NS(b,
21
+ _.uf),height:NS(d,_.uf)},this.a);this.f.writingMode&&LS({display:"flex","flex-direction":this.f.writingMode},this.a);this.f.displayAlign&&LS({"justify-content":this.f.displayAlign},this.a);for(var f of this.f.cssClassList)_.Ci(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 uT(new _.ou(0,1,"Lorem ipsum",_.iu),{},{});b=c.a;this.a.appendChild(b);c.init(TS(this.a));c=b.getBoundingClientRect().height;this.a.removeChild(b);
22
+ b=c;f*=b;break a;default:throw Error(AS);}a=jT(this,f,a.height);LS({top:NS(a,_.uf),height:NS(f,_.uf)},this.a);this.h=new DT(this,!0);this.j=!0}getId(){return this.f.id}};var FT=class{constructor(a,b){this.g=new _.T("clpp.htmlcue.StyleManager");this.l=[];this.j=a;this.h=b;this.o=[];this.a=lT(this,this.h,this.j);this.f=lT(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=mT(this,a);if(nT(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 _.w(function*(){null!=a.a&&(a.l.forEach(b=>b()),a.l=[],oT(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 GT=class extends _.Gv{constructor(a){super(a);this.g=new _.T(DS);this.m=a;this.L=pT(a.getConfiguration());this.l=!1;this.f=[];this.F=a.getSurface().getContainer();this.j=new FT(a.getSurface().getUniqueCssClass(),"CLPP Subtitle Styles");this.a=new ET(null,"clpp-text-container",{});this.A=new _.Cv(a.getSurface(),this.T.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 _.Li(()=>{vT(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=HS(this.f,GS(a));this.o=null;vT(this,!1)}}h(){null==this.j||vT(this,!0)}destroy(){const a=this;return _.w(function*(){null!=a.j&&(wT(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;vT(this,!0);return!0}isTextVisible(){return this.l}setTextVisibility(a){null!=this.j&&this.l!==a&&((this.l=a)?(this.G.Ab(.25),this.L.enableResizeObserver&&this.A.start(),vT(this,!0)):(this.G.stop(),this.A.stop(),wT(this)))}T(){vT(this,!0)}};_.x(DS,GT);GT.prototype.setTextVisibility=GT.prototype.setTextVisibility;GT.prototype.isTextVisible=GT.prototype.isTextVisible;GT.prototype.remove=GT.prototype.remove;GT.prototype.destroy=GT.prototype.destroy;
26
+ GT.prototype.append=GT.prototype.append;var HT=class{a(a){return!!a.enableHtmlCue&&!_.aj()}create(a){return new GT(a)}};_.x("clpp.htmlcue.HtmlCueComponent",class extends _.yv{install(){_.gs(_.ee,new HT)}uninstall(){_.es.has(_.ee)&&(_.es.delete(_.ee),_.fs.info("Removed factory: 'html'"))}id(){return _.Wf}});};f.call(g, window);
package/cl.ima.js CHANGED
@@ -1,17 +1,19 @@
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.K;const b=new google.ima.AdsRenderingSettings;b.restoreCustomPlaybackStateOnAdBreakComplete=!1;typeof a.bitrate===_.r&&(b.bitrate=a.bitrate);b.enablePreloading=typeof a.enablePreloading===_.Lc?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===_.Lc&&(b.useStyledLinearAds=a.useStyledLinearAds);b.uiElements=Array.isArray(a.uiElements)?a.uiElements:[];return b},qS=function(a){return!1===a.K.disableCustomPlayback&&a.a.isCustomPlaybackUsed()&&_.Qi()||_.Ti()},rS=function(a){const b=a.a,c=a.H,d=google.ima.AdEvent.Type;c.on(b,d.AD_BREAK_READY,a.Ua.bind(a));c.on(b,d.LOADED,a.ba.bind(a));c.on(b,d.CONTENT_PAUSE_REQUESTED,a.qc.bind(a));c.on(b,d.STARTED,a.ia.bind(a));c.on(b,
3
- d.LOG,a.Bb.bind(a));c.on(b,d.AD_PROGRESS,a.da.bind(a));c.on(b,d.AD_BUFFERING,a.Za.bind(a));c.on(b,d.FIRST_QUARTILE,a.V.bind(a));c.on(b,d.MIDPOINT,a.ic.bind(a));c.on(b,d.THIRD_QUARTILE,a.ya.bind(a));c.on(b,d.PAUSED,a.jc.bind(a));c.on(b,d.RESUMED,a.kc.bind(a));c.on(b,d.CLICK,a.T.bind(a));c.on(b,d.SKIPPED,a.ha.bind(a));c.on(b,d.IMPRESSION,a.Y.bind(a));c.on(b,d.COMPLETE,a.Ab.bind(a));c.on(b,d.CONTENT_RESUME_REQUESTED,a.sc.bind(a))},sS=function(a,b){const c=b?a.Ta.create(b.getErrorCode()):null;a.m.onError(new _.H(1,
4
- 9,10003,{errorType:c},b))},tS=function(a){return _.w(function*(){yield a.m.detach();var b=a.m;b.a&&b.a.stopForwardingEventsTo(b)})},uS=function(a,b,c){c=c&&c.getAd();let d=null;c&&(d={ad:new W(c,a.G,a.F)});a.m.trigger(new _.G(b,d))},vS=function(a){a.B=null;uS(a,_.lc);a.m.getSurface().hide(a.P)},wS=function(a){return _.w(function*(){return new Promise(b=>{a.H.on(a.m,_.Pf,()=>{4===a.m.getState()&&b()})})})},xS=function(a){_.Ei(a.A,{visibility:"visible"})},zS=function(a){return _.w(function*(){a.R.initialize();
5
- const b=!!a.m.getConfiguration().muted;(yield a.L.canPlay(b))||qS(a)?(qS(a)&&(yield tS(a)),yS(a)):(uS(a,_.Jc),a.g.warn(_.ka))})},AS=function(a,b){return _.w(function*(){a.R.initialize();yield b.play();yS(a)})},yS=function(a){a.a.init(a.A.offsetWidth,a.A.offsetHeight,google.ima.ViewMode.NORMAL);a.a.start();a.M=!0},W=class{constructor(a,b,c){this.a=a;this.f=a.getAdPodInfo();this.j=b;this.h=c}lb(){return"Google IMA SDK"}nb(){return google.ima.VERSION}sb(){return 0}getId(){return this.a.getAdId()}getCreativeId(){return this.a.getCreativeId()}Nb(){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()}Qb(){return this.f?
6
- this.f.getIsBumper():!1}ob(){let a=null;const b=this.a,c=Object.keys(b).find(d=>typeof b[d]===_.Ge&&typeof b[d].clickThroughUrl===_.Sf);c&&(a=b[c].clickThroughUrl);return a}getMediaUrl(){return this.a.getMediaUrl()}cb(){return this.a.getVastMediaWidth()}bb(){return this.a.getVastMediaHeight()}Na(){return this.a.getVastMediaBitrate()}Oa(){return this.h?2:this.j?1:0}getPodIndex(){return this.f?this.f.getPodIndex():0}Fb(){return this.f?this.f.getTimeOffset():0}qb(){return this.f?this.f.getAdPosition():
7
- 1}eb(){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()}Pb(){return null}};W.prototype.getVideoElement=W.prototype.Pb;W.prototype.getWrapperCreativeIds=W.prototype.getWrapperCreativeIds;W.prototype.getWrapperAdSystems=W.prototype.getWrapperAdSystems;W.prototype.canSeek=W.prototype.canSeek;W.prototype.getWrapperAdIds=W.prototype.getWrapperAdIds;
8
- W.prototype.getSequenceLength=W.prototype.eb;W.prototype.getPositionInSequence=W.prototype.qb;W.prototype.getPodTimeOffset=W.prototype.Fb;W.prototype.getPodIndex=W.prototype.getPodIndex;W.prototype.getPodType=W.prototype.Oa;W.prototype.getMediaBitrate=W.prototype.Na;W.prototype.getMediaHeight=W.prototype.bb;W.prototype.getMediaWidth=W.prototype.cb;W.prototype.getMediaUrl=W.prototype.getMediaUrl;W.prototype.getClickThroughUrl=W.prototype.ob;W.prototype.isBumper=W.prototype.Qb;
9
- 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.Nb;W.prototype.getCreativeId=W.prototype.getCreativeId;W.prototype.getId=W.prototype.getId;
10
- W.prototype.getTechnology=W.prototype.sb;W.prototype.getAdManagerVersion=W.prototype.nb;W.prototype.getAdManagerName=W.prototype.lb;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}Hb(){return 0<=this.a.indexOf(0)||0===this.a.length}Gb(){return 0<=this.a.indexOf(-1)}};CS.prototype.hasPostroll=CS.prototype.Gb;CS.prototype.hasPreroll=CS.prototype.Hb;CS.prototype.getCuePoints=CS.prototype.getCuePoints;var DS=class extends _.Iv{constructor(){super();this.a=this.h=this.f=null}onPlayerCreated(a){if(oS())return a.onError(new _.H(1,9,1E4));this.f=_.Ci(_.Dd,{"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&&
11
- (this.a.destroy(),this.a=null);this.h&&(this.h.destroy(),this.h=null);this.f&&(a.getSurface().removeElementFromContainer(this.f),this.f=null)}Dh(){return this.a}Bh(){return this.h}Jc(){return this.f}id(){return"ima"}};_.x("clpp.ima.ImaPlugin",DS);DS.prototype.getAdContainer=DS.prototype.Jc;DS.prototype.getAdDisplayContainer=DS.prototype.Bh;DS.prototype.getAdsLoader=DS.prototype.Dh;DS.Id="ima";DS.isSdkMissing=oS;var ES=class{create(){return new DS}};var FS=class{constructor(a){var b=a.ed("ima");if(!b)throw Error("IMA plugin not created.");var c=b.Jc(),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.A=e;a=this.m.getConfiguration();a=_.ch(a.ima||{});this.K=a=_.bh({disableCustomPlayback:!1},a);this.P=c;this.R=d;this.w=b;this.L=new _.yv;this.g=new _.S("clpp.ima");this.j=this.a=null;this.f=new _.Tl;this.M=!1;this.H=new _.Gt;this.Ta=new BS;
12
- this.B=null;this.J=this.F=this.G=!1;this.I=this.C=null;c=this.H;d=google.ima.AdErrorEvent.Type.AD_ERROR;c.one(this.w,google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.nc.bind(this));c.on(this.w,d,this.lc.bind(this));c.on(this.m,_.Vd,this.oc.bind(this))}nc(a){this.a=a.getAdsManager(this.A,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 _.H(1,9,10002)),this.h()):(this.j=new _.wv(this.m.getSurface(),
13
- (b,c,d)=>{this.a.resize(b,c,d?google.ima.ViewMode.FULLSCREEN:google.ima.ViewMode.NORMAL)}),a=this.a.getCuePoints(),this.C=new CS(a),this.m.trigger(new _.G(_.oc,{adsTimeline:this.C})),rS(this));this.f.resolve()}lc(a){sS(this,a.getError());this.f.resolve()}qc(a){const b=this;return _.w(function*(){b.J=!0;qS(b)?(b.I=b.m.getPosition(),yield tS(b)):(yield b.m.pause(),_.Ei(b.A,{visibility:_.be}));uS(b,_.Rb,a);b.j.start()})}Ua(){const a=this;return _.w(function*(){a.a.start()})}ba(a){a.getAd().isLinear()?
14
- uS(this,_.ec,a):(this.a.discardAdBreak(),this.G||(this.G=!0,this.m.play()))}ia(a){this.B=a.getAd().getDuration();uS(this,_.kc,a);this.m.getSurface().show(this.P)}Bb(a){a=a.getAdData();sS(this,a?a.adError:null);vS(this)}da(a){uS(this,_.hc,a)}Za(a){uS(this,_.Tb,a)}V(a){uS(this,_.Wb,a)}ic(a){uS(this,_.fc,a)}ya(a){uS(this,_.mc,a)}jc(a){uS(this,_.gc,a)}kc(a){uS(this,_.ic,a)}T(a){this.pause();uS(this,_.Ub,a)}ha(a){uS(this,_.jc,a);vS(this)}Y(a){uS(this,_.cc,a)}Ab(a){uS(this,_.Vb,a);vS(this)}sc(){const a=
15
- this;return _.w(function*(){a.G=!0;if(qS(a)&&null!==a.I){var b=a.m;b.a&&b.a.forwardEventsTo(b);yield _.eo(a.m);!a.F&&a.I&&(yield wS(a),yield a.m.seek(a.I))}else{if(!a.J)return a.m.play();xS(a)}a.J=!1;a.j&&a.j.stop();a.F||(yield a.m.play());uS(a,_.Sb)})}oc(){this.F=!0;this.w.contentComplete()}load(){const a=this;return _.w(function*(){var b=a.m;const c=a.K;try{if(typeof c.adTagUrl!==_.Sf)throw new _.H(1,9,10001,{missingKeys:"adTagUrl"});}catch(f){return b.onError(f),a.f.resolve(),a.f}if(!c.adTagUrl)return a.f.resolve(),
16
- a.f;b=yield a.L.canPlay(!1);const d=yield a.L.canPlay(!0),e=new google.ima.AdsRequest;e.adTagUrl=c.adTagUrl;e.setAdWillAutoPlay(b);e.setAdWillPlayMuted(d);a.w.getSettings().setAutoPlayAdBreaks(!1);a.w.requestAds(e);return a.f})}start(a){const b=this;return _.w(function*(){b.a&&b.C&&!b.M?b.C.Hb()?yield zS(b):yield AS(b,a):yield a.play()})}o(){}l(){return!0}resume(){this.a&&this.a.resume()}pause(){this.a&&this.a.pause()}skip(){this.a&&this.a.skip()}getVolume(){return this.a?this.a.getVolume():1}setVolume(a){this.a&&
17
- this.a.setVolume(a)}getPosition(){if(!this.a||null===this.B)return-1;const a=this.a.getRemainingTime();return 0>a?0:this.B-a}h(){this.a&&(this.a.destroy(),this.a=null);xS(this);this.H.release();this.j&&(this.j.stop(),this.j=null);return Promise.resolve()}};FS.prototype.getPosition=FS.prototype.getPosition;FS.prototype.setVolume=FS.prototype.setVolume;FS.prototype.getVolume=FS.prototype.getVolume;FS.prototype.skip=FS.prototype.skip;FS.prototype.pause=FS.prototype.pause;FS.prototype.resume=FS.prototype.resume;_.Eh(new class{constructor(){this.Qa=new _.S(nS)}name(){return nS}a(a,b){return a.namespace()===_.fd?!1:oS()?(this.Qa.warn("IMA SDK is not loaded."),!1):!(!b||!b.ima)}create(a){return new FS(a)}});_.Ln(new ES);};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var hS="clpp.ima.AdsManagerFactory",iS=function(){return!window.google||!google.ima||!google.ima.AdsLoader},jS=function(a){a=a.F;const b=new google.ima.AdsRenderingSettings;b.restoreCustomPlaybackStateOnAdBreakComplete=!1;typeof a.bitrate===_.r&&(b.bitrate=a.bitrate);b.enablePreloading=typeof a.enablePreloading===_.Nc?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===_.Nc&&(b.useStyledLinearAds=a.useStyledLinearAds);b.uiElements=Array.isArray(a.uiElements)?a.uiElements:[];return b},kS=function(a){return!1===a.F.disableCustomPlayback&&a.a.isCustomPlaybackUsed()&&(_.Pi()||_.Si())},lS=function(a){const b=a.a,c=a.L,d=google.ima.AdEvent.Type;c.on(b,d.AD_BREAK_READY,a.Bb.bind(a));c.on(b,d.LOADED,a.ga.bind(a));c.on(b,d.CONTENT_PAUSE_REQUESTED,a.yc.bind(a));c.on(b,d.STARTED,a.Ua.bind(a));c.on(b,
3
+ d.LOG,a.Nb.bind(a));c.on(b,d.AD_PROGRESS,a.ia.bind(a));c.on(b,d.AD_BUFFERING,a.Cb.bind(a));c.on(b,d.FIRST_QUARTILE,a.ba.bind(a));c.on(b,d.MIDPOINT,a.oc.bind(a));c.on(b,d.THIRD_QUARTILE,a.Va.bind(a));c.on(b,d.PAUSED,a.pc.bind(a));c.on(b,d.RESUMED,a.rc.bind(a));c.on(b,d.CLICK,a.Y.bind(a));c.on(b,d.SKIPPED,a.Aa.bind(a));c.on(b,d.IMPRESSION,a.ca.bind(a));c.on(b,d.COMPLETE,a.Mb.bind(a));c.on(b,d.CONTENT_RESUME_REQUESTED,a.zc.bind(a))},mS=function(a,b){const c=b?a.$a.create(b.getErrorCode()):null;a.m.onError(new _.I(1,
4
+ 9,10003,{errorType:c},b))},nS=function(a,b,c){c=c&&c.getAd();let d=null;c&&(d={ad:new W(c,a.H,a.G)});a.m.trigger(new _.H(b,d))},qS=function(a){_.w(function*(){a.I=a.m.getPosition();yield oS(a,3);yield a.m.pause();yield pS(a);a.a.start()})},oS=function(a,b){return _.w(function*(){return new Promise((c,d)=>{const e=setTimeout(()=>{clearInterval(f);d(Error("Timeout waiting for player state"))},1E4),f=setInterval(()=>{a.m.getState()>=b&&(clearInterval(f),clearTimeout(e),c())},200)})})},pS=function(a){return _.w(function*(){yield a.m.detach();
5
+ var b=a.m;b.a&&b.a.stopForwardingEventsTo(b)})},rS=function(a){a.C=null;nS(a,_.mc);a.m.getSurface().hide(a.R)},sS=function(a){_.Di(a.B,{visibility:"visible"})},uS=function(a){_.w(function*(){a.T.initialize();const b=!!a.m.getConfiguration().muted;(yield a.M.canPlay(b))||kS(a)?tS(a):(nS(a,_.Lc),a.g.warn(_.ka))})},tS=function(a){a.a.init(a.B.offsetWidth,a.B.offsetHeight,google.ima.ViewMode.NORMAL);kS(a)?a.F.isVast&&qS(a):a.a.start();a.P=!0},W=class{constructor(a,b,c){this.a=a;this.f=a.getAdPodInfo();
6
+ this.j=b;this.h=c}nb(){return"Google IMA SDK"}ob(){return google.ima.VERSION}ub(){return 0}getId(){return this.a.getAdId()}getCreativeId(){return this.a.getCreativeId()}Qb(){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()}Ub(){return this.f?
7
+ this.f.getIsBumper():!1}pb(){let a=null;const b=this.a,c=Object.keys(b).find(d=>typeof b[d]===_.He&&typeof b[d].clickThroughUrl===_.Tf);c&&(a=b[c].clickThroughUrl);return a}getMediaUrl(){return this.a.getMediaUrl()}eb(){return this.a.getVastMediaWidth()}cb(){return this.a.getVastMediaHeight()}Pa(){return this.a.getVastMediaBitrate()}Qa(){return this.h?2:this.j?1:0}getPodIndex(){return this.f?this.f.getPodIndex():0}Hb(){return this.f?this.f.getTimeOffset():0}rb(){return this.f?this.f.getAdPosition():
8
+ 1}fb(){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()}Sb(){return null}};W.prototype.getVideoElement=W.prototype.Sb;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.fb;W.prototype.getPositionInSequence=W.prototype.rb;W.prototype.getPodTimeOffset=W.prototype.Hb;W.prototype.getPodIndex=W.prototype.getPodIndex;W.prototype.getPodType=W.prototype.Qa;W.prototype.getMediaBitrate=W.prototype.Pa;W.prototype.getMediaHeight=W.prototype.cb;W.prototype.getMediaWidth=W.prototype.eb;W.prototype.getMediaUrl=W.prototype.getMediaUrl;W.prototype.getClickThroughUrl=W.prototype.pb;W.prototype.isBumper=W.prototype.Ub;
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.Qb;W.prototype.getCreativeId=W.prototype.getCreativeId;W.prototype.getId=W.prototype.getId;
11
+ W.prototype.getTechnology=W.prototype.ub;W.prototype.getAdManagerVersion=W.prototype.ob;W.prototype.getAdManagerName=W.prototype.nb;var vS=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 wS=class{constructor(a){this.a=a}getCuePoints(){return this.a}Jb(){return 0<=this.a.indexOf(0)||0===this.a.length}Ib(){return 0<=this.a.indexOf(-1)}};wS.prototype.hasPostroll=wS.prototype.Ib;wS.prototype.hasPreroll=wS.prototype.Jb;wS.prototype.getCuePoints=wS.prototype.getCuePoints;var xS=class extends _.Ov{constructor(){super();this.a=this.h=this.f=null}onPlayerCreated(a){if(iS())return a.onError(new _.I(1,9,1E4));this.f=_.Bi(_.Fd,{"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)}Rh(){return this.a}Ph(){return this.h}Pc(){return this.f}id(){return"ima"}};_.x("clpp.ima.ImaPlugin",xS);xS.prototype.getAdContainer=xS.prototype.Pc;xS.prototype.getAdDisplayContainer=xS.prototype.Ph;xS.prototype.getAdsLoader=xS.prototype.Rh;xS.Id="ima";xS.isSdkMissing=iS;var yS=class{create(){return new xS}};var zS=class{constructor(a){var b=a.md("ima");if(!b)throw Error("IMA plugin not created.");var c=b.Pc(),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.B=e;a=this.m.getConfiguration();a=_.dh(a.ima||{});this.F=a=_.ch({disableCustomPlayback:!1},a);this.R=c;this.T=d;this.w=b;this.M=new _.Ev;this.g=new _.T("clpp.ima");this.a=null;this.V=!1;this.h=null;this.f=new _.Hl;this.P=!1;this.L=new _.Kt;
13
+ this.$a=new vS;this.C=null;this.J=this.G=this.H=!1;this.I=this.K=null;c=this.L;d=google.ima.AdErrorEvent.Type.AD_ERROR;c.one(this.w,google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.uc.bind(this));c.on(this.w,d,this.sc.bind(this));c.on(this.m,_.Wd,this.wc.bind(this))}uc(a){this.a=a.getAdsManager(this.B,jS(this));this.a.isCustomPlaybackUsed()&&!kS(this)?(this.g.warn("IMA plugin is disabled for this platform with single video element. Disposing."),this.m.onError(new _.I(1,9,10002)),this.j()):
14
+ (this.h=new _.Cv(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.K=new wS(a),this.m.trigger(new _.H(_.pc,{adsTimeline:this.K})),lS(this));this.f.resolve()}sc(a){mS(this,a.getError());this.f.resolve()}yc(a){this.J=!0;kS(this)||(this.m.pause(),_.Di(this.B,{visibility:_.ce}));nS(this,_.Tb,a);this.h.start()}Bb(){kS(this)?qS(this):this.a.start()}ga(a){a.getAd().isLinear()?nS(this,_.ec,a):(this.a.discardAdBreak(),
15
+ this.H||(this.H=!0,this.m.play()))}Ua(a){this.C=a.getAd().getDuration();nS(this,_.lc,a);this.m.getSurface().show(this.R)}Nb(a){a=a.getAdData();mS(this,a?a.adError:null);rS(this)}ia(a){nS(this,_.ic,a)}Cb(a){nS(this,_.Vb,a)}ba(a){nS(this,_.Yb,a)}oc(a){nS(this,_.gc,a)}Va(a){nS(this,_.nc,a)}pc(a){nS(this,_.hc,a)}rc(a){nS(this,_.jc,a)}Y(a){this.pause();nS(this,_.Wb,a)}Aa(a){nS(this,_.kc,a);rS(this)}ca(a){nS(this,_.bc,a)}Mb(a){nS(this,_.Xb,a);rS(this)}zc(){const a=this;return _.w(function*(){a.H=!0;if(kS(a)&&
16
+ null!==a.I){var b=a.m;b.a&&b.a.forwardEventsTo(b);yield _.jo(a.m);!a.G&&a.I&&(yield oS(a,2),yield a.m.play(),yield a.m.pause(),yield oS(a,4),yield a.m.seek(a.I))}else{if(!a.J)return a.m.play();sS(a)}a.J=!1;a.h&&a.h.stop();a.G||(yield a.m.play());nS(a,_.Ub)})}wc(){this.G=!0;this.w.contentComplete()}load(){const a=this;return _.w(function*(){var b=a.m;const c=a.F;try{if(typeof c.adTagUrl!==_.Tf)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(),
17
+ a.f;b=yield a.M.canPlay(!1);const d=yield a.M.canPlay(!0),e=new google.ima.AdsRequest;e.adTagUrl=c.adTagUrl;e.setAdWillAutoPlay(b);e.setAdWillPlayMuted(d);a.w.getSettings().setAutoPlayAdBreaks(!1);a.w.requestAds(e);return a.f})}A(){if(!this.a)return!0;if(!this.V&&!this.P){if(this.K.Jb())return uS(this),!1;this.T.initialize();tS(this)}return!0}o(){}l(){return!0}resume(){this.a&&this.a.resume()}pause(){this.a&&this.a.pause()}skip(){this.a&&this.a.skip()}getVolume(){return this.a?this.a.getVolume():
18
+ 1}setVolume(a){this.a&&this.a.setVolume(a)}getPosition(){if(!this.a||null===this.C)return-1;const a=this.a.getRemainingTime();return 0>a?0:this.C-a}j(){this.a&&(this.a.destroy(),this.a=null);this.V=!0;sS(this);this.L.release();this.h&&(this.h.stop(),this.h=null);return Promise.resolve()}};zS.prototype.getPosition=zS.prototype.getPosition;zS.prototype.setVolume=zS.prototype.setVolume;zS.prototype.getVolume=zS.prototype.getVolume;zS.prototype.skip=zS.prototype.skip;zS.prototype.pause=zS.prototype.pause;
19
+ zS.prototype.resume=zS.prototype.resume;_.Fh(new class{constructor(){this.Sa=new _.T(hS)}name(){return hS}a(a,b){return a.namespace()===_.hd?!1:iS()?(this.Sa.warn("IMA SDK is not loaded."),!1):!(!b||!b.ima)}create(a){return new zS(a)}});_.Qn(new yS);};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 _.w(function*(){var d=yield(yield fetch(b,{method:_.cb,body:JSON.stringify(c.sessionConfig)})).json();const e=d.trackingUrl;d={zg:_.Lm(d.manifestUrl,b),vj:e?_.Lm(e,b):null};a.g.info(`Media Tailor session initialized.
2
- - manifest URI: ${d.zg}`);return d})},mS=class extends _.Iv{constructor(){super();this.g=new _.S("clpp.mediatailor.MediaTailorPlugin")}onContentWillLoad(a,b){const c=this;return _.w(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 _.G("mt-session-started"));b.url=e.zg}catch(e){throw c.g.error("Failed to start session",e),new _.H(_.C,9,7003,"Media Tailor session failed to initialize.");}}})}id(){return"mediatailor"}};_.Ln(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 fS=function(a,b,c){return _.w(function*(){var d=yield(yield fetch(b,{method:_.eb,body:JSON.stringify(c.sessionConfig)})).json();const e=d.trackingUrl;d={Lg:_.Qm(d.manifestUrl,b),Ij:e?_.Qm(e,b):null};a.g.info(`Media Tailor session initialized.
2
+ - manifest URI: ${d.Lg}`);return d})},gS=class extends _.Ov{constructor(){super();this.g=new _.T("clpp.mediatailor.MediaTailorPlugin")}onContentWillLoad(a,b){const c=this;return _.w(function*(){const d=a.getConfiguration().mediatailor;if(d.enabled){c.g.info("MediaTailor plugin is enabled");try{const e=yield fS(c,b.url,d);a.trigger(new _.H("mt-session-started"));b.url=e.Lg}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"}};_.Qn(new class{create(){return new gS}});};f.call(g, window);