@castlabs/prestoplay 6.17.1 → 6.18.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 (63) hide show
  1. package/CHANGELOG.md +30 -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 +111 -111
  6. package/cjs/cl.conviva.js +33 -33
  7. package/cjs/cl.core.js +566 -558
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +75 -74
  10. package/cjs/cl.externs.js +46 -46
  11. package/cjs/cl.freewheel.js +24 -24
  12. package/cjs/cl.hls.js +71 -69
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +29 -29
  15. package/cjs/cl.ima.js +23 -23
  16. package/cjs/cl.mse.js +311 -311
  17. package/cjs/cl.muxdata.js +15 -15
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +14 -14
  20. package/cjs/cl.playlist.js +6 -6
  21. package/cjs/cl.sessions.js +15 -15
  22. package/cjs/cl.simid.js +15 -15
  23. package/cjs/cl.smooth.js +72 -72
  24. package/cjs/cl.thumbnails.js +26 -26
  25. package/cjs/cl.tizen.js +69 -69
  26. package/cjs/cl.ttml.js +28 -28
  27. package/cjs/cl.verimatrix.js +5 -5
  28. package/cjs/cl.vimond.js +13 -13
  29. package/cjs/cl.vr.js +19 -19
  30. package/cjs/cl.vtt.js +14 -14
  31. package/cjs/cl.youbora.js +18 -18
  32. package/cl.adobe.js +3 -3
  33. package/cl.airplay.js +3 -3
  34. package/cl.broadpeak.js +5 -5
  35. package/cl.cast.js +87 -87
  36. package/cl.conviva.js +27 -27
  37. package/cl.core.js +456 -450
  38. package/cl.crypto.js +8 -8
  39. package/cl.dash.js +70 -69
  40. package/cl.externs.js +46 -46
  41. package/cl.freewheel.js +19 -19
  42. package/cl.hls.js +72 -72
  43. package/cl.hlssmpte.js +5 -5
  44. package/cl.htmlcue.js +26 -26
  45. package/cl.ima.js +17 -17
  46. package/cl.mse.js +274 -273
  47. package/cl.muxdata.js +13 -13
  48. package/cl.onboard.js +4 -4
  49. package/cl.persistent.js +10 -10
  50. package/cl.playlist.js +5 -5
  51. package/cl.sessions.js +10 -10
  52. package/cl.simid.js +13 -13
  53. package/cl.smooth.js +59 -59
  54. package/cl.thumbnails.js +19 -19
  55. package/cl.tizen.js +57 -57
  56. package/cl.ttml.js +22 -22
  57. package/cl.verimatrix.js +4 -4
  58. package/cl.vimond.js +8 -8
  59. package/cl.vr.js +15 -15
  60. package/cl.vtt.js +12 -12
  61. package/cl.youbora.js +15 -15
  62. package/package.json +2 -2
  63. package/typings.d.ts +37 -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 BQ="Unsupported unit",CQ="clpp-text-plain",DQ="clpp-text-ttml",EQ="clpp.htmlcue.HtmlTextDisplayer",FQ="initial",GQ=function(a){return _.Bh(a,{Ze:(b,c)=>b.wc(c)})},HQ=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)},IQ=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},JQ=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},LQ=function(a){let b=null;for(;b=a.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)a=a.replace(b[0],c=>KQ[c]);return a},NQ=function(a,b){MQ(a,b);Array.from(b.getElementsByTagName("*")).forEach(c=>{MQ(a,c)})},MQ=function(a,b){for(const c in a)null!=a[c]&&(b.style[c]=a[c])},OQ=function(a,b){return 0===a?"0":a+b},PQ=function(a,b){return 1>Math.abs(a-b)||a<b},QQ=function(a,b){return a<b&&1<Math.abs(a-b)},RQ=function(a,b){return a>b&&1<Math.abs(a-b)},SQ=
3
- function(a,b){return 1>Math.abs(a-b)||a>b},UQ=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 TQ(b.left+d,b.right+e,g,(b.bottom||g+f)+c,f,(b.width||a.offsetWidth)-
4
- d-e)},VQ=function(a){return new TQ(a.left,a.f,a.top,a.a,a.height,a.width)},WQ=function(a,b){return b.some(c=>QQ(a.left,c.f)&&RQ(a.f,c.left)&&QQ(a.top,c.a)&&RQ(a.a,c.top))},XQ=function(a,b){return SQ(a.top,b.top)&&PQ(a.a,b.a)&&SQ(a.left,b.left)&&PQ(a.f,b.f)},YQ=function(a,b,c){switch(c){case "+x":return QQ(a.left,b.left);case "-x":return RQ(a.f,b.f);case "+y":return QQ(a.top,b.top);case "-y":return RQ(a.a,b.a);default:throw Error("Unknown axis");}},ZQ=function(a){return a.f.writingMode===_.os},$Q=
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 ZQ(a)?b:c},aR=function(a){switch(a.f.writingMode){case _.os:return"horizontal-tb";case _.eg:return _.eg;case _.fg:return _.fg;default:throw Error("Unknown writing mode");}},bR=function(a){switch(a.f.positionAlign){case _.he:return _.ee;case "auto":case _.$c:return _.ns;case _.ie:return _.vf}return a.f.textAlign},cR=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 _.$c:return a.f.position-a.f.size/2;case _.ie:return a.f.position-a.f.size}return 0},dR=function(a){if(!a.f.positionAlign)switch(a.f.textAlign){case _.ee:case _.ee:return _.he;case _.ns:return _.$c;case _.vf:case _.vf:return _.ie}return a.f.positionAlign},gR=function(a,b,c){return(eR(a)||fR(a))&&_.Ug(c)?OQ(c,_.of):eR(a)&&_.A(c)?OQ(0,_.of):ZQ(a)&&_.Ug(b)?OQ(b,"%"):FQ},hR=function(a,b,c){return ZQ(a)&&_.Ug(c)?OQ(c,_.of):(eR(a)||fR(a))&&_.Ug(b)?
7
- OQ(b,"%"):FQ},fR=function(a){return a.f.writingMode===_.fg},eR=function(a){return a.f.writingMode===_.eg},iR=function(a,b){if(a.j)switch(b.writingMode){case _.os:return["-y"];case _.eg:return["+x"];case _.fg:return["-x"]}a=[];switch(b.writingMode){case _.os:a=["+y","-y"];break;case _.eg:a=["+x","-x"];break;case _.fg:a=["-x","+x"]}0>b.line&&(a=a.reverse());return a},jR=function(a){for(a.g=[];0<a.f.childNodes.length;)a.f.removeChild(a.f.childNodes[0]);a.a=UQ(a.l.a)},kR=function(a,b){jR(a.g);a.l.unshift(b);
8
- for(const c of a.l)a.g.append(c)},lR=function(a,b,c){a=a.f;const d=a.viewportAnchorUnits;if(d===_.vs)return a.viewportAnchorY/100*c-a.regionAnchorY/100*b;if(0===d)return a.viewportAnchorY-a.regionAnchorY;throw Error(BQ);},nR=function(a,b,c,d){const e=document.createElement(_.Of),f=e.dataset;f.name=b;f.for=c;d&&(f.name=`${b} (sandbox)`,f.sandbox=!0);c=document.head;c.appendChild(e);mR(a,c,b);a.h.debug(`Created HTML style element #${b}.`);return e.sheet},oR=function(a,b){a=`.${a.j} .clpp-text-container`;
9
- const c=`${a} .clpp-text-cue`;return b=b.replace(/::cue\((#[^)]+)\)/g,`${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)},pR=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);
10
- return c},qR=function(a){if(null!=a.a){for(;0<a.a.cssRules.length;)a.a.deleteRule(0);a.o=[]}},mR=function(a,b,c){const d=new MutationObserver(e=>{e.forEach(f=>{f.removedNodes.forEach(g=>{g.id===c&&a.h.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())},rR=function(a){a=_.Ng(a.htmlcue||{});_.A(a.stretchSmpteImage)&&(a.stretchSmpteImage=!1);_.A(a.enableResizeObserver)&&(a.enableResizeObserver=
11
- !0);return a},xR=function(a,b){if((b||a.l)&&a.F){var c=a.m.getPosition();if(b||a.J!==c&&a.m.getState()===_.Wn)if(a.J=c,c=sR(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,tR(a),c)){b={color:a.getFontColor()||void 0,backgroundColor:a.getBackgroundColor()||void 0,fontFamily:a.getFontFamily()||void 0,textShadow:_.es(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 _.rg:g="clpp-text-vtt";
12
- break;case _.Vf:g=DQ;break;case _.ms:g=CQ}g&&!f.classList.contains(g)&&_.so(f,g);f=UQ(c.a.a);if(0===f.width||0===f.height)c.h.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{MQ({fontSize:uR(c,d.containerRows)},c.a.a);f=null;g=d.payloadType===_.rg;var h=d.payloadType===_.Vf;d.region&&(g||h||d.backgroundImage)&&(c.B.has(d.region.id)?f=c.B.get(d.region.id):(f=new vR(d.region,
13
- {}),c.B.set(d.region.id,f),kR(c.a,f)));d=new wR(d,c.L,e);f?kR(f,d):kR(c.a,d)}}}}},yR=function(a){tR(a);a.J=null;a.o=null;a.f=[]},zR=function(a,b){return a.startTime<=b&&a.endTime>b},sR=function(a,b){var c=IQ(a.f,d=>zR(d,b)?0:b!==d.startTime?b-d.startTime:b-d.endTime);if(-1===c)return null;{let d=c;for(;0<=d-1&&zR(a.f[d-1],b);)d--;for(;c+1<a.f.length&&zR(a.f[c+1],b);)c++;return{start:d,end:c}}},tR=function(a){a.B.clear();if(a.a){const b=a.a.a;b.classList.remove("clpp-text-vtt");b.classList.remove(DQ);
14
- b.classList.remove(CQ);a=a.a;jR(a.g);a.l=[]}},uR=function(a,b){const c=UQ(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`},DR=class{parse(a){a={input:a};const b=_.uo(_.Fd),c=[];let d=b;for(var e;null!==(e=JQ(a));)if("\x3c"===e[0])if("/"===e[1])c.length&&c[c.length-1]===e.substr(2).replace("\x3e","")&&(c.pop(),d=d.parentNode);
15
- else{if(e=e.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/)){var f=e[1];var g=e[3];var h=AR[f];h?(h=_.uo(h),(f=BR[f])&&g&&h.setAttribute(f,g.trim()),g=h):g=null;!g||CR[g.localName]&&CR[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(LQ(e)));return b}},AR={c:"c",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"v",lang:"lang"},BR={v:"voice",lang:"lang"},CR={rt:"ruby"},KQ={"\x26amp;":"\x26",
16
- "\x26lt;":"\x3c","\x26gt;":"\x3e","\x26lrm;":"\u200e","\x26rlm;":"\u200f","\x26nbsp;":"\u00a0"};var TQ=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 ER=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 wR=class extends ER{constructor(a,b,c){super(a.id,"clpp-text-cue",{});this.l=b;this.f=a;this.g=!!this.f.backgroundImage;this.C=c}A(){return!this.g&&!(this.f.region&&this.f.region.displayAlign)}init(a){super.init(a);if(this.g)_.so(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===_.Vf){var c=_.uo(_.Fd);c.innerHTML=b.payload;b=c}else b.payloadType===
17
- _.rg?b=(new DR).parse(b.payload):(c=_.uo(_.Fd),c.textContent=b.payload,b=c);_.so(b,this.w);this.id&&(b.id=this.id);for(d of this.f.cssClassList)_.so(b,d);MQ({writingMode:aR(this)},b);var d=b;this.a.appendChild(d);_.so(this.a,"clpp-text-wrapper");for(var e of this.f.cssClassList)_.so(this.a,`clpp-text-wrapper__${e}`);_.A(this.f.line)&&(this.f.lineInterpretation=_.ps,this.f.line=ZQ(this)?-1:0);e=aR(this);MQ({writingMode:e,webkitWritingMode:e,direction:FQ,textAlign:bR(this)},this.a);if(!this.f.region||
18
- !this.f.region.displayAlign){e=cR(this,dR(this));MQ({position:"absolute",left:gR(this,e,null),right:fR(this)&&_.A(null)?OQ(0,_.of):FQ,top:hR(this,e,null),width:ZQ(this)?OQ(this.f.size,"%"):FQ,height:eR(this)||fR(this)?OQ(this.f.size,"%"):FQ},this.a);b=this.f;a=ZQ(this)?a.height:a.width;c=$Q(this);if(b.lineInterpretation===_.ps){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 _.$c:g-=f/2;break;case _.Td:g-=f}f=Math.round(g/
19
- 100*a)}fR(this)&&(f=a-f-c);a=f;MQ({left:gR(this,e,a),right:fR(this)&&_.A(a)?OQ(0,_.of):FQ,top:hR(this,e,a)},this.a)}NQ(this.C,d)}}o(){return _.uo(_.Fd)}};var FR=class{constructor(a,b){this.l=a;this.f=a.a;this.j=void 0===b?!1:b;this.a=UQ(a.a);this.g=[]}append(a){const b=a.a;b.style.visibility=_.Zd;this.f.appendChild(b);a.j||a.init(this.a);if(a.A()){a:{var c=UQ(a.a);var d=iR(this,a.f),e=$Q(a);const g=VQ(c);let h=null,k=0;for(const l of d){for(;YQ(c,this.a,l)||XQ(c,this.a)&&WQ(c,this.g);){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||XQ(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=VQ(c),k=d);c=VQ(g)}c=h||g}MQ({top:OQ(c.top-this.a.top,_.of),bottom:OQ(this.a.a-c.a,_.of),left:OQ(c.left-this.a.left,_.of),right:OQ(this.a.f-c.f,_.of),height:OQ(c.height,_.of),width:OQ(c.width,_.of)},a.a)}b.style.visibility="visible";this.g.push(UQ(a.a))}};var GR=class extends ER{constructor(a,b,c){super(a,b,c);this.g=null;this.l=[]}init(){this.g=new FR(this);this.j=!0}o(){const a=_.uo(_.Fd);_.so(a,this.w);this.id&&(a.id=this.id);return a}};var vR=class extends GR{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 _.vs:b=b.width/100*a.width;break a;default:throw Error(BQ);}}var c=this.f;var d=c.viewportAnchorUnits;if(d===_.vs)c=c.viewportAnchorX/100*a.width-c.regionAnchorX/100*b;else if(0===d)c=c.viewportAnchorX-c.regionAnchorX;else throw Error(BQ);d=a.height;const e=lR(this,d,a.height);MQ(this.B,this.a);MQ({left:OQ(c,_.of),top:OQ(e,_.of),width:OQ(b,
21
- _.of),height:OQ(d,_.of)},this.a);this.f.writingMode&&MQ({display:"flex","flex-direction":this.f.writingMode},this.a);this.f.displayAlign&&MQ({"justify-content":this.f.displayAlign},this.a);for(var f of this.f.cssClassList)_.so(this.a,f);a:switch(f=this.f,f.heightUnits){case 0:f=f.height;break a;case _.vs:f=f.height/100*a.height;break a;case 2:f=f.height;c=new wR(new _.ss(0,1,"Lorem ipsum",_.ms),{},{});b=c.a;this.a.appendChild(b);c.init(UQ(this.a));c=b.getBoundingClientRect().height;this.a.removeChild(b);
22
- b=c;f*=b;break a;default:throw Error(BQ);}a=lR(this,f,a.height);MQ({top:OQ(a,_.of),height:OQ(f,_.of)},this.a);this.g=new FR(this,!0);this.j=!0}getId(){return this.f.id}};var HR=class{constructor(a,b){this.h=new _.R("clpp.htmlcue.StyleManager");this.l=[];this.j=a;this.g=b;this.o=[];this.a=nR(this,this.g,this.j);this.f=nR(this,this.g,this.j,!0);this.f.disabled=!0;this.h.debug(`Stylesheet ${this.g} has been created.`)}appendRule(a){if(null!=this.a&&!this.o.some(b=>b===a)){const b=oR(this,a);if(pR(this,b)){try{this.a.insertRule(b,this.a.cssRules.length),this.h.debug(`Added CSS rule ${b}`)}catch(c){this.h.error(`An error occurred when adding a CSS rule: ${b}`)}this.o.push(a)}else this.h.warn(`Stylesheet ${this.g} 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=[],qR(a),document.head.removeChild(a.a.ownerNode),document.head.removeChild(a.f.ownerNode),a.a=null,a.f=null,a.h.debug(`Stylesheet ${a.g} has been destroyed.`))})}};var IR=class extends _.ou{constructor(a){super(a);this.h=new _.R(EQ);this.m=a;this.L=rR(a.getConfiguration());this.l=!1;this.f=[];this.F=a.getSurface().getContainer();this.j=new HR(a.getSurface().getUniqueCssClass(),"CLPP Subtitle Styles");this.a=new GR(null,"clpp-text-container",{});this.A=new _.fu(a.getSurface(),this.T.bind(this));this.J=null;this.F?(this.F.appendChild(this.a.a),this.a.init(null)):this.h.warn("No container element! Subtitles will not appear. Please check your player surface configuration or switch to NativeTextDisplayer.");
24
- this.G=new _.Qj(()=>{xR(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=HQ(this.f,GQ(a));this.o=null;xR(this,!1)}}g(){null==this.j||xR(this,!0)}destroy(){const a=this;return _.x(function*(){null!=a.j&&(yR(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;xR(this,!0);return!0}isTextVisible(){return this.l}setTextVisibility(a){null!=this.j&&this.l!==a&&((this.l=a)?(this.G.hb(.25),this.L.enableResizeObserver&&this.A.start(),xR(this,!0)):(this.G.stop(),this.A.stop(),yR(this)))}Oc(){return this.f}T(){xR(this,!0)}};_.z(EQ,IR);IR.prototype.setTextVisibility=IR.prototype.setTextVisibility;IR.prototype.isTextVisible=IR.prototype.isTextVisible;IR.prototype.remove=IR.prototype.remove;
26
- IR.prototype.destroy=IR.prototype.destroy;IR.prototype.append=IR.prototype.append;var JR=class{isSupported(a){return!!a.enableHtmlCue&&!_.gk()}create(a){return new IR(a)}};_.z("clpp.htmlcue.HtmlCueComponent",class extends _.Pt{f(){_.An(_.$d,new JR)}a(){_.yn.has(_.$d)&&(_.yn.delete(_.$d),_.zn.info("Removed factory: 'html'"))}id(){return _.Pf}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var KQ="Unsupported unit",LQ="clpp-text-plain",MQ="clpp-text-ttml",NQ="clpp.htmlcue.HtmlTextDisplayer",OQ="initial",PQ=function(a){return _.Eh(a,{af:(b,c)=>b.zc(c)})},QQ=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)},RQ=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},SQ=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},UQ=function(a){let b=null;for(;b=a.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)a=a.replace(b[0],c=>TQ[c]);return a},WQ=function(a,b){VQ(a,b);Array.from(b.getElementsByTagName("*")).forEach(c=>{VQ(a,c)})},VQ=function(a,b){for(const c in a)null!=a[c]&&(b.style[c]=a[c])},XQ=function(a,b){return 0===a?"0":a+b},YQ=function(a,b){return 1>Math.abs(a-b)||a<b},ZQ=function(a,b){return a<b&&1<Math.abs(a-b)},$Q=function(a,b){return a>b&&1<Math.abs(a-b)},aR=
3
+ function(a,b){return 1>Math.abs(a-b)||a>b},cR=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 bR(b.left+d,b.right+e,g,(b.bottom||g+f)+c,f,(b.width||a.offsetWidth)-
4
+ d-e)},dR=function(a){return new bR(a.left,a.f,a.top,a.a,a.height,a.width)},eR=function(a,b){return b.some(c=>ZQ(a.left,c.f)&&$Q(a.f,c.left)&&ZQ(a.top,c.a)&&$Q(a.a,c.top))},fR=function(a,b){return aR(a.top,b.top)&&YQ(a.a,b.a)&&aR(a.left,b.left)&&YQ(a.f,b.f)},gR=function(a,b,c){switch(c){case "+x":return ZQ(a.left,b.left);case "-x":return $Q(a.f,b.f);case "+y":return ZQ(a.top,b.top);case "-y":return $Q(a.a,b.a);default:throw Error("Unknown axis");}},hR=function(a){return a.f.writingMode===_.xs},iR=
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 hR(a)?b:c},jR=function(a){switch(a.f.writingMode){case _.xs:return"horizontal-tb";case _.ig:return _.ig;case _.jg:return _.jg;default:throw Error("Unknown writing mode");}},kR=function(a){switch(a.f.positionAlign){case _.ke:return _.he;case "auto":case _.ad:return _.ws;case _.me:return _.zf}return a.f.textAlign},lR=function(a,b){if(typeof a.f.position===_.t&&typeof a.f.size===
6
+ _.t)switch(b){case _.ke:return a.f.position;case "auto":case _.ad:return a.f.position-a.f.size/2;case _.me:return a.f.position-a.f.size}return 0},mR=function(a){if(!a.f.positionAlign)switch(a.f.textAlign){case _.he:case _.he:return _.ke;case _.ws:return _.ad;case _.zf:case _.zf:return _.me}return a.f.positionAlign},pR=function(a,b,c){return(nR(a)||oR(a))&&_.Xg(c)?XQ(c,_.sf):nR(a)&&_.A(c)?XQ(0,_.sf):hR(a)&&_.Xg(b)?XQ(b,"%"):OQ},qR=function(a,b,c){return hR(a)&&_.Xg(c)?XQ(c,_.sf):(nR(a)||oR(a))&&_.Xg(b)?
7
+ XQ(b,"%"):OQ},oR=function(a){return a.f.writingMode===_.jg},nR=function(a){return a.f.writingMode===_.ig},rR=function(a,b){if(a.j)switch(b.writingMode){case _.xs:return["-y"];case _.ig:return["+x"];case _.jg:return["-x"]}a=[];switch(b.writingMode){case _.xs:a=["+y","-y"];break;case _.ig:a=["+x","-x"];break;case _.jg:a=["-x","+x"]}0>b.line&&(a=a.reverse());return a},sR=function(a){for(a.h=[];0<a.f.childNodes.length;)a.f.removeChild(a.f.childNodes[0]);a.a=cR(a.l.a)},tR=function(a,b){sR(a.h);a.l.unshift(b);
8
+ for(const c of a.l)a.h.append(c)},uR=function(a,b,c){a=a.f;const d=a.viewportAnchorUnits;if(d===_.Es)return a.viewportAnchorY/100*c-a.regionAnchorY/100*b;if(0===d)return a.viewportAnchorY-a.regionAnchorY;throw Error(KQ);},wR=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);vR(a,c,b);a.g.debug(`Created HTML style element #${b}.`);return e.sheet},xR=function(a,b){a=`.${a.j} .clpp-text-container`;
9
+ const c=`${a} .clpp-text-cue`;return b=b.replace(/::cue\((#[^)]+)\)/g,`${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)},yR=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);
10
+ return c},zR=function(a){if(null!=a.a){for(;0<a.a.cssRules.length;)a.a.deleteRule(0);a.o=[]}},vR=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())},AR=function(a){a=_.Qg(a.htmlcue||{});_.A(a.stretchSmpteImage)&&(a.stretchSmpteImage=!1);_.A(a.enableResizeObserver)&&(a.enableResizeObserver=
11
+ !0);return a},GR=function(a,b){if((b||a.l)&&a.F){var c=a.m.getPosition();if(b||a.J!==c&&a.m.getState()===_.Zn)if(a.J=c,c=BR(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,CR(a),c)){b={color:a.getFontColor()||void 0,backgroundColor:a.getBackgroundColor()||void 0,fontFamily:a.getFontFamily()||void 0,textShadow:_.ns(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 _.ug:g="clpp-text-vtt";
12
+ break;case _.Zf:g=MQ;break;case _.vs:g=LQ}g&&!f.classList.contains(g)&&_.vo(f,g);f=cR(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{VQ({fontSize:DR(c,d.containerRows)},c.a.a);f=null;g=d.payloadType===_.ug;var h=d.payloadType===_.Zf;d.region&&(g||h||d.backgroundImage)&&(c.B.has(d.region.id)?f=c.B.get(d.region.id):(f=new ER(d.region,
13
+ {}),c.B.set(d.region.id,f),tR(c.a,f)));d=new FR(d,c.L,e);f?tR(f,d):tR(c.a,d)}}}}},HR=function(a){CR(a);a.J=null;a.o=null;a.f=[]},IR=function(a,b){return a.startTime<=b&&a.endTime>b},BR=function(a,b){var c=RQ(a.f,d=>IR(d,b)?0:b!==d.startTime?b-d.startTime:b-d.endTime);if(-1===c)return null;{let d=c;for(;0<=d-1&&IR(a.f[d-1],b);)d--;for(;c+1<a.f.length&&IR(a.f[c+1],b);)c++;return{start:d,end:c}}},CR=function(a){a.B.clear();if(a.a){const b=a.a.a;b.classList.remove("clpp-text-vtt");b.classList.remove(MQ);
14
+ b.classList.remove(LQ);a=a.a;sR(a.h);a.l=[]}},DR=function(a,b){const c=cR(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`},MR=class{parse(a){a={input:a};const b=_.xo(_.Gd),c=[];let d=b;for(var e;null!==(e=SQ(a));)if("\x3c"===e[0])if("/"===e[1])c.length&&c[c.length-1]===e.substr(2).replace("\x3e","")&&(c.pop(),d=d.parentNode);
15
+ else{if(e=e.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/)){var f=e[1];var g=e[3];var h=JR[f];h?(h=_.xo(h),(f=KR[f])&&g&&h.setAttribute(f,g.trim()),g=h):g=null;!g||LR[g.localName]&&LR[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(UQ(e)));return b}},JR={c:"c",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"v",lang:"lang"},KR={v:"voice",lang:"lang"},LR={rt:"ruby"},TQ={"\x26amp;":"\x26",
16
+ "\x26lt;":"\x3c","\x26gt;":"\x3e","\x26lrm;":"\u200e","\x26rlm;":"\u200f","\x26nbsp;":"\u00a0"};var bR=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 NR=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 FR=class extends NR{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)_.vo(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===_.Zf){var c=_.xo(_.Gd);c.innerHTML=b.payload;b=c}else b.payloadType===
17
+ _.ug?b=(new MR).parse(b.payload):(c=_.xo(_.Gd),c.textContent=b.payload,b=c);_.vo(b,this.w);this.id&&(b.id=this.id);for(d of this.f.cssClassList)_.vo(b,d);VQ({writingMode:jR(this)},b);var d=b;this.a.appendChild(d);_.vo(this.a,"clpp-text-wrapper");for(var e of this.f.cssClassList)_.vo(this.a,`clpp-text-wrapper__${e}`);_.A(this.f.line)&&(this.f.lineInterpretation=_.ys,this.f.line=hR(this)?-1:0);e=jR(this);VQ({writingMode:e,webkitWritingMode:e,direction:OQ,textAlign:kR(this)},this.a);if(!this.f.region||
18
+ !this.f.region.displayAlign){e=lR(this,mR(this));VQ({position:"absolute",left:pR(this,e,null),right:oR(this)&&_.A(null)?XQ(0,_.sf):OQ,top:qR(this,e,null),width:hR(this)?XQ(this.f.size,"%"):OQ,height:nR(this)||oR(this)?XQ(this.f.size,"%"):OQ},this.a);b=this.f;a=hR(this)?a.height:a.width;c=iR(this);if(b.lineInterpretation===_.ys){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 _.ad:g-=f/2;break;case _.Ud:g-=f}f=Math.round(g/
19
+ 100*a)}oR(this)&&(f=a-f-c);a=f;VQ({left:pR(this,e,a),right:oR(this)&&_.A(a)?XQ(0,_.sf):OQ,top:qR(this,e,a)},this.a)}WQ(this.C,d)}}o(){return _.xo(_.Gd)}};var OR=class{constructor(a,b){this.l=a;this.f=a.a;this.j=void 0===b?!1:b;this.a=cR(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=cR(a.a);var d=rR(this,a.f),e=iR(a);const g=dR(c);let h=null,k=0;for(const l of d){for(;gR(c,this.a,l)||fR(c,this.a)&&eR(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||fR(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=dR(c),k=d);c=dR(g)}c=h||g}VQ({top:XQ(c.top-this.a.top,_.sf),bottom:XQ(this.a.a-c.a,_.sf),left:XQ(c.left-this.a.left,_.sf),right:XQ(this.a.f-c.f,_.sf),height:XQ(c.height,_.sf),width:XQ(c.width,_.sf)},a.a)}b.style.visibility="visible";this.h.push(cR(a.a))}};var PR=class extends NR{constructor(a,b,c){super(a,b,c);this.h=null;this.l=[]}init(){this.h=new OR(this);this.j=!0}o(){const a=_.xo(_.Gd);_.vo(a,this.w);this.id&&(a.id=this.id);return a}};var ER=class extends PR{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 _.Es:b=b.width/100*a.width;break a;default:throw Error(KQ);}}var c=this.f;var d=c.viewportAnchorUnits;if(d===_.Es)c=c.viewportAnchorX/100*a.width-c.regionAnchorX/100*b;else if(0===d)c=c.viewportAnchorX-c.regionAnchorX;else throw Error(KQ);d=a.height;const e=uR(this,d,a.height);VQ(this.B,this.a);VQ({left:XQ(c,_.sf),top:XQ(e,_.sf),width:XQ(b,
21
+ _.sf),height:XQ(d,_.sf)},this.a);this.f.writingMode&&VQ({display:"flex","flex-direction":this.f.writingMode},this.a);this.f.displayAlign&&VQ({"justify-content":this.f.displayAlign},this.a);for(var f of this.f.cssClassList)_.vo(this.a,f);a:switch(f=this.f,f.heightUnits){case 0:f=f.height;break a;case _.Es:f=f.height/100*a.height;break a;case 2:f=f.height;c=new FR(new _.Bs(0,1,"Lorem ipsum",_.vs),{},{});b=c.a;this.a.appendChild(b);c.init(cR(this.a));c=b.getBoundingClientRect().height;this.a.removeChild(b);
22
+ b=c;f*=b;break a;default:throw Error(KQ);}a=uR(this,f,a.height);VQ({top:XQ(a,_.sf),height:XQ(f,_.sf)},this.a);this.h=new OR(this,!0);this.j=!0}getId(){return this.f.id}};var QR=class{constructor(a,b){this.g=new _.R("clpp.htmlcue.StyleManager");this.l=[];this.j=a;this.h=b;this.o=[];this.a=wR(this,this.h,this.j);this.f=wR(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=xR(this,a);if(yR(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=[],zR(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 RR=class extends _.xu{constructor(a){super(a);this.g=new _.R(NQ);this.m=a;this.L=AR(a.getConfiguration());this.l=!1;this.f=[];this.F=a.getSurface().getContainer();this.j=new QR(a.getSurface().getUniqueCssClass(),"CLPP Subtitle Styles");this.a=new PR(null,"clpp-text-container",{});this.A=new _.ou(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 _.Tj(()=>{GR(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=QQ(this.f,PQ(a));this.o=null;GR(this,!1)}}h(){null==this.j||GR(this,!0)}destroy(){const a=this;return _.x(function*(){null!=a.j&&(HR(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;GR(this,!0);return!0}isTextVisible(){return this.l}setTextVisibility(a){null!=this.j&&this.l!==a&&((this.l=a)?(this.G.kb(.25),this.L.enableResizeObserver&&this.A.start(),GR(this,!0)):(this.G.stop(),this.A.stop(),HR(this)))}Rc(){return this.f}T(){GR(this,!0)}};_.z(NQ,RR);RR.prototype.setTextVisibility=RR.prototype.setTextVisibility;RR.prototype.isTextVisible=RR.prototype.isTextVisible;RR.prototype.remove=RR.prototype.remove;
26
+ RR.prototype.destroy=RR.prototype.destroy;RR.prototype.append=RR.prototype.append;var SR=class{isSupported(a){return!!a.enableHtmlCue&&!_.jk()}create(a){return new RR(a)}};_.z("clpp.htmlcue.HtmlCueComponent",class extends _.Yt{f(){_.Dn(_.be,new SR)}a(){_.Bn.has(_.be)&&(_.Bn.delete(_.be),_.Cn.info("Removed factory: 'html'"))}id(){return _.Tf}});};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 kQ="clpp.ima.AdsManagerFactory",lQ=function(a){a=a.I;const b=new google.ima.AdsRenderingSettings;b.restoreCustomPlaybackStateOnAdBreakComplete=!1;typeof a.bitrate===_.t&&(b.bitrate=a.bitrate);b.enablePreloading=typeof a.enablePreloading===_.Nc?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
- _.Nc&&(b.useStyledLinearAds=a.useStyledLinearAds);b.uiElements=Array.isArray(a.uiElements)?a.uiElements:[];return b},mQ=function(a){return!1===a.I.disableCustomPlayback&&a.a.isCustomPlaybackUsed()&&_.Uj()},nQ=function(a){const b=a.a,c=a.w,d=google.ima.AdEvent.Type;c.on(b,d.AD_BREAK_READY,a.da.bind(a));c.on(b,d.LOADED,a.W.bind(a));c.on(b,d.CONTENT_PAUSE_REQUESTED,a.Zb.bind(a));c.on(b,d.STARTED,a.Y.bind(a));c.on(b,d.LOG,a.Ja.bind(a));c.on(b,d.AD_PROGRESS,a.Sa.bind(a));c.on(b,d.AD_BUFFERING,a.ja.bind(a));
3
- c.on(b,d.FIRST_QUARTILE,a.S.bind(a));c.on(b,d.MIDPOINT,a.Ka.bind(a));c.on(b,d.THIRD_QUARTILE,a.aa.bind(a));c.on(b,d.PAUSED,a.La.bind(a));c.on(b,d.RESUMED,a.ib.bind(a));c.on(b,d.CLICK,a.R.bind(a));c.on(b,d.SKIPPED,a.X.bind(a));c.on(b,d.IMPRESSION,a.T.bind(a));c.on(b,d.COMPLETE,a.Ia.bind(a));c.on(b,d.CONTENT_RESUME_REQUESTED,a.ac.bind(a));c.on(b,d.ALL_ADS_COMPLETED,a.Wb.bind(a))},oQ=function(a,b){const c=b?a.ea.create(b.getErrorCode()):null;a.m.onError(new _.H(1,9,10003,{errorType:c},b))},pQ=function(a,
4
- b,c){c=c&&c.getAd();let d=null;c&&(d={ad:new X(c,a.F,a.C)});a.m.trigger(new _.E(b,d))},qQ=function(a){a.B=null;pQ(a,_.qc);a.o&&a.m.getSurface().hide(a.o)},rQ=function(a){_.to(a.A,{visibility:"visible"})},tQ=function(a){return _.x(function*(){a.N.initialize();const b=!!a.m.getConfiguration().muted;(yield a.K.canPlay(b))||mQ(a)?sQ(a):(pQ(a,_.Lc),a.h.warn(_.ka))})},uQ=function(a,b){return _.x(function*(){a.N.initialize();yield b.play();sQ(a)})},sQ=function(a){a.a.init(a.A.offsetWidth,a.A.offsetHeight,
5
- google.ima.ViewMode.NORMAL);a.a.start();a.H=!0},vQ=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.g=c}vb(){return"Google IMA SDK"}wb(){return google.ima.VERSION}Cb(){return 0}getId(){return this.a.getAdId()}getCreativeId(){return this.a.getCreativeId()}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()}getSkipTimeOffset(){return this.a.getSkipTimeOffset()}gc(){return this.f?
6
- this.f.getIsBumper():!1}Mb(){let a=null;const b=this.a,c=Object.keys(b).find(d=>typeof b[d]===_.Ce&&typeof b[d].clickThroughUrl===_.Mf);c&&(a=b[c].clickThroughUrl);return a}getMediaUrl(){return this.a.getMediaUrl()}zb(){return this.a.getVastMediaWidth()}yb(){return this.a.getVastMediaHeight()}nb(){return this.a.getVastMediaBitrate()}ab(){return this.g?2:this.j?1:0}getPodIndex(){return this.f?this.f.getPodIndex():0}Nb(){return this.f?this.f.getTimeOffset():0}Ob(){return this.f?this.f.getAdPosition():
7
- 1}Bb(){return this.f?this.f.getTotalAds():1}getWrapperAdIds(){return this.a.getWrapperAdIds()}getWrapperAdSystems(){return this.a.getWrapperAdSystems()}getWrapperCreativeIds(){return this.a.getWrapperCreativeIds()}};X.prototype.getWrapperCreativeIds=X.prototype.getWrapperCreativeIds;X.prototype.getWrapperAdSystems=X.prototype.getWrapperAdSystems;X.prototype.getWrapperAdIds=X.prototype.getWrapperAdIds;X.prototype.getSequenceLength=X.prototype.Bb;X.prototype.getPositionInSequence=X.prototype.Ob;
8
- X.prototype.getPodTimeOffset=X.prototype.Nb;X.prototype.getPodIndex=X.prototype.getPodIndex;X.prototype.getPodType=X.prototype.ab;X.prototype.getMediaBitrate=X.prototype.nb;X.prototype.getMediaHeight=X.prototype.yb;X.prototype.getMediaWidth=X.prototype.zb;X.prototype.getMediaUrl=X.prototype.getMediaUrl;X.prototype.getClickThroughUrl=X.prototype.Mb;X.prototype.isBumper=X.prototype.gc;X.prototype.getSkipTimeOffset=X.prototype.getSkipTimeOffset;X.prototype.getDuration=X.prototype.getDuration;
9
- 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.getCreativeId=X.prototype.getCreativeId;X.prototype.getId=X.prototype.getId;X.prototype.getTechnology=X.prototype.Cb;X.prototype.getAdManagerVersion=X.prototype.wb;X.prototype.getAdManagerName=X.prototype.vb;var wQ=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 xQ=class{constructor(a){this.a=a}getCuePoints(){return this.a}Pb(){return 0<=this.a.indexOf(0)||0===this.a.length}pb(){return 0<=this.a.indexOf(-1)}};xQ.prototype.hasPostroll=xQ.prototype.pb;xQ.prototype.hasPreroll=xQ.prototype.Pb;xQ.prototype.getCuePoints=xQ.prototype.getCuePoints;var yQ=class{constructor(a){this.m=a;this.A=a.getSurface().getMedia();a=this.m.getConfiguration();a=_.Ng(a.ima||{});this.I=a=_.Mg({disableCustomPlayback:!1},a);this.o=this.m.cc("ima").xc();this.N=this.m.cc("ima").g;this.l=this.m.cc("ima").a;this.K=new _.hu;this.h=new _.R("clpp.ima");this.g=this.a=null;this.f=new _.an;this.H=!1;this.w=new _.ks;this.ea=new wQ;this.B=null;this.L=this.G=this.C=this.F=!1;this.J=this.j=null;{a=this.w;const b=google.ima.AdErrorEvent.Type.AD_ERROR;a.one(this.l,google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,
10
- this.Kb.bind(this));a.on(this.l,b,this.jb.bind(this));a.on(this.m,_.Ud,this.Yb.bind(this))}}Kb(a){this.a=a.getAdsManager(this.A,lQ(this));this.a.isCustomPlaybackUsed()&&!mQ(this)?(this.h.warn("IMA plugin is disabled for this platform with single video element. Disposing."),this.m.onError(new _.H(1,9,10002)),this.dispose()):(this.g=new _.fu(this.m.getSurface(),(b,c,d)=>{this.a.resize(b,c,d?google.ima.ViewMode.FULLSCREEN:google.ima.ViewMode.NORMAL)}),a=this.a.getCuePoints(),this.j=new xQ(a),this.m.trigger(new _.E(_.tc,
11
- {adsTimeline:this.j})),nQ(this));this.f.resolve()}jb(a){oQ(this,a.getError());this.f.resolve()}Zb(a){const b=this;return _.x(function*(){b.G=!0;if(mQ(b)){b.J=b.m.getPosition();yield b.m.detach();var c=b.m;c.a&&c.a.stopForwardingEventsTo(c)}else yield b.m.pause(),_.to(b.A,{visibility:_.Zd});pQ(b,_.bc,a);b.g.start()})}da(){const a=this;return _.x(function*(){a.a.start()})}W(a){a.getAd().isLinear()?pQ(this,_.ic,a):(this.a.discardAdBreak(),this.F||(this.F=!0,this.m.play()))}Y(a){this.B=a.getAd().getDuration();
12
- pQ(this,_.pc,a);this.m.getSurface().show(this.o)}Ja(a){a=a.getAdData();oQ(this,a?a.adError:null);qQ(this)}Sa(a){pQ(this,_.mc,a)}ja(a){pQ(this,_.dc,a)}S(a){pQ(this,_.gc,a)}Ka(a){pQ(this,_.jc,a)}aa(a){pQ(this,_.rc,a)}La(a){pQ(this,_.lc,a)}ib(a){pQ(this,_.nc,a)}R(a){this.pause();pQ(this,_.ec,a)}X(a){pQ(this,_.oc,a);qQ(this)}T(a){pQ(this,_.hc,a)}Ia(a){pQ(this,_.fc,a);qQ(this)}ac(){const a=this;return _.x(function*(){a.F=!0;if(mQ(a)&&null!==a.J){var b=a.m;b.a&&b.a.forwardEventsTo(b);yield _.qp(a.m);a.C||
13
- (yield a.m.seek(a.J))}else{if(!a.G)return a.m.play();rQ(a)}a.G=!1;a.g&&a.g.stop();a.C||(yield a.m.play());pQ(a,_.cc)})}Wb(){this.L=!0}Yb(){this.C=!0;this.l.contentComplete()}load(){const a=this;return _.x(function*(){var b=a.m;const c=a.I;try{if(typeof c.adTagUrl!==_.Mf)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.K.canPlay(!1);const d=yield a.K.canPlay(!0),e=new google.ima.AdsRequest;e.adTagUrl=
14
- c.adTagUrl;e.setAdWillAutoPlay(b);e.setAdWillPlayMuted(d);a.l.getSettings().setAutoPlayAdBreaks(!1);a.l.requestAds(e);return a.f})}start(a){const b=this;return _.x(function*(){b.a&&b.j&&!b.H?b.j.Pb()?yield tQ(b):yield uQ(b,a):yield a.play()})}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||null===this.B)return-1;const a=this.a.getRemainingTime();
15
- return 0>a?0:this.B-a}dispose(){return(new Promise(a=>{this.H&&this.j&&this.j.pb()&&!this.L?(this.w.one(this.a,google.ima.AdEvent.Type.ALL_ADS_COMPLETED,()=>{a();this.o&&this.m.getSurface().hide(this.o)}),_.nh(this.w,this.a,[google.ima.AdEvent.Type.LOADED,google.ima.AdEvent.Type.STARTED],()=>{this.a&&this.a.discardAdBreak()})):a();this.a.discardAdBreak();this.l.contentComplete()})).then(()=>{rQ(this);this.w.release();this.g&&(this.g.stop(),this.g=null);this.a&&(this.a.destroy(),this.a=null)})}};
16
- yQ.prototype.getPosition=yQ.prototype.getPosition;yQ.prototype.setVolume=yQ.prototype.setVolume;yQ.prototype.getVolume=yQ.prototype.getVolume;yQ.prototype.skip=yQ.prototype.skip;yQ.prototype.pause=yQ.prototype.pause;yQ.prototype.resume=yQ.prototype.resume;var zQ=class extends _.ru{constructor(){super();this.a=this.g=this.f=null}onPlayerCreated(a){if(vQ())return a.onError(new _.H(1,9,1E4));this.f=_.ro(_.Fd,{"class":"clpp-ima clpp-hidden"});a.getSurface().addElementToContainer(this.f);this.g=new google.ima.AdDisplayContainer(this.f,a.getSurface().getMedia());this.a=new google.ima.AdsLoader(this.g);this.a.getSettings().setPlayerType(_.ra);this.a.getSettings().setPlayerVersion(_.fa);this.a.getSettings().setAutoPlayAdBreaks(!0)}onPlayerWillDestroy(a){this.a&&
17
- (this.a.destroy(),this.a=null);this.g&&(this.g.destroy(),this.g=null);this.f&&(a.getSurface().removeElementFromContainer(this.f),this.f=null)}xg(){return this.a}vg(){return this.g}xc(){return this.f}id(){return"ima"}};_.z("clpp.ima.ImaPlugin",zQ);zQ.prototype.getAdContainer=zQ.prototype.xc;zQ.prototype.getAdDisplayContainer=zQ.prototype.vg;zQ.prototype.getAdsLoader=zQ.prototype.xg;zQ.Id="ima";zQ.isSdkMissing=vQ;_.ap(new class{create(){return new zQ}});var AQ=class{constructor(){this.a=new _.R(kQ)}name(){return kQ}isSupported(a,b){return a.namespace()===_.jd?!1:vQ()?(this.a.warn("IMA SDK is not loaded."),!1):!(!b||!b.ima)}create(a){return new yQ(a)}};AQ.prototype.create=AQ.prototype.create;AQ.prototype.isSupported=AQ.prototype.isSupported;AQ.prototype.name=AQ.prototype.name;_.oo(new AQ);};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var tQ="clpp.ima.AdsManagerFactory",uQ=function(a){a=a.I;const b=new google.ima.AdsRenderingSettings;b.restoreCustomPlaybackStateOnAdBreakComplete=!1;typeof a.bitrate===_.t&&(b.bitrate=a.bitrate);b.enablePreloading=typeof a.enablePreloading===_.Pc?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
+ _.Pc&&(b.useStyledLinearAds=a.useStyledLinearAds);b.uiElements=Array.isArray(a.uiElements)?a.uiElements:[];return b},vQ=function(a){return!1===a.I.disableCustomPlayback&&a.a.isCustomPlaybackUsed()&&_.Xj()},wQ=function(a){const b=a.a,c=a.w,d=google.ima.AdEvent.Type;c.on(b,d.AD_BREAK_READY,a.ea.bind(a));c.on(b,d.LOADED,a.W.bind(a));c.on(b,d.CONTENT_PAUSE_REQUESTED,a.cc.bind(a));c.on(b,d.STARTED,a.Z.bind(a));c.on(b,d.LOG,a.Ma.bind(a));c.on(b,d.AD_PROGRESS,a.Va.bind(a));c.on(b,d.AD_BUFFERING,a.la.bind(a));
3
+ c.on(b,d.FIRST_QUARTILE,a.S.bind(a));c.on(b,d.MIDPOINT,a.Na.bind(a));c.on(b,d.THIRD_QUARTILE,a.aa.bind(a));c.on(b,d.PAUSED,a.Oa.bind(a));c.on(b,d.RESUMED,a.lb.bind(a));c.on(b,d.CLICK,a.O.bind(a));c.on(b,d.SKIPPED,a.X.bind(a));c.on(b,d.IMPRESSION,a.T.bind(a));c.on(b,d.COMPLETE,a.Fa.bind(a));c.on(b,d.CONTENT_RESUME_REQUESTED,a.ec.bind(a));c.on(b,d.ALL_ADS_COMPLETED,a.$b.bind(a))},xQ=function(a,b){const c=b?a.ga.create(b.getErrorCode()):null;a.m.onError(new _.H(1,9,10003,{errorType:c},b))},yQ=function(a,
4
+ b,c){c=c&&c.getAd();let d=null;c&&(d={ad:new X(c,a.F,a.C)});a.m.trigger(new _.E(b,d))},zQ=function(a){a.B=null;yQ(a,_.rc);a.o&&a.m.getSurface().hide(a.o)},AQ=function(a){_.wo(a.A,{visibility:"visible"})},CQ=function(a){return _.x(function*(){a.N.initialize();const b=!!a.m.getConfiguration().muted;(yield a.K.canPlay(b))||vQ(a)?BQ(a):(yQ(a,_.Mc),a.g.warn(_.ka))})},DQ=function(a,b){return _.x(function*(){a.N.initialize();yield b.play();BQ(a)})},BQ=function(a){a.a.init(a.A.offsetWidth,a.A.offsetHeight,
5
+ google.ima.ViewMode.NORMAL);a.a.start();a.H=!0},EQ=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}yb(){return"Google IMA SDK"}zb(){return google.ima.VERSION}Fb(){return 0}getId(){return this.a.getAdId()}getCreativeId(){return this.a.getCreativeId()}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()}getSkipTimeOffset(){return this.a.getSkipTimeOffset()}kc(){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]===_.Fe&&typeof b[d].clickThroughUrl===_.Qf);c&&(a=b[c].clickThroughUrl);return a}getMediaUrl(){return this.a.getMediaUrl()}Cb(){return this.a.getVastMediaWidth()}Bb(){return this.a.getVastMediaHeight()}qb(){return this.a.getVastMediaBitrate()}eb(){return this.h?2:this.j?1:0}getPodIndex(){return this.f?this.f.getPodIndex():0}Rb(){return this.f?this.f.getTimeOffset():0}Sb(){return this.f?this.f.getAdPosition():
7
+ 1}Eb(){return this.f?this.f.getTotalAds():1}getWrapperAdIds(){return this.a.getWrapperAdIds()}getWrapperAdSystems(){return this.a.getWrapperAdSystems()}getWrapperCreativeIds(){return this.a.getWrapperCreativeIds()}};X.prototype.getWrapperCreativeIds=X.prototype.getWrapperCreativeIds;X.prototype.getWrapperAdSystems=X.prototype.getWrapperAdSystems;X.prototype.getWrapperAdIds=X.prototype.getWrapperAdIds;X.prototype.getSequenceLength=X.prototype.Eb;X.prototype.getPositionInSequence=X.prototype.Sb;
8
+ X.prototype.getPodTimeOffset=X.prototype.Rb;X.prototype.getPodIndex=X.prototype.getPodIndex;X.prototype.getPodType=X.prototype.eb;X.prototype.getMediaBitrate=X.prototype.qb;X.prototype.getMediaHeight=X.prototype.Bb;X.prototype.getMediaWidth=X.prototype.Cb;X.prototype.getMediaUrl=X.prototype.getMediaUrl;X.prototype.getClickThroughUrl=X.prototype.Qb;X.prototype.isBumper=X.prototype.kc;X.prototype.getSkipTimeOffset=X.prototype.getSkipTimeOffset;X.prototype.getDuration=X.prototype.getDuration;
9
+ 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.getCreativeId=X.prototype.getCreativeId;X.prototype.getId=X.prototype.getId;X.prototype.getTechnology=X.prototype.Fb;X.prototype.getAdManagerVersion=X.prototype.zb;X.prototype.getAdManagerName=X.prototype.yb;var FQ=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 GQ=class{constructor(a){this.a=a}getCuePoints(){return this.a}Tb(){return 0<=this.a.indexOf(0)||0===this.a.length}sb(){return 0<=this.a.indexOf(-1)}};GQ.prototype.hasPostroll=GQ.prototype.sb;GQ.prototype.hasPreroll=GQ.prototype.Tb;GQ.prototype.getCuePoints=GQ.prototype.getCuePoints;var HQ=class{constructor(a){this.m=a;this.A=a.getSurface().getMedia();a=this.m.getConfiguration();a=_.Qg(a.ima||{});this.I=a=_.Pg({disableCustomPlayback:!1},a);this.o=this.m.gc("ima").Ac();this.N=this.m.gc("ima").h;this.l=this.m.gc("ima").a;this.K=new _.qu;this.g=new _.R("clpp.ima");this.h=this.a=null;this.f=new _.dn;this.H=!1;this.w=new _.ts;this.ga=new FQ;this.B=null;this.L=this.G=this.C=this.F=!1;this.J=this.j=null;{a=this.w;const b=google.ima.AdErrorEvent.Type.AD_ERROR;a.one(this.l,google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,
10
+ this.Ob.bind(this));a.on(this.l,b,this.mb.bind(this));a.on(this.m,_.Vd,this.bc.bind(this))}}Ob(a){this.a=a.getAdsManager(this.A,uQ(this));this.a.isCustomPlaybackUsed()&&!vQ(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.dispose()):(this.h=new _.ou(this.m.getSurface(),(b,c,d)=>{this.a.resize(b,c,d?google.ima.ViewMode.FULLSCREEN:google.ima.ViewMode.NORMAL)}),a=this.a.getCuePoints(),this.j=new GQ(a),this.m.trigger(new _.E(_.uc,
11
+ {adsTimeline:this.j})),wQ(this));this.f.resolve()}mb(a){xQ(this,a.getError());this.f.resolve()}cc(a){const b=this;return _.x(function*(){b.G=!0;if(vQ(b)){b.J=b.m.getPosition();yield b.m.detach();var c=b.m;c.a&&c.a.stopForwardingEventsTo(c)}else yield b.m.pause(),_.wo(b.A,{visibility:_.$d});yQ(b,_.cc,a);b.h.start()})}ea(){const a=this;return _.x(function*(){a.a.start()})}W(a){a.getAd().isLinear()?yQ(this,_.jc,a):(this.a.discardAdBreak(),this.F||(this.F=!0,this.m.play()))}Z(a){this.B=a.getAd().getDuration();
12
+ yQ(this,_.qc,a);this.m.getSurface().show(this.o)}Ma(a){a=a.getAdData();xQ(this,a?a.adError:null);zQ(this)}Va(a){yQ(this,_.nc,a)}la(a){yQ(this,_.ec,a)}S(a){yQ(this,_.hc,a)}Na(a){yQ(this,_.lc,a)}aa(a){yQ(this,_.sc,a)}Oa(a){yQ(this,_.mc,a)}lb(a){yQ(this,_.oc,a)}O(a){this.pause();yQ(this,_.fc,a)}X(a){yQ(this,_.pc,a);zQ(this)}T(a){yQ(this,_.ic,a)}Fa(a){yQ(this,_.gc,a);zQ(this)}ec(){const a=this;return _.x(function*(){a.F=!0;if(vQ(a)&&null!==a.J){var b=a.m;b.a&&b.a.forwardEventsTo(b);yield _.tp(a.m);a.C||
13
+ (yield a.m.seek(a.J))}else{if(!a.G)return a.m.play();AQ(a)}a.G=!1;a.h&&a.h.stop();a.C||(yield a.m.play());yQ(a,_.dc)})}$b(){this.L=!0}bc(){this.C=!0;this.l.contentComplete()}load(){const a=this;return _.x(function*(){var b=a.m;const c=a.I;try{if(typeof c.adTagUrl!==_.Qf)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.K.canPlay(!1);const d=yield a.K.canPlay(!0),e=new google.ima.AdsRequest;e.adTagUrl=
14
+ c.adTagUrl;e.setAdWillAutoPlay(b);e.setAdWillPlayMuted(d);a.l.getSettings().setAutoPlayAdBreaks(!1);a.l.requestAds(e);return a.f})}start(a){const b=this;return _.x(function*(){b.a&&b.j&&!b.H?b.j.Tb()?yield CQ(b):yield DQ(b,a):yield a.play()})}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||null===this.B)return-1;const a=this.a.getRemainingTime();
15
+ return 0>a?0:this.B-a}dispose(){return(new Promise(a=>{this.H&&this.j&&this.j.sb()&&!this.L?(this.w.one(this.a,google.ima.AdEvent.Type.ALL_ADS_COMPLETED,()=>{a();this.o&&this.m.getSurface().hide(this.o)}),_.qh(this.w,this.a,[google.ima.AdEvent.Type.LOADED,google.ima.AdEvent.Type.STARTED],()=>{this.a&&this.a.discardAdBreak()})):a();this.a.discardAdBreak();this.l.contentComplete()})).then(()=>{AQ(this);this.w.release();this.h&&(this.h.stop(),this.h=null);this.a&&(this.a.destroy(),this.a=null)})}};
16
+ HQ.prototype.getPosition=HQ.prototype.getPosition;HQ.prototype.setVolume=HQ.prototype.setVolume;HQ.prototype.getVolume=HQ.prototype.getVolume;HQ.prototype.skip=HQ.prototype.skip;HQ.prototype.pause=HQ.prototype.pause;HQ.prototype.resume=HQ.prototype.resume;var IQ=class extends _.Au{constructor(){super();this.a=this.h=this.f=null}onPlayerCreated(a){if(EQ())return a.onError(new _.H(1,9,1E4));this.f=_.uo(_.Gd,{"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(_.fa);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)}zg(){return this.a}xg(){return this.h}Ac(){return this.f}id(){return"ima"}};_.z("clpp.ima.ImaPlugin",IQ);IQ.prototype.getAdContainer=IQ.prototype.Ac;IQ.prototype.getAdDisplayContainer=IQ.prototype.xg;IQ.prototype.getAdsLoader=IQ.prototype.zg;IQ.Id="ima";IQ.isSdkMissing=EQ;_.dp(new class{create(){return new IQ}});var JQ=class{constructor(){this.a=new _.R(tQ)}name(){return tQ}isSupported(a,b){return a.namespace()===_.kd?!1:EQ()?(this.a.warn("IMA SDK is not loaded."),!1):!(!b||!b.ima)}create(a){return new HQ(a)}};JQ.prototype.create=JQ.prototype.create;JQ.prototype.isSupported=JQ.prototype.isSupported;JQ.prototype.name=JQ.prototype.name;_.ro(new JQ);};f.call(g, window);