@castlabs/prestoplay 6.17.0 → 6.17.1

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 +6 -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 +98 -98
  6. package/cjs/cl.conviva.js +31 -31
  7. package/cjs/cl.core.js +372 -369
  8. package/cjs/cl.crypto.js +8 -8
  9. package/cjs/cl.dash.js +71 -71
  10. package/cjs/cl.externs.js +1 -1
  11. package/cjs/cl.freewheel.js +21 -21
  12. package/cjs/cl.hls.js +67 -67
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +29 -29
  15. package/cjs/cl.ima.js +22 -22
  16. package/cjs/cl.mse.js +302 -302
  17. package/cjs/cl.muxdata.js +14 -14
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +13 -13
  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 +71 -71
  24. package/cjs/cl.thumbnails.js +26 -26
  25. package/cjs/cl.tizen.js +64 -64
  26. package/cjs/cl.ttml.js +28 -28
  27. package/cjs/cl.verimatrix.js +5 -5
  28. package/cjs/cl.vimond.js +9 -9
  29. package/cjs/cl.vr.js +18 -18
  30. package/cjs/cl.vtt.js +14 -14
  31. package/cjs/cl.youbora.js +14 -14
  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 +83 -83
  36. package/cl.conviva.js +26 -26
  37. package/cl.core.js +324 -323
  38. package/cl.crypto.js +8 -8
  39. package/cl.dash.js +69 -69
  40. package/cl.externs.js +1 -1
  41. package/cl.freewheel.js +15 -15
  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 +15 -15
  46. package/cl.mse.js +267 -268
  47. package/cl.muxdata.js +11 -11
  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 +54 -54
  56. package/cl.ttml.js +22 -22
  57. package/cl.verimatrix.js +4 -4
  58. package/cl.vimond.js +6 -6
  59. package/cl.vr.js +14 -14
  60. package/cl.vtt.js +11 -11
  61. package/cl.youbora.js +12 -12
  62. package/package.json +1 -1
  63. package/typings.d.ts +3 -2
@@ -1,28 +1,28 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var $S="clpp-freewheel",aT="clpp.freewheel.AdsManagerFactory",bT="freewheel",cT=function(){this.f=this.a=null},dT=function(){},eT=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""}},fT=function(a,b,c){this.h=a;this.f=b;this.a=c},gT=function(a){this.a=a},hT=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},iT=function(a){var b=[];typeof a.networkId!==_.k&&b.push("networkId");typeof a.serverUrl!==_.kg&&b.push("serverUrl");typeof a.profileId!==_.kg&&b.push("profileId");typeof a.videoAssetId!==_.kg&&typeof a.videoAssetId!==_.k&&b.push("videoAssetId");if(b.length)throw new _.P(1,9,12001,{missingKeys:b.join(", ")});},jT=function(){var a,b,c,d;return _.H(function(e){if(1==e.a)return a=new _.Bt,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)})},mT=function(a){return _.H(function(b){if(a.B.length)return kT(a),a.f=a.B.shift(),a.f.play(),b.F(0);lT(a);return _.y(b,a.m.a.play(),0)})},nT=function(a){a.A.length?(kT(a),a.f=a.A.shift(),a.f.play()):lT(a)},kT=function(a){var b=a.m.pc(bT).Xc();b&&(a.m.getSurface().show(b),a.m.getSurface().hideMediaElement(),
5
- a.a.registerVideoDisplayBase($S),a.m.isMuted()?a.setVolume(0):a.setVolume(a.m.getVolume()||1))},lT=function(a){var b=a.m.pc(bT).Xc();b&&a.m.getSurface().hide(b);a.m.getSurface().showMediaElement()},oT=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 fT(a.a,c,d)});a.m.trigger(new _.L(b,d))},pT=function(){this.cd=new _.K(aT)};_.x(cT,_.wu);_.t=cT.prototype;
6
- _.t.onPlayerCreated=function(a){if(window.tv&&tv.freewheel&&tv.freewheel.SDK)this.a=_.Wp(_.ae,{id:$S}),this.f=_.Wp(_.r,{"class":_.zd}),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 bT};_.t.Xc=function(){return this.a};_.t.Kk=function(){return this.f};
7
- _.J("clpp.freewheel.FreeWheelPlugin",cT);cT.prototype.getAdVideo=cT.prototype.Kk;cT.prototype.getAdContainer=cT.prototype.Xc;cT.Id=bT;cT.AD_CONTAINER_ID=$S;dT.prototype.create=function(){return new cT};_.Xq(new dT);_.t=fT.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===_.kg?a:""};_.t.getApiFramework=function(){return this.a?this.a.getActiveCreativeRendition().getCreativeApi():""};_.t.getAdSystem=function(){return""};_.t.getAdvertiserName=function(){return""};_.t.getTitle=function(){return""};
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
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
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
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[]};fT.prototype.getWrapperCreativeIds=fT.prototype.getWrapperCreativeIds;fT.prototype.getWrapperAdSystems=fT.prototype.getWrapperAdSystems;fT.prototype.getWrapperAdIds=fT.prototype.getWrapperAdIds;fT.prototype.getSequenceLength=fT.prototype.Fb;fT.prototype.getPositionInSequence=fT.prototype.Vb;fT.prototype.getPodTimeOffset=fT.prototype.Ub;fT.prototype.getPodIndex=fT.prototype.getPodIndex;fT.prototype.getPodType=fT.prototype.fb;
12
- fT.prototype.getMediaBitrate=fT.prototype.pb;fT.prototype.getMediaHeight=fT.prototype.Cb;fT.prototype.getMediaWidth=fT.prototype.Db;fT.prototype.getMediaUrl=fT.prototype.getMediaUrl;fT.prototype.getClickThroughUrl=fT.prototype.Tb;fT.prototype.isBumper=fT.prototype.tc;fT.prototype.getSkipTimeOffset=fT.prototype.getSkipTimeOffset;fT.prototype.getDuration=fT.prototype.getDuration;fT.prototype.getTitle=fT.prototype.getTitle;fT.prototype.getAdvertiserName=fT.prototype.getAdvertiserName;
13
- fT.prototype.getAdSystem=fT.prototype.getAdSystem;fT.prototype.getApiFramework=fT.prototype.getApiFramework;fT.prototype.getCreativeId=fT.prototype.getCreativeId;fT.prototype.getId=fT.prototype.getId;fT.prototype.getTechnology=fT.prototype.Gb;fT.prototype.getAdManagerVersion=fT.prototype.Ab;fT.prototype.getAdManagerName=fT.prototype.zb;gT.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()}})};gT.prototype.Xb=function(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL).length};gT.prototype.rb=function(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL).length};
14
- gT.prototype.hasPostroll=gT.prototype.rb;gT.prototype.hasPreroll=gT.prototype.Xb;gT.prototype.getCuePoints=gT.prototype.getCuePoints;_.t=hT.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{iT(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!==_.kg&&typeof b.siteSectionId!==_.k||a.a.setSiteSection(b.siteSectionId);return _.y(m,jT(),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,eT(f.type),f.position,f.slotProfile,f.cuepointSequence,f.maxDuration,f.minDuration,f.acceptContentType);b.keyValues&&typeof b.keyValues===_.Ye&&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,_.sg,a.Bj.bind(a));a.h.on(a.m,_.hg,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,mT(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);lT(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(_.Pc,{adsTimeline:new gT(this.a)})),this.j=new _.zt(this.m.getSurface(),function(c,d){return b.a.resize(c,d)},this.m.pc(bT).f);else this.m.onError(new _.P(1,9,10003,{errorType:0},
20
- void 0));this.l.resolve()};_.t.um=function(a){oT(this,_.yc,a);this.j.start()};_.t.tm=function(a){this.f=null;a=a.slot;oT(this,_.zc);this.j.stop();if(a)switch(a.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:mT(this);break;case tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL:lT(this);this.m.play();break;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:nT(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:oT(this,_.Lc,a);oT(this,_.Ec,a);break;case tv.freewheel.SDK.EVENT_AD_IMPRESSION_END:oT(this,_.Mc,a);break;case tv.freewheel.SDK.EVENT_AD_FIRST_QUARTILE:oT(this,_.Dc,a);break;case tv.freewheel.SDK.EVENT_AD_MIDPOINT:oT(this,_.Gc,a);break;case tv.freewheel.SDK.EVENT_AD_THIRD_QUARTILE:oT(this,_.Nc,a);break;case tv.freewheel.SDK.EVENT_AD_COMPLETE:oT(this,_.Cc,a);break;case tv.freewheel.SDK.EVENT_AD_CLICK:oT(this,
22
- _.Bc,a);break;case tv.freewheel.SDK.EVENT_AD_PAUSE:oT(this,_.Hc,a);break;case tv.freewheel.SDK.EVENT_AD_RESUME:oT(this,_.Jc,a);break;case tv.freewheel.SDK.EVENT_AD_SKIPPED:oT(this,_.Kc,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_START:oT(this,_.Ac,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_END:oT(this,_.Ic,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();kT(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);nT(this);break;case _.lp:case _.wp:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_STOPPED)}};hT.prototype.getPosition=hT.prototype.getPosition;hT.prototype.setVolume=hT.prototype.setVolume;
25
- hT.prototype.getVolume=hT.prototype.getVolume;hT.prototype.skip=hT.prototype.skip;hT.prototype.pause=hT.prototype.pause;hT.prototype.resume=hT.prototype.resume;hT.prototype.start=hT.prototype.start;pT.prototype.name=function(){return aT};pT.prototype.isSupported=function(a,b){return a.namespace()===_.Fd?!1:window.tv&&tv.freewheel&&tv.freewheel.SDK?!(!b||!b.freewheel):(this.cd.warn("FreeWheel SDK is not loaded."),!1)};pT.prototype.create=function(a){return new hT(a)};pT.prototype.create=pT.prototype.create;pT.prototype.isSupported=pT.prototype.isSupported;pT.prototype.name=pT.prototype.name;_.Tp(new pT);};
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);};
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,73 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var jJ="Could not parse MP4 segment start time.",kJ="Failed to infer discontinuity number",lJ="Guessing audio-only",mJ="METHOD",nJ="SAMPLE-AES-CTR",oJ="Setting playlist start time to ",pJ="Two EXT-X-KEY tags, one with METHOD\x3dAES-128 are applied to one ",qJ="application/vnd.apple.mpegurl",rJ="sample",sJ="whole-segment",tJ=function(a){if(1>a.a)throw _.Hm();--a.a},uJ=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},vJ=function(a,b,c){c=void 0===c?[]:c;this.X=b;this.a=a;this.f=c;this.ga=-1},wJ=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),_.$u.has(b.name)))return 1;return 0},xJ=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},yJ=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})},zJ=function(a,b){a.forEach(function(c){c.attributes.forEach(function(d){d.value=
5
- yJ(d.value,b)})})},AJ=function(a,b,c){zJ(a,c);b.forEach(function(d){d.a&&(d.a=yJ(d.a,c));zJ(d.X,c);zJ(d.f,c)})},BJ=function(){this.f=0;this.a=new Map},EJ=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===wJ(b)?CJ(a,b,c):DJ(a,b,c)},DJ=function(a,b,c){for(var d=[],e=1;e<b.length;){var f=FJ(a,b[e]);if(_.av.has(f.name))break;d.push(f);e++}b=GJ(a,c,b.slice(e));
6
- e=b.U;d=d.concat(b.X);a=HJ(a,d,c);AJ(d,e,a);return new uJ(c,1,d,b.U)},CJ=function(a,b,c){for(var d=[],e=1;e<b.length;e++){var f=FJ(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(_.gc,g));e++}}b=_.Y.Sb(d,"EXT-X-DEFINE");_.Y.yi(b);b=xJ(b,c);a.a=b;AJ(d,[],a.a);return new uJ(c,0,d)},GJ=function(a,b,c){var d=[],e=[],f=[],g=[];c.forEach(function(h){/^(#EXT)/.test(h)?(h=FJ(a,h),_.$u.has(h.name)||_.cv.has(h.name)?
7
- d.push(h):_.bv.has(h.name)?"EXT-X-PART"===h.name?g.push(h):h.name===_.Ua&&"PART"===_.Zi(h,_.ec)&&g.push(h):f.push(h)):_.Y.Ch(h)||(h=_.Y.td(b,h.trim(),!1),e.push(new vJ(h,f,g)),f=[],g=[])});0<g.length&&e.push(new vJ(null,f,g));return{U:e,X:d}},FJ=function(a,b){return _.Ej(a.f++,b)},HJ=function(a,b,c){b=_.Y.Sb(b,"EXT-X-DEFINE");_.Y.yi(b);var d=xJ(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},IJ=function(a){var b=void 0===b?0:b;return 0>a?[]:Array.from({length:a},function(c,d){return d+b})},JJ=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},KJ=function(){this.a=new Map;this.f=new Map},LJ=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);}JJ(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}}JJ(a,e)||d();
10
- e+=10;e+=f}while(e<a.byteLength);return d()},MJ=function(a){for(;a.getPosition()<a.Ha()-1;){var b=a.getPosition();if(71===_.Im(a))return tJ(a),b}return-1},NJ=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();tJ(d)}function c(){throw new _.P(_.Q,4,4030);}var d=new _.Fm(new DataView(a),!1),e=0,f=0;e=MJ(d);0>e&&(_.zv.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()},OJ=function(a,b){var c=null,d=0;try{(new _.Pm).M(_.Ue,_.Qm).M(_.tg,_.Qm).M(_.Pe,_.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 _.zv.error("Unable to find timescale in init segment!"),new _.P(_.Q,4,4030,jJ,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,jJ,c);return e},RJ=function(a){var b=_.$i(a,mJ);if(!PJ.includes(b))return QJ.error("PlayReady in HLS is only supported with [",PJ.join(", "),"], not",b),null;a=_.$i(a,_.gc);b=_.hu(a);a=null;b=_.lj(b.data);try{a=_.pC(_.Sn(b))}catch(c){a=b}return _.CC(_.Sd,[{initDataType:_.ud,initData:a}],"")},SJ=function(a){this.g=new _.K("clpp.hls.MediaReader");this.f=a;this.a={attemptParameters:_.Gj()}},UJ=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===_.ed||d===_.dd)return v["return"](0);g=f;if(d!==_.cd){v.F(2);break}return _.y(v,TJ(a,c,g),3);case 3:return h=v.f,l=_.lj(h.data),JJ(l)?v["return"](LJ(l)):v["return"](NJ(h.data));case 2:if(d!==_.Jg&&d!==_.gd){v.F(4);break}m=[TJ(a,c,g)];b&&m.push(TJ(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"](OJ(p.data,q.data));case 4:if(d!==_.Ig){v.F(6);break}return _.y(v,TJ(a,c,g),7);case 7:return u=v.f,v["return"](NJ(u.data));case 6:if(!_.xr((d.split("/")[0]||
15
- "")+'/mp4;codecs\x3d"'+e+'"'))return v["return"](0);throw new _.P(_.Q,4,4030);}})},TJ=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=_.dD(b.Ra(),b.wa,b.wa+2048-1,a.a.attemptParameters),e.type=2,f=_.dD(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.");}})},VJ=function(a){this.streams=a},WJ=function(a,b){a.streams.forEach(function(c){c.df=b})},XJ=function(a,b){a.streams.forEach(function(c){c.width=b})},YJ=function(a,b){a.streams.forEach(function(c){c.height=b})},ZJ=function(a,b){a.streams.forEach(function(c){c.frameRate=
17
- b})},$J=function(a,b){a.streams.forEach(function(c){c.bandwidth=b})},aK=function(a,b){var c=a.map(function(d){return d.streams[b]});return c.some(function(d){return null==d})?null:c},bK=function(a){this.a=a},cK=function(a,b){var c=a.map(function(d){return d.a[b]});return c.some(function(d){return null==d})?null:c},dK=function(a,b){var c=new Set(a.map(function(d){return d.ga}));return b.filter(function(d){return!c.has(d.ga)})},gK=function(a,b){for(;a[0].ga<b[0].ga;)a.splice(0,1);var c=a[0],d=b[0];
18
- eK(c,d)||fK(c,d);var e=a.length-1;c=a[e];d=b[e];0<e&&!eK(c,d)&&fK(c,d);for(c=e+1;c<b.length;)a.push(b[c]),c++},hK=function(a,b){var c=a[a.length-1],d=b.findIndex(function(f){return f.ga===c.ga}),e=b[d];eK(c,e)||fK(c,e);for(d+=1;d<b.length;d++)a.push(b[d])},mK=function(a,b,c,d,e){var f=b[0].length();f=IJ(f).map(function(g){var h=cK(b,g)||[],l=aK(c,g)||[];g=aK(d,g)||[];var m=_.ch(iK(h)).concat(_.ch(l),_.ch(g)).filter(Boolean);jK(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&&kK(f[0]);lK(f);return f},iK=function(a){a=new Set(a.flatMap(function(b){return[b.video,b.audio]}).filter(Boolean));return Array.from(a)},kK=function(a){var b=iK(a.variants)[0].U[0].ya;a.startTime+=b;a.endTime+=b},lK=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}},eK=function(a,b){return a.startTime===b.startTime&&a.endTime===b.endTime},
20
- fK=function(a,b){a.startTime=b.startTime;a.endTime=b.endTime;a.duration=b.duration;nK(a.variants,b.variants);oK(_.Y.Me(a),_.Y.Me(b))},nK=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})},oK=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.Ce=d.Ce;e.duration=d.duration;e.dh=d.dh;e.encrypted=d.encrypted;e.drmInfos=d.drmInfos;
21
- e.keyId=d.keyId})},jK=function(a){var b=pK(a);a.forEach(function(c){_.ZC(c.segmentIndex,b);c.duration=b;c.Ce=c.$b+b})},pK=function(a){var b=Infinity;_.Y.Ak(a).forEach(function(c){b=Math.min(b,c.duration)});return b},qK=function(){var a=this;this.a=this.C=null;this.N=1;this.f=new KJ;this.w="";this.K=new BJ;this.D=0;this.j=null;this.h=new _.Wk(function(){a.Ib()});this.l=_.nc;this.o=null;this.A=new _.Sj;this.B=null;this.g=new _.K("clpp.hls.HlsParser");this.H=new Map;this.L=new SJ(this.nf.bind(this));
22
- this.J=!1;this.G=null;this.I=!1},rK=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})},xK=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=sK(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]?_.bd: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(_.gc,N));U.length&&Ca.push(new _.aj(_.sa,U));oa.push(new _.Yi(M.f++,_.Xa,Ca));e=new uJ(N,0,oa)}l=_.Y.Hm(e.X);return _.y(G,tK(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]);uK(a,n);M=!0;N=null;U=0;vK(a)||(M=!1,N=0,U=u.delay);N=new _.gD(a.a.timeline||{},N,U,!0,void 0,!!a.a.lowLatencyMode);_.jD(N,M);wK(N,n);p&&_.iD(N,p);v=N;if(!vK(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===_.nc&&(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)})},AK=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,yK(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=zK(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=mK(m,l,e,f,!0);return p["return"](n)})},yK=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,Pe:{width:v.width,height:v.height,
28
- frameRate:v.frameRate}});return BK(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;CK(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})})},CK=function(a,b){b.forEach(function(c){a.f.a.set(c.Wb(),c)})},tK=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=DK(a,b.be),_.y(v,EK(a,b),2);case 2:return e=v.f,f=Object.values(e).flat().map(function(z){return z.playlist}),FK(a,f),_.y(v,GK(a,e.yg,d),3);case 3:return g=v.f,_.y(v,HK(a,e.be,g,c),4);case 4:return h=v.f,_.y(v,IK(a,e.jn,d),5);case 5:return l=v.f,_.y(v,JK(a,e.Ef),6);case 6:return m=v.f,n=KK(a,e),p=a.C.configurationId,q=mK(p,h,l,m,!vK(a)),a.C.filterAllPeriods(q),vK(a)?(u=null,null!=n&&(u=LK(f,n)),v["return"]({periods:q,ji:n,wi:u})):v["return"]({periods:q,ji:n,wi:null})}})},uK=function(a,b){vK(a)||
30
- 2!==a.a.timeline.version||(a.G||(a.G=b[0].startTime),_.YE(b,-a.G))},LK=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},KK=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},EK=function(a,b){var c,d,e,f,g,h;return _.H(function(l){if(1==l.a)return _.y(l,Promise.all([MK(a,b.dd.Si),MK(a,b.dd.kn),MK(a,b.be),MK(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})})},OK=function(a,b){return Promise.all(b.map(function(c){return NK(a,c)}))},DK=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,_.mc);var h=
32
- _.Zi(f,_.Wb);f=PK(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=QK(_.bd,f),c.set(g,h));e&&(g=QK(_.r,f),c.set(e,g))}return c},IK=function(a,b,c){return Promise.all(b.map(function(d){return RK(a,d,c)}))},JK=function(a,b){return Promise.all(b.map(function(c){return SK(a,c)}))},GK=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=[RK(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 RK(a,
33
- g,c)})),_.y(f,Promise.all(d),3);e=f.f;return f["return"](_.Y.nn(e))})},HK=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,TK(a,n,c,d,e),2)}if(3!=z.a)return p=z.f,q=f.map(function(C){return TK(a,C,c,d,e)}),_.y(z,Promise.all(q),3);u=z.f;u.splice(g,0,p);v=u.reduce(_.zC,[]);return z["return"](v)})},TK=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,UK(a,b,m,c,d),2)):(n=p.f)?p["return"](VK(a,n,l,e)):p["return"]([])})},UK=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=PK(a,h),n=_.Zi(h,"AUDIO"),p=_.Zi(h,_.mc),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(lJ),z=f.AUDIO,C=!0):v.video.length?(a.g.debug(lJ),z=f.AUDIO):(a.g.debug("Guessing video-only"),z=f.VIDEO):(z=f.AUDIO,a.g.debug(lJ)),M=null,C?N.F(2):_.y(N,WK(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){XJ(U,c.width);YJ(U,c.height);ZJ(U,c.frameRate)});_.Y.wk(v);
36
- return N["return"](v)})},VK=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=zK(a,g,m,c),null==m?a.g.warn("Incompatible DRM info in HLS variant. Skipping."):(b.push(m),d.add(l)))}}return b},zK=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 bK(e)},RK=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"](XK(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
- _.ec));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,BK(a,{playlist:f,codecs:q,type:n,Qd:u,primary:G,name:v,channelsCount:F,spatialAudio:D,groupId:m,kind:p,closedCaptions:null,Pe:null}),2)}M=N.f;return N["return"](M)})}))})},SK=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"](XK(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,BK(a,{playlist:e,codecs:h,type:_.ze,Qd:l,name:m,primary:!1,kind:null,channelsCount:null,spatialAudio:!1,closedCaptions:null,groupId:null,Pe:null}),2);n=q.f;(p=_.Zi(d,_.na))&&$J(n,Number(p));return q["return"](n)})}))})},PK=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=_.LC(f);d.has(g)?a.g.debug("Ignoring duplicate codec"):(e.push(f),d.add(g))}return e},WK=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"](XK(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=QK(d,c),_.y(C,BK(a,{playlist:l,codecs:v,type:d,closedCaptions:u,primary:!1,kind:null,
41
- Qd:null,name:null,channelsCount:null,spatialAudio:!1,groupId:null,Pe:f}),2);z=C.f;return C["return"](z)})}))})},XK=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},BK=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=YK;d=ZK;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.Pe;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,$K(a,h,m,l),2)}N=Qa.f;U=a.a.lowLatencyMode?d.Gi:d.Ii;oa=u;m!==e.TEXT||u||(oa=_.ng);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,Yt=nn-Bg,fd=new _.DD(fb),on=fb[0].initSegment||null;return{id:_.iJ++,originalId:v,createSegmentIndex:Promise.resolve.bind(Promise),
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
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,df:h.f,$b:Bg,Ce:nn,duration:Yt,me:ab,groupId:p,yl:M}});return Qa["return"](new VJ(bb))})},MK=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,aL(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))})},aL=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,_.gc,void 0,{required:c});if(!d)return m["return"](null);e=_.Y.td(a.w,d);return _.y(m,bL(a,e),2)}f=m.f;g=f.response;h=f.text;l=g.uri;return m["return"](sK(a,h,l,d))})},NK=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].df);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,bL(a,c),2)}d=n.f;e=d.response;f=d.text;g=b.Wb();h=b.streams[0].df;l=e.uri;h!==l&&(h=l,WJ(b,h));m=sK(a,f,h,g);return n["return"]({stream:b,playlist:m})})},sK=function(a,b,c,d){a=EJ(a.K,b,c);a.a=d;cL(a);return a},cL=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.");})},dL=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.");},eL=function(a){a=a.map(function(b){return b.a?b.a:b.f.map(function(c){return _.Zi(c,_.gc)})||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
- },fL=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,_.gc),e=_.Y.td(b,d);b=_.Y.di(a,null,!0);return new _.DC(function(){return[e]},b.wa,b.ka,c)},gL=function(a,b,c,d,e,f,g){var h=[],l={};b=_.w(_.hJ(b.f));for(var m=b.next();!m.done;l={Re:l.Re},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,_.gc);q=_.Y.td(g,q);l.Re=q?[q]:[];u=new _.cj(c,
49
- u,v,function(z){return function(){return z.Re}}(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},hL=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=gL(b,c,d,e,f,g,l),a=b[b.length-1].endTime,z=b);h=h===_.ze?_.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},$K=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=iL,g=jL,h=b.a,l=b.U,m=e.Sk(b.X,_.Ra),n=[],!vK(a)&&g.Ri(l),_.y(F,kL(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,lL(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 dL(n),F["return"](n)}})},
51
- kL=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(!vK(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(oJ+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,mL(a,f,g,h),2)}if(3!=D.a)return v=D.f,z=jL.Im(h,a.w,v),C=fL(h,b,z.keyInfo),I=_.Y.Af(z.keyInfo,e),_.y(D,nL(a,C,h,I,v,g),3);F=D.f;a.g.debug(oJ+F+".");a.B=F;return D["return"](F)})},lL=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=jL,
53
- p=c[0],q=null==h,eL(c),_.y(fb,mL(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=jL.oa(v);I=fL(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,oL(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=hL(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})}})},FK=function(a,b){b.forEach(function(c){var d=a.f.get(c.a);iL.Xi(c,d,!vK(a))});iL.tk(b)},oL=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,nL(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)})},nL=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"](UJ(a.L,b,g,e,f,null!=d))})},QK=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});},mL=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,_.gc):null;return h["return"](pL(a,b,c,e,g))})},pL=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.nf(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])})},bL=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.nf(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})})},vK=function(a){return a.l===_.nc},wK=function(a,b){_.Y.Jh(b,function(c,d){_.nD(a,c.U,d.startTime)});_.fD(a.a,b[0].startTime,b[b.length-1].endTime)},qL=function(){},
57
- ZK={Gi:_.$B,Ii:_.ZB},YK={Li:rJ,Jn:sJ,NONE:_.Xe};_.t=KJ.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 iL={tk:function(a){var b=iL.Hk(a),c=iL.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=iL.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=iL.ol(b);if(c&&d)try{return iL.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<iL.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 iL.g.error("Failed to infer discontinuity number, because EXT-X-MEDIA-SEQUENCE tag is missing."),Error(kJ);c=Number(c.value);var d=
60
- b.find(c);if(!d)throw iL.g.error("Failed to infer discontinuity number, could not find the appropriate segment in the previous playlist (segment position \x3d "+(c+")")),Error(kJ);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))}};iL.g=new _.K("clpp.hls.DiscontinuityUtils");var rL={"com.apple.streamingkeydelivery":function(a,b){if(b===_.Ig)throw new _.P(_.Q,4,4041);if(_.$i(a,mJ)===nJ)throw new _.P(_.Q,4,4044,"EXT-X-KEY:METHOD SAMPLE-AES-CTR is not supported in FairPlay.");return _.CC(_.Qd,[{initDataType:_.dg,initData:new Uint8Array(0)}],"")},"com.microsoft.playready":RJ,"urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":RJ,"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":function(a){var b=_.$i(a,mJ);if(!PJ.includes(b))return QJ.error("Widevine in HLS is only supported with [",
61
- PJ.join(", "),"], not",b),null;b=_.$i(a,_.gc);b=_.hu(b);b=_.lj(b.data);b=_.CC(_.Ud,[{initDataType:_.ud,initData:b}],"");if(a=_.Zi(a,"KEYID"))b.keyIds=[a.substr(2).toLowerCase()];return b}},PJ=["SAMPLE-AES",nJ],QJ=new _.K("clpp.hls.DrmParser");var jL={Im:function(a,b,c){return jL.Vf(a.X,b,c)||{type:_.Xe,keyInfo:null,drmInfos:[],keyId:null}},Dm:function(a,b,c,d,e){if(a.slice(1).some(jL.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=jL.Vf(a[0].X,
62
- b,c))&&d.type===sJ){if(1<jL.Yg(a))throw new _.P(_.Q,4,4046,pJ+((e?"playlist":"discontinuity")+"."));return[d]}a=jL.bi(a,b,c);return 0===a.length?[{type:_.Xe,keyInfo:null,drmInfos:[],keyId:null}]:a}b=jL.bi(a,b,c);if(d.type===_.Xe||d.type===rJ)return[d].concat(_.ch(b));if(0<jL.Yg(a))throw new _.P(_.Q,4,4046,pJ+((e?"playlist":"discontinuity")+"."));return[d]},oa:function(a){if(0===a.length)return{type:_.Xe,keyInfo:null,drmInfos:[],keyId:null};if(a.some(function(c){return c.type===sJ})||a.every(function(c){return c.type===
63
- _.Xe}))return a[0];a=a.filter(function(c){return c.type===rJ});var b=_.ni(a.flatMap(function(c){return c.drmInfos}));return{keyInfo:null,keyId:a[a.length-1].keyId,type:rJ,drmInfos:b}},Ri:function(a){a=jL.hh(a);if(a.some(function(b){return jL.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,mJ)})},bi:function(a,b,c){return jL.hh(a).map(function(d){return jL.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],mJ);if(1===a.length){if("NONE"===d)return{type:_.Xe,keyInfo:null,drmInfos:[],keyId:null};if("AES-128"===d)return a=a[0],d=_.Zi(a,"IV",""),{type:sJ,keyInfo:{method:"AES-128",url:_.Y.td(b,_.$i(a,_.gc)),iv:d?_.yj((d||"0x").slice(2)):null},drmInfos:[],keyId:null}}b=a.map(function(e){return _.$i(e,
65
- mJ)});if(!b.every(function(e){return"SAMPLE-AES"===e})&&!b.every(function(e){return e===nJ}))throw jL.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=rL[f]||null;(e=g?g(e,c):null)||jL.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:rJ,drmInfos:b}},bo:function(){return{type:_.Xe,keyInfo:null,drmInfos:[],keyId:null}}};jL.g=new _.K("clpp.hls.EncryptionUtils");_.t=VJ.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};bK.prototype.length=function(){return this.a.length};_.t=qK.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,bL(c,a),2)}if(3!=l.a)return d=l.f,e=d.response,f=d.text,c.w=e.uri,_.y(l,xK(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};
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
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(vK(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=rK(a),d=d.filter(function(n){return e.includes(n.Wb())}));return _.y(m,OK(a,d),2)}if(3!=m.a)return f=m.f,g=f.map(function(n){return n.playlist}),FK(a,g),_.y(m,AK(a,f),3);h=m.f;dK(b.periods,h).forEach(function(n){a.C.filterNewPeriod(n)});uK(a,h);gK(b.periods,h);hK(b.adaptedPeriods,
69
- h);wK(c,h);if(l=_.Y.jl(g))!0!==a.a.keepTimelineLive&&(a.l=_.nc,_.jD(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(_.RB);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.nf=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(qL,_.Js);qL.prototype.f=function(){_.It.m3u8=qK;_.Gt[_.Fl]=qK;_.Gt[qJ]=qK};qL.prototype.a=function(){_.gE("m3u8");_.hE(_.Fl);_.hE(qJ)};qL.prototype.id=function(){return"hls"};_.J("clpp.hls.HlsComponent",qL);};
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);};
71
71
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
72
72
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
73
73
  else{_=this.clpp._;(f.call(g,this));}
@@ -1,10 +1,10 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var PS=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}},RS=function(a,b,c){this.m=a;this.l=b;this.j=c;this.a=new _.Uh;this.h=(a=_.ku(_.Zc))?new a(this.m.getConfiguration()):null;this.g=new _.K("clpp.hlssmpte.ImageCueHandler");this.f=null;QS(this)},QS=function(a){a.a.one(a.m,_.Je,function(){return SS(a)})},
3
- SS=function(a){var b=a.m.getSurface().getMedia();if(b)if(a.h){a.a.on(b.textTracks,_.Oc,function(d){return TS(a,d)});var c=Array.from(b.textTracks);c.filter(function(d){return d.kind===_.Re}).forEach(function(d){TS(a,{track:d})});!US(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."),VS(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
- US=function(a){return a.some(function(b){return b.kind===_.Re})},VS=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,_.Oc,function(g){g.track.kind===_.Re&&(a.a.off(b.textTracks,_.Oc,f),f())});c.za(e)}else a.g.warn("Can't enforce the creation of the metadata track if single audio track. Skipping.")},TS=function(a,b){var c=b.track;c.kind===_.Re&&(a.g.info("The metadata track has been added."),
5
- c.mode=_.xe,a.a.on(c,_.Xd,function(d){return WS(a,d)}))},WS=function(a,b){var c=XS(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 PS(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)}}})},XS=function(a){return(a=
6
- a.m.getTrackManager().ua())&&a.language&&a.language.toLowerCase()},YS=function(){this.a=null;this.f=!1},ZS=function(){};RS.prototype.destroy=function(){this.a.release();this.f=null;return Promise.resolve()};_.x(YS,_.wu);YS.prototype.onPlayerCreated=function(){};YS.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 RS(a,b.patchMetadataTrack,b.timestampOffset)}};YS.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)})};YS.prototype.id=function(){return"hlssmpte"};
7
- _.J("clpp.hlssmpte.HlsSmptePlugin",YS);YS.Id="hlssmpte";ZS.prototype.create=function(){return new YS};_.Xq(new ZS);};
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);};
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));}