@castlabs/prestoplay 6.25.2 → 6.26.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 (68) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +5 -5
  3. package/cjs/cl.adobe.js +3 -3
  4. package/cjs/cl.airplay.js +3 -3
  5. package/cjs/cl.broadpeak.js +7 -7
  6. package/cjs/cl.cast.js +112 -112
  7. package/cjs/cl.conviva.js +32 -32
  8. package/cjs/cl.core.js +601 -600
  9. package/cjs/cl.crypto.js +9 -9
  10. package/cjs/cl.dash.js +89 -88
  11. package/cjs/cl.externs.js +37 -31
  12. package/cjs/cl.freewheel.js +24 -24
  13. package/cjs/cl.hls.js +77 -77
  14. package/cjs/cl.hlssmpte.js +6 -6
  15. package/cjs/cl.htmlcue.js +30 -30
  16. package/cjs/cl.ima.js +23 -23
  17. package/cjs/cl.mediatailor.js +3 -3
  18. package/cjs/cl.mse.js +341 -334
  19. package/cjs/cl.muxdata.js +15 -15
  20. package/cjs/cl.onboard.js +3 -3
  21. package/cjs/cl.persistent.js +14 -14
  22. package/cjs/cl.playlist.js +6 -6
  23. package/cjs/cl.sessions.js +16 -16
  24. package/cjs/cl.simid.js +17 -17
  25. package/cjs/cl.smooth.js +72 -72
  26. package/cjs/cl.thumbnails.js +26 -26
  27. package/cjs/cl.tizen.js +71 -71
  28. package/cjs/cl.ttml.js +29 -29
  29. package/cjs/cl.verimatrix.js +5 -5
  30. package/cjs/cl.vimond.js +12 -12
  31. package/cjs/cl.vr.js +19 -19
  32. package/cjs/cl.vtt.js +14 -14
  33. package/cjs/cl.yospace.js +4 -4
  34. package/cjs/cl.youbora.js +38 -36
  35. package/cl.adobe.js +3 -3
  36. package/cl.airplay.js +3 -3
  37. package/cl.broadpeak.js +5 -5
  38. package/cl.cast.js +87 -87
  39. package/cl.conviva.js +27 -27
  40. package/cl.core.js +489 -488
  41. package/cl.crypto.js +9 -9
  42. package/cl.dash.js +82 -82
  43. package/cl.externs.js +37 -31
  44. package/cl.freewheel.js +19 -19
  45. package/cl.hls.js +79 -80
  46. package/cl.hlssmpte.js +5 -5
  47. package/cl.htmlcue.js +26 -26
  48. package/cl.ima.js +17 -17
  49. package/cl.mediatailor.js +3 -3
  50. package/cl.mse.js +299 -292
  51. package/cl.muxdata.js +13 -13
  52. package/cl.onboard.js +4 -4
  53. package/cl.persistent.js +10 -10
  54. package/cl.playlist.js +5 -5
  55. package/cl.sessions.js +10 -10
  56. package/cl.simid.js +14 -14
  57. package/cl.smooth.js +60 -60
  58. package/cl.thumbnails.js +19 -19
  59. package/cl.tizen.js +57 -57
  60. package/cl.ttml.js +22 -22
  61. package/cl.verimatrix.js +4 -4
  62. package/cl.vimond.js +8 -8
  63. package/cl.vr.js +14 -14
  64. package/cl.vtt.js +12 -12
  65. package/cl.yospace.js +3 -3
  66. package/cl.youbora.js +28 -27
  67. package/package.json +3 -3
  68. package/typings.d.ts +41 -3
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 vT="Unsupported unit",wT="clpp-text-plain",xT="clpp-text-ttml",yT="clpp.htmlcue.HtmlTextDisplayer",zT="initial",AT=function(a){return _.di(a,{Of:(b,c)=>b.Oc(c)})},BT=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)},CT=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},DT=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},FT=function(a){let b=null;for(;b=a.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)a=a.replace(b[0],c=>ET[c]);return a},HT=function(a,b){GT(a,b);Array.from(b.getElementsByTagName("*")).forEach(c=>{GT(a,c)})},GT=function(a,b){for(const c in a)null!=a[c]&&(b.style[c]=a[c])},IT=function(a,b){return 0===a?"0":a+b},JT=function(a,b){return 1>Math.abs(a-b)||a<b},KT=function(a,b){return a<b&&1<Math.abs(a-b)},LT=function(a,b){return a>b&&1<Math.abs(a-b)},MT=
3
- function(a,b){return 1>Math.abs(a-b)||a>b},OT=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 NT(b.left+d,b.right+e,g,(b.bottom||g+f)+c,f,(b.width||a.offsetWidth)-
4
- d-e)},PT=function(a){return new NT(a.left,a.f,a.top,a.a,a.height,a.width)},QT=function(a,b){return b.some(c=>KT(a.left,c.f)&&LT(a.f,c.left)&&KT(a.top,c.a)&&LT(a.a,c.top))},RT=function(a,b){return MT(a.top,b.top)&&JT(a.a,b.a)&&MT(a.left,b.left)&&JT(a.f,b.f)},ST=function(a,b,c){switch(c){case "+x":return KT(a.left,b.left);case "-x":return LT(a.f,b.f);case "+y":return KT(a.top,b.top);case "-y":return LT(a.a,b.a);default:throw Error("Unknown axis");}},TT=function(a){return a.f.writingMode===_.Rt},UT=
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 TT(a)?b:c},VT=function(a){switch(a.f.writingMode){case _.Rt:return"horizontal-tb";case _.mg:return _.mg;case _.ng:return _.ng;default:throw Error("Unknown writing mode");}},WT=function(a){switch(a.f.positionAlign){case _.he:return _.ee;case "auto":case _.Uc:return _.Qt;case _.ie:return _.wf}return a.f.textAlign},XT=function(a,b){if(typeof a.f.position===_.t&&typeof a.f.size===
6
- _.t)switch(b){case _.he:return a.f.position;case "auto":case _.Uc:return a.f.position-a.f.size/2;case _.ie:return a.f.position-a.f.size}return 0},YT=function(a){if(!a.f.positionAlign)switch(a.f.textAlign){case _.Jf:case _.ee:return _.he;case _.Qt:return _.Uc;case _.Rd:case _.wf:return _.ie}return a.f.positionAlign},aU=function(a,b,c){return(ZT(a)||$T(a))&&_.dh(c)?IT(c,_.of):ZT(a)&&_.B(c)?IT(0,_.of):TT(a)&&_.dh(b)?IT(b,"%"):zT},bU=function(a,b,c){return TT(a)&&_.dh(c)?IT(c,_.of):(ZT(a)||$T(a))&&_.dh(b)?
7
- IT(b,"%"):zT},$T=function(a){return a.f.writingMode===_.ng},ZT=function(a){return a.f.writingMode===_.mg},cU=function(a,b){if(a.j)switch(b.writingMode){case _.Rt:return["-y"];case _.mg:return["+x"];case _.ng:return["-x"]}a=[];switch(b.writingMode){case _.Rt:a=["+y","-y"];break;case _.mg:a=["+x","-x"];break;case _.ng:a=["-x","+x"]}0>b.line&&(a=a.reverse());return a},dU=function(a){for(a.h=[];0<a.f.childNodes.length;)a.f.removeChild(a.f.childNodes[0]);a.a=OT(a.l.a)},eU=function(a,b,c){a=a.f;const d=
8
- a.viewportAnchorUnits;if(d===_.Yt)return a.viewportAnchorY/100*c-a.regionAnchorY/100*b;if(0===d)return a.viewportAnchorY-a.regionAnchorY;throw Error(vT);},gU=function(a,b,c,d){const e=document.createElement(_.Pf),f=e.dataset;f.name=b;f.for=c;d&&(f.name=`${b} (sandbox)`,f.sandbox=!0);c=document.head;c.appendChild(e);fU(a,c,b);a.g.debug(`Created HTML style element #${b}.`);return e.sheet},hU=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)},iU=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},jU=function(a){if(null!=a.a){for(;0<a.a.cssRules.length;)a.a.deleteRule(0);
10
- a.o=[]}},fU=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())},kU=function(a){a=_.Xg(a.htmlcue||{});_.B(a.stretchSmpteImage)&&(a.stretchSmpteImage=!1);_.B(a.enableResizeObserver)&&(a.enableResizeObserver=!0);return a},qU=function(a,b){if((b||a.l)&&a.F){var c=a.m.getPosition();
11
- if(b||a.J!==c&&a.m.getState()===_.Wo)if(a.J=c,c=lU(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,mU(a),c)){b={color:a.getFontColor()||void 0,backgroundColor:a.getBackgroundColor()||void 0,fontFamily:a.getFontFamily()||void 0,textShadow:_.Ft(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 _.xg:g="clpp-text-vtt";break;case _.bg:g=xT;break;case _.Pt:g=wT}g&&!f.classList.contains(g)&&
12
- _.pp(f,g);f=OT(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{GT({fontSize:nU(c,d.containerRows)},c.a.a);f=null;g=d.payloadType===_.xg;var h=d.payloadType===_.bg;d.region&&(g||h||d.backgroundImage)&&(c.B.has(d.region.id)?f=c.B.get(d.region.id):(f=new oU(d.region,{}),c.B.set(d.region.id,f),c.a.appendChild(f)));d=new pU(d,c.L,e);f?f.appendChild(d):
13
- c.a.appendChild(d)}}}}},rU=function(a){mU(a);a.J=null;a.o=null;a.f=[]},sU=function(a,b){return a.startTime<=b&&a.endTime>b},lU=function(a,b){var c=CT(a.f,d=>sU(d,b)?0:b!==d.startTime?b-d.startTime:b-d.endTime);if(-1===c)return null;{let d=c;for(;0<=d-1&&sU(a.f[d-1],b);)d--;for(;c+1<a.f.length&&sU(a.f[c+1],b);)c++;return{start:d,end:c}}},mU=function(a){a.B.clear();if(a.a){const b=a.a.a;b.classList.remove("clpp-text-vtt");b.classList.remove(xT);b.classList.remove(wT);a=a.a;dU(a.h);a.l=[]}},nU=function(a,
14
- b){const c=OT(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===_.t&&0<b)return`${Math.round(c/b)}px`;a=a.getFontSizePercent();return`${Math.round(c*a)}px`},wU=class{parse(a){a={input:a};const b=_.rp(_.Cd),c=[];let d=b;for(var e;null!==(e=DT(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=tU[f];h?(h=_.rp(h),(f=uU[f])&&g&&h.setAttribute(f,g.trim()),g=h):g=null;!g||vU[g.localName]&&vU[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(FT(e)));return b}},tU={c:"c",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"v",lang:"lang"},uU={v:"voice",lang:"lang"},vU={rt:"ruby"},ET={"\x26amp;":"\x26","\x26lt;":"\x3c","\x26gt;":"\x3e","\x26lrm;":"\u200e","\x26rlm;":"\u200f",
16
- "\x26nbsp;":"\u00a0"};var NT=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 xU=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 pU=class extends xU{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)_.pp(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===_.bg){var c=_.rp(_.Cd);c.innerHTML=b.payload;b=c}else b.payloadType===
17
- _.xg?b=(new wU).parse(b.payload):(c=_.rp(_.Cd),c.textContent=b.payload,b=c);_.pp(b,this.w);this.id&&(b.id=this.id);for(d of this.f.cssClassList)_.pp(b,d);GT({writingMode:VT(this)},b);var d=b;this.a.appendChild(d);_.pp(this.a,"clpp-text-wrapper");for(var e of this.f.cssClassList)_.pp(this.a,`clpp-text-wrapper__${e}`);_.B(this.f.line)&&(this.f.lineInterpretation=_.St,this.f.line=TT(this)?-1:0);e=VT(this);GT({writingMode:e,webkitWritingMode:e,direction:zT,textAlign:WT(this)},this.a);if(!this.f.region||
18
- !this.f.region.displayAlign){e=XT(this,YT(this));GT({position:"absolute",left:aU(this,e,null),right:$T(this)&&_.B(null)?IT(0,_.of):zT,top:bU(this,e,null),width:TT(this)?IT(this.f.size,"%"):zT,height:ZT(this)||$T(this)?IT(this.f.size,"%"):zT},this.a);b=this.f;a=TT(this)?a.height:a.width;c=UT(this);if(b.lineInterpretation===_.St){var f=c*Math.round(b.line);Math.abs(f)>a&&(f=c*(0>b.line?0:-1));0>f&&(f+=a)}else{f=c/a*100;let g=b.line;switch(b.lineAlign){case _.Uc:g-=f/2;break;case _.Rd:g-=f}f=Math.round(g/
19
- 100*a)}$T(this)&&(f=a-f-c);a=f;GT({left:aU(this,e,a),right:$T(this)&&_.B(a)?IT(0,_.of):zT,top:bU(this,e,a)},this.a)}HT(this.C,d)}}o(){return _.rp(_.Cd)}};var yU=class{constructor(a,b){this.l=a;this.f=a.a;this.j=void 0===b?!1:b;this.a=OT(a.a);this.h=[]}append(a){const b=a.a;b.style.visibility=_.$d;this.f.appendChild(b);a.j||a.init(this.a);if(a.A()){a:{var c=OT(a.a);var d=cU(this,a.f),e=UT(a);const g=PT(c);let h=null,k=0;for(const l of d){for(;ST(c,this.a,l)||RT(c,this.a)&&QT(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||RT(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=PT(c),k=d);c=PT(g)}c=h||g}GT({top:IT(c.top-this.a.top,_.of),bottom:IT(this.a.a-c.a,_.of),left:IT(c.left-this.a.left,_.of),right:IT(this.a.f-c.f,_.of),height:IT(c.height,_.of),width:IT(c.width,_.of)},a.a)}b.style.visibility="visible";this.h.push(OT(a.a))}};var zU=class extends xU{constructor(a,b,c){super(a,b,c);this.h=null;this.l=[]}init(){this.h=new yU(this);this.j=!0}o(){const a=_.rp(_.Cd);_.pp(a,this.w);this.id&&(a.id=this.id);return a}appendChild(a){dU(this.h);this.l.unshift(a);for(const b of this.l)this.h.append(b)}};var oU=class extends zU{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 _.Yt:b=b.width/100*a.width;break a;default:throw Error(vT);}}var c=this.f;var d=c.viewportAnchorUnits;if(d===_.Yt)c=c.viewportAnchorX/100*a.width-c.regionAnchorX/100*b;else if(0===d)c=c.viewportAnchorX-c.regionAnchorX;else throw Error(vT);d=a.height;const e=eU(this,d,a.height);GT(this.B,this.a);GT({left:IT(c,_.of),top:IT(e,_.of),width:IT(b,
21
- _.of),height:IT(d,_.of)},this.a);this.f.writingMode&&GT({display:"flex","flex-direction":this.f.writingMode},this.a);this.f.displayAlign&&GT({"justify-content":this.f.displayAlign},this.a);for(var f of this.f.cssClassList)_.pp(this.a,f);a:switch(f=this.f,f.heightUnits){case 0:f=f.height;break a;case _.Yt:f=f.height/100*a.height;break a;case 2:f=f.height;c=new pU(new _.Vt(0,1,"Lorem ipsum",_.Pt),{},{});b=c.a;this.a.appendChild(b);c.init(OT(this.a));c=b.getBoundingClientRect().height;this.a.removeChild(b);
22
- b=c;f*=b;break a;default:throw Error(vT);}a=eU(this,f,a.height);GT({top:IT(a,_.of),height:IT(f,_.of)},this.a);this.h=new yU(this,!0);this.j=!0}getId(){return this.f.id}};var AU=class{constructor(a,b){this.g=new _.S("clpp.htmlcue.StyleManager");this.l=[];this.j=a;this.h=b;this.o=[];this.a=gU(this,this.h,this.j);this.f=gU(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=hU(this,a);if(iU(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 _.x(function*(){null!=a.a&&(a.l.forEach(b=>b()),a.l=[],jU(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 BU=class extends _.Mv{constructor(a){super(a);this.g=new _.S(yT);this.m=a;this.L=kU(a.getConfiguration());this.l=!1;this.f=[];this.F=a.getSurface().getContainer();this.j=new AU(a.getSurface().getUniqueCssClass(),"CLPP Subtitle Styles");this.a=new zU(null,"clpp-text-container",{});this.A=new _.Fv(a.getSurface(),this.S.bind(this));this.J=null;this.F?(this.F.appendChild(this.a.a),this.a.init(null)):this.g.warn("No container element! Subtitles will not appear. Please check your player surface configuration or switch to NativeTextDisplayer.");
24
- this.G=new _.rk(()=>{qU(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=BT(this.f,AT(a));this.o=null;qU(this,!1)}}h(){null==this.j||qU(this,!0)}destroy(){const a=this;return _.x(function*(){null!=a.j&&(rU(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;qU(this,!0);return!0}isTextVisible(){return this.l}setTextVisibility(a){null!=this.j&&this.l!==a&&((this.l=a)?(this.G.Bb(.25),this.L.enableResizeObserver&&this.A.start(),qU(this,!0)):(this.G.stop(),this.A.stop(),rU(this)))}S(){qU(this,!0)}};_.z(yT,BU);BU.prototype.setTextVisibility=BU.prototype.setTextVisibility;BU.prototype.isTextVisible=BU.prototype.isTextVisible;BU.prototype.remove=BU.prototype.remove;BU.prototype.destroy=BU.prototype.destroy;
26
- BU.prototype.append=BU.prototype.append;var CU=class{a(a){return!!a.enableHtmlCue&&!_.Hk()}create(a){return new BU(a)}};_.z("clpp.htmlcue.HtmlCueComponent",class extends _.Av{f(){_.Co(_.ae,new CU)}a(){_.Ao.has(_.ae)&&(_.Ao.delete(_.ae),_.Bo.info("Removed factory: 'html'"))}id(){return _.Qf}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var JT="Unsupported unit",KT="clpp-text-plain",LT="clpp-text-ttml",MT="clpp.htmlcue.HtmlTextDisplayer",NT="initial",OT=function(a){return _.fi(a,{Pf:(b,c)=>b.Oc(c)})},PT=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)},QT=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},RT=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},TT=function(a){let b=null;for(;b=a.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)a=a.replace(b[0],c=>ST[c]);return a},VT=function(a,b){UT(a,b);Array.from(b.getElementsByTagName("*")).forEach(c=>{UT(a,c)})},UT=function(a,b){for(const c in a)null!=a[c]&&(b.style[c]=a[c])},WT=function(a,b){return 0===a?"0":a+b},XT=function(a,b){return 1>Math.abs(a-b)||a<b},YT=function(a,b){return a<b&&1<Math.abs(a-b)},ZT=function(a,b){return a>b&&1<Math.abs(a-b)},$T=
3
+ function(a,b){return 1>Math.abs(a-b)||a>b},bU=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 aU(b.left+d,b.right+e,g,(b.bottom||g+f)+c,f,(b.width||a.offsetWidth)-
4
+ d-e)},cU=function(a){return new aU(a.left,a.f,a.top,a.a,a.height,a.width)},dU=function(a,b){return b.some(c=>YT(a.left,c.f)&&ZT(a.f,c.left)&&YT(a.top,c.a)&&ZT(a.a,c.top))},eU=function(a,b){return $T(a.top,b.top)&&XT(a.a,b.a)&&$T(a.left,b.left)&&XT(a.f,b.f)},fU=function(a,b,c){switch(c){case "+x":return YT(a.left,b.left);case "-x":return ZT(a.f,b.f);case "+y":return YT(a.top,b.top);case "-y":return ZT(a.a,b.a);default:throw Error("Unknown axis");}},gU=function(a){return a.f.writingMode===_.Vt},hU=
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 gU(a)?b:c},iU=function(a){switch(a.f.writingMode){case _.Vt:return"horizontal-tb";case _.og:return _.og;case _.pg:return _.pg;default:throw Error("Unknown writing mode");}},jU=function(a){switch(a.f.positionAlign){case _.ie:return _.fe;case "auto":case _.Vc:return _.Ut;case _.je:return _.yf}return a.f.textAlign},kU=function(a,b){if(typeof a.f.position===_.t&&typeof a.f.size===
6
+ _.t)switch(b){case _.ie:return a.f.position;case "auto":case _.Vc:return a.f.position-a.f.size/2;case _.je:return a.f.position-a.f.size}return 0},lU=function(a){if(!a.f.positionAlign)switch(a.f.textAlign){case _.Lf:case _.fe:return _.ie;case _.Ut:return _.Vc;case _.Rd:case _.yf:return _.je}return a.f.positionAlign},oU=function(a,b,c){return(mU(a)||nU(a))&&_.fh(c)?WT(c,_.qf):mU(a)&&_.B(c)?WT(0,_.qf):gU(a)&&_.fh(b)?WT(b,"%"):NT},pU=function(a,b,c){return gU(a)&&_.fh(c)?WT(c,_.qf):(mU(a)||nU(a))&&_.fh(b)?
7
+ WT(b,"%"):NT},nU=function(a){return a.f.writingMode===_.pg},mU=function(a){return a.f.writingMode===_.og},qU=function(a,b){if(a.j)switch(b.writingMode){case _.Vt:return["-y"];case _.og:return["+x"];case _.pg:return["-x"]}a=[];switch(b.writingMode){case _.Vt:a=["+y","-y"];break;case _.og:a=["+x","-x"];break;case _.pg:a=["-x","+x"]}0>b.line&&(a=a.reverse());return a},rU=function(a){for(a.h=[];0<a.f.childNodes.length;)a.f.removeChild(a.f.childNodes[0]);a.a=bU(a.l.a)},sU=function(a,b,c){a=a.f;const d=
8
+ a.viewportAnchorUnits;if(d===_.bu)return a.viewportAnchorY/100*c-a.regionAnchorY/100*b;if(0===d)return a.viewportAnchorY-a.regionAnchorY;throw Error(JT);},uU=function(a,b,c,d){const e=document.createElement(_.Rf),f=e.dataset;f.name=b;f.for=c;d&&(f.name=`${b} (sandbox)`,f.sandbox=!0);c=document.head;c.appendChild(e);tU(a,c,b);a.g.debug(`Created HTML style element #${b}.`);return e.sheet},vU=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)},wU=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},xU=function(a){if(null!=a.a){for(;0<a.a.cssRules.length;)a.a.deleteRule(0);
10
+ a.o=[]}},tU=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())},yU=function(a){a=_.Zg(a.htmlcue||{});_.B(a.stretchSmpteImage)&&(a.stretchSmpteImage=!1);_.B(a.enableResizeObserver)&&(a.enableResizeObserver=!0);return a},EU=function(a,b){if((b||a.l)&&a.F){var c=a.m.getPosition();
11
+ if(b||a.J!==c&&a.m.getState()===_.Zo)if(a.J=c,c=zU(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,AU(a),c)){b={color:a.getFontColor()||void 0,backgroundColor:a.getBackgroundColor()||void 0,fontFamily:a.getFontFamily()||void 0,textShadow:_.Jt(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 _.zg:g="clpp-text-vtt";break;case _.dg:g=LT;break;case _.Tt:g=KT}g&&!f.classList.contains(g)&&
12
+ _.sp(f,g);f=bU(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{UT({fontSize:BU(c,d.containerRows)},c.a.a);f=null;g=d.payloadType===_.zg;var h=d.payloadType===_.dg;d.region&&(g||h||d.backgroundImage)&&(c.B.has(d.region.id)?f=c.B.get(d.region.id):(f=new CU(d.region,{}),c.B.set(d.region.id,f),c.a.appendChild(f)));d=new DU(d,c.L,e);f?f.appendChild(d):
13
+ c.a.appendChild(d)}}}}},FU=function(a){AU(a);a.J=null;a.o=null;a.f=[]},GU=function(a,b){return a.startTime<=b&&a.endTime>b},zU=function(a,b){var c=QT(a.f,d=>GU(d,b)?0:b!==d.startTime?b-d.startTime:b-d.endTime);if(-1===c)return null;{let d=c;for(;0<=d-1&&GU(a.f[d-1],b);)d--;for(;c+1<a.f.length&&GU(a.f[c+1],b);)c++;return{start:d,end:c}}},AU=function(a){a.B.clear();if(a.a){const b=a.a.a;b.classList.remove("clpp-text-vtt");b.classList.remove(LT);b.classList.remove(KT);a=a.a;rU(a.h);a.l=[]}},BU=function(a,
14
+ b){const c=bU(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===_.t&&0<b)return`${Math.round(c/b)}px`;a=a.getFontSizePercent();return`${Math.round(c*a)}px`},KU=class{parse(a){a={input:a};const b=_.up(_.Cd),c=[];let d=b;for(var e;null!==(e=RT(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=HU[f];h?(h=_.up(h),(f=IU[f])&&g&&h.setAttribute(f,g.trim()),g=h):g=null;!g||JU[g.localName]&&JU[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(TT(e)));return b}},HU={c:"c",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"v",lang:"lang"},IU={v:"voice",lang:"lang"},JU={rt:"ruby"},ST={"\x26amp;":"\x26","\x26lt;":"\x3c","\x26gt;":"\x3e","\x26lrm;":"\u200e","\x26rlm;":"\u200f",
16
+ "\x26nbsp;":"\u00a0"};var aU=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 LU=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 DU=class extends LU{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)_.sp(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===_.dg){var c=_.up(_.Cd);c.innerHTML=b.payload;b=c}else b.payloadType===
17
+ _.zg?b=(new KU).parse(b.payload):(c=_.up(_.Cd),c.textContent=b.payload,b=c);_.sp(b,this.w);this.id&&(b.id=this.id);for(d of this.f.cssClassList)_.sp(b,d);UT({writingMode:iU(this)},b);var d=b;this.a.appendChild(d);_.sp(this.a,"clpp-text-wrapper");for(var e of this.f.cssClassList)_.sp(this.a,`clpp-text-wrapper__${e}`);_.B(this.f.line)&&(this.f.lineInterpretation=_.Wt,this.f.line=gU(this)?-1:0);e=iU(this);UT({writingMode:e,webkitWritingMode:e,direction:NT,textAlign:jU(this)},this.a);if(!this.f.region||
18
+ !this.f.region.displayAlign){e=kU(this,lU(this));UT({position:"absolute",left:oU(this,e,null),right:nU(this)&&_.B(null)?WT(0,_.qf):NT,top:pU(this,e,null),width:gU(this)?WT(this.f.size,"%"):NT,height:mU(this)||nU(this)?WT(this.f.size,"%"):NT},this.a);b=this.f;a=gU(this)?a.height:a.width;c=hU(this);if(b.lineInterpretation===_.Wt){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 _.Rd:g-=f}f=Math.round(g/
19
+ 100*a)}nU(this)&&(f=a-f-c);a=f;UT({left:oU(this,e,a),right:nU(this)&&_.B(a)?WT(0,_.qf):NT,top:pU(this,e,a)},this.a)}VT(this.C,d)}}o(){return _.up(_.Cd)}};var MU=class{constructor(a,b){this.l=a;this.f=a.a;this.j=void 0===b?!1:b;this.a=bU(a.a);this.h=[]}append(a){const b=a.a;b.style.visibility=_.$d;this.f.appendChild(b);a.j||a.init(this.a);if(a.A()){a:{var c=bU(a.a);var d=qU(this,a.f),e=hU(a);const g=cU(c);let h=null,k=0;for(const l of d){for(;fU(c,this.a,l)||eU(c,this.a)&&dU(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||eU(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=cU(c),k=d);c=cU(g)}c=h||g}UT({top:WT(c.top-this.a.top,_.qf),bottom:WT(this.a.a-c.a,_.qf),left:WT(c.left-this.a.left,_.qf),right:WT(this.a.f-c.f,_.qf),height:WT(c.height,_.qf),width:WT(c.width,_.qf)},a.a)}b.style.visibility="visible";this.h.push(bU(a.a))}};var NU=class extends LU{constructor(a,b,c){super(a,b,c);this.h=null;this.l=[]}init(){this.h=new MU(this);this.j=!0}o(){const a=_.up(_.Cd);_.sp(a,this.w);this.id&&(a.id=this.id);return a}appendChild(a){rU(this.h);this.l.unshift(a);for(const b of this.l)this.h.append(b)}};var CU=class extends NU{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 _.bu:b=b.width/100*a.width;break a;default:throw Error(JT);}}var c=this.f;var d=c.viewportAnchorUnits;if(d===_.bu)c=c.viewportAnchorX/100*a.width-c.regionAnchorX/100*b;else if(0===d)c=c.viewportAnchorX-c.regionAnchorX;else throw Error(JT);d=a.height;const e=sU(this,d,a.height);UT(this.B,this.a);UT({left:WT(c,_.qf),top:WT(e,_.qf),width:WT(b,
21
+ _.qf),height:WT(d,_.qf)},this.a);this.f.writingMode&&UT({display:"flex","flex-direction":this.f.writingMode},this.a);this.f.displayAlign&&UT({"justify-content":this.f.displayAlign},this.a);for(var f of this.f.cssClassList)_.sp(this.a,f);a:switch(f=this.f,f.heightUnits){case 0:f=f.height;break a;case _.bu:f=f.height/100*a.height;break a;case 2:f=f.height;c=new DU(new _.Zt(0,1,"Lorem ipsum",_.Tt),{},{});b=c.a;this.a.appendChild(b);c.init(bU(this.a));c=b.getBoundingClientRect().height;this.a.removeChild(b);
22
+ b=c;f*=b;break a;default:throw Error(JT);}a=sU(this,f,a.height);UT({top:WT(a,_.qf),height:WT(f,_.qf)},this.a);this.h=new MU(this,!0);this.j=!0}getId(){return this.f.id}};var OU=class{constructor(a,b){this.g=new _.T("clpp.htmlcue.StyleManager");this.l=[];this.j=a;this.h=b;this.o=[];this.a=uU(this,this.h,this.j);this.f=uU(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=vU(this,a);if(wU(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 _.x(function*(){null!=a.a&&(a.l.forEach(b=>b()),a.l=[],xU(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 PU=class extends _.Pv{constructor(a){super(a);this.g=new _.T(MT);this.m=a;this.L=yU(a.getConfiguration());this.l=!1;this.f=[];this.F=a.getSurface().getContainer();this.j=new OU(a.getSurface().getUniqueCssClass(),"CLPP Subtitle Styles");this.a=new NU(null,"clpp-text-container",{});this.A=new _.Iv(a.getSurface(),this.S.bind(this));this.J=null;this.F?(this.F.appendChild(this.a.a),this.a.init(null)):this.g.warn("No container element! Subtitles will not appear. Please check your player surface configuration or switch to NativeTextDisplayer.");
24
+ this.G=new _.wk(()=>{EU(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=PT(this.f,OT(a));this.o=null;EU(this,!1)}}h(){null==this.j||EU(this,!0)}destroy(){const a=this;return _.x(function*(){null!=a.j&&(FU(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;EU(this,!0);return!0}isTextVisible(){return this.l}setTextVisibility(a){null!=this.j&&this.l!==a&&((this.l=a)?(this.G.Bb(.25),this.L.enableResizeObserver&&this.A.start(),EU(this,!0)):(this.G.stop(),this.A.stop(),FU(this)))}S(){EU(this,!0)}};_.z(MT,PU);PU.prototype.setTextVisibility=PU.prototype.setTextVisibility;PU.prototype.isTextVisible=PU.prototype.isTextVisible;PU.prototype.remove=PU.prototype.remove;PU.prototype.destroy=PU.prototype.destroy;
26
+ PU.prototype.append=PU.prototype.append;var QU=class{a(a){return!!a.enableHtmlCue&&!_.Mk()}create(a){return new PU(a)}};_.z("clpp.htmlcue.HtmlCueComponent",class extends _.Dv{f(){_.Fo(_.ae,new QU)}a(){_.Do.has(_.ae)&&(_.Do.delete(_.ae),_.Eo.info("Removed factory: 'html'"))}id(){return _.Sf}});};f.call(g, window);
package/cl.ima.js CHANGED
@@ -1,17 +1,17 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var dT="clpp.ima.AdsManagerFactory",eT=function(a){a=a.K;const b=new google.ima.AdsRenderingSettings;b.restoreCustomPlaybackStateOnAdBreakComplete=!1;typeof a.bitrate===_.t&&(b.bitrate=a.bitrate);b.enablePreloading=typeof a.enablePreloading===_.Lc?a.enablePreloading:!0;typeof a.loadVideoTimeout===_.t&&(b.loadVideoTimeout=a.loadVideoTimeout);Array.isArray(a.mimeTypes)&&(b.mimeTypes=a.mimeTypes);typeof a.playAdsAfterTime===_.t&&(b.playAdsAfterTime=a.playAdsAfterTime);typeof a.useStyledLinearAds===
2
- _.Lc&&(b.useStyledLinearAds=a.useStyledLinearAds);b.uiElements=Array.isArray(a.uiElements)?a.uiElements:[];return b},fT=function(a){return!1===a.K.disableCustomPlayback&&a.a.isCustomPlaybackUsed()&&_.vk()||_.yk()},gT=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.rc.bind(a));c.on(b,d.STARTED,a.ia.bind(a));c.on(b,d.LOG,a.Db.bind(a));c.on(b,d.AD_PROGRESS,a.da.bind(a));c.on(b,d.AD_BUFFERING,
3
- a.bb.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.lc.bind(a));c.on(b,d.CLICK,a.S.bind(a));c.on(b,d.SKIPPED,a.fa.bind(a));c.on(b,d.IMPRESSION,a.X.bind(a));c.on(b,d.COMPLETE,a.Cb.bind(a));c.on(b,d.CONTENT_RESUME_REQUESTED,a.uc.bind(a))},hT=function(a,b){const c=b?a.Ja.create(b.getErrorCode()):null;a.m.onError(new _.I(1,9,10003,{errorType:c},b))},iT=function(a){return _.x(function*(){yield a.m.detach();
4
- var b=a.m;b.a&&b.a.stopForwardingEventsTo(b)})},jT=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 _.F(b,d))},kT=function(a){a.B=null;jT(a,_.lc);a.m.getSurface().hide(a.P)},lT=function(a){return _.x(function*(){return new Promise(b=>{a.H.on(a.m,_.Kf,()=>{a.m.getState()===_.Vo&&b()})})})},mT=function(a){_.qp(a.A,{visibility:"visible"})},oT=function(a){return _.x(function*(){a.R.initialize();const b=!!a.m.getConfiguration().muted;(yield a.L.canPlay(b))||fT(a)?
5
- (fT(a)&&(yield iT(a)),nT(a)):(jT(a,_.Jc),a.g.warn(_.ja))})},pT=function(a,b){return _.x(function*(){a.R.initialize();yield b.play();nT(a)})},nT=function(a){a.a.init(a.A.offsetWidth,a.A.offsetHeight,google.ima.ViewMode.NORMAL);a.a.start();a.M=!0},qT=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}ob(){return"Google IMA SDK"}pb(){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()}Tb(){return this.f?
6
- this.f.getIsBumper():!1}qb(){let a=null;const b=this.a,c=Object.keys(b).find(d=>typeof b[d]===_.Ce&&typeof b[d].clickThroughUrl===_.Nf);c&&(a=b[c].clickThroughUrl);return a}getMediaUrl(){return this.a.getMediaUrl()}fb(){return this.a.getVastMediaWidth()}eb(){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}Hb(){return this.f?this.f.getTimeOffset():0}sb(){return this.f?this.f.getAdPosition():
7
- 1}gb(){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;
8
- W.prototype.getSequenceLength=W.prototype.gb;W.prototype.getPositionInSequence=W.prototype.sb;W.prototype.getPodTimeOffset=W.prototype.Hb;W.prototype.getPodIndex=W.prototype.getPodIndex;W.prototype.getPodType=W.prototype.Pa;W.prototype.getMediaBitrate=W.prototype.Oa;W.prototype.getMediaHeight=W.prototype.eb;W.prototype.getMediaWidth=W.prototype.fb;W.prototype.getMediaUrl=W.prototype.getMediaUrl;W.prototype.getClickThroughUrl=W.prototype.qb;W.prototype.isBumper=W.prototype.Tb;
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.Qb;W.prototype.getCreativeId=W.prototype.getCreativeId;W.prototype.getId=W.prototype.getId;
10
- W.prototype.getTechnology=W.prototype.ub;W.prototype.getAdManagerVersion=W.prototype.pb;W.prototype.getAdManagerName=W.prototype.ob;var rT=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 sT=class{constructor(a){this.a=a}getCuePoints(){return this.a}Kb(){return 0<=this.a.indexOf(0)||0===this.a.length}Jb(){return 0<=this.a.indexOf(-1)}};sT.prototype.hasPostroll=sT.prototype.Jb;sT.prototype.hasPreroll=sT.prototype.Kb;sT.prototype.getCuePoints=sT.prototype.getCuePoints;var tT=class{constructor(a){var b=a.jd("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.A=e;a=this.m.getConfiguration();a=_.Xg(a.ima||{});this.K=a=_.Wg({disableCustomPlayback:!1},a);this.P=c;this.R=d;this.w=b;this.L=new _.Hv;this.g=new _.S("clpp.ima");this.j=this.a=null;this.f=new _.bn;this.M=!1;this.H=new _.Nt;this.Ja=new rT;
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.oc.bind(this));c.on(this.w,d,this.mc.bind(this));c.on(this.m,_.Sd,this.pc.bind(this))}oc(a){this.a=a.getAdsManager(this.A,eT(this));this.a.isCustomPlaybackUsed()&&!fT(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 _.Fv(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 sT(a),this.m.trigger(new _.F(_.oc,{adsTimeline:this.C})),gT(this));this.f.resolve()}mc(a){hT(this,a.getError());this.f.resolve()}rc(a){const b=this;return _.x(function*(){b.J=!0;fT(b)?(b.I=b.m.getPosition(),yield iT(b)):(yield b.m.pause(),_.qp(b.A,{visibility:_.$d}));jT(b,_.Rb,a);b.j.start()})}Ua(){const a=this;return _.x(function*(){a.a.start()})}ba(a){a.getAd().isLinear()?
13
- jT(this,_.ac,a):(this.a.discardAdBreak(),this.G||(this.G=!0,this.m.play()))}ia(a){this.B=a.getAd().getDuration();jT(this,_.jc,a);this.m.getSurface().show(this.P)}Db(a){a=a.getAdData();hT(this,a?a.adError:null);kT(this)}da(a){jT(this,_.dc,a)}bb(a){jT(this,_.Tb,a)}V(a){jT(this,_.Wb,a)}jc(a){jT(this,_.bc,a)}za(a){jT(this,_.mc,a)}kc(a){jT(this,_.cc,a)}lc(a){jT(this,_.ec,a)}S(a){this.pause();jT(this,_.Ub,a)}fa(a){jT(this,_.fc,a);kT(this)}X(a){jT(this,_.$b,a)}Cb(a){jT(this,_.Vb,a);kT(this)}uc(){const a=
14
- this;return _.x(function*(){a.G=!0;if(fT(a)&&null!==a.I){var b=a.m;b.a&&b.a.forwardEventsTo(b);yield _.as(a.m);!a.F&&a.I&&(yield lT(a),yield a.m.seek(a.I))}else{if(!a.J)return a.m.play();mT(a)}a.J=!1;a.j&&a.j.stop();a.F||(yield a.m.play());jT(a,_.Sb)})}pc(){this.F=!0;this.w.contentComplete()}load(){const a=this;return _.x(function*(){var b=a.m;const c=a.K;try{if(typeof c.adTagUrl!==_.Nf)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 _.x(function*(){b.a&&b.C&&!b.M?b.C.Kb()?yield oT(b):yield pT(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);mT(this);this.H.release();this.j&&(this.j.stop(),this.j=null);return Promise.resolve()}};tT.prototype.getPosition=tT.prototype.getPosition;tT.prototype.setVolume=tT.prototype.setVolume;tT.prototype.getVolume=tT.prototype.getVolume;tT.prototype.skip=tT.prototype.skip;tT.prototype.pause=tT.prototype.pause;tT.prototype.resume=tT.prototype.resume;var uT=class extends _.Pv{constructor(){super();this.a=this.h=this.f=null}onPlayerCreated(a){if(qT())return a.onError(new _.I(1,9,1E4));this.f=_.op(_.Cd,{"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(_.qa);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)}xh(){return this.a}vh(){return this.h}Pc(){return this.f}id(){return"ima"}};_.z("clpp.ima.ImaPlugin",uT);uT.prototype.getAdContainer=uT.prototype.Pc;uT.prototype.getAdDisplayContainer=uT.prototype.vh;uT.prototype.getAdsLoader=uT.prototype.xh;uT.Id="ima";uT.isSdkMissing=qT;_.Ir(new class{create(){return new uT}});_.mp(new class{constructor(){this.Ra=new _.S(dT)}name(){return dT}a(a,b){return a.namespace()===_.dd?!1:qT()?(this.Ra.warn("IMA SDK is not loaded."),!1):!(!b||!b.ima)}create(a){return new tT(a)}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var rT="clpp.ima.AdsManagerFactory",sT=function(a){a=a.K;const b=new google.ima.AdsRenderingSettings;b.restoreCustomPlaybackStateOnAdBreakComplete=!1;typeof a.bitrate===_.t&&(b.bitrate=a.bitrate);b.enablePreloading=typeof a.enablePreloading===_.Mc?a.enablePreloading:!0;typeof a.loadVideoTimeout===_.t&&(b.loadVideoTimeout=a.loadVideoTimeout);Array.isArray(a.mimeTypes)&&(b.mimeTypes=a.mimeTypes);typeof a.playAdsAfterTime===_.t&&(b.playAdsAfterTime=a.playAdsAfterTime);typeof a.useStyledLinearAds===
2
+ _.Mc&&(b.useStyledLinearAds=a.useStyledLinearAds);b.uiElements=Array.isArray(a.uiElements)?a.uiElements:[];return b},tT=function(a){return!1===a.K.disableCustomPlayback&&a.a.isCustomPlaybackUsed()&&_.Ak()||_.Dk()},uT=function(a){const b=a.a,c=a.H,d=google.ima.AdEvent.Type;c.on(b,d.AD_BREAK_READY,a.Wa.bind(a));c.on(b,d.LOADED,a.ba.bind(a));c.on(b,d.CONTENT_PAUSE_REQUESTED,a.rc.bind(a));c.on(b,d.STARTED,a.ia.bind(a));c.on(b,d.LOG,a.Db.bind(a));c.on(b,d.AD_PROGRESS,a.da.bind(a));c.on(b,d.AD_BUFFERING,
3
+ a.bb.bind(a));c.on(b,d.FIRST_QUARTILE,a.V.bind(a));c.on(b,d.MIDPOINT,a.ac.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.lc.bind(a));c.on(b,d.CLICK,a.S.bind(a));c.on(b,d.SKIPPED,a.fa.bind(a));c.on(b,d.IMPRESSION,a.X.bind(a));c.on(b,d.COMPLETE,a.Cb.bind(a));c.on(b,d.CONTENT_RESUME_REQUESTED,a.uc.bind(a))},vT=function(a,b){const c=b?a.Ka.create(b.getErrorCode()):null;a.m.onError(new _.I(1,9,10003,{errorType:c},b))},wT=function(a){return _.x(function*(){yield a.m.detach();
4
+ var b=a.m;b.a&&b.a.stopForwardingEventsTo(b)})},xT=function(a,b,c){c=c&&c.getAd();let d=null;c&&(d={ad:new X(c,a.G,a.F)});a.m.trigger(new _.F(b,d))},yT=function(a){a.B=null;xT(a,_.lc);a.m.getSurface().hide(a.P)},zT=function(a){return _.x(function*(){return new Promise(b=>{a.H.on(a.m,_.Mf,()=>{a.m.getState()===_.Yo&&b()})})})},AT=function(a){_.tp(a.A,{visibility:"visible"})},CT=function(a){return _.x(function*(){a.R.initialize();const b=!!a.m.getConfiguration().muted;(yield a.L.canPlay(b))||tT(a)?
5
+ (tT(a)&&(yield wT(a)),BT(a)):(xT(a,_.Kc),a.g.warn(_.ja))})},DT=function(a,b){return _.x(function*(){a.R.initialize();yield b.play();BT(a)})},BT=function(a){a.a.init(a.A.offsetWidth,a.A.offsetHeight,google.ima.ViewMode.NORMAL);a.a.start();a.M=!0},ET=function(){return!window.google||!google.ima||!google.ima.AdsLoader},X=class{constructor(a,b,c){this.a=a;this.f=a.getAdPodInfo();this.j=b;this.h=c}ob(){return"Google IMA SDK"}pb(){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()}Tb(){return this.f?
6
+ this.f.getIsBumper():!1}qb(){let a=null;const b=this.a,c=Object.keys(b).find(d=>typeof b[d]===_.Ee&&typeof b[d].clickThroughUrl===_.Pf);c&&(a=b[c].clickThroughUrl);return a}getMediaUrl(){return this.a.getMediaUrl()}fb(){return this.a.getVastMediaWidth()}eb(){return this.a.getVastMediaHeight()}Qa(){return this.a.getVastMediaBitrate()}Ra(){return this.h?2:this.j?1:0}getPodIndex(){return this.f?this.f.getPodIndex():0}Hb(){return this.f?this.f.getTimeOffset():0}sb(){return this.f?this.f.getAdPosition():
7
+ 1}gb(){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}};X.prototype.getVideoElement=X.prototype.Sb;X.prototype.getWrapperCreativeIds=X.prototype.getWrapperCreativeIds;X.prototype.getWrapperAdSystems=X.prototype.getWrapperAdSystems;X.prototype.canSeek=X.prototype.canSeek;X.prototype.getWrapperAdIds=X.prototype.getWrapperAdIds;
8
+ X.prototype.getSequenceLength=X.prototype.gb;X.prototype.getPositionInSequence=X.prototype.sb;X.prototype.getPodTimeOffset=X.prototype.Hb;X.prototype.getPodIndex=X.prototype.getPodIndex;X.prototype.getPodType=X.prototype.Ra;X.prototype.getMediaBitrate=X.prototype.Qa;X.prototype.getMediaHeight=X.prototype.eb;X.prototype.getMediaWidth=X.prototype.fb;X.prototype.getMediaUrl=X.prototype.getMediaUrl;X.prototype.getClickThroughUrl=X.prototype.qb;X.prototype.isBumper=X.prototype.Tb;
9
+ X.prototype.getSkipTimeOffset=X.prototype.getSkipTimeOffset;X.prototype.getPosition=X.prototype.getPosition;X.prototype.getDuration=X.prototype.getDuration;X.prototype.getTitle=X.prototype.getTitle;X.prototype.getAdvertiserName=X.prototype.getAdvertiserName;X.prototype.getAdSystem=X.prototype.getAdSystem;X.prototype.getApiFramework=X.prototype.getApiFramework;X.prototype.getSourceId=X.prototype.Qb;X.prototype.getCreativeId=X.prototype.getCreativeId;X.prototype.getId=X.prototype.getId;
10
+ X.prototype.getTechnology=X.prototype.ub;X.prototype.getAdManagerVersion=X.prototype.pb;X.prototype.getAdManagerName=X.prototype.ob;var FT=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 GT=class{constructor(a){this.a=a}getCuePoints(){return this.a}Kb(){return 0<=this.a.indexOf(0)||0===this.a.length}Jb(){return 0<=this.a.indexOf(-1)}};GT.prototype.hasPostroll=GT.prototype.Jb;GT.prototype.hasPreroll=GT.prototype.Kb;GT.prototype.getCuePoints=GT.prototype.getCuePoints;var HT=class{constructor(a){var b=a.kd("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.A=e;a=this.m.getConfiguration();a=_.Zg(a.ima||{});this.K=a=_.Yg({disableCustomPlayback:!1},a);this.P=c;this.R=d;this.w=b;this.L=new _.Kv;this.g=new _.T("clpp.ima");this.j=this.a=null;this.f=new _.Ij;this.M=!1;this.H=new _.Rt;this.Ka=new FT;
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.oc.bind(this));c.on(this.w,d,this.mc.bind(this));c.on(this.m,_.Sd,this.pc.bind(this))}oc(a){this.a=a.getAdsManager(this.A,sT(this));this.a.isCustomPlaybackUsed()&&!tT(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 _.Iv(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 GT(a),this.m.trigger(new _.F(_.pc,{adsTimeline:this.C})),uT(this));this.f.resolve()}mc(a){vT(this,a.getError());this.f.resolve()}rc(a){const b=this;return _.x(function*(){b.J=!0;tT(b)?(b.I=b.m.getPosition(),yield wT(b)):(yield b.m.pause(),_.tp(b.A,{visibility:_.$d}));xT(b,_.Sb,a);b.j.start()})}Wa(){const a=this;return _.x(function*(){a.a.start()})}ba(a){a.getAd().isLinear()?
13
+ xT(this,_.bc,a):(this.a.discardAdBreak(),this.G||(this.G=!0,this.m.play()))}ia(a){this.B=a.getAd().getDuration();xT(this,_.hc,a);this.m.getSurface().show(this.P)}Db(a){a=a.getAdData();vT(this,a?a.adError:null);yT(this)}da(a){xT(this,_.ec,a)}bb(a){xT(this,_.Ub,a)}V(a){xT(this,_.Xb,a)}ac(a){xT(this,_.cc,a)}za(a){xT(this,_.nc,a)}kc(a){xT(this,_.dc,a)}lc(a){xT(this,_.fc,a)}S(a){this.pause();xT(this,_.Vb,a)}fa(a){xT(this,_.gc,a);yT(this)}X(a){xT(this,_.ac,a)}Cb(a){xT(this,_.Wb,a);yT(this)}uc(){const a=
14
+ this;return _.x(function*(){a.G=!0;if(tT(a)&&null!==a.I){var b=a.m;b.a&&b.a.forwardEventsTo(b);yield _.es(a.m);!a.F&&a.I&&(yield zT(a),yield a.m.seek(a.I))}else{if(!a.J)return a.m.play();AT(a)}a.J=!1;a.j&&a.j.stop();a.F||(yield a.m.play());xT(a,_.Tb)})}pc(){this.F=!0;this.w.contentComplete()}load(){const a=this;return _.x(function*(){var b=a.m;const c=a.K;try{if(typeof c.adTagUrl!==_.Pf)throw new _.I(1,9,10001,{missingKeys:"adTagUrl"});}catch(f){return b.onError(f),a.f.resolve(),a.f}if(!c.adTagUrl)return a.f.resolve(),
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 _.x(function*(){b.a&&b.C&&!b.M?b.C.Kb()?yield CT(b):yield DT(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);AT(this);this.H.release();this.j&&(this.j.stop(),this.j=null);return Promise.resolve()}};HT.prototype.getPosition=HT.prototype.getPosition;HT.prototype.setVolume=HT.prototype.setVolume;HT.prototype.getVolume=HT.prototype.getVolume;HT.prototype.skip=HT.prototype.skip;HT.prototype.pause=HT.prototype.pause;HT.prototype.resume=HT.prototype.resume;var IT=class extends _.Sv{constructor(){super();this.a=this.h=this.f=null}onPlayerCreated(a){if(ET())return a.onError(new _.I(1,9,1E4));this.f=_.rp(_.Cd,{"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)}yh(){return this.a}wh(){return this.h}Pc(){return this.f}id(){return"ima"}};_.z("clpp.ima.ImaPlugin",IT);IT.prototype.getAdContainer=IT.prototype.Pc;IT.prototype.getAdDisplayContainer=IT.prototype.wh;IT.prototype.getAdsLoader=IT.prototype.yh;IT.Id="ima";IT.isSdkMissing=ET;_.Mr(new class{create(){return new IT}});_.pp(new class{constructor(){this.Ta=new _.T(rT)}name(){return rT}a(a,b){return a.namespace()===_.dd?!1:ET()?(this.Ta.warn("IMA SDK is not loaded."),!1):!(!b||!b.ima)}create(a){return new HT(a)}});};f.call(g, window);
package/cl.mediatailor.js CHANGED
@@ -1,3 +1,3 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var bT=function(a,b,c){return _.x(function*(){var d=yield(yield fetch(b,{method:_.cb,body:JSON.stringify(c.sessionConfig)})).json();const e=d.trackingUrl;d={vg:_.Nj(d.manifestUrl,b),nj:e?_.Nj(e,b):null};a.g.info(`Media Tailor session initialized.
2
- - manifest URI: ${d.vg}`);return d})},cT=class extends _.Pv{constructor(){super();this.g=new _.S("clpp.mediatailor.MediaTailorPlugin")}onContentWillLoad(a,b){const c=this;return _.x(function*(){const d=a.getConfiguration().mediatailor;if(d.enabled){c.g.info("MediaTailor plugin is enabled");try{const e=yield bT(c,b.url,d);a.trigger(new _.F("mt-session-started"));b.url=e.vg}catch(e){throw c.g.error("Failed to start session",e),new _.I(_.G,9,7003,"Media Tailor session failed to initialize.");}}})}id(){return"mediatailor"}};
3
- _.Ir(new class{create(){return new cT}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var pT=function(a,b,c){return _.x(function*(){var d=yield(yield fetch(b,{method:_.db,body:JSON.stringify(c.sessionConfig)})).json();const e=d.trackingUrl;d={wg:_.ij(d.manifestUrl,b),oj:e?_.ij(e,b):null};a.g.info(`Media Tailor session initialized.
2
+ - manifest URI: ${d.wg}`);return d})},qT=class extends _.Sv{constructor(){super();this.g=new _.T("clpp.mediatailor.MediaTailorPlugin")}onContentWillLoad(a,b){const c=this;return _.x(function*(){const d=a.getConfiguration().mediatailor;if(d.enabled){c.g.info("MediaTailor plugin is enabled");try{const e=yield pT(c,b.url,d);a.trigger(new _.F("mt-session-started"));b.url=e.wg}catch(e){throw c.g.error("Failed to start session",e),new _.I(_.G,9,7003,"Media Tailor session failed to initialize.");}}})}id(){return"mediatailor"}};
3
+ _.Mr(new class{create(){return new qT}});};f.call(g, window);