@castlabs/prestoplay 6.17.1 → 6.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +7 -7
  5. package/cjs/cl.cast.js +111 -111
  6. package/cjs/cl.conviva.js +33 -33
  7. package/cjs/cl.core.js +566 -558
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +75 -74
  10. package/cjs/cl.externs.js +46 -46
  11. package/cjs/cl.freewheel.js +24 -24
  12. package/cjs/cl.hls.js +71 -69
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +29 -29
  15. package/cjs/cl.ima.js +23 -23
  16. package/cjs/cl.mse.js +311 -311
  17. package/cjs/cl.muxdata.js +15 -15
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +14 -14
  20. package/cjs/cl.playlist.js +6 -6
  21. package/cjs/cl.sessions.js +15 -15
  22. package/cjs/cl.simid.js +15 -15
  23. package/cjs/cl.smooth.js +72 -72
  24. package/cjs/cl.thumbnails.js +26 -26
  25. package/cjs/cl.tizen.js +69 -69
  26. package/cjs/cl.ttml.js +28 -28
  27. package/cjs/cl.verimatrix.js +5 -5
  28. package/cjs/cl.vimond.js +13 -13
  29. package/cjs/cl.vr.js +19 -19
  30. package/cjs/cl.vtt.js +14 -14
  31. package/cjs/cl.youbora.js +18 -18
  32. package/cl.adobe.js +3 -3
  33. package/cl.airplay.js +3 -3
  34. package/cl.broadpeak.js +5 -5
  35. package/cl.cast.js +87 -87
  36. package/cl.conviva.js +27 -27
  37. package/cl.core.js +456 -450
  38. package/cl.crypto.js +8 -8
  39. package/cl.dash.js +70 -69
  40. package/cl.externs.js +46 -46
  41. package/cl.freewheel.js +19 -19
  42. package/cl.hls.js +72 -72
  43. package/cl.hlssmpte.js +5 -5
  44. package/cl.htmlcue.js +26 -26
  45. package/cl.ima.js +17 -17
  46. package/cl.mse.js +274 -273
  47. package/cl.muxdata.js +13 -13
  48. package/cl.onboard.js +4 -4
  49. package/cl.persistent.js +10 -10
  50. package/cl.playlist.js +5 -5
  51. package/cl.sessions.js +10 -10
  52. package/cl.simid.js +13 -13
  53. package/cl.smooth.js +59 -59
  54. package/cl.thumbnails.js +19 -19
  55. package/cl.tizen.js +57 -57
  56. package/cl.ttml.js +22 -22
  57. package/cl.verimatrix.js +4 -4
  58. package/cl.vimond.js +8 -8
  59. package/cl.vr.js +15 -15
  60. package/cl.vtt.js +12 -12
  61. package/cl.youbora.js +15 -15
  62. package/package.json +2 -2
  63. package/typings.d.ts +37 -3
@@ -1,28 +1,28 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var bT="clpp-freewheel",cT="clpp.freewheel.AdsManagerFactory",dT="freewheel",eT=function(){this.f=this.a=null},fT=function(){},gT=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""}},hT=function(a,b,c){this.h=a;this.f=b;this.a=c},iT=function(a){this.a=a},jT=function(a){this.g=new _.K("clpp.freewheel.AdsManager");this.m=a;this.h=new _.Uh;this.w=new tv.freewheel.SDK.AdManager;
3
- this.f=this.a=null;this.B=[];this.o=[];this.A=[];this.l=new _.Oj;this.j=null},kT=function(a){var b=[];typeof a.networkId!==_.k&&b.push("networkId");typeof a.serverUrl!==_.jg&&b.push("serverUrl");typeof a.profileId!==_.jg&&b.push("profileId");typeof a.videoAssetId!==_.jg&&typeof a.videoAssetId!==_.k&&b.push("videoAssetId");if(b.length)throw new _.P(1,9,12001,{missingKeys:b.join(", ")});},lT=function(){var a,b,c,d;return _.H(function(e){if(1==e.a)return a=new _.Et,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)})},oT=function(a){return _.H(function(b){if(a.B.length)return mT(a),a.f=a.B.shift(),a.f.play(),b.F(0);nT(a);return _.y(b,a.m.a.play(),0)})},pT=function(a){a.A.length?(mT(a),a.f=a.A.shift(),a.f.play()):nT(a)},mT=function(a){var b=a.m.pc(dT).Xc();b&&(a.m.getSurface().show(b),a.m.getSurface().hideMediaElement(),
5
- a.a.registerVideoDisplayBase(bT),a.m.isMuted()?a.setVolume(0):a.setVolume(a.m.getVolume()||1))},nT=function(a){var b=a.m.pc(dT).Xc();b&&a.m.getSurface().hide(b);a.m.getSurface().showMediaElement()},qT=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 hT(a.a,c,d)});a.m.trigger(new _.L(b,d))},rT=function(){this.cd=new _.K(cT)};_.x(eT,_.zu);_.t=eT.prototype;
6
- _.t.onPlayerCreated=function(a){if(window.tv&&tv.freewheel&&tv.freewheel.SDK)this.a=_.Wp(_.$d,{id:bT}),this.f=_.Wp(_.r,{"class":_.yd}),this.a.appendChild(this.f),a.getSurface().addElementToContainer(this.a,!0),a.getSurface().hide(this.a);else a.onError(new _.P(1,9,12E3))};_.t.onPlayerWillDestroy=function(a){this.a&&(a.getSurface().removeElementFromContainer(this.a),this.f=this.a=null)};_.t.id=function(){return dT};_.t.Xc=function(){return this.a};_.t.Kk=function(){return this.f};
7
- _.J("clpp.freewheel.FreeWheelPlugin",eT);eT.prototype.getAdVideo=eT.prototype.Kk;eT.prototype.getAdContainer=eT.prototype.Xc;eT.Id=dT;eT.AD_CONTAINER_ID=bT;fT.prototype.create=function(){return new eT};_.$q(new fT);_.t=hT.prototype;_.t.zb=function(){return"FreeWheel AdManager SDK"};_.t.Ab=function(){return tv.freewheel.SDK.version};_.t.Gb=function(){return 0};_.t.getId=function(){return this.a?this.a.getAdId():""};_.t.getCreativeId=function(){var a=(this.a||{})._creativeId;return typeof a===_.jg?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.tc=function(){return!1};_.t.Tb=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.Db=function(){return this.a?this.a.getActiveCreativeRendition().getWidth():0};_.t.Cb=function(){return this.a?this.a.getActiveCreativeRendition().getHeight():0};_.t.pb=function(){return 0};_.t.fb=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.fb()){case 0:return 0;case 2:return-1}return this.h.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL).indexOf(this.f)+1};_.t.Ub=function(){switch(this.fb()){case 0:return 0;case 2:return-1;default:return this.f.getTimePosition()}};_.t.Vb=function(){return this.a?this.f.getAdInstances().indexOf(this.a)+1:1};_.t.Fb=function(){return this.f.getAdCount()};_.t.getWrapperAdIds=function(){return[]};_.t.getWrapperAdSystems=function(){return[]};
11
- _.t.getWrapperCreativeIds=function(){return[]};hT.prototype.getWrapperCreativeIds=hT.prototype.getWrapperCreativeIds;hT.prototype.getWrapperAdSystems=hT.prototype.getWrapperAdSystems;hT.prototype.getWrapperAdIds=hT.prototype.getWrapperAdIds;hT.prototype.getSequenceLength=hT.prototype.Fb;hT.prototype.getPositionInSequence=hT.prototype.Vb;hT.prototype.getPodTimeOffset=hT.prototype.Ub;hT.prototype.getPodIndex=hT.prototype.getPodIndex;hT.prototype.getPodType=hT.prototype.fb;
12
- hT.prototype.getMediaBitrate=hT.prototype.pb;hT.prototype.getMediaHeight=hT.prototype.Cb;hT.prototype.getMediaWidth=hT.prototype.Db;hT.prototype.getMediaUrl=hT.prototype.getMediaUrl;hT.prototype.getClickThroughUrl=hT.prototype.Tb;hT.prototype.isBumper=hT.prototype.tc;hT.prototype.getSkipTimeOffset=hT.prototype.getSkipTimeOffset;hT.prototype.getDuration=hT.prototype.getDuration;hT.prototype.getTitle=hT.prototype.getTitle;hT.prototype.getAdvertiserName=hT.prototype.getAdvertiserName;
13
- hT.prototype.getAdSystem=hT.prototype.getAdSystem;hT.prototype.getApiFramework=hT.prototype.getApiFramework;hT.prototype.getCreativeId=hT.prototype.getCreativeId;hT.prototype.getId=hT.prototype.getId;hT.prototype.getTechnology=hT.prototype.Gb;hT.prototype.getAdManagerVersion=hT.prototype.Ab;hT.prototype.getAdManagerName=hT.prototype.zb;iT.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()}})};iT.prototype.Xb=function(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL).length};iT.prototype.rb=function(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL).length};
14
- iT.prototype.hasPostroll=iT.prototype.rb;iT.prototype.hasPreroll=iT.prototype.Xb;iT.prototype.getCuePoints=iT.prototype.getCuePoints;_.t=jT.prototype;
15
- _.t.load=function(){var a=this,b,c,d,e,f,g,h,l;return _.H(function(m){if(1==m.a){b=a.m.getConfiguration().freewheel||{};try{kT(b)}catch(n){return a.m.onError(n),a.l.resolve(),m["return"](a.l)}a.w.setNetwork(b.networkId);a.w.setServer(b.serverUrl);a.a=a.w.newContext();a.a.setProfile(b.profileId);typeof b.siteSectionId!==_.jg&&typeof b.siteSectionId!==_.k||a.a.setSiteSection(b.siteSectionId);return _.y(m,lT(),2)}c=m.f;a.a.setVideoAsset(b.videoAssetId,a.m.getDuration(),void 0,void 0,c);if(Array.isArray(b.pods))for(d=
16
- _.w(b.pods),e=d.next();!e.done;e=d.next())f=e.value,a.a.addTemporalSlot(f.id,gT(f.type),f.position,f.slotProfile,f.cuepointSequence,f.maxDuration,f.minDuration,f.acceptContentType);b.keyValues&&typeof b.keyValues===_.Xe&&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=_.w(b.parameters),h=g.next();!h.done;h=
17
- g.next())l=h.value,a.a.setParameter(l.name,l.value,l.level);a.h.on(a.a,tv.freewheel.SDK.EVENT_REQUEST_COMPLETE,a.qm.bind(a));a.h.on(a.a,tv.freewheel.SDK.EVENT_SLOT_STARTED,a.um.bind(a));a.h.on(a.a,tv.freewheel.SDK.EVENT_SLOT_ENDED,a.tm.bind(a));a.h.on(a.a,tv.freewheel.SDK.EVENT_AD,a.Kl.bind(a));a.h.on(a.m,_.rg,a.Bj.bind(a));a.h.on(a.m,_.gg,a.Aj.bind(a));a.a.submitRequest();return m["return"](a.l)})};_.t.start=function(){var a=this;return _.H(function(b){return _.y(b,oT(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 _.H(function(b){a.h.release();a.j&&(a.j.stop(),a.j=null);nT(a);a.a&&(a.a.dispose(),a.a=null);_.A(b)})};
19
- _.t.qm=function(a){var b=this;if(a.success)this.B=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL),this.o=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL),this.A=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL),this.m.trigger(new _.L(_.Oc,{adsTimeline:new iT(this.a)})),this.j=new _.Ct(this.m.getSurface(),function(c,d){return b.a.resize(c,d)},this.m.pc(dT).f);else this.m.onError(new _.P(1,9,10003,{errorType:0},
20
- void 0));this.l.resolve()};_.t.um=function(a){qT(this,_.xc,a);this.j.start()};_.t.tm=function(a){this.f=null;a=a.slot;qT(this,_.yc);this.j.stop();if(a)switch(a.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:oT(this);break;case tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL:nT(this);this.m.play();break;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:pT(this)}};
21
- _.t.Kl=function(a){var b=a.subType;this.g.debug("ad event",b);switch(b){case tv.freewheel.SDK.EVENT_AD_IMPRESSION:qT(this,_.Kc,a);qT(this,_.Dc,a);break;case tv.freewheel.SDK.EVENT_AD_IMPRESSION_END:qT(this,_.Lc,a);break;case tv.freewheel.SDK.EVENT_AD_FIRST_QUARTILE:qT(this,_.Cc,a);break;case tv.freewheel.SDK.EVENT_AD_MIDPOINT:qT(this,_.Fc,a);break;case tv.freewheel.SDK.EVENT_AD_THIRD_QUARTILE:qT(this,_.Mc,a);break;case tv.freewheel.SDK.EVENT_AD_COMPLETE:qT(this,_.Bc,a);break;case tv.freewheel.SDK.EVENT_AD_CLICK:qT(this,
22
- _.Ac,a);break;case tv.freewheel.SDK.EVENT_AD_PAUSE:qT(this,_.Gc,a);break;case tv.freewheel.SDK.EVENT_AD_RESUME:qT(this,_.Ic,a);break;case tv.freewheel.SDK.EVENT_AD_SKIPPED:qT(this,_.Jc,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_START:qT(this,_.zc,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_END:qT(this,_.Hc,a);break;case tv.freewheel.SDK.EVENT_ERROR:this.m.onError(new _.P(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.Bj=function(){var a=this;if(!this.f){var b=this.m.getPosition();if(this.f=this.o.find(function(d){return.5>Math.abs(b-d.getTimePosition())})||null){var c=this.o.findIndex(function(d){return d===a.f});this.o.splice(c,1);this.m.pause();mT(this);this.f.play()}}};
24
- _.t.Aj=function(a){if((a=a.detail)&&this.a)switch(a.currentState){case _.zp:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PLAYING);break;case _.yp:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PAUSED);break;case _.sp:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_COMPLETED);pT(this);break;case _.lp:case _.wp:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_STOPPED)}};jT.prototype.getPosition=jT.prototype.getPosition;jT.prototype.setVolume=jT.prototype.setVolume;
25
- jT.prototype.getVolume=jT.prototype.getVolume;jT.prototype.skip=jT.prototype.skip;jT.prototype.pause=jT.prototype.pause;jT.prototype.resume=jT.prototype.resume;jT.prototype.start=jT.prototype.start;rT.prototype.name=function(){return cT};rT.prototype.isSupported=function(a,b){return a.namespace()===_.Ed?!1:window.tv&&tv.freewheel&&tv.freewheel.SDK?!(!b||!b.freewheel):(this.cd.warn("FreeWheel SDK is not loaded."),!1)};rT.prototype.create=function(a){return new jT(a)};rT.prototype.create=rT.prototype.create;rT.prototype.isSupported=rT.prototype.isSupported;rT.prototype.name=rT.prototype.name;_.Tp(new rT);};
2
+ var f=function(window){var iT="clpp-freewheel",jT="clpp.freewheel.AdsManagerFactory",kT="freewheel",lT=function(){this.f=this.a=null},mT=function(){},nT=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""}},oT=function(a,b,c){this.h=a;this.f=b;this.a=c},pT=function(a){this.a=a},qT=function(a){this.g=new _.K("clpp.freewheel.AdsManager");this.m=a;this.h=new _.Xh;this.w=new tv.freewheel.SDK.AdManager;
3
+ this.f=this.a=null;this.B=[];this.o=[];this.A=[];this.l=new _.Rj;this.j=null},rT=function(a){var b=[];typeof a.networkId!==_.k&&b.push("networkId");typeof a.serverUrl!==_.mg&&b.push("serverUrl");typeof a.profileId!==_.mg&&b.push("profileId");typeof a.videoAssetId!==_.mg&&typeof a.videoAssetId!==_.k&&b.push("videoAssetId");if(b.length)throw new _.N(1,9,12001,{missingKeys:b.join(", ")});},sT=function(){var a,b,c,d;return _.I(function(e){if(1==e.a)return a=new _.Lt,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)})},vT=function(a){return _.I(function(b){if(a.B.length)return tT(a),a.f=a.B.shift(),a.f.play(),b.F(0);uT(a);return _.y(b,a.m.a.play(),0)})},wT=function(a){a.A.length?(tT(a),a.f=a.A.shift(),a.f.play()):uT(a)},tT=function(a){var b=a.m.rc(kT).Xc();b&&(a.m.getSurface().show(b),a.m.getSurface().hideMediaElement(),
5
+ a.a.registerVideoDisplayBase(iT),a.m.isMuted()?a.setVolume(0):a.setVolume(a.m.getVolume()||1))},uT=function(a){var b=a.m.rc(kT).Xc();b&&a.m.getSurface().hide(b);a.m.getSurface().showMediaElement()},xT=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 oT(a.a,c,d)});a.m.trigger(new _.L(b,d))},yT=function(){this.dd=new _.K(jT)};_.x(lT,_.Gu);_.t=lT.prototype;
6
+ _.t.onPlayerCreated=function(a){if(window.tv&&tv.freewheel&&tv.freewheel.SDK)this.a=_.Yp(_.be,{id:iT}),this.f=_.Yp(_.r,{"class":_.Ad}),this.a.appendChild(this.f),a.getSurface().addElementToContainer(this.a,!0),a.getSurface().hide(this.a);else a.onError(new _.N(1,9,12E3))};_.t.onPlayerWillDestroy=function(a){this.a&&(a.getSurface().removeElementFromContainer(this.a),this.f=this.a=null)};_.t.id=function(){return kT};_.t.Xc=function(){return this.a};_.t.Mk=function(){return this.f};
7
+ _.J("clpp.freewheel.FreeWheelPlugin",lT);lT.prototype.getAdVideo=lT.prototype.Mk;lT.prototype.getAdContainer=lT.prototype.Xc;lT.Id=kT;lT.AD_CONTAINER_ID=iT;mT.prototype.create=function(){return new lT};_.br(new mT);_.t=oT.prototype;_.t.Cb=function(){return"FreeWheel AdManager SDK"};_.t.Db=function(){return tv.freewheel.SDK.version};_.t.Jb=function(){return 0};_.t.getId=function(){return this.a?this.a.getAdId():""};_.t.getCreativeId=function(){var a=(this.a||{})._creativeId;return typeof a===_.mg?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.vc=function(){return!1};_.t.Wb=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.Gb=function(){return this.a?this.a.getActiveCreativeRendition().getWidth():0};_.t.Fb=function(){return this.a?this.a.getActiveCreativeRendition().getHeight():0};_.t.qb=function(){return 0};_.t.gb=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.gb()){case 0:return 0;case 2:return-1}return this.h.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL).indexOf(this.f)+1};_.t.Xb=function(){switch(this.gb()){case 0:return 0;case 2:return-1;default:return this.f.getTimePosition()}};_.t.Yb=function(){return this.a?this.f.getAdInstances().indexOf(this.a)+1:1};_.t.Ib=function(){return this.f.getAdCount()};_.t.getWrapperAdIds=function(){return[]};_.t.getWrapperAdSystems=function(){return[]};
11
+ _.t.getWrapperCreativeIds=function(){return[]};oT.prototype.getWrapperCreativeIds=oT.prototype.getWrapperCreativeIds;oT.prototype.getWrapperAdSystems=oT.prototype.getWrapperAdSystems;oT.prototype.getWrapperAdIds=oT.prototype.getWrapperAdIds;oT.prototype.getSequenceLength=oT.prototype.Ib;oT.prototype.getPositionInSequence=oT.prototype.Yb;oT.prototype.getPodTimeOffset=oT.prototype.Xb;oT.prototype.getPodIndex=oT.prototype.getPodIndex;oT.prototype.getPodType=oT.prototype.gb;
12
+ oT.prototype.getMediaBitrate=oT.prototype.qb;oT.prototype.getMediaHeight=oT.prototype.Fb;oT.prototype.getMediaWidth=oT.prototype.Gb;oT.prototype.getMediaUrl=oT.prototype.getMediaUrl;oT.prototype.getClickThroughUrl=oT.prototype.Wb;oT.prototype.isBumper=oT.prototype.vc;oT.prototype.getSkipTimeOffset=oT.prototype.getSkipTimeOffset;oT.prototype.getDuration=oT.prototype.getDuration;oT.prototype.getTitle=oT.prototype.getTitle;oT.prototype.getAdvertiserName=oT.prototype.getAdvertiserName;
13
+ oT.prototype.getAdSystem=oT.prototype.getAdSystem;oT.prototype.getApiFramework=oT.prototype.getApiFramework;oT.prototype.getCreativeId=oT.prototype.getCreativeId;oT.prototype.getId=oT.prototype.getId;oT.prototype.getTechnology=oT.prototype.Jb;oT.prototype.getAdManagerVersion=oT.prototype.Db;oT.prototype.getAdManagerName=oT.prototype.Cb;pT.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()}})};pT.prototype.Zb=function(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL).length};pT.prototype.sb=function(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL).length};
14
+ pT.prototype.hasPostroll=pT.prototype.sb;pT.prototype.hasPreroll=pT.prototype.Zb;pT.prototype.getCuePoints=pT.prototype.getCuePoints;_.t=qT.prototype;
15
+ _.t.load=function(){var a=this,b,c,d,e,f,g,h,l;return _.I(function(m){if(1==m.a){b=a.m.getConfiguration().freewheel||{};try{rT(b)}catch(n){return a.m.onError(n),a.l.resolve(),m["return"](a.l)}a.w.setNetwork(b.networkId);a.w.setServer(b.serverUrl);a.a=a.w.newContext();a.a.setProfile(b.profileId);typeof b.siteSectionId!==_.mg&&typeof b.siteSectionId!==_.k||a.a.setSiteSection(b.siteSectionId);return _.y(m,sT(),2)}c=m.f;a.a.setVideoAsset(b.videoAssetId,a.m.getDuration(),void 0,void 0,c);if(Array.isArray(b.pods))for(d=
16
+ _.w(b.pods),e=d.next();!e.done;e=d.next())f=e.value,a.a.addTemporalSlot(f.id,nT(f.type),f.position,f.slotProfile,f.cuepointSequence,f.maxDuration,f.minDuration,f.acceptContentType);b.keyValues&&typeof b.keyValues===_.$e&&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=_.w(b.parameters),h=g.next();!h.done;h=
17
+ g.next())l=h.value,a.a.setParameter(l.name,l.value,l.level);a.h.on(a.a,tv.freewheel.SDK.EVENT_REQUEST_COMPLETE,a.tm.bind(a));a.h.on(a.a,tv.freewheel.SDK.EVENT_SLOT_STARTED,a.xm.bind(a));a.h.on(a.a,tv.freewheel.SDK.EVENT_SLOT_ENDED,a.wm.bind(a));a.h.on(a.a,tv.freewheel.SDK.EVENT_AD,a.Nl.bind(a));a.h.on(a.m,_.ug,a.Dj.bind(a));a.h.on(a.m,_.jg,a.Cj.bind(a));a.a.submitRequest();return m["return"](a.l)})};_.t.start=function(){var a=this;return _.I(function(b){return _.y(b,vT(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 _.I(function(b){a.h.release();a.j&&(a.j.stop(),a.j=null);uT(a);a.a&&(a.a.dispose(),a.a=null);_.B(b)})};
19
+ _.t.tm=function(a){var b=this;if(a.success)this.B=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL),this.o=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL),this.A=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL),this.m.trigger(new _.L(_.Qc,{adsTimeline:new pT(this.a)})),this.j=new _.Jt(this.m.getSurface(),function(c,d){return b.a.resize(c,d)},this.m.rc(kT).f);else this.m.onError(new _.N(1,9,10003,{errorType:0},
20
+ void 0));this.l.resolve()};_.t.xm=function(a){xT(this,_.zc,a);this.j.start()};_.t.wm=function(a){this.f=null;a=a.slot;xT(this,_.Ac);this.j.stop();if(a)switch(a.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:vT(this);break;case tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL:uT(this);this.m.play();break;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:wT(this)}};
21
+ _.t.Nl=function(a){var b=a.subType;this.g.debug("ad event",b);switch(b){case tv.freewheel.SDK.EVENT_AD_IMPRESSION:xT(this,_.Mc,a);xT(this,_.Fc,a);break;case tv.freewheel.SDK.EVENT_AD_IMPRESSION_END:xT(this,_.Nc,a);break;case tv.freewheel.SDK.EVENT_AD_FIRST_QUARTILE:xT(this,_.Ec,a);break;case tv.freewheel.SDK.EVENT_AD_MIDPOINT:xT(this,_.Hc,a);break;case tv.freewheel.SDK.EVENT_AD_THIRD_QUARTILE:xT(this,_.Oc,a);break;case tv.freewheel.SDK.EVENT_AD_COMPLETE:xT(this,_.Dc,a);break;case tv.freewheel.SDK.EVENT_AD_CLICK:xT(this,
22
+ _.Cc,a);break;case tv.freewheel.SDK.EVENT_AD_PAUSE:xT(this,_.Ic,a);break;case tv.freewheel.SDK.EVENT_AD_RESUME:xT(this,_.Kc,a);break;case tv.freewheel.SDK.EVENT_AD_SKIPPED:xT(this,_.Lc,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_START:xT(this,_.Bc,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_END:xT(this,_.Jc,a);break;case tv.freewheel.SDK.EVENT_ERROR:this.m.onError(new _.N(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.Dj=function(){var a=this;if(!this.f){var b=this.m.getPosition();if(this.f=this.o.find(function(d){return.5>Math.abs(b-d.getTimePosition())})||null){var c=this.o.findIndex(function(d){return d===a.f});this.o.splice(c,1);this.m.pause();tT(this);this.f.play()}}};
24
+ _.t.Cj=function(a){if((a=a.detail)&&this.a)switch(a.currentState){case _.Bp:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PLAYING);break;case _.Ap:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PAUSED);break;case _.up:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_COMPLETED);wT(this);break;case _.np:case _.yp:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_STOPPED)}};qT.prototype.getPosition=qT.prototype.getPosition;qT.prototype.setVolume=qT.prototype.setVolume;
25
+ qT.prototype.getVolume=qT.prototype.getVolume;qT.prototype.skip=qT.prototype.skip;qT.prototype.pause=qT.prototype.pause;qT.prototype.resume=qT.prototype.resume;qT.prototype.start=qT.prototype.start;yT.prototype.name=function(){return jT};yT.prototype.isSupported=function(a,b){return a.namespace()===_.Hd?!1:window.tv&&tv.freewheel&&tv.freewheel.SDK?!(!b||!b.freewheel):(this.dd.warn("FreeWheel SDK is not loaded."),!1)};yT.prototype.create=function(a){return new qT(a)};yT.prototype.create=yT.prototype.create;yT.prototype.isSupported=yT.prototype.isSupported;yT.prototype.name=yT.prototype.name;_.Vp(new yT);};
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,73 +1,75 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var lJ="Could not parse MP4 segment start time.",mJ="Failed to infer discontinuity number",nJ="Guessing audio-only",oJ="METHOD",pJ="SAMPLE-AES-CTR",qJ="Setting playlist start time to ",rJ="Two EXT-X-KEY tags, one with METHOD\x3dAES-128 are applied to one ",sJ="application/vnd.apple.mpegurl",tJ="sample",uJ="whole-segment",vJ=function(a){if(1>a.a)throw _.Hm();--a.a},wJ=function(a,b,c,d){if(1===b){if(!d||0===d.length)throw new _.P(_.Q,4,4043,"Media playlist must have at least one segment!");if(null==
3
- d[0].a)throw new _.P(_.Q,4,4043,"Media playlist must have at least one full segment!");}this.f=a;this.a="";this.type=b;this.X=c;this.U=1===b?d:null},xJ=function(a,b,c){c=void 0===c?[]:c;this.X=b;this.a=a;this.f=c;this.ga=-1},yJ=function(a){a=_.w(a);for(var b=a.next();!b.done;b=a.next())if(b=b.value,b.startsWith("#EXT-")&&(b=_.Ej(0,b),_.cv.has(b.name)))return 1;return 0},zJ=function(a,b){var c=new Map,d=new URL(b);a.forEach(function(e){var f=_.Zi(e,"NAME"),g=_.Zi(e,"QUERYPARAM");if(f)g=_.$i(e,"VALUE"),
4
- c.set(f,g);else if(g){f=d.searchParams.get(g);if(null==f)throw new _.P(_.Q,4,4044,"Query param '"+g+"' missing in playlist URI.");if(!f)throw new _.P(_.Q,4,4044,"Query param '"+g+"' has no associated value in playlist URI.");c.set(g,decodeURIComponent(f))}});return c},AJ=function(a,b){return a.replace(/\{\$([a-zA-Z0-9_-]+)\}/g,function(c,d){var e=b.get(d);if(null==e)throw new _.P(_.Q,4,4044,"Undefined variable '"+d+"'");return e})},BJ=function(a,b){a.forEach(function(c){c.attributes.forEach(function(d){d.value=
5
- AJ(d.value,b)})})},CJ=function(a,b,c){BJ(a,c);b.forEach(function(d){d.a&&(d.a=AJ(d.a,c));BJ(d.X,c);BJ(d.f,c)})},DJ=function(){this.f=0;this.a=new Map},GJ=function(a,b,c){b=b.trim().split(/\n+/m).map(function(d){return d.trim()}).filter(function(d){return d.length&&!_.Y.Ch(d)});if(!/^#EXTM3U($|[ \t\n])/m.test(b[0]))throw new _.P(_.Q,4,4015);return 0===yJ(b)?EJ(a,b,c):FJ(a,b,c)},FJ=function(a,b,c){for(var d=[],e=1;e<b.length;){var f=HJ(a,b[e]);if(_.dv.has(f.name))break;d.push(f);e++}b=IJ(a,c,b.slice(e));
6
- e=b.U;d=d.concat(b.X);a=JJ(a,d,c);CJ(d,e,a);return new wJ(c,1,d,b.U)},EJ=function(a,b,c){for(var d=[],e=1;e<b.length;e++){var f=HJ(a,b[e]);d.push(f);if(f.name===_.Xa){var g=b[e+1];if(!g)throw new _.P(_.Q,4,4044,"EXT-X-STREAM-INF is not followed by a URI.");f.attributes.push(new _.aj(_.fc,g));e++}}b=_.Y.Sb(d,"EXT-X-DEFINE");_.Y.yi(b);b=zJ(b,c);a.a=b;CJ(d,[],a.a);return new wJ(c,0,d)},IJ=function(a,b,c){var d=[],e=[],f=[],g=[];c.forEach(function(h){/^(#EXT)/.test(h)?(h=HJ(a,h),_.cv.has(h.name)||_.fv.has(h.name)?
7
- d.push(h):_.ev.has(h.name)?"EXT-X-PART"===h.name?g.push(h):h.name===_.Ua&&"PART"===_.Zi(h,_.dc)&&g.push(h):f.push(h)):_.Y.Ch(h)||(h=_.Y.td(b,h.trim(),!1),e.push(new xJ(h,f,g)),f=[],g=[])});0<g.length&&e.push(new xJ(null,f,g));return{U:e,X:d}},HJ=function(a,b){return _.Ej(a.f++,b)},JJ=function(a,b,c){b=_.Y.Sb(b,"EXT-X-DEFINE");_.Y.yi(b);var d=zJ(b,c);b.map(function(e){return _.Zi(e,"IMPORT")}).filter(Boolean).forEach(function(e){var f=a.a.get(e);if(null==f)throw new _.P(_.Q,4,4044,"Cannot import variable '"+
8
- e+"' as it is not defined in the master playlist");d.set(e,f)});return d},KJ=function(a){var b=void 0===b?0:b;return 0>a?[]:Array.from({length:a},function(c,d){return d+b})},LJ=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},MJ=function(){this.a=new Map;this.f=new Map},NJ=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]<<
9
- 21|l[1]<<14|l[2]<<7|l[3]}function d(){throw new _.P(_.Q,4,4030);}LJ(a)||d();var e=10;a[5]&64&&(e=e+4+c(a.subarray(10,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}}LJ(a,e)||d();
10
- e+=10;e+=f}while(e<a.byteLength);return d()},OJ=function(a){for(;a.getPosition()<a.Ha()-1;){var b=a.getPosition();if(71===_.Im(a))return vJ(a),b}return-1},PJ=function(a){function b(){d.seek(e+188);f=_.Im(d);71!==f&&(d.seek(e+192),f=_.Im(d));71!==f&&(d.seek(e+204),f=_.Im(d));71!==f&&c();vJ(d)}function c(){throw new _.P(_.Q,4,4030);}var d=new _.Fm(new DataView(a),!1),e=0,f=0;e=OJ(d);0>e&&(_.Bv.error("Unable to find sync byte in TS after scanning."),c());for(;;)if(e=d.getPosition(),f=_.Im(d),71!==f&&
11
- c(),a=_.Jm(d),8191===(a&8191))b();else if(a&16384)if(a=(_.Im(d)&48)>>4,0!==a&&2!==a||c(),3===a&&(a=_.Im(d),d.skip(a)),1!==_.Km(d)>>8)b();else{d.skip(3);a=_.Im(d)>>6;0!==a&&1!==a||c();0===_.Im(d)&&c();a=_.Im(d);var g=_.Jm(d),h=_.Jm(d);return(1073741824*((a&14)>>1)+((g&65534)<<14|(h&65534)>>1))/9E4}else b()},QJ=function(a,b){var c=null,d=0;try{(new _.Pm).M(_.Te,_.Qm).M(_.sg,_.Qm).M(_.Oe,_.Qm).Y("mdhd",function(g){g.reader.skip(0===g.version?8:16);d=_.Km(g.reader);g.parser.stop()}).parse(b,!0)}catch(g){c=
12
- g}if(c||!d)throw _.Bv.error("Unable to find timescale in init segment!"),new _.P(_.Q,4,4030,lJ,c);var e=0,f=!1;try{(new _.Pm).M("moof",_.Qm).M("traf",_.Qm).Y("tfdt",function(g){var h=d;if(0===g.version)h=_.Km(g.reader)/h;else{var l=_.Km(g.reader),m=_.Km(g.reader);if(!(2097151>=l||h>=Math.pow(2,12)))throw Error("Cannot accurately parse MP4 timestamp, base time is too high and timescale is \x3c\x3d 2^12");h=l/h*Math.pow(2,32)+m/h}e=h;f=!0;g.parser.stop()}).parse(a,!0)}catch(g){c=g}if(c||!f)throw new _.P(_.Q,
13
- 4,4030,lJ,c);return e},TJ=function(a){var b=_.$i(a,oJ);if(!RJ.includes(b))return SJ.error("PlayReady in HLS is only supported with [",RJ.join(", "),"], not",b),null;a=_.$i(a,_.fc);b=_.ku(a);a=null;b=_.lj(b.data);try{a=_.rC(_.Sn(b))}catch(c){a=b}return _.EC(_.Rd,[{initDataType:_.td,initData:a}],"")},UJ=function(a){this.g=new _.K("clpp.hls.MediaReader");this.f=a;this.a={attemptParameters:_.Gj()}},WJ=function(a,b,c,d,e,f){var g,h,l,m,n,p,q,u;return _.H(function(v){switch(v.a){case 1:a.g.debug("Fetching segment to find start time");
14
- if("audio/mpeg"===d||d===_.dd||d===_.cd)return v["return"](0);g=f;if(d!==_.bd){v.F(2);break}return _.y(v,VJ(a,c,g),3);case 3:return h=v.f,l=_.lj(h.data),LJ(l)?v["return"](NJ(l)):v["return"](PJ(h.data));case 2:if(d!==_.Jg&&d!==_.ed){v.F(4);break}m=[VJ(a,c,g)];b&&m.push(VJ(a,b,!0));return _.y(v,Promise.all(m),5);case 5:return n=v.f,p=n[0],q=n[1]||n[0],v["return"](QJ(p.data,q.data));case 4:if(d!==_.Ig){v.F(6);break}return _.y(v,VJ(a,c,g),7);case 7:return u=v.f,v["return"](PJ(u.data));case 6:if(!_.Ar((d.split("/")[0]||
15
- "")+'/mp4;codecs\x3d"'+e+'"'))return v["return"](0);throw new _.P(_.Q,4,4030);}})},VJ=function(a,b,c){var d,e,f,g,h,l,m;return _.H(function(n){switch(n.a){case 1:return d=b.f(),e=_.fD(b.Ra(),b.wa,b.wa+2048-1,a.a.attemptParameters),e.type=2,f=_.fD(b.Ra(),b.wa,b.ka,a.a.attemptParameters),f.type=2,d&&(f.keyInfo=d),_.B(n,2),g=c?f:e,_.y(n,a.f(g),4);case 4:return h=n.f,n["return"](h);case 2:l=_.E(n);if(7001===l.code||c)throw l;a.g.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 pre-flights.",
16
- e.uris[0]);_.B(n,5);return _.y(n,a.f(f),7);case 7:return n["return"](n.f);case 5:throw m=_.E(n),a.g.error("Failed to fetch media segment to parse its start timestamp.",f.uris[0],m),new _.P(_.Q,4,4030,"Failed to fetch the media segment.");}})},XJ=function(a){this.streams=a},YJ=function(a,b){a.streams.forEach(function(c){c.ef=b})},ZJ=function(a,b){a.streams.forEach(function(c){c.width=b})},$J=function(a,b){a.streams.forEach(function(c){c.height=b})},aK=function(a,b){a.streams.forEach(function(c){c.frameRate=
17
- b})},bK=function(a,b){a.streams.forEach(function(c){c.bandwidth=b})},cK=function(a,b){var c=a.map(function(d){return d.streams[b]});return c.some(function(d){return null==d})?null:c},dK=function(a){this.a=a},eK=function(a,b){var c=a.map(function(d){return d.a[b]});return c.some(function(d){return null==d})?null:c},fK=function(a,b){var c=new Set(a.map(function(d){return d.ga}));return b.filter(function(d){return!c.has(d.ga)})},iK=function(a,b){for(;a[0].ga<b[0].ga;)a.splice(0,1);var c=a[0],d=b[0];
18
- gK(c,d)||hK(c,d);var e=a.length-1;c=a[e];d=b[e];0<e&&!gK(c,d)&&hK(c,d);for(c=e+1;c<b.length;)a.push(b[c]),c++},jK=function(a,b){var c=a[a.length-1],d=b.findIndex(function(f){return f.ga===c.ga}),e=b[d];gK(c,e)||hK(c,e);for(d+=1;d<b.length;d++)a.push(b[d])},oK=function(a,b,c,d,e){var f=b[0].length();f=KJ(f).map(function(g){var h=eK(b,g)||[],l=cK(c,g)||[];g=cK(d,g)||[];var m=_.ch(kK(h)).concat(_.ch(l),_.ch(g)).filter(Boolean);lK(m);var n=m[0];m=n.ga;n=n.duration;return{configurationId:a,variants:h,
19
- textStreams:l,thumbStreams:g,startTime:0,id:"P"+m,endTime:n,duration:n,ga:m}});e&&mK(f[0]);nK(f);return f},kK=function(a){a=new Set(a.flatMap(function(b){return[b.video,b.audio]}).filter(Boolean));return Array.from(a)},mK=function(a){var b=kK(a.variants)[0].U[0].ya;a.startTime+=b;a.endTime+=b},nK=function(a){for(var b=0;b<a.length;b++){var c=a[b],d=a[b-1];c.startTime=d?d.endTime:c.startTime;c.endTime=c.startTime+c.duration}},gK=function(a,b){return a.startTime===b.startTime&&a.endTime===b.endTime},
20
- hK=function(a,b){a.startTime=b.startTime;a.endTime=b.endTime;a.duration=b.duration;pK(a.variants,b.variants);qK(_.Y.Ne(a),_.Y.Ne(b))},pK=function(a,b){var c=new Map(a.map(function(d){return[_.Y.Zg(d),d]}));b.forEach(function(d){c.get(_.Y.Zg(d)).drmInfos=d.drmInfos})},qK=function(a,b){var c=new Map(a.map(function(d){return[d.Lb,d]}));b.forEach(function(d){var e=c.get(d.Lb);e.U=d.U;e.segmentIndex.replace(d.U);e.$b=d.$b;e.De=d.De;e.duration=d.duration;e.dh=d.dh;e.encrypted=d.encrypted;e.drmInfos=d.drmInfos;
21
- e.keyId=d.keyId})},lK=function(a){var b=rK(a);a.forEach(function(c){_.aD(c.segmentIndex,b);c.duration=b;c.De=c.$b+b})},rK=function(a){var b=Infinity;_.Y.Ak(a).forEach(function(c){b=Math.min(b,c.duration)});return b},sK=function(){var a=this;this.a=this.C=null;this.N=1;this.f=new MJ;this.w="";this.K=new DJ;this.D=0;this.j=null;this.h=new _.Wk(function(){a.Ib()});this.l=_.mc;this.o=null;this.A=new _.Sj;this.B=null;this.g=new _.K("clpp.hls.HlsParser");this.H=new Map;this.L=new UJ(this.pf.bind(this));
22
- this.J=!1;this.G=null;this.I=!1},tK=function(a){if(null===a.j)return[];a=a.j;return[a.audio,a.video].filter(function(b){return b}).map(function(b){return b.Lb})},zK=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,u,v,z,C,I,F,D;return _.H(function(G){if(1==G.a){c=_.Kp;d=_.Y;e=uK(a,b,a.w,"");if(1===e.type){f=e.U[0].a;var M=_.Vi(f)||"";g=null!=_.Wi.video[M]?_.r:null!=_.Wi.audio[M]?_.ad:null;h="";g===c.VIDEO?h="avc1.42E01E":g===c.AUDIO&&(h="mp4a.40.2");M=a.K;var N=a.w,U=a.a.hlsDefaultCodecs||h,oa=[],Ca=[];Ca.push(new _.aj(_.na,
23
- "0"));Ca.push(new _.aj(_.fc,N));U.length&&Ca.push(new _.aj(_.sa,U));oa.push(new _.Yi(M.f++,_.Xa,Ca));e=new wJ(N,0,oa)}l=_.Y.Hm(e.X);return _.y(G,vK(a,l),2)}m=G.f;n=m.periods;p=m.ji;q=m.wi;if(!a.C)throw new _.P(_.Q,7,7001);u=d.Vk(n[0]);wK(a,n);M=!0;N=null;U=0;xK(a)||(M=!1,N=0,U=u.delay);N=new _.iD(a.a.timeline||{},N,U,!0,void 0,!!a.a.lowLatencyMode);_.lD(N,M);yK(N,n);p&&_.kD(N,p);v=N;if(!xK(a)){a.D=u.Ac;U=0;N=_.w(a.f.values());for(M=N.next();!M.done;M=N.next())U=Math.max(U,M.value.streams[0].$b);for(N=
24
- 0;95443.7176888889<=U;)N+=95443.7176888889,U-=95443.7176888889;if(N)for(a.g.debug("Offsetting live streams by",N,"to compensate for rollover"),U=_.w(a.f.values()),M=U.next();!M.done;M=U.next())M=M.value.streams[0],95443.7176888889>M.$b?(a.g.debug("Offset applied to",M.type),M.segmentIndex.offset(N)):a.g.debug("Offset NOT applied to",M.type)}M=_.Y.Wk(n);"LIVE"===a.l||"EVENT"===a.l?(M=Math.max(M,v.I),isNaN(a.a.availabilityWindowOverride)||(M=a.a.availabilityWindowOverride),v.A=M):a.l===_.mc&&(v.f=M);
25
- if(q)for(z=_.w(q),C=z.next();!C.done;C=z.next())I=C.value,F={configurationId:a.C.configurationId,schemeIdUri:I.schemeIdUri,Xa:I.Xa,value:"",startTime:I.startTime,endTime:I.endTime,id:I.id,type:_.ci,eventElement:null},a.C.onTimelineCueAdded(F);D={presentationTimeline:v,adaptedPeriods:_.ch(n).concat(),periods:n,minBufferTime:0};a.g.debug("HLS playlist parsed",D);return G["return"](D)})},CK=function(a,b){var c,d,e,f,g,h,l,m,n;return _.H(function(p){if(1==p.a)return c=_.Y,_.y(p,AK(a,b),2);d=p.f;e=d.textStreams;
26
- f=d.thumbStreams;g=d.Ti;h=a.o.periods[0].variants;a.a.lowLatencyMode&&null!==a.j&&(h=h.filter(function(q){return q.id===a.j.id}));l=h.map(function(q){var u=c.ih(q.audio,g),v=c.ih(q.video,g);q=BK(a,u,v,q.bandwidth);if(!q)throw new _.P(_.Q,4,4047,{message:"Video and audio are encrypted in an incompatible way.",jo:v?v.Wb():void 0,audio:u?u.Wb():void 0});return q});m=a.C.configurationId;n=oK(m,l,e,f,!0);return p["return"](n)})},AK=function(a,b){var c,d,e,f,g,h,l,m,n;return _.H(function(p){if(1==p.a)return c=
27
- _.Kp,d=function(q){return q.stream.streams[0].type===c.VIDEO||q.stream.streams[0].type===c.AUDIO},e=b.filter(d),f=b.filter(function(q){return!d(q)}),g=function(q){q=q.map(function(u){var v=u.stream.streams[0];u=Object.assign({},{playlist:u.playlist},{language:v.language,channelsCount:v.channelsCount,spatialAudio:v.spatialAudio,closedCaptions:v.closedCaptions,primary:v.primary,kind:v.kind||null,groupId:v.groupId,type:v.type,codecs:v.codecs,name:v.originalId,uri:v.Lb,Qe:{width:v.width,height:v.height,
28
- frameRate:v.frameRate}});return DK(a,u)});return Promise.all(q)},_.y(p,g(e),2);if(3!=p.a)return h=p.f,_.y(p,g(f),3);l=p.f;EK(a,h.concat(l));m=l.filter(function(q){return q.streams[0].type===c.Mi});n=l.filter(function(q){return q.streams[0].type===c.IMAGE});return p["return"]({textStreams:m,thumbStreams:n,Ti:h})})},EK=function(a,b){b.forEach(function(c){a.f.a.set(c.Wb(),c)})},vK=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,u;return _.H(function(v){switch(v.a){case 1:return c=_.Y.Am(b.dd.closedCaptions),
29
- d=FK(a,b.be),_.y(v,GK(a,b),2);case 2:return e=v.f,f=Object.values(e).flat().map(function(z){return z.playlist}),HK(a,f),_.y(v,IK(a,e.yg,d),3);case 3:return g=v.f,_.y(v,JK(a,e.be,g,c),4);case 4:return h=v.f,_.y(v,KK(a,e.jn,d),5);case 5:return l=v.f,_.y(v,LK(a,e.Ef),6);case 6:return m=v.f,n=MK(a,e),p=a.C.configurationId,q=oK(p,h,l,m,!xK(a)),a.C.filterAllPeriods(q),xK(a)?(u=null,null!=n&&(u=NK(f,n)),v["return"]({periods:q,ji:n,wi:u})):v["return"]({periods:q,ji:n,wi:null})}})},wK=function(a,b){xK(a)||
30
- 2!==a.a.timeline.version||(a.G||(a.G=b[0].startTime),_.$E(b,-a.G))},NK=function(a,b){var c=a.find(function(d){return null!==_.Y.Qa(d.X,_.Ka)});return c?c.X.filter(function(d){return d.name===_.Ka}).map(function(d){return _.Y.Bm(d,b)}).filter(Boolean):null},MK=function(a,b){var c=_.ch(b.be).concat(_.ch(b.yg)).map(function(e){return e.playlist}).flatMap(function(e){return e.U[0].X});c=_.Y.Qa(c,_.Va);if(!c)return null;var d=(new Date(c.value)).getTime();return isNaN(d)?(a.g.warn("Failed to parse EXT-X-PROGRAM-DATE-TIME tag value (value: "+
31
- (c.value+").")),null):d/1E3},GK=function(a,b){var c,d,e,f,g,h;return _.H(function(l){if(1==l.a)return _.y(l,Promise.all([OK(a,b.dd.Si),OK(a,b.dd.kn),OK(a,b.be),OK(a,b.Ef)]),2);c=l.f;d=_.w(c);e=d.next().value;f=d.next().value;g=d.next().value;h=d.next().value;return l["return"]({yg:e,jn:f,be:g,Ef:h})})},QK=function(a,b){return Promise.all(b.map(function(c){return PK(a,c)}))},FK=function(a,b){for(var c=new Map,d=_.w(b),e=d.next();!e.done;e=d.next()){var f=e.value,g=_.Zi(f,"AUDIO");e=_.Zi(f,_.lc);var h=
32
- _.Zi(f,_.Wb);f=RK(a,f);if(h){var l=_.Ui(_.R,f);c.set(h,l);h=f.indexOf(l);-1<h&&f.splice(h,1)}g&&(h=SK(_.ad,f),c.set(g,h));e&&(g=SK(_.r,f),c.set(e,g))}return c},KK=function(a,b,c){return Promise.all(b.map(function(d){return TK(a,d,c)}))},LK=function(a,b){return Promise.all(b.map(function(c){return UK(a,c)}))},IK=function(a,b,c){var d,e;return _.H(function(f){if(1==f.a){if(0===b.length)return f["return"](new Map);d=[TK(a,b[0],c)];return _.y(f,d[0],2)}if(3!=f.a)return d=d.concat(b.slice(1).map(function(g){return TK(a,
33
- g,c)})),_.y(f,Promise.all(d),3);e=f.f;return f["return"](_.Y.nn(e))})},JK=function(a,b,c,d){var e,f,g,h,l,m,n,p,q,u,v;return _.H(function(z){if(1==z.a){e=new Set;f=_.ch(b).concat();g=0;h=Infinity;for(l=0;l<f.length;++l)m=Number(_.$i(f[l].tag,_.na)),m<h&&(h=m,g=l);n=f.splice(g,1).pop();return _.y(z,VK(a,n,c,d,e),2)}if(3!=z.a)return p=z.f,q=f.map(function(C){return VK(a,C,c,d,e)}),_.y(z,Promise.all(q),3);u=z.f;u.splice(g,0,p);v=u.reduce(_.BC,[]);return z["return"](v)})},VK=function(a,b,c,d,e){var f,
34
- g,h,l,m,n;return _.H(function(p){return 1==p.a?(f=_.Y,g=b,h=g.tag,l=Number(_.$i(h,_.na)),m=f.Lm(h),_.y(p,WK(a,b,m,c,d),2)):(n=p.f)?p["return"](XK(a,n,l,e)):p["return"]([])})},WK=function(a,b,c,d,e){var f,g,h,l,m,n,p,q,u,v,z,C,I,F,D,G,M;return _.H(function(N){if(1==N.a)return f=_.Kp,g=b,h=g.tag,l=g.playlist,m=RK(a,h),n=_.Zi(h,"AUDIO"),p=_.Zi(h,_.lc),u=(q=n||p)&&d.has(q)?d.get(q):[],v={audio:n?u:[],video:p?u:[]},a.g.debug("Guessing stream type for",h.toString()),C=!1,I=l.a,F=v.audio.find(function(U){return U.Lb===
35
- I}),D=_.Ui(f.VIDEO,m),G=c||D,1!==m.length||G?!u.length&&1<m.length?(a.g.debug("Guessing multiplexed audio+video"),z=f.VIDEO,m=[m.join(",")]):v.audio.length&&F?(a.g.debug(nJ),z=f.AUDIO,C=!0):v.video.length?(a.g.debug(nJ),z=f.AUDIO):(a.g.debug("Guessing video-only"),z=f.VIDEO):(z=f.AUDIO,a.g.debug(nJ)),M=null,C?N.F(2):_.y(N,YK(a,b,m,z,e,c),3);2!=N.a&&(M=N.f);if(null==M)return N["return"](null);v[z]=[M];z===f.AUDIO&&c&&u.forEach(function(U){ZJ(U,c.width);$J(U,c.height);aK(U,c.frameRate)});_.Y.wk(v);
36
- return N["return"](v)})},XK=function(a,b,c,d){var e=b.video,f=b.audio;e=0<e.length?e:[null];b=[];f=_.w(0<f.length?f:[null]);for(var g=f.next();!g.done;g=f.next()){g=g.value;for(var h=_.w(e),l=h.next();!l.done;l=h.next()){var m=l.value;l=_.Y.sk(g,m);d.has(l)?a.g.debug("Skipping variant which only differs in text streams."):(m=BK(a,g,m,c),null==m?a.g.warn("Incompatible DRM info in HLS variant. Skipping."):(b.push(m),d.add(l)))}}return b},BK=function(a,b,c,d){for(var e=[],f=(c||b).length(),g=0;g<f;g++){var h=
37
- b?b.streams[g]||null:null,l=c?c.streams[g]||null:null,m=_.Y.Ok(h,l);if(!m)return null;var n=d;h={id:a.N++,language:h?h.language:_.vg,primary:!!h&&h.primary||!!l&&l.primary,audio:h,video:l,bandwidth:n,drmInfos:m,allowedByApplication:!0,allowedByKeySystem:!0};e.push(h)}return new dK(e)},TK=function(a,b,c){var d,e,f,g;return _.H(function(h){d=b;e=d.tag;f=d.playlist;g=f.a;return h["return"](ZK(a,g,function(){var l,m,n,p,q,u,v,z,C,I,F,D,G,M;return _.H(function(N){if(1==N.a){l=_.Kp;m=_.$i(e,_.eb);n=_.Y.Xg(_.$i(e,
38
- _.dc));p=_.Y.nk(e);q=c.get(m)||"";u=_.Zi(e,_.ub);v=_.Zi(e,"NAME");z=e.getAttribute("DEFAULT");C=e.getAttribute("AUTOSELECT");I=_.Zi(e,"CHANNELS");F=n===l.AUDIO?I?parseInt(I.split("/")[0],10):null:null;var U=n===l.AUDIO?(U=_.Zi(e,"CHANNELS"))?U.includes("/JOC"):!1:!1;D=U;G=!!z&&!!C;return _.y(N,DK(a,{playlist:f,codecs:q,type:n,Qd:u,primary:G,name:v,channelsCount:F,spatialAudio:D,groupId:m,kind:p,closedCaptions:null,Qe:null}),2)}M=N.f;return N["return"](M)})}))})},UK=function(a,b){var c,d,e,f;return _.H(function(g){c=
39
- b;d=c.tag;e=c.playlist;f=e.a;return g["return"](ZK(a,f,function(){var h,l,m,n,p;return _.H(function(q){if(1==q.a)return h=_.Zi(d,_.sa)||"jpg",l=_.Zi(d,_.ub),m=_.Zi(d,"NAME"),_.y(q,DK(a,{playlist:e,codecs:h,type:_.ye,Qd:l,name:m,primary:!1,kind:null,channelsCount:null,spatialAudio:!1,closedCaptions:null,groupId:null,Qe:null}),2);n=q.f;(p=_.Zi(d,_.na))&&bK(n,Number(p));return q["return"](n)})}))})},RK=function(a,b){var c=_.Zi(b,_.sa,a.a.hlsDefaultCodecs||"avc1.42E01E,mp4a.40.2").split(/\s*,\s*/),d=
40
- new Set,e=[];c=_.w(c);for(var f=c.next();!f.done;f=c.next()){f=f.value;var g=_.NC(f);d.has(g)?a.g.debug("Ignoring duplicate codec"):(e.push(f),d.add(g))}return e},YK=function(a,b,c,d,e,f){var g,h,l,m,n;return _.H(function(p){g=b;h=g.tag;l=g.playlist;m=_.Kp;n=l.a;return p["return"](ZK(a,n,function(){var q,u,v,z;return _.H(function(C){if(1==C.a)return q=_.Zi(h,_.ra),u=null,d===m.VIDEO&&q&&"NONE"!==q&&(u=e.get(q)),v=SK(d,c),_.y(C,DK(a,{playlist:l,codecs:v,type:d,closedCaptions:u,primary:!1,kind:null,
41
- Qd:null,name:null,channelsCount:null,spatialAudio:!1,groupId:null,Qe:f}),2);z=C.f;return C["return"](z)})}))})},ZK=function(a,b,c){if(a.f.has(b))return a=a.f.get(b),Promise.resolve(a);if(a.f.f.has(b))return a.f.f.get(b)||null;c=c();a.f.set(b,c);return c},DK=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,u,v,z,C,I,F,D,G,M,N,U,oa,Ca,ab,bb;return _.H(function(Qa){if(1==Qa.a){c=$K;d=aL;e=_.Kp;f=_.Y;g=b;h=g.playlist;l=g.codecs;m=g.type;n=g.Qd;p=g.groupId;q=g.primary;u=g.kind;v=g.name;z=g.channelsCount;C=g.spatialAudio;
42
- I=g.closedCaptions;F=g.Qe;D=_.Y.qh(n);if(1!==h.type)throw new _.P(_.Q,4,4017);G=_.Y.Jm(h.X,null==a.o);a.l=G;M=_.Y.Gm(h.X,G,a.a.lowLatencyMode||!1,a.a.suggestedPresentationDelay);return _.y(Qa,bL(a,h,m,l),2)}N=Qa.f;U=a.a.lowLatencyMode?d.Gi:d.Ii;oa=u;m!==e.TEXT||u||(oa=_.mg);Ca=f.fi(h.X);ab=Ca.me;bb=N.map(function(Da){var fb=Da.U,pc=Da.yk,Ag=Da.mimeType;Da=Da.ga;var Bg=fb[0].startTime,nn=fb[fb.length-1].endTime,Xt=nn-Bg,fd=new _.FD(fb),on=fb[0].initSegment||null;return{id:_.kJ++,originalId:v,createSegmentIndex:Promise.resolve.bind(Promise),
43
- findSegmentPosition:fd.find.bind(fd),getSegmentReference:fd.get.bind(fd),adjustSegmentDurations:fd.nd.bind(fd),getDuration:fd.getDuration.bind(fd),segmentIndex:fd,segmentLookupStrategy:U,initSegmentReference:on,mimeType:Ag,codecs:l,kind:oa,dh:pc.type,encrypted:pc.type===c.Li,keyId:pc.keyId,language:D,originalLanguage:n||_.vg,label:v,type:m,primary:q,trickModeVideo:null,emsgSchemeIdUris:null,frameRate:F?F.frameRate:void 0,width:F?F.width:void 0,height:F?F.height:void 0,bandwidth:void 0,roles:[],channelsCount:z,
44
- spatialAudio:C,closedCaptions:I,keyInfo:pc.keyInfo,U:fb,drmInfos:pc.drmInfos,ga:Da,Lb:h.a,ef:h.f,$b:Bg,De:nn,duration:Xt,me:ab,groupId:p,yl:M}});return Qa["return"](new XJ(bb))})},OK=function(a,b){var c;return _.H(function(d){if(1==d.a)return _.y(d,Promise.all(b.map(function(e){var f;return _.H(function(g){if(1==g.a)return _.y(g,cL(a,e),2);f=g.f;return g["return"](f?{tag:e,playlist:f}:null)})})),2);c=d.f;return d["return"](c.filter(Boolean))})},cL=function(a,b){var c,d,e,f,g,h,l;return _.H(function(m){if(1==
45
- m.a){c=_.Y.ul(b);d=_.Zi(b,_.fc,void 0,{required:c});if(!d)return m["return"](null);e=_.Y.td(a.w,d);return _.y(m,dL(a,e),2)}f=m.f;g=f.response;h=f.text;l=g.uri;return m["return"](uK(a,h,l,d))})},PK=function(a,b){var c,d,e,f,g,h,l,m;return _.H(function(n){if(1==n.a){var p=new _.Gi(b.streams[0].ef);if(a.a.lowLatencyMode&&b.streams[0].me){var q=b.streams[b.streams.length-1].segmentIndex;if(q=q.a[q.a.length-1]){var u=q.a,v=u.length-1;q={Dl:q.position,Mm:u&&0<u.length?v:null}}else q=null;if(u=q)q=u.Dl,
46
- u=u.Mm,v=_.tk(p.a.toString()),v._HLS_msn=q.toString(),null===u&&v._HLS_part&&delete v._HLS_part,null!==u&&(v._HLS_part=u.toString()),q=_.sk(v,!0),_.Ji(p,new _.Ni(q))}c=p.toString();return _.y(n,dL(a,c),2)}d=n.f;e=d.response;f=d.text;g=b.Wb();h=b.streams[0].ef;l=e.uri;h!==l&&(h=l,YJ(b,h));m=uK(a,f,h,g);return n["return"]({stream:b,playlist:m})})},uK=function(a,b,c,d){a=GJ(a.K,b,c);a.a=d;eL(a);return a},eL=function(a){1===a.type&&a.U.forEach(function(b,c){if(_.Y.Yb(b.X,_.Pa)&&!_.Y.Yb(b.X,_.La)&&0<c)throw new _.P(_.Q,
47
- 4,4046,"Media playlist contains an EXT-X-MAP tag not accompanied by an EXT-X-DISCONTINUITY tag.");})},fL=function(a){if(1<(new Set(a.map(function(b){return b.mimeType}))).size)throw new _.P(_.Q,4,4045,"Media playlist contains discontinuities with different MIME types. This is valid, but not yet supported.");},gL=function(a){a=a.map(function(b){return b.a?b.a:b.f.map(function(c){return _.Zi(c,_.fc)})||null}).map(function(b){return _.Vi(b)});if(1<(new Set(a)).size)throw new _.P(_.Q,4,4044,"Unexpected change in file format.");
48
- },hL=function(a,b,c){a=_.Y.Sb(a.X,_.Pa);if(1<a.length)throw new _.P(_.Q,4,4020);a=a[0];if(!a)return null;var d=_.$i(a,_.fc),e=_.Y.td(b,d);b=_.Y.di(a,null,!0);return new _.FC(function(){return[e]},b.wa,b.ka,c)},iL=function(a,b,c,d,e,f,g){var h=[],l={};b=_.w(_.jJ(b.f));for(var m=b.next();!m.done;l={Se:l.Se},m=b.next()){var n=m.value;m=n.xh;n=n.item;var p=0===m,q=p?a:h[h.length-1],u=p?d:q.endTime,v=Number(_.Zi(n,_.Ga));v=u+v;p=_.Y.di(n,p?null:q.ka,p);q=_.Zi(n,_.fc);q=_.Y.td(g,q);l.Se=q?[q]:[];u=new _.cj(c,
49
- u,v,function(z){return function(){return z.Se}}(l),p.wa,p.ka,e,f,!1,null,null,null,null);if("YES"===_.Zi(n,"INDEPENDENT")||0===m)u.h=!0;h.push(u)}return h},jL=function(a,b,c,d,e,f,g,h,l,m,n){var p=c.X,q=c.a,u=null!=q,v=q?[q]:[];if(!u&&!a.a.lowLatencyMode)return null;a=0;q={wa:0,ka:null};var z=null;u?(c=_.Y.Em(p).duration,a=e+c,q=_.Y.ei(p,b?b.ka:null)):(b=iL(b,c,d,e,f,g,l),a=b[b.length-1].endTime,z=b);h=h===_.ye?_.Y.Km(p):null;d=new _.cj(d,e,a,function(){return v},q.wa,q.ka,f,g,!1,null,h?h.Gd:null,
50
- h?h.ae:null,h?h.durationPerTile:null,z);d.ga=m;d.initSegment=n||void 0;return d},bL=function(a,b,c,d){var e,f,g,h,l,m,n,p,q,u,v,z,C,I;return _.H(function(F){switch(F.a){case 1:return e=_.Y,f=kL,g=lL,h=b.a,l=b.U,m=e.Sk(b.X,_.Ra),n=[],!xK(a)&&g.Ri(l),_.y(F,mL(a,b.f,h,l,m,c,d),2);case 2:p=F.f,q=m,u=f.gn(l),v=0;case 3:if(!(v<u.length)){F.F(5);break}z=u[v];C=n[n.length-1]||null;return _.y(F,nL(a,b.f,z,q,p,c,d,C,u.length),6);case 6:I=F.f;n.push(I);q+=z.length;v++;F.F(3);break;case 5:return fL(n),F["return"](n)}})},
51
- mL=function(a,b,c,d,e,f,g){var h,l,m,n,p,q,u,v,z,C,I,F;return _.H(function(D){if(1==D.a){h=d[0];if(null!=a.B)return D["return"](a.B);if(!xK(a)&&a.o)try{var G=a.f.get(c),M=G?G.find(e)||null:null;if(!M)throw new _.P(_.Q,4,4030,"Segment not found in pervious playlist update.");l=M.startTime+M.ya;a.g.debug(qJ+l+".");a.B=l;return D["return"](l)}catch(N){if(m=a.f.get(c))n=m.streams[0].U[0].position,D=m.streams[m.streams.length-1].U,p=D[D.length-1].position,q=e,u=e+d.length-1,a.g.warn("Last #EXT-X-MEDIA-SEQUENCE values "+
52
- n+" - "+p+(", new values "+q+" - "+u+"."),b,m);throw new _.P(_.Q,4,4047,{message:"The updated playlist does not share any segments with the previous one.",uri:c});}return _.y(D,oL(a,f,g,h),2)}if(3!=D.a)return v=D.f,z=lL.Im(h,a.w,v),C=hL(h,b,z.keyInfo),I=_.Y.Af(z.keyInfo,e),_.y(D,pL(a,C,h,I,v,g),3);F=D.f;a.g.debug(qJ+F+".");a.B=F;return D["return"](F)})},nL=function(a,b,c,d,e,f,g,h,l){var m,n,p,q,u,v,z,C,I,F,D,G,M,N,U,oa,Ca,ab,bb,Qa,Da;return _.H(function(fb){switch(fb.a){case 1:return m=_.Y,n=lL,
53
- p=c[0],q=null==h,gL(c),_.y(fb,oL(a,f,g,p),2);case 2:u=fb.f;v=n.Dm(c,a.w,u,h?h.xl:null,1===l);z=v[v.length-1];C=lL.oa(v);I=hL(p,b,C.keyInfo)||(h?h.ml:null);F=_.Y.Af(C.keyInfo,d);D=p.ga;if(q){G=e;fb.F(3);break}return _.y(fb,qL(a,D,I,p,d,F,u,g),4);case 4:G=fb.f;case 3:M=G;N=[];for(U=0;U<c.length;U++)oa=c[U],Ca=N[N.length-1]||null,ab=0===U?0:Ca.endTime,bb=d+U,Qa=m.Af(C.keyInfo,bb),(Da=jL(a,Ca,oa,bb,ab,M,Qa,f,b,D,I))&&N.push(Da);return fb["return"]({U:N,yk:C,xl:z,mimeType:u,endTime:N[N.length-1].endTime,
54
- ga:D,ml:I})}})},HK=function(a,b){b.forEach(function(c){var d=a.f.get(c.a);kL.Xi(c,d,!xK(a))});kL.tk(b)},qL=function(a,b,c,d,e,f,g,h){var l;return _.H(function(m){if(1==m.a)return a.H.has(b)?m["return"](a.H.get(b)):_.y(m,pL(a,c,d,f,g,h),2);l=m.f;a.g.debug("Segment #"+e+" has raw media timestamp "+(l+" s."));a.H.set(b,l);return m["return"](l)})},pL=function(a,b,c,d,e,f){var g;return _.H(function(h){if(null==c.a)return h["return"](0);g=_.Y.rk(c,d);return h["return"](WJ(a.L,b,g,e,f,null!=d))})},SK=function(a,
55
- b){if(1===b.length)return b[0];var c=_.Ui(a,b);if(null!=c)return c;throw new _.P(_.Q,4,4025,{codecList:b});},oL=function(a,b,c,d){var e,f,g;return _.H(function(h){e=d.a;g=(f=_.Y.Qa(d.X,_.Pa))?_.$i(f,_.fc):null;return h["return"](rL(a,b,c,e,g))})},rL=function(a,b,c,d,e){var f,g,h,l,m;return _.H(function(n){if(1==n.a){f=[d,e].filter(Boolean);if(g=_.Xi(f,b,c))return n["return"](g);h=_.Jj([d],a.a.attemptParameters);h.method="HEAD";h.type=2;return _.y(n,a.pf(h),2)}l=n.f;m=l.headers["content-type"];if(!m)throw new _.P(_.Q,
56
- 4,4021,"Unknown MIME type of: "+f.join(", "));return n["return"](m.split(";")[0])})},dL=function(a,b){var c,d,e;return _.H(function(f){if(1==f.a)return c=_.Jj([b],a.a.attemptParameters),c.type=1,_.y(f,a.pf(c),2);d=f.f;e="";try{e=_.S.ba(d.data)}catch(g){throw new _.P(_.Q,4,4042);}e=_.S.Nh(e);e=e.trim();return f["return"]({text:e,response:d})})},xK=function(a){return a.l===_.mc},yK=function(a,b){_.Y.Jh(b,function(c,d){_.pD(a,c.U,d.startTime)});_.hD(a.a,b[0].startTime,b[b.length-1].endTime)},sL=function(){},
57
- aL={Gi:_.bC,Ii:_.aC},$K={Li:tJ,Jn:uJ,NONE:_.We};_.t=MJ.prototype;_.t.set=function(a,b){var c=this;this.f.set(a,b);return b.then(function(d){return c.a.set(a,d)})["catch"](function(){}).then(function(){return c.f["delete"](a)})};_.t.has=function(a){return this.a.has(a)};_.t.get=function(a){return this.a.get(a)||null};_.t.values=function(){return Array.from(this.a.values())};_.t.clear=function(){this.f.clear();this.a.clear()};
58
- var kL={tk:function(a){var b=kL.Hk(a),c=kL.wl(a);a.forEach(function(d){var e=d.U,f=e.findIndex(function(h){return h.ga===b}),g=e.findIndex(function(h){return h.ga===c+1});-1===g&&(g=e.length);d.U=e.slice(f,g)})},Xi:function(a,b,c){b=kL.Rk(a,b,c);a=_.w(a.U||[]);for(c=a.next();!c.done;c=a.next())c=c.value,_.Y.Yb(c.X,_.La)&&b++,c.ga=b},Rk:function(a,b,c){var d=_.Y.Qa(a.X,_.Ma);if(d)return Number(d.value);d=kL.ol(b);if(c&&d)try{return kL.ll(a,b)}catch(e){throw new _.P(_.Q,4,4024,"EXT-X-DISCONTINUITY-SEQUENCE tag is required for discontinuous HLS live streams.");
59
- }return 0},ol:function(a){return 0<kL.Uk(a)},gn:function(a){if(0===a.length)return[];var b=[],c=[];a=_.w(a);for(var d=a.next();!d.done;d=a.next())d=d.value,_.Y.Yb(d.X,_.La)&&0<c.length&&(b.push(c),c=[]),c.push(d);b.push(c);return b},Uk:function(a){if(!a)return 0;a=a.streams[a.streams.length-1].U;return a[a.length-1].ga},ll:function(a,b){var c=_.Y.Qa(a.X,_.Ra);if(!c)throw kL.g.error("Failed to infer discontinuity number, because EXT-X-MEDIA-SEQUENCE tag is missing."),Error(mJ);c=Number(c.value);var d=
60
- b.find(c);if(!d)throw kL.g.error("Failed to infer discontinuity number, could not find the appropriate segment in the previous playlist (segment position \x3d "+(c+")")),Error(mJ);return d.ga},wl:function(a){a=a.map(function(b){return b.U[b.U.length-1].ga});return Math.min.apply(Math,_.ch(a))},Hk:function(a){a=a.map(function(b){return b.U[0].ga});return Math.max.apply(Math,_.ch(a))}};kL.g=new _.K("clpp.hls.DiscontinuityUtils");var tL={"com.apple.streamingkeydelivery":function(a,b){if(b===_.Ig)throw new _.P(_.Q,4,4041);if(_.$i(a,oJ)===pJ)throw new _.P(_.Q,4,4044,"EXT-X-KEY:METHOD SAMPLE-AES-CTR is not supported in FairPlay.");return _.EC(_.Pd,[{initDataType:_.cg,initData:new Uint8Array(0)}],"")},"com.microsoft.playready":TJ,"urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":TJ,"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":function(a){var b=_.$i(a,oJ);if(!RJ.includes(b))return SJ.error("Widevine in HLS is only supported with [",
61
- RJ.join(", "),"], not",b),null;b=_.$i(a,_.fc);b=_.ku(b);b=_.lj(b.data);b=_.EC(_.Td,[{initDataType:_.td,initData:b}],"");if(a=_.Zi(a,"KEYID"))b.keyIds=[a.substr(2).toLowerCase()];return b}},RJ=["SAMPLE-AES",pJ],SJ=new _.K("clpp.hls.DrmParser");var lL={Im:function(a,b,c){return lL.Vf(a.X,b,c)||{type:_.We,keyInfo:null,drmInfos:[],keyId:null}},Dm:function(a,b,c,d,e){if(a.slice(1).some(lL.vh))throw new _.P(_.Q,4,4046,e?"Media playlist contains an EXT-X-KEY tag with METHOD\x3dAES-128 which is not at the beginning of the playlist.":"Media playlist contains an EXT-X-KEY tag with METHOD\x3dAES-128 which is not marked by an EXT-X-DISCONTINUITY tag and is not at the beginning of the playlist.");if(_.Y.Yb(a[0].X,_.Oa)||null===d){if((d=lL.Vf(a[0].X,
62
- b,c))&&d.type===uJ){if(1<lL.Yg(a))throw new _.P(_.Q,4,4046,rJ+((e?"playlist":"discontinuity")+"."));return[d]}a=lL.bi(a,b,c);return 0===a.length?[{type:_.We,keyInfo:null,drmInfos:[],keyId:null}]:a}b=lL.bi(a,b,c);if(d.type===_.We||d.type===tJ)return[d].concat(_.ch(b));if(0<lL.Yg(a))throw new _.P(_.Q,4,4046,rJ+((e?"playlist":"discontinuity")+"."));return[d]},oa:function(a){if(0===a.length)return{type:_.We,keyInfo:null,drmInfos:[],keyId:null};if(a.some(function(c){return c.type===uJ})||a.every(function(c){return c.type===
63
- _.We}))return a[0];a=a.filter(function(c){return c.type===tJ});var b=_.ni(a.flatMap(function(c){return c.drmInfos}));return{keyInfo:null,keyId:a[a.length-1].keyId,type:tJ,drmInfos:b}},Ri:function(a){a=lL.hh(a);if(a.some(function(b){return lL.vh(b)})&&1<a.length)throw new _.P(_.Q,4,4046,"Two EXT-X-KEY tags, one with METHOD\x3dAES-128 are applied to one playlist.");},vh:function(a){return _.Y.Sb(a.X,_.Oa).some(function(b){return"AES-128"===_.Zi(b,oJ)})},bi:function(a,b,c){return lL.hh(a).map(function(d){return lL.Vf(d.X,
64
- b,c)})},Yg:function(a){return a.filter(function(b){return _.Y.Yb(b.X,_.Oa)}).length},hh:function(a){return a.filter(function(b){return _.Y.Yb(b.X,_.Oa)})},Vf:function(a,b,c){a=_.Y.Sb(a,_.Oa);if(0===a.length)return null;var d=_.$i(a[0],oJ);if(1===a.length){if("NONE"===d)return{type:_.We,keyInfo:null,drmInfos:[],keyId:null};if("AES-128"===d)return a=a[0],d=_.Zi(a,"IV",""),{type:uJ,keyInfo:{method:"AES-128",url:_.Y.td(b,_.$i(a,_.fc)),iv:d?_.yj((d||"0x").slice(2)):null},drmInfos:[],keyId:null}}b=a.map(function(e){return _.$i(e,
65
- oJ)});if(!b.every(function(e){return"SAMPLE-AES"===e})&&!b.every(function(e){return e===pJ}))throw lL.g.warn("EXT-X-KEY methods "+b.join(", ")+" are incompatible."),new _.P(_.Q,4,4044,"Multiple EXT-X-KEY tags with incompatible METHOD values.");b=a.map(function(e){var f=_.Zi(e,"KEYFORMAT","identity"),g=tL[f]||null;(e=g?g(e,c):null)||lL.g.warn("Unsupported HLS KEYFORMAT",f);return e}).filter(Boolean);if(0===b.length)throw new _.P(_.Q,4,4026);return{keyInfo:null,keyId:b.map(function(e){return e.keyIds}).reduce(function(e,
66
- f){return e.concat(f)},[]).reverse()[0]||null,type:tJ,drmInfos:b}},bo:function(){return{type:_.We,keyInfo:null,drmInfos:[],keyId:null}}};lL.g=new _.K("clpp.hls.EncryptionUtils");_.t=XJ.prototype;_.t.length=function(){return this.streams.length};_.t.Tk=function(){return this.streams[0].groupId};_.t.Nk=function(){return this.streams[0].codecs.split(",")};_.t.Wb=function(){return this.streams[0].Lb};_.t.$m=function(a){this.streams.forEach(function(b){b.codecs=a.join(",")})};_.t.find=function(a){var b=this.streams.find(function(c){c=c.U;return c[0].position<=a&&a<=c[c.length-1].position});return null==b?null:b.U.find(function(c){return c.position===a})||null};dK.prototype.length=function(){return this.a.length};_.t=sK.prototype;_.t.configure=function(a){this.a=a;this.L.a=a};_.t.setCurrentVariant=function(a){this.j=a};_.t.start=function(a,b){var c=this,d,e,f,g,h;return _.H(function(l){if(1==l.a){if(c.J)throw Error("start() may be called only once!");c.J=!0;c.C=b;return _.y(l,dL(c,a),2)}if(3!=l.a)return d=l.f,e=d.response,f=d.text,c.w=e.uri,_.y(l,zK(c,f),3);g=l.f;c.o=g;h=c.D;c.h&&0<h&&c.h.da(h);return l["return"](g)})};_.t.requestStop=function(){this.I=!0};
67
- _.t.stop=function(){this.h&&(this.h.stop(),this.h=null);var a=[];this.A&&(a.push(this.A.destroy()),this.A=null);this.f.clear();this.o=this.a=this.C=this.j=null;return Promise.all(a)};
68
- _.t.update=function(){var a=this,b,c,d,e,f,g,h,l;return _.H(function(m){if(1==m.a){b=a.o;if(xK(a)||!b)return m["return"]();c=b.presentationTimeline;"LIVE"===a.l&&(a.B=null);d=Array.from(a.f.values());a.a.lowLatencyMode&&null!==a.j&&(e=tK(a),d=d.filter(function(n){return e.includes(n.Wb())}));return _.y(m,QK(a,d),2)}if(3!=m.a)return f=m.f,g=f.map(function(n){return n.playlist}),HK(a,g),_.y(m,CK(a,f),3);h=m.f;fK(b.periods,h).forEach(function(n){a.C.filterNewPeriod(n)});wK(a,h);iK(b.periods,h);jK(b.adaptedPeriods,
69
- h);yK(c,h);if(l=_.Y.jl(g))!0!==a.a.keepTimelineLive&&(a.l=_.mc,_.lD(c,!0),c.f=h[h.length-1].endTime),a.h.stop(),a.h=null;if(a.C.onUpdate)a.C.onUpdate(b);if(l&&a.C.onTurnedStatic)a.C.onTurnedStatic();return a.I?_.y(m,a.stop(),0):m.F(0)})};
70
- _.t.Ib=function(){var a=this,b,c;return _.H(function(d){if(1==d.a){a.g.debug(_.TB);if(!a.C)return d["return"]();_.B(d,2);return _.y(d,a.update(),4)}if(2!=d.a)return a.h&&0<a.D&&a.h.da(a.D),_.qh(d,0);b=_.E(d);if(!(b instanceof _.P))throw b;a.C&&(a.C.onError(b),c=b,1===c.severity&&a.h&&a.h.da(.1));_.A(d)})};_.t.pf=function(a){if(!this.A)throw new _.P(_.Q,7,7001);a=this.C.networkingEngine.fetch(a);_.Tj(this.A,a);return a.P};_.x(sL,_.Ms);sL.prototype.f=function(){_.Lt.m3u8=sK;_.Jt[_.Fl]=sK;_.Jt[sJ]=sK};sL.prototype.a=function(){_.iE("m3u8");_.jE(_.Fl);_.jE(sJ)};sL.prototype.id=function(){return"hls"};_.J("clpp.hls.HlsComponent",sL);};
2
+ var f=function(window){var sJ="Could not parse MP4 segment start time.",tJ="Failed to infer discontinuity number",uJ="Guessing audio-only",vJ="METHOD",wJ="SAMPLE-AES-CTR",xJ="Setting playlist start time to ",yJ="Two EXT-X-KEY tags, one with METHOD\x3dAES-128 are applied to one ",zJ="application/vnd.apple.mpegurl",AJ="sample",BJ="whole-segment",CJ=function(a){if(1>a.a)throw _.Km();--a.a},DJ=function(a,b,c,d){if(1===b){if(!d||0===d.length)throw new _.N(_.O,4,4043,"Media playlist must have at least one segment!");if(null==
3
+ d[0].a)throw new _.N(_.O,4,4043,"Media playlist must have at least one full segment!");}this.f=a;this.a="";this.type=b;this.X=c;this.U=1===b?d:null},EJ=function(a,b,c){c=void 0===c?[]:c;this.X=b;this.a=a;this.f=c;this.ga=-1},FJ=function(a){a=_.w(a);for(var b=a.next();!b.done;b=a.next())if(b=b.value,b.startsWith("#EXT-")&&(b=_.Hj(0,b),_.jv.has(b.name)))return 1;return 0},GJ=function(a,b){var c=new Map,d=new URL(b);a.forEach(function(e){var f=_.bj(e,"NAME"),g=_.bj(e,"QUERYPARAM");if(f)g=_.cj(e,"VALUE"),
4
+ c.set(f,g);else if(g){f=d.searchParams.get(g);if(null==f)throw new _.N(_.O,4,4044,"Query param '"+g+"' missing in playlist URI.");if(!f)throw new _.N(_.O,4,4044,"Query param '"+g+"' has no associated value in playlist URI.");c.set(g,decodeURIComponent(f))}});return c},HJ=function(a,b){return a.replace(/\{\$([a-zA-Z0-9_-]+)\}/g,function(c,d){var e=b.get(d);if(null==e)throw new _.N(_.O,4,4044,"Undefined variable '"+d+"'");return e})},IJ=function(a,b){a.forEach(function(c){c.attributes.forEach(function(d){d.value=
5
+ HJ(d.value,b)})})},JJ=function(a,b,c){IJ(a,c);b.forEach(function(d){d.a&&(d.a=HJ(d.a,c));IJ(d.X,c);IJ(d.f,c)})},KJ=function(){this.f=0;this.a=new Map},NJ=function(a,b,c){b=b.trim().split(/\n+/m).map(function(d){return d.trim()}).filter(function(d){return d.length&&!_.Y.Fh(d)});if(!/^#EXTM3U($|[ \t\n])/m.test(b[0]))throw new _.N(_.O,4,4015);return 0===FJ(b)?LJ(a,b,c):MJ(a,b,c)},MJ=function(a,b,c){for(var d=[],e=1;e<b.length;){var f=OJ(a,b[e]);if(_.kv.has(f.name))break;d.push(f);e++}b=PJ(a,c,b.slice(e));
6
+ e=b.U;d=d.concat(b.X);a=QJ(a,d,c);JJ(d,e,a);return new DJ(c,1,d,b.U)},LJ=function(a,b,c){for(var d=[],e=1;e<b.length;e++){var f=OJ(a,b[e]);d.push(f);if(f.name===_.Ya){var g=b[e+1];if(!g)throw new _.N(_.O,4,4044,"EXT-X-STREAM-INF is not followed by a URI.");f.attributes.push(new _.dj(_.hc,g));e++}}b=_.Y.Bb(d,"EXT-X-DEFINE");_.Y.Ai(b);b=GJ(b,c);a.a=b;JJ(d,[],a.a);return new DJ(c,0,d)},PJ=function(a,b,c){var d=[],e=[],f=[],g=[];c.forEach(function(h){/^(#EXT)/.test(h)?(h=OJ(a,h),_.jv.has(h.name)||_.mv.has(h.name)?
7
+ d.push(h):_.lv.has(h.name)?"EXT-X-PART"===h.name?g.push(h):h.name===_.Va&&"PART"===_.bj(h,_.fc)&&g.push(h):f.push(h)):_.Y.Fh(h)||(h=_.Y.vd(b,h.trim(),!1),e.push(new EJ(h,f,g)),f=[],g=[])});0<g.length&&e.push(new EJ(null,f,g));return{U:e,X:d}},OJ=function(a,b){return _.Hj(a.f++,b)},QJ=function(a,b,c){b=_.Y.Bb(b,"EXT-X-DEFINE");_.Y.Ai(b);var d=GJ(b,c);b.map(function(e){return _.bj(e,"IMPORT")}).filter(Boolean).forEach(function(e){var f=a.a.get(e);if(null==f)throw new _.N(_.O,4,4044,"Cannot import variable '"+
8
+ e+"' as it is not defined in the master playlist");d.set(e,f)});return d},RJ=function(a){var b=void 0===b?0:b;return 0>a?[]:Array.from({length:a},function(c,d){return d+b})},SJ=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},TJ=function(){this.a=new Map;this.f=new Map},UJ=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]<<
9
+ 21|l[1]<<14|l[2]<<7|l[3]}function d(){throw new _.N(_.O,4,4030);}SJ(a)||d();var e=10;a[5]&64&&(e=e+4+c(a.subarray(10,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}}SJ(a,e)||d();
10
+ e+=10;e+=f}while(e<a.byteLength);return d()},VJ=function(a){for(;a.getPosition()<a.Ia()-1;){var b=a.getPosition();if(71===_.Lm(a))return CJ(a),b}return-1},WJ=function(a){function b(){d.seek(e+188);f=_.Lm(d);71!==f&&(d.seek(e+192),f=_.Lm(d));71!==f&&(d.seek(e+204),f=_.Lm(d));71!==f&&c();CJ(d)}function c(){throw new _.N(_.O,4,4030);}var d=new _.Im(new DataView(a),!1),e=0,f=0;e=VJ(d);0>e&&(_.Iv.error("Unable to find sync byte in TS after scanning."),c());for(;;)if(e=d.getPosition(),f=_.Lm(d),71!==f&&
11
+ c(),a=_.Mm(d),8191===(a&8191))b();else if(a&16384)if(a=(_.Lm(d)&48)>>4,0!==a&&2!==a||c(),3===a&&(a=_.Lm(d),d.skip(a)),1!==_.W(d)>>8)b();else{d.skip(3);a=_.Lm(d)>>6;0!==a&&1!==a||c();0===_.Lm(d)&&c();a=_.Lm(d);var g=_.Mm(d),h=_.Mm(d);return(1073741824*((a&14)>>1)+((g&65534)<<14|(h&65534)>>1))/9E4}else b()},XJ=function(a,b){var c=null,d=0;try{(new _.Rm).M(_.We,_.Sm).M(_.vg,_.Sm).M(_.Re,_.Sm).Y("mdhd",function(g){g.reader.skip(0===g.version?8:16);d=_.W(g.reader);g.parser.stop()}).parse(b,!0)}catch(g){c=
12
+ g}if(c||!d)throw _.Iv.error("Unable to find timescale in init segment!"),new _.N(_.O,4,4030,sJ,c);var e=0,f=!1;try{(new _.Rm).M("moof",_.Sm).M("traf",_.Sm).Y("tfdt",function(g){var h=d;if(0===g.version)h=_.W(g.reader)/h;else{var l=_.W(g.reader),m=_.W(g.reader);if(!(2097151>=l||h>=Math.pow(2,12)))throw Error("Cannot accurately parse MP4 timestamp, base time is too high and timescale is \x3c\x3d 2^12");h=l/h*Math.pow(2,32)+m/h}e=h;f=!0;g.parser.stop()}).parse(a,!0)}catch(g){c=g}if(c||!f)throw new _.N(_.O,
13
+ 4,4030,sJ,c);return e},$J=function(a){var b=_.cj(a,vJ);if(!YJ.includes(b))return ZJ.error("PlayReady in HLS is only supported with [",YJ.join(", "),"], not",b),null;a=_.cj(a,_.hc);b=_.ru(a);a=null;b=_.oj(b.data);try{a=_.yC(_.Un(b))}catch(c){a=b}return _.LC(_.Td,[{initDataType:_.vd,initData:a}],"")},aK=function(a){this.g=new _.K("clpp.hls.MediaReader");this.f=a;this.a={attemptParameters:_.Jj()}},cK=function(a,b,c,d,e,f){var g,h,l,m,n,p,q,u;return _.I(function(v){switch(v.a){case 1:a.g.debug("Fetching segment to find start time");
14
+ if("audio/mpeg"===d||d===_.gd||d===_.ed)return v["return"](0);g=f;if(d!==_.dd){v.F(2);break}return _.y(v,bK(a,c,g),3);case 3:return h=v.f,l=_.oj(h.data),SJ(l)?v["return"](UJ(l)):v["return"](WJ(h.data));case 2:if(d!==_.Mg&&d!==_.hd){v.F(4);break}m=[bK(a,c,g)];b&&m.push(bK(a,b,!0));return _.y(v,Promise.all(m),5);case 5:return n=v.f,p=n[0],q=n[1]||n[0],v["return"](XJ(p.data,q.data));case 4:if(d!==_.Lg){v.F(6);break}return _.y(v,bK(a,c,g),7);case 7:return u=v.f,v["return"](WJ(u.data));case 6:if(!_.Cr((d.split("/")[0]||
15
+ "")+'/mp4;codecs\x3d"'+e+'"'))return v["return"](0);throw new _.N(_.O,4,4030);}})},bK=function(a,b,c){var d,e,f,g,h,l,m;return _.I(function(n){switch(n.a){case 1:return d=b.f(),e=_.mD(b.Sa(),b.xa,b.xa+2048-1,a.a.attemptParameters),e.type=2,f=_.mD(b.Sa(),b.xa,b.ka,a.a.attemptParameters),f.type=2,d&&(f.keyInfo=d),_.D(n,2),g=c?f:e,_.y(n,a.f(g),4);case 4:return h=n.f,n["return"](h);case 2:l=_.E(n);if(7001===l.code||c)throw l;a.g.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 pre-flights.",
16
+ e.uris[0]);_.D(n,5);return _.y(n,a.f(f),7);case 7:return n["return"](n.f);case 5:throw m=_.E(n),a.g.error("Failed to fetch media segment to parse its start timestamp.",f.uris[0],m),new _.N(_.O,4,4030,"Failed to fetch the media segment.");}})},dK=function(a){this.streams=a},eK=function(a,b){a.streams.forEach(function(c){c.hf=b})},fK=function(a,b){a.streams.forEach(function(c){c.width=b})},gK=function(a,b){a.streams.forEach(function(c){c.height=b})},hK=function(a,b){a.streams.forEach(function(c){c.frameRate=
17
+ b})},iK=function(a,b){a.streams.forEach(function(c){c.bandwidth=b})},jK=function(a,b){var c=a.map(function(d){return d.streams[b]});return c.some(function(d){return null==d})?null:c},kK=function(a){this.a=a},lK=function(a,b){var c=a.map(function(d){return d.a[b]});return c.some(function(d){return null==d})?null:c},mK=function(a,b){var c=new Set(a.map(function(d){return d.ga}));return b.filter(function(d){return!c.has(d.ga)})},pK=function(a,b){for(;a[0].ga<b[0].ga;)a.splice(0,1);var c=a[0],d=b[0];
18
+ nK(c,d)||oK(c,d);var e=a.length-1;c=a[e];d=b[e];0<e&&!nK(c,d)&&oK(c,d);for(c=e+1;c<b.length;)a.push(b[c]),c++},qK=function(a,b){var c=a[a.length-1],d=b.findIndex(function(f){return f.ga===c.ga}),e=b[d];nK(c,e)||oK(c,e);for(d+=1;d<b.length;d++)a.push(b[d])},vK=function(a,b,c,d,e){var f=b[0].length();f=RJ(f).map(function(g){var h=lK(b,g)||[],l=jK(c,g)||[];g=jK(d,g)||[];var m=_.fh(rK(h)).concat(_.fh(l),_.fh(g)).filter(Boolean);sK(m);var n=m[0];m=n.ga;n=n.duration;return{configurationId:a,variants:h,
19
+ textStreams:l,thumbStreams:g,startTime:0,id:"P"+m,endTime:n,duration:n,ga:m}});e&&tK(f[0]);uK(f);return f},rK=function(a){a=new Set(a.flatMap(function(b){return[b.video,b.audio]}).filter(Boolean));return Array.from(a)},tK=function(a){var b=rK(a.variants)[0].U[0].Aa;a.startTime+=b;a.endTime+=b},uK=function(a){for(var b=0;b<a.length;b++){var c=a[b],d=a[b-1];c.startTime=d?d.endTime:c.startTime;c.endTime=c.startTime+c.duration}},nK=function(a,b){return a.startTime===b.startTime&&a.endTime===b.endTime},
20
+ oK=function(a,b){a.startTime=b.startTime;a.endTime=b.endTime;a.duration=b.duration;wK(a.variants,b.variants);xK(_.Y.Qe(a),_.Y.Qe(b))},wK=function(a,b){var c=new Map(a.map(function(d){return[_.Y.bh(d),d]}));b.forEach(function(d){c.get(_.Y.bh(d)).drmInfos=d.drmInfos})},xK=function(a,b){var c=new Map(a.map(function(d){return[d.hc,d]}));b.forEach(function(d){var e=c.get(d.hc);e.U=d.U;e.segmentIndex.replace(d.U);e.ac=d.ac;e.Ee=d.Ee;e.duration=d.duration;e.gh=d.gh;e.encrypted=d.encrypted;e.drmInfos=d.drmInfos;
21
+ e.keyId=d.keyId})},sK=function(a){var b=yK(a);a.forEach(function(c){_.hD(c.segmentIndex,b);c.duration=b;c.Ee=c.ac+b})},yK=function(a){var b=Infinity;_.Y.Ck(a).forEach(function(c){b=Math.min(b,c.duration)});return b},zK=function(){var a=this;this.a=this.C=null;this.R=1;this.f=new TJ;this.w="";this.L=new KJ;this.D=0;this.j=null;this.h=new _.Zk(function(){a.Mb()});this.l=_.oc;this.o=null;this.B=new _.Vj;this.A=null;this.g=new _.K("clpp.hls.HlsParser");this.I=new Map;this.N=new aK(this.sf.bind(this));
22
+ this.K=!1;this.H=null;this.J=!1;this.G=new Map},AK=function(a){if(null===a.j)return[];a=a.j;return[a.audio,a.video].filter(function(b){return b}).map(function(b){return b.hc})},BK=function(a,b){for(var c=_.w(b),d=c.next();!d.done;d=c.next()){d=d.value;var e=a.G.get(d.id);if(e&&e.startTime!==d.startTime)a.C.onError(new _.N(1,4,4044,"EXT-X-DATERANGE START-DATE has changed for ID\x3d"+d.id));e||(a.G.set(d.id,d),a.C.onTimelineCueAdded({configurationId:a.C.configurationId,schemeIdUri:d.schemeIdUri,va:d.va,
23
+ value:"",startTime:d.startTime,endTime:d.endTime,id:d.id,type:_.iv,eventElement:null}))}},HK=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,u,v,z;return _.I(function(A){if(1==A.a){c=_.Mp;d=_.Y;e=CK(a,b,a.w,"");if(1===e.type){f=e.U[0].a;var G=_.Yi(f)||"";g=null!=_.Zi.video[G]?_.r:null!=_.Zi.audio[G]?_.cd:null;h="";g===c.VIDEO?h="avc1.42E01E":g===c.AUDIO&&(h="mp4a.40.2");G=a.L;var F=a.w,C=a.a.hlsDefaultCodecs||h,H=[],Q=[];Q.push(new _.dj(_.pa,"0"));Q.push(new _.dj(_.hc,F));C.length&&Q.push(new _.dj(_.ta,C));
24
+ H.push(new _.aj(G.f++,_.Ya,Q));e=new DJ(F,0,H)}l=_.Y.Km(e.X);return _.y(A,DK(a,l),2)}m=A.f;n=m.periods;p=m.Vm;q=m.sn;if(!a.C)throw new _.N(_.O,7,7001);u=d.Xk(n[0]);EK(a,n);G=!0;F=null;C=0;FK(a)||(G=!1,F=0,C=u.delay);H=a.a.timeline||{};H.type=void 0;F=new _.pD(H,F,C,!0,void 0,!!a.a.lowLatencyMode);_.sD(F,G);GK(F,n);p&&_.rD(F,p);v=F;if(!FK(a)){a.D=u.Bc;C=0;F=_.w(a.f.values());for(G=F.next();!G.done;G=F.next())C=Math.max(C,G.value.streams[0].ac);for(F=0;95443.7176888889<=C;)F+=95443.7176888889,C-=95443.7176888889;
25
+ if(F)for(a.g.debug("Offsetting live streams by",F,"to compensate for rollover"),C=_.w(a.f.values()),G=C.next();!G.done;G=C.next())G=G.value.streams[0],95443.7176888889>G.ac?(a.g.debug("Offset applied to",G.type),G.segmentIndex.offset(F)):a.g.debug("Offset NOT applied to",G.type)}G=_.Y.Yk(n);"LIVE"===a.l||"EVENT"===a.l?(G=Math.max(G,v.K),isNaN(a.a.availabilityWindowOverride)||(G=a.a.availabilityWindowOverride),v.A=G):a.l===_.oc&&(v.f=G);BK(a,q);z={presentationTimeline:v,adaptedPeriods:_.fh(n).concat(),
26
+ periods:n,minBufferTime:0};a.g.debug("HLS playlist parsed",z);return A["return"](z)})},KK=function(a,b){var c,d,e,f,g,h,l,m,n;return _.I(function(p){if(1==p.a)return c=_.Y,_.y(p,IK(a,b),2);d=p.f;e=d.textStreams;f=d.thumbStreams;g=d.Vi;h=a.o.periods[0].variants;a.a.lowLatencyMode&&null!==a.j&&(h=h.filter(function(q){return q.id===a.j.id}));l=h.map(function(q){var u=c.lh(q.audio,g),v=c.lh(q.video,g);q=JK(a,u,v,q.bandwidth);if(!q)throw new _.N(_.O,4,4047,{message:"Video and audio are encrypted in an incompatible way.",
27
+ oo:v?v.Kb():void 0,audio:u?u.Kb():void 0});return q});m=a.C.configurationId;n=vK(m,l,e,f,!0);return p["return"](n)})},IK=function(a,b){var c,d,e,f,g,h,l,m,n;return _.I(function(p){if(1==p.a)return c=_.Mp,d=function(q){return q.stream.td()===c.VIDEO||q.stream.td()===c.AUDIO},e=b.filter(d),f=b.filter(function(q){return!d(q)}),g=function(q){q=q.map(function(u){var v=u.stream.streams[0];u=Object.assign({},{playlist:u.playlist},{language:v.language,channelsCount:v.channelsCount,spatialAudio:v.spatialAudio,
28
+ closedCaptions:v.closedCaptions,primary:v.primary,kind:v.kind||null,groupId:v.groupId,type:v.type,codecs:v.codecs,name:v.originalId,uri:v.hc,Te:{width:v.width,height:v.height,frameRate:v.frameRate}});return LK(a,u)});return Promise.all(q)},_.y(p,g(e),2);if(3!=p.a)return h=p.f,_.y(p,g(f),3);l=p.f;MK(a,h.concat(l));m=l.filter(function(q){return q.td()===c.Oi});n=l.filter(function(q){return q.td()===c.IMAGE});return p["return"]({textStreams:m,thumbStreams:n,Vi:h})})},MK=function(a,b){b.forEach(function(c){a.f.a.set(c.Kb(),
29
+ c)})},DK=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,u,v;return _.I(function(z){switch(z.a){case 1:return c=_.Y.Dm(b.ed.closedCaptions),d=NK(a,b.ce),_.y(z,OK(a,b),2);case 2:return e=z.f,f=Object.values(e).flat().map(function(A){return A.playlist}),PK(a,f),_.y(z,QK(a,e.Bg,d),3);case 3:return g=z.f,_.y(z,RK(a,e.ce,g,c),4);case 4:return h=z.f,_.y(z,SK(a,e.nn,d),5);case 5:return l=z.f,_.y(z,TK(a,e.Hf),6);case 6:return m=z.f,n=a.C.configurationId,p=vK(n,h,l,m,!FK(a)),a.C.filterAllPeriods(p),q=_.fh(e.ce).concat(_.fh(e.Bg)).map(function(A){return A.playlist}),
30
+ u=UK(a,q),v=VK(a,q,u),z["return"]({periods:p,Vm:u,sn:v})}})},EK=function(a,b){FK(a)||2!==a.a.timeline.version||(a.H||(a.H=b[0].startTime),_.fF(b,-a.H))},VK=function(a,b,c){b=b.find(function(d){return null!==_.Y.Ra(d.X,_.La)});if(!b)return[];if(null===c)throw new _.N(_.O,4,4024,"EXT-X-PROGRAM-DATE-TIME tag is required when EXT-X-DATERANGE tags are present");return b.X.filter(function(d){return d.name===_.La}).map(function(d){return _.Y.Em(d,c,a.A,!FK(a))}).filter(Boolean)},UK=function(a,b){var c=b.flatMap(function(e){return e.U[0].X});
31
+ c=_.Y.Ra(c,_.Wa);if(!c)return null;var d=(new Date(c.value)).getTime();return isNaN(d)?(a.g.warn("Failed to parse EXT-X-PROGRAM-DATE-TIME tag value (value: "+(c.value+").")),null):d/1E3},OK=function(a,b){var c,d,e,f,g,h;return _.I(function(l){if(1==l.a)return _.y(l,Promise.all([WK(a,b.ed.Ui),WK(a,b.ed.pn),WK(a,b.ce),WK(a,b.Hf)]),2);c=l.f;d=_.w(c);e=d.next().value;f=d.next().value;g=d.next().value;h=d.next().value;return l["return"]({Bg:e,nn:f,ce:g,Hf:h})})},YK=function(a,b){return Promise.all(b.map(function(c){return XK(a,
32
+ c)}))},NK=function(a,b){for(var c=_.Y.te,d=new Map,e=_.w(b),f=e.next();!f.done;f=e.next()){var g=f.value,h=_.bj(g,"AUDIO");f=_.bj(g,_.nc);var l=_.bj(g,_.Yb);g=ZK(a,g);if(l){var m=_.Xi(_.P,g);d.set(c(_.P,l),m);l=g.indexOf(m);-1<l&&g.splice(l,1)}h&&(l=$K(_.cd,g),d.set(c(_.cd,h),l));f&&(h=$K(_.r,g),d.set(c(_.r,f),h))}return d},SK=function(a,b,c){return Promise.all(b.map(function(d){return aL(a,d,c)}))},TK=function(a,b){return Promise.all(b.map(function(c){return bL(a,c)}))},QK=function(a,b,c){var d,
33
+ e;return _.I(function(f){if(1==f.a){if(0===b.length)return f["return"](new Map);d=[aL(a,b[0],c)];return _.y(f,d[0],2)}if(3!=f.a)return d=d.concat(b.slice(1).map(function(g){return aL(a,g,c)})),_.y(f,Promise.all(d),3);e=f.f;return f["return"](_.Y.tn(e))})},RK=function(a,b,c,d){var e,f,g,h,l,m,n,p,q,u,v;return _.I(function(z){if(1==z.a){e=new Set;f=_.fh(b).concat();g=0;h=Infinity;for(l=0;l<f.length;++l)m=Number(_.cj(f[l].tag,_.pa)),m<h&&(h=m,g=l);n=f.splice(g,1).pop();return _.y(z,cL(a,n,c,d,e),2)}if(3!=
34
+ z.a)return p=z.f,q=f.map(function(A){return cL(a,A,c,d,e)}),_.y(z,Promise.all(q),3);u=z.f;u.splice(g,0,p);v=u.reduce(_.IC,[]);return z["return"](v)})},cL=function(a,b,c,d,e){var f,g,h,l,m,n;return _.I(function(p){return 1==p.a?(f=_.Y,g=b,h=g.tag,l=Number(_.cj(h,_.pa)),m=f.Om(h),_.y(p,dL(a,b,m,c,d),2)):(n=p.f)?p["return"](eL(a,n,l,e)):p["return"]([])})},dL=function(a,b,c,d,e){var f,g,h,l,m,n,p,q,u,v,z,A,G,F,C,H,Q,R,na;return _.I(function(da){if(1==da.a)return f=_.Mp,g=_.Y.te,h=b,l=h.tag,m=h.playlist,
35
+ n=ZK(a,l),p=_.bj(l,"AUDIO"),q=_.bj(l,_.nc),u=p?d.get(g(f.AUDIO,p))||[]:[],v=q?d.get(g(f.VIDEO,q))||[]:[],z=_.fh(u).concat(_.fh(v)),A={audio:u,video:v},a.g.debug("Guessing stream type for",l.toString()),F=!1,C=m.a,H=A.audio.find(function(Ba){return Ba.Kb()===C}),Q=_.Xi(f.VIDEO,n),R=c||Q,1!==n.length||R?!z.length&&1<n.length?(a.g.debug("Guessing multiplexed audio+video"),G=f.VIDEO,n=[n.join(",")]):A.audio.length&&H?(a.g.debug(uJ),G=f.AUDIO,F=!0):A.video.length?(a.g.debug(uJ),G=f.AUDIO):(a.g.debug("Guessing video-only"),
36
+ G=f.VIDEO):(G=f.AUDIO,a.g.debug(uJ)),na=null,F?da.F(2):_.y(da,fL(a,b,n,G,e,c),3);2!=da.a&&(na=da.f);if(null==na)return da["return"](null);A[G]=[na];G===f.AUDIO&&c&&z.forEach(function(Ba){fK(Ba,c.width);gK(Ba,c.height);hK(Ba,c.frameRate)});_.Y.yk(A);return da["return"](A)})},eL=function(a,b,c,d){var e=b.video,f=b.audio;e=0<e.length?e:[null];b=[];f=_.w(0<f.length?f:[null]);for(var g=f.next();!g.done;g=f.next()){g=g.value;for(var h=_.w(e),l=h.next();!l.done;l=h.next()){var m=l.value;l=_.Y.uk(g,m);d.has(l)?
37
+ a.g.debug("Skipping variant which only differs in text streams."):(m=JK(a,g,m,c),null==m?a.g.warn("Incompatible DRM info in HLS variant. Skipping."):(b.push(m),d.add(l)))}}return b},JK=function(a,b,c,d){for(var e=[],f=(c||b).length(),g=0;g<f;g++){var h=b?b.streams[g]||null:null,l=c?c.streams[g]||null:null,m=_.Y.Qk(h,l);if(!m)return null;var n=d;h={id:a.R++,language:h?h.language:_.yg,primary:!!h&&h.primary||!!l&&l.primary,audio:h,video:l,bandwidth:n,drmInfos:m,allowedByApplication:!0,allowedByKeySystem:!0};
38
+ e.push(h)}return new kK(e)},aL=function(a,b,c){var d,e,f,g;return _.I(function(h){d=b;e=d.tag;f=d.playlist;g=f.a;return h["return"](gL(a,g,function(){var l,m,n,p,q,u,v,z,A,G,F,C,H,Q,R;return _.I(function(na){if(1==na.a){l=_.Mp;m=_.Y.te;n=_.cj(e,_.gb);p=_.Y.$g(_.cj(e,_.fc));q=_.Y.qk(e);u=c.get(m(p,n))||"";v=_.bj(e,_.vb);z=_.bj(e,"NAME");A=e.getAttribute("DEFAULT");G=e.getAttribute("AUTOSELECT");F=_.bj(e,"CHANNELS");C=p===l.AUDIO?F?parseInt(F.split("/")[0],10):null:null;var da=p===l.AUDIO?(da=_.bj(e,
39
+ "CHANNELS"))?da.includes("/JOC"):!1:!1;H=da;Q=!!A&&!!G;return _.y(na,LK(a,{playlist:f,codecs:u,type:p,Sd:v,primary:Q,name:z,channelsCount:C,spatialAudio:H,groupId:n,kind:q,closedCaptions:null,Te:null}),2)}R=na.f;return na["return"](R)})}))})},bL=function(a,b){var c,d,e,f;return _.I(function(g){c=b;d=c.tag;e=c.playlist;f=e.a;return g["return"](gL(a,f,function(){var h,l,m,n,p;return _.I(function(q){if(1==q.a)return h=_.bj(d,_.ta)||"jpg",l=_.bj(d,_.vb),m=_.bj(d,"NAME"),_.y(q,LK(a,{playlist:e,codecs:h,
40
+ type:_.Be,Sd:l,name:m,primary:!1,kind:null,channelsCount:null,spatialAudio:!1,closedCaptions:null,groupId:null,Te:null}),2);n=q.f;(p=_.bj(d,_.pa))&&iK(n,Number(p));return q["return"](n)})}))})},ZK=function(a,b){var c=_.bj(b,_.ta,a.a.hlsDefaultCodecs||"avc1.42E01E,mp4a.40.2").split(/\s*,\s*/),d=new Set,e=[];c=_.w(c);for(var f=c.next();!f.done;f=c.next()){f=f.value;var g=_.UC(f);d.has(g)?a.g.debug("Ignoring duplicate codec"):(e.push(f),d.add(g))}return e},fL=function(a,b,c,d,e,f){var g,h,l,m,n;return _.I(function(p){g=
41
+ b;h=g.tag;l=g.playlist;m=_.Mp;n=l.a;return p["return"](gL(a,n,function(){var q,u,v,z;return _.I(function(A){if(1==A.a)return q=_.bj(h,_.sa),u=null,d===m.VIDEO&&q&&"NONE"!==q&&(u=e.get(q)),v=$K(d,c),_.y(A,LK(a,{playlist:l,codecs:v,type:d,closedCaptions:u,primary:!1,kind:null,Sd:null,name:null,channelsCount:null,spatialAudio:!1,groupId:null,Te:f}),2);z=A.f;return A["return"](z)})}))})},gL=function(a,b,c){if(a.f.has(b))return a=a.f.get(b),Promise.resolve(a);if(a.f.f.has(b))return a.f.f.get(b)||null;
42
+ c=c();a.f.set(b,c);return c},LK=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,u,v,z,A,G,F,C,H,Q,R,na,da,Ba,ab,bb;return _.I(function(Qa){if(1==Qa.a){c=hL;d=iL;e=_.Mp;f=_.Y;g=b;h=g.playlist;l=g.codecs;m=g.type;n=g.Sd;p=g.groupId;q=g.primary;u=g.kind;v=g.name;z=g.channelsCount;A=g.spatialAudio;G=g.closedCaptions;F=g.Te;C=_.Y.th(n);if(1!==h.type)throw new _.N(_.O,4,4017);H=_.Y.Mm(h.X,null==a.o);a.l=H;Q=_.Y.Jm(h.X,H,a.a.lowLatencyMode||!1,a.a.suggestedPresentationDelay);return _.y(Qa,jL(a,h,m,l),2)}R=Qa.f;
43
+ na=a.a.lowLatencyMode?d.Ii:d.Ki;da=u;m!==e.TEXT||u||(da=_.pg);Ba=f.ii(h.X);ab=Ba.me;bb=R.map(function(Ca){var fb=Ca.U,pc=Ca.Ak,Eg=Ca.mimeType;Ca=Ca.ga;var Fg=fb[0].startTime,wn=fb[fb.length-1].endTime,hu=wn-Fg,fd=new _.LD(fb),xn=fb[0].initSegment||null;return{id:_.rJ++,originalId:v,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:fd.find.bind(fd),getSegmentReference:fd.get.bind(fd),adjustSegmentDurations:fd.od.bind(fd),getDuration:fd.getDuration.bind(fd),segmentIndex:fd,segmentLookupStrategy:na,
44
+ initSegmentReference:xn,mimeType:Eg,codecs:l,kind:da,gh:pc.type,encrypted:pc.type===c.Ni,keyId:pc.keyId,language:C,originalLanguage:n||_.yg,label:v,type:m,primary:q,trickModeVideo:null,emsgSchemeIdUris:null,frameRate:F?F.frameRate:void 0,width:F?F.width:void 0,height:F?F.height:void 0,bandwidth:void 0,roles:[],channelsCount:z,spatialAudio:A,closedCaptions:G,keyInfo:pc.keyInfo,U:fb,drmInfos:pc.drmInfos,ga:Ca,hc:h.a,hf:h.f,ac:Fg,Ee:wn,duration:hu,me:ab,groupId:p,Bl:Q}});return Qa["return"](new dK(bb))})},
45
+ WK=function(a,b){var c;return _.I(function(d){if(1==d.a)return _.y(d,Promise.all(b.map(function(e){var f;return _.I(function(g){if(1==g.a)return _.y(g,kL(a,e),2);f=g.f;return g["return"](f?{tag:e,playlist:f}:null)})})),2);c=d.f;return d["return"](c.filter(Boolean))})},kL=function(a,b){var c,d,e,f,g,h,l;return _.I(function(m){if(1==m.a){c=_.Y.xl(b);d=_.bj(b,_.hc,void 0,{required:c});if(!d)return m["return"](null);e=_.Y.vd(a.w,d);return _.y(m,lL(a,e),2)}f=m.f;g=f.response;h=f.text;l=g.uri;return m["return"](CK(a,
46
+ h,l,d))})},XK=function(a,b){var c,d,e,f,g,h,l,m;return _.I(function(n){if(1==n.a){var p=new _.Ji(b.streams[0].hf);if(a.a.lowLatencyMode&&b.streams[0].me){var q=b.streams[b.streams.length-1].segmentIndex;if(q=q.a[q.a.length-1]){var u=q.a,v=u.length-1;q={Gl:q.position,Pm:u&&0<u.length?v:null}}else q=null;if(u=q)q=u.Gl,u=u.Pm,v=_.wk(p.a.toString()),v._HLS_msn=q.toString(),null===u&&v._HLS_part&&delete v._HLS_part,null!==u&&(v._HLS_part=u.toString()),q=_.vk(v,!0),_.Mi(p,new _.Qi(q))}c=p.toString();return _.y(n,
47
+ lL(a,c),2)}d=n.f;e=d.response;f=d.text;g=b.Kb();h=b.streams[0].hf;l=e.uri;h!==l&&(h=l,eK(b,h));m=CK(a,f,h,g);return n["return"]({stream:b,playlist:m})})},CK=function(a,b,c,d){a=NJ(a.L,b,c);a.a=d;return a},mL=function(a){if(1<(new Set(a.map(function(b){return b.mimeType}))).size)throw new _.N(_.O,4,4045,"Media playlist contains discontinuities with different MIME types. This is valid, but not yet supported.");},nL=function(a){a=a.map(function(b){return b.a?b.a:b.f.map(function(c){return _.bj(c,_.hc)})||
48
+ null}).map(function(b){return _.Yi(b)});if(1<(new Set(a)).size)throw new _.N(_.O,4,4044,"Unexpected change in file format.");},oL=function(a,b,c){a=_.Y.Bb(a.X,_.Ra);if(1<a.length)throw new _.N(_.O,4,4020);a=a[0];if(!a)return null;var d=_.cj(a,_.hc),e=_.Y.vd(b,d);b=_.Y.gi(a,null,!0);return new _.MC(function(){return[e]},b.xa,b.ka,c)},pL=function(a,b,c,d,e,f,g){var h=[],l={};b=_.w(_.qJ(b.f));for(var m=b.next();!m.done;l={Ve:l.Ve},m=b.next()){var n=m.value;m=n.Ah;n=n.item;var p=0===m,q=p?a:h[h.length-
49
+ 1],u=p?d:q.endTime,v=Number(_.bj(n,_.Ha));v=u+v;p=_.Y.gi(n,p?null:q.ka,p);q=_.bj(n,_.hc);q=_.Y.vd(g,q);l.Ve=q?[q]:[];u=new _.fj(c,u,v,function(z){return function(){return z.Ve}}(l),p.xa,p.ka,e,f,!1,null,null,null,null);if("YES"===_.bj(n,"INDEPENDENT")||0===m)u.h=!0;h.push(u)}return h},qL=function(a,b,c,d,e,f,g,h,l,m,n){var p=c.X,q=c.a;0<_.Y.Bb(p,_.Ra).length&&(n=oL(c,l,g));var u=null!=q,v=q?[q]:[];if(!u&&!a.a.lowLatencyMode)return null;a=0;q={xa:0,ka:null};var z=null;u?(c=_.Y.Hm(p).duration,a=e+c,
50
+ q=_.Y.hi(p,b?b.ka:null)):(b=pL(b,c,d,e,f,g,l),a=b[b.length-1].endTime,z=b);h=h===_.Be?_.Y.Nm(p):null;d=new _.fj(d,e,a,function(){return v},q.xa,q.ka,f,g,!1,null,h?h.Jd:null,h?h.be:null,h?h.durationPerTile:null,z,n);d.ga=m;return d},jL=function(a,b,c,d){var e,f,g,h,l,m,n,p,q,u,v,z,A,G;return _.I(function(F){switch(F.a){case 1:return e=_.Y,f=rL,g=sL,h=b.a,l=b.U,m=e.Uk(b.X,_.Sa),n=[],!FK(a)&&g.Ti(l),_.y(F,tL(a,b.f,h,l,m,c,d),2);case 2:p=F.f,q=m,u=f.ln(l),v=0;case 3:if(!(v<u.length)){F.F(5);break}z=u[v];
51
+ A=n[n.length-1]||null;return _.y(F,uL(a,b.f,z,q,p,c,d,A,u.length),6);case 6:G=F.f;n.push(G);q+=z.length;v++;F.F(3);break;case 5:return mL(n),F["return"](n)}})},tL=function(a,b,c,d,e,f,g){var h,l,m,n,p,q,u,v,z,A,G,F;return _.I(function(C){if(1==C.a){h=d[0];if(null!=a.A)return C["return"](a.A);if(!FK(a)&&a.o)try{var H=a.f.get(c),Q=H?H.find(e)||null:null;if(!Q)throw new _.N(_.O,4,4030,"Segment not found in pervious playlist update.");l=Q.startTime+Q.Aa;a.g.debug(xJ+l+".");a.A=l;return C["return"](l)}catch(R){if(m=
52
+ a.f.get(c))n=m.streams[0].U[0].position,C=m.streams[m.streams.length-1].U,p=C[C.length-1].position,q=e,u=e+d.length-1,a.g.warn("Last #EXT-X-MEDIA-SEQUENCE values "+n+" - "+p+(", new values "+q+" - "+u+"."),b,m);throw new _.N(_.O,4,4047,{message:"The updated playlist does not share any segments with the previous one.",uri:c});}return _.y(C,vL(a,f,g,h),2)}if(3!=C.a)return v=C.f,z=sL.Lm(h,a.w,v),A=oL(h,b,z.keyInfo),G=_.Y.Df(z.keyInfo,e),_.y(C,wL(a,A,h,G,v,g),3);F=C.f;a.g.debug(xJ+F+".");a.A=F;return C["return"](F)})},
53
+ uL=function(a,b,c,d,e,f,g,h,l){var m,n,p,q,u,v,z,A,G,F,C,H,Q,R,na,da,Ba,ab,bb,Qa,Ca;return _.I(function(fb){switch(fb.a){case 1:return m=_.Y,n=sL,p=c[0],q=null==h,nL(c),_.y(fb,vL(a,f,g,p),2);case 2:u=fb.f;v=n.Gm(c,a.w,u,h?h.Al:null,1===l);z=v[v.length-1];A=sL.pa(v);G=oL(p,b,A.keyInfo)||(h?h.ol:null);F=_.Y.Df(A.keyInfo,d);C=p.ga;if(q){H=e;fb.F(3);break}return _.y(fb,xL(a,C,G,p,d,F,u,g),4);case 4:H=fb.f;case 3:Q=H;R=[];for(na=0;na<c.length;na++)if(da=c[na],Ba=R[R.length-1]||null,ab=0===na?0:Ba.endTime,
54
+ bb=d+na,Qa=m.Df(A.keyInfo,bb),Ca=qL(a,Ba,da,bb,ab,Q,Qa,f,b,C,G))G=Ca.initSegment,R.push(Ca);return fb["return"]({U:R,Ak:A,Al:z,mimeType:u,endTime:R[R.length-1].endTime,ga:C,ol:G})}})},PK=function(a,b){b.forEach(function(c){var d=a.f.get(c.a);rL.Zi(c,d,!FK(a))});rL.vk(b)},xL=function(a,b,c,d,e,f,g,h){var l;return _.I(function(m){if(1==m.a)return a.I.has(b)?m["return"](a.I.get(b)):_.y(m,wL(a,c,d,f,g,h),2);l=m.f;a.g.debug("Segment #"+e+" has raw media timestamp "+(l+" s."));a.I.set(b,l);return m["return"](l)})},
55
+ wL=function(a,b,c,d,e,f){var g;return _.I(function(h){if(null==c.a)return h["return"](0);g=_.Y.tk(c,d);return h["return"](cK(a.N,b,g,e,f,null!=d))})},$K=function(a,b){if(1===b.length)return b[0];var c=_.Xi(a,b);if(null!=c)return c;throw new _.N(_.O,4,4025,{codecList:b});},vL=function(a,b,c,d){var e,f,g;return _.I(function(h){e=d.a;g=(f=_.Y.Ra(d.X,_.Ra))?_.cj(f,_.hc):null;return h["return"](yL(a,b,c,e,g))})},yL=function(a,b,c,d,e){var f,g,h,l,m;return _.I(function(n){if(1==n.a){f=[d,e].filter(Boolean);
56
+ if(g=_.$i(f,b,c))return n["return"](g);h=_.Mj([d],a.a.attemptParameters);h.method="HEAD";h.type=2;return _.y(n,a.sf(h),2)}l=n.f;m=l.headers["content-type"];if(!m)throw new _.N(_.O,4,4021,"Unknown MIME type of: "+f.join(", "));return n["return"](m.split(";")[0])})},lL=function(a,b){var c,d,e;return _.I(function(f){if(1==f.a)return c=_.Mj([b],a.a.attemptParameters),c.type=1,_.y(f,a.sf(c),2);d=f.f;e="";try{e=_.S.ba(d.data)}catch(g){throw new _.N(_.O,4,4042);}e=_.S.Qh(e);e=e.trim();return f["return"]({text:e,
57
+ response:d})})},FK=function(a){return a.l===_.oc},GK=function(a,b){_.Y.Mh(b,function(c,d){_.wD(a,c.U,d.startTime)});_.oD(a.a,b[0].startTime,b[b.length-1].endTime)},zL=function(){},iL={Ii:_.iC,Ki:_.hC},hL={Ni:AJ,Pn:BJ,NONE:_.Ze};_.t=TJ.prototype;_.t.set=function(a,b){var c=this;this.f.set(a,b);return b.then(function(d){return c.a.set(a,d)})["catch"](function(){}).then(function(){return c.f["delete"](a)})};_.t.has=function(a){return this.a.has(a)};_.t.get=function(a){return this.a.get(a)||null};
58
+ _.t.values=function(){return Array.from(this.a.values())};_.t.clear=function(){this.f.clear();this.a.clear()};
59
+ var rL={vk:function(a){var b=rL.Jk(a),c=rL.zl(a);a.forEach(function(d){var e=d.U,f=e.findIndex(function(h){return h.ga===b}),g=e.findIndex(function(h){return h.ga===c+1});-1===g&&(g=e.length);d.U=e.slice(f,g)})},Zi:function(a,b,c){b=rL.Tk(a,b,c);a=_.w(a.U||[]);for(c=a.next();!c.done;c=a.next())c=c.value,_.Y.bd(c.X,_.Ma)&&b++,c.ga=b},Tk:function(a,b,c){var d=_.Y.Ra(a.X,_.Na);if(d)return Number(d.value);d=rL.rl(b);if(c&&d)try{return rL.nl(a,b)}catch(e){throw new _.N(_.O,4,4024,"EXT-X-DISCONTINUITY-SEQUENCE tag is required for discontinuous HLS live streams.");
60
+ }return 0},rl:function(a){return 0<rL.Wk(a)},ln:function(a){if(0===a.length)return[];var b=[],c=[];a=_.w(a);for(var d=a.next();!d.done;d=a.next())d=d.value,_.Y.bd(d.X,_.Ma)&&0<c.length&&(b.push(c),c=[]),c.push(d);b.push(c);return b},Wk:function(a){if(!a)return 0;a=a.streams[a.streams.length-1].U;return a[a.length-1].ga},nl:function(a,b){var c=_.Y.Ra(a.X,_.Sa);if(!c)throw rL.g.error("Failed to infer discontinuity number, because EXT-X-MEDIA-SEQUENCE tag is missing."),Error(tJ);c=Number(c.value);var d=
61
+ b.find(c);if(!d)throw rL.g.error("Failed to infer discontinuity number, could not find the appropriate segment in the previous playlist (segment position \x3d "+(c+")")),Error(tJ);return d.ga},zl:function(a){a=a.map(function(b){return b.U[b.U.length-1].ga});return Math.min.apply(Math,_.fh(a))},Jk:function(a){a=a.map(function(b){return b.U[0].ga});return Math.max.apply(Math,_.fh(a))}};rL.g=new _.K("clpp.hls.DiscontinuityUtils");var AL={"com.apple.streamingkeydelivery":function(a,b){if(b===_.Lg)throw new _.N(_.O,4,4041);if(_.cj(a,vJ)===wJ)throw new _.N(_.O,4,4044,"EXT-X-KEY:METHOD SAMPLE-AES-CTR is not supported in FairPlay.");return _.LC(_.Rd,[{initDataType:_.fg,initData:new Uint8Array(0)}],"")},"com.microsoft.playready":$J,"urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":$J,"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":function(a){var b=_.cj(a,vJ);if(!YJ.includes(b))return ZJ.error("Widevine in HLS is only supported with [",
62
+ YJ.join(", "),"], not",b),null;b=_.cj(a,_.hc);b=_.ru(b);b=_.oj(b.data);b=_.LC(_.Vd,[{initDataType:_.vd,initData:b}],"");if(a=_.bj(a,"KEYID"))b.keyIds=[a.substr(2).toLowerCase()];return b}},YJ=["SAMPLE-AES",wJ],ZJ=new _.K("clpp.hls.DrmParser");var sL={Lm:function(a,b,c){return sL.Yf(a.X,b,c)||{type:_.Ze,keyInfo:null,drmInfos:[],keyId:null}},Gm:function(a,b,c,d,e){if(a.slice(1).some(sL.yh))throw new _.N(_.O,4,4046,e?"Media playlist contains an EXT-X-KEY tag with METHOD\x3dAES-128 which is not at the beginning of the playlist.":"Media playlist contains an EXT-X-KEY tag with METHOD\x3dAES-128 which is not marked by an EXT-X-DISCONTINUITY tag and is not at the beginning of the playlist.");if(_.Y.bd(a[0].X,_.Pa)||null===d){if((d=sL.Yf(a[0].X,
63
+ b,c))&&d.type===BJ){if(1<sL.ah(a))throw new _.N(_.O,4,4046,yJ+((e?"playlist":"discontinuity")+"."));return[d]}a=sL.ei(a,b,c);return 0===a.length?[{type:_.Ze,keyInfo:null,drmInfos:[],keyId:null}]:a}b=sL.ei(a,b,c);if(d.type===_.Ze||d.type===AJ)return[d].concat(_.fh(b));if(0<sL.ah(a))throw new _.N(_.O,4,4046,yJ+((e?"playlist":"discontinuity")+"."));return[d]},pa:function(a){if(0===a.length)return{type:_.Ze,keyInfo:null,drmInfos:[],keyId:null};if(a.some(function(c){return c.type===BJ})||a.every(function(c){return c.type===
64
+ _.Ze}))return a[0];a=a.filter(function(c){return c.type===AJ});var b=_.qi(a.flatMap(function(c){return c.drmInfos}));return{keyInfo:null,keyId:a[a.length-1].keyId,type:AJ,drmInfos:b}},Ti:function(a){a=sL.kh(a);if(a.some(function(b){return sL.yh(b)})&&1<a.length)throw new _.N(_.O,4,4046,"Two EXT-X-KEY tags, one with METHOD\x3dAES-128 are applied to one playlist.");},yh:function(a){return _.Y.Bb(a.X,_.Pa).some(function(b){return"AES-128"===_.bj(b,vJ)})},ei:function(a,b,c){return sL.kh(a).map(function(d){return sL.Yf(d.X,
65
+ b,c)})},ah:function(a){return a.filter(function(b){return _.Y.bd(b.X,_.Pa)}).length},kh:function(a){return a.filter(function(b){return _.Y.bd(b.X,_.Pa)})},Yf:function(a,b,c){a=_.Y.Bb(a,_.Pa);if(0===a.length)return null;var d=_.cj(a[0],vJ);if(1===a.length){if("NONE"===d)return{type:_.Ze,keyInfo:null,drmInfos:[],keyId:null};if("AES-128"===d)return a=a[0],d=_.bj(a,"IV",""),{type:BJ,keyInfo:{method:"AES-128",url:_.Y.vd(b,_.cj(a,_.hc)),iv:d?_.Bj((d||"0x").slice(2)):null},drmInfos:[],keyId:null}}b=a.map(function(e){return _.cj(e,
66
+ vJ)});if(!b.every(function(e){return"SAMPLE-AES"===e})&&!b.every(function(e){return e===wJ}))throw sL.g.warn("EXT-X-KEY methods "+b.join(", ")+" are incompatible."),new _.N(_.O,4,4044,"Multiple EXT-X-KEY tags with incompatible METHOD values.");b=a.map(function(e){var f=_.bj(e,"KEYFORMAT","identity"),g=AL[f]||null;(e=g?g(e,c):null)||sL.g.warn("Unsupported HLS KEYFORMAT",f);return e}).filter(Boolean);if(0===b.length)throw new _.N(_.O,4,4026);return{keyInfo:null,keyId:b.map(function(e){return e.keyIds}).reduce(function(e,
67
+ f){return e.concat(f)},[]).reverse()[0]||null,type:AJ,drmInfos:b}},io:function(){return{type:_.Ze,keyInfo:null,drmInfos:[],keyId:null}}};sL.g=new _.K("clpp.hls.EncryptionUtils");_.t=dK.prototype;_.t.length=function(){return this.streams.length};_.t.Vk=function(){return this.streams[0].groupId};_.t.td=function(){return this.streams[0].type};_.t.Pk=function(){return this.streams[0].codecs.split(",")};_.t.Kb=function(){return this.streams[0].hc};_.t.dn=function(a){this.streams.forEach(function(b){b.codecs=a.join(",")})};
68
+ _.t.find=function(a){var b=this.streams.find(function(c){c=c.U;return c[0].position<=a&&a<=c[c.length-1].position});return null==b?null:b.U.find(function(c){return c.position===a})||null};kK.prototype.length=function(){return this.a.length};_.t=zK.prototype;_.t.configure=function(a){this.a=a;this.N.a=a};_.t.setCurrentVariant=function(a){this.j=a};_.t.start=function(a,b){var c=this,d,e,f,g,h;return _.I(function(l){if(1==l.a){if(c.K)throw Error("start() may be called only once!");c.K=!0;c.C=b;return _.y(l,lL(c,a),2)}if(3!=l.a)return d=l.f,e=d.response,f=d.text,c.w=e.uri,_.y(l,HK(c,f),3);g=l.f;c.o=g;h=c.D;c.h&&0<h&&c.h.da(h);return l["return"](g)})};_.t.requestStop=function(){this.J=!0};
69
+ _.t.stop=function(){this.h&&(this.h.stop(),this.h=null);var a=[];this.B&&(a.push(this.B.destroy()),this.B=null);this.f.clear();this.o=this.a=this.C=this.j=null;this.G.clear();return Promise.all(a)};
70
+ _.t.update=function(){var a=this,b,c,d,e,f,g,h,l,m,n;return _.I(function(p){if(1==p.a){b=a.o;if(FK(a)||!b)return p["return"]();c=b.presentationTimeline;"LIVE"===a.l&&(a.A=null);d=Array.from(a.f.values());a.a.lowLatencyMode&&null!==a.j&&(e=AK(a),d=d.filter(function(q){return e.includes(q.Kb())}));return _.y(p,YK(a,d),2)}if(3!=p.a)return f=p.f,g=f.map(function(q){return q.playlist}),PK(a,g),_.y(p,KK(a,f),3);h=p.f;mK(b.periods,h).forEach(function(q){a.C.filterNewPeriod(q)});EK(a,h);l=UK(a,g);m=VK(a,
71
+ g,l);BK(a,m);pK(b.periods,h);qK(b.adaptedPeriods,h);GK(c,h);if(n=_.Y.ll(g))!0!==a.a.keepTimelineLive&&(a.l=_.oc,_.sD(c,!0),c.f=h[h.length-1].endTime),a.h.stop(),a.h=null;if(a.C.onUpdate)a.C.onUpdate(b);if(n&&a.C.onTurnedStatic)a.C.onTurnedStatic();return a.J?_.y(p,a.stop(),0):p.F(0)})};
72
+ _.t.Mb=function(){var a=this,b,c;return _.I(function(d){if(1==d.a){a.g.debug(_.$B);if(!a.C)return d["return"]();_.D(d,2);return _.y(d,a.update(),4)}if(2!=d.a)return a.h&&0<a.D&&a.h.da(a.D),_.th(d,0);b=_.E(d);if(!(b instanceof _.N))throw b;a.C&&(a.C.onError(b),c=b,1===c.severity&&a.h&&a.h.da(.1));_.B(d)})};_.t.sf=function(a){if(!this.B)throw new _.N(_.O,7,7001);a=this.C.networkingEngine.fetch(a);_.Wj(this.B,a);return a.P};_.x(zL,_.Ts);zL.prototype.f=function(){_.St.m3u8=zK;_.Qt[_.Il]=zK;_.Qt[zJ]=zK};zL.prototype.a=function(){_.oE("m3u8");_.pE(_.Il);_.pE(zJ)};zL.prototype.id=function(){return"hls"};_.J("clpp.hls.HlsComponent",zL);};
71
73
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
72
74
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
73
75
  else{_=this.clpp._;(f.call(g,this));}
@@ -1,10 +1,10 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var RS=function(a){this.startTime=a.startTime;this.endTime=a.endTime;this.a=this.f=null;a=a.value;if(!_.O.R(a)){a:{var b=a.info;if(_.O.ca(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=_.O.ca(a)?a:null}},TS=function(a,b,c){this.m=a;this.l=b;this.j=c;this.a=new _.Uh;this.h=(a=_.nu(_.Yc))?new a(this.m.getConfiguration()):null;this.g=new _.K("clpp.hlssmpte.ImageCueHandler");this.f=null;SS(this)},SS=function(a){a.a.one(a.m,_.Ie,function(){return US(a)})},
3
- US=function(a){var b=a.m.getSurface().getMedia();if(b)if(a.h){a.a.on(b.textTracks,_.Nc,function(d){return VS(a,d)});var c=Array.from(b.textTracks);c.filter(function(d){return d.kind===_.Qe}).forEach(function(d){VS(a,{track:d})});!WS(c)&&a.l&&(a.g.warn("The metadata track is not present. Changing an audio track in order to enforce the creation of the metadata track."),XS(a,b))}else a.g.warn("The clpp.ttml.TextParser class is not available. Please register the ttml component first.");else a.g.warn("A video element is not available. Skipping.")},
4
- WS=function(a){return a.some(function(b){return b.kind===_.Qe})},XS=function(a,b){var c=a.m.getTrackManager(),d=c.ma(),e=c.getAudioTracks().find(function(g){return g!==d});if(e){var f=function(){return c.za(d)};a.a.on(b.textTracks,_.Nc,function(g){g.track.kind===_.Qe&&(a.a.off(b.textTracks,_.Nc,f),f())});c.za(e)}else a.g.warn("Can't enforce the creation of the metadata track if single audio track. Skipping.")},VS=function(a,b){var c=b.track;c.kind===_.Qe&&(a.g.info("The metadata track has been added."),
5
- c.mode=_.we,a.a.on(c,_.Wd,function(d){return YS(a,d)}))},YS=function(a,b){var c=ZS(a);c&&Array.from(b.target.activeCues||[]).forEach(function(d){if(d!==a.f&&Number.isFinite(d.startTime)&&Number.isFinite(d.endTime)&&"org.id3"===d.type&&d.value&&"TXXX"===d.value.key){var e=new RS(d);if(e.f===c&&null!==e.a){a.f=d;d=a.h.parseMedia(_.S.Va(e.a),{periodStart:a.j,segmentStart:e.startTime,segmentEnd:e.endTime});var f=a.m.getTextDisplayer();f.remove(0,e.startTime);f.append(d.cues,d.styles)}}})},ZS=function(a){return(a=
6
- a.m.getTrackManager().ua())&&a.language&&a.language.toLowerCase()},$S=function(){this.a=null;this.f=!1},aT=function(){};TS.prototype.destroy=function(){this.a.release();this.f=null;return Promise.resolve()};_.x($S,_.zu);$S.prototype.onPlayerCreated=function(){};$S.prototype.onContentWillLoad=function(a){if(this.f=_.dl()){var b=a.getConfiguration();b=_.O.Na(b.hlssmpte||{});_.O.Bh(b.patchMetadataTrack)||(b.patchMetadataTrack=!1);_.O.ra(b.timestampOffset)||(b.timestampOffset=0);this.a=new TS(a,b.patchMetadataTrack,b.timestampOffset)}};$S.prototype.onPlayerWillDestroy=function(){var a=this;return _.H(function(b){if(1==b.a)return a.a?_.y(b,a.a.destroy(),3):b.F(0);a.a=null;_.A(b)})};$S.prototype.id=function(){return"hlssmpte"};
7
- _.J("clpp.hlssmpte.HlsSmptePlugin",$S);$S.Id="hlssmpte";aT.prototype.create=function(){return new $S};_.$q(new aT);};
2
+ var f=function(window){var YS=function(a){this.startTime=a.startTime;this.endTime=a.endTime;this.a=this.f=null;a=a.value;if(!_.M.S(a)){a:{var b=a.info;if(_.M.ca(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=_.M.ca(a)?a:null}},$S=function(a,b,c){this.m=a;this.l=b;this.j=c;this.a=new _.Xh;this.h=(a=_.uu(_.$c))?new a(this.m.getConfiguration()):null;this.g=new _.K("clpp.hlssmpte.ImageCueHandler");this.f=null;ZS(this)},ZS=function(a){a.a.one(a.m,_.Le,function(){return aT(a)})},
3
+ aT=function(a){var b=a.m.getSurface().getMedia();if(b)if(a.h){a.a.on(b.textTracks,_.Pc,function(d){return bT(a,d)});var c=Array.from(b.textTracks);c.filter(function(d){return d.kind===_.Te}).forEach(function(d){bT(a,{track:d})});!cT(c)&&a.l&&(a.g.warn("The metadata track is not present. Changing an audio track in order to enforce the creation of the metadata track."),dT(a,b))}else a.g.warn("The clpp.ttml.TextParser class is not available. Please register the ttml component first.");else a.g.warn("A video element is not available. Skipping.")},
4
+ cT=function(a){return a.some(function(b){return b.kind===_.Te})},dT=function(a,b){var c=a.m.getTrackManager(),d=c.ma(),e=c.getAudioTracks().find(function(g){return g!==d});if(e){var f=function(){return c.Ba(d)};a.a.on(b.textTracks,_.Pc,function(g){g.track.kind===_.Te&&(a.a.off(b.textTracks,_.Pc,f),f())});c.Ba(e)}else a.g.warn("Can't enforce the creation of the metadata track if single audio track. Skipping.")},bT=function(a,b){var c=b.track;c.kind===_.Te&&(a.g.info("The metadata track has been added."),
5
+ c.mode=_.ye,a.a.on(c,_.Yd,function(d){return eT(a,d)}))},eT=function(a,b){var c=fT(a);c&&Array.from(b.target.activeCues||[]).forEach(function(d){if(d!==a.f&&Number.isFinite(d.startTime)&&Number.isFinite(d.endTime)&&"org.id3"===d.type&&d.value&&"TXXX"===d.value.key){var e=new YS(d);if(e.f===c&&null!==e.a){a.f=d;d=a.h.parseMedia(_.S.Wa(e.a),{periodStart:a.j,segmentStart:e.startTime,segmentEnd:e.endTime});var f=a.m.getTextDisplayer();f.remove(0,e.startTime);f.append(d.cues,d.styles)}}})},fT=function(a){return(a=
6
+ a.m.getTrackManager().wa())&&a.language&&a.language.toLowerCase()},gT=function(){this.a=null;this.f=!1},hT=function(){};$S.prototype.destroy=function(){this.a.release();this.f=null;return Promise.resolve()};_.x(gT,_.Gu);gT.prototype.onPlayerCreated=function(){};gT.prototype.onContentWillLoad=function(a){if(this.f=_.gl()){var b=a.getConfiguration();b=_.M.Oa(b.hlssmpte||{});_.M.Eh(b.patchMetadataTrack)||(b.patchMetadataTrack=!1);_.M.sa(b.timestampOffset)||(b.timestampOffset=0);this.a=new $S(a,b.patchMetadataTrack,b.timestampOffset)}};gT.prototype.onPlayerWillDestroy=function(){var a=this;return _.I(function(b){if(1==b.a)return a.a?_.y(b,a.a.destroy(),3):b.F(0);a.a=null;_.B(b)})};gT.prototype.id=function(){return"hlssmpte"};
7
+ _.J("clpp.hlssmpte.HlsSmptePlugin",gT);gT.Id="hlssmpte";hT.prototype.create=function(){return new gT};_.br(new hT);};
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));}