@castlabs/prestoplay 6.4.1 → 6.5.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 (58) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +6 -6
  5. package/cjs/cl.cast.js +110 -110
  6. package/cjs/cl.conviva.js +33 -33
  7. package/cjs/cl.core.js +419 -416
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +72 -72
  10. package/cjs/cl.externs.js +26 -26
  11. package/cjs/cl.freewheel.js +24 -24
  12. package/cjs/cl.hls.js +47 -47
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +31 -31
  15. package/cjs/cl.ima.js +22 -22
  16. package/cjs/cl.mse.js +258 -255
  17. package/cjs/cl.muxdata.js +12 -12
  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.smooth.js +69 -69
  22. package/cjs/cl.thumbnails.js +24 -24
  23. package/cjs/cl.tizen.js +71 -71
  24. package/cjs/cl.ttml.js +27 -27
  25. package/cjs/cl.verimatrix.js +5 -5
  26. package/cjs/cl.vimond.js +13 -13
  27. package/cjs/cl.vr.js +19 -18
  28. package/cjs/cl.vtt.js +14 -14
  29. package/cjs/cl.youbora.js +20 -20
  30. package/cl.adobe.js +3 -3
  31. package/cl.airplay.js +3 -3
  32. package/cl.broadpeak.js +5 -5
  33. package/cl.cast.js +88 -88
  34. package/cl.conviva.js +27 -27
  35. package/cl.core.js +354 -351
  36. package/cl.crypto.js +8 -8
  37. package/cl.dash.js +66 -66
  38. package/cl.externs.js +26 -26
  39. package/cl.freewheel.js +19 -19
  40. package/cl.hls.js +40 -39
  41. package/cl.hlssmpte.js +5 -5
  42. package/cl.htmlcue.js +25 -25
  43. package/cl.ima.js +16 -16
  44. package/cl.mse.js +230 -231
  45. package/cl.muxdata.js +8 -8
  46. package/cl.onboard.js +4 -4
  47. package/cl.persistent.js +9 -9
  48. package/cl.playlist.js +5 -5
  49. package/cl.smooth.js +58 -58
  50. package/cl.thumbnails.js +17 -17
  51. package/cl.tizen.js +57 -57
  52. package/cl.ttml.js +22 -22
  53. package/cl.verimatrix.js +4 -4
  54. package/cl.vimond.js +8 -8
  55. package/cl.vr.js +15 -14
  56. package/cl.vtt.js +12 -12
  57. package/cl.youbora.js +15 -16
  58. package/package.json +6 -2
@@ -1,28 +1,28 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var aK="clpp-freewheel",bK="clpp.freewheel.AdsManagerFactory",cK="freewheel",dK=function(){this.f=this.a=null},eK=function(){},fK=function(a){switch(a){case 0:return tv.freewheel.SDK.ADUNIT_PREROLL;case 1:return tv.freewheel.SDK.ADUNIT_MIDROLL;case 2:return tv.freewheel.SDK.ADUNIT_POSTROLL;default:return""}},gK=function(a,b,c){this.g=a;this.f=b;this.a=c},hK=function(a){this.a=a},iK=function(a){this.B=new _.H("clpp.freewheel.AdsManager");this.l=a;this.g=new _.cg;this.o=new tv.freewheel.SDK.AdManager;
3
- this.f=this.a=null;this.A=[];this.m=[];this.w=[];this.j=new _.Mh;this.h=null},jK=function(a){var b=[];typeof a.networkId!==_.k&&b.push("networkId");typeof a.serverUrl!==_.te&&b.push("serverUrl");typeof a.profileId!==_.te&&b.push("profileId");typeof a.videoAssetId!==_.te&&typeof a.videoAssetId!==_.k&&b.push("videoAssetId");if(b.length)throw new _.L(1,9,12001,{missingKeys:b.join(", ")});},kK=function(){var a,b,c,d;return _.A(function(e){if(1==e.a)return a=new _.rp,b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_NONE,
4
- _.y(e,a.canPlay(!1),2);if(3!=e.a)return c=e.f,_.y(e,a.canPlay(!0),3);d=e.f;c?b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_ATTENDED:d&&(b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_UNATTENDED);return e["return"](b)})},nK=function(a){return _.A(function(b){if(a.A.length)return lK(a),a.f=a.A.shift(),a.f.play(),b.H(0);mK(a);return _.y(b,a.l.a.play(),0)})},oK=function(a){a.w.length?(lK(a),a.f=a.w.shift(),a.f.play()):mK(a)},lK=function(a){var b=a.l.$b(cK).Dc();b&&(a.l.getSurface().show(b),a.l.getSurface().hideMediaElement(),
5
- a.a.registerVideoDisplayBase(aK),a.l.isMuted()?a.setVolume(0):a.setVolume(a.l.getVolume()||1))},mK=function(a){var b=a.l.$b(cK).Dc();b&&a.l.getSurface().hide(b);a.l.getSurface().showMediaElement()},pK=function(a,b,c){var d=null;a.a&&c&&(c.adInstance||c.slot)&&(c=(d=c.adInstance||null)?d.getSlot():c.slot,d={ad:new gK(a.a,c,d)});a.l.trigger(new _.I(b,d))},qK=function(){this.a=new _.H(bK)};_.v(dK,_.cq);_.t=dK.prototype;
6
- _.t.onPlayerCreated=function(a){if(window.tv&&tv.freewheel&&tv.freewheel.SDK)this.a=_.xn(_.Vc,{id:aK}),this.f=_.xn(_.Pe,{"class":_.Dc}),this.a.appendChild(this.f),a.getSurface().addElementToContainer(this.a,!0),a.getSurface().hide(this.a);else a.onError(new _.L(1,9,12E3))};_.t.onPlayerWillDestroy=function(a){this.a&&(a.getSurface().removeElementFromContainer(this.a),this.f=this.a=null)};_.t.id=function(){return cK};_.t.Dc=function(){return this.a};_.t.di=function(){return this.f};
7
- _.B("clpp.freewheel.FreeWheelPlugin",dK);dK.prototype.getAdVideo=dK.prototype.di;dK.prototype.getAdContainer=dK.prototype.Dc;dK.Id=cK;dK.AD_CONTAINER_ID=aK;eK.prototype.create=function(){return new dK};_.uo(new eK);_.t=gK.prototype;_.t.sb=function(){return"FreeWheel AdManager SDK"};_.t.tb=function(){return tv.freewheel.SDK.version};_.t.yb=function(){return 0};_.t.getId=function(){return this.a?this.a.getAdId():""};_.t.getCreativeId=function(){var a=(this.a||{})._creativeId;return typeof a===_.te?a:""};_.t.getApiFramework=function(){return this.a?this.a.getActiveCreativeRendition().getCreativeApi():""};_.t.getAdSystem=function(){return""};_.t.getAdvertiserName=function(){return""};_.t.getTitle=function(){return""};
8
- _.t.getDuration=function(){return this.a?this.a.getActiveCreativeRendition().getDuration():0};_.t.getSkipTimeOffset=function(){return 0};_.t.dc=function(){return!1};_.t.Ib=function(){return this.a&&this.a.getEventCallbackUrls(tv.freewheel.SDK.EVENT_AD_CLICK,tv.freewheel.SDK.EVENT_TYPE_CLICK)[0]||""};_.t.getMediaUrl=function(){return this.a?this.a.getActiveCreativeRendition().getPrimaryCreativeRenditionAsset().getUrl():""};
9
- _.t.vb=function(){return this.a?this.a.getActiveCreativeRendition().getWidth():0};_.t.ub=function(){return this.a?this.a.getActiveCreativeRendition().getHeight():0};_.t.gb=function(){return 0};_.t.Ua=function(){switch(this.f.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:return 0;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:return 2;default:return 1}};
10
- _.t.getPodIndex=function(){switch(this.Ua()){case 0:return 0;case 2:return-1}return this.g.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL).indexOf(this.f)+1};_.t.Jb=function(){switch(this.Ua()){case 0:return 0;case 2:return-1;default:return this.f.getTimePosition()}};_.t.Kb=function(){return this.a?this.f.getAdInstances().indexOf(this.a)+1:1};_.t.xb=function(){return this.f.getAdCount()};_.t.getWrapperAdIds=function(){return[]};_.t.getWrapperAdSystems=function(){return[]};
11
- _.t.getWrapperCreativeIds=function(){return[]};gK.prototype.getWrapperCreativeIds=gK.prototype.getWrapperCreativeIds;gK.prototype.getWrapperAdSystems=gK.prototype.getWrapperAdSystems;gK.prototype.getWrapperAdIds=gK.prototype.getWrapperAdIds;gK.prototype.getSequenceLength=gK.prototype.xb;gK.prototype.getPositionInSequence=gK.prototype.Kb;gK.prototype.getPodTimeOffset=gK.prototype.Jb;gK.prototype.getPodIndex=gK.prototype.getPodIndex;gK.prototype.getPodType=gK.prototype.Ua;
12
- gK.prototype.getMediaBitrate=gK.prototype.gb;gK.prototype.getMediaHeight=gK.prototype.ub;gK.prototype.getMediaWidth=gK.prototype.vb;gK.prototype.getMediaUrl=gK.prototype.getMediaUrl;gK.prototype.getClickThroughUrl=gK.prototype.Ib;gK.prototype.isBumper=gK.prototype.dc;gK.prototype.getSkipTimeOffset=gK.prototype.getSkipTimeOffset;gK.prototype.getDuration=gK.prototype.getDuration;gK.prototype.getTitle=gK.prototype.getTitle;gK.prototype.getAdvertiserName=gK.prototype.getAdvertiserName;
13
- gK.prototype.getAdSystem=gK.prototype.getAdSystem;gK.prototype.getApiFramework=gK.prototype.getApiFramework;gK.prototype.getCreativeId=gK.prototype.getCreativeId;gK.prototype.getId=gK.prototype.getId;gK.prototype.getTechnology=gK.prototype.yb;gK.prototype.getAdManagerVersion=gK.prototype.tb;gK.prototype.getAdManagerName=gK.prototype.sb;hK.prototype.getCuePoints=function(){return this.a.getTemporalSlots().map(function(a){switch(a.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:return 0;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:return-1;default:return a.getTimePosition()}})};hK.prototype.Lb=function(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL).length};hK.prototype.hb=function(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL).length};
14
- hK.prototype.hasPostroll=hK.prototype.hb;hK.prototype.hasPreroll=hK.prototype.Lb;hK.prototype.getCuePoints=hK.prototype.getCuePoints;_.t=iK.prototype;
15
- _.t.load=function(){var a=this,b,c,d,e,f,g,h,l;return _.A(function(m){if(1==m.a){b=a.l.getConfiguration().freewheel||{};try{jK(b)}catch(n){return a.l.onError(n),a.j.resolve(),m["return"](a.j)}a.o.setNetwork(b.networkId);a.o.setServer(b.serverUrl);a.a=a.o.newContext();a.a.setProfile(b.profileId);typeof b.siteSectionId!==_.te&&typeof b.siteSectionId!==_.k||a.a.setSiteSection(b.siteSectionId);return _.y(m,kK(),2)}c=m.f;a.a.setVideoAsset(b.videoAssetId,a.l.getDuration(),void 0,void 0,c);if(Array.isArray(b.pods))for(d=
16
- _.u(b.pods),e=d.next();!e.done;e=d.next())f=e.value,a.a.addTemporalSlot(f.id,fK(f.type),f.position,f.slotProfile,f.cuepointSequence,f.maxDuration,f.minDuration,f.acceptContentType);b.keyValues&&typeof b.keyValues===_.Id&&Object.keys(b.keyValues).forEach(function(n){return a.a.addKeyValue(n,b.keyValues[n])});a.a.setParameter(tv.freewheel.SDK.PARAMETER_EXTENSION_CONTENT_VIDEO_ENABLED,!1,tv.freewheel.SDK.PARAMETER_LEVEL_GLOBAL);if(Array.isArray(b.parameters))for(g=_.u(b.parameters),h=g.next();!h.done;h=
17
- g.next())l=h.value,a.a.setParameter(l.name,l.value,l.level);a.g.on(a.a,tv.freewheel.SDK.EVENT_REQUEST_COMPLETE,a.kj.bind(a));a.g.on(a.a,tv.freewheel.SDK.EVENT_SLOT_STARTED,a.oj.bind(a));a.g.on(a.a,tv.freewheel.SDK.EVENT_SLOT_ENDED,a.nj.bind(a));a.g.on(a.a,tv.freewheel.SDK.EVENT_AD,a.Gi.bind(a));a.g.on(a.l,_.De,a.kh.bind(a));a.g.on(a.l,_.pe,a.jh.bind(a));a.a.submitRequest();return m["return"](a.j)})};_.t.start=function(){var a=this;return _.A(function(b){return _.y(b,nK(a),0)})};
18
- _.t.resume=function(){this.f&&this.f.resume()};_.t.pause=function(){this.f&&this.f.pause()};_.t.skip=function(){this.f&&this.f.skipCurrentAd()};_.t.getVolume=function(){return this.a?this.a.getAdVolume():1};_.t.setVolume=function(a){this.a&&this.a.setAdVolume(a)};_.t.getPosition=function(){return this.f?this.f.getPlayheadTime():-1};_.t.dispose=function(){var a=this;return _.A(function(b){a.g.release();a.h&&(a.h.stop(),a.h=null);mK(a);a.a&&(a.a.dispose(),a.a=null);_.z(b)})};
19
- _.t.kj=function(a){var b=this;if(a.success)this.A=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL),this.m=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL),this.w=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL),this.l.trigger(new _.I(_.Wb,{adsTimeline:new hK(this.a)})),this.h=new _.pp(this.l.getSurface(),function(c,d){return b.a.resize(c,d)},this.l.$b(cK).f);else this.l.onError(new _.L(1,9,10003,{errorType:0},
20
- void 0));this.j.resolve()};_.t.oj=function(a){pK(this,_.Fb,a);this.h.start()};_.t.nj=function(a){this.f=null;a=a.slot;pK(this,_.Gb);this.h.stop();if(a)switch(a.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:nK(this);break;case tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL:mK(this);this.l.play();break;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:oK(this)}};
21
- _.t.Gi=function(a){var b=a.subType;this.B.debug("ad event",b);switch(b){case tv.freewheel.SDK.EVENT_AD_IMPRESSION:pK(this,_.Sb,a);pK(this,_.Lb,a);break;case tv.freewheel.SDK.EVENT_AD_IMPRESSION_END:pK(this,_.Tb,a);break;case tv.freewheel.SDK.EVENT_AD_FIRST_QUARTILE:pK(this,_.Kb,a);break;case tv.freewheel.SDK.EVENT_AD_MIDPOINT:pK(this,_.Nb,a);break;case tv.freewheel.SDK.EVENT_AD_THIRD_QUARTILE:pK(this,_.Ub,a);break;case tv.freewheel.SDK.EVENT_AD_COMPLETE:pK(this,_.Jb,a);break;case tv.freewheel.SDK.EVENT_AD_CLICK:pK(this,
22
- _.Ib,a);break;case tv.freewheel.SDK.EVENT_AD_PAUSE:pK(this,_.Ob,a);break;case tv.freewheel.SDK.EVENT_AD_RESUME:pK(this,_.Qb,a);break;case tv.freewheel.SDK.EVENT_AD_SKIPPED:pK(this,_.Rb,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_START:pK(this,_.Hb,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_END:pK(this,_.Pb,a);break;case tv.freewheel.SDK.EVENT_ERROR:this.l.onError(new _.L(1,9,10003,{errorType:1},{fwCode:a[tv.freewheel.SDK.INFO_KEY_ERROR_CODE],fwInfo:a[tv.freewheel.SDK.INFO_KEY_ERROR_INFO],
23
- fwModule:a[tv.freewheel.SDK.INFO_KEY_ERROR_MODULE]}))}};_.t.kh=function(){var a=this;if(!this.f){var b=this.l.getPosition();if(this.f=this.m.find(function(d){return.5>Math.abs(b-d.getTimePosition())})||null){var c=this.m.findIndex(function(d){return d===a.f});this.m.splice(c,1);this.l.pause();lK(this);this.f.play()}}};
24
- _.t.jh=function(a){if((a=a.detail)&&this.a)switch(a.currentState){case _.bn:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PLAYING);break;case _.an:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PAUSED);break;case _.Vm:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_COMPLETED);oK(this);break;case _.Om:case _.Zm:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_STOPPED)}};iK.prototype.getPosition=iK.prototype.getPosition;iK.prototype.setVolume=iK.prototype.setVolume;
25
- iK.prototype.getVolume=iK.prototype.getVolume;iK.prototype.skip=iK.prototype.skip;iK.prototype.pause=iK.prototype.pause;iK.prototype.resume=iK.prototype.resume;iK.prototype.start=iK.prototype.start;qK.prototype.name=function(){return bK};qK.prototype.aa=function(a,b){return a.namespace()===_.Fc?!1:window.tv&&tv.freewheel&&tv.freewheel.SDK?!(!b||!b.freewheel):(this.a.warn("FreeWheel SDK is not loaded."),!1)};qK.prototype.create=function(a){return new iK(a)};qK.prototype.create=qK.prototype.create;qK.prototype.isSupported=qK.prototype.aa;qK.prototype.name=qK.prototype.name;_.un(new qK);};
2
+ var f=function(window){var fK="clpp-freewheel",gK="clpp.freewheel.AdsManagerFactory",hK="freewheel",iK=function(){this.f=this.a=null},jK=function(){},kK=function(a){switch(a){case 0:return tv.freewheel.SDK.ADUNIT_PREROLL;case 1:return tv.freewheel.SDK.ADUNIT_MIDROLL;case 2:return tv.freewheel.SDK.ADUNIT_POSTROLL;default:return""}},lK=function(a,b,c){this.g=a;this.f=b;this.a=c},mK=function(a){this.a=a},nK=function(a){this.B=new _.H("clpp.freewheel.AdsManager");this.l=a;this.g=new _.dg;this.o=new tv.freewheel.SDK.AdManager;
3
+ this.f=this.a=null;this.A=[];this.m=[];this.w=[];this.j=new _.Nh;this.h=null},oK=function(a){var b=[];typeof a.networkId!==_.k&&b.push("networkId");typeof a.serverUrl!==_.ue&&b.push("serverUrl");typeof a.profileId!==_.ue&&b.push("profileId");typeof a.videoAssetId!==_.ue&&typeof a.videoAssetId!==_.k&&b.push("videoAssetId");if(b.length)throw new _.L(1,9,12001,{missingKeys:b.join(", ")});},pK=function(){var a,b,c,d;return _.B(function(e){if(1==e.a)return a=new _.tp,b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_NONE,
4
+ _.x(e,a.canPlay(!1),2);if(3!=e.a)return c=e.f,_.x(e,a.canPlay(!0),3);d=e.f;c?b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_ATTENDED:d&&(b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_UNATTENDED);return e["return"](b)})},sK=function(a){return _.B(function(b){if(a.A.length)return qK(a),a.f=a.A.shift(),a.f.play(),b.H(0);rK(a);return _.x(b,a.l.a.play(),0)})},tK=function(a){a.w.length?(qK(a),a.f=a.w.shift(),a.f.play()):rK(a)},qK=function(a){var b=a.l.bc(hK).Fc();b&&(a.l.getSurface().show(b),a.l.getSurface().hideMediaElement(),
5
+ a.a.registerVideoDisplayBase(fK),a.l.isMuted()?a.setVolume(0):a.setVolume(a.l.getVolume()||1))},rK=function(a){var b=a.l.bc(hK).Fc();b&&a.l.getSurface().hide(b);a.l.getSurface().showMediaElement()},uK=function(a,b,c){var d=null;a.a&&c&&(c.adInstance||c.slot)&&(c=(d=c.adInstance||null)?d.getSlot():c.slot,d={ad:new lK(a.a,c,d)});a.l.trigger(new _.J(b,d))},vK=function(){this.a=new _.H(gK)};_.v(iK,_.eq);_.t=iK.prototype;
6
+ _.t.onPlayerCreated=function(a){if(window.tv&&tv.freewheel&&tv.freewheel.SDK)this.a=_.zn(_.Wc,{id:fK}),this.f=_.zn(_.Qe,{"class":_.Ec}),this.a.appendChild(this.f),a.getSurface().addElementToContainer(this.a,!0),a.getSurface().hide(this.a);else a.onError(new _.L(1,9,12E3))};_.t.onPlayerWillDestroy=function(a){this.a&&(a.getSurface().removeElementFromContainer(this.a),this.f=this.a=null)};_.t.id=function(){return hK};_.t.Fc=function(){return this.a};_.t.fi=function(){return this.f};
7
+ _.C("clpp.freewheel.FreeWheelPlugin",iK);iK.prototype.getAdVideo=iK.prototype.fi;iK.prototype.getAdContainer=iK.prototype.Fc;iK.Id=hK;iK.AD_CONTAINER_ID=fK;jK.prototype.create=function(){return new iK};_.wo(new jK);_.t=lK.prototype;_.t.sb=function(){return"FreeWheel AdManager SDK"};_.t.tb=function(){return tv.freewheel.SDK.version};_.t.yb=function(){return 0};_.t.getId=function(){return this.a?this.a.getAdId():""};_.t.getCreativeId=function(){var a=(this.a||{})._creativeId;return typeof a===_.ue?a:""};_.t.getApiFramework=function(){return this.a?this.a.getActiveCreativeRendition().getCreativeApi():""};_.t.getAdSystem=function(){return""};_.t.getAdvertiserName=function(){return""};_.t.getTitle=function(){return""};
8
+ _.t.getDuration=function(){return this.a?this.a.getActiveCreativeRendition().getDuration():0};_.t.getSkipTimeOffset=function(){return 0};_.t.fc=function(){return!1};_.t.Kb=function(){return this.a&&this.a.getEventCallbackUrls(tv.freewheel.SDK.EVENT_AD_CLICK,tv.freewheel.SDK.EVENT_TYPE_CLICK)[0]||""};_.t.getMediaUrl=function(){return this.a?this.a.getActiveCreativeRendition().getPrimaryCreativeRenditionAsset().getUrl():""};
9
+ _.t.vb=function(){return this.a?this.a.getActiveCreativeRendition().getWidth():0};_.t.ub=function(){return this.a?this.a.getActiveCreativeRendition().getHeight():0};_.t.hb=function(){return 0};_.t.Va=function(){switch(this.f.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:return 0;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:return 2;default:return 1}};
10
+ _.t.getPodIndex=function(){switch(this.Va()){case 0:return 0;case 2:return-1}return this.g.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL).indexOf(this.f)+1};_.t.Lb=function(){switch(this.Va()){case 0:return 0;case 2:return-1;default:return this.f.getTimePosition()}};_.t.Mb=function(){return this.a?this.f.getAdInstances().indexOf(this.a)+1:1};_.t.xb=function(){return this.f.getAdCount()};_.t.getWrapperAdIds=function(){return[]};_.t.getWrapperAdSystems=function(){return[]};
11
+ _.t.getWrapperCreativeIds=function(){return[]};lK.prototype.getWrapperCreativeIds=lK.prototype.getWrapperCreativeIds;lK.prototype.getWrapperAdSystems=lK.prototype.getWrapperAdSystems;lK.prototype.getWrapperAdIds=lK.prototype.getWrapperAdIds;lK.prototype.getSequenceLength=lK.prototype.xb;lK.prototype.getPositionInSequence=lK.prototype.Mb;lK.prototype.getPodTimeOffset=lK.prototype.Lb;lK.prototype.getPodIndex=lK.prototype.getPodIndex;lK.prototype.getPodType=lK.prototype.Va;
12
+ lK.prototype.getMediaBitrate=lK.prototype.hb;lK.prototype.getMediaHeight=lK.prototype.ub;lK.prototype.getMediaWidth=lK.prototype.vb;lK.prototype.getMediaUrl=lK.prototype.getMediaUrl;lK.prototype.getClickThroughUrl=lK.prototype.Kb;lK.prototype.isBumper=lK.prototype.fc;lK.prototype.getSkipTimeOffset=lK.prototype.getSkipTimeOffset;lK.prototype.getDuration=lK.prototype.getDuration;lK.prototype.getTitle=lK.prototype.getTitle;lK.prototype.getAdvertiserName=lK.prototype.getAdvertiserName;
13
+ lK.prototype.getAdSystem=lK.prototype.getAdSystem;lK.prototype.getApiFramework=lK.prototype.getApiFramework;lK.prototype.getCreativeId=lK.prototype.getCreativeId;lK.prototype.getId=lK.prototype.getId;lK.prototype.getTechnology=lK.prototype.yb;lK.prototype.getAdManagerVersion=lK.prototype.tb;lK.prototype.getAdManagerName=lK.prototype.sb;mK.prototype.getCuePoints=function(){return this.a.getTemporalSlots().map(function(a){switch(a.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:return 0;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:return-1;default:return a.getTimePosition()}})};mK.prototype.Nb=function(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL).length};mK.prototype.ib=function(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL).length};
14
+ mK.prototype.hasPostroll=mK.prototype.ib;mK.prototype.hasPreroll=mK.prototype.Nb;mK.prototype.getCuePoints=mK.prototype.getCuePoints;_.t=nK.prototype;
15
+ _.t.load=function(){var a=this,b,c,d,e,f,g,h,l;return _.B(function(m){if(1==m.a){b=a.l.getConfiguration().freewheel||{};try{oK(b)}catch(n){return a.l.onError(n),a.j.resolve(),m["return"](a.j)}a.o.setNetwork(b.networkId);a.o.setServer(b.serverUrl);a.a=a.o.newContext();a.a.setProfile(b.profileId);typeof b.siteSectionId!==_.ue&&typeof b.siteSectionId!==_.k||a.a.setSiteSection(b.siteSectionId);return _.x(m,pK(),2)}c=m.f;a.a.setVideoAsset(b.videoAssetId,a.l.getDuration(),void 0,void 0,c);if(Array.isArray(b.pods))for(d=
16
+ _.u(b.pods),e=d.next();!e.done;e=d.next())f=e.value,a.a.addTemporalSlot(f.id,kK(f.type),f.position,f.slotProfile,f.cuepointSequence,f.maxDuration,f.minDuration,f.acceptContentType);b.keyValues&&typeof b.keyValues===_.Jd&&Object.keys(b.keyValues).forEach(function(n){return a.a.addKeyValue(n,b.keyValues[n])});a.a.setParameter(tv.freewheel.SDK.PARAMETER_EXTENSION_CONTENT_VIDEO_ENABLED,!1,tv.freewheel.SDK.PARAMETER_LEVEL_GLOBAL);if(Array.isArray(b.parameters))for(g=_.u(b.parameters),h=g.next();!h.done;h=
17
+ g.next())l=h.value,a.a.setParameter(l.name,l.value,l.level);a.g.on(a.a,tv.freewheel.SDK.EVENT_REQUEST_COMPLETE,a.lj.bind(a));a.g.on(a.a,tv.freewheel.SDK.EVENT_SLOT_STARTED,a.pj.bind(a));a.g.on(a.a,tv.freewheel.SDK.EVENT_SLOT_ENDED,a.oj.bind(a));a.g.on(a.a,tv.freewheel.SDK.EVENT_AD,a.Hi.bind(a));a.g.on(a.l,_.Ee,a.nh.bind(a));a.g.on(a.l,_.re,a.mh.bind(a));a.a.submitRequest();return m["return"](a.j)})};_.t.start=function(){var a=this;return _.B(function(b){return _.x(b,sK(a),0)})};
18
+ _.t.resume=function(){this.f&&this.f.resume()};_.t.pause=function(){this.f&&this.f.pause()};_.t.skip=function(){this.f&&this.f.skipCurrentAd()};_.t.getVolume=function(){return this.a?this.a.getAdVolume():1};_.t.setVolume=function(a){this.a&&this.a.setAdVolume(a)};_.t.getPosition=function(){return this.f?this.f.getPlayheadTime():-1};_.t.dispose=function(){var a=this;return _.B(function(b){a.g.release();a.h&&(a.h.stop(),a.h=null);rK(a);a.a&&(a.a.dispose(),a.a=null);_.z(b)})};
19
+ _.t.lj=function(a){var b=this;if(a.success)this.A=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL),this.m=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL),this.w=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL),this.l.trigger(new _.J(_.Wb,{adsTimeline:new mK(this.a)})),this.h=new _.rp(this.l.getSurface(),function(c,d){return b.a.resize(c,d)},this.l.bc(hK).f);else this.l.onError(new _.L(1,9,10003,{errorType:0},
20
+ void 0));this.j.resolve()};_.t.pj=function(a){uK(this,_.Fb,a);this.h.start()};_.t.oj=function(a){this.f=null;a=a.slot;uK(this,_.Gb);this.h.stop();if(a)switch(a.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:sK(this);break;case tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL:rK(this);this.l.play();break;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:tK(this)}};
21
+ _.t.Hi=function(a){var b=a.subType;this.B.debug("ad event",b);switch(b){case tv.freewheel.SDK.EVENT_AD_IMPRESSION:uK(this,_.Sb,a);uK(this,_.Lb,a);break;case tv.freewheel.SDK.EVENT_AD_IMPRESSION_END:uK(this,_.Tb,a);break;case tv.freewheel.SDK.EVENT_AD_FIRST_QUARTILE:uK(this,_.Kb,a);break;case tv.freewheel.SDK.EVENT_AD_MIDPOINT:uK(this,_.Nb,a);break;case tv.freewheel.SDK.EVENT_AD_THIRD_QUARTILE:uK(this,_.Ub,a);break;case tv.freewheel.SDK.EVENT_AD_COMPLETE:uK(this,_.Jb,a);break;case tv.freewheel.SDK.EVENT_AD_CLICK:uK(this,
22
+ _.Ib,a);break;case tv.freewheel.SDK.EVENT_AD_PAUSE:uK(this,_.Ob,a);break;case tv.freewheel.SDK.EVENT_AD_RESUME:uK(this,_.Qb,a);break;case tv.freewheel.SDK.EVENT_AD_SKIPPED:uK(this,_.Rb,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_START:uK(this,_.Hb,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_END:uK(this,_.Pb,a);break;case tv.freewheel.SDK.EVENT_ERROR:this.l.onError(new _.L(1,9,10003,{errorType:1},{fwCode:a[tv.freewheel.SDK.INFO_KEY_ERROR_CODE],fwInfo:a[tv.freewheel.SDK.INFO_KEY_ERROR_INFO],
23
+ fwModule:a[tv.freewheel.SDK.INFO_KEY_ERROR_MODULE]}))}};_.t.nh=function(){var a=this;if(!this.f){var b=this.l.getPosition();if(this.f=this.m.find(function(d){return.5>Math.abs(b-d.getTimePosition())})||null){var c=this.m.findIndex(function(d){return d===a.f});this.m.splice(c,1);this.l.pause();qK(this);this.f.play()}}};
24
+ _.t.mh=function(a){if((a=a.detail)&&this.a)switch(a.currentState){case _.cn:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PLAYING);break;case _.bn:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PAUSED);break;case _.Wm:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_COMPLETED);tK(this);break;case _.Pm:case _.$m:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_STOPPED)}};nK.prototype.getPosition=nK.prototype.getPosition;nK.prototype.setVolume=nK.prototype.setVolume;
25
+ nK.prototype.getVolume=nK.prototype.getVolume;nK.prototype.skip=nK.prototype.skip;nK.prototype.pause=nK.prototype.pause;nK.prototype.resume=nK.prototype.resume;nK.prototype.start=nK.prototype.start;vK.prototype.name=function(){return gK};vK.prototype.ca=function(a,b){return a.namespace()===_.Gc?!1:window.tv&&tv.freewheel&&tv.freewheel.SDK?!(!b||!b.freewheel):(this.a.warn("FreeWheel SDK is not loaded."),!1)};vK.prototype.create=function(a){return new nK(a)};vK.prototype.create=vK.prototype.create;vK.prototype.isSupported=vK.prototype.ca;vK.prototype.name=vK.prototype.name;_.wn(new vK);};
26
26
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
27
27
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
28
28
  else{_=this.clpp._;(f.call(g,this));}
package/cjs/cl.hls.js CHANGED
@@ -1,51 +1,51 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var FA="CLOSED-CAPTIONS",GA="EXT-X-BYTERANGE",HA="EXT-X-DISCONTINUITY",IA="EXT-X-DISCONTINUITY-SEQUENCE",JA="EXT-X-ENDLIST",KA="EXT-X-MEDIA-SEQUENCE",LA="EXT-X-PART-INF",MA="EXT-X-PLAYLIST-TYPE",NA="EXT-X-PRELOAD-HINT",OA="EXT-X-SERVER-CONTROL",PA="EXT-X-STREAM-INF",QA="EXT-X-TARGETDURATION",RA="EXTINF",SA="GROUP-ID",TA="Guessing audio-only",UA="SAMPLE-AES-CTR",VA="SUBTITLES",WA="application/vnd.apple.mpegurl",XA=function(a,b){var c=a.getAttribute(b);if(!c)throw new _.L(_.M,4,4023,b);return c.value},
3
- YA=function(a){if(1>a.a)throw _.yk();--a.a},ZA=function(a,b,c,d){this.f=a;this.type=b;this.sa=c;this.a=d||null},$A=function(a,b,c){c=void 0===c?[]:c;this.sa=b;this.a=a;this.f=c},aB=function(a,b){return a.filter(function(c){return c.name==b})},bB=function(a,b){return a.filter(function(c){return XA(c,"TYPE")===b})},cB=function(a,b){var c=aB(a,b);return c.length?c[0]:null},dB=function(a){var b=void 0===b?0:b;return(a=cB(a,KA))?Number(a.value):b},eB=function(a,b){return _.xv([a],[b])[0]},fB=function(){this.a=
4
- 0},kB=function(a,b,c){b=_.oh(b);b=b.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n").trim();var d=b.split(/\n+/m);if(!/^#EXTM3U($|[ \t\n])/m.test(d[0]))throw new _.L(_.M,4,4015);b=0;for(var e=!0,f=_.u(d),g=f.next();!g.done;g=f.next())if(g=g.value,g=g.trim(),!g.length||/^#(?!EXT)/m.test(g)||e)e=!1;else if(g=gB(a,g),--a.a,hB.includes(g.name)){b=1;break}else g.name==PA&&(e=!0);f=[];e=!0;g=_.u(_.EA(d));for(var h=g.next();!h.done;h=g.next()){var l=h.value;h=l.Hd;var m=l.item;l=l.next;m=m.trim();if(!m.length||/^#(?!EXT)/m.test(m)||
5
- e)e=!1;else{m=gB(a,m);if(iB.includes(m.name)){if(1!=b)throw new _.L(_.M,4,4017);d=d.splice(h,d.length-h);a=jB(a,c,d,f);return new ZA(c,b,f,a)}f.push(m);m.name==PA&&(m.attributes.push(new _.Xg(_.vb,l)),e=!0)}}return new ZA(c,b,f)},jB=function(a,b,c,d){var e=[],f=[],g=[];c.forEach(function(h){/^(#EXT)/.test(h)?(h=gB(a,h),hB.includes(h.name)?d.push(h):lB.includes(h.name)?"EXT-X-PART"===h.name?g.push(h):h.name===NA&&"PART"===_.Wg(h,"TYPE")&&g.push(h):f.push(h)):/^#(?!EXT)/m.test(h)||(h=eB(b,h.trim()),
6
- e.push(new $A(h,f,g)),f=[],g=[])});g.length&&e.push(new $A(null,f,g));return e},gB=function(a,b){return _.Ch(a.a++,b)},mB=function(a,b){b=void 0===b?0:b;return b+10<=a.length&&73===a[b]&&68===a[b+1]&&51===a[b+2]&&255>a[b+3]&&255>a[b+4]&&128>a[b+6]&&128>a[b+7]&&128>a[b+8]&&128>a[b+9]?!0:!1},pB=function(){var a=this;this.g=this.j=null;this.ua=1;this.$=0;this.w=new Map;this.ia=new Set;this.f=new Map;this.h=null;this.B="";this.S=new fB;this.da=0;this.X=new Map;this.A=new _.Li(function(){nB(a)});this.m=
7
- oB;this.K=null;this.D=0;this.G=Infinity;this.C=new _.Qh;this.ca=[];this.O=new Map;this.J=!1;this.o=new Map;this.U=null;this.a=new _.H("clpp.hls.HlsParser");this.I=new Map;this.L=new Map},uB=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,r,w;return _.A(function(x){if(1==x.a){c=qB;d=b.Bg;e=new _.Eg(d);if(a.g.hlsLowLatency){f=e.a;if(b.Hg){var C=b.segmentIndex;if(C=C.a[C.a.length-1]){var D=C.a,E=D.length-1;C={Ai:C.position,tj:D&&0<D.length?E:null}}else C=null;g=C;h=g.Ai;l=g.tj;null!==h&&(f.add("_HLS_msn",h),
8
- null!==l&&f.add("_HLS_part",l))}_.Pg(f);f.g&&_.Hg(e,f)}return _.y(x,rB(a,e.toString()),2)}if(3!=x.a){m=x.f;n=kB(a.S,m.data,m.uri);if(1!=n.type)throw new _.L(_.M,4,4017);p=b.stream;return _.y(x,sB(a,b.Qd,n,p.type,p.mimeType,p.codecs,p.keyInfo||null,b.Vh),3)}q=x.f;b.segmentIndex.replace(q);r=q[q.length-1];if(w=cB(n.sa,JA))tB(a,c.VOD),a.h.Rb(r.endTime);_.z(x)})},yB=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,r,w,x,C,D,E,G,K,O,T,Da,ea;return _.A(function(fa){if(1==fa.a){c=kB(a.S,b,a.B);if(1===c.type){a.I.set(a.B,
9
- c);d=c.a[0].a;e=_.nn;f=new _.Eg(d);g=f.na.split(".").pop();h=vB[e.AUDIO][g];l=vB[e.VIDEO][g];m="";l?m="avc1.42E01E":h&&(m="mp4a.40.2");var xa=a.S,ha=a.B,qa=a.g.hlsDefaultCodecs||m,Ba=[],$a=[];$a.push(new _.Xg(_.na,"0"));$a.push(new _.Xg(_.vb,ha));qa.length&&$a.push(new _.Xg(_.pa,qa));Ba.push(new _.Vg(xa.a++,PA,$a));c=new ZA(ha,0,Ba)}return _.y(fa,wB(a,c.sa),2)}n=fa.f;if(!a.j)throw new _.L(_.M,7,7001);a.j.filterAllPeriods([n]);p=Infinity;q=0;r=Infinity;w=_.u(a.f.values());for(x=w.next();!x.done;x=
10
- w.next())C=x.value,p=Math.min(p,C.De),q=Math.max(q,C.De),C.stream.type!=_.Ae&&(r=Math.min(r,C.duration));a.m!=oB?(a.h=new _.Vv(0,a.$,!1),_.Zv(a.h,1)):a.h=new _.Vv(null,0,!0);xB(a);if(a.m!=oB){a.da=a.G;D=qB;a.m===D.LIVE&&(E=a.h.Pe,G=Math.max(r,E),isNaN(a.g.availabilityWindowOverride)||(G=a.g.availabilityWindowOverride),a.h.hc=G);for(K=0;95443.7176888889<=q;)K+=95443.7176888889,q-=95443.7176888889;if(K)for(a.a.debug("Offsetting live streams by",K,"to compensate for rollover"),O=_.u(a.f.values()),x=
11
- O.next();!x.done;x=O.next())T=x.value,95443.7176888889>T.De?(a.a.debug("Offset applied to",T.stream.type),T.segmentIndex.offset(K)):a.a.debug("Offset NOT applied to",T.stream.type)}else for(a.h.Rb(r),a.h.offset(-p),Da=_.u(a.f.values()),x=Da.next();!x.done;x=Da.next())ea=x.value,ea.segmentIndex.offset(-p),_.lw(ea.segmentIndex,r);a.K={presentationTimeline:a.h,periods:[n],offlineSessionIds:[],minBufferTime:0};_.z(fa)})},wB=function(a,b){var c,d,e,f,g,h;return _.A(function(l){switch(l.a){case 1:c=aB(b,
12
- "EXT-X-MEDIA");d=aB(b,PA);e=aB(b,"EXT-X-IMAGE-STREAM-INF");for(var m=_.u(d),n=m.next();!n.done;n=m.next()){var p=n.value,q=_.Wg(p,"AUDIO");n=_.Wg(p,"VIDEO");var r=_.Wg(p,VA);p=zB(a,p);if(r){var w=_.Rg(_.Ae,p);a.o.set(r,w);r=p.indexOf(w);-1<r&&p.splice(r,1)}q&&(r=AB(_.ic,p),a.o.set(q,r));n&&(q=AB(_.Pe,p),a.o.set(n,q))}return _.y(l,BB(a,c),2);case 2:m=bB(c,FA);m=_.u(m);for(n=m.next();!n.done;n=m.next())p=n.value,n=CB(p),q=XA(p,SA),p=XA(p,"INSTREAM-ID"),a.O.get(q)||a.O.set(q,new Map),a.O.get(q).set(p,
13
- n);return _.y(l,DB(a,d),3);case 3:return f=l.f,_.y(l,EB(a,c),4);case 4:return g=l.f,_.y(l,FB(a,e),5);case 5:return h=l.f,l["return"]({startTime:0,variants:f,textStreams:g,thumbStreams:h})}})},EB=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,r;return _.A(function(w){if(1==w.a)return c=bB(b,VA),d=c.map(function(x){var C,D;return _.A(function(E){if(1==E.a)return _.xf(E,2),_.y(E,GB(a,x),4);if(2!=E.a)return C=E.f,E["return"](C.stream);D=_.zf(E);throw D;})}),_.y(w,Promise.all(d),2);e=w.f;f=_.u(c);for(g=f.next();!g.done;g=
14
- f.next())if(h=g.value,l=XA(h,SA),m=a.o.get(l))if(n=a.w.get(l))for(p=_.u(n),q=p.next();!q.done;q=p.next())r=q.value,r.stream.codecs=m;return w["return"](e.filter(function(x){return x}))})},FB=function(a,b){var c,d;return _.A(function(e){if(1==e.a)return c=b.map(function(f){var g;return _.A(function(h){if(1==h.a)return _.y(h,HB(a,f),2);g=h.f;return h["return"](g.stream)})}),_.y(e,Promise.all(c),2);d=e.f;return e["return"](d.filter(function(f){return f}))})},BB=function(a,b){var c;return _.A(function(d){if(1==
15
- d.a)return b=b.filter(function(e){var f=_.Wg(e,_.vb)||"";return _.Wg(e,"TYPE")!==VA&&""!==f}),b.length?_.y(d,GB(a,b[0]),2):d.H(2);c=b.slice(1).map(function(e){return GB(a,e)});return _.y(d,Promise.all(c),0)})},DB=function(a,b){var c,d,e,f,g,h,l,m,n,p;return _.A(function(q){if(1==q.a){c=function(r){var w,x,C,D,E,G,K;return _.A(function(O){return 1==O.a?(w=_.Wg(r,"FRAME-RATE"),x=Number(XA(r,_.na)),C=_.Wg(r,_.ib),D=_.u(C?C.split("x"):[null,null]),E=D.next().value,G=D.next().value,_.y(O,IB(a,r,C,w),2)):
16
- (K=O.f)?O["return"](JB(a,K.audio,K.video,x,E,G,w)):O["return"]([])})};d=0;e=Infinity;for(f=0;f<b.length;++f)g=Number(XA(b[f],_.na)),g<e&&(e=g,d=f);h=b.splice(d,1).pop();return _.y(q,c(h),2)}if(3!=q.a)return l=q.f,m=b.map(c),_.y(q,Promise.all(m),3);n=q.f;n.splice(d,0,l);p=n.reduce(_.vv,[]);return q["return"](p.filter(_.Dg))})},IB=function(a,b,c,d){var e,f,g,h,l,m,n,p,q,r,w,x,C,D;return _.A(function(E){if(1==E.a)return e=_.nn,f=zB(a,b),g=_.Wg(b,"AUDIO"),h=_.Wg(b,"VIDEO"),m=(l=g||h)&&a.w.has(l)?a.w.get(l):
17
- [],n={audio:g?m:[],video:h?m:[]},a.a.debug("Guessing stream type for",b.toString()),q=!1,r=XA(b,_.vb),w=n.audio.find(function(G){return G.Qd===r}),x=_.Rg(e.VIDEO,f),C=c||d||x,1!==f.length||C?!m.length&&1<f.length?(a.a.debug("Guessing multiplexed audio+video"),p=e.VIDEO,f=[f.join(",")]):n.audio.length&&w?(a.a.debug(TA),p=e.AUDIO,q=!0):n.video.length?(a.a.debug(TA),p=e.AUDIO):(a.a.debug("Guessing video-only"),p=e.VIDEO):(p=e.AUDIO,a.a.debug(TA)),q?E.H(2):_.y(E,KB(a,b,f,p),3);2!=E.a&&(D=E.f);if(D)n[D.stream.type]=
18
- [D];else if(null===D)return a.a.debug("streamInfo is null"),E["return"](null);LB(n);return E["return"](n)})},LB=function(a){a=_.u(a.audio.concat(a.video));for(var b=a.next();!b.done;b=a.next()){b=b.value;var c=b.stream.codecs.split(",");c=c.filter(function(d){return"mp4a.40.34"!=d});b.stream.codecs=c.join(",")}},JB=function(a,b,c,d,e,f,g){c.forEach(function(C){if(C=C.stream)C.width=Number(e)||void 0,C.height=Number(f)||void 0,C.frameRate=Number(g)||void 0});b.length||(b=[null]);c.length||(c=[null]);
19
- var h=[];b=_.u(b);for(var l=b.next();!l.done;l=b.next()){l=l.value;for(var m=_.u(c),n=m.next();!n.done;n=m.next()){var p=n.value;n=l?l.stream:null;var q=p?p.stream:null,r=l?l.drmInfos:null,w=p?p.drmInfos:null;p=(p?p.Qd:"")+" - "+(l?l.Qd:"");var x=void 0;if(n&&q)if(r.length&&w.length?0<_.Hv(r,w).length:1)x=_.Hv(r,w);else{a.a.warn("Incompatible DRM info in HLS variant. Skipping.");continue}else n?x=r:q&&(x=w);a.ia.has(p)?a.a.debug("Skipping variant which only differs in text streams."):(n=MB(a,n,q,
20
- d,x),h.push(n),a.ia.add(p))}}return h},MB=function(a,b,c,d,e){return{id:a.ua++,language:b?b.language:_.Ge,primary:!!b&&b.primary||!!c&&c.primary,audio:b,video:c,bandwidth:d,drmInfos:e,allowedByApplication:!0,allowedByKeySystem:!0}},GB=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,r,w;return _.A(function(x){if(1==x.a){c=XA(b,SA);d="";e=XA(b,"TYPE").toLowerCase();f=_.nn;e==_.iv&&(e=f.TEXT);e!==f.TEXT&&c&&a.o.has(c)&&(d=a.o.get(c));g=XA(b,_.vb);if(a.f.has(g))return x["return"](a.f.get(g));h=CB(b);l=_.Wg(b,
21
- "NAME");m=b.getAttribute("DEFAULT");n=b.getAttribute("AUTOSELECT");p=_.Wg(b,"CHANNELS");q=e==_.ic?p?parseInt(p.split("/")[0],10):null:null;r=!!m&&!!n;return _.y(x,NB(a,g,d,e,h,r,l,q,null),2)}w=x.f;if(null==w)return x["return"](null);a.w.has(c)?a.w.get(c).push(w):a.w.set(c,[w]);if(a.f.has(g))return x["return"](a.f.get(g));a.f.set(g,w);return x["return"](w)})},HB=function(a,b){var c,d,e,f,g,h;return _.A(function(l){if(1==l.a){c=XA(b,_.vb);if(a.f.has(c))return l["return"](a.f.get(c));d=_.Wg(b,_.pa)||
22
- "jpg";e=CB(b);f=_.Wg(b,"NAME");return _.y(l,NB(a,c,d,_.kd,e,!1,f,null,null),2)}g=l.f;if(null===g)return l["return"](null);if(a.f.has(c))return l["return"](a.f.get(c));if(h=_.Wg(b,_.na))g.stream.bandwidth=Number(h);a.f.set(c,g);return l["return"](g)})},zB=function(a,b){var c=_.Wg(b,_.pa,a.g.hlsDefaultCodecs||"avc1.42E01E,mp4a.40.2").split(/\s*,\s*/),d=new Set,e=[];c=_.u(c);for(var f=c.next();!f.done;f=c.next()){f=f.value;var g=_.Fv(f)[0];d.has(g)?a.a.debug("Ignoring duplicate codec"):(e.push(f),d.add(g))}return e},
23
- CB=function(a){a=_.Wg(a,"LANGUAGE")||_.Ge;return _.Fi(a)},KB=function(a,b,c,d){var e,f,g,h,l,m;return _.A(function(n){if(1==n.a){e=_.nn;f=XA(b,_.vb);if(a.f.has(f))return n["return"](a.f.get(f));g=_.Wg(b,FA);h=null;d==e.VIDEO&&g&&"NONE"!=g&&(h=a.O.get(g));l=AB(d,c);return _.y(n,NB(a,f,l,d,_.Ge,!1,null,null,h),2)}m=n.f;if(null==m)return n["return"](null);if(a.f.has(f))return n["return"](a.f.get(f));a.f.set(f,m);return n["return"](m)})},NB=function(a,b,c,d,e,f,g,h,l){var m,n,p,q,r,w,x,C,D,E,G,K,O,T,
24
- Da,ea,fa,xa,ha,qa,Ba,$a,La,ab,Eb,me,fh,Mi,gh,Zc;return _.A(function(qb){switch(qb.a){case 1:m=eB(a.B,b);p=null;if(a.m==oB&&a.I.has(m)){n=a.I.get(m);a.I["delete"](m);qb.H(2);break}return _.y(qb,rB(a,m),3);case 3:q=qb.f,m=q.uri,n=kB(a.S,q.data,m);case 2:if(1!=n.type)throw new _.L(_.M,4,4017);OB(a,n);return _.y(qb,PB(a,d,c,n),4);case 4:r=qb.f;w=[];n.a.forEach(function(Vf){Vf=aB(Vf.sa,"EXT-X-KEY");w.push.apply(w,Vf)});x=!1;C=[];D=null;E=_.u(w);for(G=E.next();!G.done;G=E.next())K=G.value,O=XA(K,"METHOD"),
25
- T=_.Wg(K,"KEYFORMAT","identity"),"NONE"!=O&&("AES-128"==O?(Da=_.Wg(K,"IV",""),ea=eB(a.B,XA(K,_.vb)),p={method:"AES-128",url:ea,iv:Da?_.dk((Da||"0x").slice(2)):null},a.J=!0):(x=!0,(xa=(fa=QB[T])?fa(K,r):null)?(xa.keyIds.length&&(D=xa.keyIds[0]),C.push(xa)):a.a.warn("Unsupported HLS KEYFORMAT",T)));if(x&&!C.length&&!a.J)throw new _.L(_.M,4,4026);ha=new Map;return _.y(qb,sB(a,b,n,d,r,c,p,ha),5);case 5:return qa=qb.f,Ba=qa[0].startTime,$a=qa[qa.length-1].endTime,La=$a-Ba,ab=new _.hw(qa),Eb=a.g.hlsLowLatency?
26
- _.dz:_.av,me=RB(n,p),fh=void 0,d==_.Ae&&(fh=_.we),gh=(Mi=cB(n.sa,OA))?"YES"===_.Wg(Mi,"CAN-BLOCK-RELOAD"):!1,Zc={id:a.ua++,originalId:g,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:ab.zc.bind(ab),getSegmentReference:ab.get.bind(ab),adjustSegmentDurations:ab.Oc.bind(ab),getDuration:ab.getDuration.bind(ab),segmentIndex:ab,segmentLookupStrategy:Eb,initSegmentReference:me,mimeType:r,codecs:c,kind:fh,encrypted:x,keyId:D,language:e,label:g,type:d,primary:f,trickModeVideo:null,emsgSchemeIdUris:null,
27
- frameRate:void 0,width:void 0,height:void 0,bandwidth:void 0,roles:[],channelsCount:h,closedCaptions:l,keyInfo:p},qb["return"]({stream:Zc,segmentIndex:ab,drmInfos:C,Qd:b,Bg:m,De:Ba,qk:$a,duration:La,Vh:ha,Hg:gh})}})},OB=function(a,b){var c=cB(b.sa,MA),d=cB(b.sa,JA);d=c&&"VOD"==c.value||d;c=c&&"EVENT"==c.value&&!d;c=!d&&!c;if(d)tB(a,oB);else{c?tB(a,SB):tB(a,TB);d=cB(b.sa,QA);if(!d)throw new _.L(_.M,4,4024,{missingTag:QA});d=Number(d.value);c=cB(b.sa,LA);a.g.hlsLowLatency&&c?(d=Number(XA(c,"PART-TARGET")),
28
- a.G=Math.min(d,a.G),a.D=Math.max(d,a.D),d=cB(b.sa,OA),a.$=d?Number(XA(d,"PART-HOLD-BACK")):0):(a.D=Math.max(d,a.D),a.G=Math.min(d,a.G),a.$=3*a.D)}},RB=function(a,b){var c=aB(a.sa,"EXT-X-MAP");if(!c.length)return null;if(1<c.length)throw new _.L(_.M,4,4020);var d=c[0];c=XA(d,_.vb);var e=eB(a.f,c);c=0;var f=null;if(d=_.Wg(d,"BYTERANGE"))c=d.split("@"),d=Number(c[0]),c=Number(c[1]),f=c+d-1;return new _.Tv(function(){return[e]},c,f,b)},VB=function(a,b,c,d,e,f,g){var h=[],l={};b=_.u(_.EA(b.f));for(var m=
29
- b.next();!m.done;l={Sd:l.Sd},m=b.next()){var n=m.value;m=n.Hd;n=n.item;var p=0==m?a:h[h.length-1],q=0==m?d:p.endTime,r=Number(_.Wg(n,"DURATION"));r=q+r;var w=_.Wg(n,"BYTERANGE");w=_.u(UB(p,w));p=w.next().value;w=w.next().value;var x=_.Wg(n,_.vb);x=eB(g,x);l.Sd=x?[x]:[];q=new _.Uv(c,q,r,function(C){return function(){return C.Sd}}(l),p,w,e,f,!1,null,null,null,null);if("YES"===_.Wg(n,"INDEPENDENT")||0===m)q.g=!0;h.push(q)}return h},WB=function(a,b,c,d,e,f,g,h,l){var m=c.sa,n=c.a,p=n?[n]:[];n=cB(m,RA);
30
- (g=g?Object.assign({},g):null)&&!g.iv&&(g.iv=_.gk(new Uint8Array(12),new Uint8Array([d>>24&255,d>>16&255,d>>8&255,d&255])));var q=null,r=null,w=null;h===_.kd&&(r=cB(m,"EXT-X-TILES"),q="1x1",r&&(q=_.Wg(r,"LAYOUT")||"1x1",w=(w=_.Wg(r,"DURATION"))?Number(w):null),r=_.u(q.split("x").map(function(x){return parseInt(x,10)})),q=r.next().value,r=r.next().value);if(0===c.f.length&&!n)throw new _.L(_.M,4,4024,{missingTag:RA});h=null;if(0<c.f.length)if(a.g.hlsLowLatency)h=VB(b,c,d,e,f,g,l);else return null;
31
- c=a=0;l=null;n?(a=e+Number(n.value.split(",")[0]),m=cB(m,GA),b=_.u(UB(b,m?m.value:null)),c=b.next().value,l=b.next().value):a=h[h.length-1].endTime;return new _.Uv(d,e,a,function(){return p},c,l,f,g,!1,null,q,r,w,h)},UB=function(a,b){var c=0,d=null;b&&(c=b.split("@"),d=Number(c[0]),c=c[1]?Number(c[1]):a.Ea+1,d=c+d-1);return[c,d]},xB=function(a){a.h&&(a.ca.forEach(function(b){_.Yv(a.h,b,0)}),a.ca=[])},sB=function(a,b,c,d,e,f,g,h){var l,m,n,p,q,r,w,x,C,D,E,G,K,O,T,Da,ea,fa,xa,ha,qa,Ba,$a;return _.A(function(La){switch(La.a){case 1:l=
32
- c.a;m=RB(c,g);n=dB(c.sa);if(null!==a.U){La.H(2);break}p=a;return _.y(La,XB(a,b,m,l[0],n,g,e,f,d),3);case 3:p.U=La.f;case 2:q=a.U;r=l[0].a;a.a.debug("First segment",r.split("/").pop(),"starts at",q);x=(w=cB(c.sa,IA))?Number(w.value):0;h.has(x)||h.set(x,n);if(!w)for(;h.has(x+1)&&h.get(x+1)<n;)x++;C=a.L.get(x)||0;D=[];E=function(ab){return _.EA(ab)};G=_.u(E(l));K=G.next();case 4:if(K.done){La.H(6);break}T=O=K.value;Da=T.Hd;ea=T.item;fa=D[D.length-1];xa=0==Da?q:fa.endTime;ha=n+Da;qa=cB(ea.sa,HA);if(!qa){La.H(7);
33
- break}x++;h.set(x,ha);return _.y(La,ZB(a,x,b,m,ea,ha,g,e,f,xa,d),8);case 8:C=La.f;case 7:Ba=WB(a,fa,ea,ha,xa,C,g,d,c.f);$a=cB(ea.sa,RA);Ba&&(a.g.hlsLowLatency||$a)&&D.push(Ba);K=G.next();La.H(4);break;case 6:return a.ca.push(D),xB(a),La["return"](D)}})},ZB=function(a,b,c,d,e,f,g,h,l,m,n){var p,q;return _.A(function(r){if(1==r.a)return p=0,a.L.has(b)?(p=a.L.get(b),r.H(2)):_.y(r,XB(a,c,d,e,f,g,h,l,n,!0),3);2!=r.a&&(q=r.f,p=q-m,a.a.debug("Discontinuity segment offset",p),a.L.set(b,p));return r["return"](p)})},
34
- vC=function(a,b){var c,d,e,f,g,h,l;return _.A(function(m){switch(m.a){case 1:return c=b.f(),d=_.Sv(b.Ha(),b.Pa,b.Pa+2048-1,a.g.attemptParameters),d.type=2,e=_.Sv(b.Ha(),b.Pa,b.Ea,a.g.attemptParameters),e.type=2,c&&(e.keyInfo=c),_.xf(m,2),f=a.J?e:d,_.y(m,$B(a,f),4);case 4:return g=m.f,m["return"](g);case 2:h=_.zf(m);if(7001==h.code||a.J)throw h;a.a.warn("Unable to fetch a partial HLS segment! Falling back to a full segment request, which is expensive! Your server should support Range requests and CORS preflights.",
35
- d.uris[0]);return _.y(m,$B(a,e),5);case 5:return l=m.f,m["return"](l)}})},XB=function(a,b,c,d,e,f,g,h,l,m){var n,p,q,r,w,x,C,D,E,G,K;return _.A(function(O){switch(O.a){case 1:n=WB(a,null,d,e,0,0,f,l,"");if(!n)return O["return"](0);if(a.K&&!m){p=a.f.get(b);q=p.segmentIndex;if(r=q.get(n.position))return a.a.debug("Found segment start time in previous manifest"),O["return"](r.startTime);a.a.debug("Unable to find segment start time in previous manifest!")}a.a.debug("Fetching segment to find start time");
36
- if("audio/mpeg"==g)return O["return"](0);if(g!=_.jc){O.H(2);break}return _.y(O,vC(a,n),3);case 3:return w=O.f,x=_.N(w.data),mB(x)?O["return"](wC(x)):O["return"](xC(a,w.data));case 2:if(g!=_.Re&&g!=_.nc){O.H(4);break}C=[vC(a,n)];c&&C.push(vC(a,c));return _.y(O,Promise.all(C),5);case 5:return D=O.f,E=D[0],G=D[1]||D[0],O["return"](yC(a,E.data,G.data));case 4:if(g!=_.Qe){O.H(6);break}return _.y(O,vC(a,n),7);case 7:return K=O.f,O["return"](xC(a,K.data));case 6:if(g===_.lc||g===_.kc||!MediaSource.isTypeSupported((g.split("/")[0]||
37
- "")+'/mp4;codecs\x3d"'+h+'"'))return O["return"](0);throw new _.L(_.M,4,4030);}})},yC=function(a,b,c){var d=0;(new _.Fk).M(_.Cd,_.Gk).M(_.Ee,_.Gk).M(_.xd,_.Gk).V("mdhd",function(g){g.F.skip(0==g.version?8:16);d=_.U(g.F);g.Wa.stop()}).parse(c,!0);if(!d)throw a.a.error("Unable to find timescale in init segment!"),new _.L(_.M,4,4030);var e=0,f=!1;(new _.Fk).M("moof",_.Gk).M("traf",_.Gk).V("tfdt",function(g){e=(0==g.version?_.U(g.F):_.Dk(g.F))/d;f=!0;g.Wa.stop()}).parse(b,!0);if(!f)throw new _.L(_.M,
38
- 4,4030);return e},xC=function(a,b){function c(){e.seek(f+188);g=_.zk(e);71!=g&&(e.seek(f+192),g=_.zk(e));71!=g&&(e.seek(f+204),g=_.zk(e));71!=g&&d();YA(e)}function d(){throw new _.L(_.M,4,4030);}var e=new _.wk(new DataView(b),!1),f=0,g=0;f=zC(e);0>f&&(a.a.error("Unable to find sync byte in TS after scanning"),d());for(;;){f=e.getPosition();g=_.zk(e);71!=g&&d();var h=_.Ak(e);if(8191===(h&8191))c();else if(h&16384)if(h=(_.zk(e)&48)>>4,0!=h&&2!=h||d(),3==h&&(h=_.zk(e),e.skip(h)),1!=_.U(e)>>8)c();else{e.skip(3);
39
- h=_.zk(e)>>6;0!=h&&1!=h||d();0==_.zk(e)&&d();h=_.zk(e);var l=_.Ak(e),m=_.Ak(e);return(1073741824*((h&14)>>1)+((l&65534)<<14|(m&65534)>>1))/9E4}else c()}},zC=function(a){for(;a.getPosition()<a.ya()-1;){var b=a.getPosition();if(71===_.zk(a))return YA(a),b}return-1},wC=function(a){function b(l,m,n){for(var p="";m<n;m++)p+="%"+("00"+l[m].toString(16)).slice(-2);return p}function c(l){return l[0]<<21|l[1]<<14|l[2]<<7|l[3]}function d(){throw new _.L(_.M,4,4030);}mB(a)||d();var e=10;a[5]&64&&(e=e+4+c(a.subarray(10,
40
- 14)));do{var f=c(a.subarray(e+4,e+8));1>f&&d();var g=String.fromCharCode(a[e],a[e+1],a[e+2],a[e+3]);if("PRIV"===g){g=a.subarray(e+10,e+f+10);for(var h=0;h<g.byteLength;h++)if(0===g[h]){if("com.apple.streaming.transportStreamTimestamp"===unescape(b(g,0,h)))return a=g.subarray(h+1),f=(a[3]&1)<<30|a[4]<<22|a[5]<<14|a[6]<<6|a[7]>>>2,f*=4,f+=a[7]&3,Math.round(f/9E4);break}}mB(a,e)||d();e+=10;e+=f}while(e<a.byteLength);return d()},AB=function(a,b){if(1==b.length)return b[0];var c=_.Rg(a,b);if(null!=c)return c;
41
- throw new _.L(_.M,4,4025,{codecList:b});},PB=function(a,b,c,d){var e,f,g,h,l,m,n,p,q;return _.A(function(r){if(1==r.a){e=_.nn;f=d.a[0].a;g=new _.Eg(f);h=g.na.split(".").pop();l=vB[b];if(m=l[h])return r["return"](m);if(b==e.TEXT)return c&&"vtt"!=c?r["return"](_.cc):r["return"](_.Be);n=_.Hh([f],a.g.attemptParameters);n.method="HEAD";n.type=2;return _.y(r,$B(a,n),2)}p=r.f;q=p.headers["content-type"];if(!q)throw new _.L(_.M,4,4021,h);return r["return"](q.split(";")[0])})},rB=function(a,b){var c=_.Hh([b],
42
- a.g.attemptParameters);c.type=1;return $B(a,c)},AC=function(a){var b=XA(a,"METHOD"),c=["SAMPLE-AES",UA];if(!c.includes(b))return _.Rf("PlayReady in HLS is only supported with [",c.join(", "),"], not",b),null;a=XA(a,_.vb);b=_.Qp(a);a=null;b=_.N(b.data);try{a=_.nv(_.Fl(b))}catch(d){a=b}return _.yv(_.Oc,[{initDataType:_.zc,initData:a}],"")},nB=function(a){var b,c,d;_.A(function(e){if(1==e.a){a.a.debug(_.Uu);if(!a.j)return e["return"]();_.xf(e,2);return _.y(e,a.update(),4)}if(2!=e.a)return b=a.da,a.A.Z(b),
43
- _.yf(e,0);c=_.zf(e);a.j&&(a.j.onError(c),d=c,1===d.severity&&a.A.Z(.1));_.z(e)})},tB=function(a,b){a.m=b;if(a.h){var c=a.h,d=a.m==oB;c.j=d;c.m=d}a.m!=oB||a.A.stop()},$B=function(a,b){if(!a.C)throw new _.L(_.M,7,7001);var c=a.j.networkingEngine.fetch(b);_.Rh(a.C,c);return c.P},BC=function(){},hB=[QA,KA,IA,MA,"EXT-X-MAP","EXT-X-I-FRAMES-ONLY",JA,OA,LA],iB=[RA,GA,HA,"EXT-X-PROGRAM-DATE-TIME","EXT-X-KEY","EXT-X-DATERANGE"],lB=["EXT-X-PART",NA];_.t=pB.prototype;_.t.configure=function(a){this.g=a};
44
- _.t.setCurrentVariant=function(a){var b=a.video?a.video.id:null;a=a.audio?a.audio.id:null;this.X.clear();for(var c=_.u(this.f.keys()),d=c.next();!d.done;d=c.next()){d=d.value;var e=this.f.get(d);!e.stream||e.stream.id!==b&&e.stream.id!==a||this.X.set(d,e)}};_.t.start=function(a,b){var c=this,d,e;return _.A(function(f){if(1==f.a)return c.j=b,_.y(f,rB(c,a),2);if(3!=f.a)return d=f.f,c.B=d.uri,_.y(f,yB(c,d.data),3);e=c.da;0<e&&c.A.Z(e);return f["return"](c.K)})};
45
- _.t.stop=function(){this.A&&(this.A.stop(),this.A=null);var a=[];this.C&&(a.push(this.C.destroy()),this.C=null);this.g=this.j=null;this.ia.clear();this.f.clear();this.I.clear();this.K=null;this.w.clear();this.o.clear();return Promise.all(a)};
46
- _.t.update=function(){var a=this,b,c,d,e,f;return _.A(function(g){if(1==g.a){if(a.m==oB)return g["return"]();b=[];a.U=null;c=Array.from(a.f.values());d=Array.from(a.X.values());e=a.g.hlsLowLatency&&0<d.length?d:c;return _.y(g,uB(a,e[0]),2)}for(f=1;f<e.length;f++)b.push(uB(a,e[f]));return _.y(g,Promise.all(b),0)})};_.t.onExpirationUpdated=function(){};
47
- var vB={audio:{mp4:_.nc,m4s:_.nc,m4i:_.nc,m4a:_.nc,cmfa:_.nc,ts:_.Qe,aac:_.jc,ec3:_.lc,ac3:_.kc},video:{mp4:_.Re,m4s:_.Re,m4i:_.Re,m4v:_.Re,cmfv:_.Re,ts:_.Qe},text:{mp4:_.cc,m4s:_.cc,m4i:_.cc,cmft:_.cc,vtt:_.Be,ttml:_.fc},image:{jpg:_.ld,jpeg:_.ld,png:"image/png",svg:"image/svg+xml",webp:"image/webp",avif:"image/avif"}},QB={"com.apple.streamingkeydelivery":function(a,b){if(b===_.Qe)throw new _.L(_.M,4,4041);return _.yv(_.Nc,[{initDataType:_.le,initData:new Uint8Array(0)}],"")},"com.microsoft.playready":AC,
48
- "urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":AC,"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":function(a){var b=XA(a,"METHOD"),c=["SAMPLE-AES",UA];if(!c.includes(b))return _.Rf("Widevine in HLS is only supported with [",c.join(", "),"], not",b),null;b=XA(a,_.vb);b=_.Qp(b);b=_.N(b.data);b=_.yv(_.Pc,[{initDataType:_.zc,initData:b}],"");if(a=_.Wg(a,"KEYID"))b.keyIds=[a.substr(2).toLowerCase()];return b}},oB="VOD",TB="EVENT",SB="LIVE",qB={VOD:oB,Xj:TB,LIVE:SB};_.v(BC,_.zo);BC.prototype.Ja=function(){_.wp.m3u8=pB;_.up[_.tj]=pB;_.up[WA]=pB};BC.prototype.Ca=function(){_.qw("m3u8");_.rw(_.tj);_.rw(WA)};BC.prototype.id=function(){return"hls"};_.B("clpp.hls.HlsComponent",BC);};
2
+ var f=function(window){var MA="CLOSED-CAPTIONS",NA="EXT-X-BYTERANGE",OA="EXT-X-DISCONTINUITY",PA="EXT-X-DISCONTINUITY-SEQUENCE",QA="EXT-X-ENDLIST",RA="EXT-X-MEDIA-SEQUENCE",SA="EXT-X-PART-INF",TA="EXT-X-PLAYLIST-TYPE",UA="EXT-X-PRELOAD-HINT",VA="EXT-X-SERVER-CONTROL",WA="EXT-X-STREAM-INF",XA="EXT-X-TARGETDURATION",YA="EXTINF",ZA="GROUP-ID",$A="Guessing audio-only",aB="SAMPLE-AES-CTR",bB="SUBTITLES",cB="application/vnd.apple.mpegurl",dB=function(a,b){var c=a.getAttribute(b);if(!c)throw new _.L(_.M,4,4023,b);return c.value},
3
+ eB=function(a){if(1>a.a)throw _.zk();--a.a},fB=function(a,b,c,d){this.f=a;this.type=b;this.ta=c;this.a=d||null},gB=function(a,b,c){c=void 0===c?[]:c;this.ta=b;this.a=a;this.f=c},hB=function(a,b){return a.filter(function(c){return c.name==b})},iB=function(a,b){return a.filter(function(c){return dB(c,"TYPE")===b})},jB=function(a,b){var c=hB(a,b);return c.length?c[0]:null},kB=function(a){var b=void 0===b?0:b;return(a=jB(a,RA))?Number(a.value):b},lB=function(a,b){return _.Bv([a],[b])[0]},mB=function(){this.a=
4
+ 0},rB=function(a,b,c){b=_.ph(b);b=b.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n").trim();var d=b.split(/\n+/m);if(!/^#EXTM3U($|[ \t\n])/m.test(d[0]))throw new _.L(_.M,4,4015);b=0;for(var e=!0,f=_.u(d),g=f.next();!g.done;g=f.next())if(g=g.value,g=g.trim(),!g.length||/^#(?!EXT)/m.test(g)||e)e=!1;else if(g=nB(a,g),--a.a,oB.includes(g.name)){b=1;break}else g.name==WA&&(e=!0);f=[];e=!0;g=_.u(_.LA(d));for(var h=g.next();!h.done;h=g.next()){var l=h.value;h=l.Kd;var m=l.item;l=l.next;m=m.trim();if(!m.length||/^#(?!EXT)/m.test(m)||
5
+ e)e=!1;else{m=nB(a,m);if(pB.includes(m.name)){if(1!=b)throw new _.L(_.M,4,4017);d=d.splice(h,d.length-h);a=qB(a,c,d,f);return new fB(c,b,f,a)}f.push(m);m.name==WA&&(m.attributes.push(new _.Yg(_.vb,l)),e=!0)}}return new fB(c,b,f)},qB=function(a,b,c,d){var e=[],f=[],g=[];c.forEach(function(h){/^(#EXT)/.test(h)?(h=nB(a,h),oB.includes(h.name)?d.push(h):sB.includes(h.name)?"EXT-X-PART"===h.name?g.push(h):h.name===UA&&"PART"===_.Xg(h,"TYPE")&&g.push(h):f.push(h)):/^#(?!EXT)/m.test(h)||(h=lB(b,h.trim()),
6
+ e.push(new gB(h,f,g)),f=[],g=[])});g.length&&e.push(new gB(null,f,g));return e},nB=function(a,b){return _.Dh(a.a++,b)},tB=function(a,b){b=void 0===b?0:b;return b+10<=a.length&&73===a[b]&&68===a[b+1]&&51===a[b+2]&&255>a[b+3]&&255>a[b+4]&&128>a[b+6]&&128>a[b+7]&&128>a[b+8]&&128>a[b+9]?!0:!1},vB=function(){var a=this;this.g=this.C=null;this.fa=1;this.$=0;this.o=new Map;this.da=new Set;this.f=new Map;this.h=null;this.A="";this.R=new mB;this.ba=0;this.V=new Map;this.w=new _.Ni(function(){a.Bb()});this.j=
7
+ uB;this.K=null;this.D=0;this.F=Infinity;this.B=new _.Rh;this.aa=[];this.N=new Map;this.J=!1;this.m=new Map;this.T=null;this.a=new _.H("clpp.hls.HlsParser");this.I=new Map;this.L=new Map},AB=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,r,w;return _.B(function(y){if(1==y.a){c=wB;d=b.Eg;e=new _.Fg(d);if(a.g.hlsLowLatency){f=e.a;if(b.Kg){var A=b.segmentIndex;if(A=A.a[A.a.length-1]){var E=A.a,F=E.length-1;A={Bi:A.position,vj:E&&0<E.length?F:null}}else A=null;g=A;h=g.Bi;l=g.vj;null!==h&&(f.add("_HLS_msn",h),
8
+ null!==l&&f.add("_HLS_part",l))}_.Qg(f);f.g&&_.Ig(e,f)}return _.x(y,xB(a,e.toString()),2)}if(3!=y.a){m=y.f;n=rB(a.R,m.data,m.uri);if(1!=n.type)throw new _.L(_.M,4,4017);p=b.stream;return _.x(y,yB(a,b.Sd,n,p.type,p.mimeType,p.codecs,p.keyInfo||null,b.Xh),3)}q=y.f;b.segmentIndex.replace(q);r=q[q.length-1];if(w=jB(n.ta,QA))zB(a,c.VOD),a.h.Tb(r.endTime);_.z(y)})},EB=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,r,w,y,A,E,F,D,I,O,T,Fa,fa;return _.B(function(ka){if(1==ka.a){c=rB(a.R,b,a.A);if(1===c.type){a.I.set(a.A,
9
+ c);d=c.a[0].a;e=_.on;f=new _.Fg(d);g=f.pa.split(".").pop();h=BB[e.AUDIO][g];l=BB[e.VIDEO][g];m="";l?m="avc1.42E01E":h&&(m="mp4a.40.2");var wa=a.R,Aa=a.A,la=a.g.hlsDefaultCodecs||m,qa=[],Ga=[];Ga.push(new _.Yg(_.na,"0"));Ga.push(new _.Yg(_.vb,Aa));la.length&&Ga.push(new _.Yg(_.pa,la));qa.push(new _.Wg(wa.a++,WA,Ga));c=new fB(Aa,0,qa)}return _.x(ka,CB(a,c.ta),2)}n=ka.f;if(!a.C)throw new _.L(_.M,7,7001);a.C.filterAllPeriods([n]);p=Infinity;q=0;r=Infinity;w=_.u(a.f.values());for(y=w.next();!y.done;y=
10
+ w.next())A=y.value,p=Math.min(p,A.Fe),q=Math.max(q,A.Fe),A.stream.type!=_.Be&&(r=Math.min(r,A.duration));a.j!=uB?(a.h=new _.Zv(0,a.$,!1),_.cw(a.h,1)):a.h=new _.Zv(null,0,!0);DB(a);if(a.j!=uB){a.ba=a.F;E=wB;a.j===E.LIVE&&(F=a.h.Re,D=Math.max(r,F),isNaN(a.g.availabilityWindowOverride)||(D=a.g.availabilityWindowOverride),a.h.ic=D);for(I=0;95443.7176888889<=q;)I+=95443.7176888889,q-=95443.7176888889;if(I)for(a.a.debug("Offsetting live streams by",I,"to compensate for rollover"),O=_.u(a.f.values()),y=
11
+ O.next();!y.done;y=O.next())T=y.value,95443.7176888889>T.Fe?(a.a.debug("Offset applied to",T.stream.type),T.segmentIndex.offset(I)):a.a.debug("Offset NOT applied to",T.stream.type)}else for(a.h.Tb(r),a.h.offset(-p),Fa=_.u(a.f.values()),y=Fa.next();!y.done;y=Fa.next())fa=y.value,fa.segmentIndex.offset(-p),_.pw(fa.segmentIndex,r);a.K={presentationTimeline:a.h,periods:[n],offlineSessionIds:[],minBufferTime:0};_.z(ka)})},CB=function(a,b){var c,d,e,f,g,h;return _.B(function(l){switch(l.a){case 1:c=hB(b,
12
+ "EXT-X-MEDIA");d=hB(b,WA);e=hB(b,"EXT-X-IMAGE-STREAM-INF");for(var m=_.u(d),n=m.next();!n.done;n=m.next()){var p=n.value,q=_.Xg(p,"AUDIO");n=_.Xg(p,"VIDEO");var r=_.Xg(p,bB);p=FB(a,p);if(r){var w=_.Sg(_.Be,p);a.m.set(r,w);r=p.indexOf(w);-1<r&&p.splice(r,1)}q&&(r=GB(_.ic,p),a.m.set(q,r));n&&(q=GB(_.Qe,p),a.m.set(n,q))}return _.x(l,HB(a,c),2);case 2:m=iB(c,MA);m=_.u(m);for(n=m.next();!n.done;n=m.next())p=n.value,n=IB(p),q=dB(p,ZA),p=dB(p,"INSTREAM-ID"),a.N.get(q)||a.N.set(q,new Map),a.N.get(q).set(p,
13
+ n);return _.x(l,JB(a,d),3);case 3:return f=l.f,_.x(l,KB(a,c),4);case 4:return g=l.f,_.x(l,LB(a,e),5);case 5:return h=l.f,l["return"]({startTime:0,variants:f,textStreams:g,thumbStreams:h})}})},KB=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,r;return _.B(function(w){if(1==w.a)return c=iB(b,bB),d=c.map(function(y){var A,E;return _.B(function(F){if(1==F.a)return _.yf(F,2),_.x(F,MB(a,y),4);if(2!=F.a)return A=F.f,F["return"](A.stream);E=_.Af(F);throw E;})}),_.x(w,Promise.all(d),2);e=w.f;f=_.u(c);for(g=f.next();!g.done;g=
14
+ f.next())if(h=g.value,l=dB(h,ZA),m=a.m.get(l))if(n=a.o.get(l))for(p=_.u(n),q=p.next();!q.done;q=p.next())r=q.value,r.stream.codecs=m;return w["return"](e.filter(function(y){return y}))})},LB=function(a,b){var c,d;return _.B(function(e){if(1==e.a)return c=b.map(function(f){var g;return _.B(function(h){if(1==h.a)return _.x(h,NB(a,f),2);g=h.f;return h["return"](g.stream)})}),_.x(e,Promise.all(c),2);d=e.f;return e["return"](d.filter(function(f){return f}))})},HB=function(a,b){var c;return _.B(function(d){if(1==
15
+ d.a)return b=b.filter(function(e){var f=_.Xg(e,_.vb)||"";return _.Xg(e,"TYPE")!==bB&&""!==f}),b.length?_.x(d,MB(a,b[0]),2):d.H(2);c=b.slice(1).map(function(e){return MB(a,e)});return _.x(d,Promise.all(c),0)})},JB=function(a,b){var c,d,e,f,g,h,l,m,n,p;return _.B(function(q){if(1==q.a){c=function(r){var w,y,A,E,F,D,I;return _.B(function(O){return 1==O.a?(w=_.Xg(r,"FRAME-RATE"),y=Number(dB(r,_.na)),A=_.Xg(r,_.ib),E=_.u(A?A.split("x"):[null,null]),F=E.next().value,D=E.next().value,_.x(O,OB(a,r,A,w),2)):
16
+ (I=O.f)?O["return"](PB(a,I.audio,I.video,y,F,D,w)):O["return"]([])})};d=0;e=Infinity;for(f=0;f<b.length;++f)g=Number(dB(b[f],_.na)),g<e&&(e=g,d=f);h=b.splice(d,1).pop();return _.x(q,c(h),2)}if(3!=q.a)return l=q.f,m=b.map(c),_.x(q,Promise.all(m),3);n=q.f;n.splice(d,0,l);p=n.reduce(_.zv,[]);return q["return"](p.filter(_.Eg))})},OB=function(a,b,c,d){var e,f,g,h,l,m,n,p,q,r,w,y,A,E;return _.B(function(F){if(1==F.a)return e=_.on,f=FB(a,b),g=_.Xg(b,"AUDIO"),h=_.Xg(b,"VIDEO"),m=(l=g||h)&&a.o.has(l)?a.o.get(l):
17
+ [],n={audio:g?m:[],video:h?m:[]},a.a.debug("Guessing stream type for",b.toString()),q=!1,r=dB(b,_.vb),w=n.audio.find(function(D){return D.Sd===r}),y=_.Sg(e.VIDEO,f),A=c||d||y,1!==f.length||A?!m.length&&1<f.length?(a.a.debug("Guessing multiplexed audio+video"),p=e.VIDEO,f=[f.join(",")]):n.audio.length&&w?(a.a.debug($A),p=e.AUDIO,q=!0):n.video.length?(a.a.debug($A),p=e.AUDIO):(a.a.debug("Guessing video-only"),p=e.VIDEO):(p=e.AUDIO,a.a.debug($A)),q?F.H(2):_.x(F,QB(a,b,f,p),3);2!=F.a&&(E=F.f);if(E)n[E.stream.type]=
18
+ [E];else if(null===E)return a.a.debug("streamInfo is null"),F["return"](null);RB(n);return F["return"](n)})},RB=function(a){a=_.u(a.audio.concat(a.video));for(var b=a.next();!b.done;b=a.next()){b=b.value;var c=b.stream.codecs.split(",");c=c.filter(function(d){return"mp4a.40.34"!=d});b.stream.codecs=c.join(",")}},PB=function(a,b,c,d,e,f,g){c.forEach(function(A){if(A=A.stream)A.width=Number(e)||void 0,A.height=Number(f)||void 0,A.frameRate=Number(g)||void 0});b.length||(b=[null]);c.length||(c=[null]);
19
+ var h=[];b=_.u(b);for(var l=b.next();!l.done;l=b.next()){l=l.value;for(var m=_.u(c),n=m.next();!n.done;n=m.next()){var p=n.value;n=l?l.stream:null;var q=p?p.stream:null,r=l?l.drmInfos:null,w=p?p.drmInfos:null;p=(p?p.Sd:"")+" - "+(l?l.Sd:"");var y=void 0;if(n&&q)if(r.length&&w.length?0<_.Lv(r,w).length:1)y=_.Lv(r,w);else{a.a.warn("Incompatible DRM info in HLS variant. Skipping.");continue}else n?y=r:q&&(y=w);a.da.has(p)?a.a.debug("Skipping variant which only differs in text streams."):(n=SB(a,n,q,
20
+ d,y),h.push(n),a.da.add(p))}}return h},SB=function(a,b,c,d,e){return{id:a.fa++,language:b?b.language:_.He,primary:!!b&&b.primary||!!c&&c.primary,audio:b,video:c,bandwidth:d,drmInfos:e,allowedByApplication:!0,allowedByKeySystem:!0}},MB=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,r,w;return _.B(function(y){if(1==y.a){c=dB(b,ZA);d="";e=dB(b,"TYPE").toLowerCase();f=_.on;e==_.mv&&(e=f.TEXT);e!==f.TEXT&&c&&a.m.has(c)&&(d=a.m.get(c));g=dB(b,_.vb);if(a.f.has(g))return y["return"](a.f.get(g));h=IB(b);l=_.Xg(b,
21
+ "NAME");m=b.getAttribute("DEFAULT");n=b.getAttribute("AUTOSELECT");p=_.Xg(b,"CHANNELS");q=e==_.ic?p?parseInt(p.split("/")[0],10):null:null;r=!!m&&!!n;return _.x(y,TB(a,g,d,e,h,r,l,q,null),2)}w=y.f;if(null==w)return y["return"](null);a.o.has(c)?a.o.get(c).push(w):a.o.set(c,[w]);if(a.f.has(g))return y["return"](a.f.get(g));a.f.set(g,w);return y["return"](w)})},NB=function(a,b){var c,d,e,f,g,h;return _.B(function(l){if(1==l.a){c=dB(b,_.vb);if(a.f.has(c))return l["return"](a.f.get(c));d=_.Xg(b,_.pa)||
22
+ "jpg";e=IB(b);f=_.Xg(b,"NAME");return _.x(l,TB(a,c,d,_.ld,e,!1,f,null,null),2)}g=l.f;if(null===g)return l["return"](null);if(a.f.has(c))return l["return"](a.f.get(c));if(h=_.Xg(b,_.na))g.stream.bandwidth=Number(h);a.f.set(c,g);return l["return"](g)})},FB=function(a,b){var c=_.Xg(b,_.pa,a.g.hlsDefaultCodecs||"avc1.42E01E,mp4a.40.2").split(/\s*,\s*/),d=new Set,e=[];c=_.u(c);for(var f=c.next();!f.done;f=c.next()){f=f.value;var g=_.Jv(f)[0];d.has(g)?a.a.debug("Ignoring duplicate codec"):(e.push(f),d.add(g))}return e},
23
+ IB=function(a){a=_.Xg(a,"LANGUAGE")||_.He;return _.Gi(a)},QB=function(a,b,c,d){var e,f,g,h,l,m;return _.B(function(n){if(1==n.a){e=_.on;f=dB(b,_.vb);if(a.f.has(f))return n["return"](a.f.get(f));g=_.Xg(b,MA);h=null;d==e.VIDEO&&g&&"NONE"!=g&&(h=a.N.get(g));l=GB(d,c);return _.x(n,TB(a,f,l,d,_.He,!1,null,null,h),2)}m=n.f;if(null==m)return n["return"](null);if(a.f.has(f))return n["return"](a.f.get(f));a.f.set(f,m);return n["return"](m)})},TB=function(a,b,c,d,e,f,g,h,l){var m,n,p,q,r,w,y,A,E,F,D,I,O,T,
24
+ Fa,fa,ka,wa,Aa,la,qa,Ga,Ma,ab,Eb,me,eh,Li,fh,$c;return _.B(function(rb){switch(rb.a){case 1:m=lB(a.A,b);p=null;if(a.j==uB&&a.I.has(m)){n=a.I.get(m);a.I["delete"](m);rb.H(2);break}return _.x(rb,xB(a,m),3);case 3:q=rb.f,m=q.uri,n=rB(a.R,q.data,m);case 2:if(1!=n.type)throw new _.L(_.M,4,4017);UB(a,n);return _.x(rb,VB(a,d,c,n),4);case 4:r=rb.f;w=[];n.a.forEach(function(Vf){Vf=hB(Vf.ta,"EXT-X-KEY");w.push.apply(w,Vf)});y=!1;A=[];E=null;F=_.u(w);for(D=F.next();!D.done;D=F.next())I=D.value,O=dB(I,"METHOD"),
25
+ T=_.Xg(I,"KEYFORMAT","identity"),"NONE"!=O&&("AES-128"==O?(Fa=_.Xg(I,"IV",""),fa=lB(a.A,dB(I,_.vb)),p={method:"AES-128",url:fa,iv:Fa?_.ek((Fa||"0x").slice(2)):null},a.J=!0):(y=!0,(wa=(ka=WB[T])?ka(I,r):null)?(wa.keyIds.length&&(E=wa.keyIds[0]),A.push(wa)):a.a.warn("Unsupported HLS KEYFORMAT",T)));if(y&&!A.length&&!a.J)throw new _.L(_.M,4,4026);Aa=new Map;return _.x(rb,yB(a,b,n,d,r,c,p,Aa),5);case 5:return la=rb.f,qa=la[0].startTime,Ga=la[la.length-1].endTime,Ma=Ga-qa,ab=new _.lw(la),Eb=a.g.hlsLowLatency?
26
+ _.hz:_.ev,me=XB(n,p),eh=void 0,d==_.Be&&(eh=_.xe),fh=(Li=jB(n.ta,VA))?"YES"===_.Xg(Li,"CAN-BLOCK-RELOAD"):!1,$c={id:a.fa++,originalId:g,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:ab.Bc.bind(ab),getSegmentReference:ab.get.bind(ab),adjustSegmentDurations:ab.Qc.bind(ab),getDuration:ab.getDuration.bind(ab),segmentIndex:ab,segmentLookupStrategy:Eb,initSegmentReference:me,mimeType:r,codecs:c,kind:eh,encrypted:y,keyId:E,language:e,label:g,type:d,primary:f,trickModeVideo:null,emsgSchemeIdUris:null,
27
+ frameRate:void 0,width:void 0,height:void 0,bandwidth:void 0,roles:[],channelsCount:h,closedCaptions:l,keyInfo:p},rb["return"]({stream:$c,segmentIndex:ab,drmInfos:A,Sd:b,Eg:m,Fe:qa,tk:Ga,duration:Ma,Xh:Aa,Kg:fh})}})},UB=function(a,b){var c=jB(b.ta,TA),d=jB(b.ta,QA);d=c&&"VOD"==c.value||d;c=c&&"EVENT"==c.value&&!d;c=!d&&!c;if(d)zB(a,uB);else{c?zB(a,YB):zB(a,ZB);d=jB(b.ta,XA);if(!d)throw new _.L(_.M,4,4024,{missingTag:XA});d=Number(d.value);c=jB(b.ta,SA);a.g.hlsLowLatency&&c?(d=Number(dB(c,"PART-TARGET")),
28
+ a.F=Math.min(d,a.F),a.D=Math.max(d,a.D),d=jB(b.ta,VA),a.$=d?Number(dB(d,"PART-HOLD-BACK")):0):(a.D=Math.max(d,a.D),a.F=Math.min(d,a.F),a.$=3*a.D)}},XB=function(a,b){var c=hB(a.ta,"EXT-X-MAP");if(!c.length)return null;if(1<c.length)throw new _.L(_.M,4,4020);var d=c[0];c=dB(d,_.vb);var e=lB(a.f,c);c=0;var f=null;if(d=_.Xg(d,"BYTERANGE"))c=d.split("@"),d=Number(c[0]),c=Number(c[1]),f=c+d-1;return new _.Xv(function(){return[e]},c,f,b)},bC=function(a,b,c,d,e,f,g){var h=[],l={};b=_.u(_.LA(b.f));for(var m=
29
+ b.next();!m.done;l={Ud:l.Ud},m=b.next()){var n=m.value;m=n.Kd;n=n.item;var p=0==m?a:h[h.length-1],q=0==m?d:p.endTime,r=Number(_.Xg(n,"DURATION"));r=q+r;var w=_.Xg(n,"BYTERANGE");w=_.u(aC(p,w));p=w.next().value;w=w.next().value;var y=_.Xg(n,_.vb);y=lB(g,y);l.Ud=y?[y]:[];q=new _.Yv(c,q,r,function(A){return function(){return A.Ud}}(l),p,w,e,f,!1,null,null,null,null);if("YES"===_.Xg(n,"INDEPENDENT")||0===m)q.g=!0;h.push(q)}return h},xC=function(a,b,c,d,e,f,g,h,l){var m=c.ta,n=c.a,p=n?[n]:[];n=jB(m,YA);
30
+ (g=g?Object.assign({},g):null)&&!g.iv&&(g.iv=_.hk(new Uint8Array(12),new Uint8Array([d>>24&255,d>>16&255,d>>8&255,d&255])));var q=null,r=null,w=null;h===_.ld&&(r=jB(m,"EXT-X-TILES"),q="1x1",r&&(q=_.Xg(r,"LAYOUT")||"1x1",w=(w=_.Xg(r,"DURATION"))?Number(w):null),r=_.u(q.split("x").map(function(y){return parseInt(y,10)})),q=r.next().value,r=r.next().value);if(0===c.f.length&&!n)throw new _.L(_.M,4,4024,{missingTag:YA});h=null;if(0<c.f.length)if(a.g.hlsLowLatency)h=bC(b,c,d,e,f,g,l);else return null;
31
+ c=a=0;l=null;n?(a=e+Number(n.value.split(",")[0]),m=jB(m,NA),b=_.u(aC(b,m?m.value:null)),c=b.next().value,l=b.next().value):a=h[h.length-1].endTime;return new _.Yv(d,e,a,function(){return p},c,l,f,g,!1,null,q,r,w,h)},aC=function(a,b){var c=0,d=null;b&&(c=b.split("@"),d=Number(c[0]),c=c[1]?Number(c[1]):a.Ea+1,d=c+d-1);return[c,d]},DB=function(a){a.h&&(a.aa.forEach(function(b){_.bw(a.h,b,0)}),a.aa=[])},yB=function(a,b,c,d,e,f,g,h){var l,m,n,p,q,r,w,y,A,E,F,D,I,O,T,Fa,fa,ka,wa,Aa,la,qa,Ga;return _.B(function(Ma){switch(Ma.a){case 1:l=
32
+ c.a;m=XB(c,g);n=kB(c.ta);if(null!==a.T){Ma.H(2);break}p=a;return _.x(Ma,yC(a,b,m,l[0],n,g,e,f,d),3);case 3:p.T=Ma.f;case 2:q=a.T;r=l[0].a;a.a.debug("First segment",r.split("/").pop(),"starts at",q);y=(w=jB(c.ta,PA))?Number(w.value):0;h.has(y)||h.set(y,n);if(!w)for(;h.has(y+1)&&h.get(y+1)<n;)y++;A=a.L.get(y)||0;E=[];F=function(ab){return _.LA(ab)};D=_.u(F(l));I=D.next();case 4:if(I.done){Ma.H(6);break}T=O=I.value;Fa=T.Kd;fa=T.item;ka=E[E.length-1];wa=0==Fa?q:ka.endTime;Aa=n+Fa;la=jB(fa.ta,OA);if(!la){Ma.H(7);
33
+ break}y++;h.set(y,Aa);return _.x(Ma,zC(a,y,b,m,fa,Aa,g,e,f,wa,d),8);case 8:A=Ma.f;case 7:qa=xC(a,ka,fa,Aa,wa,A,g,d,c.f);Ga=jB(fa.ta,YA);qa&&(a.g.hlsLowLatency||Ga)&&E.push(qa);I=D.next();Ma.H(4);break;case 6:return a.aa.push(E),DB(a),Ma["return"](E)}})},zC=function(a,b,c,d,e,f,g,h,l,m,n){var p,q;return _.B(function(r){if(1==r.a)return p=0,a.L.has(b)?(p=a.L.get(b),r.H(2)):_.x(r,yC(a,c,d,e,f,g,h,l,n,!0),3);2!=r.a&&(q=r.f,p=q-m,a.a.debug("Discontinuity segment offset",p),a.L.set(b,p));return r["return"](p)})},
34
+ BC=function(a,b){var c,d,e,f,g,h,l;return _.B(function(m){switch(m.a){case 1:return c=b.f(),d=_.Wv(b.Ha(),b.Qa,b.Qa+2048-1,a.g.attemptParameters),d.type=2,e=_.Wv(b.Ha(),b.Qa,b.Ea,a.g.attemptParameters),e.type=2,c&&(e.keyInfo=c),_.yf(m,2),f=a.J?e:d,_.x(m,AC(a,f),4);case 4:return g=m.f,m["return"](g);case 2:h=_.Af(m);if(7001==h.code||a.J)throw h;a.a.warn("Unable to fetch a partial HLS segment! Falling back to a full segment request, which is expensive! Your server should support Range requests and CORS preflights.",
35
+ d.uris[0]);return _.x(m,AC(a,e),5);case 5:return l=m.f,m["return"](l)}})},yC=function(a,b,c,d,e,f,g,h,l,m){var n,p,q,r,w,y,A,E,F,D,I;return _.B(function(O){switch(O.a){case 1:n=xC(a,null,d,e,0,0,f,l,"");if(!n)return O["return"](0);if(a.K&&!m){p=a.f.get(b);q=p.segmentIndex;if(r=q.get(n.position))return a.a.debug("Found segment start time in previous manifest"),O["return"](r.startTime);a.a.debug("Unable to find segment start time in previous manifest!")}a.a.debug("Fetching segment to find start time");
36
+ if("audio/mpeg"==g)return O["return"](0);if(g!=_.jc){O.H(2);break}return _.x(O,BC(a,n),3);case 3:return w=O.f,y=_.N(w.data),tB(y)?O["return"](CC(y)):O["return"](DC(a,w.data));case 2:if(g!=_.Se&&g!=_.nc){O.H(4);break}A=[BC(a,n)];c&&A.push(BC(a,c));return _.x(O,Promise.all(A),5);case 5:return E=O.f,F=E[0],D=E[1]||E[0],O["return"](EC(a,F.data,D.data));case 4:if(g!=_.Re){O.H(6);break}return _.x(O,BC(a,n),7);case 7:return I=O.f,O["return"](DC(a,I.data));case 6:if(g===_.lc||g===_.kc||!MediaSource.isTypeSupported((g.split("/")[0]||
37
+ "")+'/mp4;codecs\x3d"'+h+'"'))return O["return"](0);throw new _.L(_.M,4,4030);}})},EC=function(a,b,c){var d=0;(new _.Gk).M(_.Dd,_.Hk).M(_.Fe,_.Hk).M(_.yd,_.Hk).W("mdhd",function(g){g.G.skip(0==g.version?8:16);d=_.U(g.G);g.Xa.stop()}).parse(c,!0);if(!d)throw a.a.error("Unable to find timescale in init segment!"),new _.L(_.M,4,4030);var e=0,f=!1;(new _.Gk).M("moof",_.Hk).M("traf",_.Hk).W("tfdt",function(g){e=(0==g.version?_.U(g.G):_.Ek(g.G))/d;f=!0;g.Xa.stop()}).parse(b,!0);if(!f)throw new _.L(_.M,
38
+ 4,4030);return e},DC=function(a,b){function c(){e.seek(f+188);g=_.Ak(e);71!=g&&(e.seek(f+192),g=_.Ak(e));71!=g&&(e.seek(f+204),g=_.Ak(e));71!=g&&d();eB(e)}function d(){throw new _.L(_.M,4,4030);}var e=new _.xk(new DataView(b),!1),f=0,g=0;f=FC(e);0>f&&(a.a.error("Unable to find sync byte in TS after scanning"),d());for(;;){f=e.getPosition();g=_.Ak(e);71!=g&&d();var h=_.Bk(e);if(8191===(h&8191))c();else if(h&16384)if(h=(_.Ak(e)&48)>>4,0!=h&&2!=h||d(),3==h&&(h=_.Ak(e),e.skip(h)),1!=_.U(e)>>8)c();else{e.skip(3);
39
+ h=_.Ak(e)>>6;0!=h&&1!=h||d();0==_.Ak(e)&&d();h=_.Ak(e);var l=_.Bk(e),m=_.Bk(e);return(1073741824*((h&14)>>1)+((l&65534)<<14|(m&65534)>>1))/9E4}else c()}},FC=function(a){for(;a.getPosition()<a.ya()-1;){var b=a.getPosition();if(71===_.Ak(a))return eB(a),b}return-1},CC=function(a){function b(l,m,n){for(var p="";m<n;m++)p+="%"+("00"+l[m].toString(16)).slice(-2);return p}function c(l){return l[0]<<21|l[1]<<14|l[2]<<7|l[3]}function d(){throw new _.L(_.M,4,4030);}tB(a)||d();var e=10;a[5]&64&&(e=e+4+c(a.subarray(10,
40
+ 14)));do{var f=c(a.subarray(e+4,e+8));1>f&&d();var g=String.fromCharCode(a[e],a[e+1],a[e+2],a[e+3]);if("PRIV"===g){g=a.subarray(e+10,e+f+10);for(var h=0;h<g.byteLength;h++)if(0===g[h]){if("com.apple.streaming.transportStreamTimestamp"===unescape(b(g,0,h)))return a=g.subarray(h+1),f=(a[3]&1)<<30|a[4]<<22|a[5]<<14|a[6]<<6|a[7]>>>2,f*=4,f+=a[7]&3,Math.round(f/9E4);break}}tB(a,e)||d();e+=10;e+=f}while(e<a.byteLength);return d()},GB=function(a,b){if(1==b.length)return b[0];var c=_.Sg(a,b);if(null!=c)return c;
41
+ throw new _.L(_.M,4,4025,{codecList:b});},VB=function(a,b,c,d){var e,f,g,h,l,m,n,p,q;return _.B(function(r){if(1==r.a){e=_.on;f=d.a[0].a;g=new _.Fg(f);h=g.pa.split(".").pop();l=BB[b];if(m=l[h])return r["return"](m);if(b==e.TEXT)return c&&"vtt"!=c?r["return"](_.cc):r["return"](_.Ce);n=_.Ih([f],a.g.attemptParameters);n.method="HEAD";n.type=2;return _.x(r,AC(a,n),2)}p=r.f;q=p.headers["content-type"];if(!q)throw new _.L(_.M,4,4021,h);return r["return"](q.split(";")[0])})},xB=function(a,b){var c=_.Ih([b],
42
+ a.g.attemptParameters);c.type=1;return AC(a,c)},GC=function(a){var b=dB(a,"METHOD"),c=["SAMPLE-AES",aB];if(!c.includes(b))return _.Sf("PlayReady in HLS is only supported with [",c.join(", "),"], not",b),null;a=dB(a,_.vb);b=_.Sp(a);a=null;b=_.N(b.data);try{a=_.rv(_.Gl(b))}catch(d){a=b}return _.Cv(_.Pc,[{initDataType:_.zc,initData:a}],"")},zB=function(a,b){a.j=b;if(a.h){var c=a.h,d=a.j==uB;c.j=d;c.m=d}a.j!=uB||a.w.stop()},AC=function(a,b){if(!a.B)throw new _.L(_.M,7,7001);var c=a.C.networkingEngine.fetch(b);
43
+ _.Sh(a.B,c);return c.P},HC=function(){},oB=[XA,RA,PA,TA,"EXT-X-MAP","EXT-X-I-FRAMES-ONLY",QA,VA,SA],pB=[YA,NA,OA,"EXT-X-PROGRAM-DATE-TIME","EXT-X-KEY","EXT-X-DATERANGE"],sB=["EXT-X-PART",UA];_.t=vB.prototype;_.t.configure=function(a){this.g=a};_.t.setCurrentVariant=function(a){var b=a.video?a.video.id:null;a=a.audio?a.audio.id:null;this.V.clear();for(var c=_.u(this.f.keys()),d=c.next();!d.done;d=c.next()){d=d.value;var e=this.f.get(d);!e.stream||e.stream.id!==b&&e.stream.id!==a||this.V.set(d,e)}};
44
+ _.t.start=function(a,b){var c=this,d,e;return _.B(function(f){if(1==f.a)return c.C=b,_.x(f,xB(c,a),2);if(3!=f.a)return d=f.f,c.A=d.uri,_.x(f,EB(c,d.data),3);e=c.ba;0<e&&c.w.Z(e);return f["return"](c.K)})};_.t.stop=function(){this.w&&(this.w.stop(),this.w=null);var a=[];this.B&&(a.push(this.B.destroy()),this.B=null);this.g=this.C=null;this.da.clear();this.f.clear();this.I.clear();this.K=null;this.o.clear();this.m.clear();return Promise.all(a)};
45
+ _.t.update=function(){var a=this,b,c,d,e,f;return _.B(function(g){if(1==g.a){if(a.j==uB)return g["return"]();b=[];a.T=null;c=Array.from(a.f.values());d=Array.from(a.V.values());e=a.g.hlsLowLatency&&0<d.length?d:c;return _.x(g,AB(a,e[0]),2)}for(f=1;f<e.length;f++)b.push(AB(a,e[f]));return _.x(g,Promise.all(b),0)})};_.t.onExpirationUpdated=function(){};
46
+ _.t.Bb=function(){var a=this,b,c,d;return _.B(function(e){if(1==e.a){a.a.debug(_.Yu);if(!a.C)return e["return"]();_.yf(e,2);return _.x(e,a.update(),4)}if(2!=e.a)return b=a.ba,a.w.Z(b),_.zf(e,0);c=_.Af(e);a.C&&(a.C.onError(c),d=c,1===d.severity&&a.w.Z(.1));_.z(e)})};
47
+ var BB={audio:{mp4:_.nc,m4s:_.nc,m4i:_.nc,m4a:_.nc,cmfa:_.nc,ts:_.Re,aac:_.jc,ec3:_.lc,ac3:_.kc},video:{mp4:_.Se,m4s:_.Se,m4i:_.Se,m4v:_.Se,cmfv:_.Se,ts:_.Re},text:{mp4:_.cc,m4s:_.cc,m4i:_.cc,cmft:_.cc,vtt:_.Ce,ttml:_.fc},image:{jpg:_.md,jpeg:_.md,png:"image/png",svg:"image/svg+xml",webp:"image/webp",avif:"image/avif"}},WB={"com.apple.streamingkeydelivery":function(a,b){if(b===_.Re)throw new _.L(_.M,4,4041);return _.Cv(_.Oc,[{initDataType:_.ne,initData:new Uint8Array(0)}],"")},"com.microsoft.playready":GC,
48
+ "urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":GC,"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":function(a){var b=dB(a,"METHOD"),c=["SAMPLE-AES",aB];if(!c.includes(b))return _.Sf("Widevine in HLS is only supported with [",c.join(", "),"], not",b),null;b=dB(a,_.vb);b=_.Sp(b);b=_.N(b.data);b=_.Cv(_.Qc,[{initDataType:_.zc,initData:b}],"");if(a=_.Xg(a,"KEYID"))b.keyIds=[a.substr(2).toLowerCase()];return b}},uB="VOD",ZB="EVENT",YB="LIVE",wB={VOD:uB,$j:ZB,LIVE:YB};_.v(HC,_.Bo);HC.prototype.Ja=function(){_.yp.m3u8=vB;_.wp[_.uj]=vB;_.wp[cB]=vB};HC.prototype.Ca=function(){_.uw("m3u8");_.vw(_.uj);_.vw(cB)};HC.prototype.id=function(){return"hls"};_.C("clpp.hls.HlsComponent",HC);};
49
49
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
50
50
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
51
51
  else{_=this.clpp._;(f.call(g,this));}
@@ -1,10 +1,10 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var QJ=function(a){this.startTime=a.startTime;this.endTime=a.endTime;this.a=this.f=null;a=a.value;if(!_.J.R(a)){a:{var b=a.info;if(_.J.Y(b)&&(b=b.toLowerCase().match(/lang:(\w+)/))&&b[1]){b=b[1].toLowerCase();break a}b=null}this.f=b;a=a.data;this.a=_.J.Y(a)?a:null}},SJ=function(a,b,c){this.l=a;this.m=b;this.j=c;this.a=new _.cg;this.h=(a=_.Rp[_.fc]||null)?new a(this.l.getConfiguration()):null;this.f=new _.H("clpp.hlssmpte.ImageCueHandler");this.g=null;RJ(this)},RJ=function(a){a.a.one(a.l,_.td,function(){return TJ(a)})},
3
- TJ=function(a){var b=a.l.getSurface().getMedia();if(b)if(a.h){a.a.on(b.textTracks,_.Vb,function(d){return UJ(a,d)});var c=Array.from(b.textTracks);c.filter(function(d){return d.kind===_.zd}).forEach(function(d){UJ(a,{track:d})});!VJ(c)&&a.m&&(a.f.warn("The metadata track is not present. Changing an audio track in order to enforce the creation of the metadata track."),WJ(a,b))}else a.f.warn("The clpp.ttml.TextParser class is not available. Please register the ttml component first.");else a.f.warn("A video element is not available. Skipping.")},
4
- VJ=function(a){return a.some(function(b){return b.kind===_.zd})},WJ=function(a,b){var c=a.l.getTrackManager(),d=c.ka(),e=c.getAudioTracks().find(function(g){return g!==d});if(e){var f=function(){return c.ra(d)};a.a.on(b.textTracks,_.Vb,function(g){g.track.kind===_.zd&&(a.a.off(b.textTracks,_.Vb,f),f())});c.ra(e)}else a.f.warn("Can't enforce the creation of the metadata track if single audio track. Skipping.")},UJ=function(a,b){var c=b.track;c.kind===_.zd&&(a.f.info("The metadata track has been added."),
5
- c.mode=_.jd,a.a.on(c,_.Sc,function(d){return XJ(a,d)}))},XJ=function(a,b){var c=YJ(a);c&&Array.from(b.target.activeCues||[]).forEach(function(d){if(d!==a.g&&Number.isFinite(d.startTime)&&Number.isFinite(d.endTime)&&"org.id3"===d.type&&d.value&&"TXXX"===d.value.key){var e=new QJ(d);if(e.f===c&&null!==e.a){a.g=d;d=a.h.parseMedia(_.sh(e.a),{periodStart:a.j,segmentStart:e.startTime,segmentEnd:e.endTime});var f=a.l.getTextDisplayer();f.remove(0,e.startTime);f.append(d.cues,d.styles)}}})},YJ=function(a){return(a=
6
- a.l.getTrackManager().la())&&a.language&&a.language.toLowerCase()},ZJ=function(){this.a=null;this.f=!1},$J=function(){};SJ.prototype.destroy=function(){this.a.release();this.g=null;return Promise.resolve()};_.v(ZJ,_.cq);ZJ.prototype.onPlayerCreated=function(){};ZJ.prototype.onContentWillLoad=function(a){if(this.f=_.Ti()){var b=a.getConfiguration();b=_.J.Ma(b.hlssmpte||{});_.J.Mf(b.patchMetadataTrack)||(b.patchMetadataTrack=!1);_.J.pa(b.timestampOffset)||(b.timestampOffset=0);this.a=new SJ(a,b.patchMetadataTrack,b.timestampOffset)}};ZJ.prototype.onPlayerWillDestroy=function(){var a=this;return _.A(function(b){if(1==b.a)return a.a?_.y(b,a.a.destroy(),3):b.H(0);a.a=null;_.z(b)})};ZJ.prototype.id=function(){return"hlssmpte"};
7
- _.B("clpp.hlssmpte.HlsSmptePlugin",ZJ);ZJ.Id="hlssmpte";$J.prototype.create=function(){return new ZJ};_.uo(new $J);};
2
+ var f=function(window){var VJ=function(a){this.startTime=a.startTime;this.endTime=a.endTime;this.a=this.f=null;a=a.value;if(!_.K.S(a)){a:{var b=a.info;if(_.K.Y(b)&&(b=b.toLowerCase().match(/lang:(\w+)/))&&b[1]){b=b[1].toLowerCase();break a}b=null}this.f=b;a=a.data;this.a=_.K.Y(a)?a:null}},XJ=function(a,b,c){this.l=a;this.m=b;this.j=c;this.a=new _.dg;this.h=(a=_.Tp[_.fc]||null)?new a(this.l.getConfiguration()):null;this.f=new _.H("clpp.hlssmpte.ImageCueHandler");this.g=null;WJ(this)},WJ=function(a){a.a.one(a.l,_.ud,function(){return YJ(a)})},
3
+ YJ=function(a){var b=a.l.getSurface().getMedia();if(b)if(a.h){a.a.on(b.textTracks,_.Vb,function(d){return ZJ(a,d)});var c=Array.from(b.textTracks);c.filter(function(d){return d.kind===_.Ad}).forEach(function(d){ZJ(a,{track:d})});!$J(c)&&a.m&&(a.f.warn("The metadata track is not present. Changing an audio track in order to enforce the creation of the metadata track."),aK(a,b))}else a.f.warn("The clpp.ttml.TextParser class is not available. Please register the ttml component first.");else a.f.warn("A video element is not available. Skipping.")},
4
+ $J=function(a){return a.some(function(b){return b.kind===_.Ad})},aK=function(a,b){var c=a.l.getTrackManager(),d=c.ma(),e=c.getAudioTracks().find(function(g){return g!==d});if(e){var f=function(){return c.sa(d)};a.a.on(b.textTracks,_.Vb,function(g){g.track.kind===_.Ad&&(a.a.off(b.textTracks,_.Vb,f),f())});c.sa(e)}else a.f.warn("Can't enforce the creation of the metadata track if single audio track. Skipping.")},ZJ=function(a,b){var c=b.track;c.kind===_.Ad&&(a.f.info("The metadata track has been added."),
5
+ c.mode=_.kd,a.a.on(c,_.Tc,function(d){return bK(a,d)}))},bK=function(a,b){var c=cK(a);c&&Array.from(b.target.activeCues||[]).forEach(function(d){if(d!==a.g&&Number.isFinite(d.startTime)&&Number.isFinite(d.endTime)&&"org.id3"===d.type&&d.value&&"TXXX"===d.value.key){var e=new VJ(d);if(e.f===c&&null!==e.a){a.g=d;d=a.h.parseMedia(_.th(e.a),{periodStart:a.j,segmentStart:e.startTime,segmentEnd:e.endTime});var f=a.l.getTextDisplayer();f.remove(0,e.startTime);f.append(d.cues,d.styles)}}})},cK=function(a){return(a=
6
+ a.l.getTrackManager().na())&&a.language&&a.language.toLowerCase()},dK=function(){this.a=null;this.f=!1},eK=function(){};XJ.prototype.destroy=function(){this.a.release();this.g=null;return Promise.resolve()};_.v(dK,_.eq);dK.prototype.onPlayerCreated=function(){};dK.prototype.onContentWillLoad=function(a){if(this.f=_.Ui()){var b=a.getConfiguration();b=_.K.Na(b.hlssmpte||{});_.K.Of(b.patchMetadataTrack)||(b.patchMetadataTrack=!1);_.K.ka(b.timestampOffset)||(b.timestampOffset=0);this.a=new XJ(a,b.patchMetadataTrack,b.timestampOffset)}};dK.prototype.onPlayerWillDestroy=function(){var a=this;return _.B(function(b){if(1==b.a)return a.a?_.x(b,a.a.destroy(),3):b.H(0);a.a=null;_.z(b)})};dK.prototype.id=function(){return"hlssmpte"};
7
+ _.C("clpp.hlssmpte.HlsSmptePlugin",dK);dK.Id="hlssmpte";eK.prototype.create=function(){return new dK};_.wo(new eK);};
8
8
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
9
9
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
10
10
  else{_=this.clpp._;(f.call(g,this));}
package/cjs/cl.htmlcue.js CHANGED
@@ -1,35 +1,35 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var II="CLPP Subtitle Styles",JI="Unsupported unit",KI="clpp-text-plain",LI="clpp-text-ttml",MI="clpp.htmlcue.HtmlTextDisplayer",NI="initial",OI=function(a,b){for(var c=0,d=a.length-1;c<=d;){var e=c+d>>1,f=b(a[e]);if(0===f)return e;0<f?c=e+1:d=e-1}return-1},PI=function(){},QI=function(a){if(!a.input)return null;var b=a.input.match(/^([^<]*)(<[^>]+>?)?/);b=b[1]?b[1]:b[2];a.input=a.input.substr(b.length);return b},SI=function(a){for(var b=null;b=a.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)a=a.replace(b[0],
3
- function(c){return RI[c]});return a},UI=function(a,b){TI(a,b);Array.from(b.getElementsByTagName("*")).forEach(function(c){TI(a,c)})},TI=function(a,b){for(var c in a)null!=a[c]&&(b.style[c]=a[c])},VI=function(a,b){return 0===a?"0":a+b},WI=function(a,b){return 1>Math.abs(a-b)||a<b},XI=function(a,b){return a<b&&1<Math.abs(a-b)},YI=function(a,b){return a>b&&1<Math.abs(a-b)},ZI=function(a,b){return 1>Math.abs(a-b)||a>b},$I=function(a,b,c,d,e,f){this.f=a;this.g=b;this.h=c;this.a=d;this.height=e;this.width=
4
- f},aJ=function(a){return new $I(a.f,a.g,a.h,a.a,a.height,a.width)},bJ=function(a){var b=a.getBoundingClientRect(),c=getComputedStyle(a,null),d=parseFloat(c.getPropertyValue("border-left-width"))||0,e=parseFloat(c.getPropertyValue("border-right-width"))||0,f=parseFloat(c.getPropertyValue("border-top-width"))||0;c=parseFloat(c.getPropertyValue("border-bottom-width"))||0;var g=(b.top||a.offsetTop)+f;f=(b.height||a.offsetHeight)-f-c;return new $I(b.left+d,b.right+e,g,(b.bottom||g+f)+c,f,(b.width||a.offsetWidth)-
5
- d-e)},cJ=function(a,b){return b.some(function(c){return XI(a.f,c.g)&&YI(a.g,c.f)&&XI(a.h,c.a)&&YI(a.a,c.h)})},dJ=function(a,b){return ZI(a.h,b.h)&&WI(a.a,b.a)&&ZI(a.f,b.f)&&WI(a.g,b.g)},eJ=function(a,b,c){switch(c){case "+x":return XI(a.f,b.f);case "-x":return YI(a.g,b.g);case "+y":return XI(a.h,b.h);case "-y":return YI(a.a,b.a);default:throw Error("Unknown axis");}},fJ=function(a,b,c){this.id=a;this.o=b;this.A=c;this.a=this.m();this.h=!1},gJ=function(a,b,c){fJ.call(this,a.id,"clpp-text-cue",{});
6
- this.j=b;this.f=a;this.g=!!this.f.backgroundImage;this.B=c},iJ=function(a){var b=a.a.childNodes[0],c=a.a.getBoundingClientRect(),d=b.getClientRects();b=c.height/d.length;c=c.width/d.length;return hJ(a)?b:c},lJ=function(a,b,c){return hJ(a)&&_.J.pa(c)?VI(c,_.ae):(jJ(a)||kJ(a))&&_.J.pa(b)?VI(b,"%"):NI},jJ=function(a){return a.f.writingMode===_.Ne},kJ=function(a){return a.f.writingMode===_.Oe},hJ=function(a){return a.f.writingMode===_.tg},mJ=function(a,b,c){return(jJ(a)||kJ(a))&&_.J.pa(c)?VI(c,_.ae):
7
- jJ(a)&&_.J.R(c)?VI(0,_.ae):hJ(a)&&_.J.pa(b)?VI(b,"%"):NI},nJ=function(a,b){if(typeof a.f.position===_.k&&typeof a.f.size===_.k)switch(b){case _.rd:return a.f.position;case "auto":case _.Ac:return a.f.position-a.f.size/2;case _.sd:return a.f.position-a.f.size}return 0},oJ=function(a){switch(a.f.positionAlign){case _.rd:return _.od;case "auto":case _.Ac:return _.sg;case _.sd:return _.he}return a.f.textAlign},pJ=function(a){if(!a.f.positionAlign)switch(a.f.textAlign){case _.od:case _.od:return _.rd;
8
- case _.sg:return _.Ac;case _.he:case _.he:return _.sd}return a.f.positionAlign},qJ=function(a){switch(a.f.writingMode){case _.tg:return"horizontal-tb";case _.Ne:return _.Ne;case _.Oe:return _.Oe;default:throw Error("Unknown writing mode");}},rJ=function(a,b){this.j=a;this.f=a.a;this.h=void 0===b?!1:b;this.a=bJ(a.a);this.g=[]},sJ=function(a,b){if(a.h)switch(b.writingMode){case _.tg:return["-y"];case _.Ne:return["+x"];case _.Oe:return["-x"]}var c=[];switch(b.writingMode){case _.tg:c=["+y","-y"];break;
9
- case _.Ne:c=["+x","-x"];break;case _.Oe:c=["-x","+x"]}0>b.line&&(c=c.reverse());return c},tJ=function(a){for(a.g=[];0<a.f.childNodes.length;)a.f.removeChild(a.f.childNodes[0]);a.a=bJ(a.j.a)},uJ=function(a,b,c){fJ.call(this,a,b,c);this.g=null;this.j=[]},vJ=function(a,b){tJ(a.g);a.j.unshift(b);for(var c=_.u(a.j),d=c.next();!d.done;d=c.next())a.g.append(d.value)},wJ=function(a,b){uJ.call(this,a.id,"clpp-text-cue-region",b);this.f=a},xJ=function(a,b,c){a=a.f;var d=a.viewportAnchorUnits;if(d===_.yg)return a.viewportAnchorY/
10
- 100*c-a.regionAnchorY/100*b;if(0===d)return a.viewportAnchorY-a.regionAnchorY;throw Error(JI);},zJ=function(a){this.f=new _.H("clpp.htmlcue.StyleManager");this.m=[];this.h=a.getSurface().getUniqueCssClass();this.j=[];this.a=yJ(this,this.h);this.g=yJ(this,this.h,!0);this.g.disabled=!0;this.f.debug("Stylesheet CLPP Subtitle Styles has been created.")},AJ=function(a,b){var c=!1;try{a.g.insertRule(b,0);var d=a.g.cssRules[0];d instanceof CSSStyleRule&&(c=d.selectorText.split(",").every(function(e){return 0===
11
- e.trim().indexOf("."+a.h+" ")}))}catch(e){}0<a.g.cssRules.length&&a.g.deleteRule(0);return c},BJ=function(a,b){var c="."+a.h+" .clpp-text-container",d=c+" .clpp-text-cue";return b=b.replace(/::cue\((#[^)]+)\)/g,c+" $1").replace(/::cue\(([^)]+)\)/g,d+" $1").replace(/::cue-region\(([^)]+)\)/g,c+" $1 .clpp-text-cue").replace(/::cue/g,d).replace(/::cue-region/g,c+" .clpp-text-cue-region .clpp-text-cue").replace(/::ttml/g,c)},yJ=function(a,b,c){var d=document.createElement(_.ve),e=d.dataset;e.name=II;
12
- e["for"]=b;c&&(e.name="CLPP Subtitle Styles (sandbox)",e.sandbox=!0);b=document.head;b.appendChild(d);CJ(a,b);a.f.debug("Created HTML style element #CLPP Subtitle Styles.");return d.sheet},CJ=function(a,b){var c=new MutationObserver(function(d){d.forEach(function(e){e.removedNodes.forEach(function(f){f.id===II&&a.f.error("PRESTOplay HTML style element #CLPP Subtitle Styles has been unexpectedly removed! Some styles will not work!")})})});c.observe(b,{subtree:!1,childList:!0});a.m.push(function(){return c.disconnect()})},
13
- FJ=function(a){_.Tp.call(this,a);var b=this;this.L=new _.H(MI);this.l=a;this.K=DJ(a);this.h=!1;this.f=[];this.B=a.getSurface().getContainer();this.g=new zJ(a);this.a=new uJ(null,"clpp-text-container",{});this.o=new _.pp(a.getSurface(),this.lh.bind(this));this.I=null;this.B?(this.B.appendChild(this.a.a),this.a.init(null)):this.L.warn("No container element! Subtitles will not appear. Please check your player surface configuration or switch to NativeTextDisplayer.");this.C=new _.Li(function(){EJ(b)});
14
- this.w=new Map;this.j=null},DJ=function(a){a=_.J.Ma(a.getConfiguration().htmlcue||{});_.J.R(a.stretchSmpteImage)&&(a.stretchSmpteImage=!1);_.J.R(a.enableResizeObserver)&&(a.enableResizeObserver=!0);return a},GJ=function(a,b){return a.startTime<=b&&a.endTime>b},EJ=function(a,b){if((b||a.h)&&a.B){var c=a.l.getPosition();if(b||a.I!==c&&a.l.getState()===_.bn){a.I=c;var d=HJ(a,c);(c=b)||(c=a.j,c=!(null===c&&null===d||null!==c&&null!==d&&c.start===d.start&&c.end===d.end));if(c&&(a.j=d,IJ(a),d)){c={color:a.getFontColor()||
15
- void 0,backgroundColor:a.getBackgroundColor()||void 0,fontFamily:a.getFontFamily()||void 0,textShadow:_.Yp(a)||void 0};d=a.f.slice(d.start,d.end+1);d=_.u(d);for(var e=d.next();!e.done;e=d.next()){var f=a;e=e.value;var g=f.a.a,h=null;switch(e.payloadType){case _.We:h="clpp-text-vtt";break;case _.Fe:h=LI;break;case _.rg:h=KI}h&&!g.classList.contains(h)&&_.yn(g,h);g=bJ(f.a.a);if(0===g.width||0===g.height)f.L.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.");
16
- else{TI({fontSize:JJ(f,e.containerRows)},f.a.a);g=null;h=e.payloadType===_.We;var l=e.payloadType===_.Fe;e.region&&(h||l||e.backgroundImage)&&(f.w.has(e.region.id)?g=f.w.get(e.region.id):(g=new wJ(e.region,{}),f.w.set(e.region.id,g),vJ(f.a,g)));e=new gJ(e,f.K,c);g?vJ(g,e):vJ(f.a,e)}}}}}},HJ=function(a,b){var c=OI(a.f,function(e){return GJ(e,b)?0:b!==e.startTime?b-e.startTime:b-e.endTime});if(-1===c)return null;for(var d=c;0<=d-1&&GJ(a.f[d-1],b);)d--;for(;c+1<a.f.length&&GJ(a.f[c+1],b);)c++;return{start:d,
17
- end:c}},KJ=function(a){IJ(a);a.I=null;a.j=null;a.f=[]},IJ=function(a){a.w.clear();if(a.a){var b=a.a.a;b.classList.remove("clpp-text-vtt");b.classList.remove(LI);b.classList.remove(KI);a=a.a;tJ(a.g);a.j=[]}},JJ=function(a,b){var c=bJ(a.a.a).height;if(null!==a.G)return a.getFontSize();if(null!==a.A){var d=a.getFontSizePercent();return Math.round(c*d)+_.ae}if(typeof b===_.k&&0<b)return Math.round(c/b)+_.ae;d=a.getFontSizePercent();return Math.round(c*d)+_.ae},LJ=function(){},MJ=function(){};
18
- PI.prototype.parse=function(a){a={input:a};for(var b=_.An(_.Vc),c=[],d=b,e;null!==(e=QI(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=e[1];var g=e[3];var h=NJ[f];h?(h=_.An(h),(f=OJ[f])&&g&&h.setAttribute(f,g.trim()),g=h):g=null;!g||PJ[g.localName]&&PJ[g.localName]!==d.localName||(e[2]&&(g.className=e[2].substr(1).replace(/\./g," ")),c.push(e[1]),d.appendChild(g),
19
- d=g)}}else d.appendChild(document.createTextNode(SI(e)));return b};var NJ={c:"c",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"v",lang:"lang"},OJ={v:"voice",lang:"lang"},PJ={rt:"ruby"},RI={"\x26amp;":"\x26","\x26lt;":"\x3c","\x26gt;":"\x3e","\x26lrm;":"\u200e","\x26rlm;":"\u200f","\x26nbsp;":"\u00a0"};fJ.prototype.init=function(){this.h=!0};fJ.prototype.w=function(){return!1};_.v(gJ,fJ);gJ.prototype.w=function(){return!this.g&&!(this.f.region&&this.f.region.displayAlign)};
20
- gJ.prototype.init=function(a){fJ.prototype.init.call(this,a);if(this.g)_.yn(this.a,"clpp-text-cue-image"),this.a.style.backgroundImage='url("'+this.f.backgroundImage+'")',this.j.stretchSmpteImage&&(this.a.style.backgroundSize="contain");else if(a){var b=this.f;if(b.payloadType===_.Fe){var c=_.An(_.Vc);c.innerHTML=b.payload;b=c}else b.payloadType===_.We?b=(new PI).parse(b.payload):(c=_.An(_.Vc),c.textContent=b.payload,b=c);_.yn(b,this.o);this.id&&(b.id=this.id);c=_.u(this.f.cssClassList);for(var d=
21
- c.next();!d.done;d=c.next())_.yn(b,d.value);TI({writingMode:qJ(this)},b);this.a.appendChild(b);_.yn(this.a,"clpp-text-wrapper");c=_.u(this.f.cssClassList);for(d=c.next();!d.done;d=c.next())_.yn(this.a,"clpp-text-wrapper__"+d.value);_.J.R(this.f.line)&&(this.f.lineInterpretation=_.ug,this.f.line=hJ(this)?-1:0);c=qJ(this);TI({writingMode:c,webkitWritingMode:c,direction:NI,textAlign:oJ(this)},this.a);if(!this.f.region||!this.f.region.displayAlign){c=nJ(this,pJ(this));d=mJ(this,c,null);var e=lJ(this,
22
- c,null),f=kJ(this)&&_.J.R(null)?VI(0,_.ae):NI;TI({position:"absolute",left:d,right:f,top:e,width:hJ(this)?VI(this.f.size,"%"):NI,height:jJ(this)||kJ(this)?VI(this.f.size,"%"):NI},this.a);d=this.f;a=hJ(this)?a.height:a.width;e=iJ(this);if(d.lineInterpretation===_.ug)f=e*Math.round(d.line),Math.abs(f)>a&&(f=e*(0>d.line?0:-1)),0>f&&(f+=a);else{f=e/a*100;var g=d.line;switch(d.lineAlign){case _.Ac:g-=f/2;break;case _.dd:g-=f}f=Math.round(g/100*a)}kJ(this)&&(f=a-f-e);a=f;d=mJ(this,c,a);e=kJ(this)&&_.J.R(a)?
23
- VI(0,_.ae):NI;TI({left:d,right:e,top:lJ(this,c,a)},this.a)}UI(this.B,b)}};gJ.prototype.m=function(){return _.An(_.Vc)};rJ.prototype.append=function(a){var b=a.a;b.style.visibility=_.jd;this.f.appendChild(b);a.h||a.init(this.a);if(a.w()){a:{var c=bJ(a.a);var d=sJ(this,a.f),e=iJ(a),f=aJ(c),g=null,h=0;d=_.u(d);for(var l=d.next();!l.done;l=d.next()){for(l=l.value;eJ(c,this.a,l)||dJ(c,this.a)&&cJ(c,this.g);){var m=c,n=e;switch(l){case "+x":m.f+=n;m.g+=n;break;case "-x":m.f-=n;m.g-=n;break;case "+y":m.h+=n;m.a+=n;break;case "-y":m.h-=n,m.a-=n}}if(this.h||dJ(c,this.a))break a;l=this.a;l=Math.max(0,Math.min(c.g,l.g)-Math.max(c.f,
24
- l.f))*Math.max(0,Math.min(c.a,l.a)-Math.max(c.h,l.h))/(c.height*c.width);l>h&&(g=aJ(c),h=l);c=aJ(f)}c=g||f}TI({top:VI(c.h-this.a.h,_.ae),bottom:VI(this.a.a-c.a,_.ae),left:VI(c.f-this.a.f,_.ae),right:VI(this.a.g-c.g,_.ae),height:VI(c.height,_.ae),width:VI(c.width,_.ae)},a.a)}b.style.visibility="visible";this.g.push(bJ(a.a))};_.v(uJ,fJ);uJ.prototype.init=function(){this.g=new rJ(this);this.h=!0};uJ.prototype.m=function(){var a=_.An(_.Vc);_.yn(a,this.o);this.id&&(a.id=this.id);return a};_.v(wJ,uJ);
25
- wJ.prototype.init=function(a){a:{var b=this.f;switch(b.widthUnits){case 0:b=b.width;break a;case _.yg:b=b.width/100*a.width;break a;default:throw Error(JI);}}var c=this.f;var d=c.viewportAnchorUnits;if(d===_.yg)c=c.viewportAnchorX/100*a.width-c.regionAnchorX/100*b;else if(0===d)c=c.viewportAnchorX-c.regionAnchorX;else throw Error(JI);d=a.height;var e=xJ(this,d,a.height);TI(this.A,this.a);TI({left:VI(c,_.ae),top:VI(e,_.ae),width:VI(b,_.ae),height:VI(d,_.ae)},this.a);this.f.writingMode&&TI({display:"flex",
26
- "flex-direction":this.f.writingMode},this.a);this.f.displayAlign&&TI({"justify-content":this.f.displayAlign},this.a);b=_.u(this.f.cssClassList);for(c=b.next();!c.done;c=b.next())_.yn(this.a,c.value);a:switch(b=this.f,b.heightUnits){case 0:b=b.height;break a;case _.yg:b=b.height/100*a.height;break a;case 2:b=b.height;d=new gJ(new _.xg(0,1,"Lorem ipsum",_.rg),{},{});c=d.a;this.a.appendChild(c);d.init(bJ(this.a));d=c.getBoundingClientRect().height;this.a.removeChild(c);b*=d;break a;default:throw Error(JI);
27
- }a=xJ(this,b,a.height);TI({top:VI(a,_.ae),height:VI(b,_.ae)},this.a);this.g=new rJ(this,!0);this.h=!0};wJ.prototype.getId=function(){return this.f.id};zJ.prototype.appendRule=function(a){if(null!=this.a&&!this.j.some(function(c){return c===a})){var b=BJ(this,a);if(AJ(this,b)){try{this.a.insertRule(b,this.a.cssRules.length),this.f.debug("Added CSS rule "+b)}catch(c){this.f.error("An error occurred when adding a CSS rule: "+b)}this.j.push(a)}else this.f.warn("Stylesheet CLPP Subtitle Styles ignoring the CSS rule because it's not safe: "+b)}};
28
- zJ.prototype.destroy=function(){var a=this;return _.A(function(b){if(null==a.a)return b["return"]();a.m.forEach(function(c){return c()});a.m=[];if(null!=a.a){for(;0<a.a.cssRules.length;)a.a.deleteRule(0);a.j=[]}document.head.removeChild(a.a.ownerNode);document.head.removeChild(a.g.ownerNode);a.a=null;a.g=null;a.f.debug("Stylesheet CLPP Subtitle Styles has been destroyed.");_.z(b)})};_.v(FJ,_.Tp);_.t=FJ.prototype;
29
- _.t.append=function(a,b){if(null!=this.g&&0!==a.length){for(var c=_.u(b),d=c.next();!d.done;d=c.next())this.g.appendRule(d.value);a.sort(function(f,g){return f.startTime!==g.startTime?f.startTime-g.startTime:f.endTime-g.endTime});c=this.f.findIndex(function(f){return f.startTime>=a[0].startTime});0===c?this.f=[]:0<c&&this.f.splice(0,c);c={};d=_.u(a);for(var e=d.next();!e.done;c={md:c.md},e=d.next())c.md=e.value,this.f.some(function(f){return function(g){var h=f.md;return g.payload!==h.payload?!1:
30
- g.startTime!==h.startTime?!1:g.endTime!==h.endTime?!1:!0}}(c))||this.f.push(c.md);this.j=null;EJ(this,!1)}};_.t.ob=function(){null==this.g||EJ(this,!0)};_.t.destroy=function(){var a=this;return _.A(function(b){if(1==b.a){if(null==a.g)return b["return"]();KJ(a);a.C.stop();return _.y(b,a.g.destroy(),2)}a.g=null;a.B.removeChild(a.a.a);a.a=null;a.o.stop();a.o=null;a.h=!1;_.z(b)})};
31
- _.t.remove=function(a,b){if(null==this.g)return!1;this.f=this.f.filter(function(c){return c.startTime<a||c.endTime>=b});this.j=null;EJ(this,!0);return!0};_.t.isTextVisible=function(){return this.h};_.t.setTextVisibility=function(a){null!=this.g&&this.h!==a&&((this.h=a)?(this.C.ab(.25),this.K.enableResizeObserver&&this.o.start(),EJ(this,!0)):(this.C.stop(),this.o.stop(),KJ(this)))};_.t.lh=function(){EJ(this,!0)};_.B(MI,FJ);FJ.prototype.setTextVisibility=FJ.prototype.setTextVisibility;
32
- FJ.prototype.isTextVisible=FJ.prototype.isTextVisible;FJ.prototype.remove=FJ.prototype.remove;FJ.prototype.destroy=FJ.prototype.destroy;FJ.prototype.append=FJ.prototype.append;LJ.prototype.aa=function(a){return!!a.enableHtmlCue&&!_.Vi()};LJ.prototype.create=function(a){return new FJ(a)};_.v(MJ,_.zo);MJ.prototype.Ja=function(){_.wm("html",new LJ)};MJ.prototype.Ca=function(){};MJ.prototype.id=function(){return _.xe};_.B("clpp.htmlcue.HtmlCueComponent",MJ);};
2
+ var f=function(window){var NI="CLPP Subtitle Styles",OI="Unsupported unit",PI="clpp-text-plain",QI="clpp-text-ttml",RI="clpp.htmlcue.HtmlTextDisplayer",SI="initial",TI=function(a,b){for(var c=0,d=a.length-1;c<=d;){var e=c+d>>1,f=b(a[e]);if(0===f)return e;0<f?c=e+1:d=e-1}return-1},UI=function(){},VI=function(a){if(!a.input)return null;var b=a.input.match(/^([^<]*)(<[^>]+>?)?/);b=b[1]?b[1]:b[2];a.input=a.input.substr(b.length);return b},XI=function(a){for(var b=null;b=a.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)a=a.replace(b[0],
3
+ function(c){return WI[c]});return a},ZI=function(a,b){YI(a,b);Array.from(b.getElementsByTagName("*")).forEach(function(c){YI(a,c)})},YI=function(a,b){for(var c in a)null!=a[c]&&(b.style[c]=a[c])},$I=function(a,b){return 0===a?"0":a+b},aJ=function(a,b){return 1>Math.abs(a-b)||a<b},bJ=function(a,b){return a<b&&1<Math.abs(a-b)},cJ=function(a,b){return a>b&&1<Math.abs(a-b)},dJ=function(a,b){return 1>Math.abs(a-b)||a>b},eJ=function(a,b,c,d,e,f){this.f=a;this.g=b;this.h=c;this.a=d;this.height=e;this.width=
4
+ f},fJ=function(a){return new eJ(a.f,a.g,a.h,a.a,a.height,a.width)},gJ=function(a){var b=a.getBoundingClientRect(),c=getComputedStyle(a,null),d=parseFloat(c.getPropertyValue("border-left-width"))||0,e=parseFloat(c.getPropertyValue("border-right-width"))||0,f=parseFloat(c.getPropertyValue("border-top-width"))||0;c=parseFloat(c.getPropertyValue("border-bottom-width"))||0;var g=(b.top||a.offsetTop)+f;f=(b.height||a.offsetHeight)-f-c;return new eJ(b.left+d,b.right+e,g,(b.bottom||g+f)+c,f,(b.width||a.offsetWidth)-
5
+ d-e)},hJ=function(a,b){return b.some(function(c){return bJ(a.f,c.g)&&cJ(a.g,c.f)&&bJ(a.h,c.a)&&cJ(a.a,c.h)})},iJ=function(a,b){return dJ(a.h,b.h)&&aJ(a.a,b.a)&&dJ(a.f,b.f)&&aJ(a.g,b.g)},jJ=function(a,b,c){switch(c){case "+x":return bJ(a.f,b.f);case "-x":return cJ(a.g,b.g);case "+y":return bJ(a.h,b.h);case "-y":return cJ(a.a,b.a);default:throw Error("Unknown axis");}},kJ=function(a,b,c){this.id=a;this.o=b;this.A=c;this.a=this.m();this.h=!1},lJ=function(a,b,c){kJ.call(this,a.id,"clpp-text-cue",{});
6
+ this.j=b;this.f=a;this.g=!!this.f.backgroundImage;this.B=c},nJ=function(a){var b=a.a.childNodes[0],c=a.a.getBoundingClientRect(),d=b.getClientRects();b=c.height/d.length;c=c.width/d.length;return mJ(a)?b:c},qJ=function(a,b,c){return mJ(a)&&_.K.ka(c)?$I(c,_.be):(oJ(a)||pJ(a))&&_.K.ka(b)?$I(b,"%"):SI},oJ=function(a){return a.f.writingMode===_.Oe},pJ=function(a){return a.f.writingMode===_.Pe},mJ=function(a){return a.f.writingMode===_.ug},rJ=function(a,b,c){return(oJ(a)||pJ(a))&&_.K.ka(c)?$I(c,_.be):
7
+ oJ(a)&&_.K.S(c)?$I(0,_.be):mJ(a)&&_.K.ka(b)?$I(b,"%"):SI},sJ=function(a,b){if(typeof a.f.position===_.k&&typeof a.f.size===_.k)switch(b){case _.sd:return a.f.position;case "auto":case _.Ac:return a.f.position-a.f.size/2;case _.td:return a.f.position-a.f.size}return 0},tJ=function(a){switch(a.f.positionAlign){case _.sd:return _.pd;case "auto":case _.Ac:return _.tg;case _.td:return _.ie}return a.f.textAlign},uJ=function(a){if(!a.f.positionAlign)switch(a.f.textAlign){case _.pd:case _.pd:return _.sd;
8
+ case _.tg:return _.Ac;case _.ie:case _.ie:return _.td}return a.f.positionAlign},vJ=function(a){switch(a.f.writingMode){case _.ug:return"horizontal-tb";case _.Oe:return _.Oe;case _.Pe:return _.Pe;default:throw Error("Unknown writing mode");}},wJ=function(a,b){this.j=a;this.f=a.a;this.h=void 0===b?!1:b;this.a=gJ(a.a);this.g=[]},xJ=function(a,b){if(a.h)switch(b.writingMode){case _.ug:return["-y"];case _.Oe:return["+x"];case _.Pe:return["-x"]}var c=[];switch(b.writingMode){case _.ug:c=["+y","-y"];break;
9
+ case _.Oe:c=["+x","-x"];break;case _.Pe:c=["-x","+x"]}0>b.line&&(c=c.reverse());return c},yJ=function(a){for(a.g=[];0<a.f.childNodes.length;)a.f.removeChild(a.f.childNodes[0]);a.a=gJ(a.j.a)},zJ=function(a,b,c){kJ.call(this,a,b,c);this.g=null;this.j=[]},AJ=function(a,b){yJ(a.g);a.j.unshift(b);for(var c=_.u(a.j),d=c.next();!d.done;d=c.next())a.g.append(d.value)},BJ=function(a,b){zJ.call(this,a.id,"clpp-text-cue-region",b);this.f=a},CJ=function(a,b,c){a=a.f;var d=a.viewportAnchorUnits;if(d===_.zg)return a.viewportAnchorY/
10
+ 100*c-a.regionAnchorY/100*b;if(0===d)return a.viewportAnchorY-a.regionAnchorY;throw Error(OI);},EJ=function(a){this.f=new _.H("clpp.htmlcue.StyleManager");this.m=[];this.h=a.getSurface().getUniqueCssClass();this.j=[];this.a=DJ(this,this.h);this.g=DJ(this,this.h,!0);this.g.disabled=!0;this.f.debug("Stylesheet CLPP Subtitle Styles has been created.")},FJ=function(a,b){var c=!1;try{a.g.insertRule(b,0);var d=a.g.cssRules[0];d instanceof CSSStyleRule&&(c=d.selectorText.split(",").every(function(e){return 0===
11
+ e.trim().indexOf("."+a.h+" ")}))}catch(e){}0<a.g.cssRules.length&&a.g.deleteRule(0);return c},GJ=function(a,b){var c="."+a.h+" .clpp-text-container",d=c+" .clpp-text-cue";return b=b.replace(/::cue\((#[^)]+)\)/g,c+" $1").replace(/::cue\(([^)]+)\)/g,d+" $1").replace(/::cue-region\(([^)]+)\)/g,c+" $1 .clpp-text-cue").replace(/::cue/g,d).replace(/::cue-region/g,c+" .clpp-text-cue-region .clpp-text-cue").replace(/::ttml/g,c)},DJ=function(a,b,c){var d=document.createElement(_.we),e=d.dataset;e.name=NI;
12
+ e["for"]=b;c&&(e.name="CLPP Subtitle Styles (sandbox)",e.sandbox=!0);b=document.head;b.appendChild(d);HJ(a,b);a.f.debug("Created HTML style element #CLPP Subtitle Styles.");return d.sheet},HJ=function(a,b){var c=new MutationObserver(function(d){d.forEach(function(e){e.removedNodes.forEach(function(f){f.id===NI&&a.f.error("PRESTOplay HTML style element #CLPP Subtitle Styles has been unexpectedly removed! Some styles will not work!")})})});c.observe(b,{subtree:!1,childList:!0});a.m.push(function(){return c.disconnect()})},
13
+ KJ=function(a){_.Vp.call(this,a);var b=this;this.N=new _.H(RI);this.l=a;this.L=IJ(a);this.h=!1;this.f=[];this.B=a.getSurface().getContainer();this.g=new EJ(a);this.a=new zJ(null,"clpp-text-container",{});this.o=new _.rp(a.getSurface(),this.oh.bind(this));this.J=null;this.B?(this.B.appendChild(this.a.a),this.a.init(null)):this.N.warn("No container element! Subtitles will not appear. Please check your player surface configuration or switch to NativeTextDisplayer.");this.D=new _.Ni(function(){JJ(b)});
14
+ this.w=new Map;this.j=null},IJ=function(a){a=_.K.Na(a.getConfiguration().htmlcue||{});_.K.S(a.stretchSmpteImage)&&(a.stretchSmpteImage=!1);_.K.S(a.enableResizeObserver)&&(a.enableResizeObserver=!0);return a},LJ=function(a,b){return a.startTime<=b&&a.endTime>b},JJ=function(a,b){if((b||a.h)&&a.B){var c=a.l.getPosition();if(b||a.J!==c&&a.l.getState()===_.cn){a.J=c;var d=MJ(a,c);(c=b)||(c=a.j,c=!(null===c&&null===d||null!==c&&null!==d&&c.start===d.start&&c.end===d.end));if(c&&(a.j=d,NJ(a),d)){c={color:a.getFontColor()||
15
+ void 0,backgroundColor:a.getBackgroundColor()||void 0,fontFamily:a.getFontFamily()||void 0,textShadow:_.$p(a)||void 0};d=a.f.slice(d.start,d.end+1);d=_.u(d);for(var e=d.next();!e.done;e=d.next()){var f=a;e=e.value;var g=f.a.a,h=null;switch(e.payloadType){case _.Xe:h="clpp-text-vtt";break;case _.Ge:h=QI;break;case _.sg:h=PI}h&&!g.classList.contains(h)&&_.An(g,h);g=gJ(f.a.a);if(0===g.width||0===g.height)f.N.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.");
16
+ else{YI({fontSize:OJ(f,e.containerRows)},f.a.a);g=null;h=e.payloadType===_.Xe;var l=e.payloadType===_.Ge;e.region&&(h||l||e.backgroundImage)&&(f.w.has(e.region.id)?g=f.w.get(e.region.id):(g=new BJ(e.region,{}),f.w.set(e.region.id,g),AJ(f.a,g)));e=new lJ(e,f.L,c);g?AJ(g,e):AJ(f.a,e)}}}}}},MJ=function(a,b){var c=TI(a.f,function(e){return LJ(e,b)?0:b!==e.startTime?b-e.startTime:b-e.endTime});if(-1===c)return null;for(var d=c;0<=d-1&&LJ(a.f[d-1],b);)d--;for(;c+1<a.f.length&&LJ(a.f[c+1],b);)c++;return{start:d,
17
+ end:c}},PJ=function(a){NJ(a);a.J=null;a.j=null;a.f=[]},NJ=function(a){a.w.clear();if(a.a){var b=a.a.a;b.classList.remove("clpp-text-vtt");b.classList.remove(QI);b.classList.remove(PI);a=a.a;yJ(a.g);a.j=[]}},OJ=function(a,b){var c=gJ(a.a.a).height;if(null!==a.I)return a.getFontSize();if(null!==a.A){var d=a.getFontSizePercent();return Math.round(c*d)+_.be}if(typeof b===_.k&&0<b)return Math.round(c/b)+_.be;d=a.getFontSizePercent();return Math.round(c*d)+_.be},QJ=function(){},RJ=function(){};
18
+ UI.prototype.parse=function(a){a={input:a};for(var b=_.Cn(_.Wc),c=[],d=b,e;null!==(e=VI(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=e[1];var g=e[3];var h=SJ[f];h?(h=_.Cn(h),(f=TJ[f])&&g&&h.setAttribute(f,g.trim()),g=h):g=null;!g||UJ[g.localName]&&UJ[g.localName]!==d.localName||(e[2]&&(g.className=e[2].substr(1).replace(/\./g," ")),c.push(e[1]),d.appendChild(g),
19
+ d=g)}}else d.appendChild(document.createTextNode(XI(e)));return b};var SJ={c:"c",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"v",lang:"lang"},TJ={v:"voice",lang:"lang"},UJ={rt:"ruby"},WI={"\x26amp;":"\x26","\x26lt;":"\x3c","\x26gt;":"\x3e","\x26lrm;":"\u200e","\x26rlm;":"\u200f","\x26nbsp;":"\u00a0"};kJ.prototype.init=function(){this.h=!0};kJ.prototype.w=function(){return!1};_.v(lJ,kJ);lJ.prototype.w=function(){return!this.g&&!(this.f.region&&this.f.region.displayAlign)};
20
+ lJ.prototype.init=function(a){kJ.prototype.init.call(this,a);if(this.g)_.An(this.a,"clpp-text-cue-image"),this.a.style.backgroundImage='url("'+this.f.backgroundImage+'")',this.j.stretchSmpteImage&&(this.a.style.backgroundSize="contain");else if(a){var b=this.f;if(b.payloadType===_.Ge){var c=_.Cn(_.Wc);c.innerHTML=b.payload;b=c}else b.payloadType===_.Xe?b=(new UI).parse(b.payload):(c=_.Cn(_.Wc),c.textContent=b.payload,b=c);_.An(b,this.o);this.id&&(b.id=this.id);c=_.u(this.f.cssClassList);for(var d=
21
+ c.next();!d.done;d=c.next())_.An(b,d.value);YI({writingMode:vJ(this)},b);this.a.appendChild(b);_.An(this.a,"clpp-text-wrapper");c=_.u(this.f.cssClassList);for(d=c.next();!d.done;d=c.next())_.An(this.a,"clpp-text-wrapper__"+d.value);_.K.S(this.f.line)&&(this.f.lineInterpretation=_.vg,this.f.line=mJ(this)?-1:0);c=vJ(this);YI({writingMode:c,webkitWritingMode:c,direction:SI,textAlign:tJ(this)},this.a);if(!this.f.region||!this.f.region.displayAlign){c=sJ(this,uJ(this));d=rJ(this,c,null);var e=qJ(this,
22
+ c,null),f=pJ(this)&&_.K.S(null)?$I(0,_.be):SI;YI({position:"absolute",left:d,right:f,top:e,width:mJ(this)?$I(this.f.size,"%"):SI,height:oJ(this)||pJ(this)?$I(this.f.size,"%"):SI},this.a);d=this.f;a=mJ(this)?a.height:a.width;e=nJ(this);if(d.lineInterpretation===_.vg)f=e*Math.round(d.line),Math.abs(f)>a&&(f=e*(0>d.line?0:-1)),0>f&&(f+=a);else{f=e/a*100;var g=d.line;switch(d.lineAlign){case _.Ac:g-=f/2;break;case _.ed:g-=f}f=Math.round(g/100*a)}pJ(this)&&(f=a-f-e);a=f;d=rJ(this,c,a);e=pJ(this)&&_.K.S(a)?
23
+ $I(0,_.be):SI;YI({left:d,right:e,top:qJ(this,c,a)},this.a)}ZI(this.B,b)}};lJ.prototype.m=function(){return _.Cn(_.Wc)};wJ.prototype.append=function(a){var b=a.a;b.style.visibility=_.kd;this.f.appendChild(b);a.h||a.init(this.a);if(a.w()){a:{var c=gJ(a.a);var d=xJ(this,a.f),e=nJ(a),f=fJ(c),g=null,h=0;d=_.u(d);for(var l=d.next();!l.done;l=d.next()){for(l=l.value;jJ(c,this.a,l)||iJ(c,this.a)&&hJ(c,this.g);){var m=c,n=e;switch(l){case "+x":m.f+=n;m.g+=n;break;case "-x":m.f-=n;m.g-=n;break;case "+y":m.h+=n;m.a+=n;break;case "-y":m.h-=n,m.a-=n}}if(this.h||iJ(c,this.a))break a;l=this.a;l=Math.max(0,Math.min(c.g,l.g)-Math.max(c.f,
24
+ l.f))*Math.max(0,Math.min(c.a,l.a)-Math.max(c.h,l.h))/(c.height*c.width);l>h&&(g=fJ(c),h=l);c=fJ(f)}c=g||f}YI({top:$I(c.h-this.a.h,_.be),bottom:$I(this.a.a-c.a,_.be),left:$I(c.f-this.a.f,_.be),right:$I(this.a.g-c.g,_.be),height:$I(c.height,_.be),width:$I(c.width,_.be)},a.a)}b.style.visibility="visible";this.g.push(gJ(a.a))};_.v(zJ,kJ);zJ.prototype.init=function(){this.g=new wJ(this);this.h=!0};zJ.prototype.m=function(){var a=_.Cn(_.Wc);_.An(a,this.o);this.id&&(a.id=this.id);return a};_.v(BJ,zJ);
25
+ BJ.prototype.init=function(a){a:{var b=this.f;switch(b.widthUnits){case 0:b=b.width;break a;case _.zg:b=b.width/100*a.width;break a;default:throw Error(OI);}}var c=this.f;var d=c.viewportAnchorUnits;if(d===_.zg)c=c.viewportAnchorX/100*a.width-c.regionAnchorX/100*b;else if(0===d)c=c.viewportAnchorX-c.regionAnchorX;else throw Error(OI);d=a.height;var e=CJ(this,d,a.height);YI(this.A,this.a);YI({left:$I(c,_.be),top:$I(e,_.be),width:$I(b,_.be),height:$I(d,_.be)},this.a);this.f.writingMode&&YI({display:"flex",
26
+ "flex-direction":this.f.writingMode},this.a);this.f.displayAlign&&YI({"justify-content":this.f.displayAlign},this.a);b=_.u(this.f.cssClassList);for(c=b.next();!c.done;c=b.next())_.An(this.a,c.value);a:switch(b=this.f,b.heightUnits){case 0:b=b.height;break a;case _.zg:b=b.height/100*a.height;break a;case 2:b=b.height;d=new lJ(new _.yg(0,1,"Lorem ipsum",_.sg),{},{});c=d.a;this.a.appendChild(c);d.init(gJ(this.a));d=c.getBoundingClientRect().height;this.a.removeChild(c);b*=d;break a;default:throw Error(OI);
27
+ }a=CJ(this,b,a.height);YI({top:$I(a,_.be),height:$I(b,_.be)},this.a);this.g=new wJ(this,!0);this.h=!0};BJ.prototype.getId=function(){return this.f.id};EJ.prototype.appendRule=function(a){if(null!=this.a&&!this.j.some(function(c){return c===a})){var b=GJ(this,a);if(FJ(this,b)){try{this.a.insertRule(b,this.a.cssRules.length),this.f.debug("Added CSS rule "+b)}catch(c){this.f.error("An error occurred when adding a CSS rule: "+b)}this.j.push(a)}else this.f.warn("Stylesheet CLPP Subtitle Styles ignoring the CSS rule because it's not safe: "+b)}};
28
+ EJ.prototype.destroy=function(){var a=this;return _.B(function(b){if(null==a.a)return b["return"]();a.m.forEach(function(c){return c()});a.m=[];if(null!=a.a){for(;0<a.a.cssRules.length;)a.a.deleteRule(0);a.j=[]}document.head.removeChild(a.a.ownerNode);document.head.removeChild(a.g.ownerNode);a.a=null;a.g=null;a.f.debug("Stylesheet CLPP Subtitle Styles has been destroyed.");_.z(b)})};_.v(KJ,_.Vp);_.t=KJ.prototype;
29
+ _.t.append=function(a,b){if(null!=this.g&&0!==a.length){for(var c=_.u(b),d=c.next();!d.done;d=c.next())this.g.appendRule(d.value);a.sort(function(f,g){return f.startTime!==g.startTime?f.startTime-g.startTime:f.endTime-g.endTime});c=this.f.findIndex(function(f){return f.startTime>=a[0].startTime});0===c?this.f=[]:0<c&&this.f.splice(0,c);c={};d=_.u(a);for(var e=d.next();!e.done;c={od:c.od},e=d.next())c.od=e.value,this.f.some(function(f){return function(g){var h=f.od;return g.payload!==h.payload?!1:
30
+ g.startTime!==h.startTime?!1:g.endTime!==h.endTime?!1:!0}}(c))||this.f.push(c.od);this.j=null;JJ(this,!1)}};_.t.pb=function(){null==this.g||JJ(this,!0)};_.t.destroy=function(){var a=this;return _.B(function(b){if(1==b.a){if(null==a.g)return b["return"]();PJ(a);a.D.stop();return _.x(b,a.g.destroy(),2)}a.g=null;a.B.removeChild(a.a.a);a.a=null;a.o.stop();a.o=null;a.h=!1;_.z(b)})};
31
+ _.t.remove=function(a,b){if(null==this.g)return!1;this.f=this.f.filter(function(c){return c.startTime<a||c.endTime>=b});this.j=null;JJ(this,!0);return!0};_.t.isTextVisible=function(){return this.h};_.t.setTextVisibility=function(a){null!=this.g&&this.h!==a&&((this.h=a)?(this.D.bb(.25),this.L.enableResizeObserver&&this.o.start(),JJ(this,!0)):(this.D.stop(),this.o.stop(),PJ(this)))};_.t.oh=function(){JJ(this,!0)};_.C(RI,KJ);KJ.prototype.setTextVisibility=KJ.prototype.setTextVisibility;
32
+ KJ.prototype.isTextVisible=KJ.prototype.isTextVisible;KJ.prototype.remove=KJ.prototype.remove;KJ.prototype.destroy=KJ.prototype.destroy;KJ.prototype.append=KJ.prototype.append;QJ.prototype.ca=function(a){return!!a.enableHtmlCue&&!_.Wi()};QJ.prototype.create=function(a){return new KJ(a)};_.v(RJ,_.Bo);RJ.prototype.Ja=function(){_.xm("html",new QJ)};RJ.prototype.Ca=function(){};RJ.prototype.id=function(){return _.ye};_.C("clpp.htmlcue.HtmlCueComponent",RJ);};
33
33
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
34
34
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
35
35
  else{_=this.clpp._;(f.call(g,this));}