@castlabs/prestoplay 6.17.0 → 6.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +7 -7
  5. package/cjs/cl.cast.js +111 -111
  6. package/cjs/cl.conviva.js +33 -33
  7. package/cjs/cl.core.js +566 -555
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +75 -74
  10. package/cjs/cl.externs.js +46 -46
  11. package/cjs/cl.freewheel.js +24 -24
  12. package/cjs/cl.hls.js +71 -69
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +29 -29
  15. package/cjs/cl.ima.js +23 -23
  16. package/cjs/cl.mse.js +312 -312
  17. package/cjs/cl.muxdata.js +15 -15
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +14 -14
  20. package/cjs/cl.playlist.js +6 -6
  21. package/cjs/cl.sessions.js +15 -15
  22. package/cjs/cl.simid.js +15 -15
  23. package/cjs/cl.smooth.js +72 -72
  24. package/cjs/cl.thumbnails.js +26 -26
  25. package/cjs/cl.tizen.js +69 -69
  26. package/cjs/cl.ttml.js +28 -28
  27. package/cjs/cl.verimatrix.js +5 -5
  28. package/cjs/cl.vimond.js +13 -13
  29. package/cjs/cl.vr.js +19 -19
  30. package/cjs/cl.vtt.js +14 -14
  31. package/cjs/cl.youbora.js +18 -18
  32. package/cl.adobe.js +3 -3
  33. package/cl.airplay.js +3 -3
  34. package/cl.broadpeak.js +5 -5
  35. package/cl.cast.js +87 -87
  36. package/cl.conviva.js +27 -27
  37. package/cl.core.js +449 -442
  38. package/cl.crypto.js +8 -8
  39. package/cl.dash.js +70 -69
  40. package/cl.externs.js +46 -46
  41. package/cl.freewheel.js +19 -19
  42. package/cl.hls.js +72 -72
  43. package/cl.hlssmpte.js +5 -5
  44. package/cl.htmlcue.js +26 -26
  45. package/cl.ima.js +17 -17
  46. package/cl.mse.js +274 -274
  47. package/cl.muxdata.js +13 -13
  48. package/cl.onboard.js +4 -4
  49. package/cl.persistent.js +10 -10
  50. package/cl.playlist.js +5 -5
  51. package/cl.sessions.js +10 -10
  52. package/cl.simid.js +13 -13
  53. package/cl.smooth.js +59 -59
  54. package/cl.thumbnails.js +19 -19
  55. package/cl.tizen.js +57 -57
  56. package/cl.ttml.js +22 -22
  57. package/cl.verimatrix.js +4 -4
  58. package/cl.vimond.js +8 -8
  59. package/cl.vr.js +15 -15
  60. package/cl.vtt.js +12 -12
  61. package/cl.youbora.js +14 -14
  62. package/package.json +2 -2
  63. package/typings.d.ts +40 -5
package/cl.freewheel.js CHANGED
@@ -1,19 +1,19 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var SR="clpp-freewheel",TR="clpp.freewheel.AdsManagerFactory",UR="freewheel",VR=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""}},WR=function(a){const b=[];typeof a.networkId!==_.t&&b.push("networkId");typeof a.serverUrl!==_.Nf&&b.push("serverUrl");typeof a.profileId!==_.Nf&&b.push("profileId");typeof a.videoAssetId!==_.Nf&&typeof a.videoAssetId!==_.t&&b.push("videoAssetId");
2
- if(b.length)throw new _.H(1,9,12001,{missingKeys:b.join(", ")});},YR=function(){return _.x(function*(){var a=new _.fu;let b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_NONE;const c=yield a.canPlay(!1);a=yield a.canPlay(!0);c?b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_ATTENDED:a&&(b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_UNATTENDED);return b})},ZR=function(a){a.g.on(a.a,tv.freewheel.SDK.EVENT_REQUEST_COMPLETE,a.H.bind(a));a.g.on(a.a,tv.freewheel.SDK.EVENT_SLOT_STARTED,a.J.bind(a));a.g.on(a.a,
3
- tv.freewheel.SDK.EVENT_SLOT_ENDED,a.I.bind(a));a.g.on(a.a,tv.freewheel.SDK.EVENT_AD,a.G.bind(a));a.g.on(a.m,_.Uf,a.F.bind(a));a.g.on(a.m,_.Kf,a.C.bind(a))},bS=function(a){return _.x(function*(){a.B.length?($R(a),a.f=a.B.shift(),a.f.play()):(aS(a),yield a.m.a.play())})},aS=function(a){const b=a.m.cc(UR).xc();b&&a.m.getSurface().hide(b);a.m.getSurface().showMediaElement()},$R=function(a){const b=a.m.cc(UR).xc();b&&(a.m.getSurface().show(b),a.m.getSurface().hideMediaElement(),a.a.registerVideoDisplayBase(SR),
4
- a.m.isMuted()?a.setVolume(0):a.setVolume(a.m.getVolume()||1))},cS=function(a){a.A.length?($R(a),a.f=a.A.shift(),a.f.play()):aS(a)},dS=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 Y(a.a,c,d)});a.m.trigger(new _.E(b,d))},eS=class extends _.pu{constructor(){super();this.f=this.a=null}onPlayerCreated(a){if(window.tv&&tv.freewheel&&tv.freewheel.SDK)this.a=_.ro(_.Gd,{id:SR}),this.f=_.ro(_.w,{"class":_.ed}),this.a.appendChild(this.f),a.getSurface().addElementToContainer(this.a,
5
- !0),a.getSurface().hide(this.a);else a.onError(new _.H(1,9,12E3))}onPlayerWillDestroy(a){this.a&&(a.getSurface().removeElementFromContainer(this.a),this.f=this.a=null)}id(){return UR}xc(){return this.a}wg(){return this.f}};_.z("clpp.freewheel.FreeWheelPlugin",eS);eS.prototype.getAdVideo=eS.prototype.wg;eS.prototype.getAdContainer=eS.prototype.xc;eS.Id=UR;eS.AD_CONTAINER_ID=SR;_.Yo(new class{create(){return new eS}});var Y=class{constructor(a,b,c){this.g=a;this.f=b;this.a=c}vb(){return"FreeWheel AdManager SDK"}wb(){return tv.freewheel.SDK.version}Cb(){return 0}getId(){return this.a?this.a.getAdId():""}getCreativeId(){const a=(this.a||{})._creativeId;return typeof a===_.Nf?a:""}getApiFramework(){return this.a?this.a.getActiveCreativeRendition().getCreativeApi():""}getAdSystem(){return""}getAdvertiserName(){return""}getTitle(){return""}getDuration(){return this.a?this.a.getActiveCreativeRendition().getDuration():
6
- 0}getSkipTimeOffset(){return 0}gc(){return!1}Mb(){return this.a&&this.a.getEventCallbackUrls(tv.freewheel.SDK.EVENT_AD_CLICK,tv.freewheel.SDK.EVENT_TYPE_CLICK)[0]||""}getMediaUrl(){return this.a?this.a.getActiveCreativeRendition().getPrimaryCreativeRenditionAsset().getUrl():""}zb(){return this.a?this.a.getActiveCreativeRendition().getWidth():0}yb(){return this.a?this.a.getActiveCreativeRendition().getHeight():0}nb(){return 0}ab(){switch(this.f.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:return 0;
7
- case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:return 2;default:return 1}}getPodIndex(){switch(this.ab()){case 0:return 0;case 2:return-1}return this.g.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL).indexOf(this.f)+1}Nb(){switch(this.ab()){case 0:return 0;case 2:return-1;default:return this.f.getTimePosition()}}Ob(){return this.a?this.f.getAdInstances().indexOf(this.a)+1:1}Bb(){return this.f.getAdCount()}getWrapperAdIds(){return[]}getWrapperAdSystems(){return[]}getWrapperCreativeIds(){return[]}};
8
- Y.prototype.getWrapperCreativeIds=Y.prototype.getWrapperCreativeIds;Y.prototype.getWrapperAdSystems=Y.prototype.getWrapperAdSystems;Y.prototype.getWrapperAdIds=Y.prototype.getWrapperAdIds;Y.prototype.getSequenceLength=Y.prototype.Bb;Y.prototype.getPositionInSequence=Y.prototype.Ob;Y.prototype.getPodTimeOffset=Y.prototype.Nb;Y.prototype.getPodIndex=Y.prototype.getPodIndex;Y.prototype.getPodType=Y.prototype.ab;Y.prototype.getMediaBitrate=Y.prototype.nb;Y.prototype.getMediaHeight=Y.prototype.yb;
9
- Y.prototype.getMediaWidth=Y.prototype.zb;Y.prototype.getMediaUrl=Y.prototype.getMediaUrl;Y.prototype.getClickThroughUrl=Y.prototype.Mb;Y.prototype.isBumper=Y.prototype.gc;Y.prototype.getSkipTimeOffset=Y.prototype.getSkipTimeOffset;Y.prototype.getDuration=Y.prototype.getDuration;Y.prototype.getTitle=Y.prototype.getTitle;Y.prototype.getAdvertiserName=Y.prototype.getAdvertiserName;Y.prototype.getAdSystem=Y.prototype.getAdSystem;Y.prototype.getApiFramework=Y.prototype.getApiFramework;
10
- Y.prototype.getCreativeId=Y.prototype.getCreativeId;Y.prototype.getId=Y.prototype.getId;Y.prototype.getTechnology=Y.prototype.Cb;Y.prototype.getAdManagerVersion=Y.prototype.wb;Y.prototype.getAdManagerName=Y.prototype.vb;var fS=class{constructor(a){this.a=a}getCuePoints(){return this.a.getTemporalSlots().map(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()}})}Pb(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL).length}pb(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL).length}};
11
- fS.prototype.hasPostroll=fS.prototype.pb;fS.prototype.hasPreroll=fS.prototype.Pb;fS.prototype.getCuePoints=fS.prototype.getCuePoints;var gS=class{constructor(a){this.h=new _.R("clpp.freewheel.AdsManager");this.m=a;this.g=new _.hs;this.w=new tv.freewheel.SDK.AdManager;this.f=this.a=null;this.B=[];this.o=[];this.A=[];this.l=new _.an;this.j=null}load(){const a=this;return _.x(function*(){const b=a.m.getConfiguration().freewheel||{};try{WR(b)}catch(d){return a.m.onError(d),a.l.resolve(),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!==_.Nf&&typeof b.siteSectionId!==
12
- _.t||a.a.setSiteSection(b.siteSectionId);const c=yield YR();a.a.setVideoAsset(b.videoAssetId,a.m.getDuration(),void 0,void 0,c);if(Array.isArray(b.pods))for(const d of b.pods)a.a.addTemporalSlot(d.id,VR(d.type),d.position,d.slotProfile,d.cuepointSequence,d.maxDuration,d.minDuration,d.acceptContentType);b.keyValues&&typeof b.keyValues===_.De&&Object.keys(b.keyValues).forEach(d=>a.a.addKeyValue(d,b.keyValues[d]));a.a.setParameter(tv.freewheel.SDK.PARAMETER_EXTENSION_CONTENT_VIDEO_ENABLED,!1,tv.freewheel.SDK.PARAMETER_LEVEL_GLOBAL);
13
- if(Array.isArray(b.parameters))for(const d of b.parameters)a.a.setParameter(d.name,d.value,d.level);ZR(a);a.a.submitRequest();return a.l})}start(){const a=this;return _.x(function*(){yield bS(a)})}resume(){this.f&&this.f.resume()}pause(){this.f&&this.f.pause()}skip(){this.f&&this.f.skipCurrentAd()}getVolume(){return this.a?this.a.getAdVolume():1}setVolume(a){this.a&&this.a.setAdVolume(a)}getPosition(){return this.f?this.f.getPlayheadTime():-1}dispose(){const a=this;return _.x(function*(){a.g.release();
14
- a.j&&(a.j.stop(),a.j=null);aS(a);a.a&&(a.a.dispose(),a.a=null)})}H(a){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 _.E(_.uc,{adsTimeline:new fS(this.a)})),this.j=new _.du(this.m.getSurface(),(b,c)=>this.a.resize(b,c),this.m.cc(UR).f);else this.m.onError(new _.H(1,
15
- 9,10003,{errorType:0},void 0));this.l.resolve()}J(a){dS(this,_.cc,a);this.j.start()}I(a){this.f=null;a=a.slot;dS(this,_.dc);this.j.stop();if(a)switch(a.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:bS(this);break;case tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL:aS(this);this.m.play();break;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:cS(this)}}G(a){const b=a.subType;this.h.debug("ad event",b);switch(b){case tv.freewheel.SDK.EVENT_AD_IMPRESSION:dS(this,_.qc,a);dS(this,
16
- _.ic,a);break;case tv.freewheel.SDK.EVENT_AD_IMPRESSION_END:dS(this,_.rc,a);break;case tv.freewheel.SDK.EVENT_AD_FIRST_QUARTILE:dS(this,_.hc,a);break;case tv.freewheel.SDK.EVENT_AD_MIDPOINT:dS(this,_.lc,a);break;case tv.freewheel.SDK.EVENT_AD_THIRD_QUARTILE:dS(this,_.sc,a);break;case tv.freewheel.SDK.EVENT_AD_COMPLETE:dS(this,_.gc,a);break;case tv.freewheel.SDK.EVENT_AD_CLICK:dS(this,_.fc,a);break;case tv.freewheel.SDK.EVENT_AD_PAUSE:dS(this,_.mc,a);break;case tv.freewheel.SDK.EVENT_AD_RESUME:dS(this,
17
- _.oc,a);break;case tv.freewheel.SDK.EVENT_AD_SKIPPED:dS(this,_.pc,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_START:dS(this,_.ec,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_END:dS(this,_.nc,a);break;case tv.freewheel.SDK.EVENT_ERROR:this.m.onError(new _.H(1,9,10003,{errorType:1},{fwCode:a[tv.freewheel.SDK.INFO_KEY_ERROR_CODE],fwInfo:a[tv.freewheel.SDK.INFO_KEY_ERROR_INFO],fwModule:a[tv.freewheel.SDK.INFO_KEY_ERROR_MODULE]}))}}F(){if(!this.f){var a=this.m.getPosition();if(this.f=this.o.find(b=>
18
- .5>Math.abs(a-b.getTimePosition()))||null){const b=this.o.findIndex(c=>c===this.f);this.o.splice(b,1);this.m.pause();$R(this);this.f.play()}}}C(a){if((a=a.detail)&&this.a)switch(a.currentState){case _.Wn:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PLAYING);break;case _.Vn:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PAUSED);break;case _.Ln:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_COMPLETED);cS(this);break;case _.Tn:case _.Sn:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_STOPPED)}}};
19
- gS.prototype.getPosition=gS.prototype.getPosition;gS.prototype.setVolume=gS.prototype.setVolume;gS.prototype.getVolume=gS.prototype.getVolume;gS.prototype.skip=gS.prototype.skip;gS.prototype.pause=gS.prototype.pause;gS.prototype.resume=gS.prototype.resume;gS.prototype.start=gS.prototype.start;var hS=class{constructor(){this.a=new _.R(TR)}name(){return TR}isSupported(a,b){return a.namespace()===_.kd?!1:window.tv&&tv.freewheel&&tv.freewheel.SDK?!(!b||!b.freewheel):(this.a.warn("FreeWheel SDK is not loaded."),!1)}create(a){return new gS(a)}};hS.prototype.create=hS.prototype.create;hS.prototype.isSupported=hS.prototype.isSupported;hS.prototype.name=hS.prototype.name;_.oo(new hS);};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var dS="clpp-freewheel",eS="clpp.freewheel.AdsManagerFactory",fS="freewheel",gS=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""}},hS=function(a){const b=[];typeof a.networkId!==_.t&&b.push("networkId");typeof a.serverUrl!==_.Qf&&b.push("serverUrl");typeof a.profileId!==_.Qf&&b.push("profileId");typeof a.videoAssetId!==_.Qf&&typeof a.videoAssetId!==_.t&&b.push("videoAssetId");
2
+ if(b.length)throw new _.H(1,9,12001,{missingKeys:b.join(", ")});},iS=function(){return _.x(function*(){var a=new _.qu;let b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_NONE;const c=yield a.canPlay(!1);a=yield a.canPlay(!0);c?b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_ATTENDED:a&&(b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_UNATTENDED);return b})},jS=function(a){a.h.on(a.a,tv.freewheel.SDK.EVENT_REQUEST_COMPLETE,a.H.bind(a));a.h.on(a.a,tv.freewheel.SDK.EVENT_SLOT_STARTED,a.J.bind(a));a.h.on(a.a,
3
+ tv.freewheel.SDK.EVENT_SLOT_ENDED,a.I.bind(a));a.h.on(a.a,tv.freewheel.SDK.EVENT_AD,a.G.bind(a));a.h.on(a.m,_.Xf,a.F.bind(a));a.h.on(a.m,_.Nf,a.C.bind(a))},mS=function(a){return _.x(function*(){a.B.length?(kS(a),a.f=a.B.shift(),a.f.play()):(lS(a),yield a.m.a.play())})},lS=function(a){const b=a.m.gc(fS).Ac();b&&a.m.getSurface().hide(b);a.m.getSurface().showMediaElement()},kS=function(a){const b=a.m.gc(fS).Ac();b&&(a.m.getSurface().show(b),a.m.getSurface().hideMediaElement(),a.a.registerVideoDisplayBase(dS),
4
+ a.m.isMuted()?a.setVolume(0):a.setVolume(a.m.getVolume()||1))},nS=function(a){a.A.length?(kS(a),a.f=a.A.shift(),a.f.play()):lS(a)},oS=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 Y(a.a,c,d)});a.m.trigger(new _.E(b,d))},pS=class extends _.Au{constructor(){super();this.f=this.a=null}onPlayerCreated(a){if(window.tv&&tv.freewheel&&tv.freewheel.SDK)this.a=_.uo(_.Gd,{id:dS}),this.f=_.uo(_.w,{"class":_.ed}),this.a.appendChild(this.f),a.getSurface().addElementToContainer(this.a,
5
+ !0),a.getSurface().hide(this.a);else a.onError(new _.H(1,9,12E3))}onPlayerWillDestroy(a){this.a&&(a.getSurface().removeElementFromContainer(this.a),this.f=this.a=null)}id(){return fS}Ac(){return this.a}yg(){return this.f}};_.z("clpp.freewheel.FreeWheelPlugin",pS);pS.prototype.getAdVideo=pS.prototype.yg;pS.prototype.getAdContainer=pS.prototype.Ac;pS.Id=fS;pS.AD_CONTAINER_ID=dS;_.dp(new class{create(){return new pS}});var Y=class{constructor(a,b,c){this.h=a;this.f=b;this.a=c}yb(){return"FreeWheel AdManager SDK"}zb(){return tv.freewheel.SDK.version}Fb(){return 0}getId(){return this.a?this.a.getAdId():""}getCreativeId(){const a=(this.a||{})._creativeId;return typeof a===_.Qf?a:""}getApiFramework(){return this.a?this.a.getActiveCreativeRendition().getCreativeApi():""}getAdSystem(){return""}getAdvertiserName(){return""}getTitle(){return""}getDuration(){return this.a?this.a.getActiveCreativeRendition().getDuration():
6
+ 0}getSkipTimeOffset(){return 0}kc(){return!1}Qb(){return this.a&&this.a.getEventCallbackUrls(tv.freewheel.SDK.EVENT_AD_CLICK,tv.freewheel.SDK.EVENT_TYPE_CLICK)[0]||""}getMediaUrl(){return this.a?this.a.getActiveCreativeRendition().getPrimaryCreativeRenditionAsset().getUrl():""}Cb(){return this.a?this.a.getActiveCreativeRendition().getWidth():0}Bb(){return this.a?this.a.getActiveCreativeRendition().getHeight():0}qb(){return 0}eb(){switch(this.f.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:return 0;
7
+ case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:return 2;default:return 1}}getPodIndex(){switch(this.eb()){case 0:return 0;case 2:return-1}return this.h.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL).indexOf(this.f)+1}Rb(){switch(this.eb()){case 0:return 0;case 2:return-1;default:return this.f.getTimePosition()}}Sb(){return this.a?this.f.getAdInstances().indexOf(this.a)+1:1}Eb(){return this.f.getAdCount()}getWrapperAdIds(){return[]}getWrapperAdSystems(){return[]}getWrapperCreativeIds(){return[]}};
8
+ Y.prototype.getWrapperCreativeIds=Y.prototype.getWrapperCreativeIds;Y.prototype.getWrapperAdSystems=Y.prototype.getWrapperAdSystems;Y.prototype.getWrapperAdIds=Y.prototype.getWrapperAdIds;Y.prototype.getSequenceLength=Y.prototype.Eb;Y.prototype.getPositionInSequence=Y.prototype.Sb;Y.prototype.getPodTimeOffset=Y.prototype.Rb;Y.prototype.getPodIndex=Y.prototype.getPodIndex;Y.prototype.getPodType=Y.prototype.eb;Y.prototype.getMediaBitrate=Y.prototype.qb;Y.prototype.getMediaHeight=Y.prototype.Bb;
9
+ Y.prototype.getMediaWidth=Y.prototype.Cb;Y.prototype.getMediaUrl=Y.prototype.getMediaUrl;Y.prototype.getClickThroughUrl=Y.prototype.Qb;Y.prototype.isBumper=Y.prototype.kc;Y.prototype.getSkipTimeOffset=Y.prototype.getSkipTimeOffset;Y.prototype.getDuration=Y.prototype.getDuration;Y.prototype.getTitle=Y.prototype.getTitle;Y.prototype.getAdvertiserName=Y.prototype.getAdvertiserName;Y.prototype.getAdSystem=Y.prototype.getAdSystem;Y.prototype.getApiFramework=Y.prototype.getApiFramework;
10
+ Y.prototype.getCreativeId=Y.prototype.getCreativeId;Y.prototype.getId=Y.prototype.getId;Y.prototype.getTechnology=Y.prototype.Fb;Y.prototype.getAdManagerVersion=Y.prototype.zb;Y.prototype.getAdManagerName=Y.prototype.yb;var qS=class{constructor(a){this.a=a}getCuePoints(){return this.a.getTemporalSlots().map(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()}})}Tb(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL).length}sb(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL).length}};
11
+ qS.prototype.hasPostroll=qS.prototype.sb;qS.prototype.hasPreroll=qS.prototype.Tb;qS.prototype.getCuePoints=qS.prototype.getCuePoints;var rS=class{constructor(a){this.g=new _.R("clpp.freewheel.AdsManager");this.m=a;this.h=new _.ts;this.w=new tv.freewheel.SDK.AdManager;this.f=this.a=null;this.B=[];this.o=[];this.A=[];this.l=new _.dn;this.j=null}load(){const a=this;return _.x(function*(){const b=a.m.getConfiguration().freewheel||{};try{hS(b)}catch(d){return a.m.onError(d),a.l.resolve(),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!==_.Qf&&typeof b.siteSectionId!==
12
+ _.t||a.a.setSiteSection(b.siteSectionId);const c=yield iS();a.a.setVideoAsset(b.videoAssetId,a.m.getDuration(),void 0,void 0,c);if(Array.isArray(b.pods))for(const d of b.pods)a.a.addTemporalSlot(d.id,gS(d.type),d.position,d.slotProfile,d.cuepointSequence,d.maxDuration,d.minDuration,d.acceptContentType);b.keyValues&&typeof b.keyValues===_.Fe&&Object.keys(b.keyValues).forEach(d=>a.a.addKeyValue(d,b.keyValues[d]));a.a.setParameter(tv.freewheel.SDK.PARAMETER_EXTENSION_CONTENT_VIDEO_ENABLED,!1,tv.freewheel.SDK.PARAMETER_LEVEL_GLOBAL);
13
+ if(Array.isArray(b.parameters))for(const d of b.parameters)a.a.setParameter(d.name,d.value,d.level);jS(a);a.a.submitRequest();return a.l})}start(){const a=this;return _.x(function*(){yield mS(a)})}resume(){this.f&&this.f.resume()}pause(){this.f&&this.f.pause()}skip(){this.f&&this.f.skipCurrentAd()}getVolume(){return this.a?this.a.getAdVolume():1}setVolume(a){this.a&&this.a.setAdVolume(a)}getPosition(){return this.f?this.f.getPlayheadTime():-1}dispose(){const a=this;return _.x(function*(){a.h.release();
14
+ a.j&&(a.j.stop(),a.j=null);lS(a);a.a&&(a.a.dispose(),a.a=null)})}H(a){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 _.E(_.uc,{adsTimeline:new qS(this.a)})),this.j=new _.ou(this.m.getSurface(),(b,c)=>this.a.resize(b,c),this.m.gc(fS).f);else this.m.onError(new _.H(1,
15
+ 9,10003,{errorType:0},void 0));this.l.resolve()}J(a){oS(this,_.cc,a);this.j.start()}I(a){this.f=null;a=a.slot;oS(this,_.dc);this.j.stop();if(a)switch(a.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:mS(this);break;case tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL:lS(this);this.m.play();break;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:nS(this)}}G(a){const b=a.subType;this.g.debug("ad event",b);switch(b){case tv.freewheel.SDK.EVENT_AD_IMPRESSION:oS(this,_.qc,a);oS(this,
16
+ _.ic,a);break;case tv.freewheel.SDK.EVENT_AD_IMPRESSION_END:oS(this,_.rc,a);break;case tv.freewheel.SDK.EVENT_AD_FIRST_QUARTILE:oS(this,_.hc,a);break;case tv.freewheel.SDK.EVENT_AD_MIDPOINT:oS(this,_.lc,a);break;case tv.freewheel.SDK.EVENT_AD_THIRD_QUARTILE:oS(this,_.sc,a);break;case tv.freewheel.SDK.EVENT_AD_COMPLETE:oS(this,_.gc,a);break;case tv.freewheel.SDK.EVENT_AD_CLICK:oS(this,_.fc,a);break;case tv.freewheel.SDK.EVENT_AD_PAUSE:oS(this,_.mc,a);break;case tv.freewheel.SDK.EVENT_AD_RESUME:oS(this,
17
+ _.oc,a);break;case tv.freewheel.SDK.EVENT_AD_SKIPPED:oS(this,_.pc,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_START:oS(this,_.ec,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_END:oS(this,_.nc,a);break;case tv.freewheel.SDK.EVENT_ERROR:this.m.onError(new _.H(1,9,10003,{errorType:1},{fwCode:a[tv.freewheel.SDK.INFO_KEY_ERROR_CODE],fwInfo:a[tv.freewheel.SDK.INFO_KEY_ERROR_INFO],fwModule:a[tv.freewheel.SDK.INFO_KEY_ERROR_MODULE]}))}}F(){if(!this.f){var a=this.m.getPosition();if(this.f=this.o.find(b=>
18
+ .5>Math.abs(a-b.getTimePosition()))||null){const b=this.o.findIndex(c=>c===this.f);this.o.splice(b,1);this.m.pause();kS(this);this.f.play()}}}C(a){if((a=a.detail)&&this.a)switch(a.currentState){case _.Zn:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PLAYING);break;case _.Yn:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PAUSED);break;case _.On:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_COMPLETED);nS(this);break;case _.Wn:case _.Vn:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_STOPPED)}}};
19
+ rS.prototype.getPosition=rS.prototype.getPosition;rS.prototype.setVolume=rS.prototype.setVolume;rS.prototype.getVolume=rS.prototype.getVolume;rS.prototype.skip=rS.prototype.skip;rS.prototype.pause=rS.prototype.pause;rS.prototype.resume=rS.prototype.resume;rS.prototype.start=rS.prototype.start;var sS=class{constructor(){this.a=new _.R(eS)}name(){return eS}isSupported(a,b){return a.namespace()===_.kd?!1:window.tv&&tv.freewheel&&tv.freewheel.SDK?!(!b||!b.freewheel):(this.a.warn("FreeWheel SDK is not loaded."),!1)}create(a){return new rS(a)}};sS.prototype.create=sS.prototype.create;sS.prototype.isSupported=sS.prototype.isSupported;sS.prototype.name=sS.prototype.name;_.ro(new sS);};f.call(g, window);
package/cl.hls.js CHANGED
@@ -1,72 +1,72 @@
1
- import {clpp} from "./cl.core.js";import './cl.mse.js';let g={};const _ = clpp._;var f=function(window){'use strict';var oH="CLOSED-CAPTIONS",pH="Could not parse MP4 segment start time.",qH="DURATION",rH="EXT-X-STREAM-INF",sH="Failed to infer discontinuity number",tH="Guessing audio-only",uH="METHOD",vH="SAMPLE-AES-CTR",wH="SUBTITLES",xH="Two EXT-X-KEY tags, one with METHOD\x3dAES-128 are applied to one ",yH="application/vnd.apple.mpegurl",zH="sample",AH="whole-segment",BH=function(a,b){return _.I(a,b,void 0,{required:!0})},CH=function(a){if(1>a.a)throw _.tl();--a.a},DH=function(a){if(null!==a&&void 0!==
2
- a)return Number(a)},EH=function(a,b){return a.filter(c=>c.name===b)},FH=function(a){const b=/^[a-zA-Z0-9_-]+$/,c=new Set;a.forEach(d=>{const e=_.I(d,"VALUE"),f=_.I(d,"NAME"),g=_.I(d,"IMPORT"),h=_.I(d,"QUERYPARAM");if(1!==[f,g,h].filter(Boolean).length||f&&null==e)throw new _.H(_.F,4,4044,{message:"Invalid tag.",text:d.toString()});d=f||g||h;if(c.has(d))throw new _.H(_.F,4,4044,`EXT-X-DEFINE redefined variable "${d}".`);if(!b.test(d))throw new _.H(_.F,4,4044,`EXT-X-DEFINE invalid variable name "${d}".`);
3
- c.add(d)})},GH=function(a,b){const c=Array.isArray(b)?b:[b];return a.filter(d=>{d=BH(d,_.Kb);return c.includes(d)})},HH=function(a,b){return a.some(c=>c.name===b)},IH=function(a,b,c){c=void 0===c?{}:c;a=a.find(d=>d.name===b)||null;if(!a&&c.required)throw new _.H(_.F,4,4024,{missingTag:b});return a},JH=function(a){var b=IH(a,"EXT-X-TILES");if(!b)return{Rc:1,jd:1,durationPerTile:null};a=_.I(b,"LAYOUT")||"1x1";b=_.I(b,qH);a=_.XA(a);return{Rc:a.Rc,jd:a.jd,durationPerTile:b?Number(b):null}},KH=function(a,
4
- b,c){c=void 0===c?!0:c;a=new _.Lh(a);b=new _.Lh(b);b=a.resolve(b).toString();return c?b:decodeURI(b)},LH=function(a){const b=new Set;a.variants.forEach(c=>{c.audio&&b.add(c.audio);c.video&&b.add(c.video)});a.textStreams.forEach(c=>b.add(c));a.thumbStreams.forEach(c=>b.add(c));return Array.from(b)},MH=function(a,b){Array.isArray(a)||(a=[a]);a.forEach(c=>{for(const d of LH(c))b(d,c)})},NH=function(a){return a.some(b=>HH(b.$,_.Fa))},OH=function(a){return a.type===_.p||a.type===_.w},PH=function(a,b){const c=
5
- IH(a,_.Fa);if(b&&c)return _.Tb;a=IH(a,_.La);if(!a)return"LIVE";if(a.value===_.Tb)return _.Tb;if("EVENT"===a.value)return"EVENT";throw new _.H(_.F,4,4044,`Invalid EXT-X-PLAYLIST-TYPE value: ${a.value}`);},QH=function(a){a={AUDIO:_.p,VIDEO:_.w,SUBTITLES:_.G,"CLOSED-CAPTIONS":_.G}[a.toUpperCase()];if(!a)throw new _.H(_.F,4,4044,"EXT-X-MEDIA tag has an invalid TYPE attribute.");return a},RH=function(a,b,c){c=void 0===c?!1:c;var d=0;let e=null;if(a){d=a.split("@");a=Number(d[0]);if(0>=a)throw new _.H(_.F,
6
- 4,4044,"Byte range length must be positive.");if(d[1]){if(d=Number(d[1]),0>d)throw new _.H(_.F,4,4044,"Byte range start byte must not be negative.");}else{if(c)throw new _.H(_.F,4,4044,"Invalid byte range, offset is required but missing.");if(null==b)throw new _.H(_.F,4,4044,"Invalid byte range, cannot calculate offset based on previous byte ranges.");d=b+1}e=d+a-1}return{ua:d,ka:e}},SH=function(a,b){a=IH(a,_.Ba);return RH(a?a.value:null,b)},TH=function(a){a=IH(a,"EXTINF",{required:!0}).value.split(",");
7
- return{duration:Number(a[0]),title:a[1]||null}},UH=function(a,b){b=void 0===b?{}:b;const c={od:!1,gg:!1,hg:null,Kg:null,Bf:null};a=IH(a,_.Oa,{required:b.Ff});if(!a)return c;const d=e=>null==e?null:Number(e);c.od="YES"===_.I(a,"CAN-BLOCK-RELOAD");c.gg="YES"===_.I(a,"CAN-SKIP-DATERANGES");c.hg=d(_.I(a,"CAN-SKIP-UNTIL"));c.Kg=d(_.I(a,"HOLD-BACK"));c.Bf=d(_.I(a,"PART-HOLD-BACK",void 0,{required:b.Ff}));return c},VH=function(a,b,c){c=void 0===c?!1:c;a=_.I(a,"BYTERANGE");return RH(a,b,c)},XH=function(a,
8
- b){const c=SH(a.$,null);return new WH(0,0,0,()=>[a.a],c.ua,c.ka,0,b)},YH=function(a,b){if(null==a)return null;a=Object.assign({},a);null==a.iv&&(a.iv=_.Fi(new Uint8Array(12),new Uint8Array([b>>24&255,b>>16&255,b>>8&255,b&255])));return a},ZH=function(a){let b=Infinity,c=Infinity;LH(a).filter(OH).forEach(d=>{{d=d.V;var e=d[0].startTime;const f=d[d.length-1].endTime;d=e;e=f-e}b=Math.min(b,d);c=Math.min(c,e)});return{Cc:b,duration:c}},$H=function(a){return a.map(b=>{({duration:b}=ZH(b));return b}).reduce((b,
9
- c)=>b+c,0)},aI=function(a){return(a.video?a.video.ya:"")+" - "+(a.audio?a.audio.ya:"")},bI=function(a,b,c,d){if(b===_.Tb)return{delay:0,mc:0};b=IH(a,_.Ja);if(c&&b){c=Number(BH(b,"PART-TARGET"));if(null!=d)return{delay:d,mc:c};({Bf:d}=UH(a,{Ff:!0}));return{delay:d,mc:c}}a=IH(a,_.Qa,{required:!0});a=Number(a.value);return null!=d?{delay:d,mc:a}:{delay:3*a,mc:a}},cI=function(a){const b=[];MH(a,c=>{b.push(c.Rg)});return{delay:Math.max(...b.map(c=>c.delay)),mc:Math.min(...b.map(c=>c.mc))}},eI=function(a){const b=
10
- new Map;a.forEach(c=>{var d=dI(c).groupId;b.has(d)?(d=b.get(d),d.includes(c)||d.push(c)):b.set(d,[c])});return b},fI=function(a){const b=new Map;for(const c of a){a=_.I(c,_.cb);a=_.Zh(a||_.Xf);const d=BH(c,_.Va),e=BH(c,"INSTREAM-ID");b.has(d)||b.set(d,new Map);b.get(d).set(e,a)}return b},hI=function(a){a=a.audio.concat(a.video);for(const b of a)a=dI(b).codecs.split(",").filter(c=>"mp4a.40.34"!==c),gI(b,a)},iI=function(a,b){if(!a)return null;const c=a.ya;return b.find(d=>dI(d).ya===c)||null},jI=function(a){for(const b of a)if(b.startsWith("#EXT-")&&
11
- (a=_.Ki(0,b),_.Hs.has(a.name)))return 1;return 0},kI=function(a,b){return a.replace(/\{\$([a-zA-Z0-9_-]+)\}/g,(c,d)=>{c=b.get(d);if(null==c)throw new _.H(_.F,4,4044,`Undefined variable '${d}'`);return c})},lI=function(a,b){a.forEach(c=>{c.attributes.forEach(d=>{d.value=kI(d.value,b)})})},mI=function(a,b,c){lI(a,c);b.forEach(d=>{d.a&&(d.a=kI(d.a,c));lI(d.$,c);lI(d.f,c)})},nI=function(a,b){const c=new Map,d=new URL(b);a.forEach(e=>{var f=_.I(e,"NAME"),g=_.I(e,"QUERYPARAM");if(f)g=BH(e,"VALUE"),c.set(f,
12
- g);else if(g){f=d.searchParams.get(g);if(null==f)throw new _.H(_.F,4,4044,`Query param '${g}' missing in playlist URI.`);if(!f)throw new _.H(_.F,4,4044,`Query param '${g}' has no associated value`+" in playlist URI.");c.set(g,decodeURIComponent(f))}});return c},qI=function(a,b,c){const d=[];for(let e=1;e<b.length;e++){const f=oI(a,b[e]);d.push(f);if(f.name===rH){const g=b[e+1];if(!g)throw new _.H(_.F,4,4044,"EXT-X-STREAM-INF is not followed by a URI.");f.attributes.push(new _.Ii(_.Mb,g));e++}}b=EH(d,
13
- "EXT-X-DEFINE");FH(b);b=nI(b,c);a.a=b;mI(d,[],a.a);return new pI(c,0,d)},tI=function(a,b,c){let d=[];for(var e=1;e<b.length;){const f=oI(a,b[e]);if(_.Is.has(f.name))break;d.push(f);e++}b=rI(a,c,b.slice(e));e=b.V;d=d.concat(b.$);a=sI(a,d,c);mI(d,e,a);return new pI(c,1,d,b.V)},uI=function(a,b,c){b=b.trim().split(/\n+/m).map(d=>d.trim()).filter(d=>d.length&&!/^#(?!EXT)/m.test(d));if(!/^#EXTM3U($|[ \t\n])/m.test(b[0]))throw new _.H(_.F,4,4015);return 0===jI(b)?qI(a,b,c):tI(a,b,c)},oI=function(a,b){return _.Ki(a.f++,
14
- b)},rI=function(a,b,c){const d=[],e=[];let f=[],g=[];c.forEach(h=>{/^(#EXT)/.test(h)?(h=oI(a,h),_.Hs.has(h.name)||_.Ks.has(h.name)?d.push(h):_.Js.has(h.name)?"EXT-X-PART"===h.name?g.push(h):h.name===_.Ma&&"PART"===_.I(h,_.Kb)&&g.push(h):f.push(h)):/^#(?!EXT)/m.test(h)||(h=KH(b,h.trim(),!1),e.push(new vI(h,f,g)),f=[],g=[])});0<g.length&&e.push(new vI(null,f,g));return{V:e,$:d}},sI=function(a,b,c){b=EH(b,"EXT-X-DEFINE");FH(b);const d=nI(b,c);b.map(e=>_.I(e,"IMPORT")).filter(Boolean).forEach(e=>{const f=
15
- a.a.get(e);if(null==f)throw new _.H(_.F,4,4044,`Cannot import variable '${e}' as it is not defined `+"in the master playlist");d.set(e,f)});return d},wI=function(a){return 0>a?[]:Array.from({length:a},(b,c)=>c)},xI=function(a,b=0){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},yI=function(a){function b(h,k,l){let m="";for(;k<l;k++)m+="%"+("00"+h[k].toString(16)).slice(-2);return m}function c(h){return h[0]<<
16
- 21|h[1]<<14|h[2]<<7|h[3]}function d(){throw new _.H(_.F,4,4030);}xI(a)||d();let 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(let 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}}xI(a,e)||d();
17
- e+=10;e+=f}while(e<a.byteLength);return d()},zI=function(a,b){let c=null,d=0;try{(new _.Jl).M(_.ze,_.Cl).M(_.Vf,_.Cl).M(_.ue,_.Cl).ba("mdhd",g=>{g.reader.skip(0===g.version?8:16);d=_.P(g.reader);g.parser.stop()}).parse(b,!0)}catch(g){c=g}if(c||!d)throw _.hu.error("Unable to find timescale in init segment!"),new _.H(_.F,4,4030,pH,c);let e=0,f=!1;try{(new _.Jl).M("moof",_.Cl).M("traf",_.Cl).ba("tfdt",g=>{var h=d;if(0===g.version)h=_.P(g.reader)/h;else{{const k=_.P(g.reader),l=_.P(g.reader);if(!(2097151>=
18
- k||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=k/h*Math.pow(2,32)+l/h}}e=h;f=!0;g.parser.stop()}).parse(a,!0)}catch(g){c=g}if(c||!f)throw new _.H(_.F,4,4030,pH,c);return e},AI=function(a){for(;a.getPosition()<a.Da()-1;){const b=a.getPosition();if(71===_.ul(a))return CH(a),b}return-1},BI=function(a){function b(){d.seek(e+188);f=_.ul(d);71!==f&&(d.seek(e+192),f=_.ul(d));71!==f&&(d.seek(e+204),f=_.ul(d));71!==f&&c();
19
- CH(d)}function c(){throw new _.H(_.F,4,4030);}const d=new _.vm(new DataView(a),!1);let e=0,f=0;e=AI(d);0>e&&(_.hu.error("Unable to find sync byte in TS after scanning."),c());for(;;){e=d.getPosition();f=_.ul(d);71!==f&&c();a=_.vl(d);if(8191===(a&8191)){b();continue}if(!(a&16384)){b();continue}a=(_.ul(d)&48)>>4;0!==a&&2!==a||c();3===a&&(a=_.ul(d),d.skip(a));if(1!==_.P(d)>>8){b();continue}d.skip(3);a=_.ul(d)>>6;0!==a&&1!==a||c();0===_.ul(d)&&c();a=_.ul(d);const g=_.vl(d),h=_.vl(d);return(1073741824*
20
- ((a&14)>>1)+((g&65534)<<14|(h&65534)>>1))/9E4}},EI=function(a){const b=CI(a),c=DI(a);a.forEach(d=>{const e=d.V,f=e.findIndex(h=>h.ga===b);let g=e.findIndex(h=>h.ga===c+1);-1===g&&(g=e.length);d.V=e.slice(f,g)})},DI=function(a){a=a.map(b=>b.V[b.V.length-1].ga);return Math.min(...a)},CI=function(a){a=a.map(b=>b.V[0].ga);return Math.max(...a)},HI=function(a){var b=BH(a,uH);if(!FI.includes(b))return GI.error("PlayReady in HLS is only supported with [",FI.join(", "),"], not",b),null;a=BH(a,_.Mb);b=_.Qr(a);
21
- a=null;b=_.J(b.data);try{a=_.GA(_.Cm(b))}catch(c){a=b}return _.TA(_.xd,[{initDataType:_.$c,initData:a}],"")},JI=function(a){if(0===a.length)return II();if(a.some(c=>c.type===AH)||a.every(c=>c.type===_.Ce))return a[0];a=a.filter(c=>c.type===zH);const b=_.Bh(a.flatMap(c=>c.drmInfos));return{keyInfo:null,keyId:a[a.length-1].keyId,type:zH,drmInfos:b}},MI=function(a){a=KI(a);if(a.some(b=>LI(b))&&1<a.length)throw new _.H(_.F,4,4046,"Two EXT-X-KEY tags, one with METHOD\x3dAES-128 are applied to one playlist.");
22
- },LI=function(a){return EH(a.$,_.Ga).some(b=>"AES-128"===_.I(b,uH))},OI=function(a,b,c){return KI(a).map(d=>NI(d.$,b,c))},PI=function(a){return a.filter(b=>HH(b.$,_.Ga)).length},KI=function(a){return a.filter(b=>HH(b.$,_.Ga))},NI=function(a,b,c){a=EH(a,_.Ga);if(0===a.length)return null;var d=BH(a[0],uH);if(1===a.length){if("NONE"===d)return II();if("AES-128"===d)return a=a[0],d=_.I(a,"IV",""),{type:AH,keyInfo:{method:"AES-128",url:KH(b,BH(a,_.Mb)),iv:d?_.Ci((d||"0x").slice(2)):null},drmInfos:[],keyId:null}}b=
23
- a.map(e=>BH(e,uH));if(!b.every(e=>"SAMPLE-AES"===e)&&!b.every(e=>e===vH))throw QI.warn(`EXT-X-KEY methods ${b.join(", ")} are incompatible.`),new _.H(_.F,4,4044,"Multiple EXT-X-KEY tags with incompatible METHOD values.");b=a.map(e=>{const f=_.I(e,"KEYFORMAT","identity");{const g=RI[f]||null;e=g?g(e,c):null}e||QI.warn("Unsupported HLS KEYFORMAT",f);return e}).filter(Boolean);if(0===b.length)throw new _.H(_.F,4,4026);return{keyInfo:null,keyId:b.map(e=>e.keyIds).reduce((e,f)=>e.concat(f),[]).reverse()[0]||
24
- null,type:zH,drmInfos:b}},II=function(){return{type:_.Ce,keyInfo:null,drmInfos:[],keyId:null}},SI=function(a,b,c){return _.x(function*(){const d=b.f(),e=_.wB(b.Oa(),b.ua,b.ua+2048-1,a.a.attemptParameters);e.type=2;const f=_.wB(b.Oa(),b.ua,b.ka,a.a.attemptParameters);f.type=2;d&&(f.keyInfo=d);try{return yield a.f(c?f:e)}catch(g){if(7001===g.code||c)throw g;a.h.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.",
25
- e.uris[0]);try{return yield a.f(f)}catch(h){throw a.h.error("Failed to fetch media segment to parse its start timestamp.",f.uris[0],h),new _.H(_.F,4,4030,"Failed to fetch the media segment.");}}})},TI=function(a,b,c,d,e,f){return _.x(function*(){a.h.debug("Fetching segment to find start time");if("audio/mpeg"===d||d===_.Ic||d===_.Hc)return 0;if(d===_.Gc){var g=yield SI(a,c,f);const h=_.J(g.data);return xI(h)?yI(h):BI(g.data)}if(d===_.ig||d===_.Jc)return g=[SI(a,c,f)],b&&g.push(SI(a,b,!0)),g=yield Promise.all(g),
26
- zI(g[0].data,(g[1]||g[0]).data);if(d===_.hg)return g=yield SI(a,c,f),BI(g.data);if(!_.Pp(`${d.split("/")[0]||""}/mp4;codecs="${e}"`))return 0;throw new _.H(_.F,4,4030);})},UI=function(a,b){a=a.map(c=>c.streams[b]);return a.some(c=>null==c)?null:a},gI=function(a,b){a.streams.forEach(c=>{c.codecs=b.join(",")})},dI=function(a){return a.streams[0]},VI=function(a,b){a.streams.forEach(c=>{c.Md=b})},WI=function(a,b){a.streams.forEach(c=>{c.width=b})},XI=function(a,b){a.streams.forEach(c=>{c.height=b})},
27
- YI=function(a,b){a.streams.forEach(c=>{c.frameRate=b})},ZI=function(a,b){a.streams.forEach(c=>{c.bandwidth=b})},$I=function(a,b){a=a.map(c=>c.a[b]);return a.some(c=>null==c)?null:a},aJ=function(a,b){const c=new Set(a.map(d=>d.ga));return b.filter(d=>!c.has(d.ga))},dJ=function(a,b){for(;a[0].ga<b[0].ga;)a.splice(0,1);var c=a[0];let d=b[0];bJ(c,d)||cJ(c,d);const e=a.length-1;c=a[e];d=b[e];0<e&&!bJ(c,d)&&cJ(c,d);for(c=e+1;c<b.length;)a.push(b[c]),c++},eJ=function(a,b){const c=a[a.length-1];var d=b.findIndex(f=>
28
- f.ga===c.ga);const e=b[d];bJ(c,e)||cJ(c,e);for(d+=1;d<b.length;d++)a.push(b[d])},jJ=function(a,b,c,d,e){var f=b[0].length();f=wI(f).map(g=>{var h=$I(b,g)||[];const k=UI(c,g)||[];g=UI(d,g)||[];{const l=[...fJ(h),...k,...g].filter(Boolean);gJ(l);const {ga:m,duration:n}=l[0];h={configurationId:a,variants:h,textStreams:k,thumbStreams:g,startTime:0,id:`P${m}`,endTime:n,duration:n,ga:m}}return h});e&&hJ(f[0]);iJ(f);return f},fJ=function(a){a=new Set(a.flatMap(b=>[b.video,b.audio]).filter(Boolean));return Array.from(a)},
29
- hJ=function(a){const b=fJ(a.variants)[0].V[0].xa;a.startTime+=b;a.endTime+=b},iJ=function(a){for(let b=0;b<a.length;b++){const c=a[b],d=a[b-1];c.startTime=d?d.endTime:c.startTime;c.endTime=c.startTime+c.duration}},bJ=function(a,b){return a.startTime===b.startTime&&a.endTime===b.endTime},cJ=function(a,b){a.startTime=b.startTime;a.endTime=b.endTime;a.duration=b.duration;kJ(a.variants,b.variants);lJ(LH(a),LH(b))},kJ=function(a,b){const c=new Map(a.map(d=>[aI(d),d]));b.forEach(d=>{c.get(aI(d)).drmInfos=
30
- d.drmInfos})},lJ=function(a,b){const c=new Map(a.map(d=>[d.ya,d]));b.forEach(d=>{const e=c.get(d.ya);e.V=d.V;e.segmentIndex.replace(d.V);e.Cc=d.Cc;e.ge=d.ge;e.duration=d.duration;e.bf=d.bf;e.encrypted=d.encrypted;e.drmInfos=d.drmInfos;e.keyId=d.keyId})},gJ=function(a){const b=mJ(a);a.forEach(c=>{_.sB(c.segmentIndex,b);c.duration=b;c.ge=c.Cc+b})},mJ=function(a){let b=Infinity;a.filter(OH).forEach(c=>{b=Math.min(b,c.duration)});return b},nJ=function(a,b){MH(b,(c,d)=>{_.FB(a,c.V,d.startTime)});_.xB(a.a,
31
- b[0].startTime,b[b.length-1].endTime)},oJ=function(a){return null===a.j?[]:[a.j.audio,a.j.video].filter(b=>b).map(b=>b.ya)},pJ=function(a,b){return _.x(function*(){var c=_.Pi([b],a.a.attemptParameters);c.type=1;c=yield a.F(c);let d="";try{d=_.li(c.data)}catch(e){throw new _.H(_.F,4,4042);}d=d.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n");d=d.trim();return{text:d,response:c}})},uJ=function(a,b){return _.x(function*(){var c=qJ(a,b,a.w,"");if(1===c.type){c=_.Ds(c.V[0].a)||"";c=null!=_.Cs.video[c]?_.w:null!=_.Cs.audio[c]?
32
- _.p:null;var d="";c===_.w?d="avc1.42E01E":c===_.p&&(d="mp4a.40.2");{c=a.K;var e=a.w;d=a.a.hlsDefaultCodecs||d;var f=[];const q=[];q.push(new _.Ii(_.ma,"0"));q.push(new _.Ii(_.Mb,e));d.length&&q.push(new _.Ii(_.pa,d));f.push(new _.Ji(c.f++,rH,q));c=new pI(e,0,f)}}d=c.$;c=EH(d,"EXT-X-MEDIA");e=EH(d,rH);d=EH(d,"EXT-X-IMAGE-STREAM-INF");c={Bc:{bg:GH(c,["AUDIO",_.Sb]),closedCaptions:GH(c,oH),sh:GH(c,wH)},kd:e,be:d};const {periods:g,Ef:h,Kf:k}=yield rJ(a,c);if(!a.D)throw new _.H(_.F,7,7001);e=cI(g[0]);
33
- sJ(a,g);c=!0;d=null;f=0;tJ(a)||(c=!1,d=0,f=e.delay);d=new _.aH(a.a.timeline||{},d,f,!0,void 0,!!a.a.lowLatencyMode);_.BB(d,c);nJ(d,g);h&&_.AB(d,h);c=d;if(!tJ(a)){a.C=e.mc;e=0;for(var l of a.f.values())e=Math.max(e,l.streams[0].Cc);for(l=0;95443.7176888889<=e;)l+=95443.7176888889,e-=95443.7176888889;if(l){a.h.debug("Offsetting live streams by",l,"to compensate for rollover");for(var m of a.f.values())e=m.streams[0],95443.7176888889>e.Cc?(a.h.debug("Offset applied to",e.type),e.segmentIndex.offset(l)):
34
- a.h.debug("Offset NOT applied to",e.type)}}m=$H(g);"LIVE"===a.l||"EVENT"===a.l?(m=Math.max(m,c.H),isNaN(a.a.availabilityWindowOverride)||(m=a.a.availabilityWindowOverride),c.A=m):a.l===_.Tb&&(c.f=m);if(k)for(var n of k)a.D.onTimelineCueAdded({configurationId:a.D.configurationId,schemeIdUri:n.schemeIdUri,Ta:n.Ta,value:"",startTime:n.startTime,endTime:n.endTime,id:n.id,type:_.oh,eventElement:null});n={presentationTimeline:c,adaptedPeriods:[...g],periods:g,minBufferTime:0};a.h.debug("HLS playlist parsed",
35
- n);return n})},wJ=function(a,b){return Promise.all(b.map(c=>vJ(a,c)))},yJ=function(a,b){b.forEach(c=>{a:{var d=a.f.get(c.a),e=!tJ(a),f=IH(c.$,_.Ea);if(f)var g=Number(f.value);else{d?(f=d.streams[d.streams.length-1].V,f=f[f.length-1].ga):f=0;if(e&&0<f)try{{const k=IH(c.$,_.Ia);if(!k)throw xJ.error("Failed to infer discontinuity number, because EXT-X-MEDIA-SEQUENCE tag is missing."),Error(sH);const l=Number(k.value),m=d.find(l);if(!m)throw xJ.error("Failed to infer discontinuity number, could not find the appropriate segment in the previous playlist"+
36
- ` (segment position = ${l})`),Error(sH);var h=m.ga}g=h;break a}catch(k){throw new _.H(_.F,4,4024,"EXT-X-DISCONTINUITY-SEQUENCE tag is required for discontinuous HLS live streams.");}g=0}}c=c.V||[];for(const k of c)HH(k.$,_.Da)&&g++,k.ga=g});EI(b)},BJ=function(a,b){return _.x(function*(){const {textStreams:c,thumbStreams:d,cg:e}=yield zJ(a,b);var f=a.o.periods[0].variants;a.a.lowLatencyMode&&null!==a.j&&(f=f.filter(g=>g.id===a.j.id));f=f.map(g=>{const h=iI(g.audio,e),k=iI(g.video,e);g=AJ(a,h,k,g.bandwidth);
37
- if(!g)throw new _.H(_.F,4,4047,{message:"Video and audio are encrypted in an incompatible way.",Wh:k?dI(k).ya:void 0,audio:h?dI(h).ya:void 0});return g});return jJ(a.D.configurationId,f,c,d,!0)})},sJ=function(a,b){tJ(a)||2!==a.a.timeline.version||(a.G||(a.G=b[0].startTime),_.dD(b,-a.G))},CJ=function(a,b,c){a.l=_.Tb;_.BB(b,!0);b.f=c[c.length-1].endTime},qJ=function(a,b,c,d){a=uI(a.K,b,c);a.a=d;DJ(a);return a},rJ=function(a,b){return _.x(function*(){var c=fI(b.Bc.closedCaptions),d=EJ(a,b.kd),e=yield FJ(a,
38
- b);const f=Object.values(e).flat().map(h=>h.playlist);yJ(a,f);var g=yield GJ(a,e.Te,d);c=yield HJ(a,e.kd,g,c);d=yield IJ(a,e.rh,d);g=yield JJ(a,e.be);e=KJ(a,e);c=jJ(a.D.configurationId,c,d,g,!tJ(a));a.D.filterAllPeriods(c);return tJ(a)?(d=null,null!=e&&(d=LJ(f,e)),{periods:c,Ef:e,Kf:d}):{periods:c,Ef:e,Kf:null}})},zJ=function(a,b){return _.x(function*(){const c=g=>dI(g.stream).type===_.w||dI(g.stream).type===_.p;var d=b.filter(c),e=b.filter(g=>!c(g)),f=g=>{g=g.map(h=>{var k=dI(h.stream);k={language:k.language,
39
- channelsCount:k.channelsCount,spatialAudio:k.spatialAudio,closedCaptions:k.closedCaptions,primary:k.primary,kind:k.kind||null,groupId:k.groupId,type:k.type,codecs:k.codecs,name:k.originalId,uri:k.ya,Kd:{width:k.width,height:k.height,frameRate:k.frameRate}};h=Object.assign({},{playlist:h.playlist},k);return MJ(a,h)});return Promise.all(g)};d=yield f(d);f=yield f(e);NJ(a,d.concat(f));e=f.filter(g=>dI(g).type===_.BA);f=f.filter(g=>dI(g).type===_.be);return{textStreams:e,thumbStreams:f,cg:d}})},AJ=function(a,
40
- b,c,d){const e=[],f=(c||b).length();for(let m=0;m<f;m++){var g=b?b.streams[m]||null:null,h=c?c.streams[m]||null:null,k=g,l=h;k=k&&l?_.aB(k.drmInfos,l.drmInfos)?_.$A(k.drmInfos,l.drmInfos):null:k?k.drmInfos:l?l.drmInfos:null;if(!k)return null;l=d;g={id:a.N++,language:g?g.language:_.Xf,primary:!!g&&g.primary||!!h&&h.primary,audio:g,video:h,bandwidth:l,drmInfos:k,allowedByApplication:!0,allowedByKeySystem:!0};e.push(g)}return new OJ(e)},MJ=function(a,b){return _.x(function*(){const c=b.playlist,d=b.codecs,
41
- e=b.type,f=b.Xc,g=b.groupId,h=b.primary;var k=b.kind;const l=b.name,m=b.channelsCount,n=b.spatialAudio,q=b.closedCaptions,u=b.Kd,v=_.Zh(f||_.Xf);if(1!==c.type)throw new _.H(_.F,4,4017);var y=PH(c.$,null==a.o);a.l=y;const B=bI(c.$,y,a.a.lowLatencyMode||!1,a.a.suggestedPresentationDelay);y=yield PJ(a,c,e,d);const D=a.a.lowLatencyMode?_.qA:_.pA;let M=k;e!==_.G||k||(M=_.BA);const {od:da}=UH(c.$);k=y.map(ub=>{const Ub=ub.V,pd=ub.ng,fg=ub.mimeType;ub=ub.ga;const Wa=Ub[0].startTime,ke=Ub[Ub.length-1].endTime,
42
- Oc=ke-Wa,ea=new _.bH(Ub),$a=Ub[0].initSegment||null;return{id:_.fH++,originalId:l,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:ea.find.bind(ea),getSegmentReference:ea.get.bind(ea),adjustSegmentDurations:ea.f.bind(ea),getDuration:ea.getDuration.bind(ea),segmentIndex:ea,segmentLookupStrategy:D,initSegmentReference:$a,mimeType:fg,codecs:d,kind:M,bf:pd.type,encrypted:pd.type===zH,keyId:pd.keyId,language:v,originalLanguage:f||_.Xf,label:l,type:e,primary:h,trickModeVideo:null,emsgSchemeIdUris:null,
43
- frameRate:u?u.frameRate:void 0,width:u?u.width:void 0,height:u?u.height:void 0,bandwidth:void 0,roles:[],channelsCount:m,spatialAudio:n,closedCaptions:q,keyInfo:pd.keyInfo,V:Ub,drmInfos:pd.drmInfos,ga:ub,ya:c.a,Md:c.f,Cc:Wa,ge:ke,duration:Oc,od:da,groupId:g,Rg:B}});return new QJ(k)})},NJ=function(a,b){b.forEach(c=>{a.f.a.set(dI(c).ya,c)})},EJ=function(a,b){const c=new Map;for(const f of b){var d=_.I(f,"AUDIO");b=_.I(f,_.Sb);var e=_.I(f,wH);const g=RJ(a,f);if(e){const h=_.wj(_.G,g);c.set(e,h);e=g.indexOf(h);
44
- -1<e&&g.splice(e,1)}d&&(e=SJ(_.p,g),c.set(d,e));b&&(d=SJ(_.w,g),c.set(b,d))}return c},FJ=function(a,b){return _.x(function*(){const c=yield Promise.all([TJ(a,b.Bc.bg),TJ(a,b.Bc.sh),TJ(a,b.kd),TJ(a,b.be)]),[d,e,f,g]=c;return{Te:d,rh:e,kd:f,be:g}})},GJ=function(a,b,c){return _.x(function*(){if(0===b.length)return new Map;var d=[UJ(a,b[0],c)];yield d[0];d=d.concat(b.slice(1).map(e=>UJ(a,e,c)));d=yield Promise.all(d);return eI(d)})},HJ=function(a,b,c,d){return _.x(function*(){const e=new Set;var f=[...b];
45
- let g=0;var h=Infinity;for(let k=0;k<f.length;++k){const l=Number(BH(f[k].tag,_.ma));l<h&&(h=l,g=k)}h=f.splice(g,1).pop();h=yield VJ(a,h,c,d,e);f=f.map(k=>VJ(a,k,c,d,e));f=yield Promise.all(f);f.splice(g,0,h);return f.reduce(_.QA,[])})},IJ=function(a,b,c){return Promise.all(b.map(d=>UJ(a,d,c)))},JJ=function(a,b){return Promise.all(b.map(c=>WJ(a,c)))},KJ=function(a,b){b=[...b.kd,...b.Te].map(d=>d.playlist).flatMap(d=>d.V[0].$);b=IH(b,_.Na);if(!b)return null;const c=(new Date(b.value)).getTime();return isNaN(c)?
46
- (a.h.warn("Failed to parse EXT-X-PROGRAM-DATE-TIME tag "+`value (value: ${b.value}).`),null):c/1E3},tJ=function(a){return a.l===_.Tb},LJ=function(a,b){return(a=a.find(c=>null!==IH(c.$,_.Ca)))?a.$.filter(c=>c.name===_.Ca).map(c=>{a:{var d=_.I(c,"ID"),e=_.I(c,"START-DATE");if(null===d||null===e)_.Gs.warn("Invalid EXT-X-DATERANGE missing mandatory ID or START-DATE attribute, ignoring the EXT-X-DATERANGE tag.",c),c=null;else{var f=new Date(e);e=f.getTime()/1E3-b;d={id:d,startTime:e,startDate:f};var g=
47
- DH(_.I(c,qH));void 0!==g&&0<=g&&(d.duration=g);var h=DH(_.I(c,"PLANNED-DURATION"));void 0!==h&&0<=h&&(d.plannedDuration=h);var k=_.I(c,"CLASS");null!==k&&(d.schemeIdUri=k);var l=_.I(c,"END-DATE");l=l?new Date(l):null;null!==l&&l.getTime()>=f.getTime()&&(d.endDate=l);{const q=c.attributes;if(null==q)var m=null;else{f={};for(m of q)m.name.startsWith("X-")&&(f[m.name]=m.value);m=_.Pg(f)?f:null}}m=m||{};if(k===_.wd){f=c.attributes;if(null==f)var n=null;else{k={};for(n of f)switch(n.name){case _.$b:k[_.$b]=
48
- n.value;break;case _.Zb:k[_.Zb]=n.value;break;case _.bc:k[_.bc]=DH(n.value);break;case _.ac:k[_.ac]=DH(n.value);break;case "X-SNAP":k["X-SNAP"]=n.value.split(",");break;case "X-RESTRICT":k["X-SNAP"]=n.value.split(",")}k[_.$b]&&k[_.Zb]||!k[_.$b]&&!k[_.Zb]?(_.Gs.warn("Invalid EXT-X-DATERANGE Interstitial attributes X-ASSET-URI, X-ASSET-LIST"),n=null):n=_.Pg(k)?k:null}if(null===n){_.Gs.warn("Invalid interstitial attributes, ignoring the EXT-X-DATERANGE tag.",c);c=null;break a}m=Object.assign(m,n)}_.Pg(m)&&
49
- (d.Ta=m);d.endTime=l?l.getTime()/1E3:g?e+g:h?e+h:e;d.type="hls-daterange";c=d}}return c}).filter(Boolean):null},TJ=function(a,b){return _.x(function*(){return(yield Promise.all(b.map(c=>_.x(function*(){const d=yield XJ(a,c);return d?{tag:c,playlist:d}:null})))).filter(Boolean)})},vJ=function(a,b){return _.x(function*(){var c=new _.Lh(dI(b).Md);if(a.a.lowLatencyMode&&dI(b).od){var d=b.streams[b.streams.length-1].segmentIndex;if(d=d.a[d.a.length-1]){var e=d.a,f=e.length-1;d={Ug:d.position,$g:e&&0<e.length?
50
- f:null}}else d=null;if(e=d)d=e.Ug,e=e.$g,f=_.ij(c.a.toString()),f._HLS_msn=d.toString(),null===e&&f._HLS_part&&delete f._HLS_part,null!==e&&(f._HLS_part=e.toString()),d=_.hj(f,!0),d=new _.Sh(d),_.Oh(c,d)}const {response:g,text:h}=yield pJ(a,c.toString());c=dI(b).ya;d=dI(b).Md;e=g.uri;d!==e&&(d=e,VI(b,d));c=qJ(a,h,d,c);return{stream:b,playlist:c}})},RJ=function(a,b){var c=_.I(b,_.pa,a.a.hlsDefaultCodecs||"avc1.42E01E,mp4a.40.2").split(/\s*,\s*/);b=new Set;const d=[];for(const e of c)c=_.fB(e),b.has(c)?
51
- a.h.debug("Ignoring duplicate codec"):(d.push(e),b.add(c));return d},SJ=function(a,b){if(1===b.length)return b[0];a=_.wj(a,b);if(null!=a)return a;throw new _.H(_.F,4,4025,{codecList:b});},UJ=function(a,b,c){return _.x(function*(){const d=b.tag,e=b.playlist;return YJ(a,e.a,()=>_.x(function*(){const f=BH(d,_.Va),g=QH(BH(d,_.Kb));var h=BH(d,_.Kb).toUpperCase();if(QH(h)!==_.G)h=null;else{var k=d.getAttribute("FORCED");k=!(!k||!k.value||"YES"!==k.value.toUpperCase());var l=_.BA;h===oH&&(l=_.lA);k&&(l=
52
- _.Wd);h=l}k=c.get(f)||"";l=_.I(d,_.cb);const m=_.I(d,"NAME"),n=d.getAttribute("DEFAULT"),q=d.getAttribute("AUTOSELECT");var u=_.I(d,"CHANNELS");u=g===_.p?u?parseInt(u.split("/")[0],10):null:null;var v=g===_.p?(v=_.I(d,"CHANNELS"))?v.includes("/JOC"):!1:!1;return yield MJ(a,{playlist:e,codecs:k,type:g,Xc:l,primary:!!n&&!!q,name:m,channelsCount:u,spatialAudio:v,groupId:f,kind:h,closedCaptions:null,Kd:null})}))})},WJ=function(a,b){return _.x(function*(){const c=b.tag,d=b.playlist;return YJ(a,d.a,()=>
53
- _.x(function*(){var e=_.I(c,_.pa)||"jpg",f=_.I(c,_.cb);const g=_.I(c,"NAME");e=yield MJ(a,{playlist:d,codecs:e,type:_.be,Xc:f,name:g,primary:!1,kind:null,channelsCount:null,spatialAudio:!1,closedCaptions:null,groupId:null,Kd:null});(f=_.I(c,_.ma))&&ZI(e,Number(f));return e}))})},VJ=function(a,b,c,d,e){return _.x(function*(){var f=b.tag,g=Number(BH(f,_.ma));if(null!=f.getAttribute("FRAME-RATE")||null!=f.getAttribute(_.Bb)){var h=_.I(f,"FRAME-RATE");f=_.I(f,_.Bb);var [k,l]=f?f.split("x"):[null,null];
54
- h={frameRate:DH(h),width:DH(k),height:DH(l)}}else h=null;if(f=yield ZJ(a,b,h,c,d)){h=f.video;f=f.audio;var m=0<f.length?f:[null];h=0<h.length?h:[null];f=[];for(const n of m)for(const q of h){m=(q?dI(q).ya:"")+" - "+(n?dI(n).ya:"");if(e.has(m)){a.h.debug("Skipping variant which only differs in text streams.");continue}const u=AJ(a,n,q,g);null==u?a.h.warn("Incompatible DRM info in HLS variant. Skipping."):(f.push(u),e.add(m))}g=f}else g=[];return g})},ZJ=function(a,b,c,d,e){return _.x(function*(){var f=
55
- b.tag,g=b.playlist;let h=RJ(a,f);var k=_.I(f,"AUDIO"),l=_.I(f,_.Sb),m=k||l;m=m&&d.has(m)?d.get(m):[];k={audio:k?m:[],video:l?m:[]};a.h.debug("Guessing stream type for",f.toString());f=!1;const n=g.a;g=k.audio.find(q=>q.ya===n);l=_.wj(_.w,h);l=c||l;1!==h.length||l?!m.length&&1<h.length?(a.h.debug("Guessing multiplexed audio+video"),g=_.w,h=[h.join(",")]):k.audio.length&&g?(a.h.debug(tH),g=_.p,f=!0):k.video.length?(a.h.debug(tH),g=_.p):(a.h.debug("Guessing video-only"),g=_.w):(g=_.p,a.h.debug(tH));
56
- l=null;f||(l=yield $J(a,b,h,g,e,c));if(null==l)return null;k[g]=[l];g===_.p&&c&&m.forEach(q=>{WI(q,c.width);XI(q,c.height);YI(q,c.frameRate)});hI(k);return k})},$J=function(a,b,c,d,e,f){return _.x(function*(){const g=b.tag,h=b.playlist;return YJ(a,h.a,()=>_.x(function*(){var k=_.I(g,oH);let l=null;d===_.w&&k&&"NONE"!==k&&(l=e.get(k));k=SJ(d,c);return yield MJ(a,{playlist:h,codecs:k,type:d,closedCaptions:l,primary:!1,kind:null,Xc:null,name:null,channelsCount:null,spatialAudio:!1,groupId:null,Kd:f})}))})},
57
- YJ=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},PJ=function(a,b,c,d){return _.x(function*(){var e=b.a,f=b.V;var g=void 0===g?0:g;var h=(h=IH(b.$,_.Ia))?Number(h.value):g;g=[];!tJ(a)&&MI(f);e=yield aK(a,b.f,e,f,h,c,d);if(0===f.length)f=[];else{var k=[],l=[];for(var m of f)HH(m.$,_.Da)&&0<l.length&&(k.push(l),l=[]),l.push(m);k.push(l);f=k}for(m=0;m<f.length;m++)k=f[m],l=yield bK(a,b.f,k,h,e,c,d,g[g.length-
58
- 1]||null,f.length),g.push(l),h+=k.length;cK(g);return g})},XJ=function(a,b){return _.x(function*(){var c="EXT-X-MEDIA"!==b.name?!0:_.I(b,_.Kb)===wH;c=_.I(b,_.Mb,void 0,{required:c});if(!c)return null;const d=KH(a.w,c),{response:e,text:f}=yield pJ(a,d);return qJ(a,f,e.uri,c)})},DJ=function(a){1===a.type&&a.V.forEach((b,c)=>{if(HH(b.$,_.Ha)&&!HH(b.$,_.Da)&&0<c)throw new _.H(_.F,4,4046,"Media playlist contains an EXT-X-MAP tag not accompanied by an EXT-X-DISCONTINUITY tag.");})},cK=function(a){if(1<
59
- (new Set(a.map(b=>b.mimeType))).size)throw new _.H(_.F,4,4045,"Media playlist contains discontinuities with different MIME types. This is valid, but not yet supported.");},dK=function(a){a=a.map(b=>b.a?b.a:b.f.map(c=>_.I(c,_.Mb))||null).map(b=>_.Ds(b));if(1<(new Set(a)).size)throw new _.H(_.F,4,4044,"Unexpected change in file format.");},eK=function(a,b,c){a=EH(a.$,_.Ha);if(1<a.length)throw new _.H(_.F,4,4020);a=a[0];if(!a)return null;const d=BH(a,_.Mb),e=KH(b,d);b=VH(a,null,!0);return new _.YG(()=>
60
- [e],b.ua,b.ka,c)},fK=function(a,b,c,d,e,f,g){const h=[];for(const q of _.YA(b.f)){b=q.pf;const u=q.item;{var k=0===b,l=k?a:h[h.length-1],m=k?d:l.endTime,n=Number(_.I(u,qH));n=m+n;k=VH(u,k?null:l.ka,k);l=_.I(u,_.Mb);const v=(l=KH(g,l))?[l]:[];m=new WH(c,m,n,()=>v,k.ua,k.ka,e,f,!1,null,null,null,null);if("YES"===_.I(u,"INDEPENDENT")||0===b)m.g=!0;h.push(m)}}return h},gK=function(a,b,c,d,e,f,g,h,k,l,m){const n=c.$;var q=c.a;const u=null!=q,v=q?[q]:[];if(!u&&!a.a.lowLatencyMode)return null;a=0;q={ua:0,
61
- ka:null};let y=null;u?({duration:c}=TH(n),a=e+c,q=SH(n,b?b.ka:null)):(b=fK(b,c,d,e,f,g,k),a=b[b.length-1].endTime,y=b);h=h===_.be?JH(n):null;d=new WH(d,e,a,()=>v,q.ua,q.ka,f,g,!1,null,h?h.Rc:null,h?h.jd:null,h?h.durationPerTile:null,y);d.ga=l;d.initSegment=m||void 0;return d},aK=function(a,b,c,d,e,f,g){return _.x(function*(){var h=d[0];if(null!=a.B)return a.B;if(!tJ(a)&&a.o)try{var k=a.f.get(c);var l=k?k.find(e)||null:null;if(!l)throw new _.H(_.F,4,4030,"Segment not found in pervious playlist update.");
62
- var m=l.startTime+l.xa;a.h.debug(`Setting playlist start time to ${m}.`);return a.B=m}catch(n){if(h=a.f.get(c))m=h.streams[h.streams.length-1].V,m=m[m.length-1],a.h.warn(`Last #EXT-X-MEDIA-SEQUENCE values ${h.streams[0].V[0].position} - ${m.position}`+`, new values ${e} - ${e+d.length-1}.`,b,h);throw new _.H(_.F,4,4047,{message:"The updated playlist does not share any segments with the previous one.",uri:c});}m=yield hK(a,f,g,h);k=NI(h.$,a.w,m)||II();l=eK(h,b,k.keyInfo);k=YH(k.keyInfo,e);h=yield iK(a,
63
- l,h,k,m,g);a.h.debug(`Setting playlist start time to ${h}.`);return a.B=h})},bK=function(a,b,c,d,e,f,g,h,k){return _.x(function*(){var l=c[0],m=null==h;dK(c);const n=yield hK(a,f,g,l);var q=a.w,u=h?h.Qg:null;var v=1===k;if(c.slice(1).some(LI))throw new _.H(_.F,4,4046,v?"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.");
64
- if(HH(c[0].$,_.Ga)||null===u)if((u=NI(c[0].$,q,n))&&u.type===AH){if(1<PI(c))throw new _.H(_.F,4,4046,xH+`${v?"playlist":"discontinuity"}.`);v=[u]}else v=OI(c,q,n),v=0===v.length?[II()]:v;else if(q=OI(c,q,n),u.type===_.Ce||u.type===zH)v=[u,...q];else{if(0<PI(c))throw new _.H(_.F,4,4046,xH+`${v?"playlist":"discontinuity"}.`);v=[u]}q=v;v=q[q.length-1];q=JI(q);u=eK(l,b,q.keyInfo)||(h?h.Lg:null);var y=YH(q.keyInfo,d);const B=l.ga;l=m?e:yield jK(a,B,u,l,d,y,n,g);m=[];for(y=0;y<c.length;y++){var D=c[y];
65
- const M=m[m.length-1]||null,da=0===y?0:M.endTime,ub=d+y,Ub=YH(q.keyInfo,ub);(D=gK(a,M,D,ub,da,l,Ub,f,b,B,u))&&m.push(D)}return{V:m,ng:q,Qg:v,mimeType:n,endTime:m[m.length-1].endTime,ga:B,Lg:u}})},hK=function(a,b,c,d){return _.x(function*(){const e=d.a;var f=IH(d.$,_.Ha);f=f?BH(f,_.Mb):null;return kK(a,b,c,e,f)})},iK=function(a,b,c,d,e,f){return _.x(function*(){if(null==c.a)return 0;const g=XH(c,d);return TI(a.L,b,g,e,f,null!=d)})},jK=function(a,b,c,d,e,f,g,h){return _.x(function*(){if(a.H.has(b))return a.H.get(b);
66
- const k=yield iK(a,c,d,f,g,h);a.h.debug(`Segment #${e} has raw media timestamp `+`${k} s.`);a.H.set(b,k);return k})},kK=function(a,b,c,d,e){return _.x(function*(){const f=[d,e].filter(Boolean);var g=_.zj(f,b,c);if(g)return g;g=_.Pi([d],a.a.attemptParameters);g.method="HEAD";g.type=2;g=(yield a.F(g)).headers["content-type"];if(!g)throw new _.H(_.F,4,4021,"Unknown MIME type of: "+f.join(", "));return g.split(";")[0]})},pI=class{constructor(a,b,c,d){if(1===b){if(!d||0===d.length)throw new _.H(_.F,4,
67
- 4043,"Media playlist must have at least one segment!");if(null==d[0].a)throw new _.H(_.F,4,4043,"Media playlist must have at least one full segment!");}this.f=a;this.a="";this.type=b;this.$=c;this.V=1===b?d:null}},vI=class{constructor(a,b,c){c=void 0===c?[]:c;this.$=b;this.a=a;this.f=c;this.ga=-1}},WH=class extends _.SB{constructor(a,b,c,d,e,f,g,h,k,l,m,n,q,u){u=void 0===u?[]:u;super(a,b,c,d,e,f,g,void 0===h?null:h,void 0===k?!1:k,void 0===l?null:l,void 0===m?null:m,void 0===n?null:n,void 0===q?null:
68
- q,u);this.initSegment=void 0;this.ga=0}},lK=class{constructor(){this.f=0;this.a=new Map}},mK=class{constructor(){this.a=new Map;this.f=new Map}set(a,b){this.f.set(a,b);return b.then(c=>this.a.set(a,c)).catch(()=>{}).then(()=>this.f.delete(a))}has(a){return this.a.has(a)}get(a){return this.a.get(a)||null}values(){return Array.from(this.a.values())}clear(){this.f.clear();this.a.clear()}},xJ=new _.R("clpp.hls.DiscontinuityUtils");var RI={"com.apple.streamingkeydelivery":function(a,b){if(b===_.hg)throw new _.H(_.F,4,4041);if(BH(a,uH)===vH)throw new _.H(_.F,4,4044,"EXT-X-KEY:METHOD SAMPLE-AES-CTR is not supported in FairPlay.");return _.TA(_.vd,[{initDataType:_.Gf,initData:new Uint8Array(0)}],"")},"com.microsoft.playready":HI,"urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":HI,"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":function(a){var b=BH(a,uH);if(!FI.includes(b))return GI.error("Widevine in HLS is only supported with [",
69
- FI.join(", "),"], not",b),null;b=BH(a,_.Mb);b=_.Qr(b);b=_.J(b.data);b=_.TA(_.zd,[{initDataType:_.$c,initData:b}],"");if(a=_.I(a,"KEYID"))b.keyIds=[a.substr(2).toLowerCase()];return b}},FI=["SAMPLE-AES",vH],GI=new _.R("clpp.hls.DrmParser");var QI=new _.R("clpp.hls.EncryptionUtils");var nK=class{constructor(a){this.h=new _.R("clpp.hls.MediaReader");this.f=a;this.a={attemptParameters:_.Mi()}}};var QJ=class{constructor(a){this.streams=a}length(){return this.streams.length}find(a){const b=this.streams.find(c=>{c=c.V;return c[0].position<=a&&a<=c[c.length-1].position});return null==b?null:b.V.find(c=>c.position===a)||null}};var OJ=class{constructor(a){this.a=a}length(){return this.a.length}};var oK=class{constructor(){this.a=this.D=null;this.N=1;this.f=new mK;this.w="";this.K=new lK;this.C=0;this.j=null;this.g=new _.Qj(()=>{this.Eb()});this.l=_.Tb;this.o=null;this.A=new _.Ls;this.B=null;this.h=new _.R("clpp.hls.HlsParser");this.H=new Map;this.L=new nK(this.F.bind(this));this.J=!1;this.G=null;this.I=!1}configure(a){this.a=a;this.L.a=a}setCurrentVariant(a){this.j=a}start(a,b){const c=this;return _.x(function*(){if(c.J)throw Error("start() may be called only once!");c.J=!0;c.D=b;const {response:d,
70
- text:e}=yield pJ(c,a);c.w=d.uri;const f=yield uJ(c,e);c.o=f;const g=c.C;c.g&&0<g&&c.g.fa(g);return f})}requestStop(){this.I=!0}stop(){this.g&&(this.g.stop(),this.g=null);const a=[];this.A&&(a.push(this.A.destroy()),this.A=null);this.f.clear();this.o=this.a=this.D=this.j=null;return Promise.all(a)}update(){const a=this;return _.x(function*(){const b=a.o;if(!tJ(a)&&b){var c=b.presentationTimeline;"LIVE"===a.l&&(a.B=null);var d=Array.from(a.f.values());if(a.a.lowLatencyMode&&null!==a.j){const f=oJ(a);
71
- d=d.filter(g=>f.includes(dI(g).ya))}var e=yield wJ(a,d);d=e.map(f=>f.playlist);yJ(a,d);e=yield BJ(a,e);aJ(b.periods,e).forEach(f=>{a.D.filterNewPeriod(f)});sJ(a,e);dJ(b.periods,e);eJ(b.adaptedPeriods,e);nJ(c,e);if(d=NH(d))!0!==a.a.keepTimelineLive&&CJ(a,c,e),a.g.stop(),a.g=null;if(a.D.onUpdate)a.D.onUpdate(b);if(d&&a.D.onTurnedStatic)a.D.onTurnedStatic();a.I&&(yield a.stop())}})}Eb(){const a=this;return _.x(function*(){a.h.debug(_.gA);if(a.D)try{yield a.update(),a.g&&0<a.C&&a.g.fa(a.C)}catch(b){if(!(b instanceof
72
- _.H))throw b;a.D&&(a.D.onError(b),1===b.severity&&a.g&&a.g.fa(.1))}})}F(a){if(!this.A)throw new _.H(_.F,7,7001);a=this.D.networkingEngine.fetch(a);_.Wi(this.A,a);return a.P}};_.z("clpp.hls.HlsComponent",class extends _.Nt{f(){_.qr.m3u8=oK;_.or[_.Lk]=oK;_.or[yH]=oK}a(){_.qC("m3u8");_.rC(_.Lk);_.rC(yH)}id(){return"hls"}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";import './cl.mse.js';let g={};const _ = clpp._;var f=function(window){'use strict';var yH="CLOSED-CAPTIONS",zH="Could not parse MP4 segment start time.",AH="DURATION",BH="EXT-X-STREAM-INF",CH="Failed to infer discontinuity number",DH="Guessing audio-only",EH="METHOD",FH="SAMPLE-AES-CTR",GH="SUBTITLES",HH="Two EXT-X-KEY tags, one with METHOD\x3dAES-128 are applied to one ",IH="application/vnd.apple.mpegurl",JH="sample",KH="whole-segment",LH=function(a,b){return _.I(a,b,void 0,{required:!0})},MH=function(a){if(1>a.a)throw _.wl();--a.a},NH=function(a){if(null!==a&&void 0!==
2
+ a)return Number(a)},OH=function(a,b){return a.filter(c=>c.name===b)},PH=function(a){const b=/^[a-zA-Z0-9_-]+$/,c=new Set;a.forEach(d=>{const e=_.I(d,"VALUE"),f=_.I(d,"NAME"),g=_.I(d,"IMPORT"),h=_.I(d,"QUERYPARAM");if(1!==[f,g,h].filter(Boolean).length||f&&null==e)throw new _.H(_.F,4,4044,{message:"Invalid tag.",text:d.toString()});d=f||g||h;if(c.has(d))throw new _.H(_.F,4,4044,`EXT-X-DEFINE redefined variable "${d}".`);if(!b.test(d))throw new _.H(_.F,4,4044,`EXT-X-DEFINE invalid variable name "${d}".`);
3
+ c.add(d)})},QH=function(a,b){const c=Array.isArray(b)?b:[b];return a.filter(d=>{d=LH(d,_.Kb);return c.includes(d)})},RH=function(a,b){return a.some(c=>c.name===b)},SH=function(a,b,c){c=void 0===c?{}:c;a=a.find(d=>d.name===b)||null;if(!a&&c.required)throw new _.H(_.F,4,4024,{missingTag:b});return a},TH=function(a){var b=SH(a,"EXT-X-TILES");if(!b)return{Uc:1,ld:1,durationPerTile:null};a=_.I(b,"LAYOUT")||"1x1";b=_.I(b,AH);a=_.hB(a);return{Uc:a.Uc,ld:a.ld,durationPerTile:b?Number(b):null}},UH=function(a,
4
+ b,c){c=void 0===c?!0:c;a=new _.Mh(a);b=new _.Mh(b);b=a.resolve(b).toString();return c?b:decodeURI(b)},VH=function(a){const b=new Set;a.variants.forEach(c=>{c.audio&&b.add(c.audio);c.video&&b.add(c.video)});a.textStreams.forEach(c=>b.add(c));a.thumbStreams.forEach(c=>b.add(c));return Array.from(b)},WH=function(a,b){Array.isArray(a)||(a=[a]);a.forEach(c=>{for(const d of VH(c))b(d,c)})},XH=function(a){return a.some(b=>RH(b.ba,_.Fa))},YH=function(a){return a.type===_.p||a.type===_.w},ZH=function(a,b){const c=
5
+ SH(a,_.Fa);if(b&&c)return _.Tb;a=SH(a,_.La);if(!a)return"LIVE";if(a.value===_.Tb)return _.Tb;if("EVENT"===a.value)return"EVENT";throw new _.H(_.F,4,4044,`Invalid EXT-X-PLAYLIST-TYPE value: ${a.value}`);},$H=function(a){a={AUDIO:_.p,VIDEO:_.w,SUBTITLES:_.G,"CLOSED-CAPTIONS":_.G}[a.toUpperCase()];if(!a)throw new _.H(_.F,4,4044,"EXT-X-MEDIA tag has an invalid TYPE attribute.");return a},aI=function(a,b,c){c=void 0===c?!1:c;var d=0;let e=null;if(a){d=a.split("@");a=Number(d[0]);if(0>=a)throw new _.H(_.F,
6
+ 4,4044,"Byte range length must be positive.");if(d[1]){if(d=Number(d[1]),0>d)throw new _.H(_.F,4,4044,"Byte range start byte must not be negative.");}else{if(c)throw new _.H(_.F,4,4044,"Invalid byte range, offset is required but missing.");if(null==b)throw new _.H(_.F,4,4044,"Invalid byte range, cannot calculate offset based on previous byte ranges.");d=b+1}e=d+a-1}return{xa:d,ma:e}},bI=function(a,b){a=SH(a,_.Ba);return aI(a?a.value:null,b)},cI=function(a){a=SH(a,"EXTINF",{required:!0}).value.split(",");
7
+ return{duration:Number(a[0]),title:a[1]||null}},dI=function(a,b){b=void 0===b?{}:b;const c={pd:!1,ig:!1,jg:null,Mg:null,Ef:null};a=SH(a,_.Oa,{required:b.If});if(!a)return c;const d=e=>null==e?null:Number(e);c.pd="YES"===_.I(a,"CAN-BLOCK-RELOAD");c.ig="YES"===_.I(a,"CAN-SKIP-DATERANGES");c.jg=d(_.I(a,"CAN-SKIP-UNTIL"));c.Mg=d(_.I(a,"HOLD-BACK"));c.Ef=d(_.I(a,"PART-HOLD-BACK",void 0,{required:b.If}));return c},eI=function(a,b,c){c=void 0===c?!1:c;a=_.I(a,"BYTERANGE");return aI(a,b,c)},gI=function(a,
8
+ b){const c=bI(a.ba,null);return new fI(0,0,0,()=>[a.a],c.xa,c.ma,0,b)},hI=function(a,b){if(null==a)return null;a=Object.assign({},a);null==a.iv&&(a.iv=_.Ii(new Uint8Array(12),new Uint8Array([b>>24&255,b>>16&255,b>>8&255,b&255])));return a},iI=function(a){let b=Infinity,c=Infinity;VH(a).filter(YH).forEach(d=>{{d=d.V;var e=d[0].startTime;const f=d[d.length-1].endTime;d=e;e=f-e}b=Math.min(b,d);c=Math.min(c,e)});return{Fc:b,duration:c}},jI=function(a){return a.map(b=>{({duration:b}=iI(b));return b}).reduce((b,
9
+ c)=>b+c,0)},kI=function(a){return(a.video?a.video.Ba:"")+" - "+(a.audio?a.audio.Ba:"")},lI=function(a,b,c,d){if(b===_.Tb)return{delay:0,pc:0};b=SH(a,_.Ja);if(c&&b){c=Number(LH(b,"PART-TARGET"));if(null!=d)return{delay:d,pc:c};({Ef:d}=dI(a,{If:!0}));return{delay:d,pc:c}}a=SH(a,_.Qa,{required:!0});a=Number(a.value);return null!=d?{delay:d,pc:a}:{delay:3*a,pc:a}},mI=function(a){const b=[];WH(a,c=>{b.push(c.Ug)});return{delay:Math.max(...b.map(c=>c.delay)),pc:Math.min(...b.map(c=>c.pc))}},oI=function(a){const b=
10
+ new Map;a.forEach(c=>{var d=`${nI(c).type}:${nI(c).groupId}`;b.has(d)?(d=b.get(d),d.includes(c)||d.push(c)):b.set(d,[c])});return b},pI=function(a){const b=new Map;for(const c of a){a=_.I(c,_.cb);a=_.bi(a||_.ag);const d=LH(c,_.Va),e=LH(c,"INSTREAM-ID");b.has(d)||b.set(d,new Map);b.get(d).set(e,a)}return b},rI=function(a){a=a.audio.concat(a.video);for(const b of a)a=nI(b).codecs.split(",").filter(c=>"mp4a.40.34"!==c),qI(b,a)},sI=function(a,b){if(!a)return null;const c=a.Ba;return b.find(d=>nI(d).Ba===
11
+ c)||null},tI=function(a){for(const b of a)if(b.startsWith("#EXT-")&&(a=_.Ni(0,b),_.Ts.has(a.name)))return 1;return 0},uI=function(a,b){return a.replace(/\{\$([a-zA-Z0-9_-]+)\}/g,(c,d)=>{c=b.get(d);if(null==c)throw new _.H(_.F,4,4044,`Undefined variable '${d}'`);return c})},vI=function(a,b){a.forEach(c=>{c.attributes.forEach(d=>{d.value=uI(d.value,b)})})},wI=function(a,b,c){vI(a,c);b.forEach(d=>{d.a&&(d.a=uI(d.a,c));vI(d.ba,c);vI(d.f,c)})},xI=function(a,b){const c=new Map,d=new URL(b);a.forEach(e=>
12
+ {var f=_.I(e,"NAME"),g=_.I(e,"QUERYPARAM");if(f)g=LH(e,"VALUE"),c.set(f,g);else if(g){f=d.searchParams.get(g);if(null==f)throw new _.H(_.F,4,4044,`Query param '${g}' missing in playlist URI.`);if(!f)throw new _.H(_.F,4,4044,`Query param '${g}' has no associated value`+" in playlist URI.");c.set(g,decodeURIComponent(f))}});return c},AI=function(a,b,c){const d=[];for(let e=1;e<b.length;e++){const f=yI(a,b[e]);d.push(f);if(f.name===BH){const g=b[e+1];if(!g)throw new _.H(_.F,4,4044,"EXT-X-STREAM-INF is not followed by a URI.");
13
+ f.attributes.push(new _.Li(_.Mb,g));e++}}b=OH(d,"EXT-X-DEFINE");PH(b);b=xI(b,c);a.a=b;wI(d,[],a.a);return new zI(c,0,d)},DI=function(a,b,c){let d=[];for(var e=1;e<b.length;){const f=yI(a,b[e]);if(_.Us.has(f.name))break;d.push(f);e++}b=BI(a,c,b.slice(e));e=b.V;d=d.concat(b.ba);a=CI(a,d,c);wI(d,e,a);return new zI(c,1,d,b.V)},EI=function(a,b,c){b=b.trim().split(/\n+/m).map(d=>d.trim()).filter(d=>d.length&&!/^#(?!EXT)/m.test(d));if(!/^#EXTM3U($|[ \t\n])/m.test(b[0]))throw new _.H(_.F,4,4015);return 0===
14
+ tI(b)?AI(a,b,c):DI(a,b,c)},yI=function(a,b){return _.Ni(a.f++,b)},BI=function(a,b,c){const d=[],e=[];let f=[],g=[];c.forEach(h=>{/^(#EXT)/.test(h)?(h=yI(a,h),_.Ts.has(h.name)||_.Ws.has(h.name)?d.push(h):_.Vs.has(h.name)?"EXT-X-PART"===h.name?g.push(h):h.name===_.Ma&&"PART"===_.I(h,_.Kb)&&g.push(h):f.push(h)):/^#(?!EXT)/m.test(h)||(h=UH(b,h.trim(),!1),e.push(new FI(h,f,g)),f=[],g=[])});0<g.length&&e.push(new FI(null,f,g));return{V:e,ba:d}},CI=function(a,b,c){b=OH(b,"EXT-X-DEFINE");PH(b);const d=xI(b,
15
+ c);b.map(e=>_.I(e,"IMPORT")).filter(Boolean).forEach(e=>{const f=a.a.get(e);if(null==f)throw new _.H(_.F,4,4044,`Cannot import variable '${e}' as it is not defined `+"in the master playlist");d.set(e,f)});return d},GI=function(a){return 0>a?[]:Array.from({length:a},(b,c)=>c)},HI=function(a,b=0){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},II=function(a){function b(h,k,l){let m="";for(;k<l;k++)m+="%"+("00"+
16
+ h[k].toString(16)).slice(-2);return m}function c(h){return h[0]<<21|h[1]<<14|h[2]<<7|h[3]}function d(){throw new _.H(_.F,4,4030);}HI(a)||d();let 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(let 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]<<
17
+ 6|a[7]>>>2,f*=4,f+=a[7]&3,Math.round(f/9E4);break}}HI(a,e)||d();e+=10;e+=f}while(e<a.byteLength);return d()},JI=function(a,b){let c=null,d=0;try{(new _.Ml).M(_.Be,_.Fl).M(_.Yf,_.Fl).M(_.we,_.Fl).ca("mdhd",g=>{g.reader.skip(0===g.version?8:16);d=_.P(g.reader);g.parser.stop()}).parse(b,!0)}catch(g){c=g}if(c||!d)throw _.su.error("Unable to find timescale in init segment!"),new _.H(_.F,4,4030,zH,c);let e=0,f=!1;try{(new _.Ml).M("moof",_.Fl).M("traf",_.Fl).ca("tfdt",g=>{var h=d;if(0===g.version)h=_.P(g.reader)/
18
+ h;else{{const k=_.P(g.reader),l=_.P(g.reader);if(!(2097151>=k||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=k/h*Math.pow(2,32)+l/h}}e=h;f=!0;g.parser.stop()}).parse(a,!0)}catch(g){c=g}if(c||!f)throw new _.H(_.F,4,4030,zH,c);return e},KI=function(a){for(;a.getPosition()<a.Ha()-1;){const b=a.getPosition();if(71===_.xl(a))return MH(a),b}return-1},LI=function(a){function b(){d.seek(e+188);f=_.xl(d);71!==f&&(d.seek(e+192),
19
+ f=_.xl(d));71!==f&&(d.seek(e+204),f=_.xl(d));71!==f&&c();MH(d)}function c(){throw new _.H(_.F,4,4030);}const d=new _.ym(new DataView(a),!1);let e=0,f=0;e=KI(d);0>e&&(_.su.error("Unable to find sync byte in TS after scanning."),c());for(;;){e=d.getPosition();f=_.xl(d);71!==f&&c();a=_.yl(d);if(8191===(a&8191)){b();continue}if(!(a&16384)){b();continue}a=(_.xl(d)&48)>>4;0!==a&&2!==a||c();3===a&&(a=_.xl(d),d.skip(a));if(1!==_.P(d)>>8){b();continue}d.skip(3);a=_.xl(d)>>6;0!==a&&1!==a||c();0===_.xl(d)&&
20
+ c();a=_.xl(d);const g=_.yl(d),h=_.yl(d);return(1073741824*((a&14)>>1)+((g&65534)<<14|(h&65534)>>1))/9E4}},OI=function(a){const b=MI(a),c=NI(a);a.forEach(d=>{const e=d.V,f=e.findIndex(h=>h.ia===b);let g=e.findIndex(h=>h.ia===c+1);-1===g&&(g=e.length);d.V=e.slice(f,g)})},NI=function(a){a=a.map(b=>b.V[b.V.length-1].ia);return Math.min(...a)},MI=function(a){a=a.map(b=>b.V[0].ia);return Math.max(...a)},RI=function(a){var b=LH(a,EH);if(!PI.includes(b))return QI.error("PlayReady in HLS is only supported with [",
21
+ PI.join(", "),"], not",b),null;a=LH(a,_.Mb);b=_.as(a);a=null;b=_.J(b.data);try{a=_.RA(_.Fm(b))}catch(c){a=b}return _.dB(_.xd,[{initDataType:_.$c,initData:a}],"")},TI=function(a){if(0===a.length)return SI();if(a.some(c=>c.type===KH)||a.every(c=>c.type===_.Ee))return a[0];a=a.filter(c=>c.type===JH);const b=_.Eh(a.flatMap(c=>c.drmInfos));return{keyInfo:null,keyId:a[a.length-1].keyId,type:JH,drmInfos:b}},WI=function(a){a=UI(a);if(a.some(b=>VI(b))&&1<a.length)throw new _.H(_.F,4,4046,"Two EXT-X-KEY tags, one with METHOD\x3dAES-128 are applied to one playlist.");
22
+ },VI=function(a){return OH(a.ba,_.Ga).some(b=>"AES-128"===_.I(b,EH))},YI=function(a,b,c){return UI(a).map(d=>XI(d.ba,b,c))},ZI=function(a){return a.filter(b=>RH(b.ba,_.Ga)).length},UI=function(a){return a.filter(b=>RH(b.ba,_.Ga))},XI=function(a,b,c){a=OH(a,_.Ga);if(0===a.length)return null;var d=LH(a[0],EH);if(1===a.length){if("NONE"===d)return SI();if("AES-128"===d)return a=a[0],d=_.I(a,"IV",""),{type:KH,keyInfo:{method:"AES-128",url:UH(b,LH(a,_.Mb)),iv:d?_.Fi((d||"0x").slice(2)):null},drmInfos:[],
23
+ keyId:null}}b=a.map(e=>LH(e,EH));if(!b.every(e=>"SAMPLE-AES"===e)&&!b.every(e=>e===FH))throw $I.warn(`EXT-X-KEY methods ${b.join(", ")} are incompatible.`),new _.H(_.F,4,4044,"Multiple EXT-X-KEY tags with incompatible METHOD values.");b=a.map(e=>{const f=_.I(e,"KEYFORMAT","identity");{const g=aJ[f]||null;e=g?g(e,c):null}e||$I.warn("Unsupported HLS KEYFORMAT",f);return e}).filter(Boolean);if(0===b.length)throw new _.H(_.F,4,4026);return{keyInfo:null,keyId:b.map(e=>e.keyIds).reduce((e,f)=>e.concat(f),
24
+ []).reverse()[0]||null,type:JH,drmInfos:b}},SI=function(){return{type:_.Ee,keyInfo:null,drmInfos:[],keyId:null}},bJ=function(a,b,c){return _.x(function*(){const d=b.f(),e=_.HB(b.Ra(),b.xa,b.xa+2048-1,a.a.attemptParameters);e.type=2;const f=_.HB(b.Ra(),b.xa,b.ma,a.a.attemptParameters);f.type=2;d&&(f.keyInfo=d);try{return yield a.f(c?f:e)}catch(g){if(7001===g.code||c)throw g;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.",
25
+ e.uris[0]);try{return yield a.f(f)}catch(h){throw a.g.error("Failed to fetch media segment to parse its start timestamp.",f.uris[0],h),new _.H(_.F,4,4030,"Failed to fetch the media segment.");}}})},cJ=function(a,b,c,d,e,f){return _.x(function*(){a.g.debug("Fetching segment to find start time");if("audio/mpeg"===d||d===_.Ic||d===_.Hc)return 0;if(d===_.Gc){var g=yield bJ(a,c,f);const h=_.J(g.data);return HI(h)?II(h):LI(g.data)}if(d===_.mg||d===_.Jc)return g=[bJ(a,c,f)],b&&g.push(bJ(a,b,!0)),g=yield Promise.all(g),
26
+ JI(g[0].data,(g[1]||g[0]).data);if(d===_.lg)return g=yield bJ(a,c,f),LI(g.data);if(!_.Vp(`${d.split("/")[0]||""}/mp4;codecs="${e}"`))return 0;throw new _.H(_.F,4,4030);})},dJ=function(a,b){a=a.map(c=>c.streams[b]);return a.some(c=>null==c)?null:a},qI=function(a,b){a.streams.forEach(c=>{c.codecs=b.join(",")})},nI=function(a){return a.streams[0]},eJ=function(a,b){a.streams.forEach(c=>{c.Qd=b})},fJ=function(a,b){a.streams.forEach(c=>{c.width=b})},gJ=function(a,b){a.streams.forEach(c=>{c.height=b})},
27
+ hJ=function(a,b){a.streams.forEach(c=>{c.frameRate=b})},iJ=function(a,b){a.streams.forEach(c=>{c.bandwidth=b})},jJ=function(a,b){a=a.map(c=>c.a[b]);return a.some(c=>null==c)?null:a},kJ=function(a,b){const c=new Set(a.map(d=>d.ia));return b.filter(d=>!c.has(d.ia))},nJ=function(a,b){for(;a[0].ia<b[0].ia;)a.splice(0,1);var c=a[0];let d=b[0];lJ(c,d)||mJ(c,d);const e=a.length-1;c=a[e];d=b[e];0<e&&!lJ(c,d)&&mJ(c,d);for(c=e+1;c<b.length;)a.push(b[c]),c++},oJ=function(a,b){const c=a[a.length-1];var d=b.findIndex(f=>
28
+ f.ia===c.ia);const e=b[d];lJ(c,e)||mJ(c,e);for(d+=1;d<b.length;d++)a.push(b[d])},tJ=function(a,b,c,d,e){var f=b[0].length();f=GI(f).map(g=>{var h=jJ(b,g)||[];const k=dJ(c,g)||[];g=dJ(d,g)||[];{const l=[...pJ(h),...k,...g].filter(Boolean);qJ(l);const {ia:m,duration:n}=l[0];h={configurationId:a,variants:h,textStreams:k,thumbStreams:g,startTime:0,id:`P${m}`,endTime:n,duration:n,ia:m}}return h});e&&rJ(f[0]);sJ(f);return f},pJ=function(a){a=new Set(a.flatMap(b=>[b.video,b.audio]).filter(Boolean));return Array.from(a)},
29
+ rJ=function(a){const b=pJ(a.variants)[0].V[0].Aa;a.startTime+=b;a.endTime+=b},sJ=function(a){for(let b=0;b<a.length;b++){const c=a[b],d=a[b-1];c.startTime=d?d.endTime:c.startTime;c.endTime=c.startTime+c.duration}},lJ=function(a,b){return a.startTime===b.startTime&&a.endTime===b.endTime},mJ=function(a,b){a.startTime=b.startTime;a.endTime=b.endTime;a.duration=b.duration;uJ(a.variants,b.variants);vJ(VH(a),VH(b))},uJ=function(a,b){const c=new Map(a.map(d=>[kI(d),d]));b.forEach(d=>{c.get(kI(d)).drmInfos=
30
+ d.drmInfos})},vJ=function(a,b){const c=new Map(a.map(d=>[d.Ba,d]));b.forEach(d=>{const e=c.get(d.Ba);e.V=d.V;e.segmentIndex.replace(d.V);e.Fc=d.Fc;e.je=d.je;e.duration=d.duration;e.df=d.df;e.encrypted=d.encrypted;e.drmInfos=d.drmInfos;e.keyId=d.keyId})},qJ=function(a){const b=wJ(a);a.forEach(c=>{_.DB(c.segmentIndex,b);c.duration=b;c.je=c.Fc+b})},wJ=function(a){let b=Infinity;a.filter(YH).forEach(c=>{b=Math.min(b,c.duration)});return b},xJ=function(a,b){WH(b,(c,d)=>{_.QB(a,c.V,d.startTime)});_.IB(a.a,
31
+ b[0].startTime,b[b.length-1].endTime)},yJ=function(a){return null===a.j?[]:[a.j.audio,a.j.video].filter(b=>b).map(b=>b.Ba)},zJ=function(a,b){return _.x(function*(){var c=_.Si([b],a.a.attemptParameters);c.type=1;c=yield a.G(c);let d="";try{d=_.oi(c.data)}catch(e){throw new _.H(_.F,4,4042);}d=d.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n");d=d.trim();return{text:d,response:c}})},FJ=function(a,b){return _.x(function*(){var c=AJ(a,b,a.w,"");if(1===c.type){c=_.Ps(c.V[0].a)||"";c=null!=_.Os.video[c]?_.w:null!=_.Os.audio[c]?
32
+ _.p:null;var d="";c===_.w?d="avc1.42E01E":c===_.p&&(d="mp4a.40.2");c=a.L;var e=a.w;d=a.a.hlsDefaultCodecs||d;var f=[],g=[];g.push(new _.Li(_.ma,"0"));g.push(new _.Li(_.Mb,e));d.length&&g.push(new _.Li(_.pa,d));f.push(new _.Mi(c.f++,BH,g));c=new zI(e,0,f)}d=c.ba;c=OH(d,"EXT-X-MEDIA");e=OH(d,BH);d=OH(d,"EXT-X-IMAGE-STREAM-INF");c={Ec:{dg:QH(c,["AUDIO",_.Sb]),closedCaptions:QH(c,yH),wh:QH(c,GH)},md:e,ee:d};const {periods:h,ih:k,yh:l}=yield BJ(a,c);if(!a.D)throw new _.H(_.F,7,7001);c=mI(h[0]);CJ(a,h);
33
+ e=!0;d=null;f=0;DJ(a)||(e=!1,d=0,f=c.delay);g=a.a.timeline||{};g.type=void 0;d=new _.jH(g,d,f,!0,void 0,!!a.a.lowLatencyMode);_.MB(d,e);xJ(d,h);k&&_.LB(d,k);e=d;if(!DJ(a)){a.C=c.pc;c=0;for(var m of a.f.values())c=Math.max(c,m.streams[0].Fc);for(m=0;95443.7176888889<=c;)m+=95443.7176888889,c-=95443.7176888889;if(m){a.g.debug("Offsetting live streams by",m,"to compensate for rollover");for(var n of a.f.values())c=n.streams[0],95443.7176888889>c.Fc?(a.g.debug("Offset applied to",c.type),c.segmentIndex.offset(m)):
34
+ a.g.debug("Offset NOT applied to",c.type)}}n=jI(h);"LIVE"===a.l||"EVENT"===a.l?(n=Math.max(n,e.J),isNaN(a.a.availabilityWindowOverride)||(n=a.a.availabilityWindowOverride),e.A=n):a.l===_.Tb&&(e.f=n);EJ(a,l);n={presentationTimeline:e,adaptedPeriods:[...h],periods:h,minBufferTime:0};a.g.debug("HLS playlist parsed",n);return n})},HJ=function(a,b){return Promise.all(b.map(c=>GJ(a,c)))},JJ=function(a,b){b.forEach(c=>{a:{var d=a.f.get(c.a),e=!DJ(a),f=SH(c.ba,_.Ea);if(f)var g=Number(f.value);else{d?(f=d.streams[d.streams.length-
35
+ 1].V,f=f[f.length-1].ia):f=0;if(e&&0<f)try{{const k=SH(c.ba,_.Ia);if(!k)throw IJ.error("Failed to infer discontinuity number, because EXT-X-MEDIA-SEQUENCE tag is missing."),Error(CH);const l=Number(k.value),m=d.find(l);if(!m)throw IJ.error("Failed to infer discontinuity number, could not find the appropriate segment in the previous playlist"+` (segment position = ${l})`),Error(CH);var h=m.ia}g=h;break a}catch(k){throw new _.H(_.F,4,4024,"EXT-X-DISCONTINUITY-SEQUENCE tag is required for discontinuous HLS live streams.");
36
+ }g=0}}c=c.V||[];for(const k of c)RH(k.ba,_.Da)&&g++,k.ia=g});OI(b)},MJ=function(a,b){return _.x(function*(){const {textStreams:c,thumbStreams:d,eg:e}=yield KJ(a,b);var f=a.o.periods[0].variants;a.a.lowLatencyMode&&null!==a.j&&(f=f.filter(g=>g.id===a.j.id));f=f.map(g=>{const h=sI(g.audio,e),k=sI(g.video,e);g=LJ(a,h,k,g.bandwidth);if(!g)throw new _.H(_.F,4,4047,{message:"Video and audio are encrypted in an incompatible way.",ai:k?nI(k).Ba:void 0,audio:h?nI(h).Ba:void 0});return g});return tJ(a.D.configurationId,
37
+ f,c,d,!0)})},CJ=function(a,b){DJ(a)||2!==a.a.timeline.version||(a.H||(a.H=b[0].startTime),_.nD(b,-a.H))},NJ=function(a,b){b=b.flatMap(d=>d.V[0].ba);b=SH(b,_.Na);if(!b)return null;const c=(new Date(b.value)).getTime();return isNaN(c)?(a.g.warn("Failed to parse EXT-X-PROGRAM-DATE-TIME tag "+`value (value: ${b.value}).`),null):c/1E3},OJ=function(a,b,c){b=b.find(d=>null!==SH(d.ba,_.Ca));if(!b)return[];if(null===c)throw new _.H(_.F,4,4024,"EXT-X-PROGRAM-DATE-TIME tag is required when EXT-X-DATERANGE tags are present");
38
+ return b.ba.filter(d=>d.name===_.Ca).map(d=>{a:{var e=a.A,f=!DJ(a),g=_.I(d,"ID"),h=_.I(d,"START-DATE");if(null===g||null===h)_.Ss.warn("Invalid EXT-X-DATERANGE missing mandatory ID or START-DATE attribute, ignoring the EXT-X-DATERANGE tag.",d),d=null;else{e=f?e-c:-c;var k=new Date(h);h=k.getTime()/1E3+e;g={id:g,startTime:h,startDate:k};f=NH(_.I(d,AH));void 0!==f&&0<=f&&(g.duration=f);var l=NH(_.I(d,"PLANNED-DURATION"));void 0!==l&&0<=l&&(g.plannedDuration=l);var m=_.I(d,"CLASS");null!==m&&(g.schemeIdUri=
39
+ m);var n=_.I(d,"END-DATE");n=n?new Date(n):null;null!==n&&n.getTime()>=k.getTime()&&(g.endDate=n);{const v=d.attributes;if(null==v)var q=null;else{k={};for(q of v)q.name.startsWith("X-")&&(k[q.name]=q.value);q=_.Sg(k)?k:null}}q=q||{};if(k=_.I(d,"CUE"))q.Gh=k.split(",");if(m===_.wd){k=d.attributes;if(null==k)var u=null;else{m={};for(u of k)switch(u.name){case _.$b:m[_.$b]=u.value;break;case _.Zb:m[_.Zb]=u.value;break;case _.bc:m[_.bc]=NH(u.value);break;case _.ac:m[_.ac]=NH(u.value);break;case "X-SNAP":m["X-SNAP"]=
40
+ u.value.split(",");break;case "X-RESTRICT":m["X-SNAP"]=u.value.split(",")}m[_.$b]&&m[_.Zb]||!m[_.$b]&&!m[_.Zb]?(_.Ss.warn("Invalid EXT-X-DATERANGE Interstitial attributes X-ASSET-URI, X-ASSET-LIST"),u=null):u=_.Sg(m)?m:null}if(null===u){_.Ss.warn("Invalid interstitial attributes, ignoring the EXT-X-DATERANGE tag.",d);d=null;break a}q=Object.assign(q,u)}_.Sg(q)&&(g.ta=q);g.endTime=n?n.getTime()/1E3+e:f?h+f:l?h+l:h;g.type=_.ae;d=g}}return d}).filter(Boolean)},EJ=function(a,b){for(const c of b){if((b=
41
+ a.F.get(c.id))&&b.startTime!==c.startTime)a.D.onError(new _.H(1,4,4044,"EXT-X-DATERANGE START-DATE has changed for"+` ID=${c.id}`));b||(a.F.set(c.id,c),a.D.onTimelineCueAdded({configurationId:a.D.configurationId,schemeIdUri:c.schemeIdUri,ta:c.ta,value:"",startTime:c.startTime,endTime:c.endTime,id:c.id,type:_.ae,eventElement:null}))}},PJ=function(a,b,c){a.l=_.Tb;_.MB(b,!0);b.f=c[c.length-1].endTime},AJ=function(a,b,c,d){a=EI(a.L,b,c);a.a=d;return a},BJ=function(a,b){return _.x(function*(){var c=pI(b.Ec.closedCaptions),
42
+ d=QJ(a,b.md),e=yield RJ(a,b),f=Object.values(e).flat().map(g=>g.playlist);JJ(a,f);f=yield SJ(a,e.Ve,d);c=yield TJ(a,e.md,f,c);d=yield UJ(a,e.vh,d);f=yield VJ(a,e.ee);d=tJ(a.D.configurationId,c,d,f,!DJ(a));a.D.filterAllPeriods(d);c=[...e.md,...e.Ve].map(g=>g.playlist);e=NJ(a,c);c=OJ(a,c,e);return{periods:d,ih:e,yh:c}})},KJ=function(a,b){return _.x(function*(){const c=g=>nI(g.stream).type===_.w||nI(g.stream).type===_.p;var d=b.filter(c),e=b.filter(g=>!c(g)),f=g=>{g=g.map(h=>{var k=nI(h.stream);k={language:k.language,
43
+ channelsCount:k.channelsCount,spatialAudio:k.spatialAudio,closedCaptions:k.closedCaptions,primary:k.primary,kind:k.kind||null,groupId:k.groupId,type:k.type,codecs:k.codecs,name:k.originalId,uri:k.Ba,Od:{width:k.width,height:k.height,frameRate:k.frameRate}};h=Object.assign({},{playlist:h.playlist},k);return WJ(a,h)});return Promise.all(g)};d=yield f(d);f=yield f(e);XJ(a,d.concat(f));e=f.filter(g=>nI(g).type===_.MA);f=f.filter(g=>nI(g).type===_.de);return{textStreams:e,thumbStreams:f,eg:d}})},LJ=function(a,
44
+ b,c,d){const e=[],f=(c||b).length();for(let m=0;m<f;m++){var g=b?b.streams[m]||null:null,h=c?c.streams[m]||null:null,k=g,l=h;k=k&&l?_.lB(k.drmInfos,l.drmInfos)?_.kB(k.drmInfos,l.drmInfos):null:k?k.drmInfos:l?l.drmInfos:null;if(!k)return null;l=d;g={id:a.O++,language:g?g.language:_.ag,primary:!!g&&g.primary||!!h&&h.primary,audio:g,video:h,bandwidth:l,drmInfos:k,allowedByApplication:!0,allowedByKeySystem:!0};e.push(g)}return new YJ(e)},WJ=function(a,b){return _.x(function*(){const c=b.playlist,d=b.codecs,
45
+ e=b.type,f=b.$c,g=b.groupId,h=b.primary;var k=b.kind;const l=b.name,m=b.channelsCount,n=b.spatialAudio,q=b.closedCaptions,u=b.Od,v=_.bi(f||_.ag);if(1!==c.type)throw new _.H(_.F,4,4017);var y=ZH(c.ba,null==a.o);a.l=y;const B=lI(c.ba,y,a.a.lowLatencyMode||!1,a.a.suggestedPresentationDelay);y=yield ZJ(a,c,e,d);const D=a.a.lowLatencyMode?_.BA:_.AA;let M=k;e!==_.G||k||(M=_.MA);const {pd:da}=dI(c.ba);k=y.map(vb=>{const Ub=vb.V,pd=vb.pg,kg=vb.mimeType;vb=vb.ia;const Wa=Ub[0].startTime,le=Ub[Ub.length-1].endTime,
46
+ Oc=le-Wa,ea=new _.kH(Ub),$a=Ub[0].initSegment||null;return{id:_.oH++,originalId:l,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:ea.find.bind(ea),getSegmentReference:ea.get.bind(ea),adjustSegmentDurations:ea.f.bind(ea),getDuration:ea.getDuration.bind(ea),segmentIndex:ea,segmentLookupStrategy:D,initSegmentReference:$a,mimeType:kg,codecs:d,kind:M,df:pd.type,encrypted:pd.type===JH,keyId:pd.keyId,language:v,originalLanguage:f||_.ag,label:l,type:e,primary:h,trickModeVideo:null,emsgSchemeIdUris:null,
47
+ frameRate:u?u.frameRate:void 0,width:u?u.width:void 0,height:u?u.height:void 0,bandwidth:void 0,roles:[],channelsCount:m,spatialAudio:n,closedCaptions:q,keyInfo:pd.keyInfo,V:Ub,drmInfos:pd.drmInfos,ia:vb,Ba:c.a,Qd:c.f,Fc:Wa,je:le,duration:Oc,pd:da,groupId:g,Ug:B}});return new $J(k)})},XJ=function(a,b){b.forEach(c=>{a.f.a.set(nI(c).Ba,c)})},QJ=function(a,b){const c=new Map;for(const f of b){var d=_.I(f,"AUDIO");b=_.I(f,_.Sb);var e=_.I(f,GH);const g=aK(a,f);if(e){const h=_.zj(_.G,g);c.set(`${_.G}:${e}`,
48
+ h);e=g.indexOf(h);-1<e&&g.splice(e,1)}d&&(e=bK(_.p,g),c.set(`${"audio"}:${d}`,e));b&&(d=bK(_.w,g),c.set(`${"video"}:${b}`,d))}return c},RJ=function(a,b){return _.x(function*(){const c=yield Promise.all([cK(a,b.Ec.dg),cK(a,b.Ec.wh),cK(a,b.md),cK(a,b.ee)]),[d,e,f,g]=c;return{Ve:d,vh:e,md:f,ee:g}})},SJ=function(a,b,c){return _.x(function*(){if(0===b.length)return new Map;var d=[dK(a,b[0],c)];yield d[0];d=d.concat(b.slice(1).map(e=>dK(a,e,c)));d=yield Promise.all(d);return oI(d)})},TJ=function(a,b,c,
49
+ d){return _.x(function*(){const e=new Set;var f=[...b];let g=0;var h=Infinity;for(let k=0;k<f.length;++k){const l=Number(LH(f[k].tag,_.ma));l<h&&(h=l,g=k)}h=f.splice(g,1).pop();h=yield eK(a,h,c,d,e);f=f.map(k=>eK(a,k,c,d,e));f=yield Promise.all(f);f.splice(g,0,h);return f.reduce(_.aB,[])})},UJ=function(a,b,c){return Promise.all(b.map(d=>dK(a,d,c)))},VJ=function(a,b){return Promise.all(b.map(c=>fK(a,c)))},DJ=function(a){return a.l===_.Tb},cK=function(a,b){return _.x(function*(){return(yield Promise.all(b.map(c=>
50
+ _.x(function*(){const d=yield gK(a,c);return d?{tag:c,playlist:d}:null})))).filter(Boolean)})},GJ=function(a,b){return _.x(function*(){var c=new _.Mh(nI(b).Qd);if(a.a.lowLatencyMode&&nI(b).pd){var d=b.streams[b.streams.length-1].segmentIndex;if(d=d.a[d.a.length-1]){var e=d.a,f=e.length-1;d={Xg:d.position,dh:e&&0<e.length?f:null}}else d=null;if(e=d)d=e.Xg,e=e.dh,f=_.lj(c.a.toString()),f._HLS_msn=d.toString(),null===e&&f._HLS_part&&delete f._HLS_part,null!==e&&(f._HLS_part=e.toString()),d=_.kj(f,!0),
51
+ d=new _.Vh(d),_.Rh(c,d)}const {response:g,text:h}=yield zJ(a,c.toString());c=nI(b).Ba;d=nI(b).Qd;e=g.uri;d!==e&&(d=e,eJ(b,d));c=AJ(a,h,d,c);return{stream:b,playlist:c}})},aK=function(a,b){var c=_.I(b,_.pa,a.a.hlsDefaultCodecs||"avc1.42E01E,mp4a.40.2").split(/\s*,\s*/);b=new Set;const d=[];for(const e of c)c=_.qB(e),b.has(c)?a.g.debug("Ignoring duplicate codec"):(d.push(e),b.add(c));return d},bK=function(a,b){if(1===b.length)return b[0];a=_.zj(a,b);if(null!=a)return a;throw new _.H(_.F,4,4025,{codecList:b});
52
+ },dK=function(a,b,c){return _.x(function*(){const d=b.tag,e=b.playlist;return hK(a,e.a,()=>_.x(function*(){const f=LH(d,_.Va),g=$H(LH(d,_.Kb));var h=LH(d,_.Kb).toUpperCase();if($H(h)!==_.G)h=null;else{var k=d.getAttribute("FORCED");k=!(!k||!k.value||"YES"!==k.value.toUpperCase());var l=_.MA;h===yH&&(l=_.wA);k&&(l=_.Wd);h=l}k=c.get(`${g}:${f}`)||"";l=_.I(d,_.cb);const m=_.I(d,"NAME"),n=d.getAttribute("DEFAULT"),q=d.getAttribute("AUTOSELECT");var u=_.I(d,"CHANNELS");u=g===_.p?u?parseInt(u.split("/")[0],
53
+ 10):null:null;var v=g===_.p?(v=_.I(d,"CHANNELS"))?v.includes("/JOC"):!1:!1;return yield WJ(a,{playlist:e,codecs:k,type:g,$c:l,primary:!!n&&!!q,name:m,channelsCount:u,spatialAudio:v,groupId:f,kind:h,closedCaptions:null,Od:null})}))})},fK=function(a,b){return _.x(function*(){const c=b.tag,d=b.playlist;return hK(a,d.a,()=>_.x(function*(){var e=_.I(c,_.pa)||"jpg",f=_.I(c,_.cb);const g=_.I(c,"NAME");e=yield WJ(a,{playlist:d,codecs:e,type:_.de,$c:f,name:g,primary:!1,kind:null,channelsCount:null,spatialAudio:!1,
54
+ closedCaptions:null,groupId:null,Od:null});(f=_.I(c,_.ma))&&iJ(e,Number(f));return e}))})},eK=function(a,b,c,d,e){return _.x(function*(){var f=b.tag,g=Number(LH(f,_.ma));if(null!=f.getAttribute("FRAME-RATE")||null!=f.getAttribute(_.Cb)){var h=_.I(f,"FRAME-RATE");f=_.I(f,_.Cb);var [k,l]=f?f.split("x"):[null,null];h={frameRate:NH(h),width:NH(k),height:NH(l)}}else h=null;if(f=yield iK(a,b,h,c,d)){h=f.video;f=f.audio;var m=0<f.length?f:[null];h=0<h.length?h:[null];f=[];for(const n of m)for(const q of h){m=
55
+ (q?nI(q).Ba:"")+" - "+(n?nI(n).Ba:"");if(e.has(m)){a.g.debug("Skipping variant which only differs in text streams.");continue}const u=LJ(a,n,q,g);null==u?a.g.warn("Incompatible DRM info in HLS variant. Skipping."):(f.push(u),e.add(m))}g=f}else g=[];return g})},iK=function(a,b,c,d,e){return _.x(function*(){var f=b.tag,g=b.playlist;let h=aK(a,f);var k=_.I(f,"AUDIO"),l=_.I(f,_.Sb);k=k?d.get(`${"audio"}:${k}`)||[]:[];var m=l?d.get(`${"video"}:${l}`)||[]:[];l=[...k,...m];k={audio:k,video:m};a.g.debug("Guessing stream type for",
56
+ f.toString());f=!1;const n=g.a;g=k.audio.find(q=>nI(q).Ba===n);m=_.zj(_.w,h);m=c||m;1!==h.length||m?!l.length&&1<h.length?(a.g.debug("Guessing multiplexed audio+video"),g=_.w,h=[h.join(",")]):k.audio.length&&g?(a.g.debug(DH),g=_.p,f=!0):k.video.length?(a.g.debug(DH),g=_.p):(a.g.debug("Guessing video-only"),g=_.w):(g=_.p,a.g.debug(DH));m=null;f||(m=yield jK(a,b,h,g,e,c));if(null==m)return null;k[g]=[m];g===_.p&&c&&l.forEach(q=>{fJ(q,c.width);gJ(q,c.height);hJ(q,c.frameRate)});rI(k);return k})},jK=
57
+ function(a,b,c,d,e,f){return _.x(function*(){const g=b.tag,h=b.playlist;return hK(a,h.a,()=>_.x(function*(){var k=_.I(g,yH);let l=null;d===_.w&&k&&"NONE"!==k&&(l=e.get(k));k=bK(d,c);return yield WJ(a,{playlist:h,codecs:k,type:d,closedCaptions:l,primary:!1,kind:null,$c:null,name:null,channelsCount:null,spatialAudio:!1,groupId:null,Od:f})}))})},hK=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},ZJ=function(a,
58
+ b,c,d){return _.x(function*(){var e=b.a,f=b.V;var g=void 0===g?0:g;var h=(h=SH(b.ba,_.Ia))?Number(h.value):g;g=[];!DJ(a)&&WI(f);e=yield kK(a,b.f,e,f,h,c,d);if(0===f.length)f=[];else{var k=[],l=[];for(var m of f)RH(m.ba,_.Da)&&0<l.length&&(k.push(l),l=[]),l.push(m);k.push(l);f=k}for(m=0;m<f.length;m++)k=f[m],l=yield lK(a,b.f,k,h,e,c,d,g[g.length-1]||null,f.length),g.push(l),h+=k.length;mK(g);return g})},gK=function(a,b){return _.x(function*(){var c="EXT-X-MEDIA"!==b.name?!0:_.I(b,_.Kb)===GH;c=_.I(b,
59
+ _.Mb,void 0,{required:c});if(!c)return null;const d=UH(a.w,c),{response:e,text:f}=yield zJ(a,d);return AJ(a,f,e.uri,c)})},mK=function(a){if(1<(new Set(a.map(b=>b.mimeType))).size)throw new _.H(_.F,4,4045,"Media playlist contains discontinuities with different MIME types. This is valid, but not yet supported.");},nK=function(a){a=a.map(b=>b.a?b.a:b.f.map(c=>_.I(c,_.Mb))||null).map(b=>_.Ps(b));if(1<(new Set(a)).size)throw new _.H(_.F,4,4044,"Unexpected change in file format.");},oK=function(a,b,c){a=
60
+ OH(a.ba,_.Ha);if(1<a.length)throw new _.H(_.F,4,4020);a=a[0];if(!a)return null;const d=LH(a,_.Mb),e=UH(b,d);b=eI(a,null,!0);return new _.gH(()=>[e],b.xa,b.ma,c)},pK=function(a,b,c,d,e,f,g){const h=[];for(const q of _.iB(b.f)){b=q.rf;const u=q.item;{var k=0===b,l=k?a:h[h.length-1],m=k?d:l.endTime,n=Number(_.I(u,AH));n=m+n;k=eI(u,k?null:l.ma,k);l=_.I(u,_.Mb);const v=(l=UH(g,l))?[l]:[];m=new fI(c,m,n,()=>v,k.xa,k.ma,e,f,!1,null,null,null,null);if("YES"===_.I(u,"INDEPENDENT")||0===b)m.h=!0;h.push(m)}}return h},
61
+ qK=function(a,b,c,d,e,f,g,h,k,l,m){const n=c.ba;var q=c.a;0<OH(n,_.Ha).length&&(m=oK(c,k,g));const u=null!=q,v=q?[q]:[];if(!u&&!a.a.lowLatencyMode)return null;a=0;q={xa:0,ma:null};let y=null;u?({duration:c}=cI(n),a=e+c,q=bI(n,b?b.ma:null)):(b=pK(b,c,d,e,f,g,k),a=b[b.length-1].endTime,y=b);h=h===_.de?TH(n):null;d=new fI(d,e,a,()=>v,q.xa,q.ma,f,g,!1,null,h?h.Uc:null,h?h.ld:null,h?h.durationPerTile:null,y,m);d.ia=l;return d},kK=function(a,b,c,d,e,f,g){return _.x(function*(){var h=d[0];if(null!=a.A)return a.A;
62
+ if(!DJ(a)&&a.o)try{var k=a.f.get(c);var l=k?k.find(e)||null:null;if(!l)throw new _.H(_.F,4,4030,"Segment not found in pervious playlist update.");var m=l.startTime+l.Aa;a.g.debug(`Setting playlist start time to ${m}.`);return a.A=m}catch(n){if(h=a.f.get(c))m=h.streams[h.streams.length-1].V,m=m[m.length-1],a.g.warn(`Last #EXT-X-MEDIA-SEQUENCE values ${h.streams[0].V[0].position} - ${m.position}`+`, new values ${e} - ${e+d.length-1}.`,b,h);throw new _.H(_.F,4,4047,{message:"The updated playlist does not share any segments with the previous one.",
63
+ uri:c});}m=yield rK(a,f,g,h);k=XI(h.ba,a.w,m)||SI();l=oK(h,b,k.keyInfo);k=hI(k.keyInfo,e);h=yield sK(a,l,h,k,m,g);a.g.debug(`Setting playlist start time to ${h}.`);return a.A=h})},lK=function(a,b,c,d,e,f,g,h,k){return _.x(function*(){var l=c[0],m=null==h;nK(c);const n=yield rK(a,f,g,l);var q=a.w,u=h?h.Tg:null;var v=1===k;if(c.slice(1).some(VI))throw new _.H(_.F,4,4046,v?"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.");
64
+ if(RH(c[0].ba,_.Ga)||null===u)if((u=XI(c[0].ba,q,n))&&u.type===KH){if(1<ZI(c))throw new _.H(_.F,4,4046,HH+`${v?"playlist":"discontinuity"}.`);v=[u]}else v=YI(c,q,n),v=0===v.length?[SI()]:v;else if(q=YI(c,q,n),u.type===_.Ee||u.type===JH)v=[u,...q];else{if(0<ZI(c))throw new _.H(_.F,4,4046,HH+`${v?"playlist":"discontinuity"}.`);v=[u]}q=v;v=q[q.length-1];q=TI(q);u=oK(l,b,q.keyInfo)||(h?h.Ng:null);var y=hI(q.keyInfo,d);const B=l.ia;l=m?e:yield tK(a,B,u,l,d,y,n,g);m=[];for(y=0;y<c.length;y++){var D=c[y];
65
+ const M=m[m.length-1]||null,da=0===y?0:M.endTime,vb=d+y,Ub=hI(q.keyInfo,vb);if(D=qK(a,M,D,vb,da,l,Ub,f,b,B,u))u=D.initSegment,m.push(D)}return{V:m,pg:q,Tg:v,mimeType:n,endTime:m[m.length-1].endTime,ia:B,Ng:u}})},rK=function(a,b,c,d){return _.x(function*(){const e=d.a;var f=SH(d.ba,_.Ha);f=f?LH(f,_.Mb):null;return uK(a,b,c,e,f)})},sK=function(a,b,c,d,e,f){return _.x(function*(){if(null==c.a)return 0;const g=gI(c,d);return cJ(a.N,b,g,e,f,null!=d)})},tK=function(a,b,c,d,e,f,g,h){return _.x(function*(){if(a.I.has(b))return a.I.get(b);
66
+ const k=yield sK(a,c,d,f,g,h);a.g.debug(`Segment #${e} has raw media timestamp `+`${k} s.`);a.I.set(b,k);return k})},uK=function(a,b,c,d,e){return _.x(function*(){const f=[d,e].filter(Boolean);var g=_.Cj(f,b,c);if(g)return g;g=_.Si([d],a.a.attemptParameters);g.method="HEAD";g.type=2;g=(yield a.G(g)).headers["content-type"];if(!g)throw new _.H(_.F,4,4021,"Unknown MIME type of: "+f.join(", "));return g.split(";")[0]})},zI=class{constructor(a,b,c,d){if(1===b){if(!d||0===d.length)throw new _.H(_.F,4,
67
+ 4043,"Media playlist must have at least one segment!");if(null==d[0].a)throw new _.H(_.F,4,4043,"Media playlist must have at least one full segment!");}this.f=a;this.a="";this.type=b;this.ba=c;this.V=1===b?d:null}},FI=class{constructor(a,b,c){c=void 0===c?[]:c;this.ba=b;this.a=a;this.f=c;this.ia=-1}},fI=class extends _.bC{constructor(a,b,c,d,e,f,g,h,k,l,m,n,q,u,v){u=void 0===u?[]:u;super(a,b,c,d,e,f,g,void 0===h?null:h,void 0===k?!1:k,void 0===l?null:l,void 0===m?null:m,void 0===n?null:n,void 0===
68
+ q?null:q,u,void 0===v?null:v);this.ia=0}},vK=class{constructor(){this.f=0;this.a=new Map}},wK=class{constructor(){this.a=new Map;this.f=new Map}set(a,b){this.f.set(a,b);return b.then(c=>this.a.set(a,c)).catch(()=>{}).then(()=>this.f.delete(a))}has(a){return this.a.has(a)}get(a){return this.a.get(a)||null}values(){return Array.from(this.a.values())}clear(){this.f.clear();this.a.clear()}},IJ=new _.R("clpp.hls.DiscontinuityUtils");var aJ={"com.apple.streamingkeydelivery":function(a,b){if(b===_.lg)throw new _.H(_.F,4,4041);if(LH(a,EH)===FH)throw new _.H(_.F,4,4044,"EXT-X-KEY:METHOD SAMPLE-AES-CTR is not supported in FairPlay.");return _.dB(_.vd,[{initDataType:_.Jf,initData:new Uint8Array(0)}],"")},"com.microsoft.playready":RI,"urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":RI,"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":function(a){var b=LH(a,EH);if(!PI.includes(b))return QI.error("Widevine in HLS is only supported with [",
69
+ PI.join(", "),"], not",b),null;b=LH(a,_.Mb);b=_.as(b);b=_.J(b.data);b=_.dB(_.zd,[{initDataType:_.$c,initData:b}],"");if(a=_.I(a,"KEYID"))b.keyIds=[a.substr(2).toLowerCase()];return b}},PI=["SAMPLE-AES",FH],QI=new _.R("clpp.hls.DrmParser");var $I=new _.R("clpp.hls.EncryptionUtils");var xK=class{constructor(a){this.g=new _.R("clpp.hls.MediaReader");this.f=a;this.a={attemptParameters:_.Pi()}}};var $J=class{constructor(a){this.streams=a}length(){return this.streams.length}find(a){const b=this.streams.find(c=>{c=c.V;return c[0].position<=a&&a<=c[c.length-1].position});return null==b?null:b.V.find(c=>c.position===a)||null}};var YJ=class{constructor(a){this.a=a}length(){return this.a.length}};var yK=class{constructor(){this.a=this.D=null;this.O=1;this.f=new wK;this.w="";this.L=new vK;this.C=0;this.j=null;this.h=new _.Tj(()=>{this.Hb()});this.l=_.Tb;this.o=null;this.B=new _.Xs;this.A=null;this.g=new _.R("clpp.hls.HlsParser");this.I=new Map;this.N=new xK(this.G.bind(this));this.K=!1;this.H=null;this.J=!1;this.F=new Map}configure(a){this.a=a;this.N.a=a}setCurrentVariant(a){this.j=a}start(a,b){const c=this;return _.x(function*(){if(c.K)throw Error("start() may be called only once!");c.K=!0;
70
+ c.D=b;const {response:d,text:e}=yield zJ(c,a);c.w=d.uri;const f=yield FJ(c,e);c.o=f;const g=c.C;c.h&&0<g&&c.h.ha(g);return f})}requestStop(){this.J=!0}stop(){this.h&&(this.h.stop(),this.h=null);const a=[];this.B&&(a.push(this.B.destroy()),this.B=null);this.f.clear();this.o=this.a=this.D=this.j=null;this.F.clear();return Promise.all(a)}update(){const a=this;return _.x(function*(){const b=a.o;if(!DJ(a)&&b){var c=b.presentationTimeline;"LIVE"===a.l&&(a.A=null);var d=Array.from(a.f.values());if(a.a.lowLatencyMode&&
71
+ null!==a.j){const g=yJ(a);d=d.filter(h=>g.includes(nI(h).Ba))}var e=yield HJ(a,d);d=e.map(g=>g.playlist);JJ(a,d);e=yield MJ(a,e);kJ(b.periods,e).forEach(g=>{a.D.filterNewPeriod(g)});CJ(a,e);var f=NJ(a,d);f=OJ(a,d,f);EJ(a,f);nJ(b.periods,e);oJ(b.adaptedPeriods,e);xJ(c,e);if(d=XH(d))!0!==a.a.keepTimelineLive&&PJ(a,c,e),a.h.stop(),a.h=null;if(a.D.onUpdate)a.D.onUpdate(b);if(d&&a.D.onTurnedStatic)a.D.onTurnedStatic();a.J&&(yield a.stop())}})}Hb(){const a=this;return _.x(function*(){a.g.debug(_.rA);if(a.D)try{yield a.update(),
72
+ a.h&&0<a.C&&a.h.ha(a.C)}catch(b){if(!(b instanceof _.H))throw b;a.D&&(a.D.onError(b),1===b.severity&&a.h&&a.h.ha(.1))}})}G(a){if(!this.B)throw new _.H(_.F,7,7001);a=this.D.networkingEngine.fetch(a);_.Zi(this.B,a);return a.R}};_.z("clpp.hls.HlsComponent",class extends _.Yt{f(){_.Br.m3u8=yK;_.zr[_.Ok]=yK;_.zr[IH]=yK}a(){_.AC("m3u8");_.BC(_.Ok);_.BC(IH)}id(){return"hls"}});};f.call(g, window);
package/cl.hlssmpte.js CHANGED
@@ -1,5 +1,5 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var JR=function(a){a.a.one(a.m,_.me,()=>IR(a))},IR=function(a){const b=a.m.getSurface().getMedia();if(b)if(a.g){a.a.on(b.textTracks,_.tc,d=>KR(a,d));var c=Array.from(b.textTracks);c.filter(d=>d.kind===_.we).forEach(d=>{KR(a,{track:d})});!LR(c)&&a.l&&(a.h.warn("The metadata track is not present. Changing an audio track in order to enforce the creation of the metadata track."),MR(a,b))}else a.h.warn("The clpp.ttml.TextParser class is not available. Please register the ttml component first.");
2
- else a.h.warn("A video element is not available. Skipping.")},KR=function(a,b){b=b.track;b.kind===_.we&&(a.h.info("The metadata track has been added."),b.mode=_.$d,a.a.on(b,_.Cd,c=>NR(a,c)))},LR=function(a){return a.some(b=>b.kind===_.we)},MR=function(a,b){const c=a.m.getTrackManager(),d=c.la(),e=c.getAudioTracks().find(g=>g!==d);if(e){var f=()=>c.ta(d);a.a.on(b.textTracks,_.tc,g=>{g.track.kind===_.we&&(a.a.off(b.textTracks,_.tc,f),c.ta(d))});c.ta(e)}else a.h.warn("Can't enforce the creation of the metadata track if single audio track. Skipping.")},
3
- NR=function(a,b){const c=OR(a);c&&Array.from(b.target.activeCues||[]).forEach(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 PR(d);if(e.f===c&&null!==e.a){a.f=d;d=a.g.parseMedia(_.pi(e.a),{periodStart:a.j,segmentStart:e.startTime,segmentEnd:e.endTime});const f=a.m.getTextDisplayer();f.remove(0,e.startTime);f.append(d.cues,d.styles)}}})},OR=function(a){return(a=a.m.getTrackManager().qa())&&a.language&&a.language.toLowerCase()},
4
- PR=class{constructor(a){this.startTime=a.startTime;this.endTime=a.endTime;this.a=this.f=null;a=a.value;if(!_.A(a)){a:{var b=a.info;if(_.Tg(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=a=_.Tg(a)?a:null}}};var QR=class{constructor(a,b,c){this.m=a;this.l=b;this.j=c;this.a=new _.hs;this.g=(a=_.Wr(_.Dc))?new a(this.m.getConfiguration()):null;this.h=new _.R("clpp.hlssmpte.ImageCueHandler");this.f=null;JR(this)}destroy(){this.a.release();this.f=null;return Promise.resolve()}};var RR=class extends _.pu{constructor(){super();this.a=null;this.f=!1}onPlayerCreated(){}onContentWillLoad(a){if(this.f=_.ek()){var b=a.getConfiguration();b=_.Ng(b.hlssmpte||{});typeof b.patchMetadataTrack!==_.Pc&&(b.patchMetadataTrack=!1);_.Ug(b.timestampOffset)||(b.timestampOffset=0);this.a=new QR(a,b.patchMetadataTrack,b.timestampOffset)}}onPlayerWillDestroy(){const a=this;return _.x(function*(){a.a&&(yield a.a.destroy(),a.a=null)})}id(){return"hlssmpte"}};_.z("clpp.hlssmpte.HlsSmptePlugin",RR);
5
- RR.Id="hlssmpte";_.Yo(new class{create(){return new RR}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var UR=function(a){a.a.one(a.m,_.re,()=>TR(a))},TR=function(a){const b=a.m.getSurface().getMedia();if(b)if(a.h){a.a.on(b.textTracks,_.tc,d=>VR(a,d));var c=Array.from(b.textTracks);c.filter(d=>d.kind===_.ye).forEach(d=>{VR(a,{track:d})});!WR(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."),YR(a,b))}else a.g.warn("The clpp.ttml.TextParser class is not available. Please register the ttml component first.");
2
+ else a.g.warn("A video element is not available. Skipping.")},VR=function(a,b){b=b.track;b.kind===_.ye&&(a.g.info("The metadata track has been added."),b.mode=_.$d,a.a.on(b,_.Cd,c=>ZR(a,c)))},WR=function(a){return a.some(b=>b.kind===_.ye)},YR=function(a,b){const c=a.m.getTrackManager(),d=c.na(),e=c.getAudioTracks().find(g=>g!==d);if(e){var f=()=>c.wa(d);a.a.on(b.textTracks,_.tc,g=>{g.track.kind===_.ye&&(a.a.off(b.textTracks,_.tc,f),c.wa(d))});c.wa(e)}else a.g.warn("Can't enforce the creation of the metadata track if single audio track. Skipping.")},
3
+ ZR=function(a,b){const c=$R(a);c&&Array.from(b.target.activeCues||[]).forEach(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 aS(d);if(e.f===c&&null!==e.a){a.f=d;d=a.h.parseMedia(_.si(e.a),{periodStart:a.j,segmentStart:e.startTime,segmentEnd:e.endTime});const f=a.m.getTextDisplayer();f.remove(0,e.startTime);f.append(d.cues,d.styles)}}})},$R=function(a){return(a=a.m.getTrackManager().ua())&&a.language&&a.language.toLowerCase()},
4
+ aS=class{constructor(a){this.startTime=a.startTime;this.endTime=a.endTime;this.a=this.f=null;a=a.value;if(!_.A(a)){a:{var b=a.info;if(_.Wg(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=a=_.Wg(a)?a:null}}};var bS=class{constructor(a,b,c){this.m=a;this.l=b;this.j=c;this.a=new _.ts;this.h=(a=_.hs(_.Dc))?new a(this.m.getConfiguration()):null;this.g=new _.R("clpp.hlssmpte.ImageCueHandler");this.f=null;UR(this)}destroy(){this.a.release();this.f=null;return Promise.resolve()}};var cS=class extends _.Au{constructor(){super();this.a=null;this.f=!1}onPlayerCreated(){}onContentWillLoad(a){if(this.f=_.hk()){var b=a.getConfiguration();b=_.Qg(b.hlssmpte||{});typeof b.patchMetadataTrack!==_.Pc&&(b.patchMetadataTrack=!1);_.Xg(b.timestampOffset)||(b.timestampOffset=0);this.a=new bS(a,b.patchMetadataTrack,b.timestampOffset)}}onPlayerWillDestroy(){const a=this;return _.x(function*(){a.a&&(yield a.a.destroy(),a.a=null)})}id(){return"hlssmpte"}};_.z("clpp.hlssmpte.HlsSmptePlugin",cS);
5
+ cS.Id="hlssmpte";_.dp(new class{create(){return new cS}});};f.call(g, window);