@castlabs/prestoplay 6.27.0 → 6.29.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 (67) hide show
  1. package/CHANGELOG.md +34 -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 +125 -114
  6. package/cjs/cl.conviva.js +32 -32
  7. package/cjs/cl.core.js +632 -624
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +89 -89
  10. package/cjs/cl.externs.js +201 -100
  11. package/cjs/cl.freewheel.js +25 -25
  12. package/cjs/cl.hls.js +78 -78
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +30 -30
  15. package/cjs/cl.ima.js +24 -24
  16. package/cjs/cl.mediatailor.js +3 -3
  17. package/cjs/cl.mse.js +351 -351
  18. package/cjs/cl.muxdata.js +14 -15
  19. package/cjs/cl.onboard.js +4 -3
  20. package/cjs/cl.persistent.js +14 -14
  21. package/cjs/cl.playlist.js +6 -6
  22. package/cjs/cl.simid.js +16 -17
  23. package/cjs/cl.smooth.js +71 -72
  24. package/cjs/cl.thumbnails.js +26 -26
  25. package/cjs/cl.tizen.js +72 -72
  26. package/cjs/cl.ttml.js +29 -29
  27. package/cjs/cl.verimatrix.js +5 -5
  28. package/cjs/cl.vimond.js +12 -12
  29. package/cjs/cl.vr.js +19 -19
  30. package/cjs/cl.vtt.js +14 -14
  31. package/cjs/cl.yospace.js +4 -4
  32. package/cjs/cl.youbora.js +39 -39
  33. package/cl.adobe.js +3 -3
  34. package/cl.airplay.js +3 -3
  35. package/cl.broadpeak.js +6 -5
  36. package/cl.cast.js +98 -90
  37. package/cl.conviva.js +27 -27
  38. package/cl.core.js +509 -501
  39. package/cl.crypto.js +8 -8
  40. package/cl.dash.js +83 -82
  41. package/cl.externs.js +197 -100
  42. package/cl.freewheel.js +19 -19
  43. package/cl.hls.js +82 -80
  44. package/cl.hlssmpte.js +5 -5
  45. package/cl.htmlcue.js +26 -26
  46. package/cl.ima.js +18 -17
  47. package/cl.mediatailor.js +2 -3
  48. package/cl.mse.js +303 -305
  49. package/cl.muxdata.js +13 -13
  50. package/cl.onboard.js +4 -4
  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 +60 -60
  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 +15 -15
  61. package/cl.vtt.js +12 -12
  62. package/cl.yospace.js +3 -3
  63. package/cl.youbora.js +31 -29
  64. package/package.json +1 -1
  65. package/typings.d.ts +221 -152
  66. package/cjs/cl.sessions.js +0 -21
  67. package/cl.sessions.js +0 -10
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 KT="Unsupported unit",LT="clpp-text-plain",MT="clpp-text-ttml",NT="clpp.htmlcue.HtmlTextDisplayer",OT="initial",PT=function(a){return _.hi(a,{Ef:(b,c)=>b.Hc(c)})},QT=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)},RT=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},ST=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},UT=function(a){let b=null;for(;b=a.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)a=a.replace(b[0],c=>TT[c]);return a},WT=function(a,b){VT(a,b);Array.from(b.getElementsByTagName("*")).forEach(c=>{VT(a,c)})},VT=function(a,b){for(const c in a)null!=a[c]&&(b.style[c]=a[c])},XT=function(a,b){return 0===a?"0":a+b},YT=function(a,b){return 1>Math.abs(a-b)||a<b},ZT=function(a,b){return a<b&&1<Math.abs(a-b)},$T=function(a,b){return a>b&&1<Math.abs(a-b)},aU=
3
- function(a,b){return 1>Math.abs(a-b)||a>b},cU=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 bU(b.left+d,b.right+e,g,(b.bottom||g+f)+c,f,(b.width||a.offsetWidth)-
4
- d-e)},dU=function(a){return new bU(a.left,a.f,a.top,a.a,a.height,a.width)},eU=function(a,b){return b.some(c=>ZT(a.left,c.f)&&$T(a.f,c.left)&&ZT(a.top,c.a)&&$T(a.a,c.top))},fU=function(a,b){return aU(a.top,b.top)&&YT(a.a,b.a)&&aU(a.left,b.left)&&YT(a.f,b.f)},gU=function(a,b,c){switch(c){case "+x":return ZT(a.left,b.left);case "-x":return $T(a.f,b.f);case "+y":return ZT(a.top,b.top);case "-y":return $T(a.a,b.a);default:throw Error("Unknown axis");}},hU=function(a){return a.f.writingMode===_.Ot},iU=
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 hU(a)?b:c},jU=function(a){switch(a.f.writingMode){case _.Ot:return"horizontal-tb";case _.qg:return _.qg;case _.rg:return _.rg;default:throw Error("Unknown writing mode");}},kU=function(a){switch(a.f.positionAlign){case _.ke:return _.he;case "auto":case _.Vc:return _.Nt;case _.le:return _.zf}return a.f.textAlign},lU=function(a,b){if(typeof a.f.position===_.r&&typeof a.f.size===
6
- _.r)switch(b){case _.ke:return a.f.position;case "auto":case _.Vc:return a.f.position-a.f.size/2;case _.le:return a.f.position-a.f.size}return 0},mU=function(a){if(!a.f.positionAlign)switch(a.f.textAlign){case _.Mf:case _.he:return _.ke;case _.Nt:return _.Vc;case _.Sd:case _.zf:return _.le}return a.f.positionAlign},pU=function(a,b,c){return(nU(a)||oU(a))&&_.hh(c)?XT(c,_.sf):nU(a)&&_.z(c)?XT(0,_.sf):hU(a)&&_.hh(b)?XT(b,"%"):OT},qU=function(a,b,c){return hU(a)&&_.hh(c)?XT(c,_.sf):(nU(a)||oU(a))&&_.hh(b)?
7
- XT(b,"%"):OT},oU=function(a){return a.f.writingMode===_.rg},nU=function(a){return a.f.writingMode===_.qg},rU=function(a,b){if(a.j)switch(b.writingMode){case _.Ot:return["-y"];case _.qg:return["+x"];case _.rg:return["-x"]}a=[];switch(b.writingMode){case _.Ot:a=["+y","-y"];break;case _.qg:a=["+x","-x"];break;case _.rg:a=["-x","+x"]}0>b.line&&(a=a.reverse());return a},sU=function(a){for(a.h=[];0<a.f.childNodes.length;)a.f.removeChild(a.f.childNodes[0]);a.a=cU(a.l.a)},tU=function(a,b,c){a=a.f;const d=
8
- a.viewportAnchorUnits;if(d===_.Vt)return a.viewportAnchorY/100*c-a.regionAnchorY/100*b;if(0===d)return a.viewportAnchorY-a.regionAnchorY;throw Error(KT);},vU=function(a,b,c,d){const e=document.createElement(_.Sf),f=e.dataset;f.name=b;f.for=c;d&&(f.name=`${b} (sandbox)`,f.sandbox=!0);c=document.head;c.appendChild(e);uU(a,c,b);a.g.debug(`Created HTML style element #${b}.`);return e.sheet},wU=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)},xU=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},yU=function(a){if(null!=a.a){for(;0<a.a.cssRules.length;)a.a.deleteRule(0);
10
- a.o=[]}},uU=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())},zU=function(a){a=_.ah(a.htmlcue||{});_.z(a.stretchSmpteImage)&&(a.stretchSmpteImage=!1);_.z(a.enableResizeObserver)&&(a.enableResizeObserver=!0);return a},FU=function(a,b){if((b||a.l)&&a.F){var c=a.m.getPosition();
11
- if(b||a.J!==c&&a.m.getState()===_.sp)if(a.J=c,c=AU(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,BU(a),c)){b={color:a.getFontColor()||void 0,backgroundColor:a.getBackgroundColor()||void 0,fontFamily:a.getFontFamily()||void 0,textShadow:_.Ct(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 _.Bg:g="clpp-text-vtt";break;case _.fg:g=MT;break;case _.Mt:g=LT}g&&!f.classList.contains(g)&&
12
- _.Mp(f,g);f=cU(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{VT({fontSize:CU(c,d.containerRows)},c.a.a);f=null;g=d.payloadType===_.Bg;var h=d.payloadType===_.fg;d.region&&(g||h||d.backgroundImage)&&(c.B.has(d.region.id)?f=c.B.get(d.region.id):(f=new DU(d.region,{}),c.B.set(d.region.id,f),c.a.appendChild(f)));d=new EU(d,c.L,e);f?f.appendChild(d):
13
- c.a.appendChild(d)}}}}},GU=function(a){BU(a);a.J=null;a.o=null;a.f=[]},HU=function(a,b){return a.startTime<=b&&a.endTime>b},AU=function(a,b){var c=RT(a.f,d=>HU(d,b)?0:b!==d.startTime?b-d.startTime:b-d.endTime);if(-1===c)return null;{let d=c;for(;0<=d-1&&HU(a.f[d-1],b);)d--;for(;c+1<a.f.length&&HU(a.f[c+1],b);)c++;return{start:d,end:c}}},BU=function(a){a.B.clear();if(a.a){const b=a.a.a;b.classList.remove("clpp-text-vtt");b.classList.remove(MT);b.classList.remove(LT);a=a.a;sU(a.h);a.l=[]}},CU=function(a,
14
- b){const c=cU(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`},LU=class{parse(a){a={input:a};const b=_.Op(_.Dd),c=[];let d=b;for(var e;null!==(e=ST(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=IU[f];h?(h=_.Op(h),(f=JU[f])&&g&&h.setAttribute(f,g.trim()),g=h):g=null;!g||KU[g.localName]&&KU[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(UT(e)));return b}},IU={c:"c",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"v",lang:"lang"},JU={v:"voice",lang:"lang"},KU={rt:"ruby"},TT={"\x26amp;":"\x26","\x26lt;":"\x3c","\x26gt;":"\x3e","\x26lrm;":"\u200e","\x26rlm;":"\u200f",
16
- "\x26nbsp;":"\u00a0"};var bU=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 MU=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 EU=class extends MU{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)_.Mp(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===_.fg){var c=_.Op(_.Dd);c.innerHTML=b.payload;b=c}else b.payloadType===
17
- _.Bg?b=(new LU).parse(b.payload):(c=_.Op(_.Dd),c.textContent=b.payload,b=c);_.Mp(b,this.w);this.id&&(b.id=this.id);for(d of this.f.cssClassList)_.Mp(b,d);VT({writingMode:jU(this)},b);var d=b;this.a.appendChild(d);_.Mp(this.a,"clpp-text-wrapper");for(var e of this.f.cssClassList)_.Mp(this.a,`clpp-text-wrapper__${e}`);_.z(this.f.line)&&(this.f.lineInterpretation=_.Pt,this.f.line=hU(this)?-1:0);e=jU(this);VT({writingMode:e,webkitWritingMode:e,direction:OT,textAlign:kU(this)},this.a);if(!this.f.region||
18
- !this.f.region.displayAlign){e=lU(this,mU(this));VT({position:"absolute",left:pU(this,e,null),right:oU(this)&&_.z(null)?XT(0,_.sf):OT,top:qU(this,e,null),width:hU(this)?XT(this.f.size,"%"):OT,height:nU(this)||oU(this)?XT(this.f.size,"%"):OT},this.a);b=this.f;a=hU(this)?a.height:a.width;c=iU(this);if(b.lineInterpretation===_.Pt){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 _.Sd:g-=f}f=Math.round(g/
19
- 100*a)}oU(this)&&(f=a-f-c);a=f;VT({left:pU(this,e,a),right:oU(this)&&_.z(a)?XT(0,_.sf):OT,top:qU(this,e,a)},this.a)}WT(this.C,d)}}o(){return _.Op(_.Dd)}};var NU=class{constructor(a,b){this.l=a;this.f=a.a;this.j=void 0===b?!1:b;this.a=cU(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=cU(a.a);var d=rU(this,a.f),e=iU(a);const g=dU(c);let h=null,k=0;for(const l of d){for(;gU(c,this.a,l)||fU(c,this.a)&&eU(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||fU(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=dU(c),k=d);c=dU(g)}c=h||g}VT({top:XT(c.top-this.a.top,_.sf),bottom:XT(this.a.a-c.a,_.sf),left:XT(c.left-this.a.left,_.sf),right:XT(this.a.f-c.f,_.sf),height:XT(c.height,_.sf),width:XT(c.width,_.sf)},a.a)}b.style.visibility="visible";this.h.push(cU(a.a))}};var OU=class extends MU{constructor(a,b,c){super(a,b,c);this.h=null;this.l=[]}init(){this.h=new NU(this);this.j=!0}o(){const a=_.Op(_.Dd);_.Mp(a,this.w);this.id&&(a.id=this.id);return a}appendChild(a){sU(this.h);this.l.unshift(a);for(const b of this.l)this.h.append(b)}};var DU=class extends OU{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 _.Vt:b=b.width/100*a.width;break a;default:throw Error(KT);}}var c=this.f;var d=c.viewportAnchorUnits;if(d===_.Vt)c=c.viewportAnchorX/100*a.width-c.regionAnchorX/100*b;else if(0===d)c=c.viewportAnchorX-c.regionAnchorX;else throw Error(KT);d=a.height;const e=tU(this,d,a.height);VT(this.B,this.a);VT({left:XT(c,_.sf),top:XT(e,_.sf),width:XT(b,
21
- _.sf),height:XT(d,_.sf)},this.a);this.f.writingMode&&VT({display:"flex","flex-direction":this.f.writingMode},this.a);this.f.displayAlign&&VT({"justify-content":this.f.displayAlign},this.a);for(var f of this.f.cssClassList)_.Mp(this.a,f);a:switch(f=this.f,f.heightUnits){case 0:f=f.height;break a;case _.Vt:f=f.height/100*a.height;break a;case 2:f=f.height;c=new EU(new _.St(0,1,"Lorem ipsum",_.Mt),{},{});b=c.a;this.a.appendChild(b);c.init(cU(this.a));c=b.getBoundingClientRect().height;this.a.removeChild(b);
22
- b=c;f*=b;break a;default:throw Error(KT);}a=tU(this,f,a.height);VT({top:XT(a,_.sf),height:XT(f,_.sf)},this.a);this.h=new NU(this,!0);this.j=!0}getId(){return this.f.id}};var PU=class{constructor(a,b){this.g=new _.S("clpp.htmlcue.StyleManager");this.l=[];this.j=a;this.h=b;this.o=[];this.a=vU(this,this.h,this.j);this.f=vU(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=wU(this,a);if(xU(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=[],yU(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 QU=class extends _.Fv{constructor(a){super(a);this.g=new _.S(NT);this.m=a;this.L=zU(a.getConfiguration());this.l=!1;this.f=[];this.F=a.getSurface().getContainer();this.j=new PU(a.getSurface().getUniqueCssClass(),"CLPP Subtitle Styles");this.a=new OU(null,"clpp-text-container",{});this.A=new _.yv(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 _.Mj(()=>{FU(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=QT(this.f,PT(a));this.o=null;FU(this,!1)}}h(){null==this.j||FU(this,!0)}destroy(){const a=this;return _.w(function*(){null!=a.j&&(GU(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;FU(this,!0);return!0}isTextVisible(){return this.l}setTextVisibility(a){null!=this.j&&this.l!==a&&((this.l=a)?(this.G.yb(.25),this.L.enableResizeObserver&&this.A.start(),FU(this,!0)):(this.G.stop(),this.A.stop(),GU(this)))}T(){FU(this,!0)}};_.x(NT,QU);QU.prototype.setTextVisibility=QU.prototype.setTextVisibility;QU.prototype.isTextVisible=QU.prototype.isTextVisible;QU.prototype.remove=QU.prototype.remove;QU.prototype.destroy=QU.prototype.destroy;
26
- QU.prototype.append=QU.prototype.append;var RU=class{a(a){return!!a.enableHtmlCue&&!_.ck()}create(a){return new QU(a)}};_.x("clpp.htmlcue.HtmlCueComponent",class extends _.uv{f(){_.Zo(_.ce,new RU)}a(){_.Xo.has(_.ce)&&(_.Xo.delete(_.ce),_.Yo.info("Removed factory: 'html'"))}id(){return _.Tf}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var IS="Unsupported unit",JS="clpp-text-plain",KS="clpp-text-ttml",LS="clpp.htmlcue.HtmlTextDisplayer",MS="initial",NS=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},OS=function(a){return _.ci(a,{Sf:(b,c)=>b.Lc(c)})},PS=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)},QS=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},SS=function(a){let b=null;for(;b=a.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)a=a.replace(b[0],c=>RS[c]);return a},US=function(a,b){TS(a,b);Array.from(b.getElementsByTagName("*")).forEach(c=>{TS(a,c)})},TS=function(a,b){for(const c in a)null!=a[c]&&(b.style[c]=a[c])},VS=function(a,b){return 0===a?"0":a+b},WS=function(a,b){return 1>Math.abs(a-b)||a<b},XS=function(a,b){return a<b&&1<Math.abs(a-b)},YS=function(a,b){return a>b&&1<Math.abs(a-b)},ZS=
3
+ function(a,b){return 1>Math.abs(a-b)||a>b},aT=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 $S(b.left+d,b.right+e,g,(b.bottom||g+f)+c,f,(b.width||a.offsetWidth)-
4
+ d-e)},bT=function(a){return new $S(a.left,a.f,a.top,a.a,a.height,a.width)},cT=function(a,b){return b.some(c=>XS(a.left,c.f)&&YS(a.f,c.left)&&XS(a.top,c.a)&&YS(a.a,c.top))},dT=function(a,b){return ZS(a.top,b.top)&&WS(a.a,b.a)&&ZS(a.left,b.left)&&WS(a.f,b.f)},eT=function(a,b,c){switch(c){case "+x":return XS(a.left,b.left);case "-x":return YS(a.f,b.f);case "+y":return XS(a.top,b.top);case "-y":return YS(a.a,b.a);default:throw Error("Unknown axis");}},fT=function(a){return a.f.writingMode===_.ru},gT=
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 fT(a)?b:c},hT=function(a){switch(a.f.writingMode){case _.ru:return"horizontal-tb";case _.wg:return _.wg;case _.xg:return _.xg;default:throw Error("Unknown writing mode");}},iT=function(a){switch(a.f.positionAlign){case _.me:return _.je;case "auto":case _.Wc:return _.qu;case _.ne:return _.Bf}return a.f.textAlign},jT=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 _.Wc:return a.f.position-a.f.size/2;case _.ne:return a.f.position-a.f.size}return 0},kT=function(a){if(!a.f.positionAlign)switch(a.f.textAlign){case _.Pf:case _.je:return _.me;case _.qu:return _.Wc;case _.Vd:case _.Bf:return _.ne}return a.f.positionAlign},nT=function(a,b,c){return(lT(a)||mT(a))&&_.kh(c)?VS(c,_.uf):lT(a)&&_.z(c)?VS(0,_.uf):fT(a)&&_.kh(b)?VS(b,"%"):MS},oT=function(a,b,c){return fT(a)&&_.kh(c)?VS(c,_.uf):(lT(a)||mT(a))&&_.kh(b)?
7
+ VS(b,"%"):MS},mT=function(a){return a.f.writingMode===_.xg},lT=function(a){return a.f.writingMode===_.wg},pT=function(a,b){if(a.j)switch(b.writingMode){case _.ru:return["-y"];case _.wg:return["+x"];case _.xg:return["-x"]}a=[];switch(b.writingMode){case _.ru:a=["+y","-y"];break;case _.wg:a=["+x","-x"];break;case _.xg:a=["-x","+x"]}0>b.line&&(a=a.reverse());return a},qT=function(a){for(a.h=[];0<a.f.childNodes.length;)a.f.removeChild(a.f.childNodes[0]);a.a=aT(a.l.a)},rT=function(a,b,c){a=a.f;const d=
8
+ a.viewportAnchorUnits;if(d===_.yu)return a.viewportAnchorY/100*c-a.regionAnchorY/100*b;if(0===d)return a.viewportAnchorY-a.regionAnchorY;throw Error(IS);},tT=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);sT(a,c,b);a.g.debug(`Created HTML style element #${b}.`);return e.sheet},uT=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)},vT=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},wT=function(a){if(null!=a.a){for(;0<a.a.cssRules.length;)a.a.deleteRule(0);
10
+ a.o=[]}},sT=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())},xT=function(a){a=_.dh(a.htmlcue||{});_.z(a.stretchSmpteImage)&&(a.stretchSmpteImage=!1);_.z(a.enableResizeObserver)&&(a.enableResizeObserver=!0);return a},DT=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=yT(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,zT(a),c)){b={color:a.getFontColor()||void 0,backgroundColor:a.getBackgroundColor()||void 0,fontFamily:a.getFontFamily()||void 0,textShadow:_.Gt(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=KS;break;case _.pu:g=JS}g&&!f.classList.contains(g)&&
12
+ _.Ei(f,g);f=aT(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{TS({fontSize:AT(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 BT(d.region,{}),c.B.set(d.region.id,f),c.a.appendChild(f)));d=new CT(d,c.L,e);f?f.appendChild(d):
13
+ c.a.appendChild(d)}}}}},ET=function(a){zT(a);a.J=null;a.o=null;a.f=[]},FT=function(a,b){return a.startTime<=b&&a.endTime>b},yT=function(a,b){var c=NS(a.f,d=>FT(d,b)?0:b!==d.startTime?b-d.startTime:b-d.endTime);if(-1===c)return null;{let d=c;for(;0<=d-1&&FT(a.f[d-1],b);)d--;for(;c+1<a.f.length&&FT(a.f[c+1],b);)c++;return{start:d,end:c}}},zT=function(a){a.B.clear();if(a.a){const b=a.a.a;b.classList.remove("clpp-text-vtt");b.classList.remove(KS);b.classList.remove(JS);a=a.a;qT(a.h);a.l=[]}},AT=function(a,
14
+ b){const c=aT(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`},JT=class{parse(a){a={input:a};const b=_.Gi(_.Ed),c=[];let d=b;for(var e;null!==(e=QS(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=GT[f];h?(h=_.Gi(h),(f=HT[f])&&g&&h.setAttribute(f,g.trim()),g=h):g=null;!g||IT[g.localName]&&IT[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(SS(e)));return b}},GT={c:"c",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"v",lang:"lang"},HT={v:"voice",lang:"lang"},IT={rt:"ruby"},RS={"\x26amp;":"\x26","\x26lt;":"\x3c","\x26gt;":"\x3e","\x26lrm;":"\u200e","\x26rlm;":"\u200f",
16
+ "\x26nbsp;":"\u00a0"};var $S=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 KT=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 CT=class extends KT{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)_.Ei(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=_.Gi(_.Ed);c.innerHTML=b.payload;b=c}else b.payloadType===
17
+ _.Eg?b=(new JT).parse(b.payload):(c=_.Gi(_.Ed),c.textContent=b.payload,b=c);_.Ei(b,this.w);this.id&&(b.id=this.id);for(d of this.f.cssClassList)_.Ei(b,d);TS({writingMode:hT(this)},b);var d=b;this.a.appendChild(d);_.Ei(this.a,"clpp-text-wrapper");for(var e of this.f.cssClassList)_.Ei(this.a,`clpp-text-wrapper__${e}`);_.z(this.f.line)&&(this.f.lineInterpretation=_.su,this.f.line=fT(this)?-1:0);e=hT(this);TS({writingMode:e,webkitWritingMode:e,direction:MS,textAlign:iT(this)},this.a);if(!this.f.region||
18
+ !this.f.region.displayAlign){e=jT(this,kT(this));TS({position:"absolute",left:nT(this,e,null),right:mT(this)&&_.z(null)?VS(0,_.uf):MS,top:oT(this,e,null),width:fT(this)?VS(this.f.size,"%"):MS,height:lT(this)||mT(this)?VS(this.f.size,"%"):MS},this.a);b=this.f;a=fT(this)?a.height:a.width;c=gT(this);if(b.lineInterpretation===_.su){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 _.Vd:g-=f}f=Math.round(g/
19
+ 100*a)}mT(this)&&(f=a-f-c);a=f;TS({left:nT(this,e,a),right:mT(this)&&_.z(a)?VS(0,_.uf):MS,top:oT(this,e,a)},this.a)}US(this.C,d)}}o(){return _.Gi(_.Ed)}};var LT=class{constructor(a,b){this.l=a;this.f=a.a;this.j=void 0===b?!1:b;this.a=aT(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=aT(a.a);var d=pT(this,a.f),e=gT(a);const g=bT(c);let h=null,k=0;for(const l of d){for(;eT(c,this.a,l)||dT(c,this.a)&&cT(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||dT(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=bT(c),k=d);c=bT(g)}c=h||g}TS({top:VS(c.top-this.a.top,_.uf),bottom:VS(this.a.a-c.a,_.uf),left:VS(c.left-this.a.left,_.uf),right:VS(this.a.f-c.f,_.uf),height:VS(c.height,_.uf),width:VS(c.width,_.uf)},a.a)}b.style.visibility="visible";this.h.push(aT(a.a))}};var MT=class extends KT{constructor(a,b,c){super(a,b,c);this.h=null;this.l=[]}init(){this.h=new LT(this);this.j=!0}o(){const a=_.Gi(_.Ed);_.Ei(a,this.w);this.id&&(a.id=this.id);return a}appendChild(a){qT(this.h);this.l.unshift(a);for(const b of this.l)this.h.append(b)}};var BT=class extends MT{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 _.yu:b=b.width/100*a.width;break a;default:throw Error(IS);}}var c=this.f;var d=c.viewportAnchorUnits;if(d===_.yu)c=c.viewportAnchorX/100*a.width-c.regionAnchorX/100*b;else if(0===d)c=c.viewportAnchorX-c.regionAnchorX;else throw Error(IS);d=a.height;const e=rT(this,d,a.height);TS(this.B,this.a);TS({left:VS(c,_.uf),top:VS(e,_.uf),width:VS(b,
21
+ _.uf),height:VS(d,_.uf)},this.a);this.f.writingMode&&TS({display:"flex","flex-direction":this.f.writingMode},this.a);this.f.displayAlign&&TS({"justify-content":this.f.displayAlign},this.a);for(var f of this.f.cssClassList)_.Ei(this.a,f);a:switch(f=this.f,f.heightUnits){case 0:f=f.height;break a;case _.yu:f=f.height/100*a.height;break a;case 2:f=f.height;c=new CT(new _.vu(0,1,"Lorem ipsum",_.pu),{},{});b=c.a;this.a.appendChild(b);c.init(aT(this.a));c=b.getBoundingClientRect().height;this.a.removeChild(b);
22
+ b=c;f*=b;break a;default:throw Error(IS);}a=rT(this,f,a.height);TS({top:VS(a,_.uf),height:VS(f,_.uf)},this.a);this.h=new LT(this,!0);this.j=!0}getId(){return this.f.id}};var NT=class{constructor(a,b){this.g=new _.S("clpp.htmlcue.StyleManager");this.l=[];this.j=a;this.h=b;this.o=[];this.a=tT(this,this.h,this.j);this.f=tT(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=uT(this,a);if(vT(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=[],wT(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 OT=class extends _.Mv{constructor(a){super(a);this.g=new _.S(LS);this.m=a;this.L=xT(a.getConfiguration());this.l=!1;this.f=[];this.F=a.getSurface().getContainer();this.j=new NT(a.getSurface().getUniqueCssClass(),"CLPP Subtitle Styles");this.a=new MT(null,"clpp-text-container",{});this.A=new _.Iv(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 _.Ni(()=>{DT(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=PS(this.f,OS(a));this.o=null;DT(this,!1)}}h(){null==this.j||DT(this,!0)}destroy(){const a=this;return _.w(function*(){null!=a.j&&(ET(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;DT(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(),DT(this,!0)):(this.G.stop(),this.A.stop(),ET(this)))}T(){DT(this,!0)}};_.x(LS,OT);OT.prototype.setTextVisibility=OT.prototype.setTextVisibility;OT.prototype.isTextVisible=OT.prototype.isTextVisible;OT.prototype.remove=OT.prototype.remove;OT.prototype.destroy=OT.prototype.destroy;
26
+ OT.prototype.append=OT.prototype.append;var PT=class{a(a){return!!a.enableHtmlCue&&!_.cj()}create(a){return new OT(a)}};_.x("clpp.htmlcue.HtmlCueComponent",class extends _.Ev{install(){_.ms(_.ee,new PT)}uninstall(){_.ks.has(_.ee)&&(_.ks.delete(_.ee),_.ls.info("Removed factory: 'html'"))}id(){return _.Wf}});};f.call(g, window);
package/cl.ima.js CHANGED
@@ -1,17 +1,18 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var sT="clpp.ima.AdsManagerFactory",tT=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===_.Mc?a.enablePreloading:!0;typeof a.loadVideoTimeout===_.r&&(b.loadVideoTimeout=a.loadVideoTimeout);Array.isArray(a.mimeTypes)&&(b.mimeTypes=a.mimeTypes);typeof a.playAdsAfterTime===_.r&&(b.playAdsAfterTime=a.playAdsAfterTime);typeof a.useStyledLinearAds===
2
- _.Mc&&(b.useStyledLinearAds=a.useStyledLinearAds);b.uiElements=Array.isArray(a.uiElements)?a.uiElements:[];return b},uT=function(a){return!1===a.K.disableCustomPlayback&&a.a.isCustomPlaybackUsed()&&_.Qj()||_.Tj()},vT=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.ca.bind(a));c.on(b,d.CONTENT_PAUSE_REQUESTED,a.nc.bind(a));c.on(b,d.STARTED,a.ia.bind(a));c.on(b,d.LOG,a.Ab.bind(a));c.on(b,d.AD_PROGRESS,a.ea.bind(a));c.on(b,d.AD_BUFFERING,
3
- a.Za.bind(a));c.on(b,d.FIRST_QUARTILE,a.V.bind(a));c.on(b,d.MIDPOINT,a.fc.bind(a));c.on(b,d.THIRD_QUARTILE,a.ya.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.T.bind(a));c.on(b,d.SKIPPED,a.ha.bind(a));c.on(b,d.IMPRESSION,a.Z.bind(a));c.on(b,d.COMPLETE,a.zb.bind(a));c.on(b,d.CONTENT_RESUME_REQUESTED,a.pc.bind(a))},wT=function(a,b){const c=b?a.Ta.create(b.getErrorCode()):null;a.m.onError(new _.I(1,9,10003,{errorType:c},b))},xT=function(a){return _.w(function*(){yield a.m.detach();
4
- var b=a.m;b.a&&b.a.stopForwardingEventsTo(b)})},yT=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 _.C(b,d))},zT=function(a){a.B=null;yT(a,_.mc);a.m.getSurface().hide(a.P)},AT=function(a){return _.w(function*(){return new Promise(b=>{a.H.on(a.m,_.Nf,()=>{a.m.getState()===_.rp&&b()})})})},BT=function(a){_.Np(a.A,{visibility:"visible"})},DT=function(a){return _.w(function*(){a.R.initialize();const b=!!a.m.getConfiguration().muted;(yield a.L.canPlay(b))||uT(a)?
5
- (uT(a)&&(yield xT(a)),CT(a)):(yT(a,_.Kc),a.g.warn(_.ka))})},ET=function(a,b){return _.w(function*(){a.R.initialize();yield b.play();CT(a)})},CT=function(a){a.a.init(a.A.offsetWidth,a.A.offsetHeight,google.ima.ViewMode.NORMAL);a.a.start();a.M=!0},FT=function(){return!window.google||!google.ima||!google.ima.AdsLoader},W=class{constructor(a,b,c){this.a=a;this.f=a.getAdPodInfo();this.j=b;this.h=c}kb(){return"Google IMA SDK"}lb(){return google.ima.VERSION}rb(){return 0}getId(){return this.a.getAdId()}getCreativeId(){return this.a.getCreativeId()}Mb(){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()}Pb(){return this.f?
6
- this.f.getIsBumper():!1}nb(){let a=null;const b=this.a,c=Object.keys(b).find(d=>typeof b[d]===_.Fe&&typeof b[d].clickThroughUrl===_.Qf);c&&(a=b[c].clickThroughUrl);return a}getMediaUrl(){return this.a.getMediaUrl()}bb(){return this.a.getVastMediaWidth()}ab(){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}Eb(){return this.f?this.f.getTimeOffset():0}pb(){return this.f?this.f.getAdPosition():
7
- 1}cb(){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()}Ob(){return null}};W.prototype.getVideoElement=W.prototype.Ob;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.cb;W.prototype.getPositionInSequence=W.prototype.pb;W.prototype.getPodTimeOffset=W.prototype.Eb;W.prototype.getPodIndex=W.prototype.getPodIndex;W.prototype.getPodType=W.prototype.Oa;W.prototype.getMediaBitrate=W.prototype.Na;W.prototype.getMediaHeight=W.prototype.ab;W.prototype.getMediaWidth=W.prototype.bb;W.prototype.getMediaUrl=W.prototype.getMediaUrl;W.prototype.getClickThroughUrl=W.prototype.nb;W.prototype.isBumper=W.prototype.Pb;
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.Mb;W.prototype.getCreativeId=W.prototype.getCreativeId;W.prototype.getId=W.prototype.getId;
10
- W.prototype.getTechnology=W.prototype.rb;W.prototype.getAdManagerVersion=W.prototype.lb;W.prototype.getAdManagerName=W.prototype.kb;var GT=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 HT=class{constructor(a){this.a=a}getCuePoints(){return this.a}Gb(){return 0<=this.a.indexOf(0)||0===this.a.length}Fb(){return 0<=this.a.indexOf(-1)}};HT.prototype.hasPostroll=HT.prototype.Fb;HT.prototype.hasPreroll=HT.prototype.Gb;HT.prototype.getCuePoints=HT.prototype.getCuePoints;var IT=class{constructor(a){var b=a.cd("ima");if(!b)throw Error("IMA plugin not created.");var c=b.Ic(),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=_.ah(a.ima||{});this.K=a=_.$g({disableCustomPlayback:!1},a);this.P=c;this.R=d;this.w=b;this.L=new _.Av;this.g=new _.S("clpp.ima");this.j=this.a=null;this.f=new _.xk;this.M=!1;this.H=new _.Kt;this.Ta=new GT;
11
- 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.kc.bind(this));c.on(this.w,d,this.ic.bind(this));c.on(this.m,_.Td,this.lc.bind(this))}kc(a){this.a=a.getAdsManager(this.A,tT(this));this.a.isCustomPlaybackUsed()&&!uT(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.h()):(this.j=new _.yv(this.m.getSurface(),
12
- (b,c,d)=>{this.a.resize(b,c,d?google.ima.ViewMode.FULLSCREEN:google.ima.ViewMode.NORMAL)}),a=this.a.getCuePoints(),this.C=new HT(a),this.m.trigger(new _.C(_.pc,{adsTimeline:this.C})),vT(this));this.f.resolve()}ic(a){wT(this,a.getError());this.f.resolve()}nc(a){const b=this;return _.w(function*(){b.J=!0;uT(b)?(b.I=b.m.getPosition(),yield xT(b)):(yield b.m.pause(),_.Np(b.A,{visibility:_.be}));yT(b,_.Sb,a);b.j.start()})}Ua(){const a=this;return _.w(function*(){a.a.start()})}ca(a){a.getAd().isLinear()?
13
- yT(this,_.bc,a):(this.a.discardAdBreak(),this.G||(this.G=!0,this.m.play()))}ia(a){this.B=a.getAd().getDuration();yT(this,_.kc,a);this.m.getSurface().show(this.P)}Ab(a){a=a.getAdData();wT(this,a?a.adError:null);zT(this)}ea(a){yT(this,_.ec,a)}Za(a){yT(this,_.Ub,a)}V(a){yT(this,_.Xb,a)}fc(a){yT(this,_.cc,a)}ya(a){yT(this,_.nc,a)}gc(a){yT(this,_.dc,a)}hc(a){yT(this,_.fc,a)}T(a){this.pause();yT(this,_.Vb,a)}ha(a){yT(this,_.gc,a);zT(this)}Z(a){yT(this,_.ac,a)}zb(a){yT(this,_.Wb,a);zT(this)}pc(){const a=
14
- this;return _.w(function*(){a.G=!0;if(uT(a)&&null!==a.I){var b=a.m;b.a&&b.a.forwardEventsTo(b);yield _.ys(a.m);!a.F&&a.I&&(yield AT(a),yield a.m.seek(a.I))}else{if(!a.J)return a.m.play();BT(a)}a.J=!1;a.j&&a.j.stop();a.F||(yield a.m.play());yT(a,_.Tb)})}lc(){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!==_.Qf)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(),
15
- 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.Gb()?yield DT(b):yield ET(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&&
16
- 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);BT(this);this.H.release();this.j&&(this.j.stop(),this.j=null);return Promise.resolve()}};IT.prototype.getPosition=IT.prototype.getPosition;IT.prototype.setVolume=IT.prototype.setVolume;IT.prototype.getVolume=IT.prototype.getVolume;IT.prototype.skip=IT.prototype.skip;IT.prototype.pause=IT.prototype.pause;IT.prototype.resume=IT.prototype.resume;var JT=class extends _.Iv{constructor(){super();this.a=this.h=this.f=null}onPlayerCreated(a){if(FT())return a.onError(new _.I(1,9,1E4));this.f=_.Lp(_.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&&
17
- (this.a.destroy(),this.a=null);this.h&&(this.h.destroy(),this.h=null);this.f&&(a.getSurface().removeElementFromContainer(this.f),this.f=null)}ph(){return this.a}nh(){return this.h}Ic(){return this.f}id(){return"ima"}};_.x("clpp.ima.ImaPlugin",JT);JT.prototype.getAdContainer=JT.prototype.Ic;JT.prototype.getAdDisplayContainer=JT.prototype.nh;JT.prototype.getAdsLoader=JT.prototype.ph;JT.Id="ima";JT.isSdkMissing=FT;_.fs(new class{create(){return new JT}});_.Jp(new class{constructor(){this.Qa=new _.S(sT)}name(){return sT}a(a,b){return a.namespace()===_.ed?!1:FT()?(this.Qa.warn("IMA SDK is not loaded."),!1):!(!b||!b.ima)}create(a){return new IT(a)}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var oS="clpp.ima.AdsManagerFactory",pS=function(){return!window.google||!google.ima||!google.ima.AdsLoader},qS=function(a){a=a.J;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},rS=function(a){return!1===a.J.disableCustomPlayback&&a.a.isCustomPlaybackUsed()&&_.Ri()||_.Ui()},sS=function(a){const b=a.a,c=a.K,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.sc.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.ca.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.jc.bind(a));c.on(b,d.THIRD_QUARTILE,a.za.bind(a));c.on(b,d.PAUSED,a.kc.bind(a));c.on(b,d.RESUMED,a.mc.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.uc.bind(a))},tS=function(a,b){const c=b?a.Ta.create(b.getErrorCode()):null;a.m.onError(new _.H(1,
4
+ 9,10003,{errorType:c},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))},xS=function(a){_.w(function*(){a.H=a.m.getPosition();yield vS(a,3);yield a.m.pause();yield wS(a);a.a.start()})},vS=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)})})},wS=function(a){return _.w(function*(){yield a.m.detach();
5
+ var b=a.m;b.a&&b.a.stopForwardingEventsTo(b)})},yS=function(a){a.B=null;uS(a,_.mc);a.m.getSurface().hide(a.P)},zS=function(a){_.Fi(a.A,{visibility:"visible"})},BS=function(a){return _.w(function*(){a.R.initialize();const b=!!a.m.getConfiguration().muted;(yield a.L.canPlay(b))||rS(a)?AS(a):(uS(a,_.Kc),a.g.warn(_.ka))})},CS=function(a,b){return _.w(function*(){a.R.initialize();yield b.play();AS(a)})},AS=function(a){a.a.init(a.A.offsetWidth,a.A.offsetHeight,google.ima.ViewMode.NORMAL);rS(a)||a.a.start();
6
+ 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()}Rb(){return this.f?
7
+ this.f.getIsBumper():!1}ob(){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()}cb(){return this.a.getVastMediaWidth()}bb(){return this.a.getVastMediaHeight()}Oa(){return this.a.getVastMediaBitrate()}Pa(){return this.h?2:this.j?1:0}getPodIndex(){return this.f?this.f.getPodIndex():0}Gb(){return this.f?this.f.getTimeOffset():0}qb(){return this.f?this.f.getAdPosition():
8
+ 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;
9
+ W.prototype.getSequenceLength=W.prototype.eb;W.prototype.getPositionInSequence=W.prototype.qb;W.prototype.getPodTimeOffset=W.prototype.Gb;W.prototype.getPodIndex=W.prototype.getPodIndex;W.prototype.getPodType=W.prototype.Pa;W.prototype.getMediaBitrate=W.prototype.Oa;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.Rb;
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.Nb;W.prototype.getCreativeId=W.prototype.getCreativeId;W.prototype.getId=W.prototype.getId;
11
+ W.prototype.getTechnology=W.prototype.sb;W.prototype.getAdManagerVersion=W.prototype.nb;W.prototype.getAdManagerName=W.prototype.lb;var DS=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 ES=class{constructor(a){this.a=a}getCuePoints(){return this.a}Ib(){return 0<=this.a.indexOf(0)||0===this.a.length}Hb(){return 0<=this.a.indexOf(-1)}};ES.prototype.hasPostroll=ES.prototype.Hb;ES.prototype.hasPreroll=ES.prototype.Ib;ES.prototype.getCuePoints=ES.prototype.getCuePoints;var FS=class extends _.Uv{constructor(){super();this.a=this.h=this.f=null}onPlayerCreated(a){if(pS())return a.onError(new _.H(1,9,1E4));this.f=_.Di(_.Ed,{"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)}Kh(){return this.a}Ih(){return this.h}Mc(){return this.f}id(){return"ima"}};_.x("clpp.ima.ImaPlugin",FS);FS.prototype.getAdContainer=FS.prototype.Mc;FS.prototype.getAdDisplayContainer=FS.prototype.Ih;FS.prototype.getAdsLoader=FS.prototype.Kh;FS.Id="ima";FS.isSdkMissing=pS;var GS=class{create(){return new FS}};var HS=class{constructor(a){var b=a.jd("ima");if(!b)throw Error("IMA plugin not created.");var c=b.Mc(),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=_.dh(a.ima||{});this.J=a=_.ch({disableCustomPlayback:!1},a);this.P=c;this.R=d;this.w=b;this.L=new _.Kv;this.g=new _.S("clpp.ima");this.j=this.a=null;this.f=new _.Jl;this.M=!1;this.K=new _.Qt;this.Ta=new DS;
13
+ this.B=null;this.I=this.F=this.G=!1;this.H=this.C=null;c=this.K;d=google.ima.AdErrorEvent.Type.AD_ERROR;c.one(this.w,google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.pc.bind(this));c.on(this.w,d,this.nc.bind(this));c.on(this.m,_.Wd,this.qc.bind(this))}pc(a){this.a=a.getAdsManager(this.A,qS(this));this.a.isCustomPlaybackUsed()&&!rS(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 _.Iv(this.m.getSurface(),
14
+ (b,c,d)=>{this.a.resize(b,c,d?google.ima.ViewMode.FULLSCREEN:google.ima.ViewMode.NORMAL)}),a=this.a.getCuePoints(),this.C=new ES(a),this.m.trigger(new _.G(_.pc,{adsTimeline:this.C})),sS(this));this.f.resolve()}nc(a){tS(this,a.getError());this.f.resolve()}sc(a){this.I=!0;rS(this)||(this.m.pause(),_.Fi(this.A,{visibility:_.ce}));uS(this,_.Sb,a);this.j.start()}Ua(){rS(this)?xS(this):this.a.start()}ba(a){a.getAd().isLinear()?uS(this,_.fc,a):(this.a.discardAdBreak(),this.G||(this.G=!0,this.m.play()))}ia(a){this.B=
15
+ a.getAd().getDuration();uS(this,_.lc,a);this.m.getSurface().show(this.P)}Bb(a){a=a.getAdData();tS(this,a?a.adError:null);yS(this)}ca(a){uS(this,_.ic,a)}Za(a){uS(this,_.Ub,a)}V(a){uS(this,_.Xb,a)}jc(a){uS(this,_.gc,a)}za(a){uS(this,_.nc,a)}kc(a){uS(this,_.hc,a)}mc(a){uS(this,_.jc,a)}T(a){this.pause();uS(this,_.Vb,a)}ha(a){uS(this,_.kc,a);yS(this)}Y(a){uS(this,_.dc,a)}Ab(a){uS(this,_.Wb,a);yS(this)}uc(){const a=this;return _.w(function*(){a.G=!0;if(rS(a)&&null!==a.H){var b=a.m;b.a&&b.a.forwardEventsTo(b);
16
+ yield _.po(a.m);!a.F&&a.H&&(yield vS(a,2),yield a.m.play(),yield a.m.pause(),yield vS(a,4),yield a.m.seek(a.H))}else{if(!a.I)return a.m.play();zS(a)}a.I=!1;a.j&&a.j.stop();a.F||(yield a.m.play());uS(a,_.Tb)})}qc(){this.F=!0;this.w.contentComplete()}load(){const a=this;return _.w(function*(){var b=a.m;const c=a.J;try{if(typeof c.adTagUrl!==_.Tf)throw new _.H(1,9,10001,{missingKeys:"adTagUrl"});}catch(f){return b.onError(f),a.f.resolve(),a.f}if(!c.adTagUrl)return a.f.resolve(),a.f;b=yield a.L.canPlay(!1);
17
+ 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.Ib()?yield BS(b):yield CS(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&&this.a.setVolume(a)}getPosition(){if(!this.a||
18
+ 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);zS(this);this.K.release();this.j&&(this.j.stop(),this.j=null);return Promise.resolve()}};HS.prototype.getPosition=HS.prototype.getPosition;HS.prototype.setVolume=HS.prototype.setVolume;HS.prototype.getVolume=HS.prototype.getVolume;HS.prototype.skip=HS.prototype.skip;HS.prototype.pause=HS.prototype.pause;HS.prototype.resume=HS.prototype.resume;_.Fh(new class{constructor(){this.Ra=new _.S(oS)}name(){return oS}a(a,b){return a.namespace()===_.gd?!1:pS()?(this.Ra.warn("IMA SDK is not loaded."),!1):!(!b||!b.ima)}create(a){return new HS(a)}});_.Wn(new GS);};f.call(g, window);
package/cl.mediatailor.js CHANGED
@@ -1,3 +1,2 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var qT=function(a,b,c){return _.w(function*(){var d=yield(yield fetch(b,{method:_.db,body:JSON.stringify(c.sessionConfig)})).json();const e=d.trackingUrl;d={ng:_.Ti(d.manifestUrl,b),gj:e?_.Ti(e,b):null};a.g.info(`Media Tailor session initialized.
2
- - manifest URI: ${d.ng}`);return d})},rT=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 qT(c,b.url,d);a.trigger(new _.C("mt-session-started"));b.url=e.ng}catch(e){throw c.g.error("Failed to start session",e),new _.I(_.F,9,7003,"Media Tailor session failed to initialize.");}}})}id(){return"mediatailor"}};
3
- _.fs(new class{create(){return new rT}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var mS=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={Eg:_.Wm(d.manifestUrl,b),Bj:e?_.Wm(e,b):null};a.g.info(`Media Tailor session initialized.
2
+ - manifest URI: ${d.Eg}`);return d})},nS=class extends _.Uv{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 mS(c,b.url,d);a.trigger(new _.G("mt-session-started"));b.url=e.Eg}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"}};_.Wn(new class{create(){return new nS}});};f.call(g, window);